agent-log-viewer 0.9.2 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -6
- package/dist/standalone/.next/BUILD_ID +1 -1
- package/dist/standalone/.next/app-path-routes-manifest.json +8 -5
- package/dist/standalone/.next/build-manifest.json +2 -2
- package/dist/standalone/.next/prerender-manifest.json +3 -3
- package/dist/standalone/.next/routes-manifest.json +20 -0
- package/dist/standalone/.next/server/app/_global-error/page.js +3 -3
- package/dist/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found/page.js +2 -2
- package/dist/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/standalone/.next/server/app/_not-found.rsc +2 -2
- package/dist/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/api/access/route.js +1 -1
- package/dist/standalone/.next/server/app/api/answer/route.js +1 -1
- package/dist/standalone/.next/server/app/api/answer/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/files/route.js +1 -1
- package/dist/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/flows/[id]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/flows/[id]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/flows/route.js +1 -1
- package/dist/standalone/.next/server/app/api/flows/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/image/route.js +1 -0
- package/dist/standalone/.next/server/app/api/image/route.js.nft.json +1 -0
- package/dist/standalone/.next/server/app/api/image/route_client-reference-manifest.js +1 -0
- package/dist/standalone/.next/server/app/api/inbox/route.js +2 -2
- package/dist/standalone/.next/server/app/api/limits/route.js +2 -2
- package/dist/standalone/.next/server/app/api/log/route.js +1 -1
- package/dist/standalone/.next/server/app/api/log/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/logs/route.js +1 -1
- package/dist/standalone/.next/server/app/api/logs/stream/route.js +2 -2
- package/dist/standalone/.next/server/app/api/proc/route.js +1 -1
- package/dist/standalone/.next/server/app/api/proc/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/push/route.js +1 -1
- package/dist/standalone/.next/server/app/api/resources/route.js +1 -1
- package/dist/standalone/.next/server/app/api/resources/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/session/route.js +1 -0
- package/dist/standalone/.next/server/app/api/session/route.js.nft.json +1 -0
- package/dist/standalone/.next/server/app/api/session/route_client-reference-manifest.js +1 -0
- package/dist/standalone/.next/server/app/api/spawn/route.js +1 -1
- package/dist/standalone/.next/server/app/api/spawn/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/assignment/route.js +2 -0
- package/dist/standalone/.next/server/app/api/tasks/[id]/assignment/route.js.nft.json +1 -0
- package/dist/standalone/.next/server/app/api/tasks/[id]/assignment/route_client-reference-manifest.js +1 -0
- package/dist/standalone/.next/server/app/api/tasks/[id]/route.js +2 -2
- package/dist/standalone/.next/server/app/api/tasks/[id]/send/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/send/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/spawn/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tasks/[id]/spawn/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tasks/route.js +2 -2
- package/dist/standalone/.next/server/app/api/timeline/route.js +1 -1
- package/dist/standalone/.next/server/app/api/timeline/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tmux/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tmux/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/tmux/targets/route.js +1 -1
- package/dist/standalone/.next/server/app/api/tmux/targets/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/transcribe/backend/route.js +2 -2
- package/dist/standalone/.next/server/app/api/transcribe/route.js +2 -2
- package/dist/standalone/.next/server/app/api/transcribe/token/route.js +2 -2
- package/dist/standalone/.next/server/app/api/workflows/[id]/route.js +1 -1
- package/dist/standalone/.next/server/app/api/workflows/[id]/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/api/workflows/route.js +1 -1
- package/dist/standalone/.next/server/app/api/workflows/route.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/favicon.ico/route.js +1 -1
- package/dist/standalone/.next/server/app/index.html +1 -1
- package/dist/standalone/.next/server/app/index.rsc +3 -3
- package/dist/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/dist/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/page.js +3 -3
- package/dist/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app-paths-manifest.json +8 -5
- package/dist/standalone/.next/server/chunks/747.js +4 -0
- package/dist/standalone/.next/server/functions-config-manifest.json +3 -0
- package/dist/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/standalone/.next/server/middleware.js +3 -3
- package/dist/standalone/.next/server/pages/404.html +1 -1
- package/dist/standalone/.next/server/pages/500.html +1 -1
- package/dist/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/standalone/.next/static/chunks/647-0b14204033b8658c.js +1 -0
- package/dist/standalone/.next/static/chunks/app/_global-error/page-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/access/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/answer/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/files/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/flows/[id]/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/flows/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/image/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/inbox/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/limits/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/log/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/logs/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/logs/stream/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/proc/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/push/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/resources/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/session/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/spawn/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/assignment/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/send/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/spawn/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tasks/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/timeline/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tmux/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/tmux/targets/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/transcribe/backend/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/transcribe/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/transcribe/token/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/workflows/[id]/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/api/workflows/route-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/app/page-b426c6e1a9f3e519.js +2 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-8e401bb1ec1877d8.js +1 -0
- package/dist/standalone/.next/static/css/295fa360d6757865.css +1 -0
- package/dist/standalone/.next/static/wmbQhT2Jcsq6xxtW3NUD-/_buildManifest.js +1 -0
- package/dist/standalone/package.json +1 -1
- package/package.json +1 -1
- package/dist/standalone/.next/server/chunks/51.js +0 -4
- package/dist/standalone/.next/static/MaaC1l53KzO-zgt5mGBIv/_buildManifest.js +0 -1
- package/dist/standalone/.next/static/chunks/680-e2cc45e50038da25.js +0 -1
- package/dist/standalone/.next/static/chunks/app/_global-error/page-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/access/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/answer/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/files/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/flows/[id]/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/flows/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/inbox/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/limits/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/log/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/logs/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/logs/stream/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/proc/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/push/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/resources/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/spawn/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/send/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/spawn/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tasks/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/timeline/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tmux/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/tmux/targets/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/transcribe/backend/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/transcribe/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/transcribe/token/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/workflows/[id]/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/api/workflows/route-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/app/page-bdda213b08e4faa2.js +0 -2
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-11aa81424c7de845.js +0 -1
- package/dist/standalone/.next/static/css/2db772af912b50a7.css +0 -1
- /package/dist/standalone/.next/static/{MaaC1l53KzO-zgt5mGBIv → wmbQhT2Jcsq6xxtW3NUD-}/_ssgManifest.js +0 -0
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{7657:(e,t,n)=>{"use strict";n.d(t,{Viewer:()=>s2});var r=n(5155),i=n(1012),s=n(233),l=n(9005),a=n(2115);let o={en:{"common.serverUnavailable":"server unavailable","common.loading":"loading…","common.loadingCap":"Loading…","common.cancel":"Cancel","common.show":"show","common.showAll":"show all","common.collapse":"collapse","common.copy":"Copy","common.copied":"copied","common.clickToCopy":"click to copy","common.yes":"Yes","common.no":"No","common.send":"Send","common.sending":"sending…","common.sent":"sent","common.close":"Close","common.failedSend":"couldn't send","common.failedDelete":"couldn't delete","common.nothingFound":"Nothing found","common.nothingRunning":"nothing is running right now","common.kb":"kB","common.chars":"{n} chars","lang.aria":"Interface language","util.effortTitle":"Reasoning effort: {effort}","time.agoSec":"{n}s ago","time.agoMin":"{n}m ago","time.agoHour":"{n}h ago","time.agoDay":"{n}d ago","kind.session":"session","kind.subagent":"subagent","kind.job":"job","kind.background":"background","kind.handoff":"handoff","rail.title":"Agent logs","rail.filter":"Filter projects…","rail.projects":"Projects","rail.overview":"Overview","rail.archive":"Archive","dash.branchesLive":{one:"{count} branch running",other:"{count} branches running"},"dash.trees":{one:"{count} tree",other:"{count} trees"},"dash.recentConvos":{one:"{count} recent conversation",other:"{count} recent conversations"},"dash.quietTrees":{one:"{count} quiet tree",other:"{count} quiet trees"},"dash.openProjects":"Open project list","dash.unarchive":"Restore from archive","dash.newConvo":"New conversation with an agent","dash.agent":"Agent","dash.newWorkflow":"New workflow: stages → review → PR","dash.workflow":"Workflow","dash.emptyTitle":"The scheme is empty for now","dash.emptyHint":"Open the switchboard in the bottom-right corner and click a conversation — it will appear here","trash.title":"The scheme is empty, but the project has records","trash.hint":"Clicking a row opens the conversation as a node; the trash icon deletes its file from disk permanently.","trash.deletedFromDisk":"\xb7 deleted from disk","trash.open":"Open {title}","trash.toArchive":"Archive","trash.notDeleted":"{failed} of {total} not deleted","trash.confirmDelete":{one:"Delete {count} project file from disk?",other:"Delete {count} project files from disk?"},"trash.deleting":"deleting…","trash.confirmYes":"Yes, delete","trash.deleteProject":"Delete project from disk","switch.aria":"Agent switchboard","switch.title":"Switchboard","switch.search":"Search by name or project","switch.updating":"updating…","switch.close":"Close switchboard","switch.waiting":"Waiting for you","switch.working":"Working","switch.recent":"Recent","switch.older":"Older","switch.hidden":"Hidden ({count})","switch.hide":"hide","switch.restore":"restore","switchCard.openColumn":"Open {title} as a column","switchCard.remove":"Remove from switchboard","composer.imagesCount":{one:"{count} image",other:"{count} images"},"composer.spawned":"launched agent in tmux {target}","composer.sentPaths":"sent {count} path(s)","composer.failedInterrupt":"couldn't interrupt","composer.escapeSent":"sent Escape — agent interrupted","composer.spawnAria":"Launch an agent with a prompt in tmux","composer.sendAria":"Send a message to the agent in tmux {target}","composer.queueAria":"Queue of sent messages","composer.removeFromQueue":"Remove from queue","composer.placeholderRelay":"type — I'll relay through the root session…","composer.placeholderSpawn":"prompt — the agent will start in tmux…","composer.placeholderSend":"message the agent…","composer.textAria":"Text for the agent","composer.titleRelay":"relayed through the branch's root session","composer.titleSpawnResumed":"new tmux window with the resumed agent","composer.root":"root","composer.interruptAria":"Interrupt the agent (Escape)","composer.interruptTitle":"send Escape to the agent pane","composer.compactAria":"Compact the agent's context (/compact)","composer.compactTitle":"send /compact — the agent condenses its context; a band appears in the feed when done","composer.compactConfirm":"Compact?","composer.compactConfirmTitle":"Click again to send /compact","composer.compactSent":"compaction started — the band will appear in the feed once it's done","composer.failedCompact":"couldn't start compaction","composer.addImages":"Add images","composer.moreTools":"More actions","composer.stopAndSend":"Stop recording and send","composer.launchAgent":"Launch the agent","composer.sendToAgent":"Send to the agent","composer.stopAndSendTitle":"stop recording and send","draft.readPrompt":"Read the agent conversation in file {src} and continue from there: ","draft.needDir":"specify a working directory","draft.launchFailed":"couldn't launch","draft.paneAria":"Draft of a new agent conversation","draft.notStarted":"agent not started yet","draft.engineAria":"Agent engine","draft.handoffLabel":"handoff: {title}","draft.newConvo":"new conversation","draft.conversation":"conversation","draft.dismiss":"Dismiss the draft conversation","draft.directory":"directory","draft.dirAria":"Agent working directory","draft.reasoning":"reasoning","draft.reasoningAria":"Reasoning effort level","draft.effortDefault":"effort: default","draft.speedAria":"Codex speed mode","draft.speedTitle":"fast = priority tier (1.5x speed, higher usage)","draft.speedDefault":"speed: default","draft.imagesOnly":"(images)","draft.launched":"agent launched in tmux {target} — waiting for the conversation to appear here…","draft.slow":"Taking a while. Check tmux window {target} — the panel will pick up the transcript as soon as it appears.","draft.hintRelay":"The new agent will first read the parent conversation's transcript and pick up from there. Add to the prompt what to do next — the branch will appear on the scheme alongside.","draft.hintNew":"Choose an engine and a directory, write the first prompt — the agent will start in tmux, and the conversation will continue in this same panel.","draft.promptAria":"First prompt for the new agent","draft.placeholder":"first prompt — the agent will start in tmux…","draft.promptTextAria":"First prompt text","draft.newWindowTitle":"new tmux window with a fresh agent","draft.newAgent":"new agent","draft.addImages":"Add images to the prompt","draft.stopAndLaunch":"Stop recording and launch the agent","link.handoffContext":"You've been handed another agent's context — the conversation \xab{title}\xbb. Its transcript: {path} — read that file first for full context, then carry out the request below.\n\n{ask}","link.dropped":"context is in the composer of \xab{title}\xbb — type the ask and send","handoff.aria":"Hand the conversation to a new agent — a draft appears below","handoff.title":"click — draft a new agent with this context \xb7 drag — link to an existing one","handoff.label":"hand off to agent","qr.showAria":"Show a QR code for phone login","qr.failed":"couldn't get the link","qr.startHint":"Start the viewer with Tailscale access: ","qr.alt":"QR code for phone login","qr.generating":"generating QR…","qr.linkAria":"Phone login link","qr.copy":"Copy link","qr.scanHint":"scan from a phone on the same tailnet","push.enabled":"Push notifications enabled","push.enable":"Enable push notifications","push.disable":"Disable push notifications","push.needsHttps":"Push requires HTTPS","sound.on":"Sound notifications on","sound.off":"Sound notifications off","sound.mute":"Mute sound notifications","sound.unmute":"Enable sound notifications","mic.stopRecognize":"Stop recording and transcribe","mic.cancel":"Cancel recording","mic.recognizing":"Transcribing…","mic.dictate":"Dictate","mic.dictateHint":"dictate (up to 2 min) \xb7 right-click: transcription method","mic.connecting":"Connecting the microphone — a moment…","mic.menuTitle":"Transcription method","mic.menuLoading":"checking what's available…","mic.menuLocked":"Locked by the LLV_TRANSCRIBE_BACKEND environment variable","mic.noKey":"not set up","mic.saveFailed":"couldn't save the choice","mic.keyTitle":"{name} is not set up","mic.copy":"copy","mic.copyPath":"Copy path","mic.copied":"copied","mic.back":"Back","stt.local.name":"Faster Whisper","stt.local.desc":"Free, fully local — audio never leaves this machine.","stt.local.fix":"Run scripts/setup-whisper.sh in the app folder once; it installs the local engine at:","stt.chatgpt.name":"ChatGPT Voice","stt.chatgpt.desc":"Covered by your ChatGPT subscription, via the Codex login.","stt.chatgpt.fix":"Log in to Codex (run `codex login`) — the token will appear at:","stt.elevenlabs.name":"ElevenLabs Scribe","stt.elevenlabs.desc":"Paid ElevenLabs API — the most accurate option.","stt.elevenlabs.fix":"Put your ElevenLabs API key (a single line) into this file:","delFile.confirm":"Delete from disk?","delFile.aria":"Delete the conversation from disk","img.readFailed":"couldn't read the image","img.readAborted":"image reading aborted","img.unsupported":"unsupported image format: {name}","img.unknownFile":"unknown file","img.tooLarge":"{name}: too large (10 MB limit)","img.image":"image","img.error":"image error","img.previewAlt":"image preview {n}","img.removeAria":"Remove image {n}","img.toFilePaths":"as file paths","question.sec":"{n} s","question.min":"{n} min","question.hour":"{n} h","question.waiting":"waiting for a reply","question.sentToPane":"Sent to the pane: {text}","question.keysHint":"keys into the pane \xb7 or the composer below","question.pane":"Pane {target}","question.alreadyAnswered":"answer already recorded","question.openFailed":"couldn't open the session","question.opened":"opened {target}","question.answered":"Answered: {text}","question.answeredElsewhere":"Answered elsewhere: {text}","question.noPane":"tmux pane unavailable","question.openSession":"open session","question.rejectComment":"Rejection comment…","question.approved":"approved","question.rejected":"rejected","question.approve":"Approve","question.reject":"Reject","question.ownAnswer":"Your own answer…","inbox.deleted":"deleted from disk","inbox.fileGone":"the file is no longer on disk","inbox.confirmDelete":"Delete the file from disk?","inbox.deleteAria":"Delete {name} from disk","inbox.deleteFromDisk":"delete from disk","inbox.attachedAlt":"attached image {name}","lightbox.zoomOut":"Zoom out","lightbox.resetZoom":"Reset zoom","lightbox.zoomIn":"Zoom in","feed.agentEnded":"agent finished","feed.copyCode":"Copy code","feed.copyMd":"Copy message (Markdown)","feed.running":"running {tool}…","feed.tool":"tool","feed.thinking":"thinking…","feed.working":"working…","feed.liveTail":"live tail","feed.backToLive":"Back to the live tail","feed.newCount":"{count} new","feed.down":"down","feed.pickLog":"Pick a log on the left — the feed updates itself","feed.showEarlier":"show earlier","feed.showEarlierHidden":"show earlier (hidden {count})","feed.loadEarlier":"load earlier from the file","feed.startOfConvo":"start of the conversation","feed.finishedTurn":"finished the turn — waiting for a reply","feed.returnedResult":"returned with a result","feed.noOutput":"No output yet — the file is empty for now","feed.onlyService":"Only service records are present ({count}).","feed.empty":"Empty (no rows to show)","render.system":"system","render.executing":"executing…","render.error":"error","render.teammate":"teammate","render.left":"{peer}: left{at}","render.codexSessionCreated":"Codex session created","render.taskStarted":"Task started","render.taskComplete":"Task completed","render.compacted":"context compacted","render.compactAuto":"auto","render.compactManual":"manual","render.compactPre":"{n}k tokens before","render.compactSummary":"conversation summary","render.patch":"patch","render.stdinSession":"stdin → session {id}","render.record":"record","render.protocol":"protocol","render.jobLogNote":"(this is a job log: it has no command stdout; the full output is in the Codex rollout session in the left list)","render.image":"image","render.dataKb":"{n} kB of data","render.commands":{one:"{count} command",other:"{count} commands"},"render.noFindings":"no findings","render.moreFindings":"{count} more findings in raw","render.memoryCitations":"memory citations ({count})","render.noCitations":"no citation entries","render.moreEntries":"{count} more entries in raw","render.truncated":"truncated","render.shutdownRequest":"shutdown request","render.shutdownResponse":"shutdown response","render.planRequest":"plan approval request","render.planVerdict":"plan verdict","render.approved":"approved","render.rejected":"rejected","render.from":"from {from}","render.structured":"structured message","render.showJson":"show JSON","render.noOutputInLog":"(output is absent from this log file — the full output is in the Codex rollout session)","render.filesChanged":"files changed","render.toDir":"to","render.fromDir":"from","render.delivered":"delivered","render.notDelivered":"not delivered","render.reasoning":"agent reasoning","flowDialog.engine":"Engine: {label}","flowDialog.modelPlaceholder":"model (default)","flowDialog.model":"Model: {label}","flowDialog.effortDefault":"effort: default","flowDialog.createFailed":"couldn't create the flow ({status})","flowDialog.title":"Start a flow","flowDialog.subtitle":"implement → review \xb7 this conversation becomes the implementer","flowDialog.preset":"preset","flowDialog.rolesManualOpen":"▾ roles manually","flowDialog.rolesManual":"▸ roles manually (model / effort)","flowDialog.implementer":"implementer","flowDialog.reviewer":"reviewer","flowDialog.diffBase":"diff base","flowDialog.fromHead":"from current HEAD","flowDialog.fromMergeBase":"from merge-base with main","flowDialog.headless":"headless (no pane)","flowDialog.tmuxPane":"tmux pane","flowDialog.transitions":"transitions","flowDialog.auto":"auto","flowDialog.manual":"manual (gate every step)","flowDialog.roundLimit":"round limit","flowDialog.creating":"creating…","flowDialog.start":"▶ Start","flowStrip.startReview":"Start review","flowStrip.spawnReviewer":"Spawn reviewer","flowStrip.relayNotes":"Relay notes","flowStrip.retryRound":"Retry round","flowStrip.anotherRound":"Another round","flowStrip.flow":"FLOW","flowStrip.roundsAria":"Review rounds","flowStrip.roundError":"Round {n}: {error}","flowStrip.roundVerdict":"Round {n}: {verdict}","flowStrip.roundInProgress":"Round {n}: in progress","flowStrip.addRoundsTitle":"Add more rounds to the limit","flowStrip.plus2":"+2 rounds","flowStrip.limitTitle":"Round limit: reviews before the loop parks (∞ — unlimited)","flowStrip.limitAria":"Set the round limit to {count}","flowStrip.limitUnlimitedAria":"Unlimited rounds","flowStrip.stopReviewer":"Stop","flowStrip.stopReviewerTitle":"Stop the running reviewer; the round lands in “needs decision”","flowStrip.notePlaceholder":"note for the reviewer…","flowStrip.noteTitle":"Sent to the next reviewer as the round's ready note","flowStrip.autoTitle":"Auto: transitions run themselves. Click — manual.","flowStrip.manualTitle":"Manual: every transition waits for a click. Click — auto.","flowStrip.manualShort":"manual","flowStrip.resume":"Resume flow","flowStrip.pause":"Pause","flowStrip.close":"Close flow","roundDeck.roundAborted":"Round {n} \xb7 aborted","roundDeck.roundVerdict":"Round {n} \xb7 {verdict}","roundDeck.roundInProgress":"Round {n} \xb7 in progress","roundDeck.aborted":"aborted","roundDeck.reviewInProgress":"review in progress","roundDeck.waitingFirst":"waiting for the first review round…","roundDeck.spawningReviewer":"launching the reviewer — the transcript will appear shortly…","roundDeck.moreRounds":"{count} more round(s) — click the chips on the flow strip","roundDeck.findings":{one:"{count} finding",other:"{count} findings"},"flowState.waiting_ready":"waiting for READY","flowState.spawn_pending":"ready to spawn the reviewer","flowState.spawning":"spawning the reviewer","flowState.reviewing":"reviewing","flowState.relay_pending":"verdict ready — relay?","flowState.relaying":"relaying notes","flowState.fixing":"fixing","flowState.approved":"approved","flowState.done_comment":"done with comments","flowState.needs_decision":"needs a decision","flowState.paused":"paused","flowState.closed":"closed","flowModel.failed":"failed ({status})","wfState.provisioning":"provisioning the worktree","wfState.implementing":"stages running","wfState.reviewing":"reviewing","wfState.finishing":"finishing","wfState.approved":"approved","wfState.needs_decision":"needs a decision","wfState.paused":"paused","wfState.closed":"closed","wfModel.failed":"failed ({status})","wfStrip.workflow":"WORKFLOW","wfStrip.stagesAria":"Workflow stages","wfStrip.reviewStage":"review","wfStrip.advance":"Advance","wfStrip.retryStage":"Retry stage","wfStrip.skipStage":"Skip","wfStrip.resume":"Resume workflow","wfStrip.pause":"Pause","wfStrip.close":"Close workflow","wfDraft.paneAria":"Draft of a new workflow","wfDraft.notStarted":"the workflow is not launched yet","wfDraft.newWorkflow":"new workflow","wfDraft.dismiss":"Dismiss the workflow draft","wfDraft.template":"template","wfDraft.templateAria":"Workflow template","wfDraft.repo":"repository","wfDraft.repoAria":"Repository directory","wfDraft.manualMode":"manual: a gate at every stage boundary","wfDraft.hint":"Pick a template and a repository, describe the task — the workflow creates a worktree, runs the stages and the review, then opens a PR.","wfDraft.taskPlaceholder":"the task for the workflow — the brief goes to every stage…","wfDraft.taskAria":"Workflow task brief","wfDraft.footerHint":"worktree \xb7 stages \xb7 review \xb7 PR","wfDraft.finishMerge":"local merge","wfDraft.needDir":"set the repository directory","wfDraft.needTask":"describe the task","wfDraft.launchFailed":"launch failed","wfDraft.launch":"▶ Launch workflow","wfDraft.launching":"launching…","scheme.flowTitle":"Run the implement → review cycle for this conversation","scheme.flow":"Flow","scheme.collapsedTitle":"Collapsed branches and tasks of this conversation","scheme.underneath":"underneath","scheme.handTool":"Hand — drag the canvas (H, or hold Space)","scheme.selectTool":"Select — click and work with conversations (V)","scheme.zoomOut":"Zoom out (−)","scheme.zoom100":"Zoom 100% (1)","scheme.zoomIn":"Zoom in (+)","scheme.fit":"Fit all (0, or double-click the background)","scheme.roleImplementer":"Implementer","scheme.roleReviewer":"Reviewer","scheme.roleWorking":"working","scheme.roleWaiting":"waiting","scheme.lassoTool":"Multi-select — draw a box around agents, click cards to toggle","bulk.selectedCount":{one:"{count} selected",other:"{count} selected"},"bulk.placeholder":"one message to every selected agent…","bulk.textAria":"Broadcast text for the selected agents","bulk.sendAll":"Send to {count} agents","bulk.interrupt":"Interrupt","bulk.stop":"Stop","bulk.stopConfirm":"Stop {count} agents?","bulk.remove":"Clear from board","bulk.removeConfirm":"Close {count} cards?","bulk.flow":"Flow","bulk.fit":"Show selection","bulk.exit":"Exit selection (Esc)","bulk.retryFailed":"Retry failed ({count})","bulk.nodeGone":"node left the board","bulk.flowTitle":"Start a review flow on {count} agents","bulk.flowStart":"Start {count} flows","minimap.title":"Minimap — click or drag to navigate","plan.agentPlan":"Agent plan:","plan.stepsAria":"Plan: {done} of {total} steps","plan.nowSuffix":", now: {current}","plan.goal":"goal","plan.goalDone":"goal ✓","plan.goalBlocked":"goal ✖","plan.noObjective":"(objective not recorded in the transcript tail)","plan.tokens":"tokens: {n}","plan.time":"time: {n} min","plan.ctxTitle":"Context window: {pct}% used\n{used} of {window} tokens","plan.ctxAria":"Context: {pct} percent of the window used","plan.goalAria":"Session goal: {status}","limits.now":"now","limits.inMin":"in {n}m","limits.inHour":"in {n}h","limits.inDay":"in {n}d","limits.asOf":"as of {time}","limits.left":"left","limits.reset":"reset {eta} \xb7 {at}","limits.stale":"data is stale: {stale}","limits.5h":"5h","limits.week":"Week","resources.ram":"RAM","resources.swap":"Swap","resources.free":"{amount} free","resources.used":"{amount} used","resources.stale":"resource data is stale: {stale}","resources.openAria":"Agent sessions and memory","resources.title":"Agent sessions","resources.total":"Σ {amount}","resources.empty":"no agent sessions in tmux","resources.orphan":"orphan pane","resources.procs":{one:"{count} process",other:"{count} processes"},"resources.swapShare":"+ {amount} swap","resources.kill":"Kill","resources.confirm":"Sure?","resources.killLiveHint":"the agent is working right now — click to unlock, then confirm","resources.killHint":"kill the tmux pane with its whole process tree","resources.bulkLabel":"idle longer than","resources.bulkKill":"Kill idle","resources.bulkNone":"nothing has been idle that long","resources.hoursN":"{n} h","resources.close":"Close","status.awaitingPlan":"awaiting plan approval","status.awaitingAnswer":"awaiting an answer to a question","status.awaitingTerminal":"awaiting a reply in the terminal","status.working":"working…","status.returnedResult":"returned with a result","status.stalled":"interrupted or awaiting permission","status.finishedTurn":"finished the turn — waiting for a reply","status.flow":"flow: {label}","dictation.failed":"couldn't transcribe","dictation.silence":"silence — nothing recognized","dictation.unsupported":"recording is not supported in this browser","dictation.liveError":"live transcription error","dictation.connectionLost":"transcription connection dropped","dictation.noMic":"no microphone access","overview.branchesLiveIn":{one:"{count} branch running in {projects}",other:"{count} branches running in {projects}"},"overview.projects":{one:"{count} project",other:"{count} projects"},"overview.archived":"\xb7 {count} archived","overview.moreLive":"{count} more live","overview.quiet":"quiet \xb7 last activity {age}","overview.empty":"No logs yet","branch.live":"working","branch.waiting":"finished the turn — waiting for a reply","branch.returned":"returned with a result","branch.stalled":"interrupted or awaiting permission","branch.done":"done — safe to remove","branch.worktree":"Worktree {name}","branch.lastActivity":"Last activity: {age}","branch.lastActivityQuiet":"Marked active, but the transcript is quiet: last activity {age}","branch.handoffTitle":"agent spawned by this conversation's handoff","branch.branchTitle":"branch of this conversation","branch.removeColumn":"Remove column {title}","branch.toggleBackground":"{action} background task {title}","branch.collapse":"Collapse","branch.expand":"Expand","branch.expandFull":"Expand conversation {title} to the full window","branch.collapseFull":"Back to the canvas (Esc)","tree.quiet":"Quiet conversations and tasks","corner.waitingCount":"\xb7 {count} waiting","corner.openSwitchboard":"Open the agent switchboard","task.working":", working","task.interrupted":", interrupted","task.finished":", finished","task.interruptedBadge":"interrupted","task.finishedBadge":"finished","task.stopFailed":"couldn't stop","task.signalSent":"sent {signal} to PID {pid}","task.confirmKill":"Really kill PID {pid}?","task.killPid":"Kill {pid}","task.confirmKillYes":"Yes, kill","task.stopAria":"Stop process PID {pid}","task.kill":"Kill","task.jobLogHint":"This is a short job log (service events only). Codex's real work is in the full session:","task.openCodexSession":"Open Codex session ({size} kB{activity})","task.rolloutMissing":"This is a short job log. The full Codex rollout session hasn't appeared in the list yet","task.backgroundCommand":"Background command","task.commandNotFound":"The command that started this background task wasn't found in the session transcripts","viewer.closeProjects":"Close the project list","viewer.agentWaiting":"Agent is waiting for a reply","viewer.closeNotification":"Close the notification","attention.badge":{one:"{count} waiting",other:"{count} waiting"},"attention.openQueue":"Attention queue — who is blocked on you (N — next)","attention.popoverTitle":"Waiting on you","attention.filterOn":"Show only those waiting on you (F)","attention.filterOff":"Show all nodes (F)","mobile.noConvos":"No conversations yet","mobile.map":"Map","mobile.closeMap":"Close the map","mobile.tapNode":"Tap a node — the conversation opens full-screen","mobile.agent":"agent","mobile.openMap":"Open the project map","tasks.failed":"failed ({status})","tasks.tool":"Task — the next click drops a card on the canvas (T)","tasks.untitled":"untitled","tasks.newPlaceholder":"task text… (the first line is the title)","tasks.editAria":"Task text","tasks.spawning":"starting…","tasks.deadChip":"the conversation is gone from the list","tasks.retry":"retry delivery","tasks.chipFailedTitle":"not delivered: {error}","tasks.send":"send","tasks.sendTitle":"Pull the arrow onto an agent's pane to deliver the task there; drop it on empty canvas to spawn a fresh agent. A click opens the list","tasks.linkSent":"task sent → “{title}”","tasks.spawn":"agent","tasks.spawnTitle":"Spawn a fresh agent with this task as the brief","tasks.spawnGo":"Launch","tasks.statusTitle":"Status: {label} — click cycles (inbox → assigned → blocked → done)","tasks.statusPrefix":"status","tasks.status.inbox":"inbox","tasks.status.assigned":"assigned","tasks.status.blocked":"blocked","tasks.status.done":"done","tasks.delete":"delete","tasks.deleteConfirm":"sure?","tasks.deleteAria":"Delete task {title}","tasks.pickerTitle":"Send to","tasks.pickerAllChildren":"⤷ all children","tasks.pickerEmpty":"no conversations in the project","tasks.pickerSend":"Send ({count})","tasks.sendOk":"Delivered {delivered} of {total}","tasks.sendFailPart":"✗ “{title}”: {error}","tasks.spawnOk":"agent started in tmux {target}","tasks.composerToggle":"create a task","tasks.composerToggleTitle":"On — the text becomes a tracked task card assigned to the selection; off — a plain broadcast with no trace","tasks.composerNeedsText":"a task needs text","tasks.panelTitle":"Tasks","tasks.panelToggleAria":"Toggle the task panel","tasks.panelThisProject":"this project","tasks.panelAll":"all","tasks.panelEmpty":"no tasks yet — drop one with the board's task tool (T)","tasks.panelClose":"Close the task panel","tasks.sheetNew":"new task","tasks.sheetCreate":"Create the task","tasks.sheetBack":"Back to the task list","tasks.sheetTargets":{one:"{count} target",other:"{count} targets"},"tasks.sheetAssignments":"assignments","tasks.sheetEmpty":"no tasks yet","tasks.sheetGone":"the task is gone","tasks.textNotSaved":"the text didn't save — delivery aborted, try again","tasks.emptyTextBlocked":"empty text isn't saved — restore the task text before sending"},uk:{"common.serverUnavailable":"сервер недоступний","common.loading":"завантаження…","common.loadingCap":"Завантаження…","common.cancel":"Скасувати","common.show":"показати","common.showAll":"показати все","common.collapse":"згорнути","common.copy":"Копіювати","common.copied":"скопійовано","common.clickToCopy":"клік — скопіювати","common.yes":"Так","common.no":"Ні","common.send":"Надіслати","common.sending":"надсилаю…","common.sent":"надіслано","common.close":"Закрити","common.failedSend":"не вдалося надіслати","common.failedDelete":"не вдалося видалити","common.nothingFound":"Нічого не знайдено","common.nothingRunning":"зараз нічого не працює","common.kb":"кБ","common.chars":"{n} симв.","lang.aria":"Мова інтерфейсу","util.effortTitle":"Зусилля міркування: {effort}","time.agoSec":"{n} с тому","time.agoMin":"{n} хв тому","time.agoHour":"{n} год тому","time.agoDay":"{n} д тому","kind.session":"сесія","kind.subagent":"субагент","kind.job":"джоба","kind.background":"фон","kind.handoff":"хендофф","rail.title":"Логи агентів","rail.filter":"Фільтр проєктів…","rail.projects":"Проєкти","rail.overview":"Огляд","rail.archive":"Архів","dash.branchesLive":{one:"{count} гілка працює",few:"{count} гілки працюють",many:"{count} гілок працюють",other:"{count} гілок працюють"},"dash.trees":{one:"{count} дерево",few:"{count} дерева",many:"{count} дерев",other:"{count} дерев"},"dash.recentConvos":{one:"{count} нещодавня розмова",few:"{count} нещодавні розмови",many:"{count} нещодавніх розмов",other:"{count} нещодавніх розмов"},"dash.quietTrees":{one:"{count} тихе дерево",few:"{count} тихі дерева",many:"{count} тихих дерев",other:"{count} тихих дерев"},"dash.openProjects":"Відкрити список проєктів","dash.unarchive":"Повернути з архіву","dash.newConvo":"Нова розмова з агентом","dash.agent":"Агент","dash.newWorkflow":"Новий воркфлоу: етапи → ревью → PR","dash.workflow":"Воркфлоу","dash.emptyTitle":"На схемі поки порожньо","dash.emptyHint":"Відкрий пульт у правому нижньому куті і клікни розмову — вона з'явиться тут","trash.title":"На схемі порожньо, але в проєкті є записи","trash.hint":"Клік по рядку відкриває розмову нодою; смітник видаляє її файл з диска назавжди.","trash.deletedFromDisk":"\xb7 видалено з диска","trash.open":"Відкрити {title}","trash.toArchive":"В архів","trash.notDeleted":"не видалено {failed} з {total}","trash.confirmDelete":{one:"Видалити з диска {count} файл проєкту?",few:"Видалити з диска {count} файли проєкту?",many:"Видалити з диска {count} файлів проєкту?",other:"Видалити з диска {count} файлів проєкту?"},"trash.deleting":"видаляю…","trash.confirmYes":"Так, видалити","trash.deleteProject":"Видалити проєкт з диска","switch.aria":"Пульт агентів","switch.title":"Пульт","switch.search":"Пошук за назвою або проєктом","switch.updating":"оновлення…","switch.close":"Закрити пульт","switch.waiting":"Чекає тебе","switch.working":"Працюють","switch.recent":"Нещодавні","switch.older":"Старіше","switch.hidden":"Приховані ({count})","switch.hide":"сховати","switch.restore":"повернути","switchCard.openColumn":"Відкрити колонкою {title}","switchCard.remove":"Прибрати з пульта","composer.imagesCount":{one:"{count} картинка",few:"{count} картинки",many:"{count} картинок",other:"{count} картинок"},"composer.spawned":"запущено агента в tmux {target}","composer.sentPaths":"надіслано {count} шлях(и)","composer.failedInterrupt":"не вдалося перервати","composer.escapeSent":"надіслано Escape — агент перервано","composer.spawnAria":"Запустити агента з промптом у tmux","composer.sendAria":"Надіслати повідомлення агенту в tmux {target}","composer.queueAria":"Черга надісланих повідомлень","composer.removeFromQueue":"Прибрати з черги","composer.placeholderRelay":"написати — передам через кореневу сесію…","composer.placeholderSpawn":"промпт — агент запуститься в tmux…","composer.placeholderSend":"написати агенту…","composer.textAria":"Текст для агента","composer.titleRelay":"передасться через кореневу сесію гілки","composer.titleSpawnResumed":"нове tmux-вікно з відновленим агентом","composer.root":"корінь","composer.interruptAria":"Перервати агента (Escape)","composer.interruptTitle":"надіслати Escape у пейн агента","composer.compactAria":"Стиснути контекст агента (/compact)","composer.compactTitle":"надіслати /compact — агент стисне контекст; після завершення у стрічці з'явиться позначка","composer.compactConfirm":"Точно?","composer.compactConfirmTitle":"Натисни ще раз, щоб надіслати /compact","composer.compactSent":"стискання почалось — позначка з'явиться у стрічці, щойно завершиться","composer.failedCompact":"не вдалося запустити стискання","composer.addImages":"Додати картинки","composer.moreTools":"Додаткові дії","composer.stopAndSend":"Зупинити запис і надіслати","composer.launchAgent":"Запустити агента","composer.sendToAgent":"Надіслати агенту","composer.stopAndSendTitle":"зупинити запис і надіслати","draft.readPrompt":"Прочитай розмову агента у файлі {src} і продовж роботу звідти: ","draft.needDir":"вкажи робочу директорію","draft.launchFailed":"не вдалося запустити","draft.paneAria":"Чернетка нової розмови з агентом","draft.notStarted":"агент ще не запущений","draft.engineAria":"Двигун агента","draft.handoffLabel":"хендофф: {title}","draft.newConvo":"нова розмова","draft.conversation":"розмова","draft.dismiss":"Прибрати чернетку розмови","draft.directory":"директорія","draft.dirAria":"Робоча директорія агента","draft.reasoning":"reasoning","draft.reasoningAria":"Рівень reasoning-зусилля","draft.effortDefault":"effort: дефолт","draft.speedAria":"Режим швидкості Codex","draft.speedTitle":"fast = priority tier (1.5x швидкість, більша витрата лімітів)","draft.speedDefault":"швидкість: дефолт","draft.imagesOnly":"(картинки)","draft.launched":"агент запущений у tmux {target} — чекаю, поки розмова з'явиться тут…","draft.slow":"Щось довго. Перевір вікно tmux {target} — щойно транскрипт з'явиться, панель підхопить його сама.","draft.hintRelay":"Новий агент спершу прочитає транскрипт батьківської розмови і продовжить з того місця. Допиши в промпт, що зробити далі, — гілка з'явиться на схемі поруч.","draft.hintNew":"Обери двигун і директорію, напиши перший промпт — агент запуститься в tmux, і розмова продовжиться в цій самій панелі.","draft.promptAria":"Перший промпт для нового агента","draft.placeholder":"перший промпт — агент запуститься в tmux…","draft.promptTextAria":"Текст першого промпта","draft.newWindowTitle":"нове tmux-вікно зі свіжим агентом","draft.newAgent":"новий агент","draft.addImages":"Додати картинки до промпта","draft.stopAndLaunch":"Зупинити запис і запустити агента","link.handoffContext":"Тобі передали контекст іншого агента — розмову \xab{title}\xbb. Її транскрипт: {path} — спочатку прочитай цей файл, щоб мати повний контекст, а тоді виконай прохання нижче.\n\n{ask}","link.dropped":"контекст у промпті \xab{title}\xbb — допиши прохання і надішли","handoff.aria":"Перекинути розмову новому агентові — чернетка з'явиться нижче","handoff.title":"клік — чернетка нового агента з цим контекстом \xb7 потягни — звʼязати з наявним","handoff.label":"перекинути агенту","qr.showAria":"Показати QR для входу з телефона","qr.failed":"не вдалося отримати посилання","qr.startHint":"Запустіть viewer з доступом через Tailscale: ","qr.alt":"QR код для входу з телефона","qr.generating":"генерую QR…","qr.linkAria":"Посилання для входу з телефона","qr.copy":"Копіювати посилання","qr.scanHint":"скануй з телефона в тому ж tailnet","push.enabled":"Push-сповіщення увімкнено","push.enable":"Увімкнути push-сповіщення","push.disable":"Вимкнути push-сповіщення","push.needsHttps":"Push потребує HTTPS","sound.on":"Звукові сповіщення увімкнено","sound.off":"Звукові сповіщення вимкнено","sound.mute":"Вимкнути звукові сповіщення","sound.unmute":"Увімкнути звукові сповіщення","mic.stopRecognize":"Зупинити запис і розпізнати","mic.cancel":"Скасувати запис","mic.recognizing":"Розпізнаю…","mic.dictate":"Надиктувати","mic.dictateHint":"надиктувати (до 2 хв) \xb7 правий клік: спосіб розпізнавання","mic.connecting":"Під'єдную мікрофон — секунду…","mic.menuTitle":"Спосіб розпізнавання","mic.menuLoading":"перевіряю, що доступно…","mic.menuLocked":"Заблоковано змінною середовища LLV_TRANSCRIBE_BACKEND","mic.noKey":"не налаштовано","mic.saveFailed":"не вдалося зберегти вибір","mic.keyTitle":"{name} не налаштовано","mic.copy":"копіювати","mic.copyPath":"Скопіювати шлях","mic.copied":"скопійовано","mic.back":"Назад","stt.local.name":"Faster Whisper","stt.local.desc":"Безкоштовно, повністю локально — аудіо не покидає цю машину.","stt.local.fix":"Запусти scripts/setup-whisper.sh у теці застосунку один раз; він встановить локальний рушій у:","stt.chatgpt.name":"ChatGPT Voice","stt.chatgpt.desc":"У межах підписки ChatGPT, через логін Codex.","stt.chatgpt.fix":"Залогінься в Codex (команда `codex login`) — токен з'явиться у:","stt.elevenlabs.name":"ElevenLabs Scribe","stt.elevenlabs.desc":"Платний API ElevenLabs — найточніший варіант.","stt.elevenlabs.fix":"Поклади свій API-ключ ElevenLabs (одним рядком) у цей файл:","delFile.confirm":"Видалити з диска?","delFile.aria":"Видалити розмову з диска","img.readFailed":"не вдалося прочитати картинку","img.readAborted":"читання картинки перервано","img.unsupported":"непідтримуваний формат картинки: {name}","img.unknownFile":"невідомий файл","img.tooLarge":"{name}: завелика (ліміт 10 МБ)","img.image":"картинка","img.error":"помилка картинки","img.previewAlt":"прев'ю картинки {n}","img.removeAria":"Прибрати картинку {n}","img.toFilePaths":"шляхами до файлів","question.sec":"{n} с","question.min":"{n} хв","question.hour":"{n} год","question.waiting":"чекає на відповідь","question.sentToPane":"Надіслано в пейн: {text}","question.keysHint":"клавіші в пейн \xb7 або композер нижче","question.pane":"Пейн {target}","question.alreadyAnswered":"відповідь уже записана","question.openFailed":"не вдалося відкрити сесію","question.opened":"відкрито {target}","question.answered":"Відповідено: {text}","question.answeredElsewhere":"Відповідено в іншому місці: {text}","question.noPane":"tmux-пейн недоступний","question.openSession":"відкрити сесію","question.rejectComment":"Коментар до відхилення…","question.approved":"затверджено","question.rejected":"відхилено","question.approve":"Затвердити","question.reject":"Відхилити","question.ownAnswer":"Своя відповідь…","inbox.deleted":"видалено з диска","inbox.fileGone":"файла вже немає на диску","inbox.confirmDelete":"Видалити файл з диска?","inbox.deleteAria":"Видалити {name} з диска","inbox.deleteFromDisk":"видалити з диска","inbox.attachedAlt":"вкладена картинка {name}","lightbox.zoomOut":"Зменшити","lightbox.resetZoom":"Скинути масштаб","lightbox.zoomIn":"Збільшити","feed.agentEnded":"агент завершився","feed.copyCode":"Скопіювати код","feed.copyMd":"Скопіювати повідомлення (Markdown)","feed.running":"виконує {tool}…","feed.tool":"інструмент","feed.thinking":"думає…","feed.working":"працює…","feed.liveTail":"живий хвіст","feed.backToLive":"Повернутись до живого хвоста","feed.newCount":"{count} нових","feed.down":"вниз","feed.pickLog":"Вибери лог зліва — стрічка оновлюється сама","feed.showEarlier":"показати раніше","feed.showEarlierHidden":"показати раніше (сховано {count})","feed.loadEarlier":"завантажити раніше з файлу","feed.startOfConvo":"початок розмови","feed.finishedTurn":"закінчив хід — чекає відповіді","feed.returnedResult":"повернувся з результатом","feed.noOutput":"Ще без виводу — файл поки порожній","feed.onlyService":"Є лише службові записи ({count}).","feed.empty":"Порожньо (немає рядків для показу)","render.system":"системне","render.executing":"виконується…","render.error":"помилка","render.teammate":"тімейт","render.left":"{peer}: звільнився{at}","render.codexSessionCreated":"Сесія Codex створена","render.taskStarted":"Задача стартувала","render.taskComplete":"Задачу завершено","render.compacted":"контекст стиснуто","render.compactAuto":"авто","render.compactManual":"вручну","render.compactPre":"{n}k токенів до","render.compactSummary":"підсумок розмови","render.patch":"патч","render.stdinSession":"stdin → сесія {id}","render.record":"запис","render.protocol":"протокол","render.jobLogNote":"(це джоб-лог: він не містить stdout команд; повний вивід — у rollout-сесії Codex у списку зліва)","render.image":"зображення","render.dataKb":"даних {n} КБ","render.commands":{one:"{count} команда",few:"{count} команди",many:"{count} команд",other:"{count} команд"},"render.noFindings":"без findings","render.moreFindings":"ще {count} findings у raw","render.memoryCitations":"цитати пам'яті ({count})","render.noCitations":"без citation entries","render.moreEntries":"ще {count} entries у raw","render.truncated":"обрізано","render.shutdownRequest":"запит на завершення","render.shutdownResponse":"відповідь на завершення","render.planRequest":"запит на затвердження плану","render.planVerdict":"вердикт по плану","render.approved":"схвалено","render.rejected":"відхилено","render.from":"від {from}","render.structured":"структуроване повідомлення","render.showJson":"показати JSON","render.noOutputInLog":"(вивід у цьому лог-файлі відсутній — повний є в rollout-сесії Codex)","render.filesChanged":"файли змінені","render.toDir":"до","render.fromDir":"від","render.delivered":"доставлено","render.notDelivered":"не доставлено","render.reasoning":"міркування агента","flowDialog.engine":"Двигун: {label}","flowDialog.modelPlaceholder":"модель (дефолт)","flowDialog.model":"Модель: {label}","flowDialog.effortDefault":"effort: дефолт","flowDialog.createFailed":"не вдалося створити флоу ({status})","flowDialog.title":"Запустити флоу","flowDialog.subtitle":"implement → review \xb7 ця розмова стає виконавцем","flowDialog.preset":"пресет","flowDialog.rolesManualOpen":"▾ ролі вручну","flowDialog.rolesManual":"▸ ролі вручну (модель / effort)","flowDialog.implementer":"виконавець","flowDialog.reviewer":"ревʼюер","flowDialog.diffBase":"база діфу","flowDialog.fromHead":"від поточного HEAD","flowDialog.fromMergeBase":"від merge-base з main","flowDialog.headless":"headless (без панелі)","flowDialog.tmuxPane":"tmux-панель","flowDialog.transitions":"переходи","flowDialog.auto":"авто","flowDialog.manual":"вручну (гейт на кожен крок)","flowDialog.roundLimit":"ліміт раундів","flowDialog.creating":"створюю…","flowDialog.start":"▶ Запустити","flowStrip.startReview":"Почати ревью","flowStrip.spawnReviewer":"Заспавнити ревʼюера","flowStrip.relayNotes":"Передати зауваження","flowStrip.retryRound":"Повторити раунд","flowStrip.anotherRound":"Ще коло","flowStrip.flow":"ФЛОУ","flowStrip.roundsAria":"Раунди ревью","flowStrip.roundError":"Раунд {n}: {error}","flowStrip.roundVerdict":"Раунд {n}: {verdict}","flowStrip.roundInProgress":"Раунд {n}: триває","flowStrip.addRoundsTitle":"Додати ще раунди до ліміту","flowStrip.plus2":"+2 раунди","flowStrip.limitTitle":"Ліміт раундів: скільки ревью до зупинки (∞ — без ліміту)","flowStrip.limitAria":"Встановити ліміт раундів: {count}","flowStrip.limitUnlimitedAria":"Без ліміту раундів","flowStrip.stopReviewer":"Стоп","flowStrip.stopReviewerTitle":"Зупинити поточного ревʼюера; раунд перейде в \xabпотрібне рішення\xbb","flowStrip.notePlaceholder":"нотатка ревʼюеру…","flowStrip.noteTitle":"Піде наступному ревʼюеру як ready-нотатка раунду","flowStrip.autoTitle":"Авто: переходи самі. Клік — вручну.","flowStrip.manualTitle":"Вручну: кожен перехід чекає кліку. Клік — авто.","flowStrip.manualShort":"вручну","flowStrip.resume":"Продовжити флоу","flowStrip.pause":"Пауза","flowStrip.close":"Закрити флоу","roundDeck.roundAborted":"Раунд {n} \xb7 перервано","roundDeck.roundVerdict":"Раунд {n} \xb7 {verdict}","roundDeck.roundInProgress":"Раунд {n} \xb7 триває","roundDeck.aborted":"перервано","roundDeck.reviewInProgress":"ревью триває","roundDeck.waitingFirst":"чекаю на перший раунд ревью…","roundDeck.spawningReviewer":"запускаю ревʼюера — транскрипт зʼявиться за мить…","roundDeck.moreRounds":"ще {count} раунд(и) — клікни чипи на стрічці флоу","roundDeck.findings":{one:"{count} знахідка",few:"{count} знахідки",many:"{count} знахідок",other:"{count} знахідок"},"flowState.waiting_ready":"чекає READY","flowState.spawn_pending":"готовий спавнити ревʼюера","flowState.spawning":"запускаю ревʼюера","flowState.reviewing":"ревью","flowState.relay_pending":"вердикт є — передати?","flowState.relaying":"передаю зауваження","flowState.fixing":"фікси","flowState.approved":"затверджено","flowState.done_comment":"готово із зауваженнями","flowState.needs_decision":"потребує рішення","flowState.paused":"пауза","flowState.closed":"закрито","flowModel.failed":"не вдалося ({status})","wfState.provisioning":"готую worktree","wfState.implementing":"етапи виконуються","wfState.reviewing":"ревью","wfState.finishing":"завершення","wfState.approved":"approved","wfState.needs_decision":"потребує рішення","wfState.paused":"пауза","wfState.closed":"закрито","wfModel.failed":"не вдалося ({status})","wfStrip.workflow":"ВОРКФЛОУ","wfStrip.stagesAria":"Етапи воркфлоу","wfStrip.reviewStage":"ревью","wfStrip.advance":"Далі","wfStrip.retryStage":"Повторити етап","wfStrip.skipStage":"Пропустити","wfStrip.resume":"Продовжити воркфлоу","wfStrip.pause":"Пауза","wfStrip.close":"Закрити воркфлоу","wfDraft.paneAria":"Чернетка нового воркфлоу","wfDraft.notStarted":"воркфлоу ще не запущений","wfDraft.newWorkflow":"новий воркфлоу","wfDraft.dismiss":"Прибрати чернетку воркфлоу","wfDraft.template":"шаблон","wfDraft.templateAria":"Шаблон воркфлоу","wfDraft.repo":"репозиторій","wfDraft.repoAria":"Директорія репозиторію","wfDraft.manualMode":"вручну: гейт на межі кожного етапу","wfDraft.hint":"Обери шаблон і репозиторій, опиши задачу — воркфлоу створить worktree, прожене етапи, ревью і відкриє PR.","wfDraft.taskPlaceholder":"задача для воркфлоу — бриф піде кожному етапу…","wfDraft.taskAria":"Бриф задачі воркфлоу","wfDraft.footerHint":"worktree \xb7 етапи \xb7 ревью \xb7 PR","wfDraft.finishMerge":"merge локально","wfDraft.needDir":"вкажи директорію репозиторію","wfDraft.needTask":"опиши задачу","wfDraft.launchFailed":"не вдалося запустити","wfDraft.launch":"▶ Запустити воркфлоу","wfDraft.launching":"запускаю…","scheme.flowTitle":"Запустити цикл implement → review для цієї розмови","scheme.flow":"Флоу","scheme.collapsedTitle":"Згорнуті гілки й задачі цієї розмови","scheme.underneath":"під сподом","scheme.handTool":"Рука — тягнути полотно (H, або тримай Space)","scheme.selectTool":"Виділення — клік і робота з розмовами (V)","scheme.zoomOut":"Віддалити (−)","scheme.zoom100":"Масштаб 100% (1)","scheme.zoomIn":"Наблизити (+)","scheme.fit":"Вписати все (0, або подвійний клік по фону)","scheme.roleImplementer":"Імплементер","scheme.roleReviewer":"Ревʼюер","scheme.roleWorking":"працює","scheme.roleWaiting":"чекає","scheme.lassoTool":"Вибірка — обведи агентів рамкою, кліком додавай чи знімай","bulk.selectedCount":{one:"Вибрано {count}",few:"Вибрано {count}",many:"Вибрано {count}",other:"Вибрано {count}"},"bulk.placeholder":"одне повідомлення кожному вибраному агенту…","bulk.textAria":"Текст розсилки вибраним агентам","bulk.sendAll":"Надіслати {count} агентам","bulk.interrupt":"Перервати","bulk.stop":"Зупинити","bulk.stopConfirm":"Точно зупинити {count}?","bulk.remove":"Прибрати зі схеми","bulk.removeConfirm":"Закрити {count} карток?","bulk.flow":"Флоу","bulk.fit":"Показати вибірку","bulk.exit":"Вийти з вибірки (Esc)","bulk.retryFailed":"Повторити невдалі ({count})","bulk.nodeGone":"вузол зник зі схеми","bulk.flowTitle":"Запустити ревʼю-флоу для {count} агентів","bulk.flowStart":"Запустити {count} флоу","minimap.title":"Мінімапа — клікни або тягни, щоб перейти","plan.agentPlan":"План агента:","plan.stepsAria":"План: {done} з {total} кроків","plan.nowSuffix":", зараз: {current}","plan.goal":"ціль","plan.goalDone":"ціль ✓","plan.goalBlocked":"ціль ✖","plan.noObjective":"(objective не записаний у хвості транскрипта)","plan.tokens":"токенів: {n}","plan.time":"часу: {n} хв","plan.ctxTitle":"Контекстне вікно: використано {pct}%\n{used} з {window} токенів","plan.ctxAria":"Контекст: використано {pct} відсотків вікна","plan.goalAria":"Ціль сесії: {status}","limits.now":"зараз","limits.inMin":"через {n} хв","limits.inHour":"через {n} год","limits.inDay":"через {n} д","limits.asOf":"станом на {time}","limits.left":"лишилось","limits.reset":"скид {eta} \xb7 {at}","limits.stale":"дані застарілі: {stale}","limits.5h":"5 год","limits.week":"Тиждень","resources.ram":"RAM","resources.swap":"Swap","resources.free":"{amount} вільно","resources.used":"{amount} зайнято","resources.stale":"дані про ресурси застарілі: {stale}","resources.openAria":"Сесії агентів і пам'ять","resources.title":"Сесії агентів","resources.total":"Σ {amount}","resources.empty":"у tmux немає сесій агентів","resources.orphan":"осиротілий пейн","resources.procs":{one:"{count} процес",few:"{count} процеси",many:"{count} процесів",other:"{count} процесу"},"resources.swapShare":"+ {amount} swap","resources.kill":"Убити","resources.confirm":"Точно?","resources.killLiveHint":"агент зараз працює — натисни, щоб розблокувати, і підтверди","resources.killHint":"закрити tmux-пейн разом з усім деревом процесів","resources.bulkLabel":"неактивні довше ніж","resources.bulkKill":"Убити неактивні","resources.bulkNone":"немає сесій, неактивних так довго","resources.hoursN":"{n} год","resources.close":"Закрити","status.awaitingPlan":"чекає затвердження плану","status.awaitingAnswer":"чекає відповіді на питання","status.awaitingTerminal":"чекає на відповідь у терміналі","status.working":"працює…","status.returnedResult":"повернувся з результатом","status.stalled":"перервано або чекає дозволу","status.finishedTurn":"закінчив хід — чекає відповіді","status.flow":"флоу: {label}","dictation.failed":"не вдалося розпізнати","dictation.silence":"тиша — нічого не розпізналось","dictation.unsupported":"запис не підтримується в цьому браузері","dictation.liveError":"помилка live-транскрипції","dictation.connectionLost":"зʼєднання з транскрипцією обірвалось","dictation.noMic":"немає доступу до мікрофона","overview.branchesLiveIn":{one:"{count} гілка працює у {projects}",few:"{count} гілки працюють у {projects}",many:"{count} гілок працюють у {projects}",other:"{count} гілок працюють у {projects}"},"overview.projects":{one:"{count} проєкті",few:"{count} проєктах",many:"{count} проєктах",other:"{count} проєктах"},"overview.archived":"\xb7 {count} в архіві","overview.moreLive":"ще {count} live","overview.quiet":"тихо \xb7 остання активність {age}","overview.empty":"Логів поки нема","branch.live":"працює","branch.waiting":"закінчив хід — чекає відповіді","branch.returned":"повернувся з результатом","branch.stalled":"перервано або чекає дозволу","branch.done":"завершено — можна прибрати","branch.worktree":"Ворк-дерево {name}","branch.lastActivity":"Остання активність: {age}","branch.lastActivityQuiet":"Позначений активним, але транскрипт мовчить: остання активність {age}","branch.handoffTitle":"агент, породжений хендоффом цієї розмови","branch.branchTitle":"гілка цієї розмови","branch.removeColumn":"Прибрати колонку {title}","branch.toggleBackground":"{action} фонову задачу {title}","branch.collapse":"Згорнути","branch.expand":"Розгорнути","branch.expandFull":"Розгорнути розмову {title} на все вікно","branch.collapseFull":"Повернутися до полотна (Esc)","tree.quiet":"Тихі розмови й задачі","corner.waitingCount":"\xb7 {count} чекають","corner.openSwitchboard":"Відкрити пульт агентів","task.working":", працює","task.interrupted":", перервано","task.finished":", закінчив","task.interruptedBadge":"перервано","task.finishedBadge":"завершено","task.stopFailed":"помилка зупинки","task.signalSent":"надіслано {signal} PID {pid}","task.confirmKill":"Точно вбити PID {pid}?","task.killPid":"Вбити {pid}","task.confirmKillYes":"Так, вбити","task.stopAria":"Зупинити процес PID {pid}","task.kill":"Вбити","task.jobLogHint":"Це короткий джоб-лог (лише службові події). Реальна робота Codex — у повній сесії:","task.openCodexSession":"Відкрити сесію Codex ({size} kB{activity})","task.rolloutMissing":"Це короткий джоб-лог. Повна rollout-сесія Codex ще не з'явилась у списку","task.backgroundCommand":"Фонова команда","task.commandNotFound":"Команду, що запустила цю фонову задачу, не знайдено у транскриптах сесії","viewer.closeProjects":"Закрити список проєктів","viewer.agentWaiting":"Агент чекає відповіді","viewer.closeNotification":"Закрити сповіщення","attention.badge":{one:"{count} чекає",few:"{count} чекають",many:"{count} чекають",other:"{count} чекають"},"attention.openQueue":"Черга уваги — хто заблокований на тобі (N — наступний)","attention.popoverTitle":"Чекають на тебе","attention.filterOn":"Показати лише тих, хто чекає на тебе (F)","attention.filterOff":"Показати всі вузли (F)","mobile.noConvos":"Розмов поки нема","mobile.map":"Карта","mobile.closeMap":"Закрити карту","mobile.tapNode":"Тапни вузол — розмова відкриється на весь екран","mobile.agent":"агент","mobile.openMap":"Відкрити карту проєкту","tasks.failed":"не вдалося ({status})","tasks.tool":"Задача — наступний клік кладе картку на полотно (T)","tasks.untitled":"без назви","tasks.newPlaceholder":"текст задачі… (перший рядок — назва)","tasks.editAria":"Текст задачі","tasks.spawning":"запускається…","tasks.deadChip":"розмови вже немає у списку","tasks.retry":"повторити доставку","tasks.chipFailedTitle":"не доставлено: {error}","tasks.send":"надіслати","tasks.sendTitle":"Потягни стрілку на панель агента — задача полетить туди; на порожнє місце — запуститься новий агент. Клік відкриває список","tasks.linkSent":"задачу надіслано → \xab{title}\xbb","tasks.spawn":"агент","tasks.spawnTitle":"Запустити нового агента з цією задачею як брифом","tasks.spawnGo":"Запустити","tasks.statusTitle":"Статус: {label} — клік перемикає (інбокс → призначено → заблоковано → готово)","tasks.statusPrefix":"статус","tasks.status.inbox":"інбокс","tasks.status.assigned":"призначено","tasks.status.blocked":"заблоковано","tasks.status.done":"готово","tasks.delete":"видалити","tasks.deleteConfirm":"точно?","tasks.deleteAria":"Видалити задачу {title}","tasks.pickerTitle":"Кому надіслати","tasks.pickerAllChildren":"⤷ всім дітям","tasks.pickerEmpty":"у проєкті немає розмов","tasks.pickerSend":"Надіслати ({count})","tasks.sendOk":"Доставлено {delivered} з {total}","tasks.sendFailPart":"✗ „{title}“: {error}","tasks.spawnOk":"агента запущено в tmux {target}","tasks.composerToggle":"створити задачу","tasks.composerToggleTitle":"Увімкнено — текст стає задачею-карткою з призначеннями на вибір; вимкнено — проста розсилка без сліду","tasks.composerNeedsText":"для задачі потрібен текст","tasks.panelTitle":"Задачі","tasks.panelToggleAria":"Показати або сховати панель задач","tasks.panelThisProject":"цей проєкт","tasks.panelAll":"всі","tasks.panelEmpty":"задач поки нема — кинь картку інструментом \xabзадача\xbb (T)","tasks.panelClose":"Закрити панель задач","tasks.sheetNew":"нова задача","tasks.sheetCreate":"Створити задачу","tasks.sheetBack":"Назад до списку задач","tasks.sheetTargets":{one:"{count} адресат",few:"{count} адресати",many:"{count} адресатів",other:"{count} адресатів"},"tasks.sheetAssignments":"призначення","tasks.sheetEmpty":"задач поки нема","tasks.sheetGone":"задачі вже немає","tasks.textNotSaved":"текст не зберігся — надсилання скасовано, спробуй ще раз","tasks.emptyTextBlocked":"порожній текст не зберігається — віднови текст задачі перед надсиланням"}},c="llv_lang",d="en",u=!1,p=new Set;function f(){return u||(u=!0,d=function(){try{let e=window.localStorage.getItem(c);if("en"===e||"uk"===e)return e}catch{}return("u">typeof navigator?navigator.language:"").toLowerCase().startsWith("uk")?"uk":"en"}(),document.documentElement.lang=d),d}function m(e){if(u=!0,e!==d){d=e;try{window.localStorage.setItem(c,e)}catch{}for(let t of("u">typeof document&&(document.documentElement.lang=e),p))t()}}function x(e){return p.add(e),()=>p.delete(e)}function h(e,t,n){var r;let i,s=o[e][t]??o.en[t]??t;if("string"==typeof s)i=s;else{let t="number"==typeof n?.count?n.count:0;i=s[new Intl.PluralRules("uk"===e?"uk-UA":"en-US").select(t)]??s.other??s.one??""}return r=i,n?r.replace(/\{(\w+)\}/g,(e,t)=>t in n?String(n[t]):e):r}function b(){let e=(0,a.useSyncExternalStore)(x,f,()=>"en");return{locale:e,t:(t,n)=>h(e,t,n),setLocale:m}}function g(e,t=160){let n=e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/[*_~#>]+/g,"").replace(/\s+/g," ").trim().replace(/(?:\/[^\s)]+){3,}/g,e=>{if(e.length<=40)return e;let t=e.split("/").filter(Boolean);return t.length>=2?".../"+t.slice(-2).join("/"):e}).replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t-1).trimEnd()+"…":n}let w="__overview__",v=e=>Math.floor(e/300);function k(e){return"live"===e.activity?0:"recent"===e.activity?1:"stalled"===e.activity?2:3}function y(e){return"claude-projects"===e.root?"session"===e.kind&&!e.parent:"codex-sessions"===e.root&&!e.parent}function j(e){return"claude-projects"===e.root&&"subagent"===e.kind}function N(e){return!!j(e)||!!e.handoff&&!!e.parent||"codex-sessions"===e.root&&!!e.parent}function S(e){return"shell"===e.engine||"codex-jobs"===e.root}function C(e){return e.project||"other"}let A=new Set(["provisioning","implementing","reviewing","finishing"]);function T(e,t=Date.now()/1e3,n=[]){let r=new Map,i=e=>{let t=r.get(e);return t||(t={project:e,liveCount:0,attentionCount:0,conversations:0,smt:0},r.set(e,t)),t};for(let n of e){let e=i(C(n));"live"===n.activity&&(e.liveCount+=1),null!==R(n,t)&&(e.attentionCount+=1),y(n)&&(e.conversations+=1),e.smt=Math.max(e.smt,n.mtime)}for(let e of n){if("closed"===e.state||!e.project)continue;let t=i(e.project);A.has(e.state)&&(t.liveCount+=1),("needs_decision"===e.state||"paused"===e.state)&&(t.attentionCount+=1),t.smt=Math.max(t.smt,(Date.parse(e.createdAt)||0)/1e3)}return[...r.values()].sort((e,t)=>{let n=e.attentionCount>0;return n!==t.attentionCount>0?n?-1:1:e.liveCount!==t.liveCount?t.liveCount-e.liveCount:v(t.smt)-v(e.smt)||e.project.localeCompare(t.project)})}function E(e){let t=new Map;for(let n of e){if(!n.parent)continue;let e=t.get(n.parent);e?e.push(n):t.set(n.parent,[n])}return t}function $(e,t){let n=[],r=[...t.get(e.path)??[]],i=new Set([e.path]);for(;r.length;){let e=r.pop();i.has(e.path)||(i.add(e.path),n.push(e),r.push(...t.get(e.path)??[]))}return n}function D(e){return!S(e)&&("live"===e.activity||"recent"===e.activity&&N(e))}function M(e,t){let n=new Map(e.map(e=>[e.path,e])),r=E(e),i=new Map,s=new Map;for(let r of e)if(C(r)===t){if("live"===r.activity||"recent"===r.activity&&N(r)){let e=function(e,t){let n=new Set,r=e;for(;r.parent&&!n.has(r.path);){n.add(r.path);let e=t.get(r.parent);if(!e)break;r=e}return r}(r,n);S(e)?s.set(e.path,e):i.set(e.path,e);continue}"recent"===r.activity&&y(r)&&i.set(r.path,r)}let l=[...i.values()].map(e=>(function(e,t,n){let r=$(e,t),i=r.filter(D).sort((e,t)=>("live"!==e.activity)-("live"!==t.activity)||v(t.mtime)-v(e.mtime)||e.path.localeCompare(t.path)),s=r.filter(e=>S(e)&&"live"===e.activity).sort((e,t)=>v(t.mtime)-v(e.mtime)||e.path.localeCompare(t.path)),l=[e,...i].map(e=>({file:e,tasks:[]})),a=new Map(l.map(e=>[e.file.path,e]));for(let e of s)(e.parent&&a.get(e.parent)||l[0]).tasks.push(e);let o=new Set([...a.keys(),...s.map(e=>e.path)]),c=r.filter(e=>!o.has(e.path)).sort((e,t)=>t.mtime-e.mtime),d=c.filter(e=>N(e)&&function(e,t){let n=new Set([e.path]),r=e;for(;r.parent&&!n.has(r.parent);){let e=t.get(r.parent);if(!e)break;if(n.add(e.path),"session"===e.kind)return"live"===e.activity||"recent"===e.activity;r=e}return!1}(e,n)),u=new Set(d.map(e=>e.path)),p=c.filter(e=>!u.has(e.path)),f=Math.max(...l.map(e=>e.file.mtime),...s.map(e=>e.mtime));return{key:e.path,columns:l,returnable:d,finished:p,smt:f,orphanTask:!1}})(e,r,n));for(let e of s.values())l.push({key:e.path,columns:[{file:e,tasks:[]}],returnable:[],finished:[],smt:e.mtime,orphanTask:!0});return l.sort((e,t)=>e.orphanTask!==t.orphanTask?e.orphanTask?1:-1:v(t.smt)-v(e.smt)||e.key.localeCompare(t.key))}function R(e,t=Date.now()/1e3){return e.pendingQuestion?e.pendingQuestion.toolUseId:e.waitingInput?`${e.path}:waiting:${Math.floor(e.waitingInput.since)}`:"stalled"===e.activity&&"running"===e.proc&&t-e.mtime<=7200?`${e.path}:stalled:${Math.floor(e.mtime)}`:null}let P="llv:flows-changed",I=new Set,L=I,_=new Set;function z(e){return _.add(e),()=>_.delete(e)}let O=new Set;function q(e){let t=new Map;for(let n of e){if("closed"===n.state)continue;let e=t.get(n.implementerPath);(!e||n.createdAt>e.createdAt)&&t.set(n.implementerPath,n)}return t}function F(e){let t=new Set;for(let n of e)for(let e of n.rounds)e.reviewerPath&&t.add(e.reviewerPath);return t}function U(e,t){return!t.has(e.path)&&("claude"===e.engine||"codex"===e.engine)&&y(e)}function B(e,t){return e(`flowState.${t}`)}let H=new Set(["spawn_pending","relay_pending","needs_decision","paused","approved"]),W=new Set(["spawning","reviewing","relaying","fixing"]);function K(e){return"spawning"===e.state||"reviewing"===e.state?"reviewer":"waiting_ready"===e.state||"relaying"===e.state||"fixing"===e.state?"implementer":null}let Y={APPROVE:"✓",REQUEST_CHANGES:"✖",COMMENT:"◆"};function J(e){return"APPROVE"===e?{color:"#1a8a3e",soft:"#e7f4ea"}:"REQUEST_CHANGES"===e?{color:"#c62828",soft:"#fbeaea"}:"COMMENT"===e?{color:"#b07d1f",soft:"#fdf3dd"}:{color:"#8b8b95",soft:"#efeff3"}}async function Q(e,t){try{let n=await fetch(`/api/flows/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.ok)return"close"===t.action&&function(e){if(!I.has(e))for(let t of(I.add(e),L=new Set(I),_))t()}(e),window.dispatchEvent(new Event(P)),null;let r=await n.json().catch(()=>null);return r?.error??h(f(),"flowModel.failed",{status:n.status})}catch{return h(f(),"common.serverUnavailable")}}function X(e){let t=f(),n=Date.now()/1e3-e;return n<90?h(t,"time.agoSec",{n:Math.round(n)}):n<5400?h(t,"time.agoMin",{n:Math.round(n/60)}):n<129600?h(t,"time.agoHour",{n:Math.round(n/3600)}):h(t,"time.agoDay",{n:Math.round(n/86400)})}function G(e){if("string"!=typeof e&&"number"!=typeof e)return"";let t=new Date(e),n="uk"===f()?"uk-UA":"en-US";return Number.isNaN(t.getTime())?"":t.toLocaleTimeString(n,{hour12:!1})}function V(e){return"live"===e?"animate-pulse bg-ok":"recent"===e?"bg-[#d29a2f]":"stalled"===e?"bg-err":"bg-[#c9c9d1]"}let Z={codex:{color:"#2f6fd0",soft:"#e8f0fb"},claude:{color:"#d97757",soft:"#faeee9"}},ee={color:"#9a9aa4",soft:"#ececf1"},et=[[/fable|mythos/,{color:"#c2410c",soft:"#fbeade"}],[/opus/,{color:"#8a5ad6",soft:"#f1ebfb"}],[/sonnet/,{color:"#e0913f",soft:"#fbf1e4"}],[/haiku/,{color:"#d9a58c",soft:"#f9f1ec"}]],en=[[/spark/,{color:"#5ea3e4",soft:"#ecf4fd"}],[/mini|nano/,{color:"#7fb1e8",soft:"#eff6fd"}],[/codex/,{color:"#1d55ab",soft:"#e4edfa"}]];function er(e){let t=Z[e.engine];if(!t)return ee;let n=(e.model??"").toLowerCase();for(let[t,r]of"codex"===e.engine?en:et)if(t.test(n))return r;return t}let ei={minimal:{dl:20,ds:-32},low:{dl:12,ds:-20},medium:{dl:0,ds:0},high:{dl:-8,ds:12},xhigh:{dl:-14,ds:22},max:{dl:-19,ds:30}};function es(e,t,n){let[r,i,s]=function(e){let t=parseInt(e.slice(1),16),n=(t>>16&255)/255,r=(t>>8&255)/255,i=(255&t)/255,s=Math.max(n,r,i),l=Math.min(n,r,i),a=(s+l)/2,o=s-l;if(0===o)return[0,0,100*a];let c=o/(1-Math.abs(2*a-1));return[60*(s===n?((r-i)/o+6)%6:s===r?(i-n)/o+2:(n-r)/o+4),100*c,100*a]}(e),l=e=>Math.min(100,Math.max(0,e));return`hsl(${Math.round(r)} ${Math.round(l(i+n))}% ${Math.round(l(s+t))}%)`}function el(e){let t=er(e),n=ei[e.effort??""];return n?{color:es(t.color,n.dl,n.ds),soft:es(t.soft,Math.round(n.dl/3),Math.round(n.ds/2))}:t}function ea(e){return e.effort?h(f(),"util.effortTitle",{effort:e.effort}):void 0}function eo(e){return er(e).color}function ec(e){return{backgroundColor:er(e).color}}function ed(e){let t={codex:"Codex",claude:"Claude",shell:"Bash"}[e.engine]??e.engine,n=Z[e.engine]??ee;return{label:t,style:{backgroundColor:n.soft,color:n.color}}}function eu(e,t){return Math.floor(t.smt/300)-Math.floor(e.smt/300)||e.file.path.localeCompare(t.file.path)}function ep(e,t=Date.now()/1e3){return!!e.pendingQuestion||!!e.waitingInput||("stalled"===e.activity?null!==R(e,t):"recent"===e.activity&&("claude"===e.engine||"codex"===e.engine)&&y(e)&&!j(e))}function ef(e,t,n,r,i=em,s=ex){let{locale:l}=b();return(0,a.useMemo)(()=>{let a=(e,t)=>h(l,e,t),o=function(e){let t=E(e),n=new Map;for(let r of e)n.set(r.path,$(r,t).length);return n}(e),c=new Map;for(let e of t){let t=c.get(e.file);(!t||e.ts>t.ts)&&c.set(e.file,e)}let d=q(s),u=F(s),p=n.trim().toLowerCase(),f=e.filter(e=>!i.has(e.path)&&!u.has(e.path)&&(y(e)||"live"===e.activity||"stalled"===e.activity||"recent"===e.activity&&!S(e))).map(e=>{let t=C(e),n=g(e.title),i=r-e.mtime,s=d.get(e.path),l=e.pendingQuestion||e.waitingInput?"waiting":"live"===e.activity?"working":ep(e,r)?"waiting":i<=86400?"recent":"older",u=function(e,t,n){var r;if(t.pendingQuestion)return e("plan"===t.pendingQuestion.kind?"status.awaitingPlan":"status.awaitingAnswer");if(t.waitingInput)return e("status.awaitingTerminal");if("live"===t.activity&&t.plan?.current)return`${t.plan.done}/${t.plan.total} \xb7 ${t.plan.current}`;let i=n.get(t.path);return i?`${i.label} \xb7 ${X(i.ts)}`:"live"===t.activity?e("status.working"):j(r=t)&&"running"!==r.proc?e("status.returnedResult"):"stalled"===t.activity?e("status.stalled"):ep(t)?e("status.finishedTurn"):""}(a,e,c);return s&&(H.has(s.state)?l="waiting":("reviewing"===s.state||"relaying"===s.state||"spawning"===s.state)&&(l="working"),u=`${a("status.flow",{label:B(a,s.state)})}${s.stateDetail?` — ${s.stateDetail}`:""}`),{file:e,project:t,title:n,descendants:o.get(e.path)??0,smt:e.mtime,kind:l,statusLine:u}}).filter(e=>!p||`${e.title} ${e.project}`.toLowerCase().includes(p)),m=(e,t)=>t.smt-e.smt||e.file.path.localeCompare(t.file.path),x=f.filter(e=>"waiting"===e.kind).sort(m),b=f.filter(e=>"working"===e.kind).sort(m);return{waiting:x,working:b,recent:f.filter(e=>"recent"===e.kind).sort(eu),older:f.filter(e=>"older"===e.kind).sort(eu),livePreview:b.slice(0,3)}},[e,t,n,r,i,s,l])}let em=new Set,ex=[];function eh(e,t=Date.now()/1e3){return e.pendingQuestion||e.waitingInput?"waiting":"live"===e.activity?"live":"recent"===e.activity&&N(e)&&"running"!==e.proc?"returned":ep(e,t)?"stalled"===e.activity?"stalled":"waiting":"done"}let eb="llvSound";function eg(){try{return"off"!==localStorage.getItem(eb)}catch{return!0}}let ew=new Map;function ev(e){let t=ew.get(e);if(!t)return 0;let n=t.getBoundingClientRect();return n.width?Math.max(-1,Math.min(1,(n.left+n.width/2)/window.innerWidth*2-1)):0}let ek=null;function ey(){if(!ek){let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;ek=new e}return ek}let ej={waiting:[{freq:784,at:0,dur:.5},{freq:1175,at:.16,dur:.75}],returned:[{freq:659,at:0,dur:.3},{freq:784,at:.09,dur:.3},{freq:988,at:.18,dur:.65}],stalled:[{freq:880,at:0,dur:.35},{freq:587,at:.14,dur:.7}],question:[{freq:1047,at:0,dur:.28},{freq:1319,at:.12,dur:.35},{freq:1568,at:.24,dur:.6}],spawned:[{freq:523,at:0,dur:.14},{freq:784,at:.06,dur:.4}]};function eN(e,t,n=0){if(!eg())return;let r=ey();if(!r)return;if("running"!==r.state)return void r.resume().catch(()=>void 0);let i=r.currentTime+.02+n/1e3,s=r.destination;if("function"==typeof r.createStereoPanner){let e=r.createStereoPanner();e.pan.value=Math.max(-1,Math.min(1,t)),e.connect(r.destination),s=e}for(let t of ej[e])!function(e,t,n,r){let i=r+n.at,s=e.createOscillator();s.type="sine",s.frequency.value=n.freq;let l=e.createGain();l.gain.setValueAtTime(0,i),l.gain.linearRampToValueAtTime(.07,i+.012),l.gain.exponentialRampToValueAtTime(4e-4,i+n.dur),s.connect(l).connect(t),s.start(i),s.stop(i+n.dur+.05);let a=e.createOscillator();a.type="sine",a.frequency.value=2*n.freq;let o=e.createGain();o.gain.setValueAtTime(0,i),o.gain.linearRampToValueAtTime(.0126,i+.012),o.gain.exponentialRampToValueAtTime(3e-4,i+.7*n.dur),a.connect(o).connect(t),a.start(i),a.stop(i+n.dur)}(r,s,t,i)}let eS={waiting:"waiting",returned:"returned",stalled:"stalled"},eC="llvArchivedProjects";function eA(e){try{window.localStorage.setItem(eC,JSON.stringify([...e]))}catch{}}let eT="llv:tasks-changed";function eE(){window.dispatchEvent(new Event(eT))}async function e$(e,t,n){try{let r=await fetch(e,{method:t,...void 0===n?{}:{headers:{"content-type":"application/json"},body:JSON.stringify(n)}}),i=await r.json().catch(()=>null);if(!r.ok||!i)return{ok:!1,status:r.status,error:i?.error??h(f(),"tasks.failed",{status:r.status})};return eE(),{ok:!0,data:i}}catch{return{ok:!1,status:0,error:h(f(),"common.serverUnavailable")}}}async function eD(e){let t=await e$("/api/tasks","POST",e);return t.ok?{task:t.data.task}:{error:t.error}}let eM=new Map;async function eR(e){let t=eM.get(e);return t&&await t!==null?h(f(),"tasks.textNotSaved"):null}function eP(e,t){let n=void 0!==t.text?eM.get(e):void 0,r=(async()=>{n&&await n;let r=await e$(`/api/tasks/${encodeURIComponent(e)}`,"PATCH",t);return r.ok||404!==r.status?r.ok?null:r.error:(eE(),null)})();return void 0!==t.text&&(eM.set(e,r),r.finally(()=>{eM.get(e)===r&&eM.delete(e)})),r}async function eI(e){let t=await e$(`/api/tasks/${encodeURIComponent(e)}`,"DELETE");return t.ok||404!==t.status?t.ok?null:t.error:(eE(),null)}async function eL(e,t){let n=await eR(e);if(n)return{error:n};let r=await e$(`/api/tasks/${encodeURIComponent(e)}/send`,"POST",{paths:t});return r.ok?r.data:{error:r.error}}async function e_(e,t){let n=await eR(e);if(n)return{error:n};let r=await e$(`/api/tasks/${encodeURIComponent(e)}/spawn`,"POST",t);return r.ok?r.data:{error:r.error}}let ez="llv:workflows-changed";function eO(e){return e.startsWith("wf-")}let eq=new Set(["needs_decision","paused","approved"]),eF=new Set(["provisioning","implementing","reviewing","finishing"]);async function eU(e,t){try{let n=await fetch(`/api/workflows/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.ok)return window.dispatchEvent(new Event(ez)),null;let r=await n.json().catch(()=>null);return r?.error??h(f(),"wfModel.failed",{status:n.status})}catch{return h(f(),"common.serverUnavailable")}}let eB={files:[],flows:[],workflows:[],tasks:[],loaded:!1},eH="(max-width: 767px)";function eW(e){let t=window.matchMedia(eH);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function eK(){return(0,a.useSyncExternalStore)(eW,()=>window.matchMedia(eH).matches,()=>!1)}var eY=n(6304);let eJ=[[1920,4],[1440,3],[1024,2]];function eQ({files:e,workflows:t,archivedProjects:n,now:i,onSelectProject:s,onSelectFile:l,onMenu:o,attention:c}){let{t:d}=b(),u=function(){let[e,t]=(0,a.useState)(3);return(0,a.useEffect)(()=>{let e=()=>t(function(){for(let[e,t]of eJ)if(window.innerWidth>=e)return t;return 1}());return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)},[]),e}(),p=(0,a.useMemo)(()=>T(e,i,t),[e,i,t]),f=(0,a.useMemo)(()=>p.filter(e=>!n.has(e.project)),[p,n]),m=p.length-f.length,x=(0,a.useMemo)(()=>f.reduce((e,t)=>e+t.liveCount,0),[f]),h=f.filter(e=>e.liveCount>0).length,w=(0,a.useMemo)(()=>f.map(t=>{let n=M(e,t.project).flatMap(e=>e.columns.flatMap(e=>[e.file,...e.tasks])).filter(e=>"live"===e.activity),r=n.slice(0,4),i=e.filter(e=>C(e)===t.project).sort((e,t)=>t.mtime-e.mtime)[0];return{summary:t,liveBranches:r,moreLive:n.length-r.length,latest:i}}),[e,f]);return(0,r.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,r.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2.5 border-b border-line bg-panel px-4",children:[o?(0,r.jsx)("button",{type:"button",className:"-ml-1.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":d("dash.openProjects"),onClick:o,children:(0,r.jsx)(eY.A,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,r.jsx)("h1",{className:"text-[13.5px] font-bold",children:d("rail.overview")}),(0,r.jsxs)("span",{className:"text-[11.5px] text-dim",children:[x?d("overview.branchesLiveIn",{count:x,projects:d("overview.projects",{count:h})}):d("common.nothingRunning"),m?` ${d("overview.archived",{count:m})}`:""]}),c?(0,r.jsx)("span",{className:"ml-auto flex shrink-0 items-center",children:c}):null]}),(0,r.jsxs)("div",{className:"grid flex-1 auto-rows-min gap-2.5 overflow-y-auto p-3",style:{gridTemplateColumns:`repeat(${u}, minmax(0, 1fr))`},children:[w.map(({summary:e,liveBranches:t,moreLive:n,latest:i})=>(0,r.jsxs)("button",{className:"flex flex-col gap-1.5 rounded-[10px] border border-line bg-panel p-3 text-left shadow-card hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>s(e.project),children:[(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${e.liveCount?"animate-pulse bg-ok":"bg-[#d6d6dd]"}`}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] font-bold",children:e.project}),e.liveCount?(0,r.jsx)("span",{className:"shrink-0 rounded-full bg-[#e5f6ea] px-1.5 py-0.5 text-[10.5px] font-bold text-ok",children:e.liveCount}):null,(0,r.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-dim",children:e.conversations})]}),t.length?(0,r.jsxs)("span",{className:"flex flex-col gap-1",children:[t.map(e=>{let t=ed(e);return(0,r.jsxs)("span",{className:"flex cursor-pointer items-center gap-1.5 rounded-[8px] px-1 py-0.5 text-[11.5px] hover:bg-bg",role:"link",tabIndex:0,title:g(e.title),onClick:t=>{t.stopPropagation(),l(e)},onKeyDown:t=>{"Enter"===t.key&&(t.stopPropagation(),l(e))},children:[(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${V(e.activity)}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:t.style,children:t.label}),(0,r.jsx)("span",{className:"truncate font-semibold",children:g(e.title,70)})]},e.path)}),n>0?(0,r.jsx)("span",{className:"px-1 text-[10.5px] font-semibold text-dim",children:d("overview.moreLive",{count:n})}):null]}):(0,r.jsx)("span",{className:"text-[11px] text-dim",children:d("overview.quiet",{age:i?X(i.mtime):"—"})})]},e.project)),f.length?null:(0,r.jsx)("div",{className:"col-span-full mt-[20vh] text-center text-dim",children:d("overview.empty")})]})]})}var eX=n(6420),eG=n(5408),eV=n(8962),eZ=n(5480),e0=n(6408),e1=n(2159),e5=n(7218),e2=n(9805),e3=n(467),e4=n(99),e6=n(7381),e8=n(5045),e9=n(4577),e7=n(6721),te=n(4088),tt=n(4962),tn=n(5222),tr=n(9314),ti=n(4885),ts=n(6210),tl=n(5796),ta=n(4551),to=n(5688),tc=n(6619),td=n(6851),tu=n(852),tp=n(4179),tf=n(5738),tm=n(7990),tx=n(6449),th=n(8910),tb=n(7979),tg=n(5561),tw=n(966),tv=n(2750),tk=n(2571);let ty={shell:e7.A,tool:tm.A,"cmd-group":tx.A,codex:tn.A,claude:td.A,image:ts.A,blob:th.A,note:tb.A,citation:tg.A,message:tl.A,shutdown:tw.A,plan:tv.A,compact:ti.A};function tj({name:e,className:t}){let n=ty[e];return(0,r.jsx)(n,{className:t??"h-3.5 w-3.5","aria-hidden":!0})}var tN=n(8747),tS=n(7650),tC=n(2125);function tA({label:e,side:t="top",children:n}){return(0,r.jsxs)("span",{className:"group/hint relative inline-flex",children:[n,(0,r.jsx)("span",{role:"tooltip",className:`pointer-events-none absolute left-1/2 z-[60] -translate-x-1/2 whitespace-nowrap rounded-[7px] bg-ink px-2 py-1 text-[10.5px] font-semibold text-white opacity-0 shadow-card transition-opacity delay-150 duration-100 group-focus-within/hint:opacity-100 group-hover/hint:opacity-100 ${"top"===t?"bottom-full mb-1.5":"top-full mt-1.5"}`,children:e})]})}let tT={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp"};function tE(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let i=String(r.result),s=i.indexOf(",");s<0?n(Error(h(f(),"img.readFailed"))):t({base64:i.slice(s+1),mime:e.type||"image/png",preview:i})},r.onerror=()=>n(r.error??Error(h(f(),"img.readFailed"))),r.onabort=()=>n(Error(h(f(),"img.readAborted"))),r.readAsDataURL(e)})}function t$({images:e,onRemove:t}){let{t:n}=b();return e.length?(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.map((e,i)=>(0,r.jsxs)("div",{className:"group/img relative",children:[(0,r.jsx)("img",{src:e.preview,alt:n("img.previewAlt",{n:i+1}),className:"h-10 w-10 rounded border border-line object-cover"}),(0,r.jsx)("button",{type:"button",onClick:()=>t(i),"aria-label":n("img.removeAria",{n:i+1}),className:"absolute -right-1 -top-1 hidden h-4 w-4 items-center justify-center rounded-full border border-line bg-panel text-dim shadow-card hover:text-err group-hover/img:flex focus-visible:flex focus-visible:outline-none",children:(0,r.jsx)(l.A,{className:"h-2.5 w-2.5","aria-hidden":!0})})]},i)),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10.5px] font-semibold text-dim",children:[n("composer.imagesCount",{count:e.length})," ",(0,r.jsx)(e3.A,{className:"h-3 w-3","aria-hidden":!0})," ",n("img.toFilePaths")]})]}):null}function tD({onFiles:e,ariaLabel:t,className:n}){let i=(0,a.useRef)(null);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("input",{ref:i,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:t=>{e(Array.from(t.target.files??[])),t.target.value=""}}),(0,r.jsx)("button",{type:"button","aria-label":t,onClick:()=>i.current?.click(),className:n,children:(0,r.jsx)(ts.A,{className:"h-4 w-4","aria-hidden":!0})})]})}let tM=null,tR=null,tP=async()=>{try{let e=await fetch("/api/transcribe/token",{method:"POST"});if(!e.ok)return null;let t=await e.json();return"string"==typeof t.token&&t.token?t.token:null}catch{return null}};function tI(){tR||tM&&tM.expiresAt>Date.now()||(tR=tP().then(e=>(tR=null,tM={token:e,expiresAt:Date.now()+(e?45e3:15e3)},e)))}let tL=async()=>{let e=tR;if(e){let t=await e;return t&&(tM=null),t}let t=tM;return t&&t.expiresAt>Date.now()?(t.token&&(tM=null),t.token):(tM=null,tP())};function t_({onError:e,onUnclaimedText:t,onLiveCommit:n}){let{t:r}=b(),[i,s]=(0,a.useState)("idle"),[l,o]=(0,a.useState)(0),[c,d]=(0,a.useState)(""),u=(0,a.useRef)(null),p=(0,a.useRef)([]),f=(0,a.useRef)(null),m=(0,a.useRef)(!1),x=(0,a.useRef)(null),h=(0,a.useRef)(null),g=(0,a.useRef)(null),w=(0,a.useRef)(null),v=(0,a.useRef)(!1),k=(0,a.useRef)(!0),y=()=>{null!==x.current&&(clearInterval(x.current),x.current=null)},j=()=>{let e=g.current;g.current=null,e&&(cancelAnimationFrame(e.raf),e.ctx.close().catch(()=>void 0))},N=()=>{let e=f.current;if(f.current=null,e){try{e.processor.disconnect()}catch{}try{e.ws.close()}catch{}e.stream.getTracks().forEach(e=>e.stop()),e.ctx.close().catch(()=>void 0)}},S=e=>{y(),j(),N(),d(""),s("idle");let n=w.current;if(w.current=null,m.current)return void n?.(null);let r=e.partial.trim();n?n(r):r&&t(r)};(0,a.useEffect)(()=>()=>{k.current=!1,y(),j(),m.current=!0,N();let e=u.current;e&&"inactive"!==e.state&&e.stop(),e?.stream.getTracks().forEach(e=>e.stop())},[]);let C=async()=>{y(),j();let n=u.current;u.current=null,n?.stream.getTracks().forEach(e=>e.stop());let i=new Blob(p.current,{type:"audio/webm"});p.current=[];let l=w.current;if(w.current=null,m.current||i.size<2e3){s("idle"),l?.(null);return}s("busy");try{let n=new FormData;n.append("file",i,"dictation.webm");let s=await fetch("/api/transcribe",{method:"POST",body:n}),a=await s.json();if(!s.ok||"string"!=typeof a.text){e(a.error??r("dictation.failed")),l?.(null);return}let o=a.text.trim();o?l?l(o):t(o):(e(r("dictation.silence")),l?.(null))}catch{e(r("common.serverUnavailable")),l?.(null)}finally{s("idle")}},A=async()=>{if(v.current||u.current||f.current)return;v.current=!0,s("starting"),m.current=!1;let t=null,i=!0;try{let[l,a]=await Promise.all([navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),tL()]);if(t=l,!k.current||m.current)return;if(d(""),!(null!==a&&((t,i)=>{let s;try{s=new AudioContext({sampleRate:16e3})}catch{return!1}let l=new URLSearchParams({model_id:"scribe_v2_realtime",token:i,audio_format:"pcm_16000",commit_strategy:"vad",vad_silence_threshold_secs:"1.2"}),a=new WebSocket(`wss://api.elevenlabs.io/v1/speech-to-text/realtime?${l.toString()}`),o=s.createScriptProcessor(4096,1,1),c={ws:a,ctx:s,processor:o,stream:t,preOpenQueue:[],partial:""};f.current=c;let u=s.createMediaStreamSource(t);return o.onaudioprocess=e=>{if(f.current!==c)return;let t=function(e){let t=new Int16Array(e.length);for(let n=0;n<e.length;n+=1){let r=Math.max(-1,Math.min(1,e[n]??0));t[n]=r<0?32768*r:32767*r}let n=new Uint8Array(t.buffer),r="";for(let e=0;e<n.length;e+=1)r+=String.fromCharCode(n[e]??0);return btoa(r)}(e.inputBuffer.getChannelData(0));a.readyState===WebSocket.OPEN?a.send(JSON.stringify({message_type:"input_audio_chunk",audio_base_64:t})):a.readyState===WebSocket.CONNECTING&&c.preOpenQueue.push(t)},u.connect(o),o.connect(s.destination),a.addEventListener("open",()=>{if(f.current===c){for(let e of c.preOpenQueue)a.send(JSON.stringify({message_type:"input_audio_chunk",audio_base_64:e}));c.preOpenQueue=[]}}),a.addEventListener("message",t=>{if(f.current===c)try{let i=JSON.parse(t.data);if("partial_transcript"===i.message_type)c.partial=i.text??"";else if(("committed_transcript"===i.message_type||"committed_transcript_with_timestamps"===i.message_type)&&i.text)c.partial="",n(i.text);else if("auth_error"===i.message_type||"error"===i.message_type||"invalid_request"===i.message_type||"quota_exceeded"===i.message_type){e(i.error||r("dictation.liveError")),S(c);return}d(c.partial)}catch{}}),a.addEventListener("close",()=>{f.current!==c||w.current||(e(r("dictation.connectionLost")),S(c))}),!0})(t,a))){let e=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"",n=e?new MediaRecorder(t,{mimeType:e}):new MediaRecorder(t);p.current=[],n.ondataavailable=e=>{e.data.size&&p.current.push(e.data)},n.onstop=()=>{C()},n.start(250),u.current=n}i=!1,(e=>{let t;try{t=new AudioContext}catch{return}let n=t.createAnalyser();n.fftSize=128,n.smoothingTimeConstant=.7,t.createMediaStreamSource(e).connect(n);let r=new Uint8Array(n.frequencyBinCount),i=()=>{if(!g.current)return;g.current.raf=requestAnimationFrame(i),n.getByteFrequencyData(r);let e=h.current;e&&function(e,t){let n=window.devicePixelRatio||1;(e.width!==56*n||e.height!==16*n)&&(e.width=56*n,e.height=16*n);let r=e.getContext("2d");if(!r)return;r.setTransform(n,0,0,n,0,0),r.clearRect(0,0,56,16);let i=Math.max(13,Math.floor(.65*t.length))/13;for(let e=0;e<13;e+=1){let n=Math.floor(e*i),s=Math.max(n+1,Math.floor((e+1)*i)),l=0;for(let e=n;e<s;e+=1)l+=t[e]??0;let a=l/(s-n)/255,o=Math.max(1.5,16*a);r.fillStyle=`rgba(198, 40, 40, ${(.35+.65*a).toFixed(3)})`,r.fillRect(4.3076923076923075*e+1,(16-o)/2,2.3076923076923075,o)}}(e,r)};g.current={ctx:t,raf:requestAnimationFrame(i)}})(t),o(0),s("rec"),x.current=window.setInterval(()=>{o(e=>{let t=e+1;return t>=120&&(u.current?.state==="recording"?u.current.stop():f.current&&S(f.current)),t})},1e3)}catch{k.current&&e(t?r("dictation.unsupported"):r("dictation.noMic"))}finally{var l;i&&(l=t,l?.getTracks().forEach(e=>e.stop())),v.current=!1,k.current&&s(e=>"starting"===e?"idle":e)}};return{phase:i,elapsed:l,liveText:c,canvasRef:h,start:A,stop:()=>new Promise(e=>{let t=f.current;if(t){w.current=e,S(t);return}let n=u.current;n&&"recording"===n.state?(w.current=e,n.stop()):e(null)}),discard:()=>{m.current=!0,u.current?.state==="recording"?u.current.stop():f.current&&S(f.current)}}}function tz({initialText:e,persistText:t,submit:n,disabled:r=!1}){let[i,s]=(0,a.useState)(e),l=(0,a.useRef)(i),o=e=>{let n="function"==typeof e?e(l.current):e;l.current=n,s(n),t(n)},[c,d]=(0,a.useState)(!1),[u,p]=(0,a.useState)(!1),[m,x]=(0,a.useState)(null),b=(0,a.useRef)(null),g=function(e){let[t,n]=(0,a.useState)([]),r=t=>{if(!t.length)return;let r=[];for(let n of t){if(null===(tT[n.type]??null)){e.onError(h(f(),"img.unsupported",{name:n.name||n.type||h(f(),"img.unknownFile")}));continue}if(n.size>0xa00000){e.onError(h(f(),"img.tooLarge",{name:n.name||h(f(),"img.image")}));continue}r.push(n)}if(!r.length)return;let i=r.length<t.length;Promise.all(r.map(tE)).then(t=>{n(e=>[...e,...t]),i||e.onAdded?.()}).catch(t=>{e.onError(t instanceof Error?t.message:h(f(),"img.error"))})};return{images:t,addFiles:r,handlePaste:e=>{let t=Array.from(e.clipboardData.items).filter(e=>e.type.startsWith("image/")).map(e=>e.getAsFile()).filter(e=>null!==e);t.length&&(e.preventDefault(),r(t))},removeAt:e=>n(t=>t.filter((t,n)=>n!==e)),clear:()=>n([])}}({onError:e=>x({kind:"err",text:e}),onAdded:()=>x(null)}),w=e=>{o(t=>t?t.trimEnd()+" "+e:e),x(null),b.current?.focus()},v=t_({onError:e=>x({kind:"err",text:e}),onUnclaimedText:w,onLiveCommit:w}),k=v.liveText?(i?i.trimEnd()+" ":"")+v.liveText:i;(0,a.useLayoutEffect)(()=>{let e=b.current;e&&(e.style.height="0px",e.style.height=Math.min(e.scrollHeight+2,160)+"px")},[k]);let y=async()=>{if(!c&&!u){p(!0);try{let e=await v.stop();if(null===e)return;let t=e?l.current?l.current.trimEnd()+" "+e:e:l.current;o(t),await n(t)}finally{p(!1)}}},j="rec"===v.phase,N="busy"===v.phase,S=c||u||r,C=!S&&!N&&(j||!!i.trim()||g.images.length>0);return{text:i,textRef:l,setText:o,setTextState:s,displayText:k,inputRef:b,status:m,setStatus:x,busy:c,setBusy:d,voiceSending:u,dictation:v,attachments:g,insertSpoken:w,stopAndSend:y,submit:n,dictationRecording:j,dictationBusy:N,fieldsDisabled:S,canSend:C}}let tO=new Set,tq=null,tF=!1,tU=!1,tB=!1;async function tH(){if(0!==tO.size){if(tF){tU=!0;return}tF=!0;try{let e=[...tO];for(let t=0;t<e.length;t+=64){let n=e.slice(t,t+64),r=n.map((e,t)=>({id:String(t),...null!==e.pid?{pid:e.pid}:{},...e.path?{path:e.path}:{}})),i={},s=!1;try{let e=await fetch("/api/tmux/targets",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({reqs:r})});e.ok?i=(await e.json()).targets??{}:s=!0}catch{s=!0}for(let e=0;e<n.length;e+=1){let t=n[e];tO.has(t)&&(s?t.onTarget({transportError:!0}):Object.prototype.hasOwnProperty.call(i,String(e))&&t.onTarget(i[String(e)]??null))}}}finally{tF=!1,tU&&(tU=!1,tH())}}}function tW({onClose:e}){let{locale:t,t:n}=b(),[i,s]=(0,a.useState)(null),[l,o]=(0,a.useState)(null),[c,d]=(0,a.useState)(null),[u,p]=(0,a.useState)(!1),[f,m]=(0,a.useState)(null),x=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=!1;return fetch("/api/transcribe/backend").then(e=>e.json()).then(t=>{!e&&Array.isArray(t.options)&&s(t)}).catch(()=>{e||o(h(t,"common.serverUnavailable"))}),()=>{e=!0}},[t]),(0,a.useEffect)(()=>{let t=t=>{x.current&&!x.current.contains(t.target)&&e()},n=t=>{"Escape"===t.key&&e()};return window.addEventListener("pointerdown",t),window.addEventListener("keydown",n),()=>{window.removeEventListener("pointerdown",t),window.removeEventListener("keydown",n)}},[e]);let g=async(t,r)=>{if(i&&!i.lockedByEnv&&!f){if(!r){d(t),p(!1);return}m(t),o(null);try{let r=await fetch("/api/transcribe/backend",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({backend:t})}),i=await r.json();if(!r.ok)return void o(i.error??n("mic.saveFailed"));s(i),e()}catch{o(n("common.serverUnavailable"))}finally{m(null)}}},w=c&&i?i.options.find(e=>e.id===c):null;return(0,r.jsx)("div",{ref:x,role:"menu","aria-label":n("mic.menuTitle"),className:"absolute bottom-[calc(100%+6px)] right-0 z-40 w-[300px] rounded-[12px] border border-line bg-panel p-1.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:w?(0,r.jsxs)("div",{className:"flex flex-col gap-2 p-2",children:[(0,r.jsx)("span",{className:"text-[12px] font-bold text-err",children:n("mic.keyTitle",{name:n(`stt.${w.id}.name`)})}),(0,r.jsx)("span",{className:"text-[11.5px] leading-snug text-ink",children:n(`stt.${w.id}.fix`)}),(0,r.jsxs)("span",{className:"flex items-center gap-1 rounded-[8px] border border-line bg-bg px-2 py-1.5",children:[(0,r.jsx)("code",{className:"min-w-0 flex-1 break-all font-mono text-[10.5px] text-ink",children:w.keyPath}),(0,r.jsxs)("button",{type:"button","aria-label":n("mic.copyPath"),title:n("mic.copyPath"),className:"inline-flex shrink-0 items-center gap-1 rounded-[6px] border border-line bg-panel px-1.5 py-1 text-[10px] font-semibold text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{navigator.clipboard.writeText(w.keyPath).then(()=>p(!0))},children:[u?(0,r.jsx)(e9.A,{className:"h-3 w-3 text-ok","aria-hidden":!0}):(0,r.jsx)(tr.A,{className:"h-3 w-3","aria-hidden":!0}),u?n("mic.copied"):n("mic.copy")]})]}),(0,r.jsxs)("button",{type:"button",className:"self-start rounded-[8px] px-2 py-1 text-[11px] font-semibold text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>d(null),children:["← ",n("mic.back")]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"px-2 pb-1 pt-1.5 text-[10.5px] font-bold uppercase tracking-wide text-dim",children:n("mic.menuTitle")}),i?.lockedByEnv?(0,r.jsx)("div",{className:"px-2 pb-1 text-[10.5px] text-err",children:n("mic.menuLocked")}):null,i||l?null:(0,r.jsxs)("div",{className:"flex items-center gap-2 px-2 py-2 text-[11.5px] text-dim",children:[(0,r.jsx)(tk.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",n("mic.menuLoading")]}),(i?.options??[]).map(e=>{let t=i?.backend===e.id;return(0,r.jsxs)("button",{type:"button",role:"menuitemradio","aria-checked":t,disabled:!!i?.lockedByEnv||null!==f,onClick:()=>void g(e.id,e.available),className:`flex w-full items-start gap-2 rounded-[9px] px-2 py-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${t?"bg-accent/10":"hover:bg-bg"}`,children:[(0,r.jsx)("span",{className:"mt-[3px] flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:f===e.id?(0,r.jsx)(tk.A,{className:"h-3.5 w-3.5 animate-spin text-dim","aria-hidden":!0}):t?(0,r.jsx)(e9.A,{className:"h-3.5 w-3.5 text-accent","aria-hidden":!0}):(0,r.jsx)("span",{"aria-hidden":!0,className:"h-2 w-2 rounded-full",style:{backgroundColor:e.available?"#1a8a3e":"#e0ae45"}})}),(0,r.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-ink",children:[n(`stt.${e.id}.name`),e.available?null:(0,r.jsx)("span",{className:"rounded-full bg-[#fdf3dd] px-1.5 py-px text-[9.5px] font-bold text-[#b07d1f]",children:n("mic.noKey")})]}),(0,r.jsx)("span",{className:"block text-[10.5px] leading-snug text-dim",children:n(`stt.${e.id}.desc`)})]})]},e.id)}),l?(0,r.jsx)("div",{className:"px-2 py-1 text-[10.5px] font-semibold text-err",children:l}):null]})})}function tK({phase:e,elapsed:t,canvasRef:n,start:i,stop:s,discard:o,onText:c,busy:d=!1}){let{t:u}=b(),[p,f]=(0,a.useState)(!1),m=()=>{d||("idle"===e?i():"rec"===e&&s().then(e=>{e&&c(e)}))};if("rec"===e)return(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[(0,r.jsxs)("button",{type:"button","aria-label":u("mic.stopRecognize"),onClick:m,className:"flex items-center gap-1.5 rounded-[8px] border border-err/50 bg-[#fff2f2] px-2 py-2 text-[11px] font-bold text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/40",children:[(0,r.jsx)("canvas",{ref:n,width:56,height:16,className:"h-4 w-14","aria-hidden":!0}),`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`]}),(0,r.jsx)("button",{type:"button","aria-label":u("mic.cancel"),onClick:o,className:"inline-flex items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,r.jsx)(l.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]});return(0,r.jsxs)("span",{className:"relative inline-flex shrink-0",children:[(0,r.jsx)("button",{type:"button","aria-label":u("busy"===e?"mic.recognizing":"starting"===e?"mic.connecting":"mic.dictate"),title:u("busy"===e?"mic.recognizing":"starting"===e?"mic.connecting":"mic.dictateHint"),disabled:"idle"!==e||d,onClick:m,onPointerEnter:tI,onFocus:tI,onContextMenu:e=>{e.preventDefault(),f(e=>!e)},className:`inline-flex shrink-0 items-center justify-center rounded-[8px] border p-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${"starting"===e?"border-accent/40 bg-accent/10 text-accent":"border-line bg-panel text-dim hover:text-accent"}`,children:"busy"===e?(0,r.jsx)(tk.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):"starting"===e?(0,r.jsx)(to.A,{className:"h-4 w-4 animate-pulse","aria-hidden":!0}):(0,r.jsx)(to.A,{className:"h-4 w-4","aria-hidden":!0})}),p?(0,r.jsx)(tW,{onClose:()=>f(!1)}):null]})}function tY({composer:e,placeholder:t,textareaAriaLabel:n,imageAriaLabel:i,leftSlot:s,sendLabelIdle:l,sendLabelRecording:a,sendTitleRecording:o,sendIdleClassName:c,sendIdleStyle:d,showImage:u=!0}){let{displayText:p,inputRef:f,dictation:m,setText:x,attachments:h,voiceSending:b,insertSpoken:g,stopAndSend:w,submit:v,fieldsDisabled:k,canSend:y,dictationRecording:j,busy:N,status:S}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("textarea",{ref:f,value:p,rows:1,readOnly:!!m.liveText,onChange:e=>x(e.target.value),onFocus:tI,onPaste:h.handlePaste,onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),"rec"===m.phase?w():v())},placeholder:t,"aria-label":n,disabled:k,className:"w-full resize-none overflow-y-auto rounded-[10px] border border-line bg-panel px-2.5 py-1.5 text-[12.5px] leading-[18px] text-[#222] placeholder:text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,r.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[s,(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,r.jsx)(tK,{...m,busy:b,onText:g}),u?(0,r.jsx)(tA,{label:i,children:(0,r.jsx)(tD,{ariaLabel:i,className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onFiles:h.addFiles})}):null,(0,r.jsx)(tA,{label:j?o??a:l,children:(0,r.jsx)("button",{type:j?"button":"submit",onClick:j?()=>void w():void 0,disabled:!y,"aria-label":j?a:l,style:j?void 0:d,className:`inline-flex shrink-0 items-center justify-center rounded-[8px] border p-2 text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40 ${j?"border-err bg-err hover:opacity-90":c}`,children:N||b?(0,r.jsx)(tk.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,r.jsx)(tc.A,{className:"h-4 w-4","aria-hidden":!0})})})]})]}),(0,r.jsx)(t$,{images:h.images,onRemove:h.removeAt}),S?(0,r.jsx)("span",{className:`truncate text-[10.5px] font-semibold ${"ok"===S.kind?"text-ok":"text-err"}`,children:S.text}):null]})}function tJ(e){return"claude-projects"===e.root?"session"===e.kind||"subagent"===e.kind:"codex-sessions"===e.root}let tQ="llv-compose-draft";function tX({file:e,pollPaused:t=!1}){let{t:n}=b(),i=function(e,t,n=!0){let[r,i]=(0,a.useState)(null);return(0,a.useEffect)(()=>{var r;if(n&&(null!==e||t))return r={pid:e,path:t??"",onTarget(e){"object"==typeof e&&null!==e&&"transportError"in e||i(e)}},tO.add(r),null===tq&&(tq=setInterval(()=>void tH(),5e3)),tB||(tB=!0,setTimeout(()=>{tB=!1,tH()},0)),()=>{tO.delete(r),0===tO.size&&null!==tq&&(clearInterval(tq),tq=null)}},[e,t,n]),null!==e||t?r:null}(e.pid,tJ(e)?e.path:void 0,!t),s=tz({initialText:()=>sessionStorage.getItem("llvDraft:"+e.path)??"",persistText:t=>{t?sessionStorage.setItem("llvDraft:"+e.path,t):sessionStorage.removeItem("llvDraft:"+e.path)},submit:e=>I(e)}),{text:o,textRef:c,setText:d,setTextState:u,inputRef:p,setStatus:m,busy:x,setBusy:h,voiceSending:g,attachments:w}=s,v=eK(),[k,y]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[S,C]=(0,a.useState)(!1),[A,T]=(0,a.useState)(!1),[E,$]=(0,a.useState)([]);(0,a.useEffect)(()=>{if(!A)return;let e=window.setTimeout(()=>T(!1),4e3);return()=>window.clearTimeout(e)},[A]),(0,a.useEffect)(()=>$(function(e){try{let t=JSON.parse(sessionStorage.getItem("llvSent:"+e)??"[]");return Array.isArray(t)?t:[]}catch{return[]}}(e.path)),[e.path]),(0,a.useEffect)(()=>{let t=t=>{if(t.detail?.path!==e.path)return;let n=sessionStorage.getItem("llvDraft:"+e.path)??"";c.current=n,u(n),requestAnimationFrame(()=>{let e=p.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))})};return window.addEventListener(tQ,t),()=>window.removeEventListener(tQ,t)},[e.path,p,u,c]),(0,a.useEffect)(()=>{let t=()=>$(t=>{let n=t.filter(t=>"pane"===t.via?1e3*e.mtime<t.at+2e3&&Date.now()-t.at<6e5:Date.now()-t.at<9e4);return n.length!==t.length&&sessionStorage.setItem("llvSent:"+e.path,JSON.stringify(n)),n.length!==t.length?n:t});t();let n=setInterval(t,5e3);return()=>clearInterval(n)},[e.mtime,e.path]);let D=tJ(e);if(null===i&&!D)return null;let M=null===i,R=M&&"claude-projects"===e.root&&"subagent"===e.kind,P=t=>{$(t),sessionStorage.setItem("llvSent:"+e.path,JSON.stringify(t))},I=async t=>{let r=t??o;if(!x&&!g&&(r.trim()||w.images.length)){h(!0),m(null);try{let t=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pid:e.pid??void 0,path:e.path,text:r,images:w.images.map(e=>({base64:e.base64,mime:e.mime}))})}),i=await t.json();if(!t.ok||!i.ok)return void m({kind:"err",text:i.error??n("common.failedSend")});let s=w.images.length,l={id:Date.now(),text:r.trim()||(s?n("composer.imagesCount",{count:s}):""),at:Date.now(),via:i.spawned?"spawn":"pane"};P([...E,l].slice(-8)),d(""),w.clear(),m({kind:"ok",text:i.spawned?n("composer.spawned",{target:i.target??""}):i.imagePaths?.length?n("composer.sentPaths",{count:i.imagePaths.length}):n("common.sent")}),p.current?.focus()}catch{m({kind:"err",text:n("common.serverUnavailable")})}finally{h(!1)}}},L=async()=>{if(!j){N(!0),m(null);try{let t=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"interrupt",path:e.path})}),r=await t.json();if(!t.ok||!r.ok)return void m({kind:"err",text:r.error??n("composer.failedInterrupt")});m({kind:"ok",text:n("composer.escapeSent")})}catch{m({kind:"err",text:n("common.serverUnavailable")})}finally{N(!1)}}},_=async()=>{if(!S){C(!0),m(null);try{let t=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"compact",path:e.path})}),r=await t.json();if(!t.ok||!r.ok)return void m({kind:"err",text:r.error??n("composer.failedCompact")});m({kind:"ok",text:n("composer.compactSent")})}catch{m({kind:"err",text:n("common.serverUnavailable")})}finally{C(!1)}}},z=(0,r.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-1.5 py-1 font-mono text-[9.5px] font-semibold text-[#555]",title:R?n("composer.titleRelay"):M?n("composer.titleSpawnResumed"):`tmux ${i}`,children:R?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e4.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",n("composer.root")]}):M?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(tc.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," resume"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(tp.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",(0,r.jsx)("span",{className:"truncate",children:i})]})}),O=M?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(tA,{label:n("composer.interruptTitle"),children:(0,r.jsx)("button",{type:"button","aria-label":n("composer.interruptAria"),disabled:j,onClick:()=>void L(),className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50",children:j?(0,r.jsx)(tk.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,r.jsx)(tu.A,{className:"h-4 w-4",fill:"currentColor","aria-hidden":!0})})}),(0,r.jsx)(tA,{label:A?n("composer.compactConfirmTitle"):n("composer.compactTitle"),children:(0,r.jsx)("button",{type:"button","aria-label":A?n("composer.compactConfirmTitle"):n("composer.compactAria"),disabled:S,onClick:()=>{A?(T(!1),_()):T(!0)},className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-[8px] border p-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 ${A?"border-[#0d9488] bg-[#e3f4f0] text-[#0b7c72]":"border-line bg-panel text-dim hover:border-[#0d9488]/50 hover:text-[#0b7c72]"}`,children:S?(0,r.jsx)(tk.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):A?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e9.A,{className:"h-4 w-4","aria-hidden":!0}),(0,r.jsx)("span",{className:"text-[10.5px] font-bold",children:n("composer.compactConfirm")})]}):(0,r.jsx)(ti.A,{className:"h-4 w-4","aria-hidden":!0})})})]});return(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault(),I()},className:"flex shrink-0 flex-col gap-1.5 border-t border-line bg-[#fbfbfd] px-2.5 py-2","aria-label":M?n("composer.spawnAria"):n("composer.sendAria",{target:i??""}),children:[E.length?(0,r.jsx)("div",{className:"flex flex-col gap-0.5","aria-label":n("composer.queueAria"),children:E.map(e=>(0,r.jsxs)("div",{className:"flex items-center justify-end gap-1.5",children:[(0,r.jsx)("span",{className:"min-w-0 max-w-[85%] truncate rounded-[10px] rounded-br-[3px] bg-[#ecebfb] px-2 py-0.5 text-[11px] text-[#333]",title:e.text,children:e.text}),(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[9.5px] text-dim",children:["spawn"===e.via?(0,r.jsx)(tc.A,{className:"h-2.5 w-2.5","aria-hidden":!0}):(0,r.jsx)(e3.A,{className:"h-2.5 w-2.5","aria-hidden":!0}),new Date(e.at).toLocaleTimeString("uk"===f()?"uk-UA":"en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"})]}),(0,r.jsx)("button",{type:"button","aria-label":n("composer.removeFromQueue"),className:"inline-flex shrink-0 items-center rounded px-0.5 text-dim hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>P(E.filter(t=>t.id!==e.id)),children:(0,r.jsx)(l.A,{className:"h-3 w-3","aria-hidden":!0})})]},e.id))}):null,(0,r.jsx)(tY,{composer:s,placeholder:R?n("composer.placeholderRelay"):M?n("composer.placeholderSpawn"):n("composer.placeholderSend"),textareaAriaLabel:n("composer.textAria"),imageAriaLabel:n("composer.addImages"),sendLabelIdle:M?n("composer.launchAgent"):n("composer.sendToAgent"),sendLabelRecording:n("composer.stopAndSend"),sendTitleRecording:n("composer.stopAndSendTitle"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",showImage:!v,leftSlot:v?(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,r.jsx)("button",{type:"button","aria-expanded":k,"aria-label":n("composer.moreTools"),title:n("composer.moreTools"),onClick:()=>y(e=>!e),className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,r.jsx)(tC.A,{className:`h-4 w-4 transition-transform ${k?"rotate-45":""}`,"aria-hidden":!0})}),k?(0,r.jsxs)(r.Fragment,{children:[z,O,(0,r.jsx)(tD,{ariaLabel:n("composer.addImages"),className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onFiles:w.addFiles})]}):null]}):(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[z,O]})})]})}let tG="#0d9488",tV=new Map;function tZ(){for(let e of document.querySelectorAll("[data-link-hover]"))e.removeAttribute("data-link-hover")}function t0(e,t,n,r){let i=Math.max(48,.45*Math.abs(n-e));return`M ${e} ${t} C ${e+i} ${t}, ${n-i} ${r}, ${n} ${r}`}function t1(e){let[t,n]=(0,a.useState)(!1),i=(0,a.useRef)(e);(0,a.useEffect)(()=>{i.current=e},[e]);let[s,l]=(0,a.useState)(null),[o,c]=(0,a.useState)(null),d=(0,a.useRef)(null),u=(0,a.useRef)(!1),p=(0,a.useRef)(!1),f=(0,a.useRef)(null),m="link-arrow-"+(0,a.useId)().replace(/[^a-zA-Z0-9-]/g,"");return(0,a.useEffect)(()=>()=>{d.current?.detach(),d.current=null,document.body.style.cursor="",tZ()},[]),(0,a.useEffect)(()=>{if(!o)return;let e=window.setTimeout(()=>{tZ(),c(null)},1600);return()=>window.clearTimeout(e)},[o]),{onPillPointerDown:e=>{if("mouse"===e.pointerType&&0!==e.button||d.current)return;let t=e.currentTarget.getBoundingClientRect(),r=e=>{let t=d.current;if(!t)return;if(t.lastX=e.clientX,t.lastY=e.clientY,!t.active){if(7>Math.hypot(e.clientX-t.startX,e.clientY-t.startY))return;t.active=!0,u.current=!0,p.current=!0,document.body.style.cursor="crosshair",tZ(),c(null),l({x:t.anchorX,y:t.anchorY}),n(!0),i.current.onDragStart?.()}f.current?.setAttribute("d",t0(t.anchorX,t.anchorY,e.clientX,e.clientY));let r=function(e,t,n){let r=document.elementFromPoint(e,t)?.closest("[data-link-path]"),i=r?.getAttribute("data-link-path");if(!r||!i||i===n)return null;let s=tV.get(i);return s&&s.el===r?s:null}(e.clientX,e.clientY,i.current.exclude??null);r?.el!==t.hover?.el&&(t.hover?.el.removeAttribute("data-link-hover"),r?.el.setAttribute("data-link-hover","1"),t.hover=r)},s=e=>{let t=d.current;if(d.current=null,t?.detach(),u.current=!1,document.body.style.cursor="",t?.active)if(n(!1),t.hover){let n=i.current.onDrop(t.hover,{x:e.clientX,y:e.clientY});null!==n?c({label:n,from:{x:t.anchorX,y:t.anchorY},to:{x:e.clientX,y:e.clientY}}):tZ()}else tZ(),i.current.onMiss?.({x:e.clientX,y:e.clientY})};d.current={startX:e.clientX,startY:e.clientY,anchorX:t.right,anchorY:t.top+t.height/2,lastX:e.clientX,lastY:e.clientY,active:!1,hover:null,detach:()=>{window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)}},window.addEventListener("pointermove",r),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s)},consumeClick:()=>{let e=p.current;return p.current=!1,e},draggingRef:u,overlay:t||o?(0,tS.createPortal)((0,r.jsxs)("div",{className:"pointer-events-none fixed inset-0 z-[95]",children:[(0,r.jsxs)("svg",{className:"block h-full w-full",children:[(0,r.jsx)("defs",{children:(0,r.jsx)("marker",{id:m,markerWidth:"9",markerHeight:"9",refX:"7",refY:"4.5",orient:"auto",children:(0,r.jsx)("path",{d:"M0,0 L8,4.5 L0,9 Z",fill:tG})})}),(0,r.jsx)("path",{ref:e=>{f.current=e;let t=d.current;e&&t?.active&&e.setAttribute("d",t0(t.anchorX,t.anchorY,t.lastX,t.lastY))},d:o?t0(o.from.x,o.from.y,o.to.x,o.to.y):void 0,fill:"none",stroke:tG,strokeWidth:2.5,strokeLinecap:"round",markerEnd:`url(#${m})`}),(0,r.jsx)("circle",{cx:o?o.from.x:s?.x??0,cy:o?o.from.y:s?.y??0,r:4,fill:tG})]}),o?(0,r.jsx)(t5,{drop:o}):null]}),document.body):null}}function t5({drop:e}){let t=Math.max(8,Math.min(e.to.x+14,window.innerWidth-288)),n=Math.max(8,Math.min(e.to.y+12,window.innerHeight-44));return(0,r.jsxs)("div",{className:"fixed flex max-w-[280px] items-center gap-1.5 rounded-full px-3 py-1.5 text-[11.5px] font-semibold text-white shadow-card",style:{left:t,top:n,backgroundColor:tG},children:[(0,r.jsx)(tN.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"truncate",children:e.label})]})}function t2({file:e,onDeleted:t}){let{t:n}=b(),[i,s]=(0,a.useState)(!1),[l,o]=(0,a.useState)(!1),[c,d]=(0,a.useState)("");if((0,a.useEffect)(()=>{if(!i)return;let e=window.setTimeout(()=>s(!1),5e3);return()=>window.clearTimeout(e)},[i]),"running"===e.proc)return null;let u=async()=>{o(!0),d("");try{let r=await fetch(`/api/log?path=${encodeURIComponent(e.path)}`,{method:"DELETE"}),i=await r.json();if(!r.ok||!i.ok)return void d(i.error??n("common.failedDelete"));s(!1),t?.()}catch{d(n("common.serverUnavailable"))}finally{o(!1)}};return i?(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5 text-[11px]",children:[(0,r.jsx)("span",{className:"px-0.5 font-semibold text-err",children:n("delFile.confirm")}),(0,r.jsx)("button",{type:"button",className:"rounded-lg bg-err px-2 py-0.5 font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:l,onClick:u,children:l?"…":n("common.yes")}),(0,r.jsx)("button",{type:"button",className:"rounded-lg border border-line bg-panel px-2 py-0.5 font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>s(!1),children:n("common.no")})]}):(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1",children:[(0,r.jsx)("button",{type:"button",className:"inline-flex items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":n("delFile.aria"),title:n("delFile.aria"),onClick:()=>s(!0),children:(0,r.jsx)(tf.A,{className:"h-3 w-3","aria-hidden":!0})}),c?(0,r.jsx)("span",{className:"max-w-[160px] truncate text-[10.5px] font-semibold text-err",title:c,children:c}):null]})}function t3({className:e,style:t,enter:n="scale",children:i}){let s=(0,a.useRef)(null);return!function(e,t="scale"){let n=(0,a.useRef)(new Map),r=(0,a.useRef)(new WeakMap),i=(0,a.useRef)(!0);(0,a.useLayoutEffect)(()=>{let s=e.current;if(!s)return;let l="u">typeof matchMedia&&matchMedia("(prefers-reduced-motion: reduce)").matches,a=s.getBoundingClientRect(),o=[...s.children].filter(e=>e instanceof HTMLElement&&void 0!==e.dataset.flipKey),c=new Map;for(let e of o){let o=e.dataset.flipKey,d=e.getBoundingClientRect(),u=r.current.get(e);u&&(u.cancel(),r.current.delete(e));let p=e.getBoundingClientRect(),f={x:p.left-a.left+s.scrollLeft,y:p.top-a.top+s.scrollTop},m=n.current.get(o);if(c.set(o,f),l||i.current||void 0!==e.dataset.flipSkip)continue;if(!m){if("none"===t)continue;let n="fade"===t?[{opacity:0},{opacity:1}]:[{opacity:0,transform:"scale(0.96)"},{opacity:1,transform:"scale(1)"}],i=e.animate(n,{duration:"fade"===t?120:240,easing:"ease-out"});r.current.set(e,i),i.addEventListener("finish",()=>r.current.delete(e));continue}let x=m.x-f.x+(d.left-p.left),h=m.y-f.y+(d.top-p.top);if(2>Math.abs(x)&&2>Math.abs(h))continue;let b=e.animate([{transform:`translate(${x}px, ${h}px)`},{transform:"translate(0px, 0px)"}],{duration:280,easing:"cubic-bezier(0.22, 0.72, 0.3, 1)"});r.current.set(e,b),b.addEventListener("finish",()=>r.current.delete(e))}n.current=c,i.current=!1})}(s,n),(0,r.jsx)("div",{ref:s,className:e,style:t,children:i})}var t4=n(4760);let t6=new Set,t8=null,t9=null,t7=null,ne=null,nt=!1,nn=!1,nr=!1,ni=!1,ns=0,nl=new Map;function na(e,t){return e&&t(e),null}function no(){ns+=1,ne?.close(),ne=null,nl=new Map}function nc(){t8=na(t8,clearInterval)}async function nd(){if(0!==t6.size){if(nt){nn=!0;return}nt=!0;try{let e=[...t6];for(let t=0;t<e.length;t+=64){let n=e.slice(t,t+64),r=n.map((e,t)=>({id:String(t),path:e.path,offset:e.getOffset()})),i={},s=!1;try{let e=await fetch("/api/logs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({reqs:r})});i=(await e.json()).chunks??{}}catch{s=!0}for(let e=0;e<n.length;e+=1){let t=n[e];if(t6.has(t))if(s)t.onChunk({transportError:!0});else{let n=i[String(e)];n&&t.onChunk(n)}}}}finally{nt=!1,nn&&(nn=!1,nd())}}}function nu(){nr||(nr=!0,setTimeout(()=>{nr=!1,ni&&nd()},0))}function np(){0!==t6.size&&(no(),ni=!0,null===t8&&(t8=setInterval(()=>void nd(),1200)),nu(),t9=na(t9,clearTimeout),t9=setTimeout(()=>{t9=null,0!==t6.size&&(ni=!1,nc(),nm(0))},6e4))}function nf(){if(t7=na(t7,clearTimeout),0===t6.size)return;if("u"<typeof EventSource||t6.size>64)return void np();ni=!1,nc(),t9=na(t9,clearTimeout),no();let e=ns,t=[...t6],n=t.map((e,t)=>({id:String(t),path:e.path,offset:e.getOffset()}));nl=new Map(n.map((e,n)=>[e.id,t[n]]));let r=new EventSource(`/api/logs/stream?subs=${encodeURIComponent(JSON.stringify(n))}`);ne=r,r.addEventListener("chunk",t=>{let n;if(e===ns&&r===ne){try{n=JSON.parse(t.data)}catch{return}if("string"==typeof n.id&&n.chunk&&"object"==typeof n.chunk){var i,s;let e;i=n.id,s=n.chunk,(e=nl.get(i))&&t6.has(e)&&e.onChunk(s)}}}),r.onerror=()=>{if(e===ns&&r===ne){for(let e of t6)e.onChunk({transportError:!0});np()}}}function nm(e=300){ni?nu():(t7=na(t7,clearTimeout),t7=setTimeout(nf,e))}let nx=e=>new TextEncoder().encode(e).length,nh=/^\s*(?:VERDICT:\s*)?(REQUEST_CHANGES|APPROVE|COMMENT)\b/m,nb=/^\s*(\d+)[.)]\s+(.*)$/,ng=/(?:\[(P[0-3])\]|\b(Critical|High|Medium|Low|Info|P[0-3])\b)/i,nw=/((?:\.{1,2}\/|\/|~\/)?[\w@.+-][\w@.+\-/]*\.(?:tsx?|jsx?|mjs|cjs|mts|cts|py|go|rs|md|json|ya?ml|toml|css|scss|html|sql|sh|env|ftl|txt))(?::(\d+))?/i,nv=/\[([^\]]+)\]\(([^)\s]+)\)/,nk=/([\w.-]*(?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token))\b(\s*[:=]\s*)(["']?)[^\s"',}]+/gi;function ny(e){return e.replace(nk,(e,t,n,r)=>`${t}${n}${r}[redacted]`)}function nj(e){let t=ny(e);return{raw:t.slice(0,24e3),truncated:t.length>24e3}}function nN(e){let t=e.match(/^(.*?):(\d+(?:-\d+)?)$/);return t?{target:t[1]??e,line:t[2]}:{target:e}}function nS(e,t){let n=e.match(nh)?.[1];if(!n)return null;let r=[],i=[],s=null,l=()=>{let e,t,n,i=s?.trim();i&&r.push((e=function(e){let t=e.toUpperCase();if("P0"===t||"P1"===t||"P2"===t||"P3"===t)return t;let n=e.toLowerCase();return"critical"===n?"Critical":"high"===n?"High":"medium"===n?"Medium":"low"===n?"Low":"Info"}(i.match(ng)?.[1]??i.match(ng)?.[2]??"Info"),t=function(e){let t=e.match(nv);if(t){let e=nN((t[2]??"").replace(/^file:\/\//,"")),n=e.line?Number(e.line.split("-",1)[0]):void 0;return{file:e.target||t[1],line:Number.isFinite(n)?n:void 0}}let n=e.match(nw);if(!n)return{};let r=n[2]?Number(n[2]):void 0;return{file:n[1],line:Number.isFinite(r)?r:void 0}}(i),n=function(e){let t=e,n=t.match(ng);if(n&&void 0!==n.index){let e=t.slice(n.index+n[0].length).replace(/^[\s.:–—-]+/,"");e&&(t=e)}return t.replace(nv,"$1").replace(/`([^`]*)`/g,"$1").replace(/\s+/g," ").trim().slice(0,200)}(i)||i.slice(0,200)||"Finding",{severity:e,file:t.file,line:t.line,title:n,body:nj(i).raw})),s=null};for(let t of e.split("\n")){let e=t.trimEnd(),n=e.match(nb);if(n){l(),s=n[2]??"";continue}let a=e.trim();if(null!==s){a?s=`${s}
|
|
2
|
-
${a}`:l();continue}!(!a||nh.test(e)||/^(findings?|summary|open questions?|tests?|residual risk)\s*:?\s*$/i.test(a))&&0===r.length&&i.length<3&&a.length<=240&&i.push(a)}l();let a=r.filter(e=>ng.test(e.body)).length;return n||/^findings?\s*:?$/im.test(e)||a>=2||a>=1&&/\b(review|request_changes|approve|comment)\b/i.test(e)?{kind:"review",ts:t,verdict:n,findings:r,summary:i,raw:nj(e).raw}:null}let nC=(e,t)=>h(f(),e,t),nA=/<oai-mem-citation>\s*<citation_entries>([\s\S]*?)<\/citation_entries>\s*<rollout_ids>([\s\S]*?)<\/rollout_ids>\s*<\/oai-mem-citation>/g;function nT(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}let nE=/<(teammate-message|agent-message)\b([^>]*)>([\s\S]*?)<\/\1>/g,n$=/\S*\/(?:agent-log-viewer\/inbox|\.claude\/viewer-inbox)\/([A-Za-z0-9._-]+\.(?:png|jpe?g|gif|webp))/gi;function nD(e){if(!e.includes("/.claude/viewer-inbox/")&&!e.includes("/agent-log-viewer/inbox/"))return{cleaned:e,images:[]};let t=[],n=new Set,r=[];for(let i of e.split("\n"))i.replace(n$,(e,r)=>(n.has(e)||(n.add(e),t.push({name:r,path:e})),"")).trim()&&r.push(i);return{cleaned:r.join("\n").trim(),images:t}}let nM=/^\s*(?:<[a-zA-Z][\w:-]*|Caveat: The messages below|\[Request interrupted|This came from another Claude session|# AGENTS\.md instructions)/;function nR(e,t){let n=e.match(/^\s*<([a-zA-Z][\w:-]*)/)?.[1];return n||(/^\s*# AGENTS\.md/.test(e)?"AGENTS.md":/^\s*Caveat:/.test(e)?"caveat":t||nC("render.system"))}function nP(e,t){return e.match(RegExp(`${t}="([^"]*)"`))?.[1]??""}function nI(e){return"string"==typeof e?e:""}function nL(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:{}}function n_(e){return Array.isArray(e)?e.filter(e=>e&&"object"==typeof e&&!Array.isArray(e)):[]}function nz(e,t,n){let r=t.split("\n").map(e=>e.trim()).filter(Boolean).map(e=>{let t=e.match(/\|note=\[(.*)\]$/)?.[1],n=nN(e.replace(/\|note=\[.*\]$/,""));return{target:n.target,line:n.line,note:t,raw:e}}),i=n.split(/\s+/).map(e=>e.trim()).filter(e=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)),s=nj(e);return{kind:"mem-citation",entries:r,rolloutIds:i,raw:s.raw,truncated:s.truncated}}async function nO(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let n=document.execCommand("copy");return t.remove(),n}catch{return!1}}function nq({text:e,label:t,className:n=""}){let[i,s]=(0,a.useState)(!1),l=(0,a.useRef)(null);(0,a.useEffect)(()=>()=>{null!==l.current&&window.clearTimeout(l.current)},[]);let o=i?nC("common.copied"):t??nC("common.copy");return(0,r.jsx)("button",{type:"button","aria-label":o,title:o,onClick:t=>{t.preventDefault(),t.stopPropagation(),nO(e).then(e=>{e&&(s(!0),null!==l.current&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>s(!1),1400))})},className:`inline-flex shrink-0 items-center justify-center rounded-[6px] border border-line bg-panel p-1 text-dim shadow-card hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${n}`,children:i?(0,r.jsx)(e9.A,{className:"h-3 w-3 text-ok","aria-hidden":!0}):(0,r.jsx)(tr.A,{className:"h-3 w-3","aria-hidden":!0})})}var nF=n(6565);function nU({src:e,alt:t,caption:n,onClose:i}){let{t:s}=b(),[o,c]=(0,a.useState)(1),[d,u]=(0,a.useState)(0),[p,f]=(0,a.useState)(0),[m,x]=(0,a.useState)(!1),h=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=e=>{"Escape"===e.key&&i()};window.addEventListener("keydown",e);let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",e),document.body.style.overflow=t}},[i]);let g=(e,t=0,n=0)=>{let r=Math.min(8,Math.max(.25,o*e)),i=r/o;c(r),u(t-(t-d)*i),f(n-(n-p)*i)},w=()=>{c(1),u(0),f(0)};return(0,tS.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-black/85 backdrop-blur-sm",role:"dialog","aria-modal":"true","aria-label":t,onClick:i,children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2.5",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("span",{className:"min-w-0 truncate text-[12.5px] font-semibold text-white/85",children:n??t}),(0,r.jsxs)("span",{className:"ml-auto flex items-center gap-1.5",children:[(0,r.jsx)("button",{className:"inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":s("lightbox.zoomOut"),onClick:()=>g(1/1.4),children:(0,r.jsx)(nF.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.jsxs)("button",{className:"rounded-lg border border-white/25 bg-white/10 px-2 py-1 text-[11.5px] font-semibold text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":s("lightbox.resetZoom"),onClick:w,children:[Math.round(100*o),"%"]}),(0,r.jsx)("button",{className:"inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":s("lightbox.zoomIn"),onClick:()=>g(1.4),children:(0,r.jsx)(tC.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.jsx)("button",{className:"ml-1 inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":s("common.close"),onClick:i,children:(0,r.jsx)(l.A,{className:"h-4 w-4","aria-hidden":!0})})]})]}),(0,r.jsx)("div",{className:"min-h-0 flex-1 touch-none overflow-hidden",onClick:e=>e.stopPropagation(),onWheel:e=>{let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left-t.width/2,r=e.clientY-t.top-t.height/2;g(e.deltaY<0?1.18:1/1.18,n,r)},onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),h.current={x:e.clientX,y:e.clientY,tx:d,ty:p},x(!0)},onPointerMove:e=>{h.current&&(u(h.current.tx+(e.clientX-h.current.x)),f(h.current.ty+(e.clientY-h.current.y)))},onPointerUp:()=>{h.current=null,x(!1)},onPointerCancel:()=>{h.current=null,x(!1)},onDoubleClick:()=>1===o?g(2):w(),children:(0,r.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,r.jsx)("img",{src:e,alt:t,draggable:!1,className:`max-h-full max-w-full select-none ${m?"":"transition-transform duration-75"} ${o>1?"cursor-grab active:cursor-grabbing":"cursor-zoom-in"}`,style:{transform:`translate(${d}px, ${p}px) scale(${o})`}})})})]}),document.body)}function nB({name:e,path:t}){let{t:n}=b(),[i,s]=(0,a.useState)("thumb"),[l,o]=(0,a.useState)(null),[c,d]=(0,a.useState)(!1),[u,p]=(0,a.useState)(!1),[f,m]=(0,a.useState)("");(0,a.useEffect)(()=>{if(!c)return;let e=window.setTimeout(()=>d(!1),5e3);return()=>window.clearTimeout(e)},[c]);let x=`/api/inbox?name=${encodeURIComponent(e)}`,h=async()=>{p(!0),m("");try{let e=await fetch(x,{method:"DELETE"}),t=await e.json();if(!e.ok||!t.ok)return void m(t.error??n("common.failedDelete"));o("deleted")}catch{m(n("common.serverUnavailable"))}finally{p(!1),d(!1)}};return l?(0,r.jsx)("div",{className:"my-2 flex justify-end",children:(0,r.jsxs)("span",{className:"inline-flex max-w-[75%] items-center gap-1.5 rounded-full border border-line bg-chip px-2.5 py-1 text-[11.5px] font-semibold text-dim",title:t,children:[(0,r.jsx)(tj,{name:"image",className:"h-3.5 w-3.5"}),(0,r.jsx)("span",{className:"truncate",children:e}),(0,r.jsxs)("span",{className:"shrink-0",children:["\xb7 ","deleted"===l?n("inbox.deleted"):n("inbox.fileGone")]})]})}):"chip"===i?(0,r.jsx)("div",{className:"my-2 flex justify-end",children:(0,r.jsxs)("button",{type:"button",onClick:()=>s("thumb"),className:"inline-flex max-w-[75%] items-center gap-2 rounded-[14px] border border-line bg-panel px-3.5 py-2 text-[13px] shadow-card",title:t,children:[(0,r.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,r.jsx)(tj,{name:"image",className:"h-4 w-4"})}),(0,r.jsx)("span",{className:"truncate font-mono text-[12px]",children:e}),(0,r.jsx)("span",{className:"shrink-0 text-[12px] font-semibold text-accent",children:n("common.show")})]})}):(0,r.jsxs)("div",{className:"my-2 flex justify-end",children:[(0,r.jsxs)("div",{className:"max-w-[75%]",children:[(0,r.jsx)("img",{src:x,alt:n("inbox.attachedAlt",{name:e}),onClick:()=>s("full"),onError:()=>o("missing"),className:"ml-auto block max-h-[240px] cursor-zoom-in rounded-[14px] border border-line"}),(0,r.jsxs)("div",{className:"mt-1 flex flex-wrap items-center justify-end gap-1.5 text-[11px]",children:[(0,r.jsx)("span",{className:"min-w-0 truncate font-mono text-dim",title:t,children:e}),(0,r.jsx)("button",{type:"button",onClick:()=>s("chip"),className:"shrink-0 text-dim hover:text-ink",children:n("common.collapse")}),c?(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5",children:[(0,r.jsx)("span",{className:"px-1 font-semibold text-err",children:n("inbox.confirmDelete")}),(0,r.jsx)("button",{type:"button",className:"rounded-lg bg-err px-2 py-0.5 font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:u,onClick:h,children:u?n("trash.deleting"):n("trash.confirmYes")}),(0,r.jsx)("button",{type:"button",className:"rounded-lg border border-line bg-panel px-2 py-0.5 font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>d(!1),children:n("common.cancel")})]}):(0,r.jsxs)("button",{type:"button",onClick:()=>d(!0),"aria-label":n("inbox.deleteAria",{name:e}),className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-line bg-panel px-2 py-0.5 font-semibold text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,r.jsx)(tf.A,{className:"h-3 w-3","aria-hidden":!0})," ",n("inbox.deleteFromDisk")]}),f?(0,r.jsx)("span",{className:"shrink-0 font-semibold text-err",children:f}):null]})]}),"full"===i?(0,r.jsx)(nU,{src:x,alt:n("inbox.attachedAlt",{name:e}),caption:t,onClose:()=>s("thumb")}):null]})}let nH=/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)\s]+\)|https?:\/\/[^\s<>"')\]]+)/g;function nW({text:e}){let[t,n]=(0,a.useState)(!1),i=(0,a.useRef)(null);return(0,a.useEffect)(()=>()=>{null!==i.current&&window.clearTimeout(i.current)},[]),(0,r.jsx)("span",{title:t?nC("common.copied"):nC("common.clickToCopy"),onClick:t=>{t.preventDefault(),t.stopPropagation(),nO(e).then(e=>{e&&(n(!0),null!==i.current&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>n(!1),1400))})},className:`cursor-copy rounded-md px-1.5 py-0.5 font-mono ${t?"bg-ok/15 text-ok":"bg-chip"}`,children:e})}function nK({code:e}){return(0,r.jsxs)("div",{className:"group/code relative my-1.5 max-w-full",children:[(0,r.jsx)("pre",{className:"max-w-full overflow-x-auto rounded-[10px] border border-line bg-bg px-3 py-2 font-mono text-[11.5px]",children:e}),(0,r.jsx)(nq,{text:e,label:nC("feed.copyCode"),className:"absolute right-1.5 top-1.5 opacity-0 transition-opacity focus-visible:opacity-100 group-hover/code:opacity-100 [@media(hover:none)]:opacity-60"})]})}function nY({href:e,label:t}){let n=/^https?:\/\//.test(e);return(0,r.jsx)("a",{href:e,target:n?"_blank":void 0,rel:n?"noreferrer":void 0,title:e,className:"break-all text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent",children:t})}function nJ(e){return e.split(nH).map((e,t)=>{if(!e)return null;if(e.startsWith("`")&&e.endsWith("`"))return(0,r.jsx)(nW,{text:e.slice(1,-1)},t);if(e.startsWith("**")&&e.endsWith("**"))return(0,r.jsx)("b",{children:e.slice(2,-2)},t);let n=e.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);if(n){let e,i;return(0,r.jsx)(nY,{href:(i=(e=n[2].replace(/\\([()])/g,"$1")).replace(/^file:\/\//,""),/^(?:\/|~\/)/.test(i)?`#f=${encodeURIComponent(i.replace(/:\d+$/,""))}`:e),label:n[1]},t)}if(/^https?:\/\//.test(e)){let n=e.replace(/[.,;:!?…»)]+$/,""),i=e.slice(n.length),s=n.length>72?n.slice(0,69)+"…":n;return(0,r.jsxs)("span",{children:[(0,r.jsx)(nY,{href:n,label:s}),i]},t)}return e})}let nQ=/^\s*\|.*\|\s*$/,nX=/^:?-{1,}:?$/;function nG({rows:e}){let t=e.map(e=>e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(e=>e.trim())),n=t.length>1&&t[1].every(e=>nX.test(e)),i=n?t[0]:null,s=n?t.slice(2):t;return(0,r.jsx)("div",{className:"my-1.5 max-w-full overflow-x-auto",children:(0,r.jsxs)("table",{className:"border-collapse text-[12.5px]",children:[i?(0,r.jsx)("thead",{children:(0,r.jsx)("tr",{children:i.map((e,t)=>(0,r.jsx)("th",{className:"border border-line bg-chip px-2.5 py-1 text-left font-semibold",children:nJ(e)},t))})}):null,(0,r.jsx)("tbody",{children:s.map((e,t)=>(0,r.jsx)("tr",{children:e.map((e,t)=>(0,r.jsx)("td",{className:"border border-line px-2.5 py-1 align-top",children:nJ(e)},t))},t))})]})})}function nV(e){let t=e.split("\n"),n=[],i=0;for(;i<t.length;){if(/^\s*```/.test(t[i])){let e=i;for(i++;i<t.length&&!/^\s*```\s*$/.test(t[i]);)i++;let s=t.slice(e+1,i).join("\n");i<t.length&&i++,"\n"===n[n.length-1]&&n.pop(),n.push((0,r.jsx)(nK,{code:s},`c${e}`));continue}if(nQ.test(t[i])){let e=i;for(;i<t.length&&nQ.test(t[i]);)i++;"\n"===n[n.length-1]&&n.pop(),n.push((0,r.jsx)(nG,{rows:t.slice(e,i)},`t${e}`));continue}let e=t[i],s=e.match(/^#{1,6}\s+(.*)$/),l=e.match(/^>\s?(.*)$/);s?n.push((0,r.jsx)("span",{className:"text-[14px] font-bold",children:nJ(s[1])},i)):l?n.push((0,r.jsx)("span",{className:"border-l-2 border-line pl-2 text-dim",children:nJ(l[1])},i)):n.push((0,r.jsx)(a.Fragment,{children:nJ(e)},i)),++i<t.length&&n.push("\n")}return n}function nZ({bytes:e,text:t}){let[n,i]=(0,a.useState)(!1),s=Math.round(e/1024);return n?(0,r.jsxs)("div",{className:"my-2 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel shadow-card",children:[(0,r.jsx)("pre",{className:"max-h-[340px] overflow-auto whitespace-pre-wrap break-all bg-[#fafafc] px-3.5 py-2.5 font-mono text-[11.5px]",children:t}),(0,r.jsx)("button",{type:"button",onClick:()=>i(!1),className:"block w-full border-t border-line px-3.5 py-1.5 text-[12px] text-dim",children:nC("common.collapse")})]}):(0,r.jsxs)("button",{type:"button",onClick:()=>i(!0),className:"my-2 ml-9 flex items-center gap-2 rounded-[14px] border border-line bg-panel px-3.5 py-2 text-[13px] shadow-card",children:[(0,r.jsx)("span",{className:"flex h-6.5 w-6.5 items-center justify-center rounded-lg bg-chip",children:(0,r.jsx)(tj,{name:"blob",className:"h-4 w-4"})}),(0,r.jsx)("span",{className:"font-semibold",children:nC("render.dataKb",{n:s})}),(0,r.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:nC("common.show")})]})}let n0=/(?:\/\.codex\/sessions\/|\/\.claude\/projects\/|\/\.claude\/plugins\/data\/codex-openai-codex\/state\/|^\/tmp\/claude-\d+\/)/;function n1({status:e,className:t}){let n=t??"h-3.5 w-3.5";return"ok"===e?(0,r.jsx)(e9.A,{className:n,"aria-hidden":!0}):"err"===e?(0,r.jsx)(l.A,{className:n,"aria-hidden":!0}):(0,r.jsx)(tk.A,{className:`${n} animate-spin`,"aria-hidden":!0})}function n5({file:e,line:t}){let n=t?`${e}:${t}`:e,i="inline-block min-w-0 max-w-full truncate rounded-md bg-chip px-1.5 py-0.5 align-bottom font-mono text-[11.5px]";return n0.test(e)?(0,r.jsx)("a",{href:`#f=${encodeURIComponent(e)}`,className:`${i} text-accent underline decoration-dotted`,title:n,children:n}):(0,r.jsx)("code",{className:i,title:n,children:n})}function n2({item:e}){let t=Object.entries(e.byTool).map(([e,t])=>`${e} \xd7${t}`).join(" \xb7 "),n=G(e.t0),i=G(e.t1),s=n&&i&&n!==i?`${n}–${i}`:n||i;return(0,r.jsxs)("details",{className:`my-2.5 ml-9 overflow-hidden rounded-[14px] border shadow-card ${e.hasErr?"border-err/35 bg-[#fff4f4]":"border-line bg-panel"}`,open:e.hasErr,children:[(0,r.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 px-3.5 py-2",children:[(0,r.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,r.jsx)(tj,{name:"cmd-group",className:"h-4 w-4"})}),(0,r.jsxs)("span",{className:"flex min-w-0 flex-1 items-center gap-1 truncate text-[12.5px]",children:[nC("render.commands",{count:e.calls.length}),t?" \xb7 "+t:""," \xb7",(0,r.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-ok",children:[(0,r.jsx)(e9.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.okCount]}),e.errCount?(0,r.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-err",children:[(0,r.jsx)(l.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.errCount]}):null]}),s?(0,r.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:s}):null]}),(0,r.jsx)("div",{className:"space-y-1 border-t border-line bg-[#fafafc] px-2 py-1.5",children:e.calls.map((t,n)=>{let i="ok"===t.status?"text-ok":"err"===t.status?"text-err":"text-dim";return(0,r.jsxs)("details",{className:"overflow-hidden rounded-[10px] border border-line bg-panel",open:t.open,children:[(0,r.jsxs)("summary",{className:"flex h-6 cursor-pointer list-none items-center gap-2 px-2.5 text-[11.5px]",children:[(0,r.jsx)("span",{className:"flex h-4.5 w-4.5 shrink-0 items-center justify-center rounded-md bg-chip",children:(0,r.jsx)(tj,{name:t.icon,className:"h-3 w-3"})}),(0,r.jsx)("code",{className:"min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap rounded-md bg-chip px-1.5 py-0.5 font-mono text-[11px]",children:t.display}),(0,r.jsxs)("span",{className:`ml-auto inline-flex shrink-0 items-center gap-1 text-[10.5px] font-semibold ${i}`,children:[(0,r.jsx)(n1,{status:t.status,className:"h-3 w-3"}),t.label]})]}),(0,r.jsx)("pre",{className:"max-h-[280px] overflow-auto whitespace-pre-wrap border-t border-line bg-[#fafafc] px-3 py-2 font-mono text-[11.5px]",children:"$ "+t.cmd+(t.output?"\n"+t.output:"")})]},`${e.ids[n]}:${n}`)})})]})}function n3({item:e}){let t=[e.trigger?nC("auto"===e.trigger?"render.compactAuto":"render.compactManual"):"",e.preTokens?nC("render.compactPre",{n:Math.round(e.preTokens/1e3)}):"",G(e.ts)||""].filter(Boolean).join(" \xb7 ");return(0,r.jsxs)("div",{className:"my-3.5",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,r.jsx)("span",{className:"h-px flex-1 bg-[#0d9488]/30","aria-hidden":!0}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-[#0d9488]/30 bg-[#e7f6f4] px-2.5 py-1 text-[11px] font-bold text-[#0b7c72]",children:[(0,r.jsx)(tj,{name:"compact",className:"h-3.5 w-3.5"}),nC("render.compacted"),t?(0,r.jsx)("span",{className:"font-semibold opacity-75",children:t}):null]}),(0,r.jsx)("span",{className:"h-px flex-1 bg-[#0d9488]/30","aria-hidden":!0})]}),e.summary?(0,r.jsxs)("details",{className:"group/cmp mt-1.5 text-center",children:[(0,r.jsxs)("summary",{className:"cursor-pointer list-none text-[11px] font-semibold text-[#0b7c72] [&::-webkit-details-marker]:hidden",children:[(0,r.jsxs)("span",{className:"group-open/cmp:hidden",children:[nC("render.compactSummary")," \xb7 ",nC("common.show")]}),(0,r.jsx)("span",{className:"hidden group-open/cmp:inline",children:nC("common.collapse")})]}),(0,r.jsx)("pre",{className:"mt-1 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[10px] border border-line bg-bg px-3 py-2 text-left font-mono text-[11px] text-[#555]",children:e.summary})]}):null]})}function n4({media:e,data:t,w:n,h:i,bytes:s}){let[l,o]=(0,a.useState)("thumb"),c=Math.round((s??3*t.length/4)/1024),d=n&&i?`${n}\xd7${i}`:nC("render.image");if("chip"===l)return(0,r.jsxs)("button",{type:"button",onClick:()=>o("thumb"),className:"my-2 ml-9 flex items-center gap-2 rounded-[14px] border border-line bg-panel px-3.5 py-2 text-[13px] shadow-card",children:[(0,r.jsx)("span",{className:"flex h-6.5 w-6.5 items-center justify-center rounded-lg bg-chip",children:(0,r.jsx)(tj,{name:"image",className:"h-4 w-4"})}),(0,r.jsx)("span",{className:"font-semibold",children:d}),(0,r.jsxs)("span",{className:"text-dim",children:["\xb7 ",c," ",nC("common.kb")]}),(0,r.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:nC("common.show")})]});let u=`data:${e};base64,${t}`;return(0,r.jsxs)("div",{className:"my-2 ml-9",children:[(0,r.jsx)("img",{src:u,alt:`${nC("render.image")} ${d}`,onClick:()=>o("full"),className:"max-h-[240px] cursor-zoom-in rounded-[14px] border border-line"}),(0,r.jsx)("button",{type:"button",onClick:()=>o("chip"),className:"mt-1 block text-[12px] text-dim",children:nC("common.collapse")}),"full"===l?(0,r.jsx)(nU,{src:u,alt:`${nC("render.image")} ${d}`,caption:`${d} \xb7 ${c} ${nC("common.kb")}`,onClose:()=>o("thumb")}):null]})}function n6({item:e}){let t=e.entries.slice(0,8),n=e.rolloutIds.slice(0,6);return(0,r.jsxs)("details",{className:"group my-2 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel text-[12px] shadow-card",children:[(0,r.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-3.5 py-2",children:[(0,r.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,r.jsx)(tj,{name:"citation",className:"h-4 w-4"})}),(0,r.jsx)("span",{className:"text-[13px] font-semibold",children:nC("render.memoryCitations",{count:e.entries.length})}),(0,r.jsx)("span",{className:"ml-auto text-[11px] font-semibold text-accent group-open:hidden",children:nC("common.show")}),(0,r.jsx)("span",{className:"ml-auto hidden text-[11px] font-semibold text-accent group-open:inline",children:nC("common.collapse")})]}),(0,r.jsxs)("div",{className:"border-t border-line px-3.5 py-2.5",children:[t.length?(0,r.jsx)("div",{className:"space-y-1.5",children:t.map((e,t)=>(0,r.jsxs)("div",{className:"min-w-0 rounded-[9px] bg-[#fbfbfd] px-2.5 py-1.5",children:[(0,r.jsx)(n5,{file:e.target,line:e.line?Number(e.line.split("-",1)[0]):void 0}),e.note?(0,r.jsx)("div",{className:"mt-1 whitespace-pre-wrap break-words text-[12px] text-[#555]",children:e.note}):null]},t))}):(0,r.jsx)("div",{className:"text-[12px] text-dim",children:nC("render.noCitations")}),e.entries.length>t.length?(0,r.jsx)("div",{className:"mt-1.5 text-[12px] text-dim",children:nC("render.moreEntries",{count:e.entries.length-t.length})}):null,n.length?(0,r.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[(0,r.jsx)("span",{className:"text-[11px] text-dim",children:"rollout:"}),n.map(e=>(0,r.jsx)("code",{className:"rounded-full bg-chip px-2 py-0.5 font-mono text-[10.5px] text-dim",title:e,children:e.slice(0,8)},e)),e.rolloutIds.length>n.length?(0,r.jsxs)("span",{className:"text-[11px] text-dim",children:["+",e.rolloutIds.length-n.length]}):null]}):null,(0,r.jsxs)("details",{className:"mt-2 rounded-[10px] border border-line bg-[#fafafc] text-[12px]",children:[(0,r.jsxs)("summary",{className:"cursor-pointer list-none px-3 py-1.5 font-semibold text-dim",children:["raw citation block",e.truncated?" \xb7 "+nC("render.truncated"):""]}),(0,r.jsx)("pre",{className:"max-h-[260px] overflow-auto whitespace-pre-wrap border-t border-line px-3 py-2 font-mono text-[11.5px] text-[#555]",children:e.raw})]})]})]})}let n8={shutdown_request:{icon:"shutdown",labelKey:"render.shutdownRequest",tone:"amber"},shutdown_response:{icon:"shutdown",labelKey:"render.shutdownResponse",tone:"amber"},plan_approval_request:{icon:"plan",labelKey:"render.planRequest",tone:"accent"},plan_approval_response:{icon:"plan",labelKey:"render.planVerdict",tone:"accent"}};function n9(e){return"string"==typeof e&&e.length?e:void 0}function n7({approve:e}){return(0,r.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10.5px] font-extrabold ${e?"border-ok/25 bg-[#eefaf1] text-ok":"border-err/25 bg-[#fff0f0] text-err"}`,children:e?nC("render.approved"):nC("render.rejected")})}function re({payload:e}){let t=n9(e.from),n=n9(e.requestId),i=G(e.timestamp);return t||n||i?(0,r.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[11px] text-dim",children:[t?(0,r.jsx)("span",{children:nC("render.from",{from:t})}):null,n?(0,r.jsx)("span",{className:"truncate font-mono",title:n,children:n.length>40?n.slice(0,40)+"…":n}):null,i?(0,r.jsx)("span",{children:i}):null]}):null}function rt({payload:e}){let t=n9(e.type),n=t?n8[t]:void 0;if(!n)return(0,r.jsxs)("div",{className:"text-[13px]",children:[(0,r.jsx)("div",{className:"text-dim",children:nC("render.structured")}),(0,r.jsxs)("details",{className:"mt-1 text-[12px]",children:[(0,r.jsx)("summary",{className:"cursor-pointer list-none font-semibold text-accent",children:nC("render.showJson")}),(0,r.jsx)("pre",{className:"mt-1 max-h-[280px] overflow-auto whitespace-pre-wrap rounded-md bg-chip px-2.5 py-2 font-mono text-[11.5px]",children:JSON.stringify(e,null,2)})]})]});let i="boolean"==typeof e.approve?e.approve:void 0,s=n9(e.reason)??n9(e.feedback);return(0,r.jsxs)("div",{className:"text-[13px]",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxs)("span",{className:`inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-[11.5px] font-bold ${"amber"===n.tone?"border-[#d89b21]/35 bg-[#fff9ea] text-[#9a6500]":"border-accent/25 bg-accent/10 text-accent"}`,children:[(0,r.jsx)(tj,{name:n.icon,className:"h-3.5 w-3.5"}),nC(n.labelKey)]}),void 0!==i?(0,r.jsx)(n7,{approve:i}):null]}),s?(0,r.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words",children:nV(s)}):null,(0,r.jsx)(re,{payload:e})]})}function rn({verdict:e}){let t="REQUEST_CHANGES"===e?e6.A:"APPROVE"===e?tt.A:ta.A;return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)(t,{className:"h-3.5 w-3.5","aria-hidden":!0}),"REQUEST_CHANGES"===e?"REQUEST_CHANGES":"APPROVE"===e?"APPROVE":"COMMENT"]})}function rr({item:e}){var t;let n=e.findings.length,i=e.findings.slice(0,12);return(0,r.jsxs)("div",{className:"my-3.5 ml-9 overflow-hidden rounded-[14px] border border-codex/20 bg-panel shadow-card",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-line px-3.5 py-2.5",children:[(0,r.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-codex-soft text-codex",children:(0,r.jsx)(tn.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.jsx)("span",{className:"text-[13.5px] font-bold",children:"Codex review"}),e.verdict?(0,r.jsx)("span",{className:`rounded-full border px-2.5 py-0.5 text-[11.5px] font-extrabold ${"REQUEST_CHANGES"===(t=e.verdict)?"bg-[#fff0f0] text-err border-err/25":"APPROVE"===t?"bg-[#eefaf1] text-ok border-ok/25":"bg-chip text-[#555] border-line"}`,children:(0,r.jsx)(rn,{verdict:e.verdict})}):null,(0,r.jsx)("span",{className:"text-[11px] text-dim",children:n?`${n} finding${1===n?"":"s"}`:nC("render.noFindings")}),G(e.ts)?(0,r.jsx)("span",{className:"ml-auto text-[11px] text-dim",children:G(e.ts)}):null]}),(0,r.jsxs)("div",{className:"px-3.5 py-2.5",children:[e.summary.length?(0,r.jsx)("div",{className:"mb-2 whitespace-pre-wrap break-words text-[13px] text-[#444]",children:nV(e.summary.join("\n"))}):null,i.length?(0,r.jsx)("div",{className:"space-y-2",children:i.map((e,t)=>{var n;return(0,r.jsxs)("div",{className:"rounded-[10px] border border-line bg-[#fbfbfd] px-3 py-2",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10.5px] font-extrabold ${"Critical"===(n=e.severity)||"High"===n||"P0"===n||"P1"===n?"border-err/30 bg-[#fff4f4] text-err":"Medium"===n||"P2"===n?"border-[#d89b21]/35 bg-[#fff9ea] text-[#9a6500]":"Low"===n||"P3"===n?"border-line bg-chip text-[#555]":"border-line bg-panel text-dim"}`,children:e.severity}),e.file?(0,r.jsx)(n5,{file:e.file,line:e.line}):null]}),(0,r.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words text-[13px]",children:nJ(e.title)}),e.body&&e.body!==e.title?(0,r.jsxs)("details",{className:"mt-1 text-[12px] text-dim",children:[(0,r.jsx)("summary",{className:"cursor-pointer list-none font-semibold text-accent",children:"details"}),(0,r.jsx)("div",{className:"mt-1 whitespace-pre-wrap break-words",children:nV(e.body)})]}):null]},t)})}):null,e.findings.length>i.length?(0,r.jsx)("div",{className:"mt-2 text-[12px] text-dim",children:nC("render.moreFindings",{count:e.findings.length-i.length})}):null,(0,r.jsxs)("details",{className:"mt-2 rounded-[10px] border border-line bg-[#fafafc] text-[12px]",children:[(0,r.jsx)("summary",{className:"cursor-pointer list-none px-3 py-1.5 font-semibold text-dim",children:"raw review text"}),(0,r.jsx)("pre",{className:"max-h-[320px] overflow-auto whitespace-pre-wrap border-t border-line px-3 py-2 font-mono text-[11.5px] text-[#555]",children:e.raw})]})]})]})}function ri({label:e,text:t}){let n=t.length>=2048?`${(t.length/1024).toFixed(1)} ${nC("common.kb")}`:nC("common.chars",{n:t.length});return(0,r.jsxs)("details",{className:"group my-1.5 ml-9",children:[(0,r.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-[11px] font-semibold text-dim hover:text-ink [&::-webkit-details-marker]:hidden",children:[(0,r.jsx)("span",{className:"flex h-4.5 w-4.5 items-center justify-center rounded-md bg-chip",children:(0,r.jsx)(tj,{name:"cmd-group",className:"h-3 w-3"})}),(0,r.jsx)("span",{className:"rounded-full bg-chip px-1.5 py-0.5 font-mono text-[9.5px]",children:e}),(0,r.jsxs)("span",{children:[nC("render.system")," \xb7 ",n]}),(0,r.jsx)("span",{className:"text-accent group-open:hidden",children:nC("common.show")}),(0,r.jsx)("span",{className:"hidden text-dim group-open:inline",children:nC("common.collapse")})]}),(0,r.jsx)("pre",{className:"mt-1 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[10px] border border-line bg-bg px-3 py-2 font-mono text-[11px] text-[#555]",children:t})]})}let rs=(0,a.memo)(function({item:e}){if("image"===e.kind)return(0,r.jsx)(n4,{media:e.media,data:e.data,w:e.w,h:e.h,bytes:e.bytes});if("inbox-image"===e.kind)return(0,r.jsx)(nB,{name:e.name,path:e.path});if("blob"===e.kind)return(0,r.jsx)(nZ,{bytes:e.bytes,text:e.text});if("sysmsg"===e.kind)return(0,r.jsx)(ri,{label:e.label,text:e.text});if("compact"===e.kind)return(0,r.jsx)(n3,{item:e});if("review"===e.kind)return(0,r.jsx)(rr,{item:e});if("mem-citation"===e.kind)return(0,r.jsx)(n6,{item:e});if("prose"===e.kind){let t="codex"===e.engine?"bg-codex":"bg-claude",n="codex"===e.engine?tn.A:td.A;return(0,r.jsxs)("div",{className:"group/msg my-3.5 flex gap-2.5",children:[(0,r.jsx)("div",{className:`mt-1 flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-full text-white ${t}`,children:(0,r.jsx)(n,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,r.jsxs)("div",{className:"relative min-w-0 flex-1 whitespace-pre-wrap break-words",children:[G(e.ts)?(0,r.jsx)("div",{className:"mb-0.5 text-[11px] text-dim",children:G(e.ts)}):null,(0,r.jsx)(nq,{text:e.text,label:nC("feed.copyMd"),className:"absolute right-0 top-0 opacity-0 transition-opacity focus-visible:opacity-100 group-hover/msg:opacity-100 [@media(hover:none)]:opacity-60"}),nV(e.text)]})]})}if("user"===e.kind){let t=e.text.length>500;return(0,r.jsxs)("div",{className:"group/msg my-3.5 flex items-start justify-end gap-1.5",children:[(0,r.jsx)(nq,{text:e.text,label:nC("feed.copyMd"),className:"mt-2 opacity-0 transition-opacity focus-visible:opacity-100 group-hover/msg:opacity-100 [@media(hover:none)]:opacity-60"}),(0,r.jsx)("div",{className:"max-w-[75%] whitespace-pre-wrap break-words rounded-2xl bg-user px-4 py-2.5",children:t?(0,r.jsxs)("details",{className:"group/usr",children:[(0,r.jsxs)("summary",{className:"cursor-pointer list-none [&::-webkit-details-marker]:hidden",children:[(0,r.jsxs)("span",{className:"group-open/usr:hidden",children:[e.text.slice(0,180),"… ",(0,r.jsxs)("span",{className:"font-semibold text-accent",children:["(",nC("common.chars",{n:e.text.length}),")"]})]}),(0,r.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-dim group-open/usr:inline-flex",children:[nC("common.collapse")," ",(0,r.jsx)(te.A,{className:"h-3 w-3","aria-hidden":!0})]})]}),nV(e.text)]}):nV(e.text)})]})}if("cmd"===e.kind){let t="ok"===e.call.status?"text-ok":"err"===e.call.status?"text-err":"text-dim";return(0,r.jsxs)("details",{className:"my-2.5 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel shadow-card",open:e.call.open,children:[(0,r.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 px-3.5 py-2",children:[(0,r.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,r.jsx)(tj,{name:e.call.icon,className:"h-4 w-4"})}),(0,r.jsx)("code",{className:"max-w-[70%] overflow-hidden text-ellipsis whitespace-nowrap rounded-md bg-chip px-2 py-0.5 font-mono text-[12.5px]",children:e.call.display}),(0,r.jsxs)("span",{className:`ml-auto inline-flex shrink-0 items-center gap-1 text-xs font-semibold ${t}`,children:[(0,r.jsx)(n1,{status:e.call.status}),e.call.label]})]}),(0,r.jsx)("pre",{className:"max-h-[340px] overflow-auto whitespace-pre-wrap border-t border-line bg-[#fafafc] px-3.5 py-2.5 font-mono text-[12.5px]",children:"$ "+e.call.cmd+(e.call.output?"\n"+e.call.output:"\n"+nC("render.noOutputInLog"))})]})}if("cmd-group"===e.kind)return(0,r.jsx)(n2,{item:e});if("edit"===e.kind)return(0,r.jsxs)("div",{className:"my-2.5 ml-9 flex items-center gap-3 rounded-[14px] border border-line bg-panel px-3.5 py-2.5 shadow-card",children:[(0,r.jsx)("span",{className:"flex h-7.5 w-7.5 items-center justify-center rounded-lg bg-chip",children:(0,r.jsx)(tj,{name:"note",className:"h-4 w-4"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-[13.5px] font-semibold",children:e.files}),(0,r.jsx)("div",{className:"text-xs text-dim",children:nC("render.filesChanged")})]})]});if("tmsg"===e.kind){let t=function(e){let t=e.trim();if((t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1).trim()),!t.startsWith("{"))return null;try{let e=JSON.parse(t);if(null!==e&&"object"==typeof e&&!Array.isArray(e))return e}catch{}return null}(e.text),n=e.text.length>420||e.text.split("\n").length>6;return(0,r.jsxs)("div",{className:"my-2.5 ml-9 overflow-hidden rounded-[14px] border border-accent/25 bg-[#f8f8fd] shadow-card",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pt-2",children:[(0,r.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-[#ecebfb] text-accent",children:(0,r.jsx)(tl.A,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,r.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:"out"===e.dir?nC("render.toDir"):nC("render.fromDir")}),(0,r.jsx)("span",{className:"rounded-full bg-accent/10 px-2 py-0.5 text-[11px] font-bold text-accent",children:e.peer}),e.delivery?(0,r.jsxs)("span",{className:`inline-flex shrink-0 items-center gap-1 text-[10.5px] font-semibold ${"ok"===e.delivery?"text-ok":"text-err"}`,title:e.msgId?`msg_id: ${e.msgId}`:void 0,children:["ok"===e.delivery?(0,r.jsx)(e9.A,{className:"h-3 w-3","aria-hidden":!0}):(0,r.jsx)(l.A,{className:"h-3 w-3","aria-hidden":!0}),"ok"===e.delivery?nC("render.delivered"):nC("render.notDelivered")]}):null,G(e.ts)?(0,r.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:G(e.ts)}):null]}),(0,r.jsx)("div",{className:"px-3.5 pb-2.5 pt-1",children:t?(0,r.jsx)(rt,{payload:t}):(0,r.jsxs)(r.Fragment,{children:[e.summary?(0,r.jsx)("div",{className:"text-[13px] font-bold",children:nJ(e.summary)}):null,n?(0,r.jsxs)("details",{className:"group/tmsg mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:[(0,r.jsxs)("summary",{className:"cursor-pointer list-none text-[12.5px] text-[#555] [&::-webkit-details-marker]:hidden",children:[(0,r.jsxs)("span",{className:"group-open/tmsg:hidden",children:[e.text.slice(0,260).trimEnd(),"… ",(0,r.jsx)("span",{className:"font-semibold text-accent",children:nC("common.showAll")})]}),(0,r.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-dim group-open/tmsg:inline-flex",children:[nC("common.collapse")," ",(0,r.jsx)(te.A,{className:"h-3 w-3","aria-hidden":!0})]})]}),nV(e.text)]}):(0,r.jsx)("div",{className:"mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:nV(e.text)})]})})]})}if("tnote"===e.kind)return(0,r.jsxs)("div",{className:"my-1 ml-9 flex items-center gap-1.5 text-[11.5px] text-dim",children:[(0,r.jsx)(tl.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),e.text]});if("think"===e.kind){let t=e.text.length>150;return(0,r.jsxs)("details",{className:"my-1 ml-9 text-[11.5px] italic text-dim",children:[(0,r.jsxs)("summary",{className:`flex list-none items-center gap-1.5 truncate ${t?"cursor-pointer":""}`,title:nC("render.reasoning"),children:[(0,r.jsx)(e8.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,r.jsxs)("span",{className:"truncate",children:[e.text.slice(0,150),t?"…":""]})]}),t?(0,r.jsx)("div",{className:"whitespace-pre-wrap break-words pt-1 not-italic",children:nV(e.text)}):null]})}return"svc"===e.kind?(0,r.jsx)("div",{className:"my-1 break-words text-[11.5px] text-dim",children:e.text}):"note"===e.kind?(0,r.jsx)("div",{className:"my-2 break-words text-[12.5px] text-dim",children:nJ(e.text)}):(0,r.jsx)("div",{className:`my-0.5 break-words text-[12.5px] ${e.err?"text-err":"text-[#555]"}`,children:e.text})});var rl=n(9267),ra=n(9383);function ro({file:e}){let{t}=b(),n=e.pendingQuestion,[i,s]=(0,a.useState)("pending"),[o,c]=(0,a.useState)(""),[d,u]=(0,a.useState)({}),[p,f]=(0,a.useState)(""),[m,x]=(0,a.useState)(""),[h,g]=(0,a.useState)(!1),w=n?null!==n.paneTarget:null!==e.pid&&"running"===e.proc,v=(0,a.useMemo)(()=>n?.questions?n.questions.map((e,t)=>(d[t]??[]).map(t=>e.options[t]?.label??String(t+1)).join(", ")).filter(Boolean).join(" \xb7 "):"",[d,n]);if(!n){if(!e.waitingInput)return null;let n=e.waitingInput.menu,l="delivering"===i,a=async(r,i)=>{s("delivering"),c("");try{let l=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"dialog-key",path:e.path,key:r,...n?{question:n.question}:{},.../^[1-9]$/.test(r)?{label:i}:{}})}),a=await l.json();if(!l.ok||!a.ok){s("failed"),c(a.error??t("common.failedSend"));return}s("answered"),c(i)}catch{s("failed"),c(t("common.serverUnavailable"))}};return"answered"===i?(0,r.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-ok/25 bg-[#eefaf1] px-4 py-3 text-[13px] font-semibold text-ok",children:t("question.sentToPane",{text:o})}):(0,r.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,r.jsxs)("div",{className:"mb-2 inline-flex items-center gap-1.5 rounded-full bg-[#f5dfae] px-2 py-0.5 text-[11px] font-bold text-[#8a5a00]",children:[(0,r.jsx)(rl.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",t("question.waiting")]}),(0,r.jsxs)("div",{className:"text-[13px] font-semibold text-ink",children:[t("question.pane",{target:e.waitingInput.target})," \xb7 ",function(e,t){let n=Math.max(0,Math.floor(Date.now()/1e3-t));if(n<60)return e("question.sec",{n:n});let r=Math.floor(n/60);return r<60?e("question.min",{n:r}):e("question.hour",{n:Math.floor(r/60)})}(t,e.waitingInput.since)]}),n?(0,r.jsxs)(r.Fragment,{children:[n.tabs.length?(0,r.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:n.tabs.map((e,t)=>(0,r.jsxs)("span",{className:`rounded-full px-2 py-0.5 text-[11px] font-bold ${e.done?"bg-ok/15 text-ok":"bg-bg text-dim"}`,children:[e.done?"✓ ":"",e.label]},t))}):null,(0,r.jsx)("div",{className:"mt-2 text-[14px] font-bold text-ink",children:n.question}),(0,r.jsx)("div",{className:"mt-2 space-y-1.5",children:n.options.map(e=>(0,r.jsxs)("button",{className:`flex w-full items-start gap-2 rounded-[8px] border px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/35 disabled:opacity-60 ${e.recommended?"border-[#e0ae45]/45 bg-[#fff5dc]":"border-line bg-bg"}`,disabled:l||e.value>9,onClick:()=>void a(String(e.value),e.label),children:[(0,r.jsx)("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border border-line bg-panel text-[10px] font-bold",children:e.value}),(0,r.jsxs)("span",{className:"min-w-0",children:[(0,r.jsx)("span",{className:"block text-[13px] font-bold",children:e.label}),e.description?(0,r.jsx)("span",{className:"block text-[12px] text-dim",children:e.description}):null]})]},e.value))})]}):(0,r.jsx)("pre",{className:"mt-2 max-h-[240px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-line bg-bg px-3 py-2 text-[12px] text-dim",children:e.waitingInput.screenTail}),(0,r.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[["Tab","Enter","Escape"].map(e=>(0,r.jsx)("button",{className:"rounded-[8px] border border-line bg-bg px-2.5 py-1 text-[12px] font-semibold text-dim disabled:opacity-60",disabled:l,onClick:()=>void a(e,"Escape"===e?"Esc":e),children:"Escape"===e?"Esc":e},e)),(0,r.jsx)("span",{className:"text-[12px] text-dim",children:t("question.keysHint")})]}),"delivering"===i?(0,r.jsxs)("div",{className:"mt-2 inline-flex items-center gap-1.5 text-[12px] font-semibold text-dim",children:[(0,r.jsx)(tk.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",t("common.sending")]}):null,"failed"===i?(0,r.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-err",children:o}):null]})}let k=async(e,r)=>{s("delivering"),c("");try{let i=await fetch("/api/answer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({transcriptPath:n.transcriptPath,toolUseId:n.toolUseId,kind:n.kind,...e})}),l=await i.json();if(!i.ok||!l.ok){if(409===i.status&&(l.superseded||l.answer)){s("superseded"),c(l.answer??l.error??t("question.alreadyAnswered"));return}s("failed"),c(l.error??t("common.failedSend"));return}s("answered"),c(l.answer??r)}catch{s("failed"),c(t("common.serverUnavailable"))}},y=(e=d)=>n.questions?.map((t,n)=>e[n]??[])??[],j=n.questions?.length??0,N=j>1||(n.questions?.some(e=>e.multiSelect)??!1),S=n.questions?.every((e,t)=>(d[t]??[]).length>0)??!1,C=async()=>{g(!0),c("");try{let n=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"resume",path:e.path})}),r=await n.json();if(!n.ok||!r.ok)return void c(r.error??t("question.openFailed"));c(t("question.opened",{target:r.target??"tmux"}))}catch{c(t("common.serverUnavailable"))}finally{g(!1)}},A="delivering"===i||!w;return"answered"===i?(0,r.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-ok/25 bg-[#eefaf1] px-4 py-3 text-[13px] font-semibold text-ok",children:t("question.answered",{text:o||v})}):"superseded"===i?(0,r.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-line bg-chip px-4 py-3 text-[13px] font-semibold text-dim",children:t("question.answeredElsewhere",{text:o})}):n&&!w?(0,r.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,r.jsxs)("div",{className:"mb-2 inline-flex items-center gap-1.5 rounded-full bg-[#f5dfae] px-2 py-0.5 text-[11px] font-bold text-[#8a5a00]",children:[(0,r.jsx)(rl.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",t("question.waiting")]}),(0,r.jsx)("div",{className:"text-[13px] font-semibold text-err",children:t("question.noPane")}),"plan"===n.kind?(0,r.jsx)("pre",{className:"mt-2 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-line bg-bg px-3 py-2 text-[13px]",children:n.plan}):n.questions?.map((e,t)=>(0,r.jsxs)("div",{className:"mt-2",children:[(0,r.jsx)("div",{className:"text-[12px] font-bold text-dim",children:e.header}),(0,r.jsx)("div",{className:"text-[13px] font-semibold text-ink",children:e.question})]},t)),(0,r.jsx)("button",{className:"mt-3 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:h,onClick:C,children:t("question.openSession")}),o?(0,r.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-dim",children:o}):null]}):(0,r.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,r.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-[#f5dfae] px-2 py-0.5 text-[11px] font-bold text-[#8a5a00]",children:[(0,r.jsx)(rl.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",t("question.waiting")]}),w?null:(0,r.jsx)("span",{className:"text-[12px] font-semibold text-err",children:t("question.noPane")})]}),"plan"===n.kind?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("pre",{className:"max-h-[420px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-line bg-bg px-3 py-2 text-[13px]",children:n.plan}),(0,r.jsx)("textarea",{className:"mt-3 min-h-20 w-full resize-y rounded-[8px] border border-line bg-bg px-3 py-2 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/35",placeholder:t("question.rejectComment"),value:m,onChange:e=>x(e.target.value)}),(0,r.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,r.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-ok px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:A,onClick:()=>k({approve:!0},t("question.approved")),children:[(0,r.jsx)(e9.A,{className:"h-4 w-4","aria-hidden":!0})," ",t("question.approve")]}),(0,r.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-err px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:A,onClick:()=>k({approve:!1,text:m},t("question.rejected")),children:[(0,r.jsx)(l.A,{className:"h-4 w-4","aria-hidden":!0})," ",t("question.reject")]})]})]}):(0,r.jsxs)(r.Fragment,{children:[n.questions?.map((e,t)=>(0,r.jsxs)("section",{className:"mt-3 first:mt-0",children:[(0,r.jsx)("div",{className:"mb-1 inline-flex rounded-full bg-bg px-2 py-0.5 text-[11px] font-bold text-dim",children:e.header}),(0,r.jsx)("div",{className:"mb-2 text-[14px] font-bold text-ink",children:e.question}),(0,r.jsx)("div",{className:"space-y-1.5",children:e.options.map((n,i)=>{let s=(d[t]??[]).includes(i);return(0,r.jsxs)("button",{className:`flex w-full items-start gap-2 rounded-[8px] border px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/35 ${s?"border-accent/45 bg-accent/10":n.recommended?"border-[#e0ae45]/45 bg-[#fff5dc]":"border-line bg-bg"}`,disabled:A,onClick:()=>{var r;let s={...d,[t]:[i]};r=e.multiSelect,u(e=>{let n=e[t]??[],s=r?n.includes(i)?n.filter(e=>e!==i):[...n,i]:[i];return{...e,[t]:s}}),e.multiSelect||1!==j||k({answers:y(s)},n.label)},children:[(0,r.jsx)("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border border-line bg-panel text-[10px] font-bold",children:s?"✓":i+1}),(0,r.jsxs)("span",{className:"min-w-0",children:[(0,r.jsx)("span",{className:"block text-[13px] font-bold",children:n.label}),n.description?(0,r.jsx)("span",{className:"block text-[12px] text-dim",children:n.description}):null]})]},i)})})]},t)),j<=1?(0,r.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,r.jsx)("input",{className:"min-w-0 flex-1 rounded-[8px] border border-line bg-bg px-3 py-1.5 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/35",placeholder:t("question.ownAnswer"),value:p,onChange:e=>f(e.target.value)}),(0,r.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:A||!p.trim(),onClick:()=>k({text:p},p),children:[(0,r.jsx)(ra.A,{className:"h-4 w-4","aria-hidden":!0})," ",t("common.send")]})]}):null,N?(0,r.jsxs)("button",{className:"mt-3 inline-flex items-center gap-1.5 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:A||!S,onClick:()=>k({answers:y()},v),children:[(0,r.jsx)(ra.A,{className:"h-4 w-4","aria-hidden":!0})," ",t("common.send")]}):null]}),"delivering"===i?(0,r.jsxs)("div",{className:"mt-3 inline-flex items-center gap-1.5 text-[12px] font-semibold text-dim",children:[(0,r.jsx)(tk.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",t("common.sending")]}):null,"failed"===i?(0,r.jsx)("div",{className:"mt-3 text-[12px] font-semibold text-err",children:o}):null]})}function rc({file:e}){let{t}=b();return"running"===e.proc?(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 whitespace-nowrap rounded-full bg-[#e5f6ea] px-2 py-0.5 text-[11px] font-bold tabular-nums text-ok",children:[(0,r.jsx)(tc.A,{className:"h-3 w-3","aria-hidden":!0})," PID ",e.pid]}):"killed"===e.proc||"stalled"===e.activity?(0,r.jsx)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#f7e8e8] px-2 py-0.5 text-[11px] font-bold text-err",children:t("task.interruptedBadge")}):"done"===e.proc?(0,r.jsx)("span",{className:"inline-flex items-center gap-1 rounded-full bg-chip px-2 py-0.5 text-[11px] font-bold text-dim",children:t("task.finishedBadge")}):null}function rd({file:e,compact:t=!1,hideChip:n=!1}){let{t:i}=b(),[s,l]=(0,a.useState)(!1),[o,c]=(0,a.useState)(!1),[d,u]=(0,a.useState)(""),[p,f]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(!s)return;let e=window.setTimeout(()=>l(!1),5e3);return()=>window.clearTimeout(e)},[s]);let m=(0,r.jsx)(rc,{file:e}),x=async()=>{c(!0),u("");try{let t=await fetch("/api/proc",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:e.path,force:p})}),n=await t.json();if(!t.ok||!n.ok){u(n.error??i("task.stopFailed")),f(!0);return}u(i("task.signalSent",{signal:p?"SIGKILL":"SIGTERM",pid:n.pid??""})),l(!1)}catch{u(i("common.serverUnavailable")),f(!0)}finally{c(!1)}};return(0,r.jsxs)("span",{className:`inline-flex min-w-0 flex-wrap items-center gap-1.5 ${t?"text-[10.5px]":"text-xs"}`,children:[n?null:m,"running"===e.proc?s?(0,r.jsxs)("span",{className:"inline-flex max-w-full items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5",children:[t?null:(0,r.jsx)("span",{className:"truncate px-1 text-[11px] font-semibold text-err",children:i("task.confirmKill",{pid:e.pid??""})}),(0,r.jsx)("button",{className:"whitespace-nowrap rounded-lg bg-err px-2 py-0.5 text-[11px] font-bold tabular-nums text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:o,onClick:x,children:p?"SIGKILL":t?i("task.killPid",{pid:e.pid??""}):i("task.confirmKillYes")}),(0,r.jsx)("button",{className:"whitespace-nowrap rounded-lg border border-line bg-panel px-2 py-0.5 text-[11px] font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>l(!1),children:t?i("common.no"):i("common.cancel")})]}):(0,r.jsx)("button",{className:"whitespace-nowrap rounded-full border border-line bg-panel px-2 py-0.5 text-[11px] font-semibold text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":i("task.stopAria",{pid:e.pid??""}),onClick:()=>l(!0),children:i("task.kill")}):null,d?(0,r.jsx)("span",{className:"max-w-[220px] truncate text-[11px] font-semibold text-dim",children:d}):null]})}function ru({file:e,files:t,onSelect:n}){let{t:i}=b();if("codex-jobs"===e.root){let s=t.find(t=>"codex-sessions"===t.root&&t.parent===e.path);return(0,r.jsxs)("div",{className:"mb-4 mt-1 rounded-[14px] border border-line bg-panel px-4 py-3 shadow-card",children:[(0,r.jsx)("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:(0,r.jsx)(rc,{file:e})}),s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mb-2 whitespace-pre-line text-[13.5px] font-semibold",children:i("task.jobLogHint")}),(0,r.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[10px] border border-line bg-bg px-3 py-1.5 text-[13px] font-semibold text-codex hover:bg-codex-soft",onClick:()=>n(s),children:[(0,r.jsx)(tn.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",i("task.openCodexSession",{size:(s.size/1024).toFixed(0),activity:"live"===s.activity?i("task.working"):"stalled"===s.activity?i("task.interrupted"):"recent"===s.activity?i("task.finished"):""})]})]}):(0,r.jsx)("div",{className:"text-[13.5px] text-dim",children:i("task.rolloutMissing")})]})}return"claude-tasks"!==e.root?null:(0,r.jsxs)("div",{className:"mb-4 mt-1 rounded-[14px] border border-line bg-panel px-4 py-3 shadow-card",children:[(0,r.jsx)("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:(0,r.jsx)(rc,{file:e})}),e.cmd?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mb-1 text-[13.5px] font-semibold",children:e.cmdDesc||i("task.backgroundCommand")}),(0,r.jsxs)("code",{className:"block whitespace-pre-wrap break-words rounded-lg border border-line bg-[#fafafc] px-2.5 py-2 font-mono text-[12.5px]",children:["$ ",e.cmd]})]}):(0,r.jsx)("div",{className:"text-[13.5px] text-dim",children:i("task.commandNotFound")})]})}let rp=window.matchMedia("(pointer: coarse)").matches?500:2500,rf=window.matchMedia("(pointer: coarse)").matches?1e3:6e3,rm={items:[],hiddenServiceCount:0},rx=new Map;function rh(e,t,n){rx.size>300&&!rx.has(e)&&rx.clear(),rx.set(e,{magnet:t,fromBottom:n})}function rb({icon:e,label:t}){return(0,r.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-[12px] font-semibold text-ok",children:[(0,r.jsxs)("span",{className:"flex items-center gap-0.5","aria-hidden":!0,children:[(0,r.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok"}),(0,r.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok [animation-delay:150ms]"}),(0,r.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok [animation-delay:300ms]"})]}),(0,r.jsx)(e,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function rg({file:e,files:t,onSelect:n,showSvc:i,lineFilter:s,onStatus:l,paused:o,follow:c,setFollow:d,compact:u=!1}){let{locale:p,t:m}=b(),[x,g]=(0,a.useState)(()=>e?rx.get(e.path)?.magnet??c:c),w=function(e,t=!1,n=2500){let r=(0,a.useRef)(n),[i,s]=(0,a.useState)({lines:[],start:0}),[l,o]=(0,a.useState)(0),[c,d]=(0,a.useState)(!1),[u,p]=(0,a.useState)(null),[m,x]=(0,a.useState)(null),[b,g]=(0,a.useState)(!1),[w,v]=(0,a.useState)(!1),[k,y]=(0,a.useState)(!1),[j,N]=(0,a.useState)(0),S=(0,a.useRef)(0),C=(0,a.useRef)(0),A=(0,a.useRef)(""),T=(0,a.useRef)(!0),E=(0,a.useRef)(0),$=(0,a.useRef)(!1);(0,a.useEffect)(()=>{r.current=n},[n]);let D=()=>{S.current=0,C.current=0,A.current="",T.current=!0,v(!1)},M=(0,a.useCallback)(()=>{s({lines:[],start:0}),D()},[]);(0,a.useEffect)(()=>{E.current+=1,D(),s({lines:[],start:0}),o(e?.size??0),p(null),d(!!e)},[e?.path]),(0,a.useEffect)(()=>{var n;if(!e||b||t)return;let i=!0,l=E.current,a=(n={path:e.path,getOffset:()=>S.current,onChunk:e=>{if(i&&l===E.current){if("transportError"in e){p(h(f(),"common.serverUnavailable")),d(!1);return}if("error"in e&&e.error){p(e.error),d(!1);return}if(S.current>e.size&&(D(),s({lines:[],start:0})),e.data){let t=A.current+e.data;if(A.current="",T.current){if(C.current=e.start,e.start>0){let n=t.indexOf("\n");C.current=e.start+(n>=0?nx(t.slice(0,n+1)):nx(t)),t=n>=0?t.slice(n+1):""}v(C.current>0)}let n=t.split("\n");A.current=n.pop()??"";let i=n.map(e=>e.trim()).filter(Boolean);0===S.current?s({lines:i,start:0}):i.length&&s(e=>{let t=e.lines.concat(i),n=r.current;return n>0&&t.length>n?{lines:t.slice(-n),start:e.start+(t.length-n)}:{lines:t,start:e.start}}),T.current=!1}S.current=e.offset,o(e.size),p(null),e.data&&x(new Date),d(!1)}}},t6.add(n),ni?(null===t8&&(t8=setInterval(()=>void nd(),1200)),nu()):nm(),()=>{(t6.delete(n),0===t6.size)?(no(),nc(),t9=na(t9,clearTimeout),t7=na(t7,clearTimeout),ni=!1,nt=!1,nn=!1,nr=!1):ni?nu():nm()});return()=>{i=!1,a()}},[e?.path,b,t]);let R=(0,a.useCallback)(async()=>{if(!e||$.current||C.current<=0)return 0;$.current=!0,y(!0);let t=E.current;try{let n="",r=C.current;for(let i=0;i<4;i+=1){let i=await fetch(`/api/log?path=${encodeURIComponent(e.path)}&before=${r}`),s=await i.json();if(t!==E.current||"error"in s&&s.error)return 0;if(n=s.data+n,r=s.start,0===r||n.slice(0,-1).includes("\n"))break}let i=r;if(r>0){let e=n.indexOf("\n");if(e<0||e===n.length-1)return 0;i=r+nx(n.slice(0,e+1)),n=n.slice(e+1)}let l=n.split("\n");""===l.at(-1)&&l.pop();let a=l.map(e=>e.trim()).filter(Boolean);return C.current=i,v(i>0),a.length&&(s(e=>({lines:a.concat(e.lines),start:e.start-a.length})),N(e=>e+1)),a.length}catch{return 0}finally{$.current=!1,y(!1)}},[e?.path]);return{lines:i.lines,linesStart:i.start,size:l,loading:c,error:u,tickTime:m,paused:b,setPaused:g,clear:M,hasMore:w,loadingOlder:k,loadOlder:R,prependGen:j}}(e,o,x?u?rp:rf:0),v=(0,a.useRef)(null),k=(0,a.useRef)(null),y=(0,a.useRef)(null),N=u?300:1500,S=u?500:1500,[C,A]=(0,a.useState)(N),[T,E]=(0,a.useState)(0),[$,D]=(0,a.useState)(!1),[M,R]=(0,a.useState)(null),P=(0,a.useRef)(!1),I=(0,a.useRef)(x),L=(0,a.useRef)(0),_=(0,a.useRef)(0),z=(0,a.useRef)(null),O=(0,a.useRef)(0),q=(0,a.useRef)(null),F=(t,n=!1)=>{I.current=t,g(t),d(t),t&&E(0),e&&rh(e.path,t,rx.get(e.path)?.fromBottom??0),n&&(D(!0),z.current&&window.clearTimeout(z.current),z.current=window.setTimeout(()=>D(!1),450))},U=()=>{let e=v.current;e&&(O.current=Date.now(),e.scrollTop=e.scrollHeight)};(0,a.useEffect)(()=>A(N),[e?.path,N]),(0,a.useEffect)(()=>{if(!e)return;let t=rx.get(e.path)?.magnet??!0;t!==I.current&&(I.current=t,g(t))},[e?.path]),(0,a.useEffect)(()=>{c!==I.current&&(I.current=c,g(c),c&&E(0))},[c]),(0,a.useEffect)(()=>()=>{z.current&&window.clearTimeout(z.current)},[]),(0,a.useEffect)(()=>{P.current=!1,queueMicrotask(()=>R(null))},[e?.path]),(0,a.useEffect)(()=>{if(e){if(e.pendingQuestion){P.current=!0,queueMicrotask(()=>R(null));return}P.current&&e.proc&&"running"!==e.proc&&(queueMicrotask(()=>R(h(p,"feed.agentEnded"))),P.current=!1)}},[e?.pendingQuestion?.toolUseId,e?.proc,e,p]);let B=s.toLowerCase(),H=(0,a.useMemo)(()=>e?function(e){let{showSvc:t,lineFilter:n}=e,r="claude"===e.fmt||"codex"===e.fmt,i=[],s=new Map,l=new Map,a=new Map,o=new Map,c=0,d=0,u=0,p=null,f=-1/0,m=null,x=null,h=null,b=null,g=null,w=new Map,v=null,k=null,y=e=>i.length?e-i[0].seq:-1,j=e=>(i.push({seq:d,src:u,item:e}),v=null,d++),N=e=>!!(!(e.length<=2e4)&&(e.match(/\s/g)?.length??0)/e.length<.02)&&(j({kind:"blob",bytes:e.length,text:ny(e).slice(0,2e5)}),!0),S=(e,t)=>{let n=nL(e.source),r=nI(n.data)||nI(t.base64);if(!r)return;let i=nI(n.media_type)||nI(t.type),s=i.startsWith("image/")?i:"image/png",l=nL(t.dimensions);j({kind:"image",media:s,data:r,w:nT(l.originalWidth),h:nT(l.originalHeight),bytes:nT(t.originalSize)})},C=(e,t,n,r=j)=>{nA.lastIndex=0;let i=nA.test(t);if(nA.lastIndex=0,!i){let n=nS(t.trim(),e);return!!n&&(r(n),!0)}let s=!1,l=0,a=t=>{let i=t.trim();if(!i)return;let l=nS(i,e);l?(r(l),s=!0):n(i)};for(let e of t.matchAll(nA)){let n=e[0],i=e.index??0;a(t.slice(l,i)),r(nz(n,e[1]??"",e[2]??"")),s=!0,l=i+n.length}return a(t.slice(l)),s},A=e=>{let t=[];return nA.lastIndex=0,{cleaned:e.replace(nA,(e,n,r)=>(t.push(nz(e,n,r)),"")).trim(),cites:t}},T=(t,n)=>{if(!n.trim()||n===m?.text||(m={text:n,src:u},N(n)))return;let r="codex"===e.engine?"codex":"claude";C(t,n,e=>j({kind:"prose",ts:t,text:e,engine:r}))||j({kind:"prose",ts:t,text:n,engine:r})},E=(e,t,n,r)=>{let i=n||"plain-"+d+"-"+String(e??""),l=function(e,t="shell"){let n=ny(e);return{cmd:n,display:function(e){let t,n=e.match(/^([A-Za-z][\w.]*): /),r=n?n[0]:"",i=r?e.slice(r.length):e;do t=i,i=(i=(i=(i=i.replace(/^export PATH=[^;]+;\s*/,"")).replace(/^cd\s+\S+\s*&&\s*/,"")).replace(/^\/usr\/bin\/zsh -lc\s+/,"")).replace(/^(["'])([\s\S]*)\1$/,(e,t,n)=>RegExp(`(?<!\\\\)${t}`).test(n)?e:n);while(i!==t);let s=i.match(/^([\w./-]+(?:\s+-)?)\s*<<\s*['"]?(\w+)['"]?/);return s&&(i=`${s[1].trim()} \xabheredoc\xbb`),(r+(i=i.replace(/\s+/g," ").trim())).slice(0,160)}(n),icon:t,output:"",status:"run",label:nC("render.executing"),open:!1}}(t,r),a=j({kind:"cmd",id:i,call:l,ts:e}),o={call:l,seq:a};return s.set(i,o),g=o,l},$=(e,t,n)=>{if(!e)return null;let r=t.match(/exited with code (\d+)/)?.[1],s=t.replace(/^Chunk ID:[^\n]*\n/,"").replace(/Wall time:[^\n]*\n/,"").replace(/Original token count:[^\n]*\n?/,"").trim(),l=!0===n||void 0!==r&&"0"!==r,a={...e.call};a.status=l?"err":"ok",a.label=l?r&&"0"!==r?"exit "+r:nC("render.error"):"ok",a.open||=l,s&&(a.output=(a.output+"\n"+ny(s)).trim().slice(-(l?6e4:12e3))),e.call=a;let o=y(e.seq);if(o>=0&&o<i.length){let e=i[o].item;"cmd"===e.kind&&(i[o]={...i[o],item:{...e,call:a}},v=null)}return a},D=(e,n,r)=>{if(!e)return;let a=l.get(e);if(void 0!==a){let e=y(a);if(e>=0&&e<i.length){let t=i[e].item;if("tmsg"===t.kind){let s=r||/"success"\s*:\s*false/.test(n)?"err":"ok",l=n.match(/"msg_id"\s*:\s*"([^"]+)"/)?.[1];i[e]={...i[e],item:{...t,delivery:s,msgId:l}},v=null}}return}!$(s.get(e),n,r)&&n&&t&&j({kind:"svc",text:"output: "+ny(n).slice(0,200)})},M=e=>{t?j({kind:"svc",text:e.slice(0,300)}):(c+=1,o.set(u,(o.get(u)??0)+1),v=null)},R=e=>{j({kind:"note",text:e})},P=(e,t)=>{let n=t.replace(nE,(t,n,r,i)=>{let s=nP(r,"teammate_id")||nP(r,"from")||nC("render.teammate"),l=nP(r,"summary"),a=i.trim();if(a.startsWith("{"))try{let e=JSON.parse(a);if("idle_notification"===e.type){let t=G(e.timestamp);return j({kind:"tnote",text:nC("render.left",{peer:s,at:t?" \xb7 "+t:""})}),""}}catch{}let{cleaned:o,cites:c}=A(a),d=nh.test(o)?nS(o,e):null;for(let t of(j({kind:"tmsg",ts:e,dir:"in",peer:s,summary:l,text:d?"":o}),d&&j(d),c))j(t);return""}).replace(/Another Claude session sent a message:\s*/g,"").trim();if(!n||N(n))return;if(nM.test(n))return void j({kind:"sysmsg",label:nR(n),text:n});let{cleaned:r,images:i}=nD(n);for(let t of(r&&!C(e,r,t=>j({kind:"user",ts:e,text:t}))&&j({kind:"user",ts:e,text:r}),i))j({kind:"inbox-image",name:t.name,path:t.path})},I=(e,t)=>{if(x&&x.text===t&&x.at===d)return;let{cleaned:n,images:r}=nD(t);for(let t of(n&&j({kind:"user",ts:e,text:n}),r))j({kind:"inbox-image",name:t.name,path:t.path});x={text:t,at:d,src:u}},L=(e,t)=>{x&&x.text===e&&x.at===d||(j({kind:"sysmsg",label:nR(e,t),text:e}),x={text:e,at:d,src:u})},_=(e,t)=>{j({kind:"compact",ts:e,trigger:t?.trigger,preTokens:t?.preTokens})},z=e=>t=>{for(let n of t.split("\n"))n.trim()&&e({kind:"raw",text:ny(n),err:/error|failed|traceback|exception/i.test(n)})},O=e=>{let t=e.replace(/\x1b\][^\x07]*(\x07|\x1b\\)/g,"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"");if(b)if(/^\[codex\]/.test(t))(()=>{if(!b)return;let e=b.lines.join("\n").trim();if(b=null,!e)return;let t=z(j);C(null,e,t)||t(e)})();else{b.lines.push(t),v=null;return}if(/Assistant message$/.test(t))return;let n=t.match(/^\[([^\]]+)\]\s*(.*)$/),r=n?.[1]??null,i=n?.[2]??t;if(!(!i||/^Assistant message captured/.test(i))){if(!n&&(nh.test(t)||t.startsWith("<oai-mem-citation>"))){b={lines:[t],src:u},v=null;return}if(/^Running command: /.test(i))return void E(r,i.replace(/^Running command: /,"").replace(/^\/usr\/bin\/zsh -lc /,""));if(/^Command (completed|failed)/.test(i)){g&&$(g,/^Command failed/.test(i)?i+"\n"+nC("render.jobLogNote"):i,/^Command failed/.test(i));return}return/^Applying \d+ file/.test(i)?void j({kind:"edit",files:i}):n&&!/^(Running|Command|Applying)/.test(i)?T(r,i):void(!N(t)&&j({kind:"raw",text:ny(t),err:/error|failed|traceback|exception/i.test(t)}))}},q=t=>{if(!n||t.toLowerCase().includes(n))if(r)try{let n=JSON.parse(t);n&&"object"==typeof n&&!Array.isArray(n)&&("claude"===e.fmt?(e=>{let t=e.timestamp;if("user"===e.type&&e.message){let n=nL(e.message).content,r=nL(nL(e.toolUseResult).file);if(!0===e.isCompactSummary){let e="string"==typeof n?n:n_(n).filter(e=>"text"===e.type).map(e=>nI(e.text)).join(" ");e.trim()&&((e,t)=>{for(let e=i.length-1;e>=0;e-=1){let n=i[e].item;if("compact"===n.kind){i[e]={...i[e],item:{...n,summary:t}},v=null;return}if("svc"!==n.kind&&"note"!==n.kind)break}j({kind:"compact",ts:e,summary:t})})(t,e.trim());return}if("string"==typeof n)P(t,n);else for(let e of n_(n))if("text"===e.type)P(t,nI(e.text));else if("image"===e.type)S(e,r);else if("tool_result"===e.type){let t=n_(e.content);for(let e of t)"image"===e.type&&S(e,r);let n="string"==typeof e.content?e.content:t.filter(e=>"image"!==e.type).map(e=>nI(e.text)).join(" ");D(nI(e.tool_use_id),n,!0===e.is_error)}return}if("assistant"===e.type&&e.message){for(let n of n_(nL(e.message).content))if("text"===n.type&&nI(n.text).trim())T(t,nI(n.text));else if("thinking"===n.type&&nI(n.thinking).trim())j({kind:"think",text:nI(n.thinking).replace(/\s+/g," ").trim()});else if("tool_use"===n.type&&"SendMessage"===nI(n.name)){let e=nL(n.input),r=e.message;if("string"==typeof r){let{cleaned:i,cites:s}=A(r),o=nh.test(i)?nS(i,t):null,c=j({kind:"tmsg",ts:t,dir:"out",peer:String(e.to??""),summary:String(e.summary??""),text:o?"":i});for(let e of(o&&j(o),s))j(e);let d=nI(n.id);d&&(l.set(d,c),a.set(c,d))}else M(`SendMessage → ${String(e.to??"")} \xb7 ${nI(nL(r).type)||nC("render.protocol")}`)}else if("tool_use"===n.type){let e=nL(n.input),r=String(e.command??e.file_path??e.prompt??JSON.stringify(e));E(t,nI(n.name)+": "+r.slice(0,160),nI(n.id),"tool")}return}if("system"===e.type&&"compact_boundary"===e.subtype){let n=nL(e.compactMetadata);return _(t,{trigger:nI(n.trigger)||void 0,preTokens:nT(n.preTokens)})}M(nI(e.type)||nC("render.record"))})(n):(e=>{let t=nL(e.payload),n=e.timestamp;if("session_meta"===e.type)return R(`${nC("render.codexSessionCreated")} \xb7 ${nI(t.model)} \xb7 ${nI(t.cwd)}`);if("event_msg"===e.type){if("agent_message"===t.type&&t.message)return T(n,nI(t.message));if("user_message"===t.type&&t.message){let e=nI(t.message);return nM.test(e)?L(e):I(n,e)}return"task_started"===t.type?R(nC("render.taskStarted")+(n?" \xb7 "+G(n):"")):"task_complete"===t.type?R(nC("render.taskComplete")+(n?" \xb7 "+G(n):"")):"context_compacted"===t.type?h?h=null:_(n):M(nI(t.type)||"event")}if("response_item"===e.type){if("message"===t.type){let e=n_(t.content).map(e=>nI(e.text)||nI(e.input_text)).join(" ").trim();return e?"assistant"===t.role?T(n,e):"user"!==t.role||nM.test(e)?L(e,nI(t.role)):I(n,e):M("message "+nI(t.role))}if("function_call"===t.type){let e={};try{e=JSON.parse(nI(t.arguments)||"{}")}catch{e={}}let r=nI(t.name);if("exec_command"===r||"shell"===r)return E(n,String(e.cmd??e.command??"").replace(/^\/usr\/bin\/zsh -lc /,""),nI(t.call_id));if("apply_patch"===r){let t=String(e.input??"").match(/(Add|Update|Delete) File: [^\n]+/g);j({kind:"edit",files:t?t.join(", ").replace(/(Add|Update|Delete) File: /g,""):nC("render.patch")});return}return"write_stdin"===r?M(nC("render.stdinSession",{id:String(e.session_id??"")})):E(n,r+" "+JSON.stringify(e).slice(0,120),nI(t.call_id),"tool")}if("function_call_output"===t.type)return D(nI(t.call_id),"string"==typeof t.output?t.output:JSON.stringify(t.output??""));if("custom_tool_call"===t.type&&"apply_patch"===nI(t.name)){let e=nI(t.input).match(/(Add|Update|Delete) File: [^\n]+/g);j({kind:"edit",files:e?e.join(", ").replace(/(Add|Update|Delete) File: /g,""):nC("render.patch")});return}return"custom_tool_call_output"===t.type?D(nI(t.call_id),"string"==typeof t.output?t.output:JSON.stringify(t.output??"")):"reasoning"===t.type?M("reasoning"):M(nI(t.type)||"item")}if("compacted"===e.type)return h={src:u},_(n);M(nI(e.type)||nC("render.record"))})(n))}catch{O(t)}else O(t)},F=()=>{i.length=0,s.clear(),l.clear(),a.clear(),o.clear(),c=0,m=null,x=null,h=null,b=null,g=null,w=new Map,v=null};return{feed:(e,t,n)=>{let r=t+e.length;(null===p||r<p||t>p||t<f)&&(F(),p=t),f=t,(e=>{for(;i.length&&i[0].src<e;){let e=i.shift();if(v=null,"cmd"===e.item.kind){let t=s.get(e.item.id);t&&t.seq===e.seq&&s.delete(e.item.id)}let t=a.get(e.seq);void 0!==t&&(a.delete(e.seq),l.get(t)===e.seq&&l.delete(t))}for(let[t,n]of o){if(t>=e)break;c-=n,o.delete(t),v=null}return m&&m.src<e&&(m=null),x&&x.src<e&&(x=null),h&&h.src<e&&(h=null),g&&0>y(g.seq)&&(g=null),null!==b&&b.src<e})(t)&&(F(),p=t);for(let n=p-t;n<e.length;n+=1)u=t+n,q(e[n]);return p=r,v&&k===n||(v=(e=>{let t=[],n=new Map,r=0;for(;r<i.length;){let l=i[r];if("cmd"!==l.item.kind){t.push({key:String(l.seq),item:l.item}),r+=1;continue}let a=r,o=[];for(;a<i.length;){let e=i[a];if("cmd"===e.item.kind)o.push({seq:e.seq,item:e.item});else if("think"!==e.item.kind)break;a+=1}let c=a===i.length;if(o.length>=4&&!(e&&c)){let e,i=o[0].seq,l=w.get(i);if(l&&l.calls.length===o.length&&o.every((e,t)=>l.calls[t]===e.item.call))e=l;else{let t={},n=0,r=0;for(let e of o){var s;let i=(s=e.item.call.cmd,s.match(/^([A-Za-z][\w.]*): /)?.[1]??"cmd");t[i]=(t[i]??0)+1,"ok"===e.item.call.status?n+=1:"err"===e.item.call.status&&(r+=1)}e={kind:"cmd-group",ids:o.map(e=>e.item.id),calls:o.map(e=>e.item.call),t0:o[0]?.item.ts,t1:o.at(-1)?.item.ts,byTool:t,okCount:n,errCount:r,hasErr:r>0}}n.set(i,e),t.push({key:"g"+i,item:e}),r=a}else t.push({key:String(l.seq),item:l.item}),r+=1}return w=n,(()=>{if(!b)return[];let e=b.lines.join("\n").trim();if(!e)return[];let t=[],n=e=>t.push(e),r=z(n);return C(null,e,r,n)||r(e),t})().forEach((e,n)=>t.push({key:"pb"+n,item:e})),{items:t,hiddenServiceCount:c}})(n),k=n),v}}}({engine:e.engine,fmt:e.fmt,showSvc:i,lineFilter:B}):null,[e?.path,e?.engine,e?.fmt,i,B,p]),W=(0,a.useMemo)(()=>e&&H?H.feed(w.lines,w.linesStart,"live"===e.activity):rm,[H,e?.activity,w.lines,w.linesStart]),K=Math.max(0,W.items.length-C),Y=K?W.items.slice(-C):W.items;(0,a.useEffect)(()=>{let t=w.tickTime?.toLocaleTimeString("uk"===f()?"uk-UA":"en-US",{hour12:!1})??"";w.error?l(w.error):e?l(`${(w.size/1024).toFixed(0)} kB${t?" \xb7 "+t:""}`):l("")},[w.error,w.size,w.tickTime,e,l]),(0,a.useLayoutEffect)(()=>{let e=v.current,t=y.current;e&&t&&(y.current=null,e.scrollTop=t.top+(e.scrollHeight-t.height))},[w.prependGen,C]),(0,a.useLayoutEffect)(()=>{let t=W.items.length,n=w.prependGen!==_.current;_.current=w.prependGen;let r=t-L.current;if(L.current=t,e&&t&&q.current!==e.path){q.current=e.path;let t=rx.get(e.path);if(!x&&t&&t.fromBottom>0&&v.current){let e=v.current;O.current=Date.now(),e.scrollTop=Math.max(0,e.scrollHeight-e.clientHeight-t.fromBottom);return}}x?U():!n&&r>0&&E(e=>e+r)},[W.items,x,w.prependGen]),(0,a.useEffect)(()=>{let e=v.current,t=k.current;if(!e||!t)return;let n=new ResizeObserver(()=>{I.current&&U()});return n.observe(t),n.observe(e),()=>n.disconnect()},[]);let J=()=>{let e=v.current;e&&(y.current={top:e.scrollTop,height:e.scrollHeight}),K?A(e=>e+S):w.hasMore&&w.loadOlder().then(()=>A(e=>e+S))},Q=K>0||w.hasMore,X=W.items.at(-1)?.item,V=X?.kind==="cmd"&&"run"===X.call.status?{icon:tm.A,label:m("feed.running",{tool:X.call.cmd.split(/[\s:]/,1)[0]||m("feed.tool")})}:X?.kind==="think"?{icon:td.A,label:m("feed.thinking")}:{icon:td.A,label:m("feed.working")},Z=u?"left-1/2 -translate-x-1/2":"right-3";return(0,r.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[e&&W.items.length?x?"live"===e.activity?(0,r.jsxs)("div",{className:`pointer-events-none absolute bottom-2 ${Z} z-10 inline-flex items-center gap-1 rounded-full bg-ok px-2 py-0.5 text-[10px] font-bold text-white shadow-card transition-transform duration-200 ${$?"scale-125":"scale-100"}`,children:[(0,r.jsx)(t4.A,{className:"h-3 w-3","aria-hidden":!0})," ",m("feed.liveTail")]}):null:(0,r.jsxs)("button",{className:`absolute bottom-2 ${Z} z-10 inline-flex items-center gap-1 whitespace-nowrap rounded-full border border-line bg-panel px-2.5 py-1 text-[11px] font-semibold text-ink shadow-card hover:border-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":m("feed.backToLive"),onClick:()=>{U(),F(!0,!0)},children:[(0,r.jsx)(e2.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",T?m("feed.newCount",{count:T}):m("feed.down")]}):null,(0,r.jsx)("div",{ref:v,className:u?"min-h-0 flex-1 overflow-y-auto py-3":"min-h-0 flex-1 overflow-y-auto py-6",onScroll:t=>{let n=t.currentTarget,r=n.scrollTop+n.clientHeight>=n.scrollHeight-50,i=Date.now()-O.current<300;r&&!I.current?F(!0,!0):!r&&I.current&&(i?U():F(!1)),e&&!i&&rh(e.path,I.current,Math.max(0,n.scrollHeight-n.clientHeight-n.scrollTop)),n.scrollTop<120&&Q&&!w.loadingOlder&&!w.loading&&J()},children:(0,r.jsx)("div",{ref:k,className:u?"px-3 pb-4 text-[13px]":"mx-auto w-full max-w-[1060px] px-6 pb-16",children:e?(0,r.jsxs)(r.Fragment,{children:[u&&Q?(0,r.jsx)("button",{className:"mb-2 flex w-full items-center justify-center gap-1.5 rounded-[8px] border border-dashed border-line bg-bg px-2 py-1 text-[11px] font-semibold text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",disabled:w.loadingOlder,onClick:J,children:w.loadingOlder?m("common.loading"):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(te.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",m("feed.showEarlier")]})}):null,!u&&Q&&W.items.length?(0,r.jsx)("button",{className:"mb-3 flex w-full items-center justify-center gap-1.5 rounded-[10px] border border-dashed border-line bg-panel px-3 py-1.5 text-[12px] font-semibold text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",disabled:w.loadingOlder,onClick:J,children:w.loadingOlder?m("common.loading"):K?m("feed.showEarlierHidden",{count:K}):m("feed.loadEarlier")}):null,u||Q||!W.items.length?null:(0,r.jsx)("div",{className:"mb-3 text-center text-[11px] text-dim",children:m("feed.startOfConvo")}),u?null:(0,r.jsx)(ru,{file:e,files:t,onSelect:n}),W.items.length?(0,r.jsxs)(r.Fragment,{children:[Y.map(({key:e,item:t})=>u?(0,r.jsx)("div",{className:"feed-cv",children:(0,r.jsx)(rs,{item:t})},e):(0,r.jsx)(rs,{item:t},e)),e.pendingQuestion||e.waitingInput?(0,r.jsx)(ro,{file:e},e.pendingQuestion?.toolUseId??"waiting"):null,e.pendingQuestion||e.waitingInput||!M?null:(0,r.jsx)("div",{className:"my-4 rounded-[8px] border border-line bg-chip px-4 py-3 text-[13px] font-semibold text-dim",children:M}),"live"===e.activity?(0,r.jsx)(rb,{icon:V.icon,label:V.label}):null,"recent"===e.activity&&ep(e)?(0,r.jsxs)("div",{className:"mt-2 flex items-center gap-1.5 text-[11.5px] font-semibold text-[#b8860b]",children:[(0,r.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-[#d29a2f]","aria-hidden":!0})," ",m("feed.finishedTurn")]}):"recent"===e.activity&&j(e)&&"running"!==e.proc?(0,r.jsxs)("div",{className:"mt-2 flex items-center gap-1 text-[11.5px] font-semibold text-accent",children:[(0,r.jsx)(e0.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",m("feed.returnedResult")]}):null]}):(0,r.jsxs)("div",{className:"mt-[14vh] text-center text-dim",children:[w.loading?m("common.loadingCap"):0===w.size?m("feed.noOutput"):W.hiddenServiceCount?m("feed.onlyService",{count:W.hiddenServiceCount}):m("feed.empty"),!w.loading&&(e.cmdDesc||e.cmd)?(0,r.jsxs)("div",{className:"mx-auto mt-3 max-w-[560px]",children:[e.cmdDesc?(0,r.jsx)("div",{className:"text-[12.5px] font-semibold text-ink",children:e.cmdDesc}):null,e.cmd?(0,r.jsx)("pre",{className:"mt-1.5 overflow-x-auto whitespace-pre-wrap break-words rounded-[10px] border border-line bg-bg px-3 py-2 text-left font-mono text-[11.5px] text-ink",children:e.cmd}):null]}):null]}),W.items.length?null:e.pendingQuestion||e.waitingInput?(0,r.jsx)(ro,{file:e},e.pendingQuestion?.toolUseId??"waiting"):null]}):(0,r.jsx)("div",{className:"mt-[20vh] text-center text-dim",children:m("feed.pickLog")})})})]})}let rw=()=>"uk"===f()?"uk-UA":"en-US",rv={completed:"✓",in_progress:"▸",pending:"○"};function rk({plan:e}){let t,{t:n}=b(),i=e.total?Math.round(e.done/e.total*100):0;return(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-[#f1f0fc] px-1.5 py-0.5 font-mono text-[9.5px] font-semibold text-accent",title:(t=e.steps.map(e=>`${rv[e.status]} ${e.text}`),[h(f(),"plan.agentPlan"),...t].join("\n")),"aria-label":n("plan.stepsAria",{done:e.done,total:e.total})+(e.current?n("plan.nowSuffix",{current:e.current}):""),children:[e.done,"/",e.total,(0,r.jsx)("span",{className:"h-1 w-6 overflow-hidden rounded-full bg-accent/20","aria-hidden":!0,children:(0,r.jsx)("span",{className:"block h-full rounded-full bg-accent",style:{width:`${i}%`}})})]})}let ry={active:{labelKey:"plan.goal",className:"bg-[#f1f0fc] text-accent"},complete:{labelKey:"plan.goalDone",className:"bg-[#e7f4ea] text-ok"},blocked:{labelKey:"plan.goalBlocked",className:"bg-[#fbeaea] text-err"}};function rj({ctx:e}){var t;let{t:n}=b();return(0,r.jsxs)("span",{className:`inline-flex shrink-0 items-center rounded-full px-1.5 py-0.5 font-mono text-[9.5px] font-semibold ${(t=e.pct)>=90?"bg-[#fbeaea] text-err":t>=70?"bg-[#fff7e6] text-[#b07d18]":"bg-chip text-dim"}`,title:n("plan.ctxTitle",{pct:e.pct,used:e.usedTokens.toLocaleString(rw()),window:e.windowTokens.toLocaleString(rw())}),"aria-label":n("plan.ctxAria",{pct:e.pct}),children:["ctx ",e.pct,"%"]})}function rN({goal:e}){let t,n,{t:i}=b(),s=ry[e.status];return(0,r.jsx)("span",{className:`inline-flex shrink-0 items-center rounded-full px-1.5 py-0.5 text-[9.5px] font-semibold ${s.className}`,title:(t=f(),n=[e.objective??h(t,"plan.noObjective")],null!==e.tokensUsed&&n.push(h(t,"plan.tokens",{n:e.tokensUsed.toLocaleString(rw())})),null!==e.timeUsedSeconds&&n.push(h(t,"plan.time",{n:Math.round(e.timeUsedSeconds/60)})),n.join("\n")),"aria-label":i("plan.goalAria",{status:i(s.labelKey)})+(e.objective?` — ${e.objective.slice(0,120)}`:""),children:i(s.labelKey)})}let rS=()=>void 0,rC={live:{section:"border-ok/60 shadow-[0_0_0_3px_rgba(47,158,68,0.16)]",header:"bg-[#eef8f0]"},waiting:{section:"border-[#e0ae45]/60 shadow-[0_0_0_3px_rgba(224,174,69,0.2)]",header:"bg-[#fff7e6]",glow:"#e0ae45"},returned:{section:"border-accent/50 shadow-[0_0_0_3px_rgba(90,81,224,0.15)]",header:"bg-[#f1f0fc]",glow:"#7a6ff0"},stalled:{section:"border-err/50 shadow-[0_0_0_3px_rgba(198,40,40,0.13)]",header:"bg-[#fdf0f0]",glow:"#d76a6a"},done:{section:"border-line",header:"bg-[#f4f4f6] text-dim opacity-80 saturate-50"}};function rA(e,t){return"session"===t?e("kind.session"):"subagent"===t?e("kind.subagent"):"job"===t?e("kind.job"):"background"===t?e("kind.background"):t}function rT({file:e}){let{t}=b(),[n,i]=(0,a.useState)(()=>Date.now());(0,a.useEffect)(()=>{let e=setInterval(()=>i(Date.now()),1e4);return()=>clearInterval(e)},[]);let s=n/1e3-e.mtime,l=("live"===e.activity||"recent"===e.activity)&&s>180;return(0,r.jsx)("span",{className:`shrink-0 font-mono text-[9.5px] tabular-nums ${l?"font-semibold text-[#b3831d]":"text-dim"}`,title:t(l?"branch.lastActivityQuiet":"branch.lastActivity",{age:X(e.mtime)}),children:X(e.mtime)})}function rE({file:e,files:t,tasks:n,onSelect:i,isRoot:s,onClose:o,dragHandle:c,noComposer:d,banner:u,onToggleExpand:p,expanded:f,dormant:m}){let{t:x}=b(),h=eK(),w=(0,a.useRef)(null),v=ed(e),k=eh(e),y=rC[k],[j,N]=(0,a.useState)(()=>"u">typeof IntersectionObserver);(0,a.useEffect)(()=>{let e=w.current;if(!e||"u"<typeof IntersectionObserver)return;let t=new IntersectionObserver(e=>N(!e.some(e=>e.isIntersecting)),{rootMargin:"256px"});return t.observe(e),()=>t.disconnect()},[]);let S=!!m||j;return(0,a.useEffect)(()=>{if(!f&&w.current){var t,n;return t=e.path,n=w.current,ew.set(t,n),()=>{ew.get(t)===n&&ew.delete(t)}}},[e.path,f]),(0,a.useEffect)(()=>{if(!d&&!f&&w.current){var t;return t=w.current,tV.set(e.path,{el:t,file:e}),()=>{tV.get(e.path)?.el===t&&tV.delete(e.path)}}},[e,d,f]),(0,r.jsx)("div",{className:`relative flex min-h-0 min-w-0 flex-1 ${y.glow?"pane-attention":""}`,style:y.glow?{"--pane-glow":y.glow}:void 0,children:(0,r.jsxs)("section",{ref:w,"data-pan-ignore":!0,"data-link-path":e.path,className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border bg-panel shadow-card ${y.section}`,children:[(0,r.jsx)("span",{"aria-hidden":!0,className:`w-full shrink-0 ${s?"h-1":"h-0.5"}`,style:"done"===k?{backgroundColor:"#c9c9d1"}:ec(e)}),(0,r.jsxs)("header",{className:`flex shrink-0 flex-col gap-y-1 border-b border-line px-2.5 py-1.5 ${y.header} ${c?"cursor-grab active:cursor-grabbing":""}`,...c,children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,r.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${V(e.activity)}`,title:x(`branch.${k}`)}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold",title:g(e.title),children:g(e.title,90)}),(0,r.jsx)(rd,{file:e,compact:!0,hideChip:h}),p?(0,r.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":f?x("branch.collapseFull"):x("branch.expandFull",{title:g(e.title,60)}),title:f?x("branch.collapseFull"):x("branch.expandFull",{title:g(e.title,60)}),onClick:p,children:f?(0,r.jsx)(eG.A,{className:"h-3 w-3","aria-hidden":!0}):(0,r.jsx)(eV.A,{className:"h-3 w-3","aria-hidden":!0})}):null,(0,r.jsx)(t2,{file:e,onDeleted:o}),o?(0,r.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":x("branch.removeColumn",{title:g(e.title,60)}),onClick:o,children:(0,r.jsx)(l.A,{className:"h-3 w-3","aria-hidden":!0})}):null]}),(0,r.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1",children:[(0,r.jsx)(rT,{file:e}),e.model?(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 font-mono text-[9.5px] font-semibold",style:{backgroundColor:el(e).soft,color:el(e).color},title:[v.label,ea(e)].filter(Boolean).join(" \xb7 "),children:e.model}):(0,r.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[10px] font-bold",style:v.style,children:v.label}),e.ctx&&(!h||e.ctx.pct>=70)?(0,r.jsx)(rj,{ctx:e.ctx}):null,e.worktree&&!h?(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 rounded-full border border-line/80 px-1.5 py-0.5 font-mono text-[9.5px] text-dim",title:x("branch.worktree",{name:e.worktree}),children:[(0,r.jsx)(eZ.A,{className:"h-2.5 w-2.5","aria-hidden":!0})," ",e.worktree]}):null,e.plan?(0,r.jsx)(rk,{plan:e.plan}):null,e.goal?(0,r.jsx)(rN,{goal:e.goal}):null,s||h?null:(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-dim",title:x(e.handoff?"branch.handoffTitle":"branch.branchTitle"),children:[(0,r.jsx)(e0.A,{className:"h-3 w-3","aria-hidden":!0})," ",e.handoff?x("kind.handoff"):rA(x,e.kind)]})]})]}),u??null,n.length?(0,r.jsx)(t3,{className:"shrink-0 border-b border-line bg-[#fbfbfd]",enter:"fade",children:n.map(e=>(0,r.jsx)("div",{"data-flip-key":e.path,children:(0,r.jsx)(r$,{file:e,files:t,onSelect:i,paused:S})},e.path))}):null,(0,r.jsx)(rg,{file:e,files:t,onSelect:i,showSvc:!1,lineFilter:"",onStatus:rS,paused:S,follow:!0,setFollow:rS,compact:!0}),d?null:(0,r.jsx)(tX,{file:e,pollPaused:S})]})})}function r$({file:e,files:t,onSelect:n,paused:i=!1}){let{t:s}=b(),[l,o]=(0,a.useState)(!1),c=g(e.cmdDesc||e.title,80);return(0,r.jsxs)("div",{className:"border-t border-line first:border-t-0",children:[(0,r.jsxs)("div",{className:"flex min-h-7 flex-wrap items-center gap-1.5 pl-2 pr-2.5",children:[(0,r.jsxs)("button",{className:"flex min-h-7 min-w-0 flex-1 items-center gap-1.5 rounded-[6px] text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":l,"aria-label":s("branch.toggleBackground",{action:s(l?"branch.collapse":"branch.expand"),title:c}),onClick:()=>o(e=>!e),children:[(0,r.jsx)(e7.A,{className:`h-3.5 w-3.5 shrink-0 text-dim transition-transform ${l?"rotate-90":""}`,"aria-hidden":!0}),(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${V(e.activity)}`}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",title:g(e.title),children:c})]}),(0,r.jsx)(rd,{file:e,compact:!0})]}),l?(0,r.jsx)("div",{className:"flex h-[220px] flex-col border-t border-dashed border-line bg-bg/60",children:(0,r.jsx)(rg,{file:e,files:t,onSelect:n,showSvc:!1,lineFilter:"",onStatus:rS,paused:i,follow:!0,setFollow:rS,compact:!0})}):null]})}let rD={claude:["low","medium","high","xhigh","max"],codex:["low","medium","high","xhigh"]};function rM({engine:e,effort:t,speed:n,disabled:i,onEffort:s,onSpeed:l}){let{t:a}=b(),o="h-7 min-w-0 rounded-[8px] border border-line bg-panel px-1.5 text-[11px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("select",{value:t,disabled:i,"aria-label":a("draft.reasoningAria"),title:a("draft.reasoningAria"),className:o,onChange:e=>s(e.target.value),children:[(0,r.jsx)("option",{value:"",children:a("draft.effortDefault")}),rD[e].map(e=>(0,r.jsx)("option",{value:e,children:e},e))]}),"codex"===e?(0,r.jsxs)("select",{value:n,disabled:i,"aria-label":a("draft.speedAria"),title:a("draft.speedTitle"),className:o,onChange:e=>l(e.target.value),children:[(0,r.jsx)("option",{value:"",children:a("draft.speedDefault")}),(0,r.jsx)("option",{value:"fast",children:"fast"}),(0,r.jsx)("option",{value:"standard",children:"standard"})]}):null]})}let rR=[{key:"claude",label:"Claude"},{key:"codex",label:"Codex"}],rP=(e,t)=>`llvDraftPane:${e}:${t}`;function rI(e,t){return sessionStorage.getItem(rP(e,t))??""}function rL(e,t,n){n?sessionStorage.setItem(rP(e,t),n):sessionStorage.removeItem(rP(e,t))}function r_({draftId:e,project:t,files:n,onClose:i,onSpawned:s}){let{t:o}=b(),[c]=(0,a.useState)(()=>rI(e,"src")),d=c?n.find(e=>e.path===c)??null:null,[u,p]=(0,a.useState)(()=>{let t=rI(e,"engine");return"codex"===t||"claude"===t?t:d?.engine==="codex"?"codex":"claude"}),[f,m]=(0,a.useState)(()=>rI(e,"cwd")),[x,h]=(0,a.useState)(()=>rI(e,"effort")),[w,v]=(0,a.useState)(()=>{let t=rI(e,"speed");return"fast"===t||"standard"===t?t:""}),[k,y]=(0,a.useState)([]),[j,N]=(0,a.useState)(()=>(function(e){try{let t=JSON.parse(rI(e,"boot")||"null");return t&&"number"==typeof t.at&&"string"==typeof t.prompt?t:null}catch{return null}})(e)),[S,C]=(0,a.useState)(!1),A=(0,a.useRef)(null),T=t=>{h(t),rL(e,"effort",t)},E=tz({initialText:()=>rI(e,"text")||(c?o("draft.readPrompt",{src:c}):""),persistText:t=>rL(e,"text",t),submit:e=>_(e),disabled:!!j}),{text:$,setText:D,setStatus:M,busy:R,setBusy:P,voiceSending:I,attachments:L}=E;(0,a.useEffect)(()=>{let n=!1;return fetch("/api/spawn?project="+encodeURIComponent(t)+(c?"&src="+encodeURIComponent(c):"")).then(e=>e.json()).then(t=>{n||(Array.isArray(t.dirs)&&y(t.dirs),m(n=>{let r="string"==typeof t.cwd?t.cwd:"",i=n||r||t.dirs?.[0]||"";return i!==n&&rL(e,"cwd",i),i}))}).catch(()=>{}),()=>{n=!0}},[t,e,c]),(0,a.useEffect)(()=>{if(!j)return;let e=A.current,t=j.path?n.find(e=>e.path===j.path):n.find(t=>"codex"===t.engine&&"codex-sessions"===t.root&&(c&&t.parent===c||!t.parent)&&t.mtime>=j.at/1e3-30&&(!e||!e.has(t.path)));t&&s(t)},[n,j,s,c]),(0,a.useEffect)(()=>{if(!j)return;let e=j.at+9e4-Date.now();if(e<=0)return void C(!0);let t=window.setTimeout(()=>C(!0),e);return()=>window.clearTimeout(t)},[j]);let _=async t=>{let r=t??$;if(!R&&!I&&!j){if(!f.trim())return void M({kind:"err",text:o("draft.needDir")});if(r.trim()||L.images.length){P(!0),M(null);try{var i;let t=await fetch("/api/spawn",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({engine:u,cwd:f.trim(),...x?{effort:x}:{},..."codex"===u&&w?{fast:"fast"===w}:{},prompt:r,images:L.images.map(e=>({base64:e.base64,mime:e.mime})),...c?{src:c}:{}})}),s=await t.json();if(!t.ok||!s.ok)return void M({kind:"err",text:s.error??o("draft.launchFailed")});A.current=new Set(n.map(e=>e.path)),i={at:Date.now(),target:s.target??"",path:s.path??null,prompt:r.trim()},N(i),rL(e,"boot",i?JSON.stringify(i):""),D(""),L.clear()}catch{M({kind:"err",text:o("common.serverUnavailable")})}finally{P(!1)}}}},z=Z[u]??ee,O=E.fieldsDisabled,q="draft-dirs-"+e;return(0,r.jsxs)("section",{"data-pan-ignore":!0,className:"relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border border-line bg-panel shadow-card","aria-label":o("draft.paneAria"),children:[(0,r.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0",style:{backgroundColor:z.color}}),(0,r.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-line px-2.5",style:{backgroundColor:z.soft},children:[(0,r.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[#c9c9d1]",title:o("draft.notStarted")}),(0,r.jsx)("div",{className:"flex shrink-0 items-center gap-1",role:"radiogroup","aria-label":o("draft.engineAria"),children:rR.map(({key:t,label:n})=>{let i=u===t,s=Z[t]??ee;return(0,r.jsx)("button",{type:"button",role:"radio","aria-checked":i,disabled:O,onClick:()=>{p(t),rL(e,"engine",t),x&&!rD[t].includes(x)&&T("")},style:i?{backgroundColor:"#fff",color:s.color,borderColor:s.color}:void 0,className:`rounded-full border px-2 py-0.5 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${i?"":"border-transparent bg-transparent text-dim hover:text-ink"}`,children:n},t)})}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-dim",title:d?g(d.title):void 0,children:c?o("draft.handoffLabel",{title:d?g(d.title,60):o("draft.conversation")}):o("draft.newConvo")}),(0,r.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":o("draft.dismiss"),onClick:i,children:(0,r.jsx)(l.A,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-line bg-[#fbfbfd] px-2.5 py-1.5",children:[(0,r.jsx)("span",{className:"shrink-0 text-[10px] font-semibold text-dim",children:o("draft.directory")}),(0,r.jsx)("input",{value:f,disabled:O,onChange:t=>{var n;m(n=t.target.value),rL(e,"cwd",n)},list:q,placeholder:"/home/…/Projects/…","aria-label":o("draft.dirAria"),className:"min-w-0 flex-1 rounded-[6px] border border-line bg-panel px-2 py-1 font-mono text-[11px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,r.jsx)("datalist",{id:q,children:k.map(e=>(0,r.jsx)("option",{value:e},e))})]}),(0,r.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-1.5 border-b border-line bg-[#fbfbfd] px-2.5 py-1.5",children:[(0,r.jsx)("span",{className:"shrink-0 text-[10px] font-semibold text-dim",children:o("draft.reasoning")}),(0,r.jsx)(rM,{engine:u,effort:x,speed:w,disabled:O,onEffort:T,onSpeed:t=>{v(t),rL(e,"speed",t)}})]}),(0,r.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-4 py-4",children:j?(0,r.jsxs)("div",{className:"flex flex-1 flex-col justify-end gap-3",children:[(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsx)("span",{className:"min-w-0 max-w-[85%] whitespace-pre-wrap rounded-[10px] rounded-br-[3px] bg-[#ecebfb] px-2.5 py-1.5 text-[12px] text-[#333]",children:j.prompt||o("draft.imagesOnly")})}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-[11.5px] font-semibold text-dim",children:[(0,r.jsx)(tk.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),(0,r.jsx)("span",{children:o("draft.launched",{target:j.target})})]}),S?(0,r.jsx)("div",{className:"text-[11px] text-dim",children:o("draft.slow",{target:j.target})}):null]}):(0,r.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-center",children:[(0,r.jsx)("span",{className:"rounded-full px-3 py-1 text-[13px] font-bold",style:{backgroundColor:z.soft,color:z.color},children:"claude"===u?"Claude":"Codex"}),(0,r.jsx)("div",{className:"max-w-[360px] text-[12px] text-dim",children:c?o("draft.hintRelay"):o("draft.hintNew")}),c?(0,r.jsx)("div",{className:"max-w-[420px] truncate font-mono text-[10px] text-dim",title:c,children:c}):null]})}),(0,r.jsx)("form",{onSubmit:e=>{e.preventDefault(),_()},className:"flex shrink-0 flex-col gap-1.5 border-t border-line bg-[#fbfbfd] px-2.5 py-2","aria-label":o("draft.promptAria"),children:(0,r.jsx)(tY,{composer:E,placeholder:o("draft.placeholder"),textareaAriaLabel:o("draft.promptTextAria"),imageAriaLabel:o("draft.addImages"),sendLabelIdle:o("composer.launchAgent"),sendLabelRecording:o("draft.stopAndLaunch"),sendIdleClassName:"hover:opacity-90",sendIdleStyle:{backgroundColor:z.color,borderColor:z.color},leftSlot:(0,r.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-1.5 py-1 font-mono text-[9.5px] font-semibold text-[#555]",title:o("draft.newWindowTitle"),children:[(0,r.jsx)(tc.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",o("draft.newAgent")]})})})]})}let rz=(e,t)=>`llvWfDraft:${e}:${t}`;function rO(e,t){return sessionStorage.getItem(rz(e,t))??""}function rq(e,t,n){n?sessionStorage.setItem(rz(e,t),n):sessionStorage.removeItem(rz(e,t))}function rF({draftId:e,project:t,onClose:n,onLaunched:i}){let{t:s}=b(),[o,c]=(0,a.useState)([]),[d,u]=(0,a.useState)(()=>rO(e,"template")),[p,f]=(0,a.useState)(()=>rO(e,"dir")),[m,x]=(0,a.useState)(()=>rO(e,"task")),[h,g]=(0,a.useState)(()=>"manual"===rO(e,"mode")),[w,v]=(0,a.useState)([]),[k,y]=(0,a.useState)(!1),[j,N]=(0,a.useState)(null);(0,a.useEffect)(()=>{let n=!1;return fetch("/api/workflows").then(e=>e.json()).then(t=>{!n&&Array.isArray(t.templates)&&(c(t.templates),u(n=>{let r=n&&t.templates.some(e=>e.name===n)?n:t.templates[0]?.name??"";return r!==n&&rq(e,"template",r),r}))}).catch(()=>{}),fetch("/api/spawn?project="+encodeURIComponent(t)).then(e=>e.json()).then(t=>{!n&&Array.isArray(t.dirs)&&(v(t.dirs),f(n=>{let r=n||t.dirs?.[0]||"";return r!==n&&rq(e,"dir",r),r}))}).catch(()=>{}),()=>{n=!0}},[t,e]);let S=o.find(e=>e.name===d)??null,C=async()=>{if(!k){if(!p.trim())return void N(s("wfDraft.needDir"));if(!m.trim())return void N(s("wfDraft.needTask"));y(!0),N(null);try{let e=await fetch("/api/workflows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({template:d,task:m.trim(),repoDir:p.trim(),mode:h?"manual":"auto"})}),t=await e.json();if(!e.ok||!t.ok)return void N(t.error??s("wfDraft.launchFailed"));window.dispatchEvent(new Event(ez)),i()}catch{N(s("common.serverUnavailable"))}finally{y(!1)}}},A="wf-draft-dirs-"+e;return(0,r.jsxs)("section",{"data-pan-ignore":!0,className:"relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border border-line bg-panel shadow-card","aria-label":s("wfDraft.paneAria"),children:[(0,r.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0 bg-accent"}),(0,r.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line bg-[#ecebfb] px-2.5",children:[(0,r.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[#c9c9d1]",title:s("wfDraft.notStarted")}),(0,r.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold tracking-[0.08em] text-accent",children:s("wfStrip.workflow")}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-dim",children:s("wfDraft.newWorkflow")}),(0,r.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":s("wfDraft.dismiss"),onClick:n,children:(0,r.jsx)(l.A,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,r.jsxs)("div",{className:"flex shrink-0 flex-col gap-1.5 border-b border-line bg-[#fbfbfd] px-2.5 py-2",children:[(0,r.jsxs)("label",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"w-[72px] shrink-0 text-[10px] font-semibold text-dim",children:s("wfDraft.template")}),(0,r.jsx)("select",{value:d,disabled:k,onChange:t=>{var n;u(n=t.target.value),rq(e,"template",n)},"aria-label":s("wfDraft.templateAria"),className:"min-w-0 flex-1 rounded-[6px] border border-line bg-panel px-2 py-1 text-[11.5px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",children:o.map(e=>(0,r.jsx)("option",{value:e.name,children:e.name},e.name))})]}),(0,r.jsxs)("label",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"w-[72px] shrink-0 text-[10px] font-semibold text-dim",children:s("wfDraft.repo")}),(0,r.jsx)("input",{value:p,disabled:k,onChange:t=>{var n;f(n=t.target.value),rq(e,"dir",n)},list:A,placeholder:"/home/…/Projects/…","aria-label":s("wfDraft.repoAria"),className:"min-w-0 flex-1 rounded-[6px] border border-line bg-panel px-2 py-1 font-mono text-[11px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,r.jsx)("datalist",{id:A,children:w.map(e=>(0,r.jsx)("option",{value:e},e))})]}),(0,r.jsxs)("label",{className:"flex items-center gap-1.5 text-[10.5px] font-semibold text-dim",children:[(0,r.jsx)("input",{type:"checkbox",checked:h,disabled:k,onChange:t=>{var n;g(n=t.target.checked),rq(e,"mode",n?"manual":"")},className:"accent-[#5a51e0]"}),s("wfDraft.manualMode")]})]}),(0,r.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto px-4 py-3",children:[S?(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5","aria-label":s("wfStrip.stagesAria"),children:[S.stages.map((e,t)=>(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:[t>0?(0,r.jsx)("span",{className:"text-[10px] font-bold text-[#c9c9d1]","aria-hidden":!0,children:"→"}):null,(0,r.jsx)("span",{className:"inline-flex h-6 max-w-[200px] items-center truncate rounded-full bg-chip px-2 text-[10.5px] font-bold text-[#555]",children:"review-loop"===e.kind?`${s("wfStrip.reviewStage")} \xb7 ${e.reviewer.engine}${e.reviewer.effort?" "+e.reviewer.effort:""}`:`${e.scope.split(/[.:\n]/)[0]} \xb7 ${e.agent.engine}${e.agent.model?" "+e.agent.model:""}${e.agent.effort?" "+e.agent.effort:""}`})]},t)),(0,r.jsxs)("span",{className:"inline-flex h-6 items-center rounded-full bg-chip px-2 text-[10.5px] font-bold text-[#555]",children:["→ ","merge"===S.finish?s("wfDraft.finishMerge"):"PR"]})]}):(0,r.jsx)("div",{className:"text-[12px] text-dim",children:s("wfDraft.hint")}),(0,r.jsx)("textarea",{value:m,disabled:k,onChange:t=>{var n;x(n=t.target.value),rq(e,"task",n)},placeholder:s("wfDraft.taskPlaceholder"),"aria-label":s("wfDraft.taskAria"),className:"min-h-[160px] flex-1 resize-none rounded-[8px] border border-line bg-panel px-2.5 py-2 text-[12.5px] leading-snug text-ink placeholder:text-dim/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"})]}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-t border-line bg-[#fbfbfd] px-2.5 py-2",children:[j?(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold text-err",title:j,children:j}):(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-dim",children:s("wfDraft.footerHint")}),(0,r.jsxs)("button",{className:"inline-flex shrink-0 items-center gap-1.5 rounded-full border border-accent bg-accent px-3.5 py-1.5 text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:k,onClick:()=>void C(),children:[k?(0,r.jsx)(tk.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,k?s("wfDraft.launching"):s("wfDraft.launch")]})]})]})}var rU=n(2749),rB=n(1275);function rH({wf:e}){var t;let{t:n}=b(),[i,s]=(0,a.useState)(!1),[o,c]=(0,a.useState)(null),d=async t=>{if(i)return;s(!0),c(null);let n=await eU(e.id,{action:t});n&&c(n),s(!1)},u=eq.has(e.state),p="closed"===e.state||"approved"===e.state,f=("implementing"===e.state||"reviewing"===e.state)&&!!e.stageRuns[e.stageIndex]?.doneAt,m=t=>{let r=e.template.stages[t];return r?"review-loop"===r.kind?n("wfStrip.reviewStage"):r.scope.split(/[.:\n]/)[0]?.trim()||`S${t+1}`:`S${t+1}`};return(0,r.jsxs)("div",{"data-scheme-ui":!0,className:`pointer-events-auto flex min-h-11 w-full items-center gap-3 rounded-[14px] border bg-panel/95 px-4 py-1 shadow-[0_2px_10px_rgb(20_20_30/0.08)] ${u?"border-[#e0ae45]/70":"border-line"}`,children:[(0,r.jsxs)("span",{className:"flex min-w-0 max-w-[46%] shrink-0 items-center gap-2",children:[(0,r.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${"approved"===e.state?"bg-ok":"needs_decision"===e.state?"bg-err":"paused"===e.state?"bg-[#e0ae45]":eF.has(e.state)?"bg-ok animate-pulse":"bg-[#9a9aa4]"}`,"aria-hidden":!0}),(0,r.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold tracking-[0.08em] text-dim",children:n("wfStrip.workflow")}),(0,r.jsx)("span",{className:"shrink-0 text-[12px] font-bold",children:e.name}),(0,r.jsx)("span",{className:"shrink-0 text-[11.5px] font-semibold text-dim",children:(t=e.state,n(`wfState.${t}`))}),e.stateDetail?(0,r.jsx)("span",{className:"min-w-0 truncate text-[11.5px] font-semibold text-err",title:e.stateDetail,children:e.stateDetail}):null]}),(0,r.jsx)("span",{className:"no-scrollbar flex min-w-0 flex-1 items-center justify-center gap-1.5 overflow-x-auto","aria-label":n("wfStrip.stagesAria"),children:e.template.stages.map((t,n)=>{let i,s=(i=e.stageRuns[n],i?.doneAt?{color:"#1a8a3e",soft:"#e7f4ea",pulse:!1}:n===e.stageIndex&&eF.has(e.state)&&"provisioning"!==e.state?{color:"#5a51e0",soft:"#ecebfb",pulse:!0}:{color:"#8b8b95",soft:"#efeff3",pulse:!1}),l=e.stageRuns[n];return(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[n>0?(0,r.jsx)("span",{className:"text-[10px] font-bold text-[#c9c9d1]","aria-hidden":!0,children:"→"}):null,(0,r.jsxs)("span",{className:`inline-flex h-6 max-w-[180px] items-center gap-1 truncate rounded-full px-2 text-[10.5px] font-bold ${s.pulse?"animate-pulse":""}`,style:{backgroundColor:s.soft,color:s.color},title:l?.doneNote??m(n),children:[l?.doneAt?"✓ ":"",m(n)]})]},n)})}),(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[o?(0,r.jsx)("span",{className:"max-w-[220px] truncate text-[10.5px] font-semibold text-err",title:o,children:o}):null,i?(0,r.jsx)(rU.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-dim","aria-hidden":!0}):null,e.prUrl?(0,r.jsxs)("a",{className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-full border border-ok/40 bg-[#eef8f0] px-2.5 text-[10.5px] font-bold text-ok hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",href:e.prUrl,target:"_blank",rel:"noreferrer",children:[(0,r.jsx)(rB.A,{className:"h-3 w-3","aria-hidden":!0})," PR"]}):null,f?(0,r.jsx)("button",{className:"shrink-0 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:i,onClick:()=>void d("advance"),children:n("wfStrip.advance")}):null,"needs_decision"===e.state?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{className:"shrink-0 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:i,onClick:()=>void d("retry-stage"),children:n("wfStrip.retryStage")}),(0,r.jsx)("button",{className:"shrink-0 rounded-full border border-line bg-bg px-2.5 py-1 text-[10.5px] font-bold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:i,onClick:()=>void d("advance"),children:n("wfStrip.skipStage")})]}):null,p?null:"paused"===e.state?(0,r.jsx)(tA,{label:n("wfStrip.resume"),children:(0,r.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-ok hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:i,"aria-label":n("wfStrip.resume"),onClick:()=>void d("resume"),children:(0,r.jsx)(tc.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}):(0,r.jsx)(tA,{label:n("wfStrip.pause"),children:(0,r.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:i,"aria-label":n("wfStrip.pause"),onClick:()=>void d("pause"),children:(0,r.jsx)(rl.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}),(0,r.jsx)(tA,{label:n("wfStrip.close"),children:(0,r.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:i,"aria-label":n("wfStrip.close"),onClick:()=>void d("close"),children:(0,r.jsx)(l.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]})]})}let rW={inbox:{color:"#e0ae45",soft:"#fdf3dd"},assigned:{color:"#5a51e0",soft:"#efeefc"},blocked:{color:"#d97757",soft:"#faeee9"},done:{color:"#1a8a3e",soft:"#e7f4ea"}},rK=["inbox","assigned","blocked","done"];function rY(e){return e.split(/\r?\n/,1)[0]?.trim()??""}function rJ(e,t){return("done"===e.status)-("done"===t.status)||t.updatedAt.localeCompare(e.updatedAt)}function rQ({tasks:e,project:t,onOpenTask:n,onClose:i}){let{t:s}=b(),[o,c]=(0,a.useState)("project"),d=(0,a.useMemo)(()=>("project"===o?e.filter(e=>e.project===t):[...e]).sort(rJ),[e,t,o]);return(0,r.jsxs)("aside",{className:"flex w-[280px] shrink-0 flex-col border-l border-line bg-panel","aria-label":s("tasks.panelTitle"),children:[(0,r.jsxs)("div",{className:"flex h-9 shrink-0 items-center gap-1.5 border-b border-line px-2.5",children:[(0,r.jsx)("span",{className:"text-[12px] font-bold",children:s("tasks.panelTitle")}),(0,r.jsx)("div",{className:"ml-1 flex items-center rounded-full border border-line p-0.5",children:["project","all"].map(e=>(0,r.jsx)("button",{type:"button","aria-pressed":o===e,className:`rounded-full px-2 py-0.5 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${o===e?"bg-accent/10 text-accent":"text-dim hover:text-ink"}`,onClick:()=>c(e),children:"project"===e?s("tasks.panelThisProject"):s("tasks.panelAll")},e))}),(0,r.jsx)("button",{type:"button",className:"ml-auto inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":s("tasks.panelClose"),onClick:i,children:(0,r.jsx)(l.A,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,r.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-1.5",children:d.length?d.map(e=>{let t=rW[e.status];return(0,r.jsxs)("button",{type:"button",className:`flex w-full min-w-0 flex-col gap-0.5 rounded-[8px] border border-line bg-panel px-2 py-1.5 text-left shadow-card hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${"done"===e.status?"opacity-60":""}`,title:e.text,onClick:()=>n(e),children:[(0,r.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-bold",style:{backgroundColor:t.soft,color:t.color},children:s(`tasks.status.${e.status}`)}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:rY(e.text)||s("tasks.untitled")})]}),(0,r.jsxs)("span",{className:"flex items-center gap-2 pl-0.5 text-[10px] text-dim",children:["all"===o?(0,r.jsx)("span",{className:"min-w-0 max-w-[110px] truncate",children:e.project}):null,e.assignments.length?(0,r.jsxs)("span",{children:["⤷ ",e.assignments.length]}):null,(0,r.jsx)("span",{children:X(new Date(e.updatedAt).getTime()/1e3)})]})]},e.id)}):(0,r.jsx)("div",{className:"px-2 py-3 text-center text-[11px] text-dim",children:s("tasks.panelEmpty")})})]})}let rX=0,rG=new Set;function rV(e,t){let n={id:++rX,kind:e,text:t};for(let e of rG)e(n)}function rZ(e,t){let n=f(),r=e.results.length,i=h(n,"tasks.sendOk",{delivered:e.delivered,total:r});if(!e.failed)return{kind:"ok",text:i};let s=new Map(t.map(e=>[e.path,e])),l=e.results.filter(e=>!e.ok).map(e=>{let t=s.get(e.path);return h(n,"tasks.sendFailPart",{title:t?g(t.title,40):e.path.split("/").pop()??e.path,error:e.error??""})});return{kind:"err",text:`${i}; ${l.join("; ")}`}}function r0(){let[e,t]=(0,a.useState)([]);return((0,a.useEffect)(()=>{let e=e=>{t(t=>[...t.slice(-3),e]),window.setTimeout(()=>t(t=>t.filter(t=>t.id!==e.id)),6e3)};return rG.add(e),()=>{rG.delete(e)}},[]),e.length)?(0,r.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-14 z-50 flex flex-col items-center gap-1.5 px-3",children:e.map(e=>(0,r.jsxs)("div",{className:`pointer-events-auto flex max-w-[560px] items-start gap-2 rounded-[10px] border px-3 py-2 text-[11.5px] font-semibold shadow-[0_10px_36px_rgb(20_20_30/0.18)] ${"ok"===e.kind?"border-ok/40 bg-[#eef8f0] text-[#1c6b30]":"border-err/40 bg-[#fdf0f0] text-[#8f2525]"}`,children:[(0,r.jsx)("span",{className:"min-w-0 break-words",children:e.text}),(0,r.jsx)("button",{type:"button",className:"mt-0.5 shrink-0 rounded p-0.5 opacity-60 hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":h(f(),"viewer.closeNotification"),onClick:()=>t(t=>t.filter(t=>t.id!==e.id)),children:(0,r.jsx)(l.A,{className:"h-3 w-3","aria-hidden":!0})})]},e.id))}):null}var r1=n(8780);async function r5(e,t,n){try{let r=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pid:e.pid??void 0,path:e.path,text:t,images:n})}),i=await r.json().catch(()=>null);if(!r.ok||!i?.ok)return i?.error??h(f(),"common.failedSend");return null}catch{return h(f(),"common.serverUnavailable")}}function r2({files:e,project:t,checked:n,onChange:i,maxHeight:s=240}){let{t:l}=b(),o=(0,a.useMemo)(()=>e.filter(e=>C(e)===t&&(y(e)||N(e))).sort((e,t)=>t.mtime-e.mtime),[e,t]),c=(0,a.useMemo)(()=>E(e),[e]),d=(0,a.useMemo)(()=>new Set(o.map(e=>e.path)),[o]);return o.length?(0,r.jsx)("div",{className:"flex flex-col gap-0.5 overflow-y-auto",style:{maxHeight:s},children:o.map(e=>{let t=ed(e),s=$(e,c).filter(e=>d.has(e.path)).length;return(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsxs)("label",{className:"flex h-7 min-w-0 flex-1 cursor-pointer items-center gap-1.5 rounded-[6px] px-1.5 hover:bg-bg",children:[(0,r.jsx)("input",{type:"checkbox",checked:n.has(e.path),onChange:()=>{var t;let r;return t=e.path,void((r=new Set(n)).has(t)?r.delete(t):r.add(t),i(r))},className:"accent-accent"}),(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${V(e.activity)}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:t.style,children:t.label}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold",title:g(e.title),children:g(e.title,46)})]}),s?(0,r.jsxs)("button",{type:"button",className:"inline-flex h-6 shrink-0 items-center gap-0.5 rounded-[6px] px-1 text-[10px] font-semibold text-dim hover:bg-bg hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:l("tasks.pickerAllChildren"),onClick:()=>(e=>{let t=new Set(n);for(let n of(t.add(e.path),$(e,c)))d.has(n.path)&&t.add(n.path);i(t)})(e),children:[(0,r.jsx)(e0.A,{className:"h-3 w-3","aria-hidden":!0})," ",s]}):null]},e.path)})}):(0,r.jsx)("div",{className:"px-1.5 py-2 text-[11px] text-dim",children:l("tasks.pickerEmpty")})}function r3({value:e,onPick:t}){let{t:n}=b();return(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:rK.map(i=>{let s=rW[i],l=i===e;return(0,r.jsx)("button",{type:"button","aria-pressed":l,className:"rounded-full border px-2 py-0.5 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:l?{backgroundColor:s.soft,color:s.color,borderColor:s.color}:{borderColor:"transparent",color:"#8b8b95"},onClick:()=>t(i),children:n(`tasks.status.${i}`)},i)})})}function r4({project:e,files:t,onCreated:n}){let{t:i}=b(),[s,l]=(0,a.useState)(()=>new Set),o=tz({initialText:()=>sessionStorage.getItem("llvTaskSheetDraft:"+e)??"",persistText:t=>{t?sessionStorage.setItem("llvTaskSheetDraft:"+e,t):sessionStorage.removeItem("llvTaskSheetDraft:"+e)},submit:e=>v(e)}),{text:c,setText:d,setStatus:u,busy:p,setBusy:m,voiceSending:x,attachments:w}=o,v=async r=>{let l=r??c;if(!p&&!x){if(!l.trim())return void u({kind:"err",text:i("tasks.composerNeedsText")});m(!0),u(null);try{let r=await eD({project:e,text:l,pos:{x:120,y:120}});if("error"in r)return void u({kind:"err",text:r.error});let i=[...s];if(i.length){let e=await eL(r.task.id,i);if("error"in e)rV("err",e.error);else{let n=rZ(e,t);rV(n.kind,n.text);let r=w.images.map(e=>({base64:e.base64,mime:e.mime}));if(r.length){let n=new Map(t.map(e=>[e.path,e])),i=e.results.filter(e=>e.ok).map(e=>{var t;let r,i,s;return n.get(e.path)??(r=(t=e.path).includes("/.codex/sessions/")?"codex-sessions":t.includes("/.claude/projects/")?"claude-projects":/\/tmp\/claude-\d+\//.test(t)?"claude-tasks":"codex-jobs",i=t.endsWith(".jsonl")?"claude-projects"===r?"claude":"codex":"plain",s=r.startsWith("codex")?"codex":"claude-tasks"===r?"shell":"claude",{path:t,root:r,fmt:i,engine:s,kind:"",title:g(t.split("/").pop()||t,120),project:"",worktree:void 0,mtime:Date.now()/1e3,size:0,activity:"idle",proc:null,pid:null,model:null,pendingQuestion:null,waitingInput:null,parent:null,name:t})}),s=[];for(let e of i)s.push(await r5(e,"",r));if(s.some(e=>null!==e)){let e=function(e,t){let n=f(),r=t.filter(e=>null===e).length,i=h(n,"tasks.sendOk",{delivered:r,total:e.length});if(r===e.length)return{kind:"ok",text:i};let s=e.map((e,n)=>({file:e,error:t[n]})).filter(e=>e.error).map(e=>h(n,"tasks.sendFailPart",{title:g(e.file.title,40),error:e.error??""}));return{kind:"err",text:`${i}; ${s.join("; ")}`}}(i,s);rV(e.kind,e.text)}}}}d(""),w.clear(),n(r.task)}finally{m(!1)}}};return(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault(),v()},className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[(0,r.jsx)("div",{className:"flex flex-col gap-1.5",children:(0,r.jsx)(tY,{composer:o,placeholder:i("tasks.newPlaceholder"),textareaAriaLabel:i("tasks.editAria"),imageAriaLabel:i("composer.addImages"),sendLabelIdle:i("tasks.sheetCreate"),sendLabelRecording:i("composer.stopAndSend"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",leftSlot:(0,r.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-1.5 py-1 text-[9.5px] font-semibold text-[#555]",children:i("tasks.sheetTargets",{count:s.size})})})}),(0,r.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-line bg-panel p-1.5",children:[(0,r.jsx)("div",{className:"px-1 text-[10.5px] font-bold text-dim",children:i("tasks.pickerTitle")}),(0,r.jsx)(r2,{files:t,project:e,checked:s,onChange:l,maxHeight:9999})]})]})}function r6({task:e,files:t,onDeleted:n}){let{t:i}=b(),[s,l]=(0,a.useState)(e.text),[o,c]=(0,a.useState)(()=>new Set),[d,u]=(0,a.useState)(!1),[p,f]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(!p)return;let e=window.setTimeout(()=>f(!1),4e3);return()=>window.clearTimeout(e)},[p]);let m=t_({onError:e=>rV("err",e),onUnclaimedText:e=>l(t=>t?t.trimEnd()+" "+e:e),onLiveCommit:e=>l(t=>t?t.trimEnd()+" "+e:e)}),x=async()=>{if(s===e.text)return null;if(!s.trim())return i("tasks.emptyTextBlocked");let t=await eP(e.id,{text:s});return t&&rV("err",t),t},h=async()=>{let n=[...o];if(n.length&&!d){if(!s.trim())return void rV("err",i("tasks.emptyTextBlocked"));u(!0);try{if(await x()!==null)return;let r=await eL(e.id,n);if("error"in r)rV("err",r.error);else{let e=rZ(r,t);rV(e.kind,e.text),c(new Set)}}finally{u(!1)}}},w=new Map(t.map(e=>[e.path,e]));return(0,r.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[10px] border border-line bg-panel p-2",children:[(0,r.jsx)("textarea",{value:m.liveText?(s?s.trimEnd()+" ":"")+m.liveText:s,readOnly:!!m.liveText,onChange:e=>l(e.target.value),onBlur:()=>void x(),rows:Math.min(14,Math.max(4,s.split("\n").length+1)),"aria-label":i("tasks.editAria"),maxLength:6e3,className:"w-full resize-none rounded-[8px] border border-line bg-panel px-2.5 py-1.5 text-[12.5px] leading-[18px] text-[#222] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),(0,r.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,r.jsx)(r3,{value:e.status,onPick:t=>{t!==e.status&&eP(e.id,{status:t}).then(e=>{e&&rV("err",e)})}}),(0,r.jsx)(tK,{...m,onText:e=>l(t=>t?t.trimEnd()+" "+e:e)})]})]}),e.assignments.length?(0,r.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-line bg-panel p-2",children:[(0,r.jsx)("div",{className:"text-[10.5px] font-bold text-dim",children:i("tasks.sheetAssignments")}),e.assignments.map((n,l)=>{let a=n.path?w.get(n.path)??null:null,o="failed"===n.state,c=a?ed(a):null,d=n.path?a?g(a.title,44):n.path.split("/").pop()??n.path:i("tasks.spawning");return(0,r.jsxs)("div",{className:`flex h-7 items-center gap-1.5 rounded-[6px] px-1.5 ${o?"bg-[#faeee9] text-[#a04a2e]":a?"bg-bg":"bg-bg opacity-60"}`,title:o?i("tasks.chipFailedTitle",{error:n.error??""}):void 0,children:[a?(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${V(a.activity)}`}):null,c?(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:c.style,children:c.label}):null,(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold",children:d}),o?(0,r.jsx)("span",{"aria-hidden":!0,children:"⚠"}):null,n.path&&(o||!a)?(0,r.jsx)("button",{type:"button",className:"shrink-0 rounded px-1 text-[10px] font-bold text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{(async()=>{if(!s.trim())return rV("err",i("tasks.emptyTextBlocked"));if(await x()!==null)return;let r=await eL(e.id,[n.path]);if("error"in r)rV("err",r.error);else{let e=rZ(r,t);rV(e.kind,e.text)}})()},children:i("tasks.retry")}):null]},(n.path??"spawning")+l)})]}):null,(0,r.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-line bg-panel p-1.5",children:[(0,r.jsx)("div",{className:"px-1 text-[10.5px] font-bold text-dim",children:i("tasks.pickerTitle")}),(0,r.jsx)(r2,{files:t,project:e.project,checked:o,onChange:c,maxHeight:9999}),(0,r.jsxs)("button",{type:"button",disabled:!o.size||d,className:"mt-1 inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] border border-accent bg-accent text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",onClick:()=>void h(),children:[d?(0,r.jsx)(tk.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):(0,r.jsx)(ra.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),i("tasks.pickerSend",{count:o.size})]})]}),(0,r.jsxs)("button",{type:"button",className:`inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] border text-[11.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${p?"border-err bg-err text-white":"border-line bg-panel text-dim hover:border-err/40 hover:text-err"}`,onClick:()=>{p?eI(e.id).then(e=>{e?rV("err",e):n()}):f(!0)},children:[(0,r.jsx)(tf.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),p?i("tasks.deleteConfirm"):i("tasks.delete")]})]})}function r8({project:e,tasks:t,files:n,initialView:i,onClose:s}){let{t:o}=b(),[c,d]=(0,a.useState)(i),u=(0,a.useMemo)(()=>[...t].sort((e,t)=>("done"===e.status)-("done"===t.status)||t.updatedAt.localeCompare(e.updatedAt)),[t]),p="object"==typeof c?t.find(e=>e.id===c.taskId)??null:null;return(0,r.jsxs)("div",{className:"fixed inset-0 z-[60] flex flex-col bg-bg pb-[env(safe-area-inset-bottom)]",children:[(0,r.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line bg-panel px-3",children:["list"!==c?(0,r.jsx)("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":o("tasks.sheetBack"),onClick:()=>d("list"),children:(0,r.jsx)(r1.A,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,r.jsx)("span",{className:"shrink-0 text-[13px] font-bold",children:"new"===c?o("tasks.sheetNew"):p?rY(p.text)||o("tasks.untitled"):o("tasks.panelTitle")}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] text-dim",children:e}),(0,r.jsx)("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":o("common.close"),onClick:s,children:(0,r.jsx)(l.A,{className:"h-4 w-4","aria-hidden":!0})})]}),"list"===c?(0,r.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto p-2",children:[(0,r.jsxs)("button",{type:"button",className:"flex h-9 shrink-0 items-center justify-center gap-1 rounded-[10px] border border-dashed border-accent/50 text-[12px] font-bold text-accent hover:bg-accent/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>d("new"),children:["+ ",o("tasks.sheetNew")]}),u.map(e=>{let t=rW[e.status];return(0,r.jsxs)("button",{type:"button",className:`flex w-full min-w-0 flex-col gap-0.5 rounded-[10px] border border-line bg-panel px-2.5 py-2 text-left shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${"done"===e.status?"opacity-60":""}`,onClick:()=>d({taskId:e.id}),children:[(0,r.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-bold",style:{backgroundColor:t.soft,color:t.color},children:o(`tasks.status.${e.status}`)}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold",children:rY(e.text)||o("tasks.untitled")})]}),(0,r.jsxs)("span",{className:"flex items-center gap-2 pl-0.5 text-[10.5px] text-dim",children:[e.assignments.length?(0,r.jsxs)("span",{children:["⤷ ",e.assignments.length]}):null,(0,r.jsx)("span",{children:X(new Date(e.updatedAt).getTime()/1e3)})]})]},e.id)}),u.length?null:(0,r.jsx)("div",{className:"px-2 py-4 text-center text-[11.5px] text-dim",children:o("tasks.sheetEmpty")})]}):"new"===c?(0,r.jsx)(r4,{project:e,files:n,onCreated:e=>d({taskId:e.id})}):p?(0,r.jsx)(r6,{task:p,files:n,onDeleted:()=>d("list")},p.id):(0,r.jsx)("div",{className:"flex flex-1 items-center justify-center text-[12px] text-dim",children:o("tasks.sheetGone")})]})}var r9=n(3665),r7=n(715);function ie({verdict:e,error:t,className:n="h-3 w-3"}){return"APPROVE"===e?(0,r.jsx)(e9.A,{className:n,strokeWidth:3,"aria-hidden":!0}):"REQUEST_CHANGES"===e?(0,r.jsx)(l.A,{className:n,strokeWidth:3,"aria-hidden":!0}):"COMMENT"===e?(0,r.jsx)(r9.A,{className:n,strokeWidth:2.5,"aria-hidden":!0}):t?(0,r.jsx)(i.A,{className:n,"aria-hidden":!0}):(0,r.jsx)(r7.A,{className:n,"aria-hidden":!0})}function it(e,t){return t.error?e("roundDeck.roundAborted",{n:t.n}):t.verdict?e("roundDeck.roundVerdict",{n:t.n,verdict:`${Y[t.verdict]} ${t.verdict}`}):e("roundDeck.roundInProgress",{n:t.n})}function ir({round:e,depth:t,pulse:n,onPull:i}){let{t:s}=b(),l=J(e.verdict);return(0,r.jsxs)("button",{className:`deck-tab absolute inset-x-0 flex items-center gap-1.5 rounded-[9px] border bg-panel px-2.5 text-left shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${n?"deck-tab-live border-ok/50":"border-line hover:border-accent/45"}`,style:{height:36,bottom:-(30*t)-10,zIndex:10-t,transform:`scale(${1-.035*t}) translateZ(${-(34*t)}px)`},title:e.error?`${it(s,e)}: ${e.error}`:it(s,e),onClick:i,children:[(0,r.jsxs)("span",{className:"inline-flex h-4 shrink-0 items-center gap-1 rounded-full px-1.5 text-[9.5px] font-bold",style:{backgroundColor:l.soft,color:l.color},children:["R",e.n," ",(0,r.jsx)(ie,{verdict:e.verdict,error:!!e.error,className:"h-2.5 w-2.5"})]}),(0,r.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-dim",children:[e.error?s("roundDeck.aborted"):e.verdict?e.verdict:s("roundDeck.reviewInProgress"),null!=e.findingsCount&&e.findingsCount>0?` \xb7 ${s("roundDeck.findings",{count:e.findingsCount})}`:""]}),n?(0,r.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-ok","aria-hidden":!0}):null]})}function ii({flow:e,rounds:t,files:n,onSelect:i,focusRound:s,dormant:l=!1}){let{t:o}=b(),c=t.length?t[t.length-1]:null,[d,u]=(0,a.useState)(null),[p,f]=(0,a.useState)(null);null!=s&&s!==p&&(f(s),u(Math.round(s)));let[m,x]=(0,a.useState)(null);c&&c.round.n!==m&&(x(c.round.n),null!=d&&c.round.n>d&&null===c.round.verdict&&u(null));let h=(0,a.useMemo)(()=>t.find(e=>e.round.n===d)??c,[t,d,c]);if(!h)return(0,r.jsx)("div",{className:"flex h-full items-center justify-center rounded-[10px] border border-dashed border-[#c9c9d1] bg-panel/60",children:(0,r.jsx)("span",{className:"text-[12px] font-semibold text-dim",children:o("roundDeck.waitingFirst")})});let g=t.filter(e=>e.round.n!==h.round.n).reverse(),w=g.slice(0,5),v=g.length-w.length,k=J(h.round.verdict),y=null!==h.round.verdict||!!h.round.error,j=c&&h.round.n!==c.round.n&&null===c.round.verdict&&!c.round.error?c:null;return(0,r.jsxs)("div",{className:"deck-3d relative h-full",style:{paddingBottom:30*Math.min(g.length,5+ +!!v)},children:[(0,r.jsx)("div",{className:"scheme-enter relative z-[11] flex h-full flex-col",children:h.file?(0,r.jsx)(rE,{file:h.file,files:n,tasks:[],onSelect:i,isRoot:!1,dormant:l,noComposer:"headless"===e.reviewerMode||y,banner:(0,r.jsxs)("div",{className:"flex h-6 shrink-0 items-center gap-1.5 border-b border-line px-2.5 text-[10.5px] font-bold",style:{backgroundColor:k.soft,color:k.color},children:[it(o,h.round),null!=h.round.findingsCount&&h.round.findingsCount>0?(0,r.jsxs)("span",{className:"font-semibold opacity-80",children:["\xb7 ",o("roundDeck.findings",{count:h.round.findingsCount})]}):null,h.round.readyNote?(0,r.jsxs)("span",{className:"min-w-0 flex-1 truncate font-semibold opacity-70",title:h.round.readyNote,children:["\xb7 ",h.round.readyNote]}):null]})}):(0,r.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-1 rounded-[10px] border border-line bg-panel shadow-card",children:[(0,r.jsx)("span",{className:"text-[12px] font-semibold text-dim",children:it(o,h.round)}),(0,r.jsx)("span",{className:"text-[11px] text-dim",children:h.round.error?h.round.error:o("roundDeck.spawningReviewer")})]})},h.round.n),w.map((e,t)=>(0,r.jsx)(ir,{round:e.round,depth:t,pulse:j?.round.n===e.round.n,onPull:()=>u(e.round.n)},e.round.n)),v>0?(0,r.jsx)("div",{className:"pointer-events-none absolute inset-x-6 flex items-center justify-center rounded-[9px] border border-line bg-panel/70 text-[10px] font-semibold text-dim shadow-card",style:{height:26,bottom:-(30*w.length)-8,zIndex:10-w.length},"aria-hidden":!0,children:o("roundDeck.moreRounds",{count:v})}):null]})}var is=n(8617);function il(e){return("claude-projects"===e.root||"codex-sessions"===e.root)&&e.path.endsWith(".jsonl")}function ia({file:e,onHandoff:t}){let{t:n}=b(),i=function(e){let{t}=b();return t1({exclude:e.path,onDragStart:void 0,onDrop:n=>{var r,i;let s,l;return r=n.file.path,i=t("link.handoffContext",{title:g(e.title,80),path:e.path,ask:""}).trimEnd()+"\n\n",s="llvDraft:"+r,l=sessionStorage.getItem(s)??"",sessionStorage.setItem(s,l.trim()?l.replace(/\s*$/,"")+"\n\n"+i:i),window.dispatchEvent(new CustomEvent(tQ,{detail:{path:r}})),t("link.dropped",{title:g(n.file.title,48)})}})}(e);return(0,r.jsxs)("div",{"data-scheme-ui":!0,className:"group absolute -bottom-11 left-2 z-[2]",children:[(0,r.jsxs)("button",{type:"button","aria-label":n("handoff.aria"),title:n("handoff.title"),onPointerDown:i.onPillPointerDown,onClick:()=>{i.consumeClick()||t()},className:"flex h-7 touch-none items-center gap-1.5 rounded-full border border-line bg-panel px-2 text-dim shadow-card transition-[border-color,color] duration-150 hover:border-accent/50 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,r.jsx)(is.A,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"max-w-[0px] overflow-hidden whitespace-nowrap text-[11px] font-semibold transition-[max-width] duration-200 group-hover:max-w-[180px] group-focus-within:max-w-[180px]",children:n("handoff.label")}),(0,r.jsx)(e2.A,{className:"hidden h-3.5 w-3.5 shrink-0 group-hover:block group-focus-within:block","aria-hidden":!0})]}),i.overlay]})}function io(e,t,n,r=[],i=[]){let s=new Map(n.map(e=>[e.path,e])),l=E(n),a=[],o=[],c=[],d=[],u=[],p=q(r),f=F(r),m=100,x=[],h=new Map;for(let e of i){let t=rI(e,"src");if(!t)continue;let n=h.get(t);n?n.push(e):h.set(t,[e])}let b=new Set,g=e=>({file:e,branches:l.get(e.path)?.length??0}),w=(e,t,n,r,i)=>{let l=(e,m,w,v)=>{let k=0===v?780:680;a.push({file:e.file,tasks:e.tasks,under:r.get(e.file.path)??[],x:m,y:w,w:600,h:k,isRoot:e.file.path===i});let y=p.get(e.file.path),j=k;if(y){var N;let e,t,n=(N=m+600+170,e=y.rounds.map(e=>({round:e,file:e.reviewerPath?s.get(e.reviewerPath)??null:null})),t={key:"deck::"+y.id,flow:y,rounds:e,x:N,y:w,w:600,h:k+30*Math.min(Math.max(y.rounds.length-1,0),6)},d.push(t),t);u.push({key:"loop::"+y.id,flow:y,x1:m+600,x2:n.x,y:w}),j=Math.max(j,n.h)}let S=w+j+130,C=t.get(e.file.path)??[],A=m+64;for(let e of C)o.push({to:e.file.path,x1:m+40,y1:w+k,x2:A+300,y2:S,color:eo(e.file),live:"live"===e.file.activity}),A+=l(e,A,S,v+1)+48;let T=n.get(e.file.path)?.filter(e=>!f.has(e.path));for(let t of(T?.length&&(c.push({key:e.file.path+"::stack",parent:e.file.path,items:T.map(g),x:A,y:S,w:360,h:16+58*Math.min(T.length,8)-6}),o.push({to:e.file.path+"::stack",x1:m+40,y1:w+k,x2:A+180,y2:S,color:"#9a9aa4",live:!1,dashed:!0}),A+=408),h.get(e.file.path)??[]))b.add(t),x.push({key:"draft::"+t,id:t,src:e.file.path,x:A,y:S,w:600,h:680}),o.push({to:"draft::"+t,x1:m+40,y1:w+k,x2:A+300,y2:S,color:"#5a51e0",live:!1,dashed:!0}),A+=648;let E=A-48-(m+64);return Math.max(E>0?Math.max(600,64+E):600,y?1370:600)};return l(e,m,100,0)};for(let t of e){let e=t.columns;if(!e.length)continue;let n=e[0].file.path,r=new Set(e.map(e=>e.file.path)),i=e=>{let t=e.parent,i=new Set([e.path]);for(;t&&!i.has(t)&&!r.has(t);)i.add(t),t=s.get(t)?.parent??null;return t&&r.has(t)&&t!==e.path?t:n},l=new Map;for(let t of e){if(t.file.path===n)continue;let e=i(t.file),r=l.get(e);r?r.push(t):l.set(e,[t])}let a=new Map,o=[];for(let e of[...t.returnable,...t.finished])if(!f.has(e.path))if(N(e)){let t=i(e),n=a.get(t);n?n.push(e):a.set(t,[e])}else o.push(e);let c=new Map([[n,o]]);m+=w(e[0],l,a,c,t.key)+150}for(let e of t){let t=(function(e,t){if(!e)return[];let n=E(t),r=[],i=new Set([e.path]),s=(e,t)=>{for(let l of(n.get(e.path)??[]).filter(e=>!i.has(e.path)).sort((e,t)=>k(e)-k(t)||t.mtime-e.mtime))i.add(l.path),r.push({file:l,depth:t}),s(l,t+1)};return s(e,1),r})(e,n).map(e=>e.file).filter(e=>!f.has(e.path)),r=t.filter(e=>N(e)),i=t.filter(e=>!N(e));m+=w({file:e,tasks:[]},new Map,new Map(r.length?[[e.path,r]]:[]),new Map([[e.path,i]]),e.parent?"":e.path)+150}for(let e of i)b.has(e)||(x.push({key:"draft::"+e,id:e,x:m,y:100,w:600,h:780}),m+=750);let v=0;for(let e of a)v=Math.max(v,e.y+e.h);for(let e of c)v=Math.max(v,e.y+e.h);for(let e of d)v=Math.max(v,e.y+e.h);for(let e of x)v=Math.max(v,e.y+e.h);return{nodes:a,edges:o,stacks:c,decks:d,loops:u,drafts:x,byPath:new Map([...a.map(e=>[e.file.path,e]),...x.map(e=>[e.key,e]),...c.map(e=>[e.key,e]),...d.map(e=>[e.key,e])]),width:Math.max(m-150+100,800),height:v+100+140}}var ic=n(1906),id=n(1285),iu=n(6900),ip=n(2879),im=n(5367),ix=n(1834),ih=n(5085),ib=n(4890),ig=n(2298);async function iw(e,t,n){let r=[];for(let i of e){try{let e=await t(i);r.push(e.ok?{path:i,ok:!0}:{path:i,ok:!1,error:e.error})}catch(e){r.push({path:i,ok:!1,error:e instanceof Error?e.message:String(e)})}n?.(r,e[r.length]??null)}return r}function iv(e){return null!==e.file.pid}function ik(e){return e.isRoot}function iy(e){let t=0;for(let n of e.text.split(/\r?\n/))t+=Math.max(1,Math.ceil(n.length/34));return Math.max(64,6+(Math.min(17*t,340)+20)+(e.assignments.length?26*e.assignments.length+6:0))}function ij(e){return{x:e.pos.x,y:e.pos.y,w:260,h:iy(e)}}function iN(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}function iS(e,t){let{x:n,y:r}=iN(e),i=t.x-n,s=t.y-r;if(!i&&!s)return{x:n,y:r};let l=Math.min(i?e.w/2/Math.abs(i):1/0,s?e.h/2/Math.abs(s):1/0,1);return{x:n+i*l,y:r+s*l}}let iC={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};async function iA(e,t){let n=await fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(n.ok)return{ok:!0};let r=await n.json().catch(()=>null);return{ok:!1,error:r?.error??`HTTP ${n.status}`}}function iT({icon:e,label:t,disabled:n,confirming:i,confirmLabel:s,onClick:l}){return(0,r.jsxs)("button",{className:`inline-flex h-7 items-center gap-1 whitespace-nowrap rounded-full border px-2.5 text-[11px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${i?"border-err bg-err text-white":"border-line bg-bg text-dim hover:border-accent/45 hover:text-accent"}`,disabled:n,onClick:l,children:[e,i?s:t]})}let iE=(0,a.memo)(function({project:e,nodes:t,flowsByImpl:n,onRemove:i,onFit:s,onExit:o}){let{t:c}=b(),[d,u]=(0,a.useState)(null),[p,f]=(0,a.useState)(!0),[m,x]=(0,a.useState)(null),[h,w]=(0,a.useState)(null),[v,k]=(0,a.useState)(!1),y=(0,a.useRef)(null),j=(0,a.useRef)(t);(0,a.useLayoutEffect)(()=>{j.current=t},[t]),(0,a.useEffect)(()=>{if(!h)return;let e=window.setTimeout(()=>w(null),4e3);return()=>window.clearTimeout(e)},[h]);let N=async(e,n,r)=>{var i,s;if(d||!n.length)return[];u(e),w(null);let l=new Map(m?.titles??[]);for(let e of t)l.set(e.file.path,g(e.file.title,60));let a=(i=()=>new Set(j.current.map(e=>e.file.path)),s=c("bulk.nodeGone"),e=>i().has(e)?r(e):Promise.resolve({ok:!1,error:s}));y.current={action:e,runner:a},x({action:e,items:[],current:n[0]??null,titles:l});try{return await iw(n,a,(t,n)=>x({action:e,items:[...t],current:n,titles:l}))}finally{u(null)}},S=tz({initialText:()=>"",persistText:()=>{},submit:async n=>{let r=(n??S.textRef.current).trim(),i=S.attachments.images.map(e=>({base64:e.base64,mime:e.mime}));if((r||i.length)&&!d){S.setBusy(!0);try{let n=new Map(t.map(e=>[e.file.path,e]));if(p){if(!r)return void S.setStatus({kind:"err",text:c("tasks.composerNeedsText")});let t=await eD({project:e,text:r,pos:(()=>{let e=j.current;if(!e.length)return{x:120,y:120};let t=0,n=0;for(let r of e)t+=r.x+r.w/2,n+=r.y+r.h/2;return{x:Math.round(t/e.length-130),y:Math.round(n/e.length-60)}})()});if("error"in t)return void S.setStatus({kind:"err",text:t.error});let s=t.task.id,l=await N("message",[...n.keys()],async e=>{let t=await eL(s,[e]);if("error"in t)return{ok:!1,error:t.error};let r=t.results[0];if(!r?.ok)return{ok:!1,error:r?.error??c("common.failedSend")};if(i.length){let t=n.get(e);return iA("/api/tmux",{pid:t?.file.pid??void 0,path:e,text:"",images:i})}return{ok:!0}});(!n.size||l.length&&l.every(e=>e.ok))&&(S.setText(""),S.attachments.clear());return}let s=await N("message",[...n.keys()],e=>{let t=n.get(e);return iA("/api/tmux",{pid:t?.file.pid??void 0,path:e,text:r,images:i})});s.length&&s.every(e=>e.ok)&&(S.setText(""),S.attachments.clear())}finally{S.setBusy(!1)}}},disabled:null!==d}),C=t.filter(iv),A=t.filter(ik),T=t.filter(e=>U(e.file,n)),E=m?.items.filter(e=>!e.ok).length??0;return(0,r.jsxs)("div",{"data-scheme-ui":!0,className:"absolute bottom-3 left-1/2 z-40 flex w-[640px] max-w-[94%] -translate-x-1/2 flex-col gap-1.5 rounded-[12px] border border-line bg-panel/95 p-2.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:[v?(0,r.jsx)(i$,{count:T.length,disabled:null!==d,onStart:e=>{k(!1),N("flow",T.map(e=>e.file.path),t=>iA("/api/flows",{implementerPath:t,...e}))},onClose:()=>k(!1)}):null,(0,r.jsx)("form",{onSubmit:e=>{e.preventDefault(),S.submit()},className:"flex flex-col gap-1.5",children:(0,r.jsx)(tY,{composer:S,placeholder:c("bulk.placeholder"),textareaAriaLabel:c("bulk.textAria"),imageAriaLabel:c("composer.addImages"),sendLabelIdle:c("bulk.sendAll",{count:t.length}),sendLabelRecording:c("composer.stopAndSend"),sendTitleRecording:c("composer.stopAndSendTitle"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",leftSlot:(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,r.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-2 py-1 text-[10px] font-bold text-[#555]",children:c("bulk.selectedCount",{count:t.length})}),(0,r.jsxs)("button",{type:"button",role:"switch","aria-checked":p,title:c("tasks.composerToggleTitle"),onClick:()=>f(e=>!e),className:`inline-flex h-6 shrink-0 items-center gap-1 rounded-full border px-2 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${p?"border-accent bg-accent/10 text-accent":"border-line bg-panel text-dim hover:text-ink"}`,children:[(0,r.jsx)("span",{className:`h-1.5 w-1.5 rounded-full ${p?"bg-accent":"bg-[#c9c9d1]"}`,"aria-hidden":!0}),c("tasks.composerToggle")]})]})})}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,r.jsx)(iT,{icon:(0,r.jsx)(im.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${c("bulk.interrupt")} ${C.length}/${t.length}`,disabled:null!==d||!C.length,onClick:()=>void N("interrupt",C.map(e=>e.file.path),e=>iA("/api/tmux",{action:"interrupt",path:e}))}),(0,r.jsx)(iT,{icon:(0,r.jsx)(tu.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${c("bulk.stop")} ${A.length}/${t.length}`,confirming:"kill"===h,confirmLabel:c("bulk.stopConfirm",{count:A.length}),disabled:null!==d||!A.length,onClick:()=>{"kill"!==h?w("kill"):N("kill",A.map(e=>e.file.path),e=>iA("/api/tmux",{action:"kill",path:e}))}}),(0,r.jsx)(iT,{icon:(0,r.jsx)(tf.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${c("bulk.remove")} ${t.length}`,confirming:"remove"===h,confirmLabel:c("bulk.removeConfirm",{count:t.length}),disabled:null!==d||!t.length,onClick:()=>{if("remove"!==h)return void w("remove");for(let e of t)i(e.file.path);w(null)}}),(0,r.jsx)(iT,{icon:(0,r.jsx)(ix.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${c("bulk.flow")} ${T.length}/${t.length}`,disabled:null!==d||!T.length,onClick:()=>k(e=>!e)}),(0,r.jsx)(iT,{icon:(0,r.jsx)(ih.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:c("bulk.fit"),disabled:!t.length,onClick:s}),(0,r.jsx)("button",{className:"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":c("bulk.exit"),title:c("bulk.exit"),onClick:o,children:(0,r.jsx)(l.A,{className:"h-4 w-4","aria-hidden":!0})})]}),m?(0,r.jsxs)("div",{className:"flex max-h-[140px] flex-col gap-0.5 overflow-y-auto rounded-[8px] border border-line bg-bg/60 p-1.5",children:[m.items.map(e=>(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px]",children:[e.ok?(0,r.jsx)(tt.A,{className:"h-3.5 w-3.5 shrink-0 text-ok","aria-hidden":!0}):(0,r.jsx)(ib.A,{className:"h-3.5 w-3.5 shrink-0 text-err","aria-hidden":!0}),(0,r.jsx)("span",{className:"min-w-0 shrink-0 truncate font-semibold",style:{maxWidth:"40%"},children:m.titles.get(e.path)??e.path}),e.error?(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-err",children:e.error}):null]},e.path)),m.current?(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px] text-dim",children:[(0,r.jsx)(tk.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin","aria-hidden":!0}),(0,r.jsx)("span",{className:"min-w-0 truncate font-semibold",children:m.titles.get(m.current)??m.current})]}):null,!d&&E?(0,r.jsxs)("button",{className:"mt-1 inline-flex h-6 items-center gap-1 self-start rounded-full border border-line bg-panel px-2 text-[10.5px] font-semibold text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{let e=m?.items.filter(e=>!e.ok).map(e=>e.path)??[],t=y.current;e.length&&t&&N(t.action,e,t.runner)},children:[(0,r.jsx)(ig.A,{className:"h-3 w-3","aria-hidden":!0}),c("bulk.retryFailed",{count:E})]}):null]}):null]})});function i$({count:e,disabled:t,onStart:n,onClose:i}){let{t:s}=b(),[l,o]=(0,a.useState)([]),[c,d]=(0,a.useState)(null),[u,p]=(0,a.useState)("auto"),[f,m]=(0,a.useState)(5);return(0,a.useEffect)(()=>{let e=!1;return fetch("/api/flows").then(e=>e.json()).then(t=>{!e&&Array.isArray(t.presets)&&t.presets.length&&(o(t.presets),d(e=>e??t.presets[0].name))}).catch(()=>{}),()=>{e=!0}},[]),(0,r.jsxs)("div",{className:"absolute bottom-[calc(100%+8px)] left-1/2 flex w-[420px] max-w-[94%] -translate-x-1/2 flex-col gap-2 rounded-[12px] border border-line bg-panel p-2.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",onKeyDown:e=>{"Escape"===e.key&&i()},children:[(0,r.jsx)("span",{className:"text-[12px] font-bold",children:s("bulk.flowTitle",{count:e})}),(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,r.jsxs)("label",{className:"col-span-3 flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[s("flowDialog.preset"),(0,r.jsx)("select",{value:c??"",className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[12px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>d(e.target.value||null),children:l.length?l.map(e=>(0,r.jsx)("option",{value:e.name,children:e.name},e.name)):(0,r.jsx)("option",{value:"",children:s("flowDialog.effortDefault")})})]}),(0,r.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[s("flowDialog.transitions"),(0,r.jsxs)("select",{value:u,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>p(e.target.value),children:[(0,r.jsx)("option",{value:"auto",children:s("flowDialog.auto")}),(0,r.jsx)("option",{value:"manual",children:s("flowDialog.manual")})]})]}),(0,r.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[s("flowDialog.roundLimit"),(0,r.jsx)("input",{type:"number",min:1,max:20,value:f,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>m(Math.max(1,Math.min(20,Number(e.target.value)||5)))})]}),(0,r.jsxs)("div",{className:"flex items-end justify-end gap-1.5",children:[(0,r.jsx)("button",{className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11px] font-semibold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:i,children:s("common.cancel")}),(0,r.jsx)("button",{className:"h-8 rounded-[8px] border border-accent bg-accent px-2.5 text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:t||!e,onClick:()=>n({...c?{preset:c}:{roles:iC},baseMode:"head",mode:u,reviewerMode:"headless",roundLimit:f}),children:s("bulk.flowStart",{count:e})})]})]})]})}function iD(e,t){return e.filter(e=>e.x<=t.x+t.w&&e.x+e.w>=t.x&&e.y<=t.y+t.h&&e.y+e.h>=t.y).map(e=>e.file.path)}function iM({layout:e,tasks:t=[],cam:n,vp:i,onJump:s}){let{t:l}=b(),o=(0,a.useRef)(null),c=(0,a.useRef)(!1),d=Math.min(216/e.width,148/e.height),u=(216-e.width*d)/2,p=(148-e.height*d)/2,f=e=>{let t=o.current?.getBoundingClientRect();t&&s((e.clientX-t.left-u)/d,(e.clientY-t.top-p)/d)};return(0,r.jsx)("div",{ref:o,"data-scheme-ui":!0,className:"absolute bottom-3 right-3 z-40 cursor-pointer overflow-hidden rounded-[10px] border border-line bg-panel/95 shadow-card",style:{width:216,height:148},title:l("minimap.title"),onPointerDown:e=>{e.stopPropagation(),c.current=!0,f(e);try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}},onPointerMove:e=>{c.current&&f(e)},onPointerUp:e=>{c.current=!1;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}},onPointerCancel:()=>{c.current=!1},children:(0,r.jsx)("svg",{width:216,height:148,"aria-hidden":!0,children:(0,r.jsxs)("g",{transform:`translate(${u} ${p}) scale(${d})`,children:[e.stacks.map(e=>(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:18,fill:"#c9c9d1",opacity:.45},e.key)),e.drafts.map(e=>(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:18,fill:"#9a9aa4",opacity:.3},e.key)),e.decks.map(e=>(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:18,fill:"#5a51e0",opacity:.3},e.key)),e.nodes.map(e=>(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:18,fill:eo(e.file),opacity:"live"===e.file.activity?.85:.35},e.file.path)),t.map(e=>(0,r.jsx)("circle",{cx:e.pos.x+130,cy:e.pos.y+iy(e)/2,r:3/d,fill:rW[e.status].color,opacity:"done"===e.status?.5:.95},e.id)),(0,r.jsx)("rect",{x:-n.x/n.z,y:-n.y/n.z,width:i.w/n.z,height:i.h/n.z,fill:"rgba(90,81,224,0.08)",stroke:"#5a51e0",strokeWidth:2.5/d})]})})})}var iR=n(9707);let iP={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};function iI({label:e,role:t,onChange:n}){let{t:i}=b();return(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"w-[86px] shrink-0 text-[10.5px] font-semibold text-dim",children:e}),(0,r.jsxs)("select",{value:t.engine,"aria-label":i("flowDialog.engine",{label:e}),className:"h-7 rounded-[8px] border border-line bg-bg px-1.5 text-[11.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>n({...t,engine:e.target.value,effort:null}),children:[(0,r.jsx)("option",{value:"claude",children:"Claude"}),(0,r.jsx)("option",{value:"codex",children:"Codex"})]}),(0,r.jsx)("input",{value:t.model??"",placeholder:i("flowDialog.modelPlaceholder"),"aria-label":i("flowDialog.model",{label:e}),className:"h-7 w-0 min-w-0 flex-1 rounded-[8px] border border-line bg-bg px-1.5 font-mono text-[11px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>n({...t,model:e.target.value.trim()||null})}),(0,r.jsxs)("select",{value:t.effort??"","aria-label":`Reasoning effort: ${e}`,className:"h-7 rounded-[8px] border border-line bg-bg px-1.5 text-[11.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>n({...t,effort:e.target.value||null}),children:[(0,r.jsx)("option",{value:"",children:i("flowDialog.effortDefault")}),rD[t.engine].map(e=>(0,r.jsx)("option",{value:e,children:e},e))]})]})}function iL({file:e,onClose:t}){let{t:n}=b(),[i,s]=(0,a.useState)([]),[l,o]=(0,a.useState)(null),[c,d]=(0,a.useState)(iP),[u,p]=(0,a.useState)(!1),[f,m]=(0,a.useState)("head"),[x,h]=(0,a.useState)("auto"),[g,w]=(0,a.useState)("headless"),[v,k]=(0,a.useState)(5),[y,j]=(0,a.useState)(!1),[N,S]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=!1;return fetch("/api/flows").then(e=>e.json()).then(t=>{!e&&Array.isArray(t.presets)&&t.presets.length&&(s(t.presets),o(e=>e??t.presets[0].name),d({implementer:t.presets[0].implementer,reviewer:t.presets[0].reviewer}))}).catch(()=>{}),()=>{e=!0}},[]);let C=async()=>{if(!y){j(!0),S(null);try{let r=await fetch("/api/flows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({implementerPath:e.path,...u||!l?{roles:c}:{preset:l},baseMode:f,mode:x,reviewerMode:g,roundLimit:v})});if(!r.ok){let e=await r.json().catch(()=>null);S(e?.error??n("flowDialog.createFailed",{status:r.status}));return}t()}catch{S(n("common.serverUnavailable"))}finally{j(!1)}}};return(0,r.jsxs)("div",{"data-scheme-ui":!0,className:"flex w-[420px] flex-col gap-2.5 rounded-[12px] border border-line bg-panel p-3 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",onKeyDown:e=>{"Escape"===e.key&&t()},children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-[12.5px] font-bold",children:n("flowDialog.title")}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-dim",children:n("flowDialog.subtitle")})]}),i.length?(0,r.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[n("flowDialog.preset"),(0,r.jsx)("select",{value:l??"",className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[12px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>{var t;let n;return o(t=e.target.value),void((n=i.find(e=>e.name===t))&&d({implementer:n.implementer,reviewer:n.reviewer}))},children:i.map(e=>(0,r.jsx)("option",{value:e.name,children:e.name},e.name))})]}):null,(0,r.jsx)("button",{className:"self-start text-[10.5px] font-semibold text-dim hover:text-accent focus-visible:outline-none","aria-expanded":u,onClick:()=>p(e=>!e),children:u?n("flowDialog.rolesManualOpen"):n("flowDialog.rolesManual")}),u?(0,r.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[10px] border border-dashed border-line bg-bg/50 p-2",children:[(0,r.jsx)(iI,{label:n("flowDialog.implementer"),role:c.implementer,onChange:e=>d(t=>({...t,implementer:e}))}),(0,r.jsx)(iI,{label:n("flowDialog.reviewer"),role:c.reviewer,onChange:e=>d(t=>({...t,reviewer:e}))})]}):null,(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,r.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[n("flowDialog.diffBase"),(0,r.jsxs)("select",{value:f,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>m(e.target.value),children:[(0,r.jsx)("option",{value:"head",children:n("flowDialog.fromHead")}),(0,r.jsx)("option",{value:"merge-base",children:n("flowDialog.fromMergeBase")})]})]}),(0,r.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[n("flowDialog.reviewer"),(0,r.jsxs)("select",{value:g,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>w(e.target.value),children:[(0,r.jsx)("option",{value:"headless",children:n("flowDialog.headless")}),(0,r.jsx)("option",{value:"pane",children:n("flowDialog.tmuxPane")})]})]}),(0,r.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[n("flowDialog.transitions"),(0,r.jsxs)("select",{value:x,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>h(e.target.value),children:[(0,r.jsx)("option",{value:"auto",children:n("flowDialog.auto")}),(0,r.jsx)("option",{value:"manual",children:n("flowDialog.manual")})]})]}),(0,r.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[n("flowDialog.roundLimit"),(0,r.jsx)("input",{type:"number",min:1,max:20,value:v,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:e=>k(Math.max(1,Math.min(20,Number(e.target.value)||5)))})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[N?(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-err",children:N}):(0,r.jsx)("span",{className:"flex-1"}),(0,r.jsx)("button",{className:"rounded-[8px] border border-line bg-bg px-2.5 py-1.5 text-[11.5px] font-semibold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:t,children:n("common.cancel")}),(0,r.jsx)("button",{className:"rounded-[8px] border border-accent bg-accent px-3 py-1.5 text-[12px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:y,onClick:()=>void C(),children:y?n("flowDialog.creating"):n("flowDialog.start")})]})]})}var i_=n(529);let iz={waiting_ready:{labelKey:"flowStrip.startReview",action:"advance"},spawn_pending:{labelKey:"flowStrip.spawnReviewer",action:"advance"},relay_pending:{labelKey:"flowStrip.relayNotes",action:"advance"},needs_decision:{labelKey:"flowStrip.retryRound",action:"retry-round"},done_comment:{labelKey:"flowStrip.anotherRound",action:"another-round"}},iO=new Set(["spawning","reviewing","relaying","fixing"]),iq=[1,2,3,4,5,0];function iF({flow:e,onFocusRound:t}){let{t:n}=b(),[i,s]=(0,a.useState)(!1),[o,c]=(0,a.useState)(null),[d,u]=(0,a.useState)(""),p=async(t,n)=>{if(i)return;s(!0),c(null);let r=await Q(e.id,{action:t,...n});r?c(r):n?.note!==void 0&&u(""),s(!1)},f=iz[e.state],m=H.has(e.state),x="closed"===e.state||"approved"===e.state,h="waiting_ready"===e.state||"needs_decision"===e.state;return(0,r.jsxs)("div",{"data-scheme-ui":!0,className:`pointer-events-auto flex h-11 w-full items-center gap-3 rounded-[14px] border bg-panel/95 px-4 shadow-[0_2px_10px_rgb(20_20_30/0.08)] ${m?"border-[#e0ae45]/70":"border-line"}`,children:[(0,r.jsxs)("span",{className:"flex min-w-0 max-w-[38%] shrink-0 items-center gap-2",children:[(0,r.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${"approved"===e.state?"bg-ok":"needs_decision"===e.state?"bg-err":"paused"===e.state?"bg-[#e0ae45]":iO.has(e.state)?"bg-ok animate-pulse":"bg-[#9a9aa4]"}`,"aria-hidden":!0}),(0,r.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold tracking-[0.08em] text-dim",children:n("flowStrip.flow")}),(0,r.jsx)("span",{className:"shrink-0 text-[12px] font-bold",children:B(n,e.state)}),e.stateDetail?(0,r.jsx)("span",{className:"min-w-0 truncate text-[11.5px] font-semibold text-dim",title:e.stateDetail,children:e.stateDetail}):null]}),(0,r.jsx)("span",{className:"no-scrollbar flex min-w-0 flex-1 items-center justify-center gap-1.5 overflow-x-auto","aria-label":n("flowStrip.roundsAria"),children:e.rounds.map((e,i)=>{let s=J(e.verdict),l=null===e.verdict&&!e.error;return(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[i>0?(0,r.jsx)("span",{className:"text-[10px] font-bold text-[#c9c9d1]","aria-hidden":!0,children:"→"}):null,(0,r.jsxs)("button",{className:`inline-flex h-6 items-center gap-1 rounded-full px-2 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"animate-pulse":""}`,style:{backgroundColor:s.soft,color:s.color},title:e.error?n("flowStrip.roundError",{n:e.n,error:e.error}):e.verdict?n("flowStrip.roundVerdict",{n:e.n,verdict:e.verdict})+(null!=e.findingsCount?` \xb7 ${n("roundDeck.findings",{count:e.findingsCount})}`:""):n("flowStrip.roundInProgress",{n:e.n}),onClick:()=>t?.(e.n),children:["R",e.n,(0,r.jsx)(ie,{verdict:e.verdict,error:!!e.error}),null!=e.findingsCount&&e.findingsCount>0?(0,r.jsx)("span",{children:e.findingsCount}):null]})]},e.n)})}),(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[o?(0,r.jsx)("span",{className:"max-w-[220px] truncate text-[10.5px] font-semibold text-err",title:o,children:o}):null,i?(0,r.jsx)(rU.A,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-dim","aria-hidden":!0}):null,h?(0,r.jsx)(tA,{label:n("flowStrip.noteTitle"),children:(0,r.jsx)("input",{className:"w-40 shrink-0 rounded-full border border-line bg-bg px-2.5 py-1 text-[10.5px] font-medium text-ink placeholder:text-dim/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",value:d,placeholder:n("flowStrip.notePlaceholder"),onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&f&&p(f.action,{note:d})}})}):null,"reviewing"===e.state?(0,r.jsx)(tA,{label:n("flowStrip.stopReviewerTitle"),children:(0,r.jsxs)("button",{className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-full border border-err/40 bg-[#fbeaea] px-2.5 text-[10.5px] font-bold text-err hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:i,onClick:()=>void p("cancel-round"),children:[(0,r.jsx)(tu.A,{className:"h-3 w-3","aria-hidden":!0})," ",n("flowStrip.stopReviewer")]})}):null,f?(0,r.jsx)("button",{className:"shrink-0 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:i,onClick:()=>void p(f.action,h?{note:d}:void 0),children:n(f.labelKey)}):null,x?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(tA,{label:n("flowStrip.limitTitle"),children:(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5 rounded-full border border-line bg-bg p-0.5",children:[iq.map(t=>{let s=e.roundLimit===t,l=0!==t&&t<e.rounds.length;return(0,r.jsx)("button",{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-30 ${s?"bg-accent text-white":"text-dim hover:bg-panel hover:text-ink"}`,disabled:i||l,"aria-label":0===t?n("flowStrip.limitUnlimitedAria"):n("flowStrip.limitAria",{count:t}),"aria-pressed":s,onClick:()=>void p("set-round-limit",{rounds:t}),children:0===t?(0,r.jsx)(i_.A,{className:"h-3 w-3","aria-hidden":!0}):t},t)}),iq.includes(e.roundLimit)?null:(0,r.jsx)("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-accent px-1 text-[10px] font-bold text-white",children:e.roundLimit})]})}),(0,r.jsx)(tA,{label:"auto"===e.mode?n("flowStrip.autoTitle"):n("flowStrip.manualTitle"),children:(0,r.jsx)("button",{className:`shrink-0 rounded-full border px-2.5 py-1 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${"auto"===e.mode?"border-ok/40 bg-[#eef8f0] text-ok":"border-line bg-bg text-dim hover:text-ink"}`,disabled:i,onClick:()=>void p("set-mode",{mode:"auto"===e.mode?"manual":"auto"}),children:"auto"===e.mode?n("flowDialog.auto"):n("flowStrip.manualShort")})}),"paused"===e.state?(0,r.jsx)(tA,{label:n("flowStrip.resume"),children:(0,r.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-ok hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:i,"aria-label":n("flowStrip.resume"),onClick:()=>void p("resume"),children:(0,r.jsx)(tc.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}):(0,r.jsx)(tA,{label:n("flowStrip.pause"),children:(0,r.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:i,"aria-label":n("flowStrip.pause"),onClick:()=>void p("pause"),children:(0,r.jsx)(rl.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]}),(0,r.jsx)(tA,{label:n("flowStrip.close"),children:(0,r.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:i,"aria-label":n("flowStrip.close"),onClick:()=>void p("close"),children:(0,r.jsx)(l.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]})]})}function iU({role:e,active:t}){let{t:n}=b();return(0,r.jsxs)("div",{className:`pointer-events-none absolute -top-3 left-4 z-[12] flex h-6 items-center gap-1.5 rounded-full border px-2.5 shadow-card ${t?"border-ok/50 bg-[#eef8f0]":"border-line bg-panel"}`,children:[(0,r.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${t?"animate-pulse bg-ok":"bg-[#c2c2cb]"}`,"aria-hidden":!0}),(0,r.jsx)("span",{className:`text-[10px] font-bold tracking-[0.06em] ${t?"text-ok":"text-ink"}`,children:n("implementer"===e?"scheme.roleImplementer":"scheme.roleReviewer")}),(0,r.jsx)("span",{className:`text-[10px] font-semibold ${t?"text-ok":"text-dim"}`,children:n(t?"scheme.roleWorking":"scheme.roleWaiting")})]})}let iB="cubic-bezier(.22,.8,.36,1)",iH=`transform 380ms ${iB}`,iW=(0,a.memo)(function({edges:e,width:t,height:n}){return(0,r.jsx)("svg",{width:t,height:n,className:"absolute left-0 top-0","aria-hidden":!0,children:e.map(e=>{let t=Math.max(36,(e.y2-e.y1)*.5),n=`M ${e.x1} ${e.y1} C ${e.x1} ${e.y1+t}, ${e.x2} ${e.y2-t}, ${e.x2} ${e.y2-7}`,i=`M ${e.x2-5} ${e.y2-9} L ${e.x2+5} ${e.y2-9} L ${e.x2} ${e.y2-1} Z`;return(0,r.jsxs)("g",{opacity:e.live?.9:.5,children:[(0,r.jsx)("path",{d:n,style:{d:`path("${n}")`,transition:`d 380ms ${iB}`},fill:"none",stroke:e.color,strokeWidth:2.5,strokeLinecap:"round",strokeDasharray:e.dashed?"5 7":void 0}),(0,r.jsx)("circle",{cx:e.x1,cy:e.y1,r:3.5,fill:e.color,style:{cx:`${e.x1}px`,cy:`${e.y1}px`,transition:`cx 380ms ${iB}, cy 380ms ${iB}`}}),(0,r.jsx)("path",{d:i,style:{d:`path("${i}")`,transition:`d 380ms ${iB}`},fill:e.color})]},e.to)})})}),iK=(0,a.memo)(function({loops:e,width:t,height:n}){return e.length?(0,r.jsx)("svg",{width:t,height:n,className:"absolute left-0 top-0","aria-hidden":!0,children:e.map(e=>{var t,n;let i="spawn_pending"===(t=e.flow).state||"spawning"===t.state||"reviewing"===t.state?"forward":"relay_pending"===t.state||"relaying"===t.state||"fixing"===t.state||"waiting_ready"===t.state&&t.rounds.length?"back":null,s="approved"===(n=e.flow).state?"#1a8a3e":W.has(n.state)?"#5a51e0":H.has(n.state)?"#e0ae45":"#9a9aa4",l=e.y+150,a=e.y+330,o=(e.x1+e.x2)/2,c=(l+a)/2,d=`M ${e.x1} ${l} C ${e.x1+52} ${l-56}, ${e.x2-52} ${l-56}, ${e.x2-7} ${l}`,u=`M ${e.x2} ${a} C ${e.x2-52} ${a+56}, ${e.x1+52} ${a+56}, ${e.x1+7} ${a}`,p=`M ${e.x2-9} ${l-5} L ${e.x2-9} ${l+5} L ${e.x2-1} ${l} Z`,f=`M ${e.x1+9} ${a-5} L ${e.x1+9} ${a+5} L ${e.x1+1} ${a} Z`,m=(e,t)=>({d:e,fill:"none",stroke:t?"#5a51e0":"#c9c9d1",strokeWidth:t?3:2.5,strokeLinecap:"round",className:t?"loop-arc-live":void 0,style:{d:`path("${e}")`,transition:`d 380ms ${iB}`}}),x=e=>({d:`path("${e}")`,transition:`d 380ms ${iB}`});return(0,r.jsxs)("g",{children:[(0,r.jsx)("path",{...m(d,"forward"===i)}),(0,r.jsx)("path",{d:p,style:x(p),fill:"forward"===i?"#5a51e0":"#c9c9d1"}),(0,r.jsx)("path",{...m(u,"back"===i)}),(0,r.jsx)("path",{d:f,style:x(f),fill:"back"===i?"#5a51e0":"#c9c9d1"}),(0,r.jsx)("circle",{cx:o,cy:c,r:17,fill:"#ffffff",stroke:s,strokeWidth:2,style:{cx:`${o}px`,cy:`${c}px`,transition:`cx 380ms ${iB}, cy 380ms ${iB}`}}),(0,r.jsx)("text",{x:o,y:c+6,textAnchor:"middle",fontSize:17,fontWeight:700,fill:s,style:{x:`${o}px`,y:`${c+6}px`,transition:`x 380ms ${iB}, y 380ms ${iB}`},children:"⟳"})]},e.key)})}):null});function iY({file:e,onSelect:t}){let n=ed(e);return(0,r.jsxs)("button",{className:"flex h-8 w-full min-w-0 items-center gap-1.5 rounded-[8px] px-2 text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:g(e.title),onClick:()=>t(e),children:[(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${V(e.activity)}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:n.style,children:n.label}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:g(e.cmdDesc||e.title,80)}),(0,r.jsx)("span",{className:"shrink-0 text-[10.5px] text-dim",children:X(e.mtime)})]})}function iJ({file:e}){let t=ed(e);return(0,r.jsx)("div",{className:"pointer-events-none absolute inset-0 z-[3] flex items-center justify-center",style:{opacity:"var(--label-o, 0)",transition:"opacity .25s"},"aria-hidden":!0,children:(0,r.jsxs)("div",{className:"flex max-w-[94%] items-center gap-[0.5em] rounded-[0.55em] border border-line bg-panel/95 px-[0.75em] py-[0.45em] shadow-[0_2px_14px_rgb(20_20_30/0.14)]",style:{fontSize:"calc(13px * min(var(--inv-z, 1), 2.6))"},children:[(0,r.jsx)("span",{className:`h-[0.6em] w-[0.6em] shrink-0 rounded-full ${V(e.activity)}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-[0.45em] font-bold",style:{...t.style,fontSize:"0.72em"},children:t.label}),(0,r.jsx)("span",{className:"line-clamp-2 min-w-0 font-bold",children:g(e.title,70)})]})})}let iQ=()=>void 0,iX=e=>e?" opacity-35":"";function iG({node:e,ringed:t,dimmed:n,flow:i}){let{t:s}=b(),l=ed(e.file);return(0,r.jsxs)("div",{"data-scheme-node":e.file.path,className:`scheme-enter absolute${iX(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:iH},children:[i?(0,r.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,r.jsx)(iF,{flow:i,onFocusRound:iQ})}):null,e.under.length?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"absolute inset-x-4 -bottom-4 h-5 rounded-[10px] border border-line bg-panel/70 shadow-card","aria-hidden":!0}),(0,r.jsx)("div",{className:"absolute inset-x-2 -bottom-2 h-5 rounded-[10px] border border-line bg-panel/90 shadow-card","aria-hidden":!0})]}):null,(0,r.jsxs)("div",{className:`relative z-[1] flex h-full min-w-0 flex-col overflow-hidden rounded-[10px] border border-line bg-panel shadow-card ${t?"ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:[(0,r.jsx)("span",{"aria-hidden":!0,className:"h-1 w-full shrink-0",style:ec(e.file)}),(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-line px-3 py-2.5",children:[(0,r.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${V(e.file.activity)}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[11px] font-bold",style:l.style,children:l.label}),e.file.model?(0,r.jsx)("span",{className:"min-w-0 truncate font-mono text-[11px] text-dim",children:e.file.model}):null,(0,r.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:X(e.file.mtime)})]}),(0,r.jsx)("div",{className:"min-w-0 flex-1 px-3 py-2.5 text-[14px] font-semibold leading-snug",children:(0,r.jsx)("span",{className:"line-clamp-5",children:g(e.file.title,180)})}),e.under.length?(0,r.jsxs)("div",{className:"shrink-0 px-3 pb-2.5 text-[11px] font-semibold text-dim",children:[e.under.length," ",s("scheme.underneath")]}):null]}),i?(0,r.jsx)(iU,{role:"implementer",active:"implementer"===K(i)}):null,(0,r.jsx)(iJ,{file:e.file})]})}function iV({draft:e,ringed:t,dimmed:n}){let{t:i}=b();return(0,r.jsx)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${iX(n)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:iH},children:(0,r.jsx)("div",{className:`flex h-full items-center justify-center rounded-[10px] border border-dashed border-line bg-panel/70 ${t?"ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:(0,r.jsxs)("span",{className:"flex items-center gap-1.5 text-[13px] font-semibold text-dim",children:[(0,r.jsx)("span",{className:"text-[15px] leading-none text-accent",children:"+"})," ",i("mobile.agent")]})})})}function iZ({deck:e,dimmed:t}){let{t:n}=b(),i=e.rounds.at(-1)??null,s=i?.round??null,l=J(s?.verdict??null);return(0,r.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${iX(t)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:iH},children:[(0,r.jsx)("div",{className:"flex h-full flex-col overflow-hidden rounded-[10px] border border-line bg-panel shadow-card",children:s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-line px-3 py-2.5",style:{backgroundColor:l.soft,color:l.color},children:[(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-[12px] font-bold",children:["R",s.n," ",(0,r.jsx)(ie,{verdict:s.verdict,error:!!s.error,className:"h-3.5 w-3.5"})]}),(0,r.jsx)("span",{className:"min-w-0 truncate text-[11px] font-semibold",children:s.error?n("roundDeck.aborted"):s.verdict??n("roundDeck.reviewInProgress")})]}),(0,r.jsx)("div",{className:"min-w-0 flex-1 px-3 py-2.5 text-[13px] font-semibold leading-snug",children:(0,r.jsx)("span",{className:"line-clamp-4",children:i?.file?g(i.file.title,140):n("roundDeck.spawningReviewer")})}),e.rounds.length>1?(0,r.jsx)("div",{className:"shrink-0 px-3 pb-2.5 text-[11px] font-semibold text-dim",children:n("roundDeck.moreRounds",{count:e.rounds.length-1})}):null]}):(0,r.jsx)("div",{className:"flex flex-1 items-center justify-center text-[12px] font-semibold text-dim",children:n("roundDeck.waitingFirst")})}),(0,r.jsx)(iU,{role:"reviewer",active:"reviewer"===K(e.flow)})]})}function i0({stack:e,dimmed:t,onSelect:n}){let{t:i}=b();return(0,r.jsx)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${iX(t)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:iH},children:(0,r.jsx)("div",{className:"flex h-full flex-col gap-1.5 overflow-y-auto rounded-[10px] border border-dashed border-[#c9c9d1] bg-panel/60 p-2",children:e.items.map(({file:e,branches:t})=>{let s=ed(e);return(0,r.jsxs)("button",{className:"flex min-h-[52px] w-full min-w-0 flex-col justify-center gap-0.5 rounded-[8px] border border-line bg-panel px-2 py-1 text-left shadow-card hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:g(e.title),onClick:()=>n(e),children:[(0,r.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${V(e.activity)}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:s.style,children:s.label}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:g(e.title,70)})]}),(0,r.jsxs)("span",{className:"flex items-center gap-2 pl-3 text-[10.5px] text-dim",children:[(0,r.jsx)("span",{children:rA(i,e.kind)}),(0,r.jsx)("span",{children:X(e.mtime)}),t?(0,r.jsxs)("span",{children:["⤷ ",t]}):null]})]},e.path)})})})}function i1({node:e,files:t,ringed:n,marked:i,dimmed:s,dormant:l,flow:o,canFlow:c,onSelect:d,onClose:u,onFocusRound:p,onHandoff:f,onExpand:m}){let{t:x}=b(),[h,g]=(0,a.useState)(!1),[w,v]=(0,a.useState)(!1);return(0,r.jsxs)("div",{"data-scheme-node":e.file.path,"data-lasso-selected":i?"true":void 0,className:`scheme-enter absolute ${h||w?"z-20":""}${iX(s)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:iH},children:[i?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"absolute -right-2.5 -top-2.5 z-[5] flex h-6 w-6 items-center justify-center rounded-full border-2 border-bg bg-accent text-white shadow-card",children:(0,r.jsx)(e9.A,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,r.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 z-[4] rounded-[10px] bg-accent/[0.06]"})]}):null,o?(0,r.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,r.jsx)(iF,{flow:o,onFocusRound:e=>p(o.id,e)})}):c?(0,r.jsx)("div",{className:"absolute -top-11 left-0 z-[4]",children:(0,r.jsxs)("button",{"data-scheme-ui":!0,className:"inline-flex h-7 items-center gap-1 rounded-full border border-line bg-panel px-2.5 text-[11px] font-semibold text-dim shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":w,title:x("scheme.flowTitle"),onClick:()=>v(e=>!e),children:[(0,r.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"⟳"})," ",x("scheme.flow")]})}):null,w?(0,r.jsx)("div",{className:"absolute left-0 top-[-8px] z-40 -translate-y-full",children:(0,r.jsx)(iL,{file:e.file,onClose:()=>v(!1)})}):null,e.under.length?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"absolute inset-x-4 -bottom-4 h-5 rounded-[10px] border border-line bg-panel/70 shadow-card","aria-hidden":!0}),(0,r.jsx)("div",{className:"absolute inset-x-2 -bottom-2 h-5 rounded-[10px] border border-line bg-panel/90 shadow-card","aria-hidden":!0})]}):null,(0,r.jsx)("div",{className:`relative z-[1] flex h-full ${n?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:(0,r.jsx)(rE,{file:e.file,tasks:e.tasks,files:t,onSelect:d,isRoot:e.isRoot,dormant:l,onClose:()=>u(e.file.path),onToggleExpand:()=>m(e.file.path)})}),o?(0,r.jsx)(iU,{role:"implementer",active:"implementer"===K(o)}):null,(0,r.jsx)(iJ,{file:e.file}),f&&il(e.file)?(0,r.jsx)(ia,{file:e.file,onHandoff:()=>f(e.file)}):null,e.under.length?(0,r.jsxs)("button",{className:"absolute -bottom-11 left-1/2 z-[2] inline-flex h-7 -translate-x-1/2 items-center gap-1.5 whitespace-nowrap rounded-full border border-line bg-panel px-2.5 text-[11px] font-semibold text-dim shadow-card hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":h,title:x("scheme.collapsedTitle"),onClick:()=>g(e=>!e),children:[(0,r.jsx)(iR.A,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.under.length," ",x("scheme.underneath"),(0,r.jsx)(e7.A,{className:`h-3 w-3 transition-transform ${h?"rotate-90":""}`,"aria-hidden":!0})]}):null,h?(0,r.jsx)("div",{className:"absolute left-0 top-[calc(100%+52px)] z-30 max-h-[280px] w-full overflow-y-auto rounded-[10px] border border-line bg-panel p-1.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:e.under.map(e=>(0,r.jsx)(iY,{file:e,onSelect:d},e.path))}):null]})}function i5({draft:e,project:t,files:n,ringed:i,dimmed:s,onDraftClose:l,onDraftSpawned:a}){return(0,r.jsx)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${iX(s)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:iH},children:(0,r.jsx)("div",{className:`flex h-full ${i?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:eO(e.id)?(0,r.jsx)(rF,{draftId:e.id,project:t,onClose:()=>l(e.id),onLaunched:()=>l(e.id)}):(0,r.jsx)(r_,{draftId:e.id,project:t,files:n,onClose:()=>l(e.id),onSpawned:t=>a(e.id,t)})})})}function i2({deck:e,files:t,focus:n,dimmed:i,dormant:s,onSelect:l}){let a=n&&n.flowId===e.flow.id?n.round+n.nonce/1e3:null;return(0,r.jsxs)("div",{"data-scheme-node":e.key,className:`scheme-enter absolute${iX(i)}`,style:{transform:`translate(${e.x}px, ${e.y}px)`,width:e.w,height:e.h,transition:iH},children:[(0,r.jsx)(ii,{flow:e.flow,rounds:e.rounds,files:t,onSelect:l,focusRound:a,dormant:s}),(0,r.jsx)(iU,{role:"reviewer",active:"reviewer"===K(e.flow)})]})}let i3=(0,a.memo)(function({layout:e,project:t,files:n,interactive:i,lite:s,dormant:l,selected:a,multi:o,session:c,focus:d,attentionPaths:u,flowsByImpl:p,deckFocus:f,onSelect:m,onClose:x,onFocusRound:h,onDraftClose:b,onDraftSpawned:g,onHandoff:w,onExpand:v}){let k=e=>null!==u&&!e.rounds.some(e=>e.file&&u.has(e.file.path));return(0,r.jsxs)("div",{className:`${i?"":"pointer-events-none select-none"} ${c?"scheme-session":""}`.trim()||void 0,children:[e.stacks.map(e=>(0,r.jsx)(i0,{stack:e,dimmed:null!==u&&!e.items.some(e=>u.has(e.file.path)),onSelect:m},e.key)),e.decks.map(e=>s?(0,r.jsx)(iZ,{deck:e,dimmed:k(e)},e.key):(0,r.jsx)(i2,{deck:e,files:n,focus:f,dimmed:k(e),dormant:l,onSelect:m},e.key)),e.drafts.map(e=>s?(0,r.jsx)(iV,{draft:e,ringed:a===e.key||d===e.key,dimmed:null!==u},e.key):(0,r.jsx)(i5,{draft:e,project:t,files:n,ringed:a===e.key||d===e.key,dimmed:null!==u,onDraftClose:b,onDraftSpawned:g},e.key)),e.nodes.map(e=>s?(0,r.jsx)(iG,{node:e,ringed:a===e.file.path||d===e.file.path,dimmed:null!==u&&!u.has(e.file.path),flow:p.get(e.file.path)??null},e.file.path):(0,r.jsx)(i1,{node:e,files:n,ringed:c?o.has(e.file.path):a===e.file.path||d===e.file.path,marked:c&&o.has(e.file.path),dimmed:null!==u&&!u.has(e.file.path),dormant:l,flow:p.get(e.file.path)??null,canFlow:U(e.file,p),onSelect:m,onClose:x,onFocusRound:h,onHandoff:w,onExpand:v},e.file.path))]})}),i4="#d97757",i6=(0,a.memo)(function({edges:e,width:t,height:n,onRetry:i}){return e.length?(0,r.jsx)("svg",{width:t,height:n,className:"pointer-events-none absolute left-0 top-0 z-[2]",children:e.map(e=>{let t=e.failed?i4:rW[e.status].color,n=(e.x1+e.x2)/2,s=`M ${e.x1} ${e.y1} C ${n} ${e.y1}, ${n} ${e.y2}, ${e.x2} ${e.y2}`,l=(e.x1+e.x2)/2,a=(e.y1+e.y2)/2;return(0,r.jsxs)("g",{opacity:e.failed?.95:.65,children:[(0,r.jsx)("path",{d:s,style:{d:`path("${s}")`,transition:`d 380ms ${iB}`},fill:"none",stroke:t,strokeWidth:2.5,strokeLinecap:"round",strokeDasharray:"5 7"}),(0,r.jsx)("circle",{cx:e.x2,cy:e.y2,r:4,fill:t,style:{cx:`${e.x2}px`,cy:`${e.y2}px`,transition:`cx 380ms ${iB}, cy 380ms ${iB}`}}),e.failed?(0,r.jsxs)("g",{className:"pointer-events-auto cursor-pointer",role:"button","aria-label":`retry ${e.path}`,onClick:()=>i(e.taskId,e.path),children:[(0,r.jsx)("title",{children:e.error??""}),(0,r.jsx)("path",{d:s,fill:"none",stroke:"transparent",strokeWidth:22,style:{pointerEvents:"stroke"}}),(0,r.jsx)("circle",{cx:l,cy:a,r:11,fill:"#fff",stroke:i4,strokeWidth:2,style:{cx:`${l}px`,cy:`${a}px`,transition:`cx 380ms ${iB}, cy 380ms ${iB}`}}),(0,r.jsx)("text",{x:l,y:a+4.5,textAnchor:"middle",fontSize:13,fontWeight:700,fill:i4,style:{x:`${l}px`,y:`${a+4.5}px`,transition:`x 380ms ${iB}, y 380ms ${iB}`},children:"⚠"})]}):null]},e.key)})}):null});var i8=n(9804);function i9(e,t){document.hasFocus()?t():window.addEventListener("focus",()=>e?.focus(),{once:!0})}function i7({task:e,assignment:t,file:n,onRetry:i}){let{t:s}=b();if(!t.path)return(0,r.jsxs)("span",{className:"flex h-6 items-center gap-1.5 rounded-[6px] bg-white/55 px-1.5 text-[10.5px] font-semibold text-dim",children:[(0,r.jsx)(tk.A,{className:"h-3 w-3 shrink-0 animate-spin","aria-hidden":!0}),s("tasks.spawning")]});let l=!n,a="failed"===t.state,o=n?ed(n):null,c=n?g(n.title,40):t.path.split("/").pop()??t.path,d=(0,r.jsxs)(r.Fragment,{children:[n?(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${V(n.activity)}`}):null,o?(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:o.style,children:o.label}):null,(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold",children:c}),a?(0,r.jsx)("span",{"aria-hidden":!0,children:"⚠"}):null]});return a||l?(0,r.jsx)("button",{type:"button",className:`flex h-6 w-full min-w-0 items-center gap-1.5 rounded-[6px] px-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${a?"bg-[#faeee9] text-[#a04a2e] hover:bg-[#f6ded2]":"bg-white/45 text-dim opacity-70 hover:opacity-100"}`,title:a?s("tasks.chipFailedTitle",{error:t.error??""}):`${s("tasks.deadChip")} \xb7 ${s("tasks.retry")}`,onClick:()=>i(e,t.path),children:d}):(0,r.jsx)("span",{className:"flex h-6 w-full min-w-0 items-center gap-1.5 rounded-[6px] bg-white/55 px-1.5",title:n?g(n.title):void 0,children:d})}function se({task:e,files:t,project:n,onSend:i,onClose:s}){let{t:l}=b(),[o,c]=(0,a.useState)(()=>new Set);return(0,r.jsxs)("div",{"data-task-pop":!0,className:"absolute left-0 top-full z-30 mt-1 flex w-[280px] flex-col rounded-[10px] border border-line bg-panel p-1.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:[(0,r.jsx)("div",{className:"px-1 pb-1 text-[10.5px] font-bold text-dim",children:l("tasks.pickerTitle")}),(0,r.jsx)(r2,{files:t,project:n,checked:o,onChange:c}),(0,r.jsxs)("div",{className:"mt-1 flex items-center justify-end gap-1 border-t border-line pt-1.5",children:[(0,r.jsx)("button",{type:"button",className:"rounded-[8px] px-2 py-1 text-[11px] font-semibold text-dim hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:s,children:l("common.cancel")}),(0,r.jsx)("button",{type:"button",disabled:!o.size,className:"rounded-[8px] border border-accent bg-accent px-2.5 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",onClick:()=>{i(e,[...o]),s()},children:l("tasks.pickerSend",{count:o.size})})]})]})}function st({task:e,onSpawn:t,onClose:n}){let{t:i}=b(),[s,l]=(0,a.useState)("claude"),[o,c]=(0,a.useState)(""),[d,u]=(0,a.useState)(""),[p,f]=(0,a.useState)(""),[m,x]=(0,a.useState)([]),[h,g]=(0,a.useState)(!1),[w,v]=(0,a.useState)(null);(0,a.useEffect)(()=>{let t=!1,n=e.assignments.find(e=>e.path)?.path;return fetch("/api/spawn?project="+encodeURIComponent(e.project)+(n?"&src="+encodeURIComponent(n):"")).then(e=>e.json()).then(e=>{t||(Array.isArray(e.dirs)&&x(e.dirs),c(t=>t||("string"==typeof e.cwd?e.cwd:"")||e.dirs?.[0]||""))}).catch(()=>{}),()=>{t=!0}},[e.project,e.assignments]);let k=async()=>{if(h||!o.trim())return;g(!0),v(null);let r=await t(e,{engine:s,cwd:o.trim(),...d?{effort:d}:{},..."codex"===s&&p?{fast:"fast"===p}:{}});g(!1),r?v(r):n()},y="task-spawn-dirs-"+e.id;return(0,r.jsxs)("div",{"data-task-pop":!0,className:"absolute left-0 top-full z-30 mt-1 flex w-[280px] flex-col gap-1.5 rounded-[10px] border border-line bg-panel p-2 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:[(0,r.jsx)("div",{className:"flex items-center gap-1",role:"radiogroup","aria-label":i("draft.engineAria"),children:["claude","codex"].map(e=>(0,r.jsx)("button",{type:"button",role:"radio","aria-checked":s===e,disabled:h,onClick:()=>{l(e),u("")},className:`rounded-full border px-2 py-0.5 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${s===e?"border-accent bg-accent/10 text-accent":"border-transparent text-dim hover:text-ink"}`,children:"claude"===e?"Claude":"Codex"},e))}),(0,r.jsx)("input",{value:o,disabled:h,onChange:e=>c(e.target.value),list:y,placeholder:"/home/…/Projects/…","aria-label":i("draft.dirAria"),className:"min-w-0 rounded-[6px] border border-line bg-panel px-2 py-1 font-mono text-[11px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,r.jsx)("datalist",{id:y,children:m.map(e=>(0,r.jsx)("option",{value:e},e))}),(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:(0,r.jsx)(rM,{engine:s,effort:d,speed:p,disabled:h,onEffort:u,onSpeed:f})}),w?(0,r.jsx)("span",{className:"text-[10.5px] font-semibold text-err",children:w}):null,(0,r.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,r.jsx)("button",{type:"button",className:"rounded-[8px] px-2 py-1 text-[11px] font-semibold text-dim hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:n,children:i("common.cancel")}),(0,r.jsxs)("button",{type:"button",disabled:h||!o.trim(),className:"inline-flex items-center gap-1 rounded-[8px] border border-accent bg-accent px-2.5 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",onClick:()=>void k(),children:[h?(0,r.jsx)(tk.A,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):(0,r.jsx)(i8.A,{className:"h-3 w-3","aria-hidden":!0}),i("tasks.spawnGo")]})]})]})}let sn=(0,a.memo)(function({task:e,files:t,camRef:n,handlers:i}){let{t:s}=b(),[l,o]=(0,a.useState)(null),c=(0,a.useRef)(null),[d,u]=(0,a.useState)(null),[p,f]=(0,a.useState)(!1),[m,x]=(0,a.useState)(""),[h,w]=(0,a.useState)(!1),[v,k]=(0,a.useState)(null),[y,j]=(0,a.useState)(!1),N=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(!y)return;let e=window.setTimeout(()=>j(!1),4e3);return()=>window.clearTimeout(e)},[y]),(0,a.useEffect)(()=>{if(!p)return;let t=window.setTimeout(()=>{m.trim()&&m!==e.text&&i.patch(e.id,{text:m})},900);return()=>window.clearTimeout(t)},[p,m,e.id,e.text,i]);let S=()=>{if(f(!1),!m.trim()){m!==e.text&&(w(!0),rV("err",s("tasks.emptyTextBlocked")));return}w(!1),m!==e.text&&i.patch(e.id,{text:m})},C=()=>(p?!m.trim():!!h)&&(rV("err",s("tasks.emptyTextBlocked")),!0),A=(e,t)=>{C()||i.send(e,t)},T=async(e,t)=>C()?s("tasks.emptyTextBlocked"):i.spawn(e,t),E=l??(d&&d.seen===e.updatedAt?d:e.pos),$=rW[e.status],D=rY(e.text)||s("tasks.untitled"),M=e.text.includes("\n")?e.text.slice(e.text.indexOf("\n")+1):"",R=new Map(t.map(e=>[e.path,e])),P=p||null!==l||null!==v,I=t1({onDrop:t=>C()?null:(i.send(e,[t.file.path]),s("tasks.linkSent",{title:g(t.file.title,48)})),onMiss:()=>k("spawn")});return(0,r.jsxs)("div",{"data-scheme-task":e.id,className:`group absolute pb-9 ${P?"z-30":"z-[4]"}`,style:{transform:`translate(${E.x}px, ${E.y}px)`,width:260,transition:l?void 0:`transform 380ms ${iB}`},onPointerDown:e=>{if(0===e.button&&!p&&!e.target.closest("button, a, input, textarea, select, [data-task-pop]")){c.current={sx:e.clientX,sy:e.clientY,ox:E.x,oy:E.y,moved:!1};try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}}},onPointerMove:e=>{let t=c.current;if(!t)return;let r=e.clientX-t.sx,i=e.clientY-t.sy;if(!t.moved&&4>Math.hypot(r,i))return;t.moved=!0;let s=n.current?.z??1;o({x:t.ox+r/s,y:t.oy+i/s})},onPointerUp:t=>{let r=c.current;if(c.current=null,r){if(r.moved){let s=n.current?.z??1,l={x:Math.round(r.ox+(t.clientX-r.sx)/s),y:Math.round(r.oy+(t.clientY-r.sy)/s)};o(null),u({...l,seen:e.updatedAt}),i.patch(e.id,{pos:l}).then(e=>{e&&u(null)});return}p||((n.current?.z??1)<.55&&i.center(ij(e)),x(e.text),f(!0),requestAnimationFrame(()=>{let e=N.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))}))}},children:[(0,r.jsxs)("div",{className:`flex flex-col overflow-hidden rounded-[8px] border border-line shadow-card ${"done"===e.status?"opacity-60 saturate-50":""} ${p?"ring-2 ring-accent/50":""}`,style:{backgroundColor:$.soft},children:[(0,r.jsx)("div",{"aria-hidden":!0,className:"h-1 w-full shrink-0",style:{backgroundColor:$.color}}),p?(0,r.jsx)("textarea",{ref:N,value:m,onChange:e=>x(e.target.value),onBlur:()=>i9(N.current,S),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),S())},"aria-label":s("tasks.editAria"),rows:Math.min(16,Math.max(3,m.split("\n").length+1)),className:"w-full resize-none bg-transparent px-3 py-2 text-[12.5px] leading-[17px] text-[#26262c] placeholder:text-dim focus-visible:outline-none",maxLength:6e3}):(0,r.jsxs)("div",{"data-task-body":!0,className:"cursor-text overflow-y-auto px-3 py-2",style:{maxHeight:340},children:[(0,r.jsx)("div",{className:"whitespace-pre-wrap break-words text-[12.5px] font-bold leading-[17px] text-[#26262c]",children:D}),M.trim()?(0,r.jsx)("div",{className:"whitespace-pre-wrap break-words text-[12.5px] leading-[17px] text-[#3a3a42]",children:M}):null]}),e.assignments.length?(0,r.jsx)("div",{className:"flex flex-col gap-1 px-2 pb-2",children:e.assignments.map((t,n)=>(0,r.jsx)(i7,{task:e,assignment:t,file:t.path?R.get(t.path)??null:null,onRetry:(e,t)=>A(e,[t])},(t.path??"spawning")+"::"+n))}):null]}),(0,r.jsxs)("div",{className:`absolute left-0 top-full flex -translate-y-8 items-center gap-1 ${P?"":"pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100"} transition-opacity`,children:[(0,r.jsxs)("button",{type:"button",className:"inline-flex h-7 touch-none items-center gap-1 rounded-full border border-line bg-panel px-2 text-[10.5px] font-semibold text-dim shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:s("tasks.sendTitle"),onPointerDown:I.onPillPointerDown,onClick:()=>{if(I.consumeClick())return;let t=i.selectionPaths();t.length?A(e,t):k(e=>"send"===e?null:"send")},children:[(0,r.jsx)(ra.A,{className:"h-3 w-3","aria-hidden":!0})," ",s("tasks.send")]}),(0,r.jsxs)("button",{type:"button",className:"inline-flex h-7 items-center rounded-full border px-2 text-[10.5px] font-bold shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{backgroundColor:"#fff",color:$.color,borderColor:$.color},title:s("tasks.statusTitle",{label:s(`tasks.status.${e.status}`)}),onClick:()=>{var t;let n;i.patch(e.id,{status:(t=e.status,n=rK.indexOf(t),rK[(n+1)%rK.length])})},children:[s("tasks.statusPrefix"),": ",s(`tasks.status.${e.status}`)]}),(0,r.jsxs)("button",{type:"button",className:`inline-flex h-7 items-center gap-1 rounded-full border px-2 text-[10.5px] font-semibold shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${y?"border-err bg-err text-white":"border-line bg-panel text-dim hover:border-err/40 hover:text-err"}`,"aria-label":s("tasks.deleteAria",{title:D}),title:y?s("tasks.deleteConfirm"):s("tasks.delete"),onClick:()=>{y?(j(!1),i.remove(e.id)):j(!0)},children:[(0,r.jsx)(tf.A,{className:"h-3 w-3","aria-hidden":!0}),y?s("tasks.deleteConfirm"):null]})]}),"send"===v?(0,r.jsx)(se,{task:e,files:t,project:e.project,onSend:A,onClose:()=>k(null)}):null,"spawn"===v?(0,r.jsx)(st,{task:e,onSpawn:T,onClose:()=>k(null)}):null,I.overlay]})});function sr({pos:e,onCommit:t,onCancel:n}){let{t:i}=b(),[s,l]=(0,a.useState)(""),o=(0,a.useRef)(null);(0,a.useEffect)(()=>{o.current?.focus()},[]);let c=()=>{s.trim()?t(s):n()};return(0,r.jsx)("div",{"data-scheme-task":"new",className:"absolute z-30",style:{transform:`translate(${e.x}px, ${e.y}px)`,width:260},children:(0,r.jsxs)("div",{className:"flex flex-col overflow-hidden rounded-[8px] border border-line shadow-card ring-2 ring-accent/50",style:{backgroundColor:rW.inbox.soft},children:[(0,r.jsx)("div",{"aria-hidden":!0,className:"h-1 w-full shrink-0",style:{backgroundColor:rW.inbox.color}}),(0,r.jsx)("textarea",{ref:o,value:s,onChange:e=>l(e.target.value),onBlur:()=>i9(o.current,c),onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),c())},placeholder:i("tasks.newPlaceholder"),"aria-label":i("tasks.editAria"),rows:4,className:"w-full resize-none bg-transparent px-3 py-2 text-[12.5px] leading-[17px] text-[#26262c] placeholder:text-dim focus-visible:outline-none",maxLength:6e3})]})})}function si({task:e}){let{t}=b(),n=rW[e.status];return(0,r.jsxs)("div",{"data-scheme-task":e.id,className:`absolute overflow-hidden rounded-[8px] border border-line shadow-card ${"done"===e.status?"opacity-60 saturate-50":""}`,style:{transform:`translate(${e.pos.x}px, ${e.pos.y}px)`,width:260,height:iy(e),backgroundColor:n.soft},children:[(0,r.jsx)("div",{"aria-hidden":!0,className:"h-1 w-full",style:{backgroundColor:n.color}}),(0,r.jsx)("div",{className:"px-3 py-2 text-[12.5px] font-bold leading-[17px] text-[#26262c]",children:(0,r.jsx)("span",{className:"line-clamp-4 whitespace-pre-wrap break-words",children:rY(e.text)||t("tasks.untitled")})})]})}let ss=(0,a.memo)(function({tasks:e,files:t,interactive:n,lite:i,camRef:s,handlers:l,pending:a,onCreate:o,onCreateCancel:c}){return(0,r.jsxs)("div",{className:n?void 0:"pointer-events-none select-none",children:[e.map(e=>i?(0,r.jsx)(si,{task:e},e.id):(0,r.jsx)(sn,{task:e,files:t,camRef:s,handlers:l},e.id)),a&&!i?(0,r.jsx)(sr,{pos:a,onCommit:o,onCancel:c}):null]})}),sl="llvSchemeMode",sa=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y),so=new Set;function sc({active:e,title:t,onClick:n,children:i}){return(0,r.jsx)("button",{className:`inline-flex h-7 w-7 items-center justify-center rounded-[8px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${e?"bg-accent/10 text-accent":"text-dim hover:bg-bg hover:text-ink"}`,title:t,"aria-label":t,"aria-pressed":e,onClick:n,children:i})}function sd({project:e,groups:t,manual:n,files:i,flows:s,tasks:l,drafts:o,focus:c,ring:d,attentionPaths:u,onSelect:p,onNodePick:m,onClose:x,onDraftClose:w,onDraftSpawned:v,onHandoff:k}){let{t:y}=b(),j=!!m,[N,S]=(0,a.useState)(null),[C,A]=(0,a.useState)(so),[T,E]=(0,a.useState)(!1);(0,a.useEffect)(()=>{c&&S(c)},[c]);let $=(0,a.useMemo)(()=>io(t,n,i,s,o),[t,n,i,s,o]);(0,a.useEffect)(()=>{A(e=>(function(e,t){let n=new Set(t.map(e=>e.file.path));for(let t of e)if(!n.has(t))return new Set([...e].filter(e=>n.has(e)));return e})(e,$.nodes))},[$]);let D=!j&&(T||C.size>0),M=(0,a.useCallback)(()=>{A(so),E(!1)},[]),R=(0,a.useCallback)(e=>{A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),P=(0,a.useRef)(N);(0,a.useEffect)(()=>{P.current=N},[N]);let I=(0,a.useCallback)((e,t)=>{if(null===e){S(null),M();return}if(t&&$.byPath.has(e)&&$.nodes.some(t=>t.file.path===e)){S(null),A(t=>{let n=new Set(t),r=P.current;return r&&r!==e&&$.nodes.some(e=>e.file.path===r)&&n.add(r),n.has(e)?n.delete(e):n.add(e),n});return}S(e)},[$,M]),L=(0,a.useMemo)(()=>q(s),[s]),[_,z]=(0,a.useState)(null);(0,a.useEffect)(()=>{z(null)},[e]);let O=_?$.nodes.find(e=>e.file.path===_)??null:null,F=null!==O;(0,a.useEffect)(()=>{if(!F)return;let e=e=>{if("Escape"!==e.key)return;let t=e.target;t&&(["INPUT","TEXTAREA","SELECT"].includes(t.tagName)||t.isContentEditable)||(e.preventDefault(),e.stopPropagation(),z(null))};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[F]);let[U,B]=(0,a.useState)(null),H=(0,a.useCallback)((e,t)=>{B(n=>({flowId:e,round:t,nonce:(n?.nonce??0)+1}))},[]),W=d??c,K=(0,a.useRef)(p),Y=(0,a.useRef)(m),J=(0,a.useRef)(x),Q=(0,a.useRef)(w),X=(0,a.useRef)(v),G=(0,a.useRef)(k);(0,a.useEffect)(()=>{K.current=p,Y.current=m,J.current=x,Q.current=w,X.current=v,G.current=k});let V=(0,a.useCallback)(e=>{let t=Y.current;t?t(e.path):K.current(e)},[]),Z=(0,a.useCallback)(e=>J.current(e),[]),ee=(0,a.useCallback)(e=>Q.current(e),[]),et=(0,a.useCallback)((e,t)=>X.current(e,t),[]),en=(0,a.useCallback)(e=>G.current?.(e),[]),er=(0,a.useCallback)(e=>z(e),[]),ei=(0,a.useCallback)(e=>{z(null),K.current(e)},[]),es=(0,a.useRef)(D);(0,a.useEffect)(()=>{es.current=D},[D]);let el=(0,a.useRef)(!1),ea=(0,a.useCallback)((e,t)=>{if(el.current)return el.current=!1,!0;if(!es.current)return S(null),!0;let n=iD($.nodes,{x:e,y:t,w:0,h:0});return n.length?R(n[0]):M(),!0},[$,R,M]),eo=(0,a.useRef)(()=>!1),[ec,ed]=(0,a.useState)([]),[eu,ep]=(0,a.useState)(null);(0,a.useEffect)(()=>{let t=new Set(l.map(e=>e.id));ed(n=>{let r=n.filter(n=>!t.has(n.id)&&n.project===e);return r.length===n.length?n:r})},[l,e]);let ef=(0,a.useMemo)(()=>{let t=new Set(l.map(e=>e.id)),n=ec.filter(n=>!t.has(n.id)&&n.project===e);return n.length?[...l,...n]:l},[l,ec,e]),em=(0,a.useMemo)(()=>new Map(ef.map(e=>["task::"+e.id,ij(e)])),[ef]),ex=(0,a.useMemo)(()=>(function(e,t){let n=[];for(let r of e){let e=ij(r),i=iN(e);for(let s of r.assignments){if(!s.path)continue;let l=t.get(s.path);if(!l)continue;let a=iS(e,iN(l)),o=iS(l,i);n.push({key:r.id+"::"+s.path,taskId:r.id,path:s.path,x1:a.x,y1:a.y,x2:o.x,y2:o.y,status:r.status,failed:"failed"===s.state,error:s.error})}}return n})(ef,function(e){let t=new Map,n=({x:e,y:t,w:n,h:r})=>({x:e,y:t,w:n,h:r});for(let r of e.stacks)for(let e of r.items)t.set(e.file.path,n(r));for(let r of e.decks)for(let e of r.rounds){let i=e.file?.path??e.round.reviewerPath;i&&t.set(i,n(r))}for(let r of e.nodes)for(let e of r.under)t.set(e.path,n(r));for(let r of e.nodes)t.set(r.file.path,n(r));return t}($)),[ef,$]),eh=(0,a.useCallback)((e,t)=>{ep({x:Math.round(e-130),y:Math.round(t-14)})},[]),{cam:eb,vp:eg,viewportRef:ew,handLike:ev,taskTool:ek,setTaskTool:ey,centerOn:ej,panning:eN,glide:eS,setMode:eC,onPointerDown:eA,onPointerMove:eT,onDoubleClick:eE,onClick:e$,zoomCenter:eM,zoomTo:eR,fit:ez,fitRect:eO,jump:eq}=function({project:e,layout:t,mapMode:n,focus:r,onNodePick:i,setSelected:s,onBackgroundDown:l,onWorldTap:o,taskRects:c,onPlaceTask:d}){let u=(0,a.useRef)(null),p=(0,a.useRef)(null),[f,m]=(0,a.useState)({x:0,y:0,z:.5}),[x,h]=(0,a.useState)("select"),[b,g]=(0,a.useState)(!1),[w,v]=(0,a.useState)(!1),[k,y]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[S,C]=(0,a.useState)({w:1,h:1}),A=(0,a.useRef)(null),T=(0,a.useRef)(new Map),E=(0,a.useRef)(null),$=(0,a.useRef)(x),D=(0,a.useRef)(w),M=(0,a.useRef)(b),R=(0,a.useRef)(d),P=(0,a.useRef)(null),I=(0,a.useRef)(null);(0,a.useEffect)(()=>{$.current=x},[x]),(0,a.useEffect)(()=>{D.current=w},[w]),(0,a.useEffect)(()=>{M.current=b},[b]),(0,a.useEffect)(()=>{R.current=d}),(0,a.useEffect)(()=>{let e=localStorage.getItem(sl);"hand"===e||"select"===e?h(e):window.matchMedia("(pointer: coarse)").matches&&h("hand")},[]);let L=(0,a.useCallback)(e=>{g(!1),h(e),localStorage.setItem(sl,e)},[]);(0,a.useEffect)(()=>{let e=u.current;if(!e)return;let t=new ResizeObserver(()=>{let t=e.getBoundingClientRect();C({w:Math.max(1,t.width),h:Math.max(1,t.height)})});return t.observe(e),()=>t.disconnect()},[]);let _=(0,a.useCallback)(e=>{let n=Math.min(Math.max(e.x,120-t.width*e.z),S.w-120),r=Math.min(Math.max(e.y,120-t.height*e.z),S.h-120);return n===e.x&&r===e.y?e:{...e,x:n,y:r}},[t.width,t.height,S]),z=(0,a.useRef)([]),O=(0,a.useRef)(null),q=(0,a.useCallback)(e=>{z.current.push(e),null==O.current&&(O.current=requestAnimationFrame(()=>{O.current=null;let e=z.current;z.current=[],m(t=>e.reduce((e,t)=>t(e),t))}))},[]);(0,a.useEffect)(()=>()=>{null!=O.current&&cancelAnimationFrame(O.current)},[]);let F=(0,a.useCallback)((e,t,n)=>{q(r=>{let i=Math.min(1.6,Math.max(.12,r.z*n));if(i===r.z)return r;let s=i/r.z;return _({z:i,x:e-(e-r.x)*s,y:t-(t-r.y)*s})})},[_,q]),U=(0,a.useCallback)(e=>{let t=u.current?.getBoundingClientRect();t&&F(t.width/2,t.height/2,e)},[F]),B=(0,a.useCallback)(e=>{let t=u.current?.getBoundingClientRect();t&&m(n=>{let r=Math.min(1.6,Math.max(.12,e));if(r===n.z)return n;let i=r/n.z,s=t.width/2,l=t.height/2;return _({z:r,x:s-(s-n.x)*i,y:l-(l-n.y)*i})})},[_]),H=(0,a.useCallback)(()=>{let e=u.current?.getBoundingClientRect();if(!e||!t.nodes.length&&!t.drafts.length)return null;let n=Math.min(1.6,Math.max(.12,Math.min((e.width-48)/t.width,(e.height-48)/t.height,1)));return{z:n,x:(e.width-t.width*n)/2,y:(e.height-t.height*n)/2}},[t]),W=(0,a.useCallback)(e=>{N(!0),m(e),P.current&&window.clearTimeout(P.current),P.current=window.setTimeout(()=>N(!1),500)},[]);(0,a.useEffect)(()=>()=>{P.current&&window.clearTimeout(P.current)},[]);let K=(0,a.useCallback)(()=>{let e=H();e&&W(e)},[H,W]),Y=(0,a.useCallback)(e=>{let t=u.current?.getBoundingClientRect();if(!t||e.w<=0||e.h<=0)return;let n=Math.min(1.6,Math.max(.12,Math.min((t.width-48)/e.w,(t.height-48)/e.h,1)));W(_({z:n,x:(t.width-e.w*n)/2-e.x*n,y:(t.height-e.h*n)/2-e.y*n}))},[W,_]),J=(0,a.useCallback)((e,t)=>{let n=u.current?.getBoundingClientRect();n&&W(r=>{let i=Math.min(1.6,Math.max(r.z,t));return{z:i,x:n.width/2-(e.x+e.w/2)*i,y:Math.min(n.height/2-e.y*i,.08*n.height-(e.y-40)*i)}})},[W]);(0,a.useEffect)(()=>{if(I.current===e||!t.nodes.length&&!t.drafts.length)return;if(I.current=e,!n)try{let t=sessionStorage.getItem("llvCam:"+e);if(t){let e=JSON.parse(t);if(Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z)&&e.z>=.12&&e.z<=1.6)return void m(e)}}catch{}let r=H();r&&m(r)},[e,t,H,n]),(0,a.useEffect)(()=>{if(n||I.current!==e)return;let t=window.setTimeout(()=>sessionStorage.setItem("llvCam:"+e,JSON.stringify(f)),300);return()=>window.clearTimeout(t)},[f,e,n]);let Q=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(!r){Q.current=null;return}if(Q.current===r)return;let e=t.byPath.get(r)??c?.get(r);e&&(Q.current=r,J(e,.55))},[r,t,c,J]),(0,a.useEffect)(()=>{let e=u.current;if(!e)return;let t=t=>{if(t.target.closest("[data-scheme-ui]"))return;let n=e.getBoundingClientRect();if(t.ctrlKey||t.metaKey){t.preventDefault(),F(t.clientX-n.left,t.clientY-n.top,Math.exp(-(.0022*t.deltaY)));return}if("select"===$.current&&!D.current){for(let n=t.target;n&&n!==e;n=n.parentElement)if(n.scrollHeight>n.clientHeight+1){let e=getComputedStyle(n).overflowY;if("auto"===e||"scroll"===e)return}}t.preventDefault();let r=t.shiftKey&&!t.deltaX?t.deltaY:t.deltaX,i=t.shiftKey&&!t.deltaX?0:t.deltaY;q(e=>_({...e,x:e.x-r,y:e.y-i}))};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[F,_,q]),(0,a.useEffect)(()=>{let e=e=>{var t;if(!((t=e.target)&&t.tagName&&(["INPUT","TEXTAREA","SELECT","BUTTON"].includes(t.tagName)||t.isContentEditable))){if(" "===e.key){e.preventDefault(),e.repeat||v(!0);return}if(!e.metaKey&&!e.ctrlKey&&!e.altKey){if("h"===e.key||"H"===e.key)L("hand");else if("v"===e.key||"V"===e.key)L("select");else if("t"===e.key||"T"===e.key)R.current&&g(!0);else if("Escape"===e.key)M.current?g(!1):s(null);else if("0"===e.key)K();else if("1"===e.key)B(1);else if("+"===e.key||"="===e.key)U(1.25);else if("-"===e.key)U(.8);else if(e.key.startsWith("Arrow")){e.preventDefault();let t="ArrowLeft"===e.key?160:"ArrowRight"===e.key?-160:0,n="ArrowUp"===e.key?160:"ArrowDown"===e.key?-160:0;m(e=>_({...e,x:e.x+t,y:e.y+n}))}}}},t=e=>{" "===e.key&&v(!1)};return window.addEventListener("keydown",e),window.addEventListener("keyup",t),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",t)}},[K,U,B,L,_,s]);let X=e=>{let t=u.current?.getBoundingClientRect();return t?{x:e.clientX-t.left,y:e.clientY-t.top}:{x:e.clientX,y:e.clientY}},G=e=>{A.current={sx:e.clientX,sy:e.clientY,cx:f.x,cy:f.y},y(!0);try{u.current?.setPointerCapture(e.pointerId)}catch{}};(0,a.useEffect)(()=>{let e=e=>{T.current.delete(e.pointerId),T.current.size<2&&(E.current=null),A.current=null,y(!1)};return window.addEventListener("pointerup",e),window.addEventListener("pointercancel",e),()=>{window.removeEventListener("pointerup",e),window.removeEventListener("pointercancel",e)}},[]);let V=n||"hand"===x||w,Z=(0,a.useCallback)((e,t)=>m(n=>_({...n,x:S.w/2-e*n.z,y:S.h/2-t*n.z})),[S,_]);return{cam:f,vp:S,viewportRef:u,mode:x,setMode:L,handLike:V,taskTool:b,setTaskTool:g,centerOn:J,panning:k,glide:j,onPointerDown:e=>{let t=e.target;if(!t.closest("[data-scheme-ui]")){if(n&&e.isPrimary&&(p.current={x:e.clientX,y:e.clientY}),"touch"===e.pointerType&&(T.current.set(e.pointerId,X(e)),2===T.current.size)){let[e,t]=[...T.current.values()];E.current={d:sa(e,t),cx:(e.x+t.x)/2,cy:(e.y+t.y)/2},A.current=null,y(!1);return}if(1===e.button){e.preventDefault(),G(e);return}if(0===e.button){if(b&&!n&&R.current){let t=u.current?.getBoundingClientRect();if(t){e.preventDefault(),R.current((e.clientX-t.left-f.x)/f.z,(e.clientY-t.top-f.y)/f.z),g(!1),L("select");return}}if(!(n||"hand"===x||w)){if(t.closest("[data-scheme-task]"))return;let n=t.closest("[data-scheme-node]");if(n)return void s(n.getAttribute("data-scheme-node"),e.shiftKey||e.ctrlKey||e.metaKey);o&&e.isPrimary&&(p.current={x:e.clientX,y:e.clientY});let r=l?.(e)??!1;if(r&&"touch"!==e.pointerType||!r&&(s(null),t.closest("button, a, input, textarea, select")))return}G(e)}}},onPointerMove:e=>{if("touch"===e.pointerType&&T.current.has(e.pointerId)){T.current.set(e.pointerId,X(e));let t=E.current;if(t&&T.current.size>=2){let[e,n]=[...T.current.values()],r=sa(e,n),i=(e.x+n.x)/2,s=(e.y+n.y)/2,l=t.d>0?r/t.d:1;q(e=>{let n=Math.min(1.6,Math.max(.12,e.z*l)),r=n/e.z;return _({z:n,x:i-(t.cx-e.x)*r,y:s-(t.cy-e.y)*r})}),E.current={d:r,cx:i,cy:s};return}}let t=A.current;if(!t)return;let n=e.clientX-t.sx,r=e.clientY-t.sy;q(e=>_({...e,x:t.cx+n,y:t.cy+r}))},onDoubleClick:e=>{let n=e.target;if(n.closest("[data-scheme-ui]"))return;let r=n.closest("[data-scheme-node]");if(!r)return void K();if("hand"!==x&&!w)return;let i=t.byPath.get(r.getAttribute("data-scheme-node")??"");i&&J(i,.9)},onClick:e=>{if(!i&&!o)return;let n=p.current;if(p.current=null,!n||Math.hypot(e.clientX-n.x,e.clientY-n.y)>9||e.target.closest("[data-scheme-ui]"))return;let r=u.current?.getBoundingClientRect();if(!r)return;let s=(e.clientX-r.left-f.x)/f.z,l=(e.clientY-r.top-f.y)/f.z;if(o?.(s,l)||!i)return;let a=((e,n)=>{let r=t=>e>=t.x&&e<=t.x+t.w&&n>=t.y&&n<=t.y+t.h;if(c){for(let[e,t]of c)if(r(t))return e}for(let e of t.nodes)if(r(e))return e.file.path;for(let e of t.drafts)if(r(e))return e.key;for(let e of t.stacks)if(r(e))return function(e,t){let n=Math.floor((t-e.y-8)/58);return e.items[Math.max(0,Math.min(n,e.items.length-1))]?.file??null}(e,n)?.path??null;for(let e of t.decks)if(r(e))return e.key;return null})(s,l);a&&i(a)},zoomCenter:U,zoomTo:B,fit:K,fitRect:Y,jump:Z}}({project:e,layout:$,mapMode:j,focus:c,onNodePick:m,setSelected:I,onBackgroundDown:j?void 0:e=>(el.current=!1,eo.current(e)),onWorldTap:j?void 0:ea,taskRects:em,onPlaceTask:j?void 0:eh}),{marquee:eF,onBackgroundDown:eU}=function({viewportRef:e,cam:t,layout:n,enabled:r,session:i,onCommit:s}){let[l,o]=(0,a.useState)(null),c=(0,a.useRef)(null),d=(0,a.useRef)(t),u=(0,a.useRef)(n),p=(0,a.useRef)(s);(0,a.useEffect)(()=>{d.current=t,u.current=n,p.current=s});let f=(0,a.useCallback)(t=>{let n=e.current?.getBoundingClientRect();return n?{x:t.clientX-n.left,y:t.clientY-n.top}:{x:t.clientX,y:t.clientY}},[e]);return(0,a.useEffect)(()=>{let e=e=>{var t,n,r,i,s;let l=c.current;if(!l)return;let a=f(e);if(!l.active&&4>Math.hypot(a.x-l.sx,a.y-l.sy))return;l.active=!0;let p=(t=l.sx,n=l.sy,{x:Math.min(t,r=a.x),y:Math.min(n,i=a.y),w:Math.abs(r-t),h:Math.abs(i-n)}),m=iD(u.current.nodes,(s=d.current,{x:(p.x-s.x)/s.z,y:(p.y-s.y)/s.z,w:p.w/s.z,h:p.h/s.z}));o({rect:p,candidates:m,additive:l.additive})},t=e=>{let t=c.current;c.current=null,t?.active&&o(t=>(e&&t&&p.current(t.candidates,t.additive),null))},n=()=>t(!0),r=()=>t(!1),i=e=>{"Escape"===e.key&&c.current?.active&&t(!1)};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",n),window.addEventListener("pointercancel",r),window.addEventListener("keydown",i),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",n),window.removeEventListener("pointercancel",r),window.removeEventListener("keydown",i)}},[f]),{marquee:l,onBackgroundDown:(0,a.useCallback)(e=>{if(!r)return!1;if("touch"===e.pointerType)return i;if(!e.isPrimary||0!==e.button)return!1;let t=f(e);return c.current={sx:t.x,sy:t.y,additive:e.shiftKey,active:!1},!0},[r,i,f])}}({viewportRef:ew,cam:eb,layout:$,enabled:!j,session:D,onCommit:(0,a.useCallback)((e,t)=>{el.current=!0,S(null),A(n=>{if(!t)return e.length?new Set(e):so;if(!e.length)return n;let r=new Set(n);for(let t of e)r.add(t);return r})},[])});(0,a.useEffect)(()=>{eo.current=eU},[eU]);let eB=(0,a.useMemo)(()=>$.nodes.filter(e=>C.has(e.file.path)),[$,C]),eH=(0,a.useMemo)(()=>(function(e,t){let n=1/0,r=1/0,i=-1/0,s=-1/0,l=!1;for(let a of e)t.has(a.file.path)&&(l=!0,n=Math.min(n,a.x),r=Math.min(r,a.y),i=Math.max(i,a.x+a.w),s=Math.max(s,a.y+a.h));return l?{x:n,y:r,w:i-n,h:s-r}:null})($.nodes,C),[$,C]),eW=(0,a.useRef)(eH);(0,a.useEffect)(()=>{eW.current=eH},[eH]);let eK=(0,a.useCallback)(()=>{eW.current&&eO(eW.current)},[eO]),eY=(0,a.useRef)(eb);(0,a.useEffect)(()=>{eY.current=eb},[eb]);let eJ=(0,a.useRef)(i),eQ=(0,a.useRef)(C),eX=(0,a.useRef)($);(0,a.useEffect)(()=>{eJ.current=i,eQ.current=C,eX.current=$});let eG=(0,a.useCallback)(async(e,t)=>{let n=await eL(e,t);if("error"in n)return void rV("err",n.error);let r=rZ(n,eJ.current);rV(r.kind,r.text)},[]),eZ=(0,a.useCallback)((e,t)=>void eG(e,[t]),[eG]),e0=(0,a.useMemo)(()=>({patch:async(e,t)=>{let n=await eP(e,t);return n&&rV("err",n),n},remove:e=>{ed(t=>t.some(t=>t.id===e)?t.filter(t=>t.id!==e):t),eI(e).then(e=>{e&&rV("err",e)})},send:(e,t)=>void eG(e.id,t),spawn:async(e,t)=>{let n=await e_(e.id,t);return"error"in n?n.error:(rV("ok",h(f(),"tasks.spawnOk",{target:n.target})),null)},center:e=>ej(e,.75),selectionPaths:()=>{let e=new Set(eX.current.nodes.map(e=>e.file.path)),t=[...eQ.current].filter(t=>e.has(t));if(t.length)return t;let n=P.current;return n&&e.has(n)?[n]:[]}}),[eG,ej]),e1=(0,a.useCallback)(t=>{eu&&eD({project:e,text:t,pos:eu}).then(e=>{"error"in e?rV("err",e.error):(ed(t=>[...t,e.task]),ep(null))})},[e,eu]),e5=(0,a.useCallback)(()=>ep(null),[]),[e2,e3]=(0,a.useState)(!1);(0,a.useEffect)(()=>{e3(e=>e?eb.z<.49500000000000005:eb.z<.4275)},[eb.z]);let e4=24*eb.z;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{ref:ew,className:`relative min-h-0 flex-1 overflow-hidden ${eN?"cursor-grabbing select-none":ek?"cursor-crosshair":ev?"cursor-grab":""} ${ev?"touch-none":""}`,onPointerDown:eA,onPointerMove:eT,onDoubleClick:eE,onClick:e$,children:[(0,r.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute",style:{inset:-e4,backgroundImage:"radial-gradient(rgba(28,28,34,0.09) 1px, transparent 1px)",backgroundSize:`${e4}px ${e4}px`,transform:`translate(${(eb.x%e4+e4)%e4}px, ${(eb.y%e4+e4)%e4}px)`,willChange:"transform"}}),(0,r.jsxs)("div",{className:`absolute left-0 top-0 ${eN?"scheme-panning":""}`,style:{width:$.width,height:$.height,transform:`translate(${eb.x}px, ${eb.y}px) scale(${eb.z})`,transformOrigin:"0 0",transition:eS?`transform .45s ${iB}`:void 0,willChange:"transform","--inv-z":String(1/eb.z),"--label-o":eb.z<.45?"1":"0"},children:[(0,r.jsx)(iW,{edges:$.edges,width:$.width,height:$.height}),(0,r.jsx)(iK,{loops:$.loops,width:$.width,height:$.height}),(0,r.jsx)(i3,{layout:$,project:e,files:i,interactive:!ev&&!D,lite:j,dormant:e2,selected:N,multi:C,session:D,focus:W,attentionPaths:u??null,flowsByImpl:L,deckFocus:U,onSelect:V,onClose:Z,onFocusRound:H,onDraftClose:ee,onDraftSpawned:et,onHandoff:k?en:void 0,onExpand:er}),(0,r.jsx)(i6,{edges:ex,width:$.width,height:$.height,onRetry:eZ}),(0,r.jsx)(ss,{tasks:ef,files:i,interactive:!ev&&!D,lite:j,camRef:eY,handlers:e0,pending:eu,onCreate:e1,onCreateCancel:e5}),D&&eH?(0,r.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute z-[6] rounded-[14px] border-2 border-dashed border-accent/60",style:{left:eH.x-14,top:eH.y-14,width:eH.w+28,height:eH.h+28},children:(0,r.jsx)("span",{className:"absolute -top-3 left-4 rounded-full border border-accent/50 bg-panel px-2 py-0.5 font-bold text-accent",style:{fontSize:"calc(11px * min(var(--inv-z, 1), 2.6))"},children:y("bulk.selectedCount",{count:C.size})})}):null]},e),eF?(0,r.jsxs)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 z-30",children:[(0,r.jsx)("div",{className:"absolute rounded-[4px] border border-accent/70 bg-accent/10",style:{left:eF.rect.x,top:eF.rect.y,width:eF.rect.w,height:eF.rect.h}}),eF.candidates.map(e=>{let t=$.byPath.get(e);return t?(0,r.jsx)("div",{className:"absolute rounded-[10px] border-2 border-accent/70",style:{left:t.x*eb.z+eb.x,top:t.y*eb.z+eb.y,width:t.w*eb.z,height:t.h*eb.z}},e):null})]}):null,(0,r.jsxs)("div",{"data-scheme-ui":!0,className:"absolute left-3 top-3 z-40 flex items-center gap-1 rounded-[10px] border border-line bg-panel/95 p-1 shadow-card",children:[j?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(sc,{active:ev&&!ek,title:y("scheme.handTool"),onClick:()=>eC("hand"),children:(0,r.jsx)(ic.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.jsx)(sc,{active:!ev&&!D&&!ek,title:y("scheme.selectTool"),onClick:()=>eC("select"),children:(0,r.jsx)(id.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.jsx)(sc,{active:D,title:y("scheme.lassoTool"),onClick:()=>{D?M():(eC("select"),E(!0))},children:(0,r.jsx)(iu.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.jsx)(sc,{active:ek,title:y("tasks.tool"),onClick:()=>ey(!ek),children:(0,r.jsx)(ip.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.jsx)("div",{className:"mx-0.5 h-5 w-px bg-line","aria-hidden":!0})]}),(0,r.jsx)(sc,{title:y("scheme.zoomOut"),onClick:()=>eM(.8),children:(0,r.jsx)(nF.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.jsxs)("button",{className:"min-w-[46px] rounded-[8px] px-1 text-center text-[11px] font-semibold text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:y("scheme.zoom100"),onClick:()=>eR(1),children:[Math.round(100*eb.z),"%"]}),(0,r.jsx)(sc,{title:y("scheme.zoomIn"),onClick:()=>eM(1.25),children:(0,r.jsx)(tC.A,{className:"h-4 w-4","aria-hidden":!0})}),(0,r.jsx)(sc,{title:y("scheme.fit"),onClick:ez,children:(0,r.jsx)(eV.A,{className:"h-4 w-4","aria-hidden":!0})})]}),D?(0,r.jsx)(iE,{project:e,nodes:eB,flowsByImpl:L,onRemove:Z,onFit:eK,onExit:M}):null,(0,r.jsx)(iM,{layout:$,tasks:ef,cam:eb,vp:eg,onJump:eq})]}),O?(0,r.jsx)("div",{className:"fixed inset-0 z-40 flex flex-col bg-bg p-3",role:"dialog","aria-modal":"true","aria-label":g(O.file.title,90),children:(0,r.jsx)(rE,{file:O.file,files:i,tasks:O.tasks,onSelect:ei,isRoot:O.isRoot,expanded:!0,onToggleExpand:()=>z(null)})}):null]})}let su={waiting:5,stalled:4,live:3,returned:2,done:1};function sp({project:e,groups:t,manual:n,files:i,flows:s,tasks:o,drafts:c,loaded:d,focus:u,onSelect:p,onClose:f,onDraftClose:m,onDraftSpawned:x,onHandoff:h}){let{t:g}=b(),[w,v]=(0,a.useState)(null),[k,y]=(0,a.useState)(!1),[j,N]=(0,a.useState)(null),S=(0,a.useRef)(null),C=(0,a.useRef)(null),A=(0,a.useMemo)(()=>io(t,n,i,s,c),[t,n,i,s,c]),T=(0,a.useMemo)(()=>[...A.nodes.map(e=>({key:e.file.path,file:e.file,isRoot:e.isRoot,kind:"node"})),...A.decks.map(e=>({key:e.key,file:null,isRoot:!1,kind:"deck"})),...A.drafts.map(e=>({key:e.key,file:null,isRoot:!0,kind:"draft"}))],[A]),E=(0,a.useMemo)(()=>new Map(T.map(e=>[e.key,e])),[T]);(0,a.useEffect)(()=>{v(sessionStorage.getItem("llvFocus:"+e)),y(!1)},[e]),(0,a.useEffect)(()=>{u&&(v(u),y(!1))},[u]);let $=(0,a.useMemo)(()=>{if(w&&E.has(w))return w;let e=null,t=-1;for(let n of T){if(!n.file)continue;let r=1e12*su[eh(n.file)]+n.file.mtime;r>t&&(t=r,e=n)}return(e??T[0])?.key??null},[w,E,T]);(0,a.useEffect)(()=>{w&&E.has(w)?sessionStorage.setItem("llvFocus:"+e,w):!w&&$&&sessionStorage.setItem("llvFocus:"+e,$)},[w,E,$,e]),(0,a.useEffect)(()=>{C.current?.scrollIntoView({block:"nearest",inline:"nearest"})},[$]);let D=(0,a.useMemo)(()=>A.nodes.find(e=>e.file.path===$)??null,[A,$]),M=(0,a.useMemo)(()=>A.decks.find(e=>e.key===$)??null,[A,$]),R=(0,a.useMemo)(()=>A.drafts.find(e=>e.key===$)??null,[A,$]),P=(0,a.useCallback)(e=>{if(!T.length)return;let t=T.findIndex(e=>e.key===$),n=T[Math.min(T.length-1,Math.max(0,(-1===t?0:t)+e))];n&&n.key!==$&&v(n.key)},[T,$]),I=(0,a.useCallback)(e=>{if(y(!1),e.startsWith("task::"))return void N({taskId:e.slice(6)});if(E.has(e))return void v(e);let t=i.find(t=>t.path===e);t&&p(t)},[E,i,p]);return(0,r.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[T.length>1?(0,r.jsx)("div",{className:"flex shrink-0 items-center gap-1.5 overflow-x-auto border-b border-line bg-panel px-2 py-1.5",children:T.map(e=>(0,r.jsx)(sf,{entry:e,active:e.key===$,chipRef:e.key===$?C:void 0,onClick:()=>v(e.key)},e.key))}):null,(0,r.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col p-1.5 pb-[max(0.375rem,env(safe-area-inset-bottom))]",children:[D?(0,r.jsxs)("div",{className:"relative flex min-h-0 flex-1",children:[(0,r.jsx)(rE,{file:D.file,tasks:D.tasks,files:i,onSelect:p,isRoot:D.isRoot,onClose:()=>f(D.file.path),dragHandle:{onTouchStart:e=>{let t=e.touches[0];t&&(S.current={x:t.clientX,y:t.clientY})},onTouchEnd:e=>{let t=S.current;S.current=null;let n=e.changedTouches[0];if(!t||!n)return;let r=n.clientX-t.x,i=n.clientY-t.y;56>Math.abs(r)||Math.abs(r)<2*Math.abs(i)||P(r<0?1:-1)}}}),h&&il(D.file)?(0,r.jsx)(ia,{file:D.file,onHandoff:()=>h(D.file)}):null]},D.file.path):M?(0,r.jsx)("div",{className:"relative min-h-0 flex-1",children:(0,r.jsx)(ii,{flow:M.flow,rounds:M.rounds,files:i,onSelect:p,focusRound:null})},M.key):R?eO(R.id)?(0,r.jsx)(rF,{draftId:R.id,project:e,onClose:()=>m(R.id),onLaunched:()=>m(R.id)},R.key):(0,r.jsx)(r_,{draftId:R.id,project:e,files:i,onClose:()=>m(R.id),onSpawned:e=>x(R.id,e)},R.key):d?(0,r.jsx)("div",{className:"flex flex-1 items-center justify-center text-center text-[13px] text-dim",children:g("mobile.noConvos")}):(0,r.jsxs)("div",{className:"flex flex-1 items-center justify-center gap-2 text-center text-[13px] text-dim",children:[(0,r.jsx)(tk.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),g("common.loading")]}),(0,r.jsx)(sm,{layout:A,tasks:o,current:$,onOpen:()=>y(!0)}),(0,r.jsxs)("button",{type:"button",className:"absolute bottom-[168px] right-4 z-30 inline-flex h-9 items-center gap-1 rounded-full border border-line bg-panel/95 px-2.5 text-[11px] font-bold text-ink shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":g("tasks.panelToggleAria"),onClick:()=>N("list"),children:[(0,r.jsx)(eX.A,{className:"h-4 w-4 text-accent","aria-hidden":!0}),o.filter(e=>"done"!==e.status).length||null]})]}),k?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-bg pb-[env(safe-area-inset-bottom)]",children:[(0,r.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line bg-panel px-3",children:[(0,r.jsx)("span",{className:"shrink-0 text-[13px] font-bold",children:g("mobile.map")}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] text-dim",children:e}),(0,r.jsx)("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":g("mobile.closeMap"),onClick:()=>y(!1),children:(0,r.jsx)(l.A,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,r.jsx)(sd,{project:e,groups:t,manual:n,files:i,flows:s,tasks:o,drafts:c,focus:null,ring:$,onSelect:p,onClose:f,onDraftClose:m,onDraftSpawned:x,onNodePick:I}),(0,r.jsx)("div",{className:"shrink-0 border-t border-line bg-panel px-3 py-1.5 text-center text-[11px] text-dim",children:g("mobile.tapNode")})]}):null,j?(0,r.jsx)(r8,{project:e,tasks:o,files:i,initialView:j,onClose:()=>N(null)}):null]})}function sf({entry:e,active:t,chipRef:n,onClick:i}){let{t:s}=b();if(!e.file){let l="deck"===e.kind;return(0,r.jsxs)("button",{ref:n,type:"button",className:`flex h-7 shrink-0 items-center gap-1 rounded-full border px-2.5 text-[11px] font-semibold ${t?"border-accent/60 bg-accent/10 text-ink":"border-dashed border-line bg-bg text-dim"}`,onClick:i,children:[(0,r.jsx)("span",{className:"text-[13px] leading-none text-accent",children:l?"R":"+"})," ",s(l?"scheme.flow":"mobile.agent")]})}let l=e.file,a=eh(l),o="waiting"===a||"stalled"===a,c=ed(l),d=g(l.title,60);return(0,r.jsxs)("button",{ref:n,type:"button",className:`flex h-7 shrink-0 items-center gap-1.5 rounded-full border px-2.5 text-[11px] font-semibold ${t?"border-accent/60 bg-accent/10 text-ink":o?"border-[#e0ae45]/60 bg-[#fff7e6] text-[#8a5a00]":"border-line bg-bg text-dim"}`,title:d,onClick:i,children:[(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${V(l.activity)}`}),e.isRoot?null:(0,r.jsx)("span",{"aria-hidden":!0,children:"⤷"}),t?(0,r.jsx)("span",{className:"max-w-[52vw] truncate",children:d}):(0,r.jsxs)("span",{children:[o?"⏸ ":"",c.label]})]})}function sm({layout:e,tasks:t,current:n,onOpen:i}){let{t:s}=b(),l=Math.min(96/e.width,64/e.height),a=(96-e.width*l)/2,o=(64-e.height*l)/2;return(0,r.jsx)("button",{type:"button",className:"absolute bottom-[92px] right-4 z-30 overflow-hidden rounded-[10px] border border-line bg-panel/95 shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{width:96,height:64},"aria-label":s("mobile.openMap"),onClick:i,children:(0,r.jsx)("svg",{width:96,height:64,"aria-hidden":!0,children:(0,r.jsxs)("g",{transform:`translate(${a} ${o}) scale(${l})`,children:[e.stacks.map(e=>(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:24,fill:"#c9c9d1",opacity:.45},e.key)),e.drafts.map(e=>(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:24,fill:"#9a9aa4",opacity:.3,stroke:e.key===n?"#5a51e0":void 0,strokeWidth:e.key===n?5/l:void 0},e.key)),e.decks.map(e=>(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:24,fill:"#5a51e0",opacity:.35,stroke:e.key===n?"#5a51e0":void 0,strokeWidth:e.key===n?5/l:void 0},e.key)),e.nodes.map(e=>(0,r.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:24,fill:eo(e.file),opacity:"live"===e.file.activity?.85:.35,stroke:e.file.path===n?"#5a51e0":void 0,strokeWidth:e.file.path===n?5/l:void 0},e.file.path)),t.map(e=>(0,r.jsx)("circle",{cx:e.pos.x+130,cy:e.pos.y+iy(e)/2,r:3/l,fill:rW[e.status].color,opacity:"done"===e.status?.5:.95},e.id))]})})})}let sx="llvArchived";function sh(e){try{window.localStorage.setItem(sx,JSON.stringify([...e]))}catch{}}function sb({data:e,onOpen:t}){let{t:n}=b(),i=e.waiting.length,s=(0,a.useRef)(i),[l,o]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{if(i>s.current){o(!0);let e=window.setTimeout(()=>o(!1),900);return s.current=i,()=>window.clearTimeout(e)}s.current=i},[i]),(0,r.jsxs)("div",{className:"group absolute bottom-3 right-3 z-20",children:[e.livePreview.length?(0,r.jsx)("div",{className:"pointer-events-none mb-1.5 hidden w-[300px] rounded-[8px] border border-line bg-panel/95 px-3 py-2 shadow-card backdrop-blur group-focus-within:block group-hover:block",children:e.livePreview.map(e=>(0,r.jsxs)("div",{className:"flex min-w-0 gap-1.5 py-0.5 text-[10.5px]",children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate font-semibold",children:e.title}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-dim",children:e.statusLine||n("status.working")})]},e.file.path))}):null,(0,r.jsxs)("button",{className:`ml-auto flex items-center gap-1.5 rounded-full border border-line bg-panel/95 px-2.5 py-1 text-[11.5px] font-bold shadow-card backdrop-blur transition-transform hover:border-accent/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 ${l?"scale-110 border-[#e0ae45]/70":""} motion-reduce:transition-none`,"aria-label":n("corner.openSwitchboard"),onClick:t,children:[(0,r.jsx)("span",{className:`h-2 w-2 rounded-full ${e.working.length?"animate-pulse bg-ok":"bg-dim"}`}),(0,r.jsx)("span",{children:e.working.length}),(0,r.jsx)("span",{className:i?"text-[#b8860b]":"text-dim",children:n("corner.waitingCount",{count:i})})]})]})}function sg({file:e,title:t,project:n,currentProject:i,descendants:s,statusLine:a,size:o,tone:c,onOpen:d,onArchive:u}){let{t:p}=b(),f=ed(e),m="large"===o;return(0,r.jsxs)("article",{className:`group relative flex ${m?"h-[150px] w-[300px]":"h-[108px] w-[220px]"} shrink-0 flex-col rounded-[8px] border p-3 shadow-card transition-colors hover:border-accent/45 ${"working"===c?"border-ok/40 bg-[#f3fbf5] shadow-[0_0_0_3px_rgba(26,138,62,0.12)]":"stalled"===c?"border-err/35 bg-[#fff5f5]":"waiting"===c?"border-[#e0ae45]/45 bg-[#fff9ed]":"border-line bg-panel"}`,role:"button",tabIndex:0,"aria-label":p("switchCard.openColumn",{title:g(t,80)}),onClick:()=>d(e),onKeyDown:t=>{"Enter"===t.key&&d(e)},children:["live"===e.activity?null:(0,r.jsx)("button",{type:"button",className:"absolute right-1.5 top-1.5 z-10 hidden h-5 w-5 items-center justify-center rounded-full border border-line bg-bg text-dim hover:border-err/50 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 group-hover:flex group-focus-within:flex","aria-label":p("switchCard.remove"),onClick:t=>{t.stopPropagation(),u(e)},onKeyDown:e=>e.stopPropagation(),children:(0,r.jsx)(l.A,{className:"h-3 w-3","aria-hidden":!0})}),(0,r.jsxs)("div",{className:"relative flex min-w-0 items-center gap-1.5",children:[(0,r.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${V(e.activity)}`}),e.model?(0,r.jsx)("span",{className:"min-w-0 truncate rounded-full px-1.5 py-0.5 font-mono text-[9px] font-semibold",style:{backgroundColor:el(e).soft,color:el(e).color},title:[f.label,ea(e)].filter(Boolean).join(" \xb7 "),children:e.model}):(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:f.style,children:f.label}),(0,r.jsx)("span",{className:`ml-auto min-w-0 truncate rounded-full border border-line bg-bg px-1.5 py-0.5 text-[9.5px] font-semibold ${n===i?"text-dim":"text-ink"}`,title:n,children:n})]}),(0,r.jsx)("div",{className:`relative mt-2 min-w-0 ${m?"text-[14px]":"text-[12.5px]"} font-bold leading-snug`,title:t,children:(0,r.jsx)("span",{className:"line-clamp-2",children:t})}),(0,r.jsxs)("div",{className:"relative mt-auto flex min-w-0 items-center gap-2 text-[10.5px] font-semibold text-dim",children:[(0,r.jsx)("span",{className:"shrink-0",children:X(e.mtime)}),e.ctx?(0,r.jsx)(rj,{ctx:e.ctx}):null,s?(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5",children:[(0,r.jsx)(e0.A,{className:"h-3 w-3","aria-hidden":!0})," ",s]}):null]}),a?(0,r.jsx)("div",{className:`relative mt-1 min-w-0 truncate ${m?"text-[11.5px]":"text-[10.5px]"} font-semibold text-ink/75`,children:a}):null,e.pid&&"running"===e.proc?(0,r.jsx)("div",{className:"relative mt-2",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:(0,r.jsx)(rd,{file:e,compact:!0})}):null]})}function sw({title:e,items:t,size:n,currentProject:i,onOpenFile:s,onArchive:l}){return t.length?(0,r.jsxs)("section",{className:"shrink-0",children:[(0,r.jsxs)("div",{className:"mb-2 flex items-baseline gap-2",children:[(0,r.jsx)("h2",{className:"text-[13px] font-bold",children:e}),(0,r.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:t.length})]}),(0,r.jsx)(t3,{className:"flex flex-wrap gap-2.5",enter:"fade",children:t.map(e=>(0,r.jsx)("div",{"data-flip-key":e.file.path,children:(0,r.jsx)(sg,{file:e.file,title:e.title,project:e.project,currentProject:i,descendants:e.descendants,statusLine:e.statusLine,size:n,tone:"working"===e.kind?"working":"waiting"===e.kind&&"stalled"===e.file.activity?"stalled":"waiting"===e.kind?"waiting":"quiet",onOpen:s,onArchive:l})},e.file.path))})]}):null}function sv({files:e,flows:t,project:n,loaded:i,onOpenFile:s}){let{t:o}=b(),[c,d]=(0,a.useState)(!1),[u,p]=(0,a.useState)(""),[f,m]=(0,a.useState)(!1),[x,h]=(0,a.useState)(!1),[w,v]=(0,a.useState)(0),k=(0,a.useRef)(null),y=function(e,t){let[n,r]=(0,a.useState)([]),[i,s]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{if(!t||!e)return;let n=!0;s(!0);let i=async()=>{try{let t=await fetch(`/api/timeline?project=${encodeURIComponent(e)}`),i=await t.json();n&&Array.isArray(i.events)&&r(i.events)}catch{}finally{n&&s(!1)}};i();let l=setInterval(i,7e3);return()=>{n=!1,clearInterval(l)}},[e,t]),{events:n,loading:i}}(n,c),{archivedPaths:j,archive:N,unarchive:S}=function(e){let[t,n]=(0,a.useState)(()=>new Set),r=(0,a.useRef)(t);return(0,a.useEffect)(()=>{let e=function(){try{let e=window.localStorage.getItem(sx),t=e?JSON.parse(e):[];return new Set(Array.isArray(t)?t.filter(e=>"string"==typeof e):[])}catch{return new Set}}();r.current=e,n(e)},[]),(0,a.useEffect)(()=>{let t=r.current;if(!t.size)return;let i=new Set(t);for(let t of e)"live"===t.activity&&i.delete(t.path);i.size!==t.size&&(r.current=i,n(i),sh(i))},[e]),{archivedPaths:t,archive:(0,a.useCallback)(e=>{n(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),r.current=n,sh(n),n})},[]),unarchive:(0,a.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),r.current=n,sh(n),n})},[])}}(e),A=ef(e,y.events,u,w,j,t),T=ef(e,[],"",w,j,t),E=(0,a.useMemo)(()=>e.filter(e=>j.has(e.path)).map(e=>({file:e,title:g(e.title),project:C(e)})).sort((e,t)=>t.file.mtime-e.file.mtime),[e,j]);(0,a.useEffect)(()=>{let e=()=>v(Date.now()/1e3);e();let t=window.setInterval(e,3e4);return()=>window.clearInterval(t)},[]),(0,a.useEffect)(()=>{if(!c)return;let e=e=>{"Escape"===e.key&&d(!1)};return window.addEventListener("keydown",e),window.setTimeout(()=>k.current?.focus(),0),()=>window.removeEventListener("keydown",e)},[c]);let $=e=>{s(e),d(!1)},D=e=>N(e.path);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(sb,{data:T,onOpen:()=>d(!0)}),c?(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/28 p-[2.5vh]",onMouseDown:()=>d(!1),children:(0,r.jsxs)("div",{className:"flex h-[95vh] w-[95vw] flex-col overflow-hidden rounded-[8px] border border-line bg-bg shadow-[0_18px_70px_rgb(20_20_30/0.28)]",role:"dialog","aria-modal":"true","aria-label":o("switch.aria"),onMouseDown:e=>e.stopPropagation(),children:[(0,r.jsxs)("header",{className:"flex h-14 shrink-0 items-center gap-3 border-b border-line bg-panel px-4",children:[(0,r.jsx)("div",{className:"text-[15px] font-bold",children:o("switch.title")}),(0,r.jsx)("input",{ref:k,value:u,onChange:e=>p(e.target.value),placeholder:o("switch.search"),className:"h-9 min-w-0 flex-1 rounded-[8px] border border-line bg-bg px-3 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),y.loading?(0,r.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:o("switch.updating")}):null,(0,r.jsx)("button",{className:"inline-flex h-8 w-8 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":o("switch.close"),onClick:()=>d(!1),children:(0,r.jsx)(l.A,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,r.jsxs)("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto px-4 py-4",children:[(0,r.jsx)(sw,{title:o("switch.waiting"),items:A.waiting,size:"large",currentProject:n,onOpenFile:$,onArchive:D}),(0,r.jsx)(sw,{title:o("switch.working"),items:A.working,size:"large",currentProject:n,onOpenFile:$,onArchive:D}),(0,r.jsx)(sw,{title:o("switch.recent"),items:A.recent,size:"small",currentProject:n,onOpenFile:$,onArchive:D}),(0,r.jsxs)("section",{className:"shrink-0",children:[(0,r.jsxs)("button",{className:"flex h-10 w-full items-center justify-between rounded-[8px] border border-line bg-panel px-3 text-left text-[12.5px] font-bold hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":f,onClick:()=>m(e=>!e),children:[(0,r.jsx)("span",{children:o("switch.older")}),(0,r.jsx)("span",{className:"text-dim",children:A.older.length})]}),f?(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(sw,{title:"",items:A.older,size:"small",currentProject:n,onOpenFile:$,onArchive:D})}):null]}),A.waiting.length||A.working.length||A.recent.length||A.older.length?null:i?(0,r.jsx)("div",{className:"pt-[18vh] text-center text-[13px] font-semibold text-dim",children:o("common.nothingFound")}):(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 pt-[18vh] text-[13px] font-semibold text-dim",children:[(0,r.jsx)(tk.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),o("common.loading")]}),E.length?(0,r.jsxs)("section",{className:"shrink-0",children:[(0,r.jsxs)("button",{className:"flex h-9 w-full items-center justify-between rounded-[8px] border border-line bg-panel px-3 text-left text-[12px] font-bold text-dim hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":x,onClick:()=>h(e=>!e),children:[(0,r.jsx)("span",{children:o("switch.hidden",{count:E.length})}),(0,r.jsx)("span",{children:x?o("switch.hide"):o("common.show")})]}),x?(0,r.jsx)("div",{className:"mt-2 space-y-1",children:E.map(e=>(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-[8px] border border-line bg-panel/60 px-3 py-1.5 text-[11.5px] text-dim",children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.title}),(0,r.jsx)("span",{className:"shrink-0 truncate text-[10.5px]",children:e.project}),(0,r.jsx)("button",{className:"shrink-0 rounded-full border border-line bg-bg px-2 py-0.5 text-[10.5px] font-semibold text-ink hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>S(e.file.path),children:o("switch.restore")})]},e.file.path))}):null]}):null]})]})}):null]})}function sk(){location.hash="#p="+encodeURIComponent(w)}function sy({files:e,onOpen:t}){let{t:n}=b();return(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-5",children:(0,r.jsxs)("div",{className:"mx-auto w-full max-w-[760px]",children:[(0,r.jsx)("div",{className:"text-[13.5px] font-semibold text-dim",children:n("trash.title")}),(0,r.jsx)("div",{className:"mb-3 mt-0.5 text-[12px] text-dim",children:n("trash.hint")}),(0,r.jsx)("div",{className:"space-y-1.5",children:e.map(e=>(0,r.jsx)(sj,{file:e,onOpen:t},e.path))})]})})}function sj({file:e,onOpen:t}){let{t:n}=b(),[i,s]=(0,a.useState)(!1),l=ed(e);return i?(0,r.jsxs)("div",{className:"flex items-center gap-2 rounded-[8px] border border-line bg-chip/60 px-3 py-1.5 text-[11.5px] font-semibold text-dim",children:[(0,r.jsx)(tf.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"min-w-0 truncate",children:g(e.title,80)}),(0,r.jsx)("span",{className:"shrink-0",children:n("trash.deletedFromDisk")})]}):(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-[8px] border border-line bg-panel px-3 py-1.5 shadow-card",children:[(0,r.jsxs)("button",{type:"button",className:"flex h-full min-w-0 flex-1 items-center gap-2 rounded-[6px] text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":n("trash.open",{title:g(e.title,60)}),onClick:()=>t(e),children:[(0,r.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${V(e.activity)}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:l.style,children:l.label}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold",title:e.path,children:g(e.title,90)}),(0,r.jsx)("span",{className:"shrink-0 text-[10.5px] font-semibold text-dim",children:X(e.mtime)}),(0,r.jsxs)("span",{className:"shrink-0 text-[10.5px] text-dim",children:[(e.size/1024).toFixed(0)," ",n("common.kb")]})]}),(0,r.jsx)(t2,{file:e,onDeleted:()=>s(!0)})]})}function sN({files:e,onArchive:t,compact:n=!1}){let{t:i}=b();return!e.length||e.some(e=>"running"===e.proc||"live"===e.activity)?null:(0,r.jsxs)("button",{type:"button",className:`inline-flex shrink-0 items-center gap-1 rounded-full border border-line bg-bg text-[11px] font-semibold text-dim hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${n?"p-1":"px-2 py-0.5"}`,"aria-label":i("trash.toArchive"),title:i("trash.toArchive"),onClick:()=>{t(),sk()},children:[(0,r.jsx)(e1.A,{className:"h-3 w-3","aria-hidden":!0})," ",n?null:i("trash.toArchive")]})}function sS({files:e}){let{t}=b(),[n,i]=(0,a.useState)(!1),[s,l]=(0,a.useState)(!1),[o,c]=(0,a.useState)("");if((0,a.useEffect)(()=>{if(!n)return;let e=window.setTimeout(()=>i(!1),6e3);return()=>window.clearTimeout(e)},[n]),!e.length||e.some(e=>"running"===e.proc||"live"===e.activity))return null;let d=async()=>{l(!0),c("");let n=0;for(let t of e)try{let e=await fetch(`/api/log?path=${encodeURIComponent(t.path)}`,{method:"DELETE"}),r=await e.json();e.ok&&r.ok||(n+=1)}catch{n+=1}(l(!1),i(!1),n)?c(t("trash.notDeleted",{failed:n,total:e.length})):sk()};return n?(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5 text-[11px]",children:[(0,r.jsx)("span",{className:"px-0.5 font-semibold text-err",children:t("trash.confirmDelete",{count:e.length})}),(0,r.jsx)("button",{type:"button",className:"rounded-lg bg-err px-2 py-0.5 font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:s,onClick:d,children:s?t("trash.deleting"):t("trash.confirmYes")}),(0,r.jsx)("button",{type:"button",className:"rounded-lg border border-line bg-panel px-2 py-0.5 font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>i(!1),children:t("common.cancel")})]}):(0,r.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1.5",children:[(0,r.jsx)("button",{type:"button",className:"inline-flex items-center rounded-full border border-line bg-bg p-1 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":t("trash.deleteProject"),title:t("trash.deleteProject"),onClick:()=>i(!0),children:(0,r.jsx)(tf.A,{className:"h-3 w-3","aria-hidden":!0})}),o?(0,r.jsx)("span",{className:"max-w-[180px] truncate text-[10.5px] font-semibold text-err",children:o}):null]})}var sC=n(4614),sA=n(8980);function sT(){let{t:e}=b(),[t,n]=(0,a.useState)(!0);return(0,a.useEffect)(()=>n(eg()),[]),(0,r.jsx)("button",{className:"ml-auto inline-flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full border border-line bg-panel text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:e(t?"sound.on":"sound.off"),"aria-label":e(t?"sound.mute":"sound.unmute"),"aria-pressed":t,onClick:()=>{let e=!t;n(e);try{localStorage.setItem(eb,e?"on":"off")}catch{}e&&eN("returned",0)},children:t?(0,r.jsx)(sC.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,r.jsx)(sA.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}function sE({items:e,onSelect:t}){let{t:n}=b(),[i,s]=(0,a.useState)(!1);return(0,r.jsxs)("div",{className:"shrink-0 border-t border-line bg-panel",children:[(0,r.jsxs)("button",{className:"flex h-8 items-center gap-2 px-4 text-[10px] font-bold uppercase tracking-[.6px] text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":i,onClick:()=>s(e=>!e),children:[(0,r.jsx)(e7.A,{className:`h-3.5 w-3.5 transition-transform ${i?"rotate-90":""}`,"aria-hidden":!0}),n("tree.quiet"),(0,r.jsx)("span",{className:"font-semibold normal-case tracking-normal",children:e.length})]}),i?(0,r.jsx)(t3,{className:"flex max-h-44 flex-wrap items-start gap-1.5 overflow-y-auto px-3 pb-2.5",children:e.map(e=>{let n=ed(e),i=g(e.cmdDesc||e.title,70);return(0,r.jsxs)("button",{"data-flip-key":e.path,className:"inline-flex h-7 max-w-[360px] items-center gap-1.5 rounded-full border border-line bg-bg px-2 text-[11px] font-semibold text-ink hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:g(e.title),onClick:()=>t(e),children:[(0,r.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${V(e.activity)}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px]",style:n.style,children:n.label}),(0,r.jsx)("span",{className:"truncate",children:i}),(0,r.jsx)("span",{className:"shrink-0 font-normal text-dim",children:X(e.mtime)})]},e.path)})}):null]})}let s$=e=>`llvCols:${e}`,sD=e=>`llvDrafts:${e}`;function sM(e){try{let t=JSON.parse(localStorage.getItem(s$(e))??"{}");return{manual:t.manual??[],hidden:t.hidden??[]}}catch{return{manual:[],hidden:[]}}}function sR(e,t){let n=sM(e);n.manual.includes(t)||n.manual.push(t),n.hidden=n.hidden.filter(e=>e!==t),localStorage.setItem(s$(e),JSON.stringify(n))}function sP(e){location.hash="#p="+encodeURIComponent(e)}function sI({files:e,flows:t,workflows:n,tasks:i,project:s,loaded:l,openNonce:o,focusRequest:c,attentionPaths:d,archived:u,onArchive:p,onUnarchive:f,onMenu:m,attention:x}){let{t:h}=b(),g=eK(),w=(0,a.useRef)(null),v=(0,a.useRef)(null),[j,N]=(0,a.useState)({manual:[],hidden:[]}),[S,A]=(0,a.useState)([]),[T,D]=(0,a.useState)(null),[R,P]=(0,a.useState)(!1),[I,L]=(0,a.useState)([]),_=(0,a.useRef)(j);(0,a.useEffect)(()=>{let e=sM(s);_.current=e,N(e),A(function(e){try{let t=JSON.parse(sessionStorage.getItem(sD(e))??"[]");return Array.isArray(t)?t.filter(e=>"string"==typeof e):[]}catch{return[]}}(s))},[s,o]),(0,a.useEffect)(()=>{P("1"===localStorage.getItem("llvTaskPanel"))},[]);let z=()=>{P(e=>(localStorage.setItem("llvTaskPanel",e?"0":"1"),!e))};(0,a.useEffect)(()=>()=>{w.current&&window.clearTimeout(w.current)},[]);let O=e=>{_.current=e,N(e),localStorage.setItem(s$(s),JSON.stringify(e))},q=(0,a.useMemo)(()=>{let n=F(t);return n.size?e.filter(e=>!n.has(e.path)):e},[e,t]),U=(0,a.useMemo)(()=>{let t;return t=new Set(e.filter(e=>e.project===s).map(e=>e.path)),n.filter(e=>"closed"!==e.state&&(!!(e.project===s||e.stageRuns.some(e=>e.agentPath&&t.has(e.agentPath)))||!!(e.fixerPath&&t.has(e.fixerPath))))},[n,s,e]),B=(0,a.useMemo)(()=>M(q,s),[q,s]),H=(0,a.useMemo)(()=>new Set(B.map(e=>e.key)),[B]),W=(0,a.useMemo)(()=>(function(e,t,n){let r=E(e),i=[];for(let s of e){if(C(s)!==t||!y(s)||n.has(s.path))continue;let e=$(s,r);if(!e.length)continue;let l=s.mtime,a=k(s);for(let t of e)l=Math.max(l,t.mtime),a=Math.min(a,k(t));i.push({root:s,branchCount:e.length,smt:l,band:a})}return i.sort((e,t)=>e.band-t.band||t.smt-e.smt)})(q,s,H),[q,s,H]),K=(0,a.useMemo)(()=>{let e;return e=E(q),q.filter(t=>!(C(t)!==s||t.parent||H.has(t.path)||e.get(t.path)?.length)&&"live"!==t.activity).sort((e,t)=>k(e)-k(t)||t.mtime-e.mtime)},[q,s,H]),Y=(0,a.useMemo)(()=>new Set(B.flatMap(e=>e.columns.map(e=>e.file.path))),[B]),J=(0,a.useMemo)(()=>new Set(j.hidden),[j.hidden]),Q=(0,a.useMemo)(()=>i.filter(e=>e.project===s),[i,s]),X=(0,a.useMemo)(()=>{let e=new Map(q.map(e=>[e.path,e]));return j.manual.map(t=>e.get(t)).filter(e=>void 0!==e&&C(e)===s&&!Y.has(e.path)&&!J.has(e.path))},[j.manual,q,s,Y,J]),G=(0,a.useMemo)(()=>{let e=new Map(q.map(e=>[e.path,e])),t=new Set(X.map(e=>e.path)),n=I.map(t=>e.get(t)).filter(e=>void 0!==e&&C(e)===s&&!t.has(e.path)&&(!Y.has(e.path)||J.has(e.path)));return n.length?[...X,...n]:X},[I,q,s,Y,J,X]),V=(0,a.useMemo)(()=>B.reduce((e,t)=>e+t.columns.reduce((e,t)=>e+ +("live"===t.file.activity)+t.tasks.filter(e=>"live"===e.activity).length,0),0),[B]),Z=B.filter(e=>!e.orphanTask).length,ee=e=>{D(e),w.current&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>D(null),1800)};(0,a.useEffect)(()=>{L([])},[s]),(0,a.useEffect)(()=>{c&&(v.current=c.path,L(e=>e.includes(c.path)?e:[...e,c.path]))},[c]),(0,a.useEffect)(()=>{let e=v.current;e&&(v.current=null,ee(e))}),(0,a.useEffect)(()=>{let e=sessionStorage.getItem("llvTaskFocus");e&&Q.some(t=>t.id===e)&&(sessionStorage.removeItem("llvTaskFocus"),ee("task::"+e))});let et=e=>{A(e),sessionStorage.setItem(sD(s),JSON.stringify(e))},en=()=>"function"==typeof crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10),er=()=>{let e=en();et([...S,e]),v.current="draft::"+e},ei=e=>{let t=S.find(t=>rI(t,"src")===e.path);if(t)return void ee("draft::"+t);let n=en();rL(n,"src",e.path),et([...S,n]),v.current="draft::"+n},es=e=>{if(eO(e))for(let t of["template","dir","task","mode"])sessionStorage.removeItem(rz(e,t));else for(let t of["engine","cwd","text","boot","src","effort","speed"])sessionStorage.removeItem(rP(e,t));et(S.filter(t=>t!==e))},el=(e,t)=>{es(e),eo(t)},ea=e=>{fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill",path:e})}).catch(()=>{}),O({manual:j.manual.filter(t=>t!==e),hidden:Y.has(e)?[...new Set([...j.hidden,e])]:j.hidden}),L(t=>t.includes(e)?t.filter(t=>t!==e):t)};(0,a.useEffect)(()=>{let e=_.current,t=[...Y].filter(t=>!e.manual.includes(t)&&!e.hidden.includes(t));if(!t.length)return;let n={...e,manual:[...e.manual,...t].slice(-40)};_.current=n,N(n),localStorage.setItem(s$(s),JSON.stringify(n))},[Y,s]);let eo=e=>{let t=C(e);if(t!==s){sR(t,e.path),sP(t);return}if(Y.has(e.path)&&!J.has(e.path)||X.some(t=>t.path===e.path))return void ee(e.path);let n=j.hidden.filter(t=>t!==e.path);O({manual:Y.has(e.path)?j.manual:[...new Set([...j.manual,e.path])],hidden:n}),v.current=e.path},ec=[];V?ec.push(`${h("dash.branchesLive",{count:V})} \xb7 ${h("dash.trees",{count:Z})}`):Z&&ec.push(h("dash.recentConvos",{count:Z})),W.length&&ec.push(h("dash.quietTrees",{count:W.length}));let ed=B.map(e=>({...e,columns:e.columns.filter(e=>!J.has(e.file.path))})).filter(e=>e.columns.length),eu=ed.filter(e=>e.orphanTask).map(e=>e.columns[0].file),ep=ed.filter(e=>!e.orphanTask),ef=ep.length>0||G.length>0||S.length>0||Q.length>0,em=(0,a.useMemo)(()=>e.filter(e=>C(e)===s).sort((e,t)=>t.mtime-e.mtime),[e,s]);return(0,r.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,r.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2.5 border-b border-line bg-panel px-4",children:[m?(0,r.jsx)("button",{type:"button",className:"-ml-1.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":h("dash.openProjects"),onClick:m,children:(0,r.jsx)(eY.A,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,r.jsx)("h1",{className:"truncate text-[13.5px] font-bold",children:s}),g?null:(0,r.jsx)("span",{className:"truncate text-[11.5px] text-dim",children:ec.length?ec.join(" \xb7 "):h("common.nothingRunning")}),(0,r.jsx)(sT,{}),u?(0,r.jsxs)("button",{type:"button",className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-line bg-bg px-2 py-0.5 text-[11px] font-semibold text-dim hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>f(s),children:[(0,r.jsx)(e5.A,{className:"h-3 w-3","aria-hidden":!0})," ",h("dash.unarchive")]}):(0,r.jsx)(sN,{files:em,onArchive:()=>p(s),compact:g}),(0,r.jsx)(sS,{files:em}),g?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"ml-auto","aria-hidden":!0}),x,(0,r.jsxs)("button",{type:"button",onClick:er,"aria-label":h("dash.newConvo"),className:"flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-2.5 py-1 text-[11.5px] font-bold text-ink shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,r.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",h("dash.agent")]})]}):(0,r.jsxs)("button",{type:"button",onClick:z,"aria-pressed":R,"aria-label":h("tasks.panelToggleAria"),className:`ml-auto flex shrink-0 items-center gap-1 rounded-[8px] border px-2.5 py-1 text-[11.5px] font-bold shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${R?"border-accent/45 bg-accent/10 text-accent":"border-line bg-panel text-ink hover:border-accent/45 hover:text-accent"}`,children:[(0,r.jsx)(eX.A,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",h("tasks.panelTitle"),Q.filter(e=>"done"!==e.status).length?(0,r.jsx)("span",{className:"rounded-full bg-accent/10 px-1.5 text-[10px] font-bold text-accent",children:Q.filter(e=>"done"!==e.status).length}):null]}),(0,r.jsxs)("button",{type:"button",onClick:()=>{let e="wf-"+en();et([...S,e]),v.current="draft::"+e},"aria-label":h("dash.newWorkflow"),className:"flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-2.5 py-1 text-[11.5px] font-bold text-ink shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,r.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",h("dash.workflow")]})]}),U.length?(0,r.jsx)("div",{className:"flex shrink-0 flex-col gap-1.5 border-b border-line bg-[#fbfbfd] px-3 py-1.5",children:U.map(e=>(0,r.jsx)(rH,{wf:e},e.id))}):null,eu.length?(0,r.jsx)("div",{className:"shrink-0 border-b border-line bg-[#fbfbfd]",children:eu.map(t=>(0,r.jsx)("div",{className:`border-l-4 ${"live"===t.activity?"border-l-ok bg-[#f2faf4]":"border-l-[#9a9aa4]"}`,children:(0,r.jsx)(r$,{file:t,files:e,onSelect:eo})},t.path))}):null,g?ef?(0,r.jsx)(sp,{project:s,groups:ep,manual:G,files:e,flows:t,tasks:Q,drafts:S,loaded:l,focus:T,onSelect:eo,onClose:ea,onDraftClose:es,onDraftSpawned:el,onHandoff:ei}):em.length?(0,r.jsx)(sy,{files:em,onOpen:eo}):(0,r.jsx)("div",{className:"flex flex-1 items-center justify-center px-4 py-5 text-center",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-[13.5px] font-semibold text-dim",children:h("dash.emptyTitle")}),(0,r.jsx)("div",{className:"mt-0.5 text-[12px] text-dim",children:h("dash.emptyHint")})]})}):(0,r.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[ef?(0,r.jsx)(sd,{project:s,groups:ep,manual:G,files:e,flows:t,tasks:Q,drafts:S,focus:T,attentionPaths:d,onSelect:eo,onClose:ea,onDraftClose:es,onDraftSpawned:el,onHandoff:ei}):em.length?(0,r.jsx)(sy,{files:em,onOpen:eo}):(0,r.jsx)("div",{className:"flex flex-1 items-center justify-center px-4 py-5 text-center",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-[13.5px] font-semibold text-dim",children:h("dash.emptyTitle")}),(0,r.jsx)("div",{className:"mt-0.5 text-[12px] text-dim",children:h("dash.emptyHint")})]})}),(0,r.jsx)("div",{className:"pointer-events-none absolute bottom-4 left-4 z-30 flex items-center gap-2",children:(0,r.jsxs)("button",{type:"button",onClick:er,"aria-label":h("dash.newConvo"),className:"pointer-events-auto flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-3 py-1.5 text-[11.5px] font-bold text-ink shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,r.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",h("dash.agent")]})})]}),R?(0,r.jsx)(rQ,{tasks:i,project:s,onOpenTask:e=>{if(e.project!==s){sessionStorage.setItem("llvTaskFocus",e.id),sP(e.project);return}ee("task::"+e.id)},onClose:z}):null]}),g?null:(0,r.jsx)(sv,{files:e,flows:t,project:s,loaded:l,onOpenFile:eo}),K.length?(0,r.jsx)(sE,{items:K,onSelect:eo}):null,(0,r.jsx)(r0,{})]})}var sL=n(908);function s_(){let{t:e}=b(),[t,i]=(0,a.useState)(!1),[s,l]=(0,a.useState)({status:"idle"}),[o,c]=(0,a.useState)(null),[d,u]=(0,a.useState)(!1),p=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(!t||"idle"!==s.status)return;let e=!1;return fetch("/api/access").then(e=>e.json()).then(t=>{e||l(t.tailnetUrl?{status:"ready",url:t.tailnetUrl}:{status:"unavailable"})}).catch(()=>{e||l({status:"error"})}),()=>{e=!0}},[t,s.status]),(0,a.useEffect)(()=>{if("ready"!==s.status)return;let e=!1,t=s.url;return n.e(768).then(n.t.bind(n,768,19)).then(({toDataURL:e})=>e(t,{margin:1,width:220})).then(n=>{e||c({url:t,dataUrl:n})}).catch(()=>{}),()=>{e=!0}},[s]);let f="ready"===s.status&&o&&o.url===s.url?o.dataUrl:null;(0,a.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"===e.key&&i(!1)},n=e=>{p.current&&!p.current.contains(e.target)&&i(!1)};return window.addEventListener("keydown",e),window.addEventListener("pointerdown",n),()=>{window.removeEventListener("keydown",e),window.removeEventListener("pointerdown",n)}},[t]);let m=(0,a.useCallback)(()=>{"ready"===s.status&&navigator.clipboard.writeText(s.url).then(()=>{u(!0),window.setTimeout(()=>u(!1),2e3)}).catch(()=>{})},[s]);return(0,r.jsxs)("div",{ref:p,className:"relative ml-auto shrink-0",children:[(0,r.jsx)("button",{type:"button","aria-expanded":t,"aria-label":e("qr.showAria"),onClick:()=>{t||l({status:"idle"}),i(!t)},className:"flex items-center justify-center rounded-[8px] border border-line bg-panel p-1.5 text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,r.jsx)(sL.A,{className:"h-4 w-4","aria-hidden":!0})}),t?(0,r.jsx)("div",{className:"fixed left-1/2 top-12 z-50 flex w-[260px] -translate-x-1/2 flex-col gap-2.5 rounded-[12px] border border-line bg-panel p-3 shadow-[0_8px_28px_rgba(20,20,30,0.14)] sm:absolute sm:left-0 sm:right-auto sm:top-full sm:mt-1.5 sm:translate-x-0",children:"idle"===s.status?(0,r.jsx)("span",{className:"text-[12px] text-ink",children:e("common.loading")}):"error"===s.status?(0,r.jsx)("span",{className:"text-[12px] font-semibold text-err",children:e("qr.failed")}):"unavailable"===s.status?(0,r.jsxs)("span",{className:"text-[12px] leading-relaxed text-ink",children:[e("qr.startHint"),(0,r.jsx)("code",{className:"break-all rounded bg-chip px-1 py-0.5 font-mono text-[11px]",children:"bunx agent-log-viewer --tailscale"})]}):(0,r.jsxs)(r.Fragment,{children:[f?(0,r.jsx)("img",{src:f,alt:e("qr.alt"),className:"mx-auto h-[220px] w-[220px]"}):(0,r.jsx)("span",{className:"text-[12px] text-ink",children:e("qr.generating")}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,r.jsx)("input",{readOnly:!0,value:s.url,"aria-label":e("qr.linkAria"),onFocus:e=>e.currentTarget.select(),className:"min-w-0 flex-1 truncate rounded-[8px] border border-line bg-bg px-2 py-1.5 font-mono text-[10.5px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),(0,r.jsx)("button",{type:"button","aria-label":e("qr.copy"),onClick:m,className:"flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-2 py-1.5 text-[11px] font-semibold text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:d?(0,r.jsx)(e9.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,r.jsx)(tr.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,r.jsx)("span",{className:"text-[10.5px] text-dim",children:e("qr.scanHint")})]})}):null]})}function sz(){let{locale:e,t,setLocale:n}=b(),i="en"===e?"uk":"en";return(0,r.jsx)("button",{className:"inline-flex h-[26px] shrink-0 items-center justify-center rounded-full border border-line bg-panel px-2 text-[10.5px] font-bold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:t("lang.aria"),"aria-label":t("lang.aria"),onClick:()=>n(i),children:e.toUpperCase()})}let sO=(e=f())=>"uk"===e?"uk-UA":"en-US";function sq({label:e,window:t,engineColor:n,now:i}){var s,l;let a,o,c,d,{t:u}=b();if(!t)return null;let p=Math.max(0,Math.min(100,100-t.usedPercent)),m=p<=10?"#c62828":p<=30?"#d29a2f":n;return(0,r.jsxs)("div",{className:"mt-1.5",children:[(0,r.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,r.jsx)("span",{className:"text-[11px] font-semibold text-ink",children:e}),(0,r.jsxs)("span",{className:"text-[11px] text-dim",children:[u("limits.left")," ",(0,r.jsxs)("span",{className:`font-bold tabular-nums ${p<=30?"":"text-ink"}`,style:p<=30?{color:m}:void 0,children:[Math.round(p),"%"]})]})]}),(0,r.jsx)("div",{className:"mt-1 h-[4px] overflow-hidden rounded-full bg-chip",children:(0,r.jsx)("div",{className:"h-full rounded-full transition-[width] duration-700 ease-out",style:{width:Math.max(p,1.5)+"%",backgroundColor:m}})}),t.resetsAt?(0,r.jsx)("div",{className:"mt-[3px] text-[10px] leading-none text-dim",children:u("limits.reset",{eta:(s=t.resetsAt,a=f(),(o=s-i)<=60?h(a,"limits.now"):o<5400?h(a,"limits.inMin",{n:Math.round(o/60)}):o<129600?h(a,"limits.inHour",{n:Math.round(o/3600)}):h(a,"limits.inDay",{n:Math.round(o/86400)})),at:(l=t.resetsAt,d=(c=new Date(1e3*l)).toLocaleTimeString(sO(),{hour:"2-digit",minute:"2-digit",hour12:!1}),l-i<86400?d:c.toLocaleDateString(sO(),{day:"numeric",month:"short"})+" "+d)})}):null]})}function sF({label:e,engine:t,limits:n,now:i,staleHint:s}){let{t:l}=b();if(!n||!n.session&&!n.weekly)return null;let a=Z[t]??ee,o=n.capturedAt&&i-n.capturedAt>1200?X(n.capturedAt):null;return(0,r.jsxs)("div",{className:`mt-2.5 first:mt-0 ${s?"opacity-60":""}`,children:[(0,r.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,r.jsx)("span",{className:"text-[11.5px] font-bold",style:{color:a.color},children:e}),n.plan?(0,r.jsx)("span",{className:"truncate text-[10px] text-dim",children:n.plan}):null,s?(0,r.jsx)("span",{className:"truncate text-[10px] text-dim",children:s}):null,o?(0,r.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 self-center rounded-full bg-[#d29a2f]",title:l("limits.stale",{stale:o})}):null]}),(0,r.jsx)(sq,{label:l("limits.5h"),window:n.session,engineColor:a.color,now:i}),(0,r.jsx)(sq,{label:l("limits.week"),window:n.weekly,engineColor:a.color,now:i})]})}function sU(){let{locale:e}=b(),[t,n]=(0,a.useState)(null);if((0,a.useEffect)(()=>{let e=!0,t=async()=>{try{let t=await fetch("/api/limits");if(!t.ok)return;let r=await t.json();e&&n(e=>{var t;return{data:(t=e?.data??null,r.claude||r.codex||!t?{claude:r.claude??t?.claude??null,codex:r.codex??t?.codex??null,staleSince:r.staleSince??null}:{...t,staleSince:r.staleSince??t.staleSince??null}),at:Date.now()/1e3}})}catch{}};t();let r=setInterval(t,6e4);return()=>{e=!1,clearInterval(r)}},[]),!t||!t.data.claude&&!t.data.codex)return null;let i=function(e,t){if(!e)return null;let n=new Date(e);return Number.isNaN(n.getTime())?null:h(t,"limits.asOf",{time:n.toLocaleTimeString(sO(t),{hour:"2-digit",minute:"2-digit",hour12:!1})})}(t.data.staleSince,e);return(0,r.jsxs)("div",{className:"shrink-0 border-t border-line px-3.5 pb-3 pt-2.5",children:[(0,r.jsx)(sF,{label:"Claude",engine:"claude",limits:t.data.claude,now:t.at,staleHint:i}),(0,r.jsx)(sF,{label:"Codex",engine:"codex",limits:t.data.codex,now:t.at,staleHint:i})]})}var sB=n(5298),sH=n(4526);function sW(){let{t:e}=b(),[t,n]=(0,a.useState)(!1),[i,s]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e="serviceWorker"in navigator&&"PushManager"in window&&window.isSecureContext;queueMicrotask(()=>s(e)),e&&navigator.serviceWorker.getRegistration("/question-push-sw.js").then(e=>e?.pushManager.getSubscription().then(e=>n(null!==e)))},[]);let l=async()=>{if(!i||"default"===Notification.permission&&"granted"!==await Notification.requestPermission()||"granted"!==Notification.permission)return;let e=await navigator.serviceWorker.register("/question-push-sw.js"),t=await e.pushManager.getSubscription();if(t){await t.unsubscribe(),n(!1);return}let r=await (await fetch("/api/push")).json(),s=await e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(e){let t=atob((e+"=".repeat((4-e.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/")),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n.buffer.slice(0)}(r.publicKey)});await fetch("/api/push",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(s)}),n(!0)};return(0,r.jsx)("button",{className:"inline-flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full border border-line bg-panel text-dim hover:text-ink disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:e(i?t?"push.enabled":"push.enable":"push.needsHttps"),"aria-label":e(i?t?"push.disable":"push.enable":"push.needsHttps"),"aria-pressed":t,disabled:!i,onClick:l,children:t?(0,r.jsx)(sB.A,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,r.jsx)(sH.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})}let sK=[2,6,12];function sY(e){return e>=0x280000000?Math.round(e/0x40000000)+" GiB":e>=0x40000000?(e/0x40000000).toFixed(1)+" GiB":Math.max(0,Math.round(e/1048576))+" MiB"}function sJ({label:e,usedPercent:t,color:n,note:i}){let s=Math.max(1.5,Math.min(100,t));return(0,r.jsxs)("div",{className:"mt-1.5 first:mt-0",children:[(0,r.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,r.jsx)("span",{className:"text-[11px] font-semibold text-ink",children:e}),(0,r.jsx)("span",{className:"text-[11px] tabular-nums text-dim",children:i})]}),(0,r.jsx)("div",{className:"mt-1 h-[4px] overflow-hidden rounded-full bg-chip",children:(0,r.jsx)("div",{className:"h-full rounded-full transition-[width] duration-700 ease-out",style:{width:s+"%",backgroundColor:n}})})]})}function sQ(){let{t:e}=b(),[t,n]=(0,a.useState)(null),[i,s]=(0,a.useState)(!1),l=(0,a.useRef)(null),o=(0,a.useRef)(async()=>{});(0,a.useEffect)(()=>{let e=!0,t=async(t=!1)=>{let r=Date.now()/1e3;try{let i=await fetch("/api/resources"+(t?"?fresh=1":""));if(!i.ok)throw Error(String(i.status));let s=await i.json();if(!e)return;n(e=>{let t;return t=null===s.system&&(e?.data.system??null)!==null,{data:{system:s.system??e?.data.system??null,sessions:s.sessions},at:r,staleSince:t?e?.staleSince??r:null}})}catch{e&&n(e=>e?{...e,staleSince:e.staleSince??r}:e)}};o.current=t,t();let r=setInterval(()=>void t(),3e4);return()=>{e=!1,clearInterval(r)}},[]),(0,a.useEffect)(()=>{if(!i)return;let e=e=>{"Escape"===e.key&&s(!1)},t=e=>{l.current&&!l.current.contains(e.target)&&s(!1)};return window.addEventListener("keydown",e),window.addEventListener("pointerdown",t),()=>{window.removeEventListener("keydown",e),window.removeEventListener("pointerdown",t)}},[i]);let c=t?.data.system??null,d=t?.data.sessions??[];if(!t||!c&&0===d.length)return null;let u=c?100*(c.ramTotal-c.ramAvailable)/c.ramTotal:0,p=c?100*c.ramAvailable/c.ramTotal:100,f=c&&c.swapTotal>0?100*c.swapUsed/c.swapTotal:0;return(0,r.jsxs)("div",{ref:l,className:"relative shrink-0 border-t border-line",children:[(0,r.jsxs)("button",{type:"button","aria-expanded":i,"aria-label":e("resources.openAria"),onClick:()=>s(e=>!e),className:"block w-full px-3.5 pb-2.5 pt-2 text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[t.staleSince?(0,r.jsx)("span",{className:"absolute right-2 top-2 h-1.5 w-1.5 rounded-full bg-[#d29a2f]",title:e("resources.stale",{stale:X(t.staleSince)})}):null,c?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(sJ,{label:e("resources.ram"),usedPercent:u,color:p<10?"#c62828":p<30?"#d29a2f":"#9a9aa4",note:e("resources.free",{amount:sY(c.ramAvailable)})}),c.swapTotal>0?(0,r.jsx)(sJ,{label:e("resources.swap"),usedPercent:f,color:f>85?"#c62828":f>60?"#d29a2f":"#9a9aa4",note:e("resources.used",{amount:sY(c.swapUsed)})}):null]}):(0,r.jsx)("span",{className:"text-[11px] font-semibold text-ink",children:e("resources.title")})]}),i?(0,r.jsx)(sG,{sessions:d,now:t.at,onRefresh:()=>o.current(!0),onClose:()=>s(!1)}):null]})}async function sX(e){let t=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill-target",target:e.target})});return t.ok?null:(await t.json().catch(()=>({}))).error??String(t.status)}function sG({sessions:e,now:t,onRefresh:n,onClose:i}){let{t:s}=b(),[o,c]=(0,a.useState)(new Set),[d,u]=(0,a.useState)(null),[p,f]=(0,a.useState)(null),[m,x]=(0,a.useState)(2),[h,g]=(0,a.useState)(!1),w=(e,t)=>c(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r}),v=async e=>{f(null),w(e.target,!0);try{let t=await sX(e);t&&f(t),await n()}finally{w(e.target,!1),u(null)}},k=n=>{let r=(t-3600*n)*1e3;return e.filter(e=>"live"!==e.activity&&null!==e.lastActiveAt&&Date.parse(e.lastActiveAt)<r)},y=async()=>{let e=k(m);if(0!==e.length&&!h){f(null),g(!0);try{for(let t of e){w(t.target,!0);let e=await sX(t);e&&f(e)}await n()}finally{c(new Set),g(!1)}}},j=e.reduce((e,t)=>e+t.rssBytes+t.swapBytes,0),N=k(m).length;return(0,r.jsxs)("div",{className:"fixed bottom-3 left-1/2 z-50 flex w-[min(430px,calc(100vw-16px))] -translate-x-1/2 flex-col rounded-[12px] border border-line bg-panel shadow-[0_8px_28px_rgba(20,20,30,0.14)] sm:absolute sm:bottom-1 sm:left-full sm:ml-2 sm:translate-x-0",children:[(0,r.jsxs)("header",{className:"flex items-center gap-2 border-b border-line px-3 py-2",children:[(0,r.jsx)("span",{className:"text-[12.5px] font-bold",children:s("resources.title")}),e.length?(0,r.jsx)("span",{className:"text-[11px] tabular-nums text-dim",children:s("resources.total",{amount:sY(j)})}):null,(0,r.jsx)("button",{type:"button","aria-label":s("resources.close"),onClick:i,className:"ml-auto rounded-[6px] p-1 text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,r.jsx)(l.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,r.jsx)("div",{className:"max-h-[min(420px,60vh)] overflow-y-auto py-1",children:0===e.length?(0,r.jsx)("div",{className:"px-3 py-4 text-center text-[12px] text-dim",children:s("resources.empty")}):e.map(e=>(0,r.jsx)(sV,{session:e,busy:o.has(e.target),armed:d===e.target,onArm:()=>u(e.target),onKill:()=>void v(e)},e.target))}),(0,r.jsxs)("footer",{className:"flex items-center gap-2 border-t border-line px-3 py-2",children:[(0,r.jsx)("span",{className:"text-[11px] text-dim",children:s("resources.bulkLabel")}),(0,r.jsx)("select",{value:m,onChange:e=>x(Number(e.target.value)),className:"rounded-[8px] border border-line bg-bg px-1.5 py-1 text-[11px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:sK.map(e=>(0,r.jsx)("option",{value:e,children:s("resources.hoursN",{n:e})},e))}),(0,r.jsxs)("button",{type:"button",disabled:h||0===N,title:0===N?s("resources.bulkNone"):void 0,onClick:()=>void y(),className:"ml-auto rounded-[8px] border border-err/40 px-2.5 py-1 text-[11px] font-semibold text-err hover:bg-err/10 disabled:cursor-not-allowed disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/40",children:[s("resources.bulkKill"),N?` (${N})`:""]})]}),p?(0,r.jsx)("div",{className:"border-t border-line px-3 py-1.5 text-[11px] font-semibold text-err",children:p}):null]})}function sV({session:e,busy:t,armed:n,onArm:i,onKill:s}){var l;let{t:a}=b(),o=Z[e.engine??""]??ee,c="live"===e.activity,d=null!==e.lastActiveAt?Date.parse(e.lastActiveAt)/1e3:null,u=c&&!n;return(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 hover:bg-bg",children:[(0,r.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${V(e.activity??"idle")}`}),(0,r.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-bold",style:{backgroundColor:o.soft,color:o.color},children:"codex"===e.engine?"Codex":"claude"===e.engine?"Claude":"?"}),(0,r.jsxs)("span",{className:"min-w-0 flex-1",title:[e.cwd,e.target,a("resources.procs",{count:e.procCount})].filter(Boolean).join(" \xb7 "),children:[(0,r.jsx)("span",{className:"block truncate text-[12px] font-semibold",children:e.title??(e.cwd?(l=e.cwd).split("/").filter(Boolean).slice(-2).join("/")||l:a("resources.orphan"))}),(0,r.jsxs)("span",{className:"block truncate text-[10.5px] text-dim",children:[null===e.title?a("resources.orphan")+" \xb7 ":e.project?e.project+" \xb7 ":"",null!==d?X(d):e.target]})]}),(0,r.jsxs)("span",{className:"shrink-0 text-right",children:[(0,r.jsx)("span",{className:"block text-[11.5px] font-bold tabular-nums",children:sY(e.rssBytes)}),e.swapBytes>0?(0,r.jsx)("span",{className:"block text-[10px] tabular-nums text-dim",children:a("resources.swapShare",{amount:sY(e.swapBytes)})}):null]}),(0,r.jsx)("button",{type:"button",disabled:t,"aria-disabled":u||t,title:a(c?"resources.killLiveHint":"resources.killHint"),onClick:()=>u?i():s(),className:["shrink-0 rounded-[8px] border px-2 py-1 text-[11px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/40",t?"cursor-wait opacity-50":"",n?"border-err bg-err text-white":u?"border-line text-dim opacity-60 hover:opacity-90":"border-err/40 text-err hover:bg-err/10"].join(" "),children:a(n?"resources.confirm":"resources.kill")})]})}function sZ({files:e,workflows:t,archivedProjects:n,selected:i,loaded:s,now:l,onSelect:o}){let{t:c}=b(),[d,u]=(0,a.useState)(""),[p,f]=(0,a.useState)(!1),m=(0,a.useMemo)(()=>T(e,l,t),[e,l,t]),x=(0,a.useMemo)(()=>{let e=d.trim().toLowerCase();return e?m.filter(t=>t.project.toLowerCase().includes(e)):m},[m,d]),h=(0,a.useMemo)(()=>x.filter(e=>!n.has(e.project)),[x,n]),g=(0,a.useMemo)(()=>x.filter(e=>n.has(e.project)),[x,n]),v=(0,a.useMemo)(()=>m.reduce((e,t)=>e+t.liveCount,0),[m]),k=(0,a.useMemo)(()=>m.reduce((e,t)=>e+t.attentionCount,0),[m]);return(0,r.jsxs)("aside",{className:"flex w-[248px] shrink-0 flex-col border-r border-line bg-panel",children:[(0,r.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line px-4 text-[13.5px] font-bold",children:[c("rail.title"),v?(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#e5f6ea] px-2 py-0.5 text-[10.5px] font-bold text-ok",children:[(0,r.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-ok"}),v]}):null,k?(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#fff1ca] px-2 py-0.5 text-[10.5px] font-bold text-[#8a5a00]",children:["⏸ ",k]}):null,(0,r.jsx)(sz,{}),(0,r.jsx)(s_,{}),(0,r.jsx)(sW,{})]}),(0,r.jsx)("div",{className:"px-2.5 pb-1 pt-2.5",children:(0,r.jsx)("input",{className:"w-full rounded-[9px] border border-line bg-bg px-2.5 py-1.5 text-[12px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40",placeholder:c("rail.filter"),value:d,onChange:e=>u(e.target.value)})}),(0,r.jsxs)("nav",{className:"flex-1 overflow-y-auto px-2 pb-3 pt-1","aria-label":c("rail.projects"),children:[(0,r.jsx)(s0,{label:c("rail.overview"),live:0,attention:0,total:null,age:"",active:i===w,hasLive:!1,onClick:()=>o(w)}),(0,r.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-line"}),(0,r.jsx)(t3,{children:h.map(e=>(0,r.jsx)("div",{"data-flip-key":e.project,children:(0,r.jsx)(s0,{label:e.project,live:e.liveCount,attention:e.attentionCount,total:e.conversations,age:X(e.smt),active:i===e.project,hasLive:e.liveCount>0,onClick:()=>o(e.project)})},e.project))}),g.length?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-line"}),(0,r.jsxs)("button",{type:"button",className:"mb-0.5 flex w-full items-center gap-1.5 rounded-[10px] px-2.5 py-1.5 text-left text-[11.5px] font-bold text-dim hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":p,onClick:()=>f(e=>!e),children:[(0,r.jsx)(e7.A,{className:`h-3 w-3 shrink-0 transition-transform ${p?"rotate-90":""}`,"aria-hidden":!0}),(0,r.jsx)(e1.A,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),c("rail.archive"),(0,r.jsx)("span",{className:"font-semibold",children:g.length})]}),p?g.map(e=>(0,r.jsx)(s0,{label:e.project,live:e.liveCount,attention:e.attentionCount,total:e.conversations,age:X(e.smt),active:i===e.project,hasLive:e.liveCount>0,onClick:()=>o(e.project)},e.project)):null]}):null,h.length||g.length?null:s?(0,r.jsx)("div",{className:"px-3 py-4 text-center text-[12px] text-dim",children:c("common.nothingFound")}):(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 px-3 py-4 text-[12px] text-dim",children:[(0,r.jsx)(tk.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),c("common.loading")]})]}),(0,r.jsx)(sQ,{}),(0,r.jsx)(sU,{})]})}function s0({label:e,live:t,attention:n,total:i,age:s,active:l,hasLive:a,onClick:o}){return(0,r.jsxs)("button",{className:["mb-0.5 flex w-full items-center gap-2 rounded-[10px] border px-2.5 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",l?"border-line bg-bg shadow-card":"border-transparent hover:bg-bg"].join(" "),"aria-current":l?"page":void 0,onClick:o,children:[(0,r.jsx)("span",{className:["h-2 w-2 shrink-0 rounded-full",a?"animate-pulse bg-ok":"bg-[#d6d6dd]"].join(" ")}),(0,r.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,r.jsx)("span",{className:`block truncate text-[13px] ${l?"font-bold":"font-semibold"}`,children:e}),s?(0,r.jsx)("span",{className:"block text-[10.5px] text-dim",children:s}):null]}),t>0?(0,r.jsx)("span",{className:"shrink-0 rounded-full bg-[#e5f6ea] px-1.5 py-0.5 text-[10.5px] font-bold text-ok",children:t}):null,n>0?(0,r.jsxs)("span",{className:"shrink-0 rounded-full bg-[#fff1ca] px-1.5 py-0.5 text-[10.5px] font-bold text-[#8a5a00]",children:["⏸ ",n]}):null,null!==i?(0,r.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-dim",children:i}):null]})}let s1="llvProject";function s5(){let e=location.hash.match(/^#f=(.+)$/);if(e){let t=(e[1]??"").replace(/#question$/,"");try{return{filePath:decodeURIComponent(t),project:null}}catch{return{filePath:t,project:null}}}let t=location.hash.match(/^#p=(.+)$/);if(t)try{return{filePath:null,project:decodeURIComponent(t[1])}}catch{return{filePath:null,project:t[1]}}return{filePath:null,project:null}}function s2(){let e,t,n,{t:o}=b(),{files:c,flows:d,workflows:u,tasks:p,loaded:f}=function(){let[e,t]=(0,a.useState)(eB);return(0,a.useEffect)(()=>{let e=!0,n="",r="",i=async()=>{try{let i=await fetch("/api/files",r?{headers:{"If-None-Match":r}}:void 0);if(304===i.status)return;let s=i.headers.get("ETag"),l=await i.text();if(!e||l===n)return;n=l,s&&(r=s);let a=JSON.parse(l);Array.isArray(a)?t({files:a,flows:[],workflows:[],tasks:[],loaded:!0}):t({files:a.files??[],flows:a.flows??[],workflows:a.workflows??[],tasks:a.tasks??[],loaded:!0})}catch{}finally{e&&t(e=>e.loaded?e:{...e,loaded:!0})}};i();let s=setInterval(i,1e4),l=()=>void i();return window.addEventListener(P,l),window.addEventListener(ez,l),window.addEventListener(eT,l),()=>{e=!1,clearInterval(s),window.removeEventListener(P,l),window.removeEventListener(ez,l),window.removeEventListener(eT,l)}},[]),e}(),m=(e=(0,a.useSyncExternalStore)(z,()=>L,()=>O),(0,a.useMemo)(()=>d.some(t=>e.has(t.id)&&"closed"!==t.state)?d.map(t=>e.has(t.id)&&"closed"!==t.state?{...t,state:"closed",closedAt:t.closedAt??new Date().toISOString()}:t):d,[d,e]));t=(0,a.useRef)(null),n=(0,a.useRef)(new Set),(0,a.useEffect)(()=>{let e;return e=()=>{let e=ey();e&&"running"!==e.state&&e.resume().catch(()=>void 0)},window.addEventListener("pointerdown",e,{passive:!0}),window.addEventListener("keydown",e),()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",e)}},[]),(0,a.useEffect)(()=>{if(!c.length)return;let e=new Map;for(let t of c)S(t)||e.set(t.path,{state:eh(t),parent:t.parent});let r=t.current;t.current=e;let i=n.current;if(!r){for(let[t,n]of e)n.parent&&i.add(t);return}let s=0;for(let[t,n]of e){let e=c.find(e=>e.path===t),l=e?.pendingQuestion||e?.waitingInput?"question":eS[n.state],a=r.get(t),o=void 0!==l&&(a?.state==="live"||void 0===a);o&&eN(l,ev(t),220*s++),n.parent&&!i.has(t)&&(i.add(t),o||eN("spawned",ev(t),220*s++))}},[c]);let{archivedProjects:x,archiveProject:h,unarchiveProject:v}=function(e){let[t,n]=(0,a.useState)(()=>new Set),r=(0,a.useRef)(t);return(0,a.useEffect)(()=>{let e=function(){try{let e=window.localStorage.getItem(eC),t=e?JSON.parse(e):[];return new Set(Array.isArray(t)?t.filter(e=>"string"==typeof e):[])}catch{return new Set}}();r.current=e,n(e)},[]),(0,a.useEffect)(()=>{let t=r.current;if(!t.size)return;let i=new Set(t);for(let t of e)"live"===t.activity&&i.delete(C(t));i.size!==t.size&&(r.current=i,n(i),eA(i))},[e]),{archivedProjects:t,archiveProject:(0,a.useCallback)(e=>{n(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),r.current=n,eA(n),n})},[]),unarchiveProject:(0,a.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),r.current=n,eA(n),n})},[])}}(c),k=eK(),[y,j]=(0,a.useState)(!1),[N,A]=(0,a.useState)(w),[T,E]=(0,a.useState)(null),[$,D]=(0,a.useState)(null),M=(0,a.useRef)(null),[I,_]=(0,a.useState)(0);(0,a.useEffect)(()=>{let e=s5();e.filePath&&E(e.filePath);let t=e.project??localStorage.getItem(s1);t&&A(t)},[]),(0,a.useEffect)(()=>{let e=()=>{let e=s5();e.filePath?E(e.filePath):e.project&&A(e.project)};return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[]);let q=(0,a.useCallback)(e=>{A(e),localStorage.setItem(s1,e),e!==w?history.replaceState(null,"","#p="+encodeURIComponent(e)):history.replaceState(null,"",location.pathname),j(!1)},[]);(0,a.useEffect)(()=>{if(!y)return;let e=e=>{"Escape"===e.key&&j(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[y]);let F=(0,a.useCallback)(e=>{let t=C(e);sR(t,e.path),q(t),_(e=>e+1)},[q]);(0,a.useEffect)(()=>{if(!T||0===c.length)return;let e=c.find(e=>e.path===T);e&&F(e),E(null)},[T,c,F]);let[U,B]=(0,a.useState)(()=>Date.now()/1e3),H=(0,a.useMemo)(()=>(function(e,t=Date.now()/1e3){let n=[];for(let r of e){let e=R(r,t);if(null===e)continue;let i=r.pendingQuestion||r.waitingInput?"blocked":"stalled",s=r.pendingQuestion?function(e){let t=Date.parse(e);return Number.isFinite(t)?t/1e3:null}(r.pendingQuestion.askedAt)??r.mtime:r.waitingInput?r.waitingInput.since:r.mtime;n.push({id:e,file:r,project:C(r),tier:i,since:s})}return n.sort((e,t)=>(e.tier===t.tier?0:"blocked"===e.tier?-1:1)||e.since-t.since||e.id.localeCompare(t.id))})(c,U),[c,U]);(0,a.useEffect)(()=>{let e=c.filter(e=>"stalled"===e.activity).map(e=>e.mtime+7200).filter(e=>e>U);if(!e.length)return;let t=Math.max(0,(Math.min(...e)-Date.now()/1e3)*1e3)+500,n=window.setTimeout(()=>B(Date.now()/1e3),t);return()=>window.clearTimeout(n)},[c,U]);let[W,K]=(0,a.useState)(!1),Y=(0,a.useRef)(null);(0,a.useEffect)(()=>{document.title=H.length?`(${H.length}) Agent Log Viewer`:"Agent Log Viewer"},[H.length]),(0,a.useEffect)(()=>{if(!W)return;let e=e=>{Y.current?.contains(e.target)||K(!1)},t=e=>{"Escape"===e.key&&K(!1)};return window.addEventListener("pointerdown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t)}},[W]);let[J,Q]=(0,a.useState)(!1);(0,a.useEffect)(()=>{k&&Q(!1)},[k]),(0,a.useEffect)(()=>{H.length||(K(!1),Q(!1))},[H.length]);let[G,V]=(0,a.useState)(null),Z=(0,a.useCallback)(e=>{V(t=>({path:e,nonce:(t?.nonce??0)+1}))},[]),ee=(0,a.useRef)(null),et=(0,a.useMemo)(()=>H.map(e=>e.file.path).sort().join("\n"),[H]),en=(0,a.useMemo)(()=>J?new Set(et.split("\n").filter(Boolean)):null,[J,et]),er=(0,a.useMemo)(()=>N===w?[]:H.filter(e=>e.project===N),[H,N]);(0,a.useEffect)(()=>{if(k)return;let e=e=>{var t;if(!((t=e.target)&&t.tagName&&(["INPUT","TEXTAREA","SELECT","BUTTON"].includes(t.tagName)||t.isContentEditable))&&!e.metaKey&&!e.ctrlKey&&!e.altKey){if("n"===e.key||"N"===e.key){let t=function(e,t,n){if(!e.length)return null;let r=null===t?-1:e.findIndex(e=>e.id===t);return -1===r?1===n?e[0]:e[e.length-1]:e[(r+n+e.length)%e.length]}(er,ee.current,e.shiftKey?-1:1);if(!t)return;e.preventDefault(),ee.current=t.id,Z(t.file.path)}else if("f"===e.key||"F"===e.key){if(!H.length)return;e.preventDefault(),Q(e=>!e)}}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[k,er,H.length,Z]);let ei=(0,a.useCallback)(e=>{K(!1),e.project!==N&&q(e.project),ee.current=e.id,Z(e.file.path)},[N,q,Z]);(0,a.useEffect)(()=>{let e=c.map(e=>({file:e,id:e.pendingQuestion||e.waitingInput?R(e):null})).filter(e=>null!==e.id);if(null===M.current){M.current=new Set(e.map(e=>e.id));return}let t=e.find(e=>!M.current.has(e.id));for(let t of e)M.current.add(t.id);t&&queueMicrotask(()=>D(t.file.path))},[c]);let es=$?c.find(e=>e.path===$):null,el=H.length?(0,r.jsxs)("div",{ref:Y,className:"pointer-events-auto relative",children:[(0,r.jsxs)("div",{className:"flex items-center overflow-hidden rounded-full border border-[#e0ae45]/45 bg-[#fff9ed] shadow-card",children:[(0,r.jsx)("button",{type:"button",className:"px-3 py-1 text-[12px] font-bold text-[#8a5a00] hover:bg-[#e0ae45]/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40","aria-expanded":W,"aria-label":o("attention.badge",{count:H.length}),title:o("attention.openQueue"),onClick:()=>K(e=>!e),children:k?(0,r.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,r.jsx)(i.A,{className:"h-3 w-3","aria-hidden":!0})," ",H.length]}):o("attention.badge",{count:H.length})}),k?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"h-4 w-px shrink-0 bg-[#e0ae45]/45","aria-hidden":!0}),(0,r.jsx)("button",{type:"button",className:`px-2 py-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40 ${J?"bg-[#e0ae45]/30 text-[#8a5a00]":"text-[#b8860b]/70 hover:bg-[#e0ae45]/15 hover:text-[#8a5a00]"}`,"aria-pressed":J,title:J?o("attention.filterOff"):o("attention.filterOn"),"aria-label":J?o("attention.filterOff"):o("attention.filterOn"),onClick:()=>Q(e=>!e),children:(0,r.jsx)(s.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})]}),W?(0,r.jsxs)("div",{className:`${k?"fixed inset-x-3 top-12":"absolute right-0 top-[calc(100%+6px)] w-[340px] max-w-[calc(100vw-2rem)]"} z-50 max-h-[60vh] overflow-y-auto rounded-[10px] border border-line bg-panel p-1.5 shadow-card`,children:[(0,r.jsx)("div",{className:"px-2.5 pb-1 pt-1.5 text-[10.5px] font-bold uppercase tracking-wide text-dim",children:o("attention.popoverTitle")}),H.map(e=>(0,r.jsxs)("button",{type:"button",className:"flex w-full min-w-0 flex-col gap-0.5 rounded-[8px] px-2.5 py-2 text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>ei(e),children:[(0,r.jsxs)("span",{className:"flex w-full min-w-0 items-center gap-1.5",children:[(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-ink",children:g(e.file.title,90)}),(0,r.jsx)("span",{className:"shrink-0 rounded-full border border-line bg-bg px-1.5 text-[10px] font-semibold text-dim",children:e.project}),(0,r.jsx)("span",{className:"shrink-0 text-[10.5px] text-dim",children:X(e.since)})]}),(0,r.jsx)("span",{className:`w-full truncate text-[11px] ${"stalled"===e.tier?"text-[#b8860b]":"text-dim"}`,children:function(e,t){let n=t.file.pendingQuestion;if(n){if("plan"===n.kind)return e("status.awaitingPlan");let t=n.questions?.[0];return t?.header||t?.question.split("\n")[0]||e("status.awaitingAnswer")}let r=t.file.waitingInput;return r?r.menu?.question.split("\n")[0]||r.screenTail||e("status.awaitingTerminal"):e("status.stalled")}(o,e)})]},e.id))]}):null]}):null;return(0,r.jsxs)("div",{className:"flex h-full",children:[k?null:(0,r.jsx)(sZ,{files:c,workflows:u,archivedProjects:x,selected:N,now:U,loaded:f,onSelect:q}),k&&y?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex",children:[(0,r.jsx)(sZ,{files:c,workflows:u,archivedProjects:x,selected:N,now:U,loaded:f,onSelect:q}),(0,r.jsx)("button",{type:"button",className:"min-w-0 flex-1 bg-ink/35","aria-label":o("viewer.closeProjects"),onClick:()=>j(!1)})]}):null,(0,r.jsxs)("main",{className:"flex min-w-0 flex-1 flex-col",children:[(0,r.jsxs)("div",{className:"pointer-events-none fixed right-4 top-4 z-50 flex flex-col items-end gap-2",children:[k?null:el,es?(0,r.jsxs)("div",{className:"pointer-events-auto flex max-w-[360px] gap-2 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] px-4 py-3 text-[13px] font-semibold text-ink shadow-card",children:[(0,r.jsxs)("button",{className:"min-w-0 flex-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{F(es),D(null)},children:[(0,r.jsx)("span",{className:"block text-[11px] font-bold text-[#8a5a00]",children:o("viewer.agentWaiting")}),(0,r.jsx)("span",{className:"line-clamp-2",children:es.title})]}),(0,r.jsx)("button",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":o("viewer.closeNotification"),onClick:()=>D(null),children:(0,r.jsx)(l.A,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}):null]}),N===w?(0,r.jsx)(eQ,{files:c,workflows:u,archivedProjects:x,now:U,onSelectProject:q,onSelectFile:F,onMenu:k?()=>j(!0):void 0,attention:k?el:void 0}):(0,r.jsx)(sI,{files:c,flows:m,workflows:u,tasks:p,project:N,loaded:f,openNonce:I,focusRequest:G,attentionPaths:en,archived:x.has(N),onArchive:h,onUnarchive:v,onMenu:k?()=>j(!0):void 0,attention:k?el:void 0})]})]})}},9097:(e,t,n)=>{Promise.resolve().then(n.bind(n,7657))}},e=>{e.O(0,[680,441,794,358],()=>e(e.s=9097)),_N_E=e.O()}]);
|