@surething/cockpit 1.0.192 → 1.0.194
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 +3 -3
- package/.next-prod/build-manifest.json +3 -3
- package/.next-prod/prerender-manifest.json +3 -3
- 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_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/_not-found.html +2 -2
- package/.next-prod/server/app/_not-found.rsc +4 -3
- package/.next-prod/server/app/_not-found.segments/_full.segment.rsc +4 -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 +4 -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 +3 -2
- package/.next-prod/server/app/api/commands/route.js +1 -1
- package/.next-prod/server/app/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/project/page.js +7 -7
- 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_client-reference-manifest.js +1 -1
- package/.next-prod/server/app-paths-manifest.json +3 -3
- package/.next-prod/server/chunks/2338.js +1 -1
- package/.next-prod/server/chunks/4732.js +1 -1
- package/.next-prod/server/middleware-build-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/3579-2dddc4a9ac5a5b31.js +1 -0
- package/.next-prod/static/chunks/9062-cf3c7d314edd19d0.js +1 -0
- package/.next-prod/static/chunks/app/{layout-44210aade5d56585.js → layout-fc306a84f663d5af.js} +1 -1
- package/.next-prod/static/chunks/app/project/page-66c22be12277e5c1.js +29 -0
- package/.next-prod/static/chunks/app/review/[id]/page-feeb4d9d472b00ab.js +1 -0
- package/.next-prod/static/chunks/{webpack-067b7836d8df9226.js → webpack-9a8ea3995034c536.js} +1 -1
- package/.next-prod/static/css/2a6d4c877711db09.css +1 -0
- package/.next-prod/static/css/e33280be1b23649f.css +1 -0
- package/.next-prod/trace +12 -12
- package/.next-prod/trace-build +1 -1
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/package.json +1 -1
- package/.next-prod/static/chunks/3579-70c6663ba8c0cf1b.js +0 -1
- package/.next-prod/static/chunks/9062-ea4adbf70cf62f01.js +0 -1
- package/.next-prod/static/chunks/app/project/page-180bad159db256a5.js +0 -29
- package/.next-prod/static/chunks/app/review/[id]/page-e81c220af0b68e3e.js +0 -1
- package/.next-prod/static/css/aefab4a01c890b38.css +0 -3
- /package/.next-prod/static/{smsKM7xQ0sAR3fsFWgImc → GrlHt_NxoSxuOTl-aMQdx}/_buildManifest.js +0 -0
- /package/.next-prod/static/{smsKM7xQ0sAR3fsFWgImc → GrlHt_NxoSxuOTl-aMQdx}/_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/
|
|
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/2a6d4c877711db09.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-9a8ea3995034c536.js"/><script src="/_next/static/chunks/4bd1b696-e356ca5ba0218e27.js" async=""></script><script src="/_next/static/chunks/3794-3fb4e6ee851037bb.js" async=""></script><script src="/_next/static/chunks/main-app-b76c0df33a946918.js" async=""></script><script src="/_next/static/chunks/9114-abef8471519b7dee.js" async=""></script><script src="/_next/static/chunks/3530-74191451ec2a46c4.js" async=""></script><script src="/_next/static/chunks/app/layout-fc306a84f663d5af.js" async=""></script><script src="/_next/static/chunks/app/global-error-3c48d7d42c672863.js" async=""></script><meta name="robots" content="noindex"/><meta name="next-size-adjust" content=""/><title>404: This page could not be found.</title><meta name="theme-color" content="#f9f9fb" media="(prefers-color-scheme: light)"/><meta name="theme-color" content="#111113" media="(prefers-color-scheme: dark)"/><title>Cockpit</title><meta name="description" content="One seat. One AI. Everything under control."/><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>
|
|
2
2
|
(function() {
|
|
3
3
|
try {
|
|
4
4
|
var theme = localStorage.getItem('theme') || 'dark';
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
})();
|
|
18
|
-
</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 bottom-4 right-4 z-[100] flex flex-col gap-2"></div><script src="/_next/static/chunks/webpack-
|
|
18
|
+
</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 bottom-4 right-4 z-[100] flex flex-col gap-2"></div><script src="/_next/static/chunks/webpack-9a8ea3995034c536.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[83599,[\"9114\",\"static/chunks/9114-abef8471519b7dee.js\",\"3530\",\"static/chunks/3530-74191451ec2a46c4.js\",\"7177\",\"static/chunks/app/layout-fc306a84f663d5af.js\"],\"Providers\"]\n3:I[57121,[],\"\"]\n4:I[74581,[],\"\"]\n5:I[90484,[],\"OutletBoundary\"]\n6:\"$Sreact.suspense\"\n9:I[90484,[],\"ViewportBoundary\"]\nb:I[90484,[],\"MetadataBoundary\"]\nd: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/2a6d4c877711db09.css\",\"style\"]\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/2a6d4c877711db09.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"className\":\"overflow-hidden\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"script\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"\\n (function() {\\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 // Unregister any leftover Service Workers (PWA has been removed)\\n if ('serviceWorker' in navigator) {\\n navigator.serviceWorker.getRegistrations().then(function(regs) {\\n regs.forEach(function(r) { r.unregister(); });\\n });\\n }\\n })();\\n \"}}]}],[\"$\",\"body\",null,{\"className\":\"__variable_f367f3 __variable_c1a059 __variable_3c557b antialiased overflow-hidden\",\"children\":[\"$\",\"$L2\",null,{\"children\":[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]}]]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$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,[\"$\",\"$L5\",null,{\"children\":[\"$\",\"$6\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@7\"}]}]]}],{},null,false,null]},null,false,\"$@8\"]},null,false,null],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$L9\",null,{\"children\":\"$La\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$Lb\",null,{\"children\":[\"$\",\"$6\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lc\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$d\",[]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"GrlHt_NxoSxuOTl-aMQdx\"}\n"])</script><script>self.__next_f.push([1,"e:[]\n8:\"$We\"\n"])</script><script>self.__next_f.push([1,"a:[[\"$\",\"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,"f:I[86869,[],\"IconMark\"]\n7:null\nc:[[\"$\",\"title\",\"0\",{\"children\":\"Cockpit\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"One seat. One AI. Everything under control.\"}],[\"$\",\"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\"}],[\"$\",\"$Lf\",\"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-9a8ea3995034c536.js"/><script src="/_next/static/chunks/4bd1b696-e356ca5ba0218e27.js" async=""></script><script src="/_next/static/chunks/3794-3fb4e6ee851037bb.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-9a8ea3995034c536.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\":\"GrlHt_NxoSxuOTl-aMQdx\"}\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":"qJxxuxDF+o7zTbZQgQWbaAEGGZ04n8cGX4rgq+8hxnU="}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3579],{578:(e,t,n)=>{function r(e,t){for(let n of e){if(n.path===t)return n;if(n.children){let e=r(n.children,t);if(e)return e}}return null}function s(e,t){if(!e)return"";let n=r(t,e);if(n?.isDirectory)return e;let s=e.split("/");return s.pop(),s.join("/")}function l(e){let t=[];for(let n of e){let e=n.split("/"),r=t;for(let t=0;t<e.length;t++){let n=e[t],s=t===e.length-1,l=e.slice(0,t+1).join("/"),o=r.find(e=>e.name===n);o||(o={name:n,path:l,isDirectory:!s,children:s?void 0:[]},r.push(o)),!s&&o.children&&(r=o.children)}}let n=e=>{e.sort((e,t)=>e.isDirectory&&!t.isDirectory?-1:!e.isDirectory&&t.isDirectory?1:e.name.localeCompare(t.name)),e.forEach(e=>{e.children&&n(e.children)})};return n(t),t}function o(e){let t=[],n=e=>{for(let r of e)r.isDirectory&&(t.push(r.path),r.children&&n(r.children))};return n(e),t}n.d(t,{B_:()=>f,KH:()=>d,MB:()=>r,S7:()=>s,fw:()=>u,q3:()=>c,r6:()=>m,tE:()=>h,tW:()=>o,u:()=>i,v3:()=>l});let a=new Set(["png","jpg","jpeg","gif","svg","webp","ico","bmp"]);function i(e){let t=e.split(".").pop()?.toLowerCase();return a.has(t||"")}function c(e,t,n=!1){let r=new Set;if(!t)return r;let s=t.toLowerCase(),l=e=>{if(r.add(e.path),e.children)for(let t of e.children)l(t)},o=(e,t)=>{let a=e.name.toLowerCase(),i=n?a===s:a.includes(s);if(i&&e.children)return l(e),t.forEach(e=>r.add(e)),!0;let c=!1;if(e.children)for(let n of e.children)o(n,[...t,e.path])&&(c=!0);return(!!i||!!c)&&(r.add(e.path),t.forEach(e=>r.add(e)),!0)};for(let t of e)o(t,[]);return r}function d(e,t,n=!1){let r=new Set;if(!t)return r;let s=t.toLowerCase();for(let t of e){let e=t.split("/");for(let t=0;t<e.length;t++){let l=e[t].toLowerCase();if(n?l===s:l.includes(s)){for(let t=0;t<=e.length-1;t++)r.add(e.slice(0,t+1).join("/"));break}}}return r}function u(e){let t=Math.floor(Math.floor((Date.now()-1e3*e)/1e3)/60),n=Math.floor(t/60),r=Math.floor(n/24),s=Math.floor(r/30),l=Math.floor(r/365);return l>0?`${l}y ago`:s>0?`${s}mo ago`:r>0?`${r}d ago`:n>0?`${n}h ago`:t>0?`${t}m ago`:"just now"}function m(e){let t=new Date(e),n=new Date,r=t.getFullYear()===n.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),l=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0");return r?`${s}-${l} ${o}:${a}`:`${t.getFullYear()}-${s}-${l} ${o}:${a}`}let h=()=>{},f=50},1531:(e,t,n)=>{n.d(t,{k_:()=>o,nH:()=>a});var r=n(95155),s=n(12115);let l=(0,s.createContext)(null);function o({children:e}){let t=(0,s.useRef)(new Map),n=(0,s.useRef)(null),[a,i]=(0,s.useState)(!1),c=(0,s.useCallback)((e,n)=>{t.current.set(n,e)},[]),d=(0,s.useCallback)(e=>{t.current.delete(e)},[]),u=(0,s.useCallback)(e=>{n.current=e},[]),m=(0,s.useCallback)(e=>{let r=n.current;if(!r)return void console.warn("No active tab to send message");let s=t.current.get(r);s?s(e):console.warn(`No chat sender registered for tab ${r}`)},[]),h=(0,s.useMemo)(()=>({sendMessage:m,isLoading:a,registerChat:c,unregisterChat:d,setActiveTab:u,setIsLoading:i}),[m,a,c,d,u]);return(0,r.jsx)(l.Provider,{value:h,children:e})}function a(){return(0,s.useContext)(l)}},10222:(e,t,n)=>{n.d(t,{$3:()=>a,Cm:()=>o,Gw:()=>d,RP:()=>i,Un:()=>c,zL:()=>l});var r=n(87918);let s=new Set;function l(e){return s.add(e),()=>s.delete(e)}function o(){s.forEach(e=>e())}async function a(e){let t=await fetch(`/api/comments?cwd=${encodeURIComponent(e)}`);if(!t.ok)throw Error("Failed to fetch comments");let n=(await t.json()).comments||[];if(0===n.length)return[];let r=new Map;for(let e of n)e.selectedText||(r.has(e.filePath)||r.set(e.filePath,[]),r.get(e.filePath).push(e));let s=new Map;await Promise.all(Array.from(r.keys()).map(async t=>{try{let n=await fetch(`/api/files/text?cwd=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`);if(n.ok){let e=await n.json();"string"==typeof e.content&&s.set(t,e.content.split("\n"))}}catch(e){console.error(`Failed to read file ${t}:`,e)}}));let l=[];for(let e of n){if(e.selectedText){l.push({...e,codeContent:e.selectedText});continue}let t=s.get(e.filePath),n="";if(t){let r=Math.max(0,e.startLine-1),s=Math.min(t.length,e.endLine);n=t.slice(r,s).join("\n")}l.push({...e,codeContent:n})}return l}async function i(e){try{if((await fetch(`/api/comments?cwd=${encodeURIComponent(e)}&all=true`,{method:"DELETE"})).ok)return o(),!0;return!1}catch(e){return console.error("Failed to clear comments:",e),!1}}let c="__chat__";function d(e,t){let n=e.filter(e=>e.filePath===c),s=e.filter(e=>e.filePath!==c),l=[];for(let e of(s.length>0&&(l.push(`${r.A.t("comments.codeRef")}`,""),s.forEach((e,t)=>{l.push(`[${t+1}] ${e.filePath}:${e.startLine}-${e.endLine}`),l.push("```"),l.push(e.codeContent),l.push("```"),e.note&&l.push(r.A.t("comments.note",{content:e.note})),l.push("")})),n)){let t=e.codeContent.split("\n").map(e=>`> ${e}`).join("\n");l.push(t),e.note&&l.push(e.note),l.push("")}return l.push(r.A.t("comments.question",{question:t})),l.join("\n")}},10611:(e,t,n)=>{n.d(t,{G:()=>u,f:()=>m});var r=n(12115);function s(){if("u"<typeof document)return null;let e=document.querySelector('meta[name="cockpit-bridge"]');if(!e)return null;let t=e.dataset.id,n=e.dataset.version;return t?{id:t,version:n||"unknown"}:null}let l=null,o=new Set;function a(){o.forEach(e=>e())}function i(e){o.add(e);let t=s();return t&&!l&&(l=t,Promise.resolve().then(a)),()=>{o.delete(e)}}function c(){return l}function d(){return null}if("u">typeof document&&(l=s()),"u">typeof MutationObserver&&"u">typeof document){let e=new MutationObserver(()=>{let e=s();e&&(!l||e.id!==l.id||e.version!==l.version)&&(l=e,a())}),t=document.head||document.documentElement;t&&e.observe(t,{childList:!0})}function u(){return(0,r.useSyncExternalStore)(i,c,d)}function m(){return l??s()}},14978:(e,t,n)=>{n.d(t,{T:()=>w});var r=n(95155),s=n(46361),l=n(79204),o=n(98164),a=n(77815),i=n(75035),c=n(88374);n(84559),n(21227);var d=n(91334),u=n(38194),m=n(88522),h=n(12115),f=n(72816);let x=[l.A,o.A,a.jb],g=[l.A,a.jb],p=[i.A,c.A],b=[i.A];function v(e){return e.replace(/^(\|.+\|)$/gm,e=>/^\|[\s:|-]+\|$/.test(e)?e:e.replace(/`([^`]*)`/g,(e,t)=>t.includes("|")?"`"+t.replace(/\|/g,"\\|")+"`":e))}function y(e){return e.replace(/\$(\d)/g,"\\$$1")}let w=(0,h.memo)(function({content:e,isUser:t=!1,isStreaming:n=!1,enableMath:l=!0,rehypePlugins:o}){let{resolvedTheme:a}=(0,f.D)(),i="dark"===a,c=(0,h.useMemo)(()=>({code({className:e,children:t,node:n,...s}){let l=/language-(\w+)/.exec(e||""),o=String(t);if(!l&&!e&&!o.includes("\n"))return(0,r.jsx)("code",{className:"px-1.5 py-0.5 mx-0.5 rounded bg-accent text-sm font-mono",...s,children:t});let a=String(t).replace(/\n$/,""),c=l?.[1]||"text",h=Number(s["data-source-start"])||0,f=h?h+1:0,x=0;return(0,r.jsx)(d.A,{style:i?u.A:m.A,language:c,PreTag:"div",customStyle:{margin:"0.75rem 0",borderRadius:"0.375rem",fontSize:"0.875rem"},wrapLines:!0,lineProps:()=>{let e=f+x;return x++,{"data-source-start":e,"data-source-end":e,style:{display:"block"}}},children:a})},p:({children:e,node:t,...n})=>(0,r.jsx)("p",{className:"mb-3 last:mb-0",...n,children:e}),h1:({children:e,node:t,...n})=>(0,r.jsx)("h1",{className:"text-xl font-bold mb-3 mt-4 first:mt-0",...n,children:e}),h2:({children:e,node:t,...n})=>(0,r.jsx)("h2",{className:"text-lg font-bold mb-2 mt-3 first:mt-0",...n,children:e}),h3:({children:e,node:t,...n})=>(0,r.jsx)("h3",{className:"text-base font-bold mb-2 mt-3 first:mt-0",...n,children:e}),ul:({children:e,node:t,...n})=>(0,r.jsx)("ul",{className:"list-disc list-inside mb-3 space-y-1",...n,children:e}),ol:({children:e,node:t,...n})=>(0,r.jsx)("ol",{className:"list-decimal list-inside mb-3 space-y-1",...n,children:e}),li:({children:e,node:t,...n})=>(0,r.jsx)("li",{className:"leading-relaxed",...n,children:e}),blockquote:({children:e,node:t,...n})=>(0,r.jsx)("blockquote",{className:"border-l-4 border-border pl-4 my-3 italic text-muted-foreground",...n,children:e}),a:({href:e,children:t,node:n,...s})=>(0,r.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-brand hover:underline",...s,children:t}),table:({children:e,node:t,...n})=>(0,r.jsx)("div",{className:"overflow-x-auto my-3",...n,children:(0,r.jsx)("table",{className:"min-w-full border border-border",children:e})}),thead:({children:e,node:t,...n})=>(0,r.jsx)("thead",{className:"bg-accent",...n,children:e}),th:({children:e,node:t,...n})=>(0,r.jsx)("th",{className:"px-4 py-2 text-left font-semibold border-b border-border",...n,children:e}),td:({children:e,node:t,...n})=>(0,r.jsx)("td",{className:"px-4 py-2 border-b border-border",...n,children:e}),hr:({node:e,...t})=>(0,r.jsx)("hr",{className:"my-4 border-border",...t}),img:({src:e,alt:t,node:n,height:s,width:l,style:o,...a})=>{if(!(s||l||o))return(0,r.jsx)("img",{src:e,alt:t||"",className:"max-w-full h-auto rounded-lg my-3",...a});let i=e=>e?/^\d+$/.test(String(e))?`${e}px`:String(e):void 0,c={...o,height:i(s)??o?.height,width:i(l)??o?.width};return(0,r.jsx)("img",{src:e,alt:t||"",style:c,className:"inline-block align-middle",...a})},strong:({children:e,node:t,...n})=>(0,r.jsx)("strong",{className:"font-bold",...n,children:e}),em:({children:e,node:t,...n})=>(0,r.jsx)("em",{className:"italic",...n,children:e}),del:({children:e,node:t,...n})=>(0,r.jsx)("del",{className:"line-through",...n,children:e})}),[i]),w=l?x:g,k=l?p:b,C=(0,h.useMemo)(()=>{if(t||n)return e;let r=v(!function(e){if(/^\|[\s:|-]+\|$/m.test(e))return!1;if(/[┌┐└┘│─├┤┬┴┼╔╗╚╝║═╭╮╯╰▲▼◀▶△▽◁▷]/.test(e)||/\+[-=]{2,}\+/.test(e))return!0;let t=e.split("\n").filter(e=>/^\s*\||\|\s*$/.test(e));if(t.length>=3){let e=t.map(e=>(e.match(/\|/g)||[]).length);return!e.every(t=>t===e[0])||!(e[0]>=3)}return!1}(e)||/^```[\s\S]*```$/m.test(e.trim())?e:"```text\n"+e.trim()+"\n```");return l?y(r):r},[e,t,n,l]),j=(0,h.useMemo)(()=>o?.length?[...k,...o]:k,[o,k]);if(t)return(0,r.jsx)("div",{className:"whitespace-pre-wrap break-words",children:e});if(n){let t=e.lastIndexOf("\n");if(-1===t)return(0,r.jsx)("div",{className:"whitespace-pre-wrap break-words",children:e});let n=e.slice(0,t+1),o=e.slice(t+1);return(0,r.jsxs)("div",{className:"markdown-body",children:[(0,r.jsx)(s.oz,{remarkPlugins:w,rehypePlugins:k,components:c,children:l?y(v(n)):v(n)}),o&&(0,r.jsx)("span",{className:"whitespace-pre-wrap",children:o})]})}return(0,r.jsx)("div",{className:"markdown-body",children:(0,r.jsx)(s.oz,{remarkPlugins:w,rehypePlugins:j,components:c,children:C})})})},18658:(e,t,n)=>{n.d(t,{n:()=>o});var r=n(12115);let s="SCHEDULED_TASKS_CHANGED";function l(){try{window.parent.postMessage({type:s},"*")}catch{}document.querySelectorAll("iframe").forEach(e=>{try{e.contentWindow?.postMessage({type:s},"*")}catch{}})}function o(){let[e,t]=(0,r.useState)([]),[n,o]=(0,r.useState)(0),a=(0,r.useCallback)(()=>{fetch("/api/scheduled-tasks").then(e=>e.json()).then(e=>{t(e.tasks||[]),o(e.unreadCount||0)}).catch(()=>{})},[]);(0,r.useEffect)(()=>{a()},[a]),(0,r.useEffect)(()=>{let e=e=>{e.data?.type===s&&a()};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[a]);let i=(0,r.useCallback)(async e=>{try{let t=await fetch("/api/scheduled-tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json();if(n.task)return a(),l(),n.task;return null}catch{return null}},[a]),c=(0,r.useCallback)(async e=>{await fetch("/api/scheduled-tasks",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"pause"})}).catch(()=>{}),a(),l()},[a]),d=(0,r.useCallback)(async e=>{await fetch("/api/scheduled-tasks",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"resume"})}).catch(()=>{}),a(),l()},[a]),u=(0,r.useCallback)(async e=>{await fetch("/api/scheduled-tasks",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e})}).catch(()=>{}),a(),l()},[a]),m=(0,r.useCallback)(async(e,t)=>{await fetch("/api/scheduled-tasks",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"update",fields:t})}).catch(()=>{}),a(),l()},[a]),h=(0,r.useCallback)(async e=>{await fetch("/api/scheduled-tasks",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"trigger"})}).catch(()=>{}),a(),l()},[a]),f=(0,r.useCallback)(async e=>{await fetch("/api/scheduled-tasks",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,action:"markRead"})}).catch(()=>{}),a(),l()},[a]),x=(0,r.useCallback)(async()=>{await fetch("/api/scheduled-tasks",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:"_",action:"markAllRead"})}).catch(()=>{}),a(),l()},[a]),g=(0,r.useCallback)(async e=>{await fetch("/api/scheduled-tasks",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:"_",action:"reorder",fields:{orderedIds:e}})}).catch(()=>{}),a(),l()},[a]);return{tasks:e,unreadCount:n,reload:a,createTask:i,pauseTask:c,resumeTask:d,triggerTask:h,deleteTask:u,updateTask:m,markRead:f,markAllRead:x,reorderTasks:g}}},22552:(e,t,n)=>{n.d(t,{h:()=>l});var r=n(12115);let s=new Map;function l({url:e,onMessage:t,enabled:n=!0}){let o=(0,r.useRef)(t);(0,r.useEffect)(()=>{o.current=t}),(0,r.useEffect)(()=>{if(!n)return;let t=e=>o.current(e),r=function(e){let t=s.get(e);if(t)return t;let n={ws:null,listeners:new Set,retryCount:0,retryTimer:null,connect(){let t="https:"===window.location.protocol?"wss:":"ws:",r=new WebSocket(`${t}//${window.location.host}${e}`);r.onopen=()=>{n.retryCount=0},r.onmessage=e=>{try{let t=JSON.parse(e.data);if("ping"===t.type)return;n.listeners.forEach(e=>e(t))}catch{}},r.onclose=()=>{if(0===n.listeners.size)return;let e=Math.min(1e3*Math.pow(1.5,n.retryCount),1e4);n.retryCount++,n.retryTimer=setTimeout(()=>n.connect(),e)},r.onerror=()=>{},n.ws=r},destroy(){n.retryTimer&&clearTimeout(n.retryTimer),n.ws&&n.ws.close(),n.ws=null,s.delete(e)}};return s.set(e,n),n.connect(),n}(e);return r.listeners.add(t),()=>{r.listeners.delete(t),0===r.listeners.size&&r.destroy()}},[e,n])}},23193:(e,t,n)=>{n.d(t,{Np:()=>d,ZD:()=>i,b8:()=>c,kS:()=>o,sQ:()=>a});var r=n(67014);let s=null,l=["typescript","tsx","javascript","jsx","html","css","scss","json","yaml","python","go","rust","java","ruby","php","bash","shell","markdown","sql","c","cpp","swift","kotlin","dart","lua","graphql","xml"];function o(){return s||(s=(0,r.O_)({themes:["github-dark","github-light"],langs:[...l]})),s}function a(e){let t=e.split("/").pop()?.toLowerCase()||"",n=t.split(".").pop()?.toLowerCase();if(".env"===t||t.startsWith(".env.")||"dockerfile"===t||t.startsWith("dockerfile.")||"makefile"===t)return"bash";let r={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",mjs:"javascript",cjs:"javascript",html:"html",htm:"html",css:"css",scss:"scss",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",py:"python",go:"go",rs:"rust",java:"java",kt:"kotlin",rb:"ruby",php:"php",cs:"cpp",cpp:"cpp",c:"c",h:"c",sh:"bash",bash:"bash",zsh:"bash",md:"markdown",mdx:"markdown",sql:"sql",swift:"swift",dart:"dart",lua:"lua",graphql:"graphql",gql:"graphql",toml:"yaml",sass:"scss",less:"css",scala:"java",r:"python",vim:"bash",env:"bash"}[n||""]||"text";return l.includes(r)?r:"text"}function i(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function c(e){return e.map(e=>e.color?`<span style="color:${e.color}">${i(e.content)}</span>`:i(e.content)).join("")}function d(e,t,n,r){if(!t)return[];let s=[],l=n?t:t.toLowerCase();for(let t=0;t<e.length;t++){let o=n?e[t]:e[t].toLowerCase(),a=0;for(;;){let e=o.indexOf(l,a);if(-1===e)break;let n=e+l.length;if(r){let r=e>0?o[e-1]:" ",l=n<o.length?o[n]:" ",a=!/\w/.test(r),i=!/\w/.test(l);a&&i&&s.push({lineIndex:t,startCol:e,endCol:n})}else s.push({lineIndex:t,startCol:e,endCol:n});a=e+1}}return s}},28147:(e,t,n)=>{n.d(t,{E:()=>c});var r=n(95155),s=n(12115),l=n(79114),o=n(87918),a=n(72588);let i={once:[{labelKey:"scheduledTasks.5minLater",value:5},{labelKey:"scheduledTasks.15minLater",value:15},{labelKey:"scheduledTasks.30minLater",value:30},{labelKey:"scheduledTasks.1hourLater",value:60}],interval:[{labelKey:"scheduledTasks.every15min",value:15},{labelKey:"scheduledTasks.every30min",value:30},{labelKey:"scheduledTasks.every1hour",value:60},{labelKey:"scheduledTasks.every2hours",value:120}],cron:[{labelKey:"scheduledTasks.daily9am",value:"0 9 * * *"},{labelKey:"scheduledTasks.daily6pm",value:"0 18 * * *"},{labelKey:"scheduledTasks.weeklyMon9am",value:"0 9 * * 1"},{labelKey:"scheduledTasks.monthly1st9am",value:"0 9 1 * *"}]};function c({onClose:e,onCreate:t,editTask:n,onUpdate:d}){let{t:u}=(0,l.Bd)(),m=!!n,[h,f]=(0,s.useState)(n?.type||"once"),[x,g]=(0,s.useState)(n?.message||""),[p,b]=(0,s.useState)(n?String(n.delayMinutes||n.intervalMinutes||""):""),[v,y]=(0,s.useState)(n?.cron||""),[w,k]=(0,s.useState)(n?.activeFrom||"09:00"),[C,j]=(0,s.useState)(n?.activeTo||"18:00"),[N,E]=(0,s.useState)(!!(n?.activeFrom&&n?.activeTo)),[L,S]=(0,s.useState)(null),M=(0,s.useRef)(null),T=(0,s.useRef)(null);(0,s.useEffect)(()=>{T.current?.focus()},[]),(0,s.useEffect)(()=>{let t=t=>{M.current&&!M.current.contains(t.target)&&e()};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[e]);let R=(0,s.useCallback)(()=>{if(!x.trim())return;let r=null;if("once"===h){let e=L||parseInt(p,10);if(!e||e<=0)return;r={message:x.trim(),type:"once",delayMinutes:e}}else if("interval"===h){let e=L||parseInt(p,10);if(!e||e<=0)return;r={message:x.trim(),type:"interval",intervalMinutes:e,...N?{activeFrom:w,activeTo:C}:{}}}else if("cron"===h){let e=L||v.trim();if(!e)return;r={message:x.trim(),type:"cron",cron:e}}r&&(m&&n&&d?d(n.id,r):t(r),e())},[x,h,L,p,v,N,w,C,t,e,m,n,d]);return(0,r.jsxs)("div",{ref:M,className:`w-80 bg-popover border border-border rounded-lg shadow-lg z-50 ${m?"":"absolute bottom-full left-0 mb-2"}`,onKeyDown:t=>{"Escape"===t.key?e():"Enter"===t.key&&(t.metaKey||t.ctrlKey)&&R()},children:[(0,r.jsx)("div",{className:"px-3 py-2 border-b border-border bg-muted/50 rounded-t-lg",children:(0,r.jsx)("span",{className:"text-sm font-medium",children:m?u("scheduledTasks.editTask"):u("scheduledTasks.createTask")})}),(0,r.jsxs)("div",{className:"p-3 space-y-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:u("scheduledTasks.sendMessage")}),(0,r.jsx)("textarea",{ref:T,value:x,onChange:e=>g(e.target.value),placeholder:u("scheduledTasks.messagePlaceholder"),rows:2,className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card text-foreground placeholder-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring resize-none"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:u("scheduledTasks.type")}),(0,r.jsx)("div",{className:"flex gap-1",children:["once","interval","cron"].map(e=>(0,r.jsx)("button",{onClick:()=>{f(e),S(null),b(""),y("")},className:`flex-1 px-2 py-1 text-xs rounded transition-colors ${h===e?"bg-brand text-white":"bg-muted text-muted-foreground hover:text-foreground"}`,children:"once"===e?u("scheduledTasks.once"):"interval"===e?u("scheduledTasks.interval"):"Cron"},e))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:u("scheduledTasks.quickSelect")}),(0,r.jsx)("div",{className:"grid grid-cols-2 gap-1",children:i[h].map(e=>(0,r.jsx)("button",{onClick:()=>{S(e.value),"cron"===h?y(String(e.value)):b(String(e.value))},className:`px-2 py-1 text-xs rounded border transition-colors ${L===e.value?"border-brand bg-brand/10 text-brand":"border-border text-muted-foreground hover:text-foreground hover:border-foreground/30"}`,children:u(e.labelKey)},e.labelKey))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:"cron"===h?u("scheduledTasks.customCron"):u("scheduledTasks.customMinutes")}),"cron"===h?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("input",{type:"text",value:v,onChange:e=>{y(e.target.value),S(null)},placeholder:u("scheduledTasks.cronPlaceholder"),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card text-foreground placeholder-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring font-mono"}),v.trim()&&(0,r.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:function(e){let t=o.A.t,n=e.trim().split(/\s+/);if(5!==n.length)return null;let[r,s,l,a,i]=n,c={0:t("cron.dowSun"),1:t("cron.dowMon"),2:t("cron.dowTue"),3:t("cron.dowWed"),4:t("cron.dowThu"),5:t("cron.dowFri"),6:t("cron.dowSat")},d={1:`1${t("cron.monthPrefix")}`,2:`2${t("cron.monthPrefix")}`,3:`3${t("cron.monthPrefix")}`,4:`4${t("cron.monthPrefix")}`,5:`5${t("cron.monthPrefix")}`,6:`6${t("cron.monthPrefix")}`,7:`7${t("cron.monthPrefix")}`,8:`8${t("cron.monthPrefix")}`,9:`9${t("cron.monthPrefix")}`,10:`10${t("cron.monthPrefix")}`,11:`11${t("cron.monthPrefix")}`,12:`12${t("cron.monthPrefix")}`};try{let e="";if(r.includes("/")||s.includes("/")){if("*"===s&&r.includes("/"))return t("cron.everyNMinutes",{n:r.split("/")[1]});if("0"===r&&s.includes("/"))return t("cron.everyNHours",{n:s.split("/")[1]});return null}let n=parseInt(s,10),o=parseInt(r,10);if(isNaN(n)&&"*"!==s||isNaN(o)&&"*"!==r)return null;e="*"===s&&"*"===r?t("cron.everyMinute"):"*"===s?t("cron.everyHourAtMin",{m:o}):"*"===r?t("cron.hourlyEveryMin",{h:n}):`${String(n).padStart(2,"0")}:${String(o).padStart(2,"0")}`;let u=[];if("*"!==a){let e=a.split(",").map(e=>d[e]||`${e}${t("cron.monthPrefix")}`);u.push(e.join(", "))}if("*"!==l)if(l.includes("-")){let[e,n]=l.split("-");u.push(t("cron.dayRange",{a:e,b:n}))}else l.includes(",")?u.push(l.split(",").map(e=>`${e}${t("cron.dayOfMonth")}`).join(", ")):u.push(`${l}${t("cron.dayOfMonth")}`);if("*"!==i)if("1-5"===i)u.push(t("cron.weekdays"));else if("0,6"===i||"6,0"===i)u.push(t("cron.weekends"));else{let e=i.split(",").map(e=>{if(e.includes("-")){let[n,r]=e.split("-");return t("cron.weekdayRange",{a:c[n]||n,b:c[r]||r})}return`${t("cron.weekdayPrefix")}${c[e]||e}`});u.push(e.join(", "))}if(0===u.length&&"*"===l&&"*"===a&&"*"===i)return t("cron.daily",{time:e});return`${u.join(" ")} ${e}`}catch{return null}}(v.trim())||(0,r.jsx)("span",{className:"text-destructive",children:u("scheduledTasks.cronFormat")})})]}):(0,r.jsx)("input",{type:"number",value:p,onChange:e=>{b(e.target.value),S(null)},placeholder:u("scheduledTasks.minutesPlaceholder"),min:1,className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card text-foreground placeholder-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]}),"interval"===h&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"flex items-center gap-2 text-xs text-muted-foreground mb-1 cursor-pointer",children:[(0,r.jsx)("input",{type:"checkbox",checked:N,onChange:e=>E(e.target.checked),className:"rounded border-border"}),u("scheduledTasks.limitTimeRange")]}),N&&(0,r.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,r.jsx)("input",{type:"time",value:w,onChange:e=>k(e.target.value),className:"flex-1 px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:u("scheduledTasks.to")}),(0,r.jsx)("input",{type:"time",value:C,onChange:e=>j(e.target.value),className:"flex-1 px-2 py-1 text-sm border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]})]}),(0,r.jsx)("button",{onClick:R,disabled:!(x.trim()&&("once"===h||"interval"===h?!!(L||p&&parseInt(p,10)>0):"cron"===h&&!!(L||v.trim()))),className:"w-full py-1.5 text-sm font-medium rounded bg-brand text-white hover:bg-brand/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:m?u("scheduledTasks.saveBtn",{modKey:(0,a.Mu)()}):u("scheduledTasks.createBtn",{modKey:(0,a.Mu)()})})]})]})}},31914:(e,t,n)=>{n.d(t,{b:()=>d});var r=n(95155),s=n(12115),l=n(79114),o=n(72816),a=n(38093),i=n(72588),c=n(10611);function d({isOpen:e,onClose:t}){let{t:n,i18n:u}=(0,l.Bd)(),{theme:m,setTheme:h}=(0,o.D)(),f=(0,c.G)(),[x,g]=(0,s.useState)(""),[p,b]=(0,s.useState)(""),[v,y]=(0,s.useState)("auto");(0,s.useEffect)(()=>{e&&fetch("/api/settings").then(e=>e.json()).then(e=>{e.language&&y(e.language)}).catch(()=>{})},[e]);let w=(0,s.useCallback)(e=>{y(e),fetch("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({language:e})}).catch(()=>{});let t="auto"===e?navigator.language.startsWith("zh")?"zh":"en":e;u.changeLanguage(t)},[u]),k=f?"installed":"not-installed",C=f?.version??null;if((0,s.useEffect)(()=>{e&&fetch("/api/version").then(e=>e.json()).then(e=>{e.version&&b(e.version)}).catch(()=>{})},[e]),(0,s.useEffect)(()=>{e&&fetch("/api/extension/version").then(e=>e.json()).then(e=>{e.path&&g(e.path)}).catch(()=>{})},[e]),!e)return null;let j=[{value:"system",label:n("settings.themeSystem"),icon:"\uD83D\uDCBB"},{value:"light",label:n("settings.themeLight"),icon:"☀️"},{value:"dark",label:n("settings.themeDark"),icon:"\uD83C\uDF19"}];return(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:t}),(0,r.jsxs)("div",{className:"relative bg-card rounded-lg shadow-xl w-full max-w-md mx-4 overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,r.jsx)("h2",{className:"text-sm font-medium text-foreground",children:n("settings.title")}),(0,r.jsx)("button",{onClick:t,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,r.jsx)("svg",{className:"w-5 h-5",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"})})})]}),(0,r.jsxs)("div",{className:"p-4 space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-foreground mb-2",children:n("settings.theme")}),(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2",children:j.map(e=>(0,r.jsxs)("button",{onClick:()=>h(e.value),className:`flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors ${m===e.value?"border-brand bg-brand/10 text-brand":"border-border hover:border-slate-6 text-muted-foreground hover:text-foreground"}`,children:[(0,r.jsx)("span",{className:"text-xl",children:e.icon}),(0,r.jsx)("span",{className:"text-xs font-medium",children:e.label})]},e.value))})]}),(0,r.jsx)("div",{className:"border-t border-border"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-foreground mb-2",children:n("settings.language")}),(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2",children:[{value:"auto",label:n("settings.languageAuto"),icon:"\uD83C\uDF10"},{value:"en",label:"English",icon:"\uD83C\uDDFA\uD83C\uDDF8"},{value:"zh",label:"中文",icon:"\uD83C\uDDE8\uD83C\uDDF3"}].map(e=>(0,r.jsxs)("button",{onClick:()=>w(e.value),className:`flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors ${v===e.value?"border-brand bg-brand/10 text-brand":"border-border hover:border-slate-6 text-muted-foreground hover:text-foreground"}`,children:[(0,r.jsx)("span",{className:"text-xl",children:e.icon}),(0,r.jsx)("span",{className:"text-xs font-medium",children:e.label})]},e.value))})]}),(0,r.jsx)("div",{className:"border-t border-border"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-foreground mb-2",children:n("settings.browserExtension")}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,r.jsx)("span",{className:`inline-block w-2 h-2 rounded-full flex-shrink-0 ${"installed"===k?"bg-green-500":"bg-slate-400"}`}),(0,r.jsxs)("span",{children:["installed"===k&&`${n("settings.extensionInstalled")}${C?` (v${C})`:""}`,"not-installed"===k&&n("settings.extensionNotInstalled")]})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:n("settings.extensionDescription")}),"installed"!==k&&(0,r.jsxs)("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded-md p-2 space-y-1",children:[(0,r.jsx)("p",{className:"font-medium text-foreground",children:n("settings.installSteps")}),(0,r.jsxs)("p",{children:[n("settings.step1")," ",(0,r.jsx)("code",{className:"px-1 py-0.5 bg-muted rounded text-foreground",children:"chrome://extensions"})]}),(0,r.jsx)("p",{children:n("settings.step2")}),(0,r.jsx)("p",{children:n("settings.step3")}),(0,i.L)()&&(0,r.jsx)("p",{dangerouslySetInnerHTML:{__html:n("settings.step4mac")}})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{onClick:()=>{let e=x||"chrome-extension";navigator.clipboard.writeText(e),(0,a.oR)(n("toast.copiedName",{name:e}))},className:"px-3 py-1.5 text-xs bg-brand text-white rounded-md hover:bg-brand/90 transition-colors",children:n("settings.copyExtensionPath")}),"installed"===k&&(0,r.jsx)("button",{onClick:()=>{f?.id&&window.chrome?.runtime?.sendMessage&&(window.chrome.runtime.sendMessage(f.id,{type:"reload"}),(0,a.oR)(n("toast.pluginReloading")))},className:"px-3 py-1.5 text-xs border border-border text-foreground rounded-md hover:bg-muted transition-colors",children:n("settings.reloadExtension")})]}),x&&(0,r.jsx)("p",{className:"text-[11px] text-muted-foreground font-mono truncate",children:x})]})]}),(0,r.jsx)("div",{className:"border-t border-border"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-foreground mb-2",children:n("settings.about")}),(0,r.jsxs)("div",{className:"text-xs text-muted-foreground space-y-1",children:[(0,r.jsxs)("p",{children:["Cockpit",p?` v${p}`:""]}),(0,r.jsx)("p",{className:"text-muted-foreground/60",children:"One seat. One AI. Everything under control."})]})]})]})]})]})}},36998:(e,t,n)=>{n.d(t,{P:()=>s});var r=n(12115);function s(){let[e,t]=(0,r.useState)([]),n=(0,r.useCallback)(()=>{fetch("/api/pinned-sessions").then(e=>e.json()).then(e=>t(e.sessions||[])).catch(()=>{})},[]);(0,r.useEffect)(()=>{n()},[n]),(0,r.useEffect)(()=>{let e=e=>{e.data?.type==="PINNED_SESSIONS_CHANGED"&&n()};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[n]);let s=(0,r.useCallback)(e=>{t(e),fetch("/api/pinned-sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessions:e})}).catch(()=>{});try{window.parent.postMessage({type:"PINNED_SESSIONS_CHANGED"},"*")}catch{}},[]),l=(0,r.useCallback)(t=>e.some(e=>e.sessionId===t),[e]),o=(0,r.useCallback)((t,n,r)=>{e.some(e=>e.sessionId===t)||s([...e,{sessionId:t,cwd:n,customTitle:r}])},[e,s]),a=(0,r.useCallback)(t=>{s(e.filter(e=>e.sessionId!==t))},[e,s]),i=(0,r.useCallback)((t,n)=>{s(e.map(e=>e.sessionId===t?{...e,customTitle:n}:e))},[e,s]);return{pinnedSessions:e,isPinned:l,pinSession:o,unpinSession:a,updateTitle:i,reorder:(0,r.useCallback)(e=>{s(e)},[s]),reload:n}}},44810:(e,t,n)=>{n.d(t,{F2:()=>m,ZL:()=>d,a9:()=>u});var r=n(95155),s=n(12115),l=n(47650);let o=()=>()=>{},a=()=>document.body,i=()=>null,c=(0,s.createContext)(null);function d({children:e}){let t=(0,s.useContext)(c),n=(0,s.useSyncExternalStore)(o,a,i),r=t??n;return r?(0,l.createPortal)(e,r):null}function u({children:e}){let[t,n]=(0,s.useState)(null);return(0,r.jsxs)("div",{className:"relative w-full h-full",style:{transform:"translateZ(0)"},children:[(0,r.jsx)(c.Provider,{value:t,children:e}),(0,r.jsx)("div",{ref:n,className:"absolute inset-0 pointer-events-none [&>*]:pointer-events-auto"})]})}function m(){return(0,s.useContext)(c)}},57842:(e,t,n)=>{n.d(t,{Ee:()=>m,SU:()=>c,ft:()=>u,iN:()=>d});var r=n(95155),s=n(12115),l=n(79114),o=n(47650),a=n(38093);let i=(0,s.createContext)(null);function c({container:e,children:t}){return(0,r.jsx)(i.Provider,{value:e,children:t})}function d(){return(0,s.useContext)(i)}function u({x:e,y:t,path:n,cwd:c,isDirectory:d,onClose:m,onCreateFile:h,onDelete:f,onRefresh:x,onCopyFile:g,onPaste:p}){let{t:b}=(0,l.Bd)(),v=(0,s.useRef)(null),y=(0,s.useContext)(i),w=n.split("/").pop()||n,k=`${c}/${n}`,C=n.includes("/")?n.substring(0,n.lastIndexOf("/")):"",j=C?`${c}/${C}`:c,N=d?n:C,E=d?k:j;(0,s.useEffect)(()=>{let e=e=>{v.current&&!v.current.contains(e.target)&&m()},t=e=>{"Escape"===e.key&&m()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[m]);let[L,S]=(0,s.useState)({x:0,y:0});(0,s.useEffect)(()=>{if(v.current&&y){let n=y.getBoundingClientRect(),r=v.current.getBoundingClientRect(),s=e-n.left,l=t-n.top;s=Math.min(s,n.width-r.width-8),l=Math.min(l,n.height-r.height-8),S({x:s=Math.max(8,s),y:l=Math.max(8,l)})}else if(v.current){let n=v.current.getBoundingClientRect();S({x:Math.max(8,Math.min(e,window.innerWidth-n.width-8)),y:Math.max(8,Math.min(t,window.innerHeight-n.height-8))})}},[e,t,y]);let M=(0,s.useCallback)(async(e,t)=>{try{await navigator.clipboard.writeText(e),(0,a.oR)(b("toast.copiedName",{name:t}),"success")}catch{(0,a.oR)(b("toast.copyFailed"),"error")}m()},[m,b]),T=d?n:C,R=[{label:b("fileContextMenu.copyRelativePath"),value:n},{label:b("fileContextMenu.copyAbsolutePath"),value:k},{label:b("fileContextMenu.copyRelativeDirPath"),value:N||"."},{label:b("fileContextMenu.copyAbsoluteDirPath"),value:E},{label:d?b("fileContextMenu.copyFolderName"):b("fileContextMenu.copyFileName"),value:w}],$=(0,r.jsxs)("div",{ref:v,className:"absolute z-[200] bg-card border border-border rounded-lg shadow-lg py-1 w-fit whitespace-nowrap",style:{left:L.x,top:L.y},children:[h&&(0,r.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-foreground hover:bg-accent transition-colors",onClick:()=>{m(),h(T)},children:b("fileContextMenu.createFile")}),g&&(0,r.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-foreground hover:bg-accent transition-colors",onClick:()=>{m(),g(n)},children:d?b("fileContextMenu.copyFolder"):b("fileContextMenu.copyFile")}),p&&(0,r.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-foreground hover:bg-accent transition-colors",onClick:()=>{m(),p(T)},children:b("fileContextMenu.pasteHere")}),f&&(0,r.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-destructive hover:bg-accent transition-colors",onClick:()=>{m(),f(n,d,w)},children:d?b("fileContextMenu.deleteFolder"):b("fileContextMenu.deleteFile")}),(h||f||g||p)&&(0,r.jsx)("div",{className:"my-1 border-t border-border"}),R.map((e,t)=>(0,r.jsx)("button",{className:"block w-full px-3 py-1.5 text-left text-sm text-foreground hover:bg-accent transition-colors",onClick:()=>M(e.value,e.label),children:e.label},t))]});return y?(0,o.createPortal)($,y):$}function m(){let[e,t]=(0,s.useState)(null);return{contextMenu:e,showContextMenu:(0,s.useCallback)((e,n,r)=>{e.preventDefault(),e.stopPropagation(),t({x:e.clientX,y:e.clientY,path:n,isDirectory:r})},[]),hideContextMenu:(0,s.useCallback)(()=>{t(null)},[])}}},71063:(e,t,n)=>{n.d(t,{_:()=>l});var r=n(12115),s=n(10222);function l({cwd:e,filePath:t}){let[n,o]=(0,r.useState)([]),[a,i]=(0,r.useState)(!1),[c,d]=(0,r.useState)(null),u=(0,r.useCallback)(async()=>{if(e&&t){i(!0),d(null);try{let n=await fetch(`/api/comments?cwd=${encodeURIComponent(e)}&filePath=${encodeURIComponent(t)}`);if(n.ok){let e=await n.json();o(e.comments||[])}else d("Failed to load comments")}catch(e){d(e instanceof Error?e.message:"Unknown error")}finally{i(!1)}}},[e,t]);(0,r.useEffect)(()=>{u()},[u]),(0,r.useEffect)(()=>(0,s.zL)(()=>{u()}),[u]);let m=(0,r.useCallback)(async(n,r,s,l)=>{try{let a=await fetch("/api/comments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,filePath:t,startLine:n,endLine:r,content:s,...l?{selectedText:l}:{}})});if(a.ok){let e=await a.json();return o(t=>[...t,e.comment]),e.comment}}catch(e){console.error("Failed to add comment:",e)}return null},[e,t]),h=(0,r.useCallback)(async(t,n)=>{try{let r=await fetch("/api/comments",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,id:t,content:n})});if(r.ok){let e=await r.json();return o(n=>n.map(n=>n.id===t?e.comment:n)),!0}}catch(e){console.error("Failed to update comment:",e)}return!1},[e]),f=(0,r.useCallback)(async t=>{try{if((await fetch(`/api/comments?cwd=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`,{method:"DELETE"})).ok)return o(e=>e.filter(e=>e.id!==t)),!0}catch(e){console.error("Failed to delete comment:",e)}return!1},[e]),x=(0,r.useCallback)(e=>n.filter(t=>e>=t.startLine&&e<=t.endLine),[n]);return{comments:n,isLoading:a,error:c,addComment:m,updateComment:h,deleteComment:f,refresh:u,getCommentsForLine:x}}},72588:(e,t,n)=>{n.d(t,{L:()=>s,Mu:()=>l});var r=n(41463);function s(){return!("u"<typeof navigator)&&(/Mac|iPhone|iPad/.test(navigator.platform||"")||navigator.userAgentData?.platform==="macOS")}function l(){return s()?"⌘":"Ctrl+"}r.platform,r.platform,r.platform},74446:(e,t,n)=>{n.d(t,{U:()=>l,k:()=>s});let r="cockpit-skills";function s(){let e="u"<typeof BroadcastChannel?null:new BroadcastChannel(r);if(e)try{e.postMessage({type:"changed"})}finally{e.close()}}function l(e){if("u"<typeof BroadcastChannel)return()=>{};let t=new BroadcastChannel(r),n=t=>{t.data?.type==="changed"&&e()};return t.addEventListener("message",n),()=>{t.removeEventListener("message",n),t.close()}}},74567:(e,t,n)=>{n.d(t,{f:()=>a,w:()=>o});var r=n(95155),s=n(12115),l=n(79114);function o({x:e,y:t,visible:n,container:s,onAddComment:a,onSendToAI:i,onSearch:c,isChatLoading:d}){let{t:u}=(0,l.Bd)(),m=s.getBoundingClientRect(),h=e-m.left,f=Math.max(0,t-m.top-40);return(0,r.jsxs)("div",{className:"floating-toolbar absolute z-[200] flex items-center gap-1.5 bg-card border border-border rounded-lg shadow-xl p-1.5",style:{left:h+8,top:f,visibility:n?"visible":"hidden",pointerEvents:n?"auto":"none"},children:[(0,r.jsx)("button",{className:"px-3 py-1.5 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors",onClick:a,children:u("floatingToolbar.addComment")}),(0,r.jsx)("button",{className:"px-3 py-1.5 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:i,disabled:d,title:u(d?"comments.aiResponding":"floatingToolbar.sendToAI"),children:u("floatingToolbar.sendToAI")}),c&&(0,r.jsx)("button",{className:"px-3 py-1.5 text-xs font-medium border border-brand text-brand rounded-md hover:bg-brand/10 transition-colors",onClick:c,children:u("floatingToolbar.search")})]})}let a=(0,s.memo)(function({floatingToolbarRef:e,bumpRef:t,container:n,onAddComment:l,onSendToAI:a,onSearch:i,isChatLoading:c}){let[d,u]=(0,s.useState)(0);(0,s.useEffect)(()=>{t.current=()=>u(e=>e+1)},[t]);let m=(0,s.useMemo)(()=>e.current,[d]);return(0,r.jsx)(o,{x:m?.x??0,y:m?.y??0,visible:!!m,container:n,onAddComment:l,onSendToAI:a,onSearch:i,isChatLoading:c})})},82085:(e,t,n)=>{n.d(t,{C:()=>l});var r=n(12115),s=n(23193);function l(e,t){let[n,l]=(0,r.useState)([]),[o,a]=(0,r.useState)(!1),i=(0,r.useRef)("");(0,r.useEffect)(()=>{let e=()=>{a(document.documentElement.classList.contains("dark"))};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>t.disconnect()},[]);let c=e.join("\n");return(0,r.useEffect)(()=>{if(0===e.length)return;let n=`${c}:${t}:${o}`;if(n===i.current)return;i.current=n,l(e.map(e=>(0,s.ZD)(e||" ")));let r=!1;return(async()=>{try{let n=await (0,s.kS)();if(r)return;let a=(0,s.sQ)(t),i=e.join("\n"),c=n.codeToTokens(i,{lang:a,theme:o?"github-dark":"github-light"}),d=[];for(let e=0;e<c.tokens.length;e++)if(d[e]=(0,s.b8)(c.tokens[e]),e%500==0&&e>0&&(await new Promise(e=>setTimeout(e,0)),r))return;l(d)}catch(e){console.error("Line highlight error:",e)}})(),()=>{r=!0}},[c,t,o]),n}},84392:(e,t,n)=>{n.d(t,{t:()=>o});var r=n(95155),s=n(12115),l=n(79114);function o({x:e,y:t,comment:n,container:a,onClose:i,onUpdateComment:c,onDeleteComment:d}){let{t:u}=(0,l.Bd)(),[m,h]=(0,s.useState)(!1),[f,x]=(0,s.useState)(n.content),g=(0,s.useRef)(null),[p,b]=(0,s.useState)({x:0,y:0});(0,s.useEffect)(()=>{if(g.current&&a){let n=a.getBoundingClientRect(),r=g.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,a]),(0,s.useEffect)(()=>{let e=e=>{g.current&&!g.current.contains(e.target)&&i()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);let v=async()=>{f.trim()&&(await c(n.id,f.trim()),h(!1))},y=async()=>{await d(n.id),i()};return(0,r.jsx)("div",{ref:g,className:"absolute z-[200] w-96 bg-card border border-border rounded-lg shadow-lg overflow-hidden",style:{left:p.x,top:p.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:f,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&&(h(!1),x(n.content))}}),(0,r.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,r.jsx)("button",{onClick:()=>{h(!1),x(n.content)},className:"px-2 py-1 text-xs text-muted-foreground hover:text-foreground",children:u("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:u("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:u("comments.lineRange",{start:n.startLine,end:n.endLine})}),(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)("button",{onClick:()=>h(!0),className:"p-1 rounded hover:bg-accent text-muted-foreground",title:u("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:u("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"})})})]})]})]})})})}},89662:(e,t,n)=>{n.d(t,{Cv:()=>R,XO:()=>$});var r=n(95155),s=n(12115),l=n(79114),o=n(47650),a=n(57842),i=n(91694),c=n(82085),d=n(23193),u=n(74567),m=n(84392),h=n(87918),f=n(44810);function x({blame:e,onClick:t}){let{t:n}=(0,l.Bd)(),o=(0,s.useRef)(null),a=(0,s.useRef)(null),i=(0,f.F2)(),c=(0,s.useRef)(!1),d=(0,s.useRef)(!1),u=(0,s.useRef)(null),m=(0,s.useRef)(null),g=(0,s.useRef)(null),p=(0,s.useRef)(e);(0,s.useEffect)(()=>{p.current=e},[e]);let b=(0,s.useRef)(t);(0,s.useEffect)(()=>{b.current=t},[t]);let v=(0,s.useCallback)(()=>{let e,t=a.current,n=o.current;if(!t||!n)return;let r=n.getBoundingClientRect(),s=t.getBoundingClientRect(),l=i?.getBoundingClientRect(),c=l?.left??0,d=l?.top??0,u=l?.width??window.innerWidth,m=l?.height??window.innerHeight,h=r.left-c;h+s.width>u-8&&(h=u-s.width-8),h<8&&(h=8);let f=r.top-d,x=r.bottom-d;(e=f-s.height-4<0?x+4:f-s.height-4)+s.height>m-8&&(e=m-s.height-8),t.style.left=`${h}px`,t.style.top=`${e}px`},[i]),y=(0,s.useCallback)(()=>{u.current&&(clearTimeout(u.current),u.current=null),m.current&&(clearTimeout(m.current),m.current=null),c.current=!1,d.current=!1,a.current&&(a.current.style.display="none"),g.current&&(document.removeEventListener("mousedown",g.current.down),document.removeEventListener("mouseup",g.current.up),g.current=null)},[]),w=(0,s.useCallback)(()=>{let e=a.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,a.current?.contains(t)||o.current?.contains(t)||y()}};document.addEventListener("mousedown",r),document.addEventListener("mouseup",s),g.current={down:r,up:s}},[v,y]),k=(0,s.useCallback)(()=>{if(u.current&&clearTimeout(u.current),m.current&&(clearTimeout(m.current),m.current=null),c.current)return;let e=window.getSelection();(!e||e.isCollapsed)&&(u.current=setTimeout(w,500))},[w]),C=(0,s.useCallback)(()=>{u.current&&(clearTimeout(u.current),u.current=null),c.current&&(m.current=setTimeout(()=>{d.current||y()},200))},[y]),j=(0,s.useCallback)(()=>{d.current=!0,m.current&&(clearTimeout(m.current),m.current=null)},[]),N=(0,s.useCallback)(()=>{d.current=!1,y()},[y]),E=(0,s.useCallback)(e=>{e.stopPropagation();let t=window.getSelection();t&&t.toString().length>0&&a.current?.contains(t.anchorNode)||(b.current?.(p.current),y())},[y]);(0,s.useEffect)(()=>()=>y(),[y]);let L=e.message.split("\n")[0]||"",S=e.message.split("\n").slice(1).join("\n").trim();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("span",{ref:o,className:"select-none text-xs text-muted-foreground/50 ml-6 cursor-default hover:text-muted-foreground/80",onMouseEnter:k,onMouseLeave:C,children:[e.author.split(" ")[0],", ",function(e){let t=h.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 o=Math.floor(l/30);return o<12?t("common.monthsAgo",{count:o}):t("common.yearsAgo",{count:Math.floor(o/12)})}(e.time)," \xb7 ",L]}),(0,r.jsx)(f.ZL,{children:(0,r.jsxs)("div",{ref:a,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:j,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:L}),S&&(0,r.jsx)("div",{className:"mt-1 text-muted-foreground",children:S}),(0,r.jsx)("div",{className:"mt-2 text-[11px] text-brand border-t border-border pt-2 cursor-pointer hover:underline",onClick:E,children:n("codeViewer.clickToViewDetails")})]})})]})}let g=[{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 p(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,o=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),a=1;for(;n=o.nextNode();){if(n===s){a+=l;break}a+=n.textContent?.length||0}return a}let b=(0,s.memo)(function({virtualKey:e,lineNum:t,highlightedHtml:n,hasComments:o,firstComment:a,lineCommentsCount:i,isInRange:c,showLineNumbers:d,lineNumChars:u,commentsEnabled:m,virtualItemSize:h,virtualItemStart:f,onCommentBubbleClick:g,onCmdClick:b,onTokenHover:v,onTokenHoverLeave:y,flashLine:w,blameLine:k,showBlameInfo:C,blameAuthorColor:j,isBlameHovered:N,onBlameClick:E,onBlameMouseEnter:L,onBlameMouseLeave:S,inlineBlameData:M,onInlineBlameClick:T,isCursorLine:R,cursorCol:$}){let{t:P}=(0,l.Bd)(),I=(0,s.useMemo)(()=>R&&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,R,$]),A=(0,s.useCallback)(e=>{if(!e.metaKey||!b)return;e.preventDefault(),e.stopPropagation();let n=e.currentTarget,r=p(e,n);window.getSelection()?.removeAllRanges(),b(t,r)},[t,b]),D=(0,s.useCallback)(e=>{if(!v||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=p(e,s),o=r.getBoundingClientRect();v(t,l,{x:o.left,y:o.bottom+4})},[t,v]),O=(0,s.useCallback)(()=>{k&&E&&E(k)},[k,E]),B=(0,s.useCallback)(e=>{k&&L&&L(k,e)},[k,L]);return(0,r.jsxs)("div",{"data-line":t,style:{position:"absolute",top:0,left:0,width:"100%",height:`${h}px`,transform:`translateY(${f}px)`,backgroundColor:N&&j?j.bg:void 0},className:`flex ${w===t?"flash-line":""} ${R?"vi-cursor-line":""} ${c?"bg-blue-9/20":o?"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&&j?j.bg:void 0},children:[k&&j&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-1 flex-shrink-0",style:{backgroundColor:j.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:B,onMouseLeave:S,onClick:O,title:P("codeViewer.clickToViewCommit"),children:C?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"font-medium",style:{color:j.border},children:k.hash}),(0,r.jsx)("span",{className:"truncate flex-1",children:k.author.split(" ")[0]})]}):null})]}),d&&(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&&o&&a&&(0,r.jsx)("button",{onClick:e=>g(a,e),className:"w-4 h-4 flex items-center justify-center rounded hover:bg-accent text-amber-9",title:P("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&&!o&&(0,r.jsx)("span",{className:"w-4"}),(0,r.jsx)("span",{className:"text-right",style:{minWidth:`${u}ch`},children:t})]})]}),(0,r.jsxs)("span",{className:"flex-1 px-3 whitespace-pre select-text",onClick:A,onMouseOver:D,onMouseLeave:y,"data-code-content":!0,children:[(0,r.jsx)("span",{dangerouslySetInnerHTML:{__html:I}}),M&&(0,r.jsx)(x,{blame:M,onClick:T})]})]},e)});var v=n(64702),y=n(71063),w=n(10222),k=n(1531);function C(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 j(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 N=n(578),E=n(38093);let L="white-space:pre;padding:0 12px;min-height:20px;line-height:20px";function S(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 M(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 o=window.getSelection(),a=document.createRange();a.selectNodeContents(r),a.collapse(!1),o?.removeAllRanges(),o?.addRange(a)}function T(e){return e.map(e=>`<div style="${L}">${e}</div>`).join("")}let R=(0,s.forwardRef)(function({content:e,filePath:t,showLineNumbers:n=!0,showSearch:h=!0,className:f="",cwd:x,enableComments:p=!1,scrollToLine:R=null,scrollToLineAlign:$="center",onScrollToLineComplete:P,highlightKeyword:I=null,visibleLineRef:A,onCmdClick:D,onTokenHover:O,onTokenHoverLeave:B,onTokenHoverCancel:K,blameLines:F,inlineBlameLines:H,onSelectCommit:z,editable:W=!1,initialMtime:_,onEditorClose:q,onSaved:V,onEditorStateChange:U,viMode:X=!1,onContentMutate:J,onEnterInsertMode:Z,onViSave:Y,viStateRef:G,initialCursorLine:Q,initialCursorCol:ee,onInitialCursorSet:et,onContentSearch:en},er){let{t:es}=(0,l.Bd)(),el=(0,s.useRef)(e),eo=(0,s.useRef)(!1),[ea,ei]=(0,s.useState)(!1),[ec,ed]=(0,s.useState)(!1),[eu,em]=(0,s.useState)(()=>e.split("\n").length),eh=(0,s.useRef)(e.split("\n").length),[ef,ex]=(0,s.useState)({show:!1}),eg=(0,s.useRef)(null),ep=(0,s.useRef)(null),eb=(0,s.useRef)(_),ev=(0,s.useRef)(null),ey=(0,s.useRef)(!1),ew=(0,s.useRef)(!1),{parentRef:ek,containerRef:eC,searchInputRef:ej,floatingToolbarRef:eN,suppressHoverRef:eE,bumpToolbarRef:eL,savedSelectionRef:eS,highlightedLines:eM,isMounted:eT,cmdHeld:eR,flashLine:e$,isSearchVisible:eP,searchQuery:eI,caseSensitive:eA,wholeWord:eD,currentMatchIndex:eO,viewingComment:eB,addCommentInput:eK,sendToAIInput:eF,chatContext:eH,commentsEnabled:ez,updateComment:eW,deleteComment:e_,lines:eq,matches:eV,rowData:eU,virtualizer:eX,commentsByEndLine:eJ,linesWithComments:eZ,setIsSearchVisible:eY,setSearchQuery:eG,setCaseSensitive:eQ,setWholeWord:e0,setViewingComment:e1,setAddCommentInput:e2,setSendToAIInput:e5,goToNextMatch:e3,goToPrevMatch:e4,handleSearchKeyDown:e8,handleCommentBubbleClick:e6,handleToolbarAddComment:e9,handleToolbarSendToAI:e7,handleToolbarSearch:te,handleCommentSubmit:tt,handleSendToAISubmit:tn,getHighlightedLineHtml:tr,suppressMatchScrollRef:ts,inlineBlameLineRef:tl,inlineBlameVersion:to}=function({content:e,filePath:t,showSearch:n=!0,cwd:r,enableComments:l=!1,scrollToLine:o=null,scrollToLineAlign:a="center",onScrollToLineComplete:i,visibleLineRef:u,onContentSearch:m}){let[h,f]=(0,s.useState)(!1),x=(0,s.useRef)(null),g=(0,s.useRef)(null),p=(0,s.useRef)(null),b=(0,k.nH)();(0,s.useEffect)(()=>{f(!0)},[]);let[j,N]=(0,s.useState)(!1),[E,L]=(0,s.useState)(null),S=(0,s.useRef)(null),[M,T]=(0,s.useState)(!1),[R,$]=(0,s.useState)(""),[P,I]=(0,s.useState)(!1),[A,D]=(0,s.useState)(!1),[O,B]=(0,s.useState)(0),[K,F]=(0,s.useState)(0),H=(0,s.useRef)(!1),[z,W]=(0,s.useState)(null),_=(0,s.useRef)(null),q=(0,s.useRef)(()=>{}),V=(0,s.useRef)(!1),U=(0,s.useRef)(null),[X,J]=(0,s.useState)(null),[Z,Y]=(0,s.useState)(null),G=(0,s.useRef)(null),[Q,ee]=(0,s.useState)(0),et=l&&!!r,{comments:en,addComment:er,updateComment:es,deleteComment:el,refresh:eo}=(0,y._)({cwd:r||"",filePath:t}),ea=(0,s.useMemo)(()=>e.split("\n"),[e]),ei=(0,c.C)(ea,t),ec=(0,s.useMemo)(()=>{let e=new Map;for(let t of en){let n=t.endLine;e.has(n)||e.set(n,[]),e.get(n).push(t)}return e},[en]),ed=(0,s.useMemo)(()=>{let e=new Set;for(let t of en)for(let n=t.startLine;n<=t.endLine;n++)e.add(n);return e},[en]),eu=(0,s.useMemo)(()=>(0,d.Np)(ea,R,P,A),[ea,R,P,A]);(0,s.useEffect)(()=>{eu.length>0&&B(0)},[eu.length,R,P,A]);let em=(0,s.useMemo)(()=>{let e=[];for(let t=0;t<ea.length;t++)e.push({type:"code",lineIndex:t});return e},[ea.length]),eh=(0,v.Te)({count:em.length,getScrollElement:()=>x.current,estimateSize:()=>20,overscan:10});(0,s.useEffect)(()=>{if(!u)return;let e=x.current;if(!e)return;let t=()=>{if(!eh.range)return;let t=e.scrollTop;for(let e of eh.getVirtualItems())if(e.start>=t){let t=em[e.index];t?.type==="code"&&(u.current=t.lineIndex+1);return}};return e.addEventListener("scroll",t,{passive:!0}),t(),()=>e.removeEventListener("scroll",t)},[u,em]),(0,s.useEffect)(()=>{let e=e=>{"Meta"===e.key&&N(!0)},t=e=>{"Meta"===e.key&&N(!1)},n=()=>N(!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(()=>p.current?.focus(),0)),"Escape"===e.key&&(M?(T(!1),$("")):Z?Y(null):X?J(null):_.current?(_.current=null,q.current()):z&&W(null))},t=g.current;if(t)return t.addEventListener("keydown",e),()=>t.removeEventListener("keydown",e)},[n,M,Z,X,z]),(0,s.useEffect)(()=>{if(H.current){H.current=!1;return}if(eu.length>0&&O>=0&&O<eu.length){let e=eu[O],t=em.findIndex(t=>"code"===t.type&&t.lineIndex===e.lineIndex);t>=0&&eh.scrollToIndex(t,{align:"center"})}},[O,eu,eh,em,K]);let ef=(0,s.useCallback)(()=>{0!==eu.length&&(B(e=>(e+1)%eu.length),F(e=>e+1))},[eu.length]),ex=(0,s.useCallback)(()=>{0!==eu.length&&(B(e=>(e-1+eu.length)%eu.length),F(e=>e+1))},[eu.length]),eg=(0,s.useRef)(o);eg.current=o,(0,s.useEffect)(()=>{if(null!==eg.current&&eg.current>0&&em.length>0){let e=eg.current,t=e-1,n=em.findIndex(e=>"code"===e.type&&e.lineIndex===t);if(n>=0){let t=()=>{eh.scrollToIndex(n,{align:a}),"center"===a&&(S.current&&clearTimeout(S.current),L(e),S.current=setTimeout(()=>L(null),500)),i?.()};"start"===a?requestAnimationFrame(t):setTimeout(t,150)}}},[o,a,em.length,eh,i]);let ep=(0,s.useCallback)(e=>{"Enter"===e.key&&(e.preventDefault(),e.shiftKey?ex():ef()),"Escape"===e.key&&(T(!1),$(""))},[ef,ex]),eb=(0,s.useCallback)((e,t)=>{et&&(t.stopPropagation(),W({comment:e,x:t.clientX,y:t.clientY}),_.current=null,q.current(),J(null),Y(null))},[et]);(0,s.useEffect)(()=>{if(!et)return;let e=x.current,t=!1,n=0,r=0,s=e=>{t=!0,n=e.clientX,r=e.clientY,U.current=null,V.current=!0,_.current&&(_.current=null,q.current())},l=e=>{t=!1;let s=e.target;if(s.closest?.(".floating-toolbar"))return;let l=Math.abs(e.clientX-n)>5||Math.abs(e.clientY-r)>5,o=window.getSelection();if(!o||o.isCollapsed){V.current=!1,_.current&&(_.current=null,q.current());return}let a=o.toString();if(!a.trim()||!l){V.current=!1,_.current&&(_.current=null,q.current());return}let i=o.getRangeAt(0),c=x.current;if(!c||!c.contains(i.commonAncestorContainer))return;let d=i.startContainer,u=i.endContainer,m=e=>{if(!document.contains(e))return null;let t=e.nodeType===Node.TEXT_NODE?e.parentElement:e;if(!t)return null;let n=t.closest("[data-line]");return n?parseInt(n.getAttribute("data-line")||"0",10):null},h=m(d),f=m(u);if(h&&f){let t=Math.min(h,f),n=Math.max(h,f);_.current={x:e.clientX,y:e.clientY,range:{start:t,end:n},selectedText:a},V.current=!0,q.current();let r=d.nodeType===Node.TEXT_NODE?d.parentElement?.closest("[data-line]"):d.closest("[data-line]"),s=u.nodeType===Node.TEXT_NODE?u.parentElement?.closest("[data-line]"):u.closest("[data-line]");r&&s&&(U.current={startLine:h,startOffset:C(r,i.startContainer,i.startOffset),endLine:f,endOffset:C(s,i.endContainer,i.endOffset)})}},o=()=>{if(t||!_.current)return;let e=window.getSelection();e&&!e.isCollapsed&&e.toString().trim()||(_.current=null,U.current=null,V.current=!1,q.current())};return e?.addEventListener("mousedown",s),document.addEventListener("mouseup",l),document.addEventListener("selectionchange",o),()=>{e?.removeEventListener("mousedown",s),document.removeEventListener("mouseup",l),document.removeEventListener("selectionchange",o)}},[et]),(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!==G.current&&(G.current=null,ee(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!==G.current&&(G.current=l,requestAnimationFrame(()=>ee(e=>e+1)))};return document.addEventListener("mouseup",t),()=>document.removeEventListener("mouseup",t)},[]);let ev=(0,s.useCallback)(()=>{let e=_.current;e&&(J({x:e.x,y:e.y,range:e.range,codeContent:e.selectedText}),_.current=null,q.current())},[]),ey=(0,s.useCallback)(()=>{let e=_.current;if(!e)return;let t=e.selectedText;Y({x:e.x,y:e.y,range:e.range,codeContent:t}),_.current=null,q.current()},[]),ew=(0,s.useCallback)(()=>{let e=_.current;if(!e||!m)return;let t=e.selectedText.trim();_.current=null,q.current(),t&&m(t)},[m]),ek=(0,s.useCallback)(async e=>{X&&(await er(X.range.start,X.range.end,e),J(null))},[X,er]),eC=(0,s.useCallback)(async e=>{if(Z&&b&&r)try{let n=await (0,w.$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.codeContent});let l=(0,w.Gw)(s,e);b.sendMessage(l),await (0,w.RP)(r),eo(),Y(null)}catch(e){console.error("Failed to send to AI:",e)}},[Z,b,t,r,eo]),ej=(0,s.useCallback)((e,t,n)=>{let r=ea[e];if(!r)return t;let s=[];if(R&&eu.length>0)for(let t of eu.filter(t=>t.lineIndex===e)){let n=eu[O]?.lineIndex===e&&eu[O]?.startCol===t.startCol;s.push({start:t.startCol,end:t.endCol,cls:n?"hl-cur":"hl-m"})}if(n&&!R&&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=[],o=0;for(let e of s){if(e.start<o)continue;e.start>o&&l.push((0,d.ZD)(r.substring(o,e.start)));let t=(0,d.ZD)(r.substring(e.start,e.end));l.push(`<span class="${e.cls}">${t}</span>`),o=e.end}if(o<r.length&&l.push((0,d.ZD)(r.substring(o))),t!==(0,d.ZD)(r)){let e=t;for(let t of s){let n=r.substring(t.start,t.end),s=(0,d.ZD)(n),l=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=RegExp(`(?<=>)([^<]*?)(${l})`,""),a=`$1<span class="${t.cls}">${s}</span>`,i=e.replace(o,a);i.length>e.length+200||(e=i)}return e}return l.join("")},[R,eu,O,ea]);return{parentRef:x,containerRef:g,searchInputRef:p,floatingToolbarRef:_,suppressHoverRef:V,savedSelectionRef:U,highlightedLines:ei,isMounted:h,cmdHeld:j,flashLine:E,isSearchVisible:M,searchQuery:R,caseSensitive:P,wholeWord:A,currentMatchIndex:O,viewingComment:z,bumpToolbarRef:q,addCommentInput:X,sendToAIInput:Z,chatContext:b,commentsEnabled:et,comments:en,updateComment:es,deleteComment:el,lines:ea,matches:eu,rowData:em,virtualizer:eh,commentsByEndLine:ec,linesWithComments:ed,setIsSearchVisible:T,setSearchQuery:$,suppressMatchScrollRef:H,setCaseSensitive:I,setWholeWord:D,setViewingComment:W,setAddCommentInput:J,setSendToAIInput:Y,goToNextMatch:ef,goToPrevMatch:ex,handleSearchKeyDown:ep,handleCommentBubbleClick:eb,handleToolbarAddComment:ev,handleToolbarSendToAI:ey,handleToolbarSearch:ew,handleCommentSubmit:ek,handleSendToAISubmit:eC,getHighlightedLineHtml:ej,inlineBlameLineRef:G,inlineBlameVersion:Q}}({content:e,filePath:t,showSearch:h,cwd:x,enableComments:!W&&p,scrollToLine:W?null:R,scrollToLineAlign:W?"center":$,onScrollToLineComplete:W?void 0:P,visibleLineRef:W?void 0:A,onContentSearch:en}),ta=(0,a.iN)(),ti=(0,s.useRef)(null),tc=(0,s.useRef)(null),td=(0,s.useRef)({line:0,col:0}),tu=function({lines:e,enabled:t,onContentChange:n,onEnterInsert:r,onSave:l,getVisibleLineCount:o,scrollToLine:a,onSearchExecute:i,onSearchNext:c,onSearchPrev:d,onSearchClear:u}){let[m,h]=(0,s.useState)("normal"),[f,x]=(0,s.useState)(-1),[g,p]=(0,s.useState)(0),[b,v]=(0,s.useState)(!1),[y,w]=(0,s.useState)(""),[k,C]=(0,s.useState)(""),[j,N]=(0,s.useState)(""),[E,L]=(0,s.useState)(""),S=(0,s.useRef)([]),M=(0,s.useRef)([]),T=(0,s.useRef)([]),R=(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 P=(0,s.useCallback)((e,t)=>Math.max(0,Math.min(t,Math.max(0,($.current[e]??"").length-1))),[]),I=(0,s.useRef)(e.length);(0,s.useEffect)(()=>{let t=Math.abs(e.length-I.current);I.current=e.length,t>10&&(queueMicrotask(()=>{x(-1),p(0),v(!1)}),S.current=[],M.current=[],T.current=[])},[e]);let A=(0,s.useCallback)(()=>{R.current&&(clearTimeout(R.current),R.current=null),w("")},[]),D=(0,s.useCallback)(()=>{R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{w(""),R.current=null},500)},[]),O=(0,s.useCallback)((e,t)=>{S.current.push(t),M.current=[],v(!0),n(e.join("\n"))},[n]),B=(0,s.useCallback)((e,t)=>{let n=Math.max(0,Math.min(e,$.current.length-1));x(n),p(P(n,t??0)),a(n,"auto")},[a,P]),K=(0,s.useCallback)(e=>{x(t=>{let n=Math.max(0,Math.min(t+e,$.current.length-1));return a(n,"auto"),p(e=>Math.max(0,Math.min(e,Math.max(0,($.current[n]??"").length-1)))),n})},[a]),F=(0,s.useCallback)(()=>{let e=$.current,t=Math.min(f,e.length-1);if(0===e.length)return;let n=e[t];T.current=[n];let r=[...e];r.splice(t,1),0===r.length&&r.push("");let s=Math.min(t,r.length-1);O(r,{lineIndex:t,oldLines:[n],newLines:[],cursorLine:t}),x(s),p(0)},[f,O]),H=(0,s.useCallback)(()=>{let e=$.current,t=Math.min(f,e.length-1);e.length>0&&(T.current=[e[t]])},[f]),z=(0,s.useCallback)(()=>{let e=T.current;if(0===e.length)return;let t=$.current,n=Math.min(f,t.length-1)+1,r=[...t];r.splice(n,0,...e),O(r,{lineIndex:n,oldLines:[],newLines:[...e],cursorLine:f}),x(n),p(0),a(n,"auto")},[f,O,a]),W=(0,s.useCallback)(()=>{let e=$.current,t=Math.min(f,e.length-1),n=e[t];if(!n||0===n.length)return;let r=n.substring(1),s=[...e];s[t]=r,O(s,{lineIndex:t,oldLines:[n],newLines:[r],cursorLine:f})},[f,O]),_=(0,s.useCallback)(()=>{let e=S.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)),a(Math.min(t.cursorLine,r.length-1),"auto"),0===e.length&&v(!1)},[n,a]),q=(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),S.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)),a(Math.min(s,r.length-1),"auto")},[n,a]),V=(0,s.useCallback)(e=>{let t=$.current,n=Math.min(f,t.length-1);if("o"===e||"O"===e){let r="o"===e?n+1:n,s=[...t];s.splice(r,0,""),O(s,{lineIndex:r,oldLines:[],newLines:[""],cursorLine:f}),n=r,x(r)}h("insert"),r(n,g,e)},[f,g,O,r]),U=(0,s.useCallback)(()=>{h("normal"),A()},[A]),X=(0,s.useCallback)(()=>{h("command"),C("")},[]),J=(0,s.useCallback)(()=>{h("normal"),C("")},[]),Z=(0,s.useCallback)(()=>{h("search"),N("")},[]),Y=(0,s.useCallback)(()=>{h("normal"),N("")},[]),G=(0,s.useCallback)(e=>{let t=e.trim();if("w"===t){l?.(),h("normal"),C("");return}if("q"===t){h("normal"),C("");return}if("wq"===t){l?.(),h("normal"),C("");return}if("noh"===t||"nohlsearch"===t){u?.(),h("normal"),C("");return}let n=parseInt(t,10);if(!isNaN(n)&&n>0){let e=Math.min(n-1,$.current.length-1);x(e),a(e,"center"),h("normal"),C("");return}h("normal"),C("")},[l,u,a]),Q=(0,s.useCallback)(e=>{if(!e){h("normal"),N("");return}L(e),i?.(e),h("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)&&(U(),!0);if("command"===m)return!e.isComposing&&("Escape"===e.key||n?J():"Enter"===e.key?G(k):"Backspace"===e.key?0===k.length?J():C(e=>e.slice(0,-1)):1!==e.key.length||e.metaKey||e.ctrlKey||C(t=>t+e.key),!0);if("search"===m)return!e.isComposing&&("Escape"===e.key||n?Y():"Enter"===e.key?Q(j):"Backspace"===e.key?0===j.length?Y():N(e=>e.slice(0,-1)):1!==e.key.length||e.metaKey||e.ctrlKey||N(t=>t+e.key),!0);if(f<0&&(x(0),p(0)),e.metaKey)return!1;if(e.ctrlKey)return"d"===e.key?(K(Math.max(1,Math.floor(o()/2))),A(),!0):"u"===e.key?(K(-Math.max(1,Math.floor(o()/2))),A(),!0):"r"===e.key&&(q(),A(),!0);let r=e.key,s=y+r;if("g"===s)return w("g"),D(),!0;if("gg"===s)return B(0),A(),!0;if("d"===s)return w("d"),D(),!0;if("dd"===s)return F(),A(),!0;if("y"===s)return w("y"),D(),!0;if("yy"===s)return H(),A(),!0;if(y&&s!==r&&A(),"j"===r||"ArrowDown"===r)return K(1),!0;if("k"===r||"ArrowUp"===r)return K(-1),!0;if("h"===r||"ArrowLeft"===r)return p(e=>Math.max(0,e-1)),!0;if("l"===r||"ArrowRight"===r){let e=Math.max(0,($.current[f]??"").length-1);return p(t=>Math.min(e,t+1)),!0}if("0"===r)return p(0),!0;if("$"===r)return p(Math.max(0,($.current[f]??"").length-1)),!0;if("^"===r){let e=($.current[f]??"").search(/\S/);return p(e>=0?e:0),!0}return"G"===r?(B($.current.length-1),!0):"x"===r?(W(),!0):"p"===r?(z(),!0):"u"===r?(_(),!0):"i"===r||"a"===r||"I"===r||"A"===r||"o"===r||"O"===r?(V(r),!0):"/"===r?(Z(),!0):"n"===r?(c?.(),!0):"N"===r?(d?.(),!0):":"===r?(X(),!0):"Escape"!==r&&1===r.length},[t,m,y,k,j,f,U,V,X,J,Z,Y,G,Q,K,B,o,F,H,z,W,_,q,A,D,c,d]);return{state:{mode:m,cursorLine:f,cursorCol:g,isDirty:b,keyBuffer:y,commandInput:k,searchInput:j,lastSearch:E},handleKeyDown:ee,enterNormal:U,enterInsert:V,setCursorLine:x,setCursorCol:p,setCommandInput:C,setSearchInput:N,setIsDirty:v,clearUndoHistory:(0,s.useCallback)(()=>{S.current=[],M.current=[]},[])}}({lines:eq,enabled:X&&!W,onContentChange:e=>{J?.(e)},onEnterInsert:(e,t,n)=>{let r=t;if("a"===n)r=t+1;else if("A"===n)r=(eq[e]??"").length;else if("I"===n){let t=(eq[e]??"").search(/\S/);r=t>=0?t:0}else("o"===n||"O"===n)&&(r=0);td.current={line:e,col:r},Z?.(e)},onSave:Y,getVisibleLineCount:()=>{let e=ek.current;return e?Math.floor(e.clientHeight/20):20},scrollToLine:(e,t)=>{let n=eU.findIndex(t=>"code"===t.type&&t.lineIndex===e);n>=0&&eX.scrollToIndex(n,{align:t||"auto"})},onSearchExecute:e=>{eG(e),eY(!1)},onSearchNext:e3,onSearchPrev:e4,onSearchClear:()=>{eG("")}});(0,s.useEffect)(()=>{G&&(G.current={cursorLine:tu.state.cursorLine,cursorCol:tu.state.cursorCol})},[G,tu.state.cursorLine,tu.state.cursorCol]);let tm=(0,s.useRef)(null);(0,s.useEffect)(()=>{X&&!W&&null!=Q&&t&&tm.current!==t&&(tm.current=t,tu.setCursorLine(Q-1),null!=ee&&tu.setCursorCol(ee-1),et?.())},[X,W,Q,ee,t]),(0,s.useEffect)(()=>{if(!X||W)return;let e=eC.current;if(!e)return;let t=e=>{let t=e.target;"TEXTAREA"===t.tagName||"INPUT"===t.tagName||t.isContentEditable||tu.handleKeyDown(e)&&(e.preventDefault(),e.stopPropagation())};return e.addEventListener("keydown",t,!0),()=>e.removeEventListener("keydown",t,!0)},[X,W,tu.handleKeyDown]),(0,s.useEffect)(()=>{if(!X||W)return;let e=eC.current;e&&"normal"===tu.state.mode&&requestAnimationFrame(()=>{let t=document.activeElement;t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName||t.isContentEditable)||e.focus()})},[X,W,tu.state.mode,e]);let th=(0,s.useCallback)(e=>{if(!X||W)return;let t=e.target.closest("[data-line]");if(t){let n=parseInt(t.getAttribute("data-line"),10);if(!isNaN(n)){tu.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 o=eq[n-1]??"";tu.setCursorCol(Math.max(0,Math.min(l,Math.max(0,o.length-1))))}}}}let n=e.target;if("TEXTAREA"===n.tagName||"INPUT"===n.tagName||n.isContentEditable)return;let r=eC.current;r&&r.focus()},[X,W,tu.setCursorLine,tu.setCursorCol,eq]),tf=(0,s.useCallback)(e=>{X&&!W&&requestAnimationFrame(()=>{let e=window.getSelection(),t=e?.toString().trim();t&&/^\S+$/.test(t)&&(ts.current=!0,eG(t))})},[X,W,eG,ts]);(0,s.useEffect)(()=>{"command"===tu.state.mode?setTimeout(()=>ti.current?.focus(),0):"search"===tu.state.mode&&setTimeout(()=>tc.current?.focus(),0)},[tu.state.mode]),(0,s.useEffect)(()=>{let e=ek.current;if(!e)return;let t=()=>{(K??B)?.()};return e.addEventListener("mousedown",t),()=>e.removeEventListener("mousedown",t)},[K,B]),(0,s.useEffect)(()=>{eK||eF?(eE.current=!0,B?.()):eN.current||(eE.current=!1)},[eK,eF,B]),(0,s.useLayoutEffect)(()=>{let e=eS.current;if(!e)return;let t=window.getSelection();if(t&&!t.isCollapsed)return;let n=ek.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=j(r,e.startOffset),o=j(s,e.endOffset);if(l&&o)try{let e=document.createRange();e.setStart(l.node,l.offset),e.setEnd(o.node,o.offset),t?.removeAllRanges(),t?.addRange(e)}catch{}});let tx=(0,s.useCallback)((e,t,n)=>{eE.current||O?.(e,t,n)},[O]),tg=(0,s.useCallback)((e,t)=>{eE.current||D?.(e,t)},[D]),tp=Math.max(4,String(W?eu:eq.length).length),tb=(0,s.useMemo)(()=>{let e=0;for(let t of eq){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},[eq]);(0,s.useEffect)(()=>{if(W){el.current=e;let t=e.split("\n").length;eh.current=t,em(t),eo.current=!1,ei(!1),ex({show:!1}),eb.current=_}},[W,e,_]),(0,s.useEffect)(()=>{if(!W)return;let t=eg.current;if(!t)return;let n=e.split("\n");t.innerHTML=T(n.map((e,t)=>eM[t]||(0,d.ZD)(e||" "))),requestAnimationFrame(()=>{let e,r;X?(e=Math.max(0,Math.min(td.current.line,n.length-1)),r=td.current.col):(e=Math.max(0,Math.min((A?.current??1)-1,n.length-1)),r=0),t.focus(),M(t,{line:e,offset:r});let s=A?.current??1;ep.current&&(ep.current.scrollTop=(s-1)*20)})},[W]),(0,s.useEffect)(()=>{W&&U?.({isDirty:ea,isSaving:ec})},[W,ea,ec,U]);let tv=(0,s.useCallback)(()=>{let e=eg.current;if(!e)return el.current;let t=[];for(let n of e.childNodes){let e=n.textContent||"";t.push(" "===e?"":e)}return t.join("\n")},[]),ty=(0,s.useCallback)(()=>{ev.current&&clearTimeout(ev.current),ev.current=setTimeout(async()=>{let e=eg.current;if(e&&!ew.current){el.current=tv();try{let n=await (0,d.kS)(),r=(0,d.sQ)(t),s=document.documentElement.classList.contains("dark"),l=el.current.split("\n"),o=n.codeToTokens(l.join("\n"),{lang:r,theme:s?"github-dark":"github-light"}).tokens.map(e=>(0,d.b8)(e)),a=S(e);ey.current=!0,e.innerHTML=T(o),ey.current=!1,a&&M(e,a)}catch{}}},300)},[t,tv]);(0,s.useEffect)(()=>{if(W)return()=>{ev.current&&clearTimeout(ev.current)}},[W]);let tw=(0,s.useCallback)(()=>{let e=eg.current;if(!e)return;eo.current||(eo.current=!0,ei(!0));let t=e.children.length;t!==eh.current&&(eh.current=t,em(t))},[]),tk=(0,s.useCallback)(()=>{ey.current||ew.current||(tw(),ty())},[tw,ty]),tC=(0,s.useCallback)(e=>{if(!e.nativeEvent.isComposing&&("Tab"===e.key&&(e.preventDefault(),document.execCommand("insertText",!1," ")),"Enter"===e.key)){e.preventDefault();let t=eg.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=S(t),o=Array.from(t.children).indexOf(s),a=s.textContent||"",i=l?.offset??a.length,c=a.substring(0,i),u=a.substring(i);s.innerHTML=(0,d.ZD)(c||" ");let m=document.createElement("div");m.setAttribute("style",L),m.innerHTML=(0,d.ZD)(u||" "),s.after(m),M(t,{line:o+1,offset:0}),tw(),ty()}},[tw,ty]),tj=(0,s.useCallback)(e=>{e.preventDefault();let t=e.clipboardData.getData("text/plain");document.execCommand("insertText",!1,t)},[]),tN=(0,s.useCallback)(async(e=!1)=>{if(x){el.current=tv(),ed(!0);try{let n=await fetch("/api/files/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:x,path:t,content:el.current,expectedMtime:e?void 0:eb.current})}),r=await n.json();if(409===n.status&&r.conflict){try{let e=await fetch(`/api/files/text?cwd=${encodeURIComponent(x)}&path=${encodeURIComponent(t)}`),n=await e.json();ex({show:!0,diskContent:e.ok&&"string"==typeof n.content?n.content:void 0})}catch{ex({show:!0})}return}if(!n.ok)throw Error("Failed to save file");r.mtime&&(eb.current=r.mtime),eo.current=!1,ei(!1),ex({show:!1}),(0,E.oR)(es("toast.savedSuccess"),"success"),V?.()}catch(e){console.error("Error saving file:",e),(0,E.oR)(es("toast.saveFailed"),"error")}finally{ed(!1)}}},[x,t,tv,V]),tE=(0,s.useCallback)(async()=>{ea&&!ec&&await tN(!1)},[ea,ec,tN]),tL=(0,s.useCallback)(async()=>{ex({show:!1}),await tN(!0)},[tN]),tS=(0,s.useCallback)(()=>{if(void 0!==ef.diskContent){el.current=ef.diskContent;let t=ef.diskContent.split("\n").length;eh.current=t,em(t);let n=ef.diskContent!==e;eo.current=n,ei(n);let r=eg.current;r&&(r.innerHTML=T(ef.diskContent.split("\n").map(e=>(0,d.ZD)(e||" "))),ty())}ex({show:!1}),V?.()},[ef.diskContent,e,V,ty]),tM=(0,s.useCallback)(()=>{let e=ep.current;return e?Math.floor(e.scrollTop/20)+1:A?.current??1},[A]),tT=(0,s.useCallback)(async()=>{(!ea||await (0,E.lJ)(es("codeViewer.unsavedConfirm"),{danger:!0,confirmText:es("codeViewer.discardChanges"),cancelText:es("codeViewer.continueEditing")}))&&q?.(tM())},[ea,q,tM]);(0,s.useEffect)(()=>{if(!W)return;let e=e=>{(e.metaKey||e.ctrlKey)&&"s"===e.key&&(e.preventDefault(),tE())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[W,tE]);let tR=(0,s.useCallback)(()=>{let e=tv();J?.(e);let t=eg.current,n=t?S(t):null,r=tM();if(tu.enterNormal(),n){tu.setCursorLine(n.line);let t=e.split("\n")[n.line]??"";tu.setCursorCol(Math.max(0,Math.min(n.offset,Math.max(0,t.length-1))))}else tu.setCursorLine(Math.max(0,r-1));q?.(r)},[tv,J,tM,q,tu]);(0,s.useEffect)(()=>{if(!W)return;let e=e=>{let t="Escape"===e.key,n=e.ctrlKey&&"c"===e.key&&!e.metaKey&&!e.shiftKey;(t||X&&n)&&(e.preventDefault(),e.stopPropagation(),X?eo.current?(0,E.lJ)(es("codeViewer.unsavedExitConfirm"),{danger:!0,confirmText:es("codeViewer.discardChanges"),cancelText:es("codeViewer.continueEditing")}).then(e=>{e&&tR()}):tR():tT())};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[W,X,tT,tR]),(0,s.useImperativeHandle)(er,()=>({save:tE,close:tT,get isDirty(){return ea},get isSaving(){return ec}}),[tE,tT,ea,ec]);let t$=!!(F&&F.length>0),tP=(0,s.useMemo)(()=>{if(!F)return new Map;let e=[...new Set(F.map(e=>e.author))],t=new Map;return e.forEach((e,n)=>{t.set(e,g[n%g.length])}),t},[F]),[tI,tA]=(0,s.useState)(null),[tD,tO]=(0,s.useState)(null);(0,s.useEffect)(()=>{tA(null),tO(null)},[F]);let tB=(0,s.useCallback)((e,t)=>{tA(e.author);let n=t.currentTarget.getBoundingClientRect();tO({line:e,x:n.right+8,y:n.top})},[]),tK=(0,s.useCallback)(()=>{tA(null),tO(null)},[]),tF=(0,s.useCallback)(e=>{z&&(z({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}),tO(null))},[z]),tH=`${tp+2}ch`;return(0,r.jsxs)("div",{ref:eC,className:`h-full flex flex-col outline-none ${f}`,tabIndex:0,onClick:th,onDoubleClick:tf,children:[W&&ef.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:es("codeViewer.fileModifiedExternally")}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{onClick:tS,className:"px-3 py-1 text-sm rounded border border-border hover:bg-accent transition-colors",children:es("codeViewer.useDiskVersion")}),(0,r.jsx)("button",{onClick:tL,className:"px-3 py-1 text-sm rounded bg-amber-500 text-white hover:bg-amber-600 transition-colors",children:es("codeViewer.forceOverwrite")})]})]}),!W&&h&&eP&&(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:ej,type:"text",value:eI,onChange:e=>eG(e.target.value),onKeyDown:e8,placeholder:es("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:()=>eQ(!eA),className:`px-2 py-1 text-xs font-mono rounded border transition-colors ${eA?"bg-brand text-white border-brand":"border-border text-muted-foreground hover:bg-accent"}`,title:es("codeViewer.caseSensitive"),children:"Aa"}),(0,r.jsx)("button",{onClick:()=>e0(!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:es("codeViewer.wholeWordMatch"),children:"[ab]"}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:eV.length>0?`${eO+1}/${eV.length}`:es("common.noMatch")}),(0,r.jsx)("button",{onClick:e4,disabled:0===eV.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:es("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:e3,disabled:0===eV.length,className:"p-1 rounded hover:bg-accent disabled:opacity-50",title:es("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:()=>{eY(!1),eG("")},className:"p-1 rounded hover:bg-accent",title:es("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"})})})]}),W?(0,r.jsx)("div",{ref:ep,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:tH},children:Array.from({length:eu},(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:eg,contentEditable:!0,suppressContentEditableWarning:!0,onInput:tk,onKeyDown:tC,onPaste:tj,onCompositionStart:()=>{ew.current=!0},onCompositionEnd:()=>{ew.current=!1,tk()},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:ek,className:`flex-1 overflow-auto font-mono text-sm bg-secondary${eR?" cmd-held-container":""}`,children:(0,r.jsx)("div",{style:{height:`${eX.getTotalSize()}px`,minWidth:"100%",width:t$?`calc(${tp+tb+10}ch + 13rem)`:`${tp+tb+10}ch`,position:"relative"},children:eX.getVirtualItems().map(e=>{let t=eU[e.index];if("code"!==t.type)return null;let s=t.lineIndex,l=s+1,o=eM[s]||(0,d.ZD)(eq[s]||""),a=tr(s,o,I),i=eZ.has(l),c=eJ.get(l),u=c?.[0],m=!!(eK&&l>=eK.range.start&&l<=eK.range.end),h=to>=0?tl.current:null,f=!W&&H&&h===l?H[s]??null:null,x=t$?F[s]:void 0,g=t$&&s>0?F[s-1]:void 0,p=!!x&&(!g||g.hash!==x.hash),v=x?tP.get(x.author):void 0;return(0,r.jsx)(b,{virtualKey:e.key,lineNum:l,highlightedHtml:a,hasComments:i,firstComment:u,lineCommentsCount:c?.length,isInRange:m,showLineNumbers:n,lineNumChars:tp,commentsEnabled:ez,virtualItemSize:e.size,virtualItemStart:e.start,onCommentBubbleClick:e6,onCmdClick:tg,onTokenHover:tx,onTokenHoverLeave:B,flashLine:e$,blameLine:x,showBlameInfo:p,blameAuthorColor:v,isBlameHovered:!!(x&&tI===x.author),onBlameClick:tF,onBlameMouseEnter:tB,onBlameMouseLeave:tK,inlineBlameData:f,onInlineBlameClick:tF,isCursorLine:X&&!W&&tu.state.cursorLine===s,cursorCol:X&&!W&&tu.state.cursorLine===s?tu.state.cursorCol:void 0},e.key)})})}),X&&(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"===tu.state.mode&&(0,r.jsx)("span",{className:"text-green-11 font-medium",children:"NORMAL"}),"insert"===tu.state.mode&&(0,r.jsx)("span",{className:"text-blue-11 font-medium",children:"INSERT"}),"command"===tu.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:ti,value:tu.state.commandInput,onChange:e=>tu.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(),tu.handleKeyDown(e.nativeEvent))},className:"flex-1 bg-transparent outline-none text-foreground ml-0.5",spellCheck:!1,autoComplete:"off"})]}),"search"===tu.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:tc,value:tu.state.searchInput,onChange:e=>tu.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(),tu.handleKeyDown(e.nativeEvent))},className:"flex-1 bg-transparent outline-none text-foreground ml-0.5",spellCheck:!1,autoComplete:"off"})]}),tu.state.keyBuffer&&"normal"===tu.state.mode&&(0,r.jsx)("span",{className:"ml-2 text-muted-foreground",children:tu.state.keyBuffer}),tu.state.isDirty&&("normal"===tu.state.mode||"command"===tu.state.mode)&&(0,r.jsx)("span",{className:"ml-2 text-amber-11",children:"[+]"}),(0,r.jsxs)("span",{className:"ml-auto text-muted-foreground",children:[tu.state.cursorLine+1,":",tu.state.cursorCol+1]})]}),eT&&ta&&(0,o.createPortal)((0,r.jsxs)(r.Fragment,{children:[!W&&(0,r.jsx)(u.f,{floatingToolbarRef:eN,bumpRef:eL,container:ta,onAddComment:e9,onSendToAI:e7,onSearch:en?te:void 0,isChatLoading:eH?.isLoading}),!W&&eK&&(0,r.jsx)(i.t,{x:eK.x,y:eK.y,range:eK.range,codeContent:eK.codeContent,container:ta,onSubmit:tt,onClose:()=>e2(null)}),!W&&eF&&(0,r.jsx)(i.G,{x:eF.x,y:eF.y,range:eF.range,filePath:t,codeContent:eF.codeContent,container:ta,onSubmit:tn,onClose:()=>e5(null),isChatLoading:eH?.isLoading}),!W&&eB&&(0,r.jsx)(m.t,{x:eB.x,y:eB.y,comment:eB.comment,container:ta,onClose:()=>e1(null),onUpdateComment:eW,onDeleteComment:e_}),tD&&(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(tD.x,window.innerWidth-450),top:Math.max(8,Math.min(tD.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:tP.get(tD.line.author)?.border||"#666"},children:tD.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:tD.line.author}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:tD.line.authorEmail})]})]}),(0,r.jsx)("div",{className:"mt-2 text-sm text-foreground whitespace-pre-wrap max-h-48 overflow-y-auto",children:tD.line.message}),(0,r.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground border-t border-border pt-2",children:[(0,N.fw)(tD.line.time)," \xb7 ",new Date(1e3*tD.line.time).toLocaleString(),(0,r.jsx)("span",{className:"ml-2 text-brand",children:es("codeViewer.clickToViewDetails")})]})]})]}),ta)]})});function $({content:e,filePath:t,className:n=""}){let l=(0,s.useMemo)(()=>e.split("\n"),[e]),o=(0,c.C)(l,t),a=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:`${a+2}ch`},children:t+1}),(0,r.jsx)("span",{className:"flex-1",dangerouslySetInnerHTML:{__html:o[t]||(0,d.ZD)(e||" ")}})]},t))})}},91694:(e,t,n)=>{n.d(t,{G:()=>a,t:()=>o});var r=n(95155),s=n(12115),l=n(79114);function o({x:e,y:t,range:n,codeContent:a,container:i,onSubmit:c,onClose:d}){let{t:u}=(0,l.Bd)(),[m,h]=(0,s.useState)(""),[f,x]=(0,s.useState)(!1),g=(0,s.useRef)(null),p=(0,s.useRef)(null),[b,v]=(0,s.useState)({x:0,y:0}),y=a?.split("\n").slice(0,5).join("\n"),w=!!a&&a.split("\n").length>5;return(0,s.useEffect)(()=>{if(g.current&&i){let n=i.getBoundingClientRect(),r=g.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(()=>v({x:s,y:l}))}},[e,t,i]),(0,s.useEffect)(()=>{p.current?.focus()},[]),(0,s.useEffect)(()=>{let e=e=>{f||!g.current||g.current.contains(e.target)||d()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[d,f]),(0,r.jsxs)("div",{ref:g,className:"absolute z-[200] w-[640px] bg-card border border-border rounded-lg shadow-lg overflow-hidden",style:{left:b.x,top:b.y},children:[(0,r.jsx)("div",{className:"px-3 py-2 bg-amber-9/10 border-b border-border",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-amber-11",children:u("comments.addComment")}),(n.start>0||n.end>0)&&(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:u("comments.lineRange",{start:n.start,end:n.end})})]})}),a&&(0,r.jsx)("div",{className:"px-3 py-2 bg-secondary/50 border-b border-border max-h-24 overflow-hidden",children:(0,r.jsxs)("pre",{className:"text-xs font-mono text-muted-foreground whitespace-pre-wrap break-all",children:[y,w&&(0,r.jsx)("span",{className:"text-muted-foreground/50",children:"..."})]})}),(0,r.jsxs)("div",{className:"p-2",children:[(0,r.jsx)("textarea",{ref:p,value:m,onChange:e=>h(e.target.value),placeholder:u("comments.inputPlaceholder"),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card resize-none focus:outline-none focus:ring-1 focus:ring-ring disabled:opacity-50 disabled:cursor-not-allowed",rows:2,disabled:f,onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),!f&&m.trim()&&(x(!0),c(m.trim()))),"Escape"!==e.key||f||d()}}),(0,r.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:u(f?"comments.submitting":"comments.enterSubmit")})]})]})}function a({x:e,y:t,range:n,filePath:o,codeContent:i,container:c,onSubmit:d,onClose:u,isChatLoading:m}){let{t:h}=(0,l.Bd)(),[f,x]=(0,s.useState)(""),g=(0,s.useRef)(null),p=(0,s.useRef)(null),[b,v]=(0,s.useState)({x:0,y:0});(0,s.useEffect)(()=>{if(g.current&&c){let n=c.getBoundingClientRect(),r=g.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(()=>v({x:s,y:l}))}},[e,t,c]),(0,s.useEffect)(()=>{p.current?.focus()},[]),(0,s.useEffect)(()=>{let e=e=>{g.current&&!g.current.contains(e.target)&&u()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[u]);let y=i?.split("\n").slice(0,5).join("\n"),w=!!i&&i.split("\n").length>5;return(0,r.jsxs)("div",{ref:g,className:"absolute z-[200] w-[640px] bg-card border border-border rounded-lg shadow-lg overflow-hidden",style:{left:b.x,top:b.y},children:[(0,r.jsxs)("div",{className:"px-3 py-2 bg-brand/10 border-b border-border",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-xs font-medium text-brand",children:h("comments.askAI")}),(n.start>0||n.end>0)&&(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:h("comments.lineRange",{start:n.start,end:n.end})})]}),o&&(0,r.jsx)("div",{className:"mt-1 text-xs text-muted-foreground truncate",children:o})]}),i&&(0,r.jsx)("div",{className:"px-3 py-2 bg-secondary/50 border-b border-border max-h-24 overflow-hidden",children:(0,r.jsxs)("pre",{className:"text-xs font-mono text-muted-foreground whitespace-pre-wrap break-all",children:[y,w&&(0,r.jsx)("span",{className:"text-muted-foreground/50",children:"..."})]})}),(0,r.jsxs)("div",{className:"p-2",children:[(0,r.jsx)("textarea",{ref:p,value:f,onChange:e=>x(e.target.value),placeholder:h("comments.inputQuestion"),className:"w-full px-2 py-1.5 text-sm border border-border rounded bg-card resize-none focus:outline-none focus:ring-1 focus:ring-ring disabled:opacity-50 disabled:cursor-not-allowed",rows:2,disabled:m,onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),!m&&f.trim()&&(d(f.trim()),u())),"Escape"===e.key&&u()}}),(0,r.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:h(m?"comments.aiGenerating":"comments.enterSend")})]})]})}},97440:(e,t,n)=>{n.d(t,{r:()=>o});var r=n(95155),s=n(12115),l=n(79114);function o({isOpen:e,onClose:t,onSelectSession:n,onAddProject:a}){let{t:i}=(0,l.Bd)(),[c,d]=(0,s.useState)(!1),[u,m]=(0,s.useState)([]),[h,f]=(0,s.useState)({}),[x,g]=(0,s.useState)(!1),[p,b]=(0,s.useState)(null),[v,y]=(0,s.useState)(""),w=(0,s.useRef)(null),k=(0,s.useCallback)(async()=>{g(!0),b(null),f({});try{let e=await fetch("/api/sessions/projects");if(!e.ok)throw Error("Failed to load projects");let t=await e.json();m(t)}catch(e){b(e instanceof Error?e.message:"Unknown error")}finally{g(!1)}},[]),C=(0,s.useCallback)(async e=>{f(t=>({...t,[e]:{...t[e],isExpanded:!0,isLoading:!0,sessions:[],error:null}}));try{let t=await fetch(`/api/sessions/projects/${encodeURIComponent(e)}`);if(!t.ok)throw Error("Failed to load sessions");let n=await t.json();f(t=>({...t,[e]:{...t[e],isLoading:!1,sessions:n}}))}catch(t){f(n=>({...n,[e]:{...n[e],isLoading:!1,error:t instanceof Error?t.message:"Unknown error"}}))}},[]),j=(0,s.useCallback)(e=>{let t=h[e];t?.isExpanded?f(t=>({...t,[e]:{...t[e],isExpanded:!1}})):t?.sessions?.length?f(t=>({...t,[e]:{...t[e],isExpanded:!0}})):C(e)},[h,C]);(0,s.useEffect)(()=>{e&&(k(),setTimeout(()=>{w.current?.focus()},100))},[e,k]);let N=(0,s.useCallback)(async()=>{if(!c){d(!0);try{let e=await fetch("/api/pick-folder"),n=await e.json();n.folder&&a&&(a(n.folder),t())}catch{}finally{d(!1)}}},[c,a,t]);return((0,s.useEffect)(()=>{let n=n=>{"Escape"===n.key&&e&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e,t]),e)?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:t}),(0,r.jsxs)("div",{className:"relative w-full max-w-6xl h-[90vh] mx-4 bg-card rounded-lg shadow-xl flex flex-col overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,r.jsx)("h2",{className:"text-sm font-medium text-foreground",children:i("sessions.projectList")}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("input",{ref:w,type:"text",placeholder:i("workspace.searchProjectPath"),value:v,onChange:e=>y(e.target.value),className:"px-2 py-1 text-xs border border-border rounded bg-card text-foreground placeholder-slate-9 focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"}),a&&(0,r.jsxs)("button",{onClick:N,disabled:c,className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-accent transition-colors disabled:opacity-50",title:i("sessions.openFolder"),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:"M12 10v6m3-3H9m-4 7h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),c?i("sessions.selectingFolder"):i("sessions.openFolder")]}),(0,r.jsx)("button",{onClick:t,className:"p-1 text-slate-9 hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,r.jsx)("svg",{className:"w-5 h-5",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"})})})]})]}),(0,r.jsxs)("div",{className:"flex-1 overflow-y-auto p-4",children:[x&&(0,r.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,r.jsxs)("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,r.jsx)("span",{children:i("workspace.loadingProjects")})]})}),p&&(0,r.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,r.jsx)("div",{className:"text-xs text-red-11",children:p})}),!x&&!p&&0===u.length&&(0,r.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:i("workspace.projectNotFound")})}),!x&&!p&&u.filter(e=>e.fullPath.toLowerCase().includes(v.toLowerCase())).map(e=>{let t=h[e.encodedPath]||{isExpanded:!1,isLoading:!1,sessions:[],error:null};return(0,r.jsxs)("div",{className:"mb-3",children:[(0,r.jsxs)("button",{onClick:()=>j(e.encodedPath),className:"w-full flex items-center gap-2 p-2 rounded hover:bg-accent transition-colors text-left",children:[(0,r.jsx)("svg",{className:`w-3 h-3 text-muted-foreground transition-transform ${t.isExpanded?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,r.jsx)("svg",{className:"w-4 h-4 text-muted-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),(0,r.jsx)("span",{className:"flex-1 text-xs font-medium text-foreground truncate",title:e.fullPath,children:e.fullPath}),(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",e.sessionCount,")"]})]}),t.isExpanded&&(0,r.jsxs)("div",{className:"ml-6 mt-2",children:[t.isLoading&&(0,r.jsxs)("div",{className:"flex items-center gap-2 p-3 text-xs text-muted-foreground",children:[(0,r.jsxs)("svg",{className:"animate-spin h-3 w-3",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,r.jsx)("span",{children:i("sessions.loadingSessions")})]}),t.error&&(0,r.jsx)("div",{className:"p-3 text-xs text-red-11",children:t.error}),!t.isLoading&&!t.error&&(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:t.sessions.map(t=>(0,r.jsxs)("div",{onClick:()=>{var r;let s;return r=e.fullPath,s=(t.path.split("/").pop()||"").replace(".jsonl",""),void(n?n(r,s):window.parent.postMessage({type:"OPEN_PROJECT",cwd:r,sessionId:s},"*"))},className:"p-3 bg-secondary rounded border border-border hover:border-brand hover:shadow-md cursor-pointer transition-all",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[t.engine&&"claude"!==t.engine&&(0,r.jsx)("span",{className:`shrink-0 px-1 py-0.5 text-[10px] leading-none font-medium rounded ${"claude2"===t.engine?"bg-orange-500/15 text-orange-11":"ollama"===t.engine?"bg-blue-500/15 text-blue-11":"codex"===t.engine?"bg-green-500/15 text-green-11":"kimi"===t.engine?"bg-purple-500/15 text-purple-11":"bg-muted text-muted-foreground"}`,children:t.engine}),(0,r.jsx)("h4",{className:"text-xs font-medium text-foreground truncate",title:t.title,children:t.title})]}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground mb-2",children:new Date(t.modifiedAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}),(0,r.jsxs)("div",{className:"space-y-0.5 text-xs",children:[t.firstMessages.map((e,t)=>(0,r.jsxs)("div",{className:"text-foreground truncate",title:e,children:[(0,r.jsx)("span",{className:"text-slate-9 mr-1",children:"•"}),e]},`first-${t}`)),t.lastMessages.length>0&&(0,r.jsx)("div",{className:"text-slate-9 text-center py-0.5",children:"\xb7\xb7\xb7"}),t.lastMessages.map((e,t)=>(0,r.jsxs)("div",{className:"text-foreground truncate",title:e,children:[(0,r.jsx)("span",{className:"text-slate-9 mr-1",children:"•"}),e]},`last-${t}`))]})]},t.path))})]})]},e.encodedPath)})]})]})]}):null}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9062],{24750:(e,t,r)=>{r.d(t,{_:()=>d});var n=r(95155),o=r(12115),s=r(79114),l=r(44810),i=r(38093),a=r(87918);function c(e,t,r){let n=(e,r)=>t[e]||r,o=[],s=null!=r?`[${r+1}] `:"",l=e.anchor.selectedText.length>200?e.anchor.selectedText.slice(0,197)+"...":e.anchor.selectedText;for(let t of(o.push(`${s}${a.A.t("review.quoteRef",{text:l})}`),o.push(a.A.t("review.commentAuthor",{author:n(e.authorId,e.author),content:e.content})),e.replies))o.push(a.A.t("review.replyAuthor",{author:n(t.authorId,t.author),content:t.content}));return o.join("\n")}function d({isOpen:e,onClose:t,comments:r,reviewTitle:h,userNameMap:x,onCommentClick:p}){let{t:m}=(0,s.Bd)(),[f,g]=(0,o.useState)(null),[v,b]=(0,o.useState)(!1);if(!e)return null;let j=[...r].sort((e,t)=>e.anchor.startOffset-t.anchor.startOffset),w=(e,t)=>x[e]||t,y=async e=>{g(e.id);try{let t=c(e,x);await navigator.clipboard.writeText(t),(0,i.oR)(m("toast.copiedComment"))}catch{(0,i.oR)(m("toast.copyFailed"),"error")}finally{g(null)}},N=async()=>{if(0!==r.length){b(!0);try{let e=function(e,t,r){if(0===e.length)return"";let n=[...e].sort((e,t)=>e.anchor.startOffset-t.anchor.startOffset),o=[a.A.t("review.reviewSummary",{title:t}),""];return n.forEach((e,t)=>{o.push(c(e,r,t)),o.push("")}),o.push(a.A.t("review.totalNComments",{count:e.length})),o.join("\n").trim()}(r,h,x);await navigator.clipboard.writeText(e),(0,i.oR)(m("toast.copiedAllComments"))}catch{(0,i.oR)(m("toast.copyFailed"),"error")}finally{b(!1)}}},k=e=>{p?.(e),t()},C=j.filter(e=>!e.closed),L=j.filter(e=>e.closed),A=(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:t,children:(0,n.jsxs)("div",{className:"w-full max-w-2xl max-h-[80vh] bg-card border border-border rounded-lg shadow-xl flex flex-col overflow-hidden",onClick:e=>e.stopPropagation(),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-secondary",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:m("review.allCommentsTitle")}),(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:[m("review.commentsCountBrief",{count:r.length}),L.length>0&&` (${m("review.closedCount",{count:L.length})})`]}),r.length>0&&(0,n.jsx)("button",{onClick:N,disabled:v,className:"p-1 rounded hover:bg-accent text-muted-foreground disabled:opacity-50",title:m("review.copyAllComments"),children:v?(0,n.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),(0,n.jsx)("button",{onClick:t,className:"p-1 rounded hover:bg-accent text-muted-foreground",children:(0,n.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto p-3",children:0===r.length?(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,n.jsx)("div",{className:"text-2xl mb-2",children:"\uD83D\uDCAC"}),(0,n.jsx)("span",{className:"text-sm",children:m("review.noComments")})]}):(0,n.jsxs)("div",{className:"space-y-2",children:[C.map((e,t)=>(0,n.jsx)(u,{comment:e,index:t,resolveAuthor:w,copyingId:f,onCopy:y,onClick:k},e.id)),L.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"text-[11px] text-muted-foreground/60 pt-2 pb-1 px-1",children:m("review.closedComments",{count:L.length})}),L.map((e,t)=>(0,n.jsx)(u,{comment:e,index:C.length+t,resolveAuthor:w,copyingId:f,onCopy:y,onClick:k,closed:!0},e.id))]})]})})]})});return(0,n.jsx)(l.ZL,{children:A})}function u({comment:e,index:t,resolveAuthor:r,copyingId:o,onCopy:s,onClick:l,closed:i}){let c=e.anchor.selectedText.length>100?e.anchor.selectedText.slice(0,97)+"...":e.anchor.selectedText;return(0,n.jsxs)("div",{className:`rounded-lg border border-border hover:border-muted-foreground/30 transition-all cursor-pointer group ${i?"opacity-50":""}`,onClick:()=>l(e.id),children:[(0,n.jsx)("div",{className:"px-3 pt-2.5 pb-1",children:(0,n.jsx)("div",{className:"text-xs bg-yellow-500/10 border-l-2 border-yellow-500 px-2 py-1 rounded-r text-muted-foreground truncate",children:c})}),(0,n.jsxs)("div",{className:"px-3 pt-1.5 pb-2 flex items-start gap-2",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,n.jsx)("span",{className:"w-4 h-4 rounded-full bg-brand/20 text-brand flex items-center justify-center text-[9px] font-bold flex-shrink-0",children:r(e.authorId,e.author).charAt(0)}),(0,n.jsx)("span",{className:"text-xs font-medium",children:r(e.authorId,e.author)}),(0,n.jsx)("span",{className:"text-[10px] text-muted-foreground",children:new Date(e.createdAt).toLocaleString("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}),i&&(0,n.jsx)("span",{className:"text-[10px] text-muted-foreground/60",children:a.A.t("review.closedLabel")})]}),(0,n.jsx)("p",{className:"text-sm text-foreground line-clamp-2 pl-6",children:e.content}),e.replies.length>0&&(0,n.jsxs)("div",{className:"pl-6 mt-1 space-y-0.5",children:[e.replies.slice(0,3).map(e=>(0,n.jsxs)("div",{className:"text-xs text-muted-foreground truncate",children:[(0,n.jsx)("span",{className:"font-medium",children:r(e.authorId,e.author)}),": ",e.content]},e.id)),e.replies.length>3&&(0,n.jsx)("div",{className:"text-[10px] text-muted-foreground/60",children:a.A.t("review.moreReplies",{count:e.replies.length-3})})]})]}),(0,n.jsx)("button",{onClick:t=>{t.stopPropagation(),s(e)},disabled:o===e.id,className:"p-1 rounded opacity-0 group-hover:opacity-100 hover:bg-accent text-muted-foreground transition-opacity disabled:opacity-50 flex-shrink-0 mt-0.5",title:a.A.t("review.copyComment"),children:o===e.id?(0,n.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]})]})}},80777:(e,t,r)=>{r.d(t,{m:()=>l});var n=r(95155),o=r(12115),s=r(44810);function l({content:e,children:t,delay:r=300,className:i=""}){let[a,c]=(0,o.useState)(!1),[d,u]=(0,o.useState)({top:0,left:0}),h=(0,o.useRef)(null),x=(0,o.useRef)({x:0,y:0}),p=(0,o.useRef)(null),m=(0,s.F2)();return(0,o.useEffect)(()=>{if(a&&p.current){let e=p.current.getBoundingClientRect(),t=m?.getBoundingClientRect(),r=t?.left??0,n=t?.top??0,o=t?.width??window.innerWidth,s=t?.height??window.innerHeight,l=e.right-r,i=e.left-r,a=e.bottom-n,c=d.left,h=d.top;l>o-8&&(c=o-e.width-8),i<8&&(c=8),a>s-8&&(h=x.current.y-e.height-8-n),(c!==d.left||h!==d.top)&&queueMicrotask(()=>u({top:h,left:c}))}},[a,d.left,d.top,m]),(0,o.useEffect)(()=>()=>{h.current&&clearTimeout(h.current)},[]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{onMouseEnter:()=>{h.current=setTimeout(()=>{let{x:e,y:t}=x.current,r=m?.getBoundingClientRect(),n=r?.left??0;u({top:t+12-(r?.top??0),left:e-n}),c(!0)},r)},onMouseMove:e=>{x.current={x:e.clientX,y:e.clientY}},onMouseLeave:()=>{h.current&&(clearTimeout(h.current),h.current=null),c(!1)},className:i,children:t}),a&&(0,n.jsx)(s.ZL,{children:(0,n.jsx)("div",{ref:p,className:"fixed z-[9999] px-2 py-1 text-xs text-foreground bg-accent rounded shadow-lg max-w-md break-words pointer-events-none",style:{top:d.top,left:d.left},children:e})})]})}},94002:(e,t,r)=>{r.d(t,{l:()=>a});var n=r(95155),o=r(12115),s=r(79114),l=r(80777);let i=e=>`h1[data-source-start="${e}"], h2[data-source-start="${e}"], h3[data-source-start="${e}"], h4[data-source-start="${e}"], h5[data-source-start="${e}"], h6[data-source-start="${e}"]`;function a({content:e,containerRef:t,width:r="w-80"}){let{t:c}=(0,s.Bd)(),d=(0,o.useMemo)(()=>(function(e){let t=[],r=e.split("\n"),n=!1;for(let e=0;e<r.length;e++){let o=r[e];if(o.trimStart().startsWith("```")){n=!n;continue}if(n)continue;let s=/^(#{1,6})\s+(.+)$/.exec(o);s&&t.push({level:s[1].length,text:s[2].replace(/\s*#+\s*$/,""),sourceLine:e+1})}return t})(e),[e]),[u,h]=(0,o.useState)(!1),[x,p]=(0,o.useState)(null),m=(0,o.useCallback)(e=>{let r=t.current;if(!r)return;let n=r.querySelector(i(e));n&&n.scrollIntoView({behavior:"smooth",block:"start"})},[t]);return((0,o.useEffect)(()=>{let e=t.current;if(!e||0===d.length)return;let r=()=>{let t=[];for(let r of d){let n=e.querySelector(i(r.sourceLine));if(n){let o=n.getBoundingClientRect().top-e.getBoundingClientRect().top;t.push({line:r.sourceLine,top:o})}}let r=null;for(let e of t)e.top<=60&&(r=e.line);null===r&&t.length>0&&(r=t[0].line),p(r)},n=setTimeout(r,150);return e.addEventListener("scroll",r,{passive:!0}),()=>{clearTimeout(n),e.removeEventListener("scroll",r)}},[d,e,t]),0===d.length)?null:(0,n.jsxs)("div",{className:`border-r border-border flex-shrink-0 flex flex-col transition-[width] duration-200 ${u?"w-8":r}`,children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-2 py-1.5 border-b border-border flex-shrink-0",children:[!u&&(0,n.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:c("editor.toc")}),(0,n.jsx)("button",{onClick:()=>h(e=>!e),className:"p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:c(u?"editor.expandToc":"editor.collapseToc"),children:(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u?(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}):(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})})]}),!u&&(0,n.jsx)("nav",{className:"flex-1 overflow-y-auto py-1",children:d.map((e,t)=>(0,n.jsx)(l.m,{content:e.text,delay:400,children:(0,n.jsx)("button",{onClick:()=>m(e.sourceLine),className:`block w-full text-left text-sm py-1 px-2 truncate transition-colors hover:bg-accent ${x===e.sourceLine?"text-brand font-medium bg-brand/5":"text-muted-foreground"}`,style:{paddingLeft:`${(e.level-1)*12+8}px`},children:e.text})},t))})]})}},95766:(e,t,r)=>{r.d(t,{W:()=>s});var n=r(48250);let o=new Set(["p","h1","h2","h3","h4","h5","h6","li","blockquote","pre","table","tr","hr","div","ul","ol"]);function s(){return e=>{(0,n.YR)(e,"element",e=>{if(o.has(e.tagName)&&e.position&&(e.properties||(e.properties={}),e.properties["data-source-start"]=e.position.start.line,e.properties["data-source-end"]=e.position.end.line,"pre"===e.tagName)){let t=e.children?.find(e=>"element"===e.type&&"code"===e.tagName);t&&(t.properties||(t.properties={}),t.properties["data-source-start"]=e.position.start.line,t.properties["data-source-end"]=e.position.end.line)}})}}}}]);
|
package/.next-prod/static/chunks/app/{layout-44210aade5d56585.js → layout-fc306a84f663d5af.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{7815:e=>{e.exports={style:{fontFamily:"'Lora', 'Lora Fallback'",fontStyle:"normal"},className:"__className_c1a059",variable:"__variable_c1a059"}},36791:e=>{e.exports={style:{fontFamily:"'Inter', 'Inter Fallback'",fontStyle:"normal"},className:"__className_f367f3",variable:"__variable_f367f3"}},51743:()=>{},66924:e=>{e.exports={style:{fontFamily:"'JetBrains Mono', 'JetBrains Mono Fallback'",fontStyle:"normal"},className:"__className_3c557b",variable:"__variable_3c557b"}},76823:(e,a,n)=>{Promise.resolve().then(n.t.bind(n,36791,23)),Promise.resolve().then(n.t.bind(n,7815,23)),Promise.resolve().then(n.t.bind(n,66924,23)),Promise.resolve().then(n.t.bind(n,51743,23)),Promise.resolve().then(n.bind(n,83599))},83599:(e,a,n)=>{"use strict";n.d(a,{Providers:()=>u});var t=n(95155),l=n(12115),r=n(79114),s=n(87918);function o(e){return"auto"!==e&&e?e:navigator.language.startsWith("zh")?"zh":"en"}function i({children:e}){return(0,l.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{let a=o(e.language||"auto");s.A.language!==a&&s.A.changeLanguage(a)}).catch(()=>{let e=o("auto");s.A.language!==e&&s.A.changeLanguage(e)})},[]),(0,l.useEffect)(()=>{let e=e=>(function(e){for(let a of document.querySelectorAll("iframe"))try{a.contentWindow?.postMessage({type:"cockpit:language-change",lang:e},"*")}catch{}})(e);return s.A.on("languageChanged",e),()=>{s.A.off("languageChanged",e)}},[]),(0,l.useEffect)(()=>{if(window===window.parent)return;let e=e=>{e.data?.type==="cockpit:language-change"&&e.data.lang&&s.A.language!==e.data.lang&&s.A.changeLanguage(e.data.lang)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[]),(0,t.jsx)(r.xC,{i18n:s.A,children:e})}var c=n(72816),g=n(38093);function u({children:e}){return(0,t.jsx)(i,{children:(0,t.jsx)(c.N,{children:(0,t.jsx)(g.tE,{children:e})})})}}},e=>{e.O(0,[
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{7815:e=>{e.exports={style:{fontFamily:"'Lora', 'Lora Fallback'",fontStyle:"normal"},className:"__className_c1a059",variable:"__variable_c1a059"}},36791:e=>{e.exports={style:{fontFamily:"'Inter', 'Inter Fallback'",fontStyle:"normal"},className:"__className_f367f3",variable:"__variable_f367f3"}},51743:()=>{},66924:e=>{e.exports={style:{fontFamily:"'JetBrains Mono', 'JetBrains Mono Fallback'",fontStyle:"normal"},className:"__className_3c557b",variable:"__variable_3c557b"}},76823:(e,a,n)=>{Promise.resolve().then(n.t.bind(n,36791,23)),Promise.resolve().then(n.t.bind(n,7815,23)),Promise.resolve().then(n.t.bind(n,66924,23)),Promise.resolve().then(n.t.bind(n,51743,23)),Promise.resolve().then(n.bind(n,83599))},83599:(e,a,n)=>{"use strict";n.d(a,{Providers:()=>u});var t=n(95155),l=n(12115),r=n(79114),s=n(87918);function o(e){return"auto"!==e&&e?e:navigator.language.startsWith("zh")?"zh":"en"}function i({children:e}){return(0,l.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{let a=o(e.language||"auto");s.A.language!==a&&s.A.changeLanguage(a)}).catch(()=>{let e=o("auto");s.A.language!==e&&s.A.changeLanguage(e)})},[]),(0,l.useEffect)(()=>{let e=e=>(function(e){for(let a of document.querySelectorAll("iframe"))try{a.contentWindow?.postMessage({type:"cockpit:language-change",lang:e},"*")}catch{}})(e);return s.A.on("languageChanged",e),()=>{s.A.off("languageChanged",e)}},[]),(0,l.useEffect)(()=>{if(window===window.parent)return;let e=e=>{e.data?.type==="cockpit:language-change"&&e.data.lang&&s.A.language!==e.data.lang&&s.A.changeLanguage(e.data.lang)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[]),(0,t.jsx)(r.xC,{i18n:s.A,children:e})}var c=n(72816),g=n(38093);function u({children:e}){return(0,t.jsx)(i,{children:(0,t.jsx)(c.N,{children:(0,t.jsx)(g.tE,{children:e})})})}}},e=>{e.O(0,[8225,3334,9114,3530,8441,3794,7358],()=>e(e.s=76823)),_N_E=e.O()}]);
|