tower-studio 0.2.23 → 0.2.25

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 (197) 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 +29 -29
  13. package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
  14. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  15. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  16. package/.next/standalone/.next/server/app/api/browse-fs/route.js +1 -1
  17. package/.next/standalone/.next/server/app/api/browse-fs/route.js.nft.json +1 -1
  18. package/.next/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/api/internal/assistant/chat/route.js.nft.json +1 -1
  20. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/start/route.js +1 -1
  21. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/start/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/tasks/[taskId]/merge/route.js +1 -1
  23. package/.next/standalone/.next/server/app/api/tasks/[taskId]/merge/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/missions/page/react-loadable-manifest.json +1 -1
  25. package/.next/standalone/.next/server/app/missions/page/server-reference-manifest.json +69 -69
  26. package/.next/standalone/.next/server/app/missions/page.js +1 -1
  27. package/.next/standalone/.next/server/app/missions/page.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/missions/page_client-reference-manifest.js +1 -1
  29. package/.next/standalone/.next/server/app/onboarding/page/react-loadable-manifest.json +1 -1
  30. package/.next/standalone/.next/server/app/onboarding/page/server-reference-manifest.json +29 -29
  31. package/.next/standalone/.next/server/app/onboarding/page.js +1 -1
  32. package/.next/standalone/.next/server/app/onboarding/page.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  34. package/.next/standalone/.next/server/app/page/react-loadable-manifest.json +1 -1
  35. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +29 -29
  36. package/.next/standalone/.next/server/app/page.js +1 -1
  37. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  39. package/.next/standalone/.next/server/app/settings/page/react-loadable-manifest.json +1 -1
  40. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +47 -47
  41. package/.next/standalone/.next/server/app/settings/page.js +1 -1
  42. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  44. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +1 -1
  45. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +86 -86
  46. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page.js +1 -1
  47. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
  49. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +1 -1
  50. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +78 -78
  51. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page.js +1 -1
  52. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
  54. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +1 -1
  55. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +65 -65
  56. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page.js +1 -1
  57. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
  58. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
  59. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +1 -1
  60. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +63 -63
  61. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js +1 -1
  62. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
  63. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
  64. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +1 -1
  65. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +29 -29
  66. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js +1 -1
  67. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
  68. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
  69. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/react-loadable-manifest.json +1 -1
  70. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/server-reference-manifest.json +68 -68
  71. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page.js +1 -1
  72. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page.js.nft.json +1 -1
  73. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page_client-reference-manifest.js +1 -1
  74. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +2 -2
  75. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +80 -80
  76. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js +1 -1
  77. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
  78. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  79. package/.next/standalone/.next/server/app/workspaces/page/react-loadable-manifest.json +1 -1
  80. package/.next/standalone/.next/server/app/workspaces/page/server-reference-manifest.json +47 -47
  81. package/.next/standalone/.next/server/app/workspaces/page.js +1 -1
  82. package/.next/standalone/.next/server/app/workspaces/page.js.nft.json +1 -1
  83. package/.next/standalone/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
  84. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0eh8dj_.js +1 -1
  85. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0hrprmi.js +1 -1
  86. package/.next/standalone/.next/server/chunks/[externals]__12mj_bs._.js +3 -0
  87. package/.next/standalone/.next/server/chunks/[root-of-the-server]__03j20vp._.js +2 -2
  88. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05se6yk._.js +1 -1
  89. package/.next/standalone/.next/server/chunks/[root-of-the-server]__06m1r8x._.js +1 -1
  90. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0_6swdz._.js → [root-of-the-server]__0g788b3._.js} +3 -3
  91. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0-0gs-6._.js → [root-of-the-server]__0j-4yc7._.js} +2 -2
  92. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o3iihg._.js +1 -1
  93. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0v5.ht~._.js +3 -0
  94. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0wuzc5o._.js +1 -1
  95. package/.next/standalone/.next/server/chunks/src_0bkvm8c._.js +1 -1
  96. package/.next/standalone/.next/server/chunks/src_lib_ai_0xx6y51._.js +1 -1
  97. package/.next/standalone/.next/server/chunks/ssr/0iu._[workspaceId]_projects_[projectId]_versions_version-timeline-client_tsx_07o_kyi._.js +1 -1
  98. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02-6df-._.js +3 -3
  99. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__03e009u._.js +3 -3
  100. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__12p2zz2._.js → [root-of-the-server]__084p3.0._.js} +1 -1
  101. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e_-mj-._.js +3 -3
  102. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0fzkdjl._.js +3 -3
  103. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0ty1ao1._.js → [root-of-the-server]__0f~m-8x._.js} +2 -2
  104. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0jti4~k._.js → [root-of-the-server]__0i7es1w._.js} +2 -2
  105. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0jymb~t._.js +1 -1
  106. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0pu-v0l._.js +3 -3
  107. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0-o.l41._.js → [root-of-the-server]__0qkus8m._.js} +2 -2
  108. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0um1ugs._.js +3 -3
  109. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0s-a4ku._.js → [root-of-the-server]__0ygiyqr._.js} +2 -2
  110. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0z7je5_._.js +1 -1
  111. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__134_xv.._.js +1 -1
  112. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__13vgkq5._.js +3 -3
  113. package/.next/standalone/.next/server/chunks/ssr/{_0m.4akk._.js → _02acmsq._.js} +2 -2
  114. package/.next/standalone/.next/server/chunks/ssr/_03osyxp._.js +3 -0
  115. package/.next/standalone/.next/server/chunks/ssr/_070t_mh._.js +2 -2
  116. package/.next/standalone/.next/server/chunks/ssr/_08z-g~5._.js +3 -3
  117. package/.next/standalone/.next/server/chunks/ssr/_0_vjay8._.js +3 -3
  118. package/.next/standalone/.next/server/chunks/ssr/_0cj9a7y._.js +1 -1
  119. package/.next/standalone/.next/server/chunks/ssr/_0ecgaqt._.js +7 -0
  120. package/.next/standalone/.next/server/chunks/ssr/{_0-9.ea2._.js → _0eete9d._.js} +2 -2
  121. package/.next/standalone/.next/server/chunks/ssr/{_0hzckhd._.js → _0gk20rx._.js} +2 -2
  122. package/.next/standalone/.next/server/chunks/ssr/_0jeo~zr._.js +4 -0
  123. package/.next/standalone/.next/server/chunks/ssr/_0jg.s-g._.js +1 -1
  124. package/.next/standalone/.next/server/chunks/ssr/_0kynu6x._.js +7 -0
  125. package/.next/standalone/.next/server/chunks/ssr/{_04y89b3._.js → _0r1pb6u._.js} +2 -2
  126. package/.next/standalone/.next/server/chunks/ssr/_0r6gweb._.js +3 -3
  127. package/.next/standalone/.next/server/chunks/ssr/_0rdyrfd._.js +1 -1
  128. package/.next/standalone/.next/server/chunks/ssr/{_0bk06da._.js → _0rny90z._.js} +2 -2
  129. package/.next/standalone/.next/server/chunks/ssr/{_012.igw._.js → _0rr~oe~._.js} +2 -2
  130. package/.next/standalone/.next/server/chunks/ssr/_0rt8jf_._.js +3 -3
  131. package/.next/standalone/.next/server/chunks/ssr/_0ueyys5._.js +1 -1
  132. package/.next/standalone/.next/server/chunks/ssr/_0uuzh5m._.js +3 -3
  133. package/.next/standalone/.next/server/chunks/ssr/{_0~v4z8z._.js → _0vx81le._.js} +2 -2
  134. package/.next/standalone/.next/server/chunks/ssr/{_10-.n35._.js → _0yvg9ie._.js} +2 -2
  135. package/.next/standalone/.next/server/chunks/ssr/_0~aon4t._.js +3 -3
  136. package/.next/standalone/.next/server/chunks/ssr/_11cv4uu._.js +7 -0
  137. package/.next/standalone/.next/server/chunks/ssr/src_075s.rk._.js +1 -1
  138. package/.next/standalone/.next/server/chunks/ssr/src_0djxlqx._.js +1 -1
  139. package/.next/standalone/.next/server/chunks/ssr/src_0eufeyj._.js +1 -1
  140. package/.next/standalone/.next/server/chunks/ssr/src_actions_agent-actions_ts_0~wc.sy._.js +1 -1
  141. package/.next/standalone/.next/server/chunks/ssr/src_actions_file-actions_ts_0gcvqwm._.js +1 -1
  142. package/.next/standalone/.next/server/chunks/ssr/src_app_missions_missions-client_tsx_11429lj._.js +1 -1
  143. package/.next/standalone/.next/server/chunks/ssr/src_app_onboarding_page_tsx_0xf7hpz._.js +1 -1
  144. package/.next/standalone/.next/server/chunks/ssr/src_app_settings_page_tsx_0h9v7dr._.js +1 -1
  145. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0wyzpam._.js +1 -1
  146. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_board-page-client_tsx_0gips66._.js +1 -1
  147. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_02t7blt._.js +1 -1
  148. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  149. package/.next/standalone/.next/server/pages/500.html +1 -1
  150. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  151. package/.next/standalone/.next/server/server-reference-manifest.json +286 -286
  152. package/.next/standalone/.next/static/chunks/{0.qj9vorfgtnt.js → 00fcxpwt-xz7b.js} +1 -1
  153. package/.next/standalone/.next/static/chunks/{0p9zhbwmnn0j4.js → 02.0.zsh_o-10.js} +1 -1
  154. package/.next/standalone/.next/static/chunks/05dryiv53wj6h.js +5 -0
  155. package/.next/standalone/.next/static/chunks/{1007_ur3fj.~m.js → 08ln6v6_fd4nf.js} +1 -1
  156. package/.next/standalone/.next/static/chunks/099fxtzvpw3be.js +1 -0
  157. package/.next/standalone/.next/static/chunks/{0c~0amyhws3l0.js → 0ce8gr~q3rs9k.js} +1 -1
  158. package/.next/standalone/.next/static/chunks/{0zfszxiw4cx9b.js → 0iyxegei1fjbp.js} +1 -1
  159. package/.next/standalone/.next/static/chunks/{17n~0msyl8bur.js → 0izvibcnunqx4.js} +1 -1
  160. package/.next/standalone/.next/static/chunks/{04axhlp_leiii.js → 0jmk1_g~_yd7-.js} +1 -1
  161. package/.next/standalone/.next/static/chunks/{0rec91xfsdv8r.js → 0mi29_2~1sr...js} +1 -1
  162. package/.next/standalone/.next/static/chunks/{0ztty8z0obk5f.js → 0n.isvqurxe72.js} +1 -1
  163. package/.next/standalone/.next/static/chunks/{120x-nmim1wfz.js → 0nl7~2pju.abl.js} +1 -1
  164. package/.next/standalone/.next/static/chunks/{12iivlft6u_tt.js → 0oopksfzoc0_k.js} +1 -1
  165. package/.next/standalone/.next/static/chunks/0p5wczoq4gvin.js +1 -0
  166. package/.next/standalone/.next/static/chunks/0pov66bj_qi58.js +1 -0
  167. package/.next/standalone/.next/static/chunks/{16r-tz37aqyoa.js → 0s2umk4hfyhqa.js} +1 -1
  168. package/.next/standalone/.next/static/chunks/0ur66aluu.t0b.js +1 -0
  169. package/.next/standalone/.next/static/chunks/0w7cz_z6p3-p_.js +1 -0
  170. package/.next/standalone/.next/static/chunks/{0so-w5.m3jaxi.js → 0wa8r89hd0y0b.js} +1 -1
  171. package/.next/standalone/.next/static/chunks/{0ik7-_3wrtspq.js → 0yjkfr0qay7z6.js} +1 -1
  172. package/.next/standalone/.next/static/chunks/{05a6uzgclxdsk.js → 131msw-pgcsxt.js} +2 -2
  173. package/.next/standalone/.next/static/chunks/{099eecj285cbx.js → 13upq83z~yuys.js} +1 -1
  174. package/.next/standalone/.next/static/chunks/{0-.9k92iyul5o.js → 141wmbqfx~lo8.js} +2 -2
  175. package/.next/standalone/.next/static/chunks/157pgx~-2_qo5.js +5 -0
  176. package/.next/standalone/.next/static/chunks/15_.l.-~mxr1v.js +1 -0
  177. package/.next/standalone/.next/static/chunks/{10r4y1zzk24jy.js → 16ndme6.~2w1x.js} +2 -2
  178. package/.next/standalone/package.json +1 -1
  179. package/package.json +1 -1
  180. package/.next/standalone/.next/server/chunks/[externals]__0m5smhl._.js +0 -3
  181. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0sy6lau._.js +0 -3
  182. package/.next/standalone/.next/server/chunks/ssr/_0385-.g._.js +0 -4
  183. package/.next/standalone/.next/server/chunks/ssr/_04yogxq._.js +0 -7
  184. package/.next/standalone/.next/server/chunks/ssr/_0cc0gt8._.js +0 -7
  185. package/.next/standalone/.next/server/chunks/ssr/_0oq26rv._.js +0 -3
  186. package/.next/standalone/.next/server/chunks/ssr/_0z-b00b._.js +0 -7
  187. package/.next/standalone/.next/static/chunks/00-6_m40h14vl.js +0 -1
  188. package/.next/standalone/.next/static/chunks/02.ihz-~spbi-.js +0 -1
  189. package/.next/standalone/.next/static/chunks/0e8r37m0q.z0p.js +0 -1
  190. package/.next/standalone/.next/static/chunks/0ima0i0p489ty.js +0 -1
  191. package/.next/standalone/.next/static/chunks/0x3tiuoe.l18z.js +0 -1
  192. package/.next/standalone/.next/static/chunks/10vl5vq1_rh1..js +0 -1
  193. package/.next/standalone/.next/static/chunks/134onqxk2foh5.js +0 -5
  194. package/.next/standalone/.next/static/chunks/16ukg_cswejw4.js +0 -5
  195. /package/.next/standalone/.next/static/{l8InE32VLIGdUBVP3BJKt → biyHBSA-7nbhZk25VrdWY}/_buildManifest.js +0 -0
  196. /package/.next/standalone/.next/static/{l8InE32VLIGdUBVP3BJKt → biyHBSA-7nbhZk25VrdWY}/_clientMiddlewareManifest.js +0 -0
  197. /package/.next/standalone/.next/static/{l8InE32VLIGdUBVP3BJKt → biyHBSA-7nbhZk25VrdWY}/_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)("604dec7b6b53f1003101b265ebad366c3e8f863085",ee.callServer,void 0,ee.findSourceMapURL,"updateProject");var es=e.i(940220);let ea=(0,ee.createServerReference)("407242762ff7550ed5b6999b2b8a95164d679fd9b0",ee.callServer,void 0,ee.findSourceMapURL,"deleteProject"),er=(0,ee.createServerReference)("40705e59f5a30b17bf67b350d66af4db2e7a8e4029",ee.callServer,void 0,ee.findSourceMapURL,"getRecentLocalProjects"),en=(0,ee.createServerReference)("4099066c016a6e290639ef563bd1d72eff923cc403",ee.callServer,void 0,ee.findSourceMapURL,"getOrCreateTowerTaskId");var el=e.i(102292),ei=e.i(830716),eo=e.i(141625),ec=e.i(270839),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:"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(52661),eD=e.i(786076),eL=e.i(120969),eB=e.i(523736),eF=e.i(578895),eR=e.i(341975),eA=e.i(40342),eO=e.i(523185),eM=e.i(610328),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(149729);let e_=(0,ee.createServerReference)("40c7270b5f3e0370f8724ee6aeb6384165a64220c7",ee.callServer,void 0,ee.findSourceMapURL,"getTaskNotes");var eH=e.i(14044);let eK=(0,ee.createServerReference)("40658e0f067e14a73b111269e4179a5c06a34f63df",ee.callServer,void 0,ee.findSourceMapURL,"getTaskAssets");var eY=e.i(605232),eq=e.i(409370),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 e3=e.i(98577),e5=e.i(500193);let e2=(0,ee.createServerReference)("40b9d22cd6da97cb86f4d390c7bdeb55b91df381b3",ee.callServer,void 0,ee.findSourceMapURL,"deleteTask"),e4=(0,ee.createServerReference)("40d120ccbea9e27f9933c9c927c90c8b17867f4f93",ee.callServer,void 0,ee.findSourceMapURL,"toggleTaskPinned");var e6=e.i(886343);let e7=(0,ee.createServerReference)("40fbd322a2220a136d975aef6295d4996afb021346",ee.callServer,void 0,ee.findSourceMapURL,"getVersionsForPicker");var e8=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)(e8.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,e3.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,e6.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,e5.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,e6.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)("60d9b4cfa4456aec024dd568e422cb9fbf8e3071b3",ee.callServer,void 0,ee.findSourceMapURL,"updateProject");var es=e.i(920115);let ea=(0,ee.createServerReference)("404171df3d7939dda365b8d5086e892794ddecfefe",ee.callServer,void 0,ee.findSourceMapURL,"deleteProject"),er=(0,ee.createServerReference)("4090fc0c31155a5a3506400d9b5552460a5aea4bcc",ee.callServer,void 0,ee.findSourceMapURL,"getRecentLocalProjects"),en=(0,ee.createServerReference)("40ae52f9c09657ba6f03439b7ef5c06ec2dccbd430",ee.callServer,void 0,ee.findSourceMapURL,"getOrCreateTowerTaskId");var el=e.i(814686),ei=e.i(792934),eo=e.i(101448),ec=e.i(736630),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:"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(245816),eD=e.i(466520),eL=e.i(992082),eB=e.i(303816),eF=e.i(764313),eR=e.i(254675),eA=e.i(114208),eO=e.i(812100),eM=e.i(230880),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(745560);let e_=(0,ee.createServerReference)("40d08ff346d341404ff0ef27346235922196a84a47",ee.callServer,void 0,ee.findSourceMapURL,"getTaskNotes");var eH=e.i(216571);let eK=(0,ee.createServerReference)("405403aa7e7a6935ec2d25a2ec320753bef4ac3c23",ee.callServer,void 0,ee.findSourceMapURL,"getTaskAssets");var eY=e.i(445283),eq=e.i(626529),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(557107),e3=e.i(269504);let e2=(0,ee.createServerReference)("4075063506e18d5a1c88fa77b9fcd7f9d45e8aa9dc",ee.callServer,void 0,ee.findSourceMapURL,"deleteTask"),e4=(0,ee.createServerReference)("404f2cec10eea45d333cb6336a3cd276e53a6b6391",ee.callServer,void 0,ee.findSourceMapURL,"toggleTaskPinned");var e8=e.i(525540);let e6=(0,ee.createServerReference)("409d80af6412fc9b8e291d2c2bc4780fe4e0d0f198",ee.callServer,void 0,ee.findSourceMapURL,"getVersionsForPicker");var e7=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)(e7.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)(()=>{e6(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 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,645119,e=>{"use strict";var t=e.i(289721),s=e.i(965652),r=e.i(538059),n=e.i(210702),a=e.i(232545),i=e.i(487278),l=e.i(368490),o=e.i(259846),d=e.i(572989);let c=(0,d.default)("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);var x=e.i(519455),m=e.i(759684),u=e.i(606393),p=e.i(226145),h=e.i(340873),f=e.i(263938),g=e.i(960518),v=e.i(453889),j=e.i(645378);let b=(0,d.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);var N=e.i(464249);let y=(0,d.default)("package-check",[["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m16 17 2 2 4-4",key:"uh5qu3"}],["path",{d:"M21 11.127V8a2 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.729l7 4a2 2 0 0 0 2 .001l1.32-.753",key:"kpkbpo"}],["path",{d:"M3.29 7 12 12l8.71-5",key:"19ckod"}],["path",{d:"m7.5 4.27 8.997 5.148",key:"9yrvtv"}]]),w=(0,d.default)("panel-right",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);var C=e.i(746798),S=e.i(685149),k=e.i(35967),D=e.i(533499);function T(e){if(!e)return"";let t="string"==typeof e?new Date(e):e;if(isNaN(t.getTime()))return"";let s=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${s}-${r}`}let B=Object.fromEntries(S.BOARD_COLUMNS.map(e=>[e.id,e.color]));function E({children:e,className:s}){return(0,t.jsx)("span",{className:`inline-flex items-center gap-1.5 rounded-md border border-border bg-muted/40 px-2 py-0.5 text-xs text-muted-foreground ${s??""}`,children:e})}function I({task:e,onOpenDetail:r}){let{t:n}=(0,D.useI18n)(),[a,i]=(0,s.useState)(!1),o="CANCELLED"===e.status?"text-muted-foreground line-through decoration-muted-foreground/40":"DONE"===e.status?"text-muted-foreground":"text-foreground";return(0,t.jsxs)("div",{className:"rounded-[10px]",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),className:"flex w-full items-center gap-2.5 rounded-[10px] px-2.5 py-2.5 text-left transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,t.jsx)(l.ChevronRight,{className:`h-3.5 w-3.5 flex-none text-muted-foreground/60 transition-transform duration-150 ${a?"rotate-90":""}`}),(0,t.jsx)("span",{className:`h-2 w-2 flex-none rounded-full ${B[e.status]??"bg-slate-400"}`}),(0,t.jsx)("span",{className:`text-[13.5px] font-medium ${o}`,children:e.title}),e.labels.map(({label:e})=>(0,t.jsx)("span",{className:"rounded-full border border-border px-1.5 py-px text-[10.5px] text-muted-foreground",style:e.color?{borderColor:e.color+"55",color:e.color}:void 0,children:e.name},e.id)),(0,t.jsx)("span",{className:"flex-1"}),(0,t.jsx)("span",{className:"flex w-16 flex-none justify-center",children:(0,t.jsx)("span",{className:`rounded-[5px] px-1.5 py-px text-[10.5px] font-bold ${S.PRIORITY_CONFIG[e.priority]?.color??S.PRIORITY_CONFIG.LOW.color}`,children:e.priority})}),(0,t.jsx)("span",{className:"h-3 w-px bg-border flex-none"}),(0,t.jsxs)("span",{className:"flex w-[72px] flex-none items-center gap-1.5",children:[(0,t.jsx)("span",{className:`h-1.5 w-1.5 flex-none rounded-full ${B[e.status]??"bg-slate-400"}`}),(0,t.jsx)("span",{className:"truncate text-[10.5px] text-muted-foreground",children:n(`version.taskStatus.${e.status}`)})]}),(0,t.jsx)("span",{className:"h-3 w-px bg-border flex-none"}),(0,t.jsx)("span",{className:"flex w-6 flex-none justify-center",children:r&&(0,t.jsxs)(C.Tooltip,{children:[(0,t.jsx)(C.TooltipTrigger,{render:(0,t.jsx)(x.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground",onClick:t=>{t.stopPropagation(),r(e.id)}}),children:(0,t.jsx)(w,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(C.TooltipContent,{children:n("version.detail")})]})})]}),a&&(0,t.jsxs)("div",{className:"flex flex-col gap-2.5 pb-3 pl-[30px] pr-3 pt-1",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"mb-1.5 flex items-center gap-1.5",children:[(0,t.jsx)(v.FolderOpen,{className:"h-3 w-3 text-muted-foreground/60"}),(0,t.jsx)("span",{className:"text-[11px] font-bold uppercase tracking-wide text-muted-foreground/60",children:n("version.resources")})]}),0===e.assets.length?(0,t.jsx)("p",{className:"text-[12px] italic text-muted-foreground/60",children:n("version.empty.resources")}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.assets.map(e=>{var s;let r=e.mimeType?.startsWith("image/");return(0,t.jsxs)("span",{className:"inline-flex cursor-pointer items-center gap-1.5 rounded-lg border border-border bg-background px-2.5 py-1.5 text-[12px] text-foreground shadow-sm transition-colors hover:border-primary/50",children:[r?(0,t.jsx)(b,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,t.jsx)(j.FileText,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,t.jsx)("span",{children:e.filename}),null!=e.size&&(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground/60",children:(s=e.size)<1024?`${s} B`:s<1048576?`${Math.round(s/1024)} KB`:`${(s/1048576).toFixed(1)} MB`})]},e.id)})})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"mb-1.5 flex items-center gap-1.5",children:[(0,t.jsx)(j.FileText,{className:"h-3 w-3 text-muted-foreground/60"}),(0,t.jsx)("span",{className:"text-[11px] font-bold uppercase tracking-wide text-muted-foreground/60",children:n("version.notes")})]}),0===e.notes.length?(0,t.jsx)("p",{className:"text-[12px] italic text-muted-foreground/60",children:n("version.empty.notes")}):(0,t.jsx)("div",{className:"flex flex-col gap-1.5",children:e.notes.map(e=>(0,t.jsx)("div",{className:"rounded-lg border border-border border-l-violet-500/50 bg-background px-2.5 py-2 shadow-sm [border-left-width:3px]",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-[12.5px] font-semibold text-foreground",children:e.title}),e.category&&(0,t.jsx)("span",{className:"rounded-[5px] border border-violet-500/30 bg-violet-500/15 px-1.5 py-px text-[10px] font-bold text-violet-300",children:e.category})]})},e.id))})]})]})]})}function L({version:e,diffStat:r,onEdit:n,onRelease:a,onViewDiff:i,onOpenTaskDetail:o}){var d;let c,{t:m}=(0,D.useI18n)(),[v,j]=(0,s.useState)(e.isCurrent),b="RELEASED"===e.status,w="ACTIVE"===e.status,S=e.tasks.length,B=e.tasks.filter(e=>"DONE"===e.status).length,R=!!(e.releaseCommit||r),_=(c=`${S} ${m("version.tasksCount")}`,B>0&&B<S?`${c} \xb7 ${B} ${m("version.doneCount")}`:B>0&&B===S?`${c} \xb7 ${m("version.allDone")}`:c);return(0,t.jsxs)("div",{className:["overflow-hidden rounded-[14px] border bg-card shadow-sm transition-shadow duration-150 hover:shadow-md",e.isCurrent?"border-border border-l-2 border-l-primary ring-1 ring-primary/20":"border-border",b?"opacity-[.96]":""].filter(Boolean).join(" "),children:[(0,t.jsx)("button",{type:"button",onClick:()=>j(e=>!e),className:"w-full text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:(0,t.jsxs)("div",{className:"px-4 py-3.5",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(l.ChevronRight,{className:`h-4 w-4 flex-none text-muted-foreground/60 transition-transform duration-150 ${v?"rotate-90":""}`}),(0,t.jsx)("span",{className:"font-mono text-[14.5px] font-bold text-foreground",children:e.number}),(0,t.jsx)("span",{className:"text-[14.5px] font-semibold text-foreground",children:e.name}),(0,t.jsx)(k.VersionTypeBadge,{name:e.type?.name??null}),(0,t.jsx)(k.VersionStatusBadge,{status:e.status}),e.isCurrent&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-primary/30 bg-primary/15 px-2.5 py-0.5 text-[11px] font-bold text-primary shadow-sm",children:[(0,t.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-primary opacity-90"}),m("version.current")]}),(0,t.jsx)("span",{className:"flex-1"}),S>0&&(0,t.jsx)("span",{className:"text-[11.5px] text-muted-foreground",children:_}),(0,t.jsxs)("span",{className:"flex items-center gap-1",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[n&&(0,t.jsxs)(C.Tooltip,{children:[(0,t.jsx)(C.TooltipTrigger,{render:(0,t.jsx)(x.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>n(e.id)}),children:(0,t.jsx)(N.Pencil,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(C.TooltipContent,{children:m("version.edit")})]}),w&&a&&(0,t.jsxs)(x.Button,{variant:"outline",className:"h-7 px-2 text-xs font-semibold",onClick:()=>a(e.id),children:[(0,t.jsx)(y,{className:"h-3.5 w-3.5"}),m("version.release")]})]})]}),(0,t.jsxs)("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[b&&e.releasedAt?(0,t.jsxs)(E,{children:[(0,t.jsx)(u.Calendar,{className:"h-3 w-3"}),m("version.releasedAt"),(0,t.jsx)("strong",{className:"text-foreground",children:T(e.releasedAt)})]}):e.startDate||e.targetDate?(0,t.jsxs)(E,{children:[(0,t.jsx)(u.Calendar,{className:"h-3 w-3"}),e.startDate?T(e.startDate):"—"," → ",e.targetDate?(0,t.jsx)("strong",{className:"text-foreground",children:T(e.targetDate)}):"—"]}):null,e.baseBranch&&(0,t.jsxs)(E,{children:[(0,t.jsx)(p.GitBranch,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"font-mono text-[11px] text-foreground",children:e.baseBranch})]}),e.baseCommit&&(0,t.jsxs)(E,{children:[(0,t.jsx)(h.GitCommitHorizontal,{className:"h-3 w-3"}),m("version.field.baseCommit"),(0,t.jsx)("span",{className:"font-mono text-[11px] text-foreground",children:(d=e.baseCommit)?d.slice(0,7):""})]}),b&&(0,t.jsxs)(E,{children:[(0,t.jsx)(f.Tag,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"font-mono text-[11px] text-foreground",children:e.number})]}),r&&(0,t.jsxs)(E,{children:[(0,t.jsx)(g.GitCompare,{className:"h-3 w-3"}),!b&&(0,t.jsx)("span",{className:"text-muted-foreground",children:m("version.diff.live")}),(0,t.jsxs)("span",{className:"font-bold text-emerald-400",children:["+",r.additions.toLocaleString()]}),(0,t.jsxs)("span",{className:"font-bold text-rose-400",children:["−",r.deletions.toLocaleString()]}),(0,t.jsxs)("span",{className:"text-muted-foreground",children:["· ",r.files," ",m("version.diff.files")]})]}),R&&i&&(0,t.jsxs)(x.Button,{variant:"ghost",size:"sm",className:"h-6 gap-1 px-2 text-xs text-muted-foreground",onClick:t=>{t.stopPropagation(),i(e.id)},children:[(0,t.jsx)(g.GitCompare,{className:"h-3 w-3"}),m("version.diff.view")," →"]})]}),e.description&&(0,t.jsx)("p",{className:"mt-2 text-[13px] text-muted-foreground",children:e.description})]})}),v&&S>0&&(0,t.jsx)("div",{className:"border-t border-dashed border-border bg-muted/40 px-2 pb-2 pt-1.5",children:e.tasks.map(e=>(0,t.jsx)(I,{task:e,onOpenDetail:o},e.id))})]})}var R=e.i(360112),_=e.i(597746),$=e.i(456346),O=e.i(776639),A=e.i(793479),V=e.i(110204),P=e.i(280027),M=e.i(337822),F=e.i(317056),z=e.i(699375),U=e.i(624687),H=e.i(514798);let G=(0,H.createServerReference)("401d229feefc4e2d103c4dc434232660d8f7f16ffc",H.callServer,void 0,H.findSourceMapURL,"createVersion"),K=(0,H.createServerReference)("608800938e4a0f56bc384158467b8bffbefecb15c0",H.callServer,void 0,H.findSourceMapURL,"updateVersion"),W=(0,H.createServerReference)("4032d571cfac26fccc236b64f8c65328886d7f6cc0",H.callServer,void 0,H.findSourceMapURL,"getVersionTypes");var Y=e.i(650059),q=e.i(812822),J=e.i(998626);let Q=(0,H.createServerReference)("4021c0128f02653d7b83e2f3fc0d55e29e6fbd6654",H.callServer,void 0,H.findSourceMapURL,"createVersionType"),X=(0,H.createServerReference)("60f1dd8fe5645bf33eb54950e8118ad0b3277ae1a9",H.callServer,void 0,H.findSourceMapURL,"updateVersionType"),Z=(0,H.createServerReference)("40ad3d288cf0041cc6b722313eee99caed9aa51258",H.callServer,void 0,H.findSourceMapURL,"deleteVersionType");function ee({open:e,onOpenChange:r,workspaceId:n,onChanged:a}){let{t:i}=(0,D.useI18n)(),[l,o]=(0,s.useState)([]),[d,c]=(0,s.useState)(""),[m,u]=(0,s.useState)({}),[p,h]=(0,s.useTransition)(),f=async()=>{let e=await W(n);o(e),u(t=>{let s={};return e.forEach(e=>{s[e.id]=e.id in t?t[e.id]:e.name}),s})};(0,s.useEffect)(()=>{e&&(f(),c(""))},[e,n]);let g=()=>{let e=d.trim();e&&h(async()=>{try{await Q({workspaceId:n,name:e}),c(""),await f(),a?.(),R.toast.success(i("version.type.add"))}catch(e){R.toast.error(e instanceof Error?e.message:String(e))}})};return(0,t.jsx)(O.Dialog,{open:e,onOpenChange:r,children:(0,t.jsxs)(O.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(O.DialogHeader,{children:(0,t.jsx)(O.DialogTitle,{children:i("version.manageTypes")})}),(0,t.jsxs)("div",{className:"flex flex-col gap-4 py-2",children:[(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(A.Input,{value:d,onChange:e=>c(e.target.value),placeholder:i("version.type.namePlaceholder"),disabled:p,onKeyDown:e=>{"Enter"===e.key&&g()},className:"flex-1"}),(0,t.jsx)(x.Button,{onClick:g,disabled:p||!d.trim(),children:i("version.type.add")})]}),0===l.length?(0,t.jsx)("p",{className:"text-center text-sm text-muted-foreground py-4",children:i("version.type.empty")}):(0,t.jsx)("div",{className:"flex flex-col gap-1.5",children:l.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/30 px-3 py-2",children:[(0,t.jsx)("span",{className:`inline-flex h-2.5 w-2.5 flex-none rounded-full ${(0,k.typeBadgeColor)(m[e.id]??e.name).split(" ").filter(e=>e.startsWith("bg-"))[0]??"bg-muted"}`}),(0,t.jsx)(A.Input,{value:m[e.id]??e.name,onChange:t=>u(s=>({...s,[e.id]:t.target.value})),onBlur:()=>(e=>{let t=(m[e]??"").trim();if(!t)return;let s=l.find(t=>t.id===e);s?.name!==t&&h(async()=>{try{await X(e,{name:t}),await f(),a?.()}catch(t){R.toast.error(t instanceof Error?t.message:String(t)),u(t=>({...t,[e]:s?.name??""}))}})})(e.id),onKeyDown:e=>{"Enter"===e.key&&e.target.blur()},disabled:p,className:"h-7 flex-1 border-transparent bg-transparent shadow-none focus-visible:border-input focus-visible:bg-background focus-visible:shadow-sm"}),(0,t.jsx)(x.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 flex-none text-muted-foreground hover:text-destructive",onClick:()=>{var t;return t=e.id,void(window.confirm(i("version.type.deleteConfirm"))&&h(async()=>{try{await Z(t),await f(),a?.()}catch(e){R.toast.error(e instanceof Error?e.message:String(e))}}))},disabled:p,children:(0,t.jsx)(J.Trash2,{className:"h-3.5 w-3.5"})})]},e.id))})]})]})})}function et(e){if(!e)return"";let t="string"==typeof e?new Date(e):e;if(isNaN(t.getTime()))return"";let s=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0");return`${s}-${r}-${n}`}function es(e){if(!e)return;let t=new Date(e);return isNaN(t.getTime())?void 0:t}function er({open:e,onOpenChange:r,projectId:n,workspaceId:a,editVersion:i,defaultBaseBranch:l,projectLocalPath:o,onSuccess:d}){let{t:c}=(0,D.useI18n)(),m=!!i,[u,h]=(0,s.useState)(""),[f,g]=(0,s.useState)(""),[v,j]=(0,s.useState)(""),[b,N]=(0,s.useState)([]),[y,w]=(0,s.useState)(!1),[C,S]=(0,s.useState)(""),[k,T]=(0,s.useState)(""),[B,E]=(0,s.useState)(""),[I,L]=(0,s.useState)(""),[H,J]=(0,s.useState)(!1),[Q,X]=(0,s.useState)([]),[Z,en]=(0,s.useState)(!1),[ea,ei]=(0,s.useState)(!1),el=!!o,[eo,ed]=(0,s.useTransition)();return(0,s.useEffect)(()=>{e&&(i?(h(i.number),g(i.name),j(i.typeId??""),S(i.baseBranch??""),T(et(i.startDate)),E(et(i.targetDate)),L(i.description??"")):(h(""),g(""),j(""),S(l??""),T(""),E(""),L("")),J(!1))},[e,i,l]),(0,s.useEffect)(()=>{e&&W(a).then(N).catch(()=>N([]))},[e,a]),(0,s.useEffect)(()=>{e&&el?(en(!0),(0,Y.getProjectBranches)(o).then(X).catch(()=>X([])).finally(()=>en(!1)),(0,q.fetchRemoteBranches)(o).then(()=>(0,Y.getProjectBranches)(o).then(X)).catch(()=>{})):X([])},[e,el,o]),(0,t.jsxs)(O.Dialog,{open:e,onOpenChange:r,children:[(0,t.jsxs)(O.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(O.DialogHeader,{children:(0,t.jsx)(O.DialogTitle,{children:m?c("version.edit"):c("version.new")})}),(0,t.jsxs)("div",{className:"grid gap-4 py-2",children:[(0,t.jsxs)("div",{className:"grid gap-1.5",children:[(0,t.jsxs)(V.Label,{htmlFor:"version-number",children:[c("version.field.number"),(0,t.jsx)("span",{className:"text-destructive ml-0.5",children:"*"})]}),(0,t.jsx)(A.Input,{id:"version-number",value:u,onChange:e=>h(e.target.value),placeholder:c("version.placeholder.number"),disabled:eo})]}),(0,t.jsxs)("div",{className:"grid gap-1.5",children:[(0,t.jsxs)(V.Label,{htmlFor:"version-name",children:[c("version.field.name"),(0,t.jsx)("span",{className:"text-destructive ml-0.5",children:"*"})]}),(0,t.jsx)(A.Input,{id:"version-name",value:f,onChange:e=>g(e.target.value),placeholder:c("version.placeholder.name"),disabled:eo})]}),(0,t.jsxs)("div",{className:"grid gap-1.5",children:[(0,t.jsx)(V.Label,{children:c("version.field.type")}),(0,t.jsxs)(P.Select,{value:v||"__none__",onValueChange:e=>{j(e&&"__none__"!==e?e:"")},children:[(0,t.jsx)(P.SelectTrigger,{className:"w-full",disabled:eo,children:(0,t.jsx)("span",{className:"truncate",children:v?b.find(e=>e.id===v)?.name??c("version.type.uncategorized"):c("version.type.uncategorized")})}),(0,t.jsxs)(P.SelectContent,{children:[(0,t.jsx)(P.SelectItem,{value:"__none__",children:c("version.type.uncategorized")}),b.map(e=>(0,t.jsx)(P.SelectItem,{value:e.id,children:e.name},e.id))]})]}),(0,t.jsxs)(x.Button,{type:"button",variant:"ghost",size:"sm",className:"h-auto justify-start px-0 py-0.5 text-xs text-muted-foreground hover:text-foreground",onClick:()=>w(!0),disabled:eo,children:["+ ",c("version.manageTypes")]})]}),(0,t.jsxs)("div",{className:"grid gap-1.5",children:[(0,t.jsx)(V.Label,{children:c("version.field.baseBranch")}),Z?(0,t.jsx)("div",{className:"text-sm text-muted-foreground",children:c("task.branchLoading")}):el&&Q.length>0?(0,t.jsxs)(M.Popover,{open:ea,onOpenChange:ei,children:[(0,t.jsxs)(M.PopoverTrigger,{className:"flex h-8 w-full items-center gap-2 rounded-lg border border-input bg-transparent px-3 text-sm transition-colors hover:bg-accent focus:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50",disabled:eo,"data-testid":"version-branch-selector",children:[(0,t.jsx)(p.GitBranch,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:`flex-1 truncate text-left text-xs ${C?"font-mono":"text-muted-foreground"}`,title:C||void 0,children:C||c("version.field.noBranch")}),(0,t.jsx)($.ChevronsUpDown,{className:"h-3.5 w-3.5 shrink-0 opacity-50"})]}),(0,t.jsx)(M.PopoverContent,{className:"w-[min(32rem,90vw)] p-0",align:"start",children:(0,t.jsxs)(F.Command,{children:[(0,t.jsx)(F.CommandInput,{placeholder:c("task.branchSearch")}),(0,t.jsxs)(F.CommandList,{children:[(0,t.jsx)(F.CommandEmpty,{children:c("task.branchNone")}),(0,t.jsxs)(F.CommandGroup,{children:[(0,t.jsxs)(F.CommandItem,{value:"__none__",onSelect:()=>{S(""),ei(!1)},children:[(0,t.jsx)("span",{className:"flex-1 truncate text-muted-foreground",children:c("version.field.noBranch")}),!C&&(0,t.jsx)(_.Check,{className:"ml-auto h-3 w-3 shrink-0 text-primary"})]}),Q.map(e=>(0,t.jsxs)(F.CommandItem,{value:e,onSelect:()=>{S(e),ei(!1)},children:[(0,t.jsx)(p.GitBranch,{className:"mr-2 h-3 w-3 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"flex-1 truncate font-mono",title:e,children:e}),e===C&&(0,t.jsx)(_.Check,{className:"ml-auto h-3 w-3 shrink-0 text-primary"})]},e))]})]})]})})]}):(0,t.jsx)(A.Input,{id:"version-base-branch",value:C,onChange:e=>S(e.target.value),placeholder:"main",disabled:eo})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{className:"grid gap-1.5",children:[(0,t.jsx)(V.Label,{htmlFor:"version-start-date",children:c("version.field.startDate")}),(0,t.jsx)("input",{id:"version-start-date",type:"date",value:k,onChange:e=>T(e.target.value),disabled:eo,className:"h-8 w-full rounded-lg border border-input bg-transparent px-2.5 py-1 text-sm outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50"})]}),(0,t.jsxs)("div",{className:"grid gap-1.5",children:[(0,t.jsx)(V.Label,{htmlFor:"version-target-date",children:c("version.field.targetDate")}),(0,t.jsx)("input",{id:"version-target-date",type:"date",value:B,onChange:e=>E(e.target.value),disabled:eo,className:"h-8 w-full rounded-lg border border-input bg-transparent px-2.5 py-1 text-sm outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50"})]})]}),(0,t.jsxs)("div",{className:"grid gap-1.5",children:[(0,t.jsx)(V.Label,{htmlFor:"version-description",children:c("version.field.description")}),(0,t.jsx)(U.Textarea,{id:"version-description",value:I,onChange:e=>L(e.target.value),rows:3,disabled:eo})]}),!m&&(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(z.Switch,{id:"version-set-current",checked:H,onCheckedChange:J,disabled:eo}),(0,t.jsx)(V.Label,{htmlFor:"version-set-current",className:"cursor-pointer",children:c("version.field.setCurrent")})]})]}),(0,t.jsxs)(O.DialogFooter,{children:[(0,t.jsx)(x.Button,{variant:"outline",onClick:()=>r(!1),disabled:eo,children:c("common.cancel")}),(0,t.jsx)(x.Button,{onClick:()=>{u.trim()&&f.trim()&&ed(async()=>{try{m&&i?await K(i.id,{number:u.trim(),name:f.trim(),typeId:v||null,baseBranch:C.trim()||null,startDate:es(k)??null,targetDate:es(B)??null,description:I.trim()||null}):await G({projectId:n,number:u.trim(),name:f.trim(),typeId:v||void 0,baseBranch:C.trim()||void 0,startDate:es(k),targetDate:es(B),description:I.trim()||void 0,setCurrent:H}),R.toast.success(m?c("version.edit"):c("version.new")),r(!1),d?.()}catch(e){R.toast.error(e instanceof Error?e.message:String(e))}})},disabled:eo||!u.trim()||!f.trim(),children:m?c("common.save"):c("common.create")})]})]}),(0,t.jsx)(ee,{open:y,onOpenChange:w,workspaceId:a,onChanged:()=>W(a).then(N)})]})}let en=(0,H.createServerReference)("609d3d7177804ef8e588c8cd4249e7ee72343aae94",H.callServer,void 0,H.findSourceMapURL,"releaseVersion");function ea({open:e,onOpenChange:r,version:n,candidates:a,onSuccess:i}){let{t:l}=(0,D.useI18n)(),[o,d]=(0,s.useState)(""),[c,m]=(0,s.useTransition)();(0,s.useEffect)(()=>{e&&d("")},[e,n]);let u=a.find(e=>e.id===o),p=a.length>0,h=p&&!!o&&!c;return(0,t.jsx)(O.Dialog,{open:e,onOpenChange:r,children:(0,t.jsxs)(O.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(O.DialogHeader,{children:(0,t.jsx)(O.DialogTitle,{children:l("version.releaseAction")})}),(0,t.jsxs)("div",{className:"grid gap-4 py-2",children:[n&&(0,t.jsxs)("p",{className:"text-sm text-muted-foreground",children:[n.number," · ",n.name]}),(0,t.jsxs)("div",{className:"text-sm",children:[(0,t.jsx)("span",{children:l("version.release.rolloverHint")}),n?.unfinishedCount!==void 0&&n.unfinishedCount>0&&(0,t.jsxs)("span",{className:"ml-1 font-medium text-foreground",children:["(",n.unfinishedCount,")"]})]}),(0,t.jsxs)("div",{className:"grid gap-1.5",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:l("version.release.nextVersion")}),p?(0,t.jsxs)(P.Select,{value:o,onValueChange:e=>{e&&d(e)},disabled:c,children:[(0,t.jsx)(P.SelectTrigger,{className:"w-full",children:(0,t.jsx)("span",{className:"truncate",children:u?`${u.number} \xb7 ${u.name}`:""})}),(0,t.jsx)(P.SelectContent,{children:a.map(e=>(0,t.jsxs)(P.SelectItem,{value:e.id,children:[e.number," · ",e.name]},e.id))})]}):(0,t.jsx)("p",{className:"text-xs text-destructive",children:l("version.release.noCandidates")})]})]}),(0,t.jsxs)(O.DialogFooter,{children:[(0,t.jsx)(x.Button,{variant:"outline",onClick:()=>r(!1),disabled:c,children:l("common.cancel")}),(0,t.jsx)(x.Button,{onClick:()=>{n&&o&&m(async()=>{try{await en(n.id,o),R.toast.success(l("version.release")),r(!1),i?.()}catch(e){R.toast.error(e instanceof Error?e.message:String(e))}})},disabled:!h,children:l("version.release")})]})]})})}var ei=e.i(400355);let el=(0,H.createServerReference)("400acfd4453438b3dc8e26e66b3d3e970ba5b16a93",H.callServer,void 0,H.findSourceMapURL,"getVersionDiff");var eo=e.i(196199);function ed({file:e}){let{t:r}=(0,D.useI18n)(),[n,a]=(0,s.useState)(!0),i=e.to&&"/dev/null"!==e.to?e.to:e.from??"",o=e.additions??0,d=e.deletions??0,c=[];for(let t of e.chunks)for(let e of(c.push({type:"normal",content:t.content,chunkHeader:t.content}),t.changes))c.push({type:e.type,content:e.content});let x=c.length>500,m=x?c.slice(0,500):c;return(0,t.jsxs)("div",{className:"overflow-hidden rounded-[10px] border border-border",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>a(e=>!e),className:"flex w-full items-center gap-2 bg-muted/40 px-3 py-2 text-left transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,t.jsx)(l.ChevronRight,{className:`h-3.5 w-3.5 flex-none text-muted-foreground/60 transition-transform duration-150 ${n?"rotate-90":""}`}),(0,t.jsx)("span",{className:"flex-1 truncate font-mono text-[12px] font-medium text-foreground",children:i}),(0,t.jsxs)("span",{className:"shrink-0 font-mono text-[11px] font-bold text-emerald-400",children:["+",o]}),(0,t.jsxs)("span",{className:"shrink-0 font-mono text-[11px] font-bold text-rose-400",children:["−",d]})]}),n&&(0,t.jsxs)("div",{className:"overflow-x-auto",children:[(0,t.jsx)("pre",{className:"m-0 p-0",children:m.map((e,s)=>void 0!==e.chunkHeader?(0,t.jsx)("div",{className:"whitespace-pre px-3 py-px font-mono text-xs text-muted-foreground bg-muted/40",children:e.content},s):"add"===e.type?(0,t.jsx)("div",{className:"whitespace-pre px-3 py-px font-mono text-xs text-emerald-300 bg-emerald-500/10",children:e.content},s):"del"===e.type?(0,t.jsx)("div",{className:"whitespace-pre px-3 py-px font-mono text-xs text-rose-300 bg-rose-500/10",children:e.content},s):(0,t.jsx)("div",{className:"whitespace-pre px-3 py-px font-mono text-xs text-muted-foreground",children:e.content},s))}),x&&(0,t.jsx)("p",{className:"border-t border-border px-3 py-2 text-[11px] text-muted-foreground/70 italic",children:r("version.diff.truncated")})]})]})}function ec({open:e,onOpenChange:r,versionId:n,versionLabel:a}){let{t:i}=(0,D.useI18n)(),[l,o]=(0,s.useTransition)(),[d,c]=(0,s.useState)(null),[x,m]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{e&&n&&(c(null),m(!1),o(async()=>{let e=await el(n);if(!e)return void m(!0);let t=(0,eo.parseUnifiedDiff)(e.patch);0===t.length||""===e.patch?m(!0):c(t)}))},[e,n]),(0,t.jsx)(O.Dialog,{open:e,onOpenChange:r,children:(0,t.jsxs)(O.DialogContent,{className:"sm:max-w-3xl max-h-[80vh] overflow-auto",children:[(0,t.jsx)(O.DialogHeader,{children:(0,t.jsxs)(O.DialogTitle,{children:[i("version.diff.title"),a?` — ${a}`:""]})}),l&&(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 py-12 text-muted-foreground",children:[(0,t.jsx)(ei.Loader2,{className:"h-5 w-5 animate-spin"}),(0,t.jsx)("span",{className:"text-sm",children:i("version.diff.loading")})]}),!l&&x&&(0,t.jsx)("p",{className:"py-10 text-center text-sm text-muted-foreground",children:i("version.diff.empty")}),!l&&d&&d.length>0&&(0,t.jsx)("div",{className:"flex flex-col gap-2",children:d.map((e,s)=>(0,t.jsx)(ed,{file:e},s))})]})})}var ex=e.i(605005);function em({version:e,isFirst:s,isLast:r,dashed:n=!1,diffStat:a,onEdit:i,onRelease:l,onViewDiff:o,onOpenTaskDetail:d}){return(0,t.jsxs)("div",{className:"flex gap-4",children:[(0,t.jsxs)("div",{className:"relative flex w-5 flex-none flex-col items-center",children:[(0,t.jsx)("div",{className:["w-px flex-none",s?"h-0":"h-6",n?"bg-[repeating-linear-gradient(to_bottom,var(--border)_0_4px,transparent_4px_8px)]":"bg-border"].filter(Boolean).join(" ")}),(0,t.jsx)("div",{className:["z-10 h-3.5 w-3.5 flex-none rounded-full border-2",e.isCurrent?"border-primary bg-primary ring-2 ring-primary/30":"ACTIVE"===e.status?"border-emerald-400 bg-emerald-400":"RELEASED"===e.status?"border-zinc-500 bg-zinc-500":"border-muted-foreground/40 bg-transparent border-dashed"].join(" ")}),!r&&(0,t.jsx)("div",{className:["w-px flex-1",n?"bg-[repeating-linear-gradient(to_bottom,var(--border)_0_4px,transparent_4px_8px)]":"bg-border"].join(" ")})]}),(0,t.jsx)("div",{className:"min-w-0 flex-1 pb-5",children:(0,t.jsx)(L,{version:e,diffStat:a??null,onEdit:i,onRelease:l,onViewDiff:o,onOpenTaskDetail:d})})]})}e.s(["VersionTimelineClient",0,function({project:e,workspaceId:d,versions:u,diffStats:p,backlog:h}){let f,{t:g}=(0,D.useI18n)(),v=(0,r.useRouter)(),[j,b]=(0,s.useState)(!1),[N,y]=(0,s.useState)(null),[w,C]=(0,s.useState)(!1),[S,k]=(0,s.useState)(!1),[T,B]=(0,s.useState)(null),[E,L]=(0,s.useState)(null),[R,_]=(0,s.useState)(null),[$,O]=(0,s.useState)(!1),A=[...[...u.filter(e=>"RELEASED"!==e.status)].sort((e,t)=>{if(!e.targetDate&&!t.targetDate)return 0;if(!e.targetDate)return 1;if(!t.targetDate)return -1;let s=new Date(t.targetDate).getTime()-new Date(e.targetDate).getTime();return 0!==s?s:new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()}),...[...u.filter(e=>"RELEASED"===e.status)].sort((e,t)=>e.releasedAt||t.releasedAt?e.releasedAt?t.releasedAt?new Date(t.releasedAt).getTime()-new Date(e.releasedAt).getTime():-1:1:0)],V=e=>{let t=u.find(t=>t.id===e);t&&(y({id:t.id,number:t.number,name:t.name,typeId:t.typeId??null,baseBranch:t.baseBranch,startDate:t.startDate,targetDate:t.targetDate,description:t.description}),b(!0))},P=e=>{let t=u.find(t=>t.id===e);t&&(B(t),k(!0))},M=e=>{L(e)},F=()=>{y(null),b(!0)},z=()=>{v.refresh()},U=T?u.filter(e=>e.id!==T.id&&("PLANNED"===e.status||"ACTIVE"===e.status)).map(e=>({id:e.id,number:e.number,name:e.name})):[],H=T?T.tasks.filter(e=>"DONE"!==e.status&&"CANCELLED"!==e.status).length:void 0;return(0,t.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,t.jsxs)("div",{className:"header-xl flex shrink-0 items-center gap-4 border-b px-6",children:[(0,t.jsxs)(n.default,{href:`/workspaces/${d}`,className:"flex items-center gap-1.5 text-sm text-muted-foreground transition-colors hover:text-foreground",children:[(0,t.jsx)(o.ArrowLeft,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:g("archive.backToBoard")})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)("span",{className:"truncate font-medium",children:e.name}),(0,t.jsx)("span",{children:"/"}),(0,t.jsx)("span",{children:g("version.timeline")})]}),(0,t.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground/70",children:g("version.historyHint")})]}),(0,t.jsxs)(x.Button,{variant:"outline",onClick:()=>C(!0),children:[(0,t.jsx)(c,{className:"h-4 w-4"}),g("version.manageTypes")]}),(0,t.jsxs)(x.Button,{onClick:F,children:[(0,t.jsx)(a.Plus,{className:"h-4 w-4"}),g("version.new")]})]}),(0,t.jsx)(m.ScrollArea,{className:"min-h-0 flex-1",children:(0,t.jsx)("div",{className:"px-6 py-6",children:(0,t.jsxs)("div",{className:"mx-auto max-w-3xl",children:[0===u.length&&0===h.length&&(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4 py-20 text-center text-muted-foreground",children:[(0,t.jsx)("p",{className:"text-sm",children:g("version.empty.list")}),(0,t.jsxs)(x.Button,{variant:"outline",onClick:F,children:[(0,t.jsx)(a.Plus,{className:"h-4 w-4"}),g("version.new")]})]}),A.length>0&&(0,t.jsx)("div",{className:"relative",children:A.map((e,s)=>(0,t.jsx)(em,{version:e,isFirst:0===s,isLast:s===A.length-1&&0===h.length,diffStat:p[e.id],onEdit:V,onRelease:P,onViewDiff:M,onOpenTaskDetail:_},e.id))}),h.length>0&&(0,t.jsxs)("div",{className:"flex gap-4",children:[(0,t.jsxs)("div",{className:"relative flex w-5 flex-none flex-col items-center",children:[(0,t.jsx)("div",{className:"h-6 w-px bg-[repeating-linear-gradient(to_bottom,var(--border)_0_4px,transparent_4px_8px)]"}),(0,t.jsx)("div",{className:"z-10 h-3.5 w-3.5 flex-none rounded-full border-2 border-dashed border-muted-foreground/40 bg-transparent"})]}),(0,t.jsx)("div",{className:"min-w-0 flex-1 pb-5",children:(0,t.jsxs)("div",{className:"overflow-hidden rounded-[14px] border border-dashed bg-muted/40 shadow-sm",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>O(e=>!e),className:"w-full px-4 py-3 text-left transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsx)(l.ChevronRight,{className:`h-3.5 w-3.5 flex-none text-muted-foreground/60 transition-transform duration-150 ${$?"rotate-90":""}`}),(0,t.jsx)(i.Archive,{className:"h-4 w-4 flex-none text-muted-foreground/70"}),(0,t.jsx)("span",{className:"text-sm font-semibold text-foreground",children:g("version.history")}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:g("version.historySub")}),(0,t.jsx)("span",{className:"flex-1"}),(0,t.jsxs)("span",{className:"text-[11.5px] text-muted-foreground",children:[h.length," ",g("version.tasksCount")]})]}),(0,t.jsx)("p",{className:"mt-2 text-xs text-muted-foreground/70",children:g("version.historyHint")})]}),$&&(0,t.jsx)("div",{className:"border-t border-dashed border-border px-2 pb-2 pt-1.5",children:h.map(e=>(0,t.jsx)(I,{task:e,onOpenDetail:_},e.id))})]})})]})]})})}),(0,t.jsx)(er,{open:j,onOpenChange:e=>{b(e),e||y(null)},projectId:e.id,workspaceId:d,editVersion:N,defaultBaseBranch:null,projectLocalPath:e.localPath,onSuccess:z}),(0,t.jsx)(ee,{open:w,onOpenChange:C,workspaceId:d,onChanged:()=>v.refresh()}),(0,t.jsx)(ea,{open:S,onOpenChange:e=>{k(e),e||B(null)},version:T?{id:T.id,number:T.number,name:T.name,unfinishedCount:H}:null,candidates:U,onSuccess:z}),(0,t.jsx)(ec,{open:!!E,onOpenChange:e=>{e||L(null)},versionId:E,versionLabel:E&&(f=u.find(e=>e.id===E))?`${f.number} ${f.name}`:void 0}),(0,t.jsx)(ex.TaskOverviewDrawer,{open:!!R,onOpenChange:e=>{e||_(null)},taskId:R})]})}],645119)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,645119,e=>{"use strict";var t=e.i(289721),s=e.i(965652),r=e.i(538059),n=e.i(210702),a=e.i(232545),i=e.i(487278),l=e.i(368490),o=e.i(259846),d=e.i(572989);let c=(0,d.default)("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);var x=e.i(519455),m=e.i(759684),u=e.i(606393),p=e.i(226145),h=e.i(340873),f=e.i(263938),g=e.i(960518),v=e.i(453889),j=e.i(645378);let b=(0,d.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);var N=e.i(464249);let y=(0,d.default)("package-check",[["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m16 17 2 2 4-4",key:"uh5qu3"}],["path",{d:"M21 11.127V8a2 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.729l7 4a2 2 0 0 0 2 .001l1.32-.753",key:"kpkbpo"}],["path",{d:"M3.29 7 12 12l8.71-5",key:"19ckod"}],["path",{d:"m7.5 4.27 8.997 5.148",key:"9yrvtv"}]]),w=(0,d.default)("panel-right",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);var C=e.i(746798),S=e.i(685149),k=e.i(35967),D=e.i(533499);function T(e){if(!e)return"";let t="string"==typeof e?new Date(e):e;if(isNaN(t.getTime()))return"";let s=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${s}-${r}`}let B=Object.fromEntries(S.BOARD_COLUMNS.map(e=>[e.id,e.color]));function E({children:e,className:s}){return(0,t.jsx)("span",{className:`inline-flex items-center gap-1.5 rounded-md border border-border bg-muted/40 px-2 py-0.5 text-xs text-muted-foreground ${s??""}`,children:e})}function I({task:e,onOpenDetail:r}){let{t:n}=(0,D.useI18n)(),[a,i]=(0,s.useState)(!1),o="CANCELLED"===e.status?"text-muted-foreground line-through decoration-muted-foreground/40":"DONE"===e.status?"text-muted-foreground":"text-foreground";return(0,t.jsxs)("div",{className:"rounded-[10px]",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),className:"flex w-full items-center gap-2.5 rounded-[10px] px-2.5 py-2.5 text-left transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,t.jsx)(l.ChevronRight,{className:`h-3.5 w-3.5 flex-none text-muted-foreground/60 transition-transform duration-150 ${a?"rotate-90":""}`}),(0,t.jsx)("span",{className:`h-2 w-2 flex-none rounded-full ${B[e.status]??"bg-slate-400"}`}),(0,t.jsx)("span",{className:`text-[13.5px] font-medium ${o}`,children:e.title}),e.labels.map(({label:e})=>(0,t.jsx)("span",{className:"rounded-full border border-border px-1.5 py-px text-[10.5px] text-muted-foreground",style:e.color?{borderColor:e.color+"55",color:e.color}:void 0,children:e.name},e.id)),(0,t.jsx)("span",{className:"flex-1"}),(0,t.jsx)("span",{className:"flex w-16 flex-none justify-center",children:(0,t.jsx)("span",{className:`rounded-[5px] px-1.5 py-px text-[10.5px] font-bold ${S.PRIORITY_CONFIG[e.priority]?.color??S.PRIORITY_CONFIG.LOW.color}`,children:e.priority})}),(0,t.jsx)("span",{className:"h-3 w-px bg-border flex-none"}),(0,t.jsxs)("span",{className:"flex w-[72px] flex-none items-center gap-1.5",children:[(0,t.jsx)("span",{className:`h-1.5 w-1.5 flex-none rounded-full ${B[e.status]??"bg-slate-400"}`}),(0,t.jsx)("span",{className:"truncate text-[10.5px] text-muted-foreground",children:n(`version.taskStatus.${e.status}`)})]}),(0,t.jsx)("span",{className:"h-3 w-px bg-border flex-none"}),(0,t.jsx)("span",{className:"flex w-6 flex-none justify-center",children:r&&(0,t.jsxs)(C.Tooltip,{children:[(0,t.jsx)(C.TooltipTrigger,{render:(0,t.jsx)(x.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground",onClick:t=>{t.stopPropagation(),r(e.id)}}),children:(0,t.jsx)(w,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(C.TooltipContent,{children:n("version.detail")})]})})]}),a&&(0,t.jsxs)("div",{className:"flex flex-col gap-2.5 pb-3 pl-[30px] pr-3 pt-1",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"mb-1.5 flex items-center gap-1.5",children:[(0,t.jsx)(v.FolderOpen,{className:"h-3 w-3 text-muted-foreground/60"}),(0,t.jsx)("span",{className:"text-[11px] font-bold uppercase tracking-wide text-muted-foreground/60",children:n("version.resources")})]}),0===e.assets.length?(0,t.jsx)("p",{className:"text-[12px] italic text-muted-foreground/60",children:n("version.empty.resources")}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.assets.map(e=>{var s;let r=e.mimeType?.startsWith("image/");return(0,t.jsxs)("span",{className:"inline-flex cursor-pointer items-center gap-1.5 rounded-lg border border-border bg-background px-2.5 py-1.5 text-[12px] text-foreground shadow-sm transition-colors hover:border-primary/50",children:[r?(0,t.jsx)(b,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,t.jsx)(j.FileText,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,t.jsx)("span",{children:e.filename}),null!=e.size&&(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground/60",children:(s=e.size)<1024?`${s} B`:s<1048576?`${Math.round(s/1024)} KB`:`${(s/1048576).toFixed(1)} MB`})]},e.id)})})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"mb-1.5 flex items-center gap-1.5",children:[(0,t.jsx)(j.FileText,{className:"h-3 w-3 text-muted-foreground/60"}),(0,t.jsx)("span",{className:"text-[11px] font-bold uppercase tracking-wide text-muted-foreground/60",children:n("version.notes")})]}),0===e.notes.length?(0,t.jsx)("p",{className:"text-[12px] italic text-muted-foreground/60",children:n("version.empty.notes")}):(0,t.jsx)("div",{className:"flex flex-col gap-1.5",children:e.notes.map(e=>(0,t.jsx)("div",{className:"rounded-lg border border-border border-l-violet-500/50 bg-background px-2.5 py-2 shadow-sm [border-left-width:3px]",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-[12.5px] font-semibold text-foreground",children:e.title}),e.category&&(0,t.jsx)("span",{className:"rounded-[5px] border border-violet-500/30 bg-violet-500/15 px-1.5 py-px text-[10px] font-bold text-violet-300",children:e.category})]})},e.id))})]})]})]})}function L({version:e,diffStat:r,onEdit:n,onRelease:a,onViewDiff:i,onOpenTaskDetail:o}){var d;let c,{t:m}=(0,D.useI18n)(),[v,j]=(0,s.useState)(e.isCurrent),b="RELEASED"===e.status,w="ACTIVE"===e.status,S=e.tasks.length,B=e.tasks.filter(e=>"DONE"===e.status).length,R=!!(e.releaseCommit||r),_=(c=`${S} ${m("version.tasksCount")}`,B>0&&B<S?`${c} \xb7 ${B} ${m("version.doneCount")}`:B>0&&B===S?`${c} \xb7 ${m("version.allDone")}`:c);return(0,t.jsxs)("div",{className:["overflow-hidden rounded-[14px] border bg-card shadow-sm transition-shadow duration-150 hover:shadow-md",e.isCurrent?"border-border border-l-2 border-l-primary ring-1 ring-primary/20":"border-border",b?"opacity-[.96]":""].filter(Boolean).join(" "),children:[(0,t.jsx)("button",{type:"button",onClick:()=>j(e=>!e),className:"w-full text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:(0,t.jsxs)("div",{className:"px-4 py-3.5",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(l.ChevronRight,{className:`h-4 w-4 flex-none text-muted-foreground/60 transition-transform duration-150 ${v?"rotate-90":""}`}),(0,t.jsx)("span",{className:"font-mono text-[14.5px] font-bold text-foreground",children:e.number}),(0,t.jsx)("span",{className:"text-[14.5px] font-semibold text-foreground",children:e.name}),(0,t.jsx)(k.VersionTypeBadge,{name:e.type?.name??null}),(0,t.jsx)(k.VersionStatusBadge,{status:e.status}),e.isCurrent&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-primary/30 bg-primary/15 px-2.5 py-0.5 text-[11px] font-bold text-primary shadow-sm",children:[(0,t.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-primary opacity-90"}),m("version.current")]}),(0,t.jsx)("span",{className:"flex-1"}),S>0&&(0,t.jsx)("span",{className:"text-[11.5px] text-muted-foreground",children:_}),(0,t.jsxs)("span",{className:"flex items-center gap-1",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[n&&(0,t.jsxs)(C.Tooltip,{children:[(0,t.jsx)(C.TooltipTrigger,{render:(0,t.jsx)(x.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>n(e.id)}),children:(0,t.jsx)(N.Pencil,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(C.TooltipContent,{children:m("version.edit")})]}),w&&a&&(0,t.jsxs)(x.Button,{variant:"outline",className:"h-7 px-2 text-xs font-semibold",onClick:()=>a(e.id),children:[(0,t.jsx)(y,{className:"h-3.5 w-3.5"}),m("version.release")]})]})]}),(0,t.jsxs)("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[b&&e.releasedAt?(0,t.jsxs)(E,{children:[(0,t.jsx)(u.Calendar,{className:"h-3 w-3"}),m("version.releasedAt"),(0,t.jsx)("strong",{className:"text-foreground",children:T(e.releasedAt)})]}):e.startDate||e.targetDate?(0,t.jsxs)(E,{children:[(0,t.jsx)(u.Calendar,{className:"h-3 w-3"}),e.startDate?T(e.startDate):"—"," → ",e.targetDate?(0,t.jsx)("strong",{className:"text-foreground",children:T(e.targetDate)}):"—"]}):null,e.baseBranch&&(0,t.jsxs)(E,{children:[(0,t.jsx)(p.GitBranch,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"font-mono text-[11px] text-foreground",children:e.baseBranch})]}),e.baseCommit&&(0,t.jsxs)(E,{children:[(0,t.jsx)(h.GitCommitHorizontal,{className:"h-3 w-3"}),m("version.field.baseCommit"),(0,t.jsx)("span",{className:"font-mono text-[11px] text-foreground",children:(d=e.baseCommit)?d.slice(0,7):""})]}),b&&(0,t.jsxs)(E,{children:[(0,t.jsx)(f.Tag,{className:"h-3 w-3"}),(0,t.jsx)("span",{className:"font-mono text-[11px] text-foreground",children:e.number})]}),r&&(0,t.jsxs)(E,{children:[(0,t.jsx)(g.GitCompare,{className:"h-3 w-3"}),!b&&(0,t.jsx)("span",{className:"text-muted-foreground",children:m("version.diff.live")}),(0,t.jsxs)("span",{className:"font-bold text-emerald-400",children:["+",r.additions.toLocaleString()]}),(0,t.jsxs)("span",{className:"font-bold text-rose-400",children:["−",r.deletions.toLocaleString()]}),(0,t.jsxs)("span",{className:"text-muted-foreground",children:["· ",r.files," ",m("version.diff.files")]})]}),R&&i&&(0,t.jsxs)(x.Button,{variant:"ghost",size:"sm",className:"h-6 gap-1 px-2 text-xs text-muted-foreground",onClick:t=>{t.stopPropagation(),i(e.id)},children:[(0,t.jsx)(g.GitCompare,{className:"h-3 w-3"}),m("version.diff.view")," →"]})]}),e.description&&(0,t.jsx)("p",{className:"mt-2 text-[13px] text-muted-foreground",children:e.description})]})}),v&&S>0&&(0,t.jsx)("div",{className:"border-t border-dashed border-border bg-muted/40 px-2 pb-2 pt-1.5",children:e.tasks.map(e=>(0,t.jsx)(I,{task:e,onOpenDetail:o},e.id))})]})}var R=e.i(360112),_=e.i(597746),$=e.i(456346),O=e.i(776639),A=e.i(793479),V=e.i(110204),P=e.i(280027),M=e.i(337822),F=e.i(317056),z=e.i(699375),U=e.i(624687),H=e.i(514798);let G=(0,H.createServerReference)("400f0b8fbfecfcbe055afa2fe8474e3e4a67718a4b",H.callServer,void 0,H.findSourceMapURL,"createVersion"),K=(0,H.createServerReference)("607ad1c062c853f2b493a07e9c17d4ab0af92c3929",H.callServer,void 0,H.findSourceMapURL,"updateVersion"),W=(0,H.createServerReference)("408f6b18494b73544dfd241989c2448bc76cfa8490",H.callServer,void 0,H.findSourceMapURL,"getVersionTypes");var Y=e.i(505610),q=e.i(598382),J=e.i(998626);let Q=(0,H.createServerReference)("40a42ec1b99169aa188307baec76559eabb954f3f9",H.callServer,void 0,H.findSourceMapURL,"createVersionType"),X=(0,H.createServerReference)("6002bdddfc7eedebe3343f4413f5a14e7eb5ed2f13",H.callServer,void 0,H.findSourceMapURL,"updateVersionType"),Z=(0,H.createServerReference)("401c1c1148b68e5a5239c44a55f857048164e9a885",H.callServer,void 0,H.findSourceMapURL,"deleteVersionType");function ee({open:e,onOpenChange:r,workspaceId:n,onChanged:a}){let{t:i}=(0,D.useI18n)(),[l,o]=(0,s.useState)([]),[d,c]=(0,s.useState)(""),[m,u]=(0,s.useState)({}),[p,h]=(0,s.useTransition)(),f=async()=>{let e=await W(n);o(e),u(t=>{let s={};return e.forEach(e=>{s[e.id]=e.id in t?t[e.id]:e.name}),s})};(0,s.useEffect)(()=>{e&&(f(),c(""))},[e,n]);let g=()=>{let e=d.trim();e&&h(async()=>{try{await Q({workspaceId:n,name:e}),c(""),await f(),a?.(),R.toast.success(i("version.type.add"))}catch(e){R.toast.error(e instanceof Error?e.message:String(e))}})};return(0,t.jsx)(O.Dialog,{open:e,onOpenChange:r,children:(0,t.jsxs)(O.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(O.DialogHeader,{children:(0,t.jsx)(O.DialogTitle,{children:i("version.manageTypes")})}),(0,t.jsxs)("div",{className:"flex flex-col gap-4 py-2",children:[(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(A.Input,{value:d,onChange:e=>c(e.target.value),placeholder:i("version.type.namePlaceholder"),disabled:p,onKeyDown:e=>{"Enter"===e.key&&g()},className:"flex-1"}),(0,t.jsx)(x.Button,{onClick:g,disabled:p||!d.trim(),children:i("version.type.add")})]}),0===l.length?(0,t.jsx)("p",{className:"text-center text-sm text-muted-foreground py-4",children:i("version.type.empty")}):(0,t.jsx)("div",{className:"flex flex-col gap-1.5",children:l.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/30 px-3 py-2",children:[(0,t.jsx)("span",{className:`inline-flex h-2.5 w-2.5 flex-none rounded-full ${(0,k.typeBadgeColor)(m[e.id]??e.name).split(" ").filter(e=>e.startsWith("bg-"))[0]??"bg-muted"}`}),(0,t.jsx)(A.Input,{value:m[e.id]??e.name,onChange:t=>u(s=>({...s,[e.id]:t.target.value})),onBlur:()=>(e=>{let t=(m[e]??"").trim();if(!t)return;let s=l.find(t=>t.id===e);s?.name!==t&&h(async()=>{try{await X(e,{name:t}),await f(),a?.()}catch(t){R.toast.error(t instanceof Error?t.message:String(t)),u(t=>({...t,[e]:s?.name??""}))}})})(e.id),onKeyDown:e=>{"Enter"===e.key&&e.target.blur()},disabled:p,className:"h-7 flex-1 border-transparent bg-transparent shadow-none focus-visible:border-input focus-visible:bg-background focus-visible:shadow-sm"}),(0,t.jsx)(x.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 flex-none text-muted-foreground hover:text-destructive",onClick:()=>{var t;return t=e.id,void(window.confirm(i("version.type.deleteConfirm"))&&h(async()=>{try{await Z(t),await f(),a?.()}catch(e){R.toast.error(e instanceof Error?e.message:String(e))}}))},disabled:p,children:(0,t.jsx)(J.Trash2,{className:"h-3.5 w-3.5"})})]},e.id))})]})]})})}function et(e){if(!e)return"";let t="string"==typeof e?new Date(e):e;if(isNaN(t.getTime()))return"";let s=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0");return`${s}-${r}-${n}`}function es(e){if(!e)return;let t=new Date(e);return isNaN(t.getTime())?void 0:t}function er({open:e,onOpenChange:r,projectId:n,workspaceId:a,editVersion:i,defaultBaseBranch:l,projectLocalPath:o,onSuccess:d}){let{t:c}=(0,D.useI18n)(),m=!!i,[u,h]=(0,s.useState)(""),[f,g]=(0,s.useState)(""),[v,j]=(0,s.useState)(""),[b,N]=(0,s.useState)([]),[y,w]=(0,s.useState)(!1),[C,S]=(0,s.useState)(""),[k,T]=(0,s.useState)(""),[B,E]=(0,s.useState)(""),[I,L]=(0,s.useState)(""),[H,J]=(0,s.useState)(!1),[Q,X]=(0,s.useState)([]),[Z,en]=(0,s.useState)(!1),[ea,ei]=(0,s.useState)(!1),el=!!o,[eo,ed]=(0,s.useTransition)();return(0,s.useEffect)(()=>{e&&(i?(h(i.number),g(i.name),j(i.typeId??""),S(i.baseBranch??""),T(et(i.startDate)),E(et(i.targetDate)),L(i.description??"")):(h(""),g(""),j(""),S(l??""),T(""),E(""),L("")),J(!1))},[e,i,l]),(0,s.useEffect)(()=>{e&&W(a).then(N).catch(()=>N([]))},[e,a]),(0,s.useEffect)(()=>{e&&el?(en(!0),(0,Y.getProjectBranches)(o).then(X).catch(()=>X([])).finally(()=>en(!1)),(0,q.fetchRemoteBranches)(o).then(()=>(0,Y.getProjectBranches)(o).then(X)).catch(()=>{})):X([])},[e,el,o]),(0,t.jsxs)(O.Dialog,{open:e,onOpenChange:r,children:[(0,t.jsxs)(O.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(O.DialogHeader,{children:(0,t.jsx)(O.DialogTitle,{children:m?c("version.edit"):c("version.new")})}),(0,t.jsxs)("div",{className:"grid gap-4 py-2",children:[(0,t.jsxs)("div",{className:"grid gap-1.5",children:[(0,t.jsxs)(V.Label,{htmlFor:"version-number",children:[c("version.field.number"),(0,t.jsx)("span",{className:"text-destructive ml-0.5",children:"*"})]}),(0,t.jsx)(A.Input,{id:"version-number",value:u,onChange:e=>h(e.target.value),placeholder:c("version.placeholder.number"),disabled:eo})]}),(0,t.jsxs)("div",{className:"grid gap-1.5",children:[(0,t.jsxs)(V.Label,{htmlFor:"version-name",children:[c("version.field.name"),(0,t.jsx)("span",{className:"text-destructive ml-0.5",children:"*"})]}),(0,t.jsx)(A.Input,{id:"version-name",value:f,onChange:e=>g(e.target.value),placeholder:c("version.placeholder.name"),disabled:eo})]}),(0,t.jsxs)("div",{className:"grid gap-1.5",children:[(0,t.jsx)(V.Label,{children:c("version.field.type")}),(0,t.jsxs)(P.Select,{value:v||"__none__",onValueChange:e=>{j(e&&"__none__"!==e?e:"")},children:[(0,t.jsx)(P.SelectTrigger,{className:"w-full",disabled:eo,children:(0,t.jsx)("span",{className:"truncate",children:v?b.find(e=>e.id===v)?.name??c("version.type.uncategorized"):c("version.type.uncategorized")})}),(0,t.jsxs)(P.SelectContent,{children:[(0,t.jsx)(P.SelectItem,{value:"__none__",children:c("version.type.uncategorized")}),b.map(e=>(0,t.jsx)(P.SelectItem,{value:e.id,children:e.name},e.id))]})]}),(0,t.jsxs)(x.Button,{type:"button",variant:"ghost",size:"sm",className:"h-auto justify-start px-0 py-0.5 text-xs text-muted-foreground hover:text-foreground",onClick:()=>w(!0),disabled:eo,children:["+ ",c("version.manageTypes")]})]}),(0,t.jsxs)("div",{className:"grid gap-1.5",children:[(0,t.jsx)(V.Label,{children:c("version.field.baseBranch")}),Z?(0,t.jsx)("div",{className:"text-sm text-muted-foreground",children:c("task.branchLoading")}):el&&Q.length>0?(0,t.jsxs)(M.Popover,{open:ea,onOpenChange:ei,children:[(0,t.jsxs)(M.PopoverTrigger,{className:"flex h-8 w-full items-center gap-2 rounded-lg border border-input bg-transparent px-3 text-sm transition-colors hover:bg-accent focus:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50",disabled:eo,"data-testid":"version-branch-selector",children:[(0,t.jsx)(p.GitBranch,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:`flex-1 truncate text-left text-xs ${C?"font-mono":"text-muted-foreground"}`,title:C||void 0,children:C||c("version.field.noBranch")}),(0,t.jsx)($.ChevronsUpDown,{className:"h-3.5 w-3.5 shrink-0 opacity-50"})]}),(0,t.jsx)(M.PopoverContent,{className:"w-[min(32rem,90vw)] p-0",align:"start",children:(0,t.jsxs)(F.Command,{children:[(0,t.jsx)(F.CommandInput,{placeholder:c("task.branchSearch")}),(0,t.jsxs)(F.CommandList,{children:[(0,t.jsx)(F.CommandEmpty,{children:c("task.branchNone")}),(0,t.jsxs)(F.CommandGroup,{children:[(0,t.jsxs)(F.CommandItem,{value:"__none__",onSelect:()=>{S(""),ei(!1)},children:[(0,t.jsx)("span",{className:"flex-1 truncate text-muted-foreground",children:c("version.field.noBranch")}),!C&&(0,t.jsx)(_.Check,{className:"ml-auto h-3 w-3 shrink-0 text-primary"})]}),Q.map(e=>(0,t.jsxs)(F.CommandItem,{value:e,onSelect:()=>{S(e),ei(!1)},children:[(0,t.jsx)(p.GitBranch,{className:"mr-2 h-3 w-3 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"flex-1 truncate font-mono",title:e,children:e}),e===C&&(0,t.jsx)(_.Check,{className:"ml-auto h-3 w-3 shrink-0 text-primary"})]},e))]})]})]})})]}):(0,t.jsx)(A.Input,{id:"version-base-branch",value:C,onChange:e=>S(e.target.value),placeholder:"main",disabled:eo})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{className:"grid gap-1.5",children:[(0,t.jsx)(V.Label,{htmlFor:"version-start-date",children:c("version.field.startDate")}),(0,t.jsx)("input",{id:"version-start-date",type:"date",value:k,onChange:e=>T(e.target.value),disabled:eo,className:"h-8 w-full rounded-lg border border-input bg-transparent px-2.5 py-1 text-sm outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50"})]}),(0,t.jsxs)("div",{className:"grid gap-1.5",children:[(0,t.jsx)(V.Label,{htmlFor:"version-target-date",children:c("version.field.targetDate")}),(0,t.jsx)("input",{id:"version-target-date",type:"date",value:B,onChange:e=>E(e.target.value),disabled:eo,className:"h-8 w-full rounded-lg border border-input bg-transparent px-2.5 py-1 text-sm outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50"})]})]}),(0,t.jsxs)("div",{className:"grid gap-1.5",children:[(0,t.jsx)(V.Label,{htmlFor:"version-description",children:c("version.field.description")}),(0,t.jsx)(U.Textarea,{id:"version-description",value:I,onChange:e=>L(e.target.value),rows:3,disabled:eo})]}),!m&&(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(z.Switch,{id:"version-set-current",checked:H,onCheckedChange:J,disabled:eo}),(0,t.jsx)(V.Label,{htmlFor:"version-set-current",className:"cursor-pointer",children:c("version.field.setCurrent")})]})]}),(0,t.jsxs)(O.DialogFooter,{children:[(0,t.jsx)(x.Button,{variant:"outline",onClick:()=>r(!1),disabled:eo,children:c("common.cancel")}),(0,t.jsx)(x.Button,{onClick:()=>{u.trim()&&f.trim()&&ed(async()=>{try{m&&i?await K(i.id,{number:u.trim(),name:f.trim(),typeId:v||null,baseBranch:C.trim()||null,startDate:es(k)??null,targetDate:es(B)??null,description:I.trim()||null}):await G({projectId:n,number:u.trim(),name:f.trim(),typeId:v||void 0,baseBranch:C.trim()||void 0,startDate:es(k),targetDate:es(B),description:I.trim()||void 0,setCurrent:H}),R.toast.success(m?c("version.edit"):c("version.new")),r(!1),d?.()}catch(e){R.toast.error(e instanceof Error?e.message:String(e))}})},disabled:eo||!u.trim()||!f.trim(),children:m?c("common.save"):c("common.create")})]})]}),(0,t.jsx)(ee,{open:y,onOpenChange:w,workspaceId:a,onChanged:()=>W(a).then(N)})]})}let en=(0,H.createServerReference)("60d8a396a284f13ce96dcc6f1e32018d98b8eb5344",H.callServer,void 0,H.findSourceMapURL,"releaseVersion");function ea({open:e,onOpenChange:r,version:n,candidates:a,onSuccess:i}){let{t:l}=(0,D.useI18n)(),[o,d]=(0,s.useState)(""),[c,m]=(0,s.useTransition)();(0,s.useEffect)(()=>{e&&d("")},[e,n]);let u=a.find(e=>e.id===o),p=a.length>0,h=p&&!!o&&!c;return(0,t.jsx)(O.Dialog,{open:e,onOpenChange:r,children:(0,t.jsxs)(O.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(O.DialogHeader,{children:(0,t.jsx)(O.DialogTitle,{children:l("version.releaseAction")})}),(0,t.jsxs)("div",{className:"grid gap-4 py-2",children:[n&&(0,t.jsxs)("p",{className:"text-sm text-muted-foreground",children:[n.number," · ",n.name]}),(0,t.jsxs)("div",{className:"text-sm",children:[(0,t.jsx)("span",{children:l("version.release.rolloverHint")}),n?.unfinishedCount!==void 0&&n.unfinishedCount>0&&(0,t.jsxs)("span",{className:"ml-1 font-medium text-foreground",children:["(",n.unfinishedCount,")"]})]}),(0,t.jsxs)("div",{className:"grid gap-1.5",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:l("version.release.nextVersion")}),p?(0,t.jsxs)(P.Select,{value:o,onValueChange:e=>{e&&d(e)},disabled:c,children:[(0,t.jsx)(P.SelectTrigger,{className:"w-full",children:(0,t.jsx)("span",{className:"truncate",children:u?`${u.number} \xb7 ${u.name}`:""})}),(0,t.jsx)(P.SelectContent,{children:a.map(e=>(0,t.jsxs)(P.SelectItem,{value:e.id,children:[e.number," · ",e.name]},e.id))})]}):(0,t.jsx)("p",{className:"text-xs text-destructive",children:l("version.release.noCandidates")})]})]}),(0,t.jsxs)(O.DialogFooter,{children:[(0,t.jsx)(x.Button,{variant:"outline",onClick:()=>r(!1),disabled:c,children:l("common.cancel")}),(0,t.jsx)(x.Button,{onClick:()=>{n&&o&&m(async()=>{try{await en(n.id,o),R.toast.success(l("version.release")),r(!1),i?.()}catch(e){R.toast.error(e instanceof Error?e.message:String(e))}})},disabled:!h,children:l("version.release")})]})]})})}var ei=e.i(400355);let el=(0,H.createServerReference)("40eeddda01c4640b57d00f13932e50965270489af0",H.callServer,void 0,H.findSourceMapURL,"getVersionDiff");var eo=e.i(196199);function ed({file:e}){let{t:r}=(0,D.useI18n)(),[n,a]=(0,s.useState)(!0),i=e.to&&"/dev/null"!==e.to?e.to:e.from??"",o=e.additions??0,d=e.deletions??0,c=[];for(let t of e.chunks)for(let e of(c.push({type:"normal",content:t.content,chunkHeader:t.content}),t.changes))c.push({type:e.type,content:e.content});let x=c.length>500,m=x?c.slice(0,500):c;return(0,t.jsxs)("div",{className:"overflow-hidden rounded-[10px] border border-border",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>a(e=>!e),className:"flex w-full items-center gap-2 bg-muted/40 px-3 py-2 text-left transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,t.jsx)(l.ChevronRight,{className:`h-3.5 w-3.5 flex-none text-muted-foreground/60 transition-transform duration-150 ${n?"rotate-90":""}`}),(0,t.jsx)("span",{className:"flex-1 truncate font-mono text-[12px] font-medium text-foreground",children:i}),(0,t.jsxs)("span",{className:"shrink-0 font-mono text-[11px] font-bold text-emerald-400",children:["+",o]}),(0,t.jsxs)("span",{className:"shrink-0 font-mono text-[11px] font-bold text-rose-400",children:["−",d]})]}),n&&(0,t.jsxs)("div",{className:"overflow-x-auto",children:[(0,t.jsx)("pre",{className:"m-0 p-0",children:m.map((e,s)=>void 0!==e.chunkHeader?(0,t.jsx)("div",{className:"whitespace-pre px-3 py-px font-mono text-xs text-muted-foreground bg-muted/40",children:e.content},s):"add"===e.type?(0,t.jsx)("div",{className:"whitespace-pre px-3 py-px font-mono text-xs text-emerald-300 bg-emerald-500/10",children:e.content},s):"del"===e.type?(0,t.jsx)("div",{className:"whitespace-pre px-3 py-px font-mono text-xs text-rose-300 bg-rose-500/10",children:e.content},s):(0,t.jsx)("div",{className:"whitespace-pre px-3 py-px font-mono text-xs text-muted-foreground",children:e.content},s))}),x&&(0,t.jsx)("p",{className:"border-t border-border px-3 py-2 text-[11px] text-muted-foreground/70 italic",children:r("version.diff.truncated")})]})]})}function ec({open:e,onOpenChange:r,versionId:n,versionLabel:a}){let{t:i}=(0,D.useI18n)(),[l,o]=(0,s.useTransition)(),[d,c]=(0,s.useState)(null),[x,m]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{e&&n&&(c(null),m(!1),o(async()=>{let e=await el(n);if(!e)return void m(!0);let t=(0,eo.parseUnifiedDiff)(e.patch);0===t.length||""===e.patch?m(!0):c(t)}))},[e,n]),(0,t.jsx)(O.Dialog,{open:e,onOpenChange:r,children:(0,t.jsxs)(O.DialogContent,{className:"sm:max-w-3xl max-h-[80vh] overflow-auto",children:[(0,t.jsx)(O.DialogHeader,{children:(0,t.jsxs)(O.DialogTitle,{children:[i("version.diff.title"),a?` — ${a}`:""]})}),l&&(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 py-12 text-muted-foreground",children:[(0,t.jsx)(ei.Loader2,{className:"h-5 w-5 animate-spin"}),(0,t.jsx)("span",{className:"text-sm",children:i("version.diff.loading")})]}),!l&&x&&(0,t.jsx)("p",{className:"py-10 text-center text-sm text-muted-foreground",children:i("version.diff.empty")}),!l&&d&&d.length>0&&(0,t.jsx)("div",{className:"flex flex-col gap-2",children:d.map((e,s)=>(0,t.jsx)(ed,{file:e},s))})]})})}var ex=e.i(605005);function em({version:e,isFirst:s,isLast:r,dashed:n=!1,diffStat:a,onEdit:i,onRelease:l,onViewDiff:o,onOpenTaskDetail:d}){return(0,t.jsxs)("div",{className:"flex gap-4",children:[(0,t.jsxs)("div",{className:"relative flex w-5 flex-none flex-col items-center",children:[(0,t.jsx)("div",{className:["w-px flex-none",s?"h-0":"h-6",n?"bg-[repeating-linear-gradient(to_bottom,var(--border)_0_4px,transparent_4px_8px)]":"bg-border"].filter(Boolean).join(" ")}),(0,t.jsx)("div",{className:["z-10 h-3.5 w-3.5 flex-none rounded-full border-2",e.isCurrent?"border-primary bg-primary ring-2 ring-primary/30":"ACTIVE"===e.status?"border-emerald-400 bg-emerald-400":"RELEASED"===e.status?"border-zinc-500 bg-zinc-500":"border-muted-foreground/40 bg-transparent border-dashed"].join(" ")}),!r&&(0,t.jsx)("div",{className:["w-px flex-1",n?"bg-[repeating-linear-gradient(to_bottom,var(--border)_0_4px,transparent_4px_8px)]":"bg-border"].join(" ")})]}),(0,t.jsx)("div",{className:"min-w-0 flex-1 pb-5",children:(0,t.jsx)(L,{version:e,diffStat:a??null,onEdit:i,onRelease:l,onViewDiff:o,onOpenTaskDetail:d})})]})}e.s(["VersionTimelineClient",0,function({project:e,workspaceId:d,versions:u,diffStats:p,backlog:h}){let f,{t:g}=(0,D.useI18n)(),v=(0,r.useRouter)(),[j,b]=(0,s.useState)(!1),[N,y]=(0,s.useState)(null),[w,C]=(0,s.useState)(!1),[S,k]=(0,s.useState)(!1),[T,B]=(0,s.useState)(null),[E,L]=(0,s.useState)(null),[R,_]=(0,s.useState)(null),[$,O]=(0,s.useState)(!1),A=[...[...u.filter(e=>"RELEASED"!==e.status)].sort((e,t)=>{if(!e.targetDate&&!t.targetDate)return 0;if(!e.targetDate)return 1;if(!t.targetDate)return -1;let s=new Date(t.targetDate).getTime()-new Date(e.targetDate).getTime();return 0!==s?s:new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()}),...[...u.filter(e=>"RELEASED"===e.status)].sort((e,t)=>e.releasedAt||t.releasedAt?e.releasedAt?t.releasedAt?new Date(t.releasedAt).getTime()-new Date(e.releasedAt).getTime():-1:1:0)],V=e=>{let t=u.find(t=>t.id===e);t&&(y({id:t.id,number:t.number,name:t.name,typeId:t.typeId??null,baseBranch:t.baseBranch,startDate:t.startDate,targetDate:t.targetDate,description:t.description}),b(!0))},P=e=>{let t=u.find(t=>t.id===e);t&&(B(t),k(!0))},M=e=>{L(e)},F=()=>{y(null),b(!0)},z=()=>{v.refresh()},U=T?u.filter(e=>e.id!==T.id&&("PLANNED"===e.status||"ACTIVE"===e.status)).map(e=>({id:e.id,number:e.number,name:e.name})):[],H=T?T.tasks.filter(e=>"DONE"!==e.status&&"CANCELLED"!==e.status).length:void 0;return(0,t.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,t.jsxs)("div",{className:"header-xl flex shrink-0 items-center gap-4 border-b px-6",children:[(0,t.jsxs)(n.default,{href:`/workspaces/${d}`,className:"flex items-center gap-1.5 text-sm text-muted-foreground transition-colors hover:text-foreground",children:[(0,t.jsx)(o.ArrowLeft,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:g("archive.backToBoard")})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)("span",{className:"truncate font-medium",children:e.name}),(0,t.jsx)("span",{children:"/"}),(0,t.jsx)("span",{children:g("version.timeline")})]}),(0,t.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground/70",children:g("version.historyHint")})]}),(0,t.jsxs)(x.Button,{variant:"outline",onClick:()=>C(!0),children:[(0,t.jsx)(c,{className:"h-4 w-4"}),g("version.manageTypes")]}),(0,t.jsxs)(x.Button,{onClick:F,children:[(0,t.jsx)(a.Plus,{className:"h-4 w-4"}),g("version.new")]})]}),(0,t.jsx)(m.ScrollArea,{className:"min-h-0 flex-1",children:(0,t.jsx)("div",{className:"px-6 py-6",children:(0,t.jsxs)("div",{className:"mx-auto max-w-3xl",children:[0===u.length&&0===h.length&&(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4 py-20 text-center text-muted-foreground",children:[(0,t.jsx)("p",{className:"text-sm",children:g("version.empty.list")}),(0,t.jsxs)(x.Button,{variant:"outline",onClick:F,children:[(0,t.jsx)(a.Plus,{className:"h-4 w-4"}),g("version.new")]})]}),A.length>0&&(0,t.jsx)("div",{className:"relative",children:A.map((e,s)=>(0,t.jsx)(em,{version:e,isFirst:0===s,isLast:s===A.length-1&&0===h.length,diffStat:p[e.id],onEdit:V,onRelease:P,onViewDiff:M,onOpenTaskDetail:_},e.id))}),h.length>0&&(0,t.jsxs)("div",{className:"flex gap-4",children:[(0,t.jsxs)("div",{className:"relative flex w-5 flex-none flex-col items-center",children:[(0,t.jsx)("div",{className:"h-6 w-px bg-[repeating-linear-gradient(to_bottom,var(--border)_0_4px,transparent_4px_8px)]"}),(0,t.jsx)("div",{className:"z-10 h-3.5 w-3.5 flex-none rounded-full border-2 border-dashed border-muted-foreground/40 bg-transparent"})]}),(0,t.jsx)("div",{className:"min-w-0 flex-1 pb-5",children:(0,t.jsxs)("div",{className:"overflow-hidden rounded-[14px] border border-dashed bg-muted/40 shadow-sm",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>O(e=>!e),className:"w-full px-4 py-3 text-left transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsx)(l.ChevronRight,{className:`h-3.5 w-3.5 flex-none text-muted-foreground/60 transition-transform duration-150 ${$?"rotate-90":""}`}),(0,t.jsx)(i.Archive,{className:"h-4 w-4 flex-none text-muted-foreground/70"}),(0,t.jsx)("span",{className:"text-sm font-semibold text-foreground",children:g("version.history")}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:g("version.historySub")}),(0,t.jsx)("span",{className:"flex-1"}),(0,t.jsxs)("span",{className:"text-[11.5px] text-muted-foreground",children:[h.length," ",g("version.tasksCount")]})]}),(0,t.jsx)("p",{className:"mt-2 text-xs text-muted-foreground/70",children:g("version.historyHint")})]}),$&&(0,t.jsx)("div",{className:"border-t border-dashed border-border px-2 pb-2 pt-1.5",children:h.map(e=>(0,t.jsx)(I,{task:e,onOpenDetail:_},e.id))})]})})]})]})})}),(0,t.jsx)(er,{open:j,onOpenChange:e=>{b(e),e||y(null)},projectId:e.id,workspaceId:d,editVersion:N,defaultBaseBranch:null,projectLocalPath:e.localPath,onSuccess:z}),(0,t.jsx)(ee,{open:w,onOpenChange:C,workspaceId:d,onChanged:()=>v.refresh()}),(0,t.jsx)(ea,{open:S,onOpenChange:e=>{k(e),e||B(null)},version:T?{id:T.id,number:T.number,name:T.name,unfinishedCount:H}:null,candidates:U,onSuccess:z}),(0,t.jsx)(ec,{open:!!E,onOpenChange:e=>{e||L(null)},versionId:E,versionLabel:E&&(f=u.find(e=>e.id===E))?`${f.number} ${f.name}`:void 0}),(0,t.jsx)(ex.TaskOverviewDrawer,{open:!!R,onOpenChange:e=>{e||_(null)},taskId:R})]})}],645119)}]);