@baique/pi-web-sky 0.1.36 → 0.1.38

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.
Files changed (48) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +11 -11
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/react-loadable-manifest.json +2 -2
  6. package/.next/required-server-files.js +2 -2
  7. package/.next/required-server-files.json +2 -2
  8. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  9. package/.next/server/app/_global-error.html +1 -1
  10. package/.next/server/app/_global-error.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/_not-found.html +1 -1
  16. package/.next/server/app/_not-found.rsc +2 -2
  17. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  18. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  19. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  20. package/.next/server/app/api/app-update/route.js +1 -1
  21. package/.next/server/app/index.html +1 -1
  22. package/.next/server/app/index.rsc +4 -4
  23. package/.next/server/app/index.segments/__PAGE__.segment.rsc +4 -4
  24. package/.next/server/app/index.segments/_full.segment.rsc +4 -4
  25. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  26. package/.next/server/app/page.js +2 -2
  27. package/.next/server/app/page_client-reference-manifest.js +1 -1
  28. package/.next/server/app-paths-manifest.json +11 -11
  29. package/.next/server/middleware-build-manifest.js +1 -1
  30. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  31. package/.next/server/pages/404.html +1 -1
  32. package/.next/server/pages/500.html +1 -1
  33. package/.next/server/server-reference-manifest.json +1 -1
  34. package/.next/static/chunks/{5315.7e72d26a3ad3bd9a.js → 5315.dba7515ae6e139ae.js} +1 -1
  35. package/.next/static/chunks/{7999.f4ab221861378788.js → 7999.879d5a20e8641752.js} +1 -1
  36. package/.next/static/chunks/app/{layout-ebbc0d287267b07b.js → layout-8d43a5f5cb228adb.js} +1 -1
  37. package/.next/static/chunks/app/{page-e568623a44c67606.js → page-c18559cf60413a65.js} +2 -2
  38. package/.next/static/chunks/{webpack-2e4e348867a555cd.js → webpack-4bbf04891e910713.js} +1 -1
  39. package/.next/trace +48 -8
  40. package/.next/trace-build +1 -1
  41. package/README.md +12 -1
  42. package/THIRD_PARTY_NOTICES.md +113 -0
  43. package/package.json +3 -1
  44. package/public/icons/apple-touch-icon.png +0 -0
  45. package/public/icons/icon-192.png +0 -0
  46. package/public/icons/icon-512.png +0 -0
  47. /package/.next/static/{EoBw3VYlygpr1EqlVOa5b → uMxGf7jVVswENHUfDPlFN}/_buildManifest.js +0 -0
  48. /package/.next/static/{EoBw3VYlygpr1EqlVOa5b → uMxGf7jVVswENHUfDPlFN}/_ssgManifest.js +0 -0
@@ -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-2e4e348867a555cd.js"/><script src="/_next/static/chunks/4bd1b696-8a4ab4fdf0ae305a.js" async=""></script><script src="/_next/static/chunks/3794-d29203733ca4633c.js" async=""></script><script src="/_next/static/chunks/main-app-b3e8a8d15d83e1f0.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,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;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-2e4e348867a555cd.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[27123,[],\"default\",1]\n7:X\n0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"_global-error\",{\"children\":[\"__PAGE__\",{},\"$undefined\",\"$undefined\",4624]},\"$undefined\",\"$undefined\",4624]},\"$undefined\",\"$undefined\",4624],[[\"$\",\"$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,\"r\":\"$undefined\",\"s\":\"$undefined\",\"a\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"EoBw3VYlygpr1EqlVOa5b\"}\n7:C\n9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n6:null\nb:[]\n"])</script></body></html>
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-4bbf04891e910713.js"/><script src="/_next/static/chunks/4bd1b696-8a4ab4fdf0ae305a.js" async=""></script><script src="/_next/static/chunks/3794-d29203733ca4633c.js" async=""></script><script src="/_next/static/chunks/main-app-b3e8a8d15d83e1f0.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,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;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-4bbf04891e910713.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[27123,[],\"default\",1]\n7:X\n0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"_global-error\",{\"children\":[\"__PAGE__\",{},\"$undefined\",\"$undefined\",4624]},\"$undefined\",\"$undefined\",4624]},\"$undefined\",\"$undefined\",4624],[[\"$\",\"$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,\"r\":\"$undefined\",\"s\":\"$undefined\",\"a\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"uMxGf7jVVswENHUfDPlFN\"}\n7:C\n9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n6:null\nb:[]\n"])</script></body></html>
@@ -1 +1 @@
1
- {"node":{},"edge":{},"encryptionKey":"0dD/jIvomahNqLzMF1tq1n/tUSIAw6OeDxTLFedvaKg="}
1
+ {"node":{},"edge":{},"encryptionKey":"cE25iSp+WGB68qToHzJ0zm2/Ml+kVilq/vl3ifMeR0c="}
@@ -1,4 +1,4 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5315],{15315:(e,t,r)=>{r.r(t),r.d(t,{SessionCanvas:()=>g});var n=r(95155),o=r(12115),i=r(37206),a=r(39247),s=r(96793),l=r(64536),d=r(71309),c=r(34229),u=r(26479),p=r(24456);function h({editor:e,inputRef:t}){let{t:r}=(0,a.s)(),{setHighlight:i}=(0,d.kz)(),[s,l]=(0,o.useState)(""),[c,u]=(0,o.useState)(!1),[p,x]=(0,o.useState)(-1),g=(0,o.useRef)(null),f=t??g,b=(0,o.useMemo)(()=>{var t;let r;return e?(t=function(e){let t=[];for(let r of e.getCurrentPageShapes())if("session-card"===r.type){let e=String(r.props.title??"").trim();e&&t.push({shapeId:r.id,kind:"session-card",text:e})}else if("sticky-note"===r.type){let e=String(r.props.text??"").trim();e&&t.push({shapeId:r.id,kind:"sticky-note",text:e})}return t}(e),0===(r=s.trim().toLowerCase().split(/\s+/).filter(Boolean)).length?[]:t.filter(e=>{let t=e.text.toLowerCase();return r.every(e=>t.includes(e))}).map(e=>({item:e,snippet:function(e,t,r=44){let n=t.trim().toLowerCase(),o=e.toLowerCase().indexOf(n);if(o<0)return e.length>r?`${e.slice(0,r)}…`:e;let i=Math.max(0,o-Math.floor((r-n.length)/2)),a=Math.min(e.length,i+r),s=i>0?"…":"",l=a<e.length?"…":"";return`${s}${e.slice(i,a)}${l}`}(e.text,r[0])}))):[]},[e,s]),v=(0,o.useCallback)(t=>{if(!e)return;let r=b[t];if(!r)return;let n=e.getShape(r.item.shapeId);if(!n)return;let o=e.getShapePageBounds(n.id);o&&(e.centerOnPoint(o.center,{animation:{duration:300}}),e.select(n.id),i(n.id),x(t))},[e,b,i]),y=(0,o.useCallback)(()=>{0!==b.length&&v((p+1)%b.length)},[b,p,v]),m=(0,o.useCallback)(()=>{0!==b.length&&v((p-1+b.length)%b.length)},[b,p,v]),w=(0,o.useCallback)(e=>{"Enter"===e.key||"ArrowDown"===e.key?(e.preventDefault(),y()):"ArrowUp"===e.key?(e.preventDefault(),m()):"Escape"===e.key&&(e.preventDefault(),c?u(!1):(l(""),x(-1),f.current?.blur()))},[c,y,m,f]),k=c&&s.trim().length>0;return(0,n.jsxs)("div",{style:{position:"relative",width:280},"data-testid":"board-search",children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,height:34,padding:"0 8px 0 10px",borderRadius:999,background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 2px 12px -6px rgba(0,0,0,0.18)"},children:[(0,n.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{color:"var(--text-dim)",flexShrink:0},children:[(0,n.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,n.jsx)("path",{d:"m21 21-4.35-4.35"})]}),(0,n.jsx)("input",{ref:f,value:s,onChange:e=>{l(e.target.value),x(-1),u(!0)},onKeyDown:w,onFocus:()=>{s.trim()&&u(!0)},onBlur:()=>u(!1),onPointerDown:e=>e.stopPropagation(),placeholder:r("boards.searchPlaceholder"),spellCheck:!1,"aria-label":r("boards.searchPlaceholder"),style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--text)",fontSize:12.5,fontFamily:"inherit"}}),s&&(0,n.jsx)("button",{type:"button",title:r("common.close"),onPointerDown:e=>e.stopPropagation(),onClick:()=>{l(""),x(-1),f.current?.focus()},style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",width:18,height:18,padding:0,border:"none",borderRadius:"50%",background:"color-mix(in srgb, var(--border) 35%, transparent)",color:"var(--text-muted)",cursor:"pointer",fontSize:11,lineHeight:1},children:"\xd7"})]}),k&&(0,n.jsx)("div",{"data-testid":"board-search-dropdown",onPointerDown:e=>e.stopPropagation(),style:{position:"absolute",top:40,left:0,right:0,zIndex:60,maxHeight:320,overflowY:"auto",borderRadius:12,padding:4,background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 4px 18px -6px rgba(0,0,0,0.28)"},children:0===b.length?(0,n.jsx)("div",{style:{padding:"8px 12px",fontSize:12,color:"var(--text-muted)"},children:r("boards.searchNoResults")}):b.map((e,t)=>{let o=t===p;return(0,n.jsxs)("button",{type:"button",onMouseDown:e=>e.preventDefault(),onClick:()=>v(t),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 10px",border:"none",borderRadius:8,background:o?"color-mix(in srgb, var(--accent) 14%, transparent)":"transparent",color:"var(--text)",fontSize:12.5,textAlign:"left",cursor:"pointer"},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{flexShrink:0,display:"inline-flex",color:o?"var(--accent)":"var(--text-dim)"},children:"session-card"===e.item.kind?(0,n.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}):(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M15.5 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2V8.5L15.5 3z"}),(0,n.jsx)("path",{d:"M15 3v6h6"})]})}),(0,n.jsx)("span",{style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.snippet}),(0,n.jsx)("span",{style:{flexShrink:0,fontSize:10,color:"var(--text-dim)"},children:"session-card"===e.item.kind?r("boards.searchSession"):r("boards.searchNote")})]},e.item.shapeId)})})]})}let x=(0,i.default)(()=>Promise.all([r.e(6009),r.e(333)]).then(r.bind(r,20333)).then(e=>e.CanvasStage),{loadableGenerated:{webpack:()=>[20333]},ssr:!1,loading:()=>(0,n.jsx)("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(8, 14, 30, 0.85)",color:"rgba(255, 255, 255, 0.85)",fontSize:13},children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{width:14,height:14,borderRadius:"50%",border:"2px solid rgba(255, 255, 255, 0.18)",borderTopColor:"rgba(255, 255, 255, 0.9)",animation:"spin 0.8s linear infinite"}}),"正在加载画布…"]})})});function g({boardId:e,taskId:t,newSessionCwd:r,onRunningSessionIdsChange:i,wallSettings:b,updateWallSettings:v}){let{t:y}=(0,a.s)(),{isDark:m}=(0,s.D)(),w=(0,l.C6)({boardId:e,taskId:t,newSessionCwd:r}),k=!!(w.board?.taskId??t),j=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=e=>{if(!(e.ctrlKey||e.metaKey)||"f"!==e.key.toLowerCase())return;let t=document.activeElement;if(t&&t!==j.current){let e=t.tagName;if("INPUT"===e||"TEXTAREA"===e||t.isContentEditable)return}e.preventDefault(),j.current?.focus(),j.current?.select()};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[]);let[S,C]=(0,o.useState)(!1),[R,I]=(0,o.useState)(null);(0,o.useEffect)(()=>{let e=!1,t=async()=>{try{let t=await fetch("/api/task-scheduler/status",{cache:"no-store"});if(!t.ok)return;let r=await t.json();e||I(r.status)}catch{}};t();let r=setInterval(t,5e3);return()=>{e=!0,clearInterval(r)}},[]);let[E,L]=(0,o.useState)(!1),T=(0,o.useCallback)(async()=>{if(!E){L(!0);try{w.loadSessionSummaries(),await w.reloadCanvas()}finally{setTimeout(()=>L(!1),800)}}},[w,E]);return(0,o.useEffect)(()=>{i?.(new Set(w.running?.runningSessionIds??[]))},[w.running,i]),(0,n.jsx)("div",{"data-glass-scope":"board",style:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},children:(0,n.jsx)(c.I,{value:"board",children:(0,n.jsx)(u.Nc.Provider,{value:{boardId:w.board?.id??null,defaultCwd:r??null},children:(0,n.jsxs)(d.eR,{children:[!w.loading&&w.board?.name&&(0,n.jsxs)("div",{style:{position:"absolute",top:12,left:12,zIndex:40,display:"flex",alignItems:"center",gap:6,maxWidth:300,height:34,padding:"0 8px 0 12px",borderRadius:999,background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 2px 12px -6px rgba(0,0,0,0.18)",color:"var(--text)"},title:w.board.name,children:[(0,n.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flexShrink:0,opacity:.7},children:[(0,n.jsx)("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1.5"}),(0,n.jsx)("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1.5"}),(0,n.jsx)("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1.5"}),(0,n.jsx)("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1.5"})]}),(0,n.jsx)("span",{style:{fontSize:12.5,fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:w.board.name}),(0,n.jsx)("button",{type:"button",onClick:()=>void T(),title:y("boards.reloadCanvas"),"aria-label":y("boards.reloadCanvas"),style:{display:"flex",alignItems:"center",justifyContent:"center",width:22,height:22,padding:0,flexShrink:0,border:"none",background:"transparent",color:"var(--text-muted)",cursor:E?"default":"pointer",borderRadius:999,transition:"background 0.12s, color 0.12s"},children:(0,n.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{animation:E?"spin 0.8s linear infinite":void 0},children:[(0,n.jsx)("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}),(0,n.jsx)("path",{d:"M21 3v5h-5"})]})})]}),!w.loading&&R&&R.running.length>0&&(0,n.jsxs)("div",{title:`调度器正在执行 ${R.running.length} 个任务`,style:{position:"absolute",top:52,left:12,zIndex:40,display:"flex",alignItems:"center",gap:6,maxWidth:260,padding:"3px 10px",borderRadius:999,background:"color-mix(in srgb, var(--board-card-glass) 85%, transparent)",border:"1px solid color-mix(in srgb, var(--border) 45%, transparent)",color:"var(--text-muted)",fontSize:10.5,lineHeight:1.4,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{flexShrink:0,width:7,height:7,borderRadius:"50%",background:"#10b981",boxShadow:"0 0 6px 1px rgba(16,185,129,0.6)",animation:"pulse 1.6s ease-in-out infinite"}}),(0,n.jsxs)("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:["正在运行 ",R.running.map(e=>`#${e.number} ${e.name}`).join("、")]})]}),!w.loading&&(0,n.jsx)("div",{style:{position:"absolute",top:12,left:"50%",transform:"translateX(-50%)",zIndex:40},children:(0,n.jsx)(h,{editor:w.editor,inputRef:j})}),(0,n.jsxs)("div",{style:{position:"absolute",top:10,right:10,zIndex:30,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:6},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:4,borderRadius:10,background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 2px 12px -6px rgba(0,0,0,0.18)"},children:[(0,n.jsx)("button",{type:"button",onClick:()=>w.addNewSessionCard(),title:y("boards.newSession"),style:{...f,color:"var(--accent)"},children:(0,n.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,n.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),(0,n.jsx)("button",{type:"button",disabled:!0,title:y("boards.autoLayoutDesc"),"aria-label":y("boards.autoLayout"),style:{...f,color:"var(--text-dim)",opacity:.55,cursor:"not-allowed"},children:(0,n.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),(0,n.jsx)("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),(0,n.jsx)("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),(0,n.jsx)("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}),(0,n.jsx)("button",{type:"button",onClick:()=>C(e=>!e),title:y("boards.scrimTitle"),"aria-expanded":S,style:{...f,color:S?"var(--accent)":"var(--text-muted)",background:S?"color-mix(in srgb, var(--accent) 12%, transparent)":"transparent"},children:(0,n.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M12 3v2"}),(0,n.jsx)("path",{d:"M12 19v2"}),(0,n.jsx)("path",{d:"M5 7l1.5 1.5"}),(0,n.jsx)("path",{d:"M17.5 15.5L19 17"}),(0,n.jsx)("path",{d:"M3 12h2"}),(0,n.jsx)("path",{d:"M19 12h2"}),(0,n.jsx)("path",{d:"M5 17l1.5-1.5"}),(0,n.jsx)("path",{d:"M17.5 8.5L19 7"}),(0,n.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})}),(0,n.jsx)("button",{type:"button",onClick:()=>{(0,p.l)({message:k?y("boards.clearTaskConfirm"):y("boards.clearConfirm"),confirmText:y("boards.clear")}).then(e=>{e&&w.clearBoard()})},title:k?y("boards.clearTaskBoardDesc"):y("boards.clearDesc"),style:f,children:(0,n.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M18 6 6 18"}),(0,n.jsx)("path",{d:"m6 6 12 12"})]})})]}),S&&(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:"8px 10px",borderRadius:10,background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 2px 12px -6px rgba(0,0,0,0.18)",color:"var(--text)",fontSize:12.5,whiteSpace:"nowrap"},children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,n.jsx)("span",{style:{width:14,flexShrink:0,textAlign:"center",fontSize:12},children:"❄"}),(0,n.jsx)("span",{style:{flexShrink:0},children:y("boards.scrimBlur")}),(0,n.jsx)("input",{type:"range",min:0,max:30,value:b.scrimBlur,onChange:e=>v({scrimBlur:Number(e.target.value)}),style:{flex:1,minWidth:120,accentColor:"var(--accent)",cursor:"pointer"},"aria-label":y("boards.scrimBlur")}),(0,n.jsxs)("span",{style:{width:30,flexShrink:0,textAlign:"right",fontSize:11,color:"var(--text)"},children:[b.scrimBlur,"px"]})]})})]}),(0,n.jsx)(x,{board:w,isDark:m})]})})})})}let f={display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,padding:0,border:"none",background:"transparent",color:"var(--text-muted)",cursor:"pointer",borderRadius:7,transition:"background 0.12s, color 0.12s"}},24456:(e,t,r)=>{r.d(t,{l:()=>c});var n=r(95155),o=r(12115),i=r(12669);let a=null,s=null,l=null;function d(e){a?.(e),a=null,l?.unmount(),s?.remove(),l=null,s=null}function c(e){return new Promise(t=>{a&&d(!1),a=t;let r=s;r||(r=document.createElement("div"),document.body.appendChild(r),s=r);let o=l;o||(l=o=(0,i.createRoot)(r)),o.render((0,n.jsx)(u,{opts:e,onClose:d}))})}function u({opts:e,onClose:t}){let[r]=(0,o.useState)(!1);return(0,n.jsx)("div",{role:"alertdialog","aria-modal":"true",onPointerDown:()=>t(!1),style:{position:"fixed",inset:0,zIndex:2e3,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.35)"},children:(0,n.jsxs)("div",{onPointerDown:e=>e.stopPropagation(),style:{width:360,maxWidth:"calc(100vw - 48px)",borderRadius:"var(--bubble-radius, 14px)",background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 10px 40px -12px rgba(0,0,0,0.4)",color:"var(--text)",padding:"16px 18px",display:"flex",flexDirection:"column",gap:10},children:[e.title&&(0,n.jsx)("div",{style:{fontSize:14,fontWeight:600},children:e.title}),(0,n.jsx)("div",{style:{fontSize:12.5,lineHeight:1.6,color:"var(--text-muted)",whiteSpace:"pre-wrap"},children:e.message}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:6},children:[(0,n.jsx)("button",{type:"button",onClick:()=>t(!1),style:{border:"none",background:"color-mix(in srgb, var(--border) 30%, transparent)",color:"var(--text-muted)",borderRadius:6,padding:"5px 14px",fontSize:12,cursor:"pointer"},children:e.cancelText??"取消"}),(0,n.jsx)("button",{type:"button",disabled:r,onClick:()=>t(!0),style:{border:"none",background:!1===e.danger?"var(--accent)":"color-mix(in srgb, #ef4444 85%, transparent)",color:"#fff",borderRadius:6,padding:"5px 14px",fontSize:12,fontWeight:600,cursor:"pointer"},children:e.confirmText??"删除"})]})]})})}},26479:(e,t,r)=>{r.d(t,{Nc:()=>g,o_:()=>v});var n=r(95155),o=r(12115),i=r(23312),a=r(15934);function s(e,t){return(e??[]).filter(e=>e.kind===t).map(e=>e.targetCardId)}var l=r(20985);function d({value:e,options:t,onChange:r,width:i="100%"}){let[a,s]=(0,o.useState)(!1),[c,u]=(0,o.useState)(!1),p=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(!a)return;let e=e=>{p.current&&!p.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[a]);let h=t.find(t=>t.value===e);return(0,n.jsxs)("div",{ref:p,style:{position:"relative",width:i},children:[(0,n.jsxs)("button",{type:"button",onClick:()=>s(e=>!e),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),style:{width:"100%",height:28,boxSizing:"border-box",display:"flex",alignItems:"center",gap:6,padding:"0 8px",background:a?"var(--side-active)":c?"var(--side-hover)":"transparent",border:"1px solid var(--border)",borderRadius:5,cursor:"pointer",fontSize:11,color:"var(--text)",textAlign:"left",transition:"background 0.12s"},children:[(0,n.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h?.label??""}),(0,n.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,color:"var(--text-dim)"},children:(0,n.jsx)("polyline",{points:"2 3.5 5 6.5 8 3.5"})})]}),a&&(0,n.jsx)(l.f,{open:!0,style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:120,minWidth:120,maxHeight:200,overflowY:"auto",background:"var(--popover-glass)",border:"1px solid var(--border)",borderRadius:6,boxShadow:"0 6px 20px -6px rgba(0,0,0,0.35)",padding:4},children:t.map(t=>(0,n.jsx)("button",{type:"button",onClick:()=>{r(t.value),s(!1)},style:{display:"block",width:"100%",boxSizing:"border-box",padding:"5px 8px",border:"none",borderRadius:4,background:t.value===e?"var(--side-active)":"transparent",color:"var(--text)",fontSize:11,textAlign:"left",cursor:"pointer"},onMouseEnter:e=>{e.currentTarget.style.background="var(--side-hover)"},onMouseLeave:r=>{r.currentTarget.style.background=t.value===e?"var(--side-active)":"transparent"},children:t.label},t.value))})]})}var c=r(87278);function u({candidates:e,selected:t,onChange:r,placeholder:i="选择任务卡…",excludeId:a,width:s="100%"}){let[d,c]=(0,o.useState)(!1),[p,h]=(0,o.useState)(!1),x=(0,o.useRef)(null),g=e.filter(e=>e.id!==a),f=new Set(t);(0,o.useEffect)(()=>{if(!d)return;let e=e=>{x.current&&!x.current.contains(e.target)&&c(!1)},t=e=>{"Escape"===e.key&&c(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[d]);let b=g.filter(e=>f.has(e.id)),v=b.length>3?b.length-3:0,y=b.slice(0,3);return(0,n.jsxs)("div",{ref:x,style:{position:"relative",width:s},children:[(0,n.jsxs)("button",{type:"button",onClick:()=>c(e=>!e),onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{width:"100%",height:28,boxSizing:"border-box",display:"flex",alignItems:"center",gap:4,padding:"0 6px",background:d?"var(--side-active)":p?"var(--side-hover)":"transparent",border:"1px solid var(--border)",borderRadius:5,cursor:"pointer",fontSize:11,color:"var(--text)",textAlign:"left",transition:"background 0.12s"},children:[y.length>0?(0,n.jsxs)(n.Fragment,{children:[y.map(e=>(0,n.jsxs)("span",{style:{flexShrink:0,display:"inline-flex",alignItems:"center",gap:3,padding:"1px 5px",borderRadius:999,background:"var(--side-selected)",color:"var(--accent)",fontFamily:"var(--font-mono)",fontSize:10},children:["#",e.number]},e.id)),v>0&&(0,n.jsxs)("span",{style:{flexShrink:0,color:"var(--text-muted)",fontSize:10},children:["+",v]})]}):(0,n.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text-dim)"},children:i}),(0,n.jsx)("span",{style:{flex:1}}),(0,n.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,color:"var(--text-dim)"},children:(0,n.jsx)("polyline",{points:"2 3.5 5 6.5 8 3.5"})})]}),d&&(0,n.jsx)(l.f,{open:!0,style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:120,minWidth:160,maxHeight:180,overflowY:"auto",background:"var(--popover-glass)",border:"1px solid var(--border)",borderRadius:6,boxShadow:"0 6px 20px -6px rgba(0,0,0,0.35)",padding:4},children:0===g.length?(0,n.jsx)("div",{style:{padding:"8px",color:"var(--text-dim)",fontSize:11},children:"本看板无其他任务卡"}):g.map(e=>{let o=f.has(e.id);return(0,n.jsxs)("button",{type:"button",onClick:n=>{var o;n.stopPropagation(),o=e.id,r(f.has(o)?t.filter(e=>e!==o):[...t,o])},style:{display:"flex",alignItems:"center",gap:7,width:"100%",boxSizing:"border-box",padding:"5px 8px",border:"none",borderRadius:4,background:o?"var(--side-selected)":"transparent",color:"var(--text)",fontSize:11,textAlign:"left",cursor:"pointer"},onMouseEnter:e=>{o||(e.currentTarget.style.background="var(--side-hover)")},onMouseLeave:e=>{e.currentTarget.style.background=o?"var(--side-selected)":"transparent"},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{flexShrink:0,width:12,height:12,borderRadius:3,border:"1px solid var(--border)",background:o?"var(--accent)":"transparent",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"var(--accent-contrast, #fff)"},children:o&&(0,n.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("polyline",{points:"1.5 5 3.5 7 8.5 2"})})}),(0,n.jsxs)("span",{style:{fontFamily:"var(--font-mono)",color:"var(--text-muted)",flexShrink:0},children:["#",e.number]}),(0,n.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name})]},e.id)})})]})}var p=r(91897),h=r(29608);function x({cwd:e,value:t,onChange:r}){let[i,a]=(0,o.useState)(null),[s,d]=(0,o.useState)(!1),[c,u]=(0,o.useState)(!1),[p,h]=(0,o.useState)(""),[g,f]=(0,o.useState)(!1),[b,v]=(0,o.useState)(null),y=(0,o.useRef)(null),m=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(!e)return void a(null);let t=!1;return(async()=>{try{let r=await fetch(`/api/worktrees?cwd=${encodeURIComponent(e)}`,{cache:"no-store"});if(!r.ok)return;let n=await r.json();if(t)return;a({forCwd:e,projectRoot:n.projectRoot??e,isGit:n.isGit??!1,currentWorktreePath:n.currentWorktreePath??null,worktrees:(n.worktrees??[]).map(e=>({path:e.path,branch:e.branch??null,isMain:!!e.isMain}))})}catch{t||a(null)}})(),()=>{t=!0}},[e]);let w=i?.worktrees.find(e=>e.path===t)??i?.worktrees.find(t=>t.path===e)??(i?.currentWorktreePath?i.worktrees.find(e=>e.path===i.currentWorktreePath):void 0)??i?.worktrees.find(e=>e.isMain)??null,k=async()=>{let e=p.trim();if(e&&!g&&i){f(!0),v(null);try{let t=await fetch("/api/worktrees",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:i.projectRoot,branch:e})}),n=await t.json().catch(()=>({}));if(!t.ok||!n.path){v(n.error??"创建失败"),f(!1);return}h(""),u(!1),d(!1),r(n.path)}catch(e){v(e instanceof Error?e.message:String(e))}f(!1)}};(0,o.useEffect)(()=>{if(!s)return;let e=e=>{y.current&&!y.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[s]);let j=w?w.isMain?`主 checkout(${w.branch??""})`:w.branch??w.path:i?.isGit?"选择工作区…":"非 git 项目";return(0,n.jsxs)("div",{ref:y,style:{position:"relative"},children:[(0,n.jsxs)("button",{type:"button",onClick:()=>{d(e=>!e),v(null)},style:{width:"100%",height:28,boxSizing:"border-box",display:"flex",alignItems:"center",gap:6,padding:"0 8px",background:s?"var(--side-active)":"transparent",border:"1px solid var(--border)",borderRadius:5,cursor:"pointer",fontSize:11,color:"var(--text)",textAlign:"left",fontFamily:"var(--font-mono)"},title:w?.path??void 0,children:[(0,n.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,color:w&&!w.isMain?"var(--accent)":"var(--text-dim)"},children:[(0,n.jsx)("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),(0,n.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,n.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,n.jsx)("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),(0,n.jsx)("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:j}),(0,n.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,color:"var(--text-dim)"},children:(0,n.jsx)("polyline",{points:"2 3.5 5 6.5 8 3.5"})})]}),(0,n.jsxs)(l.f,{open:s,style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:120,minWidth:200,background:"var(--popover-glass)",border:"1px solid var(--border)",borderRadius:6,boxShadow:"0 6px 20px -6px rgba(0,0,0,0.35)",overflow:"hidden"},children:[(0,n.jsx)("div",{style:{maxHeight:"min(40vh, 260px)",overflowY:"auto",padding:4},children:0===(i?.worktrees??[]).length?(0,n.jsx)("div",{style:{padding:"8px 10px",fontSize:11,color:"var(--text-dim)"},children:i?.isGit===!1?"非 git 项目,无法创建工作区":"暂无工作区"}):(i?.worktrees??[]).map(e=>{let o=e.path===(w?.path??t);return(0,n.jsxs)("button",{type:"button",onClick:()=>{r(e.path),d(!1),v(null)},title:e.path,style:{display:"block",width:"100%",boxSizing:"border-box",padding:"6px 8px",border:"none",borderRadius:4,background:o?"var(--side-active)":"transparent",color:"var(--text)",fontSize:11,textAlign:"left",cursor:"pointer",fontFamily:"var(--font-mono)"},onMouseEnter:e=>{o||(e.currentTarget.style.background="var(--side-hover)")},onMouseLeave:e=>{o||(e.currentTarget.style.background="transparent")},children:[(0,n.jsx)("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.isMain?`主 checkout(${e.branch??""})`:e.branch??e.path}),(0,n.jsx)("span",{style:{display:"block",fontSize:9.5,color:"var(--text-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.path})]},e.path)})}),c?(0,n.jsxs)("div",{style:{padding:"6px 8px",borderTop:"1px solid var(--bubble-hairline)"},children:[(0,n.jsx)("input",{ref:m,value:p,onChange:e=>{h(e.target.value),v(null)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),k()),"Escape"===e.key&&(u(!1),h(""),v(null))},placeholder:"新分支名",style:{width:"100%",fontSize:11,fontFamily:"var(--font-mono)",padding:"5px 8px",border:"1px solid var(--accent)",borderRadius:5,outline:"none",background:"var(--side-input)",color:"var(--text)",boxSizing:"border-box"}}),(0,n.jsxs)("div",{style:{display:"flex",gap:5,marginTop:5},children:[(0,n.jsx)("button",{type:"button",onClick:()=>void k(),disabled:g||!p.trim(),style:{flex:1,padding:"4px 0",background:"var(--accent)",border:"none",borderRadius:5,color:"var(--accent-contrast, #fff)",fontSize:11,fontWeight:600,cursor:g||!p.trim()?"not-allowed":"pointer",opacity:g||!p.trim()?.65:1},children:g?"创建中…":"创建"}),(0,n.jsx)("button",{type:"button",onClick:()=>{u(!1),h(""),v(null)},style:{flex:1,padding:"4px 0",background:"transparent",border:"1px solid var(--border)",borderRadius:5,color:"var(--text-muted)",fontSize:11,cursor:"pointer"},children:"取消"})]})]}):(0,n.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),u(!0),v(null),setTimeout(()=>m.current?.focus(),0)},style:{display:"flex",alignItems:"center",gap:7,width:"100%",padding:"7px 10px",background:"none",border:"none",borderTop:"1px solid var(--bubble-hairline)",color:"var(--text-muted)",cursor:"pointer",textAlign:"left",fontSize:11},children:[(0,n.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinecap:"round",style:{flexShrink:0},children:[(0,n.jsx)("line",{x1:"5",y1:"1",x2:"5",y2:"9"}),(0,n.jsx)("line",{x1:"1",y1:"5",x2:"9",y2:"5"})]}),(0,n.jsx)("span",{children:"新建工作区"})]}),b&&(0,n.jsx)("div",{style:{padding:"5px 10px 8px",color:"#dc2626",fontSize:11,lineHeight:1.35,overflowWrap:"anywhere"},children:b})]})]})}let g=(0,o.createContext)(null),f={cardId:i.T.string,number:i.T.number,name:i.T.string,description:i.T.string.optional(),readyStatus:i.T.string,execStatus:i.T.string,priority:i.T.number,due:i.T.number.nullable().optional(),expanded:i.T.boolean,w:i.T.number,h:i.T.number,expandedW:i.T.number,expandedH:i.T.number,collapsedW:i.T.number,collapsedH:i.T.number},b={not_started:{color:"#9ca3af",label:"未开始"},running:{color:"#10b981",label:"进行中"},review:{color:"#f59e0b",label:"待审核"},done:{color:"#10b981",label:"完成"},failed:{color:"#ef4444",label:"失败"},abandoned:{color:"#9ca3af",label:"放弃"},waiting_reply:{color:"#3184f8",label:"等回复"}};class v extends i.A8{static{this.type="task-card"}static{this.props=f}getDefaultProps(){return{cardId:"",number:0,name:"新建任务",description:"",readyStatus:"draft",execStatus:"not_started",priority:0,expanded:!1,w:380,h:270,expandedW:0,expandedH:0,collapsedW:0,collapsedH:0}}canEdit(){return!0}canResize(){return!0}canScroll(){return!0}hideRotateHandle(){return!0}onDoubleClick(e){var t;return{id:e.id,type:"task-card",props:(t=e).props.expanded?{expanded:!1,expandedW:t.props.w,expandedH:t.props.h,w:t.props.collapsedW||380,h:t.props.collapsedH||270}:{expanded:!0,collapsedW:t.props.w,collapsedH:t.props.h,w:t.props.expandedW||760,h:t.props.expandedH||600}}}onResize(e,t){let r=e.props.expanded;return(0,i.mfH)(e,t,{minWidth:r?480:380,minHeight:r?400:240})}getIndicatorPath(e){let{w:t,h:r}=e.props,n=new Path2D;return n.roundRect(0,0,t,r,12),n}component(e){return(0,n.jsx)(y,{shape:e})}}function y({shape:e}){return(0,n.jsx)(k,{shape:e})}let m={width:"100%",boxSizing:"border-box",border:"1px solid var(--border)",borderRadius:6,background:"transparent",color:"var(--text)",fontSize:12,padding:"4px 8px",outline:"none"},w={display:"block",fontSize:10,color:"var(--text)",fontWeight:600,margin:"8px 0 3px"};function k({shape:e}){let{cardId:t,w:r,h:l,expanded:f}=e.props,v=(0,i.hGv)(),y=(0,o.useContext)(g)?.boardId??null,R=(0,o.useContext)(g)?.defaultCwd??null,{detail:I,candidates:E,loading:L,error:T,reload:W,createCard:z,saveCard:P}=function(e,t){let[r,n]=(0,o.useState)(null),[i,s]=(0,o.useState)([]),[l,d]=(0,o.useState)(!1),[c,u]=(0,o.useState)(null),p=(0,o.useRef)(null);p.current=r;let h=(0,o.useCallback)(async(t=!1)=>{if(!e)return void n(null);t||d(!0);try{let t=await fetch(`/api/task-cards/${encodeURIComponent(e)}`,{cache:"no-store"});if(!t.ok){if(404===t.status)return void n(null);throw Error(`HTTP ${t.status}`)}let r=await t.json();n(r)}catch(e){t||u(e instanceof Error?e.message:String(e))}finally{t||d(!1)}},[e]),x=(0,o.useCallback)(()=>h(!1),[h]);(0,o.useEffect)(()=>{x()},[x]),(0,o.useEffect)(()=>{if(!t)return;let e=!1;return(async()=>{try{let r=await fetch(`/api/task-cards?boardId=${encodeURIComponent(t)}`,{cache:"no-store"});if(!r.ok)return;let n=await r.json();e||s(n.cards)}catch{}})(),()=>{e=!0}},[t]);let g=(0,o.useCallback)(async e=>{try{let t=await fetch("/api/task-cards",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`HTTP ${t.status}`)}let r=await t.json();return"number"==typeof r.updated&&(0,a.D2)(e.boardId,r.updated),r.card}catch(e){return u(e instanceof Error?e.message:String(e)),null}},[]),f=(0,o.useCallback)(async t=>{if(!e)return!1;try{let r=await fetch(`/api/task-cards/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error??`HTTP ${r.status}`)}let n=await r.json();return"number"==typeof n.updated&&p.current?.card.boardId&&(0,a.D2)(p.current.card.boardId,n.updated),await x(),!0}catch(e){return u(e instanceof Error?e.message:String(e)),!1}},[e,x]);return{detail:r,candidates:i,loading:l,error:c,reload:x,createCard:g,saveCard:f}}(t||null,y),M=(0,c.G)(v,e.id,"var(--assistant-card-glass)"),D=!t,$=I?.card.sessionId??null;(0,o.useEffect)(()=>{f&&!D&&W()},[f,D,W]);let H=(0,o.useCallback)(()=>{if($)for(let e of v.getCurrentPageShapes()){if("session-card"!==e.type)continue;let t=e.props;if(t.sessionId!==$)continue;let r={x:e.x+(t.w??0)/2,y:e.y+(t.h??0)/2};v.centerOnPoint(r),v.select(e.id);return}},[v,$]),A=(0,i.hau)("execStatus",()=>{let t=v.getShape(e.id);return t?.props?.execStatus??null},[v,e.id]);(0,o.useEffect)(()=>{A&&O&&O.execStatus!==A&&ed("execStatus",A)},[A]);let B=(0,i.hau)("remoteName",()=>{let t=v.getShape(e.id),r=t?.props,n=r?.name;return n&&"新建任务"!==n?n:""},[v,e.id]),F=(0,i.hau)("remoteDescription",()=>{let t=v.getShape(e.id);return t?.props?.description??""},[v,e.id]),N=(0,o.useRef)(!1);(0,o.useEffect)(()=>{!O||N.current||void 0!==B&&B!==O.name&&U(e=>e?{...e,name:B}:e)},[B]),(0,o.useEffect)(()=>{!O||N.current||void 0!==F&&F!==O.description&&U(e=>e?{...e,description:F}:e)},[F]);let[O,U]=(0,o.useState)(()=>D?{id:"",boardId:"",projectKey:"",number:0,name:"新建任务"===e.props.name?"":e.props.name,description:e.props.description??"",readyStatus:"draft",execStatus:"not_started",priority:0,due:null,attachments:[],cwd:R,useWorktree:!1,maxRetries:3,retryCount:0,sessionId:null,dispatchToken:null,created:0,updated:0}:null);(0,o.useEffect)(()=>{!D&&I?.card&&!O&&U({...I.card})},[D,I,O]);let[_,Y]=(0,o.useState)([]),[K,G]=(0,o.useState)([]),q=(0,o.useRef)(!1);(0,o.useEffect)(()=>{I&&!q.current&&(q.current=!0,Y(s(I.links,"prerequisite")),G(s(I.links,"related")))},[I]);let[J,V]=(0,o.useState)(!1),X=(0,o.useRef)(!1),[Q,Z]=(0,o.useState)(null),[ee,et]=(0,o.useState)(null),[er,en]=(0,o.useState)(!1);(0,o.useEffect)(()=>{en(f)},[f]);let[eo,ei]=(0,o.useState)(!1),[ea,es]=(0,o.useState)(null),el=(0,o.useRef)(null),ed=(t,r)=>{U(n=>{let o=n?{...n,[t]:r}:n;return o&&("name"===t||"description"===t)&&v.updateShape({id:e.id,type:"task-card",props:{name:"name"===t?r:o.name,description:"description"===t?r:o.description??""}}),o})};(0,o.useEffect)(()=>{let e=el.current;if(!e)return;let t=t=>{if(t.ctrlKey||t.metaKey)return;let r=t.target;r instanceof Node&&e.contains(r)&&function(e,t){let r=e instanceof Element?e:e.parentElement;for(;r&&r instanceof HTMLElement&&r!==t;){let e=r.scrollHeight>r.clientHeight,t=r.scrollWidth>r.clientWidth;if(e||t){let n=getComputedStyle(r),o=n.overflowY,i=n.overflowX;if(e&&("auto"===o||"scroll"===o||"overlay"===o)||t&&("auto"===i||"scroll"===i||"overlay"===i))return!0}r=r.parentElement}return!1}(r,e)&&t.stopPropagation()};return e.addEventListener("wheel",t),()=>e.removeEventListener("wheel",t)});let ec=async()=>{if(!y)return void Z("缺少看板上下文,无法创建");if(!O?.name.trim())return void et("请填写任务名称");if(V(!0),Z(null),X.current)return;X.current=!0;let t=await z({boardId:y,name:O.name,description:O.description,readyStatus:"todo",priority:O.priority,due:O.due??null,cwd:O.cwd??void 0,useWorktree:O.useWorktree,maxRetries:O.maxRetries,attachments:O.attachments,prerequisites:_,related:K});X.current=!1,V(!1),t&&(v.updateShape({id:e.id,type:"task-card",props:{cardId:t.id,number:t.number,name:t.name,readyStatus:t.readyStatus,execStatus:t.execStatus,priority:t.priority,due:t.due??void 0}}),U(e=>e?{...e,...t,sessionId:t.sessionId}:e),W())},eu=async()=>{if(!O?.name.trim())return void et("请填写任务名称");if(X.current)return;V(!0),X.current=!0,Z(null);let t=await P({name:O.name,description:O.description,readyStatus:O.readyStatus,priority:O.priority,due:O.due??null,attachments:O.attachments,cwd:O.cwd??null,useWorktree:O.useWorktree,maxRetries:O.maxRetries,prerequisites:_,related:K});X.current=!1,V(!1),t?v.updateShape({id:e.id,type:"task-card",props:{name:O.name,description:O.description??"",readyStatus:O.readyStatus,priority:O.priority,due:O.due??void 0}}):Z(T??"保存失败")},ep=(0,o.useMemo)(()=>{if(D||!I?.card||!O)return!1;let e=I.card;return O.name!==e.name||O.description!==e.description||O.priority!==e.priority||O.due!==e.due||O.cwd!==e.cwd||O.useWorktree!==e.useWorktree||O.maxRetries!==e.maxRetries||JSON.stringify(O.attachments??[])!==JSON.stringify(e.attachments??[])||JSON.stringify([..._].sort())!==JSON.stringify(s(I.links,"prerequisite").sort())||JSON.stringify([...K].sort())!==JSON.stringify(s(I.links,"related").sort())},[D,I,O,_,K]),eh=(0,i.hau)("selected",()=>v.getSelectedShapeIds().includes(e.id),[v,e.id]),ex=(0,o.useRef)(eh),eg=(0,o.useRef)(ep);eg.current=ep;let ef=(0,o.useRef)(eu);ef.current=eu,(0,o.useEffect)(()=>{let e=ex.current;ex.current=eh,e&&!eh&&!D&&eg.current&&ef.current()},[eh,D]);let eb=O?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("label",{style:w,children:"任务名称 *"}),(0,n.jsx)("input",{style:{...m,...ee?{borderColor:"#f87171",boxShadow:"0 0 0 1px #f87171"}:{}},value:O.name,onChange:e=>{ed("name",e.target.value),ee&&et(null)},onFocus:()=>{N.current=!0},onBlur:()=>{N.current=!1},placeholder:"任务名称"}),ee&&(0,n.jsx)("div",{style:{color:"#f87171",fontSize:11,marginTop:3},children:ee}),(0,n.jsx)("label",{style:w,children:"需求说明"}),(0,n.jsx)("textarea",{style:{...m,flex:1,minHeight:70,resize:"none",fontFamily:"var(--font-mono)",fontSize:11},value:O.description,onChange:e=>ed("description",e.target.value),onFocus:()=>{N.current=!0},onBlur:()=>{N.current=!1},placeholder:"任务描述",spellCheck:!1}),(0,n.jsxs)(S,{title:"高级",open:er,onToggle:()=>en(e=>!e),children:[(0,n.jsx)("label",{style:w,children:"工作目录"}),(0,n.jsxs)("div",{style:{display:"flex",gap:6},children:[(0,n.jsx)("input",{style:{...m,flex:1},value:O.cwd??"",onChange:e=>ed("cwd",e.target.value||null),placeholder:"默认项目根目录",readOnly:!0}),(0,n.jsx)("button",{type:"button",style:j,onClick:()=>ei(!0),children:"选择目录"})]}),eo&&O&&(0,n.jsx)(h.K,{onCancel:()=>ei(!1),onSelect:e=>{ed("cwd",e),ei(!1)}}),(0,n.jsx)("label",{style:w,children:"工作区"}),(0,n.jsx)(x,{cwd:O.cwd,value:ea,onChange:e=>{es(e),ed("cwd",e)}}),(0,n.jsx)("label",{style:w,children:"预计截止"}),(0,n.jsx)(C,{due:O.due??null,onChange:e=>ed("due",e)}),(0,n.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,n.jsxs)("div",{style:{flex:1},children:[(0,n.jsx)("label",{style:w,children:"优先级"}),(0,n.jsx)(d,{value:String(O.priority),onChange:e=>ed("priority",Number(e)),options:[{value:"1",label:"高"},{value:"0",label:"中"},{value:"-1",label:"低"}]})]}),(0,n.jsxs)("div",{style:{flex:1},children:[(0,n.jsx)("label",{style:w,children:"最大重试次数"}),(0,n.jsx)("input",{style:m,type:"number",min:0,value:O.maxRetries,onChange:e=>ed("maxRetries",Math.max(0,Number(e.target.value)||0))})]})]}),(0,n.jsx)("label",{style:w,children:"前置任务(可多选)"}),(0,n.jsx)(u,{candidates:E,selected:_,onChange:Y,excludeId:t,placeholder:"本看板内选择前置任务…"}),(0,n.jsx)("label",{style:w,children:"关联任务(可多选)"}),(0,n.jsx)(u,{candidates:E,selected:K,onChange:G,excludeId:t,placeholder:"本看板内选择关联任务…"}),(0,n.jsx)("label",{style:w,children:"附件(引用文件路径,每行一个)"}),(0,n.jsx)("textarea",{style:{...m,minHeight:46,resize:"vertical",fontFamily:"var(--font-mono)",fontSize:11},value:(O.attachments??[]).join("\n"),onChange:e=>ed("attachments",e.target.value.split("\n").map(e=>e.trim()).filter(Boolean)),placeholder:"/path/to/file",spellCheck:!1})]}),(Q||T)&&(0,n.jsx)("div",{style:{color:"#f87171",fontSize:11,marginTop:6},children:Q??T})]}):L?(0,n.jsx)("div",{style:{color:"var(--text-dim)",fontSize:12,padding:20,textAlign:"center"},children:"加载中…"}):(0,n.jsx)("div",{style:{color:"var(--text-dim)",fontSize:12,padding:20,textAlign:"center"},children:"未找到任务卡"});return(0,n.jsx)(i.hDc,{"data-testid":`task-card-${e.id}`,onPointerDown:()=>v.bringToFront([e.id]),style:{width:r,height:l,pointerEvents:"none"},children:(0,n.jsxs)("div",{ref:e=>{el.current=e,M(e)},style:{position:"relative",width:r,height:l,borderRadius:"var(--bubble-radius, 12px)",border:"1px solid var(--bubble-border)",background:"transparent",boxShadow:"0 2px 10px -6px rgba(0,0,0,0.2)",color:"var(--text)",display:"flex",flexDirection:"column",overflow:"hidden",pointerEvents:"all",userSelect:"none"},children:[(0,n.jsxs)("div",{style:{flexShrink:0,height:36,display:"flex",alignItems:"center",gap:6,padding:"0 10px",borderBottom:"1px solid var(--bubble-hairline)",cursor:"grab",fontSize:11,color:"var(--text-muted)"},children:[(0,n.jsx)("span",{title:`执行状态:${(b[O?.execStatus??"not_started"]??b.not_started).label}`,style:{display:"flex",alignItems:"center",gap:4,flexShrink:0},children:(0,n.jsx)(p.i,{kind:"task",color:(b[O?.execStatus??"not_started"]??b.not_started).color})}),(0,n.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:12.5,fontWeight:600,color:"var(--text)"},children:O?.name||(D?"新建任务卡":"任务卡")}),O?.number?(0,n.jsxs)("span",{style:{flexShrink:0,fontSize:12.5,fontWeight:600,color:"var(--text)",marginLeft:4},children:["#",O.number]}):null,(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,flexShrink:0},onPointerDown:e=>e.stopPropagation(),children:[D?(0,n.jsx)("button",{type:"button",style:j,disabled:J||!y,onClick:()=>void ec(),title:"创建任务并派发(转待办,调度器可执行)",children:J?"创建中…":"派发"}):O?.readyStatus==="draft"?(0,n.jsx)("button",{type:"button",style:j,disabled:J,onClick:()=>{ed("readyStatus","todo"),!D&&t&&P({readyStatus:"todo"})},title:"派发(转待办,调度器可执行)",children:J?"派发中…":"派发"}):O?.readyStatus==="todo"?(0,n.jsxs)("span",{title:`执行状态:${(b[O?.execStatus??"not_started"]??b.not_started).label}`,style:{display:"flex",alignItems:"center",gap:4,fontSize:11,fontWeight:600,color:(b[O?.execStatus??"not_started"]??b.not_started).color,whiteSpace:"nowrap"},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",background:(b[O?.execStatus??"not_started"]??b.not_started).color,...O?.execStatus==="running"?{animation:"pulse-dot 1.6s ease-in-out infinite"}:{}}}),(b[O?.execStatus??"not_started"]??b.not_started).label]}):null,$&&(0,n.jsx)("button",{type:"button",style:j,onClick:H,title:"定位到该任务的执行会话卡",children:"会话"}),D?null:ep?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",style:j,onClick:()=>{I&&(U({...I.card}),Y(s(I.links,"prerequisite")),G(s(I.links,"related")),es(null),Z(null),et(null))},title:"撤销本次编辑",children:"取消"}),(0,n.jsx)("button",{type:"button",style:j,disabled:J,onClick:()=>void eu(),title:"完成(保存)",children:J?"保存中…":"完成"})]}):null]})]}),(0,n.jsx)("div",{style:{flex:1,minHeight:0,display:"flex"},children:(0,n.jsx)("div",{className:"[scrollbar-width:none]",style:{flex:"1 1 auto",minWidth:0,overflowY:"auto",padding:"10px 12px",display:"flex",flexDirection:"column"},onPointerDown:e=>{0===e.button&&e.stopPropagation()},onPointerUp:e=>{0===e.button&&e.stopPropagation()},onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:eb})})]})})}let j={border:"none",background:"color-mix(in srgb, var(--border) 30%, transparent)",color:"var(--text-muted)",borderRadius:5,padding:"2px 10px",fontSize:11,cursor:"pointer",whiteSpace:"nowrap"};function S({title:e,open:t,onToggle:r,children:o}){return(0,n.jsxs)("div",{children:[(0,n.jsxs)("button",{type:"button",onClick:r,style:{display:"flex",alignItems:"center",gap:4,width:"100%",marginTop:10,padding:"5px 0 3px",border:"none",borderTop:"1px solid var(--bubble-hairline)",background:"transparent",color:"var(--text-muted)",fontSize:11,fontWeight:600,cursor:"pointer",textAlign:"left"},children:[(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,transform:t?"rotate(90deg)":"none",transition:"transform 0.12s"},children:(0,n.jsx)("polyline",{points:"3 2 6.5 5 3 8"})}),e]}),t&&(0,n.jsx)("div",{children:o})]})}function C({due:e,onChange:t}){let r=new Date,o=e?new Date(e):r,[i,a,s]=[o.getFullYear(),o.getMonth()+1,o.getDate()],l=[];for(let e=r.getFullYear()-2;e<=r.getFullYear()+3;e++)l.push(String(e));let c=Array.from({length:12},(e,t)=>String(t+1)),u=new Date(i,a,0).getDate(),p=Array.from({length:u},(e,t)=>String(t+1)),h=(e,r,n)=>{let o=new Date(e,r-1,n,0,0,0,0).getTime();t(Number.isNaN(o)?null:o)};return(0,n.jsxs)("div",{style:{display:"flex",gap:4},children:[(0,n.jsx)("div",{style:{flex:1.4,minWidth:0},children:(0,n.jsx)(d,{value:String(i),options:l.map(e=>({value:e,label:e})),onChange:e=>h(Number(e),a,Math.min(s,u))})}),(0,n.jsx)("div",{style:{flex:1,minWidth:0},children:(0,n.jsx)(d,{value:String(a),options:c.map(e=>({value:e,label:`${e}月`})),onChange:e=>h(i,Number(e),Math.min(s,new Date(i,Number(e),0).getDate()))})}),(0,n.jsx)("div",{style:{flex:1,minWidth:0},children:(0,n.jsx)(d,{value:String(s),options:p.map(e=>({value:e,label:e})),onChange:e=>h(i,a,Number(e))})})]})}},41264:(e,t,r)=>{r.d(t,{QQ:()=>h});var n=r(95155),o=r(12115),i=r(23312),a=r(32316),s=r(71309),l=r(91897),d=r(87278);let c={blue:"#3184f8",green:"#10b981",red:"#ef4444",yellow:"#f59e0b",purple:"#8b5cf6"},u={blue:"蓝",green:"绿",red:"红",yellow:"黄",purple:"紫"},p={text:i.T.string,w:i.T.number,h:i.T.number,badge:i.T.string.optional(),createdAt:i.T.number.optional()};class h extends i.A8{static{this.type="sticky-note"}static{this.props=p}getDefaultProps(){return{text:"",w:338,h:230,badge:"blue",createdAt:Date.now()}}canEdit(){return!0}canResize(){return!0}canScroll(){return!0}hideRotateHandle(){return!0}onResize(e,t){return(0,i.mfH)(e,t,{minWidth:182,minHeight:115})}getIndicatorPath(e){let{w:t,h:r}=e.props,n=new Path2D;return n.roundRect(0,0,t,r,12),n}component(e){return(0,n.jsx)(x,{shape:e})}}function x({shape:e}){let t,r,{w:p,h,text:f}=e.props,b=(0,i.hGv)(),v=(0,d.G)(b,e.id,"var(--assistant-card-glass)"),{highlightId:y}=(0,s.kz)(),m=y===e.id,w=(0,i.hau)("editing",()=>b.getEditingShapeId()===e.id,[b,e.id]),k=(0,o.useCallback)(e=>{0===e.button&&e.stopPropagation()},[]),j=(0,o.useCallback)(t=>{t.stopPropagation(),b.getEditingShapeId()!==e.id&&b.select(e.id)},[b,e.id]),S=(0,o.useCallback)(t=>{t.stopPropagation(),b.setEditingShape(e.id)},[b,e.id]),[C]=(0,o.useState)(()=>e.props.createdAt??Date.now()),R=e.props.badge??"blue",[I,E]=(0,o.useState)(f),L=(0,o.useRef)(f),[T,W]=(0,o.useState)(R),z=(0,o.useRef)(null),P=(0,o.useRef)(null),M=(0,o.useRef)(!1),D=(0,o.useRef)(!1),[$,H]=(0,o.useState)(!1),A=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=e=>{if(!e)return;let t=t=>{t.ctrlKey||t.metaKey||e.scrollHeight>e.clientHeight&&t.stopPropagation()};return e.addEventListener("wheel",t),()=>e.removeEventListener("wheel",t)},t=e(z.current),r=e(P.current);return()=>{t?.(),r?.()}}),(0,o.useEffect)(()=>{let e=P.current;if(!e)return;let t=e=>{let t=window.getSelection();t&&t.toString().length>0&&e.stopPropagation()};return e.addEventListener("copy",t),()=>e.removeEventListener("copy",t)});let B=(0,o.useCallback)(t=>{t.stopPropagation();let r=P.current?.querySelector(".markdown-body")?.innerText??e.props.text;navigator.clipboard.writeText(r).then(()=>{H(!0),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>H(!1),1200)}).catch(()=>{try{let e=document.createElement("textarea");e.value=r,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),H(!0),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>H(!1),1200)}catch{}})},[e.props.text]);(0,o.useEffect)(()=>()=>{A.current&&clearTimeout(A.current)},[]),(0,o.useEffect)(()=>{w&&(E(f),L.current=f,W(R),requestAnimationFrame(()=>z.current?.focus()))},[w,f,R]);let F=(0,o.useCallback)(()=>{let t=L.current;(t!==e.props.text||T!==R)&&b.updateShapes([{id:e.id,type:"sticky-note",props:{text:t,badge:T}}])},[b,e.id,e.props.text,R,T]);(0,o.useEffect)(()=>{w||!D.current||M.current||F(),M.current=!1,D.current=w},[w,F]);let N=(0,o.useCallback)(()=>{b.setEditingShape(null)},[b]),O=(0,o.useCallback)(()=>{M.current=!0,b.setEditingShape(null)},[b]),U={position:"relative",width:p,height:h,borderRadius:"var(--bubble-radius, 12px)",border:m?"2px solid var(--accent)":"1px solid var(--bubble-border)",background:"transparent",boxShadow:m?s.u:"0 2px 10px -6px rgba(0,0,0,0.2)",animation:m?"board-search-glow 1.8s ease-out forwards":void 0,color:"var(--text)",display:"flex",flexDirection:"column",overflow:"hidden",fontSize:13,lineHeight:1.5,pointerEvents:"all",userSelect:"none"};return w?(0,n.jsx)(i.hDc,{"data-testid":`sticky-note-${e.id}`,style:{width:p,height:h,pointerEvents:"none"},children:(0,n.jsxs)("div",{ref:v,style:U,children:[(0,n.jsxs)("div",{onPointerDown:e=>e.stopPropagation(),style:{flexShrink:0,height:32,display:"flex",alignItems:"center",gap:6,padding:"0 var(--bubble-pad-x, 12px)",fontSize:10,color:"var(--text-muted)",boxSizing:"border-box"},children:[(0,n.jsx)(l.i,{kind:"note",color:c[T]??c.blue}),(0,n.jsx)("div",{style:{display:"flex",alignItems:"center",gap:5},children:Object.entries(c).map(([e,t])=>(0,n.jsx)("button",{type:"button",title:`徽记\xb7${u[e]??e}`,onClick:t=>{t.stopPropagation(),W(e)},style:{width:14,height:14,padding:0,border:"none",borderRadius:"50%",background:t,cursor:"pointer",boxShadow:T===e?`0 0 0 2px var(--bg-panel), 0 0 0 3.5px ${t}`:`0 0 0 1px color-mix(in srgb, ${t} 45%, transparent)`,opacity:T===e?1:.72}},e))}),(0,n.jsx)("div",{style:{flex:1}}),(0,n.jsx)("button",{type:"button",onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),O()},style:g,title:"放弃变更 (Esc)",children:"取消"}),(0,n.jsx)("button",{type:"button",onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),N()},style:g,title:"完成 (Ctrl+Enter)",children:"完成"})]}),(0,n.jsx)("textarea",{ref:z,value:I,onChange:e=>{E(e.target.value),L.current=e.target.value},onKeyDown:e=>{e.stopPropagation(),"Enter"===e.key&&(e.ctrlKey||e.metaKey)?(e.preventDefault(),N()):"Escape"===e.key&&(e.preventDefault(),O())},onPointerDown:e=>{0===e.button&&e.stopPropagation()},spellCheck:!1,placeholder:"Markdown 便笺…",className:"sticky-note-input",style:{flex:1,minHeight:0,resize:"none",border:"none",outline:"none",background:"transparent",color:"var(--text)",fontFamily:"var(--font-mono)",fontSize:14,lineHeight:1.7,padding:"var(--bubble-pad-y, 8px) var(--bubble-pad-x, 12px)"}})]})}):(0,n.jsx)(i.hDc,{"data-testid":`sticky-note-${e.id}`,onPointerDown:()=>b.bringToFront([e.id]),style:{width:p,height:h,pointerEvents:"none"},children:(0,n.jsxs)("div",{ref:v,style:U,children:[(0,n.jsxs)("div",{style:{flexShrink:0,height:32,display:"flex",alignItems:"center",gap:6,padding:"0 var(--bubble-pad-x, 12px)",fontSize:10,color:"var(--text-muted)",cursor:"grab",boxSizing:"border-box"},children:[(0,n.jsx)(l.i,{kind:"note",color:c[R]??c.blue}),(0,n.jsx)("div",{style:{flex:1}}),(0,n.jsx)("span",{style:{fontFamily:"var(--font-mono)",whiteSpace:"nowrap"},children:(t=new Date(C),r=new Date,t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):`${t.getMonth()+1}/${t.getDate()}`)}),(0,n.jsx)("button",{type:"button",title:$?"已复制":"复制内容",onClick:B,onPointerDown:e=>e.stopPropagation(),style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",width:22,height:20,padding:0,border:"none",borderRadius:5,background:"transparent",color:$?"var(--accent)":"var(--text-dim)",cursor:"pointer",pointerEvents:"all"},children:$?(0,n.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M20 6L9 17l-5-5"})}):(0,n.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),(0,n.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,n.jsx)("div",{ref:P,style:{flex:1,minHeight:0,overflowY:"auto",padding:"4px var(--bubble-pad-x, 12px) var(--bubble-pad-y, 8px)",textAlign:"left"},children:f.trim()?(0,n.jsx)("div",{className:"markdown-body",onPointerDown:k,onPointerUp:k,onClick:j,onDoubleClick:S,style:{wordBreak:"break-word",cursor:"text"},children:(0,n.jsx)(a.oz,{children:f})}):(0,n.jsx)("div",{onClick:j,onDoubleClick:S,style:{color:"var(--text-dim)",fontSize:12,cursor:"text"},children:"双击编辑 markdown"})})]})})}let g={border:"none",background:"color-mix(in srgb, var(--border) 30%, transparent)",color:"var(--text-muted)",borderRadius:5,padding:"2px 10px",fontSize:11,cursor:"pointer"}},64536:(e,t,r)=>{r.d(t,{C6:()=>b,ZI:()=>h,eo:()=>x});var n=r(12115),o=r(23312),i=r(17357),a=r(93647),s=r(15934),l=r(24456),d=r(82264),c=r(41264),u=r(26479),p=r(41463);let h=340,x=160,g=p.env.NEXT_PUBLIC_SYNC_WS??"ws://127.0.0.1:30143",f=[...o.Ats,d.V,c.QQ,u.o_];function b({boardId:e,taskId:t,newSessionCwd:r}){let[d,c]=(0,n.useState)(null),[u,p]=(0,n.useState)(null),[y,m]=(0,n.useState)(!1),w=(0,n.useRef)(null),k=(0,n.useRef)(e);k.current=e;let j=d?.taskId??null,S=t??j,C=(0,n.useRef)(S);C.current=S;let R=(0,n.useRef)(r);R.current=r;let I=(0,n.useMemo)(()=>`${g}/connect/${encodeURIComponent(e)}`,[e]),E=(0,i.pX)({uri:I,assets:a.AWg,shapeUtils:f}),L=(0,n.useCallback)(async()=>{try{let t=await fetch(`/api/boards/${encodeURIComponent(e)}`,{cache:"no-store"});if(!t.ok)return void p(`HTTP ${t.status}`);let r=await t.json();c(r.board)}catch(e){p(e instanceof Error?e.message:String(e))}},[e]);(0,n.useEffect)(()=>{L()},[L]);let[T,W]=(0,n.useState)(()=>globalThis.__piRunningSnapshot??null),z=(0,n.useCallback)(e=>{globalThis.__piRunningSnapshot=e,W(e)},[]),P=(0,n.useRef)(!1),M=(0,n.useRef)(0),D=(0,n.useRef)(new Set),$=(0,n.useRef)(async()=>{});(0,n.useEffect)(()=>{let e=!1,t=null,r=async()=>{if(!e&&!P.current&&"visible"===document.visibilityState){P.current=!0;try{let t=await fetch("/api/agent/running",{cache:"no-store"});if(!t.ok)return;let r=await t.json();if(e)return;z(r);let n=w.current;if(!n)return;let o=[];for(let e of n.getCurrentPageShapes())if("session-card"===e.type){let t=e.props;if(!t.sessionId)continue;let n=r.states[t.sessionId],i=r.runningSessionIds.includes(t.sessionId);if(i&&n){let r=n.phase??"waiting_model",i=n.startedAt?Date.now()-n.startedAt:0;(t.phase!==r||t.runningMs!==i||0!==t.endedAt)&&o.push({id:e.id,type:"session-card",props:{phase:r,runningMs:i,endedAt:0}})}else i||"idle"===t.phase||o.push({id:e.id,type:"session-card",props:{phase:"idle",runningMs:0,endedAt:0}})}else if("task-card"===e.type){let t=e.props;if(!t.cardId)continue;let n=r.taskCards?.find(e=>e.cardId===t.cardId&&e.boardId===k.current);n&&n.execStatus!==t.execStatus&&o.push({id:e.id,type:"task-card",props:{execStatus:n.execStatus}})}o.length>0&&n.updateShapes(o);let i=D.current,a=(r.taskCards??[]).some(e=>e.boardId===k.current&&"running"===e.execStatus&&!i.has(e.cardId));for(let e of r.taskCards??[])i.add(e.cardId);a&&Date.now()-M.current>2e3&&(M.current=Date.now(),$.current())}catch{}finally{P.current=!1}}},n=()=>{e||(t=setTimeout(async()=>{await r(),n()},2500))};r(),n();let o=()=>{"visible"===document.visibilityState&&r()};return document.addEventListener("visibilitychange",o),()=>{e=!0,t&&clearTimeout(t),document.removeEventListener("visibilitychange",o)}},[z]);let[H,A]=(0,n.useState)({}),B=(0,n.useRef)({});B.current=H;let F=(0,n.useRef)(!1),N=(0,n.useCallback)(async()=>{if(!F.current){F.current=!0;try{let e=await fetch("/api/sessions",{cache:"no-store"});if(!e.ok)return;let t=await e.json(),r={};for(let e of t.sessions)r[e.id]={title:e.name??e.firstMessage??"Untitled",messageCount:e.messageCount??0,projectName:e.projectKey??e.projectRoot??"",lastReply:e.lastReply??"",lastActivityAt:e.modified?Date.parse(e.modified):0};A(r)}catch{}finally{F.current=!1}}},[]);(0,n.useEffect)(()=>{let e,t=!1,r=async()=>{await N(),t||(e=setTimeout(r,1e4))};r();let n=()=>{"visible"===document.visibilityState&&(e&&clearTimeout(e),r())};return document.addEventListener("visibilitychange",n),()=>{t=!0,e&&clearTimeout(e),document.removeEventListener("visibilitychange",n)}},[N]),(0,n.useEffect)(()=>{let e=w.current;if(!e||!y||0===Object.keys(H).length)return;let t=[];for(let r of e.getCurrentPageShapes()){if("session-card"!==r.type)continue;let e=r.props,n=H[e.sessionId];n&&(e.title!==n.title||e.lastReply!==n.lastReply||e.messageCount!==n.messageCount||e.lastActivityAt!==n.lastActivityAt)&&t.push({id:r.id,type:"session-card",props:{title:n.title,lastReply:n.lastReply,messageCount:n.messageCount,lastActivityAt:n.lastActivityAt}})}t.length>0&&e.updateShapes(t)},[H,y]);let O=(0,n.useCallback)(e=>{w.current=e,m(!0);let t=e.deleteShapes.bind(e);e.deleteShapes=r=>{let n=Array.isArray(r)?r:[r],o=[],i=[],a=[];for(let t of n){let r="string"==typeof t?t:t.id,n=e.getShape(r);if(!n){o.push(r);continue}if("arrow"===n.type){let e=n.meta;if(e?.taskLinkLabel||e?.execLinkLabel)continue;o.push(r);continue}if("session-card"===n.type){let e=n.props;e.sessionId&&!e.cwd?i.push({sid:e.sessionId,shapeId:r}):o.push(r);continue}if("task-card"===n.type){let e=n.props.cardId;e?a.push({cid:e,shapeId:r}):o.push(r);continue}o.push(r)}if(i.length>0||a.length>0){let t;return t=i.length>0&&a.length>0?`删除 ${i.length} 个会话和 ${a.length} 张任务卡?
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5315],{15315:(e,t,r)=>{r.r(t),r.d(t,{SessionCanvas:()=>g});var n=r(95155),o=r(12115),i=r(37206),a=r(39247),s=r(96793),l=r(64536),d=r(71309),c=r(34229),u=r(26479),p=r(24456);function h({editor:e,inputRef:t}){let{t:r}=(0,a.s)(),{setHighlight:i}=(0,d.kz)(),[s,l]=(0,o.useState)(""),[c,u]=(0,o.useState)(!1),[p,x]=(0,o.useState)(-1),g=(0,o.useRef)(null),f=t??g,b=(0,o.useMemo)(()=>{var t;let r;return e?(t=function(e){let t=[];for(let r of e.getCurrentPageShapes())if("session-card"===r.type){let e=String(r.props.title??"").trim();e&&t.push({shapeId:r.id,kind:"session-card",text:e})}else if("sticky-note"===r.type){let e=String(r.props.text??"").trim();e&&t.push({shapeId:r.id,kind:"sticky-note",text:e})}return t}(e),0===(r=s.trim().toLowerCase().split(/\s+/).filter(Boolean)).length?[]:t.filter(e=>{let t=e.text.toLowerCase();return r.every(e=>t.includes(e))}).map(e=>({item:e,snippet:function(e,t,r=44){let n=t.trim().toLowerCase(),o=e.toLowerCase().indexOf(n);if(o<0)return e.length>r?`${e.slice(0,r)}…`:e;let i=Math.max(0,o-Math.floor((r-n.length)/2)),a=Math.min(e.length,i+r),s=i>0?"…":"",l=a<e.length?"…":"";return`${s}${e.slice(i,a)}${l}`}(e.text,r[0])}))):[]},[e,s]),v=(0,o.useCallback)(t=>{if(!e)return;let r=b[t];if(!r)return;let n=e.getShape(r.item.shapeId);if(!n)return;let o=e.getShapePageBounds(n.id);o&&(e.centerOnPoint(o.center,{animation:{duration:300}}),e.select(n.id),i(n.id),x(t))},[e,b,i]),y=(0,o.useCallback)(()=>{0!==b.length&&v((p+1)%b.length)},[b,p,v]),m=(0,o.useCallback)(()=>{0!==b.length&&v((p-1+b.length)%b.length)},[b,p,v]),w=(0,o.useCallback)(e=>{"Enter"===e.key||"ArrowDown"===e.key?(e.preventDefault(),y()):"ArrowUp"===e.key?(e.preventDefault(),m()):"Escape"===e.key&&(e.preventDefault(),c?u(!1):(l(""),x(-1),f.current?.blur()))},[c,y,m,f]),k=c&&s.trim().length>0;return(0,n.jsxs)("div",{style:{position:"relative",width:280},"data-testid":"board-search",children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,height:34,padding:"0 8px 0 10px",borderRadius:999,background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 2px 12px -6px rgba(0,0,0,0.18)"},children:[(0,n.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{color:"var(--text-dim)",flexShrink:0},children:[(0,n.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,n.jsx)("path",{d:"m21 21-4.35-4.35"})]}),(0,n.jsx)("input",{ref:f,value:s,onChange:e=>{l(e.target.value),x(-1),u(!0)},onKeyDown:w,onFocus:()=>{s.trim()&&u(!0)},onBlur:()=>u(!1),onPointerDown:e=>e.stopPropagation(),placeholder:r("boards.searchPlaceholder"),spellCheck:!1,"aria-label":r("boards.searchPlaceholder"),style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--text)",fontSize:12.5,fontFamily:"inherit"}}),s&&(0,n.jsx)("button",{type:"button",title:r("common.close"),onPointerDown:e=>e.stopPropagation(),onClick:()=>{l(""),x(-1),f.current?.focus()},style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",width:18,height:18,padding:0,border:"none",borderRadius:"50%",background:"color-mix(in srgb, var(--border) 35%, transparent)",color:"var(--text-muted)",cursor:"pointer",fontSize:11,lineHeight:1},children:"\xd7"})]}),k&&(0,n.jsx)("div",{"data-testid":"board-search-dropdown",onPointerDown:e=>e.stopPropagation(),style:{position:"absolute",top:40,left:0,right:0,zIndex:60,maxHeight:320,overflowY:"auto",borderRadius:12,padding:4,background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 4px 18px -6px rgba(0,0,0,0.28)"},children:0===b.length?(0,n.jsx)("div",{style:{padding:"8px 12px",fontSize:12,color:"var(--text-muted)"},children:r("boards.searchNoResults")}):b.map((e,t)=>{let o=t===p;return(0,n.jsxs)("button",{type:"button",onMouseDown:e=>e.preventDefault(),onClick:()=>v(t),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 10px",border:"none",borderRadius:8,background:o?"color-mix(in srgb, var(--accent) 14%, transparent)":"transparent",color:"var(--text)",fontSize:12.5,textAlign:"left",cursor:"pointer"},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{flexShrink:0,display:"inline-flex",color:o?"var(--accent)":"var(--text-dim)"},children:"session-card"===e.item.kind?(0,n.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}):(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M15.5 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2V8.5L15.5 3z"}),(0,n.jsx)("path",{d:"M15 3v6h6"})]})}),(0,n.jsx)("span",{style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.snippet}),(0,n.jsx)("span",{style:{flexShrink:0,fontSize:10,color:"var(--text-dim)"},children:"session-card"===e.item.kind?r("boards.searchSession"):r("boards.searchNote")})]},e.item.shapeId)})})]})}let x=(0,i.default)(()=>Promise.all([r.e(6009),r.e(333)]).then(r.bind(r,20333)).then(e=>e.CanvasStage),{loadableGenerated:{webpack:()=>[20333]},ssr:!1,loading:()=>(0,n.jsx)("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(8, 14, 30, 0.85)",color:"rgba(255, 255, 255, 0.85)",fontSize:13},children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{width:14,height:14,borderRadius:"50%",border:"2px solid rgba(255, 255, 255, 0.18)",borderTopColor:"rgba(255, 255, 255, 0.9)",animation:"spin 0.8s linear infinite"}}),"正在加载画布…"]})})});function g({boardId:e,taskId:t,newSessionCwd:r,onRunningSessionIdsChange:i,wallSettings:b,updateWallSettings:v}){let{t:y}=(0,a.s)(),{isDark:m}=(0,s.D)(),w=(0,l.C6)({boardId:e,taskId:t,newSessionCwd:r}),k=!!(w.board?.taskId??t),j=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=e=>{if(!(e.ctrlKey||e.metaKey)||"f"!==e.key.toLowerCase())return;let t=document.activeElement;if(t&&t!==j.current){let e=t.tagName;if("INPUT"===e||"TEXTAREA"===e||t.isContentEditable)return}e.preventDefault(),j.current?.focus(),j.current?.select()};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[]);let[S,C]=(0,o.useState)(!1),[R,I]=(0,o.useState)(null);(0,o.useEffect)(()=>{let e=!1,t=async()=>{try{let t=await fetch("/api/task-scheduler/status",{cache:"no-store"});if(!t.ok)return;let r=await t.json();e||I(r.status)}catch{}};t();let r=setInterval(t,5e3);return()=>{e=!0,clearInterval(r)}},[]);let[E,L]=(0,o.useState)(!1),T=(0,o.useCallback)(async()=>{if(!E){L(!0);try{w.loadSessionSummaries(),await w.reloadCanvas()}finally{setTimeout(()=>L(!1),800)}}},[w,E]);return(0,o.useEffect)(()=>{i?.(new Set(w.running?.runningSessionIds??[]))},[w.running,i]),(0,n.jsx)("div",{"data-glass-scope":"board",style:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},children:(0,n.jsx)(c.I,{value:"board",children:(0,n.jsx)(u.Nc.Provider,{value:{boardId:w.board?.id??null,defaultCwd:r??null},children:(0,n.jsxs)(d.eR,{children:[!w.loading&&w.board?.name&&(0,n.jsxs)("div",{style:{position:"absolute",top:12,left:12,zIndex:40,display:"flex",alignItems:"center",gap:6,maxWidth:300,height:34,padding:"0 8px 0 12px",borderRadius:999,background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 2px 12px -6px rgba(0,0,0,0.18)",color:"var(--text)"},title:w.board.name,children:[(0,n.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flexShrink:0,opacity:.7},children:[(0,n.jsx)("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1.5"}),(0,n.jsx)("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1.5"}),(0,n.jsx)("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1.5"}),(0,n.jsx)("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1.5"})]}),(0,n.jsx)("span",{style:{fontSize:12.5,fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:w.board.name}),(0,n.jsx)("button",{type:"button",onClick:()=>void T(),title:y("boards.reloadCanvas"),"aria-label":y("boards.reloadCanvas"),style:{display:"flex",alignItems:"center",justifyContent:"center",width:22,height:22,padding:0,flexShrink:0,border:"none",background:"transparent",color:"var(--text-muted)",cursor:E?"default":"pointer",borderRadius:999,transition:"background 0.12s, color 0.12s"},children:(0,n.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{animation:E?"spin 0.8s linear infinite":void 0},children:[(0,n.jsx)("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}),(0,n.jsx)("path",{d:"M21 3v5h-5"})]})})]}),!w.loading&&R&&R.running.length>0&&(0,n.jsxs)("div",{title:`调度器正在执行 ${R.running.length} 个任务`,style:{position:"absolute",top:52,left:12,zIndex:40,display:"flex",alignItems:"center",gap:6,maxWidth:260,padding:"3px 10px",borderRadius:999,background:"color-mix(in srgb, var(--board-card-glass) 85%, transparent)",border:"1px solid color-mix(in srgb, var(--border) 45%, transparent)",color:"var(--text-muted)",fontSize:10.5,lineHeight:1.4,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{flexShrink:0,width:7,height:7,borderRadius:"50%",background:"#10b981",boxShadow:"0 0 6px 1px rgba(16,185,129,0.6)",animation:"pulse 1.6s ease-in-out infinite"}}),(0,n.jsxs)("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:["正在运行 ",R.running.map(e=>`#${e.number} ${e.name}`).join("、")]})]}),!w.loading&&(0,n.jsx)("div",{style:{position:"absolute",top:12,left:"50%",transform:"translateX(-50%)",zIndex:40},children:(0,n.jsx)(h,{editor:w.editor,inputRef:j})}),(0,n.jsxs)("div",{style:{position:"absolute",top:10,right:10,zIndex:30,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:6},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,padding:4,borderRadius:10,background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 2px 12px -6px rgba(0,0,0,0.18)"},children:[(0,n.jsx)("button",{type:"button",onClick:()=>w.addNewSessionCard(),title:y("boards.newSession"),style:{...f,color:"var(--accent)"},children:(0,n.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,n.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),(0,n.jsx)("button",{type:"button",disabled:!0,title:y("boards.autoLayoutDesc"),"aria-label":y("boards.autoLayout"),style:{...f,color:"var(--text-dim)",opacity:.55,cursor:"not-allowed"},children:(0,n.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),(0,n.jsx)("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),(0,n.jsx)("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),(0,n.jsx)("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}),(0,n.jsx)("button",{type:"button",onClick:()=>C(e=>!e),title:y("boards.scrimTitle"),"aria-expanded":S,style:{...f,color:S?"var(--accent)":"var(--text-muted)",background:S?"color-mix(in srgb, var(--accent) 12%, transparent)":"transparent"},children:(0,n.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M12 3v2"}),(0,n.jsx)("path",{d:"M12 19v2"}),(0,n.jsx)("path",{d:"M5 7l1.5 1.5"}),(0,n.jsx)("path",{d:"M17.5 15.5L19 17"}),(0,n.jsx)("path",{d:"M3 12h2"}),(0,n.jsx)("path",{d:"M19 12h2"}),(0,n.jsx)("path",{d:"M5 17l1.5-1.5"}),(0,n.jsx)("path",{d:"M17.5 8.5L19 7"}),(0,n.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})}),(0,n.jsx)("button",{type:"button",onClick:()=>{(0,p.l)({message:k?y("boards.clearTaskConfirm"):y("boards.clearConfirm"),confirmText:y("boards.clear")}).then(e=>{e&&w.clearBoard()})},title:k?y("boards.clearTaskBoardDesc"):y("boards.clearDesc"),style:f,children:(0,n.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M18 6 6 18"}),(0,n.jsx)("path",{d:"m6 6 12 12"})]})})]}),S&&(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:"8px 10px",borderRadius:10,background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 2px 12px -6px rgba(0,0,0,0.18)",color:"var(--text)",fontSize:12.5,whiteSpace:"nowrap"},children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,n.jsx)("span",{style:{width:14,flexShrink:0,textAlign:"center",fontSize:12},children:"❄"}),(0,n.jsx)("span",{style:{flexShrink:0},children:y("boards.scrimBlur")}),(0,n.jsx)("input",{type:"range",min:0,max:30,value:b.scrimBlur,onChange:e=>v({scrimBlur:Number(e.target.value)}),style:{flex:1,minWidth:120,accentColor:"var(--accent)",cursor:"pointer"},"aria-label":y("boards.scrimBlur")}),(0,n.jsxs)("span",{style:{width:30,flexShrink:0,textAlign:"right",fontSize:11,color:"var(--text)"},children:[b.scrimBlur,"px"]})]})})]}),(0,n.jsx)(x,{board:w,isDark:m})]})})})})}let f={display:"flex",alignItems:"center",justifyContent:"center",width:32,height:32,padding:0,border:"none",background:"transparent",color:"var(--text-muted)",cursor:"pointer",borderRadius:7,transition:"background 0.12s, color 0.12s"}},24456:(e,t,r)=>{r.d(t,{l:()=>c});var n=r(95155),o=r(12115),i=r(12669);let a=null,s=null,l=null;function d(e){a?.(e),a=null,l?.unmount(),s?.remove(),l=null,s=null}function c(e){return new Promise(t=>{a&&d(!1),a=t;let r=s;r||(r=document.createElement("div"),document.body.appendChild(r),s=r);let o=l;o||(l=o=(0,i.createRoot)(r)),o.render((0,n.jsx)(u,{opts:e,onClose:d}))})}function u({opts:e,onClose:t}){let[r]=(0,o.useState)(!1);return(0,n.jsx)("div",{role:"alertdialog","aria-modal":"true",onPointerDown:()=>t(!1),style:{position:"fixed",inset:0,zIndex:2e3,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.35)"},children:(0,n.jsxs)("div",{onPointerDown:e=>e.stopPropagation(),style:{width:360,maxWidth:"calc(100vw - 48px)",borderRadius:"var(--bubble-radius, 14px)",background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 10px 40px -12px rgba(0,0,0,0.4)",color:"var(--text)",padding:"16px 18px",display:"flex",flexDirection:"column",gap:10},children:[e.title&&(0,n.jsx)("div",{style:{fontSize:14,fontWeight:600},children:e.title}),(0,n.jsx)("div",{style:{fontSize:12.5,lineHeight:1.6,color:"var(--text-muted)",whiteSpace:"pre-wrap"},children:e.message}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:6},children:[(0,n.jsx)("button",{type:"button",onClick:()=>t(!1),style:{border:"none",background:"color-mix(in srgb, var(--border) 30%, transparent)",color:"var(--text-muted)",borderRadius:6,padding:"5px 14px",fontSize:12,cursor:"pointer"},children:e.cancelText??"取消"}),(0,n.jsx)("button",{type:"button",disabled:r,onClick:()=>t(!0),style:{border:"none",background:!1===e.danger?"var(--accent)":"color-mix(in srgb, #ef4444 85%, transparent)",color:"#fff",borderRadius:6,padding:"5px 14px",fontSize:12,fontWeight:600,cursor:"pointer"},children:e.confirmText??"删除"})]})]})})}},26479:(e,t,r)=>{r.d(t,{Nc:()=>g,o_:()=>v});var n=r(95155),o=r(12115),i=r(23312),a=r(15934);function s(e,t){return(e??[]).filter(e=>e.kind===t).map(e=>e.targetCardId)}var l=r(20985);function d({value:e,options:t,onChange:r,width:i="100%"}){let[a,s]=(0,o.useState)(!1),[c,u]=(0,o.useState)(!1),p=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(!a)return;let e=e=>{p.current&&!p.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[a]);let h=t.find(t=>t.value===e);return(0,n.jsxs)("div",{ref:p,style:{position:"relative",width:i},children:[(0,n.jsxs)("button",{type:"button",onClick:()=>s(e=>!e),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),style:{width:"100%",height:28,boxSizing:"border-box",display:"flex",alignItems:"center",gap:6,padding:"0 8px",background:a?"var(--side-active)":c?"var(--side-hover)":"transparent",border:"1px solid var(--border)",borderRadius:5,cursor:"pointer",fontSize:11,color:"var(--text)",textAlign:"left",transition:"background 0.12s"},children:[(0,n.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h?.label??""}),(0,n.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,color:"var(--text-dim)"},children:(0,n.jsx)("polyline",{points:"2 3.5 5 6.5 8 3.5"})})]}),a&&(0,n.jsx)(l.f,{open:!0,style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:120,minWidth:120,maxHeight:200,overflowY:"auto",background:"var(--popover-glass)",border:"1px solid var(--border)",borderRadius:6,boxShadow:"0 6px 20px -6px rgba(0,0,0,0.35)",padding:4},children:t.map(t=>(0,n.jsx)("button",{type:"button",onClick:()=>{r(t.value),s(!1)},style:{display:"block",width:"100%",boxSizing:"border-box",padding:"5px 8px",border:"none",borderRadius:4,background:t.value===e?"var(--side-active)":"transparent",color:"var(--text)",fontSize:11,textAlign:"left",cursor:"pointer"},onMouseEnter:e=>{e.currentTarget.style.background="var(--side-hover)"},onMouseLeave:r=>{r.currentTarget.style.background=t.value===e?"var(--side-active)":"transparent"},children:t.label},t.value))})]})}var c=r(87278);function u({candidates:e,selected:t,onChange:r,placeholder:i="选择任务卡…",excludeId:a,width:s="100%"}){let[d,c]=(0,o.useState)(!1),[p,h]=(0,o.useState)(!1),x=(0,o.useRef)(null),g=e.filter(e=>e.id!==a),f=new Set(t);(0,o.useEffect)(()=>{if(!d)return;let e=e=>{x.current&&!x.current.contains(e.target)&&c(!1)},t=e=>{"Escape"===e.key&&c(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[d]);let b=g.filter(e=>f.has(e.id)),v=b.length>3?b.length-3:0,y=b.slice(0,3);return(0,n.jsxs)("div",{ref:x,style:{position:"relative",width:s},children:[(0,n.jsxs)("button",{type:"button",onClick:()=>c(e=>!e),onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),style:{width:"100%",height:28,boxSizing:"border-box",display:"flex",alignItems:"center",gap:4,padding:"0 6px",background:d?"var(--side-active)":p?"var(--side-hover)":"transparent",border:"1px solid var(--border)",borderRadius:5,cursor:"pointer",fontSize:11,color:"var(--text)",textAlign:"left",transition:"background 0.12s"},children:[y.length>0?(0,n.jsxs)(n.Fragment,{children:[y.map(e=>(0,n.jsxs)("span",{style:{flexShrink:0,display:"inline-flex",alignItems:"center",gap:3,padding:"1px 5px",borderRadius:999,background:"var(--side-selected)",color:"var(--accent)",fontFamily:"var(--font-mono)",fontSize:10},children:["#",e.number]},e.id)),v>0&&(0,n.jsxs)("span",{style:{flexShrink:0,color:"var(--text-muted)",fontSize:10},children:["+",v]})]}):(0,n.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text-dim)"},children:i}),(0,n.jsx)("span",{style:{flex:1}}),(0,n.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,color:"var(--text-dim)"},children:(0,n.jsx)("polyline",{points:"2 3.5 5 6.5 8 3.5"})})]}),d&&(0,n.jsx)(l.f,{open:!0,style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:120,minWidth:160,maxHeight:180,overflowY:"auto",background:"var(--popover-glass)",border:"1px solid var(--border)",borderRadius:6,boxShadow:"0 6px 20px -6px rgba(0,0,0,0.35)",padding:4},children:0===g.length?(0,n.jsx)("div",{style:{padding:"8px",color:"var(--text-dim)",fontSize:11},children:"本看板无其他任务卡"}):g.map(e=>{let o=f.has(e.id);return(0,n.jsxs)("button",{type:"button",onClick:n=>{var o;n.stopPropagation(),o=e.id,r(f.has(o)?t.filter(e=>e!==o):[...t,o])},style:{display:"flex",alignItems:"center",gap:7,width:"100%",boxSizing:"border-box",padding:"5px 8px",border:"none",borderRadius:4,background:o?"var(--side-selected)":"transparent",color:"var(--text)",fontSize:11,textAlign:"left",cursor:"pointer"},onMouseEnter:e=>{o||(e.currentTarget.style.background="var(--side-hover)")},onMouseLeave:e=>{e.currentTarget.style.background=o?"var(--side-selected)":"transparent"},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{flexShrink:0,width:12,height:12,borderRadius:3,border:"1px solid var(--border)",background:o?"var(--accent)":"transparent",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"var(--accent-contrast, #fff)"},children:o&&(0,n.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("polyline",{points:"1.5 5 3.5 7 8.5 2"})})}),(0,n.jsxs)("span",{style:{fontFamily:"var(--font-mono)",color:"var(--text-muted)",flexShrink:0},children:["#",e.number]}),(0,n.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name})]},e.id)})})]})}var p=r(91897),h=r(29608);function x({cwd:e,value:t,onChange:r}){let[i,a]=(0,o.useState)(null),[s,d]=(0,o.useState)(!1),[c,u]=(0,o.useState)(!1),[p,h]=(0,o.useState)(""),[g,f]=(0,o.useState)(!1),[b,v]=(0,o.useState)(null),y=(0,o.useRef)(null),m=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(!e)return void a(null);let t=!1;return(async()=>{try{let r=await fetch(`/api/worktrees?cwd=${encodeURIComponent(e)}`,{cache:"no-store"});if(!r.ok)return;let n=await r.json();if(t)return;a({forCwd:e,projectRoot:n.projectRoot??e,isGit:n.isGit??!1,currentWorktreePath:n.currentWorktreePath??null,worktrees:(n.worktrees??[]).map(e=>({path:e.path,branch:e.branch??null,isMain:!!e.isMain}))})}catch{t||a(null)}})(),()=>{t=!0}},[e]);let w=i?.worktrees.find(e=>e.path===t)??i?.worktrees.find(t=>t.path===e)??(i?.currentWorktreePath?i.worktrees.find(e=>e.path===i.currentWorktreePath):void 0)??i?.worktrees.find(e=>e.isMain)??null,k=async()=>{let e=p.trim();if(e&&!g&&i){f(!0),v(null);try{let t=await fetch("/api/worktrees",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:i.projectRoot,branch:e})}),n=await t.json().catch(()=>({}));if(!t.ok||!n.path){v(n.error??"创建失败"),f(!1);return}h(""),u(!1),d(!1),r(n.path)}catch(e){v(e instanceof Error?e.message:String(e))}f(!1)}};(0,o.useEffect)(()=>{if(!s)return;let e=e=>{y.current&&!y.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[s]);let j=w?w.isMain?`主 checkout(${w.branch??""})`:w.branch??w.path:i?.isGit?"选择工作区…":"非 git 项目";return(0,n.jsxs)("div",{ref:y,style:{position:"relative"},children:[(0,n.jsxs)("button",{type:"button",onClick:()=>{d(e=>!e),v(null)},style:{width:"100%",height:28,boxSizing:"border-box",display:"flex",alignItems:"center",gap:6,padding:"0 8px",background:s?"var(--side-active)":"transparent",border:"1px solid var(--border)",borderRadius:5,cursor:"pointer",fontSize:11,color:"var(--text)",textAlign:"left",fontFamily:"var(--font-mono)"},title:w?.path??void 0,children:[(0,n.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,color:w&&!w.isMain?"var(--accent)":"var(--text-dim)"},children:[(0,n.jsx)("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),(0,n.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,n.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,n.jsx)("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),(0,n.jsx)("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:j}),(0,n.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,color:"var(--text-dim)"},children:(0,n.jsx)("polyline",{points:"2 3.5 5 6.5 8 3.5"})})]}),(0,n.jsxs)(l.f,{open:s,style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:120,minWidth:200,background:"var(--popover-glass)",border:"1px solid var(--border)",borderRadius:6,boxShadow:"0 6px 20px -6px rgba(0,0,0,0.35)",overflow:"hidden"},children:[(0,n.jsx)("div",{style:{maxHeight:"min(40vh, 260px)",overflowY:"auto",padding:4},children:0===(i?.worktrees??[]).length?(0,n.jsx)("div",{style:{padding:"8px 10px",fontSize:11,color:"var(--text-dim)"},children:i?.isGit===!1?"非 git 项目,无法创建工作区":"暂无工作区"}):(i?.worktrees??[]).map(e=>{let o=e.path===(w?.path??t);return(0,n.jsxs)("button",{type:"button",onClick:()=>{r(e.path),d(!1),v(null)},title:e.path,style:{display:"block",width:"100%",boxSizing:"border-box",padding:"6px 8px",border:"none",borderRadius:4,background:o?"var(--side-active)":"transparent",color:"var(--text)",fontSize:11,textAlign:"left",cursor:"pointer",fontFamily:"var(--font-mono)"},onMouseEnter:e=>{o||(e.currentTarget.style.background="var(--side-hover)")},onMouseLeave:e=>{o||(e.currentTarget.style.background="transparent")},children:[(0,n.jsx)("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.isMain?`主 checkout(${e.branch??""})`:e.branch??e.path}),(0,n.jsx)("span",{style:{display:"block",fontSize:9.5,color:"var(--text-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.path})]},e.path)})}),c?(0,n.jsxs)("div",{style:{padding:"6px 8px",borderTop:"1px solid var(--bubble-hairline)"},children:[(0,n.jsx)("input",{ref:m,value:p,onChange:e=>{h(e.target.value),v(null)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),k()),"Escape"===e.key&&(u(!1),h(""),v(null))},placeholder:"新分支名",style:{width:"100%",fontSize:11,fontFamily:"var(--font-mono)",padding:"5px 8px",border:"1px solid var(--accent)",borderRadius:5,outline:"none",background:"var(--side-input)",color:"var(--text)",boxSizing:"border-box"}}),(0,n.jsxs)("div",{style:{display:"flex",gap:5,marginTop:5},children:[(0,n.jsx)("button",{type:"button",onClick:()=>void k(),disabled:g||!p.trim(),style:{flex:1,padding:"4px 0",background:"var(--accent)",border:"none",borderRadius:5,color:"var(--accent-contrast, #fff)",fontSize:11,fontWeight:600,cursor:g||!p.trim()?"not-allowed":"pointer",opacity:g||!p.trim()?.65:1},children:g?"创建中…":"创建"}),(0,n.jsx)("button",{type:"button",onClick:()=>{u(!1),h(""),v(null)},style:{flex:1,padding:"4px 0",background:"transparent",border:"1px solid var(--border)",borderRadius:5,color:"var(--text-muted)",fontSize:11,cursor:"pointer"},children:"取消"})]})]}):(0,n.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),u(!0),v(null),setTimeout(()=>m.current?.focus(),0)},style:{display:"flex",alignItems:"center",gap:7,width:"100%",padding:"7px 10px",background:"none",border:"none",borderTop:"1px solid var(--bubble-hairline)",color:"var(--text-muted)",cursor:"pointer",textAlign:"left",fontSize:11},children:[(0,n.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinecap:"round",style:{flexShrink:0},children:[(0,n.jsx)("line",{x1:"5",y1:"1",x2:"5",y2:"9"}),(0,n.jsx)("line",{x1:"1",y1:"5",x2:"9",y2:"5"})]}),(0,n.jsx)("span",{children:"新建工作区"})]}),b&&(0,n.jsx)("div",{style:{padding:"5px 10px 8px",color:"#dc2626",fontSize:11,lineHeight:1.35,overflowWrap:"anywhere"},children:b})]})]})}let g=(0,o.createContext)(null),f={cardId:i.T.string,number:i.T.number,name:i.T.string,description:i.T.string.optional(),readyStatus:i.T.string,execStatus:i.T.string,priority:i.T.number,due:i.T.number.nullable().optional(),expanded:i.T.boolean,w:i.T.number,h:i.T.number,expandedW:i.T.number,expandedH:i.T.number,collapsedW:i.T.number,collapsedH:i.T.number},b={not_started:{color:"#9ca3af",label:"未开始"},running:{color:"#10b981",label:"进行中"},review:{color:"#f59e0b",label:"待审核"},done:{color:"#10b981",label:"完成"},failed:{color:"#ef4444",label:"失败"},abandoned:{color:"#9ca3af",label:"放弃"},waiting_reply:{color:"#3184f8",label:"等回复"}};class v extends i.A8{static{this.type="task-card"}static{this.props=f}getDefaultProps(){return{cardId:"",number:0,name:"新建任务",description:"",readyStatus:"draft",execStatus:"not_started",priority:0,expanded:!1,w:380,h:270,expandedW:0,expandedH:0,collapsedW:0,collapsedH:0}}canEdit(){return!0}canResize(){return!0}canScroll(){return!0}hideRotateHandle(){return!0}onDoubleClick(e){var t;return{id:e.id,type:"task-card",props:(t=e).props.expanded?{expanded:!1,expandedW:t.props.w,expandedH:t.props.h,w:t.props.collapsedW||380,h:t.props.collapsedH||270}:{expanded:!0,collapsedW:t.props.w,collapsedH:t.props.h,w:t.props.expandedW||760,h:t.props.expandedH||600}}}onResize(e,t){let r=e.props.expanded;return(0,i.mfH)(e,t,{minWidth:r?480:380,minHeight:r?400:240})}getIndicatorPath(e){let{w:t,h:r}=e.props,n=new Path2D;return n.roundRect(0,0,t,r,12),n}component(e){return(0,n.jsx)(y,{shape:e})}}function y({shape:e}){return(0,n.jsx)(k,{shape:e})}let m={width:"100%",boxSizing:"border-box",border:"1px solid var(--border)",borderRadius:6,background:"transparent",color:"var(--text)",fontSize:12,padding:"4px 8px",outline:"none"},w={display:"block",fontSize:10,color:"var(--text)",fontWeight:600,margin:"8px 0 3px"};function k({shape:e}){let{cardId:t,w:r,h:l,expanded:f}=e.props,v=(0,i.hGv)(),y=(0,o.useContext)(g)?.boardId??null,R=(0,o.useContext)(g)?.defaultCwd??null,{detail:I,candidates:E,loading:L,error:T,reload:W,createCard:z,saveCard:P}=function(e,t){let[r,n]=(0,o.useState)(null),[i,s]=(0,o.useState)([]),[l,d]=(0,o.useState)(!1),[c,u]=(0,o.useState)(null),p=(0,o.useRef)(null);p.current=r;let h=(0,o.useCallback)(async(t=!1)=>{if(!e)return void n(null);t||d(!0);try{let t=await fetch(`/api/task-cards/${encodeURIComponent(e)}`,{cache:"no-store"});if(!t.ok){if(404===t.status)return void n(null);throw Error(`HTTP ${t.status}`)}let r=await t.json();n(r)}catch(e){t||u(e instanceof Error?e.message:String(e))}finally{t||d(!1)}},[e]),x=(0,o.useCallback)(()=>h(!1),[h]);(0,o.useEffect)(()=>{x()},[x]),(0,o.useEffect)(()=>{if(!t)return;let e=!1;return(async()=>{try{let r=await fetch(`/api/task-cards?boardId=${encodeURIComponent(t)}`,{cache:"no-store"});if(!r.ok)return;let n=await r.json();e||s(n.cards)}catch{}})(),()=>{e=!0}},[t]);let g=(0,o.useCallback)(async e=>{try{let t=await fetch("/api/task-cards",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`HTTP ${t.status}`)}let r=await t.json();return"number"==typeof r.updated&&(0,a.D2)(e.boardId,r.updated),r.card}catch(e){return u(e instanceof Error?e.message:String(e)),null}},[]),f=(0,o.useCallback)(async t=>{if(!e)return!1;try{let r=await fetch(`/api/task-cards/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error??`HTTP ${r.status}`)}let n=await r.json();return"number"==typeof n.updated&&p.current?.card.boardId&&(0,a.D2)(p.current.card.boardId,n.updated),await x(),!0}catch(e){return u(e instanceof Error?e.message:String(e)),!1}},[e,x]);return{detail:r,candidates:i,loading:l,error:c,reload:x,createCard:g,saveCard:f}}(t||null,y),M=(0,c.G)(v,e.id,"var(--assistant-card-glass)"),D=!t,$=I?.card.sessionId??null;(0,o.useEffect)(()=>{f&&!D&&W()},[f,D,W]);let H=(0,o.useCallback)(()=>{if($)for(let e of v.getCurrentPageShapes()){if("session-card"!==e.type)continue;let t=e.props;if(t.sessionId!==$)continue;let r={x:e.x+(t.w??0)/2,y:e.y+(t.h??0)/2};v.centerOnPoint(r),v.select(e.id);return}},[v,$]),A=(0,i.hau)("execStatus",()=>{let t=v.getShape(e.id);return t?.props?.execStatus??null},[v,e.id]);(0,o.useEffect)(()=>{A&&O&&O.execStatus!==A&&ed("execStatus",A)},[A]);let B=(0,i.hau)("remoteName",()=>{let t=v.getShape(e.id),r=t?.props,n=r?.name;return n&&"新建任务"!==n?n:""},[v,e.id]),F=(0,i.hau)("remoteDescription",()=>{let t=v.getShape(e.id);return t?.props?.description??""},[v,e.id]),N=(0,o.useRef)(!1);(0,o.useEffect)(()=>{!O||N.current||void 0!==B&&B!==O.name&&U(e=>e?{...e,name:B}:e)},[B]),(0,o.useEffect)(()=>{!O||N.current||void 0!==F&&F!==O.description&&U(e=>e?{...e,description:F}:e)},[F]);let[O,U]=(0,o.useState)(()=>D?{id:"",boardId:"",projectKey:"",number:0,name:"新建任务"===e.props.name?"":e.props.name,description:e.props.description??"",readyStatus:"draft",execStatus:"not_started",priority:0,due:null,attachments:[],cwd:R,useWorktree:!1,maxRetries:3,retryCount:0,sessionId:null,dispatchToken:null,created:0,updated:0}:null);(0,o.useEffect)(()=>{!D&&I?.card&&!O&&U({...I.card})},[D,I,O]);let[_,Y]=(0,o.useState)([]),[K,G]=(0,o.useState)([]),q=(0,o.useRef)(!1);(0,o.useEffect)(()=>{I&&!q.current&&(q.current=!0,Y(s(I.links,"prerequisite")),G(s(I.links,"related")))},[I]);let[J,V]=(0,o.useState)(!1),X=(0,o.useRef)(!1),[Q,Z]=(0,o.useState)(null),[ee,et]=(0,o.useState)(null),[er,en]=(0,o.useState)(!1);(0,o.useEffect)(()=>{en(f)},[f]);let[eo,ei]=(0,o.useState)(!1),[ea,es]=(0,o.useState)(null),el=(0,o.useRef)(null),ed=(t,r)=>{U(n=>{let o=n?{...n,[t]:r}:n;return o&&("name"===t||"description"===t)&&v.updateShape({id:e.id,type:"task-card",props:{name:"name"===t?r:o.name,description:"description"===t?r:o.description??""}}),o})};(0,o.useEffect)(()=>{let e=el.current;if(!e)return;let t=t=>{if(t.ctrlKey||t.metaKey)return;let r=t.target;r instanceof Node&&e.contains(r)&&function(e,t){let r=e instanceof Element?e:e.parentElement;for(;r&&r instanceof HTMLElement&&r!==t;){let e=r.scrollHeight>r.clientHeight,t=r.scrollWidth>r.clientWidth;if(e||t){let n=getComputedStyle(r),o=n.overflowY,i=n.overflowX;if(e&&("auto"===o||"scroll"===o||"overlay"===o)||t&&("auto"===i||"scroll"===i||"overlay"===i))return!0}r=r.parentElement}return!1}(r,e)&&t.stopPropagation()};return e.addEventListener("wheel",t),()=>e.removeEventListener("wheel",t)});let ec=async()=>{if(!y)return void Z("缺少看板上下文,无法创建");if(!O?.name.trim())return void et("请填写任务名称");if(V(!0),Z(null),X.current)return;X.current=!0;let t=await z({boardId:y,name:O.name,description:O.description,readyStatus:"todo",priority:O.priority,due:O.due??null,cwd:O.cwd??void 0,useWorktree:O.useWorktree,maxRetries:O.maxRetries,attachments:O.attachments,prerequisites:_,related:K});X.current=!1,V(!1),t&&(v.updateShape({id:e.id,type:"task-card",props:{cardId:t.id,number:t.number,name:t.name,readyStatus:t.readyStatus,execStatus:t.execStatus,priority:t.priority,due:t.due??void 0}}),U(e=>e?{...e,...t,sessionId:t.sessionId}:e),W())},eu=async()=>{if(!O?.name.trim())return void et("请填写任务名称");if(X.current)return;V(!0),X.current=!0,Z(null);let t=await P({name:O.name,description:O.description,readyStatus:O.readyStatus,priority:O.priority,due:O.due??null,attachments:O.attachments,cwd:O.cwd??null,useWorktree:O.useWorktree,maxRetries:O.maxRetries,prerequisites:_,related:K});X.current=!1,V(!1),t?v.updateShape({id:e.id,type:"task-card",props:{name:O.name,description:O.description??"",readyStatus:O.readyStatus,priority:O.priority,due:O.due??void 0}}):Z(T??"保存失败")},ep=(0,o.useMemo)(()=>{if(D||!I?.card||!O)return!1;let e=I.card;return O.name!==e.name||O.description!==e.description||O.priority!==e.priority||O.due!==e.due||O.cwd!==e.cwd||O.useWorktree!==e.useWorktree||O.maxRetries!==e.maxRetries||JSON.stringify(O.attachments??[])!==JSON.stringify(e.attachments??[])||JSON.stringify([..._].sort())!==JSON.stringify(s(I.links,"prerequisite").sort())||JSON.stringify([...K].sort())!==JSON.stringify(s(I.links,"related").sort())},[D,I,O,_,K]),eh=(0,i.hau)("selected",()=>v.getSelectedShapeIds().includes(e.id),[v,e.id]),ex=(0,o.useRef)(eh),eg=(0,o.useRef)(ep);eg.current=ep;let ef=(0,o.useRef)(eu);ef.current=eu,(0,o.useEffect)(()=>{let e=ex.current;ex.current=eh,e&&!eh&&!D&&eg.current&&ef.current()},[eh,D]);let eb=O?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("label",{style:w,children:"任务名称 *"}),(0,n.jsx)("input",{style:{...m,...ee?{borderColor:"#f87171",boxShadow:"0 0 0 1px #f87171"}:{}},value:O.name,onChange:e=>{ed("name",e.target.value),ee&&et(null)},onFocus:()=>{N.current=!0},onBlur:()=>{N.current=!1},placeholder:"任务名称"}),ee&&(0,n.jsx)("div",{style:{color:"#f87171",fontSize:11,marginTop:3},children:ee}),(0,n.jsx)("label",{style:w,children:"需求说明"}),(0,n.jsx)("textarea",{style:{...m,flex:1,minHeight:70,resize:"none",fontFamily:"var(--font-mono)",fontSize:11},value:O.description,onChange:e=>ed("description",e.target.value),onFocus:()=>{N.current=!0},onBlur:()=>{N.current=!1},placeholder:"任务描述",spellCheck:!1}),(0,n.jsxs)(S,{title:"高级",open:er,onToggle:()=>en(e=>!e),children:[(0,n.jsx)("label",{style:w,children:"工作目录"}),(0,n.jsxs)("div",{style:{display:"flex",gap:6},children:[(0,n.jsx)("input",{style:{...m,flex:1},value:O.cwd??"",onChange:e=>ed("cwd",e.target.value||null),placeholder:"默认项目根目录",readOnly:!0}),(0,n.jsx)("button",{type:"button",style:j,onClick:()=>ei(!0),children:"选择目录"})]}),eo&&O&&(0,n.jsx)(h.K,{onCancel:()=>ei(!1),onSelect:e=>{ed("cwd",e),ei(!1)}}),(0,n.jsx)("label",{style:w,children:"工作区"}),(0,n.jsx)(x,{cwd:O.cwd,value:ea,onChange:e=>{es(e),ed("cwd",e)}}),(0,n.jsx)("label",{style:w,children:"预计截止"}),(0,n.jsx)(C,{due:O.due??null,onChange:e=>ed("due",e)}),(0,n.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,n.jsxs)("div",{style:{flex:1},children:[(0,n.jsx)("label",{style:w,children:"优先级"}),(0,n.jsx)(d,{value:String(O.priority),onChange:e=>ed("priority",Number(e)),options:[{value:"1",label:"高"},{value:"0",label:"中"},{value:"-1",label:"低"}]})]}),(0,n.jsxs)("div",{style:{flex:1},children:[(0,n.jsx)("label",{style:w,children:"最大重试次数"}),(0,n.jsx)("input",{style:m,type:"number",min:0,value:O.maxRetries,onChange:e=>ed("maxRetries",Math.max(0,Number(e.target.value)||0))})]})]}),(0,n.jsx)("label",{style:w,children:"前置任务(可多选)"}),(0,n.jsx)(u,{candidates:E,selected:_,onChange:Y,excludeId:t,placeholder:"本看板内选择前置任务…"}),(0,n.jsx)("label",{style:w,children:"关联任务(可多选)"}),(0,n.jsx)(u,{candidates:E,selected:K,onChange:G,excludeId:t,placeholder:"本看板内选择关联任务…"}),(0,n.jsx)("label",{style:w,children:"附件(引用文件路径,每行一个)"}),(0,n.jsx)("textarea",{style:{...m,minHeight:46,resize:"vertical",fontFamily:"var(--font-mono)",fontSize:11},value:(O.attachments??[]).join("\n"),onChange:e=>ed("attachments",e.target.value.split("\n").map(e=>e.trim()).filter(Boolean)),placeholder:"/path/to/file",spellCheck:!1})]}),(Q||T)&&(0,n.jsx)("div",{style:{color:"#f87171",fontSize:11,marginTop:6},children:Q??T})]}):L?(0,n.jsx)("div",{style:{color:"var(--text-dim)",fontSize:12,padding:20,textAlign:"center"},children:"加载中…"}):(0,n.jsx)("div",{style:{color:"var(--text-dim)",fontSize:12,padding:20,textAlign:"center"},children:"未找到任务卡"});return(0,n.jsx)(i.hDc,{"data-testid":`task-card-${e.id}`,onPointerDown:()=>v.bringToFront([e.id]),style:{width:r,height:l,pointerEvents:"none"},children:(0,n.jsxs)("div",{ref:e=>{el.current=e,M(e)},style:{position:"relative",width:r,height:l,borderRadius:"var(--bubble-radius, 12px)",border:"1px solid var(--bubble-border)",background:"transparent",boxShadow:"0 2px 10px -6px rgba(0,0,0,0.2)",color:"var(--text)",display:"flex",flexDirection:"column",overflow:"hidden",pointerEvents:"all",userSelect:"none"},children:[(0,n.jsxs)("div",{style:{flexShrink:0,height:36,display:"flex",alignItems:"center",gap:6,padding:"0 10px",borderBottom:"1px solid var(--bubble-hairline)",cursor:"grab",fontSize:11,color:"var(--text-muted)"},children:[(0,n.jsx)("span",{title:`执行状态:${(b[O?.execStatus??"not_started"]??b.not_started).label}`,style:{display:"flex",alignItems:"center",gap:4,flexShrink:0},children:(0,n.jsx)(p.i,{kind:"task",color:(b[O?.execStatus??"not_started"]??b.not_started).color})}),(0,n.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:12.5,fontWeight:600,color:"var(--text)"},children:O?.name||(D?"新建任务卡":"任务卡")}),O?.number?(0,n.jsxs)("span",{style:{flexShrink:0,fontSize:12.5,fontWeight:600,color:"var(--text)",marginLeft:4},children:["#",O.number]}):null,(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,flexShrink:0},onPointerDown:e=>e.stopPropagation(),children:[D?(0,n.jsx)("button",{type:"button",style:j,disabled:J||!y,onClick:()=>void ec(),title:"创建任务并派发(转待办,调度器可执行)",children:J?"创建中…":"派发"}):O?.readyStatus==="draft"?(0,n.jsx)("button",{type:"button",style:j,disabled:J,onClick:()=>{ed("readyStatus","todo"),!D&&t&&P({readyStatus:"todo"})},title:"派发(转待办,调度器可执行)",children:J?"派发中…":"派发"}):O?.readyStatus==="todo"?(0,n.jsxs)("span",{title:`执行状态:${(b[O?.execStatus??"not_started"]??b.not_started).label}`,style:{display:"flex",alignItems:"center",gap:4,fontSize:11,fontWeight:600,color:(b[O?.execStatus??"not_started"]??b.not_started).color,whiteSpace:"nowrap"},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",background:(b[O?.execStatus??"not_started"]??b.not_started).color,...O?.execStatus==="running"?{animation:"pulse-dot 1.6s ease-in-out infinite"}:{}}}),(b[O?.execStatus??"not_started"]??b.not_started).label]}):null,$&&(0,n.jsx)("button",{type:"button",style:j,onClick:H,title:"定位到该任务的执行会话卡",children:"会话"}),D?null:ep?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",style:j,onClick:()=>{I&&(U({...I.card}),Y(s(I.links,"prerequisite")),G(s(I.links,"related")),es(null),Z(null),et(null))},title:"撤销本次编辑",children:"取消"}),(0,n.jsx)("button",{type:"button",style:j,disabled:J,onClick:()=>void eu(),title:"完成(保存)",children:J?"保存中…":"完成"})]}):null]})]}),(0,n.jsx)("div",{style:{flex:1,minHeight:0,display:"flex"},children:(0,n.jsx)("div",{className:"[scrollbar-width:none]",style:{flex:"1 1 auto",minWidth:0,overflowY:"auto",padding:"10px 12px",display:"flex",flexDirection:"column"},onPointerDown:e=>{0===e.button&&e.stopPropagation()},onPointerUp:e=>{0===e.button&&e.stopPropagation()},onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:eb})})]})})}let j={border:"none",background:"color-mix(in srgb, var(--border) 30%, transparent)",color:"var(--text-muted)",borderRadius:5,padding:"2px 10px",fontSize:11,cursor:"pointer",whiteSpace:"nowrap"};function S({title:e,open:t,onToggle:r,children:o}){return(0,n.jsxs)("div",{children:[(0,n.jsxs)("button",{type:"button",onClick:r,style:{display:"flex",alignItems:"center",gap:4,width:"100%",marginTop:10,padding:"5px 0 3px",border:"none",borderTop:"1px solid var(--bubble-hairline)",background:"transparent",color:"var(--text-muted)",fontSize:11,fontWeight:600,cursor:"pointer",textAlign:"left"},children:[(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,transform:t?"rotate(90deg)":"none",transition:"transform 0.12s"},children:(0,n.jsx)("polyline",{points:"3 2 6.5 5 3 8"})}),e]}),t&&(0,n.jsx)("div",{children:o})]})}function C({due:e,onChange:t}){let r=new Date,o=e?new Date(e):r,[i,a,s]=[o.getFullYear(),o.getMonth()+1,o.getDate()],l=[];for(let e=r.getFullYear()-2;e<=r.getFullYear()+3;e++)l.push(String(e));let c=Array.from({length:12},(e,t)=>String(t+1)),u=new Date(i,a,0).getDate(),p=Array.from({length:u},(e,t)=>String(t+1)),h=(e,r,n)=>{let o=new Date(e,r-1,n,0,0,0,0).getTime();t(Number.isNaN(o)?null:o)};return(0,n.jsxs)("div",{style:{display:"flex",gap:4},children:[(0,n.jsx)("div",{style:{flex:1.4,minWidth:0},children:(0,n.jsx)(d,{value:String(i),options:l.map(e=>({value:e,label:e})),onChange:e=>h(Number(e),a,Math.min(s,u))})}),(0,n.jsx)("div",{style:{flex:1,minWidth:0},children:(0,n.jsx)(d,{value:String(a),options:c.map(e=>({value:e,label:`${e}月`})),onChange:e=>h(i,Number(e),Math.min(s,new Date(i,Number(e),0).getDate()))})}),(0,n.jsx)("div",{style:{flex:1,minWidth:0},children:(0,n.jsx)(d,{value:String(s),options:p.map(e=>({value:e,label:e})),onChange:e=>h(i,a,Number(e))})})]})}},41264:(e,t,r)=>{r.d(t,{QQ:()=>h});var n=r(95155),o=r(12115),i=r(23312),a=r(32316),s=r(71309),l=r(91897),d=r(87278);let c={blue:"#3184f8",green:"#10b981",red:"#ef4444",yellow:"#f59e0b",purple:"#8b5cf6"},u={blue:"蓝",green:"绿",red:"红",yellow:"黄",purple:"紫"},p={text:i.T.string,w:i.T.number,h:i.T.number,badge:i.T.string.optional(),createdAt:i.T.number.optional()};class h extends i.A8{static{this.type="sticky-note"}static{this.props=p}getDefaultProps(){return{text:"",w:338,h:230,badge:"blue",createdAt:Date.now()}}canEdit(){return!0}canResize(){return!0}canScroll(){return!0}hideRotateHandle(){return!0}onResize(e,t){return(0,i.mfH)(e,t,{minWidth:182,minHeight:115})}getIndicatorPath(e){let{w:t,h:r}=e.props,n=new Path2D;return n.roundRect(0,0,t,r,12),n}component(e){return(0,n.jsx)(x,{shape:e})}}function x({shape:e}){let t,r,{w:p,h,text:f}=e.props,b=(0,i.hGv)(),v=(0,d.G)(b,e.id,"var(--assistant-card-glass)"),{highlightId:y}=(0,s.kz)(),m=y===e.id,w=(0,i.hau)("editing",()=>b.getEditingShapeId()===e.id,[b,e.id]),k=(0,o.useCallback)(e=>{0===e.button&&e.stopPropagation()},[]),j=(0,o.useCallback)(t=>{t.stopPropagation(),b.getEditingShapeId()!==e.id&&b.select(e.id)},[b,e.id]),S=(0,o.useCallback)(t=>{t.stopPropagation(),b.setEditingShape(e.id)},[b,e.id]),[C]=(0,o.useState)(()=>e.props.createdAt??Date.now()),R=e.props.badge??"blue",[I,E]=(0,o.useState)(f),L=(0,o.useRef)(f),[T,W]=(0,o.useState)(R),z=(0,o.useRef)(null),P=(0,o.useRef)(null),M=(0,o.useRef)(!1),D=(0,o.useRef)(!1),[$,H]=(0,o.useState)(!1),A=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=e=>{if(!e)return;let t=t=>{t.ctrlKey||t.metaKey||e.scrollHeight>e.clientHeight&&t.stopPropagation()};return e.addEventListener("wheel",t),()=>e.removeEventListener("wheel",t)},t=e(z.current),r=e(P.current);return()=>{t?.(),r?.()}}),(0,o.useEffect)(()=>{let e=P.current;if(!e)return;let t=e=>{let t=window.getSelection();t&&t.toString().length>0&&e.stopPropagation()};return e.addEventListener("copy",t),()=>e.removeEventListener("copy",t)});let B=(0,o.useCallback)(t=>{t.stopPropagation();let r=P.current?.querySelector(".markdown-body")?.innerText??e.props.text;navigator.clipboard.writeText(r).then(()=>{H(!0),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>H(!1),1200)}).catch(()=>{try{let e=document.createElement("textarea");e.value=r,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),H(!0),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>H(!1),1200)}catch{}})},[e.props.text]);(0,o.useEffect)(()=>()=>{A.current&&clearTimeout(A.current)},[]),(0,o.useEffect)(()=>{w&&(E(f),L.current=f,W(R),requestAnimationFrame(()=>z.current?.focus()))},[w,f,R]);let F=(0,o.useCallback)(()=>{let t=L.current;(t!==e.props.text||T!==R)&&b.updateShapes([{id:e.id,type:"sticky-note",props:{text:t,badge:T}}])},[b,e.id,e.props.text,R,T]);(0,o.useEffect)(()=>{w||!D.current||M.current||F(),M.current=!1,D.current=w},[w,F]);let N=(0,o.useCallback)(()=>{b.setEditingShape(null)},[b]),O=(0,o.useCallback)(()=>{M.current=!0,b.setEditingShape(null)},[b]),U={position:"relative",width:p,height:h,borderRadius:"var(--bubble-radius, 12px)",border:m?"2px solid var(--accent)":"1px solid var(--bubble-border)",background:"transparent",boxShadow:m?s.u:"0 2px 10px -6px rgba(0,0,0,0.2)",animation:m?"board-search-glow 1.8s ease-out forwards":void 0,color:"var(--text)",display:"flex",flexDirection:"column",overflow:"hidden",fontSize:13,lineHeight:1.5,pointerEvents:"all",userSelect:"none"};return w?(0,n.jsx)(i.hDc,{"data-testid":`sticky-note-${e.id}`,style:{width:p,height:h,pointerEvents:"none"},children:(0,n.jsxs)("div",{ref:v,style:U,children:[(0,n.jsxs)("div",{onPointerDown:e=>e.stopPropagation(),style:{flexShrink:0,height:32,display:"flex",alignItems:"center",gap:6,padding:"0 var(--bubble-pad-x, 12px)",fontSize:10,color:"var(--text-muted)",boxSizing:"border-box"},children:[(0,n.jsx)(l.i,{kind:"note",color:c[T]??c.blue}),(0,n.jsx)("div",{style:{display:"flex",alignItems:"center",gap:5},children:Object.entries(c).map(([e,t])=>(0,n.jsx)("button",{type:"button",title:`徽记\xb7${u[e]??e}`,onClick:t=>{t.stopPropagation(),W(e)},style:{width:14,height:14,padding:0,border:"none",borderRadius:"50%",background:t,cursor:"pointer",boxShadow:T===e?`0 0 0 2px var(--bg-panel), 0 0 0 3.5px ${t}`:`0 0 0 1px color-mix(in srgb, ${t} 45%, transparent)`,opacity:T===e?1:.72}},e))}),(0,n.jsx)("div",{style:{flex:1}}),(0,n.jsx)("button",{type:"button",onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),O()},style:g,title:"放弃变更 (Esc)",children:"取消"}),(0,n.jsx)("button",{type:"button",onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),N()},style:g,title:"完成 (Ctrl+Enter)",children:"完成"})]}),(0,n.jsx)("textarea",{ref:z,value:I,onChange:e=>{E(e.target.value),L.current=e.target.value},onKeyDown:e=>{e.stopPropagation(),"Enter"===e.key&&(e.ctrlKey||e.metaKey)?(e.preventDefault(),N()):"Escape"===e.key&&(e.preventDefault(),O())},onPointerDown:e=>{0===e.button&&e.stopPropagation()},spellCheck:!1,placeholder:"Markdown 便笺…",className:"sticky-note-input",style:{flex:1,minHeight:0,resize:"none",border:"none",outline:"none",background:"transparent",color:"var(--text)",fontFamily:"var(--font-mono)",fontSize:14,lineHeight:1.7,padding:"var(--bubble-pad-y, 8px) var(--bubble-pad-x, 12px)"}})]})}):(0,n.jsx)(i.hDc,{"data-testid":`sticky-note-${e.id}`,onPointerDown:()=>b.bringToFront([e.id]),style:{width:p,height:h,pointerEvents:"none"},children:(0,n.jsxs)("div",{ref:v,style:U,children:[(0,n.jsxs)("div",{style:{flexShrink:0,height:32,display:"flex",alignItems:"center",gap:6,padding:"0 var(--bubble-pad-x, 12px)",fontSize:10,color:"var(--text-muted)",cursor:"grab",boxSizing:"border-box"},children:[(0,n.jsx)(l.i,{kind:"note",color:c[R]??c.blue}),(0,n.jsx)("div",{style:{flex:1}}),(0,n.jsx)("span",{style:{fontFamily:"var(--font-mono)",whiteSpace:"nowrap"},children:(t=new Date(C),r=new Date,t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):`${t.getMonth()+1}/${t.getDate()}`)}),(0,n.jsx)("button",{type:"button",title:$?"已复制":"复制内容",onClick:B,onPointerDown:e=>e.stopPropagation(),style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",width:22,height:20,padding:0,border:"none",borderRadius:5,background:"transparent",color:$?"var(--accent)":"var(--text-dim)",cursor:"pointer",pointerEvents:"all"},children:$?(0,n.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M20 6L9 17l-5-5"})}):(0,n.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),(0,n.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),(0,n.jsx)("div",{ref:P,style:{flex:1,minHeight:0,overflowY:"auto",padding:"4px var(--bubble-pad-x, 12px) var(--bubble-pad-y, 8px)",textAlign:"left"},children:f.trim()?(0,n.jsx)("div",{className:"markdown-body",onPointerDown:k,onPointerUp:k,onClick:j,onDoubleClick:S,style:{wordBreak:"break-word",cursor:"text"},children:(0,n.jsx)(a.oz,{children:f})}):(0,n.jsx)("div",{onClick:j,onDoubleClick:S,style:{color:"var(--text-dim)",fontSize:12,cursor:"text"},children:"双击编辑 markdown"})})]})})}let g={border:"none",background:"color-mix(in srgb, var(--border) 30%, transparent)",color:"var(--text-muted)",borderRadius:5,padding:"2px 10px",fontSize:11,cursor:"pointer"}},64536:(e,t,r)=>{r.d(t,{C6:()=>b,ZI:()=>h,eo:()=>x});var n=r(12115),o=r(23312),i=r(17357),a=r(93647),s=r(15934),l=r(24456),d=r(82264),c=r(41264),u=r(26479),p=r(41463);let h=340,x=160,g=p.env.NEXT_PUBLIC_SYNC_WS??`${"https:"===window.location.protocol?"wss":"ws"}://${window.location.host}`,f=[...o.Ats,d.V,c.QQ,u.o_];function b({boardId:e,taskId:t,newSessionCwd:r}){let[d,c]=(0,n.useState)(null),[u,p]=(0,n.useState)(null),[y,m]=(0,n.useState)(!1),w=(0,n.useRef)(null),k=(0,n.useRef)(e);k.current=e;let j=d?.taskId??null,S=t??j,C=(0,n.useRef)(S);C.current=S;let R=(0,n.useRef)(r);R.current=r;let I=(0,n.useMemo)(()=>`${g}/connect/${encodeURIComponent(e)}`,[e]),E=(0,i.pX)({uri:I,assets:a.AWg,shapeUtils:f}),L=(0,n.useCallback)(async()=>{try{let t=await fetch(`/api/boards/${encodeURIComponent(e)}`,{cache:"no-store"});if(!t.ok)return void p(`HTTP ${t.status}`);let r=await t.json();c(r.board)}catch(e){p(e instanceof Error?e.message:String(e))}},[e]);(0,n.useEffect)(()=>{L()},[L]);let[T,W]=(0,n.useState)(()=>globalThis.__piRunningSnapshot??null),z=(0,n.useCallback)(e=>{globalThis.__piRunningSnapshot=e,W(e)},[]),P=(0,n.useRef)(!1),M=(0,n.useRef)(0),D=(0,n.useRef)(new Set),$=(0,n.useRef)(async()=>{});(0,n.useEffect)(()=>{let e=!1,t=null,r=async()=>{if(!e&&!P.current&&"visible"===document.visibilityState){P.current=!0;try{let t=await fetch("/api/agent/running",{cache:"no-store"});if(!t.ok)return;let r=await t.json();if(e)return;z(r);let n=w.current;if(!n)return;let o=[];for(let e of n.getCurrentPageShapes())if("session-card"===e.type){let t=e.props;if(!t.sessionId)continue;let n=r.states[t.sessionId],i=r.runningSessionIds.includes(t.sessionId);if(i&&n){let r=n.phase??"waiting_model",i=n.startedAt?Date.now()-n.startedAt:0;(t.phase!==r||t.runningMs!==i||0!==t.endedAt)&&o.push({id:e.id,type:"session-card",props:{phase:r,runningMs:i,endedAt:0}})}else i||"idle"===t.phase||o.push({id:e.id,type:"session-card",props:{phase:"idle",runningMs:0,endedAt:0}})}else if("task-card"===e.type){let t=e.props;if(!t.cardId)continue;let n=r.taskCards?.find(e=>e.cardId===t.cardId&&e.boardId===k.current);n&&n.execStatus!==t.execStatus&&o.push({id:e.id,type:"task-card",props:{execStatus:n.execStatus}})}o.length>0&&n.updateShapes(o);let i=D.current,a=(r.taskCards??[]).some(e=>e.boardId===k.current&&"running"===e.execStatus&&!i.has(e.cardId));for(let e of r.taskCards??[])i.add(e.cardId);a&&Date.now()-M.current>2e3&&(M.current=Date.now(),$.current())}catch{}finally{P.current=!1}}},n=()=>{e||(t=setTimeout(async()=>{await r(),n()},2500))};r(),n();let o=()=>{"visible"===document.visibilityState&&r()};return document.addEventListener("visibilitychange",o),()=>{e=!0,t&&clearTimeout(t),document.removeEventListener("visibilitychange",o)}},[z]);let[H,A]=(0,n.useState)({}),B=(0,n.useRef)({});B.current=H;let F=(0,n.useRef)(!1),N=(0,n.useCallback)(async()=>{if(!F.current){F.current=!0;try{let e=await fetch("/api/sessions",{cache:"no-store"});if(!e.ok)return;let t=await e.json(),r={};for(let e of t.sessions)r[e.id]={title:e.name??e.firstMessage??"Untitled",messageCount:e.messageCount??0,projectName:e.projectKey??e.projectRoot??"",lastReply:e.lastReply??"",lastActivityAt:e.modified?Date.parse(e.modified):0};A(r)}catch{}finally{F.current=!1}}},[]);(0,n.useEffect)(()=>{let e,t=!1,r=async()=>{await N(),t||(e=setTimeout(r,1e4))};r();let n=()=>{"visible"===document.visibilityState&&(e&&clearTimeout(e),r())};return document.addEventListener("visibilitychange",n),()=>{t=!0,e&&clearTimeout(e),document.removeEventListener("visibilitychange",n)}},[N]),(0,n.useEffect)(()=>{let e=w.current;if(!e||!y||0===Object.keys(H).length)return;let t=[];for(let r of e.getCurrentPageShapes()){if("session-card"!==r.type)continue;let e=r.props,n=H[e.sessionId];n&&(e.title!==n.title||e.lastReply!==n.lastReply||e.messageCount!==n.messageCount||e.lastActivityAt!==n.lastActivityAt)&&t.push({id:r.id,type:"session-card",props:{title:n.title,lastReply:n.lastReply,messageCount:n.messageCount,lastActivityAt:n.lastActivityAt}})}t.length>0&&e.updateShapes(t)},[H,y]);let O=(0,n.useCallback)(e=>{w.current=e,m(!0);let t=e.deleteShapes.bind(e);e.deleteShapes=r=>{let n=Array.isArray(r)?r:[r],o=[],i=[],a=[];for(let t of n){let r="string"==typeof t?t:t.id,n=e.getShape(r);if(!n){o.push(r);continue}if("arrow"===n.type){let e=n.meta;if(e?.taskLinkLabel||e?.execLinkLabel)continue;o.push(r);continue}if("session-card"===n.type){let e=n.props;e.sessionId&&!e.cwd?i.push({sid:e.sessionId,shapeId:r}):o.push(r);continue}if("task-card"===n.type){let e=n.props.cardId;e?a.push({cid:e,shapeId:r}):o.push(r);continue}o.push(r)}if(i.length>0||a.length>0){let t;return t=i.length>0&&a.length>0?`删除 ${i.length} 个会话和 ${a.length} 张任务卡?
2
2
  将同时清理画布卡片与关联关系。此操作不可撤销。`:i.length>1?`删除 ${i.length} 个会话?
3
3
  将同时删除画布卡片并断开任务卡关联。此操作不可撤销。`:1===i.length?"删除该会话?\n将同时删除画布卡片并断开任务卡关联。此操作不可撤销。":a.length>1?`删除 ${a.length} 张任务卡?
4
4
  将删除卡/依赖线/执行会话连线;关联的执行会话保留。`:"删除该任务卡?\n将删除任务卡、依赖线与执行会话连线;关联的执行会话保留。此操作不可撤销。",(0,l.l)({message:t}).then(t=>{if(!t)return;let r=[...i.map(e=>e.shapeId),...a.map(e=>e.shapeId)],n=new Set;for(let t of r)for(let r of e.getBindingsInvolvingShape(t,"arrow"))n.add(r.fromId);for(let t of(e.store.remove([...r,...n,...o]),i))fetch(`/api/sessions/${encodeURIComponent(t.sid)}`,{method:"DELETE"}).then(()=>(0,s.Qp)(t.sid)).catch(e=>console.warn(`[board] 删除会话 ${t.sid} 异常`,e));for(let e of a)fetch(`/api/task-cards/${encodeURIComponent(e.cid)}`,{method:"DELETE"}).catch(t=>console.warn(`[board] 删除任务卡 ${e.cid} 异常`,t))}),e}return o.length>0&&t(o),e}},[]),U=(0,n.useCallback)(e=>{let t=e.getCurrentPageShapes().filter(e=>"session-card"===e.type).map(e=>({x:e.x,y:e.y,w:e.props.w||h,h:e.props.h||x})),r=(e,r)=>t.some(t=>e<t.x+t.w+24&&e+h+24>t.x&&r<t.y+t.h+24&&r+x+24>t.y),n=60,o=0;for(;o<2e3;){for(let e=0;e<4;e+=1){let t=60+e*(h+24);if(!r(t,n))return{x:t,y:n}}n+=x+24,o+=1}return{x:60+120*Math.random(),y:60+120*Math.random()}},[]),_=(0,n.useCallback)((e,t)=>{let r=x+24,n=h+24,o=e.getCurrentPageShapes().filter(e=>"arrow"!==e.type&&e.id!==t.id).map(e=>({x:e.x,y:e.y,w:e.props.w??h,h:e.props.h??x})),i=(e,t)=>o.some(r=>e<r.x+r.w+24&&e+h+24>r.x&&t<r.y+r.h+24&&t+x+24>r.y),a=t.x+t.w+24;for(let e=0;e<80;e+=1){let n=t.y+e*r;if(!i(a,n))return{x:a,y:n}}let s=t.y+t.h+24;for(let e=0;e<40;e+=1){let r=t.x+e*n;if(!i(r,s))return{x:r,y:s}}return{x:t.x+t.w+24,y:t.y+t.h+24}},[]),Y=(0,n.useRef)(!1),K=(0,n.useCallback)(async()=>{let e=w.current;if(!e||Y.current)return;let t=C.current,r=k.current;if(t){Y.current=!0;try{var n,i,a,s,l,d,c,u,p;let[g,f]=await Promise.all([fetch(`/api/tasks/${encodeURIComponent(t)}`,{cache:"no-store"}).catch(()=>null),fetch(`/api/task-cards?boardId=${encodeURIComponent(r)}`,{cache:"no-store"}).catch(()=>null)]);if(!g?.ok||!f?.ok)return;let b=await g.json(),y=await f.json(),m=e.getCurrentPageShapes(),w=new Map,k=new Map;for(let e of m){if("session-card"!==e.type)continue;let t=e.props.sessionId;t&&(w.set(t,e.id),k.set(t,e.id))}let j=new Set(b.task?.sessionIds??[]),S=[];for(let[t,r]of w){if(j.has(t))continue;let n=e.getShape(r);n&&n.props.cwd||S.push(r)}if(S.length>0&&e.store.remove(S),!m.some(e=>"session-card"===e.type&&e.props.cwd&&e.props.taskId===t)){let t=(()=>{for(let e of m)if("task-card"===e.type&&e.props.cardId){let t=e.props;return{id:e.id,x:e.x,y:e.y,w:t.w??380,h:t.h??240}}return null})();for(let r of j){if(w.has(r))continue;let n=B.current[r],i=t?_(e,t)??U(e):U(e);e.createShape({id:(0,o.n6Y)(`session-${r}`),type:"session-card",x:i.x,y:i.y,props:{sessionId:r,title:n?.title??"Untitled",projectName:n?.projectName??"",messageCount:n?.messageCount??0,lastReply:n?.lastReply??"",lastActivityAt:n?.lastActivityAt??0,phase:"idle",runningMs:0,endedAt:0,stale:!1,expanded:!1,w:h,h:x}})}}let C=new Map;for(let e of m)if("task-card"===e.type){let t=e.props.cardId;t&&C.set(t,e.id)}let R=new Map;for(let t of m){if("arrow"!==t.type)continue;let r=t.meta;if(!r?.execLinkLabel)continue;let n=e.getBindingsInvolvingShape(t.id,"arrow"),o="",i="";for(let e of n){let t=e.props.terminal;"start"===t&&(o=e.toId),"end"===t&&(i=e.toId)}if(o){let e=R.get(o)??[];e.push({to:i,arrowId:t.id}),R.set(o,e)}}for(let t of y.cards){let r=C.get(t.id);if(!r)continue;let o=t.sessionId?k.get(t.sessionId):null,d=R.get(r)??[];for(let t of d)t.to!==o&&e.deleteShapes([t.arrowId]);!o||d.some(e=>e.to===o)||(n=e,i=r,a=o,s=t.id,l=t.sessionId,v(n,i,a,`exec-${s}-${l}`,{execLinkLabel:"exec"},!0))}let I=new Map;for(let t of m){if("arrow"!==t.type)continue;let r=t.meta;if(!r?.taskLinkLabel)continue;let n=e.getBindingsInvolvingShape(t.id,"arrow"),o="",i="";for(let e of n){let t=e.props.terminal;"start"===t&&(o=e.toId),"end"===t&&(i=e.toId)}o&&i&&I.set(`${o}->${i}:${r.taskLinkLabel}`,t.id)}let E=new Set;for(let t of y.cards){let r=C.get(t.id);if(r)for(let n of t.links??[]){let t=C.get(n.targetCardId);if(!t)continue;let o=`${r}->${t}:${n.kind}`;E.add(o),I.has(o)||(d=e,c=r,u=t,p=n.kind,v(d,c,u,`link-${c}-${u}-${p}`,{taskLinkLabel:p},!1))}}for(let[t,r]of I)E.has(t)||e.deleteShapes([r])}catch{}finally{Y.current=!1}}},[U,_]);(0,n.useEffect)(()=>{$.current=K},[K]),(0,n.useEffect)(()=>{let e;if(!S)return;let t=!1,r=async()=>{await K(),t||(e=setTimeout(r,1e4))},n=setTimeout(()=>void r(),1200),o=()=>{"visible"===document.visibilityState&&(e&&clearTimeout(e),r())};return document.addEventListener("visibilitychange",o),()=>{t=!0,e&&clearTimeout(e),clearTimeout(n),document.removeEventListener("visibilitychange",o)}},[S,y,K]);let G=(0,n.useRef)(0),q=(0,n.useCallback)(()=>{let e=w.current;if(!e)return;let t=e.getViewportPageBounds(),r=t.minX+(t.width-840)/2,n=t.minY+(t.height-600)/2;600>t.height&&(n=t.minY+16),840>t.width&&(r=t.minX+16);let i=G.current%3*24;G.current+=1;let a=crypto.randomUUID();e.createShape({id:(0,o.n6Y)(),type:"session-card",x:r+i,y:n+i,props:{sessionId:a,title:"",projectName:"",messageCount:0,lastReply:"",phase:"idle",runningMs:0,endedAt:0,lastActivityAt:0,stale:!1,expanded:!0,cwd:R.current??"",taskId:C.current??"",w:840,h:600}})},[]),J=(0,n.useCallback)((e,t,r)=>{let n=w.current;if(!n)return;let i=B.current[e];n.createShape({id:(0,o.n6Y)(`session-${e}`),type:"session-card",x:t,y:r,props:{sessionId:e,title:i?.title??"Untitled",projectName:i?.projectName??"",messageCount:i?.messageCount??0,lastReply:i?.lastReply??"",lastActivityAt:i?.lastActivityAt??0,phase:"idle",runningMs:0,endedAt:0,stale:!1,expanded:!1,w:h,h:x}})},[]),V=(0,n.useCallback)(async()=>{let e=w.current;if(!e)return;let t=!!C.current,r=e.getCurrentPageShapes(),n=t?r.filter(e=>"session-card"!==e.type).map(e=>e.id):r.map(e=>e.id);n.length>0&&e.deleteShapes(n),t&&K()},[K]),X="synced-remote"!==E.status;return(0,n.useMemo)(()=>({board:d,loading:X,error:u,running:T,runningCount:T?.runningSessionIds.length??0,editor:y?w.current:null,syncStore:E,onMount:O,addSessionNode:J,addNewSessionCard:q,clearBoard:V,sessionTitles:H,loadSessionSummaries:N,reloadCanvas:L}),[d,X,u,T,y,E,O,J,q,V,H,N,L])}function v(e,t,r,n,i,a){let s=(0,o.n6Y)(n);e.createShape({id:s,type:"arrow",x:0,y:0,meta:i,props:{start:{x:0,y:0},end:{x:0,y:0},color:"blue",fill:"none",dash:a?"dashed":"solid",arrowheadStart:"none",arrowheadEnd:"arrow",labelColor:"black",font:"sans",richText:{type:"doc",content:[]},scale:1,size:"m",bend:0,kind:"elbow",labelPosition:.5,elbowMidPoint:.5}}),e.createBindings([{type:"arrow",fromId:s,toId:t,props:{terminal:"start",isPrecise:!1,isExact:!1,normalizedAnchor:{x:.5,y:.5},snap:"none"}},{type:"arrow",fromId:s,toId:r,props:{terminal:"end",isPrecise:!1,isExact:!1,normalizedAnchor:{x:.5,y:.5},snap:"none"}}])}},71309:(e,t,r)=>{r.d(t,{eR:()=>s,kz:()=>l,u:()=>i});var n=r(95155),o=r(12115);let i="0 0 0 3px var(--accent), 0 0 24px color-mix(in srgb, var(--accent) 45%, transparent)",a=(0,o.createContext)(null);function s({children:e}){let[t,r]=(0,o.useState)(null),i=(0,o.useRef)(null),l=(0,o.useCallback)(e=>{i.current&&clearTimeout(i.current),i.current=null,r(e),e&&(i.current=setTimeout(()=>r(null),1800))},[]);return(0,o.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]),(0,n.jsx)(a.Provider,{value:{highlightId:t,setHighlight:l},children:e})}function l(){let e=(0,o.useContext)(a);return e||{highlightId:null,setHighlight:()=>{}}}},82264:(e,t,r)=>{r.d(t,{V:()=>E});var n=r(95155),o=r(23312),i=r(12115),a=r(47650),s=r(60015),l=r(39247);function d({stats:e,contextUsage:t}){if(!e)return null;let r=e.tokens,o=e.cost??0,i=e=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}k`:String(e),a=o>0?o>=.01?`$${o.toFixed(2)}`:"<$0.01":null,s="var(--text-muted)",l=null;if(t?.contextWindow){let e=t.percent;null!==e&&e>90?s="#ef4444":null!==e&&e>70&&(s="rgba(234,179,8,0.95)"),l=null!==e?`${e.toFixed(0)}% / ${i(t.contextWindow)}`:`? / ${i(t.contextWindow)}`}let c={display:"flex",alignItems:"center",gap:4,flexShrink:0};return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0,fontSize:11,color:"var(--text-muted)",whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:[r.input>0&&(0,n.jsxs)("span",{style:c,children:[(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("line",{x1:"5",y1:"8.5",x2:"5",y2:"1.5"}),(0,n.jsx)("polyline",{points:"2 4 5 1.5 8 4"})]}),i(r.input)]}),r.output>0&&(0,n.jsxs)("span",{style:c,children:[(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("line",{x1:"5",y1:"1.5",x2:"5",y2:"8.5"}),(0,n.jsx)("polyline",{points:"2 6 5 8.5 8 6"})]}),i(r.output)]}),r.cacheRead>0&&(0,n.jsxs)("span",{style:c,children:[(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M8.5 5a3.5 3.5 0 1 1-1-2.45"}),(0,n.jsx)("polyline",{points:"6.5 1.5 8.5 2.5 7.5 4.5"})]}),i(r.cacheRead)]}),a&&(0,n.jsx)("span",{style:{display:"flex",alignItems:"center",color:"var(--text)",fontWeight:500,flexShrink:0},children:a}),l&&(0,n.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:4,color:s,flexShrink:0},children:[(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M1 9 L1 5 Q1 1 5 1 Q9 1 9 5 L9 9"}),(0,n.jsx)("line",{x1:"1",y1:"9",x2:"9",y2:"9"})]}),l]})]})}let c=(0,i.forwardRef)(function({sessionId:e,stats:t,contextUsage:r,todos:o},a){let{t:s}=(0,l.s)(),[d,c]=(0,i.useState)(!1),[y,m]=(0,i.useState)(!1),w=(0,i.useRef)(null),k=(0,i.useRef)(null),j=(0,i.useRef)(null);(0,i.useImperativeHandle)(a,()=>({openStats:()=>{c(!0),m(!1)}}),[]);let S=e=>{c("stats"===e),m("todo"===e)},C=(0,i.useCallback)(()=>{window.open(`/api/sessions/${encodeURIComponent(e)}/export?inline=1`,"_blank","noopener,noreferrer")},[e]),R=r?.contextWindow&&null!==r.percent?`${r.percent.toFixed(0)}% / ${f(r.contextWindow)}`:s("nav.stats"),I=o.filter(e=>"completed"!==e.status).length,E=(0,i.useCallback)(()=>{let e=w.current?.closest("[data-session-titlebar]"),t=e?.getBoundingClientRect().width;return t||(w.current?.closest(".tl-html-container")?.getBoundingClientRect().width??300)},[]),L=d||y;return(0,i.useEffect)(()=>{if(!L)return;let e=e=>{let t=e.target;t instanceof Node&&(w.current?.contains(t)||document.querySelector("[data-session-nav-popover]")?.contains(t)||document.querySelector("[data-session-nav-todo]")?.contains(t)||document.querySelector(".glass-top-panel")?.contains(t))||(c(!1),m(!1))},t=e=>{"Escape"===e.key&&(c(!1),m(!1))};return document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",t,!0),()=>{document.removeEventListener("pointerdown",e,!0),document.removeEventListener("keydown",t,!0)}},[L]),(0,n.jsxs)("div",{ref:w,style:{display:"flex",alignItems:"center",gap:2,padding:"0 4px",position:"relative",pointerEvents:"all",height:"100%"},children:[(0,n.jsxs)("button",{type:"button",onClick:C,title:s("history.full"),"aria-label":s("history.full"),style:u,onMouseEnter:e=>{e.currentTarget.style.color="var(--text)",e.currentTarget.style.background=x},onMouseLeave:e=>{e.currentTarget.style.color="var(--text-muted)",e.currentTarget.style.background="transparent"},children:[(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),(0,n.jsx)("path",{d:"M3 3v5h5"}),(0,n.jsx)("path",{d:"M12 7v5l3 2"})]}),(0,n.jsx)("span",{style:p,children:s("history.full")})]}),(0,n.jsx)("span",{style:h}),(0,n.jsxs)("button",{ref:k,type:"button",onClick:()=>S(d?"none":"stats"),title:s("session.title"),"aria-label":s("session.title"),"aria-expanded":d,style:{...u,background:d?g:"transparent",color:d?"var(--accent)":"var(--text-muted)"},onMouseEnter:e=>{d||(e.currentTarget.style.color="var(--text)",e.currentTarget.style.background=x)},onMouseLeave:e=>{d||(e.currentTarget.style.color="var(--text-muted)",e.currentTarget.style.background="transparent")},children:[(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("line",{x1:"12",y1:"20",x2:"12",y2:"10"}),(0,n.jsx)("line",{x1:"18",y1:"20",x2:"18",y2:"4"}),(0,n.jsx)("line",{x1:"6",y1:"20",x2:"6",y2:"16"})]}),(0,n.jsx)("span",{style:p,children:R})]}),o.length>0&&(0,n.jsxs)("button",{ref:j,type:"button",onClick:()=>S(y?"none":"todo"),title:s("todo.title"),"aria-label":s("todo.title"),"aria-expanded":y,style:{...u,background:y?g:"transparent",color:y?"var(--accent)":"var(--text-muted)"},onMouseEnter:e=>{y||(e.currentTarget.style.color="var(--text)",e.currentTarget.style.background=x)},onMouseLeave:e=>{y||(e.currentTarget.style.color="var(--text-muted)",e.currentTarget.style.background="transparent")},children:[(0,n.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("rect",{x:"3",y:"4",width:"18",height:"16",rx:"3"}),(0,n.jsx)("path",{d:"M8 9h8M8 13h5"})]}),(0,n.jsx)("span",{style:p,children:s("nav.todo")}),(0,n.jsx)("span",{style:{fontSize:10,fontWeight:700,color:"var(--text-muted)"},children:I>0?I:"✓"})]}),d&&t&&(0,n.jsx)(b,{navRef:w,navWidth:E(),stats:t,contextUsage:r,onClose:()=>c(!1)}),y&&o.length>0&&(0,n.jsx)(v,{navRef:w,navWidth:E(),todos:o,onClose:()=>m(!1)})]})}),u={flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",gap:4,width:"auto",height:26,padding:"0 6px",border:"none",borderRadius:6,background:"transparent",color:"var(--text-muted)",cursor:"pointer",transition:"color 0.12s, background 0.12s"},p={fontSize:11,fontWeight:600,lineHeight:1,whiteSpace:"nowrap"},h={flexShrink:0,width:1,height:16,alignSelf:"center",background:"color-mix(in srgb, var(--border) 70%, transparent)",margin:"0 3px"},x="color-mix(in srgb, var(--glass-bg-strong) 40%, transparent)",g="color-mix(in srgb, var(--glass-bg-strong) 60%, transparent)";function f(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}k`:String(e)}function b({navRef:e,navWidth:t,stats:r,contextUsage:o,onClose:s}){let{t:c}=(0,l.s)(),[u,p]=(0,i.useState)(null),h=(0,i.useRef)(null);if((0,i.useEffect)(()=>{let r=()=>{let r=e.current;if(!r)return;let n=r.getBoundingClientRect(),o=r.closest("[data-session-titlebar]"),i=o?.getBoundingClientRect(),a=i?i.left:Math.min(n.right-t,Math.max(8,n.left));p({top:i?i.bottom:n.bottom,left:a})};r();let n=new ResizeObserver(r);return e.current&&n.observe(e.current),e.current?.closest("[data-session-titlebar]")&&n.observe(e.current.closest("[data-session-titlebar]")),window.addEventListener("resize",r),()=>{n.disconnect(),window.removeEventListener("resize",r)}},[e,t]),(0,i.useEffect)(()=>{let t=t=>{let r=t.target;h.current?.contains(r)||e.current?.contains(r)||s()};return document.addEventListener("pointerdown",t,!0),()=>document.removeEventListener("pointerdown",t,!0)},[e,s]),!u)return null;let x=r.totalActiveMs??0,g=[...r.sessionName?[{label:c("session.name"),value:r.sessionName}]:[],{label:c("session.id"),value:r.sessionId},...x>0?[{label:c("session.totalActive"),value:(e=>{if(e<=0)return"0s";let t=Math.floor(e/1e3),r=Math.floor(t/3600),n=Math.floor(t%3600/60),o=t%60;return r>0?`${r}h ${n}m`:n>0?`${n}m ${o}s`:`${o}s`})(x)}]:[]],v=[[c("session.user"),r.userMessages.toLocaleString()],[c("session.assistant"),r.assistantMessages.toLocaleString()],[c("session.toolCalls"),r.toolCalls.toLocaleString()],[c("session.toolResults"),r.toolResults.toLocaleString()],[c("session.total"),r.totalMessages.toLocaleString()]],y=[[c("session.input"),r.tokens.input.toLocaleString()],[c("session.output"),r.tokens.output.toLocaleString()],...r.tokens.cacheRead>0?[[c("session.cacheRead"),r.tokens.cacheRead.toLocaleString()]]:[],...r.tokens.cacheWrite>0?[[c("session.cacheWrite"),r.tokens.cacheWrite.toLocaleString()]]:[],[c("session.total"),r.tokens.total.toLocaleString()],...r.cost>0?[[c("session.cost"),`$${r.cost.toFixed(4)}`]]:[],...r.contextUsage?.contextWindow?[[c("session.context"),`${null!==r.contextUsage.percent?`${r.contextUsage.percent.toFixed(1)}%`:"?"} / ${f(r.contextUsage.contextWindow)}`]]:[]],m=(e,t,r="left",o=!1)=>(0,n.jsxs)("div",{style:{minWidth:0},children:[(0,n.jsx)("div",{style:{fontSize:11,fontWeight:700,color:"var(--text)",marginBottom:6},children:e}),(0,n.jsx)("div",{style:{display:"grid",gridTemplateColumns:o?"max-content minmax(0, 1fr)":"auto minmax(0, 1fr)",columnGap:o?14:12,rowGap:4,justifyContent:o?"start":void 0},children:t.map(([t,o])=>(0,n.jsxs)("div",{style:{display:"contents"},children:[(0,n.jsx)("div",{style:{color:"var(--text-meta)",whiteSpace:"nowrap"},children:t}),(0,n.jsx)("div",{style:{color:"var(--text-muted)",minWidth:0,overflowWrap:"anywhere",textAlign:r,whiteSpace:"normal"},children:o})]},`${e}:${t}`))})]}),w=(0,n.jsx)("div",{ref:h,"data-session-nav-popover":!0,role:"dialog","aria-label":c("session.title"),className:"glass-panel",style:{position:"fixed",top:u.top,left:u.left,width:t,maxHeight:"min(560px, calc(100dvh - 44px))",overflowY:"auto",zIndex:1200,padding:"12px 16px",fontSize:12,lineHeight:1.5,fontFamily:"var(--font-mono)",borderRadius:12,border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)"},children:(0,n.jsxs)("div",{style:{display:"grid",gap:16,fontSize:12,lineHeight:1.5,fontFamily:"var(--font-mono)"},children:[(0,n.jsx)(d,{stats:r,contextUsage:o}),(0,n.jsx)("div",{style:{display:"grid",gridTemplateColumns:"auto minmax(0, 1fr)",columnGap:12,rowGap:8,alignItems:"start"},children:g.map(e=>(0,n.jsxs)("div",{style:{display:"contents"},children:[(0,n.jsx)("div",{style:{color:"var(--text-meta)",whiteSpace:"nowrap"},children:e.label}),(0,n.jsx)("div",{style:{color:"var(--text-muted)",minWidth:0,overflowWrap:"anywhere",wordBreak:"break-word",whiteSpace:"normal"},children:e.value})]},e.label))}),(0,n.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"minmax(160px, 0.5fr) minmax(240px, 0.7fr)",gap:24},children:[m(c("session.messages"),v),m(c("session.tokens"),y,"right",!0)]})]})});return(0,a.createPortal)(w,document.body)}function v({navRef:e,navWidth:t,todos:r,onClose:o}){let{t:s}=(0,l.s)(),[d,c]=(0,i.useState)(null),u=(0,i.useRef)(null);if((0,i.useEffect)(()=>{let r=()=>{let r=e.current;if(!r)return;let n=r.getBoundingClientRect(),o=r.closest("[data-session-titlebar]"),i=o?.getBoundingClientRect(),a=i?i.left:Math.min(n.right-t,Math.max(8,n.left));c({top:i?i.bottom:n.bottom,left:a})};r();let n=new ResizeObserver(r);return e.current&&n.observe(e.current),e.current?.closest("[data-session-titlebar]")&&n.observe(e.current.closest("[data-session-titlebar]")),window.addEventListener("resize",r),()=>{n.disconnect(),window.removeEventListener("resize",r)}},[e,t]),(0,i.useEffect)(()=>{let t=t=>{let r=t.target;u.current?.contains(r)||e.current?.contains(r)||o()};return document.addEventListener("pointerdown",t,!0),()=>document.removeEventListener("pointerdown",t,!0)},[e,o]),!d)return null;let p=(0,n.jsxs)("div",{ref:u,"data-session-nav-todo":!0,role:"menu","aria-label":s("todo.title"),className:"glass-panel",style:{position:"fixed",top:d.top,left:d.left,width:t,maxHeight:"min(440px, calc(100dvh - 44px))",overflowY:"auto",zIndex:1200,fontFamily:"inherit",borderRadius:12,border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)"},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"9px 12px",borderBottom:"1px solid color-mix(in srgb, var(--border) 70%, transparent)",fontSize:12,fontWeight:650,color:"var(--text)"},children:[s("todo.title"),(0,n.jsxs)("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-meta)",fontWeight:500},children:[r.filter(e=>"completed"===e.status).length,"/",r.length," ",s("todo.completed")]})]}),0===r.length?(0,n.jsx)("div",{style:{padding:"12px 14px",fontSize:12,color:"var(--text-muted)",fontStyle:"italic"},children:s("todo.empty")}):(0,n.jsx)("div",{style:{maxHeight:330,overflowY:"auto"},children:r.map(e=>{let t="completed"===e.status,r="high"===e.priority?"#ef4444":"medium"===e.priority?"rgba(234,179,8,0.9)":"var(--text-meta)";return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:8,padding:"7px 12px",borderBottom:"1px solid color-mix(in srgb, var(--border) 45%, transparent)"},children:[(0,n.jsx)("span",{"aria-hidden":"true",style:{flexShrink:0,marginTop:2,width:13,height:13,borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:800,lineHeight:1,color:t?"#fff":"transparent",background:t?"#16a34a":"color-mix(in srgb, var(--border) 70%, transparent)",border:t?"none":"1px solid color-mix(in srgb, var(--border) 80%, transparent)"},children:"✓"}),(0,n.jsx)("span",{style:{flex:1,minWidth:0,fontSize:12,lineHeight:1.4,color:t?"var(--text-meta)":"var(--text)",textDecoration:t?"line-through":"none",wordBreak:"break-word"},children:e.content}),(0,n.jsx)("span",{"aria-hidden":"true",style:{flexShrink:0,marginTop:5,width:7,height:7,borderRadius:"50%",background:r}})]},e.id??e.content)})})]});return(0,a.createPortal)(p,document.body)}var y=r(32782),m=r(15934);function w({sessionId:e,cwd:t,taskId:r}){let{t:d}=(0,l.s)(),{soundEnabled:u,onSoundToggle:p,playDoneSound:h,unlockAudio:x}=(0,y.G)(),g=(0,o.hGv)(),[f,b]=(0,i.useState)(null),[v,j]=(0,i.useState)(null),[S,C]=(0,i.useState)(0),R=(0,i.useRef)(null),I=(0,i.useRef)(null),E=(0,i.useRef)(null),L=!!t,T=(0,i.useRef)(null);T.current=L&&r?{taskId:r}:null;let W=(0,i.useRef)(e),z=(0,i.useRef)(t??null),P=(0,i.useRef)(L),M=(0,i.useRef)(!1),D=(0,i.useRef)(t);(0,i.useEffect)(()=>{let e=D.current;D.current=t,!e||t||P.current&&!M.current&&(P.current=!1,C(e=>e+1))},[t]);let[$,H]=(0,i.useState)(null);(0,i.useEffect)(()=>{let e=R.current?.closest(".tl-html-container"),t=e?.querySelector("[data-session-navbar-slot]")??null;H(e=>e===t?e:t)});let[A,B]=(0,i.useState)(null),[F,N]=(0,i.useState)(null),[O,U]=(0,i.useState)([]),_=(0,i.useCallback)(e=>{B(e)},[]),Y=(0,i.useCallback)(()=>{E.current?.openStats()},[]),K=(0,i.useCallback)(e=>{N(e)},[]),G=(0,i.useCallback)(e=>{U(e)},[]),q=(0,i.useCallback)(e=>{if(!e?.id)return;M.current=!0;let t=R.current?.closest(".tl-html-container"),r=t?.getAttribute("data-node-id");r&&g.updateShapes([{id:`shape:${r}`,type:"session-card",props:{cwd:""}}]),(0,m.PH)(e.id)},[g]),J=(0,i.useCallback)(t=>{(0,m.PK)(e,t)},[e]),V=(0,i.useCallback)(t=>{(0,m.Wd)(e,t)},[e]),X=(0,i.useCallback)(()=>{(0,m.Ho)(e,f?.name)},[e,f?.name]),Q=(0,i.useCallback)(t=>{(0,m.sV)(e,{title:"custom"===t.method?void 0:t.title,method:t.method})},[e]);return((0,i.useEffect)(()=>{let e=R.current;if(!e)return;let t=t=>{if(t.ctrlKey||t.metaKey)return;let r=t.target;r instanceof Node&&e.contains(r)&&function(e,t){let r=e instanceof Element?e:e.parentElement;for(;r&&r instanceof HTMLElement&&r!==t;){let e=r.scrollHeight>r.clientHeight,t=r.scrollWidth>r.clientWidth;if(e||t){let n=getComputedStyle(r),o=n.overflowY,i=n.overflowX;if(e&&("auto"===o||"scroll"===o||"overlay"===o)||t&&("auto"===i||"scroll"===i||"overlay"===i))return!0}r=r.parentElement}return!1}(r,e)&&t.stopPropagation()};return e.addEventListener("wheel",t),()=>{e.removeEventListener("wheel",t)}}),(0,i.useEffect)(()=>{let e=R.current;if(!e)return;let t=e=>{let t=window.getSelection();t&&t.toString().length>0&&e.stopPropagation()};return e.addEventListener("copy",t),()=>e.removeEventListener("copy",t)}),(0,i.useEffect)(()=>{if(L)return;let t=!1;return P.current?(j(null),(async()=>{try{let r=await fetch("/api/sessions",{cache:"no-store"});if(!r.ok)throw Error(`HTTP ${r.status}`);let n=(await r.json()).sessions.find(t=>t.id===e);if(t)return;n&&b(n)}catch(e){console.warn("new session metadata load failed:",e)}})(),()=>{t=!0}):(b(null),j(null),(async()=>{try{let r=await fetch("/api/sessions",{cache:"no-store"});if(!r.ok)throw Error(`HTTP ${r.status}`);let n=(await r.json()).sessions.find(t=>t.id===e);if(t)return;if(!n)return void j(d("boards.sessionMissing"));b(n),C(e=>e+1)}catch(e){t||j(e instanceof Error?e.message:String(e))}})(),()=>{t=!0})},[e,d,L]),v)?(0,n.jsx)("div",{style:k,children:(0,n.jsx)("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"#f87171",fontSize:13},children:v})}):f||L||P.current?(0,n.jsxs)("div",{ref:R,className:"board-workbench",style:k,onPointerDown:e=>{0===e.button&&e.stopPropagation()},onPointerUp:e=>{0===e.button&&e.stopPropagation()},onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:[$&&f&&(0,a.createPortal)((0,n.jsx)(c,{ref:E,sessionId:f.id,stats:A,contextUsage:F,todos:O}),$),(0,n.jsx)(s.l,{session:L||P.current?null:f,newSessionCwd:L||P.current?z.current??null:null,newSessionDraftKey:L||P.current?W.current:null,pendingNewSessionTaskRef:L||P.current?T:void 0,chatInputRef:I,inWorkbench:!0,onSessionStatsChange:_,onContextUsageChange:K,onSessionStatsPanelOpen:Y,onTodosChange:G,onOpenFile:J,onSessionCreated:L?e=>q(e):void 0,onSessionForked:V,onAgentEnd:X,onAttentionNeeded:Q,soundEnabled:u,onSoundToggle:p,playDoneSound:h,unlockAudio:x},S)]}):(0,n.jsx)("div",{style:k,children:(0,n.jsx)("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-muted)",fontSize:13},children:d("boards.loadingSession")})})}let k={display:"flex",flexDirection:"column",width:"100%",height:"100%",overflow:"visible",color:"var(--text)"};var j=r(64536),S=r(87278),C=r(71309),R=r(91897);let I={sessionId:o.T.string,title:o.T.string,projectName:o.T.string,messageCount:o.T.number,lastReply:o.T.string,phase:o.T.string,runningMs:o.T.number,endedAt:o.T.number,lastActivityAt:o.T.number,stale:o.T.boolean,expanded:o.T.boolean,cwd:o.T.string,taskId:o.T.string,w:o.T.number,h:o.T.number,expandedW:o.T.number,expandedH:o.T.number,collapsedW:o.T.number,collapsedH:o.T.number};class E extends o.A8{static{this.type="session-card"}static{this.props=I}getDefaultProps(){return{sessionId:"",title:"Untitled session",projectName:"",messageCount:0,lastReply:"",phase:"idle",runningMs:0,endedAt:0,lastActivityAt:0,stale:!1,expanded:!1,cwd:"",taskId:"",w:280,h:120,expandedW:0,expandedH:0,collapsedW:0,collapsedH:0}}component(e){return(0,n.jsx)(W,{shape:e})}getIndicatorPath(e){let{w:t,h:r}=e.props,n=new Path2D;return n.roundRect(0,0,t,r,14),n}canResize(){return!0}canScroll(){return!0}hideRotateHandle(){return!0}onResize(e,t){let r=e.props.expanded,n=r?600:j.ZI,i=r?500:j.eo;return(0,o.mfH)(e,t,{minWidth:n,minHeight:i})}onDoubleClick(e){return{id:e.id,type:"session-card",props:L(e)}}}function L(e){return e.props.expanded?{expanded:!1,expandedW:e.props.w,expandedH:e.props.h,w:e.props.collapsedW||j.ZI,h:e.props.collapsedH||j.eo}:{expanded:!0,collapsedW:e.props.w,collapsedH:e.props.h,w:e.props.expandedW||840,h:e.props.expandedH||600}}let T={waiting_model:{dot:"var(--accent)",label:"thinking"},running_tools:{dot:"#f59e0b",label:"tools"},running_command:{dot:"#f59e0b",label:"command"},waiting_input:{dot:"var(--text)",label:"waiting"},idle:{dot:"var(--text-dim)",label:"idle"},"just-ended":{dot:"#10b981",label:"done"}};function W({shape:e}){let{w:t,h:r,title:a,projectName:s,messageCount:l,phase:d,runningMs:c,endedAt:u,lastActivityAt:p,stale:h,sessionId:x,expanded:g,lastReply:f,cwd:b,taskId:v}=e.props,y=(0,o.hGv)(),k=(0,S.G)(y,e.id,"var(--board-card-glass)"),{highlightId:j}=(0,C.kz)(),I=j===e.id,E=!!b,z=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e=z.current;if(!e)return;let t=t=>{t.ctrlKey||t.metaKey||e.scrollHeight>e.clientHeight&&t.stopPropagation()};return e.addEventListener("wheel",t),()=>e.removeEventListener("wheel",t)}),(0,i.useEffect)(()=>{let e=z.current;if(!e)return;let t=e=>{let t=window.getSelection();t&&t.toString().length>0&&e.stopPropagation()};return e.addEventListener("copy",t),()=>e.removeEventListener("copy",t)});let[P,M]=(0,i.useState)(!1),[D,$]=(0,i.useState)(""),H=(0,i.useRef)(null),A=e=>{e.stopPropagation(),$(a||""),M(!0),requestAnimationFrame(()=>{let e=H.current;e&&(e.focus(),e.select())})},B=async()=>{if(!x)return;let t=D.trim();if(M(!1),t&&t!==a){y?.updateShapes([{id:e.id,type:"session-card",props:{title:t}}]);try{(await fetch(`/api/sessions/${encodeURIComponent(x)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t})})).ok?(0,m.z6)(x,t):y?.updateShapes([{id:e.id,type:"session-card",props:{title:a}}])}catch{y?.updateShapes([{id:e.id,type:"session-card",props:{title:a}}])}}},F=()=>{y?.bringToFront([e.id])},N=t=>{(t.stopPropagation(),E)?y?.deleteShapes([e.id]):y?.updateShapes([{id:e.id,type:"session-card",props:L(e)}])};if(g)return(0,n.jsxs)("div",{style:{position:"relative",width:t,height:r,zIndex:0},children:[(0,n.jsx)("div",{ref:k,style:{position:"absolute",inset:0,overflow:"hidden",borderRadius:18,pointerEvents:"none",zIndex:-1}}),(0,n.jsxs)(o.hDc,{"data-testid":`session-card-${x}`,"data-node-id":e.id.replace("shape:",""),onPointerDown:F,style:{width:t,height:r,overflow:"visible",borderRadius:18,border:I?"2px solid var(--accent)":`1px solid ${h?"color-mix(in srgb, var(--border) 80%, transparent)":"color-mix(in srgb, var(--border) 60%, transparent)"}`,background:"transparent",boxShadow:I?C.u:"0 2px 12px -6px rgba(0,0,0,0.18)",animation:I?"board-search-glow 1.8s ease-out forwards":void 0,opacity:h?.55:1,pointerEvents:"all",display:"flex",flexDirection:"column",color:"var(--text)",userSelect:"none",padding:8},children:[(0,n.jsxs)("div",{"data-session-titlebar":!0,style:{flexShrink:0,display:"flex",alignItems:"center",gap:6,padding:"0 10px",height:"calc(36px + env(safe-area-inset-top))",borderTopLeftRadius:12,borderTopRightRadius:12,pointerEvents:"none",cursor:"grab",position:"relative"},children:[(0,n.jsx)(R.i,{kind:"session",color:T[d]?.dot??"var(--text-dim)"}),P?(0,n.jsx)("input",{ref:H,value:D,onChange:e=>$(e.target.value),onKeyDown:e=>{"Enter"===e.key&&B(),"Escape"===e.key&&M(!1)},onBlur:()=>void B(),onPointerDown:e=>e.stopPropagation(),style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:600,padding:"2px 6px",border:"1px solid var(--accent)",borderRadius:5,outline:"none",background:"var(--side-input)",color:"var(--text)"}}):(0,n.jsx)("span",{style:{fontSize:12.5,fontWeight:600,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text)"},children:E?"New session":a||"Untitled"}),!E&&!P&&(0,n.jsx)("button",{type:"button",onClick:A,onPointerDown:e=>e.stopPropagation(),title:"Rename","aria-label":"Rename",style:{flexShrink:0,pointerEvents:"all",display:"flex",alignItems:"center",justifyContent:"center",width:20,height:20,padding:0,border:"none",borderRadius:5,background:"transparent",color:"var(--text-dim)",cursor:"pointer"},children:(0,n.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),(0,n.jsx)("div",{style:{flex:1}}),(0,n.jsx)("div",{"data-session-navbar-slot":!0,style:{display:"flex",alignItems:"center",pointerEvents:"all"}}),(0,n.jsx)("button",{type:"button",onClick:N,onPointerDown:e=>e.stopPropagation(),title:E?"Discard":"Collapse",style:{flexShrink:0,pointerEvents:"all",display:"flex",alignItems:"center",justifyContent:"center",width:22,height:22,padding:0,border:"none",borderRadius:5,background:"transparent",color:"var(--text-dim)",cursor:"pointer"},children:E?(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,n.jsx)("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),(0,n.jsx)("path",{d:"M10 11v6M14 11v6"}),(0,n.jsx)("path",{d:"M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"})]}):(0,n.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M18 15l-6-6-6 6"})})})]}),(0,n.jsx)("div",{style:{flex:1,minHeight:0,padding:"0 4px 0",pointerEvents:"all"},children:(0,n.jsx)(w,{sessionId:x,cwd:b,taskId:v})})]})]});let O=T[d]??T.idle;return(0,n.jsxs)("div",{style:{position:"relative",width:t,height:r,zIndex:0},children:[(0,n.jsx)("div",{ref:k,style:{position:"absolute",inset:0,overflow:"hidden",borderRadius:14,pointerEvents:"none",zIndex:-1}}),(0,n.jsxs)(o.hDc,{"data-testid":`session-card-${x}`,onPointerDown:F,style:{width:t,height:r,overflow:"visible",borderRadius:14,border:I?"2px solid var(--accent)":`1px solid ${h?"color-mix(in srgb, var(--border) 80%, transparent)":"color-mix(in srgb, var(--border) 60%, transparent)"}`,background:"transparent",boxShadow:I?C.u:"0 2px 12px -6px rgba(0,0,0,0.18)",animation:I?"board-search-glow 1.8s ease-out forwards":void 0,opacity:h?.55:1,pointerEvents:"all",display:"flex",flexDirection:"column",padding:"8px 10px 6px",color:"var(--text)",userSelect:"none",cursor:"grab"},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,minHeight:20,flexShrink:0},children:[(0,n.jsx)(R.i,{kind:"session",color:O.dot}),P?(0,n.jsx)("input",{ref:H,value:D,onChange:e=>$(e.target.value),onKeyDown:e=>{"Enter"===e.key&&B(),"Escape"===e.key&&M(!1)},onBlur:()=>void B(),onPointerDown:e=>e.stopPropagation(),style:{flex:1,minWidth:0,fontSize:12,fontWeight:600,padding:"2px 6px",border:"1px solid var(--accent)",borderRadius:5,outline:"none",background:"var(--side-input)",color:"var(--text)"}}):(0,n.jsx)("span",{style:{fontSize:12.5,fontWeight:600,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text)"},children:a||"Untitled"}),!E&&!P&&(0,n.jsx)("button",{type:"button",onClick:A,onPointerDown:e=>e.stopPropagation(),title:"Rename","aria-label":"Rename",style:{flexShrink:0,pointerEvents:"all",display:"flex",alignItems:"center",justifyContent:"center",width:20,height:20,padding:0,border:"none",borderRadius:5,background:"transparent",color:"var(--text-dim)",cursor:"pointer",opacity:.65},children:(0,n.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),h&&(0,n.jsx)("span",{style:{flexShrink:0,fontSize:9.5,color:"var(--text-dim)",border:"1px solid color-mix(in srgb, var(--border) 70%, transparent)",borderRadius:4,padding:"0 4px"},children:"stale"}),(0,n.jsx)("button",{type:"button",onClick:N,onPointerDown:e=>e.stopPropagation(),title:"Expand",style:{flexShrink:0,pointerEvents:"all",display:"flex",alignItems:"center",justifyContent:"center",width:20,height:20,padding:0,border:"none",borderRadius:5,background:"transparent",color:"var(--text-dim)",cursor:"pointer"},children:(0,n.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M6 9l6 6 6-6"})})})]}),(0,n.jsx)("div",{ref:z,style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",gap:2,overflowY:"auto",overflowX:"hidden",padding:"2px 2px 2px 0",scrollbarWidth:"thin",scrollbarColor:"color-mix(in srgb, var(--border) 70%, transparent) transparent"},children:f?(0,n.jsx)("div",{style:{fontSize:11.5,lineHeight:1.45,color:"var(--text-muted)",wordBreak:"break-word",overflowWrap:"anywhere",whiteSpace:"pre-wrap",maxWidth:"100%",userSelect:"text"},children:f}):(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:10.5,color:"var(--text-dim)"},children:[s&&(0,n.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flexShrink:1},children:s}),l>0&&(0,n.jsxs)("span",{style:{flexShrink:0,whiteSpace:"nowrap"},children:[l," msgs"]})]})}),(0,n.jsxs)("div",{style:{flexShrink:0,display:"flex",alignItems:"center",gap:6,fontSize:10,color:"var(--text-dim)",borderTop:"1px solid color-mix(in srgb, var(--border) 50%, transparent)",paddingTop:3},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{flexShrink:0},children:"\uD83D\uDD52"}),(0,n.jsx)("span",{children:function(e){if(e<=0)return"";let t=new Date(e),r=new Date;return t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):`${t.getMonth()+1}/${t.getDate()} ${t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`}(p)}),(0,n.jsx)("div",{style:{flex:1}}),c>0&&"idle"!==d&&(0,n.jsx)("span",{style:{fontFamily:"var(--font-mono)",whiteSpace:"nowrap",flexShrink:0},children:function(e){let t=Math.max(1,Math.round(e/1e3));if(t<60)return`${t}s`;let r=Math.floor(t/60);if(r<60)return`${r}m${t%60}s`;let n=Math.floor(r/60);return`${n}h${r%60}m`}(c)})]})]})]})}},87278:(e,t,r)=>{r.d(t,{G:()=>i});var n=r(12115),o=r(23312);function i(e,t,r){let i=(0,n.useRef)(null),a=()=>{let r=i.current;if(!r||!e?.getShape(t)||!e)return;let n=e.getZoomLevel(),a=e.getShapePageTransform(t);if(!a)return;let s=o.V8r.Point(a),l=e.pageToScreen({x:s.x,y:s.y});r.style.width=`${window.innerWidth/n}px`,r.style.height=`${window.innerHeight/n}px`,r.style.transform=`translate(${-l.x/n}px, ${-l.y/n}px)`};return(0,n.useEffect)(()=>{if(!e)return;let t=0,r=()=>{t||(t=requestAnimationFrame(()=>{t=0,a()}))},n=()=>r();return r(),e.on("change",n),()=>{e.off("change",n),t&&cancelAnimationFrame(t)}},[e,t]),e=>{if(!e)return;let t=e.querySelector("[data-glass-layer]");if(t){i.current=t,a();return}let n=document.createElement("div");n.dataset.glassLayer="1",n.style.cssText=`position:absolute;left:0;top:0;pointer-events:none;z-index:-1;will-change:transform;background-image:linear-gradient(${r}, ${r}), var(--glass-bg-image, none);background-repeat:no-repeat,no-repeat;background-size:100% 100%,100% 100%;`,e.prepend(n),i.current=n,a()}}},91897:(e,t,r)=>{r.d(t,{i:()=>i});var n=r(95155);let o={session:"会话",note:"便笺",task:"任务"};function i({kind:e,color:t}){return(0,n.jsxs)("span",{title:`${o[e]} \xb7 状态由圆点颜色表示`,style:{display:"flex",alignItems:"center",gap:4,flexShrink:0,lineHeight:1},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",background:t,flexShrink:0}}),(0,n.jsx)("span",{style:{fontSize:11,color:"var(--text-muted)",whiteSpace:"nowrap"},children:o[e]})]})}}}]);