@surething/cockpit 1.0.235 → 1.0.236
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 +2 -2
- package/.next-prod/build-manifest.json +3 -3
- package/.next-prod/prerender-manifest.json +3 -3
- package/.next-prod/react-loadable-manifest.json +7 -0
- 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 +1 -1
- 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 +2 -2
- 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.nft.json +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.nft.json +1 -1
- package/.next-prod/server/app/api/chat/deepseek/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/kimi/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/ollama/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/pty-input/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/stop/route.js.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +1 -1
- package/.next-prod/server/app/api/git/commits/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/current-branch/route.js.nft.json +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.nft.json +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.nft.json +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.nft.json +1 -1
- package/.next-prod/server/app/api/global-state/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/health/route.js.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.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.nft.json +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.nft.json +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.nft.json +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.nft.json +1 -1
- package/.next-prod/server/app/api/project-state/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/affected/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/callees/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/callers/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/coedit/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/context/route.js.nft.json +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.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/impact/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/related/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/risk/route.js.nft.json +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.nft.json +1 -1
- package/.next-prod/server/app/api/push/public-key/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/push/subscribe/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/push/unsubscribe/route.js.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +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.nft.json +1 -1
- package/.next-prod/server/app/favicon.ico/route.js.nft.json +1 -1
- package/.next-prod/server/app/m/page.js +2 -2
- package/.next-prod/server/app/m/page.js.nft.json +1 -1
- package/.next-prod/server/app/m/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/.next-prod/server/app/page.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +2 -2
- package/.next-prod/server/chunks/2939.js +1 -1
- package/.next-prod/server/chunks/7270.js +45 -0
- package/.next-prod/server/chunks/{4257.js → 8523.js} +3 -3
- package/.next-prod/server/chunks/8916.js +1 -1
- package/.next-prod/server/chunks/9658.js +3 -3
- package/.next-prod/server/middleware-build-manifest.js +1 -1
- package/.next-prod/server/middleware-react-loadable-manifest.js +1 -1
- package/.next-prod/server/pages/404.html +2 -2
- package/.next-prod/server/pages/500.html +1 -1
- package/.next-prod/server/server-reference-manifest.json +1 -1
- package/.next-prod/static/chunks/{217-656e1fdbc820d9dd.js → 217-1bf54355c7c0c898.js} +1 -1
- package/.next-prod/static/chunks/3283-80d4d836a00d7bb4.js +25 -0
- package/.next-prod/static/chunks/6784-11888818d8e3114e.js +0 -0
- package/.next-prod/static/chunks/{9428-ffc16bc24c6e0da1.js → 6787-866a3046a4a0fa50.js} +3 -3
- package/.next-prod/static/chunks/9b0008ae.0167ac0019d88811.js +45 -0
- package/.next-prod/static/chunks/app/{layout-e9ada9458f95f29c.js → layout-3781fa5b8e04f272.js} +1 -1
- package/.next-prod/static/chunks/app/m/page-bf48756850ebe349.js +1 -0
- package/.next-prod/static/chunks/app/{page-8f349cc054af0d5b.js → page-e63d872a9af204ae.js} +1 -1
- package/.next-prod/static/chunks/app/project/{page-8f349cc054af0d5b.js → page-e63d872a9af204ae.js} +1 -1
- package/.next-prod/static/chunks/webpack-fb9d282647d95d0a.js +1 -0
- package/.next-prod/static/css/7ed891f30e531791.css +1 -0
- package/.next-prod/trace +13 -13
- package/.next-prod/trace-build +1 -1
- package/bin/postinstall.mjs +8 -0
- package/package.json +6 -3
- package/public/pdfjs/pdf.worker.min.mjs +29 -0
- package/scripts/copy-pdfjs-worker.mjs +74 -0
- package/.next-prod/static/chunks/2576-47a83a4d8066d196.js +0 -25
- package/.next-prod/static/chunks/6784-8a99d051f03bb100.js +0 -0
- package/.next-prod/static/chunks/app/m/page-06a5ea22c02892d1.js +0 -1
- package/.next-prod/static/chunks/webpack-2c71a79c277961bc.js +0 -1
- package/.next-prod/static/css/44a979b47b165c63.css +0 -1
- /package/.next-prod/static/{cfyYtf1Sz25gcv6tfZqFF → VRVzMV9rhbwaTwXonUCzN}/_buildManifest.js +0 -0
- /package/.next-prod/static/{cfyYtf1Sz25gcv6tfZqFF → VRVzMV9rhbwaTwXonUCzN}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!DOCTYPE html><html lang="en" class="overflow-hidden"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/5c0c2bcbaa4149ca-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="preload" href="/_next/static/media/bb3ef058b751a6ad-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="preload" href="/_next/static/media/e4af272ccee01ff0-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/e33280be1b23649f.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/52b314bf20332f7c.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/
|
|
1
|
+
<!DOCTYPE html><html lang="en" class="overflow-hidden"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/5c0c2bcbaa4149ca-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="preload" href="/_next/static/media/bb3ef058b751a6ad-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="preload" href="/_next/static/media/e4af272ccee01ff0-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/e33280be1b23649f.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/52b314bf20332f7c.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/7ed891f30e531791.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-fb9d282647d95d0a.js"/><script src="/_next/static/chunks/4bd1b696-e356ca5ba0218e27.js" async=""></script><script src="/_next/static/chunks/3794-ba2500baa4c52d55.js" async=""></script><script src="/_next/static/chunks/main-app-b76c0df33a946918.js" async=""></script><script src="/_next/static/chunks/app/global-error-3c48d7d42c672863.js" async=""></script><script src="/_next/static/chunks/d3ac728e-ee038320ef1e4bdf.js" async=""></script><script src="/_next/static/chunks/96c8525a-f1e0653013503d49.js" async=""></script><script src="/_next/static/chunks/bc21e3dd-a78364524623b9b0.js" async=""></script><script src="/_next/static/chunks/e868780c-39804e9ab925f132.js" async=""></script><script src="/_next/static/chunks/70e0d97a-bbb0ec05083da54f.js" async=""></script><script src="/_next/static/chunks/54a60aa6-9f9f856e5049cd65.js" async=""></script><script src="/_next/static/chunks/1332-5e141e2acf28015a.js" async=""></script><script src="/_next/static/chunks/2502-fb8682bc7a61e04d.js" async=""></script><script src="/_next/static/chunks/6787-866a3046a4a0fa50.js" async=""></script><script src="/_next/static/chunks/6784-11888818d8e3114e.js" async=""></script><script src="/_next/static/chunks/217-1bf54355c7c0c898.js" async=""></script><script src="/_next/static/chunks/2032-6fcfaaa6aa730f6d.js" async=""></script><script src="/_next/static/chunks/3283-80d4d836a00d7bb4.js" async=""></script><script src="/_next/static/chunks/app/page-e63d872a9af204ae.js" async=""></script><title>404: This page could not be found.</title><meta name="robots" content="noindex"/><meta name="next-size-adjust" content=""/><meta name="theme-color" content="#f9f9fb" media="(prefers-color-scheme: light)"/><meta name="theme-color" content="#111113" media="(prefers-color-scheme: dark)"/><title>OpenCockpit</title><meta name="description" content="OpenCockpit 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."/><link rel="manifest" href="/manifest.webmanifest"/><meta name="mobile-web-app-capable" content="yes"/><meta name="apple-mobile-web-app-title" content="Cockpit"/><meta name="apple-mobile-web-app-status-bar-style" content="default"/><link rel="icon" href="/favicon.ico?603d046c9a6fdfbb" type="image/x-icon" sizes="16x16"/><link rel="icon" href="/icons/icon-192x192.png"/><link rel="apple-touch-icon" href="/icons/icon-192x192.png"/><script>// Runs before React hydrates (see app/layout.tsx <Script strategy="beforeInteractive">).
|
|
2
2
|
// Three jobs:
|
|
3
3
|
// 1. Redirect narrow viewports to the mobile route /m (before first paint).
|
|
4
4
|
// 2. Apply the persisted theme class to <html> before first paint to avoid FOUC.
|
|
@@ -54,4 +54,4 @@
|
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
56
|
})();
|
|
57
|
-
</script><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body class="__variable_f367f3 __variable_c1a059 __variable_3c557b antialiased overflow-hidden"><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><div class="fixed top-4 left-1/2 -translate-x-1/2 z-[100] flex flex-col items-center gap-2"></div><script src="/_next/static/chunks/webpack-2c71a79c277961bc.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n8:I[26719,[\"4219\",\"static/chunks/app/global-error-3c48d7d42c672863.js\"],\"default\"]\n:HL[\"/_next/static/media/5c0c2bcbaa4149ca-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/media/bb3ef058b751a6ad-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/media/e4af272ccee01ff0-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/css/e33280be1b23649f.css\",\"style\"]\n:HL[\"/_next/static/css/52b314bf20332f7c.css\",\"style\"]\n:HL[\"/_next/static/css/44a979b47b165c63.css\",\"style\"]\n2:Ta46,"])</script><script>self.__next_f.push([1,"// Runs before React hydrates (see app/layout.tsx \u003cScript strategy=\"beforeInteractive\"\u003e).\n// Three jobs:\n// 1. Redirect narrow viewports to the mobile route /m (before first paint).\n// 2. Apply the persisted theme class to \u003chtml\u003e before first paint to avoid FOUC.\n// 3. Unregister any leftover Service Workers from the PWA era (PWA has been removed).\n(function () {\n // Mobile redirect — runs first and bails out the rest on redirect.\n // Signal is VIEWPORT WIDTH (not User-Agent): it's what actually decides whether the\n // desktop 3-panel layout fits. Runs synchronously in \u003chead\u003e before the body paints,\n // so the desktop UI never flashes. Escape hatch: the /m \"use desktop\" action sets\n // `cockpit-force-desktop` in localStorage, which suppresses the redirect thereafter.\n try {\n var path = window.location.pathname;\n var onMobileRoute = path === '/m' || path.indexOf('/m/') === 0;\n var forceDesktop = false;\n try { forceDesktop = !!localStorage.getItem('cockpit-force-desktop'); } catch (_e) {}\n // Never redirect inside an iframe: the desktop shell embeds /project in a\n // frame that is 42px (sidebar) narrower than the window, so a tablet-width\n // top page (e.g. 768px iPad) would otherwise nest the mobile UI inside the\n // desktop shell — and drop the sessionId in the process. The media query is\n // only meaningful for the top-level viewport.\n var isTopWindow = true;\n try { isTopWindow = window.self === window.top; } catch (_e) {}\n if (\n isTopWindow \u0026\u0026\n !onMobileRoute \u0026\u0026\n !forceDesktop \u0026\u0026\n window.matchMedia \u0026\u0026\n window.matchMedia('(max-width: 767px)').matches\n ) {\n window.location.replace('/m' + window.location.search);\n return; // stop further boot work; the page is navigating away\n }\n } catch (_e) {}\n\n try {\n var theme = localStorage.getItem('theme') || 'dark';\n var resolved = theme;\n if (theme === 'system') {\n resolved = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n document.documentElement.classList.add(resolved);\n } catch (e) {}\n\n // Clean up legacy Service Workers from the old PWA era, but KEEP our\n // push-only SW (/push-sw.js) — it powers Web Push notifications and does no\n // caching, so it doesn't reintroduce the offline behavior we removed.\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.getRegistrations().then(function (regs) {\n regs.forEach(function (r) {\n var url = (r.active \u0026\u0026 r.active.scriptURL) || '';\n if (url.indexOf('/push-sw.js') === -1) r.unregister();\n });\n });\n }\n})();\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",16],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/e33280be1b23649f.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/52b314bf20332f7c.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"link\",\"2\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/44a979b47b165c63.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"className\":\"overflow-hidden\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"$2\"}}]}],[\"$\",\"body\",null,{\"className\":\"__variable_f367f3 __variable_c1a059 __variable_3c557b antialiased overflow-hidden\",\"children\":\"$L3\"}]]}]]}],{\"children\":[\"$L4\",{\"children\":[\"$L5\",{},null,false,null]},null,false,\"$@6\"]},null,false,null],\"$L7\",false]],\"m\":\"$undefined\",\"G\":[\"$8\",[]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"cfyYtf1Sz25gcv6tfZqFF\"}\n"])</script><script>self.__next_f.push([1,"9:I[84310,[\"7330\",\"static/chunks/d3ac728e-ee038320ef1e4bdf.js\",\"8216\",\"static/chunks/96c8525a-f1e0653013503d49.js\",\"4281\",\"static/chunks/bc21e3dd-a78364524623b9b0.js\",\"3888\",\"static/chunks/e868780c-39804e9ab925f132.js\",\"5004\",\"static/chunks/70e0d97a-bbb0ec05083da54f.js\",\"277\",\"static/chunks/54a60aa6-9f9f856e5049cd65.js\",\"1332\",\"static/chunks/1332-5e141e2acf28015a.js\",\"2502\",\"static/chunks/2502-fb8682bc7a61e04d.js\",\"9428\",\"static/chunks/9428-ffc16bc24c6e0da1.js\",\"6784\",\"static/chunks/6784-8a99d051f03bb100.js\",\"217\",\"static/chunks/217-656e1fdbc820d9dd.js\",\"2032\",\"static/chunks/2032-6fcfaaa6aa730f6d.js\",\"2576\",\"static/chunks/2576-47a83a4d8066d196.js\",\"8974\",\"static/chunks/app/page-8f349cc054af0d5b.js\"],\"Providers\"]\na:I[57121,[],\"\"]\nb:I[74581,[],\"\"]\nc:I[90484,[],\"OutletBoundary\"]\nd:\"$Sreact.suspense\"\n10:I[90484,[],\"ViewportBoundary\"]\n12:I[90484,[],\"MetadataBoundary\"]\n3:[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$La\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lb\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]\n4:[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$La\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lb\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}]\n5:[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$Lc\",null,{\"children\":[\"$\",\"$d\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@e\"}]}]]}]\nf:[]\n6:\"$Wf\"\n7:[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$L10\",null,{\"children\":\"$L11\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L12\",null,{\"children\":[\"$\",\"$d\",null,{\"name\":\"Next.Metadata\",\"children\":\"$L13\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}]\n"])</script><script>self.__next_f.push([1,"11:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"2\",{\"name\":\"theme-color\",\"content\":\"#f9f9fb\",\"media\":\"(prefers-color-scheme: light)\"}],[\"$\",\"meta\",\"3\",{\"name\":\"theme-color\",\"content\":\"#111113\",\"media\":\"(prefers-color-scheme: dark)\"}]]\n"])</script><script>self.__next_f.push([1,"14:I[86869,[],\"IconMark\"]\ne:null\n13:[[\"$\",\"title\",\"0\",{\"children\":\"OpenCockpit\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"OpenCockpit 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.\"}],[\"$\",\"link\",\"2\",{\"rel\":\"manifest\",\"href\":\"/manifest.webmanifest\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"meta\",\"3\",{\"name\":\"mobile-web-app-capable\",\"content\":\"yes\"}],[\"$\",\"meta\",\"4\",{\"name\":\"apple-mobile-web-app-title\",\"content\":\"Cockpit\"}],[\"$\",\"meta\",\"5\",{\"name\":\"apple-mobile-web-app-status-bar-style\",\"content\":\"default\"}],[\"$\",\"link\",\"6\",{\"rel\":\"icon\",\"href\":\"/favicon.ico?603d046c9a6fdfbb\",\"type\":\"image/x-icon\",\"sizes\":\"16x16\"}],[\"$\",\"link\",\"7\",{\"rel\":\"icon\",\"href\":\"/icons/icon-192x192.png\"}],[\"$\",\"link\",\"8\",{\"rel\":\"apple-touch-icon\",\"href\":\"/icons/icon-192x192.png\"}],[\"$\",\"$L14\",\"9\",{}]]\n"])</script></body></html>
|
|
57
|
+
</script><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body class="__variable_f367f3 __variable_c1a059 __variable_3c557b antialiased overflow-hidden"><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><div class="fixed top-4 left-1/2 -translate-x-1/2 z-[100] flex flex-col items-center gap-2"></div><script src="/_next/static/chunks/webpack-fb9d282647d95d0a.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n8:I[26719,[\"4219\",\"static/chunks/app/global-error-3c48d7d42c672863.js\"],\"default\"]\n:HL[\"/_next/static/media/5c0c2bcbaa4149ca-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/media/bb3ef058b751a6ad-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/media/e4af272ccee01ff0-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n:HL[\"/_next/static/css/e33280be1b23649f.css\",\"style\"]\n:HL[\"/_next/static/css/52b314bf20332f7c.css\",\"style\"]\n:HL[\"/_next/static/css/7ed891f30e531791.css\",\"style\"]\n2:Ta46,"])</script><script>self.__next_f.push([1,"// Runs before React hydrates (see app/layout.tsx \u003cScript strategy=\"beforeInteractive\"\u003e).\n// Three jobs:\n// 1. Redirect narrow viewports to the mobile route /m (before first paint).\n// 2. Apply the persisted theme class to \u003chtml\u003e before first paint to avoid FOUC.\n// 3. Unregister any leftover Service Workers from the PWA era (PWA has been removed).\n(function () {\n // Mobile redirect — runs first and bails out the rest on redirect.\n // Signal is VIEWPORT WIDTH (not User-Agent): it's what actually decides whether the\n // desktop 3-panel layout fits. Runs synchronously in \u003chead\u003e before the body paints,\n // so the desktop UI never flashes. Escape hatch: the /m \"use desktop\" action sets\n // `cockpit-force-desktop` in localStorage, which suppresses the redirect thereafter.\n try {\n var path = window.location.pathname;\n var onMobileRoute = path === '/m' || path.indexOf('/m/') === 0;\n var forceDesktop = false;\n try { forceDesktop = !!localStorage.getItem('cockpit-force-desktop'); } catch (_e) {}\n // Never redirect inside an iframe: the desktop shell embeds /project in a\n // frame that is 42px (sidebar) narrower than the window, so a tablet-width\n // top page (e.g. 768px iPad) would otherwise nest the mobile UI inside the\n // desktop shell — and drop the sessionId in the process. The media query is\n // only meaningful for the top-level viewport.\n var isTopWindow = true;\n try { isTopWindow = window.self === window.top; } catch (_e) {}\n if (\n isTopWindow \u0026\u0026\n !onMobileRoute \u0026\u0026\n !forceDesktop \u0026\u0026\n window.matchMedia \u0026\u0026\n window.matchMedia('(max-width: 767px)').matches\n ) {\n window.location.replace('/m' + window.location.search);\n return; // stop further boot work; the page is navigating away\n }\n } catch (_e) {}\n\n try {\n var theme = localStorage.getItem('theme') || 'dark';\n var resolved = theme;\n if (theme === 'system') {\n resolved = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n }\n document.documentElement.classList.add(resolved);\n } catch (e) {}\n\n // Clean up legacy Service Workers from the old PWA era, but KEEP our\n // push-only SW (/push-sw.js) — it powers Web Push notifications and does no\n // caching, so it doesn't reintroduce the offline behavior we removed.\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.getRegistrations().then(function (regs) {\n regs.forEach(function (r) {\n var url = (r.active \u0026\u0026 r.active.scriptURL) || '';\n if (url.indexOf('/push-sw.js') === -1) r.unregister();\n });\n });\n }\n})();\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",16],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/e33280be1b23649f.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/52b314bf20332f7c.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"link\",\"2\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/7ed891f30e531791.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"className\":\"overflow-hidden\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"$2\"}}]}],[\"$\",\"body\",null,{\"className\":\"__variable_f367f3 __variable_c1a059 __variable_3c557b antialiased overflow-hidden\",\"children\":\"$L3\"}]]}]]}],{\"children\":[\"$L4\",{\"children\":[\"$L5\",{},null,false,null]},null,false,\"$@6\"]},null,false,null],\"$L7\",false]],\"m\":\"$undefined\",\"G\":[\"$8\",[]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"VRVzMV9rhbwaTwXonUCzN\"}\n"])</script><script>self.__next_f.push([1,"9:I[84310,[\"7330\",\"static/chunks/d3ac728e-ee038320ef1e4bdf.js\",\"8216\",\"static/chunks/96c8525a-f1e0653013503d49.js\",\"4281\",\"static/chunks/bc21e3dd-a78364524623b9b0.js\",\"3888\",\"static/chunks/e868780c-39804e9ab925f132.js\",\"5004\",\"static/chunks/70e0d97a-bbb0ec05083da54f.js\",\"277\",\"static/chunks/54a60aa6-9f9f856e5049cd65.js\",\"1332\",\"static/chunks/1332-5e141e2acf28015a.js\",\"2502\",\"static/chunks/2502-fb8682bc7a61e04d.js\",\"6787\",\"static/chunks/6787-866a3046a4a0fa50.js\",\"6784\",\"static/chunks/6784-11888818d8e3114e.js\",\"217\",\"static/chunks/217-1bf54355c7c0c898.js\",\"2032\",\"static/chunks/2032-6fcfaaa6aa730f6d.js\",\"3283\",\"static/chunks/3283-80d4d836a00d7bb4.js\",\"8974\",\"static/chunks/app/page-e63d872a9af204ae.js\"],\"Providers\"]\na:I[57121,[],\"\"]\nb:I[74581,[],\"\"]\nc:I[90484,[],\"OutletBoundary\"]\nd:\"$Sreact.suspense\"\n10:I[90484,[],\"ViewportBoundary\"]\n12:I[90484,[],\"MetadataBoundary\"]\n3:[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$La\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lb\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]\n4:[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$La\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$Lb\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}]\n5:[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$Lc\",null,{\"children\":[\"$\",\"$d\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@e\"}]}]]}]\nf:[]\n6:\"$Wf\"\n7:[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$L10\",null,{\"children\":\"$L11\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L12\",null,{\"children\":[\"$\",\"$d\",null,{\"name\":\"Next.Metadata\",\"children\":\"$L13\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}]\n"])</script><script>self.__next_f.push([1,"11:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"2\",{\"name\":\"theme-color\",\"content\":\"#f9f9fb\",\"media\":\"(prefers-color-scheme: light)\"}],[\"$\",\"meta\",\"3\",{\"name\":\"theme-color\",\"content\":\"#111113\",\"media\":\"(prefers-color-scheme: dark)\"}]]\n"])</script><script>self.__next_f.push([1,"14:I[86869,[],\"IconMark\"]\ne:null\n13:[[\"$\",\"title\",\"0\",{\"children\":\"OpenCockpit\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"OpenCockpit 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.\"}],[\"$\",\"link\",\"2\",{\"rel\":\"manifest\",\"href\":\"/manifest.webmanifest\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"meta\",\"3\",{\"name\":\"mobile-web-app-capable\",\"content\":\"yes\"}],[\"$\",\"meta\",\"4\",{\"name\":\"apple-mobile-web-app-title\",\"content\":\"Cockpit\"}],[\"$\",\"meta\",\"5\",{\"name\":\"apple-mobile-web-app-status-bar-style\",\"content\":\"default\"}],[\"$\",\"link\",\"6\",{\"rel\":\"icon\",\"href\":\"/favicon.ico?603d046c9a6fdfbb\",\"type\":\"image/x-icon\",\"sizes\":\"16x16\"}],[\"$\",\"link\",\"7\",{\"rel\":\"icon\",\"href\":\"/icons/icon-192x192.png\"}],[\"$\",\"link\",\"8\",{\"rel\":\"apple-touch-icon\",\"href\":\"/icons/icon-192x192.png\"}],[\"$\",\"$L14\",\"9\",{}]]\n"])</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-
|
|
1
|
+
<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-fb9d282647d95d0a.js"/><script src="/_next/static/chunks/4bd1b696-e356ca5ba0218e27.js" async=""></script><script src="/_next/static/chunks/3794-ba2500baa4c52d55.js" async=""></script><script src="/_next/static/chunks/main-app-b76c0df33a946918.js" async=""></script><script src="/_next/static/chunks/app/global-error-3c48d7d42c672863.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: This page couldn’t load</title><style>:root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }</style><script src="/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;display:flex;align-items:center;justify-content:center"><div style="margin-top:-32px;max-width:325px;padding:32px 28px;text-align:left"><svg width="32" height="32" viewBox="-0.2 -1.5 32 32" fill="none" style="margin-bottom:24px"><path d="M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z" fill="var(--next-error-title)"></path></svg><h1 style="font-size:24px;font-weight:500;letter-spacing:-0.02em;line-height:32px;margin:0 0 12px 0;color:var(--next-error-title)">This page couldn’t load</h1><p style="font-size:14px;font-weight:400;line-height:21px;margin:0 0 20px 0;color:var(--next-error-message)">A server error occurred. Reload to try again.</p><form style="margin:0"><button type="submit" style="display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;font-size:14px;font-weight:500;line-height:20px;border-radius:6px;cursor:pointer;color:var(--next-error-btn-text);background:var(--next-error-btn-bg);border:var(--next-error-btn-border)">Reload</button></form></div></div><!--$--><!--/$--><script src="/_next/static/chunks/webpack-fb9d282647d95d0a.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[57121,[],\"\"]\n3:I[74581,[],\"\"]\n4:I[90484,[],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n8:I[90484,[],\"ViewportBoundary\"]\na:I[90484,[],\"MetadataBoundary\"]\nc:I[26719,[\"4219\",\"static/chunks/app/global-error-3c48d7d42c672863.js\"],\"default\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"_global-error\",{\"children\":[\"__PAGE__\",{}]}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"title\",null,{\"children\":\"500: This page couldn’t load\"}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\"}}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"marginTop\":\"-32px\",\"maxWidth\":\"325px\",\"padding\":\"32px 28px\",\"textAlign\":\"left\"},\"children\":[[\"$\",\"svg\",null,{\"width\":\"32\",\"height\":\"32\",\"viewBox\":\"-0.2 -1.5 32 32\",\"fill\":\"none\",\"style\":{\"marginBottom\":\"24px\"},\"children\":[\"$\",\"path\",null,{\"d\":\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\",\"fill\":\"var(--next-error-title)\"}]}],[\"$\",\"h1\",null,{\"style\":{\"fontSize\":\"24px\",\"fontWeight\":500,\"letterSpacing\":\"-0.02em\",\"lineHeight\":\"32px\",\"margin\":\"0 0 12px 0\",\"color\":\"var(--next-error-title)\"},\"children\":\"This page couldn’t load\"}],[\"$\",\"p\",null,{\"style\":{\"fontSize\":\"14px\",\"fontWeight\":400,\"lineHeight\":\"21px\",\"margin\":\"0 0 20px 0\",\"color\":\"var(--next-error-message)\"},\"children\":\"A server error occurred. Reload to try again.\"}],[\"$\",\"form\",null,{\"style\":{\"margin\":0},\"children\":[\"$\",\"button\",null,{\"type\":\"submit\",\"style\":{\"display\":\"inline-flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"height\":\"32px\",\"padding\":\"0 12px\",\"fontSize\":\"14px\",\"fontWeight\":500,\"lineHeight\":\"20px\",\"borderRadius\":\"6px\",\"cursor\":\"pointer\",\"color\":\"var(--next-error-btn-text)\",\"background\":\"var(--next-error-btn-bg)\",\"border\":\"var(--next-error-btn-border)\"},\"children\":\"Reload\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,null]},null,false,\"$@7\"]},null,false,\"$@7\"],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lb\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",[]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"VRVzMV9rhbwaTwXonUCzN\"}\n"])</script><script>self.__next_f.push([1,"d:[]\n7:\"$Wd\"\n"])</script><script>self.__next_f.push([1,"9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"6:null\nb:[]\n"])</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"node":{},"edge":{},"encryptionKey":"
|
|
1
|
+
{"node":{},"edge":{},"encryptionKey":"fiwY69tbkjJkdzoNzGA+Pvn2faUL2yf0SDpb5j91eBY="}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
`:"")+(e.output_file?`<output-file>${e.output_file}</output-file>
|
|
6
6
|
`:"")+"</task-notification>",a=`auto-tasknotif-${s||++W.current}`;t(e=>[...e,{id:a,role:"system",content:r,systemEvent:{kind:"task-notification",...n?{status:n}:{},detail:l},runKey:$.current?.runKey}])}return}if("system"===r&&"api_retry"===e.subtype)return void S({attempt:e.attempt??0,maxRetries:e.max_retries??0,delayMs:e.retry_delay_ms??0,errorStatus:e.error_status,error:e.error});if("rate_limit_event"===r){let t=e.rate_limit_info;t&&C({status:t.status||"allowed",resetsAt:t.resetsAt,rateLimitType:t.rateLimitType,utilization:t.utilization,overageStatus:t.overageStatus,overageDisabledReason:t.overageDisabledReason,isUsingOverage:t.isUsingOverage,surpassedThreshold:t.surpassedThreshold});return}if("error"===r){let r=e.error||l.A.t("chat.errorRetry",{defaultValue:"An error occurred. Please try again."});S(null),D.current&&(clearTimeout(D.current),D.current=null),H(),t(e=>e.map(e=>e.id===n?{...e,content:e.content?`${e.content}
|
|
7
7
|
|
|
8
|
-
⚠️ ${r}`:`⚠️ ${r}`,isStreaming:!1}:e));return}if("stream_event"===r){S(e=>e?null:e),L(e=>e?null:e);let t=e.event;if(t?.type==="content_block_delta"&&t.delta?.type==="text_delta"){let e=t.delta.text||"";F.current&&F.current.messageId===n?F.current.text+=e:F.current={messageId:n,text:e},D.current||(D.current=setTimeout(H,50))}return}if("assistant"===r&&t(t=>(0,s.F)(t,e,{engine:u,assistantId:n})),"user"===r&&t(t=>(0,s.F)(t,e,{engine:u,assistantId:n})),"result"===r){B.current=!1,V.current=!0,S(null),D.current&&(clearTimeout(D.current),D.current=null),H();let r=A.current;r&&c&&t(e=>(2===e.length&&p(r),e));let l=e.usage,a=e.total_cost_usd;l&&k({inputTokens:l.input_tokens||0,outputTokens:l.output_tokens||0,cacheCreationInputTokens:l.cache_creation_input_tokens||0,cacheReadInputTokens:l.cache_read_input_tokens||0,totalCostUsd:a||0}),t(t=>(0,s.F)(t,e,{engine:u,assistantId:n}))}},[t,H,x,p,c,u,g]);return(0,a.h)({url:R?`/ws/session-stream?sessionId=${encodeURIComponent(R.runKey)}`:"/ws/session-stream",enabled:!!R,onMessage:e=>{P.current=!0,_.current&&(clearTimeout(_.current),_.current=null);let n=$.current;if(n)if("run-snapshot"===e.type&&Array.isArray(e.events)){for(let r of(D.current&&(clearTimeout(D.current),D.current=null),F.current=null,O.current=n.assistantId,V.current=!1,B.current=!1,t(e=>e.filter(e=>!("string"==typeof e.id&&e.id.startsWith("auto-")&&e.runKey===n.runKey)).map(e=>e.id===n.assistantId?{...e,content:"",toolCalls:[]}:e)),e.events))U(r,O.current??n.assistantId);e.status&&"running"!==e.status&&z()}else if("run-event"===e.type&&e.message){if("run-ended"===e.message.type)return void z();U(e.message,O.current??n.assistantId)}else"run-idle"===e.type&&z()}}),{isLoading:v,tokenUsage:w,rateLimitInfo:j,apiRetryInfo:N,ptyNotice:E,handleSend:(0,r.useCallback)(async(e,n,r)=>{let s=r&&"permissionMode"in r?"plan"===r.permissionMode:m,a=n?.map(e=>({type:"base64",media_type:e.media_type,data:e.data})),i={id:`user-${Date.now()}`,role:"user",content:e,images:a};t(e=>[...e,i]),y(!0),S(null),L(null);let x=`assistant-${Date.now()}`,p={id:x,role:"assistant",content:"",toolCalls:[],isStreaming:!0};t(e=>[...e,p]),O.current=x,V.current=!1,B.current=!1;let g=!u||"claude"===u||"claude2"===u,b="pty"===d&&g,v=function(){try{return crypto.randomUUID()}catch{return`run-${Date.now()}-${Math.floor(1e9*Math.random())}`}}();try{if("ollama"===u&&!f)throw Error("Please select an Ollama model first (click the model picker above)");let n="codex"===u?"/api/chat/codex":"kimi"===u?"/api/chat/kimi":"ollama"===u?"/api/chat/ollama":"deepseek"===u?"/api/chat/deepseek":"/api/chat",r=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e,sessionId:A.current,runId:v,images:a,cwd:c,language:l.A.language,..."ollama"===u&&f&&{model:f},..."deepseek"===u&&h&&{model:h},..."claude2"===u&&{engine:"claude2"},...b&&{mode:"pty",ptyCols:o.EE,ptyRows:o.K2},...s&&!b&&g&&{permissionMode:"plan"}})});if(400===r.status&&"deepseek"===u){let e=await r.json().catch(()=>null);throw Error(e?.error||"DeepSeek request failed")}if(!r.ok)throw Error(l.A.t("chat.requestFailed",{defaultValue:"Request failed"}));let i=await r.json().catch(()=>({}));T({runKey:i.runKey||v,assistantId:x}),P.current=!1,_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{$.current&&!P.current&&(t(e=>e.map(e=>e.id!==x||e.content?e:{...e,content:l.A.t("chat.errorRetry",{defaultValue:"An error occurred. Please try again."})})),z())},15e3)}catch(n){console.error("Chat error:",n);let e=n instanceof Error?n.message:l.A.t("chat.errorRetry",{defaultValue:"An error occurred. Please try again."});t(t=>t.map(t=>t.id===x?{...t,content:e,isStreaming:!1}:t)),y(!1),T(null)}},[c,u,d,m,f,h,t,z]),handleStop:K,abortControllerRef:M}}},22576:(e,t,n)=>{n.d(t,{X:()=>r});function r(e,t){let n=e.split("\n"),r=t.split("\n"),s=[],l=n.length,a=r.length,o=Array(l+1).fill(null).map(()=>Array(a+1).fill(0));for(let e=1;e<=l;e++)for(let t=1;t<=a;t++)n[e-1]===r[t-1]?o[e][t]=o[e-1][t-1]+1:o[e][t]=Math.max(o[e-1][t],o[e][t-1]);let i=l,c=a,u=[];for(;i>0||c>0;)i>0&&c>0&&n[i-1]===r[c-1]?(u.push({type:"unchanged",content:n[i-1],oldLineNum:i,newLineNum:c}),i--,c--):c>0&&(0===i||o[i][c-1]>=o[i-1][c])?(u.push({type:"added",content:r[c-1],newLineNum:c}),c--):(u.push({type:"removed",content:n[i-1],oldLineNum:i}),i--);for(;u.length>0;)s.push(u.pop());return s}},27570:(e,t,n)=>{n.d(t,{L:()=>s});var r=n(12115);function s({enabled:e,container:t,resolveLineRange:n,buildLineSnapshot:l,dragThresholdPx:a=5}){let o=(0,r.useRef)(null),i=(0,r.useRef)(()=>{}),c=(0,r.useRef)(n),u=(0,r.useRef)(l),d=(0,r.useRef)(a);return c.current=n,u.current=l,d.current=a,(0,r.useEffect)(()=>{if(!e||!t)return;let n=!1,r=0,s=0,l=()=>{o.current&&(o.current=null,i.current())},a=e=>{n=!0,r=e.clientX,s=e.clientY;let t=e.target;t?.closest?.(".floating-toolbar")||l()},m=e=>{n=!1;let a=e.target;if(a?.closest?.(".floating-toolbar"))return;let m=d.current,f=Math.abs(e.clientX-r)>m||Math.abs(e.clientY-s)>m,h=window.getSelection();if(!h||h.isCollapsed||!h.toString().trim()||!f)return void l();let x=h.getRangeAt(0);if(!t.contains(x.commonAncestorContainer))return void l();let p=c.current(x.startContainer),g=c.current(x.endContainer);if(!p||!g)return void l();let b=Math.min(p.start,g.start),v=Math.max(p.end,g.end),y=h.toString(),w=u.current({start:b,end:v});o.current={x:e.clientX,y:e.clientY,range:{start:b,end:v},selectedText:y,lineSnapshot:w},i.current()},f=()=>{if(n||!o.current)return;let e=window.getSelection();e&&!e.isCollapsed&&e.toString().trim()||l()};return t.addEventListener("mousedown",a),document.addEventListener("mouseup",m),document.addEventListener("selectionchange",f),()=>{t.removeEventListener("mousedown",a),document.removeEventListener("mouseup",m),document.removeEventListener("selectionchange",f)}},[e,t]),{toolbarRef:o,bumpRef:i,clearToolbar:()=>{o.current&&(o.current=null,i.current())}}}},37614:(e,t,n)=>{n.d(t,{t:()=>a});var r=n(95155),s=n(12115),l=n(79114);function a({x:e,y:t,comment:n,container:o,onClose:i,onUpdateComment:c,onDeleteComment:u}){let{t:d}=(0,l.Bd)(),[m,f]=(0,s.useState)(!1),[h,x]=(0,s.useState)(n.content),p=(0,s.useRef)(null),[g,b]=(0,s.useState)({x:0,y:0});(0,s.useEffect)(()=>{if(p.current&&o){let n=o.getBoundingClientRect(),r=p.current.getBoundingClientRect(),s=e-n.left,l=t-n.top;s+r.width>n.width-16&&(s=n.width-r.width-16),s<16&&(s=16),l+r.height>n.height-16&&(l=l-r.height-8),l<16&&(l=16),queueMicrotask(()=>b({x:s,y:l}))}},[e,t,o]),(0,s.useEffect)(()=>{let e=e=>{p.current&&!p.current.contains(e.target)&&i()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);let v=async()=>{h.trim()&&(await c(n.id,h.trim()),f(!1))},y=async()=>{await u(n.id),i()};return(0,r.jsx)("div",{ref:p,className:"absolute z-[200] w-96 bg-card border border-border rounded-lg shadow-lg overflow-hidden",style:{left:g.x,top:g.y},children:(0,r.jsx)("div",{className:"p-3",children:m?(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("textarea",{value:h,onChange:e=>x(e.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:e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),v()),"Escape"===e.key&&(f(!1),x(n.content))}}),(0,r.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,r.jsx)("button",{onClick:()=>{f(!1),x(n.content)},className:"px-2 py-1 text-xs text-muted-foreground hover:text-foreground",children:d("common.cancel")}),(0,r.jsx)("button",{onClick:v,className:"px-2 py-1 text-xs bg-brand text-white rounded hover:bg-brand/90",children:d("common.save")})]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:n.content}),(0,r.jsxs)("div",{className:"mt-2 flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:d("comments.lineRange",{start:n.startLine,end:n.endLine})}),(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)("button",{onClick:()=>f(!0),className:"p-1 rounded hover:bg-accent text-muted-foreground",title:d("common.edit"),children:(0,r.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.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,r.jsx)("button",{onClick:y,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-red-9",title:d("common.delete"),children:(0,r.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.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"})})})]})]})]})})})}},38175:(e,t,n)=>{n.d(t,{E:()=>s});var r=n(95155);function s({content:e,filePath:t}){return(0,r.jsx)("div",{className:"h-full w-full bg-white",children:(0,r.jsx)("iframe",{srcDoc:e,title:t,sandbox:"allow-scripts allow-same-origin",className:"h-full w-full border-0"},t)})}n(12115)},38408:(e,t,n)=>{n.d(t,{Cv:()=>P,XO:()=>_});var r=n(95155),s=n(12115),l=n(79114),a=n(47650),o=n(86957),i=n(60938),c=n(70188),u=n(7320),d=n(56978),m=n(17196),f=n(89109),h=n(37614),x=n(69809),p=n(64428);function g({blame:e,onClick:t}){let{t:n}=(0,l.Bd)(),a=(0,s.useRef)(null),o=(0,s.useRef)(null),i=(0,p.F2)(),c=(0,s.useRef)(!1),u=(0,s.useRef)(!1),d=(0,s.useRef)(null),m=(0,s.useRef)(null),f=(0,s.useRef)(null),h=(0,s.useRef)(e);(0,s.useEffect)(()=>{h.current=e},[e]);let b=(0,s.useRef)(t);(0,s.useEffect)(()=>{b.current=t},[t]);let v=(0,s.useCallback)(()=>{let e,t=o.current,n=a.current;if(!t||!n)return;let r=n.getBoundingClientRect(),s=t.getBoundingClientRect(),l=i?.getBoundingClientRect(),c=l?.left??0,u=l?.top??0,d=l?.width??window.innerWidth,m=l?.height??window.innerHeight,f=r.left-c;f+s.width>d-8&&(f=d-s.width-8),f<8&&(f=8);let h=r.top-u,x=r.bottom-u;(e=h-s.height-4<0?x+4:h-s.height-4)+s.height>m-8&&(e=m-s.height-8),t.style.left=`${f}px`,t.style.top=`${e}px`},[i]),y=(0,s.useCallback)(()=>{d.current&&(clearTimeout(d.current),d.current=null),m.current&&(clearTimeout(m.current),m.current=null),c.current=!1,u.current=!1,o.current&&(o.current.style.display="none"),f.current&&(document.removeEventListener("mousedown",f.current.down),document.removeEventListener("mouseup",f.current.up),f.current=null)},[]),w=(0,s.useCallback)(()=>{let e=o.current;if(!e||c.current)return;c.current=!0,e.style.left="-9999px",e.style.top="-9999px",e.style.display="block",requestAnimationFrame(()=>requestAnimationFrame(v));let t=0,n=0,r=e=>{t=e.clientX,n=e.clientY},s=e=>{if(!(Math.abs(e.clientX-t)>5||Math.abs(e.clientY-n)>5)){let t;t=e.target,o.current?.contains(t)||a.current?.contains(t)||y()}};document.addEventListener("mousedown",r),document.addEventListener("mouseup",s),f.current={down:r,up:s}},[v,y]),k=(0,s.useCallback)(()=>{if(d.current&&clearTimeout(d.current),m.current&&(clearTimeout(m.current),m.current=null),c.current)return;let e=window.getSelection();(!e||e.isCollapsed)&&(d.current=setTimeout(w,500))},[w]),j=(0,s.useCallback)(()=>{d.current&&(clearTimeout(d.current),d.current=null),c.current&&(m.current=setTimeout(()=>{u.current||y()},200))},[y]),C=(0,s.useCallback)(()=>{u.current=!0,m.current&&(clearTimeout(m.current),m.current=null)},[]),N=(0,s.useCallback)(()=>{u.current=!1,y()},[y]),S=(0,s.useCallback)(e=>{e.stopPropagation();let t=window.getSelection();t&&t.toString().length>0&&o.current?.contains(t.anchorNode)||(b.current?.(h.current),y())},[y]);(0,s.useEffect)(()=>()=>y(),[y]);let E=e.message.split("\n")[0]||"",L=e.message.split("\n").slice(1).join("\n").trim();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("span",{ref:a,className:"select-none text-xs text-muted-foreground/50 ml-6 cursor-default hover:text-muted-foreground/80",onMouseEnter:k,onMouseLeave:j,children:[e.author.split(" ")[0],", ",function(e){let t=x.A.t,n=Math.floor((Date.now()-1e3*e)/1e3);if(n<60)return t("common.justNow");let r=Math.floor(n/60);if(r<60)return t("common.minutesAgo",{count:r});let s=Math.floor(r/60);if(s<24)return t("common.hoursAgo",{count:s});let l=Math.floor(s/24);if(l<30)return t("common.daysAgo",{count:l});let a=Math.floor(l/30);return a<12?t("common.monthsAgo",{count:a}):t("common.yearsAgo",{count:Math.floor(a/12)})}(e.time)," \xb7 ",E]}),(0,r.jsx)(p.ZL,{children:(0,r.jsxs)("div",{ref:o,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:C,onMouseLeave:N,children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,r.jsx)("span",{className:"font-mono text-brand",children:e.hash}),(0,r.jsx)("span",{className:"text-muted-foreground",children:e.author}),(0,r.jsx)("span",{className:"text-muted-foreground/60",children:new Date(1e3*e.time).toLocaleString()})]}),(0,r.jsx)("div",{className:"font-medium",children:E}),L&&(0,r.jsx)("div",{className:"mt-1 text-muted-foreground",children:L}),(0,r.jsx)("div",{className:"mt-2 text-[11px] text-brand border-t border-border pt-2 cursor-pointer hover:underline",onClick:S,children:n("codeViewer.clickToViewDetails")})]})})]})}let b=[{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 v(e,t){let n,r=document.caretRangeFromPoint(e.clientX,e.clientY);if(!r||!t.contains(r.startContainer))return 1;let s=r.startContainer,l=r.startOffset,a=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),o=1;for(;n=a.nextNode();){if(n===s){o+=l;break}o+=n.textContent?.length||0}return o}let y=(0,s.memo)(function({virtualKey:e,lineNum:t,highlightedHtml:n,hasComments:a,firstComment:o,lineCommentsCount:i,isInRange:c,showLineNumbers:u,lineNumChars:d,commentsEnabled:m,virtualItemSize:f,virtualItemStart:h,onCommentBubbleClick:x,onCmdClick:p,onTokenHover:b,onTokenHoverLeave:y,flashLine:w,blameLine:k,showBlameInfo:j,blameAuthorColor:C,isBlameHovered:N,onBlameClick:S,onBlameMouseEnter:E,onBlameMouseLeave:L,inlineBlameData:M,onInlineBlameClick:R,isCursorLine:T,cursorCol:$}){let{t:I}=(0,l.Bd)(),P=(0,s.useMemo)(()=>T&&null!=$?function(e,t){let n=0,r=0;for(;r<e.length;){if("<"===e[r]){let t=e.indexOf(">",r);if(-1!==t){r=t+1;continue}}if(n===t){let t;if("&"===e[r]){let n=e.indexOf(";",r);t=-1!==n&&n-r<10?n+1:r+1}else t=r+1;let n=e.substring(r,t);return e.substring(0,r)+'<span class="vi-char-cursor">'+n+"</span>"+e.substring(t)}if("&"===e[r]){let t=e.indexOf(";",r);r=-1!==t&&t-r<10?t+1:r+1}else r++;n++}return e+'<span class="vi-char-cursor"> </span>'}(n,$):n,[n,T,$]),_=(0,s.useCallback)(e=>{if(!e.metaKey||!p)return;e.preventDefault(),e.stopPropagation();let n=e.currentTarget,r=v(e,n);window.getSelection()?.removeAllRanges(),p(t,r)},[t,p]),A=(0,s.useCallback)(e=>{if(!b||0!==e.buttons)return;let n=window.getSelection();if(n&&!n.isCollapsed)return;let r=e.target;if("SPAN"!==r.tagName||!r.style.color)return;let s=e.currentTarget,l=v(e,s),a=r.getBoundingClientRect();b(t,l,{x:a.left,y:a.bottom+4})},[t,b]),F=(0,s.useCallback)(()=>{k&&S&&S(k)},[k,S]),D=(0,s.useCallback)(e=>{k&&E&&E(k,e)},[k,E]);return(0,r.jsxs)("div",{"data-line":t,style:{position:"absolute",top:0,left:0,width:"100%",height:`${f}px`,transform:`translateY(${h}px)`,backgroundColor:N&&C?C.bg:void 0},className:`flex ${w===t?"flash-line":""} ${T?"vi-cursor-line":""} ${c?"bg-blue-9/20":a?"bg-amber-9/10":"hover:bg-accent/50"}`,children:[(0,r.jsxs)("div",{className:"flex shrink-0 sticky left-0 z-[2] bg-secondary",style:{backgroundColor:N&&C?C.bg:void 0},children:[k&&C&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-1 flex-shrink-0",style:{backgroundColor:C.border}}),(0,r.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:D,onMouseLeave:L,onClick:F,title:I("codeViewer.clickToViewCommit"),children:j?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"font-medium",style:{color:C.border},children:k.hash}),(0,r.jsx)("span",{className:"truncate flex-1",children:k.author.split(" ")[0]})]}):null})]}),u&&(0,r.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 ${c?"bg-blue-9/30 text-blue-11":"bg-card/50 text-slate-9"}`,children:[m&&a&&o&&(0,r.jsx)("button",{onClick:e=>x(o,e),className:"w-4 h-4 flex items-center justify-center rounded hover:bg-accent text-amber-9",title:I("codeViewer.nComments",{count:i}),children:(0,r.jsx)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:(0,r.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"})})}),m&&!a&&(0,r.jsx)("span",{className:"w-4"}),(0,r.jsx)("span",{className:"text-right",style:{minWidth:`${d}ch`},children:t})]})]}),(0,r.jsxs)("span",{className:"flex-1 px-3 whitespace-pre select-text",onClick:_,onMouseOver:A,onMouseLeave:y,"data-code-content":!0,children:[(0,r.jsx)("span",{dangerouslySetInnerHTML:{__html:P}}),M&&(0,r.jsx)(g,{blame:M,onClick:R})]})]},e)});var w=n(64702),k=n(1058),j=n(90717),C=n(48347),N=n(27570);function S(e,t,n){let r,s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),l=0;for(;(r=s.nextNode())&&r!==t;)l+=r.textContent.length;return l+n}function E(e,t){let n,r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),s=t,l=null;for(;n=r.nextNode();){l=n;let e=n.textContent.length;if(s<=e)return{node:n,offset:s};s-=e}return l?{node:l,offset:l.textContent.length}:null}var L=n(82292),M=n(34075);let R="white-space:pre;padding:0 12px;min-height:20px;line-height:20px";function T(e){let t=window.getSelection();if(!t?.rangeCount)return null;let n=t.getRangeAt(0),r=n.startContainer;for(;r&&r.parentElement!==e;)r=r.parentElement;if(!r)return null;let s=Array.from(e.children).indexOf(r);if(s<0)return null;let l=document.createRange();return l.selectNodeContents(r),l.setEnd(n.startContainer,n.startOffset),{line:s,offset:l.toString().length}}function $(e,t){let n,r=e.children[t.line];if(!r)return;let s=document.createTreeWalker(r,NodeFilter.SHOW_TEXT),l=t.offset;for(;n=s.nextNode();){let e=n.textContent?.length||0;if(l<=e){let e=window.getSelection(),t=document.createRange();t.setStart(n,l),t.collapse(!0),e?.removeAllRanges(),e?.addRange(t);return}l-=e}let a=window.getSelection(),o=document.createRange();o.selectNodeContents(r),o.collapse(!1),a?.removeAllRanges(),a?.addRange(o)}function I(e){return e.map(e=>`<div style="${R}">${e}</div>`).join("")}let P=(0,s.forwardRef)(function({content:e,filePath:t,showLineNumbers:n=!0,showSearch:x=!0,className:p="",cwd:g,enableComments:v=!1,scrollToLine:P=null,scrollToLineAlign:_="center",onScrollToLineComplete:A,highlightKeyword:F=null,visibleLineRef:D,onCmdClick:O,onTokenHover:V,onTokenHoverLeave:B,onTokenHoverCancel:W,blameLines:H,inlineBlameLines:z,onSelectCommit:K,editable:U=!1,initialMtime:q,onEditorClose:X,onSaved:Z,onEditorStateChange:J,viMode:Y=!1,onContentMutate:Q,onEnterInsertMode:G,onViSave:ee,viStateRef:et,initialCursorLine:en,initialCursorCol:er,onInitialCursorSet:es,onContentSearch:el},ea){let{t:eo}=(0,l.Bd)(),ei=(0,s.useRef)(e),ec=(0,s.useRef)(!1),[eu,ed]=(0,s.useState)(!1),[em,ef]=(0,s.useState)(!1),[eh,ex]=(0,s.useState)(()=>e.split("\n").length),ep=(0,s.useRef)(e.split("\n").length),[eg,eb]=(0,s.useState)({show:!1}),ev=(0,s.useRef)(null),ey=(0,s.useRef)(null),ew=(0,s.useRef)(q),ek=(0,s.useRef)(null),ej=(0,s.useRef)(!1),eC=(0,s.useRef)(!1),{parentRef:eN,containerRef:eS,searchInputRef:eE,floatingToolbarRef:eL,suppressHoverRef:eM,bumpToolbarRef:eR,savedSelectionRef:eT,highlightedLines:e$,isMounted:eI,cmdHeld:eP,flashLine:e_,isSearchVisible:eA,searchQuery:eF,caseSensitive:eD,wholeWord:eO,currentMatchIndex:eV,viewingComment:eB,addCommentInput:eW,sendToAIInput:eH,aiBridge:ez,commentsEnabled:eK,updateComment:eU,deleteComment:eq,lines:eX,matches:eZ,rowData:eJ,virtualizer:eY,commentsByEndLine:eQ,linesWithComments:eG,setIsSearchVisible:e0,setSearchQuery:e1,setCaseSensitive:e2,setWholeWord:e5,setViewingComment:e4,setAddCommentInput:e3,setSendToAIInput:e8,goToNextMatch:e6,goToPrevMatch:e9,handleSearchKeyDown:e7,handleCommentBubbleClick:te,handleToolbarAddComment:tt,handleToolbarSendToAI:tn,handleToolbarSearch:tr,handleCommentSubmit:ts,handleSendToAISubmit:tl,getHighlightedLineHtml:ta,suppressMatchScrollRef:to,inlineBlameLineRef:ti,inlineBlameVersion:tc}=function({content:e,filePath:t,showSearch:n=!0,cwd:r,enableComments:l=!1,scrollToLine:a=null,scrollToLineAlign:o="center",onScrollToLineComplete:i,visibleLineRef:c,onContentSearch:u}){let[f,h]=(0,s.useState)(!1),x=(0,s.useRef)(null),p=(0,s.useRef)(null),g=(0,s.useRef)(null),b=(0,C.r)();(0,s.useEffect)(()=>{h(!0)},[]);let[v,y]=(0,s.useState)(!1),[E,L]=(0,s.useState)(null),M=(0,s.useRef)(null),[R,T]=(0,s.useState)(!1),[$,I]=(0,s.useState)(""),[P,_]=(0,s.useState)(!1),[A,F]=(0,s.useState)(!1),[D,O]=(0,s.useState)(0),[V,B]=(0,s.useState)(0),W=(0,s.useRef)(!1),[H,z]=(0,s.useState)(null),K=(0,s.useRef)(!1),U=(0,s.useRef)(null),[q,X]=(0,s.useState)(null),[Z,J]=(0,s.useState)(null),Y=(0,s.useMemo)(()=>e.split("\n"),[e]),[Q,G]=(0,s.useState)(null);(0,s.useEffect)(()=>{x.current!==Q&&G(x.current)});let ee=l&&!!r,{toolbarRef:et,bumpRef:en,clearToolbar:er}=(0,N.L)({enabled:ee,container:Q,resolveLineRange:e=>{if(!document.contains(e))return null;let t=e.nodeType===Node.TEXT_NODE?e.parentElement:e,n=t?.closest("[data-line]");if(!n)return null;let r=parseInt(n.getAttribute("data-line")||"0",10);return!Number.isFinite(r)||r<=0?null:{start:r,end:r}},buildLineSnapshot:({start:e,end:t})=>Y.slice(e-1,t).join("\n")}),es=(0,s.useRef)(null),[el,ea]=(0,s.useState)(0),{comments:eo,addComment:ei,updateComment:ec,deleteComment:eu,refresh:ed}=(0,k._)({cwd:r||"",filePath:t}),em=(0,d.C)(Y,t),ef=(0,s.useMemo)(()=>{let e=new Map;for(let t of eo){let n=t.endLine;e.has(n)||e.set(n,[]),e.get(n).push(t)}return e},[eo]),eh=(0,s.useMemo)(()=>{let e=new Set;for(let t of eo)for(let n=t.startLine;n<=t.endLine;n++)e.add(n);return e},[eo]),ex=(0,s.useMemo)(()=>(0,m.Np)(Y,$,P,A),[Y,$,P,A]);(0,s.useEffect)(()=>{ex.length>0&&O(0)},[ex.length,$,P,A]);let ep=(0,s.useMemo)(()=>{let e=[];for(let t=0;t<Y.length;t++)e.push({type:"code",lineIndex:t});return e},[Y.length]),eg=(0,w.Te)({count:ep.length,getScrollElement:()=>x.current,estimateSize:()=>20,overscan:10});(0,s.useEffect)(()=>{if(!c)return;let e=x.current;if(!e)return;let t=()=>{if(!eg.range)return;let t=e.scrollTop;for(let e of eg.getVirtualItems())if(e.start>=t){let t=ep[e.index];t?.type==="code"&&(c.current=t.lineIndex+1);return}};return e.addEventListener("scroll",t,{passive:!0}),t(),()=>e.removeEventListener("scroll",t)},[c,ep]),(0,s.useEffect)(()=>{let e=e=>{"Meta"===e.key&&y(!0)},t=e=>{"Meta"===e.key&&y(!1)},n=()=>y(!1);return window.addEventListener("keydown",e),window.addEventListener("keyup",t),window.addEventListener("blur",n),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",t),window.removeEventListener("blur",n)}},[]),(0,s.useEffect)(()=>{if(!n)return;let e=e=>{(e.metaKey||e.ctrlKey)&&"f"===e.key&&(e.preventDefault(),T(!0),setTimeout(()=>g.current?.focus(),0)),"Escape"===e.key&&(R?(T(!1),I("")):Z?J(null):q?X(null):et.current?er():H&&z(null))},t=p.current;if(t)return t.addEventListener("keydown",e),()=>t.removeEventListener("keydown",e)},[n,R,Z,q,H]),(0,s.useEffect)(()=>{if(W.current){W.current=!1;return}if(ex.length>0&&D>=0&&D<ex.length){let e=ex[D],t=ep.findIndex(t=>"code"===t.type&&t.lineIndex===e.lineIndex);t>=0&&eg.scrollToIndex(t,{align:"center"})}},[D,ex,eg,ep,V]);let eb=(0,s.useCallback)(()=>{0!==ex.length&&(O(e=>(e+1)%ex.length),B(e=>e+1))},[ex.length]),ev=(0,s.useCallback)(()=>{0!==ex.length&&(O(e=>(e-1+ex.length)%ex.length),B(e=>e+1))},[ex.length]),ey=(0,s.useRef)(a);ey.current=a,(0,s.useEffect)(()=>{if(null!==ey.current&&ey.current>0&&ep.length>0){let e=ey.current,t=e-1,n=ep.findIndex(e=>"code"===e.type&&e.lineIndex===t);if(n>=0){let t=()=>{eg.scrollToIndex(n,{align:o}),"center"===o&&(M.current&&clearTimeout(M.current),L(e),M.current=setTimeout(()=>L(null),500)),i?.()};"start"===o?requestAnimationFrame(t):setTimeout(t,150)}}},[a,o,ep.length,eg,i]);let ew=(0,s.useCallback)(e=>{"Enter"===e.key&&(e.preventDefault(),e.shiftKey?ev():eb()),"Escape"===e.key&&(T(!1),I(""))},[eb,ev]),ek=(0,s.useCallback)((e,t)=>{ee&&(t.stopPropagation(),z({comment:e,x:t.clientX,y:t.clientY}),er(),X(null),J(null))},[ee,er]);(0,s.useEffect)(()=>{if(!ee)return;let e=x.current,t=!1,n=()=>{t=!0,U.current=null,K.current=!0},r=()=>{t=!1;let e=window.getSelection();if(!e||e.isCollapsed||!e.toString().trim()){K.current=!1;return}let n=e.getRangeAt(0),r=x.current;if(!r||!r.contains(n.commonAncestorContainer))return;let s=n.startContainer,l=n.endContainer,a=(s.nodeType===Node.TEXT_NODE?s.parentElement:s)?.closest("[data-line]"),o=(l.nodeType===Node.TEXT_NODE?l.parentElement:l)?.closest("[data-line]");if(!a||!o)return;let i=parseInt(a.getAttribute("data-line")||"0",10),c=parseInt(o.getAttribute("data-line")||"0",10);i&&c&&(K.current=!0,U.current={startLine:i,startOffset:S(a,n.startContainer,n.startOffset),endLine:c,endOffset:S(o,n.endContainer,n.endOffset)})},s=()=>{if(t)return;let e=window.getSelection();e&&!e.isCollapsed&&e.toString().trim()||(U.current=null,K.current=!1)};return e?.addEventListener("mousedown",n),document.addEventListener("mouseup",r),document.addEventListener("selectionchange",s),()=>{e?.removeEventListener("mousedown",n),document.removeEventListener("mouseup",r),document.removeEventListener("selectionchange",s)}},[ee]),(0,s.useEffect)(()=>{let e=x.current;if(!e)return;let t=t=>{let n,r;if(!e.contains(t.target)){if(t.target.closest?.("[data-inline-blame-tip]"))return;null!==es.current&&(es.current=null,ea(e=>e+1));return}let s=window.getSelection();if(s&&!s.isCollapsed&&s.toString().trim())return;let l=(n=t.target,(r=n.closest?.("[data-line]"))?parseInt(r.getAttribute("data-line")||"0",10):null);l!==es.current&&(es.current=l,requestAnimationFrame(()=>ea(e=>e+1)))};return document.addEventListener("mouseup",t),()=>document.removeEventListener("mouseup",t)},[]);let ej=(0,s.useCallback)(()=>{let e=et.current;e&&(X({x:e.x,y:e.y,range:e.range,selectedText:e.selectedText,lineSnapshot:e.lineSnapshot}),er())},[er,et]),eC=(0,s.useCallback)(()=>{let e=et.current;e&&(J({x:e.x,y:e.y,range:e.range,selectedText:e.selectedText,lineSnapshot:e.lineSnapshot}),er())},[er,et]),eN=(0,s.useCallback)(()=>{let e=et.current;if(!e||!u)return;let t=e.selectedText.trim();er(),t&&u(t)},[u,er,et]),eS=(0,s.useCallback)(async e=>{q&&(await ei(q.range.start,q.range.end,e,q.selectedText),X(null))},[q,ei]),eE=(0,s.useCallback)(async e=>{if(Z&&b&&r)try{let n=await (0,j.$3)(r),s=[];for(let e of n)s.push({filePath:e.filePath,startLine:e.startLine,endLine:e.endLine,codeContent:e.codeContent,note:e.content||void 0});s.push({filePath:t,startLine:Z.range.start,endLine:Z.range.end,codeContent:Z.lineSnapshot});let l=(0,j.Gw)(s,e);b.sendMessage(l),await (0,j.RP)(r),ed(),J(null)}catch(e){console.error("Failed to send to AI:",e)}},[Z,b,t,r,ed]),eL=(0,s.useCallback)((e,t,n)=>{let r=Y[e];if(!r)return t;let s=[];if($&&ex.length>0)for(let t of ex.filter(t=>t.lineIndex===e)){let n=ex[D]?.lineIndex===e&&ex[D]?.startCol===t.startCol;s.push({start:t.startCol,end:t.endCol,cls:n?"hl-cur":"hl-m"})}if(n&&!$&&n.length>=1){let e=n.toLowerCase(),t=r.toLowerCase(),l=0;for(;-1!==(l=t.indexOf(e,l));)s.push({start:l,end:l+n.length,cls:"hl-kw"}),l+=1}if(0===s.length)return t;s.sort((e,t)=>e.start-t.start||e.end-t.end);let l=[],a=0;for(let e of s){if(e.start<a)continue;e.start>a&&l.push((0,m.ZD)(r.substring(a,e.start)));let t=(0,m.ZD)(r.substring(e.start,e.end));l.push(`<span class="${e.cls}">${t}</span>`),a=e.end}if(a<r.length&&l.push((0,m.ZD)(r.substring(a))),t!==(0,m.ZD)(r)){let e=t;for(let t of s){let n=r.substring(t.start,t.end),s=(0,m.ZD)(n),l=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=RegExp(`(?<=>)([^<]*?)(${l})`,""),o=`$1<span class="${t.cls}">${s}</span>`,i=e.replace(a,o);i.length>e.length+200||(e=i)}return e}return l.join("")},[$,ex,D,Y]);return{parentRef:x,containerRef:p,searchInputRef:g,floatingToolbarRef:et,suppressHoverRef:K,savedSelectionRef:U,highlightedLines:em,isMounted:f,cmdHeld:v,flashLine:E,isSearchVisible:R,searchQuery:$,caseSensitive:P,wholeWord:A,currentMatchIndex:D,viewingComment:H,bumpToolbarRef:en,addCommentInput:q,sendToAIInput:Z,aiBridge:b,commentsEnabled:ee,comments:eo,updateComment:ec,deleteComment:eu,lines:Y,matches:ex,rowData:ep,virtualizer:eg,commentsByEndLine:ef,linesWithComments:eh,setIsSearchVisible:T,setSearchQuery:I,suppressMatchScrollRef:W,setCaseSensitive:_,setWholeWord:F,setViewingComment:z,setAddCommentInput:X,setSendToAIInput:J,goToNextMatch:eb,goToPrevMatch:ev,handleSearchKeyDown:ew,handleCommentBubbleClick:ek,handleToolbarAddComment:ej,handleToolbarSendToAI:eC,handleToolbarSearch:eN,handleCommentSubmit:eS,handleSendToAISubmit:eE,getHighlightedLineHtml:eL,inlineBlameLineRef:es,inlineBlameVersion:el}}({content:e,filePath:t,showSearch:x,cwd:g,enableComments:!U&&v,scrollToLine:U?null:P,scrollToLineAlign:U?"center":_,onScrollToLineComplete:U?void 0:A,visibleLineRef:U?void 0:D,onContentSearch:el}),tu=(0,c.iN)(),td=(0,s.useRef)(null),tm=(0,s.useRef)(null),tf=(0,s.useRef)({line:0,col:0}),th=(0,s.useRef)({line:0,col:0}),tx=function({lines:e,enabled:t,onContentChange:n,onEnterInsert:r,onSave:l,getVisibleLineCount:a,scrollToLine:o,onSearchExecute:i,onSearchNext:c,onSearchPrev:u,onSearchClear:d}){let[m,f]=(0,s.useState)("normal"),[h,x]=(0,s.useState)(-1),[p,g]=(0,s.useState)(0),[b,v]=(0,s.useState)(!1),[y,w]=(0,s.useState)(""),[k,j]=(0,s.useState)(""),[C,N]=(0,s.useState)(""),[S,E]=(0,s.useState)(""),L=(0,s.useRef)([]),M=(0,s.useRef)([]),R=(0,s.useRef)([]),T=(0,s.useRef)(null),$=(0,s.useRef)(e);(0,s.useEffect)(()=>{$.current=e}),(0,s.useEffect)(()=>{0!==e.length&&queueMicrotask(()=>x(t=>Math.min(t,e.length-1)))},[e.length]);let I=(0,s.useCallback)((e,t)=>Math.max(0,Math.min(t,Math.max(0,($.current[e]??"").length-1))),[]),P=(0,s.useRef)(e.length);(0,s.useEffect)(()=>{let t=Math.abs(e.length-P.current);P.current=e.length,t>10&&(queueMicrotask(()=>{x(-1),g(0),v(!1)}),L.current=[],M.current=[],R.current=[])},[e]);let _=(0,s.useCallback)(()=>{T.current&&(clearTimeout(T.current),T.current=null),w("")},[]),A=(0,s.useCallback)(()=>{T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{w(""),T.current=null},500)},[]),F=(0,s.useCallback)((e,t)=>{L.current.push(t),M.current=[],v(!0),n(e.join("\n"))},[n]),D=(0,s.useCallback)((e,t)=>{let n=Math.max(0,Math.min(e,$.current.length-1));x(n),g(I(n,t??0)),o(n,"auto")},[o,I]),O=(0,s.useCallback)(e=>{x(t=>{let n=Math.max(0,Math.min(t+e,$.current.length-1));return o(n,"auto"),g(e=>Math.max(0,Math.min(e,Math.max(0,($.current[n]??"").length-1)))),n})},[o]),V=(0,s.useCallback)(()=>{let e=$.current,t=Math.min(h,e.length-1);if(0===e.length)return;let n=e[t];R.current=[n];let r=[...e];r.splice(t,1),0===r.length&&r.push("");let s=Math.min(t,r.length-1);F(r,{lineIndex:t,oldLines:[n],newLines:[],cursorLine:t}),x(s),g(0)},[h,F]),B=(0,s.useCallback)(()=>{let e=$.current,t=Math.min(h,e.length-1);e.length>0&&(R.current=[e[t]])},[h]),W=(0,s.useCallback)(()=>{let e=R.current;if(0===e.length)return;let t=$.current,n=Math.min(h,t.length-1)+1,r=[...t];r.splice(n,0,...e),F(r,{lineIndex:n,oldLines:[],newLines:[...e],cursorLine:h}),x(n),g(0),o(n,"auto")},[h,F,o]),H=(0,s.useCallback)(()=>{let e=$.current,t=Math.min(h,e.length-1),n=e[t];if(!n||0===n.length)return;let r=n.substring(1),s=[...e];s[t]=r,F(s,{lineIndex:t,oldLines:[n],newLines:[r],cursorLine:h})},[h,F]),z=(0,s.useCallback)(()=>{let e=L.current;if(0===e.length)return;let t=e.pop(),r=[...$.current];0===t.newLines.length&&t.oldLines.length>0?r.splice(t.lineIndex,0,...t.oldLines):0===t.oldLines.length&&t.newLines.length>0?(r.splice(t.lineIndex,t.newLines.length),0===r.length&&r.push("")):r.splice(t.lineIndex,t.newLines.length,...t.oldLines),M.current.push(t),n(r.join("\n")),x(Math.min(t.cursorLine,r.length-1)),o(Math.min(t.cursorLine,r.length-1),"auto"),0===e.length&&v(!1)},[n,o]),K=(0,s.useCallback)(()=>{let e=M.current;if(0===e.length)return;let t=e.pop(),r=[...$.current];0===t.newLines.length&&t.oldLines.length>0?(r.splice(t.lineIndex,t.oldLines.length),0===r.length&&r.push("")):0===t.oldLines.length&&t.newLines.length>0?r.splice(t.lineIndex,0,...t.newLines):r.splice(t.lineIndex,t.oldLines.length,...t.newLines),L.current.push(t),v(!0),n(r.join("\n"));let s=t.lineIndex+Math.max(0,t.newLines.length-1);x(Math.min(s,r.length-1)),o(Math.min(s,r.length-1),"auto")},[n,o]),U=(0,s.useCallback)(e=>{let t=$.current,n=Math.min(h,t.length-1);if("o"===e||"O"===e){let r="o"===e?n+1:n,s=[...t];s.splice(r,0,""),F(s,{lineIndex:r,oldLines:[],newLines:[""],cursorLine:h}),n=r,x(r)}f("insert"),r(n,p,e)},[h,p,F,r]),q=(0,s.useCallback)(()=>{f("normal"),_()},[_]),X=(0,s.useCallback)(()=>{f("command"),j("")},[]),Z=(0,s.useCallback)(()=>{f("normal"),j("")},[]),J=(0,s.useCallback)(()=>{f("search"),N("")},[]),Y=(0,s.useCallback)(()=>{f("normal"),N("")},[]),Q=(0,s.useCallback)(e=>{let t=e.trim();if("w"===t){l?.(),f("normal"),j("");return}if("q"===t){f("normal"),j("");return}if("wq"===t){l?.(),f("normal"),j("");return}if("noh"===t||"nohlsearch"===t){d?.(),f("normal"),j("");return}let n=parseInt(t,10);if(!isNaN(n)&&n>0){let e=Math.min(n-1,$.current.length-1);x(e),o(e,"center"),f("normal"),j("");return}f("normal"),j("")},[l,d,o]),G=(0,s.useCallback)(e=>{if(!e){f("normal"),N("");return}E(e),i?.(e),f("normal"),N("")},[i]),ee=(0,s.useCallback)(e=>{if(!t)return!1;let n=e.ctrlKey&&"c"===e.key&&!e.metaKey&&!e.shiftKey;if("insert"===m)return("Escape"===e.key||!!n)&&(q(),!0);if("command"===m)return!e.isComposing&&("Escape"===e.key||n?Z():"Enter"===e.key?Q(k):"Backspace"===e.key?0===k.length?Z():j(e=>e.slice(0,-1)):1!==e.key.length||e.metaKey||e.ctrlKey||j(t=>t+e.key),!0);if("search"===m)return!e.isComposing&&("Escape"===e.key||n?Y():"Enter"===e.key?G(C):"Backspace"===e.key?0===C.length?Y():N(e=>e.slice(0,-1)):1!==e.key.length||e.metaKey||e.ctrlKey||N(t=>t+e.key),!0);if(h<0&&(x(0),g(0)),e.metaKey)return!1;if(e.ctrlKey)return"d"===e.key?(O(Math.max(1,Math.floor(a()/2))),_(),!0):"u"===e.key?(O(-Math.max(1,Math.floor(a()/2))),_(),!0):"r"===e.key&&(K(),_(),!0);let r=e.key,s=y+r;if("g"===s)return w("g"),A(),!0;if("gg"===s)return D(0),_(),!0;if("d"===s)return w("d"),A(),!0;if("dd"===s)return V(),_(),!0;if("y"===s)return w("y"),A(),!0;if("yy"===s)return B(),_(),!0;if(y&&s!==r&&_(),"j"===r||"ArrowDown"===r)return O(1),!0;if("k"===r||"ArrowUp"===r)return O(-1),!0;if("h"===r||"ArrowLeft"===r)return g(e=>Math.max(0,e-1)),!0;if("l"===r||"ArrowRight"===r){let e=Math.max(0,($.current[h]??"").length-1);return g(t=>Math.min(e,t+1)),!0}if("0"===r)return g(0),!0;if("$"===r)return g(Math.max(0,($.current[h]??"").length-1)),!0;if("^"===r){let e=($.current[h]??"").search(/\S/);return g(e>=0?e:0),!0}return"G"===r?(D($.current.length-1),!0):"x"===r?(H(),!0):"p"===r?(W(),!0):"u"===r?(z(),!0):"i"===r||"a"===r||"I"===r||"A"===r||"o"===r||"O"===r?(U(r),!0):"/"===r?(J(),!0):"n"===r?(c?.(),!0):"N"===r?(u?.(),!0):":"===r?(X(),!0):"Escape"!==r&&1===r.length},[t,m,y,k,C,h,q,U,X,Z,J,Y,Q,G,O,D,a,V,B,W,H,z,K,_,A,c,u]);return{state:{mode:m,cursorLine:h,cursorCol:p,isDirty:b,keyBuffer:y,commandInput:k,searchInput:C,lastSearch:S},handleKeyDown:ee,enterNormal:q,enterInsert:U,setCursorLine:x,setCursorCol:g,setCommandInput:j,setSearchInput:N,setIsDirty:v,clearUndoHistory:(0,s.useCallback)(()=>{L.current=[],M.current=[]},[])}}({lines:eX,enabled:Y&&!U,onContentChange:e=>{tf.current={line:th.current.line,col:th.current.col},Q?.(e)},onEnterInsert:(e,t,n)=>{let r=t;if("a"===n)r=t+1;else if("A"===n)r=(eX[e]??"").length;else if("I"===n){let t=(eX[e]??"").search(/\S/);r=t>=0?t:0}else("o"===n||"O"===n)&&(r=0);tf.current={line:e,col:r},G?.(e)},onSave:ee,getVisibleLineCount:()=>{let e=eN.current;return e?Math.floor(e.clientHeight/20):20},scrollToLine:(e,t)=>{let n=eJ.findIndex(t=>"code"===t.type&&t.lineIndex===e);n>=0&&eY.scrollToIndex(n,{align:t||"auto"})},onSearchExecute:e=>{e1(e),e0(!1)},onSearchNext:e6,onSearchPrev:e9,onSearchClear:()=>{e1("")}});(0,s.useEffect)(()=>{et&&(et.current={cursorLine:tx.state.cursorLine,cursorCol:tx.state.cursorCol}),th.current={line:tx.state.cursorLine,col:tx.state.cursorCol}},[et,tx.state.cursorLine,tx.state.cursorCol]);let tp=(0,s.useRef)(null);(0,s.useEffect)(()=>{Y&&!U&&null!=en&&t&&tp.current!==t&&(tp.current=t,tx.setCursorLine(en-1),null!=er&&tx.setCursorCol(er-1),es?.())},[Y,U,en,er,t]),(0,s.useEffect)(()=>{if(!Y||U)return;let e=eS.current;if(!e)return;let t=e=>{let t=e.target;"TEXTAREA"===t.tagName||"INPUT"===t.tagName||t.isContentEditable||tx.handleKeyDown(e)&&(e.preventDefault(),e.stopPropagation())};return e.addEventListener("keydown",t,!0),()=>e.removeEventListener("keydown",t,!0)},[Y,U,tx.handleKeyDown]),(0,s.useEffect)(()=>{if(!Y||U)return;let e=eS.current;e&&"normal"===tx.state.mode&&requestAnimationFrame(()=>{let t=document.activeElement;t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName||t.isContentEditable)||e.focus()})},[Y,U,tx.state.mode,e]);let tg=(0,s.useCallback)(e=>{if(!Y||U)return;let t=e.target.closest("[data-line]");if(t){let n=parseInt(t.getAttribute("data-line"),10);if(!isNaN(n)){tx.setCursorLine(n-1);let r=t.querySelector("[data-code-content]");if(r){let t=document.caretRangeFromPoint(e.clientX,e.clientY);if(t&&r.contains(t.startContainer)){let e,s=document.createTreeWalker(r,NodeFilter.SHOW_TEXT),l=0;for(;e=s.nextNode();){if(e===t.startContainer){l+=t.startOffset;break}l+=e.textContent?.length||0}let a=eX[n-1]??"";tx.setCursorCol(Math.max(0,Math.min(l,Math.max(0,a.length-1))))}}}}let n=e.target;if("TEXTAREA"===n.tagName||"INPUT"===n.tagName||n.isContentEditable)return;let r=eS.current;r&&r.focus()},[Y,U,tx.setCursorLine,tx.setCursorCol,eX]),tb=(0,s.useCallback)(e=>{Y&&!U&&requestAnimationFrame(()=>{let e=window.getSelection(),t=e?.toString().trim();t&&/^\S+$/.test(t)&&(to.current=!0,e1(t))})},[Y,U,e1,to]);(0,s.useEffect)(()=>{"command"===tx.state.mode?setTimeout(()=>td.current?.focus(),0):"search"===tx.state.mode&&setTimeout(()=>tm.current?.focus(),0)},[tx.state.mode]),(0,s.useEffect)(()=>{let e=eN.current;if(!e)return;let t=()=>{(W??B)?.()};return e.addEventListener("mousedown",t),()=>e.removeEventListener("mousedown",t)},[W,B]),(0,s.useEffect)(()=>{eW||eH?(eM.current=!0,B?.()):eL.current||(eM.current=!1)},[eW,eH,B]),(0,s.useLayoutEffect)(()=>{let e=eT.current;if(!e)return;let t=window.getSelection();if(t&&!t.isCollapsed)return;let n=eN.current;if(!n)return;let r=n.querySelector(`[data-line="${e.startLine}"]`),s=n.querySelector(`[data-line="${e.endLine}"]`);if(!r||!s)return;let l=E(r,e.startOffset),a=E(s,e.endOffset);if(l&&a)try{let e=document.createRange();e.setStart(l.node,l.offset),e.setEnd(a.node,a.offset),t?.removeAllRanges(),t?.addRange(e)}catch{}});let tv=(0,s.useCallback)((e,t,n)=>{eM.current||V?.(e,t,n)},[V]),ty=(0,s.useCallback)((e,t)=>{eM.current||O?.(e,t)},[O]),tw=Math.max(4,String(U?eh:eX.length).length),tk=(0,s.useMemo)(()=>{let e=0;for(let t of eX){let n=0;for(let e=0;e<t.length;e++)" "===t[e]?n+=2-n%2:n+=1;n>e&&(e=n)}return e},[eX]);(0,s.useEffect)(()=>{if(U){ei.current=e;let t=e.split("\n").length;ep.current=t,ex(t),ec.current=!1,ed(!1),eb({show:!1}),ew.current=q}},[U,e,q]),(0,s.useEffect)(()=>{if(!U)return;let t=ev.current;if(!t)return;let n=e.split("\n");t.innerHTML=I(n.map((e,t)=>e$[t]||(0,m.ZD)(e||" "))),requestAnimationFrame(()=>{let e,r;Y?(e=Math.max(0,Math.min(tf.current.line,n.length-1)),r=tf.current.col):(e=Math.max(0,Math.min((D?.current??1)-1,n.length-1)),r=0),t.focus(),$(t,{line:e,offset:r});let s=D?.current??1;ey.current&&(ey.current.scrollTop=(s-1)*20)})},[U]),(0,s.useEffect)(()=>{U&&J?.({isDirty:eu,isSaving:em})},[U,eu,em,J]);let tj=(0,s.useCallback)(()=>{let e=ev.current;if(!e)return ei.current;let t=[];for(let n of e.childNodes){let e=n.textContent||"";t.push(" "===e?"":e)}return t.join("\n")},[]),tC=(0,s.useCallback)(()=>{ek.current&&clearTimeout(ek.current),ek.current=setTimeout(async()=>{let e=ev.current;if(e&&!eC.current){ei.current=tj();try{let n=await (0,m.kS)(),r=(0,m.sQ)(t),s=document.documentElement.classList.contains("dark"),l=ei.current.split("\n"),a=n.codeToTokens(l.join("\n"),{lang:r,theme:s?"github-dark":"github-light"}).tokens.map(e=>(0,m.b8)(e)),o=T(e);ej.current=!0,e.innerHTML=I(a),ej.current=!1,o&&$(e,o)}catch{}}},300)},[t,tj]);(0,s.useEffect)(()=>{if(U)return()=>{ek.current&&clearTimeout(ek.current)}},[U]);let tN=(0,s.useCallback)(()=>{let e=ev.current;if(!e)return;ec.current||(ec.current=!0,ed(!0));let t=e.children.length;t!==ep.current&&(ep.current=t,ex(t))},[]),tS=(0,s.useCallback)(()=>{ej.current||eC.current||(tN(),tC())},[tN,tC]),tE=(0,s.useCallback)(e=>{if(!e.nativeEvent.isComposing&&("Tab"===e.key&&(e.preventDefault(),document.execCommand("insertText",!1," ")),"Enter"===e.key)){e.preventDefault();let t=ev.current;if(!t)return;let n=window.getSelection();if(!n?.rangeCount)return;let r=n.getRangeAt(0);r.deleteContents();let s=r.startContainer;for(;s&&s.parentElement!==t;)s=s.parentElement;if(!s||!(s instanceof HTMLElement))return;let l=T(t),a=Array.from(t.children).indexOf(s),o=s.textContent||"",i=l?.offset??o.length,c=o.substring(0,i),u=o.substring(i);s.innerHTML=(0,m.ZD)(c||" ");let d=document.createElement("div");d.setAttribute("style",R),d.innerHTML=(0,m.ZD)(u||" "),s.after(d),$(t,{line:a+1,offset:0}),tN(),tC()}},[tN,tC]),tL=(0,s.useCallback)(e=>{e.preventDefault();let t=e.clipboardData.getData("text/plain");document.execCommand("insertText",!1,t)},[]),tM=(0,s.useCallback)(async(e=!1)=>{if(!g)return;ei.current=tj(),ef(!0);let n=await o.t4.runPromiseExit((0,i.OJ)({cwd:g,path:t,content:ei.current,expectedMtime:e?void 0:ew.current}));if("Failure"===n._tag){console.error("Error saving file:",n.cause),(0,M.oR)(eo("toast.saveFailed"),"error"),ef(!1);return}let r=n.value,s=r.data;if(409===r.status&&s?.conflict){let e=await o.t4.runPromiseExit((0,i.K9)(g,t));"Success"===e._tag&&e.value.ok&&"string"==typeof e.value.data?.content?eb({show:!0,diskContent:e.value.data.content}):eb({show:!0}),ef(!1);return}if(!r.ok){console.error("Error saving file: status",r.status),(0,M.oR)(eo("toast.saveFailed"),"error"),ef(!1);return}let l=s?.mtime;l&&(ew.current=l),ec.current=!1,ed(!1),eb({show:!1}),(0,M.oR)(eo("toast.savedSuccess"),"success"),Z?.(),ef(!1)},[g,t,tj,Z,eo]),tR=(0,s.useCallback)(async()=>{eu&&!em&&await tM(!1)},[eu,em,tM]),tT=(0,s.useCallback)(async()=>{eb({show:!1}),await tM(!0)},[tM]),t$=(0,s.useCallback)(()=>{if(void 0!==eg.diskContent){ei.current=eg.diskContent;let t=eg.diskContent.split("\n").length;ep.current=t,ex(t);let n=eg.diskContent!==e;ec.current=n,ed(n);let r=ev.current;r&&(r.innerHTML=I(eg.diskContent.split("\n").map(e=>(0,m.ZD)(e||" "))),tC())}eb({show:!1}),Z?.()},[eg.diskContent,e,Z,tC]),tI=(0,s.useCallback)(()=>{let e=ey.current;return e?Math.floor(e.scrollTop/20)+1:D?.current??1},[D]),tP=(0,s.useCallback)(async()=>{(!eu||await (0,M.lJ)(eo("codeViewer.unsavedConfirm"),{danger:!0,confirmText:eo("codeViewer.discardChanges"),cancelText:eo("codeViewer.continueEditing")}))&&X?.(tI())},[eu,X,tI]);(0,s.useEffect)(()=>{if(!U)return;let e=e=>{(e.metaKey||e.ctrlKey)&&"s"===e.key&&(e.preventDefault(),tR())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[U,tR]);let t_=(0,s.useCallback)(()=>{let e=tj();Q?.(e);let t=ev.current,n=t?T(t):null,r=tI();if(tx.enterNormal(),n){tx.setCursorLine(n.line);let t=e.split("\n")[n.line]??"";tx.setCursorCol(Math.max(0,Math.min(n.offset,Math.max(0,t.length-1))))}else tx.setCursorLine(Math.max(0,r-1));X?.(r)},[tj,Q,tI,X,tx]);(0,s.useEffect)(()=>{if(!U)return;let e=e=>{let t="Escape"===e.key,n=e.ctrlKey&&"c"===e.key&&!e.metaKey&&!e.shiftKey;(t||Y&&n)&&(e.preventDefault(),e.stopPropagation(),Y?ec.current?(0,M.lJ)(eo("codeViewer.unsavedExitConfirm"),{danger:!0,confirmText:eo("codeViewer.discardChanges"),cancelText:eo("codeViewer.continueEditing")}).then(e=>{e&&t_()}):t_():tP())};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[U,Y,tP,t_]);let tA=(0,s.useCallback)(()=>{ec.current||(ec.current=!0,ed(!0))},[]);(0,s.useImperativeHandle)(ea,()=>({save:tR,close:tP,markDirty:tA,get isDirty(){return ec.current},get isSaving(){return em}}),[tR,tP,tA,em]);let tF=!!(H&&H.length>0),tD=(0,s.useMemo)(()=>{if(!H)return new Map;let e=[...new Set(H.map(e=>e.author))],t=new Map;return e.forEach((e,n)=>{t.set(e,b[n%b.length])}),t},[H]),[tO,tV]=(0,s.useState)(null),[tB,tW]=(0,s.useState)(null);(0,s.useEffect)(()=>{tV(null),tW(null)},[H]);let tH=(0,s.useCallback)((e,t)=>{tV(e.author);let n=t.currentTarget.getBoundingClientRect();tW({line:e,x:n.right+8,y:n.top})},[]),tz=(0,s.useCallback)(()=>{tV(null),tW(null)},[]),tK=(0,s.useCallback)(e=>{K&&(K({hash:e.hashFull,shortHash:e.hash,author:e.author,authorEmail:e.authorEmail,date:new Date(1e3*e.time).toISOString(),subject:e.message.split("\n")[0]||"",body:e.message.split("\n").slice(1).join("\n").trim(),time:e.time}),tW(null))},[K]),tU=`${tw+2}ch`;return(0,r.jsxs)("div",{ref:eS,className:`h-full flex flex-col outline-none ${p}`,tabIndex:0,onClick:tg,onDoubleClick:tb,children:[U&&eg.show&&(0,r.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,r.jsx)("svg",{className:"w-5 h-5 text-amber-500 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.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,r.jsx)("span",{className:"text-sm text-foreground flex-1",children:eo("codeViewer.fileModifiedExternally")}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{onClick:t$,className:"px-3 py-1 text-sm rounded border border-border hover:bg-accent transition-colors",children:eo("codeViewer.useDiskVersion")}),(0,r.jsx)("button",{onClick:tT,className:"px-3 py-1 text-sm rounded bg-amber-500 text-white hover:bg-amber-600 transition-colors",children:eo("codeViewer.forceOverwrite")})]})]}),!U&&x&&eA&&(0,r.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-secondary border-b border-border",children:[(0,r.jsx)("input",{ref:eE,type:"text",value:eF,onChange:e=>e1(e.target.value),onKeyDown:e7,placeholder:eo("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,r.jsx)("button",{onClick:()=>e2(!eD),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${eD?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-accent"}`,title:eo("codeViewer.caseSensitive"),children:"Aa"}),(0,r.jsx)("button",{onClick:()=>e5(!eO),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${eO?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-accent"}`,title:eo("codeViewer.wholeWordMatch"),children:"[ab]"}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:eZ.length>0?`${eV+1}/${eZ.length}`:eo("common.noMatch")}),(0,r.jsx)("button",{onClick:e9,disabled:0===eZ.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:eo("common.previous"),children:(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}),(0,r.jsx)("button",{onClick:e6,disabled:0===eZ.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:eo("common.next"),children:(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),(0,r.jsx)("button",{onClick:()=>{e0(!1),e1("")},className:"p-1 rounded hover:bg-accent",title:eo("common.close"),children:(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),U?(0,r.jsx)("div",{ref:ey,className:"flex-1 overflow-auto bg-secondary",children:(0,r.jsxs)("div",{className:"flex",style:{minHeight:"100%"},children:[(0,r.jsx)("div",{className:"flex-shrink-0 font-mono text-sm select-none sticky left-0 z-[2] bg-secondary",style:{width:tU},children:Array.from({length:eh},(e,t)=>(0,r.jsx)("div",{className:"text-right text-muted-foreground/50 pr-3",style:{height:20,lineHeight:"20px"},children:t+1},t))}),(0,r.jsx)("div",{ref:ev,contentEditable:!0,suppressContentEditableWarning:!0,onInput:tS,onKeyDown:tE,onPaste:tL,onCompositionStart:()=>{eC.current=!0},onCompositionEnd:()=>{eC.current=!1,tS()},spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",className:"flex-1 font-mono text-sm outline-none",style:{caretColor:"var(--foreground)",tabSize:2}})]})}):(0,r.jsx)("div",{ref:eN,className:`flex-1 overflow-auto font-mono text-sm bg-secondary${eP?" cmd-held-container":""}`,children:(0,r.jsx)("div",{style:{height:`${eY.getTotalSize()}px`,minWidth:"100%",width:tF?`calc(${tw+tk+10}ch + 13rem)`:`${tw+tk+10}ch`,position:"relative"},children:eY.getVirtualItems().map(e=>{let t=eJ[e.index];if("code"!==t.type)return null;let s=t.lineIndex,l=s+1,a=e$[s]||(0,m.ZD)(eX[s]||""),o=ta(s,a,F),i=eG.has(l),c=eQ.get(l),u=c?.[0],d=!!(eW&&l>=eW.range.start&&l<=eW.range.end),f=tc>=0?ti.current:null,h=!U&&z&&f===l?z[s]??null:null,x=tF?H[s]:void 0,p=tF&&s>0?H[s-1]:void 0,g=!!x&&(!p||p.hash!==x.hash),b=x?tD.get(x.author):void 0;return(0,r.jsx)(y,{virtualKey:e.key,lineNum:l,highlightedHtml:o,hasComments:i,firstComment:u,lineCommentsCount:c?.length,isInRange:d,showLineNumbers:n,lineNumChars:tw,commentsEnabled:eK,virtualItemSize:e.size,virtualItemStart:e.start,onCommentBubbleClick:te,onCmdClick:ty,onTokenHover:tv,onTokenHoverLeave:B,flashLine:e_,blameLine:x,showBlameInfo:g,blameAuthorColor:b,isBlameHovered:!!(x&&tO===x.author),onBlameClick:tK,onBlameMouseEnter:tH,onBlameMouseLeave:tz,inlineBlameData:h,onInlineBlameClick:tK,isCursorLine:Y&&!U&&tx.state.cursorLine===s,cursorCol:Y&&!U&&tx.state.cursorLine===s?tx.state.cursorCol:void 0},e.key)})})}),Y&&(0,r.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"===tx.state.mode&&(0,r.jsx)("span",{className:"text-green-11 font-medium",children:"NORMAL"}),"insert"===tx.state.mode&&(0,r.jsx)("span",{className:"text-blue-11 font-medium",children:"INSERT"}),"command"===tx.state.mode&&(0,r.jsxs)("div",{className:"flex items-center flex-1",children:[(0,r.jsx)("span",{className:"text-foreground",children:":"}),(0,r.jsx)("input",{ref:td,value:tx.state.commandInput,onChange:e=>tx.setCommandInput(e.target.value),onKeyDown:e=>{if(e.nativeEvent.isComposing)return;let t=e.ctrlKey&&"c"===e.key&&!e.metaKey&&!e.shiftKey;("Enter"===e.key||"Escape"===e.key||t)&&(e.preventDefault(),e.stopPropagation(),tx.handleKeyDown(e.nativeEvent))},className:"flex-1 bg-transparent outline-none text-foreground ml-0.5",spellCheck:!1,autoComplete:"off"})]}),"search"===tx.state.mode&&(0,r.jsxs)("div",{className:"flex items-center flex-1",children:[(0,r.jsx)("span",{className:"text-foreground",children:"/"}),(0,r.jsx)("input",{ref:tm,value:tx.state.searchInput,onChange:e=>tx.setSearchInput(e.target.value),onKeyDown:e=>{if(e.nativeEvent.isComposing)return;let t=e.ctrlKey&&"c"===e.key&&!e.metaKey&&!e.shiftKey;("Enter"===e.key||"Escape"===e.key||t)&&(e.preventDefault(),e.stopPropagation(),tx.handleKeyDown(e.nativeEvent))},className:"flex-1 bg-transparent outline-none text-foreground ml-0.5",spellCheck:!1,autoComplete:"off"})]}),tx.state.keyBuffer&&"normal"===tx.state.mode&&(0,r.jsx)("span",{className:"ml-2 text-muted-foreground",children:tx.state.keyBuffer}),tx.state.isDirty&&("normal"===tx.state.mode||"command"===tx.state.mode)&&(0,r.jsx)("span",{className:"ml-2 text-amber-11",children:"[+]"}),(0,r.jsxs)("span",{className:"ml-auto text-muted-foreground",children:[tx.state.cursorLine+1,":",tx.state.cursorCol+1]})]}),eI&&tu&&(0,a.createPortal)((0,r.jsxs)(r.Fragment,{children:[!U&&(0,r.jsx)(f.f,{floatingToolbarRef:eL,bumpRef:eR,container:tu,onAddComment:tt,onSendToAI:tn,onSearch:el?tr:void 0,isChatLoading:ez?.isLoading}),!U&&eW&&(0,r.jsx)(u.t,{x:eW.x,y:eW.y,range:eW.range,lineSnapshot:eW.lineSnapshot,container:tu,onSubmit:ts,onClose:()=>e3(null)}),!U&&eH&&(0,r.jsx)(u.G,{x:eH.x,y:eH.y,range:eH.range,filePath:t,lineSnapshot:eH.lineSnapshot,container:tu,onSubmit:tl,onClose:()=>e8(null),isChatLoading:ez?.isLoading}),!U&&eB&&(0,r.jsx)(h.t,{x:eB.x,y:eB.y,comment:eB.comment,container:tu,onClose:()=>e4(null),onUpdateComment:eU,onDeleteComment:eq}),tB&&(0,r.jsxs)("div",{className:"fixed z-50 bg-card border border-border rounded-lg shadow-lg p-3 max-w-lg",style:{left:Math.min(tB.x,window.innerWidth-450),top:Math.max(8,Math.min(tB.y,window.innerHeight-200))},children:[(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"px-2 py-0.5 rounded text-xs font-mono font-medium text-white flex-shrink-0",style:{backgroundColor:tD.get(tB.line.author)?.border||"#666"},children:tB.line.hash}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:"text-sm font-medium text-foreground",children:tB.line.author}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:tB.line.authorEmail})]})]}),(0,r.jsx)("div",{className:"mt-2 text-sm text-foreground whitespace-pre-wrap max-h-48 overflow-y-auto",children:tB.line.message}),(0,r.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground border-t border-border pt-2",children:[(0,L.fw)(tB.line.time)," \xb7 ",new Date(1e3*tB.line.time).toLocaleString(),(0,r.jsx)("span",{className:"ml-2 text-brand",children:eo("codeViewer.clickToViewDetails")})]})]})]}),tu)]})});function _({content:e,filePath:t,className:n=""}){let l=(0,s.useMemo)(()=>e.split("\n"),[e]),a=(0,d.C)(l,t),o=Math.max(4,String(l.length).length);return(0,r.jsx)("pre",{className:`overflow-auto text-sm font-mono bg-secondary p-2 ${n}`,children:l.map((e,t)=>(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)("span",{className:"text-slate-9 select-none pr-4 text-right",style:{minWidth:`${o+2}ch`},children:t+1}),(0,r.jsx)("span",{className:"flex-1",dangerouslySetInnerHTML:{__html:a[t]||(0,m.ZD)(e||" ")}})]},t))})}},46456:(e,t,n)=>{n.d(t,{$:()=>i,BC:()=>c,Tu:()=>d,lb:()=>o,tj:()=>m,vv:()=>u});var r=n(49433),s=n(82680);let l=(e,t)=>r.tryPromise({try:async()=>{let n=await fetch(e,t);if(!n.ok)throw Error(`HTTP ${n.status}`);return await n.json()},catch:n=>new s.uV({message:`${t?.method??"GET"} ${e} failed`,cause:n})}),a=(e,t)=>r.tryPromise({try:async()=>{let n=await fetch(e,t);if(!n.ok)throw Error(`HTTP ${n.status}`)},catch:n=>new s.uV({message:`${t.method} ${e} failed`,cause:n})}),o=(e,t)=>l(`/api/comments?cwd=${encodeURIComponent(e)}${t?`&filePath=${encodeURIComponent(t)}`:""}`),i=e=>l(`/api/comments?cwd=${encodeURIComponent(e)}&all=true`),c=e=>l("/api/comments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),u=(e,t,n)=>l("/api/comments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,id:t,content:n})}),d=(e,t)=>a(`/api/comments?cwd=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`,{method:"DELETE"}),m=e=>a(`/api/comments?cwd=${encodeURIComponent(e)}&all=true`,{method:"DELETE"})},47215:(e,t,n)=>{n.d(t,{C6:()=>a,WU:()=>y,aR:()=>v,e$:()=>b,jU:()=>l,oK:()=>w,u:()=>g,xb:()=>o,zs:()=>x});var r=n(12115),s=n(69809);function l(e){try{return JSON.parse(e),!0}catch{return!1}}function a(e){try{let t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}}function o(e){try{let t=JSON.parse(e);return h(t,0)}catch{return e}}let i="#79c0ff",c="#a5d6ff",u="#ff7b72",d="#8b949e",m=(e,t)=>r.createElement("span",{style:{color:e}},t);function f({label:e,labelColor:t,value:n,indent:l}){let[a,o]=r.useState(!1),[i,u]=r.useState({x:0,y:0}),x="string"==typeof n&&n.replace(/\\n/g,"\n").split("\n").length>3,p={onMouseDown:e=>{u({x:e.clientX,y:e.clientY})},onClick:e=>{let t=e.clientX-i.x,n=e.clientY-i.y;t*t+n*n>25||(e.stopPropagation(),o(e=>!e))},style:{cursor:"pointer"}};if(x&&a&&"string"==typeof n){let l=n.replace(/\\n/g,"\n").split("\n")[0],a=n.replace(/\\n/g,"\n").split("\n").length;return r.createElement("span",p,m(t,e),m(d,": "),m(c,l),m("#6e7681",` ${s.A.t("toolCall.foldedLines",{count:a})}`))}let g=r.createElement(r.Fragment,null,m(t,e),m(d,": "),h(n,l));return x?r.createElement("span",p,g):g}function h(e,t){let n=" ".repeat(t);if(null===e)return m(u,"null");if(void 0===e)return m(u,"undefined");if("string"==typeof e)return m(c,e.replace(/\\n/g,"\n").replace(/\n/g,"\n"+n));if("number"==typeof e)return m("#79c0ff",String(e));if("boolean"==typeof e)return m(u,String(e));if(Array.isArray(e))return 0===e.length?m(d,"[]"):r.createElement(r.Fragment,null,m(d,"["),"\n",...e.map((s,l)=>r.createElement("span",{key:l},n+" ",r.createElement(f,{label:`[${l}]`,labelColor:i,value:s,indent:t+1}),l<e.length-1?r.createElement(r.Fragment,null,m(d,","),"\n"):"\n")),n,m(d,"]"));if("object"==typeof e){let s=Object.entries(e);return 0===s.length?m(d,"{}"):r.createElement(r.Fragment,null,m(d,"{"),"\n",...s.map(([e,l],a)=>r.createElement("span",{key:e},n+" ",r.createElement(f,{label:e,labelColor:i,value:l,indent:t+1}),a<s.length-1?r.createElement(r.Fragment,null,m(d,","),"\n"):"\n")),n,m(d,"}"))}return String(e)}function x(e){try{let t=JSON.parse(e);if(t&&"string"==typeof t.file_path&&"string"==typeof t.old_string&&"string"==typeof t.new_string)return t}catch{}return null}let p=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".ico",".avif"]);function g(e){let t=e.slice(e.lastIndexOf(".")).toLowerCase();return p.has(t)}function b(e){return e.toLowerCase().endsWith(".md")}function v(e){let t=e.toLowerCase();return t.endsWith(".html")||t.endsWith(".htm")}function y(e,t){let n=t.startsWith("/")?[]:e.split("/").slice(0,-1);for(let e of t.replace(/^\//,"").split("/"))""!==e&&"."!==e&&(".."===e?n.pop():n.push(e));return n.join("/")}function w(e){try{let t=JSON.parse(e);if(t&&"string"==typeof t.file_path)return t.file_path}catch{let t=e.trim();if(t.startsWith("/")&&!t.includes("\n")&&t.length<500)return t}return null}},48347:(e,t,n)=>{n.d(t,{H:()=>a,r:()=>o});var r=n(95155),s=n(12115);let l=(0,s.createContext)(null);function a({value:e,children:t}){return(0,r.jsx)(l.Provider,{value:e,children:t})}function o(){return(0,s.useContext)(l)}},48948:(e,t,n)=>{n.d(t,{F:()=>r});function r(e,t,n){let{engine:r,assistantId:s}=n;if("stream_event"===t.type){let n=t.event;if(n?.type==="content_block_delta"&&n.delta?.type==="text_delta"&&n.delta.text){let t=n.delta.text;return e.map(e=>e.id===s?{...e,content:(e.content||"")+t}:e)}return e}if("assistant"===t.type){let n=t.message?.content;if(!Array.isArray(n))return e;let l=e,a=t.message?.model==="<synthetic>";if("codex"===r||"kimi"===r||"ollama"===r||a){let e=n.filter(e=>"text"===e.type&&e.text).map(e=>e.text).join("");e&&(l=l.map(t=>t.id===s?{...t,content:(t.content||"")+e}:t))}for(let e of n)if(e.name){let t={id:e.id||`tool-${s}-${e.name}`,name:e.name,input:e.input||{},isLoading:!0};l=l.map(e=>e.id!==s||e.toolCalls?.some(e=>e.id===t.id)?e:{...e,toolCalls:[...e.toolCalls||[],t]})}return l}if("user"===t.type){let n=t.message?.content;if(!Array.isArray(n))return e;let r=e;for(let e of n)if(e.tool_use_id){let t=e.tool_use_id,n="string"==typeof e.content?e.content:JSON.stringify(e.content);r=r.map(e=>e.id===s?{...e,toolCalls:e.toolCalls?.map(e=>e.id===t?{...e,result:n,isLoading:!1}:e)}:e)}return r}if("error"===t.type){let n=t.error||"An error occurred. Please try again.";return e.map(e=>e.id===s?{...e,content:e.content?`${e.content}
|
|
8
|
+
⚠️ ${r}`:`⚠️ ${r}`,isStreaming:!1}:e));return}if("stream_event"===r){S(e=>e?null:e),L(e=>e?null:e);let t=e.event;if(t?.type==="content_block_delta"&&t.delta?.type==="text_delta"){let e=t.delta.text||"";F.current&&F.current.messageId===n?F.current.text+=e:F.current={messageId:n,text:e},D.current||(D.current=setTimeout(H,50))}return}if("assistant"===r&&t(t=>(0,s.F)(t,e,{engine:u,assistantId:n})),"user"===r&&t(t=>(0,s.F)(t,e,{engine:u,assistantId:n})),"result"===r){B.current=!1,V.current=!0,S(null),D.current&&(clearTimeout(D.current),D.current=null),H();let r=A.current;r&&c&&t(e=>(2===e.length&&p(r),e));let l=e.usage,a=e.total_cost_usd;l&&k({inputTokens:l.input_tokens||0,outputTokens:l.output_tokens||0,cacheCreationInputTokens:l.cache_creation_input_tokens||0,cacheReadInputTokens:l.cache_read_input_tokens||0,totalCostUsd:a||0}),t(t=>(0,s.F)(t,e,{engine:u,assistantId:n}))}},[t,H,x,p,c,u,g]);return(0,a.h)({url:R?`/ws/session-stream?sessionId=${encodeURIComponent(R.runKey)}`:"/ws/session-stream",enabled:!!R,onMessage:e=>{P.current=!0,_.current&&(clearTimeout(_.current),_.current=null);let n=$.current;if(n)if("run-snapshot"===e.type&&Array.isArray(e.events)){for(let r of(D.current&&(clearTimeout(D.current),D.current=null),F.current=null,O.current=n.assistantId,V.current=!1,B.current=!1,t(e=>e.filter(e=>!("string"==typeof e.id&&e.id.startsWith("auto-")&&e.runKey===n.runKey)).map(e=>e.id===n.assistantId?{...e,content:"",toolCalls:[]}:e)),e.events))U(r,O.current??n.assistantId);e.status&&"running"!==e.status&&z()}else if("run-event"===e.type&&e.message){if("run-ended"===e.message.type)return void z();U(e.message,O.current??n.assistantId)}else"run-idle"===e.type&&z()}}),{isLoading:v,tokenUsage:w,rateLimitInfo:j,apiRetryInfo:N,ptyNotice:E,handleSend:(0,r.useCallback)(async(e,n,r)=>{let s=r&&"permissionMode"in r?"plan"===r.permissionMode:m,a=n?.map(e=>({type:"base64",media_type:e.media_type,data:e.data})),i={id:`user-${Date.now()}`,role:"user",content:e,images:a};t(e=>[...e,i]),y(!0),S(null),L(null);let x=`assistant-${Date.now()}`,p={id:x,role:"assistant",content:"",toolCalls:[],isStreaming:!0};t(e=>[...e,p]),O.current=x,V.current=!1,B.current=!1;let g=!u||"claude"===u||"claude2"===u,b="pty"===d&&g,v=function(){try{return crypto.randomUUID()}catch{return`run-${Date.now()}-${Math.floor(1e9*Math.random())}`}}();try{if("ollama"===u&&!f)throw Error("Please select an Ollama model first (click the model picker above)");let n="codex"===u?"/api/chat/codex":"kimi"===u?"/api/chat/kimi":"ollama"===u?"/api/chat/ollama":"deepseek"===u?"/api/chat/deepseek":"/api/chat",r=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e,sessionId:A.current,runId:v,images:a,cwd:c,language:l.A.language,..."ollama"===u&&f&&{model:f},..."deepseek"===u&&h&&{model:h},..."claude2"===u&&{engine:"claude2"},...b&&{mode:"pty",ptyCols:o.EE,ptyRows:o.K2},...s&&!b&&g&&{permissionMode:"plan"}})});if(400===r.status&&"deepseek"===u){let e=await r.json().catch(()=>null);throw Error(e?.error||"DeepSeek request failed")}if(!r.ok)throw Error(l.A.t("chat.requestFailed",{defaultValue:"Request failed"}));let i=await r.json().catch(()=>({}));T({runKey:i.runKey||v,assistantId:x}),P.current=!1,_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{$.current&&!P.current&&(t(e=>e.map(e=>e.id!==x||e.content?e:{...e,content:l.A.t("chat.errorRetry",{defaultValue:"An error occurred. Please try again."})})),z())},15e3)}catch(n){console.error("Chat error:",n);let e=n instanceof Error?n.message:l.A.t("chat.errorRetry",{defaultValue:"An error occurred. Please try again."});t(t=>t.map(t=>t.id===x?{...t,content:e,isStreaming:!1}:t)),y(!1),T(null)}},[c,u,d,m,f,h,t,z]),handleStop:K,abortControllerRef:M}}},22576:(e,t,n)=>{n.d(t,{X:()=>r});function r(e,t){let n=e.split("\n"),r=t.split("\n"),s=[],l=n.length,a=r.length,o=Array(l+1).fill(null).map(()=>Array(a+1).fill(0));for(let e=1;e<=l;e++)for(let t=1;t<=a;t++)n[e-1]===r[t-1]?o[e][t]=o[e-1][t-1]+1:o[e][t]=Math.max(o[e-1][t],o[e][t-1]);let i=l,c=a,u=[];for(;i>0||c>0;)i>0&&c>0&&n[i-1]===r[c-1]?(u.push({type:"unchanged",content:n[i-1],oldLineNum:i,newLineNum:c}),i--,c--):c>0&&(0===i||o[i][c-1]>=o[i-1][c])?(u.push({type:"added",content:r[c-1],newLineNum:c}),c--):(u.push({type:"removed",content:n[i-1],oldLineNum:i}),i--);for(;u.length>0;)s.push(u.pop());return s}},27570:(e,t,n)=>{n.d(t,{L:()=>s});var r=n(12115);function s({enabled:e,container:t,resolveLineRange:n,buildLineSnapshot:l,dragThresholdPx:a=5}){let o=(0,r.useRef)(null),i=(0,r.useRef)(()=>{}),c=(0,r.useRef)(n),u=(0,r.useRef)(l),d=(0,r.useRef)(a);return c.current=n,u.current=l,d.current=a,(0,r.useEffect)(()=>{if(!e||!t)return;let n=!1,r=0,s=0,l=()=>{o.current&&(o.current=null,i.current())},a=e=>{n=!0,r=e.clientX,s=e.clientY;let t=e.target;t?.closest?.(".floating-toolbar")||l()},m=e=>{n=!1;let a=e.target;if(a?.closest?.(".floating-toolbar"))return;let m=d.current,f=Math.abs(e.clientX-r)>m||Math.abs(e.clientY-s)>m,h=window.getSelection();if(!h||h.isCollapsed||!h.toString().trim()||!f)return void l();let x=h.getRangeAt(0);if(!t.contains(x.commonAncestorContainer))return void l();let p=c.current(x.startContainer),g=c.current(x.endContainer);if(!p||!g)return void l();let b=Math.min(p.start,g.start),v=Math.max(p.end,g.end),y=h.toString(),w=u.current({start:b,end:v});o.current={x:e.clientX,y:e.clientY,range:{start:b,end:v},selectedText:y,lineSnapshot:w},i.current()},f=()=>{if(n||!o.current)return;let e=window.getSelection();e&&!e.isCollapsed&&e.toString().trim()||l()};return t.addEventListener("mousedown",a),document.addEventListener("mouseup",m),document.addEventListener("selectionchange",f),()=>{t.removeEventListener("mousedown",a),document.removeEventListener("mouseup",m),document.removeEventListener("selectionchange",f)}},[e,t]),{toolbarRef:o,bumpRef:i,clearToolbar:()=>{o.current&&(o.current=null,i.current())}}}},37614:(e,t,n)=>{n.d(t,{t:()=>a});var r=n(95155),s=n(12115),l=n(79114);function a({x:e,y:t,comment:n,container:o,onClose:i,onUpdateComment:c,onDeleteComment:u}){let{t:d}=(0,l.Bd)(),[m,f]=(0,s.useState)(!1),[h,x]=(0,s.useState)(n.content),p=(0,s.useRef)(null),[g,b]=(0,s.useState)({x:0,y:0});(0,s.useEffect)(()=>{if(p.current&&o){let n=o.getBoundingClientRect(),r=p.current.getBoundingClientRect(),s=e-n.left,l=t-n.top;s+r.width>n.width-16&&(s=n.width-r.width-16),s<16&&(s=16),l+r.height>n.height-16&&(l=l-r.height-8),l<16&&(l=16),queueMicrotask(()=>b({x:s,y:l}))}},[e,t,o]),(0,s.useEffect)(()=>{let e=e=>{p.current&&!p.current.contains(e.target)&&i()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);let v=async()=>{h.trim()&&(await c(n.id,h.trim()),f(!1))},y=async()=>{await u(n.id),i()};return(0,r.jsx)("div",{ref:p,className:"absolute z-[200] w-96 bg-card border border-border rounded-lg shadow-lg overflow-hidden",style:{left:g.x,top:g.y},children:(0,r.jsx)("div",{className:"p-3",children:m?(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("textarea",{value:h,onChange:e=>x(e.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:e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),v()),"Escape"===e.key&&(f(!1),x(n.content))}}),(0,r.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,r.jsx)("button",{onClick:()=>{f(!1),x(n.content)},className:"px-2 py-1 text-xs text-muted-foreground hover:text-foreground",children:d("common.cancel")}),(0,r.jsx)("button",{onClick:v,className:"px-2 py-1 text-xs bg-brand text-white rounded hover:bg-brand/90",children:d("common.save")})]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:n.content}),(0,r.jsxs)("div",{className:"mt-2 flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:d("comments.lineRange",{start:n.startLine,end:n.endLine})}),(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)("button",{onClick:()=>f(!0),className:"p-1 rounded hover:bg-accent text-muted-foreground",title:d("common.edit"),children:(0,r.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.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,r.jsx)("button",{onClick:y,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-red-9",title:d("common.delete"),children:(0,r.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.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"})})})]})]})]})})})}},38175:(e,t,n)=>{n.d(t,{E:()=>s});var r=n(95155);function s({content:e,filePath:t}){return(0,r.jsx)("div",{className:"h-full w-full bg-white",children:(0,r.jsx)("iframe",{srcDoc:e,title:t,sandbox:"allow-scripts allow-same-origin",className:"h-full w-full border-0"},t)})}n(12115)},38408:(e,t,n)=>{n.d(t,{Cv:()=>P,XO:()=>_});var r=n(95155),s=n(12115),l=n(79114),a=n(47650),o=n(86957),i=n(60938),c=n(70188),u=n(7320),d=n(56978),m=n(17196),f=n(89109),h=n(37614),x=n(69809),p=n(64428);function g({blame:e,onClick:t}){let{t:n}=(0,l.Bd)(),a=(0,s.useRef)(null),o=(0,s.useRef)(null),i=(0,p.F2)(),c=(0,s.useRef)(!1),u=(0,s.useRef)(!1),d=(0,s.useRef)(null),m=(0,s.useRef)(null),f=(0,s.useRef)(null),h=(0,s.useRef)(e);(0,s.useEffect)(()=>{h.current=e},[e]);let b=(0,s.useRef)(t);(0,s.useEffect)(()=>{b.current=t},[t]);let v=(0,s.useCallback)(()=>{let e,t=o.current,n=a.current;if(!t||!n)return;let r=n.getBoundingClientRect(),s=t.getBoundingClientRect(),l=i?.getBoundingClientRect(),c=l?.left??0,u=l?.top??0,d=l?.width??window.innerWidth,m=l?.height??window.innerHeight,f=r.left-c;f+s.width>d-8&&(f=d-s.width-8),f<8&&(f=8);let h=r.top-u,x=r.bottom-u;(e=h-s.height-4<0?x+4:h-s.height-4)+s.height>m-8&&(e=m-s.height-8),t.style.left=`${f}px`,t.style.top=`${e}px`},[i]),y=(0,s.useCallback)(()=>{d.current&&(clearTimeout(d.current),d.current=null),m.current&&(clearTimeout(m.current),m.current=null),c.current=!1,u.current=!1,o.current&&(o.current.style.display="none"),f.current&&(document.removeEventListener("mousedown",f.current.down),document.removeEventListener("mouseup",f.current.up),f.current=null)},[]),w=(0,s.useCallback)(()=>{let e=o.current;if(!e||c.current)return;c.current=!0,e.style.left="-9999px",e.style.top="-9999px",e.style.display="block",requestAnimationFrame(()=>requestAnimationFrame(v));let t=0,n=0,r=e=>{t=e.clientX,n=e.clientY},s=e=>{if(!(Math.abs(e.clientX-t)>5||Math.abs(e.clientY-n)>5)){let t;t=e.target,o.current?.contains(t)||a.current?.contains(t)||y()}};document.addEventListener("mousedown",r),document.addEventListener("mouseup",s),f.current={down:r,up:s}},[v,y]),k=(0,s.useCallback)(()=>{if(d.current&&clearTimeout(d.current),m.current&&(clearTimeout(m.current),m.current=null),c.current)return;let e=window.getSelection();(!e||e.isCollapsed)&&(d.current=setTimeout(w,500))},[w]),j=(0,s.useCallback)(()=>{d.current&&(clearTimeout(d.current),d.current=null),c.current&&(m.current=setTimeout(()=>{u.current||y()},200))},[y]),C=(0,s.useCallback)(()=>{u.current=!0,m.current&&(clearTimeout(m.current),m.current=null)},[]),N=(0,s.useCallback)(()=>{u.current=!1,y()},[y]),S=(0,s.useCallback)(e=>{e.stopPropagation();let t=window.getSelection();t&&t.toString().length>0&&o.current?.contains(t.anchorNode)||(b.current?.(h.current),y())},[y]);(0,s.useEffect)(()=>()=>y(),[y]);let E=e.message.split("\n")[0]||"",L=e.message.split("\n").slice(1).join("\n").trim();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("span",{ref:a,className:"select-none text-xs text-muted-foreground/50 ml-6 cursor-default hover:text-muted-foreground/80",onMouseEnter:k,onMouseLeave:j,children:[e.author.split(" ")[0],", ",function(e){let t=x.A.t,n=Math.floor((Date.now()-1e3*e)/1e3);if(n<60)return t("common.justNow");let r=Math.floor(n/60);if(r<60)return t("common.minutesAgo",{count:r});let s=Math.floor(r/60);if(s<24)return t("common.hoursAgo",{count:s});let l=Math.floor(s/24);if(l<30)return t("common.daysAgo",{count:l});let a=Math.floor(l/30);return a<12?t("common.monthsAgo",{count:a}):t("common.yearsAgo",{count:Math.floor(a/12)})}(e.time)," \xb7 ",E]}),(0,r.jsx)(p.ZL,{children:(0,r.jsxs)("div",{ref:o,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:C,onMouseLeave:N,children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,r.jsx)("span",{className:"font-mono text-brand",children:e.hash}),(0,r.jsx)("span",{className:"text-muted-foreground",children:e.author}),(0,r.jsx)("span",{className:"text-muted-foreground/60",children:new Date(1e3*e.time).toLocaleString()})]}),(0,r.jsx)("div",{className:"font-medium",children:E}),L&&(0,r.jsx)("div",{className:"mt-1 text-muted-foreground",children:L}),(0,r.jsx)("div",{className:"mt-2 text-[11px] text-brand border-t border-border pt-2 cursor-pointer hover:underline",onClick:S,children:n("codeViewer.clickToViewDetails")})]})})]})}let b=[{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 v(e,t){let n,r=document.caretRangeFromPoint(e.clientX,e.clientY);if(!r||!t.contains(r.startContainer))return 1;let s=r.startContainer,l=r.startOffset,a=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),o=1;for(;n=a.nextNode();){if(n===s){o+=l;break}o+=n.textContent?.length||0}return o}let y=(0,s.memo)(function({virtualKey:e,lineNum:t,highlightedHtml:n,hasComments:a,firstComment:o,lineCommentsCount:i,isInRange:c,showLineNumbers:u,lineNumChars:d,commentsEnabled:m,virtualItemSize:f,virtualItemStart:h,onCommentBubbleClick:x,onCmdClick:p,onTokenHover:b,onTokenHoverLeave:y,flashLine:w,blameLine:k,showBlameInfo:j,blameAuthorColor:C,isBlameHovered:N,onBlameClick:S,onBlameMouseEnter:E,onBlameMouseLeave:L,inlineBlameData:M,onInlineBlameClick:R,isCursorLine:T,cursorCol:$}){let{t:I}=(0,l.Bd)(),P=(0,s.useMemo)(()=>T&&null!=$?function(e,t){let n=0,r=0;for(;r<e.length;){if("<"===e[r]){let t=e.indexOf(">",r);if(-1!==t){r=t+1;continue}}if(n===t){let t;if("&"===e[r]){let n=e.indexOf(";",r);t=-1!==n&&n-r<10?n+1:r+1}else t=r+1;let n=e.substring(r,t);return e.substring(0,r)+'<span class="vi-char-cursor">'+n+"</span>"+e.substring(t)}if("&"===e[r]){let t=e.indexOf(";",r);r=-1!==t&&t-r<10?t+1:r+1}else r++;n++}return e+'<span class="vi-char-cursor"> </span>'}(n,$):n,[n,T,$]),_=(0,s.useCallback)(e=>{if(!e.metaKey||!p)return;e.preventDefault(),e.stopPropagation();let n=e.currentTarget,r=v(e,n);window.getSelection()?.removeAllRanges(),p(t,r)},[t,p]),A=(0,s.useCallback)(e=>{if(!b||0!==e.buttons)return;let n=window.getSelection();if(n&&!n.isCollapsed)return;let r=e.target;if("SPAN"!==r.tagName||!r.style.color)return;let s=e.currentTarget,l=v(e,s),a=r.getBoundingClientRect();b(t,l,{x:a.left,y:a.bottom+4})},[t,b]),F=(0,s.useCallback)(()=>{k&&S&&S(k)},[k,S]),D=(0,s.useCallback)(e=>{k&&E&&E(k,e)},[k,E]);return(0,r.jsxs)("div",{"data-line":t,style:{position:"absolute",top:0,left:0,width:"100%",height:`${f}px`,transform:`translateY(${h}px)`,backgroundColor:N&&C?C.bg:void 0},className:`flex ${w===t?"flash-line":""} ${T?"vi-cursor-line":""} ${c?"bg-blue-9/20":a?"bg-amber-9/10":"hover:bg-accent/50"}`,children:[(0,r.jsxs)("div",{className:"flex shrink-0 sticky left-0 z-[2] bg-secondary",style:{backgroundColor:N&&C?C.bg:void 0},children:[k&&C&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-1 flex-shrink-0",style:{backgroundColor:C.border}}),(0,r.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:D,onMouseLeave:L,onClick:F,title:I("codeViewer.clickToViewCommit"),children:j?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"font-medium",style:{color:C.border},children:k.hash}),(0,r.jsx)("span",{className:"truncate flex-1",children:k.author.split(" ")[0]})]}):null})]}),u&&(0,r.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 ${c?"bg-blue-9/30 text-blue-11":"bg-card/50 text-slate-9"}`,children:[m&&a&&o&&(0,r.jsx)("button",{onClick:e=>x(o,e),className:"w-4 h-4 flex items-center justify-center rounded hover:bg-accent text-amber-9",title:I("codeViewer.nComments",{count:i}),children:(0,r.jsx)("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:(0,r.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"})})}),m&&!a&&(0,r.jsx)("span",{className:"w-4"}),(0,r.jsx)("span",{className:"text-right",style:{minWidth:`${d}ch`},children:t})]})]}),(0,r.jsxs)("span",{className:"flex-1 px-3 whitespace-pre select-text",onClick:_,onMouseOver:A,onMouseLeave:y,"data-code-content":!0,children:[(0,r.jsx)("span",{dangerouslySetInnerHTML:{__html:P}}),M&&(0,r.jsx)(g,{blame:M,onClick:R})]})]},e)});var w=n(64702),k=n(1058),j=n(90717),C=n(48347),N=n(27570);function S(e,t,n){let r,s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),l=0;for(;(r=s.nextNode())&&r!==t;)l+=r.textContent.length;return l+n}function E(e,t){let n,r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),s=t,l=null;for(;n=r.nextNode();){l=n;let e=n.textContent.length;if(s<=e)return{node:n,offset:s};s-=e}return l?{node:l,offset:l.textContent.length}:null}var L=n(82292),M=n(34075);let R="white-space:pre;padding:0 12px;min-height:20px;line-height:20px";function T(e){let t=window.getSelection();if(!t?.rangeCount)return null;let n=t.getRangeAt(0),r=n.startContainer;for(;r&&r.parentElement!==e;)r=r.parentElement;if(!r)return null;let s=Array.from(e.children).indexOf(r);if(s<0)return null;let l=document.createRange();return l.selectNodeContents(r),l.setEnd(n.startContainer,n.startOffset),{line:s,offset:l.toString().length}}function $(e,t){let n,r=e.children[t.line];if(!r)return;let s=document.createTreeWalker(r,NodeFilter.SHOW_TEXT),l=t.offset;for(;n=s.nextNode();){let e=n.textContent?.length||0;if(l<=e){let e=window.getSelection(),t=document.createRange();t.setStart(n,l),t.collapse(!0),e?.removeAllRanges(),e?.addRange(t);return}l-=e}let a=window.getSelection(),o=document.createRange();o.selectNodeContents(r),o.collapse(!1),a?.removeAllRanges(),a?.addRange(o)}function I(e){return e.map(e=>`<div style="${R}">${e}</div>`).join("")}let P=(0,s.forwardRef)(function({content:e,filePath:t,showLineNumbers:n=!0,showSearch:x=!0,className:p="",cwd:g,enableComments:v=!1,scrollToLine:P=null,scrollToLineAlign:_="center",onScrollToLineComplete:A,highlightKeyword:F=null,visibleLineRef:D,onCmdClick:O,onTokenHover:V,onTokenHoverLeave:B,onTokenHoverCancel:W,blameLines:H,inlineBlameLines:z,onSelectCommit:K,editable:U=!1,initialMtime:q,onEditorClose:X,onSaved:Z,onEditorStateChange:J,viMode:Y=!1,onContentMutate:Q,onEnterInsertMode:G,onViSave:ee,viStateRef:et,initialCursorLine:en,initialCursorCol:er,onInitialCursorSet:es,onContentSearch:el},ea){let{t:eo}=(0,l.Bd)(),ei=(0,s.useRef)(e),ec=(0,s.useRef)(!1),[eu,ed]=(0,s.useState)(!1),[em,ef]=(0,s.useState)(!1),[eh,ex]=(0,s.useState)(()=>e.split("\n").length),ep=(0,s.useRef)(e.split("\n").length),[eg,eb]=(0,s.useState)({show:!1}),ev=(0,s.useRef)(null),ey=(0,s.useRef)(null),ew=(0,s.useRef)(q),ek=(0,s.useRef)(null),ej=(0,s.useRef)(!1),eC=(0,s.useRef)(!1),{parentRef:eN,containerRef:eS,searchInputRef:eE,floatingToolbarRef:eL,suppressHoverRef:eM,bumpToolbarRef:eR,savedSelectionRef:eT,highlightedLines:e$,isMounted:eI,cmdHeld:eP,flashLine:e_,isSearchVisible:eA,searchQuery:eF,caseSensitive:eD,wholeWord:eO,currentMatchIndex:eV,viewingComment:eB,addCommentInput:eW,sendToAIInput:eH,aiBridge:ez,commentsEnabled:eK,updateComment:eU,deleteComment:eq,lines:eX,matches:eZ,rowData:eJ,virtualizer:eY,commentsByEndLine:eQ,linesWithComments:eG,setIsSearchVisible:e0,setSearchQuery:e1,setCaseSensitive:e2,setWholeWord:e5,setViewingComment:e4,setAddCommentInput:e3,setSendToAIInput:e8,goToNextMatch:e6,goToPrevMatch:e9,handleSearchKeyDown:e7,handleCommentBubbleClick:te,handleToolbarAddComment:tt,handleToolbarSendToAI:tn,handleToolbarSearch:tr,handleCommentSubmit:ts,handleSendToAISubmit:tl,getHighlightedLineHtml:ta,suppressMatchScrollRef:to,inlineBlameLineRef:ti,inlineBlameVersion:tc}=function({content:e,filePath:t,showSearch:n=!0,cwd:r,enableComments:l=!1,scrollToLine:a=null,scrollToLineAlign:o="center",onScrollToLineComplete:i,visibleLineRef:c,onContentSearch:u}){let[f,h]=(0,s.useState)(!1),x=(0,s.useRef)(null),p=(0,s.useRef)(null),g=(0,s.useRef)(null),b=(0,C.r)();(0,s.useEffect)(()=>{h(!0)},[]);let[v,y]=(0,s.useState)(!1),[E,L]=(0,s.useState)(null),M=(0,s.useRef)(null),[R,T]=(0,s.useState)(!1),[$,I]=(0,s.useState)(""),[P,_]=(0,s.useState)(!1),[A,F]=(0,s.useState)(!1),[D,O]=(0,s.useState)(0),[V,B]=(0,s.useState)(0),W=(0,s.useRef)(!1),[H,z]=(0,s.useState)(null),K=(0,s.useRef)(!1),U=(0,s.useRef)(null),[q,X]=(0,s.useState)(null),[Z,J]=(0,s.useState)(null),Y=(0,s.useMemo)(()=>e.split("\n"),[e]),[Q,G]=(0,s.useState)(null);(0,s.useEffect)(()=>{x.current!==Q&&G(x.current)});let ee=l&&!!r,{toolbarRef:et,bumpRef:en,clearToolbar:er}=(0,N.L)({enabled:ee,container:Q,resolveLineRange:e=>{if(!document.contains(e))return null;let t=e.nodeType===Node.TEXT_NODE?e.parentElement:e,n=t?.closest("[data-line]");if(!n)return null;let r=parseInt(n.getAttribute("data-line")||"0",10);return!Number.isFinite(r)||r<=0?null:{start:r,end:r}},buildLineSnapshot:({start:e,end:t})=>Y.slice(e-1,t).join("\n")}),es=(0,s.useRef)(null),[el,ea]=(0,s.useState)(0),{comments:eo,addComment:ei,updateComment:ec,deleteComment:eu,refresh:ed}=(0,k._)({cwd:r||"",filePath:t}),em=(0,d.C)(Y,t),ef=(0,s.useMemo)(()=>{let e=new Map;for(let t of eo){let n=t.endLine;e.has(n)||e.set(n,[]),e.get(n).push(t)}return e},[eo]),eh=(0,s.useMemo)(()=>{let e=new Set;for(let t of eo)for(let n=t.startLine;n<=t.endLine;n++)e.add(n);return e},[eo]),ex=(0,s.useMemo)(()=>(0,m.Np)(Y,$,P,A),[Y,$,P,A]);(0,s.useEffect)(()=>{ex.length>0&&O(0)},[ex.length,$,P,A]);let ep=(0,s.useMemo)(()=>{let e=[];for(let t=0;t<Y.length;t++)e.push({type:"code",lineIndex:t});return e},[Y.length]),eg=(0,w.Te)({count:ep.length,getScrollElement:()=>x.current,estimateSize:()=>20,overscan:10});(0,s.useEffect)(()=>{if(!c)return;let e=x.current;if(!e)return;let t=()=>{if(!eg.range)return;let t=e.scrollTop;for(let e of eg.getVirtualItems())if(e.start>=t){let t=ep[e.index];t?.type==="code"&&(c.current=t.lineIndex+1);return}};return e.addEventListener("scroll",t,{passive:!0}),t(),()=>e.removeEventListener("scroll",t)},[c,ep]),(0,s.useEffect)(()=>{let e=e=>{"Meta"===e.key&&y(!0)},t=e=>{"Meta"===e.key&&y(!1)},n=()=>y(!1);return window.addEventListener("keydown",e),window.addEventListener("keyup",t),window.addEventListener("blur",n),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",t),window.removeEventListener("blur",n)}},[]),(0,s.useEffect)(()=>{if(!n)return;let e=e=>{(e.metaKey||e.ctrlKey)&&"f"===e.key&&(e.preventDefault(),T(!0),setTimeout(()=>g.current?.focus(),0)),"Escape"===e.key&&(R?(T(!1),I("")):Z?J(null):q?X(null):et.current?er():H&&z(null))},t=p.current;if(t)return t.addEventListener("keydown",e),()=>t.removeEventListener("keydown",e)},[n,R,Z,q,H]),(0,s.useEffect)(()=>{if(W.current){W.current=!1;return}if(ex.length>0&&D>=0&&D<ex.length){let e=ex[D],t=ep.findIndex(t=>"code"===t.type&&t.lineIndex===e.lineIndex);t>=0&&eg.scrollToIndex(t,{align:"center"})}},[D,ex,eg,ep,V]);let eb=(0,s.useCallback)(()=>{0!==ex.length&&(O(e=>(e+1)%ex.length),B(e=>e+1))},[ex.length]),ev=(0,s.useCallback)(()=>{0!==ex.length&&(O(e=>(e-1+ex.length)%ex.length),B(e=>e+1))},[ex.length]),ey=(0,s.useRef)(a);ey.current=a,(0,s.useEffect)(()=>{if(null!==ey.current&&ey.current>0&&ep.length>0){let e=ey.current,t=e-1,n=ep.findIndex(e=>"code"===e.type&&e.lineIndex===t);if(n>=0){let t=()=>{eg.scrollToIndex(n,{align:o}),"center"===o&&(M.current&&clearTimeout(M.current),L(e),M.current=setTimeout(()=>L(null),500)),i?.()};"start"===o?requestAnimationFrame(t):setTimeout(t,150)}}},[a,o,ep.length,eg,i]);let ew=(0,s.useCallback)(e=>{"Enter"===e.key&&(e.preventDefault(),e.shiftKey?ev():eb()),"Escape"===e.key&&(T(!1),I(""))},[eb,ev]),ek=(0,s.useCallback)((e,t)=>{ee&&(t.stopPropagation(),z({comment:e,x:t.clientX,y:t.clientY}),er(),X(null),J(null))},[ee,er]);(0,s.useEffect)(()=>{if(!ee)return;let e=x.current,t=!1,n=()=>{t=!0,U.current=null,K.current=!0},r=()=>{t=!1;let e=window.getSelection();if(!e||e.isCollapsed||!e.toString().trim()){K.current=!1;return}let n=e.getRangeAt(0),r=x.current;if(!r||!r.contains(n.commonAncestorContainer))return;let s=n.startContainer,l=n.endContainer,a=(s.nodeType===Node.TEXT_NODE?s.parentElement:s)?.closest("[data-line]"),o=(l.nodeType===Node.TEXT_NODE?l.parentElement:l)?.closest("[data-line]");if(!a||!o)return;let i=parseInt(a.getAttribute("data-line")||"0",10),c=parseInt(o.getAttribute("data-line")||"0",10);i&&c&&(K.current=!0,U.current={startLine:i,startOffset:S(a,n.startContainer,n.startOffset),endLine:c,endOffset:S(o,n.endContainer,n.endOffset)})},s=()=>{if(t)return;let e=window.getSelection();e&&!e.isCollapsed&&e.toString().trim()||(U.current=null,K.current=!1)};return e?.addEventListener("mousedown",n),document.addEventListener("mouseup",r),document.addEventListener("selectionchange",s),()=>{e?.removeEventListener("mousedown",n),document.removeEventListener("mouseup",r),document.removeEventListener("selectionchange",s)}},[ee]),(0,s.useEffect)(()=>{let e=x.current;if(!e)return;let t=t=>{let n,r;if(!e.contains(t.target)){if(t.target.closest?.("[data-inline-blame-tip]"))return;null!==es.current&&(es.current=null,ea(e=>e+1));return}let s=window.getSelection();if(s&&!s.isCollapsed&&s.toString().trim())return;let l=(n=t.target,(r=n.closest?.("[data-line]"))?parseInt(r.getAttribute("data-line")||"0",10):null);l!==es.current&&(es.current=l,requestAnimationFrame(()=>ea(e=>e+1)))};return document.addEventListener("mouseup",t),()=>document.removeEventListener("mouseup",t)},[]);let ej=(0,s.useCallback)(()=>{let e=et.current;e&&(X({x:e.x,y:e.y,range:e.range,selectedText:e.selectedText,lineSnapshot:e.lineSnapshot}),er())},[er,et]),eC=(0,s.useCallback)(()=>{let e=et.current;e&&(J({x:e.x,y:e.y,range:e.range,selectedText:e.selectedText,lineSnapshot:e.lineSnapshot}),er())},[er,et]),eN=(0,s.useCallback)(()=>{let e=et.current;if(!e||!u)return;let t=e.selectedText.trim();er(),t&&u(t)},[u,er,et]),eS=(0,s.useCallback)(async e=>{q&&(await ei(q.range.start,q.range.end,e,q.selectedText),X(null))},[q,ei]),eE=(0,s.useCallback)(async e=>{if(Z&&b&&r)try{let n=await (0,j.$3)(r),s=[];for(let e of n)s.push({filePath:e.filePath,startLine:e.startLine,endLine:e.endLine,codeContent:e.codeContent,note:e.content||void 0});s.push({filePath:t,startLine:Z.range.start,endLine:Z.range.end,codeContent:Z.lineSnapshot});let l=(0,j.Gw)(s,e);b.sendMessage(l),await (0,j.RP)(r),ed(),J(null)}catch(e){console.error("Failed to send to AI:",e)}},[Z,b,t,r,ed]),eL=(0,s.useCallback)((e,t,n)=>{let r=Y[e];if(!r)return t;let s=[];if($&&ex.length>0)for(let t of ex.filter(t=>t.lineIndex===e)){let n=ex[D]?.lineIndex===e&&ex[D]?.startCol===t.startCol;s.push({start:t.startCol,end:t.endCol,cls:n?"hl-cur":"hl-m"})}if(n&&!$&&n.length>=1){let e=n.toLowerCase(),t=r.toLowerCase(),l=0;for(;-1!==(l=t.indexOf(e,l));)s.push({start:l,end:l+n.length,cls:"hl-kw"}),l+=1}if(0===s.length)return t;s.sort((e,t)=>e.start-t.start||e.end-t.end);let l=[],a=0;for(let e of s){if(e.start<a)continue;e.start>a&&l.push((0,m.ZD)(r.substring(a,e.start)));let t=(0,m.ZD)(r.substring(e.start,e.end));l.push(`<span class="${e.cls}">${t}</span>`),a=e.end}if(a<r.length&&l.push((0,m.ZD)(r.substring(a))),t!==(0,m.ZD)(r)){let e=t;for(let t of s){let n=r.substring(t.start,t.end),s=(0,m.ZD)(n),l=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=RegExp(`(?<=>)([^<]*?)(${l})`,""),o=`$1<span class="${t.cls}">${s}</span>`,i=e.replace(a,o);i.length>e.length+200||(e=i)}return e}return l.join("")},[$,ex,D,Y]);return{parentRef:x,containerRef:p,searchInputRef:g,floatingToolbarRef:et,suppressHoverRef:K,savedSelectionRef:U,highlightedLines:em,isMounted:f,cmdHeld:v,flashLine:E,isSearchVisible:R,searchQuery:$,caseSensitive:P,wholeWord:A,currentMatchIndex:D,viewingComment:H,bumpToolbarRef:en,addCommentInput:q,sendToAIInput:Z,aiBridge:b,commentsEnabled:ee,comments:eo,updateComment:ec,deleteComment:eu,lines:Y,matches:ex,rowData:ep,virtualizer:eg,commentsByEndLine:ef,linesWithComments:eh,setIsSearchVisible:T,setSearchQuery:I,suppressMatchScrollRef:W,setCaseSensitive:_,setWholeWord:F,setViewingComment:z,setAddCommentInput:X,setSendToAIInput:J,goToNextMatch:eb,goToPrevMatch:ev,handleSearchKeyDown:ew,handleCommentBubbleClick:ek,handleToolbarAddComment:ej,handleToolbarSendToAI:eC,handleToolbarSearch:eN,handleCommentSubmit:eS,handleSendToAISubmit:eE,getHighlightedLineHtml:eL,inlineBlameLineRef:es,inlineBlameVersion:el}}({content:e,filePath:t,showSearch:x,cwd:g,enableComments:!U&&v,scrollToLine:U?null:P,scrollToLineAlign:U?"center":_,onScrollToLineComplete:U?void 0:A,visibleLineRef:U?void 0:D,onContentSearch:el}),tu=(0,c.iN)(),td=(0,s.useRef)(null),tm=(0,s.useRef)(null),tf=(0,s.useRef)({line:0,col:0}),th=(0,s.useRef)({line:0,col:0}),tx=function({lines:e,enabled:t,onContentChange:n,onEnterInsert:r,onSave:l,getVisibleLineCount:a,scrollToLine:o,onSearchExecute:i,onSearchNext:c,onSearchPrev:u,onSearchClear:d}){let[m,f]=(0,s.useState)("normal"),[h,x]=(0,s.useState)(-1),[p,g]=(0,s.useState)(0),[b,v]=(0,s.useState)(!1),[y,w]=(0,s.useState)(""),[k,j]=(0,s.useState)(""),[C,N]=(0,s.useState)(""),[S,E]=(0,s.useState)(""),L=(0,s.useRef)([]),M=(0,s.useRef)([]),R=(0,s.useRef)([]),T=(0,s.useRef)(null),$=(0,s.useRef)(e);(0,s.useEffect)(()=>{$.current=e}),(0,s.useEffect)(()=>{0!==e.length&&queueMicrotask(()=>x(t=>Math.min(t,e.length-1)))},[e.length]);let I=(0,s.useCallback)((e,t)=>Math.max(0,Math.min(t,Math.max(0,($.current[e]??"").length-1))),[]),P=(0,s.useRef)(e.length);(0,s.useEffect)(()=>{let t=Math.abs(e.length-P.current);P.current=e.length,t>10&&(queueMicrotask(()=>{x(-1),g(0),v(!1)}),L.current=[],M.current=[],R.current=[])},[e]);let _=(0,s.useCallback)(()=>{T.current&&(clearTimeout(T.current),T.current=null),w("")},[]),A=(0,s.useCallback)(()=>{T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{w(""),T.current=null},500)},[]),F=(0,s.useCallback)((e,t)=>{L.current.push(t),M.current=[],v(!0),n(e.join("\n"))},[n]),D=(0,s.useCallback)((e,t)=>{let n=Math.max(0,Math.min(e,$.current.length-1));x(n),g(I(n,t??0)),o(n,"auto")},[o,I]),O=(0,s.useCallback)(e=>{x(t=>{let n=Math.max(0,Math.min(t+e,$.current.length-1));return o(n,"auto"),g(e=>Math.max(0,Math.min(e,Math.max(0,($.current[n]??"").length-1)))),n})},[o]),V=(0,s.useCallback)(()=>{let e=$.current,t=Math.min(h,e.length-1);if(0===e.length)return;let n=e[t];R.current=[n];let r=[...e];r.splice(t,1),0===r.length&&r.push("");let s=Math.min(t,r.length-1);F(r,{lineIndex:t,oldLines:[n],newLines:[],cursorLine:t}),x(s),g(0)},[h,F]),B=(0,s.useCallback)(()=>{let e=$.current,t=Math.min(h,e.length-1);e.length>0&&(R.current=[e[t]])},[h]),W=(0,s.useCallback)(()=>{let e=R.current;if(0===e.length)return;let t=$.current,n=Math.min(h,t.length-1)+1,r=[...t];r.splice(n,0,...e),F(r,{lineIndex:n,oldLines:[],newLines:[...e],cursorLine:h}),x(n),g(0),o(n,"auto")},[h,F,o]),H=(0,s.useCallback)(()=>{let e=$.current,t=Math.min(h,e.length-1),n=e[t];if(!n||0===n.length)return;let r=n.substring(1),s=[...e];s[t]=r,F(s,{lineIndex:t,oldLines:[n],newLines:[r],cursorLine:h})},[h,F]),z=(0,s.useCallback)(()=>{let e=L.current;if(0===e.length)return;let t=e.pop(),r=[...$.current];0===t.newLines.length&&t.oldLines.length>0?r.splice(t.lineIndex,0,...t.oldLines):0===t.oldLines.length&&t.newLines.length>0?(r.splice(t.lineIndex,t.newLines.length),0===r.length&&r.push("")):r.splice(t.lineIndex,t.newLines.length,...t.oldLines),M.current.push(t),n(r.join("\n")),x(Math.min(t.cursorLine,r.length-1)),o(Math.min(t.cursorLine,r.length-1),"auto"),0===e.length&&v(!1)},[n,o]),K=(0,s.useCallback)(()=>{let e=M.current;if(0===e.length)return;let t=e.pop(),r=[...$.current];0===t.newLines.length&&t.oldLines.length>0?(r.splice(t.lineIndex,t.oldLines.length),0===r.length&&r.push("")):0===t.oldLines.length&&t.newLines.length>0?r.splice(t.lineIndex,0,...t.newLines):r.splice(t.lineIndex,t.oldLines.length,...t.newLines),L.current.push(t),v(!0),n(r.join("\n"));let s=t.lineIndex+Math.max(0,t.newLines.length-1);x(Math.min(s,r.length-1)),o(Math.min(s,r.length-1),"auto")},[n,o]),U=(0,s.useCallback)(e=>{let t=$.current,n=Math.min(h,t.length-1);if("o"===e||"O"===e){let r="o"===e?n+1:n,s=[...t];s.splice(r,0,""),F(s,{lineIndex:r,oldLines:[],newLines:[""],cursorLine:h}),n=r,x(r)}f("insert"),r(n,p,e)},[h,p,F,r]),q=(0,s.useCallback)(()=>{f("normal"),_()},[_]),X=(0,s.useCallback)(()=>{f("command"),j("")},[]),Z=(0,s.useCallback)(()=>{f("normal"),j("")},[]),J=(0,s.useCallback)(()=>{f("search"),N("")},[]),Y=(0,s.useCallback)(()=>{f("normal"),N("")},[]),Q=(0,s.useCallback)(e=>{let t=e.trim();if("w"===t){l?.(),f("normal"),j("");return}if("q"===t){f("normal"),j("");return}if("wq"===t){l?.(),f("normal"),j("");return}if("noh"===t||"nohlsearch"===t){d?.(),f("normal"),j("");return}let n=parseInt(t,10);if(!isNaN(n)&&n>0){let e=Math.min(n-1,$.current.length-1);x(e),o(e,"center"),f("normal"),j("");return}f("normal"),j("")},[l,d,o]),G=(0,s.useCallback)(e=>{if(!e){f("normal"),N("");return}E(e),i?.(e),f("normal"),N("")},[i]),ee=(0,s.useCallback)(e=>{if(!t)return!1;let n=e.ctrlKey&&"c"===e.key&&!e.metaKey&&!e.shiftKey;if("insert"===m)return("Escape"===e.key||!!n)&&(q(),!0);if("command"===m)return!e.isComposing&&("Escape"===e.key||n?Z():"Enter"===e.key?Q(k):"Backspace"===e.key?0===k.length?Z():j(e=>e.slice(0,-1)):1!==e.key.length||e.metaKey||e.ctrlKey||j(t=>t+e.key),!0);if("search"===m)return!e.isComposing&&("Escape"===e.key||n?Y():"Enter"===e.key?G(C):"Backspace"===e.key?0===C.length?Y():N(e=>e.slice(0,-1)):1!==e.key.length||e.metaKey||e.ctrlKey||N(t=>t+e.key),!0);if(h<0&&(x(0),g(0)),e.metaKey)return!1;if(e.ctrlKey)return"d"===e.key?(O(Math.max(1,Math.floor(a()/2))),_(),!0):"u"===e.key?(O(-Math.max(1,Math.floor(a()/2))),_(),!0):"r"===e.key&&(K(),_(),!0);let r=e.key,s=y+r;if("g"===s)return w("g"),A(),!0;if("gg"===s)return D(0),_(),!0;if("d"===s)return w("d"),A(),!0;if("dd"===s)return V(),_(),!0;if("y"===s)return w("y"),A(),!0;if("yy"===s)return B(),_(),!0;if(y&&s!==r&&_(),"j"===r||"ArrowDown"===r)return O(1),!0;if("k"===r||"ArrowUp"===r)return O(-1),!0;if("h"===r||"ArrowLeft"===r)return g(e=>Math.max(0,e-1)),!0;if("l"===r||"ArrowRight"===r){let e=Math.max(0,($.current[h]??"").length-1);return g(t=>Math.min(e,t+1)),!0}if("0"===r)return g(0),!0;if("$"===r)return g(Math.max(0,($.current[h]??"").length-1)),!0;if("^"===r){let e=($.current[h]??"").search(/\S/);return g(e>=0?e:0),!0}return"G"===r?(D($.current.length-1),!0):"x"===r?(H(),!0):"p"===r?(W(),!0):"u"===r?(z(),!0):"i"===r||"a"===r||"I"===r||"A"===r||"o"===r||"O"===r?(U(r),!0):"/"===r?(J(),!0):"n"===r?(c?.(),!0):"N"===r?(u?.(),!0):":"===r?(X(),!0):"Escape"!==r&&1===r.length},[t,m,y,k,C,h,q,U,X,Z,J,Y,Q,G,O,D,a,V,B,W,H,z,K,_,A,c,u]);return{state:{mode:m,cursorLine:h,cursorCol:p,isDirty:b,keyBuffer:y,commandInput:k,searchInput:C,lastSearch:S},handleKeyDown:ee,enterNormal:q,enterInsert:U,setCursorLine:x,setCursorCol:g,setCommandInput:j,setSearchInput:N,setIsDirty:v,clearUndoHistory:(0,s.useCallback)(()=>{L.current=[],M.current=[]},[])}}({lines:eX,enabled:Y&&!U,onContentChange:e=>{tf.current={line:th.current.line,col:th.current.col},Q?.(e)},onEnterInsert:(e,t,n)=>{let r=t;if("a"===n)r=t+1;else if("A"===n)r=(eX[e]??"").length;else if("I"===n){let t=(eX[e]??"").search(/\S/);r=t>=0?t:0}else("o"===n||"O"===n)&&(r=0);tf.current={line:e,col:r},G?.(e)},onSave:ee,getVisibleLineCount:()=>{let e=eN.current;return e?Math.floor(e.clientHeight/20):20},scrollToLine:(e,t)=>{let n=eJ.findIndex(t=>"code"===t.type&&t.lineIndex===e);n>=0&&eY.scrollToIndex(n,{align:t||"auto"})},onSearchExecute:e=>{e1(e),e0(!1)},onSearchNext:e6,onSearchPrev:e9,onSearchClear:()=>{e1("")}});(0,s.useEffect)(()=>{et&&(et.current={cursorLine:tx.state.cursorLine,cursorCol:tx.state.cursorCol}),th.current={line:tx.state.cursorLine,col:tx.state.cursorCol}},[et,tx.state.cursorLine,tx.state.cursorCol]);let tp=(0,s.useRef)(null);(0,s.useEffect)(()=>{Y&&!U&&null!=en&&t&&tp.current!==t&&(tp.current=t,tx.setCursorLine(en-1),null!=er&&tx.setCursorCol(er-1),es?.())},[Y,U,en,er,t]),(0,s.useEffect)(()=>{if(!Y||U)return;let e=eS.current;if(!e)return;let t=e=>{let t=e.target;"TEXTAREA"===t.tagName||"INPUT"===t.tagName||t.isContentEditable||tx.handleKeyDown(e)&&(e.preventDefault(),e.stopPropagation())};return e.addEventListener("keydown",t,!0),()=>e.removeEventListener("keydown",t,!0)},[Y,U,tx.handleKeyDown]),(0,s.useEffect)(()=>{if(!Y||U)return;let e=eS.current;e&&"normal"===tx.state.mode&&requestAnimationFrame(()=>{let t=document.activeElement;t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName||t.isContentEditable)||e.focus()})},[Y,U,tx.state.mode,e]);let tg=(0,s.useCallback)(e=>{if(!Y||U)return;let t=e.target.closest("[data-line]");if(t){let n=parseInt(t.getAttribute("data-line"),10);if(!isNaN(n)){tx.setCursorLine(n-1);let r=t.querySelector("[data-code-content]");if(r){let t=document.caretRangeFromPoint(e.clientX,e.clientY);if(t&&r.contains(t.startContainer)){let e,s=document.createTreeWalker(r,NodeFilter.SHOW_TEXT),l=0;for(;e=s.nextNode();){if(e===t.startContainer){l+=t.startOffset;break}l+=e.textContent?.length||0}let a=eX[n-1]??"";tx.setCursorCol(Math.max(0,Math.min(l,Math.max(0,a.length-1))))}}}}let n=e.target;if("TEXTAREA"===n.tagName||"INPUT"===n.tagName||n.isContentEditable)return;let r=eS.current;r&&r.focus()},[Y,U,tx.setCursorLine,tx.setCursorCol,eX]),tb=(0,s.useCallback)(e=>{Y&&!U&&requestAnimationFrame(()=>{let e=window.getSelection(),t=e?.toString().trim();t&&/^\S+$/.test(t)&&(to.current=!0,e1(t))})},[Y,U,e1,to]);(0,s.useEffect)(()=>{"command"===tx.state.mode?setTimeout(()=>td.current?.focus(),0):"search"===tx.state.mode&&setTimeout(()=>tm.current?.focus(),0)},[tx.state.mode]),(0,s.useEffect)(()=>{let e=eN.current;if(!e)return;let t=()=>{(W??B)?.()};return e.addEventListener("mousedown",t),()=>e.removeEventListener("mousedown",t)},[W,B]),(0,s.useEffect)(()=>{eW||eH?(eM.current=!0,B?.()):eL.current||(eM.current=!1)},[eW,eH,B]),(0,s.useLayoutEffect)(()=>{let e=eT.current;if(!e)return;let t=window.getSelection();if(t&&!t.isCollapsed)return;let n=eN.current;if(!n)return;let r=n.querySelector(`[data-line="${e.startLine}"]`),s=n.querySelector(`[data-line="${e.endLine}"]`);if(!r||!s)return;let l=E(r,e.startOffset),a=E(s,e.endOffset);if(l&&a)try{let e=document.createRange();e.setStart(l.node,l.offset),e.setEnd(a.node,a.offset),t?.removeAllRanges(),t?.addRange(e)}catch{}});let tv=(0,s.useCallback)((e,t,n)=>{eM.current||V?.(e,t,n)},[V]),ty=(0,s.useCallback)((e,t)=>{eM.current||O?.(e,t)},[O]),tw=Math.max(4,String(U?eh:eX.length).length),tk=(0,s.useMemo)(()=>{let e=0;for(let t of eX){let n=0;for(let e=0;e<t.length;e++)" "===t[e]?n+=2-n%2:n+=1;n>e&&(e=n)}return e},[eX]);(0,s.useEffect)(()=>{if(U){ei.current=e;let t=e.split("\n").length;ep.current=t,ex(t),ec.current=!1,ed(!1),eb({show:!1}),ew.current=q}},[U,e,q]),(0,s.useEffect)(()=>{if(!U)return;let t=ev.current;if(!t)return;let n=e.split("\n");t.innerHTML=I(n.map((e,t)=>e$[t]||(0,m.ZD)(e||" "))),requestAnimationFrame(()=>{let e,r;Y?(e=Math.max(0,Math.min(tf.current.line,n.length-1)),r=tf.current.col):(e=Math.max(0,Math.min((D?.current??1)-1,n.length-1)),r=0),t.focus(),$(t,{line:e,offset:r});let s=D?.current??1;ey.current&&(ey.current.scrollTop=(s-1)*20)})},[U]),(0,s.useEffect)(()=>{U&&J?.({isDirty:eu,isSaving:em})},[U,eu,em,J]);let tj=(0,s.useCallback)(()=>{let e=ev.current;if(!e)return ei.current;let t=[];for(let n of e.childNodes){let e=n.textContent||"";t.push(" "===e?"":e)}return t.join("\n")},[]),tC=(0,s.useCallback)(()=>{ek.current&&clearTimeout(ek.current),ek.current=setTimeout(async()=>{let e=ev.current;if(e&&!eC.current){ei.current=tj();try{let n=await (0,m.kS)(),r=(0,m.sQ)(t),s=document.documentElement.classList.contains("dark"),l=ei.current.split("\n"),a=n.codeToTokens(l.join("\n"),{lang:r,theme:s?"github-dark":"github-light"}).tokens.map(e=>(0,m.b8)(e)),o=T(e);ej.current=!0,e.innerHTML=I(a),ej.current=!1,o&&$(e,o)}catch{}}},300)},[t,tj]);(0,s.useEffect)(()=>{if(U)return()=>{ek.current&&clearTimeout(ek.current)}},[U]);let tN=(0,s.useCallback)(()=>{let e=ev.current;if(!e)return;ec.current||(ec.current=!0,ed(!0));let t=e.children.length;t!==ep.current&&(ep.current=t,ex(t))},[]),tS=(0,s.useCallback)(()=>{ej.current||eC.current||(tN(),tC())},[tN,tC]),tE=(0,s.useCallback)(e=>{if(!e.nativeEvent.isComposing&&("Tab"===e.key&&(e.preventDefault(),document.execCommand("insertText",!1," ")),"Enter"===e.key)){e.preventDefault();let t=ev.current;if(!t)return;let n=window.getSelection();if(!n?.rangeCount)return;let r=n.getRangeAt(0);r.deleteContents();let s=r.startContainer;for(;s&&s.parentElement!==t;)s=s.parentElement;if(!s||!(s instanceof HTMLElement))return;let l=T(t),a=Array.from(t.children).indexOf(s),o=s.textContent||"",i=l?.offset??o.length,c=o.substring(0,i),u=o.substring(i);s.innerHTML=(0,m.ZD)(c||" ");let d=document.createElement("div");d.setAttribute("style",R),d.innerHTML=(0,m.ZD)(u||" "),s.after(d),$(t,{line:a+1,offset:0}),tN(),tC()}},[tN,tC]),tL=(0,s.useCallback)(e=>{e.preventDefault();let t=e.clipboardData.getData("text/plain");document.execCommand("insertText",!1,t)},[]),tM=(0,s.useCallback)(async(e=!1)=>{if(!g)return;ei.current=tj(),ef(!0);let n=await o.t4.runPromiseExit((0,i.OJ)({cwd:g,path:t,content:ei.current,expectedMtime:e?void 0:ew.current}));if("Failure"===n._tag){console.error("Error saving file:",n.cause),(0,M.oR)(eo("toast.saveFailed"),"error"),ef(!1);return}let r=n.value,s=r.data;if(409===r.status&&s?.conflict){let e=await o.t4.runPromiseExit((0,i.K9)(g,t));"Success"===e._tag&&e.value.ok&&"string"==typeof e.value.data?.content?eb({show:!0,diskContent:e.value.data.content}):eb({show:!0}),ef(!1);return}if(!r.ok){console.error("Error saving file: status",r.status),(0,M.oR)(eo("toast.saveFailed"),"error"),ef(!1);return}let l=s?.mtime;l&&(ew.current=l),ec.current=!1,ed(!1),eb({show:!1}),(0,M.oR)(eo("toast.savedSuccess"),"success"),Z?.(),ef(!1)},[g,t,tj,Z,eo]),tR=(0,s.useCallback)(async()=>{eu&&!em&&await tM(!1)},[eu,em,tM]),tT=(0,s.useCallback)(async()=>{eb({show:!1}),await tM(!0)},[tM]),t$=(0,s.useCallback)(()=>{if(void 0!==eg.diskContent){ei.current=eg.diskContent;let t=eg.diskContent.split("\n").length;ep.current=t,ex(t);let n=eg.diskContent!==e;ec.current=n,ed(n);let r=ev.current;r&&(r.innerHTML=I(eg.diskContent.split("\n").map(e=>(0,m.ZD)(e||" "))),tC())}eb({show:!1}),Z?.()},[eg.diskContent,e,Z,tC]),tI=(0,s.useCallback)(()=>{let e=ey.current;return e?Math.floor(e.scrollTop/20)+1:D?.current??1},[D]),tP=(0,s.useCallback)(async()=>{(!eu||await (0,M.lJ)(eo("codeViewer.unsavedConfirm"),{danger:!0,confirmText:eo("codeViewer.discardChanges"),cancelText:eo("codeViewer.continueEditing")}))&&X?.(tI())},[eu,X,tI]);(0,s.useEffect)(()=>{if(!U)return;let e=e=>{(e.metaKey||e.ctrlKey)&&"s"===e.key&&(e.preventDefault(),tR())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[U,tR]);let t_=(0,s.useCallback)(()=>{let e=tj();Q?.(e);let t=ev.current,n=t?T(t):null,r=tI();if(tx.enterNormal(),n){tx.setCursorLine(n.line);let t=e.split("\n")[n.line]??"";tx.setCursorCol(Math.max(0,Math.min(n.offset,Math.max(0,t.length-1))))}else tx.setCursorLine(Math.max(0,r-1));X?.(r)},[tj,Q,tI,X,tx]);(0,s.useEffect)(()=>{if(!U)return;let e=e=>{let t="Escape"===e.key,n=e.ctrlKey&&"c"===e.key&&!e.metaKey&&!e.shiftKey;(t||Y&&n)&&(e.preventDefault(),e.stopPropagation(),Y?ec.current?(0,M.lJ)(eo("codeViewer.unsavedExitConfirm"),{danger:!0,confirmText:eo("codeViewer.discardChanges"),cancelText:eo("codeViewer.continueEditing")}).then(e=>{e&&t_()}):t_():tP())};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[U,Y,tP,t_]);let tA=(0,s.useCallback)(()=>{ec.current||(ec.current=!0,ed(!0))},[]);(0,s.useImperativeHandle)(ea,()=>({save:tR,close:tP,markDirty:tA,get isDirty(){return ec.current},get isSaving(){return em}}),[tR,tP,tA,em]);let tF=!!(H&&H.length>0),tD=(0,s.useMemo)(()=>{if(!H)return new Map;let e=[...new Set(H.map(e=>e.author))],t=new Map;return e.forEach((e,n)=>{t.set(e,b[n%b.length])}),t},[H]),[tO,tV]=(0,s.useState)(null),[tB,tW]=(0,s.useState)(null);(0,s.useEffect)(()=>{tV(null),tW(null)},[H]);let tH=(0,s.useCallback)((e,t)=>{tV(e.author);let n=t.currentTarget.getBoundingClientRect();tW({line:e,x:n.right+8,y:n.top})},[]),tz=(0,s.useCallback)(()=>{tV(null),tW(null)},[]),tK=(0,s.useCallback)(e=>{K&&(K({hash:e.hashFull,shortHash:e.hash,author:e.author,authorEmail:e.authorEmail,date:new Date(1e3*e.time).toISOString(),subject:e.message.split("\n")[0]||"",body:e.message.split("\n").slice(1).join("\n").trim(),time:e.time}),tW(null))},[K]),tU=`${tw+2}ch`;return(0,r.jsxs)("div",{ref:eS,className:`h-full flex flex-col outline-none ${p}`,tabIndex:0,onClick:tg,onDoubleClick:tb,children:[U&&eg.show&&(0,r.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,r.jsx)("svg",{className:"w-5 h-5 text-amber-500 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.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,r.jsx)("span",{className:"text-sm text-foreground flex-1",children:eo("codeViewer.fileModifiedExternally")}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{onClick:t$,className:"px-3 py-1 text-sm rounded border border-border hover:bg-accent transition-colors",children:eo("codeViewer.useDiskVersion")}),(0,r.jsx)("button",{onClick:tT,className:"px-3 py-1 text-sm rounded bg-amber-500 text-white hover:bg-amber-600 transition-colors",children:eo("codeViewer.forceOverwrite")})]})]}),!U&&x&&eA&&(0,r.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-secondary border-b border-border",children:[(0,r.jsx)("input",{ref:eE,type:"text",value:eF,onChange:e=>e1(e.target.value),onKeyDown:e7,placeholder:eo("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,r.jsx)("button",{onClick:()=>e2(!eD),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${eD?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-accent"}`,title:eo("codeViewer.caseSensitive"),children:"Aa"}),(0,r.jsx)("button",{onClick:()=>e5(!eO),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${eO?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-accent"}`,title:eo("codeViewer.wholeWordMatch"),children:"[ab]"}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:eZ.length>0?`${eV+1}/${eZ.length}`:eo("common.noMatch")}),(0,r.jsx)("button",{onClick:e9,disabled:0===eZ.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:eo("common.previous"),children:(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})}),(0,r.jsx)("button",{onClick:e6,disabled:0===eZ.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:eo("common.next"),children:(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),(0,r.jsx)("button",{onClick:()=>{e0(!1),e1("")},className:"p-1 rounded hover:bg-accent",title:eo("common.close"),children:(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),U?(0,r.jsx)("div",{ref:ey,className:"flex-1 overflow-auto bg-secondary",children:(0,r.jsxs)("div",{className:"flex",style:{minHeight:"100%"},children:[(0,r.jsx)("div",{className:"flex-shrink-0 font-mono text-sm select-none sticky left-0 z-[2] bg-secondary",style:{width:tU},children:Array.from({length:eh},(e,t)=>(0,r.jsx)("div",{className:"text-right text-muted-foreground/50 pr-3",style:{height:20,lineHeight:"20px"},children:t+1},t))}),(0,r.jsx)("div",{ref:ev,contentEditable:!0,suppressContentEditableWarning:!0,onInput:tS,onKeyDown:tE,onPaste:tL,onCompositionStart:()=>{eC.current=!0},onCompositionEnd:()=>{eC.current=!1,tS()},spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",className:"flex-1 font-mono text-sm outline-none",style:{caretColor:"var(--foreground)",tabSize:2}})]})}):(0,r.jsx)("div",{ref:eN,className:`flex-1 overflow-auto font-mono text-sm bg-secondary${eP?" cmd-held-container":""}`,children:(0,r.jsx)("div",{style:{height:`${eY.getTotalSize()}px`,minWidth:"100%",width:tF?`calc(${tw+tk+10}ch + 13rem)`:`${tw+tk+10}ch`,position:"relative"},children:eY.getVirtualItems().map(e=>{let t=eJ[e.index];if("code"!==t.type)return null;let s=t.lineIndex,l=s+1,a=e$[s]||(0,m.ZD)(eX[s]||""),o=ta(s,a,F),i=eG.has(l),c=eQ.get(l),u=c?.[0],d=!!(eW&&l>=eW.range.start&&l<=eW.range.end),f=tc>=0?ti.current:null,h=!U&&z&&f===l?z[s]??null:null,x=tF?H[s]:void 0,p=tF&&s>0?H[s-1]:void 0,g=!!x&&(!p||p.hash!==x.hash),b=x?tD.get(x.author):void 0;return(0,r.jsx)(y,{virtualKey:e.key,lineNum:l,highlightedHtml:o,hasComments:i,firstComment:u,lineCommentsCount:c?.length,isInRange:d,showLineNumbers:n,lineNumChars:tw,commentsEnabled:eK,virtualItemSize:e.size,virtualItemStart:e.start,onCommentBubbleClick:te,onCmdClick:ty,onTokenHover:tv,onTokenHoverLeave:B,flashLine:e_,blameLine:x,showBlameInfo:g,blameAuthorColor:b,isBlameHovered:!!(x&&tO===x.author),onBlameClick:tK,onBlameMouseEnter:tH,onBlameMouseLeave:tz,inlineBlameData:h,onInlineBlameClick:tK,isCursorLine:Y&&!U&&tx.state.cursorLine===s,cursorCol:Y&&!U&&tx.state.cursorLine===s?tx.state.cursorCol:void 0},e.key)})})}),Y&&(0,r.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"===tx.state.mode&&(0,r.jsx)("span",{className:"text-green-11 font-medium",children:"NORMAL"}),"insert"===tx.state.mode&&(0,r.jsx)("span",{className:"text-blue-11 font-medium",children:"INSERT"}),"command"===tx.state.mode&&(0,r.jsxs)("div",{className:"flex items-center flex-1",children:[(0,r.jsx)("span",{className:"text-foreground",children:":"}),(0,r.jsx)("input",{ref:td,value:tx.state.commandInput,onChange:e=>tx.setCommandInput(e.target.value),onKeyDown:e=>{if(e.nativeEvent.isComposing)return;let t=e.ctrlKey&&"c"===e.key&&!e.metaKey&&!e.shiftKey;("Enter"===e.key||"Escape"===e.key||t)&&(e.preventDefault(),e.stopPropagation(),tx.handleKeyDown(e.nativeEvent))},className:"flex-1 bg-transparent outline-none text-foreground ml-0.5",spellCheck:!1,autoComplete:"off"})]}),"search"===tx.state.mode&&(0,r.jsxs)("div",{className:"flex items-center flex-1",children:[(0,r.jsx)("span",{className:"text-foreground",children:"/"}),(0,r.jsx)("input",{ref:tm,value:tx.state.searchInput,onChange:e=>tx.setSearchInput(e.target.value),onKeyDown:e=>{if(e.nativeEvent.isComposing)return;let t=e.ctrlKey&&"c"===e.key&&!e.metaKey&&!e.shiftKey;("Enter"===e.key||"Escape"===e.key||t)&&(e.preventDefault(),e.stopPropagation(),tx.handleKeyDown(e.nativeEvent))},className:"flex-1 bg-transparent outline-none text-foreground ml-0.5",spellCheck:!1,autoComplete:"off"})]}),tx.state.keyBuffer&&"normal"===tx.state.mode&&(0,r.jsx)("span",{className:"ml-2 text-muted-foreground",children:tx.state.keyBuffer}),tx.state.isDirty&&("normal"===tx.state.mode||"command"===tx.state.mode)&&(0,r.jsx)("span",{className:"ml-2 text-amber-11",children:"[+]"}),(0,r.jsxs)("span",{className:"ml-auto text-muted-foreground",children:[tx.state.cursorLine+1,":",tx.state.cursorCol+1]})]}),eI&&tu&&(0,a.createPortal)((0,r.jsxs)(r.Fragment,{children:[!U&&(0,r.jsx)(f.f,{floatingToolbarRef:eL,bumpRef:eR,container:tu,onAddComment:tt,onSendToAI:tn,onSearch:el?tr:void 0,isChatLoading:ez?.isLoading}),!U&&eW&&(0,r.jsx)(u.t,{x:eW.x,y:eW.y,range:eW.range,lineSnapshot:eW.lineSnapshot,container:tu,onSubmit:ts,onClose:()=>e3(null)}),!U&&eH&&(0,r.jsx)(u.G,{x:eH.x,y:eH.y,range:eH.range,filePath:t,lineSnapshot:eH.lineSnapshot,container:tu,onSubmit:tl,onClose:()=>e8(null),isChatLoading:ez?.isLoading}),!U&&eB&&(0,r.jsx)(h.t,{x:eB.x,y:eB.y,comment:eB.comment,container:tu,onClose:()=>e4(null),onUpdateComment:eU,onDeleteComment:eq}),tB&&(0,r.jsxs)("div",{className:"fixed z-50 bg-card border border-border rounded-lg shadow-lg p-3 max-w-lg",style:{left:Math.min(tB.x,window.innerWidth-450),top:Math.max(8,Math.min(tB.y,window.innerHeight-200))},children:[(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"px-2 py-0.5 rounded text-xs font-mono font-medium text-white flex-shrink-0",style:{backgroundColor:tD.get(tB.line.author)?.border||"#666"},children:tB.line.hash}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:"text-sm font-medium text-foreground",children:tB.line.author}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:tB.line.authorEmail})]})]}),(0,r.jsx)("div",{className:"mt-2 text-sm text-foreground whitespace-pre-wrap max-h-48 overflow-y-auto",children:tB.line.message}),(0,r.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground border-t border-border pt-2",children:[(0,L.fw)(tB.line.time)," \xb7 ",new Date(1e3*tB.line.time).toLocaleString(),(0,r.jsx)("span",{className:"ml-2 text-brand",children:eo("codeViewer.clickToViewDetails")})]})]})]}),tu)]})});function _({content:e,filePath:t,className:n=""}){let l=(0,s.useMemo)(()=>e.split("\n"),[e]),a=(0,d.C)(l,t),o=Math.max(4,String(l.length).length);return(0,r.jsx)("pre",{className:`overflow-auto text-sm font-mono bg-secondary p-2 ${n}`,children:l.map((e,t)=>(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)("span",{className:"text-slate-9 select-none pr-4 text-right",style:{minWidth:`${o+2}ch`},children:t+1}),(0,r.jsx)("span",{className:"flex-1",dangerouslySetInnerHTML:{__html:a[t]||(0,m.ZD)(e||" ")}})]},t))})}},46456:(e,t,n)=>{n.d(t,{$:()=>i,BC:()=>c,Tu:()=>d,lb:()=>o,tj:()=>m,vv:()=>u});var r=n(49433),s=n(82680);let l=(e,t)=>r.tryPromise({try:async()=>{let n=await fetch(e,t);if(!n.ok)throw Error(`HTTP ${n.status}`);return await n.json()},catch:n=>new s.uV({message:`${t?.method??"GET"} ${e} failed`,cause:n})}),a=(e,t)=>r.tryPromise({try:async()=>{let n=await fetch(e,t);if(!n.ok)throw Error(`HTTP ${n.status}`)},catch:n=>new s.uV({message:`${t.method} ${e} failed`,cause:n})}),o=(e,t)=>l(`/api/comments?cwd=${encodeURIComponent(e)}${t?`&filePath=${encodeURIComponent(t)}`:""}`),i=e=>l(`/api/comments?cwd=${encodeURIComponent(e)}&all=true`),c=e=>l("/api/comments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),u=(e,t,n)=>l("/api/comments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,id:t,content:n})}),d=(e,t)=>a(`/api/comments?cwd=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`,{method:"DELETE"}),m=e=>a(`/api/comments?cwd=${encodeURIComponent(e)}&all=true`,{method:"DELETE"})},47215:(e,t,n)=>{n.d(t,{C6:()=>a,Hz:()=>b,WU:()=>v,aR:()=>g,cG:()=>i,e$:()=>p,jU:()=>l,oK:()=>y,u:()=>x,xb:()=>c,zs:()=>f});var r=n(12115),s=n(69809);function l(e){try{return JSON.parse(e),!0}catch{return!1}}function a(e){try{let t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}}let o={key:"#79c0ff",str:"#a5d6ff",num:"#79c0ff",bool:"#ff7b72",punct:"#8b949e",fold:"#6e7681"},i={key:"hsl(var(--blue-11))",str:"hsl(var(--green-11))",num:"hsl(var(--violet-11))",bool:"hsl(var(--red-11))",punct:"hsl(var(--slate-11))",fold:"hsl(var(--slate-11))"};function c(e,t=o){try{let n=JSON.parse(e);return m(n,0,t)}catch{return e}}let u=(e,t)=>r.createElement("span",{style:{color:e}},t);function d({label:e,labelColor:t,value:n,indent:l,colors:a}){let[o,i]=r.useState(!1),[c,f]=r.useState({x:0,y:0}),h="string"==typeof n&&n.replace(/\\n/g,"\n").split("\n").length>3,x={onMouseDown:e=>{f({x:e.clientX,y:e.clientY})},onClick:e=>{let t=e.clientX-c.x,n=e.clientY-c.y;t*t+n*n>25||(e.stopPropagation(),i(e=>!e))},style:{cursor:"pointer"}};if(h&&o&&"string"==typeof n){let l=n.replace(/\\n/g,"\n").split("\n")[0],o=n.replace(/\\n/g,"\n").split("\n").length;return r.createElement("span",x,u(t,e),u(a.punct,": "),u(a.str,l),u(a.fold,` ${s.A.t("toolCall.foldedLines",{count:o})}`))}let p=r.createElement(r.Fragment,null,u(t,e),u(a.punct,": "),m(n,l,a));return h?r.createElement("span",x,p):p}function m(e,t,n){let s=" ".repeat(t);if(null===e)return u(n.bool,"null");if(void 0===e)return u(n.bool,"undefined");if("string"==typeof e){let t=e.replace(/\\n/g,"\n").replace(/\n/g,"\n"+s);return u(n.str,t)}if("number"==typeof e)return u(n.num,String(e));if("boolean"==typeof e)return u(n.bool,String(e));if(Array.isArray(e))return 0===e.length?u(n.punct,"[]"):r.createElement(r.Fragment,null,u(n.punct,"["),"\n",...e.map((l,a)=>r.createElement("span",{key:a},s+" ",r.createElement(d,{label:`[${a}]`,labelColor:n.key,value:l,indent:t+1,colors:n}),a<e.length-1?r.createElement(r.Fragment,null,u(n.punct,","),"\n"):"\n")),s,u(n.punct,"]"));if("object"==typeof e){let l=Object.entries(e);return 0===l.length?u(n.punct,"{}"):r.createElement(r.Fragment,null,u(n.punct,"{"),"\n",...l.map(([e,a],o)=>r.createElement("span",{key:e},s+" ",r.createElement(d,{label:e,labelColor:n.key,value:a,indent:t+1,colors:n}),o<l.length-1?r.createElement(r.Fragment,null,u(n.punct,","),"\n"):"\n")),s,u(n.punct,"}"))}return String(e)}function f(e){try{let t=JSON.parse(e);if(t&&"string"==typeof t.file_path&&"string"==typeof t.old_string&&"string"==typeof t.new_string)return t}catch{}return null}let h=new Set([".png",".jpg",".jpeg",".gif",".webp",".svg",".bmp",".ico",".avif"]);function x(e){let t=e.slice(e.lastIndexOf(".")).toLowerCase();return h.has(t)}function p(e){return e.toLowerCase().endsWith(".md")}function g(e){let t=e.toLowerCase();return t.endsWith(".html")||t.endsWith(".htm")}function b(e){return e.toLowerCase().endsWith(".json")}function v(e,t){let n=t.startsWith("/")?[]:e.split("/").slice(0,-1);for(let e of t.replace(/^\//,"").split("/"))""!==e&&"."!==e&&(".."===e?n.pop():n.push(e));return n.join("/")}function y(e){try{let t=JSON.parse(e);if(t&&"string"==typeof t.file_path)return t.file_path}catch{let t=e.trim();if(t.startsWith("/")&&!t.includes("\n")&&t.length<500)return t}return null}},48347:(e,t,n)=>{n.d(t,{H:()=>a,r:()=>o});var r=n(95155),s=n(12115);let l=(0,s.createContext)(null);function a({value:e,children:t}){return(0,r.jsx)(l.Provider,{value:e,children:t})}function o(){return(0,s.useContext)(l)}},48948:(e,t,n)=>{n.d(t,{F:()=>r});function r(e,t,n){let{engine:r,assistantId:s}=n;if("stream_event"===t.type){let n=t.event;if(n?.type==="content_block_delta"&&n.delta?.type==="text_delta"&&n.delta.text){let t=n.delta.text;return e.map(e=>e.id===s?{...e,content:(e.content||"")+t}:e)}return e}if("assistant"===t.type){let n=t.message?.content;if(!Array.isArray(n))return e;let l=e,a=t.message?.model==="<synthetic>";if("codex"===r||"kimi"===r||"ollama"===r||a){let e=n.filter(e=>"text"===e.type&&e.text).map(e=>e.text).join("");e&&(l=l.map(t=>t.id===s?{...t,content:(t.content||"")+e}:t))}for(let e of n)if(e.name){let t={id:e.id||`tool-${s}-${e.name}`,name:e.name,input:e.input||{},isLoading:!0};l=l.map(e=>e.id!==s||e.toolCalls?.some(e=>e.id===t.id)?e:{...e,toolCalls:[...e.toolCalls||[],t]})}return l}if("user"===t.type){let n=t.message?.content;if(!Array.isArray(n))return e;let r=e;for(let e of n)if(e.tool_use_id){let t=e.tool_use_id,n="string"==typeof e.content?e.content:JSON.stringify(e.content);r=r.map(e=>e.id===s?{...e,toolCalls:e.toolCalls?.map(e=>e.id===t?{...e,result:n,isLoading:!1}:e)}:e)}return r}if("error"===t.type){let n=t.error||"An error occurred. Please try again.";return e.map(e=>e.id===s?{...e,content:e.content?`${e.content}
|
|
9
9
|
|
|
10
10
|
⚠️ ${n}`:`⚠️ ${n}`,isStreaming:!1}:e)}if("result"===t.type){let n="string"==typeof t.result?t.result.trim():"";return e.map(e=>e.id===s?{...e,content:!e.content&&n?n:e.content,isStreaming:!1,toolCalls:e.toolCalls?.map(e=>({...e,isLoading:!1}))}:e)}return e}},50860:(e,t,n)=>{n.d(t,{I:()=>o});var r=n(95155),s=n(12115),l=n(86957),a=n(60938);function o(e){let{refreshKey:t,className:n="h-full flex items-center justify-center p-4 bg-secondary",imgClassName:o="max-w-full max-h-full object-contain",alt:i}=e,c="absPath"in e&&"string"==typeof e.absPath,u=c?void 0:e.cwd,d=c?void 0:e.path,m=c?e.absPath:void 0,[f,h]=(0,s.useState)({kind:"loading"}),x=(0,s.useRef)(0);if((0,s.useEffect)(()=>{let e=++x.current;return h({kind:"loading"}),(async()=>{if(c){if(e!==x.current)return;h({kind:"ready",etag:null,size:0});return}let t=await l.t4.runPromiseExit((0,a.r6)(u,d));if(e!==x.current)return;if("Failure"===t._tag){let e="Fail"===t.cause._tag?t.cause.error:null,n=e?.cause;h({kind:"error",message:n instanceof Error?n.message:"Unknown error"});return}let n=t.value;if(!n.ok)return h({kind:"error",message:`stat failed (${n.status})`});let r=n.data;r&&r.exists?"too-large"===r.category?h({kind:"too-large",size:r.size??0}):"image"!==r.category?h({kind:"error",message:`Not an image (${r.category})`}):h({kind:"ready",etag:r.etag||`t-${r.mtimeMs??Date.now()}`,size:r.size??0}):h({kind:"missing"})})(),()=>{x.current++}},[c,u,d,m,t]),"loading"===f.kind)return(0,r.jsx)("div",{className:n,children:(0,r.jsx)("span",{className:"inline-block w-6 h-6 border-2 border-brand border-t-transparent rounded-full animate-spin"})});if("missing"===f.kind)return(0,r.jsx)("div",{className:n,children:(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:"File not found"})});if("too-large"===f.kind)return(0,r.jsx)("div",{className:n,children:(0,r.jsxs)("div",{className:"text-sm text-muted-foreground",children:["Image too large to preview (",Math.round(f.size/1024/1024)," MB)"]})});if("error"===f.kind)return(0,r.jsx)("div",{className:n,children:(0,r.jsx)("div",{className:"text-sm text-red-11",children:f.message})});let p=c?`/api/file?path=${encodeURIComponent(m)}&raw=true`:`/api/files/read?cwd=${encodeURIComponent(u)}&path=${encodeURIComponent(d)}&v=${encodeURIComponent(f.etag)}`;return(0,r.jsx)("div",{className:n,children:(0,r.jsx)("img",{src:p,alt:i??(d||m),className:o})})}},56045:(e,t,n)=>{n.d(t,{_:()=>o,o:()=>a});var r=n(12115),s=n(69809);let l="json-search-highlight-style";function a(e){let[t,n]=(0,r.useState)(!1),[s,a]=(0,r.useState)(""),[o,i]=(0,r.useState)(!1),[c,u]=(0,r.useState)(0),[d,m]=(0,r.useState)(0),f=(0,r.useRef)(null),h=(0,r.useRef)([]),x=(0,r.useCallback)(()=>{let t;CSS.highlights?.delete("json-search"),CSS.highlights?.delete("json-search-current"),h.current=[];let n=e.current;if(!n||!s){u(0),m(0);return}!function(){if(document.getElementById(l))return;let e=document.createElement("style");e.id=l,e.textContent="::highlight(json-search){background:rgba(217,119,6,.3)}::highlight(json-search-current){background:rgba(217,119,6,.5)}",document.head.appendChild(e)}();let r=n.textContent||"",a=o?s:s.toLowerCase(),i=o?r:r.toLowerCase(),c=[],d=0;for(;d<i.length;){let e=i.indexOf(a,d);if(-1===e)break;c.push([e,e+a.length]),d=e+1}if(0===c.length){u(0),m(0);return}let f=document.createTreeWalker(n,NodeFilter.SHOW_TEXT),x=0,p=0,g=[],b=null,v=0;for(;(t=f.nextNode())&&p<c.length;){let e=t.textContent?.length||0,n=x,r=x+e;for(;p<c.length;){let[e,s]=c[p];if(e>=r)break;if(!b)if(e>=n)(b=document.createRange()).setStart(t,e-n),v=s;else break;if(v<=r)b.setEnd(t,v-n),g.push(b),b=null,p++;else break}x=r}h.current=g,u(g.length),m(e=>g.length>0?Math.min(e,g.length-1):0),CSS.highlights&&g.length>0&&CSS.highlights.set("json-search",new Highlight(...g))},[e,s,o]),p=(0,r.useCallback)((e,t)=>{let n=e.getBoundingClientRect();(t.top<n.top||t.bottom>n.bottom)&&(e.scrollTop+=t.top-n.top-n.height/2+t.height/2)},[]),g=(0,r.useCallback)(t=>{CSS.highlights?.delete("json-search-current");let n=h.current[t];if(!n||!CSS.highlights)return;CSS.highlights.set("json-search-current",new Highlight(n));let r=n.getBoundingClientRect(),s=e.current?.parentElement;s&&p(s,r)},[e,p]);(0,r.useEffect)(()=>{queueMicrotask(()=>x())},[x]),(0,r.useEffect)(()=>{g(d)},[d,c,g]),(0,r.useEffect)(()=>{let t=e.current;if(!t||!s)return;let n=new MutationObserver(()=>x());return n.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>n.disconnect()},[e,s,x]),(0,r.useEffect)(()=>{t||(CSS.highlights?.delete("json-search"),CSS.highlights?.delete("json-search-current"),h.current=[])},[t]),(0,r.useEffect)(()=>()=>{CSS.highlights?.delete("json-search"),CSS.highlights?.delete("json-search-current")},[]);let b=(0,r.useCallback)(()=>{0!==c&&m(e=>(e+1)%c)},[c]),v=(0,r.useCallback)(()=>{0!==c&&m(e=>(e-1+c)%c)},[c]),y=(0,r.useCallback)(()=>{n(!0),setTimeout(()=>f.current?.focus(),0)},[]),w=(0,r.useCallback)(()=>{n(!1),a(""),m(0)},[]),k=(0,r.useCallback)(e=>{"Enter"===e.key&&(e.preventDefault(),e.shiftKey?v():b()),"Escape"===e.key&&(e.preventDefault(),w())},[b,v,w]);return{isVisible:t,query:s,setQuery:a,caseSensitive:o,setCaseSensitive:i,matchCount:c,currentIndex:d,searchInputRef:f,open:y,close:w,goToNext:b,goToPrev:v,handleKeyDown:k}}function o({search:e}){return e.isVisible?r.createElement("div",{className:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-secondary border-b border-border"},r.createElement("input",{ref:e.searchInputRef,type:"text",value:e.query,onChange:t=>e.setQuery(t.target.value),onKeyDown:e.handleKeyDown,placeholder:s.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"}),r.createElement("button",{onClick:()=>e.setCaseSensitive(e=>!e),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${e.caseSensitive?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-accent"}`,title:s.A.t("codeViewer.caseSensitive")},"Aa"),r.createElement("span",{className:"text-xs text-muted-foreground"},e.matchCount>0?`${e.currentIndex+1}/${e.matchCount}`:s.A.t("common.noMatch")),r.createElement("button",{onClick:e.goToPrev,disabled:0===e.matchCount,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:s.A.t("common.previous")},r.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"}))),r.createElement("button",{onClick:e.goToNext,disabled:0===e.matchCount,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:s.A.t("common.next")},r.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"}))),r.createElement("button",{onClick:e.close,className:"p-1 rounded hover:bg-accent",title:s.A.t("common.close")},r.createElement("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})))):null}},56978:(e,t,n)=>{n.d(t,{C:()=>l});var r=n(12115),s=n(17196);function l(e,t){let[n,l]=(0,r.useState)(null),[a,o]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=()=>{o(document.documentElement.classList.contains("dark"))};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]);let i=(0,r.useMemo)(()=>e.join("\n"),[e]),c=`${i}:${t}:${a}`,u=(0,r.useMemo)(()=>n&&n.key===c?n.html:e.map(e=>(0,s.ZD)(e||" ")),[e,c,n]);return(0,r.useEffect)(()=>{if(0===e.length)return;let n=!1;return(async()=>{try{let r=await (0,s.kS)();if(n)return;let o=(0,s.sQ)(t),i=e.join("\n"),u=r.codeToTokens(i,{lang:o,theme:a?"github-dark":"github-light"}),d=[];for(let e=0;e<u.tokens.length;e++)if(d[e]=(0,s.b8)(u.tokens[e]),e%500==0&&e>0&&(await new Promise(e=>setTimeout(e,0)),n))return;l({key:c,html:d})}catch(e){console.error("Line highlight error:",e)}})(),()=>{n=!0}},[i,t,a]),u}},60938:(e,t,n)=>{n.d(t,{DZ:()=>c,Ft:()=>f,K9:()=>p,Nn:()=>w,OJ:()=>b,VK:()=>k,YW:()=>m,__:()=>y,dt:()=>v,eA:()=>g,eE:()=>h,gZ:()=>u,mP:()=>i,nM:()=>j,r6:()=>x,r9:()=>d});var r=n(49433),s=n(82680);let l=(e,t={})=>r.tryPromise({try:async()=>{let n=await fetch(e,t.init);if(t.passThroughStatuses&&t.passThroughStatuses.includes(n.status))return await n.json().catch(()=>({}));if(!n.ok){let e;try{e=(await n.json()).error}catch{}throw Error(e||`HTTP ${n.status}`)}return await n.json()},catch:t=>new s.uV({message:`GET ${e} failed`,cause:t})}),a=(e,t)=>r.tryPromise({try:async()=>{let n=await fetch(e,t),r=null;try{r=await n.json()}catch{}return{status:n.status,ok:n.ok,data:r}},catch:t=>new s.uV({message:`GET ${e} failed`,cause:t})}),o=(e,t)=>r.tryPromise({try:async()=>{let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw Error(`HTTP ${n.status}`)},catch:t=>new s.uV({message:`POST ${e} failed`,cause:t})}),i=e=>l(`/api/files/init?cwd=${encodeURIComponent(e)}`),c=e=>l(`/api/files/index?cwd=${encodeURIComponent(e)}`),u=(e,t)=>l(`/api/files/readdir?cwd=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`),d=e=>l(`/api/files/recent?cwd=${encodeURIComponent(e)}`),m=(e,t,n)=>o("/api/files/recent",{cwd:e,file:t,...n??{}}),f=(e,t)=>o("/api/files/expanded",{cwd:e,paths:t}),h=(e,t)=>l(`/api/files/blame?cwd=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`).pipe(r.catchAll(e=>r.succeed({error:e.message}))),x=(e,t)=>a(`/api/files/stat?cwd=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`,{cache:"no-store"}),p=(e,t)=>a(`/api/files/text?cwd=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`,{cache:"no-store"}),g=e=>l(`/api/files/text?${e.toString()}`),b=e=>r.tryPromise({try:async()=>{let t=await fetch("/api/files/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=null;try{n=await t.json()}catch{}return{status:t.status,ok:t.ok,data:n}},catch:e=>new s.uV({message:"POST /api/files/save failed",cause:e})}),v=()=>l("/api/files/clipboard"),y=e=>r.tryPromise({try:async()=>{let t=await fetch("/api/files/clipboard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error(`HTTP ${t.status}`)},catch:e=>new s.uV({message:"POST /api/files/clipboard failed",cause:e})}),w=e=>r.tryPromise({try:async()=>{let t=await fetch("/api/files/paste",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n?.error||`HTTP ${t.status}`);return n},catch:e=>new s.uV({message:"POST /api/files/paste failed",cause:e})}),k=e=>r.tryPromise({try:async()=>{let t=await fetch("/api/files/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n?.error||`HTTP ${t.status}`);return n},catch:e=>new s.uV({message:"POST /api/files/delete failed",cause:e})}),j=e=>l(`/api/file?path=${encodeURIComponent(e)}`)},65153:(e,t,n)=>{n.d(t,{u:()=>a});var r=n(12115),s=n(2111),l=n(48948);function a(e,t,n,a,o){let i=(0,r.useRef)(null),c=(0,r.useRef)(0),u=(0,r.useRef)(!1),d=()=>{let e=`live-asst-${++c.current}`;return i.current=e,t(t=>[...t,{id:e,role:"assistant",content:"",isStreaming:!0}]),e},m=e=>{if("system"===e.type&&"init"===e.subtype){u.current=!0,d();return}if("system"===e.type&&"task_notification"===e.subtype){if(!u.current){let n=`live-tasknotif-${e.task_id||++c.current}`,r=`<task-notification>
|
|
11
11
|
`+(e.task_id?`<task-id>${e.task_id}</task-id>
|