tower-studio 0.2.20 → 0.2.21

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 (182) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  5. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  6. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -1
  12. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +25 -25
  13. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  14. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/.next/server/app/api/browse-fs/route.js.nft.json +1 -1
  16. package/.next/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  17. package/.next/standalone/.next/server/app/api/internal/assistant/chat/route.js +3 -2
  18. package/.next/standalone/.next/server/app/api/internal/assistant/chat/route.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/missions/page/react-loadable-manifest.json +1 -1
  20. package/.next/standalone/.next/server/app/missions/page/server-reference-manifest.json +61 -61
  21. package/.next/standalone/.next/server/app/missions/page.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/missions/page_client-reference-manifest.js +1 -1
  23. package/.next/standalone/.next/server/app/onboarding/page/react-loadable-manifest.json +1 -1
  24. package/.next/standalone/.next/server/app/onboarding/page/server-reference-manifest.json +25 -25
  25. package/.next/standalone/.next/server/app/onboarding/page.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  27. package/.next/standalone/.next/server/app/page/react-loadable-manifest.json +1 -1
  28. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +25 -25
  29. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  31. package/.next/standalone/.next/server/app/settings/page/react-loadable-manifest.json +1 -1
  32. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +41 -41
  33. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  35. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +1 -1
  36. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +76 -76
  37. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
  39. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +1 -1
  40. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +80 -80
  41. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
  43. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +1 -1
  44. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +57 -57
  45. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
  47. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +1 -1
  48. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +59 -59
  49. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
  51. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +1 -1
  52. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +25 -25
  53. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
  54. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
  55. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/react-loadable-manifest.json +1 -1
  56. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/server-reference-manifest.json +68 -68
  57. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page.js.nft.json +1 -1
  58. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page_client-reference-manifest.js +1 -1
  59. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +2 -2
  60. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +68 -68
  61. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
  62. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  63. package/.next/standalone/.next/server/app/workspaces/page/react-loadable-manifest.json +1 -1
  64. package/.next/standalone/.next/server/app/workspaces/page/server-reference-manifest.json +43 -43
  65. package/.next/standalone/.next/server/app/workspaces/page.js.nft.json +1 -1
  66. package/.next/standalone/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
  67. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0eh8dj_.js +12 -0
  68. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0hrprmi.js +2 -2
  69. package/.next/standalone/.next/server/chunks/[root-of-the-server]__03j20vp._.js +2 -2
  70. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05se6yk._.js +1 -1
  71. package/.next/standalone/.next/server/chunks/[root-of-the-server]__06m1r8x._.js +1 -1
  72. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_6swdz._.js +1 -1
  73. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0iyp~.k._.js +10 -2
  74. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o3iihg._.js +3 -0
  75. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ogh_qu._.js +10 -2
  76. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0q.piu~._.js +9 -1
  77. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0wuzc5o._.js +1 -1
  78. package/.next/standalone/.next/server/chunks/src_0bkvm8c._.js +1 -1
  79. package/.next/standalone/.next/server/chunks/ssr/0iu._[workspaceId]_projects_[projectId]_versions_version-timeline-client_tsx_07o_kyi._.js +1 -1
  80. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02-6df-._.js +3 -3
  81. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e_-mj-._.js +3 -3
  82. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0fzkdjl._.js +3 -3
  83. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0f72pl_._.js → [root-of-the-server]__0hy3~f.._.js} +2 -2
  84. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0jymb~t._.js +1 -1
  85. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0pu-v0l._.js +3 -3
  86. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0q-abig._.js +3 -0
  87. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0q~lxnz._.js +3 -0
  88. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0th0_fo._.js +3 -3
  89. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ty1ao1._.js +1 -1
  90. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0um1ugs._.js +3 -3
  91. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0z7je5_._.js +1 -1
  92. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0.hrt0s._.js → [root-of-the-server]__10ol5vl._.js} +1 -1
  93. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__134_xv.._.js +1 -1
  94. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__13vgkq5._.js +3 -3
  95. package/.next/standalone/.next/server/chunks/ssr/_00jadm8._.js +3 -0
  96. package/.next/standalone/.next/server/chunks/ssr/{_0es22_y._.js → _03.a~r1._.js} +2 -2
  97. package/.next/standalone/.next/server/chunks/ssr/_053zyvm._.js +3 -0
  98. package/.next/standalone/.next/server/chunks/ssr/{_0tua.9p._.js → _08x3jaa._.js} +2 -2
  99. package/.next/standalone/.next/server/chunks/ssr/_08z-g~5._.js +3 -3
  100. package/.next/standalone/.next/server/chunks/ssr/{_0-zk1xq._.js → _09j4imi._.js} +2 -2
  101. package/.next/standalone/.next/server/chunks/ssr/_09r0_z9._.js +3 -0
  102. package/.next/standalone/.next/server/chunks/ssr/_0_vjay8._.js +3 -3
  103. package/.next/standalone/.next/server/chunks/ssr/_0a554d8._.js +3 -0
  104. package/.next/standalone/.next/server/chunks/ssr/{_0z-mopi._.js → _0aw2qq6._.js} +2 -2
  105. package/.next/standalone/.next/server/chunks/ssr/{_0fhds8v._.js → _0bmywa6._.js} +2 -2
  106. package/.next/standalone/.next/server/chunks/ssr/_0cj9a7y._.js +1 -1
  107. package/.next/standalone/.next/server/chunks/ssr/_0ghovf3._.js +4 -0
  108. package/.next/standalone/.next/server/chunks/ssr/_0jg.s-g._.js +1 -1
  109. package/.next/standalone/.next/server/chunks/ssr/{_10sx3n7._.js → _0jyj~t3._.js} +3 -3
  110. package/.next/standalone/.next/server/chunks/ssr/_0r6gweb._.js +3 -3
  111. package/.next/standalone/.next/server/chunks/ssr/_0rdyrfd._.js +1 -1
  112. package/.next/standalone/.next/server/chunks/ssr/_0rt8jf_._.js +3 -3
  113. package/.next/standalone/.next/server/chunks/ssr/_0unw1fq._.js +2 -2
  114. package/.next/standalone/.next/server/chunks/ssr/_0uuzh5m._.js +3 -3
  115. package/.next/standalone/.next/server/chunks/ssr/{_0ln8vj0._.js → _0yakvlq._.js} +3 -3
  116. package/.next/standalone/.next/server/chunks/ssr/_0~aon4t._.js +3 -3
  117. package/.next/standalone/.next/server/chunks/ssr/{_0nzwk2y._.js → _13r9dxk._.js} +3 -3
  118. package/.next/standalone/.next/server/chunks/ssr/src_075s.rk._.js +1 -1
  119. package/.next/standalone/.next/server/chunks/ssr/src_0djxlqx._.js +1 -1
  120. package/.next/standalone/.next/server/chunks/ssr/src_0eufeyj._.js +1 -1
  121. package/.next/standalone/.next/server/chunks/ssr/src_actions_agent-actions_ts_0~wc.sy._.js +1 -1
  122. package/.next/standalone/.next/server/chunks/ssr/src_actions_file-actions_ts_0gcvqwm._.js +1 -1
  123. package/.next/standalone/.next/server/chunks/ssr/src_app_missions_missions-client_tsx_11429lj._.js +1 -1
  124. package/.next/standalone/.next/server/chunks/ssr/src_app_onboarding_page_tsx_0xf7hpz._.js +1 -1
  125. package/.next/standalone/.next/server/chunks/ssr/src_app_settings_page_tsx_0h9v7dr._.js +1 -1
  126. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0wyzpam._.js +1 -1
  127. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_board-page-client_tsx_0gips66._.js +1 -1
  128. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_02t7blt._.js +1 -1
  129. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  130. package/.next/standalone/.next/server/pages/500.html +1 -1
  131. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  132. package/.next/standalone/.next/server/server-reference-manifest.json +233 -233
  133. package/.next/standalone/.next/static/chunks/{0~7zlta-boej_.js → 00fv~h4rni5hv.js} +1 -1
  134. package/.next/standalone/.next/static/chunks/{0m2o51rtidmxh.js → 00p3.tda-56.l.js} +1 -1
  135. package/.next/standalone/.next/static/chunks/{0mqdumoz_frlg.js → 01tnwkggn5.s-.js} +1 -1
  136. package/.next/standalone/.next/static/chunks/02bobmiee9ss8.js +1 -0
  137. package/.next/standalone/.next/static/chunks/039ntokp82-em.js +1 -0
  138. package/.next/standalone/.next/static/chunks/{0j157xr-bax~d.js → 04yrp-8ps3q_-.js} +1 -1
  139. package/.next/standalone/.next/static/chunks/05.wfh773dxo9.js +1 -0
  140. package/.next/standalone/.next/static/chunks/06~1n6of8ll__.js +5 -0
  141. package/.next/standalone/.next/static/chunks/0_n2l3jehwcsq.js +1 -0
  142. package/.next/standalone/.next/static/chunks/{0m90vde-l0h1a.js → 0aq7ksckxr-8-.js} +2 -2
  143. package/.next/standalone/.next/static/chunks/0d4~4k4hv01ah.js +1 -0
  144. package/.next/standalone/.next/static/chunks/{08q54xdtb58sp.js → 0f1gk0.5slqqh.js} +1 -1
  145. package/.next/standalone/.next/static/chunks/0ip_37zz4f080.js +1 -0
  146. package/.next/standalone/.next/static/chunks/{15nh9t21_9u6i.js → 0j16~sj50uq_m.js} +1 -1
  147. package/.next/standalone/.next/static/chunks/0o8jf4a30e_ri.js +5 -0
  148. package/.next/standalone/.next/static/chunks/0ol16355~utic.js +5 -0
  149. package/.next/standalone/.next/static/chunks/{0wzn4nbo56gf3.js → 0pg_rf2cch5pv.js} +1 -1
  150. package/.next/standalone/.next/static/chunks/0pwe0m3i1rro1.js +1 -0
  151. package/.next/standalone/.next/static/chunks/{163o-5kdc6me5.js → 0rwca.wrfl3b9.js} +1 -1
  152. package/.next/standalone/.next/static/chunks/0srx~7bncp64q.js +5 -0
  153. package/.next/standalone/.next/static/chunks/{0bxz4rml4iaob.js → 0vyvdsh1mkl5d.js} +1 -1
  154. package/.next/standalone/.next/static/chunks/{0vykez3mijj6f.js → 10h~50kdsu5fx.js} +1 -1
  155. package/.next/standalone/.next/static/chunks/{18aqm8uawnpl3.js → 15esfko8asvh7.js} +1 -1
  156. package/.next/standalone/.next/static/chunks/{0yje2relcvr6r.js → 16sn2ij01qrfz.js} +1 -1
  157. package/.next/standalone/.next/static/chunks/{1157qwl1lq-uv.js → 17oxpxjm7_smn.js} +1 -1
  158. package/.next/standalone/package.json +1 -1
  159. package/package.json +1 -1
  160. package/skills/tower/SKILL.md +9 -0
  161. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o3ggen._.js +0 -12
  162. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__08mkpqd._.js +0 -3
  163. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ntdmyn._.js +0 -3
  164. package/.next/standalone/.next/server/chunks/ssr/_07~q7qs._.js +0 -3
  165. package/.next/standalone/.next/server/chunks/ssr/_09b8zgw._.js +0 -4
  166. package/.next/standalone/.next/server/chunks/ssr/_0_2c7e0._.js +0 -3
  167. package/.next/standalone/.next/server/chunks/ssr/_0mqxe~e._.js +0 -3
  168. package/.next/standalone/.next/server/chunks/ssr/_12e_1hd._.js +0 -3
  169. package/.next/standalone/.next/static/chunks/0-93a_ovah-e0.js +0 -5
  170. package/.next/standalone/.next/static/chunks/0.rw..0v.8a1-.js +0 -5
  171. package/.next/standalone/.next/static/chunks/0gh2r0ji~m34y.js +0 -1
  172. package/.next/standalone/.next/static/chunks/0odb2p6e7-8n8.js +0 -1
  173. package/.next/standalone/.next/static/chunks/0t0.k0pugrmxt.js +0 -1
  174. package/.next/standalone/.next/static/chunks/0xrhj92idqx72.js +0 -5
  175. package/.next/standalone/.next/static/chunks/0yj4qfp~pk5na.js +0 -1
  176. package/.next/standalone/.next/static/chunks/0zk-aoc.g8t8h.js +0 -1
  177. package/.next/standalone/.next/static/chunks/11~-fm76bj3r4.js +0 -1
  178. package/.next/standalone/.next/static/chunks/13wlh1lxhudv~.js +0 -1
  179. package/.next/standalone/.next/static/chunks/16pnb9m-vqs75.js +0 -5
  180. /package/.next/standalone/.next/static/{QK0JGDY3UZSvD1SQgyL-w → zosKR5i2aA392qu0Ka1j9}/_buildManifest.js +0 -0
  181. /package/.next/standalone/.next/static/{QK0JGDY3UZSvD1SQgyL-w → zosKR5i2aA392qu0Ka1j9}/_clientMiddlewareManifest.js +0 -0
  182. /package/.next/standalone/.next/static/{QK0JGDY3UZSvD1SQgyL-w → zosKR5i2aA392qu0Ka1j9}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,783426,e=>{"use strict";var t=e.i(289721),s=e.i(965652),a=e.i(538059),r=e.i(340966),n=e.i(572989);let l=(0,n.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);var i=e.i(486077),o=e.i(533499);function c({totalTasks:e,runningTasks:s}){let{t:a}=(0,o.useI18n)();return(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-3 px-6 py-4",children:[(0,t.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"rounded-lg bg-sky-500/10 p-2 ring-1 ring-sky-500/20",children:(0,t.jsx)(r.ClipboardList,{className:"h-4 w-4 text-sky-400"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:a("board.overview")}),(0,t.jsx)("p",{className:"text-2xl font-bold font-mono tracking-tight text-foreground",children:e})]})]})}),(0,t.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"rounded-lg bg-primary/10 p-2 ring-1 ring-primary/20",children:(0,t.jsx)(l,{className:"h-4 w-4 text-primary"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:a("board.running")}),(0,t.jsx)("p",{className:"text-2xl font-bold font-mono tracking-tight text-foreground",children:s})]})]})}),(0,t.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"rounded-lg bg-emerald-500/10 p-2 ring-1 ring-emerald-500/20",children:(0,t.jsx)(i.Lightbulb,{className:"h-4 w-4 text-emerald-400"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:a("board.tip")}),(0,t.jsx)("p",{className:"text-xs font-medium text-foreground/80",children:a("board.tipText")})]})]})})]})}var d=e.i(210702),m=e.i(232545),x=e.i(738690),u=e.i(226145),h=e.i(519455),p=e.i(793479),g=e.i(280027);function f({searchQuery:e,onSearchChange:s,versions:a=[],versionFilter:r="all",onVersionFilterChange:n,versionsHref:l,onCreateTask:i}){let c,{t:j}=(0,o.useI18n)(),b="all"===r?j("board.allVersions"):"backlog"===r?j("board.backlogFilter"):(c=a.find(e=>e.id===r))?`${c.number} ${c.name}`:j("board.allVersions");return(0,t.jsxs)("div",{className:"flex items-center gap-2 px-6 py-2",children:[n&&(0,t.jsxs)(g.Select,{value:r,onValueChange:e=>n(e||"all"),children:[(0,t.jsxs)(g.SelectTrigger,{className:"h-8 w-44 shrink-0 gap-1.5 text-xs text-muted-foreground",children:[(0,t.jsx)(u.GitBranch,{className:"h-3.5 w-3.5 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:b})]}),(0,t.jsxs)(g.SelectContent,{children:[(0,t.jsx)(g.SelectItem,{value:"all",children:j("board.allVersions")}),(0,t.jsx)(g.SelectItem,{value:"backlog",children:j("board.backlogFilter")}),a.map(e=>(0,t.jsxs)(g.SelectItem,{value:e.id,children:[(0,t.jsx)("span",{className:"font-mono",children:e.number})," ",e.name]},e.id))]})]}),(0,t.jsxs)("div",{className:"relative flex-1 max-w-xs",children:[(0,t.jsx)(x.Search,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(p.Input,{type:"text",value:e,onChange:e=>s(e.target.value),placeholder:j("board.searchPlaceholder"),className:"pl-8 pr-3 text-xs"})]}),(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[l&&(0,t.jsx)(d.default,{href:l,children:(0,t.jsxs)(h.Button,{variant:"outline",className:"h-8 gap-1.5 text-xs text-muted-foreground",children:[(0,t.jsx)(u.GitBranch,{className:"h-3.5 w-3.5"}),j("version.timeline")]})}),(0,t.jsxs)(h.Button,{"data-tour":"create-task",variant:"outline",className:"gap-1.5 border-border text-xs text-muted-foreground hover:border-primary/30 hover:text-primary",onClick:i,children:[(0,t.jsx)(m.Plus,{className:"h-3.5 w-3.5"}),j("board.newTask")]})]})]})}var j=e.i(585012),b=e.i(597746),N=e.i(685149);function v({x:e,y:r,taskId:n,currentStatus:l,hasExecutions:i,workspaceId:c,onClose:d,onStatusChange:m,onLaunch:x}){let{t:u}=(0,o.useI18n)(),h=(0,a.useRouter)(),p=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=e=>{p.current&&!p.current.contains(e.target)&&d()},t=e=>{"Escape"===e.key&&d()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[d]);let g="flex items-center px-3 py-1.5 text-xs cursor-pointer hover:bg-accent rounded-sm w-full text-left",f=(0,t.jsxs)("div",{ref:p,style:{position:"fixed",top:r,left:e,zIndex:9999},className:"bg-popover border border-border rounded-md shadow-md py-1 min-w-[180px]",children:[(0,t.jsx)("div",{className:"px-3 py-1 text-[10px] text-muted-foreground uppercase tracking-wider",children:u("board.contextMenu.changeStatus")}),N.BOARD_COLUMNS.map(e=>(0,t.jsxs)("button",{type:"button",className:g,onClick:()=>{m(n,e.id),d()},children:[l===e.id?(0,t.jsx)(b.Check,{className:"h-3 w-3 mr-2 flex-shrink-0"}):(0,t.jsx)("span",{className:"w-5 flex-shrink-0"}),e.label]},e.id)),(0,t.jsx)("hr",{className:"my-1 border-border"}),(0,t.jsx)("button",{type:"button",className:`${g} ${i?"opacity-50 cursor-not-allowed":""}`,disabled:i,onClick:()=>{i||(x(n),d())},children:u("board.contextMenu.launch")}),"DONE"!==l&&"CANCELLED"!==l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("hr",{className:"my-1 border-border"}),(0,t.jsx)("button",{type:"button",className:g,onClick:()=>{h.push(`/workspaces/${c}/tasks/${n}`),d()},children:u("board.contextMenu.goToDetail")})]})]});return"u"<typeof document?null:(0,j.createPortal)(f,document.body)}var k=e.i(720247),y=e.i(775712);let w=(0,n.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);var C=e.i(67013),S=e.i(49007),T=e.i(464249),P=e.i(998626);let I=(0,n.default)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);var E=e.i(487486),D=e.i(746798),L=e.i(755146),B=e.i(35967);function F({task:e,onClick:s,onEdit:a,onDelete:r,onTogglePin:n,onContextMenu:l}){let{t:i}=(0,o.useI18n)(),{attributes:c,listeners:d,setNodeRef:m,transform:x,transition:p,isDragging:g}=(0,y.useSortable)({id:e.id,data:{type:"task",task:e}}),f={transform:C.CSS.Transform.toString(x),transition:p,opacity:g?.4:1},j=N.PRIORITY_CONFIG[e.priority],b=!!e.baseBranch;return(0,t.jsxs)("div",{ref:m,style:f,...c,...d,className:"group cursor-grab rounded-lg border border-border bg-card p-3 transition-all hover:border-primary/20 hover:bg-accent/50 active:cursor-grabbing",onClick:s,onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),l?.(e,t.clientX,t.clientY)},"data-testid":"task-card",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-foreground",children:e.title}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",className:`transition-all ${e.pinned?"text-primary opacity-100":"text-muted-foreground opacity-0 group-hover:opacity-100"}`,onClick:t=>{t.stopPropagation(),n?.(e.id)},"aria-label":i(e.pinned?"board.unpin":"board.pin"),children:(0,t.jsx)(I,{className:`h-3.5 w-3.5 ${e.pinned?"-rotate-45":""}`})}),(0,t.jsxs)(L.DropdownMenu,{children:[(0,t.jsx)(L.DropdownMenuTrigger,{render:(0,t.jsx)("button",{className:"rounded-md p-0.5 text-muted-foreground opacity-0 transition-all hover:bg-background hover:text-foreground group-hover:opacity-100",onClick:e=>e.stopPropagation()}),children:(0,t.jsx)(S.MoreHorizontal,{className:"h-4 w-4"})}),(0,t.jsxs)(L.DropdownMenuContent,{align:"end",children:[(0,t.jsxs)(L.DropdownMenuItem,{onClick:t=>{t.stopPropagation(),a?.(e)},children:[(0,t.jsx)(T.Pencil,{className:"mr-2 h-3.5 w-3.5"}),i("common.edit")]}),(0,t.jsxs)(L.DropdownMenuItem,{className:"text-rose-400",onClick:t=>{t.stopPropagation(),r?.(e.id)},children:[(0,t.jsx)(P.Trash2,{className:"mr-2 h-3.5 w-3.5"}),i("common.delete")]})]})]})]})]}),e.description&&(0,t.jsx)("p",{className:"mt-1.5 line-clamp-3 text-xs leading-relaxed text-muted-foreground",children:e.description}),(0,t.jsxs)("div",{className:"mt-2.5 flex flex-wrap items-center gap-1.5",children:[(0,t.jsx)(E.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${j.color}`,children:j.label}),e.labels?.map(e=>(0,t.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-medium",style:{backgroundColor:e.label.color+"20",color:e.label.color},children:e.label.name},e.label.id)),(b||e.version)&&(0,t.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[b&&(0,t.jsxs)(D.Tooltip,{disableHoverablePopup:!0,children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)("span",{className:"inline-flex cursor-default items-center rounded-md border border-border bg-muted px-1 py-0.5 text-muted-foreground",onPointerDown:e=>e.stopPropagation(),children:(0,t.jsx)(u.GitBranch,{className:"h-2.5 w-2.5 shrink-0"})})}),(0,t.jsx)(D.TooltipContent,{side:"top",children:i("board.card.worktree",{branch:e.baseBranch??""})})]}),e.version&&(0,t.jsxs)(D.Tooltip,{disableHoverablePopup:!0,children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)("span",{className:"cursor-default",onPointerDown:e=>e.stopPropagation(),children:(0,t.jsx)(B.TaskVersionTag,{number:e.version.number,title:""})})}),(0,t.jsx)(D.TooltipContent,{side:"top",children:i("board.card.version",{number:e.version.number,name:e.version.name})})]})]})]})]})}var R=e.i(776639),A=e.i(759684);function O({open:e,onOpenChange:s,columnLabel:a,columnColor:r,tasks:n,onTaskClick:l}){let{t:i}=(0,o.useI18n)();return(0,t.jsx)(R.Dialog,{open:e,onOpenChange:s,children:(0,t.jsxs)(R.DialogContent,{className:"sm:max-w-6xl max-h-[80vh]",children:[(0,t.jsx)(R.DialogHeader,{children:(0,t.jsxs)(R.DialogTitle,{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:`h-2.5 w-2.5 rounded-full ${r}`}),(0,t.jsx)("span",{children:a}),(0,t.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-mono font-medium text-muted-foreground",children:n.length})]})}),(0,t.jsx)(A.ScrollArea,{className:"max-h-[680px]",children:(0,t.jsxs)("div",{className:"grid grid-cols-4 gap-3 pr-3",children:[n.map(e=>{let a=N.PRIORITY_CONFIG[e.priority];return(0,t.jsxs)("div",{className:"cursor-pointer rounded-lg border border-border bg-card p-3 transition-all hover:border-primary/20 hover:bg-accent/50",onClick:()=>{l?.(e),s(!1)},children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-foreground line-clamp-2",children:e.title}),e.description&&(0,t.jsx)("p",{className:"mt-1.5 line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:e.description}),(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-1.5 flex-wrap",children:[(0,t.jsx)(E.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${a.color}`,children:a.label}),e.labels?.map(e=>(0,t.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-medium",style:{backgroundColor:e.label.color+"20",color:e.label.color},children:e.label.name},e.label.id))]})]},e.id)}),0===n.length&&(0,t.jsx)("div",{className:"col-span-4 py-8 text-center text-sm text-muted-foreground",children:i("board.noTasks")})]})})]})})}function M({id:e,label:a,color:r,tasks:n,onTaskClick:l,onEditTask:i,onAddTask:c,onDeleteTask:d,onTogglePin:x,onContextMenu:u}){let{setNodeRef:p,isOver:g}=(0,k.useDroppable)({id:e}),[f,j]=(0,s.useState)(!1),{t:b}=(0,o.useI18n)();return(0,t.jsxs)("div",{className:`flex w-0 min-w-[220px] flex-1 flex-col min-h-0 border-r border-border/50 last:border-r-0 transition-colors ${g?"bg-primary/[0.06]":""}`,children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-3 py-2.5 border-b border-border/30",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:`h-2 w-2 rounded-full ${r}`}),(0,t.jsx)("span",{className:"text-xs font-semibold tracking-wide text-secondary-foreground",children:a}),(0,t.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-mono font-medium text-muted-foreground",children:n.length})]}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:()=>j(!0),className:"text-muted-foreground","aria-label":b("board.viewAll"),children:(0,t.jsx)(w,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:c,className:"text-muted-foreground","aria-label":"add",children:(0,t.jsx)(m.Plus,{className:"h-3.5 w-3.5"})})]})]}),(0,t.jsx)(O,{open:f,onOpenChange:j,columnLabel:a,columnColor:r,tasks:n,onTaskClick:l}),(0,t.jsx)(A.ScrollArea,{className:"flex-1 min-h-0",children:(0,t.jsx)("div",{ref:p,className:"flex flex-col gap-2 p-2",children:(0,t.jsx)(y.SortableContext,{items:n.map(e=>e.id),strategy:y.verticalListSortingStrategy,children:n.map(e=>(0,t.jsx)(F,{task:e,onClick:()=>l?.(e),onEdit:i,onDelete:d,onTogglePin:x,onContextMenu:u},e.id))})})})]})}function $({initialTasks:e,onTaskMove:a,onTaskClick:r,onEditTask:n,onAddTask:l,onDeleteTask:i,onTogglePin:o,onContextMenuStatusChange:c,onContextMenuLaunch:d,workspaceId:m}){let[x,u]=(0,s.useState)(e),[h,p]=(0,s.useState)(null),[g,f]=(0,s.useState)(null);(0,s.useEffect)(()=>{u(e)},[e]);let j=(0,k.useSensors)((0,k.useSensor)(k.PointerSensor,{activationConstraint:{distance:8}})),b=(0,s.useCallback)((e,t,s)=>{f({task:e,x:t,y:s})},[]),y=(0,s.useCallback)(e=>{let t=x.find(t=>t.id===e.active.id);t&&p(t)},[x]),w=(0,s.useCallback)(e=>{let t,{active:s,over:r}=e;if(p(null),!r)return;let n=s.id,l=r.id;if(N.BOARD_COLUMNS.some(e=>e.id===l))t=l;else{let e=x.find(e=>e.id===l);t=e?.status}t&&(u(e=>e.map(e=>e.id===n?{...e,status:t}:e)),a?.(n,t))},[x,a]);return(0,t.jsxs)(k.DndContext,{id:"kanban-board",sensors:j,collisionDetection:k.closestCorners,onDragStart:y,onDragEnd:w,children:[(0,t.jsx)("div",{className:"mx-2 flex h-full overflow-x-auto rounded-xl border border-border bg-card/50",children:N.BOARD_COLUMNS.map(e=>(0,t.jsx)(M,{id:e.id,label:e.label,color:e.color,tasks:x.filter(t=>t.status===e.id),onTaskClick:r,onEditTask:n,onAddTask:()=>l?.(e.id),onDeleteTask:i,onTogglePin:o,onContextMenu:b},e.id))}),(0,t.jsx)(k.DragOverlay,{children:h?(0,t.jsx)("div",{className:"rotate-3 scale-105",children:(0,t.jsx)(F,{task:h})}):null}),g&&(0,t.jsx)(v,{x:g.x,y:g.y,taskId:g.task.id,currentStatus:g.task.status,hasExecutions:(g.task._count?.executions??0)>0,workspaceId:m??"",onClose:()=>f(null),onStatusChange:(e,t)=>{c?.(e,t),f(null)},onLaunch:e=>{d?.(e),f(null)}})]})}var z=e.i(744798),U=e.i(232280),G=e.i(368490),W=e.i(645378),V=e.i(453889);let _=(0,n.default)("git-commit-vertical",[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]);var H=e.i(938499),K=e.i(400355),Y=e.i(233274),q=e.i(736061),J=e.i(460707),X=e.i(567860),Q=e.i(875840),Z=e.i(624687),ee=e.i(514798);let et=(0,ee.createServerReference)("60d96729d37481304ce6156c227b593155e817f078",ee.callServer,void 0,ee.findSourceMapURL,"updateProject");var es=e.i(958735);let ea=(0,ee.createServerReference)("4082f3efb288761c5f251b36fc6721f7269ac6492a",ee.callServer,void 0,ee.findSourceMapURL,"deleteProject"),er=(0,ee.createServerReference)("40fe3aa7bc2326c6a4b056afc9ed7d44b6d1f2c0e9",ee.callServer,void 0,ee.findSourceMapURL,"getRecentLocalProjects"),en=(0,ee.createServerReference)("402f12a5c8befd86b1a80847c2c204acd1be2dc265",ee.callServer,void 0,ee.findSourceMapURL,"getOrCreateTowerTaskId");var el=e.i(453930),ei=e.i(977998),eo=e.i(786508),ec=e.i(21108),ed=e.i(360112),em=e.i(224277),ex=e.i(905455);function eu({commits:e}){let{t:a}=(0,o.useI18n)(),[r,n]=(0,s.useState)(!1);return 0===e.length?null:(0,t.jsxs)("div",{children:[(0,t.jsxs)("button",{onClick:()=>n(!r),className:"flex w-full items-center justify-between py-1",children:[(0,t.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:a("git.commitLog")}),r?(0,t.jsx)(U.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,t.jsx)(G.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),r&&(0,t.jsx)("div",{className:"mt-1.5 space-y-0.5 max-h-64 overflow-y-auto",children:e.map(e=>(0,t.jsxs)("div",{className:"group flex items-start gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,t.jsx)(_,{className:"h-3 w-3 shrink-0 text-muted-foreground mt-0.5"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"text-xs text-foreground line-clamp-1",children:e.message}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,t.jsxs)("button",{onClick:()=>{navigator.clipboard.writeText(e.shortHash),ed.toast.success(`Copied ${e.shortHash}`)},className:"flex items-center gap-0.5 font-mono text-[10px] text-primary/70 hover:text-primary transition-colors",children:[e.shortHash,(0,t.jsx)(Q.Copy,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:e.author}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(e){let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m`;let s=Math.floor(t/60);if(s<24)return`${s}h`;let a=Math.floor(s/24);return a<30?`${a}d`:`${Math.floor(a/30)}mo`}(e.date)})]})]})]},e.hash))})]})}var eh=e.i(487278),ep=e.i(375306),eg=e.i(244354);function ef({localPath:e,stashes:a,hasChanges:r,onRefresh:n}){let{t:l}=(0,o.useI18n)(),[i,c]=(0,s.useState)(!1),[d,m]=(0,s.useState)(!1),[x,u]=(0,s.useState)(""),[g,f]=(0,s.useState)(null),j=async()=>{m(!0);try{await (0,eg.gitAction)(e,"stash-save",{message:x}),u(""),ed.toast.success(l("git.stashSaved")),await n()}catch(e){ed.toast.error(e instanceof Error?e.message:String(e))}finally{m(!1)}},b=async t=>{f(t);try{await (0,eg.gitAction)(e,"stash-pop",{index:t}),ed.toast.success(l("git.stashApplied")),await n()}catch(e){ed.toast.error(e instanceof Error?e.message:String(e))}finally{f(null)}},N=async t=>{f(t);try{await (0,eg.gitAction)(e,"stash-drop",{index:t}),ed.toast.success(l("git.stashDropped")),await n()}catch(e){ed.toast.error(e instanceof Error?e.message:String(e))}finally{f(null)}};return r||0!==a.length?(0,t.jsxs)("div",{children:[(0,t.jsxs)("button",{onClick:()=>c(!i),className:"flex w-full items-center justify-between py-1",children:[(0,t.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[l("git.stash")," ",a.length>0&&`(${a.length})`]}),i?(0,t.jsx)(U.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,t.jsx)(G.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),i&&(0,t.jsxs)("div",{className:"mt-1.5 space-y-2",children:[r&&(0,t.jsxs)("div",{className:"flex gap-1.5",children:[(0,t.jsx)(p.Input,{value:x,onChange:e=>u(e.target.value),placeholder:l("git.stashMsgPlaceholder"),className:"h-7 text-xs flex-1",onKeyDown:e=>"Enter"===e.key&&j()}),(0,t.jsx)(h.Button,{variant:"outline",size:"icon-sm",onClick:j,disabled:d,className:"shrink-0",children:d?(0,t.jsx)(K.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(eh.Archive,{className:"h-3 w-3"})})]}),a.length>0&&(0,t.jsx)("div",{className:"space-y-0.5",children:a.map(e=>(0,t.jsxs)("div",{className:"group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,t.jsx)(eh.Archive,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"flex-1 min-w-0 truncate text-xs text-foreground",children:e.message||`stash@{${e.index}}`}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:()=>b(e.index),disabled:g===e.index,className:"text-muted-foreground","aria-label":l("git.stashApply"),children:g===e.index?(0,t.jsx)(K.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(ep.ArrowUpFromLine,{className:"h-3 w-3"})}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:()=>N(e.index),disabled:g===e.index,className:"text-rose-400","aria-label":l("git.stashDrop"),children:(0,t.jsx)(P.Trash2,{className:"h-3 w-3"})})]})]},e.index))})]})]}):null}var ej=e.i(515135);function eb({value:e,ariaLabel:a}){let{t:r}=(0,o.useI18n)(),[n,l]=(0,s.useState)(!1),i=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(e);else{let t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}l(!0),ed.toast.success(r("common.copied")),setTimeout(()=>l(!1),1500)}catch{ed.toast.error(r("common.copyFailed"))}};return(0,t.jsxs)("div",{className:"flex items-center gap-1 rounded-md border border-border bg-muted/50 pl-3 pr-1 py-1.5",children:[(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",title:e,children:e}),(0,t.jsxs)(D.Tooltip,{children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",className:"shrink-0 text-muted-foreground","aria-label":a,onClick:i,children:n?(0,t.jsx)(b.Check,{className:"h-3 w-3 text-emerald-400"}):(0,t.jsx)(Q.Copy,{className:"h-3 w-3"})})}),(0,t.jsx)(D.TooltipContent,{children:n?r("common.copied"):r("common.copy")})]})]})}function eN({project:e,workspaceId:r}){let{t:n,locale:l}=(0,o.useI18n)(),i=(0,a.useRouter)(),[c,d]=(0,s.useState)(!0),[m,x]=(0,s.useState)(!0),[g,f]=(0,s.useState)(!1),[j,b]=(0,s.useState)(!1),[N,v]=(0,s.useState)(""),[k,y]=(0,s.useState)(!1),[w,C]=(0,s.useState)(!1),[S,I]=(0,s.useState)(!1),[E,L]=(0,s.useState)(e.name),[B,F]=(0,s.useState)(e.alias??""),[A,O]=(0,s.useState)(e.description??""),[M,$]=(0,s.useState)(e.localPath??""),[z,Q]=(0,s.useState)(e.projectType??"FRONTEND"),[ee,eh]=(0,s.useState)([]);(0,s.useEffect)(()=>{er(100).then(eh)},[]);let[ep,eg]=(0,s.useState)(!1),[ev,ek]=(0,s.useState)(""),[ey,ew]=(0,s.useState)(""),[eC,eS]=(0,s.useState)(""),[eT,eP]=(0,s.useState)(""),[eI,eE]=(0,s.useState)("FRONTEND"),[eD,eL]=(0,s.useState)(!1),[eB,eF]=(0,s.useState)(!1),[eR,eA]=(0,s.useState)(null),[eO,eM]=(0,s.useState)(!1),[e$,ez]=(0,s.useState)(!1),eU=e=>{ed.toast.info(e)},eG=(0,s.useCallback)(async()=>{if(e.localPath){eM(!0);try{let t=await fetch(`/api/git?path=${encodeURIComponent(e.localPath)}`);t.ok&&eA(await t.json())}catch{}finally{eM(!1)}}},[e.localPath]);(0,s.useEffect)(()=>{eG()},[eG]);let eW=async()=>{if(e.localPath){ez(!0);try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",path:e.localPath})})).ok?(eU(n("git.initSuccess")),await eG()):eU(n("git.initFailed"))}catch{eU(n("git.initFailed"))}finally{ez(!1)}}},eV=(e,t)=>{i.push(`/workspaces/${e}?projectId=${t}`,{scroll:!1}),i.refresh()},e_=async()=>{if(ey.trim()){eL(!0);try{let e=await (0,es.createProject)({name:ey.trim(),alias:eC.trim()||void 0,description:eT.trim()||void 0,localPath:ev,projectType:eI,workspaceId:r});eg(!1),eV(r,e.id)}catch(e){ed.toast.error(e instanceof Error?e.message:String(e))}finally{eL(!1)}}},eH=async()=>{if(M&&!eB){eF(!0);try{let e=await (0,ec.analyzeProjectDirectory)(M.trim(),l);O(e)}catch{ed.toast.error(n("project.analyzeError"))}finally{eF(!1)}}},eK=async()=>{try{await et(e.id,{name:E.trim(),alias:B.trim()||void 0,description:A.trim()||void 0,localPath:M.trim()||void 0,projectType:z}),i.refresh(),f(!1)}catch(e){ed.toast.error(e instanceof Error?e.message:String(e))}};return(0,t.jsxs)("aside",{className:"relative w-72 flex-shrink-0 overflow-y-auto border-l border-border bg-sidebar",children:[(0,t.jsxs)("div",{className:"border-b border-border p-4",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h2",{className:"text-base font-semibold text-foreground",children:e.name}),e.alias&&(0,t.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:e.alias})]}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{L(e.name),F(e.alias??""),O(e.description??""),$(e.localPath??""),f(!0)},className:"text-muted-foreground",children:(0,t.jsx)(T.Pencil,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{v(""),b(!0)},className:"text-muted-foreground hover:text-rose-400",children:(0,t.jsx)(P.Trash2,{className:"h-3.5 w-3.5"})})]})]}),e.description&&(0,t.jsx)("p",{className:"mt-2 text-sm text-secondary-foreground leading-relaxed line-clamp-4",children:e.description}),(0,t.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:(0,t.jsx)("span",{className:`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium ${"GIT"===e.type?"bg-sky-500/15 text-sky-300 ring-1 ring-sky-500/20":"bg-muted text-muted-foreground ring-1 ring-border"}`,children:"GIT"===e.type?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.GitBranch,{className:"h-3 w-3"}),n("sidebar.right.gitType")]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(W.FileText,{className:"h-3 w-3"}),n("sidebar.right.normalType")]})})}),(e.localPath||e.gitUrl)&&(0,t.jsxs)("div",{className:"mt-3 space-y-1.5",children:[e.localPath&&(0,t.jsx)(eb,{value:e.localPath,ariaLabel:n("project.localPath")}),e.gitUrl&&(0,t.jsx)(eb,{value:e.gitUrl,ariaLabel:n("project.gitUrl")})]}),e.localPath&&(0,t.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsxs)(D.Tooltip,{children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)(h.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,el.openInFileManager)(e.localPath)}catch(e){console.error("openInFileManager failed:",e),ed.toast.error(n("git.openInFileManagerFailed"))}},children:(0,t.jsx)(q.FolderSearch,{className:"h-4 w-4"})})}),(0,t.jsx)(D.TooltipContent,{children:n("git.openInFileManager")})]}),(0,t.jsxs)(D.Tooltip,{children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)(h.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,ei.openInEditor)(e.localPath)}catch(e){console.error("openInEditor failed:",e),ed.toast.error(n("git.openInEditorFailed"))}},children:(0,t.jsx)(J.Code,{className:"h-4 w-4"})})}),(0,t.jsx)(D.TooltipContent,{children:n("git.openInEditor")})]}),(0,t.jsxs)(D.Tooltip,{children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)(h.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,eo.openInTerminal)(e.localPath)}catch(e){console.error("openInTerminal failed:",e),ed.toast.error(n("git.openInTerminalFailed"))}},children:(0,t.jsx)(X.Terminal,{className:"h-4 w-4"})})}),(0,t.jsx)(D.TooltipContent,{children:n("git.openInTerminal")})]})]}),(0,t.jsxs)(h.Button,{variant:"outline",className:"w-full h-9 gap-1.5 text-xs",disabled:w,onClick:async()=>{C(!0);try{let t=await en(e.id);i.push(`/workspaces/${r}/tasks/${t}`)}catch{ed.toast.error(n("git.openStudioFailed"))}finally{C(!1)}},children:[w?(0,t.jsx)(K.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(V.FolderOpen,{className:"h-3.5 w-3.5"}),n("git.openStudio")]})]})]}),(0,t.jsxs)("div",{className:"border-b border-border p-4",children:[(0,t.jsxs)(h.Button,{variant:"ghost",onClick:()=>d(!c),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,t.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:n("git.section")}),c?(0,t.jsx)(U.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,t.jsx)(G.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),c&&(0,t.jsx)("div",{className:"mt-3",children:e.localPath?eO?(0,t.jsxs)("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:[(0,t.jsx)(K.Loader2,{className:"h-4 w-4 animate-spin"}),(0,t.jsx)("span",{className:"ml-2 text-xs",children:n("git.loading")})]}):eR&&!eR.isGit?(0,t.jsxs)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(H.AlertCircle,{className:"h-3.5 w-3.5"}),(0,t.jsx)("p",{className:"text-xs",children:n("git.notInitialized")})]}),(0,t.jsxs)(h.Button,{className:"mt-3 h-7 w-full gap-1.5 bg-primary/10 text-xs text-primary ring-1 ring-primary/20 hover:bg-primary/15",onClick:eW,disabled:e$,children:[e$?(0,t.jsx)(K.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(_,{className:"h-3 w-3"}),n("git.initRepo")]})]}):eR?.isGit?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("div",{className:"overflow-hidden h-[560px] flex flex-col",children:(0,t.jsx)(ej.EditorGitPanel,{localPath:e.localPath,mode:"project"})}),(0,t.jsx)(eu,{commits:eR.commits??[]}),(0,t.jsx)(ef,{localPath:e.localPath,stashes:eR.stashes??[],hasChanges:(eR.changedFiles??[]).length>0,onRefresh:eG})]}):null:(0,t.jsx)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(H.AlertCircle,{className:"h-3.5 w-3.5"}),(0,t.jsx)("p",{className:"text-xs",children:n("git.noLocalPath")})]})})})]}),(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)(h.Button,{variant:"ghost",onClick:()=>x(!m),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,t.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:n("sidebar.right.browseRepo")}),m?(0,t.jsx)(U.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,t.jsx)(G.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),m&&(0,t.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,t.jsxs)(h.Button,{variant:"outline",className:"w-full h-8 gap-1.5 text-xs",onClick:()=>I(!0),children:[(0,t.jsx)(V.FolderOpen,{className:"h-3.5 w-3.5"}),n("sidebar.right.browseRepo")]}),ee.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5 px-1",children:n("sidebar.right.recent")}),(0,t.jsx)("div",{className:"space-y-0.5",children:ee.map(s=>(0,t.jsxs)("button",{onClick:()=>{s.id!==e.id&&eV(s.workspaceId,s.id)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors ${s.id===e.id?"bg-primary/10 text-primary cursor-default":"hover:bg-accent cursor-pointer"}`,children:["GIT"===s.type?(0,t.jsx)(u.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,t.jsx)(V.FolderOpen,{className:"h-3 w-3 shrink-0 text-primary/70"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"truncate text-xs font-medium text-foreground",children:s.name}),s.localPath&&(0,t.jsx)("p",{className:"truncate text-[10px] font-mono text-muted-foreground",children:s.localPath})]})]},s.id))})]})]})]}),(0,t.jsx)(R.Dialog,{open:g,onOpenChange:f,children:(0,t.jsxs)(R.DialogContent,{style:{maxWidth:"32rem"},children:[(0,t.jsx)(R.DialogHeader,{children:(0,t.jsx)(R.DialogTitle,{children:n("project.edit")})}),(0,t.jsxs)("div",{className:"space-y-3 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.name")}),(0,t.jsx)(p.Input,{value:E,onChange:e=>L(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.type.label")}),(0,t.jsx)("div",{className:"mt-1.5",children:(0,t.jsx)(ex.SegmentedControl,{options:[{value:"FRONTEND",label:n("project.type.frontend")},{value:"BACKEND",label:n("project.type.backend")}],value:z,onChange:Q})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.alias")}),(0,t.jsx)(p.Input,{value:B,onChange:e=>F(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.description")}),(0,t.jsxs)(h.Button,{type:"button",variant:"ghost",onClick:eH,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!M||eB?"opacity-50":""}`,children:[eB?(0,t.jsx)(K.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(Y.Sparkles,{className:"h-3 w-3"}),eB?n("project.analyzing"):n("project.genDesc")]})]}),(0,t.jsx)(Z.Textarea,{value:A,onChange:e=>O(e.target.value),rows:2,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none max-h-[200px] overflow-y-auto"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.localPath")}),(0,t.jsx)("div",{className:"mt-1.5 break-all rounded-md border border-border bg-muted/50 px-3 py-2 font-mono text-xs text-muted-foreground",children:M||"—"})]})]}),(0,t.jsxs)(R.DialogFooter,{children:[(0,t.jsx)(h.Button,{variant:"outline",onClick:()=>f(!1),children:n("common.cancel")}),(0,t.jsx)(h.Button,{onClick:eK,disabled:!E.trim()||eB,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:n("common.save")})]})]})}),(0,t.jsx)(em.FolderBrowserDialog,{open:S,onOpenChange:I,onSelect:e=>{g?$(e):(e=>{let t=ee.find(t=>t.localPath===e);if(t)return eV(t.workspaceId,t.id);let s=e.split("/").filter(Boolean).pop()??"";ek(e),ew(s),eS(""),eP(""),eg(!0)})(e)}}),(0,t.jsx)(R.Dialog,{open:ep,onOpenChange:eg,children:(0,t.jsxs)(R.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(R.DialogHeader,{children:(0,t.jsx)(R.DialogTitle,{children:n("topbar.newProject")})}),(0,t.jsxs)("div",{className:"space-y-3 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.localPath")}),(0,t.jsx)("div",{className:"mt-1.5 rounded-md border border-border bg-muted/50 px-3 py-2 font-mono text-xs text-muted-foreground",children:ev})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.name")}),(0,t.jsx)(p.Input,{value:ey,onChange:e=>ew(e.target.value),placeholder:n("project.namePlaceholder"),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.type.label")}),(0,t.jsx)("div",{className:"mt-1.5",children:(0,t.jsx)(ex.SegmentedControl,{options:[{value:"FRONTEND",label:n("project.type.frontend")},{value:"BACKEND",label:n("project.type.backend")}],value:eI,onChange:eE})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.alias")}),(0,t.jsx)(p.Input,{value:eC,onChange:e=>eS(e.target.value),placeholder:n("project.aliasPlaceholder"),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.description")}),(0,t.jsx)(Z.Textarea,{value:eT,onChange:e=>eP(e.target.value),placeholder:n("project.descPlaceholder"),rows:2,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none"})]})]}),(0,t.jsxs)(R.DialogFooter,{children:[(0,t.jsx)(h.Button,{variant:"outline",onClick:()=>eg(!1),children:n("common.cancel")}),(0,t.jsxs)(h.Button,{onClick:e_,disabled:!ey.trim()||eD,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[eD?(0,t.jsx)(K.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,n("common.create")]})]})]})}),(0,t.jsx)(R.Dialog,{open:j,onOpenChange:e=>{b(e),e||v("")},children:(0,t.jsxs)(R.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(R.DialogHeader,{children:(0,t.jsx)(R.DialogTitle,{className:"text-rose-400",children:n("project.deleteTitle")})}),(0,t.jsxs)("div",{className:"space-y-3 py-2",children:[(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n("project.deleteWarning",{name:e.name})}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n("project.deleteIrreversible")}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.deleteConfirmLabel")}),(0,t.jsx)(p.Input,{value:N,onChange:e=>v(e.target.value),placeholder:n("project.deleteConfirmPlaceholder"),className:"mt-1.5",autoFocus:!0})]})]}),(0,t.jsxs)(R.DialogFooter,{children:[(0,t.jsx)(h.Button,{variant:"outline",onClick:()=>b(!1),children:n("common.cancel")}),(0,t.jsxs)(h.Button,{variant:"destructive",disabled:N!==n("project.deleteConfirmText")||k,onClick:async()=>{y(!0);try{await ea(e.id),ed.toast.success(n("project.deleteSuccess")),i.push(`/workspaces/${r}`)}catch{ed.toast.error(n("project.deleteFailed"))}finally{y(!1),b(!1)}},children:[k&&(0,t.jsx)(K.Loader2,{className:"h-3 w-3 animate-spin mr-1"}),n("project.deleteButton")]})]})]})})]})}var ev=e.i(475958),ek=e.i(313029),ey=e.i(301348),ew=e.i(259846),eC=e.i(975157);function eS({title:e,description:s,branch:a,baseBranch:r,version:n,hasConversation:l,updatedAt:i,openDir:c,onBack:d}){let{t:m}=(0,o.useI18n)();return(0,t.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(Y.Sparkles,{className:"h-3.5 w-3.5 text-primary"}),(0,t.jsx)("span",{className:"text-xs font-semibold text-primary",children:m("taskDetail.title")})]}),(0,t.jsxs)(h.Button,{variant:"ghost",onClick:d,className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground h-auto px-2 py-1",children:[(0,t.jsx)(ew.ArrowLeft,{className:"h-3.5 w-3.5"}),m("taskDetail.back")]})]}),(0,t.jsx)("h2",{className:"mt-2.5 text-lg font-bold tracking-tight text-foreground",children:e}),s&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:s}),(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[r?(0,t.jsxs)(E.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:[(0,t.jsx)(u.GitBranch,{className:"mr-1 h-3 w-3"}),r," · worktree"]}):a?(0,t.jsx)(E.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:m("taskDetail.directMode")}):null,n&&(0,t.jsx)(B.TaskVersionTag,{number:n.number,name:n.name,showName:!0}),l&&(0,t.jsx)(E.Badge,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-400 text-[10px] border border-emerald-500/20",children:m("taskDetail.hasConversation")}),(0,t.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[m("taskDetail.updatedAt")," ",(0,eC.formatRelativeTime)(i)]}),c&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-0.5",children:[(0,t.jsxs)(D.Tooltip,{children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)(h.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,el.openInFileManager)(c)}catch(e){console.error("openInFileManager failed:",e),ed.toast.error(m("git.openInFileManagerFailed"))}},children:(0,t.jsx)(q.FolderSearch,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(D.TooltipContent,{side:"bottom",children:m("git.openInFileManager")})]}),(0,t.jsxs)(D.Tooltip,{children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)(h.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,ei.openInEditor)(c)}catch(e){console.error("openInEditor failed:",e),ed.toast.error(m("git.openInEditorFailed"))}},children:(0,t.jsx)(J.Code,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(D.TooltipContent,{side:"bottom",children:m("git.openInEditor")})]}),(0,t.jsxs)(D.Tooltip,{children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)(h.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,eo.openInTerminal)(c)}catch(e){console.error("openInTerminal failed:",e),ed.toast.error(m("git.openInTerminalFailed"))}},children:(0,t.jsx)(X.Terminal,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(D.TooltipContent,{side:"bottom",children:m("git.openInTerminal")})]})]})]})]})}var eT=e.i(14842),eP=e.i(865514),eI=e.i(83434),eE=e.i(849021),eD=e.i(752299),eL=e.i(420101),eB=e.i(695314),eF=e.i(753073),eR=e.i(974507),eA=e.i(905523),eO=e.i(619658),eM=e.i(719329),e$=e.i(326883),ez=e.i(631675);let eU=(0,n.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);var eG=e.i(657153),eW=e.i(867533),eV=e.i(700116);let e_=(0,ee.createServerReference)("4066df49877116ac7cb3a8d3a38dbc5198056ab415",ee.callServer,void 0,ee.findSourceMapURL,"getTaskNotes");var eH=e.i(364931);let eK=(0,ee.createServerReference)("40385c786a7a133d7b81c4c068fb0d9c036374ccc2",ee.callServer,void 0,ee.findSourceMapURL,"getTaskAssets");var eY=e.i(292905),eq=e.i(956618),eJ=e.i(235357),eX=e.i(144640),eQ=e.i(937304);let eZ=/\.(txt|md|json)$/i;function e0({taskId:e,projectId:a}){let{t:r}=(0,o.useI18n)(),n=(0,s.useRef)(null),[l,i]=(0,s.useState)([]),[c,d]=(0,s.useState)([]),[x,u]=(0,s.useState)(!1),[p,g]=(0,s.useState)(""),[f,j]=(0,s.useState)(""),[b,N]=(0,s.useState)(!1),[v,k]=(0,s.useState)(null);async function y(){p.trim()&&(await (0,eV.createNote)({title:p.trim(),content:f.trim(),projectId:a,taskId:e,category:"task"}),g(""),j(""),u(!1),e_(e).then(i))}async function w(e){await (0,eH.deleteNote)(e),i(t=>t.filter(t=>t.id!==e))}async function C(t){let s=t.target.files?.[0];if(s){N(!0);try{let t=new FormData;t.set("file",s),t.set("projectId",a),t.set("taskId",e),await (0,eY.uploadAsset)(t),eK(e).then(d)}finally{N(!1),n.current&&(n.current.value="")}}}async function S(e){await (0,eq.deleteAsset)(e),d(t=>t.filter(t=>t.id!==e))}function T(e){return(0,eQ.isImageAsset)(e.filename,e.mimeType)||eZ.test(e.filename)}function I(e){T(e)?k(e):ed.toast.info(r("assets.previewNotSupported"))}async function E(e){try{let t=await fetch("/api/internal/assets/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e.path})});if(!t.ok){let e=await t.json().catch(()=>({}));ed.toast.error(e.error||"Failed to reveal file")}}catch{ed.toast.error("Failed to reveal file")}}(0,s.useEffect)(()=>{e_(e).then(i),eK(e).then(d)},[e]);let D=v?(0,eQ.isImageAsset)(v.filename,v.mimeType)?"image":eZ.test(v.filename)?"text":null:null,L=c.filter(e=>(0,eQ.isImageAsset)(e.filename,e.mimeType)).map(e=>({id:e.id,url:(0,eQ.localPathToApiUrl)(e.path),filename:e.filename})),B=v?L.findIndex(e=>e.id===v.id):-1;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A.ScrollArea,{className:"h-full",children:(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,t.jsx)(W.FileText,{className:"h-3.5 w-3.5"}),r("taskPage.notes")]}),(0,t.jsxs)(h.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>u(!x),children:[x?(0,t.jsx)(eG.X,{className:"h-3 w-3"}):(0,t.jsx)(m.Plus,{className:"h-3 w-3"}),x?"":r("taskPage.addNote")]})]}),x&&(0,t.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,t.jsx)("input",{type:"text",value:p,onChange:e=>g(e.target.value),placeholder:r("taskPage.noteTitle"),className:"h-8 w-full rounded-md border border-border bg-background px-3 text-sm focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),(0,t.jsx)("textarea",{value:f,onChange:e=>j(e.target.value),placeholder:r("taskPage.noteContent"),rows:3,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-primary resize-none"}),(0,t.jsx)(h.Button,{className:"text-xs",onClick:y,disabled:!p.trim(),children:r("taskPage.addNote")})]}),(0,t.jsxs)("div",{className:"mt-2 space-y-2",children:[0===l.length&&!x&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:r("taskPage.noNotes")}),l.map(e=>(0,t.jsx)("div",{className:"group rounded-md border border-border bg-card p-3",children:(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("h4",{className:"text-sm font-medium truncate",children:e.title}),e.content&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-3 whitespace-pre-wrap",children:e.content}),(0,t.jsx)("p",{className:"mt-1 text-[10px] text-muted-foreground",children:new Date(e.createdAt).toLocaleString()})]}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:()=>w(e.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:r("taskPage.deleteNote"),children:(0,t.jsx)(P.Trash2,{className:"h-3.5 w-3.5"})})]})},e.id))]})]}),(0,t.jsxs)("div",{className:"px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,t.jsx)(eU,{className:"h-3.5 w-3.5"}),r("taskPage.attachments")]}),(0,t.jsxs)(h.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>n.current?.click(),disabled:b,children:[(0,t.jsx)(ez.Upload,{className:"h-3 w-3"}),r("taskPage.uploadFile")]}),(0,t.jsx)("input",{ref:n,type:"file",className:"hidden",onChange:C})]}),(0,t.jsxs)("div",{className:"mt-2 space-y-1.5",children:[0===c.length&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:r("taskPage.noAttachments")}),c.map(e=>{var s;let a=T(e);return(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border bg-card px-3 py-2",children:[(0,t.jsx)(eU,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,t.jsx)("button",{type:"button",onClick:()=>I(e),disabled:!a,className:`min-w-0 flex-1 truncate text-left text-sm ${a?"cursor-pointer hover:underline":"cursor-default"}`,title:a?r("assets.preview"):e.filename,children:e.filename}),(0,t.jsx)("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:(s=e.size)?s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1024/1024).toFixed(1)} MB`:""}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5",children:[a&&(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:()=>I(e),className:"shrink-0 text-muted-foreground hover:bg-accent",title:r("assets.preview"),children:(0,t.jsx)(eW.Eye,{className:"h-3 w-3"})}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:()=>E(e),className:"shrink-0 text-muted-foreground hover:bg-accent",title:r("assets.revealInFinder"),children:(0,t.jsx)(V.FolderOpen,{className:"h-3 w-3"})}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:()=>S(e.id),className:"shrink-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",title:r("taskPage.deleteAttachment"),children:(0,t.jsx)(P.Trash2,{className:"h-3 w-3"})})]})]},e.id)})]})]})]})}),(0,t.jsx)(eJ.ImageLightbox,{imageUrl:"image"===D&&B>=0?L[B].url:null,filename:"image"===D&&B>=0?L[B].filename:"",open:"image"===D,onOpenChange:e=>{e||k(null)},assets:L.map(({url:e,filename:t})=>({url:e,filename:t})),currentIndex:B>=0?B:void 0,onIndexChange:e=>{let t=L[e];if(!t)return;let s=c.find(e=>e.id===t.id);s&&k(s)}}),(0,t.jsx)(eX.TextPreviewDialog,{url:"text"===D&&v?(0,eQ.localPathToApiUrl)(v.path):null,filename:v?.filename??"",open:"text"===D,onOpenChange:e=>{e||k(null)}})]})}function e1({task:e,workspaceId:r,projectLocalPath:n,onClose:l}){let{t:i}=(0,o.useI18n)(),c=(0,a.useRouter)(),{removePortal:d}=(0,eI.useTerminalPortal)(),[m,x]=(0,s.useState)("terminal"),[u,p]=(0,s.useState)(null),[f,j]=(0,s.useState)(!1),[b,N]=(0,s.useState)(e.status);(0,s.useEffect)(()=>{N(e.status)},[e.status]);let[v,k]=(0,s.useState)(null),[y,w]=(0,s.useState)(!1),[C,S]=(0,s.useState)(!1),[T,P]=(0,s.useState)([]);(0,s.useEffect)(()=>{k(null),w(!1),S(!1),P([]),p(null),x("terminal")},[e.id]);let[I,E]=(0,s.useState)([]),[L,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{let e=!1;return(0,eM.getPrompts)().then(t=>{if(e)return;E(t.map(e=>({id:e.id,name:e.name,isDefault:e.isDefault})));let s=t.find(e=>e.isDefault);s&&B(s.id)}),()=>{e=!0}},[]),(0,s.useEffect)(()=>{k(null),S(!1);let t=!1;return(0,eE.getTaskExecutions)(e.id).then(e=>{if(t)return;let s=e[0];if(s?.status==="RUNNING"){let e=s.worktreePath||n||null;e&&k(e)}P(e.filter(e=>"RUNNING"!==e.status)),S(!0)}),()=>{t=!0}},[e.id]),(0,s.useEffect)(()=>{if("changes"!==m||"TODO"===b||"CANCELLED"===b)return;let t=!1;return j(!0),fetch(`/api/tasks/${e.id}/diff`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{t||p(e?.files||e?.branchDeleted?e:null)}).catch(()=>{t||p(null)}).finally(()=>{t||j(!1)}),()=>{t=!0}},[m,b,e.id]);let F=(0,s.useCallback)(async()=>{if(!y){w(!0),d(e.id);try{let t=await (0,eD.startPtyExecutionSafe)(e.id,"",L);if(!t.ok){w(!1),ed.toast.error(t.error||i("terminal.startFailed"));return}k(t.worktreePath??null),N("IN_PROGRESS")}catch(e){w(!1),ed.toast.error(e instanceof Error&&e.message?e.message:i("terminal.startFailed"))}}},[e.id,y,L,i]),R=(0,s.useCallback)(t=>{w(!1),k(null),d(e.id),0===t&&N("IN_REVIEW"),(0,eE.getTaskExecutions)(e.id).then(e=>{P(e.filter(e=>"RUNNING"!==e.status))}),c.refresh()},[c,e.id]),O=(0,s.useCallback)(async()=>{await (0,eL.stopPtyExecution)(e.id),w(!1),d(e.id),k(null),N("IN_REVIEW"),(0,eE.getTaskExecutions)(e.id).then(e=>{P(e.filter(e=>"RUNNING"!==e.status))}),c.refresh()},[e.id,c]),M=(0,s.useCallback)(async t=>{w(!0),d(e.id),k(null);try{let{worktreePath:s}=await (0,eB.resumePtyExecution)(e.id,t);k(s),N("IN_PROGRESS")}catch{w(!1)}},[e.id,d]),$=(0,s.useCallback)(async()=>{w(!0),d(e.id),k(null);try{let{worktreePath:t}=await (0,eF.continueLatestPtyExecution)(e.id);k(t),N("IN_PROGRESS")}catch(e){w(!1),ed.toast.error(e instanceof Error?e.message:String(e))}},[e.id,d]),[z,U]=(0,s.useState)(!1),[G,V]=(0,s.useState)([]),_=(0,s.useCallback)(async()=>{try{let t=await (0,eA.checkWorktreeClean)(e.id);if(t.hasWorktree&&!t.clean)return void ed.toast.error(i("taskPage.uncommittedChanges",{count:String(t.files.length)}));if(t.hasWorktree&&t.clean&&!t.hasCommits)return void ed.toast.error(i("taskPage.noChangesToComplete"),{action:{label:i("taskPage.markAsCancelled"),onClick:()=>{(0,eR.updateTaskStatus)(e.id,"CANCELLED").then(()=>{N("CANCELLED"),ed.toast.success(i("taskPage.taskCancelled")),c.refresh()}).catch(()=>ed.toast.error("Failed to cancel task"))}}});if(t.hasWorktree&&t.hasCommits){V(t.commitLog),U(!0);return}await (0,eR.updateTaskStatus)(e.id,"DONE"),N("DONE"),ed.toast.success(i("taskPage.taskCompleted")),c.refresh()}catch{ed.toast.error("Failed to complete task")}},[e.id,c,i]),H=(0,s.useCallback)(()=>{N("DONE"),U(!1),ed.toast.success(i("taskPage.taskCompleted")),c.refresh()},[c,i]),Y=(0,s.useCallback)(async t=>{try{let{hash:s}=await (0,eO.commitWorktreeChanges)(e.id,t);ed.toast.success(i("diff.commitSuccess",{hash:s})),c.refresh();let a=await fetch(`/api/tasks/${e.id}/diff`);if(a.ok){let e=await a.json();p(e?.files?e:null)}}catch(e){ed.toast.error(e instanceof Error?e.message:"Commit failed")}},[e.id,c,i]);return(0,t.jsxs)("div",{className:"flex h-full w-[600px] flex-shrink-0 flex-col border-l border-border bg-sidebar","data-testid":"task-detail-panel",children:[(0,t.jsx)(eS,{title:e.title,description:i("taskDetail.panelDescription"),branch:`task/${e.id}`,baseBranch:e.baseBranch,version:e.version??null,hasConversation:!1,updatedAt:e.updatedAt,openDir:v??(n?e.subPath?`${n}/${e.subPath}`:n:null),onBack:l}),(0,t.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-2",children:[(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsxs)("button",{onClick:()=>x("terminal"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"terminal"===m?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,t.jsx)(X.Terminal,{className:"h-3 w-3"}),i("terminal.execute")]}),(0,t.jsx)("button",{onClick:()=>x("changes"),className:`px-3 py-1 text-xs font-medium rounded-md ${"changes"===m?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:i("taskPage.changes")}),(0,t.jsxs)("button",{onClick:()=>x("notes"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"notes"===m?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,t.jsx)(W.FileText,{className:"h-3 w-3"}),i("taskPage.notes")]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:["IN_REVIEW"===b&&(0,t.jsxs)(h.Button,{size:"sm",onClick:_,className:"bg-emerald-500/15 text-emerald-400 ring-1 ring-emerald-500/20 hover:bg-emerald-500/25",children:[(0,t.jsx)(ey.CheckCircle2,{className:"h-3 w-3"}),i("taskPage.completeTask")]}),"DONE"!==b&&"CANCELLED"!==b&&(0,t.jsxs)(h.Button,{variant:"ghost",size:"sm",onClick:()=>c.push(`/workspaces/${r}/tasks/${e.id}`),className:"text-muted-foreground",children:[(0,t.jsx)(ev.ExternalLink,{className:"h-3 w-3"}),i("taskPage.viewDetails")]})]})]}),"terminal"===m?(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:C?v?(0,t.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,t.jsxs)("div",{className:"shrink-0 flex items-center justify-between border-b border-neutral-800 px-3 py-2 bg-[#0f1419]",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-emerald-400",children:[(0,t.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"}),i("execution.running")]}),(0,t.jsxs)(D.Tooltip,{children:[(0,t.jsxs)(D.TooltipTrigger,{onClick:O,className:"flex items-center gap-1.5 rounded-md bg-red-500/15 px-3 py-1 text-xs font-medium text-red-400 hover:bg-red-500/25 transition-colors",children:[(0,t.jsx)(ek.Square,{className:"h-3 w-3"}),i("terminal.stopExecution")]}),(0,t.jsx)(D.TooltipContent,{side:"bottom",children:i("terminal.stopHint")})]})]}),(0,t.jsx)("div",{className:"flex-1 min-h-0",children:(0,t.jsx)(eI.TerminalOutlet,{taskId:e.id,worktreePath:v,onSessionEnd:R})})]}):"DONE"===b||"CANCELLED"===b?(0,t.jsx)("div",{className:"flex h-full flex-col overflow-hidden",children:(0,t.jsx)(A.ScrollArea,{className:"flex-1 min-h-0",children:(0,t.jsx)(e$.ExecutionTimeline,{executions:T})})}):(0,t.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,t.jsxs)("div",{className:"shrink-0 flex items-center gap-2 border-b border-border px-4 py-3",children:[I.length>0&&(0,t.jsxs)(g.Select,{defaultValue:L??"none",onValueChange:e=>B("none"===e?null:e),children:[(0,t.jsx)(g.SelectTrigger,{size:"sm",className:"min-w-[120px]",children:(0,t.jsx)("span",{className:"text-left truncate",children:L?I.find(e=>e.id===L)?.name??i("terminal.noPrompt"):i("terminal.noPrompt")})}),(0,t.jsxs)(g.SelectContent,{className:"min-w-[200px]",children:[(0,t.jsx)(g.SelectItem,{value:"none",children:i("terminal.noPrompt")}),I.map(e=>(0,t.jsxs)(g.SelectItem,{value:e.id,children:[e.name,e.isDefault?" ★":""]},e.id))]})]},`prompt-${I.length}`),(0,t.jsxs)(h.Button,{onClick:F,disabled:y,size:"sm",className:"gap-2 px-4",children:[y?(0,t.jsx)(K.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(X.Terminal,{className:"h-3.5 w-3.5"}),y?i("terminal.executing"):i("terminal.launch")]})]}),(0,t.jsx)(A.ScrollArea,{className:"flex-1 min-h-0",children:(0,t.jsx)(e$.ExecutionTimeline,{executions:T,onResume:M,onContinueLatest:$})})]}):(0,t.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-[#0f1419]",children:[(0,t.jsx)(K.Loader2,{className:"size-5 animate-spin text-neutral-500"}),(0,t.jsx)("span",{className:"text-xs text-neutral-500",children:i("execution.loading")})]})}):"changes"===m?(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:f?(0,t.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("taskPage.loadingDiff")})}):u?.branchDeleted?(0,t.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("taskPage.branchDeleted")})}):u?(0,t.jsx)(eT.TaskDiffView,{taskId:e.id,files:u.files,totalAdded:u.totalAdded,totalRemoved:u.totalRemoved,hasConflicts:u.hasConflicts,conflictFiles:u.conflictFiles,onCommit:Y,hasUncommitted:u.hasUncommitted}):(0,t.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("taskPage.noChanges")})})}):"notes"===m?(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,t.jsx)(e0,{taskId:e.id,projectId:e.projectId})}):null,(0,t.jsx)(eP.TaskMergeConfirmDialog,{open:z,onOpenChange:U,taskId:e.id,taskTitle:e.title,baseBranch:e.baseBranch??"main",fileCount:u?.files?.length??0,commitCount:u?.commitCount??0,commitLog:G,onMergeComplete:H})]})}var e5=e.i(938123),e3=e.i(852932);let e2=(0,ee.createServerReference)("40aa5b737a3c8b15f19d74784e47d3ec8be042714a",ee.callServer,void 0,ee.findSourceMapURL,"deleteTask"),e4=(0,ee.createServerReference)("406d2cdabab5795e4c05cfd5cfb944193885a68fd7",ee.callServer,void 0,ee.findSourceMapURL,"toggleTaskPinned");var e8=e.i(156075);let e7=(0,ee.createServerReference)("40e3150fc36b6ff94401f24846067b18788d1eaf37",ee.callServer,void 0,ee.findSourceMapURL,"getVersionsForPicker");var e6=e.i(19671);function e9({projects:e,activeProjectId:a,onSelect:r}){let n=(0,s.useRef)(null),[l,i]=(0,s.useState)(!1),[o,c]=(0,s.useState)(!1),d=()=>{let e=n.current;e&&(i(e.scrollLeft>0),c(e.scrollLeft<e.scrollWidth-e.clientWidth-1))};(0,s.useEffect)(()=>{d();let e=n.current;if(e){e.addEventListener("scroll",d);let t=new ResizeObserver(d);return t.observe(e),()=>{e.removeEventListener("scroll",d),t.disconnect()}}},[e]);let m=e=>{let t=n.current;t&&t.scrollBy({left:"left"===e?-150:150,behavior:"smooth"})};return(0,t.jsxs)("div",{className:"relative flex items-center",children:[l&&(0,t.jsx)("button",{onClick:()=>m("left"),className:"absolute left-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,t.jsx)(e6.ChevronLeft,{className:"h-4 w-4"})}),(0,t.jsx)("div",{ref:n,className:"flex items-center gap-1.5 overflow-x-auto scrollbar-none px-1 py-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:e.map(e=>{let s=a===e.id;return(0,t.jsxs)("button",{onClick:()=>{s||r(e.id)},className:`shrink-0 rounded-lg border-b-2 px-4 py-2 text-sm font-medium transition-colors ${s?"border-primary bg-primary/10 text-primary ring-1 ring-primary/20 cursor-default":"border-transparent text-muted-foreground hover:bg-accent hover:text-foreground cursor-pointer"}`,children:[(0,t.jsx)("span",{children:e.name}),e.alias&&(0,t.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:e.alias})]},e.id)})}),o&&(0,t.jsx)("button",{onClick:()=>m("right"),className:"absolute right-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,t.jsx)(G.ChevronRight,{className:"h-4 w-4"})})]})}var te=e.i(759686);function tt({open:e,onOpenChange:s,taskTitle:a,uncommittedFiles:r,commitLog:n,onConfirm:l}){let{t:i}=(0,o.useI18n)(),c=r.length,d=n.length,m=0===c&&0===d;return(0,t.jsx)(R.Dialog,{open:e,onOpenChange:s,children:(0,t.jsxs)(R.DialogContent,{showCloseButton:!0,className:"sm:max-w-md",children:[(0,t.jsx)(R.DialogHeader,{children:(0,t.jsxs)(R.DialogTitle,{className:"flex items-center gap-2",children:[(0,t.jsx)(te.AlertTriangle,{className:"h-4 w-4 text-amber-400"}),i("taskCancel.title")]})}),(0,t.jsxs)("div",{className:"space-y-3 py-2",children:[(0,t.jsxs)("div",{className:"rounded-lg border border-amber-500/20 bg-amber-500/10 p-3 space-y-1.5",children:[(0,t.jsx)("p",{className:"text-xs text-foreground",children:i("taskCancel.intro",{title:a})}),(0,t.jsx)("p",{className:"text-xs text-amber-300",children:i("taskCancel.irreversible")})]}),m?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:i("taskCancel.cleanNotice")}):(0,t.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 p-3 space-y-2.5",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:i("taskCancel.uncommittedFiles")}),(0,t.jsx)("span",{className:"text-xs font-medium text-foreground",children:c})]}),(0,t.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:i("taskCancel.unmergedCommits")}),(0,t.jsx)("span",{className:"text-xs font-medium text-foreground",children:d})]})]}),c>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground mb-1 block",children:i("taskCancel.filesList")}),(0,t.jsx)("div",{className:"rounded-md border border-border bg-muted/30 p-2 space-y-1 max-h-32 overflow-y-auto",children:r.map((e,s)=>(0,t.jsx)("div",{className:"text-xs font-mono text-foreground/80",children:e},s))})]}),d>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground mb-1 block",children:i("taskCancel.commitsList")}),(0,t.jsx)("div",{className:"rounded-md border border-border bg-muted/30 p-2 space-y-1 max-h-32 overflow-y-auto",children:n.map((e,s)=>(0,t.jsx)("div",{className:"text-xs font-mono text-foreground/80",children:e},s))}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-1.5",children:i("taskCancel.reflogHint")})]})]}),(0,t.jsxs)(R.DialogFooter,{children:[(0,t.jsx)(h.Button,{variant:"outline",onClick:()=>s(!1),children:i("taskCancel.keep")}),(0,t.jsxs)(h.Button,{variant:"destructive",onClick:l,className:"gap-2",children:[(0,t.jsx)(te.AlertTriangle,{className:"h-4 w-4"}),i("taskCancel.confirm")]})]})]})})}e.s(["BoardPageClient",0,function({workspaceId:e,projectId:r,project:n,projects:l,initialTasks:i,labels:d,openTaskId:m}){let x=(0,a.useRouter)(),{t:u}=(0,o.useI18n)(),[,h]=(0,s.useTransition)(),[p,g]=(0,s.useState)(""),[j,b]=(0,s.useState)("all"),[v,k]=(0,s.useState)(!1),[y,w]=(0,s.useState)("TODO"),[C,S]=(0,s.useState)(m??null),[T,P]=(0,s.useState)([]),I=C?i.find(e=>e.id===C)??null:null,[E,D]=(0,s.useState)(null),[L,B]=(0,s.useState)(null),[F,R]=(0,s.useState)(null);(0,s.useEffect)(()=>{e7(r).then(P).catch(()=>P([]))},[r]);let A=T.find(e=>e.isCurrent)?.id??null,O=(0,s.useCallback)(()=>{h(()=>{x.refresh()})},[x]);(0,s.useEffect)(()=>{if(v)return;let e=setInterval(()=>{h(()=>{x.refresh()})},5e3);return()=>clearInterval(e)},[x,v]);let M=(0,s.useCallback)(e=>{g(e)},[]),U=(0,s.useCallback)(async e=>{let t=i.find(t=>t.id===e);if(t)try{let s=await (0,eA.checkWorktreeClean)(e);if(s.hasWorktree&&!s.clean){ed.toast.error(u("taskPage.uncommittedChanges",{count:String(s.files.length)})),O();return}if(s.hasWorktree&&s.clean&&!s.hasCommits){ed.toast.error(u("taskPage.noChangesToComplete"),{action:{label:u("taskPage.markAsCancelled"),onClick:()=>{(0,eR.updateTaskStatus)(e,"CANCELLED").then(()=>{ed.toast.success(u("taskPage.taskCancelled")),O()}).catch(()=>ed.toast.error("Failed to cancel task"))}}}),O();return}if(s.hasWorktree&&s.hasCommits){B({task:t,commitLog:s.commitLog,commitCount:s.commitLog.length}),O();return}await (0,eR.updateTaskStatus)(e,"DONE"),ed.toast.success(u("taskPage.taskCompleted")),O()}catch{ed.toast.error("Failed to complete task"),O()}},[i,O,u]),G=(0,s.useCallback)(async e=>{let t=i.find(t=>t.id===e);if(t)try{let s=await (0,eA.checkWorktreeClean)(e);if(!s.hasWorktree){await (0,eR.updateTaskStatus)(e,"CANCELLED"),ed.toast.success(u("taskPage.taskCancelled")),O();return}R({task:t,files:s.files,commitLog:s.commitLog}),O()}catch{ed.toast.error("Failed to cancel task"),O()}},[i,O,u]),W=(0,s.useCallback)(async(e,t)=>{"DONE"===t?await U(e):"CANCELLED"===t?await G(e):(await (0,eR.updateTaskStatus)(e,t),O())},[O,U,G]),V=(0,s.useCallback)(async e=>{let t=await (0,e5.createTask)({title:e.title,description:e.description,projectId:r,priority:e.priority,status:e.status,labelIds:e.labelIds,baseBranch:e.baseBranch,subPath:e.subPath,versionId:e.versionId??void 0});if(e.autoStart&&t?.id)try{await (0,e8.startPtyExecution)(t.id,""),S(t.id)}catch(e){ed.toast.error(e instanceof Error?e.message:String(e))}O()},[r,O]),_=(0,s.useCallback)(async(e,t)=>{await (0,e3.updateTask)(e,{...t,labelIds:t.labelIds}),D(null),O()},[O]),H=(0,s.useCallback)(async e=>{await e2(e),C===e&&S(null),O()},[O,C]),K=(0,s.useCallback)(async e=>{await e4(e),O()},[O]),Y=(0,s.useCallback)(async t=>{try{await (0,e8.startPtyExecution)(t,"")}catch(e){ed.toast.error(e instanceof Error?e.message:String(e))}x.push(`/workspaces/${e}/tasks/${t}`)},[x,e]),q=(0,s.useCallback)(async(e,t)=>{"DONE"===t?await U(e):"CANCELLED"===t?await G(e):(await (0,eR.updateTaskStatus)(e,t),O())},[O,U,G]),J=(0,s.useCallback)(e=>{w(e),D(null),k(!0)},[]),X=(0,s.useCallback)(e=>{D(e),k(!0)},[]),Q=i.filter(e=>!e.labels?.some(e=>e.label.name===N.TOWER_LABEL_NAME&&e.label.isBuiltin)),Z=Q.filter(e=>{if("backlog"===j){if(e.versionId)return!1}else if("all"!==j&&e.versionId!==j)return!1;if(p.trim()){let t=p.toLowerCase();if(!e.title.toLowerCase().includes(t)&&!e.description?.toLowerCase().includes(t))return!1}return!0});return(0,t.jsxs)("div",{className:"flex h-full",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,t.jsx)("div",{className:"px-6 pt-3 pb-1",children:(0,t.jsx)(e9,{projects:l,activeProjectId:r,onSelect:t=>x.push(`/workspaces/${e}?projectId=${t}`,{scroll:!1})})}),(0,t.jsx)(c,{totalTasks:Q.length,runningTasks:Q.filter(e=>"IN_PROGRESS"===e.status).length}),(0,t.jsx)(f,{searchQuery:p,onSearchChange:M,versions:T,versionFilter:j,onVersionFilterChange:b,versionsHref:`/workspaces/${e}/projects/${r}/versions`,onCreateTask:()=>{D(null),k(!0)}}),(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:(0,t.jsx)($,{initialTasks:Z,onTaskMove:W,onTaskClick:e=>{S(e.id)},onEditTask:X,onAddTask:J,onDeleteTask:H,onTogglePin:K,workspaceId:e,onContextMenuStatusChange:q,onContextMenuLaunch:Y})}),(0,t.jsx)(z.CreateTaskDialog,{open:v,onOpenChange:e=>{k(e),e||D(null)},onSubmit:V,onUpdate:_,defaultStatus:y,editTask:E,editTaskLabelIds:E?.labels?E.labels.map(e=>e.labelId):[],labels:d.filter(e=>!(e.name===N.TOWER_LABEL_NAME&&e.isBuiltin)),projectType:n.type,projectLocalPath:n.localPath,versions:T,defaultVersionId:A})]}),I?(0,t.jsx)(e1,{task:I,workspaceId:e,projectLocalPath:n.localPath,onClose:()=>S(null)}):(0,t.jsx)(eN,{project:n,workspaceId:e}),L&&(0,t.jsx)(eP.TaskMergeConfirmDialog,{open:!0,onOpenChange:e=>{e||B(null)},taskId:L.task.id,taskTitle:L.task.title,baseBranch:L.task.baseBranch??"main",fileCount:0,commitCount:L.commitCount,commitLog:L.commitLog,onMergeComplete:()=>{B(null),ed.toast.success(u("taskPage.taskCompleted")),O()}}),F&&(0,t.jsx)(tt,{open:!0,onOpenChange:e=>{e||R(null)},taskTitle:F.task.title,uncommittedFiles:F.files,commitLog:F.commitLog,onConfirm:()=>{let e=F.task.id;R(null),(0,eR.updateTaskStatus)(e,"CANCELLED").then(()=>{ed.toast.success(u("taskPage.taskCancelled")),O()}).catch(()=>ed.toast.error("Failed to cancel task"))}})]})}],783426)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,783426,e=>{"use strict";var t=e.i(289721),s=e.i(965652),a=e.i(538059),r=e.i(340966),n=e.i(572989);let l=(0,n.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);var i=e.i(486077),o=e.i(533499);function c({totalTasks:e,runningTasks:s}){let{t:a}=(0,o.useI18n)();return(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-3 px-6 py-4",children:[(0,t.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"rounded-lg bg-sky-500/10 p-2 ring-1 ring-sky-500/20",children:(0,t.jsx)(r.ClipboardList,{className:"h-4 w-4 text-sky-400"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:a("board.overview")}),(0,t.jsx)("p",{className:"text-2xl font-bold font-mono tracking-tight text-foreground",children:e})]})]})}),(0,t.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"rounded-lg bg-primary/10 p-2 ring-1 ring-primary/20",children:(0,t.jsx)(l,{className:"h-4 w-4 text-primary"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:a("board.running")}),(0,t.jsx)("p",{className:"text-2xl font-bold font-mono tracking-tight text-foreground",children:s})]})]})}),(0,t.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"rounded-lg bg-emerald-500/10 p-2 ring-1 ring-emerald-500/20",children:(0,t.jsx)(i.Lightbulb,{className:"h-4 w-4 text-emerald-400"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:a("board.tip")}),(0,t.jsx)("p",{className:"text-xs font-medium text-foreground/80",children:a("board.tipText")})]})]})})]})}var d=e.i(210702),m=e.i(232545),x=e.i(738690),u=e.i(226145),h=e.i(519455),p=e.i(793479),g=e.i(280027);function f({searchQuery:e,onSearchChange:s,versions:a=[],versionFilter:r="all",onVersionFilterChange:n,versionsHref:l,onCreateTask:i}){let c,{t:j}=(0,o.useI18n)(),b="all"===r?j("board.allVersions"):"backlog"===r?j("board.backlogFilter"):(c=a.find(e=>e.id===r))?`${c.number} ${c.name}`:j("board.allVersions");return(0,t.jsxs)("div",{className:"flex items-center gap-2 px-6 py-2",children:[n&&(0,t.jsxs)(g.Select,{value:r,onValueChange:e=>n(e||"all"),children:[(0,t.jsxs)(g.SelectTrigger,{className:"h-8 w-44 shrink-0 gap-1.5 text-xs text-muted-foreground",children:[(0,t.jsx)(u.GitBranch,{className:"h-3.5 w-3.5 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:b})]}),(0,t.jsxs)(g.SelectContent,{children:[(0,t.jsx)(g.SelectItem,{value:"all",children:j("board.allVersions")}),(0,t.jsx)(g.SelectItem,{value:"backlog",children:j("board.backlogFilter")}),a.map(e=>(0,t.jsxs)(g.SelectItem,{value:e.id,children:[(0,t.jsx)("span",{className:"font-mono",children:e.number})," ",e.name]},e.id))]})]}),(0,t.jsxs)("div",{className:"relative flex-1 max-w-xs",children:[(0,t.jsx)(x.Search,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(p.Input,{type:"text",value:e,onChange:e=>s(e.target.value),placeholder:j("board.searchPlaceholder"),className:"pl-8 pr-3 text-xs"})]}),(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[l&&(0,t.jsx)(d.default,{href:l,children:(0,t.jsxs)(h.Button,{variant:"outline",className:"h-8 gap-1.5 text-xs text-muted-foreground",children:[(0,t.jsx)(u.GitBranch,{className:"h-3.5 w-3.5"}),j("version.timeline")]})}),(0,t.jsxs)(h.Button,{"data-tour":"create-task",variant:"outline",className:"gap-1.5 border-border text-xs text-muted-foreground hover:border-primary/30 hover:text-primary",onClick:i,children:[(0,t.jsx)(m.Plus,{className:"h-3.5 w-3.5"}),j("board.newTask")]})]})]})}var j=e.i(585012),b=e.i(597746),N=e.i(685149);function v({x:e,y:r,taskId:n,currentStatus:l,hasExecutions:i,workspaceId:c,onClose:d,onStatusChange:m,onLaunch:x}){let{t:u}=(0,o.useI18n)(),h=(0,a.useRouter)(),p=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=e=>{p.current&&!p.current.contains(e.target)&&d()},t=e=>{"Escape"===e.key&&d()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[d]);let g="flex items-center px-3 py-1.5 text-xs cursor-pointer hover:bg-accent rounded-sm w-full text-left",f=(0,t.jsxs)("div",{ref:p,style:{position:"fixed",top:r,left:e,zIndex:9999},className:"bg-popover border border-border rounded-md shadow-md py-1 min-w-[180px]",children:[(0,t.jsx)("div",{className:"px-3 py-1 text-[10px] text-muted-foreground uppercase tracking-wider",children:u("board.contextMenu.changeStatus")}),N.BOARD_COLUMNS.map(e=>(0,t.jsxs)("button",{type:"button",className:g,onClick:()=>{m(n,e.id),d()},children:[l===e.id?(0,t.jsx)(b.Check,{className:"h-3 w-3 mr-2 flex-shrink-0"}):(0,t.jsx)("span",{className:"w-5 flex-shrink-0"}),e.label]},e.id)),(0,t.jsx)("hr",{className:"my-1 border-border"}),(0,t.jsx)("button",{type:"button",className:`${g} ${i?"opacity-50 cursor-not-allowed":""}`,disabled:i,onClick:()=>{i||(x(n),d())},children:u("board.contextMenu.launch")}),"DONE"!==l&&"CANCELLED"!==l&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("hr",{className:"my-1 border-border"}),(0,t.jsx)("button",{type:"button",className:g,onClick:()=>{h.push(`/workspaces/${c}/tasks/${n}`),d()},children:u("board.contextMenu.goToDetail")})]})]});return"u"<typeof document?null:(0,j.createPortal)(f,document.body)}var k=e.i(720247),y=e.i(775712);let w=(0,n.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);var C=e.i(67013),S=e.i(49007),T=e.i(464249),P=e.i(998626);let I=(0,n.default)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);var E=e.i(487486),D=e.i(746798),L=e.i(755146),B=e.i(35967);function F({task:e,onClick:s,onEdit:a,onDelete:r,onTogglePin:n,onContextMenu:l}){let{t:i}=(0,o.useI18n)(),{attributes:c,listeners:d,setNodeRef:m,transform:x,transition:p,isDragging:g}=(0,y.useSortable)({id:e.id,data:{type:"task",task:e}}),f={transform:C.CSS.Transform.toString(x),transition:p,opacity:g?.4:1},j=N.PRIORITY_CONFIG[e.priority],b=!!e.baseBranch;return(0,t.jsxs)("div",{ref:m,style:f,...c,...d,className:"group cursor-grab rounded-lg border border-border bg-card p-3 transition-all hover:border-primary/20 hover:bg-accent/50 active:cursor-grabbing",onClick:s,onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),l?.(e,t.clientX,t.clientY)},"data-testid":"task-card",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-foreground",children:e.title}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",className:`transition-all ${e.pinned?"text-primary opacity-100":"text-muted-foreground opacity-0 group-hover:opacity-100"}`,onClick:t=>{t.stopPropagation(),n?.(e.id)},"aria-label":i(e.pinned?"board.unpin":"board.pin"),children:(0,t.jsx)(I,{className:`h-3.5 w-3.5 ${e.pinned?"-rotate-45":""}`})}),(0,t.jsxs)(L.DropdownMenu,{children:[(0,t.jsx)(L.DropdownMenuTrigger,{render:(0,t.jsx)("button",{className:"rounded-md p-0.5 text-muted-foreground opacity-0 transition-all hover:bg-background hover:text-foreground group-hover:opacity-100",onClick:e=>e.stopPropagation()}),children:(0,t.jsx)(S.MoreHorizontal,{className:"h-4 w-4"})}),(0,t.jsxs)(L.DropdownMenuContent,{align:"end",children:[(0,t.jsxs)(L.DropdownMenuItem,{onClick:t=>{t.stopPropagation(),a?.(e)},children:[(0,t.jsx)(T.Pencil,{className:"mr-2 h-3.5 w-3.5"}),i("common.edit")]}),(0,t.jsxs)(L.DropdownMenuItem,{className:"text-rose-400",onClick:t=>{t.stopPropagation(),r?.(e.id)},children:[(0,t.jsx)(P.Trash2,{className:"mr-2 h-3.5 w-3.5"}),i("common.delete")]})]})]})]})]}),e.description&&(0,t.jsx)("p",{className:"mt-1.5 line-clamp-3 text-xs leading-relaxed text-muted-foreground",children:e.description}),(0,t.jsxs)("div",{className:"mt-2.5 flex flex-wrap items-center gap-1.5",children:[(0,t.jsx)(E.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${j.color}`,children:j.label}),e.labels?.map(e=>(0,t.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-medium",style:{backgroundColor:e.label.color+"20",color:e.label.color},children:e.label.name},e.label.id)),(b||e.version)&&(0,t.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[b&&(0,t.jsxs)(D.Tooltip,{disableHoverablePopup:!0,children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)("span",{className:"inline-flex cursor-default items-center rounded-md border border-border bg-muted px-1 py-0.5 text-muted-foreground",onPointerDown:e=>e.stopPropagation(),children:(0,t.jsx)(u.GitBranch,{className:"h-2.5 w-2.5 shrink-0"})})}),(0,t.jsx)(D.TooltipContent,{side:"top",children:i("board.card.worktree",{branch:e.baseBranch??""})})]}),e.version&&(0,t.jsxs)(D.Tooltip,{disableHoverablePopup:!0,children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)("span",{className:"cursor-default",onPointerDown:e=>e.stopPropagation(),children:(0,t.jsx)(B.TaskVersionTag,{number:e.version.number,title:""})})}),(0,t.jsx)(D.TooltipContent,{side:"top",children:i("board.card.version",{number:e.version.number,name:e.version.name})})]})]})]})]})}var R=e.i(776639),A=e.i(759684);function O({open:e,onOpenChange:s,columnLabel:a,columnColor:r,tasks:n,onTaskClick:l}){let{t:i}=(0,o.useI18n)();return(0,t.jsx)(R.Dialog,{open:e,onOpenChange:s,children:(0,t.jsxs)(R.DialogContent,{className:"sm:max-w-6xl max-h-[80vh]",children:[(0,t.jsx)(R.DialogHeader,{children:(0,t.jsxs)(R.DialogTitle,{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:`h-2.5 w-2.5 rounded-full ${r}`}),(0,t.jsx)("span",{children:a}),(0,t.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-mono font-medium text-muted-foreground",children:n.length})]})}),(0,t.jsx)(A.ScrollArea,{className:"max-h-[680px]",children:(0,t.jsxs)("div",{className:"grid grid-cols-4 gap-3 pr-3",children:[n.map(e=>{let a=N.PRIORITY_CONFIG[e.priority];return(0,t.jsxs)("div",{className:"cursor-pointer rounded-lg border border-border bg-card p-3 transition-all hover:border-primary/20 hover:bg-accent/50",onClick:()=>{l?.(e),s(!1)},children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-foreground line-clamp-2",children:e.title}),e.description&&(0,t.jsx)("p",{className:"mt-1.5 line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:e.description}),(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-1.5 flex-wrap",children:[(0,t.jsx)(E.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${a.color}`,children:a.label}),e.labels?.map(e=>(0,t.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-medium",style:{backgroundColor:e.label.color+"20",color:e.label.color},children:e.label.name},e.label.id))]})]},e.id)}),0===n.length&&(0,t.jsx)("div",{className:"col-span-4 py-8 text-center text-sm text-muted-foreground",children:i("board.noTasks")})]})})]})})}function M({id:e,label:a,color:r,tasks:n,onTaskClick:l,onEditTask:i,onAddTask:c,onDeleteTask:d,onTogglePin:x,onContextMenu:u}){let{setNodeRef:p,isOver:g}=(0,k.useDroppable)({id:e}),[f,j]=(0,s.useState)(!1),{t:b}=(0,o.useI18n)();return(0,t.jsxs)("div",{className:`flex w-0 min-w-[220px] flex-1 flex-col min-h-0 border-r border-border/50 last:border-r-0 transition-colors ${g?"bg-primary/[0.06]":""}`,children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-3 py-2.5 border-b border-border/30",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:`h-2 w-2 rounded-full ${r}`}),(0,t.jsx)("span",{className:"text-xs font-semibold tracking-wide text-secondary-foreground",children:a}),(0,t.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-mono font-medium text-muted-foreground",children:n.length})]}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:()=>j(!0),className:"text-muted-foreground","aria-label":b("board.viewAll"),children:(0,t.jsx)(w,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:c,className:"text-muted-foreground","aria-label":"add",children:(0,t.jsx)(m.Plus,{className:"h-3.5 w-3.5"})})]})]}),(0,t.jsx)(O,{open:f,onOpenChange:j,columnLabel:a,columnColor:r,tasks:n,onTaskClick:l}),(0,t.jsx)(A.ScrollArea,{className:"flex-1 min-h-0",children:(0,t.jsx)("div",{ref:p,className:"flex flex-col gap-2 p-2",children:(0,t.jsx)(y.SortableContext,{items:n.map(e=>e.id),strategy:y.verticalListSortingStrategy,children:n.map(e=>(0,t.jsx)(F,{task:e,onClick:()=>l?.(e),onEdit:i,onDelete:d,onTogglePin:x,onContextMenu:u},e.id))})})})]})}function $({initialTasks:e,onTaskMove:a,onTaskClick:r,onEditTask:n,onAddTask:l,onDeleteTask:i,onTogglePin:o,onContextMenuStatusChange:c,onContextMenuLaunch:d,workspaceId:m}){let[x,u]=(0,s.useState)(e),[h,p]=(0,s.useState)(null),[g,f]=(0,s.useState)(null);(0,s.useEffect)(()=>{u(e)},[e]);let j=(0,k.useSensors)((0,k.useSensor)(k.PointerSensor,{activationConstraint:{distance:8}})),b=(0,s.useCallback)((e,t,s)=>{f({task:e,x:t,y:s})},[]),y=(0,s.useCallback)(e=>{let t=x.find(t=>t.id===e.active.id);t&&p(t)},[x]),w=(0,s.useCallback)(e=>{let t,{active:s,over:r}=e;if(p(null),!r)return;let n=s.id,l=r.id;if(N.BOARD_COLUMNS.some(e=>e.id===l))t=l;else{let e=x.find(e=>e.id===l);t=e?.status}t&&(u(e=>e.map(e=>e.id===n?{...e,status:t}:e)),a?.(n,t))},[x,a]);return(0,t.jsxs)(k.DndContext,{id:"kanban-board",sensors:j,collisionDetection:k.closestCorners,onDragStart:y,onDragEnd:w,children:[(0,t.jsx)("div",{className:"mx-2 flex h-full overflow-x-auto rounded-xl border border-border bg-card/50",children:N.BOARD_COLUMNS.map(e=>(0,t.jsx)(M,{id:e.id,label:e.label,color:e.color,tasks:x.filter(t=>t.status===e.id),onTaskClick:r,onEditTask:n,onAddTask:()=>l?.(e.id),onDeleteTask:i,onTogglePin:o,onContextMenu:b},e.id))}),(0,t.jsx)(k.DragOverlay,{children:h?(0,t.jsx)("div",{className:"rotate-3 scale-105",children:(0,t.jsx)(F,{task:h})}):null}),g&&(0,t.jsx)(v,{x:g.x,y:g.y,taskId:g.task.id,currentStatus:g.task.status,hasExecutions:(g.task._count?.executions??0)>0,workspaceId:m??"",onClose:()=>f(null),onStatusChange:(e,t)=>{c?.(e,t),f(null)},onLaunch:e=>{d?.(e),f(null)}})]})}var z=e.i(744798),U=e.i(232280),G=e.i(368490),W=e.i(645378),V=e.i(453889);let _=(0,n.default)("git-commit-vertical",[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]);var H=e.i(938499),K=e.i(400355),Y=e.i(233274),q=e.i(736061),J=e.i(460707),X=e.i(567860),Q=e.i(875840),Z=e.i(624687),ee=e.i(514798);let et=(0,ee.createServerReference)("608352de1cc1602250a8ff2ac89d7162a531657d3f",ee.callServer,void 0,ee.findSourceMapURL,"updateProject");var es=e.i(387292);let ea=(0,ee.createServerReference)("400af64baf5eef2e6b627a6d20a331f3d5763c2646",ee.callServer,void 0,ee.findSourceMapURL,"deleteProject"),er=(0,ee.createServerReference)("40f56c724ff4de28b52994d784fb8faf4cdeb0c411",ee.callServer,void 0,ee.findSourceMapURL,"getRecentLocalProjects"),en=(0,ee.createServerReference)("408bcb914d056275e6454a031cc4bc59ce08cf5bc5",ee.callServer,void 0,ee.findSourceMapURL,"getOrCreateTowerTaskId");var el=e.i(197550),ei=e.i(852494),eo=e.i(583329),ec=e.i(796997),ed=e.i(360112),em=e.i(224277),ex=e.i(905455);function eu({commits:e}){let{t:a}=(0,o.useI18n)(),[r,n]=(0,s.useState)(!1);return 0===e.length?null:(0,t.jsxs)("div",{children:[(0,t.jsxs)("button",{onClick:()=>n(!r),className:"flex w-full items-center justify-between py-1",children:[(0,t.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:a("git.commitLog")}),r?(0,t.jsx)(U.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,t.jsx)(G.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),r&&(0,t.jsx)("div",{className:"mt-1.5 space-y-0.5 max-h-64 overflow-y-auto",children:e.map(e=>(0,t.jsxs)("div",{className:"group flex items-start gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,t.jsx)(_,{className:"h-3 w-3 shrink-0 text-muted-foreground mt-0.5"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"text-xs text-foreground line-clamp-1",children:e.message}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,t.jsxs)("button",{onClick:()=>{navigator.clipboard.writeText(e.shortHash),ed.toast.success(`Copied ${e.shortHash}`)},className:"flex items-center gap-0.5 font-mono text-[10px] text-primary/70 hover:text-primary transition-colors",children:[e.shortHash,(0,t.jsx)(Q.Copy,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:e.author}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(e){let t=Math.floor((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m`;let s=Math.floor(t/60);if(s<24)return`${s}h`;let a=Math.floor(s/24);return a<30?`${a}d`:`${Math.floor(a/30)}mo`}(e.date)})]})]})]},e.hash))})]})}var eh=e.i(487278),ep=e.i(375306),eg=e.i(244354);function ef({localPath:e,stashes:a,hasChanges:r,onRefresh:n}){let{t:l}=(0,o.useI18n)(),[i,c]=(0,s.useState)(!1),[d,m]=(0,s.useState)(!1),[x,u]=(0,s.useState)(""),[g,f]=(0,s.useState)(null),j=async()=>{m(!0);try{await (0,eg.gitAction)(e,"stash-save",{message:x}),u(""),ed.toast.success(l("git.stashSaved")),await n()}catch(e){ed.toast.error(e instanceof Error?e.message:String(e))}finally{m(!1)}},b=async t=>{f(t);try{await (0,eg.gitAction)(e,"stash-pop",{index:t}),ed.toast.success(l("git.stashApplied")),await n()}catch(e){ed.toast.error(e instanceof Error?e.message:String(e))}finally{f(null)}},N=async t=>{f(t);try{await (0,eg.gitAction)(e,"stash-drop",{index:t}),ed.toast.success(l("git.stashDropped")),await n()}catch(e){ed.toast.error(e instanceof Error?e.message:String(e))}finally{f(null)}};return r||0!==a.length?(0,t.jsxs)("div",{children:[(0,t.jsxs)("button",{onClick:()=>c(!i),className:"flex w-full items-center justify-between py-1",children:[(0,t.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[l("git.stash")," ",a.length>0&&`(${a.length})`]}),i?(0,t.jsx)(U.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,t.jsx)(G.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),i&&(0,t.jsxs)("div",{className:"mt-1.5 space-y-2",children:[r&&(0,t.jsxs)("div",{className:"flex gap-1.5",children:[(0,t.jsx)(p.Input,{value:x,onChange:e=>u(e.target.value),placeholder:l("git.stashMsgPlaceholder"),className:"h-7 text-xs flex-1",onKeyDown:e=>"Enter"===e.key&&j()}),(0,t.jsx)(h.Button,{variant:"outline",size:"icon-sm",onClick:j,disabled:d,className:"shrink-0",children:d?(0,t.jsx)(K.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(eh.Archive,{className:"h-3 w-3"})})]}),a.length>0&&(0,t.jsx)("div",{className:"space-y-0.5",children:a.map(e=>(0,t.jsxs)("div",{className:"group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,t.jsx)(eh.Archive,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"flex-1 min-w-0 truncate text-xs text-foreground",children:e.message||`stash@{${e.index}}`}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:()=>b(e.index),disabled:g===e.index,className:"text-muted-foreground","aria-label":l("git.stashApply"),children:g===e.index?(0,t.jsx)(K.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(ep.ArrowUpFromLine,{className:"h-3 w-3"})}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:()=>N(e.index),disabled:g===e.index,className:"text-rose-400","aria-label":l("git.stashDrop"),children:(0,t.jsx)(P.Trash2,{className:"h-3 w-3"})})]})]},e.index))})]})]}):null}var ej=e.i(515135);function eb({value:e,ariaLabel:a}){let{t:r}=(0,o.useI18n)(),[n,l]=(0,s.useState)(!1),i=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(e);else{let t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}l(!0),ed.toast.success(r("common.copied")),setTimeout(()=>l(!1),1500)}catch{ed.toast.error(r("common.copyFailed"))}};return(0,t.jsxs)("div",{className:"flex items-center gap-1 rounded-md border border-border bg-muted/50 pl-3 pr-1 py-1.5",children:[(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",title:e,children:e}),(0,t.jsxs)(D.Tooltip,{children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",className:"shrink-0 text-muted-foreground","aria-label":a,onClick:i,children:n?(0,t.jsx)(b.Check,{className:"h-3 w-3 text-emerald-400"}):(0,t.jsx)(Q.Copy,{className:"h-3 w-3"})})}),(0,t.jsx)(D.TooltipContent,{children:n?r("common.copied"):r("common.copy")})]})]})}function eN({project:e,workspaceId:r}){let{t:n,locale:l}=(0,o.useI18n)(),i=(0,a.useRouter)(),[c,d]=(0,s.useState)(!0),[m,x]=(0,s.useState)(!0),[g,f]=(0,s.useState)(!1),[j,b]=(0,s.useState)(!1),[N,v]=(0,s.useState)(""),[k,y]=(0,s.useState)(!1),[w,C]=(0,s.useState)(!1),[S,I]=(0,s.useState)(!1),[E,L]=(0,s.useState)(e.name),[B,F]=(0,s.useState)(e.alias??""),[A,O]=(0,s.useState)(e.description??""),[M,$]=(0,s.useState)(e.localPath??""),[z,Q]=(0,s.useState)(e.projectType??"FRONTEND"),[ee,eh]=(0,s.useState)([]);(0,s.useEffect)(()=>{er(100).then(eh)},[]);let[ep,eg]=(0,s.useState)(!1),[ev,ek]=(0,s.useState)(""),[ey,ew]=(0,s.useState)(""),[eC,eS]=(0,s.useState)(""),[eT,eP]=(0,s.useState)(""),[eI,eE]=(0,s.useState)("FRONTEND"),[eD,eL]=(0,s.useState)(!1),[eB,eF]=(0,s.useState)(!1),[eR,eA]=(0,s.useState)(null),[eO,eM]=(0,s.useState)(!1),[e$,ez]=(0,s.useState)(!1),eU=e=>{ed.toast.info(e)},eG=(0,s.useCallback)(async()=>{if(e.localPath){eM(!0);try{let t=await fetch(`/api/git?path=${encodeURIComponent(e.localPath)}`);t.ok&&eA(await t.json())}catch{}finally{eM(!1)}}},[e.localPath]);(0,s.useEffect)(()=>{eG()},[eG]);let eW=async()=>{if(e.localPath){ez(!0);try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",path:e.localPath})})).ok?(eU(n("git.initSuccess")),await eG()):eU(n("git.initFailed"))}catch{eU(n("git.initFailed"))}finally{ez(!1)}}},eV=(e,t)=>{i.push(`/workspaces/${e}?projectId=${t}`,{scroll:!1}),i.refresh()},e_=async()=>{if(ey.trim()){eL(!0);try{let e=await (0,es.createProject)({name:ey.trim(),alias:eC.trim()||void 0,description:eT.trim()||void 0,localPath:ev,projectType:eI,workspaceId:r});eg(!1),eV(r,e.id)}catch(e){ed.toast.error(e instanceof Error?e.message:String(e))}finally{eL(!1)}}},eH=async()=>{if(M&&!eB){eF(!0);try{let e=await (0,ec.analyzeProjectDirectory)(M.trim(),l);O(e)}catch{ed.toast.error(n("project.analyzeError"))}finally{eF(!1)}}},eK=async()=>{try{await et(e.id,{name:E.trim(),alias:B.trim()||void 0,description:A.trim()||void 0,localPath:M.trim()||void 0,projectType:z}),i.refresh(),f(!1)}catch(e){ed.toast.error(e instanceof Error?e.message:String(e))}};return(0,t.jsxs)("aside",{className:"relative w-72 flex-shrink-0 overflow-y-auto border-l border-border bg-sidebar",children:[(0,t.jsxs)("div",{className:"border-b border-border p-4",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h2",{className:"text-base font-semibold text-foreground",children:e.name}),e.alias&&(0,t.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:e.alias})]}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{L(e.name),F(e.alias??""),O(e.description??""),$(e.localPath??""),f(!0)},className:"text-muted-foreground",children:(0,t.jsx)(T.Pencil,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{v(""),b(!0)},className:"text-muted-foreground hover:text-rose-400",children:(0,t.jsx)(P.Trash2,{className:"h-3.5 w-3.5"})})]})]}),e.description&&(0,t.jsx)("p",{className:"mt-2 text-sm text-secondary-foreground leading-relaxed line-clamp-4",children:e.description}),(0,t.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:(0,t.jsx)("span",{className:`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium ${"GIT"===e.type?"bg-sky-500/15 text-sky-300 ring-1 ring-sky-500/20":"bg-muted text-muted-foreground ring-1 ring-border"}`,children:"GIT"===e.type?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.GitBranch,{className:"h-3 w-3"}),n("sidebar.right.gitType")]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(W.FileText,{className:"h-3 w-3"}),n("sidebar.right.normalType")]})})}),(e.localPath||e.gitUrl)&&(0,t.jsxs)("div",{className:"mt-3 space-y-1.5",children:[e.localPath&&(0,t.jsx)(eb,{value:e.localPath,ariaLabel:n("project.localPath")}),e.gitUrl&&(0,t.jsx)(eb,{value:e.gitUrl,ariaLabel:n("project.gitUrl")})]}),e.localPath&&(0,t.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsxs)(D.Tooltip,{children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)(h.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,el.openInFileManager)(e.localPath)}catch(e){console.error("openInFileManager failed:",e),ed.toast.error(n("git.openInFileManagerFailed"))}},children:(0,t.jsx)(q.FolderSearch,{className:"h-4 w-4"})})}),(0,t.jsx)(D.TooltipContent,{children:n("git.openInFileManager")})]}),(0,t.jsxs)(D.Tooltip,{children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)(h.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,ei.openInEditor)(e.localPath)}catch(e){console.error("openInEditor failed:",e),ed.toast.error(n("git.openInEditorFailed"))}},children:(0,t.jsx)(J.Code,{className:"h-4 w-4"})})}),(0,t.jsx)(D.TooltipContent,{children:n("git.openInEditor")})]}),(0,t.jsxs)(D.Tooltip,{children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)(h.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,eo.openInTerminal)(e.localPath)}catch(e){console.error("openInTerminal failed:",e),ed.toast.error(n("git.openInTerminalFailed"))}},children:(0,t.jsx)(X.Terminal,{className:"h-4 w-4"})})}),(0,t.jsx)(D.TooltipContent,{children:n("git.openInTerminal")})]})]}),(0,t.jsxs)(h.Button,{variant:"outline",className:"w-full h-9 gap-1.5 text-xs",disabled:w,onClick:async()=>{C(!0);try{let t=await en(e.id);i.push(`/workspaces/${r}/tasks/${t}`)}catch{ed.toast.error(n("git.openStudioFailed"))}finally{C(!1)}},children:[w?(0,t.jsx)(K.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(V.FolderOpen,{className:"h-3.5 w-3.5"}),n("git.openStudio")]})]})]}),(0,t.jsxs)("div",{className:"border-b border-border p-4",children:[(0,t.jsxs)(h.Button,{variant:"ghost",onClick:()=>d(!c),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,t.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:n("git.section")}),c?(0,t.jsx)(U.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,t.jsx)(G.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),c&&(0,t.jsx)("div",{className:"mt-3",children:e.localPath?eO?(0,t.jsxs)("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:[(0,t.jsx)(K.Loader2,{className:"h-4 w-4 animate-spin"}),(0,t.jsx)("span",{className:"ml-2 text-xs",children:n("git.loading")})]}):eR&&!eR.isGit?(0,t.jsxs)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(H.AlertCircle,{className:"h-3.5 w-3.5"}),(0,t.jsx)("p",{className:"text-xs",children:n("git.notInitialized")})]}),(0,t.jsxs)(h.Button,{className:"mt-3 h-7 w-full gap-1.5 bg-primary/10 text-xs text-primary ring-1 ring-primary/20 hover:bg-primary/15",onClick:eW,disabled:e$,children:[e$?(0,t.jsx)(K.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(_,{className:"h-3 w-3"}),n("git.initRepo")]})]}):eR?.isGit?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("div",{className:"overflow-hidden h-[560px] flex flex-col",children:(0,t.jsx)(ej.EditorGitPanel,{localPath:e.localPath,mode:"project"})}),(0,t.jsx)(eu,{commits:eR.commits??[]}),(0,t.jsx)(ef,{localPath:e.localPath,stashes:eR.stashes??[],hasChanges:(eR.changedFiles??[]).length>0,onRefresh:eG})]}):null:(0,t.jsx)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(H.AlertCircle,{className:"h-3.5 w-3.5"}),(0,t.jsx)("p",{className:"text-xs",children:n("git.noLocalPath")})]})})})]}),(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)(h.Button,{variant:"ghost",onClick:()=>x(!m),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,t.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:n("sidebar.right.browseRepo")}),m?(0,t.jsx)(U.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,t.jsx)(G.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),m&&(0,t.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,t.jsxs)(h.Button,{variant:"outline",className:"w-full h-8 gap-1.5 text-xs",onClick:()=>I(!0),children:[(0,t.jsx)(V.FolderOpen,{className:"h-3.5 w-3.5"}),n("sidebar.right.browseRepo")]}),ee.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5 px-1",children:n("sidebar.right.recent")}),(0,t.jsx)("div",{className:"space-y-0.5",children:ee.map(s=>(0,t.jsxs)("button",{onClick:()=>{s.id!==e.id&&eV(s.workspaceId,s.id)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors ${s.id===e.id?"bg-primary/10 text-primary cursor-default":"hover:bg-accent cursor-pointer"}`,children:["GIT"===s.type?(0,t.jsx)(u.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,t.jsx)(V.FolderOpen,{className:"h-3 w-3 shrink-0 text-primary/70"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"truncate text-xs font-medium text-foreground",children:s.name}),s.localPath&&(0,t.jsx)("p",{className:"truncate text-[10px] font-mono text-muted-foreground",children:s.localPath})]})]},s.id))})]})]})]}),(0,t.jsx)(R.Dialog,{open:g,onOpenChange:f,children:(0,t.jsxs)(R.DialogContent,{style:{maxWidth:"32rem"},children:[(0,t.jsx)(R.DialogHeader,{children:(0,t.jsx)(R.DialogTitle,{children:n("project.edit")})}),(0,t.jsxs)("div",{className:"space-y-3 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.name")}),(0,t.jsx)(p.Input,{value:E,onChange:e=>L(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.type.label")}),(0,t.jsx)("div",{className:"mt-1.5",children:(0,t.jsx)(ex.SegmentedControl,{options:[{value:"FRONTEND",label:n("project.type.frontend")},{value:"BACKEND",label:n("project.type.backend")}],value:z,onChange:Q})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.alias")}),(0,t.jsx)(p.Input,{value:B,onChange:e=>F(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.description")}),(0,t.jsxs)(h.Button,{type:"button",variant:"ghost",onClick:eH,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!M||eB?"opacity-50":""}`,children:[eB?(0,t.jsx)(K.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(Y.Sparkles,{className:"h-3 w-3"}),eB?n("project.analyzing"):n("project.genDesc")]})]}),(0,t.jsx)(Z.Textarea,{value:A,onChange:e=>O(e.target.value),rows:2,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none max-h-[200px] overflow-y-auto"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.localPath")}),(0,t.jsx)("div",{className:"mt-1.5 break-all rounded-md border border-border bg-muted/50 px-3 py-2 font-mono text-xs text-muted-foreground",children:M||"—"})]})]}),(0,t.jsxs)(R.DialogFooter,{children:[(0,t.jsx)(h.Button,{variant:"outline",onClick:()=>f(!1),children:n("common.cancel")}),(0,t.jsx)(h.Button,{onClick:eK,disabled:!E.trim()||eB,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:n("common.save")})]})]})}),(0,t.jsx)(em.FolderBrowserDialog,{open:S,onOpenChange:I,onSelect:e=>{g?$(e):(e=>{let t=ee.find(t=>t.localPath===e);if(t)return eV(t.workspaceId,t.id);let s=e.split("/").filter(Boolean).pop()??"";ek(e),ew(s),eS(""),eP(""),eg(!0)})(e)}}),(0,t.jsx)(R.Dialog,{open:ep,onOpenChange:eg,children:(0,t.jsxs)(R.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(R.DialogHeader,{children:(0,t.jsx)(R.DialogTitle,{children:n("topbar.newProject")})}),(0,t.jsxs)("div",{className:"space-y-3 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.localPath")}),(0,t.jsx)("div",{className:"mt-1.5 rounded-md border border-border bg-muted/50 px-3 py-2 font-mono text-xs text-muted-foreground",children:ev})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.name")}),(0,t.jsx)(p.Input,{value:ey,onChange:e=>ew(e.target.value),placeholder:n("project.namePlaceholder"),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.type.label")}),(0,t.jsx)("div",{className:"mt-1.5",children:(0,t.jsx)(ex.SegmentedControl,{options:[{value:"FRONTEND",label:n("project.type.frontend")},{value:"BACKEND",label:n("project.type.backend")}],value:eI,onChange:eE})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.alias")}),(0,t.jsx)(p.Input,{value:eC,onChange:e=>eS(e.target.value),placeholder:n("project.aliasPlaceholder"),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.description")}),(0,t.jsx)(Z.Textarea,{value:eT,onChange:e=>eP(e.target.value),placeholder:n("project.descPlaceholder"),rows:2,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none"})]})]}),(0,t.jsxs)(R.DialogFooter,{children:[(0,t.jsx)(h.Button,{variant:"outline",onClick:()=>eg(!1),children:n("common.cancel")}),(0,t.jsxs)(h.Button,{onClick:e_,disabled:!ey.trim()||eD,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[eD?(0,t.jsx)(K.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,n("common.create")]})]})]})}),(0,t.jsx)(R.Dialog,{open:j,onOpenChange:e=>{b(e),e||v("")},children:(0,t.jsxs)(R.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(R.DialogHeader,{children:(0,t.jsx)(R.DialogTitle,{className:"text-rose-400",children:n("project.deleteTitle")})}),(0,t.jsxs)("div",{className:"space-y-3 py-2",children:[(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n("project.deleteWarning",{name:e.name})}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n("project.deleteIrreversible")}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.deleteConfirmLabel")}),(0,t.jsx)(p.Input,{value:N,onChange:e=>v(e.target.value),placeholder:n("project.deleteConfirmPlaceholder"),className:"mt-1.5",autoFocus:!0})]})]}),(0,t.jsxs)(R.DialogFooter,{children:[(0,t.jsx)(h.Button,{variant:"outline",onClick:()=>b(!1),children:n("common.cancel")}),(0,t.jsxs)(h.Button,{variant:"destructive",disabled:N!==n("project.deleteConfirmText")||k,onClick:async()=>{y(!0);try{await ea(e.id),ed.toast.success(n("project.deleteSuccess")),i.push(`/workspaces/${r}`)}catch{ed.toast.error(n("project.deleteFailed"))}finally{y(!1),b(!1)}},children:[k&&(0,t.jsx)(K.Loader2,{className:"h-3 w-3 animate-spin mr-1"}),n("project.deleteButton")]})]})]})})]})}var ev=e.i(475958),ek=e.i(313029),ey=e.i(301348),ew=e.i(259846),eC=e.i(975157);function eS({title:e,description:s,branch:a,baseBranch:r,version:n,hasConversation:l,updatedAt:i,openDir:c,onBack:d}){let{t:m}=(0,o.useI18n)();return(0,t.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(Y.Sparkles,{className:"h-3.5 w-3.5 text-primary"}),(0,t.jsx)("span",{className:"text-xs font-semibold text-primary",children:m("taskDetail.title")})]}),(0,t.jsxs)(h.Button,{variant:"ghost",onClick:d,className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground h-auto px-2 py-1",children:[(0,t.jsx)(ew.ArrowLeft,{className:"h-3.5 w-3.5"}),m("taskDetail.back")]})]}),(0,t.jsx)("h2",{className:"mt-2.5 text-lg font-bold tracking-tight text-foreground",children:e}),s&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:s}),(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[r?(0,t.jsxs)(E.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:[(0,t.jsx)(u.GitBranch,{className:"mr-1 h-3 w-3"}),r," · worktree"]}):a?(0,t.jsx)(E.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:m("taskDetail.directMode")}):null,n&&(0,t.jsx)(B.TaskVersionTag,{number:n.number,name:n.name,showName:!0}),l&&(0,t.jsx)(E.Badge,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-400 text-[10px] border border-emerald-500/20",children:m("taskDetail.hasConversation")}),(0,t.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[m("taskDetail.updatedAt")," ",(0,eC.formatRelativeTime)(i)]}),c&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-0.5",children:[(0,t.jsxs)(D.Tooltip,{children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)(h.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,el.openInFileManager)(c)}catch(e){console.error("openInFileManager failed:",e),ed.toast.error(m("git.openInFileManagerFailed"))}},children:(0,t.jsx)(q.FolderSearch,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(D.TooltipContent,{side:"bottom",children:m("git.openInFileManager")})]}),(0,t.jsxs)(D.Tooltip,{children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)(h.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,ei.openInEditor)(c)}catch(e){console.error("openInEditor failed:",e),ed.toast.error(m("git.openInEditorFailed"))}},children:(0,t.jsx)(J.Code,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(D.TooltipContent,{side:"bottom",children:m("git.openInEditor")})]}),(0,t.jsxs)(D.Tooltip,{children:[(0,t.jsx)(D.TooltipTrigger,{render:(0,t.jsx)(h.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,eo.openInTerminal)(c)}catch(e){console.error("openInTerminal failed:",e),ed.toast.error(m("git.openInTerminalFailed"))}},children:(0,t.jsx)(X.Terminal,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(D.TooltipContent,{side:"bottom",children:m("git.openInTerminal")})]})]})]})]})}var eT=e.i(14842),eP=e.i(865514),eI=e.i(83434),eE=e.i(188013),eD=e.i(37170),eL=e.i(429210),eB=e.i(473221),eF=e.i(382216),eR=e.i(714039),eA=e.i(309955),eO=e.i(629777),eM=e.i(436325),e$=e.i(326883),ez=e.i(631675);let eU=(0,n.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);var eG=e.i(657153),eW=e.i(867533),eV=e.i(563733);let e_=(0,ee.createServerReference)("4005f69c130644e6a8a2047e274defc0ceb38509d0",ee.callServer,void 0,ee.findSourceMapURL,"getTaskNotes");var eH=e.i(873753);let eK=(0,ee.createServerReference)("40c8eddee531b8553afe0724dfaffc11c2abe7b8ad",ee.callServer,void 0,ee.findSourceMapURL,"getTaskAssets");var eY=e.i(438304),eq=e.i(796299),eJ=e.i(235357),eX=e.i(144640),eQ=e.i(937304);let eZ=/\.(txt|md|json)$/i;function e0({taskId:e,projectId:a}){let{t:r}=(0,o.useI18n)(),n=(0,s.useRef)(null),[l,i]=(0,s.useState)([]),[c,d]=(0,s.useState)([]),[x,u]=(0,s.useState)(!1),[p,g]=(0,s.useState)(""),[f,j]=(0,s.useState)(""),[b,N]=(0,s.useState)(!1),[v,k]=(0,s.useState)(null);async function y(){p.trim()&&(await (0,eV.createNote)({title:p.trim(),content:f.trim(),projectId:a,taskId:e,category:"task"}),g(""),j(""),u(!1),e_(e).then(i))}async function w(e){await (0,eH.deleteNote)(e),i(t=>t.filter(t=>t.id!==e))}async function C(t){let s=t.target.files?.[0];if(s){N(!0);try{let t=new FormData;t.set("file",s),t.set("projectId",a),t.set("taskId",e),await (0,eY.uploadAsset)(t),eK(e).then(d)}finally{N(!1),n.current&&(n.current.value="")}}}async function S(e){await (0,eq.deleteAsset)(e),d(t=>t.filter(t=>t.id!==e))}function T(e){return(0,eQ.isImageAsset)(e.filename,e.mimeType)||eZ.test(e.filename)}function I(e){T(e)?k(e):ed.toast.info(r("assets.previewNotSupported"))}async function E(e){try{let t=await fetch("/api/internal/assets/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e.path})});if(!t.ok){let e=await t.json().catch(()=>({}));ed.toast.error(e.error||"Failed to reveal file")}}catch{ed.toast.error("Failed to reveal file")}}(0,s.useEffect)(()=>{e_(e).then(i),eK(e).then(d)},[e]);let D=v?(0,eQ.isImageAsset)(v.filename,v.mimeType)?"image":eZ.test(v.filename)?"text":null:null,L=c.filter(e=>(0,eQ.isImageAsset)(e.filename,e.mimeType)).map(e=>({id:e.id,url:(0,eQ.localPathToApiUrl)(e.path),filename:e.filename})),B=v?L.findIndex(e=>e.id===v.id):-1;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A.ScrollArea,{className:"h-full",children:(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,t.jsx)(W.FileText,{className:"h-3.5 w-3.5"}),r("taskPage.notes")]}),(0,t.jsxs)(h.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>u(!x),children:[x?(0,t.jsx)(eG.X,{className:"h-3 w-3"}):(0,t.jsx)(m.Plus,{className:"h-3 w-3"}),x?"":r("taskPage.addNote")]})]}),x&&(0,t.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,t.jsx)("input",{type:"text",value:p,onChange:e=>g(e.target.value),placeholder:r("taskPage.noteTitle"),className:"h-8 w-full rounded-md border border-border bg-background px-3 text-sm focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),(0,t.jsx)("textarea",{value:f,onChange:e=>j(e.target.value),placeholder:r("taskPage.noteContent"),rows:3,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-primary resize-none"}),(0,t.jsx)(h.Button,{className:"text-xs",onClick:y,disabled:!p.trim(),children:r("taskPage.addNote")})]}),(0,t.jsxs)("div",{className:"mt-2 space-y-2",children:[0===l.length&&!x&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:r("taskPage.noNotes")}),l.map(e=>(0,t.jsx)("div",{className:"group rounded-md border border-border bg-card p-3",children:(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("h4",{className:"text-sm font-medium truncate",children:e.title}),e.content&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-3 whitespace-pre-wrap",children:e.content}),(0,t.jsx)("p",{className:"mt-1 text-[10px] text-muted-foreground",children:new Date(e.createdAt).toLocaleString()})]}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:()=>w(e.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:r("taskPage.deleteNote"),children:(0,t.jsx)(P.Trash2,{className:"h-3.5 w-3.5"})})]})},e.id))]})]}),(0,t.jsxs)("div",{className:"px-4 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,t.jsx)(eU,{className:"h-3.5 w-3.5"}),r("taskPage.attachments")]}),(0,t.jsxs)(h.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>n.current?.click(),disabled:b,children:[(0,t.jsx)(ez.Upload,{className:"h-3 w-3"}),r("taskPage.uploadFile")]}),(0,t.jsx)("input",{ref:n,type:"file",className:"hidden",onChange:C})]}),(0,t.jsxs)("div",{className:"mt-2 space-y-1.5",children:[0===c.length&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:r("taskPage.noAttachments")}),c.map(e=>{var s;let a=T(e);return(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border bg-card px-3 py-2",children:[(0,t.jsx)(eU,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,t.jsx)("button",{type:"button",onClick:()=>I(e),disabled:!a,className:`min-w-0 flex-1 truncate text-left text-sm ${a?"cursor-pointer hover:underline":"cursor-default"}`,title:a?r("assets.preview"):e.filename,children:e.filename}),(0,t.jsx)("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:(s=e.size)?s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1024/1024).toFixed(1)} MB`:""}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5",children:[a&&(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:()=>I(e),className:"shrink-0 text-muted-foreground hover:bg-accent",title:r("assets.preview"),children:(0,t.jsx)(eW.Eye,{className:"h-3 w-3"})}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:()=>E(e),className:"shrink-0 text-muted-foreground hover:bg-accent",title:r("assets.revealInFinder"),children:(0,t.jsx)(V.FolderOpen,{className:"h-3 w-3"})}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:()=>S(e.id),className:"shrink-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",title:r("taskPage.deleteAttachment"),children:(0,t.jsx)(P.Trash2,{className:"h-3 w-3"})})]})]},e.id)})]})]})]})}),(0,t.jsx)(eJ.ImageLightbox,{imageUrl:"image"===D&&B>=0?L[B].url:null,filename:"image"===D&&B>=0?L[B].filename:"",open:"image"===D,onOpenChange:e=>{e||k(null)},assets:L.map(({url:e,filename:t})=>({url:e,filename:t})),currentIndex:B>=0?B:void 0,onIndexChange:e=>{let t=L[e];if(!t)return;let s=c.find(e=>e.id===t.id);s&&k(s)}}),(0,t.jsx)(eX.TextPreviewDialog,{url:"text"===D&&v?(0,eQ.localPathToApiUrl)(v.path):null,filename:v?.filename??"",open:"text"===D,onOpenChange:e=>{e||k(null)}})]})}function e1({task:e,workspaceId:r,projectLocalPath:n,onClose:l}){let{t:i}=(0,o.useI18n)(),c=(0,a.useRouter)(),{removePortal:d}=(0,eI.useTerminalPortal)(),[m,x]=(0,s.useState)("terminal"),[u,p]=(0,s.useState)(null),[f,j]=(0,s.useState)(!1),[b,N]=(0,s.useState)(e.status);(0,s.useEffect)(()=>{N(e.status)},[e.status]);let[v,k]=(0,s.useState)(null),[y,w]=(0,s.useState)(!1),[C,S]=(0,s.useState)(!1),[T,P]=(0,s.useState)([]);(0,s.useEffect)(()=>{k(null),w(!1),S(!1),P([]),p(null),x("terminal")},[e.id]);let[I,E]=(0,s.useState)([]),[L,B]=(0,s.useState)(null);(0,s.useEffect)(()=>{let e=!1;return(0,eM.getPrompts)().then(t=>{if(e)return;E(t.map(e=>({id:e.id,name:e.name,isDefault:e.isDefault})));let s=t.find(e=>e.isDefault);s&&B(s.id)}),()=>{e=!0}},[]),(0,s.useEffect)(()=>{k(null),S(!1);let t=!1;return(0,eE.getTaskExecutions)(e.id).then(e=>{if(t)return;let s=e[0];if(s?.status==="RUNNING"){let e=s.worktreePath||n||null;e&&k(e)}P(e.filter(e=>"RUNNING"!==e.status)),S(!0)}),()=>{t=!0}},[e.id]),(0,s.useEffect)(()=>{if("changes"!==m||"TODO"===b||"CANCELLED"===b)return;let t=!1;return j(!0),fetch(`/api/tasks/${e.id}/diff`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{t||p(e?.files||e?.branchDeleted?e:null)}).catch(()=>{t||p(null)}).finally(()=>{t||j(!1)}),()=>{t=!0}},[m,b,e.id]);let F=(0,s.useCallback)(async()=>{if(!y){w(!0),d(e.id);try{let t=await (0,eD.startPtyExecutionSafe)(e.id,"",L);if(!t.ok){w(!1),ed.toast.error(t.error||i("terminal.startFailed"));return}k(t.worktreePath??null),N("IN_PROGRESS")}catch(e){w(!1),ed.toast.error(e instanceof Error&&e.message?e.message:i("terminal.startFailed"))}}},[e.id,y,L,i]),R=(0,s.useCallback)(t=>{w(!1),k(null),d(e.id),0===t&&N("IN_REVIEW"),(0,eE.getTaskExecutions)(e.id).then(e=>{P(e.filter(e=>"RUNNING"!==e.status))}),c.refresh()},[c,e.id]),O=(0,s.useCallback)(async()=>{await (0,eL.stopPtyExecution)(e.id),w(!1),d(e.id),k(null),N("IN_REVIEW"),(0,eE.getTaskExecutions)(e.id).then(e=>{P(e.filter(e=>"RUNNING"!==e.status))}),c.refresh()},[e.id,c]),M=(0,s.useCallback)(async t=>{w(!0),d(e.id),k(null);try{let{worktreePath:s}=await (0,eB.resumePtyExecution)(e.id,t);k(s),N("IN_PROGRESS")}catch{w(!1)}},[e.id,d]),$=(0,s.useCallback)(async()=>{w(!0),d(e.id),k(null);try{let{worktreePath:t}=await (0,eF.continueLatestPtyExecution)(e.id);k(t),N("IN_PROGRESS")}catch(e){w(!1),ed.toast.error(e instanceof Error?e.message:String(e))}},[e.id,d]),[z,U]=(0,s.useState)(!1),[G,V]=(0,s.useState)([]),_=(0,s.useCallback)(async()=>{try{let t=await (0,eA.checkWorktreeClean)(e.id);if(t.hasWorktree&&!t.clean)return void ed.toast.error(i("taskPage.uncommittedChanges",{count:String(t.files.length)}));if(t.hasWorktree&&t.clean&&!t.hasCommits)return void ed.toast.error(i("taskPage.noChangesToComplete"),{action:{label:i("taskPage.markAsCancelled"),onClick:()=>{(0,eR.updateTaskStatus)(e.id,"CANCELLED").then(()=>{N("CANCELLED"),ed.toast.success(i("taskPage.taskCancelled")),c.refresh()}).catch(()=>ed.toast.error("Failed to cancel task"))}}});if(t.hasWorktree&&t.hasCommits){V(t.commitLog),U(!0);return}await (0,eR.updateTaskStatus)(e.id,"DONE"),N("DONE"),ed.toast.success(i("taskPage.taskCompleted")),c.refresh()}catch{ed.toast.error("Failed to complete task")}},[e.id,c,i]),H=(0,s.useCallback)(()=>{N("DONE"),U(!1),ed.toast.success(i("taskPage.taskCompleted")),c.refresh()},[c,i]),Y=(0,s.useCallback)(async t=>{try{let{hash:s}=await (0,eO.commitWorktreeChanges)(e.id,t);ed.toast.success(i("diff.commitSuccess",{hash:s})),c.refresh();let a=await fetch(`/api/tasks/${e.id}/diff`);if(a.ok){let e=await a.json();p(e?.files?e:null)}}catch(e){ed.toast.error(e instanceof Error?e.message:"Commit failed")}},[e.id,c,i]);return(0,t.jsxs)("div",{className:"flex h-full w-[600px] flex-shrink-0 flex-col border-l border-border bg-sidebar","data-testid":"task-detail-panel",children:[(0,t.jsx)(eS,{title:e.title,description:i("taskDetail.panelDescription"),branch:`task/${e.id}`,baseBranch:e.baseBranch,version:e.version??null,hasConversation:!1,updatedAt:e.updatedAt,openDir:v??(n?e.subPath?`${n}/${e.subPath}`:n:null),onBack:l}),(0,t.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-2",children:[(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsxs)("button",{onClick:()=>x("terminal"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"terminal"===m?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,t.jsx)(X.Terminal,{className:"h-3 w-3"}),i("terminal.execute")]}),(0,t.jsx)("button",{onClick:()=>x("changes"),className:`px-3 py-1 text-xs font-medium rounded-md ${"changes"===m?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:i("taskPage.changes")}),(0,t.jsxs)("button",{onClick:()=>x("notes"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"notes"===m?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,t.jsx)(W.FileText,{className:"h-3 w-3"}),i("taskPage.notes")]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:["IN_REVIEW"===b&&(0,t.jsxs)(h.Button,{size:"sm",onClick:_,className:"bg-emerald-500/15 text-emerald-400 ring-1 ring-emerald-500/20 hover:bg-emerald-500/25",children:[(0,t.jsx)(ey.CheckCircle2,{className:"h-3 w-3"}),i("taskPage.completeTask")]}),"DONE"!==b&&"CANCELLED"!==b&&(0,t.jsxs)(h.Button,{variant:"ghost",size:"sm",onClick:()=>c.push(`/workspaces/${r}/tasks/${e.id}`),className:"text-muted-foreground",children:[(0,t.jsx)(ev.ExternalLink,{className:"h-3 w-3"}),i("taskPage.viewDetails")]})]})]}),"terminal"===m?(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:C?v?(0,t.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,t.jsxs)("div",{className:"shrink-0 flex items-center justify-between border-b border-neutral-800 px-3 py-2 bg-[#0f1419]",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-emerald-400",children:[(0,t.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"}),i("execution.running")]}),(0,t.jsxs)(D.Tooltip,{children:[(0,t.jsxs)(D.TooltipTrigger,{onClick:O,className:"flex items-center gap-1.5 rounded-md bg-red-500/15 px-3 py-1 text-xs font-medium text-red-400 hover:bg-red-500/25 transition-colors",children:[(0,t.jsx)(ek.Square,{className:"h-3 w-3"}),i("terminal.stopExecution")]}),(0,t.jsx)(D.TooltipContent,{side:"bottom",children:i("terminal.stopHint")})]})]}),(0,t.jsx)("div",{className:"flex-1 min-h-0",children:(0,t.jsx)(eI.TerminalOutlet,{taskId:e.id,worktreePath:v,onSessionEnd:R})})]}):"DONE"===b||"CANCELLED"===b?(0,t.jsx)("div",{className:"flex h-full flex-col overflow-hidden",children:(0,t.jsx)(A.ScrollArea,{className:"flex-1 min-h-0",children:(0,t.jsx)(e$.ExecutionTimeline,{executions:T})})}):(0,t.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,t.jsxs)("div",{className:"shrink-0 flex items-center gap-2 border-b border-border px-4 py-3",children:[I.length>0&&(0,t.jsxs)(g.Select,{defaultValue:L??"none",onValueChange:e=>B("none"===e?null:e),children:[(0,t.jsx)(g.SelectTrigger,{size:"sm",className:"min-w-[120px]",children:(0,t.jsx)("span",{className:"text-left truncate",children:L?I.find(e=>e.id===L)?.name??i("terminal.noPrompt"):i("terminal.noPrompt")})}),(0,t.jsxs)(g.SelectContent,{className:"min-w-[200px]",children:[(0,t.jsx)(g.SelectItem,{value:"none",children:i("terminal.noPrompt")}),I.map(e=>(0,t.jsxs)(g.SelectItem,{value:e.id,children:[e.name,e.isDefault?" ★":""]},e.id))]})]},`prompt-${I.length}`),(0,t.jsxs)(h.Button,{onClick:F,disabled:y,size:"sm",className:"gap-2 px-4",children:[y?(0,t.jsx)(K.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(X.Terminal,{className:"h-3.5 w-3.5"}),y?i("terminal.executing"):i("terminal.launch")]})]}),(0,t.jsx)(A.ScrollArea,{className:"flex-1 min-h-0",children:(0,t.jsx)(e$.ExecutionTimeline,{executions:T,onResume:M,onContinueLatest:$})})]}):(0,t.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-[#0f1419]",children:[(0,t.jsx)(K.Loader2,{className:"size-5 animate-spin text-neutral-500"}),(0,t.jsx)("span",{className:"text-xs text-neutral-500",children:i("execution.loading")})]})}):"changes"===m?(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:f?(0,t.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("taskPage.loadingDiff")})}):u?.branchDeleted?(0,t.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("taskPage.branchDeleted")})}):u?(0,t.jsx)(eT.TaskDiffView,{taskId:e.id,files:u.files,totalAdded:u.totalAdded,totalRemoved:u.totalRemoved,hasConflicts:u.hasConflicts,conflictFiles:u.conflictFiles,onCommit:Y,hasUncommitted:u.hasUncommitted}):(0,t.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("taskPage.noChanges")})})}):"notes"===m?(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,t.jsx)(e0,{taskId:e.id,projectId:e.projectId})}):null,(0,t.jsx)(eP.TaskMergeConfirmDialog,{open:z,onOpenChange:U,taskId:e.id,taskTitle:e.title,baseBranch:e.baseBranch??"main",fileCount:u?.files?.length??0,commitCount:u?.commitCount??0,commitLog:G,onMergeComplete:H})]})}var e5=e.i(157972),e3=e.i(517677);let e2=(0,ee.createServerReference)("4071f63fb5bd8ebb5c5ff83388414c0dde47707af0",ee.callServer,void 0,ee.findSourceMapURL,"deleteTask"),e4=(0,ee.createServerReference)("4041a7f15aceb3c8450797ad6507b966941cca7fd7",ee.callServer,void 0,ee.findSourceMapURL,"toggleTaskPinned");var e7=e.i(892734);let e8=(0,ee.createServerReference)("407d238968d5d2100907c40c5bcc103f3ce332d5e8",ee.callServer,void 0,ee.findSourceMapURL,"getVersionsForPicker");var e6=e.i(19671);function e9({projects:e,activeProjectId:a,onSelect:r}){let n=(0,s.useRef)(null),[l,i]=(0,s.useState)(!1),[o,c]=(0,s.useState)(!1),d=()=>{let e=n.current;e&&(i(e.scrollLeft>0),c(e.scrollLeft<e.scrollWidth-e.clientWidth-1))};(0,s.useEffect)(()=>{d();let e=n.current;if(e){e.addEventListener("scroll",d);let t=new ResizeObserver(d);return t.observe(e),()=>{e.removeEventListener("scroll",d),t.disconnect()}}},[e]);let m=e=>{let t=n.current;t&&t.scrollBy({left:"left"===e?-150:150,behavior:"smooth"})};return(0,t.jsxs)("div",{className:"relative flex items-center",children:[l&&(0,t.jsx)("button",{onClick:()=>m("left"),className:"absolute left-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,t.jsx)(e6.ChevronLeft,{className:"h-4 w-4"})}),(0,t.jsx)("div",{ref:n,className:"flex items-center gap-1.5 overflow-x-auto scrollbar-none px-1 py-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:e.map(e=>{let s=a===e.id;return(0,t.jsxs)("button",{onClick:()=>{s||r(e.id)},className:`shrink-0 rounded-lg border-b-2 px-4 py-2 text-sm font-medium transition-colors ${s?"border-primary bg-primary/10 text-primary ring-1 ring-primary/20 cursor-default":"border-transparent text-muted-foreground hover:bg-accent hover:text-foreground cursor-pointer"}`,children:[(0,t.jsx)("span",{children:e.name}),e.alias&&(0,t.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:e.alias})]},e.id)})}),o&&(0,t.jsx)("button",{onClick:()=>m("right"),className:"absolute right-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,t.jsx)(G.ChevronRight,{className:"h-4 w-4"})})]})}var te=e.i(759686);function tt({open:e,onOpenChange:s,taskTitle:a,uncommittedFiles:r,commitLog:n,onConfirm:l}){let{t:i}=(0,o.useI18n)(),c=r.length,d=n.length,m=0===c&&0===d;return(0,t.jsx)(R.Dialog,{open:e,onOpenChange:s,children:(0,t.jsxs)(R.DialogContent,{showCloseButton:!0,className:"sm:max-w-md",children:[(0,t.jsx)(R.DialogHeader,{children:(0,t.jsxs)(R.DialogTitle,{className:"flex items-center gap-2",children:[(0,t.jsx)(te.AlertTriangle,{className:"h-4 w-4 text-amber-400"}),i("taskCancel.title")]})}),(0,t.jsxs)("div",{className:"space-y-3 py-2",children:[(0,t.jsxs)("div",{className:"rounded-lg border border-amber-500/20 bg-amber-500/10 p-3 space-y-1.5",children:[(0,t.jsx)("p",{className:"text-xs text-foreground",children:i("taskCancel.intro",{title:a})}),(0,t.jsx)("p",{className:"text-xs text-amber-300",children:i("taskCancel.irreversible")})]}),m?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:i("taskCancel.cleanNotice")}):(0,t.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 p-3 space-y-2.5",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:i("taskCancel.uncommittedFiles")}),(0,t.jsx)("span",{className:"text-xs font-medium text-foreground",children:c})]}),(0,t.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:i("taskCancel.unmergedCommits")}),(0,t.jsx)("span",{className:"text-xs font-medium text-foreground",children:d})]})]}),c>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground mb-1 block",children:i("taskCancel.filesList")}),(0,t.jsx)("div",{className:"rounded-md border border-border bg-muted/30 p-2 space-y-1 max-h-32 overflow-y-auto",children:r.map((e,s)=>(0,t.jsx)("div",{className:"text-xs font-mono text-foreground/80",children:e},s))})]}),d>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground mb-1 block",children:i("taskCancel.commitsList")}),(0,t.jsx)("div",{className:"rounded-md border border-border bg-muted/30 p-2 space-y-1 max-h-32 overflow-y-auto",children:n.map((e,s)=>(0,t.jsx)("div",{className:"text-xs font-mono text-foreground/80",children:e},s))}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-1.5",children:i("taskCancel.reflogHint")})]})]}),(0,t.jsxs)(R.DialogFooter,{children:[(0,t.jsx)(h.Button,{variant:"outline",onClick:()=>s(!1),children:i("taskCancel.keep")}),(0,t.jsxs)(h.Button,{variant:"destructive",onClick:l,className:"gap-2",children:[(0,t.jsx)(te.AlertTriangle,{className:"h-4 w-4"}),i("taskCancel.confirm")]})]})]})})}e.s(["BoardPageClient",0,function({workspaceId:e,projectId:r,project:n,projects:l,initialTasks:i,labels:d,openTaskId:m}){let x=(0,a.useRouter)(),{t:u}=(0,o.useI18n)(),[,h]=(0,s.useTransition)(),[p,g]=(0,s.useState)(""),[j,b]=(0,s.useState)("all"),[v,k]=(0,s.useState)(!1),[y,w]=(0,s.useState)("TODO"),[C,S]=(0,s.useState)(m??null),[T,P]=(0,s.useState)([]),I=C?i.find(e=>e.id===C)??null:null,[E,D]=(0,s.useState)(null),[L,B]=(0,s.useState)(null),[F,R]=(0,s.useState)(null);(0,s.useEffect)(()=>{e8(r).then(P).catch(()=>P([]))},[r]);let A=T.find(e=>e.isCurrent)?.id??null,O=(0,s.useCallback)(()=>{h(()=>{x.refresh()})},[x]);(0,s.useEffect)(()=>{if(v)return;let e=setInterval(()=>{h(()=>{x.refresh()})},5e3);return()=>clearInterval(e)},[x,v]);let M=(0,s.useCallback)(e=>{g(e)},[]),U=(0,s.useCallback)(async e=>{let t=i.find(t=>t.id===e);if(t)try{let s=await (0,eA.checkWorktreeClean)(e);if(s.hasWorktree&&!s.clean){ed.toast.error(u("taskPage.uncommittedChanges",{count:String(s.files.length)})),O();return}if(s.hasWorktree&&s.clean&&!s.hasCommits){ed.toast.error(u("taskPage.noChangesToComplete"),{action:{label:u("taskPage.markAsCancelled"),onClick:()=>{(0,eR.updateTaskStatus)(e,"CANCELLED").then(()=>{ed.toast.success(u("taskPage.taskCancelled")),O()}).catch(()=>ed.toast.error("Failed to cancel task"))}}}),O();return}if(s.hasWorktree&&s.hasCommits){B({task:t,commitLog:s.commitLog,commitCount:s.commitLog.length}),O();return}await (0,eR.updateTaskStatus)(e,"DONE"),ed.toast.success(u("taskPage.taskCompleted")),O()}catch{ed.toast.error("Failed to complete task"),O()}},[i,O,u]),G=(0,s.useCallback)(async e=>{let t=i.find(t=>t.id===e);if(t)try{let s=await (0,eA.checkWorktreeClean)(e);if(!s.hasWorktree){await (0,eR.updateTaskStatus)(e,"CANCELLED"),ed.toast.success(u("taskPage.taskCancelled")),O();return}R({task:t,files:s.files,commitLog:s.commitLog}),O()}catch{ed.toast.error("Failed to cancel task"),O()}},[i,O,u]),W=(0,s.useCallback)(async(e,t)=>{"DONE"===t?await U(e):"CANCELLED"===t?await G(e):(await (0,eR.updateTaskStatus)(e,t),O())},[O,U,G]),V=(0,s.useCallback)(async e=>{let t=await (0,e5.createTask)({title:e.title,description:e.description,projectId:r,priority:e.priority,status:e.status,labelIds:e.labelIds,baseBranch:e.baseBranch,subPath:e.subPath,versionId:e.versionId??void 0});if(e.autoStart&&t?.id)try{await (0,e7.startPtyExecution)(t.id,""),S(t.id)}catch(e){ed.toast.error(e instanceof Error?e.message:String(e))}O()},[r,O]),_=(0,s.useCallback)(async(e,t)=>{await (0,e3.updateTask)(e,{...t,labelIds:t.labelIds}),D(null),O()},[O]),H=(0,s.useCallback)(async e=>{await e2(e),C===e&&S(null),O()},[O,C]),K=(0,s.useCallback)(async e=>{await e4(e),O()},[O]),Y=(0,s.useCallback)(async t=>{try{await (0,e7.startPtyExecution)(t,"")}catch(e){ed.toast.error(e instanceof Error?e.message:String(e))}x.push(`/workspaces/${e}/tasks/${t}`)},[x,e]),q=(0,s.useCallback)(async(e,t)=>{"DONE"===t?await U(e):"CANCELLED"===t?await G(e):(await (0,eR.updateTaskStatus)(e,t),O())},[O,U,G]),J=(0,s.useCallback)(e=>{w(e),D(null),k(!0)},[]),X=(0,s.useCallback)(e=>{D(e),k(!0)},[]),Q=i.filter(e=>!e.labels?.some(e=>e.label.name===N.TOWER_LABEL_NAME&&e.label.isBuiltin)),Z=Q.filter(e=>{if("backlog"===j){if(e.versionId)return!1}else if("all"!==j&&e.versionId!==j)return!1;if(p.trim()){let t=p.toLowerCase();if(!e.title.toLowerCase().includes(t)&&!e.description?.toLowerCase().includes(t))return!1}return!0});return(0,t.jsxs)("div",{className:"flex h-full",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,t.jsx)("div",{className:"px-6 pt-3 pb-1",children:(0,t.jsx)(e9,{projects:l,activeProjectId:r,onSelect:t=>x.push(`/workspaces/${e}?projectId=${t}`,{scroll:!1})})}),(0,t.jsx)(c,{totalTasks:Q.length,runningTasks:Q.filter(e=>"IN_PROGRESS"===e.status).length}),(0,t.jsx)(f,{searchQuery:p,onSearchChange:M,versions:T,versionFilter:j,onVersionFilterChange:b,versionsHref:`/workspaces/${e}/projects/${r}/versions`,onCreateTask:()=>{D(null),k(!0)}}),(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:(0,t.jsx)($,{initialTasks:Z,onTaskMove:W,onTaskClick:e=>{S(e.id)},onEditTask:X,onAddTask:J,onDeleteTask:H,onTogglePin:K,workspaceId:e,onContextMenuStatusChange:q,onContextMenuLaunch:Y})}),(0,t.jsx)(z.CreateTaskDialog,{open:v,onOpenChange:e=>{k(e),e||D(null)},onSubmit:V,onUpdate:_,defaultStatus:y,editTask:E,editTaskLabelIds:E?.labels?E.labels.map(e=>e.labelId):[],labels:d.filter(e=>!(e.name===N.TOWER_LABEL_NAME&&e.isBuiltin)),projectType:n.type,projectLocalPath:n.localPath,versions:T,defaultVersionId:A})]}),I?(0,t.jsx)(e1,{task:I,workspaceId:e,projectLocalPath:n.localPath,onClose:()=>S(null)}):(0,t.jsx)(eN,{project:n,workspaceId:e}),L&&(0,t.jsx)(eP.TaskMergeConfirmDialog,{open:!0,onOpenChange:e=>{e||B(null)},taskId:L.task.id,taskTitle:L.task.title,baseBranch:L.task.baseBranch??"main",fileCount:0,commitCount:L.commitCount,commitLog:L.commitLog,onMergeComplete:()=>{B(null),ed.toast.success(u("taskPage.taskCompleted")),O()}}),F&&(0,t.jsx)(tt,{open:!0,onOpenChange:e=>{e||R(null)},taskTitle:F.task.title,uncommittedFiles:F.files,commitLog:F.commitLog,onConfirm:()=>{let e=F.task.id;R(null),(0,eR.updateTaskStatus)(e,"CANCELLED").then(()=>{ed.toast.success(u("taskPage.taskCancelled")),O()}).catch(()=>ed.toast.error("Failed to cancel task"))}})]})}],783426)}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,245697,e=>{"use strict";let t=(0,e.i(572989).default)("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);e.s(["Package",0,t],245697)},922541,e=>{"use strict";let t=(0,e.i(572989).default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);e.s(["RotateCcw",0,t],922541)},631675,e=>{"use strict";let t=(0,e.i(572989).default)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);e.s(["Upload",0,t],631675)},301348,181209,e=>{"use strict";var t=e.i(59737);e.s(["CheckCircle2",()=>t.default],301348);let a=(0,e.i(572989).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);e.s(["XCircle",0,a],181209)},475958,e=>{"use strict";let t=(0,e.i(572989).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",0,t],475958)},719329,e=>{"use strict";var t=e.i(514798);let a=(0,t.createServerReference)("40ceddd66888c984655eae0ed43100f49a0619a5ba",t.callServer,void 0,t.findSourceMapURL,"getPrompts");e.s(["getPrompts",0,a])},759686,e=>{"use strict";var t=e.i(567098);e.s(["AlertTriangle",()=>t.default])},991838,e=>{"use strict";var t=e.i(965652),a=e.i(770303);e.s(["useExtension",0,function(e){let s=(0,t.useContext)(a.ExtensionContext);if(!s)throw Error("useExtension must be used inside <ExtensionProvider>");return{status:s.statusMap[e],loading:s.loading,isInstalling:s.installing.has(e),install:()=>s.install(e),uninstall:()=>s.uninstall(e),refresh:()=>s.refresh(e)}}])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,245697,e=>{"use strict";let t=(0,e.i(572989).default)("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);e.s(["Package",0,t],245697)},922541,e=>{"use strict";let t=(0,e.i(572989).default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);e.s(["RotateCcw",0,t],922541)},631675,e=>{"use strict";let t=(0,e.i(572989).default)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);e.s(["Upload",0,t],631675)},301348,181209,e=>{"use strict";var t=e.i(59737);e.s(["CheckCircle2",()=>t.default],301348);let a=(0,e.i(572989).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);e.s(["XCircle",0,a],181209)},475958,e=>{"use strict";let t=(0,e.i(572989).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",0,t],475958)},436325,e=>{"use strict";var t=e.i(514798);let a=(0,t.createServerReference)("406e2e4cc47185291de78e1588274f4b8e46cedb04",t.callServer,void 0,t.findSourceMapURL,"getPrompts");e.s(["getPrompts",0,a])},759686,e=>{"use strict";var t=e.i(567098);e.s(["AlertTriangle",()=>t.default])},991838,e=>{"use strict";var t=e.i(965652),a=e.i(770303);e.s(["useExtension",0,function(e){let s=(0,t.useContext)(a.ExtensionContext);if(!s)throw Error("useExtension must be used inside <ExtensionProvider>");return{status:s.statusMap[e],loading:s.loading,isInstalling:s.installing.has(e),install:()=>s.install(e),uninstall:()=>s.uninstall(e),refresh:()=>s.refresh(e)}}])}]);
@@ -1,2 +1,2 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,368490,e=>{"use strict";var t=e.i(776405);e.s(["ChevronRight",()=>t.default])},245697,e=>{"use strict";let t=(0,e.i(572989).default)("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);e.s(["Package",0,t],245697)},259846,e=>{"use strict";let t=(0,e.i(572989).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,t],259846)},685149,e=>{"use strict";e.s(["BOARD_COLUMNS",0,[{id:"TODO",label:"To Do",color:"bg-slate-400"},{id:"IN_PROGRESS",label:"In Progress",color:"bg-amber-400"},{id:"IN_REVIEW",label:"In Review",color:"bg-sky-400"},{id:"DONE",label:"Done",color:"bg-emerald-400"},{id:"CANCELLED",label:"Cancelled",color:"bg-rose-400"}],"NOTE_CATEGORIES_PRESET",0,["账号","环境","需求","备忘"],"PRIORITY_CONFIG",0,{LOW:{label:"低",color:"bg-slate-500/20 text-slate-300 border border-slate-500/30"},MEDIUM:{label:"中",color:"bg-amber-500/20 text-amber-300 border border-amber-500/30"},HIGH:{label:"高",color:"bg-orange-500/20 text-orange-300 border border-orange-500/30"},CRITICAL:{label:"紧急",color:"bg-rose-500/20 text-rose-300 border border-rose-500/30"}},"TOWER_LABEL_NAME",0,"Tower"])},786508,e=>{"use strict";var t=e.i(514798);let a=(0,t.createServerReference)("403d1df8a142d93b5320c6f253ba669b1176f03d16",t.callServer,void 0,t.findSourceMapURL,"openInTerminal");e.s(["openInTerminal",0,a])},567860,e=>{"use strict";let t=(0,e.i(572989).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",0,t],567860)},35967,e=>{"use strict";var t=e.i(289721);let a=(0,e.i(572989).default)("milestone",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M18.172 6a2 2 0 0 1 1.414.586l2.06 2.06a1.207 1.207 0 0 1 0 1.708l-2.06 2.06a2 2 0 0 1-1.414.586H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z",key:"8gz4t4"}]]);var r=e.i(533499);let s=["bg-sky-500/20 text-sky-300 border border-sky-500/30","bg-amber-500/20 text-amber-300 border border-amber-500/30","bg-violet-500/20 text-violet-300 border border-violet-500/30","bg-emerald-500/20 text-emerald-300 border border-emerald-500/30","bg-rose-500/20 text-rose-300 border border-rose-500/30","bg-cyan-500/20 text-cyan-300 border border-cyan-500/30","bg-indigo-500/20 text-indigo-300 border border-indigo-500/30"];function l(e){return s[function(e){let t=0;for(let a=0;a<e.length;a++)t=31*t+e.charCodeAt(a)>>>0;return t}(e)%s.length]}let n={PLANNED:"bg-slate-500/20 text-slate-300 border border-slate-500/30",ACTIVE:"bg-emerald-500/20 text-emerald-300 border border-emerald-500/30",RELEASED:"bg-zinc-500/20 text-zinc-400 border border-zinc-500/30"};e.s(["TaskVersionTag",0,function({number:e,name:r,showName:s=!1,className:l="",title:n}){return(0,t.jsxs)("span",{className:`inline-flex items-center gap-1 rounded-md border border-border bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground ${l}`,title:n??(r?`${e} \xb7 ${r}`:e),children:[(0,t.jsx)(a,{className:"h-2.5 w-2.5 shrink-0"}),(0,t.jsx)("span",{className:"font-mono",children:e}),s&&r?(0,t.jsx)("span",{className:"max-w-[140px] truncate",children:r}):null]})},"VersionStatusBadge",0,function({status:e}){let{t:a}=(0,r.useI18n)();return(0,t.jsx)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${n[e]}`,children:a(`version.status.${e}`)})},"VersionTypeBadge",0,function({name:e}){let{t:a}=(0,r.useI18n)();return e?(0,t.jsx)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${l(e)}`,children:e}):(0,t.jsx)("span",{className:"inline-flex items-center rounded-full border border-border bg-muted/40 px-2 py-0.5 text-xs font-medium text-muted-foreground",children:a("version.type.uncategorized")})},"typeBadgeColor",0,l],35967)},453930,977998,12659,e=>{"use strict";var t=e.i(514798);let a=(0,t.createServerReference)("4010962b6e3809e9ec6adcc5e4727e5afa521b684c",t.callServer,void 0,t.findSourceMapURL,"openInFileManager");e.s(["openInFileManager",0,a],453930);let r=(0,t.createServerReference)("40ffbf43f53a51dbec34e07f44c777d2eac35a0385",t.callServer,void 0,t.findSourceMapURL,"openInEditor");e.s(["openInEditor",0,r],977998);let s=(0,e.i(572989).default)("circle-play",[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);e.s(["PlayCircle",0,s],12659)},736061,460707,e=>{"use strict";var t=e.i(572989);let a=(0,t.default)("folder-search",[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]);e.s(["FolderSearch",0,a],736061);let r=(0,t.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);e.s(["Code",0,r],460707)},606393,e=>{"use strict";let t=(0,e.i(572989).default)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);e.s(["Calendar",0,t],606393)},980376,822305,e=>{"use strict";var t=e.i(289721),a=e.i(225061),r=e.i(975157),s=e.i(519455),l=e.i(670123);function n({...e}){return(0,t.jsx)(a.Dialog.Portal,{"data-slot":"sheet-portal",...e})}function i({className:e,...s}){return(0,t.jsx)(a.Dialog.Backdrop,{"data-slot":"sheet-overlay",className:(0,r.cn)("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",e),...s})}e.s(["Sheet",0,function({...e}){return(0,t.jsx)(a.Dialog.Root,{"data-slot":"sheet",...e})},"SheetContent",0,function({className:e,children:o,side:d="right",showCloseButton:c=!0,...u}){return(0,t.jsxs)(n,{children:[(0,t.jsx)(i,{}),(0,t.jsxs)(a.Dialog.Popup,{"data-slot":"sheet-content","data-side":d,className:(0,r.cn)("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...u,children:[o,c&&(0,t.jsxs)(a.Dialog.Close,{"data-slot":"sheet-close",render:(0,t.jsx)(s.Button,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[(0,t.jsx)(l.XIcon,{}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})},"SheetDescription",0,function({className:e,...s}){return(0,t.jsx)(a.Dialog.Description,{"data-slot":"sheet-description",className:(0,r.cn)("text-sm text-muted-foreground",e),...s})},"SheetHeader",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"sheet-header",className:(0,r.cn)("flex flex-col gap-0.5 p-4",e),...a})},"SheetTitle",0,function({className:e,...s}){return(0,t.jsx)(a.Dialog.Title,{"data-slot":"sheet-title",className:(0,r.cn)("font-heading text-base font-medium text-foreground",e),...s})}],980376);var o=e.i(514798);let d=(0,o.createServerReference)("405fce19efb2cf0b35a9d14b1a7c8a55c28ea204f4",o.callServer,void 0,o.findSourceMapURL,"getTaskOverview");e.s(["getTaskOverview",0,d],822305)},605005,e=>{"use strict";var t=e.i(289721),a=e.i(965652),r=e.i(980376),s=e.i(759684),l=e.i(487486),n=e.i(519455),i=e.i(533499),o=e.i(938123),d=e.i(822305),c=e.i(74908),u=e.i(453930),m=e.i(977998),x=e.i(786508),p=e.i(744798),h=e.i(685149),f=e.i(606393),g=e.i(875840),b=e.i(245697),y=e.i(12659),j=e.i(736061),k=e.i(460707),w=e.i(567860);function v({added:e,removed:a}){let{t:r}=(0,i.useI18n)();return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs text-gray-500",children:[(0,t.jsx)("span",{children:r("diff.filesChanged",{count:String(e+a)})}),e>0&&(0,t.jsxs)("span",{className:"text-green-500",children:["+",e]}),a>0&&(0,t.jsxs)("span",{className:"text-red-500",children:["-",a]})]})}var N=e.i(35967),S=e.i(360112);e.s(["TaskOverviewDrawer",0,function({open:e,onOpenChange:I,taskId:C}){let{t:T}=(0,i.useI18n)(),[D,M]=(0,a.useState)(null),[E,L]=(0,a.useTransition)(),[R,$]=(0,a.useState)(!1),[O,P]=(0,a.useState)([]);(0,a.useEffect)(()=>{C&&e?L(async()=>{let e=await (0,d.getTaskOverview)(C);e&&(M(e),e.project?.workspaceId&&(0,c.getLabelsForWorkspace)(e.project.workspaceId).then(e=>{P(e.map(e=>({id:e.id,name:e.name,color:e.color,isBuiltin:e.isBuiltin})))}).catch(()=>P([])))}):M(null)},[C,e]);let A=D?h.BOARD_COLUMNS.find(e=>e.id===D.status):null,B=D?h.PRIORITY_CONFIG[D.priority]:null,z=D?.executions?.[0]??null,F=(()=>{if(z?.worktreePath)return z.worktreePath;let e=D?.project?.localPath;return e?D?.subPath?`${e}/${D.subPath}`:e:null})(),V=(()=>{let e=z?.gitStats;if(!e)return null;try{let t=JSON.parse(e);return{added:t.insertions??0,removed:t.deletions??0}}catch{return null}})(),_=async e=>{if(D?.project)try{let{autoStart:t,...a}=e;await (0,o.createTask)({...a,projectId:D.project.id}),S.toast.success(T("taskDrawer.duplicateSuccess")),$(!1),I(!1)}catch{S.toast.error(T("taskDrawer.duplicateFailed"))}};return(0,t.jsxs)(r.Sheet,{open:e,onOpenChange:I,children:[(0,t.jsxs)(r.SheetContent,{side:"right",className:"w-[380px] sm:max-w-[380px] p-0",children:[(0,t.jsxs)(r.SheetHeader,{className:"px-4 pt-4 pb-3 border-b border-border",children:[(0,t.jsx)(r.SheetTitle,{className:"text-base font-semibold leading-tight pr-8",children:D?.title??""}),(0,t.jsx)(r.SheetDescription,{className:"sr-only",children:T("taskDrawer.title")}),D&&(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[A&&(0,t.jsxs)(l.Badge,{variant:"secondary",className:"text-xs",children:[(0,t.jsx)("span",{className:`inline-block w-2 h-2 rounded-full mr-1.5 ${A.color}`}),A.label]}),B&&(0,t.jsx)(l.Badge,{variant:"secondary",className:`text-xs ${B.color}`,children:B.label}),D.version&&(0,t.jsx)(N.TaskVersionTag,{number:D.version.number,name:D.version.name,showName:!0})]})]}),(0,t.jsx)(s.ScrollArea,{className:"flex-1 h-[calc(100%-80px)]",children:E&&!D?(0,t.jsx)("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:T("assets.loading")}):D?(0,t.jsxs)("div",{className:"p-4 space-y-4",children:[(0,t.jsxs)("section",{children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-muted-foreground mb-1",children:T("taskDrawer.description")}),(0,t.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:D.description||T("taskDrawer.noDescription")})]}),D.labels.length>0&&(0,t.jsxs)("section",{children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:T("taskDrawer.labels")}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:D.labels.map(e=>(0,t.jsx)(l.Badge,{variant:"secondary",className:"text-xs",style:{backgroundColor:`${e.label.color}20`,color:e.label.color,borderColor:`${e.label.color}40`},children:e.label.name},e.label.id))})]}),(0,t.jsxs)("section",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(f.Calendar,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:T("taskDrawer.createdAt")}),(0,t.jsx)("span",{className:"text-foreground",children:new Date(D.createdAt).toLocaleDateString()})]}),(0,t.jsxs)("section",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(b.Package,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:T("taskDrawer.resources")}),(0,t.jsx)("span",{className:"text-foreground",children:D._count.assets})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:T("taskDrawer.fileChanges")}),V?(0,t.jsx)(v,{added:V.added,removed:V.removed}):(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:T("taskDrawer.noFileChanges")})]}),(0,t.jsxs)("section",{children:[(0,t.jsxs)("h4",{className:"text-xs font-medium text-muted-foreground mb-1.5 flex items-center gap-1.5",children:[(0,t.jsx)(y.PlayCircle,{className:"h-3.5 w-3.5"}),T("taskDrawer.lastExecution")]}),z?(0,t.jsxs)("div",{className:"rounded-md border border-border p-2.5 text-sm",children:[(0,t.jsx)(l.Badge,{variant:"secondary",className:"text-xs mb-1.5",children:z.status}),z.summary&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-4",children:z.summary.slice(0,200)})]}):(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:T("taskDrawer.noExecution")})]}),F&&(0,t.jsxs)("section",{className:"flex flex-col",children:[(0,t.jsxs)(n.Button,{variant:"ghost",className:"w-full h-8 justify-start gap-2 px-2 text-xs text-muted-foreground",onClick:async()=>{try{await (0,u.openInFileManager)(F)}catch(e){console.error("openInFileManager failed:",e),S.toast.error(T("git.openInFileManagerFailed"))}},children:[(0,t.jsx)(j.FolderSearch,{className:"h-3.5 w-3.5 shrink-0"}),T("git.openInFileManager")]}),(0,t.jsxs)(n.Button,{variant:"ghost",className:"w-full h-8 justify-start gap-2 px-2 text-xs text-muted-foreground",onClick:async()=>{try{await (0,m.openInEditor)(F)}catch(e){console.error("openInEditor failed:",e),S.toast.error(T("git.openInEditorFailed"))}},children:[(0,t.jsx)(k.Code,{className:"h-3.5 w-3.5 shrink-0"}),T("git.openInEditor")]}),(0,t.jsxs)(n.Button,{variant:"ghost",className:"w-full h-8 justify-start gap-2 px-2 text-xs text-muted-foreground",onClick:async()=>{try{await (0,x.openInTerminal)(F)}catch(e){console.error("openInTerminal failed:",e),S.toast.error(T("git.openInTerminalFailed"))}},children:[(0,t.jsx)(w.Terminal,{className:"h-3.5 w-3.5 shrink-0"}),T("git.openInTerminal")]})]}),(0,t.jsx)("section",{children:(0,t.jsxs)(n.Button,{variant:"default",className:"w-full",onClick:()=>{D&&$(!0)},disabled:!D,children:[(0,t.jsx)(g.Copy,{className:"h-4 w-4"}),T("taskDrawer.duplicate")]})})]}):null})]}),D?.project&&(0,t.jsx)(p.CreateTaskDialog,{open:R,onOpenChange:$,onSubmit:_,labels:O,projectType:D.project.type,projectLocalPath:D.project.localPath,prefillFromTask:{title:D.title,description:D.description,priority:D.priority,subPath:D.subPath,labelIds:D.labels.map(e=>e.label.id),baseBranch:D.baseBranch}})]})}],605005)},340873,e=>{"use strict";let t=(0,e.i(572989).default)("git-commit-horizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);e.s(["GitCommitHorizontal",0,t],340873)},960518,e=>{"use strict";let t=(0,e.i(572989).default)("git-compare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);e.s(["GitCompare",0,t],960518)},707631,(e,t,a)=>{t.exports=e=>{if(!e||"string"!=typeof e||e.match(/^\s+$/))return[];let t=e.split(`
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,368490,e=>{"use strict";var t=e.i(776405);e.s(["ChevronRight",()=>t.default])},245697,e=>{"use strict";let t=(0,e.i(572989).default)("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);e.s(["Package",0,t],245697)},259846,e=>{"use strict";let t=(0,e.i(572989).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,t],259846)},685149,e=>{"use strict";e.s(["BOARD_COLUMNS",0,[{id:"TODO",label:"To Do",color:"bg-slate-400"},{id:"IN_PROGRESS",label:"In Progress",color:"bg-amber-400"},{id:"IN_REVIEW",label:"In Review",color:"bg-sky-400"},{id:"DONE",label:"Done",color:"bg-emerald-400"},{id:"CANCELLED",label:"Cancelled",color:"bg-rose-400"}],"NOTE_CATEGORIES_PRESET",0,["账号","环境","需求","备忘"],"PRIORITY_CONFIG",0,{LOW:{label:"低",color:"bg-slate-500/20 text-slate-300 border border-slate-500/30"},MEDIUM:{label:"中",color:"bg-amber-500/20 text-amber-300 border border-amber-500/30"},HIGH:{label:"高",color:"bg-orange-500/20 text-orange-300 border border-orange-500/30"},CRITICAL:{label:"紧急",color:"bg-rose-500/20 text-rose-300 border border-rose-500/30"}},"TOWER_LABEL_NAME",0,"Tower"])},583329,e=>{"use strict";var t=e.i(514798);let a=(0,t.createServerReference)("40761db40351e40c001ff439284f4ab6a350d93b1b",t.callServer,void 0,t.findSourceMapURL,"openInTerminal");e.s(["openInTerminal",0,a])},567860,e=>{"use strict";let t=(0,e.i(572989).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",0,t],567860)},35967,e=>{"use strict";var t=e.i(289721);let a=(0,e.i(572989).default)("milestone",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M18.172 6a2 2 0 0 1 1.414.586l2.06 2.06a1.207 1.207 0 0 1 0 1.708l-2.06 2.06a2 2 0 0 1-1.414.586H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z",key:"8gz4t4"}]]);var r=e.i(533499);let s=["bg-sky-500/20 text-sky-300 border border-sky-500/30","bg-amber-500/20 text-amber-300 border border-amber-500/30","bg-violet-500/20 text-violet-300 border border-violet-500/30","bg-emerald-500/20 text-emerald-300 border border-emerald-500/30","bg-rose-500/20 text-rose-300 border border-rose-500/30","bg-cyan-500/20 text-cyan-300 border border-cyan-500/30","bg-indigo-500/20 text-indigo-300 border border-indigo-500/30"];function l(e){return s[function(e){let t=0;for(let a=0;a<e.length;a++)t=31*t+e.charCodeAt(a)>>>0;return t}(e)%s.length]}let n={PLANNED:"bg-slate-500/20 text-slate-300 border border-slate-500/30",ACTIVE:"bg-emerald-500/20 text-emerald-300 border border-emerald-500/30",RELEASED:"bg-zinc-500/20 text-zinc-400 border border-zinc-500/30"};e.s(["TaskVersionTag",0,function({number:e,name:r,showName:s=!1,className:l="",title:n}){return(0,t.jsxs)("span",{className:`inline-flex items-center gap-1 rounded-md border border-border bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground ${l}`,title:n??(r?`${e} \xb7 ${r}`:e),children:[(0,t.jsx)(a,{className:"h-2.5 w-2.5 shrink-0"}),(0,t.jsx)("span",{className:"font-mono",children:e}),s&&r?(0,t.jsx)("span",{className:"max-w-[140px] truncate",children:r}):null]})},"VersionStatusBadge",0,function({status:e}){let{t:a}=(0,r.useI18n)();return(0,t.jsx)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${n[e]}`,children:a(`version.status.${e}`)})},"VersionTypeBadge",0,function({name:e}){let{t:a}=(0,r.useI18n)();return e?(0,t.jsx)("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${l(e)}`,children:e}):(0,t.jsx)("span",{className:"inline-flex items-center rounded-full border border-border bg-muted/40 px-2 py-0.5 text-xs font-medium text-muted-foreground",children:a("version.type.uncategorized")})},"typeBadgeColor",0,l],35967)},197550,852494,12659,e=>{"use strict";var t=e.i(514798);let a=(0,t.createServerReference)("4072804d823a8f55231ec0829fb98a68bc38646216",t.callServer,void 0,t.findSourceMapURL,"openInFileManager");e.s(["openInFileManager",0,a],197550);let r=(0,t.createServerReference)("40a7283207727ed21a6ecaca85b390988b3687e1dd",t.callServer,void 0,t.findSourceMapURL,"openInEditor");e.s(["openInEditor",0,r],852494);let s=(0,e.i(572989).default)("circle-play",[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);e.s(["PlayCircle",0,s],12659)},736061,460707,e=>{"use strict";var t=e.i(572989);let a=(0,t.default)("folder-search",[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]);e.s(["FolderSearch",0,a],736061);let r=(0,t.default)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);e.s(["Code",0,r],460707)},606393,e=>{"use strict";let t=(0,e.i(572989).default)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);e.s(["Calendar",0,t],606393)},980376,661149,e=>{"use strict";var t=e.i(289721),a=e.i(225061),r=e.i(975157),s=e.i(519455),l=e.i(670123);function n({...e}){return(0,t.jsx)(a.Dialog.Portal,{"data-slot":"sheet-portal",...e})}function i({className:e,...s}){return(0,t.jsx)(a.Dialog.Backdrop,{"data-slot":"sheet-overlay",className:(0,r.cn)("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",e),...s})}e.s(["Sheet",0,function({...e}){return(0,t.jsx)(a.Dialog.Root,{"data-slot":"sheet",...e})},"SheetContent",0,function({className:e,children:o,side:d="right",showCloseButton:c=!0,...u}){return(0,t.jsxs)(n,{children:[(0,t.jsx)(i,{}),(0,t.jsxs)(a.Dialog.Popup,{"data-slot":"sheet-content","data-side":d,className:(0,r.cn)("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...u,children:[o,c&&(0,t.jsxs)(a.Dialog.Close,{"data-slot":"sheet-close",render:(0,t.jsx)(s.Button,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[(0,t.jsx)(l.XIcon,{}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})},"SheetDescription",0,function({className:e,...s}){return(0,t.jsx)(a.Dialog.Description,{"data-slot":"sheet-description",className:(0,r.cn)("text-sm text-muted-foreground",e),...s})},"SheetHeader",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"sheet-header",className:(0,r.cn)("flex flex-col gap-0.5 p-4",e),...a})},"SheetTitle",0,function({className:e,...s}){return(0,t.jsx)(a.Dialog.Title,{"data-slot":"sheet-title",className:(0,r.cn)("font-heading text-base font-medium text-foreground",e),...s})}],980376);var o=e.i(514798);let d=(0,o.createServerReference)("403b726cc7d9cff0549ec73b0b63b5550d931ba5bc",o.callServer,void 0,o.findSourceMapURL,"getTaskOverview");e.s(["getTaskOverview",0,d],661149)},605005,e=>{"use strict";var t=e.i(289721),a=e.i(965652),r=e.i(980376),s=e.i(759684),l=e.i(487486),n=e.i(519455),i=e.i(533499),o=e.i(157972),d=e.i(661149),c=e.i(339733),u=e.i(197550),m=e.i(852494),x=e.i(583329),p=e.i(744798),h=e.i(685149),g=e.i(606393),f=e.i(875840),b=e.i(245697),y=e.i(12659),j=e.i(736061),k=e.i(460707),w=e.i(567860);function v({added:e,removed:a}){let{t:r}=(0,i.useI18n)();return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs text-gray-500",children:[(0,t.jsx)("span",{children:r("diff.filesChanged",{count:String(e+a)})}),e>0&&(0,t.jsxs)("span",{className:"text-green-500",children:["+",e]}),a>0&&(0,t.jsxs)("span",{className:"text-red-500",children:["-",a]})]})}var N=e.i(35967),S=e.i(360112);e.s(["TaskOverviewDrawer",0,function({open:e,onOpenChange:I,taskId:C}){let{t:T}=(0,i.useI18n)(),[D,M]=(0,a.useState)(null),[E,L]=(0,a.useTransition)(),[R,$]=(0,a.useState)(!1),[O,P]=(0,a.useState)([]);(0,a.useEffect)(()=>{C&&e?L(async()=>{let e=await (0,d.getTaskOverview)(C);e&&(M(e),e.project?.workspaceId&&(0,c.getLabelsForWorkspace)(e.project.workspaceId).then(e=>{P(e.map(e=>({id:e.id,name:e.name,color:e.color,isBuiltin:e.isBuiltin})))}).catch(()=>P([])))}):M(null)},[C,e]);let A=D?h.BOARD_COLUMNS.find(e=>e.id===D.status):null,B=D?h.PRIORITY_CONFIG[D.priority]:null,z=D?.executions?.[0]??null,F=(()=>{if(z?.worktreePath)return z.worktreePath;let e=D?.project?.localPath;return e?D?.subPath?`${e}/${D.subPath}`:e:null})(),V=(()=>{let e=z?.gitStats;if(!e)return null;try{let t=JSON.parse(e);return{added:t.insertions??0,removed:t.deletions??0}}catch{return null}})(),_=async e=>{if(D?.project)try{let{autoStart:t,...a}=e;await (0,o.createTask)({...a,projectId:D.project.id}),S.toast.success(T("taskDrawer.duplicateSuccess")),$(!1),I(!1)}catch{S.toast.error(T("taskDrawer.duplicateFailed"))}};return(0,t.jsxs)(r.Sheet,{open:e,onOpenChange:I,children:[(0,t.jsxs)(r.SheetContent,{side:"right",className:"w-[380px] sm:max-w-[380px] p-0",children:[(0,t.jsxs)(r.SheetHeader,{className:"px-4 pt-4 pb-3 border-b border-border",children:[(0,t.jsx)(r.SheetTitle,{className:"text-base font-semibold leading-tight pr-8",children:D?.title??""}),(0,t.jsx)(r.SheetDescription,{className:"sr-only",children:T("taskDrawer.title")}),D&&(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[A&&(0,t.jsxs)(l.Badge,{variant:"secondary",className:"text-xs",children:[(0,t.jsx)("span",{className:`inline-block w-2 h-2 rounded-full mr-1.5 ${A.color}`}),A.label]}),B&&(0,t.jsx)(l.Badge,{variant:"secondary",className:`text-xs ${B.color}`,children:B.label}),D.version&&(0,t.jsx)(N.TaskVersionTag,{number:D.version.number,name:D.version.name,showName:!0})]})]}),(0,t.jsx)(s.ScrollArea,{className:"flex-1 h-[calc(100%-80px)]",children:E&&!D?(0,t.jsx)("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:T("assets.loading")}):D?(0,t.jsxs)("div",{className:"p-4 space-y-4",children:[(0,t.jsxs)("section",{children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-muted-foreground mb-1",children:T("taskDrawer.description")}),(0,t.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:D.description||T("taskDrawer.noDescription")})]}),D.labels.length>0&&(0,t.jsxs)("section",{children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:T("taskDrawer.labels")}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:D.labels.map(e=>(0,t.jsx)(l.Badge,{variant:"secondary",className:"text-xs",style:{backgroundColor:`${e.label.color}20`,color:e.label.color,borderColor:`${e.label.color}40`},children:e.label.name},e.label.id))})]}),(0,t.jsxs)("section",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(g.Calendar,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:T("taskDrawer.createdAt")}),(0,t.jsx)("span",{className:"text-foreground",children:new Date(D.createdAt).toLocaleDateString()})]}),(0,t.jsxs)("section",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(b.Package,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:T("taskDrawer.resources")}),(0,t.jsx)("span",{className:"text-foreground",children:D._count.assets})]}),(0,t.jsxs)("section",{children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:T("taskDrawer.fileChanges")}),V?(0,t.jsx)(v,{added:V.added,removed:V.removed}):(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:T("taskDrawer.noFileChanges")})]}),(0,t.jsxs)("section",{children:[(0,t.jsxs)("h4",{className:"text-xs font-medium text-muted-foreground mb-1.5 flex items-center gap-1.5",children:[(0,t.jsx)(y.PlayCircle,{className:"h-3.5 w-3.5"}),T("taskDrawer.lastExecution")]}),z?(0,t.jsxs)("div",{className:"rounded-md border border-border p-2.5 text-sm",children:[(0,t.jsx)(l.Badge,{variant:"secondary",className:"text-xs mb-1.5",children:z.status}),z.summary&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-4",children:z.summary.slice(0,200)})]}):(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:T("taskDrawer.noExecution")})]}),F&&(0,t.jsxs)("section",{className:"flex flex-col",children:[(0,t.jsxs)(n.Button,{variant:"ghost",className:"w-full h-8 justify-start gap-2 px-2 text-xs text-muted-foreground",onClick:async()=>{try{await (0,u.openInFileManager)(F)}catch(e){console.error("openInFileManager failed:",e),S.toast.error(T("git.openInFileManagerFailed"))}},children:[(0,t.jsx)(j.FolderSearch,{className:"h-3.5 w-3.5 shrink-0"}),T("git.openInFileManager")]}),(0,t.jsxs)(n.Button,{variant:"ghost",className:"w-full h-8 justify-start gap-2 px-2 text-xs text-muted-foreground",onClick:async()=>{try{await (0,m.openInEditor)(F)}catch(e){console.error("openInEditor failed:",e),S.toast.error(T("git.openInEditorFailed"))}},children:[(0,t.jsx)(k.Code,{className:"h-3.5 w-3.5 shrink-0"}),T("git.openInEditor")]}),(0,t.jsxs)(n.Button,{variant:"ghost",className:"w-full h-8 justify-start gap-2 px-2 text-xs text-muted-foreground",onClick:async()=>{try{await (0,x.openInTerminal)(F)}catch(e){console.error("openInTerminal failed:",e),S.toast.error(T("git.openInTerminalFailed"))}},children:[(0,t.jsx)(w.Terminal,{className:"h-3.5 w-3.5 shrink-0"}),T("git.openInTerminal")]})]}),(0,t.jsx)("section",{children:(0,t.jsxs)(n.Button,{variant:"default",className:"w-full",onClick:()=>{D&&$(!0)},disabled:!D,children:[(0,t.jsx)(f.Copy,{className:"h-4 w-4"}),T("taskDrawer.duplicate")]})})]}):null})]}),D?.project&&(0,t.jsx)(p.CreateTaskDialog,{open:R,onOpenChange:$,onSubmit:_,labels:O,projectType:D.project.type,projectLocalPath:D.project.localPath,prefillFromTask:{title:D.title,description:D.description,priority:D.priority,subPath:D.subPath,labelIds:D.labels.map(e=>e.label.id),baseBranch:D.baseBranch}})]})}],605005)},340873,e=>{"use strict";let t=(0,e.i(572989).default)("git-commit-horizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);e.s(["GitCommitHorizontal",0,t],340873)},960518,e=>{"use strict";let t=(0,e.i(572989).default)("git-compare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);e.s(["GitCompare",0,t],960518)},707631,(e,t,a)=>{t.exports=e=>{if(!e||"string"!=typeof e||e.match(/^\s+$/))return[];let t=e.split(`
2
2
  `);if(0===t.length)return[];let a=[],r=null,s=null,n=0,o=0,d=null,c=e=>{let[t,s]=l(e)??[];r={chunks:[],deletions:0,additions:0,from:t,to:s},a.push(r)},u=()=>{(!r||r.chunks.length)&&c()},m=e=>{if(!s)return;let[t]=s.changes.slice(-1);s.changes.push({type:t.type,[t.type]:!0,ln1:t.ln1,ln2:t.ln2,ln:t.ln,content:e})},x=[[/^diff\s/,c],[/^new file mode (\d+)$/,(e,t)=>{u(),r.new=!0,r.newMode=t[1],r.from="/dev/null"}],[/^deleted file mode (\d+)$/,(e,t)=>{u(),r.deleted=!0,r.oldMode=t[1],r.to="/dev/null"}],[/^old mode (\d+)$/,(e,t)=>{u(),r.oldMode=t[1]}],[/^new mode (\d+)$/,(e,t)=>{u(),r.newMode=t[1]}],[/^index\s[\da-zA-Z]+\.\.[\da-zA-Z]+(\s(\d+))?$/,(e,t)=>{u(),r.index=e.split(" ").slice(1),t[1]&&(r.oldMode=r.newMode=t[1].trim())}],[/^---\s/,e=>{u(),r.from=i(e)}],[/^\+\+\+\s/,e=>{u(),r.to=i(e)}],[/^@@\s+-(\d+),?(\d+)?\s+\+(\d+),?(\d+)?\s@@/,(e,t)=>{r||c(e);let[a,l,i,u]=t.slice(1);n=+a,o=+i,s={content:e,changes:[],oldStart:+a,oldLines:+(l||1),newStart:+i,newLines:+(u||1)},d={oldLines:+(l||1),newLines:+(u||1)},r.chunks.push(s)}],[/^\$/,m]],p=[[/^\$/,m],[/^-/,e=>{s&&(s.changes.push({type:"del",del:!0,ln:n++,content:e}),r.deletions++,d.oldLines--)}],[/^\+/,e=>{s&&(s.changes.push({type:"add",add:!0,ln:o++,content:e}),r.additions++,d.newLines--)}],[/^\s*/,e=>{s?.changes.push({type:"normal",normal:!0,ln1:n++,ln2:o++,content:e}),d.oldLines--,d.newLines--}]],h=e=>{d?(e=>{for(let[t,a]of p){let r=e.match(t);if(r){a(e,r);break}}0===d.oldLines&&0===d.newLines&&(d=null)})(e):(e=>{for(let[t,a]of x){let r=e.match(t);if(r){a(e,r);break}}})(e)};for(let e of t)h(e);return a};let r=/(a|i|w|c|o|1|2)\/.*(?=["']? ["']?(b|i|w|c|o|1|2)\/)|(b|i|w|c|o|1|2)\/.*$/g,s=/^(a|b|i|w|c|o|1|2)\//,l=e=>e?.match(r)?.map(e=>e.replace(s,"").replace(/("|')$/,"")),n=/^\\?['"]|\\?['"]$/g,i=e=>{let t=o(e,"-+").trim();return(t=c(t)).replace(n,"").replace(s,"")},o=(e,t)=>{if(e=m(e),!t&&String.prototype.trimLeft)return e.trimLeft();let a=u(t);return e.replace(RegExp(`^${a}+`),"")},d=/\t.*|\d{4}-\d\d-\d\d\s\d\d:\d\d:\d\d(.\d+)?\s(\+|-)\d\d\d\d/,c=e=>{let t=d.exec(e);return t&&(e=e.substring(0,t.index).trim()),e},u=e=>null==e?"\\s":e instanceof RegExp?e.source:`[${m(e).replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}]`,m=e=>`${e??""}`},196199,e=>{"use strict";var t=e.i(707631);function a(e){return e.replace(/\r\n/g,"\n")}e.s(["normalizeLF",0,a,"parseUnifiedDiff",0,function(e){return(0,t.default)(a(e))}])}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,245697,e=>{"use strict";let t=(0,e.i(572989).default)("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);e.s(["Package",0,t],245697)},368490,e=>{"use strict";var t=e.i(776405);e.s(["ChevronRight",()=>t.default])},567860,e=>{"use strict";let t=(0,e.i(572989).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",0,t],567860)},19671,e=>{"use strict";let t=(0,e.i(572989).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",0,t],19671)},301348,181209,e=>{"use strict";var t=e.i(59737);e.s(["CheckCircle2",()=>t.default],301348);let s=(0,e.i(572989).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);e.s(["XCircle",0,s],181209)},475958,e=>{"use strict";let t=(0,e.i(572989).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",0,t],475958)},673984,e=>{"use strict";let t=(0,e.i(572989).default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);e.s(["User",0,t],673984)},566606,e=>{"use strict";var t=e.i(289721),s=e.i(965652),a=e.i(538059),l=e.i(821957),i=e.i(519455),n=e.i(793479),r=e.i(905455),o=e.i(746798),d=e.i(224277),c=e.i(975157);function m({className:e,size:s="default",...a}){return(0,t.jsx)("div",{"data-slot":"card","data-size":s,className:(0,c.cn)("group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",e),...a})}function x({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-content",className:(0,c.cn)("px-4 group-data-[size=sm]/card:px-3",e),...s})}var h=e.i(400355),u=e.i(597746),p=e.i(657153),g=e.i(567860),f=e.i(301348),b=e.i(181209),j=e.i(533499);function v({adapterType:e,adapterLabel:a,provider:l,hideHeader:n,onResult:r}){let[o,d]=(0,s.useState)(!1),[N,y]=(0,s.useState)(null),{t:k}=(0,j.useI18n)();async function w(){if(!o){d(!0),y(null);try{let t=await fetch("/api/adapters/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({adapterType:e,provider:l})}),s=await t.json();y(s),r?.(s)}catch{let e={ok:!1,checks:[{name:"network_error",passed:!1,message:"Network request failed"}]};y(e),r?.(e)}finally{d(!1)}}}return(0,t.jsxs)("div",{className:"space-y-4",children:[!n&&(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"rounded-lg bg-emerald-100 dark:bg-emerald-900/30 p-2",children:(0,t.jsx)(g.Terminal,{className:"h-5 w-5 text-emerald-600 dark:text-emerald-400"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"font-semibold",children:k("settings.aiTools.cliVerification")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:k("settings.aiTools.cliVerificationDesc")})]})]}),(0,t.jsx)(m,{children:(0,t.jsxs)(x,{className:"p-6 space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("div",{children:a&&(0,t.jsx)("p",{className:"font-medium",children:a})}),(0,t.jsx)(i.Button,{onClick:w,disabled:o,variant:"outline",children:o?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Loader2,{className:"h-4 w-4 animate-spin mr-2"}),k("settings.aiTools.testing")]}):k("settings.aiTools.testConnection")})]}),N&&(0,t.jsxs)("div",{className:(0,c.cn)("rounded-lg border p-4 space-y-3",N.ok?"bg-green-50 border-green-200 dark:bg-green-950/20 dark:border-green-800":"bg-red-50 border-red-200 dark:bg-red-950/20 dark:border-red-800"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[N.ok?(0,t.jsx)(f.CheckCircle2,{className:"h-4 w-4 text-green-600 dark:text-green-400"}):(0,t.jsx)(b.XCircle,{className:"h-4 w-4 text-red-600 dark:text-red-400"}),(0,t.jsx)("span",{className:(0,c.cn)("text-sm font-medium",N.ok?"text-green-700 dark:text-green-300":"text-red-700 dark:text-red-300"),children:k(N.ok?"settings.aiTools.testPassed":"settings.aiTools.testFailed")})]}),(0,t.jsx)("div",{className:"space-y-2",children:N.checks.map(s=>(0,t.jsxs)("div",{className:"flex items-start gap-2 text-sm",children:[s.passed?(0,t.jsx)(u.Check,{className:"h-4 w-4 text-green-500 mt-0.5 shrink-0"}):(0,t.jsx)(p.X,{className:"h-4 w-4 text-red-500 mt-0.5 shrink-0"}),(0,t.jsx)("span",{className:(0,c.cn)(s.passed?"text-green-700 dark:text-green-300":"text-red-700 dark:text-red-300"),children:s.message})]},`${e}-${s.name}`))})]})]})})]})}var N=e.i(288285),y=e.i(673984),k=e.i(226145),w=e.i(245697),C=e.i(19671),T=e.i(368490),S=e.i(387091),L=e.i(15299),M=e.i(572989);let P=(0,M.default)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),B=(0,M.default)("languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);var R=e.i(232545),$=e.i(998626),z=e.i(453889),I=e.i(475958),U=e.i(887911),H=e.i(570835),F=e.i(514798);let O=(0,F.createServerReference)("60e4a419220a4075eb76a0587ff8e11e675f6c5cf2",F.callServer,void 0,F.findSourceMapURL,"completeOnboarding"),E=(0,F.createServerReference)("60b065b32bb69305b6e8ee9a922ad29fbd6b12beb1",F.callServer,void 0,F.findSourceMapURL,"setOnboardingExtensions");function q({username:e,onComplete:a}){let{t:l}=(0,j.useI18n)(),n=(0,U.listExtensionMetadata)(),[r,o]=(0,s.useState)(()=>new Set(n.map(e=>e.id))),[d,c]=(0,s.useState)(!1),m=n.length,x=r.size;async function u(){c(!0);let t=Array.from(r),s=[];if(t.length>0)for(let e of(await Promise.all(t.map(async e=>{try{let t=await (0,H.installExtension)(e);return{id:e,success:t.success}}catch{return{id:e,success:!1}}}))))e.success&&s.push(e.id);await E(t,s),await O(e),c(!1),a()}return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h2",{className:"text-xl font-semibold",children:l("onboarding.step4.title")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:l("onboarding.step4.desc")})]}),(0,t.jsx)("div",{className:"space-y-2",children:n.map(e=>{let s=e.icon,a=r.has(e.id);return(0,t.jsxs)("label",{className:"flex items-start gap-3 rounded-lg border border-border bg-background p-3 cursor-pointer hover:bg-accent/50 transition-colors",children:[(0,t.jsx)("input",{type:"checkbox",checked:a,onChange:()=>{var t;return t=e.id,void o(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},disabled:d,className:"mt-0.5 h-4 w-4 cursor-pointer accent-primary"}),(0,t.jsxs)("div",{className:"flex flex-1 items-start gap-3 min-w-0",children:[(0,t.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-muted",children:(0,t.jsx)(s,{className:"h-4 w-4 text-muted-foreground"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,t.jsxs)("span",{className:"shrink-0 text-xs text-muted-foreground",children:["~",e.sizeMB," MB"]})]}),(0,t.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:e.description}),(0,t.jsxs)("a",{href:e.homepageUrl,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"mt-1 inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:[(0,t.jsx)(I.ExternalLink,{className:"h-3 w-3"}),l("settings.extensions.visitHomepage")]})]})]})]},e.id)})}),x<m&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground italic",children:l("onboarding.step4.skipHint")}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(i.Button,{onClick:u,disabled:d,children:d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),l("onboarding.step4.installing")]}):0===x?l("onboarding.step4.continueWithoutInstall"):l("onboarding.step4.continue")})})]})}function D({step:e}){let s=[y.User,g.Terminal,k.GitBranch,w.Package][e-1]??y.User,a=["Profile","Connect","Configure","Extensions"][e-1]??"";return(0,t.jsxs)("div",{className:"relative h-full w-full overflow-hidden",children:[(0,t.jsx)("div",{className:"absolute inset-0 opacity-[0.07] text-white",style:{backgroundImage:"radial-gradient(circle, currentColor 1px, transparent 1px)",backgroundSize:"24px 24px"}}),(0,t.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{width:"380px",height:"380px",background:"radial-gradient(circle, oklch(0.80 0.14 75 / 0.25) 0%, oklch(0.80 0.14 75 / 0.08) 45%, transparent 70%)",animation:"ob-pulse 6s ease-in-out infinite"}}),(0,t.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border border-amber-400/25",style:{width:"260px",height:"260px",animation:"ob-spin 20s linear infinite"},children:(0,t.jsx)("div",{className:"absolute -top-1.5 left-1/2 -translate-x-1/2 h-3 w-3 rounded-full bg-amber-400",style:{boxShadow:"0 0 16px oklch(0.80 0.14 75 / 0.7)"}})}),(0,t.jsxs)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border border-amber-400/15",style:{width:"380px",height:"380px",animation:"ob-spin 30s linear infinite reverse"},children:[(0,t.jsx)("div",{className:"absolute -top-1 left-1/2 -translate-x-1/2 h-2 w-2 rounded-full bg-amber-400/70"}),(0,t.jsx)("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 h-1.5 w-1.5 rounded-full bg-amber-400/50"})]}),(0,t.jsx)("svg",{className:"absolute",style:{top:"18%",right:"22%",animation:"ob-float 8s ease-in-out infinite"},width:"44",height:"50",viewBox:"0 0 40 46",fill:"none",children:(0,t.jsx)("path",{d:"M20 1 L38 12 L38 34 L20 45 L2 34 L2 12 Z",stroke:"oklch(0.80 0.14 75 / 0.4)",strokeWidth:"1.5",fill:"oklch(0.80 0.14 75 / 0.06)"})}),(0,t.jsx)("svg",{className:"absolute",style:{bottom:"22%",left:"18%",animation:"ob-float 10s ease-in-out 2s infinite"},width:"32",height:"36",viewBox:"0 0 40 46",fill:"none",children:(0,t.jsx)("path",{d:"M20 1 L38 12 L38 34 L20 45 L2 34 L2 12 Z",stroke:"oklch(0.80 0.14 75 / 0.3)",strokeWidth:"1.5",fill:"oklch(0.80 0.14 75 / 0.05)"})}),(0,t.jsx)("div",{className:"absolute h-3.5 w-3.5 rounded-full bg-amber-400/40",style:{top:"30%",left:"28%",animation:"ob-float 7s ease-in-out 1s infinite"}}),(0,t.jsx)("div",{className:"absolute h-2.5 w-2.5 rounded-full bg-amber-400/30",style:{top:"65%",right:"30%",animation:"ob-float 9s ease-in-out 3s infinite"}}),(0,t.jsx)("div",{className:"absolute h-2 w-2 rounded-full bg-amber-400/20",style:{top:"45%",right:"15%",animation:"ob-float 6s ease-in-out 0.5s infinite"}}),(0,t.jsxs)("svg",{className:"absolute inset-0 h-full w-full text-white opacity-[0.12]",children:[(0,t.jsx)("line",{x1:"30%",y1:"25%",x2:"70%",y2:"45%",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 6",style:{animation:"ob-dash 12s linear infinite"}}),(0,t.jsx)("line",{x1:"65%",y1:"30%",x2:"35%",y2:"70%",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 6",style:{animation:"ob-dash 15s linear infinite reverse"}})]}),(0,t.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 flex items-center justify-center",children:(0,t.jsx)("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl border border-amber-400/35 bg-amber-500/10 backdrop-blur-sm transition-all duration-700",style:{boxShadow:"0 0 50px oklch(0.80 0.14 75 / 0.2)"},children:(0,t.jsx)(s,{className:"h-7 w-7 text-amber-400"})})}),(0,t.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 translate-y-12 text-center",children:(0,t.jsx)("p",{className:"text-[11px] font-medium tracking-widest uppercase text-amber-400/60",children:a})})]})}let V={host:"",ownerMatch:"*",localPathTemplate:""};e.s(["default",0,function(){let e,c,m,x=(0,a.useRouter)(),{t:h,locale:p,setLocale:f}=(0,j.useI18n)(),{theme:b,setTheme:M}=(0,l.useTheme)(),[I,U]=(0,s.useState)(!1),[H,F]=(0,s.useState)(1),[O,E]=(0,s.useState)(""),[_,A]=(0,s.useState)({}),G=Object.values(_).some(e=>e.ok),[W,X]=(0,s.useState)([]),[K,Z]=(0,s.useState)({...V}),[J,Q]=(0,s.useState)(!0),[Y,ee]=(0,s.useState)(0),[et,es]=(0,s.useState)(!1),[ea,el]=(0,s.useState)(!1);(0,s.useEffect)(()=>U(!0),[]);let ei=[{value:"light",label:(0,t.jsx)(S.Sun,{className:"h-4 w-4"})},{value:"dark",label:(0,t.jsx)(L.Moon,{className:"h-4 w-4"})},{value:"system",label:(0,t.jsx)(P,{className:"h-4 w-4"})}];function en(){F(e=>e+1)}function er(){F(e=>Math.max(1,e-1))}let eo=[{icon:y.User,label:h("onboarding.step1.title")},{icon:g.Terminal,label:h("onboarding.step2.title")},{icon:k.GitBranch,label:h("onboarding.step3.title")},{icon:w.Package,label:h("onboarding.step4.title")}];return(0,t.jsxs)("div",{className:"flex h-screen bg-background",children:[(0,t.jsx)("div",{className:"hidden xl:block xl:w-3/5 border-r border-border/50 bg-[oklch(0.13_0.006_260)]",children:(0,t.jsx)(D,{step:H})}),(0,t.jsx)("div",{className:"flex w-full flex-col items-center px-8 pt-[10vh] pb-10 xl:w-2/5 xl:px-16 overflow-y-auto",children:(0,t.jsxs)("div",{className:"w-full max-w-lg space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-8 w-8 rounded-lg"}),(0,t.jsx)("span",{className:"text-lg font-semibold tracking-tight",children:"Tower"})]}),(0,t.jsx)("div",{className:"flex items-center gap-1.5",children:eo.map((e,s)=>{let a=s+1,l=a===H,i=a<H,n=e.icon;return(0,t.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[s>0&&(0,t.jsx)("div",{className:`h-px w-4 transition-colors duration-500 ${i?"bg-primary":"bg-border"}`}),(0,t.jsxs)("div",{className:`flex items-center gap-1 shrink-0 rounded-full px-2 py-1 text-[11px] font-medium whitespace-nowrap transition-all duration-500 ${l?"bg-primary text-primary-foreground shadow-sm":i?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"}`,children:[i?(0,t.jsx)(u.Check,{className:"h-3 w-3 shrink-0"}):(0,t.jsx)(n,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{children:e.label})]})]},s)})})]}),(0,t.jsxs)("div",{children:[1===H&&(0,t.jsxs)("div",{className:"space-y-7 animate-in fade-in slide-in-from-left-4 duration-500",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:h("onboarding.step1.title")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:h("onboarding.step1.desc")})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{htmlFor:"onboarding-username",className:"text-sm font-medium",children:h("onboarding.step1.usernameLabel")}),(0,t.jsx)("input",{id:"onboarding-username",type:"text",value:O,onChange:e=>E(e.target.value),placeholder:h("onboarding.step1.usernamePlaceholder"),className:"flex h-10 w-full rounded-lg border border-input bg-transparent px-3 py-2 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",maxLength:64,autoFocus:!0,autoComplete:"username"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,t.jsxs)("div",{className:"space-y-2.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(B,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,t.jsx)("label",{className:"text-sm font-medium",children:h("settings.language")})]}),(0,t.jsx)(r.SegmentedControl,{options:[{value:"zh",label:"中文"},{value:"en",label:"English"}].map(e=>({value:e.value,label:e.label})),value:p,onChange:e=>f(e)})]}),(0,t.jsxs)("div",{className:"space-y-2.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(S.Sun,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,t.jsx)("label",{className:"text-sm font-medium",children:h("settings.theme")})]}),I?(0,t.jsx)(r.SegmentedControl,{options:ei.map(e=>({value:e.value,label:e.label})),value:b??"system",onChange:e=>M(e)}):(0,t.jsx)("div",{className:"inline-flex h-8 rounded-md border border-border bg-muted p-1 gap-1 w-[120px]"})]})]}),(0,t.jsx)("div",{className:"flex justify-end pt-3",children:(0,t.jsxs)(i.Button,{onClick:en,disabled:0===O.trim().length,className:"px-5",children:[h("onboarding.step1.next"),(0,t.jsx)(T.ChevronRight,{className:"h-4 w-4 ml-1"})]})})]}),2===H&&(0,t.jsxs)("div",{className:"space-y-7 animate-in fade-in slide-in-from-left-4 duration-500",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:h("onboarding.step2.title")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:h("onboarding.step2.desc")})]}),(0,t.jsx)(v,{adapterType:"claude_code",adapterLabel:"Claude CLI",provider:"claude",onResult:e=>A(t=>({...t,claude:e}))}),(0,t.jsx)(v,{adapterType:"codex_cli",adapterLabel:"Codex CLI",provider:"codex",hideHeader:!0,onResult:e=>A(t=>({...t,codex:e}))}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-3",children:[(0,t.jsxs)(i.Button,{variant:"ghost",className:"text-muted-foreground",onClick:er,children:[(0,t.jsx)(C.ChevronLeft,{className:"h-4 w-4 mr-1"}),h("onboarding.back")]}),(0,t.jsxs)(i.Button,{onClick:en,disabled:!G,className:"px-5",children:[h("onboarding.step1.next"),(0,t.jsx)(T.ChevronRight,{className:"h-4 w-4 ml-1"})]})]})]}),3===H&&(0,t.jsxs)("div",{className:"space-y-5 animate-in fade-in slide-in-from-left-4 duration-500",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:h("onboarding.step3.title")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:h("onboarding.step3.desc")})]}),W.length>0&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:h("onboarding.step3.added").replace("{count}",String(W.length))}),W.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/30 px-3 py-2",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("p",{className:"text-sm font-medium truncate",children:[e.host,(0,t.jsx)("span",{className:"text-muted-foreground",children:"*"!==e.ownerMatch?` / ${e.ownerMatch}`:""})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground font-mono truncate",children:e.localPathTemplate})]}),(0,t.jsx)(i.Button,{variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>{var t;return t=e.id,void X(e=>e.filter(e=>e.id!==t))},children:(0,t.jsx)($.Trash2,{className:"h-3.5 w-3.5"})})]},e.id))]}),J?(0,t.jsxs)("div",{className:"space-y-3 rounded-lg border border-border p-4",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium",children:h("onboarding.step3.hostLabel")}),(0,t.jsx)(n.Input,{value:K.host,onChange:e=>Z(t=>({...t,host:e.target.value})),placeholder:h("onboarding.step3.hostPlaceholder"),className:"h-9",autoFocus:!0})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium",children:h("onboarding.step3.ownerLabel")}),(0,t.jsx)(n.Input,{value:K.ownerMatch,onChange:e=>Z(t=>({...t,ownerMatch:e.target.value})),placeholder:h("onboarding.step3.ownerPlaceholder"),className:"h-9"})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"block text-xs font-medium",children:h("onboarding.step3.pathLabel")}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(n.Input,{value:K.localPathTemplate,onChange:e=>Z(t=>({...t,localPathTemplate:e.target.value})),placeholder:h("onboarding.step3.pathPlaceholder"),className:"h-9 font-mono text-xs flex-1"}),(0,t.jsxs)(o.Tooltip,{children:[(0,t.jsx)(o.TooltipTrigger,{render:(0,t.jsx)(i.Button,{variant:et?"default":"outline",size:"sm",type:"button",onClick:()=>{es(e=>(e||ee(2),!e))},className:"shrink-0 font-mono",children:"{path}"})}),(0,t.jsx)(o.TooltipContent,{side:"top",className:"max-w-xs",children:(0,t.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,t.jsx)("div",{className:"font-medium",children:h("settings.config.git.pathTooltipTitle")}),(0,t.jsx)("div",{className:"opacity-80",children:h("settings.config.git.pathTooltipDetail")})]})})]}),(0,t.jsxs)(o.Tooltip,{children:[(0,t.jsx)(o.TooltipTrigger,{render:(0,t.jsx)(i.Button,{variant:"outline",size:"icon",type:"button",onClick:()=>el(!0),children:(0,t.jsx)(z.FolderOpen,{className:"h-4 w-4"})})}),(0,t.jsx)(o.TooltipContent,{children:h("settings.config.git.pickFolder")})]})]}),(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground",children:h(et?"onboarding.step3.pathHintFull":"onboarding.step3.pathHintRepo")})]}),K.localPathTemplate&&(e=K.localPathTemplate.trim().replace(/\/+$/,""),c=et?`${e}/{path}`:e,m=[{label:"GitHub SSH",url:"git@github.com:user/my-app.git"},{label:"GitHub HTTPS",url:"https://github.com/user/my-app.git"},{label:"GitLab Subgroup",url:"https://gitlab.com/org/team/sub/my-api.git"}],(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-xs font-medium",children:h("onboarding.step3.previewLabel")}),(0,t.jsx)("div",{className:"flex gap-1 flex-wrap",children:m.map((e,s)=>(0,t.jsx)("button",{type:"button",onClick:()=>ee(s),className:`rounded-md px-2 py-1 text-[11px] font-medium transition-colors ${Y===s?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:e.label},s))}),(0,t.jsxs)("div",{className:"rounded-md bg-muted/50 px-3 py-2 space-y-1",children:[(0,t.jsx)("p",{className:"font-mono text-[11px] text-muted-foreground truncate",children:m[Y].url}),(0,t.jsxs)("p",{className:"font-mono text-xs",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"→ "}),(0,t.jsx)("span",{className:"text-primary",children:function(e,t){if(!e||!t)return"";let s=t.trim(),a=[],l=s.match(/^git@[^:]+:(.+)$/);if(l)a=l[1].replace(/\.git\/?$/,"").split("/").filter(Boolean);else try{let e=new URL(s);a=decodeURIComponent(e.pathname).replace(/\.git\/?$/,"").split("/").filter(Boolean)}catch{return""}if(!a.length)return"";let i=a[0],n=a[a.length-1],r=a.join("/");if(e.includes("{path}"))return e.replace("{path}",r).replace("{owner}",i).replace("{repo}",n).replace(/\/+$/,"");let o=e.replace("{owner}",i).replace("{repo}","").replace(/\/+$/,"");return`${o}/${n}`}(c,m[Y].url)})]})]})]})),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[W.length>0&&(0,t.jsx)(i.Button,{variant:"ghost",onClick:()=>Q(!1),children:h("settings.config.git.cancel")}),(0,t.jsxs)(i.Button,{onClick:function(){if(!K.host.trim()||!K.localPathTemplate.trim())return;let e=K.localPathTemplate.trim().replace(/\/+$/,""),t=et?`${e}/{path}`:e,s={id:crypto.randomUUID(),host:K.host.trim(),ownerMatch:K.ownerMatch.trim()||"*",localPathTemplate:t,priority:W.length};X(e=>[...e,s]),Z({...V}),es(!1),Q(!1)},disabled:!K.host.trim()||!K.localPathTemplate.trim(),children:[(0,t.jsx)(u.Check,{className:"h-4 w-4 mr-1"}),h("settings.config.git.save")]})]})]}):(0,t.jsxs)(i.Button,{variant:"outline",onClick:()=>{Z({...V}),Q(!0)},children:[(0,t.jsx)(R.Plus,{className:"h-4 w-4 mr-1"}),h("settings.config.git.addRule")]}),(0,t.jsxs)("div",{className:"flex items-center justify-between pt-3",children:[(0,t.jsxs)(i.Button,{variant:"ghost",className:"text-muted-foreground",onClick:er,children:[(0,t.jsx)(C.ChevronLeft,{className:"h-4 w-4 mr-1"}),h("onboarding.back")]}),(0,t.jsxs)(i.Button,{onClick:async()=>{W.length>0&&await (0,N.setConfigValue)("git.pathMappingRules",W),F(e=>e+1)},className:"px-5",children:[h("onboarding.step1.next"),(0,t.jsx)(T.ChevronRight,{className:"h-4 w-4 ml-1"})]})]})]}),4===H&&(0,t.jsx)(q,{username:O,onComplete:()=>x.replace("/workspaces")})]}),(0,t.jsx)("div",{className:"pt-6 text-xs text-muted-foreground",children:h("onboarding.stepIndicator").replace("{current}",String(H)).replace("{total}",String(4))})]})}),(0,t.jsx)(d.FolderBrowserDialog,{open:ea,onOpenChange:el,onSelect:e=>{Z(t=>({...t,localPathTemplate:e})),el(!1)}})]})}],566606)}]);