tower-studio 0.2.14 → 0.2.15

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 (263) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-path-routes-manifest.json +1 -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 +8 -0
  6. package/.next/standalone/.next/server/app/_global-error/page.js +1 -1
  7. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  14. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/standalone/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -1
  16. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +41 -41
  17. package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
  18. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  21. package/.next/standalone/.next/server/app/_not-found.rsc +14 -14
  22. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
  23. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  24. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +9 -9
  25. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  26. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  27. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  28. package/.next/standalone/.next/server/app/api/adapters/test/route.js +1 -1
  29. package/.next/standalone/.next/server/app/api/adapters/test/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/browse-fs/route.js +1 -1
  31. package/.next/standalone/.next/server/app/api/browse-fs/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/files/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/api/git/route.js +1 -1
  34. package/.next/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/api/internal/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/internal/assets/reveal/route.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/api/internal/assistant/attachments/route.js +1 -1
  38. package/.next/standalone/.next/server/app/api/internal/assistant/attachments/route.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/api/internal/assistant/chat/route.js +1 -1
  40. package/.next/standalone/.next/server/app/api/internal/assistant/chat/route.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/api/internal/assistant/sessions/route.js +1 -1
  42. package/.next/standalone/.next/server/app/api/internal/assistant/sessions/route.js.nft.json +1 -1
  43. package/.next/standalone/.next/server/app/api/internal/backup/import/route.js +1 -1
  44. package/.next/standalone/.next/server/app/api/internal/backup/import/route.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/api/internal/cache/[...segments]/route.js +1 -1
  46. package/.next/standalone/.next/server/app/api/internal/cache/[...segments]/route.js.nft.json +1 -1
  47. package/.next/standalone/.next/server/app/api/internal/hooks/upload/route.js +1 -1
  48. package/.next/standalone/.next/server/app/api/internal/hooks/upload/route.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/api/internal/monaco/[...path]/route/app-paths-manifest.json +3 -0
  50. package/.next/standalone/.next/server/app/api/internal/monaco/[...path]/route/build-manifest.json +9 -0
  51. package/.next/standalone/.next/server/app/api/internal/monaco/[...path]/route/server-reference-manifest.json +4 -0
  52. package/.next/standalone/.next/server/app/api/internal/monaco/[...path]/route.js +7 -0
  53. package/.next/standalone/.next/server/app/api/internal/monaco/[...path]/route.js.nft.json +1 -0
  54. package/.next/standalone/.next/server/app/api/internal/monaco/[...path]/route_client-reference-manifest.js +3 -0
  55. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/start/route.js +1 -1
  56. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/start/route.js.nft.json +1 -1
  57. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff/route.js +1 -1
  58. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff/route.js.nft.json +1 -1
  59. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff-patch/route.js +1 -1
  60. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff-patch/route.js.nft.json +1 -1
  61. package/.next/standalone/.next/server/app/api/tasks/[taskId]/merge/route.js +1 -1
  62. package/.next/standalone/.next/server/app/api/tasks/[taskId]/merge/route.js.nft.json +1 -1
  63. package/.next/standalone/.next/server/app/index.html +1 -1
  64. package/.next/standalone/.next/server/app/index.rsc +14 -14
  65. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  66. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +14 -14
  67. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
  68. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +9 -9
  69. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  70. package/.next/standalone/.next/server/app/missions/page/react-loadable-manifest.json +1 -1
  71. package/.next/standalone/.next/server/app/missions/page/server-reference-manifest.json +75 -75
  72. package/.next/standalone/.next/server/app/missions/page.js +1 -1
  73. package/.next/standalone/.next/server/app/missions/page.js.nft.json +1 -1
  74. package/.next/standalone/.next/server/app/missions/page_client-reference-manifest.js +1 -1
  75. package/.next/standalone/.next/server/app/onboarding/page/react-loadable-manifest.json +1 -1
  76. package/.next/standalone/.next/server/app/onboarding/page/server-reference-manifest.json +41 -41
  77. package/.next/standalone/.next/server/app/onboarding/page.js +1 -1
  78. package/.next/standalone/.next/server/app/onboarding/page.js.nft.json +1 -1
  79. package/.next/standalone/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  80. package/.next/standalone/.next/server/app/onboarding.html +1 -1
  81. package/.next/standalone/.next/server/app/onboarding.rsc +16 -16
  82. package/.next/standalone/.next/server/app/onboarding.segments/_full.segment.rsc +16 -16
  83. package/.next/standalone/.next/server/app/onboarding.segments/_head.segment.rsc +4 -4
  84. package/.next/standalone/.next/server/app/onboarding.segments/_index.segment.rsc +9 -9
  85. package/.next/standalone/.next/server/app/onboarding.segments/_tree.segment.rsc +1 -1
  86. package/.next/standalone/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +4 -4
  87. package/.next/standalone/.next/server/app/onboarding.segments/onboarding.segment.rsc +3 -3
  88. package/.next/standalone/.next/server/app/page/react-loadable-manifest.json +1 -1
  89. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +41 -41
  90. package/.next/standalone/.next/server/app/page.js +1 -1
  91. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  92. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  93. package/.next/standalone/.next/server/app/settings/page/react-loadable-manifest.json +1 -1
  94. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +54 -54
  95. package/.next/standalone/.next/server/app/settings/page.js +1 -1
  96. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  97. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  98. package/.next/standalone/.next/server/app/settings.html +1 -1
  99. package/.next/standalone/.next/server/app/settings.rsc +16 -16
  100. package/.next/standalone/.next/server/app/settings.segments/_full.segment.rsc +16 -16
  101. package/.next/standalone/.next/server/app/settings.segments/_head.segment.rsc +4 -4
  102. package/.next/standalone/.next/server/app/settings.segments/_index.segment.rsc +9 -9
  103. package/.next/standalone/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  104. package/.next/standalone/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
  105. package/.next/standalone/.next/server/app/settings.segments/settings.segment.rsc +3 -3
  106. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +1 -1
  107. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +94 -94
  108. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page.js +1 -1
  109. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
  110. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
  111. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +1 -1
  112. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +82 -82
  113. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page.js +1 -1
  114. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
  115. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
  116. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +1 -1
  117. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +73 -73
  118. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page.js +1 -1
  119. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
  120. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
  121. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +1 -1
  122. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +70 -70
  123. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js +1 -1
  124. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
  125. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
  126. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +1 -1
  127. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +41 -41
  128. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js +1 -1
  129. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
  130. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
  131. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/react-loadable-manifest.json +1 -1
  132. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/server-reference-manifest.json +74 -74
  133. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page.js +1 -1
  134. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page.js.nft.json +1 -1
  135. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page_client-reference-manifest.js +1 -1
  136. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +2 -2
  137. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +88 -88
  138. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js +1 -1
  139. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
  140. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  141. package/.next/standalone/.next/server/app/workspaces/page/react-loadable-manifest.json +1 -1
  142. package/.next/standalone/.next/server/app/workspaces/page/server-reference-manifest.json +59 -59
  143. package/.next/standalone/.next/server/app/workspaces/page.js +1 -1
  144. package/.next/standalone/.next/server/app/workspaces/page.js.nft.json +1 -1
  145. package/.next/standalone/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
  146. package/.next/standalone/.next/server/app-paths-manifest.json +1 -0
  147. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0hrprmi.js +1 -1
  148. package/.next/standalone/.next/server/chunks/[externals]__12any6r._.js +3 -0
  149. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0oc0p.b._.js → [root-of-the-server]__0.0.jeg._.js} +2 -2
  150. package/.next/standalone/.next/server/chunks/[root-of-the-server]__03j20vp._.js +2 -2
  151. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05se6yk._.js +4 -0
  152. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05~g1fm._.js +3 -0
  153. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__087s5zn._.js → [root-of-the-server]__0ag-i9m._.js} +2 -2
  154. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__09pc-71._.js → [root-of-the-server]__0d1dj18._.js} +3 -3
  155. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0u7f9y0._.js → [root-of-the-server]__0g2lv9x._.js} +2 -2
  156. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0i8.umh._.js → [root-of-the-server]__0ge1~qa._.js} +2 -2
  157. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0wotir9._.js → [root-of-the-server]__0jf72nm._.js} +5 -5
  158. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0otyifi._.js +1 -1
  159. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__08v2air._.js → [root-of-the-server]__0pg9aea._.js} +3 -3
  160. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0r0nj9k._.js → [root-of-the-server]__0q.piu~._.js} +3 -3
  161. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0s__pv8._.js +4 -0
  162. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0sfk~2k._.js +3 -0
  163. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0umocfj._.js +1 -1
  164. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0z-k6vg._.js +1 -1
  165. package/.next/standalone/.next/server/chunks/[root-of-the-server]__124i0i-._.js +3 -0
  166. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_internal_monaco_[___path]_route_actions_02u8e7k.js +3 -0
  167. package/.next/standalone/.next/server/chunks/src_0bkvm8c._.js +1 -1
  168. package/.next/standalone/.next/server/chunks/ssr/0iu._[workspaceId]_projects_[projectId]_versions_version-timeline-client_tsx_07o_kyi._.js +1 -1
  169. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0.bvw5b._.js +1 -1
  170. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__046r30r._.js → [root-of-the-server]__06zyaub._.js} +2 -2
  171. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0f6jg2_._.js +1 -1
  172. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0gaiasa._.js +1 -1
  173. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0gzi6v8._.js +3 -0
  174. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0n-4zp8._.js +1 -1
  175. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0k23.h1._.js → [root-of-the-server]__0oht3x8._.js} +2 -2
  176. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ps55l6._.js +1 -1
  177. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0snkwkk._.js +1 -1
  178. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0vk3eou._.js +1 -1
  179. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0vqar.7._.js +1 -1
  180. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__11dfb6z._.js → [root-of-the-server]__0xg37gu._.js} +2 -2
  181. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0yr--da._.js +1 -1
  182. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0~8i4lj._.js +1 -1
  183. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__10yxmur._.js +1 -1
  184. package/.next/standalone/.next/server/chunks/ssr/{_0ome.i4._.js → _0-anjz4._.js} +2 -2
  185. package/.next/standalone/.next/server/chunks/ssr/{_0mvc5xq._.js → _05_bfrg._.js} +2 -2
  186. package/.next/standalone/.next/server/chunks/ssr/_05h.8a~._.js +1 -1
  187. package/.next/standalone/.next/server/chunks/ssr/{_0w3~ri1._.js → _065qc4e._.js} +2 -2
  188. package/.next/standalone/.next/server/chunks/ssr/_06gydyh._.js +7 -0
  189. package/.next/standalone/.next/server/chunks/ssr/_06sgp6h._.js +1 -1
  190. package/.next/standalone/.next/server/chunks/ssr/_0_l8.dg._.js +1 -1
  191. package/.next/standalone/.next/server/chunks/ssr/_0cj9a7y._.js +1 -1
  192. package/.next/standalone/.next/server/chunks/ssr/_0h~yckx._.js +1 -1
  193. package/.next/standalone/.next/server/chunks/ssr/_0i4__mf._.js +1 -1
  194. package/.next/standalone/.next/server/chunks/ssr/_0kkxrcc._.js +1 -1
  195. package/.next/standalone/.next/server/chunks/ssr/{_0v_1aum._.js → _0l-ci5f._.js} +2 -2
  196. package/.next/standalone/.next/server/chunks/ssr/{_0nbldfa._.js → _0ov6bwe._.js} +2 -2
  197. package/.next/standalone/.next/server/chunks/ssr/_0qxei2o._.js +7 -0
  198. package/.next/standalone/.next/server/chunks/ssr/{_0s10w76._.js → _0tb98gb._.js} +2 -2
  199. package/.next/standalone/.next/server/chunks/ssr/{_0istl17._.js → _0v53yq7._.js} +2 -2
  200. package/.next/standalone/.next/server/chunks/ssr/_0wvv86n._.js +1 -1
  201. package/.next/standalone/.next/server/chunks/ssr/_0xrgx~o._.js +1 -1
  202. package/.next/standalone/.next/server/chunks/ssr/_0ze9ezr._.js +7 -0
  203. package/.next/standalone/.next/server/chunks/ssr/_0~80adm._.js +3 -3
  204. package/.next/standalone/.next/server/chunks/ssr/_10dvolb._.js +1 -1
  205. package/.next/standalone/.next/server/chunks/ssr/{_0bxf9ev._.js → _12o7r.n._.js} +2 -2
  206. package/.next/standalone/.next/server/chunks/ssr/src_0eufeyj._.js +1 -1
  207. package/.next/standalone/.next/server/chunks/ssr/src_0j_1~da._.js +3 -3
  208. package/.next/standalone/.next/server/chunks/ssr/src_13jha60._.js +1 -1
  209. package/.next/standalone/.next/server/chunks/ssr/src_actions_agent-actions_ts_0~wc.sy._.js +1 -1
  210. package/.next/standalone/.next/server/chunks/ssr/src_actions_file-actions_ts_0gcvqwm._.js +1 -1
  211. package/.next/standalone/.next/server/chunks/ssr/src_actions_search-code-actions_ts_0k9u5d~._.js +1 -1
  212. package/.next/standalone/.next/server/chunks/ssr/src_app_missions_missions-client_tsx_11429lj._.js +1 -1
  213. package/.next/standalone/.next/server/chunks/ssr/src_app_onboarding_page_tsx_0xf7hpz._.js +1 -1
  214. package/.next/standalone/.next/server/chunks/ssr/src_app_settings_page_tsx_0h9v7dr._.js +1 -1
  215. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0wyzpam._.js +1 -1
  216. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_board-page-client_tsx_0gips66._.js +1 -1
  217. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_02t7blt._.js +1 -1
  218. package/.next/standalone/.next/server/functions-config-manifest.json +1 -0
  219. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  220. package/.next/standalone/.next/server/pages/404.html +1 -1
  221. package/.next/standalone/.next/server/pages/500.html +1 -1
  222. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  223. package/.next/standalone/.next/server/server-reference-manifest.json +288 -288
  224. package/.next/standalone/.next/static/chunks/{00l2hb0-8vqxa.js → 040v3khsfu0lz.js} +2 -2
  225. package/.next/standalone/.next/static/chunks/{11qxjwptzbka2.js → 05mx9brj-f8gw.js} +1 -1
  226. package/.next/standalone/.next/static/chunks/0600r~b6rdg~2.js +1 -0
  227. package/.next/standalone/.next/static/chunks/{10m3b0915q6yz.js → 0666bg18.a5h8.js} +1 -1
  228. package/.next/standalone/.next/static/chunks/{0zvvx~xakrlk3.js → 078tkiwi_e..w.js} +1 -1
  229. package/.next/standalone/.next/static/chunks/{07pvcpi6zp562.js → 09nbrak~rje1..js} +2 -2
  230. package/.next/standalone/.next/static/chunks/{0gw.5-0.yxwx-.js → 0_8g669_.94gk.js} +1 -1
  231. package/.next/standalone/.next/static/chunks/{0q6i.u46oj3et.js → 0c.9g9ugtt_fi.js} +1 -1
  232. package/.next/standalone/.next/static/chunks/{11fsu1zog.5r2.js → 0caf_e5zdgl2s.js} +2 -2
  233. package/.next/standalone/.next/static/chunks/{0wuryio392ep..js → 0dbel03y5wo85.js} +1 -1
  234. package/.next/standalone/.next/static/chunks/0g62a2i4hk0pj.js +1 -0
  235. package/.next/standalone/.next/static/chunks/{08xj788_-g4ro.js → 0i84hdhbjwxv3.js} +1 -1
  236. package/.next/standalone/.next/static/chunks/0j94ru7oloqhp.js +1 -0
  237. package/.next/standalone/.next/static/chunks/0k02g-ep3ca11.js +1 -0
  238. package/.next/standalone/.next/static/chunks/{0vg7vvvpc41pt.js → 0kqksl8_mibg1.js} +1 -1
  239. package/.next/standalone/.next/static/chunks/{0qx8zbx8~0kzb.js → 0lve_d~~~n7y4.js} +1 -1
  240. package/.next/standalone/.next/static/chunks/{0xw4lc5b8_ksq.js → 0m7mzooex9.cp.js} +1 -1
  241. package/.next/standalone/.next/static/chunks/{0v5-g5xtcj48u.js → 0my~5x9vknsv2.js} +1 -1
  242. package/.next/standalone/.next/static/chunks/{17fjz63sudhsi.js → 0nsoo.df~w7ez.js} +2 -2
  243. package/.next/standalone/.next/static/chunks/{162.req.5srx1.js → 0unk0vfgdc4b1.js} +1 -1
  244. package/.next/standalone/.next/static/chunks/{0.8v0ovyop-~2.js → 0xfk375kd_~b3.js} +1 -1
  245. package/.next/standalone/package.json +1 -1
  246. package/bin/tower.mjs +57 -1
  247. package/package.json +1 -1
  248. package/.next/standalone/.next/server/chunks/[externals]__07308ej._.js +0 -3
  249. package/.next/standalone/.next/server/chunks/[root-of-the-server]__04qke1x._.js +0 -4
  250. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qif839._.js +0 -4
  251. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0rvsc5q._.js +0 -3
  252. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0stmn6n._.js +0 -3
  253. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__06fz814._.js +0 -3
  254. package/.next/standalone/.next/server/chunks/ssr/_0cf4wa5._.js +0 -7
  255. package/.next/standalone/.next/server/chunks/ssr/_0nia_eb._.js +0 -7
  256. package/.next/standalone/.next/server/chunks/ssr/_0pgn51u._.js +0 -7
  257. package/.next/standalone/.next/static/chunks/0x-x1fbxj_xqd.js +0 -1
  258. package/.next/standalone/.next/static/chunks/0y5a_8x-kzjh~.js +0 -1
  259. package/.next/standalone/.next/static/chunks/1633lyb6elnxv.js +0 -1
  260. package/.next/standalone/.next/static/chunks/184w42tfqip9h.js +0 -1
  261. /package/.next/standalone/.next/static/{_ZiE8oD76fu2E6vKTuPlS → 9NXMylL5Ks4ehg3RIDVt3}/_buildManifest.js +0 -0
  262. /package/.next/standalone/.next/static/{_ZiE8oD76fu2E6vKTuPlS → 9NXMylL5Ks4ehg3RIDVt3}/_clientMiddlewareManifest.js +0 -0
  263. /package/.next/standalone/.next/static/{_ZiE8oD76fu2E6vKTuPlS → 9NXMylL5Ks4ehg3RIDVt3}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[919647,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(704494),e=a.i(865011),f=a.i(951192),g=a.i(493563),h=a.i(780410);let i=(0,h.createServerReference)("40eac2d3c2ae34fcddf408ca48183e6394d1c9f92f",h.callServer,void 0,h.findSourceMapURL,"getProjectAssets");var j=a.i(347165),k=a.i(579834),l=a.i(350739),m=a.i(509405),n=a.i(975231),o=a.i(699570);function p(a){let b=a.match(/(?:^|\/)(?:storage|data)\/assets\/([^/]+)\/([^/]+)$/);return b?`/api/files/assets/${b[1]}/${b[2]}`:a}function q({asset:a,onPreview:c,onReveal:d,onDelete:e,onTaskClick:g}){var h;let{t:i}=(0,f.useI18n)(),k=p(a.path),r=a.mimeType?.startsWith("image/");return(0,b.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,b.jsx)(o.Button,{variant:"ghost",onClick:()=>c(a),className:"flex-shrink-0 cursor-pointer p-0 h-auto",children:r?(0,b.jsx)("img",{src:k,alt:a.filename,className:"h-12 w-12 rounded object-cover border border-border"}):(0,b.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded border border-border bg-muted",children:(0,b.jsx)(l.FileText,{className:"h-6 w-6 text-muted-foreground"})})}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("p",{className:"truncate text-sm font-medium text-foreground",children:a.filename}),a.taskTitle&&a.taskId&&(0,b.jsx)(o.Button,{variant:"ghost",onClick:b=>{b.stopPropagation(),g?.(a.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:a.taskTitle.length>20?`[任务: ${a.taskTitle.slice(0,20)}...]`:`[任务: ${a.taskTitle}]`})]}),a.description&&(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground truncate",children:a.description}),(0,b.jsxs)("div",{className:"mt-0.5 flex items-center gap-3 text-xs text-muted-foreground",children:[(0,b.jsx)("span",{children:null===(h=a.size)?"-":h<1024?`${h} B`:h<1048576?`${(h/1024).toFixed(1)} KB`:h<0x40000000?`${(h/1048576).toFixed(1)} MB`:`${(h/0x40000000).toFixed(1)} GB`}),(0,b.jsx)("span",{children:new Date(a.createdAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",onClick:()=>c(a),className:"text-muted-foreground","aria-label":i("assets.preview"),children:(0,b.jsx)(m.Eye,{className:"h-4 w-4"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",onClick:()=>d(a),className:"text-muted-foreground","aria-label":i("assets.revealInFinder"),children:(0,b.jsx)(j.FolderOpen,{className:"h-4 w-4"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",onClick:()=>e(a.id),className:"text-muted-foreground hover:text-rose-400","aria-label":i("assets.delete"),children:(0,b.jsx)(n.Trash2,{className:"h-4 w-4"})})]})]})}function r({assets:a,onPreview:c,onReveal:d,onDelete:e,onTaskClick:g}){let{t:h}=(0,f.useI18n)();return 0===a.length?(0,b.jsx)(k.EmptyState,{icon:j.FolderOpen,title:h("assets.empty"),description:h("assets.emptyHint")}):(0,b.jsx)("div",{className:"flex flex-col gap-3",children:a.map(a=>(0,b.jsx)(q,{asset:a,onPreview:c,onReveal:d,onDelete:e,onTaskClick:g},a.id))})}var s=a.i(324954),t=a.i(54384),u=a.i(41348),v=a.i(429246),w=a.i(580701);function x({allWorkspaces:a,initialWsId:d,initialProjectId:e,onUploaded:g}){let h,{t:i}=(0,f.useI18n)(),j=(0,c.useRef)(null),[k,l]=(0,c.useState)(!1),[m,n]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null),[r,y]=(0,c.useState)(d),[z,A]=(0,c.useState)(e),[B,C]=(0,c.useState)(""),D=a.find(a=>a.id===r),E=D?.projects??[],F=()=>{l(!1),q(null),j.current&&(j.current.value="")},G=async()=>{if(p&&z){n(!0);try{let a=new FormData;a.append("file",p),a.append("projectId",z),a.append("description",B.trim()),await (0,u.uploadAsset)(a),g(z),F()}finally{n(!1)}}};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(o.Button,{onClick:()=>{y(d),A(e),q(null),C(""),l(!0)},className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[(0,b.jsx)(s.Upload,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:i("assets.upload")})]}),k&&(0,b.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,b.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:F}),(0,b.jsxs)("div",{className:"relative w-full max-w-md rounded-lg border border-border bg-card p-6 shadow-lg",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:F,className:"absolute right-3 top-3 text-muted-foreground",children:(0,b.jsx)(t.X,{className:"h-4 w-4"})}),(0,b.jsx)("h3",{className:"text-sm font-semibold text-foreground mb-4",children:i("assets.uploadTitle")}),(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0",children:i("assets.workspace")}),(0,b.jsxs)(w.Select,{value:r,onValueChange:b=>{var c;let d;return y(c=b??""),d=a.find(a=>a.id===c),void A(d?.projects[0]?.id??null)},children:[(0,b.jsx)(w.SelectTrigger,{className:"flex-1 text-xs",children:(0,b.jsx)("span",{className:"truncate",children:D?.name??r})}),(0,b.jsx)(w.SelectContent,{children:a.map(a=>(0,b.jsx)(w.SelectItem,{value:a.id,children:a.name},a.id))})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0",children:i("assets.project")}),E.length>0?(0,b.jsxs)(w.Select,{value:z??"",onValueChange:a=>A(a??""),children:[(0,b.jsx)(w.SelectTrigger,{className:"flex-1 text-xs",children:(0,b.jsx)("span",{className:"truncate",children:(h=E.find(a=>a.id===z))?h.alias?`${h.name} (${h.alias})`:h.name:z})}),(0,b.jsx)(w.SelectContent,{children:E.map(a=>{let c=a.alias?`${a.name} (${a.alias})`:a.name;return(0,b.jsx)(w.SelectItem,{value:a.id,children:c},a.id)})})]}):(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:i("assets.noProject")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0",children:i("assets.file")}),(0,b.jsx)("input",{type:"file",ref:j,onChange:a=>{q(a.target.files?.[0]??null)},className:"hidden"}),(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>{j.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:p?p.name:i("assets.selectFile")})]}),(0,b.jsxs)("div",{className:"flex items-start gap-3",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0 pt-1.5",children:i("assets.description")}),(0,b.jsx)(v.Textarea,{value:B,onChange:a=>C(a.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,b.jsxs)("div",{className:"flex items-center gap-2 justify-end mt-6",children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:F,children:i("notes.cancel")}),(0,b.jsx)(o.Button,{onClick:G,disabled:!p||!z||!B.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 y=a.i(986099),z=a.i(912868),A=a.i(10390),B=a.i(91756);let C=(0,a.i(711796).default)("chevrons-right",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);var D=a.i(161664);function E({imageUrl:a,filename:d,open:e,onOpenChange:g,assets:h,currentIndex:i,onIndexChange:j}){let{t:k}=(0,f.useI18n)(),[l,m]=(0,c.useState)(1),[n,o]=(0,c.useState)({x:0,y:0}),[p,q]=(0,c.useState)(!1),r=(0,c.useRef)(null),[s,u]=(0,c.useState)(!1),v=!!h&&h.length>1&&"number"==typeof i&&!!j,w=v&&i>0,x=v&&i<h.length-1,G=v?h.length:0,H=G>0?Math.ceil(G/10):0,I=v?Math.floor(i/10):0,J=10*I,K=Math.min(J+10,G),L=H>1,M=v&&I>0,N=v&&I<H-1;(0,c.useEffect)(()=>{u(!0)},[]),(0,c.useEffect)(()=>{m(1),o({x:0,y:0})},[a]),(0,c.useEffect)(()=>{if(!e)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[e]);let O=(0,c.useCallback)(()=>g(!1),[g]),P=(0,c.useCallback)(()=>{v&&w&&j(i-1)},[v,w,j,i]),Q=(0,c.useCallback)(()=>{v&&x&&j(i+1)},[v,x,j,i]),R=(0,c.useCallback)(()=>{v&&M&&j((I-1)*10)},[v,M,j,I]),S=(0,c.useCallback)(()=>{v&&N&&j(Math.min((I+1)*10,G-1))},[v,N,j,I,G]),T=(0,c.useCallback)(()=>{m(a=>Math.min(8,1.25*a))},[]),U=(0,c.useCallback)(()=>{m(a=>{let b=Math.max(.1,a/1.25);return b<=1&&o({x:0,y:0}),b})},[]),V=(0,c.useCallback)(()=>{m(1),o({x:0,y:0})},[]);(0,c.useEffect)(()=>{if(!e)return;let a=a=>{switch(a.key){case"Escape":a.preventDefault(),O();break;case"ArrowLeft":v&&(a.preventDefault(),P());break;case"ArrowRight":v&&(a.preventDefault(),Q());break;case"+":case"=":a.preventDefault(),T();break;case"-":case"_":a.preventDefault(),U();break;case"0":a.preventDefault(),V()}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e,v,O,P,Q,T,U,V]);let W=(0,c.useRef)(!1),X=()=>{p&&q(!1),r.current=null},Y=p?"cursor-grabbing":"cursor-grab";if(!e||!s)return null;let Z=(0,b.jsxs)("div",{className:"fixed inset-0 z-[100] bg-black/70 dark:bg-black/40 backdrop-blur-md",role:"dialog","aria-modal":"true","aria-label":k("assets.lightbox.zoomFit"),children:[(0,b.jsxs)("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 max-w-[80vw] truncate rounded-md bg-black/40 px-3 py-1 text-xs text-white/80 backdrop-blur-sm pointer-events-none",children:[d,v?` \xb7 ${i+1} / ${h.length}`:""]}),(0,b.jsx)("div",{className:`absolute inset-0 flex items-center justify-center overflow-hidden select-none ${Y}`,onClick:a=>{a.target===a.currentTarget&&O()},onWheel:a=>{a.preventDefault();let b=-a.deltaY>0?1.25:.8;m(a=>{let c=Math.min(8,Math.max(.1,a*b));return c<=1&&o({x:0,y:0}),c})},children:a&&(0,b.jsx)("img",{src:a,alt:d,onClick:a=>{a.stopPropagation(),W.current&&(W.current=!1)},onPointerDown:a=>{0===a.button&&(a.stopPropagation(),W.current=!1,a.target.setPointerCapture?.(a.pointerId),r.current={x:a.clientX,y:a.clientY,panX:n.x,panY:n.y},q(!0))},onPointerMove:a=>{if(!r.current)return;let b=a.clientX-r.current.x,c=a.clientY-r.current.y;Math.abs(b)+Math.abs(c)>5&&(W.current=!0),p&&o({x:r.current.panX+b,y:r.current.panY+c})},onPointerUp:X,onPointerLeave:X,onPointerCancel:X,className:"max-h-[88vh] max-w-[92vw] object-contain pointer-events-auto",style:{transform:`translate3d(${n.x}px, ${n.y}px, 0) scale(${l})`,transformOrigin:"center center",transition:p?"none":"transform 120ms ease-out",willChange:p?"transform":"auto"},draggable:!1})}),(0,b.jsxs)("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-10 flex flex-col items-center gap-2 max-w-[92vw]",onClick:a=>a.stopPropagation(),children:[v&&(0,b.jsxs)("div",{className:"flex items-center gap-1 rounded-lg bg-black/50 px-1.5 py-1.5 backdrop-blur-md ring-1 ring-white/10 max-w-[92vw]",children:[L&&(0,b.jsx)(F,{onClick:R,title:`${k("assets.lightbox.prev")} (-10)`,"aria-label":`${k("assets.lightbox.prev")} (-10)`,disabled:!M,children:(0,b.jsx)(B.ChevronsLeft,{className:"h-4 w-4"})}),(0,b.jsx)(F,{onClick:P,title:k("assets.lightbox.prev"),"aria-label":k("assets.lightbox.prev"),disabled:!w,children:(0,b.jsx)(z.ChevronLeft,{className:"h-4 w-4"})}),(0,b.jsx)("div",{className:"flex items-center gap-1.5",children:h.slice(J,K).map((a,c)=>{let d=J+c,e=d===i;return(0,b.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),e||j(d)},title:a.filename,className:`shrink-0 h-12 w-12 overflow-hidden rounded-md transition-all ${e?"ring-2 ring-white opacity-100 scale-105":"opacity-60 hover:opacity-100 ring-1 ring-white/20"}`,children:(0,b.jsx)("img",{src:a.url,alt:a.filename,className:"h-full w-full object-cover",loading:"lazy",draggable:!1})},a.url+d)})}),(0,b.jsx)(F,{onClick:Q,title:k("assets.lightbox.next"),"aria-label":k("assets.lightbox.next"),disabled:!x,children:(0,b.jsx)(A.ChevronRight,{className:"h-4 w-4"})}),L&&(0,b.jsx)(F,{onClick:S,title:`${k("assets.lightbox.next")} (+10)`,"aria-label":`${k("assets.lightbox.next")} (+10)`,disabled:!N,children:(0,b.jsx)(C,{className:"h-4 w-4"})})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 rounded-lg bg-black/50 px-2 py-1.5 backdrop-blur-md ring-1 ring-white/10",children:[(0,b.jsxs)("span",{className:"px-2 text-xs text-white/80 tabular-nums select-none min-w-12 text-center",children:[Math.round(100*l),"%"]}),(0,b.jsx)(F,{onClick:V,title:k("assets.lightbox.reset"),"aria-label":k("assets.lightbox.reset"),disabled:1===l&&0===n.x&&0===n.y,children:(0,b.jsx)(D.RotateCcw,{className:"h-4 w-4"})}),(0,b.jsx)("div",{className:"mx-1 h-5 w-px bg-white/20"}),(0,b.jsx)(F,{onClick:O,title:k("assets.lightbox.close"),"aria-label":k("assets.lightbox.close"),children:(0,b.jsx)(t.X,{className:"h-4 w-4"})})]})]})]});return(0,y.createPortal)(Z,document.body)}function F({children:a,onClick:c,title:d,disabled:e,...f}){return(0,b.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),e||c()},title:d,disabled:e,className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-white/80 hover:bg-white/15 hover:text-white disabled:opacity-30 disabled:hover:bg-transparent disabled:hover:text-white/80 transition-colors",...f,children:a})}a.i(757942);var G=a.i(950314),H=a.i(814574);function I({url:a,filename:e,open:g,onOpenChange:h}){let{t:i}=(0,f.useI18n)(),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)(!1),[n,o]=(0,c.useState)(null);(0,c.useEffect)(()=>{if(!g||!a){k(null),o(null);return}let b=!1;return m(!0),o(null),k(null),fetch(a).then(a=>{let b=a.headers.get("content-length");if(b&&parseInt(b,10)>1048576)throw Error("FILE_TOO_LARGE");return a.text()}).then(a=>{if(a.length>1048576)throw Error("FILE_TOO_LARGE");b||(k(a),m(!1))}).catch(a=>{b||(a instanceof Error&&"FILE_TOO_LARGE"===a.message?o(i("assets.fileTooLarge")):o(i("assets.previewError")),m(!1))}),()=>{b=!0}},[g,a,i]);let p=e.split(".").pop()?.toLowerCase();return(0,b.jsx)(H.Dialog,{open:g,onOpenChange:h,children:(0,b.jsxs)(H.DialogContent,{className:"w-[min(960px,92vw)] max-w-none sm:max-w-none h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0",children:[(0,b.jsx)("h3",{className:"text-sm font-medium truncate px-5 py-3 border-b border-border/50",children:e}),(0,b.jsx)("div",{className:"flex-1 overflow-auto px-5 py-4",children:(()=>{if(l)return(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 gap-2",children:[(0,b.jsx)(d.Loader2,{className:"size-5 animate-spin text-muted-foreground"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:i("assets.loadingPreview")})]});if(n)return(0,b.jsx)("p",{className:"text-sm text-destructive",children:n});if(null===j)return null;if("md"===p)return(0,b.jsx)("div",{className:"text-sm leading-relaxed",children:(0,b.jsx)(G.Streamdown,{children:j})});if("json"===p){let a;try{a=JSON.stringify(JSON.parse(j),null,2)}catch{a=j}return(0,b.jsx)("pre",{className:"font-mono text-xs whitespace-pre-wrap text-foreground",children:a})}return(0,b.jsx)("pre",{className:"font-mono text-sm whitespace-pre-wrap text-foreground",children:j})})()})]})})}var J=a.i(972420),K=a.i(952313);a.s(["AssetsPageClient",0,function({allWorkspaces:a,initialWorkspaceId:h,initialProjectId:j,initialAssets:k}){let l,{t:m}=(0,f.useI18n)(),[n,o]=(0,c.useTransition)(),[q,s]=(0,c.useState)(h),[t,u]=(0,c.useState)(j),[v,y]=(0,c.useState)(k),[z,A]=(0,c.useState)(null),B=a.find(a=>a.id===q),C=B?.projects??[],D=(0,c.useCallback)(a=>{a?o(async()=>{y(await i(a))}):y([])},[o]),[F,G]=(0,c.useState)(null),H=F?F.mimeType?.startsWith("image/")?"image":/\.(txt|md|json)$/i.test(F.filename)?"text":null:null,L=v.filter(a=>a.mimeType?.startsWith("image/")).map(a=>({id:a.id,url:p(a.path),filename:a.filename})),M=F?L.findIndex(a=>a.id===F.id):-1,N=async a=>{try{let b=await fetch("/api/internal/assets/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a.path})});if(!b.ok){let a=await b.json().catch(()=>({}));K.toast.error(a.error||"Failed to reveal file")}}catch{K.toast.error("Failed to reveal file")}},O=async a=>{let b=v.find(b=>b.id===a);confirm(m("assets.deleteConfirm",{filename:b?.filename??a}))&&(await (0,g.deleteAsset)(a),D(t))};return(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsx)(e.SubPageNav,{workspaceId:q}),(0,b.jsxs)("div",{className:"header-sm flex items-center gap-3 px-6 py-2",children:[(0,b.jsxs)(w.Select,{value:q,onValueChange:b=>b&&(b=>{if(b===q)return;s(b);let c=a.find(a=>a.id===b),d=c?.projects[0]??null;u(d?.id??null),D(d?.id??null)})(b),children:[(0,b.jsx)(w.SelectTrigger,{className:"h-8 w-auto min-w-[120px]",children:(0,b.jsx)("span",{className:"truncate",children:a.find(a=>a.id===q)?.name??q})}),(0,b.jsx)(w.SelectContent,{children:a.map(a=>(0,b.jsx)(w.SelectItem,{value:a.id,children:a.name},a.id))})]}),C.length>0&&(0,b.jsxs)(w.Select,{value:t??"",onValueChange:a=>a&&void(a!==t&&(u(a),D(a))),children:[(0,b.jsx)(w.SelectTrigger,{className:"h-8 w-auto min-w-[140px]",children:(0,b.jsx)("span",{className:"truncate",children:(l=C.find(a=>a.id===t))?l.alias?`${l.name} (${l.alias})`:l.name:""})}),(0,b.jsx)(w.SelectContent,{children:C.map(a=>(0,b.jsxs)(w.SelectItem,{value:a.id,children:[a.name,a.alias?` (${a.alias})`:""]},a.id))})]}),(0,b.jsx)("div",{className:"ml-auto",children:(0,b.jsx)(x,{allWorkspaces:a,initialWsId:q,initialProjectId:t,onUploaded:a=>{a===t&&D(t)}})})]}),(0,b.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4",children:(0,b.jsxs)("div",{className:`relative ${n?"opacity-40 pointer-events-none":""} transition-opacity`,children:[n&&(0,b.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:(0,b.jsx)(d.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}),0===C.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-16 text-center",children:[(0,b.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:m("assets.noProject")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60",children:m("assets.noProjectHint")})]}):(0,b.jsx)(r,{assets:v.map(a=>({...a,taskId:a.task?.id??null,taskTitle:a.task?.title??null})),onPreview:a=>{let b=a.mimeType?.startsWith("image/"),c=/\.(txt|md|json)$/i.test(a.filename);(b||c)&&G(a)},onReveal:N,onDelete:O,onTaskClick:A})]})}),(0,b.jsx)(E,{imageUrl:"image"===H&&M>=0?L[M].url:null,filename:"image"===H&&M>=0?L[M].filename:"",open:"image"===H,onOpenChange:a=>{a||G(null)},assets:L.map(({url:a,filename:b})=>({url:a,filename:b})),currentIndex:M>=0?M:void 0,onIndexChange:a=>{let b=L[a];if(!b)return;let c=v.find(a=>a.id===b.id);c&&G({...c,taskId:c.task?.id??null,taskTitle:c.task?.title??null})}}),(0,b.jsx)(I,{url:"text"===H&&F?p(F.path):null,filename:F?.filename??"",open:"text"===H,onOpenChange:a=>{a||G(null)}}),(0,b.jsx)(J.TaskOverviewDrawer,{open:!!z,onOpenChange:a=>{a||A(null)},taskId:z})]})}],919647)}];
1
+ module.exports=[919647,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(704494),e=a.i(865011),f=a.i(951192),g=a.i(226918),h=a.i(780410);let i=(0,h.createServerReference)("404cd55c8e86de5b708ddeb965dc346ae799e948c4",h.callServer,void 0,h.findSourceMapURL,"getProjectAssets");var j=a.i(347165),k=a.i(579834),l=a.i(350739),m=a.i(509405),n=a.i(975231),o=a.i(699570);function p(a){let b=a.match(/(?:^|\/)(?:storage|data)\/assets\/([^/]+)\/([^/]+)$/);return b?`/api/files/assets/${b[1]}/${b[2]}`:a}function q({asset:a,onPreview:c,onReveal:d,onDelete:e,onTaskClick:g}){var h;let{t:i}=(0,f.useI18n)(),k=p(a.path),r=a.mimeType?.startsWith("image/");return(0,b.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,b.jsx)(o.Button,{variant:"ghost",onClick:()=>c(a),className:"flex-shrink-0 cursor-pointer p-0 h-auto",children:r?(0,b.jsx)("img",{src:k,alt:a.filename,className:"h-12 w-12 rounded object-cover border border-border"}):(0,b.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded border border-border bg-muted",children:(0,b.jsx)(l.FileText,{className:"h-6 w-6 text-muted-foreground"})})}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("p",{className:"truncate text-sm font-medium text-foreground",children:a.filename}),a.taskTitle&&a.taskId&&(0,b.jsx)(o.Button,{variant:"ghost",onClick:b=>{b.stopPropagation(),g?.(a.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:a.taskTitle.length>20?`[任务: ${a.taskTitle.slice(0,20)}...]`:`[任务: ${a.taskTitle}]`})]}),a.description&&(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground truncate",children:a.description}),(0,b.jsxs)("div",{className:"mt-0.5 flex items-center gap-3 text-xs text-muted-foreground",children:[(0,b.jsx)("span",{children:null===(h=a.size)?"-":h<1024?`${h} B`:h<1048576?`${(h/1024).toFixed(1)} KB`:h<0x40000000?`${(h/1048576).toFixed(1)} MB`:`${(h/0x40000000).toFixed(1)} GB`}),(0,b.jsx)("span",{children:new Date(a.createdAt).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",onClick:()=>c(a),className:"text-muted-foreground","aria-label":i("assets.preview"),children:(0,b.jsx)(m.Eye,{className:"h-4 w-4"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",onClick:()=>d(a),className:"text-muted-foreground","aria-label":i("assets.revealInFinder"),children:(0,b.jsx)(j.FolderOpen,{className:"h-4 w-4"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",onClick:()=>e(a.id),className:"text-muted-foreground hover:text-rose-400","aria-label":i("assets.delete"),children:(0,b.jsx)(n.Trash2,{className:"h-4 w-4"})})]})]})}function r({assets:a,onPreview:c,onReveal:d,onDelete:e,onTaskClick:g}){let{t:h}=(0,f.useI18n)();return 0===a.length?(0,b.jsx)(k.EmptyState,{icon:j.FolderOpen,title:h("assets.empty"),description:h("assets.emptyHint")}):(0,b.jsx)("div",{className:"flex flex-col gap-3",children:a.map(a=>(0,b.jsx)(q,{asset:a,onPreview:c,onReveal:d,onDelete:e,onTaskClick:g},a.id))})}var s=a.i(324954),t=a.i(54384),u=a.i(161083),v=a.i(429246),w=a.i(580701);function x({allWorkspaces:a,initialWsId:d,initialProjectId:e,onUploaded:g}){let h,{t:i}=(0,f.useI18n)(),j=(0,c.useRef)(null),[k,l]=(0,c.useState)(!1),[m,n]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null),[r,y]=(0,c.useState)(d),[z,A]=(0,c.useState)(e),[B,C]=(0,c.useState)(""),D=a.find(a=>a.id===r),E=D?.projects??[],F=()=>{l(!1),q(null),j.current&&(j.current.value="")},G=async()=>{if(p&&z){n(!0);try{let a=new FormData;a.append("file",p),a.append("projectId",z),a.append("description",B.trim()),await (0,u.uploadAsset)(a),g(z),F()}finally{n(!1)}}};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(o.Button,{onClick:()=>{y(d),A(e),q(null),C(""),l(!0)},className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[(0,b.jsx)(s.Upload,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:i("assets.upload")})]}),k&&(0,b.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,b.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:F}),(0,b.jsxs)("div",{className:"relative w-full max-w-md rounded-lg border border-border bg-card p-6 shadow-lg",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:F,className:"absolute right-3 top-3 text-muted-foreground",children:(0,b.jsx)(t.X,{className:"h-4 w-4"})}),(0,b.jsx)("h3",{className:"text-sm font-semibold text-foreground mb-4",children:i("assets.uploadTitle")}),(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0",children:i("assets.workspace")}),(0,b.jsxs)(w.Select,{value:r,onValueChange:b=>{var c;let d;return y(c=b??""),d=a.find(a=>a.id===c),void A(d?.projects[0]?.id??null)},children:[(0,b.jsx)(w.SelectTrigger,{className:"flex-1 text-xs",children:(0,b.jsx)("span",{className:"truncate",children:D?.name??r})}),(0,b.jsx)(w.SelectContent,{children:a.map(a=>(0,b.jsx)(w.SelectItem,{value:a.id,children:a.name},a.id))})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0",children:i("assets.project")}),E.length>0?(0,b.jsxs)(w.Select,{value:z??"",onValueChange:a=>A(a??""),children:[(0,b.jsx)(w.SelectTrigger,{className:"flex-1 text-xs",children:(0,b.jsx)("span",{className:"truncate",children:(h=E.find(a=>a.id===z))?h.alias?`${h.name} (${h.alias})`:h.name:z})}),(0,b.jsx)(w.SelectContent,{children:E.map(a=>{let c=a.alias?`${a.name} (${a.alias})`:a.name;return(0,b.jsx)(w.SelectItem,{value:a.id,children:c},a.id)})})]}):(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:i("assets.noProject")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0",children:i("assets.file")}),(0,b.jsx)("input",{type:"file",ref:j,onChange:a=>{q(a.target.files?.[0]??null)},className:"hidden"}),(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>{j.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:p?p.name:i("assets.selectFile")})]}),(0,b.jsxs)("div",{className:"flex items-start gap-3",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground w-16 shrink-0 pt-1.5",children:i("assets.description")}),(0,b.jsx)(v.Textarea,{value:B,onChange:a=>C(a.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,b.jsxs)("div",{className:"flex items-center gap-2 justify-end mt-6",children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:F,children:i("notes.cancel")}),(0,b.jsx)(o.Button,{onClick:G,disabled:!p||!z||!B.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 y=a.i(986099),z=a.i(912868),A=a.i(10390),B=a.i(91756);let C=(0,a.i(711796).default)("chevrons-right",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);var D=a.i(161664);function E({imageUrl:a,filename:d,open:e,onOpenChange:g,assets:h,currentIndex:i,onIndexChange:j}){let{t:k}=(0,f.useI18n)(),[l,m]=(0,c.useState)(1),[n,o]=(0,c.useState)({x:0,y:0}),[p,q]=(0,c.useState)(!1),r=(0,c.useRef)(null),[s,u]=(0,c.useState)(!1),v=!!h&&h.length>1&&"number"==typeof i&&!!j,w=v&&i>0,x=v&&i<h.length-1,G=v?h.length:0,H=G>0?Math.ceil(G/10):0,I=v?Math.floor(i/10):0,J=10*I,K=Math.min(J+10,G),L=H>1,M=v&&I>0,N=v&&I<H-1;(0,c.useEffect)(()=>{u(!0)},[]),(0,c.useEffect)(()=>{m(1),o({x:0,y:0})},[a]),(0,c.useEffect)(()=>{if(!e)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[e]);let O=(0,c.useCallback)(()=>g(!1),[g]),P=(0,c.useCallback)(()=>{v&&w&&j(i-1)},[v,w,j,i]),Q=(0,c.useCallback)(()=>{v&&x&&j(i+1)},[v,x,j,i]),R=(0,c.useCallback)(()=>{v&&M&&j((I-1)*10)},[v,M,j,I]),S=(0,c.useCallback)(()=>{v&&N&&j(Math.min((I+1)*10,G-1))},[v,N,j,I,G]),T=(0,c.useCallback)(()=>{m(a=>Math.min(8,1.25*a))},[]),U=(0,c.useCallback)(()=>{m(a=>{let b=Math.max(.1,a/1.25);return b<=1&&o({x:0,y:0}),b})},[]),V=(0,c.useCallback)(()=>{m(1),o({x:0,y:0})},[]);(0,c.useEffect)(()=>{if(!e)return;let a=a=>{switch(a.key){case"Escape":a.preventDefault(),O();break;case"ArrowLeft":v&&(a.preventDefault(),P());break;case"ArrowRight":v&&(a.preventDefault(),Q());break;case"+":case"=":a.preventDefault(),T();break;case"-":case"_":a.preventDefault(),U();break;case"0":a.preventDefault(),V()}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[e,v,O,P,Q,T,U,V]);let W=(0,c.useRef)(!1),X=()=>{p&&q(!1),r.current=null},Y=p?"cursor-grabbing":"cursor-grab";if(!e||!s)return null;let Z=(0,b.jsxs)("div",{className:"fixed inset-0 z-[100] bg-black/70 dark:bg-black/40 backdrop-blur-md",role:"dialog","aria-modal":"true","aria-label":k("assets.lightbox.zoomFit"),children:[(0,b.jsxs)("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 max-w-[80vw] truncate rounded-md bg-black/40 px-3 py-1 text-xs text-white/80 backdrop-blur-sm pointer-events-none",children:[d,v?` \xb7 ${i+1} / ${h.length}`:""]}),(0,b.jsx)("div",{className:`absolute inset-0 flex items-center justify-center overflow-hidden select-none ${Y}`,onClick:a=>{a.target===a.currentTarget&&O()},onWheel:a=>{a.preventDefault();let b=-a.deltaY>0?1.25:.8;m(a=>{let c=Math.min(8,Math.max(.1,a*b));return c<=1&&o({x:0,y:0}),c})},children:a&&(0,b.jsx)("img",{src:a,alt:d,onClick:a=>{a.stopPropagation(),W.current&&(W.current=!1)},onPointerDown:a=>{0===a.button&&(a.stopPropagation(),W.current=!1,a.target.setPointerCapture?.(a.pointerId),r.current={x:a.clientX,y:a.clientY,panX:n.x,panY:n.y},q(!0))},onPointerMove:a=>{if(!r.current)return;let b=a.clientX-r.current.x,c=a.clientY-r.current.y;Math.abs(b)+Math.abs(c)>5&&(W.current=!0),p&&o({x:r.current.panX+b,y:r.current.panY+c})},onPointerUp:X,onPointerLeave:X,onPointerCancel:X,className:"max-h-[88vh] max-w-[92vw] object-contain pointer-events-auto",style:{transform:`translate3d(${n.x}px, ${n.y}px, 0) scale(${l})`,transformOrigin:"center center",transition:p?"none":"transform 120ms ease-out",willChange:p?"transform":"auto"},draggable:!1})}),(0,b.jsxs)("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-10 flex flex-col items-center gap-2 max-w-[92vw]",onClick:a=>a.stopPropagation(),children:[v&&(0,b.jsxs)("div",{className:"flex items-center gap-1 rounded-lg bg-black/50 px-1.5 py-1.5 backdrop-blur-md ring-1 ring-white/10 max-w-[92vw]",children:[L&&(0,b.jsx)(F,{onClick:R,title:`${k("assets.lightbox.prev")} (-10)`,"aria-label":`${k("assets.lightbox.prev")} (-10)`,disabled:!M,children:(0,b.jsx)(B.ChevronsLeft,{className:"h-4 w-4"})}),(0,b.jsx)(F,{onClick:P,title:k("assets.lightbox.prev"),"aria-label":k("assets.lightbox.prev"),disabled:!w,children:(0,b.jsx)(z.ChevronLeft,{className:"h-4 w-4"})}),(0,b.jsx)("div",{className:"flex items-center gap-1.5",children:h.slice(J,K).map((a,c)=>{let d=J+c,e=d===i;return(0,b.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),e||j(d)},title:a.filename,className:`shrink-0 h-12 w-12 overflow-hidden rounded-md transition-all ${e?"ring-2 ring-white opacity-100 scale-105":"opacity-60 hover:opacity-100 ring-1 ring-white/20"}`,children:(0,b.jsx)("img",{src:a.url,alt:a.filename,className:"h-full w-full object-cover",loading:"lazy",draggable:!1})},a.url+d)})}),(0,b.jsx)(F,{onClick:Q,title:k("assets.lightbox.next"),"aria-label":k("assets.lightbox.next"),disabled:!x,children:(0,b.jsx)(A.ChevronRight,{className:"h-4 w-4"})}),L&&(0,b.jsx)(F,{onClick:S,title:`${k("assets.lightbox.next")} (+10)`,"aria-label":`${k("assets.lightbox.next")} (+10)`,disabled:!N,children:(0,b.jsx)(C,{className:"h-4 w-4"})})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 rounded-lg bg-black/50 px-2 py-1.5 backdrop-blur-md ring-1 ring-white/10",children:[(0,b.jsxs)("span",{className:"px-2 text-xs text-white/80 tabular-nums select-none min-w-12 text-center",children:[Math.round(100*l),"%"]}),(0,b.jsx)(F,{onClick:V,title:k("assets.lightbox.reset"),"aria-label":k("assets.lightbox.reset"),disabled:1===l&&0===n.x&&0===n.y,children:(0,b.jsx)(D.RotateCcw,{className:"h-4 w-4"})}),(0,b.jsx)("div",{className:"mx-1 h-5 w-px bg-white/20"}),(0,b.jsx)(F,{onClick:O,title:k("assets.lightbox.close"),"aria-label":k("assets.lightbox.close"),children:(0,b.jsx)(t.X,{className:"h-4 w-4"})})]})]})]});return(0,y.createPortal)(Z,document.body)}function F({children:a,onClick:c,title:d,disabled:e,...f}){return(0,b.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),e||c()},title:d,disabled:e,className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-white/80 hover:bg-white/15 hover:text-white disabled:opacity-30 disabled:hover:bg-transparent disabled:hover:text-white/80 transition-colors",...f,children:a})}a.i(757942);var G=a.i(950314),H=a.i(814574);function I({url:a,filename:e,open:g,onOpenChange:h}){let{t:i}=(0,f.useI18n)(),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)(!1),[n,o]=(0,c.useState)(null);(0,c.useEffect)(()=>{if(!g||!a){k(null),o(null);return}let b=!1;return m(!0),o(null),k(null),fetch(a).then(a=>{let b=a.headers.get("content-length");if(b&&parseInt(b,10)>1048576)throw Error("FILE_TOO_LARGE");return a.text()}).then(a=>{if(a.length>1048576)throw Error("FILE_TOO_LARGE");b||(k(a),m(!1))}).catch(a=>{b||(a instanceof Error&&"FILE_TOO_LARGE"===a.message?o(i("assets.fileTooLarge")):o(i("assets.previewError")),m(!1))}),()=>{b=!0}},[g,a,i]);let p=e.split(".").pop()?.toLowerCase();return(0,b.jsx)(H.Dialog,{open:g,onOpenChange:h,children:(0,b.jsxs)(H.DialogContent,{className:"w-[min(960px,92vw)] max-w-none sm:max-w-none h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0",children:[(0,b.jsx)("h3",{className:"text-sm font-medium truncate px-5 py-3 border-b border-border/50",children:e}),(0,b.jsx)("div",{className:"flex-1 overflow-auto px-5 py-4",children:(()=>{if(l)return(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 gap-2",children:[(0,b.jsx)(d.Loader2,{className:"size-5 animate-spin text-muted-foreground"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:i("assets.loadingPreview")})]});if(n)return(0,b.jsx)("p",{className:"text-sm text-destructive",children:n});if(null===j)return null;if("md"===p)return(0,b.jsx)("div",{className:"text-sm leading-relaxed",children:(0,b.jsx)(G.Streamdown,{children:j})});if("json"===p){let a;try{a=JSON.stringify(JSON.parse(j),null,2)}catch{a=j}return(0,b.jsx)("pre",{className:"font-mono text-xs whitespace-pre-wrap text-foreground",children:a})}return(0,b.jsx)("pre",{className:"font-mono text-sm whitespace-pre-wrap text-foreground",children:j})})()})]})})}var J=a.i(972420),K=a.i(952313);a.s(["AssetsPageClient",0,function({allWorkspaces:a,initialWorkspaceId:h,initialProjectId:j,initialAssets:k}){let l,{t:m}=(0,f.useI18n)(),[n,o]=(0,c.useTransition)(),[q,s]=(0,c.useState)(h),[t,u]=(0,c.useState)(j),[v,y]=(0,c.useState)(k),[z,A]=(0,c.useState)(null),B=a.find(a=>a.id===q),C=B?.projects??[],D=(0,c.useCallback)(a=>{a?o(async()=>{y(await i(a))}):y([])},[o]),[F,G]=(0,c.useState)(null),H=F?F.mimeType?.startsWith("image/")?"image":/\.(txt|md|json)$/i.test(F.filename)?"text":null:null,L=v.filter(a=>a.mimeType?.startsWith("image/")).map(a=>({id:a.id,url:p(a.path),filename:a.filename})),M=F?L.findIndex(a=>a.id===F.id):-1,N=async a=>{try{let b=await fetch("/api/internal/assets/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a.path})});if(!b.ok){let a=await b.json().catch(()=>({}));K.toast.error(a.error||"Failed to reveal file")}}catch{K.toast.error("Failed to reveal file")}},O=async a=>{let b=v.find(b=>b.id===a);confirm(m("assets.deleteConfirm",{filename:b?.filename??a}))&&(await (0,g.deleteAsset)(a),D(t))};return(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsx)(e.SubPageNav,{workspaceId:q}),(0,b.jsxs)("div",{className:"header-sm flex items-center gap-3 px-6 py-2",children:[(0,b.jsxs)(w.Select,{value:q,onValueChange:b=>b&&(b=>{if(b===q)return;s(b);let c=a.find(a=>a.id===b),d=c?.projects[0]??null;u(d?.id??null),D(d?.id??null)})(b),children:[(0,b.jsx)(w.SelectTrigger,{className:"h-8 w-auto min-w-[120px]",children:(0,b.jsx)("span",{className:"truncate",children:a.find(a=>a.id===q)?.name??q})}),(0,b.jsx)(w.SelectContent,{children:a.map(a=>(0,b.jsx)(w.SelectItem,{value:a.id,children:a.name},a.id))})]}),C.length>0&&(0,b.jsxs)(w.Select,{value:t??"",onValueChange:a=>a&&void(a!==t&&(u(a),D(a))),children:[(0,b.jsx)(w.SelectTrigger,{className:"h-8 w-auto min-w-[140px]",children:(0,b.jsx)("span",{className:"truncate",children:(l=C.find(a=>a.id===t))?l.alias?`${l.name} (${l.alias})`:l.name:""})}),(0,b.jsx)(w.SelectContent,{children:C.map(a=>(0,b.jsxs)(w.SelectItem,{value:a.id,children:[a.name,a.alias?` (${a.alias})`:""]},a.id))})]}),(0,b.jsx)("div",{className:"ml-auto",children:(0,b.jsx)(x,{allWorkspaces:a,initialWsId:q,initialProjectId:t,onUploaded:a=>{a===t&&D(t)}})})]}),(0,b.jsx)("div",{className:"flex-1 overflow-auto px-6 py-4",children:(0,b.jsxs)("div",{className:`relative ${n?"opacity-40 pointer-events-none":""} transition-opacity`,children:[n&&(0,b.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:(0,b.jsx)(d.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}),0===C.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-16 text-center",children:[(0,b.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:m("assets.noProject")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60",children:m("assets.noProjectHint")})]}):(0,b.jsx)(r,{assets:v.map(a=>({...a,taskId:a.task?.id??null,taskTitle:a.task?.title??null})),onPreview:a=>{let b=a.mimeType?.startsWith("image/"),c=/\.(txt|md|json)$/i.test(a.filename);(b||c)&&G(a)},onReveal:N,onDelete:O,onTaskClick:A})]})}),(0,b.jsx)(E,{imageUrl:"image"===H&&M>=0?L[M].url:null,filename:"image"===H&&M>=0?L[M].filename:"",open:"image"===H,onOpenChange:a=>{a||G(null)},assets:L.map(({url:a,filename:b})=>({url:a,filename:b})),currentIndex:M>=0?M:void 0,onIndexChange:a=>{let b=L[a];if(!b)return;let c=v.find(a=>a.id===b.id);c&&G({...c,taskId:c.task?.id??null,taskTitle:c.task?.title??null})}}),(0,b.jsx)(I,{url:"text"===H&&F?p(F.path):null,filename:F?.filename??"",open:"text"===H,onOpenChange:a=>{a||G(null)}}),(0,b.jsx)(J.TaskOverviewDrawer,{open:!!z,onOpenChange:a=>{a||A(null)},taskId:z})]})}],919647)}];
2
2
 
3
3
  //# sourceMappingURL=src_app_workspaces_%5BworkspaceId%5D_assets_assets-page-client_tsx_0wyzpam._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[473935,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(553798),e=a.i(711796);let f=(0,e.default)("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]),g=(0,e.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);var h=a.i(283857),i=a.i(951192);function j({totalTasks:a,runningTasks:c}){let{t:d}=(0,i.useI18n)();return(0,b.jsxs)("div",{className:"grid grid-cols-3 gap-3 px-6 py-4",children:[(0,b.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"rounded-lg bg-sky-500/10 p-2 ring-1 ring-sky-500/20",children:(0,b.jsx)(f,{className:"h-4 w-4 text-sky-400"})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:d("board.overview")}),(0,b.jsx)("p",{className:"text-2xl font-bold font-mono tracking-tight text-foreground",children:a})]})]})}),(0,b.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"rounded-lg bg-primary/10 p-2 ring-1 ring-primary/20",children:(0,b.jsx)(g,{className:"h-4 w-4 text-primary"})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:d("board.running")}),(0,b.jsx)("p",{className:"text-2xl font-bold font-mono tracking-tight text-foreground",children:c})]})]})}),(0,b.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"rounded-lg bg-emerald-500/10 p-2 ring-1 ring-emerald-500/20",children:(0,b.jsx)(h.Lightbulb,{className:"h-4 w-4 text-emerald-400"})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:d("board.tip")}),(0,b.jsx)("p",{className:"text-xs font-medium text-foreground/80",children:d("board.tipText")})]})]})})]})}var k=a.i(634910),l=a.i(774881),m=a.i(573242),n=a.i(577565),o=a.i(699570),p=a.i(866718),q=a.i(580701);function r({searchQuery:a,onSearchChange:c,versions:d=[],versionFilter:e="all",onVersionFilterChange:f,versionsHref:g,onCreateTask:h}){let j,{t:s}=(0,i.useI18n)(),t="all"===e?s("board.allVersions"):"backlog"===e?s("board.backlogFilter"):(j=d.find(a=>a.id===e))?`${j.number} ${j.name}`:s("board.allVersions");return(0,b.jsxs)("div",{className:"flex items-center gap-2 px-6 py-2",children:[f&&(0,b.jsxs)(q.Select,{value:e,onValueChange:a=>f(a||"all"),children:[(0,b.jsxs)(q.SelectTrigger,{className:"h-8 w-44 shrink-0 gap-1.5 text-xs text-muted-foreground",children:[(0,b.jsx)(n.GitBranch,{className:"h-3.5 w-3.5 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:t})]}),(0,b.jsxs)(q.SelectContent,{children:[(0,b.jsx)(q.SelectItem,{value:"all",children:s("board.allVersions")}),(0,b.jsx)(q.SelectItem,{value:"backlog",children:s("board.backlogFilter")}),d.map(a=>(0,b.jsxs)(q.SelectItem,{value:a.id,children:[(0,b.jsx)("span",{className:"font-mono",children:a.number})," ",a.name]},a.id))]})]}),(0,b.jsxs)("div",{className:"relative flex-1 max-w-xs",children:[(0,b.jsx)(m.Search,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),(0,b.jsx)(p.Input,{type:"text",value:a,onChange:a=>c(a.target.value),placeholder:s("board.searchPlaceholder"),className:"pl-8 pr-3 text-xs"})]}),(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[g&&(0,b.jsx)(k.default,{href:g,children:(0,b.jsxs)(o.Button,{variant:"outline",className:"h-8 gap-1.5 text-xs text-muted-foreground",children:[(0,b.jsx)(n.GitBranch,{className:"h-3.5 w-3.5"}),s("version.timeline")]})}),(0,b.jsxs)(o.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:h,children:[(0,b.jsx)(l.Plus,{className:"h-3.5 w-3.5"}),s("board.newTask")]})]})]})}var s=a.i(986099),t=a.i(668116),u=a.i(521007);function v({x:a,y:e,taskId:f,currentStatus:g,hasExecutions:h,workspaceId:j,onClose:k,onStatusChange:l,onLaunch:m}){let{t:n}=(0,i.useI18n)(),o=(0,d.useRouter)(),p=(0,c.useRef)(null);(0,c.useEffect)(()=>{let a=a=>{p.current&&!p.current.contains(a.target)&&k()},b=a=>{"Escape"===a.key&&k()};return document.addEventListener("mousedown",a),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",b)}},[k]);let q="flex items-center px-3 py-1.5 text-xs cursor-pointer hover:bg-accent rounded-sm w-full text-left",r=(0,b.jsxs)("div",{ref:p,style:{position:"fixed",top:e,left:a,zIndex:9999},className:"bg-popover border border-border rounded-md shadow-md py-1 min-w-[180px]",children:[(0,b.jsx)("div",{className:"px-3 py-1 text-[10px] text-muted-foreground uppercase tracking-wider",children:n("board.contextMenu.changeStatus")}),u.BOARD_COLUMNS.map(a=>(0,b.jsxs)("button",{type:"button",className:q,onClick:()=>{l(f,a.id),k()},children:[g===a.id?(0,b.jsx)(t.Check,{className:"h-3 w-3 mr-2 flex-shrink-0"}):(0,b.jsx)("span",{className:"w-5 flex-shrink-0"}),a.label]},a.id)),(0,b.jsx)("hr",{className:"my-1 border-border"}),(0,b.jsx)("button",{type:"button",className:`${q} ${h?"opacity-50 cursor-not-allowed":""}`,disabled:h,onClick:()=>{h||(m(f),k())},children:n("board.contextMenu.launch")}),"DONE"!==g&&"CANCELLED"!==g&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("hr",{className:"my-1 border-border"}),(0,b.jsx)("button",{type:"button",className:q,onClick:()=>{o.push(`/workspaces/${j}/tasks/${f}`),k()},children:n("board.contextMenu.goToDetail")})]})]});return"u"<typeof document?null:(0,s.createPortal)(r,document.body)}var w=a.i(643228),x=a.i(859103);let y=(0,e.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);var z=a.i(514126),A=a.i(336771),B=a.i(690251),C=a.i(975231);let D=(0,e.default)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);var E=a.i(786304),F=a.i(335732);function G({task:a,onClick:c,onEdit:d,onDelete:e,onTogglePin:f,onContextMenu:g}){let{t:h}=(0,i.useI18n)(),{attributes:j,listeners:k,setNodeRef:l,transform:m,transition:n,isDragging:p}=(0,x.useSortable)({id:a.id,data:{type:"task",task:a}}),q={transform:z.CSS.Transform.toString(m),transition:n,opacity:p?.4:1},r=u.PRIORITY_CONFIG[a.priority];return(0,b.jsxs)("div",{ref:l,style:q,...j,...k,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:c,onContextMenu:b=>{b.preventDefault(),b.stopPropagation(),g?.(a,b.clientX,b.clientY)},"data-testid":"task-card",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between",children:[(0,b.jsx)("h4",{className:"text-sm font-medium text-foreground",children:a.title}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",className:`transition-all ${a.pinned?"text-primary opacity-100":"text-muted-foreground opacity-0 group-hover:opacity-100"}`,onClick:b=>{b.stopPropagation(),f?.(a.id)},"aria-label":h(a.pinned?"board.unpin":"board.pin"),children:(0,b.jsx)(D,{className:`h-3.5 w-3.5 ${a.pinned?"-rotate-45":""}`})}),(0,b.jsxs)(F.DropdownMenu,{children:[(0,b.jsx)(F.DropdownMenuTrigger,{render:(0,b.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:a=>a.stopPropagation()}),children:(0,b.jsx)(A.MoreHorizontal,{className:"h-4 w-4"})}),(0,b.jsxs)(F.DropdownMenuContent,{align:"end",children:[(0,b.jsxs)(F.DropdownMenuItem,{onClick:b=>{b.stopPropagation(),d?.(a)},children:[(0,b.jsx)(B.Pencil,{className:"mr-2 h-3.5 w-3.5"}),h("common.edit")]}),(0,b.jsxs)(F.DropdownMenuItem,{className:"text-rose-400",onClick:b=>{b.stopPropagation(),e?.(a.id)},children:[(0,b.jsx)(C.Trash2,{className:"mr-2 h-3.5 w-3.5"}),h("common.delete")]})]})]})]})]}),a.description&&(0,b.jsx)("p",{className:"mt-1.5 line-clamp-3 text-xs leading-relaxed text-muted-foreground",children:a.description}),(0,b.jsx)("div",{className:"mt-2.5",children:(0,b.jsx)(E.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${r.color}`,children:r.label})}),a.labels&&a.labels.length>0&&(0,b.jsx)("div",{className:"mt-1.5 flex flex-wrap gap-1",children:a.labels.map(a=>(0,b.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-medium",style:{backgroundColor:a.label.color+"20",color:a.label.color},children:a.label.name},a.label.id))})]})}var H=a.i(814574),I=a.i(269876);function J({open:a,onOpenChange:c,columnLabel:d,columnColor:e,tasks:f,onTaskClick:g}){let{t:h}=(0,i.useI18n)();return(0,b.jsx)(H.Dialog,{open:a,onOpenChange:c,children:(0,b.jsxs)(H.DialogContent,{className:"sm:max-w-6xl max-h-[80vh]",children:[(0,b.jsx)(H.DialogHeader,{children:(0,b.jsxs)(H.DialogTitle,{className:"flex items-center gap-2",children:[(0,b.jsx)("div",{className:`h-2.5 w-2.5 rounded-full ${e}`}),(0,b.jsx)("span",{children:d}),(0,b.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-mono font-medium text-muted-foreground",children:f.length})]})}),(0,b.jsx)(I.ScrollArea,{className:"max-h-[680px]",children:(0,b.jsxs)("div",{className:"grid grid-cols-4 gap-3 pr-3",children:[f.map(a=>{let d=u.PRIORITY_CONFIG[a.priority];return(0,b.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:()=>{g?.(a),c(!1)},children:[(0,b.jsx)("h4",{className:"text-sm font-medium text-foreground line-clamp-2",children:a.title}),a.description&&(0,b.jsx)("p",{className:"mt-1.5 line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:a.description}),(0,b.jsxs)("div",{className:"mt-2 flex items-center gap-1.5 flex-wrap",children:[(0,b.jsx)(E.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${d.color}`,children:d.label}),a.labels?.map(a=>(0,b.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-medium",style:{backgroundColor:a.label.color+"20",color:a.label.color},children:a.label.name},a.label.id))]})]},a.id)}),0===f.length&&(0,b.jsx)("div",{className:"col-span-4 py-8 text-center text-sm text-muted-foreground",children:h("board.noTasks")})]})})]})})}function K({id:a,label:d,color:e,tasks:f,onTaskClick:g,onEditTask:h,onAddTask:j,onDeleteTask:k,onTogglePin:m,onContextMenu:n}){let{setNodeRef:p,isOver:q}=(0,w.useDroppable)({id:a}),[r,s]=(0,c.useState)(!1),{t}=(0,i.useI18n)();return(0,b.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 ${q?"bg-primary/[0.06]":""}`,children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-3 py-2.5 border-b border-border/30",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("div",{className:`h-2 w-2 rounded-full ${e}`}),(0,b.jsx)("span",{className:"text-xs font-semibold tracking-wide text-secondary-foreground",children:d}),(0,b.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-mono font-medium text-muted-foreground",children:f.length})]}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>s(!0),className:"text-muted-foreground","aria-label":t("board.viewAll"),children:(0,b.jsx)(y,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:j,className:"text-muted-foreground","aria-label":"add",children:(0,b.jsx)(l.Plus,{className:"h-3.5 w-3.5"})})]})]}),(0,b.jsx)(J,{open:r,onOpenChange:s,columnLabel:d,columnColor:e,tasks:f,onTaskClick:g}),(0,b.jsx)(I.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)("div",{ref:p,className:"flex flex-col gap-2 p-2",children:(0,b.jsx)(x.SortableContext,{items:f.map(a=>a.id),strategy:x.verticalListSortingStrategy,children:f.map(a=>(0,b.jsx)(G,{task:a,onClick:()=>g?.(a),onEdit:h,onDelete:k,onTogglePin:m,onContextMenu:n},a.id))})})})]})}function L({initialTasks:a,onTaskMove:d,onTaskClick:e,onEditTask:f,onAddTask:g,onDeleteTask:h,onTogglePin:i,onContextMenuStatusChange:j,onContextMenuLaunch:k,workspaceId:l}){let[m,n]=(0,c.useState)(a),[o,p]=(0,c.useState)(null),[q,r]=(0,c.useState)(null);(0,c.useEffect)(()=>{n(a)},[a]);let s=(0,w.useSensors)((0,w.useSensor)(w.PointerSensor,{activationConstraint:{distance:8}})),t=(0,c.useCallback)((a,b,c)=>{r({task:a,x:b,y:c})},[]),x=(0,c.useCallback)(a=>{let b=m.find(b=>b.id===a.active.id);b&&p(b)},[m]),y=(0,c.useCallback)(a=>{let b,{active:c,over:e}=a;if(p(null),!e)return;let f=c.id,g=e.id;if(u.BOARD_COLUMNS.some(a=>a.id===g))b=g;else{let a=m.find(a=>a.id===g);b=a?.status}b&&(n(a=>a.map(a=>a.id===f?{...a,status:b}:a)),d?.(f,b))},[m,d]);return(0,b.jsxs)(w.DndContext,{id:"kanban-board",sensors:s,collisionDetection:w.closestCorners,onDragStart:x,onDragEnd:y,children:[(0,b.jsx)("div",{className:"mx-2 flex h-full overflow-x-auto rounded-xl border border-border bg-card/50",children:u.BOARD_COLUMNS.map(a=>(0,b.jsx)(K,{id:a.id,label:a.label,color:a.color,tasks:m.filter(b=>b.status===a.id),onTaskClick:e,onEditTask:f,onAddTask:()=>g?.(a.id),onDeleteTask:h,onTogglePin:i,onContextMenu:t},a.id))}),(0,b.jsx)(w.DragOverlay,{children:o?(0,b.jsx)("div",{className:"rotate-3 scale-105",children:(0,b.jsx)(G,{task:o})}):null}),q&&(0,b.jsx)(v,{x:q.x,y:q.y,taskId:q.task.id,currentStatus:q.task.status,hasExecutions:(q.task._count?.executions??0)>0,workspaceId:l??"",onClose:()=>r(null),onStatusChange:(a,b)=>{j?.(a,b),r(null)},onLaunch:a=>{k?.(a),r(null)}})]})}var M=a.i(445798),N=a.i(442620),O=a.i(10390),P=a.i(851378),Q=a.i(350739),R=a.i(347165);let S=(0,e.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 T=a.i(616335),U=a.i(704494),V=a.i(394259),W=a.i(192369),X=a.i(429246),Y=a.i(780410);let Z=(0,Y.createServerReference)("60ff1bcd800e45caa95b9e3e61d8b7716f0fadd9f6",Y.callServer,void 0,Y.findSourceMapURL,"updateProject");var $=a.i(511768);let _=(0,Y.createServerReference)("408150f33758d58766cf3d1bb0b0c96f3bcb63cec2",Y.callServer,void 0,Y.findSourceMapURL,"deleteProject"),aa=(0,Y.createServerReference)("403be1e37c4ff9500a2f2908929cc0fb13c98d7c60",Y.callServer,void 0,Y.findSourceMapURL,"getRecentLocalProjects"),ab=(0,Y.createServerReference)("4067adef8f36f10d4abf6af87a6bb44a46471f927a",Y.callServer,void 0,Y.findSourceMapURL,"getOrCreateTowerTaskId");var ac=a.i(87943),ad=a.i(952313),ae=a.i(43775),af=a.i(487410),ag=a.i(791717),ah=a.i(22761);function ai({commits:a}){let{t:d}=(0,i.useI18n)(),[e,f]=(0,c.useState)(!1);return 0===a.length?null:(0,b.jsxs)("div",{children:[(0,b.jsxs)("button",{onClick:()=>f(!e),className:"flex w-full items-center justify-between py-1",children:[(0,b.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:d("git.commitLog")}),e?(0,b.jsx)(N.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,b.jsx)(O.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),e&&(0,b.jsx)("div",{className:"mt-1.5 space-y-0.5 max-h-64 overflow-y-auto",children:a.map(a=>(0,b.jsxs)("div",{className:"group flex items-start gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,b.jsx)(S,{className:"h-3 w-3 shrink-0 text-muted-foreground mt-0.5"}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("p",{className:"text-xs text-foreground line-clamp-1",children:a.message}),(0,b.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,b.jsxs)("button",{onClick:()=>{navigator.clipboard.writeText(a.shortHash),ad.toast.success(`Copied ${a.shortHash}`)},className:"flex items-center gap-0.5 font-mono text-[10px] text-primary/70 hover:text-primary transition-colors",children:[a.shortHash,(0,b.jsx)(ah.Copy,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:a.author}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(a){let b=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(b<1)return"just now";if(b<60)return`${b}m`;let c=Math.floor(b/60);if(c<24)return`${c}h`;let d=Math.floor(c/24);return d<30?`${d}d`:`${Math.floor(d/30)}mo`}(a.date)})]})]})]},a.hash))})]})}var aj=a.i(607219),ak=a.i(324263),al=a.i(7285);function am({localPath:a,stashes:d,hasChanges:e,onRefresh:f}){let{t:g}=(0,i.useI18n)(),[h,j]=(0,c.useState)(!1),[k,l]=(0,c.useState)(!1),[m,n]=(0,c.useState)(""),[q,r]=(0,c.useState)(null),s=async()=>{l(!0);try{await (0,al.gitAction)(a,"stash-save",{message:m}),n(""),ad.toast.success(g("git.stashSaved")),await f()}catch(a){ad.toast.error(a instanceof Error?a.message:String(a))}finally{l(!1)}},t=async b=>{r(b);try{await (0,al.gitAction)(a,"stash-pop",{index:b}),ad.toast.success(g("git.stashApplied")),await f()}catch(a){ad.toast.error(a instanceof Error?a.message:String(a))}finally{r(null)}},u=async b=>{r(b);try{await (0,al.gitAction)(a,"stash-drop",{index:b}),ad.toast.success(g("git.stashDropped")),await f()}catch(a){ad.toast.error(a instanceof Error?a.message:String(a))}finally{r(null)}};return e||0!==d.length?(0,b.jsxs)("div",{children:[(0,b.jsxs)("button",{onClick:()=>j(!h),className:"flex w-full items-center justify-between py-1",children:[(0,b.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[g("git.stash")," ",d.length>0&&`(${d.length})`]}),h?(0,b.jsx)(N.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,b.jsx)(O.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),h&&(0,b.jsxs)("div",{className:"mt-1.5 space-y-2",children:[e&&(0,b.jsxs)("div",{className:"flex gap-1.5",children:[(0,b.jsx)(p.Input,{value:m,onChange:a=>n(a.target.value),placeholder:g("git.stashMsgPlaceholder"),className:"h-7 text-xs flex-1",onKeyDown:a=>"Enter"===a.key&&s()}),(0,b.jsx)(o.Button,{variant:"outline",size:"icon-sm",onClick:s,disabled:k,className:"shrink-0",children:k?(0,b.jsx)(U.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aj.Archive,{className:"h-3 w-3"})})]}),d.length>0&&(0,b.jsx)("div",{className:"space-y-0.5",children:d.map(a=>(0,b.jsxs)("div",{className:"group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,b.jsx)(aj.Archive,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"flex-1 min-w-0 truncate text-xs text-foreground",children:a.message||`stash@{${a.index}}`}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>t(a.index),disabled:q===a.index,className:"text-muted-foreground","aria-label":g("git.stashApply"),children:q===a.index?(0,b.jsx)(U.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(ak.ArrowUpFromLine,{className:"h-3 w-3"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>u(a.index),disabled:q===a.index,className:"text-rose-400","aria-label":g("git.stashDrop"),children:(0,b.jsx)(C.Trash2,{className:"h-3 w-3"})})]})]},a.index))})]})]}):null}function an({project:a,workspaceId:e}){let{t:f,locale:g}=(0,i.useI18n)(),h=(0,d.useRouter)(),[j,k]=(0,c.useState)(!0),[l,m]=(0,c.useState)(!0),[q,r]=(0,c.useState)(!1),[s,t]=(0,c.useState)(!1),[u,v]=(0,c.useState)(""),[w,x]=(0,c.useState)(!1),[y,z]=(0,c.useState)(!1),[A,D]=(0,c.useState)(!1),[E,F]=(0,c.useState)(a.name),[G,I]=(0,c.useState)(a.alias??""),[J,K]=(0,c.useState)(a.description??""),[L,M]=(0,c.useState)(a.localPath??""),[W,Y]=(0,c.useState)(a.projectType??"FRONTEND"),[ah,aj]=(0,c.useState)([]);(0,c.useEffect)(()=>{aa(100).then(aj)},[]);let[ak,al]=(0,c.useState)(!1),[ap,aq]=(0,c.useState)(""),[ar,as]=(0,c.useState)(""),[at,au]=(0,c.useState)(""),[av,aw]=(0,c.useState)(""),[ax,ay]=(0,c.useState)("FRONTEND"),[az,aA]=(0,c.useState)(!1),[aB,aC]=(0,c.useState)(!1),[aD,aE]=(0,c.useState)(null),[aF,aG]=(0,c.useState)(!1),[aH,aI]=(0,c.useState)(!1),[aJ,aK]=(0,c.useState)(!1),aL=a=>{ad.toast.info(a)},aM=(0,c.useCallback)(async()=>{if(a.localPath){aG(!0);try{let b=await fetch(`/api/git?path=${encodeURIComponent(a.localPath)}`);b.ok&&aE(await b.json())}catch{}finally{aG(!1)}}},[a.localPath]);(0,c.useEffect)(()=>{aM()},[aM]);let aN=async()=>{if(a.localPath){aI(!0);try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",path:a.localPath})})).ok?(aL(f("git.initSuccess")),await aM()):aL(f("git.initFailed"))}catch{aL(f("git.initFailed"))}finally{aI(!1)}}},aO=async b=>{if(a.localPath)try{let c=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"checkout",path:a.localPath,branch:b})});if(c.ok)aL(`${f("git.switchSuccess")} ${b}`),await aM();else{let a=await c.json();aL(`${f("git.switchFailed")}: ${a.error}`)}}catch{aL(f("git.switchFailed"))}},aP=(a,b)=>{h.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1}),h.refresh()},aQ=async()=>{if(ar.trim()){aA(!0);try{let a=await (0,$.createProject)({name:ar.trim(),alias:at.trim()||void 0,description:av.trim()||void 0,localPath:ap,projectType:ax,workspaceId:e});al(!1),aP(e,a.id)}catch(a){ad.toast.error(a instanceof Error?a.message:String(a))}finally{aA(!1)}}},aR=async()=>{if(L&&!aB){aC(!0);try{let a=await (0,ac.analyzeProjectDirectory)(L.trim(),g);K(a)}catch{ad.toast.error(f("project.analyzeError"))}finally{aC(!1)}}},aS=async()=>{try{await Z(a.id,{name:E.trim(),alias:G.trim()||void 0,description:J.trim()||void 0,localPath:L.trim()||void 0,projectType:W}),h.refresh(),r(!1)}catch(a){ad.toast.error(a instanceof Error?a.message:String(a))}};return(0,b.jsxs)("aside",{className:"relative w-72 flex-shrink-0 overflow-y-auto border-l border-border bg-sidebar",children:[(0,b.jsxs)("div",{className:"border-b border-border p-4",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("h2",{className:"text-base font-semibold text-foreground",children:a.name}),a.alias&&(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:a.alias})]}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{F(a.name),I(a.alias??""),K(a.description??""),M(a.localPath??""),r(!0)},className:"text-muted-foreground",children:(0,b.jsx)(B.Pencil,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{v(""),t(!0)},className:"text-muted-foreground hover:text-rose-400",children:(0,b.jsx)(C.Trash2,{className:"h-3.5 w-3.5"})})]})]}),a.description&&(0,b.jsx)("p",{className:"mt-2 text-sm text-secondary-foreground leading-relaxed line-clamp-4",children:a.description}),(0,b.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:(0,b.jsx)("span",{className:`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium ${"GIT"===a.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"===a.type?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.GitBranch,{className:"h-3 w-3"}),f("sidebar.right.gitType")]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(Q.FileText,{className:"h-3 w-3"}),f("sidebar.right.normalType")]})})}),a.localPath&&(0,b.jsxs)("div",{className:"mt-3 flex items-start gap-2 rounded-md bg-muted/50 px-2.5 py-2 text-xs",children:[(0,b.jsx)(R.FolderOpen,{className:"mt-0.5 h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"break-all font-mono text-secondary-foreground",children:a.localPath})]}),a.gitUrl&&(0,b.jsxs)("div",{className:"mt-2 flex items-start gap-2 rounded-md bg-muted/50 px-2.5 py-2 text-xs",children:[(0,b.jsx)(P.Globe,{className:"mt-0.5 h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"break-all text-secondary-foreground",children:a.gitUrl})]}),a.localPath&&(0,b.jsxs)(o.Button,{variant:"outline",className:"mt-3 w-full h-8 gap-1.5 text-xs",disabled:y,onClick:async()=>{z(!0);try{let b=await ab(a.id);h.push(`/workspaces/${e}/tasks/${b}`)}catch{ad.toast.error(f("git.openStudioFailed"))}finally{z(!1)}},children:[y?(0,b.jsx)(U.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,b.jsx)(R.FolderOpen,{className:"h-3.5 w-3.5"}),f("git.openStudio")]})]}),(0,b.jsxs)("div",{className:"border-b border-border p-4",children:[(0,b.jsxs)(o.Button,{variant:"ghost",onClick:()=>k(!j),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,b.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:f("git.section")}),j?(0,b.jsx)(N.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,b.jsx)(O.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),j&&(0,b.jsx)("div",{className:"mt-3",children:a.localPath?aF?(0,b.jsxs)("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:[(0,b.jsx)(U.Loader2,{className:"h-4 w-4 animate-spin"}),(0,b.jsx)("span",{className:"ml-2 text-xs",children:f("git.loading")})]}):aD&&!aD.isGit?(0,b.jsxs)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,b.jsx)(T.AlertCircle,{className:"h-3.5 w-3.5"}),(0,b.jsx)("p",{className:"text-xs",children:f("git.notInitialized")})]}),(0,b.jsxs)(o.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:aN,disabled:aH,children:[aH?(0,b.jsx)(U.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(S,{className:"h-3 w-3"}),f("git.initRepo")]})]}):aD?.isGit?(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsx)(ao,{localBranches:aD.branches??[],remoteBranches:(aD.remoteBranches??[]).filter(a=>!aD.branches?.includes(a)),currentBranch:aD.currentBranch??"",onSwitch:aO,onFetch:async()=>{a.localPath&&(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"fetch",path:a.localPath})}),await aM())},onCreateBranch:()=>aK(!0)}),(0,b.jsx)(ai,{commits:aD.commits??[]}),(0,b.jsx)(am,{localPath:a.localPath,stashes:aD.stashes??[],hasChanges:(aD.changedFiles??[]).length>0,onRefresh:aM})]}):null:(0,b.jsx)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:(0,b.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,b.jsx)(T.AlertCircle,{className:"h-3.5 w-3.5"}),(0,b.jsx)("p",{className:"text-xs",children:f("git.noLocalPath")})]})})})]}),(0,b.jsxs)("div",{className:"p-4",children:[(0,b.jsxs)(o.Button,{variant:"ghost",onClick:()=>m(!l),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,b.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:f("sidebar.right.browseRepo")}),l?(0,b.jsx)(N.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,b.jsx)(O.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),l&&(0,b.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,b.jsxs)(o.Button,{variant:"outline",className:"w-full h-8 gap-1.5 text-xs",onClick:()=>D(!0),children:[(0,b.jsx)(R.FolderOpen,{className:"h-3.5 w-3.5"}),f("sidebar.right.browseRepo")]}),ah.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5 px-1",children:f("sidebar.right.recent")}),(0,b.jsx)("div",{className:"space-y-0.5",children:ah.map(c=>(0,b.jsxs)("button",{onClick:()=>{c.id!==a.id&&aP(c.workspaceId,c.id)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors ${c.id===a.id?"bg-primary/10 text-primary cursor-default":"hover:bg-accent cursor-pointer"}`,children:["GIT"===c.type?(0,b.jsx)(n.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,b.jsx)(R.FolderOpen,{className:"h-3 w-3 shrink-0 text-primary/70"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsx)("p",{className:"truncate text-xs font-medium text-foreground",children:c.name}),c.localPath&&(0,b.jsx)("p",{className:"truncate text-[10px] font-mono text-muted-foreground",children:c.localPath})]})]},c.id))})]})]})]}),(0,b.jsx)(H.Dialog,{open:q,onOpenChange:r,children:(0,b.jsxs)(H.DialogContent,{style:{maxWidth:"32rem"},children:[(0,b.jsx)(H.DialogHeader,{children:(0,b.jsx)(H.DialogTitle,{children:f("project.edit")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(p.Input,{value:E,onChange:a=>F(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.type.label")}),(0,b.jsx)("div",{className:"mt-1.5",children:(0,b.jsx)(af.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:W,onChange:Y})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(p.Input,{value:G,onChange:a=>I(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsxs)(o.Button,{type:"button",variant:"ghost",onClick:aR,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!L||aB?"opacity-50":""}`,children:[aB?(0,b.jsx)(U.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(V.Sparkles,{className:"h-3 w-3"}),aB?f("project.analyzing"):f("project.genDesc")]})]}),(0,b.jsx)(X.Textarea,{value:J,onChange:a=>K(a.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,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,b.jsx)(p.Input,{value:L,onChange:a=>M(a.target.value),placeholder:f("project.localPathPlaceholder"),className:"flex-1 font-mono text-xs"}),(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>D(!0),className:"h-8 shrink-0",children:f("folder.browse")})]})]})]}),(0,b.jsxs)(H.DialogFooter,{children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>r(!1),children:f("common.cancel")}),(0,b.jsx)(o.Button,{onClick:aS,disabled:!E.trim()||aB,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:f("common.save")})]})]})}),(0,b.jsx)(ae.FolderBrowserDialog,{open:A,onOpenChange:D,onSelect:a=>{q?M(a):(a=>{let b=ah.find(b=>b.localPath===a);if(b)return aP(b.workspaceId,b.id);let c=a.split("/").filter(Boolean).pop()??"";aq(a),as(c),au(""),aw(""),al(!0)})(a)}}),(0,b.jsx)(H.Dialog,{open:ak,onOpenChange:al,children:(0,b.jsxs)(H.DialogContent,{className:"sm:max-w-md",children:[(0,b.jsx)(H.DialogHeader,{children:(0,b.jsx)(H.DialogTitle,{children:f("topbar.newProject")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.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:ap})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(p.Input,{value:ar,onChange:a=>as(a.target.value),placeholder:f("project.namePlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.type.label")}),(0,b.jsx)("div",{className:"mt-1.5",children:(0,b.jsx)(af.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:ax,onChange:ay})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(p.Input,{value:at,onChange:a=>au(a.target.value),placeholder:f("project.aliasPlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsx)(X.Textarea,{value:av,onChange:a=>aw(a.target.value),placeholder:f("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,b.jsxs)(H.DialogFooter,{children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>al(!1),children:f("common.cancel")}),(0,b.jsxs)(o.Button,{onClick:aQ,disabled:!ar.trim()||az,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[az?(0,b.jsx)(U.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,f("common.create")]})]})]})}),aD?.isGit&&(0,b.jsx)(ag.CreateBranchDialog,{open:aJ,onOpenChange:aK,branches:aD.branches??[],currentBranch:aD.currentBranch??"",localPath:a.localPath,onCreated:async()=>{await aM(),aL(f("git.createSuccess"))},onError:a=>aL(`${f("git.createFailed")}: ${a}`)}),(0,b.jsx)(H.Dialog,{open:s,onOpenChange:a=>{t(a),a||v("")},children:(0,b.jsxs)(H.DialogContent,{className:"sm:max-w-md",children:[(0,b.jsx)(H.DialogHeader,{children:(0,b.jsx)(H.DialogTitle,{className:"text-rose-400",children:f("project.deleteTitle")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:f("project.deleteWarning",{name:a.name})}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:f("project.deleteIrreversible")}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.deleteConfirmLabel")}),(0,b.jsx)(p.Input,{value:u,onChange:a=>v(a.target.value),placeholder:f("project.deleteConfirmPlaceholder"),className:"mt-1.5",autoFocus:!0})]})]}),(0,b.jsxs)(H.DialogFooter,{children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>t(!1),children:f("common.cancel")}),(0,b.jsxs)(o.Button,{variant:"destructive",disabled:u!==f("project.deleteConfirmText")||w,onClick:async()=>{x(!0);try{await _(a.id),ad.toast.success(f("project.deleteSuccess")),h.push(`/workspaces/${e}`)}catch{ad.toast.error(f("project.deleteFailed"))}finally{x(!1),t(!1)}},children:[w&&(0,b.jsx)(U.Loader2,{className:"h-3 w-3 animate-spin mr-1"}),f("project.deleteButton")]})]})]})})]})}function ao({localBranches:a,remoteBranches:d,currentBranch:e,onSwitch:f,onFetch:g,onCreateBranch:h}){let{t:j}=(0,i.useI18n)(),[k,p]=(0,c.useState)(!1),[q,r]=(0,c.useState)(""),[s,u]=(0,c.useState)(!1),v=(0,c.useRef)(null);(0,c.useEffect)(()=>{if(k)return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a);function a(a){v.current&&!v.current.contains(a.target)&&p(!1)}},[k]);let w=q.toLowerCase(),x=a.filter(a=>a.toLowerCase().includes(w)),y=d.filter(a=>a.toLowerCase().includes(w)),z=x.length>0||y.length>0,A=async()=>{u(!0);try{await g()}finally{u(!1)}};return(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,b.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:j("git.currentBranch")}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:A,disabled:s,className:"text-muted-foreground","aria-label":"Fetch",children:(0,b.jsx)(W.RefreshCw,{className:`h-3 w-3 ${s?"animate-spin":""}`})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:h,className:"text-muted-foreground","aria-label":j("git.createBranch"),children:(0,b.jsx)(l.Plus,{className:"h-3 w-3"})})]})]}),(0,b.jsxs)("div",{className:"relative",ref:v,children:[(0,b.jsxs)("button",{onClick:()=>{p(!k),r("")},className:"flex w-full items-center justify-between rounded-lg border border-border bg-muted/50 px-3 py-2 text-left transition-colors hover:bg-accent",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,b.jsx)(n.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}),(0,b.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:e||"—"})]}),(0,b.jsx)(N.ChevronDown,{className:`h-3 w-3 shrink-0 text-muted-foreground transition-transform ${k?"rotate-180":""}`})]}),k&&(0,b.jsxs)("div",{className:"absolute left-0 right-0 top-full z-20 mt-1 rounded-lg border border-border bg-popover shadow-xl",children:[(0,b.jsx)("div",{className:"border-b border-border p-1.5",children:(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)(m.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),(0,b.jsx)("input",{value:q,onChange:a=>r(a.target.value),placeholder:"Filter...",autoFocus:!0,className:"h-7 w-full rounded-md bg-muted/50 pl-7 pr-2 text-xs text-foreground placeholder-muted-foreground outline-none focus:ring-1 focus:ring-ring"})]})}),(0,b.jsxs)("div",{className:"max-h-60 overflow-auto py-1",children:[!z&&(0,b.jsx)("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No branches found"}),x.length>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"px-3 pt-1.5 pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:j("git.localBranches")}),x.map(a=>{let c=a===e;return(0,b.jsxs)("button",{onClick:()=>{c||f(a),p(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors ${c?"bg-emerald-500/10 text-emerald-400":"text-secondary-foreground hover:bg-accent"}`,children:[(0,b.jsx)(n.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate font-mono text-xs",children:a}),c&&(0,b.jsx)(t.Check,{className:"h-3 w-3 ml-auto shrink-0"})]},`local-${a}`)})]}),y.length>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"px-3 pt-2.5 pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:j("git.remoteBranches")}),y.map(a=>(0,b.jsxs)("button",{onClick:()=>{f(a),p(!1)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-secondary-foreground transition-colors hover:bg-accent",children:[(0,b.jsx)(P.Globe,{className:"h-3 w-3 shrink-0 text-sky-400"}),(0,b.jsx)("span",{className:"truncate font-mono text-xs",children:a})]},`remote-${a}`))]})]})]})]})]})}var ap=a.i(963326),aq=a.i(648512),ar=a.i(300141),as=a.i(913284),at=a.i(785259),au=a.i(269280),av=a.i(368114);function aw({title:a,description:c,branch:d,baseBranch:e,hasConversation:f,updatedAt:g,onBack:h}){let{t:j}=(0,i.useI18n)();return(0,b.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(V.Sparkles,{className:"h-3.5 w-3.5 text-primary"}),(0,b.jsx)("span",{className:"text-xs font-semibold text-primary",children:j("taskDetail.title")})]}),(0,b.jsxs)(o.Button,{variant:"ghost",onClick:h,className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground h-auto px-2 py-1",children:[(0,b.jsx)(au.ArrowLeft,{className:"h-3.5 w-3.5"}),j("taskDetail.back")]})]}),(0,b.jsx)("h2",{className:"mt-2.5 text-lg font-bold tracking-tight text-foreground",children:a}),c&&(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:c}),(0,b.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e?(0,b.jsxs)(E.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:[(0,b.jsx)(n.GitBranch,{className:"mr-1 h-3 w-3"}),e," · worktree"]}):d?(0,b.jsx)(E.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:j("taskDetail.directMode")}):null,f&&(0,b.jsx)(E.Badge,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-400 text-[10px] border border-emerald-500/20",children:j("taskDetail.hasConversation")}),(0,b.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[j("taskDetail.updatedAt")," ",(0,av.formatRelativeTime)(g)]})]})]})}var ax=a.i(639138),ay=a.i(88757),az=a.i(347872),aA=a.i(77025),aB=a.i(779097),aC=a.i(930089),aD=a.i(57469),aE=a.i(391228),aF=a.i(289254),aG=a.i(59921),aH=a.i(826499),aI=a.i(229288),aJ=a.i(715525),aK=a.i(324954);let aL=(0,e.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);var aM=a.i(54384),aN=a.i(460230);let aO=(0,Y.createServerReference)("408fb77b6a46e85e21aba81eff4d1e88c7a84aad94",Y.callServer,void 0,Y.findSourceMapURL,"getTaskNotes");var aP=a.i(60730);let aQ=(0,Y.createServerReference)("40ba2fad36852388e48a3f76f77a0c66ade051068b",Y.callServer,void 0,Y.findSourceMapURL,"getTaskAssets");var aR=a.i(41348),aS=a.i(493563);function aT({taskId:a,projectId:d}){let{t:e}=(0,i.useI18n)(),f=(0,c.useRef)(null),[g,h]=(0,c.useState)([]),[j,k]=(0,c.useState)([]),[m,n]=(0,c.useState)(!1),[p,q]=(0,c.useState)(""),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(!1);async function v(){p.trim()&&(await (0,aN.createNote)({title:p.trim(),content:r.trim(),projectId:d,taskId:a,category:"task"}),q(""),s(""),n(!1),aO(a).then(h))}async function w(a){await (0,aP.deleteNote)(a),h(b=>b.filter(b=>b.id!==a))}async function x(b){let c=b.target.files?.[0];if(c){u(!0);try{let b=new FormData;b.set("file",c),b.set("projectId",d),b.set("taskId",a),await (0,aR.uploadAsset)(b),aQ(a).then(k)}finally{u(!1),f.current&&(f.current.value="")}}}async function y(a){await (0,aS.deleteAsset)(a),k(b=>b.filter(b=>b.id!==a))}return(0,c.useEffect)(()=>{aO(a).then(h),aQ(a).then(k)},[a]),(0,b.jsx)(I.ScrollArea,{className:"h-full",children:(0,b.jsxs)("div",{className:"flex flex-col",children:[(0,b.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,b.jsx)(Q.FileText,{className:"h-3.5 w-3.5"}),e("taskPage.notes")]}),(0,b.jsxs)(o.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>n(!m),children:[m?(0,b.jsx)(aM.X,{className:"h-3 w-3"}):(0,b.jsx)(l.Plus,{className:"h-3 w-3"}),m?"":e("taskPage.addNote")]})]}),m&&(0,b.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,b.jsx)("input",{type:"text",value:p,onChange:a=>q(a.target.value),placeholder:e("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,b.jsx)("textarea",{value:r,onChange:a=>s(a.target.value),placeholder:e("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,b.jsx)(o.Button,{className:"text-xs",onClick:v,disabled:!p.trim(),children:e("taskPage.addNote")})]}),(0,b.jsxs)("div",{className:"mt-2 space-y-2",children:[0===g.length&&!m&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:e("taskPage.noNotes")}),g.map(a=>(0,b.jsx)("div",{className:"group rounded-md border border-border bg-card p-3",children:(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsx)("h4",{className:"text-sm font-medium truncate",children:a.title}),a.content&&(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-3 whitespace-pre-wrap",children:a.content}),(0,b.jsx)("p",{className:"mt-1 text-[10px] text-muted-foreground",children:new Date(a.createdAt).toLocaleString()})]}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>w(a.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:e("taskPage.deleteNote"),children:(0,b.jsx)(C.Trash2,{className:"h-3.5 w-3.5"})})]})},a.id))]})]}),(0,b.jsxs)("div",{className:"px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,b.jsx)(aL,{className:"h-3.5 w-3.5"}),e("taskPage.attachments")]}),(0,b.jsxs)(o.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>f.current?.click(),disabled:t,children:[(0,b.jsx)(aK.Upload,{className:"h-3 w-3"}),e("taskPage.uploadFile")]}),(0,b.jsx)("input",{ref:f,type:"file",className:"hidden",onChange:x})]}),(0,b.jsxs)("div",{className:"mt-2 space-y-1.5",children:[0===j.length&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:e("taskPage.noAttachments")}),j.map(a=>{var c;return(0,b.jsxs)("div",{className:"group flex items-center gap-2 rounded-md border border-border bg-card px-3 py-2",children:[(0,b.jsx)(aL,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"flex-1 truncate text-sm",children:a.filename}),(0,b.jsx)("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:(c=a.size)?c<1024?`${c} B`:c<1048576?`${(c/1024).toFixed(1)} KB`:`${(c/1024/1024).toFixed(1)} MB`:""}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>y(a.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:e("taskPage.deleteAttachment"),children:(0,b.jsx)(C.Trash2,{className:"h-3 w-3"})})]},a.id)})]})]})]})})}function aU({task:a,workspaceId:e,projectLocalPath:f,onClose:g}){let{t:h}=(0,i.useI18n)(),j=(0,d.useRouter)(),{removePortal:k}=(0,az.useTerminalPortal)(),[l,m]=(0,c.useState)("terminal"),[n,p]=(0,c.useState)(null),[r,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)(a.status);(0,c.useEffect)(()=>{u(a.status)},[a.status]);let[v,w]=(0,c.useState)(null),[x,y]=(0,c.useState)(!1),[z,A]=(0,c.useState)(!1),[B,C]=(0,c.useState)([]);(0,c.useEffect)(()=>{w(null),y(!1),A(!1),C([]),p(null),m("terminal")},[a.id]);let[D,E]=(0,c.useState)([]),[F,G]=(0,c.useState)(null);(0,c.useEffect)(()=>{let a=!1;return(0,aI.getPrompts)().then(b=>{if(a)return;E(b.map(a=>({id:a.id,name:a.name,isDefault:a.isDefault})));let c=b.find(a=>a.isDefault);c&&G(c.id)}),()=>{a=!0}},[]),(0,c.useEffect)(()=>{w(null),A(!1);let b=!1;return(0,aA.getTaskExecutions)(a.id).then(a=>{if(b)return;let c=a[0];if(c?.status==="RUNNING"){let a=c.worktreePath||f||null;a&&w(a)}C(a.filter(a=>"RUNNING"!==a.status)),A(!0)}),()=>{b=!0}},[a.id]),(0,c.useEffect)(()=>{if("changes"!==l||"TODO"===t||"CANCELLED"===t)return;let b=!1;return s(!0),fetch(`/api/tasks/${a.id}/diff`).then(a=>{if(!a.ok)throw Error(`HTTP ${a.status}`);return a.json()}).then(a=>{b||p(a?.files||a?.branchDeleted?a:null)}).catch(()=>{b||p(null)}).finally(()=>{b||s(!1)}),()=>{b=!0}},[l,t,a.id]);let H=(0,c.useCallback)(async()=>{if(!x){y(!0),k(a.id);try{let{worktreePath:b}=await (0,aB.startPtyExecution)(a.id,"",F);w(b),u("IN_PROGRESS")}catch(a){y(!1),ad.toast.error(a instanceof Error?a.message:String(a))}}},[a.id,x,F]),J=(0,c.useCallback)(b=>{y(!1),w(null),k(a.id),0===b&&u("IN_REVIEW"),(0,aA.getTaskExecutions)(a.id).then(a=>{C(a.filter(a=>"RUNNING"!==a.status))}),j.refresh()},[j,a.id]),K=(0,c.useCallback)(async()=>{await (0,aC.stopPtyExecution)(a.id),y(!1),k(a.id),w(null),u("IN_REVIEW"),(0,aA.getTaskExecutions)(a.id).then(a=>{C(a.filter(a=>"RUNNING"!==a.status))}),j.refresh()},[a.id,j]),L=(0,c.useCallback)(async b=>{y(!0),k(a.id),w(null);try{let{worktreePath:c}=await (0,aD.resumePtyExecution)(a.id,b);w(c),u("IN_PROGRESS")}catch{y(!1)}},[a.id,k]),M=(0,c.useCallback)(async()=>{y(!0),k(a.id),w(null);try{let{worktreePath:b}=await (0,aE.continueLatestPtyExecution)(a.id);w(b),u("IN_PROGRESS")}catch(a){y(!1),ad.toast.error(a instanceof Error?a.message:String(a))}},[a.id,k]),[N,O]=(0,c.useState)(!1),[P,R]=(0,c.useState)([]),S=(0,c.useCallback)(async()=>{try{let b=await (0,aG.checkWorktreeClean)(a.id);if(b.hasWorktree&&!b.clean)return void ad.toast.error(h("taskPage.uncommittedChanges",{count:String(b.files.length)}));if(b.hasWorktree&&b.clean&&!b.hasCommits)return void ad.toast.error(h("taskPage.noChangesToComplete"));if(b.hasWorktree&&b.hasCommits){R(b.commitLog),O(!0);return}await (0,aF.updateTaskStatus)(a.id,"DONE"),u("DONE"),ad.toast.success(h("taskPage.taskCompleted")),j.refresh()}catch{ad.toast.error("Failed to complete task")}},[a.id,j,h]),T=(0,c.useCallback)(()=>{u("DONE"),O(!1),ad.toast.success(h("taskPage.taskCompleted")),j.refresh()},[j,h]),V=(0,c.useCallback)(async b=>{try{let{hash:c}=await (0,aH.commitWorktreeChanges)(a.id,b);ad.toast.success(h("diff.commitSuccess",{hash:c})),j.refresh();let d=await fetch(`/api/tasks/${a.id}/diff`);if(d.ok){let a=await d.json();p(a?.files?a:null)}}catch(a){ad.toast.error(a instanceof Error?a.message:"Commit failed")}},[a.id,j,h]);return(0,b.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,b.jsx)(aw,{title:a.title,description:h("taskDetail.panelDescription"),branch:`task/${a.id}`,baseBranch:a.baseBranch,hasConversation:!1,updatedAt:a.updatedAt,onBack:g}),(0,b.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-2",children:[(0,b.jsxs)("div",{className:"flex gap-1",children:[(0,b.jsxs)("button",{onClick:()=>m("terminal"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"terminal"===l?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,b.jsx)(aq.Terminal,{className:"h-3 w-3"}),h("terminal.execute")]}),(0,b.jsx)("button",{onClick:()=>m("changes"),className:`px-3 py-1 text-xs font-medium rounded-md ${"changes"===l?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:h("taskPage.changes")}),(0,b.jsxs)("button",{onClick:()=>m("notes"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"notes"===l?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,b.jsx)(Q.FileText,{className:"h-3 w-3"}),h("taskPage.notes")]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:["IN_REVIEW"===t&&(0,b.jsxs)(o.Button,{size:"sm",onClick:S,className:"bg-emerald-500/15 text-emerald-400 ring-1 ring-emerald-500/20 hover:bg-emerald-500/25",children:[(0,b.jsx)(as.CheckCircle2,{className:"h-3 w-3"}),h("taskPage.completeTask")]}),"DONE"!==t&&"CANCELLED"!==t&&(0,b.jsxs)(o.Button,{variant:"ghost",size:"sm",onClick:()=>j.push(`/workspaces/${e}/tasks/${a.id}`),className:"text-muted-foreground",children:[(0,b.jsx)(ap.ExternalLink,{className:"h-3 w-3"}),h("taskPage.viewDetails")]})]})]}),"terminal"===l?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:z?v?(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsxs)("div",{className:"shrink-0 flex items-center justify-between border-b border-neutral-800 px-3 py-2 bg-[#0f1419]",children:[(0,b.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-emerald-400",children:[(0,b.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"}),h("execution.running")]}),(0,b.jsxs)(at.Tooltip,{children:[(0,b.jsxs)(at.TooltipTrigger,{onClick:K,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,b.jsx)(ar.Square,{className:"h-3 w-3"}),h("terminal.stopExecution")]}),(0,b.jsx)(at.TooltipContent,{side:"bottom",children:h("terminal.stopHint")})]})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0",children:(0,b.jsx)(az.TerminalOutlet,{taskId:a.id,worktreePath:v,onSessionEnd:J})})]}):"DONE"===t||"CANCELLED"===t?(0,b.jsx)("div",{className:"flex h-full flex-col overflow-hidden",children:(0,b.jsx)(I.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)(aJ.ExecutionTimeline,{executions:B})})}):(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsxs)("div",{className:"shrink-0 flex items-center gap-2 border-b border-border px-4 py-3",children:[D.length>0&&(0,b.jsxs)(q.Select,{defaultValue:F??"none",onValueChange:a=>G("none"===a?null:a),children:[(0,b.jsx)(q.SelectTrigger,{size:"sm",className:"min-w-[120px]",children:(0,b.jsx)("span",{className:"text-left truncate",children:F?D.find(a=>a.id===F)?.name??h("terminal.noPrompt"):h("terminal.noPrompt")})}),(0,b.jsxs)(q.SelectContent,{className:"min-w-[200px]",children:[(0,b.jsx)(q.SelectItem,{value:"none",children:h("terminal.noPrompt")}),D.map(a=>(0,b.jsxs)(q.SelectItem,{value:a.id,children:[a.name,a.isDefault?" ★":""]},a.id))]})]},`prompt-${D.length}`),(0,b.jsxs)(o.Button,{onClick:H,disabled:x,size:"sm",className:"gap-2 px-4",children:[x?(0,b.jsx)(U.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,b.jsx)(aq.Terminal,{className:"h-3.5 w-3.5"}),x?h("terminal.executing"):h("terminal.launch")]})]}),(0,b.jsx)(I.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)(aJ.ExecutionTimeline,{executions:B,onResume:L,onContinueLatest:M})})]}):(0,b.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-[#0f1419]",children:[(0,b.jsx)(U.Loader2,{className:"size-5 animate-spin text-neutral-500"}),(0,b.jsx)("span",{className:"text-xs text-neutral-500",children:h("execution.loading")})]})}):"changes"===l?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:r?(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.loadingDiff")})}):n?.branchDeleted?(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.branchDeleted")})}):n?(0,b.jsx)(ax.TaskDiffView,{taskId:a.id,files:n.files,totalAdded:n.totalAdded,totalRemoved:n.totalRemoved,hasConflicts:n.hasConflicts,conflictFiles:n.conflictFiles,onCommit:V,hasUncommitted:n.hasUncommitted}):(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.noChanges")})})}):"notes"===l?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,b.jsx)(aT,{taskId:a.id,projectId:a.projectId})}):null,(0,b.jsx)(ay.TaskMergeConfirmDialog,{open:N,onOpenChange:O,taskId:a.id,taskTitle:a.title,baseBranch:a.baseBranch??"main",fileCount:n?.files?.length??0,commitCount:n?.commitCount??0,commitLog:P,onMergeComplete:T})]})}var aV=a.i(101526),aW=a.i(942427);let aX=(0,Y.createServerReference)("409268e8c3bea05e209fc80f56d36599bb38ec4608",Y.callServer,void 0,Y.findSourceMapURL,"deleteTask"),aY=(0,Y.createServerReference)("40f52736456189b0053a31bc639186ec0701665762",Y.callServer,void 0,Y.findSourceMapURL,"toggleTaskPinned"),aZ=(0,Y.createServerReference)("402a0021fb002b02307b59ed1b90763b727561dd5a",Y.callServer,void 0,Y.findSourceMapURL,"getVersionsForPicker");var a$=a.i(912868);function a_({projects:a,activeProjectId:d,onSelect:e}){let f=(0,c.useRef)(null),[g,h]=(0,c.useState)(!1),[i,j]=(0,c.useState)(!1),k=()=>{let a=f.current;a&&(h(a.scrollLeft>0),j(a.scrollLeft<a.scrollWidth-a.clientWidth-1))};(0,c.useEffect)(()=>{k();let a=f.current;if(a){a.addEventListener("scroll",k);let b=new ResizeObserver(k);return b.observe(a),()=>{a.removeEventListener("scroll",k),b.disconnect()}}},[a]);let l=a=>{let b=f.current;b&&b.scrollBy({left:"left"===a?-150:150,behavior:"smooth"})};return(0,b.jsxs)("div",{className:"relative flex items-center",children:[g&&(0,b.jsx)("button",{onClick:()=>l("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,b.jsx)(a$.ChevronLeft,{className:"h-4 w-4"})}),(0,b.jsx)("div",{ref:f,className:"flex items-center gap-1.5 overflow-x-auto scrollbar-none px-1 py-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:a.map(a=>{let c=d===a.id;return(0,b.jsxs)("button",{onClick:()=>{c||e(a.id)},className:`shrink-0 rounded-lg border-b-2 px-4 py-2 text-sm font-medium transition-colors ${c?"border-primary bg-primary/10 text-primary ring-1 ring-primary/20 cursor-default":"border-transparent text-muted-foreground hover:bg-accent hover:text-foreground cursor-pointer"}`,children:[(0,b.jsx)("span",{children:a.name}),a.alias&&(0,b.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:a.alias})]},a.id)})}),i&&(0,b.jsx)("button",{onClick:()=>l("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,b.jsx)(O.ChevronRight,{className:"h-4 w-4"})})]})}a.s(["BoardPageClient",0,function({workspaceId:a,projectId:e,project:f,projects:g,initialTasks:h,labels:i,openTaskId:k}){let l=(0,d.useRouter)(),[,m]=(0,c.useTransition)(),[n,o]=(0,c.useState)(""),[p,q]=(0,c.useState)("all"),[s,t]=(0,c.useState)(!1),[v,w]=(0,c.useState)("TODO"),[x,y]=(0,c.useState)(k??null),[z,A]=(0,c.useState)([]),B=x?h.find(a=>a.id===x)??null:null,[C,D]=(0,c.useState)(null);(0,c.useEffect)(()=>{aZ(e).then(A).catch(()=>A([]))},[e]);let E=z.find(a=>a.isCurrent)?.id??null,F=(0,c.useCallback)(()=>{m(()=>{l.refresh()})},[l]);(0,c.useEffect)(()=>{if(s)return;let a=setInterval(()=>{m(()=>{l.refresh()})},5e3);return()=>clearInterval(a)},[l,s]);let G=(0,c.useCallback)(a=>{o(a)},[]),H=(0,c.useCallback)(async(a,b)=>{await (0,aF.updateTaskStatus)(a,b),F()},[F]),I=(0,c.useCallback)(async a=>{await (0,aV.createTask)({title:a.title,description:a.description,projectId:e,priority:a.priority,status:a.status,labelIds:a.labelIds,baseBranch:a.baseBranch,subPath:a.subPath,versionId:a.versionId??void 0}),F()},[e,F]),J=(0,c.useCallback)(async(a,b)=>{await (0,aW.updateTask)(a,{...b,labelIds:b.labelIds}),D(null),F()},[F]),K=(0,c.useCallback)(async a=>{await aX(a),x===a&&y(null),F()},[F,x]),N=(0,c.useCallback)(async a=>{await aY(a),F()},[F]),O=(0,c.useCallback)(async b=>{try{await (0,aB.startPtyExecution)(b,"")}catch(a){ad.toast.error(a instanceof Error?a.message:String(a))}l.push(`/workspaces/${a}/tasks/${b}`)},[l,a]),P=(0,c.useCallback)(async(a,b)=>{await (0,aF.updateTaskStatus)(a,b),F()},[F]),Q=(0,c.useCallback)(a=>{w(a),D(null),t(!0)},[]),R=(0,c.useCallback)(a=>{D(a),t(!0)},[]),S=h.filter(a=>!a.labels?.some(a=>a.label.name===u.TOWER_LABEL_NAME&&a.label.isBuiltin)),T=S.filter(a=>{if("backlog"===p){if(a.versionId)return!1}else if("all"!==p&&a.versionId!==p)return!1;if(n.trim()){let b=n.toLowerCase();if(!a.title.toLowerCase().includes(b)&&!a.description?.toLowerCase().includes(b))return!1}return!0});return(0,b.jsxs)("div",{className:"flex h-full",children:[(0,b.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,b.jsx)("div",{className:"px-6 pt-3 pb-1",children:(0,b.jsx)(a_,{projects:g,activeProjectId:e,onSelect:b=>l.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1})})}),(0,b.jsx)(j,{totalTasks:S.length,runningTasks:S.filter(a=>"IN_PROGRESS"===a.status).length}),(0,b.jsx)(r,{searchQuery:n,onSearchChange:G,versions:z,versionFilter:p,onVersionFilterChange:q,versionsHref:`/workspaces/${a}/projects/${e}/versions`,onCreateTask:()=>{D(null),t(!0)}}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:(0,b.jsx)(L,{initialTasks:T,onTaskMove:H,onTaskClick:a=>{y(a.id)},onEditTask:R,onAddTask:Q,onDeleteTask:K,onTogglePin:N,workspaceId:a,onContextMenuStatusChange:P,onContextMenuLaunch:O})}),(0,b.jsx)(M.CreateTaskDialog,{open:s,onOpenChange:a=>{t(a),a||D(null)},onSubmit:I,onUpdate:J,defaultStatus:v,editTask:C,editTaskLabelIds:C?.labels?C.labels.map(a=>a.labelId):[],labels:i.filter(a=>!(a.name===u.TOWER_LABEL_NAME&&a.isBuiltin)),projectType:f.type,projectLocalPath:f.localPath,versions:z,defaultVersionId:E})]}),B?(0,b.jsx)(aU,{task:B,workspaceId:a,projectLocalPath:f.localPath,onClose:()=>y(null)}):(0,b.jsx)(an,{project:f,workspaceId:a})]})}],473935)}];
1
+ module.exports=[473935,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(553798),e=a.i(711796);let f=(0,e.default)("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]),g=(0,e.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);var h=a.i(283857),i=a.i(951192);function j({totalTasks:a,runningTasks:c}){let{t:d}=(0,i.useI18n)();return(0,b.jsxs)("div",{className:"grid grid-cols-3 gap-3 px-6 py-4",children:[(0,b.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"rounded-lg bg-sky-500/10 p-2 ring-1 ring-sky-500/20",children:(0,b.jsx)(f,{className:"h-4 w-4 text-sky-400"})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:d("board.overview")}),(0,b.jsx)("p",{className:"text-2xl font-bold font-mono tracking-tight text-foreground",children:a})]})]})}),(0,b.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"rounded-lg bg-primary/10 p-2 ring-1 ring-primary/20",children:(0,b.jsx)(g,{className:"h-4 w-4 text-primary"})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:d("board.running")}),(0,b.jsx)("p",{className:"text-2xl font-bold font-mono tracking-tight text-foreground",children:c})]})]})}),(0,b.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"rounded-lg bg-emerald-500/10 p-2 ring-1 ring-emerald-500/20",children:(0,b.jsx)(h.Lightbulb,{className:"h-4 w-4 text-emerald-400"})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:d("board.tip")}),(0,b.jsx)("p",{className:"text-xs font-medium text-foreground/80",children:d("board.tipText")})]})]})})]})}var k=a.i(634910),l=a.i(774881),m=a.i(573242),n=a.i(577565),o=a.i(699570),p=a.i(866718),q=a.i(580701);function r({searchQuery:a,onSearchChange:c,versions:d=[],versionFilter:e="all",onVersionFilterChange:f,versionsHref:g,onCreateTask:h}){let j,{t:s}=(0,i.useI18n)(),t="all"===e?s("board.allVersions"):"backlog"===e?s("board.backlogFilter"):(j=d.find(a=>a.id===e))?`${j.number} ${j.name}`:s("board.allVersions");return(0,b.jsxs)("div",{className:"flex items-center gap-2 px-6 py-2",children:[f&&(0,b.jsxs)(q.Select,{value:e,onValueChange:a=>f(a||"all"),children:[(0,b.jsxs)(q.SelectTrigger,{className:"h-8 w-44 shrink-0 gap-1.5 text-xs text-muted-foreground",children:[(0,b.jsx)(n.GitBranch,{className:"h-3.5 w-3.5 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:t})]}),(0,b.jsxs)(q.SelectContent,{children:[(0,b.jsx)(q.SelectItem,{value:"all",children:s("board.allVersions")}),(0,b.jsx)(q.SelectItem,{value:"backlog",children:s("board.backlogFilter")}),d.map(a=>(0,b.jsxs)(q.SelectItem,{value:a.id,children:[(0,b.jsx)("span",{className:"font-mono",children:a.number})," ",a.name]},a.id))]})]}),(0,b.jsxs)("div",{className:"relative flex-1 max-w-xs",children:[(0,b.jsx)(m.Search,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),(0,b.jsx)(p.Input,{type:"text",value:a,onChange:a=>c(a.target.value),placeholder:s("board.searchPlaceholder"),className:"pl-8 pr-3 text-xs"})]}),(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[g&&(0,b.jsx)(k.default,{href:g,children:(0,b.jsxs)(o.Button,{variant:"outline",className:"h-8 gap-1.5 text-xs text-muted-foreground",children:[(0,b.jsx)(n.GitBranch,{className:"h-3.5 w-3.5"}),s("version.timeline")]})}),(0,b.jsxs)(o.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:h,children:[(0,b.jsx)(l.Plus,{className:"h-3.5 w-3.5"}),s("board.newTask")]})]})]})}var s=a.i(986099),t=a.i(668116),u=a.i(521007);function v({x:a,y:e,taskId:f,currentStatus:g,hasExecutions:h,workspaceId:j,onClose:k,onStatusChange:l,onLaunch:m}){let{t:n}=(0,i.useI18n)(),o=(0,d.useRouter)(),p=(0,c.useRef)(null);(0,c.useEffect)(()=>{let a=a=>{p.current&&!p.current.contains(a.target)&&k()},b=a=>{"Escape"===a.key&&k()};return document.addEventListener("mousedown",a),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",b)}},[k]);let q="flex items-center px-3 py-1.5 text-xs cursor-pointer hover:bg-accent rounded-sm w-full text-left",r=(0,b.jsxs)("div",{ref:p,style:{position:"fixed",top:e,left:a,zIndex:9999},className:"bg-popover border border-border rounded-md shadow-md py-1 min-w-[180px]",children:[(0,b.jsx)("div",{className:"px-3 py-1 text-[10px] text-muted-foreground uppercase tracking-wider",children:n("board.contextMenu.changeStatus")}),u.BOARD_COLUMNS.map(a=>(0,b.jsxs)("button",{type:"button",className:q,onClick:()=>{l(f,a.id),k()},children:[g===a.id?(0,b.jsx)(t.Check,{className:"h-3 w-3 mr-2 flex-shrink-0"}):(0,b.jsx)("span",{className:"w-5 flex-shrink-0"}),a.label]},a.id)),(0,b.jsx)("hr",{className:"my-1 border-border"}),(0,b.jsx)("button",{type:"button",className:`${q} ${h?"opacity-50 cursor-not-allowed":""}`,disabled:h,onClick:()=>{h||(m(f),k())},children:n("board.contextMenu.launch")}),"DONE"!==g&&"CANCELLED"!==g&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("hr",{className:"my-1 border-border"}),(0,b.jsx)("button",{type:"button",className:q,onClick:()=>{o.push(`/workspaces/${j}/tasks/${f}`),k()},children:n("board.contextMenu.goToDetail")})]})]});return"u"<typeof document?null:(0,s.createPortal)(r,document.body)}var w=a.i(643228),x=a.i(859103);let y=(0,e.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);var z=a.i(514126),A=a.i(336771),B=a.i(690251),C=a.i(975231);let D=(0,e.default)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);var E=a.i(786304),F=a.i(335732);function G({task:a,onClick:c,onEdit:d,onDelete:e,onTogglePin:f,onContextMenu:g}){let{t:h}=(0,i.useI18n)(),{attributes:j,listeners:k,setNodeRef:l,transform:m,transition:n,isDragging:p}=(0,x.useSortable)({id:a.id,data:{type:"task",task:a}}),q={transform:z.CSS.Transform.toString(m),transition:n,opacity:p?.4:1},r=u.PRIORITY_CONFIG[a.priority];return(0,b.jsxs)("div",{ref:l,style:q,...j,...k,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:c,onContextMenu:b=>{b.preventDefault(),b.stopPropagation(),g?.(a,b.clientX,b.clientY)},"data-testid":"task-card",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between",children:[(0,b.jsx)("h4",{className:"text-sm font-medium text-foreground",children:a.title}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",className:`transition-all ${a.pinned?"text-primary opacity-100":"text-muted-foreground opacity-0 group-hover:opacity-100"}`,onClick:b=>{b.stopPropagation(),f?.(a.id)},"aria-label":h(a.pinned?"board.unpin":"board.pin"),children:(0,b.jsx)(D,{className:`h-3.5 w-3.5 ${a.pinned?"-rotate-45":""}`})}),(0,b.jsxs)(F.DropdownMenu,{children:[(0,b.jsx)(F.DropdownMenuTrigger,{render:(0,b.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:a=>a.stopPropagation()}),children:(0,b.jsx)(A.MoreHorizontal,{className:"h-4 w-4"})}),(0,b.jsxs)(F.DropdownMenuContent,{align:"end",children:[(0,b.jsxs)(F.DropdownMenuItem,{onClick:b=>{b.stopPropagation(),d?.(a)},children:[(0,b.jsx)(B.Pencil,{className:"mr-2 h-3.5 w-3.5"}),h("common.edit")]}),(0,b.jsxs)(F.DropdownMenuItem,{className:"text-rose-400",onClick:b=>{b.stopPropagation(),e?.(a.id)},children:[(0,b.jsx)(C.Trash2,{className:"mr-2 h-3.5 w-3.5"}),h("common.delete")]})]})]})]})]}),a.description&&(0,b.jsx)("p",{className:"mt-1.5 line-clamp-3 text-xs leading-relaxed text-muted-foreground",children:a.description}),(0,b.jsx)("div",{className:"mt-2.5",children:(0,b.jsx)(E.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${r.color}`,children:r.label})}),a.labels&&a.labels.length>0&&(0,b.jsx)("div",{className:"mt-1.5 flex flex-wrap gap-1",children:a.labels.map(a=>(0,b.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-medium",style:{backgroundColor:a.label.color+"20",color:a.label.color},children:a.label.name},a.label.id))})]})}var H=a.i(814574),I=a.i(269876);function J({open:a,onOpenChange:c,columnLabel:d,columnColor:e,tasks:f,onTaskClick:g}){let{t:h}=(0,i.useI18n)();return(0,b.jsx)(H.Dialog,{open:a,onOpenChange:c,children:(0,b.jsxs)(H.DialogContent,{className:"sm:max-w-6xl max-h-[80vh]",children:[(0,b.jsx)(H.DialogHeader,{children:(0,b.jsxs)(H.DialogTitle,{className:"flex items-center gap-2",children:[(0,b.jsx)("div",{className:`h-2.5 w-2.5 rounded-full ${e}`}),(0,b.jsx)("span",{children:d}),(0,b.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-mono font-medium text-muted-foreground",children:f.length})]})}),(0,b.jsx)(I.ScrollArea,{className:"max-h-[680px]",children:(0,b.jsxs)("div",{className:"grid grid-cols-4 gap-3 pr-3",children:[f.map(a=>{let d=u.PRIORITY_CONFIG[a.priority];return(0,b.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:()=>{g?.(a),c(!1)},children:[(0,b.jsx)("h4",{className:"text-sm font-medium text-foreground line-clamp-2",children:a.title}),a.description&&(0,b.jsx)("p",{className:"mt-1.5 line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:a.description}),(0,b.jsxs)("div",{className:"mt-2 flex items-center gap-1.5 flex-wrap",children:[(0,b.jsx)(E.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${d.color}`,children:d.label}),a.labels?.map(a=>(0,b.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-medium",style:{backgroundColor:a.label.color+"20",color:a.label.color},children:a.label.name},a.label.id))]})]},a.id)}),0===f.length&&(0,b.jsx)("div",{className:"col-span-4 py-8 text-center text-sm text-muted-foreground",children:h("board.noTasks")})]})})]})})}function K({id:a,label:d,color:e,tasks:f,onTaskClick:g,onEditTask:h,onAddTask:j,onDeleteTask:k,onTogglePin:m,onContextMenu:n}){let{setNodeRef:p,isOver:q}=(0,w.useDroppable)({id:a}),[r,s]=(0,c.useState)(!1),{t}=(0,i.useI18n)();return(0,b.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 ${q?"bg-primary/[0.06]":""}`,children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-3 py-2.5 border-b border-border/30",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("div",{className:`h-2 w-2 rounded-full ${e}`}),(0,b.jsx)("span",{className:"text-xs font-semibold tracking-wide text-secondary-foreground",children:d}),(0,b.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-mono font-medium text-muted-foreground",children:f.length})]}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>s(!0),className:"text-muted-foreground","aria-label":t("board.viewAll"),children:(0,b.jsx)(y,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:j,className:"text-muted-foreground","aria-label":"add",children:(0,b.jsx)(l.Plus,{className:"h-3.5 w-3.5"})})]})]}),(0,b.jsx)(J,{open:r,onOpenChange:s,columnLabel:d,columnColor:e,tasks:f,onTaskClick:g}),(0,b.jsx)(I.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)("div",{ref:p,className:"flex flex-col gap-2 p-2",children:(0,b.jsx)(x.SortableContext,{items:f.map(a=>a.id),strategy:x.verticalListSortingStrategy,children:f.map(a=>(0,b.jsx)(G,{task:a,onClick:()=>g?.(a),onEdit:h,onDelete:k,onTogglePin:m,onContextMenu:n},a.id))})})})]})}function L({initialTasks:a,onTaskMove:d,onTaskClick:e,onEditTask:f,onAddTask:g,onDeleteTask:h,onTogglePin:i,onContextMenuStatusChange:j,onContextMenuLaunch:k,workspaceId:l}){let[m,n]=(0,c.useState)(a),[o,p]=(0,c.useState)(null),[q,r]=(0,c.useState)(null);(0,c.useEffect)(()=>{n(a)},[a]);let s=(0,w.useSensors)((0,w.useSensor)(w.PointerSensor,{activationConstraint:{distance:8}})),t=(0,c.useCallback)((a,b,c)=>{r({task:a,x:b,y:c})},[]),x=(0,c.useCallback)(a=>{let b=m.find(b=>b.id===a.active.id);b&&p(b)},[m]),y=(0,c.useCallback)(a=>{let b,{active:c,over:e}=a;if(p(null),!e)return;let f=c.id,g=e.id;if(u.BOARD_COLUMNS.some(a=>a.id===g))b=g;else{let a=m.find(a=>a.id===g);b=a?.status}b&&(n(a=>a.map(a=>a.id===f?{...a,status:b}:a)),d?.(f,b))},[m,d]);return(0,b.jsxs)(w.DndContext,{id:"kanban-board",sensors:s,collisionDetection:w.closestCorners,onDragStart:x,onDragEnd:y,children:[(0,b.jsx)("div",{className:"mx-2 flex h-full overflow-x-auto rounded-xl border border-border bg-card/50",children:u.BOARD_COLUMNS.map(a=>(0,b.jsx)(K,{id:a.id,label:a.label,color:a.color,tasks:m.filter(b=>b.status===a.id),onTaskClick:e,onEditTask:f,onAddTask:()=>g?.(a.id),onDeleteTask:h,onTogglePin:i,onContextMenu:t},a.id))}),(0,b.jsx)(w.DragOverlay,{children:o?(0,b.jsx)("div",{className:"rotate-3 scale-105",children:(0,b.jsx)(G,{task:o})}):null}),q&&(0,b.jsx)(v,{x:q.x,y:q.y,taskId:q.task.id,currentStatus:q.task.status,hasExecutions:(q.task._count?.executions??0)>0,workspaceId:l??"",onClose:()=>r(null),onStatusChange:(a,b)=>{j?.(a,b),r(null)},onLaunch:a=>{k?.(a),r(null)}})]})}var M=a.i(445798),N=a.i(442620),O=a.i(10390),P=a.i(851378),Q=a.i(350739),R=a.i(347165);let S=(0,e.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 T=a.i(616335),U=a.i(704494),V=a.i(394259),W=a.i(192369),X=a.i(429246),Y=a.i(780410);let Z=(0,Y.createServerReference)("605ebe4b2fe7df781528af26c6ba05ad99a170494d",Y.callServer,void 0,Y.findSourceMapURL,"updateProject");var $=a.i(345461);let _=(0,Y.createServerReference)("40a6f54a8eaddca32b1b82916d299acd01ec10e2a1",Y.callServer,void 0,Y.findSourceMapURL,"deleteProject"),aa=(0,Y.createServerReference)("403cdffff8e68b74f4b87600180859186790e48c88",Y.callServer,void 0,Y.findSourceMapURL,"getRecentLocalProjects"),ab=(0,Y.createServerReference)("408ca143a464253c708c120389a2daf12a50459d39",Y.callServer,void 0,Y.findSourceMapURL,"getOrCreateTowerTaskId");var ac=a.i(807439),ad=a.i(952313),ae=a.i(43775),af=a.i(487410),ag=a.i(791717),ah=a.i(22761);function ai({commits:a}){let{t:d}=(0,i.useI18n)(),[e,f]=(0,c.useState)(!1);return 0===a.length?null:(0,b.jsxs)("div",{children:[(0,b.jsxs)("button",{onClick:()=>f(!e),className:"flex w-full items-center justify-between py-1",children:[(0,b.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:d("git.commitLog")}),e?(0,b.jsx)(N.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,b.jsx)(O.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),e&&(0,b.jsx)("div",{className:"mt-1.5 space-y-0.5 max-h-64 overflow-y-auto",children:a.map(a=>(0,b.jsxs)("div",{className:"group flex items-start gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,b.jsx)(S,{className:"h-3 w-3 shrink-0 text-muted-foreground mt-0.5"}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("p",{className:"text-xs text-foreground line-clamp-1",children:a.message}),(0,b.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,b.jsxs)("button",{onClick:()=>{navigator.clipboard.writeText(a.shortHash),ad.toast.success(`Copied ${a.shortHash}`)},className:"flex items-center gap-0.5 font-mono text-[10px] text-primary/70 hover:text-primary transition-colors",children:[a.shortHash,(0,b.jsx)(ah.Copy,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:a.author}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(a){let b=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(b<1)return"just now";if(b<60)return`${b}m`;let c=Math.floor(b/60);if(c<24)return`${c}h`;let d=Math.floor(c/24);return d<30?`${d}d`:`${Math.floor(d/30)}mo`}(a.date)})]})]})]},a.hash))})]})}var aj=a.i(607219),ak=a.i(324263),al=a.i(7285);function am({localPath:a,stashes:d,hasChanges:e,onRefresh:f}){let{t:g}=(0,i.useI18n)(),[h,j]=(0,c.useState)(!1),[k,l]=(0,c.useState)(!1),[m,n]=(0,c.useState)(""),[q,r]=(0,c.useState)(null),s=async()=>{l(!0);try{await (0,al.gitAction)(a,"stash-save",{message:m}),n(""),ad.toast.success(g("git.stashSaved")),await f()}catch(a){ad.toast.error(a instanceof Error?a.message:String(a))}finally{l(!1)}},t=async b=>{r(b);try{await (0,al.gitAction)(a,"stash-pop",{index:b}),ad.toast.success(g("git.stashApplied")),await f()}catch(a){ad.toast.error(a instanceof Error?a.message:String(a))}finally{r(null)}},u=async b=>{r(b);try{await (0,al.gitAction)(a,"stash-drop",{index:b}),ad.toast.success(g("git.stashDropped")),await f()}catch(a){ad.toast.error(a instanceof Error?a.message:String(a))}finally{r(null)}};return e||0!==d.length?(0,b.jsxs)("div",{children:[(0,b.jsxs)("button",{onClick:()=>j(!h),className:"flex w-full items-center justify-between py-1",children:[(0,b.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[g("git.stash")," ",d.length>0&&`(${d.length})`]}),h?(0,b.jsx)(N.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,b.jsx)(O.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),h&&(0,b.jsxs)("div",{className:"mt-1.5 space-y-2",children:[e&&(0,b.jsxs)("div",{className:"flex gap-1.5",children:[(0,b.jsx)(p.Input,{value:m,onChange:a=>n(a.target.value),placeholder:g("git.stashMsgPlaceholder"),className:"h-7 text-xs flex-1",onKeyDown:a=>"Enter"===a.key&&s()}),(0,b.jsx)(o.Button,{variant:"outline",size:"icon-sm",onClick:s,disabled:k,className:"shrink-0",children:k?(0,b.jsx)(U.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aj.Archive,{className:"h-3 w-3"})})]}),d.length>0&&(0,b.jsx)("div",{className:"space-y-0.5",children:d.map(a=>(0,b.jsxs)("div",{className:"group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,b.jsx)(aj.Archive,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"flex-1 min-w-0 truncate text-xs text-foreground",children:a.message||`stash@{${a.index}}`}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>t(a.index),disabled:q===a.index,className:"text-muted-foreground","aria-label":g("git.stashApply"),children:q===a.index?(0,b.jsx)(U.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(ak.ArrowUpFromLine,{className:"h-3 w-3"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>u(a.index),disabled:q===a.index,className:"text-rose-400","aria-label":g("git.stashDrop"),children:(0,b.jsx)(C.Trash2,{className:"h-3 w-3"})})]})]},a.index))})]})]}):null}function an({project:a,workspaceId:e}){let{t:f,locale:g}=(0,i.useI18n)(),h=(0,d.useRouter)(),[j,k]=(0,c.useState)(!0),[l,m]=(0,c.useState)(!0),[q,r]=(0,c.useState)(!1),[s,t]=(0,c.useState)(!1),[u,v]=(0,c.useState)(""),[w,x]=(0,c.useState)(!1),[y,z]=(0,c.useState)(!1),[A,D]=(0,c.useState)(!1),[E,F]=(0,c.useState)(a.name),[G,I]=(0,c.useState)(a.alias??""),[J,K]=(0,c.useState)(a.description??""),[L,M]=(0,c.useState)(a.localPath??""),[W,Y]=(0,c.useState)(a.projectType??"FRONTEND"),[ah,aj]=(0,c.useState)([]);(0,c.useEffect)(()=>{aa(100).then(aj)},[]);let[ak,al]=(0,c.useState)(!1),[ap,aq]=(0,c.useState)(""),[ar,as]=(0,c.useState)(""),[at,au]=(0,c.useState)(""),[av,aw]=(0,c.useState)(""),[ax,ay]=(0,c.useState)("FRONTEND"),[az,aA]=(0,c.useState)(!1),[aB,aC]=(0,c.useState)(!1),[aD,aE]=(0,c.useState)(null),[aF,aG]=(0,c.useState)(!1),[aH,aI]=(0,c.useState)(!1),[aJ,aK]=(0,c.useState)(!1),aL=a=>{ad.toast.info(a)},aM=(0,c.useCallback)(async()=>{if(a.localPath){aG(!0);try{let b=await fetch(`/api/git?path=${encodeURIComponent(a.localPath)}`);b.ok&&aE(await b.json())}catch{}finally{aG(!1)}}},[a.localPath]);(0,c.useEffect)(()=>{aM()},[aM]);let aN=async()=>{if(a.localPath){aI(!0);try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",path:a.localPath})})).ok?(aL(f("git.initSuccess")),await aM()):aL(f("git.initFailed"))}catch{aL(f("git.initFailed"))}finally{aI(!1)}}},aO=async b=>{if(a.localPath)try{let c=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"checkout",path:a.localPath,branch:b})});if(c.ok)aL(`${f("git.switchSuccess")} ${b}`),await aM();else{let a=await c.json();aL(`${f("git.switchFailed")}: ${a.error}`)}}catch{aL(f("git.switchFailed"))}},aP=(a,b)=>{h.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1}),h.refresh()},aQ=async()=>{if(ar.trim()){aA(!0);try{let a=await (0,$.createProject)({name:ar.trim(),alias:at.trim()||void 0,description:av.trim()||void 0,localPath:ap,projectType:ax,workspaceId:e});al(!1),aP(e,a.id)}catch(a){ad.toast.error(a instanceof Error?a.message:String(a))}finally{aA(!1)}}},aR=async()=>{if(L&&!aB){aC(!0);try{let a=await (0,ac.analyzeProjectDirectory)(L.trim(),g);K(a)}catch{ad.toast.error(f("project.analyzeError"))}finally{aC(!1)}}},aS=async()=>{try{await Z(a.id,{name:E.trim(),alias:G.trim()||void 0,description:J.trim()||void 0,localPath:L.trim()||void 0,projectType:W}),h.refresh(),r(!1)}catch(a){ad.toast.error(a instanceof Error?a.message:String(a))}};return(0,b.jsxs)("aside",{className:"relative w-72 flex-shrink-0 overflow-y-auto border-l border-border bg-sidebar",children:[(0,b.jsxs)("div",{className:"border-b border-border p-4",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("h2",{className:"text-base font-semibold text-foreground",children:a.name}),a.alias&&(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:a.alias})]}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{F(a.name),I(a.alias??""),K(a.description??""),M(a.localPath??""),r(!0)},className:"text-muted-foreground",children:(0,b.jsx)(B.Pencil,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{v(""),t(!0)},className:"text-muted-foreground hover:text-rose-400",children:(0,b.jsx)(C.Trash2,{className:"h-3.5 w-3.5"})})]})]}),a.description&&(0,b.jsx)("p",{className:"mt-2 text-sm text-secondary-foreground leading-relaxed line-clamp-4",children:a.description}),(0,b.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:(0,b.jsx)("span",{className:`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium ${"GIT"===a.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"===a.type?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.GitBranch,{className:"h-3 w-3"}),f("sidebar.right.gitType")]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(Q.FileText,{className:"h-3 w-3"}),f("sidebar.right.normalType")]})})}),a.localPath&&(0,b.jsxs)("div",{className:"mt-3 flex items-start gap-2 rounded-md bg-muted/50 px-2.5 py-2 text-xs",children:[(0,b.jsx)(R.FolderOpen,{className:"mt-0.5 h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"break-all font-mono text-secondary-foreground",children:a.localPath})]}),a.gitUrl&&(0,b.jsxs)("div",{className:"mt-2 flex items-start gap-2 rounded-md bg-muted/50 px-2.5 py-2 text-xs",children:[(0,b.jsx)(P.Globe,{className:"mt-0.5 h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"break-all text-secondary-foreground",children:a.gitUrl})]}),a.localPath&&(0,b.jsxs)(o.Button,{variant:"outline",className:"mt-3 w-full h-8 gap-1.5 text-xs",disabled:y,onClick:async()=>{z(!0);try{let b=await ab(a.id);h.push(`/workspaces/${e}/tasks/${b}`)}catch{ad.toast.error(f("git.openStudioFailed"))}finally{z(!1)}},children:[y?(0,b.jsx)(U.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,b.jsx)(R.FolderOpen,{className:"h-3.5 w-3.5"}),f("git.openStudio")]})]}),(0,b.jsxs)("div",{className:"border-b border-border p-4",children:[(0,b.jsxs)(o.Button,{variant:"ghost",onClick:()=>k(!j),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,b.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:f("git.section")}),j?(0,b.jsx)(N.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,b.jsx)(O.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),j&&(0,b.jsx)("div",{className:"mt-3",children:a.localPath?aF?(0,b.jsxs)("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:[(0,b.jsx)(U.Loader2,{className:"h-4 w-4 animate-spin"}),(0,b.jsx)("span",{className:"ml-2 text-xs",children:f("git.loading")})]}):aD&&!aD.isGit?(0,b.jsxs)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,b.jsx)(T.AlertCircle,{className:"h-3.5 w-3.5"}),(0,b.jsx)("p",{className:"text-xs",children:f("git.notInitialized")})]}),(0,b.jsxs)(o.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:aN,disabled:aH,children:[aH?(0,b.jsx)(U.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(S,{className:"h-3 w-3"}),f("git.initRepo")]})]}):aD?.isGit?(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsx)(ao,{localBranches:aD.branches??[],remoteBranches:(aD.remoteBranches??[]).filter(a=>!aD.branches?.includes(a)),currentBranch:aD.currentBranch??"",onSwitch:aO,onFetch:async()=>{a.localPath&&(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"fetch",path:a.localPath})}),await aM())},onCreateBranch:()=>aK(!0)}),(0,b.jsx)(ai,{commits:aD.commits??[]}),(0,b.jsx)(am,{localPath:a.localPath,stashes:aD.stashes??[],hasChanges:(aD.changedFiles??[]).length>0,onRefresh:aM})]}):null:(0,b.jsx)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:(0,b.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,b.jsx)(T.AlertCircle,{className:"h-3.5 w-3.5"}),(0,b.jsx)("p",{className:"text-xs",children:f("git.noLocalPath")})]})})})]}),(0,b.jsxs)("div",{className:"p-4",children:[(0,b.jsxs)(o.Button,{variant:"ghost",onClick:()=>m(!l),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,b.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:f("sidebar.right.browseRepo")}),l?(0,b.jsx)(N.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,b.jsx)(O.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),l&&(0,b.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,b.jsxs)(o.Button,{variant:"outline",className:"w-full h-8 gap-1.5 text-xs",onClick:()=>D(!0),children:[(0,b.jsx)(R.FolderOpen,{className:"h-3.5 w-3.5"}),f("sidebar.right.browseRepo")]}),ah.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5 px-1",children:f("sidebar.right.recent")}),(0,b.jsx)("div",{className:"space-y-0.5",children:ah.map(c=>(0,b.jsxs)("button",{onClick:()=>{c.id!==a.id&&aP(c.workspaceId,c.id)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors ${c.id===a.id?"bg-primary/10 text-primary cursor-default":"hover:bg-accent cursor-pointer"}`,children:["GIT"===c.type?(0,b.jsx)(n.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,b.jsx)(R.FolderOpen,{className:"h-3 w-3 shrink-0 text-primary/70"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsx)("p",{className:"truncate text-xs font-medium text-foreground",children:c.name}),c.localPath&&(0,b.jsx)("p",{className:"truncate text-[10px] font-mono text-muted-foreground",children:c.localPath})]})]},c.id))})]})]})]}),(0,b.jsx)(H.Dialog,{open:q,onOpenChange:r,children:(0,b.jsxs)(H.DialogContent,{style:{maxWidth:"32rem"},children:[(0,b.jsx)(H.DialogHeader,{children:(0,b.jsx)(H.DialogTitle,{children:f("project.edit")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(p.Input,{value:E,onChange:a=>F(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.type.label")}),(0,b.jsx)("div",{className:"mt-1.5",children:(0,b.jsx)(af.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:W,onChange:Y})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(p.Input,{value:G,onChange:a=>I(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsxs)(o.Button,{type:"button",variant:"ghost",onClick:aR,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!L||aB?"opacity-50":""}`,children:[aB?(0,b.jsx)(U.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(V.Sparkles,{className:"h-3 w-3"}),aB?f("project.analyzing"):f("project.genDesc")]})]}),(0,b.jsx)(X.Textarea,{value:J,onChange:a=>K(a.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,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,b.jsx)(p.Input,{value:L,onChange:a=>M(a.target.value),placeholder:f("project.localPathPlaceholder"),className:"flex-1 font-mono text-xs"}),(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>D(!0),className:"h-8 shrink-0",children:f("folder.browse")})]})]})]}),(0,b.jsxs)(H.DialogFooter,{children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>r(!1),children:f("common.cancel")}),(0,b.jsx)(o.Button,{onClick:aS,disabled:!E.trim()||aB,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:f("common.save")})]})]})}),(0,b.jsx)(ae.FolderBrowserDialog,{open:A,onOpenChange:D,onSelect:a=>{q?M(a):(a=>{let b=ah.find(b=>b.localPath===a);if(b)return aP(b.workspaceId,b.id);let c=a.split("/").filter(Boolean).pop()??"";aq(a),as(c),au(""),aw(""),al(!0)})(a)}}),(0,b.jsx)(H.Dialog,{open:ak,onOpenChange:al,children:(0,b.jsxs)(H.DialogContent,{className:"sm:max-w-md",children:[(0,b.jsx)(H.DialogHeader,{children:(0,b.jsx)(H.DialogTitle,{children:f("topbar.newProject")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.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:ap})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(p.Input,{value:ar,onChange:a=>as(a.target.value),placeholder:f("project.namePlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.type.label")}),(0,b.jsx)("div",{className:"mt-1.5",children:(0,b.jsx)(af.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:ax,onChange:ay})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(p.Input,{value:at,onChange:a=>au(a.target.value),placeholder:f("project.aliasPlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsx)(X.Textarea,{value:av,onChange:a=>aw(a.target.value),placeholder:f("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,b.jsxs)(H.DialogFooter,{children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>al(!1),children:f("common.cancel")}),(0,b.jsxs)(o.Button,{onClick:aQ,disabled:!ar.trim()||az,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[az?(0,b.jsx)(U.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,f("common.create")]})]})]})}),aD?.isGit&&(0,b.jsx)(ag.CreateBranchDialog,{open:aJ,onOpenChange:aK,branches:aD.branches??[],currentBranch:aD.currentBranch??"",localPath:a.localPath,onCreated:async()=>{await aM(),aL(f("git.createSuccess"))},onError:a=>aL(`${f("git.createFailed")}: ${a}`)}),(0,b.jsx)(H.Dialog,{open:s,onOpenChange:a=>{t(a),a||v("")},children:(0,b.jsxs)(H.DialogContent,{className:"sm:max-w-md",children:[(0,b.jsx)(H.DialogHeader,{children:(0,b.jsx)(H.DialogTitle,{className:"text-rose-400",children:f("project.deleteTitle")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:f("project.deleteWarning",{name:a.name})}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:f("project.deleteIrreversible")}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.deleteConfirmLabel")}),(0,b.jsx)(p.Input,{value:u,onChange:a=>v(a.target.value),placeholder:f("project.deleteConfirmPlaceholder"),className:"mt-1.5",autoFocus:!0})]})]}),(0,b.jsxs)(H.DialogFooter,{children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>t(!1),children:f("common.cancel")}),(0,b.jsxs)(o.Button,{variant:"destructive",disabled:u!==f("project.deleteConfirmText")||w,onClick:async()=>{x(!0);try{await _(a.id),ad.toast.success(f("project.deleteSuccess")),h.push(`/workspaces/${e}`)}catch{ad.toast.error(f("project.deleteFailed"))}finally{x(!1),t(!1)}},children:[w&&(0,b.jsx)(U.Loader2,{className:"h-3 w-3 animate-spin mr-1"}),f("project.deleteButton")]})]})]})})]})}function ao({localBranches:a,remoteBranches:d,currentBranch:e,onSwitch:f,onFetch:g,onCreateBranch:h}){let{t:j}=(0,i.useI18n)(),[k,p]=(0,c.useState)(!1),[q,r]=(0,c.useState)(""),[s,u]=(0,c.useState)(!1),v=(0,c.useRef)(null);(0,c.useEffect)(()=>{if(k)return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a);function a(a){v.current&&!v.current.contains(a.target)&&p(!1)}},[k]);let w=q.toLowerCase(),x=a.filter(a=>a.toLowerCase().includes(w)),y=d.filter(a=>a.toLowerCase().includes(w)),z=x.length>0||y.length>0,A=async()=>{u(!0);try{await g()}finally{u(!1)}};return(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,b.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:j("git.currentBranch")}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:A,disabled:s,className:"text-muted-foreground","aria-label":"Fetch",children:(0,b.jsx)(W.RefreshCw,{className:`h-3 w-3 ${s?"animate-spin":""}`})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:h,className:"text-muted-foreground","aria-label":j("git.createBranch"),children:(0,b.jsx)(l.Plus,{className:"h-3 w-3"})})]})]}),(0,b.jsxs)("div",{className:"relative",ref:v,children:[(0,b.jsxs)("button",{onClick:()=>{p(!k),r("")},className:"flex w-full items-center justify-between rounded-lg border border-border bg-muted/50 px-3 py-2 text-left transition-colors hover:bg-accent",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,b.jsx)(n.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}),(0,b.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:e||"—"})]}),(0,b.jsx)(N.ChevronDown,{className:`h-3 w-3 shrink-0 text-muted-foreground transition-transform ${k?"rotate-180":""}`})]}),k&&(0,b.jsxs)("div",{className:"absolute left-0 right-0 top-full z-20 mt-1 rounded-lg border border-border bg-popover shadow-xl",children:[(0,b.jsx)("div",{className:"border-b border-border p-1.5",children:(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)(m.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),(0,b.jsx)("input",{value:q,onChange:a=>r(a.target.value),placeholder:"Filter...",autoFocus:!0,className:"h-7 w-full rounded-md bg-muted/50 pl-7 pr-2 text-xs text-foreground placeholder-muted-foreground outline-none focus:ring-1 focus:ring-ring"})]})}),(0,b.jsxs)("div",{className:"max-h-60 overflow-auto py-1",children:[!z&&(0,b.jsx)("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No branches found"}),x.length>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"px-3 pt-1.5 pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:j("git.localBranches")}),x.map(a=>{let c=a===e;return(0,b.jsxs)("button",{onClick:()=>{c||f(a),p(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors ${c?"bg-emerald-500/10 text-emerald-400":"text-secondary-foreground hover:bg-accent"}`,children:[(0,b.jsx)(n.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate font-mono text-xs",children:a}),c&&(0,b.jsx)(t.Check,{className:"h-3 w-3 ml-auto shrink-0"})]},`local-${a}`)})]}),y.length>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"px-3 pt-2.5 pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:j("git.remoteBranches")}),y.map(a=>(0,b.jsxs)("button",{onClick:()=>{f(a),p(!1)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-secondary-foreground transition-colors hover:bg-accent",children:[(0,b.jsx)(P.Globe,{className:"h-3 w-3 shrink-0 text-sky-400"}),(0,b.jsx)("span",{className:"truncate font-mono text-xs",children:a})]},`remote-${a}`))]})]})]})]})]})}var ap=a.i(963326),aq=a.i(648512),ar=a.i(300141),as=a.i(913284),at=a.i(785259),au=a.i(269280),av=a.i(368114);function aw({title:a,description:c,branch:d,baseBranch:e,hasConversation:f,updatedAt:g,onBack:h}){let{t:j}=(0,i.useI18n)();return(0,b.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(V.Sparkles,{className:"h-3.5 w-3.5 text-primary"}),(0,b.jsx)("span",{className:"text-xs font-semibold text-primary",children:j("taskDetail.title")})]}),(0,b.jsxs)(o.Button,{variant:"ghost",onClick:h,className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground h-auto px-2 py-1",children:[(0,b.jsx)(au.ArrowLeft,{className:"h-3.5 w-3.5"}),j("taskDetail.back")]})]}),(0,b.jsx)("h2",{className:"mt-2.5 text-lg font-bold tracking-tight text-foreground",children:a}),c&&(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:c}),(0,b.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e?(0,b.jsxs)(E.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:[(0,b.jsx)(n.GitBranch,{className:"mr-1 h-3 w-3"}),e," · worktree"]}):d?(0,b.jsx)(E.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:j("taskDetail.directMode")}):null,f&&(0,b.jsx)(E.Badge,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-400 text-[10px] border border-emerald-500/20",children:j("taskDetail.hasConversation")}),(0,b.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[j("taskDetail.updatedAt")," ",(0,av.formatRelativeTime)(g)]})]})]})}var ax=a.i(639138),ay=a.i(88757),az=a.i(347872),aA=a.i(755074),aB=a.i(240586),aC=a.i(152538),aD=a.i(193433),aE=a.i(803484),aF=a.i(652482),aG=a.i(570251),aH=a.i(689775),aI=a.i(103517),aJ=a.i(715525),aK=a.i(324954);let aL=(0,e.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);var aM=a.i(54384),aN=a.i(508637);let aO=(0,Y.createServerReference)("40e4f84812477567b064f24e1a7fa8934b575642ec",Y.callServer,void 0,Y.findSourceMapURL,"getTaskNotes");var aP=a.i(62397);let aQ=(0,Y.createServerReference)("400c4004b4c9205452e2ce3b821ee9565898d092fd",Y.callServer,void 0,Y.findSourceMapURL,"getTaskAssets");var aR=a.i(161083),aS=a.i(226918);function aT({taskId:a,projectId:d}){let{t:e}=(0,i.useI18n)(),f=(0,c.useRef)(null),[g,h]=(0,c.useState)([]),[j,k]=(0,c.useState)([]),[m,n]=(0,c.useState)(!1),[p,q]=(0,c.useState)(""),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(!1);async function v(){p.trim()&&(await (0,aN.createNote)({title:p.trim(),content:r.trim(),projectId:d,taskId:a,category:"task"}),q(""),s(""),n(!1),aO(a).then(h))}async function w(a){await (0,aP.deleteNote)(a),h(b=>b.filter(b=>b.id!==a))}async function x(b){let c=b.target.files?.[0];if(c){u(!0);try{let b=new FormData;b.set("file",c),b.set("projectId",d),b.set("taskId",a),await (0,aR.uploadAsset)(b),aQ(a).then(k)}finally{u(!1),f.current&&(f.current.value="")}}}async function y(a){await (0,aS.deleteAsset)(a),k(b=>b.filter(b=>b.id!==a))}return(0,c.useEffect)(()=>{aO(a).then(h),aQ(a).then(k)},[a]),(0,b.jsx)(I.ScrollArea,{className:"h-full",children:(0,b.jsxs)("div",{className:"flex flex-col",children:[(0,b.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,b.jsx)(Q.FileText,{className:"h-3.5 w-3.5"}),e("taskPage.notes")]}),(0,b.jsxs)(o.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>n(!m),children:[m?(0,b.jsx)(aM.X,{className:"h-3 w-3"}):(0,b.jsx)(l.Plus,{className:"h-3 w-3"}),m?"":e("taskPage.addNote")]})]}),m&&(0,b.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,b.jsx)("input",{type:"text",value:p,onChange:a=>q(a.target.value),placeholder:e("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,b.jsx)("textarea",{value:r,onChange:a=>s(a.target.value),placeholder:e("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,b.jsx)(o.Button,{className:"text-xs",onClick:v,disabled:!p.trim(),children:e("taskPage.addNote")})]}),(0,b.jsxs)("div",{className:"mt-2 space-y-2",children:[0===g.length&&!m&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:e("taskPage.noNotes")}),g.map(a=>(0,b.jsx)("div",{className:"group rounded-md border border-border bg-card p-3",children:(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsx)("h4",{className:"text-sm font-medium truncate",children:a.title}),a.content&&(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-3 whitespace-pre-wrap",children:a.content}),(0,b.jsx)("p",{className:"mt-1 text-[10px] text-muted-foreground",children:new Date(a.createdAt).toLocaleString()})]}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>w(a.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:e("taskPage.deleteNote"),children:(0,b.jsx)(C.Trash2,{className:"h-3.5 w-3.5"})})]})},a.id))]})]}),(0,b.jsxs)("div",{className:"px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,b.jsx)(aL,{className:"h-3.5 w-3.5"}),e("taskPage.attachments")]}),(0,b.jsxs)(o.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>f.current?.click(),disabled:t,children:[(0,b.jsx)(aK.Upload,{className:"h-3 w-3"}),e("taskPage.uploadFile")]}),(0,b.jsx)("input",{ref:f,type:"file",className:"hidden",onChange:x})]}),(0,b.jsxs)("div",{className:"mt-2 space-y-1.5",children:[0===j.length&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:e("taskPage.noAttachments")}),j.map(a=>{var c;return(0,b.jsxs)("div",{className:"group flex items-center gap-2 rounded-md border border-border bg-card px-3 py-2",children:[(0,b.jsx)(aL,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"flex-1 truncate text-sm",children:a.filename}),(0,b.jsx)("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:(c=a.size)?c<1024?`${c} B`:c<1048576?`${(c/1024).toFixed(1)} KB`:`${(c/1024/1024).toFixed(1)} MB`:""}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>y(a.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:e("taskPage.deleteAttachment"),children:(0,b.jsx)(C.Trash2,{className:"h-3 w-3"})})]},a.id)})]})]})]})})}function aU({task:a,workspaceId:e,projectLocalPath:f,onClose:g}){let{t:h}=(0,i.useI18n)(),j=(0,d.useRouter)(),{removePortal:k}=(0,az.useTerminalPortal)(),[l,m]=(0,c.useState)("terminal"),[n,p]=(0,c.useState)(null),[r,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)(a.status);(0,c.useEffect)(()=>{u(a.status)},[a.status]);let[v,w]=(0,c.useState)(null),[x,y]=(0,c.useState)(!1),[z,A]=(0,c.useState)(!1),[B,C]=(0,c.useState)([]);(0,c.useEffect)(()=>{w(null),y(!1),A(!1),C([]),p(null),m("terminal")},[a.id]);let[D,E]=(0,c.useState)([]),[F,G]=(0,c.useState)(null);(0,c.useEffect)(()=>{let a=!1;return(0,aI.getPrompts)().then(b=>{if(a)return;E(b.map(a=>({id:a.id,name:a.name,isDefault:a.isDefault})));let c=b.find(a=>a.isDefault);c&&G(c.id)}),()=>{a=!0}},[]),(0,c.useEffect)(()=>{w(null),A(!1);let b=!1;return(0,aA.getTaskExecutions)(a.id).then(a=>{if(b)return;let c=a[0];if(c?.status==="RUNNING"){let a=c.worktreePath||f||null;a&&w(a)}C(a.filter(a=>"RUNNING"!==a.status)),A(!0)}),()=>{b=!0}},[a.id]),(0,c.useEffect)(()=>{if("changes"!==l||"TODO"===t||"CANCELLED"===t)return;let b=!1;return s(!0),fetch(`/api/tasks/${a.id}/diff`).then(a=>{if(!a.ok)throw Error(`HTTP ${a.status}`);return a.json()}).then(a=>{b||p(a?.files||a?.branchDeleted?a:null)}).catch(()=>{b||p(null)}).finally(()=>{b||s(!1)}),()=>{b=!0}},[l,t,a.id]);let H=(0,c.useCallback)(async()=>{if(!x){y(!0),k(a.id);try{let{worktreePath:b}=await (0,aB.startPtyExecution)(a.id,"",F);w(b),u("IN_PROGRESS")}catch(a){y(!1),ad.toast.error(a instanceof Error?a.message:String(a))}}},[a.id,x,F]),J=(0,c.useCallback)(b=>{y(!1),w(null),k(a.id),0===b&&u("IN_REVIEW"),(0,aA.getTaskExecutions)(a.id).then(a=>{C(a.filter(a=>"RUNNING"!==a.status))}),j.refresh()},[j,a.id]),K=(0,c.useCallback)(async()=>{await (0,aC.stopPtyExecution)(a.id),y(!1),k(a.id),w(null),u("IN_REVIEW"),(0,aA.getTaskExecutions)(a.id).then(a=>{C(a.filter(a=>"RUNNING"!==a.status))}),j.refresh()},[a.id,j]),L=(0,c.useCallback)(async b=>{y(!0),k(a.id),w(null);try{let{worktreePath:c}=await (0,aD.resumePtyExecution)(a.id,b);w(c),u("IN_PROGRESS")}catch{y(!1)}},[a.id,k]),M=(0,c.useCallback)(async()=>{y(!0),k(a.id),w(null);try{let{worktreePath:b}=await (0,aE.continueLatestPtyExecution)(a.id);w(b),u("IN_PROGRESS")}catch(a){y(!1),ad.toast.error(a instanceof Error?a.message:String(a))}},[a.id,k]),[N,O]=(0,c.useState)(!1),[P,R]=(0,c.useState)([]),S=(0,c.useCallback)(async()=>{try{let b=await (0,aG.checkWorktreeClean)(a.id);if(b.hasWorktree&&!b.clean)return void ad.toast.error(h("taskPage.uncommittedChanges",{count:String(b.files.length)}));if(b.hasWorktree&&b.clean&&!b.hasCommits)return void ad.toast.error(h("taskPage.noChangesToComplete"));if(b.hasWorktree&&b.hasCommits){R(b.commitLog),O(!0);return}await (0,aF.updateTaskStatus)(a.id,"DONE"),u("DONE"),ad.toast.success(h("taskPage.taskCompleted")),j.refresh()}catch{ad.toast.error("Failed to complete task")}},[a.id,j,h]),T=(0,c.useCallback)(()=>{u("DONE"),O(!1),ad.toast.success(h("taskPage.taskCompleted")),j.refresh()},[j,h]),V=(0,c.useCallback)(async b=>{try{let{hash:c}=await (0,aH.commitWorktreeChanges)(a.id,b);ad.toast.success(h("diff.commitSuccess",{hash:c})),j.refresh();let d=await fetch(`/api/tasks/${a.id}/diff`);if(d.ok){let a=await d.json();p(a?.files?a:null)}}catch(a){ad.toast.error(a instanceof Error?a.message:"Commit failed")}},[a.id,j,h]);return(0,b.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,b.jsx)(aw,{title:a.title,description:h("taskDetail.panelDescription"),branch:`task/${a.id}`,baseBranch:a.baseBranch,hasConversation:!1,updatedAt:a.updatedAt,onBack:g}),(0,b.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-2",children:[(0,b.jsxs)("div",{className:"flex gap-1",children:[(0,b.jsxs)("button",{onClick:()=>m("terminal"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"terminal"===l?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,b.jsx)(aq.Terminal,{className:"h-3 w-3"}),h("terminal.execute")]}),(0,b.jsx)("button",{onClick:()=>m("changes"),className:`px-3 py-1 text-xs font-medium rounded-md ${"changes"===l?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:h("taskPage.changes")}),(0,b.jsxs)("button",{onClick:()=>m("notes"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"notes"===l?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,b.jsx)(Q.FileText,{className:"h-3 w-3"}),h("taskPage.notes")]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:["IN_REVIEW"===t&&(0,b.jsxs)(o.Button,{size:"sm",onClick:S,className:"bg-emerald-500/15 text-emerald-400 ring-1 ring-emerald-500/20 hover:bg-emerald-500/25",children:[(0,b.jsx)(as.CheckCircle2,{className:"h-3 w-3"}),h("taskPage.completeTask")]}),"DONE"!==t&&"CANCELLED"!==t&&(0,b.jsxs)(o.Button,{variant:"ghost",size:"sm",onClick:()=>j.push(`/workspaces/${e}/tasks/${a.id}`),className:"text-muted-foreground",children:[(0,b.jsx)(ap.ExternalLink,{className:"h-3 w-3"}),h("taskPage.viewDetails")]})]})]}),"terminal"===l?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:z?v?(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsxs)("div",{className:"shrink-0 flex items-center justify-between border-b border-neutral-800 px-3 py-2 bg-[#0f1419]",children:[(0,b.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-emerald-400",children:[(0,b.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"}),h("execution.running")]}),(0,b.jsxs)(at.Tooltip,{children:[(0,b.jsxs)(at.TooltipTrigger,{onClick:K,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,b.jsx)(ar.Square,{className:"h-3 w-3"}),h("terminal.stopExecution")]}),(0,b.jsx)(at.TooltipContent,{side:"bottom",children:h("terminal.stopHint")})]})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0",children:(0,b.jsx)(az.TerminalOutlet,{taskId:a.id,worktreePath:v,onSessionEnd:J})})]}):"DONE"===t||"CANCELLED"===t?(0,b.jsx)("div",{className:"flex h-full flex-col overflow-hidden",children:(0,b.jsx)(I.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)(aJ.ExecutionTimeline,{executions:B})})}):(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsxs)("div",{className:"shrink-0 flex items-center gap-2 border-b border-border px-4 py-3",children:[D.length>0&&(0,b.jsxs)(q.Select,{defaultValue:F??"none",onValueChange:a=>G("none"===a?null:a),children:[(0,b.jsx)(q.SelectTrigger,{size:"sm",className:"min-w-[120px]",children:(0,b.jsx)("span",{className:"text-left truncate",children:F?D.find(a=>a.id===F)?.name??h("terminal.noPrompt"):h("terminal.noPrompt")})}),(0,b.jsxs)(q.SelectContent,{className:"min-w-[200px]",children:[(0,b.jsx)(q.SelectItem,{value:"none",children:h("terminal.noPrompt")}),D.map(a=>(0,b.jsxs)(q.SelectItem,{value:a.id,children:[a.name,a.isDefault?" ★":""]},a.id))]})]},`prompt-${D.length}`),(0,b.jsxs)(o.Button,{onClick:H,disabled:x,size:"sm",className:"gap-2 px-4",children:[x?(0,b.jsx)(U.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,b.jsx)(aq.Terminal,{className:"h-3.5 w-3.5"}),x?h("terminal.executing"):h("terminal.launch")]})]}),(0,b.jsx)(I.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)(aJ.ExecutionTimeline,{executions:B,onResume:L,onContinueLatest:M})})]}):(0,b.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-[#0f1419]",children:[(0,b.jsx)(U.Loader2,{className:"size-5 animate-spin text-neutral-500"}),(0,b.jsx)("span",{className:"text-xs text-neutral-500",children:h("execution.loading")})]})}):"changes"===l?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:r?(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.loadingDiff")})}):n?.branchDeleted?(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.branchDeleted")})}):n?(0,b.jsx)(ax.TaskDiffView,{taskId:a.id,files:n.files,totalAdded:n.totalAdded,totalRemoved:n.totalRemoved,hasConflicts:n.hasConflicts,conflictFiles:n.conflictFiles,onCommit:V,hasUncommitted:n.hasUncommitted}):(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.noChanges")})})}):"notes"===l?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,b.jsx)(aT,{taskId:a.id,projectId:a.projectId})}):null,(0,b.jsx)(ay.TaskMergeConfirmDialog,{open:N,onOpenChange:O,taskId:a.id,taskTitle:a.title,baseBranch:a.baseBranch??"main",fileCount:n?.files?.length??0,commitCount:n?.commitCount??0,commitLog:P,onMergeComplete:T})]})}var aV=a.i(545734),aW=a.i(407834);let aX=(0,Y.createServerReference)("402b22af3e2e3b5fca5b9e3a0e18132fd7a121e8fd",Y.callServer,void 0,Y.findSourceMapURL,"deleteTask"),aY=(0,Y.createServerReference)("4003e378032d2935d161efd653a517e38c2f3b3433",Y.callServer,void 0,Y.findSourceMapURL,"toggleTaskPinned"),aZ=(0,Y.createServerReference)("400583fec52c3aece6270a4e38a55ff57d0844a8e1",Y.callServer,void 0,Y.findSourceMapURL,"getVersionsForPicker");var a$=a.i(912868);function a_({projects:a,activeProjectId:d,onSelect:e}){let f=(0,c.useRef)(null),[g,h]=(0,c.useState)(!1),[i,j]=(0,c.useState)(!1),k=()=>{let a=f.current;a&&(h(a.scrollLeft>0),j(a.scrollLeft<a.scrollWidth-a.clientWidth-1))};(0,c.useEffect)(()=>{k();let a=f.current;if(a){a.addEventListener("scroll",k);let b=new ResizeObserver(k);return b.observe(a),()=>{a.removeEventListener("scroll",k),b.disconnect()}}},[a]);let l=a=>{let b=f.current;b&&b.scrollBy({left:"left"===a?-150:150,behavior:"smooth"})};return(0,b.jsxs)("div",{className:"relative flex items-center",children:[g&&(0,b.jsx)("button",{onClick:()=>l("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,b.jsx)(a$.ChevronLeft,{className:"h-4 w-4"})}),(0,b.jsx)("div",{ref:f,className:"flex items-center gap-1.5 overflow-x-auto scrollbar-none px-1 py-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:a.map(a=>{let c=d===a.id;return(0,b.jsxs)("button",{onClick:()=>{c||e(a.id)},className:`shrink-0 rounded-lg border-b-2 px-4 py-2 text-sm font-medium transition-colors ${c?"border-primary bg-primary/10 text-primary ring-1 ring-primary/20 cursor-default":"border-transparent text-muted-foreground hover:bg-accent hover:text-foreground cursor-pointer"}`,children:[(0,b.jsx)("span",{children:a.name}),a.alias&&(0,b.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:a.alias})]},a.id)})}),i&&(0,b.jsx)("button",{onClick:()=>l("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,b.jsx)(O.ChevronRight,{className:"h-4 w-4"})})]})}a.s(["BoardPageClient",0,function({workspaceId:a,projectId:e,project:f,projects:g,initialTasks:h,labels:i,openTaskId:k}){let l=(0,d.useRouter)(),[,m]=(0,c.useTransition)(),[n,o]=(0,c.useState)(""),[p,q]=(0,c.useState)("all"),[s,t]=(0,c.useState)(!1),[v,w]=(0,c.useState)("TODO"),[x,y]=(0,c.useState)(k??null),[z,A]=(0,c.useState)([]),B=x?h.find(a=>a.id===x)??null:null,[C,D]=(0,c.useState)(null);(0,c.useEffect)(()=>{aZ(e).then(A).catch(()=>A([]))},[e]);let E=z.find(a=>a.isCurrent)?.id??null,F=(0,c.useCallback)(()=>{m(()=>{l.refresh()})},[l]);(0,c.useEffect)(()=>{if(s)return;let a=setInterval(()=>{m(()=>{l.refresh()})},5e3);return()=>clearInterval(a)},[l,s]);let G=(0,c.useCallback)(a=>{o(a)},[]),H=(0,c.useCallback)(async(a,b)=>{await (0,aF.updateTaskStatus)(a,b),F()},[F]),I=(0,c.useCallback)(async a=>{await (0,aV.createTask)({title:a.title,description:a.description,projectId:e,priority:a.priority,status:a.status,labelIds:a.labelIds,baseBranch:a.baseBranch,subPath:a.subPath,versionId:a.versionId??void 0}),F()},[e,F]),J=(0,c.useCallback)(async(a,b)=>{await (0,aW.updateTask)(a,{...b,labelIds:b.labelIds}),D(null),F()},[F]),K=(0,c.useCallback)(async a=>{await aX(a),x===a&&y(null),F()},[F,x]),N=(0,c.useCallback)(async a=>{await aY(a),F()},[F]),O=(0,c.useCallback)(async b=>{try{await (0,aB.startPtyExecution)(b,"")}catch(a){ad.toast.error(a instanceof Error?a.message:String(a))}l.push(`/workspaces/${a}/tasks/${b}`)},[l,a]),P=(0,c.useCallback)(async(a,b)=>{await (0,aF.updateTaskStatus)(a,b),F()},[F]),Q=(0,c.useCallback)(a=>{w(a),D(null),t(!0)},[]),R=(0,c.useCallback)(a=>{D(a),t(!0)},[]),S=h.filter(a=>!a.labels?.some(a=>a.label.name===u.TOWER_LABEL_NAME&&a.label.isBuiltin)),T=S.filter(a=>{if("backlog"===p){if(a.versionId)return!1}else if("all"!==p&&a.versionId!==p)return!1;if(n.trim()){let b=n.toLowerCase();if(!a.title.toLowerCase().includes(b)&&!a.description?.toLowerCase().includes(b))return!1}return!0});return(0,b.jsxs)("div",{className:"flex h-full",children:[(0,b.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,b.jsx)("div",{className:"px-6 pt-3 pb-1",children:(0,b.jsx)(a_,{projects:g,activeProjectId:e,onSelect:b=>l.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1})})}),(0,b.jsx)(j,{totalTasks:S.length,runningTasks:S.filter(a=>"IN_PROGRESS"===a.status).length}),(0,b.jsx)(r,{searchQuery:n,onSearchChange:G,versions:z,versionFilter:p,onVersionFilterChange:q,versionsHref:`/workspaces/${a}/projects/${e}/versions`,onCreateTask:()=>{D(null),t(!0)}}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:(0,b.jsx)(L,{initialTasks:T,onTaskMove:H,onTaskClick:a=>{y(a.id)},onEditTask:R,onAddTask:Q,onDeleteTask:K,onTogglePin:N,workspaceId:a,onContextMenuStatusChange:P,onContextMenuLaunch:O})}),(0,b.jsx)(M.CreateTaskDialog,{open:s,onOpenChange:a=>{t(a),a||D(null)},onSubmit:I,onUpdate:J,defaultStatus:v,editTask:C,editTaskLabelIds:C?.labels?C.labels.map(a=>a.labelId):[],labels:i.filter(a=>!(a.name===u.TOWER_LABEL_NAME&&a.isBuiltin)),projectType:f.type,projectLocalPath:f.localPath,versions:z,defaultVersionId:E})]}),B?(0,b.jsx)(aU,{task:B,workspaceId:a,projectLocalPath:f.localPath,onClose:()=>y(null)}):(0,b.jsx)(an,{project:f,workspaceId:a})]})}],473935)}];
2
2
 
3
3
  //# sourceMappingURL=src_app_workspaces_%5BworkspaceId%5D_board-page-client_tsx_0gips66._.js.map