tower-studio 0.2.40 → 0.2.42

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 (285) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +2 -0
  3. package/.next/standalone/.next/build-manifest.json +3 -3
  4. package/.next/standalone/.next/prerender-manifest.json +3 -3
  5. package/.next/standalone/.next/routes-manifest.json +16 -0
  6. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found/page/react-loadable-manifest.json +3 -3
  14. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +31 -31
  15. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  16. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  17. package/.next/standalone/.next/server/app/api/adapters/test/route.js +2 -2
  18. package/.next/standalone/.next/server/app/api/adapters/test/route.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/api/browse-fs/route.js.nft.json +1 -1
  20. package/.next/standalone/.next/server/app/api/files/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/internal/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  23. package/.next/standalone/.next/server/app/api/internal/assets/reveal/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/internal/assistant/attachments/route.js +1 -1
  25. package/.next/standalone/.next/server/app/api/internal/assistant/attachments/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/internal/assistant/chat/route.js +1 -1
  27. package/.next/standalone/.next/server/app/api/internal/assistant/chat/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/internal/assistant/route.js +1 -1
  29. package/.next/standalone/.next/server/app/api/internal/assistant/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/internal/assistant/sessions/route.js +1 -1
  31. package/.next/standalone/.next/server/app/api/internal/assistant/sessions/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/internal/backup/import/route.js +1 -1
  33. package/.next/standalone/.next/server/app/api/internal/backup/import/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/internal/cache/[...segments]/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/api/internal/hooks/install/route.js +2 -3
  36. package/.next/standalone/.next/server/app/api/internal/hooks/install/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/internal/hooks/stop/route.js +1 -1
  38. package/.next/standalone/.next/server/app/api/internal/hooks/stop/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/internal/hooks/upload/route.js +1 -1
  40. package/.next/standalone/.next/server/app/api/internal/hooks/upload/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/internal/monaco/[...path]/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/buffer/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/input/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/resume/route/app-paths-manifest.json +3 -0
  45. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/resume/route/build-manifest.json +9 -0
  46. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/resume/route/server-reference-manifest.json +4 -0
  47. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/resume/route.js +11 -0
  48. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/resume/route.js.nft.json +1 -0
  49. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/resume/route_client-reference-manifest.js +3 -0
  50. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/start/route.js +5 -5
  51. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/start/route.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/stop/route/app-paths-manifest.json +3 -0
  53. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/stop/route/build-manifest.json +9 -0
  54. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/stop/route/server-reference-manifest.json +4 -0
  55. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/stop/route.js +11 -0
  56. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/stop/route.js.nft.json +1 -0
  57. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/stop/route_client-reference-manifest.js +3 -0
  58. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff/route.js +1 -1
  59. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff/route.js.nft.json +1 -1
  60. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff-patch/route.js +1 -1
  61. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff-patch/route.js.nft.json +1 -1
  62. package/.next/standalone/.next/server/app/api/tasks/[taskId]/merge/route.js +1 -1
  63. package/.next/standalone/.next/server/app/api/tasks/[taskId]/merge/route.js.nft.json +1 -1
  64. package/.next/standalone/.next/server/app/missions/page/react-loadable-manifest.json +2 -2
  65. package/.next/standalone/.next/server/app/missions/page/server-reference-manifest.json +118 -118
  66. package/.next/standalone/.next/server/app/missions/page.js +2 -3
  67. package/.next/standalone/.next/server/app/missions/page.js.nft.json +1 -1
  68. package/.next/standalone/.next/server/app/missions/page_client-reference-manifest.js +1 -1
  69. package/.next/standalone/.next/server/app/onboarding/page/react-loadable-manifest.json +3 -3
  70. package/.next/standalone/.next/server/app/onboarding/page/server-reference-manifest.json +31 -31
  71. package/.next/standalone/.next/server/app/onboarding/page.js.nft.json +1 -1
  72. package/.next/standalone/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  73. package/.next/standalone/.next/server/app/page/react-loadable-manifest.json +3 -3
  74. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +31 -31
  75. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  76. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  77. package/.next/standalone/.next/server/app/settings/page/react-loadable-manifest.json +3 -3
  78. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +48 -48
  79. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  80. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  81. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +3 -3
  82. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +118 -106
  83. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
  84. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
  85. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +3 -3
  86. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +97 -85
  87. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
  88. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
  89. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +3 -3
  90. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +74 -62
  91. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
  92. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
  93. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +3 -3
  94. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +77 -77
  95. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
  96. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
  97. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +3 -3
  98. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +31 -31
  99. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
  100. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
  101. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/react-loadable-manifest.json +3 -3
  102. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/server-reference-manifest.json +73 -73
  103. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page.js.nft.json +1 -1
  104. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page_client-reference-manifest.js +1 -1
  105. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +4 -4
  106. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +88 -76
  107. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
  108. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  109. package/.next/standalone/.next/server/app/workspaces/page/react-loadable-manifest.json +3 -3
  110. package/.next/standalone/.next/server/app/workspaces/page/server-reference-manifest.json +59 -47
  111. package/.next/standalone/.next/server/app/workspaces/page.js.nft.json +1 -1
  112. package/.next/standalone/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
  113. package/.next/standalone/.next/server/app-paths-manifest.json +2 -0
  114. package/.next/standalone/.next/server/chunks/07-d_@anthropic-ai_claude-agent-sdk_sdk_mjs_0.721uk._.js +16 -9
  115. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0eh8dj_.js +5 -5
  116. package/.next/standalone/.next/server/chunks/0zjb_server_app_api_internal_terminal_[taskId]_resume_route_actions_0uascj..js +3 -0
  117. package/.next/standalone/.next/server/chunks/0zjb_server_app_api_internal_terminal_[taskId]_stop_route_actions_0r3bvc-.js +3 -0
  118. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0.tbb~k._.js +3 -0
  119. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05zlbau._.js +4 -0
  120. package/.next/standalone/.next/server/chunks/[root-of-the-server]__06qz5fz._.js +4 -0
  121. package/.next/standalone/.next/server/chunks/[root-of-the-server]__075f7rs._.js +4 -0
  122. package/.next/standalone/.next/server/chunks/[root-of-the-server]__08b~~wj._.js +3 -0
  123. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__037x-0a._.js → [root-of-the-server]__0askhfg._.js} +4 -4
  124. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__04u7b2g._.js → [root-of-the-server]__0bo_6v~._.js} +2 -2
  125. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0e~6fr~._.js +3 -0
  126. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0kexk71._.js → [root-of-the-server]__0fxmnch._.js} +3 -3
  127. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0gr~8aq._.js +3 -0
  128. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0hd.0to._.js +3 -0
  129. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0g2lv9x._.js → [root-of-the-server]__0j3l3l4._.js} +2 -2
  130. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0obk~80._.js +28 -0
  131. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__05nz.tg._.js → [root-of-the-server]__0skk0fd._.js} +2 -2
  132. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0ag-i9m._.js → [root-of-the-server]__0v2nkck._.js} +2 -2
  133. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~6py0f._.js +4 -0
  134. package/.next/standalone/.next/server/chunks/[root-of-the-server]__126b53k._.js +4 -0
  135. package/.next/standalone/.next/server/chunks/_0aflzks._.js +7 -0
  136. package/.next/standalone/.next/server/chunks/_0b~hjvi._.js +7 -0
  137. package/.next/standalone/.next/server/chunks/_0qk_esg._.js +4 -0
  138. package/.next/standalone/.next/server/chunks/src_02ruq-1._.js +1 -1
  139. package/.next/standalone/.next/server/chunks/src_07gek7k._.js +3 -0
  140. package/.next/standalone/.next/server/chunks/src_0mqkaid._.js +3 -0
  141. package/.next/standalone/.next/server/chunks/src_actions_agent-actions_ts_10q9r5b._.js +4 -0
  142. package/.next/standalone/.next/server/chunks/ssr/0iu._[workspaceId]_projects_[projectId]_versions_version-timeline-client_tsx_07o_kyi._.js +1 -1
  143. package/.next/standalone/.next/server/chunks/ssr/{0ws9_lucide-react_dist_esm_icons_10_90yo._.js → 0ws9_lucide-react_dist_esm_icons_0pkla8j._.js} +2 -2
  144. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0.-z9ts._.js +1 -1
  145. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__038u_kv._.js +3 -3
  146. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__045k323._.js +3 -0
  147. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__04wbr9x._.js +1 -1
  148. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__058rbx5._.js +3 -3
  149. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__05xg05r._.js +1 -1
  150. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__087pocz._.js +3 -0
  151. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0c2mh1c._.js +47 -0
  152. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ce3fpq._.js +3 -3
  153. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0dsaqeq._.js +3 -0
  154. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0gt5dbj._.js +3 -0
  155. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h-se8t._.js +3 -0
  156. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h589~0._.js +3 -3
  157. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0jymb~t._.js +1 -1
  158. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0oq-j16._.js +3 -3
  159. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0whlq2_._.js +4 -0
  160. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0z7je5_._.js +1 -1
  161. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__10s67lq._.js +3 -3
  162. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12w35bx._.js +3 -3
  163. package/.next/standalone/.next/server/chunks/ssr/_0-~9em3._.js +1 -1
  164. package/.next/standalone/.next/server/chunks/ssr/_03lt1_x._.js +3 -3
  165. package/.next/standalone/.next/server/chunks/ssr/_04~zqvy._.js +3 -3
  166. package/.next/standalone/.next/server/chunks/ssr/_070t_mh._.js +2 -2
  167. package/.next/standalone/.next/server/chunks/ssr/{_0_z-t6g._.js → _08bq4g8._.js} +2 -2
  168. package/.next/standalone/.next/server/chunks/ssr/{_0t863nl._.js → _09z2zmm._.js} +1 -1
  169. package/.next/standalone/.next/server/chunks/ssr/_0_5abui._.js +3 -0
  170. package/.next/standalone/.next/server/chunks/ssr/_0axcfvf._.js +3 -0
  171. package/.next/standalone/.next/server/chunks/ssr/_0c2gong._.js +3 -0
  172. package/.next/standalone/.next/server/chunks/ssr/_0cj9a7y._.js +1 -1
  173. package/.next/standalone/.next/server/chunks/ssr/{_0ecu98s._.js → _0dye20y._.js} +2 -2
  174. package/.next/standalone/.next/server/chunks/ssr/{_0zqwuq~._.js → _0f~l8kv._.js} +3 -3
  175. package/.next/standalone/.next/server/chunks/ssr/{_0o3rthp._.js → _0m.wslt._.js} +2 -2
  176. package/.next/standalone/.next/server/chunks/ssr/_0o2tntr._.js +3 -0
  177. package/.next/standalone/.next/server/chunks/ssr/_0p6p_68._.js +3 -3
  178. package/.next/standalone/.next/server/chunks/ssr/{_0u_uywm._.js → _0q2mf9q._.js} +1 -1
  179. package/.next/standalone/.next/server/chunks/ssr/_0rdyrfd._.js +1 -1
  180. package/.next/standalone/.next/server/chunks/ssr/{_0be3783._.js → _0rq68d8._.js} +2 -2
  181. package/.next/standalone/.next/server/chunks/ssr/{_0hh17jg._.js → _0rxeqmo._.js} +2 -2
  182. package/.next/standalone/.next/server/chunks/ssr/{_07_8m~l._.js → _0u.n7v8._.js} +2 -2
  183. package/.next/standalone/.next/server/chunks/ssr/_0u7c6bz._.js +3 -3
  184. package/.next/standalone/.next/server/chunks/ssr/_0wbcp88._.js +1 -1
  185. package/.next/standalone/.next/server/chunks/ssr/_0whlnt7._.js +3 -0
  186. package/.next/standalone/.next/server/chunks/ssr/_0~oc5bl._.js +3 -0
  187. package/.next/standalone/.next/server/chunks/ssr/_116-_2z._.js +3 -0
  188. package/.next/standalone/.next/server/chunks/ssr/_12ca88g._.js +3 -3
  189. package/.next/standalone/.next/server/chunks/ssr/src_0djxlqx._.js +1 -1
  190. package/.next/standalone/.next/server/chunks/ssr/src_0eufeyj._.js +1 -1
  191. package/.next/standalone/.next/server/chunks/ssr/src_actions_agent-actions_ts_0~wc.sy._.js +2 -2
  192. package/.next/standalone/.next/server/chunks/ssr/src_actions_file-actions_ts_0gcvqwm._.js +1 -1
  193. package/.next/standalone/.next/server/chunks/ssr/src_app_missions_missions-client_tsx_11429lj._.js +1 -1
  194. package/.next/standalone/.next/server/chunks/ssr/src_app_onboarding_page_tsx_0xf7hpz._.js +1 -1
  195. package/.next/standalone/.next/server/chunks/ssr/src_app_settings_page_tsx_0h9v7dr._.js +1 -1
  196. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0wyzpam._.js +1 -1
  197. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_board-page-client_tsx_0gips66._.js +1 -1
  198. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_notes_notes-page-client_tsx_10gyo3v._.js +1 -1
  199. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_02t7blt._.js +1 -1
  200. package/.next/standalone/.next/server/chunks/ssr/src_components_ui_select_tsx_0d2ra01._.js +1 -1
  201. package/.next/standalone/.next/server/chunks/ssr/{src_lib_11w~.ge._.js → src_lib_0x6grav._.js} +1 -1
  202. package/.next/standalone/.next/server/functions-config-manifest.json +2 -0
  203. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  204. package/.next/standalone/.next/server/pages/500.html +1 -1
  205. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  206. package/.next/standalone/.next/server/server-reference-manifest.json +364 -322
  207. package/.next/standalone/.next/static/chunks/0-efd~h5j2ufi.js +1 -0
  208. package/.next/standalone/.next/static/chunks/{0s6gcjv24hfkq.js → 0.onaugl2w8ci.js} +1 -1
  209. package/.next/standalone/.next/static/chunks/{03jo4masky_ji.js → 0.wxa05y455w7.js} +1 -1
  210. package/.next/standalone/.next/static/chunks/{0nc-n~ecfjozt.js → 0.z171pzeg-.7.js} +1 -1
  211. package/.next/standalone/.next/static/chunks/01zlxs4rl~h_o.js +1 -0
  212. package/.next/standalone/.next/static/chunks/{0vm6adb7s2i4g.js → 02f8-ju2se8qw.js} +1 -1
  213. package/.next/standalone/.next/static/chunks/{0roncmx7dp-47.js → 035a_v6g7ioyw.js} +1 -1
  214. package/.next/standalone/.next/static/chunks/{11brr5_f60yx-.js → 040j8d.w8mkyn.js} +1 -1
  215. package/.next/standalone/.next/static/chunks/0_d04kox03m72.css +1 -0
  216. package/.next/standalone/.next/static/chunks/0af7afat3acfx.js +1 -0
  217. package/.next/standalone/.next/static/chunks/0ais32-8.3wlj.js +1 -0
  218. package/.next/standalone/.next/static/chunks/{0tb.0x~6y.21w.js → 0bdwzhoelky9-.js} +1 -1
  219. package/.next/standalone/.next/static/chunks/{0.65.u3zhwau~.js → 0clewc5ifaruu.js} +1 -1
  220. package/.next/standalone/.next/static/chunks/0dewfthzwmcwb.js +1 -0
  221. package/.next/standalone/.next/static/chunks/0f43x~jzb70f4.js +1 -0
  222. package/.next/standalone/.next/static/chunks/{0v.l5.sqos562.js → 0i-x__600fys6.js} +1 -1
  223. package/.next/standalone/.next/static/chunks/{050agjgyp545k.js → 0l25d0nc5ygyd.js} +1 -1
  224. package/.next/standalone/.next/static/chunks/0lyq0-a32.15m.js +1 -0
  225. package/.next/standalone/.next/static/chunks/{0~33w7-91bik-.js → 0m~m1~si.ot17.js} +1 -1
  226. package/.next/standalone/.next/static/chunks/{0bq80txkiwk0q.js → 0rozlwh3y46l0.js} +1 -1
  227. package/.next/standalone/.next/static/chunks/{1821tyytk30ed.js → 0t8lz62rmr801.js} +2 -2
  228. package/.next/standalone/.next/static/chunks/0utrquxfg25b2.js +1 -0
  229. package/.next/standalone/.next/static/chunks/{0bx6xpa7fgedh.js → 0wcdxs4sl-gjf.js} +1 -1
  230. package/.next/standalone/.next/static/chunks/0wcwdbtpm0~r6.js +1 -0
  231. package/.next/standalone/.next/static/chunks/0x-ug4iz~~qr2.js +1 -0
  232. package/.next/standalone/.next/static/chunks/0xj6v_80hlyv0.js +1 -0
  233. package/.next/standalone/.next/static/chunks/0xl7h5fsfc7zk.js +1 -0
  234. package/.next/standalone/.next/static/chunks/{0xxn47mtozln~.js → 0ypd9eqm_pj-o.js} +1 -1
  235. package/.next/standalone/.next/static/chunks/115ae91fq~slq.js +1 -0
  236. package/.next/standalone/.next/static/chunks/{120u45g91sx4q.js → 13.3woq55msp..js} +1 -1
  237. package/.next/standalone/.next/static/chunks/17fug-zaik-v~.js +1 -0
  238. package/.next/standalone/.next/static/chunks/{0v8apmh_d7lz3.js → 17m4o~gdsvuo3.js} +1 -1
  239. package/.next/standalone/package.json +1 -1
  240. package/README.md +25 -3
  241. package/README.zh.md +25 -3
  242. package/dist/mcp-server.cjs +115 -0
  243. package/package.json +1 -1
  244. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0hrprmi.js +0 -4
  245. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0.wld9h._.js +0 -3
  246. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0.z8.oi._.js +0 -4
  247. package/.next/standalone/.next/server/chunks/[root-of-the-server]__02jy80j._.js +0 -4
  248. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0az764e._.js +0 -3
  249. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0d1bhsb._.js +0 -28
  250. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0kuo6q5._.js +0 -4
  251. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0np.553._.js +0 -4
  252. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0u_-4~7._.js +0 -3
  253. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01kyzx1._.js +0 -3
  254. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02mo_kb._.js +0 -3
  255. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02~6htc._.js +0 -4
  256. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__077c1-u._.js +0 -3
  257. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0da~mv~._.js +0 -47
  258. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ea-1l0._.js +0 -3
  259. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__10~3-.h._.js +0 -3
  260. package/.next/standalone/.next/server/chunks/ssr/_0-_yznx._.js +0 -43
  261. package/.next/standalone/.next/server/chunks/ssr/_04jcctt._.js +0 -3
  262. package/.next/standalone/.next/server/chunks/ssr/_0a-.s7z._.js +0 -3
  263. package/.next/standalone/.next/server/chunks/ssr/_0aqfqr5._.js +0 -3
  264. package/.next/standalone/.next/server/chunks/ssr/_0g8mw1b._.js +0 -3
  265. package/.next/standalone/.next/server/chunks/ssr/_0qrc1eu._.js +0 -3
  266. package/.next/standalone/.next/server/chunks/ssr/_0~cy-h1._.js +0 -3
  267. package/.next/standalone/.next/server/chunks/ssr/_11rjd4d._.js +0 -3
  268. package/.next/standalone/.next/static/chunks/02zqmiej0opg7.js +0 -1
  269. package/.next/standalone/.next/static/chunks/03rl6s3rpptas.js +0 -1
  270. package/.next/standalone/.next/static/chunks/05n5tgexx2_92.js +0 -1
  271. package/.next/standalone/.next/static/chunks/0651zmy-w~saj.js +0 -1
  272. package/.next/standalone/.next/static/chunks/09ossbd-6zx4g.js +0 -1
  273. package/.next/standalone/.next/static/chunks/0_d-xz2x5qb_c.js +0 -1
  274. package/.next/standalone/.next/static/chunks/0dp-d685xgb68.js +0 -1
  275. package/.next/standalone/.next/static/chunks/0kf6kwtt_mouu.js +0 -1
  276. package/.next/standalone/.next/static/chunks/0l2-qbv0tx44i.js +0 -1
  277. package/.next/standalone/.next/static/chunks/0l3n_2z5xfhor.js +0 -1
  278. package/.next/standalone/.next/static/chunks/0mu2posb9cg4b.js +0 -1
  279. package/.next/standalone/.next/static/chunks/0t1nk8jlwgyb-.js +0 -1
  280. package/.next/standalone/.next/static/chunks/0~qrkswofk7zn.css +0 -1
  281. package/.next/standalone/.next/static/chunks/16e-u8e~pzz_-.js +0 -1
  282. package/.next/standalone/.next/static/chunks/183m8iouij_n8.js +0 -1
  283. /package/.next/standalone/.next/static/{wtOlqKEl8oeuEeWLbCnuv → LCBoYZWhXzs8PjuBmxw7g}/_buildManifest.js +0 -0
  284. /package/.next/standalone/.next/static/{wtOlqKEl8oeuEeWLbCnuv → LCBoYZWhXzs8PjuBmxw7g}/_clientMiddlewareManifest.js +0 -0
  285. /package/.next/standalone/.next/static/{wtOlqKEl8oeuEeWLbCnuv → LCBoYZWhXzs8PjuBmxw7g}/_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(210702),n=e.i(232545),l=e.i(738690),i=e.i(226145),o=e.i(486077),c=e.i(519455),d=e.i(793479),m=e.i(967489),x=e.i(746798),u=e.i(533499);function h({searchQuery:e,onSearchChange:s,versions:a=[],versionFilter:p="all",onVersionFilterChange:g,versionsHref:f,onCreateTask:j}){let b,{t:N}=(0,u.useI18n)(),v="all"===p?N("board.allVersions"):"backlog"===p?N("board.backlogFilter"):(b=a.find(e=>e.id===p))?`${b.number} ${b.name}`:N("board.allVersions");return(0,t.jsxs)("div",{className:"flex items-center gap-2 px-6 py-2",children:[g&&(0,t.jsxs)(m.Select,{value:p,onValueChange:e=>g(e||"all"),children:[(0,t.jsxs)(m.SelectTrigger,{className:"h-8 w-44 shrink-0 gap-1.5 text-xs text-muted-foreground",children:[(0,t.jsx)(i.GitBranch,{className:"h-3.5 w-3.5 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:v})]}),(0,t.jsxs)(m.SelectContent,{children:[(0,t.jsx)(m.SelectItem,{value:"all",children:N("board.allVersions")}),(0,t.jsx)(m.SelectItem,{value:"backlog",children:N("board.backlogFilter")}),a.map(e=>(0,t.jsxs)(m.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)(l.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)(d.Input,{type:"text",value:e,onChange:e=>s(e.target.value),placeholder:N("board.searchPlaceholder"),className:"pl-8 pr-3 text-xs"})]}),(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[(0,t.jsxs)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",children:(0,t.jsx)(o.Lightbulb,{className:"h-4 w-4"})})}),(0,t.jsx)(x.TooltipContent,{side:"bottom",className:"max-w-xs",children:N("board.tipText")})]}),f&&(0,t.jsx)(r.default,{href:f,children:(0,t.jsxs)(c.Button,{variant:"outline",className:"h-8 gap-1.5 text-xs text-muted-foreground",children:[(0,t.jsx)(i.GitBranch,{className:"h-3.5 w-3.5"}),N("version.timeline")]})}),(0,t.jsxs)(c.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:j,children:[(0,t.jsx)(n.Plus,{className:"h-3.5 w-3.5"}),N("board.newTask")]})]})]})}var p=e.i(585012),g=e.i(597746),f=e.i(685149);function j({x:e,y:r,taskId:n,currentStatus:l,hasExecutions:i,workspaceId:o,onClose:c,onStatusChange:d,onLaunch:m}){let{t:x}=(0,u.useI18n)(),h=(0,a.useRouter)(),b=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=e=>{b.current&&!b.current.contains(e.target)&&c()},t=e=>{"Escape"===e.key&&c()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[c]);let N="flex items-center px-3 py-1.5 text-xs cursor-pointer hover:bg-accent rounded-sm w-full text-left",v=(0,t.jsxs)("div",{ref:b,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:x("board.contextMenu.changeStatus")}),f.BOARD_COLUMNS.map(e=>(0,t.jsxs)("button",{type:"button",className:N,onClick:()=>{d(n,e.id),c()},children:[l===e.id?(0,t.jsx)(g.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:`${N} ${i?"opacity-50 cursor-not-allowed":""}`,disabled:i,onClick:()=>{i||(m(n),c())},children:x("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:N,onClick:()=>{h.push(`/workspaces/${o}/tasks/${n}`),c()},children:x("board.contextMenu.goToDetail")})]})]});return"u"<typeof document?null:(0,p.createPortal)(v,document.body)}var b=e.i(720247),N=e.i(775712),v=e.i(469051),k=e.i(67013),w=e.i(49007),y=e.i(464249),C=e.i(998626),T=e.i(572989);let S=(0,T.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 P=e.i(487486),E=e.i(755146),I=e.i(35967);function D({task:e,onClick:s,onEdit:a,onDelete:r,onTogglePin:n,onContextMenu:l}){let{t:o}=(0,u.useI18n)(),{attributes:d,listeners:m,setNodeRef:h,transform:p,transition:g,isDragging:j}=(0,N.useSortable)({id:e.id,data:{type:"task",task:e}}),b={transform:k.CSS.Transform.toString(p),transition:g,opacity:j?.4:1},v=f.PRIORITY_CONFIG[e.priority],T=!!e.baseBranch;return(0,t.jsxs)("div",{ref:h,style:b,...d,...m,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)(c.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":o(e.pinned?"board.unpin":"board.pin"),children:(0,t.jsx)(S,{className:`h-3.5 w-3.5 ${e.pinned?"-rotate-45":""}`})}),(0,t.jsxs)(E.DropdownMenu,{children:[(0,t.jsx)(E.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)(w.MoreHorizontal,{className:"h-4 w-4"})}),(0,t.jsxs)(E.DropdownMenuContent,{align:"end",children:[(0,t.jsxs)(E.DropdownMenuItem,{onClick:t=>{t.stopPropagation(),a?.(e)},children:[(0,t.jsx)(y.Pencil,{className:"mr-2 h-3.5 w-3.5"}),o("common.edit")]}),(0,t.jsxs)(E.DropdownMenuItem,{className:"text-rose-400",onClick:t=>{t.stopPropagation(),r?.(e.id)},children:[(0,t.jsx)(C.Trash2,{className:"mr-2 h-3.5 w-3.5"}),o("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)(P.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${v.color}`,children:v.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)),(T||e.version)&&(0,t.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[T&&(0,t.jsxs)(x.Tooltip,{disableHoverablePopup:!0,children:[(0,t.jsx)(x.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)(i.GitBranch,{className:"h-2.5 w-2.5 shrink-0"})})}),(0,t.jsx)(x.TooltipContent,{side:"top",children:o("board.card.worktree",{branch:e.baseBranch??""})})]}),e.version&&(0,t.jsxs)(x.Tooltip,{disableHoverablePopup:!0,children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)("span",{className:"cursor-default",onPointerDown:e=>e.stopPropagation(),children:(0,t.jsx)(I.TaskVersionTag,{number:e.version.number,title:""})})}),(0,t.jsx)(x.TooltipContent,{side:"top",children:o("board.card.version",{number:e.version.number,name:e.version.name})})]})]})]})]})}var L=e.i(776639),B=e.i(759684);function F({open:e,onOpenChange:s,columnLabel:a,columnColor:r,tasks:n,onTaskClick:l}){let{t:i}=(0,u.useI18n)();return(0,t.jsx)(L.Dialog,{open:e,onOpenChange:s,children:(0,t.jsxs)(L.DialogContent,{className:"sm:max-w-6xl max-h-[80vh]",children:[(0,t.jsx)(L.DialogHeader,{children:(0,t.jsxs)(L.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)(B.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=f.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)(P.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 A({id:e,label:a,color:r,tasks:l,onTaskClick:i,onEditTask:o,onAddTask:d,onDeleteTask:m,onTogglePin:x,onContextMenu:h}){let{setNodeRef:p,isOver:g}=(0,b.useDroppable)({id:e}),[f,j]=(0,s.useState)(!1),{t:k}=(0,u.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:l.length})]}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(c.Button,{variant:"ghost",size:"icon-xs",onClick:()=>j(!0),className:"text-muted-foreground","aria-label":k("board.viewAll"),children:(0,t.jsx)(v.LayoutGrid,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(c.Button,{variant:"ghost",size:"icon-xs",onClick:d,className:"text-muted-foreground","aria-label":"add",children:(0,t.jsx)(n.Plus,{className:"h-3.5 w-3.5"})})]})]}),(0,t.jsx)(F,{open:f,onOpenChange:j,columnLabel:a,columnColor:r,tasks:l,onTaskClick:i}),(0,t.jsx)(B.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)(N.SortableContext,{items:l.map(e=>e.id),strategy:N.verticalListSortingStrategy,children:l.map(e=>(0,t.jsx)(D,{task:e,onClick:()=>i?.(e),onEdit:o,onDelete:m,onTogglePin:x,onContextMenu:h},e.id))})})})]})}function R({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,N]=(0,s.useState)(null);(0,s.useEffect)(()=>{u(e)},[e]);let v=(0,b.useSensors)((0,b.useSensor)(b.PointerSensor,{activationConstraint:{distance:8}})),k=(0,s.useCallback)((e,t,s)=>{N({task:e,x:t,y:s})},[]),w=(0,s.useCallback)(e=>{let t=x.find(t=>t.id===e.active.id);t&&p(t)},[x]),y=(0,s.useCallback)(e=>{let t,{active:s,over:r}=e;if(p(null),!r)return;let n=s.id,l=r.id;if(f.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)(b.DndContext,{id:"kanban-board",sensors:v,collisionDetection:b.closestCorners,onDragStart:w,onDragEnd:y,children:[(0,t.jsx)("div",{className:"mx-2 flex h-full overflow-x-auto rounded-xl border border-border bg-card/50",children:f.BOARD_COLUMNS.map(e=>(0,t.jsx)(A,{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:k},e.id))}),(0,t.jsx)(b.DragOverlay,{children:h?(0,t.jsx)("div",{className:"rotate-3 scale-105",children:(0,t.jsx)(D,{task:h})}):null}),g&&(0,t.jsx)(j,{x:g.x,y:g.y,taskId:g.task.id,currentStatus:g.task.status,hasExecutions:(g.task._count?.executions??0)>0,workspaceId:m??"",onClose:()=>N(null),onStatusChange:(e,t)=>{c?.(e,t),N(null)},onLaunch:e=>{d?.(e),N(null)}})]})}var O=e.i(744798);function $(e,t,s){return Math.min(Math.max(e,t),s)}var M=e.i(232280),z=e.i(368490),U=e.i(645378),W=e.i(453889);let G=(0,T.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),V=e.i(400355),_=e.i(233274),K=e.i(736061),X=e.i(460707),Y=e.i(567860),J=e.i(875840),q=e.i(624687),Q=e.i(514798);let Z=(0,Q.createServerReference)("603706234cb101ae8a8a3142f46c07d3b280a30e61",Q.callServer,void 0,Q.findSourceMapURL,"updateProject");var ee=e.i(52790);let et=(0,Q.createServerReference)("4064d2a7b0c0c118936087a169b589c891148820f6",Q.callServer,void 0,Q.findSourceMapURL,"deleteProject"),es=(0,Q.createServerReference)("406e59a62f1dddf3587b6bd0ec73ef95fc3b48af6e",Q.callServer,void 0,Q.findSourceMapURL,"getRecentLocalProjects"),ea=(0,Q.createServerReference)("403bf07251f1b17ce9d38fba6645ec658f3a4c58f8",Q.callServer,void 0,Q.findSourceMapURL,"getOrCreateTowerTaskId");var er=e.i(617690),en=e.i(323412),el=e.i(331411),ei=e.i(22234),eo=e.i(360112),ec=e.i(224277),ed=e.i(905455);function em({commits:e}){let{t:a}=(0,u.useI18n)(),[r,n]=(0,s.useState)(!1);return 0===e.length?null:(0,t.jsxs)("div",{className:"border-b border-border",children:[(0,t.jsxs)("button",{onClick:()=>n(!r),className:"flex w-full items-center gap-1 px-2 py-1.5 hover:bg-accent/50 transition-colors",children:[r?(0,t.jsx)(M.ChevronDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,t.jsx)(z.ChevronRight,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,t.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[a("git.commitLog")," (",e.length,")"]})]}),r&&(0,t.jsx)("div",{className:"mt-0.5 mb-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)(G,{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),eo.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)(J.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 ex=e.i(487278),eu=e.i(375306),eh=e.i(244354);function ep({localPath:e,stashes:a,hasChanges:r,onRefresh:n}){let{t:l}=(0,u.useI18n)(),[i,o]=(0,s.useState)(!1),[m,x]=(0,s.useState)(!1),[h,p]=(0,s.useState)(""),[g,f]=(0,s.useState)(null),j=async()=>{x(!0);try{await (0,eh.gitAction)(e,"stash-save",{message:h}),p(""),eo.toast.success(l("git.stashSaved")),await n()}catch(e){eo.toast.error(e instanceof Error?e.message:String(e))}finally{x(!1)}},b=async t=>{f(t);try{await (0,eh.gitAction)(e,"stash-pop",{index:t}),eo.toast.success(l("git.stashApplied")),await n()}catch(e){eo.toast.error(e instanceof Error?e.message:String(e))}finally{f(null)}},N=async t=>{f(t);try{await (0,eh.gitAction)(e,"stash-drop",{index:t}),eo.toast.success(l("git.stashDropped")),await n()}catch(e){eo.toast.error(e instanceof Error?e.message:String(e))}finally{f(null)}};return r||0!==a.length?(0,t.jsxs)("div",{className:"border-b border-border",children:[(0,t.jsxs)("button",{onClick:()=>o(!i),className:"flex w-full items-center gap-1 px-2 py-1.5 hover:bg-accent/50 transition-colors",children:[i?(0,t.jsx)(M.ChevronDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,t.jsx)(z.ChevronRight,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(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.jsxs)("div",{className:"mt-0.5 mb-1.5 space-y-2",children:[r&&(0,t.jsxs)("div",{className:"flex gap-1.5",children:[(0,t.jsx)(d.Input,{value:h,onChange:e=>p(e.target.value),placeholder:l("git.stashMsgPlaceholder"),className:"h-7 text-xs flex-1",onKeyDown:e=>"Enter"===e.key&&j()}),(0,t.jsx)(c.Button,{variant:"outline",size:"icon-sm",onClick:j,disabled:m,className:"shrink-0",children:m?(0,t.jsx)(V.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(ex.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)(ex.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)(c.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)(V.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(eu.ArrowUpFromLine,{className:"h-3 w-3"})}),(0,t.jsx)(c.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)(C.Trash2,{className:"h-3 w-3"})})]})]},e.index))})]})]}):null}var eg=e.i(515135);function ef({value:e,ariaLabel:a}){let{t:r}=(0,u.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),eo.toast.success(r("common.copied")),setTimeout(()=>l(!1),1500)}catch{eo.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)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon-xs",className:"shrink-0 text-muted-foreground","aria-label":a,onClick:i,children:n?(0,t.jsx)(g.Check,{className:"h-3 w-3 text-emerald-400"}):(0,t.jsx)(J.Copy,{className:"h-3 w-3"})})}),(0,t.jsx)(x.TooltipContent,{children:n?r("common.copied"):r("common.copy")})]})]})}function ej({project:e,workspaceId:r}){let{t:n,locale:l}=(0,u.useI18n)(),o=(0,a.useRouter)(),{width:m,isDragging:h,startResize:p}=function(e){let{storageKey:t,defaultWidth:a,minWidth:r,maxWidth:n,edge:l="left"}=e,[i,o]=(0,s.useState)(a),[c,d]=(0,s.useState)(!1),m=(0,s.useRef)(null);(0,s.useEffect)(()=>{try{let e=window.localStorage.getItem(t),s=null==e?NaN:Number(e);Number.isFinite(s)&&o($(s,r,n))}catch{}},[t,r,n]);let x=(0,s.useCallback)(e=>{let t=m.current;t&&o(function(e,t,s,a,r,n="left"){return $(e+("left"===n?t-s:s-t),a,r)}(t.width,t.x,e.clientX,r,n,l))},[r,n,l]),u=(0,s.useCallback)(()=>{m.current&&(m.current=null,d(!1),window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",u),o(e=>{try{window.localStorage.setItem(t,String(e))}catch{}return e}))},[x,t]),h=(0,s.useCallback)(e=>{e.preventDefault(),m.current={x:e.clientX,width:i},d(!0),window.addEventListener("pointermove",x),window.addEventListener("pointerup",u)},[i,x,u]);return(0,s.useEffect)(()=>()=>{window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",u)},[x,u]),{width:i,isDragging:c,startResize:h}}({storageKey:"tower:repo-sidebar-width",defaultWidth:288,minWidth:240,maxWidth:560,edge:"left"}),[g,f]=(0,s.useState)(!0),[j,b]=(0,s.useState)(!0),[N,v]=(0,s.useState)(!1),[k,w]=(0,s.useState)(!1),[T,S]=(0,s.useState)(""),[P,E]=(0,s.useState)(!1),[I,D]=(0,s.useState)(!1),[B,F]=(0,s.useState)(!1),[A,R]=(0,s.useState)(e.name),[O,J]=(0,s.useState)(e.alias??""),[Q,ex]=(0,s.useState)(e.description??""),[eu,eh]=(0,s.useState)(e.localPath??""),[eb,eN]=(0,s.useState)(e.projectType??"FRONTEND"),[ev,ek]=(0,s.useState)([]);(0,s.useEffect)(()=>{es(100).then(ek)},[]);let[ew,ey]=(0,s.useState)(!1),[eC,eT]=(0,s.useState)(""),[eS,eP]=(0,s.useState)(""),[eE,eI]=(0,s.useState)(""),[eD,eL]=(0,s.useState)(""),[eB,eF]=(0,s.useState)("FRONTEND"),[eA,eR]=(0,s.useState)(!1),[eO,e$]=(0,s.useState)(!1),[eM,ez]=(0,s.useState)(null),[eU,eW]=(0,s.useState)(!1),[eG,eH]=(0,s.useState)(!1),eV=e=>{eo.toast.info(e)},e_=(0,s.useCallback)(async()=>{if(e.localPath){eW(!0);try{let t=await fetch(`/api/git?path=${encodeURIComponent(e.localPath)}`);t.ok&&ez(await t.json())}catch{}finally{eW(!1)}}},[e.localPath]);(0,s.useEffect)(()=>{e_()},[e_]);let eK=async()=>{if(e.localPath){eH(!0);try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",path:e.localPath})})).ok?(eV(n("git.initSuccess")),await e_()):eV(n("git.initFailed"))}catch{eV(n("git.initFailed"))}finally{eH(!1)}}},eX=(e,t)=>{o.push(`/workspaces/${e}?projectId=${t}`,{scroll:!1}),o.refresh()},eY=async()=>{if(eS.trim()){eR(!0);try{let e=await (0,ee.createProject)({name:eS.trim(),alias:eE.trim()||void 0,description:eD.trim()||void 0,localPath:eC,projectType:eB,workspaceId:r});ey(!1),eX(r,e.id)}catch(e){eo.toast.error(e instanceof Error?e.message:String(e))}finally{eR(!1)}}},eJ=async()=>{if(eu&&!eO){e$(!0);try{let e=await (0,ei.analyzeProjectDirectory)(eu.trim(),l);ex(e)}catch{eo.toast.error(n("project.analyzeError"))}finally{e$(!1)}}},eq=async()=>{try{await Z(e.id,{name:A.trim(),alias:O.trim()||void 0,description:Q.trim()||void 0,localPath:eu.trim()||void 0,projectType:eb}),o.refresh(),v(!1)}catch(e){eo.toast.error(e instanceof Error?e.message:String(e))}};return(0,t.jsxs)("aside",{className:"relative flex-shrink-0 border-l border-border bg-sidebar",style:{width:m},children:[(0,t.jsx)("div",{onPointerDown:p,className:`absolute left-0 top-0 z-20 h-full w-1 -translate-x-1/2 cursor-col-resize transition-colors hover:bg-primary/20 ${h?"bg-primary/40":"bg-transparent"}`,role:"separator","aria-orientation":"vertical","aria-label":n("sidebar.right.resize")}),(0,t.jsxs)("div",{className:"h-full overflow-y-auto",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)(c.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{R(e.name),J(e.alias??""),ex(e.description??""),eh(e.localPath??""),v(!0)},className:"text-muted-foreground",children:(0,t.jsx)(y.Pencil,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(c.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{S(""),w(!0)},className:"text-muted-foreground hover:text-rose-400",children:(0,t.jsx)(C.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)(i.GitBranch,{className:"h-3 w-3"}),n("sidebar.right.gitType")]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(U.FileText,{className:"h-3 w-3"}),n("sidebar.right.normalType")]})})}),e.gitUrl&&(0,t.jsx)("div",{className:"mt-3 space-y-1.5",children:(0,t.jsx)(ef,{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)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,er.openInFileManager)(e.localPath)}catch(e){console.error("openInFileManager failed:",e),eo.toast.error(n("git.openInFileManagerFailed"))}},children:(0,t.jsx)(K.FolderSearch,{className:"h-4 w-4"})})}),(0,t.jsx)(x.TooltipContent,{children:n("git.openInFileManager")})]}),(0,t.jsxs)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,en.openInEditor)(e.localPath)}catch(e){console.error("openInEditor failed:",e),eo.toast.error(n("git.openInEditorFailed"))}},children:(0,t.jsx)(X.Code,{className:"h-4 w-4"})})}),(0,t.jsx)(x.TooltipContent,{children:n("git.openInEditor")})]}),(0,t.jsxs)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,el.openInTerminal)(e.localPath)}catch(e){console.error("openInTerminal failed:",e),eo.toast.error(n("git.openInTerminalFailed"))}},children:(0,t.jsx)(Y.Terminal,{className:"h-4 w-4"})})}),(0,t.jsx)(x.TooltipContent,{children:n("git.openInTerminal")})]})]}),(0,t.jsxs)(c.Button,{variant:"outline",className:"w-full h-9 gap-1.5 text-xs",disabled:I,onClick:async()=>{D(!0);try{let t=await ea(e.id);o.push(`/workspaces/${r}/tasks/${t}`)}catch{eo.toast.error(n("git.openStudioFailed"))}finally{D(!1)}},children:[I?(0,t.jsx)(V.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(W.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)(c.Button,{variant:"ghost",onClick:()=>f(!g),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")}),g?(0,t.jsx)(M.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,t.jsx)(z.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),g&&(0,t.jsx)("div",{className:"mt-3",children:e.localPath?eU?(0,t.jsxs)("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:[(0,t.jsx)(V.Loader2,{className:"h-4 w-4 animate-spin"}),(0,t.jsx)("span",{className:"ml-2 text-xs",children:n("git.loading")})]}):eM&&!eM.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)(c.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:eK,disabled:eG,children:[eG?(0,t.jsx)(V.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(G,{className:"h-3 w-3"}),n("git.initRepo")]})]}):eM?.isGit?(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"flex flex-col",children:(0,t.jsx)(eg.EditorGitPanel,{localPath:e.localPath,mode:"project"})}),(0,t.jsx)(em,{commits:eM.commits??[]}),(0,t.jsx)(ep,{localPath:e.localPath,stashes:eM.stashes??[],hasChanges:(eM.changedFiles??[]).length>0,onRefresh:e_})]}):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)(c.Button,{variant:"ghost",onClick:()=>b(!j),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")}),j?(0,t.jsx)(M.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,t.jsx)(z.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),j&&(0,t.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,t.jsxs)(c.Button,{variant:"outline",className:"w-full h-8 gap-1.5 text-xs",onClick:()=>F(!0),children:[(0,t.jsx)(W.FolderOpen,{className:"h-3.5 w-3.5"}),n("sidebar.right.browseRepo")]}),ev.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:ev.map(s=>(0,t.jsxs)("button",{onClick:()=>{s.id!==e.id&&eX(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)(i.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,t.jsx)(W.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)(L.Dialog,{open:N,onOpenChange:v,children:(0,t.jsxs)(L.DialogContent,{style:{maxWidth:"32rem"},children:[(0,t.jsx)(L.DialogHeader,{children:(0,t.jsx)(L.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)(d.Input,{value:A,onChange:e=>R(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)(ed.SegmentedControl,{options:[{value:"FRONTEND",label:n("project.type.frontend")},{value:"BACKEND",label:n("project.type.backend")}],value:eb,onChange:eN})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.alias")}),(0,t.jsx)(d.Input,{value:O,onChange:e=>J(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)(c.Button,{type:"button",variant:"ghost",onClick:eJ,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!eu||eO?"opacity-50":""}`,children:[eO?(0,t.jsx)(V.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(_.Sparkles,{className:"h-3 w-3"}),eO?n("project.analyzing"):n("project.genDesc")]})]}),(0,t.jsx)(q.Textarea,{value:Q,onChange:e=>ex(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:eu||"—"})]})]}),(0,t.jsxs)(L.DialogFooter,{children:[(0,t.jsx)(c.Button,{variant:"outline",onClick:()=>v(!1),children:n("common.cancel")}),(0,t.jsx)(c.Button,{onClick:eq,disabled:!A.trim()||eO,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:n("common.save")})]})]})}),(0,t.jsx)(ec.FolderBrowserDialog,{open:B,onOpenChange:F,onSelect:e=>{N?eh(e):(e=>{let t=ev.find(t=>t.localPath===e);if(t)return eX(t.workspaceId,t.id);let s=e.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean).pop()??"";eT(e),eP(s),eI(""),eL(""),ey(!0)})(e)}}),(0,t.jsx)(L.Dialog,{open:ew,onOpenChange:ey,children:(0,t.jsxs)(L.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(L.DialogHeader,{children:(0,t.jsx)(L.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:eC})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.name")}),(0,t.jsx)(d.Input,{value:eS,onChange:e=>eP(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)(ed.SegmentedControl,{options:[{value:"FRONTEND",label:n("project.type.frontend")},{value:"BACKEND",label:n("project.type.backend")}],value:eB,onChange:eF})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.alias")}),(0,t.jsx)(d.Input,{value:eE,onChange:e=>eI(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)(q.Textarea,{value:eD,onChange:e=>eL(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)(L.DialogFooter,{children:[(0,t.jsx)(c.Button,{variant:"outline",onClick:()=>ey(!1),children:n("common.cancel")}),(0,t.jsxs)(c.Button,{onClick:eY,disabled:!eS.trim()||eA,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[eA?(0,t.jsx)(V.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,n("common.create")]})]})]})}),(0,t.jsx)(L.Dialog,{open:k,onOpenChange:e=>{w(e),e||S("")},children:(0,t.jsxs)(L.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(L.DialogHeader,{children:(0,t.jsx)(L.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)(d.Input,{value:T,onChange:e=>S(e.target.value),placeholder:n("project.deleteConfirmPlaceholder"),className:"mt-1.5",autoFocus:!0})]})]}),(0,t.jsxs)(L.DialogFooter,{children:[(0,t.jsx)(c.Button,{variant:"outline",onClick:()=>w(!1),children:n("common.cancel")}),(0,t.jsxs)(c.Button,{variant:"destructive",disabled:T!==n("project.deleteConfirmText")||P,onClick:async()=>{E(!0);try{await et(e.id),eo.toast.success(n("project.deleteSuccess")),o.push(`/workspaces/${r}`)}catch{eo.toast.error(n("project.deleteFailed"))}finally{E(!1),w(!1)}},children:[P&&(0,t.jsx)(V.Loader2,{className:"h-3 w-3 animate-spin mr-1"}),n("project.deleteButton")]})]})]})})]})}var eb=e.i(475958),eN=e.i(313029),ev=e.i(882651),ek=e.i(259846),ew=e.i(975157);function ey({title:e,description:s,branch:a,baseBranch:r,version:n,hasConversation:l,updatedAt:o,openDir:d,onBack:m}){let{t:h}=(0,u.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)(_.Sparkles,{className:"h-3.5 w-3.5 text-primary"}),(0,t.jsx)("span",{className:"text-xs font-semibold text-primary",children:h("taskDetail.title")})]}),(0,t.jsxs)(c.Button,{variant:"ghost",onClick:m,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)(ek.ArrowLeft,{className:"h-3.5 w-3.5"}),h("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)(P.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:[(0,t.jsx)(i.GitBranch,{className:"mr-1 h-3 w-3"}),r," · worktree"]}):a?(0,t.jsx)(P.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:h("taskDetail.directMode")}):null,n&&(0,t.jsx)(I.TaskVersionTag,{number:n.number,name:n.name,showName:!0}),l&&(0,t.jsx)(P.Badge,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-400 text-[10px] border border-emerald-500/20",children:h("taskDetail.hasConversation")}),(0,t.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h("taskDetail.updatedAt")," ",(0,ew.formatRelativeTime)(o)]}),d&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-0.5",children:[(0,t.jsxs)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,er.openInFileManager)(d)}catch(e){console.error("openInFileManager failed:",e),eo.toast.error(h("git.openInFileManagerFailed"))}},children:(0,t.jsx)(K.FolderSearch,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(x.TooltipContent,{side:"bottom",children:h("git.openInFileManager")})]}),(0,t.jsxs)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,en.openInEditor)(d)}catch(e){console.error("openInEditor failed:",e),eo.toast.error(h("git.openInEditorFailed"))}},children:(0,t.jsx)(X.Code,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(x.TooltipContent,{side:"bottom",children:h("git.openInEditor")})]}),(0,t.jsxs)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,el.openInTerminal)(d)}catch(e){console.error("openInTerminal failed:",e),eo.toast.error(h("git.openInTerminalFailed"))}},children:(0,t.jsx)(Y.Terminal,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(x.TooltipContent,{side:"bottom",children:h("git.openInTerminal")})]})]})]})]})}var eC=e.i(14842),eT=e.i(865514),eS=e.i(83434),eP=e.i(124868),eE=e.i(613391),eI=e.i(762121),eD=e.i(861978),eL=e.i(156509),eB=e.i(49145),eF=e.i(662414),eA=e.i(32626),eR=e.i(900203),eO=e.i(326883),e$=e.i(631675),eM=e.i(297338),ez=e.i(657153),eU=e.i(867533),eW=e.i(205157),eG=e.i(207268),eH=e.i(313718),eV=e.i(952679),e_=e.i(66460),eK=e.i(258998),eX=e.i(235357),eY=e.i(144640),eJ=e.i(997025),eq=e.i(937304);let eQ=/\.(txt|md|json)$/i;function eZ({taskId:e,projectId:a}){let{t:r}=(0,u.useI18n)(),l=(0,s.useRef)(null),[i,o]=(0,s.useState)([]),[d,m]=(0,s.useState)([]),[x,h]=(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),[w,y]=(0,s.useState)(null);async function T(){p.trim()&&(await (0,eW.createNote)({title:p.trim(),content:f.trim(),projectId:a,taskId:e,category:"task"}),g(""),j(""),h(!1),(0,eG.getTaskNotes)(e).then(o))}async function S(e){await (0,eH.deleteNote)(e),o(t=>t.filter(t=>t.id!==e))}async function P(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,e_.uploadAsset)(t),(0,eV.getTaskAssets)(e).then(m)}finally{N(!1),l.current&&(l.current.value="")}}}async function E(e){await (0,eK.deleteAsset)(e),m(t=>t.filter(t=>t.id!==e))}function I(e){return(0,eq.isImageAsset)(e.filename,e.mimeType)||eQ.test(e.filename)}function D(e){I(e)?k(e):eo.toast.info(r("assets.previewNotSupported"))}async function L(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(()=>({}));eo.toast.error(e.error||"Failed to reveal file")}}catch{eo.toast.error("Failed to reveal file")}}(0,s.useEffect)(()=>{(0,eG.getTaskNotes)(e).then(o),(0,eV.getTaskAssets)(e).then(m)},[e]);let F=v?(0,eq.isImageAsset)(v.filename,v.mimeType)?"image":eQ.test(v.filename)?"text":null:null,A=d.filter(e=>(0,eq.isImageAsset)(e.filename,e.mimeType)).map(e=>({id:e.id,url:(0,eq.localPathToApiUrl)(e.path),filename:e.filename})),R=v?A.findIndex(e=>e.id===v.id):-1;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B.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)(U.FileText,{className:"h-3.5 w-3.5"}),r("taskPage.notes")]}),(0,t.jsxs)(c.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>h(!x),children:[x?(0,t.jsx)(ez.X,{className:"h-3 w-3"}):(0,t.jsx)(n.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)(c.Button,{className:"text-xs",onClick:T,disabled:!p.trim(),children:r("taskPage.addNote")})]}),(0,t.jsxs)("div",{className:"mt-2 space-y-2",children:[0===i.length&&!x&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:r("taskPage.noNotes")}),i.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)("button",{type:"button",onClick:()=>y(e),className:"min-w-0 flex-1 cursor-pointer text-left",title:r("taskPage.previewNote"),children:[(0,t.jsx)("h4",{className:"text-sm font-medium truncate hover:underline",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.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,t.jsx)(c.Button,{variant:"ghost",size:"icon-xs",onClick:()=>y(e),className:"text-muted-foreground hover:bg-accent",title:r("taskPage.previewNote"),children:(0,t.jsx)(eU.Eye,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(c.Button,{variant:"ghost",size:"icon-xs",onClick:()=>S(e.id),className:"text-muted-foreground hover:bg-destructive/10 hover:text-destructive",title:r("taskPage.deleteNote"),children:(0,t.jsx)(C.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)(eM.Paperclip,{className:"h-3.5 w-3.5"}),r("taskPage.attachments")]}),(0,t.jsxs)(c.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>l.current?.click(),disabled:b,children:[(0,t.jsx)(e$.Upload,{className:"h-3 w-3"}),r("taskPage.uploadFile")]}),(0,t.jsx)("input",{ref:l,type:"file",className:"hidden",onChange:P})]}),(0,t.jsxs)("div",{className:"mt-2 space-y-1.5",children:[0===d.length&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:r("taskPage.noAttachments")}),d.map(e=>{var s;let a=I(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)(eM.Paperclip,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,t.jsx)("button",{type:"button",onClick:()=>D(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)(c.Button,{variant:"ghost",size:"icon-xs",onClick:()=>D(e),className:"shrink-0 text-muted-foreground hover:bg-accent",title:r("assets.preview"),children:(0,t.jsx)(eU.Eye,{className:"h-3 w-3"})}),(0,t.jsx)(c.Button,{variant:"ghost",size:"icon-xs",onClick:()=>L(e),className:"shrink-0 text-muted-foreground hover:bg-accent",title:r("assets.revealInFinder"),children:(0,t.jsx)(W.FolderOpen,{className:"h-3 w-3"})}),(0,t.jsx)(c.Button,{variant:"ghost",size:"icon-xs",onClick:()=>E(e.id),className:"shrink-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",title:r("taskPage.deleteAttachment"),children:(0,t.jsx)(C.Trash2,{className:"h-3 w-3"})})]})]},e.id)})]})]})]})}),(0,t.jsx)(eX.ImageLightbox,{imageUrl:"image"===F&&R>=0?A[R].url:null,filename:"image"===F&&R>=0?A[R].filename:"",open:"image"===F,onOpenChange:e=>{e||k(null)},assets:A.map(({url:e,filename:t})=>({url:e,filename:t})),currentIndex:R>=0?R:void 0,onIndexChange:e=>{let t=A[e];if(!t)return;let s=d.find(e=>e.id===t.id);s&&k(s)}}),(0,t.jsx)(eY.TextPreviewDialog,{url:"text"===F&&v?(0,eq.localPathToApiUrl)(v.path):null,filename:v?.filename??"",open:"text"===F,onOpenChange:e=>{e||k(null)}}),(0,t.jsx)(eJ.NotePreviewDialog,{note:w,open:null!==w,onOpenChange:e=>{e||y(null)}})]})}function e0({task:e,workspaceId:r,projectLocalPath:n,onClose:l}){let{t:i}=(0,u.useI18n)(),o=(0,a.useRouter)(),{removePortal:d}=(0,eS.useTerminalPortal)(),[h,p]=(0,s.useState)("terminal"),[g,f]=(0,s.useState)(null),[j,b]=(0,s.useState)(!1),[N,v]=(0,s.useState)(e.status);(0,s.useEffect)(()=>{v(e.status)},[e.status]);let[k,w]=(0,s.useState)(null),[y,C]=(0,s.useState)(!1),[T,S]=(0,s.useState)(!1),[P,E]=(0,s.useState)([]);(0,s.useEffect)(()=>{w(null),C(!1),S(!1),E([]),f(null),p("terminal")},[e.id]);let[I,D]=(0,s.useState)([]),[L,F]=(0,s.useState)(null);(0,s.useEffect)(()=>{let e=!1;return(0,eR.getPrompts)().then(t=>{if(e)return;D(t.map(e=>({id:e.id,name:e.name,isDefault:e.isDefault})));let s=t.find(e=>e.isDefault);s&&F(s.id)}),()=>{e=!0}},[]),(0,s.useEffect)(()=>{w(null),S(!1);let t=!1;return(0,eP.getTaskExecutions)(e.id).then(e=>{if(t)return;let s=e[0];if(s?.status==="RUNNING"){let e=s.worktreePath||n||null;e&&w(e)}E(e.filter(e=>"RUNNING"!==e.status)),S(!0)}),()=>{t=!0}},[e.id]),(0,s.useEffect)(()=>{if("changes"!==h||"TODO"===N||"CANCELLED"===N)return;let t=!1;return b(!0),fetch(`/api/tasks/${e.id}/diff`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{t||f(e?.files||e?.branchDeleted?e:null)}).catch(()=>{t||f(null)}).finally(()=>{t||b(!1)}),()=>{t=!0}},[h,N,e.id]);let A=(0,s.useCallback)(async()=>{if(!y){C(!0),d(e.id);try{let t=await (0,eE.startPtyExecutionSafe)(e.id,"",L);if(!t.ok){C(!1),eo.toast.error(t.error||i("terminal.startFailed"));return}w(t.worktreePath??null),v("IN_PROGRESS")}catch(e){C(!1),eo.toast.error(e instanceof Error&&e.message?e.message:i("terminal.startFailed"))}}},[e.id,y,L,i]),R=(0,s.useCallback)(t=>{C(!1),w(null),d(e.id),0===t&&v("IN_REVIEW"),(0,eP.getTaskExecutions)(e.id).then(e=>{E(e.filter(e=>"RUNNING"!==e.status))}),o.refresh()},[o,e.id]),O=(0,s.useCallback)(async()=>{await (0,eI.stopPtyExecution)(e.id),C(!1),d(e.id),w(null),v("IN_REVIEW"),(0,eP.getTaskExecutions)(e.id).then(e=>{E(e.filter(e=>"RUNNING"!==e.status))}),o.refresh()},[e.id,o]),$=(0,s.useCallback)(async t=>{C(!0),d(e.id),w(null);try{let{worktreePath:s}=await (0,eD.resumePtyExecution)(e.id,t);w(s),v("IN_PROGRESS")}catch{C(!1)}},[e.id,d]),M=(0,s.useCallback)(async()=>{C(!0),d(e.id),w(null);try{let{worktreePath:t}=await (0,eL.continueLatestPtyExecution)(e.id);w(t),v("IN_PROGRESS")}catch(e){C(!1),eo.toast.error(e instanceof Error?e.message:String(e))}},[e.id,d]),[z,W]=(0,s.useState)(!1),[G,H]=(0,s.useState)([]),_=(0,s.useCallback)(async()=>{try{let t=await (0,eF.checkWorktreeClean)(e.id);if(t.hasWorktree&&!t.clean)return void eo.toast.error(i("taskPage.uncommittedChanges",{count:String(t.files.length)}));if(t.hasWorktree&&t.clean&&!t.hasCommits)return void eo.toast.error(i("taskPage.noChangesToComplete"),{action:{label:i("taskPage.markAsCancelled"),onClick:()=>{(0,eB.updateTaskStatus)(e.id,"CANCELLED").then(()=>{v("CANCELLED"),eo.toast.success(i("taskPage.taskCancelled")),o.refresh()}).catch(()=>eo.toast.error("Failed to cancel task"))}}});if(t.hasWorktree&&t.hasCommits){H(t.commitLog),W(!0);return}await (0,eB.updateTaskStatus)(e.id,"DONE"),v("DONE"),eo.toast.success(i("taskPage.taskCompleted")),o.refresh()}catch{eo.toast.error("Failed to complete task")}},[e.id,o,i]),K=(0,s.useCallback)(()=>{v("DONE"),W(!1),eo.toast.success(i("taskPage.taskCompleted")),o.refresh()},[o,i]),X=(0,s.useCallback)(async t=>{try{let{hash:s}=await (0,eA.commitWorktreeChanges)(e.id,t);eo.toast.success(i("diff.commitSuccess",{hash:s})),o.refresh();let a=await fetch(`/api/tasks/${e.id}/diff`);if(a.ok){let e=await a.json();f(e?.files?e:null)}}catch(e){eo.toast.error(e instanceof Error?e.message:"Commit failed")}},[e.id,o,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)(ey,{title:e.title,description:i("taskDetail.panelDescription"),branch:`task/${e.id}`,baseBranch:e.baseBranch,version:e.version??null,hasConversation:!1,updatedAt:e.updatedAt,openDir:k??(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:()=>p("terminal"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"terminal"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,t.jsx)(Y.Terminal,{className:"h-3 w-3"}),i("terminal.execute")]}),(0,t.jsx)("button",{onClick:()=>p("changes"),className:`px-3 py-1 text-xs font-medium rounded-md ${"changes"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:i("taskPage.changes")}),(0,t.jsxs)("button",{onClick:()=>p("notes"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"notes"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,t.jsx)(U.FileText,{className:"h-3 w-3"}),i("taskPage.notes")]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:["IN_REVIEW"===N&&(0,t.jsxs)(c.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)(ev.CheckCircle2,{className:"h-3 w-3"}),i("taskPage.completeTask")]}),"DONE"!==N&&"CANCELLED"!==N&&(0,t.jsxs)(c.Button,{variant:"ghost",size:"sm",onClick:()=>o.push(`/workspaces/${r}/tasks/${e.id}`),className:"text-muted-foreground",children:[(0,t.jsx)(eb.ExternalLink,{className:"h-3 w-3"}),i("taskPage.viewDetails")]})]})]}),"terminal"===h?(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:T?k?(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)(x.Tooltip,{children:[(0,t.jsxs)(x.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)(eN.Square,{className:"h-3 w-3"}),i("terminal.stopExecution")]}),(0,t.jsx)(x.TooltipContent,{side:"bottom",children:i("terminal.stopHint")})]})]}),(0,t.jsx)("div",{className:"flex-1 min-h-0",children:(0,t.jsx)(eS.TerminalOutlet,{taskId:e.id,worktreePath:k,onSessionEnd:R})})]}):"DONE"===N||"CANCELLED"===N?(0,t.jsx)("div",{className:"flex h-full flex-col overflow-hidden",children:(0,t.jsx)(B.ScrollArea,{className:"flex-1 min-h-0",children:(0,t.jsx)(eO.ExecutionTimeline,{executions:P})})}):(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)(m.Select,{defaultValue:L??"none",onValueChange:e=>F("none"===e?null:e),children:[(0,t.jsx)(m.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)(m.SelectContent,{className:"min-w-[200px]",children:[(0,t.jsx)(m.SelectItem,{value:"none",children:i("terminal.noPrompt")}),I.map(e=>(0,t.jsxs)(m.SelectItem,{value:e.id,children:[e.name,e.isDefault?" ★":""]},e.id))]})]},`prompt-${I.length}`),(0,t.jsxs)(c.Button,{onClick:A,disabled:y,size:"sm",className:"gap-2 px-4",children:[y?(0,t.jsx)(V.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(Y.Terminal,{className:"h-3.5 w-3.5"}),y?i("terminal.executing"):i("terminal.launch")]})]}),(0,t.jsx)(B.ScrollArea,{className:"flex-1 min-h-0",children:(0,t.jsx)(eO.ExecutionTimeline,{executions:P,onResume:$,onContinueLatest:M})})]}):(0,t.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-[#0f1419]",children:[(0,t.jsx)(V.Loader2,{className:"size-5 animate-spin text-neutral-500"}),(0,t.jsx)("span",{className:"text-xs text-neutral-500",children:i("execution.loading")})]})}):"changes"===h?(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:j?(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")})}):g?.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")})}):g?(0,t.jsx)(eC.TaskDiffView,{taskId:e.id,files:g.files,totalAdded:g.totalAdded,totalRemoved:g.totalRemoved,hasConflicts:g.hasConflicts,conflictFiles:g.conflictFiles,onCommit:X,hasUncommitted:g.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"===h?(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,t.jsx)(eZ,{taskId:e.id,projectId:e.projectId})}):null,(0,t.jsx)(eT.TaskMergeConfirmDialog,{open:z,onOpenChange:W,taskId:e.id,taskTitle:e.title,baseBranch:e.baseBranch??"main",fileCount:g?.files?.length??0,commitCount:g?.commitCount??0,commitLog:G,onMergeComplete:K})]})}var e1=e.i(887753),e5=e.i(387711);let e3=(0,Q.createServerReference)("4030e78f069857b3442f62a09eece7800ff9194c77",Q.callServer,void 0,Q.findSourceMapURL,"deleteTask"),e2=(0,Q.createServerReference)("40c0c82602098695bf0b87f5b733c3ad600116fe1e",Q.callServer,void 0,Q.findSourceMapURL,"toggleTaskPinned");var e4=e.i(569897);let e8=(0,Q.createServerReference)("40d01f477de58b0906912bd54d70f1517dfa0c3d83",Q.callServer,void 0,Q.findSourceMapURL,"getVersionsForPicker");var e7=e.i(889620),e6=e.i(19671);function e9({project:e,isActive:s,onSelect:a}){let{t:r}=(0,u.useI18n)(),n=e.totalTasks,l=e.runningTasks,i=n>0?Math.round(l/n*100):0,o=(0,t.jsxs)("button",{onClick:()=>{s||a(e.id)},className:`group flex w-[212px] shrink-0 items-center gap-2 rounded-lg border-b-2 px-3 py-1.5 text-left transition-colors ${s?"border-primary bg-primary/10 ring-1 ring-primary/20 cursor-default":"border-transparent hover:bg-accent cursor-pointer"}`,children:[(0,t.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,t.jsx)("span",{className:`w-full truncate text-sm font-medium leading-tight ${s?"text-primary":"text-muted-foreground group-hover:text-foreground"}`,children:e.name}),e.alias&&(0,t.jsx)("span",{className:"w-full truncate text-[11px] font-normal leading-tight text-muted-foreground/70",children:e.alias})]}),(0,t.jsxs)("span",{className:"flex shrink-0 items-baseline rounded-md border border-border bg-card px-1.5 py-0.5 font-mono text-[11px] font-semibold leading-none",children:[(0,t.jsx)("span",{className:"text-amber-500 dark:text-amber-400",children:l}),(0,t.jsx)("span",{className:"mx-px text-muted-foreground/50",children:"/"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:n})]})]});return(0,t.jsxs)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:o}),(0,t.jsxs)(x.TooltipContent,{side:"bottom",hideArrow:!0,className:"flex w-[268px] max-w-none flex-col items-stretch gap-0 rounded-xl border border-border bg-card p-3.5 text-foreground shadow-lg",children:[(0,t.jsx)("div",{className:"text-[13px] font-bold leading-snug break-words",children:e.name}),e.alias&&(0,t.jsx)("div",{className:"mt-0.5 text-[11.5px] leading-relaxed text-muted-foreground break-words",children:e.alias}),(0,t.jsx)("div",{className:"my-2.5 h-px bg-border"}),(0,t.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,t.jsx)("span",{className:"size-2 shrink-0 rounded-full bg-amber-500 dark:bg-amber-400"}),(0,t.jsx)("span",{className:"text-[13px] font-semibold",children:r("board.running")}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:r("board.runningDesc")}),(0,t.jsx)("span",{className:"ml-auto font-mono text-[15px] font-bold text-amber-500 dark:text-amber-400",children:l})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"size-2 shrink-0 rounded-full bg-sky-500 dark:bg-sky-400"}),(0,t.jsx)("span",{className:"text-[13px] font-semibold",children:r("board.overview")}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:r("board.totalDesc")}),(0,t.jsx)("span",{className:"ml-auto font-mono text-[15px] font-bold",children:n})]}),(0,t.jsx)("div",{className:"mt-2.5 h-[5px] overflow-hidden rounded-full bg-sky-500/15 dark:bg-sky-400/15",children:(0,t.jsx)("div",{className:"h-full rounded-full bg-amber-500 dark:bg-amber-400",style:{width:`${i}%`}})}),(0,t.jsx)("div",{className:"mt-2.5 text-[10px] text-muted-foreground",children:r("board.badgeFormatHint")})]})]})}function te({projects:e,activeProjectId:a,onSelect:r}){let n=(0,s.useRef)(null),[l,i]=(0,s.useState)(!1),[o,c]=(0,s.useState)(!1),d=()=>{let e=n.current;e&&(i(e.scrollLeft>0),c(e.scrollLeft<e.scrollWidth-e.clientWidth-1))};(0,s.useEffect)(()=>{d();let e=n.current;if(e){e.addEventListener("scroll",d);let t=new ResizeObserver(d);return t.observe(e),()=>{e.removeEventListener("scroll",d),t.disconnect()}}},[e]);let m=e=>{let t=n.current;t&&t.scrollBy({left:"left"===e?-150:150,behavior:"smooth"})};return(0,t.jsxs)("div",{className:"relative flex items-center",children:[l&&(0,t.jsx)("button",{onClick:()=>m("left"),className:"absolute left-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,t.jsx)(e6.ChevronLeft,{className:"h-4 w-4"})}),(0,t.jsx)("div",{ref:n,className:"flex items-center gap-1.5 overflow-x-auto scrollbar-none px-1 py-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:e.map(e=>(0,t.jsx)(e9,{project:e,isActive:a===e.id,onSelect:r},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)(z.ChevronRight,{className:"h-4 w-4"})})]})}var tt=e.i(759686);function ts({open:e,onOpenChange:s,taskTitle:a,uncommittedFiles:r,commitLog:n,onConfirm:l}){let{t:i}=(0,u.useI18n)(),o=r.length,d=n.length,m=0===o&&0===d;return(0,t.jsx)(L.Dialog,{open:e,onOpenChange:s,children:(0,t.jsxs)(L.DialogContent,{showCloseButton:!0,className:"sm:max-w-md",children:[(0,t.jsx)(L.DialogHeader,{children:(0,t.jsxs)(L.DialogTitle,{className:"flex items-center gap-2",children:[(0,t.jsx)(tt.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:o})]}),(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})]})]}),o>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)(L.DialogFooter,{children:[(0,t.jsx)(c.Button,{variant:"outline",onClick:()=>s(!1),children:i("taskCancel.keep")}),(0,t.jsxs)(c.Button,{variant:"destructive",onClick:l,className:"gap-2",children:[(0,t.jsx)(tt.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:o,openTaskId:c}){let d=(0,a.useRouter)(),{t:m}=(0,u.useI18n)(),[,x]=(0,s.useTransition)(),[p,g]=(0,s.useState)(""),[j,b]=(0,s.useState)("all"),[N,v]=(0,s.useState)(!1),[k,w]=(0,s.useState)("TODO"),[y,C]=(0,s.useState)(c??null),[T,S]=(0,s.useState)([]),P=y?i.find(e=>e.id===y)??null:null,[E,I]=(0,s.useState)(null),[D,L]=(0,s.useState)(null),[B,F]=(0,s.useState)(null);(0,s.useEffect)(()=>{e8(r).then(S).catch(()=>S([]))},[r]),(0,s.useEffect)(()=>{(0,e7.setLastProjectId)(e,r)},[e,r]);let A=T.find(e=>e.isCurrent)?.id??null,$=(0,s.useCallback)(()=>{x(()=>{d.refresh()})},[d]);(0,s.useEffect)(()=>{if(N)return;let e=setInterval(()=>{x(()=>{d.refresh()})},5e3);return()=>clearInterval(e)},[d,N]);let M=(0,s.useCallback)(e=>{g(e)},[]),z=(0,s.useCallback)(async e=>{let t=i.find(t=>t.id===e);if(t)try{let s=await (0,eF.checkWorktreeClean)(e);if(s.hasWorktree&&!s.clean){eo.toast.error(m("taskPage.uncommittedChanges",{count:String(s.files.length)})),$();return}if(s.hasWorktree&&s.clean&&!s.hasCommits){eo.toast.error(m("taskPage.noChangesToComplete"),{action:{label:m("taskPage.markAsCancelled"),onClick:()=>{(0,eB.updateTaskStatus)(e,"CANCELLED").then(()=>{eo.toast.success(m("taskPage.taskCancelled")),$()}).catch(()=>eo.toast.error("Failed to cancel task"))}}}),$();return}if(s.hasWorktree&&s.hasCommits){L({task:t,commitLog:s.commitLog,commitCount:s.commitLog.length}),$();return}await (0,eB.updateTaskStatus)(e,"DONE"),eo.toast.success(m("taskPage.taskCompleted")),$()}catch{eo.toast.error("Failed to complete task"),$()}},[i,$,m]),U=(0,s.useCallback)(async e=>{let t=i.find(t=>t.id===e);if(t)try{let s=await (0,eF.checkWorktreeClean)(e);if(!s.hasWorktree){await (0,eB.updateTaskStatus)(e,"CANCELLED"),eo.toast.success(m("taskPage.taskCancelled")),$();return}F({task:t,files:s.files,commitLog:s.commitLog}),$()}catch{eo.toast.error("Failed to cancel task"),$()}},[i,$,m]),W=(0,s.useCallback)(async(e,t)=>{"DONE"===t?await z(e):"CANCELLED"===t?await U(e):(await (0,eB.updateTaskStatus)(e,t),$())},[$,z,U]),G=(0,s.useCallback)(async e=>{let t=await (0,e1.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,e4.startPtyExecution)(t.id,""),C(t.id)}catch(e){eo.toast.error(e instanceof Error?e.message:String(e))}$()},[r,$]),H=(0,s.useCallback)(async(e,t)=>{await (0,e5.updateTask)(e,{...t,labelIds:t.labelIds}),I(null),$()},[$]),V=(0,s.useCallback)(async e=>{await e3(e),y===e&&C(null),$()},[$,y]),_=(0,s.useCallback)(async e=>{await e2(e),$()},[$]),K=(0,s.useCallback)(async t=>{try{await (0,e4.startPtyExecution)(t,"")}catch(e){eo.toast.error(e instanceof Error?e.message:String(e))}d.push(`/workspaces/${e}/tasks/${t}`)},[d,e]),X=(0,s.useCallback)(async(e,t)=>{"DONE"===t?await z(e):"CANCELLED"===t?await U(e):(await (0,eB.updateTaskStatus)(e,t),$())},[$,z,U]),Y=(0,s.useCallback)(e=>{w(e),I(null),v(!0)},[]),J=(0,s.useCallback)(e=>{I(e),v(!0)},[]),q=i.filter(e=>!e.labels?.some(e=>e.label.name===f.TOWER_LABEL_NAME&&e.label.isBuiltin)).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)(te,{projects:l,activeProjectId:r,onSelect:t=>d.push(`/workspaces/${e}?projectId=${t}`,{scroll:!1})})}),(0,t.jsx)(h,{searchQuery:p,onSearchChange:M,versions:T,versionFilter:j,onVersionFilterChange:b,versionsHref:`/workspaces/${e}/projects/${r}/versions`,onCreateTask:()=>{I(null),v(!0)}}),(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:(0,t.jsx)(R,{initialTasks:q,onTaskMove:W,onTaskClick:e=>{C(e.id)},onEditTask:J,onAddTask:Y,onDeleteTask:V,onTogglePin:_,workspaceId:e,onContextMenuStatusChange:X,onContextMenuLaunch:K})}),(0,t.jsx)(O.CreateTaskDialog,{open:N,onOpenChange:e=>{v(e),e||I(null)},onSubmit:G,onUpdate:H,defaultStatus:k,editTask:E,editTaskLabelIds:E?.labels?E.labels.map(e=>e.labelId):[],labels:o.filter(e=>!(e.name===f.TOWER_LABEL_NAME&&e.isBuiltin)),projectType:n.type,projectLocalPath:n.localPath,versions:T,defaultVersionId:A})]}),P?(0,t.jsx)(e0,{task:P,workspaceId:e,projectLocalPath:n.localPath,onClose:()=>C(null)}):(0,t.jsx)(ej,{project:n,workspaceId:e}),D&&(0,t.jsx)(eT.TaskMergeConfirmDialog,{open:!0,onOpenChange:e=>{e||L(null)},taskId:D.task.id,taskTitle:D.task.title,baseBranch:D.task.baseBranch??"main",fileCount:0,commitCount:D.commitCount,commitLog:D.commitLog,onMergeComplete:()=>{L(null),eo.toast.success(m("taskPage.taskCompleted")),$()}}),B&&(0,t.jsx)(ts,{open:!0,onOpenChange:e=>{e||F(null)},taskTitle:B.task.title,uncommittedFiles:B.files,commitLog:B.commitLog,onConfirm:()=>{let e=B.task.id;F(null),(0,eB.updateTaskStatus)(e,"CANCELLED").then(()=>{eo.toast.success(m("taskPage.taskCancelled")),$()}).catch(()=>eo.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(210702),n=e.i(232545),l=e.i(738690),i=e.i(226145),o=e.i(486077),c=e.i(519455),d=e.i(793479),m=e.i(967489),x=e.i(746798),u=e.i(533499);function h({searchQuery:e,onSearchChange:s,versions:a=[],versionFilter:p="all",onVersionFilterChange:g,versionsHref:f,onCreateTask:j}){let b,{t:N}=(0,u.useI18n)(),v="all"===p?N("board.allVersions"):"backlog"===p?N("board.backlogFilter"):(b=a.find(e=>e.id===p))?`${b.number} ${b.name}`:N("board.allVersions");return(0,t.jsxs)("div",{className:"flex items-center gap-2 px-6 py-2",children:[g&&(0,t.jsxs)(m.Select,{value:p,onValueChange:e=>g(e||"all"),children:[(0,t.jsxs)(m.SelectTrigger,{className:"h-8 w-44 shrink-0 gap-1.5 text-xs text-muted-foreground",children:[(0,t.jsx)(i.GitBranch,{className:"h-3.5 w-3.5 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:v})]}),(0,t.jsxs)(m.SelectContent,{children:[(0,t.jsx)(m.SelectItem,{value:"all",children:N("board.allVersions")}),(0,t.jsx)(m.SelectItem,{value:"backlog",children:N("board.backlogFilter")}),a.map(e=>(0,t.jsxs)(m.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)(l.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)(d.Input,{type:"text",value:e,onChange:e=>s(e.target.value),placeholder:N("board.searchPlaceholder"),className:"pl-8 pr-3 text-xs"})]}),(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[(0,t.jsxs)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",children:(0,t.jsx)(o.Lightbulb,{className:"h-4 w-4"})})}),(0,t.jsx)(x.TooltipContent,{side:"bottom",className:"max-w-xs",children:N("board.tipText")})]}),f&&(0,t.jsx)(r.default,{href:f,children:(0,t.jsxs)(c.Button,{variant:"outline",className:"h-8 gap-1.5 text-xs text-muted-foreground",children:[(0,t.jsx)(i.GitBranch,{className:"h-3.5 w-3.5"}),N("version.timeline")]})}),(0,t.jsxs)(c.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:j,children:[(0,t.jsx)(n.Plus,{className:"h-3.5 w-3.5"}),N("board.newTask")]})]})]})}var p=e.i(585012),g=e.i(597746),f=e.i(685149);function j({x:e,y:r,taskId:n,currentStatus:l,hasExecutions:i,workspaceId:o,onClose:c,onStatusChange:d,onLaunch:m}){let{t:x}=(0,u.useI18n)(),h=(0,a.useRouter)(),b=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=e=>{b.current&&!b.current.contains(e.target)&&c()},t=e=>{"Escape"===e.key&&c()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[c]);let N="flex items-center px-3 py-1.5 text-xs cursor-pointer hover:bg-accent rounded-sm w-full text-left",v=(0,t.jsxs)("div",{ref:b,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:x("board.contextMenu.changeStatus")}),f.BOARD_COLUMNS.map(e=>(0,t.jsxs)("button",{type:"button",className:N,onClick:()=>{d(n,e.id),c()},children:[l===e.id?(0,t.jsx)(g.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:`${N} ${i?"opacity-50 cursor-not-allowed":""}`,disabled:i,onClick:()=>{i||(m(n),c())},children:x("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:N,onClick:()=>{h.push(`/workspaces/${o}/tasks/${n}`),c()},children:x("board.contextMenu.goToDetail")})]})]});return"u"<typeof document?null:(0,p.createPortal)(v,document.body)}var b=e.i(720247),N=e.i(775712),v=e.i(469051),k=e.i(67013),w=e.i(49007),y=e.i(464249),C=e.i(998626),T=e.i(572989);let S=(0,T.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 P=e.i(487486),E=e.i(755146),I=e.i(35967);function D({task:e,onClick:s,onEdit:a,onDelete:r,onTogglePin:n,onContextMenu:l}){let{t:o}=(0,u.useI18n)(),{attributes:d,listeners:m,setNodeRef:h,transform:p,transition:g,isDragging:j}=(0,N.useSortable)({id:e.id,data:{type:"task",task:e}}),b={transform:k.CSS.Transform.toString(p),transition:g,opacity:j?.4:1},v=f.PRIORITY_CONFIG[e.priority],T=!!e.baseBranch;return(0,t.jsxs)("div",{ref:h,style:b,...d,...m,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)(c.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":o(e.pinned?"board.unpin":"board.pin"),children:(0,t.jsx)(S,{className:`h-3.5 w-3.5 ${e.pinned?"-rotate-45":""}`})}),(0,t.jsxs)(E.DropdownMenu,{children:[(0,t.jsx)(E.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)(w.MoreHorizontal,{className:"h-4 w-4"})}),(0,t.jsxs)(E.DropdownMenuContent,{align:"end",children:[(0,t.jsxs)(E.DropdownMenuItem,{onClick:t=>{t.stopPropagation(),a?.(e)},children:[(0,t.jsx)(y.Pencil,{className:"mr-2 h-3.5 w-3.5"}),o("common.edit")]}),(0,t.jsxs)(E.DropdownMenuItem,{className:"text-rose-400",onClick:t=>{t.stopPropagation(),r?.(e.id)},children:[(0,t.jsx)(C.Trash2,{className:"mr-2 h-3.5 w-3.5"}),o("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)(P.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${v.color}`,children:v.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)),(T||e.version)&&(0,t.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[T&&(0,t.jsxs)(x.Tooltip,{disableHoverablePopup:!0,children:[(0,t.jsx)(x.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)(i.GitBranch,{className:"h-2.5 w-2.5 shrink-0"})})}),(0,t.jsx)(x.TooltipContent,{side:"top",children:o("board.card.worktree",{branch:e.baseBranch??""})})]}),e.version&&(0,t.jsxs)(x.Tooltip,{disableHoverablePopup:!0,children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)("span",{className:"cursor-default",onPointerDown:e=>e.stopPropagation(),children:(0,t.jsx)(I.TaskVersionTag,{number:e.version.number,title:""})})}),(0,t.jsx)(x.TooltipContent,{side:"top",children:o("board.card.version",{number:e.version.number,name:e.version.name})})]})]})]})]})}var L=e.i(776639),B=e.i(759684);function F({open:e,onOpenChange:s,columnLabel:a,columnColor:r,tasks:n,onTaskClick:l}){let{t:i}=(0,u.useI18n)();return(0,t.jsx)(L.Dialog,{open:e,onOpenChange:s,children:(0,t.jsxs)(L.DialogContent,{className:"sm:max-w-6xl max-h-[80vh]",children:[(0,t.jsx)(L.DialogHeader,{children:(0,t.jsxs)(L.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)(B.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=f.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)(P.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 R({id:e,label:a,color:r,tasks:l,onTaskClick:i,onEditTask:o,onAddTask:d,onDeleteTask:m,onTogglePin:x,onContextMenu:h}){let{setNodeRef:p,isOver:g}=(0,b.useDroppable)({id:e}),[f,j]=(0,s.useState)(!1),{t:k}=(0,u.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:l.length})]}),(0,t.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(c.Button,{variant:"ghost",size:"icon-xs",onClick:()=>j(!0),className:"text-muted-foreground","aria-label":k("board.viewAll"),children:(0,t.jsx)(v.LayoutGrid,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(c.Button,{variant:"ghost",size:"icon-xs",onClick:d,className:"text-muted-foreground","aria-label":"add",children:(0,t.jsx)(n.Plus,{className:"h-3.5 w-3.5"})})]})]}),(0,t.jsx)(F,{open:f,onOpenChange:j,columnLabel:a,columnColor:r,tasks:l,onTaskClick:i}),(0,t.jsx)(B.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)(N.SortableContext,{items:l.map(e=>e.id),strategy:N.verticalListSortingStrategy,children:l.map(e=>(0,t.jsx)(D,{task:e,onClick:()=>i?.(e),onEdit:o,onDelete:m,onTogglePin:x,onContextMenu:h},e.id))})})})]})}function A({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,N]=(0,s.useState)(null);(0,s.useEffect)(()=>{u(e)},[e]);let v=(0,b.useSensors)((0,b.useSensor)(b.PointerSensor,{activationConstraint:{distance:8}})),k=(0,s.useCallback)((e,t,s)=>{N({task:e,x:t,y:s})},[]),w=(0,s.useCallback)(e=>{let t=x.find(t=>t.id===e.active.id);t&&p(t)},[x]),y=(0,s.useCallback)(e=>{let t,{active:s,over:r}=e;if(p(null),!r)return;let n=s.id,l=r.id;if(f.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)(b.DndContext,{id:"kanban-board",sensors:v,collisionDetection:b.closestCorners,onDragStart:w,onDragEnd:y,children:[(0,t.jsx)("div",{className:"mx-2 flex h-full overflow-x-auto rounded-xl border border-border bg-card/50",children:f.BOARD_COLUMNS.map(e=>(0,t.jsx)(R,{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:k},e.id))}),(0,t.jsx)(b.DragOverlay,{children:h?(0,t.jsx)("div",{className:"rotate-3 scale-105",children:(0,t.jsx)(D,{task:h})}):null}),g&&(0,t.jsx)(j,{x:g.x,y:g.y,taskId:g.task.id,currentStatus:g.task.status,hasExecutions:(g.task._count?.executions??0)>0,workspaceId:m??"",onClose:()=>N(null),onStatusChange:(e,t)=>{c?.(e,t),N(null)},onLaunch:e=>{d?.(e),N(null)}})]})}var O=e.i(744798);function $(e,t,s){return Math.min(Math.max(e,t),s)}var M=e.i(232280),z=e.i(368490),U=e.i(645378),W=e.i(453889);let G=(0,T.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),V=e.i(400355),_=e.i(233274),K=e.i(736061),X=e.i(460707),Y=e.i(567860),J=e.i(875840),q=e.i(624687),Q=e.i(514798);let Z=(0,Q.createServerReference)("608aac1637b86613ba60424496283123c9a2a5de0b",Q.callServer,void 0,Q.findSourceMapURL,"updateProject");var ee=e.i(86084);let et=(0,Q.createServerReference)("40f16c9bf878ed8da769bf0b0f991bce6a98c60409",Q.callServer,void 0,Q.findSourceMapURL,"deleteProject"),es=(0,Q.createServerReference)("40ebfe2e4d860bd1f880950a57713cfba603ebe8cb",Q.callServer,void 0,Q.findSourceMapURL,"getRecentLocalProjects"),ea=(0,Q.createServerReference)("4054b75c148f6c4fd80843f786e74e0da8e3622d60",Q.callServer,void 0,Q.findSourceMapURL,"getOrCreateTowerTaskId");var er=e.i(517675),en=e.i(49618),el=e.i(338973),ei=e.i(117356),eo=e.i(360112),ec=e.i(224277),ed=e.i(905455);function em({commits:e}){let{t:a}=(0,u.useI18n)(),[r,n]=(0,s.useState)(!1);return 0===e.length?null:(0,t.jsxs)("div",{className:"border-b border-border",children:[(0,t.jsxs)("button",{onClick:()=>n(!r),className:"flex w-full items-center gap-1 px-2 py-1.5 hover:bg-accent/50 transition-colors",children:[r?(0,t.jsx)(M.ChevronDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,t.jsx)(z.ChevronRight,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,t.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[a("git.commitLog")," (",e.length,")"]})]}),r&&(0,t.jsx)("div",{className:"mt-0.5 mb-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)(G,{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),eo.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)(J.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 ex=e.i(487278),eu=e.i(375306),eh=e.i(244354);function ep({localPath:e,stashes:a,hasChanges:r,onRefresh:n}){let{t:l}=(0,u.useI18n)(),[i,o]=(0,s.useState)(!1),[m,x]=(0,s.useState)(!1),[h,p]=(0,s.useState)(""),[g,f]=(0,s.useState)(null),j=async()=>{x(!0);try{await (0,eh.gitAction)(e,"stash-save",{message:h}),p(""),eo.toast.success(l("git.stashSaved")),await n()}catch(e){eo.toast.error(e instanceof Error?e.message:String(e))}finally{x(!1)}},b=async t=>{f(t);try{await (0,eh.gitAction)(e,"stash-pop",{index:t}),eo.toast.success(l("git.stashApplied")),await n()}catch(e){eo.toast.error(e instanceof Error?e.message:String(e))}finally{f(null)}},N=async t=>{f(t);try{await (0,eh.gitAction)(e,"stash-drop",{index:t}),eo.toast.success(l("git.stashDropped")),await n()}catch(e){eo.toast.error(e instanceof Error?e.message:String(e))}finally{f(null)}};return r||0!==a.length?(0,t.jsxs)("div",{className:"border-b border-border",children:[(0,t.jsxs)("button",{onClick:()=>o(!i),className:"flex w-full items-center gap-1 px-2 py-1.5 hover:bg-accent/50 transition-colors",children:[i?(0,t.jsx)(M.ChevronDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,t.jsx)(z.ChevronRight,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(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.jsxs)("div",{className:"mt-0.5 mb-1.5 space-y-2",children:[r&&(0,t.jsxs)("div",{className:"flex gap-1.5",children:[(0,t.jsx)(d.Input,{value:h,onChange:e=>p(e.target.value),placeholder:l("git.stashMsgPlaceholder"),className:"h-7 text-xs flex-1",onKeyDown:e=>"Enter"===e.key&&j()}),(0,t.jsx)(c.Button,{variant:"outline",size:"icon-sm",onClick:j,disabled:m,className:"shrink-0",children:m?(0,t.jsx)(V.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(ex.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)(ex.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)(c.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)(V.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(eu.ArrowUpFromLine,{className:"h-3 w-3"})}),(0,t.jsx)(c.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)(C.Trash2,{className:"h-3 w-3"})})]})]},e.index))})]})]}):null}var eg=e.i(515135);function ef({value:e,ariaLabel:a}){let{t:r}=(0,u.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),eo.toast.success(r("common.copied")),setTimeout(()=>l(!1),1500)}catch{eo.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)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon-xs",className:"shrink-0 text-muted-foreground","aria-label":a,onClick:i,children:n?(0,t.jsx)(g.Check,{className:"h-3 w-3 text-emerald-400"}):(0,t.jsx)(J.Copy,{className:"h-3 w-3"})})}),(0,t.jsx)(x.TooltipContent,{children:n?r("common.copied"):r("common.copy")})]})]})}function ej({project:e,workspaceId:r}){let{t:n,locale:l}=(0,u.useI18n)(),o=(0,a.useRouter)(),{width:m,isDragging:h,startResize:p}=function(e){let{storageKey:t,defaultWidth:a,minWidth:r,maxWidth:n,edge:l="left"}=e,[i,o]=(0,s.useState)(a),[c,d]=(0,s.useState)(!1),m=(0,s.useRef)(null);(0,s.useEffect)(()=>{try{let e=window.localStorage.getItem(t),s=null==e?NaN:Number(e);Number.isFinite(s)&&o($(s,r,n))}catch{}},[t,r,n]);let x=(0,s.useCallback)(e=>{let t=m.current;t&&o(function(e,t,s,a,r,n="left"){return $(e+("left"===n?t-s:s-t),a,r)}(t.width,t.x,e.clientX,r,n,l))},[r,n,l]),u=(0,s.useCallback)(()=>{m.current&&(m.current=null,d(!1),window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",u),o(e=>{try{window.localStorage.setItem(t,String(e))}catch{}return e}))},[x,t]),h=(0,s.useCallback)(e=>{e.preventDefault(),m.current={x:e.clientX,width:i},d(!0),window.addEventListener("pointermove",x),window.addEventListener("pointerup",u)},[i,x,u]);return(0,s.useEffect)(()=>()=>{window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",u)},[x,u]),{width:i,isDragging:c,startResize:h}}({storageKey:"tower:repo-sidebar-width",defaultWidth:288,minWidth:240,maxWidth:560,edge:"left"}),[g,f]=(0,s.useState)(!0),[j,b]=(0,s.useState)(!0),[N,v]=(0,s.useState)(!1),[k,w]=(0,s.useState)(!1),[T,S]=(0,s.useState)(""),[P,E]=(0,s.useState)(!1),[I,D]=(0,s.useState)(!1),[B,F]=(0,s.useState)(!1),[R,A]=(0,s.useState)(e.name),[O,J]=(0,s.useState)(e.alias??""),[Q,ex]=(0,s.useState)(e.description??""),[eu,eh]=(0,s.useState)(e.localPath??""),[eb,eN]=(0,s.useState)(e.projectType??"FRONTEND"),[ev,ek]=(0,s.useState)([]);(0,s.useEffect)(()=>{es(100).then(ek)},[]);let[ew,ey]=(0,s.useState)(!1),[eC,eT]=(0,s.useState)(""),[eS,eP]=(0,s.useState)(""),[eE,eI]=(0,s.useState)(""),[eD,eL]=(0,s.useState)(""),[eB,eF]=(0,s.useState)("FRONTEND"),[eR,eA]=(0,s.useState)(!1),[eO,e$]=(0,s.useState)(!1),[eM,ez]=(0,s.useState)(null),[eU,eW]=(0,s.useState)(!1),[eG,eH]=(0,s.useState)(!1),eV=e=>{eo.toast.info(e)},e_=(0,s.useCallback)(async()=>{if(e.localPath){eW(!0);try{let t=await fetch(`/api/git?path=${encodeURIComponent(e.localPath)}`);t.ok&&ez(await t.json())}catch{}finally{eW(!1)}}},[e.localPath]);(0,s.useEffect)(()=>{e_()},[e_]);let eK=async()=>{if(e.localPath){eH(!0);try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",path:e.localPath})})).ok?(eV(n("git.initSuccess")),await e_()):eV(n("git.initFailed"))}catch{eV(n("git.initFailed"))}finally{eH(!1)}}},eX=(e,t)=>{o.push(`/workspaces/${e}?projectId=${t}`,{scroll:!1}),o.refresh()},eY=async()=>{if(eS.trim()){eA(!0);try{let e=await (0,ee.createProject)({name:eS.trim(),alias:eE.trim()||void 0,description:eD.trim()||void 0,localPath:eC,projectType:eB,workspaceId:r});ey(!1),eX(r,e.id)}catch(e){eo.toast.error(e instanceof Error?e.message:String(e))}finally{eA(!1)}}},eJ=async()=>{if(eu&&!eO){e$(!0);try{let e=await (0,ei.analyzeProjectDirectory)(eu.trim(),l);ex(e)}catch{eo.toast.error(n("project.analyzeError"))}finally{e$(!1)}}},eq=async()=>{try{await Z(e.id,{name:R.trim(),alias:O.trim()||void 0,description:Q.trim()||void 0,localPath:eu.trim()||void 0,projectType:eb}),o.refresh(),v(!1)}catch(e){eo.toast.error(e instanceof Error?e.message:String(e))}};return(0,t.jsxs)("aside",{className:"relative flex-shrink-0 border-l border-border bg-sidebar",style:{width:m},children:[(0,t.jsx)("div",{onPointerDown:p,className:`absolute left-0 top-0 z-20 h-full w-1 -translate-x-1/2 cursor-col-resize transition-colors hover:bg-primary/20 ${h?"bg-primary/40":"bg-transparent"}`,role:"separator","aria-orientation":"vertical","aria-label":n("sidebar.right.resize")}),(0,t.jsxs)("div",{className:"h-full overflow-y-auto",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)(c.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{A(e.name),J(e.alias??""),ex(e.description??""),eh(e.localPath??""),v(!0)},className:"text-muted-foreground",children:(0,t.jsx)(y.Pencil,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(c.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{S(""),w(!0)},className:"text-muted-foreground hover:text-rose-400",children:(0,t.jsx)(C.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)(i.GitBranch,{className:"h-3 w-3"}),n("sidebar.right.gitType")]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(U.FileText,{className:"h-3 w-3"}),n("sidebar.right.normalType")]})})}),e.gitUrl&&(0,t.jsx)("div",{className:"mt-3 space-y-1.5",children:(0,t.jsx)(ef,{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)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,er.openInFileManager)(e.localPath)}catch(e){console.error("openInFileManager failed:",e),eo.toast.error(n("git.openInFileManagerFailed"))}},children:(0,t.jsx)(K.FolderSearch,{className:"h-4 w-4"})})}),(0,t.jsx)(x.TooltipContent,{children:n("git.openInFileManager")})]}),(0,t.jsxs)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,en.openInEditor)(e.localPath)}catch(e){console.error("openInEditor failed:",e),eo.toast.error(n("git.openInEditorFailed"))}},children:(0,t.jsx)(X.Code,{className:"h-4 w-4"})})}),(0,t.jsx)(x.TooltipContent,{children:n("git.openInEditor")})]}),(0,t.jsxs)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,el.openInTerminal)(e.localPath)}catch(e){console.error("openInTerminal failed:",e),eo.toast.error(n("git.openInTerminalFailed"))}},children:(0,t.jsx)(Y.Terminal,{className:"h-4 w-4"})})}),(0,t.jsx)(x.TooltipContent,{children:n("git.openInTerminal")})]})]}),(0,t.jsxs)(c.Button,{variant:"outline",className:"w-full h-9 gap-1.5 text-xs",disabled:I,onClick:async()=>{D(!0);try{let t=await ea(e.id);o.push(`/workspaces/${r}/tasks/${t}`)}catch{eo.toast.error(n("git.openStudioFailed"))}finally{D(!1)}},children:[I?(0,t.jsx)(V.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(W.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)(c.Button,{variant:"ghost",onClick:()=>f(!g),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")}),g?(0,t.jsx)(M.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,t.jsx)(z.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),g&&(0,t.jsx)("div",{className:"mt-3",children:e.localPath?eU?(0,t.jsxs)("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:[(0,t.jsx)(V.Loader2,{className:"h-4 w-4 animate-spin"}),(0,t.jsx)("span",{className:"ml-2 text-xs",children:n("git.loading")})]}):eM&&!eM.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)(c.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:eK,disabled:eG,children:[eG?(0,t.jsx)(V.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(G,{className:"h-3 w-3"}),n("git.initRepo")]})]}):eM?.isGit?(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"flex flex-col",children:(0,t.jsx)(eg.EditorGitPanel,{localPath:e.localPath,mode:"project"})}),(0,t.jsx)(em,{commits:eM.commits??[]}),(0,t.jsx)(ep,{localPath:e.localPath,stashes:eM.stashes??[],hasChanges:(eM.changedFiles??[]).length>0,onRefresh:e_})]}):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)(c.Button,{variant:"ghost",onClick:()=>b(!j),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")}),j?(0,t.jsx)(M.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,t.jsx)(z.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),j&&(0,t.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,t.jsxs)(c.Button,{variant:"outline",className:"w-full h-8 gap-1.5 text-xs",onClick:()=>F(!0),children:[(0,t.jsx)(W.FolderOpen,{className:"h-3.5 w-3.5"}),n("sidebar.right.browseRepo")]}),ev.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:ev.map(s=>(0,t.jsxs)("button",{onClick:()=>{s.id!==e.id&&eX(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)(i.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,t.jsx)(W.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)(L.Dialog,{open:N,onOpenChange:v,children:(0,t.jsxs)(L.DialogContent,{style:{maxWidth:"32rem"},children:[(0,t.jsx)(L.DialogHeader,{children:(0,t.jsx)(L.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)(d.Input,{value:R,onChange:e=>A(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)(ed.SegmentedControl,{options:[{value:"FRONTEND",label:n("project.type.frontend")},{value:"BACKEND",label:n("project.type.backend")}],value:eb,onChange:eN})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.alias")}),(0,t.jsx)(d.Input,{value:O,onChange:e=>J(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)(c.Button,{type:"button",variant:"ghost",onClick:eJ,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!eu||eO?"opacity-50":""}`,children:[eO?(0,t.jsx)(V.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(_.Sparkles,{className:"h-3 w-3"}),eO?n("project.analyzing"):n("project.genDesc")]})]}),(0,t.jsx)(q.Textarea,{value:Q,onChange:e=>ex(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:eu||"—"})]})]}),(0,t.jsxs)(L.DialogFooter,{children:[(0,t.jsx)(c.Button,{variant:"outline",onClick:()=>v(!1),children:n("common.cancel")}),(0,t.jsx)(c.Button,{onClick:eq,disabled:!R.trim()||eO,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:n("common.save")})]})]})}),(0,t.jsx)(ec.FolderBrowserDialog,{open:B,onOpenChange:F,onSelect:e=>{N?eh(e):(e=>{let t=ev.find(t=>t.localPath===e);if(t)return eX(t.workspaceId,t.id);let s=e.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean).pop()??"";eT(e),eP(s),eI(""),eL(""),ey(!0)})(e)}}),(0,t.jsx)(L.Dialog,{open:ew,onOpenChange:ey,children:(0,t.jsxs)(L.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(L.DialogHeader,{children:(0,t.jsx)(L.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:eC})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.name")}),(0,t.jsx)(d.Input,{value:eS,onChange:e=>eP(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)(ed.SegmentedControl,{options:[{value:"FRONTEND",label:n("project.type.frontend")},{value:"BACKEND",label:n("project.type.backend")}],value:eB,onChange:eF})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.alias")}),(0,t.jsx)(d.Input,{value:eE,onChange:e=>eI(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)(q.Textarea,{value:eD,onChange:e=>eL(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)(L.DialogFooter,{children:[(0,t.jsx)(c.Button,{variant:"outline",onClick:()=>ey(!1),children:n("common.cancel")}),(0,t.jsxs)(c.Button,{onClick:eY,disabled:!eS.trim()||eR,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[eR?(0,t.jsx)(V.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,n("common.create")]})]})]})}),(0,t.jsx)(L.Dialog,{open:k,onOpenChange:e=>{w(e),e||S("")},children:(0,t.jsxs)(L.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(L.DialogHeader,{children:(0,t.jsx)(L.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)(d.Input,{value:T,onChange:e=>S(e.target.value),placeholder:n("project.deleteConfirmPlaceholder"),className:"mt-1.5",autoFocus:!0})]})]}),(0,t.jsxs)(L.DialogFooter,{children:[(0,t.jsx)(c.Button,{variant:"outline",onClick:()=>w(!1),children:n("common.cancel")}),(0,t.jsxs)(c.Button,{variant:"destructive",disabled:T!==n("project.deleteConfirmText")||P,onClick:async()=>{E(!0);try{await et(e.id),eo.toast.success(n("project.deleteSuccess")),o.push(`/workspaces/${r}`)}catch{eo.toast.error(n("project.deleteFailed"))}finally{E(!1),w(!1)}},children:[P&&(0,t.jsx)(V.Loader2,{className:"h-3 w-3 animate-spin mr-1"}),n("project.deleteButton")]})]})]})})]})}var eb=e.i(475958),eN=e.i(313029),ev=e.i(882651),ek=e.i(259846),ew=e.i(975157);function ey({title:e,description:s,branch:a,baseBranch:r,version:n,hasConversation:l,updatedAt:o,openDir:d,onBack:m}){let{t:h}=(0,u.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)(_.Sparkles,{className:"h-3.5 w-3.5 text-primary"}),(0,t.jsx)("span",{className:"text-xs font-semibold text-primary",children:h("taskDetail.title")})]}),(0,t.jsxs)(c.Button,{variant:"ghost",onClick:m,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)(ek.ArrowLeft,{className:"h-3.5 w-3.5"}),h("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)(P.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:[(0,t.jsx)(i.GitBranch,{className:"mr-1 h-3 w-3"}),r," · worktree"]}):a?(0,t.jsx)(P.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:h("taskDetail.directMode")}):null,n&&(0,t.jsx)(I.TaskVersionTag,{number:n.number,name:n.name,showName:!0}),l&&(0,t.jsx)(P.Badge,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-400 text-[10px] border border-emerald-500/20",children:h("taskDetail.hasConversation")}),(0,t.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h("taskDetail.updatedAt")," ",(0,ew.formatRelativeTime)(o)]}),d&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-0.5",children:[(0,t.jsxs)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,er.openInFileManager)(d)}catch(e){console.error("openInFileManager failed:",e),eo.toast.error(h("git.openInFileManagerFailed"))}},children:(0,t.jsx)(K.FolderSearch,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(x.TooltipContent,{side:"bottom",children:h("git.openInFileManager")})]}),(0,t.jsxs)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,en.openInEditor)(d)}catch(e){console.error("openInEditor failed:",e),eo.toast.error(h("git.openInEditorFailed"))}},children:(0,t.jsx)(X.Code,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(x.TooltipContent,{side:"bottom",children:h("git.openInEditor")})]}),(0,t.jsxs)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,el.openInTerminal)(d)}catch(e){console.error("openInTerminal failed:",e),eo.toast.error(h("git.openInTerminalFailed"))}},children:(0,t.jsx)(Y.Terminal,{className:"h-3.5 w-3.5"})})}),(0,t.jsx)(x.TooltipContent,{side:"bottom",children:h("git.openInTerminal")})]})]})]})]})}var eC=e.i(14842),eT=e.i(865514),eS=e.i(83434),eP=e.i(838582),eE=e.i(698343),eI=e.i(257868),eD=e.i(681894),eL=e.i(502889),eB=e.i(352290),eF=e.i(207539),eR=e.i(382644),eA=e.i(292862),eO=e.i(326883),e$=e.i(631675),eM=e.i(297338),ez=e.i(657153),eU=e.i(867533),eW=e.i(979469),eG=e.i(570634),eH=e.i(44024),eV=e.i(527043),e_=e.i(981705),eK=e.i(715362),eX=e.i(235357),eY=e.i(144640),eJ=e.i(997025),eq=e.i(937304);let eQ=/\.(txt|md|json)$/i;function eZ({taskId:e,projectId:a}){let{t:r}=(0,u.useI18n)(),l=(0,s.useRef)(null),[i,o]=(0,s.useState)([]),[d,m]=(0,s.useState)([]),[x,h]=(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),[w,y]=(0,s.useState)(null);async function T(){p.trim()&&(await (0,eW.createNote)({title:p.trim(),content:f.trim(),projectId:a,taskId:e,category:"task"}),g(""),j(""),h(!1),(0,eG.getTaskNotes)(e).then(o))}async function S(e){await (0,eH.deleteNote)(e),o(t=>t.filter(t=>t.id!==e))}async function P(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,e_.uploadAsset)(t),(0,eV.getTaskAssets)(e).then(m)}finally{N(!1),l.current&&(l.current.value="")}}}async function E(e){await (0,eK.deleteAsset)(e),m(t=>t.filter(t=>t.id!==e))}function I(e){return(0,eq.isImageAsset)(e.filename,e.mimeType)||eQ.test(e.filename)}function D(e){I(e)?k(e):eo.toast.info(r("assets.previewNotSupported"))}async function L(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(()=>({}));eo.toast.error(e.error||"Failed to reveal file")}}catch{eo.toast.error("Failed to reveal file")}}(0,s.useEffect)(()=>{(0,eG.getTaskNotes)(e).then(o),(0,eV.getTaskAssets)(e).then(m)},[e]);let F=v?(0,eq.isImageAsset)(v.filename,v.mimeType)?"image":eQ.test(v.filename)?"text":null:null,R=d.filter(e=>(0,eq.isImageAsset)(e.filename,e.mimeType)).map(e=>({id:e.id,url:(0,eq.localPathToApiUrl)(e.path),filename:e.filename})),A=v?R.findIndex(e=>e.id===v.id):-1;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B.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)(U.FileText,{className:"h-3.5 w-3.5"}),r("taskPage.notes")]}),(0,t.jsxs)(c.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>h(!x),children:[x?(0,t.jsx)(ez.X,{className:"h-3 w-3"}):(0,t.jsx)(n.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)(c.Button,{className:"text-xs",onClick:T,disabled:!p.trim(),children:r("taskPage.addNote")})]}),(0,t.jsxs)("div",{className:"mt-2 space-y-2",children:[0===i.length&&!x&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:r("taskPage.noNotes")}),i.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)("button",{type:"button",onClick:()=>y(e),className:"min-w-0 flex-1 cursor-pointer text-left",title:r("taskPage.previewNote"),children:[(0,t.jsx)("h4",{className:"text-sm font-medium truncate hover:underline",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.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,t.jsx)(c.Button,{variant:"ghost",size:"icon-xs",onClick:()=>y(e),className:"text-muted-foreground hover:bg-accent",title:r("taskPage.previewNote"),children:(0,t.jsx)(eU.Eye,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(c.Button,{variant:"ghost",size:"icon-xs",onClick:()=>S(e.id),className:"text-muted-foreground hover:bg-destructive/10 hover:text-destructive",title:r("taskPage.deleteNote"),children:(0,t.jsx)(C.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)(eM.Paperclip,{className:"h-3.5 w-3.5"}),r("taskPage.attachments")]}),(0,t.jsxs)(c.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>l.current?.click(),disabled:b,children:[(0,t.jsx)(e$.Upload,{className:"h-3 w-3"}),r("taskPage.uploadFile")]}),(0,t.jsx)("input",{ref:l,type:"file",className:"hidden",onChange:P})]}),(0,t.jsxs)("div",{className:"mt-2 space-y-1.5",children:[0===d.length&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:r("taskPage.noAttachments")}),d.map(e=>{var s;let a=I(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)(eM.Paperclip,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,t.jsx)("button",{type:"button",onClick:()=>D(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)(c.Button,{variant:"ghost",size:"icon-xs",onClick:()=>D(e),className:"shrink-0 text-muted-foreground hover:bg-accent",title:r("assets.preview"),children:(0,t.jsx)(eU.Eye,{className:"h-3 w-3"})}),(0,t.jsx)(c.Button,{variant:"ghost",size:"icon-xs",onClick:()=>L(e),className:"shrink-0 text-muted-foreground hover:bg-accent",title:r("assets.revealInFinder"),children:(0,t.jsx)(W.FolderOpen,{className:"h-3 w-3"})}),(0,t.jsx)(c.Button,{variant:"ghost",size:"icon-xs",onClick:()=>E(e.id),className:"shrink-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",title:r("taskPage.deleteAttachment"),children:(0,t.jsx)(C.Trash2,{className:"h-3 w-3"})})]})]},e.id)})]})]})]})}),(0,t.jsx)(eX.ImageLightbox,{imageUrl:"image"===F&&A>=0?R[A].url:null,filename:"image"===F&&A>=0?R[A].filename:"",open:"image"===F,onOpenChange:e=>{e||k(null)},assets:R.map(({url:e,filename:t})=>({url:e,filename:t})),currentIndex:A>=0?A:void 0,onIndexChange:e=>{let t=R[e];if(!t)return;let s=d.find(e=>e.id===t.id);s&&k(s)}}),(0,t.jsx)(eY.TextPreviewDialog,{url:"text"===F&&v?(0,eq.localPathToApiUrl)(v.path):null,filename:v?.filename??"",open:"text"===F,onOpenChange:e=>{e||k(null)}}),(0,t.jsx)(eJ.NotePreviewDialog,{note:w,open:null!==w,onOpenChange:e=>{e||y(null)}})]})}function e0({task:e,workspaceId:r,projectLocalPath:n,onClose:l}){let{t:i}=(0,u.useI18n)(),o=(0,a.useRouter)(),{removePortal:d}=(0,eS.useTerminalPortal)(),[h,p]=(0,s.useState)("terminal"),[g,f]=(0,s.useState)(null),[j,b]=(0,s.useState)(!1),[N,v]=(0,s.useState)(e.status);(0,s.useEffect)(()=>{v(e.status)},[e.status]);let[k,w]=(0,s.useState)(null),[y,C]=(0,s.useState)(!1),[T,S]=(0,s.useState)(!1),[P,E]=(0,s.useState)([]);(0,s.useEffect)(()=>{w(null),C(!1),S(!1),E([]),f(null),p("terminal")},[e.id]);let[I,D]=(0,s.useState)([]),[L,F]=(0,s.useState)(null);(0,s.useEffect)(()=>{let e=!1;return(0,eA.getPrompts)().then(t=>{if(e)return;D(t.map(e=>({id:e.id,name:e.name,isDefault:e.isDefault})));let s=t.find(e=>e.isDefault);s&&F(s.id)}),()=>{e=!0}},[]),(0,s.useEffect)(()=>{w(null),S(!1);let t=!1;return(0,eP.getTaskExecutions)(e.id).then(e=>{if(t)return;let s=e[0];if(s?.status==="RUNNING"){let e=s.worktreePath||n||null;e&&w(e)}E(e.filter(e=>"RUNNING"!==e.status)),S(!0)}),()=>{t=!0}},[e.id]),(0,s.useEffect)(()=>{if("changes"!==h||"TODO"===N||"CANCELLED"===N)return;let t=!1;return b(!0),fetch(`/api/tasks/${e.id}/diff`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{t||f(e?.files||e?.branchDeleted?e:null)}).catch(()=>{t||f(null)}).finally(()=>{t||b(!1)}),()=>{t=!0}},[h,N,e.id]);let R=(0,s.useCallback)(async()=>{if(!y){C(!0),d(e.id);try{let t=await (0,eE.startPtyExecutionSafe)(e.id,"",L);if(!t.ok){C(!1),eo.toast.error(t.error||i("terminal.startFailed"));return}w(t.worktreePath??null),v("IN_PROGRESS")}catch(e){C(!1),eo.toast.error(e instanceof Error&&e.message?e.message:i("terminal.startFailed"))}}},[e.id,y,L,i]),A=(0,s.useCallback)(t=>{C(!1),w(null),d(e.id),0===t&&v("IN_REVIEW"),(0,eP.getTaskExecutions)(e.id).then(e=>{E(e.filter(e=>"RUNNING"!==e.status))}),o.refresh()},[o,e.id]),O=(0,s.useCallback)(async()=>{await (0,eI.stopPtyExecution)(e.id),C(!1),d(e.id),w(null),v("IN_REVIEW"),(0,eP.getTaskExecutions)(e.id).then(e=>{E(e.filter(e=>"RUNNING"!==e.status))}),o.refresh()},[e.id,o]),$=(0,s.useCallback)(async t=>{C(!0),d(e.id),w(null);try{let{worktreePath:s}=await (0,eD.resumePtyExecution)(e.id,t);w(s),v("IN_PROGRESS")}catch{C(!1)}},[e.id,d]),M=(0,s.useCallback)(async()=>{C(!0),d(e.id),w(null);try{let{worktreePath:t}=await (0,eL.continueLatestPtyExecution)(e.id);w(t),v("IN_PROGRESS")}catch(e){C(!1),eo.toast.error(e instanceof Error?e.message:String(e))}},[e.id,d]),[z,W]=(0,s.useState)(!1),[G,H]=(0,s.useState)([]),_=(0,s.useCallback)(async()=>{try{let t=await (0,eF.checkWorktreeClean)(e.id);if(t.hasWorktree&&!t.clean)return void eo.toast.error(i("taskPage.uncommittedChanges",{count:String(t.files.length)}));if(t.hasWorktree&&t.clean&&!t.hasCommits)return void eo.toast.error(i("taskPage.noChangesToComplete"),{action:{label:i("taskPage.markAsCancelled"),onClick:()=>{(0,eB.updateTaskStatus)(e.id,"CANCELLED").then(()=>{v("CANCELLED"),eo.toast.success(i("taskPage.taskCancelled")),o.refresh()}).catch(()=>eo.toast.error("Failed to cancel task"))}}});if(t.hasWorktree&&t.hasCommits){H(t.commitLog),W(!0);return}await (0,eB.updateTaskStatus)(e.id,"DONE"),v("DONE"),eo.toast.success(i("taskPage.taskCompleted")),o.refresh()}catch{eo.toast.error("Failed to complete task")}},[e.id,o,i]),K=(0,s.useCallback)(()=>{v("DONE"),W(!1),eo.toast.success(i("taskPage.taskCompleted")),o.refresh()},[o,i]),X=(0,s.useCallback)(async t=>{try{let{hash:s}=await (0,eR.commitWorktreeChanges)(e.id,t);eo.toast.success(i("diff.commitSuccess",{hash:s})),o.refresh();let a=await fetch(`/api/tasks/${e.id}/diff`);if(a.ok){let e=await a.json();f(e?.files?e:null)}}catch(e){eo.toast.error(e instanceof Error?e.message:"Commit failed")}},[e.id,o,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)(ey,{title:e.title,description:i("taskDetail.panelDescription"),branch:`task/${e.id}`,baseBranch:e.baseBranch,version:e.version??null,hasConversation:!1,updatedAt:e.updatedAt,openDir:k??(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:()=>p("terminal"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"terminal"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,t.jsx)(Y.Terminal,{className:"h-3 w-3"}),i("terminal.execute")]}),(0,t.jsx)("button",{onClick:()=>p("changes"),className:`px-3 py-1 text-xs font-medium rounded-md ${"changes"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:i("taskPage.changes")}),(0,t.jsxs)("button",{onClick:()=>p("notes"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"notes"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,t.jsx)(U.FileText,{className:"h-3 w-3"}),i("taskPage.notes")]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:["IN_REVIEW"===N&&(0,t.jsxs)(c.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)(ev.CheckCircle2,{className:"h-3 w-3"}),i("taskPage.completeTask")]}),"DONE"!==N&&"CANCELLED"!==N&&(0,t.jsxs)(c.Button,{variant:"ghost",size:"sm",onClick:()=>o.push(`/workspaces/${r}/tasks/${e.id}`),className:"text-muted-foreground",children:[(0,t.jsx)(eb.ExternalLink,{className:"h-3 w-3"}),i("taskPage.viewDetails")]})]})]}),"terminal"===h?(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:T?k?(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)(x.Tooltip,{children:[(0,t.jsxs)(x.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)(eN.Square,{className:"h-3 w-3"}),i("terminal.stopExecution")]}),(0,t.jsx)(x.TooltipContent,{side:"bottom",children:i("terminal.stopHint")})]})]}),(0,t.jsx)("div",{className:"flex-1 min-h-0",children:(0,t.jsx)(eS.TerminalOutlet,{taskId:e.id,worktreePath:k,onSessionEnd:A})})]}):"DONE"===N||"CANCELLED"===N?(0,t.jsx)("div",{className:"flex h-full flex-col overflow-hidden",children:(0,t.jsx)(B.ScrollArea,{className:"flex-1 min-h-0",children:(0,t.jsx)(eO.ExecutionTimeline,{executions:P})})}):(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)(m.Select,{defaultValue:L??"none",onValueChange:e=>F("none"===e?null:e),children:[(0,t.jsx)(m.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)(m.SelectContent,{className:"min-w-[200px]",children:[(0,t.jsx)(m.SelectItem,{value:"none",children:i("terminal.noPrompt")}),I.map(e=>(0,t.jsxs)(m.SelectItem,{value:e.id,children:[e.name,e.isDefault?" ★":""]},e.id))]})]},`prompt-${I.length}`),(0,t.jsxs)(c.Button,{onClick:R,disabled:y,size:"sm",className:"gap-2 px-4",children:[y?(0,t.jsx)(V.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(Y.Terminal,{className:"h-3.5 w-3.5"}),y?i("terminal.executing"):i("terminal.launch")]})]}),(0,t.jsx)(B.ScrollArea,{className:"flex-1 min-h-0",children:(0,t.jsx)(eO.ExecutionTimeline,{executions:P,onResume:$,onContinueLatest:M})})]}):(0,t.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-[#0f1419]",children:[(0,t.jsx)(V.Loader2,{className:"size-5 animate-spin text-neutral-500"}),(0,t.jsx)("span",{className:"text-xs text-neutral-500",children:i("execution.loading")})]})}):"changes"===h?(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:j?(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")})}):g?.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")})}):g?(0,t.jsx)(eC.TaskDiffView,{taskId:e.id,files:g.files,totalAdded:g.totalAdded,totalRemoved:g.totalRemoved,hasConflicts:g.hasConflicts,conflictFiles:g.conflictFiles,onCommit:X,hasUncommitted:g.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"===h?(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,t.jsx)(eZ,{taskId:e.id,projectId:e.projectId})}):null,(0,t.jsx)(eT.TaskMergeConfirmDialog,{open:z,onOpenChange:W,taskId:e.id,taskTitle:e.title,baseBranch:e.baseBranch??"main",fileCount:g?.files?.length??0,commitCount:g?.commitCount??0,commitLog:G,onMergeComplete:K})]})}var e1=e.i(323293),e5=e.i(111114);let e3=(0,Q.createServerReference)("40039292e6f13a93220735ef7737a5b7a36712cf05",Q.callServer,void 0,Q.findSourceMapURL,"deleteTask"),e2=(0,Q.createServerReference)("405ed7de6cb31552d1f1b993f720cead3c04731221",Q.callServer,void 0,Q.findSourceMapURL,"toggleTaskPinned");var e4=e.i(751819);let e8=(0,Q.createServerReference)("40ba368a4474ca9b032e17613ca34770c7bc685a69",Q.callServer,void 0,Q.findSourceMapURL,"getVersionsForPicker");var e7=e.i(889620),e6=e.i(19671);function e9({project:e,isActive:r,workspaceId:n,onSelect:l}){let{t:i}=(0,u.useI18n)(),o=(0,a.useRouter)(),d=e.totalTasks,m=e.runningTasks,h=d>0?Math.round(m/d*100):0,[p,g]=(0,s.useState)(!1),[f,j]=(0,s.useState)(!1),b=async()=>{j(!0);try{let t=await ea(e.id);o.push(`/workspaces/${n}/tasks/${t}`)}catch{eo.toast.error(i("git.openStudioFailed"))}finally{j(!1)}},N=(0,t.jsxs)("button",{onClick:()=>{r||l(e.id)},className:`group flex w-[212px] shrink-0 items-center gap-2 rounded-lg border-b-2 px-3 py-1.5 text-left transition-colors ${r?"border-primary bg-primary/10 ring-1 ring-primary/20 cursor-default":`border-transparent cursor-pointer ${p?"bg-accent":"hover:bg-accent"}`}`,children:[(0,t.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,t.jsx)("span",{className:`w-full truncate text-sm font-medium leading-tight ${r?"text-primary":p?"text-foreground":"text-muted-foreground group-hover:text-foreground"}`,children:e.name}),e.alias&&(0,t.jsx)("span",{className:"w-full truncate text-[11px] font-normal leading-tight text-muted-foreground/70",children:e.alias})]}),(0,t.jsxs)("span",{className:"flex shrink-0 items-baseline rounded-md border border-border bg-card px-1.5 py-0.5 font-mono text-[11px] font-semibold leading-none",children:[(0,t.jsx)("span",{className:"text-amber-500 dark:text-amber-400",children:m}),(0,t.jsx)("span",{className:"mx-px text-muted-foreground/50",children:"/"}),(0,t.jsx)("span",{className:"text-muted-foreground",children:d})]})]});return(0,t.jsxs)(x.Tooltip,{onOpenChange:g,children:[(0,t.jsx)(x.TooltipTrigger,{render:N}),(0,t.jsxs)(x.TooltipContent,{side:"bottom",hideArrow:!0,className:"flex w-[268px] max-w-none flex-col items-stretch gap-0 rounded-xl border border-border bg-card p-3.5 text-foreground shadow-lg",children:[(0,t.jsx)("div",{className:"text-[13px] font-bold leading-snug break-words",children:e.name}),e.alias&&(0,t.jsx)("div",{className:"mt-0.5 text-[11.5px] leading-relaxed text-muted-foreground break-words",children:e.alias}),(0,t.jsx)("div",{className:"my-2.5 h-px bg-border"}),(0,t.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,t.jsx)("span",{className:"size-2 shrink-0 rounded-full bg-amber-500 dark:bg-amber-400"}),(0,t.jsx)("span",{className:"text-[13px] font-semibold",children:i("board.running")}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:i("board.runningDesc")}),(0,t.jsx)("span",{className:"ml-auto font-mono text-[15px] font-bold text-amber-500 dark:text-amber-400",children:m})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"size-2 shrink-0 rounded-full bg-sky-500 dark:bg-sky-400"}),(0,t.jsx)("span",{className:"text-[13px] font-semibold",children:i("board.overview")}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:i("board.totalDesc")}),(0,t.jsx)("span",{className:"ml-auto font-mono text-[15px] font-bold",children:d})]}),(0,t.jsx)("div",{className:"mt-2.5 h-[5px] overflow-hidden rounded-full bg-sky-500/15 dark:bg-sky-400/15",children:(0,t.jsx)("div",{className:"h-full rounded-full bg-amber-500 dark:bg-amber-400",style:{width:`${h}%`}})}),(0,t.jsxs)("div",{className:"mt-2.5 flex items-center justify-between gap-2",children:[(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:i("board.badgeFormatHint")}),(0,t.jsxs)(c.Button,{variant:"outline",disabled:f,onClick:b,className:"h-6 shrink-0 gap-1 px-2 text-[11px]",children:[f?(0,t.jsx)(V.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(W.FolderOpen,{className:"h-3 w-3"}),i("git.openStudio")]})]})]})]})}function te({projects:e,activeProjectId:a,workspaceId:r,onSelect:n}){let l=(0,s.useRef)(null),[i,o]=(0,s.useState)(!1),[c,d]=(0,s.useState)(!1),m=()=>{let e=l.current;e&&(o(e.scrollLeft>0),d(e.scrollLeft<e.scrollWidth-e.clientWidth-1))};(0,s.useEffect)(()=>{m();let e=l.current;if(e){e.addEventListener("scroll",m);let t=new ResizeObserver(m);return t.observe(e),()=>{e.removeEventListener("scroll",m),t.disconnect()}}},[e]);let x=e=>{let t=l.current;t&&t.scrollBy({left:"left"===e?-150:150,behavior:"smooth"})};return(0,t.jsxs)("div",{className:"relative flex items-center",children:[i&&(0,t.jsx)("button",{onClick:()=>x("left"),className:"absolute left-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,t.jsx)(e6.ChevronLeft,{className:"h-4 w-4"})}),(0,t.jsx)("div",{ref:l,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=>(0,t.jsx)(e9,{project:e,isActive:a===e.id,workspaceId:r,onSelect:n},e.id))}),c&&(0,t.jsx)("button",{onClick:()=>x("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)(z.ChevronRight,{className:"h-4 w-4"})})]})}var tt=e.i(759686);function ts({open:e,onOpenChange:s,taskTitle:a,uncommittedFiles:r,commitLog:n,onConfirm:l}){let{t:i}=(0,u.useI18n)(),o=r.length,d=n.length,m=0===o&&0===d;return(0,t.jsx)(L.Dialog,{open:e,onOpenChange:s,children:(0,t.jsxs)(L.DialogContent,{showCloseButton:!0,className:"sm:max-w-md",children:[(0,t.jsx)(L.DialogHeader,{children:(0,t.jsxs)(L.DialogTitle,{className:"flex items-center gap-2",children:[(0,t.jsx)(tt.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:o})]}),(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})]})]}),o>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)(L.DialogFooter,{children:[(0,t.jsx)(c.Button,{variant:"outline",onClick:()=>s(!1),children:i("taskCancel.keep")}),(0,t.jsxs)(c.Button,{variant:"destructive",onClick:l,className:"gap-2",children:[(0,t.jsx)(tt.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:o,openTaskId:c}){let d=(0,a.useRouter)(),{t:m}=(0,u.useI18n)(),[,x]=(0,s.useTransition)(),[p,g]=(0,s.useState)(""),[j,b]=(0,s.useState)("all"),[N,v]=(0,s.useState)(!1),[k,w]=(0,s.useState)("TODO"),[y,C]=(0,s.useState)(c??null),[T,S]=(0,s.useState)([]),P=y?i.find(e=>e.id===y)??null:null,[E,I]=(0,s.useState)(null),[D,L]=(0,s.useState)(null),[B,F]=(0,s.useState)(null);(0,s.useEffect)(()=>{e8(r).then(S).catch(()=>S([]))},[r]),(0,s.useEffect)(()=>{(0,e7.setLastProjectId)(e,r)},[e,r]);let R=T.find(e=>e.isCurrent)?.id??null,$=(0,s.useCallback)(()=>{x(()=>{d.refresh()})},[d]);(0,s.useEffect)(()=>{if(N)return;let e=setInterval(()=>{x(()=>{d.refresh()})},5e3);return()=>clearInterval(e)},[d,N]);let M=(0,s.useCallback)(e=>{g(e)},[]),z=(0,s.useCallback)(async e=>{let t=i.find(t=>t.id===e);if(t)try{let s=await (0,eF.checkWorktreeClean)(e);if(s.hasWorktree&&!s.clean){eo.toast.error(m("taskPage.uncommittedChanges",{count:String(s.files.length)})),$();return}if(s.hasWorktree&&s.clean&&!s.hasCommits){eo.toast.error(m("taskPage.noChangesToComplete"),{action:{label:m("taskPage.markAsCancelled"),onClick:()=>{(0,eB.updateTaskStatus)(e,"CANCELLED").then(()=>{eo.toast.success(m("taskPage.taskCancelled")),$()}).catch(()=>eo.toast.error("Failed to cancel task"))}}}),$();return}if(s.hasWorktree&&s.hasCommits){L({task:t,commitLog:s.commitLog,commitCount:s.commitLog.length}),$();return}await (0,eB.updateTaskStatus)(e,"DONE"),eo.toast.success(m("taskPage.taskCompleted")),$()}catch{eo.toast.error("Failed to complete task"),$()}},[i,$,m]),U=(0,s.useCallback)(async e=>{let t=i.find(t=>t.id===e);if(t)try{let s=await (0,eF.checkWorktreeClean)(e);if(!s.hasWorktree){await (0,eB.updateTaskStatus)(e,"CANCELLED"),eo.toast.success(m("taskPage.taskCancelled")),$();return}F({task:t,files:s.files,commitLog:s.commitLog}),$()}catch{eo.toast.error("Failed to cancel task"),$()}},[i,$,m]),W=(0,s.useCallback)(async(e,t)=>{"DONE"===t?await z(e):"CANCELLED"===t?await U(e):(await (0,eB.updateTaskStatus)(e,t),$())},[$,z,U]),G=(0,s.useCallback)(async e=>{let t=await (0,e1.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,e4.startPtyExecution)(t.id,""),C(t.id)}catch(e){eo.toast.error(e instanceof Error?e.message:String(e))}$()},[r,$]),H=(0,s.useCallback)(async(e,t)=>{await (0,e5.updateTask)(e,{...t,labelIds:t.labelIds}),I(null),$()},[$]),V=(0,s.useCallback)(async e=>{await e3(e),y===e&&C(null),$()},[$,y]),_=(0,s.useCallback)(async e=>{await e2(e),$()},[$]),K=(0,s.useCallback)(async t=>{try{await (0,e4.startPtyExecution)(t,"")}catch(e){eo.toast.error(e instanceof Error?e.message:String(e))}d.push(`/workspaces/${e}/tasks/${t}`)},[d,e]),X=(0,s.useCallback)(async(e,t)=>{"DONE"===t?await z(e):"CANCELLED"===t?await U(e):(await (0,eB.updateTaskStatus)(e,t),$())},[$,z,U]),Y=(0,s.useCallback)(e=>{w(e),I(null),v(!0)},[]),J=(0,s.useCallback)(e=>{I(e),v(!0)},[]),q=i.filter(e=>!e.labels?.some(e=>e.label.name===f.TOWER_LABEL_NAME&&e.label.isBuiltin)).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)(te,{projects:l,activeProjectId:r,workspaceId:e,onSelect:t=>d.push(`/workspaces/${e}?projectId=${t}`,{scroll:!1})})}),(0,t.jsx)(h,{searchQuery:p,onSearchChange:M,versions:T,versionFilter:j,onVersionFilterChange:b,versionsHref:`/workspaces/${e}/projects/${r}/versions`,onCreateTask:()=>{I(null),v(!0)}}),(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:(0,t.jsx)(A,{initialTasks:q,onTaskMove:W,onTaskClick:e=>{C(e.id)},onEditTask:J,onAddTask:Y,onDeleteTask:V,onTogglePin:_,workspaceId:e,onContextMenuStatusChange:X,onContextMenuLaunch:K})}),(0,t.jsx)(O.CreateTaskDialog,{open:N,onOpenChange:e=>{v(e),e||I(null)},onSubmit:G,onUpdate:H,defaultStatus:k,editTask:E,editTaskLabelIds:E?.labels?E.labels.map(e=>e.labelId):[],labels:o.filter(e=>!(e.name===f.TOWER_LABEL_NAME&&e.isBuiltin)),projectType:n.type,projectLocalPath:n.localPath,versions:T,defaultVersionId:R})]}),P?(0,t.jsx)(e0,{task:P,workspaceId:e,projectLocalPath:n.localPath,onClose:()=>C(null)}):(0,t.jsx)(ej,{project:n,workspaceId:e}),D&&(0,t.jsx)(eT.TaskMergeConfirmDialog,{open:!0,onOpenChange:e=>{e||L(null)},taskId:D.task.id,taskTitle:D.task.title,baseBranch:D.task.baseBranch??"main",fileCount:0,commitCount:D.commitCount,commitLog:D.commitLog,onMergeComplete:()=>{L(null),eo.toast.success(m("taskPage.taskCompleted")),$()}}),B&&(0,t.jsx)(ts,{open:!0,onOpenChange:e=>{e||F(null)},taskTitle:B.task.title,uncommittedFiles:B.files,commitLog:B.commitLog,onConfirm:()=>{let e=B.task.id;F(null),(0,eB.updateTaskStatus)(e,"CANCELLED").then(()=>{eo.toast.success(m("taskPage.taskCancelled")),$()}).catch(()=>eo.toast.error("Failed to cancel task"))}})]})}],783426)}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,565893,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={assign:function(){return l},searchParamsToUrlQuery:function(){return a},urlQueryToSearchParams:function(){return o}};for(var s in n)Object.defineProperty(r,s,{enumerable:!0,get:n[s]});function a(e){let t={};for(let[r,n]of e.entries()){let e=t[r];void 0===e?t[r]=n:Array.isArray(e)?e.push(n):t[r]=[e,n]}return t}function i(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function o(e){let t=new URLSearchParams;for(let[r,n]of Object.entries(e))if(Array.isArray(n))for(let e of n)t.append(r,i(e));else t.set(r,i(n));return t}function l(e,...t){for(let r of t){for(let t of r.keys())e.delete(t);for(let[t,n]of r.entries())e.append(t,n)}return e}},204575,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={DecodeError:function(){return y},MiddlewareNotFoundError:function(){return k},MissingStaticPage:function(){return x},NormalizeError:function(){return b},PageNotFoundError:function(){return v},SP:function(){return m},ST:function(){return g},WEB_VITALS:function(){return a},execOnce:function(){return i},getDisplayName:function(){return d},getLocationOrigin:function(){return c},getURL:function(){return u},isAbsoluteUrl:function(){return l},isResSent:function(){return f},loadGetInitialProps:function(){return p},normalizeRepeatedSlashes:function(){return h},stringifyError:function(){return w}};for(var s in n)Object.defineProperty(r,s,{enumerable:!0,get:n[s]});let a=["CLS","FCP","FID","INP","LCP","TTFB"];function i(e){let t,r=!1;return(...n)=>(r||(r=!0,t=e(...n)),t)}let o=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,l=e=>o.test(e);function c(){let{protocol:e,hostname:t,port:r}=window.location;return`${e}//${t}${r?":"+r:""}`}function u(){let{href:e}=window.location,t=c();return e.substring(t.length)}function d(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function f(e){return e.finished||e.headersSent}function h(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function p(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await p(t.Component,t.ctx)}:{};let n=await e.getInitialProps(t);if(r&&f(r))return n;if(!n)throw Object.defineProperty(Error(`"${d(e)}.getInitialProps()" should resolve to an object. But found "${n}" instead.`),"__NEXT_ERROR_CODE",{value:"E1025",enumerable:!1,configurable:!0});return n}let m="u">typeof performance,g=m&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class y extends Error{}class b extends Error{}class v extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class x extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class k extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function w(e){return JSON.stringify({message:e.message,stack:e.stack})}},619172,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"warnOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},358754,e=>{"use strict";var t=e.i(514798);let r=(0,t.createServerReference)("40678a2b403c111cdd409176df5bba928e0f63a5b4",t.callServer,void 0,t.findSourceMapURL,"getLabelsForWorkspace");e.s(["getLabelsForWorkspace",0,r])},821957,e=>{"use strict";var t=e.i(965652),r=(e,t,r,n,s,a,i,o)=>{let l=document.documentElement,c=["light","dark"];function u(t){var r;(Array.isArray(e)?e:[e]).forEach(e=>{let r="class"===e,n=r&&a?s.map(e=>a[e]||e):s;r?(l.classList.remove(...n),l.classList.add(a&&a[t]?a[t]:t)):l.setAttribute(e,t)}),r=t,o&&c.includes(r)&&(l.style.colorScheme=r)}if(n)u(n);else try{let e=localStorage.getItem(t)||r,n=i&&"system"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e;u(n)}catch(e){}},n=["light","dark"],s="(prefers-color-scheme: dark)",a="u"<typeof window,i=t.createContext(void 0),o={setTheme:e=>{},themes:[]},l=["light","dark"],c=({forcedTheme:e,disableTransitionOnChange:r=!1,enableSystem:a=!0,enableColorScheme:o=!0,storageKey:c="theme",themes:p=l,defaultTheme:m=a?"system":"light",attribute:g="data-theme",value:y,children:b,nonce:v,scriptProps:x})=>{let[k,w]=t.useState(()=>d(c,m)),[S,j]=t.useState(()=>"system"===k?h():k),C=y?Object.values(y):p,M=t.useCallback(e=>{let t=e;if(!t)return;"system"===e&&a&&(t=h());let s=y?y[t]:t,i=r?f(v):null,l=document.documentElement,c=e=>{"class"===e?(l.classList.remove(...C),s&&l.classList.add(s)):e.startsWith("data-")&&(s?l.setAttribute(e,s):l.removeAttribute(e))};if(Array.isArray(g)?g.forEach(c):c(g),o){let e=n.includes(m)?m:null,r=n.includes(t)?t:e;l.style.colorScheme=r}null==i||i()},[v]),E=t.useCallback(e=>{let t="function"==typeof e?e(k):e;w(t);try{localStorage.setItem(c,t)}catch(e){}},[k]),A=t.useCallback(t=>{j(h(t)),"system"===k&&a&&!e&&M("system")},[k,e]);t.useEffect(()=>{let e=window.matchMedia(s);return e.addListener(A),A(e),()=>e.removeListener(A)},[A]),t.useEffect(()=>{let e=e=>{e.key===c&&(e.newValue?w(e.newValue):E(m))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[E]),t.useEffect(()=>{M(null!=e?e:k)},[e,k]);let N=t.useMemo(()=>({theme:k,setTheme:E,forcedTheme:e,resolvedTheme:"system"===k?S:k,themes:a?[...p,"system"]:p,systemTheme:a?S:void 0}),[k,E,e,S,a,p]);return t.createElement(i.Provider,{value:N},t.createElement(u,{forcedTheme:e,storageKey:c,attribute:g,enableSystem:a,enableColorScheme:o,defaultTheme:m,value:y,themes:p,nonce:v,scriptProps:x}),b)},u=t.memo(({forcedTheme:e,storageKey:n,attribute:s,enableSystem:a,enableColorScheme:i,defaultTheme:o,value:l,themes:c,nonce:u,scriptProps:d})=>{let f=JSON.stringify([s,n,o,e,c,l,a,i]).slice(1,-1);return t.createElement("script",{...d,suppressHydrationWarning:!0,nonce:"u"<typeof window?u:"",dangerouslySetInnerHTML:{__html:`(${r.toString()})(${f})`}})}),d=(e,t)=>{let r;if(!a){try{r=localStorage.getItem(e)||void 0}catch(e){}return r||t}},f=e=>{let t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},h=e=>(e||(e=window.matchMedia(s)),e.matches?"dark":"light");e.s(["ThemeProvider",0,e=>t.useContext(i)?t.createElement(t.Fragment,null,e.children):t.createElement(c,{...e}),"useTheme",0,()=>{var e;return null!=(e=t.useContext(i))?e:o}])},218526,e=>{"use strict";var t=e.i(514798);let r=(0,t.createServerReference)("008ca26582a6bc86f8a81485dafd39264601108780",t.callServer,void 0,t.findSourceMapURL,"getActualWsPort");e.s(["getActualWsPort",0,r])},311687,e=>{"use strict";var t=e.i(514798);let r=(0,t.createServerReference)("4004282668f38cbee8857d302368731b5ab318a755",t.callServer,void 0,t.findSourceMapURL,"installExtension");e.s(["installExtension",0,r])},812983,e=>{"use strict";let t=(0,e.i(572989).default)("file-code",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]);e.s(["FileCode",0,t],812983)},887911,e=>{"use strict";var t=e.i(738690),r=e.i(812983);let n={rg:{id:"rg",name:"代码搜索 (ripgrep)",description:"基于 rg 的全文代码搜索",icon:t.Search,sizeMB:5,homepageUrl:"https://github.com/BurntSushi/ripgrep#installation",manualInstall:!0},monaco:{id:"monaco",name:"代码编辑器 (Monaco)",description:"VS Code 同款 Web 编辑器",icon:r.FileCode,sizeMB:15,homepageUrl:"https://microsoft.github.io/monaco-editor/"}},s=[n.rg,n.monaco];e.s(["listExtensionMetadata",0,function(){return s}])},689401,e=>{"use strict";var t=e.i(965652),r=e.i(804849),n=e.i(207516);e.s(["useAriaLabelledBy",0,function(e,s,a,i=!0,o){let[l,c]=t.useState(),u=(0,n.useBaseUiId)(o?`${o}-label`:void 0),d=e??s??l;return(0,r.useIsoLayoutEffect)(()=>{let t=e||s||!i?void 0:function(e,t){let r=function(e){if(!e)return;let t=e.parentElement;if(t&&"LABEL"===t.tagName)return t;let r=e.id;if(r){let t=e.nextElementSibling;if(t&&t.htmlFor===r)return t}let n=e.labels;return n&&n[0]}(e);if(r)return!r.id&&t&&(r.id=t),r.id||void 0}(a.current,u);l!==t&&c(t)}),d}])},863255,e=>{"use strict";var t=e.i(514798);let r=(0,t.createServerReference)("603ff195358b719fe71041bada759b1541862c7e83",t.callServer,void 0,t.findSourceMapURL,"setConfigValue");e.s(["setConfigValue",0,r])},387091,15299,769757,e=>{"use strict";var t=e.i(572989);let r=(0,t.default)("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);e.s(["Sun",0,r],387091);let n=(0,t.default)("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]);e.s(["Moon",0,n],15299);let s=(0,t.default)("languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);e.s(["Languages",0,s],769757)},938499,e=>{"use strict";let t=(0,e.i(572989).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["AlertCircle",0,t],938499)},651236,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"BailoutToCSR",{enumerable:!0,get:function(){return s}});let n=e.r(415440);function s({reason:e,children:t}){if("u"<typeof window)throw Object.defineProperty(new n.BailoutToCSRError(e),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return t}},37982,(e,t,r)=>{"use strict";function n(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"encodeURIPath",{enumerable:!0,get:function(){return n}})},607717,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"PreloadChunks",{enumerable:!0,get:function(){return l}});let n=e.r(289721),s=e.r(585012),a=e.r(465687),i=e.r(37982),o=e.r(695597);function l({moduleIds:e}){if("u">typeof window)return null;let t=a.workAsyncStorage.getStore();if(void 0===t)return null;let r=[];if(t.reactLoadableManifest&&e){let n=t.reactLoadableManifest;for(let t of e){if(!n[t])continue;let e=n[t].files;r.push(...e)}}if(0===r.length)return null;let c=(0,o.getAssetTokenQuery)();return(0,n.jsx)(n.Fragment,{children:r.map(e=>{let r=`${t.assetPrefix}/_next/${(0,i.encodeURIPath)(e)}${c}`;return e.endsWith(".css")?(0,n.jsx)("link",{precedence:"dynamic",href:r,rel:"stylesheet",as:"style",nonce:t.nonce},e):((0,s.preload)(r,{as:"script",fetchPriority:"low",nonce:t.nonce}),null)})})}},105931,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return c}});let n=e.r(289721),s=e.r(965652),a=e.r(651236),i=e.r(607717);function o(e){return{default:e&&"default"in e?e.default:e}}let l={loader:()=>Promise.resolve(o(()=>null)),loading:null,ssr:!0},c=function(e){let t={...l,...e},r=(0,s.lazy)(()=>t.loader().then(o)),c=t.loading;function u(e){let o=c?(0,n.jsx)(c,{isLoading:!0,pastDelay:!0,error:null}):null,l=!t.ssr||!!t.loading,u=l?s.Suspense:s.Fragment,d=t.ssr?(0,n.jsxs)(n.Fragment,{children:["u"<typeof window?(0,n.jsx)(i.PreloadChunks,{moduleIds:t.modules}):null,(0,n.jsx)(r,{...e})]}):(0,n.jsx)(a.BailoutToCSR,{reason:"next/dynamic",children:(0,n.jsx)(r,{...e})});return(0,n.jsx)(u,{...l?{fallback:o}:{},children:d})}return u.displayName="LoadableComponent",u}},19578,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return s}});let n=e.r(481258)._(e.r(105931));function s(e,t){let r={};"function"==typeof e&&(r.loader=e);let s={...r,...t};return(0,n.default)({...s,modules:s.loadableGenerated?.modules})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},232280,e=>{"use strict";var t=e.i(314338);e.s(["ChevronDown",()=>t.default])},966001,e=>{"use strict";var t=e.i(289721),r=e.i(965652),n=e.i(938499),s=e.i(194358),a=e.i(519455);class i extends r.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error("[ErrorBoundary]",e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 p-8 text-center",children:[(0,t.jsx)(n.AlertCircle,{className:"h-8 w-8 text-destructive"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Something went wrong"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:this.state.error?.message??"An unexpected error occurred"})]}),(0,t.jsxs)(a.Button,{variant:"outline",onClick:()=>this.setState({hasError:!1,error:null}),children:[(0,t.jsx)(s.RefreshCw,{className:"mr-2 h-3.5 w-3.5"}),"Retry"]})]}):this.props.children}}e.s(["ErrorBoundary",0,i])},699375,e=>{"use strict";var t,r=e.i(289721);e.s([],159880),e.i(159880),e.i(708878);var n=e.i(965652),s=e.i(314757),a=e.i(887642),i=e.i(362891),o=e.i(804849),l=e.i(416369),c=e.i(954588),u=e.i(581263),d=e.i(565455),f=e.i(207516),h=e.i(282109),p=e.i(462902);let m=n.createContext(void 0);var g=e.i(551974);let y=((t={}).checked="data-checked",t.unchecked="data-unchecked",t.disabled="data-disabled",t.readonly="data-readonly",t.required="data-required",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.filled="data-filled",t.focused="data-focused",t),b={...g.fieldValidityMapping,checked:e=>e?{[y.checked]:""}:{[y.unchecked]:""}};var v=e.i(421689),x=e.i(890514),k=e.i(571870),w=e.i(179279),S=e.i(689401),j=e.i(103353),C=e.i(67077),M=e.i(586622),E=e.i(353052);let A=n.forwardRef(function(e,t){let{checked:p,className:g,defaultChecked:y,"aria-labelledby":A,id:N,inputRef:P,name:I,nativeButton:T=!1,onCheckedChange:R,readOnly:K=!1,required:O=!1,disabled:L=!1,render:z,uncheckedValue:F,value:$,...D}=e,{clearErrors:_}=(0,k.useFormContext)(),{state:U,setTouched:B,setDirty:H,validityData:V,setFilled:J,setFocused:q,shouldValidateOnChange:W,validationMode:G,disabled:Z,name:X,validation:Q}=(0,x.useFieldRootContext)(),{labelId:Y}=(0,w.useLabelableContext)(),ee=Z||L,et=X??I,er=(0,a.useStableCallback)(R),en=n.useRef(null),es=(0,i.useMergedRefs)(en,P,Q.inputRef),ea=n.useRef(null),ei=(0,f.useBaseUiId)(),eo=(0,j.useLabelableId)({id:N,implicit:!1,controlRef:ea}),el=T?void 0:eo,[ec,eu]=(0,s.useControlled)({controlled:p,default:!!y,name:"Switch",state:"checked"});(0,v.useField)({id:ei,commit:Q.commit,value:ec,controlRef:ea,name:et,getValue:()=>ec}),(0,o.useIsoLayoutEffect)(()=>{en.current&&J(en.current.checked)},[en,J]),(0,E.useValueChanged)(ec,()=>{_(et),H(ec!==V.initialValue),J(ec),W()?Q.commit(ec):Q.commit(ec,!0)});let{getButtonProps:ed,buttonRef:ef}=(0,h.useButton)({disabled:ee,native:T}),eh=(0,S.useAriaLabelledBy)(A,Y,en,!T,el),ep=n.useMemo(()=>(0,d.mergeProps)({checked:ec,disabled:ee,id:el,name:et,required:O,style:et?l.visuallyHiddenInput:l.visuallyHidden,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:es,onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.checked,r=(0,C.createChangeEventDetails)(M.REASONS.none,e.nativeEvent);er?.(t,r),r.isCanceled||eu(t)},onFocus(){ea.current?.focus()}},Q.getInputValidationProps,void 0!==$?{value:$}:c.EMPTY_OBJECT),[ec,ee,es,el,et,er,O,eu,Q,$]),em=n.useMemo(()=>({...U,checked:ec,disabled:ee,readOnly:K,required:O}),[U,ec,ee,K,O]),eg=(0,u.useRenderElement)("span",e,{state:em,ref:[t,ea,ef],props:[{id:T?eo:ei,role:"switch","aria-checked":ec,"aria-readonly":K||void 0,"aria-required":O||void 0,"aria-labelledby":eh,onFocus(){ee||q(!0)},onBlur(){let e=en.current;e&&!ee&&(B(!0),q(!1),"onBlur"===G&&Q.commit(e.checked))},onClick(e){K||ee||(e.preventDefault(),en.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},Q.getValidationProps,D,ed],stateAttributesMapping:b});return(0,r.jsxs)(m.Provider,{value:em,children:[eg,!ec&&et&&void 0!==F&&(0,r.jsx)("input",{type:"hidden",name:et,value:F}),(0,r.jsx)("input",{...ep})]})}),N=n.forwardRef(function(e,t){let{render:r,className:s,...a}=e,{state:i}=(0,x.useFieldRootContext)(),o=function(){let e=n.useContext(m);if(void 0===e)throw Error((0,p.default)(63));return e}(),l={...i,...o};return(0,u.useRenderElement)("span",e,{state:l,ref:t,stateAttributesMapping:b,props:a})});e.s(["Root",0,A,"Thumb",0,N],803205);var P=e.i(803205),P=P,I=e.i(975157);e.s(["Switch",0,function({className:e,size:t="default",...n}){return(0,r.jsx)(P.Root,{"data-slot":"switch","data-size":t,className:(0,I.cn)("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...n,children:(0,r.jsx)(P.Thumb,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}],699375)},464249,e=>{"use strict";let t=(0,e.i(572989).default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);e.s(["Pencil",0,t],464249)},889620,e=>{"use strict";let t="workspace-last-project";function r(){try{let e=localStorage.getItem(t);if(!e)return{};let r=JSON.parse(e);return r&&"object"==typeof r?r:{}}catch{return{}}}e.s(["getLastProjectId",0,function(e){return r()[e]??null},"setLastProjectId",0,function(e,n){try{let s=r();if(s[e]===n)return;localStorage.setItem(t,JSON.stringify({...s,[e]:n}))}catch{}}])},263938,e=>{"use strict";let t=(0,e.i(572989).default)("tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);e.s(["Tag",0,t],263938)},989548,338187,e=>{"use strict";let t=(0,e.i(572989).default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);e.s(["Bot",0,t],989548);var r=e.i(289721),n=e.i(965652);e.i(508271);var s=e.i(841359),a=e.i(127723);let i="tower-assistant-sessions",o="tower-assistant-active-session";function l(){try{let e=localStorage.getItem(i);if(!e)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];return t}catch{return[]}}function c(){return localStorage.getItem(o)}function u(e){null===e?localStorage.removeItem(o):localStorage.setItem(o,e)}let d=(0,n.createContext)(null);function f(){return"u">typeof crypto&&crypto.randomUUID?crypto.randomUUID():`msg-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}let h="assistant-attachment-cache";function p(e,t,r){try{let n=sessionStorage.getItem(h),s=n?JSON.parse(n):{};s[e]||(s[e]={}),s[e][t]=r,sessionStorage.setItem(h,JSON.stringify(s))}catch{}}e.s(["AssistantProvider",0,function({children:e}){let[t,o]=(0,n.useState)(!1),[m,g]=(0,n.useState)(!1),[y,b]=(0,n.useState)(0),[v,x]=(0,n.useState)("sidebar"),[k,w]=(0,n.useState)(null),[S,j]=(0,n.useState)([]),[C,M]=(0,n.useState)("idle"),[E,A]=(0,n.useState)(!1),N=(0,n.useRef)([]),P=(0,n.useRef)(null),I=(0,n.useRef)(null),[T,R]=(0,n.useState)([]),[K,O]=(0,n.useState)(null),L=(0,n.useRef)(!1),z=(0,n.useCallback)(()=>{j([...N.current])},[]),F=(0,n.useCallback)(async()=>{x("dialog"===await (0,a.getConfigValue)("assistant.displayMode","sidebar")?"dialog":"sidebar")},[]);(0,n.useEffect)(()=>{F()},[F]);let $=(0,n.useCallback)(async()=>{let e=l();try{let t=await fetch("/api/internal/assistant/sessions");if(t.ok){let r=await t.json();if(Array.isArray(r.sessions)){let t=new Map(e.map(e=>[e.id,e.title])),n=r.sessions.map(e=>{let r=t.get(e.id);return r?{...e,title:r}:e});return R(n),n}}}catch{}return R(e),e},[]),D=(0,n.useCallback)(async e=>{A(!0);try{let t=await fetch(`/api/internal/assistant/sessions?sessionId=${encodeURIComponent(e)}`);if(!t.ok)return;let r=await t.json();if(Array.isArray(r.messages)){N.current=r.messages;let t=function(e){try{let t=sessionStorage.getItem(h);if(!t)return{};return JSON.parse(t)[e]??{}}catch{return{}}}(e);if(Object.keys(t).length>0){let e=0;N.current=N.current.map(r=>{if("user"===r.role){let n=t[e];if(e++,n?.length)return{...r,attachmentFilenames:n}}return r})}j([...N.current])}}catch{}finally{A(!1)}},[]);(0,n.useEffect)(()=>{let e=!1;return(async()=>{let t=await $();if(e)return;let r=c(),n=r&&t.some(e=>e.id===r)?r:t[0]?.id??null;n&&(O(n),P.current=n,L.current=!0,u(n),D(n))})(),()=>{e=!0}},[$,D]);let _=(0,n.useCallback)(()=>{I.current?.abort(),P.current=null,L.current=!1,O(null),u(null),N.current=[],j([]),M("idle")},[]),U=(0,n.useCallback)(e=>{I.current?.abort(),P.current=e,L.current=!0,O(e),u(e),N.current=[],j([]),M("idle"),D(e)},[D]),B=(0,n.useCallback)(e=>{let t;t=l().filter(t=>t.id!==e),localStorage.setItem(i,JSON.stringify(t)),c()===e&&u(null),R(t=>t.filter(t=>t.id!==e)),K===e&&_(),fetch(`/api/internal/assistant/sessions?sessionId=${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{}).finally(()=>{$()})},[K,_,$]),H=(0,n.useCallback)((e,t)=>{let r=t.trim();if(r){var n;let t;n={title:r},t=l().map(t=>t.id===e?{...t,...n,updatedAt:new Date().toISOString()}:t),localStorage.setItem(i,JSON.stringify(t)),R(t=>t.map(t=>t.id===e?{...t,title:r}:t)),fetch(`/api/internal/assistant/sessions?sessionId=${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:r})}).catch(()=>{})}},[]),V=(0,n.useCallback)(async()=>{g(!0);try{await F(),o(!0)}finally{g(!1)}},[F]),J=(0,n.useCallback)(()=>{o(!1),I.current?.abort(),I.current=null,M("idle")},[]),q=(0,n.useCallback)(()=>{if(!t&&!m)return void V();let e=document.activeElement;e instanceof HTMLElement&&null!==e.closest("[data-assistant-input]")?J():b(e=>e+1)},[t,m,J,V]);(0,s.useActionShortcut)("global.assistant",()=>q());let W=(0,n.useCallback)(async(e,t)=>{if(!e.trim()&&!t?.attachmentFilenames?.length)return;I.current?.abort();let r=new AbortController;I.current=r;let n=0!==N.current.length||L.current?null:e,s=f();if(N.current=[...N.current,{id:f(),role:"user",content:e,attachmentFilenames:t?.attachmentFilenames?.length?t.attachmentFilenames:void 0},{id:s,role:"thinking",content:"",isStreaming:!0}],z(),t?.attachmentFilenames?.length&&P.current){let e=N.current.filter(e=>"user"===e.role).length-1;p(P.current,e,t.attachmentFilenames)}M("connecting");let a=null;try{let o=await fetch("/api/internal/assistant/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e,sessionId:P.current,attachmentFilenames:t?.attachmentFilenames??[]}),signal:r.signal});if(!o.ok||!o.body)throw Error(`HTTP ${o.status}`);M("streaming");let c=o.body.getReader(),d=new TextDecoder,h="";for(;;){let{done:e,value:r}=await c.read();if(e)break;let o=(h+=d.decode(r,{stream:!0})).split("\n");for(let e of(h=o.pop()??"",o)){let r;if(e.startsWith("data: ")){try{r=JSON.parse(e.slice(6).trim())}catch{continue}if(r.sessionId){let e=P.current;if(P.current=r.sessionId,n&&!L.current&&r.sessionId!==e){L.current=!0;let e=new Date().toISOString(),s={id:r.sessionId,title:function(e){let t=e.trim();return t?t.length>30?t.slice(0,30):t:"New Session"}(n),createdAt:e,updatedAt:e};!function(e){let t=[e,...l().filter(t=>t.id!==e.id)].slice(0,10);localStorage.setItem(i,JSON.stringify(t))}(s),R(l()),O(r.sessionId),u(r.sessionId),t?.attachmentFilenames?.length&&p(r.sessionId,0,t.attachmentFilenames)}}switch(r.type){case"text_delta":{let e=N.current.filter(e=>e.id!==s);a?N.current=e.map(e=>e.id===a?{...e,content:e.content+(r.content??""),isStreaming:!0}:e):(a=f(),N.current=[...e,{id:a,role:"assistant",content:r.content??"",isStreaming:!0}]),z();break}case"text":{let e=N.current.filter(e=>e.id!==s);a?N.current=e.map(e=>e.id===a?{...e,content:r.content??e.content,isStreaming:!0}:e):(a=f(),N.current=[...e,{id:a,role:"assistant",content:r.content??"",isStreaming:!0}]),z();break}case"tool_start":{let e=N.current.filter(e=>e.id!==s);a?(N.current=e.map(e=>e.id===a?{...e,isStreaming:!1}:e),a=null):N.current=e,r.toolId&&N.current.some(e=>"tool"===e.role&&e.toolId===r.toolId)||(N.current=[...N.current,{id:f(),role:"tool",content:`Calling ${r.content??"tool"}...`,toolName:r.content,toolId:r.toolId,isStreaming:!0}]),z();break}case"tool_use":{let e=N.current.filter(e=>e.id!==s),t=a?e.map(e=>e.id===a?{...e,isStreaming:!1}:e):e;a=null;let n=JSON.stringify(r.toolInput??{},null,2),i=-1;if(r.toolId&&(i=t.findIndex(e=>"tool"===e.role&&e.toolId===r.toolId)),-1===i)for(let e=t.length-1;e>=0;e--){let n=t[e];if("tool"===n.role&&n.isStreaming&&n.toolName===r.content){i=e;break}}-1!==i?N.current=t.map((e,t)=>t===i?{...e,content:n,toolName:r.content,toolId:r.toolId??e.toolId,isStreaming:!1}:e):N.current=[...t,{id:f(),role:"tool",content:n,toolName:r.content,toolId:r.toolId,isStreaming:!1}],z();break}case"tool_result":N.current=[...N.current,{id:f(),role:"tool",content:String(r.toolOutput??""),toolName:`${r.content??"tool"} (result)`}],z();break;case"error":N.current=[...N.current.filter(e=>e.id!==s),{id:f(),role:"assistant",content:`Error: ${r.content??"Unknown error"}`}],z(),M("error");break;case"done":N.current=N.current.filter(e=>e.id!==s).map(e=>e.isStreaming?{...e,isStreaming:!1}:e),a=null,z(),M("idle")}}}}N.current=N.current.filter(e=>e.id!==s),z(),M(e=>"streaming"===e?"idle":e),$()}catch(e){if("AbortError"===e.name)return;N.current=[...N.current.filter(e=>e.id!==s),{id:f(),role:"assistant",content:`Connection error: ${e.message??"Unknown error"}`}],z(),M("error")}},[z,$]),G=(0,n.useCallback)(()=>(I.current?.abort(),I.current=null,N.current=N.current.filter(e=>"thinking"!==e.role).map(e=>e.isStreaming?{...e,isStreaming:!1}:e),j([...N.current]),M("idle"),null),[]),Z=S[S.length-1],X="connecting"===C||"streaming"===C||Z?.role==="thinking"&&!0===Z.isStreaming;return(0,r.jsx)(d.Provider,{value:{isOpen:t,isStarting:m,displayMode:v,worktreePath:k,toggleAssistant:q,closeAssistant:J,inputFocusSignal:y,chatMessages:S,chatStatus:C,isChatThinking:X,isLoadingHistory:E,sendChatMessage:W,cancelChat:G,sessions:T,activeSessionId:K,createNewSession:_,switchSession:U,removeSession:B,renameSession:H,refreshSessions:$},children:e})},"useAssistant",0,function(){let e=(0,n.useContext)(d);if(!e)throw Error("useAssistant must be used within an AssistantProvider");return e}],338187)},275360,e=>{"use strict";let t=(0,e.i(572989).default)("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);e.s(["FolderPlus",0,t],275360)},431828,763131,e=>{"use strict";var t=e.i(572989);let r=(0,t.default)("folder-git-2",[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);e.s(["FolderGit2",0,r],431828);let n=(0,t.default)("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]);e.s(["Home",0,n],763131)},256753,e=>{"use strict";let t=(0,e.i(572989).default)("hard-drive",[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]]);e.s(["HardDrive",0,t],256753)},224277,e=>{"use strict";var t=e.i(289721),r=e.i(965652),n=e.i(977982),s=e.i(431828),a=e.i(763131),i=e.i(472074),o=e.i(738690),l=e.i(256753),c=e.i(275360),u=e.i(597746),d=e.i(657153),f=e.i(776639),h=e.i(519455),p=e.i(793479),m=e.i(746798),g=e.i(533499),y=e.i(759684);e.s(["FolderBrowserDialog",0,function({open:e,onOpenChange:b,onSelect:v,gitOnly:x=!1}){let{t:k}=(0,g.useI18n)(),[w,S]=(0,r.useState)(null),[j,C]=(0,r.useState)(!1),[M,E]=(0,r.useState)(null),[A,N]=(0,r.useState)(""),[P,I]=(0,r.useState)(""),[T,R]=(0,r.useState)(!1),K=(0,r.useRef)(null),[O,L]=(0,r.useState)(!1),[z,F]=(0,r.useState)(""),$=(0,r.useRef)(null),D=(0,r.useCallback)(async e=>{C(!0),E(null),I(""),R(!1);try{let t=e?`/api/browse-fs?path=${encodeURIComponent(e)}`:"/api/browse-fs",r=await fetch(t);if(!r.ok){let e=await r.json();E(e.error||"Failed");return}let n=await r.json();return S(n),N(n.currentPath),n}catch{E("Failed to browse filesystem")}finally{C(!1)}},[]);(0,r.useEffect)(()=>{e&&(D().then(e=>{e?.isWindows&&R(!0)}),setTimeout(()=>K.current?.focus(),200))},[e,D]);let _=()=>{A.trim()&&D(A.trim())},U=async()=>{let e=z.trim();if(e&&w?.currentPath)try{let t=await fetch("/api/browse-fs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parentPath:w.currentPath,name:e})});if(!t.ok){let e=await t.json();E(e.error||k("folder.newFolderError"));return}L(!1),F(""),D(w.currentPath)}catch{E(k("folder.newFolderError"))}},B=()=>{L(!1),F("")},H=w?.folders.filter(e=>e.name.toLowerCase().includes(P.toLowerCase()))??[];return(0,t.jsx)(f.Dialog,{open:e,onOpenChange:b,children:(0,t.jsx)(f.DialogContent,{className:"p-0 gap-0",style:{maxWidth:"36rem",overflow:"hidden"},children:(0,t.jsxs)("div",{className:"flex flex-col max-h-[60vh] overflow-hidden",children:[(0,t.jsxs)("div",{className:"px-5 pt-5 pb-3 shrink-0",children:[(0,t.jsx)(f.DialogTitle,{children:x?k("folder.selectGitRepo"):k("folder.selectFolder")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:k("folder.hint")})]}),(0,t.jsxs)("div",{className:"border-t border-border px-4 pt-3 pb-2 shrink-0",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:k("folder.manualInput")}),(0,t.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,t.jsx)(p.Input,{ref:K,value:A,onChange:e=>N(e.target.value),onKeyDown:e=>"Enter"===e.key&&_(),placeholder:"/path/to/your/project",title:A,className:"flex-1 min-w-0"}),(0,t.jsx)(h.Button,{variant:"outline",onClick:_,className:"h-8 px-3 shrink-0",children:k("folder.goTo")})]})]}),(0,t.jsxs)("div",{className:"px-4 py-2 shrink-0",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:k("folder.searchDir")}),(0,t.jsxs)("div",{className:"relative mt-1.5",children:[(0,t.jsx)(o.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),(0,t.jsx)("input",{value:P,onChange:e=>I(e.target.value),placeholder:k("folder.filterPlaceholder"),className:"h-8 w-full rounded-md border border-border bg-background pl-8 pr-3 text-sm text-foreground placeholder-muted-foreground outline-none focus:border-ring focus:ring-1 focus:ring-ring"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 border-y border-border px-4 py-2 shrink-0 min-w-0",children:[(0,t.jsxs)(m.Tooltip,{children:[(0,t.jsx)(m.TooltipTrigger,{render:(0,t.jsx)(h.Button,{variant:"outline",size:"icon-sm",onClick:()=>{w?.isWindows?R(!0):w?.homePath&&D(w.homePath)},className:"shrink-0 text-muted-foreground"}),children:(0,t.jsx)(a.Home,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(m.TooltipContent,{side:"bottom",sideOffset:4,children:k("folder.home")})]}),(0,t.jsxs)(m.Tooltip,{children:[(0,t.jsx)(m.TooltipTrigger,{render:(0,t.jsx)(h.Button,{variant:"outline",size:"icon-sm",onClick:()=>{w&&("__DRIVES__"===w.parentPath?R(!0):(R(!1),D(w.parentPath)))},className:"shrink-0 text-muted-foreground"}),children:(0,t.jsx)(i.ChevronUp,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(m.TooltipContent,{side:"bottom",sideOffset:4,children:k("folder.parent")})]}),(0,t.jsxs)(m.Tooltip,{children:[(0,t.jsx)(m.TooltipTrigger,{render:(0,t.jsx)(h.Button,{variant:"outline",size:"icon-sm",onClick:()=>{L(!0),F(""),setTimeout(()=>$.current?.focus(),50)},className:"shrink-0 text-muted-foreground"}),children:(0,t.jsx)(c.FolderPlus,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(m.TooltipContent,{side:"bottom",sideOffset:4,children:k("folder.newFolder")})]}),(0,t.jsx)("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground font-mono",title:w?.currentPath??"",children:w?.currentPath??"..."})]}),(0,t.jsxs)(y.ScrollArea,{className:"min-h-0 flex-1",children:[O&&(0,t.jsxs)("div",{className:"flex items-center gap-2 border-b border-border/30 px-4 py-2",children:[(0,t.jsx)(n.Folder,{className:"h-4 w-4 text-primary/70 shrink-0"}),(0,t.jsx)("input",{ref:$,value:z,onChange:e=>F(e.target.value),onKeyDown:e=>{"Enter"===e.key&&U(),"Escape"===e.key&&B()},placeholder:k("folder.newFolderPlaceholder"),className:"h-7 flex-1 rounded-md border border-border bg-background px-2 text-sm text-foreground placeholder-muted-foreground outline-none focus:border-ring focus:ring-1 focus:ring-ring"}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:U,disabled:!z.trim(),className:"text-emerald-400 hover:text-emerald-300",children:(0,t.jsx)(u.Check,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-xs",onClick:B,className:"text-muted-foreground",children:(0,t.jsx)(d.X,{className:"h-3.5 w-3.5"})})]}),j&&(0,t.jsx)("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"Loading..."}),M&&(0,t.jsx)("div",{className:"flex items-center justify-center py-8 text-sm text-rose-400",children:M}),T&&(!w?.drives||0===w.drives.length)&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-1 py-8 text-sm text-muted-foreground",children:[(0,t.jsx)("span",{children:k("folder.noDrives")}),(0,t.jsxs)("span",{className:"text-[10px] opacity-60",children:[w?.diag??"old-build"," · platform=",w?.platform??"?"," · drives=",w?.drives?.length??0," · ",w?.currentPath??"?"]})]}),T&&w?.drives&&w.drives.map(e=>(0,t.jsxs)("button",{onClick:()=>{var t;return t=e.path,void(R(!1),D(t))},className:"flex w-full items-center gap-3 border-b border-border/30 px-4 py-2.5 text-left transition-colors hover:bg-accent last:border-b-0",children:[(0,t.jsx)(l.HardDrive,{className:"h-4 w-4 text-blue-400 shrink-0"}),(0,t.jsx)("span",{className:"flex-1 text-sm text-foreground truncate",children:e.name}),(0,t.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:e.path})]},e.path)),!T&&!j&&!M&&0===H.length&&(0,t.jsx)("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:k("folder.empty")}),!T&&!j&&!M&&H.map(e=>(0,t.jsxs)("button",{onClick:()=>{e.isGit||x?(v(e.path),b(!1)):D(e.path)},onDoubleClick:()=>D(e.path),className:"flex w-full items-center gap-3 border-b border-border/30 px-4 py-2.5 text-left transition-colors hover:bg-accent last:border-b-0",children:[e.isGit?(0,t.jsx)(s.FolderGit2,{className:"h-4 w-4 text-emerald-400 shrink-0"}):(0,t.jsx)(n.Folder,{className:"h-4 w-4 text-primary/70 shrink-0"}),(0,t.jsx)("span",{className:"flex-1 text-sm text-foreground truncate",children:e.name}),e.isGit&&(0,t.jsx)("span",{className:"shrink-0 rounded-md bg-emerald-500/10 px-2 py-0.5 text-[10px] font-medium text-emerald-400 ring-1 ring-emerald-500/20",children:"git"})]},e.path))]}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 px-5 py-3 shrink-0 border-t border-border",children:[(0,t.jsx)(h.Button,{variant:"outline",onClick:()=>b(!1),children:k("common.cancel")}),(0,t.jsx)(h.Button,{onClick:()=>{w?.currentPath&&(v(w.currentPath),b(!1))},className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:k("folder.selectPath")})]})]})})})}])},905455,e=>{"use strict";var t=e.i(289721),r=e.i(975157);e.s(["SegmentedControl",0,function({options:e,value:n,onChange:s,className:a}){return(0,t.jsx)("div",{className:(0,r.cn)("inline-flex rounded-md border border-border bg-muted p-1 gap-1",a),children:e.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>s(e.value),className:(0,r.cn)("rounded px-3 py-1 text-sm transition-colors",n===e.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:e.label},e.value))})}])},233274,e=>{"use strict";let t=(0,e.i(572989).default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);e.s(["Sparkles",0,t],233274)},117356,e=>{"use strict";var t=e.i(514798);let r=(0,t.createServerReference)("60d6bdc95a2a456d0e0dc627f1f08c495e85e3c291",t.callServer,void 0,t.findSourceMapURL,"analyzeProjectDirectory");e.s(["analyzeProjectDirectory",0,r])},86084,e=>{"use strict";var t=e.i(514798);let r=(0,t.createServerReference)("401a552a24f8644baa876aacdcf5eba7d28ab5cc3a",t.callServer,void 0,t.findSourceMapURL,"createProject");e.s(["createProject",0,r])},469051,e=>{"use strict";let t=(0,e.i(572989).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"}]]);e.s(["LayoutGrid",0,t],469051)},338271,289813,941068,e=>{"use strict";var t=e.i(965652);let r=e=>{let t,r=new Set,n=(e,n)=>{let s="function"==typeof e?e(t):e;if(!Object.is(s,t)){let e=t;t=(null!=n?n:"object"!=typeof s||null===s)?s:Object.assign({},t,s),r.forEach(r=>r(t,e))}},s=()=>t,a={setState:n,getState:s,getInitialState:()=>i,subscribe:e=>(r.add(e),()=>r.delete(e))},i=t=e(n,s,a);return a},n=e=>{let n=e?r(e):r,s=e=>(function(e,r=e=>e){let n=t.default.useSyncExternalStore(e.subscribe,t.default.useCallback(()=>r(e.getState()),[e,r]),t.default.useCallback(()=>r(e.getInitialState()),[e,r]));return t.default.useDebugValue(n),n})(n,e);return Object.assign(s,n),s},s=e=>e?n(e):n;e.s(["create",0,s],289813);let a=["Shift","Meta","Alt","Control"],i="object"==typeof navigator?navigator.platform:"",o=/Mac|iPod|iPhone|iPad/.test(i)?"Meta":"Control",l="Win32"===i?["Control","Alt"]:["Alt"];function c(e,t){return"function"==typeof e.getModifierState&&(e.getModifierState(t)||l.includes(t)&&e.getModifierState("AltGraph"))}function u(e){return e.trim().split(" ").map(e=>{let t=e.split(/(?<=\w|\])\+/),r=t.pop(),n=r.match(/^\((.+)\)$/),s=n?RegExp(`^(?:${n[1]})$`,"iv"):r,a=[],i=[];for(let e of t){let t=e.match(/^\[(.*)\]$/),r=t?.[1]??e;r="$mod"===r?o:r,t?i.push(r):a.push(r)}return[a,i,s]})}e.s(["matchKeybindingPress",0,function(e,[t,r,n]){let s=t.includes("AltGraph");return!((n instanceof RegExp?!(n.test(e.key)||n.test(e.code)):n.toUpperCase()!==e.key.toUpperCase()&&n!==e.code)||t.find(t=>!c(e,t))||a.find(a=>!t.includes(a)&&!r.includes(a)&&n!==a&&c(e,a)&&!(s&&l.includes(a))))},"parseKeybinding",0,u],941068);let d=0,f=0,h=s(e=>({entries:new Map,register:t=>{var r;let n=(d+=1,`sc_${d}`);f+=1;let s=Array.isArray(r=t.keys)?[...r]:[r],a={...t,id:n,keys:s,presses:s.map(e=>u(e)),seq:f};return e(e=>{let t=new Map(e.entries);return t.set(n,a),{entries:t}}),n},unregister:t=>{e(e=>{if(!e.entries.has(t))return e;let r=new Map(e.entries);return r.delete(t),{entries:r}})}}));e.s(["selectAllShortcuts",0,function(e){return Array.from(e.entries.values())},"useShortcutStore",0,h],338271)},889383,e=>{"use strict";var t=e.i(289721),r=e.i(965652),n=e.i(338271),s=e.i(941068);function a(e){return(e.priority??0)+1e3*("global"!==e.scope)}e.s(["ShortcutProvider",0,function({children:e}){return(0,r.useEffect)(()=>{function e(e){let t=(0,n.selectAllShortcuts)(n.useShortcutStore.getState());if(0===t.length)return;let r=function(e,t,r){let n=[];for(let a of e){if(a.when&&!1===a.when())continue;let e=null;for(let r of a.presses){if(1!==r.length)continue;let n=r[0];if((0,s.matchKeybindingPress)(t,n)){e=n;break}}if(e){if(r){if(function(e){let[t]=e;return t.some(e=>"Control"===e||"Meta"===e||"Alt"===e)}(e)){if(!1===a.allowInInput)continue}else if(!a.allowInInput)continue}n.push(a)}}return 0===n.length?null:(n.sort((e,t)=>{let r=a(e),n=a(t);return r!==n?n-r:t.seq-e.seq}),n[0])}(t,e,function(e){if(!e)return!1;let t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t||!0===e.isContentEditable}(document.activeElement));r&&(!1!==r.preventDefault&&e.preventDefault(),e.stopPropagation(),r.handler(e))}return window.addEventListener("keydown",e,{capture:!0}),()=>{window.removeEventListener("keydown",e,{capture:!0})}},[]),(0,t.jsx)(t.Fragment,{children:e})}],889383)},454711,e=>{"use strict";var t=e.i(965652),r=e.i(338271);e.s(["useShortcut",0,function(...e){let n=function(e){let t=e[0];if("string"==typeof t||Array.isArray(t))return Array.isArray(t)&&t.length>0&&"string"!=typeof t[0]?t:[{keys:t,handler:e[1],...e[2]??{}}];return[t]}(e),s=(0,t.useRef)(n);(0,t.useEffect)(()=>{s.current=n});let a=(0,r.useShortcutStore)(e=>e.register),i=(0,r.useShortcutStore)(e=>e.unregister),o=JSON.stringify(n.map(e=>({keys:e.keys,scope:e.scope,description:e.description,group:e.group,allowInInput:e.allowInInput,preventDefault:e.preventDefault,priority:e.priority,hidden:e.hidden,hasWhen:"function"==typeof e.when})));(0,t.useEffect)(()=>{let e=s.current.map((e,t)=>a({...e,handler:e=>s.current[t]?.handler(e),when:e.when?()=>s.current[t]?.when?.()??!0:void 0}));return()=>{for(let t of e)i(t)}},[o,a,i])}])},743059,e=>{"use strict";var t=e.i(338271);function r(){if("u"<typeof navigator)return!1;let e=navigator.userAgentData?.platform;return/mac/i.test(e??navigator.userAgent??"")}let n={ArrowLeft:"←",ArrowRight:"→",ArrowUp:"↑",ArrowDown:"↓"};function s(e){let t=r();return e.split("+").map(e=>(function(e,t){switch(e){case"$mod":case"Meta":return t?"⌘":"Ctrl";case"Control":return"Ctrl";case"Alt":return t?"⌥":"Alt";case"Shift":return"⇧";case"Escape":return"Esc";case"Enter":return"↵";case"Tab":return"Tab";default:if(/^Digit[0-9]$/.test(e))return e.slice(5);return n[e]??e}})(e,t))}function a(e){return e.map(e=>s(e).join("+"))}e.s(["compactKeyList",0,function(e){if(e.length<3)return e;let t=e.map(e=>{let t=/^(.*?)(?:Digit)?([1-9])$/.exec(e);return t?{prefix:t[1],digit:Number(t[2])}:null});if(t.some(e=>null===e))return e;let r=t[0].prefix;return t.every(e=>e.prefix===r)&&t.every((e,t)=>e.digit===t+1)?[`${r}1–${t[t.length-1].digit}`]:e},"isMac",0,r,"renderComboTokens",0,s,"renderKeys",0,a,"useShortcutHelp",0,function(){let e=(0,t.useShortcutStore)(t.selectAllShortcuts),r=new Map;for(let t of e){if(t.hidden)continue;let e=t.group??t.scope??"global",n=r.get(e);n?n.push(t):r.set(e,[t])}return{groups:Array.from(r.entries()).map(([e,t])=>({title:e,shortcuts:t})),renderKeys:a}}])},371385,75566,841359,e=>{"use strict";let t=[{id:"global.search",defaultKeys:["$mod+k"],descriptionKey:"shortcuts.search",group:"global",scope:"global",configurable:!0},{id:"global.commandPalette",defaultKeys:["$mod+p"],descriptionKey:"shortcuts.commandPalette",group:"global",scope:"global",configurable:!0},{id:"global.help",defaultKeys:["$mod+/","?"],descriptionKey:"shortcuts.openHelp",group:"global",scope:"global",configurable:!0},{id:"global.assistant",defaultKeys:["$mod+l"],descriptionKey:"shortcuts.assistant",group:"global",scope:"global",configurable:!0},{id:"global.gotoWorkspace",defaultKeys:["Alt+Digit1","Alt+Digit2","Alt+Digit3","Alt+Digit4","Alt+Digit5","Alt+Digit6","Alt+Digit7","Alt+Digit8","Alt+Digit9"],descriptionKey:"shortcuts.gotoWorkspace",group:"global",scope:"global",configurable:!1,allowInInput:!0},{id:"panels.taskManager",defaultKeys:["$mod+Control+j"],descriptionKey:"shortcuts.panels.taskManager",group:"panels",scope:"global",configurable:!0},{id:"panels.assets",defaultKeys:["$mod+Control+k"],descriptionKey:"shortcuts.panels.assets",group:"panels",scope:"global",configurable:!0},{id:"panels.notes",defaultKeys:["$mod+Control+l"],descriptionKey:"shortcuts.panels.notes",group:"panels",scope:"global",configurable:!0},{id:"panels.archive",defaultKeys:["$mod+Control+;"],descriptionKey:"shortcuts.panels.archive",group:"panels",scope:"global",configurable:!0},{id:"missions.exit",defaultKeys:["Control+;"],descriptionKey:"shortcuts.missions.exitToNav",group:"missions",scope:"missions",configurable:!0,allowInInput:!0},{id:"missions.jump",defaultKeys:["1","2","3","4","5","6","7","8","9"],descriptionKey:"shortcuts.missions.jump",group:"missions",scope:"missions",configurable:!1},{id:"missions.moveSelection",defaultKeys:["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],descriptionKey:"shortcuts.missions.moveSel",group:"missions",scope:"missions",configurable:!1},{id:"missions.cycle",defaultKeys:["Tab"],descriptionKey:"shortcuts.missions.cyclePane",group:"missions",scope:"missions",configurable:!1},{id:"missions.cycleBack",defaultKeys:["Shift+Tab"],descriptionKey:"shortcuts.missions.cyclePane",group:"missions",scope:"missions",configurable:!1},{id:"missions.focus",defaultKeys:["Enter"],descriptionKey:"shortcuts.missions.focusSel",group:"missions",scope:"missions",configurable:!1},{id:"missions.next",defaultKeys:["$mod+ArrowRight"],descriptionKey:"shortcuts.missions.nextPane",group:"missions",scope:"missions",configurable:!0,allowInInput:!0},{id:"missions.prev",defaultKeys:["$mod+ArrowLeft"],descriptionKey:"shortcuts.missions.prevPane",group:"missions",scope:"missions",configurable:!0,allowInInput:!0}],r=new Map(t.map(e=>[e.id,e]));function n(e){let t=r.get(e);if(!t)throw Error(`Unknown shortcut action: ${e}`);return t}e.s(["SHORTCUT_ACTIONS",0,t,"getAction",0,n],371385);var s=e.i(289813);let a="tower-keymap-overrides";function i(e){try{window.localStorage.setItem(a,JSON.stringify(e))}catch{}}function o(e,t){return e[t]??[...n(t).defaultKeys]}let l=(0,s.create)((e,t)=>({overrides:function(){try{let e=window.localStorage.getItem(a);if(!e)return{};let t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t;return{}}catch{return{}}}(),setBinding:(t,r)=>e(e=>{let n={...e.overrides,[t]:r};return i(n),{overrides:n}}),resetBinding:t=>e(e=>{if(!(t in e.overrides))return e;let r={...e.overrides};return delete r[t],i(r),{overrides:r}}),resetAll:()=>{i({}),e({overrides:{}})},resolveKeys:e=>o(t().overrides,e)}));e.s(["resolveKeysFrom",0,o,"useKeymapStore",0,l],75566);var c=e.i(533499),u=e.i(454711);function d(e){return l(t=>t.overrides[e])??[...n(e).defaultKeys]}e.s(["useActionShortcut",0,function(e,t,r){let s=n(e),a=d(e),{t:i}=(0,c.useI18n)();(0,u.useShortcut)(a,t,{scope:s.scope,description:i(s.descriptionKey),group:i(`shortcuts.group.${s.group}`),allowInInput:s.allowInInput,...r})},"useResolvedKeys",0,d],841359)},508271,158956,e=>{"use strict";e.i(889383),e.i(454711);var t=e.i(743059);e.i(338271),e.i(371385),e.i(841359),e.s(["serializeKeyEvent",0,function(e){let{key:r}=e;if("Control"===r||"Shift"===r||"Alt"===r||"Meta"===r)return null;let n=(0,t.isMac)(),s=[];return(n?e.metaKey:e.ctrlKey)&&s.push("$mod"),(n?e.ctrlKey:e.metaKey)&&s.push(n?"Control":"Meta"),e.altKey&&s.push("Alt"),e.shiftKey&&s.push("Shift"),s.push(1===r.length&&/[a-zA-Z]/.test(r)?r.toLowerCase():r),s.join("+")}],158956),e.i(75566),e.s([],508271)},127723,e=>{"use strict";var t=e.i(514798);let r=(0,t.createServerReference)("602f249ffd4feeacc003965c2280a0f6818774621f",t.callServer,void 0,t.findSourceMapURL,"getConfigValue");e.s(["getConfigValue",0,r])},232545,e=>{"use strict";let t=(0,e.i(572989).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",0,t],232545)},998626,e=>{"use strict";let t=(0,e.i(572989).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);e.s(["Trash2",0,t],998626)},977982,472074,e=>{"use strict";let t=(0,e.i(572989).default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);e.s(["Folder",0,t],977982);var r=e.i(792566);e.s(["ChevronUp",()=>r.default],472074)},59737,e=>{"use strict";let t=(0,e.i(572989).default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);e.s(["default",0,t])},194358,e=>{"use strict";let t=(0,e.i(572989).default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",0,t],194358)},567098,e=>{"use strict";let t=(0,e.i(572989).default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);e.s(["default",0,t])},770303,e=>{"use strict";var t=e.i(289721),r=e.i(965652),n=e.i(514798);let s=(0,n.createServerReference)("4071f8336f22edfe28929da6c8ff0f4029617d3711",n.callServer,void 0,n.findSourceMapURL,"checkExtension");var a=e.i(311687);let i=(0,n.createServerReference)("40a3c6df81ffdfc61bfe62695cc844afa21f21a1ac",n.callServer,void 0,n.findSourceMapURL,"uninstallExtension");var o=e.i(887911);let l={installed:!1},c=(0,r.createContext)(null);e.s(["ExtensionContext",0,c,"ExtensionProvider",0,function({children:e,initialStatus:n}){let[u,d]=(0,r.useState)(()=>n??Object.fromEntries((0,o.listExtensionMetadata)().map(e=>[e.id,l]))),[f,h]=(0,r.useState)(new Set),p=(0,r.useRef)(new Set),m=(0,r.useCallback)(async e=>{let t=await s(e);d(r=>({...r,[e]:t}))},[]),g=(0,r.useCallback)(async e=>{if(p.current.has(e))return{success:!1,error:"install already in progress"};p.current.add(e),h(t=>{let r=new Set(t);return r.add(e),r});try{let t=await (0,a.installExtension)(e);return t.success&&await m(e),t}finally{p.current.delete(e),h(t=>{let r=new Set(t);return r.delete(e),r})}},[m]),y=(0,r.useCallback)(async e=>{if(p.current.has(e))return{success:!1,error:"operation already in progress"};p.current.add(e),h(t=>{let r=new Set(t);return r.add(e),r});try{let t=await i(e);return t.success&&await m(e),t}finally{p.current.delete(e),h(t=>{let r=new Set(t);return r.delete(e),r})}},[m]),b=(0,r.useMemo)(()=>({statusMap:u,loading:!1,installing:f,refresh:m,install:g,uninstall:y}),[u,f,m,g,y]);return(0,t.jsx)(c.Provider,{value:b,children:e})}],770303)},360325,e=>{"use strict";let t=(0,e.i(572989).default)("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);e.s(["Keyboard",0,t],360325)},386343,125177,851289,e=>{"use strict";var t=e.i(572989);let r=(0,t.default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["Settings",0,r],386343);let n=(0,t.default)("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);e.s(["Bell",0,n],125177);var s=e.i(289721),a=e.i(965652);e.i(508271);var i=e.i(743059),o=e.i(975157);function l({children:e}){return(0,s.jsx)("kbd",{className:(0,o.cn)("inline-flex min-w-[1.5rem] items-center justify-center rounded-md","border border-border bg-muted px-1.5 py-0.5","text-[11px] font-medium leading-none text-foreground","shadow-[inset_0_-1px_0_var(--border)]"),children:e})}e.s(["KeyCombo",0,function({keys:e}){let t=(0,i.compactKeyList)(e);return(0,s.jsx)("span",{className:"inline-flex flex-wrap items-center gap-1.5",children:t.map((e,t)=>(0,s.jsxs)("span",{className:"inline-flex items-center gap-1",children:[t>0&&(0,s.jsx)("span",{className:"text-[11px] text-muted-foreground/40",children:"/"}),(0,i.renderComboTokens)(e).map((e,t)=>(0,s.jsxs)(a.Fragment,{children:[t>0&&(0,s.jsx)("span",{className:"text-[10px] text-muted-foreground/60",children:"+"}),(0,s.jsx)(l,{children:e})]},t))]},`${e}-${t}`))})}],851289)},243288,e=>{e.v(t=>Promise.all(["static/chunks/0af7afat3acfx.js","static/chunks/0ep-qrl_zzch8.js","static/chunks/035a_v6g7ioyw.js","static/chunks/17oc2l.ekcs8b.css"].map(t=>e.l(t))).then(()=>t(346069)))},427768,e=>{e.v(t=>Promise.all(["static/chunks/0l25d0nc5ygyd.js","static/chunks/0o6zqtzz_7ysr.js"].map(t=>e.l(t))).then(()=>t(103363)))}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,912505,e=>{"use strict";var t=e.i(289721),s=e.i(975157);e.s(["EmptyState",0,function({icon:e,title:a,description:l,action:n,className:r}){return(0,t.jsxs)("div",{className:(0,s.cn)("flex h-48 flex-col items-center justify-center gap-2 text-center",r),children:[e&&(0,t.jsx)(e,{className:"h-10 w-10 text-muted-foreground/40"}),(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:a}),l&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground/60",children:l}),n&&(0,t.jsx)("div",{className:"mt-2",children:n})]})}])},236967,e=>{"use strict";var t=e.i(289721),s=e.i(210702),a=e.i(538059),l=e.i(259846),n=e.i(645378),r=e.i(453889),i=e.i(487278),c=e.i(533499);let o=[{key:"notes",icon:n.FileText},{key:"assets",icon:r.FolderOpen},{key:"archive",icon:i.Archive}];e.s(["SubPageNav",0,function({workspaceId:e}){let{t:n}=(0,c.useI18n)(),r=(0,a.usePathname)(),i=o.find(e=>r.includes(`/${e.key}`))?.key;return(0,t.jsxs)("div",{className:"header-sm flex items-center gap-1 px-4",children:[(0,t.jsxs)(s.default,{href:`/workspaces/${e}`,className:"mr-2 inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:[(0,t.jsx)(l.ArrowLeft,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:n("archive.backToBoard")})]}),(0,t.jsx)("span",{className:"mr-2 h-4 w-px bg-border"}),o.map(a=>{let l=a.icon,r=i===a.key;return(0,t.jsxs)(s.default,{href:`/workspaces/${e}/${a.key}`,className:`inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs font-medium transition-colors ${r?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"}`,children:[(0,t.jsx)(l,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:n(`sidebar.${a.key}`)})]},a.key)})]})}])},631675,e=>{"use strict";let t=(0,e.i(572989).default)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);e.s(["Upload",0,t],631675)},715362,e=>{"use strict";var t=e.i(514798);let s=(0,t.createServerReference)("409ee3a4936770685e5864c918fde77b58c82c8c49",t.callServer,void 0,t.findSourceMapURL,"deleteAsset");e.s(["deleteAsset",0,s])},981705,e=>{"use strict";var t=e.i(514798);let s=(0,t.createServerReference)("402a900d665c83ee0101923eeccf19b2ac388a33f0",t.callServer,void 0,t.findSourceMapURL,"uploadAsset");e.s(["uploadAsset",0,s])},734525,e=>{"use strict";var t=e.i(289721),s=e.i(965652),a=e.i(400355),l=e.i(738690),n=e.i(236967),r=e.i(533499),i=e.i(715362),c=e.i(514798);let o=(0,c.createServerReference)("4028050fca8d1cd079e697253d40f00308d04890b7",c.callServer,void 0,c.findSourceMapURL,"getProjectAssets");var d=e.i(453889),m=e.i(912505),x=e.i(645378),u=e.i(867533),h=e.i(998626),p=e.i(519455),f=e.i(937304);function g({asset:e,onPreview:s,onReveal:a,onDelete:l,onTaskClick:n}){var i;let{t:c}=(0,r.useI18n)(),o=(0,f.localPathToApiUrl)(e.path),m=(0,f.isImageAsset)(e.filename,e.mimeType);return(0,t.jsxs)("div",{className:"flex items-center gap-4 rounded-lg border border-border bg-card px-4 py-3 transition-colors hover:bg-accent/20",children:[(0,t.jsx)(p.Button,{variant:"ghost",onClick:()=>s(e),className:"flex-shrink-0 cursor-pointer p-0 h-auto",children:m?(0,t.jsx)("img",{src:o,alt:e.filename,className:"h-12 w-12 rounded object-cover border border-border"}):(0,t.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded border border-border bg-muted",children:(0,t.jsx)(x.FileText,{className:"h-6 w-6 text-muted-foreground"})})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("p",{className:"truncate text-sm font-medium text-foreground",children:e.filename}),e.taskTitle&&e.taskId&&(0,t.jsx)(p.Button,{variant:"ghost",onClick:t=>{t.stopPropagation(),n?.(e.taskId)},className:"flex-shrink-0 bg-blue-500/10 text-blue-600 dark:text-blue-400 text-xs px-1.5 py-0.5 rounded cursor-pointer hover:bg-blue-500/20 transition-colors h-auto",children:e.taskTitle.length>20?`[任务: ${e.taskTitle.slice(0,20)}...]`:`[任务: ${e.taskTitle}]`})]}),e.description&&(0,t.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground truncate",children:e.description}),(0,t.jsxs)("div",{className:"mt-0.5 flex items-center gap-3 text-xs text-muted-foreground",children:[(0,t.jsx)("span",{children:null===(i=e.size)?"-":i<1024?`${i} B`:i<1048576?`${(i/1024).toFixed(1)} KB`:i<0x40000000?`${(i/1048576).toFixed(1)} MB`:`${(i/0x40000000).toFixed(1)} GB`}),(0,t.jsx)("span",{children:new Date(e.createdAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,t.jsx)(p.Button,{variant:"ghost",size:"icon",onClick:()=>s(e),className:"text-muted-foreground","aria-label":c("assets.preview"),children:(0,t.jsx)(u.Eye,{className:"h-4 w-4"})}),(0,t.jsx)(p.Button,{variant:"ghost",size:"icon",onClick:()=>a(e),className:"text-muted-foreground","aria-label":c("assets.revealInFinder"),children:(0,t.jsx)(d.FolderOpen,{className:"h-4 w-4"})}),(0,t.jsx)(p.Button,{variant:"ghost",size:"icon",onClick:()=>l(e.id),className:"text-muted-foreground hover:text-rose-400","aria-label":c("assets.delete"),children:(0,t.jsx)(h.Trash2,{className:"h-4 w-4"})})]})]})}function j({assets:e,onPreview:s,onReveal:a,onDelete:l,onTaskClick:n}){let{t:i}=(0,r.useI18n)();return 0===e.length?(0,t.jsx)(m.EmptyState,{icon:d.FolderOpen,title:i("assets.empty"),description:i("assets.emptyHint")}):(0,t.jsx)("div",{className:"flex flex-col gap-3",children:e.map(e=>(0,t.jsx)(g,{asset:e,onPreview:s,onReveal:a,onDelete:l,onTaskClick:n},e.id))})}var v=e.i(631675),N=e.i(657153),b=e.i(981705),k=e.i(624687),y=e.i(967489);function w({allWorkspaces:e,initialWsId:a,initialProjectId:l,onUploaded:n}){let{t:i}=(0,r.useI18n)(),c=(0,s.useRef)(null),[o,d]=(0,s.useState)(!1),[m,x]=(0,s.useState)(!1),[u,h]=(0,s.useState)(null),[f,g]=(0,s.useState)(a),[j,S]=(0,s.useState)(l),[C,T]=(0,s.useState)(""),I=e.find(e=>e.id===f),P=I?.projects??[],$=P.find(e=>e.id===j),A=$?$.alias?`${$.name} (${$.alias})`:$.name:j??"",B=()=>{d(!1),h(null),c.current&&(c.current.value="")},F=async()=>{if(u&&j){x(!0);try{let e=new FormData;e.append("file",u),e.append("projectId",j),e.append("description",C.trim()),await (0,b.uploadAsset)(e),n(j),B()}finally{x(!1)}}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(p.Button,{onClick:()=>{g(a),S(l),h(null),T(""),d(!0)},className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[(0,t.jsx)(v.Upload,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:i("assets.upload")})]}),o&&(0,t.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,t.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:B}),(0,t.jsxs)("div",{className:"relative w-full max-w-md rounded-lg border border-border bg-card p-6 shadow-lg",children:[(0,t.jsx)(p.Button,{variant:"ghost",size:"icon-xs",onClick:B,className:"absolute right-3 top-3 text-muted-foreground",children:(0,t.jsx)(N.X,{className:"h-4 w-4"})}),(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground mb-4",children:i("assets.uploadTitle")}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0",children:i("assets.workspace")}),(0,t.jsxs)(y.Select,{value:f,onValueChange:t=>{var s;let a;return g(s=t??""),a=e.find(e=>e.id===s),void S(a?.projects[0]?.id??null)},children:[(0,t.jsx)(y.SelectTrigger,{className:"flex-1 min-w-0 text-xs",children:(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-left",title:I?.name??f,children:I?.name??f})}),(0,t.jsx)(y.SelectContent,{className:"max-w-[var(--anchor-width)]",children:e.map(e=>(0,t.jsx)(y.SelectItem,{value:e.id,title:e.name,children:(0,t.jsx)("span",{className:"block truncate",children:e.name})},e.id))})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0",children:i("assets.project")}),P.length>0?(0,t.jsxs)(y.Select,{value:j??"",onValueChange:e=>S(e??""),children:[(0,t.jsx)(y.SelectTrigger,{className:"flex-1 min-w-0 text-xs",children:(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-left",title:A,children:A})}),(0,t.jsx)(y.SelectContent,{className:"max-w-[var(--anchor-width)]",children:P.map(e=>{let s=e.alias?`${e.name} (${e.alias})`:e.name;return(0,t.jsx)(y.SelectItem,{value:e.id,title:s,children:(0,t.jsx)("span",{className:"block truncate",children:s})},e.id)})})]}):(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i("assets.noProject")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0",children:i("assets.file")}),(0,t.jsx)("input",{type:"file",ref:c,onChange:e=>{h(e.target.files?.[0]??null)},className:"hidden"}),(0,t.jsx)(p.Button,{variant:"outline",onClick:()=>{c.current?.click()},className:"flex-1 border-dashed bg-background px-3 py-2 text-xs text-muted-foreground hover:border-primary/50 hover:text-foreground transition-colors text-left justify-start",children:u?u.name:i("assets.selectFile")})]}),(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0 pt-1.5",children:i("assets.description")}),(0,t.jsx)(k.Textarea,{value:C,onChange:e=>T(e.target.value),placeholder:i("assets.descriptionPlaceholder"),className:"flex-1 rounded-md border border-border bg-background px-3 py-2 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-ring resize-none h-20"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 justify-end mt-6",children:[(0,t.jsx)(p.Button,{variant:"outline",onClick:B,children:i("notes.cancel")}),(0,t.jsx)(p.Button,{onClick:F,disabled:!u||!j||!C.trim()||m,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:i(m?"assets.uploading":"assets.upload")})]})]})]})]})}var S=e.i(235357),C=e.i(144640),T=e.i(605005),I=e.i(360112);e.s(["AssetsPageClient",0,function({allWorkspaces:e,initialWorkspaceId:c,initialProjectId:d,initialAssets:m}){let x,{t:u}=(0,r.useI18n)(),[h,p]=(0,s.useTransition)(),[g,v]=(0,s.useState)(c),[N,b]=(0,s.useState)(d),[k,P]=(0,s.useState)(m),[$,A]=(0,s.useState)(""),[B,F]=(0,s.useState)(null),U=e.find(e=>e.id===g),z=U?.projects??[],O=(0,s.useCallback)(e=>{e?p(async()=>{P(await o(e))}):P([])},[p]),[R,L]=(0,s.useState)(null),D=R?(0,f.isImageAsset)(R.filename,R.mimeType)?"image":/\.(txt|md|json)$/i.test(R.filename)?"text":null:null,M=$.trim().toLowerCase(),V=M?k.filter(e=>e.filename.toLowerCase().includes(M)):k,E=V.filter(e=>(0,f.isImageAsset)(e.filename,e.mimeType)).map(e=>({id:e.id,url:(0,f.localPathToApiUrl)(e.path),filename:e.filename})),H=R?E.findIndex(e=>e.id===R.id):-1,K=async 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(()=>({}));I.toast.error(e.error||"Failed to reveal file")}}catch{I.toast.error("Failed to reveal file")}},W=async e=>{let t=k.find(t=>t.id===e);confirm(u("assets.deleteConfirm",{filename:t?.filename??e}))&&(await (0,i.deleteAsset)(e),O(N))};return(0,t.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,t.jsx)(n.SubPageNav,{workspaceId:g}),(0,t.jsxs)("div",{className:"header-sm flex items-center gap-3 px-6 py-2",children:[(0,t.jsxs)(y.Select,{value:g,onValueChange:t=>t&&(t=>{if(t===g)return;v(t);let s=e.find(e=>e.id===t),a=s?.projects[0]??null;b(a?.id??null),O(a?.id??null)})(t),children:[(0,t.jsx)(y.SelectTrigger,{className:"h-8 w-auto min-w-[120px]",children:(0,t.jsx)("span",{className:"truncate",children:e.find(e=>e.id===g)?.name??g})}),(0,t.jsx)(y.SelectContent,{children:e.map(e=>(0,t.jsx)(y.SelectItem,{value:e.id,children:e.name},e.id))})]}),z.length>0&&(0,t.jsxs)(y.Select,{value:N??"",onValueChange:e=>e&&void(e!==N&&(b(e),O(e))),children:[(0,t.jsx)(y.SelectTrigger,{className:"h-8 w-auto min-w-[140px]",children:(0,t.jsx)("span",{className:"truncate",children:(x=z.find(e=>e.id===N))?x.alias?`${x.name} (${x.alias})`:x.name:""})}),(0,t.jsx)(y.SelectContent,{children:z.map(e=>(0,t.jsxs)(y.SelectItem,{value:e.id,children:[e.name,e.alias?` (${e.alias})`:""]},e.id))})]}),(0,t.jsxs)("div",{className:"relative ml-auto",children:[(0,t.jsx)(l.Search,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)("input",{type:"text",value:$,onChange:e=>A(e.target.value),placeholder:u("assets.searchPlaceholder"),className:"h-8 w-48 rounded-md border border-border bg-background pl-8 pr-3 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]}),(0,t.jsx)(w,{allWorkspaces:e,initialWsId:g,initialProjectId:N,onUploaded:e=>{e===N&&O(N)}})]}),(0,t.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4",children:(0,t.jsxs)("div",{className:`relative ${h?"opacity-40 pointer-events-none":""} transition-opacity`,children:[h&&(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:(0,t.jsx)(a.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}),0===z.length?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-16 text-center",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:u("assets.noProject")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground/60",children:u("assets.noProjectHint")})]}):(0,t.jsx)(j,{assets:V.map(e=>({...e,taskId:e.task?.id??null,taskTitle:e.task?.title??null})),onPreview:e=>{let t=(0,f.isImageAsset)(e.filename,e.mimeType),s=/\.(txt|md|json)$/i.test(e.filename);(t||s)&&L(e)},onReveal:K,onDelete:W,onTaskClick:F})]})}),(0,t.jsx)(S.ImageLightbox,{imageUrl:"image"===D&&H>=0?E[H].url:null,filename:"image"===D&&H>=0?E[H].filename:"",open:"image"===D,onOpenChange:e=>{e||L(null)},assets:E.map(({url:e,filename:t})=>({url:e,filename:t})),currentIndex:H>=0?H:void 0,onIndexChange:e=>{let t=E[e];if(!t)return;let s=k.find(e=>e.id===t.id);s&&L({...s,taskId:s.task?.id??null,taskTitle:s.task?.title??null})}}),(0,t.jsx)(C.TextPreviewDialog,{url:"text"===D&&R?(0,f.localPathToApiUrl)(R.path):null,filename:R?.filename??"",open:"text"===D,onOpenChange:e=>{e||L(null)}}),(0,t.jsx)(T.TaskOverviewDrawer,{open:!!B,onOpenChange:e=>{e||F(null)},taskId:B})]})}],734525)},244455,e=>{e.v(t=>Promise.all(["static/chunks/075e-zs_kgc_g.js"].map(t=>e.l(t))).then(()=>t(629495)))},800307,e=>{e.v(t=>Promise.all(["static/chunks/0zm4fvu.lntrp.js"].map(t=>e.l(t))).then(()=>t(267483)))}]);