@surething/cockpit 1.0.209 → 1.0.211
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/.next-prod/BUILD_ID +1 -1
- package/.next-prod/app-path-routes-manifest.json +5 -1
- package/.next-prod/build-manifest.json +3 -3
- package/.next-prod/diagnostics/framework.json +1 -1
- package/.next-prod/next-server.js.nft.json +1 -1
- package/.next-prod/prerender-manifest.json +3 -3
- package/.next-prod/routes-manifest.json +24 -0
- package/.next-prod/server/app/_global-error/page.js +3 -3
- package/.next-prod/server/app/_global-error/page.js.nft.json +1 -1
- package/.next-prod/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/_global-error.html +1 -1
- package/.next-prod/server/app/_global-error.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found/page.js +2 -2
- package/.next-prod/server/app/_not-found/page.js.nft.json +1 -1
- package/.next-prod/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/_not-found.html +1 -1
- package/.next-prod/server/app/_not-found.rsc +3 -3
- package/.next-prod/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/.next-prod/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/.next-prod/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next-prod/server/app/api/agent/test/route.js +1 -1
- package/.next-prod/server/app/api/agent/test/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/bash/route.js +1 -1
- package/.next-prod/server/app/api/bash/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/codex/route.js +78 -4
- package/.next-prod/server/app/api/chat/codex/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/deepseek/route.js +78 -4
- package/.next-prod/server/app/api/chat/deepseek/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/kimi/route.js +87 -13
- package/.next-prod/server/app/api/chat/kimi/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/ollama/route.js +89 -15
- package/.next-prod/server/app/api/chat/ollama/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/route.js +78 -4
- package/.next-prod/server/app/api/chat/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/claude-stats/route.js +1 -1
- package/.next-prod/server/app/api/claude-stats/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/commands/route.js +1 -1
- package/.next-prod/server/app/api/commands/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/comments/route.js +1 -1
- package/.next-prod/server/app/api/comments/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/columns/route.js +2 -2
- package/.next-prod/server/app/api/db/columns/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/connect/route.js +1 -1
- package/.next-prod/server/app/api/db/connect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/disconnect/route.js +1 -1
- package/.next-prod/server/app/api/db/disconnect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/export/route.js +1 -1
- package/.next-prod/server/app/api/db/export/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/query/route.js +1 -1
- package/.next-prod/server/app/api/db/query/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/schemas/route.js +1 -1
- package/.next-prod/server/app/api/db/schemas/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/dev/spans/route.js +1 -1
- package/.next-prod/server/app/api/dev/spans/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/extension/version/route.js +1 -1
- package/.next-prod/server/app/api/extension/version/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/file/route.js +1 -1
- package/.next-prod/server/app/api/file/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/blame/route.js +1 -1
- package/.next-prod/server/app/api/files/blame/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/clipboard/route.js +1 -1
- package/.next-prod/server/app/api/files/clipboard/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/copy/route.js +1 -1
- package/.next-prod/server/app/api/files/copy/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/delete/route.js +1 -1
- package/.next-prod/server/app/api/files/delete/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/expanded/route.js +1 -1
- package/.next-prod/server/app/api/files/expanded/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/index/route.js +1 -1
- package/.next-prod/server/app/api/files/index/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/init/route.js +1 -1
- package/.next-prod/server/app/api/files/init/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/paste/route.js +1 -1
- package/.next-prod/server/app/api/files/paste/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/read/route.js +1 -1
- package/.next-prod/server/app/api/files/read/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/readdir/route.js +1 -1
- package/.next-prod/server/app/api/files/readdir/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/recent/route.js +1 -1
- package/.next-prod/server/app/api/files/recent/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/save/route.js +1 -1
- package/.next-prod/server/app/api/files/save/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/search/route.js +1 -1
- package/.next-prod/server/app/api/files/search/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/stat/route.js +1 -1
- package/.next-prod/server/app/api/files/stat/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/text/route.js +1 -1
- package/.next-prod/server/app/api/files/text/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/branch-diff/route.js +1 -1
- package/.next-prod/server/app/api/git/branch-diff/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/branches/route.js +1 -1
- package/.next-prod/server/app/api/git/branches/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/commit-diff/route.js +1 -1
- package/.next-prod/server/app/api/git/commit-diff/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/commits/route.js +1 -1
- package/.next-prod/server/app/api/git/commits/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/diff/route.js +1 -1
- package/.next-prod/server/app/api/git/diff/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/discard/route.js +1 -1
- package/.next-prod/server/app/api/git/discard/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/stage/route.js +1 -1
- package/.next-prod/server/app/api/git/stage/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/status/route.js +1 -1
- package/.next-prod/server/app/api/git/status/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/unstage/route.js +1 -1
- package/.next-prod/server/app/api/git/unstage/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/worktree/route.js +1 -1
- package/.next-prod/server/app/api/git/worktree/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/global-state/route.js +1 -1
- package/.next-prod/server/app/api/global-state/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/jupyter/load/route.js +1 -1
- package/.next-prod/server/app/api/jupyter/load/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/jupyter/save/route.js +1 -1
- package/.next-prod/server/app/api/jupyter/save/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/jupyter/shutdown/route.js +1 -1
- package/.next-prod/server/app/api/jupyter/shutdown/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/lsp/definition/route.js +1 -1
- package/.next-prod/server/app/api/lsp/definition/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/lsp/hover/route.js +1 -1
- package/.next-prod/server/app/api/lsp/hover/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/lsp/references/route.js +1 -1
- package/.next-prod/server/app/api/lsp/references/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/lsp/status/route.js +1 -1
- package/.next-prod/server/app/api/lsp/status/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/lsp/warmup/route.js +1 -1
- package/.next-prod/server/app/api/lsp/warmup/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/columns/route.js +1 -1
- package/.next-prod/server/app/api/mysql/columns/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/connect/route.js +1 -1
- package/.next-prod/server/app/api/mysql/connect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/disconnect/route.js +1 -1
- package/.next-prod/server/app/api/mysql/disconnect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/export/route.js +1 -1
- package/.next-prod/server/app/api/mysql/export/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/query/route.js +1 -1
- package/.next-prod/server/app/api/mysql/query/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/schemas/route.js +1 -1
- package/.next-prod/server/app/api/mysql/schemas/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/neo4j/connect/route.js +1 -1
- package/.next-prod/server/app/api/neo4j/connect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/neo4j/disconnect/route.js +1 -1
- package/.next-prod/server/app/api/neo4j/disconnect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/neo4j/query/route.js +1 -1
- package/.next-prod/server/app/api/neo4j/query/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/neo4j/schema/route.js +1 -1
- package/.next-prod/server/app/api/neo4j/schema/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/note/route.js +1 -1
- package/.next-prod/server/app/api/note/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/ollama/models/route.js +1 -1
- package/.next-prod/server/app/api/ollama/models/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/ollama/start/route.js +1 -1
- package/.next-prod/server/app/api/ollama/start/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/open-cursor/route.js +1 -1
- package/.next-prod/server/app/api/open-cursor/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/open-vscode/route.js +1 -1
- package/.next-prod/server/app/api/open-vscode/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/pick-folder/route.js +1 -1
- package/.next-prod/server/app/api/pick-folder/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/pinned-sessions/route.js +1 -1
- package/.next-prod/server/app/api/pinned-sessions/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/project-settings/route.js +1 -1
- package/.next-prod/server/app/api/project-settings/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/project-state/route.js +1 -1
- package/.next-prod/server/app/api/project-state/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/callees/route.js +1 -0
- package/.next-prod/server/app/api/projectGraph/callees/route.js.nft.json +1 -0
- package/.next-prod/server/app/api/projectGraph/callees/route_client-reference-manifest.js +1 -0
- package/.next-prod/server/app/api/projectGraph/callers/route.js +1 -0
- package/.next-prod/server/app/api/projectGraph/callers/route.js.nft.json +1 -0
- package/.next-prod/server/app/api/projectGraph/callers/route_client-reference-manifest.js +1 -0
- package/.next-prod/server/app/api/projectGraph/coedit/route.js +1 -0
- package/.next-prod/server/app/api/projectGraph/coedit/route.js.nft.json +1 -0
- package/.next-prod/server/app/api/projectGraph/coedit/route_client-reference-manifest.js +1 -0
- package/.next-prod/server/app/api/projectGraph/file/route.js +1 -1
- package/.next-prod/server/app/api/projectGraph/file/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/file-functions/route.js +1 -1
- package/.next-prod/server/app/api/projectGraph/file-functions/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/impact/route.js +1 -0
- package/.next-prod/server/app/api/projectGraph/impact/route.js.nft.json +1 -0
- package/.next-prod/server/app/api/projectGraph/impact/route_client-reference-manifest.js +1 -0
- package/.next-prod/server/app/api/projectGraph/search/route.js +1 -1
- package/.next-prod/server/app/api/projectGraph/search/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projects/route.js +1 -1
- package/.next-prod/server/app/api/projects/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/command/route.js +1 -1
- package/.next-prod/server/app/api/redis/command/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/connect/route.js +1 -1
- package/.next-prod/server/app/api/redis/connect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/delete/route.js +1 -1
- package/.next-prod/server/app/api/redis/delete/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/disconnect/route.js +1 -1
- package/.next-prod/server/app/api/redis/disconnect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/get/route.js +1 -1
- package/.next-prod/server/app/api/redis/get/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/keys/route.js +1 -1
- package/.next-prod/server/app/api/redis/keys/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/set/route.js +1 -1
- package/.next-prod/server/app/api/redis/set/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/[id]/comments/route.js +1 -1
- package/.next-prod/server/app/api/review/[id]/comments/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/[id]/replies/route.js +1 -1
- package/.next-prod/server/app/api/review/[id]/replies/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/[id]/route.js +1 -1
- package/.next-prod/server/app/api/review/[id]/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/identify/route.js +1 -1
- package/.next-prod/server/app/api/review/identify/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/order/route.js +1 -1
- package/.next-prod/server/app/api/review/order/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/route.js +1 -1
- package/.next-prod/server/app/api/review/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/share-info/route.js +1 -1
- package/.next-prod/server/app/api/review/share-info/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/users/route.js +1 -1
- package/.next-prod/server/app/api/review/users/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/scheduled-tasks/route.js +1 -1
- package/.next-prod/server/app/api/scheduled-tasks/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/services/config/route.js +1 -1
- package/.next-prod/server/app/api/services/config/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/services/scripts/route.js +1 -1
- package/.next-prod/server/app/api/services/scripts/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/session/[sessionId]/fork/route.js +1 -1
- package/.next-prod/server/app/api/session/[sessionId]/fork/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/session/[sessionId]/history/route.js +1 -1
- package/.next-prod/server/app/api/session/[sessionId]/history/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/session-by-path/route.js +1 -1
- package/.next-prod/server/app/api/session-by-path/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/sessions/projects/[encodedPath]/route.js +1 -1
- package/.next-prod/server/app/api/sessions/projects/[encodedPath]/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/sessions/projects/route.js +1 -1
- package/.next-prod/server/app/api/sessions/projects/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/sessions/route.js +1 -1
- package/.next-prod/server/app/api/sessions/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/settings/route.js +1 -1
- package/.next-prod/server/app/api/settings/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/skills/[id]/route.js +1 -1
- package/.next-prod/server/app/api/skills/[id]/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/skills/content/route.js +1 -1
- package/.next-prod/server/app/api/skills/content/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/skills/route.js +1 -1
- package/.next-prod/server/app/api/skills/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/terminal/aliases/route.js +1 -1
- package/.next-prod/server/app/api/terminal/aliases/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/terminal/autocomplete/route.js +1 -1
- package/.next-prod/server/app/api/terminal/autocomplete/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/terminal/bubble-order/route.js +1 -1
- package/.next-prod/server/app/api/terminal/bubble-order/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/terminal/env/route.js +1 -1
- package/.next-prod/server/app/api/terminal/env/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/terminal/history/route.js +1 -1
- package/.next-prod/server/app/api/terminal/history/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/version/route.js +1 -1
- package/.next-prod/server/app/api/version/route.js.nft.json +1 -1
- package/.next-prod/server/app/favicon.ico/route.js +1 -1
- package/.next-prod/server/app/favicon.ico/route.js.nft.json +1 -1
- package/.next-prod/server/app/manifest.webmanifest/route.js +2 -2
- package/.next-prod/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/.next-prod/server/app/page.js +2 -2
- package/.next-prod/server/app/page.js.nft.json +1 -1
- package/.next-prod/server/app/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/project/page.js +2 -2
- package/.next-prod/server/app/project/page.js.nft.json +1 -1
- package/.next-prod/server/app/project/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/review/[id]/page.js +2 -2
- package/.next-prod/server/app/review/[id]/page.js.nft.json +1 -1
- package/.next-prod/server/app/review/[id]/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app-paths-manifest.json +5 -1
- package/.next-prod/server/chunks/2939.js +1 -0
- package/.next-prod/server/chunks/4034.js +1 -1
- package/.next-prod/server/chunks/4741.js +2 -2
- package/.next-prod/server/chunks/5616.js +1 -1
- package/.next-prod/server/chunks/6955.js +1 -1
- package/.next-prod/server/chunks/7973.js +15 -0
- package/.next-prod/server/chunks/8916.js +1 -1
- package/.next-prod/server/chunks/9658.js +6 -6
- package/.next-prod/server/middleware-build-manifest.js +1 -1
- package/.next-prod/server/pages/404.html +1 -1
- package/.next-prod/server/pages/500.html +1 -1
- package/.next-prod/server/server-reference-manifest.json +1 -1
- package/.next-prod/static/chunks/{3794-3fb4e6ee851037bb.js → 3794-ba2500baa4c52d55.js} +3 -3
- package/.next-prod/static/chunks/5188-6ad3d686c5e9fb28.js +29 -0
- package/.next-prod/static/chunks/6345-3da1914a1a74c1fb.js +14 -0
- package/.next-prod/static/chunks/app/_global-error/page-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/agent/test/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/bash/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/chat/codex/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/chat/deepseek/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/chat/kimi/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/chat/ollama/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/chat/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/claude-stats/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/commands/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/comments/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/db/columns/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/db/connect/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/db/disconnect/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/db/export/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/db/query/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/db/schemas/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/dev/spans/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/extension/version/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/file/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/files/blame/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/files/clipboard/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/files/copy/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/files/delete/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/files/expanded/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/files/index/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/files/init/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/files/paste/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/files/read/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/files/readdir/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/files/recent/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/files/save/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/files/search/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/files/stat/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/files/text/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/git/branch-diff/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/git/branches/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/git/commit-diff/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/git/commits/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/git/diff/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/git/discard/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/git/stage/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/git/status/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/git/unstage/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/git/worktree/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/global-state/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/jupyter/load/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/jupyter/save/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/jupyter/shutdown/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/lsp/definition/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/lsp/hover/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/lsp/references/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/lsp/status/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/lsp/warmup/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/mysql/columns/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/mysql/connect/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/mysql/disconnect/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/mysql/export/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/mysql/query/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/mysql/schemas/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/neo4j/connect/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/neo4j/disconnect/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/neo4j/query/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/neo4j/schema/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/note/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/ollama/models/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/ollama/start/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/open-cursor/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/open-vscode/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/pick-folder/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/pinned-sessions/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/project-settings/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/project-state/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/projectGraph/callees/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/projectGraph/callers/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/projectGraph/coedit/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/projectGraph/file/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/projectGraph/file-functions/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/projectGraph/impact/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/projectGraph/search/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/projects/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/redis/command/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/redis/connect/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/redis/delete/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/redis/disconnect/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/redis/get/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/redis/keys/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/redis/set/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/review/[id]/comments/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/review/[id]/replies/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/review/[id]/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/review/identify/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/review/order/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/review/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/review/share-info/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/review/users/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/scheduled-tasks/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/services/config/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/services/scripts/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/session/[sessionId]/fork/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/session/[sessionId]/history/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/session-by-path/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/sessions/projects/[encodedPath]/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/sessions/projects/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/sessions/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/settings/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/skills/[id]/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/skills/content/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/skills/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/terminal/aliases/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/terminal/autocomplete/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/terminal/bubble-order/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/terminal/env/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/terminal/history/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/api/version/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/{layout-e3b4c334b1eceb18.js → layout-a0362651ba6e6e6f.js} +1 -1
- package/.next-prod/static/chunks/app/manifest.webmanifest/route-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/app/{page-3d87bb74a7b3d36e.js → page-1b14cabf47df9ff7.js} +1 -1
- package/.next-prod/static/chunks/app/project/{page-3d87bb74a7b3d36e.js → page-1b14cabf47df9ff7.js} +1 -1
- package/.next-prod/static/chunks/{main-5a46314a5491113b.js → main-79827b1543335b12.js} +3 -3
- package/.next-prod/static/chunks/next/dist/client/components/builtin/app-error-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/next/dist/client/components/builtin/forbidden-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/next/dist/client/components/builtin/not-found-994734ef0d317687.js +1 -0
- package/.next-prod/static/chunks/next/dist/client/components/builtin/unauthorized-994734ef0d317687.js +1 -0
- package/.next-prod/static/css/f9a27209b85d8e5a.css +1 -0
- package/.next-prod/static/pS6D6oF2RLyDG-MzgFWGm/_buildManifest.js +1 -0
- package/.next-prod/trace +12 -12
- package/.next-prod/trace-build +1 -1
- package/.next-prod/types/app/api/projectGraph/callees/route.ts +351 -0
- package/.next-prod/types/app/api/projectGraph/callers/route.ts +351 -0
- package/.next-prod/types/app/api/projectGraph/coedit/route.ts +351 -0
- package/.next-prod/types/app/api/projectGraph/impact/route.ts +351 -0
- package/.next-prod/types/routes.d.ts +5 -1
- package/.next-prod/types/validator.ts +36 -0
- package/README.md +5 -1
- package/README.zh.md +5 -1
- package/dist/wsServer.mjs +2730 -4
- package/package.json +3 -3
- package/.next-prod/server/chunks/5159.js +0 -1
- package/.next-prod/server/chunks/8465.js +0 -15
- package/.next-prod/static/chunks/6345-3c06cdc8c89677b8.js +0 -14
- package/.next-prod/static/chunks/8024-a869e23f4e8e5b38.js +0 -29
- package/.next-prod/static/chunks/app/_global-error/page-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/agent/test/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/bash/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/chat/codex/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/chat/deepseek/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/chat/kimi/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/chat/ollama/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/chat/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/claude-stats/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/commands/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/comments/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/db/columns/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/db/connect/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/db/disconnect/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/db/export/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/db/query/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/db/schemas/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/dev/spans/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/extension/version/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/file/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/files/blame/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/files/clipboard/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/files/copy/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/files/delete/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/files/expanded/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/files/index/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/files/init/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/files/paste/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/files/read/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/files/readdir/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/files/recent/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/files/save/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/files/search/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/files/stat/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/files/text/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/git/branch-diff/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/git/branches/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/git/commit-diff/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/git/commits/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/git/diff/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/git/discard/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/git/stage/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/git/status/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/git/unstage/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/git/worktree/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/global-state/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/jupyter/load/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/jupyter/save/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/jupyter/shutdown/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/lsp/definition/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/lsp/hover/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/lsp/references/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/lsp/status/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/lsp/warmup/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/mysql/columns/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/mysql/connect/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/mysql/disconnect/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/mysql/export/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/mysql/query/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/mysql/schemas/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/neo4j/connect/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/neo4j/disconnect/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/neo4j/query/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/neo4j/schema/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/note/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/ollama/models/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/ollama/start/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/open-cursor/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/open-vscode/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/pick-folder/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/pinned-sessions/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/project-settings/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/project-state/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/projectGraph/file/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/projectGraph/file-functions/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/projectGraph/search/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/projects/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/redis/command/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/redis/connect/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/redis/delete/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/redis/disconnect/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/redis/get/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/redis/keys/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/redis/set/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/review/[id]/comments/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/review/[id]/replies/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/review/[id]/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/review/identify/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/review/order/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/review/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/review/share-info/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/review/users/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/scheduled-tasks/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/services/config/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/services/scripts/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/session/[sessionId]/fork/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/session/[sessionId]/history/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/session-by-path/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/sessions/projects/[encodedPath]/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/sessions/projects/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/sessions/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/settings/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/skills/[id]/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/skills/content/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/skills/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/terminal/aliases/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/terminal/autocomplete/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/terminal/bubble-order/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/terminal/env/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/terminal/history/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/api/version/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/app/manifest.webmanifest/route-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/next/dist/client/components/builtin/app-error-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/next/dist/client/components/builtin/forbidden-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/next/dist/client/components/builtin/not-found-826847d169541fa9.js +0 -1
- package/.next-prod/static/chunks/next/dist/client/components/builtin/unauthorized-826847d169541fa9.js +0 -1
- package/.next-prod/static/css/dcde719317bea028.css +0 -1
- package/.next-prod/static/zlybFiR-nH1wBW1--beGo/_buildManifest.js +0 -1
- /package/.next-prod/static/{zlybFiR-nH1wBW1--beGo → pS6D6oF2RLyDG-MzgFWGm}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
exports.id=9658,exports.ids=[9658],exports.modules={208:(a,b,c)=>{"use strict";c.d(b,{A:()=>g});var d=c(529);let e=JSON.parse('{"common":{"save":"Save","cancel":"Cancel","delete":"Delete","close":"Close","copy":"Copy","edit":"Edit","file":"File","codeMap":"Code Map","confirm":"Confirm","loading":"Loading...","search":"Search","refresh":"Refresh","retry":"Retry","submit":"Submit","copied":"Copied","saved":"Saved","failed":"Failed","noMatch":"No matches","noData":"No data","done":"Done","justNow":"just now","minutesAgo":"{{count}}m ago","hoursAgo":"{{count}}h ago","daysAgo":"{{count}}d ago","monthsAgo":"{{count}}mo ago","yearsAgo":"{{count}}y ago","saveFailed":"Save failed","copyFailed":"Copy failed","deleteFailed":"Delete failed","operationFailed":"Operation failed","copiedPath":"Path copied","copyAbsPath":"Copy absolute path","loadMore":"Load more","noResult":"No results","selected":"Selected","selectAll":"Select all","hint":"Notice","confirmBtn":"OK","cancelBtn":"Cancel","preview":"Preview","readable":"Readable","previous":"Previous","next":"Next","all":"All","input":"Input","result":"Result","line":"Line","lines":"lines","running":"Running","connecting":"Connecting","connected":"Connected","connectionFailed":"Connection failed","builtin":"Built-in","global":"Global","project":"Project","current":"Current"},"toast":{"savedSuccess":"Saved","saveFailed":"Save failed","copiedName":"Copied: {{name}}","copyFailed":"Copy failed","deleteFailed":"Delete failed","operationFailed":"Operation failed","staged":"Staged","stageFailed":"Stage failed","unstaged":"Unstaged","unstageFailed":"Unstage failed","stagedNFiles":"Staged {{count}} files","unstagedNFiles":"Unstaged {{count}} files","discardFailed":"Discard failed","discardedNFiles":"Discarded changes in {{count}} files","stagedAllFiles":"All files staged","deletedFile":"File deleted","discardedChanges":"Changes discarded","pastedFile":"Pasted: {{name}}","pasteFailed":"Paste failed","noFileToPaste":"No file to paste","createdFile":"Created: {{name}}","createFailed":"Create failed","movedToTrash":"Moved to trash: {{name}}","copiedPageUrl":"Page URL copied","copiedDirPath":"Directory path copied","switchedToBranch":"Switched to {{branch}}","switchBranchFailed":"Branch switch failed","loadBranchFailed":"Failed to load branches","copiedCommand":"Copied: {{command}}","copiedMessage":"Message copied","copiedUrl":"URL copied","copiedOutput":"Output copied","copiedCmd":"Command copied","copiedComment":"Comment copied","copiedAllComments":"All comments copied","copiedFileContent":"File content copied","copiedQA":"Copied {{count}} Q&A","copiedAllQA":"All Q&A copied","readFileFailed":"Failed to read file","reviewCreated":"Review created, link copied","reviewUpdated":"Review updated, link copied","reviewCreateFailed":"Failed to create review","sharingClosed":"Sharing disabled","sharingCloseFailed":"Failed to disable sharing","linkCopied":"Link copied","addCommentFailed":"Failed to add comment","deleteCommentFailed":"Failed to delete comment","editCommentFailed":"Failed to edit comment","addReplyFailed":"Failed to add reply","deleteReplyFailed":"Failed to delete reply","editReplyFailed":"Failed to edit reply","disconnected":"Disconnected: {{id}}","pluginReloading":"Reloading extension...","worktreeCreateSuccess":"Worktree created: {{name}}","worktreeCreateFailed":"Failed to create worktree","worktreeLoadFailed":"Failed to load worktree list","worktreeDeleted":"Worktree deleted","worktreeDeleteFailed":"Failed to delete worktree","worktreeLocked":"Locked","worktreeUnlocked":"Unlocked"},"workspace":{"selectProject":"Select a project to start","searchProjectPath":"Search project path...","loadingProjects":"Loading projects...","projectNotFound":"No projects found","sessions":"{{count}} sessions","loadingSessions":"Loading sessions...","noSessions":"No sessions","loadingText":"Loading...","openProject":"Open Project","expandSidebar":"Expand sidebar","collapseSidebar":"Collapse sidebar","notes":"Notes","skills":"Skills","settings":"Settings","projectNotes":"Project Notes","closeProject":"Close project"},"sessions":{"recentSessions":"Recent Sessions","runningCount":"{{count}} running","unreadCount":"{{count}} unread","noSessions":"No sessions yet","running":"Running","done":"Done","pinnedSessions":"Pinned Sessions","noPinnedSessions":"No pinned sessions. Click the pin icon in the tab bar to add.","editTitle":"Edit title","remove":"Remove","projectSessions":"Project Sessions","browseAllSessions":"Browse all sessions","sessionList":"Session List","searchSessions":"Search sessions...","loadingSessions":"Loading sessions...","noMatchingSessions":"No matching sessions","noSessionsYet":"No sessions yet","projectList":"Project List","openFolder":"Open Folder","selectingFolder":"Selecting...","loadingHistory":"Loading history..."},"scheduledTasks":{"title":"Scheduled Tasks","aboutToTrigger":"About to trigger","secondsLater":"in {{count}}s","minutesLater":"in {{count}}m","hoursMinutesLater":"in {{h}}h {{m}}m","hoursLater":"in {{h}}h","onceType":"Once ({{minutes}}min)","everyNMinutes":"Every {{minutes}}min","completed":"Completed","paused":"Paused","activeCount":"{{running}} active","pausedCount":"{{paused}} paused","noScheduledTasks":"No scheduled tasks. Click the clock button in the chat input to create one.","lastResult":"Last","runNow":"Run now","resume":"Resume","pause":"Pause","completedCount":"Completed ({{count}})","success":"Success","failure":"Failed","createTask":"Create Scheduled Task","editTask":"Edit Scheduled Task","sendMessage":"Message","messagePlaceholder":"Enter message to send...","type":"Type","once":"Once","interval":"Interval","quickSelect":"Quick Select","customCron":"Custom Cron Expression","customMinutes":"Custom minutes","cronPlaceholder":"e.g. 0 9 * * 1-5 (weekdays at 9am)","cronFormat":"Format: min hour day month weekday (e.g. 0 9 * * 1-5)","minutesPlaceholder":"Minutes","limitTimeRange":"Limit execution time range","to":"to","saveBtn":"Save ({{modKey}}↩)","createBtn":"Create ({{modKey}}↩)","5minLater":"In 5 minutes","15minLater":"In 15 minutes","30minLater":"In 30 minutes","1hourLater":"In 1 hour","every15min":"Every 15 min","every30min":"Every 30 min","every1hour":"Every 1 hour","every2hours":"Every 2 hours","daily9am":"Daily 09:00","daily6pm":"Daily 18:00","weeklyMon9am":"Mon 09:00","monthly1st9am":"1st of month 09:00"},"cron":{"everyNMinutes":"Every {{n}} minutes","everyNHours":"Every {{n}} hours","everyMinute":"Every minute","everyHourAtMin":"Every hour at minute {{m}}","hourlyEveryMin":"{{h}}:xx every minute","daily":"Daily at {{time}}","weekdays":"Weekdays","weekends":"Weekends","dowSun":"Sun","dowMon":"Mon","dowTue":"Tue","dowWed":"Wed","dowThu":"Thu","dowFri":"Fri","dowSat":"Sat","monthPrefix":"","dayOfMonth":"","dayRange":"{{a}}th to {{b}}th","weekdayPrefix":"","weekdayRange":"{{a}} to {{b}}"},"blockViewer":{"empty":{"body":"Select a file in the left tree to see its code map.","hint":"or press ⌘K to search."},"fileMode":{"loading":"Loading…","notFound":"This file is not indexed (unsupported language or beyond the file cap)."},"search":{"tooltip":"Search (⌘K)","hint":"Start typing to search","noResults":"No matches","files":"Files","symbols":"Symbols"},"viewerToggle":{"toBlock":"Show code map","toCode":"Back to code view"},"toc":{"title":"this file","empty":"No functions detected."},"history":{"title":"history","empty":"Click an input or output pin to begin tracing.","clear":"Clear history"},"refresh":"Rebuild project graph","retry":"Retry"},"blockDiffViewer":{"loading":"Building code map…","unsupported":"Code map diff is not available for this file type.","unsupportedHint":"Switch back to the regular diff view to read it.","error":"Code map diff failed: {{message}}","noBlockChanges":"No code-map changes (formatting / whitespace only).","noBefore":"(new)","noAfter":"(removed)","kind":{"added":"added","deleted":"deleted","modified":"modified"}},"fileBrowser":{"directoryTree":"Tree","searchTab":"Search","recentTab":"Recent","changesTab":"Status","historyTab":"History","searchFiles":"Search files...","clear":"Clear","exactMatchOn":"Exact match (on)","exactMatchOff":"Exact match (off)","refreshTree":"Refresh directory tree","collapseAll":"Collapse all directories","searchFileContent":"Search file contents...","caseSensitive":"Case sensitive","wholeWord":"Whole word","regex":"Regex","fileTypes":"File types (ts,tsx)","compareMode":"Compare","compareModeOff":"Close branch comparison","compareModeOn":"Compare with selected branch","createFile":"New File","createFileIn":"New File (in {{path}}/)","fileName":"File name...","noRecentFiles":"No recent files","stagingArea":"Staged ({{count}})","changesSummary_one":"{{count}} change","changesSummary_other":"{{count}} changes","noChanges":"No changes in working tree","refreshChanges":"Refresh changes","unstageAll":"Unstage all","noStagedFiles":"No staged files","unstageNFiles":"Unstage {{count}} files","unstageFile":"Unstage","workspace":"Workspace ({{count}})","discardAll":"Discard all","stageAll":"Stage all","noUnstagedChanges":"No unstaged changes","discardNFiles":"Discard changes in {{count}} files","stageNFiles":"Stage {{count}} files","discardChanges":"Discard changes","stageFile":"Stage file","loadingDiff":"Loading diff...","noDiffFiles":"No diff files","nFilesChanged":"{{count}} files changed (vs {{branch}})","loadingCommits":"Loading commits...","noCommits":"No commits","allLoaded":"All {{count}} records loaded","locateInTree":"Locate in directory tree","unsaved":"Unsaved","saveBeforeSwitch":"Current file has unsaved changes. Save before switching?","saveAndSwitch":"Save and switch","closeEdit":"Close edit (ESC)","closeBtn":"Close","copyFileContent":"Copy file content","toggleJsonReadable":"Toggle JSON readable mode","previewMarkdown":"Preview Markdown","viewBlame":"View line-by-line change history","editFile":"Edit file","backToPreview":"Back to preview","cannotPreview":"Cannot preview this file","selectFileToPreview":"Select a file to preview","staged":"Staged","unstaged":"Unstaged","selectFileToViewDiff":"Select a file to view diff","loadingDiffContent":"Loading diff...","clickCompareToLoad":"Click \\"Compare\\" to load branch diff","selectCommitToView":"Select a commit to view details","confirmDelete":"Confirm Delete","confirmDeleteMessage":"Move <file>{{name}}</file> to trash?","nFilesNMatches":"{{files}} files, {{matches}} matches","resultsTruncated":"Results truncated","noContentSearchResults":"No results","enterKeywordToSearch":"Enter keyword to search file contents","searchMinChars":"Search requires at least 2 characters"},"codeViewer":{"fileModifiedExternally":"File was modified externally. Saving will overwrite external changes.","useDiskVersion":"Use disk version","forceOverwrite":"Force overwrite","searchPlaceholder":"Search...","caseSensitive":"Case sensitive","wholeWordMatch":"Whole word match","unsavedConfirm":"You have unsaved changes. Close anyway?","discardChanges":"Discard changes","continueEditing":"Continue editing","unsavedExitConfirm":"You have unsaved changes. Exit edit mode?","clickToViewDetails":"Click to view details","clickToViewCommit":"Click to view commit details","nComments":"{{count}} comments","searchChat":"Search chat...","prevShiftEnter":"Previous (Shift+Enter)","nextEnter":"Next (Enter)","closeEsc":"Close (Esc)"},"chat":{"startConversation":"Start a conversation","loadMoreHistory":"Load more...","scrollUpForMore":"↑ Scroll up to load more history","claudeThinking":"Claude is thinking...","jumpToStart":"Jump to start","jumpToLatest":"Jump to latest","copyMessage":"Copy message","forkSession":"Fork session from here","imageN":"Image {{index}}","imagePreview":"Image preview","toolCalls":"{{count}} tool calls","collapse":"▲ Collapse","expand":"▼ Expand","viewQuestions":"View questions","viewAllFileChanges":"View all file changes","requestFailed":"Request failed","cannotReadStream":"Cannot read response stream","errorRetry":"An error occurred, please retry","placeholder":"Type a message, Enter to send (Shift+Enter for new line, paste images, / for commands)","placeholderDisabled":"Generating... you can keep typing","imageSizeLimit":"Image size exceeds limit (max 5MB), current: {{size}}MB","stageAll":"Stage all files (git add -A)","viewGitChanges":"View Git changes","viewAllComments":"View all comments","userMessages":"User messages","projectNotes":"Project Notes","scheduledTasks":"Scheduled Tasks","context":"Context","output":"Output","copiedCommandTooltip":"Copied!","copyCommandTooltip":"Copy command: claude -r {{sessionId}}","executedCommand":"Executed `{{command}}`{{exitInfo}}, output:\\n```\\n{{output}}\\n```","executedCommandFailed":"Failed to execute `{{command}}`: {{error}}","skillExpansionPrompt":"Please read this skill file:"},"console":{"enterCommandOrUrl":"Enter a command or URL to start","loadingMore":"Loading...","loadMoreHistory":"Load more history","quickCommands":"Quick Commands","singleColumn":"Single column","dualColumn":"Dual column","envVars":"Environment Variables","launchZsh":"Launch zsh terminal","inputPlaceholder":"Enter command or URL and press Enter... (↑↓ history, Tab complete)","scopeProject":"Project","scopeGlobal":"Global","tabSwitchEscClose":"Tab to switch \xb7 Esc to close","copyOutput":"Copy output","copyCommand":"Copy command","rerun":"Re-run","deleteRecord":"Delete record","searchPlaceholder":"Search...","searchMode":"Search","filterMode":"Filter","prevShiftEnter":"Previous (Shift+Enter)","nextEnter":"Next (Enter)","loadingTerminal":"Loading terminal...","clickToInput":"Click terminal area to type","stdinPlaceholder":"stdin input...","runningText":"Running...","exitCode":"Exit code: {{code}}","totalLines":"{{count}} lines total","globalCommands":"Global Commands","projectCommands":"Project Commands","noCustomCommands":"No custom commands yet","namePlaceholder":"Name","commandPlaceholder":"Command","restoreTooltip":"Restore ({{modKey}}M / ESC)","screenshotting":"Screenshotting...","outputFileDeleted":"[Output file deleted]"},"browser":{"blankPage":"Blank page","copyUrl":"Copy URL","openInNewWindow":"Open in new window","exitMaximize":"Exit maximize ({{modKey}}M)","maximize":"Maximize ({{modKey}}M)","pageLoadFailed":"Page load failed","clickToWake":"Click to wake","sleeping":"Sleeping","loadingPage":"Loading...","loadFailed":"Load failed"},"database":{"connectionFailed":"Connection failed","connected":"Connected","connecting":"Connecting...","refreshTableList":"Refresh table list","filterTable":"T Tables","filterView":"V Views","noTables":"No tables","tabStructure":"Structure","tabData":"Data","tabSql":"SQL","filterActive":"Filter: {{count}} cols","clearAllFilters":"Clear all filters","deleteNRows":"Delete {{count}} rows","confirmDeleteRows":"Confirm delete?","copyCsvSelected":"Copy selected rows as CSV","copyCsvAll":"Export all as CSV","copyJsonSelected":"Copy selected rows as JSON","copyJsonAll":"Export all as JSON","copyCSV":"Copy CSV","CSV":"CSV","copyJSON":"Copy JSON","JSON":"JSON","selectTable":"Select a table","selectTableToView":"Select a table to view structure","selectTableForData":"Select a table to view data","columns":"Columns","colName":"Name","colType":"Type","colNullable":"Nullable","colDefault":"Default","primaryKey":"Primary Key","foreignKeys":"Foreign Keys","indexes":"Indexes","enable":"Enable","commaValues":"Comma-separated values","likePattern":"%pattern%","valuePlaceholder":"Value","apply":"Apply","clearFilter":"Clear","addRow":"+ Add Row","totalRows":"{{count}} rows","rowsAffected":"{{command}} — {{count}} rows affected ({{duration}}ms)","queryRows":"{{count}} rows ({{duration}}ms)","resultTruncated":"[Results truncated to 1000 rows]","sqlPlaceholder":"Enter SQL... ({{modKey}}Enter to execute)","executing":"Executing...","execute":"▶ Execute","deleteRowsFailed":"{{count}} rows failed to delete","inputParams":"Input Parameters","resultLabel":"Result"},"mysql":{"connectionFailed":"Connection failed","connected":"Connected","connecting":"Connecting...","refreshTableList":"Refresh table list","filterTable":"T Tables","filterView":"V Views","noTables":"No tables","tabStructure":"Structure","tabData":"Data","tabSql":"SQL","filterActive":"Filter: {{count}} cols","clearAllFilters":"Clear all filters","deleteNRows":"Delete {{count}} rows","confirmDeleteRows":"Confirm delete?","copyCsvSelected":"Copy selected rows as CSV","copyCsvAll":"Export all as CSV","copyJsonSelected":"Copy selected rows as JSON","copyJsonAll":"Export all as JSON","copyCSV":"Copy CSV","CSV":"CSV","copyJSON":"Copy JSON","JSON":"JSON","selectTable":"Select a table","selectTableToView":"Select a table to view structure","selectTableForData":"Select a table to view data","columns":"Columns","colName":"Name","colType":"Type","colNullable":"Nullable","colDefault":"Default","primaryKey":"Primary Key","foreignKeys":"Foreign Keys","indexes":"Indexes","enable":"Enable","commaValues":"Comma-separated values","likePattern":"%pattern%","valuePlaceholder":"Value","apply":"Apply","clearFilter":"Clear","addRow":"+ Add Row","totalRows":"{{count}} rows","rowsAffected":"{{command}} — {{count}} rows affected ({{duration}}ms)","queryRows":"{{count}} rows ({{duration}}ms)","resultTruncated":"[Results truncated to 1000 rows]","sqlPlaceholder":"Enter SQL... ({{modKey}}Enter to execute)","executing":"Executing...","execute":"▶ Execute","deleteRowsFailed":"{{count}} rows failed to delete"},"redis":{"neverExpires":"Never expires","expired":"Expired","loadFailed":"Load failed","deleteFailed":"Delete failed","saveFailed":"Save failed","scanPlaceholder":"SCAN pattern...","scanSearch":"Search (SCAN)","noKeys":"No keys","loadMore":"Load more...","tabData":"Data","tabInfo":"Info","tabCli":"CLI","selectKey":"Select a key","keyNotExist":"Key does not exist","unsupportedType":"Unsupported type: {{type}}","nItems":"{{total}} items","showingN":"showing {{count}}","nMembers":"{{total}} members","nEntries":"{{total}} entries","cliHint":"Enter Redis commands, e.g. PING, GET key, KEYS *","cliPlaceholder":"Enter command..."},"git":{"switchBranch":"Switch branch","searchBranch":"Search branches...","noBranches":"No branches available","noMatchingBranches":"No matching branches","localBranches":"Local Branches","remoteBranches":"Remote Branches","branchNotFound":"Branch not found","selectBranch":"Select branch...","currentBranch":"Current","notGitRepo":"Current directory is not a Git repository","cannotGetBranches":"Cannot get branch info","getBranchesFailed":"Failed to get branch info","discardAllConfirm":"Discard changes in {{count}} workspace files? This cannot be undone.","worktree":{"title":"Git Worktree","count":"{{count}} worktrees","selectBranch":"Select branch","addWorktree":"+ Add Worktree","confirmDelete":"Confirm Delete","confirmDeleteMsg":"Delete this worktree?","path":"Path:","branch":"Branch:","locked":"Locked","unlock":"Unlock","lock":"Lock","searchBranch":"Search branches...","noBranches":"No available branches"}},"comments":{"addComment":"Add Comment","lineRange":"Line {{start}}-{{end}}","inputPlaceholder":"Enter comment...","newComment":"New comment {{range}}","commentPlaceholder":"Enter comment... ({{modKey}}Enter to submit, Esc to cancel)","nComments":"{{count}} comments","allComments":"All Comments","copyAllComments":"Copy all comments","noComments":"No comments yet","clearAll":"Clear all","totalComments":"{{count}} comments total","aiReply":"AI Reply","noContent":"(no content)","linesCount":"({{count}} lines)","codeRef":"Code reference:","note":"Note: {{content}}","submitting":"Submitting...","enterSubmit":"Enter to submit \xb7 Shift+Enter for new line","askAI":"Ask AI","inputQuestion":"Enter your question...","aiGenerating":"Generating, please wait...","enterSend":"Enter to send \xb7 Shift+Enter for new line","sendToAI":"Send to AI","aiResponding":"AI is responding...","question":"Question: {{question}}"},"fileContextMenu":{"createFile":"New File","copyFile":"Copy File","copyFolder":"Copy Folder","pasteHere":"Paste Here","deleteFile":"Delete File","deleteFolder":"Delete Folder","copyRelativePath":"Copy Relative Path","copyAbsolutePath":"Copy Absolute Path","copyRelativeDirPath":"Copy Relative Dir Path","copyAbsoluteDirPath":"Copy Absolute Dir Path","copyFileName":"Copy File Name","copyFolderName":"Copy Folder Name"},"settings":{"title":"Settings","theme":"Theme","themeLight":"Light","themeDark":"Dark","themeSystem":"System","browserExtension":"Browser Extension","extensionInstalled":"Cockpit Bridge installed","extensionNotInstalled":"Cockpit Bridge not installed","extensionDescription":"After installing the Chrome extension, link navigation in iframes will be intercepted: new tab links create new bubbles, page navigation updates the current bubble.","installSteps":"Installation steps:","step1":"1. Open Chrome and navigate to","step2":"2. Enable \\"Developer mode\\" in the top-right corner","step3":"3. Click \\"Load unpacked\\"","step4mac":"4. Press <kbd>Cmd+Shift+G</kbd> → paste the path below → Enter","copyExtensionPath":"Copy extension directory path","reloadExtension":"Reload extension","about":"About","language":"Language","languageAuto":"System","switchDark":"Switch to dark","switchLight":"Switch to light"},"editor":{"placeholder":"Write something... Type / for commands","noteTitle":"{{name}} - Notes","noteUntitled":"Notes","saving":"Saving...","linkPlaceholder":"Enter URL...","confirmLink":"Confirm","removeLink":"Remove link","heading1":"Heading 1","heading2":"Heading 2","heading3":"Heading 3","bold":"Bold","italic":"Italic","strikethrough":"Strikethrough","inlineCode":"Inline code","link":"Link","bulletList":"Bullet list","orderedList":"Ordered list","taskList":"Task list","blockquote":"Blockquote","codeBlock":"Code block","table":"Table","horizontalRule":"Horizontal rule","insertRowAbove":"Insert row above","insertRowBelow":"Insert row below","insertColumnLeft":"Insert column left","insertColumnRight":"Insert column right","deleteRow":"Delete row","deleteColumn":"Delete column","deleteTable":"Delete table","deleteCodeBlock":"Delete code block","toc":"TOC","expandToc":"Expand TOC","collapseToc":"Collapse TOC"},"slashCommands":{"heading1":"Heading 1","heading1Desc":"Large heading","heading2":"Heading 2","heading2Desc":"Medium heading","heading3":"Heading 3","heading3Desc":"Small heading","bulletList":"Bullet List","bulletListDesc":"Bulleted list","orderedList":"Ordered List","orderedListDesc":"Numbered list","taskList":"Task List","taskListDesc":"Checkable task list","blockquote":"Blockquote","blockquoteDesc":"Quote block","codeBlock":"Code Block","codeBlockDesc":"Code snippet","table":"Table","tableDesc":"Insert 3\xd73 table","horizontalRule":"Divider","horizontalRuleDesc":"Horizontal divider","link":"Link","linkDesc":"Insert hyperlink"},"commands":{"qa":"Enter requirements clarification mode","commit":"Commit code changes","review":"Code review","test":"Run tests","fix":"Fix issues","explain":"Explain code","refactor":"Refactor code"},"review":{"reviewManagement":"Review Management","allReviews":"All Reviews","noOpenReviews":"No open reviews","viewComments":"View comments","nComments":"{{count}} comments","nDocs":"{{count}} docs","nReviews":"{{count}} reviews","docList":"Document List","allReviewsList":"All Reviews","expandList":"Expand list","collapseList":"Collapse list","closeReview":"Close review","reopenReview":"Reopen","deleteReview":"Delete review","noOpenDocs":"No open documents","noReviews":"No reviews","sharing":"Sharing","notShared":"Not shared","closeSharing":"Disable sharing","enableSharing":"Enable sharing","view":"View","setNickname":"Set your nickname","nicknameHint":"Other reviewers will see this name","nicknamePlaceholder":"Enter nickname","skipForNow":"Skip for now","identitySettings":"Identity Settings","reviewNickname":"Review Nickname","random":"Random","selectTextToComment":"Select text to add comment","selectTextHint":"Select text on the left to add a comment","prevComment":"Previous","nextComment":"Next","commentsCount":"{{count}} comments","commentsNavCount":"{{current}}/{{total}} comments","allCommentsTitle":"All Comments","commentsCountBrief":"{{count}}","closedCount":"{{count}} closed","copyAllComments":"Copy all comments","noComments":"No comments yet","closedComments":"Closed ({{count}})","closedLabel":"Closed","moreReplies":"+{{count}} replies","copyComment":"Copy comment","reopen":"Reopen","closeComment":"Close comment","editComment":"Edit comment","deleteComment":"Delete comment","edited":"(edited)","editReply":"Edit reply","deleteReply":"Delete reply","reply":"Reply","replyPlaceholder":"Add a reply...","selectedText":"Selected text","addCommentPlaceholder":"Add a comment...","enterSubmitHint":"Enter to submit, Shift+Enter for new line","commentBtn":"Comment","reviewNotExist":"Review does not exist or has been deleted","loadFailed":"Load failed","networkError":"Network error","reviewNotFound":"Review not found","checkLink":"Please check the link","updatedAt":"Updated {{date}}","active":"Active","closed":"Closed","viewAllComments":"View all comments","viewCommentBtn":"View Comments","copyLink":"Copy Link","reviewSummary":"Review Comments Summary — {{title}}","totalNComments":"{{count}} comments total","quoteRef":"Quote: \\"{{text}}\\"","commentAuthor":"Comment ({{author}}): {{content}}","replyAuthor":" ↳ {{author}}: {{content}}"},"markdown":{"copied":"✓ Copied","copy":"Copy"},"imagePreview":{"previewImage":"Preview image","deleteImage":"Delete image"},"tokenStats":{"title":"Claude Code Token Stats","activeHours":"Active Hours Distribution","hourSessions":"{{h}}:00 — {{count}} sessions","messages":"Messages","toolCalls":"Tool Calls","activityTrend":"Activity Trend","byModel":"By Model","tokenUsage":"Token Usage","equivalentCost":"Equivalent Cost","modelCostDetail":"Model Cost Details","model":"Model","share":"Share","total":"Total","totalSessions":"Total Sessions","totalMessages":"Total Messages","equivalentApiCost":"Equivalent API Cost","longestSession":"Longest Session","firstUse":"First Use","notFound":"~/.claude/stats-cache.json not found","day":"Day","week":"Week","month":"Month"},"toolCall":{"inputParams":"Input Parameters","resultLabel":"Result","inputParamsTitle":"View input parameters","resultTitle":"View result","input":"Input","result":"Result","foldedLines":"... ({{count}} lines)"},"fileEditor":{"unsavedConfirm":"You have unsaved changes. Close anyway?","discardChanges":"Discard changes","continueEditing":"Continue editing","externallyModified":"File was modified externally. Saving will overwrite external changes.","useDiskVersion":"Use disk version","forceOverwrite":"Force overwrite"},"quickFileOpen":{"placeholder":"Type file name to open...","noMatch":"No matching files","recent":"Recent","selectHint":"Select","openHint":"Open","closeHint":"Close"},"envManager":{"title":"Environment Variables","tabScope":"Current Tab Only","globalScope":"Global Environment Variables","varNamePlaceholder":"Variable name (e.g. NODE_ENV)","varValuePlaceholder":"Value (e.g. production)","valuePlaceholder":"Value","noVars":"No environment variables yet. Add one to get started."},"aliasManager":{"title":"Command Aliases","description":"Set shortcut aliases for common commands (global)","aliasPlaceholder":"Alias (e.g. ll)","commandPlaceholder":"Full command (e.g. ls -la)","fullCommandPlaceholder":"Full command","usage":"Usage tip:","usageDesc":"Type an alias to execute the corresponding full command","noAliases":"No command aliases yet. Add one to get started."},"diffViewer":{"fileChanges":"File Changes ({{count}})","selectFileToView":"Select a file to view changes","sideBySide":"Side by side","unified":"Unified","previewFile":"Preview file","copiedAll":"Full text copied","compact":"Compact","full":"Full","gap":{"hidden":"{{count}} lines hidden","more":"\xb7\xb7\xb7 more +{{count}} \xb7\xb7\xb7","expandUp":"Expand {{count}} lines up","expandDown":"Expand {{count}} lines down"}},"commitDetail":{"title":"Commit Details","hash":"Hash:","author":"Author:","date":"Date:","files":"Files:","nChanges":"{{count}} changes","loadingFiles":"Loading files...","noFileChanges":"No file changes","loadingDiff":"Loading diff...","selectFileToView":"Select a file to view diff"},"askQuestion":{"title":"Questions","nQuestions":"{{count}} questions","checkedN":"{{count}} checked","copyChecked":"Copy {{count}} checked Q&A","copyAll":"Copy all Q&A","checkToCopy":"Check to copy","custom":"Custom","customPlaceholder":"Enter custom answer...","notSelected":"(not selected)"},"tabBar":{"unpin":"Unpin","pin":"Pin to favorites","closeTab":"Close tab","newTab":"New tab"},"tabManagerTopBar":{"copyPageUrl":"Copy page URL","copyDirPath":"Copy directory path","refreshProject":"Refresh project","openInVSCode":"Open in VS Code","openInCursor":"Open in Cursor","aliasesGlobal":"Command Aliases (Global)","tokenStats":"Token Stats","openSurething":"Open Surething"},"hoverTooltip":{"findReferences":"Find References","search":"Search"},"todoViewer":{"title":"Task List","progress":"{{completed}} / {{total}} done"},"userMessages":{"title":"User Messages","noMessages":"No user messages"},"shortIdBadge":{"clickToDisconnect":"Click to disconnect","clickToRegister":"Click to register and copy CLI command"},"api":{"pathForbidden":"Operation not allowed on this path","deleteForbidden":"Delete not allowed on this path","notAFolder":"Target is not a folder","imageTooLarge":"Image too large to preview","cannotPreviewBinary":"Cannot preview binary file","fileTooLarge":"File too large to preview (over 10MB)","fileModifiedExternally":"File was modified externally","pickFolderPrompt":"Select project folder"},"confirm":{"title":"Notice","ok":"OK","cancel":"Cancel"},"floatingToolbar":{"addComment":"Add Comment","sendToAI":"Send to AI","search":"Search"},"searchResults":{"title":"Search Results","nMatches":"({{count}} matches)","searching":"Searching...","noResults":"No matches"},"references":{"title":"References","searching":"Searching...","notFound":"No references found"},"gitFileTree":{"noFiles":"No files"},"reviewUtils":{"adjectives":["Happy","Brave","Quiet","Bright","Gentle","Agile","Free","Clear","Flying","Relaxed","Lively","Wise","Calm","Alert","Composed","Steady","Cheerful","Warm","Bold","Poised"],"nouns":["Panda","Dolphin","Crane","Snow Leopard","Skylark","Squirrel","Flying Fish","Deer","Bluebird","Silver Fox","Owl","Dragonfly","Firefly","Sea Turtle","Butterfly","Monkey","Red-crowned Crane","Antelope","Swallow","Penguin"]}}'),f=JSON.parse('{"common":{"save":"保存","cancel":"取消","delete":"删除","close":"关闭","copy":"复制","edit":"编辑","file":"文件","codeMap":"代码地图","confirm":"确认","loading":"加载中...","search":"搜索","refresh":"刷新","retry":"重试","submit":"提交","copied":"已复制","saved":"已保存","failed":"失败","noMatch":"无匹配","noData":"无数据","done":"完成","justNow":"刚刚","minutesAgo":"{{count}}分钟前","hoursAgo":"{{count}}小时前","daysAgo":"{{count}}天前","monthsAgo":"{{count}}个月前","yearsAgo":"{{count}}年前","saveFailed":"保存失败","copyFailed":"复制失败","deleteFailed":"删除失败","operationFailed":"操作失败","copiedPath":"已复制路径","copyAbsPath":"复制绝对路径","loadMore":"加载更多","noResult":"无匹配结果","selected":"已选择","selectAll":"全选","hint":"提示","confirmBtn":"确定","cancelBtn":"取消","preview":"预览","readable":"可读","previous":"上一个","next":"下一个","all":"全部","input":"输入","result":"结果","line":"行","lines":"行","running":"运行中","connecting":"连接中","connected":"已连接","connectionFailed":"连接失败","builtin":"内置","global":"全局","project":"项目","current":"当前"},"toast":{"savedSuccess":"已保存","saveFailed":"保存失败","copiedName":"已复制: {{name}}","copyFailed":"复制失败","deleteFailed":"删除失败","operationFailed":"操作失败","staged":"已暂存","stageFailed":"暂存失败","unstaged":"已取消暂存","unstageFailed":"取消暂存失败","stagedNFiles":"已暂存 {{count}} 个文件","unstagedNFiles":"已取消暂存 {{count}} 个文件","discardFailed":"放弃变更失败","discardedNFiles":"已放弃 {{count}} 个文件的变更","stagedAllFiles":"已暂存所有文件","deletedFile":"已删除文件","discardedChanges":"已放弃变更","pastedFile":"已粘贴: {{name}}","pasteFailed":"粘贴失败","noFileToPaste":"没有可粘贴的文件","createdFile":"已创建文件: {{name}}","createFailed":"创建失败","movedToTrash":"已移动到回收站: {{name}}","copiedPageUrl":"已复制页面地址","copiedDirPath":"已复制目录路径","switchedToBranch":"已切换到 {{branch}}","switchBranchFailed":"切换分支失败","loadBranchFailed":"加载分支列表失败","copiedCommand":"已复制: {{command}}","copiedMessage":"已复制消息","copiedUrl":"已复制网址","copiedOutput":"已复制输出","copiedCmd":"已复制命令","copiedComment":"已复制评论","copiedAllComments":"已复制全部评论","copiedFileContent":"已复制文件内容","copiedQA":"已复制 {{count}} 个问答","copiedAllQA":"已复制所有问答","readFileFailed":"读取文件失败","reviewCreated":"评审已创建,链接已复制","reviewUpdated":"评审已更新,链接已复制","reviewCreateFailed":"创建评审失败","sharingClosed":"已关闭分享","sharingCloseFailed":"关闭分享失败","linkCopied":"链接已复制","addCommentFailed":"添加评论失败","deleteCommentFailed":"删除评论失败","editCommentFailed":"编辑评论失败","addReplyFailed":"添加回复失败","deleteReplyFailed":"删除回复失败","editReplyFailed":"编辑回复失败","disconnected":"已断开: {{id}}","pluginReloading":"插件重载中...","worktreeCreateSuccess":"Worktree 创建成功: {{name}}","worktreeCreateFailed":"创建 worktree 失败","worktreeLoadFailed":"加载 worktree 列表失败","worktreeDeleted":"Worktree 已删除","worktreeDeleteFailed":"删除 worktree 失败","worktreeLocked":"已锁定","worktreeUnlocked":"已解锁"},"workspace":{"selectProject":"选择一个项目开始","searchProjectPath":"搜索项目路径...","loadingProjects":"加载项目中...","projectNotFound":"未找到项目","sessions":"{{count}} 会话","loadingSessions":"加载会话...","noSessions":"无会话记录","loadingText":"加载中...","openProject":"打开项目","expandSidebar":"展开侧边栏","collapseSidebar":"折叠侧边栏","notes":"笔记","skills":"技能","settings":"设置","projectNotes":"项目笔记","closeProject":"关闭项目"},"sessions":{"recentSessions":"最近会话","runningCount":"{{count}} 运行中","unreadCount":"{{count}} 未读","noSessions":"暂无会话记录","running":"运行中","done":"完成","pinnedSessions":"常用会话","noPinnedSessions":"暂无常用会话,在 Tab 栏点击图钉可添加","editTitle":"编辑标题","remove":"移除","projectSessions":"项目会话","browseAllSessions":"浏览所有会话","sessionList":"会话列表","searchSessions":"搜索会话...","loadingSessions":"加载会话中...","noMatchingSessions":"未找到匹配的会话","noSessionsYet":"暂无会话","projectList":"项目列表","openFolder":"打开文件夹","selectingFolder":"选择中...","loadingHistory":"加载历史消息..."},"scheduledTasks":{"title":"定时任务","aboutToTrigger":"即将触发","secondsLater":"{{count}}秒后","minutesLater":"{{count}}分钟后","hoursMinutesLater":"{{h}}小时{{m}}分后","hoursLater":"{{h}}小时后","onceType":"一次性 ({{minutes}}分钟)","everyNMinutes":"每{{minutes}}分钟","completed":"已完成","paused":"已暂停","activeCount":"{{running}} 个活跃","pausedCount":"{{paused}} 个暂停","noScheduledTasks":"暂无定时任务,在聊天输入栏点击时钟按钮创建","lastResult":"上次","runNow":"立即运行","resume":"恢复","pause":"暂停","completedCount":"已完成 ({{count}})","success":"成功","failure":"失败","createTask":"创建定时任务","editTask":"编辑定时任务","sendMessage":"发送消息","messagePlaceholder":"输入要发送的消息...","type":"类型","once":"一次性","interval":"周期","quickSelect":"快捷选择","customCron":"自定义 Cron 表达式","customMinutes":"自定义分钟数","cronPlaceholder":"例: 0 9 * * 1-5 (工作日9点)","cronFormat":"格式:分 时 日 月 星期(如 0 9 * * 1-5)","minutesPlaceholder":"分钟数","limitTimeRange":"限制执行时段","to":"至","saveBtn":"保存 ({{modKey}}↩)","createBtn":"创建 ({{modKey}}↩)","5minLater":"5 分钟后","15minLater":"15 分钟后","30minLater":"30 分钟后","1hourLater":"1 小时后","every15min":"每 15 分钟","every30min":"每 30 分钟","every1hour":"每 1 小时","every2hours":"每 2 小时","daily9am":"每天 09:00","daily6pm":"每天 18:00","weeklyMon9am":"每周一 09:00","monthly1st9am":"每月 1 号 09:00"},"cron":{"everyNMinutes":"每 {{n}} 分钟","everyNHours":"每 {{n}} 小时整点","everyMinute":"每分钟","everyHourAtMin":"每小时第 {{m}} 分","hourlyEveryMin":"{{h}} 点每分钟","daily":"每天 {{time}}","weekdays":"工作日","weekends":"周末","dowSun":"日","dowMon":"一","dowTue":"二","dowWed":"三","dowThu":"四","dowFri":"五","dowSat":"六","monthPrefix":"月","dayOfMonth":"号","dayRange":"{{a}}号到{{b}}号","weekdayPrefix":"周","weekdayRange":"周{{a}}到周{{b}}"},"blockViewer":{"empty":{"body":"在左侧文件树选择一个文件,查看它的代码地图。","hint":"或按 ⌘K 搜索。"},"fileMode":{"loading":"加载中…","notFound":"该文件未索引(不支持的语言或超出文件上限)。"},"search":{"tooltip":"搜索 (⌘K)","hint":"开始输入以搜索","noResults":"未找到匹配","files":"文件","symbols":"符号"},"viewerToggle":{"toBlock":"显示代码地图","toCode":"返回代码视图"},"toc":{"title":"本文件","empty":"未检测到函数。"},"history":{"title":"历史","empty":"点击左右两侧的 pin 开始追踪调用链。","clear":"清空历史"},"refresh":"重新构建项目图","retry":"重试"},"blockDiffViewer":{"loading":"正在生成代码地图…","unsupported":"该文件类型暂不支持代码地图 diff","unsupportedHint":"切回常规 diff 视图查看。","error":"代码地图 diff 失败:{{message}}","noBlockChanges":"代码地图无变化(仅格式或空白)。","noBefore":"(新增)","noAfter":"(已删除)","kind":{"added":"新增","deleted":"删除","modified":"修改"}},"fileBrowser":{"directoryTree":"目录树","searchTab":"搜索","recentTab":"最近","changesTab":"变更","historyTab":"历史","searchFiles":"搜索文件...","clear":"清除","exactMatchOn":"全词匹配(已开启)","exactMatchOff":"全词匹配(已关闭)","refreshTree":"刷新目录树","collapseAll":"折叠所有目录","searchFileContent":"搜索文件内容...","caseSensitive":"区分大小写","wholeWord":"完整词","regex":"正则","fileTypes":"文件类型 (ts,tsx)","compareMode":"对比","compareModeOff":"关闭分支对比","compareModeOn":"与选定分支对比","createFile":"新建文件","createFileIn":"新建文件 (在 {{path}}/)","fileName":"文件名...","noRecentFiles":"暂无最近浏览的文件","stagingArea":"暂存区 ({{count}})","changesSummary_one":"{{count}} 个变更","changesSummary_other":"{{count}} 个变更","noChanges":"工作区无变更","refreshChanges":"刷新变更列表","unstageAll":"全部取消","noStagedFiles":"无暂存的文件","unstageNFiles":"取消暂存 {{count}} 个文件","unstageFile":"取消暂存","workspace":"工作区 ({{count}})","discardAll":"放弃所有","stageAll":"全部暂存","noUnstagedChanges":"无未暂存的变更","discardNFiles":"放弃 {{count}} 个文件的变更","stageNFiles":"暂存 {{count}} 个文件","discardChanges":"放弃变更","stageFile":"暂存文件","loadingDiff":"加载对比文件中...","noDiffFiles":"无差异文件","nFilesChanged":"{{count}} 个文件变更(vs {{branch}})","loadingCommits":"加载提交记录中...","noCommits":"无提交记录","allLoaded":"已加载全部 {{count}} 条记录","locateInTree":"在目录树中定位","unsaved":"未保存","saveBeforeSwitch":"当前文件有未保存的修改,是否保存后切换?","saveAndSwitch":"保存并切换","closeEdit":"关闭编辑 (ESC)","closeBtn":"关闭","copyFileContent":"复制文件内容","toggleJsonReadable":"切换 JSON 可读模式","previewMarkdown":"预览 Markdown 渲染效果","viewBlame":"查看每行代码的修改记录","editFile":"编辑文件","backToPreview":"返回预览","cannotPreview":"无法预览此文件","selectFileToPreview":"选择文件以预览","staged":"已暂存","unstaged":"未暂存","selectFileToViewDiff":"选择文件查看差异","loadingDiffContent":"加载差异中...","clickCompareToLoad":"点击「对比」加载分支差异","selectCommitToView":"选择提交查看详情","confirmDelete":"确认删除","confirmDeleteMessage":"确定要将 <file>{{name}}</file> 移动到回收站吗?","nFilesNMatches":"{{files}} 个文件,{{matches}} 处匹配","resultsTruncated":"结果已截断","noContentSearchResults":"无匹配结果","enterKeywordToSearch":"输入关键词搜索文件内容","searchMinChars":"搜索内容至少需要 2 个字符"},"codeViewer":{"fileModifiedExternally":"文件已被外部修改,保存将覆盖外部更改","useDiskVersion":"使用磁盘版本","forceOverwrite":"强制覆盖","searchPlaceholder":"搜索...","caseSensitive":"区分大小写","wholeWordMatch":"全字匹配","unsavedConfirm":"有未保存的修改,确定关闭?","discardChanges":"放弃修改","continueEditing":"继续编辑","unsavedExitConfirm":"有未保存的修改,确定退出编辑模式?","clickToViewDetails":"点击查看详情","clickToViewCommit":"点击查看 commit 详情","nComments":"{{count}} 条评论","searchChat":"搜索聊天内容...","prevShiftEnter":"上一个 (Shift+Enter)","nextEnter":"下一个 (Enter)","closeEsc":"关闭 (Esc)"},"chat":{"startConversation":"开始对话吧","loadMoreHistory":"加载更多...","scrollUpForMore":"↑ 向上滚动加载更多历史","claudeThinking":"Claude 正在思考...","jumpToStart":"跳转到开始","jumpToLatest":"跳转到最新","copyMessage":"复制消息","forkSession":"从此处分叉会话","imageN":"图片 {{index}}","imagePreview":"图片预览","toolCalls":"{{count}} 个工具调用","collapse":"▲ 收起","expand":"▼ 展开","viewQuestions":"查看提问","viewAllFileChanges":"查看所有文件变更","requestFailed":"请求失败","cannotReadStream":"无法读取响应流","errorRetry":"发生错误,请重试","placeholder":"输入消息,Enter 发送 (Shift+Enter 换行,可粘贴图片,/ 显示命令)","placeholderDisabled":"生成中... 可继续输入","imageSizeLimit":"图片大小超过限制(最大 5MB),当前大小: {{size}}MB","stageAll":"暂存所有文件 (git add -A)","viewGitChanges":"查看 Git 变更","viewAllComments":"查看所有评论","userMessages":"用户消息列表","projectNotes":"项目笔记","scheduledTasks":"定时任务","context":"上下文","output":"输出","copiedCommandTooltip":"已复制!","copyCommandTooltip":"复制命令: claude -r {{sessionId}}","executedCommand":"执行了 `{{command}}`{{exitInfo}},输出:\\n```\\n{{output}}\\n```","executedCommandFailed":"执行 `{{command}}` 失败:{{error}}","skillExpansionPrompt":"请读取这个 skill 文件:"},"console":{"enterCommandOrUrl":"输入命令或网址开始使用","loadingMore":"加载中...","loadMoreHistory":"加载更多历史","quickCommands":"快捷命令","singleColumn":"单列布局","dualColumn":"双列布局","envVars":"环境变量","launchZsh":"启动 zsh 交互终端","inputPlaceholder":"输入命令或网址并按 Enter... (↑↓ 历史, Tab 补全)","scopeProject":"项目","scopeGlobal":"全局","tabSwitchEscClose":"Tab 切换 \xb7 Esc 关闭","copyOutput":"复制输出","copyCommand":"复制命令","rerun":"重新运行","deleteRecord":"删除记录","searchPlaceholder":"搜索...","searchMode":"搜索","filterMode":"过滤","prevShiftEnter":"上一个 (Shift+Enter)","nextEnter":"下一个 (Enter)","loadingTerminal":"加载终端...","clickToInput":"点击终端区域输入","stdinPlaceholder":"stdin 输入...","runningText":"运行中...","exitCode":"退出代码: {{code}}","totalLines":"共 {{count}} 行","globalCommands":"全局命令","projectCommands":"项目命令","noCustomCommands":"暂无自定义命令","namePlaceholder":"名称","commandPlaceholder":"命令","restoreTooltip":"还原 ({{modKey}}M / ESC)","screenshotting":"截图中...","outputFileDeleted":"[输出文件已删除]"},"browser":{"blankPage":"空白页","copyUrl":"复制网址","openInNewWindow":"在新窗口打开","exitMaximize":"退出最大化 ({{modKey}}M)","maximize":"最大化 ({{modKey}}M)","pageLoadFailed":"页面加载失败","clickToWake":"点击唤醒","sleeping":"已休眠","loadingPage":"加载中...","loadFailed":"加载失败"},"database":{"connectionFailed":"连接失败","connected":"已连接","connecting":"连接中...","refreshTableList":"刷新表列表","filterTable":"T 表","filterView":"V 视图","noTables":"无表","tabStructure":"结构","tabData":"数据","tabSql":"SQL","filterActive":"筛选: {{count}}列","clearAllFilters":"清除所有筛选","deleteNRows":"删除 {{count}} 行","confirmDeleteRows":"确认删除?","copyCsvSelected":"复制选中行为 CSV","copyCsvAll":"导出全表 CSV","copyJsonSelected":"复制选中行为 JSON","copyJsonAll":"导出全表 JSON","copyCSV":"复制 CSV","CSV":"CSV","copyJSON":"复制 JSON","JSON":"JSON","selectTable":"选择左侧表格","selectTableToView":"选择表以查看结构","selectTableForData":"选择表以查看数据","columns":"列","colName":"名称","colType":"类型","colNullable":"可空","colDefault":"默认值","primaryKey":"主键","foreignKeys":"外键","indexes":"索引","enable":"启用","commaValues":"逗号分隔多值","likePattern":"%pattern%","valuePlaceholder":"值","apply":"应用","clearFilter":"清除","addRow":"+ 新增行","totalRows":"{{count}} 行","rowsAffected":"{{command}} — {{count}} 行受影响 ({{duration}}ms)","queryRows":"{{count}} 行 ({{duration}}ms)","resultTruncated":"[结果已截断至1000行]","sqlPlaceholder":"输入 SQL... ({{modKey}}Enter 执行)","executing":"执行中...","execute":"▶ 执行","deleteRowsFailed":"{{count}} 行删除失败","inputParams":"输入参数","resultLabel":"结果"},"mysql":{"connectionFailed":"连接失败","connected":"已连接","connecting":"连接中...","refreshTableList":"刷新表列表","filterTable":"T 表","filterView":"V 视图","noTables":"无表","tabStructure":"结构","tabData":"数据","tabSql":"SQL","filterActive":"筛选: {{count}}列","clearAllFilters":"清除所有筛选","deleteNRows":"删除 {{count}} 行","confirmDeleteRows":"确认删除?","copyCsvSelected":"复制选中行为 CSV","copyCsvAll":"导出全表 CSV","copyJsonSelected":"复制选中行为 JSON","copyJsonAll":"导出全表 JSON","copyCSV":"复制 CSV","CSV":"CSV","copyJSON":"复制 JSON","JSON":"JSON","selectTable":"选择左侧表格","selectTableToView":"选择表以查看结构","selectTableForData":"选择表以查看数据","columns":"列","colName":"名称","colType":"类型","colNullable":"可空","colDefault":"默认值","primaryKey":"主键","foreignKeys":"外键","indexes":"索引","enable":"启用","commaValues":"逗号分隔多值","likePattern":"%pattern%","valuePlaceholder":"值","apply":"应用","clearFilter":"清除","addRow":"+ 新增行","totalRows":"{{count}} 行","rowsAffected":"{{command}} — {{count}} 行受影响 ({{duration}}ms)","queryRows":"{{count}} 行 ({{duration}}ms)","resultTruncated":"[结果已截断至1000行]","sqlPlaceholder":"输入 SQL... ({{modKey}}Enter 执行)","executing":"执行中...","execute":"▶ 执行","deleteRowsFailed":"{{count}} 行删除失败"},"redis":{"neverExpires":"永不过期","expired":"已过期","loadFailed":"加载失败","deleteFailed":"删除失败","saveFailed":"保存失败","scanPlaceholder":"SCAN 模式...","scanSearch":"搜索 (SCAN)","noKeys":"无 key","loadMore":"加载更多...","tabData":"数据","tabInfo":"信息","tabCli":"CLI","selectKey":"选择左侧 Key","keyNotExist":"Key 不存在","unsupportedType":"不支持的类型: {{type}}","nItems":"{{total}} items","showingN":"显示 {{count}}","nMembers":"{{total}} members","nEntries":"{{total}} entries","cliHint":"输入 Redis 命令,如 PING, GET key, KEYS *","cliPlaceholder":"输入命令..."},"git":{"switchBranch":"切换分支","searchBranch":"搜索分支...","noBranches":"无可切换分支","noMatchingBranches":"无匹配分支","localBranches":"本地分支","remoteBranches":"远程分支","branchNotFound":"未找到分支","selectBranch":"选择分支...","currentBranch":"当前","notGitRepo":"当前目录不是 Git 仓库","cannotGetBranches":"无法获取分支信息","getBranchesFailed":"获取分支信息失败","discardAllConfirm":"确定要放弃工作区的 {{count}} 个文件的变更吗?此操作不可恢复。","worktree":{"title":"Git Worktree","count":"{{count}} 个 worktree","selectBranch":"选择分支","addWorktree":"+ 添加 Worktree","confirmDelete":"确认删除","confirmDeleteMsg":"确定要删除 worktree 吗?","path":"路径:","branch":"分支:","locked":"已锁定","unlock":"解锁","lock":"锁定","searchBranch":"搜索分支...","noBranches":"无可用分支"}},"comments":{"addComment":"添加评论","lineRange":"行 {{start}}-{{end}}","inputPlaceholder":"输入评论...","newComment":"新评论 {{range}}","commentPlaceholder":"输入评论... ({{modKey}}Enter 提交, Esc 取消)","nComments":"{{count}} 条评论","allComments":"所有评论","copyAllComments":"复制全部评论","noComments":"暂无评论","clearAll":"清空所有","totalComments":"共 {{count}} 条评论","aiReply":"AI 回复","noContent":"(无内容)","linesCount":"({{count}} 行)","codeRef":"代码引用:","note":"备注: {{content}}","submitting":"提交中...","enterSubmit":"Enter 提交 \xb7 Shift+Enter 换行","askAI":"提问 AI","inputQuestion":"输入你的问题...","aiGenerating":"正在生成中,请稍候...","enterSend":"Enter 发送 \xb7 Shift+Enter 换行","sendToAI":"发送到 AI","aiResponding":"AI 正在响应中...","question":"问题: {{question}}"},"fileContextMenu":{"createFile":"新建文件","copyFile":"复制文件","copyFolder":"复制文件夹","pasteHere":"粘贴到此处","deleteFile":"删除文件","deleteFolder":"删除文件夹","copyRelativePath":"复制相对路径","copyAbsolutePath":"复制绝对路径","copyRelativeDirPath":"复制相对文件夹路径","copyAbsoluteDirPath":"复制绝对文件夹路径","copyFileName":"复制文件名","copyFolderName":"复制文件夹名"},"settings":{"title":"设置","theme":"主题","themeLight":"浅色","themeDark":"深色","themeSystem":"跟随系统","browserExtension":"浏览器插件","extensionInstalled":"Cockpit Bridge 已安装","extensionNotInstalled":"Cockpit Bridge 未安装","extensionDescription":"安装 Chrome 插件后,iframe 内的链接跳转将被拦截:新标签链接创建新气泡,页面内导航更新当前气泡。","installSteps":"安装步骤:","step1":"1. 打开 Chrome 地址栏输入","step2":"2. 开启右上角「开发者模式」","step3":"3. 点击「加载已解压的扩展程序」","step4mac":"4. 按 <kbd>Cmd+Shift+G</kbd> → 粘贴下方路径 → 回车","copyExtensionPath":"复制插件目录路径","reloadExtension":"重载插件","about":"关于","language":"语言","languageAuto":"跟随系统","switchDark":"切换暗色","switchLight":"切换亮色"},"editor":{"placeholder":"写点什么... 输入 / 打开快捷命令","noteTitle":"{{name}} - 笔记","noteUntitled":"笔记","saving":"保存中...","linkPlaceholder":"输入链接地址...","confirmLink":"确认","removeLink":"移除链接","heading1":"标题 1","heading2":"标题 2","heading3":"标题 3","bold":"粗体","italic":"斜体","strikethrough":"删除线","inlineCode":"行内代码","link":"链接","bulletList":"无序列表","orderedList":"有序列表","taskList":"待办列表","blockquote":"引用","codeBlock":"代码块","table":"表格","horizontalRule":"分割线","insertRowAbove":"在上方插入行","insertRowBelow":"在下方插入行","insertColumnLeft":"在左侧插入列","insertColumnRight":"在右侧插入列","deleteRow":"删除当前行","deleteColumn":"删除当前列","deleteTable":"删除表格","deleteCodeBlock":"删除代码块","toc":"目录","expandToc":"展开目录","collapseToc":"收起目录"},"slashCommands":{"heading1":"标题 1","heading1Desc":"大标题","heading2":"标题 2","heading2Desc":"中标题","heading3":"标题 3","heading3Desc":"小标题","bulletList":"无序列表","bulletListDesc":"项目符号列表","orderedList":"有序列表","orderedListDesc":"编号列表","taskList":"待办列表","taskListDesc":"可勾选的任务列表","blockquote":"引用","blockquoteDesc":"引用块","codeBlock":"代码块","codeBlockDesc":"代码片段","table":"表格","tableDesc":"插入 3\xd73 表格","horizontalRule":"分割线","horizontalRuleDesc":"水平分割线","link":"链接","linkDesc":"插入超链接"},"commands":{"qa":"进入需求澄清讨论模式","commit":"提交代码变更","review":"代码审查","test":"运行测试","fix":"修复问题","explain":"解释代码","refactor":"重构代码"},"review":{"reviewManagement":"评审管理","allReviews":"所有评审","noOpenReviews":"暂无开放评审","viewComments":"查看评论","nComments":"{{count}} 条评论","nDocs":"{{count}} 文档","nReviews":"{{count}} 评审","docList":"文档列表","allReviewsList":"所有评审","expandList":"展开列表","collapseList":"折叠列表","closeReview":"关闭评审","reopenReview":"重新开放","deleteReview":"删除评审","noOpenDocs":"暂无开放文档","noReviews":"暂无评审","sharing":"分享中","notShared":"未分享","closeSharing":"关闭分享","enableSharing":"开启分享评审","view":"查看","setNickname":"设置你的昵称","nicknameHint":"其他评审人将看到这个名字","nicknamePlaceholder":"输入昵称","skipForNow":"下次再说","identitySettings":"身份设置","reviewNickname":"评审昵称","random":"随机","selectTextToComment":"选中左侧文本添加评论","selectTextHint":"选中左侧文本即可添加评论","prevComment":"上一条","nextComment":"下一条","commentsCount":"{{count}} 条评论","commentsNavCount":"{{current}}/{{total}} 条评论","allCommentsTitle":"全部评论","commentsCountBrief":"{{count}} 条","closedCount":"{{count}} 条已关闭","copyAllComments":"复制全部评论","noComments":"暂无评论","closedComments":"已关闭 ({{count}})","closedLabel":"已关闭","moreReplies":"+{{count}} 条回复","copyComment":"复制评论","reopen":"重开","closeComment":"关闭评论","editComment":"编辑评论","deleteComment":"删除评论","edited":"(已编辑)","editReply":"编辑回复","deleteReply":"删除回复","reply":"回复","replyPlaceholder":"添加回复...","selectedText":"选中文本","addCommentPlaceholder":"添加评论...","enterSubmitHint":"Enter 提交,Shift+Enter 换行","commentBtn":"评论","reviewNotExist":"评审不存在或已被删除","loadFailed":"加载失败","networkError":"网络错误","reviewNotFound":"评审不存在","checkLink":"请检查链接是否正确","updatedAt":"更新于 {{date}}","active":"开放中","closed":"已关闭","viewAllComments":"查看全部评论","viewCommentBtn":"查看评论","copyLink":"复制链接","reviewSummary":"评审评论汇总 — {{title}}","totalNComments":"共 {{count}} 条评论","quoteRef":"引用: \\"{{text}}\\"","commentAuthor":"评论 ({{author}}): {{content}}","replyAuthor":" ↳ {{author}}: {{content}}"},"markdown":{"copied":"✓ 已复制","copy":"复制"},"imagePreview":{"previewImage":"预览图片","deleteImage":"删除图片"},"tokenStats":{"title":"Claude Code Token 统计","activeHours":"活跃时段分布","hourSessions":"{{h}}:00 — {{count}} 次会话","messages":"消息","toolCalls":"工具调用","activityTrend":"活动趋势","byModel":"按模型","tokenUsage":"Token 用量","equivalentCost":"等效费用","modelCostDetail":"模型费用明细","model":"模型","share":"占比","total":"合计","totalSessions":"总会话","totalMessages":"总消息","equivalentApiCost":"等效 API 费用","longestSession":"最长会话","firstUse":"首次使用","notFound":"未找到 ~/.claude/stats-cache.json","day":"日","week":"周","month":"月"},"toolCall":{"inputParams":"输入参数","resultLabel":"结果","inputParamsTitle":"查看输入参数","resultTitle":"查看结果","input":"输入","result":"结果","foldedLines":"... ({{count}} 行)"},"fileEditor":{"unsavedConfirm":"有未保存的修改,确定关闭?","discardChanges":"放弃修改","continueEditing":"继续编辑","externallyModified":"文件已被外部修改,保存将覆盖外部更改","useDiskVersion":"使用磁盘版本","forceOverwrite":"强制覆盖"},"quickFileOpen":{"placeholder":"输入文件名快速打开...","noMatch":"没有匹配的文件","recent":"最近","selectHint":"选择","openHint":"打开","closeHint":"关闭"},"envManager":{"title":"环境变量管理","tabScope":"当前 Tab 专用","globalScope":"全局环境变量","varNamePlaceholder":"变量名(如 NODE_ENV)","varValuePlaceholder":"值(如 production)","valuePlaceholder":"值","noVars":"还没有环境变量,添加一个试试"},"aliasManager":{"title":"命令别名管理","description":"为常用命令设置快捷别名(全局生效)","aliasPlaceholder":"别名(如 ll)","commandPlaceholder":"完整命令(如 ls -la)","fullCommandPlaceholder":"完整命令","usage":"使用提示:","usageDesc":"输入别名即可执行对应的完整命令","noAliases":"还没有命令别名,添加一个试试"},"diffViewer":{"fileChanges":"文件变更 ({{count}} 处)","selectFileToView":"选择左侧文件查看变更","sideBySide":"并列对比","unified":"统一对比","previewFile":"预览文件","copiedAll":"已复制全文","compact":"精简","full":"全文","gap":{"hidden":"已隐藏 {{count}} 行","more":"\xb7\xb7\xb7 更多 +{{count}} \xb7\xb7\xb7","expandUp":"向上展开 {{count}} 行","expandDown":"向下展开 {{count}} 行"}},"commitDetail":{"title":"提交详情","hash":"哈希:","author":"作者:","date":"日期:","files":"文件:","nChanges":"{{count}} 个变更","loadingFiles":"加载文件中...","noFileChanges":"无文件变更","loadingDiff":"加载差异中...","selectFileToView":"选择文件查看差异"},"askQuestion":{"title":"提问","nQuestions":"{{count}} 个问题","checkedN":"已勾选 {{count}}","copyChecked":"复制勾选的 {{count}} 个问答","copyAll":"复制所有问答","checkToCopy":"勾选以复制","custom":"自定义","customPlaceholder":"输入自定义回答...","notSelected":"(未选择)"},"tabBar":{"unpin":"取消固定","pin":"固定到常用会话","closeTab":"关闭标签","newTab":"新建标签"},"tabManagerTopBar":{"copyPageUrl":"复制页面地址","copyDirPath":"复制目录路径","refreshProject":"刷新当前项目","openInVSCode":"在 VS Code 中打开","openInCursor":"在 Cursor 中打开","aliasesGlobal":"命令别名(全局)","tokenStats":"Token 统计","openSurething":"打开 Surething"},"hoverTooltip":{"findReferences":"查找引用","search":"搜索"},"todoViewer":{"title":"任务列表","progress":"{{completed}} / {{total}} 完成"},"userMessages":{"title":"用户消息列表","noMessages":"暂无用户消息"},"shortIdBadge":{"clickToDisconnect":"点击断开连接","clickToRegister":"点击注册并复制 CLI 命令"},"api":{"pathForbidden":"不允许操作此路径","deleteForbidden":"不允许删除此路径","notAFolder":"目标不是文件夹","imageTooLarge":"图片文件过大,无法预览","cannotPreviewBinary":"无法预览二进制文件","fileTooLarge":"文件过大,无法预览(超过 10MB)","fileModifiedExternally":"文件已被外部修改","pickFolderPrompt":"选择项目文件夹"},"confirm":{"title":"提示","ok":"确定","cancel":"取消"},"floatingToolbar":{"addComment":"添加评论","sendToAI":"发送 AI","search":"搜索"},"searchResults":{"title":"搜索结果","nMatches":"({{count}} 处匹配)","searching":"搜索中...","noResults":"无匹配结果"},"references":{"title":"引用","searching":"搜索中...","notFound":"未找到引用"},"gitFileTree":{"noFiles":"无文件"},"reviewUtils":{"adjectives":["快乐","勇敢","安静","明亮","温柔","灵巧","自由","清澈","飞翔","悠闲","活泼","聪慧","淡定","机敏","从容","坚定","爽朗","和煦","奔放","沉稳"],"nouns":["熊猫","海豚","白鹤","雪豹","云雀","松鼠","飞鱼","梅花鹿","青鸟","银狐","猫头鹰","蜻蜓","萤火虫","海龟","蝴蝶","金丝猴","丹顶鹤","羚羊","燕子","企鹅"]}}');d.Ay.isInitialized||d.Ay.init({resources:{en:{translation:e},zh:{translation:f}},lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});let g=d.Ay},2633:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{d:()=>k});var e=c(48249),f=c(67484),g=c(87844),h=c(55287),i=c(7833);c(33281),c(80532);var j=a([h]);function k({skillId:a,onClose:b}){let[c,d]=(0,f.useState)(null),[j,l]=(0,f.useState)(!0),[m,n]=(0,f.useState)("preview"),o=(0,f.useCallback)(async()=>{if(c?.path)try{await navigator.clipboard.writeText(c.path),(0,i.oR)("Path copied","success")}catch{(0,i.oR)("Failed to copy","error")}},[c]);return(0,e.jsxs)("div",{className:"fixed inset-0 z-[70] flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:b}),(0,e.jsxs)("div",{className:"relative bg-card rounded-lg shadow-xl w-full max-w-4xl h-[85vh] mx-4 flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-foreground truncate",children:c?.name?`/${c.name}`:"Skill Preview"}),(0,e.jsx)("button",{onClick:o,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:"Copy path",children:(0,e.jsxs)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]})})]}),c?.path&&(0,e.jsx)("div",{className:"text-xs text-muted-foreground font-mono truncate mt-0.5",children:c.path})]}),(0,e.jsxs)("div",{className:"flex items-center rounded-md border border-border overflow-hidden text-xs flex-shrink-0",children:[(0,e.jsx)("button",{onClick:()=>n("preview"),className:`px-3 py-1 transition-colors ${"preview"===m?"bg-brand text-white":"text-muted-foreground hover:text-foreground hover:bg-accent"}`,children:"Preview"}),(0,e.jsx)("button",{onClick:()=>n("source"),className:`px-3 py-1 transition-colors ${"source"===m?"bg-brand text-white":"text-muted-foreground hover:text-foreground hover:bg-accent"}`,children:"Source"})]}),(0,e.jsx)("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors flex-shrink-0",title:"Close",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:j?(0,e.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"Loading..."}):c&&c.valid?"preview"===m?(0,e.jsx)("div",{className:"px-6 py-4",children:(0,e.jsx)(g.T,{content:c.content})}):(0,e.jsx)(h.XO,{content:c.content,filePath:c.path,className:"min-h-full"}):(0,e.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"File cannot be read."})})]})]})}h=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},2929:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{s:()=>z});var e=c(48249),f=c(67484),g=c(44256),h=c(7833),i=c(49681),j=c(21735),k=c(33740),l=c(55313),m=c(32616),n=c(80983),o=c(69424),p=c(57632),q=c(73887),r=c(7122),s=c(87844),t=c(33281),u=c(41224),v=c(44384),w=a([q,n,p,o]);function x({image:a,onClose:b}){let{t:c}=(0,v.Bd)(),d=(0,e.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:b,children:[(0,e.jsx)("button",{onClick:b,className:"absolute top-4 right-4 w-10 h-10 flex items-center justify-center text-white/80 hover:text-white bg-black/40 hover:bg-black/60 rounded-full transition-colors",children:(0,e.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),(0,e.jsx)("img",{src:`data:${a.media_type};base64,${a.data}`,alt:c("chat.imagePreview"),className:"max-w-[90vw] max-h-[90vh] object-contain",onClick:a=>a.stopPropagation()})]});return(0,e.jsx)(g.ZL,{children:d})}function y({filePath:a,content:b,cwd:c,onClose:d}){let[h,i]=(0,f.useState)(null);return(0,e.jsx)(g.ZL,{children:(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:d,children:(0,e.jsx)("div",{ref:i,className:"bg-card rounded-lg shadow-xl w-full max-w-[90%] h-[90vh] flex flex-col relative",onClick:a=>a.stopPropagation(),children:(0,e.jsx)(r.SU,{container:h,children:(0,e.jsx)(q.M,{content:b,filePath:a,cwd:c,onClose:d})})})})})}[q,n,p,o]=w.then?(await w)():w;let z=(0,f.memo)(function({message:a,cwd:b,sessionId:c,onFork:d}){let g,q,r,w,{t:z}=(0,v.Bd)(),[A,B]=(0,f.useState)(null),[C,D]=(0,f.useState)(()=>1===(a.toolCalls?.length||0)),[E,F]=(0,f.useState)(!1),[G,H]=(0,f.useState)(!1),I="user"===a.role,J=a.images&&a.images.length>0,K=a.toolCalls?.length||0,L=K>0,M=!!c&&!!b&&!!d,N=(0,f.useMemo)(()=>a.toolCalls?.some(a=>"Edit"===a.name||"Write"===a.name)||!1,[a.toolCalls]),O=(0,f.useMemo)(()=>{if(!a.toolCalls)return null;for(let b=a.toolCalls.length-1;b>=0;b--)if("TodoWrite"===a.toolCalls[b].name)return a.toolCalls[b];return null},[a.toolCalls]),P=(0,f.useMemo)(()=>a.toolCalls?a.toolCalls.filter(a=>"AskUserQuestion"===a.name):[],[a.toolCalls]),Q=(0,f.useMemo)(()=>{if(!a.toolCalls)return[];let b=new Set,c=[];for(let d of a.toolCalls)if("Read"===d.name||"Edit"===d.name||"Write"===d.name){let a=d.input.file_path;a&&a.toLowerCase().endsWith(".md")&&!b.has(a)&&(b.add(a),c.push(a))}return c},[a.toolCalls]),R=(0,f.useMemo)(()=>{if(!a.toolCalls)return[];let b=[];for(let c of a.toolCalls){let a=c.input?.thought;if(a&&"string"==typeof a){let d=a.match(/PREVIOUS:\s*(.*?)\s*→\s*THIS:\s*(.*?)\s*→\s*EXPECT:\s*(.*)/i);d?b.push({previous:d[1].trim(),current:d[2].trim(),expect:d[3].trim(),raw:a,toolName:c.name}):b.push({previous:"",current:a,expect:"",raw:a,toolName:c.name})}}return b},[a.toolCalls]),[S,T]=(0,f.useState)(null),[U,V]=(0,f.useState)(null);(0,f.useEffect)(()=>{if(!S)return void queueMicrotask(()=>V(null));let a=!1;return t.t4.runPromiseExit((0,u.an)(S)).then(b=>{a||("Success"===b._tag&&void 0!==b.value.content?V(b.value.content):((0,h.oR)(z("toast.readFileFailed"),"error"),T(null)))}),()=>{a=!0}},[S,z]);let W=()=>{a.content&&(navigator.clipboard.writeText(a.content),(0,h.oR)(z("toast.copiedMessage")))},X=()=>{M&&d(a.id)},Y=(a=>{if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`})(a.timestamp);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:`flex flex-col ${I?"items-end":"items-start"} mb-4 group`,"data-role":a.role,children:[Y&&(0,e.jsx)("span",{className:"text-[11px] text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity mb-0.5 px-1",children:Y}),(0,e.jsxs)("div",{className:`flex ${I?"justify-end":"justify-start"} w-full`,children:[I&&(0,e.jsxs)("div",{className:"self-start mt-2 mr-1 flex flex-col gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[a.content&&(0,e.jsx)("button",{onClick:W,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent",title:z("chat.copyMessage"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),M&&(0,e.jsx)("button",{onClick:X,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent",title:z("chat.forkSession"),children:(0,e.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("circle",{cx:"12",cy:"18",r:"3"}),(0,e.jsx)("circle",{cx:"6",cy:"6",r:"3"}),(0,e.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,e.jsx)("path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9"}),(0,e.jsx)("path",{d:"M12 12v3"})]})})]}),(0,e.jsxs)("div",{className:`max-w-[80%] ${I?"bg-accent text-foreground border border-brand rounded-2xl rounded-br-md":"bg-accent text-foreground dark:text-slate-11 rounded-2xl rounded-bl-md"} px-4 py-2`,children:[J&&(0,e.jsx)("div",{className:`flex flex-wrap gap-2 ${a.content?"mb-2":""}`,children:a.images.map((a,b)=>(0,e.jsx)("div",{className:"relative w-16 h-16 rounded-lg overflow-hidden border border-white/20 cursor-pointer hover:opacity-90 transition-opacity",onClick:()=>B(a),children:(0,e.jsx)("img",{src:`data:${a.media_type};base64,${a.data}`,alt:z("chat.imageN",{index:b+1}),className:"w-full h-full object-cover"})},b))}),a.content&&(0,e.jsxs)("div",{className:"break-words",children:[(0,e.jsx)(s.T,{content:a.content,isUser:I,isStreaming:a.isStreaming,enableMath:!1}),a.isStreaming&&(0,e.jsx)("span",{className:"inline-block w-2 h-4 ml-1 bg-current animate-pulse"})]}),O&&(g=O.input?.todos,r=(q=Array.isArray(g)?g:[]).filter(a=>"completed"===a.status).length,w=q.length,(0,e.jsx)("div",{className:`${a.content||J?"mt-2":""}`,children:(0,e.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden bg-secondary/50 px-3 py-2 space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,e.jsx)("div",{className:"flex-1 h-1 bg-secondary rounded-full overflow-hidden",children:(0,e.jsx)("div",{className:"h-full bg-green-500 rounded-full transition-all duration-300",style:{width:`${w>0?r/w*100:0}%`}})}),(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:[r,"/",w]})]}),q.map((a,b)=>(0,e.jsxs)("div",{className:`flex items-center gap-1.5 ${"completed"===a.status?"opacity-50":""}`,children:["completed"===a.status?(0,e.jsx)(i.A,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):"in_progress"===a.status?(0,e.jsx)(j.A,{className:"w-3 h-3 text-brand flex-shrink-0 animate-spin"}):(0,e.jsx)(k.A,{className:"w-3 h-3 text-muted-foreground flex-shrink-0"}),(0,e.jsx)("span",{className:`text-xs truncate ${"completed"===a.status?"text-muted-foreground":"text-foreground"}`,children:"in_progress"===a.status&&a.activeForm?a.activeForm:a.content})]},b))]})})),Q.length>0&&(0,e.jsx)("div",{className:`${a.content||J||O?"mt-2":""}`,children:(0,e.jsx)("div",{className:"border border-border rounded-lg overflow-hidden bg-secondary/50 px-3 py-2 space-y-0.5",children:Q.map(a=>(0,e.jsxs)("button",{onClick:()=>T(a),className:"flex items-center gap-1.5 w-full text-left hover:bg-accent rounded px-1 py-0.5 transition-colors group/md",children:[(0,e.jsx)("svg",{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground group-hover/md:text-foreground truncate",children:a.split("/").pop()})]},a))})}),R.length>0&&(0,e.jsx)("div",{className:`${a.content||J||O||Q.length>0?"mt-2":""}`,children:(0,e.jsx)("div",{className:"border border-border rounded-lg overflow-hidden bg-secondary/50",children:(0,e.jsxs)("table",{className:"w-full text-xs",children:[(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{className:"border-b border-border text-muted-foreground",children:[(0,e.jsx)("th",{className:"px-2 py-1.5 text-left font-medium w-[60px]",children:"Tool"}),(0,e.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",children:"Previous"}),(0,e.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",children:"Action"}),(0,e.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",children:"Expect"})]})}),(0,e.jsx)("tbody",{children:R.map((a,b)=>(0,e.jsxs)("tr",{className:b<R.length-1?"border-b border-border/50":"",children:[(0,e.jsx)("td",{className:"px-2 py-1 text-muted-foreground font-mono",children:a.toolName}),(0,e.jsx)("td",{className:"px-2 py-1 text-muted-foreground",children:a.previous||"—"}),(0,e.jsx)("td",{className:"px-2 py-1 text-foreground",children:a.current}),(0,e.jsx)("td",{className:"px-2 py-1 text-muted-foreground",children:a.expect||"—"})]},b))})]})})}),a.toolCalls&&a.toolCalls.length>0&&(0,e.jsx)("div",{className:`${a.content||J?"mt-2":""}`,children:L?(0,e.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden bg-secondary",children:[(0,e.jsxs)("div",{className:"flex items-center",children:[(0,e.jsxs)("button",{onClick:()=>D(!C),className:"flex-1 px-3 py-2 flex items-center gap-2 text-left hover:bg-accent transition-colors active:bg-muted",children:[(0,e.jsx)("span",{className:"text-lg",children:"\uD83D\uDD27"}),(0,e.jsx)("span",{className:"font-medium text-foreground",children:z("chat.toolCalls",{count:K})}),(0,e.jsx)("span",{className:"ml-auto text-muted-foreground text-sm",children:C?z("chat.collapse"):z("chat.expand")})]}),P.length>0&&(0,e.jsx)("button",{onClick:()=>H(!0),className:"px-3 py-2 text-muted-foreground hover:text-foreground hover:bg-accent transition-colors border-l border-border",title:z("chat.viewQuestions"),children:(0,e.jsx)(l.A,{className:"w-4 h-4"})}),N&&(0,e.jsx)("button",{onClick:()=>F(!0),className:"px-3 py-2 text-muted-foreground hover:text-foreground hover:bg-accent transition-colors border-l border-border",title:z("chat.viewAllFileChanges"),children:(0,e.jsx)(m.A,{className:"w-4 h-4"})})]}),C&&(0,e.jsx)("div",{className:"border-t border-border p-2 space-y-1",children:a.toolCalls.map((a,c)=>(0,e.jsx)(n.K,{toolCall:a,cwd:b},`${a.id}-${c}`))})]}):a.toolCalls.map((a,c)=>(0,e.jsx)(n.K,{toolCall:a,cwd:b},`${a.id}-${c}`))})]}),!I&&(0,e.jsxs)("div",{className:"self-start mt-2 ml-1 flex flex-col gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[a.content&&(0,e.jsx)("button",{onClick:W,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent",title:z("chat.copyMessage"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),M&&(0,e.jsx)("button",{onClick:X,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent",title:z("chat.forkSession"),children:(0,e.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("circle",{cx:"12",cy:"18",r:"3"}),(0,e.jsx)("circle",{cx:"6",cy:"6",r:"3"}),(0,e.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,e.jsx)("path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9"}),(0,e.jsx)("path",{d:"M12 12v3"})]})})]})]})]}),A&&(0,e.jsx)(x,{image:A,onClose:()=>B(null)}),E&&a.toolCalls&&(0,e.jsx)(p.z,{toolCalls:a.toolCalls,cwd:b,onClose:()=>F(!1)}),G&&P.length>0&&(0,e.jsx)(o.$,{toolCalls:P,onClose:()=>H(!1)}),S&&null!==U&&(0,e.jsx)(y,{filePath:S,content:U,cwd:b||"",onClose:()=>T(null)})]})});d()}catch(a){d(a)}})},3033:(a,b,c)=>{"use strict";c.d(b,{w:()=>p});var d=c(48249),e=c(67484),f=c(44384);c(33281),c(41224);let g={"claude-opus-4-6":{label:"Opus 4.6",input:5,output:25,cacheRead:.5,cacheWrite:6.25,color:"#f97316"},"claude-opus-4-5-20251101":{label:"Opus 4.5",input:5,output:25,cacheRead:.5,cacheWrite:6.25,color:"#fb923c"},"claude-sonnet-4-6":{label:"Sonnet 4.6",input:3,output:15,cacheRead:.3,cacheWrite:3.75,color:"#3b82f6"},"claude-sonnet-4-5-20250929":{label:"Sonnet 4.5",input:3,output:15,cacheRead:.3,cacheWrite:3.75,color:"#60a5fa"},"claude-haiku-4-5-20251001":{label:"Haiku 4.5",input:1,output:5,cacheRead:.1,cacheWrite:1.25,color:"#22c55e"}},h={label:"",input:3,output:15,cacheRead:.3,cacheWrite:3.75,color:"#94a3b8"};function i(a){if(g[a])return g[a];let b=a.toLowerCase();return b.includes("opus")?{...h,input:5,output:25,cacheRead:.5,cacheWrite:6.25,color:"#f97316"}:b.includes("haiku")?{...h,input:1,output:5,cacheRead:.1,cacheWrite:1.25,color:"#22c55e"}:h}function j(a){let b=g[a];return b?b.label:a.replace(/^claude-/,"").replace(/-\d{8}$/,"").replace(/-/g," ").replace(/\b\w/g,a=>a.toUpperCase())}function k(a){return(g[a]??i(a)).color}function l(a){return a>=1e9?`${(a/1e9).toFixed(1)}B`:a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(1)}K`:String(a)}function m(a){return a>=1e3?`$${a.toFixed(0)}`:a>=100?`$${a.toFixed(1)}`:`$${a.toFixed(2)}`}function n({data:a,height:b=200,formatValue:c=l}){let f=(0,e.useRef)(null),g=(0,e.useRef)(null),[h,i]=(0,e.useState)(null),j=(0,e.useRef)([]);(0,e.useCallback)(()=>{let d=f.current,e=g.current;if(!d||!e)return;let h=window.devicePixelRatio||1,i=e.getBoundingClientRect().width;d.width=i*h,d.height=b*h,d.style.width=`${i}px`,d.style.height=`${b}px`;let k=d.getContext("2d");k.scale(h,h),k.clearRect(0,0,i,b);let{labels:l,datasets:m}=a;if(0===l.length)return;let n=i-50-12,o=b-8-28,p=function(a){if(a<=0)return 1;let b=Math.pow(10,Math.floor(Math.log10(a))),c=a/b;return c<=1?b:c<=2?2*b:c<=5?5*b:10*b}(Math.max(1,...l.map((a,b)=>m.reduce((a,c)=>a+c.data[b],0))));k.fillStyle=getComputedStyle(d).getPropertyValue("color")||"#888",k.font="10px ui-monospace, monospace",k.textAlign="right",k.textBaseline="middle";for(let a=0;a<=4;a++){var q;let b=p/4*a,e=8+o-b/p*o;k.fillText(c(b),44,e),k.strokeStyle=(q="--border",getComputedStyle(d).getPropertyValue(q).trim()||"#333"),k.lineWidth=.5,k.beginPath(),k.moveTo(50,e),k.lineTo(50+n,e),k.stroke()}let r=n/l.length,s=Math.max(4,Math.min(.6*r,32)),t=[];l.forEach((a,b)=>{let c=50+b*r+(r-s)/2,e=0;m.forEach(d=>{var f,g,h,i,j,l;let m=d.data[b];if(m<=0)return;let n=m/p*o,q=8+o-e-n;k.fillStyle=d.color,f=k,g=c,h=q,i=s,l=2,(j=n)<1||(l=Math.min(l,j/2,i/2),f.beginPath(),f.moveTo(g+l,h),f.lineTo(g+i-l,h),f.quadraticCurveTo(g+i,h,g+i,h+l),f.lineTo(g+i,h+j-l),f.quadraticCurveTo(g+i,h+j,g+i-l,h+j),f.lineTo(g+l,h+j),f.quadraticCurveTo(g,h+j,g,h+j-l),f.lineTo(g,h+l),f.quadraticCurveTo(g,h,g+l,h),f.fill()),t.push({x:c,y:q,w:s,h:n,label:a,value:m,dataset:d.label,color:d.color}),e+=n}),k.fillStyle=getComputedStyle(d).getPropertyValue("color")||"#888",k.font="9px ui-monospace, monospace",k.textAlign="center",k.textBaseline="top",b%(l.length>20?Math.ceil(l.length/15):1)==0&&k.fillText(a,c+s/2,8+o+6)}),j.current=t},[a,b,c]);let k=(0,e.useCallback)(a=>{let b=f.current?.getBoundingClientRect();if(!b)return;let d=a.clientX-b.left,e=a.clientY-b.top,g=j.current.find(a=>d>=a.x&&d<=a.x+a.w&&e>=a.y&&e<=a.y+a.h);g?i({x:a.clientX-b.left,y:g.y-4,content:`${g.dataset}: ${c(g.value)}`}):i(null)},[c]);return(0,d.jsxs)("div",{ref:g,className:"relative w-full text-muted-foreground",children:[(0,d.jsx)("canvas",{ref:f,className:"w-full",style:{height:b},onMouseMove:k,onMouseLeave:()=>i(null)}),h&&(0,d.jsx)("div",{className:"absolute pointer-events-none bg-popover text-popover-foreground text-[10px] px-2 py-1 rounded shadow-lg border border-border whitespace-nowrap z-10",style:{left:h.x,top:h.y,transform:"translate(-50%, -100%)"},children:h.content})]})}function o({hourCounts:a}){let{t:b}=(0,f.Bd)(),c=Math.max(1,...Object.values(a)),e=Array.from({length:24},(a,b)=>b);return(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:b("tokenStats.activeHours")}),(0,d.jsx)("div",{className:"flex gap-[2px] items-end h-16",children:e.map(e=>{let f=a[String(e)]||0,g=f/c;return(0,d.jsxs)("div",{className:"flex-1 flex flex-col items-center gap-0.5",title:b("tokenStats.hourSessions",{h:e,count:f}),children:[(0,d.jsx)("div",{className:"w-full rounded-sm transition-all",style:{height:`${Math.max(2,48*g)}px`,backgroundColor:g>0?`rgba(59, 130, 246, ${.2+.8*g})`:"var(--muted)"}}),e%3==0&&(0,d.jsx)("span",{className:"text-[8px] text-muted-foreground",children:e})]},e)})})]})}function p({isOpen:a,onClose:b}){var c;let g,h,{t:r}=(0,f.Bd)(),[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(!0),[w,x]=(0,e.useState)("day"),[y,z]=(0,e.useState)("tokens"),[A,B]=(0,e.useState)("claude"),C=(0,e.useMemo)(()=>s?.modelUsage?Object.entries(s.modelUsage).filter(([a])=>!a.startsWith("<")).map(([a,b])=>{let c;return{id:a,label:j(a),color:k(a),usage:b,cost:(c=i(a),b.inputTokens/1e6*c.input+b.outputTokens/1e6*c.output+b.cacheReadInputTokens/1e6*c.cacheRead+b.cacheCreationInputTokens/1e6*c.cacheWrite),totalTokens:b.inputTokens+b.outputTokens+b.cacheReadInputTokens+b.cacheCreationInputTokens}}).sort((a,b)=>b.cost-a.cost):[],[s]),D=(0,e.useMemo)(()=>C.reduce((a,b)=>a+b.cost,0),[C]),E=(0,e.useMemo)(()=>C.map(a=>a.id),[C]),F=(0,e.useMemo)(()=>{let a={};for(let b of C)a[b.id]=b.totalTokens>0?b.cost/b.totalTokens:0;return a},[C]),{activityChart:G,tokenChart:H,costChart:I}=(0,e.useMemo)(()=>{let a=s?.dailyActivity||[],b=s?.dailyModelTokens||[];if("day"===w){let c=a.slice(-60),d=b.slice(-60),e={labels:c.map(a=>a.date.slice(5)),datasets:[{label:r("tokenStats.messages"),data:c.map(a=>a.messageCount),color:"#3b82f6"},{label:r("tokenStats.toolCalls"),data:c.map(a=>a.toolCallCount),color:"#22c55e"}]},f=d.map(a=>a.date.slice(5));return{activityChart:e,tokenChart:{labels:f,datasets:E.map(a=>({label:j(a),data:d.map(b=>b.tokensByModel[a]||0),color:k(a)}))},costChart:{labels:f,datasets:E.map(a=>({label:j(a),data:d.map(b=>(b.tokensByModel[a]||0)*(F[a]||0)),color:k(a)}))}}}if("week"===w){let c=function(a,b){let c=new Map;for(let b of a){let a=new Date(b.date),d=new Date(a);d.setDate(a.getDate()-a.getDay());let e=d.toISOString().slice(0,10),f=e.slice(5);c.has(e)||c.set(e,{label:f,messages:0,sessions:0,tools:0,tokensByModel:{}});let g=c.get(e);g.messages+=b.messageCount,g.sessions+=b.sessionCount,g.tools+=b.toolCallCount}for(let a of b){let b=new Date(a.date),d=new Date(b);d.setDate(b.getDate()-b.getDay());let e=d.toISOString().slice(0,10);c.has(e)||c.set(e,{label:e.slice(5),messages:0,sessions:0,tools:0,tokensByModel:{}});let f=c.get(e);for(let[b,c]of Object.entries(a.tokensByModel))f.tokensByModel[b]=(f.tokensByModel[b]||0)+c}return Array.from(c.values()).sort((a,b)=>a.label.localeCompare(b.label))}(a,b),d=c.map(a=>a.label),e={labels:d,datasets:[{label:r("tokenStats.messages"),data:c.map(a=>a.messages),color:"#3b82f6"},{label:r("tokenStats.toolCalls"),data:c.map(a=>a.tools),color:"#22c55e"}]};return{activityChart:e,tokenChart:{labels:d,datasets:E.map(a=>({label:j(a),data:c.map(b=>b.tokensByModel[a]||0),color:k(a)}))},costChart:{labels:d,datasets:E.map(a=>({label:j(a),data:c.map(b=>(b.tokensByModel[a]||0)*(F[a]||0)),color:k(a)}))}}}let c=function(a,b){let c=new Map;for(let b of a){let a=b.date.slice(0,7);c.has(a)||c.set(a,{label:a,messages:0,sessions:0,tools:0,tokensByModel:{}});let d=c.get(a);d.messages+=b.messageCount,d.sessions+=b.sessionCount,d.tools+=b.toolCallCount}for(let a of b){let b=a.date.slice(0,7);c.has(b)||c.set(b,{label:b,messages:0,sessions:0,tools:0,tokensByModel:{}});let d=c.get(b);for(let[b,c]of Object.entries(a.tokensByModel))d.tokensByModel[b]=(d.tokensByModel[b]||0)+c}return Array.from(c.values()).sort((a,b)=>a.label.localeCompare(b.label))}(a,b),d=c.map(a=>a.label),e={labels:d,datasets:[{label:r("tokenStats.messages"),data:c.map(a=>a.messages),color:"#3b82f6"},{label:r("tokenStats.toolCalls"),data:c.map(a=>a.tools),color:"#22c55e"}]};return{activityChart:e,tokenChart:{labels:d,datasets:E.map(a=>({label:j(a),data:c.map(b=>b.tokensByModel[a]||0),color:k(a)}))},costChart:{labels:d,datasets:E.map(a=>({label:j(a),data:c.map(b=>(b.tokensByModel[a]||0)*(F[a]||0)),color:k(a)}))}}},[s,w,E,F,r]);if(!a)return null;let J=[{key:"day",label:r("tokenStats.day")},{key:"week",label:r("tokenStats.week")},{key:"month",label:r("tokenStats.month")}];return(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:b}),(0,d.jsxs)("div",{className:"relative bg-card rounded-xl shadow-xl w-full max-w-4xl mx-4 max-h-[90vh] flex flex-col overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border flex-shrink-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("h2",{className:"text-sm font-medium text-foreground",children:r("tokenStats.title")}),(0,d.jsx)("div",{className:"flex bg-muted rounded-md p-0.5",children:["claude","claude2"].map(a=>(0,d.jsx)("button",{className:`px-2.5 py-0.5 text-[11px] rounded transition-colors ${A===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>{t(null),B(a)},children:"claude"===a?"Claude":"Claude 2"},a))}),(0,d.jsx)("div",{className:"flex bg-muted rounded-md p-0.5",children:J.map(a=>(0,d.jsx)("button",{className:`px-2.5 py-0.5 text-[11px] rounded transition-colors ${w===a.key?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>x(a.key),children:a.label},a.key))})]}),(0,d.jsx)("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-6",children:u?(0,d.jsx)("div",{className:"text-center text-muted-foreground py-12",children:r("common.loading")}):s?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"grid grid-cols-5 gap-3",children:[(0,d.jsx)(q,{label:r("tokenStats.totalSessions"),value:String(s.totalSessions??0)}),(0,d.jsx)(q,{label:r("tokenStats.totalMessages"),value:l(s.totalMessages??0)}),(0,d.jsx)(q,{label:r("tokenStats.equivalentApiCost"),value:m(D),highlight:!0}),(0,d.jsx)(q,{label:r("tokenStats.longestSession"),value:s.longestSession?(g=Math.floor((c=s.longestSession.duration)/36e5),h=Math.floor(c%36e5/6e4),g>0?`${g}h ${h}m`:`${h}m`):"-"}),(0,d.jsx)(q,{label:r("tokenStats.firstUse"),value:s.firstSessionDate?s.firstSessionDate.slice(0,10):"-"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,d.jsx)("h3",{className:"text-xs font-medium text-muted-foreground",children:r("tokenStats.activityTrend")}),(0,d.jsxs)("div",{className:"flex items-center gap-3 text-[10px]",children:[(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("span",{className:"inline-block w-2.5 h-2.5 rounded-sm",style:{backgroundColor:"#3b82f6"}}),r("tokenStats.messages")]}),(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("span",{className:"inline-block w-2.5 h-2.5 rounded-sm",style:{backgroundColor:"#22c55e"}}),r("tokenStats.toolCalls")]})]})]}),(0,d.jsx)("div",{className:"border border-border rounded-lg p-3 bg-muted/20",children:(0,d.jsx)(n,{data:G,height:180})})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h3",{className:"text-xs font-medium text-muted-foreground",children:r("tokenStats.byModel")}),(0,d.jsxs)("div",{className:"flex bg-muted rounded-md p-0.5",children:[(0,d.jsx)("button",{className:`px-2.5 py-0.5 text-[11px] rounded transition-colors ${"tokens"===y?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>z("tokens"),children:r("tokenStats.tokenUsage")}),(0,d.jsx)("button",{className:`px-2.5 py-0.5 text-[11px] rounded transition-colors ${"cost"===y?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>z("cost"),children:r("tokenStats.equivalentCost")})]})]}),(0,d.jsx)("div",{className:"flex items-center gap-3 text-[10px] flex-wrap",children:C.map(a=>(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("span",{className:"inline-block w-2.5 h-2.5 rounded-sm",style:{backgroundColor:a.color}}),a.label]},a.id))})]}),(0,d.jsx)("div",{className:"border border-border rounded-lg p-3 bg-muted/20",children:(0,d.jsx)(n,{data:"tokens"===y?H:I,height:180,formatValue:"tokens"===y?l:m})})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:r("tokenStats.modelCostDetail")}),(0,d.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:(0,d.jsxs)("table",{className:"w-full text-xs",children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{className:"bg-muted/50 text-muted-foreground",children:[(0,d.jsx)("th",{className:"text-left px-3 py-2 font-medium",children:r("tokenStats.model")}),(0,d.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:"Input"}),(0,d.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:"Output"}),(0,d.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:"Cache Read"}),(0,d.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:"Cache Write"}),(0,d.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:r("tokenStats.share")}),(0,d.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:r("tokenStats.equivalentCost")})]})}),(0,d.jsxs)("tbody",{children:[C.map(a=>(0,d.jsxs)("tr",{className:"border-t border-border",children:[(0,d.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:a.color}}),a.label]})}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:l(a.usage.inputTokens)}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:l(a.usage.outputTokens)}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:l(a.usage.cacheReadInputTokens)}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:l(a.usage.cacheCreationInputTokens)}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:D>0?`${(a.cost/D*100).toFixed(1)}%`:"-"}),(0,d.jsx)("td",{className:"px-3 py-2 text-right font-medium text-foreground",children:m(a.cost)})]},a.id)),(0,d.jsxs)("tr",{className:"border-t-2 border-border bg-muted/30",children:[(0,d.jsx)("td",{className:"px-3 py-2 font-medium text-foreground",children:r("tokenStats.total")}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:l(C.reduce((a,b)=>a+b.usage.inputTokens,0))}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:l(C.reduce((a,b)=>a+b.usage.outputTokens,0))}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:l(C.reduce((a,b)=>a+b.usage.cacheReadInputTokens,0))}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:l(C.reduce((a,b)=>a+b.usage.cacheCreationInputTokens,0))}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:"100%"}),(0,d.jsx)("td",{className:"px-3 py-2 text-right font-bold text-foreground",children:m(D)})]})]})]})})]}),s.hourCounts&&Object.keys(s.hourCounts).length>0&&(0,d.jsx)("div",{className:"border border-border rounded-lg p-3 bg-muted/20",children:(0,d.jsx)(o,{hourCounts:s.hourCounts})})]}):(0,d.jsx)("div",{className:"text-center text-muted-foreground py-12",children:r("tokenStats.notFound")})})]})]})}function q({label:a,value:b,highlight:c}){return(0,d.jsxs)("div",{className:"bg-muted/30 rounded-lg px-3 py-2.5",children:[(0,d.jsx)("div",{className:"text-[10px] text-muted-foreground",children:a}),(0,d.jsx)("div",{className:`text-sm font-semibold mt-0.5 ${c?"text-brand":"text-foreground"}`,children:b})]})}},3406:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(48249),e=c(3560),f=c(18792),g=c(74493),h=a([f]);f=(h.then?(await h)():h)[0],(0,e.Aq)({type:"neo4j",idPrefix:"neo4j",match(a){let b=a.trim().toLowerCase();return b.startsWith("neo4j://")||b.startsWith("neo4j+s://")||b.startsWith("bolt://")||b.startsWith("bolt+s://")},parse(a){let b=a.trim(),c=b;try{let a=new URL(b);c=`${a.hostname}${a.port?":"+a.port:":7687"}`}catch{}return{connectionString:b,displayName:c}},fromHistory:a=>({connectionString:a.connectionString,displayName:a.displayName||a.connectionString}),toHistory:a=>({connectionString:a.connectionString,displayName:a.displayName}),Component:function({item:a,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l}){return(0,d.jsx)(f.P,{id:a.id,connectionString:a.connectionString,displayName:a.displayName,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l})},async onClose(a){await (0,g.ax)("neo4j",a.id)}}),b()}catch(a){b(a)}})},3560:(a,b,c)=>{"use strict";c.d(b,{Aq:()=>e,lf:()=>h,sd:()=>f,sk:()=>g});let d=new Map;function e(a){d.set(a.type,a)}function f(a){return d.get(a)}function g(a){for(let b of d.values())if(b.match(a))return b;return null}function h(a){return`${a}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}},3588:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{TabBar:()=>l});var e=c(48249),f=c(67484),g=c(72529),h=c(44256),i=c(44384);function j({number:a,isActive:b}){return(0,e.jsxs)("svg",{className:`w-5 h-5 flex-shrink-0 ${b?"text-brand":"text-muted-foreground"}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,e.jsx)("text",{x:"12",y:"16",textAnchor:"middle",fill:"currentColor",stroke:"none",fontSize:"12",fontWeight:"500",children:a})]})}function k({onNewTab:a,onNewClaude2Tab:b,onNewCodexTab:c,onNewKimiTab:d,onNewOllamaTab:g,onNewDeepseekTab:i}){let[j,l]=(0,f.useState)(!1),m=(0,f.useRef)(null),n=(0,f.useRef)(null),[o,p]=(0,f.useState)({top:0,right:0}),q=(0,h.F2)(),r=e=>{l(!1),"claude2"===e?b?.():"codex"===e?c?.():"kimi"===e?d?.():"ollama"===e?g?.():"deepseek"===e?i?.():a()};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{ref:m,onClick:()=>{if(!j&&m.current){let a=m.current.getBoundingClientRect(),b=q?.getBoundingClientRect(),c=b?.left??0,d=b?.top??0,e=b?.width??window.innerWidth;p({top:a.bottom+4-d,right:e-(a.right-c)})}l(a=>!a)},className:"flex-shrink-0 p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:"New tab",children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}),j&&(0,e.jsx)(h.ZL,{children:(0,e.jsxs)("div",{ref:n,className:"fixed z-[9999] bg-popover border border-border rounded-lg shadow-lg py-1 min-w-[140px]",style:{top:o.top,right:o.right},children:[(0,e.jsxs)("button",{onClick:()=>r("claude"),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-foreground hover:bg-brand/10 transition-colors whitespace-nowrap",children:[(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-brand flex-shrink-0"}),"Claude Code"]}),(0,e.jsxs)("button",{onClick:()=>r("claude2"),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-foreground hover:bg-brand/10 transition-colors whitespace-nowrap",children:[(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-orange-500 flex-shrink-0"}),"Claude 2"]}),(0,e.jsxs)("button",{onClick:()=>r("codex"),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-foreground hover:bg-brand/10 transition-colors whitespace-nowrap",children:[(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-500 flex-shrink-0"}),"OpenAI Codex"]}),(0,e.jsxs)("button",{onClick:()=>r("deepseek"),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-foreground hover:bg-brand/10 transition-colors whitespace-nowrap",children:[(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-sky-500 flex-shrink-0"}),"DeepSeek"]}),(0,e.jsxs)("button",{onClick:()=>r("kimi"),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-foreground hover:bg-brand/10 transition-colors whitespace-nowrap",children:[(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-blue-500 flex-shrink-0"}),"Kimi"]}),(0,e.jsxs)("button",{onClick:()=>r("ollama"),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-foreground hover:bg-brand/10 transition-colors whitespace-nowrap",children:[(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-violet-500 flex-shrink-0"}),"Ollama"]})]})})]})}function l({tabs:a,activeTabId:b,unreadTabs:c,dragTabIndex:d,dragOverTabIndex:f,isPinned:h,onTogglePin:m,onSwitchTab:n,onCloseTab:o,onNewTab:p,onNewClaude2Tab:q,onNewCodexTab:r,onNewKimiTab:s,onNewOllamaTab:t,onNewDeepseekTab:u,onDragStart:v,onDragOver:w,onDrop:x,onDragEnd:y}){let{t:z}=(0,i.Bd)();return(0,e.jsx)("div",{className:"border-b border-border bg-card shrink-0",children:(0,e.jsxs)("div",{className:"flex items-center px-2 gap-1 overflow-x-auto",children:[a.map((i,k)=>(0,e.jsx)(g.m,{content:i.title,delay:200,className:"flex-1 min-w-16 max-w-32",children:(0,e.jsxs)("div",{draggable:!0,onDragStart:()=>v(k),onDragOver:a=>w(a,k),onDrop:()=>x(k),onDragEnd:y,className:`group flex items-center gap-1 px-3 py-1.5 text-sm cursor-pointer rounded-t-lg transition-colors ${i.id===b?"bg-accent text-foreground":"text-muted-foreground hover:bg-secondary"} ${d===k?"opacity-50":""} ${f===k?"border-l-2 border-brand":""}`,onClick:()=>n(i.id),children:[(0,e.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,e.jsx)(j,{number:k+1,isActive:i.id===b}),i.isLoading&&(0,e.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-orange-9 animate-pulse"}),!i.isLoading&&c.has(i.id)&&i.id!==b&&(0,e.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-red-500"}),m&&h?.(i.id)&&!i.isLoading&&!(c.has(i.id)&&i.id!==b)&&(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),m(i.id)},className:"absolute -top-1 -right-1 w-3.5 h-3.5 flex items-center justify-center rounded-full bg-card text-amber-500 hover:text-destructive transition-colors",title:z("tabBar.unpin"),children:(0,e.jsx)("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"currentColor",children:(0,e.jsx)("path",{d:"M16 4h-2V2h-4v2H8c-.55 0-1 .45-1 1v4l-2 3v2h5.97v7l1 1 1-1v-7H19v-2l-2-3V5c0-.55-.45-1-1-1z"})})}),m&&!h?.(i.id)&&!i.isLoading&&!(c.has(i.id)&&i.id!==b)&&(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),m(i.id)},className:"absolute -top-1 -right-1 w-3.5 h-3.5 flex items-center justify-center rounded-full bg-card text-muted-foreground opacity-0 group-hover:opacity-60 hover:!opacity-100 hover:!text-brand transition-all",title:z("tabBar.pin"),children:(0,e.jsx)("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,children:(0,e.jsx)("path",{d:"M16 4h-2V2h-4v2H8c-.55 0-1 .45-1 1v4l-2 3v2h5.97v7l1 1 1-1v-7H19v-2l-2-3V5c0-.55-.45-1-1-1z"})})})]}),(0,e.jsx)("span",{className:"flex-1 min-w-0 truncate",children:i.title}),"claude2"===i.engine&&(0,e.jsx)("span",{className:"flex-shrink-0 text-[9px] px-1 py-0 rounded bg-orange-500/15 text-orange-400 font-medium leading-relaxed",children:"C2"}),"codex"===i.engine&&(0,e.jsx)("span",{className:"flex-shrink-0 text-[9px] px-1 py-0 rounded bg-emerald-500/15 text-emerald-400 font-medium leading-relaxed",children:"CX"}),"kimi"===i.engine&&(0,e.jsx)("span",{className:"flex-shrink-0 text-[9px] px-1 py-0 rounded bg-blue-500/15 text-blue-400 font-medium leading-relaxed",children:"KM"}),"ollama"===i.engine&&(0,e.jsx)("span",{className:"flex-shrink-0 text-[9px] px-1 py-0 rounded bg-violet-500/15 text-violet-400 font-medium leading-relaxed",children:"OL"}),"deepseek"===i.engine&&(0,e.jsx)("span",{className:"flex-shrink-0 text-[9px] px-1 py-0 rounded bg-sky-500/15 text-sky-400 font-medium leading-relaxed",children:"DS"}),a.length>1&&(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),o(i.id)},className:"ml-1 p-0.5 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:z("tabBar.closeTab"),children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})},i.id)),(0,e.jsx)(k,{onNewTab:p,onNewClaude2Tab:q,onNewCodexTab:r,onNewKimiTab:s,onNewOllamaTab:t,onNewDeepseekTab:u})]})})}d()}catch(a){d(a)}})},4263:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{$:()=>g});var e=c(12629),f=a([e]);e=(f.then?(await f)():f)[0];let h="/tree-sitter",i=null,j=new Map;async function g(a){let b,c=await (!(b=j.get(a))&&(b=(async()=>(await (!i&&(i=e.Parser.init({locateFile:a=>`${h}/${a}`})),i),e.Language.load(`${h}/tree-sitter-${a}.wasm`)))(),j.set(a,b)),b),d=new e.Parser;return d.setLanguage(c),d}d()}catch(a){d(a)}})},4354:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{D:()=>q});var e=c(48249),f=c(67484),g=c(44384),h=c(95801),i=c(69004),j=c(75155),k=c(64672),l=c(87238),m=c(9780),n=c(33281),o=c(23328),p=a([l,m]);function q({cwd:a,currentCwd:b,commandHistoryRef:c,gridLayout:d,onGridLayoutChange:p,onExecute:r,onAddPluginItem:s,onShowEnvManager:t,onOpenZsh:u,onOpenNote:v}){let{t:w}=(0,g.Bd)(),[x,y]=(0,f.useState)(""),[z,A]=(0,f.useState)(-1),[B,C]=(0,f.useState)(""),[D,E]=(0,f.useState)([]),[F,G]=(0,f.useState)(0),[H,I]=(0,f.useState)(!1),[J,K]=(0,f.useState)(!1),[L,M]=(0,f.useState)([]),[N,O]=(0,f.useState)(!1),[P,Q]=(0,f.useState)(0),R=(0,f.useRef)(null),S=(0,f.useRef)(null),T=(0,f.useRef)(!1),{projectCommands:U,globalCommands:V,expandCustomCommand:W,loadQuickCommands:X}=(0,l.j)(a),Y=(0,f.useCallback)(a=>{O(!1);let b=a.command,c=(0,m.sk)(b);c?s?.(c.type,b.trim()):r(b),y("")},[r,s]),Z=(0,f.useCallback)(a=>{if(a.preventDefault(),T.current||!x.trim())return;let b=W(x)??x,c=(0,m.sk)(b);c?s?.(c.type,b.trim()):r(b),y(""),A(-1),C("")},[x,r,s,W]),$=(0,f.useCallback)(async()=>{if(!R.current)return;let a=R.current.selectionStart||0,c=await n.t4.runPromiseExit((0,o.tp)({cwd:b,input:x,cursorPosition:a}));if("Success"===c._tag){let b=c.value,d=b.suggestions;if(d&&d.length>0&&(E(d),G(0),I(!0),1===d.length)){let c=x.substring(0,b.replaceStart??0),e=x.substring(b.replaceEnd??a),f=c+d[0]+e;y(f),I(!1),setTimeout(()=>{if(R.current){let a=(b.replaceStart??0)+d[0].length;R.current.setSelectionRange(a,a)}},0)}}else console.error("Autocomplete error:",c.cause)},[b,x]),_=(0,f.useCallback)(a=>{if(!R.current)return;let b=R.current.selectionStart||0,c=x.substring(0,b),d=x.substring(b),e=c.split(/\s+/),f=e[e.length-1]||"",g=b-f.length,h=x.substring(0,g)+a+d;y(h),I(!1),setTimeout(()=>{if(R.current){let b=g+a.length;R.current.setSelectionRange(b,b)}},0)},[x]),aa=(0,f.useCallback)(a=>{if(a.nativeEvent.isComposing)return;if(N&&L.length>0){if("ArrowUp"===a.key){a.preventDefault(),Q(a=>(a-1+L.length)%L.length);return}if("ArrowDown"===a.key){a.preventDefault(),Q(a=>(a+1)%L.length);return}if("Tab"===a.key||"Enter"===a.key){a.preventDefault(),Y(L[P]);return}if("Escape"===a.key){a.preventDefault(),O(!1);return}}if("Tab"===a.key){if(a.preventDefault(),H&&D.length>0){let a=(F+1)%D.length;G(a),_(D[a])}else $();return}if("Escape"===a.key&&H){a.preventDefault(),I(!1);return}let b=c.current;if(b&&0!==b.length){if("ArrowUp"===a.key){a.preventDefault(),-1===z&&C(x);let c=-1===z?b.length-1:Math.max(0,z-1);A(c),y(b[c])}else if("ArrowDown"===a.key){if(a.preventDefault(),-1===z)return;let c=z+1;c>=b.length?(A(-1),y(B)):(A(c),y(b[c]))}}},[z,x,B,H,D,F,$,_,N,L,P,Y,c]);return(0,e.jsx)("div",{className:"border-t border-border p-4",children:(0,e.jsxs)("form",{onSubmit:Z,className:"relative flex gap-2 items-center",children:[(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("button",{type:"button",onClick:()=>{J||X(),K(!J)},className:`p-2 rounded-lg transition-all ${J?"text-brand bg-brand/10":"text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95"}`,title:w("console.quickCommands"),children:(0,e.jsx)(h.A,{className:"w-4 h-4"})}),(0,e.jsx)(l.$,{cwd:a,show:J,onClose:()=>K(!1),onExecute:r,onAddPluginItem:s})]}),v&&(0,e.jsx)("button",{type:"button",onClick:v,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95 rounded-lg transition-all",title:w("chat.projectNotes"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,e.jsx)("button",{type:"button",onClick:()=>p(!d),className:`p-2 rounded-lg transition-all ${d?"text-brand bg-brand/10":"text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95"}`,title:d?w("console.singleColumn"):w("console.dualColumn"),children:d?(0,e.jsx)(i.A,{className:"w-4 h-4"}):(0,e.jsx)(j.A,{className:"w-4 h-4"})}),(0,e.jsx)("button",{type:"button",onClick:t,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95 rounded-lg transition-all",title:w("console.envVars"),children:(0,e.jsx)(k.A,{className:"w-4 h-4"})}),(0,e.jsx)("button",{type:"button",onClick:u,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95 rounded-lg transition-all",title:w("console.launchZsh"),children:(0,e.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("polyline",{points:"4 17 10 11 4 5"}),(0,e.jsx)("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}),(0,e.jsx)("input",{ref:R,type:"text",value:x,onChange:a=>{y(a.target.value),-1!==z&&(A(-1),C("")),I(!1)},onKeyDown:aa,onCompositionStart:()=>{T.current=!0},onCompositionEnd:()=>{T.current=!1},placeholder:w("console.inputPlaceholder"),className:"flex-1 px-3 py-2 rounded-lg border border-input bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring font-mono"}),N&&L.length>0&&(0,e.jsx)("div",{ref:S,className:"absolute bottom-full left-0 right-0 mb-1 max-h-64 overflow-y-auto bg-popover border border-border rounded-lg shadow-lg z-50",children:L.map((a,b)=>(0,e.jsxs)("div",{onClick:()=>Y(a),className:`flex items-center gap-3 px-3 py-1.5 cursor-pointer text-sm ${b===P?"bg-brand/10":"hover:bg-accent"}`,children:[(0,e.jsxs)("span",{className:"font-mono font-medium text-foreground",children:["/",a.name]}),(0,e.jsx)("span",{className:"flex-1 text-muted-foreground truncate",children:a.command}),(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground/60 flex-shrink-0",children:"project"===a.scope?w("console.scopeProject"):w("console.scopeGlobal")})]},`${a.scope}-${a.name}`))}),H&&D.length>1&&(0,e.jsxs)("div",{className:"absolute bottom-full left-0 mb-1 bg-popover border border-border rounded-lg shadow-lg max-h-48 overflow-y-auto z-50",children:[(0,e.jsx)("div",{className:"py-1",children:D.map((a,b)=>(0,e.jsx)("button",{type:"button",onClick:()=>_(a),className:`w-full px-3 py-1.5 text-left text-sm font-mono hover:bg-accent transition-colors ${b===F?"bg-accent":""}`,children:a},b))}),(0,e.jsx)("div",{className:"border-t border-border px-3 py-1 text-xs text-muted-foreground",children:w("console.tabSwitchEscClose")})]})]})})}[l,m]=p.then?(await p)():p,d()}catch(a){d(a)}})},4462:(a,b,c)=>{"use strict";c.d(b,{EmptyState:()=>i});var d=c(48249),e=c(67484),f=c(44384),g=c(33281),h=c(65484);function i({onSelectSession:a}){let{t:b}=(0,f.Bd)(),[c,j]=(0,e.useState)([]),[k,l]=(0,e.useState)({}),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(null),[q,r]=(0,e.useState)(""),s=(0,e.useRef)(null);(0,e.useCallback)(async()=>{n(!0),p(null),l({});let a=await g.t4.runPromiseExit((0,h.H7)());"Success"===a._tag?j(a.value):p("Failed to load projects"),n(!1)},[]);let t=(0,e.useCallback)(async a=>{l(b=>({...b,[a]:{...b[a],isExpanded:!0,isLoading:!0,sessions:[],error:null}}));let b=await g.t4.runPromiseExit((0,h.QW)(a));"Success"===b._tag?l(c=>({...c,[a]:{...c[a],isLoading:!1,sessions:b.value}})):l(b=>({...b,[a]:{...b[a],isLoading:!1,error:"Failed to load sessions"}}))},[]),u=(0,e.useCallback)(a=>{let b=k[a];b?.isExpanded?l(b=>({...b,[a]:{...b[a],isExpanded:!1}})):b?.sessions?.length?l(b=>({...b,[a]:{...b[a],isExpanded:!0}})):t(a)},[k,t]);return(0,d.jsxs)("div",{className:"flex-1 flex flex-col bg-card",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[(0,d.jsx)("h2",{className:"text-lg font-medium text-foreground",children:b("workspace.selectProject")}),(0,d.jsx)("input",{ref:s,type:"text",placeholder:b("workspace.searchProjectPath"),value:q,onChange:a=>r(a.target.value),className:"px-3 py-1.5 text-sm border border-border rounded-lg bg-card text-foreground placeholder-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"})]}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto p-6",children:[m&&(0,d.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,d.jsxs)("svg",{className:"animate-spin h-5 w-5",fill:"none",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,d.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,d.jsx)("span",{children:b("workspace.loadingProjects")})]})}),o&&(0,d.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,d.jsx)("div",{className:"text-sm text-red-500",children:o})}),!m&&!o&&0===c.length&&(0,d.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,d.jsx)("div",{className:"text-sm text-muted-foreground",children:b("workspace.projectNotFound")})}),!m&&!o&&(0,d.jsx)("div",{className:"space-y-2",children:c.filter(a=>a.fullPath.toLowerCase().includes(q.toLowerCase())).map(c=>{let e=k[c.encodedPath]||{isExpanded:!1,isLoading:!1,sessions:[],error:null};return(0,d.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,d.jsxs)("button",{onClick:()=>u(c.encodedPath),className:"w-full flex items-center gap-3 p-3 hover:bg-accent transition-colors text-left",children:[(0,d.jsx)("svg",{className:`w-4 h-4 text-muted-foreground transition-transform ${e.isExpanded?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,d.jsx)("svg",{className:"w-5 h-5 text-brand",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-sm font-medium text-foreground truncate",children:c.name}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:c.fullPath})]}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground bg-secondary px-2 py-0.5 rounded",children:b("workspace.sessions",{count:c.sessionCount})})]}),e.isExpanded&&(0,d.jsxs)("div",{className:"border-t border-border bg-secondary/30",children:[e.isLoading&&(0,d.jsxs)("div",{className:"flex items-center gap-2 p-3 text-xs text-muted-foreground",children:[(0,d.jsxs)("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,d.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,d.jsx)("span",{children:b("workspace.loadingSessions")})]}),e.error&&(0,d.jsx)("div",{className:"p-3 text-xs text-red-500",children:e.error}),!e.isLoading&&!e.error&&0===e.sessions.length&&(0,d.jsx)("div",{className:"p-3 text-xs text-muted-foreground",children:b("workspace.noSessions")}),!e.isLoading&&!e.error&&e.sessions.map(b=>(0,d.jsxs)("button",{onClick:()=>{a(c.fullPath,(b.path.split("/").pop()||"").replace(".jsonl",""))},className:"w-full flex items-start gap-3 p-3 hover:bg-accent transition-colors text-left border-t border-border first:border-t-0",children:[(0,d.jsx)("svg",{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-sm text-foreground truncate",children:b.title}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:new Date(b.modifiedAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}),b.firstMessages.length>0&&(0,d.jsx)("div",{className:"text-xs text-muted-foreground mt-1 truncate",children:b.firstMessages[0]})]})]},b.path))]})]},c.encodedPath)})})]})]})}},4857:(a,b,c)=>{"use strict";c.d(b,{Q:()=>e});var d=c(67484);function e(){let a=(0,d.useRef)([]),b=(0,d.useRef)([]),c=(0,d.useCallback)(c=>{a.current.push(c),a.current.length>50&&(a.current=a.current.slice(-50)),b.current=[]},[]),e=(0,d.useCallback)(c=>{if(0===a.current.length)return null;let d=a.current.pop();return b.current.push(c),b.current.length>50&&(b.current=b.current.slice(-50)),d},[]),f=(0,d.useCallback)(c=>{if(0===b.current.length)return null;let d=b.current.pop();return a.current.push(c),a.current.length>50&&(a.current=a.current.slice(-50)),d},[]);return{push:c,goBack:e,goForward:f,canGoBack:(0,d.useCallback)(()=>a.current.length>0,[]),canGoForward:(0,d.useCallback)(()=>b.current.length>0,[])}}},6612:(a,b,c)=>{"use strict";c.d(b,{TabManager:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call TabManager() from the server but TabManager is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/TabManager.tsx","TabManager")},6662:(a,b,c)=>{"use strict";c.d(b,{W:()=>i});var d=c(67484),e=c(9804),f=c(79606),g=c(33281),h=c(87808);function i({cwd:a}){let[b,c]=(0,d.useState)([]),[j,k]=(0,d.useState)(null),[l,m]=(0,d.useState)(new Set),[n,o]=(0,d.useState)([]),[p,q]=(0,d.useState)(null),[r,s]=(0,d.useState)(null),[t,u]=(0,d.useState)(new Set),[v,w]=(0,d.useState)(null),[x,y]=(0,d.useState)(""),[z,A]=(0,d.useState)(!1),[B,C]=(0,d.useState)(null),[D,E]=(0,d.useState)(!1),[F,G]=(0,d.useState)(!1),[H,I]=(0,d.useState)(null),J=(0,d.useRef)(null),[K,L]=(0,d.useState)(!1),[M,N]=(0,d.useState)(null),[O,P]=(0,d.useState)("center"),[Q,R]=(0,d.useState)(null),[S,T]=(0,d.useState)(null),[U,V]=(0,d.useState)(!1),[W,X]=(0,d.useState)([]),[Y,Z]=(0,d.useState)(!1),[$,_]=(0,d.useState)(null),[aa,ab]=(0,d.useState)(null),[ac,ad]=(0,d.useState)(!1),[ae,af]=(0,d.useState)(!1),ag=(0,d.useMemo)(()=>n.map(a=>a.path).filter(Boolean),[n]),ah=(0,d.useMemo)(()=>(0,e.v3)(ag),[ag]),ai=(0,d.useMemo)(()=>new Set((0,e.tW)(ah)),[ah]),aj=(0,d.useMemo)(()=>x?j?(0,e.KH)(j,x,z):(0,e.q3)(b,x,z):null,[b,j,x,z]),ak=v??t,al=(0,d.useRef)(null),am=(0,d.useCallback)(b=>{al.current&&clearTimeout(al.current),al.current=setTimeout(()=>{g.t4.runFork((0,h.Ft)(a,Array.from(b)).pipe(f.tapError(a=>f.sync(()=>console.error("Error saving expanded paths:",a))),f.orElse(()=>f.void)))},500)},[a]),an=(0,d.useCallback)(async()=>{E(!0),I(null),await g.t4.runPromise((0,h.mP)(a).pipe(f.match({onSuccess:a=>{a.error?I(a.error):(c(a.files??[]),a.expandedPaths&&Array.isArray(a.expandedPaths)&&u(new Set(a.expandedPaths)))},onFailure:a=>{console.error("Error loading files:",a),I("Failed to load files")}}))),E(!1)},[a]),ao=(0,d.useCallback)(()=>{g.t4.runPromise((0,h.DZ)(a).pipe(f.match({onSuccess:a=>{a.paths&&k(a.paths)},onFailure:a=>{console.error("Error loading file index:",a)}})))},[a]),ap=(0,d.useCallback)(async b=>{m(a=>new Set([...a,b])),await g.t4.runPromise((0,h.gZ)(a,b).pipe(f.match({onSuccess:a=>{a.children&&c(c=>{if(!b){let b=new Map(c.map(a=>[a.path,a]));return a.children.map(a=>{let c=b.get(a.path);return c?.children&&a.isDirectory?{...a,children:c.children}:a})}let d=structuredClone(c),f=(0,e.MB)(d,b);return f&&(f.children=a.children),d})},onFailure:a=>{console.error("Error loading directory:",a)}}))),m(a=>{let c=new Set(a);return c.delete(b),c})},[a]);(0,d.useRef)(l).current=l;let aq=(0,d.useCallback)(async()=>{await g.t4.runPromise((0,h.r9)(a).pipe(f.match({onSuccess:a=>o(a.files??[]),onFailure:a=>console.error("Error loading recent files:",a)})))},[a]),ar=(0,d.useCallback)(async b=>{o(a=>{let c=a.filter(a=>a.path!==b);return[{path:b},...c].slice(0,15)}),await g.t4.runPromise((0,h.YW)(a,b).pipe(f.tapError(a=>f.sync(()=>console.error("Error adding to recent files:",a))),f.orElse(()=>f.void)))},[a]),as=(0,d.useCallback)((b,c,d,e)=>{o(a=>a.map(a=>a.path===b?{...a,scrollLine:c,cursorLine:d,cursorCol:e}:a)),g.t4.runFork((0,h.YW)(a,b,{scrollLine:c,cursorLine:d,cursorCol:e}).pipe(f.orElse(()=>f.void)))},[a]),at=(0,d.useCallback)(a=>n.find(b=>b.path===a),[n]),au=(0,d.useCallback)(async b=>{let c=b||p;c&&(Z(!0),_(null),await g.t4.runPromise((0,h.eE)(a,c).pipe(f.match({onSuccess:a=>{a.error?_(a.error):X(a.blame??[])},onFailure:a=>{console.error("Error loading blame:",a),_("Failed to load blame info")}}))),Z(!1))},[a,p]),av=(0,d.useCallback)(async b=>{G(!0),s(null),V(!1),X([]),_(null),ab(null);let c=f.gen(function*(){let c=yield*(0,h.r6)(a,b);if(!c.ok)return{type:"error",message:c.data?.error||"Failed to stat file"};let d=c.data??{};if(!d.exists)return{type:"error",message:"File not found"};if("dir"===d.kind)return{type:"error",message:"Path is a directory"};switch(d.category){case"image":return{type:"image",size:d.size,mtime:d.mtimeMs,...d.isSymlink?{isSymlink:!0,symlinkTarget:d.symlinkTarget}:{}};case"binary":return{type:"binary",message:"Cannot preview binary file",size:d.size,mtime:d.mtimeMs};case"too-large":return{type:"error",message:"File too large to preview",size:d.size,mtime:d.mtimeMs};default:{let c=yield*(0,h.K9)(a,b);if(409===c.status)return{type:"binary",message:c.data?.error||"Cannot preview binary file",size:d.size,mtime:d.mtimeMs};if(!c.ok)return{type:"error",message:c.data?.error||"Failed to load file"};let e=c.data??{};return{type:"text",content:e.content,size:e.size,mtime:e.mtimeMs,...e.isSymlink?{isSymlink:!0,symlinkTarget:e.symlinkTarget}:{}}}}});await g.t4.runPromise(c.pipe(f.match({onSuccess:a=>s(a),onFailure:a=>{console.error("Error loading file content:",a),s({type:"error",message:"Failed to load file"})}}))),ar(b),au(b),G(!1)},[a,ar,au]),aw=(0,d.useCallback)(()=>{U?V(!1):(V(!0),0===W.length&&au())},[U,W.length,au]),ax=(0,d.useCallback)((a,b)=>{if(!a)return;if(q(a),N(b??null),null==b){let b=n.find(b=>b.path===a);b?.scrollLine?(N(b.scrollLine),P("start"),R(b.cursorLine??null),T(b.cursorCol??null)):(P("center"),R(null),T(null))}else P("center"),R(null),T(null);av(a);let c=a.split("/");if(c.length>1){let a=[];for(let b=1;b<c.length;b++)a.push(c.slice(0,b).join("/"));u(b=>{let c=new Set(b),d=!1;for(let b of a)c.has(b)||(c.add(b),d=!0);return d&&am(c),d?c:b})}},[av,am,n]),ay=(0,d.useCallback)(a=>{if(v)w(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c});else{let c=!t.has(a);if(u(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),am(c),c}),c){let c=(0,e.MB)(b,a);c&&c.isDirectory&&!c.children&&ap(a)}}},[v,am,t,b,ap]);return{files:b,setFiles:c,fileIndex:j,setFileIndex:k,loadingDirs:l,expandedPaths:t,setExpandedPaths:u,searchTreeExpandedPaths:v,setSearchTreeExpandedPaths:w,effectiveExpandedPaths:ak,searchQuery:x,setSearchQuery:y,searchExactMatch:z,setSearchDirExact:A,matchedPaths:aj,creatingItem:B,setCreatingItem:C,isLoadingFiles:D,fileError:H,searchInputRef:J,shouldScrollToSelected:K,setShouldScrollToSelected:L,targetLineNumber:M,setTargetLineNumber:N,targetScrollAlign:O,setTargetScrollAlign:P,initialCursorLine:Q,initialCursorCol:S,setInitialCursorLine:R,setInitialCursorCol:T,selectedPath:p,setSelectedPath:q,fileContent:r,setFileContent:s,isLoadingContent:F,recentFiles:n,recentFilePaths:ag,setRecentFiles:o,recentFilesTree:ah,recentTreeDirPaths:ai,showBlame:U,setShowBlame:V,blameLines:W,isLoadingBlame:Y,blameError:$,blameSelectedCommit:aa,setBlameSelectedCommit:ab,showMarkdownPreview:ac,setShowMarkdownPreview:ad,showEditor:ae,setShowEditor:af,saveExpandedPaths:am,loadFiles:an,loadFileIndex:ao,loadDirectory:ap,loadRecentFiles:aq,addToRecentFiles:ar,updateRecentFilePosition:as,getRecentFilePosition:at,loadFileContent:av,loadBlame:au,handleToggleBlame:aw,handleSelectFile:ax,handleToggle:ay}}},6900:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{x:()=>m});var e=c(48249),f=c(67484),g=c(44384),h=c(7833),i=c(33281),j=c(85655),k=c(57031),l=c(88214);function m({isOpen:a,onClose:b,cwd:c}){let d,{t:n}=(0,g.Bd)(),[o,p]=(0,f.useState)([]),[q,r]=(0,f.useState)(null),[s,t]=(0,f.useState)(null),[u,v]=(0,f.useState)(!1),[w,x]=(0,f.useState)(!1),[y,z]=(0,f.useState)(null),[A,B]=(0,f.useState)(!1),[C,D]=(0,f.useState)(""),[E,F]=(0,f.useState)(!1),[G,H]=(0,f.useState)([]),[I,J]=(0,f.useState)(""),[K,L]=(0,f.useState)(!1),M=(0,f.useCallback)((a,b)=>a?._tag==="Fail"&&a.error?.cause instanceof Error?a.error.cause.message:n(b),[n]),N=(0,f.useCallback)(async()=>{v(!0);let a=await i.t4.runPromiseExit((0,j.FK)(c));if("Success"===a._tag){let b=a.value;p(b.worktrees),r(b.nextPath),t(b.nextRandomWord),b.gitUserName&&D(b.gitUserName)}else console.error("Failed to load worktrees:",a.cause),(0,h.oR)(n("toast.worktreeLoadFailed"),"error");v(!1)},[c,n]),O=(0,f.useCallback)(a=>{let{local:b,remote:c}=a;return c.includes("origin/main")?"origin/main":c.includes("origin/master")?"origin/master":b.includes("main")?"main":b.includes("master")?"master":c.length>0?c[0]:b.length>0?b[0]:"main"},[]),P=async()=>{if(!q)return;let a="origin/main",b=await i.t4.runPromiseExit((0,j.r4)(c));"Success"===b._tag&&(a=O(b.value));let d=s||function(){let a="bcdfghjklmnprstvwz",b=["a","e","i","o","u","ai","au","ea","ee","ia","io","oa","oo","ou","ui"],c="";for(let d=0;d<2;d++)c+=a[Math.floor(Math.random()*a.length)],c+=b[Math.floor(Math.random()*b.length)];return c}(),e=C?`${C}/${d}`:d;x(!0);let f=await i.t4.runPromiseExit((0,j.CM)({action:"add",cwd:c,path:q,newBranch:e,baseBranch:a}));"Success"===f._tag?((0,h.oR)(n("toast.worktreeCreateSuccess",{name:e}),"success"),N()):(console.error("Failed to create worktree:",f.cause),(0,h.oR)(M(f.cause,"toast.worktreeCreateFailed"),"error")),x(!1)},Q=async()=>{L(!0),J(""),F(!0);let a=await i.t4.runPromiseExit((0,j.r4)(c));if("Success"===a._tag){let b=a.value,c=b.local??[],d=b.remote??[],e=new Set(o.map(a=>a.branch).filter(Boolean)),f=[...c.filter(a=>!e.has(a)),...d.filter(a=>!e.has(a)&&!c.includes(a.replace(/^origin\//,"")))];H(f)}else(0,h.oR)(n("toast.loadBranchFailed"),"error");L(!1)},R=async a=>{if(!q)return;F(!1),x(!0);let b=await i.t4.runPromiseExit((0,j.CM)({action:"add",cwd:c,path:q,branch:a}));"Success"===b._tag?((0,h.oR)(n("toast.worktreeCreateSuccess",{name:a}),"success"),N()):(console.error("Failed to create worktree:",b.cause),(0,h.oR)(M(b.cause,"toast.worktreeCreateFailed"),"error")),x(!1)},S=async()=>{if(!y)return;B(!0);let a=await i.t4.runPromiseExit((0,j.CM)({action:"remove",cwd:c,path:y.path}));"Success"===a._tag?((0,h.oR)(n("toast.worktreeDeleted"),"success"),z(null),N()):(console.error("Failed to delete worktree:",a.cause),(0,h.oR)(M(a.cause,"toast.worktreeDeleteFailed"),"error")),B(!1)},T=async a=>{let b=a.isLocked?"unlock":"lock",d=await i.t4.runPromiseExit((0,j.CM)({action:b,cwd:c,path:a.path}));"Success"===d._tag?((0,h.oR)(a.isLocked?n("toast.worktreeUnlocked"):n("toast.worktreeLocked"),"success"),N()):(console.error("Failed to toggle lock:",d.cause),(0,h.oR)(M(d.cause,"toast.operationFailed"),"error"))};return a?(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:b,children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-[480px] max-h-[80vh] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between flex-shrink-0",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Git Worktrees"}),(0,e.jsx)("button",{onClick:b,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:n("common.close"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("div",{className:"flex-1 p-4 overflow-y-auto",children:u?(0,e.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):(0,e.jsx)("div",{className:"space-y-2",children:o.map(a=>{let d=a.path===c;return(0,e.jsxs)("div",{className:`group p-3 rounded-lg border transition-colors ${d?"border-brand bg-brand/5":"border-border hover:bg-accent cursor-pointer"}`,onClick:()=>{a.path!==c&&((0,k.F)(l.n.OpenProject,{cwd:a.path}),b())},children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,e.jsx)("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${d?"bg-brand":"bg-muted-foreground/30"}`}),(0,e.jsx)("span",{className:"font-medium text-foreground truncate",children:a.branch||(a.isDetached?"detached":"unknown")}),a.isLocked&&(0,e.jsx)("span",{className:"text-amber-11",title:n("git.worktree.locked"),children:"\uD83D\uDD12"}),d&&(0,e.jsxs)("span",{className:"text-xs text-brand",children:["(",n("common.current"),")"]})]}),(0,e.jsx)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:!d&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),T(a)},className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-secondary rounded transition-colors",title:a.isLocked?n("git.worktree.unlock"):n("git.worktree.lock"),children:a.isLocked?(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}):(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),z(a)},className:"p-1.5 text-muted-foreground hover:text-red-11 hover:bg-secondary rounded transition-colors",title:n("common.delete"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})})]}),(0,e.jsx)("div",{className:"mt-1 text-xs text-muted-foreground truncate pl-4",children:a.path}),a.isDetached&&(0,e.jsx)("div",{className:"mt-1 text-xs text-amber-11 pl-4",children:"(detached HEAD)"})]},a.path)})})}),E&&(0,e.jsxs)("div",{className:"border-t border-border px-4 py-3 flex-shrink-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,e.jsx)("input",{value:I,onChange:a=>J(a.target.value),placeholder:n("git.worktree.searchBranch"),className:"flex-1 bg-secondary text-sm text-foreground rounded px-2.5 py-1.5 outline-none placeholder:text-muted-foreground",autoFocus:!0,autoComplete:"off",spellCheck:"false"}),(0,e.jsx)("button",{onClick:()=>F(!1),className:"text-xs text-muted-foreground hover:text-foreground px-2 py-1.5",children:n("common.cancel")})]}),(0,e.jsx)("div",{className:"max-h-[200px] overflow-y-auto space-y-0.5",children:K?(0,e.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:n("common.loading")}):(d=G.filter(a=>a.toLowerCase().includes(I.toLowerCase())),0===d.length?(0,e.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:n("git.worktree.noBranches")}):d.map(a=>(0,e.jsx)("button",{onClick:()=>R(a),className:"w-full text-left px-2.5 py-1.5 text-sm rounded hover:bg-accent transition-colors truncate",children:(0,e.jsx)("span",{className:`${a.startsWith("origin/")?"text-muted-foreground":"text-foreground"}`,children:a})},a)))})]}),(0,e.jsxs)("div",{className:"px-4 py-3 border-t border-border flex items-center justify-between flex-shrink-0",children:[(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:n("git.worktree.count",{count:o.length})}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:Q,disabled:!q||w,className:`px-3 py-1.5 text-sm rounded transition-colors ${q&&!w?"bg-secondary text-foreground hover:bg-accent":"bg-secondary text-muted-foreground cursor-not-allowed"}`,children:n("git.worktree.selectBranch")}),(0,e.jsx)("button",{onClick:P,disabled:!q||w,className:`px-3 py-1.5 text-sm rounded transition-colors ${q&&!w?"bg-brand text-white hover:bg-brand/90":"bg-secondary text-muted-foreground cursor-not-allowed"}`,children:w?(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):n("git.worktree.addWorktree")})]})]}),y&&(0,e.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-black/50 rounded-lg",onClick:()=>z(null),children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-[360px] p-4",onClick:a=>a.stopPropagation(),children:[(0,e.jsx)("div",{className:"text-sm font-medium text-foreground mb-3",children:n("git.worktree.confirmDelete")}),(0,e.jsxs)("div",{className:"text-sm text-muted-foreground mb-4",children:[(0,e.jsx)("p",{className:"mb-2",children:n("git.worktree.confirmDeleteMsg")}),(0,e.jsxs)("p",{className:"text-xs",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:n("git.worktree.path")}),(0,e.jsx)("span",{className:"text-foreground",children:y.path})]}),(0,e.jsxs)("p",{className:"text-xs",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:n("git.worktree.branch")}),(0,e.jsx)("span",{className:"text-foreground",children:y.branch||"detached"})]})]}),(0,e.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,e.jsx)("button",{onClick:()=>z(null),className:"px-3 py-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:n("common.cancel")}),(0,e.jsx)("button",{onClick:S,disabled:A,className:"px-3 py-1.5 text-sm bg-red-9 text-white rounded hover:bg-red-10 transition-colors disabled:opacity-50",children:A?(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):n("common.delete")})]})]})})]})}):null}d()}catch(a){d(a)}})},7031:(a,b,c)=>{"use strict";c.d(b,{H:()=>g,r:()=>h});var d=c(48249),e=c(67484);let f=(0,e.createContext)(null);function g({value:a,children:b}){return(0,d.jsx)(f.Provider,{value:a,children:b})}function h(){return(0,e.useContext)(f)}},7122:(a,b,c)=>{"use strict";c.d(b,{Ee:()=>m,SU:()=>j,ft:()=>l,iN:()=>k});var d=c(48249),e=c(67484),f=c(44384),g=c(74429),h=c(7833);let i=(0,e.createContext)(null);function j({container:a,children:b}){return(0,d.jsx)(i.Provider,{value:a,children:b})}function k(){return(0,e.useContext)(i)}function l({x:a,y:b,path:c,cwd:j,isDirectory:k,onClose:m,onCreateFile:n,onDelete:o,onRefresh:p,onCopyFile:q,onPaste:r}){let{t:s}=(0,f.Bd)(),t=(0,e.useRef)(null),u=(0,e.useContext)(i),v=c.split("/").pop()||c,w=`${j}/${c}`,x=c.includes("/")?c.substring(0,c.lastIndexOf("/")):"",y=x?`${j}/${x}`:j,z=k?c:x,A=k?w:y,[B,C]=(0,e.useState)({x:0,y:0}),D=(0,e.useCallback)(async(a,b)=>{try{await navigator.clipboard.writeText(a),(0,h.oR)(s("toast.copiedName",{name:b}),"success")}catch{(0,h.oR)(s("toast.copyFailed"),"error")}m()},[m,s]),E=k?c:x,F=[{label:s("fileContextMenu.copyRelativePath"),value:c},{label:s("fileContextMenu.copyAbsolutePath"),value:w},{label:s("fileContextMenu.copyRelativeDirPath"),value:z||"."},{label:s("fileContextMenu.copyAbsoluteDirPath"),value:A},{label:k?s("fileContextMenu.copyFolderName"):s("fileContextMenu.copyFileName"),value:v}],G=(0,d.jsxs)("div",{ref:t,className:"absolute z-[200] bg-card border border-border rounded-lg shadow-lg py-1 w-fit whitespace-nowrap",style:{left:B.x,top:B.y},children:[n&&(0,d.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-foreground hover:bg-accent transition-colors",onClick:()=>{m(),n(E)},children:s("fileContextMenu.createFile")}),q&&(0,d.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-foreground hover:bg-accent transition-colors",onClick:()=>{m(),q(c)},children:k?s("fileContextMenu.copyFolder"):s("fileContextMenu.copyFile")}),r&&(0,d.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-foreground hover:bg-accent transition-colors",onClick:()=>{m(),r(E)},children:s("fileContextMenu.pasteHere")}),o&&(0,d.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-destructive hover:bg-accent transition-colors",onClick:()=>{m(),o(c,k,v)},children:k?s("fileContextMenu.deleteFolder"):s("fileContextMenu.deleteFile")}),(n||o||q||r)&&(0,d.jsx)("div",{className:"my-1 border-t border-border"}),F.map((a,b)=>(0,d.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-foreground hover:bg-accent transition-colors",onClick:()=>D(a.value,a.label),children:a.label},b))]});return u?(0,g.createPortal)(G,u):G}function m(){let[a,b]=(0,e.useState)(null);return{contextMenu:a,showContextMenu:(0,e.useCallback)((a,c,d)=>{a.preventDefault(),a.stopPropagation(),b({x:a.clientX,y:a.clientY,path:c,isDirectory:d})},[]),hideContextMenu:(0,e.useCallback)(()=>{b(null)},[])}}},7833:(a,b,c)=>{"use strict";c.d(b,{dj:()=>h,lJ:()=>l,oR:()=>n,tE:()=>i});var d=c(48249),e=c(67484),f=c(208);let g=(0,e.createContext)(null);function h(){let a=(0,e.useContext)(g);if(!a)throw Error("useToast must be used within a ToastProvider");return a}function i({children:a}){let[b,c]=(0,e.useState)([]),f=(0,e.useCallback)((a,b="success")=>{let d=`toast-${Date.now()}`;c(c=>[...c,{id:d,message:a,type:b}])},[]),h=(0,e.useCallback)(a=>{c(b=>b.filter(b=>b.id!==a))},[]);return(0,d.jsxs)(g.Provider,{value:{showToast:f},children:[a,(0,d.jsx)(j,{toasts:b,onRemove:h})]})}function j({toasts:a,onRemove:b}){return(0,d.jsx)("div",{className:"fixed bottom-4 right-4 z-[100] flex flex-col gap-2",children:a.map(a=>(0,d.jsx)(k,{toast:a,onRemove:b},a.id))})}function k({toast:a,onRemove:b}){let c={success:"bg-green-9",error:"bg-red-9",info:"bg-brand"}[a.type],e={success:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),error:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),info:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}[a.type];return(0,d.jsxs)("div",{className:`${c} text-white px-4 py-3 rounded-lg shadow-lg flex items-center gap-3 min-w-[200px] animate-slide-in`,style:{animation:"slideIn 0.3s ease-out"},children:[e,(0,d.jsx)("span",{className:"text-sm",children:a.message}),(0,d.jsx)("button",{onClick:()=>b(a.id),className:"ml-auto p-1 hover:bg-white/20 rounded transition-colors",children:(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}function l(a,b){let{title:c=f.A.t("confirm.title",{defaultValue:"Confirm"}),confirmText:d=f.A.t("confirm.ok",{defaultValue:"OK"}),cancelText:e=f.A.t("confirm.cancel",{defaultValue:"Cancel"}),danger:g=!1}=b||{};return new Promise(b=>{let f=document.createElement("div");f.className="fixed inset-0 z-[200] flex items-center justify-center",f.style.animation="confirmFadeIn 0.15s ease-out";let h=a=>{f.style.animation="confirmFadeOut 0.12s ease-in",f.addEventListener("animationend",()=>{document.body.removeChild(f),b(a)},{once:!0})};f.addEventListener("mousedown",a=>{a.target===f&&h(!1)});let i=a=>{"Escape"===a.key?(a.stopPropagation(),document.removeEventListener("keydown",i,!0),h(!1)):"Enter"===a.key&&(a.stopPropagation(),document.removeEventListener("keydown",i,!0),h(!0))};document.addEventListener("keydown",i,!0),f.innerHTML=`
|
|
1
|
+
exports.id=9658,exports.ids=[9658],exports.modules={208:(a,b,c)=>{"use strict";c.d(b,{A:()=>g});var d=c(529);let e=JSON.parse('{"common":{"save":"Save","cancel":"Cancel","delete":"Delete","close":"Close","copy":"Copy","edit":"Edit","file":"File","codeMap":"Code Map","confirm":"Confirm","loading":"Loading...","search":"Search","refresh":"Refresh","retry":"Retry","submit":"Submit","copied":"Copied","saved":"Saved","failed":"Failed","noMatch":"No matches","noData":"No data","done":"Done","justNow":"just now","minutesAgo":"{{count}}m ago","hoursAgo":"{{count}}h ago","daysAgo":"{{count}}d ago","monthsAgo":"{{count}}mo ago","yearsAgo":"{{count}}y ago","saveFailed":"Save failed","copyFailed":"Copy failed","deleteFailed":"Delete failed","operationFailed":"Operation failed","copiedPath":"Path copied","copyAbsPath":"Copy absolute path","loadMore":"Load more","noResult":"No results","selected":"Selected","selectAll":"Select all","hint":"Notice","confirmBtn":"OK","cancelBtn":"Cancel","preview":"Preview","readable":"Readable","previous":"Previous","next":"Next","all":"All","input":"Input","result":"Result","line":"Line","lines":"lines","running":"Running","connecting":"Connecting","connected":"Connected","connectionFailed":"Connection failed","builtin":"Built-in","global":"Global","project":"Project","current":"Current"},"toast":{"savedSuccess":"Saved","saveFailed":"Save failed","copiedName":"Copied: {{name}}","copyFailed":"Copy failed","deleteFailed":"Delete failed","operationFailed":"Operation failed","staged":"Staged","stageFailed":"Stage failed","unstaged":"Unstaged","unstageFailed":"Unstage failed","stagedNFiles":"Staged {{count}} files","unstagedNFiles":"Unstaged {{count}} files","discardFailed":"Discard failed","discardedNFiles":"Discarded changes in {{count}} files","stagedAllFiles":"All files staged","deletedFile":"File deleted","discardedChanges":"Changes discarded","pastedFile":"Pasted: {{name}}","pasteFailed":"Paste failed","noFileToPaste":"No file to paste","createdFile":"Created: {{name}}","createFailed":"Create failed","movedToTrash":"Moved to trash: {{name}}","copiedPageUrl":"Page URL copied","copiedDirPath":"Directory path copied","switchedToBranch":"Switched to {{branch}}","switchBranchFailed":"Branch switch failed","loadBranchFailed":"Failed to load branches","copiedCommand":"Copied: {{command}}","copiedMessage":"Message copied","copiedUrl":"URL copied","copiedOutput":"Output copied","copiedCmd":"Command copied","copiedComment":"Comment copied","copiedAllComments":"All comments copied","copiedFileContent":"File content copied","copiedQA":"Copied {{count}} Q&A","copiedAllQA":"All Q&A copied","readFileFailed":"Failed to read file","reviewCreated":"Review created, link copied","reviewUpdated":"Review updated, link copied","reviewCreateFailed":"Failed to create review","sharingClosed":"Sharing disabled","sharingCloseFailed":"Failed to disable sharing","linkCopied":"Link copied","addCommentFailed":"Failed to add comment","deleteCommentFailed":"Failed to delete comment","editCommentFailed":"Failed to edit comment","addReplyFailed":"Failed to add reply","deleteReplyFailed":"Failed to delete reply","editReplyFailed":"Failed to edit reply","disconnected":"Disconnected: {{id}}","pluginReloading":"Reloading extension...","worktreeCreateSuccess":"Worktree created: {{name}}","worktreeCreateFailed":"Failed to create worktree","worktreeLoadFailed":"Failed to load worktree list","worktreeDeleted":"Worktree deleted","worktreeDeleteFailed":"Failed to delete worktree","worktreeLocked":"Locked","worktreeUnlocked":"Unlocked"},"workspace":{"selectProject":"Select a project to start","searchProjectPath":"Search project path...","loadingProjects":"Loading projects...","projectNotFound":"No projects found","sessions":"{{count}} sessions","loadingSessions":"Loading sessions...","noSessions":"No sessions","loadingText":"Loading...","openProject":"Open Project","expandSidebar":"Expand sidebar","collapseSidebar":"Collapse sidebar","notes":"Notes","skills":"Skills","settings":"Settings","projectNotes":"Project Notes","closeProject":"Close project"},"sessions":{"recentSessions":"Recent Sessions","runningCount":"{{count}} running","unreadCount":"{{count}} unread","noSessions":"No sessions yet","running":"Running","done":"Done","pinnedSessions":"Pinned Sessions","noPinnedSessions":"No pinned sessions. Click the pin icon in the tab bar to add.","editTitle":"Edit title","remove":"Remove","projectSessions":"Project Sessions","browseAllSessions":"Browse all sessions","sessionList":"Session List","searchSessions":"Search sessions...","loadingSessions":"Loading sessions...","noMatchingSessions":"No matching sessions","noSessionsYet":"No sessions yet","projectList":"Project List","openFolder":"Open Folder","selectingFolder":"Selecting...","loadingHistory":"Loading history..."},"scheduledTasks":{"title":"Scheduled Tasks","aboutToTrigger":"About to trigger","secondsLater":"in {{count}}s","minutesLater":"in {{count}}m","hoursMinutesLater":"in {{h}}h {{m}}m","hoursLater":"in {{h}}h","onceType":"Once ({{minutes}}min)","everyNMinutes":"Every {{minutes}}min","completed":"Completed","paused":"Paused","activeCount":"{{running}} active","pausedCount":"{{paused}} paused","noScheduledTasks":"No scheduled tasks. Click the clock button in the chat input to create one.","lastResult":"Last","runNow":"Run now","resume":"Resume","pause":"Pause","completedCount":"Completed ({{count}})","success":"Success","failure":"Failed","createTask":"Create Scheduled Task","editTask":"Edit Scheduled Task","sendMessage":"Message","messagePlaceholder":"Enter message to send...","type":"Type","once":"Once","interval":"Interval","quickSelect":"Quick Select","customCron":"Custom Cron Expression","customMinutes":"Custom minutes","cronPlaceholder":"e.g. 0 9 * * 1-5 (weekdays at 9am)","cronFormat":"Format: min hour day month weekday (e.g. 0 9 * * 1-5)","minutesPlaceholder":"Minutes","limitTimeRange":"Limit execution time range","to":"to","saveBtn":"Save ({{modKey}}↩)","createBtn":"Create ({{modKey}}↩)","5minLater":"In 5 minutes","15minLater":"In 15 minutes","30minLater":"In 30 minutes","1hourLater":"In 1 hour","every15min":"Every 15 min","every30min":"Every 30 min","every1hour":"Every 1 hour","every2hours":"Every 2 hours","daily9am":"Daily 09:00","daily6pm":"Daily 18:00","weeklyMon9am":"Mon 09:00","monthly1st9am":"1st of month 09:00"},"cron":{"everyNMinutes":"Every {{n}} minutes","everyNHours":"Every {{n}} hours","everyMinute":"Every minute","everyHourAtMin":"Every hour at minute {{m}}","hourlyEveryMin":"{{h}}:xx every minute","daily":"Daily at {{time}}","weekdays":"Weekdays","weekends":"Weekends","dowSun":"Sun","dowMon":"Mon","dowTue":"Tue","dowWed":"Wed","dowThu":"Thu","dowFri":"Fri","dowSat":"Sat","monthPrefix":"","dayOfMonth":"","dayRange":"{{a}}th to {{b}}th","weekdayPrefix":"","weekdayRange":"{{a}} to {{b}}"},"blockViewer":{"empty":{"body":"Select a file in the left tree to see its code map.","hint":"or press ⌘K to search."},"fileMode":{"loading":"Loading…","notFound":"This file is not indexed (unsupported language or beyond the file cap)."},"search":{"tooltip":"Search (⌘K)","hint":"Start typing to search","noResults":"No matches","files":"Files","symbols":"Symbols"},"viewerToggle":{"toBlock":"Show code map","toCode":"Back to code view"},"toc":{"title":"this file","empty":"No functions detected."},"history":{"title":"history","empty":"Click an input or output pin to begin tracing.","clear":"Clear history"},"refresh":"Rebuild project graph","retry":"Retry"},"blockDiffViewer":{"loading":"Building code map…","unsupported":"Code map diff is not available for this file type.","unsupportedHint":"Switch back to the regular diff view to read it.","error":"Code map diff failed: {{message}}","noBlockChanges":"No code-map changes (formatting / whitespace only).","noBefore":"(new)","noAfter":"(removed)","kind":{"added":"added","deleted":"deleted","modified":"modified"}},"fileBrowser":{"directoryTree":"Tree","searchTab":"Search","recentTab":"Recent","changesTab":"Status","historyTab":"History","searchFiles":"Search files...","clear":"Clear","exactMatchOn":"Exact match (on)","exactMatchOff":"Exact match (off)","refreshTree":"Refresh directory tree","collapseAll":"Collapse all directories","searchFileContent":"Search file contents...","caseSensitive":"Case sensitive","wholeWord":"Whole word","regex":"Regex","fileTypes":"File types (ts,tsx)","compareMode":"Compare","compareModeOff":"Close branch comparison","compareModeOn":"Compare with selected branch","createFile":"New File","createFileIn":"New File (in {{path}}/)","fileName":"File name...","noRecentFiles":"No recent files","stagingArea":"Staged ({{count}})","changesSummary_one":"{{count}} change","changesSummary_other":"{{count}} changes","noChanges":"No changes in working tree","refreshChanges":"Refresh changes","unstageAll":"Unstage all","noStagedFiles":"No staged files","unstageNFiles":"Unstage {{count}} files","unstageFile":"Unstage","workspace":"Workspace ({{count}})","discardAll":"Discard all","stageAll":"Stage all","noUnstagedChanges":"No unstaged changes","discardNFiles":"Discard changes in {{count}} files","stageNFiles":"Stage {{count}} files","discardChanges":"Discard changes","stageFile":"Stage file","loadingDiff":"Loading diff...","noDiffFiles":"No diff files","nFilesChanged":"{{count}} files changed (vs {{branch}})","loadingCommits":"Loading commits...","noCommits":"No commits","allLoaded":"All {{count}} records loaded","locateInTree":"Locate in directory tree","unsaved":"Unsaved","saveBeforeSwitch":"Current file has unsaved changes. Save before switching?","saveAndSwitch":"Save and switch","closeEdit":"Close edit (ESC)","closeBtn":"Close","copyFileContent":"Copy file content","toggleJsonReadable":"Toggle JSON readable mode","previewMarkdown":"Preview Markdown","viewBlame":"View line-by-line change history","editFile":"Edit file","backToPreview":"Back to preview","cannotPreview":"Cannot preview this file","selectFileToPreview":"Select a file to preview","staged":"Staged","unstaged":"Unstaged","selectFileToViewDiff":"Select a file to view diff","loadingDiffContent":"Loading diff...","clickCompareToLoad":"Click \\"Compare\\" to load branch diff","selectCommitToView":"Select a commit to view details","confirmDelete":"Confirm Delete","confirmDeleteMessage":"Move <file>{{name}}</file> to trash?","nFilesNMatches":"{{files}} files, {{matches}} matches","resultsTruncated":"Results truncated","noContentSearchResults":"No results","enterKeywordToSearch":"Enter keyword to search file contents","searchMinChars":"Search requires at least 2 characters"},"codeViewer":{"fileModifiedExternally":"File was modified externally. Saving will overwrite external changes.","useDiskVersion":"Use disk version","forceOverwrite":"Force overwrite","searchPlaceholder":"Search...","caseSensitive":"Case sensitive","wholeWordMatch":"Whole word match","unsavedConfirm":"You have unsaved changes. Close anyway?","discardChanges":"Discard changes","continueEditing":"Continue editing","unsavedExitConfirm":"You have unsaved changes. Exit edit mode?","clickToViewDetails":"Click to view details","clickToViewCommit":"Click to view commit details","nComments":"{{count}} comments","searchChat":"Search chat...","prevShiftEnter":"Previous (Shift+Enter)","nextEnter":"Next (Enter)","closeEsc":"Close (Esc)"},"chat":{"startConversation":"Start a conversation","loadMoreHistory":"Load more...","scrollUpForMore":"↑ Scroll up to load more history","claudeThinking":"Claude is thinking...","jumpToStart":"Jump to start","jumpToLatest":"Jump to latest","copyMessage":"Copy message","forkSession":"Fork session from here","imageN":"Image {{index}}","imagePreview":"Image preview","toolCalls":"{{count}} tool calls","collapse":"▲ Collapse","expand":"▼ Expand","viewQuestions":"View questions","viewAllFileChanges":"View all file changes","requestFailed":"Request failed","cannotReadStream":"Cannot read response stream","errorRetry":"An error occurred, please retry","placeholder":"Type a message, Enter to send (Shift+Enter for new line, paste images, /qa /fx /cg /skill-name ... for commands)","placeholderDisabled":"Generating... you can keep typing","imageSizeLimit":"Image size exceeds limit (max 5MB), current: {{size}}MB","stageAll":"Stage all files (git add -A)","viewGitChanges":"View Git changes","viewAllComments":"View all comments","userMessages":"User messages","projectNotes":"Project Notes","scheduledTasks":"Scheduled Tasks","context":"Context","output":"Output","copiedCommandTooltip":"Copied!","copyCommandTooltip":"Copy command: claude -r {{sessionId}}","executedCommand":"Executed `{{command}}`{{exitInfo}}, output:\\n```\\n{{output}}\\n```","executedCommandFailed":"Failed to execute `{{command}}`: {{error}}","skillExpansionPrompt":"Please read this skill file:"},"console":{"enterCommandOrUrl":"Enter a command or URL to start","loadingMore":"Loading...","loadMoreHistory":"Load more history","quickCommands":"Quick Commands","singleColumn":"Single column","dualColumn":"Dual column","envVars":"Environment Variables","launchZsh":"Launch zsh terminal","inputPlaceholder":"Enter command or URL and press Enter... (↑↓ history, Tab complete)","scopeProject":"Project","scopeGlobal":"Global","tabSwitchEscClose":"Tab to switch \xb7 Esc to close","copyOutput":"Copy output","copyCommand":"Copy command","rerun":"Re-run","deleteRecord":"Delete record","searchPlaceholder":"Search...","searchMode":"Search","filterMode":"Filter","prevShiftEnter":"Previous (Shift+Enter)","nextEnter":"Next (Enter)","loadingTerminal":"Loading terminal...","clickToInput":"Click terminal area to type","stdinPlaceholder":"stdin input...","runningText":"Running...","exitCode":"Exit code: {{code}}","totalLines":"{{count}} lines total","globalCommands":"Global Commands","projectCommands":"Project Commands","noCustomCommands":"No custom commands yet","namePlaceholder":"Name","commandPlaceholder":"Command","restoreTooltip":"Restore ({{modKey}}M / ESC)","screenshotting":"Screenshotting...","outputFileDeleted":"[Output file deleted]"},"browser":{"blankPage":"Blank page","copyUrl":"Copy URL","openInNewWindow":"Open in new window","exitMaximize":"Exit maximize ({{modKey}}M)","maximize":"Maximize ({{modKey}}M)","pageLoadFailed":"Page load failed","clickToWake":"Click to wake","sleeping":"Sleeping","loadingPage":"Loading...","loadFailed":"Load failed"},"database":{"connectionFailed":"Connection failed","connected":"Connected","connecting":"Connecting...","refreshTableList":"Refresh table list","filterTable":"T Tables","filterView":"V Views","noTables":"No tables","tabStructure":"Structure","tabData":"Data","tabSql":"SQL","filterActive":"Filter: {{count}} cols","clearAllFilters":"Clear all filters","deleteNRows":"Delete {{count}} rows","confirmDeleteRows":"Confirm delete?","copyCsvSelected":"Copy selected rows as CSV","copyCsvAll":"Export all as CSV","copyJsonSelected":"Copy selected rows as JSON","copyJsonAll":"Export all as JSON","copyCSV":"Copy CSV","CSV":"CSV","copyJSON":"Copy JSON","JSON":"JSON","selectTable":"Select a table","selectTableToView":"Select a table to view structure","selectTableForData":"Select a table to view data","columns":"Columns","colName":"Name","colType":"Type","colNullable":"Nullable","colDefault":"Default","primaryKey":"Primary Key","foreignKeys":"Foreign Keys","indexes":"Indexes","enable":"Enable","commaValues":"Comma-separated values","likePattern":"%pattern%","valuePlaceholder":"Value","apply":"Apply","clearFilter":"Clear","addRow":"+ Add Row","totalRows":"{{count}} rows","rowsAffected":"{{command}} — {{count}} rows affected ({{duration}}ms)","queryRows":"{{count}} rows ({{duration}}ms)","resultTruncated":"[Results truncated to 1000 rows]","sqlPlaceholder":"Enter SQL... ({{modKey}}Enter to execute)","executing":"Executing...","execute":"▶ Execute","deleteRowsFailed":"{{count}} rows failed to delete","inputParams":"Input Parameters","resultLabel":"Result"},"mysql":{"connectionFailed":"Connection failed","connected":"Connected","connecting":"Connecting...","refreshTableList":"Refresh table list","filterTable":"T Tables","filterView":"V Views","noTables":"No tables","tabStructure":"Structure","tabData":"Data","tabSql":"SQL","filterActive":"Filter: {{count}} cols","clearAllFilters":"Clear all filters","deleteNRows":"Delete {{count}} rows","confirmDeleteRows":"Confirm delete?","copyCsvSelected":"Copy selected rows as CSV","copyCsvAll":"Export all as CSV","copyJsonSelected":"Copy selected rows as JSON","copyJsonAll":"Export all as JSON","copyCSV":"Copy CSV","CSV":"CSV","copyJSON":"Copy JSON","JSON":"JSON","selectTable":"Select a table","selectTableToView":"Select a table to view structure","selectTableForData":"Select a table to view data","columns":"Columns","colName":"Name","colType":"Type","colNullable":"Nullable","colDefault":"Default","primaryKey":"Primary Key","foreignKeys":"Foreign Keys","indexes":"Indexes","enable":"Enable","commaValues":"Comma-separated values","likePattern":"%pattern%","valuePlaceholder":"Value","apply":"Apply","clearFilter":"Clear","addRow":"+ Add Row","totalRows":"{{count}} rows","rowsAffected":"{{command}} — {{count}} rows affected ({{duration}}ms)","queryRows":"{{count}} rows ({{duration}}ms)","resultTruncated":"[Results truncated to 1000 rows]","sqlPlaceholder":"Enter SQL... ({{modKey}}Enter to execute)","executing":"Executing...","execute":"▶ Execute","deleteRowsFailed":"{{count}} rows failed to delete"},"redis":{"neverExpires":"Never expires","expired":"Expired","loadFailed":"Load failed","deleteFailed":"Delete failed","saveFailed":"Save failed","scanPlaceholder":"SCAN pattern...","scanSearch":"Search (SCAN)","noKeys":"No keys","loadMore":"Load more...","tabData":"Data","tabInfo":"Info","tabCli":"CLI","selectKey":"Select a key","keyNotExist":"Key does not exist","unsupportedType":"Unsupported type: {{type}}","nItems":"{{total}} items","showingN":"showing {{count}}","nMembers":"{{total}} members","nEntries":"{{total}} entries","cliHint":"Enter Redis commands, e.g. PING, GET key, KEYS *","cliPlaceholder":"Enter command..."},"git":{"switchBranch":"Switch branch","searchBranch":"Search branches...","noBranches":"No branches available","noMatchingBranches":"No matching branches","localBranches":"Local Branches","remoteBranches":"Remote Branches","branchNotFound":"Branch not found","selectBranch":"Select branch...","currentBranch":"Current","notGitRepo":"Current directory is not a Git repository","cannotGetBranches":"Cannot get branch info","getBranchesFailed":"Failed to get branch info","discardAllConfirm":"Discard changes in {{count}} workspace files? This cannot be undone.","worktree":{"title":"Git Worktree","count":"{{count}} worktrees","selectBranch":"Select branch","addWorktree":"+ Add Worktree","confirmDelete":"Confirm Delete","confirmDeleteMsg":"Delete this worktree?","path":"Path:","branch":"Branch:","locked":"Locked","unlock":"Unlock","lock":"Lock","searchBranch":"Search branches...","noBranches":"No available branches"}},"comments":{"addComment":"Add Comment","lineRange":"Line {{start}}-{{end}}","inputPlaceholder":"Enter comment...","newComment":"New comment {{range}}","commentPlaceholder":"Enter comment... ({{modKey}}Enter to submit, Esc to cancel)","nComments":"{{count}} comments","allComments":"All Comments","copyAllComments":"Copy all comments","noComments":"No comments yet","clearAll":"Clear all","totalComments":"{{count}} comments total","aiReply":"AI Reply","noContent":"(no content)","linesCount":"({{count}} lines)","codeRef":"Code reference:","note":"Note: {{content}}","submitting":"Submitting...","enterSubmit":"Enter to submit \xb7 Shift+Enter for new line","askAI":"Ask AI","inputQuestion":"Enter your question...","aiGenerating":"Generating, please wait...","enterSend":"Enter to send \xb7 Shift+Enter for new line","sendToAI":"Send to AI","aiResponding":"AI is responding...","question":"Question: {{question}}"},"fileContextMenu":{"createFile":"New File","copyFile":"Copy File","copyFolder":"Copy Folder","pasteHere":"Paste Here","deleteFile":"Delete File","deleteFolder":"Delete Folder","copyRelativePath":"Copy Relative Path","copyAbsolutePath":"Copy Absolute Path","copyRelativeDirPath":"Copy Relative Dir Path","copyAbsoluteDirPath":"Copy Absolute Dir Path","copyFileName":"Copy File Name","copyFolderName":"Copy Folder Name"},"settings":{"title":"Settings","theme":"Theme","themeLight":"Light","themeDark":"Dark","themeSystem":"System","browserExtension":"Browser Extension","extensionInstalled":"Cockpit Bridge installed","extensionNotInstalled":"Cockpit Bridge not installed","extensionDescription":"After installing the Chrome extension, link navigation in iframes will be intercepted: new tab links create new bubbles, page navigation updates the current bubble.","installSteps":"Installation steps:","step1":"1. Open Chrome and navigate to","step2":"2. Enable \\"Developer mode\\" in the top-right corner","step3":"3. Click \\"Load unpacked\\"","step4mac":"4. Press <kbd>Cmd+Shift+G</kbd> → paste the path below → Enter","copyExtensionPath":"Copy extension directory path","reloadExtension":"Reload extension","about":"About","language":"Language","languageAuto":"System","switchDark":"Switch to dark","switchLight":"Switch to light"},"editor":{"placeholder":"Write something... Type / for commands","noteTitle":"{{name}} - Notes","noteUntitled":"Notes","saving":"Saving...","linkPlaceholder":"Enter URL...","confirmLink":"Confirm","removeLink":"Remove link","heading1":"Heading 1","heading2":"Heading 2","heading3":"Heading 3","bold":"Bold","italic":"Italic","strikethrough":"Strikethrough","inlineCode":"Inline code","link":"Link","bulletList":"Bullet list","orderedList":"Ordered list","taskList":"Task list","blockquote":"Blockquote","codeBlock":"Code block","table":"Table","horizontalRule":"Horizontal rule","insertRowAbove":"Insert row above","insertRowBelow":"Insert row below","insertColumnLeft":"Insert column left","insertColumnRight":"Insert column right","deleteRow":"Delete row","deleteColumn":"Delete column","deleteTable":"Delete table","deleteCodeBlock":"Delete code block","toc":"TOC","expandToc":"Expand TOC","collapseToc":"Collapse TOC"},"slashCommands":{"heading1":"Heading 1","heading1Desc":"Large heading","heading2":"Heading 2","heading2Desc":"Medium heading","heading3":"Heading 3","heading3Desc":"Small heading","bulletList":"Bullet List","bulletListDesc":"Bulleted list","orderedList":"Ordered List","orderedListDesc":"Numbered list","taskList":"Task List","taskListDesc":"Checkable task list","blockquote":"Blockquote","blockquoteDesc":"Quote block","codeBlock":"Code Block","codeBlockDesc":"Code snippet","table":"Table","tableDesc":"Insert 3\xd73 table","horizontalRule":"Divider","horizontalRuleDesc":"Horizontal divider","link":"Link","linkDesc":"Insert hyperlink"},"commands":{"qa":"Enter requirements clarification mode","commit":"Commit code changes","review":"Code review","test":"Run tests","fix":"Fix issues","explain":"Explain code","refactor":"Refactor code"},"review":{"reviewManagement":"Review Management","allReviews":"All Reviews","noOpenReviews":"No open reviews","viewComments":"View comments","nComments":"{{count}} comments","nDocs":"{{count}} docs","nReviews":"{{count}} reviews","docList":"Document List","allReviewsList":"All Reviews","expandList":"Expand list","collapseList":"Collapse list","closeReview":"Close review","reopenReview":"Reopen","deleteReview":"Delete review","noOpenDocs":"No open documents","noReviews":"No reviews","sharing":"Sharing","notShared":"Not shared","closeSharing":"Disable sharing","enableSharing":"Enable sharing","view":"View","setNickname":"Set your nickname","nicknameHint":"Other reviewers will see this name","nicknamePlaceholder":"Enter nickname","skipForNow":"Skip for now","identitySettings":"Identity Settings","reviewNickname":"Review Nickname","random":"Random","selectTextToComment":"Select text to add comment","selectTextHint":"Select text on the left to add a comment","prevComment":"Previous","nextComment":"Next","commentsCount":"{{count}} comments","commentsNavCount":"{{current}}/{{total}} comments","allCommentsTitle":"All Comments","commentsCountBrief":"{{count}}","closedCount":"{{count}} closed","copyAllComments":"Copy all comments","noComments":"No comments yet","closedComments":"Closed ({{count}})","closedLabel":"Closed","moreReplies":"+{{count}} replies","copyComment":"Copy comment","reopen":"Reopen","closeComment":"Close comment","editComment":"Edit comment","deleteComment":"Delete comment","edited":"(edited)","editReply":"Edit reply","deleteReply":"Delete reply","reply":"Reply","replyPlaceholder":"Add a reply...","selectedText":"Selected text","addCommentPlaceholder":"Add a comment...","enterSubmitHint":"Enter to submit, Shift+Enter for new line","commentBtn":"Comment","reviewNotExist":"Review does not exist or has been deleted","loadFailed":"Load failed","networkError":"Network error","reviewNotFound":"Review not found","checkLink":"Please check the link","updatedAt":"Updated {{date}}","active":"Active","closed":"Closed","viewAllComments":"View all comments","viewCommentBtn":"View Comments","copyLink":"Copy Link","reviewSummary":"Review Comments Summary — {{title}}","totalNComments":"{{count}} comments total","quoteRef":"Quote: \\"{{text}}\\"","commentAuthor":"Comment ({{author}}): {{content}}","replyAuthor":" ↳ {{author}}: {{content}}"},"markdown":{"copied":"✓ Copied","copy":"Copy"},"imagePreview":{"previewImage":"Preview image","deleteImage":"Delete image"},"tokenStats":{"title":"Claude Code Token Stats","activeHours":"Active Hours Distribution","hourSessions":"{{h}}:00 — {{count}} sessions","messages":"Messages","toolCalls":"Tool Calls","activityTrend":"Activity Trend","byModel":"By Model","tokenUsage":"Token Usage","equivalentCost":"Equivalent Cost","modelCostDetail":"Model Cost Details","model":"Model","share":"Share","total":"Total","totalSessions":"Total Sessions","totalMessages":"Total Messages","equivalentApiCost":"Equivalent API Cost","longestSession":"Longest Session","firstUse":"First Use","notFound":"~/.claude/stats-cache.json not found","day":"Day","week":"Week","month":"Month"},"toolCall":{"inputParams":"Input Parameters","resultLabel":"Result","inputParamsTitle":"View input parameters","resultTitle":"View result","input":"Input","result":"Result","foldedLines":"... ({{count}} lines)"},"fileEditor":{"unsavedConfirm":"You have unsaved changes. Close anyway?","discardChanges":"Discard changes","continueEditing":"Continue editing","externallyModified":"File was modified externally. Saving will overwrite external changes.","useDiskVersion":"Use disk version","forceOverwrite":"Force overwrite"},"quickFileOpen":{"placeholder":"Type file name to open...","noMatch":"No matching files","recent":"Recent","selectHint":"Select","openHint":"Open","closeHint":"Close"},"envManager":{"title":"Environment Variables","tabScope":"Current Tab Only","globalScope":"Global Environment Variables","varNamePlaceholder":"Variable name (e.g. NODE_ENV)","varValuePlaceholder":"Value (e.g. production)","valuePlaceholder":"Value","noVars":"No environment variables yet. Add one to get started."},"aliasManager":{"title":"Command Aliases","description":"Set shortcut aliases for common commands (global)","aliasPlaceholder":"Alias (e.g. ll)","commandPlaceholder":"Full command (e.g. ls -la)","fullCommandPlaceholder":"Full command","usage":"Usage tip:","usageDesc":"Type an alias to execute the corresponding full command","noAliases":"No command aliases yet. Add one to get started."},"diffViewer":{"fileChanges":"File Changes ({{count}})","selectFileToView":"Select a file to view changes","sideBySide":"Side by side","unified":"Unified","previewFile":"Preview file","copiedAll":"Full text copied","compact":"Compact","full":"Full","gap":{"hidden":"{{count}} lines hidden","more":"\xb7\xb7\xb7 more +{{count}} \xb7\xb7\xb7","expandUp":"Expand {{count}} lines up","expandDown":"Expand {{count}} lines down"}},"commitDetail":{"title":"Commit Details","hash":"Hash:","author":"Author:","date":"Date:","files":"Files:","nChanges":"{{count}} changes","loadingFiles":"Loading files...","noFileChanges":"No file changes","loadingDiff":"Loading diff...","selectFileToView":"Select a file to view diff"},"askQuestion":{"title":"Questions","nQuestions":"{{count}} questions","checkedN":"{{count}} checked","copyChecked":"Copy {{count}} checked Q&A","copyAll":"Copy all Q&A","checkToCopy":"Check to copy","custom":"Custom","customPlaceholder":"Enter custom answer...","notSelected":"(not selected)"},"tabBar":{"unpin":"Unpin","pin":"Pin to favorites","closeTab":"Close tab","newTab":"New tab"},"tabManagerTopBar":{"copyPageUrl":"Copy page URL","copyDirPath":"Copy directory path","refreshProject":"Refresh project","openInVSCode":"Open in VS Code","openInCursor":"Open in Cursor","aliasesGlobal":"Command Aliases (Global)","tokenStats":"Token Stats","openSurething":"Open Surething"},"hoverTooltip":{"findReferences":"Find References","search":"Search"},"todoViewer":{"title":"Task List","progress":"{{completed}} / {{total}} done"},"userMessages":{"title":"User Messages","noMessages":"No user messages"},"shortIdBadge":{"clickToDisconnect":"Click to disconnect","clickToRegister":"Click to register and copy CLI command"},"api":{"pathForbidden":"Operation not allowed on this path","deleteForbidden":"Delete not allowed on this path","notAFolder":"Target is not a folder","imageTooLarge":"Image too large to preview","cannotPreviewBinary":"Cannot preview binary file","fileTooLarge":"File too large to preview (over 10MB)","fileModifiedExternally":"File was modified externally","pickFolderPrompt":"Select project folder"},"confirm":{"title":"Notice","ok":"OK","cancel":"Cancel"},"floatingToolbar":{"addComment":"Add Comment","sendToAI":"Send to AI","search":"Search"},"searchResults":{"title":"Search Results","nMatches":"({{count}} matches)","searching":"Searching...","noResults":"No matches"},"references":{"title":"References","searching":"Searching...","notFound":"No references found"},"gitFileTree":{"noFiles":"No files"},"reviewUtils":{"adjectives":["Happy","Brave","Quiet","Bright","Gentle","Agile","Free","Clear","Flying","Relaxed","Lively","Wise","Calm","Alert","Composed","Steady","Cheerful","Warm","Bold","Poised"],"nouns":["Panda","Dolphin","Crane","Snow Leopard","Skylark","Squirrel","Flying Fish","Deer","Bluebird","Silver Fox","Owl","Dragonfly","Firefly","Sea Turtle","Butterfly","Monkey","Red-crowned Crane","Antelope","Swallow","Penguin"]}}'),f=JSON.parse('{"common":{"save":"保存","cancel":"取消","delete":"删除","close":"关闭","copy":"复制","edit":"编辑","file":"文件","codeMap":"代码地图","confirm":"确认","loading":"加载中...","search":"搜索","refresh":"刷新","retry":"重试","submit":"提交","copied":"已复制","saved":"已保存","failed":"失败","noMatch":"无匹配","noData":"无数据","done":"完成","justNow":"刚刚","minutesAgo":"{{count}}分钟前","hoursAgo":"{{count}}小时前","daysAgo":"{{count}}天前","monthsAgo":"{{count}}个月前","yearsAgo":"{{count}}年前","saveFailed":"保存失败","copyFailed":"复制失败","deleteFailed":"删除失败","operationFailed":"操作失败","copiedPath":"已复制路径","copyAbsPath":"复制绝对路径","loadMore":"加载更多","noResult":"无匹配结果","selected":"已选择","selectAll":"全选","hint":"提示","confirmBtn":"确定","cancelBtn":"取消","preview":"预览","readable":"可读","previous":"上一个","next":"下一个","all":"全部","input":"输入","result":"结果","line":"行","lines":"行","running":"运行中","connecting":"连接中","connected":"已连接","connectionFailed":"连接失败","builtin":"内置","global":"全局","project":"项目","current":"当前"},"toast":{"savedSuccess":"已保存","saveFailed":"保存失败","copiedName":"已复制: {{name}}","copyFailed":"复制失败","deleteFailed":"删除失败","operationFailed":"操作失败","staged":"已暂存","stageFailed":"暂存失败","unstaged":"已取消暂存","unstageFailed":"取消暂存失败","stagedNFiles":"已暂存 {{count}} 个文件","unstagedNFiles":"已取消暂存 {{count}} 个文件","discardFailed":"放弃变更失败","discardedNFiles":"已放弃 {{count}} 个文件的变更","stagedAllFiles":"已暂存所有文件","deletedFile":"已删除文件","discardedChanges":"已放弃变更","pastedFile":"已粘贴: {{name}}","pasteFailed":"粘贴失败","noFileToPaste":"没有可粘贴的文件","createdFile":"已创建文件: {{name}}","createFailed":"创建失败","movedToTrash":"已移动到回收站: {{name}}","copiedPageUrl":"已复制页面地址","copiedDirPath":"已复制目录路径","switchedToBranch":"已切换到 {{branch}}","switchBranchFailed":"切换分支失败","loadBranchFailed":"加载分支列表失败","copiedCommand":"已复制: {{command}}","copiedMessage":"已复制消息","copiedUrl":"已复制网址","copiedOutput":"已复制输出","copiedCmd":"已复制命令","copiedComment":"已复制评论","copiedAllComments":"已复制全部评论","copiedFileContent":"已复制文件内容","copiedQA":"已复制 {{count}} 个问答","copiedAllQA":"已复制所有问答","readFileFailed":"读取文件失败","reviewCreated":"评审已创建,链接已复制","reviewUpdated":"评审已更新,链接已复制","reviewCreateFailed":"创建评审失败","sharingClosed":"已关闭分享","sharingCloseFailed":"关闭分享失败","linkCopied":"链接已复制","addCommentFailed":"添加评论失败","deleteCommentFailed":"删除评论失败","editCommentFailed":"编辑评论失败","addReplyFailed":"添加回复失败","deleteReplyFailed":"删除回复失败","editReplyFailed":"编辑回复失败","disconnected":"已断开: {{id}}","pluginReloading":"插件重载中...","worktreeCreateSuccess":"Worktree 创建成功: {{name}}","worktreeCreateFailed":"创建 worktree 失败","worktreeLoadFailed":"加载 worktree 列表失败","worktreeDeleted":"Worktree 已删除","worktreeDeleteFailed":"删除 worktree 失败","worktreeLocked":"已锁定","worktreeUnlocked":"已解锁"},"workspace":{"selectProject":"选择一个项目开始","searchProjectPath":"搜索项目路径...","loadingProjects":"加载项目中...","projectNotFound":"未找到项目","sessions":"{{count}} 会话","loadingSessions":"加载会话...","noSessions":"无会话记录","loadingText":"加载中...","openProject":"打开项目","expandSidebar":"展开侧边栏","collapseSidebar":"折叠侧边栏","notes":"笔记","skills":"技能","settings":"设置","projectNotes":"项目笔记","closeProject":"关闭项目"},"sessions":{"recentSessions":"最近会话","runningCount":"{{count}} 运行中","unreadCount":"{{count}} 未读","noSessions":"暂无会话记录","running":"运行中","done":"完成","pinnedSessions":"常用会话","noPinnedSessions":"暂无常用会话,在 Tab 栏点击图钉可添加","editTitle":"编辑标题","remove":"移除","projectSessions":"项目会话","browseAllSessions":"浏览所有会话","sessionList":"会话列表","searchSessions":"搜索会话...","loadingSessions":"加载会话中...","noMatchingSessions":"未找到匹配的会话","noSessionsYet":"暂无会话","projectList":"项目列表","openFolder":"打开文件夹","selectingFolder":"选择中...","loadingHistory":"加载历史消息..."},"scheduledTasks":{"title":"定时任务","aboutToTrigger":"即将触发","secondsLater":"{{count}}秒后","minutesLater":"{{count}}分钟后","hoursMinutesLater":"{{h}}小时{{m}}分后","hoursLater":"{{h}}小时后","onceType":"一次性 ({{minutes}}分钟)","everyNMinutes":"每{{minutes}}分钟","completed":"已完成","paused":"已暂停","activeCount":"{{running}} 个活跃","pausedCount":"{{paused}} 个暂停","noScheduledTasks":"暂无定时任务,在聊天输入栏点击时钟按钮创建","lastResult":"上次","runNow":"立即运行","resume":"恢复","pause":"暂停","completedCount":"已完成 ({{count}})","success":"成功","failure":"失败","createTask":"创建定时任务","editTask":"编辑定时任务","sendMessage":"发送消息","messagePlaceholder":"输入要发送的消息...","type":"类型","once":"一次性","interval":"周期","quickSelect":"快捷选择","customCron":"自定义 Cron 表达式","customMinutes":"自定义分钟数","cronPlaceholder":"例: 0 9 * * 1-5 (工作日9点)","cronFormat":"格式:分 时 日 月 星期(如 0 9 * * 1-5)","minutesPlaceholder":"分钟数","limitTimeRange":"限制执行时段","to":"至","saveBtn":"保存 ({{modKey}}↩)","createBtn":"创建 ({{modKey}}↩)","5minLater":"5 分钟后","15minLater":"15 分钟后","30minLater":"30 分钟后","1hourLater":"1 小时后","every15min":"每 15 分钟","every30min":"每 30 分钟","every1hour":"每 1 小时","every2hours":"每 2 小时","daily9am":"每天 09:00","daily6pm":"每天 18:00","weeklyMon9am":"每周一 09:00","monthly1st9am":"每月 1 号 09:00"},"cron":{"everyNMinutes":"每 {{n}} 分钟","everyNHours":"每 {{n}} 小时整点","everyMinute":"每分钟","everyHourAtMin":"每小时第 {{m}} 分","hourlyEveryMin":"{{h}} 点每分钟","daily":"每天 {{time}}","weekdays":"工作日","weekends":"周末","dowSun":"日","dowMon":"一","dowTue":"二","dowWed":"三","dowThu":"四","dowFri":"五","dowSat":"六","monthPrefix":"月","dayOfMonth":"号","dayRange":"{{a}}号到{{b}}号","weekdayPrefix":"周","weekdayRange":"周{{a}}到周{{b}}"},"blockViewer":{"empty":{"body":"在左侧文件树选择一个文件,查看它的代码地图。","hint":"或按 ⌘K 搜索。"},"fileMode":{"loading":"加载中…","notFound":"该文件未索引(不支持的语言或超出文件上限)。"},"search":{"tooltip":"搜索 (⌘K)","hint":"开始输入以搜索","noResults":"未找到匹配","files":"文件","symbols":"符号"},"viewerToggle":{"toBlock":"显示代码地图","toCode":"返回代码视图"},"toc":{"title":"本文件","empty":"未检测到函数。"},"history":{"title":"历史","empty":"点击左右两侧的 pin 开始追踪调用链。","clear":"清空历史"},"refresh":"重新构建项目图","retry":"重试"},"blockDiffViewer":{"loading":"正在生成代码地图…","unsupported":"该文件类型暂不支持代码地图 diff","unsupportedHint":"切回常规 diff 视图查看。","error":"代码地图 diff 失败:{{message}}","noBlockChanges":"代码地图无变化(仅格式或空白)。","noBefore":"(新增)","noAfter":"(已删除)","kind":{"added":"新增","deleted":"删除","modified":"修改"}},"fileBrowser":{"directoryTree":"目录树","searchTab":"搜索","recentTab":"最近","changesTab":"变更","historyTab":"历史","searchFiles":"搜索文件...","clear":"清除","exactMatchOn":"全词匹配(已开启)","exactMatchOff":"全词匹配(已关闭)","refreshTree":"刷新目录树","collapseAll":"折叠所有目录","searchFileContent":"搜索文件内容...","caseSensitive":"区分大小写","wholeWord":"完整词","regex":"正则","fileTypes":"文件类型 (ts,tsx)","compareMode":"对比","compareModeOff":"关闭分支对比","compareModeOn":"与选定分支对比","createFile":"新建文件","createFileIn":"新建文件 (在 {{path}}/)","fileName":"文件名...","noRecentFiles":"暂无最近浏览的文件","stagingArea":"暂存区 ({{count}})","changesSummary_one":"{{count}} 个变更","changesSummary_other":"{{count}} 个变更","noChanges":"工作区无变更","refreshChanges":"刷新变更列表","unstageAll":"全部取消","noStagedFiles":"无暂存的文件","unstageNFiles":"取消暂存 {{count}} 个文件","unstageFile":"取消暂存","workspace":"工作区 ({{count}})","discardAll":"放弃所有","stageAll":"全部暂存","noUnstagedChanges":"无未暂存的变更","discardNFiles":"放弃 {{count}} 个文件的变更","stageNFiles":"暂存 {{count}} 个文件","discardChanges":"放弃变更","stageFile":"暂存文件","loadingDiff":"加载对比文件中...","noDiffFiles":"无差异文件","nFilesChanged":"{{count}} 个文件变更(vs {{branch}})","loadingCommits":"加载提交记录中...","noCommits":"无提交记录","allLoaded":"已加载全部 {{count}} 条记录","locateInTree":"在目录树中定位","unsaved":"未保存","saveBeforeSwitch":"当前文件有未保存的修改,是否保存后切换?","saveAndSwitch":"保存并切换","closeEdit":"关闭编辑 (ESC)","closeBtn":"关闭","copyFileContent":"复制文件内容","toggleJsonReadable":"切换 JSON 可读模式","previewMarkdown":"预览 Markdown 渲染效果","viewBlame":"查看每行代码的修改记录","editFile":"编辑文件","backToPreview":"返回预览","cannotPreview":"无法预览此文件","selectFileToPreview":"选择文件以预览","staged":"已暂存","unstaged":"未暂存","selectFileToViewDiff":"选择文件查看差异","loadingDiffContent":"加载差异中...","clickCompareToLoad":"点击「对比」加载分支差异","selectCommitToView":"选择提交查看详情","confirmDelete":"确认删除","confirmDeleteMessage":"确定要将 <file>{{name}}</file> 移动到回收站吗?","nFilesNMatches":"{{files}} 个文件,{{matches}} 处匹配","resultsTruncated":"结果已截断","noContentSearchResults":"无匹配结果","enterKeywordToSearch":"输入关键词搜索文件内容","searchMinChars":"搜索内容至少需要 2 个字符"},"codeViewer":{"fileModifiedExternally":"文件已被外部修改,保存将覆盖外部更改","useDiskVersion":"使用磁盘版本","forceOverwrite":"强制覆盖","searchPlaceholder":"搜索...","caseSensitive":"区分大小写","wholeWordMatch":"全字匹配","unsavedConfirm":"有未保存的修改,确定关闭?","discardChanges":"放弃修改","continueEditing":"继续编辑","unsavedExitConfirm":"有未保存的修改,确定退出编辑模式?","clickToViewDetails":"点击查看详情","clickToViewCommit":"点击查看 commit 详情","nComments":"{{count}} 条评论","searchChat":"搜索聊天内容...","prevShiftEnter":"上一个 (Shift+Enter)","nextEnter":"下一个 (Enter)","closeEsc":"关闭 (Esc)"},"chat":{"startConversation":"开始对话吧","loadMoreHistory":"加载更多...","scrollUpForMore":"↑ 向上滚动加载更多历史","claudeThinking":"Claude 正在思考...","jumpToStart":"跳转到开始","jumpToLatest":"跳转到最新","copyMessage":"复制消息","forkSession":"从此处分叉会话","imageN":"图片 {{index}}","imagePreview":"图片预览","toolCalls":"{{count}} 个工具调用","collapse":"▲ 收起","expand":"▼ 展开","viewQuestions":"查看提问","viewAllFileChanges":"查看所有文件变更","requestFailed":"请求失败","cannotReadStream":"无法读取响应流","errorRetry":"发生错误,请重试","placeholder":"输入消息,Enter 发送 (Shift+Enter 换行,可粘贴图片,/qa /fx /cg /skill-name ... 显示命令)","placeholderDisabled":"生成中... 可继续输入","imageSizeLimit":"图片大小超过限制(最大 5MB),当前大小: {{size}}MB","stageAll":"暂存所有文件 (git add -A)","viewGitChanges":"查看 Git 变更","viewAllComments":"查看所有评论","userMessages":"用户消息列表","projectNotes":"项目笔记","scheduledTasks":"定时任务","context":"上下文","output":"输出","copiedCommandTooltip":"已复制!","copyCommandTooltip":"复制命令: claude -r {{sessionId}}","executedCommand":"执行了 `{{command}}`{{exitInfo}},输出:\\n```\\n{{output}}\\n```","executedCommandFailed":"执行 `{{command}}` 失败:{{error}}","skillExpansionPrompt":"请读取这个 skill 文件:"},"console":{"enterCommandOrUrl":"输入命令或网址开始使用","loadingMore":"加载中...","loadMoreHistory":"加载更多历史","quickCommands":"快捷命令","singleColumn":"单列布局","dualColumn":"双列布局","envVars":"环境变量","launchZsh":"启动 zsh 交互终端","inputPlaceholder":"输入命令或网址并按 Enter... (↑↓ 历史, Tab 补全)","scopeProject":"项目","scopeGlobal":"全局","tabSwitchEscClose":"Tab 切换 \xb7 Esc 关闭","copyOutput":"复制输出","copyCommand":"复制命令","rerun":"重新运行","deleteRecord":"删除记录","searchPlaceholder":"搜索...","searchMode":"搜索","filterMode":"过滤","prevShiftEnter":"上一个 (Shift+Enter)","nextEnter":"下一个 (Enter)","loadingTerminal":"加载终端...","clickToInput":"点击终端区域输入","stdinPlaceholder":"stdin 输入...","runningText":"运行中...","exitCode":"退出代码: {{code}}","totalLines":"共 {{count}} 行","globalCommands":"全局命令","projectCommands":"项目命令","noCustomCommands":"暂无自定义命令","namePlaceholder":"名称","commandPlaceholder":"命令","restoreTooltip":"还原 ({{modKey}}M / ESC)","screenshotting":"截图中...","outputFileDeleted":"[输出文件已删除]"},"browser":{"blankPage":"空白页","copyUrl":"复制网址","openInNewWindow":"在新窗口打开","exitMaximize":"退出最大化 ({{modKey}}M)","maximize":"最大化 ({{modKey}}M)","pageLoadFailed":"页面加载失败","clickToWake":"点击唤醒","sleeping":"已休眠","loadingPage":"加载中...","loadFailed":"加载失败"},"database":{"connectionFailed":"连接失败","connected":"已连接","connecting":"连接中...","refreshTableList":"刷新表列表","filterTable":"T 表","filterView":"V 视图","noTables":"无表","tabStructure":"结构","tabData":"数据","tabSql":"SQL","filterActive":"筛选: {{count}}列","clearAllFilters":"清除所有筛选","deleteNRows":"删除 {{count}} 行","confirmDeleteRows":"确认删除?","copyCsvSelected":"复制选中行为 CSV","copyCsvAll":"导出全表 CSV","copyJsonSelected":"复制选中行为 JSON","copyJsonAll":"导出全表 JSON","copyCSV":"复制 CSV","CSV":"CSV","copyJSON":"复制 JSON","JSON":"JSON","selectTable":"选择左侧表格","selectTableToView":"选择表以查看结构","selectTableForData":"选择表以查看数据","columns":"列","colName":"名称","colType":"类型","colNullable":"可空","colDefault":"默认值","primaryKey":"主键","foreignKeys":"外键","indexes":"索引","enable":"启用","commaValues":"逗号分隔多值","likePattern":"%pattern%","valuePlaceholder":"值","apply":"应用","clearFilter":"清除","addRow":"+ 新增行","totalRows":"{{count}} 行","rowsAffected":"{{command}} — {{count}} 行受影响 ({{duration}}ms)","queryRows":"{{count}} 行 ({{duration}}ms)","resultTruncated":"[结果已截断至1000行]","sqlPlaceholder":"输入 SQL... ({{modKey}}Enter 执行)","executing":"执行中...","execute":"▶ 执行","deleteRowsFailed":"{{count}} 行删除失败","inputParams":"输入参数","resultLabel":"结果"},"mysql":{"connectionFailed":"连接失败","connected":"已连接","connecting":"连接中...","refreshTableList":"刷新表列表","filterTable":"T 表","filterView":"V 视图","noTables":"无表","tabStructure":"结构","tabData":"数据","tabSql":"SQL","filterActive":"筛选: {{count}}列","clearAllFilters":"清除所有筛选","deleteNRows":"删除 {{count}} 行","confirmDeleteRows":"确认删除?","copyCsvSelected":"复制选中行为 CSV","copyCsvAll":"导出全表 CSV","copyJsonSelected":"复制选中行为 JSON","copyJsonAll":"导出全表 JSON","copyCSV":"复制 CSV","CSV":"CSV","copyJSON":"复制 JSON","JSON":"JSON","selectTable":"选择左侧表格","selectTableToView":"选择表以查看结构","selectTableForData":"选择表以查看数据","columns":"列","colName":"名称","colType":"类型","colNullable":"可空","colDefault":"默认值","primaryKey":"主键","foreignKeys":"外键","indexes":"索引","enable":"启用","commaValues":"逗号分隔多值","likePattern":"%pattern%","valuePlaceholder":"值","apply":"应用","clearFilter":"清除","addRow":"+ 新增行","totalRows":"{{count}} 行","rowsAffected":"{{command}} — {{count}} 行受影响 ({{duration}}ms)","queryRows":"{{count}} 行 ({{duration}}ms)","resultTruncated":"[结果已截断至1000行]","sqlPlaceholder":"输入 SQL... ({{modKey}}Enter 执行)","executing":"执行中...","execute":"▶ 执行","deleteRowsFailed":"{{count}} 行删除失败"},"redis":{"neverExpires":"永不过期","expired":"已过期","loadFailed":"加载失败","deleteFailed":"删除失败","saveFailed":"保存失败","scanPlaceholder":"SCAN 模式...","scanSearch":"搜索 (SCAN)","noKeys":"无 key","loadMore":"加载更多...","tabData":"数据","tabInfo":"信息","tabCli":"CLI","selectKey":"选择左侧 Key","keyNotExist":"Key 不存在","unsupportedType":"不支持的类型: {{type}}","nItems":"{{total}} items","showingN":"显示 {{count}}","nMembers":"{{total}} members","nEntries":"{{total}} entries","cliHint":"输入 Redis 命令,如 PING, GET key, KEYS *","cliPlaceholder":"输入命令..."},"git":{"switchBranch":"切换分支","searchBranch":"搜索分支...","noBranches":"无可切换分支","noMatchingBranches":"无匹配分支","localBranches":"本地分支","remoteBranches":"远程分支","branchNotFound":"未找到分支","selectBranch":"选择分支...","currentBranch":"当前","notGitRepo":"当前目录不是 Git 仓库","cannotGetBranches":"无法获取分支信息","getBranchesFailed":"获取分支信息失败","discardAllConfirm":"确定要放弃工作区的 {{count}} 个文件的变更吗?此操作不可恢复。","worktree":{"title":"Git Worktree","count":"{{count}} 个 worktree","selectBranch":"选择分支","addWorktree":"+ 添加 Worktree","confirmDelete":"确认删除","confirmDeleteMsg":"确定要删除 worktree 吗?","path":"路径:","branch":"分支:","locked":"已锁定","unlock":"解锁","lock":"锁定","searchBranch":"搜索分支...","noBranches":"无可用分支"}},"comments":{"addComment":"添加评论","lineRange":"行 {{start}}-{{end}}","inputPlaceholder":"输入评论...","newComment":"新评论 {{range}}","commentPlaceholder":"输入评论... ({{modKey}}Enter 提交, Esc 取消)","nComments":"{{count}} 条评论","allComments":"所有评论","copyAllComments":"复制全部评论","noComments":"暂无评论","clearAll":"清空所有","totalComments":"共 {{count}} 条评论","aiReply":"AI 回复","noContent":"(无内容)","linesCount":"({{count}} 行)","codeRef":"代码引用:","note":"备注: {{content}}","submitting":"提交中...","enterSubmit":"Enter 提交 \xb7 Shift+Enter 换行","askAI":"提问 AI","inputQuestion":"输入你的问题...","aiGenerating":"正在生成中,请稍候...","enterSend":"Enter 发送 \xb7 Shift+Enter 换行","sendToAI":"发送到 AI","aiResponding":"AI 正在响应中...","question":"问题: {{question}}"},"fileContextMenu":{"createFile":"新建文件","copyFile":"复制文件","copyFolder":"复制文件夹","pasteHere":"粘贴到此处","deleteFile":"删除文件","deleteFolder":"删除文件夹","copyRelativePath":"复制相对路径","copyAbsolutePath":"复制绝对路径","copyRelativeDirPath":"复制相对文件夹路径","copyAbsoluteDirPath":"复制绝对文件夹路径","copyFileName":"复制文件名","copyFolderName":"复制文件夹名"},"settings":{"title":"设置","theme":"主题","themeLight":"浅色","themeDark":"深色","themeSystem":"跟随系统","browserExtension":"浏览器插件","extensionInstalled":"Cockpit Bridge 已安装","extensionNotInstalled":"Cockpit Bridge 未安装","extensionDescription":"安装 Chrome 插件后,iframe 内的链接跳转将被拦截:新标签链接创建新气泡,页面内导航更新当前气泡。","installSteps":"安装步骤:","step1":"1. 打开 Chrome 地址栏输入","step2":"2. 开启右上角「开发者模式」","step3":"3. 点击「加载已解压的扩展程序」","step4mac":"4. 按 <kbd>Cmd+Shift+G</kbd> → 粘贴下方路径 → 回车","copyExtensionPath":"复制插件目录路径","reloadExtension":"重载插件","about":"关于","language":"语言","languageAuto":"跟随系统","switchDark":"切换暗色","switchLight":"切换亮色"},"editor":{"placeholder":"写点什么... 输入 / 打开快捷命令","noteTitle":"{{name}} - 笔记","noteUntitled":"笔记","saving":"保存中...","linkPlaceholder":"输入链接地址...","confirmLink":"确认","removeLink":"移除链接","heading1":"标题 1","heading2":"标题 2","heading3":"标题 3","bold":"粗体","italic":"斜体","strikethrough":"删除线","inlineCode":"行内代码","link":"链接","bulletList":"无序列表","orderedList":"有序列表","taskList":"待办列表","blockquote":"引用","codeBlock":"代码块","table":"表格","horizontalRule":"分割线","insertRowAbove":"在上方插入行","insertRowBelow":"在下方插入行","insertColumnLeft":"在左侧插入列","insertColumnRight":"在右侧插入列","deleteRow":"删除当前行","deleteColumn":"删除当前列","deleteTable":"删除表格","deleteCodeBlock":"删除代码块","toc":"目录","expandToc":"展开目录","collapseToc":"收起目录"},"slashCommands":{"heading1":"标题 1","heading1Desc":"大标题","heading2":"标题 2","heading2Desc":"中标题","heading3":"标题 3","heading3Desc":"小标题","bulletList":"无序列表","bulletListDesc":"项目符号列表","orderedList":"有序列表","orderedListDesc":"编号列表","taskList":"待办列表","taskListDesc":"可勾选的任务列表","blockquote":"引用","blockquoteDesc":"引用块","codeBlock":"代码块","codeBlockDesc":"代码片段","table":"表格","tableDesc":"插入 3\xd73 表格","horizontalRule":"分割线","horizontalRuleDesc":"水平分割线","link":"链接","linkDesc":"插入超链接"},"commands":{"qa":"进入需求澄清讨论模式","commit":"提交代码变更","review":"代码审查","test":"运行测试","fix":"修复问题","explain":"解释代码","refactor":"重构代码"},"review":{"reviewManagement":"评审管理","allReviews":"所有评审","noOpenReviews":"暂无开放评审","viewComments":"查看评论","nComments":"{{count}} 条评论","nDocs":"{{count}} 文档","nReviews":"{{count}} 评审","docList":"文档列表","allReviewsList":"所有评审","expandList":"展开列表","collapseList":"折叠列表","closeReview":"关闭评审","reopenReview":"重新开放","deleteReview":"删除评审","noOpenDocs":"暂无开放文档","noReviews":"暂无评审","sharing":"分享中","notShared":"未分享","closeSharing":"关闭分享","enableSharing":"开启分享评审","view":"查看","setNickname":"设置你的昵称","nicknameHint":"其他评审人将看到这个名字","nicknamePlaceholder":"输入昵称","skipForNow":"下次再说","identitySettings":"身份设置","reviewNickname":"评审昵称","random":"随机","selectTextToComment":"选中左侧文本添加评论","selectTextHint":"选中左侧文本即可添加评论","prevComment":"上一条","nextComment":"下一条","commentsCount":"{{count}} 条评论","commentsNavCount":"{{current}}/{{total}} 条评论","allCommentsTitle":"全部评论","commentsCountBrief":"{{count}} 条","closedCount":"{{count}} 条已关闭","copyAllComments":"复制全部评论","noComments":"暂无评论","closedComments":"已关闭 ({{count}})","closedLabel":"已关闭","moreReplies":"+{{count}} 条回复","copyComment":"复制评论","reopen":"重开","closeComment":"关闭评论","editComment":"编辑评论","deleteComment":"删除评论","edited":"(已编辑)","editReply":"编辑回复","deleteReply":"删除回复","reply":"回复","replyPlaceholder":"添加回复...","selectedText":"选中文本","addCommentPlaceholder":"添加评论...","enterSubmitHint":"Enter 提交,Shift+Enter 换行","commentBtn":"评论","reviewNotExist":"评审不存在或已被删除","loadFailed":"加载失败","networkError":"网络错误","reviewNotFound":"评审不存在","checkLink":"请检查链接是否正确","updatedAt":"更新于 {{date}}","active":"开放中","closed":"已关闭","viewAllComments":"查看全部评论","viewCommentBtn":"查看评论","copyLink":"复制链接","reviewSummary":"评审评论汇总 — {{title}}","totalNComments":"共 {{count}} 条评论","quoteRef":"引用: \\"{{text}}\\"","commentAuthor":"评论 ({{author}}): {{content}}","replyAuthor":" ↳ {{author}}: {{content}}"},"markdown":{"copied":"✓ 已复制","copy":"复制"},"imagePreview":{"previewImage":"预览图片","deleteImage":"删除图片"},"tokenStats":{"title":"Claude Code Token 统计","activeHours":"活跃时段分布","hourSessions":"{{h}}:00 — {{count}} 次会话","messages":"消息","toolCalls":"工具调用","activityTrend":"活动趋势","byModel":"按模型","tokenUsage":"Token 用量","equivalentCost":"等效费用","modelCostDetail":"模型费用明细","model":"模型","share":"占比","total":"合计","totalSessions":"总会话","totalMessages":"总消息","equivalentApiCost":"等效 API 费用","longestSession":"最长会话","firstUse":"首次使用","notFound":"未找到 ~/.claude/stats-cache.json","day":"日","week":"周","month":"月"},"toolCall":{"inputParams":"输入参数","resultLabel":"结果","inputParamsTitle":"查看输入参数","resultTitle":"查看结果","input":"输入","result":"结果","foldedLines":"... ({{count}} 行)"},"fileEditor":{"unsavedConfirm":"有未保存的修改,确定关闭?","discardChanges":"放弃修改","continueEditing":"继续编辑","externallyModified":"文件已被外部修改,保存将覆盖外部更改","useDiskVersion":"使用磁盘版本","forceOverwrite":"强制覆盖"},"quickFileOpen":{"placeholder":"输入文件名快速打开...","noMatch":"没有匹配的文件","recent":"最近","selectHint":"选择","openHint":"打开","closeHint":"关闭"},"envManager":{"title":"环境变量管理","tabScope":"当前 Tab 专用","globalScope":"全局环境变量","varNamePlaceholder":"变量名(如 NODE_ENV)","varValuePlaceholder":"值(如 production)","valuePlaceholder":"值","noVars":"还没有环境变量,添加一个试试"},"aliasManager":{"title":"命令别名管理","description":"为常用命令设置快捷别名(全局生效)","aliasPlaceholder":"别名(如 ll)","commandPlaceholder":"完整命令(如 ls -la)","fullCommandPlaceholder":"完整命令","usage":"使用提示:","usageDesc":"输入别名即可执行对应的完整命令","noAliases":"还没有命令别名,添加一个试试"},"diffViewer":{"fileChanges":"文件变更 ({{count}} 处)","selectFileToView":"选择左侧文件查看变更","sideBySide":"并列对比","unified":"统一对比","previewFile":"预览文件","copiedAll":"已复制全文","compact":"精简","full":"全文","gap":{"hidden":"已隐藏 {{count}} 行","more":"\xb7\xb7\xb7 更多 +{{count}} \xb7\xb7\xb7","expandUp":"向上展开 {{count}} 行","expandDown":"向下展开 {{count}} 行"}},"commitDetail":{"title":"提交详情","hash":"哈希:","author":"作者:","date":"日期:","files":"文件:","nChanges":"{{count}} 个变更","loadingFiles":"加载文件中...","noFileChanges":"无文件变更","loadingDiff":"加载差异中...","selectFileToView":"选择文件查看差异"},"askQuestion":{"title":"提问","nQuestions":"{{count}} 个问题","checkedN":"已勾选 {{count}}","copyChecked":"复制勾选的 {{count}} 个问答","copyAll":"复制所有问答","checkToCopy":"勾选以复制","custom":"自定义","customPlaceholder":"输入自定义回答...","notSelected":"(未选择)"},"tabBar":{"unpin":"取消固定","pin":"固定到常用会话","closeTab":"关闭标签","newTab":"新建标签"},"tabManagerTopBar":{"copyPageUrl":"复制页面地址","copyDirPath":"复制目录路径","refreshProject":"刷新当前项目","openInVSCode":"在 VS Code 中打开","openInCursor":"在 Cursor 中打开","aliasesGlobal":"命令别名(全局)","tokenStats":"Token 统计","openSurething":"打开 Surething"},"hoverTooltip":{"findReferences":"查找引用","search":"搜索"},"todoViewer":{"title":"任务列表","progress":"{{completed}} / {{total}} 完成"},"userMessages":{"title":"用户消息列表","noMessages":"暂无用户消息"},"shortIdBadge":{"clickToDisconnect":"点击断开连接","clickToRegister":"点击注册并复制 CLI 命令"},"api":{"pathForbidden":"不允许操作此路径","deleteForbidden":"不允许删除此路径","notAFolder":"目标不是文件夹","imageTooLarge":"图片文件过大,无法预览","cannotPreviewBinary":"无法预览二进制文件","fileTooLarge":"文件过大,无法预览(超过 10MB)","fileModifiedExternally":"文件已被外部修改","pickFolderPrompt":"选择项目文件夹"},"confirm":{"title":"提示","ok":"确定","cancel":"取消"},"floatingToolbar":{"addComment":"添加评论","sendToAI":"发送 AI","search":"搜索"},"searchResults":{"title":"搜索结果","nMatches":"({{count}} 处匹配)","searching":"搜索中...","noResults":"无匹配结果"},"references":{"title":"引用","searching":"搜索中...","notFound":"未找到引用"},"gitFileTree":{"noFiles":"无文件"},"reviewUtils":{"adjectives":["快乐","勇敢","安静","明亮","温柔","灵巧","自由","清澈","飞翔","悠闲","活泼","聪慧","淡定","机敏","从容","坚定","爽朗","和煦","奔放","沉稳"],"nouns":["熊猫","海豚","白鹤","雪豹","云雀","松鼠","飞鱼","梅花鹿","青鸟","银狐","猫头鹰","蜻蜓","萤火虫","海龟","蝴蝶","金丝猴","丹顶鹤","羚羊","燕子","企鹅"]}}');d.Ay.isInitialized||d.Ay.init({resources:{en:{translation:e},zh:{translation:f}},lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});let g=d.Ay},2633:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{d:()=>k});var e=c(48249),f=c(67484),g=c(87844),h=c(55287),i=c(7833);c(33281),c(80532);var j=a([h]);function k({skillId:a,onClose:b}){let[c,d]=(0,f.useState)(null),[j,l]=(0,f.useState)(!0),[m,n]=(0,f.useState)("preview"),o=(0,f.useCallback)(async()=>{if(c?.path)try{await navigator.clipboard.writeText(c.path),(0,i.oR)("Path copied","success")}catch{(0,i.oR)("Failed to copy","error")}},[c]);return(0,e.jsxs)("div",{className:"fixed inset-0 z-[70] flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:b}),(0,e.jsxs)("div",{className:"relative bg-card rounded-lg shadow-xl w-full max-w-4xl h-[85vh] mx-4 flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-foreground truncate",children:c?.name?`/${c.name}`:"Skill Preview"}),(0,e.jsx)("button",{onClick:o,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:"Copy path",children:(0,e.jsxs)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]})})]}),c?.path&&(0,e.jsx)("div",{className:"text-xs text-muted-foreground font-mono truncate mt-0.5",children:c.path})]}),(0,e.jsxs)("div",{className:"flex items-center rounded-md border border-border overflow-hidden text-xs flex-shrink-0",children:[(0,e.jsx)("button",{onClick:()=>n("preview"),className:`px-3 py-1 transition-colors ${"preview"===m?"bg-brand text-white":"text-muted-foreground hover:text-foreground hover:bg-accent"}`,children:"Preview"}),(0,e.jsx)("button",{onClick:()=>n("source"),className:`px-3 py-1 transition-colors ${"source"===m?"bg-brand text-white":"text-muted-foreground hover:text-foreground hover:bg-accent"}`,children:"Source"})]}),(0,e.jsx)("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors flex-shrink-0",title:"Close",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:j?(0,e.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"Loading..."}):c&&c.valid?"preview"===m?(0,e.jsx)("div",{className:"px-6 py-4",children:(0,e.jsx)(g.T,{content:c.content})}):(0,e.jsx)(h.XO,{content:c.content,filePath:c.path,className:"min-h-full"}):(0,e.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"File cannot be read."})})]})]})}h=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},2929:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{s:()=>z});var e=c(48249),f=c(67484),g=c(44256),h=c(7833),i=c(49681),j=c(21735),k=c(33740),l=c(55313),m=c(32616),n=c(80983),o=c(69424),p=c(57632),q=c(73887),r=c(7122),s=c(87844),t=c(33281),u=c(41224),v=c(44384),w=a([q,n,p,o]);function x({image:a,onClose:b}){let{t:c}=(0,v.Bd)(),d=(0,e.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:b,children:[(0,e.jsx)("button",{onClick:b,className:"absolute top-4 right-4 w-10 h-10 flex items-center justify-center text-white/80 hover:text-white bg-black/40 hover:bg-black/60 rounded-full transition-colors",children:(0,e.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),(0,e.jsx)("img",{src:`data:${a.media_type};base64,${a.data}`,alt:c("chat.imagePreview"),className:"max-w-[90vw] max-h-[90vh] object-contain",onClick:a=>a.stopPropagation()})]});return(0,e.jsx)(g.ZL,{children:d})}function y({filePath:a,content:b,cwd:c,onClose:d}){let[h,i]=(0,f.useState)(null);return(0,e.jsx)(g.ZL,{children:(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:d,children:(0,e.jsx)("div",{ref:i,className:"bg-card rounded-lg shadow-xl w-full max-w-[90%] h-[90vh] flex flex-col relative",onClick:a=>a.stopPropagation(),children:(0,e.jsx)(r.SU,{container:h,children:(0,e.jsx)(q.M,{content:b,filePath:a,cwd:c,onClose:d})})})})})}[q,n,p,o]=w.then?(await w)():w;let z=(0,f.memo)(function({message:a,cwd:b,sessionId:c,onFork:d}){let g,q,r,w,{t:z}=(0,v.Bd)(),[A,B]=(0,f.useState)(null),[C,D]=(0,f.useState)(()=>1===(a.toolCalls?.length||0)),[E,F]=(0,f.useState)(!1),[G,H]=(0,f.useState)(!1),I="user"===a.role,J=a.images&&a.images.length>0,K=a.toolCalls?.length||0,L=K>0,M=!!c&&!!b&&!!d,N=(0,f.useMemo)(()=>a.toolCalls?.some(a=>"Edit"===a.name||"Write"===a.name)||!1,[a.toolCalls]),O=(0,f.useMemo)(()=>{if(!a.toolCalls)return null;for(let b=a.toolCalls.length-1;b>=0;b--)if("TodoWrite"===a.toolCalls[b].name)return a.toolCalls[b];return null},[a.toolCalls]),P=(0,f.useMemo)(()=>a.toolCalls?a.toolCalls.filter(a=>"AskUserQuestion"===a.name):[],[a.toolCalls]),Q=(0,f.useMemo)(()=>{if(!a.toolCalls)return[];let b=new Set,c=[];for(let d of a.toolCalls)if("Read"===d.name||"Edit"===d.name||"Write"===d.name){let a=d.input.file_path;a&&a.toLowerCase().endsWith(".md")&&!b.has(a)&&(b.add(a),c.push(a))}return c},[a.toolCalls]),R=(0,f.useMemo)(()=>{if(!a.toolCalls)return[];let b=[];for(let c of a.toolCalls){let a=c.input?.thought;if(a&&"string"==typeof a){let d=a.match(/PREVIOUS:\s*(.*?)\s*→\s*THIS:\s*(.*?)\s*→\s*EXPECT:\s*(.*)/i);d?b.push({previous:d[1].trim(),current:d[2].trim(),expect:d[3].trim(),raw:a,toolName:c.name}):b.push({previous:"",current:a,expect:"",raw:a,toolName:c.name})}}return b},[a.toolCalls]),[S,T]=(0,f.useState)(null),[U,V]=(0,f.useState)(null);(0,f.useEffect)(()=>{if(!S)return void queueMicrotask(()=>V(null));let a=!1;return t.t4.runPromiseExit((0,u.an)(S)).then(b=>{a||("Success"===b._tag&&void 0!==b.value.content?V(b.value.content):((0,h.oR)(z("toast.readFileFailed"),"error"),T(null)))}),()=>{a=!0}},[S,z]);let W=()=>{a.content&&(navigator.clipboard.writeText(a.content),(0,h.oR)(z("toast.copiedMessage")))},X=()=>{M&&d(a.id)},Y=(a=>{if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`})(a.timestamp);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:`flex flex-col ${I?"items-end":"items-start"} mb-4 group`,"data-role":a.role,children:[Y&&(0,e.jsx)("span",{className:"text-[11px] text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity mb-0.5 px-1",children:Y}),(0,e.jsxs)("div",{className:`flex ${I?"justify-end":"justify-start"} w-full`,children:[I&&(0,e.jsxs)("div",{className:"self-start mt-2 mr-1 flex flex-col gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[a.content&&(0,e.jsx)("button",{onClick:W,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent",title:z("chat.copyMessage"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),M&&(0,e.jsx)("button",{onClick:X,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent",title:z("chat.forkSession"),children:(0,e.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("circle",{cx:"12",cy:"18",r:"3"}),(0,e.jsx)("circle",{cx:"6",cy:"6",r:"3"}),(0,e.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,e.jsx)("path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9"}),(0,e.jsx)("path",{d:"M12 12v3"})]})})]}),(0,e.jsxs)("div",{className:`max-w-[80%] ${I?"bg-accent text-foreground border border-brand rounded-2xl rounded-br-md":"bg-accent text-foreground dark:text-slate-11 rounded-2xl rounded-bl-md"} px-4 py-2`,children:[J&&(0,e.jsx)("div",{className:`flex flex-wrap gap-2 ${a.content?"mb-2":""}`,children:a.images.map((a,b)=>(0,e.jsx)("div",{className:"relative w-16 h-16 rounded-lg overflow-hidden border border-white/20 cursor-pointer hover:opacity-90 transition-opacity",onClick:()=>B(a),children:(0,e.jsx)("img",{src:`data:${a.media_type};base64,${a.data}`,alt:z("chat.imageN",{index:b+1}),className:"w-full h-full object-cover"})},b))}),a.content&&(0,e.jsxs)("div",{className:"break-words",children:[(0,e.jsx)(s.T,{content:a.content,isUser:I,isStreaming:a.isStreaming,enableMath:!1}),a.isStreaming&&(0,e.jsx)("span",{className:"inline-block w-2 h-4 ml-1 bg-current animate-pulse"})]}),O&&(g=O.input?.todos,r=(q=Array.isArray(g)?g:[]).filter(a=>"completed"===a.status).length,w=q.length,(0,e.jsx)("div",{className:`${a.content||J?"mt-2":""}`,children:(0,e.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden bg-secondary/50 px-3 py-2 space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,e.jsx)("div",{className:"flex-1 h-1 bg-secondary rounded-full overflow-hidden",children:(0,e.jsx)("div",{className:"h-full bg-green-500 rounded-full transition-all duration-300",style:{width:`${w>0?r/w*100:0}%`}})}),(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:[r,"/",w]})]}),q.map((a,b)=>(0,e.jsxs)("div",{className:`flex items-center gap-1.5 ${"completed"===a.status?"opacity-50":""}`,children:["completed"===a.status?(0,e.jsx)(i.A,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):"in_progress"===a.status?(0,e.jsx)(j.A,{className:"w-3 h-3 text-brand flex-shrink-0 animate-spin"}):(0,e.jsx)(k.A,{className:"w-3 h-3 text-muted-foreground flex-shrink-0"}),(0,e.jsx)("span",{className:`text-xs truncate ${"completed"===a.status?"text-muted-foreground":"text-foreground"}`,children:"in_progress"===a.status&&a.activeForm?a.activeForm:a.content})]},b))]})})),Q.length>0&&(0,e.jsx)("div",{className:`${a.content||J||O?"mt-2":""}`,children:(0,e.jsx)("div",{className:"border border-border rounded-lg overflow-hidden bg-secondary/50 px-3 py-2 space-y-0.5",children:Q.map(a=>(0,e.jsxs)("button",{onClick:()=>T(a),className:"flex items-center gap-1.5 w-full text-left hover:bg-accent rounded px-1 py-0.5 transition-colors group/md",children:[(0,e.jsx)("svg",{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground group-hover/md:text-foreground truncate",children:a.split("/").pop()})]},a))})}),R.length>0&&(0,e.jsx)("div",{className:`${a.content||J||O||Q.length>0?"mt-2":""}`,children:(0,e.jsx)("div",{className:"border border-border rounded-lg overflow-hidden bg-secondary/50",children:(0,e.jsxs)("table",{className:"w-full text-xs",children:[(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{className:"border-b border-border text-muted-foreground",children:[(0,e.jsx)("th",{className:"px-2 py-1.5 text-left font-medium w-[60px]",children:"Tool"}),(0,e.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",children:"Previous"}),(0,e.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",children:"Action"}),(0,e.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",children:"Expect"})]})}),(0,e.jsx)("tbody",{children:R.map((a,b)=>(0,e.jsxs)("tr",{className:b<R.length-1?"border-b border-border/50":"",children:[(0,e.jsx)("td",{className:"px-2 py-1 text-muted-foreground font-mono",children:a.toolName}),(0,e.jsx)("td",{className:"px-2 py-1 text-muted-foreground",children:a.previous||"—"}),(0,e.jsx)("td",{className:"px-2 py-1 text-foreground",children:a.current}),(0,e.jsx)("td",{className:"px-2 py-1 text-muted-foreground",children:a.expect||"—"})]},b))})]})})}),a.toolCalls&&a.toolCalls.length>0&&(0,e.jsx)("div",{className:`${a.content||J?"mt-2":""}`,children:L?(0,e.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden bg-secondary",children:[(0,e.jsxs)("div",{className:"flex items-center",children:[(0,e.jsxs)("button",{onClick:()=>D(!C),className:"flex-1 px-3 py-2 flex items-center gap-2 text-left hover:bg-accent transition-colors active:bg-muted",children:[(0,e.jsx)("span",{className:"text-lg",children:"\uD83D\uDD27"}),(0,e.jsx)("span",{className:"font-medium text-foreground",children:z("chat.toolCalls",{count:K})}),(0,e.jsx)("span",{className:"ml-auto text-muted-foreground text-sm",children:C?z("chat.collapse"):z("chat.expand")})]}),P.length>0&&(0,e.jsx)("button",{onClick:()=>H(!0),className:"px-3 py-2 text-muted-foreground hover:text-foreground hover:bg-accent transition-colors border-l border-border",title:z("chat.viewQuestions"),children:(0,e.jsx)(l.A,{className:"w-4 h-4"})}),N&&(0,e.jsx)("button",{onClick:()=>F(!0),className:"px-3 py-2 text-muted-foreground hover:text-foreground hover:bg-accent transition-colors border-l border-border",title:z("chat.viewAllFileChanges"),children:(0,e.jsx)(m.A,{className:"w-4 h-4"})})]}),C&&(0,e.jsx)("div",{className:"border-t border-border p-2 space-y-1",children:a.toolCalls.map((a,c)=>(0,e.jsx)(n.K,{toolCall:a,cwd:b},`${a.id}-${c}`))})]}):a.toolCalls.map((a,c)=>(0,e.jsx)(n.K,{toolCall:a,cwd:b},`${a.id}-${c}`))})]}),!I&&(0,e.jsxs)("div",{className:"self-start mt-2 ml-1 flex flex-col gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[a.content&&(0,e.jsx)("button",{onClick:W,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent",title:z("chat.copyMessage"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),M&&(0,e.jsx)("button",{onClick:X,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent",title:z("chat.forkSession"),children:(0,e.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("circle",{cx:"12",cy:"18",r:"3"}),(0,e.jsx)("circle",{cx:"6",cy:"6",r:"3"}),(0,e.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,e.jsx)("path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9"}),(0,e.jsx)("path",{d:"M12 12v3"})]})})]})]})]}),A&&(0,e.jsx)(x,{image:A,onClose:()=>B(null)}),E&&a.toolCalls&&(0,e.jsx)(p.z,{toolCalls:a.toolCalls,cwd:b,onClose:()=>F(!1)}),G&&P.length>0&&(0,e.jsx)(o.$,{toolCalls:P,onClose:()=>H(!1)}),S&&null!==U&&(0,e.jsx)(y,{filePath:S,content:U,cwd:b||"",onClose:()=>T(null)})]})});d()}catch(a){d(a)}})},3033:(a,b,c)=>{"use strict";c.d(b,{w:()=>p});var d=c(48249),e=c(67484),f=c(44384);c(33281),c(41224);let g={"claude-opus-4-6":{label:"Opus 4.6",input:5,output:25,cacheRead:.5,cacheWrite:6.25,color:"#f97316"},"claude-opus-4-5-20251101":{label:"Opus 4.5",input:5,output:25,cacheRead:.5,cacheWrite:6.25,color:"#fb923c"},"claude-sonnet-4-6":{label:"Sonnet 4.6",input:3,output:15,cacheRead:.3,cacheWrite:3.75,color:"#3b82f6"},"claude-sonnet-4-5-20250929":{label:"Sonnet 4.5",input:3,output:15,cacheRead:.3,cacheWrite:3.75,color:"#60a5fa"},"claude-haiku-4-5-20251001":{label:"Haiku 4.5",input:1,output:5,cacheRead:.1,cacheWrite:1.25,color:"#22c55e"}},h={label:"",input:3,output:15,cacheRead:.3,cacheWrite:3.75,color:"#94a3b8"};function i(a){if(g[a])return g[a];let b=a.toLowerCase();return b.includes("opus")?{...h,input:5,output:25,cacheRead:.5,cacheWrite:6.25,color:"#f97316"}:b.includes("haiku")?{...h,input:1,output:5,cacheRead:.1,cacheWrite:1.25,color:"#22c55e"}:h}function j(a){let b=g[a];return b?b.label:a.replace(/^claude-/,"").replace(/-\d{8}$/,"").replace(/-/g," ").replace(/\b\w/g,a=>a.toUpperCase())}function k(a){return(g[a]??i(a)).color}function l(a){return a>=1e9?`${(a/1e9).toFixed(1)}B`:a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(1)}K`:String(a)}function m(a){return a>=1e3?`$${a.toFixed(0)}`:a>=100?`$${a.toFixed(1)}`:`$${a.toFixed(2)}`}function n({data:a,height:b=200,formatValue:c=l}){let f=(0,e.useRef)(null),g=(0,e.useRef)(null),[h,i]=(0,e.useState)(null),j=(0,e.useRef)([]);(0,e.useCallback)(()=>{let d=f.current,e=g.current;if(!d||!e)return;let h=window.devicePixelRatio||1,i=e.getBoundingClientRect().width;d.width=i*h,d.height=b*h,d.style.width=`${i}px`,d.style.height=`${b}px`;let k=d.getContext("2d");k.scale(h,h),k.clearRect(0,0,i,b);let{labels:l,datasets:m}=a;if(0===l.length)return;let n=i-50-12,o=b-8-28,p=function(a){if(a<=0)return 1;let b=Math.pow(10,Math.floor(Math.log10(a))),c=a/b;return c<=1?b:c<=2?2*b:c<=5?5*b:10*b}(Math.max(1,...l.map((a,b)=>m.reduce((a,c)=>a+c.data[b],0))));k.fillStyle=getComputedStyle(d).getPropertyValue("color")||"#888",k.font="10px ui-monospace, monospace",k.textAlign="right",k.textBaseline="middle";for(let a=0;a<=4;a++){var q;let b=p/4*a,e=8+o-b/p*o;k.fillText(c(b),44,e),k.strokeStyle=(q="--border",getComputedStyle(d).getPropertyValue(q).trim()||"#333"),k.lineWidth=.5,k.beginPath(),k.moveTo(50,e),k.lineTo(50+n,e),k.stroke()}let r=n/l.length,s=Math.max(4,Math.min(.6*r,32)),t=[];l.forEach((a,b)=>{let c=50+b*r+(r-s)/2,e=0;m.forEach(d=>{var f,g,h,i,j,l;let m=d.data[b];if(m<=0)return;let n=m/p*o,q=8+o-e-n;k.fillStyle=d.color,f=k,g=c,h=q,i=s,l=2,(j=n)<1||(l=Math.min(l,j/2,i/2),f.beginPath(),f.moveTo(g+l,h),f.lineTo(g+i-l,h),f.quadraticCurveTo(g+i,h,g+i,h+l),f.lineTo(g+i,h+j-l),f.quadraticCurveTo(g+i,h+j,g+i-l,h+j),f.lineTo(g+l,h+j),f.quadraticCurveTo(g,h+j,g,h+j-l),f.lineTo(g,h+l),f.quadraticCurveTo(g,h,g+l,h),f.fill()),t.push({x:c,y:q,w:s,h:n,label:a,value:m,dataset:d.label,color:d.color}),e+=n}),k.fillStyle=getComputedStyle(d).getPropertyValue("color")||"#888",k.font="9px ui-monospace, monospace",k.textAlign="center",k.textBaseline="top",b%(l.length>20?Math.ceil(l.length/15):1)==0&&k.fillText(a,c+s/2,8+o+6)}),j.current=t},[a,b,c]);let k=(0,e.useCallback)(a=>{let b=f.current?.getBoundingClientRect();if(!b)return;let d=a.clientX-b.left,e=a.clientY-b.top,g=j.current.find(a=>d>=a.x&&d<=a.x+a.w&&e>=a.y&&e<=a.y+a.h);g?i({x:a.clientX-b.left,y:g.y-4,content:`${g.dataset}: ${c(g.value)}`}):i(null)},[c]);return(0,d.jsxs)("div",{ref:g,className:"relative w-full text-muted-foreground",children:[(0,d.jsx)("canvas",{ref:f,className:"w-full",style:{height:b},onMouseMove:k,onMouseLeave:()=>i(null)}),h&&(0,d.jsx)("div",{className:"absolute pointer-events-none bg-popover text-popover-foreground text-[10px] px-2 py-1 rounded shadow-lg border border-border whitespace-nowrap z-10",style:{left:h.x,top:h.y,transform:"translate(-50%, -100%)"},children:h.content})]})}function o({hourCounts:a}){let{t:b}=(0,f.Bd)(),c=Math.max(1,...Object.values(a)),e=Array.from({length:24},(a,b)=>b);return(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:b("tokenStats.activeHours")}),(0,d.jsx)("div",{className:"flex gap-[2px] items-end h-16",children:e.map(e=>{let f=a[String(e)]||0,g=f/c;return(0,d.jsxs)("div",{className:"flex-1 flex flex-col items-center gap-0.5",title:b("tokenStats.hourSessions",{h:e,count:f}),children:[(0,d.jsx)("div",{className:"w-full rounded-sm transition-all",style:{height:`${Math.max(2,48*g)}px`,backgroundColor:g>0?`rgba(59, 130, 246, ${.2+.8*g})`:"var(--muted)"}}),e%3==0&&(0,d.jsx)("span",{className:"text-[8px] text-muted-foreground",children:e})]},e)})})]})}function p({isOpen:a,onClose:b}){var c;let g,h,{t:r}=(0,f.Bd)(),[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(!0),[w,x]=(0,e.useState)("day"),[y,z]=(0,e.useState)("tokens"),[A,B]=(0,e.useState)("claude"),C=(0,e.useMemo)(()=>s?.modelUsage?Object.entries(s.modelUsage).filter(([a])=>!a.startsWith("<")).map(([a,b])=>{let c;return{id:a,label:j(a),color:k(a),usage:b,cost:(c=i(a),b.inputTokens/1e6*c.input+b.outputTokens/1e6*c.output+b.cacheReadInputTokens/1e6*c.cacheRead+b.cacheCreationInputTokens/1e6*c.cacheWrite),totalTokens:b.inputTokens+b.outputTokens+b.cacheReadInputTokens+b.cacheCreationInputTokens}}).sort((a,b)=>b.cost-a.cost):[],[s]),D=(0,e.useMemo)(()=>C.reduce((a,b)=>a+b.cost,0),[C]),E=(0,e.useMemo)(()=>C.map(a=>a.id),[C]),F=(0,e.useMemo)(()=>{let a={};for(let b of C)a[b.id]=b.totalTokens>0?b.cost/b.totalTokens:0;return a},[C]),{activityChart:G,tokenChart:H,costChart:I}=(0,e.useMemo)(()=>{let a=s?.dailyActivity||[],b=s?.dailyModelTokens||[];if("day"===w){let c=a.slice(-60),d=b.slice(-60),e={labels:c.map(a=>a.date.slice(5)),datasets:[{label:r("tokenStats.messages"),data:c.map(a=>a.messageCount),color:"#3b82f6"},{label:r("tokenStats.toolCalls"),data:c.map(a=>a.toolCallCount),color:"#22c55e"}]},f=d.map(a=>a.date.slice(5));return{activityChart:e,tokenChart:{labels:f,datasets:E.map(a=>({label:j(a),data:d.map(b=>b.tokensByModel[a]||0),color:k(a)}))},costChart:{labels:f,datasets:E.map(a=>({label:j(a),data:d.map(b=>(b.tokensByModel[a]||0)*(F[a]||0)),color:k(a)}))}}}if("week"===w){let c=function(a,b){let c=new Map;for(let b of a){let a=new Date(b.date),d=new Date(a);d.setDate(a.getDate()-a.getDay());let e=d.toISOString().slice(0,10),f=e.slice(5);c.has(e)||c.set(e,{label:f,messages:0,sessions:0,tools:0,tokensByModel:{}});let g=c.get(e);g.messages+=b.messageCount,g.sessions+=b.sessionCount,g.tools+=b.toolCallCount}for(let a of b){let b=new Date(a.date),d=new Date(b);d.setDate(b.getDate()-b.getDay());let e=d.toISOString().slice(0,10);c.has(e)||c.set(e,{label:e.slice(5),messages:0,sessions:0,tools:0,tokensByModel:{}});let f=c.get(e);for(let[b,c]of Object.entries(a.tokensByModel))f.tokensByModel[b]=(f.tokensByModel[b]||0)+c}return Array.from(c.values()).sort((a,b)=>a.label.localeCompare(b.label))}(a,b),d=c.map(a=>a.label),e={labels:d,datasets:[{label:r("tokenStats.messages"),data:c.map(a=>a.messages),color:"#3b82f6"},{label:r("tokenStats.toolCalls"),data:c.map(a=>a.tools),color:"#22c55e"}]};return{activityChart:e,tokenChart:{labels:d,datasets:E.map(a=>({label:j(a),data:c.map(b=>b.tokensByModel[a]||0),color:k(a)}))},costChart:{labels:d,datasets:E.map(a=>({label:j(a),data:c.map(b=>(b.tokensByModel[a]||0)*(F[a]||0)),color:k(a)}))}}}let c=function(a,b){let c=new Map;for(let b of a){let a=b.date.slice(0,7);c.has(a)||c.set(a,{label:a,messages:0,sessions:0,tools:0,tokensByModel:{}});let d=c.get(a);d.messages+=b.messageCount,d.sessions+=b.sessionCount,d.tools+=b.toolCallCount}for(let a of b){let b=a.date.slice(0,7);c.has(b)||c.set(b,{label:b,messages:0,sessions:0,tools:0,tokensByModel:{}});let d=c.get(b);for(let[b,c]of Object.entries(a.tokensByModel))d.tokensByModel[b]=(d.tokensByModel[b]||0)+c}return Array.from(c.values()).sort((a,b)=>a.label.localeCompare(b.label))}(a,b),d=c.map(a=>a.label),e={labels:d,datasets:[{label:r("tokenStats.messages"),data:c.map(a=>a.messages),color:"#3b82f6"},{label:r("tokenStats.toolCalls"),data:c.map(a=>a.tools),color:"#22c55e"}]};return{activityChart:e,tokenChart:{labels:d,datasets:E.map(a=>({label:j(a),data:c.map(b=>b.tokensByModel[a]||0),color:k(a)}))},costChart:{labels:d,datasets:E.map(a=>({label:j(a),data:c.map(b=>(b.tokensByModel[a]||0)*(F[a]||0)),color:k(a)}))}}},[s,w,E,F,r]);if(!a)return null;let J=[{key:"day",label:r("tokenStats.day")},{key:"week",label:r("tokenStats.week")},{key:"month",label:r("tokenStats.month")}];return(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:b}),(0,d.jsxs)("div",{className:"relative bg-card rounded-xl shadow-xl w-full max-w-4xl mx-4 max-h-[90vh] flex flex-col overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border flex-shrink-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("h2",{className:"text-sm font-medium text-foreground",children:r("tokenStats.title")}),(0,d.jsx)("div",{className:"flex bg-muted rounded-md p-0.5",children:["claude","claude2"].map(a=>(0,d.jsx)("button",{className:`px-2.5 py-0.5 text-[11px] rounded transition-colors ${A===a?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>{t(null),B(a)},children:"claude"===a?"Claude":"Claude 2"},a))}),(0,d.jsx)("div",{className:"flex bg-muted rounded-md p-0.5",children:J.map(a=>(0,d.jsx)("button",{className:`px-2.5 py-0.5 text-[11px] rounded transition-colors ${w===a.key?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>x(a.key),children:a.label},a.key))})]}),(0,d.jsx)("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-6",children:u?(0,d.jsx)("div",{className:"text-center text-muted-foreground py-12",children:r("common.loading")}):s?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"grid grid-cols-5 gap-3",children:[(0,d.jsx)(q,{label:r("tokenStats.totalSessions"),value:String(s.totalSessions??0)}),(0,d.jsx)(q,{label:r("tokenStats.totalMessages"),value:l(s.totalMessages??0)}),(0,d.jsx)(q,{label:r("tokenStats.equivalentApiCost"),value:m(D),highlight:!0}),(0,d.jsx)(q,{label:r("tokenStats.longestSession"),value:s.longestSession?(g=Math.floor((c=s.longestSession.duration)/36e5),h=Math.floor(c%36e5/6e4),g>0?`${g}h ${h}m`:`${h}m`):"-"}),(0,d.jsx)(q,{label:r("tokenStats.firstUse"),value:s.firstSessionDate?s.firstSessionDate.slice(0,10):"-"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,d.jsx)("h3",{className:"text-xs font-medium text-muted-foreground",children:r("tokenStats.activityTrend")}),(0,d.jsxs)("div",{className:"flex items-center gap-3 text-[10px]",children:[(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("span",{className:"inline-block w-2.5 h-2.5 rounded-sm",style:{backgroundColor:"#3b82f6"}}),r("tokenStats.messages")]}),(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("span",{className:"inline-block w-2.5 h-2.5 rounded-sm",style:{backgroundColor:"#22c55e"}}),r("tokenStats.toolCalls")]})]})]}),(0,d.jsx)("div",{className:"border border-border rounded-lg p-3 bg-muted/20",children:(0,d.jsx)(n,{data:G,height:180})})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h3",{className:"text-xs font-medium text-muted-foreground",children:r("tokenStats.byModel")}),(0,d.jsxs)("div",{className:"flex bg-muted rounded-md p-0.5",children:[(0,d.jsx)("button",{className:`px-2.5 py-0.5 text-[11px] rounded transition-colors ${"tokens"===y?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>z("tokens"),children:r("tokenStats.tokenUsage")}),(0,d.jsx)("button",{className:`px-2.5 py-0.5 text-[11px] rounded transition-colors ${"cost"===y?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>z("cost"),children:r("tokenStats.equivalentCost")})]})]}),(0,d.jsx)("div",{className:"flex items-center gap-3 text-[10px] flex-wrap",children:C.map(a=>(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("span",{className:"inline-block w-2.5 h-2.5 rounded-sm",style:{backgroundColor:a.color}}),a.label]},a.id))})]}),(0,d.jsx)("div",{className:"border border-border rounded-lg p-3 bg-muted/20",children:(0,d.jsx)(n,{data:"tokens"===y?H:I,height:180,formatValue:"tokens"===y?l:m})})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:r("tokenStats.modelCostDetail")}),(0,d.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:(0,d.jsxs)("table",{className:"w-full text-xs",children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{className:"bg-muted/50 text-muted-foreground",children:[(0,d.jsx)("th",{className:"text-left px-3 py-2 font-medium",children:r("tokenStats.model")}),(0,d.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:"Input"}),(0,d.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:"Output"}),(0,d.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:"Cache Read"}),(0,d.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:"Cache Write"}),(0,d.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:r("tokenStats.share")}),(0,d.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:r("tokenStats.equivalentCost")})]})}),(0,d.jsxs)("tbody",{children:[C.map(a=>(0,d.jsxs)("tr",{className:"border-t border-border",children:[(0,d.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:a.color}}),a.label]})}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:l(a.usage.inputTokens)}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:l(a.usage.outputTokens)}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:l(a.usage.cacheReadInputTokens)}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:l(a.usage.cacheCreationInputTokens)}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:D>0?`${(a.cost/D*100).toFixed(1)}%`:"-"}),(0,d.jsx)("td",{className:"px-3 py-2 text-right font-medium text-foreground",children:m(a.cost)})]},a.id)),(0,d.jsxs)("tr",{className:"border-t-2 border-border bg-muted/30",children:[(0,d.jsx)("td",{className:"px-3 py-2 font-medium text-foreground",children:r("tokenStats.total")}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:l(C.reduce((a,b)=>a+b.usage.inputTokens,0))}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:l(C.reduce((a,b)=>a+b.usage.outputTokens,0))}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:l(C.reduce((a,b)=>a+b.usage.cacheReadInputTokens,0))}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:l(C.reduce((a,b)=>a+b.usage.cacheCreationInputTokens,0))}),(0,d.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:"100%"}),(0,d.jsx)("td",{className:"px-3 py-2 text-right font-bold text-foreground",children:m(D)})]})]})]})})]}),s.hourCounts&&Object.keys(s.hourCounts).length>0&&(0,d.jsx)("div",{className:"border border-border rounded-lg p-3 bg-muted/20",children:(0,d.jsx)(o,{hourCounts:s.hourCounts})})]}):(0,d.jsx)("div",{className:"text-center text-muted-foreground py-12",children:r("tokenStats.notFound")})})]})]})}function q({label:a,value:b,highlight:c}){return(0,d.jsxs)("div",{className:"bg-muted/30 rounded-lg px-3 py-2.5",children:[(0,d.jsx)("div",{className:"text-[10px] text-muted-foreground",children:a}),(0,d.jsx)("div",{className:`text-sm font-semibold mt-0.5 ${c?"text-brand":"text-foreground"}`,children:b})]})}},3406:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(48249),e=c(3560),f=c(18792),g=c(74493),h=a([f]);f=(h.then?(await h)():h)[0],(0,e.Aq)({type:"neo4j",idPrefix:"neo4j",match(a){let b=a.trim().toLowerCase();return b.startsWith("neo4j://")||b.startsWith("neo4j+s://")||b.startsWith("bolt://")||b.startsWith("bolt+s://")},parse(a){let b=a.trim(),c=b;try{let a=new URL(b);c=`${a.hostname}${a.port?":"+a.port:":7687"}`}catch{}return{connectionString:b,displayName:c}},fromHistory:a=>({connectionString:a.connectionString,displayName:a.displayName||a.connectionString}),toHistory:a=>({connectionString:a.connectionString,displayName:a.displayName}),Component:function({item:a,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l}){return(0,d.jsx)(f.P,{id:a.id,connectionString:a.connectionString,displayName:a.displayName,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l})},async onClose(a){await (0,g.ax)("neo4j",a.id)}}),b()}catch(a){b(a)}})},3560:(a,b,c)=>{"use strict";c.d(b,{Aq:()=>e,lf:()=>h,sd:()=>f,sk:()=>g});let d=new Map;function e(a){d.set(a.type,a)}function f(a){return d.get(a)}function g(a){for(let b of d.values())if(b.match(a))return b;return null}function h(a){return`${a}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}},3588:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{TabBar:()=>l});var e=c(48249),f=c(67484),g=c(72529),h=c(44256),i=c(44384);function j({number:a,isActive:b}){return(0,e.jsxs)("svg",{className:`w-5 h-5 flex-shrink-0 ${b?"text-brand":"text-muted-foreground"}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,e.jsx)("text",{x:"12",y:"16",textAnchor:"middle",fill:"currentColor",stroke:"none",fontSize:"12",fontWeight:"500",children:a})]})}function k({onNewTab:a,onNewClaude2Tab:b,onNewCodexTab:c,onNewKimiTab:d,onNewOllamaTab:g,onNewDeepseekTab:i}){let[j,l]=(0,f.useState)(!1),m=(0,f.useRef)(null),n=(0,f.useRef)(null),[o,p]=(0,f.useState)({top:0,right:0}),q=(0,h.F2)(),r=e=>{l(!1),"claude2"===e?b?.():"codex"===e?c?.():"kimi"===e?d?.():"ollama"===e?g?.():"deepseek"===e?i?.():a()};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{ref:m,onClick:()=>{if(!j&&m.current){let a=m.current.getBoundingClientRect(),b=q?.getBoundingClientRect(),c=b?.left??0,d=b?.top??0,e=b?.width??window.innerWidth;p({top:a.bottom+4-d,right:e-(a.right-c)})}l(a=>!a)},className:"flex-shrink-0 p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:"New tab",children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}),j&&(0,e.jsx)(h.ZL,{children:(0,e.jsxs)("div",{ref:n,className:"fixed z-[9999] bg-popover border border-border rounded-lg shadow-lg py-1 min-w-[140px]",style:{top:o.top,right:o.right},children:[(0,e.jsxs)("button",{onClick:()=>r("claude"),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-foreground hover:bg-brand/10 transition-colors whitespace-nowrap",children:[(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-brand flex-shrink-0"}),"Claude Code"]}),(0,e.jsxs)("button",{onClick:()=>r("claude2"),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-foreground hover:bg-brand/10 transition-colors whitespace-nowrap",children:[(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-orange-500 flex-shrink-0"}),"Claude 2"]}),(0,e.jsxs)("button",{onClick:()=>r("codex"),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-foreground hover:bg-brand/10 transition-colors whitespace-nowrap",children:[(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-500 flex-shrink-0"}),"OpenAI Codex"]}),(0,e.jsxs)("button",{onClick:()=>r("deepseek"),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-foreground hover:bg-brand/10 transition-colors whitespace-nowrap",children:[(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-sky-500 flex-shrink-0"}),"DeepSeek"]}),(0,e.jsxs)("button",{onClick:()=>r("kimi"),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-foreground hover:bg-brand/10 transition-colors whitespace-nowrap",children:[(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-blue-500 flex-shrink-0"}),"Kimi"]}),(0,e.jsxs)("button",{onClick:()=>r("ollama"),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-foreground hover:bg-brand/10 transition-colors whitespace-nowrap",children:[(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-violet-500 flex-shrink-0"}),"Ollama"]})]})})]})}function l({tabs:a,activeTabId:b,unreadTabs:c,dragTabIndex:d,dragOverTabIndex:f,isPinned:h,onTogglePin:m,onSwitchTab:n,onCloseTab:o,onNewTab:p,onNewClaude2Tab:q,onNewCodexTab:r,onNewKimiTab:s,onNewOllamaTab:t,onNewDeepseekTab:u,onDragStart:v,onDragOver:w,onDrop:x,onDragEnd:y}){let{t:z}=(0,i.Bd)();return(0,e.jsx)("div",{className:"border-b border-border bg-card shrink-0",children:(0,e.jsxs)("div",{className:"flex items-center px-2 gap-1 overflow-x-auto",children:[a.map((i,k)=>(0,e.jsx)(g.m,{content:i.title,delay:200,className:"flex-1 min-w-16 max-w-32",children:(0,e.jsxs)("div",{draggable:!0,onDragStart:()=>v(k),onDragOver:a=>w(a,k),onDrop:()=>x(k),onDragEnd:y,className:`group flex items-center gap-1 px-3 py-1.5 text-sm cursor-pointer rounded-t-lg transition-colors ${i.id===b?"bg-accent text-foreground":"text-muted-foreground hover:bg-secondary"} ${d===k?"opacity-50":""} ${f===k?"border-l-2 border-brand":""}`,onClick:()=>n(i.id),children:[(0,e.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,e.jsx)(j,{number:k+1,isActive:i.id===b}),i.isLoading&&(0,e.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-orange-9 animate-pulse"}),!i.isLoading&&c.has(i.id)&&i.id!==b&&(0,e.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-red-500"}),m&&h?.(i.id)&&!i.isLoading&&!(c.has(i.id)&&i.id!==b)&&(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),m(i.id)},className:"absolute -top-1 -right-1 w-3.5 h-3.5 flex items-center justify-center rounded-full bg-card text-amber-500 hover:text-destructive transition-colors",title:z("tabBar.unpin"),children:(0,e.jsx)("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"currentColor",children:(0,e.jsx)("path",{d:"M16 4h-2V2h-4v2H8c-.55 0-1 .45-1 1v4l-2 3v2h5.97v7l1 1 1-1v-7H19v-2l-2-3V5c0-.55-.45-1-1-1z"})})}),m&&!h?.(i.id)&&!i.isLoading&&!(c.has(i.id)&&i.id!==b)&&(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),m(i.id)},className:"absolute -top-1 -right-1 w-3.5 h-3.5 flex items-center justify-center rounded-full bg-card text-muted-foreground opacity-0 group-hover:opacity-60 hover:!opacity-100 hover:!text-brand transition-all",title:z("tabBar.pin"),children:(0,e.jsx)("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,children:(0,e.jsx)("path",{d:"M16 4h-2V2h-4v2H8c-.55 0-1 .45-1 1v4l-2 3v2h5.97v7l1 1 1-1v-7H19v-2l-2-3V5c0-.55-.45-1-1-1z"})})})]}),(0,e.jsx)("span",{className:"flex-1 min-w-0 truncate",children:i.title}),"claude2"===i.engine&&(0,e.jsx)("span",{className:"flex-shrink-0 text-[9px] px-1 py-0 rounded bg-orange-500/15 text-orange-400 font-medium leading-relaxed",children:"C2"}),"codex"===i.engine&&(0,e.jsx)("span",{className:"flex-shrink-0 text-[9px] px-1 py-0 rounded bg-emerald-500/15 text-emerald-400 font-medium leading-relaxed",children:"CX"}),"kimi"===i.engine&&(0,e.jsx)("span",{className:"flex-shrink-0 text-[9px] px-1 py-0 rounded bg-blue-500/15 text-blue-400 font-medium leading-relaxed",children:"KM"}),"ollama"===i.engine&&(0,e.jsx)("span",{className:"flex-shrink-0 text-[9px] px-1 py-0 rounded bg-violet-500/15 text-violet-400 font-medium leading-relaxed",children:"OL"}),"deepseek"===i.engine&&(0,e.jsx)("span",{className:"flex-shrink-0 text-[9px] px-1 py-0 rounded bg-sky-500/15 text-sky-400 font-medium leading-relaxed",children:"DS"}),a.length>1&&(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),o(i.id)},className:"ml-1 p-0.5 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:z("tabBar.closeTab"),children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})},i.id)),(0,e.jsx)(k,{onNewTab:p,onNewClaude2Tab:q,onNewCodexTab:r,onNewKimiTab:s,onNewOllamaTab:t,onNewDeepseekTab:u})]})})}d()}catch(a){d(a)}})},4263:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{$:()=>g});var e=c(12629),f=a([e]);e=(f.then?(await f)():f)[0];let h="/tree-sitter",i=null,j=new Map;async function g(a){let b,c=await (!(b=j.get(a))&&(b=(async()=>(await (!i&&(i=e.Parser.init({locateFile:a=>`${h}/${a}`})),i),e.Language.load(`${h}/tree-sitter-${a}.wasm`)))(),j.set(a,b)),b),d=new e.Parser;return d.setLanguage(c),d}d()}catch(a){d(a)}})},4354:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{D:()=>q});var e=c(48249),f=c(67484),g=c(44384),h=c(95801),i=c(69004),j=c(75155),k=c(64672),l=c(87238),m=c(9780),n=c(33281),o=c(23328),p=a([l,m]);function q({cwd:a,currentCwd:b,commandHistoryRef:c,gridLayout:d,onGridLayoutChange:p,onExecute:r,onAddPluginItem:s,onShowEnvManager:t,onOpenZsh:u,onOpenNote:v}){let{t:w}=(0,g.Bd)(),[x,y]=(0,f.useState)(""),[z,A]=(0,f.useState)(-1),[B,C]=(0,f.useState)(""),[D,E]=(0,f.useState)([]),[F,G]=(0,f.useState)(0),[H,I]=(0,f.useState)(!1),[J,K]=(0,f.useState)(!1),[L,M]=(0,f.useState)([]),[N,O]=(0,f.useState)(!1),[P,Q]=(0,f.useState)(0),R=(0,f.useRef)(null),S=(0,f.useRef)(null),T=(0,f.useRef)(!1),{projectCommands:U,globalCommands:V,expandCustomCommand:W,loadQuickCommands:X}=(0,l.j)(a),Y=(0,f.useCallback)(a=>{O(!1);let b=a.command,c=(0,m.sk)(b);c?s?.(c.type,b.trim()):r(b),y("")},[r,s]),Z=(0,f.useCallback)(a=>{if(a.preventDefault(),T.current||!x.trim())return;let b=W(x)??x,c=(0,m.sk)(b);c?s?.(c.type,b.trim()):r(b),y(""),A(-1),C("")},[x,r,s,W]),$=(0,f.useCallback)(async()=>{if(!R.current)return;let a=R.current.selectionStart||0,c=await n.t4.runPromiseExit((0,o.tp)({cwd:b,input:x,cursorPosition:a}));if("Success"===c._tag){let b=c.value,d=b.suggestions;if(d&&d.length>0&&(E(d),G(0),I(!0),1===d.length)){let c=x.substring(0,b.replaceStart??0),e=x.substring(b.replaceEnd??a),f=c+d[0]+e;y(f),I(!1),setTimeout(()=>{if(R.current){let a=(b.replaceStart??0)+d[0].length;R.current.setSelectionRange(a,a)}},0)}}else console.error("Autocomplete error:",c.cause)},[b,x]),_=(0,f.useCallback)(a=>{if(!R.current)return;let b=R.current.selectionStart||0,c=x.substring(0,b),d=x.substring(b),e=c.split(/\s+/),f=e[e.length-1]||"",g=b-f.length,h=x.substring(0,g)+a+d;y(h),I(!1),setTimeout(()=>{if(R.current){let b=g+a.length;R.current.setSelectionRange(b,b)}},0)},[x]),aa=(0,f.useCallback)(a=>{if(a.nativeEvent.isComposing)return;if(N&&L.length>0){if("ArrowUp"===a.key){a.preventDefault(),Q(a=>(a-1+L.length)%L.length);return}if("ArrowDown"===a.key){a.preventDefault(),Q(a=>(a+1)%L.length);return}if("Tab"===a.key||"Enter"===a.key){a.preventDefault(),Y(L[P]);return}if("Escape"===a.key){a.preventDefault(),O(!1);return}}if("Tab"===a.key){if(a.preventDefault(),H&&D.length>0){let a=(F+1)%D.length;G(a),_(D[a])}else $();return}if("Escape"===a.key&&H){a.preventDefault(),I(!1);return}let b=c.current;if(b&&0!==b.length){if("ArrowUp"===a.key){a.preventDefault(),-1===z&&C(x);let c=-1===z?b.length-1:Math.max(0,z-1);A(c),y(b[c])}else if("ArrowDown"===a.key){if(a.preventDefault(),-1===z)return;let c=z+1;c>=b.length?(A(-1),y(B)):(A(c),y(b[c]))}}},[z,x,B,H,D,F,$,_,N,L,P,Y,c]);return(0,e.jsx)("div",{className:"border-t border-border p-4",children:(0,e.jsxs)("form",{onSubmit:Z,className:"relative flex gap-2 items-center",children:[(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("button",{type:"button",onClick:()=>{J||X(),K(!J)},className:`p-2 rounded-lg transition-all ${J?"text-brand bg-brand/10":"text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95"}`,title:w("console.quickCommands"),children:(0,e.jsx)(h.A,{className:"w-4 h-4"})}),(0,e.jsx)(l.$,{cwd:a,show:J,onClose:()=>K(!1),onExecute:r,onAddPluginItem:s})]}),v&&(0,e.jsx)("button",{type:"button",onClick:v,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95 rounded-lg transition-all",title:w("chat.projectNotes"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,e.jsx)("button",{type:"button",onClick:()=>p(!d),className:`p-2 rounded-lg transition-all ${d?"text-brand bg-brand/10":"text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95"}`,title:d?w("console.singleColumn"):w("console.dualColumn"),children:d?(0,e.jsx)(i.A,{className:"w-4 h-4"}):(0,e.jsx)(j.A,{className:"w-4 h-4"})}),(0,e.jsx)("button",{type:"button",onClick:t,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95 rounded-lg transition-all",title:w("console.envVars"),children:(0,e.jsx)(k.A,{className:"w-4 h-4"})}),(0,e.jsx)("button",{type:"button",onClick:u,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95 rounded-lg transition-all",title:w("console.launchZsh"),children:(0,e.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("polyline",{points:"4 17 10 11 4 5"}),(0,e.jsx)("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}),(0,e.jsx)("input",{ref:R,type:"text",value:x,onChange:a=>{y(a.target.value),-1!==z&&(A(-1),C("")),I(!1)},onKeyDown:aa,onCompositionStart:()=>{T.current=!0},onCompositionEnd:()=>{T.current=!1},placeholder:w("console.inputPlaceholder"),className:"flex-1 px-3 py-2 rounded-lg border border-input bg-background text-sm focus:outline-none focus:ring-2 focus:ring-ring font-mono"}),N&&L.length>0&&(0,e.jsx)("div",{ref:S,className:"absolute bottom-full left-0 right-0 mb-1 max-h-64 overflow-y-auto bg-popover border border-border rounded-lg shadow-lg z-50",children:L.map((a,b)=>(0,e.jsxs)("div",{onClick:()=>Y(a),className:`flex items-center gap-3 px-3 py-1.5 cursor-pointer text-sm ${b===P?"bg-brand/10":"hover:bg-accent"}`,children:[(0,e.jsxs)("span",{className:"font-mono font-medium text-foreground",children:["/",a.name]}),(0,e.jsx)("span",{className:"flex-1 text-muted-foreground truncate",children:a.command}),(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground/60 flex-shrink-0",children:"project"===a.scope?w("console.scopeProject"):w("console.scopeGlobal")})]},`${a.scope}-${a.name}`))}),H&&D.length>1&&(0,e.jsxs)("div",{className:"absolute bottom-full left-0 mb-1 bg-popover border border-border rounded-lg shadow-lg max-h-48 overflow-y-auto z-50",children:[(0,e.jsx)("div",{className:"py-1",children:D.map((a,b)=>(0,e.jsx)("button",{type:"button",onClick:()=>_(a),className:`w-full px-3 py-1.5 text-left text-sm font-mono hover:bg-accent transition-colors ${b===F?"bg-accent":""}`,children:a},b))}),(0,e.jsx)("div",{className:"border-t border-border px-3 py-1 text-xs text-muted-foreground",children:w("console.tabSwitchEscClose")})]})]})})}[l,m]=p.then?(await p)():p,d()}catch(a){d(a)}})},4462:(a,b,c)=>{"use strict";c.d(b,{EmptyState:()=>i});var d=c(48249),e=c(67484),f=c(44384),g=c(33281),h=c(65484);function i({onSelectSession:a}){let{t:b}=(0,f.Bd)(),[c,j]=(0,e.useState)([]),[k,l]=(0,e.useState)({}),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(null),[q,r]=(0,e.useState)(""),s=(0,e.useRef)(null);(0,e.useCallback)(async()=>{n(!0),p(null),l({});let a=await g.t4.runPromiseExit((0,h.H7)());"Success"===a._tag?j(a.value):p("Failed to load projects"),n(!1)},[]);let t=(0,e.useCallback)(async a=>{l(b=>({...b,[a]:{...b[a],isExpanded:!0,isLoading:!0,sessions:[],error:null}}));let b=await g.t4.runPromiseExit((0,h.QW)(a));"Success"===b._tag?l(c=>({...c,[a]:{...c[a],isLoading:!1,sessions:b.value}})):l(b=>({...b,[a]:{...b[a],isLoading:!1,error:"Failed to load sessions"}}))},[]),u=(0,e.useCallback)(a=>{let b=k[a];b?.isExpanded?l(b=>({...b,[a]:{...b[a],isExpanded:!1}})):b?.sessions?.length?l(b=>({...b,[a]:{...b[a],isExpanded:!0}})):t(a)},[k,t]);return(0,d.jsxs)("div",{className:"flex-1 flex flex-col bg-card",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[(0,d.jsx)("h2",{className:"text-lg font-medium text-foreground",children:b("workspace.selectProject")}),(0,d.jsx)("input",{ref:s,type:"text",placeholder:b("workspace.searchProjectPath"),value:q,onChange:a=>r(a.target.value),className:"px-3 py-1.5 text-sm border border-border rounded-lg bg-card text-foreground placeholder-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"})]}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto p-6",children:[m&&(0,d.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,d.jsxs)("svg",{className:"animate-spin h-5 w-5",fill:"none",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,d.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,d.jsx)("span",{children:b("workspace.loadingProjects")})]})}),o&&(0,d.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,d.jsx)("div",{className:"text-sm text-red-500",children:o})}),!m&&!o&&0===c.length&&(0,d.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,d.jsx)("div",{className:"text-sm text-muted-foreground",children:b("workspace.projectNotFound")})}),!m&&!o&&(0,d.jsx)("div",{className:"space-y-2",children:c.filter(a=>a.fullPath.toLowerCase().includes(q.toLowerCase())).map(c=>{let e=k[c.encodedPath]||{isExpanded:!1,isLoading:!1,sessions:[],error:null};return(0,d.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,d.jsxs)("button",{onClick:()=>u(c.encodedPath),className:"w-full flex items-center gap-3 p-3 hover:bg-accent transition-colors text-left",children:[(0,d.jsx)("svg",{className:`w-4 h-4 text-muted-foreground transition-transform ${e.isExpanded?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,d.jsx)("svg",{className:"w-5 h-5 text-brand",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-sm font-medium text-foreground truncate",children:c.name}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:c.fullPath})]}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground bg-secondary px-2 py-0.5 rounded",children:b("workspace.sessions",{count:c.sessionCount})})]}),e.isExpanded&&(0,d.jsxs)("div",{className:"border-t border-border bg-secondary/30",children:[e.isLoading&&(0,d.jsxs)("div",{className:"flex items-center gap-2 p-3 text-xs text-muted-foreground",children:[(0,d.jsxs)("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,d.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,d.jsx)("span",{children:b("workspace.loadingSessions")})]}),e.error&&(0,d.jsx)("div",{className:"p-3 text-xs text-red-500",children:e.error}),!e.isLoading&&!e.error&&0===e.sessions.length&&(0,d.jsx)("div",{className:"p-3 text-xs text-muted-foreground",children:b("workspace.noSessions")}),!e.isLoading&&!e.error&&e.sessions.map(b=>(0,d.jsxs)("button",{onClick:()=>{a(c.fullPath,(b.path.split("/").pop()||"").replace(".jsonl",""))},className:"w-full flex items-start gap-3 p-3 hover:bg-accent transition-colors text-left border-t border-border first:border-t-0",children:[(0,d.jsx)("svg",{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-sm text-foreground truncate",children:b.title}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:new Date(b.modifiedAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}),b.firstMessages.length>0&&(0,d.jsx)("div",{className:"text-xs text-muted-foreground mt-1 truncate",children:b.firstMessages[0]})]})]},b.path))]})]},c.encodedPath)})})]})]})}},4857:(a,b,c)=>{"use strict";c.d(b,{Q:()=>e});var d=c(67484);function e(){let a=(0,d.useRef)([]),b=(0,d.useRef)([]),c=(0,d.useCallback)(c=>{a.current.push(c),a.current.length>50&&(a.current=a.current.slice(-50)),b.current=[]},[]),e=(0,d.useCallback)(c=>{if(0===a.current.length)return null;let d=a.current.pop();return b.current.push(c),b.current.length>50&&(b.current=b.current.slice(-50)),d},[]),f=(0,d.useCallback)(c=>{if(0===b.current.length)return null;let d=b.current.pop();return a.current.push(c),a.current.length>50&&(a.current=a.current.slice(-50)),d},[]);return{push:c,goBack:e,goForward:f,canGoBack:(0,d.useCallback)(()=>a.current.length>0,[]),canGoForward:(0,d.useCallback)(()=>b.current.length>0,[])}}},6612:(a,b,c)=>{"use strict";c.d(b,{TabManager:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call TabManager() from the server but TabManager is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/TabManager.tsx","TabManager")},6662:(a,b,c)=>{"use strict";c.d(b,{W:()=>i});var d=c(67484),e=c(9804),f=c(79606),g=c(33281),h=c(87808);function i({cwd:a}){let[b,c]=(0,d.useState)([]),[j,k]=(0,d.useState)(null),[l,m]=(0,d.useState)(new Set),[n,o]=(0,d.useState)([]),[p,q]=(0,d.useState)(null),[r,s]=(0,d.useState)(null),[t,u]=(0,d.useState)(new Set),[v,w]=(0,d.useState)(null),[x,y]=(0,d.useState)(""),[z,A]=(0,d.useState)(!1),[B,C]=(0,d.useState)(null),[D,E]=(0,d.useState)(!1),[F,G]=(0,d.useState)(!1),[H,I]=(0,d.useState)(null),J=(0,d.useRef)(null),[K,L]=(0,d.useState)(!1),[M,N]=(0,d.useState)(null),[O,P]=(0,d.useState)("center"),[Q,R]=(0,d.useState)(null),[S,T]=(0,d.useState)(null),[U,V]=(0,d.useState)(!1),[W,X]=(0,d.useState)([]),[Y,Z]=(0,d.useState)(!1),[$,_]=(0,d.useState)(null),[aa,ab]=(0,d.useState)(null),[ac,ad]=(0,d.useState)(!1),[ae,af]=(0,d.useState)(!1),ag=(0,d.useMemo)(()=>n.map(a=>a.path).filter(Boolean),[n]),ah=(0,d.useMemo)(()=>(0,e.v3)(ag),[ag]),ai=(0,d.useMemo)(()=>new Set((0,e.tW)(ah)),[ah]),aj=(0,d.useMemo)(()=>x?j?(0,e.KH)(j,x,z):(0,e.q3)(b,x,z):null,[b,j,x,z]),ak=v??t,al=(0,d.useRef)(null),am=(0,d.useCallback)(b=>{al.current&&clearTimeout(al.current),al.current=setTimeout(()=>{g.t4.runFork((0,h.Ft)(a,Array.from(b)).pipe(f.tapError(a=>f.sync(()=>console.error("Error saving expanded paths:",a))),f.orElse(()=>f.void)))},500)},[a]),an=(0,d.useCallback)(async()=>{E(!0),I(null),await g.t4.runPromise((0,h.mP)(a).pipe(f.match({onSuccess:a=>{a.error?I(a.error):(c(a.files??[]),a.expandedPaths&&Array.isArray(a.expandedPaths)&&u(new Set(a.expandedPaths)))},onFailure:a=>{console.error("Error loading files:",a),I("Failed to load files")}}))),E(!1)},[a]),ao=(0,d.useCallback)(()=>{g.t4.runPromise((0,h.DZ)(a).pipe(f.match({onSuccess:a=>{a.paths&&k(a.paths)},onFailure:a=>{console.error("Error loading file index:",a)}})))},[a]),ap=(0,d.useCallback)(async b=>{m(a=>new Set([...a,b])),await g.t4.runPromise((0,h.gZ)(a,b).pipe(f.match({onSuccess:a=>{a.children&&c(c=>{if(!b){let b=new Map(c.map(a=>[a.path,a]));return a.children.map(a=>{let c=b.get(a.path);return c?.children&&a.isDirectory?{...a,children:c.children}:a})}let d=structuredClone(c),f=(0,e.MB)(d,b);return f&&(f.children=a.children),d})},onFailure:a=>{console.error("Error loading directory:",a)}}))),m(a=>{let c=new Set(a);return c.delete(b),c})},[a]);(0,d.useRef)(l).current=l;let aq=(0,d.useCallback)(async()=>{await g.t4.runPromise((0,h.r9)(a).pipe(f.match({onSuccess:a=>o(a.files??[]),onFailure:a=>console.error("Error loading recent files:",a)})))},[a]),ar=(0,d.useCallback)(async b=>{o(a=>{let c=a.filter(a=>a.path!==b);return[{path:b},...c].slice(0,15)}),await g.t4.runPromise((0,h.YW)(a,b).pipe(f.tapError(a=>f.sync(()=>console.error("Error adding to recent files:",a))),f.orElse(()=>f.void)))},[a]),as=(0,d.useCallback)((b,c,d,e)=>{o(a=>a.map(a=>a.path===b?{...a,scrollLine:c,cursorLine:d,cursorCol:e}:a)),g.t4.runFork((0,h.YW)(a,b,{scrollLine:c,cursorLine:d,cursorCol:e}).pipe(f.orElse(()=>f.void)))},[a]),at=(0,d.useCallback)(a=>n.find(b=>b.path===a),[n]),au=(0,d.useCallback)(async b=>{let c=b||p;c&&(Z(!0),_(null),await g.t4.runPromise((0,h.eE)(a,c).pipe(f.match({onSuccess:a=>{a.error?_(a.error):X(a.blame??[])},onFailure:a=>{console.error("Error loading blame:",a),_("Failed to load blame info")}}))),Z(!1))},[a,p]),av=(0,d.useCallback)(async b=>{G(!0),s(null),V(!1),X([]),_(null),ab(null);let c=f.gen(function*(){let c=yield*(0,h.r6)(a,b);if(!c.ok)return{type:"error",message:c.data?.error||"Failed to stat file"};let d=c.data??{};if(!d.exists)return{type:"error",message:"File not found"};if("dir"===d.kind)return{type:"error",message:"Path is a directory"};switch(d.category){case"image":return{type:"image",size:d.size,mtime:d.mtimeMs,...d.isSymlink?{isSymlink:!0,symlinkTarget:d.symlinkTarget}:{}};case"binary":return{type:"binary",message:"Cannot preview binary file",size:d.size,mtime:d.mtimeMs};case"too-large":return{type:"error",message:"File too large to preview",size:d.size,mtime:d.mtimeMs};default:{let c=yield*(0,h.K9)(a,b);if(409===c.status)return{type:"binary",message:c.data?.error||"Cannot preview binary file",size:d.size,mtime:d.mtimeMs};if(!c.ok)return{type:"error",message:c.data?.error||"Failed to load file"};let e=c.data??{};return{type:"text",content:e.content,size:e.size,mtime:e.mtimeMs,...e.isSymlink?{isSymlink:!0,symlinkTarget:e.symlinkTarget}:{}}}}});await g.t4.runPromise(c.pipe(f.match({onSuccess:a=>s(a),onFailure:a=>{console.error("Error loading file content:",a),s({type:"error",message:"Failed to load file"})}}))),ar(b),au(b),G(!1)},[a,ar,au]),aw=(0,d.useCallback)(()=>{U?V(!1):(V(!0),0===W.length&&au())},[U,W.length,au]),ax=(0,d.useCallback)((a,b)=>{if(!a)return;if(q(a),N(b??null),null==b){let b=n.find(b=>b.path===a);b?.scrollLine?(N(b.scrollLine),P("start"),R(b.cursorLine??null),T(b.cursorCol??null)):(P("center"),R(null),T(null))}else P("center"),R(null),T(null);av(a);let c=a.split("/");if(c.length>1){let a=[];for(let b=1;b<c.length;b++)a.push(c.slice(0,b).join("/"));u(b=>{let c=new Set(b),d=!1;for(let b of a)c.has(b)||(c.add(b),d=!0);return d&&am(c),d?c:b})}},[av,am,n]),ay=(0,d.useCallback)(a=>{if(v)w(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c});else{let c=!t.has(a);if(u(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),am(c),c}),c){let c=(0,e.MB)(b,a);c&&c.isDirectory&&!c.children&&ap(a)}}},[v,am,t,b,ap]);return{files:b,setFiles:c,fileIndex:j,setFileIndex:k,loadingDirs:l,expandedPaths:t,setExpandedPaths:u,searchTreeExpandedPaths:v,setSearchTreeExpandedPaths:w,effectiveExpandedPaths:ak,searchQuery:x,setSearchQuery:y,searchExactMatch:z,setSearchDirExact:A,matchedPaths:aj,creatingItem:B,setCreatingItem:C,isLoadingFiles:D,fileError:H,searchInputRef:J,shouldScrollToSelected:K,setShouldScrollToSelected:L,targetLineNumber:M,setTargetLineNumber:N,targetScrollAlign:O,setTargetScrollAlign:P,initialCursorLine:Q,initialCursorCol:S,setInitialCursorLine:R,setInitialCursorCol:T,selectedPath:p,setSelectedPath:q,fileContent:r,setFileContent:s,isLoadingContent:F,recentFiles:n,recentFilePaths:ag,setRecentFiles:o,recentFilesTree:ah,recentTreeDirPaths:ai,showBlame:U,setShowBlame:V,blameLines:W,isLoadingBlame:Y,blameError:$,blameSelectedCommit:aa,setBlameSelectedCommit:ab,showMarkdownPreview:ac,setShowMarkdownPreview:ad,showEditor:ae,setShowEditor:af,saveExpandedPaths:am,loadFiles:an,loadFileIndex:ao,loadDirectory:ap,loadRecentFiles:aq,addToRecentFiles:ar,updateRecentFilePosition:as,getRecentFilePosition:at,loadFileContent:av,loadBlame:au,handleToggleBlame:aw,handleSelectFile:ax,handleToggle:ay}}},6900:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{x:()=>m});var e=c(48249),f=c(67484),g=c(44384),h=c(7833),i=c(33281),j=c(85655),k=c(57031),l=c(88214);function m({isOpen:a,onClose:b,cwd:c}){let d,{t:n}=(0,g.Bd)(),[o,p]=(0,f.useState)([]),[q,r]=(0,f.useState)(null),[s,t]=(0,f.useState)(null),[u,v]=(0,f.useState)(!1),[w,x]=(0,f.useState)(!1),[y,z]=(0,f.useState)(null),[A,B]=(0,f.useState)(!1),[C,D]=(0,f.useState)(""),[E,F]=(0,f.useState)(!1),[G,H]=(0,f.useState)([]),[I,J]=(0,f.useState)(""),[K,L]=(0,f.useState)(!1),M=(0,f.useCallback)((a,b)=>a?._tag==="Fail"&&a.error?.cause instanceof Error?a.error.cause.message:n(b),[n]),N=(0,f.useCallback)(async()=>{v(!0);let a=await i.t4.runPromiseExit((0,j.FK)(c));if("Success"===a._tag){let b=a.value;p(b.worktrees),r(b.nextPath),t(b.nextRandomWord),b.gitUserName&&D(b.gitUserName)}else console.error("Failed to load worktrees:",a.cause),(0,h.oR)(n("toast.worktreeLoadFailed"),"error");v(!1)},[c,n]),O=(0,f.useCallback)(a=>{let{local:b,remote:c}=a;return c.includes("origin/main")?"origin/main":c.includes("origin/master")?"origin/master":b.includes("main")?"main":b.includes("master")?"master":c.length>0?c[0]:b.length>0?b[0]:"main"},[]),P=async()=>{if(!q)return;let a="origin/main",b=await i.t4.runPromiseExit((0,j.r4)(c));"Success"===b._tag&&(a=O(b.value));let d=s||function(){let a="bcdfghjklmnprstvwz",b=["a","e","i","o","u","ai","au","ea","ee","ia","io","oa","oo","ou","ui"],c="";for(let d=0;d<2;d++)c+=a[Math.floor(Math.random()*a.length)],c+=b[Math.floor(Math.random()*b.length)];return c}(),e=C?`${C}/${d}`:d;x(!0);let f=await i.t4.runPromiseExit((0,j.CM)({action:"add",cwd:c,path:q,newBranch:e,baseBranch:a}));"Success"===f._tag?((0,h.oR)(n("toast.worktreeCreateSuccess",{name:e}),"success"),N()):(console.error("Failed to create worktree:",f.cause),(0,h.oR)(M(f.cause,"toast.worktreeCreateFailed"),"error")),x(!1)},Q=async()=>{L(!0),J(""),F(!0);let a=await i.t4.runPromiseExit((0,j.r4)(c));if("Success"===a._tag){let b=a.value,c=b.local??[],d=b.remote??[],e=new Set(o.map(a=>a.branch).filter(Boolean)),f=[...c.filter(a=>!e.has(a)),...d.filter(a=>!e.has(a)&&!c.includes(a.replace(/^origin\//,"")))];H(f)}else(0,h.oR)(n("toast.loadBranchFailed"),"error");L(!1)},R=async a=>{if(!q)return;F(!1),x(!0);let b=await i.t4.runPromiseExit((0,j.CM)({action:"add",cwd:c,path:q,branch:a}));"Success"===b._tag?((0,h.oR)(n("toast.worktreeCreateSuccess",{name:a}),"success"),N()):(console.error("Failed to create worktree:",b.cause),(0,h.oR)(M(b.cause,"toast.worktreeCreateFailed"),"error")),x(!1)},S=async()=>{if(!y)return;B(!0);let a=await i.t4.runPromiseExit((0,j.CM)({action:"remove",cwd:c,path:y.path}));"Success"===a._tag?((0,h.oR)(n("toast.worktreeDeleted"),"success"),z(null),N()):(console.error("Failed to delete worktree:",a.cause),(0,h.oR)(M(a.cause,"toast.worktreeDeleteFailed"),"error")),B(!1)},T=async a=>{let b=a.isLocked?"unlock":"lock",d=await i.t4.runPromiseExit((0,j.CM)({action:b,cwd:c,path:a.path}));"Success"===d._tag?((0,h.oR)(a.isLocked?n("toast.worktreeUnlocked"):n("toast.worktreeLocked"),"success"),N()):(console.error("Failed to toggle lock:",d.cause),(0,h.oR)(M(d.cause,"toast.operationFailed"),"error"))};return a?(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:b,children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-[480px] max-h-[80vh] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between flex-shrink-0",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Git Worktrees"}),(0,e.jsx)("button",{onClick:b,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:n("common.close"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("div",{className:"flex-1 p-4 overflow-y-auto",children:u?(0,e.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):(0,e.jsx)("div",{className:"space-y-2",children:o.map(a=>{let d=a.path===c;return(0,e.jsxs)("div",{className:`group p-3 rounded-lg border transition-colors ${d?"border-brand bg-brand/5":"border-border hover:bg-accent cursor-pointer"}`,onClick:()=>{a.path!==c&&((0,k.F)(l.n.OpenProject,{cwd:a.path}),b())},children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,e.jsx)("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${d?"bg-brand":"bg-muted-foreground/30"}`}),(0,e.jsx)("span",{className:"font-medium text-foreground truncate",children:a.branch||(a.isDetached?"detached":"unknown")}),a.isLocked&&(0,e.jsx)("span",{className:"text-amber-11",title:n("git.worktree.locked"),children:"\uD83D\uDD12"}),d&&(0,e.jsxs)("span",{className:"text-xs text-brand",children:["(",n("common.current"),")"]})]}),(0,e.jsx)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:!d&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),T(a)},className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-secondary rounded transition-colors",title:a.isLocked?n("git.worktree.unlock"):n("git.worktree.lock"),children:a.isLocked?(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"})}):(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),z(a)},className:"p-1.5 text-muted-foreground hover:text-red-11 hover:bg-secondary rounded transition-colors",title:n("common.delete"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})})]}),(0,e.jsx)("div",{className:"mt-1 text-xs text-muted-foreground truncate pl-4",children:a.path}),a.isDetached&&(0,e.jsx)("div",{className:"mt-1 text-xs text-amber-11 pl-4",children:"(detached HEAD)"})]},a.path)})})}),E&&(0,e.jsxs)("div",{className:"border-t border-border px-4 py-3 flex-shrink-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,e.jsx)("input",{value:I,onChange:a=>J(a.target.value),placeholder:n("git.worktree.searchBranch"),className:"flex-1 bg-secondary text-sm text-foreground rounded px-2.5 py-1.5 outline-none placeholder:text-muted-foreground",autoFocus:!0,autoComplete:"off",spellCheck:"false"}),(0,e.jsx)("button",{onClick:()=>F(!1),className:"text-xs text-muted-foreground hover:text-foreground px-2 py-1.5",children:n("common.cancel")})]}),(0,e.jsx)("div",{className:"max-h-[200px] overflow-y-auto space-y-0.5",children:K?(0,e.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:n("common.loading")}):(d=G.filter(a=>a.toLowerCase().includes(I.toLowerCase())),0===d.length?(0,e.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:n("git.worktree.noBranches")}):d.map(a=>(0,e.jsx)("button",{onClick:()=>R(a),className:"w-full text-left px-2.5 py-1.5 text-sm rounded hover:bg-accent transition-colors truncate",children:(0,e.jsx)("span",{className:`${a.startsWith("origin/")?"text-muted-foreground":"text-foreground"}`,children:a})},a)))})]}),(0,e.jsxs)("div",{className:"px-4 py-3 border-t border-border flex items-center justify-between flex-shrink-0",children:[(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:n("git.worktree.count",{count:o.length})}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:Q,disabled:!q||w,className:`px-3 py-1.5 text-sm rounded transition-colors ${q&&!w?"bg-secondary text-foreground hover:bg-accent":"bg-secondary text-muted-foreground cursor-not-allowed"}`,children:n("git.worktree.selectBranch")}),(0,e.jsx)("button",{onClick:P,disabled:!q||w,className:`px-3 py-1.5 text-sm rounded transition-colors ${q&&!w?"bg-brand text-white hover:bg-brand/90":"bg-secondary text-muted-foreground cursor-not-allowed"}`,children:w?(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):n("git.worktree.addWorktree")})]})]}),y&&(0,e.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-black/50 rounded-lg",onClick:()=>z(null),children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-[360px] p-4",onClick:a=>a.stopPropagation(),children:[(0,e.jsx)("div",{className:"text-sm font-medium text-foreground mb-3",children:n("git.worktree.confirmDelete")}),(0,e.jsxs)("div",{className:"text-sm text-muted-foreground mb-4",children:[(0,e.jsx)("p",{className:"mb-2",children:n("git.worktree.confirmDeleteMsg")}),(0,e.jsxs)("p",{className:"text-xs",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:n("git.worktree.path")}),(0,e.jsx)("span",{className:"text-foreground",children:y.path})]}),(0,e.jsxs)("p",{className:"text-xs",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:n("git.worktree.branch")}),(0,e.jsx)("span",{className:"text-foreground",children:y.branch||"detached"})]})]}),(0,e.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,e.jsx)("button",{onClick:()=>z(null),className:"px-3 py-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:n("common.cancel")}),(0,e.jsx)("button",{onClick:S,disabled:A,className:"px-3 py-1.5 text-sm bg-red-9 text-white rounded hover:bg-red-10 transition-colors disabled:opacity-50",children:A?(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):n("common.delete")})]})]})})]})}):null}d()}catch(a){d(a)}})},7031:(a,b,c)=>{"use strict";c.d(b,{H:()=>g,r:()=>h});var d=c(48249),e=c(67484);let f=(0,e.createContext)(null);function g({value:a,children:b}){return(0,d.jsx)(f.Provider,{value:a,children:b})}function h(){return(0,e.useContext)(f)}},7122:(a,b,c)=>{"use strict";c.d(b,{Ee:()=>m,SU:()=>j,ft:()=>l,iN:()=>k});var d=c(48249),e=c(67484),f=c(44384),g=c(74429),h=c(7833);let i=(0,e.createContext)(null);function j({container:a,children:b}){return(0,d.jsx)(i.Provider,{value:a,children:b})}function k(){return(0,e.useContext)(i)}function l({x:a,y:b,path:c,cwd:j,isDirectory:k,onClose:m,onCreateFile:n,onDelete:o,onRefresh:p,onCopyFile:q,onPaste:r}){let{t:s}=(0,f.Bd)(),t=(0,e.useRef)(null),u=(0,e.useContext)(i),v=c.split("/").pop()||c,w=`${j}/${c}`,x=c.includes("/")?c.substring(0,c.lastIndexOf("/")):"",y=x?`${j}/${x}`:j,z=k?c:x,A=k?w:y,[B,C]=(0,e.useState)({x:0,y:0}),D=(0,e.useCallback)(async(a,b)=>{try{await navigator.clipboard.writeText(a),(0,h.oR)(s("toast.copiedName",{name:b}),"success")}catch{(0,h.oR)(s("toast.copyFailed"),"error")}m()},[m,s]),E=k?c:x,F=[{label:s("fileContextMenu.copyRelativePath"),value:c},{label:s("fileContextMenu.copyAbsolutePath"),value:w},{label:s("fileContextMenu.copyRelativeDirPath"),value:z||"."},{label:s("fileContextMenu.copyAbsoluteDirPath"),value:A},{label:k?s("fileContextMenu.copyFolderName"):s("fileContextMenu.copyFileName"),value:v}],G=(0,d.jsxs)("div",{ref:t,className:"absolute z-[200] bg-card border border-border rounded-lg shadow-lg py-1 w-fit whitespace-nowrap",style:{left:B.x,top:B.y},children:[n&&(0,d.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-foreground hover:bg-accent transition-colors",onClick:()=>{m(),n(E)},children:s("fileContextMenu.createFile")}),q&&(0,d.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-foreground hover:bg-accent transition-colors",onClick:()=>{m(),q(c)},children:k?s("fileContextMenu.copyFolder"):s("fileContextMenu.copyFile")}),r&&(0,d.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-foreground hover:bg-accent transition-colors",onClick:()=>{m(),r(E)},children:s("fileContextMenu.pasteHere")}),o&&(0,d.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-destructive hover:bg-accent transition-colors",onClick:()=>{m(),o(c,k,v)},children:k?s("fileContextMenu.deleteFolder"):s("fileContextMenu.deleteFile")}),(n||o||q||r)&&(0,d.jsx)("div",{className:"my-1 border-t border-border"}),F.map((a,b)=>(0,d.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-foreground hover:bg-accent transition-colors",onClick:()=>D(a.value,a.label),children:a.label},b))]});return u?(0,g.createPortal)(G,u):G}function m(){let[a,b]=(0,e.useState)(null);return{contextMenu:a,showContextMenu:(0,e.useCallback)((a,c,d)=>{a.preventDefault(),a.stopPropagation(),b({x:a.clientX,y:a.clientY,path:c,isDirectory:d})},[]),hideContextMenu:(0,e.useCallback)(()=>{b(null)},[])}}},7833:(a,b,c)=>{"use strict";c.d(b,{dj:()=>h,lJ:()=>l,oR:()=>n,tE:()=>i});var d=c(48249),e=c(67484),f=c(208);let g=(0,e.createContext)(null);function h(){let a=(0,e.useContext)(g);if(!a)throw Error("useToast must be used within a ToastProvider");return a}function i({children:a}){let[b,c]=(0,e.useState)([]),f=(0,e.useCallback)((a,b="success")=>{let d=`toast-${Date.now()}`;c(c=>[...c,{id:d,message:a,type:b}])},[]),h=(0,e.useCallback)(a=>{c(b=>b.filter(b=>b.id!==a))},[]);return(0,d.jsxs)(g.Provider,{value:{showToast:f},children:[a,(0,d.jsx)(j,{toasts:b,onRemove:h})]})}function j({toasts:a,onRemove:b}){return(0,d.jsx)("div",{className:"fixed bottom-4 right-4 z-[100] flex flex-col gap-2",children:a.map(a=>(0,d.jsx)(k,{toast:a,onRemove:b},a.id))})}function k({toast:a,onRemove:b}){let c={success:"bg-green-9",error:"bg-red-9",info:"bg-brand"}[a.type],e={success:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),error:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),info:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}[a.type];return(0,d.jsxs)("div",{className:`${c} text-white px-4 py-3 rounded-lg shadow-lg flex items-center gap-3 min-w-[200px] animate-slide-in`,style:{animation:"slideIn 0.3s ease-out"},children:[e,(0,d.jsx)("span",{className:"text-sm",children:a.message}),(0,d.jsx)("button",{onClick:()=>b(a.id),className:"ml-auto p-1 hover:bg-white/20 rounded transition-colors",children:(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}function l(a,b){let{title:c=f.A.t("confirm.title",{defaultValue:"Confirm"}),confirmText:d=f.A.t("confirm.ok",{defaultValue:"OK"}),cancelText:e=f.A.t("confirm.cancel",{defaultValue:"Cancel"}),danger:g=!1}=b||{};return new Promise(b=>{let f=document.createElement("div");f.className="fixed inset-0 z-[200] flex items-center justify-center",f.style.animation="confirmFadeIn 0.15s ease-out";let h=a=>{f.style.animation="confirmFadeOut 0.12s ease-in",f.addEventListener("animationend",()=>{document.body.removeChild(f),b(a)},{once:!0})};f.addEventListener("mousedown",a=>{a.target===f&&h(!1)});let i=a=>{"Escape"===a.key?(a.stopPropagation(),document.removeEventListener("keydown",i,!0),h(!1)):"Enter"===a.key&&(a.stopPropagation(),document.removeEventListener("keydown",i,!0),h(!0))};document.addEventListener("keydown",i,!0),f.innerHTML=`
|
|
2
2
|
<div class="fixed inset-0 bg-black/50"></div>
|
|
3
3
|
<div class="relative bg-card border border-border rounded-xl shadow-2xl p-6 max-w-sm w-full mx-4" style="animation: confirmScaleIn 0.15s ease-out">
|
|
4
4
|
<div class="text-base font-medium text-foreground mb-2">${c}</div>
|
|
@@ -11,7 +11,7 @@ exports.id=9658,exports.ids=[9658],exports.modules={208:(a,b,c)=>{"use strict";c
|
|
|
11
11
|
`,f.querySelector('[data-action="cancel"]').addEventListener("click",()=>{document.removeEventListener("keydown",i,!0),h(!1)}),f.querySelector('[data-action="confirm"]').addEventListener("click",()=>{document.removeEventListener("keydown",i,!0),h(!0)}),document.body.appendChild(f),f.querySelector('[data-action="confirm"]')?.focus()})}let m=null;function n(a,b="success"){let c=(m||((m=document.createElement("div")).id="toast-container",m.className="fixed bottom-4 right-4 z-[100] flex flex-col-reverse items-end gap-2",document.body.appendChild(m)),m),d=document.createElement("div");d.className=`${"success"===b?"bg-green-9":"error"===b?"bg-red-9":"bg-brand"} text-white px-4 py-3 rounded-lg shadow-lg flex items-center gap-3 min-w-[200px]`,d.style.animation="slideIn 0.3s ease-out",d.innerHTML=`
|
|
12
12
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">${"success"===b?'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />':"error"===b?'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />':'<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />'}</svg>
|
|
13
13
|
<span class="text-sm">${a}</span>
|
|
14
|
-
`,c.appendChild(d),setTimeout(()=>{d.style.animation="slideOut 0.3s ease-in",setTimeout(()=>{c.removeChild(d)},300)},3e3)}},8077:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{ProjectSidebar:()=>o});var e=c(48249),f=c(67484),g=c(44384),h=c(25608),i=c(32459),j=c(18499),k=c(74991),l=c(98982),m=c(13054),n=c(29939);function o({projects:a,activeIndex:b,collapsed:c,currentCwd:d,onSelectProject:p,onRemoveProject:q,onReorderProjects:r,onToggleCollapse:s,onOpenSessionBrowser:t,onOpenSettings:u,onOpenNote:v,onOpenSkills:w,onSwitchProject:x,onAddProject:y}){let{t:z}=(0,g.Bd)(),{pinnedSessions:A,unpinSession:B,updateTitle:C,reorder:D}=(0,l.P)(),{tasks:E,unreadCount:F,reload:G,pauseTask:H,resumeTask:I,triggerTask:J,deleteTask:K,updateTask:L,markRead:M,reorderTasks:N}=(0,m.n)(),[O,P]=(0,f.useState)(!1),[Q,R]=(0,f.useState)(null),[S,T]=(0,f.useState)(null),[U,V]=(0,f.useState)([]);(0,f.useRef)(U);let W=(0,f.useRef)(G),X=(0,f.useCallback)(a=>{try{if("task-fired"===a.type)return void W.current();let{data:b}=a;if(!b)return;V(b.sessions||[])}catch{}},[]);(0,n.h)({url:"/ws/global-state",onMessage:X});let Y=new Set(U.filter(a=>"loading"===a.status).map(a=>a.cwd)),Z=new Set(U.filter(a=>"unread"===a.status).map(a=>a.cwd)),$=(0,f.useCallback)(a=>{R(a)},[]),_=(0,f.useCallback)((a,b)=>{a.preventDefault(),null!==Q&&Q!==b&&T(b)},[Q]),aa=(0,f.useCallback)(b=>{if(null!==Q&&Q!==b){let c=[...a],[d]=c.splice(Q,1);c.splice(b,0,d),r(c)}R(null),T(null)},[Q,a,r]),ab=(0,f.useCallback)(()=>{R(null),T(null)},[]);return(0,e.jsxs)("div",{className:`h-full bg-card border-r border-border flex flex-col transition-all duration-200 ${c?"w-12":"w-56"}`,children:[(0,e.jsxs)("div",{className:"p-2 border-b border-border relative",onMouseEnter:()=>P(!0),onMouseLeave:()=>P(!1),children:[(0,e.jsxs)("button",{className:`w-full flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${c?"justify-center":""}`,onClick:t,title:z("workspace.openProject"),children:[(0,e.jsxs)("svg",{className:"w-5 h-5 flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),(0,e.jsx)("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),(0,e.jsx)("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),(0,e.jsx)("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]}),!c&&(0,e.jsx)("span",{className:"text-sm",children:z("workspace.openProject")})]}),O&&(c?(0,e.jsx)("button",{className:"absolute inset-0 m-2 flex items-center justify-center px-2 py-2 rounded-lg bg-accent text-foreground transition-colors z-10",onClick:s,title:z("workspace.expandSidebar"),children:(0,e.jsx)("svg",{className:"w-5 h-5 flex-shrink-0 rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}):(0,e.jsx)("button",{className:"absolute top-1/2 -translate-y-1/2 right-2 p-2 rounded-lg bg-accent text-foreground transition-colors z-10",onClick:s,title:z("workspace.collapseSidebar"),children:(0,e.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}))]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:a.map((a,d)=>{var f;let g;return(0,e.jsx)("div",{draggable:!0,onDragStart:()=>$(d),onDragOver:a=>_(a,d),onDrop:()=>aa(d),onDragEnd:ab,className:`${S===d?"border-t-2 border-brand":""} ${Q===d?"opacity-50":""}`,children:(0,e.jsx)(h.ProjectItem,{index:d,name:(g=(f=a.cwd).split("/").filter(Boolean))[g.length-1]||f,cwd:a.cwd,isActive:d===b,collapsed:c,hasUnread:Z.has(a.cwd),isLoading:Y.has(a.cwd),onClick:()=>p(d),onRemove:()=>q(d),onOpenNote:()=>v(a.cwd)})},a.cwd)})}),(0,e.jsxs)("div",{className:"p-2 border-t border-border space-y-1",children:[(0,e.jsx)(i.e,{currentCwd:d,onSwitchProject:x,collapsed:c,sessions:U}),(0,e.jsx)(j._,{collapsed:c,pinnedSessions:A,onSwitchProject:x,onUnpin:B,onUpdateTitle:C,onReorder:D}),(0,e.jsx)(k.I,{collapsed:c,tasks:E,unreadCount:F,onSwitchProject:x,onPause:H,onResume:I,onTrigger:J,onDelete:K,onMarkRead:M,onUpdateTask:L,onReorder:N}),(0,e.jsxs)("button",{className:`w-full flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${c?"justify-center":""}`,onClick:()=>v(),title:z("workspace.notes"),children:[(0,e.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})}),!c&&(0,e.jsx)("span",{className:"text-sm",children:z("workspace.notes")})]}),(0,e.jsxs)("button",{className:`w-full flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${c?"justify-center":""}`,onClick:w,title:z("workspace.skills"),children:[(0,e.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3l1.9 4.8L19 9l-4.1 3.1L16 18l-4-2.8L8 18l1.1-5.9L5 9l5.1-1.2L12 3z"})}),!c&&(0,e.jsx)("span",{className:"text-sm",children:z("workspace.skills")})]}),(0,e.jsxs)("button",{className:`w-full flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${c?"justify-center":""}`,onClick:u,title:z("workspace.settings"),children:[(0,e.jsxs)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),!c&&(0,e.jsx)("span",{className:"text-sm",children:z("workspace.settings")})]})]})]})}d()}catch(a){d(a)}})},9780:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{lf:()=>k.lf,sd:()=>k.sd,sk:()=>k.sk});var e=c(18482),f=c(63913),g=c(90677),h=c(51520),i=c(47111),j=c(3406),k=c(3560),l=a([e,f,g,h,i,j]);[e,f,g,h,i,j]=l.then?(await l)():l,d()}catch(a){d(a)}})},9804:(a,b,c)=>{"use strict";function d(a,b){for(let c of a){if(c.path===b)return c;if(c.children){let a=d(c.children,b);if(a)return a}}return null}function e(a,b){if(!a)return"";let c=d(b,a);if(c?.isDirectory)return a;let e=a.split("/");return e.pop(),e.join("/")}function f(a){let b=[];for(let c of a){let a=c.split("/"),d=b;for(let b=0;b<a.length;b++){let c=a[b],e=b===a.length-1,f=a.slice(0,b+1).join("/"),g=d.find(a=>a.name===c);g||(g={name:c,path:f,isDirectory:!e,children:e?void 0:[]},d.push(g)),!e&&g.children&&(d=g.children)}}let c=a=>{a.sort((a,b)=>a.isDirectory&&!b.isDirectory?-1:!a.isDirectory&&b.isDirectory?1:a.name.localeCompare(b.name)),a.forEach(a=>{a.children&&c(a.children)})};return c(b),b}function g(a){let b=[],c=a=>{for(let d of a)d.isDirectory&&(b.push(d.path),d.children&&c(d.children))};return c(a),b}c.d(b,{B_:()=>o,HR:()=>function a(b,c){if(0===c.length)return b;let d=new Map(c.map(a=>[a.path,a]));return b.map(b=>{let c=d.get(b.path);return c&&b.isDirectory?void 0===b.children&&void 0!==c.children?{...b,children:c.children}:void 0!==b.children&&void 0!==c.children?{...b,children:a(b.children,c.children)}:b:b})},KH:()=>k,MB:()=>d,S7:()=>e,fw:()=>l,q3:()=>j,r6:()=>m,tE:()=>n,tW:()=>g,u:()=>i,v3:()=>f});let h=new Set(["png","jpg","jpeg","gif","svg","webp","ico","bmp"]);function i(a){let b=a.split(".").pop()?.toLowerCase();return h.has(b||"")}function j(a,b,c=!1){let d=new Set;if(!b)return d;let e=b.toLowerCase(),f=a=>{if(d.add(a.path),a.children)for(let b of a.children)f(b)},g=(a,b)=>{let h=a.name.toLowerCase(),i=c?h===e:h.includes(e);if(i&&a.children)return f(a),b.forEach(a=>d.add(a)),!0;let j=!1;if(a.children)for(let c of a.children)g(c,[...b,a.path])&&(j=!0);return(!!i||!!j)&&(d.add(a.path),b.forEach(a=>d.add(a)),!0)};for(let b of a)g(b,[]);return d}function k(a,b,c=!1){let d=new Set;if(!b)return d;let e=b.toLowerCase();for(let b of a){let a=b.split("/");for(let b=0;b<a.length;b++){let f=a[b].toLowerCase();if(c?f===e:f.includes(e)){for(let b=0;b<=a.length-1;b++)d.add(a.slice(0,b+1).join("/"));break}}}return d}function l(a){let b=Math.floor(Math.floor((Date.now()-1e3*a)/1e3)/60),c=Math.floor(b/60),d=Math.floor(c/24),e=Math.floor(d/30),f=Math.floor(d/365);return f>0?`${f}y ago`:e>0?`${e}mo ago`:d>0?`${d}d ago`:c>0?`${c}h ago`:b>0?`${b}m ago`:"just now"}function m(a){let b=new Date(a),c=new Date,d=b.getFullYear()===c.getFullYear(),e=String(b.getMonth()+1).padStart(2,"0"),f=String(b.getDate()).padStart(2,"0"),g=String(b.getHours()).padStart(2,"0"),h=String(b.getMinutes()).padStart(2,"0");return d?`${e}-${f} ${g}:${h}`:`${b.getFullYear()}-${e}-${f} ${g}:${h}`}let n=()=>{},o=50},12568:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{ReviewDropdown:()=>p});var e=c(48249),f=c(67484),g=c(44384),h=c(29939),i=c(61130),j=c(79606),k=c(33281),l=c(83120),m=a([i]);i=(m.then?(await m)():m)[0];let q="review-last-viewed";function n(){try{return JSON.parse(localStorage.getItem(q)||"{}")}catch{return{}}}function o(a,b){if(!a.lastCommentAt)return!1;let c=b[a.id];return!c||a.lastCommentAt>c}function p({cwd:a}){let{t:b}=(0,g.Bd)(),[c,d]=(0,f.useState)(!1),[m,r]=(0,f.useState)([]),[s,t]=(0,f.useState)(!1),[u,v]=(0,f.useState)(null),[w,x]=(0,f.useState)({}),[y,z]=(0,f.useState)({open:!1,comments:[],title:"",userNameMap:{}}),A=(0,f.useRef)(null),B=(0,f.useRef)(null),[C,D]=(0,f.useState)(null),E=(0,f.useCallback)(async()=>{t(!0);let a=await k.t4.runPromiseExit((0,l.Y_)());"Success"===a._tag&&r(a.value.reviews??[]),t(!1)},[]),F=(0,f.useCallback)(a=>{let{data:b}=a;b?.some(a=>"review"===a.type)&&E()},[E]);(0,h.h)({url:`/ws/watch?cwd=${encodeURIComponent(a||"/")}`,onMessage:F,enabled:!!a});let G=(0,f.useMemo)(()=>m.filter(a=>a.active),[m]),H=(0,f.useMemo)(()=>G.some(a=>o(a,w)),[G,w]),I=(0,f.useCallback)(a=>{let b;(b=n())[a]=Date.now(),localStorage.setItem(q,JSON.stringify(b)),x(n()),window.open(`${window.location.origin}/review/${a}`,"_blank")},[]),J=(0,f.useCallback)(async(a,b)=>{a.stopPropagation();let[c,d]=await Promise.all([k.t4.runPromiseExit((0,l.JK)(b)),k.t4.runPromiseExit((0,l.BL)())]);if("Success"!==c._tag)return;let e=c.value.review,f={};if("Success"===d._tag)for(let[a,b]of Object.entries(d.value.users))f[a]=b.name;z({open:!0,comments:e.comments||[],title:e.title??"",userNameMap:f})},[]),K=(0,f.useCallback)((a,b)=>{B.current=b,a.dataTransfer.effectAllowed="move";let c=a.currentTarget;requestAnimationFrame(()=>c.classList.add("opacity-30"))},[]),L=(0,f.useCallback)(a=>{B.current=null,D(null),a.currentTarget instanceof HTMLElement&&a.currentTarget.classList.remove("opacity-30")},[]),M=(0,f.useCallback)((a,b)=>{a.preventDefault(),a.dataTransfer.dropEffect="move",B.current&&B.current!==b&&D(b)},[]),N=(0,f.useCallback)((a,b)=>{a.preventDefault(),D(null);let c=B.current;B.current=null,c&&c!==b&&r(a=>{let d=[...a],e=d.findIndex(a=>a.id===c),f=d.findIndex(a=>a.id===b);if(-1===e||-1===f)return a;let[g]=d.splice(e,1);d.splice(f,0,g);let h=d.map(a=>a.id);return k.t4.runFork((0,l.z1)(h).pipe(j.orElse(()=>j.void))),d})},[]);return(0,e.jsxs)("div",{ref:A,className:"relative",children:[(0,e.jsxs)("button",{onClick:()=>d(a=>!a),className:`relative p-2 rounded-lg transition-colors ${c?"text-foreground bg-accent":"text-muted-foreground hover:text-foreground hover:bg-accent"}`,title:b("review.reviewManagement"),children:[(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),H&&(0,e.jsx)("span",{className:"absolute top-1 right-1 w-2 h-2 bg-red-500 rounded-full"})]}),c&&(0,e.jsxs)("div",{className:"absolute right-0 top-full mt-1 w-64 bg-popover border border-border rounded-lg shadow-xl z-50 overflow-hidden",children:[(0,e.jsxs)("div",{className:"px-3 py-2 border-b border-border flex items-center justify-between",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:b("review.allReviews")}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground/60 ml-1.5",children:G.length})]}),(0,e.jsx)("button",{onClick:E,className:"p-0.5 text-muted-foreground hover:text-foreground rounded transition-colors",title:b("common.refresh"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),(0,e.jsx)("div",{className:"max-h-80 overflow-y-auto",children:s&&0===m.length?(0,e.jsx)("div",{className:"px-3 py-4 text-xs text-muted-foreground/50 text-center",children:b("common.loading")}):0===G.length?(0,e.jsx)("div",{className:"px-3 py-4 text-xs text-muted-foreground/50 text-center",children:b("review.noOpenReviews")}):G.map(a=>{var c;let d,f,g,h,i,j=o(a,w);return(0,e.jsxs)("div",{draggable:!0,onDragStart:b=>K(b,a.id),onDragEnd:L,onDragOver:b=>M(b,a.id),onDrop:b=>N(b,a.id),onMouseEnter:b=>{let c=b.currentTarget.getBoundingClientRect();v({id:a.id,text:a.title,top:c.top+c.height/2,left:c.left})},onMouseLeave:()=>v(b=>b?.id===a.id?null:b),onClick:()=>I(a.id),className:`group px-3 py-2 cursor-pointer border-b transition-colors ${C===a.id?"border-b-brand border-t border-t-transparent":"border-b-border/50"} hover:bg-accent/30`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,e.jsx)("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${j?"bg-red-500":"bg-green-500"}`}),(0,e.jsx)("span",{className:`text-xs truncate flex-1 ${j?"font-medium text-foreground":""}`,children:a.title}),a.commentCount>0&&(0,e.jsx)("button",{onClick:b=>J(b,a.id),className:"flex-shrink-0 p-0.5 rounded text-muted-foreground/0 group-hover:text-muted-foreground/60 hover:!text-brand hover:!bg-brand/10 transition-colors",title:b("review.viewComments"),children:(0,e.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("path",{d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground/50 mt-0.5 pl-3",children:[(0,e.jsx)("span",{children:(c=a.updatedAt||a.createdAt,d=new Date(c),f=String(d.getMonth()+1).padStart(2,"0"),g=String(d.getDate()).padStart(2,"0"),h=String(d.getHours()).padStart(2,"0"),i=String(d.getMinutes()).padStart(2,"0"),`${f}-${g} ${h}:${i}`)}),a.commentCount>0&&(0,e.jsx)("span",{children:b("review.nComments",{count:a.commentCount})})]})]},a.id)})})]}),u&&c&&(0,e.jsx)("div",{className:"fixed z-[60] px-2 py-1 text-xs bg-popover text-popover-foreground border border-border rounded shadow-md whitespace-nowrap pointer-events-none",style:{top:u.top,left:u.left-8,transform:"translate(-100%, -50%)"},children:u.text}),(0,e.jsx)(i.ReviewCommentsListModal,{isOpen:y.open,onClose:()=>z(a=>({...a,open:!1})),comments:y.comments,reviewTitle:y.title,userNameMap:y.userNameMap})]})}d()}catch(a){d(a)}})},13054:(a,b,c)=>{"use strict";c.d(b,{n:()=>l});var d=c(67484),e=c(57031),f=c(88214),g=c(79606),h=c(33281),i=c(71192);let j=(a,b,c)=>g.tryPromise({try:async()=>{let d=await fetch(a,{method:b,headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok)throw Error(`HTTP ${d.status}`);return await d.json()},catch:c=>new i.uV({message:`${b} ${a} failed`,cause:c})});function k(){(0,e.F)(f.n.ScheduledTasksChanged,{}),document.querySelectorAll("iframe").forEach(a=>{try{a.contentWindow?.postMessage({type:"SCHEDULED_TASKS_CHANGED"},"*")}catch{}})}function l(){let[a,b]=(0,d.useState)([]),[c,e]=(0,d.useState)(0),f=(0,d.useCallback)(()=>{let a;h.t4.runPromise((a="/api/scheduled-tasks",g.tryPromise({try:async()=>{let b=await fetch(a);if(!b.ok)throw Error(`HTTP ${b.status}`);return await b.json()},catch:b=>new i.uV({message:`fetch ${a} failed`,cause:b})})).pipe(g.match({onSuccess:a=>{b(a.tasks??[]),e(a.unreadCount??0)},onFailure:()=>{}})))},[]),l=(0,d.useCallback)(async a=>{let b=await h.t4.runPromiseExit(j("/api/scheduled-tasks","POST",a));if("Success"!==b._tag)return null;let c=b.value;return c.task?(f(),k(),c.task):null},[f]),m=(0,d.useCallback)(async(a,b,c)=>{await h.t4.runPromise(j("/api/scheduled-tasks","PATCH",{id:a,action:b,fields:c}).pipe(g.asVoid).pipe(g.orElse(()=>g.void))),f(),k()},[f]),n=(0,d.useCallback)(a=>m(a,"pause"),[m]),o=(0,d.useCallback)(a=>m(a,"resume"),[m]),p=(0,d.useCallback)(async a=>{await h.t4.runPromise(j("/api/scheduled-tasks","DELETE",{id:a}).pipe(g.asVoid).pipe(g.orElse(()=>g.void))),f(),k()},[f]),q=(0,d.useCallback)((a,b)=>m(a,"update",b),[m]),r=(0,d.useCallback)(a=>m(a,"trigger"),[m]),s=(0,d.useCallback)(a=>m(a,"markRead"),[m]);return{tasks:a,unreadCount:c,reload:f,createTask:l,pauseTask:n,resumeTask:o,triggerTask:r,deleteTask:p,updateTask:q,markRead:s,markAllRead:(0,d.useCallback)(()=>m("_","markAllRead"),[m]),reorderTasks:(0,d.useCallback)(a=>m("_","reorder",{orderedIds:a}),[m])}}},13512:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{d:()=>n,o:()=>m});var e=c(67484),f=c(36043),g=c(74754),h=c(91579),i=c(7031),j=c(38896),k=c(36984),l=a([j,k]);function m(a,b){let c,d=document.createTreeWalker(a,NodeFilter.SHOW_TEXT),e=b,f=null;for(;c=d.nextNode();){f=c;let a=c.textContent.length;if(e<=a)return{node:c,offset:e};e-=a}return f?{node:f,offset:f.textContent.length}:null}function n({content:a,filePath:b,showSearch:c=!0,cwd:d,enableComments:l=!1,scrollToLine:m=null,scrollToLineAlign:o="center",onScrollToLineComplete:p,visibleLineRef:q,onContentSearch:r}){let[s,t]=(0,e.useState)(!1),u=(0,e.useRef)(null),v=(0,e.useRef)(null),w=(0,e.useRef)(null),x=(0,i.r)(),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(null);(0,e.useRef)(null);let[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)(""),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)(!1),[K,L]=(0,e.useState)(0),[M,N]=(0,e.useState)(0),O=(0,e.useRef)(!1),[P,Q]=(0,e.useState)(null),R=(0,e.useRef)(null),S=(0,e.useRef)(()=>{}),T=(0,e.useRef)(!1),U=(0,e.useRef)(null),[V,W]=(0,e.useState)(null),[X,Y]=(0,e.useState)(null),Z=(0,e.useRef)(null),[$,_]=(0,e.useState)(0),aa=l&&!!d,{comments:ab,addComment:ac,updateComment:ad,deleteComment:ae,refresh:af}=(0,g._)({cwd:d||"",filePath:b}),ag=(0,e.useMemo)(()=>a.split("\n"),[a]),ah=(0,j.C)(ag,b),ai=(0,e.useMemo)(()=>{let a=new Map;for(let b of ab){let c=b.endLine;a.has(c)||a.set(c,[]),a.get(c).push(b)}return a},[ab]),aj=(0,e.useMemo)(()=>{let a=new Set;for(let b of ab)for(let c=b.startLine;c<=b.endLine;c++)a.add(c);return a},[ab]),ak=(0,e.useMemo)(()=>(0,k.Np)(ag,E,G,I),[ag,E,G,I]),al=(0,e.useMemo)(()=>{let a=[];for(let b=0;b<ag.length;b++)a.push({type:"code",lineIndex:b});return a},[ag.length]),am=(0,f.Te)({count:al.length,getScrollElement:()=>u.current,estimateSize:()=>20,overscan:10}),an=(0,e.useCallback)(()=>{0!==ak.length&&(L(a=>(a+1)%ak.length),N(a=>a+1))},[ak.length]),ao=(0,e.useCallback)(()=>{0!==ak.length&&(L(a=>(a-1+ak.length)%ak.length),N(a=>a+1))},[ak.length]);(0,e.useRef)(m).current=m;let ap=(0,e.useCallback)(a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?ao():an()),"Escape"===a.key&&(D(!1),F(""))},[an,ao]),aq=(0,e.useCallback)((a,b)=>{aa&&(b.stopPropagation(),Q({comment:a,x:b.clientX,y:b.clientY}),R.current=null,S.current(),W(null),Y(null))},[aa]),ar=(0,e.useCallback)(()=>{let a=R.current;a&&(W({x:a.x,y:a.y,range:a.range,codeContent:a.selectedText}),R.current=null,S.current())},[]),as=(0,e.useCallback)(()=>{let a=R.current;if(!a)return;let b=a.selectedText;Y({x:a.x,y:a.y,range:a.range,codeContent:b}),R.current=null,S.current()},[]),at=(0,e.useCallback)(()=>{let a=R.current;if(!a||!r)return;let b=a.selectedText.trim();R.current=null,S.current(),b&&r(b)},[r]),au=(0,e.useCallback)(async a=>{V&&(await ac(V.range.start,V.range.end,a),W(null))},[V,ac]),av=(0,e.useCallback)(async a=>{if(X&&x&&d)try{let c=await (0,h.$3)(d),e=[];for(let a of c)e.push({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0});e.push({filePath:b,startLine:X.range.start,endLine:X.range.end,codeContent:X.codeContent});let f=(0,h.Gw)(e,a);x.sendMessage(f),await (0,h.RP)(d),af(),Y(null)}catch(a){console.error("Failed to send to AI:",a)}},[X,x,b,d,af]),aw=(0,e.useCallback)((a,b,c)=>{let d=ag[a];if(!d)return b;let e=[];if(E&&ak.length>0)for(let b of ak.filter(b=>b.lineIndex===a)){let c=ak[K]?.lineIndex===a&&ak[K]?.startCol===b.startCol;e.push({start:b.startCol,end:b.endCol,cls:c?"hl-cur":"hl-m"})}if(c&&!E&&c.length>=1){let a=c.toLowerCase(),b=d.toLowerCase(),f=0;for(;-1!==(f=b.indexOf(a,f));)e.push({start:f,end:f+c.length,cls:"hl-kw"}),f+=1}if(0===e.length)return b;e.sort((a,b)=>a.start-b.start||a.end-b.end);let f=[],g=0;for(let a of e){if(a.start<g)continue;a.start>g&&f.push((0,k.ZD)(d.substring(g,a.start)));let b=(0,k.ZD)(d.substring(a.start,a.end));f.push(`<span class="${a.cls}">${b}</span>`),g=a.end}g<d.length&&f.push((0,k.ZD)(d.substring(g)));let h=(0,k.ZD)(d);if(b!==h){let a=b;for(let b of e){let c=d.substring(b.start,b.end),e=(0,k.ZD)(c),f=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),g=RegExp(`(?<=>)([^<]*?)(${f})`,""),h=`$1<span class="${b.cls}">${e}</span>`,i=a.replace(g,h);i.length>a.length+200||(a=i)}return a}return f.join("")},[E,ak,K,ag]);return{parentRef:u,containerRef:v,searchInputRef:w,floatingToolbarRef:R,suppressHoverRef:T,savedSelectionRef:U,highlightedLines:ah,isMounted:s,cmdHeld:y,flashLine:A,isSearchVisible:C,searchQuery:E,caseSensitive:G,wholeWord:I,currentMatchIndex:K,viewingComment:P,bumpToolbarRef:S,addCommentInput:V,sendToAIInput:X,aiBridge:x,commentsEnabled:aa,comments:ab,updateComment:ad,deleteComment:ae,lines:ag,matches:ak,rowData:al,virtualizer:am,commentsByEndLine:ai,linesWithComments:aj,setIsSearchVisible:D,setSearchQuery:F,suppressMatchScrollRef:O,setCaseSensitive:H,setWholeWord:J,setViewingComment:Q,setAddCommentInput:W,setSendToAIInput:Y,goToNextMatch:an,goToPrevMatch:ao,handleSearchKeyDown:ap,handleCommentBubbleClick:aq,handleToolbarAddComment:ar,handleToolbarSendToAI:as,handleToolbarSearch:at,handleCommentSubmit:au,handleSendToAISubmit:av,getHighlightedLineHtml:aw,inlineBlameLineRef:Z,inlineBlameVersion:$}}[j,k]=l.then?(await l)():l,d()}catch(a){d(a)}})},13812:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{k:()=>p});var e=c(48249),f=c(67484),g=c(44256),h=c(36295),i=c(7833),j=c(28602),k=c(44384),l=c(74493),m=a([h]);h=(m.then?(await m)():m)[0];let t={string:{label:"S",color:"text-emerald-500 bg-emerald-500/10"},hash:{label:"H",color:"text-blue-500 bg-blue-500/10"},list:{label:"L",color:"text-orange-500 bg-orange-500/10"},set:{label:"SET",color:"text-teal-500 bg-teal-500/10"},zset:{label:"Z",color:"text-purple-500 bg-purple-500/10"},stream:{label:"STR",color:"text-pink-500 bg-pink-500/10"}};function n({type:a}){let b=t[a]||{label:"?",color:"text-muted-foreground bg-muted"};return(0,e.jsx)("span",{className:`inline-block text-[9px] font-mono font-bold leading-none px-1 py-0.5 rounded flex-shrink-0 ${b.color}`,children:b.label})}function o({text:a}){let[b,c]=(0,f.useState)(!1),[d,h]=(0,f.useState)({x:0,y:0,above:!0}),i=(0,f.useRef)(null),j=(0,f.useRef)(null),k=(0,g.F2)(),l=(0,f.useCallback)(()=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{let a=i.current;if(!a||a.scrollWidth<=a.clientWidth)return;let b=a.getBoundingClientRect(),d=k?.getBoundingClientRect(),e=d?.left??0,f=d?.top??0,g=d?.height??window.innerHeight,j=b.top-f,l=b.bottom-f,m=j>g/2;h({x:b.left-e,y:m?j-4:l+4,above:m}),c(!0)},350)},[k]),m=(0,f.useCallback)(()=>{j.current&&clearTimeout(j.current),c(!1)},[]);return(0,e.jsxs)("span",{ref:i,className:"block truncate",onMouseEnter:l,onMouseLeave:m,children:[a,b&&(0,e.jsx)(g.ZL,{children:(0,e.jsx)("div",{className:"fixed z-[9999] max-w-[500px] max-h-[200px] overflow-y-auto px-2 py-1.5 text-xs font-mono bg-popover text-popover-foreground border border-border rounded shadow-lg whitespace-pre-wrap break-all select-text",style:{left:d.x,top:d.y,transform:d.above?"translateY(-100%)":void 0},children:a})})]})}function p({id:a,connectionString:b,displayName:c,selected:d,maximized:g,expandedHeight:m,bubbleContentHeight:t,onSelect:u,onClose:v,onToggleMaximize:w,timestamp:x,onTitleMouseDown:y}){var z;let{t:A}=(0,k.Bd)(),{showToast:B}=(0,i.dj)(),[C,D]=(0,f.useState)("connecting"),[E,F]=(0,f.useState)(""),[G,H]=(0,f.useState)(null),[I,J]=(0,f.useState)([]),[K,L]=(0,f.useState)("0"),[M,N]=(0,f.useState)(!1),[O,P]=(0,f.useState)("*"),[Q,R]=(0,f.useState)(!1),[S,T]=(0,f.useState)(null),[U,V]=(0,f.useState)(null),[W,X]=(0,f.useState)(!1),[Y,Z]=(0,f.useState)(null),[$,_]=(0,f.useState)(!1),[aa,ab]=(0,f.useState)("data"),[ac,ad]=(0,f.useState)(""),[ae,af]=(0,f.useState)(""),[ag,ah]=(0,f.useState)([]),[ai,aj]=(0,f.useState)(!1),ak=(0,f.useRef)(null),al=(0,f.useRef)(null),am=(0,f.useCallback)(async()=>{D("connecting"),F("");try{let c=await (0,l.GW)("/api/redis/connect",{id:a,connectionString:b});H(c),D("connected")}catch(a){F(a instanceof Error?a.message:String(a)),D("error")}},[a,b]),an=(0,f.useCallback)(async(c,d,e)=>{R(!0);try{let f=await (0,l.GW)("/api/redis/keys",{id:a,connectionString:b,pattern:c,cursor:d,count:200});J(a=>e?[...a,...f.keys]:f.keys),L(f.cursor),N(f.hasMore)}catch{}R(!1)},[a,b]),ao=(0,f.useCallback)(()=>{T(null),V(null),an(O,"0",!1)},[O,an]),ap=(0,f.useCallback)(async c=>{T(c),X(!0),Z(null),_(!1);try{let d=await (0,l.GW)("/api/redis/get",{id:a,connectionString:b,key:c});V(d)}catch(a){V(null),B(a instanceof Error?a.message:A("redis.loadFailed"))}X(!1)},[a,b,B]),aq=(0,f.useCallback)(async()=>{if(S)try{await (0,l.GW)("/api/redis/delete",{id:a,connectionString:b,keys:[S]}),T(null),V(null),_(!1),an(O,"0",!1)}catch(a){B(a instanceof Error?a.message:A("redis.deleteFailed"))}},[S,a,b,O,an,B]),ar=(0,f.useCallback)(async()=>{if(S&&null!==Y)try{await (0,l.GW)("/api/redis/set",{id:a,connectionString:b,key:S,value:Y,type:"string"}),Z(null),ap(S),B(A("common.saved"))}catch(a){B(a instanceof Error?a.message:A("redis.saveFailed"))}},[S,Y,a,b,ap,B]),as=(0,f.useCallback)(async()=>{try{let c=await (0,l.GW)("/api/redis/command",{id:a,connectionString:b,command:"INFO"});ad("string"==typeof c.result?c.result:String(c.result))}catch{}},[a,b]),at=(0,f.useCallback)(async()=>{let c,d=ae.trim();if(!d)return;aj(!0),af("");let e=[],f=/(?:"([^"]*)")|(?:'([^']*)')|(\S+)/g;for(;null!==(c=f.exec(d));)e.push(c[1]??c[2]??c[3]);let g=e[0]||"",h=e.slice(1);try{let c=await (0,l.GW)("/api/redis/command",{id:a,connectionString:b,command:g,args:h});ah(a=>[...a,{command:d,result:c.result,duration:c.duration,isError:!1}])}catch(a){ah(b=>[...b,{command:d,result:a instanceof Error?a.message:String(a),duration:0,isError:!0}])}aj(!1)},[ae,a,b]),au=g&&m?m-41:t??h.p;return(0,e.jsx)("div",{className:"flex flex-col items-start",children:(0,e.jsxs)("div",{className:`w-full bg-accent text-foreground
|
|
14
|
+
`,c.appendChild(d),setTimeout(()=>{d.style.animation="slideOut 0.3s ease-in",setTimeout(()=>{c.removeChild(d)},300)},3e3)}},8077:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{ProjectSidebar:()=>o});var e=c(48249),f=c(67484),g=c(44384),h=c(25608),i=c(32459),j=c(18499),k=c(74991),l=c(98982),m=c(13054),n=c(29939);function o({projects:a,activeIndex:b,collapsed:c,currentCwd:d,onSelectProject:p,onRemoveProject:q,onReorderProjects:r,onToggleCollapse:s,onOpenSessionBrowser:t,onOpenSettings:u,onOpenNote:v,onOpenSkills:w,onSwitchProject:x,onAddProject:y}){let{t:z}=(0,g.Bd)(),{pinnedSessions:A,unpinSession:B,updateTitle:C,reorder:D}=(0,l.P)(),{tasks:E,unreadCount:F,reload:G,pauseTask:H,resumeTask:I,triggerTask:J,deleteTask:K,updateTask:L,markRead:M,reorderTasks:N}=(0,m.n)(),[O,P]=(0,f.useState)(!1),[Q,R]=(0,f.useState)(null),[S,T]=(0,f.useState)(null),[U,V]=(0,f.useState)([]);(0,f.useRef)(U);let W=(0,f.useRef)(G),X=(0,f.useCallback)(a=>{try{if("task-fired"===a.type)return void W.current();let{data:b}=a;if(!b)return;V(b.sessions||[])}catch{}},[]);(0,n.h)({url:"/ws/global-state",onMessage:X});let Y=new Set(U.filter(a=>"loading"===a.status).map(a=>a.cwd)),Z=new Set(U.filter(a=>"unread"===a.status).map(a=>a.cwd)),$=(0,f.useCallback)(a=>{R(a)},[]),_=(0,f.useCallback)((a,b)=>{a.preventDefault(),null!==Q&&Q!==b&&T(b)},[Q]),aa=(0,f.useCallback)(b=>{if(null!==Q&&Q!==b){let c=[...a],[d]=c.splice(Q,1);c.splice(b,0,d),r(c)}R(null),T(null)},[Q,a,r]),ab=(0,f.useCallback)(()=>{R(null),T(null)},[]);return(0,e.jsxs)("div",{className:`h-full bg-card border-r border-border flex flex-col transition-all duration-200 ${c?"w-12":"w-56"}`,children:[(0,e.jsxs)("div",{className:"p-2 border-b border-border relative",onMouseEnter:()=>P(!0),onMouseLeave:()=>P(!1),children:[(0,e.jsxs)("button",{className:`w-full flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${c?"justify-center":""}`,onClick:t,title:z("workspace.openProject"),children:[(0,e.jsxs)("svg",{className:"w-5 h-5 flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),(0,e.jsx)("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),(0,e.jsx)("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),(0,e.jsx)("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]}),!c&&(0,e.jsx)("span",{className:"text-sm",children:z("workspace.openProject")})]}),O&&(c?(0,e.jsx)("button",{className:"absolute inset-0 m-2 flex items-center justify-center px-2 py-2 rounded-lg bg-accent text-foreground transition-colors z-10",onClick:s,title:z("workspace.expandSidebar"),children:(0,e.jsx)("svg",{className:"w-5 h-5 flex-shrink-0 rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}):(0,e.jsx)("button",{className:"absolute top-1/2 -translate-y-1/2 right-2 p-2 rounded-lg bg-accent text-foreground transition-colors z-10",onClick:s,title:z("workspace.collapseSidebar"),children:(0,e.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}))]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:a.map((a,d)=>{var f;let g;return(0,e.jsx)("div",{draggable:!0,onDragStart:()=>$(d),onDragOver:a=>_(a,d),onDrop:()=>aa(d),onDragEnd:ab,className:`${S===d?"border-t-2 border-brand":""} ${Q===d?"opacity-50":""}`,children:(0,e.jsx)(h.ProjectItem,{index:d,name:(g=(f=a.cwd).split("/").filter(Boolean))[g.length-1]||f,cwd:a.cwd,isActive:d===b,collapsed:c,hasUnread:Z.has(a.cwd),isLoading:Y.has(a.cwd),onClick:()=>p(d),onRemove:()=>q(d),onOpenNote:()=>v(a.cwd)})},a.cwd)})}),(0,e.jsxs)("div",{className:"p-2 border-t border-border space-y-1",children:[(0,e.jsx)(i.e,{currentCwd:d,onSwitchProject:x,collapsed:c,sessions:U}),(0,e.jsx)(j._,{collapsed:c,pinnedSessions:A,onSwitchProject:x,onUnpin:B,onUpdateTitle:C,onReorder:D}),(0,e.jsx)(k.I,{collapsed:c,tasks:E,unreadCount:F,onSwitchProject:x,onPause:H,onResume:I,onTrigger:J,onDelete:K,onMarkRead:M,onUpdateTask:L,onReorder:N}),(0,e.jsxs)("button",{className:`w-full flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${c?"justify-center":""}`,onClick:()=>v(),title:z("workspace.notes"),children:[(0,e.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})}),!c&&(0,e.jsx)("span",{className:"text-sm",children:z("workspace.notes")})]}),(0,e.jsxs)("button",{className:`w-full flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${c?"justify-center":""}`,onClick:w,title:z("workspace.skills"),children:[(0,e.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3l1.9 4.8L19 9l-4.1 3.1L16 18l-4-2.8L8 18l1.1-5.9L5 9l5.1-1.2L12 3z"})}),!c&&(0,e.jsx)("span",{className:"text-sm",children:z("workspace.skills")})]}),(0,e.jsxs)("button",{className:`w-full flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${c?"justify-center":""}`,onClick:u,title:z("workspace.settings"),children:[(0,e.jsxs)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),!c&&(0,e.jsx)("span",{className:"text-sm",children:z("workspace.settings")})]})]})]})}d()}catch(a){d(a)}})},9780:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{lf:()=>k.lf,sd:()=>k.sd,sk:()=>k.sk});var e=c(18482),f=c(63913),g=c(90677),h=c(51520),i=c(47111),j=c(3406),k=c(3560),l=a([e,f,g,h,i,j]);[e,f,g,h,i,j]=l.then?(await l)():l,d()}catch(a){d(a)}})},9804:(a,b,c)=>{"use strict";function d(a,b){for(let c of a){if(c.path===b)return c;if(c.children){let a=d(c.children,b);if(a)return a}}return null}function e(a,b){if(!a)return"";let c=d(b,a);if(c?.isDirectory)return a;let e=a.split("/");return e.pop(),e.join("/")}function f(a){let b=[];for(let c of a){let a=c.split("/"),d=b;for(let b=0;b<a.length;b++){let c=a[b],e=b===a.length-1,f=a.slice(0,b+1).join("/"),g=d.find(a=>a.name===c);g||(g={name:c,path:f,isDirectory:!e,children:e?void 0:[]},d.push(g)),!e&&g.children&&(d=g.children)}}let c=a=>{a.sort((a,b)=>a.isDirectory&&!b.isDirectory?-1:!a.isDirectory&&b.isDirectory?1:a.name.localeCompare(b.name)),a.forEach(a=>{a.children&&c(a.children)})};return c(b),b}function g(a){let b=[],c=a=>{for(let d of a)d.isDirectory&&(b.push(d.path),d.children&&c(d.children))};return c(a),b}c.d(b,{B_:()=>o,HR:()=>function a(b,c){if(0===c.length)return b;let d=new Map(c.map(a=>[a.path,a]));return b.map(b=>{let c=d.get(b.path);return c&&b.isDirectory?void 0===b.children&&void 0!==c.children?{...b,children:c.children}:void 0!==b.children&&void 0!==c.children?{...b,children:a(b.children,c.children)}:b:b})},KH:()=>k,MB:()=>d,S7:()=>e,fw:()=>l,q3:()=>j,r6:()=>m,tE:()=>n,tW:()=>g,u:()=>i,v3:()=>f});let h=new Set(["png","jpg","jpeg","gif","svg","webp","ico","bmp"]);function i(a){let b=a.split(".").pop()?.toLowerCase();return h.has(b||"")}function j(a,b,c=!1){let d=new Set;if(!b)return d;let e=b.toLowerCase(),f=a=>{if(d.add(a.path),a.children)for(let b of a.children)f(b)},g=(a,b)=>{let h=a.name.toLowerCase(),i=c?h===e:h.includes(e);if(i&&a.children)return f(a),b.forEach(a=>d.add(a)),!0;let j=!1;if(a.children)for(let c of a.children)g(c,[...b,a.path])&&(j=!0);return(!!i||!!j)&&(d.add(a.path),b.forEach(a=>d.add(a)),!0)};for(let b of a)g(b,[]);return d}function k(a,b,c=!1){let d=new Set;if(!b)return d;let e=b.toLowerCase();for(let b of a){let a=b.split("/");for(let b=0;b<a.length;b++){let f=a[b].toLowerCase();if(c?f===e:f.includes(e)){for(let b=0;b<=a.length-1;b++)d.add(a.slice(0,b+1).join("/"));break}}}return d}function l(a){let b=Math.floor(Math.floor((Date.now()-1e3*a)/1e3)/60),c=Math.floor(b/60),d=Math.floor(c/24),e=Math.floor(d/30),f=Math.floor(d/365);return f>0?`${f}y ago`:e>0?`${e}mo ago`:d>0?`${d}d ago`:c>0?`${c}h ago`:b>0?`${b}m ago`:"just now"}function m(a){let b=new Date(a),c=new Date,d=b.getFullYear()===c.getFullYear(),e=String(b.getMonth()+1).padStart(2,"0"),f=String(b.getDate()).padStart(2,"0"),g=String(b.getHours()).padStart(2,"0"),h=String(b.getMinutes()).padStart(2,"0");return d?`${e}-${f} ${g}:${h}`:`${b.getFullYear()}-${e}-${f} ${g}:${h}`}let n=()=>{},o=50},12568:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{ReviewDropdown:()=>p});var e=c(48249),f=c(67484),g=c(44384),h=c(29939),i=c(61130),j=c(79606),k=c(33281),l=c(83120),m=a([i]);i=(m.then?(await m)():m)[0];let q="review-last-viewed";function n(){try{return JSON.parse(localStorage.getItem(q)||"{}")}catch{return{}}}function o(a,b){if(!a.lastCommentAt)return!1;let c=b[a.id];return!c||a.lastCommentAt>c}function p({cwd:a}){let{t:b}=(0,g.Bd)(),[c,d]=(0,f.useState)(!1),[m,r]=(0,f.useState)([]),[s,t]=(0,f.useState)(!1),[u,v]=(0,f.useState)(null),[w,x]=(0,f.useState)({}),[y,z]=(0,f.useState)({open:!1,comments:[],title:"",userNameMap:{}}),A=(0,f.useRef)(null),B=(0,f.useRef)(null),[C,D]=(0,f.useState)(null),E=(0,f.useCallback)(async()=>{t(!0);let a=await k.t4.runPromiseExit((0,l.Y_)());"Success"===a._tag&&r(a.value.reviews??[]),t(!1)},[]),F=(0,f.useCallback)(a=>{let{data:b}=a;b?.some(a=>"review"===a.type)&&E()},[E]);(0,h.h)({url:`/ws/watch?cwd=${encodeURIComponent(a||"/")}`,onMessage:F,enabled:!!a});let G=(0,f.useMemo)(()=>m.filter(a=>a.active),[m]),H=(0,f.useMemo)(()=>G.some(a=>o(a,w)),[G,w]),I=(0,f.useCallback)(a=>{let b;(b=n())[a]=Date.now(),localStorage.setItem(q,JSON.stringify(b)),x(n()),window.open(`${window.location.origin}/review/${a}`,"_blank")},[]),J=(0,f.useCallback)(async(a,b)=>{a.stopPropagation();let[c,d]=await Promise.all([k.t4.runPromiseExit((0,l.JK)(b)),k.t4.runPromiseExit((0,l.BL)())]);if("Success"!==c._tag)return;let e=c.value.review,f={};if("Success"===d._tag)for(let[a,b]of Object.entries(d.value.users))f[a]=b.name;z({open:!0,comments:e.comments||[],title:e.title??"",userNameMap:f})},[]),K=(0,f.useCallback)((a,b)=>{B.current=b,a.dataTransfer.effectAllowed="move";let c=a.currentTarget;requestAnimationFrame(()=>c.classList.add("opacity-30"))},[]),L=(0,f.useCallback)(a=>{B.current=null,D(null),a.currentTarget instanceof HTMLElement&&a.currentTarget.classList.remove("opacity-30")},[]),M=(0,f.useCallback)((a,b)=>{a.preventDefault(),a.dataTransfer.dropEffect="move",B.current&&B.current!==b&&D(b)},[]),N=(0,f.useCallback)((a,b)=>{a.preventDefault(),D(null);let c=B.current;B.current=null,c&&c!==b&&r(a=>{let d=[...a],e=d.findIndex(a=>a.id===c),f=d.findIndex(a=>a.id===b);if(-1===e||-1===f)return a;let[g]=d.splice(e,1);d.splice(f,0,g);let h=d.map(a=>a.id);return k.t4.runFork((0,l.z1)(h).pipe(j.orElse(()=>j.void))),d})},[]);return(0,e.jsxs)("div",{ref:A,className:"relative",children:[(0,e.jsxs)("button",{onClick:()=>d(a=>!a),className:`relative p-2 rounded-lg transition-colors ${c?"text-foreground bg-accent":"text-muted-foreground hover:text-foreground hover:bg-accent"}`,title:b("review.reviewManagement"),children:[(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})}),H&&(0,e.jsx)("span",{className:"absolute top-1 right-1 w-2 h-2 bg-red-500 rounded-full"})]}),c&&(0,e.jsxs)("div",{className:"absolute right-0 top-full mt-1 w-64 bg-popover border border-border rounded-lg shadow-xl z-50 overflow-hidden",children:[(0,e.jsxs)("div",{className:"px-3 py-2 border-b border-border flex items-center justify-between",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:b("review.allReviews")}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground/60 ml-1.5",children:G.length})]}),(0,e.jsx)("button",{onClick:E,className:"p-0.5 text-muted-foreground hover:text-foreground rounded transition-colors",title:b("common.refresh"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),(0,e.jsx)("div",{className:"max-h-80 overflow-y-auto",children:s&&0===m.length?(0,e.jsx)("div",{className:"px-3 py-4 text-xs text-muted-foreground/50 text-center",children:b("common.loading")}):0===G.length?(0,e.jsx)("div",{className:"px-3 py-4 text-xs text-muted-foreground/50 text-center",children:b("review.noOpenReviews")}):G.map(a=>{var c;let d,f,g,h,i,j=o(a,w);return(0,e.jsxs)("div",{draggable:!0,onDragStart:b=>K(b,a.id),onDragEnd:L,onDragOver:b=>M(b,a.id),onDrop:b=>N(b,a.id),onMouseEnter:b=>{let c=b.currentTarget.getBoundingClientRect();v({id:a.id,text:a.title,top:c.top+c.height/2,left:c.left})},onMouseLeave:()=>v(b=>b?.id===a.id?null:b),onClick:()=>I(a.id),className:`group px-3 py-2 cursor-pointer border-b transition-colors ${C===a.id?"border-b-brand border-t border-t-transparent":"border-b-border/50"} hover:bg-accent/30`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,e.jsx)("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${j?"bg-red-500":"bg-green-500"}`}),(0,e.jsx)("span",{className:`text-xs truncate flex-1 ${j?"font-medium text-foreground":""}`,children:a.title}),a.commentCount>0&&(0,e.jsx)("button",{onClick:b=>J(b,a.id),className:"flex-shrink-0 p-0.5 rounded text-muted-foreground/0 group-hover:text-muted-foreground/60 hover:!text-brand hover:!bg-brand/10 transition-colors",title:b("review.viewComments"),children:(0,e.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("path",{d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground/50 mt-0.5 pl-3",children:[(0,e.jsx)("span",{children:(c=a.updatedAt||a.createdAt,d=new Date(c),f=String(d.getMonth()+1).padStart(2,"0"),g=String(d.getDate()).padStart(2,"0"),h=String(d.getHours()).padStart(2,"0"),i=String(d.getMinutes()).padStart(2,"0"),`${f}-${g} ${h}:${i}`)}),a.commentCount>0&&(0,e.jsx)("span",{children:b("review.nComments",{count:a.commentCount})})]})]},a.id)})})]}),u&&c&&(0,e.jsx)("div",{className:"fixed z-[60] px-2 py-1 text-xs bg-popover text-popover-foreground border border-border rounded shadow-md whitespace-nowrap pointer-events-none",style:{top:u.top,left:u.left-8,transform:"translate(-100%, -50%)"},children:u.text}),(0,e.jsx)(i.ReviewCommentsListModal,{isOpen:y.open,onClose:()=>z(a=>({...a,open:!1})),comments:y.comments,reviewTitle:y.title,userNameMap:y.userNameMap})]})}d()}catch(a){d(a)}})},13054:(a,b,c)=>{"use strict";c.d(b,{n:()=>l});var d=c(67484),e=c(57031),f=c(88214),g=c(79606),h=c(33281),i=c(71192);let j=(a,b,c)=>g.tryPromise({try:async()=>{let d=await fetch(a,{method:b,headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok)throw Error(`HTTP ${d.status}`);return await d.json()},catch:c=>new i.uV({message:`${b} ${a} failed`,cause:c})});function k(){(0,e.F)(f.n.ScheduledTasksChanged,{}),document.querySelectorAll("iframe").forEach(a=>{try{a.contentWindow?.postMessage({type:"SCHEDULED_TASKS_CHANGED"},"*")}catch{}})}function l(){let[a,b]=(0,d.useState)([]),[c,e]=(0,d.useState)(0),f=(0,d.useCallback)(()=>{let a;h.t4.runPromise((a="/api/scheduled-tasks",g.tryPromise({try:async()=>{let b=await fetch(a);if(!b.ok)throw Error(`HTTP ${b.status}`);return await b.json()},catch:b=>new i.uV({message:`fetch ${a} failed`,cause:b})})).pipe(g.match({onSuccess:a=>{b(a.tasks??[]),e(a.unreadCount??0)},onFailure:()=>{}})))},[]),l=(0,d.useCallback)(async a=>{let b=await h.t4.runPromiseExit(j("/api/scheduled-tasks","POST",a));if("Success"!==b._tag)return null;let c=b.value;return c.task?(f(),k(),c.task):null},[f]),m=(0,d.useCallback)(async(a,b,c)=>{await h.t4.runPromise(j("/api/scheduled-tasks","PATCH",{id:a,action:b,fields:c}).pipe(g.asVoid).pipe(g.orElse(()=>g.void))),f(),k()},[f]),n=(0,d.useCallback)(a=>m(a,"pause"),[m]),o=(0,d.useCallback)(a=>m(a,"resume"),[m]),p=(0,d.useCallback)(async a=>{await h.t4.runPromise(j("/api/scheduled-tasks","DELETE",{id:a}).pipe(g.asVoid).pipe(g.orElse(()=>g.void))),f(),k()},[f]),q=(0,d.useCallback)((a,b)=>m(a,"update",b),[m]),r=(0,d.useCallback)(a=>m(a,"trigger"),[m]),s=(0,d.useCallback)(a=>m(a,"markRead"),[m]);return{tasks:a,unreadCount:c,reload:f,createTask:l,pauseTask:n,resumeTask:o,triggerTask:r,deleteTask:p,updateTask:q,markRead:s,markAllRead:(0,d.useCallback)(()=>m("_","markAllRead"),[m]),reorderTasks:(0,d.useCallback)(a=>m("_","reorder",{orderedIds:a}),[m])}}},13512:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{d:()=>o,o:()=>n});var e=c(67484),f=c(36043),g=c(74754),h=c(91579),i=c(7031),j=c(38896),k=c(36984),l=c(37690),m=a([j,k]);function n(a,b){let c,d=document.createTreeWalker(a,NodeFilter.SHOW_TEXT),e=b,f=null;for(;c=d.nextNode();){f=c;let a=c.textContent.length;if(e<=a)return{node:c,offset:e};e-=a}return f?{node:f,offset:f.textContent.length}:null}function o({content:a,filePath:b,showSearch:c=!0,cwd:d,enableComments:m=!1,scrollToLine:n=null,scrollToLineAlign:p="center",onScrollToLineComplete:q,visibleLineRef:r,onContentSearch:s}){let[t,u]=(0,e.useState)(!1),v=(0,e.useRef)(null),w=(0,e.useRef)(null),x=(0,e.useRef)(null),y=(0,i.r)(),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(null);(0,e.useRef)(null);let[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)(""),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(!1),[L,M]=(0,e.useState)(0),[N,O]=(0,e.useState)(0),P=(0,e.useRef)(!1),[Q,R]=(0,e.useState)(null),S=(0,e.useRef)(!1),T=(0,e.useRef)(null),[U,V]=(0,e.useState)(null),[W,X]=(0,e.useState)(null),Y=(0,e.useMemo)(()=>a.split("\n"),[a]),[Z,$]=(0,e.useState)(null),_=m&&!!d,{toolbarRef:aa,bumpRef:ab,clearToolbar:ac}=(0,l.L)({enabled:_,container:Z,resolveLineRange:a=>{if(!document.contains(a))return null;let b=a.nodeType===Node.TEXT_NODE?a.parentElement:a,c=b?.closest("[data-line]");if(!c)return null;let d=parseInt(c.getAttribute("data-line")||"0",10);return!Number.isFinite(d)||d<=0?null:{start:d,end:d}},buildLineSnapshot:({start:a,end:b})=>Y.slice(a-1,b).join("\n")}),ad=(0,e.useRef)(null),[ae,af]=(0,e.useState)(0),{comments:ag,addComment:ah,updateComment:ai,deleteComment:aj,refresh:ak}=(0,g._)({cwd:d||"",filePath:b}),al=(0,j.C)(Y,b),am=(0,e.useMemo)(()=>{let a=new Map;for(let b of ag){let c=b.endLine;a.has(c)||a.set(c,[]),a.get(c).push(b)}return a},[ag]),an=(0,e.useMemo)(()=>{let a=new Set;for(let b of ag)for(let c=b.startLine;c<=b.endLine;c++)a.add(c);return a},[ag]),ao=(0,e.useMemo)(()=>(0,k.Np)(Y,F,H,J),[Y,F,H,J]),ap=(0,e.useMemo)(()=>{let a=[];for(let b=0;b<Y.length;b++)a.push({type:"code",lineIndex:b});return a},[Y.length]),aq=(0,f.Te)({count:ap.length,getScrollElement:()=>v.current,estimateSize:()=>20,overscan:10}),ar=(0,e.useCallback)(()=>{0!==ao.length&&(M(a=>(a+1)%ao.length),O(a=>a+1))},[ao.length]),as=(0,e.useCallback)(()=>{0!==ao.length&&(M(a=>(a-1+ao.length)%ao.length),O(a=>a+1))},[ao.length]);(0,e.useRef)(n).current=n;let at=(0,e.useCallback)(a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?as():ar()),"Escape"===a.key&&(E(!1),G(""))},[ar,as]),au=(0,e.useCallback)((a,b)=>{_&&(b.stopPropagation(),R({comment:a,x:b.clientX,y:b.clientY}),ac(),V(null),X(null))},[_,ac]),av=(0,e.useCallback)(()=>{let a=aa.current;a&&(V({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),ac())},[ac,aa]),aw=(0,e.useCallback)(()=>{let a=aa.current;a&&(X({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),ac())},[ac,aa]),ax=(0,e.useCallback)(()=>{let a=aa.current;if(!a||!s)return;let b=a.selectedText.trim();ac(),b&&s(b)},[s,ac,aa]),ay=(0,e.useCallback)(async a=>{U&&(await ah(U.range.start,U.range.end,a,U.selectedText),V(null))},[U,ah]),az=(0,e.useCallback)(async a=>{if(W&&y&&d)try{let c=await (0,h.$3)(d),e=[];for(let a of c)e.push({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0});e.push({filePath:b,startLine:W.range.start,endLine:W.range.end,codeContent:W.lineSnapshot});let f=(0,h.Gw)(e,a);y.sendMessage(f),await (0,h.RP)(d),ak(),X(null)}catch(a){console.error("Failed to send to AI:",a)}},[W,y,b,d,ak]),aA=(0,e.useCallback)((a,b,c)=>{let d=Y[a];if(!d)return b;let e=[];if(F&&ao.length>0)for(let b of ao.filter(b=>b.lineIndex===a)){let c=ao[L]?.lineIndex===a&&ao[L]?.startCol===b.startCol;e.push({start:b.startCol,end:b.endCol,cls:c?"hl-cur":"hl-m"})}if(c&&!F&&c.length>=1){let a=c.toLowerCase(),b=d.toLowerCase(),f=0;for(;-1!==(f=b.indexOf(a,f));)e.push({start:f,end:f+c.length,cls:"hl-kw"}),f+=1}if(0===e.length)return b;e.sort((a,b)=>a.start-b.start||a.end-b.end);let f=[],g=0;for(let a of e){if(a.start<g)continue;a.start>g&&f.push((0,k.ZD)(d.substring(g,a.start)));let b=(0,k.ZD)(d.substring(a.start,a.end));f.push(`<span class="${a.cls}">${b}</span>`),g=a.end}g<d.length&&f.push((0,k.ZD)(d.substring(g)));let h=(0,k.ZD)(d);if(b!==h){let a=b;for(let b of e){let c=d.substring(b.start,b.end),e=(0,k.ZD)(c),f=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),g=RegExp(`(?<=>)([^<]*?)(${f})`,""),h=`$1<span class="${b.cls}">${e}</span>`,i=a.replace(g,h);i.length>a.length+200||(a=i)}return a}return f.join("")},[F,ao,L,Y]);return{parentRef:v,containerRef:w,searchInputRef:x,floatingToolbarRef:aa,suppressHoverRef:S,savedSelectionRef:T,highlightedLines:al,isMounted:t,cmdHeld:z,flashLine:B,isSearchVisible:D,searchQuery:F,caseSensitive:H,wholeWord:J,currentMatchIndex:L,viewingComment:Q,bumpToolbarRef:ab,addCommentInput:U,sendToAIInput:W,aiBridge:y,commentsEnabled:_,comments:ag,updateComment:ai,deleteComment:aj,lines:Y,matches:ao,rowData:ap,virtualizer:aq,commentsByEndLine:am,linesWithComments:an,setIsSearchVisible:E,setSearchQuery:G,suppressMatchScrollRef:P,setCaseSensitive:I,setWholeWord:K,setViewingComment:R,setAddCommentInput:V,setSendToAIInput:X,goToNextMatch:ar,goToPrevMatch:as,handleSearchKeyDown:at,handleCommentBubbleClick:au,handleToolbarAddComment:av,handleToolbarSendToAI:aw,handleToolbarSearch:ax,handleCommentSubmit:ay,handleSendToAISubmit:az,getHighlightedLineHtml:aA,inlineBlameLineRef:ad,inlineBlameVersion:ae}}[j,k]=m.then?(await m)():m,d()}catch(a){d(a)}})},13812:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{k:()=>p});var e=c(48249),f=c(67484),g=c(44256),h=c(36295),i=c(7833),j=c(28602),k=c(44384),l=c(74493),m=a([h]);h=(m.then?(await m)():m)[0];let t={string:{label:"S",color:"text-emerald-500 bg-emerald-500/10"},hash:{label:"H",color:"text-blue-500 bg-blue-500/10"},list:{label:"L",color:"text-orange-500 bg-orange-500/10"},set:{label:"SET",color:"text-teal-500 bg-teal-500/10"},zset:{label:"Z",color:"text-purple-500 bg-purple-500/10"},stream:{label:"STR",color:"text-pink-500 bg-pink-500/10"}};function n({type:a}){let b=t[a]||{label:"?",color:"text-muted-foreground bg-muted"};return(0,e.jsx)("span",{className:`inline-block text-[9px] font-mono font-bold leading-none px-1 py-0.5 rounded flex-shrink-0 ${b.color}`,children:b.label})}function o({text:a}){let[b,c]=(0,f.useState)(!1),[d,h]=(0,f.useState)({x:0,y:0,above:!0}),i=(0,f.useRef)(null),j=(0,f.useRef)(null),k=(0,g.F2)(),l=(0,f.useCallback)(()=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{let a=i.current;if(!a||a.scrollWidth<=a.clientWidth)return;let b=a.getBoundingClientRect(),d=k?.getBoundingClientRect(),e=d?.left??0,f=d?.top??0,g=d?.height??window.innerHeight,j=b.top-f,l=b.bottom-f,m=j>g/2;h({x:b.left-e,y:m?j-4:l+4,above:m}),c(!0)},350)},[k]),m=(0,f.useCallback)(()=>{j.current&&clearTimeout(j.current),c(!1)},[]);return(0,e.jsxs)("span",{ref:i,className:"block truncate",onMouseEnter:l,onMouseLeave:m,children:[a,b&&(0,e.jsx)(g.ZL,{children:(0,e.jsx)("div",{className:"fixed z-[9999] max-w-[500px] max-h-[200px] overflow-y-auto px-2 py-1.5 text-xs font-mono bg-popover text-popover-foreground border border-border rounded shadow-lg whitespace-pre-wrap break-all select-text",style:{left:d.x,top:d.y,transform:d.above?"translateY(-100%)":void 0},children:a})})]})}function p({id:a,connectionString:b,displayName:c,selected:d,maximized:g,expandedHeight:m,bubbleContentHeight:t,onSelect:u,onClose:v,onToggleMaximize:w,timestamp:x,onTitleMouseDown:y}){var z;let{t:A}=(0,k.Bd)(),{showToast:B}=(0,i.dj)(),[C,D]=(0,f.useState)("connecting"),[E,F]=(0,f.useState)(""),[G,H]=(0,f.useState)(null),[I,J]=(0,f.useState)([]),[K,L]=(0,f.useState)("0"),[M,N]=(0,f.useState)(!1),[O,P]=(0,f.useState)("*"),[Q,R]=(0,f.useState)(!1),[S,T]=(0,f.useState)(null),[U,V]=(0,f.useState)(null),[W,X]=(0,f.useState)(!1),[Y,Z]=(0,f.useState)(null),[$,_]=(0,f.useState)(!1),[aa,ab]=(0,f.useState)("data"),[ac,ad]=(0,f.useState)(""),[ae,af]=(0,f.useState)(""),[ag,ah]=(0,f.useState)([]),[ai,aj]=(0,f.useState)(!1),ak=(0,f.useRef)(null),al=(0,f.useRef)(null),am=(0,f.useCallback)(async()=>{D("connecting"),F("");try{let c=await (0,l.GW)("/api/redis/connect",{id:a,connectionString:b});H(c),D("connected")}catch(a){F(a instanceof Error?a.message:String(a)),D("error")}},[a,b]),an=(0,f.useCallback)(async(c,d,e)=>{R(!0);try{let f=await (0,l.GW)("/api/redis/keys",{id:a,connectionString:b,pattern:c,cursor:d,count:200});J(a=>e?[...a,...f.keys]:f.keys),L(f.cursor),N(f.hasMore)}catch{}R(!1)},[a,b]),ao=(0,f.useCallback)(()=>{T(null),V(null),an(O,"0",!1)},[O,an]),ap=(0,f.useCallback)(async c=>{T(c),X(!0),Z(null),_(!1);try{let d=await (0,l.GW)("/api/redis/get",{id:a,connectionString:b,key:c});V(d)}catch(a){V(null),B(a instanceof Error?a.message:A("redis.loadFailed"))}X(!1)},[a,b,B]),aq=(0,f.useCallback)(async()=>{if(S)try{await (0,l.GW)("/api/redis/delete",{id:a,connectionString:b,keys:[S]}),T(null),V(null),_(!1),an(O,"0",!1)}catch(a){B(a instanceof Error?a.message:A("redis.deleteFailed"))}},[S,a,b,O,an,B]),ar=(0,f.useCallback)(async()=>{if(S&&null!==Y)try{await (0,l.GW)("/api/redis/set",{id:a,connectionString:b,key:S,value:Y,type:"string"}),Z(null),ap(S),B(A("common.saved"))}catch(a){B(a instanceof Error?a.message:A("redis.saveFailed"))}},[S,Y,a,b,ap,B]),as=(0,f.useCallback)(async()=>{try{let c=await (0,l.GW)("/api/redis/command",{id:a,connectionString:b,command:"INFO"});ad("string"==typeof c.result?c.result:String(c.result))}catch{}},[a,b]),at=(0,f.useCallback)(async()=>{let c,d=ae.trim();if(!d)return;aj(!0),af("");let e=[],f=/(?:"([^"]*)")|(?:'([^']*)')|(\S+)/g;for(;null!==(c=f.exec(d));)e.push(c[1]??c[2]??c[3]);let g=e[0]||"",h=e.slice(1);try{let c=await (0,l.GW)("/api/redis/command",{id:a,connectionString:b,command:g,args:h});ah(a=>[...a,{command:d,result:c.result,duration:c.duration,isError:!1}])}catch(a){ah(b=>[...b,{command:d,result:a instanceof Error?a.message:String(a),duration:0,isError:!0}])}aj(!1)},[ae,a,b]),au=g&&m?m-41:t??h.p;return(0,e.jsx)("div",{className:"flex flex-col items-start",children:(0,e.jsxs)("div",{className:`w-full bg-accent text-foreground
|
|
15
15
|
relative transition-colors cursor-pointer
|
|
16
16
|
${g?"rounded-none overflow-visible border-0":"border overflow-hidden rounded-2xl rounded-bl-md rounded-br-md"}
|
|
17
17
|
${g?"":d?"border-brand":"border-brand/30"}`,onClick:g?void 0:u,children:[(0,e.jsxs)("div",{"data-drag-handle":!0,onDoubleClick:w,onMouseDown:y,className:`flex items-center gap-2 px-4 py-1.5 border-b border-border ${g?"bg-card":"bg-card/50"}`,style:g?{height:41}:void 0,children:[(0,e.jsx)("span",{className:"text-sm flex-shrink-0",children:"♦"}),(0,e.jsx)("span",{className:"text-xs text-foreground truncate font-mono font-medium",children:c}),"connecting"===C&&(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin flex-shrink-0"}),"error"===C&&(0,e.jsx)("span",{className:"text-[10px] text-destructive flex-shrink-0",children:A("common.connectionFailed")}),"connected"===C&&G&&(0,e.jsxs)("span",{className:"text-[10px] text-red-500 flex-shrink-0",children:["v",G.version," \xb7 ",G.dbSize," keys \xb7 ",G.memory]}),(0,e.jsx)("span",{className:"flex-1"}),x&&(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:function(a){if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`}(x)}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),w()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:g?A("browser.exitMaximize",{modKey:(0,j.Mu)()}):A("browser.maximize",{modKey:(0,j.Mu)()}),children:g?(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3"})}):(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),v()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:A("common.close"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsxs)("div",{style:{height:au},className:"flex overflow-hidden",children:["connecting"===C&&(0,e.jsxs)("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:[(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin mr-2"}),A("common.connecting"),"..."]}),"error"===C&&(0,e.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 p-4",children:[(0,e.jsx)("span",{className:"text-sm text-destructive text-center break-all",children:E}),(0,e.jsx)("button",{onClick:am,className:"px-3 py-1.5 text-xs bg-brand text-white rounded-md hover:bg-brand/90 transition-colors",children:A("common.retry")})]}),"connected"===C&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"w-52 flex-shrink-0 border-r border-border flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"p-1.5 border-b border-border flex items-center gap-1",children:[(0,e.jsx)("input",{type:"text",value:O,onChange:a=>P(a.target.value),onKeyDown:a=>{"Enter"===a.key&&ao()},placeholder:A("redis.scanPlaceholder"),className:"flex-1 min-w-0 text-xs bg-background border border-input rounded px-1.5 py-1 font-mono focus:outline-none focus:ring-1 focus:ring-ring"}),(0,e.jsx)("button",{onClick:ao,className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent active:bg-accent/50 transition-colors",title:A("redis.scanSearch"),children:(0,e.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("circle",{cx:"6.5",cy:"6.5",r:"4.5"}),(0,e.jsx)("path",{d:"M10 10l4 4"})]})}),(0,e.jsx)("button",{onClick:()=>an(O,"0",!1),className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent active:bg-accent/50 transition-colors",title:A("common.refresh"),children:(0,e.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("path",{d:"M1 1v5h5"}),(0,e.jsx)("path",{d:"M15 15v-5h-5"}),(0,e.jsx)("path",{d:"M13.5 6A6 6 0 0 0 3.2 3.2L1 6"}),(0,e.jsx)("path",{d:"M2.5 10a6 6 0 0 0 10.3 2.8L15 10"})]})})]}),(0,e.jsxs)("div",{className:"flex-1 overflow-y-auto text-xs",children:[I.map(a=>(0,e.jsxs)("div",{onClick:()=>ap(a.key),className:`flex items-center gap-1.5 px-2 py-1 cursor-pointer transition-colors ${S===a.key?"bg-brand/10 text-brand":"hover:bg-accent text-foreground"}`,children:[(0,e.jsx)(n,{type:a.type}),(0,e.jsx)("span",{className:"truncate min-w-0 flex-1 font-mono",children:(0,e.jsx)(o,{text:a.key})})]},a.key)),0===I.length&&!Q&&(0,e.jsx)("div",{className:"p-2 text-muted-foreground text-center",children:A("redis.noKeys")}),Q&&(0,e.jsx)("div",{className:"p-2 flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin"})}),M&&!Q&&(0,e.jsx)("button",{onClick:()=>an(O,K,!0),className:"w-full py-1.5 text-[10px] text-brand hover:text-brand/80 transition-colors",children:A("redis.loadMore")})]}),(0,e.jsxs)("div",{className:"px-2 py-1 border-t border-border text-[10px] text-muted-foreground",children:[I.length," keys",M?"+":"",G?` / ${G.dbSize} total`:""]})]}),(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-0 border-b border-border bg-card/30 flex-shrink-0",children:[["data","info","cli"].map(a=>(0,e.jsx)("button",{onClick:()=>ab(a),className:`px-3 py-1.5 text-xs transition-colors ${aa===a?"text-brand border-b-2 border-brand font-medium":"text-muted-foreground hover:text-foreground"}`,children:{data:A("redis.tabData"),info:A("redis.tabInfo"),cli:"CLI"}[a]},a)),S&&"data"===aa&&(0,e.jsxs)("div",{className:"ml-auto flex items-center gap-1 pr-2",children:[U&&(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:["TTL: ",function(a,b){if(-1===a)return b("redis.neverExpires");if(-2===a)return b("redis.expired");if(a<60)return`${a}s`;if(a<3600)return`${Math.floor(a/60)}m${a%60>0?` ${a%60}s`:""}`;let c=Math.floor(a/3600),d=Math.floor(a%3600/60);return`${c}h${d>0?` ${d}m`:""}`}(U.ttl,A),null!==U.size?` \xb7 ${null==(z=U.size)?"":z<1024?`${z} B`:z<1048576?`${(z/1024).toFixed(1)} KB`:`${(z/1048576).toFixed(1)} MB`}`:""]}),$?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("span",{className:"text-[10px] text-destructive",children:[A("common.confirm"),"?"]}),(0,e.jsx)("button",{onClick:aq,className:"px-1.5 py-0.5 text-[10px] text-white bg-destructive rounded transition-colors hover:bg-destructive/80",children:A("common.confirm")}),(0,e.jsx)("button",{onClick:()=>_(!1),className:"px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground bg-muted rounded transition-colors",children:A("common.cancel")})]}):(0,e.jsx)("button",{onClick:()=>_(!0),className:"px-1.5 py-0.5 text-[10px] text-destructive hover:text-destructive/80 bg-destructive/10 rounded transition-colors",children:A("common.delete")})]})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:"data"===aa?(0,e.jsx)(q,{selectedKey:S,keyValue:U,keyLoading:W,editingValue:Y,onStartEdit:a=>Z(a),onEditChange:Z,onSaveEdit:ar,onCancelEdit:()=>Z(null),onCellCopy:a=>{navigator.clipboard.writeText(a),B(A("common.copied"))}}):"info"===aa?(0,e.jsx)(r,{infoText:ac,onRefresh:as}):(0,e.jsx)(s,{cliInput:ae,onInputChange:af,onExecute:at,history:ag,loading:ai,endRef:ak,inputRef:al})})]})]})]})]})})}function q({selectedKey:a,keyValue:b,keyLoading:c,editingValue:d,onStartEdit:f,onEditChange:g,onSaveEdit:h,onCancelEdit:i,onCellCopy:j}){let{t:l}=(0,k.Bd)();if(!a)return(0,e.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:l("redis.selectKey")});if(c)return(0,e.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"})});if(!b)return(0,e.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:l("redis.keyNotExist")});let{type:m,value:p}=b;if("string"===m){let b=String(p??""),c=null!==d;return(0,e.jsxs)("div",{className:"p-3 h-full flex flex-col",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,e.jsx)(n,{type:"string"}),(0,e.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:a}),(0,e.jsx)("span",{className:"flex-1"}),c?(0,e.jsxs)("div",{className:"flex gap-1",children:[(0,e.jsx)("button",{onClick:h,className:"px-2 py-0.5 text-[10px] text-white bg-brand rounded hover:bg-brand/90",children:l("common.save")}),(0,e.jsx)("button",{onClick:i,className:"px-2 py-0.5 text-[10px] text-muted-foreground bg-muted rounded hover:text-foreground",children:l("common.cancel")})]}):(0,e.jsx)("button",{onClick:()=>f(b),className:"px-2 py-0.5 text-[10px] text-brand hover:text-brand/80 bg-brand/10 rounded transition-colors",children:l("common.edit")})]}),c?(0,e.jsx)("textarea",{value:d,onChange:a=>g(a.target.value),className:"flex-1 w-full px-2 py-1.5 text-xs font-mono bg-background border border-input rounded resize-none focus:outline-none focus:ring-1 focus:ring-ring",spellCheck:!1}):(0,e.jsx)("pre",{className:"flex-1 overflow-auto text-xs font-mono bg-muted/30 rounded p-2 whitespace-pre-wrap break-all select-text cursor-text",onContextMenu:a=>{a.preventDefault(),j(b)},children:b})]})}if("hash"===m){let b=Object.entries(p||{});return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border",children:[(0,e.jsx)(n,{type:"hash"}),(0,e.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:a}),(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground ml-auto",children:[b.length," fields"]})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:(0,e.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,e.jsx)("thead",{className:"sticky top-0 bg-card z-[1]",children:(0,e.jsxs)("tr",{children:[(0,e.jsx)("th",{className:"px-2 py-1 text-left text-muted-foreground font-medium border-b border-border w-1/3",children:"Field"}),(0,e.jsx)("th",{className:"px-2 py-1 text-left text-muted-foreground font-medium border-b border-border",children:"Value"})]})}),(0,e.jsx)("tbody",{children:b.map(([a,b])=>(0,e.jsxs)("tr",{className:"hover:bg-accent/50",children:[(0,e.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 font-mono truncate max-w-[150px]",onContextMenu:b=>{b.preventDefault(),j(a)},children:(0,e.jsx)(o,{text:a})}),(0,e.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 font-mono truncate max-w-[300px]",onContextMenu:a=>{a.preventDefault(),j(b)},children:(0,e.jsx)(o,{text:b})})]},a))})]})})]})}if("list"===m){let b=p?.items||[],c=p?.total||0;return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border",children:[(0,e.jsx)(n,{type:"list"}),(0,e.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:a}),(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground ml-auto",children:[l("redis.nItems",{total:c}),b.length<c?` (${l("redis.showingN",{count:b.length})})`:""]})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:(0,e.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,e.jsx)("thead",{className:"sticky top-0 bg-card z-[1]",children:(0,e.jsxs)("tr",{children:[(0,e.jsx)("th",{className:"px-2 py-1 text-left text-muted-foreground font-medium border-b border-border w-16",children:"#"}),(0,e.jsx)("th",{className:"px-2 py-1 text-left text-muted-foreground font-medium border-b border-border",children:"Value"})]})}),(0,e.jsx)("tbody",{children:b.map((a,b)=>(0,e.jsxs)("tr",{className:"hover:bg-accent/50",children:[(0,e.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 text-muted-foreground",children:b}),(0,e.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 font-mono truncate max-w-[300px]",onContextMenu:b=>{b.preventDefault(),j(a)},children:(0,e.jsx)(o,{text:a})})]},b))})]})})]})}if("set"===m){let b=p?.items||[],c=p?.total||0;return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border",children:[(0,e.jsx)(n,{type:"set"}),(0,e.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:a}),(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground ml-auto",children:[l("redis.nMembers",{total:c}),b.length<c?` (${l("redis.showingN",{count:b.length})})`:""]})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:(0,e.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,e.jsx)("thead",{className:"sticky top-0 bg-card z-[1]",children:(0,e.jsx)("tr",{children:(0,e.jsx)("th",{className:"px-2 py-1 text-left text-muted-foreground font-medium border-b border-border",children:"Member"})})}),(0,e.jsx)("tbody",{children:b.map((a,b)=>(0,e.jsx)("tr",{className:"hover:bg-accent/50",children:(0,e.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 font-mono truncate max-w-[400px]",onContextMenu:b=>{b.preventDefault(),j(a)},children:(0,e.jsx)(o,{text:a})})},b))})]})})]})}if("zset"===m){let b=p?.items||[],c=p?.total||0;return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border",children:[(0,e.jsx)(n,{type:"zset"}),(0,e.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:a}),(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground ml-auto",children:[l("redis.nMembers",{total:c}),b.length<c?` (${l("redis.showingN",{count:b.length})})`:""]})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:(0,e.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,e.jsx)("thead",{className:"sticky top-0 bg-card z-[1]",children:(0,e.jsxs)("tr",{children:[(0,e.jsx)("th",{className:"px-2 py-1 text-left text-muted-foreground font-medium border-b border-border",children:"Member"}),(0,e.jsx)("th",{className:"px-2 py-1 text-right text-muted-foreground font-medium border-b border-border w-28",children:"Score"})]})}),(0,e.jsx)("tbody",{children:b.map((a,b)=>(0,e.jsxs)("tr",{className:"hover:bg-accent/50",children:[(0,e.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 font-mono truncate max-w-[300px]",onContextMenu:b=>{b.preventDefault(),j(a.member)},children:(0,e.jsx)(o,{text:a.member})}),(0,e.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 font-mono text-right text-muted-foreground",children:a.score})]},b))})]})})]})}if("stream"===m){let b=p?.entries||[],c=p?.total||0;return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border",children:[(0,e.jsx)(n,{type:"stream"}),(0,e.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:a}),(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground ml-auto",children:[l("redis.nEntries",{total:c}),b.length<c?` (${l("redis.showingN",{count:b.length})})`:""]})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:(0,e.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,e.jsx)("thead",{className:"sticky top-0 bg-card z-[1]",children:(0,e.jsxs)("tr",{children:[(0,e.jsx)("th",{className:"px-2 py-1 text-left text-muted-foreground font-medium border-b border-border w-40",children:"ID"}),(0,e.jsx)("th",{className:"px-2 py-1 text-left text-muted-foreground font-medium border-b border-border",children:"Fields"})]})}),(0,e.jsx)("tbody",{children:b.map(([a,b])=>{let c=[];for(let a=0;a<b.length;a+=2)c.push(`${b[a]}: ${b[a+1]}`);return(0,e.jsxs)("tr",{className:"hover:bg-accent/50",children:[(0,e.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 font-mono text-muted-foreground",children:a}),(0,e.jsx)("td",{className:"px-2 py-0.5 border-b border-border/50 font-mono truncate max-w-[300px]",children:(0,e.jsx)(o,{text:c.join(", ")})})]},a)})})]})})]})}return(0,e.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:l("redis.unsupportedType",{type:m})})}function r({infoText:a,onRefresh:b}){let{t:c}=(0,k.Bd)();if(!a)return(0,e.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"})});let d=[],f=null;for(let b of a.split("\n")){let a=b.trim();if(a){if(a.startsWith("#"))f={title:a.replace(/^#\s*/,""),items:[]},d.push(f);else if(f&&a.includes(":")){let b=a.indexOf(":");f.items.push({key:a.slice(0,b),value:a.slice(b+1)})}}}return(0,e.jsxs)("div",{className:"p-2 space-y-3 overflow-auto h-full",children:[(0,e.jsx)("div",{className:"flex justify-end",children:(0,e.jsx)("button",{onClick:b,className:"px-2 py-0.5 text-[10px] text-muted-foreground hover:text-foreground bg-muted rounded transition-colors",children:c("common.refresh")})}),d.map(a=>(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wide px-1 mb-1 font-medium",children:a.title}),(0,e.jsx)("div",{className:"space-y-0",children:a.items.map(({key:a,value:b})=>(0,e.jsxs)("div",{className:"flex items-start gap-2 px-1.5 py-0.5 text-xs hover:bg-accent/50 rounded",children:[(0,e.jsx)("span",{className:"text-muted-foreground font-mono flex-shrink-0 w-48 truncate",children:a}),(0,e.jsx)("span",{className:"font-mono text-foreground break-all",children:b})]},a))})]},a.title))]})}function s({cliInput:a,onInputChange:b,onExecute:c,history:d,loading:f,endRef:g,inputRef:h}){let{t:i}=(0,k.Bd)();return(0,e.jsxs)("div",{className:"flex flex-col h-full",children:[(0,e.jsxs)("div",{className:"flex-1 overflow-auto p-2 font-mono text-xs space-y-2",onClick:()=>h.current?.focus(),children:[0===d.length&&(0,e.jsx)("div",{className:"text-muted-foreground text-center py-4",children:i("redis.cliHint")}),d.map((a,b)=>(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"text-brand",children:[(0,e.jsx)("span",{className:"text-muted-foreground mr-1",children:">"}),a.command,a.duration>0&&(0,e.jsxs)("span",{className:"text-muted-foreground/50 ml-2",children:["(",a.duration,"ms)"]})]}),(0,e.jsx)("pre",{className:`whitespace-pre-wrap break-all mt-0.5 ${a.isError?"text-destructive":"text-foreground"}`,children:a.isError?`(error) ${a.result}`:function a(b,c=0){let d=" ".repeat(c);return null===b?`${d}(nil)`:"number"==typeof b?`${d}(integer) ${b}`:"string"==typeof b?`${d}"${b}"`:Array.isArray(b)?0===b.length?`${d}(empty array)`:b.map((b,c)=>`${d}${c+1}) ${a(b,0)}`).join("\n"):`${d}${String(b)}`}(a.result)})]},b)),(0,e.jsx)("div",{ref:g})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1.5 border-t border-border bg-card/30 flex-shrink-0",children:[(0,e.jsx)("span",{className:"text-xs text-brand font-mono flex-shrink-0",children:">"}),(0,e.jsx)("input",{ref:h,type:"text",value:a,onChange:a=>b(a.target.value),onKeyDown:a=>{"Enter"!==a.key||f||c()},placeholder:i("redis.cliPlaceholder"),className:"flex-1 min-w-0 text-xs font-mono bg-transparent border-0 focus:outline-none",autoComplete:"off",spellCheck:!1,disabled:f}),f&&(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin flex-shrink-0"})]})]})}d()}catch(a){d(a)}})},15105:(a,b,c)=>{"use strict";c.d(b,{G:()=>l,f:()=>m});var d=c(67484);function e(){if("u"<typeof document)return null;let a=document.querySelector('meta[name="cockpit-bridge"]');if(!a)return null;let b=a.dataset.id,c=a.dataset.version;return b?{id:b,version:c||"unknown"}:null}let f=null,g=new Set;function h(){g.forEach(a=>a())}function i(a){g.add(a);let b=e();return b&&!f&&(f=b,Promise.resolve().then(h)),()=>{g.delete(a)}}function j(){return f}function k(){return null}if("u">typeof document&&(f=e()),"u">typeof MutationObserver&&"u">typeof document){let a=new MutationObserver(()=>{let a=e();a&&(!f||a.id!==f.id||a.version!==f.version)&&(f=a,h())}),b=document.head||document.documentElement;b&&a.observe(b,{childList:!0})}function l(){return(0,d.useSyncExternalStore)(i,j,k)}function m(){return f??e()}},16618:(a,b,c)=>{"use strict";function d(a){let b=0xdeadbeef,c=0x41c6ce57;for(let d=0;d<a.length;d++){let e=a.charCodeAt(d);b=Math.imul(b^e,0x9e3779b1),c=Math.imul(c^e,0x5f356495)}return b=Math.imul(b^b>>>16,0x85ebca6b)^Math.imul(c^c>>>13,0xc2b2ae35),(0x100000000*(2097151&(c=Math.imul(c^c>>>16,0x85ebca6b)^Math.imul(b^b>>>13,0xc2b2ae35)))+(b>>>0)>>>0).toString(16)}function e(a){return a.replace(/\s+/g," ").trim()}function f(a,b){return a?`${a}>${b}`:b}function g(a){let b=a.childForFieldName("name");if(b)return b.text;for(let b=0;b<a.namedChildCount;b++){let c=a.namedChild(b);if(c&&("identifier"===c.type||"type_identifier"===c.type||"property_identifier"===c.type))return c.text}return"<anonymous>"}function h(a,b,c,g,i=[],j){return{qualifiedName:f(g,b),name:b,kind:c,startLine:a.startPosition.row+1,endLine:a.endPosition.row+1,contentHash:d(e(a.text)),children:i,params:j}}function i(a){let b=a.childForFieldName("parameter");if(b)return[b.text];let c=a.childForFieldName("parameters");if(!c)return;let d=[];for(let a=0;a<c.namedChildCount;a++){let b=c.namedChild(a);b&&d.push(function a(b){switch(b.type){case"required_parameter":case"optional_parameter":{let c=b.childForFieldName("pattern");return c?a(c):b.text}case"assignment_pattern":{let c=b.childForFieldName("left");return c?a(c):b.text}case"default_parameter":case"typed_default_parameter":{let a=b.childForFieldName("name");return a?a.text:b.text}case"typed_parameter":for(let a=0;a<b.namedChildCount;a++){let c=b.namedChild(a);if(c?.type==="identifier")return c.text}return b.text;default:return b.text}}(b))}return d}function j(a){let b=[],c=function(a){let b=[],c=-1,f=-1;for(let d=0;d<a.namedChildCount;d++){let e=a.namedChild(d);if(e){if("import_statement"===e.type||"export_statement"===e.type&&null!==e.childForFieldName("source")||"import_from_statement"===e.type||"future_import_statement"===e.type)b.push(e),c<0&&(c=e.startPosition.row+1),f=e.endPosition.row+1;else if(c>=0)break}}return c<0?null:{qualifiedName:"__imports__",name:"imports",kind:"unknown",startLine:c,endLine:f,contentHash:d(e(b.map(a=>a.text).join("\n"))),children:[]}}(a);c&&b.push(c);for(let c=0;c<a.namedChildCount;c++){let j=a.namedChild(c);j&&b.push(...function a(b,c,j=!1){switch(b.type){case"export_statement":case"export_default_declaration":{let d=[];for(let e=0;e<b.namedChildCount;e++){let f=b.namedChild(e);f&&d.push(...a(f,c,!0))}return d}case"function_declaration":case"generator_function_declaration":case"function_definition":return[h(b,g(b),"function",c,[],i(b))];case"class_declaration":case"abstract_class_declaration":{let a=g(b),d=f(c,a),e=function(a,b){if(!a)return[];let c=[];for(let d=0;d<a.namedChildCount;d++){let e=a.namedChild(d);if(e){if("method_definition"===e.type)c.push(h(e,g(e),"method",b,[],i(e)));else if("public_field_definition"===e.type){let a=e.childForFieldName("value");a&&("arrow_function"===a.type||"function_expression"===a.type)&&c.push(h(e,g(e),"method",b,[],i(a)))}}}return c}(b.childForFieldName("body"),d);return[h(b,a,"class",c,e)]}case"interface_declaration":return[h(b,g(b),"interface",c)];case"type_alias_declaration":return[h(b,g(b),"type",c)];case"enum_declaration":return[h(b,g(b),"enum",c)];case"lexical_declaration":case"variable_declaration":return function(a,b){let c=[];for(let d=0;d<a.namedChildCount;d++){let e=a.namedChild(d);if(!e||"variable_declarator"!==e.type)continue;let f=e.childForFieldName("name"),j=e.childForFieldName("value");if(!f)continue;let k=f.text,l=j&&("arrow_function"===j.type||"function_expression"===j.type),m=l&&j?i(j):void 0;if(c.push(h(a,k,l?"function":"const",b,[],m)),j&&"object"===j.type&&!l){let a=b?`${b}>${k}`:k;for(let b=0;b<j.namedChildCount;b++){let d=j.namedChild(b);if(d){if("pair"===d.type){let b=d.childForFieldName("key"),e=d.childForFieldName("value");if(!b||!e||"property_identifier"!==b.type&&"identifier"!==b.type||"arrow_function"!==e.type&&"function_expression"!==e.type)continue;c.push(h(d,b.text,"method",a,[],i(e)))}else if("method_definition"===d.type){let b=g(d);b&&c.push(h(d,b,"method",a,[],i(d)))}}}}}return c}(b,c);case"class_definition":{let a=g(b),j=f(c,a),k=function a(b,c){if(!b)return[];let j=[];for(let k=0;k<b.namedChildCount;k++){let l=b.namedChild(k);if(l){if("function_definition"===l.type)j.push(h(l,g(l),"method",c,[],i(l)));else if("decorated_definition"===l.type){let b=l.childForFieldName("definition");if(b?.type==="function_definition")j.push({...h(b,g(b),"method",c,[],i(b)),startLine:l.startPosition.row+1,contentHash:d(e(l.text))});else if(b?.type==="class_definition"){let i=g(b),k=f(c,i),m=a(b.childForFieldName("body"),k);j.push({...h(b,i,"class",c,m),startLine:l.startPosition.row+1,contentHash:d(e(l.text))})}}else if("class_definition"===l.type){let b=g(l),d=f(c,b),e=a(l.childForFieldName("body"),d);j.push(h(l,b,"class",c,e))}}}return j}(b.childForFieldName("body"),j);return[h(b,a,"class",c,k)]}case"decorated_definition":{let f=b.childForFieldName("definition");if(!f)return[];return a(f,c,!1).map(a=>({...a,startLine:b.startPosition.row+1,contentHash:d(e(b.text))}))}case"expression_statement":{let a=[];for(let g=0;g<b.namedChildCount;g++){let h=b.namedChild(g);if(h?.type==="assignment"){let g=function(a,b,c){let g=b.childForFieldName("left");if(!g||"identifier"!==g.type)return null;let h=g.text;return{qualifiedName:f(c,h),name:h,kind:"const",startLine:a.startPosition.row+1,endLine:a.endPosition.row+1,contentHash:d(e(a.text)),children:[]}}(b,h,c);g&&a.push(g)}}return a.push(...function(a,b){let c=null;for(let b=0;b<a.namedChildCount;b++){let d=a.namedChild(b);if(d){if("call_expression"===d.type){c=d;break}if("await_expression"===d.type){for(let a=0;a<d.namedChildCount;a++){let b=d.namedChild(a);if(b?.type==="call_expression"){c=b;break}}break}}}if(!c)return[];let d=c.childForFieldName("function"),e=c.childForFieldName("arguments");if(!d||!e)return[];let f=null,g=[];for(let a=0;a<e.namedChildCount;a++){let b=e.namedChild(a);if(b){if(null===f&&("string"===b.type||"template_string"===b.type)){let a=b.text;f=a.length>=2&&/^["'`]/.test(a)?a.slice(1,-1):a}("arrow_function"===b.type||"function_expression"===b.type)&&g.push(b)}}if(0===g.length||!f)return[];let j=function a(b){if("identifier"===b.type)return b.text;if("member_expression"===b.type){let a=b.childForFieldName("property");return a?.text??""}if("call_expression"===b.type){let c=b.childForFieldName("function");return c?a(c):""}return""}(d),k=j?`${j} ${f}`:f;return g.map((a,c)=>h(a,g.length>1?`${k} #${c+1}`:k,"function",b,[],i(a)))}(b,c)),a}default:return[]}}(j,void 0,!1))}return b.push(...function(a,b){let c=a.text.split("\n"),f=c.length;if(0===f)return[];let g=new Uint8Array(f+2);for(let a of b){let b=Math.max(1,a.startLine),c=Math.min(f,a.endLine);for(let a=b;a<=c;a++)g[a]=1}let h=[],i=(a,b)=>{let f=!1;for(let d=a;d<=b;d++){let a=c[d-1];if(a&&a.trim().length>0){f=!0;break}}if(!f)return;let g=c.slice(a-1,b).join("\n");h.push({qualifiedName:`__code_${a}_${b}__`,name:"code",kind:"unknown",startLine:a,endLine:b,contentHash:d(e(g)),children:[]})},j=-1;for(let a=1;a<=f;a++)g[a]?j>=0&&(i(j,a-1),j=-1):j<0&&(j=a);return j>=0&&i(j,f),h}(a,b)),b}c.d(b,{Hs:()=>j})},16665:(a,b,c)=>{Promise.resolve().then(c.bind(c,55632)),Promise.resolve().then(c.bind(c,99829)),Promise.resolve().then(c.bind(c,24943)),Promise.resolve().then(c.bind(c,74837)),Promise.resolve().then(c.bind(c,85906)),Promise.resolve().then(c.bind(c,72399)),Promise.resolve().then(c.bind(c,25702)),Promise.resolve().then(c.bind(c,47938)),Promise.resolve().then(c.bind(c,19562)),Promise.resolve().then(c.bind(c,83022)),Promise.resolve().then(c.bind(c,6612)),Promise.resolve().then(c.bind(c,93448)),Promise.resolve().then(c.bind(c,65395)),Promise.resolve().then(c.bind(c,84747))},17966:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{i:()=>m});var e=c(32580),f=c(16618),g=c(84398),h=c(4263),i=a([h]);function j(a){return a.qualifiedName.startsWith("__code_")||a.qualifiedName.startsWith("__heading_")}function k(a){return!j(a)&&"__file__"!==a.qualifiedName}async function l(a,b){if(!a)return[];let c=(0,g.k)(b);if(!c)return null;let d=(await (0,h.$)(c)).parse(a);if(!d)return null;try{return(0,f.Hs)(d.rootNode)}finally{d.delete()}}async function m(a,b,c,d,f){let h=new Set;if(a!==b)for(let c of(0,e.X)(d?"":a,f?"":b))"added"===c.type&&void 0!==c.newLineNum&&h.add(c.newLineNum);if(!(0,g.k)(c))return{addedLines:h};let[i,m]=await Promise.all([l(d?"":a,c),l(f?"":b,c)]),n=m??[],o=function(a,b){let c=new Map;for(let b of a)c.set(b.qualifiedName,b);let d=new Map;for(let a of b)d.set(a.qualifiedName,a);let e=[];for(let a of b){let b=c.get(a.qualifiedName);b?b.contentHash!==a.contentHash&&e.push({id:`mod:${a.qualifiedName}`,changeKind:"modified",qname:a.qualifiedName}):e.push({id:`add:${a.qualifiedName}`,changeKind:"added",qname:a.qualifiedName})}for(let b of a)d.has(b.qualifiedName)||e.push({id:`del:${b.qualifiedName}`,changeKind:"deleted",qname:b.qualifiedName});return e}((i??[]).filter(k),n.filter(k)),p=new Set;for(let a of o)"deleted"!==a.changeKind&&p.add(a.qname);for(let a of function(a,b){if(0===b.size)return[];let c=[];for(let d of a)if(j(d)){for(let a of b)if(a>=d.startLine&&a<=d.endLine){c.push(d.qualifiedName);break}}return c}(n,h))p.add(a);return{changedQnames:p,addedLines:h}}h=(i.then?(await i)():i)[0],d()}catch(a){d(a)}})},18191:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{cK:()=>m});var e=c(67484),f=c(63963),g=c(9780),h=c(79606),i=c(33281),j=c(23328),k=a([g]);function l(){return`cmd-${Date.now()}-${Math.random().toString(36).substring(2,9)}`}g=(k.then?(await k)():k)[0];let n=new Set(["zsh","bash","sh","fish","nu","python","python3","node","irb","lua","vim","nvim","vi","nano","emacs","top","htop","less","man"]);function m({cwd:a,initialShellCwd:b,tabId:c,onCwdChange:d}){let[k,o]=(0,e.useState)([]),[p,q]=(0,e.useState)([]),[r,s]=(0,e.useState)(new Set),[t,u]=(0,e.useState)(b||a),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(0),[B,C]=(0,e.useState)(null),[D,E]=(0,e.useState)({}),[F,G]=(0,e.useState)({}),[H,I]=(0,e.useState)(null),J=(0,e.useRef)(null),K=(0,e.useRef)(new Map),L=(0,e.useRef)(new Map),M=(0,e.useRef)(new Set),N=(0,e.useRef)([]),O=(0,e.useRef)(new Map),P=(0,e.useRef)(new Map),Q=(0,e.useRef)(new Map),R=(0,e.useRef)(null),S=(0,e.useRef)(null),T=(0,e.useRef)([]),U=(0,e.useRef)(null),V=(0,e.useCallback)(()=>{if(K.current.size>0){let a=new Map(K.current);K.current.clear(),o(b=>b.map(b=>{let c=a.get(b.id);return void 0!==c?{...b,output:c}:b}))}J.current=null},[]),W=(0,e.useCallback)((a,b)=>{if(M.current.has(a)){let c=P.current.get(a);if(c&&c.size>0)for(let a of c)a(b);else Q.current.has(a)||Q.current.set(a,[]),Q.current.get(a).push(b);return}let c=(L.current.get(a)||"")+b;if(c.length>2097152){let b=function(a){let b=a.slice(-2097152),c=0;if(b.length>0){let a=b.charCodeAt(0);a>=56320&&a<=57343&&(c=1)}let d=Math.min(b.length,64);for(let a=c;a<d;a++){let d=b.charCodeAt(a);if(27===d){c=a;break}if((!(d>=48)||!(d<=63))&&59!==d&&63!==d&&32!==d){d>=64&&d<=126&&(c=a+1);break}}return c>0?b.slice(c):b}(c);L.current.set(a,b),K.current.set(a,b)}else L.current.set(a,c),K.current.set(a,c);null===J.current&&(J.current=requestAnimationFrame(V))},[V]),X=(0,e.useCallback)((a,b=!1)=>{L.current.delete(a),M.current.delete(a),K.current.delete(a),Q.current.delete(a),b||(P.current.delete(a),Z.current.delete(a))},[]),Y=(0,e.useCallback)((a,b)=>{P.current.has(a)||P.current.set(a,new Set),P.current.get(a).add(b);let c=Q.current.get(a);if(c&&c.length>0){for(let a of c)b(a);Q.current.delete(a)}return()=>{P.current.get(a)?.delete(b)}},[]),Z=(0,e.useRef)(new Map),$=(0,e.useCallback)((a,b)=>(Z.current.has(a)||Z.current.set(a,new Set),Z.current.get(a).add(b),()=>{Z.current.get(a)?.delete(b)}),[]),_=(0,e.useCallback)(a=>(null!==J.current&&(cancelAnimationFrame(J.current),J.current=null),V(),L.current.get(a)||""),[V]),aa=(0,e.useCallback)(()=>{U.current&&(U.current.scrollTop=U.current.scrollHeight)},[]),ab=(0,e.useCallback)(async(b=0)=>{if(c){w(!0);try{let d=await i.t4.runPromise((0,j.uc)(a,c,b,100)).catch(a=>(console.error("Failed to load history:",a),null));if(d){let a=[],c=[],e=new Set;for(let b of d.entries){let d=(0,g.sd)(b.type);if(d){let a=d.fromHistory(b);c.push({id:b.id,_type:b.type,timestamp:b.timestamp,...a}),b.sleeping&&e.add(b.id)}else{if(b.running)continue;a.push({id:b.id.includes("-")&&3===b.id.split("-").length?b.id:l(),command:b.command,output:b.output,exitCode:b.exitCode,isRunning:!1,timestamp:b.timestamp,cwd:b.cwd,usePty:b.usePty})}}0===b?(o(a),q(c),e.size>0&&s(e)):(o(b=>{let c=new Set(b.map(a=>a.id)),d=a.filter(a=>!c.has(a.id));return[...b,...d]}),q(a=>{let b=new Set(a.map(a=>a.id)),d=c.filter(a=>!b.has(a.id));return[...a,...d]})),y(d.hasMore),A(b)}}catch(a){console.error("Failed to load history:",a)}finally{w(!1)}}},[a,c]),ac=(0,e.useCallback)(async b=>{c&&await i.t4.runPromise((0,j.AJ)(a,c,{id:b.id,command:b.command,output:b.output,exitCode:b.exitCode,timestamp:b.timestamp,cwd:t}).pipe(h.tapError(a=>h.sync(()=>console.error("Failed to save cd history:",a))),h.orElse(()=>h.void)))},[a,c,t]);(0,e.useCallback)(async b=>{try{let d=await (0,f.If)(a);if(b.current)return;for(let e of d){if(c&&e.tabId!==c)continue;if(b.current)break;let d=e.commandId;o(a=>a.find(a=>a.id===d)?a.map(a=>a.id===d?{...a,isRunning:!0,exitCode:void 0,pid:e.pid,...e.usePty?{usePty:!0}:{}}:a):[...a,{id:d,command:e.command,output:"",isRunning:!0,pid:e.pid,timestamp:e.timestamp,cwd:e.cwd,...e.usePty?{usePty:!0}:{}}]),L.current.set(d,""),e.usePty&&M.current.add(d),await (0,f.TN)({commandId:d,projectCwd:a,onData:(a,b)=>{if("pid"===a);else if("stdout"===a||"stderr"===a)W(d,b.data);else if("exit"===a){let a=_(d);X(d),o(c=>c.map(c=>c.id===d?{...c,output:a,exitCode:b.code,isRunning:!1,pid:void 0}:c))}},onError:()=>{o(a=>a.map(a=>a.id===d&&a.isRunning?{...a,isRunning:!1}:a))}})}}catch{}},[a,c,W,_,X]);let ad=(0,e.useCallback)(async b=>{let e,h=b.trim().split(/\s+/),i=h[0],j=b;F[i]&&(j=F[i]+(h.length>1?" "+h.slice(1).join(" "):""));let k=(0,g.sk)(j);if(k)return void S.current?.(k.type,j.trim());let m=l(),p=new Date().toISOString(),q=(e=j.trim().split(/\s+/)[0],n.has(e)),r={id:m,command:b,output:j!==b?`→ ${j}
|
|
@@ -20,7 +20,7 @@ Error: ${a}`,exitCode:1,isRunning:!1,pid:void 0}:c))}})}catch(b){let a=_(m);X(m)
|
|
|
20
20
|
Error: ${b.message}`,exitCode:1,isRunning:!1,pid:void 0}:c))}},[F,t,D,c,a,W,_,X,aa,d,ac]),ae=(0,e.useCallback)(a=>{let b=k.find(b=>b.id===a);b?.isRunning&&b.pid&&(0,f.HV)(b.pid)},[k]),af=(0,e.useCallback)(async b=>{let d=k.find(a=>a.id===b);if(!d)return;d.isRunning&&d.pid&&((0,f.HV)(d.pid),await new Promise(a=>setTimeout(a,200)));let e=d.command.trim().split(/\s+/),g=e[0],h=d.command;F[g]&&(h=F[g]+(e.length>1?" "+e.slice(1).join(" "):""));let i=d.usePty||!1;if(i){let a=Z.current.get(b);if(a)for(let b of a)b()}X(b,i);let j=h!==d.command?`→ ${h}
|
|
21
21
|
`:"";i||L.current.set(b,j),i&&M.current.add(b),o(a=>a.map(a=>a.id===b?{...a,output:i?"":j,exitCode:void 0,isRunning:!0,pid:void 0}:a));let l=O.current.get(b);try{await (0,f.RS)({cwd:d.cwd||t,command:h,commandId:b,tabId:c||"",projectCwd:a,env:D,usePty:i,...i&&l?{cols:l.cols,rows:l.rows}:{},onData:(a,c)=>{if("pid"===a)o(a=>a.map(a=>a.id===b?{...a,pid:c.pid}:a));else if("stdout"===a||"stderr"===a)W(b,c.data);else if("exit"===a){let a=_(b);X(b),o(d=>d.map(d=>d.id===b?{...d,output:a,exitCode:c.code,isRunning:!1,pid:void 0}:d))}},onError:a=>{let c=_(b);X(b),o(d=>d.map(d=>d.id===b?{...d,output:c+`
|
|
22
22
|
Error: ${a}`,exitCode:1,isRunning:!1,pid:void 0}:d))}})}catch(c){let a=_(b);X(b),o(d=>d.map(d=>d.id===b?{...d,output:a+`
|
|
23
|
-
Error: ${c.message}`,exitCode:1,isRunning:!1,pid:void 0}:d))}},[k,F,t,D,c,a,W,_,X]),ag=(0,e.useCallback)(async b=>{o(a=>a.filter(a=>a.id!==b)),X(b),c&&await i.t4.runPromise((0,j.SN)(a,c,b).pipe(h.tapError(a=>h.sync(()=>console.error("Failed to delete command:",a))),h.orElse(()=>h.void)))},[a,c,X]),ah=(0,e.useCallback)((b,d,e)=>{let f=(0,g.sd)(b);if(!f)return;let k=f.parse(d);"cwd"in k&&!k.cwd&&(k.cwd=t);let l={id:(0,g.lf)(f.idPrefix),_type:b,timestamp:new Date().toISOString(),...k};if(q(a=>[...a,l]),C(l.id),setTimeout(aa,100),e){let b=H&&H.length>0?[...H]:T.current.map(a=>a.data.id),d=b.indexOf(e);-1!==d?b.splice(d+1,0,l.id):b.push(l.id),I(b),c&&i.t4.runFork((0,j.cm)(a,c,b).pipe(h.orElse(()=>h.void)))}if(c){let d=f.toHistory(l);i.t4.runFork((0,j.AJ)(a,c,{type:b,id:l.id,timestamp:l.timestamp,...d}).pipe(h.tapError(a=>h.sync(()=>console.error(`Failed to save ${b} item:`,a))),h.orElse(()=>h.void)))}},[aa,a,c,H]),ai=(0,e.useCallback)(async b=>{let d=p.find(a=>a.id===b);if(q(a=>a.filter(a=>a.id!==b)),C(a=>a===b?null:a),s(a=>{let c=new Set(a);return c.delete(b),c}),d){let a=(0,g.sd)(d._type);a?.onClose?.(d)}c&&i.t4.runFork((0,j.SN)(a,c,b).pipe(h.tapError(a=>h.sync(()=>console.error("Failed to delete plugin item:",a))),h.orElse(()=>h.void)))},[p,a,c]);S.current=ah,R.current=ad;let aj=(0,e.useCallback)((b,d)=>{c&&i.t4.runFork((0,j.bv)(a,c,b,{sleeping:d}).pipe(h.orElse(()=>h.void)))},[a,c]),ak=(0,e.useCallback)(a=>{s(b=>new Set(b).add(a)),aj(a,!0)},[aj]),al=(0,e.useCallback)(a=>{s(b=>{let c=new Set(b);return c.delete(a),c}),aj(a,!1)},[aj]),am=(0,e.useCallback)(async b=>{I(b),c&&await i.t4.runPromise((0,j.cm)(a,c,b).pipe(h.orElse(()=>h.void)))},[a,c]),an=(0,e.useMemo)(()=>{let a=[...k.map(a=>({type:"command",data:a})),...p.map(a=>({type:a._type,data:a}))];if(!H||0===H.length)return a.sort((a,b)=>new Date(a.data.timestamp).getTime()-new Date(b.data.timestamp).getTime());let b=new Map(H.map((a,b)=>[a,b])),c=[],d=[];for(let e of a)b.has(e.data.id)?c.push(e):d.push(e);return c.sort((a,c)=>b.get(a.data.id)-b.get(c.data.id)),d.sort((a,b)=>new Date(a.data.timestamp).getTime()-new Date(b.data.timestamp).getTime()),[...c,...d]},[k,p,H]);return T.current=an,{commands:k,pluginItems:p,sleepingBubbles:r,consoleItems:an,currentCwd:t,selectedCommandId:B,setSelectedCommandId:C,customEnv:D,setCustomEnv:E,aliases:F,setAliases:G,isLoadingHistory:v,hasMoreHistory:x,currentPage:z,scrollRef:U,commandHistoryRef:N,ptySizeRef:O,executeCommandRef:R,executeCommand:ad,interruptCommand:ae,rerunCommand:af,deleteCommand:ag,addPluginItem:ah,closePluginItem:ai,handleBubbleSleep:ak,handleBubbleWake:al,loadHistory:ab,scrollToBottom:aa,saveBubbleOrder:am,sendStdin:f.tr,resizePty:f.mO,subscribePtyOutput:Y,subscribePtyReset:$}}d()}catch(a){d(a)}})},18482:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(48249),e=c(3560),f=c(98420),g=a([f]);f=(g.then?(await g)():g)[0],(0,e.Aq)({type:"browser",idPrefix:"browser",match(a){let b=a.trim().toLowerCase();return b.startsWith("http://")||b.startsWith("https://")},parse:a=>({url:a.trim()}),fromHistory:a=>({url:a.url}),toHistory:a=>({url:a.url}),Component:function({item:a,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l,extra:m}){return(0,d.jsx)(f.V,{id:a.id,url:a.url,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l,onNewTab:m?.addBrowserItem,initialSleeping:m?.initialSleeping,onSleep:m?.onSleep,onWake:m?.onWake})}}),b()}catch(a){b(a)}})},18499:(a,b,c)=>{"use strict";c.d(b,{_:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({collapsed:a,pinnedSessions:b,onSwitchProject:c,onUnpin:h,onUpdateTitle:i,onReorder:j}){let{t:k}=(0,f.Bd)(),[l,m]=(0,e.useState)(!1),n=(0,e.useRef)(null),[o,p]=(0,e.useState)(null),[q,r]=(0,e.useState)(""),s=(0,e.useRef)(null),[t,u]=(0,e.useState)(null),[v,w]=(0,e.useState)(null),x=(0,e.useCallback)(a=>{o||(c(a.cwd,a.sessionId),m(!1))},[c,o]),y=(0,e.useCallback)((a,b)=>{b.stopPropagation(),p(a.sessionId),r(a.customTitle||"")},[]),z=(0,e.useCallback)(()=>{o&&q.trim()&&i(o,q.trim()),p(null)},[o,q,i]),A=(0,e.useCallback)(a=>{u(a)},[]),B=(0,e.useCallback)((a,b)=>{a.preventDefault(),w(b)},[]),C=(0,e.useCallback)(a=>{if(null===t||t===a){u(null),w(null);return}let c=[...b],[d]=c.splice(t,1);c.splice(a,0,d),j(c),u(null),w(null)},[t,b,j]),D=(0,e.useCallback)(()=>{u(null),w(null)},[]);return(0,d.jsxs)("div",{className:"relative",ref:n,children:[(0,d.jsxs)("button",{onClick:()=>m(!l),className:`relative flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${a?"w-full justify-center":"w-full"}`,title:k("sessions.pinnedSessions"),children:[(0,d.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"})}),!a&&(0,d.jsx)("span",{className:"text-sm flex-1 text-left",children:k("sessions.pinnedSessions")}),a&&b.length>0&&(0,d.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] px-1 text-muted-foreground text-xs font-medium rounded-full flex items-center justify-center bg-accent",children:b.length})]}),l&&(0,d.jsxs)("div",{className:"absolute left-full bottom-0 ml-2 w-80 max-h-[450px] bg-popover border border-border rounded-lg shadow-lg z-50 flex flex-col",children:[(0,d.jsx)("div",{className:"px-3 py-2 border-b border-border bg-muted/50 flex-shrink-0 rounded-t-lg",children:(0,d.jsx)("span",{className:"text-sm font-medium",children:k("sessions.pinnedSessions")})}),(0,d.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:0===b.length?(0,d.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:k("sessions.noPinnedSessions")}):b.map((a,c)=>{let e;return(0,d.jsxs)("div",{draggable:!0,onDragStart:()=>A(c),onDragOver:a=>B(a,c),onDrop:()=>C(c),onDragEnd:D,onClick:()=>x(a),className:`group w-full px-3 py-2 text-left hover:bg-accent transition-colors flex items-start gap-2 cursor-pointer ${c!==b.length-1?"border-b border-border/50":""} ${t===c?"opacity-50":""} ${v===c?"border-t-2 border-brand":""}`,children:[(0,d.jsx)("span",{className:"mt-1.5 text-muted-foreground/30 flex-shrink-0 cursor-grab",children:(0,d.jsxs)("svg",{className:"w-3 h-3",viewBox:"0 0 10 16",fill:"currentColor",children:[(0,d.jsx)("circle",{cx:"3",cy:"2",r:"1.5"}),(0,d.jsx)("circle",{cx:"7",cy:"2",r:"1.5"}),(0,d.jsx)("circle",{cx:"3",cy:"8",r:"1.5"}),(0,d.jsx)("circle",{cx:"7",cy:"8",r:"1.5"}),(0,d.jsx)("circle",{cx:"3",cy:"14",r:"1.5"}),(0,d.jsx)("circle",{cx:"7",cy:"14",r:"1.5"})]})}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",title:a.cwd,children:[(0,d.jsx)("div",{className:"flex items-center gap-2",children:(0,d.jsx)("span",{className:"font-medium text-sm truncate",children:(e=a.cwd).split("/").pop()||e})}),o===a.sessionId?(0,d.jsx)("input",{ref:s,type:"text",value:q,onChange:a=>r(a.target.value),onKeyDown:a=>{a.nativeEvent.isComposing||("Enter"===a.key&&z(),"Escape"===a.key&&p(null))},onBlur:z,onClick:a=>a.stopPropagation(),className:"w-full text-xs px-1 py-0.5 border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring mt-0.5"}):(0,d.jsx)("div",{className:"text-xs text-foreground/80 truncate",children:a.customTitle||a.sessionId.slice(0,8)})]}),o!==a.sessionId&&(0,d.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity mt-0.5",children:[(0,d.jsx)("button",{onClick:b=>y(a,b),className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground",title:k("sessions.editTitle"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})}),(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),h(a.sessionId)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-destructive",title:k("sessions.remove"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]},a.sessionId)})})]})]})}},18792:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{P:()=>m});var e=c(48249),f=c(67484),g=c(36295),h=c(28602),i=c(74493),j=a([g]);g=(j.then?(await j)():j)[0];let n=["#4C8BF5","#E74C3C","#2ECC71","#F39C12","#9B59B6","#1ABC9C","#E67E22","#3498DB","#E91E63","#00BCD4"];function k(a){if(!a)return"";let b=new Date(a);return isNaN(b.getTime())?"":`${String(b.getMonth()+1).padStart(2,"0")}-${String(b.getDate()).padStart(2,"0")} ${String(b.getHours()).padStart(2,"0")}:${String(b.getMinutes()).padStart(2,"0")}`}function l({nodes:a,rels:b,allLabels:c}){let d=(0,f.useRef)(null),g=(0,f.useRef)(null),h=(0,f.useRef)([]);(0,f.useRef)(0);let i=(0,f.useRef)(null);(0,f.useRef)({w:0,h:0}),(0,f.useRef)(new Map);let[j,k]=(0,f.useState)(null),m=(0,f.useRef)(null),n=(0,f.useCallback)(a=>{let b=g.current?.getBoundingClientRect();if(!b)return null;let c=a.clientX-b.left,d=a.clientY-b.top;return h.current.find(a=>{let b=(a.x||0)-c,e=(a.y||0)-d;return b*b+e*e<400})||null},[]);return(0,e.jsxs)("div",{ref:d,className:"relative w-full h-full",children:[(0,e.jsx)("canvas",{ref:g,className:"cursor-grab active:cursor-grabbing absolute inset-0",onMouseDown:a=>{let b=n(a);if(b){let c=g.current.getBoundingClientRect();i.current={nodeId:b.id,offsetX:a.clientX-c.left-(b.x||0),offsetY:a.clientY-c.top-(b.y||0)}}},onMouseMove:a=>{if(i.current){let b=g.current.getBoundingClientRect(),c=h.current.find(a=>a.id===i.current.nodeId);c&&(c.x=a.clientX-b.left-i.current.offsetX,c.y=a.clientY-b.top-i.current.offsetY,c.vx=0,c.vy=0)}else{let b=n(a);m.current=b,k(b)}},onMouseUp:()=>{i.current=null},onMouseLeave:()=>{i.current=null,m.current=null,k(null)}}),j&&!i.current&&(0,e.jsxs)("div",{className:"absolute top-2 left-2 bg-popover text-popover-foreground border border-border rounded px-2 py-1 text-xs max-w-[300px] pointer-events-none",children:[(0,e.jsxs)("div",{className:"font-medium",children:[j.labels.join(", ")," #",String(j.id)]}),Object.entries(j.properties).slice(0,8).map(([a,b])=>(0,e.jsxs)("div",{className:"truncate",children:[(0,e.jsxs)("span",{className:"text-muted-foreground",children:[a,":"]})," ",String(b)]},a))]})]})}function m({id:a,connectionString:b,displayName:c,selected:d,maximized:j,expandedHeight:o,bubbleContentHeight:p,onSelect:q,onClose:r,onToggleMaximize:s,timestamp:t,onTitleMouseDown:u}){let[v,w]=(0,f.useState)("connecting"),[x,y]=(0,f.useState)(""),[z,A]=(0,f.useState)(null),[B,C]=(0,f.useState)(null),[D,E]=(0,f.useState)(!1),[F,G]=(0,f.useState)("labels"),[H,I]=(0,f.useState)(""),[J,K]=(0,f.useState)(null),[L,M]=(0,f.useState)(!1),[N,O]=(0,f.useState)(""),P=(0,f.useRef)(null),[Q,R]=(0,f.useState)([]),[S,T]=(0,f.useState)([]),[U,V]=(0,f.useState)("schema"),W=j&&o?o-41:p??g.p,X=(0,f.useCallback)(async()=>{w("connecting");try{let c=await (0,i.GW)("/api/neo4j/connect",{id:a,connectionString:b});A(c),w("connected")}catch(a){y(a instanceof Error?a.message:String(a)),w("error")}},[a,b]),Y=(0,f.useCallback)(async()=>{E(!0);try{let c=await (0,i.GW)("/api/neo4j/schema",{id:a,connectionString:b});C(c)}catch{}E(!1)},[a,b]),Z=(0,f.useCallback)(async c=>{let d=c||H.trim();if(d){M(!0),O("");try{var e;let c,f,g=await (0,i.GW)("/api/neo4j/query",{id:a,connectionString:b,cypher:d});K(g);let{nodes:h,rels:j}=(e=g.records,c=new Map,f=[],e.forEach(a=>Object.values(a).forEach(function a(b){if(b&&"object"==typeof b)if("node"===b._type){let a=b._id;c.has(a)||c.set(a,{id:a,labels:b._labels||[],properties:Object.fromEntries(Object.entries(b).filter(([a])=>!a.startsWith("_")))})}else if("relationship"===b._type)f.push({id:b._id,type:b._relType,startId:b._start,endId:b._end,properties:Object.fromEntries(Object.entries(b).filter(([a])=>!a.startsWith("_")))});else if("path"===b._type){let c=b.segments;c?.forEach(b=>{a(b.start),a(b.relationship),a(b.end)})}else Array.isArray(b)&&b.forEach(a)})),{nodes:Array.from(c.values()),rels:f});h.length>0&&(R(h),T(j))}catch(a){O(a instanceof Error?a.message:String(a))}M(!1)}},[a,b,H]),$=(0,f.useCallback)(a=>{let b=`MATCH (n:\`${a}\`) RETURN n LIMIT 25`;I(b),V("cypher"),Z(b)},[Z]),_=(0,f.useCallback)(a=>{let b=`MATCH (a)-[r:\`${a}\`]->(b) RETURN a, r, b LIMIT 25`;I(b),V("graph"),Z(b)},[Z]);return(0,e.jsx)("div",{className:"flex flex-col items-start",onClick:q,children:(0,e.jsxs)("div",{className:`w-full bg-accent text-foreground relative transition-colors ${d?"ring-1 ring-ring":""} rounded-lg overflow-hidden`,children:[(0,e.jsxs)("div",{"data-drag-handle":!0,onDoubleClick:s,onMouseDown:u,className:"flex items-center gap-2 px-4 py-1.5 border-b border-border cursor-grab active:cursor-grabbing select-none",children:[(0,e.jsx)("span",{className:"text-sm flex-shrink-0",children:"⬡"}),(0,e.jsx)("span",{className:"text-xs text-foreground truncate font-mono font-medium",children:c}),"connecting"===v&&(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin flex-shrink-0"}),"connected"===v&&(0,e.jsx)("span",{className:"text-[10px] text-emerald-500 flex-shrink-0",children:"Connected"}),"error"===v&&(0,e.jsx)("span",{className:"text-[10px] text-destructive flex-shrink-0",children:"Error"}),t&&(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:k(t)}),"connected"===v&&z&&(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:["v",z.version," \xb7 ",z.nodeCount.toLocaleString(),"n \xb7 ",z.relationshipCount.toLocaleString(),"r"]}),(0,e.jsx)("span",{className:"flex-1"}),"connected"===v&&(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),Y(),X()},disabled:D,className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0 disabled:opacity-40",title:"Refresh",children:(0,e.jsx)("svg",{className:`w-3.5 h-3.5 ${D?"animate-spin":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),s()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:j?(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25"}):(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),r()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsxs)("div",{style:{height:W},className:"flex flex-col overflow-hidden",children:["connecting"===v&&(0,e.jsxs)("div",{className:"flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin"}),"Connecting..."]}),"error"===v&&(0,e.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center text-xs p-4 gap-2",children:[(0,e.jsx)("p",{className:"text-destructive",children:x}),(0,e.jsx)("button",{onClick:X,className:"px-3 py-1 rounded text-xs bg-brand text-white hover:bg-brand/90 transition-colors",children:"Retry"})]}),"connected"===v&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"flex items-center gap-0 border-b border-border bg-card/30 flex-shrink-0",children:["schema","cypher","graph"].map(a=>(0,e.jsx)("button",{onClick:()=>V(a),className:`px-3 py-1.5 text-xs transition-colors ${U===a?"text-brand border-b-2 border-brand font-medium":"text-muted-foreground hover:text-foreground"}`,children:{schema:"Schema",cypher:"Cypher",graph:"Graph"}[a]},a))}),(0,e.jsxs)("div",{className:"flex-1 overflow-hidden flex",children:["schema"===U&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"w-40 flex-shrink-0 border-r border-border flex flex-col overflow-hidden",children:(0,e.jsx)("div",{className:"flex-1 overflow-y-auto text-xs",children:[{key:"labels",label:"Labels",count:B?.labels.length},{key:"relationships",label:"Relationships",count:B?.relationshipTypes.length},{key:"properties",label:"Properties",count:B?.propertyKeys.length},{key:"indexes",label:"Indexes",count:B?.indexes.length},{key:"constraints",label:"Constraints",count:B?.constraints.length}].map(a=>(0,e.jsxs)("div",{onClick:()=>G(a.key),className:`flex items-center gap-1.5 px-2 py-1.5 cursor-pointer truncate transition-colors ${F===a.key?"bg-brand/10 text-brand":"hover:bg-white/10 text-foreground"}`,children:[(0,e.jsx)("span",{className:"truncate min-w-0 flex-1",children:a.label}),(0,e.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground flex-shrink-0",children:a.count??0})]},a.key))})}),(0,e.jsxs)("div",{className:"flex-1 overflow-y-auto text-xs",children:[D&&(0,e.jsxs)("div",{className:"flex items-center justify-center p-4 gap-2 text-muted-foreground",children:[(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin"})," Loading..."]}),!D&&"labels"===F&&B?.labels.map(a=>{var b;return(0,e.jsxs)("div",{onClick:()=>$(a.name),className:"flex items-center gap-1.5 px-2 py-1 cursor-pointer hover:bg-brand/10 transition-colors",children:[(0,e.jsx)("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:(b=a.name,n[B.labels.map(a=>a.name).indexOf(b)%n.length])}}),(0,e.jsx)("span",{className:"truncate min-w-0 flex-1 font-mono",children:a.name}),(0,e.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground flex-shrink-0",children:a.count.toLocaleString()})]},a.name)}),!D&&"relationships"===F&&B?.relationshipTypes.map(a=>(0,e.jsxs)("div",{onClick:()=>_(a.name),className:"flex items-center gap-1.5 px-2 py-1 cursor-pointer hover:bg-brand/10 transition-colors",children:[(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:"→"}),(0,e.jsx)("span",{className:"truncate min-w-0 flex-1 font-mono",children:a.name}),(0,e.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground flex-shrink-0",children:a.count.toLocaleString()})]},a.name)),!D&&"properties"===F&&B?.propertyKeys.map(a=>(0,e.jsx)("div",{className:"px-2 py-1 font-mono text-muted-foreground hover:bg-brand/10 transition-colors",children:a},a)),!D&&"indexes"===F&&B?.indexes.map(a=>(0,e.jsxs)("div",{className:"px-2 py-1 border-b border-border/50 hover:bg-brand/10 transition-colors",children:[(0,e.jsx)("div",{className:"font-mono text-foreground",children:a.name}),(0,e.jsxs)("div",{className:"text-muted-foreground",children:[a.type," \xb7 ",a.labelsOrTypes?.join(", ")," \xb7 (",a.properties?.join(", "),") \xb7 ",a.state]})]},a.name)),!D&&"constraints"===F&&B?.constraints.map(a=>(0,e.jsxs)("div",{className:"px-2 py-1 border-b border-border/50 hover:bg-brand/10 transition-colors",children:[(0,e.jsx)("div",{className:"font-mono text-foreground",children:a.name}),(0,e.jsxs)("div",{className:"text-muted-foreground",children:[a.type," \xb7 ",a.labelsOrTypes?.join(", ")," \xb7 (",a.properties?.join(", "),")"]})]},a.name))]})]}),"cypher"===U&&(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"p-2 border-b border-border flex-shrink-0",children:[(0,e.jsx)("textarea",{ref:P,value:H,onChange:a=>I(a.target.value),onKeyDown:a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&(a.preventDefault(),Z())},placeholder:`Enter Cypher query (${(0,h.Mu)()}+Enter to run)`,className:"w-full h-20 px-2 py-1.5 text-xs font-mono bg-background border border-input rounded resize-y focus:outline-none focus:ring-1 focus:ring-ring",spellCheck:!1}),(0,e.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[(0,h.Mu)(),"+Enter to execute"]}),(0,e.jsx)("button",{onClick:()=>Z(),disabled:L||!H.trim(),className:"px-2 py-1 text-xs bg-brand text-white rounded hover:bg-brand/90 disabled:opacity-50 transition-colors",children:L?"Running...":"Execute"})]})]}),(0,e.jsxs)("div",{className:"flex-1 overflow-auto",children:[N&&(0,e.jsx)("div",{className:"p-2 text-xs text-destructive",children:N}),J&&!N&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"px-2 py-1 text-[10px] text-muted-foreground border-b border-border flex items-center gap-2",children:[(0,e.jsxs)("span",{children:[J.records.length," rows"]}),(0,e.jsxs)("span",{children:[J.duration,"ms"]}),Object.entries(J.counters).filter(([,a])=>a>0).map(([a,b])=>(0,e.jsxs)("span",{children:[a,": ",b]},a))]}),J.records.length>0&&(0,e.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,e.jsx)("thead",{className:"sticky top-0 bg-card z-[1]",children:(0,e.jsx)("tr",{children:J.keys.map(a=>(0,e.jsx)("th",{className:"px-1.5 py-1 text-left text-muted-foreground font-medium border-b border-border whitespace-nowrap font-mono",children:a},a))})}),(0,e.jsx)("tbody",{children:J.records.map((a,b)=>(0,e.jsx)("tr",{className:"hover:bg-accent/50",children:J.keys.map(b=>(0,e.jsx)("td",{className:"px-1.5 py-0.5 border-b border-border/50 font-mono whitespace-nowrap max-w-[200px] truncate",children:null===a[b]?(0,e.jsx)("span",{className:"text-muted-foreground italic",children:"NULL"}):function(a){if(null==a)return"null";if("object"==typeof a){if("node"===a._type){let b=a._labels?.[0]||"",c=a.name||a.title||a.id||"";return`(${b}${c?": "+c:""})`}return"relationship"===a._type?`[${a._relType}]`:JSON.stringify(a)}return String(a)}(a[b])},b))},b))})]})]})]})]}),"graph"===U&&(0,e.jsx)("div",{className:"flex-1 relative",children:0===Q.length?(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-xs text-muted-foreground gap-2",children:[(0,e.jsx)("p",{children:"Run a Cypher query that returns nodes to visualize"}),(0,e.jsx)("button",{onClick:()=>{let a="MATCH (a)-[r]->(b) RETURN a, r, b LIMIT 50";I(a),Z(a)},className:"px-3 py-1 rounded text-xs bg-brand text-white hover:bg-brand/90 transition-colors",children:"Load sample graph"})]}):(0,e.jsx)(l,{nodes:Q,rels:S,allLabels:B?.labels.map(a=>a.name)||[]})})]})]})]}),!j&&(0,e.jsxs)("div",{className:"border-t border-border px-4 py-1.5 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${"connected"===v?"bg-green-500":"error"===v?"bg-red-500":"bg-yellow-500 animate-pulse"}`}),(0,e.jsx)("span",{children:{connecting:"Connecting",connected:"Connected",error:"Error"}[v]}),"connected"===v&&z&&(0,e.jsx)("span",{className:"text-muted-foreground/70",children:z.edition}),(0,e.jsx)("span",{className:"flex-1"}),t&&(0,e.jsx)("span",{className:"text-[11px] flex-shrink-0",children:k(t)})]})]})})}d()}catch(a){d(a)}})},18921:(a,b,c)=>{"use strict";c.d(b,{_:()=>i,o:()=>h});var d=c(67484),e=c.n(d),f=c(208);let g="json-search-highlight-style";function h(a){let[b,c]=(0,d.useState)(!1),[e,f]=(0,d.useState)(""),[h,i]=(0,d.useState)(!1),[j,k]=(0,d.useState)(0),[l,m]=(0,d.useState)(0),n=(0,d.useRef)(null),o=(0,d.useRef)([]);(0,d.useCallback)(()=>{let b;CSS.highlights?.delete("json-search"),CSS.highlights?.delete("json-search-current"),o.current=[];let c=a.current;if(!c||!e){k(0),m(0);return}!function(){if(document.getElementById(g))return;let a=document.createElement("style");a.id=g,a.textContent="::highlight(json-search){background:rgba(217,119,6,.3)}::highlight(json-search-current){background:rgba(217,119,6,.5)}",document.head.appendChild(a)}();let d=c.textContent||"",f=h?e:e.toLowerCase(),i=h?d:d.toLowerCase(),j=[],l=0;for(;l<i.length;){let a=i.indexOf(f,l);if(-1===a)break;j.push([a,a+f.length]),l=a+1}if(0===j.length){k(0),m(0);return}let n=document.createTreeWalker(c,NodeFilter.SHOW_TEXT),p=0,q=0,r=[],s=null,t=0;for(;(b=n.nextNode())&&q<j.length;){let a=b.textContent?.length||0,c=p,d=p+a;for(;q<j.length;){let[a,e]=j[q];if(a>=d)break;if(!s)if(a>=c)(s=document.createRange()).setStart(b,a-c),t=e;else break;if(t<=d)s.setEnd(b,t-c),r.push(s),s=null,q++;else break}p=d}o.current=r,k(r.length),m(a=>r.length>0?Math.min(a,r.length-1):0),CSS.highlights&&r.length>0&&CSS.highlights.set("json-search",new Highlight(...r))},[a,e,h]);let p=(0,d.useCallback)((a,b)=>{let c=a.getBoundingClientRect();(b.top<c.top||b.bottom>c.bottom)&&(a.scrollTop+=b.top-c.top-c.height/2+b.height/2)},[]);(0,d.useCallback)(b=>{CSS.highlights?.delete("json-search-current");let c=o.current[b];if(!c||!CSS.highlights)return;CSS.highlights.set("json-search-current",new Highlight(c));let d=c.getBoundingClientRect(),e=a.current?.parentElement;e&&p(e,d)},[a,p]);let q=(0,d.useCallback)(()=>{0!==j&&m(a=>(a+1)%j)},[j]),r=(0,d.useCallback)(()=>{0!==j&&m(a=>(a-1+j)%j)},[j]),s=(0,d.useCallback)(()=>{c(!0),setTimeout(()=>n.current?.focus(),0)},[]),t=(0,d.useCallback)(()=>{c(!1),f(""),m(0)},[]),u=(0,d.useCallback)(a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?r():q()),"Escape"===a.key&&(a.preventDefault(),t())},[q,r,t]);return{isVisible:b,query:e,setQuery:f,caseSensitive:h,setCaseSensitive:i,matchCount:j,currentIndex:l,searchInputRef:n,open:s,close:t,goToNext:q,goToPrev:r,handleKeyDown:u}}function i({search:a}){return a.isVisible?e().createElement("div",{className:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-secondary border-b border-border"},e().createElement("input",{ref:a.searchInputRef,type:"text",value:a.query,onChange:b=>a.setQuery(b.target.value),onKeyDown:a.handleKeyDown,placeholder:f.A.t("codeViewer.searchPlaceholder"),className:"flex-1 max-w-xs px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),e().createElement("button",{onClick:()=>a.setCaseSensitive(a=>!a),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${a.caseSensitive?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-accent"}`,title:f.A.t("codeViewer.caseSensitive")},"Aa"),e().createElement("span",{className:"text-xs text-muted-foreground"},a.matchCount>0?`${a.currentIndex+1}/${a.matchCount}`:f.A.t("common.noMatch")),e().createElement("button",{onClick:a.goToPrev,disabled:0===a.matchCount,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:f.A.t("common.previous")},e().createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"}))),e().createElement("button",{onClick:a.goToNext,disabled:0===a.matchCount,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:f.A.t("common.next")},e().createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"}))),e().createElement("button",{onClick:a.close,className:"p-1 rounded hover:bg-accent",title:f.A.t("common.close")},e().createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})))):null}},18946:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{X:()=>i});var e=c(48249),f=c(67484),g=c(58554),h=a([g]);function i({tabId:a,cwd:b,sessionId:c,engine:d,ollamaModel:h,onOllamaModelChange:j,deepseekModel:k,onDeepseekModelChange:l,isActive:m,onStateChange:n,onShowGitStatus:o,onOpenNote:p,onCreateScheduledTask:q,onOpenSession:r,onContentSearch:s}){let t=(0,f.useCallback)(b=>{n(a,{isLoading:b})},[a,n]),u=(0,f.useCallback)(b=>{n(a,{sessionId:b})},[a,n]),v=(0,f.useCallback)(b=>{n(a,{title:b})},[a,n]),w=(0,f.useCallback)(b=>{j?.(a,b)},[a,j]),x=(0,f.useCallback)(b=>{l?.(a,b)},[a,l]);return(0,e.jsx)(g.r,{tabId:a,initialCwd:b,initialSessionId:c,engine:d,ollamaModel:h,onOllamaModelChange:w,deepseekModel:k,onDeepseekModelChange:x,hideHeader:!0,hideSidebar:!0,isActive:m,onLoadingChange:t,onSessionIdChange:u,onTitleChange:v,onShowGitStatus:o,onOpenNote:p,onCreateScheduledTask:q,onOpenSession:r,onContentSearch:s})}g=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},19545:(a,b,c)=>{"use strict";c.d(b,{Qe:()=>f,up:()=>e});var d=c(208);function e(a){return a.storage.markdown.getMarkdown()}function f(){return[{label:d.A.t("slashCommands.heading1"),icon:"H1",description:d.A.t("slashCommands.heading1Desc"),action:a=>a.chain().focus().toggleHeading({level:1}).run()},{label:d.A.t("slashCommands.heading2"),icon:"H2",description:d.A.t("slashCommands.heading2Desc"),action:a=>a.chain().focus().toggleHeading({level:2}).run()},{label:d.A.t("slashCommands.heading3"),icon:"H3",description:d.A.t("slashCommands.heading3Desc"),action:a=>a.chain().focus().toggleHeading({level:3}).run()},{label:d.A.t("slashCommands.bulletList"),icon:"•",description:d.A.t("slashCommands.bulletListDesc"),action:a=>a.chain().focus().toggleBulletList().run()},{label:d.A.t("slashCommands.orderedList"),icon:"1.",description:d.A.t("slashCommands.orderedListDesc"),action:a=>a.chain().focus().toggleOrderedList().run()},{label:d.A.t("slashCommands.taskList"),icon:"☑",description:d.A.t("slashCommands.taskListDesc"),action:a=>a.chain().focus().toggleTaskList().run()},{label:d.A.t("slashCommands.blockquote"),icon:"❝",description:d.A.t("slashCommands.blockquoteDesc"),action:a=>a.chain().focus().toggleBlockquote().run()},{label:d.A.t("slashCommands.codeBlock"),icon:"<>",description:d.A.t("slashCommands.codeBlockDesc"),action:a=>a.chain().focus().toggleCodeBlock().run()},{label:d.A.t("slashCommands.table"),icon:"▦",description:d.A.t("slashCommands.tableDesc"),action:a=>a.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()},{label:d.A.t("slashCommands.horizontalRule"),icon:"──",description:d.A.t("slashCommands.horizontalRuleDesc"),action:a=>a.chain().focus().setHorizontalRule().run()},{label:d.A.t("slashCommands.link"),icon:"\uD83D\uDD17",description:d.A.t("slashCommands.linkDesc"),action:a=>{window.dispatchEvent(new CustomEvent("tiptap-insert-link"))}}]}f()},19562:(a,b,c)=>{"use strict";c.d(b,{SettingsModal:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call SettingsModal() from the server but SettingsModal is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/SettingsModal.tsx","SettingsModal")},20291:(a,b,c)=>{"use strict";c.d(b,{p:()=>i});var d=c(67484),e=c(208),f=c(79606),g=c(33281),h=c(71192);function i({cwd:a,onSearchComplete:b}){let[c,j]=(0,d.useState)(""),[k,l]=(0,d.useState)([]),[m,n]=(0,d.useState)(!1),[o,p]=(0,d.useState)(null),[q,r]=(0,d.useState)(new Set),[s,t]=(0,d.useState)({caseSensitive:!1,wholeWord:!1,regex:!1,fileType:""}),[u,v]=(0,d.useState)(null),w=(0,d.useRef)(null),x=(0,d.useCallback)(async c=>{let d=c.trim();if(!d){l([]),v(null);return}if(d.length<2)return void p(e.A.t("fileBrowser.searchMinChars"));n(!0),p(null);let i=new URLSearchParams({cwd:a,q:c,caseSensitive:String(s.caseSensitive),wholeWord:String(s.wholeWord),regex:String(s.regex),fileType:s.fileType}),j=f.tryPromise({try:async()=>{let a=await fetch(`/api/files/search?${i}`),b=await a.json();if(b.error)throw Error(b.error);return b},catch:a=>new h.uV({message:"content search failed",cause:a})});await g.t4.runPromise(j.pipe(f.match({onSuccess:a=>{l(a.results),v({totalFiles:a.totalFiles,totalMatches:a.totalMatches,truncated:a.truncated}),r(new Set(a.results.map(a=>a.path))),a.results.length>0&&b?.()},onFailure:a=>{p(a.cause instanceof Error?a.cause.message:"Search failed"),l([])}}))),n(!1)},[a,s,b]);return{contentSearchQuery:c,setContentSearchQuery:j,contentSearchResults:k,isSearching:m,searchError:o,searchExpandedPaths:q,searchOptions:s,setSearchOptions:t,searchStats:u,contentSearchInputRef:w,performContentSearch:x,handleSearchToggle:(0,d.useCallback)(a=>{r(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[])}}},20586:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Do:()=>m,Sz:()=>n,VO:()=>l,wI:()=>o});var e=c(48249),f=c(67484),g=c.n(f),h=c(44384),i=c(7122),j=c(61591);function k({status:a}){let{label:b,className:c}={added:{label:"A",className:"text-green-11"},untracked:{label:"A",className:"text-green-11"},modified:{label:"M",className:"text-amber-11"},deleted:{label:"D",className:"text-red-11"},renamed:{label:"R",className:"text-brand"}}[a]||{label:"?",className:"text-muted-foreground"};return(0,e.jsx)("span",{className:`text-xs font-bold ${c}`,children:b})}let a=g().memo(function a({node:b,level:c,selectedPath:d,expandedPaths:g,onSelect:h,onToggle:i,onContextMenu:l,showChanges:m=!1,renderActions:n}){let o=d===b.path,p=g.has(b.path),q=(0,f.useCallback)(()=>{b.isDirectory?i(b.path):h(b)},[b,h,i]),r=(0,f.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),l(a,b.path,b.isDirectory)},[b.path,b.isDirectory,l]);return b.isDirectory?(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 py-0.5 px-2 pr-3 hover:bg-accent cursor-pointer whitespace-nowrap group",style:{paddingLeft:`${12*c+8}px`},onClick:q,onContextMenu:r,children:[(0,e.jsx)("span",{className:"text-slate-9 text-xs",children:p?"▼":"▶"}),(0,e.jsx)("span",{className:"text-sm text-foreground flex-1 truncate","data-tooltip":b.path,children:b.name}),n&&n(b)]}),p&&b.children.map(b=>(0,e.jsx)(a,{node:b,level:c+1,selectedPath:d,expandedPaths:g,onSelect:h,onToggle:i,onContextMenu:l,showChanges:m,renderActions:n},b.path))]}):(0,e.jsxs)("div",{className:`flex items-center gap-1.5 py-0.5 px-2 pr-3 cursor-pointer whitespace-nowrap group ${o?"bg-brand/10":"hover:bg-accent"}`,style:{paddingLeft:`${12*c+8}px`},onClick:q,onContextMenu:r,children:[(0,e.jsx)(j.o,{name:b.name,size:16,className:"flex-shrink-0"}),(0,e.jsx)("span",{className:`text-sm flex-1 truncate ${o?"text-brand":"text-foreground"}`,"data-tooltip":b.path,children:b.name}),b.status&&(0,e.jsx)(k,{status:b.status}),m&&void 0!==b.additions&&void 0!==b.deletions&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("span",{className:"text-xs text-green-11",children:["+",b.additions]}),(0,e.jsxs)("span",{className:"text-xs text-red-11",children:["-",b.deletions]})]}),n&&n(b)]})});function l({files:b,selectedPath:c,expandedPaths:d,onSelect:f,onToggle:g,cwd:j,showChanges:k=!1,renderActions:m,emptyMessage:n,className:o}){let{t:p}=(0,h.Bd)(),q=n??p("gitFileTree.noFiles"),{contextMenu:r,showContextMenu:s,hideContextMenu:t}=(0,i.Ee)();return 0===b.length?(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-slate-9",children:q}):(0,e.jsxs)("div",{className:o||"py-1",children:[b.map(b=>(0,e.jsx)(a,{node:b,level:0,selectedPath:c,expandedPaths:d,onSelect:f,onToggle:g,onContextMenu:s,showChanges:k,renderActions:m},b.path)),r&&(0,e.jsx)(i.ft,{x:r.x,y:r.y,path:r.path,cwd:j,isDirectory:r.isDirectory,onClose:t})]})}function m(a){let b=[];for(let c of a){let a=c.path.split("/"),d=b;for(let b=0;b<a.length;b++){let e=a[b],f=b===a.length-1,g=a.slice(0,b+1).join("/"),h=d.find(a=>a.name===e);h||(h={name:e,path:g,isDirectory:!f,children:[],...f&&{status:c.status,additions:c.additions,deletions:c.deletions,oldPath:c.oldPath,file:c}},d.push(h)),f||(d=h.children)}}let c=a=>{a.sort((a,b)=>a.isDirectory&&!b.isDirectory?-1:!a.isDirectory&&b.isDirectory?1:a.name.localeCompare(b.name)),a.forEach(a=>c(a.children))};return c(b),b}function n(a){let b=[],c=a=>{for(let d of a)d.isDirectory&&(b.push(d.path),c(d.children))};return c(a),b}function o(a){let b=[],c=a=>{if(a.isDirectory)for(let b of a.children)c(b);else b.push(a)};return c(a),b}d()}catch(a){d(a)}})},21482:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{D:()=>k});var e=c(48249),f=c(67484),g=c(44384),h=c(46674),i=c(36984),j=a([i]);function k({results:a,loading:b,totalMatches:c,onSelect:d,onClose:i}){let{t:j}=(0,g.Bd)(),l=function(){let[a,b]=(0,f.useState)(new Map),[c,d]=(0,f.useState)(!1);return(0,f.useRef)(0),a}();return(0,e.jsxs)("div",{className:"border-t border-border bg-secondary flex flex-col",style:{height:"300px"},children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-card/50 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("span",{className:"text-xs font-medium text-foreground",children:[j("searchResults.title")," ",!b&&j("searchResults.nMatches",{count:c})]}),(0,e.jsx)("button",{onClick:i,className:"p-0.5 rounded hover:bg-accent text-muted-foreground",children:(0,e.jsx)(h.A,{className:"w-3.5 h-3.5"})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:b?(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:j("searchResults.searching")}):0===a.length?(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:j("searchResults.noResults")}):a.map(a=>(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"px-3 py-1 text-xs text-muted-foreground font-medium bg-card/30 sticky top-0",children:a.path}),a.matches.map((b,c)=>{let f=`${a.path}:${b.lineNumber}`,g=l.get(f);return(0,e.jsxs)("button",{onClick:()=>d(a.path,b.lineNumber),className:"w-full text-left px-3 py-0.5 hover:bg-accent/50 flex items-baseline gap-2 group",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground font-mono font-variant-tabular flex-shrink-0 w-10 text-right",children:b.lineNumber}),g?(0,e.jsx)("span",{className:"text-sm font-mono truncate",dangerouslySetInnerHTML:{__html:g}}):(0,e.jsx)("span",{className:"text-sm font-mono text-foreground truncate",children:b.content||""})]},`${b.lineNumber}-${c}`)})]},a.path))})]})}i=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},21538:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{n:()=>o});var e=c(48249),f=c(67484),g=c(44384),h=c(35208),i=c(20586),j=c(33281),k=c(85655),l=c(60591),m=c(18921),n=a([i,h]);function o({isOpen:a,onClose:b,commit:c,cwd:d,embedded:n=!1,initialFilePath:p,onContentSearch:q}){let{t:r}=(0,g.Bd)(),[s,t]=(0,f.useState)([]),[u,v]=(0,f.useState)([]),[w,x]=(0,f.useState)(new Set),[y,z]=(0,f.useState)(null),[A,B]=(0,f.useState)(null),[C,D]=(0,f.useState)(!1),[E,F]=(0,f.useState)(!1),[G,H]=(0,f.useState)(null),I=(0,f.useRef)(null),J=(0,m.o)(I),K=(0,f.useCallback)(a=>{c&&(z(a),F(!0),j.t4.runPromiseExit((0,k.Zi)(d,c.hash,a.path)).then(a=>{"Success"===a._tag?B(a.value):console.error(a.cause),F(!1)}))},[d,c]),L=(0,f.useCallback)(a=>{x(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),M=(0,f.useMemo)(()=>{if(!c)return"";if(c.date){var a;let b,d,e,f,g,h,i;return a=c.date,b=new Date(a),d=new Date,e=b.getFullYear()===d.getFullYear(),f=String(b.getMonth()+1).padStart(2,"0"),g=String(b.getDate()).padStart(2,"0"),h=String(b.getHours()).padStart(2,"0"),i=String(b.getMinutes()).padStart(2,"0"),e?`${f}-${g} ${h}:${i}`:`${b.getFullYear()}-${f}-${g} ${h}:${i}`}return c.time?new Date(1e3*c.time).toLocaleString():""},[c]);if(!a||!c)return null;let N=(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"px-4 py-3 border-b border-border bg-secondary flex-shrink-0",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-foreground mb-2",children:c.subject}),c.body&&(0,e.jsx)("div",{className:"text-xs text-muted-foreground whitespace-pre-wrap mb-3 max-h-32 overflow-y-auto border-l-2 border-border pl-3",children:c.body}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-4 text-xs text-muted-foreground",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-slate-9",children:r("commitDetail.hash")}),(0,e.jsx)("span",{className:"font-mono bg-accent px-1.5 py-0.5 rounded",children:c.hash})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-slate-9",children:r("commitDetail.author")}),(0,e.jsx)("span",{children:c.author}),(0,e.jsxs)("span",{className:"text-slate-9",children:["<",c.authorEmail,">"]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-slate-9",children:r("commitDetail.date")}),(0,e.jsx)("span",{children:M}),c.relativeDate&&(0,e.jsxs)("span",{className:"text-slate-9",children:["(",c.relativeDate,")"]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-slate-9",children:r("commitDetail.files")}),(0,e.jsx)("span",{children:r("commitDetail.nChanges",{count:s.length})})]})]})]}),(0,e.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,e.jsx)("div",{className:"w-72 flex-shrink-0 border-r border-border overflow-y-auto overflow-x-hidden",children:C?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:r("commitDetail.loadingFiles")}):(0,e.jsx)(i.VO,{files:u,selectedPath:y?.path||null,expandedPaths:w,onSelect:a=>a.file&&K(a.file),onToggle:L,cwd:d,showChanges:!0,emptyMessage:r("commitDetail.noFileChanges"),className:"py-1"})}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden",children:E?(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:r("commitDetail.loadingDiff")}):A?(0,e.jsx)(h.xZ,{oldContent:A.oldContent,newContent:A.newContent,filePath:A.filePath,isNew:A.isNew,isDeleted:A.isDeleted,cwd:d,enableComments:!0,onPreview:!A.isDeleted&&A.filePath.endsWith(".json")?()=>H({content:A.newContent,filePath:A.filePath}):void 0,previewLabel:r("common.readable"),onContentSearch:q}):(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:r("commitDetail.selectFileToView")})})]})]}),O=G&&(0,e.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>H(null),children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-[90%] h-[90%] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border flex-shrink-0",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground font-mono truncate",children:G.filePath}),(0,e.jsx)("button",{onClick:()=>H(null),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)(m._,{search:J}),(0,e.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4 bg-[#0d1117]",children:(0,e.jsx)("pre",{ref:I,className:"whitespace-pre-wrap break-words font-mono",style:{fontSize:"0.8125rem",lineHeight:"1.5"},children:(0,l.xb)(G.content)})})]})});return n?(0,e.jsxs)("div",{className:"bg-card w-full h-full flex flex-col relative",children:[(0,e.jsx)("button",{onClick:b,className:"absolute top-2 right-2 z-10 p-1 text-slate-9 hover:text-foreground hover:bg-accent rounded transition-colors",title:r("common.close"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),N,O]}):(0,e.jsx)("div",{className:"fixed inset-0 z-[60] bg-black/50",onClick:b,children:(0,e.jsxs)("div",{className:"bg-card w-full h-full flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground",children:r("commitDetail.title")}),(0,e.jsx)("button",{onClick:b,className:"p-1 text-slate-9 hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),N,O]})})}[i,h]=n.then?(await n)():n,d()}catch(a){d(a)}})},21672:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{D:()=>k});var e=c(48249),f=c(67484),g=c(44384),h=c(46674),i=c(36984),j=a([i]);function k({references:a,loading:b,onSelect:c,onClose:d}){let{t:i}=(0,g.Bd)(),j=function(){let[a,b]=(0,f.useState)(new Map),[c,d]=(0,f.useState)(!1);return(0,f.useRef)(0),a}(),l=[],m=new Map;for(let b=0;b<a.length;b++){let c=a[b],d=m.get(c.file);void 0===d&&(d=l.length,m.set(c.file,d),l.push({file:c.file,items:[]})),l[d].items.push({ref:c,idx:b})}return(0,e.jsxs)("div",{className:"border-t border-border bg-secondary flex flex-col",style:{height:"300px"},children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-card/50 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("span",{className:"text-xs font-medium text-foreground",children:[i("references.title")," ",!b&&`(${a.length})`]}),(0,e.jsx)("button",{onClick:d,className:"p-0.5 rounded hover:bg-accent text-muted-foreground",children:(0,e.jsx)(h.A,{className:"w-3.5 h-3.5"})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:b?(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:i("references.searching")}):0===a.length?(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:i("references.notFound")}):l.map(({file:a,items:b})=>(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"px-3 py-1 text-xs text-muted-foreground font-medium bg-card/30 sticky top-0",children:a}),b.map(({ref:a,idx:b})=>(0,e.jsxs)("button",{onClick:()=>c(a),className:"w-full text-left px-3 py-0.5 hover:bg-accent/50 flex items-baseline gap-2 group",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground font-mono font-variant-tabular flex-shrink-0 w-10 text-right",children:a.line}),j.has(b)?(0,e.jsx)("span",{className:"text-sm font-mono truncate",dangerouslySetInnerHTML:{__html:j.get(b)}}):(0,e.jsx)("span",{className:"text-sm font-mono text-foreground truncate",children:a.lineText||""})]},`${a.line}-${a.column}-${b}`))]},a))})]})}i=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},23328:(a,b,c)=>{"use strict";c.d(b,{AJ:()=>n,Cb:()=>z,D0:()=>v,DN:()=>k,Jn:()=>j,Ok:()=>s,QF:()=>i,SN:()=>o,UV:()=>y,Vv:()=>q,Yj:()=>x,Yn:()=>w,bv:()=>p,cm:()=>l,cv:()=>r,jO:()=>t,tp:()=>u,uc:()=>m});var d=c(79606),e=c(71192);let f=a=>d.tryPromise({try:async()=>{let b=await fetch(a);if(!b.ok)throw Error(`HTTP ${b.status}`);return await b.json()},catch:b=>new e.uV({message:`fetch ${a} failed`,cause:b})}),g=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`)},catch:c=>new e.uV({message:`${b.method} ${a} failed`,cause:c})}),h=(a,b)=>g(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),i=(a,b)=>d.gen(function*(){let c=new URLSearchParams({cwd:a});return b&&c.set("tabId",b),(yield*f(`/api/terminal/env?${c}`)).env||{}}),j=()=>f("/api/terminal/aliases").pipe(d.map(a=>a.aliases||{})),k=(a,b)=>f(`/api/terminal/bubble-order?cwd=${encodeURIComponent(a)}&tabId=${encodeURIComponent(b)}`).pipe(d.map(a=>a.order||[])),l=(a,b,c)=>h("/api/terminal/bubble-order",{cwd:a,tabId:b,order:c}),m=(a,b,c,d=100)=>f(`/api/terminal/history?cwd=${encodeURIComponent(a)}&tabId=${encodeURIComponent(b)}&page=${c}&pageSize=${d}`),n=(a,b,c)=>h("/api/terminal/history",{cwd:a,tabId:b,entry:c}),o=(a,b,c)=>g(`/api/terminal/history?cwd=${encodeURIComponent(a)}&tabId=${encodeURIComponent(b)}&commandId=${encodeURIComponent(c)}`,{method:"DELETE"}),p=(a,b,c,d)=>g("/api/terminal/history",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,tabId:b,id:c,fields:d})}),q=a=>h("/api/terminal/env",a),r=a=>h("/api/terminal/aliases",{aliases:a}),s=a=>h("/api/terminal/register",a),t=a=>h("/api/terminal/unregister",a),u=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/terminal/autocomplete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok)throw Error(`HTTP ${b.status}`);return await b.json()},catch:a=>new e.uV({message:"POST /api/terminal/autocomplete failed",cause:a})}),v=a=>f(`/api/project-settings?cwd=${encodeURIComponent(a)}`),w=a=>h("/api/project-settings",a),x=()=>f("/api/services/config?scope=global"),y=a=>f(`/api/services/config?cwd=${encodeURIComponent(a)}`),z=a=>h("/api/services/config",a)},23734:(a,b,c)=>{"use strict";c.d(b,{R:()=>e,d:()=>f});var d=c(28031);let e=(a,b)=>({id:a,legacyType:b??a.replace(/-/g,"_").toUpperCase()}),f=d.Io("@cockpit/IframeBus")},23860:(a,b,c)=>{"use strict";c.d(b,{F:()=>e});var d=c(67484);function e(){let[a,b]=(0,d.useState)(()=>"u"<typeof document||"visible"===document.visibilityState);return a}},23881:(a,b,c)=>{"use strict";c.d(b,{s:()=>h});var d=c(48249),e=c(67484),f=c(44384);function g(a){return a.replace(/^\([^)]+\)\s*/,"")}let h=(0,e.forwardRef)(function({displayString:a,documentation:b,x:c,y:h,container:i,onMouseEnter:j,onMouseLeave:k,onFindReferences:l,onSearch:m},n){let{t:o}=(0,f.Bd)(),p=(0,e.useRef)(null);(0,e.useImperativeHandle)(n,()=>p.current,[]);let q=i.getBoundingClientRect(),r=c-q.left,s=h-q.top,t=(0,e.useMemo)(()=>g(a),[a]),u=(0,e.useMemo)(()=>(function(a){let b,c=/\b(const|let|var|function|class|interface|type|enum|import|export|async|await|return|new|typeof|keyof|extends|implements|readonly|static|public|private|protected|abstract|declare|namespace|module|void|never|undefined|null|true|false|any|unknown|string|number|boolean|bigint|symbol|object)\b/g,e=[],f=0,g=0,h=/\b(const|let|var|function|class|interface|type|enum|import|export|async|await|return|new|typeof|keyof|extends|implements|readonly|static|public|private|protected|abstract|declare|namespace|module|void|never|undefined|null|true|false|any|unknown|string|number|boolean|bigint|symbol|object)\b|"[^"]*"|'[^']*'|\b\d+\b/g;for(;null!==(b=h.exec(a));){b.index>f&&e.push((0,d.jsx)("span",{className:"text-foreground",children:a.slice(f,b.index)},g++));let h=b[0];/^["']/.test(h)?e.push((0,d.jsx)("span",{className:"text-green-400",children:h},g++)):/^\d+$/.test(h)?e.push((0,d.jsx)("span",{className:"text-orange-300",children:h},g++)):c.test(h)?(c.lastIndex=0,e.push((0,d.jsx)("span",{className:"text-pink-400",children:h},g++))):e.push((0,d.jsx)("span",{className:"text-foreground",children:h},g++)),f=b.index+h.length}return f<a.length&&e.push((0,d.jsx)("span",{className:"text-foreground",children:a.slice(f)},g++)),e})(t),[t]);return(0,e.useEffect)(()=>{if(!p.current)return;let a=p.current,b=i.getBoundingClientRect(),d=a.getBoundingClientRect(),e=c-b.left,f=h-b.top;e+d.width>b.width-8&&(e=b.width-d.width-8),e<8&&(e=8),f+d.height>b.height-8&&(f=f-d.height-24),a.style.left=`${e}px`,a.style.top=`${f}px`},[c,h,i]),(0,d.jsxs)("div",{ref:p,className:"absolute z-[200] max-w-lg bg-card border border-border rounded-lg shadow-xl px-3 py-2 pointer-events-none",style:{left:r,top:s},children:[(0,d.jsx)("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all leading-relaxed",children:u}),b&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"border-t border-border my-1"}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:b})]}),(l||m)&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"border-t border-border my-1.5"}),(0,d.jsxs)("div",{className:"flex items-center gap-3 pointer-events-auto",onMouseEnter:j,onMouseLeave:k,children:[l&&(0,d.jsx)("button",{onClick:l,className:"text-[11px] text-brand hover:underline cursor-pointer",children:o("hoverTooltip.findReferences")}),m&&(0,d.jsx)("button",{onClick:()=>m(function(a){let b=g(a),c=b.match(/^(?:function|const|let|var|class|interface|type|enum|async function)\s+([a-zA-Z_$][\w$]*)/);if(c)return c[1];let d=a.match(/\([^)]+\)\s+(?:[\w$]+\.)*([a-zA-Z_$][\w$]*)/);if(d)return d[1];let e=b.match(/([a-zA-Z_$][\w$]*)/);return e?e[1]:b.split(/[(\s:]/)[0]}(a)),className:"text-[11px] text-brand hover:underline cursor-pointer",children:o("hoverTooltip.search")})]})]})]})})},24680:(a,b,c)=>{"use strict";c.d(b,{l:()=>h});var d=c(48249),e=c(67484),f=c(44384),g=c(72529);function h({content:a,containerRef:b,width:c="w-80"}){let{t:i}=(0,f.Bd)(),j=(0,e.useMemo)(()=>(function(a){let b=[],c=a.split("\n"),d=!1;for(let a=0;a<c.length;a++){let e=c[a];if(e.trimStart().startsWith("```")){d=!d;continue}if(d)continue;let f=/^(#{1,6})\s+(.+)$/.exec(e);f&&b.push({level:f[1].length,text:f[2].replace(/\s*#+\s*$/,""),sourceLine:a+1})}return b})(a),[a]),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(null),o=(0,e.useCallback)(a=>{let c=b.current;if(!c)return;let d=c.querySelector(`h1[data-source-start="${a}"], h2[data-source-start="${a}"], h3[data-source-start="${a}"], h4[data-source-start="${a}"], h5[data-source-start="${a}"], h6[data-source-start="${a}"]`);d&&d.scrollIntoView({behavior:"smooth",block:"start"})},[b]);return 0===j.length?null:(0,d.jsxs)("div",{className:`border-r border-border flex-shrink-0 flex flex-col transition-[width] duration-200 ${k?"w-8":c}`,children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-2 py-1.5 border-b border-border flex-shrink-0",children:[!k&&(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:i("editor.toc")}),(0,d.jsx)("button",{onClick:()=>l(a=>!a),className:"p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:i(k?"editor.expandToc":"editor.collapseToc"),children:(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:k?(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}):(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})})]}),!k&&(0,d.jsx)("nav",{className:"flex-1 overflow-y-auto py-1",children:j.map((a,b)=>(0,d.jsx)(g.m,{content:a.text,delay:400,children:(0,d.jsx)("button",{onClick:()=>o(a.sourceLine),className:`block w-full text-left text-sm py-1 px-2 truncate transition-colors hover:bg-accent ${m===a.sourceLine?"text-brand font-medium bg-brand/5":"text-muted-foreground"}`,style:{paddingLeft:`${(a.level-1)*12+8}px`},children:a.text})},b))})]})}},24724:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{h:()=>k});var e=c(48249),f=c(67484),g=c.n(f),h=c(36043),i=c(7122),j=c(61591);let a={M:{text:"text-amber-11",bg:"bg-amber-9/20"},A:{text:"text-green-11",bg:"bg-green-9/20"},D:{text:"text-red-11",bg:"bg-red-9/20"},"?":{text:"text-slate-9",bg:"bg-slate-9/20"},R:{text:"text-blue-11",bg:"bg-blue-9/20"}},l=g().memo(function({item:b,isSelected:c,isExpanded:d,isLoading:g,onSelect:h,onToggle:i,onContextMenu:k,renderActions:l}){let{node:m,level:n,gitStatus:o,hasChangedChildren:p}=b,q=o?a[o]:null,r=(0,f.useCallback)(()=>{m.isDirectory?i(m.path):h(m.path)},[m.isDirectory,m.path,h,i]),s=(0,f.useCallback)(a=>{k(a,m.path,m.isDirectory)},[m.path,m.isDirectory,k]),t=!m.isDirectory&&(".env"===m.name||m.name.startsWith(".env.")),u=o?q.text:p?"text-amber-11":t?"text-yellow-600 dark:text-yellow-500":c&&!m.isDirectory?"text-brand":"text-foreground";return(0,e.jsxs)("div",{className:`flex items-center gap-1.5 py-0.5 px-2 cursor-pointer hover:bg-accent ${c?"bg-brand/10":""}`,style:{paddingLeft:`${12*n+8}px`},onClick:r,onContextMenu:s,children:[m.isDirectory?g?(0,e.jsxs)("svg",{className:"w-4 h-4 flex-shrink-0 text-muted-foreground animate-spin",viewBox:"0 0 16 16",fill:"none",children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",opacity:"0.3"}),(0,e.jsx)("path",{d:"M14 8a6 6 0 0 0-6-6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}):(0,e.jsx)("svg",{className:`w-4 h-4 flex-shrink-0 text-muted-foreground transition-transform ${d?"rotate-90":""}`,viewBox:"0 0 16 16",fill:"none",children:(0,e.jsx)("path",{d:"M6 4 L10 8 L6 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):(0,e.jsx)(j.o,{name:m.name,size:16,className:"flex-shrink-0 ml-4"}),(0,e.jsx)("span",{className:`text-sm truncate flex-1 ${u}`,"data-tooltip":m.isSymlink&&m.symlinkTarget?`${m.path} → ${m.symlinkTarget}`:m.path,children:m.name}),m.isSymlink&&(0,e.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:"→"}),o&&(0,e.jsx)("span",{className:`text-xs font-mono px-1 rounded ${q.text} ${q.bg} flex-shrink-0`,children:o}),m.isDirectory&&p&&(0,e.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-9 flex-shrink-0"}),l?.(m)]})});function k({files:a,selectedPath:b,expandedPaths:c,matchedPaths:d=null,gitStatusMap:g=null,loadingDirs:j,onSelect:m,onToggle:n,cwd:o,shouldScrollToSelected:p=!1,onScrolledToSelected:q,className:r,renderActions:s,onCreateFile:t,onDelete:u,onRefresh:v,onCopyFile:w,onPaste:x}){let y=(0,f.useRef)(null),{contextMenu:z,showContextMenu:A,hideContextMenu:B}=(0,i.Ee)(),C=(0,f.useMemo)(()=>(function a(b,c,d,e=null,f=0){let g=[];for(let h of b){if(null!==d&&!d.has(h.path))continue;let b=e?.get(h.path),i=h.isDirectory?function(a,b){if(!b)return!1;let c=a+"/";for(let a of b.keys())if(a.startsWith(c))return!0;return!1}(h.path,e):void 0;g.push({node:h,level:f,gitStatus:b,hasChangedChildren:i}),h.isDirectory&&h.children&&c.has(h.path)&&g.push(...a(h.children,c,d,e,f+1))}return g})(a,c,d,g),[a,c,d,g]),D=(0,h.Te)({count:C.length,getScrollElement:()=>y.current,estimateSize:()=>26,overscan:10});return((0,f.useRef)(q).current=q,0===C.length)?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:"No files"}):(0,e.jsxs)("div",{ref:y,className:r||"h-full overflow-y-auto",style:{willChange:"transform"},children:[(0,e.jsx)("div",{style:{height:`${D.getTotalSize()}px`,width:"100%",position:"relative"},children:D.getVirtualItems().map(a=>{let d=C[a.index];return(0,e.jsx)("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:`${a.size}px`,transform:`translateY(${a.start}px)`},children:(0,e.jsx)(l,{item:d,isSelected:b===d.node.path,isExpanded:c.has(d.node.path),isLoading:j?.has(d.node.path),onSelect:m,onToggle:n,onContextMenu:A,renderActions:s})},d.node.path)})}),z&&(0,e.jsx)(i.ft,{x:z.x,y:z.y,path:z.path,cwd:o,isDirectory:z.isDirectory,onClose:B,onCreateFile:t,onDelete:u,onRefresh:v,onCopyFile:w,onPaste:x})]})}d()}catch(a){d(a)}})},24943:(a,b,c)=>{"use strict";c.d(b,{NoteModal:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call NoteModal() from the server but NoteModal is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/NoteModal.tsx","NoteModal")},25465:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{ShareReviewToggle:()=>k});var e=c(48249),f=c(67484),g=c(44384),h=c(7833),i=c(33281),j=c(83120);function k({content:a,sourceFile:b}){var c;let d,l,m,n,o,{t:p}=(0,g.Bd)(),[q,r]=(0,f.useState)(null),[s,t]=(0,f.useState)(!0),[u,v]=(0,f.useState)(!1),w=q?.active===!0,x=(0,f.useCallback)(async()=>{v(!0);let c=b.split("/").pop()||b,d=await i.t4.runPromiseExit((0,j.bx)({title:c,content:a,sourceFile:b}));if("Success"!==d._tag||!d.value.review){(0,h.oR)(p("toast.reviewCreateFailed"),"error"),v(!1);return}let e=d.value.review;r({id:e.id,active:!0,updatedAt:e.updatedAt||e.createdAt});let f=await i.t4.runPromiseExit((0,j._c)()),g="Success"===f._tag&&f.value.shareBase?`${f.value.shareBase}/review/${e.id}`:`${window.location.origin}/review/${e.id}`;try{await navigator.clipboard.writeText(g)}catch{}(0,h.oR)(e.existing?p("toast.reviewUpdated"):p("toast.reviewCreated"),"success"),v(!1)},[a,b,p]),y=(0,f.useCallback)(async()=>{if(!q)return;v(!0);let a=await i.t4.runPromiseExit((0,j.Gm)(q.id,{active:!1}));"Success"===a._tag?(r(a=>a?{...a,active:!1}:null),(0,h.oR)(p("toast.sharingClosed"),"success")):(0,h.oR)(p("toast.sharingCloseFailed"),"error"),v(!1)},[q,p]),z=(0,f.useCallback)(()=>{u||(w?y():x())},[u,w,x,y]),A=(0,f.useCallback)(()=>{q&&window.open(`${window.location.origin}/review/${q.id}`,"_blank")},[q]);return s?null:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:z,disabled:u,className:`relative inline-flex h-4 w-7 items-center rounded-full transition-colors ${u?"opacity-50 cursor-wait":"cursor-pointer"} ${w?"bg-green-500":"bg-muted-foreground/30"}`,title:w?p("review.closeSharing"):p("review.enableSharing"),children:(0,e.jsx)("span",{className:`inline-block h-3 w-3 rounded-full bg-white transition-transform ${w?"translate-x-3.5":"translate-x-0.5"}`})}),(0,e.jsx)("span",{className:`text-[11px] ${w?"text-green-600 dark:text-green-400":"text-muted-foreground"}`,children:w?p("review.sharing"):p("review.notShared")}),q&&q.updatedAt&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground",children:(c=q.updatedAt,d=new Date(c),l=String(d.getMonth()+1).padStart(2,"0"),m=String(d.getDate()).padStart(2,"0"),n=String(d.getHours()).padStart(2,"0"),o=String(d.getMinutes()).padStart(2,"0"),`${l}-${m} ${n}:${o}`)}),(0,e.jsx)("button",{onClick:A,className:"text-[11px] text-brand hover:underline",children:p("review.view")})]})]})}d()}catch(a){d(a)}})},25608:(a,b,c)=>{"use strict";c.d(b,{ProjectItem:()=>h});var d=c(48249),e=c(67484),f=c(44384);function g({number:a,isActive:b}){return(0,d.jsxs)("svg",{className:`w-6 h-6 flex-shrink-0 ${b?"text-brand":"text-muted-foreground"}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[(0,d.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4"}),(0,d.jsx)("text",{x:"12",y:"16",textAnchor:"middle",fill:"currentColor",stroke:"none",fontSize:"12",fontWeight:"500",children:a})]})}function h({index:a,name:b,cwd:c,isActive:i,collapsed:j,hasUnread:k,isLoading:l,onClick:m,onRemove:n,onOpenNote:o}){let{t:p}=(0,f.Bd)(),[q,r]=(0,e.useState)(!1);return(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1 rounded-lg cursor-pointer transition-colors relative ${j?"justify-center":""} ${i?"bg-accent text-foreground":"text-muted-foreground hover:bg-secondary hover:text-foreground"}`,onClick:m,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),title:c,children:[(0,d.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,d.jsx)(g,{number:a+1,isActive:i}),k&&!i&&!l&&(0,d.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-red-500"}),l&&(0,d.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-orange-9 animate-pulse"})]}),!j&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"flex-1 truncate text-sm",children:b}),!l&&i?(0,d.jsx)("span",{className:"w-2 h-2 rounded-full bg-brand flex-shrink-0"}):null]}),q&&!j&&(0,d.jsxs)("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5",children:[o&&(0,d.jsx)("button",{className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",onClick:a=>{a.stopPropagation(),o()},title:p("workspace.projectNotes"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,d.jsx)("button",{className:"p-1 rounded hover:bg-red-500/20 text-muted-foreground hover:text-red-500 transition-colors",onClick:a=>{a.stopPropagation(),n()},title:p("workspace.closeProject"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]})}},25667:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{r:()=>j});var e=c(48249),f=c(67484),g=c(90018);c(33281),c(85655);var h=c(17966),i=a([h,g]);function j({cwd:a,filePath:b,oldContent:c,newContent:d,isNew:h=!1,isDeleted:i=!1,changedFiles:k,fileGitStatusMap:l,enableComments:m=!1,onContentSearch:n,headerExtraLeft:o,headerExtraRight:p}){let[q,r]=(0,f.useState)(b),[s,t]=(0,f.useState)(null);return(0,e.jsx)(g.O,{cwd:a,highlightedFilePath:b,changedFiles:k,enableComments:m,qnameFilter:s?.changedQnames,qnameFilterFile:q,accentQnames:s?.changedQnames,accentFile:q,addedLines:s?.addedLines,addedLinesFile:q,onFocalChange:a=>a&&r(a),onContentSearch:n,headerExtraLeft:o,headerExtraRight:p})}[h,g]=i.then?(await i)():i,d()}catch(a){d(a)}})},25702:(a,b,c)=>{"use strict";c.d(b,{Providers:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call Providers() from the server but Providers is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/Providers.tsx","Providers")},28602:(a,b,c)=>{"use strict";function d(){return!("u"<typeof navigator)&&(/Mac|iPhone|iPad/.test(navigator.platform||"")||navigator.userAgentData?.platform==="macOS")}function e(){return d()?"⌘":"Ctrl+"}c.d(b,{L:()=>d,Mu:()=>e}),process.platform,process.platform,process.platform},28797:(a,b,c)=>{"use strict";function d(a){let b=a.split(".").pop()?.toLowerCase();return b?["ts","tsx","js","jsx","mjs","cjs"].includes(b)?"typescript":["py","pyi"].includes(b)?"python":null:null}c.d(b,{c:()=>d})},29412:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{g:()=>m});var e=c(48249),f=c(67484),g=c(7833),h=c(2633),i=c(62751),j=c(33281),k=c(80532),l=a([h]);function m({isOpen:a,onClose:b}){let[c,d]=(0,f.useState)([]),[l,o]=(0,f.useState)(!1),[p,q]=(0,f.useState)(""),[r,s]=(0,f.useState)(!1),[t,u]=(0,f.useState)(""),[v,w]=(0,f.useState)(!1),[x,y]=(0,f.useState)(null),z=(0,f.useCallback)(async()=>{o(!0);let a=await j.t4.runPromiseExit((0,k.Hy)());"Success"===a._tag?d(a.value):console.error("Failed to load skills",a.cause),o(!1)},[]),A=(0,f.useMemo)(()=>{let a=p.trim().toLowerCase();return a?c.filter(b=>b.name.toLowerCase().includes(a)||b.description.toLowerCase().includes(a)||b.path.toLowerCase().includes(a)):c},[c,p]),B=(0,f.useCallback)(async()=>{let a=t.trim();if(!a)return;w(!0);let b=await j.t4.runPromiseExit((0,k.L5)(a));if("Success"===b._tag)(0,g.oR)("Skill added","success"),u(""),s(!1),await z(),(0,i.k)();else{let a="Fail"===b.cause._tag?b.cause.error:null,c=a?.cause,d=c instanceof Error?c.message:"Failed to add skill";(0,g.oR)(d,"error")}w(!1)},[t,z]),C=(0,f.useCallback)(async a=>{let b=await j.t4.runPromiseExit((0,k.hp)(a));"Success"===b._tag?(d(b=>b.filter(b=>b.id!==a)),(0,i.k)()):(0,g.oR)("Failed to delete","error")},[]),D=(0,f.useCallback)(async a=>{try{await navigator.clipboard.writeText(a),(0,g.oR)("Path copied","success")}catch{(0,g.oR)("Failed to copy","error")}},[]);return a?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:b}),(0,e.jsxs)("div",{className:"relative bg-card rounded-lg shadow-xl w-full max-w-3xl h-[80vh] mx-4 flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-foreground",children:"Skills"}),(0,e.jsx)("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:"Close",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("div",{className:"relative flex-1",children:[(0,e.jsxs)("svg",{className:"w-4 h-4 absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"11",cy:"11",r:"7",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-4.35-4.35"})]}),(0,e.jsx)("input",{type:"text",value:p,onChange:a=>q(a.target.value),placeholder:"Search skills...",className:"w-full pl-8 pr-3 py-1.5 text-sm border border-border rounded-md bg-card text-foreground placeholder-slate-9 focus:outline-none focus:ring-2 focus:ring-ring"})]}),(0,e.jsx)("button",{onClick:()=>s(!0),className:"px-3 py-1.5 text-sm rounded-md bg-brand text-white hover:bg-teal-10 active:scale-95 transition-all",children:"+ Add Skill"})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:l?(0,e.jsx)("div",{className:"text-center text-muted-foreground py-8 text-sm",children:"Loading..."}):0===A.length?(0,e.jsx)("div",{className:"text-center text-muted-foreground py-8 text-sm",children:0===c.length?'No skills yet. Click "Add Skill" to add one.':"No skills match your search."}):A.map(a=>(0,e.jsx)(n,{skill:a,onPreview:()=>y(a.id),onDelete:()=>C(a.id),onCopyPath:()=>D(a.path)},a.id))})]})]}),r&&(0,e.jsxs)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:()=>{v||(s(!1),u(""))}}),(0,e.jsxs)("div",{className:"relative bg-card rounded-lg shadow-xl w-full max-w-lg mx-4 p-5",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground mb-3",children:"Add Skill"}),(0,e.jsx)("label",{className:"block text-xs text-muted-foreground mb-1",children:"Absolute path to SKILL.md"}),(0,e.jsx)("input",{type:"text",value:t,onChange:a=>u(a.target.value),onKeyDown:a=>{"Enter"!==a.key||v||B()},placeholder:"/Users/you/.../skills/foo/SKILL.md",autoFocus:!0,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-md bg-card text-foreground placeholder-slate-9 focus:outline-none focus:ring-2 focus:ring-ring"}),(0,e.jsxs)("div",{className:"flex justify-end gap-2 mt-4",children:[(0,e.jsx)("button",{onClick:()=>{s(!1),u("")},disabled:v,className:"px-3 py-1.5 text-sm rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-accent transition-colors disabled:opacity-50",children:"Cancel"}),(0,e.jsx)("button",{onClick:B,disabled:v||!t.trim(),className:"px-3 py-1.5 text-sm rounded-md bg-brand text-white hover:bg-teal-10 transition-colors disabled:opacity-50",children:v?"Adding...":"Add"})]})]})]}),x&&(0,e.jsx)(h.d,{skillId:x,onClose:()=>y(null)})]}):null}function n({skill:a,onPreview:b,onDelete:c,onCopyPath:d}){let[g,h]=(0,f.useState)(!1);return(0,e.jsx)("div",{className:`border border-border rounded-lg p-3 bg-card hover:bg-accent/30 transition-colors ${a.valid?"":"opacity-60"}`,children:(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[(0,e.jsx)("div",{className:"w-9 h-9 flex-shrink-0 flex items-center justify-center rounded-md bg-brand/10 text-brand text-lg",children:a.icon?(0,e.jsx)("span",{children:a.icon}):(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3l1.9 4.8L19 9l-4.1 3.1L16 18l-4-2.8L8 18l1.1-5.9L5 9l5.1-1.2L12 3z"})})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,e.jsxs)("span",{className:"font-mono text-sm font-medium text-foreground",children:["/",a.name]}),a.description&&(0,e.jsx)("span",{className:"text-sm text-muted-foreground line-clamp-2",children:a.description}),!a.valid&&(0,e.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-red-9/15 text-red-11",children:"Invalid"})]}),a.argumentHint&&(0,e.jsx)("div",{className:"font-mono text-xs text-muted-foreground mt-0.5 truncate",children:a.argumentHint}),(0,e.jsx)("div",{className:"flex items-center gap-1 mt-1",children:(0,e.jsx)("button",{onClick:d,className:"text-xs text-muted-foreground hover:text-foreground font-mono truncate text-left",title:"Copy path",children:a.path})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,e.jsx)("button",{onClick:b,disabled:!a.valid,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:"Preview",children:(0,e.jsxs)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})}),g?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{onClick:()=>{h(!1),c()},className:"px-2 py-1 text-xs rounded bg-red-9 text-white hover:bg-red-10",children:"Confirm"}),(0,e.jsx)("button",{onClick:()=>h(!1),className:"px-2 py-1 text-xs rounded border border-border text-muted-foreground hover:text-foreground",children:"Cancel"})]}):(0,e.jsx)("button",{onClick:()=>h(!0),className:"p-1.5 text-muted-foreground hover:text-red-11 hover:bg-red-9/10 rounded transition-colors",title:"Delete",children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6M1 7h22M9 7V4a1 1 0 011-1h4a1 1 0 011 1v3"})})})]})]})})}h=(l.then?(await l)():l)[0],d()}catch(a){d(a)}})},29491:(a,b,c)=>{"use strict";c.d(b,{I18nProvider:()=>g});var d=c(48249);c(67484);var e=c(44384),f=c(208);function g({children:a}){return(0,d.jsx)(e.xC,{i18n:f.A,children:a})}c(33281),c(65484)},29939:(a,b,c)=>{"use strict";c.d(b,{h:()=>g});var d=c(67484),e=c(88055),f=c(21586);function g({url:a,onMessage:b,enabled:c=!0}){(0,d.useRef)(b)}e.EV(f.YA(1),1.5).pipe(e.gP(e.ji(f.YA(10))),e.y$(e.t5(10))),e.EV(f.ne(200),2).pipe(e.gP(e.ji(f.YA(5))),e.y$(e.t5(5))),e.EV(f.YA(1),2).pipe(e.et,e.gP(e.ji(f.YA(30))),e.y$(e.t5(8))),e.ji(f.YA(30)),e.ji(f.YA(1)),e.ji(f.YA(30)),f.ne(50),e.BW},30337:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,15098,23)),Promise.resolve().then(c.t.bind(c,47644,23)),Promise.resolve().then(c.t.bind(c,33859,23)),Promise.resolve().then(c.t.bind(c,98099,23)),Promise.resolve().then(c.t.bind(c,16237,23)),Promise.resolve().then(c.t.bind(c,98562,23)),Promise.resolve().then(c.t.bind(c,36675,23))},30458:(a,b,c)=>{"use strict";c.d(b,{E:()=>j});var d=c(48249),e=c(67484),f=c(44384),g=c(208),h=c(28602);let i={once:[{labelKey:"scheduledTasks.5minLater",value:5},{labelKey:"scheduledTasks.15minLater",value:15},{labelKey:"scheduledTasks.30minLater",value:30},{labelKey:"scheduledTasks.1hourLater",value:60}],interval:[{labelKey:"scheduledTasks.every15min",value:15},{labelKey:"scheduledTasks.every30min",value:30},{labelKey:"scheduledTasks.every1hour",value:60},{labelKey:"scheduledTasks.every2hours",value:120}],cron:[{labelKey:"scheduledTasks.daily9am",value:"0 9 * * *"},{labelKey:"scheduledTasks.daily6pm",value:"0 18 * * *"},{labelKey:"scheduledTasks.weeklyMon9am",value:"0 9 * * 1"},{labelKey:"scheduledTasks.monthly1st9am",value:"0 9 1 * *"}]};function j({onClose:a,onCreate:b,editTask:c,onUpdate:k}){let{t:l}=(0,f.Bd)(),m=!!c,[n,o]=(0,e.useState)(c?.type||"once"),[p,q]=(0,e.useState)(c?.message||""),[r,s]=(0,e.useState)(c?String(c.delayMinutes||c.intervalMinutes||""):""),[t,u]=(0,e.useState)(c?.cron||""),[v,w]=(0,e.useState)(c?.activeFrom||"09:00"),[x,y]=(0,e.useState)(c?.activeTo||"18:00"),[z,A]=(0,e.useState)(!!(c?.activeFrom&&c?.activeTo)),[B,C]=(0,e.useState)(null),D=(0,e.useRef)(null),E=(0,e.useRef)(null),F=(0,e.useCallback)(()=>{if(!p.trim())return;let d=null;if("once"===n){let a=B||parseInt(r,10);if(!a||a<=0)return;d={message:p.trim(),type:"once",delayMinutes:a}}else if("interval"===n){let a=B||parseInt(r,10);if(!a||a<=0)return;d={message:p.trim(),type:"interval",intervalMinutes:a,...z?{activeFrom:v,activeTo:x}:{}}}else if("cron"===n){let a=B||t.trim();if(!a)return;d={message:p.trim(),type:"cron",cron:a}}d&&(m&&c&&k?k(c.id,d):b(d),a())},[p,n,B,r,t,z,v,x,b,a,m,c,k]);return(0,d.jsxs)("div",{ref:D,className:`w-80 bg-popover border border-border rounded-lg shadow-lg z-50 ${m?"":"absolute bottom-full left-0 mb-2"}`,onKeyDown:b=>{"Escape"===b.key?a():"Enter"===b.key&&(b.metaKey||b.ctrlKey)&&F()},children:[(0,d.jsx)("div",{className:"px-3 py-2 border-b border-border bg-muted/50 rounded-t-lg",children:(0,d.jsx)("span",{className:"text-sm font-medium",children:m?l("scheduledTasks.editTask"):l("scheduledTasks.createTask")})}),(0,d.jsxs)("div",{className:"p-3 space-y-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:l("scheduledTasks.sendMessage")}),(0,d.jsx)("textarea",{ref:E,value:p,onChange:a=>q(a.target.value),placeholder:l("scheduledTasks.messagePlaceholder"),rows:2,className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card text-foreground placeholder-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring resize-none"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:l("scheduledTasks.type")}),(0,d.jsx)("div",{className:"flex gap-1",children:["once","interval","cron"].map(a=>(0,d.jsx)("button",{onClick:()=>{o(a),C(null),s(""),u("")},className:`flex-1 px-2 py-1 text-xs rounded transition-colors ${n===a?"bg-brand text-white":"bg-muted text-muted-foreground hover:text-foreground"}`,children:"once"===a?l("scheduledTasks.once"):"interval"===a?l("scheduledTasks.interval"):"Cron"},a))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:l("scheduledTasks.quickSelect")}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-1",children:i[n].map(a=>(0,d.jsx)("button",{onClick:()=>{C(a.value),"cron"===n?u(String(a.value)):s(String(a.value))},className:`px-2 py-1 text-xs rounded border transition-colors ${B===a.value?"border-brand bg-brand/10 text-brand":"border-border text-muted-foreground hover:text-foreground hover:border-foreground/30"}`,children:l(a.labelKey)},a.labelKey))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:"cron"===n?l("scheduledTasks.customCron"):l("scheduledTasks.customMinutes")}),"cron"===n?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{type:"text",value:t,onChange:a=>{u(a.target.value),C(null)},placeholder:l("scheduledTasks.cronPlaceholder"),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card text-foreground placeholder-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring font-mono"}),t.trim()&&(0,d.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:function(a){let b=g.A.t,c=a.trim().split(/\s+/);if(5!==c.length)return null;let[d,e,f,h,i]=c,j={0:b("cron.dowSun"),1:b("cron.dowMon"),2:b("cron.dowTue"),3:b("cron.dowWed"),4:b("cron.dowThu"),5:b("cron.dowFri"),6:b("cron.dowSat")},k={1:`1${b("cron.monthPrefix")}`,2:`2${b("cron.monthPrefix")}`,3:`3${b("cron.monthPrefix")}`,4:`4${b("cron.monthPrefix")}`,5:`5${b("cron.monthPrefix")}`,6:`6${b("cron.monthPrefix")}`,7:`7${b("cron.monthPrefix")}`,8:`8${b("cron.monthPrefix")}`,9:`9${b("cron.monthPrefix")}`,10:`10${b("cron.monthPrefix")}`,11:`11${b("cron.monthPrefix")}`,12:`12${b("cron.monthPrefix")}`};try{let a="";if(d.includes("/")||e.includes("/")){if("*"===e&&d.includes("/"))return b("cron.everyNMinutes",{n:d.split("/")[1]});if("0"===d&&e.includes("/"))return b("cron.everyNHours",{n:e.split("/")[1]});return null}let c=parseInt(e,10),g=parseInt(d,10);if(isNaN(c)&&"*"!==e||isNaN(g)&&"*"!==d)return null;a="*"===e&&"*"===d?b("cron.everyMinute"):"*"===e?b("cron.everyHourAtMin",{m:g}):"*"===d?b("cron.hourlyEveryMin",{h:c}):`${String(c).padStart(2,"0")}:${String(g).padStart(2,"0")}`;let l=[];if("*"!==h){let a=h.split(",").map(a=>k[a]||`${a}${b("cron.monthPrefix")}`);l.push(a.join(", "))}if("*"!==f)if(f.includes("-")){let[a,c]=f.split("-");l.push(b("cron.dayRange",{a,b:c}))}else f.includes(",")?l.push(f.split(",").map(a=>`${a}${b("cron.dayOfMonth")}`).join(", ")):l.push(`${f}${b("cron.dayOfMonth")}`);if("*"!==i)if("1-5"===i)l.push(b("cron.weekdays"));else if("0,6"===i||"6,0"===i)l.push(b("cron.weekends"));else{let a=i.split(",").map(a=>{if(a.includes("-")){let[c,d]=a.split("-");return b("cron.weekdayRange",{a:j[c]||c,b:j[d]||d})}return`${b("cron.weekdayPrefix")}${j[a]||a}`});l.push(a.join(", "))}if(0===l.length&&"*"===f&&"*"===h&&"*"===i)return b("cron.daily",{time:a});return`${l.join(" ")} ${a}`}catch{return null}}(t.trim())||(0,d.jsx)("span",{className:"text-destructive",children:l("scheduledTasks.cronFormat")})})]}):(0,d.jsx)("input",{type:"number",value:r,onChange:a=>{s(a.target.value),C(null)},placeholder:l("scheduledTasks.minutesPlaceholder"),min:1,className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card text-foreground placeholder-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]}),"interval"===n&&(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground mb-1 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox",checked:z,onChange:a=>A(a.target.checked),className:"rounded border-border"}),l("scheduledTasks.limitTimeRange")]}),z&&(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,d.jsx)("input",{type:"time",value:v,onChange:a=>w(a.target.value),className:"flex-1 px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:l("scheduledTasks.to")}),(0,d.jsx)("input",{type:"time",value:x,onChange:a=>y(a.target.value),className:"flex-1 px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]})]}),(0,d.jsx)("button",{onClick:F,disabled:!(p.trim()&&("once"===n||"interval"===n?!!(B||r&&parseInt(r,10)>0):"cron"===n&&!!(B||t.trim()))),className:"w-full py-1.5 text-sm font-medium rounded bg-brand text-white hover:bg-brand/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:m?l("scheduledTasks.saveBtn",{modKey:(0,h.Mu)()}):l("scheduledTasks.createBtn",{modKey:(0,h.Mu)()})})]})]})}},30894:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{j:()=>a});var e=c(48249),f=c(67484),g=c(44384),h=c(7833);let a=(0,f.memo)(function({shortId:a,type:b,onRegister:c,onUnregister:d}){let{t:i}=(0,g.Bd)(),[j,k]=(0,f.useState)(!1),l=(0,f.useCallback)(async e=>{if(e.stopPropagation(),j)await d(),k(!1),(0,h.oR)(i("toast.disconnected",{id:a}));else{await c(),k(!0);let d=`cock ${b} ${a}`;navigator.clipboard.writeText(d),(0,h.oR)(i("toast.copiedCommand",{command:d}))}},[j,a,b,c,d,i]);return(0,e.jsxs)("button",{onClick:l,className:"inline-flex items-center gap-1 text-[10px] font-mono leading-none px-1.5 py-0.5 rounded flex-shrink-0 transition-colors bg-muted/60 hover:bg-muted text-muted-foreground",title:j?i("shortIdBadge.clickToDisconnect"):i("shortIdBadge.clickToRegister"),children:[(0,e.jsx)("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${j?"bg-green-500":"bg-muted-foreground/40"}`}),a]})});d()}catch(a){d(a)}})},32459:(a,b,c)=>{"use strict";c.d(b,{e:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({currentCwd:a,onSwitchProject:b,collapsed:c,sessions:h}){let{t:i}=(0,f.Bd)(),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(0),n=(0,e.useRef)(null),o=(0,e.useCallback)(a=>{b(a.cwd,a.sessionId),k(!1)},[b]),p=h.filter(a=>"loading"===a.status).length,q=h.filter(a=>"unread"===a.status).length,r=(0,e.useCallback)(a=>{let b=Math.floor((l-a)/6e4);if(b<1)return i("common.justNow");if(b<60)return i("common.minutesAgo",{count:b});let c=Math.floor(b/60);return c<24?i("common.hoursAgo",{count:c}):i("common.daysAgo",{count:Math.floor(c/24)})},[i,l]);return(0,d.jsxs)("div",{className:"relative",ref:n,children:[(0,d.jsxs)("button",{onClick:()=>{m(Date.now()),k(!j)},className:`relative flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${c?"w-full justify-center":"w-full"}`,title:i("sessions.recentSessions"),children:[(0,d.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),!c&&(0,d.jsx)("span",{className:"text-sm flex-1 text-left",children:i("sessions.recentSessions")}),p>0&&(0,d.jsx)("span",{className:`min-w-[18px] h-[18px] px-1 text-white text-xs font-medium rounded-full flex items-center justify-center bg-orange-9 animate-pulse ${c?"absolute -top-1 -right-1":""}`,children:p}),q>0&&(0,d.jsx)("span",{className:`min-w-[18px] h-[18px] px-1 text-white text-xs font-medium rounded-full flex items-center justify-center bg-red-500 ${c&&!p?"absolute -top-1 -right-1":""}`,children:q})]}),j&&(0,d.jsxs)("div",{className:"absolute left-full bottom-0 ml-2 w-80 h-[450px] bg-popover border border-border rounded-lg shadow-lg z-50 flex flex-col",children:[(0,d.jsxs)("div",{className:"px-3 py-2 border-b border-border bg-muted/50 flex-shrink-0 rounded-t-lg",children:[(0,d.jsx)("span",{className:"text-sm font-medium",children:i("sessions.recentSessions")}),p>0&&(0,d.jsxs)("span",{className:"ml-2 text-xs text-orange-11",children:["(",i("sessions.runningCount",{count:p}),")"]}),q>0&&(0,d.jsxs)("span",{className:"ml-2 text-xs text-red-500",children:["(",i("sessions.unreadCount",{count:q}),")"]})]}),(0,d.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:0===h.length?(0,d.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:i("sessions.noSessions")}):h.map((b,c)=>{let e;return(0,d.jsxs)("button",{onClick:()=>o(b),className:`w-full px-3 py-2 text-left hover:bg-accent transition-colors flex items-start gap-2 ${c!==h.length-1?"border-b border-border/50":""} ${a===b.cwd?"bg-accent/50":""}`,children:[(0,d.jsx)("span",{className:`mt-1.5 w-2 h-2 rounded-full flex-shrink-0 ${"loading"===b.status?"bg-orange-9 animate-pulse":"unread"===b.status?"bg-red-500":"bg-muted-foreground/30"}`}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",title:b.cwd,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"font-medium text-sm truncate",children:(e=b.cwd).split("/").pop()||e}),"loading"===b.status&&(0,d.jsx)("span",{className:"text-xs text-orange-11 flex-shrink-0",children:i("sessions.running")}),"unread"===b.status&&(0,d.jsx)("span",{className:"text-xs text-red-500 flex-shrink-0",children:i("sessions.done")}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:r(b.lastActive)})]}),(b.lastUserMessage||b.title)&&(0,d.jsx)("div",{className:"text-xs text-foreground/80 truncate",children:b.lastUserMessage||b.title})]})]},`${b.cwd}-${b.sessionId}`)})})]})]})}},32465:(a,b,c)=>{"use strict";c.d(b,{Y:()=>m});var d=c(48249),e=c(67484),f=c(44384),g=c(76592),h=c(46674),i=c(59347),j=c(24520),k=c(33281),l=c(23328);function m({onClose:a,onSave:b}){let{t:c}=(0,f.Bd)(),[n,o]=(0,e.useState)({}),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)(!0);(0,e.useCallback)(async()=>{u(!0);let a=await k.t4.runPromiseExit((0,l.Jn)());"Success"===a._tag?o(a.value):console.error("Failed to load aliases:",a.cause),u(!1)},[]);let v=()=>{p.trim()&&r.trim()&&(o(a=>({...a,[p.trim()]:r.trim()})),q(""),s(""))},w=async()=>{let c=await k.t4.runPromiseExit((0,l.cv)(n));"Success"===c._tag?(b(n),a()):console.error("Failed to save aliases:",c.cause)};return(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center z-50",children:(0,d.jsxs)("div",{className:"bg-background border border-border rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] flex flex-col m-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,d.jsx)(g.A,{className:"w-5 h-5"}),c("aliasManager.title")]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:c("aliasManager.description")})]}),(0,d.jsx)("button",{onClick:a,className:"p-1 rounded hover:bg-accent transition-colors",children:(0,d.jsx)(h.A,{className:"w-5 h-5"})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:t?(0,d.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground",children:c("common.loading")}):(0,d.jsxs)("div",{className:"space-y-3",children:[Object.entries(n).map(([a,b])=>(0,d.jsxs)("div",{className:"flex items-start gap-2 group",children:[(0,d.jsxs)("div",{className:"flex-1 grid grid-cols-2 gap-2",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-sm",children:"$"}),(0,d.jsx)("input",{type:"text",value:a,disabled:!0,className:"w-full pl-7 pr-3 py-2 rounded-lg border border-input bg-muted text-sm font-mono"})]}),(0,d.jsx)("input",{type:"text",value:b,onChange:b=>{var c;return c=b.target.value,void o(b=>({...b,[a]:c}))},placeholder:c("aliasManager.fullCommandPlaceholder"),className:"w-full px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent"})]}),(0,d.jsx)("button",{onClick:()=>{o(b=>{let c={...b};return delete c[a],c})},className:"p-2 rounded-lg text-destructive hover:bg-destructive/10 transition-colors opacity-0 group-hover:opacity-100",children:(0,d.jsx)(i.A,{className:"w-4 h-4"})})]},a)),(0,d.jsxs)("div",{className:"flex items-start gap-2 pt-2 border-t border-border",children:[(0,d.jsxs)("div",{className:"flex-1 grid grid-cols-2 gap-2",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-sm",children:"$"}),(0,d.jsx)("input",{type:"text",value:p,onChange:a=>q(a.target.value),placeholder:c("aliasManager.aliasPlaceholder"),className:"w-full pl-7 pr-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent",onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),v())}})]}),(0,d.jsx)("input",{type:"text",value:r,onChange:a=>s(a.target.value),placeholder:c("aliasManager.commandPlaceholder"),className:"w-full px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent",onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),v())}})]}),(0,d.jsx)("button",{onClick:v,disabled:!p.trim()||!r.trim(),className:"p-2 rounded-lg bg-brand text-brand-foreground hover:bg-brand/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:(0,d.jsx)(j.A,{className:"w-4 h-4"})})]}),(0,d.jsxs)("div",{className:"mt-4 p-3 bg-accent rounded-lg",children:[(0,d.jsxs)("p",{className:"text-sm text-muted-foreground",children:[(0,d.jsx)("strong",{children:c("aliasManager.usage")}),c("aliasManager.usageDesc")]}),(0,d.jsxs)("div",{className:"mt-2 space-y-1 text-xs text-muted-foreground",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"$ ll"}),(0,d.jsx)("span",{children:"→"}),(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"ls -la"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"$ gs"}),(0,d.jsx)("span",{children:"→"}),(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"git status"})]})]})]}),0===Object.keys(n).length&&(0,d.jsx)("div",{className:"text-center py-8 text-muted-foreground text-sm",children:c("aliasManager.noAliases")})]})}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[(0,d.jsx)("button",{onClick:a,className:"px-4 py-2 rounded-lg text-sm hover:bg-accent transition-colors",children:c("common.cancel")}),(0,d.jsx)("button",{onClick:w,className:"px-4 py-2 rounded-lg text-sm bg-brand text-brand-foreground hover:bg-brand/90 transition-colors",children:c("common.save")})]})]})})}},32580:(a,b,c)=>{"use strict";function d(a,b){let c=a.split("\n"),d=b.split("\n"),e=[],f=c.length,g=d.length,h=Array(f+1).fill(null).map(()=>Array(g+1).fill(0));for(let a=1;a<=f;a++)for(let b=1;b<=g;b++)c[a-1]===d[b-1]?h[a][b]=h[a-1][b-1]+1:h[a][b]=Math.max(h[a-1][b],h[a][b-1]);let i=f,j=g,k=[];for(;i>0||j>0;)i>0&&j>0&&c[i-1]===d[j-1]?(k.push({type:"unchanged",content:c[i-1],oldLineNum:i,newLineNum:j}),i--,j--):j>0&&(0===i||h[i][j-1]>=h[i-1][j])?(k.push({type:"added",content:d[j-1],newLineNum:j}),j--):(k.push({type:"removed",content:c[i-1],oldLineNum:i}),i--);for(;k.length>0;)e.push(k.pop());return e}c.d(b,{X:()=>d})},33281:(a,b,c)=>{"use strict";c.d(b,{t4:()=>G});var d=c(95753),e=c(88512),f=c(79606),g=c(28582),h=c(61808);let i=d.Um(h.j9,h.dl((a=>{switch((a??"").toLowerCase()){case"all":return g.u8;case"trace":return g.Cn;case"debug":return g.y;case"info":default:return g.R2;case"warning":case"warn":return g.N5;case"error":return g.$D;case"fatal":return g.Lj;case"none":return g.NV}})(process.env.COCKPIT_LOG_LEVEL)));var j=c(1239),k=c(69063);let l=globalThis,m=l.__cockpitSpanRing??={buffer:[],index:new Map},n=a=>{let b="abcdef0123456789",c="";for(let d=0;d<a;d++)c+=b.charAt(Math.floor(Math.random()*b.length));return c};class o{constructor(a,b,c,d,e,f){this.name=a,this.parent=b,this.context=c,this.startTime=e,this.kind=f,this._tag="Span",this.sampled=!0,this.attributes=new Map,this.events=[],this.traceId=j.Ru(b)?b.value.traceId:n(32),this.spanId=n(16),this.status={_tag:"Started",startTime:e},this.links=Array.from(d),function(a){if(m.buffer.push(a),m.index.set(a.spanId,m.buffer.length-1),m.buffer.length>500){m.buffer.shift(),m.index.clear();for(let a=0;a<m.buffer.length;a++)m.index.set(m.buffer[a].spanId,a)}}(function(a,b,c,d,e,f){return{traceId:b,spanId:a,parentSpanId:c,name:d,kind:e,startTimeNs:f.toString(),endTimeNs:null,durationMs:null,attributes:{},events:[],status:"started"}}(this.spanId,this.traceId,function(a){return j.Ru(a)?a.value.spanId:null}(b),a,f,e))}end(a,b){this.status={_tag:"Ended",endTime:a,exit:b,startTime:this.status.startTime},function(a,b,c){let d=m.index.get(a);if(void 0===d)return;let e=m.buffer[d];if(!e)return;let f=Number(b-BigInt(e.startTimeNs))/1e6;m.buffer[d]={...e,endTimeNs:b.toString(),durationMs:Math.round(100*f)/100,status:"Success"===c._tag?"ok":"error",errorMessage:"Failure"===c._tag?function(a){if(a instanceof Error)return a.message;if("string"==typeof a)return a;try{return JSON.stringify(a)}catch{return String(a)}}(c.cause):void 0}}(this.spanId,a,"Success"===b._tag?{_tag:"Success"}:{_tag:"Failure",cause:b.cause})}attribute(a,b){this.attributes.set(a,b),function(a,b,c){let d=m.index.get(a);if(void 0===d)return;let e=m.buffer[d];e&&(m.buffer[d]={...e,attributes:{...e.attributes,[b]:c}})}(this.spanId,a,b)}event(a,b,c){this.events.push([a,b,c??{}]),function(a,b,c,d){let e=m.index.get(a);if(void 0===e)return;let f=m.buffer[e];f&&(m.buffer[e]={...f,events:[...f.events,{name:b,timeNs:c.toString(),attributes:d}]})}(this.spanId,a,b,c)}addLinks(a){this.links.push(...a)}}let p=k.L8({span:(a,b,c,d,e,f)=>new o(a,b,c,d,e,f),context:a=>a()}),q=d.Py(k.sh,p);d.Ie;var r=c(66473);let s=r.eu("dev","prod")("COCKPIT_ENV").pipe(r.IQ("prod")),t=r.Yj("COCKPIT_HOST").pipe(r.IQ("127.0.0.1")),u=r.nd("COCKPIT_PORT").pipe(r.NW(()=>r.nd("PORT")),r.IQ(3457)),v=r.uK(r.Yj("COCKPIT_OPEN_PROJECT")).pipe(r.Tj(a=>"Some"===a._tag?a.value:void 0)),w=r.zM("COCKPIT_NO_OPEN").pipe(r.IQ(!1)),x=r.Yj("COCKPIT_LOG_LEVEL").pipe(r.IQ("info")),y=r.uK(r.Yj("COCKPIT_DIR"));f.gen(function*(){let a=yield*s,b=yield*t,c=yield*u,d=yield*v,e=yield*w,g=yield*x,h=yield*y,i=yield*f.sync(()=>{if("Some"===h._tag)return h.value;let a="u">typeof process?process.env:void 0;return(a?.HOME||a?.USERPROFILE||".")+"/.cockpit"});return{env:a,host:b,port:3457===c&&"dev"===a?3456:c,cockpitDir:i,openProject:d,openBrowser:!e,logLevel:g,logFile:i+"/logs/cockpit.log"}}).pipe(f.orDie);let z=d.Ie;var A=c(7846),B=c(55805),C=c(23734);let D=d.P1(C.d,f.gen(function*(){let a=yield*A.dT();return yield*f.acquireRelease(f.sync(()=>b=>{f.runFork(A.mk(a,b))}),a=>f.sync(()=>{})),C.d.of({publish:(a,b)=>f.sync(()=>{}),subscribe:b=>B.qdp(a).pipe(B.pbD(a=>{var c;return c=a.data,!!c&&"object"==typeof c&&(c.topic===b.id||c.type===b.legacyType)}),B.TjK(a=>((a,b)=>{if(a.topic===b.id)return a.msg;let{type:c,...d}=a;return d})(a.data,b)))})})),E=d.Um(i,q,z),F=d.Um(E,D),G=e.L8(F);f.void},33988:(a,b,c)=>{"use strict";c.d(b,{B:()=>f});var d=c(67484);c(57031),c(88214);var e=c(76334);function f(a,b,c){let f=(0,d.useMemo)(()=>(0,e.p)(a),[a]),[g,h]=(0,d.useState)(!1),i=(0,d.useRef)(null);(0,d.useRef)([]),(0,d.useRef)(null),(0,d.useRef)(!1),(0,d.useRef)(c);let j=(0,d.useRef)([]);(0,d.useCallback)(a=>{let c=b.current;if(!c?.contentWindow){let b=i.current;b&&b.readyState===WebSocket.OPEN&&b.send(JSON.stringify({type:"browser:cmd-result",reqId:a.reqId,ok:!1,error:"iframe not available (page may be sleeping)"}));return}c.contentWindow.postMessage({type:"cockpit:cmd",reqId:a.reqId,action:a.action,params:a.params},"*")},[b]);let k=(0,d.useCallback)(()=>g&&i.current?.readyState===WebSocket.OPEN?Promise.resolve():new Promise(a=>{j.current.push(a),g||h(!0)}),[g]);return{shortId:f,connected:g,connect:k,disconnect:(0,d.useCallback)(()=>{h(!1)},[])}}},34001:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{NoteModal:()=>z});var e=c(48249),f=c(67484),g=c(44384),h=c(208),i=c(13191),j=c(63831),k=c(19043),l=c(48197),m=c(9731),n=c(44551),o=c(53116),p=c(16512),q=c(6993),r=c(11537),s=c(73555),t=c(19545),u=c(92451),v=c(83179),w=c(33281),x=c(79606),y=c(65484);function z({isOpen:a,onClose:b,projectCwd:c,projectName:d}){let{t:A}=(0,g.Bd)(),[B,C]=(0,f.useState)(!0),[D,E]=(0,f.useState)(!1),F=(0,f.useRef)(null),G=(0,f.useRef)(!1),[H,I]=(0,f.useState)(null),J=(0,f.useRef)(null),K=(0,f.useCallback)(async a=>{E(!0);let b=await w.t4.runPromiseExit((0,y.Cq)(c,a).pipe(x.tapError(a=>x.sync(()=>console.error("Failed to save note:",a)))));"Success"===b._tag&&(G.current=!1),E(!1)},[c]),L=(0,f.useCallback)(a=>{G.current=!0,F.current&&clearTimeout(F.current),F.current=setTimeout(()=>{K(a)},5e3)},[K]),M=(0,i.hG)({immediatelyRender:!1,extensions:[j.A.configure({heading:{levels:[1,2,3]}}),k.A.configure({placeholder:()=>h.A.t("editor.placeholder")}),l.XI.configure({resizable:!0}),m.H,n.n,o.A,p._,r.Ay.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"tiptap-link",target:"_blank",rel:"noopener noreferrer"}}),q.L.configure({nested:!0}),s.o.configure({html:!0,transformCopiedText:!0,transformPastedText:!0})],editorProps:{attributes:{class:"tiptap-editor focus:outline-none min-h-[60vh] px-6 py-4"},handleClick:(a,b,c)=>{if(c.metaKey||c.ctrlKey){let c=a.state.doc.resolve(b).marks().find(a=>"link"===a.type.name)?.attrs;if(c?.href)return window.open(c.href,"_blank","noopener,noreferrer"),!0}return!1},handleKeyDown:(a,b)=>{if("Backspace"===b.key&&N.current){let a=N.current;if(a.isActive("codeBlock")){let{$from:b}=a.state.selection,c=b.node(b.depth);if("codeBlock"===c.type.name&&""===c.textContent)return a.chain().focus().toggleCodeBlock().run(),!0}}return"/"!==b.key||H||setTimeout(()=>{if(!N.current)return;let{from:a}=N.current.state.selection,b=N.current.state.doc.textBetween(Math.max(0,a-1),a,"\n");if("/"===b){J.current=a;let b=N.current.view.coordsAtPos(a);I({query:"",position:{top:b.bottom+4,left:b.left}})}},0),!1}},onUpdate:({editor:a})=>{let b=(0,t.up)(a);if(L(b),null!==J.current){let{from:b}=a.state.selection;if(b<J.current)I(null),J.current=null;else{let c=a.state.doc.textBetween(J.current,b,"\n");c.includes(" ")||c.includes("\n")?(I(null),J.current=null):I(a=>a?{...a,query:c}:null)}}}}),N=(0,f.useRef)(M),O=(0,f.useCallback)(()=>{if(F.current&&(clearTimeout(F.current),F.current=null),G.current&&M){let a=(0,t.up)(M);K(a)}I(null),J.current=null,b()},[M,K,b]);return a?(0,e.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:O}),(0,e.jsxs)("div",{className:"relative bg-card rounded-lg shadow-xl w-full max-w-6xl h-[90vh] mx-4 flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-foreground",children:d?A("editor.noteTitle",{name:d}):A("editor.noteUntitled")}),D&&(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:A("editor.saving")})]}),(0,e.jsx)("button",{onClick:O,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)(v.NoteToolbar,{editor:M}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto",children:B?(0,e.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:(0,e.jsx)("span",{children:A("common.loading")})}):(0,e.jsx)(i.$Z,{editor:M})})]}),H&&M&&(0,e.jsx)(u.U,{editor:M,query:H.query,position:H.position,onClose:()=>{I(null),J.current=null}})]}):null}d()}catch(a){d(a)}})},34102:(a,b,c)=>{"use strict";c.d(b,{B:()=>g});var d=c(48249),e=c(67484),f=c(74429);function g(){let[a,b]=(0,e.useState)(null);(0,e.useRef)(null).current=a,(0,e.useRef)(null);let c=(0,e.useRef)(null),[g,h]=(0,e.useState)({left:0,top:0}),[i,j]=(0,e.useState)(!1);return i&&a?(0,f.createPortal)((0,d.jsx)("div",{ref:c,className:"fixed z-[9999] px-2 py-1 bg-popover text-popover-foreground text-xs font-mono rounded shadow-lg border border-brand whitespace-nowrap pointer-events-none max-w-[80vw] overflow-hidden text-ellipsis",style:{left:g.left,top:g.top},children:a.text}),document.body):null}},35208:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{xU:()=>z,xZ:()=>y});var e=c(48249),f=c(67484),g=c(74429),h=c(44384),i=c(36043),j=c(74754),k=c(91579),l=c(7122),m=c(7031),n=c(42140),o=c(32580),p=c(73414),q=c(7833),r=c(38896),s=c(36984),t=c(74542),u=c(41051),v=c(70596),w=a([r,s]);function x(a){return a.params?`${a.name}(${a.params.join(", ")})`:a.name}[r,s]=w.then?(await w)():w;let A=(0,f.memo)(function({floatingToolbarRef:a,bumpRef:b,container:c,onAddComment:d,onSendToAI:g,onSearch:h,isChatLoading:i}){let[j,k]=(0,f.useState)(0),l=(0,f.useMemo)(()=>a.current,[j]);return(0,e.jsx)(u.w,{x:l?.x??0,y:l?.y??0,visible:!!l,container:c,onAddComment:d,onSendToAI:g,onSearch:h,isChatLoading:i})});function y({oldContent:a,newContent:b,filePath:c,isNew:d=!1,isDeleted:u=!1,cwd:w,enableComments:z=!1,onPreview:B,previewLabel:C,onContentSearch:D,targetLine:E,compact:F=!1,symbols:G}){let{t:H}=(0,h.Bd)(),I=C??H("common.preview"),J=(0,f.useMemo)(()=>(0,o.X)(a,b),[a,b]),K=(0,f.useRef)(null),L=(0,f.useRef)(null),M=(0,f.useRef)(null);(0,f.useRef)(!1);let[N,O]=(0,f.useState)(!1),P=(0,l.iN)(),Q=(0,m.r)(),R=z&&!!w,{comments:S,addComment:T,updateComment:U,deleteComment:V,refresh:W}=(0,j._)({cwd:w||"",filePath:c}),[X,Y]=(0,f.useState)(null),Z=(0,f.useRef)(null),$=(0,f.useRef)(()=>{}),[_,aa]=(0,f.useState)(null),[ab,ac]=(0,f.useState)(null),ad=(0,f.useMemo)(()=>{let a=new Set;for(let b of S)for(let c=b.startLine;c<=b.endLine;c++)a.add(c);return a},[S]),ae=(0,f.useMemo)(()=>{let a=new Map;for(let b of S){let c=b.endLine;a.has(c)||a.set(c,[]),a.get(c).push(b)}return a},[S]),af=(0,f.useCallback)((a,b)=>{b.stopPropagation(),Y({comment:a,x:b.clientX,y:b.clientY}),Z.current=null,$.current(),aa(null),ac(null)},[]),ag=(0,f.useCallback)(()=>{let a=Z.current;a&&(aa({x:a.x,y:a.y,range:a.range,codeContent:a.codeContent}),Z.current=null,$.current())},[]),ah=(0,f.useCallback)(()=>{let a=Z.current;a&&(ac({x:a.x,y:a.y,range:a.range,codeContent:a.codeContent}),Z.current=null,$.current())},[]),ai=(0,f.useCallback)(()=>{let a=Z.current;if(!a||!D)return;let b=a.codeContent.trim();Z.current=null,$.current(),b&&D(b)},[D]),aj=(0,f.useCallback)(async a=>{if(ab&&Q&&w)try{let b=await (0,k.$3)(w),d=[];for(let a of b)d.push({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0});d.push({filePath:c,startLine:ab.range.start,endLine:ab.range.end,codeContent:ab.codeContent});let e=(0,k.Gw)(d,a);Q.sendMessage(e),await (0,k.RP)(w),W(),ac(null)}catch(a){console.error("Failed to send to AI:",a)}},[ab,Q,c,w,W]),ak=(0,f.useCallback)(async a=>{_&&(await T(_.range.start,_.range.end,a),aa(null))},[_,T]),{leftLines:al,rightLines:am}=(0,f.useMemo)(()=>{let a=[],b=[],c=0,d=0;for(let e=0;e<J.length;e++){let f=J[e];if("unchanged"===f.type){for(;a.length<b.length;)a.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});for(;b.length<a.length;)b.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});c++,d++,a.push({lineNum:c,content:f.content,type:"unchanged",originalIdx:e}),b.push({lineNum:d,content:f.content,type:"unchanged",originalIdx:e})}else"removed"===f.type?(c++,a.push({lineNum:c,content:f.content,type:"removed",originalIdx:e})):"added"===f.type&&(d++,b.push({lineNum:d,content:f.content,type:"added",originalIdx:e}))}for(;a.length<b.length;)a.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});for(;b.length<a.length;)b.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});return{leftLines:a,rightLines:b}},[J]),an=(0,f.useMemo)(()=>J.map(a=>a.content),[J]),ao=(0,r.C)(an,c),[ap,aq]=(0,f.useState)(()=>new Map),ar=(0,f.useMemo)(()=>G??[],[G]),{rows:as,gaps:at}=(0,f.useMemo)(()=>F?(0,p.pU)(al,am,ap,ar):{rows:al.map((a,b)=>({kind:"diff",idx:b})),gaps:[]},[F,al,al,am,ap,ar]),au=(0,f.useCallback)((a,b)=>{let c=at.find(b=>b.id===a);c&&aq(d=>{let e=d.get(a)??{topRevealed:0,bottomRevealed:0},f=c.endIdx-c.startIdx+1-e.topRevealed-e.bottomRevealed;if(f<=0)return d;let g=Math.min(p.YO,f),h="up"===b?{...e,topRevealed:e.topRevealed+g}:{...e,bottomRevealed:e.bottomRevealed+g};return new Map(d).set(a,h)})},[at]);(0,f.useCallback)(a=>{for(let b of at)if(a>=b.startIdx&&a<=b.endIdx)return b.id;return null},[at]);let av=(0,f.useCallback)(a=>as[a]?.kind==="gap-label"?28:20,[as]),aw=(0,f.useCallback)(a=>{let b=as[a];if(!b)return a;if("gap-label"===b.kind)return`gl:${b.gapId}`;if("gap-expand"===b.kind)return`ge:${b.gapId}:${b.direction}`;let c=al[b.idx],d=am[b.idx];return`d:${c?.lineNum??"x"}:${c?.type??"x"}:${d?.lineNum??"x"}:${d?.type??"x"}`},[as,al,am]),ax=(0,i.Te)({count:as.length,getScrollElement:()=>K.current,estimateSize:av,getItemKey:aw,overscan:20}),ay=d?"w-1/4":u?"w-3/4":"w-1/2",az=d?"w-3/4":u?"w-1/4":"w-1/2",aA=(0,f.useMemo)(()=>as.map(a=>{if("diff"!==a.kind)return{type:"unchanged"};let b=al[a.idx],c=am[a.idx];return"removed"===b.type?{type:"removed"}:c?.type==="added"?{type:"added"}:{type:"unchanged"}}),[as,al,am]),aB=ax.getTotalSize(),aC=ax.getVirtualItems();return(0,e.jsxs)("div",{className:"font-mono flex flex-col h-full text-sm",children:[(0,e.jsxs)("div",{className:"flex flex-shrink-0 border-b border-border",children:[(0,e.jsx)("div",{className:`${ay} min-w-0 px-2 py-1 bg-accent text-muted-foreground text-center text-xs font-medium border-r border-border`,children:d?"(New File)":u?"Deleted":"Old"}),(0,e.jsxs)("div",{className:`${az} min-w-0 px-2 py-1 bg-accent text-muted-foreground text-xs font-medium relative`,children:[(0,e.jsx)("span",{className:"block text-center",children:u?"(Deleted)":"New"}),(0,e.jsxs)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-2",children:[B&&(0,e.jsx)("button",{onClick:B,className:"text-muted-foreground hover:text-foreground transition-colors",children:I}),!u&&b&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(b),(0,q.oR)(H("diffViewer.copiedAll"))},className:"text-muted-foreground hover:text-foreground transition-colors",children:H("common.copy")})]})]}),(0,e.jsx)("div",{className:"w-4 flex-shrink-0 bg-accent"})]}),(0,e.jsxs)("div",{className:"flex-1 min-h-0 flex",children:[(0,e.jsx)("div",{ref:K,className:"flex-1 overflow-y-auto overflow-x-hidden",children:(0,e.jsxs)("div",{className:"flex",style:{height:`${aB}px`},children:[(0,e.jsx)("div",{ref:L,className:`${ay} overflow-x-auto border-r border-border`,children:(0,e.jsx)("div",{className:"min-w-max h-full",style:{position:"relative"},children:aC.map(a=>{let b=as[a.index];if("gap-expand"===b.kind||"gap-label"===b.kind){let c="gap-label"===b.kind;return(0,e.jsx)("div",{ref:ax.measureElement,"data-index":a.index,style:{position:"absolute",top:0,left:0,width:"100%",height:`${a.size}px`,transform:`translateY(${a.start}px)`},className:c?"bg-accent border-y border-border":""},a.key)}let c=al[b.idx];return(0,e.jsxs)("div",{ref:ax.measureElement,"data-index":a.index,"data-row-idx":b.idx,style:{position:"absolute",top:0,left:0,minWidth:"100%",width:"max-content",height:`${a.size}px`,transform:`translateY(${a.start}px)`},className:`flex ${"removed"===c.type?"bg-red-9/15 dark:bg-red-9/25":""}`,children:[(0,e.jsx)("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-slate-9 select-none border-r border-border",children:c.lineNum||""}),(0,e.jsx)("span",{className:"whitespace-pre pl-2",dangerouslySetInnerHTML:{__html:c.originalIdx>=0&&ao[c.originalIdx]||(0,s.ZD)(c.content||" ")}})]},a.key)})})}),(0,e.jsx)("div",{ref:M,className:`${az} overflow-x-auto`,children:(0,e.jsx)("div",{className:"min-w-max h-full",style:{position:"relative"},children:aC.map(a=>{let b=as[a.index];if("gap-expand"===b.kind)return(0,e.jsx)("button",{ref:ax.measureElement,"data-index":a.index,type:"button",onClick:()=>au(b.gapId,b.direction),style:{position:"absolute",top:0,left:0,width:"100%",height:`${a.size}px`,transform:`translateY(${a.start}px)`},className:"flex items-center justify-center text-[11px] text-foreground/50 hover:bg-accent hover:text-brand active:bg-brand/15 transition-colors duration-100 cursor-pointer focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-brand/60",title:H("up"===b.direction?"diffViewer.gap.expandUp":"diffViewer.gap.expandDown",{count:b.revealCount}),"aria-label":H("up"===b.direction?"diffViewer.gap.expandUp":"diffViewer.gap.expandDown",{count:b.revealCount}),children:(0,e.jsx)("span",{className:"select-none",children:H("diffViewer.gap.more",{count:b.revealCount})})},a.key);if("gap-label"===b.kind)return(0,e.jsxs)("div",{ref:ax.measureElement,"data-index":a.index,"data-gap-id":b.gapId,style:{position:"absolute",top:0,left:0,width:"100%",height:`${a.size}px`,transform:`translateY(${a.start}px)`},className:"flex items-center justify-center gap-2 px-3 text-[11px] text-foreground/80 bg-accent border-y border-border min-w-0 select-none",children:[(0,e.jsx)("span",{className:"flex-shrink-0",children:H("diffViewer.gap.hidden",{count:b.hiddenCount})}),b.enclosingFn&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"opacity-50 flex-shrink-0",children:"\xb7"}),(0,e.jsx)("span",{className:"truncate min-w-0 font-medium",title:x(b.enclosingFn),children:x(b.enclosingFn)})]})]},a.key);let c=am[b.idx],d=c?.lineNum||0,f=d>0&&ad.has(d),g=ae.get(d),h=g?.[0],i=_&&d>=_.range.start&&d<=_.range.end,j=ab&&d>=ab.range.start&&d<=ab.range.end,k=i||j;return(0,e.jsxs)("div",{ref:ax.measureElement,"data-index":a.index,"data-new-line":d||void 0,"data-row-idx":b.idx,style:{position:"absolute",top:0,left:0,minWidth:"100%",width:"max-content",height:`${a.size}px`,transform:`translateY(${a.start}px)`},className:`flex ${k?"bg-blue-9/20":f?"bg-amber-9/10":c?.type==="added"?"bg-green-9/15 dark:bg-green-9/25":""}`,children:[(0,e.jsxs)("span",{className:`flex-shrink-0 flex items-center gap-0.5 pr-1 text-slate-9 select-none border-r border-border ${k?"bg-blue-9/30":""}`,style:{width:R?"52px":"40px"},children:[R&&d>0&&f&&h&&(0,e.jsx)("button",{onClick:a=>af(h,a),className:"w-4 h-4 flex items-center justify-center rounded hover:bg-accent text-amber-9",title:H("codeViewer.nComments",{count:g?.length}),children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M18 10c0 3.866-3.582 7-8 7a8.841 8.841 0 01-4.083-.98L2 17l1.338-3.123C2.493 12.767 2 11.434 2 10c0-3.866 3.582-7 8-7s8 3.134 8 7zM7 9H5v2h2V9zm8 0h-2v2h2V9zM9 9h2v2H9V9z",clipRule:"evenodd"})})}),R&&d>0&&!f&&(0,e.jsx)("span",{className:"w-4"}),(0,e.jsx)("span",{className:"flex-1 text-right pr-1",children:d||""})]}),(0,e.jsx)("span",{className:"whitespace-pre pl-2",dangerouslySetInnerHTML:{__html:c?.originalIdx>=0&&ao[c.originalIdx]||(0,s.ZD)(c?.content||" ")}})]},a.key)})})})]})}),(0,e.jsx)(t.b,{lines:aA,containerRef:K})]}),N&&P&&(0,g.createPortal)((0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(A,{floatingToolbarRef:Z,bumpRef:$,container:P,onAddComment:ag,onSendToAI:ah,onSearch:D?ai:void 0,isChatLoading:Q?.isLoading??!1}),_&&(0,e.jsx)(n.t,{x:_.x,y:_.y,range:_.range,codeContent:_.codeContent,container:P,onSubmit:ak,onClose:()=>aa(null)}),ab&&(0,e.jsx)(n.G,{x:ab.x,y:ab.y,range:ab.range,container:P,onSubmit:aj,onClose:()=>ac(null)}),X&&(0,e.jsx)(v.t,{x:X.x,y:X.y,comment:X.comment,container:P,onClose:()=>Y(null),onUpdateComment:U,onDeleteComment:V})]}),P)]})}function z({oldContent:a,newContent:b,filePath:c}){let d=(0,f.useMemo)(()=>(0,o.X)(a,b),[a,b]),g=(0,f.useRef)(null),h=(0,f.useMemo)(()=>d.map(a=>a.content),[d]),j=(0,r.C)(h,c),k=(0,f.useCallback)(a=>{let b=d[a];return b?`${b.type}:${b.oldLineNum??"x"}:${b.newLineNum??"x"}`:a},[d]),l=(0,i.Te)({count:d.length,getScrollElement:()=>g.current,estimateSize:()=>20,getItemKey:k,overscan:20});return(0,e.jsx)("div",{ref:g,className:"font-mono text-sm overflow-auto h-full",children:(0,e.jsx)("div",{style:{height:`${l.getTotalSize()}px`,position:"relative"},children:l.getVirtualItems().map(a=>{let b=d[a.index];return(0,e.jsxs)("div",{style:{position:"absolute",top:0,left:0,minWidth:"100%",width:"max-content",height:`${a.size}px`,transform:`translateY(${a.start}px)`},className:`flex ${"removed"===b.type?"bg-red-9/15 dark:bg-red-9/25":"added"===b.type?"bg-green-9/15 dark:bg-green-9/25":""}`,children:[(0,e.jsx)("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-slate-9 select-none border-r border-border",children:"added"!==b.type?b.oldLineNum:""}),(0,e.jsx)("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-slate-9 select-none border-r border-border",children:"removed"!==b.type?b.newLineNum:""}),(0,e.jsx)("span",{className:`w-6 flex-shrink-0 text-center select-none ${"removed"===b.type?"text-red-11":"added"===b.type?"text-green-11":"text-slate-9"}`,children:"removed"===b.type?"-":"added"===b.type?"+":" "}),(0,e.jsx)("span",{className:"flex-1 whitespace-pre pl-1",dangerouslySetInnerHTML:{__html:j[a.index]||(0,s.ZD)(b.content||" ")}})]},a.key)})})})}d()}catch(a){d(a)}})},36295:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{G:()=>C,p:()=>A});var e=c(48249),f=c(67484),g=c(46674),h=c(15273),i=c(62956),j=c(82594),k=c(10316),l=c(72419),m=c(44218),n=c(7833),o=c(44384),p=c(34678),q=c(76334),r=c(30894),s=c(28602),t=c(79606),u=c(33281),v=c(23328),w=a([r]);r=(w.then?(await w)():w)[0];let y=(0,f.lazy)(()=>c.e(8764).then(c.bind(c,98764)).then(a=>({default:a.XtermRenderer}))),z={c:"\x03",d:"\x04",z:"\x1a",l:"\f",a:"\x01",e:"\x05",u:"\x15",w:"\x17"},A=360,B=/\x1b\[[0-9;]*m/g;function x({output:a,query:b,mode:c,currentIdx:d,matchListRef:g}){let h=(0,f.useRef)(null);h.current||(h.current=new p.v,h.current.use_classes=!0);let i=a.split("\n"),j=b.toLowerCase(),k=0;return g.current=[],(0,e.jsx)("pre",{className:"text-sm font-mono whitespace-pre-wrap break-words select-text",children:i.map((a,b)=>{let f=a.replace(B,""),i=f.toLowerCase().includes(j);if("filter"===c&&!i)return null;if(!i){let c=h.current.ansi_to_html(a);return(0,e.jsx)("div",{dangerouslySetInnerHTML:{__html:c}},b)}let l=[],m=0,n=f.toLowerCase(),o=0;for(;o<n.length;){let a=n.indexOf(j,o);if(-1===a)break;a>m&&l.push((0,e.jsx)("span",{children:f.slice(m,a)},`t${m}`));let b=k++,c=b===d;l.push((0,e.jsx)("mark",{ref:a=>{g.current[b]=a},className:c?"bg-brand/40 text-foreground":"bg-yellow-300/40 text-foreground",children:f.slice(a,a+j.length)},`m${a}`)),o=m=a+j.length}return m<f.length&&l.push((0,e.jsx)("span",{children:f.slice(m)},`t${m}`)),(0,e.jsx)("div",{children:l},b)})})}let C=(0,f.memo)(function({commandId:a,tabId:b,projectCwd:c,command:d,output:w,exitCode:B,isRunning:C,selected:D,onSelect:E,onInterrupt:F,onStdin:G,onDelete:H,onRerun:I,timestamp:J,usePty:K,subscribePtyOutput:L,subscribePtyReset:M,onPtyResize:N,onToggleMaximize:O,maximized:P,expandedHeight:Q,bubbleContentHeight:R,onTitleMouseDown:S}){let{t:T}=(0,o.Bd)(),U=(0,f.useRef)(null),V=(0,f.useRef)(null),W=(0,f.useRef)(!0),X=(0,f.useRef)(null),Y=(0,f.useRef)(null),Z=(a=>{if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`})(J),$=a&&b?(0,q.p)(b+a):void 0,[_,aa]=(0,f.useState)(!1),[ab,ac]=(0,f.useState)(""),ad=(0,f.useRef)(null),ae=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(!L||!a)return;let b=()=>{if(ad.current){let b=ad.current.write;return L(a,b)}return null},c=b();if(c)return c;let d=setInterval(()=>{(c=b())&&clearInterval(d)},50);return()=>{clearInterval(d),c?.()}},[L,a]),(0,f.useEffect)(()=>{if(!M||!a)return;let b=()=>{if(ad.current){let b=ad.current.reset;return M(a,b)}return null},c=b();if(c)return c;let d=setInterval(()=>{(c=b())&&clearInterval(d)},50);return()=>{clearInterval(d),c?.()}},[M,a]);let[af,ag]=(0,f.useState)(!1),[ah,ai]=(0,f.useState)(""),[aj,ak]=(0,f.useState)("search"),[al,am]=(0,f.useState)(0),an=(0,f.useRef)([]),ao=(0,f.useRef)(null),ap=(0,f.useRef)(0);(0,f.useEffect)(()=>{ao.current||(ao.current=new p.v,ao.current.use_classes=!0)},[]),(0,f.useLayoutEffect)(()=>{let a=V.current;if(a&&ao.current){if(w.length<ap.current&&(ao.current=new p.v,ao.current.use_classes=!0,ap.current=0,a.innerHTML=""),w.length>ap.current){let b=w.slice(ap.current),c=ao.current.ansi_to_html(b);ap.current=w.length,a.insertAdjacentHTML("beforeend",c)}if(U.current){let a=U.current.scrollHeight>U.current.clientHeight;aa(a),a&&(U.current.scrollTop=U.current.scrollHeight)}}},[w]),(0,f.useEffect)(()=>(C&&W.current&&U.current&&(null!==X.current&&cancelAnimationFrame(X.current),X.current=requestAnimationFrame(()=>{U.current&&(U.current.scrollTop=U.current.scrollHeight),X.current=null})),()=>{null!==X.current&&cancelAnimationFrame(X.current)}),[w,C]),(0,f.useEffect)(()=>{if(!P)return;let a=a=>{"Escape"===a.key&&(a.preventDefault(),a.stopPropagation(),O?.())};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[P,O]);let aq=w?w.split("\n").length:0,ar=(0,f.useCallback)(()=>{ag(!0),requestAnimationFrame(()=>ae.current?.focus())},[]),as=(0,f.useCallback)(()=>{ag(!1),ai(""),am(0),ad.current?.clearSearch()},[]),at=(0,f.useCallback)(a=>{a.trim()&&(K?ad.current?.findNext(a):am(a=>{let b=a+1,c=an.current[b];return c?(c.scrollIntoView({block:"nearest"}),b):(an.current[0]?.scrollIntoView({block:"nearest"}),0)}))},[K]),au=(0,f.useCallback)(a=>{a.trim()&&(K?ad.current?.findPrevious(a):am(a=>{let b=a-1;if(b>=0)return an.current[b]?.scrollIntoView({block:"nearest"}),b;let c=an.current.length-1;return c>=0&&an.current[c]?.scrollIntoView({block:"nearest"}),Math.max(c,0)}))},[K]);(0,f.useEffect)(()=>{if(!D)return;let a=a=>{if((a.metaKey||a.ctrlKey)&&"f"===a.key){a.preventDefault(),a.stopPropagation(),ar();return}if("Escape"===a.key&&af){a.preventDefault(),a.stopPropagation(),as();return}};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[D,af,ar,as]);let av=P&&Q?Q-41:R??A;return(0,e.jsx)("div",{className:"flex flex-col items-start",children:(0,e.jsxs)("div",{className:`w-full bg-accent text-foreground dark:text-slate-11 relative overflow-hidden border transition-colors cursor-pointer ${P?"rounded-none border-0":"rounded-2xl rounded-bl-md rounded-br-md"} ${P?"":D?"border-brand":"border-brand/30"}`,onClick:E,children:[P?(0,e.jsxs)("div",{onDoubleClick:()=>O?.(),className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-card",style:{height:41,flexShrink:0},children:[(0,e.jsx)("span",{className:"text-[10px] font-mono leading-none px-1 py-0.5 rounded bg-muted text-muted-foreground",children:">_"}),(0,e.jsx)("span",{className:"flex-1 text-xs text-muted-foreground truncate font-mono",children:d}),C&&(0,e.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"inline-block w-2 h-2 bg-green-500 rounded-full animate-pulse"}),T("console.runningText")]}),C&&F&&(0,e.jsx)("button",{onClick:F,className:"text-xs px-3 py-1 rounded-md font-medium bg-destructive text-destructive-foreground transition-all duration-150 hover:bg-destructive/80 hover:shadow-md active:scale-95 active:bg-destructive/70 cursor-pointer select-none",children:"Ctrl+C"}),(0,e.jsx)("button",{onClick:()=>O?.(),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:T("console.restoreTooltip",{modKey:(0,s.Mu)()}),children:(0,e.jsx)(g.A,{className:"w-4 h-4"})})]}):(0,e.jsxs)("div",{"data-drag-handle":!0,onMouseDown:()=>S?.(),onDoubleClick:a=>{a.stopPropagation(),O?.()},className:`flex items-center gap-2 px-4 py-1.5 border-b text-xs transition-colors cursor-grab active:cursor-grabbing ${D?"border-brand":"border-brand/30"}`,children:[(0,e.jsx)("span",{className:"text-[10px] font-mono leading-none px-1 py-0.5 rounded flex-shrink-0 bg-muted text-muted-foreground",children:">_"}),$&&a&&b&&(0,e.jsx)(r.j,{shortId:$,type:"terminal",onRegister:()=>{u.t4.runFork((0,v.Ok)({tabId:b,commandId:a,command:d,projectCwd:c}).pipe(t.orElse(()=>t.void)))},onUnregister:()=>{u.t4.runFork((0,v.jO)({commandId:a}).pipe(t.orElse(()=>t.void)))}}),(0,e.jsx)("span",{className:"font-mono text-foreground truncate",children:d}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(d),(0,n.oR)(T("toast.copiedCmd"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:T("console.copyCommand"),children:(0,e.jsx)(h.A,{className:"w-3.5 h-3.5"})}),(0,e.jsx)("span",{className:"flex-1"}),_&&!C&&(0,e.jsx)("span",{className:"text-muted-foreground flex-shrink-0",children:T("console.totalLines",{count:aq})}),w&&(0,e.jsx)("button",{onClick:a=>{let b;a.stopPropagation(),b=w.replace(/\x1b\[[0-9;]*m/g,""),navigator.clipboard.writeText(b),(0,n.oR)(T("toast.copiedOutput"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:T("console.copyOutput"),children:(0,e.jsx)(i.A,{className:"w-3.5 h-3.5"})}),I&&(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),I()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:T("console.rerun"),children:(0,e.jsx)(j.A,{className:"w-3.5 h-3.5"})}),H&&(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),H()},className:"p-0.5 rounded text-destructive hover:text-destructive/80 transition-colors flex-shrink-0",title:T("console.deleteRecord"),children:(0,e.jsx)(g.A,{className:"w-3.5 h-3.5"})})]}),af&&(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border bg-card",style:{flexShrink:0},children:[(0,e.jsx)(k.A,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}),(0,e.jsx)("input",{ref:ae,value:ah,onChange:a=>{let b=a.target.value;ai(b),am(0),K&&(b.trim()?ad.current?.findNext(b):ad.current?.clearSearch())},onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?au(ah):at(ah))},placeholder:T("console.searchPlaceholder"),className:"flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground",autoComplete:"off",spellCheck:"false"}),!K&&(0,e.jsxs)("div",{className:"flex items-center gap-0.5 text-xs flex-shrink-0",children:[(0,e.jsx)("button",{onClick:()=>ak("search"),className:`px-1.5 py-0.5 rounded transition-colors ${"search"===aj?"bg-brand/20 text-brand":"text-muted-foreground hover:text-foreground"}`,children:T("console.searchMode")}),(0,e.jsx)("button",{onClick:()=>ak("filter"),className:`px-1.5 py-0.5 rounded transition-colors ${"filter"===aj?"bg-brand/20 text-brand":"text-muted-foreground hover:text-foreground"}`,children:T("console.filterMode")})]}),(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:()=>au(ah),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:T("console.prevShiftEnter"),children:(0,e.jsx)(l.A,{className:"w-3.5 h-3.5"})}),(0,e.jsx)("button",{onClick:()=>at(ah),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:T("console.nextEnter"),children:(0,e.jsx)(m.A,{className:"w-3.5 h-3.5"})})]}),(0,e.jsx)("button",{onClick:as,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:(0,e.jsx)(g.A,{className:"w-3.5 h-3.5"})})]}),K?(0,e.jsx)("div",{style:{height:av,overflow:"hidden"},children:(0,e.jsx)(f.Suspense,{fallback:(0,e.jsx)("div",{className:"px-4 py-2 text-xs text-muted-foreground",style:{height:av},children:T("console.loadingTerminal")}),children:(0,e.jsx)(y,{ref:ad,output:w,isRunning:C,onInput:G,onResize:N,maximized:P,height:av,directWrite:!!L})})}):(0,e.jsx)("div",{ref:U,className:"overflow-auto px-4 py-2",style:{height:av},onScroll:()=>{if(U.current){let{scrollTop:a,scrollHeight:b,clientHeight:c}=U.current;W.current=b-a-c<50}},children:af&&ah.trim()?(0,e.jsx)(x,{output:w,query:ah,mode:aj,currentIdx:al,matchListRef:an}):(0,e.jsx)("pre",{ref:V,className:"text-sm font-mono whitespace-pre-wrap break-words select-text"})}),C&&!P&&(0,e.jsxs)("div",{className:"border-t border-border px-4 py-2 flex items-center gap-2",onClick:a=>a.stopPropagation(),children:[(0,e.jsx)("span",{className:"inline-block w-2 h-2 bg-green-500 rounded-full animate-pulse flex-shrink-0"}),K?(0,e.jsx)("span",{className:"text-xs text-muted-foreground flex-1",children:T("console.clickToInput")}):G?(0,e.jsx)("input",{ref:Y,value:ab,onChange:a=>ac(a.target.value),onKeyDown:a=>{if(a.ctrlKey&&!a.metaKey&&!a.altKey){let b=z[a.key.toLowerCase()];if(b){a.preventDefault(),a.stopPropagation(),G(b);return}}"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),G(ab+"\n"),ac("")),"Tab"===a.key&&(a.preventDefault(),G(" "))},placeholder:T("console.stdinPlaceholder"),className:"flex-1 min-w-0 bg-transparent text-xs font-mono text-foreground outline-none placeholder:text-muted-foreground",autoComplete:"off",spellCheck:"false"}):(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:T("console.runningText")}),F&&(0,e.jsx)("button",{onClick:F,className:"flex-shrink-0 text-xs text-destructive hover:brightness-125 transition-colors cursor-pointer select-none",children:"Ctrl+C"}),Z&&(0,e.jsx)("span",{className:"text-[11px] text-muted-foreground flex-shrink-0",children:Z})]}),!C&&void 0!==B&&!P&&(0,e.jsxs)("div",{className:"border-t border-border px-4 py-2 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${0===B?"bg-green-500":"bg-red-500"}`}),(0,e.jsx)("span",{children:T("console.exitCode",{code:B})}),(0,e.jsx)("span",{className:"flex-1"}),Z&&(0,e.jsx)("span",{className:"text-[11px] flex-shrink-0",children:Z})]})]})})});d()}catch(a){d(a)}})},36984:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Np:()=>k,ZD:()=>i,b8:()=>j,kS:()=>g,sQ:()=>h});var e=c(78908),f=a([e]);e=(f.then?(await f)():f)[0];let l=null,m=["typescript","tsx","javascript","jsx","html","css","scss","json","yaml","python","go","rust","java","ruby","php","bash","shell","markdown","sql","c","cpp","swift","kotlin","dart","lua","graphql","xml"];function g(){return l||(l=(0,e.createHighlighter)({themes:["github-dark","github-light"],langs:[...m]})),l}function h(a){let b=a.split("/").pop()?.toLowerCase()||"",c=b.split(".").pop()?.toLowerCase();if(".env"===b||b.startsWith(".env.")||"dockerfile"===b||b.startsWith("dockerfile.")||"makefile"===b)return"bash";let d={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",mjs:"javascript",cjs:"javascript",html:"html",htm:"html",css:"css",scss:"scss",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",py:"python",go:"go",rs:"rust",java:"java",kt:"kotlin",rb:"ruby",php:"php",cs:"cpp",cpp:"cpp",c:"c",h:"c",sh:"bash",bash:"bash",zsh:"bash",md:"markdown",mdx:"markdown",sql:"sql",swift:"swift",dart:"dart",lua:"lua",graphql:"graphql",gql:"graphql",toml:"yaml",sass:"scss",less:"css",scala:"java",r:"python",vim:"bash",env:"bash"}[c||""]||"text";return m.includes(d)?d:"text"}function i(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function j(a){return a.map(a=>a.color?`<span style="color:${a.color}">${i(a.content)}</span>`:i(a.content)).join("")}function k(a,b,c,d){if(!b)return[];let e=[],f=c?b:b.toLowerCase();for(let b=0;b<a.length;b++){let g=c?a[b]:a[b].toLowerCase(),h=0;for(;;){let a=g.indexOf(f,h);if(-1===a)break;let c=a+f.length;if(d){let d=a>0?g[a-1]:" ",f=c<g.length?g[c]:" ",h=!/\w/.test(d),i=!/\w/.test(f);h&&i&&e.push({lineIndex:b,startCol:a,endCol:c})}else e.push({lineIndex:b,startCol:a,endCol:c});h=a+1}}return e}d()}catch(a){d(a)}})},37129:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{useTabState:()=>j});var e=c(67484),f=c(23860);c(57031),c(88214);var g=c(79606),h=c(33281),i=c(37388);function j({initialCwd:a,initialSessionId:b,activeView:c}){(0,e.useRef)(!1),(0,e.useRef)(!0);let d=(0,e.useRef)(c),k=(0,f.F)(),l=(0,e.useRef)(k),[m,n]=(0,e.useState)(()=>[{id:`tab-${Date.now()}`,cwd:a,title:"New Chat"}]),[o,p]=(0,e.useState)(m[0].id),[q,r]=(0,e.useState)(new Set),s=(0,e.useRef)(m),t=(0,e.useCallback)((b,c)=>{a&&b&&h.t4.runFork((0,i.KJ)(a,b,c).pipe(g.catchAll(()=>g.void)))},[a]),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(null),y=(0,e.useCallback)((a,b,c,d,e,f)=>{let g={id:`tab-${Date.now()}`,cwd:a,sessionId:b,title:c||(b?`Session ${b.slice(0,6)}...`:"New Chat"),engine:d,ollamaModel:e,deepseekModel:f};n(a=>{let b=a.findIndex(a=>a.id===o);if(-1===b)return[...a,g];let c=[...a];return c.splice(b+1,0,g),c}),p(g.id)},[o]),z=(0,e.useCallback)(b=>{n(c=>{let d=c.filter(a=>a.id!==b);if(b===o&&d.length>0&&p(d[d.length-1].id),0===d.length){let b={id:`tab-${Date.now()}`,cwd:a,title:"New Chat"};return p(b.id),[b]}return d})},[o,a]),A=(0,e.useCallback)((b,c)=>{let d=m.find(a=>a.sessionId===b);d?p(d.id):y(a,b,c)},[m,a,y]),B=(0,e.useCallback)(()=>{y(a)},[a,y]),C=(0,e.useCallback)(()=>{y(a,void 0,"New Claude 2 Chat","claude2")},[a,y]),D=(0,e.useCallback)(()=>{y(a,void 0,"New Codex Chat","codex")},[a,y]),E=(0,e.useCallback)(()=>{y(a,void 0,"New Kimi Chat","kimi")},[a,y]),F=(0,e.useCallback)(b=>{y(a,void 0,b?`New Ollama (${b})`:"New Ollama Chat","ollama",b)},[a,y]),G=(0,e.useCallback)((a,b)=>{n(c=>c.map(c=>c.id===a?{...c,ollamaModel:b}:c))},[]),H=(0,e.useCallback)(()=>{y(a,void 0,"New DeepSeek Chat","deepseek",void 0,"deepseek-v4-flash")},[a,y]),I=(0,e.useCallback)((a,b)=>{n(c=>c.map(c=>c.id===a?{...c,deepseekModel:b}:c))},[]),J=(0,e.useCallback)((b,c)=>{y(a,b,c)},[a,y]),K=(0,e.useCallback)((a,b)=>{n(c=>{let e=c.find(b=>b.id===a);if(e?.isLoading&&!1===b.isLoading){let c=!d.current||"agent"===d.current;if(a===o&&c&&l.current){let a=e.sessionId||b.sessionId;a&&t(a,"normal")}else r(b=>new Set(b).add(a))}return c.map(c=>c.id===a?{...c,...b}:c)})},[o,t]),L=(0,e.useCallback)(a=>{p(a),r(b=>{if(!b.has(a))return b;let c=new Set(b);c.delete(a);let d=s.current.find(b=>b.id===a);return d?.sessionId&&(t(d.sessionId,"normal"),h.t4.runFork((0,i.M2)(d.sessionId).pipe(g.catchAll(()=>g.void)))),c})},[t]),M=(0,e.useCallback)(a=>{v(a)},[]),N=(0,e.useCallback)((a,b)=>{a.preventDefault(),null!==u&&u!==b&&x(b)},[u]),O=(0,e.useCallback)(a=>{null!==u&&u!==a&&n(b=>{let c=[...b],[d]=c.splice(u,1);return c.splice(a,0,d),c}),v(null),x(null)},[u]),P=(0,e.useCallback)(()=>{v(null),x(null)},[]),Q=m.find(a=>a.id===o);return{tabs:m,activeTabId:o,activeTab:Q,unreadTabs:q,dragTabIndex:u,dragOverTabIndex:w,addTab:y,closeTab:z,switchTab:L,handleSelectSession:A,handleNewTab:B,handleNewClaude2Tab:C,handleNewCodexTab:D,handleNewKimiTab:E,handleNewOllamaTab:F,handleNewDeepseekTab:H,handleOpenSession:J,updateTabState:K,updateTabOllamaModel:G,updateTabDeepseekModel:I,handleTabDragStart:M,handleTabDragOver:N,handleTabDrop:O,handleTabDragEnd:P}}d()}catch(a){d(a)}})},37202:(a,b,c)=>{"use strict";c.d(b,{M:()=>m,O:()=>k});var d=c(48249),e=c(67484),f=c(44384),g=c(74429);let h=[],i=[];function j(){i.forEach(a=>a())}function k(a){let b=`session-toast-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;h=[...h,{...a,id:b}],j()}function l(a){h=h.filter(b=>b.id!==a),j()}function m({onNavigate:a}){let b=function(){let[,a]=(0,e.useState)(0);return h}();return 0===b.length?null:(0,g.createPortal)((0,d.jsx)("div",{className:"fixed bottom-4 left-4 z-[100] flex flex-col gap-2 pointer-events-none",children:b.map(b=>(0,d.jsx)(n,{item:b,onNavigate:a,onRemove:l},b.id))}),document.body)}function n({item:a,onNavigate:b,onRemove:c}){let{t:g}=(0,f.Bd)(),[h,i]=(0,e.useState)(!1),j=(0,e.useRef)(void 0),k=(0,e.useCallback)(()=>{i(!0),setTimeout(()=>c(a.id),300)},[a.id,c]),l=(0,e.useCallback)(()=>{clearTimeout(j.current),b(a.cwd,a.sessionId),c(a.id)},[a,b,c]),m=(0,e.useCallback)(()=>{clearTimeout(j.current)},[]),o=(0,e.useCallback)(()=>{j.current=setTimeout(k,2e3)},[k]);return(0,d.jsxs)("div",{className:`pointer-events-auto bg-card border border-border rounded-lg shadow-lg px-3 py-2.5 min-w-[260px] max-w-[340px] cursor-pointer hover:bg-accent transition-all ${h?"opacity-0 -translate-x-4":"opacity-100 translate-x-0"}`,style:{animation:h?void 0:"slideInLeft 0.3s ease-out"},onClick:l,onMouseEnter:m,onMouseLeave:o,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("svg",{className:"w-4 h-4 text-green-9 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),(0,d.jsx)("span",{className:"text-sm font-medium text-foreground truncate",children:a.projectName}),(0,d.jsx)("span",{className:"text-xs text-green-11 flex-shrink-0",children:g("common.done")}),(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),k()},className:"ml-auto p-0.5 text-muted-foreground hover:text-foreground rounded transition-colors",children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.message&&(0,d.jsx)("div",{className:"text-xs text-muted-foreground truncate mt-1 ml-6",children:a.message})]})}},37388:(a,b,c)=>{"use strict";c.d(b,{KJ:()=>h,M2:()=>i,ej:()=>g,n8:()=>f});var d=c(79606),e=c(71192);let f=a=>d.tryPromise({try:async()=>{let b=await fetch(`/api/project-state?cwd=${encodeURIComponent(a)}`);if(!b.ok)throw Error(`HTTP ${b.status}`);return await b.json()},catch:a=>new e.uV({message:"loadProjectState failed",cause:a})}),g=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/project-state",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok)throw Error(`HTTP ${b.status}`)},catch:a=>new e.uV({message:"saveProjectState failed",cause:a})}),h=(a,b,c)=>d.tryPromise({try:async()=>{let d=await fetch("/api/global-state",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,sessionId:b,status:c})});if(!d.ok)throw Error(`HTTP ${d.status}`)},catch:a=>new e.uV({message:"updateSessionStatus failed",cause:a})}),i=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/scheduled-tasks",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"markReadBySessionId",fields:{sessionId:a}})});if(!b.ok)throw Error(`HTTP ${b.status}`)},catch:a=>new e.uV({message:"markScheduledTasksReadBySession failed",cause:a})})},38087:(a,b,c)=>{"use strict";c.d(b,{m:()=>i});var d=c(67484),e=c(79606),f=c(33281),g=c(71192);let h=a=>e.tryPromise({try:async()=>{let b=await fetch("/api/session-by-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});return b.ok?await b.json():null},catch:a=>new g.uV({message:"session-by-path failed",cause:a})});function i(a,b,c,{cwd:j,initialSessionId:k,onSessionId:l,onTitleChange:m,onTokenUsage:n}){let[o,p]=(0,d.useState)(!1),[q,r]=(0,d.useState)(!1),[s,t]=(0,d.useState)(!1),[u,v]=(0,d.useState)(void 0),[w,x]=(0,d.useState)(0),y=(0,d.useRef)(m);y.current=m;let z=(0,d.useRef)(n);z.current=n;let A=(0,d.useRef)(void 0),B=(0,d.useRef)(0),C=(0,d.useCallback)(async(a,c,d=!1,e,g)=>{if(d){let a=Date.now();if(a-B.current<5e3)return;B.current=a}d||p(!0);try{let i={cwd:a,sessionId:c,limit:e,beforeTurnIndex:g};d&&A.current&&(i.ifFingerprint=A.current);let j=await f.t4.runPromiseExit(h(i));if("Success"===j._tag&&j.value){let a=j.value;if(a.notModified)return;a.fingerprint&&(A.current=a.fingerprint),void 0!==a.totalTurns&&x(a.totalTurns),void 0!==a.hasMore&&t(a.hasMore),a.messages&&a.messages.length>0&&(d?b(b=>{let c=a.messages;if(b.length===c.length&&b.length>0&&b[b.length-1].content===c[c.length-1].content)return b;let d=0;for(let a=0;a<Math.min(b.length,c.length)&&b[a].id===c[a].id&&b[a].content===c[a].content;a++)d=a+1;return d===b.length&&d<c.length?[...b,...c.slice(d)]:c}):b(a.messages)),a.sessionId&&l(a.sessionId),a.title&&y.current?.(a.title),a.usage&&z.current?.({inputTokens:a.usage.input_tokens||0,outputTokens:a.usage.output_tokens||0,cacheCreationInputTokens:a.usage.cache_creation_input_tokens||0,cacheReadInputTokens:a.usage.cache_read_input_tokens||0,totalCostUsd:0})}}catch(a){console.error("Failed to load history by cwd and sessionId:",a)}finally{d||p(!1)}},[b,l]),D=(0,d.useCallback)(async()=>{if(j&&c&&!q&&s){r(!0);try{let d=void 0!==u?u:w-Math.ceil(a.filter(a=>"user"===a.role).length),e=await f.t4.runPromiseExit(h({cwd:j,sessionId:c,limit:10,beforeTurnIndex:d>0?d:void 0}));if("Success"===e._tag&&e.value){let a=e.value;if(a.messages&&a.messages.length>0){b(b=>[...a.messages,...b]);let c=a.messages.filter(a=>"user"===a.role).length;v(d-c)}void 0!==a.hasMore&&t(a.hasMore),a.fingerprint&&(A.current=a.fingerprint)}else"Failure"===e._tag&&console.error("Failed to load more history:",e.cause)}finally{r(!1)}}},[j,c,q,s,u,w,a,b]);return{isLoadingHistory:o,isLoadingMore:q,hasMoreHistory:s,loadMoreHistory:D,loadHistory:(0,d.useCallback)(async a=>{p(!0);let c=e.tryPromise({try:async()=>{let b=await fetch(`/api/session/${a}/history`);return b.ok?await b.json():null},catch:a=>new g.uV({message:"load session history failed",cause:a})}),d=await f.t4.runPromiseExit(c);"Success"===d._tag&&d.value?.messages&&d.value.messages.length>0?b(d.value.messages):"Failure"===d._tag&&console.error("Failed to load history:",d.cause),p(!1)},[b]),loadHistoryByCwdAndSessionId:C}}},38878:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{TabManagerTopBar:()=>s});var e=c(48249),f=c(67484),g=c(94192),h=c(12568),i=c(7833),j=c(44384),k=c(57031),l=c(88214),m=c(79606),n=c(33281),o=c(85655),p=c(65484),q=a([h]);function r({cwd:a,currentBranch:b,onSwitched:c}){let{t:d}=(0,j.Bd)(),[g,h]=(0,f.useState)(!1),[k,l]=(0,f.useState)([]),[m,q]=(0,f.useState)(!1),[s,t]=(0,f.useState)(!1),[u,v]=(0,f.useState)(""),w=(0,f.useRef)(null),x=(0,f.useRef)(null),y=(0,f.useCallback)(async()=>{q(!0);let b=await n.t4.runPromiseExit((0,o.r4)(a));if("Success"===b._tag){let a=b.value,c=a.local??[],d=a.remote??[],e=[...c,...d.filter(a=>!c.includes(a.replace(/^origin\//,"")))];l(e)}else(0,i.oR)(d("toast.loadBranchFailed"),"error");q(!1)},[a,d]),z=(0,f.useCallback)(()=>{h(!0),v(""),y()},[y]),A=(0,f.useCallback)(()=>{h(!1)},[]),B=async b=>{t(!0);let e=await n.t4.runPromiseExit((0,p.Kl)({action:"checkout",cwd:a,path:a,branch:b}));if("Success"===e._tag){let a=b.replace(/^origin\//,"");(0,i.oR)(d("toast.switchedToBranch",{branch:a}),"success"),A(),c()}else{let a="Fail"===e.cause._tag?e.cause.error:null,b=a?.cause,c=b instanceof Error?b.message:d("toast.switchBranchFailed");(0,i.oR)(c,"error")}t(!1)},C=k.filter(a=>a!==b&&a.toLowerCase().includes(u.toLowerCase()));return(0,e.jsxs)("div",{className:"relative",ref:w,children:[(0,e.jsx)("button",{onClick:g?A:z,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:d("git.switchBranch"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"})})}),g&&(0,e.jsxs)("div",{className:"absolute top-full left-0 mt-1 w-64 bg-popover border border-border rounded-lg shadow-lg z-50 overflow-hidden",children:[(0,e.jsx)("div",{className:"p-2 border-b border-border",children:(0,e.jsx)("input",{ref:x,type:"text",value:u,onChange:a=>v(a.target.value),placeholder:d("git.searchBranch"),className:"w-full px-2.5 py-1.5 text-sm bg-muted rounded border-none outline-none placeholder:text-muted-foreground",onKeyDown:a=>{"Escape"===a.key&&A()}})}),(0,e.jsx)("div",{className:"max-h-60 overflow-y-auto p-1",children:m?(0,e.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:d("common.loading")}):0===C.length?(0,e.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:u?d("git.noMatchingBranches"):d("git.noBranches")}):C.map(a=>(0,e.jsx)("button",{onClick:()=>B(a),disabled:s,className:"w-full text-left px-2.5 py-1.5 text-sm rounded hover:bg-accent transition-colors truncate disabled:opacity-50",children:(0,e.jsx)("span",{className:a.startsWith("origin/")?"text-muted-foreground":"text-foreground",children:a})},a))})]})]})}function s({initialCwd:a,activeTab:b,isGitRepo:c,currentBranch:d,onOpenWorktree:f,onOpenProjectSessions:o,onOpenAliasManager:q,onBranchSwitched:t}){let{t:u}=(0,j.Bd)();return(0,e.jsx)("div",{className:"border-b border-border bg-card shrink-0",children:(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 relative",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("img",{src:"/icons/icon-72x72.png",alt:"Cockpit",className:"w-6 h-6 cursor-pointer",title:u("tabManagerTopBar.copyPageUrl"),onClick:()=>{navigator.clipboard.writeText(window.location.href).then(()=>{(0,i.oR)(u("toast.copiedPageUrl"),"success")})}}),a?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-sm text-foreground max-w-md truncate cursor-help",title:`CWD: ${a}`,children:a}),(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(a),(0,i.oR)(u("toast.copiedDirPath"))},className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:u("tabManagerTopBar.copyDirPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}):(0,e.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:"Cockpit"})]}),c&&a&&(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsxs)("button",{onClick:f,className:"flex items-center gap-1.5 px-2 py-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:"Git Worktrees",children:[(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 17h8m0 0l-4-4m4 4l-4 4M3 7v6a4 4 0 004 4h5"})}),(0,e.jsx)("span",{className:"text-sm",children:d||"main"})]}),(0,e.jsx)(r,{cwd:a,currentBranch:d,onSwitched:()=>t?.()})]})]}),(0,e.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2",children:(0,e.jsx)(g.gT,{})}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(h.ReviewDropdown,{cwd:a}),(0,e.jsx)("button",{onClick:()=>window.location.reload(),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:u("tabManagerTopBar.refreshProject"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),a&&(0,e.jsx)("button",{onClick:o,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:u("sessions.projectSessions"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,e.jsx)("button",{onClick:()=>{b?.cwd&&n.t4.runFork((0,p.em)(b.cwd).pipe(m.orElse(()=>m.void)))},className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:u("tabManagerTopBar.openInVSCode"),children:(0,e.jsx)("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:(0,e.jsx)("path",{d:"M17.583 2.213L12 7.393 6.417 2.213 1 6.17v11.66l5.417 3.957L12 16.607l5.583 5.18L23 17.83V6.17l-5.417-3.957zM6.417 17.83L3 15.33V8.67l3.417-2.5v11.66zm11.166 0V6.17L21 8.67v6.66l-3.417 2.5z"})})}),(0,e.jsx)("button",{onClick:()=>{b?.cwd&&n.t4.runFork((0,p.Q1)(b.cwd).pipe(m.orElse(()=>m.void)))},className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:u("tabManagerTopBar.openInCursor"),children:(0,e.jsx)("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:(0,e.jsx)("path",{d:"M4.5 2L20.5 12L4.5 22V2Z"})})}),b?.sessionId&&(0,e.jsx)("button",{onClick:()=>{let a=`claude -r ${b.sessionId}`;navigator.clipboard.writeText(a).then(()=>{(0,i.oR)(u("toast.copiedCommand",{command:a}),"success")})},className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:u("chat.copyCommandTooltip",{sessionId:b.sessionId}),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("button",{onClick:q,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:u("tabManagerTopBar.aliasesGlobal"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 12h-6m-4 0a8 8 0 1116 0 8 8 0 01-16 0zm4 0h.01"})})}),(0,e.jsx)("button",{onClick:()=>(0,k.F)(l.n.OpenTokenStats,{}),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:u("tabManagerTopBar.tokenStats"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})})}),(0,e.jsx)("button",{onClick:()=>window.open("https://surething.io?from=cockpit","_blank"),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:u("tabManagerTopBar.openSurething"),children:(0,e.jsx)("img",{src:"https://surething.io/logo.png?from=cockpit",alt:"Surething",className:"w-5 h-5 rounded-sm"})})]})]})})}h=(q.then?(await q)():q)[0],d()}catch(a){d(a)}})},38896:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{C:()=>h});var e=c(67484),f=c(36984),g=a([f]);function h(a,b){let[c,d]=(0,e.useState)(null),[g,h]=(0,e.useState)(!1),i=(0,e.useMemo)(()=>a.join("\n"),[a]),j=`${i}:${b}:${g}`;return(0,e.useMemo)(()=>c&&c.key===j?c.html:a.map(a=>(0,f.ZD)(a||" ")),[a,j,c])}f=(g.then?(await g)():g)[0],d()}catch(a){d(a)}})},39222:(a,b,c)=>{"use strict";c.d(b,{v:()=>l});var d=c(48249),e=c(67484),f=c(44384),g=c(46674),h=c(59347),i=c(24520),j=c(33281),k=c(23328);function l({cwd:a,tabId:b,onClose:c,onSave:m}){let{t:n}=(0,f.Bd)(),[o,p]=(0,e.useState)({}),[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)(""),[u,v]=(0,e.useState)(!0);(0,e.useCallback)(async()=>{v(!0);let c=await j.t4.runPromiseExit((0,k.QF)(a,b));"Success"===c._tag?p(c.value):console.error("Failed to load env:",c.cause),v(!1)},[a,b]);let w=()=>{q.trim()&&(p(a=>({...a,[q.trim()]:s})),r(""),t(""))},x=async()=>{let d=await j.t4.runPromiseExit((0,k.Vv)({cwd:a,tabId:b,env:o}));"Success"===d._tag?(m(o),c()):console.error("Failed to save env:",d.cause)};return(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center z-50",children:(0,d.jsxs)("div",{className:"bg-background border border-border rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] flex flex-col m-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{className:"text-lg font-semibold",children:n("envManager.title")}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:b?n("envManager.tabScope"):n("envManager.globalScope")})]}),(0,d.jsx)("button",{onClick:c,className:"p-1 rounded hover:bg-accent transition-colors",children:(0,d.jsx)(g.A,{className:"w-5 h-5"})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:u?(0,d.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground",children:n("common.loading")}):(0,d.jsxs)("div",{className:"space-y-3",children:[Object.entries(o).map(([a,b])=>(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("input",{type:"text",value:a,disabled:!0,className:"flex-1 px-3 py-2 rounded-lg border border-input bg-muted text-sm font-mono"}),(0,d.jsx)("input",{type:"text",value:b,onChange:b=>{var c;return c=b.target.value,void p(b=>({...b,[a]:c}))},placeholder:n("envManager.valuePlaceholder"),className:"flex-1 px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent"}),(0,d.jsx)("button",{onClick:()=>{p(b=>{let c={...b};return delete c[a],c})},className:"p-2 rounded-lg text-destructive hover:bg-destructive/10 transition-colors",children:(0,d.jsx)(h.A,{className:"w-4 h-4"})})]},a)),(0,d.jsxs)("div",{className:"flex items-start gap-2 pt-2 border-t border-border",children:[(0,d.jsx)("input",{type:"text",value:q,onChange:a=>r(a.target.value),placeholder:n("envManager.varNamePlaceholder"),className:"flex-1 px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent",onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),w())}}),(0,d.jsx)("input",{type:"text",value:s,onChange:a=>t(a.target.value),placeholder:n("envManager.varValuePlaceholder"),className:"flex-1 px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent",onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),w())}}),(0,d.jsx)("button",{onClick:w,disabled:!q.trim(),className:"p-2 rounded-lg bg-brand text-brand-foreground hover:bg-brand/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:(0,d.jsx)(i.A,{className:"w-4 h-4"})})]}),0===Object.keys(o).length&&(0,d.jsx)("div",{className:"text-center py-8 text-muted-foreground text-sm",children:n("envManager.noVars")})]})}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[(0,d.jsx)("button",{onClick:c,className:"px-4 py-2 rounded-lg text-sm hover:bg-accent transition-colors",children:n("common.cancel")}),(0,d.jsx)("button",{onClick:x,className:"px-4 py-2 rounded-lg text-sm bg-brand text-brand-foreground hover:bg-brand/90 transition-colors",children:n("common.save")})]})]})})}},39712:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{w:()=>p});var e=c(48249),f=c(67484),g=c(50757),h=c(27454),i=c(37752),j=c(87844),k=c(34678),l=c(83768);let a=new k.v;function m(a){return a?Array.isArray(a)?a.join(""):a:""}function n(a,b){return a&&a[b]?m(a[b]):""}a.use_classes=!0;let o=(0,f.memo)(function({output:b}){if("stream"===b.output_type){let c=m(b.text);if(!c)return null;let d=a.ansi_to_html(c);return(0,e.jsx)("pre",{className:`text-xs leading-relaxed whitespace-pre-wrap break-all px-3 py-1 ${"stderr"===b.name?"text-amber-500":"text-foreground"}`,dangerouslySetInnerHTML:{__html:d}})}if("error"===b.output_type){let c=(b.traceback||[]).join("\n"),d=a.ansi_to_html(c);return(0,e.jsx)("pre",{className:"text-xs leading-relaxed whitespace-pre-wrap break-all px-3 py-1 text-red-400 bg-red-500/5 rounded",dangerouslySetInnerHTML:{__html:d}})}if("execute_result"===b.output_type||"display_data"===b.output_type||"update_display_data"===b.output_type){let a=b.data;if(!a)return null;let c=n(a,"image/png"),d=n(a,"image/jpeg"),f=n(a,"image/svg+xml"),g=n(a,"text/html"),h=n(a,"text/markdown"),i=n(a,"text/latex"),k=n(a,"text/plain");if(c)return(0,e.jsx)("div",{className:"px-3 py-1",children:(0,e.jsx)("img",{src:`data:image/png;base64,${c}`,alt:"output",className:"max-w-full"})});if(d)return(0,e.jsx)("div",{className:"px-3 py-1",children:(0,e.jsx)("img",{src:`data:image/jpeg;base64,${d}`,alt:"output",className:"max-w-full"})});if(f)return(0,e.jsx)("div",{className:"px-3 py-1",dangerouslySetInnerHTML:{__html:f}});if(g)return(0,e.jsx)("div",{className:"px-3 py-1 overflow-x-auto notebook-html-output",dangerouslySetInnerHTML:{__html:g}});if(h)return(0,e.jsx)("div",{className:"px-3 py-1",children:(0,e.jsx)(j.T,{content:h})});if(i)return(0,e.jsx)("div",{className:"px-3 py-1",children:(0,e.jsx)(j.T,{content:`$$${i}$$`})});if(k)return(0,e.jsx)("pre",{className:"text-xs leading-relaxed whitespace-pre-wrap break-all px-3 py-1 text-foreground",children:k})}return null}),p=(0,f.memo)(function({cell:a,isActive:b,isEditing:c,onSelect:d,onEdit:k,onStopEdit:m,onSourceChange:n,onRun:p,onDelete:q,onMoveUp:r,onMoveDown:s,onToggleType:t,isFirst:u,isLast:v}){let{resolvedTheme:w}=(0,l.D)(),x=(0,f.useRef)(null),[y,z]=(0,f.useState)(a.source),A=(0,f.useCallback)(()=>{z(a.source),k()},[a.source,k]);(0,f.useEffect)(()=>{if(c&&x.current){x.current.focus();let a=x.current.value.length;x.current.setSelectionRange(a,a)}},[c]);let B=(0,f.useCallback)(()=>{let a=x.current;a&&(a.style.height="auto",a.style.height=a.scrollHeight+"px")},[]);(0,f.useEffect)(()=>{c&&B()},[c,y,B]);let C=(0,f.useCallback)(a=>{z(a.target.value),B()},[B]),D=(0,f.useCallback)(()=>{y!==a.source&&n(y),m()},[y,a.source,n,m]),E=(0,f.useCallback)(b=>{if("Enter"===b.key&&b.shiftKey)b.preventDefault(),y!==a.source&&n(y),p();else if("Enter"===b.key&&(b.metaKey||b.ctrlKey))b.preventDefault(),y!==a.source&&n(y),p();else if("Escape"===b.key)b.preventDefault(),D();else if("Tab"===b.key){b.preventDefault();let a=x.current;if(a){let b=a.selectionStart,c=a.selectionEnd,d=y.substring(0,b)+" "+y.substring(c);z(d),requestAnimationFrame(()=>{a.selectionStart=a.selectionEnd=b+4})}}},[y,a.source,n,p,D]),F=a.isExecuting?"*":a.execution_count??" ",G="code"===a.cell_type?"Code":"markdown"===a.cell_type?"Md":"Raw";return(0,e.jsxs)("div",{className:`group relative border rounded-lg transition-colors ${b?"border-brand/50 bg-brand/5":"border-border/50 hover:border-border"}`,onClick:d,children:[(0,e.jsxs)("div",{className:`absolute -top-3 left-2 flex items-center gap-0.5 text-[10px] z-10 bg-surface-secondary rounded px-1 py-0.5 border border-border/50 transition-opacity ${b?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:[(0,e.jsx)("button",{onClick:p,className:"px-1 hover:text-brand",title:"Run (Shift+Enter)",children:a.isExecuting?"⬛":"▶"}),(0,e.jsx)("button",{onClick:t,className:"px-1 hover:text-brand",title:"Toggle type",children:G}),!u&&(0,e.jsx)("button",{onClick:r,className:"px-1 hover:text-brand",title:"Move up",children:"↑"}),!v&&(0,e.jsx)("button",{onClick:s,className:"px-1 hover:text-brand",title:"Move down",children:"↓"}),(0,e.jsx)("button",{onClick:q,className:"px-1 hover:text-red-400",title:"Delete",children:"\xd7"})]}),(0,e.jsxs)("div",{className:"flex",children:[(0,e.jsx)("div",{className:"flex-shrink-0 w-10 text-center py-2 text-[10px] text-muted-foreground select-none cursor-pointer border-r border-border/30",onClick:a=>{a.stopPropagation(),p()},title:"code"===a.cell_type?"Click to run":void 0,children:"code"===a.cell_type?(0,e.jsxs)("span",{className:a.isExecuting?"text-brand animate-pulse":"",children:["[",F,"]"]}):(0,e.jsx)("span",{className:"text-muted-foreground/50",children:G})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("div",{className:"cursor-text",onDoubleClick:a=>{a.stopPropagation(),A()},children:c?(0,e.jsx)("textarea",{ref:x,value:y,onChange:C,onBlur:D,onKeyDown:E,className:"w-full bg-transparent text-xs font-mono leading-relaxed px-3 py-2 resize-none outline-none text-foreground",spellCheck:!1,style:{minHeight:"1.5rem"}}):"code"===a.cell_type?(0,e.jsx)("div",{className:"text-xs [&_pre]:!m-0 [&_pre]:!p-2 [&_pre]:!bg-transparent [&_code]:!bg-transparent",children:(0,e.jsx)(g.A,{language:"python",style:"dark"===w?h.A:i.A,customStyle:{margin:0,padding:"8px 12px",background:"transparent",fontSize:"12px"},wrapLongLines:!0,children:a.source||" "})}):"markdown"===a.cell_type?a.source.trim()?(0,e.jsx)("div",{className:"px-3 py-2 text-sm prose prose-sm dark:prose-invert max-w-none",children:(0,e.jsx)(j.T,{content:a.source})}):(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground italic",children:"Empty markdown cell"}):(0,e.jsx)("pre",{className:"text-xs font-mono px-3 py-2 text-muted-foreground whitespace-pre-wrap",children:a.source||" "})}),a.outputs.length>0&&(0,e.jsx)("div",{className:"border-t border-border/30",children:a.outputs.map((a,b)=>(0,e.jsx)(o,{output:a},b))})]})]})]})});d()}catch(a){d(a)}})},40159:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{S:()=>l,j:()=>a});var e=c(48249),f=c(67484),g=c(44384),h=c(208),i=c(44256);function j({blame:a,onClick:b}){let{t:c}=(0,g.Bd)(),d=(0,f.useRef)(null),k=(0,f.useRef)(null),l=(0,i.F2)(),m=(0,f.useRef)(!1),n=(0,f.useRef)(!1),o=(0,f.useRef)(null),p=(0,f.useRef)(null),q=(0,f.useRef)(null),r=(0,f.useRef)(a),s=(0,f.useRef)(b),t=(0,f.useCallback)(()=>{let a,b=k.current,c=d.current;if(!b||!c)return;let e=c.getBoundingClientRect(),f=b.getBoundingClientRect(),g=l?.getBoundingClientRect(),h=g?.left??0,i=g?.top??0,j=g?.width??window.innerWidth,m=g?.height??window.innerHeight,n=e.left-h;n+f.width>j-8&&(n=j-f.width-8),n<8&&(n=8);let o=e.top-i,p=e.bottom-i;(a=o-f.height-4<0?p+4:o-f.height-4)+f.height>m-8&&(a=m-f.height-8),b.style.left=`${n}px`,b.style.top=`${a}px`},[l]),u=(0,f.useCallback)(()=>{o.current&&(clearTimeout(o.current),o.current=null),p.current&&(clearTimeout(p.current),p.current=null),m.current=!1,n.current=!1,k.current&&(k.current.style.display="none"),q.current&&(document.removeEventListener("mousedown",q.current.down),document.removeEventListener("mouseup",q.current.up),q.current=null)},[]),v=(0,f.useCallback)(()=>{let a=k.current;if(!a||m.current)return;m.current=!0,a.style.left="-9999px",a.style.top="-9999px",a.style.display="block",requestAnimationFrame(()=>requestAnimationFrame(t));let b=0,c=0,e=a=>{b=a.clientX,c=a.clientY},f=a=>{if(!(Math.abs(a.clientX-b)>5||Math.abs(a.clientY-c)>5)){let b;b=a.target,k.current?.contains(b)||d.current?.contains(b)||u()}};document.addEventListener("mousedown",e),document.addEventListener("mouseup",f),q.current={down:e,up:f}},[t,u]),w=(0,f.useCallback)(()=>{if(o.current&&clearTimeout(o.current),p.current&&(clearTimeout(p.current),p.current=null),m.current)return;let a=window.getSelection();(!a||a.isCollapsed)&&(o.current=setTimeout(v,500))},[v]),x=(0,f.useCallback)(()=>{o.current&&(clearTimeout(o.current),o.current=null),m.current&&(p.current=setTimeout(()=>{n.current||u()},200))},[u]),y=(0,f.useCallback)(()=>{n.current=!0,p.current&&(clearTimeout(p.current),p.current=null)},[]),z=(0,f.useCallback)(()=>{n.current=!1,u()},[u]),A=(0,f.useCallback)(a=>{a.stopPropagation();let b=window.getSelection();b&&b.toString().length>0&&k.current?.contains(b.anchorNode)||(s.current?.(r.current),u())},[u]),B=a.message.split("\n")[0]||"",C=a.message.split("\n").slice(1).join("\n").trim();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("span",{ref:d,className:"select-none text-xs text-muted-foreground/50 ml-6 cursor-default hover:text-muted-foreground/80",onMouseEnter:w,onMouseLeave:x,children:[a.author.split(" ")[0],", ",function(a){let b=h.A.t,c=Date.now(),d=Math.floor((c-1e3*a)/1e3);if(d<60)return b("common.justNow");let e=Math.floor(d/60);if(e<60)return b("common.minutesAgo",{count:e});let f=Math.floor(e/60);if(f<24)return b("common.hoursAgo",{count:f});let g=Math.floor(f/24);if(g<30)return b("common.daysAgo",{count:g});let i=Math.floor(g/30);if(i<12)return b("common.monthsAgo",{count:i});let j=Math.floor(i/12);return b("common.yearsAgo",{count:j})}(a.time)," \xb7 ",B]}),(0,e.jsx)(i.ZL,{children:(0,e.jsxs)("div",{ref:k,className:"fixed z-[9999] bg-card border border-border rounded-lg shadow-xl p-3 text-xs text-foreground whitespace-pre-wrap max-w-md select-text",style:{display:"none",minWidth:280,cursor:"text"},"data-inline-blame-tip":"",onMouseEnter:y,onMouseLeave:z,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,e.jsx)("span",{className:"font-mono text-brand",children:a.hash}),(0,e.jsx)("span",{className:"text-muted-foreground",children:a.author}),(0,e.jsx)("span",{className:"text-muted-foreground/60",children:new Date(1e3*a.time).toLocaleString()})]}),(0,e.jsx)("div",{className:"font-medium",children:B}),C&&(0,e.jsx)("div",{className:"mt-1 text-muted-foreground",children:C}),(0,e.jsx)("div",{className:"mt-2 text-[11px] text-brand border-t border-border pt-2 cursor-pointer hover:underline",onClick:A,children:c("codeViewer.clickToViewDetails")})]})})]})}let a=[{bg:"rgba(59, 130, 246, 0.15)",border:"rgb(59, 130, 246)"},{bg:"rgba(16, 185, 129, 0.15)",border:"rgb(16, 185, 129)"},{bg:"rgba(245, 158, 11, 0.15)",border:"rgb(245, 158, 11)"},{bg:"rgba(239, 68, 68, 0.15)",border:"rgb(239, 68, 68)"},{bg:"rgba(168, 85, 247, 0.15)",border:"rgb(168, 85, 247)"},{bg:"rgba(236, 72, 153, 0.15)",border:"rgb(236, 72, 153)"},{bg:"rgba(20, 184, 166, 0.15)",border:"rgb(20, 184, 166)"},{bg:"rgba(249, 115, 22, 0.15)",border:"rgb(249, 115, 22)"}];function k(a,b){let c,d=document.caretRangeFromPoint(a.clientX,a.clientY);if(!d||!b.contains(d.startContainer))return 1;let e=d.startContainer,f=d.startOffset,g=document.createTreeWalker(b,NodeFilter.SHOW_TEXT),h=1;for(;c=g.nextNode();){if(c===e){h+=f;break}h+=c.textContent?.length||0}return h}let l=(0,f.memo)(function({virtualKey:a,lineNum:b,highlightedHtml:c,hasComments:d,firstComment:h,lineCommentsCount:i,isInRange:l,showLineNumbers:m,lineNumChars:n,commentsEnabled:o,virtualItemSize:p,virtualItemStart:q,onCommentBubbleClick:r,onCmdClick:s,onTokenHover:t,onTokenHoverLeave:u,flashLine:v,blameLine:w,showBlameInfo:x,blameAuthorColor:y,isBlameHovered:z,onBlameClick:A,onBlameMouseEnter:B,onBlameMouseLeave:C,inlineBlameData:D,onInlineBlameClick:E,isCursorLine:F,cursorCol:G}){let{t:H}=(0,g.Bd)(),I=(0,f.useMemo)(()=>F&&null!=G?function(a,b){let c=0,d=0;for(;d<a.length;){if("<"===a[d]){let b=a.indexOf(">",d);if(-1!==b){d=b+1;continue}}if(c===b){let b;if("&"===a[d]){let c=a.indexOf(";",d);b=-1!==c&&c-d<10?c+1:d+1}else b=d+1;let c=a.substring(d,b);return a.substring(0,d)+'<span class="vi-char-cursor">'+c+"</span>"+a.substring(b)}if("&"===a[d]){let b=a.indexOf(";",d);d=-1!==b&&b-d<10?b+1:d+1}else d++;c++}return a+'<span class="vi-char-cursor"> </span>'}(c,G):c,[c,F,G]),J=(0,f.useCallback)(a=>{if(!a.metaKey||!s)return;a.preventDefault(),a.stopPropagation();let c=a.currentTarget,d=k(a,c);window.getSelection()?.removeAllRanges(),s(b,d)},[b,s]),K=(0,f.useCallback)(a=>{if(!t||0!==a.buttons)return;let c=window.getSelection();if(c&&!c.isCollapsed)return;let d=a.target;if("SPAN"!==d.tagName||!d.style.color)return;let e=a.currentTarget,f=k(a,e),g=d.getBoundingClientRect();t(b,f,{x:g.left,y:g.bottom+4})},[b,t]),L=(0,f.useCallback)(()=>{w&&A&&A(w)},[w,A]),M=(0,f.useCallback)(a=>{w&&B&&B(w,a)},[w,B]);return(0,e.jsxs)("div",{"data-line":b,style:{position:"absolute",top:0,left:0,width:"100%",height:`${p}px`,transform:`translateY(${q}px)`,backgroundColor:z&&y?y.bg:void 0},className:`flex ${v===b?"flash-line":""} ${F?"vi-cursor-line":""} ${l?"bg-blue-9/20":d?"bg-amber-9/10":"hover:bg-accent/50"}`,children:[(0,e.jsxs)("div",{className:"flex shrink-0 sticky left-0 z-[2] bg-secondary",style:{backgroundColor:z&&y?y.bg:void 0},children:[w&&y&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"w-1 flex-shrink-0",style:{backgroundColor:y.border}}),(0,e.jsx)("div",{className:"w-48 flex-shrink-0 px-2 flex items-center gap-2 border-r border-border text-muted-foreground cursor-pointer hover:bg-accent/50",onMouseEnter:M,onMouseLeave:C,onClick:L,title:H("codeViewer.clickToViewCommit"),children:x?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"font-medium",style:{color:y.border},children:w.hash}),(0,e.jsx)("span",{className:"truncate flex-1",children:w.author.split(" ")[0]})]}):null})]}),m&&(0,e.jsxs)("span",{className:`flex-shrink-0 flex items-center justify-end gap-0.5 pr-2 select-none border-r border-border font-variant-tabular ${l?"bg-blue-9/30 text-blue-11":"bg-card/50 text-slate-9"}`,children:[o&&d&&h&&(0,e.jsx)("button",{onClick:a=>r(h,a),className:"w-4 h-4 flex items-center justify-center rounded hover:bg-accent text-amber-9",title:H("codeViewer.nComments",{count:i}),children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M18 10c0 3.866-3.582 7-8 7a8.841 8.841 0 01-4.083-.98L2 17l1.338-3.123C2.493 12.767 2 11.434 2 10c0-3.866 3.582-7 8-7s8 3.134 8 7zM7 9H5v2h2V9zm8 0h-2v2h2V9zM9 9h2v2H9V9z",clipRule:"evenodd"})})}),o&&!d&&(0,e.jsx)("span",{className:"w-4"}),(0,e.jsx)("span",{className:"text-right",style:{minWidth:`${n}ch`},children:b})]})]}),(0,e.jsxs)("span",{className:"flex-1 px-3 whitespace-pre select-text",onClick:J,onMouseOver:K,onMouseLeave:u,"data-code-content":!0,children:[(0,e.jsx)("span",{dangerouslySetInnerHTML:{__html:I}}),D&&(0,e.jsx)(j,{blame:D,onClick:E})]})]},a)});d()}catch(a){d(a)}})},41051:(a,b,c)=>{"use strict";c.d(b,{f:()=>h,w:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({x:a,y:b,visible:c,container:e,onAddComment:h,onSendToAI:i,onSearch:j,isChatLoading:k}){let{t:l}=(0,f.Bd)(),m=e.getBoundingClientRect(),n=a-m.left,o=Math.max(0,b-m.top-40);return(0,d.jsxs)("div",{className:"floating-toolbar absolute z-[200] flex items-center gap-1.5 bg-card border border-border rounded-lg shadow-xl p-1.5",style:{left:n+8,top:o,visibility:c?"visible":"hidden",pointerEvents:c?"auto":"none"},children:[(0,d.jsx)("button",{className:"px-3 py-1.5 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors",onClick:h,children:l("floatingToolbar.addComment")}),(0,d.jsx)("button",{className:"px-3 py-1.5 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:i,disabled:k,title:l(k?"comments.aiResponding":"floatingToolbar.sendToAI"),children:l("floatingToolbar.sendToAI")}),j&&(0,d.jsx)("button",{className:"px-3 py-1.5 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors",onClick:j,children:l("floatingToolbar.search")})]})}let h=(0,e.memo)(function({floatingToolbarRef:a,bumpRef:b,container:c,onAddComment:f,onSendToAI:h,onSearch:i,isChatLoading:j}){let[k,l]=(0,e.useState)(0),m=(0,e.useMemo)(()=>a.current,[k]);return(0,d.jsx)(g,{x:m?.x??0,y:m?.y??0,visible:!!m,container:c,onAddComment:f,onSendToAI:h,onSearch:i,isChatLoading:j})})},41224:(a,b,c)=>{"use strict";c.d(b,{Cr:()=>s,JC:()=>l,M5:()=>j,QW:()=>o,Zr:()=>n,an:()=>r,em:()=>i,l1:()=>k,n_:()=>m,qD:()=>q,td:()=>h});var d=c(79606),e=c(71192);let f=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`);return await c.json()},catch:c=>new e.uV({message:`${b?.method??"GET"} ${a} failed`,cause:c})}),g=(a,b)=>f(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),h=()=>f("/api/settings"),i=a=>f("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),j=a=>f(a?`/api/commands?cwd=${encodeURIComponent(a)}`:"/api/commands"),k=()=>f("/api/skills"),l=a=>g("/api/bash",a),m=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/session-by-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});return b.ok?await b.json():null},catch:a=>new e.uV({message:"POST /api/session-by-path failed",cause:a})}),n=(a,b)=>g(`/api/session/${encodeURIComponent(a)}/fork`,b),o=a=>f(`/api/sessions/projects/${encodeURIComponent(a)}`),p=()=>d.tryPromise({try:async()=>{let a=await fetch("/api/ollama/models");return 503===a.status?{_tag:"not-running"}:a.ok?{_tag:"ok",models:(await a.json()).models??[]}:{_tag:"error",message:"Failed to fetch models"}},catch:a=>new e.uV({message:"fetch ollama models failed",cause:a})}),q=a=>d.gen(function*(){let b=yield*p();if("not-running"!==b._tag)return b;a&&(yield*d.sync(a));let c=yield*d.tryPromise({try:async()=>{let a=await fetch("/api/ollama/start",{method:"POST"}),b=await a.json().catch(()=>({}));return 404===a.status?{_tag:"not-installed",message:b.message||"Ollama is not installed"}:a.ok?{_tag:"started"}:{_tag:"error",message:"Failed to start Ollama"}},catch:a=>new e.uV({message:"start ollama failed",cause:a})});if("not-installed"===c._tag)return{_tag:"not-installed",message:c.message};if("error"===c._tag)return{_tag:"error",message:c.message};let f=yield*p();return"not-running"===f._tag?{_tag:"error",message:"Ollama started but cannot fetch models"}:f}),r=a=>f(`/api/file?path=${encodeURIComponent(a)}`),s=a=>f(`/api/claude-stats?engine=${encodeURIComponent(a)}`)},42140:(a,b,c)=>{"use strict";c.d(b,{G:()=>h,t:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({x:a,y:b,range:c,codeContent:h,container:i,onSubmit:j,onClose:k}){let{t:l}=(0,f.Bd)(),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(!1),q=(0,e.useRef)(null),r=(0,e.useRef)(null),[s,t]=(0,e.useState)({x:0,y:0}),u=h?.split("\n").slice(0,5).join("\n"),v=!!h&&h.split("\n").length>5;return(0,d.jsxs)("div",{ref:q,className:"absolute z-[200] w-[640px] bg-card border border-border rounded-lg shadow-lg overflow-hidden",style:{left:s.x,top:s.y},children:[(0,d.jsx)("div",{className:"px-3 py-2 bg-amber-9/10 border-b border-border",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-amber-11",children:l("comments.addComment")}),(c.start>0||c.end>0)&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:l("comments.lineRange",{start:c.start,end:c.end})})]})}),h&&(0,d.jsx)("div",{className:"px-3 py-2 bg-secondary/50 border-b border-border max-h-24 overflow-hidden",children:(0,d.jsxs)("pre",{className:"text-xs font-mono text-muted-foreground whitespace-pre-wrap break-all",children:[u,v&&(0,d.jsx)("span",{className:"text-muted-foreground/50",children:"..."})]})}),(0,d.jsxs)("div",{className:"p-2",children:[(0,d.jsx)("textarea",{ref:r,value:m,onChange:a=>n(a.target.value),placeholder:l("comments.inputPlaceholder"),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card resize-none focus:outline-none focus:ring-1 focus:ring-ring disabled:opacity-50 disabled:cursor-not-allowed",rows:2,disabled:o,onKeyDown:a=>{"Enter"===a.key&&!a.shiftKey&&!a.nativeEvent.isComposing&&(a.preventDefault(),!o&&m.trim()&&(p(!0),j(m.trim()))),"Escape"!==a.key||o||k()}}),(0,d.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:l(o?"comments.submitting":"comments.enterSubmit")})]})]})}function h({x:a,y:b,range:c,filePath:g,codeContent:i,container:j,onSubmit:k,onClose:l,isChatLoading:m}){let{t:n}=(0,f.Bd)(),[o,p]=(0,e.useState)(""),q=(0,e.useRef)(null),r=(0,e.useRef)(null),[s,t]=(0,e.useState)({x:0,y:0}),u=i?.split("\n").slice(0,5).join("\n"),v=!!i&&i.split("\n").length>5;return(0,d.jsxs)("div",{ref:q,className:"absolute z-[200] w-[640px] bg-card border border-border rounded-lg shadow-lg overflow-hidden",style:{left:s.x,top:s.y},children:[(0,d.jsxs)("div",{className:"px-3 py-2 bg-brand/10 border-b border-border",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-brand",children:n("comments.askAI")}),(c.start>0||c.end>0)&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:n("comments.lineRange",{start:c.start,end:c.end})})]}),g&&(0,d.jsx)("div",{className:"mt-1 text-xs text-muted-foreground truncate",children:g})]}),i&&(0,d.jsx)("div",{className:"px-3 py-2 bg-secondary/50 border-b border-border max-h-24 overflow-hidden",children:(0,d.jsxs)("pre",{className:"text-xs font-mono text-muted-foreground whitespace-pre-wrap break-all",children:[u,v&&(0,d.jsx)("span",{className:"text-muted-foreground/50",children:"..."})]})}),(0,d.jsxs)("div",{className:"p-2",children:[(0,d.jsx)("textarea",{ref:r,value:o,onChange:a=>p(a.target.value),placeholder:n("comments.inputQuestion"),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card resize-none focus:outline-none focus:ring-1 focus:ring-ring disabled:opacity-50 disabled:cursor-not-allowed",rows:2,disabled:m,onKeyDown:a=>{"Enter"===a.key&&!a.shiftKey&&!a.nativeEvent.isComposing&&(a.preventDefault(),!m&&o.trim()&&(k(o.trim()),l())),"Escape"===a.key&&l()}}),(0,d.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:n(m?"comments.aiGenerating":"comments.enterSend")})]})]})}},43489:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,60440,23)),Promise.resolve().then(c.t.bind(c,84342,23)),Promise.resolve().then(c.t.bind(c,82265,23)),Promise.resolve().then(c.t.bind(c,35421,23)),Promise.resolve().then(c.t.bind(c,61335,23)),Promise.resolve().then(c.t.bind(c,70664,23)),Promise.resolve().then(c.bind(c,74661))},44256:(a,b,c)=>{"use strict";c.d(b,{F2:()=>m,ZL:()=>k,a9:()=>l});var d=c(48249),e=c(67484),f=c(74429);let g=()=>()=>{},h=()=>document.body,i=()=>null,j=(0,e.createContext)(null);function k({children:a}){let b=(0,e.useContext)(j),c=(0,e.useSyncExternalStore)(g,h,i),d=b??c;return d?(0,f.createPortal)(a,d):null}function l({children:a}){let[b,c]=(0,e.useState)(null);return(0,d.jsxs)("div",{className:"relative w-full h-full",style:{transform:"translateZ(0)"},children:[(0,d.jsx)(j.Provider,{value:b,children:a}),(0,d.jsx)("div",{ref:c,className:"absolute inset-0 pointer-events-none [&>*]:pointer-events-auto"})]})}function m(){return(0,e.useContext)(j)}},44616:(a,b,c)=>{Promise.resolve().then(c.bind(c,67045))},47111:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(48249),e=c(3560),f=c(13812),g=c(74493),h=a([f]);f=(h.then?(await h)():h)[0],(0,e.Aq)({type:"redis",idPrefix:"redis",match(a){let b=a.trim().toLowerCase();return b.startsWith("redis://")||b.startsWith("rediss://")},parse(a){let b=a.trim(),c=b;try{let a=new URL(b),d=a.pathname.replace(/^\//,"")||"0";c=`db${d}@${a.hostname}${a.port?":"+a.port:":6379"}`}catch{}return{connectionString:b,displayName:c}},fromHistory:a=>({connectionString:a.connectionString,displayName:a.displayName||a.connectionString}),toHistory:a=>({connectionString:a.connectionString,displayName:a.displayName}),Component:function({item:a,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l}){return(0,d.jsx)(f.k,{id:a.id,connectionString:a.connectionString,displayName:a.displayName,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l})},async onClose(a){await (0,g.ax)("redis",a.id)}}),b()}catch(a){b(a)}})},47938:(a,b,c)=>{"use strict";c.d(b,{SessionBrowser:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call SessionBrowser() from the server but SessionBrowser is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/SessionBrowser.tsx","SessionBrowser")},49924:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{mp:()=>k,nb:()=>l});var e=c(48249),f=c(44384),g=c(96286),h=c(46674),i=c(72529),j=c(53716);function k({entries:a,onSelect:b,onClear:c}){let{t:d}=(0,f.Bd)();return(0,e.jsxs)("div",{className:"w-56 flex-shrink-0 bg-card border-l border-border flex flex-col","data-testid":"function-history-drawer",children:[(0,e.jsxs)("div",{className:"flex-shrink-0 px-2 py-1.5 border-b border-border flex items-center justify-between gap-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground font-mono min-w-0",children:[(0,e.jsx)(g.A,{className:"w-3 h-3 flex-shrink-0"}),(0,e.jsx)("span",{className:"truncate",children:0===a.length?d("blockViewer.history.title"):`${d("blockViewer.history.title")} \xb7 ${a.length}/15`})]}),a.length>0&&(0,e.jsx)(i.m,{content:d("blockViewer.history.clear"),children:(0,e.jsx)("button",{onClick:c,className:"flex-shrink-0 text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-secondary",children:(0,e.jsx)(h.A,{className:"w-3 h-3"})})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===a.length?(0,e.jsx)("div",{className:"px-3 py-4 text-[10px] text-muted-foreground/60 italic leading-relaxed",children:d("blockViewer.history.empty")}):a.map((a,c)=>{var d;let f;return(0,e.jsx)(i.m,{content:`${a.qname} \xb7 ${a.filePath}`,children:(0,e.jsxs)("button",{onClick:()=>b(a),className:"w-full text-left px-2 py-1.5 border-b border-border/50 hover:bg-secondary/60 transition-colors group flex items-start gap-1.5",children:[(0,e.jsx)(j.y,{kind:a.kind??"unknown",qname:a.qname,className:"w-3 h-3 mt-0.5 flex-shrink-0"}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("div",{className:"text-xs font-mono font-medium truncate",children:a.name}),(0,e.jsxs)("div",{className:"text-[10px] text-muted-foreground/70 truncate",children:[(f=(d=a.filePath).lastIndexOf("/"))>=0?d.slice(f+1):d,a.kind&&(0,e.jsxs)("span",{className:"ml-1 opacity-60",children:["\xb7 ",a.kind]})]})]})]})},`${a.filePath}::${a.qname}::${c}`)})})]})}function l(a,b){let c=a.filter(a=>a.filePath!==b.filePath||a.qname!==b.qname),d=[b,...c];return d.length>15?d.slice(0,15):d}d()}catch(a){d(a)}})},49950:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{J:()=>t});var e=c(48249),f=c(67484),g=c(44384),h=c(36295),i=c(39222),j=c(32465),k=c(4354),l=c(55579),m=c(18191),n=c(63963),o=c(9780),p=c(33281),q=c(79606),r=c(23328),s=a([o,m,h,k]);function t({cwd:a,initialShellCwd:b,tabId:c,onCwdChange:d,onOpenNote:s}){let{t:u}=(0,g.Bd)(),{consoleItems:v,scrollRef:w,selectedCommandId:x,setSelectedCommandId:y,interruptCommand:z,sendStdin:A,deleteCommand:B,rerunCommand:C,ptySizeRef:D,resizePty:E,executeCommand:F,addPluginItem:G,closePluginItem:H,sleepingBubbles:I,handleBubbleSleep:J,handleBubbleWake:K,scrollToBottom:L,currentCwd:M,commandHistoryRef:N,setCustomEnv:O,setAliases:P,saveBubbleOrder:Q,hasMoreHistory:R,loadHistory:S,currentPage:T,isLoadingHistory:U,subscribePtyOutput:V,subscribePtyReset:W}=(0,m.cK)({cwd:a,initialShellCwd:b,tabId:c,onCwdChange:d}),[X,Y]=(0,f.useState)(null),[Z,$]=(0,f.useState)(0),[_,aa]=(0,f.useState)(0),[ab,ac]=(0,f.useState)(!0),[ad,ae]=(0,f.useState)(!1),[af,ag]=(0,f.useState)(!1),[ah,ai]=(0,f.useState)(!1),[aj,ak]=(0,f.useState)(!1),al=(0,f.useRef)(null),am=(0,f.useRef)(null),an=(0,f.useRef)(null),ao=(0,f.useRef)(!1),ap=(0,f.useRef)(null),aq=(0,f.useRef)(null),ar=(0,f.useRef)([]),as=(0,f.useCallback)(()=>{let a=w.current;return!a||a.scrollHeight-a.scrollTop-a.clientHeight<50},[w]),at=(0,f.useCallback)(()=>{let a=w.current;return!a||a.scrollTop<50},[w]),au=(0,f.useCallback)(()=>{ai(!at()),ak(!as())},[as,at]),av=(0,f.useCallback)(()=>{am.current?.scrollIntoView({behavior:"smooth"})},[]),aw=(0,f.useCallback)(()=>{ao.current=!0},[]),ax=(0,f.useCallback)((a,b)=>{if(!ao.current)return void a.preventDefault();ao.current=!1,ap.current=b,a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",b),a.currentTarget.style.opacity="0.4";let c=a.currentTarget.querySelector("[data-drag-handle]");if(c){let b=c.cloneNode(!0);b.style.cssText="position:fixed;top:-9999px;left:-9999px;width:"+c.offsetWidth+"px;background:var(--card);border-radius:8px;padding:4px 12px;opacity:0.9;",document.body.appendChild(b),a.dataTransfer.setDragImage(b,20,16),requestAnimationFrame(()=>document.body.removeChild(b))}},[]),ay=(0,f.useCallback)((a,b)=>{a.preventDefault(),a.dataTransfer.dropEffect="move",aq.current=b},[]),az=(0,f.useCallback)(a=>{a.preventDefault(),a.currentTarget.classList.add("ring-2","ring-brand")},[]),aA=(0,f.useCallback)(a=>{a.currentTarget.classList.remove("ring-2","ring-brand")},[]),aB=(0,f.useCallback)(a=>{a.preventDefault(),a.currentTarget.classList.remove("ring-2","ring-brand")},[]),aC=(0,f.useCallback)(a=>{a.currentTarget.style.opacity="1";let b=ap.current,c=aq.current;if(ap.current=null,aq.current=null,!b||!c||b===c)return;let d=ar.current.map(a=>a.data.id),e=d.indexOf(b),f=d.indexOf(c);if(-1===e||-1===f)return;let g=[...d];g[e]=c,g[f]=b,Q(g)},[Q]),aD=(0,f.useCallback)(a=>{Y(b=>b===a?null:a)},[]),aE=_>0?Math.floor((_-32-12)/2-41):void 0;return(0,e.jsxs)("div",{ref:al,className:"h-full flex flex-col bg-background relative",children:[(0,e.jsx)("div",{ref:w,onScroll:au,className:`flex-1 overflow-y-auto ${X?"":"py-4 px-4"}`,children:0===v.length?(0,e.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:u("console.enterCommandOrUrl")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{ref:am}),R&&(0,e.jsx)("div",{className:"flex justify-center mb-4",children:(0,e.jsx)("button",{onClick:()=>S(T+1),disabled:U,className:"px-4 py-2 text-sm text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors disabled:opacity-50",children:u(U?"console.loadingMore":"console.loadMoreHistory")})}),(0,e.jsx)("div",{className:X?"flex flex-col gap-3":ab?"grid grid-cols-2 gap-3":"flex flex-col gap-3",children:v.map(b=>{let d={draggable:!0,onDragStart:a=>ax(a,b.data.id),onDragOver:a=>ay(a,b.data.id),onDragEnter:az,onDragLeave:aA,onDrop:aB,onDragEnd:aC};if("command"===b.type){let f=b.data;return(0,e.jsx)("div",{"data-bubble-id":f.id,className:"group/cmd rounded-lg transition-shadow",...d,children:(0,e.jsx)(h.G,{commandId:f.id,tabId:c,projectCwd:a,command:f.command,output:f.output,exitCode:f.exitCode,isRunning:f.isRunning,selected:x===f.id,onSelect:()=>{y(f.id)},onInterrupt:f.isRunning?()=>z(f.id):void 0,onStdin:f.isRunning?a=>A(f.id,a):void 0,onDelete:()=>{f.isRunning&&f.pid&&(0,n.HV)(f.pid),B(f.id)},onRerun:()=>C(f.id),timestamp:f.timestamp,usePty:f.usePty,subscribePtyOutput:f.usePty?V:void 0,subscribePtyReset:f.usePty?W:void 0,onPtyResize:(a,b)=>{D.current.set(f.id,{cols:a,rows:b}),E(f.id,a,b)},onToggleMaximize:()=>aD(f.id),maximized:X===f.id,expandedHeight:Z,bubbleContentHeight:aE,onTitleMouseDown:aw})},f.id)}let f=(0,o.sd)(b.type);if(!f)return null;let g=f.Component,i=b.data;return(0,e.jsx)("div",{"data-bubble-id":i.id,className:"rounded-lg transition-shadow",...d,children:(0,e.jsx)(g,{item:i,selected:x===i.id,maximized:X===i.id,expandedHeight:Z,bubbleContentHeight:aE,timestamp:i.timestamp,onSelect:()=>{y(i.id)},onClose:()=>H(i.id),onToggleMaximize:()=>aD(i.id),onTitleMouseDown:aw,extra:{addBrowserItem:(a,b)=>G("browser",a,b),initialSleeping:I.has(i.id),onSleep:J,onWake:K}})},i.id)})}),(0,e.jsx)("div",{ref:an})]})}),!X&&v.length>0&&(0,e.jsx)(l.w,{showTop:ah,showBottom:aj,onScrollTop:av,onScrollBottom:L}),(0,e.jsx)(k.D,{cwd:a,currentCwd:M,commandHistoryRef:N,gridLayout:ab,onGridLayoutChange:b=>{ac(b),p.t4.runFork((0,r.Yn)({cwd:a,settings:{gridLayout:b}}).pipe(q.tapError(a=>q.sync(()=>console.error("Failed to save project settings:",a))),q.orElse(()=>q.void)))},onExecute:F,onAddPluginItem:G,onShowEnvManager:()=>ae(!0),onOpenZsh:()=>F("zsh"),onOpenNote:s}),ad&&(0,e.jsx)(i.v,{cwd:a,tabId:c,onClose:()=>ae(!1),onSave:a=>O(a)}),af&&(0,e.jsx)(j.Y,{onClose:()=>ag(!1),onSave:a=>P(a)})]})}[o,m,h,k]=s.then?(await s)():s,d()}catch(a){d(a)}})},51520:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(48249),e=c(3560),f=c(77016),g=c(74493),h=a([f]);f=(h.then?(await h)():h)[0],(0,e.Aq)({type:"mysql",idPrefix:"mysql",match:a=>a.trim().toLowerCase().startsWith("mysql://"),parse(a){let b=a.trim(),c=b;try{let a=new URL(b),d=a.pathname.replace(/^\//,"")||"mysql";c=`${d}@${a.hostname}${a.port?":"+a.port:""}`}catch{}return{connectionString:b,displayName:c}},fromHistory:a=>({connectionString:a.connectionString,displayName:a.displayName||a.connectionString}),toHistory:a=>({connectionString:a.connectionString,displayName:a.displayName}),Component:function({item:a,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l}){return(0,d.jsx)(f.b,{id:a.id,connectionString:a.connectionString,displayName:a.displayName,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l})},async onClose(a){await (0,g.ax)("mysql",a.id)}}),b()}catch(a){b(a)}})},53036:(a,b,c)=>{"use strict";c.d(b,{I:()=>f});var d=c(48249),e=c(67484);function f(a){let{refreshKey:b,className:c="h-full flex items-center justify-center p-4 bg-secondary",imgClassName:f="max-w-full max-h-full object-contain",alt:g}=a,h="absPath"in a&&"string"==typeof a.absPath,i=h?void 0:a.cwd,j=h?void 0:a.path,k=h?a.absPath:void 0,[l,m]=(0,e.useState)({kind:"loading"});if((0,e.useRef)(0),"loading"===l.kind)return(0,d.jsx)("div",{className:c,children:(0,d.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})});if("missing"===l.kind)return(0,d.jsx)("div",{className:c,children:(0,d.jsx)("div",{className:"text-sm text-muted-foreground",children:"File not found"})});if("too-large"===l.kind)return(0,d.jsx)("div",{className:c,children:(0,d.jsxs)("div",{className:"text-sm text-muted-foreground",children:["Image too large to preview (",Math.round(l.size/1024/1024)," MB)"]})});if("error"===l.kind)return(0,d.jsx)("div",{className:c,children:(0,d.jsx)("div",{className:"text-sm text-red-11",children:l.message})});let n=h?`/api/file?path=${encodeURIComponent(k)}&raw=true`:`/api/files/read?cwd=${encodeURIComponent(i)}&path=${encodeURIComponent(j)}&v=${encodeURIComponent(l.etag)}`;return(0,d.jsx)("div",{className:c,children:(0,d.jsx)("img",{src:n,alt:g??(j||k),className:f})})}c(33281),c(87808)},53113:(a,b,c)=>{Promise.resolve().then(c.bind(c,4462)),Promise.resolve().then(c.bind(c,29491)),Promise.resolve().then(c.bind(c,34001)),Promise.resolve().then(c.bind(c,83179)),Promise.resolve().then(c.bind(c,25608)),Promise.resolve().then(c.bind(c,8077)),Promise.resolve().then(c.bind(c,76552)),Promise.resolve().then(c.bind(c,77120)),Promise.resolve().then(c.bind(c,77220)),Promise.resolve().then(c.bind(c,3588)),Promise.resolve().then(c.bind(c,77462)),Promise.resolve().then(c.bind(c,38878)),Promise.resolve().then(c.bind(c,37129)),Promise.resolve().then(c.bind(c,99033))},53716:(a,b,c)=>{"use strict";c.d(b,{y:()=>l});var d=c(48249),e=c(80600),f=c(33982),g=c(34622),h=c(34948),i=c(26875),j=c(87148),k=c(82633);function l({kind:a,qname:b,className:c}){let m=`${(function(a,b){if("__file__"===b||"__preamble__"===b||b&&b.startsWith("__heading_"))return"text-muted-foreground/60";switch(a){case"function":case"method":return"text-violet-11";case"class":return"text-amber-11";case"interface":return"text-blue-11";default:return"text-muted-foreground/60"}})(a,b)} ${c??""}`.trim();if("__file__"===b)return(0,d.jsx)(e.A,{className:m});if("__preamble__"===b)return(0,d.jsx)(f.A,{className:m});if(b&&b.startsWith("__heading_"))return(0,d.jsx)(g.A,{className:m});switch(a){case"function":case"method":return(0,d.jsx)(h.A,{className:m});case"class":return(0,d.jsx)(i.A,{className:m});case"interface":return(0,d.jsx)(j.A,{className:m});default:return(0,d.jsx)(k.A,{className:m})}}},54038:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{g:()=>k});var e=c(48249),f=c(67484),g=c(44384),h=c(65543),i=c(72529),j=c(53716);function k({functions:a,currentQname:b,onSelect:c}){let{t:d}=(0,g.Bd)(),l=(0,f.useMemo)(()=>a.filter(h._),[a]);return(0,e.jsxs)("div",{className:"w-56 flex-shrink-0 bg-card border-r border-border flex flex-col","data-testid":"file-toc-section",children:[(0,e.jsx)("div",{className:"flex-shrink-0 px-2 py-1.5 border-b border-border text-xs text-muted-foreground font-mono truncate",children:0===l.length?d("blockViewer.toc.title"):`${d("blockViewer.toc.title")} \xb7 ${l.length}`}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===l.length?(0,e.jsx)("div",{className:"px-3 py-4 text-[10px] text-muted-foreground/60 italic leading-relaxed",children:d("blockViewer.toc.empty")}):l.map(a=>{let d=b===a.qualifiedName;return(0,e.jsx)(i.m,{content:`${a.qualifiedName} \xb7 L${a.startLine}`,children:(0,e.jsxs)("button",{onClick:()=>c(a.qualifiedName,a.startLine),className:`w-full text-left px-2 py-1 transition-colors flex items-center gap-1.5 min-w-0 ${d?"bg-brand/15 hover:bg-brand/20":"hover:bg-secondary/60"}`,children:[(0,e.jsx)(j.y,{kind:a.kind,qname:a.qualifiedName,className:"w-3 h-3 flex-shrink-0"}),(0,e.jsx)("span",{className:`text-xs font-mono truncate ${d?"font-semibold text-brand":""}`,children:a.name})]})},a.qualifiedName)})})]})}d()}catch(a){d(a)}})},55287:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Cv:()=>B,XO:()=>z});var e=c(48249),f=c(67484),g=c(44384),h=c(74429),i=c(33281),j=c(87808),k=c(7122),l=c(42140),m=c(38896),n=c(36984),o=c(41051),p=c(70596),q=c(40159),r=c(13512),s=c(9804),t=c(7833),u=c(83377),v=a([r,n,q,m]);[r,n,q,m]=v.then?(await v)():v;let A="white-space:pre;padding:0 12px;min-height:20px;line-height:20px";function w(a){let b=window.getSelection();if(!b?.rangeCount)return null;let c=b.getRangeAt(0),d=c.startContainer;for(;d&&d.parentElement!==a;)d=d.parentElement;if(!d)return null;let e=Array.from(a.children).indexOf(d);if(e<0)return null;let f=document.createRange();f.selectNodeContents(d),f.setEnd(c.startContainer,c.startOffset);let g=f.toString().length;return{line:e,offset:g}}function x(a,b){let c,d=a.children[b.line];if(!d)return;let e=document.createTreeWalker(d,NodeFilter.SHOW_TEXT),f=b.offset;for(;c=e.nextNode();){let a=c.textContent?.length||0;if(f<=a){let a=window.getSelection(),b=document.createRange();b.setStart(c,f),b.collapse(!0),a?.removeAllRanges(),a?.addRange(b);return}f-=a}let g=window.getSelection(),h=document.createRange();h.selectNodeContents(d),h.collapse(!1),g?.removeAllRanges(),g?.addRange(h)}function y(a){return a.map(a=>`<div style="${A}">${a}</div>`).join("")}let B=(0,f.forwardRef)(function({content:a,filePath:b,showLineNumbers:c=!0,showSearch:d=!0,className:m="",cwd:v,enableComments:z=!1,scrollToLine:B=null,scrollToLineAlign:C="center",onScrollToLineComplete:D,highlightKeyword:E=null,visibleLineRef:F,onCmdClick:G,onTokenHover:H,onTokenHoverLeave:I,onTokenHoverCancel:J,blameLines:K,inlineBlameLines:L,onSelectCommit:M,editable:N=!1,initialMtime:O,onEditorClose:P,onSaved:Q,onEditorStateChange:R,viMode:S=!1,onContentMutate:T,onEnterInsertMode:U,onViSave:V,viStateRef:W,initialCursorLine:X,initialCursorCol:Y,onInitialCursorSet:Z,onContentSearch:$},_){let{t:aa}=(0,g.Bd)(),ab=(0,f.useRef)(a),ac=(0,f.useRef)(!1),[ad,ae]=(0,f.useState)(!1),[af,ag]=(0,f.useState)(!1),[ah,ai]=(0,f.useState)(()=>a.split("\n").length),aj=(0,f.useRef)(a.split("\n").length),[ak,al]=(0,f.useState)({show:!1}),am=(0,f.useRef)(null),an=(0,f.useRef)(null),ao=(0,f.useRef)(O),ap=(0,f.useRef)(null),aq=(0,f.useRef)(!1),ar=(0,f.useRef)(!1),{parentRef:as,containerRef:at,searchInputRef:au,floatingToolbarRef:av,suppressHoverRef:aw,bumpToolbarRef:ax,savedSelectionRef:ay,highlightedLines:az,isMounted:aA,cmdHeld:aB,flashLine:aC,isSearchVisible:aD,searchQuery:aE,caseSensitive:aF,wholeWord:aG,currentMatchIndex:aH,viewingComment:aI,addCommentInput:aJ,sendToAIInput:aK,aiBridge:aL,commentsEnabled:aM,updateComment:aN,deleteComment:aO,lines:aP,matches:aQ,rowData:aR,virtualizer:aS,commentsByEndLine:aT,linesWithComments:aU,setIsSearchVisible:aV,setSearchQuery:aW,setCaseSensitive:aX,setWholeWord:aY,setViewingComment:aZ,setAddCommentInput:a$,setSendToAIInput:a_,goToNextMatch:a0,goToPrevMatch:a1,handleSearchKeyDown:a2,handleCommentBubbleClick:a3,handleToolbarAddComment:a4,handleToolbarSendToAI:a5,handleToolbarSearch:a6,handleCommentSubmit:a7,handleSendToAISubmit:a8,getHighlightedLineHtml:a9,suppressMatchScrollRef:ba,inlineBlameLineRef:bb,inlineBlameVersion:bc}=(0,r.d)({content:a,filePath:b,showSearch:d,cwd:v,enableComments:!N&&z,scrollToLine:N?null:B,scrollToLineAlign:N?"center":C,onScrollToLineComplete:N?void 0:D,visibleLineRef:N?void 0:F,onContentSearch:$}),bd=(0,k.iN)(),be=(0,f.useRef)(null),bf=(0,f.useRef)(null),bg=(0,f.useRef)({line:0,col:0}),bh=(0,f.useRef)({line:0,col:0}),bi=(0,u.A)({lines:aP,enabled:S&&!N,onContentChange:a=>{bg.current={line:bh.current.line,col:bh.current.col},T?.(a)},onEnterInsert:(a,b,c)=>{let d=b;if("a"===c)d=b+1;else if("A"===c)d=(aP[a]??"").length;else if("I"===c){let b=(aP[a]??"").search(/\S/);d=b>=0?b:0}else("o"===c||"O"===c)&&(d=0);bg.current={line:a,col:d},U?.(a)},onSave:V,getVisibleLineCount:()=>{let a=as.current;return a?Math.floor(a.clientHeight/20):20},scrollToLine:(a,b)=>{let c=aR.findIndex(b=>"code"===b.type&&b.lineIndex===a);c>=0&&aS.scrollToIndex(c,{align:b||"auto"})},onSearchExecute:a=>{aW(a),aV(!1)},onSearchNext:a0,onSearchPrev:a1,onSearchClear:()=>{aW("")}});(0,f.useEffect)(()=>{W&&(W.current={cursorLine:bi.state.cursorLine,cursorCol:bi.state.cursorCol}),bh.current={line:bi.state.cursorLine,col:bi.state.cursorCol}},[W,bi.state.cursorLine,bi.state.cursorCol]);let bj=(0,f.useRef)(null);(0,f.useEffect)(()=>{S&&!N&&null!=X&&b&&bj.current!==b&&(bj.current=b,bi.setCursorLine(X-1),null!=Y&&bi.setCursorCol(Y-1),Z?.())},[S,N,X,Y,b]),(0,f.useEffect)(()=>{if(!S||N)return;let a=at.current;if(!a)return;let b=a=>{let b=a.target;"TEXTAREA"===b.tagName||"INPUT"===b.tagName||b.isContentEditable||bi.handleKeyDown(a)&&(a.preventDefault(),a.stopPropagation())};return a.addEventListener("keydown",b,!0),()=>a.removeEventListener("keydown",b,!0)},[S,N,bi.handleKeyDown]),(0,f.useEffect)(()=>{if(!S||N)return;let a=at.current;a&&"normal"===bi.state.mode&&requestAnimationFrame(()=>{let b=document.activeElement;b&&("TEXTAREA"===b.tagName||"INPUT"===b.tagName||b.isContentEditable)||a.focus()})},[S,N,bi.state.mode,a]);let bk=(0,f.useCallback)(a=>{if(!S||N)return;let b=a.target.closest("[data-line]");if(b){let c=parseInt(b.getAttribute("data-line"),10);if(!isNaN(c)){bi.setCursorLine(c-1);let d=b.querySelector("[data-code-content]");if(d){let b=document.caretRangeFromPoint(a.clientX,a.clientY);if(b&&d.contains(b.startContainer)){let a,e=document.createTreeWalker(d,NodeFilter.SHOW_TEXT),f=0;for(;a=e.nextNode();){if(a===b.startContainer){f+=b.startOffset;break}f+=a.textContent?.length||0}let g=aP[c-1]??"";bi.setCursorCol(Math.max(0,Math.min(f,Math.max(0,g.length-1))))}}}}let c=a.target;if("TEXTAREA"===c.tagName||"INPUT"===c.tagName||c.isContentEditable)return;let d=at.current;d&&d.focus()},[S,N,bi.setCursorLine,bi.setCursorCol,aP]),bl=(0,f.useCallback)(a=>{S&&!N&&requestAnimationFrame(()=>{let a=window.getSelection(),b=a?.toString().trim();b&&/^\S+$/.test(b)&&(ba.current=!0,aW(b))})},[S,N,aW,ba]);(0,f.useEffect)(()=>{"command"===bi.state.mode?setTimeout(()=>be.current?.focus(),0):"search"===bi.state.mode&&setTimeout(()=>bf.current?.focus(),0)},[bi.state.mode]),(0,f.useEffect)(()=>{let a=as.current;if(!a)return;let b=()=>{(J??I)?.()};return a.addEventListener("mousedown",b),()=>a.removeEventListener("mousedown",b)},[J,I]),(0,f.useEffect)(()=>{aJ||aK?(aw.current=!0,I?.()):av.current||(aw.current=!1)},[aJ,aK,I]),(0,f.useLayoutEffect)(()=>{let a=ay.current;if(!a)return;let b=window.getSelection();if(b&&!b.isCollapsed)return;let c=as.current;if(!c)return;let d=c.querySelector(`[data-line="${a.startLine}"]`),e=c.querySelector(`[data-line="${a.endLine}"]`);if(!d||!e)return;let f=(0,r.o)(d,a.startOffset),g=(0,r.o)(e,a.endOffset);if(f&&g)try{let a=document.createRange();a.setStart(f.node,f.offset),a.setEnd(g.node,g.offset),b?.removeAllRanges(),b?.addRange(a)}catch{}});let bm=(0,f.useCallback)((a,b,c)=>{aw.current||H?.(a,b,c)},[H]),bn=(0,f.useCallback)((a,b)=>{aw.current||G?.(a,b)},[G]),bo=Math.max(4,String(N?ah:aP.length).length),bp=(0,f.useMemo)(()=>{let a=0;for(let b of aP){let c=0;for(let a=0;a<b.length;a++)" "===b[a]?c+=2-c%2:c+=1;c>a&&(a=c)}return a},[aP]);(0,f.useEffect)(()=>{if(N){ab.current=a;let b=a.split("\n").length;aj.current=b,ai(b),ac.current=!1,ae(!1),al({show:!1}),ao.current=O}},[N,a,O]),(0,f.useEffect)(()=>{if(!N)return;let b=am.current;if(!b)return;let c=a.split("\n"),d=c.map((a,b)=>az[b]||(0,n.ZD)(a||" "));b.innerHTML=y(d),requestAnimationFrame(()=>{let a,d;S?(a=Math.max(0,Math.min(bg.current.line,c.length-1)),d=bg.current.col):(a=Math.max(0,Math.min((F?.current??1)-1,c.length-1)),d=0),b.focus(),x(b,{line:a,offset:d});let e=F?.current??1;an.current&&(an.current.scrollTop=(e-1)*20)})},[N]),(0,f.useEffect)(()=>{N&&R?.({isDirty:ad,isSaving:af})},[N,ad,af,R]);let bq=(0,f.useCallback)(()=>{let a=am.current;if(!a)return ab.current;let b=[];for(let c of a.childNodes){let a=c.textContent||"";b.push(" "===a?"":a)}return b.join("\n")},[]),br=(0,f.useCallback)(()=>{ap.current&&clearTimeout(ap.current),ap.current=setTimeout(async()=>{let a=am.current;if(a&&!ar.current){ab.current=bq();try{let c=await (0,n.kS)(),d=(0,n.sQ)(b),e=document.documentElement.classList.contains("dark"),f=ab.current.split("\n"),g=c.codeToTokens(f.join("\n"),{lang:d,theme:e?"github-dark":"github-light"}).tokens.map(a=>(0,n.b8)(a)),h=w(a);aq.current=!0,a.innerHTML=y(g),aq.current=!1,h&&x(a,h)}catch{}}},300)},[b,bq]);(0,f.useEffect)(()=>{if(N)return()=>{ap.current&&clearTimeout(ap.current)}},[N]);let bs=(0,f.useCallback)(()=>{let a=am.current;if(!a)return;ac.current||(ac.current=!0,ae(!0));let b=a.children.length;b!==aj.current&&(aj.current=b,ai(b))},[]),bt=(0,f.useCallback)(()=>{aq.current||ar.current||(bs(),br())},[bs,br]),bu=(0,f.useCallback)(a=>{if(!a.nativeEvent.isComposing&&("Tab"===a.key&&(a.preventDefault(),document.execCommand("insertText",!1," ")),"Enter"===a.key)){a.preventDefault();let b=am.current;if(!b)return;let c=window.getSelection();if(!c?.rangeCount)return;let d=c.getRangeAt(0);d.deleteContents();let e=d.startContainer;for(;e&&e.parentElement!==b;)e=e.parentElement;if(!e||!(e instanceof HTMLElement))return;let f=w(b),g=Array.from(b.children).indexOf(e),h=e.textContent||"",i=f?.offset??h.length,j=h.substring(0,i),k=h.substring(i);e.innerHTML=(0,n.ZD)(j||" ");let l=document.createElement("div");l.setAttribute("style",A),l.innerHTML=(0,n.ZD)(k||" "),e.after(l),x(b,{line:g+1,offset:0}),bs(),br()}},[bs,br]),bv=(0,f.useCallback)(a=>{a.preventDefault();let b=a.clipboardData.getData("text/plain");document.execCommand("insertText",!1,b)},[]),bw=(0,f.useCallback)(async(a=!1)=>{if(!v)return;ab.current=bq(),ag(!0);let c=await i.t4.runPromiseExit((0,j.OJ)({cwd:v,path:b,content:ab.current,expectedMtime:a?void 0:ao.current}));if("Failure"===c._tag){console.error("Error saving file:",c.cause),(0,t.oR)(aa("toast.saveFailed"),"error"),ag(!1);return}let d=c.value,e=d.data;if(409===d.status&&e?.conflict){let a=await i.t4.runPromiseExit((0,j.K9)(v,b));"Success"===a._tag&&a.value.ok&&"string"==typeof a.value.data?.content?al({show:!0,diskContent:a.value.data.content}):al({show:!0}),ag(!1);return}if(!d.ok){console.error("Error saving file: status",d.status),(0,t.oR)(aa("toast.saveFailed"),"error"),ag(!1);return}let f=e?.mtime;f&&(ao.current=f),ac.current=!1,ae(!1),al({show:!1}),(0,t.oR)(aa("toast.savedSuccess"),"success"),Q?.(),ag(!1)},[v,b,bq,Q,aa]),bx=(0,f.useCallback)(async()=>{ad&&!af&&await bw(!1)},[ad,af,bw]),by=(0,f.useCallback)(async()=>{al({show:!1}),await bw(!0)},[bw]),bz=(0,f.useCallback)(()=>{if(void 0!==ak.diskContent){ab.current=ak.diskContent;let b=ak.diskContent.split("\n").length;aj.current=b,ai(b);let c=ak.diskContent!==a;ac.current=c,ae(c);let d=am.current;if(d){let a=ak.diskContent.split("\n");d.innerHTML=y(a.map(a=>(0,n.ZD)(a||" "))),br()}}al({show:!1}),Q?.()},[ak.diskContent,a,Q,br]),bA=(0,f.useCallback)(()=>{let a=an.current;return a?Math.floor(a.scrollTop/20)+1:F?.current??1},[F]),bB=(0,f.useCallback)(async()=>{(!ad||await (0,t.lJ)(aa("codeViewer.unsavedConfirm"),{danger:!0,confirmText:aa("codeViewer.discardChanges"),cancelText:aa("codeViewer.continueEditing")}))&&P?.(bA())},[ad,P,bA]);(0,f.useEffect)(()=>{if(!N)return;let a=a=>{(a.metaKey||a.ctrlKey)&&"s"===a.key&&(a.preventDefault(),bx())};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[N,bx]);let bC=(0,f.useCallback)(()=>{let a=bq();T?.(a);let b=am.current,c=b?w(b):null,d=bA();if(bi.enterNormal(),c){bi.setCursorLine(c.line);let b=a.split("\n")[c.line]??"";bi.setCursorCol(Math.max(0,Math.min(c.offset,Math.max(0,b.length-1))))}else bi.setCursorLine(Math.max(0,d-1));P?.(d)},[bq,T,bA,P,bi]);(0,f.useEffect)(()=>{if(!N)return;let a=a=>{let b="Escape"===a.key,c=a.ctrlKey&&"c"===a.key&&!a.metaKey&&!a.shiftKey;(b||S&&c)&&(a.preventDefault(),a.stopPropagation(),S?ac.current?(0,t.lJ)(aa("codeViewer.unsavedExitConfirm"),{danger:!0,confirmText:aa("codeViewer.discardChanges"),cancelText:aa("codeViewer.continueEditing")}).then(a=>{a&&bC()}):bC():bB())};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[N,S,bB,bC]);let bD=(0,f.useCallback)(()=>{ac.current||(ac.current=!0,ae(!0))},[]);(0,f.useImperativeHandle)(_,()=>({save:bx,close:bB,markDirty:bD,get isDirty(){return ac.current},get isSaving(){return af}}),[bx,bB,bD,af]);let bE=!!(K&&K.length>0),bF=(0,f.useMemo)(()=>{if(!K)return new Map;let a=[...new Set(K.map(a=>a.author))],b=new Map;return a.forEach((a,c)=>{b.set(a,q.j[c%q.j.length])}),b},[K]),[bG,bH]=(0,f.useState)(null),[bI,bJ]=(0,f.useState)(null);(0,f.useEffect)(()=>{bH(null),bJ(null)},[K]);let bK=(0,f.useCallback)((a,b)=>{bH(a.author);let c=b.currentTarget.getBoundingClientRect();bJ({line:a,x:c.right+8,y:c.top})},[]),bL=(0,f.useCallback)(()=>{bH(null),bJ(null)},[]),bM=(0,f.useCallback)(a=>{if(!M)return;let b={hash:a.hashFull,shortHash:a.hash,author:a.author,authorEmail:a.authorEmail,date:new Date(1e3*a.time).toISOString(),subject:a.message.split("\n")[0]||"",body:a.message.split("\n").slice(1).join("\n").trim(),time:a.time};M(b),bJ(null)},[M]),bN=`${bo+2}ch`;return(0,e.jsxs)("div",{ref:at,className:`h-full flex flex-col outline-none ${m}`,tabIndex:0,onClick:bk,onDoubleClick:bl,children:[N&&ak.show&&(0,e.jsxs)("div",{className:"px-4 py-2 bg-amber-500/15 border-b border-amber-500/30 flex items-center gap-3 flex-shrink-0",children:[(0,e.jsx)("svg",{className:"w-5 h-5 text-amber-500 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})}),(0,e.jsx)("span",{className:"text-sm text-foreground flex-1",children:aa("codeViewer.fileModifiedExternally")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:bz,className:"px-3 py-1 text-sm rounded border border-border hover:bg-accent transition-colors",children:aa("codeViewer.useDiskVersion")}),(0,e.jsx)("button",{onClick:by,className:"px-3 py-1 text-sm rounded bg-amber-500 text-white hover:bg-amber-600 transition-colors",children:aa("codeViewer.forceOverwrite")})]})]}),!N&&d&&aD&&(0,e.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-secondary border-b border-border",children:[(0,e.jsx)("input",{ref:au,type:"text",value:aE,onChange:a=>aW(a.target.value),onKeyDown:a2,placeholder:aa("codeViewer.searchPlaceholder"),className:"flex-1 max-w-xs px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),(0,e.jsx)("button",{onClick:()=>aX(!aF),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${aF?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-accent"}`,title:aa("codeViewer.caseSensitive"),children:"Aa"}),(0,e.jsx)("button",{onClick:()=>aY(!aG),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${aG?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-accent"}`,title:aa("codeViewer.wholeWordMatch"),children:"[ab]"}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:aQ.length>0?`${aH+1}/${aQ.length}`:aa("common.noMatch")}),(0,e.jsx)("button",{onClick:a1,disabled:0===aQ.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:aa("common.previous"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}),(0,e.jsx)("button",{onClick:a0,disabled:0===aQ.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:aa("common.next"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),(0,e.jsx)("button",{onClick:()=>{aV(!1),aW("")},className:"p-1 rounded hover:bg-accent",title:aa("common.close"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),N?(0,e.jsx)("div",{ref:an,className:"flex-1 overflow-auto bg-secondary",children:(0,e.jsxs)("div",{className:"flex",style:{minHeight:"100%"},children:[(0,e.jsx)("div",{className:"flex-shrink-0 font-mono text-sm select-none sticky left-0 z-[2] bg-secondary",style:{width:bN},children:Array.from({length:ah},(a,b)=>(0,e.jsx)("div",{className:"text-right text-muted-foreground/50 pr-3",style:{height:20,lineHeight:"20px"},children:b+1},b))}),(0,e.jsx)("div",{ref:am,contentEditable:!0,suppressContentEditableWarning:!0,onInput:bt,onKeyDown:bu,onPaste:bv,onCompositionStart:()=>{ar.current=!0},onCompositionEnd:()=>{ar.current=!1,bt()},spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",className:"flex-1 font-mono text-sm outline-none",style:{caretColor:"var(--foreground)",tabSize:2}})]})}):(0,e.jsx)("div",{ref:as,className:`flex-1 overflow-auto font-mono text-sm bg-secondary${aB?" cmd-held-container":""}`,children:(0,e.jsx)("div",{style:{height:`${aS.getTotalSize()}px`,minWidth:"100%",width:bE?`calc(${bo+bp+10}ch + 13rem)`:`${bo+bp+10}ch`,position:"relative"},children:aS.getVirtualItems().map(a=>{let b=aR[a.index];if("code"!==b.type)return null;let d=b.lineIndex,f=d+1,g=az[d]||(0,n.ZD)(aP[d]||""),h=a9(d,g,E),i=aU.has(f),j=aT.get(f),k=j?.[0],l=!!(aJ&&f>=aJ.range.start&&f<=aJ.range.end),m=bc>=0?bb.current:null,o=!N&&L&&m===f?L[d]??null:null,p=bE?K[d]:void 0,r=bE&&d>0?K[d-1]:void 0,s=!!p&&(!r||r.hash!==p.hash),t=p?bF.get(p.author):void 0;return(0,e.jsx)(q.S,{virtualKey:a.key,lineNum:f,highlightedHtml:h,hasComments:i,firstComment:k,lineCommentsCount:j?.length,isInRange:l,showLineNumbers:c,lineNumChars:bo,commentsEnabled:aM,virtualItemSize:a.size,virtualItemStart:a.start,onCommentBubbleClick:a3,onCmdClick:bn,onTokenHover:bm,onTokenHoverLeave:I,flashLine:aC,blameLine:p,showBlameInfo:s,blameAuthorColor:t,isBlameHovered:!!(p&&bG===p.author),onBlameClick:bM,onBlameMouseEnter:bK,onBlameMouseLeave:bL,inlineBlameData:o,onInlineBlameClick:bM,isCursorLine:S&&!N&&bi.state.cursorLine===d,cursorCol:S&&!N&&bi.state.cursorLine===d?bi.state.cursorCol:void 0},a.key)})})}),S&&(0,e.jsxs)("div",{className:"vi-status-bar flex-shrink-0 h-6 bg-card border-t border-border flex items-center px-3 text-xs font-mono select-none",children:["normal"===bi.state.mode&&(0,e.jsx)("span",{className:"text-green-11 font-medium",children:"NORMAL"}),"insert"===bi.state.mode&&(0,e.jsx)("span",{className:"text-blue-11 font-medium",children:"INSERT"}),"command"===bi.state.mode&&(0,e.jsxs)("div",{className:"flex items-center flex-1",children:[(0,e.jsx)("span",{className:"text-foreground",children:":"}),(0,e.jsx)("input",{ref:be,value:bi.state.commandInput,onChange:a=>bi.setCommandInput(a.target.value),onKeyDown:a=>{if(a.nativeEvent.isComposing)return;let b=a.ctrlKey&&"c"===a.key&&!a.metaKey&&!a.shiftKey;("Enter"===a.key||"Escape"===a.key||b)&&(a.preventDefault(),a.stopPropagation(),bi.handleKeyDown(a.nativeEvent))},className:"flex-1 bg-transparent outline-none text-foreground ml-0.5",spellCheck:!1,autoComplete:"off"})]}),"search"===bi.state.mode&&(0,e.jsxs)("div",{className:"flex items-center flex-1",children:[(0,e.jsx)("span",{className:"text-foreground",children:"/"}),(0,e.jsx)("input",{ref:bf,value:bi.state.searchInput,onChange:a=>bi.setSearchInput(a.target.value),onKeyDown:a=>{if(a.nativeEvent.isComposing)return;let b=a.ctrlKey&&"c"===a.key&&!a.metaKey&&!a.shiftKey;("Enter"===a.key||"Escape"===a.key||b)&&(a.preventDefault(),a.stopPropagation(),bi.handleKeyDown(a.nativeEvent))},className:"flex-1 bg-transparent outline-none text-foreground ml-0.5",spellCheck:!1,autoComplete:"off"})]}),bi.state.keyBuffer&&"normal"===bi.state.mode&&(0,e.jsx)("span",{className:"ml-2 text-muted-foreground",children:bi.state.keyBuffer}),bi.state.isDirty&&("normal"===bi.state.mode||"command"===bi.state.mode)&&(0,e.jsx)("span",{className:"ml-2 text-amber-11",children:"[+]"}),(0,e.jsxs)("span",{className:"ml-auto text-muted-foreground",children:[bi.state.cursorLine+1,":",bi.state.cursorCol+1]})]}),aA&&bd&&(0,h.createPortal)((0,e.jsxs)(e.Fragment,{children:[!N&&(0,e.jsx)(o.f,{floatingToolbarRef:av,bumpRef:ax,container:bd,onAddComment:a4,onSendToAI:a5,onSearch:$?a6:void 0,isChatLoading:aL?.isLoading}),!N&&aJ&&(0,e.jsx)(l.t,{x:aJ.x,y:aJ.y,range:aJ.range,codeContent:aJ.codeContent,container:bd,onSubmit:a7,onClose:()=>a$(null)}),!N&&aK&&(0,e.jsx)(l.G,{x:aK.x,y:aK.y,range:aK.range,filePath:b,codeContent:aK.codeContent,container:bd,onSubmit:a8,onClose:()=>a_(null),isChatLoading:aL?.isLoading}),!N&&aI&&(0,e.jsx)(p.t,{x:aI.x,y:aI.y,comment:aI.comment,container:bd,onClose:()=>aZ(null),onUpdateComment:aN,onDeleteComment:aO}),bI&&(0,e.jsxs)("div",{className:"fixed z-50 bg-card border border-border rounded-lg shadow-lg p-3 max-w-lg",style:{left:Math.min(bI.x,window.innerWidth-450),top:Math.max(8,Math.min(bI.y,window.innerHeight-200))},children:[(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[(0,e.jsx)("div",{className:"px-2 py-0.5 rounded text-xs font-mono font-medium text-white flex-shrink-0",style:{backgroundColor:bF.get(bI.line.author)?.border||"#666"},children:bI.line.hash}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-foreground",children:bI.line.author}),(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:bI.line.authorEmail})]})]}),(0,e.jsx)("div",{className:"mt-2 text-sm text-foreground whitespace-pre-wrap max-h-48 overflow-y-auto",children:bI.line.message}),(0,e.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground border-t border-border pt-2",children:[(0,s.fw)(bI.line.time)," \xb7 ",new Date(1e3*bI.line.time).toLocaleString(),(0,e.jsx)("span",{className:"ml-2 text-brand",children:aa("codeViewer.clickToViewDetails")})]})]})]}),bd)]})});function z({content:a,filePath:b,className:c=""}){let d=(0,f.useMemo)(()=>a.split("\n"),[a]),g=(0,m.C)(d,b),h=Math.max(4,String(d.length).length);return(0,e.jsx)("pre",{className:`overflow-auto text-sm font-mono bg-secondary p-2 ${c}`,children:d.map((a,b)=>(0,e.jsxs)("div",{className:"flex",children:[(0,e.jsx)("span",{className:"text-slate-9 select-none pr-4 text-right",style:{minWidth:`${h+2}ch`},children:b+1}),(0,e.jsx)("span",{className:"flex-1",dangerouslySetInnerHTML:{__html:g[b]||(0,n.ZD)(a||" ")}})]},b))})}d()}catch(a){d(a)}})},55579:(a,b,c)=>{"use strict";c.d(b,{w:()=>f});var d=c(48249),e=c(44384);function f({showTop:a,showBottom:b,onScrollTop:c,onScrollBottom:g}){let{t:h}=(0,e.Bd)();return(0,d.jsxs)(d.Fragment,{children:[a&&(0,d.jsx)("button",{onClick:c,className:"absolute top-2 left-1/2 -translate-x-1/2 p-2 bg-card text-muted-foreground hover:text-foreground shadow-md rounded-full transition-all hover:shadow-lg active:scale-95 z-10",title:h("chat.jumpToStart"),children:(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}),b&&(0,d.jsx)("button",{onClick:g,className:"absolute bottom-20 left-1/2 -translate-x-1/2 p-2 bg-card text-muted-foreground hover:text-foreground shadow-md rounded-full transition-all hover:shadow-lg active:scale-95 z-10",title:h("chat.jumpToLatest"),children:(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})}},55632:(a,b,c)=>{"use strict";c.d(b,{EmptyState:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call EmptyState() from the server but EmptyState is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/EmptyState.tsx","EmptyState")},56696:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{M:()=>r});var e=c(48249),f=c(67484),g=c(44256),h=c(36295),i=c(7833),j=c(28602),k=c(44384),l=c(74493),m=a([h]);h=(m.then?(await m)():m)[0];let w=[{value:"=",label:"="},{value:"!=",label:"≠"},{value:">",label:">"},{value:"<",label:"<"},{value:">=",label:"≥"},{value:"<=",label:"≤"},{value:"LIKE",label:"LIKE"},{value:"NOT LIKE",label:"NOT LIKE"},{value:"IN",label:"IN"},{value:"IS NULL",label:"IS NULL"},{value:"IS NOT NULL",label:"IS NOT NULL"}];function n(a){if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`}function o(a){return`"${a.replace(/"/g,'""')}"`}function p(a){return null==a?"":"object"==typeof a?JSON.stringify(a):String(a)}function q({text:a}){let[b,c]=(0,f.useState)(!1),[d,h]=(0,f.useState)({x:0,y:0,maxW:600,maxH:300,above:!0}),i=(0,f.useRef)(null),j=(0,f.useRef)(null),k=(0,f.useRef)(!1),l=(0,g.F2)(),m=(0,f.useCallback)(()=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{k.current||c(!1)},80)},[]),n=(0,f.useCallback)(()=>{j.current&&clearTimeout(j.current),k.current=!1,j.current=setTimeout(()=>{let a=i.current;if(!a||a.scrollWidth<=a.clientWidth)return;let b=a.getBoundingClientRect(),d=l?.getBoundingClientRect(),e=d?.left??0,f=d?.top??0,g=d?.width??window.innerWidth,j=d?.height??window.innerHeight,k=b.left-e,m=b.top-f,n=b.bottom-f,o=Math.min(600,g-k-8),p=o<200?Math.max(8,g-600-8):k,q=o<200?Math.min(600,g-16):o,r=m-8,s=j-n-8,t=r>s&&r>80,u=t?r-4:s-4;h({x:p,y:t?m-4:n+4,maxW:q,maxH:Math.max(60,u),above:t}),c(!0)},350)},[l]),o=(0,f.useCallback)(()=>{m()},[m]),p=(0,f.useCallback)(()=>{k.current=!0,j.current&&clearTimeout(j.current)},[]),r=(0,f.useCallback)(()=>{k.current=!1,m()},[m]);return(0,e.jsxs)("span",{ref:i,className:"block truncate",onMouseEnter:n,onMouseLeave:o,children:[a,b&&(0,e.jsx)(g.ZL,{children:(0,e.jsx)("div",{className:"fixed z-[9999] overflow-y-auto px-2 py-1.5 text-xs font-mono bg-popover text-popover-foreground border border-border rounded shadow-lg whitespace-pre-wrap break-all select-text cursor-text",style:{left:d.x,top:d.y,maxWidth:d.maxW,maxHeight:d.maxH,transform:d.above?"translateY(-100%)":void 0},onMouseEnter:p,onMouseLeave:r,children:function(a){try{let b=JSON.parse(a);if("object"==typeof b&&null!==b)return JSON.stringify(b,null,2)}catch{}return a}(a)})})]})}function r({id:a,connectionString:b,displayName:c,selected:d,maximized:g,expandedHeight:m,bubbleContentHeight:t,onSelect:w,onClose:x,onToggleMaximize:y,timestamp:z,onTitleMouseDown:A}){let{t:B}=(0,k.Bd)(),{showToast:C}=(0,i.dj)(),[D,E]=(0,f.useState)("connecting"),[F,G]=(0,f.useState)(""),[H,I]=(0,f.useState)([]),[J,K]=(0,f.useState)("public"),[L,M]=(0,f.useState)([]),[N,O]=(0,f.useState)(null),[P,Q]=(0,f.useState)("table"),[R,S]=(0,f.useState)("data"),[T,U]=(0,f.useState)([]),[V,W]=(0,f.useState)([]),[X,Y]=(0,f.useState)([]),[Z,$]=(0,f.useState)([]),[_,aa]=(0,f.useState)(null),[ab,ac]=(0,f.useState)(0),[ad,ae]=(0,f.useState)(!1),[af,ag]=(0,f.useState)(0),[ah,ai]=(0,f.useState)(new Set),[aj,ak]=(0,f.useState)(!1),[al,am]=(0,f.useState)(null),[an,ao]=(0,f.useState)({}),[ap,aq]=(0,f.useState)(!1),[ar,as]=(0,f.useState)({}),[at,au]=(0,f.useState)({}),[av,aw]=(0,f.useState)(null),[ax,ay]=(0,f.useState)(""),[az,aA]=(0,f.useState)(null),[aB,aC]=(0,f.useState)(""),[aD,aE]=(0,f.useState)(!1),aF=(0,f.useRef)(null),aG=(0,f.useCallback)(async()=>{E("connecting"),G("");try{let c=await (0,l.GW)("/api/db/connect",{id:a,connectionString:b});I(c.schemas||[]),c.schemas?.length>0&&!c.schemas.includes("public")&&K(c.schemas[0]),E("connected")}catch(a){G(a instanceof Error?a.message:String(a)),E("error")}},[a,b]),aH=(0,f.useCallback)(async()=>{if("connected"===D)try{let c=await (0,l.Ey)("/api/db/schemas",{id:a,connectionString:b,schema:J});M(c.tables||[])}catch{}},[a,b,J,D]),aI=(0,f.useCallback)(async(c,d,e,f)=>{ae(!0);let g=e??at,h=void 0!==f?f:av;try{let e=`${o(J)}.${o(c)}`,{where:f,params:i}=function(a){let b=[],c=[],d=1;for(let[e,f]of Object.entries(a)){if(!f.enabled)continue;let a=o(e);if("IS NULL"===f.op)b.push(`${a} IS NULL`);else if("IS NOT NULL"===f.op)b.push(`${a} IS NOT NULL`);else if("IN"===f.op){let e=f.value.split(",").map(a=>a.trim()).filter(Boolean);if(0===e.length)continue;let g=e.map(a=>(c.push(a),`$${d++}`));b.push(`${a}::text IN (${g.join(", ")})`)}else"LIKE"===f.op||f.op,b.push(`${a}::text ${f.op} $${d++}`),c.push(f.value)}return{where:b.length>0?` WHERE ${b.join(" AND ")}`:"",params:c}}(g),j=h?` ORDER BY ${o(h.column)} ${h.dir}`:"",k=`SELECT * FROM ${e}${f}${j} LIMIT 50 OFFSET ${50*d}`,m=await (0,l.GW)("/api/db/query",{id:a,connectionString:b,sql:k,params:i});aa(m);let n=`SELECT count(*)::int AS cnt FROM ${e}${f}`,p=await (0,l.GW)("/api/db/query",{id:a,connectionString:b,sql:n,params:i});ag(p.rows?.[0]?.cnt??0)}catch{}ae(!1)},[a,b,J,at,av]),aJ=(0,f.useCallback)(async c=>{O(c),ac(0),am(null),aq(!1),ai(new Set),ak(!1),au({}),aw(null);try{let d=await (0,l.Ey)("/api/db/columns",{id:a,connectionString:b,schema:J,table:c});U(d.columns||[]),W(d.primaryKeys||[]),Y(d.foreignKeys||[]),$(d.indexes||[])}catch{}aI(c,0,{},null)},[a,b,J,aI]),aK=(0,f.useCallback)(async()=>{if(ax.trim()){aE(!0),aC(""),aA(null);try{let c=await (0,l.GW)("/api/db/query",{id:a,connectionString:b,sql:ax});aA(c)}catch(a){aC(a instanceof Error?a.message:String(a))}aE(!1)}},[a,b,ax]),aL=(0,f.useCallback)(async()=>{if(null===al||!_||!N)return;let c=_.rows[al],d=[],e=[],f=1;for(let a of T)void 0!==an[a.name]&&an[a.name]!==p(c[a.name]??"")&&(d.push(`${o(a.name)} = $${f}`),e.push(""===an[a.name]&&a.nullable?null:an[a.name]),f++);if(0===d.length)return void am(null);let g=V.length>0?V:T.map(a=>a.name),h=[];for(let a of g)null===c[a]||void 0===c[a]?h.push(`${o(a)} IS NULL`):(h.push(`${o(a)} = $${f}`),e.push(c[a]),f++);let i=`UPDATE ${o(J)}.${o(N)} SET ${d.join(", ")} WHERE ${h.join(" AND ")}`;try{await (0,l.GW)("/api/db/query",{id:a,connectionString:b,sql:i,params:e}),am(null),aI(N,ab,at,av)}catch(a){alert(`Update failed: ${a instanceof Error?a.message:String(a)}`)}},[al,_,N,T,V,an,a,b,J,aI,ab,at,av]),aM=(0,f.useCallback)(async()=>{if(!N)return;let c=[],d=[],e=[],f=1;for(let a of T)void 0!==ar[a.name]&&""!==ar[a.name]&&(c.push(o(a.name)),d.push(ar[a.name]),e.push(`$${f}`),f++);if(0===c.length)return;let g=`INSERT INTO ${o(J)}.${o(N)} (${c.join(", ")}) VALUES (${e.join(", ")})`;try{await (0,l.GW)("/api/db/query",{id:a,connectionString:b,sql:g,params:d}),aq(!1),as({}),aI(N,ab,at,av)}catch(a){alert(`Insert failed: ${a instanceof Error?a.message:String(a)}`)}},[N,T,ar,a,b,J,aI,ab,at,av]),aN=(0,f.useCallback)(async()=>{if(0===ah.size||!_||!N)return;let c=V.length>0?V:T.map(a=>a.name),d=0;for(let e of Array.from(ah).sort((a,b)=>b-a)){let f=_.rows[e];if(!f)continue;let g=[],h=[],i=1;for(let a of c)null===f[a]||void 0===f[a]?g.push(`${o(a)} IS NULL`):(g.push(`${o(a)} = $${i}`),h.push(f[a]),i++);let j=`DELETE FROM ${o(J)}.${o(N)} WHERE ctid = (SELECT ctid FROM ${o(J)}.${o(N)} WHERE ${g.join(" AND ")} LIMIT 1)`;try{await (0,l.GW)("/api/db/query",{id:a,connectionString:b,sql:j,params:h})}catch{d++}}ai(new Set),ak(!1),aI(N,ab,at,av),d>0&&alert(B("database.deleteRowsFailed",{count:d}))},[ah,_,N,V,T,a,b,J,aI,ab,at,av]),aO=(0,f.useCallback)(async c=>{if(!N)return;if(ah.size>0&&_){let a,b=_.fields.map(a=>a.name),d=Array.from(ah).sort((a,b)=>a-b).map(a=>_.rows[a]).filter(Boolean);if("json"===c)a=JSON.stringify(d,null,2);else{let c=[b.join(",")];for(let a of d)c.push(b.map(b=>{let c=a[b];if(null==c)return"";let d="object"==typeof c?JSON.stringify(c):String(c);return d.includes(",")||d.includes('"')||d.includes("\n")?`"${d.replace(/"/g,'""')}"`:d}).join(","));a=c.join("\n")}navigator.clipboard.writeText(a);return}let d=`SELECT * FROM ${o(J)}.${o(N)}`;try{let e=await (0,l.HS)("/api/db/export",{id:a,connectionString:b,sql:d,format:c}),f=URL.createObjectURL(e),g=document.createElement("a");g.href=f,g.download=`${N}.${c}`,g.click(),URL.revokeObjectURL(f)}catch(a){alert(`Export failed: ${a instanceof Error?a.message:String(a)}`)}},[N,a,b,J,ah,_]),aP=(0,f.useCallback)(a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&(a.preventDefault(),aK())},[aK]),aQ=g&&m?m-41:t??h.p,aR=Math.max(1,Math.ceil(af/50)),aS=(0,f.useCallback)(a=>{N&&(ac(a),aI(N,a,at,av))},[N,aI,at,av]),aT=(0,f.useCallback)((a,b)=>{let c={...at};b?c[a]=b:delete c[a],au(c),ac(0),ai(new Set),N&&aI(N,0,c,av)},[at,av,N,aI]),aU=(0,f.useCallback)(()=>{au({}),ac(0),ai(new Set),N&&aI(N,0,{},av)},[av,N,aI]),aV=(0,f.useCallback)(a=>{aw(a),ac(0),ai(new Set),N&&aI(N,0,at,a)},[at,N,aI]);return(0,e.jsx)("div",{className:"flex flex-col items-start",children:(0,e.jsxs)("div",{className:`w-full bg-accent text-foreground
|
|
23
|
+
Error: ${c.message}`,exitCode:1,isRunning:!1,pid:void 0}:d))}},[k,F,t,D,c,a,W,_,X]),ag=(0,e.useCallback)(async b=>{o(a=>a.filter(a=>a.id!==b)),X(b),c&&await i.t4.runPromise((0,j.SN)(a,c,b).pipe(h.tapError(a=>h.sync(()=>console.error("Failed to delete command:",a))),h.orElse(()=>h.void)))},[a,c,X]),ah=(0,e.useCallback)((b,d,e)=>{let f=(0,g.sd)(b);if(!f)return;let k=f.parse(d);"cwd"in k&&!k.cwd&&(k.cwd=t);let l={id:(0,g.lf)(f.idPrefix),_type:b,timestamp:new Date().toISOString(),...k};if(q(a=>[...a,l]),C(l.id),setTimeout(aa,100),e){let b=H&&H.length>0?[...H]:T.current.map(a=>a.data.id),d=b.indexOf(e);-1!==d?b.splice(d+1,0,l.id):b.push(l.id),I(b),c&&i.t4.runFork((0,j.cm)(a,c,b).pipe(h.orElse(()=>h.void)))}if(c){let d=f.toHistory(l);i.t4.runFork((0,j.AJ)(a,c,{type:b,id:l.id,timestamp:l.timestamp,...d}).pipe(h.tapError(a=>h.sync(()=>console.error(`Failed to save ${b} item:`,a))),h.orElse(()=>h.void)))}},[aa,a,c,H]),ai=(0,e.useCallback)(async b=>{let d=p.find(a=>a.id===b);if(q(a=>a.filter(a=>a.id!==b)),C(a=>a===b?null:a),s(a=>{let c=new Set(a);return c.delete(b),c}),d){let a=(0,g.sd)(d._type);a?.onClose?.(d)}c&&i.t4.runFork((0,j.SN)(a,c,b).pipe(h.tapError(a=>h.sync(()=>console.error("Failed to delete plugin item:",a))),h.orElse(()=>h.void)))},[p,a,c]);S.current=ah,R.current=ad;let aj=(0,e.useCallback)((b,d)=>{c&&i.t4.runFork((0,j.bv)(a,c,b,{sleeping:d}).pipe(h.orElse(()=>h.void)))},[a,c]),ak=(0,e.useCallback)(a=>{s(b=>new Set(b).add(a)),aj(a,!0)},[aj]),al=(0,e.useCallback)(a=>{s(b=>{let c=new Set(b);return c.delete(a),c}),aj(a,!1)},[aj]),am=(0,e.useCallback)(async b=>{I(b),c&&await i.t4.runPromise((0,j.cm)(a,c,b).pipe(h.orElse(()=>h.void)))},[a,c]),an=(0,e.useMemo)(()=>{let a=[...k.map(a=>({type:"command",data:a})),...p.map(a=>({type:a._type,data:a}))];if(!H||0===H.length)return a.sort((a,b)=>new Date(a.data.timestamp).getTime()-new Date(b.data.timestamp).getTime());let b=new Map(H.map((a,b)=>[a,b])),c=[],d=[];for(let e of a)b.has(e.data.id)?c.push(e):d.push(e);return c.sort((a,c)=>b.get(a.data.id)-b.get(c.data.id)),d.sort((a,b)=>new Date(a.data.timestamp).getTime()-new Date(b.data.timestamp).getTime()),[...c,...d]},[k,p,H]);return T.current=an,{commands:k,pluginItems:p,sleepingBubbles:r,consoleItems:an,currentCwd:t,selectedCommandId:B,setSelectedCommandId:C,customEnv:D,setCustomEnv:E,aliases:F,setAliases:G,isLoadingHistory:v,hasMoreHistory:x,currentPage:z,scrollRef:U,commandHistoryRef:N,ptySizeRef:O,executeCommandRef:R,executeCommand:ad,interruptCommand:ae,rerunCommand:af,deleteCommand:ag,addPluginItem:ah,closePluginItem:ai,handleBubbleSleep:ak,handleBubbleWake:al,loadHistory:ab,scrollToBottom:aa,saveBubbleOrder:am,sendStdin:f.tr,resizePty:f.mO,subscribePtyOutput:Y,subscribePtyReset:$}}d()}catch(a){d(a)}})},18482:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(48249),e=c(3560),f=c(98420),g=a([f]);f=(g.then?(await g)():g)[0],(0,e.Aq)({type:"browser",idPrefix:"browser",match(a){let b=a.trim().toLowerCase();return b.startsWith("http://")||b.startsWith("https://")},parse:a=>({url:a.trim()}),fromHistory:a=>({url:a.url}),toHistory:a=>({url:a.url}),Component:function({item:a,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l,extra:m}){return(0,d.jsx)(f.V,{id:a.id,url:a.url,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l,onNewTab:m?.addBrowserItem,initialSleeping:m?.initialSleeping,onSleep:m?.onSleep,onWake:m?.onWake})}}),b()}catch(a){b(a)}})},18499:(a,b,c)=>{"use strict";c.d(b,{_:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({collapsed:a,pinnedSessions:b,onSwitchProject:c,onUnpin:h,onUpdateTitle:i,onReorder:j}){let{t:k}=(0,f.Bd)(),[l,m]=(0,e.useState)(!1),n=(0,e.useRef)(null),[o,p]=(0,e.useState)(null),[q,r]=(0,e.useState)(""),s=(0,e.useRef)(null),[t,u]=(0,e.useState)(null),[v,w]=(0,e.useState)(null),x=(0,e.useCallback)(a=>{o||(c(a.cwd,a.sessionId),m(!1))},[c,o]),y=(0,e.useCallback)((a,b)=>{b.stopPropagation(),p(a.sessionId),r(a.customTitle||"")},[]),z=(0,e.useCallback)(()=>{o&&q.trim()&&i(o,q.trim()),p(null)},[o,q,i]),A=(0,e.useCallback)(a=>{u(a)},[]),B=(0,e.useCallback)((a,b)=>{a.preventDefault(),w(b)},[]),C=(0,e.useCallback)(a=>{if(null===t||t===a){u(null),w(null);return}let c=[...b],[d]=c.splice(t,1);c.splice(a,0,d),j(c),u(null),w(null)},[t,b,j]),D=(0,e.useCallback)(()=>{u(null),w(null)},[]);return(0,d.jsxs)("div",{className:"relative",ref:n,children:[(0,d.jsxs)("button",{onClick:()=>m(!l),className:`relative flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${a?"w-full justify-center":"w-full"}`,title:k("sessions.pinnedSessions"),children:[(0,d.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"})}),!a&&(0,d.jsx)("span",{className:"text-sm flex-1 text-left",children:k("sessions.pinnedSessions")}),a&&b.length>0&&(0,d.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] px-1 text-muted-foreground text-xs font-medium rounded-full flex items-center justify-center bg-accent",children:b.length})]}),l&&(0,d.jsxs)("div",{className:"absolute left-full bottom-0 ml-2 w-80 max-h-[450px] bg-popover border border-border rounded-lg shadow-lg z-50 flex flex-col",children:[(0,d.jsx)("div",{className:"px-3 py-2 border-b border-border bg-muted/50 flex-shrink-0 rounded-t-lg",children:(0,d.jsx)("span",{className:"text-sm font-medium",children:k("sessions.pinnedSessions")})}),(0,d.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:0===b.length?(0,d.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:k("sessions.noPinnedSessions")}):b.map((a,c)=>{let e;return(0,d.jsxs)("div",{draggable:!0,onDragStart:()=>A(c),onDragOver:a=>B(a,c),onDrop:()=>C(c),onDragEnd:D,onClick:()=>x(a),className:`group w-full px-3 py-2 text-left hover:bg-accent transition-colors flex items-start gap-2 cursor-pointer ${c!==b.length-1?"border-b border-border/50":""} ${t===c?"opacity-50":""} ${v===c?"border-t-2 border-brand":""}`,children:[(0,d.jsx)("span",{className:"mt-1.5 text-muted-foreground/30 flex-shrink-0 cursor-grab",children:(0,d.jsxs)("svg",{className:"w-3 h-3",viewBox:"0 0 10 16",fill:"currentColor",children:[(0,d.jsx)("circle",{cx:"3",cy:"2",r:"1.5"}),(0,d.jsx)("circle",{cx:"7",cy:"2",r:"1.5"}),(0,d.jsx)("circle",{cx:"3",cy:"8",r:"1.5"}),(0,d.jsx)("circle",{cx:"7",cy:"8",r:"1.5"}),(0,d.jsx)("circle",{cx:"3",cy:"14",r:"1.5"}),(0,d.jsx)("circle",{cx:"7",cy:"14",r:"1.5"})]})}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",title:a.cwd,children:[(0,d.jsx)("div",{className:"flex items-center gap-2",children:(0,d.jsx)("span",{className:"font-medium text-sm truncate",children:(e=a.cwd).split("/").pop()||e})}),o===a.sessionId?(0,d.jsx)("input",{ref:s,type:"text",value:q,onChange:a=>r(a.target.value),onKeyDown:a=>{a.nativeEvent.isComposing||("Enter"===a.key&&z(),"Escape"===a.key&&p(null))},onBlur:z,onClick:a=>a.stopPropagation(),className:"w-full text-xs px-1 py-0.5 border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring mt-0.5"}):(0,d.jsx)("div",{className:"text-xs text-foreground/80 truncate",children:a.customTitle||a.sessionId.slice(0,8)})]}),o!==a.sessionId&&(0,d.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity mt-0.5",children:[(0,d.jsx)("button",{onClick:b=>y(a,b),className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground",title:k("sessions.editTitle"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})}),(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),h(a.sessionId)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-destructive",title:k("sessions.remove"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]},a.sessionId)})})]})]})}},18792:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{P:()=>m});var e=c(48249),f=c(67484),g=c(36295),h=c(28602),i=c(74493),j=a([g]);g=(j.then?(await j)():j)[0];let n=["#4C8BF5","#E74C3C","#2ECC71","#F39C12","#9B59B6","#1ABC9C","#E67E22","#3498DB","#E91E63","#00BCD4"];function k(a){if(!a)return"";let b=new Date(a);return isNaN(b.getTime())?"":`${String(b.getMonth()+1).padStart(2,"0")}-${String(b.getDate()).padStart(2,"0")} ${String(b.getHours()).padStart(2,"0")}:${String(b.getMinutes()).padStart(2,"0")}`}function l({nodes:a,rels:b,allLabels:c}){let d=(0,f.useRef)(null),g=(0,f.useRef)(null),h=(0,f.useRef)([]);(0,f.useRef)(0);let i=(0,f.useRef)(null);(0,f.useRef)({w:0,h:0}),(0,f.useRef)(new Map);let[j,k]=(0,f.useState)(null),m=(0,f.useRef)(null),n=(0,f.useCallback)(a=>{let b=g.current?.getBoundingClientRect();if(!b)return null;let c=a.clientX-b.left,d=a.clientY-b.top;return h.current.find(a=>{let b=(a.x||0)-c,e=(a.y||0)-d;return b*b+e*e<400})||null},[]);return(0,e.jsxs)("div",{ref:d,className:"relative w-full h-full",children:[(0,e.jsx)("canvas",{ref:g,className:"cursor-grab active:cursor-grabbing absolute inset-0",onMouseDown:a=>{let b=n(a);if(b){let c=g.current.getBoundingClientRect();i.current={nodeId:b.id,offsetX:a.clientX-c.left-(b.x||0),offsetY:a.clientY-c.top-(b.y||0)}}},onMouseMove:a=>{if(i.current){let b=g.current.getBoundingClientRect(),c=h.current.find(a=>a.id===i.current.nodeId);c&&(c.x=a.clientX-b.left-i.current.offsetX,c.y=a.clientY-b.top-i.current.offsetY,c.vx=0,c.vy=0)}else{let b=n(a);m.current=b,k(b)}},onMouseUp:()=>{i.current=null},onMouseLeave:()=>{i.current=null,m.current=null,k(null)}}),j&&!i.current&&(0,e.jsxs)("div",{className:"absolute top-2 left-2 bg-popover text-popover-foreground border border-border rounded px-2 py-1 text-xs max-w-[300px] pointer-events-none",children:[(0,e.jsxs)("div",{className:"font-medium",children:[j.labels.join(", ")," #",String(j.id)]}),Object.entries(j.properties).slice(0,8).map(([a,b])=>(0,e.jsxs)("div",{className:"truncate",children:[(0,e.jsxs)("span",{className:"text-muted-foreground",children:[a,":"]})," ",String(b)]},a))]})]})}function m({id:a,connectionString:b,displayName:c,selected:d,maximized:j,expandedHeight:o,bubbleContentHeight:p,onSelect:q,onClose:r,onToggleMaximize:s,timestamp:t,onTitleMouseDown:u}){let[v,w]=(0,f.useState)("connecting"),[x,y]=(0,f.useState)(""),[z,A]=(0,f.useState)(null),[B,C]=(0,f.useState)(null),[D,E]=(0,f.useState)(!1),[F,G]=(0,f.useState)("labels"),[H,I]=(0,f.useState)(""),[J,K]=(0,f.useState)(null),[L,M]=(0,f.useState)(!1),[N,O]=(0,f.useState)(""),P=(0,f.useRef)(null),[Q,R]=(0,f.useState)([]),[S,T]=(0,f.useState)([]),[U,V]=(0,f.useState)("schema"),W=j&&o?o-41:p??g.p,X=(0,f.useCallback)(async()=>{w("connecting");try{let c=await (0,i.GW)("/api/neo4j/connect",{id:a,connectionString:b});A(c),w("connected")}catch(a){y(a instanceof Error?a.message:String(a)),w("error")}},[a,b]),Y=(0,f.useCallback)(async()=>{E(!0);try{let c=await (0,i.GW)("/api/neo4j/schema",{id:a,connectionString:b});C(c)}catch{}E(!1)},[a,b]),Z=(0,f.useCallback)(async c=>{let d=c||H.trim();if(d){M(!0),O("");try{var e;let c,f,g=await (0,i.GW)("/api/neo4j/query",{id:a,connectionString:b,cypher:d});K(g);let{nodes:h,rels:j}=(e=g.records,c=new Map,f=[],e.forEach(a=>Object.values(a).forEach(function a(b){if(b&&"object"==typeof b)if("node"===b._type){let a=b._id;c.has(a)||c.set(a,{id:a,labels:b._labels||[],properties:Object.fromEntries(Object.entries(b).filter(([a])=>!a.startsWith("_")))})}else if("relationship"===b._type)f.push({id:b._id,type:b._relType,startId:b._start,endId:b._end,properties:Object.fromEntries(Object.entries(b).filter(([a])=>!a.startsWith("_")))});else if("path"===b._type){let c=b.segments;c?.forEach(b=>{a(b.start),a(b.relationship),a(b.end)})}else Array.isArray(b)&&b.forEach(a)})),{nodes:Array.from(c.values()),rels:f});h.length>0&&(R(h),T(j))}catch(a){O(a instanceof Error?a.message:String(a))}M(!1)}},[a,b,H]),$=(0,f.useCallback)(a=>{let b=`MATCH (n:\`${a}\`) RETURN n LIMIT 25`;I(b),V("cypher"),Z(b)},[Z]),_=(0,f.useCallback)(a=>{let b=`MATCH (a)-[r:\`${a}\`]->(b) RETURN a, r, b LIMIT 25`;I(b),V("graph"),Z(b)},[Z]);return(0,e.jsx)("div",{className:"flex flex-col items-start",onClick:q,children:(0,e.jsxs)("div",{className:`w-full bg-accent text-foreground relative transition-colors ${d?"ring-1 ring-ring":""} rounded-lg overflow-hidden`,children:[(0,e.jsxs)("div",{"data-drag-handle":!0,onDoubleClick:s,onMouseDown:u,className:"flex items-center gap-2 px-4 py-1.5 border-b border-border cursor-grab active:cursor-grabbing select-none",children:[(0,e.jsx)("span",{className:"text-sm flex-shrink-0",children:"⬡"}),(0,e.jsx)("span",{className:"text-xs text-foreground truncate font-mono font-medium",children:c}),"connecting"===v&&(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin flex-shrink-0"}),"connected"===v&&(0,e.jsx)("span",{className:"text-[10px] text-emerald-500 flex-shrink-0",children:"Connected"}),"error"===v&&(0,e.jsx)("span",{className:"text-[10px] text-destructive flex-shrink-0",children:"Error"}),t&&(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:k(t)}),"connected"===v&&z&&(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:["v",z.version," \xb7 ",z.nodeCount.toLocaleString(),"n \xb7 ",z.relationshipCount.toLocaleString(),"r"]}),(0,e.jsx)("span",{className:"flex-1"}),"connected"===v&&(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),Y(),X()},disabled:D,className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0 disabled:opacity-40",title:"Refresh",children:(0,e.jsx)("svg",{className:`w-3.5 h-3.5 ${D?"animate-spin":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),s()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:j?(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 9V4.5M9 9H4.5M9 9L3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5l5.25 5.25"}):(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),r()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsxs)("div",{style:{height:W},className:"flex flex-col overflow-hidden",children:["connecting"===v&&(0,e.jsxs)("div",{className:"flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin"}),"Connecting..."]}),"error"===v&&(0,e.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center text-xs p-4 gap-2",children:[(0,e.jsx)("p",{className:"text-destructive",children:x}),(0,e.jsx)("button",{onClick:X,className:"px-3 py-1 rounded text-xs bg-brand text-white hover:bg-brand/90 transition-colors",children:"Retry"})]}),"connected"===v&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"flex items-center gap-0 border-b border-border bg-card/30 flex-shrink-0",children:["schema","cypher","graph"].map(a=>(0,e.jsx)("button",{onClick:()=>V(a),className:`px-3 py-1.5 text-xs transition-colors ${U===a?"text-brand border-b-2 border-brand font-medium":"text-muted-foreground hover:text-foreground"}`,children:{schema:"Schema",cypher:"Cypher",graph:"Graph"}[a]},a))}),(0,e.jsxs)("div",{className:"flex-1 overflow-hidden flex",children:["schema"===U&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"w-40 flex-shrink-0 border-r border-border flex flex-col overflow-hidden",children:(0,e.jsx)("div",{className:"flex-1 overflow-y-auto text-xs",children:[{key:"labels",label:"Labels",count:B?.labels.length},{key:"relationships",label:"Relationships",count:B?.relationshipTypes.length},{key:"properties",label:"Properties",count:B?.propertyKeys.length},{key:"indexes",label:"Indexes",count:B?.indexes.length},{key:"constraints",label:"Constraints",count:B?.constraints.length}].map(a=>(0,e.jsxs)("div",{onClick:()=>G(a.key),className:`flex items-center gap-1.5 px-2 py-1.5 cursor-pointer truncate transition-colors ${F===a.key?"bg-brand/10 text-brand":"hover:bg-white/10 text-foreground"}`,children:[(0,e.jsx)("span",{className:"truncate min-w-0 flex-1",children:a.label}),(0,e.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground flex-shrink-0",children:a.count??0})]},a.key))})}),(0,e.jsxs)("div",{className:"flex-1 overflow-y-auto text-xs",children:[D&&(0,e.jsxs)("div",{className:"flex items-center justify-center p-4 gap-2 text-muted-foreground",children:[(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin"})," Loading..."]}),!D&&"labels"===F&&B?.labels.map(a=>{var b;return(0,e.jsxs)("div",{onClick:()=>$(a.name),className:"flex items-center gap-1.5 px-2 py-1 cursor-pointer hover:bg-brand/10 transition-colors",children:[(0,e.jsx)("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:(b=a.name,n[B.labels.map(a=>a.name).indexOf(b)%n.length])}}),(0,e.jsx)("span",{className:"truncate min-w-0 flex-1 font-mono",children:a.name}),(0,e.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground flex-shrink-0",children:a.count.toLocaleString()})]},a.name)}),!D&&"relationships"===F&&B?.relationshipTypes.map(a=>(0,e.jsxs)("div",{onClick:()=>_(a.name),className:"flex items-center gap-1.5 px-2 py-1 cursor-pointer hover:bg-brand/10 transition-colors",children:[(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:"→"}),(0,e.jsx)("span",{className:"truncate min-w-0 flex-1 font-mono",children:a.name}),(0,e.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground flex-shrink-0",children:a.count.toLocaleString()})]},a.name)),!D&&"properties"===F&&B?.propertyKeys.map(a=>(0,e.jsx)("div",{className:"px-2 py-1 font-mono text-muted-foreground hover:bg-brand/10 transition-colors",children:a},a)),!D&&"indexes"===F&&B?.indexes.map(a=>(0,e.jsxs)("div",{className:"px-2 py-1 border-b border-border/50 hover:bg-brand/10 transition-colors",children:[(0,e.jsx)("div",{className:"font-mono text-foreground",children:a.name}),(0,e.jsxs)("div",{className:"text-muted-foreground",children:[a.type," \xb7 ",a.labelsOrTypes?.join(", ")," \xb7 (",a.properties?.join(", "),") \xb7 ",a.state]})]},a.name)),!D&&"constraints"===F&&B?.constraints.map(a=>(0,e.jsxs)("div",{className:"px-2 py-1 border-b border-border/50 hover:bg-brand/10 transition-colors",children:[(0,e.jsx)("div",{className:"font-mono text-foreground",children:a.name}),(0,e.jsxs)("div",{className:"text-muted-foreground",children:[a.type," \xb7 ",a.labelsOrTypes?.join(", ")," \xb7 (",a.properties?.join(", "),")"]})]},a.name))]})]}),"cypher"===U&&(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"p-2 border-b border-border flex-shrink-0",children:[(0,e.jsx)("textarea",{ref:P,value:H,onChange:a=>I(a.target.value),onKeyDown:a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&(a.preventDefault(),Z())},placeholder:`Enter Cypher query (${(0,h.Mu)()}+Enter to run)`,className:"w-full h-20 px-2 py-1.5 text-xs font-mono bg-background border border-input rounded resize-y focus:outline-none focus:ring-1 focus:ring-ring",spellCheck:!1}),(0,e.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[(0,h.Mu)(),"+Enter to execute"]}),(0,e.jsx)("button",{onClick:()=>Z(),disabled:L||!H.trim(),className:"px-2 py-1 text-xs bg-brand text-white rounded hover:bg-brand/90 disabled:opacity-50 transition-colors",children:L?"Running...":"Execute"})]})]}),(0,e.jsxs)("div",{className:"flex-1 overflow-auto",children:[N&&(0,e.jsx)("div",{className:"p-2 text-xs text-destructive",children:N}),J&&!N&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"px-2 py-1 text-[10px] text-muted-foreground border-b border-border flex items-center gap-2",children:[(0,e.jsxs)("span",{children:[J.records.length," rows"]}),(0,e.jsxs)("span",{children:[J.duration,"ms"]}),Object.entries(J.counters).filter(([,a])=>a>0).map(([a,b])=>(0,e.jsxs)("span",{children:[a,": ",b]},a))]}),J.records.length>0&&(0,e.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,e.jsx)("thead",{className:"sticky top-0 bg-card z-[1]",children:(0,e.jsx)("tr",{children:J.keys.map(a=>(0,e.jsx)("th",{className:"px-1.5 py-1 text-left text-muted-foreground font-medium border-b border-border whitespace-nowrap font-mono",children:a},a))})}),(0,e.jsx)("tbody",{children:J.records.map((a,b)=>(0,e.jsx)("tr",{className:"hover:bg-accent/50",children:J.keys.map(b=>(0,e.jsx)("td",{className:"px-1.5 py-0.5 border-b border-border/50 font-mono whitespace-nowrap max-w-[200px] truncate",children:null===a[b]?(0,e.jsx)("span",{className:"text-muted-foreground italic",children:"NULL"}):function(a){if(null==a)return"null";if("object"==typeof a){if("node"===a._type){let b=a._labels?.[0]||"",c=a.name||a.title||a.id||"";return`(${b}${c?": "+c:""})`}return"relationship"===a._type?`[${a._relType}]`:JSON.stringify(a)}return String(a)}(a[b])},b))},b))})]})]})]})]}),"graph"===U&&(0,e.jsx)("div",{className:"flex-1 relative",children:0===Q.length?(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-xs text-muted-foreground gap-2",children:[(0,e.jsx)("p",{children:"Run a Cypher query that returns nodes to visualize"}),(0,e.jsx)("button",{onClick:()=>{let a="MATCH (a)-[r]->(b) RETURN a, r, b LIMIT 50";I(a),Z(a)},className:"px-3 py-1 rounded text-xs bg-brand text-white hover:bg-brand/90 transition-colors",children:"Load sample graph"})]}):(0,e.jsx)(l,{nodes:Q,rels:S,allLabels:B?.labels.map(a=>a.name)||[]})})]})]})]}),!j&&(0,e.jsxs)("div",{className:"border-t border-border px-4 py-1.5 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${"connected"===v?"bg-green-500":"error"===v?"bg-red-500":"bg-yellow-500 animate-pulse"}`}),(0,e.jsx)("span",{children:{connecting:"Connecting",connected:"Connected",error:"Error"}[v]}),"connected"===v&&z&&(0,e.jsx)("span",{className:"text-muted-foreground/70",children:z.edition}),(0,e.jsx)("span",{className:"flex-1"}),t&&(0,e.jsx)("span",{className:"text-[11px] flex-shrink-0",children:k(t)})]})]})})}d()}catch(a){d(a)}})},18921:(a,b,c)=>{"use strict";c.d(b,{_:()=>i,o:()=>h});var d=c(67484),e=c.n(d),f=c(208);let g="json-search-highlight-style";function h(a){let[b,c]=(0,d.useState)(!1),[e,f]=(0,d.useState)(""),[h,i]=(0,d.useState)(!1),[j,k]=(0,d.useState)(0),[l,m]=(0,d.useState)(0),n=(0,d.useRef)(null),o=(0,d.useRef)([]);(0,d.useCallback)(()=>{let b;CSS.highlights?.delete("json-search"),CSS.highlights?.delete("json-search-current"),o.current=[];let c=a.current;if(!c||!e){k(0),m(0);return}!function(){if(document.getElementById(g))return;let a=document.createElement("style");a.id=g,a.textContent="::highlight(json-search){background:rgba(217,119,6,.3)}::highlight(json-search-current){background:rgba(217,119,6,.5)}",document.head.appendChild(a)}();let d=c.textContent||"",f=h?e:e.toLowerCase(),i=h?d:d.toLowerCase(),j=[],l=0;for(;l<i.length;){let a=i.indexOf(f,l);if(-1===a)break;j.push([a,a+f.length]),l=a+1}if(0===j.length){k(0),m(0);return}let n=document.createTreeWalker(c,NodeFilter.SHOW_TEXT),p=0,q=0,r=[],s=null,t=0;for(;(b=n.nextNode())&&q<j.length;){let a=b.textContent?.length||0,c=p,d=p+a;for(;q<j.length;){let[a,e]=j[q];if(a>=d)break;if(!s)if(a>=c)(s=document.createRange()).setStart(b,a-c),t=e;else break;if(t<=d)s.setEnd(b,t-c),r.push(s),s=null,q++;else break}p=d}o.current=r,k(r.length),m(a=>r.length>0?Math.min(a,r.length-1):0),CSS.highlights&&r.length>0&&CSS.highlights.set("json-search",new Highlight(...r))},[a,e,h]);let p=(0,d.useCallback)((a,b)=>{let c=a.getBoundingClientRect();(b.top<c.top||b.bottom>c.bottom)&&(a.scrollTop+=b.top-c.top-c.height/2+b.height/2)},[]);(0,d.useCallback)(b=>{CSS.highlights?.delete("json-search-current");let c=o.current[b];if(!c||!CSS.highlights)return;CSS.highlights.set("json-search-current",new Highlight(c));let d=c.getBoundingClientRect(),e=a.current?.parentElement;e&&p(e,d)},[a,p]);let q=(0,d.useCallback)(()=>{0!==j&&m(a=>(a+1)%j)},[j]),r=(0,d.useCallback)(()=>{0!==j&&m(a=>(a-1+j)%j)},[j]),s=(0,d.useCallback)(()=>{c(!0),setTimeout(()=>n.current?.focus(),0)},[]),t=(0,d.useCallback)(()=>{c(!1),f(""),m(0)},[]),u=(0,d.useCallback)(a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?r():q()),"Escape"===a.key&&(a.preventDefault(),t())},[q,r,t]);return{isVisible:b,query:e,setQuery:f,caseSensitive:h,setCaseSensitive:i,matchCount:j,currentIndex:l,searchInputRef:n,open:s,close:t,goToNext:q,goToPrev:r,handleKeyDown:u}}function i({search:a}){return a.isVisible?e().createElement("div",{className:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-secondary border-b border-border"},e().createElement("input",{ref:a.searchInputRef,type:"text",value:a.query,onChange:b=>a.setQuery(b.target.value),onKeyDown:a.handleKeyDown,placeholder:f.A.t("codeViewer.searchPlaceholder"),className:"flex-1 max-w-xs px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),e().createElement("button",{onClick:()=>a.setCaseSensitive(a=>!a),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${a.caseSensitive?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-accent"}`,title:f.A.t("codeViewer.caseSensitive")},"Aa"),e().createElement("span",{className:"text-xs text-muted-foreground"},a.matchCount>0?`${a.currentIndex+1}/${a.matchCount}`:f.A.t("common.noMatch")),e().createElement("button",{onClick:a.goToPrev,disabled:0===a.matchCount,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:f.A.t("common.previous")},e().createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"}))),e().createElement("button",{onClick:a.goToNext,disabled:0===a.matchCount,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:f.A.t("common.next")},e().createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"}))),e().createElement("button",{onClick:a.close,className:"p-1 rounded hover:bg-accent",title:f.A.t("common.close")},e().createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e().createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})))):null}},18946:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{X:()=>i});var e=c(48249),f=c(67484),g=c(58554),h=a([g]);function i({tabId:a,cwd:b,sessionId:c,engine:d,ollamaModel:h,onOllamaModelChange:j,deepseekModel:k,onDeepseekModelChange:l,isActive:m,onStateChange:n,onShowGitStatus:o,onOpenNote:p,onCreateScheduledTask:q,onOpenSession:r,onContentSearch:s}){let t=(0,f.useCallback)(b=>{n(a,{isLoading:b})},[a,n]),u=(0,f.useCallback)(b=>{n(a,{sessionId:b})},[a,n]),v=(0,f.useCallback)(b=>{n(a,{title:b})},[a,n]),w=(0,f.useCallback)(b=>{j?.(a,b)},[a,j]),x=(0,f.useCallback)(b=>{l?.(a,b)},[a,l]);return(0,e.jsx)(g.r,{tabId:a,initialCwd:b,initialSessionId:c,engine:d,ollamaModel:h,onOllamaModelChange:w,deepseekModel:k,onDeepseekModelChange:x,hideHeader:!0,hideSidebar:!0,isActive:m,onLoadingChange:t,onSessionIdChange:u,onTitleChange:v,onShowGitStatus:o,onOpenNote:p,onCreateScheduledTask:q,onOpenSession:r,onContentSearch:s})}g=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},19545:(a,b,c)=>{"use strict";c.d(b,{Qe:()=>f,up:()=>e});var d=c(208);function e(a){return a.storage.markdown.getMarkdown()}function f(){return[{label:d.A.t("slashCommands.heading1"),icon:"H1",description:d.A.t("slashCommands.heading1Desc"),action:a=>a.chain().focus().toggleHeading({level:1}).run()},{label:d.A.t("slashCommands.heading2"),icon:"H2",description:d.A.t("slashCommands.heading2Desc"),action:a=>a.chain().focus().toggleHeading({level:2}).run()},{label:d.A.t("slashCommands.heading3"),icon:"H3",description:d.A.t("slashCommands.heading3Desc"),action:a=>a.chain().focus().toggleHeading({level:3}).run()},{label:d.A.t("slashCommands.bulletList"),icon:"•",description:d.A.t("slashCommands.bulletListDesc"),action:a=>a.chain().focus().toggleBulletList().run()},{label:d.A.t("slashCommands.orderedList"),icon:"1.",description:d.A.t("slashCommands.orderedListDesc"),action:a=>a.chain().focus().toggleOrderedList().run()},{label:d.A.t("slashCommands.taskList"),icon:"☑",description:d.A.t("slashCommands.taskListDesc"),action:a=>a.chain().focus().toggleTaskList().run()},{label:d.A.t("slashCommands.blockquote"),icon:"❝",description:d.A.t("slashCommands.blockquoteDesc"),action:a=>a.chain().focus().toggleBlockquote().run()},{label:d.A.t("slashCommands.codeBlock"),icon:"<>",description:d.A.t("slashCommands.codeBlockDesc"),action:a=>a.chain().focus().toggleCodeBlock().run()},{label:d.A.t("slashCommands.table"),icon:"▦",description:d.A.t("slashCommands.tableDesc"),action:a=>a.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()},{label:d.A.t("slashCommands.horizontalRule"),icon:"──",description:d.A.t("slashCommands.horizontalRuleDesc"),action:a=>a.chain().focus().setHorizontalRule().run()},{label:d.A.t("slashCommands.link"),icon:"\uD83D\uDD17",description:d.A.t("slashCommands.linkDesc"),action:a=>{window.dispatchEvent(new CustomEvent("tiptap-insert-link"))}}]}f()},19562:(a,b,c)=>{"use strict";c.d(b,{SettingsModal:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call SettingsModal() from the server but SettingsModal is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/SettingsModal.tsx","SettingsModal")},20291:(a,b,c)=>{"use strict";c.d(b,{p:()=>i});var d=c(67484),e=c(208),f=c(79606),g=c(33281),h=c(71192);function i({cwd:a,onSearchComplete:b}){let[c,j]=(0,d.useState)(""),[k,l]=(0,d.useState)([]),[m,n]=(0,d.useState)(!1),[o,p]=(0,d.useState)(null),[q,r]=(0,d.useState)(new Set),[s,t]=(0,d.useState)({caseSensitive:!1,wholeWord:!1,regex:!1,fileType:""}),[u,v]=(0,d.useState)(null),w=(0,d.useRef)(null),x=(0,d.useCallback)(async c=>{let d=c.trim();if(!d){l([]),v(null);return}if(d.length<2)return void p(e.A.t("fileBrowser.searchMinChars"));n(!0),p(null);let i=new URLSearchParams({cwd:a,q:c,caseSensitive:String(s.caseSensitive),wholeWord:String(s.wholeWord),regex:String(s.regex),fileType:s.fileType}),j=f.tryPromise({try:async()=>{let a=await fetch(`/api/files/search?${i}`),b=await a.json();if(b.error)throw Error(b.error);return b},catch:a=>new h.uV({message:"content search failed",cause:a})});await g.t4.runPromise(j.pipe(f.match({onSuccess:a=>{l(a.results),v({totalFiles:a.totalFiles,totalMatches:a.totalMatches,truncated:a.truncated}),r(new Set(a.results.map(a=>a.path))),a.results.length>0&&b?.()},onFailure:a=>{p(a.cause instanceof Error?a.cause.message:"Search failed"),l([])}}))),n(!1)},[a,s,b]);return{contentSearchQuery:c,setContentSearchQuery:j,contentSearchResults:k,isSearching:m,searchError:o,searchExpandedPaths:q,searchOptions:s,setSearchOptions:t,searchStats:u,contentSearchInputRef:w,performContentSearch:x,handleSearchToggle:(0,d.useCallback)(a=>{r(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[])}}},20586:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Do:()=>m,Sz:()=>n,VO:()=>l,wI:()=>o});var e=c(48249),f=c(67484),g=c.n(f),h=c(44384),i=c(7122),j=c(61591);function k({status:a}){let{label:b,className:c}={added:{label:"A",className:"text-green-11"},untracked:{label:"A",className:"text-green-11"},modified:{label:"M",className:"text-amber-11"},deleted:{label:"D",className:"text-red-11"},renamed:{label:"R",className:"text-brand"}}[a]||{label:"?",className:"text-muted-foreground"};return(0,e.jsx)("span",{className:`text-xs font-bold ${c}`,children:b})}let a=g().memo(function a({node:b,level:c,selectedPath:d,expandedPaths:g,onSelect:h,onToggle:i,onContextMenu:l,showChanges:m=!1,renderActions:n}){let o=d===b.path,p=g.has(b.path),q=(0,f.useCallback)(()=>{b.isDirectory?i(b.path):h(b)},[b,h,i]),r=(0,f.useCallback)(a=>{a.preventDefault(),a.stopPropagation(),l(a,b.path,b.isDirectory)},[b.path,b.isDirectory,l]);return b.isDirectory?(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 py-0.5 px-2 pr-3 hover:bg-accent cursor-pointer whitespace-nowrap group",style:{paddingLeft:`${12*c+8}px`},onClick:q,onContextMenu:r,children:[(0,e.jsx)("span",{className:"text-slate-9 text-xs",children:p?"▼":"▶"}),(0,e.jsx)("span",{className:"text-sm text-foreground flex-1 truncate","data-tooltip":b.path,children:b.name}),n&&n(b)]}),p&&b.children.map(b=>(0,e.jsx)(a,{node:b,level:c+1,selectedPath:d,expandedPaths:g,onSelect:h,onToggle:i,onContextMenu:l,showChanges:m,renderActions:n},b.path))]}):(0,e.jsxs)("div",{className:`flex items-center gap-1.5 py-0.5 px-2 pr-3 cursor-pointer whitespace-nowrap group ${o?"bg-brand/10":"hover:bg-accent"}`,style:{paddingLeft:`${12*c+8}px`},onClick:q,onContextMenu:r,children:[(0,e.jsx)(j.o,{name:b.name,size:16,className:"flex-shrink-0"}),(0,e.jsx)("span",{className:`text-sm flex-1 truncate ${o?"text-brand":"text-foreground"}`,"data-tooltip":b.path,children:b.name}),b.status&&(0,e.jsx)(k,{status:b.status}),m&&void 0!==b.additions&&void 0!==b.deletions&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("span",{className:"text-xs text-green-11",children:["+",b.additions]}),(0,e.jsxs)("span",{className:"text-xs text-red-11",children:["-",b.deletions]})]}),n&&n(b)]})});function l({files:b,selectedPath:c,expandedPaths:d,onSelect:f,onToggle:g,cwd:j,showChanges:k=!1,renderActions:m,emptyMessage:n,className:o}){let{t:p}=(0,h.Bd)(),q=n??p("gitFileTree.noFiles"),{contextMenu:r,showContextMenu:s,hideContextMenu:t}=(0,i.Ee)();return 0===b.length?(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-slate-9",children:q}):(0,e.jsxs)("div",{className:o||"py-1",children:[b.map(b=>(0,e.jsx)(a,{node:b,level:0,selectedPath:c,expandedPaths:d,onSelect:f,onToggle:g,onContextMenu:s,showChanges:k,renderActions:m},b.path)),r&&(0,e.jsx)(i.ft,{x:r.x,y:r.y,path:r.path,cwd:j,isDirectory:r.isDirectory,onClose:t})]})}function m(a){let b=[];for(let c of a){let a=c.path.split("/"),d=b;for(let b=0;b<a.length;b++){let e=a[b],f=b===a.length-1,g=a.slice(0,b+1).join("/"),h=d.find(a=>a.name===e);h||(h={name:e,path:g,isDirectory:!f,children:[],...f&&{status:c.status,additions:c.additions,deletions:c.deletions,oldPath:c.oldPath,file:c}},d.push(h)),f||(d=h.children)}}let c=a=>{a.sort((a,b)=>a.isDirectory&&!b.isDirectory?-1:!a.isDirectory&&b.isDirectory?1:a.name.localeCompare(b.name)),a.forEach(a=>c(a.children))};return c(b),b}function n(a){let b=[],c=a=>{for(let d of a)d.isDirectory&&(b.push(d.path),c(d.children))};return c(a),b}function o(a){let b=[],c=a=>{if(a.isDirectory)for(let b of a.children)c(b);else b.push(a)};return c(a),b}d()}catch(a){d(a)}})},21482:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{D:()=>k});var e=c(48249),f=c(67484),g=c(44384),h=c(46674),i=c(36984),j=a([i]);function k({results:a,loading:b,totalMatches:c,onSelect:d,onClose:i}){let{t:j}=(0,g.Bd)(),l=function(){let[a,b]=(0,f.useState)(new Map),[c,d]=(0,f.useState)(!1);return(0,f.useRef)(0),a}();return(0,e.jsxs)("div",{className:"border-t border-border bg-secondary flex flex-col",style:{height:"300px"},children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-card/50 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("span",{className:"text-xs font-medium text-foreground",children:[j("searchResults.title")," ",!b&&j("searchResults.nMatches",{count:c})]}),(0,e.jsx)("button",{onClick:i,className:"p-0.5 rounded hover:bg-accent text-muted-foreground",children:(0,e.jsx)(h.A,{className:"w-3.5 h-3.5"})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:b?(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:j("searchResults.searching")}):0===a.length?(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:j("searchResults.noResults")}):a.map(a=>(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"px-3 py-1 text-xs text-muted-foreground font-medium bg-card/30 sticky top-0",children:a.path}),a.matches.map((b,c)=>{let f=`${a.path}:${b.lineNumber}`,g=l.get(f);return(0,e.jsxs)("button",{onClick:()=>d(a.path,b.lineNumber),className:"w-full text-left px-3 py-0.5 hover:bg-accent/50 flex items-baseline gap-2 group",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground font-mono font-variant-tabular flex-shrink-0 w-10 text-right",children:b.lineNumber}),g?(0,e.jsx)("span",{className:"text-sm font-mono truncate",dangerouslySetInnerHTML:{__html:g}}):(0,e.jsx)("span",{className:"text-sm font-mono text-foreground truncate",children:b.content||""})]},`${b.lineNumber}-${c}`)})]},a.path))})]})}i=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},21538:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{n:()=>o});var e=c(48249),f=c(67484),g=c(44384),h=c(35208),i=c(20586),j=c(33281),k=c(85655),l=c(60591),m=c(18921),n=a([i,h]);function o({isOpen:a,onClose:b,commit:c,cwd:d,embedded:n=!1,initialFilePath:p,onContentSearch:q}){let{t:r}=(0,g.Bd)(),[s,t]=(0,f.useState)([]),[u,v]=(0,f.useState)([]),[w,x]=(0,f.useState)(new Set),[y,z]=(0,f.useState)(null),[A,B]=(0,f.useState)(null),[C,D]=(0,f.useState)(!1),[E,F]=(0,f.useState)(!1),[G,H]=(0,f.useState)(null),I=(0,f.useRef)(null),J=(0,m.o)(I),K=(0,f.useCallback)(a=>{c&&(z(a),F(!0),j.t4.runPromiseExit((0,k.Zi)(d,c.hash,a.path)).then(a=>{"Success"===a._tag?B(a.value):console.error(a.cause),F(!1)}))},[d,c]),L=(0,f.useCallback)(a=>{x(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),M=(0,f.useMemo)(()=>{if(!c)return"";if(c.date){var a;let b,d,e,f,g,h,i;return a=c.date,b=new Date(a),d=new Date,e=b.getFullYear()===d.getFullYear(),f=String(b.getMonth()+1).padStart(2,"0"),g=String(b.getDate()).padStart(2,"0"),h=String(b.getHours()).padStart(2,"0"),i=String(b.getMinutes()).padStart(2,"0"),e?`${f}-${g} ${h}:${i}`:`${b.getFullYear()}-${f}-${g} ${h}:${i}`}return c.time?new Date(1e3*c.time).toLocaleString():""},[c]);if(!a||!c)return null;let N=(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"px-4 py-3 border-b border-border bg-secondary flex-shrink-0",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-foreground mb-2",children:c.subject}),c.body&&(0,e.jsx)("div",{className:"text-xs text-muted-foreground whitespace-pre-wrap mb-3 max-h-32 overflow-y-auto border-l-2 border-border pl-3",children:c.body}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-4 text-xs text-muted-foreground",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-slate-9",children:r("commitDetail.hash")}),(0,e.jsx)("span",{className:"font-mono bg-accent px-1.5 py-0.5 rounded",children:c.hash})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-slate-9",children:r("commitDetail.author")}),(0,e.jsx)("span",{children:c.author}),(0,e.jsxs)("span",{className:"text-slate-9",children:["<",c.authorEmail,">"]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-slate-9",children:r("commitDetail.date")}),(0,e.jsx)("span",{children:M}),c.relativeDate&&(0,e.jsxs)("span",{className:"text-slate-9",children:["(",c.relativeDate,")"]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-slate-9",children:r("commitDetail.files")}),(0,e.jsx)("span",{children:r("commitDetail.nChanges",{count:s.length})})]})]})]}),(0,e.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,e.jsx)("div",{className:"w-72 flex-shrink-0 border-r border-border overflow-y-auto overflow-x-hidden",children:C?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:r("commitDetail.loadingFiles")}):(0,e.jsx)(i.VO,{files:u,selectedPath:y?.path||null,expandedPaths:w,onSelect:a=>a.file&&K(a.file),onToggle:L,cwd:d,showChanges:!0,emptyMessage:r("commitDetail.noFileChanges"),className:"py-1"})}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden",children:E?(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:r("commitDetail.loadingDiff")}):A?(0,e.jsx)(h.xZ,{oldContent:A.oldContent,newContent:A.newContent,filePath:A.filePath,isNew:A.isNew,isDeleted:A.isDeleted,cwd:d,enableComments:!0,onPreview:!A.isDeleted&&A.filePath.endsWith(".json")?()=>H({content:A.newContent,filePath:A.filePath}):void 0,previewLabel:r("common.readable"),onContentSearch:q}):(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground text-sm",children:r("commitDetail.selectFileToView")})})]})]}),O=G&&(0,e.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>H(null),children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-[90%] h-[90%] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border flex-shrink-0",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground font-mono truncate",children:G.filePath}),(0,e.jsx)("button",{onClick:()=>H(null),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)(m._,{search:J}),(0,e.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4 bg-[#0d1117]",children:(0,e.jsx)("pre",{ref:I,className:"whitespace-pre-wrap break-words font-mono",style:{fontSize:"0.8125rem",lineHeight:"1.5"},children:(0,l.xb)(G.content)})})]})});return n?(0,e.jsxs)("div",{className:"bg-card w-full h-full flex flex-col relative",children:[(0,e.jsx)("button",{onClick:b,className:"absolute top-2 right-2 z-10 p-1 text-slate-9 hover:text-foreground hover:bg-accent rounded transition-colors",title:r("common.close"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),N,O]}):(0,e.jsx)("div",{className:"fixed inset-0 z-[60] bg-black/50",onClick:b,children:(0,e.jsxs)("div",{className:"bg-card w-full h-full flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground",children:r("commitDetail.title")}),(0,e.jsx)("button",{onClick:b,className:"p-1 text-slate-9 hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),N,O]})})}[i,h]=n.then?(await n)():n,d()}catch(a){d(a)}})},21672:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{D:()=>k});var e=c(48249),f=c(67484),g=c(44384),h=c(46674),i=c(36984),j=a([i]);function k({references:a,loading:b,onSelect:c,onClose:d}){let{t:i}=(0,g.Bd)(),j=function(){let[a,b]=(0,f.useState)(new Map),[c,d]=(0,f.useState)(!1);return(0,f.useRef)(0),a}(),l=[],m=new Map;for(let b=0;b<a.length;b++){let c=a[b],d=m.get(c.file);void 0===d&&(d=l.length,m.set(c.file,d),l.push({file:c.file,items:[]})),l[d].items.push({ref:c,idx:b})}return(0,e.jsxs)("div",{className:"border-t border-border bg-secondary flex flex-col",style:{height:"300px"},children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-card/50 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("span",{className:"text-xs font-medium text-foreground",children:[i("references.title")," ",!b&&`(${a.length})`]}),(0,e.jsx)("button",{onClick:d,className:"p-0.5 rounded hover:bg-accent text-muted-foreground",children:(0,e.jsx)(h.A,{className:"w-3.5 h-3.5"})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:b?(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:i("references.searching")}):0===a.length?(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:i("references.notFound")}):l.map(({file:a,items:b})=>(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"px-3 py-1 text-xs text-muted-foreground font-medium bg-card/30 sticky top-0",children:a}),b.map(({ref:a,idx:b})=>(0,e.jsxs)("button",{onClick:()=>c(a),className:"w-full text-left px-3 py-0.5 hover:bg-accent/50 flex items-baseline gap-2 group",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground font-mono font-variant-tabular flex-shrink-0 w-10 text-right",children:a.line}),j.has(b)?(0,e.jsx)("span",{className:"text-sm font-mono truncate",dangerouslySetInnerHTML:{__html:j.get(b)}}):(0,e.jsx)("span",{className:"text-sm font-mono text-foreground truncate",children:a.lineText||""})]},`${a.line}-${a.column}-${b}`))]},a))})]})}i=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},23328:(a,b,c)=>{"use strict";c.d(b,{AJ:()=>n,Cb:()=>z,D0:()=>v,DN:()=>k,Jn:()=>j,Ok:()=>s,QF:()=>i,SN:()=>o,UV:()=>y,Vv:()=>q,Yj:()=>x,Yn:()=>w,bv:()=>p,cm:()=>l,cv:()=>r,jO:()=>t,tp:()=>u,uc:()=>m});var d=c(79606),e=c(71192);let f=a=>d.tryPromise({try:async()=>{let b=await fetch(a);if(!b.ok)throw Error(`HTTP ${b.status}`);return await b.json()},catch:b=>new e.uV({message:`fetch ${a} failed`,cause:b})}),g=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`)},catch:c=>new e.uV({message:`${b.method} ${a} failed`,cause:c})}),h=(a,b)=>g(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),i=(a,b)=>d.gen(function*(){let c=new URLSearchParams({cwd:a});return b&&c.set("tabId",b),(yield*f(`/api/terminal/env?${c}`)).env||{}}),j=()=>f("/api/terminal/aliases").pipe(d.map(a=>a.aliases||{})),k=(a,b)=>f(`/api/terminal/bubble-order?cwd=${encodeURIComponent(a)}&tabId=${encodeURIComponent(b)}`).pipe(d.map(a=>a.order||[])),l=(a,b,c)=>h("/api/terminal/bubble-order",{cwd:a,tabId:b,order:c}),m=(a,b,c,d=100)=>f(`/api/terminal/history?cwd=${encodeURIComponent(a)}&tabId=${encodeURIComponent(b)}&page=${c}&pageSize=${d}`),n=(a,b,c)=>h("/api/terminal/history",{cwd:a,tabId:b,entry:c}),o=(a,b,c)=>g(`/api/terminal/history?cwd=${encodeURIComponent(a)}&tabId=${encodeURIComponent(b)}&commandId=${encodeURIComponent(c)}`,{method:"DELETE"}),p=(a,b,c,d)=>g("/api/terminal/history",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,tabId:b,id:c,fields:d})}),q=a=>h("/api/terminal/env",a),r=a=>h("/api/terminal/aliases",{aliases:a}),s=a=>h("/api/terminal/register",a),t=a=>h("/api/terminal/unregister",a),u=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/terminal/autocomplete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok)throw Error(`HTTP ${b.status}`);return await b.json()},catch:a=>new e.uV({message:"POST /api/terminal/autocomplete failed",cause:a})}),v=a=>f(`/api/project-settings?cwd=${encodeURIComponent(a)}`),w=a=>h("/api/project-settings",a),x=()=>f("/api/services/config?scope=global"),y=a=>f(`/api/services/config?cwd=${encodeURIComponent(a)}`),z=a=>h("/api/services/config",a)},23734:(a,b,c)=>{"use strict";c.d(b,{R:()=>e,d:()=>f});var d=c(28031);let e=(a,b)=>({id:a,legacyType:b??a.replace(/-/g,"_").toUpperCase()}),f=d.Io("@cockpit/IframeBus")},23860:(a,b,c)=>{"use strict";c.d(b,{F:()=>e});var d=c(67484);function e(){let[a,b]=(0,d.useState)(()=>"u"<typeof document||"visible"===document.visibilityState);return a}},23881:(a,b,c)=>{"use strict";c.d(b,{s:()=>h});var d=c(48249),e=c(67484),f=c(44384);function g(a){return a.replace(/^\([^)]+\)\s*/,"")}let h=(0,e.forwardRef)(function({displayString:a,documentation:b,x:c,y:h,container:i,onMouseEnter:j,onMouseLeave:k,onFindReferences:l,onSearch:m},n){let{t:o}=(0,f.Bd)(),p=(0,e.useRef)(null);(0,e.useImperativeHandle)(n,()=>p.current,[]);let q=i.getBoundingClientRect(),r=c-q.left,s=h-q.top,t=(0,e.useMemo)(()=>g(a),[a]),u=(0,e.useMemo)(()=>(function(a){let b,c=/\b(const|let|var|function|class|interface|type|enum|import|export|async|await|return|new|typeof|keyof|extends|implements|readonly|static|public|private|protected|abstract|declare|namespace|module|void|never|undefined|null|true|false|any|unknown|string|number|boolean|bigint|symbol|object)\b/g,e=[],f=0,g=0,h=/\b(const|let|var|function|class|interface|type|enum|import|export|async|await|return|new|typeof|keyof|extends|implements|readonly|static|public|private|protected|abstract|declare|namespace|module|void|never|undefined|null|true|false|any|unknown|string|number|boolean|bigint|symbol|object)\b|"[^"]*"|'[^']*'|\b\d+\b/g;for(;null!==(b=h.exec(a));){b.index>f&&e.push((0,d.jsx)("span",{className:"text-foreground",children:a.slice(f,b.index)},g++));let h=b[0];/^["']/.test(h)?e.push((0,d.jsx)("span",{className:"text-green-400",children:h},g++)):/^\d+$/.test(h)?e.push((0,d.jsx)("span",{className:"text-orange-300",children:h},g++)):c.test(h)?(c.lastIndex=0,e.push((0,d.jsx)("span",{className:"text-pink-400",children:h},g++))):e.push((0,d.jsx)("span",{className:"text-foreground",children:h},g++)),f=b.index+h.length}return f<a.length&&e.push((0,d.jsx)("span",{className:"text-foreground",children:a.slice(f)},g++)),e})(t),[t]);return(0,e.useEffect)(()=>{if(!p.current)return;let a=p.current,b=i.getBoundingClientRect(),d=a.getBoundingClientRect(),e=c-b.left,f=h-b.top;e+d.width>b.width-8&&(e=b.width-d.width-8),e<8&&(e=8),f+d.height>b.height-8&&(f=f-d.height-24),a.style.left=`${e}px`,a.style.top=`${f}px`},[c,h,i]),(0,d.jsxs)("div",{ref:p,className:"absolute z-[200] max-w-lg bg-card border border-border rounded-lg shadow-xl px-3 py-2 pointer-events-none",style:{left:r,top:s},children:[(0,d.jsx)("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all leading-relaxed",children:u}),b&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"border-t border-border my-1"}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:b})]}),(l||m)&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"border-t border-border my-1.5"}),(0,d.jsxs)("div",{className:"flex items-center gap-3 pointer-events-auto",onMouseEnter:j,onMouseLeave:k,children:[l&&(0,d.jsx)("button",{onClick:l,className:"text-[11px] text-brand hover:underline cursor-pointer",children:o("hoverTooltip.findReferences")}),m&&(0,d.jsx)("button",{onClick:()=>m(function(a){let b=g(a),c=b.match(/^(?:function|const|let|var|class|interface|type|enum|async function)\s+([a-zA-Z_$][\w$]*)/);if(c)return c[1];let d=a.match(/\([^)]+\)\s+(?:[\w$]+\.)*([a-zA-Z_$][\w$]*)/);if(d)return d[1];let e=b.match(/([a-zA-Z_$][\w$]*)/);return e?e[1]:b.split(/[(\s:]/)[0]}(a)),className:"text-[11px] text-brand hover:underline cursor-pointer",children:o("hoverTooltip.search")})]})]})]})})},24680:(a,b,c)=>{"use strict";c.d(b,{l:()=>h});var d=c(48249),e=c(67484),f=c(44384),g=c(72529);function h({content:a,containerRef:b,width:c="w-80"}){let{t:i}=(0,f.Bd)(),j=(0,e.useMemo)(()=>(function(a){let b=[],c=a.split("\n"),d=!1;for(let a=0;a<c.length;a++){let e=c[a];if(e.trimStart().startsWith("```")){d=!d;continue}if(d)continue;let f=/^(#{1,6})\s+(.+)$/.exec(e);f&&b.push({level:f[1].length,text:f[2].replace(/\s*#+\s*$/,""),sourceLine:a+1})}return b})(a),[a]),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(null),o=(0,e.useCallback)(a=>{let c=b.current;if(!c)return;let d=c.querySelector(`h1[data-source-start="${a}"], h2[data-source-start="${a}"], h3[data-source-start="${a}"], h4[data-source-start="${a}"], h5[data-source-start="${a}"], h6[data-source-start="${a}"]`);d&&d.scrollIntoView({behavior:"smooth",block:"start"})},[b]);return 0===j.length?null:(0,d.jsxs)("div",{className:`border-r border-border flex-shrink-0 flex flex-col transition-[width] duration-200 ${k?"w-8":c}`,children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-2 py-1.5 border-b border-border flex-shrink-0",children:[!k&&(0,d.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:i("editor.toc")}),(0,d.jsx)("button",{onClick:()=>l(a=>!a),className:"p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:i(k?"editor.expandToc":"editor.collapseToc"),children:(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:k?(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}):(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})})]}),!k&&(0,d.jsx)("nav",{className:"flex-1 overflow-y-auto py-1",children:j.map((a,b)=>(0,d.jsx)(g.m,{content:a.text,delay:400,children:(0,d.jsx)("button",{onClick:()=>o(a.sourceLine),className:`block w-full text-left text-sm py-1 px-2 truncate transition-colors hover:bg-accent ${m===a.sourceLine?"text-brand font-medium bg-brand/5":"text-muted-foreground"}`,style:{paddingLeft:`${(a.level-1)*12+8}px`},children:a.text})},b))})]})}},24724:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{h:()=>k});var e=c(48249),f=c(67484),g=c.n(f),h=c(36043),i=c(7122),j=c(61591);let a={M:{text:"text-amber-11",bg:"bg-amber-9/20"},A:{text:"text-green-11",bg:"bg-green-9/20"},D:{text:"text-red-11",bg:"bg-red-9/20"},"?":{text:"text-slate-9",bg:"bg-slate-9/20"},R:{text:"text-blue-11",bg:"bg-blue-9/20"}},l=g().memo(function({item:b,isSelected:c,isExpanded:d,isLoading:g,onSelect:h,onToggle:i,onContextMenu:k,renderActions:l}){let{node:m,level:n,gitStatus:o,hasChangedChildren:p}=b,q=o?a[o]:null,r=(0,f.useCallback)(()=>{m.isDirectory?i(m.path):h(m.path)},[m.isDirectory,m.path,h,i]),s=(0,f.useCallback)(a=>{k(a,m.path,m.isDirectory)},[m.path,m.isDirectory,k]),t=!m.isDirectory&&(".env"===m.name||m.name.startsWith(".env.")),u=o?q.text:p?"text-amber-11":t?"text-yellow-600 dark:text-yellow-500":c&&!m.isDirectory?"text-brand":"text-foreground";return(0,e.jsxs)("div",{className:`flex items-center gap-1.5 py-0.5 px-2 cursor-pointer hover:bg-accent ${c?"bg-brand/10":""}`,style:{paddingLeft:`${12*n+8}px`},onClick:r,onContextMenu:s,children:[m.isDirectory?g?(0,e.jsxs)("svg",{className:"w-4 h-4 flex-shrink-0 text-muted-foreground animate-spin",viewBox:"0 0 16 16",fill:"none",children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",opacity:"0.3"}),(0,e.jsx)("path",{d:"M14 8a6 6 0 0 0-6-6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}):(0,e.jsx)("svg",{className:`w-4 h-4 flex-shrink-0 text-muted-foreground transition-transform ${d?"rotate-90":""}`,viewBox:"0 0 16 16",fill:"none",children:(0,e.jsx)("path",{d:"M6 4 L10 8 L6 12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):(0,e.jsx)(j.o,{name:m.name,size:16,className:"flex-shrink-0 ml-4"}),(0,e.jsx)("span",{className:`text-sm truncate flex-1 ${u}`,"data-tooltip":m.isSymlink&&m.symlinkTarget?`${m.path} → ${m.symlinkTarget}`:m.path,children:m.name}),m.isSymlink&&(0,e.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:"→"}),o&&(0,e.jsx)("span",{className:`text-xs font-mono px-1 rounded ${q.text} ${q.bg} flex-shrink-0`,children:o}),m.isDirectory&&p&&(0,e.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-9 flex-shrink-0"}),l?.(m)]})});function k({files:a,selectedPath:b,expandedPaths:c,matchedPaths:d=null,gitStatusMap:g=null,loadingDirs:j,onSelect:m,onToggle:n,cwd:o,shouldScrollToSelected:p=!1,onScrolledToSelected:q,className:r,renderActions:s,onCreateFile:t,onDelete:u,onRefresh:v,onCopyFile:w,onPaste:x}){let y=(0,f.useRef)(null),{contextMenu:z,showContextMenu:A,hideContextMenu:B}=(0,i.Ee)(),C=(0,f.useMemo)(()=>(function a(b,c,d,e=null,f=0){let g=[];for(let h of b){if(null!==d&&!d.has(h.path))continue;let b=e?.get(h.path),i=h.isDirectory?function(a,b){if(!b)return!1;let c=a+"/";for(let a of b.keys())if(a.startsWith(c))return!0;return!1}(h.path,e):void 0;g.push({node:h,level:f,gitStatus:b,hasChangedChildren:i}),h.isDirectory&&h.children&&c.has(h.path)&&g.push(...a(h.children,c,d,e,f+1))}return g})(a,c,d,g),[a,c,d,g]),D=(0,h.Te)({count:C.length,getScrollElement:()=>y.current,estimateSize:()=>26,overscan:10});return((0,f.useRef)(q).current=q,0===C.length)?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:"No files"}):(0,e.jsxs)("div",{ref:y,className:r||"h-full overflow-y-auto",style:{willChange:"transform"},children:[(0,e.jsx)("div",{style:{height:`${D.getTotalSize()}px`,width:"100%",position:"relative"},children:D.getVirtualItems().map(a=>{let d=C[a.index];return(0,e.jsx)("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:`${a.size}px`,transform:`translateY(${a.start}px)`},children:(0,e.jsx)(l,{item:d,isSelected:b===d.node.path,isExpanded:c.has(d.node.path),isLoading:j?.has(d.node.path),onSelect:m,onToggle:n,onContextMenu:A,renderActions:s})},d.node.path)})}),z&&(0,e.jsx)(i.ft,{x:z.x,y:z.y,path:z.path,cwd:o,isDirectory:z.isDirectory,onClose:B,onCreateFile:t,onDelete:u,onRefresh:v,onCopyFile:w,onPaste:x})]})}d()}catch(a){d(a)}})},24943:(a,b,c)=>{"use strict";c.d(b,{NoteModal:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call NoteModal() from the server but NoteModal is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/NoteModal.tsx","NoteModal")},25465:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{ShareReviewToggle:()=>k});var e=c(48249),f=c(67484),g=c(44384),h=c(7833),i=c(33281),j=c(83120);function k({content:a,sourceFile:b}){var c;let d,l,m,n,o,{t:p}=(0,g.Bd)(),[q,r]=(0,f.useState)(null),[s,t]=(0,f.useState)(!0),[u,v]=(0,f.useState)(!1),w=q?.active===!0,x=(0,f.useCallback)(async()=>{v(!0);let c=b.split("/").pop()||b,d=await i.t4.runPromiseExit((0,j.bx)({title:c,content:a,sourceFile:b}));if("Success"!==d._tag||!d.value.review){(0,h.oR)(p("toast.reviewCreateFailed"),"error"),v(!1);return}let e=d.value.review;r({id:e.id,active:!0,updatedAt:e.updatedAt||e.createdAt});let f=await i.t4.runPromiseExit((0,j._c)()),g="Success"===f._tag&&f.value.shareBase?`${f.value.shareBase}/review/${e.id}`:`${window.location.origin}/review/${e.id}`;try{await navigator.clipboard.writeText(g)}catch{}(0,h.oR)(e.existing?p("toast.reviewUpdated"):p("toast.reviewCreated"),"success"),v(!1)},[a,b,p]),y=(0,f.useCallback)(async()=>{if(!q)return;v(!0);let a=await i.t4.runPromiseExit((0,j.Gm)(q.id,{active:!1}));"Success"===a._tag?(r(a=>a?{...a,active:!1}:null),(0,h.oR)(p("toast.sharingClosed"),"success")):(0,h.oR)(p("toast.sharingCloseFailed"),"error"),v(!1)},[q,p]),z=(0,f.useCallback)(()=>{u||(w?y():x())},[u,w,x,y]),A=(0,f.useCallback)(()=>{q&&window.open(`${window.location.origin}/review/${q.id}`,"_blank")},[q]);return s?null:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:z,disabled:u,className:`relative inline-flex h-4 w-7 items-center rounded-full transition-colors ${u?"opacity-50 cursor-wait":"cursor-pointer"} ${w?"bg-green-500":"bg-muted-foreground/30"}`,title:w?p("review.closeSharing"):p("review.enableSharing"),children:(0,e.jsx)("span",{className:`inline-block h-3 w-3 rounded-full bg-white transition-transform ${w?"translate-x-3.5":"translate-x-0.5"}`})}),(0,e.jsx)("span",{className:`text-[11px] ${w?"text-green-600 dark:text-green-400":"text-muted-foreground"}`,children:w?p("review.sharing"):p("review.notShared")}),q&&q.updatedAt&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground",children:(c=q.updatedAt,d=new Date(c),l=String(d.getMonth()+1).padStart(2,"0"),m=String(d.getDate()).padStart(2,"0"),n=String(d.getHours()).padStart(2,"0"),o=String(d.getMinutes()).padStart(2,"0"),`${l}-${m} ${n}:${o}`)}),(0,e.jsx)("button",{onClick:A,className:"text-[11px] text-brand hover:underline",children:p("review.view")})]})]})}d()}catch(a){d(a)}})},25608:(a,b,c)=>{"use strict";c.d(b,{ProjectItem:()=>h});var d=c(48249),e=c(67484),f=c(44384);function g({number:a,isActive:b}){return(0,d.jsxs)("svg",{className:`w-6 h-6 flex-shrink-0 ${b?"text-brand":"text-muted-foreground"}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[(0,d.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4"}),(0,d.jsx)("text",{x:"12",y:"16",textAnchor:"middle",fill:"currentColor",stroke:"none",fontSize:"12",fontWeight:"500",children:a})]})}function h({index:a,name:b,cwd:c,isActive:i,collapsed:j,hasUnread:k,isLoading:l,onClick:m,onRemove:n,onOpenNote:o}){let{t:p}=(0,f.Bd)(),[q,r]=(0,e.useState)(!1);return(0,d.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1 rounded-lg cursor-pointer transition-colors relative ${j?"justify-center":""} ${i?"bg-accent text-foreground":"text-muted-foreground hover:bg-secondary hover:text-foreground"}`,onClick:m,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),title:c,children:[(0,d.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,d.jsx)(g,{number:a+1,isActive:i}),k&&!i&&!l&&(0,d.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-red-500"}),l&&(0,d.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-orange-9 animate-pulse"})]}),!j&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"flex-1 truncate text-sm",children:b}),!l&&i?(0,d.jsx)("span",{className:"w-2 h-2 rounded-full bg-brand flex-shrink-0"}):null]}),q&&!j&&(0,d.jsxs)("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5",children:[o&&(0,d.jsx)("button",{className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",onClick:a=>{a.stopPropagation(),o()},title:p("workspace.projectNotes"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,d.jsx)("button",{className:"p-1 rounded hover:bg-red-500/20 text-muted-foreground hover:text-red-500 transition-colors",onClick:a=>{a.stopPropagation(),n()},title:p("workspace.closeProject"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]})}},25667:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{r:()=>j});var e=c(48249),f=c(67484),g=c(90018);c(33281),c(85655);var h=c(17966),i=a([h,g]);function j({cwd:a,filePath:b,oldContent:c,newContent:d,isNew:h=!1,isDeleted:i=!1,changedFiles:k,fileGitStatusMap:l,enableComments:m=!1,onContentSearch:n,headerExtraLeft:o,headerExtraRight:p}){let[q,r]=(0,f.useState)(b),[s,t]=(0,f.useState)(null);return(0,e.jsx)(g.O,{cwd:a,highlightedFilePath:b,changedFiles:k,enableComments:m,qnameFilter:s?.changedQnames,qnameFilterFile:q,accentQnames:s?.changedQnames,accentFile:q,addedLines:s?.addedLines,addedLinesFile:q,onFocalChange:a=>a&&r(a),onContentSearch:n,headerExtraLeft:o,headerExtraRight:p})}[h,g]=i.then?(await i)():i,d()}catch(a){d(a)}})},25702:(a,b,c)=>{"use strict";c.d(b,{Providers:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call Providers() from the server but Providers is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/Providers.tsx","Providers")},28602:(a,b,c)=>{"use strict";function d(){return!("u"<typeof navigator)&&(/Mac|iPhone|iPad/.test(navigator.platform||"")||navigator.userAgentData?.platform==="macOS")}function e(){return d()?"⌘":"Ctrl+"}c.d(b,{L:()=>d,Mu:()=>e}),process.platform,process.platform,process.platform},28797:(a,b,c)=>{"use strict";function d(a){let b=a.split(".").pop()?.toLowerCase();return b?["ts","tsx","js","jsx","mjs","cjs"].includes(b)?"typescript":["py","pyi"].includes(b)?"python":null:null}c.d(b,{c:()=>d})},29412:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{g:()=>m});var e=c(48249),f=c(67484),g=c(7833),h=c(2633),i=c(62751),j=c(33281),k=c(80532),l=a([h]);function m({isOpen:a,onClose:b}){let[c,d]=(0,f.useState)([]),[l,o]=(0,f.useState)(!1),[p,q]=(0,f.useState)(""),[r,s]=(0,f.useState)(!1),[t,u]=(0,f.useState)(""),[v,w]=(0,f.useState)(!1),[x,y]=(0,f.useState)(null),z=(0,f.useCallback)(async()=>{o(!0);let a=await j.t4.runPromiseExit((0,k.Hy)());"Success"===a._tag?d(a.value):console.error("Failed to load skills",a.cause),o(!1)},[]),A=(0,f.useMemo)(()=>{let a=p.trim().toLowerCase();return a?c.filter(b=>b.name.toLowerCase().includes(a)||b.description.toLowerCase().includes(a)||b.path.toLowerCase().includes(a)):c},[c,p]),B=(0,f.useCallback)(async()=>{let a=t.trim();if(!a)return;w(!0);let b=await j.t4.runPromiseExit((0,k.L5)(a));if("Success"===b._tag)(0,g.oR)("Skill added","success"),u(""),s(!1),await z(),(0,i.k)();else{let a="Fail"===b.cause._tag?b.cause.error:null,c=a?.cause,d=c instanceof Error?c.message:"Failed to add skill";(0,g.oR)(d,"error")}w(!1)},[t,z]),C=(0,f.useCallback)(async a=>{let b=await j.t4.runPromiseExit((0,k.hp)(a));"Success"===b._tag?(d(b=>b.filter(b=>b.id!==a)),(0,i.k)()):(0,g.oR)("Failed to delete","error")},[]),D=(0,f.useCallback)(async a=>{try{await navigator.clipboard.writeText(a),(0,g.oR)("Path copied","success")}catch{(0,g.oR)("Failed to copy","error")}},[]);return a?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:b}),(0,e.jsxs)("div",{className:"relative bg-card rounded-lg shadow-xl w-full max-w-3xl h-[80vh] mx-4 flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-foreground",children:"Skills"}),(0,e.jsx)("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:"Close",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("div",{className:"relative flex-1",children:[(0,e.jsxs)("svg",{className:"w-4 h-4 absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"11",cy:"11",r:"7",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-4.35-4.35"})]}),(0,e.jsx)("input",{type:"text",value:p,onChange:a=>q(a.target.value),placeholder:"Search skills...",className:"w-full pl-8 pr-3 py-1.5 text-sm border border-border rounded-md bg-card text-foreground placeholder-slate-9 focus:outline-none focus:ring-2 focus:ring-ring"})]}),(0,e.jsx)("button",{onClick:()=>s(!0),className:"px-3 py-1.5 text-sm rounded-md bg-brand text-white hover:bg-teal-10 active:scale-95 transition-all",children:"+ Add Skill"})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:l?(0,e.jsx)("div",{className:"text-center text-muted-foreground py-8 text-sm",children:"Loading..."}):0===A.length?(0,e.jsx)("div",{className:"text-center text-muted-foreground py-8 text-sm",children:0===c.length?'No skills yet. Click "Add Skill" to add one.':"No skills match your search."}):A.map(a=>(0,e.jsx)(n,{skill:a,onPreview:()=>y(a.id),onDelete:()=>C(a.id),onCopyPath:()=>D(a.path)},a.id))})]})]}),r&&(0,e.jsxs)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:()=>{v||(s(!1),u(""))}}),(0,e.jsxs)("div",{className:"relative bg-card rounded-lg shadow-xl w-full max-w-lg mx-4 p-5",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground mb-3",children:"Add Skill"}),(0,e.jsx)("label",{className:"block text-xs text-muted-foreground mb-1",children:"Absolute path to SKILL.md"}),(0,e.jsx)("input",{type:"text",value:t,onChange:a=>u(a.target.value),onKeyDown:a=>{"Enter"!==a.key||v||B()},placeholder:"/Users/you/.../skills/foo/SKILL.md",autoFocus:!0,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-md bg-card text-foreground placeholder-slate-9 focus:outline-none focus:ring-2 focus:ring-ring"}),(0,e.jsxs)("div",{className:"flex justify-end gap-2 mt-4",children:[(0,e.jsx)("button",{onClick:()=>{s(!1),u("")},disabled:v,className:"px-3 py-1.5 text-sm rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-accent transition-colors disabled:opacity-50",children:"Cancel"}),(0,e.jsx)("button",{onClick:B,disabled:v||!t.trim(),className:"px-3 py-1.5 text-sm rounded-md bg-brand text-white hover:bg-teal-10 transition-colors disabled:opacity-50",children:v?"Adding...":"Add"})]})]})]}),x&&(0,e.jsx)(h.d,{skillId:x,onClose:()=>y(null)})]}):null}function n({skill:a,onPreview:b,onDelete:c,onCopyPath:d}){let[g,h]=(0,f.useState)(!1);return(0,e.jsx)("div",{className:`border border-border rounded-lg p-3 bg-card hover:bg-accent/30 transition-colors ${a.valid?"":"opacity-60"}`,children:(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[(0,e.jsx)("div",{className:"w-9 h-9 flex-shrink-0 flex items-center justify-center rounded-md bg-brand/10 text-brand text-lg",children:a.icon?(0,e.jsx)("span",{children:a.icon}):(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3l1.9 4.8L19 9l-4.1 3.1L16 18l-4-2.8L8 18l1.1-5.9L5 9l5.1-1.2L12 3z"})})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,e.jsxs)("span",{className:"font-mono text-sm font-medium text-foreground",children:["/",a.name]}),a.description&&(0,e.jsx)("span",{className:"text-sm text-muted-foreground line-clamp-2",children:a.description}),!a.valid&&(0,e.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-red-9/15 text-red-11",children:"Invalid"})]}),a.argumentHint&&(0,e.jsx)("div",{className:"font-mono text-xs text-muted-foreground mt-0.5 truncate",children:a.argumentHint}),(0,e.jsx)("div",{className:"flex items-center gap-1 mt-1",children:(0,e.jsx)("button",{onClick:d,className:"text-xs text-muted-foreground hover:text-foreground font-mono truncate text-left",title:"Copy path",children:a.path})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,e.jsx)("button",{onClick:b,disabled:!a.valid,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:"Preview",children:(0,e.jsxs)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})}),g?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{onClick:()=>{h(!1),c()},className:"px-2 py-1 text-xs rounded bg-red-9 text-white hover:bg-red-10",children:"Confirm"}),(0,e.jsx)("button",{onClick:()=>h(!1),className:"px-2 py-1 text-xs rounded border border-border text-muted-foreground hover:text-foreground",children:"Cancel"})]}):(0,e.jsx)("button",{onClick:()=>h(!0),className:"p-1.5 text-muted-foreground hover:text-red-11 hover:bg-red-9/10 rounded transition-colors",title:"Delete",children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6M1 7h22M9 7V4a1 1 0 011-1h4a1 1 0 011 1v3"})})})]})]})})}h=(l.then?(await l)():l)[0],d()}catch(a){d(a)}})},29491:(a,b,c)=>{"use strict";c.d(b,{I18nProvider:()=>g});var d=c(48249);c(67484);var e=c(44384),f=c(208);function g({children:a}){return(0,d.jsx)(e.xC,{i18n:f.A,children:a})}c(33281),c(65484)},29939:(a,b,c)=>{"use strict";c.d(b,{h:()=>g});var d=c(67484),e=c(88055),f=c(21586);function g({url:a,onMessage:b,enabled:c=!0}){(0,d.useRef)(b)}e.EV(f.YA(1),1.5).pipe(e.gP(e.ji(f.YA(10))),e.y$(e.t5(10))),e.EV(f.ne(200),2).pipe(e.gP(e.ji(f.YA(5))),e.y$(e.t5(5))),e.EV(f.YA(1),2).pipe(e.et,e.gP(e.ji(f.YA(30))),e.y$(e.t5(8))),e.ji(f.YA(30)),e.ji(f.YA(1)),e.ji(f.YA(30)),f.ne(50),e.BW},30337:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,15098,23)),Promise.resolve().then(c.t.bind(c,47644,23)),Promise.resolve().then(c.t.bind(c,33859,23)),Promise.resolve().then(c.t.bind(c,98099,23)),Promise.resolve().then(c.t.bind(c,16237,23)),Promise.resolve().then(c.t.bind(c,98562,23)),Promise.resolve().then(c.t.bind(c,36675,23))},30458:(a,b,c)=>{"use strict";c.d(b,{E:()=>j});var d=c(48249),e=c(67484),f=c(44384),g=c(208),h=c(28602);let i={once:[{labelKey:"scheduledTasks.5minLater",value:5},{labelKey:"scheduledTasks.15minLater",value:15},{labelKey:"scheduledTasks.30minLater",value:30},{labelKey:"scheduledTasks.1hourLater",value:60}],interval:[{labelKey:"scheduledTasks.every15min",value:15},{labelKey:"scheduledTasks.every30min",value:30},{labelKey:"scheduledTasks.every1hour",value:60},{labelKey:"scheduledTasks.every2hours",value:120}],cron:[{labelKey:"scheduledTasks.daily9am",value:"0 9 * * *"},{labelKey:"scheduledTasks.daily6pm",value:"0 18 * * *"},{labelKey:"scheduledTasks.weeklyMon9am",value:"0 9 * * 1"},{labelKey:"scheduledTasks.monthly1st9am",value:"0 9 1 * *"}]};function j({onClose:a,onCreate:b,editTask:c,onUpdate:k}){let{t:l}=(0,f.Bd)(),m=!!c,[n,o]=(0,e.useState)(c?.type||"once"),[p,q]=(0,e.useState)(c?.message||""),[r,s]=(0,e.useState)(c?String(c.delayMinutes||c.intervalMinutes||""):""),[t,u]=(0,e.useState)(c?.cron||""),[v,w]=(0,e.useState)(c?.activeFrom||"09:00"),[x,y]=(0,e.useState)(c?.activeTo||"18:00"),[z,A]=(0,e.useState)(!!(c?.activeFrom&&c?.activeTo)),[B,C]=(0,e.useState)(null),D=(0,e.useRef)(null),E=(0,e.useRef)(null),F=(0,e.useCallback)(()=>{if(!p.trim())return;let d=null;if("once"===n){let a=B||parseInt(r,10);if(!a||a<=0)return;d={message:p.trim(),type:"once",delayMinutes:a}}else if("interval"===n){let a=B||parseInt(r,10);if(!a||a<=0)return;d={message:p.trim(),type:"interval",intervalMinutes:a,...z?{activeFrom:v,activeTo:x}:{}}}else if("cron"===n){let a=B||t.trim();if(!a)return;d={message:p.trim(),type:"cron",cron:a}}d&&(m&&c&&k?k(c.id,d):b(d),a())},[p,n,B,r,t,z,v,x,b,a,m,c,k]);return(0,d.jsxs)("div",{ref:D,className:`w-80 bg-popover border border-border rounded-lg shadow-lg z-50 ${m?"":"absolute bottom-full left-0 mb-2"}`,onKeyDown:b=>{"Escape"===b.key?a():"Enter"===b.key&&(b.metaKey||b.ctrlKey)&&F()},children:[(0,d.jsx)("div",{className:"px-3 py-2 border-b border-border bg-muted/50 rounded-t-lg",children:(0,d.jsx)("span",{className:"text-sm font-medium",children:m?l("scheduledTasks.editTask"):l("scheduledTasks.createTask")})}),(0,d.jsxs)("div",{className:"p-3 space-y-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:l("scheduledTasks.sendMessage")}),(0,d.jsx)("textarea",{ref:E,value:p,onChange:a=>q(a.target.value),placeholder:l("scheduledTasks.messagePlaceholder"),rows:2,className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card text-foreground placeholder-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring resize-none"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:l("scheduledTasks.type")}),(0,d.jsx)("div",{className:"flex gap-1",children:["once","interval","cron"].map(a=>(0,d.jsx)("button",{onClick:()=>{o(a),C(null),s(""),u("")},className:`flex-1 px-2 py-1 text-xs rounded transition-colors ${n===a?"bg-brand text-white":"bg-muted text-muted-foreground hover:text-foreground"}`,children:"once"===a?l("scheduledTasks.once"):"interval"===a?l("scheduledTasks.interval"):"Cron"},a))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:l("scheduledTasks.quickSelect")}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-1",children:i[n].map(a=>(0,d.jsx)("button",{onClick:()=>{C(a.value),"cron"===n?u(String(a.value)):s(String(a.value))},className:`px-2 py-1 text-xs rounded border transition-colors ${B===a.value?"border-brand bg-brand/10 text-brand":"border-border text-muted-foreground hover:text-foreground hover:border-foreground/30"}`,children:l(a.labelKey)},a.labelKey))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:"cron"===n?l("scheduledTasks.customCron"):l("scheduledTasks.customMinutes")}),"cron"===n?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{type:"text",value:t,onChange:a=>{u(a.target.value),C(null)},placeholder:l("scheduledTasks.cronPlaceholder"),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card text-foreground placeholder-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring font-mono"}),t.trim()&&(0,d.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:function(a){let b=g.A.t,c=a.trim().split(/\s+/);if(5!==c.length)return null;let[d,e,f,h,i]=c,j={0:b("cron.dowSun"),1:b("cron.dowMon"),2:b("cron.dowTue"),3:b("cron.dowWed"),4:b("cron.dowThu"),5:b("cron.dowFri"),6:b("cron.dowSat")},k={1:`1${b("cron.monthPrefix")}`,2:`2${b("cron.monthPrefix")}`,3:`3${b("cron.monthPrefix")}`,4:`4${b("cron.monthPrefix")}`,5:`5${b("cron.monthPrefix")}`,6:`6${b("cron.monthPrefix")}`,7:`7${b("cron.monthPrefix")}`,8:`8${b("cron.monthPrefix")}`,9:`9${b("cron.monthPrefix")}`,10:`10${b("cron.monthPrefix")}`,11:`11${b("cron.monthPrefix")}`,12:`12${b("cron.monthPrefix")}`};try{let a="";if(d.includes("/")||e.includes("/")){if("*"===e&&d.includes("/"))return b("cron.everyNMinutes",{n:d.split("/")[1]});if("0"===d&&e.includes("/"))return b("cron.everyNHours",{n:e.split("/")[1]});return null}let c=parseInt(e,10),g=parseInt(d,10);if(isNaN(c)&&"*"!==e||isNaN(g)&&"*"!==d)return null;a="*"===e&&"*"===d?b("cron.everyMinute"):"*"===e?b("cron.everyHourAtMin",{m:g}):"*"===d?b("cron.hourlyEveryMin",{h:c}):`${String(c).padStart(2,"0")}:${String(g).padStart(2,"0")}`;let l=[];if("*"!==h){let a=h.split(",").map(a=>k[a]||`${a}${b("cron.monthPrefix")}`);l.push(a.join(", "))}if("*"!==f)if(f.includes("-")){let[a,c]=f.split("-");l.push(b("cron.dayRange",{a,b:c}))}else f.includes(",")?l.push(f.split(",").map(a=>`${a}${b("cron.dayOfMonth")}`).join(", ")):l.push(`${f}${b("cron.dayOfMonth")}`);if("*"!==i)if("1-5"===i)l.push(b("cron.weekdays"));else if("0,6"===i||"6,0"===i)l.push(b("cron.weekends"));else{let a=i.split(",").map(a=>{if(a.includes("-")){let[c,d]=a.split("-");return b("cron.weekdayRange",{a:j[c]||c,b:j[d]||d})}return`${b("cron.weekdayPrefix")}${j[a]||a}`});l.push(a.join(", "))}if(0===l.length&&"*"===f&&"*"===h&&"*"===i)return b("cron.daily",{time:a});return`${l.join(" ")} ${a}`}catch{return null}}(t.trim())||(0,d.jsx)("span",{className:"text-destructive",children:l("scheduledTasks.cronFormat")})})]}):(0,d.jsx)("input",{type:"number",value:r,onChange:a=>{s(a.target.value),C(null)},placeholder:l("scheduledTasks.minutesPlaceholder"),min:1,className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card text-foreground placeholder-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]}),"interval"===n&&(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground mb-1 cursor-pointer",children:[(0,d.jsx)("input",{type:"checkbox",checked:z,onChange:a=>A(a.target.checked),className:"rounded border-border"}),l("scheduledTasks.limitTimeRange")]}),z&&(0,d.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,d.jsx)("input",{type:"time",value:v,onChange:a=>w(a.target.value),className:"flex-1 px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:l("scheduledTasks.to")}),(0,d.jsx)("input",{type:"time",value:x,onChange:a=>y(a.target.value),className:"flex-1 px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]})]}),(0,d.jsx)("button",{onClick:F,disabled:!(p.trim()&&("once"===n||"interval"===n?!!(B||r&&parseInt(r,10)>0):"cron"===n&&!!(B||t.trim()))),className:"w-full py-1.5 text-sm font-medium rounded bg-brand text-white hover:bg-brand/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:m?l("scheduledTasks.saveBtn",{modKey:(0,h.Mu)()}):l("scheduledTasks.createBtn",{modKey:(0,h.Mu)()})})]})]})}},30894:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{j:()=>a});var e=c(48249),f=c(67484),g=c(44384),h=c(7833);let a=(0,f.memo)(function({shortId:a,type:b,onRegister:c,onUnregister:d}){let{t:i}=(0,g.Bd)(),[j,k]=(0,f.useState)(!1),l=(0,f.useCallback)(async e=>{if(e.stopPropagation(),j)await d(),k(!1),(0,h.oR)(i("toast.disconnected",{id:a}));else{await c(),k(!0);let d=`cock ${b} ${a}`;navigator.clipboard.writeText(d),(0,h.oR)(i("toast.copiedCommand",{command:d}))}},[j,a,b,c,d,i]);return(0,e.jsxs)("button",{onClick:l,className:"inline-flex items-center gap-1 text-[10px] font-mono leading-none px-1.5 py-0.5 rounded flex-shrink-0 transition-colors bg-muted/60 hover:bg-muted text-muted-foreground",title:j?i("shortIdBadge.clickToDisconnect"):i("shortIdBadge.clickToRegister"),children:[(0,e.jsx)("span",{className:`inline-block w-1.5 h-1.5 rounded-full ${j?"bg-green-500":"bg-muted-foreground/40"}`}),a]})});d()}catch(a){d(a)}})},32459:(a,b,c)=>{"use strict";c.d(b,{e:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({currentCwd:a,onSwitchProject:b,collapsed:c,sessions:h}){let{t:i}=(0,f.Bd)(),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(0),n=(0,e.useRef)(null),o=(0,e.useCallback)(a=>{b(a.cwd,a.sessionId),k(!1)},[b]),p=h.filter(a=>"loading"===a.status).length,q=h.filter(a=>"unread"===a.status).length,r=(0,e.useCallback)(a=>{let b=Math.floor((l-a)/6e4);if(b<1)return i("common.justNow");if(b<60)return i("common.minutesAgo",{count:b});let c=Math.floor(b/60);return c<24?i("common.hoursAgo",{count:c}):i("common.daysAgo",{count:Math.floor(c/24)})},[i,l]);return(0,d.jsxs)("div",{className:"relative",ref:n,children:[(0,d.jsxs)("button",{onClick:()=>{m(Date.now()),k(!j)},className:`relative flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${c?"w-full justify-center":"w-full"}`,title:i("sessions.recentSessions"),children:[(0,d.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),!c&&(0,d.jsx)("span",{className:"text-sm flex-1 text-left",children:i("sessions.recentSessions")}),p>0&&(0,d.jsx)("span",{className:`min-w-[18px] h-[18px] px-1 text-white text-xs font-medium rounded-full flex items-center justify-center bg-orange-9 animate-pulse ${c?"absolute -top-1 -right-1":""}`,children:p}),q>0&&(0,d.jsx)("span",{className:`min-w-[18px] h-[18px] px-1 text-white text-xs font-medium rounded-full flex items-center justify-center bg-red-500 ${c&&!p?"absolute -top-1 -right-1":""}`,children:q})]}),j&&(0,d.jsxs)("div",{className:"absolute left-full bottom-0 ml-2 w-80 h-[450px] bg-popover border border-border rounded-lg shadow-lg z-50 flex flex-col",children:[(0,d.jsxs)("div",{className:"px-3 py-2 border-b border-border bg-muted/50 flex-shrink-0 rounded-t-lg",children:[(0,d.jsx)("span",{className:"text-sm font-medium",children:i("sessions.recentSessions")}),p>0&&(0,d.jsxs)("span",{className:"ml-2 text-xs text-orange-11",children:["(",i("sessions.runningCount",{count:p}),")"]}),q>0&&(0,d.jsxs)("span",{className:"ml-2 text-xs text-red-500",children:["(",i("sessions.unreadCount",{count:q}),")"]})]}),(0,d.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:0===h.length?(0,d.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:i("sessions.noSessions")}):h.map((b,c)=>{let e;return(0,d.jsxs)("button",{onClick:()=>o(b),className:`w-full px-3 py-2 text-left hover:bg-accent transition-colors flex items-start gap-2 ${c!==h.length-1?"border-b border-border/50":""} ${a===b.cwd?"bg-accent/50":""}`,children:[(0,d.jsx)("span",{className:`mt-1.5 w-2 h-2 rounded-full flex-shrink-0 ${"loading"===b.status?"bg-orange-9 animate-pulse":"unread"===b.status?"bg-red-500":"bg-muted-foreground/30"}`}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",title:b.cwd,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"font-medium text-sm truncate",children:(e=b.cwd).split("/").pop()||e}),"loading"===b.status&&(0,d.jsx)("span",{className:"text-xs text-orange-11 flex-shrink-0",children:i("sessions.running")}),"unread"===b.status&&(0,d.jsx)("span",{className:"text-xs text-red-500 flex-shrink-0",children:i("sessions.done")}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:r(b.lastActive)})]}),(b.lastUserMessage||b.title)&&(0,d.jsx)("div",{className:"text-xs text-foreground/80 truncate",children:b.lastUserMessage||b.title})]})]},`${b.cwd}-${b.sessionId}`)})})]})]})}},32465:(a,b,c)=>{"use strict";c.d(b,{Y:()=>m});var d=c(48249),e=c(67484),f=c(44384),g=c(76592),h=c(46674),i=c(59347),j=c(24520),k=c(33281),l=c(23328);function m({onClose:a,onSave:b}){let{t:c}=(0,f.Bd)(),[n,o]=(0,e.useState)({}),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)(""),[t,u]=(0,e.useState)(!0);(0,e.useCallback)(async()=>{u(!0);let a=await k.t4.runPromiseExit((0,l.Jn)());"Success"===a._tag?o(a.value):console.error("Failed to load aliases:",a.cause),u(!1)},[]);let v=()=>{p.trim()&&r.trim()&&(o(a=>({...a,[p.trim()]:r.trim()})),q(""),s(""))},w=async()=>{let c=await k.t4.runPromiseExit((0,l.cv)(n));"Success"===c._tag?(b(n),a()):console.error("Failed to save aliases:",c.cause)};return(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center z-50",children:(0,d.jsxs)("div",{className:"bg-background border border-border rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] flex flex-col m-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,d.jsx)(g.A,{className:"w-5 h-5"}),c("aliasManager.title")]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:c("aliasManager.description")})]}),(0,d.jsx)("button",{onClick:a,className:"p-1 rounded hover:bg-accent transition-colors",children:(0,d.jsx)(h.A,{className:"w-5 h-5"})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:t?(0,d.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground",children:c("common.loading")}):(0,d.jsxs)("div",{className:"space-y-3",children:[Object.entries(n).map(([a,b])=>(0,d.jsxs)("div",{className:"flex items-start gap-2 group",children:[(0,d.jsxs)("div",{className:"flex-1 grid grid-cols-2 gap-2",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-sm",children:"$"}),(0,d.jsx)("input",{type:"text",value:a,disabled:!0,className:"w-full pl-7 pr-3 py-2 rounded-lg border border-input bg-muted text-sm font-mono"})]}),(0,d.jsx)("input",{type:"text",value:b,onChange:b=>{var c;return c=b.target.value,void o(b=>({...b,[a]:c}))},placeholder:c("aliasManager.fullCommandPlaceholder"),className:"w-full px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent"})]}),(0,d.jsx)("button",{onClick:()=>{o(b=>{let c={...b};return delete c[a],c})},className:"p-2 rounded-lg text-destructive hover:bg-destructive/10 transition-colors opacity-0 group-hover:opacity-100",children:(0,d.jsx)(i.A,{className:"w-4 h-4"})})]},a)),(0,d.jsxs)("div",{className:"flex items-start gap-2 pt-2 border-t border-border",children:[(0,d.jsxs)("div",{className:"flex-1 grid grid-cols-2 gap-2",children:[(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("div",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground text-sm",children:"$"}),(0,d.jsx)("input",{type:"text",value:p,onChange:a=>q(a.target.value),placeholder:c("aliasManager.aliasPlaceholder"),className:"w-full pl-7 pr-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent",onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),v())}})]}),(0,d.jsx)("input",{type:"text",value:r,onChange:a=>s(a.target.value),placeholder:c("aliasManager.commandPlaceholder"),className:"w-full px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent",onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),v())}})]}),(0,d.jsx)("button",{onClick:v,disabled:!p.trim()||!r.trim(),className:"p-2 rounded-lg bg-brand text-brand-foreground hover:bg-brand/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:(0,d.jsx)(j.A,{className:"w-4 h-4"})})]}),(0,d.jsxs)("div",{className:"mt-4 p-3 bg-accent rounded-lg",children:[(0,d.jsxs)("p",{className:"text-sm text-muted-foreground",children:[(0,d.jsx)("strong",{children:c("aliasManager.usage")}),c("aliasManager.usageDesc")]}),(0,d.jsxs)("div",{className:"mt-2 space-y-1 text-xs text-muted-foreground",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"$ ll"}),(0,d.jsx)("span",{children:"→"}),(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"ls -la"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"$ gs"}),(0,d.jsx)("span",{children:"→"}),(0,d.jsx)("code",{className:"px-1.5 py-0.5 bg-background rounded",children:"git status"})]})]})]}),0===Object.keys(n).length&&(0,d.jsx)("div",{className:"text-center py-8 text-muted-foreground text-sm",children:c("aliasManager.noAliases")})]})}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[(0,d.jsx)("button",{onClick:a,className:"px-4 py-2 rounded-lg text-sm hover:bg-accent transition-colors",children:c("common.cancel")}),(0,d.jsx)("button",{onClick:w,className:"px-4 py-2 rounded-lg text-sm bg-brand text-brand-foreground hover:bg-brand/90 transition-colors",children:c("common.save")})]})]})})}},32580:(a,b,c)=>{"use strict";function d(a,b){let c=a.split("\n"),d=b.split("\n"),e=[],f=c.length,g=d.length,h=Array(f+1).fill(null).map(()=>Array(g+1).fill(0));for(let a=1;a<=f;a++)for(let b=1;b<=g;b++)c[a-1]===d[b-1]?h[a][b]=h[a-1][b-1]+1:h[a][b]=Math.max(h[a-1][b],h[a][b-1]);let i=f,j=g,k=[];for(;i>0||j>0;)i>0&&j>0&&c[i-1]===d[j-1]?(k.push({type:"unchanged",content:c[i-1],oldLineNum:i,newLineNum:j}),i--,j--):j>0&&(0===i||h[i][j-1]>=h[i-1][j])?(k.push({type:"added",content:d[j-1],newLineNum:j}),j--):(k.push({type:"removed",content:c[i-1],oldLineNum:i}),i--);for(;k.length>0;)e.push(k.pop());return e}c.d(b,{X:()=>d})},33281:(a,b,c)=>{"use strict";c.d(b,{t4:()=>G});var d=c(95753),e=c(88512),f=c(79606),g=c(28582),h=c(61808);let i=d.Um(h.j9,h.dl((a=>{switch((a??"").toLowerCase()){case"all":return g.u8;case"trace":return g.Cn;case"debug":return g.y;case"info":default:return g.R2;case"warning":case"warn":return g.N5;case"error":return g.$D;case"fatal":return g.Lj;case"none":return g.NV}})(process.env.COCKPIT_LOG_LEVEL)));var j=c(1239),k=c(69063);let l=globalThis,m=l.__cockpitSpanRing??={buffer:[],index:new Map},n=a=>{let b="abcdef0123456789",c="";for(let d=0;d<a;d++)c+=b.charAt(Math.floor(Math.random()*b.length));return c};class o{constructor(a,b,c,d,e,f){this.name=a,this.parent=b,this.context=c,this.startTime=e,this.kind=f,this._tag="Span",this.sampled=!0,this.attributes=new Map,this.events=[],this.traceId=j.Ru(b)?b.value.traceId:n(32),this.spanId=n(16),this.status={_tag:"Started",startTime:e},this.links=Array.from(d),function(a){if(m.buffer.push(a),m.index.set(a.spanId,m.buffer.length-1),m.buffer.length>500){m.buffer.shift(),m.index.clear();for(let a=0;a<m.buffer.length;a++)m.index.set(m.buffer[a].spanId,a)}}(function(a,b,c,d,e,f){return{traceId:b,spanId:a,parentSpanId:c,name:d,kind:e,startTimeNs:f.toString(),endTimeNs:null,durationMs:null,attributes:{},events:[],status:"started"}}(this.spanId,this.traceId,function(a){return j.Ru(a)?a.value.spanId:null}(b),a,f,e))}end(a,b){this.status={_tag:"Ended",endTime:a,exit:b,startTime:this.status.startTime},function(a,b,c){let d=m.index.get(a);if(void 0===d)return;let e=m.buffer[d];if(!e)return;let f=Number(b-BigInt(e.startTimeNs))/1e6;m.buffer[d]={...e,endTimeNs:b.toString(),durationMs:Math.round(100*f)/100,status:"Success"===c._tag?"ok":"error",errorMessage:"Failure"===c._tag?function(a){if(a instanceof Error)return a.message;if("string"==typeof a)return a;try{return JSON.stringify(a)}catch{return String(a)}}(c.cause):void 0}}(this.spanId,a,"Success"===b._tag?{_tag:"Success"}:{_tag:"Failure",cause:b.cause})}attribute(a,b){this.attributes.set(a,b),function(a,b,c){let d=m.index.get(a);if(void 0===d)return;let e=m.buffer[d];e&&(m.buffer[d]={...e,attributes:{...e.attributes,[b]:c}})}(this.spanId,a,b)}event(a,b,c){this.events.push([a,b,c??{}]),function(a,b,c,d){let e=m.index.get(a);if(void 0===e)return;let f=m.buffer[e];f&&(m.buffer[e]={...f,events:[...f.events,{name:b,timeNs:c.toString(),attributes:d}]})}(this.spanId,a,b,c)}addLinks(a){this.links.push(...a)}}let p=k.L8({span:(a,b,c,d,e,f)=>new o(a,b,c,d,e,f),context:a=>a()}),q=d.Py(k.sh,p);d.Ie;var r=c(66473);let s=r.eu("dev","prod")("COCKPIT_ENV").pipe(r.IQ("prod")),t=r.Yj("COCKPIT_HOST").pipe(r.IQ("127.0.0.1")),u=r.nd("COCKPIT_PORT").pipe(r.NW(()=>r.nd("PORT")),r.IQ(3457)),v=r.uK(r.Yj("COCKPIT_OPEN_PROJECT")).pipe(r.Tj(a=>"Some"===a._tag?a.value:void 0)),w=r.zM("COCKPIT_NO_OPEN").pipe(r.IQ(!1)),x=r.Yj("COCKPIT_LOG_LEVEL").pipe(r.IQ("info")),y=r.uK(r.Yj("COCKPIT_DIR"));f.gen(function*(){let a=yield*s,b=yield*t,c=yield*u,d=yield*v,e=yield*w,g=yield*x,h=yield*y,i=yield*f.sync(()=>{if("Some"===h._tag)return h.value;let a="u">typeof process?process.env:void 0;return(a?.HOME||a?.USERPROFILE||".")+"/.cockpit"});return{env:a,host:b,port:3457===c&&"dev"===a?3456:c,cockpitDir:i,openProject:d,openBrowser:!e,logLevel:g,logFile:i+"/logs/cockpit.log"}}).pipe(f.orDie);let z=d.Ie;var A=c(7846),B=c(55805),C=c(23734);let D=d.P1(C.d,f.gen(function*(){let a=yield*A.dT();return yield*f.acquireRelease(f.sync(()=>b=>{f.runFork(A.mk(a,b))}),a=>f.sync(()=>{})),C.d.of({publish:(a,b)=>f.sync(()=>{}),subscribe:b=>B.qdp(a).pipe(B.pbD(a=>{var c;return c=a.data,!!c&&"object"==typeof c&&(c.topic===b.id||c.type===b.legacyType)}),B.TjK(a=>((a,b)=>{if(a.topic===b.id)return a.msg;let{type:c,...d}=a;return d})(a.data,b)))})})),E=d.Um(i,q,z),F=d.Um(E,D),G=e.L8(F);f.void},33988:(a,b,c)=>{"use strict";c.d(b,{B:()=>f});var d=c(67484);c(57031),c(88214);var e=c(76334);function f(a,b,c){let f=(0,d.useMemo)(()=>(0,e.p)(a),[a]),[g,h]=(0,d.useState)(!1),i=(0,d.useRef)(null);(0,d.useRef)([]),(0,d.useRef)(null),(0,d.useRef)(!1),(0,d.useRef)(c);let j=(0,d.useRef)([]);(0,d.useCallback)(a=>{let c=b.current;if(!c?.contentWindow){let b=i.current;b&&b.readyState===WebSocket.OPEN&&b.send(JSON.stringify({type:"browser:cmd-result",reqId:a.reqId,ok:!1,error:"iframe not available (page may be sleeping)"}));return}c.contentWindow.postMessage({type:"cockpit:cmd",reqId:a.reqId,action:a.action,params:a.params},"*")},[b]);let k=(0,d.useCallback)(()=>g&&i.current?.readyState===WebSocket.OPEN?Promise.resolve():new Promise(a=>{j.current.push(a),g||h(!0)}),[g]);return{shortId:f,connected:g,connect:k,disconnect:(0,d.useCallback)(()=>{h(!1)},[])}}},34001:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{NoteModal:()=>z});var e=c(48249),f=c(67484),g=c(44384),h=c(208),i=c(13191),j=c(63831),k=c(19043),l=c(48197),m=c(9731),n=c(44551),o=c(53116),p=c(16512),q=c(6993),r=c(11537),s=c(73555),t=c(19545),u=c(92451),v=c(83179),w=c(33281),x=c(79606),y=c(65484);function z({isOpen:a,onClose:b,projectCwd:c,projectName:d}){let{t:A}=(0,g.Bd)(),[B,C]=(0,f.useState)(!0),[D,E]=(0,f.useState)(!1),F=(0,f.useRef)(null),G=(0,f.useRef)(!1),[H,I]=(0,f.useState)(null),J=(0,f.useRef)(null),K=(0,f.useCallback)(async a=>{E(!0);let b=await w.t4.runPromiseExit((0,y.Cq)(c,a).pipe(x.tapError(a=>x.sync(()=>console.error("Failed to save note:",a)))));"Success"===b._tag&&(G.current=!1),E(!1)},[c]),L=(0,f.useCallback)(a=>{G.current=!0,F.current&&clearTimeout(F.current),F.current=setTimeout(()=>{K(a)},5e3)},[K]),M=(0,i.hG)({immediatelyRender:!1,extensions:[j.A.configure({heading:{levels:[1,2,3]}}),k.A.configure({placeholder:()=>h.A.t("editor.placeholder")}),l.XI.configure({resizable:!0}),m.H,n.n,o.A,p._,r.Ay.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"tiptap-link",target:"_blank",rel:"noopener noreferrer"}}),q.L.configure({nested:!0}),s.o.configure({html:!0,transformCopiedText:!0,transformPastedText:!0})],editorProps:{attributes:{class:"tiptap-editor focus:outline-none min-h-[60vh] px-6 py-4"},handleClick:(a,b,c)=>{if(c.metaKey||c.ctrlKey){let c=a.state.doc.resolve(b).marks().find(a=>"link"===a.type.name)?.attrs;if(c?.href)return window.open(c.href,"_blank","noopener,noreferrer"),!0}return!1},handleKeyDown:(a,b)=>{if("Backspace"===b.key&&N.current){let a=N.current;if(a.isActive("codeBlock")){let{$from:b}=a.state.selection,c=b.node(b.depth);if("codeBlock"===c.type.name&&""===c.textContent)return a.chain().focus().toggleCodeBlock().run(),!0}}return"/"!==b.key||H||setTimeout(()=>{if(!N.current)return;let{from:a}=N.current.state.selection,b=N.current.state.doc.textBetween(Math.max(0,a-1),a,"\n");if("/"===b){J.current=a;let b=N.current.view.coordsAtPos(a);I({query:"",position:{top:b.bottom+4,left:b.left}})}},0),!1}},onUpdate:({editor:a})=>{let b=(0,t.up)(a);if(L(b),null!==J.current){let{from:b}=a.state.selection;if(b<J.current)I(null),J.current=null;else{let c=a.state.doc.textBetween(J.current,b,"\n");c.includes(" ")||c.includes("\n")?(I(null),J.current=null):I(a=>a?{...a,query:c}:null)}}}}),N=(0,f.useRef)(M),O=(0,f.useCallback)(()=>{if(F.current&&(clearTimeout(F.current),F.current=null),G.current&&M){let a=(0,t.up)(M);K(a)}I(null),J.current=null,b()},[M,K,b]);return a?(0,e.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:O}),(0,e.jsxs)("div",{className:"relative bg-card rounded-lg shadow-xl w-full max-w-6xl h-[90vh] mx-4 flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-foreground",children:d?A("editor.noteTitle",{name:d}):A("editor.noteUntitled")}),D&&(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:A("editor.saving")})]}),(0,e.jsx)("button",{onClick:O,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)(v.NoteToolbar,{editor:M}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto",children:B?(0,e.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:(0,e.jsx)("span",{children:A("common.loading")})}):(0,e.jsx)(i.$Z,{editor:M})})]}),H&&M&&(0,e.jsx)(u.U,{editor:M,query:H.query,position:H.position,onClose:()=>{I(null),J.current=null}})]}):null}d()}catch(a){d(a)}})},34102:(a,b,c)=>{"use strict";c.d(b,{B:()=>g});var d=c(48249),e=c(67484),f=c(74429);function g(){let[a,b]=(0,e.useState)(null);(0,e.useRef)(null).current=a,(0,e.useRef)(null);let c=(0,e.useRef)(null),[g,h]=(0,e.useState)({left:0,top:0}),[i,j]=(0,e.useState)(!1);return i&&a?(0,f.createPortal)((0,d.jsx)("div",{ref:c,className:"fixed z-[9999] px-2 py-1 bg-popover text-popover-foreground text-xs font-mono rounded shadow-lg border border-brand whitespace-nowrap pointer-events-none max-w-[80vw] overflow-hidden text-ellipsis",style:{left:g.left,top:g.top},children:a.text}),document.body):null}},35208:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{xU:()=>A,xZ:()=>z});var e=c(48249),f=c(67484),g=c(74429),h=c(44384),i=c(36043),j=c(74754),k=c(91579),l=c(7122),m=c(7031),n=c(41051),o=c(42140),p=c(32580),q=c(73414),r=c(7833),s=c(38896),t=c(36984),u=c(74542),v=c(70596),w=c(37690),x=a([s,t]);function y(a){return a.params?`${a.name}(${a.params.join(", ")})`:a.name}function z({oldContent:a,newContent:b,filePath:c,isNew:d=!1,isDeleted:x=!1,cwd:A,enableComments:B=!1,onPreview:C,previewLabel:D,onContentSearch:E,targetLine:F,compact:G=!1,symbols:H}){let{t:I}=(0,h.Bd)(),J=D??I("common.preview"),K=(0,f.useMemo)(()=>(0,p.X)(a,b),[a,b]),L=(0,f.useRef)(null),M=(0,f.useRef)(null),N=(0,f.useRef)(null);(0,f.useRef)(!1);let[O,P]=(0,f.useState)(!1),Q=(0,l.iN)(),R=(0,m.r)(),S=B&&!!A,{comments:T,addComment:U,updateComment:V,deleteComment:W,refresh:X}=(0,j._)({cwd:A||"",filePath:c}),[Y,Z]=(0,f.useState)(null),[$,_]=(0,f.useState)(null),{toolbarRef:aa,bumpRef:ab,clearToolbar:ac}=(0,w.L)({enabled:S,container:$,resolveLineRange:a=>{if(!document.contains(a))return null;let b=a.nodeType===Node.TEXT_NODE?a.parentElement:a,c=b?.closest("[data-new-line]");if(!c)return null;let d=parseInt(c.getAttribute("data-new-line")||"0",10);return!Number.isFinite(d)||d<=0?null:{start:d,end:d}},buildLineSnapshot:({start:a,end:b})=>{let c=[],d=0;for(let e of K)("unchanged"===e.type||"added"===e.type)&&++d>=a&&d<=b&&c.push(e.content);return c.join("\n")}}),[ad,ae]=(0,f.useState)(null),[af,ag]=(0,f.useState)(null),ah=(0,f.useMemo)(()=>{let a=new Set;for(let b of T)for(let c=b.startLine;c<=b.endLine;c++)a.add(c);return a},[T]),ai=(0,f.useMemo)(()=>{let a=new Map;for(let b of T){let c=b.endLine;a.has(c)||a.set(c,[]),a.get(c).push(b)}return a},[T]),aj=(0,f.useCallback)((a,b)=>{b.stopPropagation(),Z({comment:a,x:b.clientX,y:b.clientY}),ac(),ae(null),ag(null)},[ac]),ak=(0,f.useCallback)(()=>{let a=aa.current;a&&(ae({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),ac())},[ac,aa]),al=(0,f.useCallback)(()=>{let a=aa.current;a&&(ag({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),ac())},[ac,aa]),am=(0,f.useCallback)(()=>{let a=aa.current;if(!a||!E)return;let b=a.selectedText.trim();ac(),b&&E(b)},[E,ac,aa]),an=(0,f.useCallback)(async a=>{if(af&&R&&A)try{let b=await (0,k.$3)(A),d=[];for(let a of b)d.push({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0});d.push({filePath:c,startLine:af.range.start,endLine:af.range.end,codeContent:af.lineSnapshot});let e=(0,k.Gw)(d,a);R.sendMessage(e),await (0,k.RP)(A),X(),ag(null)}catch(a){console.error("Failed to send to AI:",a)}},[af,R,c,A,X]),ao=(0,f.useCallback)(async a=>{ad&&(await U(ad.range.start,ad.range.end,a,ad.selectedText),ae(null))},[ad,U]),{leftLines:ap,rightLines:aq}=(0,f.useMemo)(()=>{let a=[],b=[],c=0,d=0;for(let e=0;e<K.length;e++){let f=K[e];if("unchanged"===f.type){for(;a.length<b.length;)a.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});for(;b.length<a.length;)b.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});c++,d++,a.push({lineNum:c,content:f.content,type:"unchanged",originalIdx:e}),b.push({lineNum:d,content:f.content,type:"unchanged",originalIdx:e})}else"removed"===f.type?(c++,a.push({lineNum:c,content:f.content,type:"removed",originalIdx:e})):"added"===f.type&&(d++,b.push({lineNum:d,content:f.content,type:"added",originalIdx:e}))}for(;a.length<b.length;)a.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});for(;b.length<a.length;)b.push({lineNum:0,content:"",type:"unchanged",originalIdx:-1});return{leftLines:a,rightLines:b}},[K]),ar=(0,f.useMemo)(()=>K.map(a=>a.content),[K]),as=(0,s.C)(ar,c),[at,au]=(0,f.useState)(()=>new Map),av=(0,f.useMemo)(()=>H??[],[H]),{rows:aw,gaps:ax}=(0,f.useMemo)(()=>G?(0,q.pU)(ap,aq,at,av):{rows:ap.map((a,b)=>({kind:"diff",idx:b})),gaps:[]},[G,ap,ap,aq,at,av]),ay=(0,f.useCallback)((a,b)=>{let c=ax.find(b=>b.id===a);c&&au(d=>{let e=d.get(a)??{topRevealed:0,bottomRevealed:0},f=c.endIdx-c.startIdx+1-e.topRevealed-e.bottomRevealed;if(f<=0)return d;let g=Math.min(q.YO,f),h="up"===b?{...e,topRevealed:e.topRevealed+g}:{...e,bottomRevealed:e.bottomRevealed+g};return new Map(d).set(a,h)})},[ax]);(0,f.useCallback)(a=>{for(let b of ax)if(a>=b.startIdx&&a<=b.endIdx)return b.id;return null},[ax]);let az=(0,f.useCallback)(a=>aw[a]?.kind==="gap-label"?28:20,[aw]),aA=(0,f.useCallback)(a=>{let b=aw[a];if(!b)return a;if("gap-label"===b.kind)return`gl:${b.gapId}`;if("gap-expand"===b.kind)return`ge:${b.gapId}:${b.direction}`;let c=ap[b.idx],d=aq[b.idx];return`d:${c?.lineNum??"x"}:${c?.type??"x"}:${d?.lineNum??"x"}:${d?.type??"x"}`},[aw,ap,aq]),aB=(0,i.Te)({count:aw.length,getScrollElement:()=>L.current,estimateSize:az,getItemKey:aA,overscan:20}),aC=d?"w-1/4":x?"w-3/4":"w-1/2",aD=d?"w-3/4":x?"w-1/4":"w-1/2",aE=(0,f.useMemo)(()=>aw.map(a=>{if("diff"!==a.kind)return{type:"unchanged"};let b=ap[a.idx],c=aq[a.idx];return"removed"===b.type?{type:"removed"}:c?.type==="added"?{type:"added"}:{type:"unchanged"}}),[aw,ap,aq]),aF=aB.getTotalSize(),aG=aB.getVirtualItems();return(0,e.jsxs)("div",{className:"font-mono flex flex-col h-full text-sm",children:[(0,e.jsxs)("div",{className:"flex flex-shrink-0 border-b border-border",children:[(0,e.jsx)("div",{className:`${aC} min-w-0 px-2 py-1 bg-accent text-muted-foreground text-center text-xs font-medium border-r border-border`,children:d?"(New File)":x?"Deleted":"Old"}),(0,e.jsxs)("div",{className:`${aD} min-w-0 px-2 py-1 bg-accent text-muted-foreground text-xs font-medium relative`,children:[(0,e.jsx)("span",{className:"block text-center",children:x?"(Deleted)":"New"}),(0,e.jsxs)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-2",children:[C&&(0,e.jsx)("button",{onClick:C,className:"text-muted-foreground hover:text-foreground transition-colors",children:J}),!x&&b&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(b),(0,r.oR)(I("diffViewer.copiedAll"))},className:"text-muted-foreground hover:text-foreground transition-colors",children:I("common.copy")})]})]}),(0,e.jsx)("div",{className:"w-4 flex-shrink-0 bg-accent"})]}),(0,e.jsxs)("div",{className:"flex-1 min-h-0 flex",children:[(0,e.jsx)("div",{ref:L,className:"flex-1 overflow-y-auto overflow-x-hidden",children:(0,e.jsxs)("div",{className:"flex",style:{height:`${aF}px`},children:[(0,e.jsx)("div",{ref:M,className:`${aC} overflow-x-auto border-r border-border`,children:(0,e.jsx)("div",{className:"min-w-max h-full",style:{position:"relative"},children:aG.map(a=>{let b=aw[a.index];if("gap-expand"===b.kind||"gap-label"===b.kind){let c="gap-label"===b.kind;return(0,e.jsx)("div",{ref:aB.measureElement,"data-index":a.index,style:{position:"absolute",top:0,left:0,width:"100%",height:`${a.size}px`,transform:`translateY(${a.start}px)`},className:c?"bg-accent border-y border-border":""},a.key)}let c=ap[b.idx];return(0,e.jsxs)("div",{ref:aB.measureElement,"data-index":a.index,"data-row-idx":b.idx,style:{position:"absolute",top:0,left:0,minWidth:"100%",width:"max-content",height:`${a.size}px`,transform:`translateY(${a.start}px)`},className:`flex ${"removed"===c.type?"bg-red-9/15 dark:bg-red-9/25":""}`,children:[(0,e.jsx)("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-slate-9 select-none border-r border-border",children:c.lineNum||""}),(0,e.jsx)("span",{className:"whitespace-pre pl-2",dangerouslySetInnerHTML:{__html:c.originalIdx>=0&&as[c.originalIdx]||(0,t.ZD)(c.content||" ")}})]},a.key)})})}),(0,e.jsx)("div",{ref:N,className:`${aD} overflow-x-auto`,children:(0,e.jsx)("div",{className:"min-w-max h-full",style:{position:"relative"},children:aG.map(a=>{let b=aw[a.index];if("gap-expand"===b.kind)return(0,e.jsx)("button",{ref:aB.measureElement,"data-index":a.index,type:"button",onClick:()=>ay(b.gapId,b.direction),style:{position:"absolute",top:0,left:0,width:"100%",height:`${a.size}px`,transform:`translateY(${a.start}px)`},className:"flex items-center justify-center text-[11px] text-foreground/50 hover:bg-accent hover:text-brand active:bg-brand/15 transition-colors duration-100 cursor-pointer focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-brand/60",title:I("up"===b.direction?"diffViewer.gap.expandUp":"diffViewer.gap.expandDown",{count:b.revealCount}),"aria-label":I("up"===b.direction?"diffViewer.gap.expandUp":"diffViewer.gap.expandDown",{count:b.revealCount}),children:(0,e.jsx)("span",{className:"select-none",children:I("diffViewer.gap.more",{count:b.revealCount})})},a.key);if("gap-label"===b.kind)return(0,e.jsxs)("div",{ref:aB.measureElement,"data-index":a.index,"data-gap-id":b.gapId,style:{position:"absolute",top:0,left:0,width:"100%",height:`${a.size}px`,transform:`translateY(${a.start}px)`},className:"flex items-center justify-center gap-2 px-3 text-[11px] text-foreground/80 bg-accent border-y border-border min-w-0 select-none",children:[(0,e.jsx)("span",{className:"flex-shrink-0",children:I("diffViewer.gap.hidden",{count:b.hiddenCount})}),b.enclosingFn&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"opacity-50 flex-shrink-0",children:"\xb7"}),(0,e.jsx)("span",{className:"truncate min-w-0 font-medium",title:y(b.enclosingFn),children:y(b.enclosingFn)})]})]},a.key);let c=aq[b.idx],d=c?.lineNum||0,f=d>0&&ah.has(d),g=ai.get(d),h=g?.[0],i=ad&&d>=ad.range.start&&d<=ad.range.end,j=af&&d>=af.range.start&&d<=af.range.end,k=i||j;return(0,e.jsxs)("div",{ref:aB.measureElement,"data-index":a.index,"data-new-line":d||void 0,"data-row-idx":b.idx,style:{position:"absolute",top:0,left:0,minWidth:"100%",width:"max-content",height:`${a.size}px`,transform:`translateY(${a.start}px)`},className:`flex ${k?"bg-blue-9/20":f?"bg-amber-9/10":c?.type==="added"?"bg-green-9/15 dark:bg-green-9/25":""}`,children:[(0,e.jsxs)("span",{className:`flex-shrink-0 flex items-center gap-0.5 pr-1 text-slate-9 select-none border-r border-border ${k?"bg-blue-9/30":""}`,style:{width:S?"52px":"40px"},children:[S&&d>0&&f&&h&&(0,e.jsx)("button",{onClick:a=>aj(h,a),className:"w-4 h-4 flex items-center justify-center rounded hover:bg-accent text-amber-9",title:I("codeViewer.nComments",{count:g?.length}),children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M18 10c0 3.866-3.582 7-8 7a8.841 8.841 0 01-4.083-.98L2 17l1.338-3.123C2.493 12.767 2 11.434 2 10c0-3.866 3.582-7 8-7s8 3.134 8 7zM7 9H5v2h2V9zm8 0h-2v2h2V9zM9 9h2v2H9V9z",clipRule:"evenodd"})})}),S&&d>0&&!f&&(0,e.jsx)("span",{className:"w-4"}),(0,e.jsx)("span",{className:"flex-1 text-right pr-1",children:d||""})]}),(0,e.jsx)("span",{className:"whitespace-pre pl-2",dangerouslySetInnerHTML:{__html:c?.originalIdx>=0&&as[c.originalIdx]||(0,t.ZD)(c?.content||" ")}})]},a.key)})})})]})}),(0,e.jsx)(u.b,{lines:aE,containerRef:L})]}),O&&Q&&(0,g.createPortal)((0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.f,{floatingToolbarRef:aa,bumpRef:ab,container:Q,onAddComment:ak,onSendToAI:al,onSearch:E?am:void 0,isChatLoading:R?.isLoading??!1}),ad&&(0,e.jsx)(o.t,{x:ad.x,y:ad.y,range:ad.range,lineSnapshot:ad.lineSnapshot,container:Q,onSubmit:ao,onClose:()=>ae(null)}),af&&(0,e.jsx)(o.G,{x:af.x,y:af.y,range:af.range,filePath:c,lineSnapshot:af.lineSnapshot,container:Q,onSubmit:an,onClose:()=>ag(null),isChatLoading:R?.isLoading}),Y&&(0,e.jsx)(v.t,{x:Y.x,y:Y.y,comment:Y.comment,container:Q,onClose:()=>Z(null),onUpdateComment:V,onDeleteComment:W})]}),Q)]})}function A({oldContent:a,newContent:b,filePath:c}){let d=(0,f.useMemo)(()=>(0,p.X)(a,b),[a,b]),g=(0,f.useRef)(null),h=(0,f.useMemo)(()=>d.map(a=>a.content),[d]),j=(0,s.C)(h,c),k=(0,f.useCallback)(a=>{let b=d[a];return b?`${b.type}:${b.oldLineNum??"x"}:${b.newLineNum??"x"}`:a},[d]),l=(0,i.Te)({count:d.length,getScrollElement:()=>g.current,estimateSize:()=>20,getItemKey:k,overscan:20});return(0,e.jsx)("div",{ref:g,className:"font-mono text-sm overflow-auto h-full",children:(0,e.jsx)("div",{style:{height:`${l.getTotalSize()}px`,position:"relative"},children:l.getVirtualItems().map(a=>{let b=d[a.index];return(0,e.jsxs)("div",{style:{position:"absolute",top:0,left:0,minWidth:"100%",width:"max-content",height:`${a.size}px`,transform:`translateY(${a.start}px)`},className:`flex ${"removed"===b.type?"bg-red-9/15 dark:bg-red-9/25":"added"===b.type?"bg-green-9/15 dark:bg-green-9/25":""}`,children:[(0,e.jsx)("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-slate-9 select-none border-r border-border",children:"added"!==b.type?b.oldLineNum:""}),(0,e.jsx)("span",{className:"w-10 flex-shrink-0 text-right pr-2 text-slate-9 select-none border-r border-border",children:"removed"!==b.type?b.newLineNum:""}),(0,e.jsx)("span",{className:`w-6 flex-shrink-0 text-center select-none ${"removed"===b.type?"text-red-11":"added"===b.type?"text-green-11":"text-slate-9"}`,children:"removed"===b.type?"-":"added"===b.type?"+":" "}),(0,e.jsx)("span",{className:"flex-1 whitespace-pre pl-1",dangerouslySetInnerHTML:{__html:j[a.index]||(0,t.ZD)(b.content||" ")}})]},a.key)})})})}[s,t]=x.then?(await x)():x,d()}catch(a){d(a)}})},36295:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{G:()=>C,p:()=>A});var e=c(48249),f=c(67484),g=c(46674),h=c(15273),i=c(62956),j=c(82594),k=c(10316),l=c(72419),m=c(44218),n=c(7833),o=c(44384),p=c(34678),q=c(76334),r=c(30894),s=c(28602),t=c(79606),u=c(33281),v=c(23328),w=a([r]);r=(w.then?(await w)():w)[0];let y=(0,f.lazy)(()=>c.e(8764).then(c.bind(c,98764)).then(a=>({default:a.XtermRenderer}))),z={c:"\x03",d:"\x04",z:"\x1a",l:"\f",a:"\x01",e:"\x05",u:"\x15",w:"\x17"},A=360,B=/\x1b\[[0-9;]*m/g;function x({output:a,query:b,mode:c,currentIdx:d,matchListRef:g}){let h=(0,f.useRef)(null);h.current||(h.current=new p.v,h.current.use_classes=!0);let i=a.split("\n"),j=b.toLowerCase(),k=0;return g.current=[],(0,e.jsx)("pre",{className:"text-sm font-mono whitespace-pre-wrap break-words select-text",children:i.map((a,b)=>{let f=a.replace(B,""),i=f.toLowerCase().includes(j);if("filter"===c&&!i)return null;if(!i){let c=h.current.ansi_to_html(a);return(0,e.jsx)("div",{dangerouslySetInnerHTML:{__html:c}},b)}let l=[],m=0,n=f.toLowerCase(),o=0;for(;o<n.length;){let a=n.indexOf(j,o);if(-1===a)break;a>m&&l.push((0,e.jsx)("span",{children:f.slice(m,a)},`t${m}`));let b=k++,c=b===d;l.push((0,e.jsx)("mark",{ref:a=>{g.current[b]=a},className:c?"bg-brand/40 text-foreground":"bg-yellow-300/40 text-foreground",children:f.slice(a,a+j.length)},`m${a}`)),o=m=a+j.length}return m<f.length&&l.push((0,e.jsx)("span",{children:f.slice(m)},`t${m}`)),(0,e.jsx)("div",{children:l},b)})})}let C=(0,f.memo)(function({commandId:a,tabId:b,projectCwd:c,command:d,output:w,exitCode:B,isRunning:C,selected:D,onSelect:E,onInterrupt:F,onStdin:G,onDelete:H,onRerun:I,timestamp:J,usePty:K,subscribePtyOutput:L,subscribePtyReset:M,onPtyResize:N,onToggleMaximize:O,maximized:P,expandedHeight:Q,bubbleContentHeight:R,onTitleMouseDown:S}){let{t:T}=(0,o.Bd)(),U=(0,f.useRef)(null),V=(0,f.useRef)(null),W=(0,f.useRef)(!0),X=(0,f.useRef)(null),Y=(0,f.useRef)(null),Z=(a=>{if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`})(J),$=a&&b?(0,q.p)(b+a):void 0,[_,aa]=(0,f.useState)(!1),[ab,ac]=(0,f.useState)(""),ad=(0,f.useRef)(null),ae=(0,f.useRef)(null);(0,f.useEffect)(()=>{if(!L||!a)return;let b=()=>{if(ad.current){let b=ad.current.write;return L(a,b)}return null},c=b();if(c)return c;let d=setInterval(()=>{(c=b())&&clearInterval(d)},50);return()=>{clearInterval(d),c?.()}},[L,a]),(0,f.useEffect)(()=>{if(!M||!a)return;let b=()=>{if(ad.current){let b=ad.current.reset;return M(a,b)}return null},c=b();if(c)return c;let d=setInterval(()=>{(c=b())&&clearInterval(d)},50);return()=>{clearInterval(d),c?.()}},[M,a]);let[af,ag]=(0,f.useState)(!1),[ah,ai]=(0,f.useState)(""),[aj,ak]=(0,f.useState)("search"),[al,am]=(0,f.useState)(0),an=(0,f.useRef)([]),ao=(0,f.useRef)(null),ap=(0,f.useRef)(0);(0,f.useEffect)(()=>{ao.current||(ao.current=new p.v,ao.current.use_classes=!0)},[]),(0,f.useLayoutEffect)(()=>{let a=V.current;if(a&&ao.current){if(w.length<ap.current&&(ao.current=new p.v,ao.current.use_classes=!0,ap.current=0,a.innerHTML=""),w.length>ap.current){let b=w.slice(ap.current),c=ao.current.ansi_to_html(b);ap.current=w.length,a.insertAdjacentHTML("beforeend",c)}if(U.current){let a=U.current.scrollHeight>U.current.clientHeight;aa(a),a&&(U.current.scrollTop=U.current.scrollHeight)}}},[w]),(0,f.useEffect)(()=>(C&&W.current&&U.current&&(null!==X.current&&cancelAnimationFrame(X.current),X.current=requestAnimationFrame(()=>{U.current&&(U.current.scrollTop=U.current.scrollHeight),X.current=null})),()=>{null!==X.current&&cancelAnimationFrame(X.current)}),[w,C]),(0,f.useEffect)(()=>{if(!P)return;let a=a=>{"Escape"===a.key&&(a.preventDefault(),a.stopPropagation(),O?.())};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[P,O]);let aq=w?w.split("\n").length:0,ar=(0,f.useCallback)(()=>{ag(!0),requestAnimationFrame(()=>ae.current?.focus())},[]),as=(0,f.useCallback)(()=>{ag(!1),ai(""),am(0),ad.current?.clearSearch()},[]),at=(0,f.useCallback)(a=>{a.trim()&&(K?ad.current?.findNext(a):am(a=>{let b=a+1,c=an.current[b];return c?(c.scrollIntoView({block:"nearest"}),b):(an.current[0]?.scrollIntoView({block:"nearest"}),0)}))},[K]),au=(0,f.useCallback)(a=>{a.trim()&&(K?ad.current?.findPrevious(a):am(a=>{let b=a-1;if(b>=0)return an.current[b]?.scrollIntoView({block:"nearest"}),b;let c=an.current.length-1;return c>=0&&an.current[c]?.scrollIntoView({block:"nearest"}),Math.max(c,0)}))},[K]);(0,f.useEffect)(()=>{if(!D)return;let a=a=>{if((a.metaKey||a.ctrlKey)&&"f"===a.key){a.preventDefault(),a.stopPropagation(),ar();return}if("Escape"===a.key&&af){a.preventDefault(),a.stopPropagation(),as();return}};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[D,af,ar,as]);let av=P&&Q?Q-41:R??A;return(0,e.jsx)("div",{className:"flex flex-col items-start",children:(0,e.jsxs)("div",{className:`w-full bg-accent text-foreground dark:text-slate-11 relative overflow-hidden border transition-colors cursor-pointer ${P?"rounded-none border-0":"rounded-2xl rounded-bl-md rounded-br-md"} ${P?"":D?"border-brand":"border-brand/30"}`,onClick:E,children:[P?(0,e.jsxs)("div",{onDoubleClick:()=>O?.(),className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-card",style:{height:41,flexShrink:0},children:[(0,e.jsx)("span",{className:"text-[10px] font-mono leading-none px-1 py-0.5 rounded bg-muted text-muted-foreground",children:">_"}),(0,e.jsx)("span",{className:"flex-1 text-xs text-muted-foreground truncate font-mono",children:d}),C&&(0,e.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"inline-block w-2 h-2 bg-green-500 rounded-full animate-pulse"}),T("console.runningText")]}),C&&F&&(0,e.jsx)("button",{onClick:F,className:"text-xs px-3 py-1 rounded-md font-medium bg-destructive text-destructive-foreground transition-all duration-150 hover:bg-destructive/80 hover:shadow-md active:scale-95 active:bg-destructive/70 cursor-pointer select-none",children:"Ctrl+C"}),(0,e.jsx)("button",{onClick:()=>O?.(),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:T("console.restoreTooltip",{modKey:(0,s.Mu)()}),children:(0,e.jsx)(g.A,{className:"w-4 h-4"})})]}):(0,e.jsxs)("div",{"data-drag-handle":!0,onMouseDown:()=>S?.(),onDoubleClick:a=>{a.stopPropagation(),O?.()},className:`flex items-center gap-2 px-4 py-1.5 border-b text-xs transition-colors cursor-grab active:cursor-grabbing ${D?"border-brand":"border-brand/30"}`,children:[(0,e.jsx)("span",{className:"text-[10px] font-mono leading-none px-1 py-0.5 rounded flex-shrink-0 bg-muted text-muted-foreground",children:">_"}),$&&a&&b&&(0,e.jsx)(r.j,{shortId:$,type:"terminal",onRegister:()=>{u.t4.runFork((0,v.Ok)({tabId:b,commandId:a,command:d,projectCwd:c}).pipe(t.orElse(()=>t.void)))},onUnregister:()=>{u.t4.runFork((0,v.jO)({commandId:a}).pipe(t.orElse(()=>t.void)))}}),(0,e.jsx)("span",{className:"font-mono text-foreground truncate",children:d}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(d),(0,n.oR)(T("toast.copiedCmd"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:T("console.copyCommand"),children:(0,e.jsx)(h.A,{className:"w-3.5 h-3.5"})}),(0,e.jsx)("span",{className:"flex-1"}),_&&!C&&(0,e.jsx)("span",{className:"text-muted-foreground flex-shrink-0",children:T("console.totalLines",{count:aq})}),w&&(0,e.jsx)("button",{onClick:a=>{let b;a.stopPropagation(),b=w.replace(/\x1b\[[0-9;]*m/g,""),navigator.clipboard.writeText(b),(0,n.oR)(T("toast.copiedOutput"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:T("console.copyOutput"),children:(0,e.jsx)(i.A,{className:"w-3.5 h-3.5"})}),I&&(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),I()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:T("console.rerun"),children:(0,e.jsx)(j.A,{className:"w-3.5 h-3.5"})}),H&&(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),H()},className:"p-0.5 rounded text-destructive hover:text-destructive/80 transition-colors flex-shrink-0",title:T("console.deleteRecord"),children:(0,e.jsx)(g.A,{className:"w-3.5 h-3.5"})})]}),af&&(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b border-border bg-card",style:{flexShrink:0},children:[(0,e.jsx)(k.A,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}),(0,e.jsx)("input",{ref:ae,value:ah,onChange:a=>{let b=a.target.value;ai(b),am(0),K&&(b.trim()?ad.current?.findNext(b):ad.current?.clearSearch())},onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?au(ah):at(ah))},placeholder:T("console.searchPlaceholder"),className:"flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground",autoComplete:"off",spellCheck:"false"}),!K&&(0,e.jsxs)("div",{className:"flex items-center gap-0.5 text-xs flex-shrink-0",children:[(0,e.jsx)("button",{onClick:()=>ak("search"),className:`px-1.5 py-0.5 rounded transition-colors ${"search"===aj?"bg-brand/20 text-brand":"text-muted-foreground hover:text-foreground"}`,children:T("console.searchMode")}),(0,e.jsx)("button",{onClick:()=>ak("filter"),className:`px-1.5 py-0.5 rounded transition-colors ${"filter"===aj?"bg-brand/20 text-brand":"text-muted-foreground hover:text-foreground"}`,children:T("console.filterMode")})]}),(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:()=>au(ah),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:T("console.prevShiftEnter"),children:(0,e.jsx)(l.A,{className:"w-3.5 h-3.5"})}),(0,e.jsx)("button",{onClick:()=>at(ah),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",title:T("console.nextEnter"),children:(0,e.jsx)(m.A,{className:"w-3.5 h-3.5"})})]}),(0,e.jsx)("button",{onClick:as,className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:(0,e.jsx)(g.A,{className:"w-3.5 h-3.5"})})]}),K?(0,e.jsxs)("div",{className:"relative group",style:{height:av,overflow:"hidden"},children:[(0,e.jsx)(f.Suspense,{fallback:(0,e.jsx)("div",{className:"px-4 py-2 text-xs text-muted-foreground",style:{height:av},children:T("console.loadingTerminal")}),children:(0,e.jsx)(y,{ref:ad,output:w,isRunning:C,onInput:G,onResize:N,maximized:P,height:av,directWrite:!!L})}),!C&&I&&(0,e.jsx)("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",onClick:a=>{a.stopPropagation(),I()},title:T("console.rerun"),children:(0,e.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-black/60 text-white text-xs",children:[(0,e.jsx)(j.A,{className:"w-3.5 h-3.5"}),T("console.rerun")]})})]}):(0,e.jsx)("div",{ref:U,className:"overflow-auto px-4 py-2",style:{height:av},onScroll:()=>{if(U.current){let{scrollTop:a,scrollHeight:b,clientHeight:c}=U.current;W.current=b-a-c<50}},children:af&&ah.trim()?(0,e.jsx)(x,{output:w,query:ah,mode:aj,currentIdx:al,matchListRef:an}):(0,e.jsx)("pre",{ref:V,className:"text-sm font-mono whitespace-pre-wrap break-words select-text"})}),C&&!P&&(0,e.jsxs)("div",{className:"border-t border-border px-4 py-2 flex items-center gap-2",onClick:a=>a.stopPropagation(),children:[(0,e.jsx)("span",{className:"inline-block w-2 h-2 bg-green-500 rounded-full animate-pulse flex-shrink-0"}),K?(0,e.jsx)("span",{className:"text-xs text-muted-foreground flex-1",children:T("console.clickToInput")}):G?(0,e.jsx)("input",{ref:Y,value:ab,onChange:a=>ac(a.target.value),onKeyDown:a=>{if(a.ctrlKey&&!a.metaKey&&!a.altKey){let b=z[a.key.toLowerCase()];if(b){a.preventDefault(),a.stopPropagation(),G(b);return}}"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),G(ab+"\n"),ac("")),"Tab"===a.key&&(a.preventDefault(),G(" "))},placeholder:T("console.stdinPlaceholder"),className:"flex-1 min-w-0 bg-transparent text-xs font-mono text-foreground outline-none placeholder:text-muted-foreground",autoComplete:"off",spellCheck:"false"}):(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:T("console.runningText")}),F&&(0,e.jsx)("button",{onClick:F,className:"flex-shrink-0 text-xs text-destructive hover:brightness-125 transition-colors cursor-pointer select-none",children:"Ctrl+C"}),Z&&(0,e.jsx)("span",{className:"text-[11px] text-muted-foreground flex-shrink-0",children:Z})]}),!C&&void 0!==B&&!P&&(0,e.jsxs)("div",{className:"border-t border-border px-4 py-2 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${0===B?"bg-green-500":"bg-red-500"}`}),(0,e.jsx)("span",{children:T("console.exitCode",{code:B})}),(0,e.jsx)("span",{className:"flex-1"}),Z&&(0,e.jsx)("span",{className:"text-[11px] flex-shrink-0",children:Z})]})]})})});d()}catch(a){d(a)}})},36984:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Np:()=>k,ZD:()=>i,b8:()=>j,kS:()=>g,sQ:()=>h});var e=c(78908),f=a([e]);e=(f.then?(await f)():f)[0];let l=null,m=["typescript","tsx","javascript","jsx","html","css","scss","json","yaml","python","go","rust","java","ruby","php","bash","shell","markdown","sql","c","cpp","swift","kotlin","dart","lua","graphql","xml"];function g(){return l||(l=(0,e.createHighlighter)({themes:["github-dark","github-light"],langs:[...m]})),l}function h(a){let b=a.split("/").pop()?.toLowerCase()||"",c=b.split(".").pop()?.toLowerCase();if(".env"===b||b.startsWith(".env.")||"dockerfile"===b||b.startsWith("dockerfile.")||"makefile"===b)return"bash";let d={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",mjs:"javascript",cjs:"javascript",html:"html",htm:"html",css:"css",scss:"scss",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",py:"python",go:"go",rs:"rust",java:"java",kt:"kotlin",rb:"ruby",php:"php",cs:"cpp",cpp:"cpp",c:"c",h:"c",sh:"bash",bash:"bash",zsh:"bash",md:"markdown",mdx:"markdown",sql:"sql",swift:"swift",dart:"dart",lua:"lua",graphql:"graphql",gql:"graphql",toml:"yaml",sass:"scss",less:"css",scala:"java",r:"python",vim:"bash",env:"bash"}[c||""]||"text";return m.includes(d)?d:"text"}function i(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function j(a){return a.map(a=>a.color?`<span style="color:${a.color}">${i(a.content)}</span>`:i(a.content)).join("")}function k(a,b,c,d){if(!b)return[];let e=[],f=c?b:b.toLowerCase();for(let b=0;b<a.length;b++){let g=c?a[b]:a[b].toLowerCase(),h=0;for(;;){let a=g.indexOf(f,h);if(-1===a)break;let c=a+f.length;if(d){let d=a>0?g[a-1]:" ",f=c<g.length?g[c]:" ",h=!/\w/.test(d),i=!/\w/.test(f);h&&i&&e.push({lineIndex:b,startCol:a,endCol:c})}else e.push({lineIndex:b,startCol:a,endCol:c});h=a+1}}return e}d()}catch(a){d(a)}})},37129:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{useTabState:()=>j});var e=c(67484),f=c(23860);c(57031),c(88214);var g=c(79606),h=c(33281),i=c(37388);function j({initialCwd:a,initialSessionId:b,activeView:c}){(0,e.useRef)(!1),(0,e.useRef)(!0);let d=(0,e.useRef)(c),k=(0,f.F)(),l=(0,e.useRef)(k),[m,n]=(0,e.useState)(()=>[{id:`tab-${Date.now()}`,cwd:a,title:"New Chat"}]),[o,p]=(0,e.useState)(m[0].id),[q,r]=(0,e.useState)(new Set),s=(0,e.useRef)(m),t=(0,e.useCallback)((b,c)=>{a&&b&&h.t4.runFork((0,i.KJ)(a,b,c).pipe(g.catchAll(()=>g.void)))},[a]),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(null),y=(0,e.useCallback)((a,b,c,d,e,f,g=!1)=>{let h={id:`tab-${Date.now()}`,cwd:a,sessionId:b,title:c||(b?`Session ${b.slice(0,6)}...`:"New Chat"),engine:d,ollamaModel:e,deepseekModel:f};n(a=>{if(g)return[...a,h];let b=a.findIndex(a=>a.id===o);if(-1===b)return[...a,h];let c=[...a];return c.splice(b+1,0,h),c}),p(h.id)},[o]),z=(0,e.useCallback)(b=>{n(c=>{let d=c.filter(a=>a.id!==b);if(b===o&&d.length>0&&p(d[d.length-1].id),0===d.length){let b={id:`tab-${Date.now()}`,cwd:a,title:"New Chat"};return p(b.id),[b]}return d})},[o,a]),A=(0,e.useCallback)((b,c)=>{let d=m.find(a=>a.sessionId===b);d?p(d.id):y(a,b,c,void 0,void 0,void 0,!0)},[m,a,y]),B=(0,e.useCallback)(()=>{y(a,void 0,void 0,void 0,void 0,void 0,!0)},[a,y]),C=(0,e.useCallback)(()=>{y(a,void 0,"New Claude 2 Chat","claude2",void 0,void 0,!0)},[a,y]),D=(0,e.useCallback)(()=>{y(a,void 0,"New Codex Chat","codex",void 0,void 0,!0)},[a,y]),E=(0,e.useCallback)(()=>{y(a,void 0,"New Kimi Chat","kimi",void 0,void 0,!0)},[a,y]),F=(0,e.useCallback)(b=>{y(a,void 0,b?`New Ollama (${b})`:"New Ollama Chat","ollama",b,void 0,!0)},[a,y]),G=(0,e.useCallback)((a,b)=>{n(c=>c.map(c=>c.id===a?{...c,ollamaModel:b}:c))},[]),H=(0,e.useCallback)(()=>{y(a,void 0,"New DeepSeek Chat","deepseek",void 0,"deepseek-v4-flash",!0)},[a,y]),I=(0,e.useCallback)((a,b)=>{n(c=>c.map(c=>c.id===a?{...c,deepseekModel:b}:c))},[]),J=(0,e.useCallback)((b,c)=>{y(a,b,c)},[a,y]),K=(0,e.useCallback)((a,b)=>{n(c=>{let e=c.find(b=>b.id===a);if(e?.isLoading&&!1===b.isLoading){let c=!d.current||"agent"===d.current;if(a===o&&c&&l.current){let a=e.sessionId||b.sessionId;a&&t(a,"normal")}else r(b=>new Set(b).add(a))}return c.map(c=>c.id===a?{...c,...b}:c)})},[o,t]),L=(0,e.useCallback)(a=>{p(a),r(b=>{if(!b.has(a))return b;let c=new Set(b);c.delete(a);let d=s.current.find(b=>b.id===a);return d?.sessionId&&(t(d.sessionId,"normal"),h.t4.runFork((0,i.M2)(d.sessionId).pipe(g.catchAll(()=>g.void)))),c})},[t]),M=(0,e.useCallback)(a=>{v(a)},[]),N=(0,e.useCallback)((a,b)=>{a.preventDefault(),null!==u&&u!==b&&x(b)},[u]),O=(0,e.useCallback)(a=>{null!==u&&u!==a&&n(b=>{let c=[...b],[d]=c.splice(u,1);return c.splice(a,0,d),c}),v(null),x(null)},[u]),P=(0,e.useCallback)(()=>{v(null),x(null)},[]),Q=m.find(a=>a.id===o);return{tabs:m,activeTabId:o,activeTab:Q,unreadTabs:q,dragTabIndex:u,dragOverTabIndex:w,addTab:y,closeTab:z,switchTab:L,handleSelectSession:A,handleNewTab:B,handleNewClaude2Tab:C,handleNewCodexTab:D,handleNewKimiTab:E,handleNewOllamaTab:F,handleNewDeepseekTab:H,handleOpenSession:J,updateTabState:K,updateTabOllamaModel:G,updateTabDeepseekModel:I,handleTabDragStart:M,handleTabDragOver:N,handleTabDrop:O,handleTabDragEnd:P}}d()}catch(a){d(a)}})},37202:(a,b,c)=>{"use strict";c.d(b,{M:()=>m,O:()=>k});var d=c(48249),e=c(67484),f=c(44384),g=c(74429);let h=[],i=[];function j(){i.forEach(a=>a())}function k(a){let b=`session-toast-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;h=[...h,{...a,id:b}],j()}function l(a){h=h.filter(b=>b.id!==a),j()}function m({onNavigate:a}){let b=function(){let[,a]=(0,e.useState)(0);return h}();return 0===b.length?null:(0,g.createPortal)((0,d.jsx)("div",{className:"fixed bottom-4 left-4 z-[100] flex flex-col gap-2 pointer-events-none",children:b.map(b=>(0,d.jsx)(n,{item:b,onNavigate:a,onRemove:l},b.id))}),document.body)}function n({item:a,onNavigate:b,onRemove:c}){let{t:g}=(0,f.Bd)(),[h,i]=(0,e.useState)(!1),j=(0,e.useRef)(void 0),k=(0,e.useCallback)(()=>{i(!0),setTimeout(()=>c(a.id),300)},[a.id,c]),l=(0,e.useCallback)(()=>{clearTimeout(j.current),b(a.cwd,a.sessionId),c(a.id)},[a,b,c]),m=(0,e.useCallback)(()=>{clearTimeout(j.current)},[]),o=(0,e.useCallback)(()=>{j.current=setTimeout(k,2e3)},[k]);return(0,d.jsxs)("div",{className:`pointer-events-auto bg-card border border-border rounded-lg shadow-lg px-3 py-2.5 min-w-[260px] max-w-[340px] cursor-pointer hover:bg-accent transition-all ${h?"opacity-0 -translate-x-4":"opacity-100 translate-x-0"}`,style:{animation:h?void 0:"slideInLeft 0.3s ease-out"},onClick:l,onMouseEnter:m,onMouseLeave:o,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("svg",{className:"w-4 h-4 text-green-9 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),(0,d.jsx)("span",{className:"text-sm font-medium text-foreground truncate",children:a.projectName}),(0,d.jsx)("span",{className:"text-xs text-green-11 flex-shrink-0",children:g("common.done")}),(0,d.jsx)("button",{onClick:a=>{a.stopPropagation(),k()},className:"ml-auto p-0.5 text-muted-foreground hover:text-foreground rounded transition-colors",children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.message&&(0,d.jsx)("div",{className:"text-xs text-muted-foreground truncate mt-1 ml-6",children:a.message})]})}},37388:(a,b,c)=>{"use strict";c.d(b,{KJ:()=>h,M2:()=>i,ej:()=>g,n8:()=>f});var d=c(79606),e=c(71192);let f=a=>d.tryPromise({try:async()=>{let b=await fetch(`/api/project-state?cwd=${encodeURIComponent(a)}`);if(!b.ok)throw Error(`HTTP ${b.status}`);return await b.json()},catch:a=>new e.uV({message:"loadProjectState failed",cause:a})}),g=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/project-state",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok)throw Error(`HTTP ${b.status}`)},catch:a=>new e.uV({message:"saveProjectState failed",cause:a})}),h=(a,b,c)=>d.tryPromise({try:async()=>{let d=await fetch("/api/global-state",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,sessionId:b,status:c})});if(!d.ok)throw Error(`HTTP ${d.status}`)},catch:a=>new e.uV({message:"updateSessionStatus failed",cause:a})}),i=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/scheduled-tasks",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"markReadBySessionId",fields:{sessionId:a}})});if(!b.ok)throw Error(`HTTP ${b.status}`)},catch:a=>new e.uV({message:"markScheduledTasksReadBySession failed",cause:a})})},37690:(a,b,c)=>{"use strict";c.d(b,{L:()=>e});var d=c(67484);function e({enabled:a,container:b,resolveLineRange:c,buildLineSnapshot:f,dragThresholdPx:g=5}){let h=(0,d.useRef)(null),i=(0,d.useRef)(()=>{}),j=(0,d.useRef)(c),k=(0,d.useRef)(f),l=(0,d.useRef)(g);return j.current=c,k.current=f,l.current=g,{toolbarRef:h,bumpRef:i,clearToolbar:()=>{h.current&&(h.current=null,i.current())}}}},38087:(a,b,c)=>{"use strict";c.d(b,{m:()=>i});var d=c(67484),e=c(79606),f=c(33281),g=c(71192);let h=a=>e.tryPromise({try:async()=>{let b=await fetch("/api/session-by-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});return b.ok?await b.json():null},catch:a=>new g.uV({message:"session-by-path failed",cause:a})});function i(a,b,c,{cwd:j,initialSessionId:k,onSessionId:l,onTitleChange:m,onTokenUsage:n}){let[o,p]=(0,d.useState)(!1),[q,r]=(0,d.useState)(!1),[s,t]=(0,d.useState)(!1),[u,v]=(0,d.useState)(void 0),[w,x]=(0,d.useState)(0),y=(0,d.useRef)(m);y.current=m;let z=(0,d.useRef)(n);z.current=n;let A=(0,d.useRef)(void 0),B=(0,d.useRef)(0),C=(0,d.useCallback)(async(a,c,d=!1,e,g)=>{if(d){let a=Date.now();if(a-B.current<5e3)return;B.current=a}d||p(!0);try{let i={cwd:a,sessionId:c,limit:e,beforeTurnIndex:g};d&&A.current&&(i.ifFingerprint=A.current);let j=await f.t4.runPromiseExit(h(i));if("Success"===j._tag&&j.value){let a=j.value;if(a.notModified)return;a.fingerprint&&(A.current=a.fingerprint),void 0!==a.totalTurns&&x(a.totalTurns),void 0!==a.hasMore&&t(a.hasMore),a.messages&&a.messages.length>0&&(d?b(b=>{let c=a.messages;if(b.length===c.length&&b.length>0&&b[b.length-1].content===c[c.length-1].content)return b;let d=0;for(let a=0;a<Math.min(b.length,c.length)&&b[a].id===c[a].id&&b[a].content===c[a].content;a++)d=a+1;return d===b.length&&d<c.length?[...b,...c.slice(d)]:c}):b(a.messages)),a.sessionId&&l(a.sessionId),a.title&&y.current?.(a.title),a.usage&&z.current?.({inputTokens:a.usage.input_tokens||0,outputTokens:a.usage.output_tokens||0,cacheCreationInputTokens:a.usage.cache_creation_input_tokens||0,cacheReadInputTokens:a.usage.cache_read_input_tokens||0,totalCostUsd:0})}}catch(a){console.error("Failed to load history by cwd and sessionId:",a)}finally{d||p(!1)}},[b,l]),D=(0,d.useCallback)(async()=>{if(j&&c&&!q&&s){r(!0);try{let d=void 0!==u?u:w-Math.ceil(a.filter(a=>"user"===a.role).length),e=await f.t4.runPromiseExit(h({cwd:j,sessionId:c,limit:10,beforeTurnIndex:d>0?d:void 0}));if("Success"===e._tag&&e.value){let a=e.value;if(a.messages&&a.messages.length>0){b(b=>[...a.messages,...b]);let c=a.messages.filter(a=>"user"===a.role).length;v(d-c)}void 0!==a.hasMore&&t(a.hasMore),a.fingerprint&&(A.current=a.fingerprint)}else"Failure"===e._tag&&console.error("Failed to load more history:",e.cause)}finally{r(!1)}}},[j,c,q,s,u,w,a,b]);return{isLoadingHistory:o,isLoadingMore:q,hasMoreHistory:s,loadMoreHistory:D,loadHistory:(0,d.useCallback)(async a=>{p(!0);let c=e.tryPromise({try:async()=>{let b=await fetch(`/api/session/${a}/history`);return b.ok?await b.json():null},catch:a=>new g.uV({message:"load session history failed",cause:a})}),d=await f.t4.runPromiseExit(c);"Success"===d._tag&&d.value?.messages&&d.value.messages.length>0?b(d.value.messages):"Failure"===d._tag&&console.error("Failed to load history:",d.cause),p(!1)},[b]),loadHistoryByCwdAndSessionId:C}}},38878:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{TabManagerTopBar:()=>s});var e=c(48249),f=c(67484),g=c(94192),h=c(12568),i=c(7833),j=c(44384),k=c(57031),l=c(88214),m=c(79606),n=c(33281),o=c(85655),p=c(65484),q=a([h]);function r({cwd:a,currentBranch:b,onSwitched:c}){let{t:d}=(0,j.Bd)(),[g,h]=(0,f.useState)(!1),[k,l]=(0,f.useState)([]),[m,q]=(0,f.useState)(!1),[s,t]=(0,f.useState)(!1),[u,v]=(0,f.useState)(""),w=(0,f.useRef)(null),x=(0,f.useRef)(null),y=(0,f.useCallback)(async()=>{q(!0);let b=await n.t4.runPromiseExit((0,o.r4)(a));if("Success"===b._tag){let a=b.value,c=a.local??[],d=a.remote??[],e=[...c,...d.filter(a=>!c.includes(a.replace(/^origin\//,"")))];l(e)}else(0,i.oR)(d("toast.loadBranchFailed"),"error");q(!1)},[a,d]),z=(0,f.useCallback)(()=>{h(!0),v(""),y()},[y]),A=(0,f.useCallback)(()=>{h(!1)},[]),B=async b=>{t(!0);let e=await n.t4.runPromiseExit((0,p.Kl)({action:"checkout",cwd:a,path:a,branch:b}));if("Success"===e._tag){let a=b.replace(/^origin\//,"");(0,i.oR)(d("toast.switchedToBranch",{branch:a}),"success"),A(),c()}else{let a="Fail"===e.cause._tag?e.cause.error:null,b=a?.cause,c=b instanceof Error?b.message:d("toast.switchBranchFailed");(0,i.oR)(c,"error")}t(!1)},C=k.filter(a=>a!==b&&a.toLowerCase().includes(u.toLowerCase()));return(0,e.jsxs)("div",{className:"relative",ref:w,children:[(0,e.jsx)("button",{onClick:g?A:z,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:d("git.switchBranch"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"})})}),g&&(0,e.jsxs)("div",{className:"absolute top-full left-0 mt-1 w-64 bg-popover border border-border rounded-lg shadow-lg z-50 overflow-hidden",children:[(0,e.jsx)("div",{className:"p-2 border-b border-border",children:(0,e.jsx)("input",{ref:x,type:"text",value:u,onChange:a=>v(a.target.value),placeholder:d("git.searchBranch"),className:"w-full px-2.5 py-1.5 text-sm bg-muted rounded border-none outline-none placeholder:text-muted-foreground",onKeyDown:a=>{"Escape"===a.key&&A()}})}),(0,e.jsx)("div",{className:"max-h-60 overflow-y-auto p-1",children:m?(0,e.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:d("common.loading")}):0===C.length?(0,e.jsx)("div",{className:"text-xs text-muted-foreground text-center py-4",children:u?d("git.noMatchingBranches"):d("git.noBranches")}):C.map(a=>(0,e.jsx)("button",{onClick:()=>B(a),disabled:s,className:"w-full text-left px-2.5 py-1.5 text-sm rounded hover:bg-accent transition-colors truncate disabled:opacity-50",children:(0,e.jsx)("span",{className:a.startsWith("origin/")?"text-muted-foreground":"text-foreground",children:a})},a))})]})]})}function s({initialCwd:a,activeTab:b,isGitRepo:c,currentBranch:d,onOpenWorktree:f,onOpenProjectSessions:o,onOpenAliasManager:q,onBranchSwitched:t}){let{t:u}=(0,j.Bd)();return(0,e.jsx)("div",{className:"border-b border-border bg-card shrink-0",children:(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 relative",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("img",{src:"/icons/icon-72x72.png",alt:"Cockpit",className:"w-6 h-6 cursor-pointer",title:u("tabManagerTopBar.copyPageUrl"),onClick:()=>{navigator.clipboard.writeText(window.location.href).then(()=>{(0,i.oR)(u("toast.copiedPageUrl"),"success")})}}),a?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-sm text-foreground max-w-md truncate cursor-help",title:`CWD: ${a}`,children:a}),(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(a),(0,i.oR)(u("toast.copiedDirPath"))},className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:u("tabManagerTopBar.copyDirPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}):(0,e.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:"Cockpit"})]}),c&&a&&(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsxs)("button",{onClick:f,className:"flex items-center gap-1.5 px-2 py-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:"Git Worktrees",children:[(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 17h8m0 0l-4-4m4 4l-4 4M3 7v6a4 4 0 004 4h5"})}),(0,e.jsx)("span",{className:"text-sm",children:d||"main"})]}),(0,e.jsx)(r,{cwd:a,currentBranch:d,onSwitched:()=>t?.()})]})]}),(0,e.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2",children:(0,e.jsx)(g.gT,{})}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(h.ReviewDropdown,{cwd:a}),(0,e.jsx)("button",{onClick:()=>window.location.reload(),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:u("tabManagerTopBar.refreshProject"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),a&&(0,e.jsx)("button",{onClick:o,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:u("sessions.projectSessions"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,e.jsx)("button",{onClick:()=>{b?.cwd&&n.t4.runFork((0,p.em)(b.cwd).pipe(m.orElse(()=>m.void)))},className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:u("tabManagerTopBar.openInVSCode"),children:(0,e.jsx)("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:(0,e.jsx)("path",{d:"M17.583 2.213L12 7.393 6.417 2.213 1 6.17v11.66l5.417 3.957L12 16.607l5.583 5.18L23 17.83V6.17l-5.417-3.957zM6.417 17.83L3 15.33V8.67l3.417-2.5v11.66zm11.166 0V6.17L21 8.67v6.66l-3.417 2.5z"})})}),(0,e.jsx)("button",{onClick:()=>{b?.cwd&&n.t4.runFork((0,p.Q1)(b.cwd).pipe(m.orElse(()=>m.void)))},className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:u("tabManagerTopBar.openInCursor"),children:(0,e.jsx)("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:(0,e.jsx)("path",{d:"M4.5 2L20.5 12L4.5 22V2Z"})})}),b?.sessionId&&(0,e.jsx)("button",{onClick:()=>{let a=`claude -r ${b.sessionId}`;navigator.clipboard.writeText(a).then(()=>{(0,i.oR)(u("toast.copiedCommand",{command:a}),"success")})},className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:u("chat.copyCommandTooltip",{sessionId:b.sessionId}),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("button",{onClick:q,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:u("tabManagerTopBar.aliasesGlobal"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 12h-6m-4 0a8 8 0 1116 0 8 8 0 01-16 0zm4 0h.01"})})}),(0,e.jsx)("button",{onClick:()=>(0,k.F)(l.n.OpenTokenStats,{}),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:u("tabManagerTopBar.tokenStats"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})})}),(0,e.jsx)("button",{onClick:()=>window.open("https://surething.io?from=cockpit","_blank"),className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:u("tabManagerTopBar.openSurething"),children:(0,e.jsx)("img",{src:"https://surething.io/logo.png?from=cockpit",alt:"Surething",className:"w-5 h-5 rounded-sm"})})]})]})})}h=(q.then?(await q)():q)[0],d()}catch(a){d(a)}})},38896:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{C:()=>h});var e=c(67484),f=c(36984),g=a([f]);function h(a,b){let[c,d]=(0,e.useState)(null),[g,h]=(0,e.useState)(!1),i=(0,e.useMemo)(()=>a.join("\n"),[a]),j=`${i}:${b}:${g}`;return(0,e.useMemo)(()=>c&&c.key===j?c.html:a.map(a=>(0,f.ZD)(a||" ")),[a,j,c])}f=(g.then?(await g)():g)[0],d()}catch(a){d(a)}})},39222:(a,b,c)=>{"use strict";c.d(b,{v:()=>l});var d=c(48249),e=c(67484),f=c(44384),g=c(46674),h=c(59347),i=c(24520),j=c(33281),k=c(23328);function l({cwd:a,tabId:b,onClose:c,onSave:m}){let{t:n}=(0,f.Bd)(),[o,p]=(0,e.useState)({}),[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)(""),[u,v]=(0,e.useState)(!0);(0,e.useCallback)(async()=>{v(!0);let c=await j.t4.runPromiseExit((0,k.QF)(a,b));"Success"===c._tag?p(c.value):console.error("Failed to load env:",c.cause),v(!1)},[a,b]);let w=()=>{q.trim()&&(p(a=>({...a,[q.trim()]:s})),r(""),t(""))},x=async()=>{let d=await j.t4.runPromiseExit((0,k.Vv)({cwd:a,tabId:b,env:o}));"Success"===d._tag?(m(o),c()):console.error("Failed to save env:",d.cause)};return(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center z-50",children:(0,d.jsxs)("div",{className:"bg-background border border-border rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] flex flex-col m-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{className:"text-lg font-semibold",children:n("envManager.title")}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:b?n("envManager.tabScope"):n("envManager.globalScope")})]}),(0,d.jsx)("button",{onClick:c,className:"p-1 rounded hover:bg-accent transition-colors",children:(0,d.jsx)(g.A,{className:"w-5 h-5"})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:u?(0,d.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground",children:n("common.loading")}):(0,d.jsxs)("div",{className:"space-y-3",children:[Object.entries(o).map(([a,b])=>(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("input",{type:"text",value:a,disabled:!0,className:"flex-1 px-3 py-2 rounded-lg border border-input bg-muted text-sm font-mono"}),(0,d.jsx)("input",{type:"text",value:b,onChange:b=>{var c;return c=b.target.value,void p(b=>({...b,[a]:c}))},placeholder:n("envManager.valuePlaceholder"),className:"flex-1 px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent"}),(0,d.jsx)("button",{onClick:()=>{p(b=>{let c={...b};return delete c[a],c})},className:"p-2 rounded-lg text-destructive hover:bg-destructive/10 transition-colors",children:(0,d.jsx)(h.A,{className:"w-4 h-4"})})]},a)),(0,d.jsxs)("div",{className:"flex items-start gap-2 pt-2 border-t border-border",children:[(0,d.jsx)("input",{type:"text",value:q,onChange:a=>r(a.target.value),placeholder:n("envManager.varNamePlaceholder"),className:"flex-1 px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent",onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),w())}}),(0,d.jsx)("input",{type:"text",value:s,onChange:a=>t(a.target.value),placeholder:n("envManager.varValuePlaceholder"),className:"flex-1 px-3 py-2 rounded-lg border border-input bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-brand focus:border-transparent",onKeyDown:a=>{"Enter"!==a.key||a.nativeEvent.isComposing||(a.preventDefault(),w())}}),(0,d.jsx)("button",{onClick:w,disabled:!q.trim(),className:"p-2 rounded-lg bg-brand text-brand-foreground hover:bg-brand/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:(0,d.jsx)(i.A,{className:"w-4 h-4"})})]}),0===Object.keys(o).length&&(0,d.jsx)("div",{className:"text-center py-8 text-muted-foreground text-sm",children:n("envManager.noVars")})]})}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[(0,d.jsx)("button",{onClick:c,className:"px-4 py-2 rounded-lg text-sm hover:bg-accent transition-colors",children:n("common.cancel")}),(0,d.jsx)("button",{onClick:x,className:"px-4 py-2 rounded-lg text-sm bg-brand text-brand-foreground hover:bg-brand/90 transition-colors",children:n("common.save")})]})]})})}},39712:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{w:()=>p});var e=c(48249),f=c(67484),g=c(50757),h=c(27454),i=c(37752),j=c(87844),k=c(34678),l=c(83768);let a=new k.v;function m(a){return a?Array.isArray(a)?a.join(""):a:""}function n(a,b){return a&&a[b]?m(a[b]):""}a.use_classes=!0;let o=(0,f.memo)(function({output:b}){if("stream"===b.output_type){let c=m(b.text);if(!c)return null;let d=a.ansi_to_html(c);return(0,e.jsx)("pre",{className:`text-xs leading-relaxed whitespace-pre-wrap break-all px-3 py-1 ${"stderr"===b.name?"text-amber-500":"text-foreground"}`,dangerouslySetInnerHTML:{__html:d}})}if("error"===b.output_type){let c=(b.traceback||[]).join("\n"),d=a.ansi_to_html(c);return(0,e.jsx)("pre",{className:"text-xs leading-relaxed whitespace-pre-wrap break-all px-3 py-1 text-red-400 bg-red-500/5 rounded",dangerouslySetInnerHTML:{__html:d}})}if("execute_result"===b.output_type||"display_data"===b.output_type||"update_display_data"===b.output_type){let a=b.data;if(!a)return null;let c=n(a,"image/png"),d=n(a,"image/jpeg"),f=n(a,"image/svg+xml"),g=n(a,"text/html"),h=n(a,"text/markdown"),i=n(a,"text/latex"),k=n(a,"text/plain");if(c)return(0,e.jsx)("div",{className:"px-3 py-1",children:(0,e.jsx)("img",{src:`data:image/png;base64,${c}`,alt:"output",className:"max-w-full"})});if(d)return(0,e.jsx)("div",{className:"px-3 py-1",children:(0,e.jsx)("img",{src:`data:image/jpeg;base64,${d}`,alt:"output",className:"max-w-full"})});if(f)return(0,e.jsx)("div",{className:"px-3 py-1",dangerouslySetInnerHTML:{__html:f}});if(g)return(0,e.jsx)("div",{className:"px-3 py-1 overflow-x-auto notebook-html-output",dangerouslySetInnerHTML:{__html:g}});if(h)return(0,e.jsx)("div",{className:"px-3 py-1",children:(0,e.jsx)(j.T,{content:h})});if(i)return(0,e.jsx)("div",{className:"px-3 py-1",children:(0,e.jsx)(j.T,{content:`$$${i}$$`})});if(k)return(0,e.jsx)("pre",{className:"text-xs leading-relaxed whitespace-pre-wrap break-all px-3 py-1 text-foreground",children:k})}return null}),p=(0,f.memo)(function({cell:a,isActive:b,isEditing:c,onSelect:d,onEdit:k,onStopEdit:m,onSourceChange:n,onRun:p,onDelete:q,onMoveUp:r,onMoveDown:s,onToggleType:t,isFirst:u,isLast:v}){let{resolvedTheme:w}=(0,l.D)(),x=(0,f.useRef)(null),[y,z]=(0,f.useState)(a.source),A=(0,f.useCallback)(()=>{z(a.source),k()},[a.source,k]);(0,f.useEffect)(()=>{if(c&&x.current){x.current.focus();let a=x.current.value.length;x.current.setSelectionRange(a,a)}},[c]);let B=(0,f.useCallback)(()=>{let a=x.current;a&&(a.style.height="auto",a.style.height=a.scrollHeight+"px")},[]);(0,f.useEffect)(()=>{c&&B()},[c,y,B]);let C=(0,f.useCallback)(a=>{z(a.target.value),B()},[B]),D=(0,f.useCallback)(()=>{y!==a.source&&n(y),m()},[y,a.source,n,m]),E=(0,f.useCallback)(b=>{if("Enter"===b.key&&b.shiftKey)b.preventDefault(),y!==a.source&&n(y),p();else if("Enter"===b.key&&(b.metaKey||b.ctrlKey))b.preventDefault(),y!==a.source&&n(y),p();else if("Escape"===b.key)b.preventDefault(),D();else if("Tab"===b.key){b.preventDefault();let a=x.current;if(a){let b=a.selectionStart,c=a.selectionEnd,d=y.substring(0,b)+" "+y.substring(c);z(d),requestAnimationFrame(()=>{a.selectionStart=a.selectionEnd=b+4})}}},[y,a.source,n,p,D]),F=a.isExecuting?"*":a.execution_count??" ",G="code"===a.cell_type?"Code":"markdown"===a.cell_type?"Md":"Raw";return(0,e.jsxs)("div",{className:`group relative border rounded-lg transition-colors ${b?"border-brand/50 bg-brand/5":"border-border/50 hover:border-border"}`,onClick:d,children:[(0,e.jsxs)("div",{className:`absolute -top-3 left-2 flex items-center gap-0.5 text-[10px] z-10 bg-surface-secondary rounded px-1 py-0.5 border border-border/50 transition-opacity ${b?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:[(0,e.jsx)("button",{onClick:p,className:"px-1 hover:text-brand",title:"Run (Shift+Enter)",children:a.isExecuting?"⬛":"▶"}),(0,e.jsx)("button",{onClick:t,className:"px-1 hover:text-brand",title:"Toggle type",children:G}),!u&&(0,e.jsx)("button",{onClick:r,className:"px-1 hover:text-brand",title:"Move up",children:"↑"}),!v&&(0,e.jsx)("button",{onClick:s,className:"px-1 hover:text-brand",title:"Move down",children:"↓"}),(0,e.jsx)("button",{onClick:q,className:"px-1 hover:text-red-400",title:"Delete",children:"\xd7"})]}),(0,e.jsxs)("div",{className:"flex",children:[(0,e.jsx)("div",{className:"flex-shrink-0 w-10 text-center py-2 text-[10px] text-muted-foreground select-none cursor-pointer border-r border-border/30",onClick:a=>{a.stopPropagation(),p()},title:"code"===a.cell_type?"Click to run":void 0,children:"code"===a.cell_type?(0,e.jsxs)("span",{className:a.isExecuting?"text-brand animate-pulse":"",children:["[",F,"]"]}):(0,e.jsx)("span",{className:"text-muted-foreground/50",children:G})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("div",{className:"cursor-text",onDoubleClick:a=>{a.stopPropagation(),A()},children:c?(0,e.jsx)("textarea",{ref:x,value:y,onChange:C,onBlur:D,onKeyDown:E,className:"w-full bg-transparent text-xs font-mono leading-relaxed px-3 py-2 resize-none outline-none text-foreground",spellCheck:!1,style:{minHeight:"1.5rem"}}):"code"===a.cell_type?(0,e.jsx)("div",{className:"text-xs [&_pre]:!m-0 [&_pre]:!p-2 [&_pre]:!bg-transparent [&_code]:!bg-transparent",children:(0,e.jsx)(g.A,{language:"python",style:"dark"===w?h.A:i.A,customStyle:{margin:0,padding:"8px 12px",background:"transparent",fontSize:"12px"},wrapLongLines:!0,children:a.source||" "})}):"markdown"===a.cell_type?a.source.trim()?(0,e.jsx)("div",{className:"px-3 py-2 text-sm prose prose-sm dark:prose-invert max-w-none",children:(0,e.jsx)(j.T,{content:a.source})}):(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground italic",children:"Empty markdown cell"}):(0,e.jsx)("pre",{className:"text-xs font-mono px-3 py-2 text-muted-foreground whitespace-pre-wrap",children:a.source||" "})}),a.outputs.length>0&&(0,e.jsx)("div",{className:"border-t border-border/30",children:a.outputs.map((a,b)=>(0,e.jsx)(o,{output:a},b))})]})]})]})});d()}catch(a){d(a)}})},40159:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{S:()=>l,j:()=>a});var e=c(48249),f=c(67484),g=c(44384),h=c(208),i=c(44256);function j({blame:a,onClick:b}){let{t:c}=(0,g.Bd)(),d=(0,f.useRef)(null),k=(0,f.useRef)(null),l=(0,i.F2)(),m=(0,f.useRef)(!1),n=(0,f.useRef)(!1),o=(0,f.useRef)(null),p=(0,f.useRef)(null),q=(0,f.useRef)(null),r=(0,f.useRef)(a),s=(0,f.useRef)(b),t=(0,f.useCallback)(()=>{let a,b=k.current,c=d.current;if(!b||!c)return;let e=c.getBoundingClientRect(),f=b.getBoundingClientRect(),g=l?.getBoundingClientRect(),h=g?.left??0,i=g?.top??0,j=g?.width??window.innerWidth,m=g?.height??window.innerHeight,n=e.left-h;n+f.width>j-8&&(n=j-f.width-8),n<8&&(n=8);let o=e.top-i,p=e.bottom-i;(a=o-f.height-4<0?p+4:o-f.height-4)+f.height>m-8&&(a=m-f.height-8),b.style.left=`${n}px`,b.style.top=`${a}px`},[l]),u=(0,f.useCallback)(()=>{o.current&&(clearTimeout(o.current),o.current=null),p.current&&(clearTimeout(p.current),p.current=null),m.current=!1,n.current=!1,k.current&&(k.current.style.display="none"),q.current&&(document.removeEventListener("mousedown",q.current.down),document.removeEventListener("mouseup",q.current.up),q.current=null)},[]),v=(0,f.useCallback)(()=>{let a=k.current;if(!a||m.current)return;m.current=!0,a.style.left="-9999px",a.style.top="-9999px",a.style.display="block",requestAnimationFrame(()=>requestAnimationFrame(t));let b=0,c=0,e=a=>{b=a.clientX,c=a.clientY},f=a=>{if(!(Math.abs(a.clientX-b)>5||Math.abs(a.clientY-c)>5)){let b;b=a.target,k.current?.contains(b)||d.current?.contains(b)||u()}};document.addEventListener("mousedown",e),document.addEventListener("mouseup",f),q.current={down:e,up:f}},[t,u]),w=(0,f.useCallback)(()=>{if(o.current&&clearTimeout(o.current),p.current&&(clearTimeout(p.current),p.current=null),m.current)return;let a=window.getSelection();(!a||a.isCollapsed)&&(o.current=setTimeout(v,500))},[v]),x=(0,f.useCallback)(()=>{o.current&&(clearTimeout(o.current),o.current=null),m.current&&(p.current=setTimeout(()=>{n.current||u()},200))},[u]),y=(0,f.useCallback)(()=>{n.current=!0,p.current&&(clearTimeout(p.current),p.current=null)},[]),z=(0,f.useCallback)(()=>{n.current=!1,u()},[u]),A=(0,f.useCallback)(a=>{a.stopPropagation();let b=window.getSelection();b&&b.toString().length>0&&k.current?.contains(b.anchorNode)||(s.current?.(r.current),u())},[u]),B=a.message.split("\n")[0]||"",C=a.message.split("\n").slice(1).join("\n").trim();return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("span",{ref:d,className:"select-none text-xs text-muted-foreground/50 ml-6 cursor-default hover:text-muted-foreground/80",onMouseEnter:w,onMouseLeave:x,children:[a.author.split(" ")[0],", ",function(a){let b=h.A.t,c=Date.now(),d=Math.floor((c-1e3*a)/1e3);if(d<60)return b("common.justNow");let e=Math.floor(d/60);if(e<60)return b("common.minutesAgo",{count:e});let f=Math.floor(e/60);if(f<24)return b("common.hoursAgo",{count:f});let g=Math.floor(f/24);if(g<30)return b("common.daysAgo",{count:g});let i=Math.floor(g/30);if(i<12)return b("common.monthsAgo",{count:i});let j=Math.floor(i/12);return b("common.yearsAgo",{count:j})}(a.time)," \xb7 ",B]}),(0,e.jsx)(i.ZL,{children:(0,e.jsxs)("div",{ref:k,className:"fixed z-[9999] bg-card border border-border rounded-lg shadow-xl p-3 text-xs text-foreground whitespace-pre-wrap max-w-md select-text",style:{display:"none",minWidth:280,cursor:"text"},"data-inline-blame-tip":"",onMouseEnter:y,onMouseLeave:z,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,e.jsx)("span",{className:"font-mono text-brand",children:a.hash}),(0,e.jsx)("span",{className:"text-muted-foreground",children:a.author}),(0,e.jsx)("span",{className:"text-muted-foreground/60",children:new Date(1e3*a.time).toLocaleString()})]}),(0,e.jsx)("div",{className:"font-medium",children:B}),C&&(0,e.jsx)("div",{className:"mt-1 text-muted-foreground",children:C}),(0,e.jsx)("div",{className:"mt-2 text-[11px] text-brand border-t border-border pt-2 cursor-pointer hover:underline",onClick:A,children:c("codeViewer.clickToViewDetails")})]})})]})}let a=[{bg:"rgba(59, 130, 246, 0.15)",border:"rgb(59, 130, 246)"},{bg:"rgba(16, 185, 129, 0.15)",border:"rgb(16, 185, 129)"},{bg:"rgba(245, 158, 11, 0.15)",border:"rgb(245, 158, 11)"},{bg:"rgba(239, 68, 68, 0.15)",border:"rgb(239, 68, 68)"},{bg:"rgba(168, 85, 247, 0.15)",border:"rgb(168, 85, 247)"},{bg:"rgba(236, 72, 153, 0.15)",border:"rgb(236, 72, 153)"},{bg:"rgba(20, 184, 166, 0.15)",border:"rgb(20, 184, 166)"},{bg:"rgba(249, 115, 22, 0.15)",border:"rgb(249, 115, 22)"}];function k(a,b){let c,d=document.caretRangeFromPoint(a.clientX,a.clientY);if(!d||!b.contains(d.startContainer))return 1;let e=d.startContainer,f=d.startOffset,g=document.createTreeWalker(b,NodeFilter.SHOW_TEXT),h=1;for(;c=g.nextNode();){if(c===e){h+=f;break}h+=c.textContent?.length||0}return h}let l=(0,f.memo)(function({virtualKey:a,lineNum:b,highlightedHtml:c,hasComments:d,firstComment:h,lineCommentsCount:i,isInRange:l,showLineNumbers:m,lineNumChars:n,commentsEnabled:o,virtualItemSize:p,virtualItemStart:q,onCommentBubbleClick:r,onCmdClick:s,onTokenHover:t,onTokenHoverLeave:u,flashLine:v,blameLine:w,showBlameInfo:x,blameAuthorColor:y,isBlameHovered:z,onBlameClick:A,onBlameMouseEnter:B,onBlameMouseLeave:C,inlineBlameData:D,onInlineBlameClick:E,isCursorLine:F,cursorCol:G}){let{t:H}=(0,g.Bd)(),I=(0,f.useMemo)(()=>F&&null!=G?function(a,b){let c=0,d=0;for(;d<a.length;){if("<"===a[d]){let b=a.indexOf(">",d);if(-1!==b){d=b+1;continue}}if(c===b){let b;if("&"===a[d]){let c=a.indexOf(";",d);b=-1!==c&&c-d<10?c+1:d+1}else b=d+1;let c=a.substring(d,b);return a.substring(0,d)+'<span class="vi-char-cursor">'+c+"</span>"+a.substring(b)}if("&"===a[d]){let b=a.indexOf(";",d);d=-1!==b&&b-d<10?b+1:d+1}else d++;c++}return a+'<span class="vi-char-cursor"> </span>'}(c,G):c,[c,F,G]),J=(0,f.useCallback)(a=>{if(!a.metaKey||!s)return;a.preventDefault(),a.stopPropagation();let c=a.currentTarget,d=k(a,c);window.getSelection()?.removeAllRanges(),s(b,d)},[b,s]),K=(0,f.useCallback)(a=>{if(!t||0!==a.buttons)return;let c=window.getSelection();if(c&&!c.isCollapsed)return;let d=a.target;if("SPAN"!==d.tagName||!d.style.color)return;let e=a.currentTarget,f=k(a,e),g=d.getBoundingClientRect();t(b,f,{x:g.left,y:g.bottom+4})},[b,t]),L=(0,f.useCallback)(()=>{w&&A&&A(w)},[w,A]),M=(0,f.useCallback)(a=>{w&&B&&B(w,a)},[w,B]);return(0,e.jsxs)("div",{"data-line":b,style:{position:"absolute",top:0,left:0,width:"100%",height:`${p}px`,transform:`translateY(${q}px)`,backgroundColor:z&&y?y.bg:void 0},className:`flex ${v===b?"flash-line":""} ${F?"vi-cursor-line":""} ${l?"bg-blue-9/20":d?"bg-amber-9/10":"hover:bg-accent/50"}`,children:[(0,e.jsxs)("div",{className:"flex shrink-0 sticky left-0 z-[2] bg-secondary",style:{backgroundColor:z&&y?y.bg:void 0},children:[w&&y&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"w-1 flex-shrink-0",style:{backgroundColor:y.border}}),(0,e.jsx)("div",{className:"w-48 flex-shrink-0 px-2 flex items-center gap-2 border-r border-border text-muted-foreground cursor-pointer hover:bg-accent/50",onMouseEnter:M,onMouseLeave:C,onClick:L,title:H("codeViewer.clickToViewCommit"),children:x?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"font-medium",style:{color:y.border},children:w.hash}),(0,e.jsx)("span",{className:"truncate flex-1",children:w.author.split(" ")[0]})]}):null})]}),m&&(0,e.jsxs)("span",{className:`flex-shrink-0 flex items-center justify-end gap-0.5 pr-2 select-none border-r border-border font-variant-tabular ${l?"bg-blue-9/30 text-blue-11":"bg-card/50 text-slate-9"}`,children:[o&&d&&h&&(0,e.jsx)("button",{onClick:a=>r(h,a),className:"w-4 h-4 flex items-center justify-center rounded hover:bg-accent text-amber-9",title:H("codeViewer.nComments",{count:i}),children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:(0,e.jsx)("path",{fillRule:"evenodd",d:"M18 10c0 3.866-3.582 7-8 7a8.841 8.841 0 01-4.083-.98L2 17l1.338-3.123C2.493 12.767 2 11.434 2 10c0-3.866 3.582-7 8-7s8 3.134 8 7zM7 9H5v2h2V9zm8 0h-2v2h2V9zM9 9h2v2H9V9z",clipRule:"evenodd"})})}),o&&!d&&(0,e.jsx)("span",{className:"w-4"}),(0,e.jsx)("span",{className:"text-right",style:{minWidth:`${n}ch`},children:b})]})]}),(0,e.jsxs)("span",{className:"flex-1 px-3 whitespace-pre select-text",onClick:J,onMouseOver:K,onMouseLeave:u,"data-code-content":!0,children:[(0,e.jsx)("span",{dangerouslySetInnerHTML:{__html:I}}),D&&(0,e.jsx)(j,{blame:D,onClick:E})]})]},a)});d()}catch(a){d(a)}})},41051:(a,b,c)=>{"use strict";c.d(b,{f:()=>h});var d=c(48249),e=c(67484),f=c(44384);function g({x:a,y:b,visible:c,container:e,onAddComment:h,onSendToAI:i,onSearch:j,isChatLoading:k}){let{t:l}=(0,f.Bd)(),m=e.getBoundingClientRect(),n=a-m.left,o=Math.max(0,b-m.top-40);return(0,d.jsxs)("div",{className:"floating-toolbar absolute z-[200] flex items-center gap-1.5 bg-card border border-border rounded-lg shadow-xl p-1.5",style:{left:n+8,top:o,visibility:c?"visible":"hidden",pointerEvents:c?"auto":"none"},children:[(0,d.jsx)("button",{className:"px-3 py-1.5 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors",onClick:h,children:l("floatingToolbar.addComment")}),(0,d.jsx)("button",{className:"px-3 py-1.5 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:i,disabled:k,title:l(k?"comments.aiResponding":"floatingToolbar.sendToAI"),children:l("floatingToolbar.sendToAI")}),j&&(0,d.jsx)("button",{className:"px-3 py-1.5 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors",onClick:j,children:l("floatingToolbar.search")})]})}let h=(0,e.memo)(function({floatingToolbarRef:a,bumpRef:b,container:c,onAddComment:f,onSendToAI:h,onSearch:i,isChatLoading:j}){let[k,l]=(0,e.useState)(0),m=(0,e.useMemo)(()=>a.current,[k]);return(0,d.jsx)(g,{x:m?.x??0,y:m?.y??0,visible:!!m,container:c,onAddComment:f,onSendToAI:h,onSearch:i,isChatLoading:j})})},41224:(a,b,c)=>{"use strict";c.d(b,{Cr:()=>s,JC:()=>l,M5:()=>j,QW:()=>o,Zr:()=>n,an:()=>r,em:()=>i,l1:()=>k,n_:()=>m,qD:()=>q,td:()=>h});var d=c(79606),e=c(71192);let f=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`);return await c.json()},catch:c=>new e.uV({message:`${b?.method??"GET"} ${a} failed`,cause:c})}),g=(a,b)=>f(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),h=()=>f("/api/settings"),i=a=>f("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),j=a=>f(a?`/api/commands?cwd=${encodeURIComponent(a)}`:"/api/commands"),k=()=>f("/api/skills"),l=a=>g("/api/bash",a),m=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/session-by-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});return b.ok?await b.json():null},catch:a=>new e.uV({message:"POST /api/session-by-path failed",cause:a})}),n=(a,b)=>g(`/api/session/${encodeURIComponent(a)}/fork`,b),o=a=>f(`/api/sessions/projects/${encodeURIComponent(a)}`),p=()=>d.tryPromise({try:async()=>{let a=await fetch("/api/ollama/models");return 503===a.status?{_tag:"not-running"}:a.ok?{_tag:"ok",models:(await a.json()).models??[]}:{_tag:"error",message:"Failed to fetch models"}},catch:a=>new e.uV({message:"fetch ollama models failed",cause:a})}),q=a=>d.gen(function*(){let b=yield*p();if("not-running"!==b._tag)return b;a&&(yield*d.sync(a));let c=yield*d.tryPromise({try:async()=>{let a=await fetch("/api/ollama/start",{method:"POST"}),b=await a.json().catch(()=>({}));return 404===a.status?{_tag:"not-installed",message:b.message||"Ollama is not installed"}:a.ok?{_tag:"started"}:{_tag:"error",message:"Failed to start Ollama"}},catch:a=>new e.uV({message:"start ollama failed",cause:a})});if("not-installed"===c._tag)return{_tag:"not-installed",message:c.message};if("error"===c._tag)return{_tag:"error",message:c.message};let f=yield*p();return"not-running"===f._tag?{_tag:"error",message:"Ollama started but cannot fetch models"}:f}),r=a=>f(`/api/file?path=${encodeURIComponent(a)}`),s=a=>f(`/api/claude-stats?engine=${encodeURIComponent(a)}`)},42140:(a,b,c)=>{"use strict";c.d(b,{G:()=>h,t:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({x:a,y:b,range:c,lineSnapshot:h,container:i,onSubmit:j,onClose:k}){let{t:l}=(0,f.Bd)(),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(!1),q=(0,e.useRef)(null),r=(0,e.useRef)(null),[s,t]=(0,e.useState)({x:0,y:0}),u=h?.split("\n").slice(0,5).join("\n"),v=!!h&&h.split("\n").length>5;return(0,d.jsxs)("div",{ref:q,className:"absolute z-[200] w-[640px] bg-card border border-border rounded-lg shadow-lg overflow-hidden",style:{left:s.x,top:s.y},children:[(0,d.jsx)("div",{className:"px-3 py-2 bg-amber-9/10 border-b border-border",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-amber-11",children:l("comments.addComment")}),(c.start>0||c.end>0)&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:l("comments.lineRange",{start:c.start,end:c.end})})]})}),h&&(0,d.jsx)("div",{className:"px-3 py-2 bg-secondary/50 border-b border-border max-h-24 overflow-hidden",children:(0,d.jsxs)("pre",{className:"text-xs font-mono text-muted-foreground whitespace-pre-wrap break-all",children:[u,v&&(0,d.jsx)("span",{className:"text-muted-foreground/50",children:"..."})]})}),(0,d.jsxs)("div",{className:"p-2",children:[(0,d.jsx)("textarea",{ref:r,value:m,onChange:a=>n(a.target.value),placeholder:l("comments.inputPlaceholder"),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card resize-none focus:outline-none focus:ring-1 focus:ring-ring disabled:opacity-50 disabled:cursor-not-allowed",rows:2,disabled:o,onKeyDown:a=>{"Enter"===a.key&&!a.shiftKey&&!a.nativeEvent.isComposing&&(a.preventDefault(),!o&&m.trim()&&(p(!0),j(m.trim()))),"Escape"!==a.key||o||k()}}),(0,d.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:l(o?"comments.submitting":"comments.enterSubmit")})]})]})}function h({x:a,y:b,range:c,filePath:g,lineSnapshot:i,container:j,onSubmit:k,onClose:l,isChatLoading:m}){let{t:n}=(0,f.Bd)(),[o,p]=(0,e.useState)(""),q=(0,e.useRef)(null),r=(0,e.useRef)(null),[s,t]=(0,e.useState)({x:0,y:0}),u=i?.split("\n").slice(0,5).join("\n"),v=!!i&&i.split("\n").length>5;return(0,d.jsxs)("div",{ref:q,className:"absolute z-[200] w-[640px] bg-card border border-border rounded-lg shadow-lg overflow-hidden",style:{left:s.x,top:s.y},children:[(0,d.jsxs)("div",{className:"px-3 py-2 bg-brand/10 border-b border-border",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs font-medium text-brand",children:n("comments.askAI")}),(c.start>0||c.end>0)&&(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:n("comments.lineRange",{start:c.start,end:c.end})})]}),g&&(0,d.jsx)("div",{className:"mt-1 text-xs text-muted-foreground truncate",children:g})]}),i&&(0,d.jsx)("div",{className:"px-3 py-2 bg-secondary/50 border-b border-border max-h-24 overflow-hidden",children:(0,d.jsxs)("pre",{className:"text-xs font-mono text-muted-foreground whitespace-pre-wrap break-all",children:[u,v&&(0,d.jsx)("span",{className:"text-muted-foreground/50",children:"..."})]})}),(0,d.jsxs)("div",{className:"p-2",children:[(0,d.jsx)("textarea",{ref:r,value:o,onChange:a=>p(a.target.value),placeholder:n("comments.inputQuestion"),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card resize-none focus:outline-none focus:ring-1 focus:ring-ring disabled:opacity-50 disabled:cursor-not-allowed",rows:2,disabled:m,onKeyDown:a=>{"Enter"===a.key&&!a.shiftKey&&!a.nativeEvent.isComposing&&(a.preventDefault(),!m&&o.trim()&&(k(o.trim()),l())),"Escape"===a.key&&l()}}),(0,d.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:n(m?"comments.aiGenerating":"comments.enterSend")})]})]})}},43489:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,60440,23)),Promise.resolve().then(c.t.bind(c,84342,23)),Promise.resolve().then(c.t.bind(c,82265,23)),Promise.resolve().then(c.t.bind(c,35421,23)),Promise.resolve().then(c.t.bind(c,61335,23)),Promise.resolve().then(c.t.bind(c,70664,23)),Promise.resolve().then(c.bind(c,74661))},44256:(a,b,c)=>{"use strict";c.d(b,{F2:()=>m,ZL:()=>k,a9:()=>l});var d=c(48249),e=c(67484),f=c(74429);let g=()=>()=>{},h=()=>document.body,i=()=>null,j=(0,e.createContext)(null);function k({children:a}){let b=(0,e.useContext)(j),c=(0,e.useSyncExternalStore)(g,h,i),d=b??c;return d?(0,f.createPortal)(a,d):null}function l({children:a}){let[b,c]=(0,e.useState)(null);return(0,d.jsxs)("div",{className:"relative w-full h-full",style:{transform:"translateZ(0)"},children:[(0,d.jsx)(j.Provider,{value:b,children:a}),(0,d.jsx)("div",{ref:c,className:"absolute inset-0 pointer-events-none [&>*]:pointer-events-auto"})]})}function m(){return(0,e.useContext)(j)}},44616:(a,b,c)=>{Promise.resolve().then(c.bind(c,67045))},47111:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(48249),e=c(3560),f=c(13812),g=c(74493),h=a([f]);f=(h.then?(await h)():h)[0],(0,e.Aq)({type:"redis",idPrefix:"redis",match(a){let b=a.trim().toLowerCase();return b.startsWith("redis://")||b.startsWith("rediss://")},parse(a){let b=a.trim(),c=b;try{let a=new URL(b),d=a.pathname.replace(/^\//,"")||"0";c=`db${d}@${a.hostname}${a.port?":"+a.port:":6379"}`}catch{}return{connectionString:b,displayName:c}},fromHistory:a=>({connectionString:a.connectionString,displayName:a.displayName||a.connectionString}),toHistory:a=>({connectionString:a.connectionString,displayName:a.displayName}),Component:function({item:a,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l}){return(0,d.jsx)(f.k,{id:a.id,connectionString:a.connectionString,displayName:a.displayName,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l})},async onClose(a){await (0,g.ax)("redis",a.id)}}),b()}catch(a){b(a)}})},47938:(a,b,c)=>{"use strict";c.d(b,{SessionBrowser:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call SessionBrowser() from the server but SessionBrowser is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/SessionBrowser.tsx","SessionBrowser")},49924:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{mp:()=>k,nb:()=>l});var e=c(48249),f=c(44384),g=c(96286),h=c(46674),i=c(72529),j=c(53716);function k({entries:a,onSelect:b,onClear:c}){let{t:d}=(0,f.Bd)();return(0,e.jsxs)("div",{className:"w-56 flex-shrink-0 bg-card border-l border-border flex flex-col","data-testid":"function-history-drawer",children:[(0,e.jsxs)("div",{className:"flex-shrink-0 px-2 py-1.5 border-b border-border flex items-center justify-between gap-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground font-mono min-w-0",children:[(0,e.jsx)(g.A,{className:"w-3 h-3 flex-shrink-0"}),(0,e.jsx)("span",{className:"truncate",children:0===a.length?d("blockViewer.history.title"):`${d("blockViewer.history.title")} \xb7 ${a.length}/15`})]}),a.length>0&&(0,e.jsx)(i.m,{content:d("blockViewer.history.clear"),children:(0,e.jsx)("button",{onClick:c,className:"flex-shrink-0 text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-secondary",children:(0,e.jsx)(h.A,{className:"w-3 h-3"})})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===a.length?(0,e.jsx)("div",{className:"px-3 py-4 text-[10px] text-muted-foreground/60 italic leading-relaxed",children:d("blockViewer.history.empty")}):a.map((a,c)=>{var d;let f;return(0,e.jsx)(i.m,{content:`${a.qname} \xb7 ${a.filePath}`,children:(0,e.jsxs)("button",{onClick:()=>b(a),className:"w-full text-left px-2 py-1.5 border-b border-border/50 hover:bg-secondary/60 transition-colors group flex items-start gap-1.5",children:[(0,e.jsx)(j.y,{kind:a.kind??"unknown",qname:a.qname,className:"w-3 h-3 mt-0.5 flex-shrink-0"}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("div",{className:"text-xs font-mono font-medium truncate",children:a.name}),(0,e.jsxs)("div",{className:"text-[10px] text-muted-foreground/70 truncate",children:[(f=(d=a.filePath).lastIndexOf("/"))>=0?d.slice(f+1):d,a.kind&&(0,e.jsxs)("span",{className:"ml-1 opacity-60",children:["\xb7 ",a.kind]})]})]})]})},`${a.filePath}::${a.qname}::${c}`)})})]})}function l(a,b){let c=a.filter(a=>a.filePath!==b.filePath||a.qname!==b.qname),d=[b,...c];return d.length>15?d.slice(0,15):d}d()}catch(a){d(a)}})},49950:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{J:()=>t});var e=c(48249),f=c(67484),g=c(44384),h=c(36295),i=c(39222),j=c(32465),k=c(4354),l=c(55579),m=c(18191),n=c(63963),o=c(9780),p=c(33281),q=c(79606),r=c(23328),s=a([o,m,h,k]);function t({cwd:a,initialShellCwd:b,tabId:c,onCwdChange:d,onOpenNote:s}){let{t:u}=(0,g.Bd)(),{consoleItems:v,scrollRef:w,selectedCommandId:x,setSelectedCommandId:y,interruptCommand:z,sendStdin:A,deleteCommand:B,rerunCommand:C,ptySizeRef:D,resizePty:E,executeCommand:F,addPluginItem:G,closePluginItem:H,sleepingBubbles:I,handleBubbleSleep:J,handleBubbleWake:K,scrollToBottom:L,currentCwd:M,commandHistoryRef:N,setCustomEnv:O,setAliases:P,saveBubbleOrder:Q,hasMoreHistory:R,loadHistory:S,currentPage:T,isLoadingHistory:U,subscribePtyOutput:V,subscribePtyReset:W}=(0,m.cK)({cwd:a,initialShellCwd:b,tabId:c,onCwdChange:d}),[X,Y]=(0,f.useState)(null),[Z,$]=(0,f.useState)(0),[_,aa]=(0,f.useState)(0),[ab,ac]=(0,f.useState)(!0),[ad,ae]=(0,f.useState)(!1),[af,ag]=(0,f.useState)(!1),[ah,ai]=(0,f.useState)(!1),[aj,ak]=(0,f.useState)(!1),al=(0,f.useRef)(null),am=(0,f.useRef)(null),an=(0,f.useRef)(null),ao=(0,f.useRef)(!1),ap=(0,f.useRef)(null),aq=(0,f.useRef)(null),ar=(0,f.useRef)([]),as=(0,f.useCallback)(()=>{let a=w.current;return!a||a.scrollHeight-a.scrollTop-a.clientHeight<50},[w]),at=(0,f.useCallback)(()=>{let a=w.current;return!a||a.scrollTop<50},[w]),au=(0,f.useCallback)(()=>{ai(!at()),ak(!as())},[as,at]),av=(0,f.useCallback)(()=>{am.current?.scrollIntoView({behavior:"smooth"})},[]),aw=(0,f.useCallback)(()=>{ao.current=!0},[]),ax=(0,f.useCallback)((a,b)=>{if(!ao.current)return void a.preventDefault();ao.current=!1,ap.current=b,a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",b),a.currentTarget.style.opacity="0.4";let c=a.currentTarget.querySelector("[data-drag-handle]");if(c){let b=c.cloneNode(!0);b.style.cssText="position:fixed;top:-9999px;left:-9999px;width:"+c.offsetWidth+"px;background:var(--card);border-radius:8px;padding:4px 12px;opacity:0.9;",document.body.appendChild(b),a.dataTransfer.setDragImage(b,20,16),requestAnimationFrame(()=>document.body.removeChild(b))}},[]),ay=(0,f.useCallback)((a,b)=>{a.preventDefault(),a.dataTransfer.dropEffect="move",aq.current=b},[]),az=(0,f.useCallback)(a=>{a.preventDefault(),a.currentTarget.classList.add("ring-2","ring-brand")},[]),aA=(0,f.useCallback)(a=>{a.currentTarget.classList.remove("ring-2","ring-brand")},[]),aB=(0,f.useCallback)(a=>{a.preventDefault(),a.currentTarget.classList.remove("ring-2","ring-brand")},[]),aC=(0,f.useCallback)(a=>{a.currentTarget.style.opacity="1";let b=ap.current,c=aq.current;if(ap.current=null,aq.current=null,!b||!c||b===c)return;let d=ar.current.map(a=>a.data.id),e=d.indexOf(b),f=d.indexOf(c);if(-1===e||-1===f)return;let g=[...d];g[e]=c,g[f]=b,Q(g)},[Q]),aD=(0,f.useCallback)(a=>{Y(b=>b===a?null:a)},[]),aE=_>0?Math.floor((_-32-12)/2-41):void 0;return(0,e.jsxs)("div",{ref:al,className:"h-full flex flex-col bg-background relative",children:[(0,e.jsx)("div",{ref:w,onScroll:au,className:`flex-1 overflow-y-auto ${X?"":"py-4 px-4"}`,children:0===v.length?(0,e.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:u("console.enterCommandOrUrl")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{ref:am}),R&&(0,e.jsx)("div",{className:"flex justify-center mb-4",children:(0,e.jsx)("button",{onClick:()=>S(T+1),disabled:U,className:"px-4 py-2 text-sm text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors disabled:opacity-50",children:u(U?"console.loadingMore":"console.loadMoreHistory")})}),(0,e.jsx)("div",{className:X?"flex flex-col gap-3":ab?"grid grid-cols-2 gap-3":"flex flex-col gap-3",children:v.map(b=>{let d={draggable:!0,onDragStart:a=>ax(a,b.data.id),onDragOver:a=>ay(a,b.data.id),onDragEnter:az,onDragLeave:aA,onDrop:aB,onDragEnd:aC};if("command"===b.type){let f=b.data;return(0,e.jsx)("div",{"data-bubble-id":f.id,className:"group/cmd rounded-lg transition-shadow",...d,children:(0,e.jsx)(h.G,{commandId:f.id,tabId:c,projectCwd:a,command:f.command,output:f.output,exitCode:f.exitCode,isRunning:f.isRunning,selected:x===f.id,onSelect:()=>{y(f.id)},onInterrupt:f.isRunning?()=>z(f.id):void 0,onStdin:f.isRunning?a=>A(f.id,a):void 0,onDelete:()=>{f.isRunning&&f.pid&&(0,n.HV)(f.pid),B(f.id)},onRerun:()=>C(f.id),timestamp:f.timestamp,usePty:f.usePty,subscribePtyOutput:f.usePty?V:void 0,subscribePtyReset:f.usePty?W:void 0,onPtyResize:(a,b)=>{D.current.set(f.id,{cols:a,rows:b}),E(f.id,a,b)},onToggleMaximize:()=>aD(f.id),maximized:X===f.id,expandedHeight:Z,bubbleContentHeight:aE,onTitleMouseDown:aw})},f.id)}let f=(0,o.sd)(b.type);if(!f)return null;let g=f.Component,i=b.data;return(0,e.jsx)("div",{"data-bubble-id":i.id,className:"rounded-lg transition-shadow",...d,children:(0,e.jsx)(g,{item:i,selected:x===i.id,maximized:X===i.id,expandedHeight:Z,bubbleContentHeight:aE,timestamp:i.timestamp,onSelect:()=>{y(i.id)},onClose:()=>H(i.id),onToggleMaximize:()=>aD(i.id),onTitleMouseDown:aw,extra:{addBrowserItem:(a,b)=>G("browser",a,b),initialSleeping:I.has(i.id),onSleep:J,onWake:K}})},i.id)})}),(0,e.jsx)("div",{ref:an})]})}),!X&&v.length>0&&(0,e.jsx)(l.w,{showTop:ah,showBottom:aj,onScrollTop:av,onScrollBottom:L}),(0,e.jsx)(k.D,{cwd:a,currentCwd:M,commandHistoryRef:N,gridLayout:ab,onGridLayoutChange:b=>{ac(b),p.t4.runFork((0,r.Yn)({cwd:a,settings:{gridLayout:b}}).pipe(q.tapError(a=>q.sync(()=>console.error("Failed to save project settings:",a))),q.orElse(()=>q.void)))},onExecute:F,onAddPluginItem:G,onShowEnvManager:()=>ae(!0),onOpenZsh:()=>F("zsh"),onOpenNote:s}),ad&&(0,e.jsx)(i.v,{cwd:a,tabId:c,onClose:()=>ae(!1),onSave:a=>O(a)}),af&&(0,e.jsx)(j.Y,{onClose:()=>ag(!1),onSave:a=>P(a)})]})}[o,m,h,k]=s.then?(await s)():s,d()}catch(a){d(a)}})},51520:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(48249),e=c(3560),f=c(77016),g=c(74493),h=a([f]);f=(h.then?(await h)():h)[0],(0,e.Aq)({type:"mysql",idPrefix:"mysql",match:a=>a.trim().toLowerCase().startsWith("mysql://"),parse(a){let b=a.trim(),c=b;try{let a=new URL(b),d=a.pathname.replace(/^\//,"")||"mysql";c=`${d}@${a.hostname}${a.port?":"+a.port:""}`}catch{}return{connectionString:b,displayName:c}},fromHistory:a=>({connectionString:a.connectionString,displayName:a.displayName||a.connectionString}),toHistory:a=>({connectionString:a.connectionString,displayName:a.displayName}),Component:function({item:a,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l}){return(0,d.jsx)(f.b,{id:a.id,connectionString:a.connectionString,displayName:a.displayName,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l})},async onClose(a){await (0,g.ax)("mysql",a.id)}}),b()}catch(a){b(a)}})},53036:(a,b,c)=>{"use strict";c.d(b,{I:()=>f});var d=c(48249),e=c(67484);function f(a){let{refreshKey:b,className:c="h-full flex items-center justify-center p-4 bg-secondary",imgClassName:f="max-w-full max-h-full object-contain",alt:g}=a,h="absPath"in a&&"string"==typeof a.absPath,i=h?void 0:a.cwd,j=h?void 0:a.path,k=h?a.absPath:void 0,[l,m]=(0,e.useState)({kind:"loading"});if((0,e.useRef)(0),"loading"===l.kind)return(0,d.jsx)("div",{className:c,children:(0,d.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})});if("missing"===l.kind)return(0,d.jsx)("div",{className:c,children:(0,d.jsx)("div",{className:"text-sm text-muted-foreground",children:"File not found"})});if("too-large"===l.kind)return(0,d.jsx)("div",{className:c,children:(0,d.jsxs)("div",{className:"text-sm text-muted-foreground",children:["Image too large to preview (",Math.round(l.size/1024/1024)," MB)"]})});if("error"===l.kind)return(0,d.jsx)("div",{className:c,children:(0,d.jsx)("div",{className:"text-sm text-red-11",children:l.message})});let n=h?`/api/file?path=${encodeURIComponent(k)}&raw=true`:`/api/files/read?cwd=${encodeURIComponent(i)}&path=${encodeURIComponent(j)}&v=${encodeURIComponent(l.etag)}`;return(0,d.jsx)("div",{className:c,children:(0,d.jsx)("img",{src:n,alt:g??(j||k),className:f})})}c(33281),c(87808)},53113:(a,b,c)=>{Promise.resolve().then(c.bind(c,4462)),Promise.resolve().then(c.bind(c,29491)),Promise.resolve().then(c.bind(c,34001)),Promise.resolve().then(c.bind(c,83179)),Promise.resolve().then(c.bind(c,25608)),Promise.resolve().then(c.bind(c,8077)),Promise.resolve().then(c.bind(c,76552)),Promise.resolve().then(c.bind(c,77120)),Promise.resolve().then(c.bind(c,77220)),Promise.resolve().then(c.bind(c,3588)),Promise.resolve().then(c.bind(c,77462)),Promise.resolve().then(c.bind(c,38878)),Promise.resolve().then(c.bind(c,37129)),Promise.resolve().then(c.bind(c,99033))},53716:(a,b,c)=>{"use strict";c.d(b,{y:()=>l});var d=c(48249),e=c(80600),f=c(33982),g=c(34622),h=c(34948),i=c(26875),j=c(87148),k=c(82633);function l({kind:a,qname:b,className:c}){let m=`${(function(a,b){if("__file__"===b||"__preamble__"===b||b&&b.startsWith("__heading_"))return"text-muted-foreground/60";switch(a){case"function":case"method":return"text-violet-11";case"class":return"text-amber-11";case"interface":return"text-blue-11";default:return"text-muted-foreground/60"}})(a,b)} ${c??""}`.trim();if("__file__"===b)return(0,d.jsx)(e.A,{className:m});if("__preamble__"===b)return(0,d.jsx)(f.A,{className:m});if(b&&b.startsWith("__heading_"))return(0,d.jsx)(g.A,{className:m});switch(a){case"function":case"method":return(0,d.jsx)(h.A,{className:m});case"class":return(0,d.jsx)(i.A,{className:m});case"interface":return(0,d.jsx)(j.A,{className:m});default:return(0,d.jsx)(k.A,{className:m})}}},54038:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{g:()=>k});var e=c(48249),f=c(67484),g=c(44384),h=c(65543),i=c(72529),j=c(53716);function k({functions:a,currentQname:b,onSelect:c}){let{t:d}=(0,g.Bd)(),l=(0,f.useMemo)(()=>a.filter(h._),[a]);return(0,e.jsxs)("div",{className:"w-56 flex-shrink-0 bg-card border-r border-border flex flex-col","data-testid":"file-toc-section",children:[(0,e.jsx)("div",{className:"flex-shrink-0 px-2 py-1.5 border-b border-border text-xs text-muted-foreground font-mono truncate",children:0===l.length?d("blockViewer.toc.title"):`${d("blockViewer.toc.title")} \xb7 ${l.length}`}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===l.length?(0,e.jsx)("div",{className:"px-3 py-4 text-[10px] text-muted-foreground/60 italic leading-relaxed",children:d("blockViewer.toc.empty")}):l.map(a=>{let d=b===a.qualifiedName;return(0,e.jsx)(i.m,{content:`${a.qualifiedName} \xb7 L${a.startLine}`,children:(0,e.jsxs)("button",{onClick:()=>c(a.qualifiedName,a.startLine),className:`w-full text-left px-2 py-1 transition-colors flex items-center gap-1.5 min-w-0 ${d?"bg-brand/15 hover:bg-brand/20":"hover:bg-secondary/60"}`,children:[(0,e.jsx)(j.y,{kind:a.kind,qname:a.qualifiedName,className:"w-3 h-3 flex-shrink-0"}),(0,e.jsx)("span",{className:`text-xs font-mono truncate ${d?"font-semibold text-brand":""}`,children:a.name})]})},a.qualifiedName)})})]})}d()}catch(a){d(a)}})},55287:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Cv:()=>B,XO:()=>z});var e=c(48249),f=c(67484),g=c(44384),h=c(74429),i=c(33281),j=c(87808),k=c(7122),l=c(42140),m=c(38896),n=c(36984),o=c(41051),p=c(70596),q=c(40159),r=c(13512),s=c(9804),t=c(7833),u=c(83377),v=a([r,n,q,m]);[r,n,q,m]=v.then?(await v)():v;let A="white-space:pre;padding:0 12px;min-height:20px;line-height:20px";function w(a){let b=window.getSelection();if(!b?.rangeCount)return null;let c=b.getRangeAt(0),d=c.startContainer;for(;d&&d.parentElement!==a;)d=d.parentElement;if(!d)return null;let e=Array.from(a.children).indexOf(d);if(e<0)return null;let f=document.createRange();f.selectNodeContents(d),f.setEnd(c.startContainer,c.startOffset);let g=f.toString().length;return{line:e,offset:g}}function x(a,b){let c,d=a.children[b.line];if(!d)return;let e=document.createTreeWalker(d,NodeFilter.SHOW_TEXT),f=b.offset;for(;c=e.nextNode();){let a=c.textContent?.length||0;if(f<=a){let a=window.getSelection(),b=document.createRange();b.setStart(c,f),b.collapse(!0),a?.removeAllRanges(),a?.addRange(b);return}f-=a}let g=window.getSelection(),h=document.createRange();h.selectNodeContents(d),h.collapse(!1),g?.removeAllRanges(),g?.addRange(h)}function y(a){return a.map(a=>`<div style="${A}">${a}</div>`).join("")}let B=(0,f.forwardRef)(function({content:a,filePath:b,showLineNumbers:c=!0,showSearch:d=!0,className:m="",cwd:v,enableComments:z=!1,scrollToLine:B=null,scrollToLineAlign:C="center",onScrollToLineComplete:D,highlightKeyword:E=null,visibleLineRef:F,onCmdClick:G,onTokenHover:H,onTokenHoverLeave:I,onTokenHoverCancel:J,blameLines:K,inlineBlameLines:L,onSelectCommit:M,editable:N=!1,initialMtime:O,onEditorClose:P,onSaved:Q,onEditorStateChange:R,viMode:S=!1,onContentMutate:T,onEnterInsertMode:U,onViSave:V,viStateRef:W,initialCursorLine:X,initialCursorCol:Y,onInitialCursorSet:Z,onContentSearch:$},_){let{t:aa}=(0,g.Bd)(),ab=(0,f.useRef)(a),ac=(0,f.useRef)(!1),[ad,ae]=(0,f.useState)(!1),[af,ag]=(0,f.useState)(!1),[ah,ai]=(0,f.useState)(()=>a.split("\n").length),aj=(0,f.useRef)(a.split("\n").length),[ak,al]=(0,f.useState)({show:!1}),am=(0,f.useRef)(null),an=(0,f.useRef)(null),ao=(0,f.useRef)(O),ap=(0,f.useRef)(null),aq=(0,f.useRef)(!1),ar=(0,f.useRef)(!1),{parentRef:as,containerRef:at,searchInputRef:au,floatingToolbarRef:av,suppressHoverRef:aw,bumpToolbarRef:ax,savedSelectionRef:ay,highlightedLines:az,isMounted:aA,cmdHeld:aB,flashLine:aC,isSearchVisible:aD,searchQuery:aE,caseSensitive:aF,wholeWord:aG,currentMatchIndex:aH,viewingComment:aI,addCommentInput:aJ,sendToAIInput:aK,aiBridge:aL,commentsEnabled:aM,updateComment:aN,deleteComment:aO,lines:aP,matches:aQ,rowData:aR,virtualizer:aS,commentsByEndLine:aT,linesWithComments:aU,setIsSearchVisible:aV,setSearchQuery:aW,setCaseSensitive:aX,setWholeWord:aY,setViewingComment:aZ,setAddCommentInput:a$,setSendToAIInput:a_,goToNextMatch:a0,goToPrevMatch:a1,handleSearchKeyDown:a2,handleCommentBubbleClick:a3,handleToolbarAddComment:a4,handleToolbarSendToAI:a5,handleToolbarSearch:a6,handleCommentSubmit:a7,handleSendToAISubmit:a8,getHighlightedLineHtml:a9,suppressMatchScrollRef:ba,inlineBlameLineRef:bb,inlineBlameVersion:bc}=(0,r.d)({content:a,filePath:b,showSearch:d,cwd:v,enableComments:!N&&z,scrollToLine:N?null:B,scrollToLineAlign:N?"center":C,onScrollToLineComplete:N?void 0:D,visibleLineRef:N?void 0:F,onContentSearch:$}),bd=(0,k.iN)(),be=(0,f.useRef)(null),bf=(0,f.useRef)(null),bg=(0,f.useRef)({line:0,col:0}),bh=(0,f.useRef)({line:0,col:0}),bi=(0,u.A)({lines:aP,enabled:S&&!N,onContentChange:a=>{bg.current={line:bh.current.line,col:bh.current.col},T?.(a)},onEnterInsert:(a,b,c)=>{let d=b;if("a"===c)d=b+1;else if("A"===c)d=(aP[a]??"").length;else if("I"===c){let b=(aP[a]??"").search(/\S/);d=b>=0?b:0}else("o"===c||"O"===c)&&(d=0);bg.current={line:a,col:d},U?.(a)},onSave:V,getVisibleLineCount:()=>{let a=as.current;return a?Math.floor(a.clientHeight/20):20},scrollToLine:(a,b)=>{let c=aR.findIndex(b=>"code"===b.type&&b.lineIndex===a);c>=0&&aS.scrollToIndex(c,{align:b||"auto"})},onSearchExecute:a=>{aW(a),aV(!1)},onSearchNext:a0,onSearchPrev:a1,onSearchClear:()=>{aW("")}});(0,f.useEffect)(()=>{W&&(W.current={cursorLine:bi.state.cursorLine,cursorCol:bi.state.cursorCol}),bh.current={line:bi.state.cursorLine,col:bi.state.cursorCol}},[W,bi.state.cursorLine,bi.state.cursorCol]);let bj=(0,f.useRef)(null);(0,f.useEffect)(()=>{S&&!N&&null!=X&&b&&bj.current!==b&&(bj.current=b,bi.setCursorLine(X-1),null!=Y&&bi.setCursorCol(Y-1),Z?.())},[S,N,X,Y,b]),(0,f.useEffect)(()=>{if(!S||N)return;let a=at.current;if(!a)return;let b=a=>{let b=a.target;"TEXTAREA"===b.tagName||"INPUT"===b.tagName||b.isContentEditable||bi.handleKeyDown(a)&&(a.preventDefault(),a.stopPropagation())};return a.addEventListener("keydown",b,!0),()=>a.removeEventListener("keydown",b,!0)},[S,N,bi.handleKeyDown]),(0,f.useEffect)(()=>{if(!S||N)return;let a=at.current;a&&"normal"===bi.state.mode&&requestAnimationFrame(()=>{let b=document.activeElement;b&&("TEXTAREA"===b.tagName||"INPUT"===b.tagName||b.isContentEditable)||a.focus()})},[S,N,bi.state.mode,a]);let bk=(0,f.useCallback)(a=>{if(!S||N)return;let b=a.target.closest("[data-line]");if(b){let c=parseInt(b.getAttribute("data-line"),10);if(!isNaN(c)){bi.setCursorLine(c-1);let d=b.querySelector("[data-code-content]");if(d){let b=document.caretRangeFromPoint(a.clientX,a.clientY);if(b&&d.contains(b.startContainer)){let a,e=document.createTreeWalker(d,NodeFilter.SHOW_TEXT),f=0;for(;a=e.nextNode();){if(a===b.startContainer){f+=b.startOffset;break}f+=a.textContent?.length||0}let g=aP[c-1]??"";bi.setCursorCol(Math.max(0,Math.min(f,Math.max(0,g.length-1))))}}}}let c=a.target;if("TEXTAREA"===c.tagName||"INPUT"===c.tagName||c.isContentEditable)return;let d=at.current;d&&d.focus()},[S,N,bi.setCursorLine,bi.setCursorCol,aP]),bl=(0,f.useCallback)(a=>{S&&!N&&requestAnimationFrame(()=>{let a=window.getSelection(),b=a?.toString().trim();b&&/^\S+$/.test(b)&&(ba.current=!0,aW(b))})},[S,N,aW,ba]);(0,f.useEffect)(()=>{"command"===bi.state.mode?setTimeout(()=>be.current?.focus(),0):"search"===bi.state.mode&&setTimeout(()=>bf.current?.focus(),0)},[bi.state.mode]),(0,f.useEffect)(()=>{let a=as.current;if(!a)return;let b=()=>{(J??I)?.()};return a.addEventListener("mousedown",b),()=>a.removeEventListener("mousedown",b)},[J,I]),(0,f.useEffect)(()=>{aJ||aK?(aw.current=!0,I?.()):av.current||(aw.current=!1)},[aJ,aK,I]),(0,f.useLayoutEffect)(()=>{let a=ay.current;if(!a)return;let b=window.getSelection();if(b&&!b.isCollapsed)return;let c=as.current;if(!c)return;let d=c.querySelector(`[data-line="${a.startLine}"]`),e=c.querySelector(`[data-line="${a.endLine}"]`);if(!d||!e)return;let f=(0,r.o)(d,a.startOffset),g=(0,r.o)(e,a.endOffset);if(f&&g)try{let a=document.createRange();a.setStart(f.node,f.offset),a.setEnd(g.node,g.offset),b?.removeAllRanges(),b?.addRange(a)}catch{}});let bm=(0,f.useCallback)((a,b,c)=>{aw.current||H?.(a,b,c)},[H]),bn=(0,f.useCallback)((a,b)=>{aw.current||G?.(a,b)},[G]),bo=Math.max(4,String(N?ah:aP.length).length),bp=(0,f.useMemo)(()=>{let a=0;for(let b of aP){let c=0;for(let a=0;a<b.length;a++)" "===b[a]?c+=2-c%2:c+=1;c>a&&(a=c)}return a},[aP]);(0,f.useEffect)(()=>{if(N){ab.current=a;let b=a.split("\n").length;aj.current=b,ai(b),ac.current=!1,ae(!1),al({show:!1}),ao.current=O}},[N,a,O]),(0,f.useEffect)(()=>{if(!N)return;let b=am.current;if(!b)return;let c=a.split("\n"),d=c.map((a,b)=>az[b]||(0,n.ZD)(a||" "));b.innerHTML=y(d),requestAnimationFrame(()=>{let a,d;S?(a=Math.max(0,Math.min(bg.current.line,c.length-1)),d=bg.current.col):(a=Math.max(0,Math.min((F?.current??1)-1,c.length-1)),d=0),b.focus(),x(b,{line:a,offset:d});let e=F?.current??1;an.current&&(an.current.scrollTop=(e-1)*20)})},[N]),(0,f.useEffect)(()=>{N&&R?.({isDirty:ad,isSaving:af})},[N,ad,af,R]);let bq=(0,f.useCallback)(()=>{let a=am.current;if(!a)return ab.current;let b=[];for(let c of a.childNodes){let a=c.textContent||"";b.push(" "===a?"":a)}return b.join("\n")},[]),br=(0,f.useCallback)(()=>{ap.current&&clearTimeout(ap.current),ap.current=setTimeout(async()=>{let a=am.current;if(a&&!ar.current){ab.current=bq();try{let c=await (0,n.kS)(),d=(0,n.sQ)(b),e=document.documentElement.classList.contains("dark"),f=ab.current.split("\n"),g=c.codeToTokens(f.join("\n"),{lang:d,theme:e?"github-dark":"github-light"}).tokens.map(a=>(0,n.b8)(a)),h=w(a);aq.current=!0,a.innerHTML=y(g),aq.current=!1,h&&x(a,h)}catch{}}},300)},[b,bq]);(0,f.useEffect)(()=>{if(N)return()=>{ap.current&&clearTimeout(ap.current)}},[N]);let bs=(0,f.useCallback)(()=>{let a=am.current;if(!a)return;ac.current||(ac.current=!0,ae(!0));let b=a.children.length;b!==aj.current&&(aj.current=b,ai(b))},[]),bt=(0,f.useCallback)(()=>{aq.current||ar.current||(bs(),br())},[bs,br]),bu=(0,f.useCallback)(a=>{if(!a.nativeEvent.isComposing&&("Tab"===a.key&&(a.preventDefault(),document.execCommand("insertText",!1," ")),"Enter"===a.key)){a.preventDefault();let b=am.current;if(!b)return;let c=window.getSelection();if(!c?.rangeCount)return;let d=c.getRangeAt(0);d.deleteContents();let e=d.startContainer;for(;e&&e.parentElement!==b;)e=e.parentElement;if(!e||!(e instanceof HTMLElement))return;let f=w(b),g=Array.from(b.children).indexOf(e),h=e.textContent||"",i=f?.offset??h.length,j=h.substring(0,i),k=h.substring(i);e.innerHTML=(0,n.ZD)(j||" ");let l=document.createElement("div");l.setAttribute("style",A),l.innerHTML=(0,n.ZD)(k||" "),e.after(l),x(b,{line:g+1,offset:0}),bs(),br()}},[bs,br]),bv=(0,f.useCallback)(a=>{a.preventDefault();let b=a.clipboardData.getData("text/plain");document.execCommand("insertText",!1,b)},[]),bw=(0,f.useCallback)(async(a=!1)=>{if(!v)return;ab.current=bq(),ag(!0);let c=await i.t4.runPromiseExit((0,j.OJ)({cwd:v,path:b,content:ab.current,expectedMtime:a?void 0:ao.current}));if("Failure"===c._tag){console.error("Error saving file:",c.cause),(0,t.oR)(aa("toast.saveFailed"),"error"),ag(!1);return}let d=c.value,e=d.data;if(409===d.status&&e?.conflict){let a=await i.t4.runPromiseExit((0,j.K9)(v,b));"Success"===a._tag&&a.value.ok&&"string"==typeof a.value.data?.content?al({show:!0,diskContent:a.value.data.content}):al({show:!0}),ag(!1);return}if(!d.ok){console.error("Error saving file: status",d.status),(0,t.oR)(aa("toast.saveFailed"),"error"),ag(!1);return}let f=e?.mtime;f&&(ao.current=f),ac.current=!1,ae(!1),al({show:!1}),(0,t.oR)(aa("toast.savedSuccess"),"success"),Q?.(),ag(!1)},[v,b,bq,Q,aa]),bx=(0,f.useCallback)(async()=>{ad&&!af&&await bw(!1)},[ad,af,bw]),by=(0,f.useCallback)(async()=>{al({show:!1}),await bw(!0)},[bw]),bz=(0,f.useCallback)(()=>{if(void 0!==ak.diskContent){ab.current=ak.diskContent;let b=ak.diskContent.split("\n").length;aj.current=b,ai(b);let c=ak.diskContent!==a;ac.current=c,ae(c);let d=am.current;if(d){let a=ak.diskContent.split("\n");d.innerHTML=y(a.map(a=>(0,n.ZD)(a||" "))),br()}}al({show:!1}),Q?.()},[ak.diskContent,a,Q,br]),bA=(0,f.useCallback)(()=>{let a=an.current;return a?Math.floor(a.scrollTop/20)+1:F?.current??1},[F]),bB=(0,f.useCallback)(async()=>{(!ad||await (0,t.lJ)(aa("codeViewer.unsavedConfirm"),{danger:!0,confirmText:aa("codeViewer.discardChanges"),cancelText:aa("codeViewer.continueEditing")}))&&P?.(bA())},[ad,P,bA]);(0,f.useEffect)(()=>{if(!N)return;let a=a=>{(a.metaKey||a.ctrlKey)&&"s"===a.key&&(a.preventDefault(),bx())};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[N,bx]);let bC=(0,f.useCallback)(()=>{let a=bq();T?.(a);let b=am.current,c=b?w(b):null,d=bA();if(bi.enterNormal(),c){bi.setCursorLine(c.line);let b=a.split("\n")[c.line]??"";bi.setCursorCol(Math.max(0,Math.min(c.offset,Math.max(0,b.length-1))))}else bi.setCursorLine(Math.max(0,d-1));P?.(d)},[bq,T,bA,P,bi]);(0,f.useEffect)(()=>{if(!N)return;let a=a=>{let b="Escape"===a.key,c=a.ctrlKey&&"c"===a.key&&!a.metaKey&&!a.shiftKey;(b||S&&c)&&(a.preventDefault(),a.stopPropagation(),S?ac.current?(0,t.lJ)(aa("codeViewer.unsavedExitConfirm"),{danger:!0,confirmText:aa("codeViewer.discardChanges"),cancelText:aa("codeViewer.continueEditing")}).then(a=>{a&&bC()}):bC():bB())};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[N,S,bB,bC]);let bD=(0,f.useCallback)(()=>{ac.current||(ac.current=!0,ae(!0))},[]);(0,f.useImperativeHandle)(_,()=>({save:bx,close:bB,markDirty:bD,get isDirty(){return ac.current},get isSaving(){return af}}),[bx,bB,bD,af]);let bE=!!(K&&K.length>0),bF=(0,f.useMemo)(()=>{if(!K)return new Map;let a=[...new Set(K.map(a=>a.author))],b=new Map;return a.forEach((a,c)=>{b.set(a,q.j[c%q.j.length])}),b},[K]),[bG,bH]=(0,f.useState)(null),[bI,bJ]=(0,f.useState)(null);(0,f.useEffect)(()=>{bH(null),bJ(null)},[K]);let bK=(0,f.useCallback)((a,b)=>{bH(a.author);let c=b.currentTarget.getBoundingClientRect();bJ({line:a,x:c.right+8,y:c.top})},[]),bL=(0,f.useCallback)(()=>{bH(null),bJ(null)},[]),bM=(0,f.useCallback)(a=>{if(!M)return;let b={hash:a.hashFull,shortHash:a.hash,author:a.author,authorEmail:a.authorEmail,date:new Date(1e3*a.time).toISOString(),subject:a.message.split("\n")[0]||"",body:a.message.split("\n").slice(1).join("\n").trim(),time:a.time};M(b),bJ(null)},[M]),bN=`${bo+2}ch`;return(0,e.jsxs)("div",{ref:at,className:`h-full flex flex-col outline-none ${m}`,tabIndex:0,onClick:bk,onDoubleClick:bl,children:[N&&ak.show&&(0,e.jsxs)("div",{className:"px-4 py-2 bg-amber-500/15 border-b border-amber-500/30 flex items-center gap-3 flex-shrink-0",children:[(0,e.jsx)("svg",{className:"w-5 h-5 text-amber-500 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})}),(0,e.jsx)("span",{className:"text-sm text-foreground flex-1",children:aa("codeViewer.fileModifiedExternally")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:bz,className:"px-3 py-1 text-sm rounded border border-border hover:bg-accent transition-colors",children:aa("codeViewer.useDiskVersion")}),(0,e.jsx)("button",{onClick:by,className:"px-3 py-1 text-sm rounded bg-amber-500 text-white hover:bg-amber-600 transition-colors",children:aa("codeViewer.forceOverwrite")})]})]}),!N&&d&&aD&&(0,e.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-secondary border-b border-border",children:[(0,e.jsx)("input",{ref:au,type:"text",value:aE,onChange:a=>aW(a.target.value),onKeyDown:a2,placeholder:aa("codeViewer.searchPlaceholder"),className:"flex-1 max-w-xs px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),(0,e.jsx)("button",{onClick:()=>aX(!aF),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${aF?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-accent"}`,title:aa("codeViewer.caseSensitive"),children:"Aa"}),(0,e.jsx)("button",{onClick:()=>aY(!aG),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${aG?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-accent"}`,title:aa("codeViewer.wholeWordMatch"),children:"[ab]"}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:aQ.length>0?`${aH+1}/${aQ.length}`:aa("common.noMatch")}),(0,e.jsx)("button",{onClick:a1,disabled:0===aQ.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:aa("common.previous"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}),(0,e.jsx)("button",{onClick:a0,disabled:0===aQ.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:aa("common.next"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),(0,e.jsx)("button",{onClick:()=>{aV(!1),aW("")},className:"p-1 rounded hover:bg-accent",title:aa("common.close"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),N?(0,e.jsx)("div",{ref:an,className:"flex-1 overflow-auto bg-secondary",children:(0,e.jsxs)("div",{className:"flex",style:{minHeight:"100%"},children:[(0,e.jsx)("div",{className:"flex-shrink-0 font-mono text-sm select-none sticky left-0 z-[2] bg-secondary",style:{width:bN},children:Array.from({length:ah},(a,b)=>(0,e.jsx)("div",{className:"text-right text-muted-foreground/50 pr-3",style:{height:20,lineHeight:"20px"},children:b+1},b))}),(0,e.jsx)("div",{ref:am,contentEditable:!0,suppressContentEditableWarning:!0,onInput:bt,onKeyDown:bu,onPaste:bv,onCompositionStart:()=>{ar.current=!0},onCompositionEnd:()=>{ar.current=!1,bt()},spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",className:"flex-1 font-mono text-sm outline-none",style:{caretColor:"var(--foreground)",tabSize:2}})]})}):(0,e.jsx)("div",{ref:as,className:`flex-1 overflow-auto font-mono text-sm bg-secondary${aB?" cmd-held-container":""}`,children:(0,e.jsx)("div",{style:{height:`${aS.getTotalSize()}px`,minWidth:"100%",width:bE?`calc(${bo+bp+10}ch + 13rem)`:`${bo+bp+10}ch`,position:"relative"},children:aS.getVirtualItems().map(a=>{let b=aR[a.index];if("code"!==b.type)return null;let d=b.lineIndex,f=d+1,g=az[d]||(0,n.ZD)(aP[d]||""),h=a9(d,g,E),i=aU.has(f),j=aT.get(f),k=j?.[0],l=!!(aJ&&f>=aJ.range.start&&f<=aJ.range.end),m=bc>=0?bb.current:null,o=!N&&L&&m===f?L[d]??null:null,p=bE?K[d]:void 0,r=bE&&d>0?K[d-1]:void 0,s=!!p&&(!r||r.hash!==p.hash),t=p?bF.get(p.author):void 0;return(0,e.jsx)(q.S,{virtualKey:a.key,lineNum:f,highlightedHtml:h,hasComments:i,firstComment:k,lineCommentsCount:j?.length,isInRange:l,showLineNumbers:c,lineNumChars:bo,commentsEnabled:aM,virtualItemSize:a.size,virtualItemStart:a.start,onCommentBubbleClick:a3,onCmdClick:bn,onTokenHover:bm,onTokenHoverLeave:I,flashLine:aC,blameLine:p,showBlameInfo:s,blameAuthorColor:t,isBlameHovered:!!(p&&bG===p.author),onBlameClick:bM,onBlameMouseEnter:bK,onBlameMouseLeave:bL,inlineBlameData:o,onInlineBlameClick:bM,isCursorLine:S&&!N&&bi.state.cursorLine===d,cursorCol:S&&!N&&bi.state.cursorLine===d?bi.state.cursorCol:void 0},a.key)})})}),S&&(0,e.jsxs)("div",{className:"vi-status-bar flex-shrink-0 h-6 bg-card border-t border-border flex items-center px-3 text-xs font-mono select-none",children:["normal"===bi.state.mode&&(0,e.jsx)("span",{className:"text-green-11 font-medium",children:"NORMAL"}),"insert"===bi.state.mode&&(0,e.jsx)("span",{className:"text-blue-11 font-medium",children:"INSERT"}),"command"===bi.state.mode&&(0,e.jsxs)("div",{className:"flex items-center flex-1",children:[(0,e.jsx)("span",{className:"text-foreground",children:":"}),(0,e.jsx)("input",{ref:be,value:bi.state.commandInput,onChange:a=>bi.setCommandInput(a.target.value),onKeyDown:a=>{if(a.nativeEvent.isComposing)return;let b=a.ctrlKey&&"c"===a.key&&!a.metaKey&&!a.shiftKey;("Enter"===a.key||"Escape"===a.key||b)&&(a.preventDefault(),a.stopPropagation(),bi.handleKeyDown(a.nativeEvent))},className:"flex-1 bg-transparent outline-none text-foreground ml-0.5",spellCheck:!1,autoComplete:"off"})]}),"search"===bi.state.mode&&(0,e.jsxs)("div",{className:"flex items-center flex-1",children:[(0,e.jsx)("span",{className:"text-foreground",children:"/"}),(0,e.jsx)("input",{ref:bf,value:bi.state.searchInput,onChange:a=>bi.setSearchInput(a.target.value),onKeyDown:a=>{if(a.nativeEvent.isComposing)return;let b=a.ctrlKey&&"c"===a.key&&!a.metaKey&&!a.shiftKey;("Enter"===a.key||"Escape"===a.key||b)&&(a.preventDefault(),a.stopPropagation(),bi.handleKeyDown(a.nativeEvent))},className:"flex-1 bg-transparent outline-none text-foreground ml-0.5",spellCheck:!1,autoComplete:"off"})]}),bi.state.keyBuffer&&"normal"===bi.state.mode&&(0,e.jsx)("span",{className:"ml-2 text-muted-foreground",children:bi.state.keyBuffer}),bi.state.isDirty&&("normal"===bi.state.mode||"command"===bi.state.mode)&&(0,e.jsx)("span",{className:"ml-2 text-amber-11",children:"[+]"}),(0,e.jsxs)("span",{className:"ml-auto text-muted-foreground",children:[bi.state.cursorLine+1,":",bi.state.cursorCol+1]})]}),aA&&bd&&(0,h.createPortal)((0,e.jsxs)(e.Fragment,{children:[!N&&(0,e.jsx)(o.f,{floatingToolbarRef:av,bumpRef:ax,container:bd,onAddComment:a4,onSendToAI:a5,onSearch:$?a6:void 0,isChatLoading:aL?.isLoading}),!N&&aJ&&(0,e.jsx)(l.t,{x:aJ.x,y:aJ.y,range:aJ.range,lineSnapshot:aJ.lineSnapshot,container:bd,onSubmit:a7,onClose:()=>a$(null)}),!N&&aK&&(0,e.jsx)(l.G,{x:aK.x,y:aK.y,range:aK.range,filePath:b,lineSnapshot:aK.lineSnapshot,container:bd,onSubmit:a8,onClose:()=>a_(null),isChatLoading:aL?.isLoading}),!N&&aI&&(0,e.jsx)(p.t,{x:aI.x,y:aI.y,comment:aI.comment,container:bd,onClose:()=>aZ(null),onUpdateComment:aN,onDeleteComment:aO}),bI&&(0,e.jsxs)("div",{className:"fixed z-50 bg-card border border-border rounded-lg shadow-lg p-3 max-w-lg",style:{left:Math.min(bI.x,window.innerWidth-450),top:Math.max(8,Math.min(bI.y,window.innerHeight-200))},children:[(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[(0,e.jsx)("div",{className:"px-2 py-0.5 rounded text-xs font-mono font-medium text-white flex-shrink-0",style:{backgroundColor:bF.get(bI.line.author)?.border||"#666"},children:bI.line.hash}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-foreground",children:bI.line.author}),(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:bI.line.authorEmail})]})]}),(0,e.jsx)("div",{className:"mt-2 text-sm text-foreground whitespace-pre-wrap max-h-48 overflow-y-auto",children:bI.line.message}),(0,e.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground border-t border-border pt-2",children:[(0,s.fw)(bI.line.time)," \xb7 ",new Date(1e3*bI.line.time).toLocaleString(),(0,e.jsx)("span",{className:"ml-2 text-brand",children:aa("codeViewer.clickToViewDetails")})]})]})]}),bd)]})});function z({content:a,filePath:b,className:c=""}){let d=(0,f.useMemo)(()=>a.split("\n"),[a]),g=(0,m.C)(d,b),h=Math.max(4,String(d.length).length);return(0,e.jsx)("pre",{className:`overflow-auto text-sm font-mono bg-secondary p-2 ${c}`,children:d.map((a,b)=>(0,e.jsxs)("div",{className:"flex",children:[(0,e.jsx)("span",{className:"text-slate-9 select-none pr-4 text-right",style:{minWidth:`${h+2}ch`},children:b+1}),(0,e.jsx)("span",{className:"flex-1",dangerouslySetInnerHTML:{__html:g[b]||(0,n.ZD)(a||" ")}})]},b))})}d()}catch(a){d(a)}})},55579:(a,b,c)=>{"use strict";c.d(b,{w:()=>f});var d=c(48249),e=c(44384);function f({showTop:a,showBottom:b,onScrollTop:c,onScrollBottom:g}){let{t:h}=(0,e.Bd)();return(0,d.jsxs)(d.Fragment,{children:[a&&(0,d.jsx)("button",{onClick:c,className:"absolute top-2 left-1/2 -translate-x-1/2 p-2 bg-card text-muted-foreground hover:text-foreground shadow-md rounded-full transition-all hover:shadow-lg active:scale-95 z-10",title:h("chat.jumpToStart"),children:(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}),b&&(0,d.jsx)("button",{onClick:g,className:"absolute bottom-20 left-1/2 -translate-x-1/2 p-2 bg-card text-muted-foreground hover:text-foreground shadow-md rounded-full transition-all hover:shadow-lg active:scale-95 z-10",title:h("chat.jumpToLatest"),children:(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})}},55632:(a,b,c)=>{"use strict";c.d(b,{EmptyState:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call EmptyState() from the server but EmptyState is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/EmptyState.tsx","EmptyState")},56696:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{M:()=>r});var e=c(48249),f=c(67484),g=c(44256),h=c(36295),i=c(7833),j=c(28602),k=c(44384),l=c(74493),m=a([h]);h=(m.then?(await m)():m)[0];let w=[{value:"=",label:"="},{value:"!=",label:"≠"},{value:">",label:">"},{value:"<",label:"<"},{value:">=",label:"≥"},{value:"<=",label:"≤"},{value:"LIKE",label:"LIKE"},{value:"NOT LIKE",label:"NOT LIKE"},{value:"IN",label:"IN"},{value:"IS NULL",label:"IS NULL"},{value:"IS NOT NULL",label:"IS NOT NULL"}];function n(a){if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`}function o(a){return`"${a.replace(/"/g,'""')}"`}function p(a){return null==a?"":"object"==typeof a?JSON.stringify(a):String(a)}function q({text:a}){let[b,c]=(0,f.useState)(!1),[d,h]=(0,f.useState)({x:0,y:0,maxW:600,maxH:300,above:!0}),i=(0,f.useRef)(null),j=(0,f.useRef)(null),k=(0,f.useRef)(!1),l=(0,g.F2)(),m=(0,f.useCallback)(()=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{k.current||c(!1)},80)},[]),n=(0,f.useCallback)(()=>{j.current&&clearTimeout(j.current),k.current=!1,j.current=setTimeout(()=>{let a=i.current;if(!a||a.scrollWidth<=a.clientWidth)return;let b=a.getBoundingClientRect(),d=l?.getBoundingClientRect(),e=d?.left??0,f=d?.top??0,g=d?.width??window.innerWidth,j=d?.height??window.innerHeight,k=b.left-e,m=b.top-f,n=b.bottom-f,o=Math.min(600,g-k-8),p=o<200?Math.max(8,g-600-8):k,q=o<200?Math.min(600,g-16):o,r=m-8,s=j-n-8,t=r>s&&r>80,u=t?r-4:s-4;h({x:p,y:t?m-4:n+4,maxW:q,maxH:Math.max(60,u),above:t}),c(!0)},350)},[l]),o=(0,f.useCallback)(()=>{m()},[m]),p=(0,f.useCallback)(()=>{k.current=!0,j.current&&clearTimeout(j.current)},[]),r=(0,f.useCallback)(()=>{k.current=!1,m()},[m]);return(0,e.jsxs)("span",{ref:i,className:"block truncate",onMouseEnter:n,onMouseLeave:o,children:[a,b&&(0,e.jsx)(g.ZL,{children:(0,e.jsx)("div",{className:"fixed z-[9999] overflow-y-auto px-2 py-1.5 text-xs font-mono bg-popover text-popover-foreground border border-border rounded shadow-lg whitespace-pre-wrap break-all select-text cursor-text",style:{left:d.x,top:d.y,maxWidth:d.maxW,maxHeight:d.maxH,transform:d.above?"translateY(-100%)":void 0},onMouseEnter:p,onMouseLeave:r,children:function(a){try{let b=JSON.parse(a);if("object"==typeof b&&null!==b)return JSON.stringify(b,null,2)}catch{}return a}(a)})})]})}function r({id:a,connectionString:b,displayName:c,selected:d,maximized:g,expandedHeight:m,bubbleContentHeight:t,onSelect:w,onClose:x,onToggleMaximize:y,timestamp:z,onTitleMouseDown:A}){let{t:B}=(0,k.Bd)(),{showToast:C}=(0,i.dj)(),[D,E]=(0,f.useState)("connecting"),[F,G]=(0,f.useState)(""),[H,I]=(0,f.useState)([]),[J,K]=(0,f.useState)("public"),[L,M]=(0,f.useState)([]),[N,O]=(0,f.useState)(null),[P,Q]=(0,f.useState)("table"),[R,S]=(0,f.useState)("data"),[T,U]=(0,f.useState)([]),[V,W]=(0,f.useState)([]),[X,Y]=(0,f.useState)([]),[Z,$]=(0,f.useState)([]),[_,aa]=(0,f.useState)(null),[ab,ac]=(0,f.useState)(0),[ad,ae]=(0,f.useState)(!1),[af,ag]=(0,f.useState)(0),[ah,ai]=(0,f.useState)(new Set),[aj,ak]=(0,f.useState)(!1),[al,am]=(0,f.useState)(null),[an,ao]=(0,f.useState)({}),[ap,aq]=(0,f.useState)(!1),[ar,as]=(0,f.useState)({}),[at,au]=(0,f.useState)({}),[av,aw]=(0,f.useState)(null),[ax,ay]=(0,f.useState)(""),[az,aA]=(0,f.useState)(null),[aB,aC]=(0,f.useState)(""),[aD,aE]=(0,f.useState)(!1),aF=(0,f.useRef)(null),aG=(0,f.useCallback)(async()=>{E("connecting"),G("");try{let c=await (0,l.GW)("/api/db/connect",{id:a,connectionString:b});I(c.schemas||[]),c.schemas?.length>0&&!c.schemas.includes("public")&&K(c.schemas[0]),E("connected")}catch(a){G(a instanceof Error?a.message:String(a)),E("error")}},[a,b]),aH=(0,f.useCallback)(async()=>{if("connected"===D)try{let c=await (0,l.Ey)("/api/db/schemas",{id:a,connectionString:b,schema:J});M(c.tables||[])}catch{}},[a,b,J,D]),aI=(0,f.useCallback)(async(c,d,e,f)=>{ae(!0);let g=e??at,h=void 0!==f?f:av;try{let e=`${o(J)}.${o(c)}`,{where:f,params:i}=function(a){let b=[],c=[],d=1;for(let[e,f]of Object.entries(a)){if(!f.enabled)continue;let a=o(e);if("IS NULL"===f.op)b.push(`${a} IS NULL`);else if("IS NOT NULL"===f.op)b.push(`${a} IS NOT NULL`);else if("IN"===f.op){let e=f.value.split(",").map(a=>a.trim()).filter(Boolean);if(0===e.length)continue;let g=e.map(a=>(c.push(a),`$${d++}`));b.push(`${a}::text IN (${g.join(", ")})`)}else"LIKE"===f.op||f.op,b.push(`${a}::text ${f.op} $${d++}`),c.push(f.value)}return{where:b.length>0?` WHERE ${b.join(" AND ")}`:"",params:c}}(g),j=h?` ORDER BY ${o(h.column)} ${h.dir}`:"",k=`SELECT * FROM ${e}${f}${j} LIMIT 50 OFFSET ${50*d}`,m=await (0,l.GW)("/api/db/query",{id:a,connectionString:b,sql:k,params:i});aa(m);let n=`SELECT count(*)::int AS cnt FROM ${e}${f}`,p=await (0,l.GW)("/api/db/query",{id:a,connectionString:b,sql:n,params:i});ag(p.rows?.[0]?.cnt??0)}catch{}ae(!1)},[a,b,J,at,av]),aJ=(0,f.useCallback)(async c=>{O(c),ac(0),am(null),aq(!1),ai(new Set),ak(!1),au({}),aw(null);try{let d=await (0,l.Ey)("/api/db/columns",{id:a,connectionString:b,schema:J,table:c});U(d.columns||[]),W(d.primaryKeys||[]),Y(d.foreignKeys||[]),$(d.indexes||[])}catch{}aI(c,0,{},null)},[a,b,J,aI]),aK=(0,f.useCallback)(async()=>{if(ax.trim()){aE(!0),aC(""),aA(null);try{let c=await (0,l.GW)("/api/db/query",{id:a,connectionString:b,sql:ax});aA(c)}catch(a){aC(a instanceof Error?a.message:String(a))}aE(!1)}},[a,b,ax]),aL=(0,f.useCallback)(async()=>{if(null===al||!_||!N)return;let c=_.rows[al],d=[],e=[],f=1;for(let a of T)void 0!==an[a.name]&&an[a.name]!==p(c[a.name]??"")&&(d.push(`${o(a.name)} = $${f}`),e.push(""===an[a.name]&&a.nullable?null:an[a.name]),f++);if(0===d.length)return void am(null);let g=V.length>0?V:T.map(a=>a.name),h=[];for(let a of g)null===c[a]||void 0===c[a]?h.push(`${o(a)} IS NULL`):(h.push(`${o(a)} = $${f}`),e.push(c[a]),f++);let i=`UPDATE ${o(J)}.${o(N)} SET ${d.join(", ")} WHERE ${h.join(" AND ")}`;try{await (0,l.GW)("/api/db/query",{id:a,connectionString:b,sql:i,params:e}),am(null),aI(N,ab,at,av)}catch(a){alert(`Update failed: ${a instanceof Error?a.message:String(a)}`)}},[al,_,N,T,V,an,a,b,J,aI,ab,at,av]),aM=(0,f.useCallback)(async()=>{if(!N)return;let c=[],d=[],e=[],f=1;for(let a of T)void 0!==ar[a.name]&&""!==ar[a.name]&&(c.push(o(a.name)),d.push(ar[a.name]),e.push(`$${f}`),f++);if(0===c.length)return;let g=`INSERT INTO ${o(J)}.${o(N)} (${c.join(", ")}) VALUES (${e.join(", ")})`;try{await (0,l.GW)("/api/db/query",{id:a,connectionString:b,sql:g,params:d}),aq(!1),as({}),aI(N,ab,at,av)}catch(a){alert(`Insert failed: ${a instanceof Error?a.message:String(a)}`)}},[N,T,ar,a,b,J,aI,ab,at,av]),aN=(0,f.useCallback)(async()=>{if(0===ah.size||!_||!N)return;let c=V.length>0?V:T.map(a=>a.name),d=0;for(let e of Array.from(ah).sort((a,b)=>b-a)){let f=_.rows[e];if(!f)continue;let g=[],h=[],i=1;for(let a of c)null===f[a]||void 0===f[a]?g.push(`${o(a)} IS NULL`):(g.push(`${o(a)} = $${i}`),h.push(f[a]),i++);let j=`DELETE FROM ${o(J)}.${o(N)} WHERE ctid = (SELECT ctid FROM ${o(J)}.${o(N)} WHERE ${g.join(" AND ")} LIMIT 1)`;try{await (0,l.GW)("/api/db/query",{id:a,connectionString:b,sql:j,params:h})}catch{d++}}ai(new Set),ak(!1),aI(N,ab,at,av),d>0&&alert(B("database.deleteRowsFailed",{count:d}))},[ah,_,N,V,T,a,b,J,aI,ab,at,av]),aO=(0,f.useCallback)(async c=>{if(!N)return;if(ah.size>0&&_){let a,b=_.fields.map(a=>a.name),d=Array.from(ah).sort((a,b)=>a-b).map(a=>_.rows[a]).filter(Boolean);if("json"===c)a=JSON.stringify(d,null,2);else{let c=[b.join(",")];for(let a of d)c.push(b.map(b=>{let c=a[b];if(null==c)return"";let d="object"==typeof c?JSON.stringify(c):String(c);return d.includes(",")||d.includes('"')||d.includes("\n")?`"${d.replace(/"/g,'""')}"`:d}).join(","));a=c.join("\n")}navigator.clipboard.writeText(a);return}let d=`SELECT * FROM ${o(J)}.${o(N)}`;try{let e=await (0,l.HS)("/api/db/export",{id:a,connectionString:b,sql:d,format:c}),f=URL.createObjectURL(e),g=document.createElement("a");g.href=f,g.download=`${N}.${c}`,g.click(),URL.revokeObjectURL(f)}catch(a){alert(`Export failed: ${a instanceof Error?a.message:String(a)}`)}},[N,a,b,J,ah,_]),aP=(0,f.useCallback)(a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&(a.preventDefault(),aK())},[aK]),aQ=g&&m?m-41:t??h.p,aR=Math.max(1,Math.ceil(af/50)),aS=(0,f.useCallback)(a=>{N&&(ac(a),aI(N,a,at,av))},[N,aI,at,av]),aT=(0,f.useCallback)((a,b)=>{let c={...at};b?c[a]=b:delete c[a],au(c),ac(0),ai(new Set),N&&aI(N,0,c,av)},[at,av,N,aI]),aU=(0,f.useCallback)(()=>{au({}),ac(0),ai(new Set),N&&aI(N,0,{},av)},[av,N,aI]),aV=(0,f.useCallback)(a=>{aw(a),ac(0),ai(new Set),N&&aI(N,0,at,a)},[at,N,aI]);return(0,e.jsx)("div",{className:"flex flex-col items-start",children:(0,e.jsxs)("div",{className:`w-full bg-accent text-foreground
|
|
24
24
|
relative transition-colors cursor-pointer
|
|
25
25
|
${g?"rounded-none overflow-visible border-0":"border overflow-hidden rounded-2xl rounded-bl-md rounded-br-md"}
|
|
26
26
|
${g?"":d?"border-brand":"border-brand/30"}`,onClick:g?void 0:w,children:[(0,e.jsxs)("div",{"data-drag-handle":!0,onDoubleClick:y,onMouseDown:A,className:`flex items-center gap-2 px-4 py-1.5 border-b border-border ${g?"bg-card":"bg-card/50"}`,style:g?{height:41}:void 0,children:[(0,e.jsx)("span",{className:"text-sm flex-shrink-0",children:"\uD83D\uDC18"}),(0,e.jsx)("span",{className:"text-xs text-foreground truncate font-mono font-medium",children:c}),"connecting"===D&&(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin flex-shrink-0"}),"error"===D&&(0,e.jsx)("span",{className:"text-[10px] text-destructive flex-shrink-0",children:B("database.connectionFailed")}),"connected"===D&&(0,e.jsx)("span",{className:"text-[10px] text-emerald-500 flex-shrink-0",children:B("database.connected")}),(0,e.jsx)("span",{className:"flex-1"}),z&&(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:n(z)}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),y()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:g?B("browser.exitMaximize",{modKey:(0,j.Mu)()}):B("browser.maximize",{modKey:(0,j.Mu)()}),children:g?(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3"})}):(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),x()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:B("common.close"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsxs)("div",{style:{height:aQ},className:"flex overflow-hidden",children:["connecting"===D&&(0,e.jsxs)("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:[(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin mr-2"}),B("database.connecting")]}),"error"===D&&(0,e.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 p-4",children:[(0,e.jsx)("span",{className:"text-sm text-destructive text-center break-all",children:F}),(0,e.jsx)("button",{onClick:aG,className:"px-3 py-1.5 text-xs bg-brand text-white rounded-md hover:bg-brand/90 transition-colors",children:B("common.retry")})]}),"connected"===D&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"w-52 flex-shrink-0 border-r border-border flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"p-1.5 border-b border-border flex items-center gap-1",children:[H.length>1?(0,e.jsx)("select",{value:J,onChange:a=>{K(a.target.value),O(null)},className:"flex-1 min-w-0 text-xs bg-background border border-input rounded px-1.5 py-1",children:H.map(a=>(0,e.jsx)("option",{value:a,children:a},a))}):(0,e.jsx)("span",{className:"flex-1 min-w-0 text-xs text-muted-foreground truncate",children:J}),(0,e.jsx)("button",{onClick:aH,className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent active:bg-accent/50 transition-colors",title:B("database.refreshTableList"),children:(0,e.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("path",{d:"M1 1v5h5"}),(0,e.jsx)("path",{d:"M15 15v-5h-5"}),(0,e.jsx)("path",{d:"M13.5 6A6 6 0 0 0 3.2 3.2L1 6"}),(0,e.jsx)("path",{d:"M2.5 10a6 6 0 0 0 10.3 2.8L15 10"})]})})]}),(0,e.jsx)("div",{className:"flex items-center border-b border-border",children:["table","view"].map(a=>(0,e.jsx)("button",{onClick:()=>Q(a),className:`flex-1 py-1 text-[10px] font-medium transition-colors ${P===a?"text-brand border-b border-brand":"text-muted-foreground hover:text-foreground"}`,children:{table:B("database.filterTable"),view:B("database.filterView")}[a]},a))}),(0,e.jsxs)("div",{className:"flex-1 overflow-y-auto text-xs",children:[L.filter(a=>"table"===P?"view"!==a.type:"view"===a.type).map(a=>(0,e.jsxs)("div",{onClick:()=>aJ(a.name),className:`flex items-center gap-1.5 px-2 py-1 cursor-pointer truncate transition-colors ${N===a.name?"bg-brand/10 text-brand":"hover:bg-accent text-foreground"}`,children:[(0,e.jsx)("span",{className:"flex-shrink-0 text-[10px] text-muted-foreground",children:"view"===a.type?"V":"T"}),(0,e.jsx)("span",{className:"truncate min-w-0 flex-1",children:(0,e.jsx)(q,{text:a.name})}),(0,e.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground flex-shrink-0",children:a.rowEstimate>0?`~${a.rowEstimate}`:""})]},a.name)),0===L.length&&(0,e.jsx)("div",{className:"p-2 text-muted-foreground text-center",children:B("database.noTables")})]})]}),(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-0 border-b border-border bg-card/30 flex-shrink-0",children:[["structure","data","sql"].map(a=>(0,e.jsx)("button",{onClick:()=>S(a),className:`px-3 py-1.5 text-xs transition-colors ${R===a?"text-brand border-b-2 border-brand font-medium":"text-muted-foreground hover:text-foreground"}`,children:{structure:B("database.tabStructure"),data:B("database.tabData"),sql:"SQL"}[a]},a)),N&&"data"===R&&(0,e.jsxs)("div",{className:"ml-auto flex items-center gap-1 pr-2",children:[Object.values(at).some(a=>a.enabled)&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-[10px] text-brand",children:B("database.filterActive",{count:Object.values(at).filter(a=>a.enabled).length})}),(0,e.jsx)("button",{onClick:aU,className:"px-1 py-0.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors",title:B("database.clearAllFilters"),children:"✕"}),(0,e.jsx)("span",{className:"text-border",children:"|"})]}),ah.size>0&&!aj&&(0,e.jsx)("button",{onClick:()=>ak(!0),className:"px-1.5 py-0.5 text-[10px] text-destructive hover:text-destructive/80 bg-destructive/10 rounded transition-colors",children:B("database.deleteNRows",{count:ah.size})}),aj&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-[10px] text-destructive",children:B("database.confirmDeleteRows")}),(0,e.jsx)("button",{onClick:aN,className:"px-1.5 py-0.5 text-[10px] text-white bg-destructive rounded transition-colors hover:bg-destructive/80",children:B("common.confirm")}),(0,e.jsx)("button",{onClick:()=>ak(!1),className:"px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground bg-muted rounded transition-colors",children:B("common.cancel")})]}),(0,e.jsx)("button",{onClick:()=>aO("csv"),className:"px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground bg-muted rounded transition-colors",title:ah.size>0?B("database.copyCsvSelected"):B("database.copyCsvAll"),children:ah.size>0?B("database.copyCSV"):B("database.CSV")}),(0,e.jsx)("button",{onClick:()=>aO("json"),className:"px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground bg-muted rounded transition-colors",title:ah.size>0?B("database.copyJsonSelected"):B("database.copyJsonAll"),children:ah.size>0?B("database.copyJSON"):B("database.JSON")})]})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:N||"sql"===R?"structure"===R?(0,e.jsx)(s,{columns:T,primaryKeys:V,foreignKeys:X,indexes:Z}):"data"===R?(0,e.jsx)(u,{result:_,loading:ad,columns:T,page:ab,totalPages:aR,totalRows:af,onPageChange:aS,filters:at,sort:av,onFilterChange:aT,onSortChange:aV,selectedRows:ah,onSelectedRowsChange:a=>{ai(a),ak(!1)},editingRowIdx:al,editValues:an,onStartEdit:a=>{if(!_)return;let b=_.rows[a],c={};for(let a of T)c[a.name]=null==b[a.name]?"":p(b[a.name]);ao(c),am(a)},onEditChange:(a,b)=>ao(c=>({...c,[a]:b})),onSaveEdit:aL,onCancelEdit:()=>am(null),isAddingRow:ap,newRowValues:ar,onStartAdd:()=>{aq(!0),as({})},onNewRowChange:(a,b)=>as(c=>({...c,[a]:b})),onSaveNewRow:aM,onCancelAdd:()=>{aq(!1),as({})},onCellCopy:a=>{navigator.clipboard.writeText(a),C(B("common.copied"))}}):(0,e.jsx)(v,{sqlInput:ax,onSqlChange:ay,onExecute:aK,onKeyDown:aP,result:az,error:aB,loading:aD,sqlRef:aF,onCellCopy:a=>{navigator.clipboard.writeText(a),C(B("common.copied"))}}):(0,e.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:B("database.selectTable")})})]})]})]}),!g&&(0,e.jsxs)("div",{className:"border-t border-border px-4 py-1.5 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${"connected"===D?"bg-green-500":"error"===D?"bg-red-500":"bg-yellow-500 animate-pulse"}`}),(0,e.jsx)("span",{children:{connecting:B("common.connecting"),connected:B("common.connected"),error:B("common.connectionFailed")}[D]}),"connected"===D&&N&&(0,e.jsx)("span",{className:"text-muted-foreground/70",children:N}),(0,e.jsx)("span",{className:"flex-1"}),z&&(0,e.jsx)("span",{className:"text-[11px] flex-shrink-0",children:n(z)})]})]})})}function s({columns:a,primaryKeys:b,foreignKeys:c,indexes:d}){let{t:f}=(0,k.Bd)();return 0===a.length?(0,e.jsx)("div",{className:"p-4 text-sm text-muted-foreground",children:f("database.selectTableToView")}):(0,e.jsxs)("div",{className:"p-2 space-y-3",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wide px-1 mb-1",children:f("database.columns")}),(0,e.jsxs)("table",{className:"w-full text-xs",children:[(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{className:"text-left text-muted-foreground border-b border-border",children:[(0,e.jsx)("th",{className:"px-1.5 py-1 font-medium",children:f("database.colName")}),(0,e.jsx)("th",{className:"px-1.5 py-1 font-medium",children:f("database.colType")}),(0,e.jsx)("th",{className:"px-1.5 py-1 font-medium",children:f("database.colNullable")}),(0,e.jsx)("th",{className:"px-1.5 py-1 font-medium",children:f("database.colDefault")})]})}),(0,e.jsx)("tbody",{children:a.map(a=>(0,e.jsxs)("tr",{className:"border-b border-border/50 hover:bg-accent/50",children:[(0,e.jsxs)("td",{className:"px-1.5 py-1 font-mono",children:[a.isPrimaryKey&&(0,e.jsx)("span",{className:"text-amber-500 mr-1",title:f("database.primaryKey"),children:"\uD83D\uDD11"}),a.name]}),(0,e.jsxs)("td",{className:"px-1.5 py-1 text-muted-foreground font-mono",children:[a.type,a.maxLength?`(${a.maxLength})`:""]}),(0,e.jsx)("td",{className:"px-1.5 py-1 text-muted-foreground",children:a.nullable?"YES":"NO"}),(0,e.jsx)("td",{className:"px-1.5 py-1 text-muted-foreground font-mono truncate max-w-[120px]",children:a.default||""})]},a.name))})]})]}),c.length>0&&(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wide px-1 mb-1",children:f("database.foreignKeys")}),(0,e.jsx)("div",{className:"space-y-0.5",children:c.map((a,b)=>(0,e.jsxs)("div",{className:"text-xs font-mono px-1.5 text-muted-foreground",children:[a.column," → ",a.refSchema,".",a.refTable,".",a.refColumn]},b))})]}),d.length>0&&(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wide px-1 mb-1",children:f("database.indexes")}),(0,e.jsx)("div",{className:"space-y-0.5",children:d.map(a=>(0,e.jsx)("div",{className:"text-xs font-mono px-1.5 text-muted-foreground truncate",title:a.definition,children:a.name},a.name))})]})]})}function t({filter:a,onApply:b,onClear:c,onToggle:d,onClose:h,colName:i,anchorRect:j}){let{t:l}=(0,k.Bd)(),[m,n]=(0,f.useState)(a?.op||"="),[o,p]=(0,f.useState)(a?.value||""),q=(0,f.useRef)(null),r=(0,g.F2)(),s="IS NULL"!==m&&"IS NOT NULL"!==m,u=()=>{(!s||o.trim())&&b({op:m,value:o.trim(),enabled:!0})},v=r?.getBoundingClientRect(),x=v?.left??0,y=v?.top??0,z=v?.width??1e3,A=j.left-x;A+220>z-8&&(A=z-220-8),A<8&&(A=8);let B=j.bottom+2-y;return(0,e.jsx)(g.ZL,{children:(0,e.jsxs)("div",{ref:q,className:"fixed z-[9998] w-[220px] bg-popover border border-border rounded-md shadow-lg p-2 space-y-2",style:{left:A,top:B},onClick:a=>a.stopPropagation(),children:[a&&(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("label",{className:"flex items-center gap-1.5 text-[10px] text-muted-foreground cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:a.enabled,onChange:a=>d(a.target.checked),className:"w-3 h-3 accent-brand"}),l("database.enable")]}),(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground font-mono truncate max-w-[120px]",children:i})]}),(0,e.jsx)("select",{value:m,onChange:a=>n(a.target.value),className:"w-full text-xs bg-background border border-input rounded px-1.5 py-1 focus:outline-none focus:ring-1 focus:ring-ring",children:w.map(a=>(0,e.jsx)("option",{value:a.value,children:a.label},a.value))}),s&&(0,e.jsx)("input",{type:"text",value:o,onChange:a=>p(a.target.value),onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),u())},placeholder:l("IN"===m?"database.commaValues":"LIKE"===m?"database.likePattern":"database.valuePlaceholder"),className:"w-full text-xs bg-background border border-input rounded px-1.5 py-1 font-mono focus:outline-none focus:ring-1 focus:ring-ring",autoFocus:!0}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("button",{onClick:u,disabled:s&&!o.trim(),className:"flex-1 px-2 py-1 text-[10px] bg-brand text-white rounded hover:bg-brand/90 disabled:opacity-40 transition-colors",children:l("database.apply")}),a&&(0,e.jsx)("button",{onClick:c,className:"flex-1 px-2 py-1 text-[10px] text-muted-foreground bg-muted rounded hover:text-foreground transition-colors",children:l("database.clearFilter")})]})]})})}function u({result:a,loading:b,columns:c,page:d,totalPages:g,totalRows:h,onPageChange:i,filters:j,sort:l,onFilterChange:m,onSortChange:n,selectedRows:o,onSelectedRowsChange:r,editingRowIdx:s,editValues:v,onStartEdit:w,onEditChange:x,onSaveEdit:y,onCancelEdit:z,isAddingRow:A,newRowValues:B,onStartAdd:C,onNewRowChange:D,onSaveNewRow:E,onCancelAdd:F,onCellCopy:G}){let{t:H}=(0,k.Bd)(),[I,J]=(0,f.useState)(null),[K,L]=(0,f.useState)({left:0,bottom:0});if(!a&&!b)return(0,e.jsx)("div",{className:"p-4 text-sm text-muted-foreground",children:H("database.selectTableForData")});let M=a?.fields||[],N=a?.rows||[],O={};for(let a of c)O[a.name]=a.type+(a.maxLength?`(${a.maxLength})`:"");let P=N.length>0&&o.size===N.length,Q=o.size>0&&!P;return(0,e.jsxs)("div",{className:"flex flex-col h-full",children:[(0,e.jsxs)("div",{className:"flex-1 overflow-auto relative",children:[b&&(0,e.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center z-10",children:(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"})}),(0,e.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,e.jsx)("thead",{className:"sticky top-0 bg-card z-[2]",children:(0,e.jsxs)("tr",{children:[(0,e.jsx)("th",{className:"px-1 py-1 border-b border-border w-8 text-center",children:(0,e.jsx)("input",{type:"checkbox",checked:P,ref:a=>{a&&(a.indeterminate=Q)},onChange:()=>{P?r(new Set):r(new Set(N.map((a,b)=>b)))},className:"w-3 h-3 accent-brand cursor-pointer"})}),M.map(a=>{let b=l?.column===a.name?l.dir:null,c=j[a.name],d=c?.enabled;return(0,e.jsxs)("th",{className:"px-1.5 py-1 text-left text-muted-foreground font-medium border-b border-border whitespace-nowrap font-mono relative",children:[(0,e.jsxs)("span",{className:"cursor-pointer select-none hover:text-foreground transition-colors",onClick:()=>{var b;return b=a.name,void(l?.column===b?"ASC"===l.dir?n({column:b,dir:"DESC"}):n(null):n({column:b,dir:"ASC"}))},children:[a.name,O[a.name]&&(0,e.jsx)("span",{className:"ml-1 text-[9px] text-muted-foreground/60 font-normal",children:O[a.name]}),"ASC"===b&&(0,e.jsx)("span",{className:"ml-0.5 text-brand",children:"↑"}),"DESC"===b&&(0,e.jsx)("span",{className:"ml-0.5 text-brand",children:"↓"})]}),(0,e.jsx)("button",{onClick:b=>{if(b.stopPropagation(),I===a.name)return void J(null);let c=b.currentTarget.closest("th").getBoundingClientRect();L({left:c.left,bottom:c.bottom}),J(a.name)},className:`ml-1 inline-flex items-center transition-colors ${d?"text-brand":"text-muted-foreground/40 hover:text-muted-foreground"}`,children:(0,e.jsx)("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 16 16",fill:"currentColor",children:(0,e.jsx)("path",{d:"M1 2h14l-5.5 6.5V14l-3-2v-3.5z"})})}),I===a.name&&(0,e.jsx)(t,{filter:c||null,onApply:b=>{m(a.name,b),J(null)},onClear:()=>{m(a.name,null),J(null)},onToggle:b=>{c&&m(a.name,{...c,enabled:b})},onClose:()=>J(null),colName:a.name,anchorRect:K})]},a.name)})]})}),(0,e.jsxs)("tbody",{children:[A&&(0,e.jsxs)("tr",{className:"bg-emerald-500/5",children:[(0,e.jsx)("td",{className:"px-1 py-0.5 border-b border-border text-center",children:(0,e.jsxs)("div",{className:"flex gap-0.5 justify-center",children:[(0,e.jsx)("button",{onClick:E,className:"text-[10px] text-emerald-500 hover:text-emerald-400",title:H("common.save"),children:"✓"}),(0,e.jsx)("button",{onClick:F,className:"text-[10px] text-muted-foreground hover:text-foreground",title:H("common.cancel"),children:"✕"})]})}),M.map(a=>(0,e.jsx)("td",{className:"px-0.5 py-0.5 border-b border-border",children:(0,e.jsx)("input",{type:"text",value:B[a.name]??"",onChange:b=>D(a.name,b.target.value),className:"w-full px-1 py-0.5 text-xs bg-background border border-input rounded font-mono min-w-[60px]",placeholder:"NULL"})},a.name))]}),N.map((a,b)=>(0,e.jsxs)("tr",{className:`hover:bg-accent/50 ${o.has(b)?"bg-brand/5":""} ${s===b?"bg-blue-500/5":""}`,children:[(0,e.jsx)("td",{className:"px-1 py-0.5 border-b border-border/50 text-center",children:s===b?(0,e.jsxs)("div",{className:"flex gap-0.5 justify-center",children:[(0,e.jsx)("button",{onClick:y,className:"text-[10px] text-emerald-500 hover:text-emerald-400",title:H("common.save"),children:"✓"}),(0,e.jsx)("button",{onClick:z,className:"text-[10px] text-muted-foreground hover:text-foreground",title:H("common.cancel"),children:"✕"})]}):(0,e.jsx)("input",{type:"checkbox",checked:o.has(b),onChange:()=>{let a;(a=new Set(o)).has(b)?a.delete(b):a.add(b),r(a)},className:"w-3 h-3 accent-brand cursor-pointer"})}),M.map(c=>(0,e.jsx)("td",{className:"px-1.5 py-0.5 border-b border-border/50 font-mono whitespace-nowrap max-w-[200px] truncate",onDoubleClick:()=>{null===s&&w(b)},onContextMenu:b=>{b.preventDefault(),G(p(a[c.name]))},children:s===b?(0,e.jsx)("input",{type:"text",value:v[c.name]??"",onChange:a=>x(c.name,a.target.value),className:"w-full px-1 py-0.5 text-xs bg-background border border-input rounded font-mono min-w-[60px]"}):null===a[c.name]||void 0===a[c.name]?(0,e.jsx)("span",{className:"text-muted-foreground italic",children:"NULL"}):(0,e.jsx)(q,{text:p(a[c.name])})},c.name))]},b))]})]}),0===N.length&&!b&&(0,e.jsx)("div",{className:"p-4 text-xs text-muted-foreground text-center",children:H("common.noData")})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between px-2 py-1 border-t border-border text-[10px] text-muted-foreground bg-card/30 flex-shrink-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:C,disabled:A,className:"px-1.5 py-0.5 text-[10px] text-emerald-500 hover:text-emerald-400 disabled:opacity-30",children:H("database.addRow")}),(0,e.jsx)("span",{children:H("database.totalRows",{count:h})}),a?.duration!==void 0&&(0,e.jsxs)("span",{children:[a.duration,"ms"]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("button",{onClick:()=>i(d-1),disabled:0===d,className:"px-1 py-0.5 hover:text-foreground disabled:opacity-30",children:"◀"}),(0,e.jsxs)("span",{children:[d+1," / ",g]}),(0,e.jsx)("button",{onClick:()=>i(d+1),disabled:d>=g-1,className:"px-1 py-0.5 hover:text-foreground disabled:opacity-30",children:"▶"})]})]})]})}function v({sqlInput:a,onSqlChange:b,onExecute:c,onKeyDown:d,result:f,error:g,loading:h,sqlRef:i,onCellCopy:l}){let{t:m}=(0,k.Bd)();return(0,e.jsxs)("div",{className:"flex flex-col h-full",children:[(0,e.jsxs)("div",{className:"flex-shrink-0 p-2 border-b border-border",children:[(0,e.jsx)("textarea",{ref:i,value:a,onChange:a=>b(a.target.value),onKeyDown:d,placeholder:m("database.sqlPlaceholder",{modKey:(0,j.Mu)()}),className:"w-full h-20 px-2 py-1.5 text-xs font-mono bg-background border border-input rounded resize-y focus:outline-none focus:ring-1 focus:ring-ring",spellCheck:!1}),(0,e.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,e.jsx)("button",{onClick:c,disabled:h||!a.trim(),className:"px-2 py-1 text-xs bg-brand text-white rounded hover:bg-brand/90 disabled:opacity-50 transition-colors",children:m(h?"database.executing":"database.execute")}),f?.duration!==void 0&&(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[f.command&&!f.fields?m("database.rowsAffected",{command:f.command,count:f.rowCount,duration:f.duration}):m("database.queryRows",{count:f.rows?.length??0,duration:f.duration}),f.truncated&&` ${m("database.resultTruncated")}`]})]})]}),g&&(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-destructive bg-destructive/5 border-b border-border break-all",children:g}),f?.fields&&f.rows&&(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:(0,e.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,e.jsx)("thead",{className:"sticky top-0 bg-card z-[1]",children:(0,e.jsx)("tr",{children:f.fields.map(a=>(0,e.jsx)("th",{className:"px-1.5 py-1 text-left text-muted-foreground font-medium border-b border-border whitespace-nowrap font-mono",children:a.name},a.name))})}),(0,e.jsx)("tbody",{children:f.rows.map((a,b)=>(0,e.jsx)("tr",{className:"hover:bg-accent/50",children:f.fields.map(b=>(0,e.jsx)("td",{className:"px-1.5 py-0.5 border-b border-border/50 font-mono whitespace-nowrap max-w-[200px] truncate",onContextMenu:c=>{c.preventDefault(),l(p(a[b.name]))},children:null===a[b.name]||void 0===a[b.name]?(0,e.jsx)("span",{className:"text-muted-foreground italic",children:"NULL"}):(0,e.jsx)(q,{text:p(a[b.name])})},b.name))},b))})]})})]})}d()}catch(a){d(a)}})},57014:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{m:()=>t});var e=c(48249),f=c(67484),g=c(44384),h=c(7833),i=c(35208),j=c(73887),k=c(60591),l=c(18921),m=c(72529),n=c(85984),o=c(65543),p=c(25667),q=c(53036),r=c(9804),s=a([p,i,j]);function t({cwd:a,selected:b,diff:c,showMarkdownPreview:d,setShowMarkdownPreview:s,changedFiles:u,fileGitStatusMap:v,onContentSearch:w,locateInTree:x,jsonPreview:y,setJsonPreview:z,jsonPreviewSearch:A,jsonPreviewPreRef:B}){let{t:C}=(0,g.Bd)(),[D,E]=(0,f.useState)("file"),[F,G]=(0,f.useState)("compact"),H=b.file.path,I=(0,r.u)(H),{state:J}=(0,n.V)(a,H),K=(0,f.useMemo)(()=>{if("ready"===J.state)return J.data.functions.filter(o._).map(a=>({name:a.name,startLine:a.startLine,endLine:a.endLine,params:a.params}))},[J]);return(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[I||"map"!==D?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"px-4 py-2 bg-secondary border-b border-border flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs font-mono text-muted-foreground",children:H}),(0,e.jsx)(m.m,{content:C("common.copyAbsPath"),children:(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),navigator.clipboard.writeText(`${a}/${H}`),(0,h.oR)(C("common.copiedPath"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0",children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})}),(0,e.jsx)(m.m,{content:C("fileBrowser.locateInTree"),children:(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),x(H)},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0",children:(0,e.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("circle",{cx:"12",cy:"12",r:"3",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeWidth:2,d:"M12 2v4m0 12v4M2 12h4m12 0h4"})]})})}),(0,e.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded ${"staged"===b.type?"bg-green-9/15 text-green-11 dark:bg-green-9/25":"bg-amber-9/15 text-amber-11 dark:bg-amber-9/25"}`,children:"staged"===b.type?C("fileBrowser.staged"):C("fileBrowser.unstaged")}),(0,e.jsx)("div",{className:"flex-1"}),!I&&"file"===D&&(0,e.jsx)("div",{className:"flex items-center gap-0.5 rounded border border-border overflow-hidden",children:["compact","full"].map(a=>(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),G(a)},className:`px-2 py-0.5 text-xs transition-colors ${F===a?"bg-brand text-white":"text-muted-foreground hover:bg-accent"}`,children:C("compact"===a?"diffViewer.compact":"diffViewer.full")},a))}),!I&&(0,e.jsx)("div",{className:"flex items-center gap-0.5 rounded border border-border overflow-hidden",children:["file","map"].map(a=>(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),E(a)},className:`px-2 py-0.5 text-xs transition-colors ${D===a?"bg-brand text-white":"text-muted-foreground hover:bg-accent"}`,children:C("file"===a?"common.file":"common.codeMap")},a))})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:I?(0,e.jsx)(q.I,{cwd:a,path:H,className:"p-4 flex items-center justify-center",imgClassName:"max-w-full max-h-[60vh] object-contain",alt:H}):(0,e.jsx)(i.xZ,{oldContent:c.oldContent,newContent:c.newContent,filePath:c.filePath,isNew:c.isNew,isDeleted:c.isDeleted,cwd:a,enableComments:!0,compact:"compact"===F,symbols:K,onPreview:!c.isDeleted&&(0,k.e$)(H)?()=>s(!0):!c.isDeleted&&H.endsWith(".json")?()=>z({content:c.newContent,filePath:c.filePath}):void 0,previewLabel:H.endsWith(".json")?C("common.readable"):C("common.preview"),onContentSearch:w})})]}):(0,e.jsx)(p.r,{cwd:a,filePath:c.filePath,oldContent:c.oldContent,newContent:c.newContent,isNew:c.isNew,isDeleted:c.isDeleted,changedFiles:u,fileGitStatusMap:v,enableComments:!0,onContentSearch:w,headerExtraLeft:({focalFile:b})=>{if(!b)return null;let c=v.get(b);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(m.m,{content:C("common.copyAbsPath"),children:(0,e.jsx)("button",{onClick:c=>{c.stopPropagation(),navigator.clipboard.writeText(`${a}/${b}`),(0,h.oR)(C("common.copiedPath"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0",children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})}),(0,e.jsx)(m.m,{content:C("fileBrowser.locateInTree"),children:(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),x(b)},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0",children:(0,e.jsxs)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("circle",{cx:"12",cy:"12",r:"3",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeWidth:2,d:"M12 2v4m0 12v4M2 12h4m12 0h4"})]})})}),c&&(0,e.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded flex-shrink-0 ${"staged"===c?"bg-green-9/15 text-green-11 dark:bg-green-9/25":"bg-amber-9/15 text-amber-11 dark:bg-amber-9/25"}`,children:"staged"===c?C("fileBrowser.staged"):C("fileBrowser.unstaged")})]})},headerExtraRight:()=>(0,e.jsx)("div",{className:"flex items-center gap-0.5 rounded border border-border overflow-hidden",children:["file","map"].map(a=>(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),E(a)},className:`px-2 py-0.5 text-[11px] transition-colors ${D===a?"bg-brand text-white":"text-muted-foreground hover:bg-accent"}`,children:C("file"===a?"common.file":"common.codeMap")},a))})}),d&&(0,e.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>s(!1),children:(0,e.jsx)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-[90%] h-full flex flex-col",onClick:a=>a.stopPropagation(),children:(0,e.jsx)(j.M,{content:c.newContent,filePath:c.filePath,cwd:a,onClose:()=>s(!1)})})}),y&&(0,e.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>z(null),children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-[90%] h-[90%] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border flex-shrink-0",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground font-mono truncate",children:y.filePath}),(0,e.jsx)("button",{onClick:()=>z(null),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)(l._,{search:A}),(0,e.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4 bg-[#0d1117]",children:(0,e.jsx)("pre",{ref:B,className:"whitespace-pre-wrap break-words font-mono",style:{fontSize:"0.8125rem",lineHeight:"1.5"},children:(0,k.xb)(y.content)})})]})})]})}[p,i,j]=s.then?(await s)():s,d()}catch(a){d(a)}})},57031:(a,b,c)=>{"use strict";c.d(b,{F:()=>g});var d=c(79606),e=c(23734),f=c(33281);let g=(a,b)=>{f.t4.runFork(d.flatMap(e.d,c=>c.publish(a,b)))}},57632:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{z:()=>q});var e=c(48249),f=c(67484),g=c(44384),h=c(44256),i=c(80600),j=c(44218),k=c(19794),l=c(46674),m=c(35208),n=a([m]);function o(a,b){if(b&&a.startsWith(b)){let c=a.slice(b.length);return c.startsWith("/")?c.slice(1):c}return a}function p({node:a,selectedUid:b,onSelect:c,depth:d=0}){let[g,h]=(0,f.useState)(!0);if(a.isFile&&a.change){let f=b===a.change.uid;return(0,e.jsxs)("button",{onClick:()=>c(a.change),className:`w-full flex items-center gap-1.5 px-2 py-1 text-xs text-left rounded transition-colors ${f?"bg-brand/15 text-brand":"text-foreground hover:bg-accent"}`,style:{paddingLeft:`${12*d+8}px`},"data-tooltip":a.fullPath,children:[(0,e.jsx)(i.A,{className:"w-3.5 h-3.5 flex-shrink-0 opacity-60"}),(0,e.jsx)("span",{className:"truncate",children:a.name}),(0,e.jsx)("span",{className:`ml-auto text-[10px] flex-shrink-0 ${"write"===a.change.type?"text-green-500":"text-yellow-500"}`,children:"write"===a.change.type?"new":"edit"})]})}return(0,e.jsxs)("div",{children:[(0,e.jsxs)("button",{onClick:()=>h(!g),className:"w-full flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors",style:{paddingLeft:`${12*d+8}px`},children:[g?(0,e.jsx)(j.A,{className:"w-3 h-3"}):(0,e.jsx)(k.A,{className:"w-3 h-3"}),(0,e.jsx)("span",{className:"truncate",children:a.name})]}),g&&a.children.map((a,f)=>(0,e.jsx)(p,{node:a,selectedUid:b,onSelect:c,depth:d+1},a.isFile&&a.change?a.change.uid:`${a.fullPath}-${f}`))]})}function q({toolCalls:a,cwd:b,onClose:c}){let{t:d}=(0,g.Bd)(),i=(0,f.useMemo)(()=>(function(a,b){let c=[],d=0;for(let e of a)if("Edit"===e.name){let a=e.input;a.file_path&&"string"==typeof a.old_string&&"string"==typeof a.new_string&&c.push({filePath:o(a.file_path,b),uid:`change-${d++}`,type:"edit",old_string:a.old_string,new_string:a.new_string})}else if("Write"===e.name){let a=e.input;a.file_path&&"string"==typeof a.content&&c.push({filePath:o(a.file_path,b),uid:`change-${d++}`,type:"write",old_string:"",new_string:a.content})}return c})(a,b),[a,b]),j=(0,f.useMemo)(()=>(function a(b){return b.map(b=>{if(!b.isFile&&1===b.children.length&&!b.children[0].isFile){let c=b.children[0];return{...c,name:b.name+"/"+c.name,children:a(c.children)}}return{...b,children:a(b.children)}})})(function(a){let b=[];for(let c of a){let a=c.filePath.split("/").filter(Boolean),d=b;for(let b=0;b<a.length;b++){let e=a[b],f=b===a.length-1,g=a.slice(0,b+1).join("/");if(f){let a={name:e,fullPath:g,isFile:!0,children:[],change:c};d.push(a)}else{let a=d.find(a=>a.name===e&&!a.isFile);a||(a={name:e,fullPath:g,isFile:!1,children:[]},d.push(a)),d=a.children}}}return b}(i)),[i]),[k,n]=(0,f.useState)(i[0]||null),[r,s]=(0,f.useState)("unified"),t=(0,f.useRef)(null);if(0===i.length)return null;let u=(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:c,children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-[90%] h-[90vh] flex flex-col transition-all",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,e.jsx)("div",{className:"flex items-center gap-2",children:(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground",children:d("diffViewer.fileChanges",{count:i.length})})}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 bg-accent rounded p-0.5",children:[(0,e.jsx)("button",{onClick:()=>s("unified"),className:`px-2 py-1 text-xs rounded transition-colors ${"unified"===r?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Unified"}),(0,e.jsx)("button",{onClick:()=>s("split"),className:`px-2 py-1 text-xs rounded transition-colors ${"split"===r?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Split"})]}),(0,e.jsx)("button",{onClick:c,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)(l.A,{className:"w-5 h-5"})})]})]}),(0,e.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,e.jsx)("div",{ref:t,className:"w-56 flex-shrink-0 border-r border-border overflow-y-auto py-2",children:j.map((a,b)=>(0,e.jsx)(p,{node:a,selectedUid:k?.uid||"",onSelect:n},a.isFile&&a.change?a.change.uid:`${a.fullPath}-${b}`))}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:k?"unified"===r?(0,e.jsx)(m.xU,{oldContent:k.old_string,newContent:k.new_string,filePath:k.filePath}):(0,e.jsx)(m.xZ,{oldContent:k.old_string,newContent:k.new_string,filePath:k.filePath,isNew:"write"===k.type}):(0,e.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:d("diffViewer.selectFileToView")})})]})]})});return(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(h.ZL,{children:u})})}m=(n.then?(await n)():n)[0],d()}catch(a){d(a)}})},58554:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{r:()=>y});var e=c(48249),f=c(67484),g=c(33281),h=c(41224),i=c(57031),j=c(88214),k=c(63041),l=c(62473),m=c(86686),n=c(75513),o=c(38087),p=c(97951),q=c(99843),r=c(62336),s=c(67115),t=c(95401),u=c(90298),v=c(84844),w=c(44384),x=a([n,t,u,q,r,v,m]);function y({tabId:a,initialCwd:b,initialSessionId:c,engine:d,ollamaModel:x,onOllamaModelChange:z,deepseekModel:A,onDeepseekModelChange:B,hideHeader:C,hideSidebar:D,isActive:E=!0,onLoadingChange:F,onSessionIdChange:G,onTitleChange:H,onShowGitStatus:I,onOpenNote:J,onCreateScheduledTask:K,onOpenSession:L,onContentSearch:M,onOpenSessionBrowser:N,onOpenSettings:O}){let{t:P}=(0,w.Bd)();(0,n.nH)();let[Q,R]=(0,f.useState)([]),[S,T]=(0,f.useState)(null),[U,V]=(0,f.useState)(!1),[W,X]=(0,f.useState)(!1),[Y,Z]=(0,f.useState)(!1),[$,_]=(0,f.useState)(!1),[aa,ab]=(0,f.useState)(null),ac=(0,f.useRef)(null);(0,f.useRef)(null);let ad=(0,f.useCallback)(async a=>{if(!b)return;let c=await g.t4.runPromiseExit((0,h.n_)({cwd:b,sessionId:a}));"Success"===c._tag&&c.value&&"string"==typeof c.value.title?H?.(c.value.title):"Failure"===c._tag&&console.error("Failed to fetch session title:",c.cause)},[b,H]),{isLoading:ae,tokenUsage:af,rateLimitInfo:ag,apiRetryInfo:ah,handleSend:ai,handleStop:aj}=(0,p.e)(Q,R,{sessionId:S,cwd:b,engine:d,ollamaModel:x,deepseekModel:A,onSessionId:T,onFetchTitle:ad}),ak=(0,f.useCallback)(async(a,c)=>{let d=a.split("\n")[0];if(d.startsWith("!")&&d.length>1){let e=d.slice(1).trim();if(!e)return void ai(a,c);let f=a.split("\n").slice(1).join("\n").trim(),i=await g.t4.runPromiseExit((0,h.JC)({command:e,cwd:b}));if("Success"===i._tag){let a=i.value,b=[a.stdout,a.stderr].filter(Boolean).join("\n")||"(no output)",d=a.exitCode?` (exit code: ${a.exitCode})`:"",g=P("chat.executedCommand",{command:e,exitInfo:d,output:b});f&&(g+=`
|
|
@@ -29,14 +29,14 @@ ${f}`),ai(g,c)}else ai(P("chat.executedCommandFailed",{command:e,error:i.cause})
|
|
|
29
29
|
${a.skillPath}`;break}let d=`${a.name} `;if(c.startsWith(d)){let e=c.slice(d.length).trimStart();b=`${t("chat.skillExpansionPrompt")}
|
|
30
30
|
${a.skillPath}
|
|
31
31
|
|
|
32
|
-
${e}`;break}}a(b,w.length>0?w:void 0),v(""),x([]),I.current&&(I.current.style.height="auto")}},[u,w,b,a,A,t]),Q=(0,f.useCallback)(a=>{v(a.name+" "),I.current?.focus()},[]),R=(0,f.useCallback)(a=>{if(!a.nativeEvent.isComposing){if(N&&M.length>0){if("ArrowDown"===a.key){a.preventDefault(),F(a=>(a+1)%M.length);return}if("ArrowUp"===a.key){a.preventDefault(),F(a=>(a-1+M.length)%M.length);return}if("Enter"===a.key){a.preventDefault(),Q(M[E]);return}if("Escape"===a.key){a.preventDefault(),H(!0);return}if("Tab"===a.key){a.preventDefault(),Q(M[E]);return}}"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),P())}},[N,M,E,Q,P]),S=(0,f.useCallback)(a=>{let b=a.clipboardData?.items;if(!b)return;let c=["image/png","image/jpeg","image/webp","image/gif"];for(let d of Array.from(b)){let b=c.find(a=>d.type===a);if(b){a.preventDefault();let c=d.getAsFile();if(!c)continue;if(c.size>5242880){alert(t("chat.imageSizeLimit",{size:(c.size/1024/1024).toFixed(2)}));continue}let e=new FileReader;e.onload=a=>{let c=a.target?.result;if(!c)return;let d=c.replace(/^data:image\/\w+;base64,/,""),e={id:`img-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,data:d,preview:c,media_type:b};x(a=>[...a,e])},e.readAsDataURL(c)}}},[t]),T=(0,f.useCallback)(a=>{x(b=>b.filter(b=>b.id!==a))},[]);return(0,e.jsxs)("div",{className:"border-t border-border bg-card relative",children:[(0,e.jsx)(i.k,{images:w,onRemove:T,disabled:b}),N&&M.length>0&&(0,e.jsx)("div",{ref:J,className:"absolute bottom-full left-0 right-0 mx-4 mb-2 max-h-64 overflow-y-auto bg-card border border-border rounded-lg shadow-lg",children:M.map((a,b)=>{let c=b>0?M[b-1]:null,d="skill"===a.source&&(!c||"skill"!==c.source),f="skill"!==a.source&&0===b;return(0,e.jsxs)("div",{children:[f&&(0,e.jsx)("div",{className:"px-4 py-1 text-[10px] uppercase tracking-wider text-muted-foreground bg-muted/40",children:"Commands"}),d&&(0,e.jsx)("div",{className:"px-4 py-1 text-[10px] uppercase tracking-wider text-muted-foreground bg-muted/40",children:"Skills"}),(0,e.jsxs)("div",{onClick:()=>Q(a),className:`px-4 py-2 cursor-pointer ${b===E?"bg-brand/10":"hover:bg-accent"}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)("span",{className:"font-mono text-sm font-medium text-foreground",children:a.name}),(0,e.jsx)("span",{className:"flex-1 text-sm text-muted-foreground truncate",children:a.description}),(0,e.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded ${(a=>{switch(a){case"builtin":return"bg-brand/15 text-brand dark:bg-brand/25 dark:text-teal-11";case"global":return"bg-green-9/15 text-green-11 dark:bg-green-9/25 dark:text-green-11";case"project":return"bg-amber-9/15 text-amber-11 dark:bg-amber-9/25 dark:text-amber-11";case"skill":return"bg-purple-9/15 text-purple-11 dark:bg-purple-9/25 dark:text-purple-11"}})(a.source)}`,children:(a=>{switch(a){case"builtin":return t("common.builtin");case"global":return t("common.global");case"project":return t("common.project");case"skill":return"Skill"}})(a.source)})]}),"skill"===a.source&&a.argumentHint&&(0,e.jsx)("div",{className:"font-mono text-xs text-muted-foreground mt-0.5 pl-0 truncate",children:a.argumentHint})]})]},a.name)})}),(0,e.jsxs)("div",{className:"flex gap-2 items-end p-4",children:[(0,e.jsx)("button",{onClick:async()=>{if(!c)return;let a=await l.t4.runPromiseExit((0,m.Iz)(c,["."]));"Success"===a._tag?((0,g.oR)(t("toast.stagedAllFiles"),"success"),window.dispatchEvent(new CustomEvent("git-status-changed"))):(console.error("Error staging files:",a.cause),(0,g.oR)(t("toast.stageFailed"),"error"))},className:"p-2 text-green-11 hover:text-green-10 hover:bg-green-9/10 active:bg-green-9/20 active:scale-95 rounded-lg transition-all",title:t("chat.stageAll"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}),o&&(0,e.jsx)("button",{onClick:o,className:"p-2 text-brand hover:text-teal-10 hover:bg-brand/10 active:bg-brand/20 active:scale-95 rounded-lg transition-all",title:t("chat.viewGitChanges"),children:(0,e.jsxs)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"6",cy:"6",r:"2",strokeWidth:2}),(0,e.jsx)("circle",{cx:"18",cy:"6",r:"2",strokeWidth:2}),(0,e.jsx)("circle",{cx:"6",cy:"18",r:"2",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 8v10M18 8v4c0 2-2 4-6 4"})]})}),p&&(0,e.jsx)("button",{onClick:p,className:"p-2 text-amber-11 hover:text-amber-10 hover:bg-amber-9/10 active:bg-amber-9/20 active:scale-95 rounded-lg transition-all",title:t("chat.viewAllComments"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})}),q&&(0,e.jsx)("button",{onClick:q,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95 rounded-lg transition-all",title:t("chat.userMessages"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),r&&(0,e.jsx)("button",{onClick:r,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95 rounded-lg transition-all",title:t("chat.projectNotes"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),s&&(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("button",{onClick:()=>D(!C),className:`p-2 rounded-lg transition-all ${C?"text-brand bg-brand/10":"text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95"}`,title:t("chat.scheduledTasks"),children:(0,e.jsxs)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6l4 2"})]})}),C&&(0,e.jsx)(j.E,{onClose:()=>D(!1),onCreate:s})]}),(0,e.jsx)("textarea",{ref:I,value:u,onChange:a=>v(a.target.value),onKeyDown:R,onPaste:S,placeholder:b?t("chat.placeholderDisabled"):t("chat.placeholder"),rows:1,className:"flex-1 resize-none px-4 py-2 border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-ring bg-card text-foreground placeholder-slate-9"})]})]})});d()}catch(a){d(a)}})},62473:(a,b,c)=>{"use strict";c.d(b,{g:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({tokenUsage:a,rateLimitInfo:b}){let{t:c}=(0,f.Bd)(),[h,i]=(0,e.useState)(()=>Date.now()),j=b?.status==="rejected"?"text-red-500":b?.status==="allowed_warning"?"text-yellow-500":"text-muted-foreground",k=b?.status==="rejected"?c("chat.rateLimitRejected","Rate Limited"):b?.status==="allowed_warning"?c("chat.rateLimitWarning","Approaching Limit"):null,l=a=>{if(!a)return"";let b=(a<1e12?1e3*a:a)-h;if(b<=0)return"";let c=Math.ceil(b/6e4);if(c<60)return`${c}m`;let d=Math.floor(c/60),e=c%60;return e>0?`${d}h${e}m`:`${d}h`},m=a=>a?a.replace(/_/g," "):"";return(0,d.jsx)("div",{className:"px-4 py-1.5 border-t border-border bg-secondary",children:(0,d.jsxs)("div",{className:"flex items-center justify-end gap-4 text-xs text-muted-foreground",children:[b&&k&&(0,d.jsxs)("span",{className:`flex items-center gap-1 ${j}`,title:[b.rateLimitType&&`Type: ${m(b.rateLimitType)}`,null!=b.utilization&&`Usage: ${(100*b.utilization).toFixed(0)}%`,b.resetsAt&&`Resets in: ${l(b.resetsAt)}`,b.isUsingOverage&&"Using overage"].filter(Boolean).join(" \xb7 "),children:["rejected"===b.status?(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}):(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,d.jsxs)("span",{children:[(0,d.jsx)("strong",{children:k}),null!=b.utilization&&` ${(100*b.utilization).toFixed(0)}%`,b.resetsAt&&` \xb7 ${l(b.resetsAt)}`]})]}),b&&!k&&b.resetsAt&&(0,d.jsxs)("span",{className:"flex items-center gap-1.5",title:[b.rateLimitType&&m(b.rateLimitType),null!=b.utilization&&`Usage: ${(100*b.utilization).toFixed(0)}%`,`Resets in: ${l(b.resetsAt)}`].filter(Boolean).join(" \xb7 "),children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),null!=b.utilization?(0,d.jsxs)("span",{children:[(100*b.utilization).toFixed(0),"%"]}):(0,d.jsx)("span",{children:l(b.resetsAt)})]}),(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),(0,d.jsxs)("span",{children:[c("chat.context"),": ",(0,d.jsx)("strong",{className:"text-foreground",children:(a.inputTokens+a.cacheReadInputTokens+a.cacheCreationInputTokens).toLocaleString()})]})]}),(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),(0,d.jsxs)("span",{children:[c("chat.output"),": ",(0,d.jsx)("strong",{className:"text-foreground",children:a.outputTokens.toLocaleString()})]})]}),(a.cacheReadInputTokens>0||a.cacheCreationInputTokens>0)&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-brand",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),(0,d.jsxs)("span",{children:["Cache: ",(a.cacheReadInputTokens/(a.inputTokens+a.cacheReadInputTokens+a.cacheCreationInputTokens)*100).toFixed(0),"%"]})]}),a.totalCostUsd>0&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-green-11",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,d.jsxs)("span",{children:["$",a.totalCostUsd.toFixed(4)]})]})]})})}},62751:(a,b,c)=>{"use strict";function d(){}function e(a){return()=>{}}c.d(b,{U:()=>e,k:()=>d})},63041:(a,b,c)=>{"use strict";c.d(b,{e:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({cwd:a,sessionId:b,onOpenProjectSessions:c,onOpenSessionBrowser:h,onOpenSettings:i}){let{t:j}=(0,f.Bd)(),[k,l]=(0,e.useState)(!1);return(0,d.jsx)("div",{className:"border-b border-border px-4 py-3 bg-card",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("img",{src:"/icons/icon-72x72.png",alt:"Cockpit",className:"w-6 h-6"}),(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,d.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:"Cockpit"}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:"One seat. One AI. Everything under control."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[a&&(0,d.jsx)("span",{className:"text-sm text-foreground max-w-md truncate cursor-help",title:`CWD: ${a}`,children:a}),!a&&b&&(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Session: ",b.slice(0,8),"..."]}),a&&(0,d.jsx)("button",{onClick:c,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:j("sessions.projectSessions"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,d.jsx)("button",{onClick:h,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:j("sessions.browseAllSessions"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})})}),b&&(0,d.jsx)("button",{onClick:()=>{let a=`claude -r ${b}`;navigator.clipboard.writeText(a).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)})},className:`p-2 rounded-lg transition-colors ${k?"text-green-500 bg-green-500/10":"text-muted-foreground hover:text-foreground hover:bg-accent"}`,title:k?j("chat.copiedCommandTooltip"):j("chat.copyCommandTooltip",{sessionId:b}),children:k?(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"})})}),(0,d.jsx)("button",{onClick:i,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:j("settings.title"),children:(0,d.jsxs)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})]})]})})}},63913:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(48249),e=c(3560),f=c(56696),g=c(74493),h=a([f]);f=(h.then?(await h)():h)[0],(0,e.Aq)({type:"database",idPrefix:"db",match(a){let b=a.trim().toLowerCase();return b.startsWith("postgresql://")||b.startsWith("postgres://")},parse(a){let b=a.trim(),c=b;try{let a=new URL(b),d=a.pathname.replace(/^\//,"")||"postgres";c=`${d}@${a.hostname}${a.port?":"+a.port:""}`}catch{}return{connectionString:b,displayName:c}},fromHistory:a=>({connectionString:a.connectionString,displayName:a.displayName||a.connectionString}),toHistory:a=>({connectionString:a.connectionString,displayName:a.displayName}),Component:function({item:a,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l}){return(0,d.jsx)(f.M,{id:a.id,connectionString:a.connectionString,displayName:a.displayName,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l})},async onClose(a){await (0,g.ax)("db",a.id)}}),b()}catch(a){b(a)}})},63963:(a,b,c)=>{"use strict";c.d(b,{AS:()=>w,HV:()=>t,If:()=>u,RS:()=>p,TN:()=>q,mO:()=>s,tr:()=>r});let d=null,e="",f=0,g=null,h=!1,i=new Map,j=null,k=null;function l(a){let b;try{b=JSON.parse(a.data)}catch{return}let c=b.type;if("ping"===c)return;if("running"===c){j&&(j(b.commands),j=null);return}let d=b.commandId;if(!d)return;let e=i.get(d);if(e){if("error"===c)e.onError(b.error);else{let{commandId:a,type:d,...f}=b;e.onData(c,f)}("exit"===c||"error"===c)&&i.delete(d)}}function m(a){d?.readyState===WebSocket.OPEN&&d.send(JSON.stringify(a))}function n(a){let b,c=(b="https:"===window.location.protocol?"wss:":"ws:",`${b}//${window.location.host}/ws/terminal?projectCwd=${encodeURIComponent(a)}`);e===c&&d||(w(),h=!1,e=c,function a(){if(h||!e)return;let b=new WebSocket(e);d=b,b.onopen=()=>{for(let a of(f=0,i.keys()))b.send(JSON.stringify({type:"attach",commandId:a}))},b.onmessage=l,b.onclose=()=>{if(d!==b||(d=null,h))return;g&&clearTimeout(g);let c=Math.min(1e3*Math.pow(1.5,f),1e4);f++,g=setTimeout(a,c)},b.onerror=()=>{}}())}function o(){return new Promise((a,b)=>{if(d?.readyState===WebSocket.OPEN)return void a();let c=setInterval(()=>{d?.readyState===WebSocket.OPEN&&(clearInterval(c),clearTimeout(e),a())},50),e=setTimeout(()=>{clearInterval(c),b(Error("WebSocket connection timeout"))},5e3)})}async function p(a){let{cwd:b,command:c,commandId:d,tabId:e,projectCwd:f,env:g,usePty:h,cols:j,rows:k,onData:l,onError:p}=a;n(f);try{await o()}catch{p("WebSocket connection failed");return}i.delete(d),i.set(d,{onData:l,onError:p}),m({type:"exec",commandId:d,command:c,cwd:b,tabId:e,env:g,...h?{usePty:!0}:{},...j?{cols:j,rows:k}:{}})}async function q(a){let{commandId:b,projectCwd:c,onData:d,onError:e}=a;n(c);try{await o()}catch{e("WebSocket connection failed");return}i.set(b,{onData:d,onError:e}),m({type:"attach",commandId:b})}function r(a,b){m({type:"stdin",commandId:a,data:b})}function s(a,b,c){m({type:"resize",commandId:a,cols:b,rows:c})}function t(a){m({type:"interrupt",pid:a})}function u(a){return k||(k=v(a))}async function v(a){try{n(a);try{await o()}catch{return[]}return await new Promise(a=>{j=b=>{a(b)},m({type:"running"}),setTimeout(()=>{j&&(j=null,a([]))},3e3)})}finally{k=null}}function w(){if(h=!0,g&&(clearTimeout(g),g=null),d){let a=d;d=null,a.close()}i.clear(),j&&(j([]),j=null),k=null,e="",f=0}},65395:(a,b,c)=>{"use strict";c.d(b,{useTabState:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call useTabState() from the server but useTabState is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/useTabState.ts","useTabState")},65484:(a,b,c)=>{"use strict";c.d(b,{Cq:()=>n,D0:()=>q,DZ:()=>i,H7:()=>o,It:()=>s,Kl:()=>w,M5:()=>h,Or:()=>k,Q1:()=>u,QW:()=>p,Wr:()=>j,Yn:()=>r,b2:()=>v,em:()=>t,zF:()=>m});var d=c(79606),e=c(71192);let f=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`);return await c.json()},catch:c=>new e.uV({message:`${b?.method??"GET"} ${a} failed`,cause:c})}),g=(a,b)=>f(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),h=()=>f("/api/settings"),i=a=>f("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),j=()=>f("/api/version"),k=()=>f("/api/extension/version"),l=a=>a?`/api/note?cwd=${encodeURIComponent(a)}`:"/api/note",m=a=>f(l(a)),n=(a,b)=>g(l(a),{content:b}),o=()=>f("/api/sessions/projects"),p=a=>f(`/api/sessions/projects/${encodeURIComponent(a)}`),q=a=>f(`/api/project-settings?cwd=${encodeURIComponent(a)}`),r=a=>g("/api/project-settings",a),s=()=>f("/api/pick-folder"),t=a=>g("/api/open-vscode",{cwd:a}),u=a=>g("/api/open-cursor",{cwd:a}),v=a=>f(`/api/git/worktree?cwd=${encodeURIComponent(a)}`),w=a=>g("/api/git/worktree",a)},65543:(a,b,c)=>{"use strict";c.d(b,{_:()=>e});let d=new Set(["function","class","method"]);function e(a){return d.has(a.kind)}},67045:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(48249);function e({error:a,reset:b}){return(0,d.jsx)("html",{children:(0,d.jsx)("body",{children:(0,d.jsxs)("div",{style:{padding:"2rem",fontFamily:"system-ui, sans-serif"},children:[(0,d.jsx)("h2",{children:"Something went wrong"}),(0,d.jsx)("p",{style:{color:"#666"},children:a.message}),(0,d.jsx)("button",{onClick:b,style:{marginTop:"1rem",padding:"0.5rem 1rem",cursor:"pointer",borderRadius:"0.375rem",border:"1px solid #ccc",background:"#fff"},children:"Try again"})]})})})}},67115:(a,b,c)=>{"use strict";c.d(b,{Q:()=>k});var d=c(48249),e=c(67484),f=c(44384),g=c(57031),h=c(88214),i=c(33281),j=c(41224);function k({isOpen:a,onClose:b,cwd:c,onSelectSession:l}){let{t:m}=(0,f.Bd)(),[n,o]=(0,e.useState)([]),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(null),[t,u]=(0,e.useState)(""),v=(0,e.useRef)(null);(0,e.useCallback)(async()=>{if(!c)return;q(!0),s(null);let a=c.replace(/\//g,"-"),b=await i.t4.runPromiseExit((0,j.QW)(a));"Success"===b._tag?o(b.value):s("Failed to load sessions"),q(!1)},[c]);let w=n.filter(a=>{if(!t)return!0;let b=t.toLowerCase();return a.title.toLowerCase().includes(b)||a.firstMessages.some(a=>a.toLowerCase().includes(b))||a.lastMessages.some(a=>a.toLowerCase().includes(b))});return a?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:b}),(0,d.jsxs)("div",{className:"relative w-full max-w-6xl h-[90vh] mx-4 bg-card rounded-lg shadow-xl flex flex-col overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("h2",{className:"text-sm font-medium text-foreground",children:m("sessions.sessionList")}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground truncate",title:c,children:c})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 ml-4",children:[(0,d.jsx)("input",{ref:v,type:"text",placeholder:m("sessions.searchSessions"),value:t,onChange:a=>u(a.target.value),className:"px-2 py-1 text-xs border border-border rounded bg-card text-foreground placeholder-slate-9 focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"}),(0,d.jsx)("button",{onClick:b,className:"p-1 text-slate-9 hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto p-4",children:[p&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsxs)("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,d.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,d.jsx)("span",{children:m("sessions.loadingSessions")})]})}),r&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsx)("div",{className:"text-xs text-red-11",children:r})}),!p&&!r&&0===w.length&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsx)("div",{className:"text-xs text-muted-foreground",children:m(t?"sessions.noMatchingSessions":"sessions.noSessionsYet")})}),!p&&!r&&w.length>0&&(0,d.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:w.map(a=>(0,d.jsxs)("div",{onClick:()=>{let d;return d=(a.path.split("/").pop()||"").replace(".jsonl",""),void(l?(l(d,a.title),b()):(0,g.F)(h.n.OpenProject,{cwd:c,sessionId:d}))},className:"p-3 bg-secondary rounded border border-border hover:border-brand hover:shadow-md cursor-pointer transition-all",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[a.engine&&"claude"!==a.engine&&(0,d.jsx)("span",{className:`shrink-0 px-1 py-0.5 text-[10px] leading-none font-medium rounded ${"claude2"===a.engine?"bg-orange-500/15 text-orange-11":"ollama"===a.engine?"bg-blue-500/15 text-blue-11":"codex"===a.engine?"bg-green-500/15 text-green-11":"kimi"===a.engine?"bg-purple-500/15 text-purple-11":"bg-muted text-muted-foreground"}`,children:a.engine}),(0,d.jsx)("h4",{className:"text-xs font-medium text-foreground truncate",title:a.title,children:a.title})]}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground mb-2",children:new Date(a.modifiedAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}),(0,d.jsxs)("div",{className:"space-y-0.5 text-xs",children:[a.firstMessages.map((a,b)=>(0,d.jsxs)("div",{className:"text-foreground truncate",title:a,children:[(0,d.jsx)("span",{className:"text-slate-9 mr-1",children:"•"}),a]},`first-${b}`)),a.lastMessages.length>0&&(0,d.jsx)("div",{className:"text-slate-9 text-center py-0.5",children:"\xb7\xb7\xb7"}),a.lastMessages.map((a,b)=>(0,d.jsxs)("div",{className:"text-foreground truncate",title:a,children:[(0,d.jsx)("span",{className:"text-slate-9 mr-1",children:"•"}),a]},`last-${b}`))]})]},a.path))})]})]})]}):null}},69424:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{$:()=>q});var e=c(48249),f=c(67484),g=c(44384),h=c(7833),i=c(44256),j=c(15273),k=c(46674),l=c(99941),m=c(44643),n=c(32026),o=c(11732);function p(a){let b=a.input?.questions||[],c=a.input?.answers||{},d={};if(a.result)try{let b=JSON.parse(a.result);b?.answers&&(d=b.answers)}catch{}return{questions:b,answers:{...c,...d}}}function q({toolCalls:a,onClose:b}){let{t:c}=(0,g.Bd)(),[d,r]=(0,f.useState)({}),[s,t]=(0,f.useState)({}),[u,v]=(0,f.useState)({}),[w,x]=(0,f.useState)({}),y=a.reduce((a,b)=>{let{questions:c}=p(b);return a+c.length},0),z=Object.values(w).filter(Boolean).length,A=(0,f.useCallback)((a,b)=>{r(c=>({...c,[a]:b})),t(b=>({...b,[a]:!1}))},[]),B=(0,f.useCallback)(a=>{t(b=>{let c=!b[a];if(c){let b=u[a]||"";b&&r(c=>({...c,[a]:b}))}return{...b,[a]:c}})},[u]),C=(0,f.useCallback)((a,b)=>{v(c=>({...c,[a]:b})),b&&r(c=>({...c,[a]:b}))},[]),D=(0,f.useCallback)(a=>{x(b=>({...b,[a]:!b[a]}))},[]),E=(0,f.useCallback)(()=>{let b=z>0,e=[];a.forEach((a,f)=>{let{questions:g}=p(a);g.forEach((a,g)=>{let h=`${f}-${g}`;if(b&&!w[h])return;let i=d[h];e.push(`Q: ${a.question}`),e.push(`A: ${i||c("askQuestion.notSelected")}`),e.push("")})}),navigator.clipboard.writeText(e.join("\n").trim()),(0,h.oR)(b?c("toast.copiedQA",{count:z}):c("toast.copiedAllQA"))},[a,d,w,z,c]),F=(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:b,children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-6xl h-[90vh] flex flex-col overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground",children:c("askQuestion.title")}),(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[c("askQuestion.nQuestions",{count:y}),z>0&&` \xb7 ${c("askQuestion.checkedN",{count:z})}`]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:E,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:z>0?c("askQuestion.copyChecked",{count:z}):c("askQuestion.copyAll"),children:(0,e.jsx)(j.A,{className:"w-4 h-4"})}),(0,e.jsx)("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)(k.A,{className:"w-5 h-5"})})]})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-6",children:a.map((b,f)=>{let{questions:g}=p(b);return g.map((b,h)=>{let i=`${f}-${h}`,j=d[i],k=s[i]||!1,p=w[i]||!1;return(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-start gap-2",children:[(0,e.jsx)("button",{onClick:()=>D(i),className:"mt-0.5 flex-shrink-0 p-0.5 rounded hover:bg-accent transition-colors",title:c("askQuestion.checkToCopy"),children:p?(0,e.jsx)(l.A,{className:"w-4 h-4 text-brand"}):(0,e.jsx)(m.A,{className:"w-4 h-4 text-muted-foreground"})}),b.header&&(0,e.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-brand/10 text-brand flex-shrink-0 mt-0.5",children:b.header}),(0,e.jsx)("span",{className:"text-sm font-medium text-foreground",children:b.question})]}),(0,e.jsxs)("div",{className:"space-y-1 ml-7",children:[b.options.map((a,b)=>{let c=j===a.label&&!k;return(0,e.jsxs)("button",{onClick:()=>A(i,a.label),className:`flex items-start gap-2 px-2.5 py-1.5 rounded-md transition-colors w-full text-left cursor-pointer hover:bg-accent/50 ${c?"bg-brand/10 hover:bg-brand/15":""}`,children:[(0,e.jsx)("div",{className:"mt-0.5 flex-shrink-0",children:c?(0,e.jsx)(n.A,{className:"w-3.5 h-3.5 text-brand"}):(0,e.jsx)("div",{className:"w-3.5 h-3.5 rounded-full border border-muted-foreground"})}),(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsx)("div",{className:`text-sm ${c?"text-foreground font-medium":"text-foreground"}`,children:a.label}),a.description&&(0,e.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:a.description})]})]},b)}),(0,e.jsxs)("button",{onClick:()=>B(i),className:`flex items-start gap-2 px-2.5 py-1.5 rounded-md transition-colors w-full text-left cursor-pointer hover:bg-accent/50 ${k?"bg-brand/10 hover:bg-brand/15":""}`,children:[(0,e.jsx)("div",{className:"mt-0.5 flex-shrink-0",children:k?(0,e.jsx)(n.A,{className:"w-3.5 h-3.5 text-brand"}):(0,e.jsx)("div",{className:"w-3.5 h-3.5 rounded-full border border-muted-foreground"})}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(o.A,{className:"w-3.5 h-3.5 text-muted-foreground"}),(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:c("askQuestion.custom")})]})]}),k&&(0,e.jsx)("div",{className:"ml-6 mt-1",children:(0,e.jsx)("input",{type:"text",autoFocus:!0,value:u[i]||"",onChange:a=>C(i,a.target.value),placeholder:c("askQuestion.customPlaceholder"),className:"w-full px-3 py-1.5 text-sm bg-background border border-border rounded-md focus:outline-none focus:ring-1 focus:ring-brand text-foreground placeholder:text-muted-foreground"})})]}),(f!==a.length-1||h!==g.length-1)&&(0,e.jsx)("div",{className:"border-b border-border/50 mt-3"})]},i)})})})]})});return(0,e.jsx)(i.ZL,{children:F})}d()}catch(a){d(a)}})},70151:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{g:()=>Q});var e=c(48249),f=c(67484),g=c(74429),h=c(44256),i=c(33281),j=c(87808),k=c(85655),l=c(21538),m=c(35208),n=c(7833),o=c(24724),p=c(20586),q=c(7122),r=c(55287),s=c(60591),t=c(9804),u=c(73887),v=c(94239),w=c(29939),x=c(23860),y=c(90018),z=c(57014),A=c(94308),B=c(53036),C=c(6662),D=c(20291),E=c(58904),F=c(61632),G=c(76855),H=c(4857),I=c(44384),J=c(18921),K=c(28797),L=c(23881),M=c(21672),N=c(21482),O=c(94192),P=a([E,F,p,o,l,y,r,z,m,u,v,N,M]);function Q({onClose:a,cwd:b,initialTab:c="tree",tabSwitchTrigger:d,initialSearchQuery:P,searchQueryTrigger:R}){let{t:S}=(0,I.Bd)(),{activeView:T}=(0,O.R8)(),[U,V]=(0,f.useState)(c),[W,X]=(0,f.useState)("code"),Y=(0,f.useRef)(null),Z=(0,f.useRef)(!1),[$,_]=(0,f.useState)(null),[aa,ab]=(0,f.useState)(null),[ac,ad]=(0,f.useState)(!1),ae=(0,f.useRef)(1),af=(0,f.useRef)(null),[ag,ah]=(0,f.useState)(null),ai=(0,f.useRef)(null),[aj,ak]=(0,f.useState)({isDirty:!1,isSaving:!1}),[al,am]=(0,f.useState)(!1),[an,ao]=(0,f.useState)(!1),[ap,aq]=(0,f.useState)(null),ar=(0,f.useRef)(null),as=(0,J.o)(ar),at=(0,f.useRef)(null),au=(0,J.o)(at),av=(0,G.Sn)(b),aw=(0,G.Xm)(b),ax=(0,G.po)(b),ay=(0,H.Q)(),az=(0,x.F)(),aA=(0,C.W)({cwd:b});(0,G.JL)(b,aA.selectedPath);let aB=(0,D.p)({cwd:b,onSearchComplete:()=>am(!0)}),aC=(0,E.e)({cwd:b,addToRecentFiles:aA.addToRecentFiles}),aD=(0,f.useMemo)(()=>{let a=new Set;if(aC.status){for(let b of aC.status.staged)a.add(b.path);for(let b of aC.status.unstaged)a.add(b.path)}return a},[aC.status]),aE=(0,f.useMemo)(()=>{let a=new Map;if(aC.status){for(let b of aC.status.staged)a.set(b.path,"staged");for(let b of aC.status.unstaged)a.set(b.path,"unstaged")}return a},[aC.status]),aF=(0,F.y)({cwd:b,addToRecentFiles:aA.addToRecentFiles}),aG=(0,f.useRef)(!1),aH=(0,f.useCallback)(a=>{aA.setFileContent(b=>b?.type==="text"?{...b,content:a}:b),aA.showEditor||(aG.current=!0,aA.setShowEditor(!0))},[aA]),aI=(0,f.useCallback)(a=>{aA.setShowEditor(!0)},[aA]),aJ=(0,f.useCallback)(async()=>{if(!aA.fileContent||"text"!==aA.fileContent.type||!aA.fileContent.content)return;let a=await i.t4.runPromiseExit((0,j.OJ)({cwd:b,path:aA.selectedPath,content:aA.fileContent.content}));try{if("Failure"===a._tag||!a.value.ok)throw Error("Failed to save file");let b=a.value.data?.mtime;b&&aA.setFileContent(a=>a?.type==="text"?{...a,mtime:b}:a),(0,n.oR)(S("toast.savedSuccess"),"success")}catch{(0,n.oR)(S("toast.saveFailed"),"error")}},[b,aA]),aK=(0,f.useCallback)(()=>{if(!aA.selectedPath)return;let a=ae.current,b=af.current;a>0&&aA.updateRecentFilePosition(aA.selectedPath,a,b?b.cursorLine+1:a,b?b.cursorCol+1:1)},[aA]),aL=(0,f.useCallback)(async(a,b)=>{let c=a!==aA.selectedPath;if(c&&aA.showEditor){if(aj.isDirty&&(!await (0,n.lJ)(S("fileBrowser.saveBeforeSwitch"),{confirmText:S("fileBrowser.saveAndSwitch"),cancelText:S("common.cancel")})||(await ai.current?.save(),ai.current?.isDirty)))return;aA.setShowEditor(!1)}c&&aK(),aA.handleSelectFile(a,b)},[aA,aK,aj.isDirty,S]),aM=(0,f.useMemo)(()=>{let a=aB.contentSearchResults;if(0===a.length)return{files:[],expandDirs:new Set,matchMap:new Map};let b=new Map,c=[];for(let d of a)b.set(d.path,d),c.push(d.path);let d=(0,t.v3)(c),e=new Set((0,t.tW)(d));return{files:d,expandDirs:e,matchMap:b}},[aB.contentSearchResults]),[aN,aO]=(0,f.useState)(new Set),aP=(0,f.useCallback)(a=>{aO(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),aQ=(0,f.useCallback)(a=>{if(a.isDirectory)return null;let b=aM.matchMap.get(a.path);return b?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:b.matches.length}):null},[aM.matchMap]),aR=al&&aB.contentSearchResults.length>0,aS=!!aA.selectedPath&&null!==(0,K.c)(aA.selectedPath),aT=(0,f.useCallback)(async(a,c)=>{if(!aA.selectedPath||!aS)return;let d=await av.goToDefinition(aA.selectedPath,a,c);if(0===d.length)return;let e=d[0],f=b.endsWith("/")?b:b+"/",g=e.file.startsWith(f)?e.file.slice(f.length):e.file;ay.push({filePath:aA.selectedPath,lineNumber:ae.current}),g===aA.selectedPath?aA.setTargetLineNumber(e.line):aL(g,e.line)},[aA,b,aS,av,ay]),aU=(0,f.useCallback)((a,b,c)=>{aA.selectedPath&&aS&&aw.onTokenMouseEnter(aA.selectedPath,a,b,c)},[aA.selectedPath,aS,aw]),aV=(0,f.useCallback)(a=>{let c=b.endsWith("/")?b:b+"/",d=a.file.startsWith(c)?a.file.slice(c.length):a.file;aA.selectedPath&&ay.push({filePath:aA.selectedPath,lineNumber:ae.current}),d===aA.selectedPath?aA.setTargetLineNumber(a.line):aL(d,a.line)},[aA,b,ay]),aW=(0,f.useMemo)(()=>{if(!aC.status)return null;let a=new Map,b=a=>{switch(a){case"modified":default:return"M";case"added":return"A";case"deleted":return"D";case"renamed":return"R";case"untracked":return"?"}};for(let c of aC.status.staged)a.set(c.path,b(c.status));for(let c of aC.status.unstaged)a.set(c.path,b(c.status));return a},[aC.status]),aX=(0,f.useCallback)(a=>{V(a),aA.setBlameSelectedCommit(null),"history"===a&&aF.selectedBranch&&aF.loadCommits(aF.selectedBranch)},[aA,aF.selectedBranch,aF.loadCommits]);(0,f.useCallback)(()=>{if(!aA.selectedPath)return;let a={filePath:aA.selectedPath,lineNumber:ae.current},b=ay.goBack(a);b&&(b.filePath===aA.selectedPath?aA.setTargetLineNumber(b.lineNumber):aL(b.filePath,b.lineNumber))},[aA,ay]),(0,f.useCallback)(()=>{if(!aA.selectedPath)return;let a={filePath:aA.selectedPath,lineNumber:ae.current},b=ay.goForward(a);b&&(b.filePath===aA.selectedPath?aA.setTargetLineNumber(b.lineNumber):aL(b.filePath,b.lineNumber))},[aA,ay]);let aY=(0,f.useCallback)(async a=>{let c=a.split("/").pop()||a,d=await i.t4.runPromiseExit((0,j.__)({cwd:b,paths:[a],op:"copy"}));"Success"===d._tag?(0,n.oR)(S("toast.copiedName",{name:c}),"success"):(0,n.oR)(S("toast.copyFailed"),"error")},[b,S]),aZ=(0,f.useCallback)(async a=>{let c=await i.t4.runPromiseExit((0,j.dt)());if("Success"!==c._tag||!c.value.path)return void(0,n.oR)(S("toast.noFileToPaste"),"info");let d=c.value.path,e=await i.t4.runPromiseExit((0,j.Nn)({cwd:b,targetDir:a,sourceAbsPath:d}));if("Success"===e._tag)(0,n.oR)(S("toast.pastedFile",{name:e.value.newName}),"success"),aA.loadDirectory(a),aA.loadFileIndex();else{let a="Fail"===e.cause._tag?e.cause.error:null,b=a?.cause,c=b instanceof Error?b.message:S("toast.pasteFailed");(0,n.oR)(c,"error")}},[b,aA,S]);(0,f.useRef)(0),(0,f.useRef)(az),(0,f.useRef)(U);let a$=(0,f.useRef)(aF.selectedBranch);a$.current=aF.selectedBranch;let a_=(0,f.useRef)(aA.selectedPath);a_.current=aA.selectedPath;let a0=(0,f.useRef)(aA.fileContent?.type);a0.current=aA.fileContent?.type;let a1=(0,f.useCallback)(async a=>{try{let{data:c}=a;if(!c)return;let d=c.some(a=>"git"===a.type),e=c.some(a=>"file"===a.type),f=[];if((e||d)&&(f.push(i.t4.runPromise((0,j.mP)(b)).then(a=>{a.error||aA.setFiles(b=>(0,t.HR)(a.files??[],b))}).catch(()=>{})),f.push(i.t4.runPromise((0,j.DZ)(b)).then(a=>{a.paths&&aA.setFileIndex(a.paths)}).catch(()=>{})),f.push(i.t4.runPromise((0,j.r9)(b)).then(a=>{aA.setRecentFiles(a.files??[])}).catch(()=>{}))),d||e){f.push(i.t4.runPromise((0,k.lv)(b)).then(a=>{aC.setStatus(a);let b=(0,p.Do)(a.staged),c=(0,p.Do)(a.unstaged);aC.setStagedTree(b),aC.setUnstagedTree(c)}).catch(()=>{})),aC.refreshDiff(),d&&aF.loadBranches();let a=a$.current;a&&f.push(i.t4.runPromise((0,k.Bj)(b,a,t.B_)).then(a=>{let b=a.commits??[];aF.setCommits(b),aF.setHasMoreCommits(b.length>=t.B_)}).catch(()=>{}))}let g=a_.current,h=a0.current;g&&"text"===h&&f.push(i.t4.runPromise((0,j.K9)(b,g)).then(a=>{let b=a.ok?a.data:null;b&&"string"==typeof b.content&&aA.setFileContent({type:"text",content:b.content,size:b.size,mtime:b.mtimeMs,...b.isSymlink?{isSymlink:!0,symlinkTarget:b.symlinkTarget}:{}})}).catch(()=>{})),await Promise.all(f)}catch(a){console.error("File watch handler error:",a)}},[b]);(0,w.h)({url:`/ws/watch?cwd=${encodeURIComponent(b)}`,onMessage:a1,enabled:az});let a2=(0,f.useCallback)(a=>{let b=a.split("/");if(b.length>1){let a=[];for(let c=1;c<b.length;c++)a.push(b.slice(0,c).join("/"));aA.setExpandedPaths(b=>{let c=new Set(b);for(let b of a)c.add(b);return aA.saveExpandedPaths(c),c})}aA.setSelectedPath(a),aA.setShouldScrollToSelected(!0),V("tree")},[aA]);return(0,e.jsxs)(q.SU,{container:$,children:[(0,e.jsxs)("div",{ref:Y,className:"bg-card w-full h-full flex flex-col relative",children:[(0,e.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,e.jsxs)("div",{className:"w-80 flex-shrink-0 border-r border-border flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex border-b border-border",children:[(0,e.jsx)("button",{onClick:()=>aX("tree"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"tree"===U?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:S("fileBrowser.directoryTree")}),(0,e.jsx)("button",{onClick:()=>aX("search"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"search"===U?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:S("fileBrowser.searchTab")}),(0,e.jsx)("button",{onClick:()=>aX("recent"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"recent"===U?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:S("fileBrowser.recentTab")}),(0,e.jsx)("button",{onClick:()=>aX("status"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"status"===U?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:S("fileBrowser.changesTab")}),(0,e.jsx)("button",{onClick:()=>aX("history"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"history"===U?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:S("fileBrowser.historyTab")})]}),"tree"===U&&(0,e.jsxs)("div",{className:"p-2 border-b border-border flex items-center gap-2",children:[(0,e.jsxs)("div",{className:"flex-1 relative",children:[(0,e.jsx)("input",{ref:aA.searchInputRef,type:"text",value:aA.searchQuery,onChange:a=>aA.setSearchQuery(a.target.value),placeholder:S("fileBrowser.searchFiles"),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded bg-card text-foreground placeholder-slate-9 focus:outline-none focus:ring-2 focus:ring-ring"}),aA.searchQuery&&(0,e.jsx)("button",{onClick:()=>aA.setSearchQuery(""),className:"absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 text-slate-9 hover:text-foreground rounded-sm transition-colors",title:S("fileBrowser.clear"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("button",{onClick:()=>aA.setSearchDirExact(a=>!a),className:`px-1 py-0.5 rounded transition-colors text-xs font-mono font-bold border ${aA.searchExactMatch?"border-brand text-brand bg-brand/10":"border-transparent text-muted-foreground hover:text-foreground hover:bg-accent"}`,title:aA.searchExactMatch?S("fileBrowser.exactMatchOn"):S("fileBrowser.exactMatchOff"),children:"ab"}),(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:()=>aA.loadFiles(),className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:S("fileBrowser.refreshTree"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),(0,e.jsx)("button",{onClick:()=>aA.searchTreeExpandedPaths?aA.setSearchTreeExpandedPaths(new Set):aA.setExpandedPaths(new Set),className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:S("fileBrowser.collapseAll"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})})]})]}),"search"===U&&(0,e.jsxs)("div",{className:"p-2 border-b border-border space-y-2",children:[(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsxs)("div",{className:"flex-1 relative",children:[(0,e.jsx)("input",{ref:aB.contentSearchInputRef,type:"text",value:aB.contentSearchQuery,onChange:a=>aB.setContentSearchQuery(a.target.value),onKeyDown:a=>{"Enter"===a.key&&aB.performContentSearch(aB.contentSearchQuery)},placeholder:S("fileBrowser.searchFileContent"),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded bg-card text-foreground placeholder-slate-9 focus:outline-none focus:ring-2 focus:ring-ring"}),aB.contentSearchQuery&&(0,e.jsx)("button",{onClick:()=>aB.setContentSearchQuery(""),className:"absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 text-slate-9 hover:text-foreground rounded-sm transition-colors",title:S("fileBrowser.clear"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("button",{onClick:()=>aB.performContentSearch(aB.contentSearchQuery),disabled:aB.isSearching||!aB.contentSearchQuery.trim(),className:"px-3 py-1.5 text-sm bg-brand text-white rounded hover:bg-brand/90 disabled:opacity-50 disabled:cursor-not-allowed",children:aB.isSearching?"...":S("common.search")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-2 text-xs",children:[(0,e.jsxs)("label",{className:"flex items-center gap-1 cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:aB.searchOptions.caseSensitive,onChange:a=>aB.setSearchOptions(b=>({...b,caseSensitive:a.target.checked})),className:"w-3 h-3"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:S("fileBrowser.caseSensitive")})]}),(0,e.jsxs)("label",{className:"flex items-center gap-1 cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:aB.searchOptions.wholeWord,onChange:a=>aB.setSearchOptions(b=>({...b,wholeWord:a.target.checked})),className:"w-3 h-3"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:S("fileBrowser.wholeWord")})]}),(0,e.jsxs)("label",{className:"flex items-center gap-1 cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:aB.searchOptions.regex,onChange:a=>aB.setSearchOptions(b=>({...b,regex:a.target.checked})),className:"w-3 h-3"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:S("fileBrowser.regex")})]}),(0,e.jsx)("input",{type:"text",value:aB.searchOptions.fileType,onChange:a=>aB.setSearchOptions(b=>({...b,fileType:a.target.value})),placeholder:S("fileBrowser.fileTypes"),className:"w-24 px-2 py-0.5 text-xs border border-border rounded bg-card text-foreground placeholder-slate-9"})]})]}),"history"===U&&(0,e.jsx)("div",{className:"p-3 border-b border-border",children:aF.compareMode?(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsxs)("div",{className:"flex-1 min-w-0 px-3 py-1.5 text-sm border border-border rounded bg-secondary text-foreground flex items-center gap-2",children:[(0,e.jsx)("svg",{className:"w-4 h-4 text-muted-foreground flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),(0,e.jsx)("span",{className:"truncate",children:aF.branches?.current||"HEAD"}),(0,e.jsx)("span",{className:"text-xs text-green-11 flex-shrink-0",children:"HEAD"})]}),(0,e.jsx)("button",{onClick:()=>aF.toggleCompareMode(!1),className:"flex-shrink-0 px-2.5 py-1.5 text-xs font-medium rounded-lg transition-colors bg-brand text-white",title:S("fileBrowser.compareModeOff"),children:S("fileBrowser.compareMode")})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0 pl-1",children:"vs"}),(0,e.jsx)("div",{className:"flex-1 min-w-0",children:(0,e.jsx)(A.e,{branches:aF.branches,selectedBranch:aF.compareBaseBranch,onSelect:a=>{aF.setCompareBaseBranch(a),aF.loadCompareFiles(a)},isLoading:aF.isLoadingBranches,pinnedBranches:["origin/main",...aF.upstreamBranch&&"origin/main"!==aF.upstreamBranch?[aF.upstreamBranch]:[]]})})]})]}):(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("div",{className:"flex-1 min-w-0",children:(0,e.jsx)(A.e,{branches:aF.branches,selectedBranch:aF.selectedBranch,onSelect:a=>{aF.setSelectedBranch(a)},isLoading:aF.isLoadingBranches,pinnedBranches:["origin/main",...aF.upstreamBranch&&"origin/main"!==aF.upstreamBranch?[aF.upstreamBranch]:[]]})}),(0,e.jsx)("button",{onClick:()=>aF.toggleCompareMode(!0),className:"flex-shrink-0 px-2.5 py-1.5 text-xs font-medium rounded-lg transition-colors text-muted-foreground hover:text-foreground hover:bg-accent border border-border",title:S("fileBrowser.compareModeOn"),children:S("fileBrowser.compareMode")})]})}),(0,e.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col",children:[(0,e.jsxs)("div",{className:`flex-1 flex flex-col min-h-0 ${"tree"===U?"":"hidden"}`,children:[aA.creatingItem&&(0,e.jsxs)("div",{className:"px-2 py-1.5 border-b border-border bg-secondary flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:aA.creatingItem.parentPath?S("fileBrowser.createFileIn",{path:aA.creatingItem.parentPath}):S("fileBrowser.createFile")}),(0,e.jsx)("input",{type:"text",autoFocus:!0,placeholder:S("fileBrowser.fileName"),className:"flex-1 px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring",onCompositionStart:()=>{Z.current=!0},onCompositionEnd:()=>{Z.current=!1},onKeyDown:async a=>{if("Enter"===a.key){if(Z.current)return;let c=a.target.value.trim();if(!c)return;let d=aA.creatingItem.parentPath,e=d?`${d}/${c}`:c,f=await i.t4.runPromiseExit((0,j.OJ)({cwd:b,path:e,content:""}));if("Success"===f._tag&&f.value.ok)(0,n.oR)(S("toast.createdFile",{name:c}),"success"),aA.setCreatingItem(null),aA.loadDirectory(d),aA.loadFileIndex(),d&&aA.setExpandedPaths(a=>new Set([...a,d])),aL(e);else if("Success"===f._tag){let a=f.value.data?.error;(0,n.oR)(a||S("toast.createFailed"),"error")}else(0,n.oR)(S("toast.createFailed"),"error")}else"Escape"===a.key&&aA.setCreatingItem(null)},onBlur:()=>aA.setCreatingItem(null)})]}),aA.isLoadingFiles?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:S("common.loading")}):aA.fileError?(0,e.jsx)("div",{className:"p-4 text-center text-red-11 text-sm",children:aA.fileError}):(0,e.jsx)(o.h,{files:aA.files,selectedPath:aA.selectedPath,expandedPaths:aA.effectiveExpandedPaths,matchedPaths:aA.matchedPaths,gitStatusMap:aW,loadingDirs:aA.loadingDirs,onSelect:a=>{aA.setShouldScrollToSelected(!1),aL(a)},onToggle:aA.handleToggle,cwd:b,shouldScrollToSelected:aA.shouldScrollToSelected,onScrolledToSelected:()=>aA.setShouldScrollToSelected(!1),onCreateFile:a=>aA.setCreatingItem({type:"file",parentPath:a}),onDelete:(a,b,c)=>ab({path:a,isDirectory:b,name:c}),onRefresh:()=>aA.loadFiles(),onCopyFile:aY,onPaste:aZ})]}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"search"===U?"":"hidden"}`,children:aB.isSearching?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):aB.searchError?(0,e.jsx)("div",{className:"p-4 text-center text-red-11 text-sm",children:aB.searchError}):0===aB.contentSearchResults.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:aB.contentSearchQuery?S("fileBrowser.noContentSearchResults"):S("fileBrowser.enterKeywordToSearch")}):(0,e.jsxs)("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[aB.searchStats&&(0,e.jsxs)("div",{className:"px-3 py-1.5 text-xs text-muted-foreground bg-secondary border-b border-border flex-shrink-0",children:[S("fileBrowser.nFilesNMatches",{files:aB.searchStats.totalFiles,matches:aB.searchStats.totalMatches}),aB.searchStats.truncated&&(0,e.jsxs)("span",{className:"text-amber-11 ml-1",children:["(",S("fileBrowser.resultsTruncated"),")"]})]}),(0,e.jsx)(o.h,{files:aM.files,selectedPath:aA.selectedPath,expandedPaths:aN,onSelect:a=>{let b=aM.matchMap.get(a);aL(a,b?.matches[0]?.lineNumber),al||am(!0)},onToggle:aP,cwd:b,renderActions:aQ,className:"flex-1 overflow-y-auto py-1 min-w-max"})]})}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"recent"===U?"":"hidden"}`,children:0===aA.recentFiles.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:S("fileBrowser.noRecentFiles")}):(0,e.jsx)(o.h,{files:aA.recentFilesTree,selectedPath:aA.selectedPath,expandedPaths:aA.recentTreeDirPaths,onSelect:aL,onToggle:t.tE,cwd:b})}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"status"===U?"":"hidden"}`,children:aC.statusLoading?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):aC.statusError?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center p-4",children:(0,e.jsx)("span",{className:"text-red-11 text-sm",children:aC.statusError})}):(0,e.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[(0,e.jsxs)("div",{className:"border-b border-border",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-secondary",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:S("fileBrowser.stagingArea",{count:aC.status?.staged.length||0})}),(0,e.jsx)("button",{onClick:()=>aC.fetchStatus(),className:"p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:S("fileBrowser.refreshChanges"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),(aC.status?.staged.length||0)>0&&(0,e.jsx)("button",{onClick:aC.handleUnstageAll,className:"text-sm text-amber-11 hover:text-amber-10 hover:underline",children:S("fileBrowser.unstageAll")})]}),(0,e.jsx)(p.VO,{files:aC.stagedTree,selectedPath:aC.statusSelectedFile?.type==="staged"?aC.statusSelectedFile.file.path:null,expandedPaths:aC.stagedExpandedPaths,onSelect:a=>a.file&&aC.handleStatusFileSelect(a.file,"staged"),onToggle:aC.handleStagedToggle,cwd:b,emptyMessage:S("fileBrowser.noStagedFiles"),className:"py-1",renderActions:a=>{if(a.isDirectory){let b=(0,p.wI)(a);return 0===b.length?null:(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),aC.handleUnstageFiles(b.map(a=>a.path))},className:"opacity-0 group-hover:opacity-100 p-0.5 text-amber-11 hover:text-amber-10 hover:bg-amber-9/10 dark:hover:bg-amber-9/20 rounded transition-all",title:S("fileBrowser.unstageNFiles",{count:b.length}),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})})}return(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),aC.handleUnstage(a.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-amber-11 hover:text-amber-10 hover:bg-amber-9/10 dark:hover:bg-amber-9/20 rounded transition-all",title:S("fileBrowser.unstageFile"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})})}})]}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-secondary",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:S("fileBrowser.workspace",{count:aC.status?.unstaged.length||0})}),(aC.status?.unstaged.length||0)>0&&(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:aC.handleDiscardAll,className:"text-sm text-red-11 hover:text-red-10 hover:underline",children:S("fileBrowser.discardAll")}),(0,e.jsx)("button",{onClick:aC.handleStageAll,className:"text-sm text-green-11 hover:text-green-10 hover:underline",children:S("fileBrowser.stageAll")})]})]}),(0,e.jsx)(p.VO,{files:aC.unstagedTree,selectedPath:aC.statusSelectedFile?.type==="unstaged"?aC.statusSelectedFile.file.path:null,expandedPaths:aC.unstagedExpandedPaths,onSelect:a=>a.file&&aC.handleStatusFileSelect(a.file,"unstaged"),onToggle:aC.handleUnstagedToggle,cwd:b,emptyMessage:S("fileBrowser.noUnstagedChanges"),className:"py-1",renderActions:a=>{if(a.isDirectory){let b=(0,p.wI)(a);if(0===b.length)return null;let c=b.map(a=>a.file).filter(Boolean);return(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),aC.handleDiscardFiles(c)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-red-11 hover:text-red-10 hover:bg-red-9/10 dark:hover:bg-red-9/20 rounded transition-all",title:S("fileBrowser.discardNFiles",{count:b.length}),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),aC.handleStageFiles(b.map(a=>a.path))},className:"opacity-0 group-hover:opacity-100 p-0.5 text-green-11 hover:text-green-10 hover:bg-green-9/10 dark:hover:bg-green-9/20 rounded transition-all",title:S("fileBrowser.stageNFiles",{count:b.length}),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})})]})}return a.file?(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),aC.handleDiscardFile(a.file)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-red-11 hover:text-red-10 hover:bg-red-9/10 dark:hover:bg-red-9/20 rounded transition-all",title:S("fileBrowser.discardChanges"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6"})})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),aC.handleStage(a.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-green-11 hover:text-green-10 hover:bg-green-9/10 dark:hover:bg-green-9/20 rounded transition-all",title:S("fileBrowser.stageFile"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})})]}):null}})]})]})}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"history"===U?"":"hidden"}`,children:aF.historyError?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("svg",{className:"w-16 h-16 mx-auto text-slate-7 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),(0,e.jsx)("p",{className:"text-muted-foreground",children:aF.historyError})]})}):aF.compareMode?(0,e.jsx)("div",{className:"flex-1 overflow-y-auto overflow-x-hidden",children:aF.isLoadingCompareFiles?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:S("fileBrowser.loadingDiff")}):0===aF.compareFiles.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:S("fileBrowser.noDiffFiles")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"px-3 py-2 border-b border-border",children:(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:S("fileBrowser.nFilesChanged",{count:aF.compareFiles.length,branch:aF.compareBaseBranch})})}),(0,e.jsx)(p.VO,{files:aF.compareFileTree,expandedPaths:aF.compareExpandedPaths,onToggle:aF.handleCompareToggle,selectedPath:aF.compareSelectedFile?.path||null,onSelect:a=>{a.file&&aF.handleSelectCompareFile(a.file)},cwd:b,showChanges:!0})]})}):(0,e.jsx)("div",{ref:aF.commitListRef,className:"flex-1 overflow-y-auto",onScroll:aF.handleCommitListScroll,children:aF.isLoadingCommits?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:S("fileBrowser.loadingCommits")}):0===aF.commits.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:S("fileBrowser.noCommits")}):(0,e.jsxs)(e.Fragment,{children:[aF.commits.map(a=>(0,e.jsxs)("div",{onClick:()=>aF.handleSelectCommit(a),className:`px-3 py-2 border-b border-border cursor-pointer hover:bg-accent ${aF.selectedCommit?.hash===a.hash?"bg-brand/10":""}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"font-mono text-xs text-brand",children:a.shortHash}),(0,e.jsxs)("span",{className:"text-xs text-slate-9",title:a.date,children:[a.relativeDate," \xb7 ",(0,t.r6)(a.date)]})]}),(0,e.jsx)("div",{className:"text-sm text-foreground truncate mt-0.5","data-tooltip":a.subject,children:a.subject}),(0,e.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:a.author})]},a.hash)),aF.isLoadingMore&&(0,e.jsx)("div",{className:"p-3 text-center",children:(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"})}),!aF.hasMoreCommits&&aF.commits.length>0&&(0,e.jsx)("div",{className:"p-3 text-center text-xs text-slate-9",children:S("fileBrowser.allLoaded",{count:aF.commits.length})})]})})})]})]}),(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[("tree"===U||"search"===U||"recent"===U)&&(aA.blameSelectedCommit?(0,e.jsx)(l.n,{isOpen:!0,onClose:()=>aA.setBlameSelectedCommit(null),commit:aA.blameSelectedCommit,cwd:b,embedded:!0,initialFilePath:aA.selectedPath||void 0,onContentSearch:a=>{V("search"),aB.setContentSearchQuery(a),aB.performContentSearch(a)}}):"map"===W?(0,e.jsx)(y.O,{cwd:b,highlightedFilePath:aA.selectedPath,changedFiles:aD,onSwitchToCode:()=>X("code"),enableComments:!0,onContentSearch:a=>{V("search"),aB.setContentSearchQuery(a),aB.performContentSearch(a)},headerExtraLeft:({focalFile:a})=>a&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{onClick:c=>{c.stopPropagation(),navigator.clipboard.writeText(`${b}/${a}`),(0,n.oR)(S("common.copiedPath"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0",title:S("common.copyAbsPath"),children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),a2(a)},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0",title:S("fileBrowser.locateInTree"),children:(0,e.jsxs)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("circle",{cx:"12",cy:"12",r:"3",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeWidth:2,d:"M12 2v4m0 12v4M2 12h4m12 0h4"})]})})]})}):aA.selectedPath?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"px-4 py-2 bg-secondary border-b border-border flex-shrink-0 flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 min-w-0",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground truncate",children:aA.selectedPath}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(`${b}/${aA.selectedPath}`),(0,n.oR)(S("common.copiedPath"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0",title:S("common.copyAbsPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),a2(aA.selectedPath)},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0",title:S("fileBrowser.locateInTree"),children:(0,e.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("circle",{cx:"12",cy:"12",r:"3",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeWidth:2,d:"M12 2v4m0 12v4M2 12h4m12 0h4"})]})})]}),(0,e.jsx)("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:aA.showEditor?(0,e.jsxs)(e.Fragment,{children:[aj.isDirty&&(0,e.jsx)("span",{className:"text-xs text-amber-11",children:S("fileBrowser.unsaved")}),(0,e.jsx)("button",{onClick:()=>ai.current?.save(),disabled:!aj.isDirty||aj.isSaving,className:`px-1.5 py-0.5 text-xs rounded transition-colors ${aj.isDirty&&!aj.isSaving?"bg-brand text-white hover:bg-brand/90":"bg-secondary text-muted-foreground cursor-not-allowed"}`,children:aj.isSaving?(0,e.jsx)("span",{className:"inline-block w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):S("common.save")}),(0,e.jsx)("button",{onClick:()=>ai.current?.close(),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-accent",title:S("fileBrowser.closeEdit"),children:S("fileBrowser.closeBtn")})]}):(0,e.jsxs)(e.Fragment,{children:[aA.fileContent?.type==="text"&&aA.fileContent.content&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(aA.fileContent.content),(0,n.oR)(S("toast.copiedFileContent"))},className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-accent",title:S("fileBrowser.copyFileContent"),children:S("common.copy")}),aA.selectedPath?.endsWith(".json")&&aA.fileContent?.type==="text"&&(0,e.jsx)("button",{onClick:()=>ao(a=>!a),className:`px-1.5 py-0.5 text-xs rounded transition-colors ${an?"bg-brand text-white":"text-muted-foreground hover:bg-accent"}`,title:S("fileBrowser.toggleJsonReadable"),children:S("common.readable")}),aA.fileContent?.type==="text"&&(0,s.e$)(aA.selectedPath)&&(0,e.jsx)("button",{onClick:()=>aA.setShowMarkdownPreview(!0),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-accent",title:S("fileBrowser.previewMarkdown"),children:S("common.preview")}),aA.fileContent?.type==="text"&&(0,e.jsx)("button",{onClick:aA.handleToggleBlame,disabled:aA.isLoadingBlame,className:`px-1.5 py-0.5 text-xs rounded transition-colors ${aA.showBlame?"bg-brand text-white":"text-muted-foreground hover:bg-accent"} disabled:opacity-50`,title:S("fileBrowser.viewBlame"),children:aA.isLoadingBlame?(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-current border-t-transparent rounded-full animate-spin"}):"Blame"}),aA.fileContent?.type==="text"&&(0,e.jsx)("button",{onClick:()=>X("map"),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-accent",title:S("blockViewer.viewerToggle.toBlock"),children:S("common.codeMap")}),aA.fileContent?.type==="text"&&(0,e.jsx)("button",{onClick:()=>aA.setShowEditor(!0),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-accent",title:S("fileBrowser.editFile"),children:S("common.edit")})]})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden",children:aA.isLoadingContent?(0,e.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):aA.fileContent?"text"===aA.fileContent.type&&"string"==typeof aA.fileContent.content?aA.showBlame&&aA.blameError?(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("p",{className:"text-red-11",children:aA.blameError}),(0,e.jsx)("button",{onClick:()=>aA.setShowBlame(!1),className:"mt-2 text-brand hover:underline text-sm",children:S("fileBrowser.backToPreview")})]})}):aA.showBlame&&0===aA.blameLines.length&&aA.isLoadingBlame?(0,e.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):an&&aA.selectedPath?.endsWith(".json")?(0,e.jsxs)("div",{className:"h-full flex flex-col bg-[#0d1117]",children:[(0,e.jsx)(J._,{search:as}),(0,e.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4",children:(0,e.jsx)("pre",{ref:ar,className:"whitespace-pre-wrap break-words font-mono",style:{fontSize:"0.8125rem",lineHeight:"1.5"},children:(0,s.xb)(aA.fileContent.content)})})]}):(0,e.jsx)(r.Cv,{ref:ai,content:aA.fileContent.content,filePath:aA.selectedPath,cwd:b,enableComments:!0,scrollToLine:ag??aA.targetLineNumber,scrollToLineAlign:null!=ag?"start":aA.targetScrollAlign,onScrollToLineComplete:()=>{ah(null),aA.setTargetLineNumber(null)},highlightKeyword:"search"===U?aB.contentSearchQuery:null,visibleLineRef:ae,viStateRef:af,initialCursorLine:aA.initialCursorLine,initialCursorCol:aA.initialCursorCol,onInitialCursorSet:()=>{aA.setInitialCursorLine(null),aA.setInitialCursorCol(null)},onCmdClick:aS?aT:void 0,onTokenHover:aS?aU:void 0,onTokenHoverLeave:aS?aw.onTokenMouseLeave:void 0,onTokenHoverCancel:aS?aw.clearHover:void 0,blameLines:aA.showBlame&&aA.blameLines.length>0?aA.blameLines:void 0,inlineBlameLines:aA.blameLines.length>0?aA.blameLines:void 0,onSelectCommit:aA.setBlameSelectedCommit,editable:aA.showEditor,initialMtime:aA.fileContent.mtime,onEditorClose:a=>{aA.setShowEditor(!1),ah(a)},onSaved:()=>{let a=ae.current??1;aA.loadFileContent(aA.selectedPath),aA.setShowEditor(!1),ah(a)},onEditorStateChange:ak,viMode:!0,onContentMutate:aH,onEnterInsertMode:aI,onViSave:aJ,onContentSearch:a=>{V("search"),aB.setContentSearchQuery(a),aB.performContentSearch(a)}}):"image"===aA.fileContent.type&&aA.selectedPath?(0,e.jsx)(B.I,{cwd:b,path:aA.selectedPath,refreshKey:aA.fileContent.mtime,alt:aA.selectedPath}):(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("svg",{className:"w-16 h-16 mx-auto text-slate-7 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),(0,e.jsx)("p",{children:aA.fileContent.message||S("fileBrowser.cannotPreview")})]})}):(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:S("fileBrowser.selectFileToPreview")})})]}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("svg",{className:"w-16 h-16 mx-auto text-slate-7 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),(0,e.jsx)("p",{children:S("fileBrowser.selectFileToPreview")})]})})),"status"===U&&(aC.statusSelectedFile&&aC.statusDiff?(0,e.jsx)(z.m,{cwd:b,selected:aC.statusSelectedFile,diff:aC.statusDiff,showMarkdownPreview:aC.showStatusDiffPreview,setShowMarkdownPreview:aC.setShowStatusDiffPreview,changedFiles:aD,fileGitStatusMap:aE,onContentSearch:a=>{V("search"),aB.setContentSearchQuery(a),aB.performContentSearch(a)},locateInTree:a2,jsonPreview:ap,setJsonPreview:aq,jsonPreviewSearch:au,jsonPreviewPreRef:at}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-slate-9",children:(0,e.jsx)("span",{children:S("fileBrowser.selectFileToViewDiff")})})),"history"===U&&!aF.historyError&&(aF.compareMode?aF.isLoadingCompareDiff?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:S("fileBrowser.loadingDiffContent")}):aF.compareFileDiff?(0,e.jsx)(m.xZ,{oldContent:aF.compareFileDiff.oldContent,newContent:aF.compareFileDiff.newContent,filePath:aF.compareFileDiff.filePath,isNew:aF.compareFileDiff.isNew,isDeleted:aF.compareFileDiff.isDeleted,cwd:b,enableComments:!0,onPreview:!aF.compareFileDiff.isDeleted&&aF.compareFileDiff.filePath.endsWith(".json")?()=>aq({content:aF.compareFileDiff.newContent,filePath:aF.compareFileDiff.filePath}):void 0,previewLabel:S("common.readable"),onContentSearch:a=>{V("search"),aB.setContentSearchQuery(a),aB.performContentSearch(a)}}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-slate-9",children:(0,e.jsx)("span",{children:aF.compareFiles.length>0?S("fileBrowser.selectFileToViewDiff"):S("fileBrowser.clickCompareToLoad")})}):aF.selectedCommit?(0,e.jsx)(l.n,{isOpen:!0,onClose:()=>aF.setSelectedCommit(null),commit:aF.selectedCommit,cwd:b,embedded:!0,onContentSearch:a=>{V("search"),aB.setContentSearchQuery(a),aB.performContentSearch(a)}}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-slate-9",children:(0,e.jsx)("span",{children:S("fileBrowser.selectCommitToView")})}))]})]}),aA.showMarkdownPreview&&aA.fileContent?.type==="text"&&aA.selectedPath&&(0,e.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>aA.setShowMarkdownPreview(!1),children:(0,e.jsx)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-[90%] h-full flex flex-col",onClick:a=>a.stopPropagation(),children:(0,e.jsx)(u.M,{content:aA.fileContent.content||"",filePath:aA.selectedPath,cwd:b,onClose:()=>aA.setShowMarkdownPreview(!1)})})}),ac&&(0,e.jsx)(v.c,{files:aA.files,fileIndex:aA.fileIndex,recentFiles:aA.recentFilePaths,onSelectFile:a=>{aL(a),aA.setShouldScrollToSelected(!0),V("tree")},onClose:()=>ad(!1)}),(aR||ax.visible)&&(0,e.jsxs)("div",{className:`flex ${ax.visible&&aR?"":"flex-col"}`,children:[aR&&(0,e.jsx)("div",{className:ax.visible?"flex-1 min-w-0 border-r border-border":"",children:(0,e.jsx)(N.D,{results:aB.contentSearchResults,loading:aB.isSearching,totalMatches:aB.searchStats?.totalMatches??0,onSelect:(a,b)=>{aA.selectedPath&&ay.push({filePath:aA.selectedPath,lineNumber:ae.current}),aL(a,b)},onClose:()=>am(!1)})}),ax.visible&&(0,e.jsx)("div",{className:aR?"flex-1 min-w-0":"",children:(0,e.jsx)(M.D,{references:ax.references,loading:ax.loading,onSelect:aV,onClose:ax.closeReferences})})]})]}),aa&&(0,e.jsx)(h.ZL,{children:(0,e.jsx)("div",{className:"fixed inset-0 z-[300] flex items-center justify-center bg-black/50",onClick:()=>ab(null),children:(0,e.jsxs)("div",{className:"bg-card border border-border rounded-lg shadow-xl p-4 max-w-sm w-full mx-4",onClick:a=>a.stopPropagation(),children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground mb-2",children:S("fileBrowser.confirmDelete")}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:S("fileBrowser.confirmDeleteMessage",{name:aa.name}).split(/<\/?file>/g).map((a,b)=>1===b?(0,e.jsx)("span",{className:"font-mono text-foreground",children:a},b):a)}),(0,e.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,e.jsx)("button",{onClick:()=>ab(null),className:"px-3 py-1.5 text-sm rounded border border-border hover:bg-accent transition-colors",children:S("common.cancel")}),(0,e.jsx)("button",{onClick:async()=>{let{path:a,name:c}=aa;ab(null);let d=await i.t4.runPromiseExit((0,j.VK)({cwd:b,path:a}));if("Success"===d._tag){(0,n.oR)(S("toast.movedToTrash",{name:c}),"success");let b=a.includes("/")?a.substring(0,a.lastIndexOf("/")):"";aA.loadDirectory(b),aA.loadFileIndex(),aA.selectedPath===a&&aL("")}else{let a="Fail"===d.cause._tag?d.cause.error:null,b=a?.cause,c=b instanceof Error?b.message:S("toast.deleteFailed");(0,n.oR)(c,"error")}},className:"px-3 py-1.5 text-sm rounded bg-destructive text-destructive-foreground hover:bg-destructive/90 transition-colors",children:S("common.delete")})]})]})})}),aw.hoverInfo&&$&&(0,g.createPortal)((0,e.jsx)(L.s,{ref:aw.setTooltipEl,displayString:aw.hoverInfo.displayString,documentation:aw.hoverInfo.documentation,x:aw.hoverInfo.x,y:aw.hoverInfo.y,container:$,onMouseEnter:aw.onCardMouseEnter,onMouseLeave:aw.onCardMouseLeave,onFindReferences:()=>{let{filePath:a,line:b,column:c}=aw.hoverInfo;aw.clearHover(),ax.findReferences(a,b,c)},onSearch:a=>{aw.clearHover(),V("search"),aB.setContentSearchQuery(a),aB.performContentSearch(a)}}),$)]})}[E,F,p,o,l,y,r,z,m,u,v,N,M]=P.then?(await P)():P,d()}catch(a){d(a)}})},70404:(a,b,c)=>{"use strict";c.d(b,{e:()=>g});var d=c(48249),e=c(67484);function f(a,b){for(let c=0;c<a.blocks.length;c++){let d=a.blocks[c];if(b>=d.startLine&&b<=d.endLine)return a.prefix[c]+(b-d.startLine)}return null}function g({addedLines:a,blockRanges:b,viewportRange:c,onJumpToLine:h}){let i,j=(0,e.useRef)(null),k=(0,e.useMemo)(()=>(function(a){let b=[...a].sort((a,b)=>a.startLine-b.startLine),c=[0];for(let a of b){let b=Math.max(0,a.endLine-a.startLine+1);c.push(c[c.length-1]+b)}return{blocks:b,prefix:c,total:c[c.length-1]}})(b),[b]),l=(0,e.useMemo)(()=>{if(k.total<=0||0===a.size)return[];let b=[];for(let c of a){let a=k.blocks.find(a=>c>=a.startLine&&c<=a.endLine);a&&b.push({line:c,qname:a.qname})}b.sort((a,b)=>a.line-b.line);let c=[],d=null;for(let a of b)d&&a.line===d.end+1&&a.qname===d.qname?d.end=a.line:(d&&c.push(d),d={start:a.line,end:a.line,qname:a.qname});return d&&c.push(d),c},[a,k]);if(k.total<=0)return null;let m=(a,b)=>{let c=f(k,a),d=f(k,b);return null===c||null===d?null:{top:c/k.total*100,heightPct:(d-c+1)/k.total*100}};return(0,d.jsxs)("div",{ref:j,onClick:a=>{let b=j.current;if(!b)return;let c=b.getBoundingClientRect();if(c.height<=0)return;let d=function(a,b){if(a.total<=0)return null;let c=Math.max(0,Math.min(a.total-1,b));for(let b=0;b<a.blocks.length;b++){let d=a.prefix[b],e=a.prefix[b+1];if(c>=d&&c<e){let e=a.blocks[b];return{qname:e.qname,line:e.startLine+Math.round(c-d)}}}return null}(k,(a.clientY-c.top)/c.height*k.total);if(!d)return;let e=d.line,g=l.find(a=>a.qname===d.qname&&e>=a.start&&e<=a.end);if(g)return void h(g.qname,e);if(l.length>0){let a=Math.max(2,Math.round(.05*k.total)),b=f(k,e);if(null!==b){let c=null,d=1/0;for(let a of l){let e=f(k,a.start),g=f(k,a.end);if(null===e||null===g)continue;let h=b<e?e-b:b>g?b-g:0;h<d&&(c=a,d=h)}if(c&&d<=a){let a=e<c.start?c.start:e>c.end?c.end:e;h(c.qname,a);return}}}let i=k.blocks.find(a=>a.qname===d.qname);i&&h(i.qname,i.startLine)},className:"w-4 flex-shrink-0 bg-secondary border-l border-border relative cursor-pointer",title:"Diff minimap — click to jump",children:[l.map(a=>{let b=m(a.start,a.end);return b?(0,d.jsx)("div",{className:"absolute left-0 right-0 bg-green-9 pointer-events-none",style:{top:`${b.top}%`,height:`${b.heightPct}%`,minHeight:"2px"}},`run:${a.qname}:${a.start}-${a.end}`):null}),c&&c.end>=c.start&&((i=m(c.start,c.end))?(0,d.jsx)("div",{className:"absolute left-0 right-0 bg-muted/60 border-y border-border pointer-events-none",style:{top:`${i.top}%`,height:`${Math.max(1.2,i.heightPct)}%`}}):null)]})}},70440:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(88868);let e=async a=>[{type:"image/x-icon",sizes:"16x16",url:(0,d.fillMetadataSegment)(".",await a.params,"favicon.ico",!0)+"?603d046c9a6fdfbb"}]},70596:(a,b,c)=>{"use strict";c.d(b,{t:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({x:a,y:b,comment:c,container:h,onClose:i,onUpdateComment:j,onDeleteComment:k}){let{t:l}=(0,f.Bd)(),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(c.content),q=(0,e.useRef)(null),[r,s]=(0,e.useState)({x:0,y:0}),t=async()=>{o.trim()&&(await j(c.id,o.trim()),n(!1))},u=async()=>{await k(c.id),i()};return(0,d.jsx)("div",{ref:q,className:"absolute z-[200] w-96 bg-card border border-border rounded-lg shadow-lg overflow-hidden",style:{left:r.x,top:r.y},children:(0,d.jsx)("div",{className:"p-3",children:m?(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("textarea",{value:o,onChange:a=>p(a.target.value),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card resize-none focus:outline-none focus:ring-1 focus:ring-ring",rows:3,autoFocus:!0,onKeyDown:a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),t()),"Escape"===a.key&&(n(!1),p(c.content))}}),(0,d.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,d.jsx)("button",{onClick:()=>{n(!1),p(c.content)},className:"px-2 py-1 text-xs text-muted-foreground hover:text-foreground",children:l("common.cancel")}),(0,d.jsx)("button",{onClick:t,className:"px-2 py-1 text-xs bg-brand text-white rounded hover:bg-brand/90",children:l("common.save")})]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:c.content}),(0,d.jsxs)("div",{className:"mt-2 flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:l("comments.lineRange",{start:c.startLine,end:c.endLine})}),(0,d.jsxs)("div",{className:"flex gap-1",children:[(0,d.jsx)("button",{onClick:()=>n(!0),className:"p-1 rounded hover:bg-accent text-muted-foreground",title:l("common.edit"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,d.jsx)("button",{onClick:u,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-red-9",title:l("common.delete"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]})]})})})}},71192:(a,b,c)=>{"use strict";c.d(b,{m_:()=>f,uV:()=>e});var d=c(81218);class e extends d.rN("AppError"){}d.rN("DBError"),d.rN("WSError"),d.rN("FSError"),d.rN("AgentError"),d.rN("ValidationError");class f extends d.rN("NotFoundError"){}d.rN("PermissionError")},72399:(a,b,c)=>{"use strict";c.d(b,{ProjectSidebar:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call ProjectSidebar() from the server but ProjectSidebar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/ProjectSidebar.tsx","ProjectSidebar")},72529:(a,b,c)=>{"use strict";c.d(b,{m:()=>f});var d=c(48249),e=c(67484);function f({content:a,children:b,className:c}){if(c)return(0,d.jsx)("div",{"data-tooltip":a,className:c,children:b});let g=e.Children.toArray(b);if(1===g.length&&(0,e.isValidElement)(g[0])){let b=g[0];return(0,e.cloneElement)(b,{"data-tooltip":a})}return(0,d.jsx)("div",{"data-tooltip":a,style:{display:"contents"},children:b})}},73414:(a,b,c)=>{"use strict";c.d(b,{YO:()=>d,pU:()=>e});let d=20;function e(a,b,c,f=[]){let g=a.length,h=c=>"unchanged"!==a[c].type||"unchanged"!==b[c].type,i=new Set;for(let a=0;a<g;a++){if(!h(a))continue;let b=Math.max(0,a-3),c=Math.min(g-1,a+3);for(let a=b;a<=c;a++)i.add(a)}let j=[];for(let a=0;a<g;a++){if(i.has(a))continue;let b=a;for(;a<g&&!i.has(a);)a++;j.push({id:j.length,startIdx:b,endIdx:a-1}),a--}for(let a of j){let b=c.get(a.id)??{topRevealed:0,bottomRevealed:0},d=a.endIdx-a.startIdx+1,e=Math.max(0,Math.min(b.topRevealed,d)),f=Math.max(0,Math.min(b.bottomRevealed,d-e));for(let b=a.startIdx;b<a.startIdx+e;b++)i.add(b);for(let b=a.endIdx-f+1;b<=a.endIdx;b++)i.add(b)}let k=[];for(let a=0;a<g;a++){let c;if(i.has(a)){k.push({kind:"diff",idx:a});continue}let e=a;for(;a<g&&!i.has(a);)a++;let h=a-1;a--;let l=j.find(a=>a.startIdx<=e&&h<=a.endIdx);if(!l)continue;let m=h-e+1,n=Math.min(d,m);if(f.length>0&&h+1<g)for(let a=h+1;a<g;a++){let d=b[a].lineNum;if(!(d<=0)){c=function(a,b){let c=null;for(let d of a)d.startLine<=b&&b<=d.endLine&&(!c||d.endLine-d.startLine<c.endLine-c.startLine)&&(c=d);return c}(f,d)??void 0;break}}k.push({kind:"gap-expand",gapId:l.id,direction:"up",revealCount:n}),k.push({kind:"gap-label",gapId:l.id,hiddenCount:m,enclosingFn:c}),k.push({kind:"gap-expand",gapId:l.id,direction:"down",revealCount:n})}return{rows:k,gaps:j}}},73887:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{M:()=>u});var e=c(48249),f=c(67484),g=c(44384),h=c(74429),i=c(7122),j=c(41051),k=c(42140),l=c(70596),m=c(74754),n=c(7031),o=c(91579),p=c(87844),q=c(84835),r=c(24680),s=c(25465),t=a([s]);s=(t.then?(await t)():t)[0];let v=[q.W];function u({content:a,filePath:b,cwd:c,onClose:d,sourceFile:q}){let t=q||(c&&b.startsWith(c)?b.slice(c.endsWith("/")?c.length:c.length+1):b),{t:w}=(0,g.Bd)(),x=(0,f.useRef)(null),y=(0,f.useRef)(null),z=(0,f.useRef)(()=>{}),A=(0,i.iN)(),B=(0,n.r)(),{comments:C,addComment:D,updateComment:E,deleteComment:F,refresh:G}=(0,m._)({cwd:c,filePath:b}),[H,I]=(0,f.useState)(!1),[J,K]=(0,f.useState)(null),[L,M]=(0,f.useState)(null),[N,O]=(0,f.useState)(null),P=(0,f.useMemo)(()=>a.split("\n"),[a]),Q=(0,f.useCallback)(()=>{let a=y.current;a&&(K({x:a.x,y:a.y,range:a.range,codeContent:a.selectedText}),y.current=null,z.current())},[]),R=(0,f.useCallback)(()=>{let a=y.current;a&&(M({x:a.x,y:a.y,range:a.range,codeContent:a.selectedText}),y.current=null,z.current())},[]),S=(0,f.useCallback)(async a=>{J&&(await D(J.range.start,J.range.end,a),K(null))},[J,D]),T=(0,f.useCallback)(async a=>{if(L&&B)try{let d=await (0,o.$3)(c),e=[];for(let a of d)e.push({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0});let f=Math.max(0,L.range.start-1),g=Math.min(P.length,L.range.end),h=P.slice(f,g).join("\n");e.push({filePath:b,startLine:L.range.start,endLine:L.range.end,codeContent:h});let i=(0,o.Gw)(e,a);B.sendMessage(i),await (0,o.RP)(c),G(),M(null)}catch(a){console.error("Failed to send to AI:",a)}},[L,B,b,c,P,G]);(0,f.useMemo)(()=>{if(0===C.length)return[];let a=new Map;for(let b of C){let c=`${b.startLine}-${b.endLine}`;a.has(c)||a.set(c,[]),a.get(c).push(b)}return Array.from(a.entries()).map(([a,b])=>({key:a,startLine:b[0].startLine,endLine:b[0].endLine,comments:b}))},[C]);let[U,V]=(0,f.useState)([]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between flex-shrink-0",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-foreground truncate",children:b}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)(s.ShareReviewToggle,{content:a,sourceFile:t}),(0,e.jsx)("button",{onClick:d,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:w("common.close"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,e.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,e.jsx)(r.l,{content:a,containerRef:x}),(0,e.jsxs)("div",{className:"flex-1 overflow-auto relative",ref:x,children:[(0,e.jsx)("div",{className:"p-6",children:(0,e.jsx)(p.T,{content:a,rehypePlugins:v})}),U.map(({key:a,top:b,comments:c})=>(0,e.jsx)("div",{className:"absolute right-3 cursor-pointer z-10",style:{top:b},onClick:a=>{a.stopPropagation(),O({comment:c[0],x:a.clientX,y:a.clientY})},children:(0,e.jsx)("div",{className:"w-5 h-5 rounded-full bg-amber-500/80 text-white text-xs flex items-center justify-center shadow-sm hover:bg-amber-500 transition-colors",children:c.length})},a))]})]}),H&&A&&(0,h.createPortal)((0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(j.f,{floatingToolbarRef:y,bumpRef:z,container:A,onAddComment:Q,onSendToAI:R,isChatLoading:B?.isLoading}),J&&(0,e.jsx)(k.t,{x:J.x,y:J.y,range:J.range,codeContent:J.codeContent,container:A,onSubmit:S,onClose:()=>K(null)}),L&&(0,e.jsx)(k.G,{x:L.x,y:L.y,range:L.range,filePath:b,codeContent:L.codeContent,container:A,onSubmit:T,onClose:()=>M(null),isChatLoading:B?.isLoading}),N&&(0,e.jsx)(l.t,{x:N.x,y:N.y,comment:N.comment,container:A,onClose:()=>O(null),onUpdateComment:E,onDeleteComment:F})]}),A)]})}d()}catch(a){d(a)}})},74493:(a,b,c)=>{"use strict";c.d(b,{Ey:()=>n,GW:()=>m,HS:()=>o,Hj:()=>i,ax:()=>h,qM:()=>j});var d=c(79606),e=c(33281),f=c(71192);let g=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error(`HTTP ${c.status}`)},catch:b=>new f.uV({message:`POST ${a} failed`,cause:b})}),h=(a,b)=>e.t4.runPromise(g(`/api/${a}/disconnect`,{id:b}).pipe(d.orElse(()=>d.void))),i=a=>e.t4.runPromise(g("/api/jupyter/shutdown",{bubbleId:a}).pipe(d.orElse(()=>d.void))),j=a=>e.t4.runPromise(g("/api/browser/unregister",{id:a}).pipe(d.orElse(()=>d.void))),k=a=>e.t4.runPromise(a.pipe(d.catchAll(a=>d.sync(()=>{if(a.cause instanceof Error)throw a.cause;throw Error(a.message)})))),l=(a,b)=>{if(a&&"object"==typeof a&&"error"in a){let b=a.error;if("string"==typeof b&&b.length>0)return b;if(b&&"object"==typeof b){let a=b.message;if("string"==typeof a&&a.length>0)return a;let c=b._tag;if("string"==typeof c&&c.length>0)return c}}return`HTTP ${b}`},m=(a,b)=>k(d.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),d=await c.json();if(!c.ok)throw Error(l(d,c.status));return d},catch:b=>new f.uV({message:`POST ${a} failed`,cause:b})})),n=(a,b)=>k(d.tryPromise({try:async()=>{let c=new URLSearchParams(b),d=await fetch(`${a}?${c}`),e=await d.json();if(!d.ok)throw Error(l(e,d.status));return e},catch:b=>new f.uV({message:`GET ${a} failed`,cause:b})})),o=(a,b)=>k(d.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error(`HTTP ${c.status}`);return c.blob()},catch:b=>new f.uV({message:`POST blob ${a} failed`,cause:b})}))},74542:(a,b,c)=>{"use strict";c.d(b,{b:()=>f});var d=c(48249),e=c(67484);function f({lines:a,containerRef:b}){let c=(0,e.useRef)(null),[g,h]=(0,e.useState)({top:0,height:0});if(0===a.length)return null;let i=100/a.length;return(0,d.jsxs)("div",{ref:c,className:"w-4 flex-shrink-0 bg-secondary border-l border-border relative cursor-pointer",onClick:a=>{let d=b.current,e=c.current;if(!d||!e)return;let f=e.getBoundingClientRect(),g=(a.clientY-f.top)/f.height*d.scrollHeight-d.clientHeight/2;d.scrollTo({top:Math.max(0,g),behavior:"smooth"})},children:[a.map((a,b)=>"unchanged"!==a.type&&(0,d.jsx)("div",{className:`absolute left-0 right-0 ${"removed"===a.type?"bg-red-9":"bg-green-9"}`,style:{top:`${b*i}%`,height:`${Math.max(i,.5)}%`,minHeight:"2px"}},b)),(0,d.jsx)("div",{className:"absolute left-0 right-0 bg-muted/60 border-y border-border",style:{top:`${g.top}px`,height:`${Math.max(g.height,10)}px`}})]})}},74754:(a,b,c)=>{"use strict";c.d(b,{_:()=>g});var d=c(67484);c(91579);var e=c(33281),f=c(89800);function g({cwd:a,filePath:b}){let[c,h]=(0,d.useState)([]),[i,j]=(0,d.useState)(!1),[k,l]=(0,d.useState)(null),m=(0,d.useCallback)(async()=>{if(!a||!b)return;j(!0),l(null);let c=await e.t4.runPromiseExit((0,f.lb)(a,b));if("Success"===c._tag)h(c.value.comments??[]);else{let a="Fail"===c.cause._tag?c.cause.error:null,b=a?.cause;l(b instanceof Error?b.message:"Failed to load comments")}j(!1)},[a,b]),n=(0,d.useCallback)(async(c,d,g,i)=>{let j=await e.t4.runPromiseExit((0,f.BC)({cwd:a,filePath:b,startLine:c,endLine:d,content:g,...i?{selectedText:i}:{}}));if("Success"===j._tag&&j.value.comment){let a=j.value.comment;return h(b=>[...b,a]),a}return"Failure"===j._tag&&console.error("Failed to add comment:",j.cause),null},[a,b]),o=(0,d.useCallback)(async(b,c)=>{let d=await e.t4.runPromiseExit((0,f.vv)(a,b,c));if("Success"===d._tag&&d.value.comment){let a=d.value.comment;return h(c=>c.map(c=>c.id===b?a:c)),!0}return"Failure"===d._tag&&console.error("Failed to update comment:",d.cause),!1},[a]),p=(0,d.useCallback)(async b=>{let c=await e.t4.runPromiseExit((0,f.Tu)(a,b));return"Success"===c._tag?(h(a=>a.filter(a=>a.id!==b)),!0):(console.error("Failed to delete comment:",c.cause),!1)},[a]),q=(0,d.useCallback)(a=>c.filter(b=>a>=b.startLine&&a<=b.endLine),[c]);return{comments:c,isLoading:i,error:k,addComment:n,updateComment:o,deleteComment:p,refresh:m,getCommentsForLine:q}}},74815:(a,b,c)=>{"use strict";c.d(b,{r:()=>e});var d=c(67484);function e({enabled:a,container:b,bodyScope:c}){let[f,g]=(0,d.useState)(null);return{toolbar:f,clearToolbar:()=>g(null)}}},74837:(a,b,c)=>{"use strict";c.d(b,{NoteToolbar:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call NoteToolbar() from the server but NoteToolbar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/NoteToolbar.tsx","NoteToolbar")},74991:(a,b,c)=>{"use strict";c.d(b,{I:()=>j});var d=c(48249),e=c(67484),f=c(44384),g=c(30458);function h(a,b){if("once"===a.type)return b("scheduledTasks.onceType",{minutes:a.delayMinutes});if("interval"===a.type){let c=b("scheduledTasks.everyNMinutes",{minutes:a.intervalMinutes});return a.activeFrom&&a.activeTo?`${c} (${a.activeFrom}-${a.activeTo})`:c}return"cron"===a.type?a.cron||"cron":a.type}function i(a){return a.unread?"bg-red-500":a.completed?"bg-muted-foreground":a.paused?"bg-yellow-500":"error"===a.lastResult?"bg-red-500":"bg-green-500"}function j({collapsed:a,tasks:b,unreadCount:c,onSwitchProject:k,onPause:l,onResume:m,onTrigger:n,onDelete:o,onMarkRead:p,onUpdateTask:q,onReorder:r}){let{t:s}=(0,f.Bd)(),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)(null),x=(0,e.useRef)(null),y=b.filter(a=>!a.completed),z=y.filter(a=>!a.paused).length,A=b.filter(a=>a.completed),[B,C]=(0,e.useState)(null),[D,E]=(0,e.useState)(null),F=(0,e.useCallback)(a=>{C(a)},[]),G=(0,e.useCallback)((a,b)=>{a.preventDefault(),E(b)},[]),H=(0,e.useCallback)(a=>{if(null===B||B===a){C(null),E(null);return}let b=[...y],[c]=b.splice(B,1);b.splice(a,0,c),r([...b,...A].map(a=>a.id)),C(null),E(null)},[B,y,A,r]),I=(0,e.useCallback)(()=>{C(null),E(null)},[]),[,J]=(0,e.useState)(0);return(0,d.jsxs)("div",{className:"relative",ref:x,children:[(0,d.jsxs)("button",{onClick:()=>u(!t),className:`relative flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${a?"w-full justify-center":"w-full"}`,title:s("scheduledTasks.title"),children:[(0,d.jsxs)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6l4 2"})]}),!a&&(0,d.jsx)("span",{className:"text-sm flex-1 text-left",children:s("scheduledTasks.title")}),c>0?(0,d.jsx)("span",{className:`min-w-[18px] h-[18px] px-1 text-white text-xs font-medium rounded-full flex items-center justify-center bg-red-500 ${a?"absolute -top-1 -right-1":""}`,children:c}):a&&b.length>0?(0,d.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] px-1 text-muted-foreground text-xs font-medium rounded-full flex items-center justify-center bg-accent",children:b.length}):null]}),t&&(0,d.jsxs)("div",{className:"absolute left-full bottom-0 ml-2 w-96 max-h-[500px] bg-popover border border-border rounded-lg shadow-lg z-50 flex flex-col",children:[(0,d.jsxs)("div",{className:"px-3 py-2 border-b border-border bg-muted/50 flex-shrink-0 rounded-t-lg flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm font-medium",children:s("scheduledTasks.title")}),y.length>0&&(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:[s("scheduledTasks.activeCount",{running:z}),y.length-z>0?` \xb7 ${s("scheduledTasks.pausedCount",{paused:y.length-z})}`:""]})]}),(0,d.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:0===b.length?(0,d.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:s("scheduledTasks.noScheduledTasks")}):(0,d.jsxs)(d.Fragment,{children:[y.map((a,b)=>{var c;return(0,d.jsx)("div",{draggable:!0,onDragStart:()=>F(b),onDragOver:a=>G(a,b),onDrop:()=>H(b),onDragEnd:I,className:`group px-3 py-2 hover:bg-accent transition-colors border-b border-border/50 cursor-pointer ${a.unread?"bg-brand/5":""} ${B===b?"opacity-50":""} ${D===b?"border-t-2 border-brand":""}`,onClick:()=>{k(a.cwd,a.sessionId),a.unread&&p(a.id),u(!1)},children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:`mt-1.5 w-2 h-2 rounded-full flex-shrink-0 ${i(a)}`}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-xs text-muted-foreground font-mono",children:(c=a.cwd).split("/").pop()||c}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:"\xb7"}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:a.completed?s("scheduledTasks.completed"):a.paused?s("scheduledTasks.paused"):s("common.running")})]}),(0,d.jsx)("div",{className:"text-sm text-foreground truncate mt-0.5",title:a.message,children:a.message}),(0,d.jsxs)("div",{className:"flex items-center gap-3 mt-1 text-xs text-muted-foreground",children:[(0,d.jsx)("span",{children:h(a,s)}),(0,d.jsx)("span",{children:"\xb7"}),(0,d.jsx)("span",{children:a.paused?s("scheduledTasks.paused"):function(a,b){if(!a)return"-";let c=a-Date.now();if(c<=0)return b("scheduledTasks.aboutToTrigger");if(c<6e4)return b("scheduledTasks.secondsLater",{count:Math.ceil(c/1e3)});if(c<36e5)return b("scheduledTasks.minutesLater",{count:Math.ceil(c/6e4)});if(c<864e5){let a=Math.floor(c/36e5),d=Math.ceil(c%36e5/6e4);return d>0?b("scheduledTasks.hoursMinutesLater",{h:a,m:d}):b("scheduledTasks.hoursLater",{h:a})}return new Date(a).toLocaleDateString("zh-CN",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}(a.nextFireTime,s)}),a.lastFiredAt&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{children:"\xb7"}),(0,d.jsxs)("span",{children:[s("scheduledTasks.lastResult"),": ","success"===a.lastResult?"✓":"✗"]})]})]})]}),(0,d.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),n(a.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-brand",title:s("scheduledTasks.runNow"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M8 5v14l11-7z"})})}),(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),w(a)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground",title:s("common.edit"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),a.paused?(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),m(a.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-green-500",title:s("scheduledTasks.resume"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"})})}):(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),l(a.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-yellow-500",title:s("scheduledTasks.pause"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 9v6m4-6v6"})})}),(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),o(a.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-destructive",title:s("common.delete"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]})},a.id)}),A.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"px-3 py-1.5 text-xs text-muted-foreground bg-muted/30 border-b border-border/50",children:s("scheduledTasks.completedCount",{count:A.length})}),A.map(a=>(0,d.jsx)("div",{className:"group px-3 py-2 hover:bg-accent transition-colors border-b border-border/50 opacity-60 cursor-pointer",onClick:()=>{k(a.cwd,a.sessionId),u(!1)},children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:`mt-1.5 w-2 h-2 rounded-full flex-shrink-0 ${i(a)}`}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-sm text-foreground truncate",children:a.message}),(0,d.jsxs)("div",{className:"text-xs text-muted-foreground mt-0.5",children:[h(a,s)," \xb7 ","success"===a.lastResult?s("scheduledTasks.success"):s("scheduledTasks.failure")]})]}),(0,d.jsx)("div",{className:"flex-shrink-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),o(a.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-destructive",title:s("common.delete"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})})]})},a.id))]})]})})]}),v&&(0,d.jsxs)("div",{className:"fixed inset-0 z-[100] flex items-center justify-center",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/30",onClick:()=>w(null)}),(0,d.jsx)("div",{className:"relative",children:(0,d.jsx)(g.E,{onClose:()=>w(null),onCreate:()=>{},editTask:{id:v.id,message:v.message,type:v.type,delayMinutes:v.delayMinutes,intervalMinutes:v.intervalMinutes,activeFrom:v.activeFrom,activeTo:v.activeTo,cron:v.cron},onUpdate:(a,b)=>{q(a,b),w(null)}})})]})]})}},75513:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{k_:()=>h,nH:()=>i});var e=c(48249),f=c(67484),g=c(7031);let a=(0,f.createContext)(null);function h({children:b}){let c=(0,f.useRef)(new Map),d=(0,f.useRef)(null),[i,j]=(0,f.useState)(!1),k=(0,f.useCallback)((a,b)=>{c.current.set(b,a)},[]),l=(0,f.useCallback)(a=>{c.current.delete(a)},[]),m=(0,f.useCallback)(a=>{d.current=a},[]),n=(0,f.useCallback)(a=>{let b=d.current;if(!b)return void console.warn("No active tab to send message");let e=c.current.get(b);e?e(a):console.warn(`No chat sender registered for tab ${b}`)},[]),o=(0,f.useMemo)(()=>({sendMessage:n,isLoading:i,registerChat:k,unregisterChat:l,setActiveTab:m,setIsLoading:j}),[n,i,k,l,m]),p=(0,f.useMemo)(()=>({sendMessage:n,isLoading:i}),[n,i]);return(0,e.jsx)(a.Provider,{value:o,children:(0,e.jsx)(g.H,{value:p,children:b})})}function i(){return(0,f.useContext)(a)}d()}catch(a){d(a)}})},76334:(a,b,c)=>{"use strict";function d(a){let b=function(a){let b=0xffffffff;for(let c=0;c<a.length;c++){b^=a.charCodeAt(c);for(let a=0;a<8;a++)b=b>>>1^(1&b?0xedb88320:0)}return(0xffffffff^b)>>>0}(a),c="",d=b;for(let a=0;a<4;a++)c+=String.fromCharCode(97+d%26),d=Math.floor(d/26);return c}c.d(b,{p:()=>d})},76537:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>n,metadata:()=>l,viewport:()=>m});var d=c(5735),e=c(45864),f=c.n(e),g=c(87764),h=c.n(g),i=c(76055),j=c.n(i);c(61135);var k=c(25702);let l={title:"Cockpit",description:"Cockpit is a local-first AI development hub with chat agents, a file explorer, terminals, and browser bubbles in one swipeable workspace. One seat. One AI.",manifest:"/manifest.json",appleWebApp:{capable:!0,statusBarStyle:"default",title:"Cockpit"},icons:{icon:"/icons/icon-192x192.png",apple:"/icons/icon-192x192.png"}},m={themeColor:[{media:"(prefers-color-scheme: light)",color:"#f9f9fb"},{media:"(prefers-color-scheme: dark)",color:"#111113"}]};function n({children:a}){return(0,d.jsxs)("html",{lang:"en",suppressHydrationWarning:!0,className:"overflow-hidden",children:[(0,d.jsx)("head",{children:(0,d.jsx)("script",{src:"/boot.js"})}),(0,d.jsx)("body",{className:`${f().variable} ${h().variable} ${j().variable} antialiased overflow-hidden`,children:(0,d.jsx)(k.Providers,{children:a})})]})}},76552:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Providers:()=>j});var e=c(48249),f=c(29491),g=c(83768),h=c(7833),i=c(34102);function j({children:a}){return(0,e.jsx)(f.I18nProvider,{children:(0,e.jsx)(g.N,{children:(0,e.jsxs)(h.tE,{children:[a,(0,e.jsx)(i.B,{})]})})})}d()}catch(a){d(a)}})},76855:(a,b,c)=>{"use strict";c.d(b,{Sn:()=>i,Xm:()=>j,po:()=>k,JL:()=>l});var d=c(67484);c(28797);var e=c(79606),f=c(33281),g=c(71192);let h=(a,b)=>e.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error(`HTTP ${c.status}`);return await c.json()},catch:b=>new g.uV({message:`${a} failed`,cause:b})});function i(a){let[b,c]=(0,d.useState)(!1);return{goToDefinition:(0,d.useCallback)(async(b,d,e)=>{c(!0);let g=await f.t4.runPromiseExit(h("/api/lsp/definition",{cwd:a,filePath:b,line:d,column:e}));return(c(!1),"Success"===g._tag)?g.value.definitions??[]:(console.error("[useLSP] definition error:",g.cause),[])},[a]),loading:b}}function j(a){let[b,c]=(0,d.useState)(null),e=(0,d.useRef)(null),g=(0,d.useRef)(null),i=(0,d.useRef)(0),j=(0,d.useRef)(!1),k=(0,d.useRef)(null),l=(0,d.useRef)({x:0,y:0}),m=(0,d.useCallback)(a=>{k.current=a},[]),n=(0,d.useRef)(!1),o=(0,d.useRef)(null),p=(0,d.useCallback)(()=>{let a=k.current;a&&n.current&&(a.style.pointerEvents="none"),n.current=!1,o.current&&(k.current?.removeEventListener("mouseleave",o.current),o.current=null)},[]),q=(0,d.useCallback)(()=>{let a=k.current;if(!a||n.current)return;n.current=!0,j.current=!0,a.style.pointerEvents="auto";let b=()=>{j.current=!1,p(),i.current++,c(null)};o.current=b,a.addEventListener("mouseleave",b)},[p]),r=(0,d.useCallback)((b,d,j,k)=>{e.current&&clearTimeout(e.current),g.current&&clearTimeout(g.current);let l=++i.current;e.current=setTimeout(async()=>{let e=await f.t4.runPromiseExit(h("/api/lsp/hover",{cwd:a,filePath:b,line:d,column:j}));if(l!==i.current||"Success"!==e._tag)return;let g=e.value.hover;g&&g.displayString&&c({...g,x:k.x,y:k.y,filePath:b,line:d,column:j})},300)},[a]),s=(0,d.useCallback)(()=>{e.current&&clearTimeout(e.current),i.current++,g.current=setTimeout(function(){if(j.current)return;let a=k.current;if(a){let b=a.getBoundingClientRect(),{x:c,y:d}=l.current;if(c>=b.left&&c<=b.right&&d>=b.top&&d<=b.bottom)return void q()}c(null)},150)},[q]),t=(0,d.useCallback)(()=>{j.current=!0,g.current&&clearTimeout(g.current)},[]);return{hoverInfo:b,onTokenMouseEnter:r,onTokenMouseLeave:s,onCardMouseEnter:t,onCardMouseLeave:(0,d.useCallback)(()=>{j.current=!1,i.current++,c(null)},[]),clearHover:(0,d.useCallback)(()=>{e.current&&clearTimeout(e.current),g.current&&clearTimeout(g.current),j.current=!1,p(),i.current++,c(null)},[p]),setTooltipEl:m}}function k(a){let[b,c]=(0,d.useState)([]),[e,g]=(0,d.useState)(!1),[i,j]=(0,d.useState)(!1);return{references:b,loading:e,visible:i,findReferences:(0,d.useCallback)(async(b,d,e)=>{g(!0),j(!0);let i=await f.t4.runPromiseExit(h("/api/lsp/references",{cwd:a,filePath:b,line:d,column:e}));"Success"===i._tag?c(i.value.references??[]):(console.error("[useLSP] references error:",i.cause),c([])),g(!1)},[a]),closeReferences:(0,d.useCallback)(()=>{j(!1),c([])},[])}}function l(a,b){(0,d.useRef)(null)}},77016:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{b:()=>s});var e=c(48249),f=c(67484),g=c(44256),h=c(36295),i=c(7833),j=c(28602),k=c(44384),l=c(74493),m=a([h]);h=(m.then?(await m)():m)[0];let x=[{value:"=",label:"="},{value:"!=",label:"!="},{value:">",label:">"},{value:"<",label:"<"},{value:">=",label:">="},{value:"<=",label:"<="},{value:"LIKE",label:"LIKE"},{value:"NOT LIKE",label:"NOT LIKE"},{value:"IN",label:"IN"},{value:"IS NULL",label:"IS NULL"},{value:"IS NOT NULL",label:"IS NOT NULL"}];function n(a){if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`}function o(a){return`\`${a.replace(/`/g,"``")}\``}function p(a){try{let b=a.match(/\/\/[^/]+\/([^?]+)/);if(b)return b[1]}catch{}return""}function q(a){return null==a?"":"object"==typeof a?JSON.stringify(a):String(a)}function r({text:a}){let[b,c]=(0,f.useState)(!1),[d,h]=(0,f.useState)({x:0,y:0,maxW:600,maxH:300,above:!0}),i=(0,f.useRef)(null),j=(0,f.useRef)(null),k=(0,f.useRef)(!1),l=(0,g.F2)(),m=(0,f.useCallback)(()=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{k.current||c(!1)},80)},[]),n=(0,f.useCallback)(()=>{j.current&&clearTimeout(j.current),k.current=!1,j.current=setTimeout(()=>{let a=i.current;if(!a||a.scrollWidth<=a.clientWidth)return;let b=a.getBoundingClientRect(),d=l?.getBoundingClientRect(),e=d?.left??0,f=d?.top??0,g=d?.width??window.innerWidth,j=d?.height??window.innerHeight,k=b.left-e,m=b.top-f,n=b.bottom-f,o=Math.min(600,g-k-8),p=o<200?Math.max(8,g-600-8):k,q=o<200?Math.min(600,g-16):o,r=m-8,s=j-n-8,t=r>s&&r>80,u=t?r-4:s-4;h({x:p,y:t?m-4:n+4,maxW:q,maxH:Math.max(60,u),above:t}),c(!0)},350)},[l]),o=(0,f.useCallback)(()=>{m()},[m]),p=(0,f.useCallback)(()=>{k.current=!0,j.current&&clearTimeout(j.current)},[]),q=(0,f.useCallback)(()=>{k.current=!1,m()},[m]);return(0,e.jsxs)("span",{ref:i,className:"block truncate",onMouseEnter:n,onMouseLeave:o,children:[a,b&&(0,e.jsx)(g.ZL,{children:(0,e.jsx)("div",{className:"fixed z-[9999] overflow-y-auto px-2 py-1.5 text-xs font-mono bg-popover text-popover-foreground border border-border rounded shadow-lg whitespace-pre-wrap break-all select-text cursor-text",style:{left:d.x,top:d.y,maxWidth:d.maxW,maxHeight:d.maxH,transform:d.above?"translateY(-100%)":void 0},onMouseEnter:p,onMouseLeave:q,children:function(a){try{let b=JSON.parse(a);if("object"==typeof b&&null!==b)return JSON.stringify(b,null,2)}catch{}return a}(a)})})]})}function s({id:a,connectionString:b,displayName:c,selected:d,maximized:g,expandedHeight:m,bubbleContentHeight:u,onSelect:x,onClose:y,onToggleMaximize:z,timestamp:A,onTitleMouseDown:B}){let{t:C}=(0,k.Bd)(),{showToast:D}=(0,i.dj)(),[E,F]=(0,f.useState)("connecting"),[G,H]=(0,f.useState)(""),[I,J]=(0,f.useState)([]),[K,L]=(0,f.useState)(()=>p(b)),[M,N]=(0,f.useState)([]),[O,P]=(0,f.useState)(null),[Q,R]=(0,f.useState)("table"),[S,T]=(0,f.useState)("data"),[U,V]=(0,f.useState)([]),[W,X]=(0,f.useState)([]),[Y,Z]=(0,f.useState)([]),[$,_]=(0,f.useState)([]),[aa,ab]=(0,f.useState)(null),[ac,ad]=(0,f.useState)(0),[ae,af]=(0,f.useState)(!1),[ag,ah]=(0,f.useState)(0),[ai,aj]=(0,f.useState)(new Set),[ak,al]=(0,f.useState)(!1),[am,an]=(0,f.useState)(null),[ao,ap]=(0,f.useState)({}),[aq,ar]=(0,f.useState)(!1),[as,at]=(0,f.useState)({}),[au,av]=(0,f.useState)({}),[aw,ax]=(0,f.useState)(null),[ay,az]=(0,f.useState)(""),[aA,aB]=(0,f.useState)(null),[aC,aD]=(0,f.useState)(""),[aE,aF]=(0,f.useState)(!1),aG=(0,f.useRef)(null),aH=(0,f.useCallback)(async()=>{F("connecting"),H("");try{let c=await (0,l.GW)("/api/mysql/connect",{id:a,connectionString:b});J(c.schemas||[]);let d=p(b);c.schemas?.length>0&&d&&c.schemas.includes(d)?L(d):c.schemas?.length>0&&L(c.schemas[0]),F("connected")}catch(a){H(a instanceof Error?a.message:String(a)),F("error")}},[a,b]),aI=(0,f.useCallback)(async()=>{if("connected"===E)try{let c=await (0,l.Ey)("/api/mysql/schemas",{id:a,connectionString:b,schema:K});N(c.tables||[])}catch{}},[a,b,K,E]),aJ=(0,f.useCallback)(async(c,d,e,f)=>{af(!0);let g=e??au,h=void 0!==f?f:aw;try{let e=`${o(K)}.${o(c)}`,{where:f,params:i}=function(a){let b=[],c=[];for(let[d,e]of Object.entries(a)){if(!e.enabled)continue;let a=o(d);if("IS NULL"===e.op)b.push(`${a} IS NULL`);else if("IS NOT NULL"===e.op)b.push(`${a} IS NOT NULL`);else if("IN"===e.op){let d=e.value.split(",").map(a=>a.trim()).filter(Boolean);if(0===d.length)continue;let f=d.map(a=>(c.push(a),"?"));b.push(`${a} IN (${f.join(", ")})`)}else"LIKE"===e.op||e.op,b.push(`${a} ${e.op} ?`),c.push(e.value)}return{where:b.length>0?` WHERE ${b.join(" AND ")}`:"",params:c}}(g),j=h?` ORDER BY ${o(h.column)} ${h.dir}`:"",k=`SELECT * FROM ${e}${f}${j} LIMIT 50 OFFSET ${50*d}`,m=await (0,l.GW)("/api/mysql/query",{id:a,connectionString:b,sql:k,params:i});ab(m);let n=`SELECT count(*) AS cnt FROM ${e}${f}`,p=await (0,l.GW)("/api/mysql/query",{id:a,connectionString:b,sql:n,params:i});ah(p.rows?.[0]?.cnt??0)}catch{}af(!1)},[a,b,K,au,aw]),aK=(0,f.useCallback)(async c=>{P(c),ad(0),an(null),ar(!1),aj(new Set),al(!1),av({}),ax(null);try{let d=await (0,l.Ey)("/api/mysql/columns",{id:a,connectionString:b,schema:K,table:c});V(d.columns||[]),X(d.primaryKeys||[]),Z(d.foreignKeys||[]),_(d.indexes||[])}catch{}aJ(c,0,{},null)},[a,b,K,aJ]),aL=(0,f.useCallback)(async()=>{if(ay.trim()){aF(!0),aD(""),aB(null);try{let c=await (0,l.GW)("/api/mysql/query",{id:a,connectionString:b,sql:ay});aB(c)}catch(a){aD(a instanceof Error?a.message:String(a))}aF(!1)}},[a,b,ay]),aM=(0,f.useCallback)(async()=>{if(null===am||!aa||!O)return;let c=aa.rows[am],d=[],e=[];for(let a of U)void 0!==ao[a.name]&&ao[a.name]!==q(c[a.name]??"")&&(d.push(`${o(a.name)} = ?`),e.push(""===ao[a.name]&&a.nullable?null:ao[a.name]));if(0===d.length)return void an(null);let f=W.length>0?W:U.map(a=>a.name),g=[];for(let a of f)null===c[a]||void 0===c[a]?g.push(`${o(a)} IS NULL`):(g.push(`${o(a)} = ?`),e.push(c[a]));let h=`UPDATE ${o(K)}.${o(O)} SET ${d.join(", ")} WHERE ${g.join(" AND ")}`;try{await (0,l.GW)("/api/mysql/query",{id:a,connectionString:b,sql:h,params:e}),an(null),aJ(O,ac,au,aw)}catch(a){alert(`Update failed: ${a instanceof Error?a.message:String(a)}`)}},[am,aa,O,U,W,ao,a,b,K,aJ,ac,au,aw]),aN=(0,f.useCallback)(async()=>{if(!O)return;let c=[],d=[],e=[];for(let a of U)void 0!==as[a.name]&&""!==as[a.name]&&(c.push(o(a.name)),d.push(as[a.name]),e.push("?"));if(0===c.length)return;let f=`INSERT INTO ${o(K)}.${o(O)} (${c.join(", ")}) VALUES (${e.join(", ")})`;try{await (0,l.GW)("/api/mysql/query",{id:a,connectionString:b,sql:f,params:d}),ar(!1),at({}),aJ(O,ac,au,aw)}catch(a){alert(`Insert failed: ${a instanceof Error?a.message:String(a)}`)}},[O,U,as,a,b,K,aJ,ac,au,aw]),aO=(0,f.useCallback)(async()=>{if(0===ai.size||!aa||!O)return;let c=W.length>0?W:U.map(a=>a.name),d=0;for(let e of Array.from(ai).sort((a,b)=>b-a)){let f=aa.rows[e];if(!f)continue;let g=[],h=[];for(let a of c)null===f[a]||void 0===f[a]?g.push(`${o(a)} IS NULL`):(g.push(`${o(a)} = ?`),h.push(f[a]));let i=`DELETE FROM ${o(K)}.${o(O)} WHERE ${g.join(" AND ")} LIMIT 1`;try{await (0,l.GW)("/api/mysql/query",{id:a,connectionString:b,sql:i,params:h})}catch{d++}}aj(new Set),al(!1),aJ(O,ac,au,aw),d>0&&alert(C("mysql.deleteRowsFailed",{count:d}))},[ai,aa,O,W,U,a,b,K,aJ,ac,au,aw]),aP=(0,f.useCallback)(async c=>{if(!O)return;if(ai.size>0&&aa){let a,b=aa.fields.map(a=>a.name),d=Array.from(ai).sort((a,b)=>a-b).map(a=>aa.rows[a]).filter(Boolean);if("json"===c)a=JSON.stringify(d,null,2);else{let c=[b.join(",")];for(let a of d)c.push(b.map(b=>{let c=a[b];if(null==c)return"";let d="object"==typeof c?JSON.stringify(c):String(c);return d.includes(",")||d.includes('"')||d.includes("\n")?`"${d.replace(/"/g,'""')}"`:d}).join(","));a=c.join("\n")}navigator.clipboard.writeText(a);return}let d=`SELECT * FROM ${o(K)}.${o(O)}`;try{let e=await (0,l.HS)("/api/mysql/export",{id:a,connectionString:b,sql:d,format:c}),f=URL.createObjectURL(e),g=document.createElement("a");g.href=f,g.download=`${O}.${c}`,g.click(),URL.revokeObjectURL(f)}catch(a){alert(`Export failed: ${a instanceof Error?a.message:String(a)}`)}},[O,a,b,K,ai,aa]),aQ=(0,f.useCallback)(a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&(a.preventDefault(),aL())},[aL]),aR=g&&m?m-41:u??h.p,aS=Math.max(1,Math.ceil(ag/50)),aT=(0,f.useCallback)(a=>{O&&(ad(a),aJ(O,a,au,aw))},[O,aJ,au,aw]),aU=(0,f.useCallback)((a,b)=>{let c={...au};b?c[a]=b:delete c[a],av(c),ad(0),aj(new Set),O&&aJ(O,0,c,aw)},[au,aw,O,aJ]),aV=(0,f.useCallback)(()=>{av({}),ad(0),aj(new Set),O&&aJ(O,0,{},aw)},[aw,O,aJ]),aW=(0,f.useCallback)(a=>{ax(a),ad(0),aj(new Set),O&&aJ(O,0,au,a)},[au,O,aJ]);return(0,e.jsx)("div",{className:"flex flex-col items-start",children:(0,e.jsxs)("div",{className:`w-full bg-accent text-foreground
|
|
32
|
+
${e}`;break}}a(b,w.length>0?w:void 0),v(""),x([]),I.current&&(I.current.style.height="auto")}},[u,w,b,a,A,t]),Q=(0,f.useCallback)(a=>{v(a.name+" "),I.current?.focus()},[]),R=(0,f.useCallback)(a=>{if(!a.nativeEvent.isComposing){if(N&&M.length>0){if("ArrowDown"===a.key){a.preventDefault(),F(a=>(a+1)%M.length);return}if("ArrowUp"===a.key){a.preventDefault(),F(a=>(a-1+M.length)%M.length);return}if("Enter"===a.key){a.preventDefault(),Q(M[E]);return}if("Escape"===a.key){a.preventDefault(),H(!0);return}if("Tab"===a.key){a.preventDefault(),Q(M[E]);return}}"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),P())}},[N,M,E,Q,P]),S=(0,f.useCallback)(a=>{let b=a.clipboardData?.items;if(!b)return;let c=["image/png","image/jpeg","image/webp","image/gif"];for(let d of Array.from(b)){let b=c.find(a=>d.type===a);if(b){a.preventDefault();let c=d.getAsFile();if(!c)continue;if(c.size>5242880){alert(t("chat.imageSizeLimit",{size:(c.size/1024/1024).toFixed(2)}));continue}let e=new FileReader;e.onload=a=>{let c=a.target?.result;if(!c)return;let d=c.replace(/^data:image\/\w+;base64,/,""),e={id:`img-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,data:d,preview:c,media_type:b};x(a=>[...a,e])},e.readAsDataURL(c)}}},[t]),T=(0,f.useCallback)(a=>{x(b=>b.filter(b=>b.id!==a))},[]);return(0,e.jsxs)("div",{className:"border-t border-border bg-card relative",children:[(0,e.jsx)(i.k,{images:w,onRemove:T,disabled:b}),N&&M.length>0&&(0,e.jsx)("div",{ref:J,className:"absolute bottom-full left-0 right-0 mx-4 mb-2 max-h-64 overflow-y-auto bg-card border border-border rounded-lg shadow-lg",children:M.map((a,b)=>{let c=b>0?M[b-1]:null,d="skill"===a.source&&(!c||"skill"!==c.source),f="skill"!==a.source&&0===b;return(0,e.jsxs)("div",{children:[f&&(0,e.jsx)("div",{className:"px-4 py-1 text-[10px] uppercase tracking-wider text-muted-foreground bg-muted/40",children:"Commands"}),d&&(0,e.jsx)("div",{className:"px-4 py-1 text-[10px] uppercase tracking-wider text-muted-foreground bg-muted/40",children:"Skills"}),(0,e.jsxs)("div",{onClick:()=>Q(a),className:`px-4 py-2 cursor-pointer ${b===E?"bg-brand/10":"hover:bg-accent"}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)("span",{className:"font-mono text-sm font-medium text-foreground",children:a.name}),(0,e.jsx)("span",{className:"flex-1 text-sm text-muted-foreground truncate",children:a.description}),(0,e.jsx)("span",{className:`text-xs px-1.5 py-0.5 rounded ${(a=>{switch(a){case"builtin":return"bg-brand/15 text-brand dark:bg-brand/25 dark:text-teal-11";case"global":return"bg-green-9/15 text-green-11 dark:bg-green-9/25 dark:text-green-11";case"project":return"bg-amber-9/15 text-amber-11 dark:bg-amber-9/25 dark:text-amber-11";case"skill":return"bg-purple-9/15 text-purple-11 dark:bg-purple-9/25 dark:text-purple-11"}})(a.source)}`,children:(a=>{switch(a){case"builtin":return t("common.builtin");case"global":return t("common.global");case"project":return t("common.project");case"skill":return"Skill"}})(a.source)})]}),"skill"===a.source&&a.argumentHint&&(0,e.jsx)("div",{className:"font-mono text-xs text-muted-foreground mt-0.5 pl-0 truncate",children:a.argumentHint})]})]},a.name)})}),(0,e.jsxs)("div",{className:"flex gap-2 items-end p-4",children:[(0,e.jsx)("button",{onClick:async()=>{if(!c)return;let a=await l.t4.runPromiseExit((0,m.Iz)(c,["."]));"Success"===a._tag?((0,g.oR)(t("toast.stagedAllFiles"),"success"),window.dispatchEvent(new CustomEvent("git-status-changed"))):(console.error("Error staging files:",a.cause),(0,g.oR)(t("toast.stageFailed"),"error"))},className:"p-2 text-green-11 hover:text-green-10 hover:bg-green-9/10 active:bg-green-9/20 active:scale-95 rounded-lg transition-all",title:t("chat.stageAll"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}),o&&(0,e.jsx)("button",{onClick:o,className:"p-2 text-brand hover:text-teal-10 hover:bg-brand/10 active:bg-brand/20 active:scale-95 rounded-lg transition-all",title:t("chat.viewGitChanges"),children:(0,e.jsxs)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"6",cy:"6",r:"2",strokeWidth:2}),(0,e.jsx)("circle",{cx:"18",cy:"6",r:"2",strokeWidth:2}),(0,e.jsx)("circle",{cx:"6",cy:"18",r:"2",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 8v10M18 8v4c0 2-2 4-6 4"})]})}),p&&(0,e.jsx)("button",{onClick:p,className:"p-2 text-amber-11 hover:text-amber-10 hover:bg-amber-9/10 active:bg-amber-9/20 active:scale-95 rounded-lg transition-all",title:t("chat.viewAllComments"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})})}),q&&(0,e.jsx)("button",{onClick:q,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95 rounded-lg transition-all",title:t("chat.userMessages"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),r&&(0,e.jsx)("button",{onClick:r,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95 rounded-lg transition-all",title:t("chat.projectNotes"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),s&&(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("button",{onClick:()=>D(!C),className:`p-2 rounded-lg transition-all ${C?"text-brand bg-brand/10":"text-muted-foreground hover:text-foreground hover:bg-accent active:bg-muted active:scale-95"}`,title:t("chat.scheduledTasks"),children:(0,e.jsxs)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6l4 2"})]})}),C&&(0,e.jsx)(j.E,{onClose:()=>D(!1),onCreate:s})]}),(0,e.jsx)("textarea",{ref:I,value:u,onChange:a=>v(a.target.value),onKeyDown:R,onPaste:S,placeholder:b?t("chat.placeholderDisabled"):t("chat.placeholder"),rows:1,className:"flex-1 resize-none px-4 py-2 border border-border rounded-lg focus:outline-none focus:ring-2 focus:ring-ring bg-card text-foreground placeholder-slate-9"})]})]})});d()}catch(a){d(a)}})},62473:(a,b,c)=>{"use strict";c.d(b,{g:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({tokenUsage:a,rateLimitInfo:b}){let{t:c}=(0,f.Bd)(),[h,i]=(0,e.useState)(()=>Date.now()),j=b?.status==="rejected"?"text-red-500":b?.status==="allowed_warning"?"text-yellow-500":"text-muted-foreground",k=b?.status==="rejected"?c("chat.rateLimitRejected","Rate Limited"):b?.status==="allowed_warning"?c("chat.rateLimitWarning","Approaching Limit"):null,l=a=>{if(!a)return"";let b=(a<1e12?1e3*a:a)-h;if(b<=0)return"";let c=Math.ceil(b/6e4);if(c<60)return`${c}m`;let d=Math.floor(c/60),e=c%60;return e>0?`${d}h${e}m`:`${d}h`},m=a=>a?a.replace(/_/g," "):"";return(0,d.jsx)("div",{className:"px-4 py-1.5 border-t border-border bg-secondary",children:(0,d.jsxs)("div",{className:"flex items-center justify-end gap-4 text-xs text-muted-foreground",children:[b&&k&&(0,d.jsxs)("span",{className:`flex items-center gap-1 ${j}`,title:[b.rateLimitType&&`Type: ${m(b.rateLimitType)}`,null!=b.utilization&&`Usage: ${(100*b.utilization).toFixed(0)}%`,b.resetsAt&&`Resets in: ${l(b.resetsAt)}`,b.isUsingOverage&&"Using overage"].filter(Boolean).join(" \xb7 "),children:["rejected"===b.status?(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}):(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,d.jsxs)("span",{children:[(0,d.jsx)("strong",{children:k}),null!=b.utilization&&` ${(100*b.utilization).toFixed(0)}%`,b.resetsAt&&` \xb7 ${l(b.resetsAt)}`]})]}),b&&!k&&b.resetsAt&&(0,d.jsxs)("span",{className:"flex items-center gap-1.5",title:[b.rateLimitType&&m(b.rateLimitType),null!=b.utilization&&`Usage: ${(100*b.utilization).toFixed(0)}%`,`Resets in: ${l(b.resetsAt)}`].filter(Boolean).join(" \xb7 "),children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),null!=b.utilization?(0,d.jsxs)("span",{children:[(100*b.utilization).toFixed(0),"%"]}):(0,d.jsx)("span",{children:l(b.resetsAt)})]}),(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),(0,d.jsxs)("span",{children:[c("chat.context"),": ",(0,d.jsx)("strong",{className:"text-foreground",children:(a.inputTokens+a.cacheReadInputTokens+a.cacheCreationInputTokens).toLocaleString()})]})]}),(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),(0,d.jsxs)("span",{children:[c("chat.output"),": ",(0,d.jsx)("strong",{className:"text-foreground",children:a.outputTokens.toLocaleString()})]})]}),(a.cacheReadInputTokens>0||a.cacheCreationInputTokens>0)&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-brand",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"})}),(0,d.jsxs)("span",{children:["Cache: ",(a.cacheReadInputTokens/(a.inputTokens+a.cacheReadInputTokens+a.cacheCreationInputTokens)*100).toFixed(0),"%"]})]}),a.totalCostUsd>0&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-green-11",children:[(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,d.jsxs)("span",{children:["$",a.totalCostUsd.toFixed(4)]})]})]})})}},62751:(a,b,c)=>{"use strict";function d(){}function e(a){return()=>{}}c.d(b,{U:()=>e,k:()=>d})},63041:(a,b,c)=>{"use strict";c.d(b,{e:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({cwd:a,sessionId:b,onOpenProjectSessions:c,onOpenSessionBrowser:h,onOpenSettings:i}){let{t:j}=(0,f.Bd)(),[k,l]=(0,e.useState)(!1);return(0,d.jsx)("div",{className:"border-b border-border px-4 py-3 bg-card",children:(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("img",{src:"/icons/icon-72x72.png",alt:"Cockpit",className:"w-6 h-6"}),(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,d.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:"Cockpit"}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:"One seat. One AI. Everything under control."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[a&&(0,d.jsx)("span",{className:"text-sm text-foreground max-w-md truncate cursor-help",title:`CWD: ${a}`,children:a}),!a&&b&&(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Session: ",b.slice(0,8),"..."]}),a&&(0,d.jsx)("button",{onClick:c,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:j("sessions.projectSessions"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,d.jsx)("button",{onClick:h,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:j("sessions.browseAllSessions"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})})}),b&&(0,d.jsx)("button",{onClick:()=>{let a=`claude -r ${b}`;navigator.clipboard.writeText(a).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)})},className:`p-2 rounded-lg transition-colors ${k?"text-green-500 bg-green-500/10":"text-muted-foreground hover:text-foreground hover:bg-accent"}`,title:k?j("chat.copiedCommandTooltip"):j("chat.copyCommandTooltip",{sessionId:b}),children:k?(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}):(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"})})}),(0,d.jsx)("button",{onClick:i,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",title:j("settings.title"),children:(0,d.jsxs)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})})]})]})})}},63913:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(48249),e=c(3560),f=c(56696),g=c(74493),h=a([f]);f=(h.then?(await h)():h)[0],(0,e.Aq)({type:"database",idPrefix:"db",match(a){let b=a.trim().toLowerCase();return b.startsWith("postgresql://")||b.startsWith("postgres://")},parse(a){let b=a.trim(),c=b;try{let a=new URL(b),d=a.pathname.replace(/^\//,"")||"postgres";c=`${d}@${a.hostname}${a.port?":"+a.port:""}`}catch{}return{connectionString:b,displayName:c}},fromHistory:a=>({connectionString:a.connectionString,displayName:a.displayName||a.connectionString}),toHistory:a=>({connectionString:a.connectionString,displayName:a.displayName}),Component:function({item:a,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l}){return(0,d.jsx)(f.M,{id:a.id,connectionString:a.connectionString,displayName:a.displayName,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l})},async onClose(a){await (0,g.ax)("db",a.id)}}),b()}catch(a){b(a)}})},63963:(a,b,c)=>{"use strict";c.d(b,{AS:()=>w,HV:()=>t,If:()=>u,RS:()=>p,TN:()=>q,mO:()=>s,tr:()=>r});let d=null,e="",f=0,g=null,h=!1,i=new Map,j=null,k=null;function l(a){let b;try{b=JSON.parse(a.data)}catch{return}let c=b.type;if("ping"===c)return;if("running"===c){j&&(j(b.commands),j=null);return}let d=b.commandId;if(!d)return;let e=i.get(d);if(e){if("error"===c)e.onError(b.error);else{let{commandId:a,type:d,...f}=b;e.onData(c,f)}("exit"===c||"error"===c)&&i.delete(d)}}function m(a){d?.readyState===WebSocket.OPEN&&d.send(JSON.stringify(a))}function n(a){let b,c=(b="https:"===window.location.protocol?"wss:":"ws:",`${b}//${window.location.host}/ws/terminal?projectCwd=${encodeURIComponent(a)}`);e===c&&d||(w(),h=!1,e=c,function a(){if(h||!e)return;let b=new WebSocket(e);d=b,b.onopen=()=>{for(let a of(f=0,i.keys()))b.send(JSON.stringify({type:"attach",commandId:a}))},b.onmessage=l,b.onclose=()=>{if(d!==b||(d=null,h))return;g&&clearTimeout(g);let c=Math.min(1e3*Math.pow(1.5,f),1e4);f++,g=setTimeout(a,c)},b.onerror=()=>{}}())}function o(){return new Promise((a,b)=>{if(d?.readyState===WebSocket.OPEN)return void a();let c=setInterval(()=>{d?.readyState===WebSocket.OPEN&&(clearInterval(c),clearTimeout(e),a())},50),e=setTimeout(()=>{clearInterval(c),b(Error("WebSocket connection timeout"))},5e3)})}async function p(a){let{cwd:b,command:c,commandId:d,tabId:e,projectCwd:f,env:g,usePty:h,cols:j,rows:k,onData:l,onError:p}=a;n(f);try{await o()}catch{p("WebSocket connection failed");return}i.delete(d),i.set(d,{onData:l,onError:p}),m({type:"exec",commandId:d,command:c,cwd:b,tabId:e,env:g,...h?{usePty:!0}:{},...j?{cols:j,rows:k}:{}})}async function q(a){let{commandId:b,projectCwd:c,onData:d,onError:e}=a;n(c);try{await o()}catch{e("WebSocket connection failed");return}i.set(b,{onData:d,onError:e}),m({type:"attach",commandId:b})}function r(a,b){m({type:"stdin",commandId:a,data:b})}function s(a,b,c){m({type:"resize",commandId:a,cols:b,rows:c})}function t(a){m({type:"interrupt",pid:a})}function u(a){return k||(k=v(a))}async function v(a){try{n(a);try{await o()}catch{return[]}return await new Promise(a=>{j=b=>{a(b)},m({type:"running"}),setTimeout(()=>{j&&(j=null,a([]))},3e3)})}finally{k=null}}function w(){if(h=!0,g&&(clearTimeout(g),g=null),d){let a=d;d=null,a.close()}i.clear(),j&&(j([]),j=null),k=null,e="",f=0}},65395:(a,b,c)=>{"use strict";c.d(b,{useTabState:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call useTabState() from the server but useTabState is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/useTabState.ts","useTabState")},65484:(a,b,c)=>{"use strict";c.d(b,{Cq:()=>n,D0:()=>q,DZ:()=>i,H7:()=>o,It:()=>s,Kl:()=>w,M5:()=>h,Or:()=>k,Q1:()=>u,QW:()=>p,Wr:()=>j,Yn:()=>r,b2:()=>v,em:()=>t,zF:()=>m});var d=c(79606),e=c(71192);let f=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`);return await c.json()},catch:c=>new e.uV({message:`${b?.method??"GET"} ${a} failed`,cause:c})}),g=(a,b)=>f(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),h=()=>f("/api/settings"),i=a=>f("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),j=()=>f("/api/version"),k=()=>f("/api/extension/version"),l=a=>a?`/api/note?cwd=${encodeURIComponent(a)}`:"/api/note",m=a=>f(l(a)),n=(a,b)=>g(l(a),{content:b}),o=()=>f("/api/sessions/projects"),p=a=>f(`/api/sessions/projects/${encodeURIComponent(a)}`),q=a=>f(`/api/project-settings?cwd=${encodeURIComponent(a)}`),r=a=>g("/api/project-settings",a),s=()=>f("/api/pick-folder"),t=a=>g("/api/open-vscode",{cwd:a}),u=a=>g("/api/open-cursor",{cwd:a}),v=a=>f(`/api/git/worktree?cwd=${encodeURIComponent(a)}`),w=a=>g("/api/git/worktree",a)},65543:(a,b,c)=>{"use strict";c.d(b,{_:()=>e});let d=new Set(["function","class","method"]);function e(a){return d.has(a.kind)}},67045:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(48249);function e({error:a,reset:b}){return(0,d.jsx)("html",{children:(0,d.jsx)("body",{children:(0,d.jsxs)("div",{style:{padding:"2rem",fontFamily:"system-ui, sans-serif"},children:[(0,d.jsx)("h2",{children:"Something went wrong"}),(0,d.jsx)("p",{style:{color:"#666"},children:a.message}),(0,d.jsx)("button",{onClick:b,style:{marginTop:"1rem",padding:"0.5rem 1rem",cursor:"pointer",borderRadius:"0.375rem",border:"1px solid #ccc",background:"#fff"},children:"Try again"})]})})})}},67115:(a,b,c)=>{"use strict";c.d(b,{Q:()=>k});var d=c(48249),e=c(67484),f=c(44384),g=c(57031),h=c(88214),i=c(33281),j=c(41224);function k({isOpen:a,onClose:b,cwd:c,onSelectSession:l}){let{t:m}=(0,f.Bd)(),[n,o]=(0,e.useState)([]),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(null),[t,u]=(0,e.useState)(""),v=(0,e.useRef)(null);(0,e.useCallback)(async()=>{if(!c)return;q(!0),s(null);let a=c.replace(/\//g,"-"),b=await i.t4.runPromiseExit((0,j.QW)(a));"Success"===b._tag?o(b.value):s("Failed to load sessions"),q(!1)},[c]);let w=n.filter(a=>{if(!t)return!0;let b=t.toLowerCase();return a.title.toLowerCase().includes(b)||a.firstMessages.some(a=>a.toLowerCase().includes(b))||a.lastMessages.some(a=>a.toLowerCase().includes(b))});return a?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:b}),(0,d.jsxs)("div",{className:"relative w-full max-w-6xl h-[90vh] mx-4 bg-card rounded-lg shadow-xl flex flex-col overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("h2",{className:"text-sm font-medium text-foreground",children:m("sessions.sessionList")}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground truncate",title:c,children:c})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 ml-4",children:[(0,d.jsx)("input",{ref:v,type:"text",placeholder:m("sessions.searchSessions"),value:t,onChange:a=>u(a.target.value),className:"px-2 py-1 text-xs border border-border rounded bg-card text-foreground placeholder-slate-9 focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"}),(0,d.jsx)("button",{onClick:b,className:"p-1 text-slate-9 hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto p-4",children:[p&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsxs)("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,d.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,d.jsx)("span",{children:m("sessions.loadingSessions")})]})}),r&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsx)("div",{className:"text-xs text-red-11",children:r})}),!p&&!r&&0===w.length&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsx)("div",{className:"text-xs text-muted-foreground",children:m(t?"sessions.noMatchingSessions":"sessions.noSessionsYet")})}),!p&&!r&&w.length>0&&(0,d.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:w.map(a=>(0,d.jsxs)("div",{onClick:()=>{let d;return d=(a.path.split("/").pop()||"").replace(".jsonl",""),void(l?(l(d,a.title),b()):(0,g.F)(h.n.OpenProject,{cwd:c,sessionId:d}))},className:"p-3 bg-secondary rounded border border-border hover:border-brand hover:shadow-md cursor-pointer transition-all",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[a.engine&&"claude"!==a.engine&&(0,d.jsx)("span",{className:`shrink-0 px-1 py-0.5 text-[10px] leading-none font-medium rounded ${"claude2"===a.engine?"bg-orange-500/15 text-orange-11":"ollama"===a.engine?"bg-blue-500/15 text-blue-11":"codex"===a.engine?"bg-green-500/15 text-green-11":"kimi"===a.engine?"bg-purple-500/15 text-purple-11":"bg-muted text-muted-foreground"}`,children:a.engine}),(0,d.jsx)("h4",{className:"text-xs font-medium text-foreground truncate",title:a.title,children:a.title})]}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground mb-2",children:new Date(a.modifiedAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}),(0,d.jsxs)("div",{className:"space-y-0.5 text-xs",children:[a.firstMessages.map((a,b)=>(0,d.jsxs)("div",{className:"text-foreground truncate",title:a,children:[(0,d.jsx)("span",{className:"text-slate-9 mr-1",children:"•"}),a]},`first-${b}`)),a.lastMessages.length>0&&(0,d.jsx)("div",{className:"text-slate-9 text-center py-0.5",children:"\xb7\xb7\xb7"}),a.lastMessages.map((a,b)=>(0,d.jsxs)("div",{className:"text-foreground truncate",title:a,children:[(0,d.jsx)("span",{className:"text-slate-9 mr-1",children:"•"}),a]},`last-${b}`))]})]},a.path))})]})]})]}):null}},69424:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{$:()=>q});var e=c(48249),f=c(67484),g=c(44384),h=c(7833),i=c(44256),j=c(15273),k=c(46674),l=c(99941),m=c(44643),n=c(32026),o=c(11732);function p(a){let b=a.input?.questions||[],c=a.input?.answers||{},d={};if(a.result)try{let b=JSON.parse(a.result);b?.answers&&(d=b.answers)}catch{}return{questions:b,answers:{...c,...d}}}function q({toolCalls:a,onClose:b}){let{t:c}=(0,g.Bd)(),[d,r]=(0,f.useState)({}),[s,t]=(0,f.useState)({}),[u,v]=(0,f.useState)({}),[w,x]=(0,f.useState)({}),y=a.reduce((a,b)=>{let{questions:c}=p(b);return a+c.length},0),z=Object.values(w).filter(Boolean).length,A=(0,f.useCallback)((a,b)=>{r(c=>({...c,[a]:b})),t(b=>({...b,[a]:!1}))},[]),B=(0,f.useCallback)(a=>{t(b=>{let c=!b[a];if(c){let b=u[a]||"";b&&r(c=>({...c,[a]:b}))}return{...b,[a]:c}})},[u]),C=(0,f.useCallback)((a,b)=>{v(c=>({...c,[a]:b})),b&&r(c=>({...c,[a]:b}))},[]),D=(0,f.useCallback)(a=>{x(b=>({...b,[a]:!b[a]}))},[]),E=(0,f.useCallback)(()=>{let b=z>0,e=[];a.forEach((a,f)=>{let{questions:g}=p(a);g.forEach((a,g)=>{let h=`${f}-${g}`;if(b&&!w[h])return;let i=d[h];e.push(`Q: ${a.question}`),e.push(`A: ${i||c("askQuestion.notSelected")}`),e.push("")})}),navigator.clipboard.writeText(e.join("\n").trim()),(0,h.oR)(b?c("toast.copiedQA",{count:z}):c("toast.copiedAllQA"))},[a,d,w,z,c]),F=(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:b,children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-6xl h-[90vh] flex flex-col overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground",children:c("askQuestion.title")}),(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[c("askQuestion.nQuestions",{count:y}),z>0&&` \xb7 ${c("askQuestion.checkedN",{count:z})}`]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:E,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:z>0?c("askQuestion.copyChecked",{count:z}):c("askQuestion.copyAll"),children:(0,e.jsx)(j.A,{className:"w-4 h-4"})}),(0,e.jsx)("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)(k.A,{className:"w-5 h-5"})})]})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-6",children:a.map((b,f)=>{let{questions:g}=p(b);return g.map((b,h)=>{let i=`${f}-${h}`,j=d[i],k=s[i]||!1,p=w[i]||!1;return(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-start gap-2",children:[(0,e.jsx)("button",{onClick:()=>D(i),className:"mt-0.5 flex-shrink-0 p-0.5 rounded hover:bg-accent transition-colors",title:c("askQuestion.checkToCopy"),children:p?(0,e.jsx)(l.A,{className:"w-4 h-4 text-brand"}):(0,e.jsx)(m.A,{className:"w-4 h-4 text-muted-foreground"})}),b.header&&(0,e.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-brand/10 text-brand flex-shrink-0 mt-0.5",children:b.header}),(0,e.jsx)("span",{className:"text-sm font-medium text-foreground",children:b.question})]}),(0,e.jsxs)("div",{className:"space-y-1 ml-7",children:[b.options.map((a,b)=>{let c=j===a.label&&!k;return(0,e.jsxs)("button",{onClick:()=>A(i,a.label),className:`flex items-start gap-2 px-2.5 py-1.5 rounded-md transition-colors w-full text-left cursor-pointer hover:bg-accent/50 ${c?"bg-brand/10 hover:bg-brand/15":""}`,children:[(0,e.jsx)("div",{className:"mt-0.5 flex-shrink-0",children:c?(0,e.jsx)(n.A,{className:"w-3.5 h-3.5 text-brand"}):(0,e.jsx)("div",{className:"w-3.5 h-3.5 rounded-full border border-muted-foreground"})}),(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsx)("div",{className:`text-sm ${c?"text-foreground font-medium":"text-foreground"}`,children:a.label}),a.description&&(0,e.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:a.description})]})]},b)}),(0,e.jsxs)("button",{onClick:()=>B(i),className:`flex items-start gap-2 px-2.5 py-1.5 rounded-md transition-colors w-full text-left cursor-pointer hover:bg-accent/50 ${k?"bg-brand/10 hover:bg-brand/15":""}`,children:[(0,e.jsx)("div",{className:"mt-0.5 flex-shrink-0",children:k?(0,e.jsx)(n.A,{className:"w-3.5 h-3.5 text-brand"}):(0,e.jsx)("div",{className:"w-3.5 h-3.5 rounded-full border border-muted-foreground"})}),(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(o.A,{className:"w-3.5 h-3.5 text-muted-foreground"}),(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:c("askQuestion.custom")})]})]}),k&&(0,e.jsx)("div",{className:"ml-6 mt-1",children:(0,e.jsx)("input",{type:"text",autoFocus:!0,value:u[i]||"",onChange:a=>C(i,a.target.value),placeholder:c("askQuestion.customPlaceholder"),className:"w-full px-3 py-1.5 text-sm bg-background border border-border rounded-md focus:outline-none focus:ring-1 focus:ring-brand text-foreground placeholder:text-muted-foreground"})})]}),(f!==a.length-1||h!==g.length-1)&&(0,e.jsx)("div",{className:"border-b border-border/50 mt-3"})]},i)})})})]})});return(0,e.jsx)(i.ZL,{children:F})}d()}catch(a){d(a)}})},70151:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{g:()=>Q});var e=c(48249),f=c(67484),g=c(74429),h=c(44256),i=c(33281),j=c(87808),k=c(85655),l=c(21538),m=c(35208),n=c(7833),o=c(24724),p=c(20586),q=c(7122),r=c(55287),s=c(60591),t=c(9804),u=c(73887),v=c(94239),w=c(29939),x=c(23860),y=c(90018),z=c(57014),A=c(94308),B=c(53036),C=c(6662),D=c(20291),E=c(58904),F=c(61632),G=c(76855),H=c(4857),I=c(44384),J=c(18921),K=c(28797),L=c(23881),M=c(21672),N=c(21482),O=c(94192),P=a([E,F,p,o,l,y,r,z,m,u,v,N,M]);function Q({onClose:a,cwd:b,initialTab:c="tree",tabSwitchTrigger:d,initialSearchQuery:P,searchQueryTrigger:R}){let{t:S}=(0,I.Bd)(),{activeView:T}=(0,O.R8)(),[U,V]=(0,f.useState)(c),[W,X]=(0,f.useState)("code"),Y=(0,f.useRef)(null),Z=(0,f.useRef)(!1),[$,_]=(0,f.useState)(null),[aa,ab]=(0,f.useState)(null),[ac,ad]=(0,f.useState)(!1),ae=(0,f.useRef)(1),af=(0,f.useRef)(null),[ag,ah]=(0,f.useState)(null),ai=(0,f.useRef)(null),[aj,ak]=(0,f.useState)({isDirty:!1,isSaving:!1}),[al,am]=(0,f.useState)(!1),[an,ao]=(0,f.useState)(!1),[ap,aq]=(0,f.useState)(null),ar=(0,f.useRef)(null),as=(0,J.o)(ar),at=(0,f.useRef)(null),au=(0,J.o)(at),av=(0,G.Sn)(b),aw=(0,G.Xm)(b),ax=(0,G.po)(b),ay=(0,H.Q)(),az=(0,x.F)(),aA=(0,C.W)({cwd:b});(0,G.JL)(b,aA.selectedPath);let aB=(0,D.p)({cwd:b,onSearchComplete:()=>am(!0)}),aC=(0,E.e)({cwd:b,addToRecentFiles:aA.addToRecentFiles}),aD=(0,f.useMemo)(()=>{let a=new Set;if(aC.status){for(let b of aC.status.staged)a.add(b.path);for(let b of aC.status.unstaged)a.add(b.path)}return a},[aC.status]),aE=(0,f.useMemo)(()=>{let a=new Map;if(aC.status){for(let b of aC.status.staged)a.set(b.path,"staged");for(let b of aC.status.unstaged)a.set(b.path,"unstaged")}return a},[aC.status]),aF=(0,F.y)({cwd:b,addToRecentFiles:aA.addToRecentFiles}),aG=(0,f.useRef)(!1),aH=(0,f.useCallback)(a=>{aA.setFileContent(b=>b?.type==="text"?{...b,content:a}:b),aA.showEditor||(aG.current=!0,aA.setShowEditor(!0))},[aA]),aI=(0,f.useCallback)(a=>{aA.setShowEditor(!0)},[aA]),aJ=(0,f.useCallback)(async()=>{if(!aA.fileContent||"text"!==aA.fileContent.type||!aA.fileContent.content)return;let a=await i.t4.runPromiseExit((0,j.OJ)({cwd:b,path:aA.selectedPath,content:aA.fileContent.content}));try{if("Failure"===a._tag||!a.value.ok)throw Error("Failed to save file");let b=a.value.data?.mtime;b&&aA.setFileContent(a=>a?.type==="text"?{...a,mtime:b}:a),(0,n.oR)(S("toast.savedSuccess"),"success")}catch{(0,n.oR)(S("toast.saveFailed"),"error")}},[b,aA]),aK=(0,f.useCallback)(()=>{if(!aA.selectedPath)return;let a=ae.current,b=af.current;a>0&&aA.updateRecentFilePosition(aA.selectedPath,a,b?b.cursorLine+1:a,b?b.cursorCol+1:1)},[aA]),aL=(0,f.useCallback)(async(a,b)=>{let c=a!==aA.selectedPath;if(c&&aA.showEditor){if(aj.isDirty&&(!await (0,n.lJ)(S("fileBrowser.saveBeforeSwitch"),{confirmText:S("fileBrowser.saveAndSwitch"),cancelText:S("common.cancel")})||(await ai.current?.save(),ai.current?.isDirty)))return;aA.setShowEditor(!1)}c&&aK(),aA.handleSelectFile(a,b)},[aA,aK,aj.isDirty,S]),aM=(0,f.useMemo)(()=>{let a=aB.contentSearchResults;if(0===a.length)return{files:[],expandDirs:new Set,matchMap:new Map};let b=new Map,c=[];for(let d of a)b.set(d.path,d),c.push(d.path);let d=(0,t.v3)(c),e=new Set((0,t.tW)(d));return{files:d,expandDirs:e,matchMap:b}},[aB.contentSearchResults]),[aN,aO]=(0,f.useState)(new Set),aP=(0,f.useCallback)(a=>{aO(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),aQ=(0,f.useCallback)(a=>{if(a.isDirectory)return null;let b=aM.matchMap.get(a.path);return b?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:b.matches.length}):null},[aM.matchMap]),aR=al&&aB.contentSearchResults.length>0,aS=!!aA.selectedPath&&null!==(0,K.c)(aA.selectedPath),aT=(0,f.useCallback)(async(a,c)=>{if(!aA.selectedPath||!aS)return;let d=await av.goToDefinition(aA.selectedPath,a,c);if(0===d.length)return;let e=d[0],f=b.endsWith("/")?b:b+"/",g=e.file.startsWith(f)?e.file.slice(f.length):e.file;ay.push({filePath:aA.selectedPath,lineNumber:ae.current}),g===aA.selectedPath?aA.setTargetLineNumber(e.line):aL(g,e.line)},[aA,b,aS,av,ay]),aU=(0,f.useCallback)((a,b,c)=>{aA.selectedPath&&aS&&aw.onTokenMouseEnter(aA.selectedPath,a,b,c)},[aA.selectedPath,aS,aw]),aV=(0,f.useCallback)(a=>{let c=b.endsWith("/")?b:b+"/",d=a.file.startsWith(c)?a.file.slice(c.length):a.file;aA.selectedPath&&ay.push({filePath:aA.selectedPath,lineNumber:ae.current}),d===aA.selectedPath?aA.setTargetLineNumber(a.line):aL(d,a.line)},[aA,b,ay]),aW=(0,f.useMemo)(()=>{if(!aC.status)return null;let a=new Map,b=a=>{switch(a){case"modified":default:return"M";case"added":return"A";case"deleted":return"D";case"renamed":return"R";case"untracked":return"?"}};for(let c of aC.status.staged)a.set(c.path,b(c.status));for(let c of aC.status.unstaged)a.set(c.path,b(c.status));return a},[aC.status]),aX=(0,f.useCallback)(a=>{V(a),aA.setBlameSelectedCommit(null),"history"===a&&aF.selectedBranch&&aF.loadCommits(aF.selectedBranch)},[aA,aF.selectedBranch,aF.loadCommits]);(0,f.useCallback)(()=>{if(!aA.selectedPath)return;let a={filePath:aA.selectedPath,lineNumber:ae.current},b=ay.goBack(a);b&&(b.filePath===aA.selectedPath?aA.setTargetLineNumber(b.lineNumber):aL(b.filePath,b.lineNumber))},[aA,ay]),(0,f.useCallback)(()=>{if(!aA.selectedPath)return;let a={filePath:aA.selectedPath,lineNumber:ae.current},b=ay.goForward(a);b&&(b.filePath===aA.selectedPath?aA.setTargetLineNumber(b.lineNumber):aL(b.filePath,b.lineNumber))},[aA,ay]);let aY=(0,f.useCallback)(async a=>{let c=a.split("/").pop()||a,d=await i.t4.runPromiseExit((0,j.__)({cwd:b,paths:[a],op:"copy"}));"Success"===d._tag?(0,n.oR)(S("toast.copiedName",{name:c}),"success"):(0,n.oR)(S("toast.copyFailed"),"error")},[b,S]),aZ=(0,f.useCallback)(async a=>{let c=await i.t4.runPromiseExit((0,j.dt)());if("Success"!==c._tag||!c.value.path)return void(0,n.oR)(S("toast.noFileToPaste"),"info");let d=c.value.path,e=await i.t4.runPromiseExit((0,j.Nn)({cwd:b,targetDir:a,sourceAbsPath:d}));if("Success"===e._tag)(0,n.oR)(S("toast.pastedFile",{name:e.value.newName}),"success"),aA.loadDirectory(a),aA.loadFileIndex();else{let a="Fail"===e.cause._tag?e.cause.error:null,b=a?.cause,c=b instanceof Error?b.message:S("toast.pasteFailed");(0,n.oR)(c,"error")}},[b,aA,S]);(0,f.useRef)(0),(0,f.useRef)(az),(0,f.useRef)(U);let a$=(0,f.useRef)(aF.selectedBranch);a$.current=aF.selectedBranch;let a_=(0,f.useRef)(aA.selectedPath);a_.current=aA.selectedPath;let a0=(0,f.useRef)(aA.fileContent?.type);a0.current=aA.fileContent?.type;let a1=(0,f.useCallback)(async a=>{try{let{data:c}=a;if(!c)return;let d=c.some(a=>"git"===a.type),e=c.some(a=>"file"===a.type),f=[];if((e||d)&&(f.push(i.t4.runPromise((0,j.mP)(b)).then(a=>{a.error||aA.setFiles(b=>(0,t.HR)(a.files??[],b))}).catch(()=>{})),f.push(i.t4.runPromise((0,j.DZ)(b)).then(a=>{a.paths&&aA.setFileIndex(a.paths)}).catch(()=>{})),f.push(i.t4.runPromise((0,j.r9)(b)).then(a=>{aA.setRecentFiles(a.files??[])}).catch(()=>{}))),d||e){f.push(i.t4.runPromise((0,k.lv)(b)).then(a=>{aC.setStatus(a);let b=(0,p.Do)(a.staged),c=(0,p.Do)(a.unstaged);aC.setStagedTree(b),aC.setUnstagedTree(c)}).catch(()=>{})),aC.refreshDiff(),d&&aF.loadBranches();let a=a$.current;a&&f.push(i.t4.runPromise((0,k.Bj)(b,a,t.B_)).then(a=>{let b=a.commits??[];aF.setCommits(b),aF.setHasMoreCommits(b.length>=t.B_)}).catch(()=>{}))}let g=a_.current,h=a0.current;g&&"text"===h&&f.push(i.t4.runPromise((0,j.K9)(b,g)).then(a=>{let b=a.ok?a.data:null;b&&"string"==typeof b.content&&aA.setFileContent({type:"text",content:b.content,size:b.size,mtime:b.mtimeMs,...b.isSymlink?{isSymlink:!0,symlinkTarget:b.symlinkTarget}:{}})}).catch(()=>{})),await Promise.all(f)}catch(a){console.error("File watch handler error:",a)}},[b]);(0,w.h)({url:`/ws/watch?cwd=${encodeURIComponent(b)}`,onMessage:a1,enabled:az});let a2=(0,f.useCallback)(a=>{let b=a.split("/");if(b.length>1){let a=[];for(let c=1;c<b.length;c++)a.push(b.slice(0,c).join("/"));aA.setExpandedPaths(b=>{let c=new Set(b);for(let b of a)c.add(b);return aA.saveExpandedPaths(c),c})}aA.setSelectedPath(a),aA.setShouldScrollToSelected(!0),V("tree")},[aA]);return(0,e.jsxs)(q.SU,{container:$,children:[(0,e.jsxs)("div",{ref:Y,className:"bg-card w-full h-full flex flex-col relative",children:[(0,e.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,e.jsxs)("div",{className:"w-80 flex-shrink-0 border-r border-border flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex border-b border-border",children:[(0,e.jsx)("button",{onClick:()=>aX("tree"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"tree"===U?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:S("fileBrowser.directoryTree")}),(0,e.jsx)("button",{onClick:()=>aX("search"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"search"===U?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:S("fileBrowser.searchTab")}),(0,e.jsx)("button",{onClick:()=>aX("recent"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"recent"===U?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:S("fileBrowser.recentTab")}),(0,e.jsx)("button",{onClick:()=>aX("status"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"status"===U?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:S("fileBrowser.changesTab")}),(0,e.jsx)("button",{onClick:()=>aX("history"),className:`flex-1 px-2 py-2 text-sm font-medium transition-colors ${"history"===U?"text-brand border-b-2 border-brand":"text-muted-foreground hover:text-foreground dark:hover:text-foreground"}`,children:S("fileBrowser.historyTab")})]}),"tree"===U&&(0,e.jsxs)("div",{className:"p-2 border-b border-border flex items-center gap-2",children:[(0,e.jsxs)("div",{className:"flex-1 relative",children:[(0,e.jsx)("input",{ref:aA.searchInputRef,type:"text",value:aA.searchQuery,onChange:a=>aA.setSearchQuery(a.target.value),placeholder:S("fileBrowser.searchFiles"),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded bg-card text-foreground placeholder-slate-9 focus:outline-none focus:ring-2 focus:ring-ring"}),aA.searchQuery&&(0,e.jsx)("button",{onClick:()=>aA.setSearchQuery(""),className:"absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 text-slate-9 hover:text-foreground rounded-sm transition-colors",title:S("fileBrowser.clear"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("button",{onClick:()=>aA.setSearchDirExact(a=>!a),className:`px-1 py-0.5 rounded transition-colors text-xs font-mono font-bold border ${aA.searchExactMatch?"border-brand text-brand bg-brand/10":"border-transparent text-muted-foreground hover:text-foreground hover:bg-accent"}`,title:aA.searchExactMatch?S("fileBrowser.exactMatchOn"):S("fileBrowser.exactMatchOff"),children:"ab"}),(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:()=>aA.loadFiles(),className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:S("fileBrowser.refreshTree"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),(0,e.jsx)("button",{onClick:()=>aA.searchTreeExpandedPaths?aA.setSearchTreeExpandedPaths(new Set):aA.setExpandedPaths(new Set),className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:S("fileBrowser.collapseAll"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})})]})]}),"search"===U&&(0,e.jsxs)("div",{className:"p-2 border-b border-border space-y-2",children:[(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsxs)("div",{className:"flex-1 relative",children:[(0,e.jsx)("input",{ref:aB.contentSearchInputRef,type:"text",value:aB.contentSearchQuery,onChange:a=>aB.setContentSearchQuery(a.target.value),onKeyDown:a=>{"Enter"===a.key&&aB.performContentSearch(aB.contentSearchQuery)},placeholder:S("fileBrowser.searchFileContent"),className:"w-full px-3 py-1.5 pr-7 text-sm border border-border rounded bg-card text-foreground placeholder-slate-9 focus:outline-none focus:ring-2 focus:ring-ring"}),aB.contentSearchQuery&&(0,e.jsx)("button",{onClick:()=>aB.setContentSearchQuery(""),className:"absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 text-slate-9 hover:text-foreground rounded-sm transition-colors",title:S("fileBrowser.clear"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("button",{onClick:()=>aB.performContentSearch(aB.contentSearchQuery),disabled:aB.isSearching||!aB.contentSearchQuery.trim(),className:"px-3 py-1.5 text-sm bg-brand text-white rounded hover:bg-brand/90 disabled:opacity-50 disabled:cursor-not-allowed",children:aB.isSearching?"...":S("common.search")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-2 text-xs",children:[(0,e.jsxs)("label",{className:"flex items-center gap-1 cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:aB.searchOptions.caseSensitive,onChange:a=>aB.setSearchOptions(b=>({...b,caseSensitive:a.target.checked})),className:"w-3 h-3"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:S("fileBrowser.caseSensitive")})]}),(0,e.jsxs)("label",{className:"flex items-center gap-1 cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:aB.searchOptions.wholeWord,onChange:a=>aB.setSearchOptions(b=>({...b,wholeWord:a.target.checked})),className:"w-3 h-3"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:S("fileBrowser.wholeWord")})]}),(0,e.jsxs)("label",{className:"flex items-center gap-1 cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:aB.searchOptions.regex,onChange:a=>aB.setSearchOptions(b=>({...b,regex:a.target.checked})),className:"w-3 h-3"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:S("fileBrowser.regex")})]}),(0,e.jsx)("input",{type:"text",value:aB.searchOptions.fileType,onChange:a=>aB.setSearchOptions(b=>({...b,fileType:a.target.value})),placeholder:S("fileBrowser.fileTypes"),className:"w-24 px-2 py-0.5 text-xs border border-border rounded bg-card text-foreground placeholder-slate-9"})]})]}),"history"===U&&(0,e.jsx)("div",{className:"p-3 border-b border-border",children:aF.compareMode?(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsxs)("div",{className:"flex-1 min-w-0 px-3 py-1.5 text-sm border border-border rounded bg-secondary text-foreground flex items-center gap-2",children:[(0,e.jsx)("svg",{className:"w-4 h-4 text-muted-foreground flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),(0,e.jsx)("span",{className:"truncate",children:aF.branches?.current||"HEAD"}),(0,e.jsx)("span",{className:"text-xs text-green-11 flex-shrink-0",children:"HEAD"})]}),(0,e.jsx)("button",{onClick:()=>aF.toggleCompareMode(!1),className:"flex-shrink-0 px-2.5 py-1.5 text-xs font-medium rounded-lg transition-colors bg-brand text-white",title:S("fileBrowser.compareModeOff"),children:S("fileBrowser.compareMode")})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0 pl-1",children:"vs"}),(0,e.jsx)("div",{className:"flex-1 min-w-0",children:(0,e.jsx)(A.e,{branches:aF.branches,selectedBranch:aF.compareBaseBranch,onSelect:a=>{aF.setCompareBaseBranch(a),aF.loadCompareFiles(a)},isLoading:aF.isLoadingBranches,pinnedBranches:["origin/main",...aF.upstreamBranch&&"origin/main"!==aF.upstreamBranch?[aF.upstreamBranch]:[]]})})]})]}):(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("div",{className:"flex-1 min-w-0",children:(0,e.jsx)(A.e,{branches:aF.branches,selectedBranch:aF.selectedBranch,onSelect:a=>{aF.setSelectedBranch(a)},isLoading:aF.isLoadingBranches,pinnedBranches:["origin/main",...aF.upstreamBranch&&"origin/main"!==aF.upstreamBranch?[aF.upstreamBranch]:[]]})}),(0,e.jsx)("button",{onClick:()=>aF.toggleCompareMode(!0),className:"flex-shrink-0 px-2.5 py-1.5 text-xs font-medium rounded-lg transition-colors text-muted-foreground hover:text-foreground hover:bg-accent border border-border",title:S("fileBrowser.compareModeOn"),children:S("fileBrowser.compareMode")})]})}),(0,e.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col",children:[(0,e.jsxs)("div",{className:`flex-1 flex flex-col min-h-0 ${"tree"===U?"":"hidden"}`,children:[aA.creatingItem&&(0,e.jsxs)("div",{className:"px-2 py-1.5 border-b border-border bg-secondary flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:aA.creatingItem.parentPath?S("fileBrowser.createFileIn",{path:aA.creatingItem.parentPath}):S("fileBrowser.createFile")}),(0,e.jsx)("input",{type:"text",autoFocus:!0,placeholder:S("fileBrowser.fileName"),className:"flex-1 px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring",onCompositionStart:()=>{Z.current=!0},onCompositionEnd:()=>{Z.current=!1},onKeyDown:async a=>{if("Enter"===a.key){if(Z.current)return;let c=a.target.value.trim();if(!c)return;let d=aA.creatingItem.parentPath,e=d?`${d}/${c}`:c,f=await i.t4.runPromiseExit((0,j.OJ)({cwd:b,path:e,content:""}));if("Success"===f._tag&&f.value.ok)(0,n.oR)(S("toast.createdFile",{name:c}),"success"),aA.setCreatingItem(null),aA.loadDirectory(d),aA.loadFileIndex(),d&&aA.setExpandedPaths(a=>new Set([...a,d])),aL(e);else if("Success"===f._tag){let a=f.value.data?.error;(0,n.oR)(a||S("toast.createFailed"),"error")}else(0,n.oR)(S("toast.createFailed"),"error")}else"Escape"===a.key&&aA.setCreatingItem(null)},onBlur:()=>aA.setCreatingItem(null)})]}),aA.isLoadingFiles?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:S("common.loading")}):aA.fileError?(0,e.jsx)("div",{className:"p-4 text-center text-red-11 text-sm",children:aA.fileError}):(0,e.jsx)(o.h,{files:aA.files,selectedPath:aA.selectedPath,expandedPaths:aA.effectiveExpandedPaths,matchedPaths:aA.matchedPaths,gitStatusMap:aW,loadingDirs:aA.loadingDirs,onSelect:a=>{aA.setShouldScrollToSelected(!1),aL(a)},onToggle:aA.handleToggle,cwd:b,shouldScrollToSelected:aA.shouldScrollToSelected,onScrolledToSelected:()=>aA.setShouldScrollToSelected(!1),onCreateFile:a=>aA.setCreatingItem({type:"file",parentPath:a}),onDelete:(a,b,c)=>ab({path:a,isDirectory:b,name:c}),onRefresh:()=>aA.loadFiles(),onCopyFile:aY,onPaste:aZ})]}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"search"===U?"":"hidden"}`,children:aB.isSearching?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):aB.searchError?(0,e.jsx)("div",{className:"p-4 text-center text-red-11 text-sm",children:aB.searchError}):0===aB.contentSearchResults.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:aB.contentSearchQuery?S("fileBrowser.noContentSearchResults"):S("fileBrowser.enterKeywordToSearch")}):(0,e.jsxs)("div",{className:"flex-1 overflow-y-auto flex flex-col min-h-0",children:[aB.searchStats&&(0,e.jsxs)("div",{className:"px-3 py-1.5 text-xs text-muted-foreground bg-secondary border-b border-border flex-shrink-0",children:[S("fileBrowser.nFilesNMatches",{files:aB.searchStats.totalFiles,matches:aB.searchStats.totalMatches}),aB.searchStats.truncated&&(0,e.jsxs)("span",{className:"text-amber-11 ml-1",children:["(",S("fileBrowser.resultsTruncated"),")"]})]}),(0,e.jsx)(o.h,{files:aM.files,selectedPath:aA.selectedPath,expandedPaths:aN,onSelect:a=>{let b=aM.matchMap.get(a);aL(a,b?.matches[0]?.lineNumber),al||am(!0)},onToggle:aP,cwd:b,renderActions:aQ,className:"flex-1 overflow-y-auto py-1 min-w-max"})]})}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"recent"===U?"":"hidden"}`,children:0===aA.recentFiles.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:S("fileBrowser.noRecentFiles")}):(0,e.jsx)(o.h,{files:aA.recentFilesTree,selectedPath:aA.selectedPath,expandedPaths:aA.recentTreeDirPaths,onSelect:aL,onToggle:t.tE,cwd:b})}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"status"===U?"":"hidden"}`,children:aC.statusLoading?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):aC.statusError?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center p-4",children:(0,e.jsx)("span",{className:"text-red-11 text-sm",children:aC.statusError})}):(0,e.jsxs)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:[(0,e.jsxs)("div",{className:"border-b border-border",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-secondary",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:S("fileBrowser.stagingArea",{count:aC.status?.staged.length||0})}),(0,e.jsx)("button",{onClick:()=>aC.fetchStatus(),className:"p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:S("fileBrowser.refreshChanges"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),(aC.status?.staged.length||0)>0&&(0,e.jsx)("button",{onClick:aC.handleUnstageAll,className:"text-sm text-amber-11 hover:text-amber-10 hover:underline",children:S("fileBrowser.unstageAll")})]}),(0,e.jsx)(p.VO,{files:aC.stagedTree,selectedPath:aC.statusSelectedFile?.type==="staged"?aC.statusSelectedFile.file.path:null,expandedPaths:aC.stagedExpandedPaths,onSelect:a=>a.file&&aC.handleStatusFileSelect(a.file,"staged"),onToggle:aC.handleStagedToggle,cwd:b,emptyMessage:S("fileBrowser.noStagedFiles"),className:"py-1",renderActions:a=>{if(a.isDirectory){let b=(0,p.wI)(a);return 0===b.length?null:(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),aC.handleUnstageFiles(b.map(a=>a.path))},className:"opacity-0 group-hover:opacity-100 p-0.5 text-amber-11 hover:text-amber-10 hover:bg-amber-9/10 dark:hover:bg-amber-9/20 rounded transition-all",title:S("fileBrowser.unstageNFiles",{count:b.length}),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})})}return(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),aC.handleUnstage(a.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-amber-11 hover:text-amber-10 hover:bg-amber-9/10 dark:hover:bg-amber-9/20 rounded transition-all",title:S("fileBrowser.unstageFile"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 12H4"})})})}})]}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-secondary",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:S("fileBrowser.workspace",{count:aC.status?.unstaged.length||0})}),(aC.status?.unstaged.length||0)>0&&(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:aC.handleDiscardAll,className:"text-sm text-red-11 hover:text-red-10 hover:underline",children:S("fileBrowser.discardAll")}),(0,e.jsx)("button",{onClick:aC.handleStageAll,className:"text-sm text-green-11 hover:text-green-10 hover:underline",children:S("fileBrowser.stageAll")})]})]}),(0,e.jsx)(p.VO,{files:aC.unstagedTree,selectedPath:aC.statusSelectedFile?.type==="unstaged"?aC.statusSelectedFile.file.path:null,expandedPaths:aC.unstagedExpandedPaths,onSelect:a=>a.file&&aC.handleStatusFileSelect(a.file,"unstaged"),onToggle:aC.handleUnstagedToggle,cwd:b,emptyMessage:S("fileBrowser.noUnstagedChanges"),className:"py-1",renderActions:a=>{if(a.isDirectory){let b=(0,p.wI)(a);if(0===b.length)return null;let c=b.map(a=>a.file).filter(Boolean);return(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),aC.handleDiscardFiles(c)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-red-11 hover:text-red-10 hover:bg-red-9/10 dark:hover:bg-red-9/20 rounded transition-all",title:S("fileBrowser.discardNFiles",{count:b.length}),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),aC.handleStageFiles(b.map(a=>a.path))},className:"opacity-0 group-hover:opacity-100 p-0.5 text-green-11 hover:text-green-10 hover:bg-green-9/10 dark:hover:bg-green-9/20 rounded transition-all",title:S("fileBrowser.stageNFiles",{count:b.length}),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})})]})}return a.file?(0,e.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),aC.handleDiscardFile(a.file)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-red-11 hover:text-red-10 hover:bg-red-9/10 dark:hover:bg-red-9/20 rounded transition-all",title:S("fileBrowser.discardChanges"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6"})})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),aC.handleStage(a.path)},className:"opacity-0 group-hover:opacity-100 p-0.5 text-green-11 hover:text-green-10 hover:bg-green-9/10 dark:hover:bg-green-9/20 rounded transition-all",title:S("fileBrowser.stageFile"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})})]}):null}})]})]})}),(0,e.jsx)("div",{className:`flex-1 flex flex-col min-h-0 ${"history"===U?"":"hidden"}`,children:aF.historyError?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("svg",{className:"w-16 h-16 mx-auto text-slate-7 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),(0,e.jsx)("p",{className:"text-muted-foreground",children:aF.historyError})]})}):aF.compareMode?(0,e.jsx)("div",{className:"flex-1 overflow-y-auto overflow-x-hidden",children:aF.isLoadingCompareFiles?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:S("fileBrowser.loadingDiff")}):0===aF.compareFiles.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:S("fileBrowser.noDiffFiles")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"px-3 py-2 border-b border-border",children:(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:S("fileBrowser.nFilesChanged",{count:aF.compareFiles.length,branch:aF.compareBaseBranch})})}),(0,e.jsx)(p.VO,{files:aF.compareFileTree,expandedPaths:aF.compareExpandedPaths,onToggle:aF.handleCompareToggle,selectedPath:aF.compareSelectedFile?.path||null,onSelect:a=>{a.file&&aF.handleSelectCompareFile(a.file)},cwd:b,showChanges:!0})]})}):(0,e.jsx)("div",{ref:aF.commitListRef,className:"flex-1 overflow-y-auto",onScroll:aF.handleCommitListScroll,children:aF.isLoadingCommits?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:S("fileBrowser.loadingCommits")}):0===aF.commits.length?(0,e.jsx)("div",{className:"p-4 text-center text-muted-foreground text-sm",children:S("fileBrowser.noCommits")}):(0,e.jsxs)(e.Fragment,{children:[aF.commits.map(a=>(0,e.jsxs)("div",{onClick:()=>aF.handleSelectCommit(a),className:`px-3 py-2 border-b border-border cursor-pointer hover:bg-accent ${aF.selectedCommit?.hash===a.hash?"bg-brand/10":""}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"font-mono text-xs text-brand",children:a.shortHash}),(0,e.jsxs)("span",{className:"text-xs text-slate-9",title:a.date,children:[a.relativeDate," \xb7 ",(0,t.r6)(a.date)]})]}),(0,e.jsx)("div",{className:"text-sm text-foreground truncate mt-0.5","data-tooltip":a.subject,children:a.subject}),(0,e.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:a.author})]},a.hash)),aF.isLoadingMore&&(0,e.jsx)("div",{className:"p-3 text-center",children:(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"})}),!aF.hasMoreCommits&&aF.commits.length>0&&(0,e.jsx)("div",{className:"p-3 text-center text-xs text-slate-9",children:S("fileBrowser.allLoaded",{count:aF.commits.length})})]})})})]})]}),(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[("tree"===U||"search"===U||"recent"===U)&&(aA.blameSelectedCommit?(0,e.jsx)(l.n,{isOpen:!0,onClose:()=>aA.setBlameSelectedCommit(null),commit:aA.blameSelectedCommit,cwd:b,embedded:!0,initialFilePath:aA.selectedPath||void 0,onContentSearch:a=>{V("search"),aB.setContentSearchQuery(a),aB.performContentSearch(a)}}):"map"===W?(0,e.jsx)(y.O,{cwd:b,highlightedFilePath:aA.selectedPath,changedFiles:aD,onSwitchToCode:()=>X("code"),enableComments:!0,onContentSearch:a=>{V("search"),aB.setContentSearchQuery(a),aB.performContentSearch(a)},headerExtraLeft:({focalFile:a})=>a&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{onClick:c=>{c.stopPropagation(),navigator.clipboard.writeText(`${b}/${a}`),(0,n.oR)(S("common.copiedPath"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0",title:S("common.copyAbsPath"),children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),a2(a)},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0",title:S("fileBrowser.locateInTree"),children:(0,e.jsxs)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("circle",{cx:"12",cy:"12",r:"3",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeWidth:2,d:"M12 2v4m0 12v4M2 12h4m12 0h4"})]})})]})}):aA.selectedPath?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"px-4 py-2 bg-secondary border-b border-border flex-shrink-0 flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 min-w-0",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground truncate",children:aA.selectedPath}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(`${b}/${aA.selectedPath}`),(0,n.oR)(S("common.copiedPath"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0",title:S("common.copyAbsPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),a2(aA.selectedPath)},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0",title:S("fileBrowser.locateInTree"),children:(0,e.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,e.jsx)("circle",{cx:"12",cy:"12",r:"3",strokeWidth:2}),(0,e.jsx)("path",{strokeLinecap:"round",strokeWidth:2,d:"M12 2v4m0 12v4M2 12h4m12 0h4"})]})})]}),(0,e.jsx)("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:aA.showEditor?(0,e.jsxs)(e.Fragment,{children:[aj.isDirty&&(0,e.jsx)("span",{className:"text-xs text-amber-11",children:S("fileBrowser.unsaved")}),(0,e.jsx)("button",{onClick:()=>ai.current?.save(),disabled:!aj.isDirty||aj.isSaving,className:`px-1.5 py-0.5 text-xs rounded transition-colors ${aj.isDirty&&!aj.isSaving?"bg-brand text-white hover:bg-brand/90":"bg-secondary text-muted-foreground cursor-not-allowed"}`,children:aj.isSaving?(0,e.jsx)("span",{className:"inline-block w-3 h-3 border-2 border-current border-t-transparent rounded-full animate-spin"}):S("common.save")}),(0,e.jsx)("button",{onClick:()=>ai.current?.close(),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-accent",title:S("fileBrowser.closeEdit"),children:S("fileBrowser.closeBtn")})]}):(0,e.jsxs)(e.Fragment,{children:[aA.fileContent?.type==="text"&&aA.fileContent.content&&(0,e.jsx)("button",{onClick:()=>{navigator.clipboard.writeText(aA.fileContent.content),(0,n.oR)(S("toast.copiedFileContent"))},className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-accent",title:S("fileBrowser.copyFileContent"),children:S("common.copy")}),aA.selectedPath?.endsWith(".json")&&aA.fileContent?.type==="text"&&(0,e.jsx)("button",{onClick:()=>ao(a=>!a),className:`px-1.5 py-0.5 text-xs rounded transition-colors ${an?"bg-brand text-white":"text-muted-foreground hover:bg-accent"}`,title:S("fileBrowser.toggleJsonReadable"),children:S("common.readable")}),aA.fileContent?.type==="text"&&(0,s.e$)(aA.selectedPath)&&(0,e.jsx)("button",{onClick:()=>aA.setShowMarkdownPreview(!0),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-accent",title:S("fileBrowser.previewMarkdown"),children:S("common.preview")}),aA.fileContent?.type==="text"&&(0,e.jsx)("button",{onClick:aA.handleToggleBlame,disabled:aA.isLoadingBlame,className:`px-1.5 py-0.5 text-xs rounded transition-colors ${aA.showBlame?"bg-brand text-white":"text-muted-foreground hover:bg-accent"} disabled:opacity-50`,title:S("fileBrowser.viewBlame"),children:aA.isLoadingBlame?(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-current border-t-transparent rounded-full animate-spin"}):"Blame"}),aA.fileContent?.type==="text"&&(0,e.jsx)("button",{onClick:()=>X("map"),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-accent",title:S("blockViewer.viewerToggle.toBlock"),children:S("common.codeMap")}),aA.fileContent?.type==="text"&&(0,e.jsx)("button",{onClick:()=>aA.setShowEditor(!0),className:"px-1.5 py-0.5 text-xs rounded transition-colors text-muted-foreground hover:bg-accent",title:S("fileBrowser.editFile"),children:S("common.edit")})]})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden",children:aA.isLoadingContent?(0,e.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):aA.fileContent?"text"===aA.fileContent.type&&"string"==typeof aA.fileContent.content?aA.showBlame&&aA.blameError?(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("p",{className:"text-red-11",children:aA.blameError}),(0,e.jsx)("button",{onClick:()=>aA.setShowBlame(!1),className:"mt-2 text-brand hover:underline text-sm",children:S("fileBrowser.backToPreview")})]})}):aA.showBlame&&0===aA.blameLines.length&&aA.isLoadingBlame?(0,e.jsx)("div",{className:"h-full flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}):an&&aA.selectedPath?.endsWith(".json")?(0,e.jsxs)("div",{className:"h-full flex flex-col bg-[#0d1117]",children:[(0,e.jsx)(J._,{search:as}),(0,e.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4",children:(0,e.jsx)("pre",{ref:ar,className:"whitespace-pre-wrap break-words font-mono",style:{fontSize:"0.8125rem",lineHeight:"1.5"},children:(0,s.xb)(aA.fileContent.content)})})]}):(0,e.jsx)(r.Cv,{ref:ai,content:aA.fileContent.content,filePath:aA.selectedPath,cwd:b,enableComments:!0,scrollToLine:ag??aA.targetLineNumber,scrollToLineAlign:null!=ag?"start":aA.targetScrollAlign,onScrollToLineComplete:()=>{ah(null),aA.setTargetLineNumber(null)},highlightKeyword:"search"===U?aB.contentSearchQuery:null,visibleLineRef:ae,viStateRef:af,initialCursorLine:aA.initialCursorLine,initialCursorCol:aA.initialCursorCol,onInitialCursorSet:()=>{aA.setInitialCursorLine(null),aA.setInitialCursorCol(null)},onCmdClick:aS?aT:void 0,onTokenHover:aS?aU:void 0,onTokenHoverLeave:aS?aw.onTokenMouseLeave:void 0,onTokenHoverCancel:aS?aw.clearHover:void 0,blameLines:aA.showBlame&&aA.blameLines.length>0?aA.blameLines:void 0,inlineBlameLines:aA.blameLines.length>0?aA.blameLines:void 0,onSelectCommit:aA.setBlameSelectedCommit,editable:aA.showEditor,initialMtime:aA.fileContent.mtime,onEditorClose:a=>{aA.setShowEditor(!1),ah(a)},onSaved:()=>{let a=ae.current??1;aA.loadFileContent(aA.selectedPath),aA.setShowEditor(!1),ah(a)},onEditorStateChange:ak,viMode:!0,onContentMutate:aH,onEnterInsertMode:aI,onViSave:aJ,onContentSearch:a=>{V("search"),aB.setContentSearchQuery(a),aB.performContentSearch(a)}}):"image"===aA.fileContent.type&&aA.selectedPath?(0,e.jsx)(B.I,{cwd:b,path:aA.selectedPath,refreshKey:aA.fileContent.mtime,alt:aA.selectedPath}):(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("svg",{className:"w-16 h-16 mx-auto text-slate-7 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),(0,e.jsx)("p",{children:aA.fileContent.message||S("fileBrowser.cannotPreview")})]})}):(0,e.jsx)("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:S("fileBrowser.selectFileToPreview")})})]}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("svg",{className:"w-16 h-16 mx-auto text-slate-7 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),(0,e.jsx)("p",{children:S("fileBrowser.selectFileToPreview")})]})})),"status"===U&&(aC.statusSelectedFile&&aC.statusDiff?(0,e.jsx)(z.m,{cwd:b,selected:aC.statusSelectedFile,diff:aC.statusDiff,showMarkdownPreview:aC.showStatusDiffPreview,setShowMarkdownPreview:aC.setShowStatusDiffPreview,changedFiles:aD,fileGitStatusMap:aE,onContentSearch:a=>{V("search"),aB.setContentSearchQuery(a),aB.performContentSearch(a)},locateInTree:a2,jsonPreview:ap,setJsonPreview:aq,jsonPreviewSearch:au,jsonPreviewPreRef:at}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-slate-9",children:(0,e.jsx)("span",{children:S("fileBrowser.selectFileToViewDiff")})})),"history"===U&&!aF.historyError&&(aF.compareMode?aF.isLoadingCompareDiff?(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:S("fileBrowser.loadingDiffContent")}):aF.compareFileDiff?(0,e.jsx)(m.xZ,{oldContent:aF.compareFileDiff.oldContent,newContent:aF.compareFileDiff.newContent,filePath:aF.compareFileDiff.filePath,isNew:aF.compareFileDiff.isNew,isDeleted:aF.compareFileDiff.isDeleted,cwd:b,enableComments:!0,onPreview:!aF.compareFileDiff.isDeleted&&aF.compareFileDiff.filePath.endsWith(".json")?()=>aq({content:aF.compareFileDiff.newContent,filePath:aF.compareFileDiff.filePath}):void 0,previewLabel:S("common.readable"),onContentSearch:a=>{V("search"),aB.setContentSearchQuery(a),aB.performContentSearch(a)}}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-slate-9",children:(0,e.jsx)("span",{children:aF.compareFiles.length>0?S("fileBrowser.selectFileToViewDiff"):S("fileBrowser.clickCompareToLoad")})}):aF.selectedCommit?(0,e.jsx)(l.n,{isOpen:!0,onClose:()=>aF.setSelectedCommit(null),commit:aF.selectedCommit,cwd:b,embedded:!0,onContentSearch:a=>{V("search"),aB.setContentSearchQuery(a),aB.performContentSearch(a)}}):(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-slate-9",children:(0,e.jsx)("span",{children:S("fileBrowser.selectCommitToView")})}))]})]}),aA.showMarkdownPreview&&aA.fileContent?.type==="text"&&aA.selectedPath&&(0,e.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/50",onClick:()=>aA.setShowMarkdownPreview(!1),children:(0,e.jsx)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-[90%] h-full flex flex-col",onClick:a=>a.stopPropagation(),children:(0,e.jsx)(u.M,{content:aA.fileContent.content||"",filePath:aA.selectedPath,cwd:b,onClose:()=>aA.setShowMarkdownPreview(!1)})})}),ac&&(0,e.jsx)(v.c,{files:aA.files,fileIndex:aA.fileIndex,recentFiles:aA.recentFilePaths,onSelectFile:a=>{aL(a),aA.setShouldScrollToSelected(!0),V("tree")},onClose:()=>ad(!1)}),(aR||ax.visible)&&(0,e.jsxs)("div",{className:`flex ${ax.visible&&aR?"":"flex-col"}`,children:[aR&&(0,e.jsx)("div",{className:ax.visible?"flex-1 min-w-0 border-r border-border":"",children:(0,e.jsx)(N.D,{results:aB.contentSearchResults,loading:aB.isSearching,totalMatches:aB.searchStats?.totalMatches??0,onSelect:(a,b)=>{aA.selectedPath&&ay.push({filePath:aA.selectedPath,lineNumber:ae.current}),aL(a,b)},onClose:()=>am(!1)})}),ax.visible&&(0,e.jsx)("div",{className:aR?"flex-1 min-w-0":"",children:(0,e.jsx)(M.D,{references:ax.references,loading:ax.loading,onSelect:aV,onClose:ax.closeReferences})})]})]}),aa&&(0,e.jsx)(h.ZL,{children:(0,e.jsx)("div",{className:"fixed inset-0 z-[300] flex items-center justify-center bg-black/50",onClick:()=>ab(null),children:(0,e.jsxs)("div",{className:"bg-card border border-border rounded-lg shadow-xl p-4 max-w-sm w-full mx-4",onClick:a=>a.stopPropagation(),children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground mb-2",children:S("fileBrowser.confirmDelete")}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:S("fileBrowser.confirmDeleteMessage",{name:aa.name}).split(/<\/?file>/g).map((a,b)=>1===b?(0,e.jsx)("span",{className:"font-mono text-foreground",children:a},b):a)}),(0,e.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,e.jsx)("button",{onClick:()=>ab(null),className:"px-3 py-1.5 text-sm rounded border border-border hover:bg-accent transition-colors",children:S("common.cancel")}),(0,e.jsx)("button",{onClick:async()=>{let{path:a,name:c}=aa;ab(null);let d=await i.t4.runPromiseExit((0,j.VK)({cwd:b,path:a}));if("Success"===d._tag){(0,n.oR)(S("toast.movedToTrash",{name:c}),"success");let b=a.includes("/")?a.substring(0,a.lastIndexOf("/")):"";aA.loadDirectory(b),aA.loadFileIndex(),aA.selectedPath===a&&aL("")}else{let a="Fail"===d.cause._tag?d.cause.error:null,b=a?.cause,c=b instanceof Error?b.message:S("toast.deleteFailed");(0,n.oR)(c,"error")}},className:"px-3 py-1.5 text-sm rounded bg-destructive text-destructive-foreground hover:bg-destructive/90 transition-colors",children:S("common.delete")})]})]})})}),aw.hoverInfo&&$&&(0,g.createPortal)((0,e.jsx)(L.s,{ref:aw.setTooltipEl,displayString:aw.hoverInfo.displayString,documentation:aw.hoverInfo.documentation,x:aw.hoverInfo.x,y:aw.hoverInfo.y,container:$,onMouseEnter:aw.onCardMouseEnter,onMouseLeave:aw.onCardMouseLeave,onFindReferences:()=>{let{filePath:a,line:b,column:c}=aw.hoverInfo;aw.clearHover(),ax.findReferences(a,b,c)},onSearch:a=>{aw.clearHover(),V("search"),aB.setContentSearchQuery(a),aB.performContentSearch(a)}}),$)]})}[E,F,p,o,l,y,r,z,m,u,v,N,M]=P.then?(await P)():P,d()}catch(a){d(a)}})},70404:(a,b,c)=>{"use strict";c.d(b,{e:()=>g});var d=c(48249),e=c(67484);function f(a,b){for(let c=0;c<a.blocks.length;c++){let d=a.blocks[c];if(b>=d.startLine&&b<=d.endLine)return a.prefix[c]+(b-d.startLine)}return null}function g({addedLines:a,blockRanges:b,viewportRange:c,onJumpToLine:h}){let i,j=(0,e.useRef)(null),k=(0,e.useMemo)(()=>(function(a){let b=[...a].sort((a,b)=>a.startLine-b.startLine),c=[0];for(let a of b){let b=Math.max(0,a.endLine-a.startLine+1);c.push(c[c.length-1]+b)}return{blocks:b,prefix:c,total:c[c.length-1]}})(b),[b]),l=(0,e.useMemo)(()=>{if(k.total<=0||0===a.size)return[];let b=[];for(let c of a){let a=k.blocks.find(a=>c>=a.startLine&&c<=a.endLine);a&&b.push({line:c,qname:a.qname})}b.sort((a,b)=>a.line-b.line);let c=[],d=null;for(let a of b)d&&a.line===d.end+1&&a.qname===d.qname?d.end=a.line:(d&&c.push(d),d={start:a.line,end:a.line,qname:a.qname});return d&&c.push(d),c},[a,k]);if(k.total<=0)return null;let m=(a,b)=>{let c=f(k,a),d=f(k,b);return null===c||null===d?null:{top:c/k.total*100,heightPct:(d-c+1)/k.total*100}};return(0,d.jsxs)("div",{ref:j,onClick:a=>{let b=j.current;if(!b)return;let c=b.getBoundingClientRect();if(c.height<=0)return;let d=function(a,b){if(a.total<=0)return null;let c=Math.max(0,Math.min(a.total-1,b));for(let b=0;b<a.blocks.length;b++){let d=a.prefix[b],e=a.prefix[b+1];if(c>=d&&c<e){let e=a.blocks[b];return{qname:e.qname,line:e.startLine+Math.round(c-d)}}}return null}(k,(a.clientY-c.top)/c.height*k.total);if(!d)return;let e=d.line,g=l.find(a=>a.qname===d.qname&&e>=a.start&&e<=a.end);if(g)return void h(g.qname,e);if(l.length>0){let a=Math.max(2,Math.round(.05*k.total)),b=f(k,e);if(null!==b){let c=null,d=1/0;for(let a of l){let e=f(k,a.start),g=f(k,a.end);if(null===e||null===g)continue;let h=b<e?e-b:b>g?b-g:0;h<d&&(c=a,d=h)}if(c&&d<=a){let a=e<c.start?c.start:e>c.end?c.end:e;h(c.qname,a);return}}}let i=k.blocks.find(a=>a.qname===d.qname);i&&h(i.qname,i.startLine)},className:"w-4 flex-shrink-0 bg-secondary border-l border-border relative cursor-pointer",title:"Diff minimap — click to jump",children:[l.map(a=>{let b=m(a.start,a.end);return b?(0,d.jsx)("div",{className:"absolute left-0 right-0 bg-green-9 pointer-events-none",style:{top:`${b.top}%`,height:`${b.heightPct}%`,minHeight:"2px"}},`run:${a.qname}:${a.start}-${a.end}`):null}),c&&c.end>=c.start&&((i=m(c.start,c.end))?(0,d.jsx)("div",{className:"absolute left-0 right-0 bg-muted/60 border-y border-border pointer-events-none",style:{top:`${i.top}%`,height:`${Math.max(1.2,i.heightPct)}%`}}):null)]})}},70440:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(88868);let e=async a=>[{type:"image/x-icon",sizes:"16x16",url:(0,d.fillMetadataSegment)(".",await a.params,"favicon.ico",!0)+"?603d046c9a6fdfbb"}]},70596:(a,b,c)=>{"use strict";c.d(b,{t:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({x:a,y:b,comment:c,container:h,onClose:i,onUpdateComment:j,onDeleteComment:k}){let{t:l}=(0,f.Bd)(),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(c.content),q=(0,e.useRef)(null),[r,s]=(0,e.useState)({x:0,y:0}),t=async()=>{o.trim()&&(await j(c.id,o.trim()),n(!1))},u=async()=>{await k(c.id),i()};return(0,d.jsx)("div",{ref:q,className:"absolute z-[200] w-96 bg-card border border-border rounded-lg shadow-lg overflow-hidden",style:{left:r.x,top:r.y},children:(0,d.jsx)("div",{className:"p-3",children:m?(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("textarea",{value:o,onChange:a=>p(a.target.value),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card resize-none focus:outline-none focus:ring-1 focus:ring-ring",rows:3,autoFocus:!0,onKeyDown:a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),t()),"Escape"===a.key&&(n(!1),p(c.content))}}),(0,d.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,d.jsx)("button",{onClick:()=>{n(!1),p(c.content)},className:"px-2 py-1 text-xs text-muted-foreground hover:text-foreground",children:l("common.cancel")}),(0,d.jsx)("button",{onClick:t,className:"px-2 py-1 text-xs bg-brand text-white rounded hover:bg-brand/90",children:l("common.save")})]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:c.content}),(0,d.jsxs)("div",{className:"mt-2 flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:l("comments.lineRange",{start:c.startLine,end:c.endLine})}),(0,d.jsxs)("div",{className:"flex gap-1",children:[(0,d.jsx)("button",{onClick:()=>n(!0),className:"p-1 rounded hover:bg-accent text-muted-foreground",title:l("common.edit"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,d.jsx)("button",{onClick:u,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-red-9",title:l("common.delete"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]})]})})})}},71192:(a,b,c)=>{"use strict";c.d(b,{m_:()=>f,uV:()=>e});var d=c(81218);class e extends d.rN("AppError"){}d.rN("DBError"),d.rN("WSError"),d.rN("FSError"),d.rN("AgentError"),d.rN("ValidationError");class f extends d.rN("NotFoundError"){}d.rN("PermissionError")},72399:(a,b,c)=>{"use strict";c.d(b,{ProjectSidebar:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call ProjectSidebar() from the server but ProjectSidebar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/ProjectSidebar.tsx","ProjectSidebar")},72529:(a,b,c)=>{"use strict";c.d(b,{m:()=>f});var d=c(48249),e=c(67484);function f({content:a,children:b,className:c}){if(c)return(0,d.jsx)("div",{"data-tooltip":a,className:c,children:b});let g=e.Children.toArray(b);if(1===g.length&&(0,e.isValidElement)(g[0])){let b=g[0];return(0,e.cloneElement)(b,{"data-tooltip":a})}return(0,d.jsx)("div",{"data-tooltip":a,style:{display:"contents"},children:b})}},73414:(a,b,c)=>{"use strict";c.d(b,{YO:()=>d,pU:()=>e});let d=20;function e(a,b,c,f=[]){let g=a.length,h=c=>"unchanged"!==a[c].type||"unchanged"!==b[c].type,i=new Set;for(let a=0;a<g;a++){if(!h(a))continue;let b=Math.max(0,a-3),c=Math.min(g-1,a+3);for(let a=b;a<=c;a++)i.add(a)}let j=[];for(let a=0;a<g;a++){if(i.has(a))continue;let b=a;for(;a<g&&!i.has(a);)a++;j.push({id:j.length,startIdx:b,endIdx:a-1}),a--}for(let a of j){let b=c.get(a.id)??{topRevealed:0,bottomRevealed:0},d=a.endIdx-a.startIdx+1,e=Math.max(0,Math.min(b.topRevealed,d)),f=Math.max(0,Math.min(b.bottomRevealed,d-e));for(let b=a.startIdx;b<a.startIdx+e;b++)i.add(b);for(let b=a.endIdx-f+1;b<=a.endIdx;b++)i.add(b)}let k=[];for(let a=0;a<g;a++){let c;if(i.has(a)){k.push({kind:"diff",idx:a});continue}let e=a;for(;a<g&&!i.has(a);)a++;let h=a-1;a--;let l=j.find(a=>a.startIdx<=e&&h<=a.endIdx);if(!l)continue;let m=h-e+1,n=Math.min(d,m);if(f.length>0&&h+1<g)for(let a=h+1;a<g;a++){let d=b[a].lineNum;if(!(d<=0)){c=function(a,b){let c=null;for(let d of a)d.startLine<=b&&b<=d.endLine&&(!c||d.endLine-d.startLine<c.endLine-c.startLine)&&(c=d);return c}(f,d)??void 0;break}}k.push({kind:"gap-expand",gapId:l.id,direction:"up",revealCount:n}),k.push({kind:"gap-label",gapId:l.id,hiddenCount:m,enclosingFn:c}),k.push({kind:"gap-expand",gapId:l.id,direction:"down",revealCount:n})}return{rows:k,gaps:j}}},73887:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{M:()=>v});var e=c(48249),f=c(67484),g=c(44384),h=c(74429),i=c(7122),j=c(41051),k=c(42140),l=c(70596),m=c(74754),n=c(7031),o=c(91579),p=c(87844),q=c(84835),r=c(24680),s=c(25465),t=c(37690),u=a([s]);s=(u.then?(await u)():u)[0];let w=[q.W];function v({content:a,filePath:b,cwd:c,onClose:d,sourceFile:q}){let u=q||(c&&b.startsWith(c)?b.slice(c.endsWith("/")?c.length:c.length+1):b),{t:x}=(0,g.Bd)(),y=(0,i.iN)(),z=(0,n.r)(),{comments:A,addComment:B,updateComment:C,deleteComment:D,refresh:E}=(0,m._)({cwd:c,filePath:b}),[F,G]=(0,f.useState)(!1),[H,I]=(0,f.useState)(null),[J,K]=(0,f.useState)(null),[L,M]=(0,f.useState)(null),N=(0,f.useMemo)(()=>a.split("\n"),[a]),[O,P]=(0,f.useState)(null),Q=(0,f.useRef)(null),{toolbarRef:R,bumpRef:S,clearToolbar:T}=(0,t.L)({enabled:!0,container:O,resolveLineRange:a=>{let b=function(a){let b=a.nodeType===Node.TEXT_NODE?a.parentElement:a;if(!b||!("closest"in b))return null;let c=b.closest("[data-source-start]");if(!c)return null;let d=c.getAttribute("data-source-start"),e=c.getAttribute("data-source-end");return d&&e?{start:parseInt(d,10),end:parseInt(e,10)}:null}(a);return b?{start:b.start,end:b.end}:null},buildLineSnapshot:({start:a,end:b})=>{let c=Math.max(0,a-1),d=Math.min(N.length,b);return N.slice(c,d).join("\n")}}),U=(0,f.useCallback)(()=>{let a=R.current;a&&(I({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),T())},[T,R]),V=(0,f.useCallback)(()=>{let a=R.current;a&&(K({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),T())},[T,R]),W=(0,f.useCallback)(async a=>{H&&(await B(H.range.start,H.range.end,a,H.selectedText),I(null))},[H,B]),X=(0,f.useCallback)(async a=>{if(J&&z)try{let d=await (0,o.$3)(c),e=[];for(let a of d)e.push({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0});e.push({filePath:b,startLine:J.range.start,endLine:J.range.end,codeContent:J.lineSnapshot});let f=(0,o.Gw)(e,a);z.sendMessage(f),await (0,o.RP)(c),E(),K(null)}catch(a){console.error("Failed to send to AI:",a)}},[J,z,b,c,E]);(0,f.useMemo)(()=>{if(0===A.length)return[];let a=new Map;for(let b of A){let c=`${b.startLine}-${b.endLine}`;a.has(c)||a.set(c,[]),a.get(c).push(b)}return Array.from(a.entries()).map(([a,b])=>({key:a,startLine:b[0].startLine,endLine:b[0].endLine,comments:b}))},[A]);let[Y,Z]=(0,f.useState)([]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between flex-shrink-0",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-foreground truncate",children:b}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)(s.ShareReviewToggle,{content:a,sourceFile:u}),(0,e.jsx)("button",{onClick:d,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:x("common.close"),children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,e.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,e.jsx)(r.l,{content:a,containerRef:Q}),(0,e.jsxs)("div",{className:"flex-1 overflow-auto relative",ref:Q,children:[(0,e.jsx)("div",{className:"p-6",children:(0,e.jsx)(p.T,{content:a,rehypePlugins:w})}),Y.map(({key:a,top:b,comments:c})=>(0,e.jsx)("div",{className:"absolute right-3 cursor-pointer z-10",style:{top:b},onClick:a=>{a.stopPropagation(),M({comment:c[0],x:a.clientX,y:a.clientY})},children:(0,e.jsx)("div",{className:"w-5 h-5 rounded-full bg-amber-500/80 text-white text-xs flex items-center justify-center shadow-sm hover:bg-amber-500 transition-colors",children:c.length})},a))]})]}),F&&y&&(0,h.createPortal)((0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(j.f,{floatingToolbarRef:R,bumpRef:S,container:y,onAddComment:U,onSendToAI:V,isChatLoading:z?.isLoading}),H&&(0,e.jsx)(k.t,{x:H.x,y:H.y,range:H.range,lineSnapshot:H.lineSnapshot,container:y,onSubmit:W,onClose:()=>I(null)}),J&&(0,e.jsx)(k.G,{x:J.x,y:J.y,range:J.range,filePath:b,lineSnapshot:J.lineSnapshot,container:y,onSubmit:X,onClose:()=>K(null),isChatLoading:z?.isLoading}),L&&(0,e.jsx)(l.t,{x:L.x,y:L.y,comment:L.comment,container:y,onClose:()=>M(null),onUpdateComment:C,onDeleteComment:D})]}),y)]})}d()}catch(a){d(a)}})},74493:(a,b,c)=>{"use strict";c.d(b,{Ey:()=>n,GW:()=>m,HS:()=>o,Hj:()=>i,ax:()=>h,qM:()=>j});var d=c(79606),e=c(33281),f=c(71192);let g=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error(`HTTP ${c.status}`)},catch:b=>new f.uV({message:`POST ${a} failed`,cause:b})}),h=(a,b)=>e.t4.runPromise(g(`/api/${a}/disconnect`,{id:b}).pipe(d.orElse(()=>d.void))),i=a=>e.t4.runPromise(g("/api/jupyter/shutdown",{bubbleId:a}).pipe(d.orElse(()=>d.void))),j=a=>e.t4.runPromise(g("/api/browser/unregister",{id:a}).pipe(d.orElse(()=>d.void))),k=a=>e.t4.runPromise(a.pipe(d.catchAll(a=>d.sync(()=>{if(a.cause instanceof Error)throw a.cause;throw Error(a.message)})))),l=(a,b)=>{if(a&&"object"==typeof a&&"error"in a){let b=a.error;if("string"==typeof b&&b.length>0)return b;if(b&&"object"==typeof b){let a=b.message;if("string"==typeof a&&a.length>0)return a;let c=b._tag;if("string"==typeof c&&c.length>0)return c}}return`HTTP ${b}`},m=(a,b)=>k(d.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),d=await c.json();if(!c.ok)throw Error(l(d,c.status));return d},catch:b=>new f.uV({message:`POST ${a} failed`,cause:b})})),n=(a,b)=>k(d.tryPromise({try:async()=>{let c=new URLSearchParams(b),d=await fetch(`${a}?${c}`),e=await d.json();if(!d.ok)throw Error(l(e,d.status));return e},catch:b=>new f.uV({message:`GET ${a} failed`,cause:b})})),o=(a,b)=>k(d.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error(`HTTP ${c.status}`);return c.blob()},catch:b=>new f.uV({message:`POST blob ${a} failed`,cause:b})}))},74542:(a,b,c)=>{"use strict";c.d(b,{b:()=>f});var d=c(48249),e=c(67484);function f({lines:a,containerRef:b}){let c=(0,e.useRef)(null),[g,h]=(0,e.useState)({top:0,height:0});if(0===a.length)return null;let i=100/a.length;return(0,d.jsxs)("div",{ref:c,className:"w-4 flex-shrink-0 bg-secondary border-l border-border relative cursor-pointer",onClick:a=>{let d=b.current,e=c.current;if(!d||!e)return;let f=e.getBoundingClientRect(),g=(a.clientY-f.top)/f.height*d.scrollHeight-d.clientHeight/2;d.scrollTo({top:Math.max(0,g),behavior:"smooth"})},children:[a.map((a,b)=>"unchanged"!==a.type&&(0,d.jsx)("div",{className:`absolute left-0 right-0 ${"removed"===a.type?"bg-red-9":"bg-green-9"}`,style:{top:`${b*i}%`,height:`${Math.max(i,.5)}%`,minHeight:"2px"}},b)),(0,d.jsx)("div",{className:"absolute left-0 right-0 bg-muted/60 border-y border-border",style:{top:`${g.top}px`,height:`${Math.max(g.height,10)}px`}})]})}},74754:(a,b,c)=>{"use strict";c.d(b,{_:()=>g});var d=c(67484);c(91579);var e=c(33281),f=c(89800);function g({cwd:a,filePath:b}){let[c,h]=(0,d.useState)([]),[i,j]=(0,d.useState)(!1),[k,l]=(0,d.useState)(null),m=(0,d.useCallback)(async()=>{if(!a||!b)return;j(!0),l(null);let c=await e.t4.runPromiseExit((0,f.lb)(a,b));if("Success"===c._tag)h(c.value.comments??[]);else{let a="Fail"===c.cause._tag?c.cause.error:null,b=a?.cause;l(b instanceof Error?b.message:"Failed to load comments")}j(!1)},[a,b]),n=(0,d.useCallback)(async(c,d,g,i)=>{let j=await e.t4.runPromiseExit((0,f.BC)({cwd:a,filePath:b,startLine:c,endLine:d,content:g,...i?{selectedText:i}:{}}));if("Success"===j._tag&&j.value.comment){let a=j.value.comment;return h(b=>[...b,a]),a}return"Failure"===j._tag&&console.error("Failed to add comment:",j.cause),null},[a,b]),o=(0,d.useCallback)(async(b,c)=>{let d=await e.t4.runPromiseExit((0,f.vv)(a,b,c));if("Success"===d._tag&&d.value.comment){let a=d.value.comment;return h(c=>c.map(c=>c.id===b?a:c)),!0}return"Failure"===d._tag&&console.error("Failed to update comment:",d.cause),!1},[a]),p=(0,d.useCallback)(async b=>{let c=await e.t4.runPromiseExit((0,f.Tu)(a,b));return"Success"===c._tag?(h(a=>a.filter(a=>a.id!==b)),!0):(console.error("Failed to delete comment:",c.cause),!1)},[a]),q=(0,d.useCallback)(a=>c.filter(b=>a>=b.startLine&&a<=b.endLine),[c]);return{comments:c,isLoading:i,error:k,addComment:n,updateComment:o,deleteComment:p,refresh:m,getCommentsForLine:q}}},74837:(a,b,c)=>{"use strict";c.d(b,{NoteToolbar:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call NoteToolbar() from the server but NoteToolbar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/NoteToolbar.tsx","NoteToolbar")},74991:(a,b,c)=>{"use strict";c.d(b,{I:()=>j});var d=c(48249),e=c(67484),f=c(44384),g=c(30458);function h(a,b){if("once"===a.type)return b("scheduledTasks.onceType",{minutes:a.delayMinutes});if("interval"===a.type){let c=b("scheduledTasks.everyNMinutes",{minutes:a.intervalMinutes});return a.activeFrom&&a.activeTo?`${c} (${a.activeFrom}-${a.activeTo})`:c}return"cron"===a.type?a.cron||"cron":a.type}function i(a){return a.unread?"bg-red-500":a.completed?"bg-muted-foreground":a.paused?"bg-yellow-500":"error"===a.lastResult?"bg-red-500":"bg-green-500"}function j({collapsed:a,tasks:b,unreadCount:c,onSwitchProject:k,onPause:l,onResume:m,onTrigger:n,onDelete:o,onMarkRead:p,onUpdateTask:q,onReorder:r}){let{t:s}=(0,f.Bd)(),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)(null),x=(0,e.useRef)(null),y=b.filter(a=>!a.completed),z=y.filter(a=>!a.paused).length,A=b.filter(a=>a.completed),[B,C]=(0,e.useState)(null),[D,E]=(0,e.useState)(null),F=(0,e.useCallback)(a=>{C(a)},[]),G=(0,e.useCallback)((a,b)=>{a.preventDefault(),E(b)},[]),H=(0,e.useCallback)(a=>{if(null===B||B===a){C(null),E(null);return}let b=[...y],[c]=b.splice(B,1);b.splice(a,0,c),r([...b,...A].map(a=>a.id)),C(null),E(null)},[B,y,A,r]),I=(0,e.useCallback)(()=>{C(null),E(null)},[]),[,J]=(0,e.useState)(0);return(0,d.jsxs)("div",{className:"relative",ref:x,children:[(0,d.jsxs)("button",{onClick:()=>u(!t),className:`relative flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${a?"w-full justify-center":"w-full"}`,title:s("scheduledTasks.title"),children:[(0,d.jsxs)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6l4 2"})]}),!a&&(0,d.jsx)("span",{className:"text-sm flex-1 text-left",children:s("scheduledTasks.title")}),c>0?(0,d.jsx)("span",{className:`min-w-[18px] h-[18px] px-1 text-white text-xs font-medium rounded-full flex items-center justify-center bg-red-500 ${a?"absolute -top-1 -right-1":""}`,children:c}):a&&b.length>0?(0,d.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] px-1 text-muted-foreground text-xs font-medium rounded-full flex items-center justify-center bg-accent",children:b.length}):null]}),t&&(0,d.jsxs)("div",{className:"absolute left-full bottom-0 ml-2 w-96 max-h-[500px] bg-popover border border-border rounded-lg shadow-lg z-50 flex flex-col",children:[(0,d.jsxs)("div",{className:"px-3 py-2 border-b border-border bg-muted/50 flex-shrink-0 rounded-t-lg flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm font-medium",children:s("scheduledTasks.title")}),y.length>0&&(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:[s("scheduledTasks.activeCount",{running:z}),y.length-z>0?` \xb7 ${s("scheduledTasks.pausedCount",{paused:y.length-z})}`:""]})]}),(0,d.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:0===b.length?(0,d.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:s("scheduledTasks.noScheduledTasks")}):(0,d.jsxs)(d.Fragment,{children:[y.map((a,b)=>{var c;return(0,d.jsx)("div",{draggable:!0,onDragStart:()=>F(b),onDragOver:a=>G(a,b),onDrop:()=>H(b),onDragEnd:I,className:`group px-3 py-2 hover:bg-accent transition-colors border-b border-border/50 cursor-pointer ${a.unread?"bg-brand/5":""} ${B===b?"opacity-50":""} ${D===b?"border-t-2 border-brand":""}`,onClick:()=>{k(a.cwd,a.sessionId),a.unread&&p(a.id),u(!1)},children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:`mt-1.5 w-2 h-2 rounded-full flex-shrink-0 ${i(a)}`}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-xs text-muted-foreground font-mono",children:(c=a.cwd).split("/").pop()||c}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:"\xb7"}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:a.completed?s("scheduledTasks.completed"):a.paused?s("scheduledTasks.paused"):s("common.running")})]}),(0,d.jsx)("div",{className:"text-sm text-foreground truncate mt-0.5",title:a.message,children:a.message}),(0,d.jsxs)("div",{className:"flex items-center gap-3 mt-1 text-xs text-muted-foreground",children:[(0,d.jsx)("span",{children:h(a,s)}),(0,d.jsx)("span",{children:"\xb7"}),(0,d.jsx)("span",{children:a.paused?s("scheduledTasks.paused"):function(a,b){if(!a)return"-";let c=a-Date.now();if(c<=0)return b("scheduledTasks.aboutToTrigger");if(c<6e4)return b("scheduledTasks.secondsLater",{count:Math.ceil(c/1e3)});if(c<36e5)return b("scheduledTasks.minutesLater",{count:Math.ceil(c/6e4)});if(c<864e5){let a=Math.floor(c/36e5),d=Math.ceil(c%36e5/6e4);return d>0?b("scheduledTasks.hoursMinutesLater",{h:a,m:d}):b("scheduledTasks.hoursLater",{h:a})}return new Date(a).toLocaleDateString("zh-CN",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}(a.nextFireTime,s)}),a.lastFiredAt&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{children:"\xb7"}),(0,d.jsxs)("span",{children:[s("scheduledTasks.lastResult"),": ","success"===a.lastResult?"✓":"✗"]})]})]})]}),(0,d.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),n(a.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-brand",title:s("scheduledTasks.runNow"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M8 5v14l11-7z"})})}),(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),w(a)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground",title:s("common.edit"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),a.paused?(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),m(a.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-green-500",title:s("scheduledTasks.resume"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"})})}):(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),l(a.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-yellow-500",title:s("scheduledTasks.pause"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 9v6m4-6v6"})})}),(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),o(a.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-destructive",title:s("common.delete"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]})},a.id)}),A.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"px-3 py-1.5 text-xs text-muted-foreground bg-muted/30 border-b border-border/50",children:s("scheduledTasks.completedCount",{count:A.length})}),A.map(a=>(0,d.jsx)("div",{className:"group px-3 py-2 hover:bg-accent transition-colors border-b border-border/50 opacity-60 cursor-pointer",onClick:()=>{k(a.cwd,a.sessionId),u(!1)},children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:`mt-1.5 w-2 h-2 rounded-full flex-shrink-0 ${i(a)}`}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-sm text-foreground truncate",children:a.message}),(0,d.jsxs)("div",{className:"text-xs text-muted-foreground mt-0.5",children:[h(a,s)," \xb7 ","success"===a.lastResult?s("scheduledTasks.success"):s("scheduledTasks.failure")]})]}),(0,d.jsx)("div",{className:"flex-shrink-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),o(a.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-destructive",title:s("common.delete"),children:(0,d.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})})]})},a.id))]})]})})]}),v&&(0,d.jsxs)("div",{className:"fixed inset-0 z-[100] flex items-center justify-center",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/30",onClick:()=>w(null)}),(0,d.jsx)("div",{className:"relative",children:(0,d.jsx)(g.E,{onClose:()=>w(null),onCreate:()=>{},editTask:{id:v.id,message:v.message,type:v.type,delayMinutes:v.delayMinutes,intervalMinutes:v.intervalMinutes,activeFrom:v.activeFrom,activeTo:v.activeTo,cron:v.cron},onUpdate:(a,b)=>{q(a,b),w(null)}})})]})]})}},75513:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{k_:()=>h,nH:()=>i});var e=c(48249),f=c(67484),g=c(7031);let a=(0,f.createContext)(null);function h({children:b}){let c=(0,f.useRef)(new Map),d=(0,f.useRef)(null),[i,j]=(0,f.useState)(!1),k=(0,f.useCallback)((a,b)=>{c.current.set(b,a)},[]),l=(0,f.useCallback)(a=>{c.current.delete(a)},[]),m=(0,f.useCallback)(a=>{d.current=a},[]),n=(0,f.useCallback)(a=>{let b=d.current;if(!b)return void console.warn("No active tab to send message");let e=c.current.get(b);e?e(a):console.warn(`No chat sender registered for tab ${b}`)},[]),o=(0,f.useMemo)(()=>({sendMessage:n,isLoading:i,registerChat:k,unregisterChat:l,setActiveTab:m,setIsLoading:j}),[n,i,k,l,m]),p=(0,f.useMemo)(()=>({sendMessage:n,isLoading:i}),[n,i]);return(0,e.jsx)(a.Provider,{value:o,children:(0,e.jsx)(g.H,{value:p,children:b})})}function i(){return(0,f.useContext)(a)}d()}catch(a){d(a)}})},76334:(a,b,c)=>{"use strict";function d(a){let b=function(a){let b=0xffffffff;for(let c=0;c<a.length;c++){b^=a.charCodeAt(c);for(let a=0;a<8;a++)b=b>>>1^(1&b?0xedb88320:0)}return(0xffffffff^b)>>>0}(a),c="",d=b;for(let a=0;a<4;a++)c+=String.fromCharCode(97+d%26),d=Math.floor(d/26);return c}c.d(b,{p:()=>d})},76537:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>n,metadata:()=>l,viewport:()=>m});var d=c(5735),e=c(45864),f=c.n(e),g=c(87764),h=c.n(g),i=c(76055),j=c.n(i);c(61135);var k=c(25702);let l={title:"Cockpit",description:"Cockpit is a local-first AI development hub with chat agents, a file explorer, terminals, and browser bubbles in one swipeable workspace. One seat. One AI.",manifest:"/manifest.json",appleWebApp:{capable:!0,statusBarStyle:"default",title:"Cockpit"},icons:{icon:"/icons/icon-192x192.png",apple:"/icons/icon-192x192.png"}},m={themeColor:[{media:"(prefers-color-scheme: light)",color:"#f9f9fb"},{media:"(prefers-color-scheme: dark)",color:"#111113"}]};function n({children:a}){return(0,d.jsxs)("html",{lang:"en",suppressHydrationWarning:!0,className:"overflow-hidden",children:[(0,d.jsx)("head",{children:(0,d.jsx)("script",{src:"/boot.js"})}),(0,d.jsx)("body",{className:`${f().variable} ${h().variable} ${j().variable} antialiased overflow-hidden`,children:(0,d.jsx)(k.Providers,{children:a})})]})}},76552:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Providers:()=>j});var e=c(48249),f=c(29491),g=c(83768),h=c(7833),i=c(34102);function j({children:a}){return(0,e.jsx)(f.I18nProvider,{children:(0,e.jsx)(g.N,{children:(0,e.jsxs)(h.tE,{children:[a,(0,e.jsx)(i.B,{})]})})})}d()}catch(a){d(a)}})},76855:(a,b,c)=>{"use strict";c.d(b,{Sn:()=>i,Xm:()=>j,po:()=>k,JL:()=>l});var d=c(67484);c(28797);var e=c(79606),f=c(33281),g=c(71192);let h=(a,b)=>e.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error(`HTTP ${c.status}`);return await c.json()},catch:b=>new g.uV({message:`${a} failed`,cause:b})});function i(a){let[b,c]=(0,d.useState)(!1);return{goToDefinition:(0,d.useCallback)(async(b,d,e)=>{c(!0);let g=await f.t4.runPromiseExit(h("/api/lsp/definition",{cwd:a,filePath:b,line:d,column:e}));return(c(!1),"Success"===g._tag)?g.value.definitions??[]:(console.error("[useLSP] definition error:",g.cause),[])},[a]),loading:b}}function j(a){let[b,c]=(0,d.useState)(null),e=(0,d.useRef)(null),g=(0,d.useRef)(null),i=(0,d.useRef)(0),j=(0,d.useRef)(!1),k=(0,d.useRef)(null),l=(0,d.useRef)({x:0,y:0}),m=(0,d.useCallback)(a=>{k.current=a},[]),n=(0,d.useRef)(!1),o=(0,d.useRef)(null),p=(0,d.useCallback)(()=>{let a=k.current;a&&n.current&&(a.style.pointerEvents="none"),n.current=!1,o.current&&(k.current?.removeEventListener("mouseleave",o.current),o.current=null)},[]),q=(0,d.useCallback)(()=>{let a=k.current;if(!a||n.current)return;n.current=!0,j.current=!0,a.style.pointerEvents="auto";let b=()=>{j.current=!1,p(),i.current++,c(null)};o.current=b,a.addEventListener("mouseleave",b)},[p]),r=(0,d.useCallback)((b,d,j,k)=>{e.current&&clearTimeout(e.current),g.current&&clearTimeout(g.current);let l=++i.current;e.current=setTimeout(async()=>{let e=await f.t4.runPromiseExit(h("/api/lsp/hover",{cwd:a,filePath:b,line:d,column:j}));if(l!==i.current||"Success"!==e._tag)return;let g=e.value.hover;g&&g.displayString&&c({...g,x:k.x,y:k.y,filePath:b,line:d,column:j})},300)},[a]),s=(0,d.useCallback)(()=>{e.current&&clearTimeout(e.current),i.current++,g.current=setTimeout(function(){if(j.current)return;let a=k.current;if(a){let b=a.getBoundingClientRect(),{x:c,y:d}=l.current;if(c>=b.left&&c<=b.right&&d>=b.top&&d<=b.bottom)return void q()}c(null)},150)},[q]),t=(0,d.useCallback)(()=>{j.current=!0,g.current&&clearTimeout(g.current)},[]);return{hoverInfo:b,onTokenMouseEnter:r,onTokenMouseLeave:s,onCardMouseEnter:t,onCardMouseLeave:(0,d.useCallback)(()=>{j.current=!1,i.current++,c(null)},[]),clearHover:(0,d.useCallback)(()=>{e.current&&clearTimeout(e.current),g.current&&clearTimeout(g.current),j.current=!1,p(),i.current++,c(null)},[p]),setTooltipEl:m}}function k(a){let[b,c]=(0,d.useState)([]),[e,g]=(0,d.useState)(!1),[i,j]=(0,d.useState)(!1);return{references:b,loading:e,visible:i,findReferences:(0,d.useCallback)(async(b,d,e)=>{g(!0),j(!0);let i=await f.t4.runPromiseExit(h("/api/lsp/references",{cwd:a,filePath:b,line:d,column:e}));"Success"===i._tag?c(i.value.references??[]):(console.error("[useLSP] references error:",i.cause),c([])),g(!1)},[a]),closeReferences:(0,d.useCallback)(()=>{j(!1),c([])},[])}}function l(a,b){(0,d.useRef)(null)}},77016:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{b:()=>s});var e=c(48249),f=c(67484),g=c(44256),h=c(36295),i=c(7833),j=c(28602),k=c(44384),l=c(74493),m=a([h]);h=(m.then?(await m)():m)[0];let x=[{value:"=",label:"="},{value:"!=",label:"!="},{value:">",label:">"},{value:"<",label:"<"},{value:">=",label:">="},{value:"<=",label:"<="},{value:"LIKE",label:"LIKE"},{value:"NOT LIKE",label:"NOT LIKE"},{value:"IN",label:"IN"},{value:"IS NULL",label:"IS NULL"},{value:"IS NOT NULL",label:"IS NOT NULL"}];function n(a){if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`}function o(a){return`\`${a.replace(/`/g,"``")}\``}function p(a){try{let b=a.match(/\/\/[^/]+\/([^?]+)/);if(b)return b[1]}catch{}return""}function q(a){return null==a?"":"object"==typeof a?JSON.stringify(a):String(a)}function r({text:a}){let[b,c]=(0,f.useState)(!1),[d,h]=(0,f.useState)({x:0,y:0,maxW:600,maxH:300,above:!0}),i=(0,f.useRef)(null),j=(0,f.useRef)(null),k=(0,f.useRef)(!1),l=(0,g.F2)(),m=(0,f.useCallback)(()=>{j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{k.current||c(!1)},80)},[]),n=(0,f.useCallback)(()=>{j.current&&clearTimeout(j.current),k.current=!1,j.current=setTimeout(()=>{let a=i.current;if(!a||a.scrollWidth<=a.clientWidth)return;let b=a.getBoundingClientRect(),d=l?.getBoundingClientRect(),e=d?.left??0,f=d?.top??0,g=d?.width??window.innerWidth,j=d?.height??window.innerHeight,k=b.left-e,m=b.top-f,n=b.bottom-f,o=Math.min(600,g-k-8),p=o<200?Math.max(8,g-600-8):k,q=o<200?Math.min(600,g-16):o,r=m-8,s=j-n-8,t=r>s&&r>80,u=t?r-4:s-4;h({x:p,y:t?m-4:n+4,maxW:q,maxH:Math.max(60,u),above:t}),c(!0)},350)},[l]),o=(0,f.useCallback)(()=>{m()},[m]),p=(0,f.useCallback)(()=>{k.current=!0,j.current&&clearTimeout(j.current)},[]),q=(0,f.useCallback)(()=>{k.current=!1,m()},[m]);return(0,e.jsxs)("span",{ref:i,className:"block truncate",onMouseEnter:n,onMouseLeave:o,children:[a,b&&(0,e.jsx)(g.ZL,{children:(0,e.jsx)("div",{className:"fixed z-[9999] overflow-y-auto px-2 py-1.5 text-xs font-mono bg-popover text-popover-foreground border border-border rounded shadow-lg whitespace-pre-wrap break-all select-text cursor-text",style:{left:d.x,top:d.y,maxWidth:d.maxW,maxHeight:d.maxH,transform:d.above?"translateY(-100%)":void 0},onMouseEnter:p,onMouseLeave:q,children:function(a){try{let b=JSON.parse(a);if("object"==typeof b&&null!==b)return JSON.stringify(b,null,2)}catch{}return a}(a)})})]})}function s({id:a,connectionString:b,displayName:c,selected:d,maximized:g,expandedHeight:m,bubbleContentHeight:u,onSelect:x,onClose:y,onToggleMaximize:z,timestamp:A,onTitleMouseDown:B}){let{t:C}=(0,k.Bd)(),{showToast:D}=(0,i.dj)(),[E,F]=(0,f.useState)("connecting"),[G,H]=(0,f.useState)(""),[I,J]=(0,f.useState)([]),[K,L]=(0,f.useState)(()=>p(b)),[M,N]=(0,f.useState)([]),[O,P]=(0,f.useState)(null),[Q,R]=(0,f.useState)("table"),[S,T]=(0,f.useState)("data"),[U,V]=(0,f.useState)([]),[W,X]=(0,f.useState)([]),[Y,Z]=(0,f.useState)([]),[$,_]=(0,f.useState)([]),[aa,ab]=(0,f.useState)(null),[ac,ad]=(0,f.useState)(0),[ae,af]=(0,f.useState)(!1),[ag,ah]=(0,f.useState)(0),[ai,aj]=(0,f.useState)(new Set),[ak,al]=(0,f.useState)(!1),[am,an]=(0,f.useState)(null),[ao,ap]=(0,f.useState)({}),[aq,ar]=(0,f.useState)(!1),[as,at]=(0,f.useState)({}),[au,av]=(0,f.useState)({}),[aw,ax]=(0,f.useState)(null),[ay,az]=(0,f.useState)(""),[aA,aB]=(0,f.useState)(null),[aC,aD]=(0,f.useState)(""),[aE,aF]=(0,f.useState)(!1),aG=(0,f.useRef)(null),aH=(0,f.useCallback)(async()=>{F("connecting"),H("");try{let c=await (0,l.GW)("/api/mysql/connect",{id:a,connectionString:b});J(c.schemas||[]);let d=p(b);c.schemas?.length>0&&d&&c.schemas.includes(d)?L(d):c.schemas?.length>0&&L(c.schemas[0]),F("connected")}catch(a){H(a instanceof Error?a.message:String(a)),F("error")}},[a,b]),aI=(0,f.useCallback)(async()=>{if("connected"===E)try{let c=await (0,l.Ey)("/api/mysql/schemas",{id:a,connectionString:b,schema:K});N(c.tables||[])}catch{}},[a,b,K,E]),aJ=(0,f.useCallback)(async(c,d,e,f)=>{af(!0);let g=e??au,h=void 0!==f?f:aw;try{let e=`${o(K)}.${o(c)}`,{where:f,params:i}=function(a){let b=[],c=[];for(let[d,e]of Object.entries(a)){if(!e.enabled)continue;let a=o(d);if("IS NULL"===e.op)b.push(`${a} IS NULL`);else if("IS NOT NULL"===e.op)b.push(`${a} IS NOT NULL`);else if("IN"===e.op){let d=e.value.split(",").map(a=>a.trim()).filter(Boolean);if(0===d.length)continue;let f=d.map(a=>(c.push(a),"?"));b.push(`${a} IN (${f.join(", ")})`)}else"LIKE"===e.op||e.op,b.push(`${a} ${e.op} ?`),c.push(e.value)}return{where:b.length>0?` WHERE ${b.join(" AND ")}`:"",params:c}}(g),j=h?` ORDER BY ${o(h.column)} ${h.dir}`:"",k=`SELECT * FROM ${e}${f}${j} LIMIT 50 OFFSET ${50*d}`,m=await (0,l.GW)("/api/mysql/query",{id:a,connectionString:b,sql:k,params:i});ab(m);let n=`SELECT count(*) AS cnt FROM ${e}${f}`,p=await (0,l.GW)("/api/mysql/query",{id:a,connectionString:b,sql:n,params:i});ah(p.rows?.[0]?.cnt??0)}catch{}af(!1)},[a,b,K,au,aw]),aK=(0,f.useCallback)(async c=>{P(c),ad(0),an(null),ar(!1),aj(new Set),al(!1),av({}),ax(null);try{let d=await (0,l.Ey)("/api/mysql/columns",{id:a,connectionString:b,schema:K,table:c});V(d.columns||[]),X(d.primaryKeys||[]),Z(d.foreignKeys||[]),_(d.indexes||[])}catch{}aJ(c,0,{},null)},[a,b,K,aJ]),aL=(0,f.useCallback)(async()=>{if(ay.trim()){aF(!0),aD(""),aB(null);try{let c=await (0,l.GW)("/api/mysql/query",{id:a,connectionString:b,sql:ay});aB(c)}catch(a){aD(a instanceof Error?a.message:String(a))}aF(!1)}},[a,b,ay]),aM=(0,f.useCallback)(async()=>{if(null===am||!aa||!O)return;let c=aa.rows[am],d=[],e=[];for(let a of U)void 0!==ao[a.name]&&ao[a.name]!==q(c[a.name]??"")&&(d.push(`${o(a.name)} = ?`),e.push(""===ao[a.name]&&a.nullable?null:ao[a.name]));if(0===d.length)return void an(null);let f=W.length>0?W:U.map(a=>a.name),g=[];for(let a of f)null===c[a]||void 0===c[a]?g.push(`${o(a)} IS NULL`):(g.push(`${o(a)} = ?`),e.push(c[a]));let h=`UPDATE ${o(K)}.${o(O)} SET ${d.join(", ")} WHERE ${g.join(" AND ")}`;try{await (0,l.GW)("/api/mysql/query",{id:a,connectionString:b,sql:h,params:e}),an(null),aJ(O,ac,au,aw)}catch(a){alert(`Update failed: ${a instanceof Error?a.message:String(a)}`)}},[am,aa,O,U,W,ao,a,b,K,aJ,ac,au,aw]),aN=(0,f.useCallback)(async()=>{if(!O)return;let c=[],d=[],e=[];for(let a of U)void 0!==as[a.name]&&""!==as[a.name]&&(c.push(o(a.name)),d.push(as[a.name]),e.push("?"));if(0===c.length)return;let f=`INSERT INTO ${o(K)}.${o(O)} (${c.join(", ")}) VALUES (${e.join(", ")})`;try{await (0,l.GW)("/api/mysql/query",{id:a,connectionString:b,sql:f,params:d}),ar(!1),at({}),aJ(O,ac,au,aw)}catch(a){alert(`Insert failed: ${a instanceof Error?a.message:String(a)}`)}},[O,U,as,a,b,K,aJ,ac,au,aw]),aO=(0,f.useCallback)(async()=>{if(0===ai.size||!aa||!O)return;let c=W.length>0?W:U.map(a=>a.name),d=0;for(let e of Array.from(ai).sort((a,b)=>b-a)){let f=aa.rows[e];if(!f)continue;let g=[],h=[];for(let a of c)null===f[a]||void 0===f[a]?g.push(`${o(a)} IS NULL`):(g.push(`${o(a)} = ?`),h.push(f[a]));let i=`DELETE FROM ${o(K)}.${o(O)} WHERE ${g.join(" AND ")} LIMIT 1`;try{await (0,l.GW)("/api/mysql/query",{id:a,connectionString:b,sql:i,params:h})}catch{d++}}aj(new Set),al(!1),aJ(O,ac,au,aw),d>0&&alert(C("mysql.deleteRowsFailed",{count:d}))},[ai,aa,O,W,U,a,b,K,aJ,ac,au,aw]),aP=(0,f.useCallback)(async c=>{if(!O)return;if(ai.size>0&&aa){let a,b=aa.fields.map(a=>a.name),d=Array.from(ai).sort((a,b)=>a-b).map(a=>aa.rows[a]).filter(Boolean);if("json"===c)a=JSON.stringify(d,null,2);else{let c=[b.join(",")];for(let a of d)c.push(b.map(b=>{let c=a[b];if(null==c)return"";let d="object"==typeof c?JSON.stringify(c):String(c);return d.includes(",")||d.includes('"')||d.includes("\n")?`"${d.replace(/"/g,'""')}"`:d}).join(","));a=c.join("\n")}navigator.clipboard.writeText(a);return}let d=`SELECT * FROM ${o(K)}.${o(O)}`;try{let e=await (0,l.HS)("/api/mysql/export",{id:a,connectionString:b,sql:d,format:c}),f=URL.createObjectURL(e),g=document.createElement("a");g.href=f,g.download=`${O}.${c}`,g.click(),URL.revokeObjectURL(f)}catch(a){alert(`Export failed: ${a instanceof Error?a.message:String(a)}`)}},[O,a,b,K,ai,aa]),aQ=(0,f.useCallback)(a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&(a.preventDefault(),aL())},[aL]),aR=g&&m?m-41:u??h.p,aS=Math.max(1,Math.ceil(ag/50)),aT=(0,f.useCallback)(a=>{O&&(ad(a),aJ(O,a,au,aw))},[O,aJ,au,aw]),aU=(0,f.useCallback)((a,b)=>{let c={...au};b?c[a]=b:delete c[a],av(c),ad(0),aj(new Set),O&&aJ(O,0,c,aw)},[au,aw,O,aJ]),aV=(0,f.useCallback)(()=>{av({}),ad(0),aj(new Set),O&&aJ(O,0,{},aw)},[aw,O,aJ]),aW=(0,f.useCallback)(a=>{ax(a),ad(0),aj(new Set),O&&aJ(O,0,au,a)},[au,O,aJ]);return(0,e.jsx)("div",{className:"flex flex-col items-start",children:(0,e.jsxs)("div",{className:`w-full bg-accent text-foreground
|
|
33
33
|
relative transition-colors cursor-pointer
|
|
34
34
|
${g?"rounded-none overflow-visible border-0":"border overflow-hidden rounded-2xl rounded-bl-md rounded-br-md"}
|
|
35
35
|
${g?"":d?"border-brand":"border-brand/30"}`,onClick:g?void 0:x,children:[(0,e.jsxs)("div",{"data-drag-handle":!0,onDoubleClick:z,onMouseDown:B,className:`flex items-center gap-2 px-4 py-1.5 border-b border-border ${g?"bg-card":"bg-card/50"}`,style:g?{height:41}:void 0,children:[(0,e.jsx)("span",{className:"text-sm flex-shrink-0",children:"\uD83D\uDC2C"}),(0,e.jsx)("span",{className:"text-xs text-foreground truncate font-mono font-medium",children:c}),"connecting"===E&&(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin flex-shrink-0"}),"error"===E&&(0,e.jsx)("span",{className:"text-[10px] text-destructive flex-shrink-0",children:C("mysql.connectionFailed")}),"connected"===E&&(0,e.jsx)("span",{className:"text-[10px] text-emerald-500 flex-shrink-0",children:C("mysql.connected")}),(0,e.jsx)("span",{className:"flex-1"}),A&&(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:n(A)}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),z()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:g?C("browser.exitMaximize",{modKey:(0,j.Mu)()}):C("browser.maximize",{modKey:(0,j.Mu)()}),children:g?(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3"})}):(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),y()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:C("common.close"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsxs)("div",{style:{height:aR},className:"flex overflow-hidden",children:["connecting"===E&&(0,e.jsxs)("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:[(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin mr-2"}),C("mysql.connecting")]}),"error"===E&&(0,e.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 p-4",children:[(0,e.jsx)("span",{className:"text-sm text-destructive text-center break-all",children:G}),(0,e.jsx)("button",{onClick:aH,className:"px-3 py-1.5 text-xs bg-brand text-white rounded-md hover:bg-brand/90 transition-colors",children:C("common.retry")})]}),"connected"===E&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"w-52 flex-shrink-0 border-r border-border flex flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"p-1.5 border-b border-border flex items-center gap-1",children:[I.length>1?(0,e.jsx)("select",{value:K,onChange:a=>{L(a.target.value),P(null)},className:"flex-1 min-w-0 text-xs bg-background border border-input rounded px-1.5 py-1",children:I.map(a=>(0,e.jsx)("option",{value:a,children:a},a))}):(0,e.jsx)("span",{className:"flex-1 min-w-0 text-xs text-muted-foreground truncate",children:K}),(0,e.jsx)("button",{onClick:aI,className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent active:bg-accent/50 transition-colors",title:C("mysql.refreshTableList"),children:(0,e.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("path",{d:"M1 1v5h5"}),(0,e.jsx)("path",{d:"M15 15v-5h-5"}),(0,e.jsx)("path",{d:"M13.5 6A6 6 0 0 0 3.2 3.2L1 6"}),(0,e.jsx)("path",{d:"M2.5 10a6 6 0 0 0 10.3 2.8L15 10"})]})})]}),(0,e.jsx)("div",{className:"flex items-center border-b border-border",children:["table","view"].map(a=>(0,e.jsx)("button",{onClick:()=>R(a),className:`flex-1 py-1 text-[10px] font-medium transition-colors ${Q===a?"text-brand border-b border-brand":"text-muted-foreground hover:text-foreground"}`,children:{table:C("mysql.filterTable"),view:C("mysql.filterView")}[a]},a))}),(0,e.jsxs)("div",{className:"flex-1 overflow-y-auto text-xs",children:[M.filter(a=>"table"===Q?"view"!==a.type:"view"===a.type).map(a=>(0,e.jsxs)("div",{onClick:()=>aK(a.name),className:`flex items-center gap-1.5 px-2 py-1 cursor-pointer truncate transition-colors ${O===a.name?"bg-brand/10 text-brand":"hover:bg-accent text-foreground"}`,children:[(0,e.jsx)("span",{className:"flex-shrink-0 text-[10px] text-muted-foreground",children:"view"===a.type?"V":"T"}),(0,e.jsx)("span",{className:"truncate min-w-0 flex-1",children:(0,e.jsx)(r,{text:a.name})}),(0,e.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground flex-shrink-0",children:a.rowEstimate>0?`~${a.rowEstimate}`:""})]},a.name)),0===M.length&&(0,e.jsx)("div",{className:"p-2 text-muted-foreground text-center",children:C("mysql.noTables")})]})]}),(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-0 border-b border-border bg-card/30 flex-shrink-0",children:[["structure","data","sql"].map(a=>(0,e.jsx)("button",{onClick:()=>T(a),className:`px-3 py-1.5 text-xs transition-colors ${S===a?"text-brand border-b-2 border-brand font-medium":"text-muted-foreground hover:text-foreground"}`,children:{structure:C("mysql.tabStructure"),data:C("mysql.tabData"),sql:"SQL"}[a]},a)),O&&"data"===S&&(0,e.jsxs)("div",{className:"ml-auto flex items-center gap-1 pr-2",children:[Object.values(au).some(a=>a.enabled)&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-[10px] text-brand",children:C("mysql.filterActive",{count:Object.values(au).filter(a=>a.enabled).length})}),(0,e.jsx)("button",{onClick:aV,className:"px-1 py-0.5 text-[10px] text-muted-foreground hover:text-foreground transition-colors",title:C("mysql.clearAllFilters"),children:"✕"}),(0,e.jsx)("span",{className:"text-border",children:"|"})]}),ai.size>0&&!ak&&(0,e.jsx)("button",{onClick:()=>al(!0),className:"px-1.5 py-0.5 text-[10px] text-destructive hover:text-destructive/80 bg-destructive/10 rounded transition-colors",children:C("mysql.deleteNRows",{count:ai.size})}),ak&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-[10px] text-destructive",children:C("mysql.confirmDeleteRows")}),(0,e.jsx)("button",{onClick:aO,className:"px-1.5 py-0.5 text-[10px] text-white bg-destructive rounded transition-colors hover:bg-destructive/80",children:C("common.confirm")}),(0,e.jsx)("button",{onClick:()=>al(!1),className:"px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground bg-muted rounded transition-colors",children:C("common.cancel")})]}),(0,e.jsx)("button",{onClick:()=>aP("csv"),className:"px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground bg-muted rounded transition-colors",title:ai.size>0?C("mysql.copyCsvSelected"):C("mysql.copyCsvAll"),children:ai.size>0?C("mysql.copyCSV"):C("mysql.CSV")}),(0,e.jsx)("button",{onClick:()=>aP("json"),className:"px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground bg-muted rounded transition-colors",title:ai.size>0?C("mysql.copyJsonSelected"):C("mysql.copyJsonAll"),children:ai.size>0?C("mysql.copyJSON"):C("mysql.JSON")})]})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:O||"sql"===S?"structure"===S?(0,e.jsx)(t,{columns:U,primaryKeys:W,foreignKeys:Y,indexes:$}):"data"===S?(0,e.jsx)(v,{result:aa,loading:ae,columns:U,page:ac,totalPages:aS,totalRows:ag,onPageChange:aT,filters:au,sort:aw,onFilterChange:aU,onSortChange:aW,selectedRows:ai,onSelectedRowsChange:a=>{aj(a),al(!1)},editingRowIdx:am,editValues:ao,onStartEdit:a=>{if(!aa)return;let b=aa.rows[a],c={};for(let a of U)c[a.name]=null==b[a.name]?"":q(b[a.name]);ap(c),an(a)},onEditChange:(a,b)=>ap(c=>({...c,[a]:b})),onSaveEdit:aM,onCancelEdit:()=>an(null),isAddingRow:aq,newRowValues:as,onStartAdd:()=>{ar(!0),at({})},onNewRowChange:(a,b)=>at(c=>({...c,[a]:b})),onSaveNewRow:aN,onCancelAdd:()=>{ar(!1),at({})},onCellCopy:a=>{navigator.clipboard.writeText(a),D(C("common.copied"))}}):(0,e.jsx)(w,{sqlInput:ay,onSqlChange:az,onExecute:aL,onKeyDown:aQ,result:aA,error:aC,loading:aE,sqlRef:aG,onCellCopy:a=>{navigator.clipboard.writeText(a),D(C("common.copied"))}}):(0,e.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:C("mysql.selectTable")})})]})]})]}),!g&&(0,e.jsxs)("div",{className:"border-t border-border px-4 py-1.5 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${"connected"===E?"bg-green-500":"error"===E?"bg-red-500":"bg-yellow-500 animate-pulse"}`}),(0,e.jsx)("span",{children:{connecting:C("common.connecting"),connected:C("common.connected"),error:C("common.connectionFailed")}[E]}),"connected"===E&&O&&(0,e.jsx)("span",{className:"text-muted-foreground/70",children:O}),(0,e.jsx)("span",{className:"flex-1"}),A&&(0,e.jsx)("span",{className:"text-[11px] flex-shrink-0",children:n(A)})]})]})})}function t({columns:a,primaryKeys:b,foreignKeys:c,indexes:d}){let{t:f}=(0,k.Bd)();return 0===a.length?(0,e.jsx)("div",{className:"p-4 text-sm text-muted-foreground",children:f("mysql.selectTableToView")}):(0,e.jsxs)("div",{className:"p-2 space-y-3",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wide px-1 mb-1",children:f("mysql.columns")}),(0,e.jsxs)("table",{className:"w-full text-xs",children:[(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{className:"text-left text-muted-foreground border-b border-border",children:[(0,e.jsx)("th",{className:"px-1.5 py-1 font-medium",children:f("mysql.colName")}),(0,e.jsx)("th",{className:"px-1.5 py-1 font-medium",children:f("mysql.colType")}),(0,e.jsx)("th",{className:"px-1.5 py-1 font-medium",children:f("mysql.colNullable")}),(0,e.jsx)("th",{className:"px-1.5 py-1 font-medium",children:f("mysql.colDefault")})]})}),(0,e.jsx)("tbody",{children:a.map(a=>(0,e.jsxs)("tr",{className:"border-b border-border/50 hover:bg-accent/50",children:[(0,e.jsxs)("td",{className:"px-1.5 py-1 font-mono",children:[a.isPrimaryKey&&(0,e.jsx)("span",{className:"text-amber-500 mr-1",title:f("mysql.primaryKey"),children:"\uD83D\uDD11"}),a.name]}),(0,e.jsxs)("td",{className:"px-1.5 py-1 text-muted-foreground font-mono",children:[a.type,a.maxLength?`(${a.maxLength})`:""]}),(0,e.jsx)("td",{className:"px-1.5 py-1 text-muted-foreground",children:a.nullable?"YES":"NO"}),(0,e.jsx)("td",{className:"px-1.5 py-1 text-muted-foreground font-mono truncate max-w-[120px]",children:a.default||""})]},a.name))})]})]}),c.length>0&&(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wide px-1 mb-1",children:f("mysql.foreignKeys")}),(0,e.jsx)("div",{className:"space-y-0.5",children:c.map((a,b)=>(0,e.jsxs)("div",{className:"text-xs font-mono px-1.5 text-muted-foreground",children:[a.column," → ",a.refSchema,".",a.refTable,".",a.refColumn]},b))})]}),d.length>0&&(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wide px-1 mb-1",children:f("mysql.indexes")}),(0,e.jsx)("div",{className:"space-y-0.5",children:d.map(a=>(0,e.jsx)("div",{className:"text-xs font-mono px-1.5 text-muted-foreground truncate",title:a.definition,children:a.name},a.name))})]})]})}function u({filter:a,onApply:b,onClear:c,onToggle:d,onClose:h,colName:i,anchorRect:j}){let{t:l}=(0,k.Bd)(),[m,n]=(0,f.useState)(a?.op||"="),[o,p]=(0,f.useState)(a?.value||""),q=(0,f.useRef)(null),r=(0,g.F2)(),s="IS NULL"!==m&&"IS NOT NULL"!==m,t=()=>{(!s||o.trim())&&b({op:m,value:o.trim(),enabled:!0})},v=r?.getBoundingClientRect(),w=v?.left??0,y=v?.top??0,z=v?.width??1e3,A=j.left-w;A+220>z-8&&(A=z-220-8),A<8&&(A=8);let B=j.bottom+2-y;return(0,e.jsx)(g.ZL,{children:(0,e.jsxs)("div",{ref:q,className:"fixed z-[9998] w-[220px] bg-popover border border-border rounded-md shadow-lg p-2 space-y-2",style:{left:A,top:B},onClick:a=>a.stopPropagation(),children:[a&&(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("label",{className:"flex items-center gap-1.5 text-[10px] text-muted-foreground cursor-pointer",children:[(0,e.jsx)("input",{type:"checkbox",checked:a.enabled,onChange:a=>d(a.target.checked),className:"w-3 h-3 accent-brand"}),l("mysql.enable")]}),(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground font-mono truncate max-w-[120px]",children:i})]}),(0,e.jsx)("select",{value:m,onChange:a=>n(a.target.value),className:"w-full text-xs bg-background border border-input rounded px-1.5 py-1 focus:outline-none focus:ring-1 focus:ring-ring",children:x.map(a=>(0,e.jsx)("option",{value:a.value,children:a.label},a.value))}),s&&(0,e.jsx)("input",{type:"text",value:o,onChange:a=>p(a.target.value),onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),t())},placeholder:l("IN"===m?"mysql.commaValues":"LIKE"===m?"mysql.likePattern":"mysql.valuePlaceholder"),className:"w-full text-xs bg-background border border-input rounded px-1.5 py-1 font-mono focus:outline-none focus:ring-1 focus:ring-ring",autoFocus:!0}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("button",{onClick:t,disabled:s&&!o.trim(),className:"flex-1 px-2 py-1 text-[10px] bg-brand text-white rounded hover:bg-brand/90 disabled:opacity-40 transition-colors",children:l("mysql.apply")}),a&&(0,e.jsx)("button",{onClick:c,className:"flex-1 px-2 py-1 text-[10px] text-muted-foreground bg-muted rounded hover:text-foreground transition-colors",children:l("mysql.clearFilter")})]})]})})}function v({result:a,loading:b,columns:c,page:d,totalPages:g,totalRows:h,onPageChange:i,filters:j,sort:l,onFilterChange:m,onSortChange:n,selectedRows:o,onSelectedRowsChange:p,editingRowIdx:s,editValues:t,onStartEdit:w,onEditChange:x,onSaveEdit:y,onCancelEdit:z,isAddingRow:A,newRowValues:B,onStartAdd:C,onNewRowChange:D,onSaveNewRow:E,onCancelAdd:F,onCellCopy:G}){let{t:H}=(0,k.Bd)(),[I,J]=(0,f.useState)(null),[K,L]=(0,f.useState)({left:0,bottom:0});if(!a&&!b)return(0,e.jsx)("div",{className:"p-4 text-sm text-muted-foreground",children:H("mysql.selectTableForData")});let M=a?.fields||[],N=a?.rows||[],O={};for(let a of c)O[a.name]=a.type+(a.maxLength?`(${a.maxLength})`:"");let P=N.length>0&&o.size===N.length,Q=o.size>0&&!P;return(0,e.jsxs)("div",{className:"flex flex-col h-full",children:[(0,e.jsxs)("div",{className:"flex-1 overflow-auto relative",children:[b&&(0,e.jsx)("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center z-10",children:(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"})}),(0,e.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,e.jsx)("thead",{className:"sticky top-0 bg-card z-[2]",children:(0,e.jsxs)("tr",{children:[(0,e.jsx)("th",{className:"px-1 py-1 border-b border-border w-8 text-center",children:(0,e.jsx)("input",{type:"checkbox",checked:P,ref:a=>{a&&(a.indeterminate=Q)},onChange:()=>{P?p(new Set):p(new Set(N.map((a,b)=>b)))},className:"w-3 h-3 accent-brand cursor-pointer"})}),M.map(a=>{let b=l?.column===a.name?l.dir:null,c=j[a.name],d=c?.enabled;return(0,e.jsxs)("th",{className:"px-1.5 py-1 text-left text-muted-foreground font-medium border-b border-border whitespace-nowrap font-mono relative",children:[(0,e.jsxs)("span",{className:"cursor-pointer select-none hover:text-foreground transition-colors",onClick:()=>{var b;return b=a.name,void(l?.column===b?"ASC"===l.dir?n({column:b,dir:"DESC"}):n(null):n({column:b,dir:"ASC"}))},children:[a.name,O[a.name]&&(0,e.jsx)("span",{className:"ml-1 text-[9px] text-muted-foreground/60 font-normal",children:O[a.name]}),"ASC"===b&&(0,e.jsx)("span",{className:"ml-0.5 text-brand",children:"↑"}),"DESC"===b&&(0,e.jsx)("span",{className:"ml-0.5 text-brand",children:"↓"})]}),(0,e.jsx)("button",{onClick:b=>{if(b.stopPropagation(),I===a.name)return void J(null);let c=b.currentTarget.closest("th").getBoundingClientRect();L({left:c.left,bottom:c.bottom}),J(a.name)},className:`ml-1 inline-flex items-center transition-colors ${d?"text-brand":"text-muted-foreground/40 hover:text-muted-foreground"}`,children:(0,e.jsx)("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 16 16",fill:"currentColor",children:(0,e.jsx)("path",{d:"M1 2h14l-5.5 6.5V14l-3-2v-3.5z"})})}),I===a.name&&(0,e.jsx)(u,{filter:c||null,onApply:b=>{m(a.name,b),J(null)},onClear:()=>{m(a.name,null),J(null)},onToggle:b=>{c&&m(a.name,{...c,enabled:b})},onClose:()=>J(null),colName:a.name,anchorRect:K})]},a.name)})]})}),(0,e.jsxs)("tbody",{children:[A&&(0,e.jsxs)("tr",{className:"bg-emerald-500/5",children:[(0,e.jsx)("td",{className:"px-1 py-0.5 border-b border-border text-center",children:(0,e.jsxs)("div",{className:"flex gap-0.5 justify-center",children:[(0,e.jsx)("button",{onClick:E,className:"text-[10px] text-emerald-500 hover:text-emerald-400",title:H("common.save"),children:"✓"}),(0,e.jsx)("button",{onClick:F,className:"text-[10px] text-muted-foreground hover:text-foreground",title:H("common.cancel"),children:"✕"})]})}),M.map(a=>(0,e.jsx)("td",{className:"px-0.5 py-0.5 border-b border-border",children:(0,e.jsx)("input",{type:"text",value:B[a.name]??"",onChange:b=>D(a.name,b.target.value),className:"w-full px-1 py-0.5 text-xs bg-background border border-input rounded font-mono min-w-[60px]",placeholder:"NULL"})},a.name))]}),N.map((a,b)=>(0,e.jsxs)("tr",{className:`hover:bg-accent/50 ${o.has(b)?"bg-brand/5":""} ${s===b?"bg-blue-500/5":""}`,children:[(0,e.jsx)("td",{className:"px-1 py-0.5 border-b border-border/50 text-center",children:s===b?(0,e.jsxs)("div",{className:"flex gap-0.5 justify-center",children:[(0,e.jsx)("button",{onClick:y,className:"text-[10px] text-emerald-500 hover:text-emerald-400",title:H("common.save"),children:"✓"}),(0,e.jsx)("button",{onClick:z,className:"text-[10px] text-muted-foreground hover:text-foreground",title:H("common.cancel"),children:"✕"})]}):(0,e.jsx)("input",{type:"checkbox",checked:o.has(b),onChange:()=>{let a;(a=new Set(o)).has(b)?a.delete(b):a.add(b),p(a)},className:"w-3 h-3 accent-brand cursor-pointer"})}),M.map(c=>(0,e.jsx)("td",{className:"px-1.5 py-0.5 border-b border-border/50 font-mono whitespace-nowrap max-w-[200px] truncate",onDoubleClick:()=>{null===s&&w(b)},onContextMenu:b=>{b.preventDefault(),G(q(a[c.name]))},children:s===b?(0,e.jsx)("input",{type:"text",value:t[c.name]??"",onChange:a=>x(c.name,a.target.value),className:"w-full px-1 py-0.5 text-xs bg-background border border-input rounded font-mono min-w-[60px]"}):null===a[c.name]||void 0===a[c.name]?(0,e.jsx)("span",{className:"text-muted-foreground italic",children:"NULL"}):(0,e.jsx)(r,{text:q(a[c.name])})},c.name))]},b))]})]}),0===N.length&&!b&&(0,e.jsx)("div",{className:"p-4 text-xs text-muted-foreground text-center",children:H("common.noData")})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between px-2 py-1 border-t border-border text-[10px] text-muted-foreground bg-card/30 flex-shrink-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{onClick:C,disabled:A,className:"px-1.5 py-0.5 text-[10px] text-emerald-500 hover:text-emerald-400 disabled:opacity-30",children:H("mysql.addRow")}),(0,e.jsx)("span",{children:H("mysql.totalRows",{count:h})}),a?.duration!==void 0&&(0,e.jsxs)("span",{children:[a.duration,"ms"]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("button",{onClick:()=>i(d-1),disabled:0===d,className:"px-1 py-0.5 hover:text-foreground disabled:opacity-30",children:"◀"}),(0,e.jsxs)("span",{children:[d+1," / ",g]}),(0,e.jsx)("button",{onClick:()=>i(d+1),disabled:d>=g-1,className:"px-1 py-0.5 hover:text-foreground disabled:opacity-30",children:"▶"})]})]})]})}function w({sqlInput:a,onSqlChange:b,onExecute:c,onKeyDown:d,result:f,error:g,loading:h,sqlRef:i,onCellCopy:l}){let{t:m}=(0,k.Bd)();return(0,e.jsxs)("div",{className:"flex flex-col h-full",children:[(0,e.jsxs)("div",{className:"flex-shrink-0 p-2 border-b border-border",children:[(0,e.jsx)("textarea",{ref:i,value:a,onChange:a=>b(a.target.value),onKeyDown:d,placeholder:m("mysql.sqlPlaceholder",{modKey:(0,j.Mu)()}),className:"w-full h-20 px-2 py-1.5 text-xs font-mono bg-background border border-input rounded resize-y focus:outline-none focus:ring-1 focus:ring-ring",spellCheck:!1}),(0,e.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,e.jsx)("button",{onClick:c,disabled:h||!a.trim(),className:"px-2 py-1 text-xs bg-brand text-white rounded hover:bg-brand/90 disabled:opacity-50 transition-colors",children:m(h?"mysql.executing":"mysql.execute")}),f?.duration!==void 0&&(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[f.command&&!f.fields?m("mysql.rowsAffected",{command:f.command,count:f.rowCount,duration:f.duration}):m("mysql.queryRows",{count:f.rows?.length??0,duration:f.duration}),f.truncated&&` ${m("mysql.resultTruncated")}`]})]})]}),g&&(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-destructive bg-destructive/5 border-b border-border break-all",children:g}),f?.fields&&f.rows&&(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:(0,e.jsxs)("table",{className:"w-full text-xs border-collapse",children:[(0,e.jsx)("thead",{className:"sticky top-0 bg-card z-[1]",children:(0,e.jsx)("tr",{children:f.fields.map(a=>(0,e.jsx)("th",{className:"px-1.5 py-1 text-left text-muted-foreground font-medium border-b border-border whitespace-nowrap font-mono",children:a.name},a.name))})}),(0,e.jsx)("tbody",{children:f.rows.map((a,b)=>(0,e.jsx)("tr",{className:"hover:bg-accent/50",children:f.fields.map(b=>(0,e.jsx)("td",{className:"px-1.5 py-0.5 border-b border-border/50 font-mono whitespace-nowrap max-w-[200px] truncate",onContextMenu:c=>{c.preventDefault(),l(q(a[b.name]))},children:null===a[b.name]||void 0===a[b.name]?(0,e.jsx)("span",{className:"text-muted-foreground italic",children:"NULL"}):(0,e.jsx)(r,{text:q(a[b.name])})},b.name))},b))})]})})]})}d()}catch(a){d(a)}})},77120:(a,b,c)=>{"use strict";c.d(b,{SessionBrowser:()=>k});var d=c(48249),e=c(67484),f=c(44384),g=c(57031),h=c(88214),i=c(33281),j=c(65484);function k({isOpen:a,onClose:b,onSelectSession:c,onAddProject:l}){let{t:m}=(0,f.Bd)(),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)([]),[r,s]=(0,e.useState)({}),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)(null),[x,y]=(0,e.useState)(""),z=(0,e.useRef)(null);(0,e.useCallback)(async()=>{u(!0),w(null),s({});let a=await i.t4.runPromiseExit((0,j.H7)());"Success"===a._tag?q(a.value):w("Failed to load projects"),u(!1)},[]);let A=(0,e.useCallback)(async a=>{s(b=>({...b,[a]:{...b[a],isExpanded:!0,isLoading:!0,sessions:[],error:null}}));let b=await i.t4.runPromiseExit((0,j.QW)(a));"Success"===b._tag?s(c=>({...c,[a]:{...c[a],isLoading:!1,sessions:b.value}})):s(b=>({...b,[a]:{...b[a],isLoading:!1,error:"Failed to load sessions"}}))},[]),B=(0,e.useCallback)(a=>{let b=r[a];b?.isExpanded?s(b=>({...b,[a]:{...b[a],isExpanded:!1}})):b?.sessions?.length?s(b=>({...b,[a]:{...b[a],isExpanded:!0}})):A(a)},[r,A]),C=(0,e.useCallback)(async()=>{if(n)return;o(!0);let a=await i.t4.runPromiseExit((0,j.It)());"Success"===a._tag&&a.value.folder&&l&&(l(a.value.folder),b()),o(!1)},[n,l,b]);return a?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:b}),(0,d.jsxs)("div",{className:"relative w-full max-w-6xl h-[90vh] mx-4 bg-card rounded-lg shadow-xl flex flex-col overflow-hidden",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,d.jsx)("h2",{className:"text-sm font-medium text-foreground",children:m("sessions.projectList")}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("input",{ref:z,type:"text",placeholder:m("workspace.searchProjectPath"),value:x,onChange:a=>y(a.target.value),className:"px-2 py-1 text-xs border border-border rounded bg-card text-foreground placeholder-slate-9 focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"}),l&&(0,d.jsxs)("button",{onClick:C,disabled:n,className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-accent transition-colors disabled:opacity-50",title:m("sessions.openFolder"),children:[(0,d.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 10v6m3-3H9m-4 7h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),n?m("sessions.selectingFolder"):m("sessions.openFolder")]}),(0,d.jsx)("button",{onClick:b,className:"p-1 text-slate-9 hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto p-4",children:[t&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,d.jsxs)("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,d.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,d.jsx)("span",{children:m("workspace.loadingProjects")})]})}),v&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsx)("div",{className:"text-xs text-red-11",children:v})}),!t&&!v&&0===p.length&&(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsx)("div",{className:"text-xs text-muted-foreground",children:m("workspace.projectNotFound")})}),!t&&!v&&p.filter(a=>a.fullPath.toLowerCase().includes(x.toLowerCase())).map(a=>{let b=r[a.encodedPath]||{isExpanded:!1,isLoading:!1,sessions:[],error:null};return(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsxs)("button",{onClick:()=>B(a.encodedPath),className:"w-full flex items-center gap-2 p-2 rounded hover:bg-accent transition-colors text-left",children:[(0,d.jsx)("svg",{className:`w-3 h-3 text-muted-foreground transition-transform ${b.isExpanded?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,d.jsx)("svg",{className:"w-4 h-4 text-muted-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),(0,d.jsx)("span",{className:"flex-1 text-xs font-medium text-foreground truncate",title:a.fullPath,children:a.fullPath}),(0,d.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",a.sessionCount,")"]})]}),b.isExpanded&&(0,d.jsxs)("div",{className:"ml-6 mt-2",children:[b.isLoading&&(0,d.jsxs)("div",{className:"flex items-center gap-2 p-3 text-xs text-muted-foreground",children:[(0,d.jsxs)("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,d.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,d.jsx)("span",{children:m("sessions.loadingSessions")})]}),b.error&&(0,d.jsx)("div",{className:"p-3 text-xs text-red-11",children:b.error}),!b.isLoading&&!b.error&&(0,d.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:b.sessions.map(b=>(0,d.jsxs)("div",{onClick:()=>{var d;let e;return d=a.fullPath,e=(b.path.split("/").pop()||"").replace(".jsonl",""),void(c?c(d,e):(0,g.F)(h.n.OpenProject,{cwd:d,sessionId:e}))},className:"p-3 bg-secondary rounded border border-border hover:border-brand hover:shadow-md cursor-pointer transition-all",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[b.engine&&"claude"!==b.engine&&(0,d.jsx)("span",{className:`shrink-0 px-1 py-0.5 text-[10px] leading-none font-medium rounded ${"claude2"===b.engine?"bg-orange-500/15 text-orange-11":"ollama"===b.engine?"bg-blue-500/15 text-blue-11":"codex"===b.engine?"bg-green-500/15 text-green-11":"kimi"===b.engine?"bg-purple-500/15 text-purple-11":"bg-muted text-muted-foreground"}`,children:b.engine}),(0,d.jsx)("h4",{className:"text-xs font-medium text-foreground truncate",title:b.title,children:b.title})]}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground mb-2",children:new Date(b.modifiedAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}),(0,d.jsxs)("div",{className:"space-y-0.5 text-xs",children:[b.firstMessages.map((a,b)=>(0,d.jsxs)("div",{className:"text-foreground truncate",title:a,children:[(0,d.jsx)("span",{className:"text-slate-9 mr-1",children:"•"}),a]},`first-${b}`)),b.lastMessages.length>0&&(0,d.jsx)("div",{className:"text-slate-9 text-center py-0.5",children:"\xb7\xb7\xb7"}),b.lastMessages.map((a,b)=>(0,d.jsxs)("div",{className:"text-foreground truncate",title:a,children:[(0,d.jsx)("span",{className:"text-slate-9 mr-1",children:"•"}),a]},`last-${b}`))]})]},b.path))})]})]},a.encodedPath)})]})]})]}):null}},77220:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{SettingsModal:()=>o});var e=c(48249),f=c(67484),g=c(44384),h=c(83768),i=c(7833),j=c(28602),k=c(15105),l=c(33281),m=c(79606),n=c(65484);function o({isOpen:a,onClose:b}){let{t:c,i18n:d}=(0,g.Bd)(),{theme:p,setTheme:q}=(0,h.D)(),r=(0,k.G)(),[s,t]=(0,f.useState)(""),[u,v]=(0,f.useState)(""),[w,x]=(0,f.useState)("auto"),y=(0,f.useCallback)(a=>{x(a),l.t4.runFork((0,n.DZ)({language:a}).pipe(m.orElse(()=>m.void)));let b="auto"===a?navigator.language.startsWith("zh")?"zh":"en":a;d.changeLanguage(b)},[d]),z=r?"installed":"not-installed",A=r?.version??null;if(!a)return null;let B=[{value:"system",label:c("settings.themeSystem"),icon:"\uD83D\uDCBB"},{value:"light",label:c("settings.themeLight"),icon:"☀️"},{value:"dark",label:c("settings.themeDark"),icon:"\uD83C\uDF19"}];return(0,e.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,e.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:b}),(0,e.jsxs)("div",{className:"relative bg-card rounded-lg shadow-xl w-full max-w-md mx-4 overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-foreground",children:c("settings.title")}),(0,e.jsx)("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsxs)("div",{className:"p-4 space-y-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"block text-sm font-medium text-foreground mb-2",children:c("settings.theme")}),(0,e.jsx)("div",{className:"grid grid-cols-3 gap-2",children:B.map(a=>(0,e.jsxs)("button",{onClick:()=>q(a.value),className:`flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors ${p===a.value?"border-brand bg-brand/10 text-brand":"border-border hover:border-slate-6 text-muted-foreground hover:text-foreground"}`,children:[(0,e.jsx)("span",{className:"text-xl",children:a.icon}),(0,e.jsx)("span",{className:"text-xs font-medium",children:a.label})]},a.value))})]}),(0,e.jsx)("div",{className:"border-t border-border"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"block text-sm font-medium text-foreground mb-2",children:c("settings.language")}),(0,e.jsx)("div",{className:"grid grid-cols-3 gap-2",children:[{value:"auto",label:c("settings.languageAuto"),icon:"\uD83C\uDF10"},{value:"en",label:"English",icon:"\uD83C\uDDFA\uD83C\uDDF8"},{value:"zh",label:"中文",icon:"\uD83C\uDDE8\uD83C\uDDF3"}].map(a=>(0,e.jsxs)("button",{onClick:()=>y(a.value),className:`flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors ${w===a.value?"border-brand bg-brand/10 text-brand":"border-border hover:border-slate-6 text-muted-foreground hover:text-foreground"}`,children:[(0,e.jsx)("span",{className:"text-xl",children:a.icon}),(0,e.jsx)("span",{className:"text-xs font-medium",children:a.label})]},a.value))})]}),(0,e.jsx)("div",{className:"border-t border-border"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"block text-sm font-medium text-foreground mb-2",children:c("settings.browserExtension")}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${"installed"===z?"bg-green-500":"bg-slate-400"}`}),(0,e.jsxs)("span",{children:["installed"===z&&`${c("settings.extensionInstalled")}${A?` (v${A})`:""}`,"not-installed"===z&&c("settings.extensionNotInstalled")]})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:c("settings.extensionDescription")}),"installed"!==z&&(0,e.jsxs)("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded-md p-2 space-y-1",children:[(0,e.jsx)("p",{className:"font-medium text-foreground",children:c("settings.installSteps")}),(0,e.jsxs)("p",{children:[c("settings.step1")," ",(0,e.jsx)("code",{className:"px-1 py-0.5 bg-muted rounded text-foreground",children:"chrome://extensions"})]}),(0,e.jsx)("p",{children:c("settings.step2")}),(0,e.jsx)("p",{children:c("settings.step3")}),(0,j.L)()&&(0,e.jsx)("p",{dangerouslySetInnerHTML:{__html:c("settings.step4mac")}})]}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)("button",{onClick:()=>{let a=s||"chrome-extension";navigator.clipboard.writeText(a),(0,i.oR)(c("toast.copiedName",{name:a}))},className:"px-3 py-1.5 text-xs bg-brand text-white rounded-md hover:bg-brand/90 transition-colors",children:c("settings.copyExtensionPath")}),"installed"===z&&(0,e.jsx)("button",{onClick:()=>{r?.id&&window.chrome?.runtime?.sendMessage&&(window.chrome.runtime.sendMessage(r.id,{type:"reload"}),(0,i.oR)(c("toast.pluginReloading")))},className:"px-3 py-1.5 text-xs border border-border text-foreground rounded-md hover:bg-muted transition-colors",children:c("settings.reloadExtension")})]}),s&&(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground font-mono truncate",children:s})]})]}),(0,e.jsx)("div",{className:"border-t border-border"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"block text-sm font-medium text-foreground mb-2",children:c("settings.about")}),(0,e.jsxs)("div",{className:"text-xs text-muted-foreground space-y-1",children:[(0,e.jsxs)("p",{children:["Cockpit",u?` v${u}`:""]}),(0,e.jsx)("p",{className:"text-muted-foreground/60",children:"One seat. One AI. Everything under control."})]})]})]})]})]})}d()}catch(a){d(a)}})},77396:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{_:()=>h});var e=c(48249),f=c(22341),g=c(72529);function h({comments:a,startLine:b,endLine:c,lineHeight:d,bodyTopOffset:i,onCommentClick:j}){let k=new Map;for(let d of a){if(d.endLine<b||d.endLine>c)continue;let a=k.get(d.endLine);a?a.push(d):k.set(d.endLine,[d])}return 0===k.size?null:(0,e.jsx)("div",{className:"absolute top-0 right-0 bottom-0 w-6 pointer-events-none",children:Array.from(k.entries()).map(([a,c])=>{let h=i+(a-b)*d,k=c[0],l=c.length-1;return(0,e.jsx)(g.m,{content:1===c.length?k.content:`${c.length} comments — click to view`,children:(0,e.jsxs)("button",{onClick:a=>j(k,a),className:"pointer-events-auto absolute right-1 w-4 h-4 rounded-full bg-amber-9/70 hover:bg-amber-11 text-white flex items-center justify-center shadow-sm transition-colors",style:{top:`${h+d/2-8}px`},children:[(0,e.jsx)(f.A,{className:"w-2.5 h-2.5"}),l>0&&(0,e.jsx)("span",{className:"absolute -top-1 -right-1 bg-amber-11 text-white rounded-full text-[8px] leading-none w-3 h-3 flex items-center justify-center",children:l+1})]})},a)})})}d()}catch(a){d(a)}})},77462:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{TabManager:()=>C});var e=c(48249),f=c(67484),g=c(44384),h=c(67115),i=c(70151),j=c(6900),k=c(49950),l=c(32465),m=c(75513),n=c(94192),o=c(44256),p=c(37129),q=c(38878),r=c(3588),s=c(18946),t=c(29939),u=c(98982),v=c(13054),w=c(79606),x=c(23734),y=c(88214),z=c(33281),A=c(65484);c(37388);var B=a([p,m,q,r,s,i,k,j]);function C({initialCwd:a,initialSessionId:b}){let{t:c}=(0,g.Bd)(),[d,B]=(0,f.useState)("agent"),{tabs:D,activeTabId:E,activeTab:F,unreadTabs:G,dragTabIndex:H,dragOverTabIndex:I,closeTab:J,switchTab:K,handleSelectSession:L,handleNewTab:M,handleNewClaude2Tab:N,handleNewCodexTab:O,handleNewKimiTab:P,handleNewOllamaTab:Q,handleNewDeepseekTab:R,handleOpenSession:S,updateTabState:T,updateTabOllamaModel:U,updateTabDeepseekModel:V,handleTabDragStart:W,handleTabDragOver:X,handleTabDrop:Y,handleTabDragEnd:Z}=(0,p.useTabState)({initialCwd:a,initialSessionId:b,activeView:d}),{isPinned:$,pinSession:_,unpinSession:aa}=(0,u.P)(),{createTask:ab}=(0,v.n)(),ac=(0,f.useCallback)(a=>{let b=D.find(b=>b.id===a);return!!b?.sessionId&&$(b.sessionId)},[D,$]),ad=(0,f.useCallback)(b=>{let c=D.find(a=>a.id===b);c?.sessionId&&($(c.sessionId)?aa(c.sessionId):_(c.sessionId,c.cwd||a||"",c.title))},[D,$,_,aa,a]),[ae,af]=(0,f.useState)(!1),[ag,ah]=(0,f.useState)(!1),[ai,aj]=(0,f.useState)(!1),[ak,al]=(0,f.useState)(null),[am,an]=(0,f.useState)(!1),[ao,ap]=(0,f.useState)("tree"),[aq,ar]=(0,f.useState)(0),[as,at]=(0,f.useState)(null),[au,av]=(0,f.useState)(0),[aw,ax]=(0,f.useState)(!1);(0,f.useRef)(null);let ay=(0,f.useCallback)(b=>{B(b),a&&(z.t4.runFork((0,A.Yn)({cwd:a,settings:{activeView:b}}).pipe(w.orElse(()=>w.void))),z.t4.runFork(w.flatMap(x.d,c=>c.publish(y.n.ViewChange,{cwd:a,view:b}))))},[a]),az=(0,f.useCallback)(async()=>{if(!a)return;let b=await z.t4.runPromiseExit((0,A.b2)(a));if("Success"===b._tag){let c=b.value;if(an(!!c.isGitRepo),c.isGitRepo&&c.worktrees&&c.worktrees.length>0){let b=c.worktrees.find(b=>b.path===a);b&&al(b.branch)}}else console.error("Failed to load git info:",b.cause)},[a]),aA=(0,f.useCallback)(a=>{let{data:b}=a;b?.some(a=>"git"===a.type)&&az()},[az]);(0,t.h)({url:`/ws/watch?cwd=${encodeURIComponent(a||"")}`,onMessage:aA,enabled:!!a});let aB=(0,f.useCallback)(()=>{ap("status"),ar(a=>a+1),ay("explorer")},[ay]),aC=(0,f.useCallback)(a=>{at(a),av(a=>a+1),ay("explorer")},[ay]),aD=(0,f.useCallback)(()=>{a&&z.t4.runFork(w.flatMap(x.d,b=>b.publish(y.n.OpenNote,{cwd:a})))},[a]);return(0,e.jsx)(m.k_,{children:(0,e.jsx)(n.fY,{activeView:d,onViewChange:ay,children:(0,e.jsxs)("div",{className:"flex h-screen bg-card",children:[(0,e.jsxs)("div",{className:"flex-1 flex flex-col min-w-0",children:[(0,e.jsx)(q.TabManagerTopBar,{initialCwd:a,activeTab:F,isGitRepo:am,currentBranch:ak,onOpenWorktree:()=>ah(!0),onOpenProjectSessions:()=>af(!0),onOpenAliasManager:()=>aj(!0),onBranchSwitched:az}),aw&&(0,e.jsxs)("div",{className:"flex items-center justify-center gap-2 py-1 bg-brand/15 text-brand text-xs font-medium border-b border-brand/20",children:[(0,e.jsx)("span",{className:"animate-pulse",children:"●"}),c("console.screenshotting")]}),a?(0,e.jsxs)(n.c0,{children:[(0,e.jsx)("div",{className:"w-1/3 h-full flex flex-col overflow-hidden",children:(0,e.jsx)(o.a9,{children:(0,e.jsxs)("div",{className:"w-full h-full flex flex-col",children:[(0,e.jsx)(r.TabBar,{tabs:D,activeTabId:E,unreadTabs:G,dragTabIndex:H,dragOverTabIndex:I,isPinned:ac,onTogglePin:ad,onSwitchTab:K,onCloseTab:J,onNewTab:M,onNewClaude2Tab:N,onNewCodexTab:O,onNewKimiTab:P,onNewOllamaTab:Q,onNewDeepseekTab:R,onDragStart:W,onDragOver:X,onDrop:Y,onDragEnd:Z}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden relative",children:D.map(a=>(0,e.jsx)("div",{className:`h-full ${a.id===E?"block":"hidden"}`,children:(0,e.jsx)(s.X,{tabId:a.id,cwd:a.cwd,sessionId:a.sessionId,engine:a.engine,ollamaModel:a.ollamaModel,onOllamaModelChange:U,deepseekModel:a.deepseekModel,onDeepseekModelChange:V,isActive:a.id===E&&"agent"===d,onStateChange:T,onShowGitStatus:aB,onContentSearch:aC,onOpenNote:aD,onCreateScheduledTask:ab,onOpenSession:S})},a.id))})]})})}),(0,e.jsx)("div",{className:"w-1/3 h-full overflow-hidden",children:(0,e.jsx)(o.a9,{children:(0,e.jsx)(i.g,{onClose:()=>ay("agent"),cwd:a,initialTab:ao,tabSwitchTrigger:aq,initialSearchQuery:as,searchQueryTrigger:au})})}),(0,e.jsx)("div",{className:"w-1/3 h-full overflow-hidden",children:(0,e.jsx)(o.a9,{children:(0,e.jsx)(k.J,{cwd:a,tabId:"default",onOpenNote:aD})})})]}):(0,e.jsxs)("div",{className:"flex-1 flex flex-col overflow-hidden",children:[(0,e.jsx)(r.TabBar,{tabs:D,activeTabId:E,unreadTabs:G,dragTabIndex:H,dragOverTabIndex:I,isPinned:ac,onTogglePin:ad,onSwitchTab:K,onCloseTab:J,onNewTab:M,onNewClaude2Tab:N,onNewCodexTab:O,onNewKimiTab:P,onNewDeepseekTab:R,onDragStart:W,onDragOver:X,onDrop:Y,onDragEnd:Z}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden relative",children:D.map(a=>(0,e.jsx)("div",{className:`h-full ${a.id===E?"block":"hidden"}`,children:(0,e.jsx)(s.X,{tabId:a.id,cwd:a.cwd,sessionId:a.sessionId,engine:a.engine,ollamaModel:a.ollamaModel,onOllamaModelChange:U,deepseekModel:a.deepseekModel,onDeepseekModelChange:V,isActive:a.id===E,onStateChange:T,onCreateScheduledTask:ab,onOpenSession:S})},a.id))})]})]}),a&&(0,e.jsx)(h.Q,{isOpen:ae,onClose:()=>af(!1),cwd:a,onSelectSession:L}),a&&am&&(0,e.jsx)(j.x,{isOpen:ag,onClose:()=>ah(!1),cwd:a}),ai&&(0,e.jsx)(l.Y,{onClose:()=>aj(!1),onSave:()=>aj(!1)})]})})})}[p,m,q,r,s,i,k,j]=B.then?(await B)():B,d()}catch(a){d(a)}})},78335:()=>{},78684:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{o:()=>m});var e=c(48249),f=c(67484),g=c(36295),h=c(7833),i=c(28602),j=c(39712),k=c(74493),l=a([g,j]);function m({id:a,filePath:b,displayName:c,cwd:d,selected:l,maximized:n,expandedHeight:o,bubbleContentHeight:p,timestamp:q,onSelect:r,onClose:s,onToggleMaximize:t,onTitleMouseDown:u}){let{showToast:v}=(0,h.dj)(),[w,x]=(0,f.useState)([]),[y,z]=(0,f.useState)(!0),[A,B]=(0,f.useState)(null),[C,D]=(0,f.useState)(!1),[E,F]=(0,f.useState)(!1),[G,H]=(0,f.useState)(null),[I,J]=(0,f.useState)(null),[K,L]=(0,f.useState)("disconnected"),[M,N]=(0,f.useState)(null),O=(0,f.useRef)(null),P=(0,f.useRef)(new Map),Q=(0,f.useRef)(null),R=(0,f.useRef)(w);R.current=w;let S=(0,f.useCallback)(async()=>{z(!0),B(null);try{let a=await (0,k.GW)("/api/jupyter/load",{filePath:b,cwd:d});x(a.cells.map((a,b)=>({...a,index:b,isExecuting:!1}))),D(!1)}catch(a){B(a.message)}finally{z(!1)}},[b,d]),T=(0,f.useCallback)(async()=>{if(!E){F(!0);try{await (0,k.GW)("/api/jupyter/save",{filePath:b,cwd:d,cells:w.map(a=>({cell_type:a.cell_type,source:a.source,outputs:a.outputs,execution_count:a.execution_count,metadata:a.metadata}))}),D(!1),v("Saved","success")}catch(a){v(a.message,"error")}finally{F(!1)}}},[b,d,w,E,v]),U=(0,f.useCallback)(()=>{if(O.current&&O.current.readyState<=1)return;L("starting"),N(null);let b="https:"===window.location.protocol?"wss:":"ws:",c=new WebSocket(`${b}//${window.location.host}/ws/jupyter?bubbleId=${encodeURIComponent(a)}&cwd=${encodeURIComponent(d)}`);O.current=c,c.onopen=()=>{},c.onmessage=a=>{let b;try{b=JSON.parse(a.data)}catch{return}let c=b.type;if("ready"===c)L("idle"),N(null);else if("status"===c){let a=b.execution_state;"idle"===a?L("idle"):"busy"===a&&L("busy")}else if("output"===c){let a=b.msg_id,c=b.msg_type,d=b.content,e=P.current.get(a);if(void 0===e)return;x(a=>a.map((a,b)=>{if(b!==e)return a;let f={output_type:"execute_result"===c?"execute_result":"display_data"===c?"display_data":"update_display_data"===c?"update_display_data":"stream"===c?"stream":"error"===c?"error":"display_data"};return"stream"===c?(f.name=d.name,f.text=d.text):"error"===c?(f.ename=d.ename,f.evalue=d.evalue,f.traceback=d.traceback):(f.data=d.data,f.metadata=d.metadata,"execute_result"===c&&(f.execution_count=d.execution_count)),{...a,outputs:[...a.outputs,f]}}))}else if("kernel_error"===c)L("error"),N(b.message);else if("kernel_died"===c){for(let[,a]of(L("dead"),N("Kernel died"),P.current))x(b=>b.map((b,c)=>c===a?{...b,isExecuting:!1}:b));P.current.clear()}},c.onclose=()=>{"error"!==K&&"dead"!==K&&L("disconnected")},c.onerror=()=>{L("error")}},[a,d,K]),V=(0,f.useRef)(null),W=(0,f.useCallback)(a=>{let b=R.current[a];if(!b||"code"!==b.cell_type)return;if(!O.current||O.current.readyState!==WebSocket.OPEN){U();let b=setInterval(()=>{O.current?.readyState===WebSocket.OPEN&&(clearInterval(b),V.current?.(a))},200);setTimeout(()=>clearInterval(b),15e3);return}let c=`cell-${a}-${Date.now()}`;P.current.set(c,a),x(b=>b.map((b,c)=>c===a?{...b,outputs:[],isExecuting:!0,execution_count:null}:b)),O.current.send(JSON.stringify({type:"execute",msg_id:c,code:b.source})),setTimeout(()=>{P.current.has(c)&&(P.current.delete(c),x(b=>b.map((b,c)=>c===a?{...b,isExecuting:!1}:b)))},3e5)},[U]);V.current=W;let X=(0,f.useCallback)(()=>{let a=[...w.map((a,b)=>({cell:a,index:b})).filter(a=>"code"===a.cell.cell_type)],b=()=>{if(0===a.length)return;let{index:c}=a.shift();W(c);let d=setInterval(()=>{let a=R.current[c];a&&!a.isExecuting&&(clearInterval(d),b())},200)};b()},[w,W]),Y=(0,f.useCallback)(()=>{O.current?.send(JSON.stringify({type:"interrupt"}))},[]),Z=(0,f.useCallback)((a,b)=>{x(c=>c.map((c,d)=>d===a?{...c,source:b}:c)),D(!0)},[]),$=(0,f.useCallback)(a=>{x(b=>b.filter((b,c)=>c!==a)),D(!0),G===a&&H(null)},[G]),_=(0,f.useCallback)((a,b)=>{x(c=>{let d=[...c],e="up"===b?a-1:a+1;return e<0||e>=d.length?c:([d[a],d[e]]=[d[e],d[a]],d)}),D(!0),H("up"===b?a-1:a+1)},[]),aa=(0,f.useCallback)(a=>{x(b=>b.map((b,c)=>{if(c!==a)return b;let d="code"===b.cell_type?"markdown":"markdown"===b.cell_type?"raw":"code";return{...b,cell_type:d,outputs:"code"===d?b.outputs:[]}})),D(!0)},[]),ab=(0,f.useCallback)((a,b)=>{let c={index:0,cell_type:a,source:"",outputs:[],execution_count:null,metadata:{},isExecuting:!1};x(a=>{let d=[...a],e=void 0!==b?b+1:d.length;return d.splice(e,0,c),d}),D(!0);let d=void 0!==b?b+1:w.length;H(d),J(d)},[w.length]),ac=n&&o?o-41:p??g.p,ad=(0,f.useMemo)(()=>{switch(K){case"idle":return(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-emerald-500 inline-block",title:"Kernel idle"});case"busy":return(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-amber-500 animate-pulse inline-block",title:"Kernel busy"});case"starting":return(0,e.jsx)("span",{className:"w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin inline-block",title:"Starting kernel"});case"error":return(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-red-500 inline-block",title:M||"Kernel error"});case"dead":return(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-red-500 inline-block",title:"Kernel died"});default:return(0,e.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-500 inline-block",title:"Disconnected"})}},[K,M]);return(0,e.jsxs)("div",{className:`w-full bg-accent text-foreground
|
|
36
36
|
relative transition-colors cursor-pointer
|
|
37
37
|
${n?"rounded-none overflow-visible border-0":"border overflow-hidden rounded-2xl rounded-bl-md rounded-br-md"}
|
|
38
|
-
${n?"":l?"border-brand":"border-brand/30"}`,onClick:n?void 0:r,children:[(0,e.jsxs)("div",{"data-drag-handle":!0,onDoubleClick:t,onMouseDown:u,className:`flex items-center gap-2 px-4 py-1.5 border-b border-border ${n?"bg-card":"bg-card/50"}`,style:n?{height:41}:void 0,children:[(0,e.jsx)("span",{className:"text-sm flex-shrink-0",children:"\uD83D\uDCD3"}),(0,e.jsx)("span",{className:"text-xs text-foreground truncate font-mono font-medium",children:c}),ad,C&&(0,e.jsx)("span",{className:"text-[10px] text-amber-500 flex-shrink-0",children:"unsaved"}),(0,e.jsx)("span",{className:"flex-1"}),q&&(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:function(a){if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`}(q)}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),t()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:n?`Exit maximize (${(0,i.Mu)()}+M)`:`Maximize (${(0,i.Mu)()}+M)`,children:n?(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3"})}):(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),s()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:"Close",children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 px-3 py-1 border-b border-border/50 bg-surface-secondary/50 text-[11px]",children:[(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),X()},className:"px-1.5 py-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Run All",children:"▶ All"}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),Y()},className:"px-1.5 py-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Interrupt",disabled:"busy"!==K,children:"⬛ Stop"}),(0,e.jsx)("div",{className:"w-px h-3 bg-border/50 mx-1"}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),ab("code",G??w.length-1)},className:"px-1.5 py-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Add code cell",children:"+ Code"}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),ab("markdown",G??w.length-1)},className:"px-1.5 py-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Add markdown cell",children:"+ Md"}),(0,e.jsx)("div",{className:"w-px h-3 bg-border/50 mx-1"}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),T()},className:`px-1.5 py-0.5 rounded hover:bg-accent transition-colors ${C?"text-brand":"text-muted-foreground hover:text-foreground"}`,title:`Save (${(0,i.Mu)()}+S)`,disabled:E,children:E?"Saving...":"Save"}),(0,e.jsx)("span",{className:"flex-1"}),M&&(0,e.jsx)("span",{className:"text-[10px] text-red-400 truncate max-w-[50%]",title:M,children:M}),"dead"===K&&(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),U()},className:"px-1.5 py-0.5 rounded text-brand hover:bg-accent transition-colors",children:"Restart"})]}),(0,e.jsx)("div",{ref:Q,className:"overflow-y-auto",style:{height:ac-30},children:y?(0,e.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground text-sm",children:"Loading notebook..."}):A?(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 gap-2",children:[(0,e.jsx)("span",{className:"text-red-400 text-sm",children:A}),(0,e.jsx)("button",{onClick:S,className:"text-xs text-brand hover:underline",children:"Retry"})]}):0===w.length?(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 gap-2 text-muted-foreground text-sm",children:[(0,e.jsx)("span",{children:"Empty notebook"}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)("button",{onClick:()=>ab("code"),className:"text-xs text-brand hover:underline",children:"+ Code cell"}),(0,e.jsx)("button",{onClick:()=>ab("markdown"),className:"text-xs text-brand hover:underline",children:"+ Markdown cell"})]})]}):(0,e.jsxs)("div",{className:"flex flex-col gap-1 p-2",children:[w.map((a,b)=>(0,e.jsx)(j.w,{cell:a,isActive:G===b,isEditing:I===b,onSelect:()=>H(b),onEdit:()=>{H(b),J(b)},onStopEdit:()=>J(null),onSourceChange:a=>Z(b,a),onRun:()=>{"code"===a.cell_type&&W(b),b<w.length-1&&H(b+1)},onDelete:()=>$(b),onMoveUp:()=>_(b,"up"),onMoveDown:()=>_(b,"down"),onToggleType:()=>aa(b),isFirst:0===b,isLast:b===w.length-1},`${b}-${a.cell_type}`)),(0,e.jsxs)("div",{className:"flex justify-center gap-2 py-2 opacity-0 hover:opacity-100 transition-opacity",children:[(0,e.jsx)("button",{onClick:()=>ab("code",w.length-1),className:"text-[10px] text-muted-foreground hover:text-foreground px-2 py-0.5 rounded border border-border/50 hover:border-border transition-colors",children:"+ Code"}),(0,e.jsx)("button",{onClick:()=>ab("markdown",w.length-1),className:"text-[10px] text-muted-foreground hover:text-foreground px-2 py-0.5 rounded border border-border/50 hover:border-border transition-colors",children:"+ Markdown"})]})]})})]})}[g,j]=l.then?(await l)():l,d()}catch(a){d(a)}})},80532:(a,b,c)=>{"use strict";c.d(b,{Bz:()=>j,Hy:()=>g,L5:()=>h,hp:()=>i});var d=c(79606),e=c(71192);let f=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok){let a;try{a=(await c.json()).error}catch{}throw Error(a||`HTTP ${c.status}`)}return await c.json()},catch:c=>new e.uV({message:`${b?.method??"GET"} ${a} failed`,cause:c})}),g=()=>f("/api/skills"),h=a=>f("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})}),i=a=>f(`/api/skills/${encodeURIComponent(a)}`,{method:"DELETE"}),j=a=>f(`/api/skills/content?id=${encodeURIComponent(a)}`)},80983:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{K:()=>k});var e=c(48249),f=c(67484),g=c(44384),h=c(7833),i=c(61349),j=a([i]);i=(j.then?(await j)():j)[0];let l={Read:"\uD83D\uDCC4",Write:"✏️",Edit:"\uD83D\uDCDD",Bash:"\uD83D\uDCBB",Glob:"\uD83D\uDD0D",Grep:"\uD83D\uDD0E",WebFetch:"\uD83C\uDF10",WebSearch:"\uD83D\uDD0D"};function k({toolCall:a,cwd:b}){let c,{t:d}=(0,g.Bd)(),[j,m]=(0,f.useState)(!1),[n,o]=(0,f.useState)(null),p=l[a.name]||"\uD83D\uDD27",q=(c=a.input,"Bash"===a.name&&c.command&&"string"==typeof c.command?c.command:"Glob"===a.name&&c.pattern&&"string"==typeof c.pattern||"Grep"===a.name&&c.pattern&&"string"==typeof c.pattern?c.pattern:c.file_path&&"string"==typeof c.file_path?c.file_path:c.path&&"string"==typeof c.path?c.path:null),r="Glob"===a.name||"Grep"===a.name||"Bash"===a.name,s=q?r?q:(a=>{if(b&&a.startsWith(b)){let c=a.slice(b.length);return c.startsWith("/")?c.slice(1):c}let c=a.split("/");return c.length>2?".../"+c.slice(-2).join("/"):a})(q):null,t=b=>{let c="input"===b?d("toolCall.inputParams"):d("toolCall.resultLabel"),e="input"===b?JSON.stringify(a.input,null,2):"string"==typeof a.result?a.result:JSON.stringify(a.result,null,2);o({title:`${a.name}${s?` ${s}`:""} - ${c}`,content:e,toolName:a.name})};return(0,e.jsxs)("div",{className:"my-2 border border-border rounded-lg overflow-hidden bg-secondary",children:[(0,e.jsxs)("button",{onClick:()=>m(!j),className:"w-full px-3 py-2 flex items-center gap-2 text-left hover:bg-accent transition-colors",children:[(0,e.jsx)("span",{className:"text-base",children:p}),(0,e.jsx)("span",{className:"font-medium text-sm text-foreground flex-shrink-0",children:a.name}),s&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground truncate flex-1 min-w-0",title:q||"",children:s}),(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),q&&(navigator.clipboard.writeText(q),(0,h.oR)(d("common.copiedPath")))},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.stopPropagation(),q&&(navigator.clipboard.writeText(q),(0,h.oR)(d("common.copiedPath"))))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0 cursor-pointer",title:d("common.copyAbsPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),(0,e.jsxs)("span",{className:"ml-auto flex items-center gap-2",children:[j&&!a.isLoading&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),t("input")},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.stopPropagation(),t("input"))},className:"text-xs text-brand hover:text-teal-10 cursor-pointer",title:d("toolCall.inputParamsTitle"),children:d("toolCall.input")}),a.result&&(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),t("result")},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.stopPropagation(),t("result"))},className:"text-xs text-brand hover:text-teal-10 cursor-pointer",title:d("toolCall.resultTitle"),children:d("toolCall.result")})]}),a.isLoading?(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"}):(0,e.jsx)("span",{className:"text-slate-9 text-xs",children:j?"▲":"▼"})]})]}),j&&(0,e.jsxs)("div",{className:"border-t border-border",children:[(0,e.jsxs)("div",{className:"px-3 py-2",children:[(0,e.jsx)("div",{className:"mb-1",children:(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[d("toolCall.inputParams"),":"]})}),(0,e.jsx)("pre",{className:"text-xs bg-secondary p-2 rounded overflow-x-auto max-h-24 overflow-y-auto text-foreground",children:JSON.stringify(a.input,null,2)})]}),a.result&&(0,e.jsxs)("div",{className:"px-3 py-2 border-t border-border",children:[(0,e.jsx)("div",{className:"mb-1",children:(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[d("toolCall.resultLabel"),":"]})}),(0,e.jsx)("pre",{className:"text-xs bg-secondary p-2 rounded overflow-x-auto max-h-24 overflow-y-auto text-foreground",children:"string"==typeof a.result?a.result:JSON.stringify(a.result,null,2)})]})]}),n&&(0,e.jsx)(i.M,{title:n.title,content:n.content,toolName:n.toolName,onClose:()=>o(null)})]})}d()}catch(a){d(a)}})},81064:(a,b,c)=>{Promise.resolve().then(c.bind(c,81227))},81227:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/cockpit/cockpit/src/app/global-error.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/src/app/global-error.tsx","default")},83003:(a,b,c)=>{"use strict";c.d(b,{k:()=>i});var d=c(48249),e=c(67484),f=c(44384),g=c(44256);function h({image:a,onClose:b}){let{t:c}=(0,f.Bd)(),e=(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:b,children:(0,d.jsxs)("div",{className:"relative max-w-[90vw] max-h-[90vh]",children:[(0,d.jsx)("img",{src:a.preview,alt:c("imagePreview.previewImage"),className:"max-w-full max-h-[90vh] object-contain rounded-lg",onClick:a=>a.stopPropagation()}),(0,d.jsx)("button",{onClick:b,className:"absolute -top-3 -right-3 w-8 h-8 bg-card text-foreground hover:text-foreground rounded-full shadow-lg flex items-center justify-center transition-colors",title:c("common.close"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})});return(0,d.jsx)(g.ZL,{children:e})}function i({images:a,onRemove:b,disabled:c}){let{t:g}=(0,f.Bd)(),[j,k]=(0,e.useState)(null);return 0===a.length?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"flex flex-wrap gap-2 p-2 bg-secondary border-b border-border",children:a.map(a=>(0,d.jsxs)("div",{className:"relative group w-16 h-16 rounded-lg overflow-hidden border border-border cursor-pointer",onClick:()=>k(a),children:[(0,d.jsx)("img",{src:a.preview,alt:g("imagePreview.previewImage"),className:"w-full h-full object-cover hover:opacity-90 transition-opacity"}),(0,d.jsx)("button",{onClick:c=>{c.stopPropagation(),b(a.id)},className:"absolute top-0 right-0 w-5 h-5 bg-black/60 hover:bg-black/80 text-white text-xs flex items-center justify-center rounded-bl-lg opacity-0 group-hover:opacity-100 transition-opacity",title:g("imagePreview.deleteImage"),children:"✕"})]},a.id))}),j&&(0,d.jsx)(h,{image:j,onClose:()=>k(null)})]})}},83022:(a,b,c)=>{"use strict";c.d(b,{TabBar:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call TabBar() from the server but TabBar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/TabBar.tsx","TabBar")},83120:(a,b,c)=>{"use strict";c.d(b,{BL:()=>q,Gm:()=>n,JK:()=>l,Wr:()=>o,Y8:()=>t,Y_:()=>k,_c:()=>r,bx:()=>m,dU:()=>s,i7:()=>x,jw:()=>u,mu:()=>v,vy:()=>w,z1:()=>p});var d=c(79606),e=c(71192);let f=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`);return await c.json()},catch:c=>new e.uV({message:`${b?.method??"GET"} ${a} failed`,cause:c})}),g=(a,b)=>f(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),h=(a,b)=>f(a,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),i=(a,b)=>f(a,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),j=a=>f(a,{method:"DELETE"}),k=()=>f("/api/review"),l=a=>{let b;return b=`/api/review/${encodeURIComponent(a)}`,d.tryPromise({try:async()=>{let a=await fetch(b);if(404===a.status)throw Object.assign(Error("not found"),{__404__:!0});if(!a.ok)throw Error(`HTTP ${a.status}`);return await a.json()},catch:a=>a?.__404__?new e.m_({resource:"review",id:b}):new e.uV({message:`GET ${b} failed`,cause:a})})},m=a=>g("/api/review",a),n=(a,b)=>i(`/api/review/${encodeURIComponent(a)}`,b),o=a=>j(`/api/review/${encodeURIComponent(a)}`),p=a=>i("/api/review/order",{order:a}),q=()=>f("/api/review/users"),r=()=>f("/api/review/share-info"),s=(a,b)=>g(`/api/review/${encodeURIComponent(a)}/comments`,b),t=(a,b)=>h(`/api/review/${encodeURIComponent(a)}/comments`,b),u=(a,b)=>j(`/api/review/${encodeURIComponent(a)}/comments?commentId=${encodeURIComponent(b)}`),v=(a,b)=>g(`/api/review/${encodeURIComponent(a)}/replies`,b),w=(a,b)=>h(`/api/review/${encodeURIComponent(a)}/replies`,b),x=(a,b,c)=>j(`/api/review/${encodeURIComponent(a)}/replies?commentId=${encodeURIComponent(b)}&replyId=${encodeURIComponent(c)}`)},83179:(a,b,c)=>{"use strict";c.d(b,{NoteToolbar:()=>h});var d=c(48249),e=c(67484),f=c(44384);function g({editor:a,onClose:b,position:c}){let{t:h}=(0,f.Bd)(),[i,j]=(0,e.useState)(()=>a.getAttributes("link").href||""),k=(0,e.useRef)(null),l=()=>{let c=i.trim();if(c){let b=c.match(/^https?:\/\//)?c:`https://${c}`;a.chain().focus().extendMarkRange("link").setLink({href:b}).run()}else a.chain().focus().extendMarkRange("link").unsetLink().run();b()},m=c?{top:c.top,left:c.left}:{};return(0,d.jsxs)("div",{className:`${c?"fixed":"absolute top-full left-0 mt-1"} z-[60] bg-popover border border-border rounded-lg shadow-lg p-2 flex items-center gap-2`,style:m,children:[(0,d.jsx)("input",{ref:k,type:"text",value:i,onChange:a=>j(a.target.value),onKeyDown:a=>{"Enter"===a.key?(a.preventDefault(),l()):"Escape"===a.key&&(a.preventDefault(),b())},placeholder:h("editor.linkPlaceholder"),className:"bg-background border border-border rounded px-2 py-1 text-sm w-64 outline-none focus:border-brand"}),(0,d.jsx)("button",{onClick:l,className:"p-1 rounded text-sm font-medium text-brand hover:bg-brand/10 transition-colors",title:h("editor.confirmLink"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})})}),a.isActive("link")&&(0,d.jsx)("button",{onClick:()=>{a.chain().focus().extendMarkRange("link").unsetLink().run(),b()},className:"p-1 rounded text-sm font-medium text-red-500 hover:bg-red-500/10 transition-colors",title:h("editor.removeLink"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"})})})]})}function h({editor:a}){let{t:b}=(0,f.Bd)(),[c,i]=(0,e.useState)(!1),j=(0,e.useRef)(null),[,k]=(0,e.useState)(0);if(!a)return null;let l=a=>`p-1.5 rounded text-xs font-medium transition-colors ${a?"bg-brand/15 text-brand":"text-muted-foreground hover:text-foreground hover:bg-accent"}`,m="w-px h-5 bg-border mx-0.5",n=a.isActive("table");return(0,d.jsxs)("div",{className:"flex items-center gap-0.5 px-4 py-1.5 border-b border-border flex-shrink-0 flex-wrap",children:[(0,d.jsx)("button",{className:l(a.isActive("heading",{level:1})),onClick:()=>a.chain().focus().toggleHeading({level:1}).run(),title:b("editor.heading1"),children:"H1"}),(0,d.jsx)("button",{className:l(a.isActive("heading",{level:2})),onClick:()=>a.chain().focus().toggleHeading({level:2}).run(),title:b("editor.heading2"),children:"H2"}),(0,d.jsx)("button",{className:l(a.isActive("heading",{level:3})),onClick:()=>a.chain().focus().toggleHeading({level:3}).run(),title:b("editor.heading3"),children:"H3"}),(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:l(a.isActive("bold")),onClick:()=>a.chain().focus().toggleBold().run(),title:b("editor.bold"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z"})})}),(0,d.jsx)("button",{className:l(a.isActive("italic")),onClick:()=>a.chain().focus().toggleItalic().run(),title:b("editor.italic"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"})})}),(0,d.jsx)("button",{className:l(a.isActive("strike")),onClick:()=>a.chain().focus().toggleStrike().run(),title:b("editor.strikethrough"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"})})}),(0,d.jsx)("button",{className:l(a.isActive("code")),onClick:()=>a.chain().focus().toggleCode().run(),title:b("editor.inlineCode"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"})})}),(0,d.jsx)("div",{className:m}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("button",{ref:j,className:l(a.isActive("link")),onClick:()=>i(!c),title:b("editor.link"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"})})}),c&&(0,d.jsx)(g,{editor:a,onClose:()=>i(!1),position:null})]}),(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:l(a.isActive("bulletList")),onClick:()=>a.chain().focus().toggleBulletList().run(),title:b("editor.bulletList"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"})})}),(0,d.jsx)("button",{className:l(a.isActive("orderedList")),onClick:()=>a.chain().focus().toggleOrderedList().run(),title:b("editor.orderedList"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"})})}),(0,d.jsx)("button",{className:l(a.isActive("taskList")),onClick:()=>a.chain().focus().toggleTaskList().run(),title:b("editor.taskList"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zM17.99 9l-1.41-1.42-6.59 6.59-2.58-2.57-1.42 1.41 4 3.99z"})})}),(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:l(a.isActive("blockquote")),onClick:()=>a.chain().focus().toggleBlockquote().run(),title:b("editor.blockquote"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"})})}),(0,d.jsx)("button",{className:l(a.isActive("codeBlock")),onClick:()=>a.chain().focus().toggleCodeBlock().run(),title:b("editor.codeBlock"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M20 3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H4V5h16v14zm-7.5-4.5L15 12l-2.5-2.5L11 11l1.5 1.5L11 14l1.5 1.5zM9.5 14.5L7 12l2.5-2.5L11 11 9.5 12.5 11 14l-1.5.5z"})})}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),title:b("editor.table"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-9 15H4v-4h7v4zm0-6H4V7h7v4zm9 6h-7v-4h7v4zm0-6h-7V7h7v4z"})})}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().setHorizontalRule().run(),title:b("editor.horizontalRule"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M4 11h16v2H4z"})})}),n&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().addRowBefore().run(),title:b("editor.insertRowAbove"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v2h20V6c0-1.1-.9-2-2-2zm0 6H2v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V10zM11 17H4v-2h7v2zm0-4H4v-2h7v2zm9 4h-7v-2h7v2zm0-4h-7v-2h7v2z"}),(0,d.jsx)("path",{d:"M14 1h-4v2H8v2h2v2h4V5h2V3h-2z",opacity:".6"})]})}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().addRowAfter().run(),title:b("editor.insertRowBelow"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v10h20V6c0-1.1-.9-2-2-2zM11 12H4v-2h7v2zm0-4H4V6h7v2zm9 4h-7v-2h7v2zm0-4h-7V6h7v2z"}),(0,d.jsx)("path",{d:"M14 19h-4v2H8v2h2v-2h4v2h2v-2h-2z",opacity:".6"})]})}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().addColumnBefore().run(),title:b("editor.insertColumnLeft"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M6 4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h2V4H6zm4 0v20h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H10zm7 11H10v-2h7v2zm0-4H10V9h7v2z"}),(0,d.jsx)("path",{d:"M1 14v-4h2V8h2v2h-2v4h2v2H3v-2z",opacity:".6"})]})}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().addColumnAfter().run(),title:b("editor.insertColumnRight"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M4 4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h10V4H4zm7 11H4v-2h7v2zm0-4H4V9h7v2z"}),(0,d.jsx)("path",{d:"M18 4v20h2c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-2z"}),(0,d.jsx)("path",{d:"M21 14v-4h2V8h2v2h-2v4h2v2h-2v-2z",opacity:".6"})]})}),(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:"p-1.5 rounded text-xs font-medium transition-colors text-orange-500 hover:bg-orange-500/10",onClick:()=>a.chain().focus().deleteRow().run(),title:b("editor.deleteRow"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v2h20V6c0-1.1-.9-2-2-2zm0 6H2v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V10zm-8 8H4v-2h8v2z"}),(0,d.jsx)("path",{d:"M15 13l-1.41 1.41L15.17 16l-1.58 1.59L15 19l1.59-1.59L18.17 19l1.42-1.41L18 16l1.59-1.59L18.17 13 16.59 14.41z",fill:"currentColor"})]})}),(0,d.jsx)("button",{className:"p-1.5 rounded text-xs font-medium transition-colors text-orange-500 hover:bg-orange-500/10",onClick:()=>a.chain().focus().deleteColumn().run(),title:b("editor.deleteColumn"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M6 4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h2V4H6zm4 0v20h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H10zm7 7H10V9h7v2z"}),(0,d.jsx)("path",{d:"M13 16l-1.41 1.41L13.17 19l-1.58 1.59L13 22l1.59-1.59L16.17 22l1.42-1.41L16 19l1.59-1.59L16.17 16l-1.58 1.41z",fill:"currentColor"})]})}),(0,d.jsx)("button",{className:"p-1.5 rounded text-xs font-medium transition-colors text-red-500 hover:bg-red-500/10",onClick:()=>a.chain().focus().deleteTable().run(),title:b("editor.deleteTable"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"})})})]}),a.isActive("codeBlock")&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:"p-1.5 rounded text-xs font-medium transition-colors text-red-500 hover:bg-red-500/10",onClick:()=>a.chain().focus().toggleCodeBlock().run(),title:b("editor.deleteCodeBlock"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"})})})]})]})}},83377:(a,b,c)=>{"use strict";c.d(b,{A:()=>e});var d=c(67484);function e({lines:a,enabled:b,onContentChange:c,onEnterInsert:f,onSave:g,getVisibleLineCount:h,scrollToLine:i,onSearchExecute:j,onSearchNext:k,onSearchPrev:l,onSearchClear:m}){let[n,o]=(0,d.useState)("normal"),[p,q]=(0,d.useState)(-1),[r,s]=(0,d.useState)(0),[t,u]=(0,d.useState)(!1),[v,w]=(0,d.useState)(""),[x,y]=(0,d.useState)(""),[z,A]=(0,d.useState)(""),[B,C]=(0,d.useState)(""),D=(0,d.useRef)([]),E=(0,d.useRef)([]),F=(0,d.useRef)([]),G=(0,d.useRef)(null),H=(0,d.useRef)(a),I=(0,d.useCallback)((a,b)=>Math.max(0,Math.min(b,Math.max(0,(H.current[a]??"").length-1))),[]);(0,d.useRef)(a.length);let J=(0,d.useCallback)(()=>{G.current&&(clearTimeout(G.current),G.current=null),w("")},[]),K=(0,d.useCallback)(()=>{G.current&&clearTimeout(G.current),G.current=setTimeout(()=>{w(""),G.current=null},500)},[]),L=(0,d.useCallback)((a,b)=>{D.current.push(b),E.current=[],u(!0),c(a.join("\n"))},[c]),M=(0,d.useCallback)((a,b)=>{let c=Math.max(0,Math.min(a,H.current.length-1));q(c),s(I(c,b??0)),i(c,"auto")},[i,I]),N=(0,d.useCallback)(a=>{q(b=>{let c=Math.max(0,Math.min(b+a,H.current.length-1));return i(c,"auto"),s(a=>Math.max(0,Math.min(a,Math.max(0,(H.current[c]??"").length-1)))),c})},[i]),O=(0,d.useCallback)(()=>{let a=H.current,b=Math.min(p,a.length-1);if(0===a.length)return;let c=a[b];F.current=[c];let d=[...a];d.splice(b,1),0===d.length&&d.push("");let e=Math.min(b,d.length-1);L(d,{lineIndex:b,oldLines:[c],newLines:[],cursorLine:b}),q(e),s(0)},[p,L]),P=(0,d.useCallback)(()=>{let a=H.current,b=Math.min(p,a.length-1);a.length>0&&(F.current=[a[b]])},[p]),Q=(0,d.useCallback)(()=>{let a=F.current;if(0===a.length)return;let b=H.current,c=Math.min(p,b.length-1)+1,d=[...b];d.splice(c,0,...a),L(d,{lineIndex:c,oldLines:[],newLines:[...a],cursorLine:p}),q(c),s(0),i(c,"auto")},[p,L,i]),R=(0,d.useCallback)(()=>{let a=H.current,b=Math.min(p,a.length-1),c=a[b];if(!c||0===c.length)return;let d=c.substring(1),e=[...a];e[b]=d,L(e,{lineIndex:b,oldLines:[c],newLines:[d],cursorLine:p})},[p,L]),S=(0,d.useCallback)(()=>{let a=D.current;if(0===a.length)return;let b=a.pop(),d=[...H.current];0===b.newLines.length&&b.oldLines.length>0?d.splice(b.lineIndex,0,...b.oldLines):0===b.oldLines.length&&b.newLines.length>0?(d.splice(b.lineIndex,b.newLines.length),0===d.length&&d.push("")):d.splice(b.lineIndex,b.newLines.length,...b.oldLines),E.current.push(b),c(d.join("\n")),q(Math.min(b.cursorLine,d.length-1)),i(Math.min(b.cursorLine,d.length-1),"auto"),0===a.length&&u(!1)},[c,i]),T=(0,d.useCallback)(()=>{let a=E.current;if(0===a.length)return;let b=a.pop(),d=[...H.current];0===b.newLines.length&&b.oldLines.length>0?(d.splice(b.lineIndex,b.oldLines.length),0===d.length&&d.push("")):0===b.oldLines.length&&b.newLines.length>0?d.splice(b.lineIndex,0,...b.newLines):d.splice(b.lineIndex,b.oldLines.length,...b.newLines),D.current.push(b),u(!0),c(d.join("\n"));let e=b.lineIndex+Math.max(0,b.newLines.length-1);q(Math.min(e,d.length-1)),i(Math.min(e,d.length-1),"auto")},[c,i]),U=(0,d.useCallback)(a=>{let b=H.current,c=Math.min(p,b.length-1);if("o"===a||"O"===a){let d="o"===a?c+1:c,e=[...b];e.splice(d,0,""),L(e,{lineIndex:d,oldLines:[],newLines:[""],cursorLine:p}),c=d,q(d)}o("insert"),f(c,r,a)},[p,r,L,f]),V=(0,d.useCallback)(()=>{o("normal"),J()},[J]),W=(0,d.useCallback)(()=>{o("command"),y("")},[]),X=(0,d.useCallback)(()=>{o("normal"),y("")},[]),Y=(0,d.useCallback)(()=>{o("search"),A("")},[]),Z=(0,d.useCallback)(()=>{o("normal"),A("")},[]),$=(0,d.useCallback)(a=>{let b=a.trim();if("w"===b){g?.(),o("normal"),y("");return}if("q"===b){o("normal"),y("");return}if("wq"===b){g?.(),o("normal"),y("");return}if("noh"===b||"nohlsearch"===b){m?.(),o("normal"),y("");return}let c=parseInt(b,10);if(!isNaN(c)&&c>0){let a=Math.min(c-1,H.current.length-1);q(a),i(a,"center"),o("normal"),y("");return}o("normal"),y("")},[g,m,i]),_=(0,d.useCallback)(a=>{if(!a){o("normal"),A("");return}C(a),j?.(a),o("normal"),A("")},[j]),aa=(0,d.useCallback)(a=>{if(!b)return!1;let c=a.ctrlKey&&"c"===a.key&&!a.metaKey&&!a.shiftKey;if("insert"===n)return("Escape"===a.key||!!c)&&(V(),!0);if("command"===n)return!a.isComposing&&("Escape"===a.key||c?X():"Enter"===a.key?$(x):"Backspace"===a.key?0===x.length?X():y(a=>a.slice(0,-1)):1!==a.key.length||a.metaKey||a.ctrlKey||y(b=>b+a.key),!0);if("search"===n)return!a.isComposing&&("Escape"===a.key||c?Z():"Enter"===a.key?_(z):"Backspace"===a.key?0===z.length?Z():A(a=>a.slice(0,-1)):1!==a.key.length||a.metaKey||a.ctrlKey||A(b=>b+a.key),!0);if(p<0&&(q(0),s(0)),a.metaKey)return!1;if(a.ctrlKey)return"d"===a.key?(N(Math.max(1,Math.floor(h()/2))),J(),!0):"u"===a.key?(N(-Math.max(1,Math.floor(h()/2))),J(),!0):"r"===a.key&&(T(),J(),!0);let d=a.key,e=v+d;if("g"===e)return w("g"),K(),!0;if("gg"===e)return M(0),J(),!0;if("d"===e)return w("d"),K(),!0;if("dd"===e)return O(),J(),!0;if("y"===e)return w("y"),K(),!0;if("yy"===e)return P(),J(),!0;if(v&&e!==d&&J(),"j"===d||"ArrowDown"===d)return N(1),!0;if("k"===d||"ArrowUp"===d)return N(-1),!0;if("h"===d||"ArrowLeft"===d)return s(a=>Math.max(0,a-1)),!0;if("l"===d||"ArrowRight"===d){let a=Math.max(0,(H.current[p]??"").length-1);return s(b=>Math.min(a,b+1)),!0}if("0"===d)return s(0),!0;if("$"===d)return s(Math.max(0,(H.current[p]??"").length-1)),!0;if("^"===d){let a=(H.current[p]??"").search(/\S/);return s(a>=0?a:0),!0}return"G"===d?(M(H.current.length-1),!0):"x"===d?(R(),!0):"p"===d?(Q(),!0):"u"===d?(S(),!0):"i"===d||"a"===d||"I"===d||"A"===d||"o"===d||"O"===d?(U(d),!0):"/"===d?(Y(),!0):"n"===d?(k?.(),!0):"N"===d?(l?.(),!0):":"===d?(W(),!0):"Escape"!==d&&1===d.length},[b,n,v,x,z,p,V,U,W,X,Y,Z,$,_,N,M,h,O,P,Q,R,S,T,J,K,k,l]);return{state:{mode:n,cursorLine:p,cursorCol:r,isDirty:t,keyBuffer:v,commandInput:x,searchInput:z,lastSearch:B},handleKeyDown:aa,enterNormal:V,enterInsert:U,setCursorLine:q,setCursorCol:s,setCommandInput:y,setSearchInput:A,setIsDirty:u,clearUndoHistory:(0,d.useCallback)(()=>{D.current=[],E.current=[]},[])}}},83768:(a,b,c)=>{"use strict";c.d(b,{D:()=>g,N:()=>h});var d=c(48249),e=c(67484);let f=(0,e.createContext)(null);function g(){let a=(0,e.useContext)(f);if(!a)throw Error("useTheme must be used within a ThemeProvider");return a}function h({children:a}){let[b,c]=(0,e.useState)("system"),[g,i]=(0,e.useState)("light"),j=(0,e.useCallback)(()=>"light",[]),k=(0,e.useCallback)(a=>{let b=document.documentElement;b.classList.remove("light","dark"),b.classList.add(a),i(a);let c=document.querySelector('meta[name="theme-color"]'),d="dark"===a?"#111113":"#f9f9fb";c&&c.setAttribute("content",d)},[]),l=(0,e.useCallback)(a=>{c(a),localStorage.setItem("theme",a),k("system"===a?j():a),document.querySelectorAll("iframe").forEach(b=>{b.contentWindow?.postMessage({type:"THEME_CHANGE",theme:a},"*")})},[j,k]);return(0,d.jsx)(f.Provider,{value:{theme:b,resolvedTheme:g,setTheme:l},children:a})}},84398:(a,b,c)=>{"use strict";function d(a){let b=a.split("/").pop()?.toLowerCase()??"";switch(b.includes(".")?b.split(".").pop():""){case"ts":return"typescript";case"tsx":case"jsx":return"tsx";case"js":case"mjs":case"cjs":return"javascript";case"py":case"pyi":return"python";case"go":return"go";case"rs":return"rust";default:return null}}c.d(b,{k:()=>d})},84747:(a,b,c)=>{"use strict";c.d(b,{Workspace:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call Workspace() from the server but Workspace is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/Workspace.tsx","Workspace")},84835:(a,b,c)=>{"use strict";c.d(b,{W:()=>f});var d=c(50300);let e=new Set(["p","h1","h2","h3","h4","h5","h6","li","blockquote","pre","table","tr","hr","div","ul","ol"]);function f(){return a=>{(0,d.YR)(a,"element",a=>{if(e.has(a.tagName)&&a.position&&(a.properties||(a.properties={}),a.properties["data-source-start"]=a.position.start.line,a.properties["data-source-end"]=a.position.end.line,"pre"===a.tagName)){let b=a.children?.find(a=>"element"===a.type&&"code"===a.tagName);b&&(b.properties||(b.properties={}),b.properties["data-source-start"]=a.position.start.line,b.properties["data-source-end"]=a.position.end.line)}})}}},84844:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{i:()=>p});var e=c(48249),f=c(67484),g=c(44384),h=c(208),i=c(91579),j=c(44256),k=c(7833),l=c(33281),m=c(89800),n=c(87808);function o(a){if(0===a.length)return"";let b=[h.A.t("comments.codeRef"),""],c=a.filter(a=>a.filePath===i.Un),d=a.filter(a=>a.filePath!==i.Un);for(let a of(d.length>0&&d.forEach((a,c)=>{b.push(`[${c+1}] ${a.filePath}:${a.startLine}-${a.endLine}`),b.push("```"),b.push(a.codeContent),b.push("```"),a.content&&b.push(h.A.t("comments.note",{content:a.content})),b.push("")}),c)){let c=a.codeContent.split("\n").map(a=>`> ${a}`).join("\n");b.push(c),a.content&&b.push(a.content),b.push("")}return b.join("\n").trim()}function p({isOpen:a,onClose:b,cwd:c,onNavigateToComment:d}){let{t:h}=(0,g.Bd)(),[q,r]=(0,f.useState)([]),[s,t]=(0,f.useState)(!1),[u,v]=(0,f.useState)(null),[w,x]=(0,f.useState)(!1);(0,f.useCallback)(async()=>{if(!c)return;t(!0);let a=await l.t4.runPromiseExit((0,m.$)(c));"Success"===a._tag?r(a.value.comments??[]):console.error("Failed to load comments:",a.cause),t(!1)},[c]);let y=async a=>{let b=await l.t4.runPromiseExit((0,m.Tu)(c,a));"Success"===b._tag?(r(b=>b.filter(b=>b.id!==a)),(0,i.Cm)()):console.error("Failed to delete comment:",b.cause)},z=async a=>{v(a.id);try{let b="";if(a.selectedText)b=a.selectedText;else{let d=await l.t4.runPromiseExit((0,n.K9)(c,a.filePath));if("Success"!==d._tag||!d.value.ok)throw Error("Failed to read file");b=(d.value.data?.content||"").split("\n").slice(a.startLine-1,a.endLine).join("\n")}let d={filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,content:a.content,codeContent:b},e=o([d]);await navigator.clipboard.writeText(e),(0,k.oR)(h("toast.copiedComment"))}catch(a){console.error("Failed to copy comment:",a)}finally{v(null)}},A=async()=>{if(0!==q.length){x(!0);try{let a=await (0,i.$3)(c),b=o(a);await navigator.clipboard.writeText(b),(0,k.oR)(h("toast.copiedAllComments"))}catch(a){console.error("Failed to copy all comments:",a)}finally{x(!1)}}},B=q.reduce((a,b)=>(a[b.filePath]||(a[b.filePath]=[]),a[b.filePath].push(b),a),{});if(!a)return null;let C=(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:b,children:(0,e.jsxs)("div",{className:"w-full max-w-2xl max-h-[80vh] bg-card border border-border rounded-lg shadow-xl flex flex-col overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-secondary",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:h("comments.allComments")}),q.length>0&&(0,e.jsx)("button",{onClick:A,disabled:w,className:"p-1 rounded hover:bg-accent text-muted-foreground disabled:opacity-50",title:h("comments.copyAllComments"),children:w?(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),(0,e.jsx)("button",{onClick:b,className:"p-1 rounded hover:bg-accent text-muted-foreground",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:s?(0,e.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:h("common.loading")}):0===q.length?(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,e.jsx)("svg",{className:"w-12 h-12 mb-3 opacity-50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),(0,e.jsx)("span",{children:h("comments.noComments")})]}):(0,e.jsx)("div",{className:"space-y-4",children:Object.entries(B).map(([a,b])=>(0,e.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,e.jsxs)("div",{className:"px-3 py-2 bg-secondary border-b border-border",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-foreground font-mono",children:a===i.Un?h("comments.aiReply"):a}),(0,e.jsxs)("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",h("comments.nComments",{count:b.length}),")"]})]}),(0,e.jsx)("div",{className:"divide-y divide-border",children:b.map(a=>{var b;return(0,e.jsx)("div",{className:"px-3 py-2 hover:bg-accent/50 cursor-pointer group",onClick:()=>d?.(a),children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[a.startLine>0||a.endLine>0?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("span",{className:"text-xs text-brand font-mono",children:[h("common.line")," ",a.startLine===a.endLine?a.startLine:`${a.startLine}-${a.endLine}`]}),(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",h("comments.linesCount",{count:a.endLine-a.startLine+1}),")"]})]}):a.selectedText?(0,e.jsxs)("span",{className:"text-xs text-muted-foreground italic truncate max-w-[200px]",children:["“",a.selectedText.slice(0,50),a.selectedText.length>50?"...":"","”"]}):null,(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:(b=a.updatedAt||a.createdAt)?new Date(b).toLocaleString("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):""})]}),(0,e.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:a.content||(0,e.jsx)("span",{className:"text-muted-foreground italic",children:h("comments.noContent")})})]}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),z(a)},disabled:u===a.id,className:"p-1 rounded opacity-0 group-hover:opacity-100 hover:bg-accent text-muted-foreground transition-opacity disabled:opacity-50",title:h("common.copy"),children:u===a.id?(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),y(a.id)},className:"p-1 rounded opacity-0 group-hover:opacity-100 hover:bg-accent text-muted-foreground hover:text-red-9 transition-opacity",title:h("common.delete"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})},a.id)})})]},a))})}),(0,e.jsxs)("div",{className:"px-4 py-3 border-t border-border bg-secondary flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:h("comments.totalComments",{count:q.length})}),(0,e.jsx)("button",{onClick:async()=>{0===q.length||await (0,i.RP)(c)&&r([])},disabled:0===q.length,className:"px-3 py-1.5 text-sm bg-red-9 text-white rounded hover:bg-red-10 disabled:opacity-50 disabled:cursor-not-allowed",children:h("comments.clearAll")})]})]})});return(0,e.jsx)(j.ZL,{children:C})}d()}catch(a){d(a)}})},85655:(a,b,c)=>{"use strict";c.d(b,{Bj:()=>i,CM:()=>s,FK:()=>r,Iz:()=>m,MB:()=>t,Ub:()=>o,X0:()=>n,Zi:()=>j,lv:()=>l,oh:()=>q,r4:()=>h,w2:()=>p,yy:()=>k});var d=c(79606),e=c(71192);let f=a=>d.tryPromise({try:async()=>{let b=await fetch(a);if(!b.ok){let a;try{a=(await b.json()).error}catch{}throw Error(a||`HTTP ${b.status}`)}return await b.json()},catch:b=>new e.uV({message:`fetch ${a} failed`,cause:b})}),g=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error(`HTTP ${c.status}`)},catch:b=>new e.uV({message:`POST ${a} failed`,cause:b})}),h=a=>f(`/api/git/branches?cwd=${encodeURIComponent(a)}`).pipe(d.flatMap(b=>"Failed to get branches"===b.error?d.fail(new e.m_({resource:"git-repo",id:a})):d.succeed(b))),i=(a,b,c,d)=>f(`/api/git/commits?cwd=${encodeURIComponent(a)}&branch=${encodeURIComponent(b)}&limit=${c}${"number"==typeof d?`&offset=${d}`:""}`),j=(a,b,c)=>f(`/api/git/commit-diff?cwd=${encodeURIComponent(a)}&hash=${encodeURIComponent(b)}${c?`&file=${encodeURIComponent(c)}`:""}`),k=(a,b,c)=>f(`/api/git/branch-diff?cwd=${encodeURIComponent(a)}&base=${encodeURIComponent(b)}${c?`&file=${encodeURIComponent(c)}`:""}`),l=a=>f(`/api/git/status?cwd=${encodeURIComponent(a)}`),m=(a,b)=>g("/api/git/stage",{cwd:a,files:b}),n=(a,b)=>g("/api/git/unstage",{cwd:a,files:b}),o=(a,b,c)=>g("/api/git/discard",{cwd:a,files:b,isUntracked:c}),p=(a,b,c)=>{let d=new URLSearchParams({cwd:a,file:b,type:c});return f(`/api/git/diff?${d}`)},q=a=>f(`/api/git/diff?${a.toString()}`),r=a=>f(`/api/git/worktree?cwd=${encodeURIComponent(a)}`),s=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/git/worktree",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json().catch(()=>null);if(!b.ok)throw Error(c?.error||`HTTP ${b.status}`);return c},catch:a=>new e.uV({message:"POST /api/git/worktree failed",cause:a})}),t=a=>f(`/api/projectGraph/search?${a.toString()}`)},85906:(a,b,c)=>{"use strict";c.d(b,{ProjectItem:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call ProjectItem() from the server but ProjectItem is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/ProjectItem.tsx","ProjectItem")},85984:(a,b,c)=>{"use strict";c.d(b,{V:()=>k});var d=c(67484),e=c(79606),f=c(33281),g=c(71192);let h=new Map,i=new Map;async function j(a,b,c=!1){let d=`${a}::${b}`;if(c)!function(a){if(!a){h.clear(),i.clear();return}let b=`${a}::`;for(let a of h.keys())a.startsWith(b)&&h.delete(a);for(let a of i.keys())a.startsWith(b)&&i.delete(a)}(a);else{let a=h.get(d);if(a)return a;let b=i.get(d);if(b)return b}let k=e.tryPromise({try:async()=>{let e=new URLSearchParams({cwd:a,path:b});c&&e.set("refresh","1");let f=await fetch(`/api/projectGraph/file-functions?${e}`);if(404===f.status)return"not-found";if(!f.ok)throw Error((await f.json().catch(()=>({error:`HTTP ${f.status}`}))).error||`HTTP ${f.status}`);let g=await f.json();return h.set(d,g),g},catch:a=>new g.uV({message:"fetchFileFunctions failed",cause:a})}),l=f.t4.runPromiseExit(k).then(a=>{if("Success"===a._tag)return a.value;let b="Fail"===a.cause._tag?a.cause.error:null,c=b?.cause;if(c instanceof Error)throw c;throw Error(b?.message??"fetchFileFunctions failed")}).finally(()=>i.delete(d));return i.set(d,l),l}function k(a,b){let[c,e]=(0,d.useState)({state:"idle"}),f=(0,d.useRef)(!0),g=(0,d.useCallback)((a,b,c)=>{e({state:"loading"}),j(a,b,c).then(a=>{f.current&&("not-found"===a?e({state:"notFound"}):e({state:"ready",data:a}))}).catch(a=>{f.current&&e({state:"error",message:a.message})})},[]);return{state:c,refresh:(0,d.useCallback)(()=>{a&&b&&g(a,b,!0)},[a,b,g])}}},86686:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{f:()=>h});var e=c(48249);c(67484);var f=c(44384),g=c(44256);function h({isOpen:a,onClose:b,messages:c,onSelectMessage:d}){let{t:i}=(0,f.Bd)();if(!a)return null;let j=c.filter(a=>"user"===a.role),k=(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:b,children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-lg max-h-[70vh] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border shrink-0",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground",children:i("userMessages.title")}),(0,e.jsx)("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===j.length?(0,e.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground",children:i("userMessages.noMessages")}):(0,e.jsx)("div",{className:"divide-y divide-border",children:j.map((a,c)=>{let f,g,h,i=(f=a.id.match(/^user-(\d+)/))?parseInt(f[1],10):null,j=i?(g=new Date(i),h=new Date,g.toDateString()===h.toDateString()?g.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):g.toLocaleDateString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})):"";return(0,e.jsx)("button",{onClick:()=>{var c;return c=a.id,void(d(c),b())},className:"w-full px-4 py-3 text-left hover:bg-accent transition-colors",children:(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[(0,e.jsxs)("span",{className:"text-xs text-muted-foreground font-mono w-6 shrink-0 pt-0.5",children:[c+1,"."]}),(0,e.jsx)("div",{className:"flex-1 min-w-0",children:(0,e.jsx)("p",{className:"text-sm text-foreground break-words",children:function(a,b=50){let c=a.replace(/\s+/g," ").trim();return c.length<=b?c:c.slice(0,b)+"..."}(a.content)})}),j&&(0,e.jsx)("span",{className:"text-xs text-muted-foreground shrink-0 pt-0.5",children:j})]})},a.id)})})})]})});return(0,e.jsx)(g.ZL,{children:k})}d()}catch(a){d(a)}})},87238:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{$:()=>r,j:()=>s});var e=c(48249),f=c(67484),g=c(44384),h=c(24520),i=c(88282),j=c(46674),k=c(72529),l=c(9780),m=c(33281),n=c(23328),o=a([l]);function p({onAdd:a,onCancel:b}){let{t:c}=(0,g.Bd)(),[d,h]=(0,f.useState)(""),[i,j]=(0,f.useState)("");return(0,e.jsxs)("div",{className:"flex gap-1 mb-1",children:[(0,e.jsx)("input",{type:"text",value:d,onChange:a=>h(a.target.value),placeholder:c("console.namePlaceholder"),className:"w-24 flex-shrink-0 px-2 py-1 text-xs rounded border border-input bg-background focus:outline-none focus:ring-1 focus:ring-ring",autoFocus:!0,onKeyDown:a=>{"Escape"===a.key&&b()}}),(0,e.jsx)("input",{type:"text",value:i,onChange:a=>j(a.target.value),placeholder:c("console.commandPlaceholder"),className:"flex-1 min-w-0 px-2 py-1 text-xs font-mono rounded border border-input bg-background focus:outline-none focus:ring-1 focus:ring-ring",onKeyDown:c=>{"Enter"!==c.key||c.nativeEvent.isComposing?"Escape"===c.key&&b():(c.preventDefault(),c.stopPropagation(),d.trim()&&i.trim()&&a(d.trim(),i.trim()))}})]})}function q({label:a,commands:b,isAdding:c,onStartAdd:d,onAdd:f,onCancelAdd:l,onDelete:m,onExecute:n}){let{t:o}=(0,g.Bd)();return(0,e.jsxs)("div",{className:"p-2",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground px-1",children:a}),(0,e.jsx)("button",{type:"button",onClick:d,className:"p-0.5 text-muted-foreground hover:text-foreground rounded",children:(0,e.jsx)(h.A,{className:"w-3.5 h-3.5"})})]}),c&&(0,e.jsx)(p,{onAdd:(a,b)=>f(a,b),onCancel:l}),0===b.length&&!c&&(0,e.jsx)("div",{className:"text-xs text-muted-foreground px-1 py-1",children:o("console.noCustomCommands")}),b.map((a,b)=>(0,e.jsx)(k.m,{content:a.command,children:(0,e.jsxs)("div",{className:"flex items-center group min-w-0",children:[(0,e.jsxs)("button",{type:"button",onClick:()=>n(a.command),className:"flex-1 min-w-0 flex items-center gap-2 px-2 py-1.5 text-left text-sm rounded hover:bg-accent transition-colors",children:[(0,e.jsx)(i.A,{className:"w-3 h-3 flex-shrink-0 text-muted-foreground"}),(0,e.jsx)("span",{className:"truncate",children:a.name})]}),(0,e.jsx)("button",{type:"button",onClick:()=>m(b),className:"p-1 text-muted-foreground hover:text-destructive rounded opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:(0,e.jsx)(j.A,{className:"w-3 h-3"})})]})},b))]})}function r({cwd:a,show:b,onClose:c,onExecute:d,onAddPluginItem:h}){let{t:i}=(0,g.Bd)(),[j,k]=(0,f.useState)([]),[o,p]=(0,f.useState)([]),[s,t]=(0,f.useState)(null),u=(0,f.useRef)(null);(0,f.useCallback)(async()=>{let[b,c]=await Promise.all([m.t4.runPromiseExit((0,n.Yj)()),m.t4.runPromiseExit((0,n.UV)(a))]);if("Success"===b._tag){let a=b.value;k(a.customCommands||[])}if("Success"===c._tag){let a=c.value;p(a.customCommands||[])}},[a]);let v=(0,f.useCallback)(async a=>{k(a);let b=await m.t4.runPromiseExit((0,n.Cb)({scope:"global",customCommands:a}));"Failure"===b._tag&&console.error("Failed to save global commands:",b.cause)},[]),w=(0,f.useCallback)(async b=>{p(b);let c=await m.t4.runPromiseExit((0,n.Cb)({cwd:a,customCommands:b}));"Failure"===c._tag&&console.error("Failed to save project commands:",c.cause)},[a]),x=(0,f.useCallback)(a=>{c();let b=(0,l.sk)(a);b?h?.(b.type,a.trim()):d(a)},[c,d,h]);return b?(0,e.jsxs)("div",{ref:u,className:"absolute bottom-full left-0 mb-2 w-72 bg-popover border border-border rounded-lg shadow-lg z-50 max-h-[70vh] overflow-y-auto",children:[(0,e.jsx)(q,{label:i("console.globalCommands"),commands:j,isAdding:"global"===s,onStartAdd:()=>t("global"),onAdd:(a,b)=>{v([...j,{name:a,command:b}]),t(null)},onCancelAdd:()=>t(null),onDelete:a=>v(j.filter((b,c)=>c!==a)),onExecute:x}),(0,e.jsx)("div",{className:"border-t border-border"}),(0,e.jsx)(q,{label:i("console.projectCommands"),commands:o,isAdding:"project"===s,onStartAdd:()=>t("project"),onAdd:(a,b)=>{w([...o,{name:a,command:b}]),t(null)},onCancelAdd:()=>t(null),onDelete:a=>w(o.filter((b,c)=>c!==a)),onExecute:x})]}):null}function s(a){let[b,c]=(0,f.useState)([]),[d,e]=(0,f.useState)([]),g=(0,f.useCallback)(async()=>{let[b,d]=await Promise.all([m.t4.runPromiseExit((0,n.UV)(a)),m.t4.runPromiseExit((0,n.Yj)())]);if("Success"===b._tag){let a=b.value;c(a.customCommands||[])}if("Success"===d._tag){let a=d.value;e(a.customCommands||[])}},[a]),h=[...b,...d],i=(0,f.useCallback)(a=>{let c=a.trim().split(/\s+/),e=c[0];if(!e.startsWith("/")||e.length<=1)return null;let f=e.slice(1),g=b.find(a=>a.name===f)??d.find(a=>a.name===f);return g?g.command+(c.length>1?" "+c.slice(1).join(" "):""):null},[b,d]);return{quickCustomCommands:h,projectCommands:b,globalCommands:d,expandCustomCommand:i,loadQuickCommands:g}}l=(o.then?(await o)():o)[0],d()}catch(a){d(a)}})},87808:(a,b,c)=>{"use strict";c.d(b,{DZ:()=>j,Ft:()=>n,K9:()=>q,Nn:()=>v,OJ:()=>s,VK:()=>w,YW:()=>m,__:()=>u,dt:()=>t,eA:()=>r,eE:()=>o,gZ:()=>k,mP:()=>i,nM:()=>x,r6:()=>p,r9:()=>l});var d=c(79606),e=c(71192);let f=(a,b={})=>d.tryPromise({try:async()=>{let c=await fetch(a,b.init);if(b.passThroughStatuses&&b.passThroughStatuses.includes(c.status))return await c.json().catch(()=>({}));if(!c.ok){let a;try{a=(await c.json()).error}catch{}throw Error(a||`HTTP ${c.status}`)}return await c.json()},catch:b=>new e.uV({message:`GET ${a} failed`,cause:b})}),g=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b),d=null;try{d=await c.json()}catch{}return{status:c.status,ok:c.ok,data:d}},catch:b=>new e.uV({message:`GET ${a} failed`,cause:b})}),h=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error(`HTTP ${c.status}`)},catch:b=>new e.uV({message:`POST ${a} failed`,cause:b})}),i=a=>f(`/api/files/init?cwd=${encodeURIComponent(a)}`),j=a=>f(`/api/files/index?cwd=${encodeURIComponent(a)}`),k=(a,b)=>f(`/api/files/readdir?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`),l=a=>f(`/api/files/recent?cwd=${encodeURIComponent(a)}`),m=(a,b,c)=>h("/api/files/recent",{cwd:a,file:b,...c??{}}),n=(a,b)=>h("/api/files/expanded",{cwd:a,paths:b}),o=(a,b)=>f(`/api/files/blame?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`),p=(a,b)=>g(`/api/files/stat?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`,{cache:"no-store"}),q=(a,b)=>g(`/api/files/text?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`,{cache:"no-store"}),r=a=>f(`/api/files/text?${a.toString()}`),s=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/files/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=null;try{c=await b.json()}catch{}return{status:b.status,ok:b.ok,data:c}},catch:a=>new e.uV({message:"POST /api/files/save failed",cause:a})}),t=()=>f("/api/files/clipboard"),u=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/files/clipboard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok)throw Error(`HTTP ${b.status}`)},catch:a=>new e.uV({message:"POST /api/files/clipboard failed",cause:a})}),v=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/files/paste",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json().catch(()=>null);if(!b.ok)throw Error(c?.error||`HTTP ${b.status}`);return c},catch:a=>new e.uV({message:"POST /api/files/paste failed",cause:a})}),w=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/files/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json().catch(()=>null);if(!b.ok)throw Error(c?.error||`HTTP ${b.status}`);return c},catch:a=>new e.uV({message:"POST /api/files/delete failed",cause:a})}),x=a=>f(`/api/file?path=${encodeURIComponent(a)}`)},87819:(a,b,c)=>{"use strict";c.d(b,{Z:()=>e});var d=c(67484);function e(a,b){let[c,e]=(0,d.useState)({status:"loading"});return c}c(13426),c(79883),c(1239),c(79606),c(95046),c(33281)},87844:(a,b,c)=>{"use strict";c.d(b,{T:()=>x});var d=c(48249),e=c(98051),f=c(38368),g=c(33972),h=c(10841),i=c(99773),j=c(36513);c(55583),c(87023);var k=c(50757),l=c(27454),m=c(37752),n=c(67484),o=c(83768);let p=[f.A,g.A,h.jb],q=[f.A,h.jb],r=[i.A,j.A],s=[i.A];function t(a){return a.replace(/^(\|.+\|)$/gm,a=>/^\|[\s:|-]+\|$/.test(a)?a:a.replace(/`([^`]*)`/g,(a,b)=>b.includes("|")?"`"+b.replace(/\|/g,"\\|")+"`":a))}function u(a){return a.replace(/\$(\d)/g,"\\$$1")}let v=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clippath","defs","ellipse","g","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan","use"]);function w(a){let b=[],c=a=>(b.push(a),`\0MASK${b.length-1}\0`);return a.replace(/```[\s\S]*?```/g,a=>c(a)).replace(/~~~[\s\S]*?~~~/g,a=>c(a)).replace(/`[^`\n]+`/g,a=>c(a)).replace(/<\/?([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(a,b)=>{let c=b.toLowerCase();return v.has(c)||c.includes("-")?a:a.replace(/</g,"<").replace(/>/g,">")}).replace(/MASK(\d+)/g,(a,c)=>b[+c])}let x=(0,n.memo)(function({content:a,isUser:b=!1,isStreaming:c=!1,enableMath:f=!0,rehypePlugins:g}){let{resolvedTheme:h}=(0,o.D)(),i="dark"===h,j=(0,n.useMemo)(()=>({code({className:a,children:b,node:c,...e}){let f=/language-(\w+)/.exec(a||""),g=String(b);if(!f&&!a&&!g.includes("\n"))return(0,d.jsx)("code",{className:"px-1.5 py-0.5 mx-0.5 rounded bg-accent text-sm font-mono",...e,children:b});let h=String(b).replace(/\n$/,""),j=f?.[1]||"text",n=Number(e["data-source-start"])||0,o=n?n+1:0,p=0;return(0,d.jsx)(k.A,{style:i?l.A:m.A,language:j,PreTag:"div",customStyle:{margin:"0.75rem 0",borderRadius:"0.375rem",fontSize:"0.875rem"},wrapLines:!0,lineProps:()=>{let a=o+p;return p++,{"data-source-start":a,"data-source-end":a,style:{display:"block"}}},children:h})},p:({children:a,node:b,...c})=>(0,d.jsx)("p",{className:"mb-3 last:mb-0",...c,children:a}),h1:({children:a,node:b,...c})=>(0,d.jsx)("h1",{className:"text-xl font-bold mb-3 mt-4 first:mt-0",...c,children:a}),h2:({children:a,node:b,...c})=>(0,d.jsx)("h2",{className:"text-lg font-bold mb-2 mt-3 first:mt-0",...c,children:a}),h3:({children:a,node:b,...c})=>(0,d.jsx)("h3",{className:"text-base font-bold mb-2 mt-3 first:mt-0",...c,children:a}),ul:({children:a,node:b,...c})=>(0,d.jsx)("ul",{className:"list-disc list-inside mb-3 space-y-1",...c,children:a}),ol:({children:a,node:b,...c})=>(0,d.jsx)("ol",{className:"list-decimal list-inside mb-3 space-y-1",...c,children:a}),li:({children:a,node:b,...c})=>(0,d.jsx)("li",{className:"leading-relaxed",...c,children:a}),blockquote:({children:a,node:b,...c})=>(0,d.jsx)("blockquote",{className:"border-l-4 border-border pl-4 my-3 italic text-muted-foreground",...c,children:a}),a:({href:a,children:b,node:c,...e})=>(0,d.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"text-brand hover:underline",...e,children:b}),table:({children:a,node:b,...c})=>(0,d.jsx)("div",{className:"overflow-x-auto my-3",...c,children:(0,d.jsx)("table",{className:"min-w-full border border-border",children:a})}),thead:({children:a,node:b,...c})=>(0,d.jsx)("thead",{className:"bg-accent",...c,children:a}),th:({children:a,node:b,...c})=>(0,d.jsx)("th",{className:"px-4 py-2 text-left font-semibold border-b border-border",...c,children:a}),td:({children:a,node:b,...c})=>(0,d.jsx)("td",{className:"px-4 py-2 border-b border-border",...c,children:a}),hr:({node:a,...b})=>(0,d.jsx)("hr",{className:"my-4 border-border",...b}),img:({src:a,alt:b,node:c,height:e,width:f,style:g,...h})=>{if(!(e||f||g))return(0,d.jsx)("img",{src:a,alt:b||"",className:"max-w-full h-auto rounded-lg my-3",...h});let i=a=>a?/^\d+$/.test(String(a))?`${a}px`:String(a):void 0,j={...g,height:i(e)??g?.height,width:i(f)??g?.width};return(0,d.jsx)("img",{src:a,alt:b||"",style:j,className:"inline-block align-middle",...h})},strong:({children:a,node:b,...c})=>(0,d.jsx)("strong",{className:"font-bold",...c,children:a}),em:({children:a,node:b,...c})=>(0,d.jsx)("em",{className:"italic",...c,children:a}),del:({children:a,node:b,...c})=>(0,d.jsx)("del",{className:"line-through",...c,children:a})}),[i]),v=f?p:q,x=f?r:s,y=(0,n.useMemo)(()=>{if(b||c)return w(a);let d=w(t(!function(a){if(/^\|[\s:|-]+\|$/m.test(a))return!1;if(/[┌┐└┘│─├┤┬┴┼╔╗╚╝║═╭╮╯╰▲▼◀▶△▽◁▷]/.test(a)||/\+[-=]{2,}\+/.test(a))return!0;let b=a.split("\n").filter(a=>/^\s*\||\|\s*$/.test(a));if(b.length>=3){let a=b.map(a=>(a.match(/\|/g)||[]).length);return!a.every(b=>b===a[0])||!(a[0]>=3)}return!1}(a)||/^```[\s\S]*```$/m.test(a.trim())?a:"```text\n"+a.trim()+"\n```"));return f?u(d):d},[a,b,c,f]),z=(0,n.useMemo)(()=>g?.length?[...x,...g]:x,[g,x]);if(b)return(0,d.jsx)("div",{className:"whitespace-pre-wrap break-words",children:a});if(c){let b=a.lastIndexOf("\n");if(-1===b)return(0,d.jsx)("div",{className:"whitespace-pre-wrap break-words",children:a});let c=a.slice(0,b+1),g=a.slice(b+1);return(0,d.jsxs)("div",{className:"markdown-body",children:[(0,d.jsx)(e.oz,{remarkPlugins:v,rehypePlugins:x,components:j,children:f?u(w(t(c))):w(t(c))}),g&&(0,d.jsx)("span",{className:"whitespace-pre-wrap",children:g})]})}return(0,d.jsx)("div",{className:"markdown-body",children:(0,d.jsx)(e.oz,{remarkPlugins:v,rehypePlugins:z,components:j,children:y})})})},88214:(a,b,c)=>{"use strict";c.d(b,{n:()=>e});var d=c(23734);let e={SessionChange:(0,d.R)("session-change"),ViewChange:(0,d.R)("view-change"),OpenNote:(0,d.R)("open-note"),LangChange:(0,d.R)("lang-change"),TabAdd:(0,d.R)("tab-add"),TabClose:(0,d.R)("tab-close"),SwitchSession:(0,d.R)("switch-session"),ProjectChange:(0,d.R)("project-change"),OpenProject:(0,d.R)("open-project"),SessionComplete:(0,d.R)("session-complete"),OpenTokenStats:(0,d.R)("open-token-stats"),PinnedSessionsChanged:(0,d.R)("pinned-sessions-changed"),ScheduledTasksChanged:(0,d.R)("scheduled-tasks-changed"),ScreenshotPrepare:(0,d.R)("screenshot-prepare"),ScreenshotDone:(0,d.R)("screenshot-done")}},89800:(a,b,c)=>{"use strict";c.d(b,{$:()=>i,BC:()=>j,Tu:()=>l,lb:()=>h,tj:()=>m,vv:()=>k});var d=c(79606),e=c(71192);let f=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`);return await c.json()},catch:c=>new e.uV({message:`${b?.method??"GET"} ${a} failed`,cause:c})}),g=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`)},catch:c=>new e.uV({message:`${b.method} ${a} failed`,cause:c})}),h=(a,b)=>f(`/api/comments?cwd=${encodeURIComponent(a)}${b?`&filePath=${encodeURIComponent(b)}`:""}`),i=a=>f(`/api/comments?cwd=${encodeURIComponent(a)}&all=true`),j=a=>f("/api/comments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),k=(a,b,c)=>f("/api/comments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,id:b,content:c})}),l=(a,b)=>g(`/api/comments?cwd=${encodeURIComponent(a)}&id=${encodeURIComponent(b)}`,{method:"DELETE"}),m=a=>g(`/api/comments?cwd=${encodeURIComponent(a)}&all=true`,{method:"DELETE"})},90018:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{O:()=>K});var e=c(48249),f=c(67484),g=c(44384),h=c(10316),i=c(46674),j=c(80600),k=c(69924);c(33281),c(85655),c(87808);var l=c(53716),m=c(85984),n=c(7031),o=c(74754),p=c(91579),q=c(83768),r=c(36984),s=c(49924),t=c(54038),u=c(74815),v=c(77396),w=c(70404),x=c(41051),y=c(42140),z=c(70596),A=a([r,v,s,t]);function B(a){let b=a.lastIndexOf("/");return b>=0?a.slice(b+1):a}function C({symbol:a,fileSource:b,hasChange:c,onHighlighted:d,comments:g,onCommentClick:h,addedLines:i}){let{resolvedTheme:j}=(0,q.D)();(0,f.useMemo)(()=>(0,r.sQ)(a.filePath),[a.filePath]);let[k,m]=(0,f.useState)(null),[n,o]=(0,f.useState)(null);return(0,e.jsxs)("div",{className:"flex-1 min-w-0 bg-card border border-border rounded overflow-hidden relative",children:[(0,e.jsxs)("div",{"data-block-header":!0,className:"flex items-center gap-1.5 px-2 py-1.5 border-b border-border bg-secondary/40 text-xs",children:[(0,e.jsx)(l.y,{kind:a.kind,qname:a.qualifiedName,className:"w-3.5 h-3.5 flex-shrink-0"}),(0,e.jsxs)("span",{className:"font-mono truncate min-w-0",children:[(0,e.jsx)("span",{className:"font-medium",children:a.name}),void 0!==a.params&&(0,e.jsxs)("span",{className:"text-muted-foreground/80",children:["(",a.params.join(", "),")"]})]}),(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground/70 flex-shrink-0",children:[a.kind," \xb7 L",a.startLine,"-",a.endLine]}),(0,e.jsx)("span",{className:"flex-1"}),c&&(0,e.jsx)("span",{className:"flex-shrink-0 w-2 h-2 rounded-full bg-amber-11","data-tooltip":"File has uncommitted change"})]}),(0,e.jsxs)("div",{"data-block-body":!0,className:"text-[11px] font-mono px-2 py-2 overflow-auto",style:{lineHeight:`${N}px`},children:[!b&&(0,e.jsx)("span",{className:"text-muted-foreground",children:"Loading…"}),n&&(0,e.jsx)("span",{className:"text-red-11",children:n}),k&&(0,e.jsx)("div",{dangerouslySetInnerHTML:{__html:k}})]}),g&&g.length>0&&h&&(0,e.jsx)(v._,{comments:g,startLine:a.startLine,endLine:a.endLine,lineHeight:N,bodyTopOffset:O+P,onCommentClick:h})]})}function D({side:a,pin:b,accent:c,onClick:d}){let f,g,h,i,j,k,l,m=b.lines.length;"ext"===b.kind?(f="bg-secondary/30 border-border/50 hover:border-muted-foreground/60",g="ext",h="text-muted-foreground/60",i=b.name,j=b.packageSpec,k="external",l=b.packageSpec):"method"===b.kind?(f="bg-secondary/30 border-border/50 hover:border-muted-foreground/60",g="method",h="text-muted-foreground/60",i=`${b.receiverName}.${b.methodName}`,j=null,k="method (unresolved)",l=m>0?`at line${m>1?"s":""} ${b.lines.join(", ")}`:""):"self"===b.kind?(f="bg-secondary/40 border-border hover:border-muted-foreground",g="self",h="text-muted-foreground/70",i=b.external.name,j=null,k="same-file",l=m>0?`at line${m>1?"s":""} ${b.lines.join(", ")}`:""):(f="in"===a?"bg-amber-9/15 border-amber-9/40 hover:border-amber-11":"bg-green-9/15 border-green-9/40 hover:border-green-11",g=a,h="in"===a?"text-amber-11":"text-green-11",i=b.external.name,j=B(b.external.filePath),k="in"===a?"caller":"callee",l=b.external.filePath);let n=c&&"ext"!==b.kind&&"method"!==b.kind?" ring-1 ring-amber-9/70 ring-offset-0":"";return(0,e.jsxs)("button",{onClick:a=>{a.stopPropagation(),d()},className:`${f}${n} w-full text-left border rounded px-1.5 py-0.5 text-[10px] font-mono cursor-pointer transition-colors flex items-center gap-1.5`,"data-tooltip":`${k}${l?" \xb7 "+l:""}`,children:[(0,e.jsx)("span",{className:`${h} text-[9px] uppercase tracking-wider font-semibold flex-shrink-0`,children:g}),(0,e.jsxs)("span",{className:"truncate flex-1 min-w-0",children:[(0,e.jsx)("span",{className:"font-medium",children:i}),j&&(0,e.jsx)("span",{className:"text-muted-foreground/70 ml-1",children:j}),m>1&&(0,e.jsxs)("span",{className:"text-muted-foreground/60 ml-1",children:["\xb7",m,"\xd7"]})]})]})}[r,v,s,t]=A.then?(await A)():A;let N=18,O=29,P=8;function E(a,b){switch(b.kind){case"cross":return`${a}:x:${b.external.filePath}::${b.external.qualifiedName}`;case"self":return`${a}:s:${b.external.filePath}::${b.external.qualifiedName}`;case"ext":return`${a}:e:${b.packageSpec}::${b.name}`;case"method":return`${a}:m:${b.receiverName}::${b.methodName}`}}function F(a,b){return"ext"!==a.kind&&"method"!==a.kind&&(b?.has(a.external.qualifiedName)??!1)}function G(a){return{filePath:a.filePath,qname:a.qualifiedName,name:a.name,kind:a.kind}}function H({symbol:a,fileSource:b,hasChange:c,upstream:d,downstream:f,onPinClick:g,onHighlighted:h,comments:i,onCommentClick:j,accentQnames:k,addedLines:l}){let m=function(a,b){if(0===a.length)return[];let c=a.map((a,c)=>{var d,e,f;return{i:c,line:(d=a.lines[0]??b.startLine,e=b.startLine,f=b.endLine,Math.max(e,Math.min(f,d)))}});c.sort((a,b)=>a.line-b.line||a.i-b.i);let d=Array(a.length).fill(0),e=-1/0;for(let{i:a,line:f}of c){let c=O+P+(f-b.startLine)*N,g=Math.max(c,e);d[a]=g,e=g+22}return d}(f,a);return(0,e.jsxs)("div",{"data-block-qname":a.qualifiedName,"data-start-line":a.startLine,"data-end-line":a.endLine,className:"flex gap-2 items-stretch scroll-mt-2",children:[(0,e.jsx)("div",{className:"w-44 flex-shrink-0 flex flex-col gap-1 pt-1",children:0===d.length?(0,e.jsx)("div",{className:"text-[10px] text-muted-foreground/40 italic px-1.5",children:"no callers"}):d.map(b=>(0,e.jsx)(D,{side:"in",pin:b,accent:F(b,k),onClick:()=>g(b,a)},E("in",b)))}),(0,e.jsx)(C,{symbol:a,fileSource:b,hasChange:c,onHighlighted:h,comments:i,onCommentClick:j,addedLines:l}),(0,e.jsx)("div",{className:"w-44 flex-shrink-0 relative",children:0===f.length?(0,e.jsx)("div",{className:"text-[10px] text-muted-foreground/40 italic px-1.5 pt-1",children:"no callees"}):f.map((b,c)=>(0,e.jsx)("div",{className:"absolute left-0 right-0",style:{top:`${m[c]}px`},children:(0,e.jsx)(D,{side:"out",pin:b,accent:F(b,k),onClick:()=>g(b,a)})},E("out",b)))})]})}function I({cwd:a,onSelect:b,onClose:c}){let{t:d}=(0,g.Bd)(),[j,k]=(0,f.useState)(""),[l,m]=(0,f.useState)({files:[],symbols:[]}),[n,o]=(0,f.useState)(0),[p,q]=(0,f.useState)(!1),r=(0,f.useMemo)(()=>[...l.files,...l.symbols],[l]),s=(0,f.useCallback)(a=>{if("Escape"===a.key)return void c();if(0!==r.length){if("ArrowDown"===a.key)a.preventDefault(),o(a=>Math.min(a+1,r.length-1));else if("ArrowUp"===a.key)a.preventDefault(),o(a=>Math.max(a-1,0));else if("Enter"===a.key){a.preventDefault();let c=r[n];c&&b(c)}}},[r,n,c,b]);return(0,e.jsx)("div",{className:"absolute inset-0 bg-background/40 z-20 flex items-start justify-center pt-24",onClick:c,children:(0,e.jsxs)("div",{className:"w-[480px] max-w-[80%] bg-card border border-border rounded shadow-2xl overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border",children:[(0,e.jsx)(h.A,{className:"w-4 h-4 text-muted-foreground"}),(0,e.jsx)("input",{autoFocus:!0,value:j,onChange:a=>k(a.target.value),onKeyDown:s,placeholder:d("blockViewer.search.hint","Start typing to search"),className:"flex-1 bg-transparent border-0 outline-none text-sm"}),p&&(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"…"}),(0,e.jsx)("button",{onClick:c,className:"text-muted-foreground hover:text-foreground",children:(0,e.jsx)(i.A,{className:"w-3.5 h-3.5"})})]}),(0,e.jsxs)("div",{className:"max-h-96 overflow-y-auto",children:[0===r.length&&j&&!p&&(0,e.jsx)("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:d("blockViewer.search.noResults","No matches")}),(0,e.jsx)(J,{label:d("blockViewer.search.files","Files"),hits:l.files,startIdx:0,activeIdx:n,onSelect:b,setActive:o}),(0,e.jsx)(J,{label:d("blockViewer.search.symbols","Symbols"),hits:l.symbols,startIdx:l.files.length,activeIdx:n,onSelect:b,setActive:o})]})]})})}function J({label:a,hits:b,startIdx:c,activeIdx:d,onSelect:f,setActive:g}){return 0===b.length?null:(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-muted-foreground bg-secondary/40",children:a}),b.map((a,b)=>{let h=c+b,i=h===d;return(0,e.jsxs)("button",{onMouseEnter:()=>g(h),onClick:()=>f(a),className:`w-full text-left px-3 py-1.5 text-xs flex items-start gap-2 ${i?"bg-secondary":"hover:bg-secondary/60"}`,children:["file"===a.target.kind?(0,e.jsx)(j.A,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0 text-muted-foreground"}):(0,e.jsx)(l.y,{kind:a.target.symbolKind,qname:a.target.qualifiedName,className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"}),(0,e.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[(0,e.jsx)("span",{className:"font-mono truncate",children:a.label}),a.hint&&(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground truncate",children:a.hint})]})]},`${a.type}:${a.label}:${b}`)})]})}function K({cwd:a,highlightedFilePath:b,changedFiles:c,onSwitchToCode:d,enableComments:h=!1,onContentSearch:i,onFocalChange:j,qnameFilter:k,qnameFilterFile:l,accentQnames:q,accentFile:r,addedLines:v,addedLinesFile:A,headerExtraLeft:C,headerExtraRight:D}){let{t:E}=(0,g.Bd)(),[F,J]=(0,f.useState)(null),N=F??b??null,{state:O,refresh:P}=(0,m.V)(a,N),[Q,R]=(0,f.useState)(null);(0,f.useRef)(null);let[S,T]=(0,f.useState)([]),[U,V]=(0,f.useState)(!1),[W,X]=(0,f.useState)(null),Y=(0,f.useRef)(0);(0,f.useRef)(0);let[Z,$]=(0,f.useState)(()=>new Set);"ready"===O.state&&O.data.filePath;let _=(0,f.useCallback)(a=>{$(b=>{if(b.has(a))return b;let c=new Set(b);return c.add(a),c})},[]),aa=(0,f.useCallback)((a,b)=>{if("ext"===a.kind||"method"===a.kind){let a=b.filePath;if(!a)return;Y.current+=1,X({filePath:a,qname:"__imports__",nonce:Y.current});return}let c=G(b),d=G(a.external);T(a=>(0,s.nb)((0,s.nb)(a,c),d)),J(d.filePath),Y.current+=1,X({filePath:d.filePath,qname:d.qname,nonce:Y.current})},[]),ab=(0,f.useCallback)(a=>{J(a.filePath),Y.current+=1,X({filePath:a.filePath,qname:a.qname,nonce:Y.current})},[]),ac=(0,f.useCallback)(a=>{V(!1),J(a.target.filePath),"symbol"===a.target.kind&&(Y.current+=1,X({filePath:a.target.filePath,qname:a.target.qualifiedName,line:a.target.line,nonce:Y.current}))},[]),ad=(0,f.useCallback)((a,b)=>{N&&(Y.current+=1,X({filePath:N,qname:a,line:b,nonce:Y.current}))},[N]),[ae,af]=(0,f.useState)(null),[ag,ah]=(0,f.useState)(null),ai=(0,f.useMemo)(()=>{if("ready"!==O.state||!ag)return null;let a=O.data.functions;if(0===a.length)return null;let b=(ag.start+ag.end)/2;for(let c of a)if(c.startLine<=b&&b<=c.endLine)return c.qualifiedName;let c=null;for(let b of a)b.startLine<=ag.start&&(!c||b.startLine>c.startLine)&&(c=b);return c?.qualifiedName??null},[O,ag]),aj=h&&!!a&&!!N,ak=(0,n.r)(),{comments:al,addComment:am,updateComment:an,deleteComment:ao,refresh:ap}=(0,o._)({cwd:a,filePath:N??""}),[aq,ar]=(0,f.useState)(null),{toolbar:as,clearToolbar:at}=(0,u.r)({enabled:aj,container:aq}),[au,av]=(0,f.useState)(null),[aw,ax]=(0,f.useState)(null),[ay,az]=(0,f.useState)(null),aA=(0,f.useCallback)(()=>{as&&(av({x:as.x,y:as.y,range:as.range,codeContent:as.selectedText}),at())},[as,at]),aB=(0,f.useCallback)(()=>{as&&(ax({x:as.x,y:as.y,range:as.range,codeContent:as.selectedText}),at())},[as,at]),aC=(0,f.useCallback)(()=>{if(!as||!i)return;let a=as.selectedText.trim();at(),a&&i(a)},[as,i,at]),aD=(0,f.useCallback)(async a=>{au&&(await am(au.range.start,au.range.end,a,au.codeContent),av(null))},[au,am]),aE=(0,f.useCallback)(async b=>{if(aw&&ak&&a&&N)try{let c=(await (0,p.$3)(a)).map(a=>({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0}));c.push({filePath:N,startLine:aw.range.start,endLine:aw.range.end,codeContent:aw.codeContent});let d=(0,p.Gw)(c,b);ak.sendMessage(d),await (0,p.RP)(a),ap(),ax(null)}catch(a){console.error("[BlockViewer] send to AI failed:",a)}},[aw,ak,a,N,ap]),aF=(0,f.useCallback)((a,b)=>{b.stopPropagation(),az({comment:a,x:b.clientX,y:b.clientY}),at(),av(null),ax(null)},[at]);if(!N)return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(M,{focalFile:null,fileCount:null,onSwitchToCode:d,onSearch:()=>V(!0),onRefresh:P,refreshDisabled:!0,extraLeft:C,extraRight:D}),(0,e.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center text-sm text-muted-foreground gap-2 px-4 text-center",children:[(0,e.jsx)("span",{children:E("blockViewer.empty.body","Select a file in the left tree to see its function call graph.")}),(0,e.jsx)("span",{className:"text-xs",children:E("blockViewer.empty.hint","or press ⌘K to search.")})]}),U&&(0,e.jsx)(I,{cwd:a,onSelect:ac,onClose:()=>V(!1)})]});if("idle"===O.state||"loading"===O.state)return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(M,{focalFile:N,fileCount:null,onSwitchToCode:d,onSearch:()=>V(!0),onRefresh:P,refreshDisabled:!0,extraLeft:C,extraRight:D}),(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:E("blockViewer.fileMode.loading","Loading…")})]});if("notFound"===O.state)return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(M,{focalFile:N,fileCount:null,onSwitchToCode:d,onSearch:()=>V(!0),onRefresh:P,extraLeft:C,extraRight:D}),(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground px-4 text-center",children:E("blockViewer.fileMode.notFound","This file is not indexed (unsupported language or beyond the file cap).")}),U&&(0,e.jsx)(I,{cwd:a,onSelect:ac,onClose:()=>V(!1)})]});if("error"===O.state)return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(M,{focalFile:N,fileCount:null,onSwitchToCode:d,onSearch:()=>V(!0),onRefresh:P,extraLeft:C,extraRight:D}),(0,e.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-sm",children:[(0,e.jsx)("span",{className:"text-red-11",children:O.message}),(0,e.jsx)("button",{onClick:P,className:"px-3 py-1 rounded bg-secondary hover:bg-secondary/80",children:E("blockViewer.retry","Retry")})]})]});let aG=O.data,aH=aG.functions;if(0===aH.length&&Q){let a=Math.max(1,Q.content.split("\n").length);aH=[{filePath:aG.filePath,qualifiedName:"__file__",name:B(aG.filePath),kind:"unknown",startLine:1,endLine:a}]}let aI=l&&l===aG.filePath,aJ=r&&r===aG.filePath,aK=A&&A===aG.filePath;aI&&k&&(aH=aH.filter(a=>k.has(a.qualifiedName)));let aL=aJ?q:void 0,aM=aK?v:void 0,aN=L(aG.upstreamCalls),aO=L(aG.downstreamCalls),aP=new Map(aH.map(a=>[a.qualifiedName,a])),aQ=new Map,aR=new Map;for(let a of aG.intraCalls){let b=aP.get(a.to),c=aP.get(a.from);if(b){let c=aQ.get(a.from),d={kind:"self",external:b,lines:a.lines};c?c.push(d):aQ.set(a.from,[d])}if(c){let b=aR.get(a.to),d={kind:"self",external:c,lines:a.lines};b?b.push(d):aR.set(a.to,[d])}}let aS=new Map;for(let a of aG.externalCalls??[]){let b=aS.get(a.focalQname),c={kind:"ext",name:a.external.name,packageSpec:a.external.packageSpec,lines:a.lines};b?b.push(c):aS.set(a.focalQname,[c])}let aT=new Map;for(let a of aG.methodCalls??[]){let b=aT.get(a.focalQname),c={kind:"method",receiverName:a.receiverName,methodName:a.methodName,lines:a.lines};b?b.push(c):aT.set(a.focalQname,[c])}let aU=c.has(aG.filePath);return(0,e.jsxs)("div",{className:"h-full flex flex-col relative",children:[(0,e.jsx)(M,{focalFile:N,fileCount:aG.fileCount,functionCount:aG.functions.length,upstreamCount:aG.upstreamCalls.length,downstreamCount:aG.downstreamCalls.length,onSwitchToCode:d,onSearch:()=>V(!0),onRefresh:P,extraLeft:C,extraRight:D}),(0,e.jsxs)("div",{ref:ar,className:"flex-1 relative min-h-0 flex",children:[(0,e.jsx)(t.g,{functions:aH,currentQname:ai,onSelect:ad}),(0,e.jsx)("div",{ref:af,className:"flex-1 min-w-0 overflow-auto",children:(0,e.jsx)("div",{className:"flex flex-col gap-3 p-3",children:aH.map(a=>{let b,c,d,f,g,h;return(0,e.jsx)(H,{symbol:a,fileSource:Q?.content??null,hasChange:aU,upstream:(b=aN.get(a.qualifiedName),c=aR.get(a.qualifiedName),[...(b??[]).map(a=>({kind:"cross",external:a.external,lines:a.lines})),...c??[]]),downstream:(d=aO.get(a.qualifiedName),f=aQ.get(a.qualifiedName),g=aT.get(a.qualifiedName),h=aS.get(a.qualifiedName),[...(d??[]).map(a=>({kind:"cross",external:a.external,lines:a.lines})),...f??[],...g??[],...h??[]]),onPinClick:aa,onHighlighted:_,comments:aj?al:void 0,onCommentClick:aj?aF:void 0,accentQnames:aL,addedLines:aM},a.qualifiedName)})})}),aj&&as&&aq&&(0,e.jsx)(x.w,{x:as.x,y:as.y,visible:!0,container:aq,onAddComment:aA,onSendToAI:aB,onSearch:i?aC:void 0,isChatLoading:ak?.isLoading}),aj&&au&&(0,e.jsx)(y.t,{x:au.x,y:au.y,range:au.range,codeContent:au.codeContent,container:aq,onSubmit:aD,onClose:()=>av(null)}),aj&&aw&&N&&(0,e.jsx)(y.G,{x:aw.x,y:aw.y,range:aw.range,filePath:N,codeContent:aw.codeContent,container:aq,onSubmit:aE,onClose:()=>ax(null),isChatLoading:ak?.isLoading}),aj&&ay&&(0,e.jsx)(z.t,{x:ay.x,y:ay.y,comment:ay.comment,container:aq,onClose:()=>az(null),onUpdateComment:an,onDeleteComment:ao}),aM&&aM.size>0&&aH.length>0&&(0,e.jsx)(w.e,{addedLines:aM,blockRanges:aH.map(a=>({qname:a.qualifiedName,startLine:a.startLine,endLine:a.endLine})),viewportRange:ag,onJumpToLine:ad}),(0,e.jsx)(s.mp,{entries:S,onSelect:ab,onClear:()=>T([])}),U&&(0,e.jsx)(I,{cwd:a,onSelect:ac,onClose:()=>V(!1)})]})]})}function L(a){let b=new Map;for(let c of a){let a=b.get(c.focalQname);if(!a){b.set(c.focalQname,[c]);continue}a.some(a=>a.external.filePath===c.external.filePath&&a.external.qualifiedName===c.external.qualifiedName)||a.push(c)}return b}function M({focalFile:a,fileCount:b,functionCount:c,upstreamCount:d,downstreamCount:f,onSwitchToCode:i,onSearch:j,onRefresh:l,refreshDisabled:m,extraLeft:n,extraRight:o}){let{t:p}=(0,g.Bd)(),q={focalFile:a,blockCount:c??0,upstreamCount:d??0,downstreamCount:f??0};return(0,e.jsxs)("div",{className:"flex-shrink-0 px-3 py-2 border-b border-border flex items-center justify-between bg-secondary/30 gap-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 min-w-0 text-xs text-muted-foreground font-mono",children:[(0,e.jsx)("span",{className:"truncate min-w-0",children:a?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-foreground",children:a}),"number"==typeof c&&(0,e.jsxs)("span",{className:"ml-2",children:["\xb7 ",c," blocks"]}),"number"==typeof d&&"number"==typeof f&&(0,e.jsxs)("span",{className:"ml-2",children:["\xb7 ",d," in \xb7 ",f," out"]})]}):(0,e.jsx)("span",{children:null!==b?`${b} files`:"…"})}),n&&(0,e.jsx)("span",{className:"flex items-center gap-1 flex-shrink-0",children:n(q)})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[o&&(0,e.jsx)("span",{className:"flex items-center gap-1",children:o(q)}),(0,e.jsxs)("button",{onClick:j,className:"text-xs px-2 py-1 rounded hover:bg-secondary text-muted-foreground hover:text-foreground flex items-center gap-1","data-tooltip":p("blockViewer.search.tooltip","Search (⌘K)"),children:[(0,e.jsx)(h.A,{className:"w-3 h-3"})," ⌘K"]}),(0,e.jsx)("button",{onClick:l,disabled:m,className:"text-xs px-2 py-1 rounded hover:bg-secondary text-muted-foreground hover:text-foreground disabled:opacity-50 disabled:hover:bg-transparent","data-tooltip":p("blockViewer.refresh","Rebuild project graph"),children:(0,e.jsx)(k.A,{className:"w-3 h-3"})}),i&&(0,e.jsx)("button",{onClick:i,className:"text-xs px-2 py-1 rounded hover:bg-secondary text-muted-foreground hover:text-foreground",children:"Code"})]})]})}d()}catch(a){d(a)}})},90298:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{r:()=>j});var e=c(48249),f=c(67484),g=c(44256),h=c(33281),i=c(41224);let a=[{value:"deepseek-v4-flash",label:"deepseek-v4-flash"},{value:"deepseek-v4-pro",label:"deepseek-v4-pro"}];function j({currentModel:b,onModelChange:c}){let[d,k]=(0,f.useState)(!1),[l,m]=(0,f.useState)(""),[n,o]=(0,f.useState)(""),[p,q]=(0,f.useState)(!1),[r,s]=(0,f.useState)(!1),[t,u]=(0,f.useState)(!1),[v,w]=(0,f.useState)(null),x=(0,f.useRef)(null),y=(0,f.useRef)(null),z=(0,f.useRef)(null),[A,B]=(0,f.useState)({top:0,left:0}),C=(0,g.F2)(),D=(0,f.useCallback)(async()=>{s(!0),w(null);let d=await h.t4.runPromiseExit((0,i.td)());if("Failure"===d._tag){w("Failed to load settings"),s(!1);return}let e=d.value,f=e?.engines?.deepseek?.apiKey||"";m(f),o(""),q(!1);let g=e?.engines?.deepseek?.model;!b&&g&&a.some(a=>a.value===g)&&c(g),s(!1)},[b,c]),E=(0,f.useCallback)(async a=>{let b=await h.t4.runPromiseExit((0,i.td)()),c=("Success"===b._tag?b.value:{}).engines||{},d={...c,deepseek:{...c.deepseek||{},...a}},e=await h.t4.runPromiseExit((0,i.em)({engines:d}));if("Failure"===e._tag)throw Error("Failed to save settings")},[]),F=async()=>{let a=n.trim();if(a){u(!0),w(null);try{await E({apiKey:a}),m(a),o(""),q(!1)}catch(a){w(a instanceof Error?a.message:"Save failed")}finally{u(!1)}}},G=async()=>{u(!0),w(null);try{await E({apiKey:""}),m(""),o(""),q(!1)}catch(a){w(a instanceof Error?a.message:"Clear failed")}finally{u(!1)}},H=async a=>{c(a);try{await E({model:a})}catch{}},I=!!l,J=I?b||"deepseek-v4-flash":"Set API key",K=I?"text-sky-400":"text-amber-400",L=d?(0,e.jsx)(g.ZL,{children:(0,e.jsx)("div",{ref:y,className:"fixed z-[9999] bg-popover border border-border rounded-lg shadow-lg py-2 min-w-[280px]",style:{top:A.top,left:A.left},children:r?(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin"}),"Loading..."]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"px-3 py-1.5",children:[(0,e.jsx)("div",{className:"text-[11px] font-medium text-muted-foreground mb-1.5",children:"API Key"}),I&&!p?(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("code",{className:"flex-1 min-w-0 truncate text-xs px-2 py-1 rounded bg-secondary text-foreground font-mono",children:l?l.length<=8?l.replace(/./g,"•"):`${l.slice(0,3)}${"•".repeat(Math.max(4,l.length-7))}${l.slice(-4)}`:""}),(0,e.jsx)("button",{onClick:()=>{q(!0),o(""),setTimeout(()=>z.current?.focus(),0)},className:"text-[11px] px-2 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",disabled:t,children:"Edit"}),(0,e.jsx)("button",{onClick:G,className:"text-[11px] px-2 py-1 rounded text-red-400 hover:bg-red-500/10 transition-colors",disabled:t,children:"Clear"})]}):(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("input",{ref:z,type:"password",value:n,onChange:a=>o(a.target.value),onKeyDown:a=>{"Enter"===a.key&&F()},placeholder:"sk-...",className:"flex-1 min-w-0 text-xs px-2 py-1 rounded bg-secondary text-foreground border border-border focus:border-sky-500 focus:outline-none font-mono",autoFocus:!0}),(0,e.jsx)("button",{onClick:F,disabled:t||!n.trim(),className:"text-[11px] px-2 py-1 rounded bg-sky-500/20 hover:bg-sky-500/30 text-sky-300 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:t?"Saving...":"Save"}),I&&(0,e.jsx)("button",{onClick:()=>{q(!1),o("")},className:"text-[11px] px-2 py-1 rounded text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"})]}),v&&(0,e.jsx)("div",{className:"mt-1 text-[11px] text-red-400",children:v})]}),(0,e.jsx)("div",{className:"my-1 border-t border-border"}),(0,e.jsxs)("div",{className:"px-3 py-1.5",children:[(0,e.jsx)("div",{className:"text-[11px] font-medium text-muted-foreground mb-1.5",children:"Model"}),(0,e.jsx)("div",{className:"flex flex-col gap-0.5",children:a.map(a=>{let c=(b||"deepseek-v4-flash")===a.value;return(0,e.jsxs)("button",{onClick:()=>H(a.value),className:`flex items-center gap-2 px-2 py-1 text-xs rounded transition-colors ${c?"bg-sky-500/15 text-sky-300":"text-foreground hover:bg-accent"}`,children:[(0,e.jsx)("span",{className:`w-3 h-3 rounded-full border-2 flex items-center justify-center ${c?"border-sky-400":"border-muted-foreground"}`,children:c&&(0,e.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-sky-400"})}),(0,e.jsx)("span",{children:a.label})]},a.value)})})]})]})})}):null;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{ref:x,onClick:()=>{if(!d){if(x.current){let a=x.current.getBoundingClientRect(),b=C?.getBoundingClientRect(),c=b?.left??0,d=b?.top??0;B({top:a.bottom+4-d,left:a.left-c})}D()}k(a=>!a)},className:"flex items-center gap-1 px-2 py-0.5 text-[11px] rounded bg-sky-500/15 hover:bg-sky-500/25 transition-colors",title:"Configure DeepSeek",children:[(0,e.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-sky-500 flex-shrink-0"}),(0,e.jsx)("span",{className:`truncate max-w-[160px] ${K}`,children:J}),(0,e.jsx)("svg",{className:"w-3 h-3 flex-shrink-0 text-sky-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),L]})}d()}catch(a){d(a)}})},90677:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(48249),e=c(3560),f=c(78684),g=c(74493),h=a([f]);f=(h.then?(await h)():h)[0],(0,e.Aq)({type:"jupyter",idPrefix:"nb",match:a=>a.trim().endsWith(".ipynb"),parse(a){let b=a.trim(),c=b.split("/"),d=c[c.length-1]||b;return{filePath:b,displayName:d,cwd:""}},fromHistory:a=>({filePath:a.filePath,displayName:a.displayName||"",cwd:a.cwd||""}),toHistory:a=>({filePath:a.filePath,displayName:a.displayName,cwd:a.cwd}),Component:function({item:a,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l}){return(0,d.jsx)(f.o,{id:a.id,filePath:a.filePath,displayName:a.displayName,cwd:a.cwd,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l})},async onClose(a){await (0,g.Hj)(a.id)}}),b()}catch(a){b(a)}})},91579:(a,b,c)=>{"use strict";c.d(b,{$3:()=>l,Cm:()=>k,Gw:()=>o,RP:()=>m,Un:()=>n,zL:()=>j});var d=c(208),e=c(79606),f=c(33281),g=c(71192),h=c(89800);let i=new Set;function j(a){return i.add(a),()=>i.delete(a)}function k(){i.forEach(a=>a())}async function l(a){let b=await f.t4.runPromiseExit((0,h.lb)(a));if("Success"!==b._tag)throw Error("Failed to fetch comments");let c=b.value.comments??[];if(0===c.length)return[];let d=new Map;for(let a of c)a.selectedText||(d.has(a.filePath)||d.set(a.filePath,[]),d.get(a.filePath).push(a));let i=new Map;await Promise.all(Array.from(d.keys()).map(async b=>{let c=await f.t4.runPromiseExit(e.tryPromise({try:async()=>{let c=await fetch(`/api/files/text?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`);return c.ok?await c.json():null},catch:a=>new g.uV({message:`read file text ${b} failed`,cause:a})}));"Success"===c._tag&&c.value&&"string"==typeof c.value.content?i.set(b,c.value.content.split("\n")):"Failure"===c._tag&&console.error(`Failed to read file ${b}:`,c.cause)}));let j=[];for(let a of c){if(a.selectedText){j.push({...a,codeContent:a.selectedText});continue}let b=i.get(a.filePath),c="";if(b){let d=Math.max(0,a.startLine-1),e=Math.min(b.length,a.endLine);c=b.slice(d,e).join("\n")}j.push({...a,codeContent:c})}return j}async function m(a){let b=await f.t4.runPromiseExit((0,h.tj)(a));return"Success"===b._tag?(k(),!0):(console.error("Failed to clear comments:",b.cause),!1)}let n="__chat__";function o(a,b){let c=a.filter(a=>a.filePath===n),e=a.filter(a=>a.filePath!==n),f=[];for(let a of(e.length>0&&(f.push(`${d.A.t("comments.codeRef")}`,""),e.forEach((a,b)=>{f.push(`[${b+1}] ${a.filePath}:${a.startLine}-${a.endLine}`),f.push("```"),f.push(a.codeContent),f.push("```"),a.note&&f.push(d.A.t("comments.note",{content:a.note})),f.push("")})),c)){let b=a.codeContent.split("\n").map(a=>`> ${a}`).join("\n");f.push(b),a.note&&f.push(a.note),f.push("")}return f.push(d.A.t("comments.question",{question:b})),f.join("\n")}},92451:(a,b,c)=>{"use strict";c.d(b,{U:()=>g});var d=c(48249),e=c(67484),f=c(19545);function g({editor:a,query:b,position:c,onClose:h}){let[i,j]=(0,e.useState)(0),k=(0,e.useRef)(null),l=(0,f.Qe)().filter(a=>a.label.toLowerCase().includes(b.toLowerCase())||a.description.toLowerCase().includes(b.toLowerCase()));return 0===l.length?null:(0,d.jsx)("div",{ref:k,className:"slash-command-menu fixed z-[60] bg-popover border border-border rounded-lg shadow-lg py-1 w-56 max-h-64 overflow-y-auto",style:{top:c.top,left:c.left},children:l.map((c,e)=>(0,d.jsxs)("button",{className:`w-full flex items-center gap-3 px-3 py-2 text-left text-sm transition-colors ${e===i?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"}`,onClick:()=>{a.chain().focus().deleteRange({from:a.state.selection.from-b.length-1,to:a.state.selection.from}).run(),c.action(a),h()},onMouseEnter:()=>j(e),children:[(0,d.jsx)("span",{className:"w-6 text-center text-xs font-mono flex-shrink-0",children:c.icon}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"font-medium",children:c.label}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground",children:c.description})]})]},c.label))})}},93448:(a,b,c)=>{"use strict";c.d(b,{TabManagerTopBar:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call TabManagerTopBar() from the server but TabManagerTopBar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/TabManagerTopBar.tsx","TabManagerTopBar")},94192:(a,b,c)=>{"use strict";c.d(b,{R8:()=>i,c0:()=>k,fY:()=>j,gT:()=>l});var d=c(48249),e=c(67484);let f=["agent","explorer","console"],g={agent:"AGENT",explorer:"EXPLORER",console:"CONSOLE"},h=(0,e.createContext)(null);function i(){let a=(0,e.useContext)(h);if(!a)throw Error("useSwipeContext must be used within SwipeableViewContainer");return a}function j({activeView:a,onViewChange:b,children:c}){(0,e.useRef)(null),(0,e.useRef)(!1),(0,e.useRef)(0);let[g,i]=(0,e.useState)(0),[k,l]=(0,e.useState)(!1);f.indexOf(a),f.length;let[m,n]=(0,e.useState)(!1),o={activeView:a,onViewChange:b,dragOffset:(()=>{if(!m)return 0;let a=window.innerWidth;return a?g/a:0})(),isDragging:m&&k};return(0,d.jsx)(h.Provider,{value:o,children:c})}function k({children:a}){let b,c,{activeView:g,dragOffset:h,isDragging:j}=i(),l=(0,e.useRef)(null),m=(0,e.useRef)(null),n=f.indexOf(g),o=f.length;return(0,d.jsx)("div",{ref:l,className:"flex-1 overflow-hidden relative",style:{overscrollBehaviorX:"none"},children:(0,d.jsx)("div",{ref:m,className:j?"flex":"flex transition-transform duration-100 ease-out",style:{position:"absolute",top:"0px",bottom:"0px",left:"0px",width:`${100*f.length}%`,transform:(b=h/o*100,c=-(100/o*n)+(Number.isFinite(b)?b:0),`translateX(${c}%)`)},children:a})})}function l(){let{activeView:a,onViewChange:b,dragOffset:c,isDragging:h}=i(),j=(0,e.useRef)(null),k=(0,e.useRef)([]),[l,m]=(0,e.useState)({left:0,width:0}),n=f.indexOf(a),o=Number.isFinite(c)?c:0,p=Math.round(Math.max(0,Math.min(f.length-1,n-o)));return(0,d.jsxs)("div",{ref:j,className:"relative flex gap-4",children:[f.map((a,c)=>(0,d.jsx)("button",{ref:a=>{k.current[c]=a},onClick:()=>b(a),className:`px-4 py-1 text-sm font-medium transition-colors ${p===c?"text-brand":"text-muted-foreground hover:text-foreground"}`,children:g[a]},a)),(0,d.jsx)("div",{className:`absolute bottom-0 h-0.5 bg-brand ${h?"":"transition-all duration-100 ease-out"}`,style:{left:l.left,width:l.width}})]})}},94239:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{c:()=>k});var e=c(48249),f=c(67484),g=c(44384),h=c(61591),i=c(44256);function j({path:a,matchedIndices:b}){let c=(0,f.useMemo)(()=>new Set(b),[b]),d=a.lastIndexOf("/"),g=d>=0?a.slice(0,d+1):"",h=d>=0?a.slice(d+1):a,i=(a,b,d)=>{let f=[],g="",h=!1;for(let d=0;d<a.length;d++){let i=b+d,j=c.has(i);j!==h&&g&&(f.push(h?(0,e.jsx)("span",{className:"text-brand font-medium",children:g},`${b}-${d}`):(0,e.jsx)("span",{children:g},`${b}-${d}`)),g=""),h=j,g+=a[d]}return g&&f.push(h?(0,e.jsx)("span",{className:"text-brand font-medium",children:g},`${b}-end`):(0,e.jsx)("span",{children:g},`${b}-end`)),(0,e.jsx)("span",{className:d,children:f})};return(0,e.jsxs)("span",{className:"truncate",children:[g&&i(g,0,"text-muted-foreground"),i(h,g.length,"text-foreground")]})}function k({files:a,fileIndex:b,recentFiles:c,onSelectFile:d,onClose:l}){let{t:m}=(0,g.Bd)(),[n,o]=(0,f.useState)(""),[p,q]=(0,f.useState)(0),r=(0,f.useRef)(null),s=(0,f.useRef)(null),t=(0,f.useMemo)(()=>{let c,d;return b??(c=[],(d=a=>{for(let b of a)b.isDirectory&&b.children?d(b.children):b.isDirectory||c.push(b.path)})(a),c)},[b,a]),u=(0,f.useMemo)(()=>{if(!n.trim()){let a=new Set(c),b=c.map(a=>({path:a,score:0,matchedIndices:[]})),d=t.filter(b=>!a.has(b)).slice(0,50).map(a=>({path:a,score:0,matchedIndices:[]}));return[...b,...d]}let a=[];for(let b of t){let d=function(a,b){let c=a.toLowerCase(),d=b.toLowerCase(),e=[],f=0,g=0,h=-1;for(let i=0;i<c.length&&f<d.length;i++)if(c[i]===d[f]){e.push(i),h===i-1&&(g+=5),(0===i||"/"===a[i-1]||"."===a[i-1]||"-"===a[i-1]||"_"===a[i-1])&&(g+=10);let c=a.lastIndexOf("/");i>c&&(g+=3),a[i]===b[f]&&(g+=1),h=i,f++}return f<d.length?null:(g-=.1*a.length,{path:a,score:g,matchedIndices:e})}(b,n.trim());d&&(c.includes(b)&&(d.score+=20),a.push(d))}return a.sort((a,b)=>b.score-a.score),a.slice(0,50)},[n,t,c]),v=(0,f.useCallback)(a=>{o(a),q(0)},[]),w=(0,f.useCallback)(a=>{d(a),l()},[d,l]),x=(0,f.useCallback)(a=>{if(!a.nativeEvent.isComposing)switch(a.key){case"ArrowDown":a.preventDefault(),q(a=>Math.min(a+1,u.length-1));break;case"ArrowUp":a.preventDefault(),q(a=>Math.max(a-1,0));break;case"Enter":a.preventDefault(),u[p]&&w(u[p].path);break;case"Escape":a.preventDefault(),l()}},[u,p,w,l]);return(0,e.jsx)(i.ZL,{children:(0,e.jsx)("div",{className:"fixed inset-0 z-[300] flex items-start justify-center pt-[15vh]",onClick:l,children:(0,e.jsxs)("div",{className:"w-[680px] max-h-[60vh] bg-card border border-border rounded-lg shadow-2xl overflow-hidden flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:[(0,e.jsx)("svg",{className:"w-4 h-4 text-muted-foreground flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,e.jsx)("input",{ref:r,value:n,onChange:a=>v(a.target.value),onKeyDown:x,placeholder:m("quickFileOpen.placeholder"),className:"flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground",autoComplete:"off",autoCorrect:"off",spellCheck:"false"}),(0,e.jsx)("kbd",{className:"text-[10px] text-muted-foreground px-1.5 py-0.5 rounded border border-border bg-secondary",children:"ESC"})]}),(0,e.jsx)("div",{ref:s,className:"flex-1 overflow-y-auto py-1",children:0===u.length?(0,e.jsx)("div",{className:"px-3 py-8 text-center text-sm text-muted-foreground",children:m("quickFileOpen.noMatch")}):u.map((a,b)=>(0,e.jsxs)("div",{className:`px-3 py-1.5 flex items-center gap-2 cursor-pointer transition-colors ${b===p?"bg-brand/15 text-foreground":"hover:bg-accent text-foreground"}`,"data-tooltip":a.path,onClick:()=>w(a.path),children:[(0,e.jsx)(h.o,{name:a.path.split("/").pop()||"",className:"w-4 h-4 flex-shrink-0"}),(0,e.jsx)(j,{path:a.path,matchedIndices:a.matchedIndices}),!n.trim()&&c.includes(a.path)&&(0,e.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground px-1.5 py-0.5 rounded bg-secondary flex-shrink-0",children:m("quickFileOpen.recent")})]},a.path))}),(0,e.jsxs)("div",{className:"px-3 py-1.5 border-t border-border flex items-center gap-3 text-[10px] text-muted-foreground",children:[(0,e.jsxs)("span",{className:"flex items-center gap-1",children:[(0,e.jsx)("kbd",{className:"px-1 py-0.5 rounded border border-border bg-secondary",children:"↑↓"})," ",m("quickFileOpen.selectHint")]}),(0,e.jsxs)("span",{className:"flex items-center gap-1",children:[(0,e.jsx)("kbd",{className:"px-1 py-0.5 rounded border border-border bg-secondary",children:"Enter"})," ",m("quickFileOpen.openHint")]}),(0,e.jsxs)("span",{className:"flex items-center gap-1",children:[(0,e.jsx)("kbd",{className:"px-1 py-0.5 rounded border border-border bg-secondary",children:"Esc"})," ",m("quickFileOpen.closeHint")]})]})]})})})}d()}catch(a){d(a)}})},94308:(a,b,c)=>{"use strict";c.d(b,{e:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({branches:a,selectedBranch:b,onSelect:c,isLoading:h,pinnedBranches:i=[]}){let{t:j}=(0,f.Bd)(),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(""),o=(0,e.useRef)(null),p=(0,e.useRef)(null),q=m.toLowerCase(),r=new Set([...a?.local||[],...a?.remote||[]]),s=i.filter(a=>r.has(a)&&a.toLowerCase().includes(q)),t=new Set(s),u=a?.local.filter(a=>!t.has(a)&&a.toLowerCase().includes(q))||[],v=a?.remote.filter(a=>!t.has(a)&&a.toLowerCase().includes(q))||[],w=a=>{c(a),l(!1),n("")};return(0,d.jsxs)("div",{className:"relative",ref:o,children:[(0,d.jsxs)("button",{onClick:()=>l(!k),disabled:h,className:"w-full px-3 py-1.5 text-sm border border-border rounded bg-card text-foreground text-left flex items-center justify-between hover:border-slate-6 dark:hover:border-slate-6 transition-colors",children:[(0,d.jsxs)("span",{className:"truncate flex items-center gap-2",children:[(0,d.jsx)("svg",{className:"w-4 h-4 text-muted-foreground flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),b||j("git.selectBranch"),a?.current===b&&(0,d.jsxs)("span",{className:"text-xs text-green-11",children:["(",j("git.currentBranch"),")"]})]}),(0,d.jsx)("svg",{className:`w-4 h-4 text-slate-9 transition-transform ${k?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),k&&(0,d.jsxs)("div",{className:"absolute z-50 mt-1 w-full bg-card border border-border rounded-lg shadow-lg max-h-80 flex flex-col",children:[(0,d.jsx)("div",{className:"p-2 border-b border-border",children:(0,d.jsx)("input",{ref:p,type:"text",value:m,onChange:a=>n(a.target.value),placeholder:j("git.searchBranch"),className:"w-full px-2 py-1 text-sm border border-border rounded bg-secondary text-foreground placeholder-slate-9"})}),(0,d.jsxs)("div",{className:"overflow-y-auto flex-1",children:[s.length>0&&s.map(c=>(0,d.jsxs)("div",{onClick:()=>w(c),className:`px-3 py-1.5 text-sm cursor-pointer flex items-center gap-2 ${c===b?"bg-brand/10 text-brand":"hover:bg-accent text-foreground"}`,children:[(0,d.jsx)("span",{className:"truncate flex-1",children:c}),c===a?.current&&(0,d.jsx)("span",{className:"text-xs text-green-11 flex-shrink-0",children:j("git.currentBranch")}),c===b&&(0,d.jsx)("svg",{className:"w-4 h-4 text-brand flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},`pinned-${c}`)),u.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"px-3 py-1 text-xs font-medium text-muted-foreground bg-secondary sticky top-0",children:j("git.localBranches")}),u.map(c=>(0,d.jsxs)("div",{onClick:()=>w(c),className:`px-3 py-1.5 text-sm cursor-pointer flex items-center gap-2 ${c===b?"bg-brand/10 text-brand":"hover:bg-accent text-foreground"}`,children:[(0,d.jsx)("span",{className:"truncate flex-1",children:c}),c===a?.current&&(0,d.jsx)("span",{className:"text-xs text-green-11 flex-shrink-0",children:j("git.currentBranch")}),c===b&&(0,d.jsx)("svg",{className:"w-4 h-4 text-brand flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},c))]}),v.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"px-3 py-1 text-xs font-medium text-muted-foreground bg-secondary sticky top-0",children:j("git.remoteBranches")}),v.map(a=>(0,d.jsxs)("div",{onClick:()=>w(a),className:`px-3 py-1.5 text-sm cursor-pointer flex items-center gap-2 ${a===b?"bg-brand/10 text-brand":"hover:bg-accent text-foreground"}`,children:[(0,d.jsx)("span",{className:"truncate flex-1",children:a}),a===b&&(0,d.jsx)("svg",{className:"w-4 h-4 text-brand flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},a))]}),0===s.length&&0===u.length&&0===v.length&&(0,d.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:j("git.noMatchingBranches")})]})]})]})}},95401:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{m:()=>j});var e=c(48249),f=c(67484),g=c(44256),h=c(33281),i=c(41224);function j({currentModel:a,onModelChange:b}){let[c,d]=(0,f.useState)(!1),[k,l]=(0,f.useState)([]),[m,n]=(0,f.useState)(!1),[o,p]=(0,f.useState)(null),[q,r]=(0,f.useState)(!1),s=(0,f.useRef)(null),t=(0,f.useRef)(null),[u,v]=(0,f.useState)({top:0,left:0}),w=(0,g.F2)(),x=(0,f.useCallback)(async()=>{n(!0),p(null);let a=await h.t4.runPromiseExit((0,i.qD)(()=>r(!0)));if(r(!1),"Failure"===a._tag)p("Connection error");else{let b=a.value;switch(b._tag){case"ok":l(b.models);break;case"not-installed":case"error":p(b.message);break;case"not-running":p("Ollama is not running")}}n(!1)},[]),y=a?a.replace(/:latest$/,""):"Select model",z=c?(0,e.jsx)(g.ZL,{children:(0,e.jsx)("div",{ref:t,className:"fixed z-[9999] bg-popover border border-border rounded-lg shadow-lg py-1 min-w-[200px] max-h-[300px] overflow-y-auto",style:{top:u.top,left:u.left},children:m||q?(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin"}),q?"Starting Ollama...":"Loading models..."]}):o?(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-red-400",children:o}):0===k.length?(0,e.jsxs)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:["No models found. Run ",(0,e.jsx)("code",{className:"bg-secondary px-1 rounded",children:"ollama pull <model>"})]}):k.map(c=>{var f;return(0,e.jsxs)("button",{onClick:()=>{var a;return a=c.name,void(b(a),d(!1))},className:`w-full flex items-center justify-between gap-2 px-3 py-1.5 text-xs hover:bg-brand/10 transition-colors ${c.name===a?"text-brand":"text-foreground"}`,children:[(0,e.jsx)("span",{className:"truncate",children:c.name.replace(/:latest$/,"")}),(0,e.jsx)("span",{className:"text-muted-foreground flex-shrink-0",children:c.parameter_size||((f=c.size)<1e9?`${(f/1e6).toFixed(0)}M`:`${(f/1e9).toFixed(1)}G`)})]},c.name)})})}):null;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{ref:s,onClick:()=>{if(!c){if(s.current){let a=s.current.getBoundingClientRect(),b=w?.getBoundingClientRect(),c=b?.left??0,d=b?.top??0;v({top:a.bottom+4-d,left:a.left-c})}x()}d(a=>!a)},className:"flex items-center gap-1 px-2 py-0.5 text-[11px] rounded bg-violet-500/15 text-violet-400 hover:bg-violet-500/25 transition-colors",title:"Switch Ollama model",children:[(0,e.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-violet-500 flex-shrink-0"}),(0,e.jsx)("span",{className:"truncate max-w-[120px]",children:y}),(0,e.jsx)("svg",{className:"w-3 h-3 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),z]})}d()}catch(a){d(a)}})},96487:()=>{},97572:(a,b,c)=>{"use strict";c.d(b,{g:()=>g,v:()=>f});var d=c(79606),e=c(71192);let f=d.tryPromise({try:async()=>{let a=await fetch("/api/projects");if(!a.ok)throw Error(`HTTP ${a.status}`);return await a.json()},catch:a=>new e.uV({message:"fetch /api/projects failed",cause:a})}),g=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/projects",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)});if(!b.ok)throw Error(`HTTP ${b.status}`)},catch:a=>new e.uV({message:"save /api/projects failed",cause:a})})},97951:(a,b,c)=>{"use strict";c.d(b,{e:()=>f});var d=c(67484),e=c(208);function f(a,b,{sessionId:c,cwd:g,engine:h,ollamaModel:i,deepseekModel:j,onSessionId:k,onFetchTitle:l}){let[m,n]=(0,d.useState)(!1),[o,p]=(0,d.useState)(null),[q,r]=(0,d.useState)(null),[s,t]=(0,d.useState)(null),u=(0,d.useRef)(null),v=(0,d.useRef)(c);v.current=c;let w=(0,d.useRef)(null),x=(0,d.useRef)(null),y=(0,d.useCallback)(()=>{let a=w.current;if(a&&a.text){let{messageId:c,text:d}=a;b(a=>a.map(a=>a.id===c?{...a,content:(a.content||"")+d}:a)),w.current={messageId:c,text:""}}x.current=null},[b]),z=(0,d.useCallback)(()=>{u.current&&(u.current.abort(),u.current=null)},[]),A=(0,d.useCallback)((a,c)=>{let d=a.type;if("system"===d&&"init"===a.subtype){let b=a.session_id;k(b),v.current=b,t(null);return}if("system"===d&&"api_retry"===a.subtype)return void t({attempt:a.attempt??0,maxRetries:a.max_retries??0,delayMs:a.retry_delay_ms??0,errorStatus:a.error_status,error:a.error});if("rate_limit_event"===d){let b=a.rate_limit_info;b&&r({status:b.status||"allowed",resetsAt:b.resetsAt,rateLimitType:b.rateLimitType,utilization:b.utilization,overageStatus:b.overageStatus,overageDisabledReason:b.overageDisabledReason,isUsingOverage:b.isUsingOverage,surpassedThreshold:b.surpassedThreshold});return}if("stream_event"===d){t(a=>a?null:a);let b=a.event;if(b?.type==="content_block_delta"&&b.delta?.type==="text_delta"){let a=b.delta.text||"";w.current&&w.current.messageId===c?w.current.text+=a:w.current={messageId:c,text:a},x.current||(x.current=setTimeout(y,50))}return}if("assistant"===d){let d=a.message;if(d?.content){if("codex"===h||"kimi"===h||"ollama"===h){let a=d.content.filter(a=>"text"===a.type&&a.text).map(a=>a.text);if(a.length>0){let d=a.join("");b(a=>a.map(a=>a.id===c?{...a,content:(a.content||"")+d}:a))}}for(let a of d.content)if("name"in a&&a.name){let d={id:a.id||`tool-${Date.now()}`,name:a.name,input:a.input||{},isLoading:!0};b(a=>a.map(a=>a.id!==c||a.toolCalls?.some(a=>a.id===d.id)?a:{...a,toolCalls:[...a.toolCalls||[],d]}))}}}if("user"===d){let d=a.message;if(d?.content){for(let a of d.content)if("tool_use_id"in a&&a.tool_use_id){let d=a.tool_use_id,e="string"==typeof a.content?a.content:JSON.stringify(a.content);b(a=>a.map(a=>a.id===c?{...a,toolCalls:a.toolCalls?.map(a=>a.id===d?{...a,result:e,isLoading:!1}:a)}:a))}}}if("result"===d){t(null),x.current&&(clearTimeout(x.current),x.current=null),y();let d=v.current;d&&g&&b(a=>(2===a.length&&l(d),a));let e=a.usage,f=a.total_cost_usd;e&&p({inputTokens:e.input_tokens||0,outputTokens:e.output_tokens||0,cacheCreationInputTokens:e.cache_creation_input_tokens||0,cacheReadInputTokens:e.cache_read_input_tokens||0,totalCostUsd:f||0}),b(a=>a.map(a=>a.id===c?{...a,isStreaming:!1,toolCalls:a.toolCalls?.map(a=>({...a,isLoading:!1}))}:a))}},[b,y,k,l,g,h]),B=(0,d.useCallback)(async(a,c)=>{let d=c?.map(a=>({type:"base64",media_type:a.media_type,data:a.data})),f={id:`user-${Date.now()}`,role:"user",content:a,images:d};b(a=>[...a,f]),n(!0),t(null);let k=`assistant-${Date.now()}`,l={id:k,role:"assistant",content:"",toolCalls:[],isStreaming:!0};b(a=>[...a,l]),u.current=new AbortController;try{if("ollama"===h&&!i)throw Error("Please select an Ollama model first (click the model picker above)");let b="codex"===h?"/api/chat/codex":"kimi"===h?"/api/chat/kimi":"ollama"===h?"/api/chat/ollama":"deepseek"===h?"/api/chat/deepseek":"/api/chat",c=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:a,sessionId:v.current,images:d,cwd:g,language:e.A.language,..."ollama"===h&&i&&{model:i},..."deepseek"===h&&j&&{model:j},..."claude2"===h&&{engine:"claude2"}}),signal:u.current.signal});if(400===c.status&&"deepseek"===h){let a=await c.json().catch(()=>null);throw Error(a?.error||"DeepSeek request failed")}if(!c.ok)throw Error(e.A.t("chat.requestFailed",{defaultValue:"Request failed"}));let f=c.body?.getReader();if(!f)throw Error(e.A.t("chat.cannotReadStream",{defaultValue:"Cannot read stream"}));let l=new TextDecoder,m="";for(;;){let{done:a,value:b}=await f.read();if(a)break;let c=(m+=l.decode(b,{stream:!0})).split("\n");for(let a of(m=c.pop()||"",c))if(a.startsWith("data: ")){let b=a.slice(6);if("[DONE]"===b)continue;try{let a=JSON.parse(b);A(a,k)}catch{}}}}catch(a){if(a instanceof Error&&"AbortError"===a.name);else{console.error("Chat error:",a);let c=a instanceof Error?a.message:e.A.t("chat.errorRetry",{defaultValue:"An error occurred. Please try again."});b(a=>a.map(a=>a.id===k?{...a,content:c,isStreaming:!1}:a))}}finally{u.current=null,n(!1),b(a=>a.map(a=>a.id===k?{...a,isStreaming:!1}:a))}},[g,h,i,j,b,A]);return{isLoading:m,tokenUsage:o,rateLimitInfo:q,apiRetryInfo:s,handleSend:B,handleStop:z,abortControllerRef:u}}},98420:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{V:()=>q});var e=c(48249),f=c(67484),g=c(44384),h=c(7833),i=c(36295),j=c(33988),k=c(30894),l=c(28602),m=c(74493),n=c(15105),o=a([i,k]);async function p(a){let b=(0,n.f)()?.id??null;return!!b&&new Promise(c=>{try{let d=globalThis.chrome?.runtime;if(!d?.sendMessage)return void c(!1);let e=setTimeout(()=>c(!1),2e3);d.sendMessage(b,{type:"prepare-iframe",url:a},a=>{clearTimeout(e),c(a?.ok??!1)})}catch{c(!1)}})}function q({url:a,id:b,selected:c,maximized:d,expandedHeight:n,bubbleContentHeight:o,onSelect:r,onClose:s,onToggleMaximize:t,onNewTab:u,timestamp:v,onTitleMouseDown:w,initialSleeping:x,onSleep:y,onWake:z}){let{t:A}=(0,g.Bd)(),[B,C]=(0,f.useState)(!1),[D,E]=(0,f.useState)(null),[F,G]=(0,f.useState)(a),[H,I]=(0,f.useState)(null),[J,K]=(0,f.useState)(x??!1),L=(0,f.useRef)(null),M=(0,f.useRef)(null),N=(0,f.useRef)(null);(0,f.useRef)(!0),(0,f.useCallback)(()=>{J||(K(!0),I(null),y?.(b))},[J,b,y]),(0,f.useCallback)(()=>{L.current&&(clearTimeout(L.current),L.current=null)},[]);let O=!!H&&!J&&!B,{shortId:P,connected:Q,connect:R,disconnect:S}=(0,j.B)(b,N,O);(0,f.useRef)(Q).current=Q;let T=(0,f.useCallback)(()=>{K(!1),z?.(b);let c=function(a){if(!a)return a;try{let b=new URL(a);return b.searchParams.set("_cockpit","1"),b.toString()}catch{let b=a.includes("?")?"&":"?";return`${a}${b}_cockpit=1`}}(a);!function(a){try{let b=new URL(a).hostname;return"localhost"===b||"127.0.0.1"===b}catch{return!1}}(a)?p(a).then(()=>I(c)):I(c)},[a,b,z]),U=(0,f.useCallback)(()=>C(!1),[]),V=(0,f.useCallback)(()=>{C(!1),E(A("browser.pageLoadFailed"))},[]),W=(0,f.useCallback)(()=>{if(J)return void T();let a=M.current?.querySelector("iframe");if(a&&H){C(!0),E(null);let b=a.src;a.src="",setTimeout(()=>{a.src=b},0)}},[J,T,H]),X=(0,f.useCallback)(()=>{F&&window.open(F,"_blank")},[F]),Y=function(a){if(!a)return"";try{let b=new URL(a);return b.port?`${b.hostname}:${b.port}`:b.hostname}catch{return a}}(F),Z=d&&n?n-41:o??i.p;return(0,e.jsx)("div",{className:"flex flex-col items-start",children:(0,e.jsxs)("div",{className:`w-full bg-accent text-foreground
|
|
38
|
+
${n?"":l?"border-brand":"border-brand/30"}`,onClick:n?void 0:r,children:[(0,e.jsxs)("div",{"data-drag-handle":!0,onDoubleClick:t,onMouseDown:u,className:`flex items-center gap-2 px-4 py-1.5 border-b border-border ${n?"bg-card":"bg-card/50"}`,style:n?{height:41}:void 0,children:[(0,e.jsx)("span",{className:"text-sm flex-shrink-0",children:"\uD83D\uDCD3"}),(0,e.jsx)("span",{className:"text-xs text-foreground truncate font-mono font-medium",children:c}),ad,C&&(0,e.jsx)("span",{className:"text-[10px] text-amber-500 flex-shrink-0",children:"unsaved"}),(0,e.jsx)("span",{className:"flex-1"}),q&&(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:function(a){if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`}(q)}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),t()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:n?`Exit maximize (${(0,i.Mu)()}+M)`:`Maximize (${(0,i.Mu)()}+M)`,children:n?(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3"})}):(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),s()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:"Close",children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 px-3 py-1 border-b border-border/50 bg-surface-secondary/50 text-[11px]",children:[(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),X()},className:"px-1.5 py-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Run All",children:"▶ All"}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),Y()},className:"px-1.5 py-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Interrupt",disabled:"busy"!==K,children:"⬛ Stop"}),(0,e.jsx)("div",{className:"w-px h-3 bg-border/50 mx-1"}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),ab("code",G??w.length-1)},className:"px-1.5 py-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Add code cell",children:"+ Code"}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),ab("markdown",G??w.length-1)},className:"px-1.5 py-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Add markdown cell",children:"+ Md"}),(0,e.jsx)("div",{className:"w-px h-3 bg-border/50 mx-1"}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),T()},className:`px-1.5 py-0.5 rounded hover:bg-accent transition-colors ${C?"text-brand":"text-muted-foreground hover:text-foreground"}`,title:`Save (${(0,i.Mu)()}+S)`,disabled:E,children:E?"Saving...":"Save"}),(0,e.jsx)("span",{className:"flex-1"}),M&&(0,e.jsx)("span",{className:"text-[10px] text-red-400 truncate max-w-[50%]",title:M,children:M}),"dead"===K&&(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),U()},className:"px-1.5 py-0.5 rounded text-brand hover:bg-accent transition-colors",children:"Restart"})]}),(0,e.jsx)("div",{ref:Q,className:"overflow-y-auto",style:{height:ac-30},children:y?(0,e.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground text-sm",children:"Loading notebook..."}):A?(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 gap-2",children:[(0,e.jsx)("span",{className:"text-red-400 text-sm",children:A}),(0,e.jsx)("button",{onClick:S,className:"text-xs text-brand hover:underline",children:"Retry"})]}):0===w.length?(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 gap-2 text-muted-foreground text-sm",children:[(0,e.jsx)("span",{children:"Empty notebook"}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)("button",{onClick:()=>ab("code"),className:"text-xs text-brand hover:underline",children:"+ Code cell"}),(0,e.jsx)("button",{onClick:()=>ab("markdown"),className:"text-xs text-brand hover:underline",children:"+ Markdown cell"})]})]}):(0,e.jsxs)("div",{className:"flex flex-col gap-1 p-2",children:[w.map((a,b)=>(0,e.jsx)(j.w,{cell:a,isActive:G===b,isEditing:I===b,onSelect:()=>H(b),onEdit:()=>{H(b),J(b)},onStopEdit:()=>J(null),onSourceChange:a=>Z(b,a),onRun:()=>{"code"===a.cell_type&&W(b),b<w.length-1&&H(b+1)},onDelete:()=>$(b),onMoveUp:()=>_(b,"up"),onMoveDown:()=>_(b,"down"),onToggleType:()=>aa(b),isFirst:0===b,isLast:b===w.length-1},`${b}-${a.cell_type}`)),(0,e.jsxs)("div",{className:"flex justify-center gap-2 py-2 opacity-0 hover:opacity-100 transition-opacity",children:[(0,e.jsx)("button",{onClick:()=>ab("code",w.length-1),className:"text-[10px] text-muted-foreground hover:text-foreground px-2 py-0.5 rounded border border-border/50 hover:border-border transition-colors",children:"+ Code"}),(0,e.jsx)("button",{onClick:()=>ab("markdown",w.length-1),className:"text-[10px] text-muted-foreground hover:text-foreground px-2 py-0.5 rounded border border-border/50 hover:border-border transition-colors",children:"+ Markdown"})]})]})})]})}[g,j]=l.then?(await l)():l,d()}catch(a){d(a)}})},80532:(a,b,c)=>{"use strict";c.d(b,{Bz:()=>j,Hy:()=>g,L5:()=>h,hp:()=>i});var d=c(79606),e=c(71192);let f=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok){let a;try{a=(await c.json()).error}catch{}throw Error(a||`HTTP ${c.status}`)}return await c.json()},catch:c=>new e.uV({message:`${b?.method??"GET"} ${a} failed`,cause:c})}),g=()=>f("/api/skills"),h=a=>f("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})}),i=a=>f(`/api/skills/${encodeURIComponent(a)}`,{method:"DELETE"}),j=a=>f(`/api/skills/content?id=${encodeURIComponent(a)}`)},80983:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{K:()=>k});var e=c(48249),f=c(67484),g=c(44384),h=c(7833),i=c(61349),j=a([i]);i=(j.then?(await j)():j)[0];let l={Read:"\uD83D\uDCC4",Write:"✏️",Edit:"\uD83D\uDCDD",Bash:"\uD83D\uDCBB",Glob:"\uD83D\uDD0D",Grep:"\uD83D\uDD0E",WebFetch:"\uD83C\uDF10",WebSearch:"\uD83D\uDD0D"};function k({toolCall:a,cwd:b}){let c,{t:d}=(0,g.Bd)(),[j,m]=(0,f.useState)(!1),[n,o]=(0,f.useState)(null),p=l[a.name]||"\uD83D\uDD27",q=(c=a.input,"Bash"===a.name&&c.command&&"string"==typeof c.command?c.command:"Glob"===a.name&&c.pattern&&"string"==typeof c.pattern||"Grep"===a.name&&c.pattern&&"string"==typeof c.pattern?c.pattern:c.file_path&&"string"==typeof c.file_path?c.file_path:c.path&&"string"==typeof c.path?c.path:null),r="Glob"===a.name||"Grep"===a.name||"Bash"===a.name,s=q?r?q:(a=>{if(b&&a.startsWith(b)){let c=a.slice(b.length);return c.startsWith("/")?c.slice(1):c}let c=a.split("/");return c.length>2?".../"+c.slice(-2).join("/"):a})(q):null,t=b=>{let c="input"===b?d("toolCall.inputParams"):d("toolCall.resultLabel"),e="input"===b?JSON.stringify(a.input,null,2):"string"==typeof a.result?a.result:JSON.stringify(a.result,null,2);o({title:`${a.name}${s?` ${s}`:""} - ${c}`,content:e,toolName:a.name})};return(0,e.jsxs)("div",{className:"my-2 border border-border rounded-lg overflow-hidden bg-secondary",children:[(0,e.jsxs)("button",{onClick:()=>m(!j),className:"w-full px-3 py-2 flex items-center gap-2 text-left hover:bg-accent transition-colors",children:[(0,e.jsx)("span",{className:"text-base",children:p}),(0,e.jsx)("span",{className:"font-medium text-sm text-foreground flex-shrink-0",children:a.name}),s&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground truncate flex-1 min-w-0",title:q||"",children:s}),(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),q&&(navigator.clipboard.writeText(q),(0,h.oR)(d("common.copiedPath")))},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.stopPropagation(),q&&(navigator.clipboard.writeText(q),(0,h.oR)(d("common.copiedPath"))))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors flex-shrink-0 cursor-pointer",title:d("common.copyAbsPath"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),(0,e.jsxs)("span",{className:"ml-auto flex items-center gap-2",children:[j&&!a.isLoading&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),t("input")},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.stopPropagation(),t("input"))},className:"text-xs text-brand hover:text-teal-10 cursor-pointer",title:d("toolCall.inputParamsTitle"),children:d("toolCall.input")}),a.result&&(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:a=>{a.stopPropagation(),t("result")},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.stopPropagation(),t("result"))},className:"text-xs text-brand hover:text-teal-10 cursor-pointer",title:d("toolCall.resultTitle"),children:d("toolCall.result")})]}),a.isLoading?(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"}):(0,e.jsx)("span",{className:"text-slate-9 text-xs",children:j?"▲":"▼"})]})]}),j&&(0,e.jsxs)("div",{className:"border-t border-border",children:[(0,e.jsxs)("div",{className:"px-3 py-2",children:[(0,e.jsx)("div",{className:"mb-1",children:(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[d("toolCall.inputParams"),":"]})}),(0,e.jsx)("pre",{className:"text-xs bg-secondary p-2 rounded overflow-x-auto max-h-24 overflow-y-auto text-foreground",children:JSON.stringify(a.input,null,2)})]}),a.result&&(0,e.jsxs)("div",{className:"px-3 py-2 border-t border-border",children:[(0,e.jsx)("div",{className:"mb-1",children:(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[d("toolCall.resultLabel"),":"]})}),(0,e.jsx)("pre",{className:"text-xs bg-secondary p-2 rounded overflow-x-auto max-h-24 overflow-y-auto text-foreground",children:"string"==typeof a.result?a.result:JSON.stringify(a.result,null,2)})]})]}),n&&(0,e.jsx)(i.M,{title:n.title,content:n.content,toolName:n.toolName,onClose:()=>o(null)})]})}d()}catch(a){d(a)}})},81064:(a,b,c)=>{Promise.resolve().then(c.bind(c,81227))},81227:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/cockpit/cockpit/src/app/global-error.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/src/app/global-error.tsx","default")},83003:(a,b,c)=>{"use strict";c.d(b,{k:()=>i});var d=c(48249),e=c(67484),f=c(44384),g=c(44256);function h({image:a,onClose:b}){let{t:c}=(0,f.Bd)(),e=(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:b,children:(0,d.jsxs)("div",{className:"relative max-w-[90vw] max-h-[90vh]",children:[(0,d.jsx)("img",{src:a.preview,alt:c("imagePreview.previewImage"),className:"max-w-full max-h-[90vh] object-contain rounded-lg",onClick:a=>a.stopPropagation()}),(0,d.jsx)("button",{onClick:b,className:"absolute -top-3 -right-3 w-8 h-8 bg-card text-foreground hover:text-foreground rounded-full shadow-lg flex items-center justify-center transition-colors",title:c("common.close"),children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})});return(0,d.jsx)(g.ZL,{children:e})}function i({images:a,onRemove:b,disabled:c}){let{t:g}=(0,f.Bd)(),[j,k]=(0,e.useState)(null);return 0===a.length?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"flex flex-wrap gap-2 p-2 bg-secondary border-b border-border",children:a.map(a=>(0,d.jsxs)("div",{className:"relative group w-16 h-16 rounded-lg overflow-hidden border border-border cursor-pointer",onClick:()=>k(a),children:[(0,d.jsx)("img",{src:a.preview,alt:g("imagePreview.previewImage"),className:"w-full h-full object-cover hover:opacity-90 transition-opacity"}),(0,d.jsx)("button",{onClick:c=>{c.stopPropagation(),b(a.id)},className:"absolute top-0 right-0 w-5 h-5 bg-black/60 hover:bg-black/80 text-white text-xs flex items-center justify-center rounded-bl-lg opacity-0 group-hover:opacity-100 transition-opacity",title:g("imagePreview.deleteImage"),children:"✕"})]},a.id))}),j&&(0,d.jsx)(h,{image:j,onClose:()=>k(null)})]})}},83022:(a,b,c)=>{"use strict";c.d(b,{TabBar:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call TabBar() from the server but TabBar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/TabBar.tsx","TabBar")},83120:(a,b,c)=>{"use strict";c.d(b,{BL:()=>q,Gm:()=>n,JK:()=>l,Wr:()=>o,Y8:()=>t,Y_:()=>k,_c:()=>r,bx:()=>m,dU:()=>s,i7:()=>x,jw:()=>u,mu:()=>v,vy:()=>w,z1:()=>p});var d=c(79606),e=c(71192);let f=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`);return await c.json()},catch:c=>new e.uV({message:`${b?.method??"GET"} ${a} failed`,cause:c})}),g=(a,b)=>f(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),h=(a,b)=>f(a,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),i=(a,b)=>f(a,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),j=a=>f(a,{method:"DELETE"}),k=()=>f("/api/review"),l=a=>{let b;return b=`/api/review/${encodeURIComponent(a)}`,d.tryPromise({try:async()=>{let a=await fetch(b);if(404===a.status)throw Object.assign(Error("not found"),{__404__:!0});if(!a.ok)throw Error(`HTTP ${a.status}`);return await a.json()},catch:a=>a?.__404__?new e.m_({resource:"review",id:b}):new e.uV({message:`GET ${b} failed`,cause:a})})},m=a=>g("/api/review",a),n=(a,b)=>i(`/api/review/${encodeURIComponent(a)}`,b),o=a=>j(`/api/review/${encodeURIComponent(a)}`),p=a=>i("/api/review/order",{order:a}),q=()=>f("/api/review/users"),r=()=>f("/api/review/share-info"),s=(a,b)=>g(`/api/review/${encodeURIComponent(a)}/comments`,b),t=(a,b)=>h(`/api/review/${encodeURIComponent(a)}/comments`,b),u=(a,b)=>j(`/api/review/${encodeURIComponent(a)}/comments?commentId=${encodeURIComponent(b)}`),v=(a,b)=>g(`/api/review/${encodeURIComponent(a)}/replies`,b),w=(a,b)=>h(`/api/review/${encodeURIComponent(a)}/replies`,b),x=(a,b,c)=>j(`/api/review/${encodeURIComponent(a)}/replies?commentId=${encodeURIComponent(b)}&replyId=${encodeURIComponent(c)}`)},83179:(a,b,c)=>{"use strict";c.d(b,{NoteToolbar:()=>h});var d=c(48249),e=c(67484),f=c(44384);function g({editor:a,onClose:b,position:c}){let{t:h}=(0,f.Bd)(),[i,j]=(0,e.useState)(()=>a.getAttributes("link").href||""),k=(0,e.useRef)(null),l=()=>{let c=i.trim();if(c){let b=c.match(/^https?:\/\//)?c:`https://${c}`;a.chain().focus().extendMarkRange("link").setLink({href:b}).run()}else a.chain().focus().extendMarkRange("link").unsetLink().run();b()},m=c?{top:c.top,left:c.left}:{};return(0,d.jsxs)("div",{className:`${c?"fixed":"absolute top-full left-0 mt-1"} z-[60] bg-popover border border-border rounded-lg shadow-lg p-2 flex items-center gap-2`,style:m,children:[(0,d.jsx)("input",{ref:k,type:"text",value:i,onChange:a=>j(a.target.value),onKeyDown:a=>{"Enter"===a.key?(a.preventDefault(),l()):"Escape"===a.key&&(a.preventDefault(),b())},placeholder:h("editor.linkPlaceholder"),className:"bg-background border border-border rounded px-2 py-1 text-sm w-64 outline-none focus:border-brand"}),(0,d.jsx)("button",{onClick:l,className:"p-1 rounded text-sm font-medium text-brand hover:bg-brand/10 transition-colors",title:h("editor.confirmLink"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})})}),a.isActive("link")&&(0,d.jsx)("button",{onClick:()=>{a.chain().focus().extendMarkRange("link").unsetLink().run(),b()},className:"p-1 rounded text-sm font-medium text-red-500 hover:bg-red-500/10 transition-colors",title:h("editor.removeLink"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"})})})]})}function h({editor:a}){let{t:b}=(0,f.Bd)(),[c,i]=(0,e.useState)(!1),j=(0,e.useRef)(null),[,k]=(0,e.useState)(0);if(!a)return null;let l=a=>`p-1.5 rounded text-xs font-medium transition-colors ${a?"bg-brand/15 text-brand":"text-muted-foreground hover:text-foreground hover:bg-accent"}`,m="w-px h-5 bg-border mx-0.5",n=a.isActive("table");return(0,d.jsxs)("div",{className:"flex items-center gap-0.5 px-4 py-1.5 border-b border-border flex-shrink-0 flex-wrap",children:[(0,d.jsx)("button",{className:l(a.isActive("heading",{level:1})),onClick:()=>a.chain().focus().toggleHeading({level:1}).run(),title:b("editor.heading1"),children:"H1"}),(0,d.jsx)("button",{className:l(a.isActive("heading",{level:2})),onClick:()=>a.chain().focus().toggleHeading({level:2}).run(),title:b("editor.heading2"),children:"H2"}),(0,d.jsx)("button",{className:l(a.isActive("heading",{level:3})),onClick:()=>a.chain().focus().toggleHeading({level:3}).run(),title:b("editor.heading3"),children:"H3"}),(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:l(a.isActive("bold")),onClick:()=>a.chain().focus().toggleBold().run(),title:b("editor.bold"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z"})})}),(0,d.jsx)("button",{className:l(a.isActive("italic")),onClick:()=>a.chain().focus().toggleItalic().run(),title:b("editor.italic"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"})})}),(0,d.jsx)("button",{className:l(a.isActive("strike")),onClick:()=>a.chain().focus().toggleStrike().run(),title:b("editor.strikethrough"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"})})}),(0,d.jsx)("button",{className:l(a.isActive("code")),onClick:()=>a.chain().focus().toggleCode().run(),title:b("editor.inlineCode"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"})})}),(0,d.jsx)("div",{className:m}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("button",{ref:j,className:l(a.isActive("link")),onClick:()=>i(!c),title:b("editor.link"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"})})}),c&&(0,d.jsx)(g,{editor:a,onClose:()=>i(!1),position:null})]}),(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:l(a.isActive("bulletList")),onClick:()=>a.chain().focus().toggleBulletList().run(),title:b("editor.bulletList"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"})})}),(0,d.jsx)("button",{className:l(a.isActive("orderedList")),onClick:()=>a.chain().focus().toggleOrderedList().run(),title:b("editor.orderedList"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"})})}),(0,d.jsx)("button",{className:l(a.isActive("taskList")),onClick:()=>a.chain().focus().toggleTaskList().run(),title:b("editor.taskList"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zM17.99 9l-1.41-1.42-6.59 6.59-2.58-2.57-1.42 1.41 4 3.99z"})})}),(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:l(a.isActive("blockquote")),onClick:()=>a.chain().focus().toggleBlockquote().run(),title:b("editor.blockquote"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"})})}),(0,d.jsx)("button",{className:l(a.isActive("codeBlock")),onClick:()=>a.chain().focus().toggleCodeBlock().run(),title:b("editor.codeBlock"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M20 3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H4V5h16v14zm-7.5-4.5L15 12l-2.5-2.5L11 11l1.5 1.5L11 14l1.5 1.5zM9.5 14.5L7 12l2.5-2.5L11 11 9.5 12.5 11 14l-1.5.5z"})})}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),title:b("editor.table"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-9 15H4v-4h7v4zm0-6H4V7h7v4zm9 6h-7v-4h7v4zm0-6h-7V7h7v4z"})})}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().setHorizontalRule().run(),title:b("editor.horizontalRule"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M4 11h16v2H4z"})})}),n&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().addRowBefore().run(),title:b("editor.insertRowAbove"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v2h20V6c0-1.1-.9-2-2-2zm0 6H2v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V10zM11 17H4v-2h7v2zm0-4H4v-2h7v2zm9 4h-7v-2h7v2zm0-4h-7v-2h7v2z"}),(0,d.jsx)("path",{d:"M14 1h-4v2H8v2h2v2h4V5h2V3h-2z",opacity:".6"})]})}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().addRowAfter().run(),title:b("editor.insertRowBelow"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v10h20V6c0-1.1-.9-2-2-2zM11 12H4v-2h7v2zm0-4H4V6h7v2zm9 4h-7v-2h7v2zm0-4h-7V6h7v2z"}),(0,d.jsx)("path",{d:"M14 19h-4v2H8v2h2v-2h4v2h2v-2h-2z",opacity:".6"})]})}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().addColumnBefore().run(),title:b("editor.insertColumnLeft"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M6 4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h2V4H6zm4 0v20h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H10zm7 11H10v-2h7v2zm0-4H10V9h7v2z"}),(0,d.jsx)("path",{d:"M1 14v-4h2V8h2v2h-2v4h2v2H3v-2z",opacity:".6"})]})}),(0,d.jsx)("button",{className:l(!1),onClick:()=>a.chain().focus().addColumnAfter().run(),title:b("editor.insertColumnRight"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M4 4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h10V4H4zm7 11H4v-2h7v2zm0-4H4V9h7v2z"}),(0,d.jsx)("path",{d:"M18 4v20h2c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-2z"}),(0,d.jsx)("path",{d:"M21 14v-4h2V8h2v2h-2v4h2v2h-2v-2z",opacity:".6"})]})}),(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:"p-1.5 rounded text-xs font-medium transition-colors text-orange-500 hover:bg-orange-500/10",onClick:()=>a.chain().focus().deleteRow().run(),title:b("editor.deleteRow"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v2h20V6c0-1.1-.9-2-2-2zm0 6H2v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V10zm-8 8H4v-2h8v2z"}),(0,d.jsx)("path",{d:"M15 13l-1.41 1.41L15.17 16l-1.58 1.59L15 19l1.59-1.59L18.17 19l1.42-1.41L18 16l1.59-1.59L18.17 13 16.59 14.41z",fill:"currentColor"})]})}),(0,d.jsx)("button",{className:"p-1.5 rounded text-xs font-medium transition-colors text-orange-500 hover:bg-orange-500/10",onClick:()=>a.chain().focus().deleteColumn().run(),title:b("editor.deleteColumn"),children:(0,d.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,d.jsx)("path",{d:"M6 4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h2V4H6zm4 0v20h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H10zm7 7H10V9h7v2z"}),(0,d.jsx)("path",{d:"M13 16l-1.41 1.41L13.17 19l-1.58 1.59L13 22l1.59-1.59L16.17 22l1.42-1.41L16 19l1.59-1.59L16.17 16l-1.58 1.41z",fill:"currentColor"})]})}),(0,d.jsx)("button",{className:"p-1.5 rounded text-xs font-medium transition-colors text-red-500 hover:bg-red-500/10",onClick:()=>a.chain().focus().deleteTable().run(),title:b("editor.deleteTable"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"})})})]}),a.isActive("codeBlock")&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:m}),(0,d.jsx)("button",{className:"p-1.5 rounded text-xs font-medium transition-colors text-red-500 hover:bg-red-500/10",onClick:()=>a.chain().focus().toggleCodeBlock().run(),title:b("editor.deleteCodeBlock"),children:(0,d.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,d.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"})})})]})]})}},83377:(a,b,c)=>{"use strict";c.d(b,{A:()=>e});var d=c(67484);function e({lines:a,enabled:b,onContentChange:c,onEnterInsert:f,onSave:g,getVisibleLineCount:h,scrollToLine:i,onSearchExecute:j,onSearchNext:k,onSearchPrev:l,onSearchClear:m}){let[n,o]=(0,d.useState)("normal"),[p,q]=(0,d.useState)(-1),[r,s]=(0,d.useState)(0),[t,u]=(0,d.useState)(!1),[v,w]=(0,d.useState)(""),[x,y]=(0,d.useState)(""),[z,A]=(0,d.useState)(""),[B,C]=(0,d.useState)(""),D=(0,d.useRef)([]),E=(0,d.useRef)([]),F=(0,d.useRef)([]),G=(0,d.useRef)(null),H=(0,d.useRef)(a),I=(0,d.useCallback)((a,b)=>Math.max(0,Math.min(b,Math.max(0,(H.current[a]??"").length-1))),[]);(0,d.useRef)(a.length);let J=(0,d.useCallback)(()=>{G.current&&(clearTimeout(G.current),G.current=null),w("")},[]),K=(0,d.useCallback)(()=>{G.current&&clearTimeout(G.current),G.current=setTimeout(()=>{w(""),G.current=null},500)},[]),L=(0,d.useCallback)((a,b)=>{D.current.push(b),E.current=[],u(!0),c(a.join("\n"))},[c]),M=(0,d.useCallback)((a,b)=>{let c=Math.max(0,Math.min(a,H.current.length-1));q(c),s(I(c,b??0)),i(c,"auto")},[i,I]),N=(0,d.useCallback)(a=>{q(b=>{let c=Math.max(0,Math.min(b+a,H.current.length-1));return i(c,"auto"),s(a=>Math.max(0,Math.min(a,Math.max(0,(H.current[c]??"").length-1)))),c})},[i]),O=(0,d.useCallback)(()=>{let a=H.current,b=Math.min(p,a.length-1);if(0===a.length)return;let c=a[b];F.current=[c];let d=[...a];d.splice(b,1),0===d.length&&d.push("");let e=Math.min(b,d.length-1);L(d,{lineIndex:b,oldLines:[c],newLines:[],cursorLine:b}),q(e),s(0)},[p,L]),P=(0,d.useCallback)(()=>{let a=H.current,b=Math.min(p,a.length-1);a.length>0&&(F.current=[a[b]])},[p]),Q=(0,d.useCallback)(()=>{let a=F.current;if(0===a.length)return;let b=H.current,c=Math.min(p,b.length-1)+1,d=[...b];d.splice(c,0,...a),L(d,{lineIndex:c,oldLines:[],newLines:[...a],cursorLine:p}),q(c),s(0),i(c,"auto")},[p,L,i]),R=(0,d.useCallback)(()=>{let a=H.current,b=Math.min(p,a.length-1),c=a[b];if(!c||0===c.length)return;let d=c.substring(1),e=[...a];e[b]=d,L(e,{lineIndex:b,oldLines:[c],newLines:[d],cursorLine:p})},[p,L]),S=(0,d.useCallback)(()=>{let a=D.current;if(0===a.length)return;let b=a.pop(),d=[...H.current];0===b.newLines.length&&b.oldLines.length>0?d.splice(b.lineIndex,0,...b.oldLines):0===b.oldLines.length&&b.newLines.length>0?(d.splice(b.lineIndex,b.newLines.length),0===d.length&&d.push("")):d.splice(b.lineIndex,b.newLines.length,...b.oldLines),E.current.push(b),c(d.join("\n")),q(Math.min(b.cursorLine,d.length-1)),i(Math.min(b.cursorLine,d.length-1),"auto"),0===a.length&&u(!1)},[c,i]),T=(0,d.useCallback)(()=>{let a=E.current;if(0===a.length)return;let b=a.pop(),d=[...H.current];0===b.newLines.length&&b.oldLines.length>0?(d.splice(b.lineIndex,b.oldLines.length),0===d.length&&d.push("")):0===b.oldLines.length&&b.newLines.length>0?d.splice(b.lineIndex,0,...b.newLines):d.splice(b.lineIndex,b.oldLines.length,...b.newLines),D.current.push(b),u(!0),c(d.join("\n"));let e=b.lineIndex+Math.max(0,b.newLines.length-1);q(Math.min(e,d.length-1)),i(Math.min(e,d.length-1),"auto")},[c,i]),U=(0,d.useCallback)(a=>{let b=H.current,c=Math.min(p,b.length-1);if("o"===a||"O"===a){let d="o"===a?c+1:c,e=[...b];e.splice(d,0,""),L(e,{lineIndex:d,oldLines:[],newLines:[""],cursorLine:p}),c=d,q(d)}o("insert"),f(c,r,a)},[p,r,L,f]),V=(0,d.useCallback)(()=>{o("normal"),J()},[J]),W=(0,d.useCallback)(()=>{o("command"),y("")},[]),X=(0,d.useCallback)(()=>{o("normal"),y("")},[]),Y=(0,d.useCallback)(()=>{o("search"),A("")},[]),Z=(0,d.useCallback)(()=>{o("normal"),A("")},[]),$=(0,d.useCallback)(a=>{let b=a.trim();if("w"===b){g?.(),o("normal"),y("");return}if("q"===b){o("normal"),y("");return}if("wq"===b){g?.(),o("normal"),y("");return}if("noh"===b||"nohlsearch"===b){m?.(),o("normal"),y("");return}let c=parseInt(b,10);if(!isNaN(c)&&c>0){let a=Math.min(c-1,H.current.length-1);q(a),i(a,"center"),o("normal"),y("");return}o("normal"),y("")},[g,m,i]),_=(0,d.useCallback)(a=>{if(!a){o("normal"),A("");return}C(a),j?.(a),o("normal"),A("")},[j]),aa=(0,d.useCallback)(a=>{if(!b)return!1;let c=a.ctrlKey&&"c"===a.key&&!a.metaKey&&!a.shiftKey;if("insert"===n)return("Escape"===a.key||!!c)&&(V(),!0);if("command"===n)return!a.isComposing&&("Escape"===a.key||c?X():"Enter"===a.key?$(x):"Backspace"===a.key?0===x.length?X():y(a=>a.slice(0,-1)):1!==a.key.length||a.metaKey||a.ctrlKey||y(b=>b+a.key),!0);if("search"===n)return!a.isComposing&&("Escape"===a.key||c?Z():"Enter"===a.key?_(z):"Backspace"===a.key?0===z.length?Z():A(a=>a.slice(0,-1)):1!==a.key.length||a.metaKey||a.ctrlKey||A(b=>b+a.key),!0);if(p<0&&(q(0),s(0)),a.metaKey)return!1;if(a.ctrlKey)return"d"===a.key?(N(Math.max(1,Math.floor(h()/2))),J(),!0):"u"===a.key?(N(-Math.max(1,Math.floor(h()/2))),J(),!0):"r"===a.key&&(T(),J(),!0);let d=a.key,e=v+d;if("g"===e)return w("g"),K(),!0;if("gg"===e)return M(0),J(),!0;if("d"===e)return w("d"),K(),!0;if("dd"===e)return O(),J(),!0;if("y"===e)return w("y"),K(),!0;if("yy"===e)return P(),J(),!0;if(v&&e!==d&&J(),"j"===d||"ArrowDown"===d)return N(1),!0;if("k"===d||"ArrowUp"===d)return N(-1),!0;if("h"===d||"ArrowLeft"===d)return s(a=>Math.max(0,a-1)),!0;if("l"===d||"ArrowRight"===d){let a=Math.max(0,(H.current[p]??"").length-1);return s(b=>Math.min(a,b+1)),!0}if("0"===d)return s(0),!0;if("$"===d)return s(Math.max(0,(H.current[p]??"").length-1)),!0;if("^"===d){let a=(H.current[p]??"").search(/\S/);return s(a>=0?a:0),!0}return"G"===d?(M(H.current.length-1),!0):"x"===d?(R(),!0):"p"===d?(Q(),!0):"u"===d?(S(),!0):"i"===d||"a"===d||"I"===d||"A"===d||"o"===d||"O"===d?(U(d),!0):"/"===d?(Y(),!0):"n"===d?(k?.(),!0):"N"===d?(l?.(),!0):":"===d?(W(),!0):"Escape"!==d&&1===d.length},[b,n,v,x,z,p,V,U,W,X,Y,Z,$,_,N,M,h,O,P,Q,R,S,T,J,K,k,l]);return{state:{mode:n,cursorLine:p,cursorCol:r,isDirty:t,keyBuffer:v,commandInput:x,searchInput:z,lastSearch:B},handleKeyDown:aa,enterNormal:V,enterInsert:U,setCursorLine:q,setCursorCol:s,setCommandInput:y,setSearchInput:A,setIsDirty:u,clearUndoHistory:(0,d.useCallback)(()=>{D.current=[],E.current=[]},[])}}},83768:(a,b,c)=>{"use strict";c.d(b,{D:()=>g,N:()=>h});var d=c(48249),e=c(67484);let f=(0,e.createContext)(null);function g(){let a=(0,e.useContext)(f);if(!a)throw Error("useTheme must be used within a ThemeProvider");return a}function h({children:a}){let[b,c]=(0,e.useState)("system"),[g,i]=(0,e.useState)("light"),j=(0,e.useCallback)(()=>"light",[]),k=(0,e.useCallback)(a=>{let b=document.documentElement;b.classList.remove("light","dark"),b.classList.add(a),i(a);let c=document.querySelector('meta[name="theme-color"]'),d="dark"===a?"#111113":"#f9f9fb";c&&c.setAttribute("content",d)},[]),l=(0,e.useCallback)(a=>{c(a),localStorage.setItem("theme",a),k("system"===a?j():a),document.querySelectorAll("iframe").forEach(b=>{b.contentWindow?.postMessage({type:"THEME_CHANGE",theme:a},"*")})},[j,k]);return(0,d.jsx)(f.Provider,{value:{theme:b,resolvedTheme:g,setTheme:l},children:a})}},84398:(a,b,c)=>{"use strict";function d(a){let b=a.split("/").pop()?.toLowerCase()??"";switch(b.includes(".")?b.split(".").pop():""){case"ts":return"typescript";case"tsx":case"jsx":return"tsx";case"js":case"mjs":case"cjs":return"javascript";case"py":case"pyi":return"python";case"go":return"go";case"rs":return"rust";default:return null}}c.d(b,{k:()=>d})},84747:(a,b,c)=>{"use strict";c.d(b,{Workspace:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call Workspace() from the server but Workspace is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/Workspace.tsx","Workspace")},84835:(a,b,c)=>{"use strict";c.d(b,{W:()=>f});var d=c(50300);let e=new Set(["p","h1","h2","h3","h4","h5","h6","li","blockquote","pre","table","tr","hr","div","ul","ol"]);function f(){return a=>{(0,d.YR)(a,"element",a=>{if(e.has(a.tagName)&&a.position&&(a.properties||(a.properties={}),a.properties["data-source-start"]=a.position.start.line,a.properties["data-source-end"]=a.position.end.line,"pre"===a.tagName)){let b=a.children?.find(a=>"element"===a.type&&"code"===a.tagName);b&&(b.properties||(b.properties={}),b.properties["data-source-start"]=a.position.start.line,b.properties["data-source-end"]=a.position.end.line)}})}}},84844:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{i:()=>p});var e=c(48249),f=c(67484),g=c(44384),h=c(208),i=c(91579),j=c(44256),k=c(7833),l=c(33281),m=c(89800),n=c(87808);function o(a){if(0===a.length)return"";let b=[h.A.t("comments.codeRef"),""],c=a.filter(a=>a.filePath===i.Un),d=a.filter(a=>a.filePath!==i.Un);for(let a of(d.length>0&&d.forEach((a,c)=>{b.push(`[${c+1}] ${a.filePath}:${a.startLine}-${a.endLine}`),b.push("```"),b.push(a.codeContent),b.push("```"),a.content&&b.push(h.A.t("comments.note",{content:a.content})),b.push("")}),c)){let c=a.codeContent.split("\n").map(a=>`> ${a}`).join("\n");b.push(c),a.content&&b.push(a.content),b.push("")}return b.join("\n").trim()}function p({isOpen:a,onClose:b,cwd:c,onNavigateToComment:d}){let{t:h}=(0,g.Bd)(),[q,r]=(0,f.useState)([]),[s,t]=(0,f.useState)(!1),[u,v]=(0,f.useState)(null),[w,x]=(0,f.useState)(!1);(0,f.useCallback)(async()=>{if(!c)return;t(!0);let a=await l.t4.runPromiseExit((0,m.$)(c));"Success"===a._tag?r(a.value.comments??[]):console.error("Failed to load comments:",a.cause),t(!1)},[c]);let y=async a=>{let b=await l.t4.runPromiseExit((0,m.Tu)(c,a));"Success"===b._tag?(r(b=>b.filter(b=>b.id!==a)),(0,i.Cm)()):console.error("Failed to delete comment:",b.cause)},z=async a=>{v(a.id);try{let b="";if(a.selectedText)b=a.selectedText;else{let d=await l.t4.runPromiseExit((0,n.K9)(c,a.filePath));if("Success"!==d._tag||!d.value.ok)throw Error("Failed to read file");b=(d.value.data?.content||"").split("\n").slice(a.startLine-1,a.endLine).join("\n")}let d={filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,content:a.content,codeContent:b},e=o([d]);await navigator.clipboard.writeText(e),(0,k.oR)(h("toast.copiedComment"))}catch(a){console.error("Failed to copy comment:",a)}finally{v(null)}},A=async()=>{if(0!==q.length){x(!0);try{let a=await (0,i.$3)(c),b=o(a);await navigator.clipboard.writeText(b),(0,k.oR)(h("toast.copiedAllComments"))}catch(a){console.error("Failed to copy all comments:",a)}finally{x(!1)}}},B=q.reduce((a,b)=>(a[b.filePath]||(a[b.filePath]=[]),a[b.filePath].push(b),a),{});if(!a)return null;let C=(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:b,children:(0,e.jsxs)("div",{className:"w-full max-w-2xl max-h-[80vh] bg-card border border-border rounded-lg shadow-xl flex flex-col overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-secondary",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:h("comments.allComments")}),q.length>0&&(0,e.jsx)("button",{onClick:A,disabled:w,className:"p-1 rounded hover:bg-accent text-muted-foreground disabled:opacity-50",title:h("comments.copyAllComments"),children:w?(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),(0,e.jsx)("button",{onClick:b,className:"p-1 rounded hover:bg-accent text-muted-foreground",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:s?(0,e.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:h("common.loading")}):0===q.length?(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,e.jsx)("svg",{className:"w-12 h-12 mb-3 opacity-50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"})}),(0,e.jsx)("span",{children:h("comments.noComments")})]}):(0,e.jsx)("div",{className:"space-y-4",children:Object.entries(B).map(([a,b])=>(0,e.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,e.jsxs)("div",{className:"px-3 py-2 bg-secondary border-b border-border",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-foreground font-mono",children:a===i.Un?h("comments.aiReply"):a}),(0,e.jsxs)("span",{className:"ml-2 text-xs text-muted-foreground",children:["(",h("comments.nComments",{count:b.length}),")"]})]}),(0,e.jsx)("div",{className:"divide-y divide-border",children:b.map(a=>{var b;return(0,e.jsx)("div",{className:"px-3 py-2 hover:bg-accent/50 cursor-pointer group",onClick:()=>d?.(a),children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[a.startLine>0||a.endLine>0?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("span",{className:"text-xs text-brand font-mono",children:[h("common.line")," ",a.startLine===a.endLine?a.startLine:`${a.startLine}-${a.endLine}`]}),(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",h("comments.linesCount",{count:a.endLine-a.startLine+1}),")"]})]}):a.selectedText?(0,e.jsxs)("span",{className:"text-xs text-muted-foreground italic truncate max-w-[200px]",children:["“",a.selectedText.slice(0,50),a.selectedText.length>50?"...":"","”"]}):null,(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:(b=a.updatedAt||a.createdAt)?new Date(b).toLocaleString("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):""})]}),(0,e.jsx)("p",{className:"text-sm text-foreground line-clamp-2",children:a.content||(0,e.jsx)("span",{className:"text-muted-foreground italic",children:h("comments.noContent")})})]}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),z(a)},disabled:u===a.id,className:"p-1 rounded opacity-0 group-hover:opacity-100 hover:bg-accent text-muted-foreground transition-opacity disabled:opacity-50",title:h("common.copy"),children:u===a.id?(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("button",{onClick:b=>{b.stopPropagation(),y(a.id)},className:"p-1 rounded opacity-0 group-hover:opacity-100 hover:bg-accent text-muted-foreground hover:text-red-9 transition-opacity",title:h("common.delete"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})},a.id)})})]},a))})}),(0,e.jsxs)("div",{className:"px-4 py-3 border-t border-border bg-secondary flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:h("comments.totalComments",{count:q.length})}),(0,e.jsx)("button",{onClick:async()=>{0===q.length||await (0,i.RP)(c)&&r([])},disabled:0===q.length,className:"px-3 py-1.5 text-sm bg-red-9 text-white rounded hover:bg-red-10 disabled:opacity-50 disabled:cursor-not-allowed",children:h("comments.clearAll")})]})]})});return(0,e.jsx)(j.ZL,{children:C})}d()}catch(a){d(a)}})},85655:(a,b,c)=>{"use strict";c.d(b,{Bj:()=>i,CM:()=>s,FK:()=>r,Iz:()=>m,MB:()=>t,Ub:()=>o,X0:()=>n,Zi:()=>j,lv:()=>l,oh:()=>q,r4:()=>h,w2:()=>p,yy:()=>k});var d=c(79606),e=c(71192);let f=a=>d.tryPromise({try:async()=>{let b=await fetch(a);if(!b.ok){let a;try{a=(await b.json()).error}catch{}throw Error(a||`HTTP ${b.status}`)}return await b.json()},catch:b=>new e.uV({message:`fetch ${a} failed`,cause:b})}),g=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error(`HTTP ${c.status}`)},catch:b=>new e.uV({message:`POST ${a} failed`,cause:b})}),h=a=>f(`/api/git/branches?cwd=${encodeURIComponent(a)}`).pipe(d.flatMap(b=>"Failed to get branches"===b.error?d.fail(new e.m_({resource:"git-repo",id:a})):d.succeed(b))),i=(a,b,c,d)=>f(`/api/git/commits?cwd=${encodeURIComponent(a)}&branch=${encodeURIComponent(b)}&limit=${c}${"number"==typeof d?`&offset=${d}`:""}`),j=(a,b,c)=>f(`/api/git/commit-diff?cwd=${encodeURIComponent(a)}&hash=${encodeURIComponent(b)}${c?`&file=${encodeURIComponent(c)}`:""}`),k=(a,b,c)=>f(`/api/git/branch-diff?cwd=${encodeURIComponent(a)}&base=${encodeURIComponent(b)}${c?`&file=${encodeURIComponent(c)}`:""}`),l=a=>f(`/api/git/status?cwd=${encodeURIComponent(a)}`),m=(a,b)=>g("/api/git/stage",{cwd:a,files:b}),n=(a,b)=>g("/api/git/unstage",{cwd:a,files:b}),o=(a,b,c)=>g("/api/git/discard",{cwd:a,files:b,isUntracked:c}),p=(a,b,c)=>{let d=new URLSearchParams({cwd:a,file:b,type:c});return f(`/api/git/diff?${d}`)},q=a=>f(`/api/git/diff?${a.toString()}`),r=a=>f(`/api/git/worktree?cwd=${encodeURIComponent(a)}`),s=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/git/worktree",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json().catch(()=>null);if(!b.ok)throw Error(c?.error||`HTTP ${b.status}`);return c},catch:a=>new e.uV({message:"POST /api/git/worktree failed",cause:a})}),t=a=>f(`/api/projectGraph/search?${a.toString()}`)},85906:(a,b,c)=>{"use strict";c.d(b,{ProjectItem:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call ProjectItem() from the server but ProjectItem is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/ProjectItem.tsx","ProjectItem")},85984:(a,b,c)=>{"use strict";c.d(b,{V:()=>k});var d=c(67484),e=c(79606),f=c(33281),g=c(71192);let h=new Map,i=new Map;async function j(a,b,c=!1){let d=`${a}::${b}`;if(c)!function(a){if(!a){h.clear(),i.clear();return}let b=`${a}::`;for(let a of h.keys())a.startsWith(b)&&h.delete(a);for(let a of i.keys())a.startsWith(b)&&i.delete(a)}(a);else{let a=h.get(d);if(a)return a;let b=i.get(d);if(b)return b}let k=e.tryPromise({try:async()=>{let e=new URLSearchParams({cwd:a,path:b});c&&e.set("refresh","1");let f=await fetch(`/api/projectGraph/file-functions?${e}`);if(404===f.status)return"not-found";if(!f.ok)throw Error((await f.json().catch(()=>({error:`HTTP ${f.status}`}))).error||`HTTP ${f.status}`);let g=await f.json();return h.set(d,g),g},catch:a=>new g.uV({message:"fetchFileFunctions failed",cause:a})}),l=f.t4.runPromiseExit(k).then(a=>{if("Success"===a._tag)return a.value;let b="Fail"===a.cause._tag?a.cause.error:null,c=b?.cause;if(c instanceof Error)throw c;throw Error(b?.message??"fetchFileFunctions failed")}).finally(()=>i.delete(d));return i.set(d,l),l}function k(a,b){let[c,e]=(0,d.useState)({state:"idle"}),f=(0,d.useRef)(!0),g=(0,d.useCallback)((a,b,c)=>{e({state:"loading"}),j(a,b,c).then(a=>{f.current&&("not-found"===a?e({state:"notFound"}):e({state:"ready",data:a}))}).catch(a=>{f.current&&e({state:"error",message:a.message})})},[]);return{state:c,refresh:(0,d.useCallback)(()=>{a&&b&&g(a,b,!0)},[a,b,g])}}},86686:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{f:()=>h});var e=c(48249);c(67484);var f=c(44384),g=c(44256);function h({isOpen:a,onClose:b,messages:c,onSelectMessage:d}){let{t:i}=(0,f.Bd)();if(!a)return null;let j=c.filter(a=>"user"===a.role),k=(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:b,children:(0,e.jsxs)("div",{className:"bg-card rounded-lg shadow-xl w-full max-w-lg max-h-[70vh] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border shrink-0",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground",children:i("userMessages.title")}),(0,e.jsx)("button",{onClick:b,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===j.length?(0,e.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground",children:i("userMessages.noMessages")}):(0,e.jsx)("div",{className:"divide-y divide-border",children:j.map((a,c)=>{let f,g,h,i=(f=a.id.match(/^user-(\d+)/))?parseInt(f[1],10):null,j=i?(g=new Date(i),h=new Date,g.toDateString()===h.toDateString()?g.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):g.toLocaleDateString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})):"";return(0,e.jsx)("button",{onClick:()=>{var c;return c=a.id,void(d(c),b())},className:"w-full px-4 py-3 text-left hover:bg-accent transition-colors",children:(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[(0,e.jsxs)("span",{className:"text-xs text-muted-foreground font-mono w-6 shrink-0 pt-0.5",children:[c+1,"."]}),(0,e.jsx)("div",{className:"flex-1 min-w-0",children:(0,e.jsx)("p",{className:"text-sm text-foreground break-words",children:function(a,b=50){let c=a.replace(/\s+/g," ").trim();return c.length<=b?c:c.slice(0,b)+"..."}(a.content)})}),j&&(0,e.jsx)("span",{className:"text-xs text-muted-foreground shrink-0 pt-0.5",children:j})]})},a.id)})})})]})});return(0,e.jsx)(g.ZL,{children:k})}d()}catch(a){d(a)}})},87238:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{$:()=>r,j:()=>s});var e=c(48249),f=c(67484),g=c(44384),h=c(24520),i=c(88282),j=c(46674),k=c(72529),l=c(9780),m=c(33281),n=c(23328),o=a([l]);function p({onAdd:a,onCancel:b}){let{t:c}=(0,g.Bd)(),[d,h]=(0,f.useState)(""),[i,j]=(0,f.useState)("");return(0,e.jsxs)("div",{className:"flex gap-1 mb-1",children:[(0,e.jsx)("input",{type:"text",value:d,onChange:a=>h(a.target.value),placeholder:c("console.namePlaceholder"),className:"w-24 flex-shrink-0 px-2 py-1 text-xs rounded border border-input bg-background focus:outline-none focus:ring-1 focus:ring-ring",autoFocus:!0,onKeyDown:a=>{"Escape"===a.key&&b()}}),(0,e.jsx)("input",{type:"text",value:i,onChange:a=>j(a.target.value),placeholder:c("console.commandPlaceholder"),className:"flex-1 min-w-0 px-2 py-1 text-xs font-mono rounded border border-input bg-background focus:outline-none focus:ring-1 focus:ring-ring",onKeyDown:c=>{"Enter"!==c.key||c.nativeEvent.isComposing?"Escape"===c.key&&b():(c.preventDefault(),c.stopPropagation(),d.trim()&&i.trim()&&a(d.trim(),i.trim()))}})]})}function q({label:a,commands:b,isAdding:c,onStartAdd:d,onAdd:f,onCancelAdd:l,onDelete:m,onExecute:n}){let{t:o}=(0,g.Bd)();return(0,e.jsxs)("div",{className:"p-2",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground px-1",children:a}),(0,e.jsx)("button",{type:"button",onClick:d,className:"p-0.5 text-muted-foreground hover:text-foreground rounded",children:(0,e.jsx)(h.A,{className:"w-3.5 h-3.5"})})]}),c&&(0,e.jsx)(p,{onAdd:(a,b)=>f(a,b),onCancel:l}),0===b.length&&!c&&(0,e.jsx)("div",{className:"text-xs text-muted-foreground px-1 py-1",children:o("console.noCustomCommands")}),b.map((a,b)=>(0,e.jsx)(k.m,{content:a.command,children:(0,e.jsxs)("div",{className:"flex items-center group min-w-0",children:[(0,e.jsxs)("button",{type:"button",onClick:()=>n(a.command),className:"flex-1 min-w-0 flex items-center gap-2 px-2 py-1.5 text-left text-sm rounded hover:bg-accent transition-colors",children:[(0,e.jsx)(i.A,{className:"w-3 h-3 flex-shrink-0 text-muted-foreground"}),(0,e.jsx)("span",{className:"truncate",children:a.name})]}),(0,e.jsx)("button",{type:"button",onClick:()=>m(b),className:"p-1 text-muted-foreground hover:text-destructive rounded opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:(0,e.jsx)(j.A,{className:"w-3 h-3"})})]})},b))]})}function r({cwd:a,show:b,onClose:c,onExecute:d,onAddPluginItem:h}){let{t:i}=(0,g.Bd)(),[j,k]=(0,f.useState)([]),[o,p]=(0,f.useState)([]),[s,t]=(0,f.useState)(null),u=(0,f.useRef)(null);(0,f.useCallback)(async()=>{let[b,c]=await Promise.all([m.t4.runPromiseExit((0,n.Yj)()),m.t4.runPromiseExit((0,n.UV)(a))]);if("Success"===b._tag){let a=b.value;k(a.customCommands||[])}if("Success"===c._tag){let a=c.value;p(a.customCommands||[])}},[a]);let v=(0,f.useCallback)(async a=>{k(a);let b=await m.t4.runPromiseExit((0,n.Cb)({scope:"global",customCommands:a}));"Failure"===b._tag&&console.error("Failed to save global commands:",b.cause)},[]),w=(0,f.useCallback)(async b=>{p(b);let c=await m.t4.runPromiseExit((0,n.Cb)({cwd:a,customCommands:b}));"Failure"===c._tag&&console.error("Failed to save project commands:",c.cause)},[a]),x=(0,f.useCallback)(a=>{c();let b=(0,l.sk)(a);b?h?.(b.type,a.trim()):d(a)},[c,d,h]);return b?(0,e.jsxs)("div",{ref:u,className:"absolute bottom-full left-0 mb-2 w-72 bg-popover border border-border rounded-lg shadow-lg z-50 max-h-[70vh] overflow-y-auto",children:[(0,e.jsx)(q,{label:i("console.globalCommands"),commands:j,isAdding:"global"===s,onStartAdd:()=>t("global"),onAdd:(a,b)=>{v([...j,{name:a,command:b}]),t(null)},onCancelAdd:()=>t(null),onDelete:a=>v(j.filter((b,c)=>c!==a)),onExecute:x}),(0,e.jsx)("div",{className:"border-t border-border"}),(0,e.jsx)(q,{label:i("console.projectCommands"),commands:o,isAdding:"project"===s,onStartAdd:()=>t("project"),onAdd:(a,b)=>{w([...o,{name:a,command:b}]),t(null)},onCancelAdd:()=>t(null),onDelete:a=>w(o.filter((b,c)=>c!==a)),onExecute:x})]}):null}function s(a){let[b,c]=(0,f.useState)([]),[d,e]=(0,f.useState)([]),g=(0,f.useCallback)(async()=>{let[b,d]=await Promise.all([m.t4.runPromiseExit((0,n.UV)(a)),m.t4.runPromiseExit((0,n.Yj)())]);if("Success"===b._tag){let a=b.value;c(a.customCommands||[])}if("Success"===d._tag){let a=d.value;e(a.customCommands||[])}},[a]),h=[...b,...d],i=(0,f.useCallback)(a=>{let c=a.trim().split(/\s+/),e=c[0];if(!e.startsWith("/")||e.length<=1)return null;let f=e.slice(1),g=b.find(a=>a.name===f)??d.find(a=>a.name===f);return g?g.command+(c.length>1?" "+c.slice(1).join(" "):""):null},[b,d]);return{quickCustomCommands:h,projectCommands:b,globalCommands:d,expandCustomCommand:i,loadQuickCommands:g}}l=(o.then?(await o)():o)[0],d()}catch(a){d(a)}})},87808:(a,b,c)=>{"use strict";c.d(b,{DZ:()=>j,Ft:()=>n,K9:()=>q,Nn:()=>v,OJ:()=>s,VK:()=>w,YW:()=>m,__:()=>u,dt:()=>t,eA:()=>r,eE:()=>o,gZ:()=>k,mP:()=>i,nM:()=>x,r6:()=>p,r9:()=>l});var d=c(79606),e=c(71192);let f=(a,b={})=>d.tryPromise({try:async()=>{let c=await fetch(a,b.init);if(b.passThroughStatuses&&b.passThroughStatuses.includes(c.status))return await c.json().catch(()=>({}));if(!c.ok){let a;try{a=(await c.json()).error}catch{}throw Error(a||`HTTP ${c.status}`)}return await c.json()},catch:b=>new e.uV({message:`GET ${a} failed`,cause:b})}),g=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b),d=null;try{d=await c.json()}catch{}return{status:c.status,ok:c.ok,data:d}},catch:b=>new e.uV({message:`GET ${a} failed`,cause:b})}),h=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error(`HTTP ${c.status}`)},catch:b=>new e.uV({message:`POST ${a} failed`,cause:b})}),i=a=>f(`/api/files/init?cwd=${encodeURIComponent(a)}`),j=a=>f(`/api/files/index?cwd=${encodeURIComponent(a)}`),k=(a,b)=>f(`/api/files/readdir?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`),l=a=>f(`/api/files/recent?cwd=${encodeURIComponent(a)}`),m=(a,b,c)=>h("/api/files/recent",{cwd:a,file:b,...c??{}}),n=(a,b)=>h("/api/files/expanded",{cwd:a,paths:b}),o=(a,b)=>f(`/api/files/blame?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`),p=(a,b)=>g(`/api/files/stat?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`,{cache:"no-store"}),q=(a,b)=>g(`/api/files/text?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`,{cache:"no-store"}),r=a=>f(`/api/files/text?${a.toString()}`),s=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/files/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=null;try{c=await b.json()}catch{}return{status:b.status,ok:b.ok,data:c}},catch:a=>new e.uV({message:"POST /api/files/save failed",cause:a})}),t=()=>f("/api/files/clipboard"),u=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/files/clipboard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok)throw Error(`HTTP ${b.status}`)},catch:a=>new e.uV({message:"POST /api/files/clipboard failed",cause:a})}),v=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/files/paste",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json().catch(()=>null);if(!b.ok)throw Error(c?.error||`HTTP ${b.status}`);return c},catch:a=>new e.uV({message:"POST /api/files/paste failed",cause:a})}),w=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/files/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json().catch(()=>null);if(!b.ok)throw Error(c?.error||`HTTP ${b.status}`);return c},catch:a=>new e.uV({message:"POST /api/files/delete failed",cause:a})}),x=a=>f(`/api/file?path=${encodeURIComponent(a)}`)},87819:(a,b,c)=>{"use strict";c.d(b,{Z:()=>e});var d=c(67484);function e(a,b){let[c,e]=(0,d.useState)({status:"loading"});return c}c(13426),c(79883),c(1239),c(79606),c(95046),c(33281)},87844:(a,b,c)=>{"use strict";c.d(b,{T:()=>x});var d=c(48249),e=c(98051),f=c(38368),g=c(33972),h=c(10841),i=c(99773),j=c(36513);c(55583),c(87023);var k=c(50757),l=c(27454),m=c(37752),n=c(67484),o=c(83768);let p=[f.A,g.A,h.jb],q=[f.A,h.jb],r=[i.A,j.A],s=[i.A];function t(a){return a.replace(/^(\|.+\|)$/gm,a=>/^\|[\s:|-]+\|$/.test(a)?a:a.replace(/`([^`]*)`/g,(a,b)=>b.includes("|")?"`"+b.replace(/\|/g,"\\|")+"`":a))}function u(a){return a.replace(/\$(\d)/g,"\\$$1")}let v=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clippath","defs","ellipse","g","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan","use"]);function w(a){let b=[],c=a=>(b.push(a),`\0MASK${b.length-1}\0`);return a.replace(/```[\s\S]*?```/g,a=>c(a)).replace(/~~~[\s\S]*?~~~/g,a=>c(a)).replace(/`[^`\n]+`/g,a=>c(a)).replace(/<\/?([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(a,b)=>{let c=b.toLowerCase();return v.has(c)||c.includes("-")?a:a.replace(/</g,"<").replace(/>/g,">")}).replace(/MASK(\d+)/g,(a,c)=>b[+c])}let x=(0,n.memo)(function({content:a,isUser:b=!1,isStreaming:c=!1,enableMath:f=!0,rehypePlugins:g}){let{resolvedTheme:h}=(0,o.D)(),i="dark"===h,j=(0,n.useMemo)(()=>({code({className:a,children:b,node:c,...e}){let f=/language-(\w+)/.exec(a||""),g=String(b);if(!f&&!a&&!g.includes("\n"))return(0,d.jsx)("code",{className:"px-1.5 py-0.5 mx-0.5 rounded bg-accent text-sm font-mono",...e,children:b});let h=String(b).replace(/\n$/,""),j=f?.[1]||"text",n=Number(e["data-source-start"])||0,o=n?n+1:0,p=0;return(0,d.jsx)(k.A,{style:i?l.A:m.A,language:j,PreTag:"div",customStyle:{margin:"0.75rem 0",borderRadius:"0.375rem",fontSize:"0.875rem"},wrapLines:!0,lineProps:()=>{let a=o+p;return p++,{"data-source-start":a,"data-source-end":a,style:{display:"block"}}},children:h})},p:({children:a,node:b,...c})=>(0,d.jsx)("p",{className:"mb-3 last:mb-0",...c,children:a}),h1:({children:a,node:b,...c})=>(0,d.jsx)("h1",{className:"text-xl font-bold mb-3 mt-4 first:mt-0",...c,children:a}),h2:({children:a,node:b,...c})=>(0,d.jsx)("h2",{className:"text-lg font-bold mb-2 mt-3 first:mt-0",...c,children:a}),h3:({children:a,node:b,...c})=>(0,d.jsx)("h3",{className:"text-base font-bold mb-2 mt-3 first:mt-0",...c,children:a}),ul:({children:a,node:b,...c})=>(0,d.jsx)("ul",{className:"list-disc list-inside mb-3 space-y-1",...c,children:a}),ol:({children:a,node:b,...c})=>(0,d.jsx)("ol",{className:"list-decimal list-inside mb-3 space-y-1",...c,children:a}),li:({children:a,node:b,...c})=>(0,d.jsx)("li",{className:"leading-relaxed",...c,children:a}),blockquote:({children:a,node:b,...c})=>(0,d.jsx)("blockquote",{className:"border-l-4 border-border pl-4 my-3 italic text-muted-foreground",...c,children:a}),a:({href:a,children:b,node:c,...e})=>(0,d.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"text-brand hover:underline",...e,children:b}),table:({children:a,node:b,...c})=>(0,d.jsx)("div",{className:"overflow-x-auto my-3",...c,children:(0,d.jsx)("table",{className:"min-w-full border border-border",children:a})}),thead:({children:a,node:b,...c})=>(0,d.jsx)("thead",{className:"bg-accent",...c,children:a}),th:({children:a,node:b,...c})=>(0,d.jsx)("th",{className:"px-4 py-2 text-left font-semibold border-b border-border",...c,children:a}),td:({children:a,node:b,...c})=>(0,d.jsx)("td",{className:"px-4 py-2 border-b border-border",...c,children:a}),hr:({node:a,...b})=>(0,d.jsx)("hr",{className:"my-4 border-border",...b}),img:({src:a,alt:b,node:c,height:e,width:f,style:g,...h})=>{if(!(e||f||g))return(0,d.jsx)("img",{src:a,alt:b||"",className:"max-w-full h-auto rounded-lg my-3",...h});let i=a=>a?/^\d+$/.test(String(a))?`${a}px`:String(a):void 0,j={...g,height:i(e)??g?.height,width:i(f)??g?.width};return(0,d.jsx)("img",{src:a,alt:b||"",style:j,className:"inline-block align-middle",...h})},strong:({children:a,node:b,...c})=>(0,d.jsx)("strong",{className:"font-bold",...c,children:a}),em:({children:a,node:b,...c})=>(0,d.jsx)("em",{className:"italic",...c,children:a}),del:({children:a,node:b,...c})=>(0,d.jsx)("del",{className:"line-through",...c,children:a})}),[i]),v=f?p:q,x=f?r:s,y=(0,n.useMemo)(()=>{if(b||c)return w(a);let d=w(t(!function(a){if(/^\|[\s:|-]+\|$/m.test(a))return!1;if(/[┌┐└┘│─├┤┬┴┼╔╗╚╝║═╭╮╯╰▲▼◀▶△▽◁▷]/.test(a)||/\+[-=]{2,}\+/.test(a))return!0;let b=a.split("\n").filter(a=>/^\s*\||\|\s*$/.test(a));if(b.length>=3){let a=b.map(a=>(a.match(/\|/g)||[]).length);return!a.every(b=>b===a[0])||!(a[0]>=3)}return!1}(a)||/^```[\s\S]*```$/m.test(a.trim())?a:"```text\n"+a.trim()+"\n```"));return f?u(d):d},[a,b,c,f]),z=(0,n.useMemo)(()=>g?.length?[...x,...g]:x,[g,x]);if(b)return(0,d.jsx)("div",{className:"whitespace-pre-wrap break-words",children:a});if(c){let b=a.lastIndexOf("\n");if(-1===b)return(0,d.jsx)("div",{className:"whitespace-pre-wrap break-words",children:a});let c=a.slice(0,b+1),g=a.slice(b+1);return(0,d.jsxs)("div",{className:"markdown-body",children:[(0,d.jsx)(e.oz,{remarkPlugins:v,rehypePlugins:x,components:j,children:f?u(w(t(c))):w(t(c))}),g&&(0,d.jsx)("span",{className:"whitespace-pre-wrap",children:g})]})}return(0,d.jsx)("div",{className:"markdown-body",children:(0,d.jsx)(e.oz,{remarkPlugins:v,rehypePlugins:z,components:j,children:y})})})},88214:(a,b,c)=>{"use strict";c.d(b,{n:()=>e});var d=c(23734);let e={SessionChange:(0,d.R)("session-change"),ViewChange:(0,d.R)("view-change"),OpenNote:(0,d.R)("open-note"),LangChange:(0,d.R)("lang-change"),TabAdd:(0,d.R)("tab-add"),TabClose:(0,d.R)("tab-close"),SwitchSession:(0,d.R)("switch-session"),ProjectChange:(0,d.R)("project-change"),OpenProject:(0,d.R)("open-project"),SessionComplete:(0,d.R)("session-complete"),OpenTokenStats:(0,d.R)("open-token-stats"),PinnedSessionsChanged:(0,d.R)("pinned-sessions-changed"),ScheduledTasksChanged:(0,d.R)("scheduled-tasks-changed"),ScreenshotPrepare:(0,d.R)("screenshot-prepare"),ScreenshotDone:(0,d.R)("screenshot-done")}},89800:(a,b,c)=>{"use strict";c.d(b,{$:()=>i,BC:()=>j,Tu:()=>l,lb:()=>h,tj:()=>m,vv:()=>k});var d=c(79606),e=c(71192);let f=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`);return await c.json()},catch:c=>new e.uV({message:`${b?.method??"GET"} ${a} failed`,cause:c})}),g=(a,b)=>d.tryPromise({try:async()=>{let c=await fetch(a,b);if(!c.ok)throw Error(`HTTP ${c.status}`)},catch:c=>new e.uV({message:`${b.method} ${a} failed`,cause:c})}),h=(a,b)=>f(`/api/comments?cwd=${encodeURIComponent(a)}${b?`&filePath=${encodeURIComponent(b)}`:""}`),i=a=>f(`/api/comments?cwd=${encodeURIComponent(a)}&all=true`),j=a=>f("/api/comments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),k=(a,b,c)=>f("/api/comments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,id:b,content:c})}),l=(a,b)=>g(`/api/comments?cwd=${encodeURIComponent(a)}&id=${encodeURIComponent(b)}`,{method:"DELETE"}),m=a=>g(`/api/comments?cwd=${encodeURIComponent(a)}&all=true`,{method:"DELETE"})},90018:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{O:()=>K});var e=c(48249),f=c(67484),g=c(44384),h=c(10316),i=c(46674),j=c(80600),k=c(69924);c(33281),c(85655),c(87808);var l=c(53716),m=c(85984),n=c(7031),o=c(74754),p=c(91579),q=c(83768),r=c(36984),s=c(49924),t=c(54038),u=c(37690),v=c(77396),w=c(70404),x=c(41051),y=c(42140),z=c(70596),A=a([r,v,s,t]);function B(a){let b=a.lastIndexOf("/");return b>=0?a.slice(b+1):a}function C({symbol:a,fileSource:b,hasChange:c,onHighlighted:d,comments:g,onCommentClick:h,addedLines:i}){let{resolvedTheme:j}=(0,q.D)();(0,f.useMemo)(()=>(0,r.sQ)(a.filePath),[a.filePath]);let[k,m]=(0,f.useState)(null),[n,o]=(0,f.useState)(null);return(0,e.jsxs)("div",{className:"flex-1 min-w-0 bg-card border border-border rounded overflow-hidden relative",children:[(0,e.jsxs)("div",{"data-block-header":!0,className:"flex items-center gap-1.5 px-2 py-1.5 border-b border-border bg-secondary/40 text-xs",children:[(0,e.jsx)(l.y,{kind:a.kind,qname:a.qualifiedName,className:"w-3.5 h-3.5 flex-shrink-0"}),(0,e.jsxs)("span",{className:"font-mono truncate min-w-0",children:[(0,e.jsx)("span",{className:"font-medium",children:a.name}),void 0!==a.params&&(0,e.jsxs)("span",{className:"text-muted-foreground/80",children:["(",a.params.join(", "),")"]})]}),(0,e.jsxs)("span",{className:"text-[10px] text-muted-foreground/70 flex-shrink-0",children:[a.kind," \xb7 L",a.startLine,"-",a.endLine]}),(0,e.jsx)("span",{className:"flex-1"}),c&&(0,e.jsx)("span",{className:"flex-shrink-0 w-2 h-2 rounded-full bg-amber-11","data-tooltip":"File has uncommitted change"})]}),(0,e.jsxs)("div",{"data-block-body":!0,className:"text-[11px] font-mono px-2 py-2 overflow-auto",style:{lineHeight:`${N}px`},children:[!b&&(0,e.jsx)("span",{className:"text-muted-foreground",children:"Loading…"}),n&&(0,e.jsx)("span",{className:"text-red-11",children:n}),k&&(0,e.jsx)("div",{dangerouslySetInnerHTML:{__html:k}})]}),g&&g.length>0&&h&&(0,e.jsx)(v._,{comments:g,startLine:a.startLine,endLine:a.endLine,lineHeight:N,bodyTopOffset:O+P,onCommentClick:h})]})}function D({side:a,pin:b,accent:c,onClick:d}){let f,g,h,i,j,k,l,m=b.lines.length;"ext"===b.kind?(f="bg-secondary/30 border-border/50 hover:border-muted-foreground/60",g="ext",h="text-muted-foreground/60",i=b.name,j=b.packageSpec,k="external",l=b.packageSpec):"method"===b.kind?(f="bg-secondary/30 border-border/50 hover:border-muted-foreground/60",g="method",h="text-muted-foreground/60",i=`${b.receiverName}.${b.methodName}`,j=null,k="method (unresolved)",l=m>0?`at line${m>1?"s":""} ${b.lines.join(", ")}`:""):"self"===b.kind?(f="bg-secondary/40 border-border hover:border-muted-foreground",g="self",h="text-muted-foreground/70",i=b.external.name,j=null,k="same-file",l=m>0?`at line${m>1?"s":""} ${b.lines.join(", ")}`:""):(f="in"===a?"bg-amber-9/15 border-amber-9/40 hover:border-amber-11":"bg-green-9/15 border-green-9/40 hover:border-green-11",g=a,h="in"===a?"text-amber-11":"text-green-11",i=b.external.name,j=B(b.external.filePath),k="in"===a?"caller":"callee",l=b.external.filePath);let n=c&&"ext"!==b.kind&&"method"!==b.kind?" ring-1 ring-amber-9/70 ring-offset-0":"";return(0,e.jsxs)("button",{onClick:a=>{a.stopPropagation(),d()},className:`${f}${n} w-full text-left border rounded px-1.5 py-0.5 text-[10px] font-mono cursor-pointer transition-colors flex items-center gap-1.5`,"data-tooltip":`${k}${l?" \xb7 "+l:""}`,children:[(0,e.jsx)("span",{className:`${h} text-[9px] uppercase tracking-wider font-semibold flex-shrink-0`,children:g}),(0,e.jsxs)("span",{className:"truncate flex-1 min-w-0",children:[(0,e.jsx)("span",{className:"font-medium",children:i}),j&&(0,e.jsx)("span",{className:"text-muted-foreground/70 ml-1",children:j}),m>1&&(0,e.jsxs)("span",{className:"text-muted-foreground/60 ml-1",children:["\xb7",m,"\xd7"]})]})]})}[r,v,s,t]=A.then?(await A)():A;let N=18,O=29,P=8;function E(a,b){switch(b.kind){case"cross":return`${a}:x:${b.external.filePath}::${b.external.qualifiedName}`;case"self":return`${a}:s:${b.external.filePath}::${b.external.qualifiedName}`;case"ext":return`${a}:e:${b.packageSpec}::${b.name}`;case"method":return`${a}:m:${b.receiverName}::${b.methodName}`}}function F(a,b){return"ext"!==a.kind&&"method"!==a.kind&&(b?.has(a.external.qualifiedName)??!1)}function G(a){return{filePath:a.filePath,qname:a.qualifiedName,name:a.name,kind:a.kind}}function H({symbol:a,fileSource:b,hasChange:c,upstream:d,downstream:f,onPinClick:g,onHighlighted:h,comments:i,onCommentClick:j,accentQnames:k,addedLines:l}){let m=function(a,b){if(0===a.length)return[];let c=a.map((a,c)=>{var d,e,f;return{i:c,line:(d=a.lines[0]??b.startLine,e=b.startLine,f=b.endLine,Math.max(e,Math.min(f,d)))}});c.sort((a,b)=>a.line-b.line||a.i-b.i);let d=Array(a.length).fill(0),e=-1/0;for(let{i:a,line:f}of c){let c=O+P+(f-b.startLine)*N,g=Math.max(c,e);d[a]=g,e=g+22}return d}(f,a);return(0,e.jsxs)("div",{"data-block-qname":a.qualifiedName,"data-start-line":a.startLine,"data-end-line":a.endLine,className:"flex gap-2 items-stretch scroll-mt-2",children:[(0,e.jsx)("div",{className:"w-44 flex-shrink-0 flex flex-col gap-1 pt-1",children:0===d.length?(0,e.jsx)("div",{className:"text-[10px] text-muted-foreground/40 italic px-1.5",children:"no callers"}):d.map(b=>(0,e.jsx)(D,{side:"in",pin:b,accent:F(b,k),onClick:()=>g(b,a)},E("in",b)))}),(0,e.jsx)(C,{symbol:a,fileSource:b,hasChange:c,onHighlighted:h,comments:i,onCommentClick:j,addedLines:l}),(0,e.jsx)("div",{className:"w-44 flex-shrink-0 relative",children:0===f.length?(0,e.jsx)("div",{className:"text-[10px] text-muted-foreground/40 italic px-1.5 pt-1",children:"no callees"}):f.map((b,c)=>(0,e.jsx)("div",{className:"absolute left-0 right-0",style:{top:`${m[c]}px`},children:(0,e.jsx)(D,{side:"out",pin:b,accent:F(b,k),onClick:()=>g(b,a)})},E("out",b)))})]})}function I({cwd:a,onSelect:b,onClose:c}){let{t:d}=(0,g.Bd)(),[j,k]=(0,f.useState)(""),[l,m]=(0,f.useState)({files:[],symbols:[]}),[n,o]=(0,f.useState)(0),[p,q]=(0,f.useState)(!1),r=(0,f.useMemo)(()=>[...l.files,...l.symbols],[l]),s=(0,f.useCallback)(a=>{if("Escape"===a.key)return void c();if(0!==r.length){if("ArrowDown"===a.key)a.preventDefault(),o(a=>Math.min(a+1,r.length-1));else if("ArrowUp"===a.key)a.preventDefault(),o(a=>Math.max(a-1,0));else if("Enter"===a.key){a.preventDefault();let c=r[n];c&&b(c)}}},[r,n,c,b]);return(0,e.jsx)("div",{className:"absolute inset-0 bg-background/40 z-20 flex items-start justify-center pt-24",onClick:c,children:(0,e.jsxs)("div",{className:"w-[480px] max-w-[80%] bg-card border border-border rounded shadow-2xl overflow-hidden",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border",children:[(0,e.jsx)(h.A,{className:"w-4 h-4 text-muted-foreground"}),(0,e.jsx)("input",{autoFocus:!0,value:j,onChange:a=>k(a.target.value),onKeyDown:s,placeholder:d("blockViewer.search.hint","Start typing to search"),className:"flex-1 bg-transparent border-0 outline-none text-sm"}),p&&(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"…"}),(0,e.jsx)("button",{onClick:c,className:"text-muted-foreground hover:text-foreground",children:(0,e.jsx)(i.A,{className:"w-3.5 h-3.5"})})]}),(0,e.jsxs)("div",{className:"max-h-96 overflow-y-auto",children:[0===r.length&&j&&!p&&(0,e.jsx)("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:d("blockViewer.search.noResults","No matches")}),(0,e.jsx)(J,{label:d("blockViewer.search.files","Files"),hits:l.files,startIdx:0,activeIdx:n,onSelect:b,setActive:o}),(0,e.jsx)(J,{label:d("blockViewer.search.symbols","Symbols"),hits:l.symbols,startIdx:l.files.length,activeIdx:n,onSelect:b,setActive:o})]})]})})}function J({label:a,hits:b,startIdx:c,activeIdx:d,onSelect:f,setActive:g}){return 0===b.length?null:(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"px-3 py-1 text-[10px] uppercase tracking-wider text-muted-foreground bg-secondary/40",children:a}),b.map((a,b)=>{let h=c+b,i=h===d;return(0,e.jsxs)("button",{onMouseEnter:()=>g(h),onClick:()=>f(a),className:`w-full text-left px-3 py-1.5 text-xs flex items-start gap-2 ${i?"bg-secondary":"hover:bg-secondary/60"}`,children:["file"===a.target.kind?(0,e.jsx)(j.A,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0 text-muted-foreground"}):(0,e.jsx)(l.y,{kind:a.target.symbolKind,qname:a.target.qualifiedName,className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"}),(0,e.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-0.5",children:[(0,e.jsx)("span",{className:"font-mono truncate",children:a.label}),a.hint&&(0,e.jsx)("span",{className:"text-[10px] text-muted-foreground truncate",children:a.hint})]})]},`${a.type}:${a.label}:${b}`)})]})}function K({cwd:a,highlightedFilePath:b,changedFiles:c,onSwitchToCode:d,enableComments:h=!1,onContentSearch:i,onFocalChange:j,qnameFilter:k,qnameFilterFile:l,accentQnames:q,accentFile:r,addedLines:v,addedLinesFile:A,headerExtraLeft:C,headerExtraRight:D}){let{t:E}=(0,g.Bd)(),[F,J]=(0,f.useState)(null),N=F??b??null,{state:O,refresh:P}=(0,m.V)(a,N),[Q,R]=(0,f.useState)(null);(0,f.useRef)(null);let[S,T]=(0,f.useState)([]),[U,V]=(0,f.useState)(!1),[W,X]=(0,f.useState)(null),Y=(0,f.useRef)(0);(0,f.useRef)(0);let[Z,$]=(0,f.useState)(()=>new Set);"ready"===O.state&&O.data.filePath;let _=(0,f.useCallback)(a=>{$(b=>{if(b.has(a))return b;let c=new Set(b);return c.add(a),c})},[]),aa=(0,f.useCallback)((a,b)=>{if("ext"===a.kind||"method"===a.kind){let a=b.filePath;if(!a)return;Y.current+=1,X({filePath:a,qname:"__imports__",nonce:Y.current});return}let c=G(b),d=G(a.external);T(a=>(0,s.nb)((0,s.nb)(a,c),d)),J(d.filePath),Y.current+=1,X({filePath:d.filePath,qname:d.qname,nonce:Y.current})},[]),ab=(0,f.useCallback)(a=>{J(a.filePath),Y.current+=1,X({filePath:a.filePath,qname:a.qname,nonce:Y.current})},[]),ac=(0,f.useCallback)(a=>{V(!1),J(a.target.filePath),"symbol"===a.target.kind&&(Y.current+=1,X({filePath:a.target.filePath,qname:a.target.qualifiedName,line:a.target.line,nonce:Y.current}))},[]),ad=(0,f.useCallback)((a,b)=>{N&&(Y.current+=1,X({filePath:N,qname:a,line:b,nonce:Y.current}))},[N]),[ae,af]=(0,f.useState)(null),[ag,ah]=(0,f.useState)(null),ai=(0,f.useMemo)(()=>{if("ready"!==O.state||!ag)return null;let a=O.data.functions;if(0===a.length)return null;let b=(ag.start+ag.end)/2;for(let c of a)if(c.startLine<=b&&b<=c.endLine)return c.qualifiedName;let c=null;for(let b of a)b.startLine<=ag.start&&(!c||b.startLine>c.startLine)&&(c=b);return c?.qualifiedName??null},[O,ag]),aj=h&&!!a&&!!N,ak=(0,n.r)(),{comments:al,addComment:am,updateComment:an,deleteComment:ao,refresh:ap}=(0,o._)({cwd:a,filePath:N??""}),[aq,ar]=(0,f.useState)(null),{toolbarRef:as,bumpRef:at,clearToolbar:au}=(0,u.L)({enabled:aj,container:aq,resolveLineRange:a=>{if(!document.contains(a))return null;let b=a.nodeType===Node.TEXT_NODE?a.parentElement:a,c=b?.closest("[data-line]");if(!c||!aq||!aq.contains(c))return null;let d=c.getAttribute("data-line");if(!d)return null;let e=parseInt(d,10);return Number.isFinite(e)?{start:e,end:e}:null},buildLineSnapshot:({start:a,end:b})=>{let c=Q?.content;return c?c.split("\n").slice(a-1,b).join("\n"):""}}),[av,aw]=(0,f.useState)(null),[ax,ay]=(0,f.useState)(null),[az,aA]=(0,f.useState)(null),aB=(0,f.useCallback)(()=>{let a=as.current;a&&(aw({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),au())},[au,as]),aC=(0,f.useCallback)(()=>{let a=as.current;a&&(ay({x:a.x,y:a.y,range:a.range,selectedText:a.selectedText,lineSnapshot:a.lineSnapshot}),au())},[au,as]),aD=(0,f.useCallback)(()=>{let a=as.current;if(!a||!i)return;let b=a.selectedText.trim();au(),b&&i(b)},[i,au,as]),aE=(0,f.useCallback)(async a=>{av&&(await am(av.range.start,av.range.end,a,av.selectedText),aw(null))},[av,am]),aF=(0,f.useCallback)(async b=>{if(ax&&ak&&a&&N)try{let c=(await (0,p.$3)(a)).map(a=>({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0}));c.push({filePath:N,startLine:ax.range.start,endLine:ax.range.end,codeContent:ax.lineSnapshot});let d=(0,p.Gw)(c,b);ak.sendMessage(d),await (0,p.RP)(a),ap(),ay(null)}catch(a){console.error("[BlockViewer] send to AI failed:",a)}},[ax,ak,a,N,ap]),aG=(0,f.useCallback)((a,b)=>{b.stopPropagation(),aA({comment:a,x:b.clientX,y:b.clientY}),au(),aw(null),ay(null)},[au]);if(!N)return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(M,{focalFile:null,fileCount:null,onSwitchToCode:d,onSearch:()=>V(!0),onRefresh:P,refreshDisabled:!0,extraLeft:C,extraRight:D}),(0,e.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center text-sm text-muted-foreground gap-2 px-4 text-center",children:[(0,e.jsx)("span",{children:E("blockViewer.empty.body","Select a file in the left tree to see its function call graph.")}),(0,e.jsx)("span",{className:"text-xs",children:E("blockViewer.empty.hint","or press ⌘K to search.")})]}),U&&(0,e.jsx)(I,{cwd:a,onSelect:ac,onClose:()=>V(!1)})]});if("idle"===O.state||"loading"===O.state)return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(M,{focalFile:N,fileCount:null,onSwitchToCode:d,onSearch:()=>V(!0),onRefresh:P,refreshDisabled:!0,extraLeft:C,extraRight:D}),(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:E("blockViewer.fileMode.loading","Loading…")})]});if("notFound"===O.state)return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(M,{focalFile:N,fileCount:null,onSwitchToCode:d,onSearch:()=>V(!0),onRefresh:P,extraLeft:C,extraRight:D}),(0,e.jsx)("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground px-4 text-center",children:E("blockViewer.fileMode.notFound","This file is not indexed (unsupported language or beyond the file cap).")}),U&&(0,e.jsx)(I,{cwd:a,onSelect:ac,onClose:()=>V(!1)})]});if("error"===O.state)return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(M,{focalFile:N,fileCount:null,onSwitchToCode:d,onSearch:()=>V(!0),onRefresh:P,extraLeft:C,extraRight:D}),(0,e.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-sm",children:[(0,e.jsx)("span",{className:"text-red-11",children:O.message}),(0,e.jsx)("button",{onClick:P,className:"px-3 py-1 rounded bg-secondary hover:bg-secondary/80",children:E("blockViewer.retry","Retry")})]})]});let aH=O.data,aI=aH.functions;if(0===aI.length&&Q){let a=Math.max(1,Q.content.split("\n").length);aI=[{filePath:aH.filePath,qualifiedName:"__file__",name:B(aH.filePath),kind:"unknown",startLine:1,endLine:a}]}let aJ=l&&l===aH.filePath,aK=r&&r===aH.filePath,aL=A&&A===aH.filePath;aJ&&k&&(aI=aI.filter(a=>k.has(a.qualifiedName)));let aM=aK?q:void 0,aN=aL?v:void 0,aO=L(aH.upstreamCalls),aP=L(aH.downstreamCalls),aQ=new Map(aI.map(a=>[a.qualifiedName,a])),aR=new Map,aS=new Map;for(let a of aH.intraCalls){let b=aQ.get(a.to),c=aQ.get(a.from);if(b){let c=aR.get(a.from),d={kind:"self",external:b,lines:a.lines};c?c.push(d):aR.set(a.from,[d])}if(c){let b=aS.get(a.to),d={kind:"self",external:c,lines:a.lines};b?b.push(d):aS.set(a.to,[d])}}let aT=new Map;for(let a of aH.externalCalls??[]){let b=aT.get(a.focalQname),c={kind:"ext",name:a.external.name,packageSpec:a.external.packageSpec,lines:a.lines};b?b.push(c):aT.set(a.focalQname,[c])}let aU=new Map;for(let a of aH.methodCalls??[]){let b=aU.get(a.focalQname),c={kind:"method",receiverName:a.receiverName,methodName:a.methodName,lines:a.lines};b?b.push(c):aU.set(a.focalQname,[c])}let aV=c.has(aH.filePath);return(0,e.jsxs)("div",{className:"h-full flex flex-col relative",children:[(0,e.jsx)(M,{focalFile:N,fileCount:aH.fileCount,functionCount:aH.functions.length,upstreamCount:aH.upstreamCalls.length,downstreamCount:aH.downstreamCalls.length,onSwitchToCode:d,onSearch:()=>V(!0),onRefresh:P,extraLeft:C,extraRight:D}),(0,e.jsxs)("div",{ref:ar,className:"flex-1 relative min-h-0 flex",children:[(0,e.jsx)(t.g,{functions:aI,currentQname:ai,onSelect:ad}),(0,e.jsx)("div",{ref:af,className:"flex-1 min-w-0 overflow-auto",children:(0,e.jsx)("div",{className:"flex flex-col gap-3 p-3",children:aI.map(a=>{let b,c,d,f,g,h;return(0,e.jsx)(H,{symbol:a,fileSource:Q?.content??null,hasChange:aV,upstream:(b=aO.get(a.qualifiedName),c=aS.get(a.qualifiedName),[...(b??[]).map(a=>({kind:"cross",external:a.external,lines:a.lines})),...c??[]]),downstream:(d=aP.get(a.qualifiedName),f=aR.get(a.qualifiedName),g=aU.get(a.qualifiedName),h=aT.get(a.qualifiedName),[...(d??[]).map(a=>({kind:"cross",external:a.external,lines:a.lines})),...f??[],...g??[],...h??[]]),onPinClick:aa,onHighlighted:_,comments:aj?al:void 0,onCommentClick:aj?aG:void 0,accentQnames:aM,addedLines:aN},a.qualifiedName)})})}),aj&&aq&&(0,e.jsx)(x.f,{floatingToolbarRef:as,bumpRef:at,container:aq,onAddComment:aB,onSendToAI:aC,onSearch:i?aD:void 0,isChatLoading:ak?.isLoading}),aj&&av&&(0,e.jsx)(y.t,{x:av.x,y:av.y,range:av.range,lineSnapshot:av.lineSnapshot,container:aq,onSubmit:aE,onClose:()=>aw(null)}),aj&&ax&&N&&(0,e.jsx)(y.G,{x:ax.x,y:ax.y,range:ax.range,filePath:N,lineSnapshot:ax.lineSnapshot,container:aq,onSubmit:aF,onClose:()=>ay(null),isChatLoading:ak?.isLoading}),aj&&az&&(0,e.jsx)(z.t,{x:az.x,y:az.y,comment:az.comment,container:aq,onClose:()=>aA(null),onUpdateComment:an,onDeleteComment:ao}),aN&&aN.size>0&&aI.length>0&&(0,e.jsx)(w.e,{addedLines:aN,blockRanges:aI.map(a=>({qname:a.qualifiedName,startLine:a.startLine,endLine:a.endLine})),viewportRange:ag,onJumpToLine:ad}),(0,e.jsx)(s.mp,{entries:S,onSelect:ab,onClear:()=>T([])}),U&&(0,e.jsx)(I,{cwd:a,onSelect:ac,onClose:()=>V(!1)})]})]})}function L(a){let b=new Map;for(let c of a){let a=b.get(c.focalQname);if(!a){b.set(c.focalQname,[c]);continue}a.some(a=>a.external.filePath===c.external.filePath&&a.external.qualifiedName===c.external.qualifiedName)||a.push(c)}return b}function M({focalFile:a,fileCount:b,functionCount:c,upstreamCount:d,downstreamCount:f,onSwitchToCode:i,onSearch:j,onRefresh:l,refreshDisabled:m,extraLeft:n,extraRight:o}){let{t:p}=(0,g.Bd)(),q={focalFile:a,blockCount:c??0,upstreamCount:d??0,downstreamCount:f??0};return(0,e.jsxs)("div",{className:"flex-shrink-0 px-3 py-2 border-b border-border flex items-center justify-between bg-secondary/30 gap-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 min-w-0 text-xs text-muted-foreground font-mono",children:[(0,e.jsx)("span",{className:"truncate min-w-0",children:a?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-foreground",children:a}),"number"==typeof c&&(0,e.jsxs)("span",{className:"ml-2",children:["\xb7 ",c," blocks"]}),"number"==typeof d&&"number"==typeof f&&(0,e.jsxs)("span",{className:"ml-2",children:["\xb7 ",d," in \xb7 ",f," out"]})]}):(0,e.jsx)("span",{children:null!==b?`${b} files`:"…"})}),n&&(0,e.jsx)("span",{className:"flex items-center gap-1 flex-shrink-0",children:n(q)})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[o&&(0,e.jsx)("span",{className:"flex items-center gap-1",children:o(q)}),(0,e.jsxs)("button",{onClick:j,className:"text-xs px-2 py-1 rounded hover:bg-secondary text-muted-foreground hover:text-foreground flex items-center gap-1","data-tooltip":p("blockViewer.search.tooltip","Search (⌘K)"),children:[(0,e.jsx)(h.A,{className:"w-3 h-3"})," ⌘K"]}),(0,e.jsx)("button",{onClick:l,disabled:m,className:"text-xs px-2 py-1 rounded hover:bg-secondary text-muted-foreground hover:text-foreground disabled:opacity-50 disabled:hover:bg-transparent","data-tooltip":p("blockViewer.refresh","Rebuild project graph"),children:(0,e.jsx)(k.A,{className:"w-3 h-3"})}),i&&(0,e.jsx)("button",{onClick:i,className:"text-xs px-2 py-1 rounded hover:bg-secondary text-muted-foreground hover:text-foreground",children:"Code"})]})]})}d()}catch(a){d(a)}})},90298:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{r:()=>j});var e=c(48249),f=c(67484),g=c(44256),h=c(33281),i=c(41224);let a=[{value:"deepseek-v4-flash",label:"deepseek-v4-flash"},{value:"deepseek-v4-pro",label:"deepseek-v4-pro"}];function j({currentModel:b,onModelChange:c}){let[d,k]=(0,f.useState)(!1),[l,m]=(0,f.useState)(""),[n,o]=(0,f.useState)(""),[p,q]=(0,f.useState)(!1),[r,s]=(0,f.useState)(!1),[t,u]=(0,f.useState)(!1),[v,w]=(0,f.useState)(null),x=(0,f.useRef)(null),y=(0,f.useRef)(null),z=(0,f.useRef)(null),[A,B]=(0,f.useState)({top:0,left:0}),C=(0,g.F2)(),D=(0,f.useCallback)(async()=>{s(!0),w(null);let d=await h.t4.runPromiseExit((0,i.td)());if("Failure"===d._tag){w("Failed to load settings"),s(!1);return}let e=d.value,f=e?.engines?.deepseek?.apiKey||"";m(f),o(""),q(!1);let g=e?.engines?.deepseek?.model;!b&&g&&a.some(a=>a.value===g)&&c(g),s(!1)},[b,c]),E=(0,f.useCallback)(async a=>{let b=await h.t4.runPromiseExit((0,i.td)()),c=("Success"===b._tag?b.value:{}).engines||{},d={...c,deepseek:{...c.deepseek||{},...a}},e=await h.t4.runPromiseExit((0,i.em)({engines:d}));if("Failure"===e._tag)throw Error("Failed to save settings")},[]),F=async()=>{let a=n.trim();if(a){u(!0),w(null);try{await E({apiKey:a}),m(a),o(""),q(!1)}catch(a){w(a instanceof Error?a.message:"Save failed")}finally{u(!1)}}},G=async()=>{u(!0),w(null);try{await E({apiKey:""}),m(""),o(""),q(!1)}catch(a){w(a instanceof Error?a.message:"Clear failed")}finally{u(!1)}},H=async a=>{c(a);try{await E({model:a})}catch{}},I=!!l,J=I?b||"deepseek-v4-flash":"Set API key",K=I?"text-sky-400":"text-amber-400",L=d?(0,e.jsx)(g.ZL,{children:(0,e.jsx)("div",{ref:y,className:"fixed z-[9999] bg-popover border border-border rounded-lg shadow-lg py-2 min-w-[280px]",style:{top:A.top,left:A.left},children:r?(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin"}),"Loading..."]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"px-3 py-1.5",children:[(0,e.jsx)("div",{className:"text-[11px] font-medium text-muted-foreground mb-1.5",children:"API Key"}),I&&!p?(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("code",{className:"flex-1 min-w-0 truncate text-xs px-2 py-1 rounded bg-secondary text-foreground font-mono",children:l?l.length<=8?l.replace(/./g,"•"):`${l.slice(0,3)}${"•".repeat(Math.max(4,l.length-7))}${l.slice(-4)}`:""}),(0,e.jsx)("button",{onClick:()=>{q(!0),o(""),setTimeout(()=>z.current?.focus(),0)},className:"text-[11px] px-2 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",disabled:t,children:"Edit"}),(0,e.jsx)("button",{onClick:G,className:"text-[11px] px-2 py-1 rounded text-red-400 hover:bg-red-500/10 transition-colors",disabled:t,children:"Clear"})]}):(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("input",{ref:z,type:"password",value:n,onChange:a=>o(a.target.value),onKeyDown:a=>{"Enter"===a.key&&F()},placeholder:"sk-...",className:"flex-1 min-w-0 text-xs px-2 py-1 rounded bg-secondary text-foreground border border-border focus:border-sky-500 focus:outline-none font-mono",autoFocus:!0}),(0,e.jsx)("button",{onClick:F,disabled:t||!n.trim(),className:"text-[11px] px-2 py-1 rounded bg-sky-500/20 hover:bg-sky-500/30 text-sky-300 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:t?"Saving...":"Save"}),I&&(0,e.jsx)("button",{onClick:()=>{q(!1),o("")},className:"text-[11px] px-2 py-1 rounded text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"})]}),v&&(0,e.jsx)("div",{className:"mt-1 text-[11px] text-red-400",children:v})]}),(0,e.jsx)("div",{className:"my-1 border-t border-border"}),(0,e.jsxs)("div",{className:"px-3 py-1.5",children:[(0,e.jsx)("div",{className:"text-[11px] font-medium text-muted-foreground mb-1.5",children:"Model"}),(0,e.jsx)("div",{className:"flex flex-col gap-0.5",children:a.map(a=>{let c=(b||"deepseek-v4-flash")===a.value;return(0,e.jsxs)("button",{onClick:()=>H(a.value),className:`flex items-center gap-2 px-2 py-1 text-xs rounded transition-colors ${c?"bg-sky-500/15 text-sky-300":"text-foreground hover:bg-accent"}`,children:[(0,e.jsx)("span",{className:`w-3 h-3 rounded-full border-2 flex items-center justify-center ${c?"border-sky-400":"border-muted-foreground"}`,children:c&&(0,e.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-sky-400"})}),(0,e.jsx)("span",{children:a.label})]},a.value)})})]})]})})}):null;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{ref:x,onClick:()=>{if(!d){if(x.current){let a=x.current.getBoundingClientRect(),b=C?.getBoundingClientRect(),c=b?.left??0,d=b?.top??0;B({top:a.bottom+4-d,left:a.left-c})}D()}k(a=>!a)},className:"flex items-center gap-1 px-2 py-0.5 text-[11px] rounded bg-sky-500/15 hover:bg-sky-500/25 transition-colors",title:"Configure DeepSeek",children:[(0,e.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-sky-500 flex-shrink-0"}),(0,e.jsx)("span",{className:`truncate max-w-[160px] ${K}`,children:J}),(0,e.jsx)("svg",{className:"w-3 h-3 flex-shrink-0 text-sky-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),L]})}d()}catch(a){d(a)}})},90677:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(48249),e=c(3560),f=c(78684),g=c(74493),h=a([f]);f=(h.then?(await h)():h)[0],(0,e.Aq)({type:"jupyter",idPrefix:"nb",match:a=>a.trim().endsWith(".ipynb"),parse(a){let b=a.trim(),c=b.split("/"),d=c[c.length-1]||b;return{filePath:b,displayName:d,cwd:""}},fromHistory:a=>({filePath:a.filePath,displayName:a.displayName||"",cwd:a.cwd||""}),toHistory:a=>({filePath:a.filePath,displayName:a.displayName,cwd:a.cwd}),Component:function({item:a,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l}){return(0,d.jsx)(f.o,{id:a.id,filePath:a.filePath,displayName:a.displayName,cwd:a.cwd,selected:b,maximized:c,expandedHeight:e,bubbleContentHeight:g,timestamp:h,onSelect:i,onClose:j,onToggleMaximize:k,onTitleMouseDown:l})},async onClose(a){await (0,g.Hj)(a.id)}}),b()}catch(a){b(a)}})},91579:(a,b,c)=>{"use strict";c.d(b,{$3:()=>l,Cm:()=>k,Gw:()=>o,RP:()=>m,Un:()=>n,zL:()=>j});var d=c(208),e=c(79606),f=c(33281),g=c(71192),h=c(89800);let i=new Set;function j(a){return i.add(a),()=>i.delete(a)}function k(){i.forEach(a=>a())}async function l(a){let b=await f.t4.runPromiseExit((0,h.lb)(a));if("Success"!==b._tag)throw Error("Failed to fetch comments");let c=b.value.comments??[];if(0===c.length)return[];let d=new Map;for(let a of c)a.selectedText||(d.has(a.filePath)||d.set(a.filePath,[]),d.get(a.filePath).push(a));let i=new Map;await Promise.all(Array.from(d.keys()).map(async b=>{let c=await f.t4.runPromiseExit(e.tryPromise({try:async()=>{let c=await fetch(`/api/files/text?cwd=${encodeURIComponent(a)}&path=${encodeURIComponent(b)}`);return c.ok?await c.json():null},catch:a=>new g.uV({message:`read file text ${b} failed`,cause:a})}));"Success"===c._tag&&c.value&&"string"==typeof c.value.content?i.set(b,c.value.content.split("\n")):"Failure"===c._tag&&console.error(`Failed to read file ${b}:`,c.cause)}));let j=[];for(let a of c){if(a.selectedText){j.push({...a,codeContent:a.selectedText});continue}let b=i.get(a.filePath),c="";if(b){let d=Math.max(0,a.startLine-1),e=Math.min(b.length,a.endLine);c=b.slice(d,e).join("\n")}j.push({...a,codeContent:c})}return j}async function m(a){let b=await f.t4.runPromiseExit((0,h.tj)(a));return"Success"===b._tag?(k(),!0):(console.error("Failed to clear comments:",b.cause),!1)}let n="__chat__";function o(a,b){let c=a.filter(a=>a.filePath===n),e=a.filter(a=>a.filePath!==n),f=[];for(let a of(e.length>0&&(f.push(`${d.A.t("comments.codeRef")}`,""),e.forEach((a,b)=>{f.push(`[${b+1}] ${a.filePath}:${a.startLine}-${a.endLine}`),f.push("```"),f.push(a.codeContent),f.push("```"),a.note&&f.push(d.A.t("comments.note",{content:a.note})),f.push("")})),c)){let b=a.codeContent.split("\n").map(a=>`> ${a}`).join("\n");f.push(b),a.note&&f.push(a.note),f.push("")}return f.push(d.A.t("comments.question",{question:b})),f.join("\n")}},92451:(a,b,c)=>{"use strict";c.d(b,{U:()=>g});var d=c(48249),e=c(67484),f=c(19545);function g({editor:a,query:b,position:c,onClose:h}){let[i,j]=(0,e.useState)(0),k=(0,e.useRef)(null),l=(0,f.Qe)().filter(a=>a.label.toLowerCase().includes(b.toLowerCase())||a.description.toLowerCase().includes(b.toLowerCase()));return 0===l.length?null:(0,d.jsx)("div",{ref:k,className:"slash-command-menu fixed z-[60] bg-popover border border-border rounded-lg shadow-lg py-1 w-56 max-h-64 overflow-y-auto",style:{top:c.top,left:c.left},children:l.map((c,e)=>(0,d.jsxs)("button",{className:`w-full flex items-center gap-3 px-3 py-2 text-left text-sm transition-colors ${e===i?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"}`,onClick:()=>{a.chain().focus().deleteRange({from:a.state.selection.from-b.length-1,to:a.state.selection.from}).run(),c.action(a),h()},onMouseEnter:()=>j(e),children:[(0,d.jsx)("span",{className:"w-6 text-center text-xs font-mono flex-shrink-0",children:c.icon}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"font-medium",children:c.label}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground",children:c.description})]})]},c.label))})}},93448:(a,b,c)=>{"use strict";c.d(b,{TabManagerTopBar:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call TabManagerTopBar() from the server but TabManagerTopBar is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/TabManagerTopBar.tsx","TabManagerTopBar")},94192:(a,b,c)=>{"use strict";c.d(b,{R8:()=>i,c0:()=>k,fY:()=>j,gT:()=>l});var d=c(48249),e=c(67484);let f=["agent","explorer","console"],g={agent:"AGENT",explorer:"EXPLORER",console:"CONSOLE"},h=(0,e.createContext)(null);function i(){let a=(0,e.useContext)(h);if(!a)throw Error("useSwipeContext must be used within SwipeableViewContainer");return a}function j({activeView:a,onViewChange:b,children:c}){(0,e.useRef)(null),(0,e.useRef)(!1),(0,e.useRef)(0);let[g,i]=(0,e.useState)(0),[k,l]=(0,e.useState)(!1);f.indexOf(a),f.length;let[m,n]=(0,e.useState)(!1),o={activeView:a,onViewChange:b,dragOffset:(()=>{if(!m)return 0;let a=window.innerWidth;return a?g/a:0})(),isDragging:m&&k};return(0,d.jsx)(h.Provider,{value:o,children:c})}function k({children:a}){let b,c,{activeView:g,dragOffset:h,isDragging:j}=i(),l=(0,e.useRef)(null),m=(0,e.useRef)(null),n=f.indexOf(g),o=f.length;return(0,d.jsx)("div",{ref:l,className:"flex-1 overflow-hidden relative",style:{overscrollBehaviorX:"none"},children:(0,d.jsx)("div",{ref:m,className:j?"flex":"flex transition-transform duration-100 ease-out",style:{position:"absolute",top:"0px",bottom:"0px",left:"0px",width:`${100*f.length}%`,transform:(b=h/o*100,c=-(100/o*n)+(Number.isFinite(b)?b:0),`translateX(${c}%)`)},children:a})})}function l(){let{activeView:a,onViewChange:b,dragOffset:c,isDragging:h}=i(),j=(0,e.useRef)(null),k=(0,e.useRef)([]),[l,m]=(0,e.useState)({left:0,width:0}),n=f.indexOf(a),o=Number.isFinite(c)?c:0,p=Math.round(Math.max(0,Math.min(f.length-1,n-o)));return(0,d.jsxs)("div",{ref:j,className:"relative flex gap-4",children:[f.map((a,c)=>(0,d.jsx)("button",{ref:a=>{k.current[c]=a},onClick:()=>b(a),className:`px-4 py-1 text-sm font-medium transition-colors ${p===c?"text-brand":"text-muted-foreground hover:text-foreground"}`,children:g[a]},a)),(0,d.jsx)("div",{className:`absolute bottom-0 h-0.5 bg-brand ${h?"":"transition-all duration-100 ease-out"}`,style:{left:l.left,width:l.width}})]})}},94239:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{c:()=>k});var e=c(48249),f=c(67484),g=c(44384),h=c(61591),i=c(44256);function j({path:a,matchedIndices:b}){let c=(0,f.useMemo)(()=>new Set(b),[b]),d=a.lastIndexOf("/"),g=d>=0?a.slice(0,d+1):"",h=d>=0?a.slice(d+1):a,i=(a,b,d)=>{let f=[],g="",h=!1;for(let d=0;d<a.length;d++){let i=b+d,j=c.has(i);j!==h&&g&&(f.push(h?(0,e.jsx)("span",{className:"text-brand font-medium",children:g},`${b}-${d}`):(0,e.jsx)("span",{children:g},`${b}-${d}`)),g=""),h=j,g+=a[d]}return g&&f.push(h?(0,e.jsx)("span",{className:"text-brand font-medium",children:g},`${b}-end`):(0,e.jsx)("span",{children:g},`${b}-end`)),(0,e.jsx)("span",{className:d,children:f})};return(0,e.jsxs)("span",{className:"truncate",children:[g&&i(g,0,"text-muted-foreground"),i(h,g.length,"text-foreground")]})}function k({files:a,fileIndex:b,recentFiles:c,onSelectFile:d,onClose:l}){let{t:m}=(0,g.Bd)(),[n,o]=(0,f.useState)(""),[p,q]=(0,f.useState)(0),r=(0,f.useRef)(null),s=(0,f.useRef)(null),t=(0,f.useMemo)(()=>{let c,d;return b??(c=[],(d=a=>{for(let b of a)b.isDirectory&&b.children?d(b.children):b.isDirectory||c.push(b.path)})(a),c)},[b,a]),u=(0,f.useMemo)(()=>{if(!n.trim()){let a=new Set(c),b=c.map(a=>({path:a,score:0,matchedIndices:[]})),d=t.filter(b=>!a.has(b)).slice(0,50).map(a=>({path:a,score:0,matchedIndices:[]}));return[...b,...d]}let a=[];for(let b of t){let d=function(a,b){let c=a.toLowerCase(),d=b.toLowerCase(),e=[],f=0,g=0,h=-1;for(let i=0;i<c.length&&f<d.length;i++)if(c[i]===d[f]){e.push(i),h===i-1&&(g+=5),(0===i||"/"===a[i-1]||"."===a[i-1]||"-"===a[i-1]||"_"===a[i-1])&&(g+=10);let c=a.lastIndexOf("/");i>c&&(g+=3),a[i]===b[f]&&(g+=1),h=i,f++}return f<d.length?null:(g-=.1*a.length,{path:a,score:g,matchedIndices:e})}(b,n.trim());d&&(c.includes(b)&&(d.score+=20),a.push(d))}return a.sort((a,b)=>b.score-a.score),a.slice(0,50)},[n,t,c]),v=(0,f.useCallback)(a=>{o(a),q(0)},[]),w=(0,f.useCallback)(a=>{d(a),l()},[d,l]),x=(0,f.useCallback)(a=>{if(!a.nativeEvent.isComposing)switch(a.key){case"ArrowDown":a.preventDefault(),q(a=>Math.min(a+1,u.length-1));break;case"ArrowUp":a.preventDefault(),q(a=>Math.max(a-1,0));break;case"Enter":a.preventDefault(),u[p]&&w(u[p].path);break;case"Escape":a.preventDefault(),l()}},[u,p,w,l]);return(0,e.jsx)(i.ZL,{children:(0,e.jsx)("div",{className:"fixed inset-0 z-[300] flex items-start justify-center pt-[15vh]",onClick:l,children:(0,e.jsxs)("div",{className:"w-[680px] max-h-[60vh] bg-card border border-border rounded-lg shadow-2xl overflow-hidden flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,e.jsxs)("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:[(0,e.jsx)("svg",{className:"w-4 h-4 text-muted-foreground flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),(0,e.jsx)("input",{ref:r,value:n,onChange:a=>v(a.target.value),onKeyDown:x,placeholder:m("quickFileOpen.placeholder"),className:"flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground",autoComplete:"off",autoCorrect:"off",spellCheck:"false"}),(0,e.jsx)("kbd",{className:"text-[10px] text-muted-foreground px-1.5 py-0.5 rounded border border-border bg-secondary",children:"ESC"})]}),(0,e.jsx)("div",{ref:s,className:"flex-1 overflow-y-auto py-1",children:0===u.length?(0,e.jsx)("div",{className:"px-3 py-8 text-center text-sm text-muted-foreground",children:m("quickFileOpen.noMatch")}):u.map((a,b)=>(0,e.jsxs)("div",{className:`px-3 py-1.5 flex items-center gap-2 cursor-pointer transition-colors ${b===p?"bg-brand/15 text-foreground":"hover:bg-accent text-foreground"}`,"data-tooltip":a.path,onClick:()=>w(a.path),children:[(0,e.jsx)(h.o,{name:a.path.split("/").pop()||"",className:"w-4 h-4 flex-shrink-0"}),(0,e.jsx)(j,{path:a.path,matchedIndices:a.matchedIndices}),!n.trim()&&c.includes(a.path)&&(0,e.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground px-1.5 py-0.5 rounded bg-secondary flex-shrink-0",children:m("quickFileOpen.recent")})]},a.path))}),(0,e.jsxs)("div",{className:"px-3 py-1.5 border-t border-border flex items-center gap-3 text-[10px] text-muted-foreground",children:[(0,e.jsxs)("span",{className:"flex items-center gap-1",children:[(0,e.jsx)("kbd",{className:"px-1 py-0.5 rounded border border-border bg-secondary",children:"↑↓"})," ",m("quickFileOpen.selectHint")]}),(0,e.jsxs)("span",{className:"flex items-center gap-1",children:[(0,e.jsx)("kbd",{className:"px-1 py-0.5 rounded border border-border bg-secondary",children:"Enter"})," ",m("quickFileOpen.openHint")]}),(0,e.jsxs)("span",{className:"flex items-center gap-1",children:[(0,e.jsx)("kbd",{className:"px-1 py-0.5 rounded border border-border bg-secondary",children:"Esc"})," ",m("quickFileOpen.closeHint")]})]})]})})})}d()}catch(a){d(a)}})},94308:(a,b,c)=>{"use strict";c.d(b,{e:()=>g});var d=c(48249),e=c(67484),f=c(44384);function g({branches:a,selectedBranch:b,onSelect:c,isLoading:h,pinnedBranches:i=[]}){let{t:j}=(0,f.Bd)(),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(""),o=(0,e.useRef)(null),p=(0,e.useRef)(null),q=m.toLowerCase(),r=new Set([...a?.local||[],...a?.remote||[]]),s=i.filter(a=>r.has(a)&&a.toLowerCase().includes(q)),t=new Set(s),u=a?.local.filter(a=>!t.has(a)&&a.toLowerCase().includes(q))||[],v=a?.remote.filter(a=>!t.has(a)&&a.toLowerCase().includes(q))||[],w=a=>{c(a),l(!1),n("")};return(0,d.jsxs)("div",{className:"relative",ref:o,children:[(0,d.jsxs)("button",{onClick:()=>l(!k),disabled:h,className:"w-full px-3 py-1.5 text-sm border border-border rounded bg-card text-foreground text-left flex items-center justify-between hover:border-slate-6 dark:hover:border-slate-6 transition-colors",children:[(0,d.jsxs)("span",{className:"truncate flex items-center gap-2",children:[(0,d.jsx)("svg",{className:"w-4 h-4 text-muted-foreground flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),b||j("git.selectBranch"),a?.current===b&&(0,d.jsxs)("span",{className:"text-xs text-green-11",children:["(",j("git.currentBranch"),")"]})]}),(0,d.jsx)("svg",{className:`w-4 h-4 text-slate-9 transition-transform ${k?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),k&&(0,d.jsxs)("div",{className:"absolute z-50 mt-1 w-full bg-card border border-border rounded-lg shadow-lg max-h-80 flex flex-col",children:[(0,d.jsx)("div",{className:"p-2 border-b border-border",children:(0,d.jsx)("input",{ref:p,type:"text",value:m,onChange:a=>n(a.target.value),placeholder:j("git.searchBranch"),className:"w-full px-2 py-1 text-sm border border-border rounded bg-secondary text-foreground placeholder-slate-9"})}),(0,d.jsxs)("div",{className:"overflow-y-auto flex-1",children:[s.length>0&&s.map(c=>(0,d.jsxs)("div",{onClick:()=>w(c),className:`px-3 py-1.5 text-sm cursor-pointer flex items-center gap-2 ${c===b?"bg-brand/10 text-brand":"hover:bg-accent text-foreground"}`,children:[(0,d.jsx)("span",{className:"truncate flex-1",children:c}),c===a?.current&&(0,d.jsx)("span",{className:"text-xs text-green-11 flex-shrink-0",children:j("git.currentBranch")}),c===b&&(0,d.jsx)("svg",{className:"w-4 h-4 text-brand flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},`pinned-${c}`)),u.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"px-3 py-1 text-xs font-medium text-muted-foreground bg-secondary sticky top-0",children:j("git.localBranches")}),u.map(c=>(0,d.jsxs)("div",{onClick:()=>w(c),className:`px-3 py-1.5 text-sm cursor-pointer flex items-center gap-2 ${c===b?"bg-brand/10 text-brand":"hover:bg-accent text-foreground"}`,children:[(0,d.jsx)("span",{className:"truncate flex-1",children:c}),c===a?.current&&(0,d.jsx)("span",{className:"text-xs text-green-11 flex-shrink-0",children:j("git.currentBranch")}),c===b&&(0,d.jsx)("svg",{className:"w-4 h-4 text-brand flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},c))]}),v.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"px-3 py-1 text-xs font-medium text-muted-foreground bg-secondary sticky top-0",children:j("git.remoteBranches")}),v.map(a=>(0,d.jsxs)("div",{onClick:()=>w(a),className:`px-3 py-1.5 text-sm cursor-pointer flex items-center gap-2 ${a===b?"bg-brand/10 text-brand":"hover:bg-accent text-foreground"}`,children:[(0,d.jsx)("span",{className:"truncate flex-1",children:a}),a===b&&(0,d.jsx)("svg",{className:"w-4 h-4 text-brand flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},a))]}),0===s.length&&0===u.length&&0===v.length&&(0,d.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:j("git.noMatchingBranches")})]})]})]})}},95401:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{m:()=>j});var e=c(48249),f=c(67484),g=c(44256),h=c(33281),i=c(41224);function j({currentModel:a,onModelChange:b}){let[c,d]=(0,f.useState)(!1),[k,l]=(0,f.useState)([]),[m,n]=(0,f.useState)(!1),[o,p]=(0,f.useState)(null),[q,r]=(0,f.useState)(!1),s=(0,f.useRef)(null),t=(0,f.useRef)(null),[u,v]=(0,f.useState)({top:0,left:0}),w=(0,g.F2)(),x=(0,f.useCallback)(async()=>{n(!0),p(null);let a=await h.t4.runPromiseExit((0,i.qD)(()=>r(!0)));if(r(!1),"Failure"===a._tag)p("Connection error");else{let b=a.value;switch(b._tag){case"ok":l(b.models);break;case"not-installed":case"error":p(b.message);break;case"not-running":p("Ollama is not running")}}n(!1)},[]),y=a?a.replace(/:latest$/,""):"Select model",z=c?(0,e.jsx)(g.ZL,{children:(0,e.jsx)("div",{ref:t,className:"fixed z-[9999] bg-popover border border-border rounded-lg shadow-lg py-1 min-w-[200px] max-h-[300px] overflow-y-auto",style:{top:u.top,left:u.left},children:m||q?(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin"}),q?"Starting Ollama...":"Loading models..."]}):o?(0,e.jsx)("div",{className:"px-3 py-2 text-xs text-red-400",children:o}):0===k.length?(0,e.jsxs)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:["No models found. Run ",(0,e.jsx)("code",{className:"bg-secondary px-1 rounded",children:"ollama pull <model>"})]}):k.map(c=>{var f;return(0,e.jsxs)("button",{onClick:()=>{var a;return a=c.name,void(b(a),d(!1))},className:`w-full flex items-center justify-between gap-2 px-3 py-1.5 text-xs hover:bg-brand/10 transition-colors ${c.name===a?"text-brand":"text-foreground"}`,children:[(0,e.jsx)("span",{className:"truncate",children:c.name.replace(/:latest$/,"")}),(0,e.jsx)("span",{className:"text-muted-foreground flex-shrink-0",children:c.parameter_size||((f=c.size)<1e9?`${(f/1e6).toFixed(0)}M`:`${(f/1e9).toFixed(1)}G`)})]},c.name)})})}):null;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{ref:s,onClick:()=>{if(!c){if(s.current){let a=s.current.getBoundingClientRect(),b=w?.getBoundingClientRect(),c=b?.left??0,d=b?.top??0;v({top:a.bottom+4-d,left:a.left-c})}x()}d(a=>!a)},className:"flex items-center gap-1 px-2 py-0.5 text-[11px] rounded bg-violet-500/15 text-violet-400 hover:bg-violet-500/25 transition-colors",title:"Switch Ollama model",children:[(0,e.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-violet-500 flex-shrink-0"}),(0,e.jsx)("span",{className:"truncate max-w-[120px]",children:y}),(0,e.jsx)("svg",{className:"w-3 h-3 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),z]})}d()}catch(a){d(a)}})},96487:()=>{},97572:(a,b,c)=>{"use strict";c.d(b,{g:()=>g,v:()=>f});var d=c(79606),e=c(71192);let f=d.tryPromise({try:async()=>{let a=await fetch("/api/projects");if(!a.ok)throw Error(`HTTP ${a.status}`);return await a.json()},catch:a=>new e.uV({message:"fetch /api/projects failed",cause:a})}),g=a=>d.tryPromise({try:async()=>{let b=await fetch("/api/projects",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a)});if(!b.ok)throw Error(`HTTP ${b.status}`)},catch:a=>new e.uV({message:"save /api/projects failed",cause:a})})},97951:(a,b,c)=>{"use strict";c.d(b,{e:()=>f});var d=c(67484),e=c(208);function f(a,b,{sessionId:c,cwd:g,engine:h,ollamaModel:i,deepseekModel:j,onSessionId:k,onFetchTitle:l}){let[m,n]=(0,d.useState)(!1),[o,p]=(0,d.useState)(null),[q,r]=(0,d.useState)(null),[s,t]=(0,d.useState)(null),u=(0,d.useRef)(null),v=(0,d.useRef)(c);v.current=c;let w=(0,d.useRef)(null),x=(0,d.useRef)(null),y=(0,d.useCallback)(()=>{let a=w.current;if(a&&a.text){let{messageId:c,text:d}=a;b(a=>a.map(a=>a.id===c?{...a,content:(a.content||"")+d}:a)),w.current={messageId:c,text:""}}x.current=null},[b]),z=(0,d.useCallback)(()=>{u.current&&(u.current.abort(),u.current=null)},[]),A=(0,d.useCallback)((a,c)=>{let d=a.type;if("system"===d&&"init"===a.subtype){let b=a.session_id;k(b),v.current=b,t(null);return}if("system"===d&&"api_retry"===a.subtype)return void t({attempt:a.attempt??0,maxRetries:a.max_retries??0,delayMs:a.retry_delay_ms??0,errorStatus:a.error_status,error:a.error});if("rate_limit_event"===d){let b=a.rate_limit_info;b&&r({status:b.status||"allowed",resetsAt:b.resetsAt,rateLimitType:b.rateLimitType,utilization:b.utilization,overageStatus:b.overageStatus,overageDisabledReason:b.overageDisabledReason,isUsingOverage:b.isUsingOverage,surpassedThreshold:b.surpassedThreshold});return}if("stream_event"===d){t(a=>a?null:a);let b=a.event;if(b?.type==="content_block_delta"&&b.delta?.type==="text_delta"){let a=b.delta.text||"";w.current&&w.current.messageId===c?w.current.text+=a:w.current={messageId:c,text:a},x.current||(x.current=setTimeout(y,50))}return}if("assistant"===d){let d=a.message;if(d?.content){if("codex"===h||"kimi"===h||"ollama"===h){let a=d.content.filter(a=>"text"===a.type&&a.text).map(a=>a.text);if(a.length>0){let d=a.join("");b(a=>a.map(a=>a.id===c?{...a,content:(a.content||"")+d}:a))}}for(let a of d.content)if("name"in a&&a.name){let d={id:a.id||`tool-${Date.now()}`,name:a.name,input:a.input||{},isLoading:!0};b(a=>a.map(a=>a.id!==c||a.toolCalls?.some(a=>a.id===d.id)?a:{...a,toolCalls:[...a.toolCalls||[],d]}))}}}if("user"===d){let d=a.message;if(d?.content){for(let a of d.content)if("tool_use_id"in a&&a.tool_use_id){let d=a.tool_use_id,e="string"==typeof a.content?a.content:JSON.stringify(a.content);b(a=>a.map(a=>a.id===c?{...a,toolCalls:a.toolCalls?.map(a=>a.id===d?{...a,result:e,isLoading:!1}:a)}:a))}}}if("result"===d){t(null),x.current&&(clearTimeout(x.current),x.current=null),y();let d=v.current;d&&g&&b(a=>(2===a.length&&l(d),a));let e=a.usage,f=a.total_cost_usd;e&&p({inputTokens:e.input_tokens||0,outputTokens:e.output_tokens||0,cacheCreationInputTokens:e.cache_creation_input_tokens||0,cacheReadInputTokens:e.cache_read_input_tokens||0,totalCostUsd:f||0}),b(a=>a.map(a=>a.id===c?{...a,isStreaming:!1,toolCalls:a.toolCalls?.map(a=>({...a,isLoading:!1}))}:a))}},[b,y,k,l,g,h]),B=(0,d.useCallback)(async(a,c)=>{let d=c?.map(a=>({type:"base64",media_type:a.media_type,data:a.data})),f={id:`user-${Date.now()}`,role:"user",content:a,images:d};b(a=>[...a,f]),n(!0),t(null);let k=`assistant-${Date.now()}`,l={id:k,role:"assistant",content:"",toolCalls:[],isStreaming:!0};b(a=>[...a,l]),u.current=new AbortController;try{if("ollama"===h&&!i)throw Error("Please select an Ollama model first (click the model picker above)");let b="codex"===h?"/api/chat/codex":"kimi"===h?"/api/chat/kimi":"ollama"===h?"/api/chat/ollama":"deepseek"===h?"/api/chat/deepseek":"/api/chat",c=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:a,sessionId:v.current,images:d,cwd:g,language:e.A.language,..."ollama"===h&&i&&{model:i},..."deepseek"===h&&j&&{model:j},..."claude2"===h&&{engine:"claude2"}}),signal:u.current.signal});if(400===c.status&&"deepseek"===h){let a=await c.json().catch(()=>null);throw Error(a?.error||"DeepSeek request failed")}if(!c.ok)throw Error(e.A.t("chat.requestFailed",{defaultValue:"Request failed"}));let f=c.body?.getReader();if(!f)throw Error(e.A.t("chat.cannotReadStream",{defaultValue:"Cannot read stream"}));let l=new TextDecoder,m="";for(;;){let{done:a,value:b}=await f.read();if(a)break;let c=(m+=l.decode(b,{stream:!0})).split("\n");for(let a of(m=c.pop()||"",c))if(a.startsWith("data: ")){let b=a.slice(6);if("[DONE]"===b)continue;try{let a=JSON.parse(b);A(a,k)}catch{}}}}catch(a){if(a instanceof Error&&"AbortError"===a.name);else{console.error("Chat error:",a);let c=a instanceof Error?a.message:e.A.t("chat.errorRetry",{defaultValue:"An error occurred. Please try again."});b(a=>a.map(a=>a.id===k?{...a,content:c,isStreaming:!1}:a))}}finally{u.current=null,n(!1),b(a=>a.map(a=>a.id===k?{...a,isStreaming:!1}:a))}},[g,h,i,j,b,A]);return{isLoading:m,tokenUsage:o,rateLimitInfo:q,apiRetryInfo:s,handleSend:B,handleStop:z,abortControllerRef:u}}},98420:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{V:()=>q});var e=c(48249),f=c(67484),g=c(44384),h=c(7833),i=c(36295),j=c(33988),k=c(30894),l=c(28602),m=c(74493),n=c(15105),o=a([i,k]);async function p(a){let b=(0,n.f)()?.id??null;return!!b&&new Promise(c=>{try{let d=globalThis.chrome?.runtime;if(!d?.sendMessage)return void c(!1);let e=setTimeout(()=>c(!1),2e3);d.sendMessage(b,{type:"prepare-iframe",url:a},a=>{clearTimeout(e),c(a?.ok??!1)})}catch{c(!1)}})}function q({url:a,id:b,selected:c,maximized:d,expandedHeight:n,bubbleContentHeight:o,onSelect:r,onClose:s,onToggleMaximize:t,onNewTab:u,timestamp:v,onTitleMouseDown:w,initialSleeping:x,onSleep:y,onWake:z}){let{t:A}=(0,g.Bd)(),[B,C]=(0,f.useState)(!1),[D,E]=(0,f.useState)(null),[F,G]=(0,f.useState)(a),[H,I]=(0,f.useState)(null),[J,K]=(0,f.useState)(x??!1),L=(0,f.useRef)(null),M=(0,f.useRef)(null),N=(0,f.useRef)(null);(0,f.useRef)(!0),(0,f.useCallback)(()=>{J||(K(!0),I(null),y?.(b))},[J,b,y]),(0,f.useCallback)(()=>{L.current&&(clearTimeout(L.current),L.current=null)},[]);let O=!!H&&!J&&!B,{shortId:P,connected:Q,connect:R,disconnect:S}=(0,j.B)(b,N,O);(0,f.useRef)(Q).current=Q;let T=(0,f.useCallback)(()=>{K(!1),z?.(b);let c=function(a){if(!a)return a;try{let b=new URL(a);return b.searchParams.set("_cockpit","1"),b.toString()}catch{let b=a.includes("?")?"&":"?";return`${a}${b}_cockpit=1`}}(a);!function(a){try{let b=new URL(a).hostname;return"localhost"===b||"127.0.0.1"===b}catch{return!1}}(a)?p(a).then(()=>I(c)):I(c)},[a,b,z]),U=(0,f.useCallback)(()=>C(!1),[]),V=(0,f.useCallback)(()=>{C(!1),E(A("browser.pageLoadFailed"))},[]),W=(0,f.useCallback)(()=>{if(J)return void T();let a=M.current?.querySelector("iframe");if(a&&H){C(!0),E(null);let b=a.src;a.src="",setTimeout(()=>{a.src=b},0)}},[J,T,H]),X=(0,f.useCallback)(()=>{F&&window.open(F,"_blank")},[F]),Y=function(a){if(!a)return"";try{let b=new URL(a);return b.port?`${b.hostname}:${b.port}`:b.hostname}catch{return a}}(F),Z=d&&n?n-41:o??i.p;return(0,e.jsx)("div",{className:"flex flex-col items-start",children:(0,e.jsxs)("div",{className:`w-full bg-accent text-foreground
|
|
39
39
|
relative transition-colors cursor-pointer
|
|
40
40
|
${d?"rounded-none overflow-visible border-0":"border overflow-hidden rounded-2xl rounded-bl-md rounded-br-md"}
|
|
41
41
|
${d?"":c?"border-brand":"border-brand/30"}`,onClick:d?void 0:r,children:[d?(0,e.jsxs)("div",{onDoubleClick:t,className:"flex items-center gap-2 px-3 py-2 border-b border-border bg-card",style:{height:41},children:[(0,e.jsx)("span",{className:"text-[10px] font-mono leading-none px-1 py-0.5 rounded flex-shrink-0 bg-muted text-muted-foreground",children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})})}),P&&(0,e.jsx)(k.j,{shortId:P,type:"browser",onRegister:()=>R(),onUnregister:async()=>{S(),await (0,m.qM)(P)}}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground truncate font-mono",children:F||A("browser.blankPage")}),F&&(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(F),(0,h.oR)(A("toast.copiedUrl"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:A("browser.copyUrl"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("span",{className:"flex-1"}),B&&(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin flex-shrink-0"}),(0,e.jsx)("button",{onClick:W,className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:A("common.refresh"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),(0,e.jsx)("button",{onClick:X,className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:A("browser.openInNewWindow"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})}),(0,e.jsx)("button",{onClick:t,className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:A("browser.exitMaximize",{modKey:(0,l.Mu)()}),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3"})})})]}):(0,e.jsxs)("div",{"data-drag-handle":!0,onMouseDown:()=>w?.(),onDoubleClick:a=>{a.stopPropagation(),t()},className:`flex items-center gap-2 px-4 py-1.5 border-b text-xs transition-colors cursor-grab active:cursor-grabbing
|
|
42
|
-
${c?"border-brand":"border-brand/30"}`,children:[(0,e.jsx)("span",{className:"text-[10px] font-mono leading-none px-1 py-0.5 rounded flex-shrink-0 bg-muted text-muted-foreground",children:(0,e.jsx)("svg",{className:"w-3 h-3 inline-block",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})})}),P&&(0,e.jsx)(k.j,{shortId:P,type:"browser",onRegister:()=>R(),onUnregister:async()=>{S(),await (0,m.qM)(P)}}),(0,e.jsx)("span",{className:"font-mono text-foreground truncate",children:F||A("browser.blankPage")}),F&&(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(F),(0,h.oR)(A("toast.copiedUrl"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:A("browser.copyUrl"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("span",{className:"flex-1"}),B&&(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin flex-shrink-0"}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),X()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:A("browser.openInNewWindow"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),W()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:A("common.refresh"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),s()},className:"p-0.5 rounded text-destructive hover:text-destructive/80 transition-colors flex-shrink-0",title:A("common.close"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("div",{ref:M,className:"w-full",style:{height:Z},children:J?(0,e.jsxs)("div",{className:"relative overflow-hidden cursor-pointer group h-full",onClick:a=>{a.stopPropagation(),W()},children:[(0,e.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-muted/30",children:[(0,e.jsx)("svg",{className:"w-10 h-10 mb-2 text-muted-foreground/50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground/60",children:Y})]}),(0,e.jsx)("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:(0,e.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-black/60 text-white text-xs",children:[(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),A("browser.clickToWake")]})})]}):a?D?(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center text-muted-foreground p-6 h-full",children:[(0,e.jsx)("svg",{className:"w-10 h-10 mb-3 text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),(0,e.jsx)("p",{className:"text-xs",children:D}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),W()},className:"mt-2 px-3 py-1 text-xs bg-secondary text-foreground rounded hover:bg-accent transition-colors",children:A("common.retry")})]}):(0,e.jsxs)("div",{className:"relative overflow-hidden h-full",style:{contain:"strict"},children:[B&&(0,e.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-white/80 dark:bg-slate-900/80 z-10",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}),H?(0,e.jsx)("iframe",{ref:N,src:H,className:"border-0",allow:"clipboard-write; clipboard-read",style:d?{width:"100%",height:"100%"}:{position:"absolute",top:0,left:0,width:"200%",height:"200%",transform:"scale(0.5)",transformOrigin:"top left"},onLoad:U,onError:V,title:`Browser: ${Y}`,"data-browser-id":b}):(0,e.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})})]}):(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center text-muted-foreground h-full",children:[(0,e.jsx)("svg",{className:"w-10 h-10 mb-2 text-slate-300 dark:text-slate-700",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})}),(0,e.jsx)("p",{className:"text-xs",children:A("browser.blankPage")})]})}),!d&&a&&(0,e.jsxs)("div",{className:"border-t border-border px-4 py-2 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${J?"bg-yellow-500":B?"bg-brand animate-pulse":D?"bg-red-500":"bg-green-500"}`}),(0,e.jsx)("span",{className:"truncate",children:J?A("browser.sleeping"):B?A("browser.loadingPage"):D?A("browser.loadFailed"):Y}),(0,e.jsx)("span",{className:"flex-1"}),v&&(0,e.jsx)("span",{className:"text-[11px] flex-shrink-0",children:function(a){if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`}(v)})]})]})})}[i,k]=o.then?(await o)():o,d()}catch(a){d(a)}})},98982:(a,b,c)=>{"use strict";c.d(b,{P:()=>j});var d=c(67484),e=c(57031),f=c(88214),g=c(79606),h=c(33281),i=c(71192);function j(){let[a,b]=(0,d.useState)([]),c=(0,d.useCallback)(()=>{let a=g.tryPromise({try:async()=>{let a=await fetch("/api/pinned-sessions");return await a.json()},catch:a=>new i.uV({message:"loadPinnedSessions failed",cause:a})});h.t4.runPromise(a.pipe(g.match({onSuccess:a=>b(a.sessions||[]),onFailure:()=>{}})))},[]),j=(0,d.useCallback)(a=>{b(a);let c=g.tryPromise({try:async()=>{await fetch("/api/pinned-sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessions:a})})},catch:a=>new i.uV({message:"savePinnedSessions failed",cause:a})});h.t4.runFork(c.pipe(g.orElse(()=>g.void))),(0,e.F)(f.n.PinnedSessionsChanged,{})},[]),k=(0,d.useCallback)(b=>a.some(a=>a.sessionId===b),[a]),l=(0,d.useCallback)((b,c,d)=>{a.some(a=>a.sessionId===b)||j([...a,{sessionId:b,cwd:c,customTitle:d}])},[a,j]),m=(0,d.useCallback)(b=>{j(a.filter(a=>a.sessionId!==b))},[a,j]),n=(0,d.useCallback)((b,c)=>{j(a.map(a=>a.sessionId===b?{...a,customTitle:c}:a))},[a,j]);return{pinnedSessions:a,isPinned:k,pinSession:l,unpinSession:m,updateTitle:n,reorder:(0,d.useCallback)(a=>{j(a)},[j]),reload:c}}},99033:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Workspace:()=>s});var e=c(48249),f=c(67484),g=c(44384),h=c(8077),i=c(4462),j=c(77120),k=c(77220),l=c(3033),m=c(34001),n=c(29412),o=c(37202),p=c(87819),q=c(97572),r=a([h,k,m,n]);function s({initialCwd:a,initialSessionId:b}){let{t:d}=(0,g.Bd)(),[r,t]=(0,f.useState)([]),[u,v]=(0,f.useState)(0),[w,x]=(0,f.useState)(!1),[y,z]=(0,f.useState)(!1),[A,B]=(0,f.useState)(!1),[C,D]=(0,f.useState)(!1),[E,F]=(0,f.useState)(!1),[G,H]=(0,f.useState)(null),[I,J]=(0,f.useState)(!1),[K,L]=(0,f.useState)(!1),[M,N]=(0,f.useState)(new Set),O=(0,f.useRef)(new Map),P=(0,f.useRef)(new Map),Q=(0,f.useRef)(new Map);(0,f.useRef)(null),(0,p.Z)(q.v,[]);let R=(0,f.useCallback)(async(a,b,d)=>{let{Effect:e}=await c.e(2728).then(c.bind(c,92728)),{BrowserRuntime:f}=await c.e(3718).then(c.bind(c,3718)),g=await f.runPromise((0,q.g)({projects:a,activeIndex:b,collapsed:d}).pipe(e.either));"Left"===g._tag&&console.error("Failed to save projects:",g.left)},[]),S=(0,f.useCallback)((a,b)=>{let c=new URL(window.location.href);c.searchParams.set("cwd",a),b?c.searchParams.set("sessionId",b):c.searchParams.delete("sessionId"),window.history.replaceState({},"",c.toString());let d=a.split("/").filter(Boolean).pop();document.title=d?`Cockpit - ${d}`:"Cockpit"},[]);(0,f.useRef)(!1);let T=(0,f.useCallback)(a=>{v(a),R(r,a,w);let b=r[a];if(b?.cwd){let a=Q.current.get(b.cwd);S(b.cwd,a)}},[r,w,R,S]),U=(0,f.useCallback)(a=>{let b=r.filter((b,c)=>c!==a),c=u;a<u?c=u-1:a===u&&c>=b.length&&(c=Math.max(0,b.length-1)),t(b),v(c),R(b,c,w)},[r,u,w,R]),V=(0,f.useCallback)(a=>{let b=r[u],c=a.findIndex(a=>a.cwd===b?.cwd);t(a),v(c>=0?c:0),R(a,c>=0?c:0,w)},[r,u,w,R]),W=(0,f.useCallback)(()=>{let a=!w;x(a),R(r,u,a)},[r,u,w,R]),X=(0,f.useCallback)((a,b)=>{Q.current.set(a,b);let c=r.findIndex(b=>b.cwd===a);if(c>=0){let d=O.current.get(a);d?.contentWindow&&d.contentWindow.postMessage({type:"SWITCH_SESSION",sessionId:b,switchToAgent:!0},"*"),v(c),R(r,c,w)}else{let c=[...r,{cwd:a}],d=c.length-1;t(c),v(d),R(c,d,w),P.current.set(a,{sessionId:b,switchToAgent:!0})}S(a,b),z(!1)},[r,w,R,S]),Y=(0,f.useCallback)((a,b)=>{Q.current.set(a,b);let c=r.findIndex(b=>b.cwd===a);if(c>=0){let d=O.current.get(a);d?.contentWindow&&d.contentWindow.postMessage({type:"SWITCH_SESSION",sessionId:b,switchToAgent:!0},"*"),c!==u&&(v(c),R(r,c,w))}else{let c=[...r,{cwd:a}],d=c.length-1;t(c),v(d),R(c,d,w),P.current.set(a,{sessionId:b,switchToAgent:!0})}S(a,b)},[r,u,w,R,S]),Z=(0,f.useCallback)(a=>{let b=P.current.get(a);if(b){let c=O.current.get(a);c?.contentWindow&&c.contentWindow.postMessage({type:"SWITCH_SESSION",sessionId:b.sessionId,switchToAgent:b.switchToAgent},"*"),P.current.delete(a)}},[]);return K?(0,e.jsxs)("div",{className:"h-screen flex bg-background overflow-hidden",children:[(0,e.jsx)(h.ProjectSidebar,{projects:r,activeIndex:u,collapsed:w,currentCwd:r[u]?.cwd,onSelectProject:T,onRemoveProject:U,onReorderProjects:V,onToggleCollapse:W,onOpenSessionBrowser:()=>z(!0),onOpenSettings:()=>B(!0),onOpenNote:a=>{H(a??null),F(!0)},onOpenSkills:()=>J(!0),onSwitchProject:Y,onAddProject:a=>{let b=r.findIndex(b=>b.cwd===a);if(b>=0)v(b),R(r,b,w);else{let b=[...r,{cwd:a}],c=b.length-1;t(b),v(c),R(b,c,w)}}}),(0,e.jsx)("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:0===r.length?(0,e.jsx)(i.EmptyState,{onSelectSession:X}):(0,e.jsx)("div",{className:"flex-1 relative overflow-hidden",children:r.map((a,b)=>M.has(a.cwd)&&(0,e.jsx)("iframe",{ref:b=>{b?O.current.set(a.cwd,b):O.current.delete(a.cwd)},src:`/project?cwd=${encodeURIComponent(a.cwd)}`,onLoad:()=>Z(a.cwd),className:`absolute inset-0 w-full h-full border-0 ${b===u?"block":"hidden"}`,title:`Project: ${a.cwd}`},a.cwd))})}),(0,e.jsx)(j.SessionBrowser,{isOpen:y,onClose:()=>z(!1),onSelectSession:X,onAddProject:a=>{let b=r.findIndex(b=>b.cwd===a);if(b>=0)v(b),R(r,b,w);else{let b=[...r,{cwd:a}],c=b.length-1;t(b),v(c),R(b,c,w)}z(!1)}}),(0,e.jsx)(k.SettingsModal,{isOpen:A,onClose:()=>B(!1)}),(0,e.jsx)(l.w,{isOpen:C,onClose:()=>D(!1)}),(0,e.jsx)(m.NoteModal,{isOpen:E,onClose:()=>{F(!1),H(null)},projectCwd:G,projectName:G?G.split("/").pop():null}),(0,e.jsx)(n.g,{isOpen:I,onClose:()=>J(!1)}),(0,e.jsx)(o.M,{onNavigate:Y})]}):(0,e.jsx)("div",{className:"h-screen flex items-center justify-center bg-card",children:(0,e.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,e.jsxs)("svg",{className:"animate-spin h-5 w-5",fill:"none",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,e.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,e.jsx)("span",{children:d("workspace.loadingText")})]})})}[h,k,m,n]=r.then?(await r)():r,d()}catch(a){d(a)}})},99087:(a,b,c)=>{"use strict";c.d(b,{a:()=>e});var d=c(67484);function e(a){let[b,c]=(0,d.useState)(!1),[e,f]=(0,d.useState)(""),[g,h]=(0,d.useState)([]),[i,j]=(0,d.useState)(0),k=(0,d.useRef)(null),l=(0,d.useRef)([]),m=(0,d.useCallback)(()=>{let b=a.current;b&&(b.querySelectorAll("mark.chat-search-match, mark.chat-search-current").forEach(a=>{let b=a.parentNode;b&&(b.replaceChild(document.createTextNode(a.textContent||""),a),b.normalize())}),l.current=[])},[a]);(0,d.useCallback)(b=>{if(m(),!b||!a.current){h([]),j(0);return}let c=[],d=[],e=b.toLowerCase();a.current.querySelectorAll("[data-message-id]").forEach(a=>{let f,g=a.getAttribute("data-message-id")||"",h=0,i=document.createTreeWalker(a,NodeFilter.SHOW_TEXT,null),j=[];for(;f=i.nextNode();)j.push(f);for(let a of j){let f=(a.textContent||"").toLowerCase(),i=0,j=[];for(;;){let a=f.indexOf(e,i);if(-1===a)break;j.push({start:a,end:a+b.length}),i=a+1}if(0!==j.length)for(let b=j.length-1;b>=0;b--){let e=j[b];a.splitText(e.end);let f=a.splitText(e.start),i=document.createElement("mark");i.className="chat-search-match",i.textContent=f.textContent,f.parentNode.replaceChild(i,f),c.push({messageId:g,markIndex:h}),d.push(i),h++}}}),c.reverse(),d.reverse(),l.current=d,h(c),j(c.length>0?0:-1)},[a,m]);let n=(0,d.useCallback)(()=>{0!==g.length&&j(a=>(a+1)%g.length)},[g.length]),o=(0,d.useCallback)(()=>{0!==g.length&&j(a=>(a-1+g.length)%g.length)},[g.length]),p=(0,d.useCallback)(()=>{c(!0),setTimeout(()=>k.current?.focus(),0)},[]),q=(0,d.useCallback)(()=>{c(!1),f(""),m(),h([]),j(0)},[m]),r=(0,d.useCallback)(a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?o():n()),"Escape"===a.key&&q()},[n,o,q]);return{isSearchVisible:b,searchQuery:e,setSearchQuery:f,matches:g,currentMatchIndex:i,goToNextMatch:n,goToPrevMatch:o,openSearch:p,closeSearch:q,searchInputRef:k,handleSearchKeyDown:r}}},99829:(a,b,c)=>{"use strict";c.d(b,{I18nProvider:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call I18nProvider() from the server but I18nProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/I18nProvider.tsx","I18nProvider")},99843:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{M:()=>p});var e=c(48249),f=c(67484),g=c(75513),h=c(2929),i=c(99087),j=c(74754),k=c(91579),l=c(41051),m=c(42140),n=c(44384),o=a([g,h]);[g,h]=o.then?(await o)():o;let p=(0,f.forwardRef)(function({messages:a,isLoading:b,cwd:c,sessionId:d,engine:o,apiRetryInfo:p,hasMoreHistory:q,isLoadingMore:r,onLoadMore:s,onFork:t,isActive:u=!0,onContentSearch:v},w){let{t:x}=(0,n.Bd)(),y=(0,f.useRef)(null),z=(0,f.useRef)(null),A=(0,f.useRef)(null),B=(0,f.useRef)(null),[C,D]=(0,f.useState)(null),[E,F]=(0,f.useState)(!0),[G,H]=(0,f.useState)(!1),[I,J]=(0,f.useState)(!1);(0,f.useEffect)(()=>{D(B.current)},[]);let{isSearchVisible:K,searchQuery:L,setSearchQuery:M,matches:N,currentMatchIndex:O,goToNextMatch:P,goToPrevMatch:Q,closeSearch:R,searchInputRef:S,handleSearchKeyDown:T}=(0,i.a)(B),U=(0,g.nH)(),V=(0,f.useRef)(null),W=(0,f.useRef)(()=>{}),{addComment:X,refresh:Y}=(0,j._)({cwd:c||"",filePath:k.Un}),[Z,$]=(0,f.useState)(null),[_,aa]=(0,f.useState)(null),ab=(0,f.useCallback)(a=>{if(Z||_)return;let b=window.getSelection();if(!b||b.isCollapsed||!b.rangeCount){V.current=null,W.current();return}let c=b.toString().trim();if(!c){V.current=null,W.current();return}let d=b.anchorNode instanceof HTMLElement?b.anchorNode:b.anchorNode?.parentElement;if(d?.closest('[data-role="user"]')){V.current=null,W.current();return}V.current={x:a.clientX,y:a.clientY,range:{start:0,end:0},selectedText:c},W.current()},[Z,_]),ac=(0,f.useCallback)(a=>{let b=a.target;!(b.closest(".floating-toolbar")||b.closest('[class*="z-[200]"]'))&&V.current&&(V.current=null,W.current())},[]),ad=(0,f.useCallback)(()=>{let a=V.current;a&&($({x:a.x,y:a.y,text:a.selectedText}),V.current=null,W.current(),window.getSelection()?.removeAllRanges())},[]),ae=(0,f.useCallback)(()=>{let a=V.current;a&&(aa({x:a.x,y:a.y,text:a.selectedText}),V.current=null,W.current(),window.getSelection()?.removeAllRanges())},[]),af=(0,f.useCallback)(()=>{let a=V.current;if(!a||!v)return;let b=a.selectedText.trim();V.current=null,W.current(),window.getSelection()?.removeAllRanges(),b&&v(b)},[v]),ag=(0,f.useCallback)(async a=>{Z&&(await X(0,0,a,Z.text),$(null))},[Z,X]),ah=(0,f.useCallback)(async a=>{if(_&&U&&c)try{let b=(await (0,k.$3)(c)).map(a=>({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0}));b.push({filePath:k.Un,startLine:0,endLine:0,codeContent:_.text});let d=(0,k.Gw)(b,a);U.sendMessage(d),await (0,k.RP)(c),Y(),aa(null)}catch(a){console.error("Failed to send to AI:",a)}},[_,U,c,Y]),ai=(0,f.useMemo)(()=>{let b=new Set;return a.filter(a=>!b.has(a.id)&&(b.add(a.id),!0))},[a]),aj=(0,f.useRef)(0),ak=(0,f.useRef)(!1),al=(0,f.useCallback)(()=>{let a=A.current;return!a||a.scrollHeight-a.scrollTop-a.clientHeight<50},[]),am=(0,f.useCallback)(()=>{let a=A.current;return!a||a.scrollTop<50},[]),an=(0,f.useCallback)(()=>{let a=al(),b=am();if(F(a),H(!b),J(!a),b&&q&&!r&&s){let a=A.current;a&&(aj.current=a.scrollHeight,ak.current=!0),s()}},[al,am,q,r,s]),ao=(0,f.useCallback)(()=>{z.current?.scrollIntoView({behavior:"smooth"})},[]),ap=(0,f.useCallback)(()=>{y.current?.scrollIntoView({behavior:"smooth"})},[]),aq=(0,f.useCallback)(a=>{let b=A.current;if(!b)return;let c=b.querySelector(`[data-message-id="${a}"]`);c&&(c.scrollIntoView({behavior:"smooth",block:"center"}),c.classList.add("ring-2","ring-brand","ring-offset-2"),setTimeout(()=>{c.classList.remove("ring-2","ring-brand","ring-offset-2")},2e3))},[]);(0,f.useImperativeHandle)(w,()=>({scrollToMessage:aq}),[aq]);let ar=(0,f.useRef)(0),as=(0,f.useRef)(!0);(0,f.useEffect)(()=>{let b=ar.current,c=a.length;ar.current=c,!as.current&&E&&c>b&&y.current?.scrollIntoView({behavior:"smooth"})},[a,E]),(0,f.useEffect)(()=>{E&&b&&y.current?.scrollIntoView({behavior:"smooth"})},[b,E]),(0,f.useEffect)(()=>{if(ak.current&&!r){let a=A.current;if(a){let b=a.scrollHeight-aj.current;a.scrollTop=b,ak.current=!1}}},[a,r]);let at=(0,f.useRef)(!1);return(0,f.useEffect)(()=>{u&&at.current&&a.length>0&&(at.current=!1,y.current?.scrollIntoView({behavior:"instant"}))},[u,a.length]),(0,f.useEffect)(()=>{as.current&&a.length>0&&(as.current=!1,u?y.current?.scrollIntoView({behavior:"instant"}):at.current=!0)},[a.length,u]),(0,e.jsxs)("div",{ref:B,className:"relative flex-1 min-h-0 overflow-hidden flex flex-col outline-none",tabIndex:-1,onMouseUp:ab,onMouseDown:ac,children:[K&&(0,e.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-secondary border-b border-border",children:[(0,e.jsx)("input",{ref:S,type:"text",value:L,onChange:a=>M(a.target.value),onKeyDown:T,placeholder:x("codeViewer.searchChat"),className:"flex-1 max-w-xs px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:N.length>0?`${O+1}/${N.length}`:x("common.noMatch")}),(0,e.jsx)("button",{onClick:Q,disabled:0===N.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:x("codeViewer.prevShiftEnter"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}),(0,e.jsx)("button",{onClick:P,disabled:0===N.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:x("codeViewer.nextEnter"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),(0,e.jsx)("button",{onClick:R,className:"p-1 rounded hover:bg-accent",title:x("codeViewer.closeEsc"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("div",{ref:A,onScroll:an,className:"relative flex-1 min-h-0 overflow-y-auto p-4",children:0!==a.length||b?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{ref:z}),q&&(0,e.jsx)("div",{className:"flex justify-center py-3",children:r?(0,e.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground text-sm",children:[(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"}),(0,e.jsx)("span",{children:x("chat.loadMoreHistory")})]}):(0,e.jsx)("button",{onClick:s,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:x("chat.scrollUpForMore")})}),ai.map(a=>(0,e.jsx)("div",{"data-message-id":a.id,className:"transition-[box-shadow] duration-300",children:(0,e.jsx)(h.s,{message:a,cwd:c,sessionId:d,onFork:t})},a.id)),b&&(0,e.jsx)("div",{className:"flex justify-start mb-4",children:(0,e.jsxs)("div",{className:"bg-accent rounded-2xl rounded-bl-md px-4 py-3 max-w-[90%]",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,e.jsx)("span",{className:"inline-block w-5 h-5 border-2 border-brand border-t-transparent rounded-full animate-spin"}),(0,e.jsx)("span",{className:"text-sm",children:"claude2"===o?"Claude 2 is thinking...":"codex"===o?"Codex is thinking...":"kimi"===o?"Kimi is thinking...":"ollama"===o?"Ollama is thinking...":"deepseek"===o?"DeepSeek is thinking...":x("chat.claudeThinking")})]}),p&&(0,e.jsxs)("div",{className:"mt-2 flex items-start gap-2 text-xs text-amber-400 border-t border-border/50 pt-2",children:[(0,e.jsx)("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0 animate-spin",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsxs)("div",{children:["Retrying API call (attempt ",p.attempt,p.maxRetries>0?`/${p.maxRetries}`:"",p.delayMs>0?`, delay ${(p.delayMs/1e3).toFixed(1)}s`:"",")"]}),(p.errorStatus||p.error)&&(0,e.jsxs)("div",{className:"text-muted-foreground/80 break-words",children:[p.errorStatus?`${p.errorStatus}`:"",p.errorStatus&&p.error?" \xb7 ":"",p.error||""]})]})]})]})}),(0,e.jsx)("div",{ref:y})]}):(0,e.jsx)("div",{className:"flex items-center justify-center h-full text-slate-9",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("div",{className:"text-4xl mb-4",children:"\uD83D\uDCAC"}),(0,e.jsx)("div",{children:x("chat.startConversation")})]})})}),G&&a.length>0&&(0,e.jsx)("button",{onClick:ao,className:"absolute top-2 left-1/2 -translate-x-1/2 p-2 bg-card text-muted-foreground hover:text-foreground shadow-md rounded-full transition-all hover:shadow-lg active:scale-95",title:x("chat.jumpToStart"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}),I&&a.length>0&&(0,e.jsx)("button",{onClick:ap,className:"absolute bottom-2 left-1/2 -translate-x-1/2 p-2 bg-card text-muted-foreground hover:text-foreground shadow-md rounded-full transition-all hover:shadow-lg active:scale-95",title:x("chat.jumpToLatest"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),C&&(0,e.jsx)(l.f,{floatingToolbarRef:V,bumpRef:W,container:C,onAddComment:ad,onSendToAI:ae,onSearch:v?af:void 0,isChatLoading:U?.isLoading}),Z&&C&&(0,e.jsx)(m.t,{x:Z.x,y:Z.y,range:{start:0,end:0},codeContent:Z.text,container:C,onSubmit:ag,onClose:()=>$(null)}),_&&C&&(0,e.jsx)(m.G,{x:_.x,y:_.y,range:{start:0,end:0},codeContent:_.text,container:C,onSubmit:ah,onClose:()=>aa(null),isChatLoading:U?.isLoading})]})});d()}catch(a){d(a)}})}};
|
|
42
|
+
${c?"border-brand":"border-brand/30"}`,children:[(0,e.jsx)("span",{className:"text-[10px] font-mono leading-none px-1 py-0.5 rounded flex-shrink-0 bg-muted text-muted-foreground",children:(0,e.jsx)("svg",{className:"w-3 h-3 inline-block",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})})}),P&&(0,e.jsx)(k.j,{shortId:P,type:"browser",onRegister:()=>R(),onUnregister:async()=>{S(),await (0,m.qM)(P)}}),(0,e.jsx)("span",{className:"font-mono text-foreground truncate",children:F||A("browser.blankPage")}),F&&(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),navigator.clipboard.writeText(F),(0,h.oR)(A("toast.copiedUrl"))},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:A("browser.copyUrl"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})}),(0,e.jsx)("span",{className:"flex-1"}),B&&(0,e.jsx)("span",{className:"inline-block w-3 h-3 border border-brand border-t-transparent rounded-full animate-spin flex-shrink-0"}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),X()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:A("browser.openInNewWindow"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),W()},className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors flex-shrink-0",title:A("common.refresh"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),s()},className:"p-0.5 rounded text-destructive hover:text-destructive/80 transition-colors flex-shrink-0",title:A("common.close"),children:(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("div",{ref:M,className:"w-full",style:{height:Z},children:J?(0,e.jsxs)("div",{className:"relative overflow-hidden cursor-pointer group h-full",onClick:a=>{a.stopPropagation(),W()},children:[(0,e.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-muted/30",children:[(0,e.jsx)("svg",{className:"w-10 h-10 mb-2 text-muted-foreground/50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground/60",children:Y})]}),(0,e.jsx)("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:(0,e.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-black/60 text-white text-xs",children:[(0,e.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),A("browser.clickToWake")]})})]}):a?D?(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center text-muted-foreground p-6 h-full",children:[(0,e.jsx)("svg",{className:"w-10 h-10 mb-3 text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),(0,e.jsx)("p",{className:"text-xs",children:D}),(0,e.jsx)("button",{onClick:a=>{a.stopPropagation(),W()},className:"mt-2 px-3 py-1 text-xs bg-secondary text-foreground rounded hover:bg-accent transition-colors",children:A("common.retry")})]}):(0,e.jsxs)("div",{className:"relative overflow-hidden h-full",style:{contain:"strict"},children:[B&&(0,e.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-white/80 dark:bg-slate-900/80 z-10",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})}),H?(0,e.jsx)("iframe",{ref:N,src:H,className:"border-0",allow:"clipboard-write; clipboard-read",style:d?{width:"100%",height:"100%"}:{position:"absolute",top:0,left:0,width:"200%",height:"200%",transform:"scale(0.5)",transformOrigin:"top left"},onLoad:U,onError:V,title:`Browser: ${Y}`,"data-browser-id":b}):(0,e.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,e.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})})]}):(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center text-muted-foreground h-full",children:[(0,e.jsx)("svg",{className:"w-10 h-10 mb-2 text-slate-300 dark:text-slate-700",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"})}),(0,e.jsx)("p",{className:"text-xs",children:A("browser.blankPage")})]})}),!d&&a&&(0,e.jsxs)("div",{className:"border-t border-border px-4 py-2 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${J?"bg-yellow-500":B?"bg-brand animate-pulse":D?"bg-red-500":"bg-green-500"}`}),(0,e.jsx)("span",{className:"truncate",children:J?A("browser.sleeping"):B?A("browser.loadingPage"):D?A("browser.loadFailed"):Y}),(0,e.jsx)("span",{className:"flex-1"}),v&&(0,e.jsx)("span",{className:"text-[11px] flex-shrink-0",children:function(a){if(!a)return"";let b=new Date(a);if(isNaN(b.getTime()))return"";let c=String(b.getMonth()+1).padStart(2,"0"),d=String(b.getDate()).padStart(2,"0"),e=String(b.getHours()).padStart(2,"0"),f=String(b.getMinutes()).padStart(2,"0");return`${c}-${d} ${e}:${f}`}(v)})]})]})})}[i,k]=o.then?(await o)():o,d()}catch(a){d(a)}})},98982:(a,b,c)=>{"use strict";c.d(b,{P:()=>j});var d=c(67484),e=c(57031),f=c(88214),g=c(79606),h=c(33281),i=c(71192);function j(){let[a,b]=(0,d.useState)([]),c=(0,d.useCallback)(()=>{let a=g.tryPromise({try:async()=>{let a=await fetch("/api/pinned-sessions");return await a.json()},catch:a=>new i.uV({message:"loadPinnedSessions failed",cause:a})});h.t4.runPromise(a.pipe(g.match({onSuccess:a=>b(a.sessions||[]),onFailure:()=>{}})))},[]),j=(0,d.useCallback)(a=>{b(a);let c=g.tryPromise({try:async()=>{await fetch("/api/pinned-sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessions:a})})},catch:a=>new i.uV({message:"savePinnedSessions failed",cause:a})});h.t4.runFork(c.pipe(g.orElse(()=>g.void))),(0,e.F)(f.n.PinnedSessionsChanged,{})},[]),k=(0,d.useCallback)(b=>a.some(a=>a.sessionId===b),[a]),l=(0,d.useCallback)((b,c,d)=>{a.some(a=>a.sessionId===b)||j([...a,{sessionId:b,cwd:c,customTitle:d}])},[a,j]),m=(0,d.useCallback)(b=>{j(a.filter(a=>a.sessionId!==b))},[a,j]),n=(0,d.useCallback)((b,c)=>{j(a.map(a=>a.sessionId===b?{...a,customTitle:c}:a))},[a,j]);return{pinnedSessions:a,isPinned:k,pinSession:l,unpinSession:m,updateTitle:n,reorder:(0,d.useCallback)(a=>{j(a)},[j]),reload:c}}},99033:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Workspace:()=>s});var e=c(48249),f=c(67484),g=c(44384),h=c(8077),i=c(4462),j=c(77120),k=c(77220),l=c(3033),m=c(34001),n=c(29412),o=c(37202),p=c(87819),q=c(97572),r=a([h,k,m,n]);function s({initialCwd:a,initialSessionId:b}){let{t:d}=(0,g.Bd)(),[r,t]=(0,f.useState)([]),[u,v]=(0,f.useState)(0),[w,x]=(0,f.useState)(!1),[y,z]=(0,f.useState)(!1),[A,B]=(0,f.useState)(!1),[C,D]=(0,f.useState)(!1),[E,F]=(0,f.useState)(!1),[G,H]=(0,f.useState)(null),[I,J]=(0,f.useState)(!1),[K,L]=(0,f.useState)(!1),[M,N]=(0,f.useState)(new Set),O=(0,f.useRef)(new Map),P=(0,f.useRef)(new Map),Q=(0,f.useRef)(new Map);(0,f.useRef)(null),(0,p.Z)(q.v,[]);let R=(0,f.useCallback)(async(a,b,d)=>{let{Effect:e}=await c.e(2728).then(c.bind(c,92728)),{BrowserRuntime:f}=await c.e(3718).then(c.bind(c,3718)),g=await f.runPromise((0,q.g)({projects:a,activeIndex:b,collapsed:d}).pipe(e.either));"Left"===g._tag&&console.error("Failed to save projects:",g.left)},[]),S=(0,f.useCallback)((a,b)=>{let c=new URL(window.location.href);c.searchParams.set("cwd",a),b?c.searchParams.set("sessionId",b):c.searchParams.delete("sessionId"),window.history.replaceState({},"",c.toString());let d=a.split("/").filter(Boolean).pop();document.title=d?`Cockpit - ${d}`:"Cockpit"},[]);(0,f.useRef)(!1);let T=(0,f.useCallback)(a=>{v(a),R(r,a,w);let b=r[a];if(b?.cwd){let a=Q.current.get(b.cwd);S(b.cwd,a)}},[r,w,R,S]),U=(0,f.useCallback)(a=>{let b=r.filter((b,c)=>c!==a),c=u;a<u?c=u-1:a===u&&c>=b.length&&(c=Math.max(0,b.length-1)),t(b),v(c),R(b,c,w)},[r,u,w,R]),V=(0,f.useCallback)(a=>{let b=r[u],c=a.findIndex(a=>a.cwd===b?.cwd);t(a),v(c>=0?c:0),R(a,c>=0?c:0,w)},[r,u,w,R]),W=(0,f.useCallback)(()=>{let a=!w;x(a),R(r,u,a)},[r,u,w,R]),X=(0,f.useCallback)((a,b)=>{Q.current.set(a,b);let c=r.findIndex(b=>b.cwd===a);if(c>=0){let d=O.current.get(a);d?.contentWindow&&d.contentWindow.postMessage({type:"SWITCH_SESSION",sessionId:b,switchToAgent:!0},"*"),v(c),R(r,c,w)}else{let c=[...r,{cwd:a}],d=c.length-1;t(c),v(d),R(c,d,w),P.current.set(a,{sessionId:b,switchToAgent:!0})}S(a,b),z(!1)},[r,w,R,S]),Y=(0,f.useCallback)((a,b)=>{Q.current.set(a,b);let c=r.findIndex(b=>b.cwd===a);if(c>=0){let d=O.current.get(a);d?.contentWindow&&d.contentWindow.postMessage({type:"SWITCH_SESSION",sessionId:b,switchToAgent:!0},"*"),c!==u&&(v(c),R(r,c,w))}else{let c=[...r,{cwd:a}],d=c.length-1;t(c),v(d),R(c,d,w),P.current.set(a,{sessionId:b,switchToAgent:!0})}S(a,b)},[r,u,w,R,S]),Z=(0,f.useCallback)(a=>{let b=P.current.get(a);if(b){let c=O.current.get(a);c?.contentWindow&&c.contentWindow.postMessage({type:"SWITCH_SESSION",sessionId:b.sessionId,switchToAgent:b.switchToAgent},"*"),P.current.delete(a)}},[]);return K?(0,e.jsxs)("div",{className:"h-screen flex bg-background overflow-hidden",children:[(0,e.jsx)(h.ProjectSidebar,{projects:r,activeIndex:u,collapsed:w,currentCwd:r[u]?.cwd,onSelectProject:T,onRemoveProject:U,onReorderProjects:V,onToggleCollapse:W,onOpenSessionBrowser:()=>z(!0),onOpenSettings:()=>B(!0),onOpenNote:a=>{H(a??null),F(!0)},onOpenSkills:()=>J(!0),onSwitchProject:Y,onAddProject:a=>{let b=r.findIndex(b=>b.cwd===a);if(b>=0)v(b),R(r,b,w);else{let b=[...r,{cwd:a}],c=b.length-1;t(b),v(c),R(b,c,w)}}}),(0,e.jsx)("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:0===r.length?(0,e.jsx)(i.EmptyState,{onSelectSession:X}):(0,e.jsx)("div",{className:"flex-1 relative overflow-hidden",children:r.map((a,b)=>M.has(a.cwd)&&(0,e.jsx)("iframe",{ref:b=>{b?O.current.set(a.cwd,b):O.current.delete(a.cwd)},src:`/project?cwd=${encodeURIComponent(a.cwd)}`,onLoad:()=>Z(a.cwd),className:`absolute inset-0 w-full h-full border-0 ${b===u?"block":"hidden"}`,title:`Project: ${a.cwd}`},a.cwd))})}),(0,e.jsx)(j.SessionBrowser,{isOpen:y,onClose:()=>z(!1),onSelectSession:X,onAddProject:a=>{let b=r.findIndex(b=>b.cwd===a);if(b>=0)v(b),R(r,b,w);else{let b=[...r,{cwd:a}],c=b.length-1;t(b),v(c),R(b,c,w)}z(!1)}}),(0,e.jsx)(k.SettingsModal,{isOpen:A,onClose:()=>B(!1)}),(0,e.jsx)(l.w,{isOpen:C,onClose:()=>D(!1)}),(0,e.jsx)(m.NoteModal,{isOpen:E,onClose:()=>{F(!1),H(null)},projectCwd:G,projectName:G?G.split("/").pop():null}),(0,e.jsx)(n.g,{isOpen:I,onClose:()=>J(!1)}),(0,e.jsx)(o.M,{onNavigate:Y})]}):(0,e.jsx)("div",{className:"h-screen flex items-center justify-center bg-card",children:(0,e.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,e.jsxs)("svg",{className:"animate-spin h-5 w-5",fill:"none",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,e.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,e.jsx)("span",{children:d("workspace.loadingText")})]})})}[h,k,m,n]=r.then?(await r)():r,d()}catch(a){d(a)}})},99087:(a,b,c)=>{"use strict";c.d(b,{a:()=>e});var d=c(67484);function e(a){let[b,c]=(0,d.useState)(!1),[e,f]=(0,d.useState)(""),[g,h]=(0,d.useState)([]),[i,j]=(0,d.useState)(0),k=(0,d.useRef)(null),l=(0,d.useRef)([]),m=(0,d.useCallback)(()=>{let b=a.current;b&&(b.querySelectorAll("mark.chat-search-match, mark.chat-search-current").forEach(a=>{let b=a.parentNode;b&&(b.replaceChild(document.createTextNode(a.textContent||""),a),b.normalize())}),l.current=[])},[a]);(0,d.useCallback)(b=>{if(m(),!b||!a.current){h([]),j(0);return}let c=[],d=[],e=b.toLowerCase();a.current.querySelectorAll("[data-message-id]").forEach(a=>{let f,g=a.getAttribute("data-message-id")||"",h=0,i=document.createTreeWalker(a,NodeFilter.SHOW_TEXT,null),j=[];for(;f=i.nextNode();)j.push(f);for(let a of j){let f=(a.textContent||"").toLowerCase(),i=0,j=[];for(;;){let a=f.indexOf(e,i);if(-1===a)break;j.push({start:a,end:a+b.length}),i=a+1}if(0!==j.length)for(let b=j.length-1;b>=0;b--){let e=j[b];a.splitText(e.end);let f=a.splitText(e.start),i=document.createElement("mark");i.className="chat-search-match",i.textContent=f.textContent,f.parentNode.replaceChild(i,f),c.push({messageId:g,markIndex:h}),d.push(i),h++}}}),c.reverse(),d.reverse(),l.current=d,h(c),j(c.length>0?0:-1)},[a,m]);let n=(0,d.useCallback)(()=>{0!==g.length&&j(a=>(a+1)%g.length)},[g.length]),o=(0,d.useCallback)(()=>{0!==g.length&&j(a=>(a-1+g.length)%g.length)},[g.length]),p=(0,d.useCallback)(()=>{c(!0),setTimeout(()=>k.current?.focus(),0)},[]),q=(0,d.useCallback)(()=>{c(!1),f(""),m(),h([]),j(0)},[m]),r=(0,d.useCallback)(a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?o():n()),"Escape"===a.key&&q()},[n,o,q]);return{isSearchVisible:b,searchQuery:e,setSearchQuery:f,matches:g,currentMatchIndex:i,goToNextMatch:n,goToPrevMatch:o,openSearch:p,closeSearch:q,searchInputRef:k,handleSearchKeyDown:r}}},99829:(a,b,c)=>{"use strict";c.d(b,{I18nProvider:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call I18nProvider() from the server but I18nProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/cockpit/cockpit/packages/feature/workspace/src/client/I18nProvider.tsx","I18nProvider")},99843:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{M:()=>p});var e=c(48249),f=c(67484),g=c(75513),h=c(2929),i=c(99087),j=c(74754),k=c(91579),l=c(41051),m=c(42140),n=c(44384),o=a([g,h]);[g,h]=o.then?(await o)():o;let p=(0,f.forwardRef)(function({messages:a,isLoading:b,cwd:c,sessionId:d,engine:o,apiRetryInfo:p,hasMoreHistory:q,isLoadingMore:r,onLoadMore:s,onFork:t,isActive:u=!0,onContentSearch:v},w){let{t:x}=(0,n.Bd)(),y=(0,f.useRef)(null),z=(0,f.useRef)(null),A=(0,f.useRef)(null),B=(0,f.useRef)(null),[C,D]=(0,f.useState)(null),[E,F]=(0,f.useState)(!0),[G,H]=(0,f.useState)(!1),[I,J]=(0,f.useState)(!1);(0,f.useEffect)(()=>{D(B.current)},[]);let{isSearchVisible:K,searchQuery:L,setSearchQuery:M,matches:N,currentMatchIndex:O,goToNextMatch:P,goToPrevMatch:Q,closeSearch:R,searchInputRef:S,handleSearchKeyDown:T}=(0,i.a)(B),U=(0,g.nH)(),V=(0,f.useRef)(null),W=(0,f.useRef)(()=>{}),{addComment:X,refresh:Y}=(0,j._)({cwd:c||"",filePath:k.Un}),[Z,$]=(0,f.useState)(null),[_,aa]=(0,f.useState)(null),ab=(0,f.useCallback)(a=>{if(Z||_)return;let b=window.getSelection();if(!b||b.isCollapsed||!b.rangeCount){V.current=null,W.current();return}let c=b.toString().trim();if(!c){V.current=null,W.current();return}let d=b.anchorNode instanceof HTMLElement?b.anchorNode:b.anchorNode?.parentElement;if(d?.closest('[data-role="user"]')){V.current=null,W.current();return}V.current={x:a.clientX,y:a.clientY,range:{start:0,end:0},selectedText:c,lineSnapshot:c},W.current()},[Z,_]),ac=(0,f.useCallback)(a=>{let b=a.target;!(b.closest(".floating-toolbar")||b.closest('[class*="z-[200]"]'))&&V.current&&(V.current=null,W.current())},[]),ad=(0,f.useCallback)(()=>{let a=V.current;a&&($({x:a.x,y:a.y,text:a.selectedText}),V.current=null,W.current(),window.getSelection()?.removeAllRanges())},[]),ae=(0,f.useCallback)(()=>{let a=V.current;a&&(aa({x:a.x,y:a.y,text:a.selectedText}),V.current=null,W.current(),window.getSelection()?.removeAllRanges())},[]),af=(0,f.useCallback)(()=>{let a=V.current;if(!a||!v)return;let b=a.selectedText.trim();V.current=null,W.current(),window.getSelection()?.removeAllRanges(),b&&v(b)},[v]),ag=(0,f.useCallback)(async a=>{Z&&(await X(0,0,a,Z.text),$(null))},[Z,X]),ah=(0,f.useCallback)(async a=>{if(_&&U&&c)try{let b=(await (0,k.$3)(c)).map(a=>({filePath:a.filePath,startLine:a.startLine,endLine:a.endLine,codeContent:a.codeContent,note:a.content||void 0}));b.push({filePath:k.Un,startLine:0,endLine:0,codeContent:_.text});let d=(0,k.Gw)(b,a);U.sendMessage(d),await (0,k.RP)(c),Y(),aa(null)}catch(a){console.error("Failed to send to AI:",a)}},[_,U,c,Y]),ai=(0,f.useMemo)(()=>{let b=new Set;return a.filter(a=>!b.has(a.id)&&(b.add(a.id),!0))},[a]),aj=(0,f.useRef)(0),ak=(0,f.useRef)(!1),al=(0,f.useCallback)(()=>{let a=A.current;return!a||a.scrollHeight-a.scrollTop-a.clientHeight<50},[]),am=(0,f.useCallback)(()=>{let a=A.current;return!a||a.scrollTop<50},[]),an=(0,f.useCallback)(()=>{let a=al(),b=am();if(F(a),H(!b),J(!a),b&&q&&!r&&s){let a=A.current;a&&(aj.current=a.scrollHeight,ak.current=!0),s()}},[al,am,q,r,s]),ao=(0,f.useCallback)(()=>{z.current?.scrollIntoView({behavior:"smooth"})},[]),ap=(0,f.useCallback)(()=>{y.current?.scrollIntoView({behavior:"smooth"})},[]),aq=(0,f.useCallback)(a=>{let b=A.current;if(!b)return;let c=b.querySelector(`[data-message-id="${a}"]`);c&&(c.scrollIntoView({behavior:"smooth",block:"center"}),c.classList.add("ring-2","ring-brand","ring-offset-2"),setTimeout(()=>{c.classList.remove("ring-2","ring-brand","ring-offset-2")},2e3))},[]);(0,f.useImperativeHandle)(w,()=>({scrollToMessage:aq}),[aq]);let ar=(0,f.useRef)(0),as=(0,f.useRef)(!0);(0,f.useEffect)(()=>{let b=ar.current,c=a.length;ar.current=c,!as.current&&E&&c>b&&y.current?.scrollIntoView({behavior:"smooth"})},[a,E]),(0,f.useEffect)(()=>{E&&b&&y.current?.scrollIntoView({behavior:"smooth"})},[b,E]),(0,f.useEffect)(()=>{if(ak.current&&!r){let a=A.current;if(a){let b=a.scrollHeight-aj.current;a.scrollTop=b,ak.current=!1}}},[a,r]);let at=(0,f.useRef)(!1);return(0,f.useEffect)(()=>{u&&at.current&&a.length>0&&(at.current=!1,y.current?.scrollIntoView({behavior:"instant"}))},[u,a.length]),(0,f.useEffect)(()=>{as.current&&a.length>0&&(as.current=!1,u?y.current?.scrollIntoView({behavior:"instant"}):at.current=!0)},[a.length,u]),(0,e.jsxs)("div",{ref:B,className:"relative flex-1 min-h-0 overflow-hidden flex flex-col outline-none",tabIndex:-1,onMouseUp:ab,onMouseDown:ac,children:[K&&(0,e.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-secondary border-b border-border",children:[(0,e.jsx)("input",{ref:S,type:"text",value:L,onChange:a=>M(a.target.value),onKeyDown:T,placeholder:x("codeViewer.searchChat"),className:"flex-1 max-w-xs px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-2 focus:ring-ring"}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:N.length>0?`${O+1}/${N.length}`:x("common.noMatch")}),(0,e.jsx)("button",{onClick:Q,disabled:0===N.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:x("codeViewer.prevShiftEnter"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}),(0,e.jsx)("button",{onClick:P,disabled:0===N.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:x("codeViewer.nextEnter"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),(0,e.jsx)("button",{onClick:R,className:"p-1 rounded hover:bg-accent",title:x("codeViewer.closeEsc"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("div",{ref:A,onScroll:an,className:"relative flex-1 min-h-0 overflow-y-auto p-4",children:0!==a.length||b?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{ref:z}),q&&(0,e.jsx)("div",{className:"flex justify-center py-3",children:r?(0,e.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground text-sm",children:[(0,e.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-brand border-t-transparent rounded-full animate-spin"}),(0,e.jsx)("span",{children:x("chat.loadMoreHistory")})]}):(0,e.jsx)("button",{onClick:s,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:x("chat.scrollUpForMore")})}),ai.map(a=>(0,e.jsx)("div",{"data-message-id":a.id,className:"transition-[box-shadow] duration-300",children:(0,e.jsx)(h.s,{message:a,cwd:c,sessionId:d,onFork:t})},a.id)),b&&(0,e.jsx)("div",{className:"flex justify-start mb-4",children:(0,e.jsxs)("div",{className:"bg-accent rounded-2xl rounded-bl-md px-4 py-3 max-w-[90%]",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,e.jsx)("span",{className:"inline-block w-5 h-5 border-2 border-brand border-t-transparent rounded-full animate-spin"}),(0,e.jsx)("span",{className:"text-sm",children:"claude2"===o?"Claude 2 is thinking...":"codex"===o?"Codex is thinking...":"kimi"===o?"Kimi is thinking...":"ollama"===o?"Ollama is thinking...":"deepseek"===o?"DeepSeek is thinking...":x("chat.claudeThinking")})]}),p&&(0,e.jsxs)("div",{className:"mt-2 flex items-start gap-2 text-xs text-amber-400 border-t border-border/50 pt-2",children:[(0,e.jsx)("svg",{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0 animate-spin",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsxs)("div",{children:["Retrying API call (attempt ",p.attempt,p.maxRetries>0?`/${p.maxRetries}`:"",p.delayMs>0?`, delay ${(p.delayMs/1e3).toFixed(1)}s`:"",")"]}),(p.errorStatus||p.error)&&(0,e.jsxs)("div",{className:"text-muted-foreground/80 break-words",children:[p.errorStatus?`${p.errorStatus}`:"",p.errorStatus&&p.error?" \xb7 ":"",p.error||""]})]})]})]})}),(0,e.jsx)("div",{ref:y})]}):(0,e.jsx)("div",{className:"flex items-center justify-center h-full text-slate-9",children:(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("div",{className:"text-4xl mb-4",children:"\uD83D\uDCAC"}),(0,e.jsx)("div",{children:x("chat.startConversation")})]})})}),G&&a.length>0&&(0,e.jsx)("button",{onClick:ao,className:"absolute top-2 left-1/2 -translate-x-1/2 p-2 bg-card text-muted-foreground hover:text-foreground shadow-md rounded-full transition-all hover:shadow-lg active:scale-95",title:x("chat.jumpToStart"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}),I&&a.length>0&&(0,e.jsx)("button",{onClick:ap,className:"absolute bottom-2 left-1/2 -translate-x-1/2 p-2 bg-card text-muted-foreground hover:text-foreground shadow-md rounded-full transition-all hover:shadow-lg active:scale-95",title:x("chat.jumpToLatest"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),C&&(0,e.jsx)(l.f,{floatingToolbarRef:V,bumpRef:W,container:C,onAddComment:ad,onSendToAI:ae,onSearch:v?af:void 0,isChatLoading:U?.isLoading}),Z&&C&&(0,e.jsx)(m.t,{x:Z.x,y:Z.y,range:{start:0,end:0},lineSnapshot:Z.text,container:C,onSubmit:ag,onClose:()=>$(null)}),_&&C&&(0,e.jsx)(m.G,{x:_.x,y:_.y,range:{start:0,end:0},lineSnapshot:_.text,container:C,onSubmit:ah,onClose:()=>aa(null),isChatLoading:U?.isLoading})]})});d()}catch(a){d(a)}})}};
|