tower-studio 0.2.25 → 0.2.27

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 (259) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  5. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  6. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -1
  12. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +29 -29
  13. package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
  14. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  15. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  16. package/.next/standalone/.next/server/app/api/adapters/test/route.js +1 -1
  17. package/.next/standalone/.next/server/app/api/adapters/test/route.js.nft.json +1 -1
  18. package/.next/standalone/.next/server/app/api/browse-fs/route.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/api/files/assets/[projectId]/[filename]/route.js +1 -1
  20. package/.next/standalone/.next/server/app/api/files/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/internal/assets/[projectId]/[filename]/route.js +1 -1
  23. package/.next/standalone/.next/server/app/api/internal/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/internal/assets/reveal/route.js +1 -1
  25. package/.next/standalone/.next/server/app/api/internal/assets/reveal/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/internal/assistant/attachments/route.js +1 -1
  27. package/.next/standalone/.next/server/app/api/internal/assistant/attachments/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/internal/assistant/chat/route.js +1 -1
  29. package/.next/standalone/.next/server/app/api/internal/assistant/chat/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/internal/assistant/route.js +1 -1
  31. package/.next/standalone/.next/server/app/api/internal/assistant/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/internal/backup/import/route.js +1 -1
  33. package/.next/standalone/.next/server/app/api/internal/backup/import/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/internal/cache/[...segments]/route.js +1 -1
  35. package/.next/standalone/.next/server/app/api/internal/cache/[...segments]/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/internal/hooks/session/route.js +1 -1
  37. package/.next/standalone/.next/server/app/api/internal/hooks/session/route.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/api/internal/hooks/stop/route.js +1 -1
  39. package/.next/standalone/.next/server/app/api/internal/hooks/stop/route.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/api/internal/hooks/upload/route.js +1 -1
  41. package/.next/standalone/.next/server/app/api/internal/hooks/upload/route.js.nft.json +1 -1
  42. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/start/route.js +1 -1
  43. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/start/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff/route.js +1 -1
  45. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff/route.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff-patch/route.js +1 -1
  47. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff-patch/route.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/api/tasks/[taskId]/merge/route.js +1 -1
  49. package/.next/standalone/.next/server/app/api/tasks/[taskId]/merge/route.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/missions/page/react-loadable-manifest.json +1 -1
  51. package/.next/standalone/.next/server/app/missions/page/server-reference-manifest.json +67 -67
  52. package/.next/standalone/.next/server/app/missions/page.js +1 -1
  53. package/.next/standalone/.next/server/app/missions/page.js.nft.json +1 -1
  54. package/.next/standalone/.next/server/app/missions/page_client-reference-manifest.js +1 -1
  55. package/.next/standalone/.next/server/app/onboarding/page/react-loadable-manifest.json +1 -1
  56. package/.next/standalone/.next/server/app/onboarding/page/server-reference-manifest.json +29 -29
  57. package/.next/standalone/.next/server/app/onboarding/page.js +1 -1
  58. package/.next/standalone/.next/server/app/onboarding/page.js.nft.json +1 -1
  59. package/.next/standalone/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  60. package/.next/standalone/.next/server/app/page/react-loadable-manifest.json +1 -1
  61. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +29 -29
  62. package/.next/standalone/.next/server/app/page.js +1 -1
  63. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  64. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  65. package/.next/standalone/.next/server/app/settings/page/react-loadable-manifest.json +1 -1
  66. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +47 -47
  67. package/.next/standalone/.next/server/app/settings/page.js +1 -1
  68. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  69. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  70. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +1 -1
  71. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +86 -86
  72. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page.js +1 -1
  73. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
  74. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
  75. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +1 -1
  76. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +80 -80
  77. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page.js +1 -1
  78. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
  79. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
  80. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +1 -1
  81. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +61 -61
  82. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page.js +1 -1
  83. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
  84. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
  85. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +1 -1
  86. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +63 -63
  87. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js +1 -1
  88. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
  89. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
  90. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +1 -1
  91. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +29 -29
  92. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js +1 -1
  93. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
  94. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
  95. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/react-loadable-manifest.json +1 -1
  96. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/server-reference-manifest.json +70 -70
  97. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page.js +1 -1
  98. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page.js.nft.json +1 -1
  99. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page_client-reference-manifest.js +1 -1
  100. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +2 -2
  101. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +80 -80
  102. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js +1 -1
  103. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
  104. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  105. package/.next/standalone/.next/server/app/workspaces/page/react-loadable-manifest.json +1 -1
  106. package/.next/standalone/.next/server/app/workspaces/page/server-reference-manifest.json +45 -45
  107. package/.next/standalone/.next/server/app/workspaces/page.js +1 -1
  108. package/.next/standalone/.next/server/app/workspaces/page.js.nft.json +1 -1
  109. package/.next/standalone/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
  110. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0eh8dj_.js +5 -5
  111. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0hrprmi.js +1 -1
  112. package/.next/standalone/.next/server/chunks/[root-of-the-server]__08xus7y._.js +3 -0
  113. package/.next/standalone/.next/server/chunks/[root-of-the-server]__09p152b._.js +1 -1
  114. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0j-4yc7._.js → [root-of-the-server]__09sw_a5._.js} +2 -2
  115. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_3ce_3._.js +3 -0
  116. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0b-ib~7._.js +1 -1
  117. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0dy~osn._.js +3 -0
  118. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0gmwjkc._.js +1 -1
  119. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0l1-djp._.js +3 -0
  120. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0nggjno._.js +4 -0
  121. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0oe.86i._.js +4 -0
  122. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0q8.khe._.js +3 -0
  123. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qif839._.js +4 -0
  124. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qn.178._.js +4 -0
  125. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0o3iihg._.js → [root-of-the-server]__0r17py1._.js} +2 -2
  126. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__024m_g.._.js → [root-of-the-server]__0rpck4h._.js} +2 -2
  127. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0hc9vir._.js → [root-of-the-server]__0ul.hbv._.js} +2 -2
  128. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0v5.ht~._.js +1 -1
  129. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0j8xb6s._.js → [root-of-the-server]__0~au8v.._.js} +2 -2
  130. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0r9mscb._.js → [root-of-the-server]__11c_is3._.js} +2 -2
  131. package/.next/standalone/.next/server/chunks/[root-of-the-server]__11j15wy._.js +4 -0
  132. package/.next/standalone/.next/server/chunks/[root-of-the-server]__12brxjg._.js +3 -0
  133. package/.next/standalone/.next/server/chunks/src_0bkvm8c._.js +1 -1
  134. package/.next/standalone/.next/server/chunks/src_lib_0aowbzy._.js +1 -1
  135. package/.next/standalone/.next/server/chunks/src_lib_ai_0xx6y51._.js +1 -1
  136. package/.next/standalone/.next/server/chunks/ssr/0iu._[workspaceId]_projects_[projectId]_versions_version-timeline-client_tsx_07o_kyi._.js +1 -1
  137. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02-6df-._.js +3 -3
  138. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__03e009u._.js +3 -3
  139. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e_-mj-._.js +3 -3
  140. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0fzkdjl._.js +3 -3
  141. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h-yd-.._.js +3 -0
  142. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0f~m-8x._.js → [root-of-the-server]__0ihwpkg._.js} +2 -2
  143. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__084p3.0._.js → [root-of-the-server]__0jaud.k._.js} +1 -1
  144. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0jymb~t._.js +1 -1
  145. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0pu-v0l._.js +3 -3
  146. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0ygiyqr._.js → [root-of-the-server]__0srv77j._.js} +2 -2
  147. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0qkus8m._.js → [root-of-the-server]__0uh3kpv._.js} +2 -2
  148. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0um1ugs._.js +3 -3
  149. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0z7je5_._.js +1 -1
  150. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__134_xv.._.js +1 -1
  151. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__13vgkq5._.js +3 -3
  152. package/.next/standalone/.next/server/chunks/ssr/_006o~oo._.js +3 -0
  153. package/.next/standalone/.next/server/chunks/ssr/{_11cv4uu._.js → _03f_wwv._.js} +3 -3
  154. package/.next/standalone/.next/server/chunks/ssr/_070t_mh._.js +2 -2
  155. package/.next/standalone/.next/server/chunks/ssr/_08z-g~5._.js +3 -3
  156. package/.next/standalone/.next/server/chunks/ssr/_0_vjay8._.js +3 -3
  157. package/.next/standalone/.next/server/chunks/ssr/_0adfhzf._.js +3 -0
  158. package/.next/standalone/.next/server/chunks/ssr/_0cacv5.._.js +3 -0
  159. package/.next/standalone/.next/server/chunks/ssr/_0cj9a7y._.js +1 -1
  160. package/.next/standalone/.next/server/chunks/ssr/_0eqcb.s._.js +3 -0
  161. package/.next/standalone/.next/server/chunks/ssr/_0hp.0s8._.js +3 -0
  162. package/.next/standalone/.next/server/chunks/ssr/{_0ecgaqt._.js → _0jd3nyu._.js} +3 -3
  163. package/.next/standalone/.next/server/chunks/ssr/_0jg.s-g._.js +1 -1
  164. package/.next/standalone/.next/server/chunks/ssr/_0m-e3bn._.js +3 -0
  165. package/.next/standalone/.next/server/chunks/ssr/{_0kynu6x._.js → _0o.uf_.._.js} +3 -3
  166. package/.next/standalone/.next/server/chunks/ssr/{_0r1pb6u._.js → _0px5iue._.js} +2 -2
  167. package/.next/standalone/.next/server/chunks/ssr/{_03osyxp._.js → _0qdu.-q._.js} +2 -2
  168. package/.next/standalone/.next/server/chunks/ssr/{_0vx81le._.js → _0r48bby._.js} +2 -2
  169. package/.next/standalone/.next/server/chunks/ssr/_0r6gweb._.js +3 -3
  170. package/.next/standalone/.next/server/chunks/ssr/_0rdyrfd._.js +1 -1
  171. package/.next/standalone/.next/server/chunks/ssr/_0rt8jf_._.js +3 -3
  172. package/.next/standalone/.next/server/chunks/ssr/_0uuzh5m._.js +3 -3
  173. package/.next/standalone/.next/server/chunks/ssr/_0yb~7-n._.js +4 -0
  174. package/.next/standalone/.next/server/chunks/ssr/_0~aon4t._.js +3 -3
  175. package/.next/standalone/.next/server/chunks/ssr/_11df4xf._.js +3 -0
  176. package/.next/standalone/.next/server/chunks/ssr/src_075s.rk._.js +1 -1
  177. package/.next/standalone/.next/server/chunks/ssr/src_0djxlqx._.js +1 -1
  178. package/.next/standalone/.next/server/chunks/ssr/src_0eufeyj._.js +1 -1
  179. package/.next/standalone/.next/server/chunks/ssr/src_actions_agent-actions_ts_0~wc.sy._.js +1 -1
  180. package/.next/standalone/.next/server/chunks/ssr/src_actions_file-actions_ts_0gcvqwm._.js +1 -1
  181. package/.next/standalone/.next/server/chunks/ssr/src_app_missions_missions-client_tsx_11429lj._.js +1 -1
  182. package/.next/standalone/.next/server/chunks/ssr/src_app_onboarding_page_tsx_0xf7hpz._.js +1 -1
  183. package/.next/standalone/.next/server/chunks/ssr/src_app_settings_page_tsx_0h9v7dr._.js +1 -1
  184. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0wyzpam._.js +1 -1
  185. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_board-page-client_tsx_0gips66._.js +1 -1
  186. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_02t7blt._.js +1 -1
  187. package/.next/standalone/.next/server/chunks/ssr/src_components_ui_popover_tsx_0a78wqo._.js +3 -0
  188. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  189. package/.next/standalone/.next/server/pages/500.html +1 -1
  190. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  191. package/.next/standalone/.next/server/server-reference-manifest.json +279 -279
  192. package/.next/standalone/.next/static/chunks/0-f79~906wz5j.js +1 -0
  193. package/.next/standalone/.next/static/chunks/{0mi29_2~1sr...js → 0149fv_0zggn8.js} +1 -1
  194. package/.next/standalone/.next/static/chunks/02gl~iszfc1yd.js +1 -0
  195. package/.next/standalone/.next/static/chunks/{0jmk1_g~_yd7-.js → 039a4i2lrpg48.js} +1 -1
  196. package/.next/standalone/.next/static/chunks/04iae2dax3a4_.css +1 -0
  197. package/.next/standalone/.next/static/chunks/04l_v10h82d9x.js +1 -0
  198. package/.next/standalone/.next/static/chunks/{0izvibcnunqx4.js → 05aw58w9v12_k.js} +1 -1
  199. package/.next/standalone/.next/static/chunks/05ro4v-~1rzzu.js +1 -0
  200. package/.next/standalone/.next/static/chunks/06pml6cu861_z.js +1 -0
  201. package/.next/standalone/.next/static/chunks/{0oopksfzoc0_k.js → 07-hrgrojd47k.js} +1 -1
  202. package/.next/standalone/.next/static/chunks/082l64h0~egwa.js +1 -0
  203. package/.next/standalone/.next/static/chunks/08stlcmc.w7i-.js +1 -0
  204. package/.next/standalone/.next/static/chunks/{08ln6v6_fd4nf.js → 0_0at2~~4zjdh.js} +1 -1
  205. package/.next/standalone/.next/static/chunks/0_1uz793pu.9y.js +1 -0
  206. package/.next/standalone/.next/static/chunks/{131msw-pgcsxt.js → 0aml6gixhw._8.js} +2 -2
  207. package/.next/standalone/.next/static/chunks/{0s2umk4hfyhqa.js → 0chv87z6o3n63.js} +1 -1
  208. package/.next/standalone/.next/static/chunks/0d-53ws8ezr.b.js +1 -0
  209. package/.next/standalone/.next/static/chunks/{157pgx~-2_qo5.js → 0fvf0wt_q0_zq.js} +2 -2
  210. package/.next/standalone/.next/static/chunks/0gd1q9f89qnfj.js +1 -0
  211. package/.next/standalone/.next/static/chunks/{0pov66bj_qi58.js → 0gn8igf9i2j_9.js} +1 -1
  212. package/.next/standalone/.next/static/chunks/0g~pi-_mk2cd8.js +1 -0
  213. package/.next/standalone/.next/static/chunks/0osd9c3nf.67-.js +1 -0
  214. package/.next/standalone/.next/static/chunks/{13upq83z~yuys.js → 0tmwe-h4iyyf~.js} +1 -1
  215. package/.next/standalone/.next/static/chunks/{0w7cz_z6p3-p_.js → 0vsivergi0gca.js} +1 -1
  216. package/.next/standalone/.next/static/chunks/{141wmbqfx~lo8.js → 14~xgkw1qggbk.js} +2 -2
  217. package/.next/standalone/.next/static/chunks/16-54g5tfsd82.js +5 -0
  218. package/.next/standalone/.next/static/chunks/16szb7161dy4k.js +1 -0
  219. package/.next/standalone/.next/static/chunks/17z3hzpf34o4a.js +2 -0
  220. package/.next/standalone/package.json +1 -1
  221. package/dist/mcp-server.cjs +16 -7
  222. package/package.json +1 -1
  223. package/.next/standalone/.next/server/chunks/[root-of-the-server]__03j20vp._.js +0 -4
  224. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05se6yk._.js +0 -4
  225. package/.next/standalone/.next/server/chunks/[root-of-the-server]__06m1r8x._.js +0 -4
  226. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g788b3._.js +0 -4
  227. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qdvear._.js +0 -3
  228. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0umocfj._.js +0 -3
  229. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0wuzc5o._.js +0 -4
  230. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0z-k6vg._.js +0 -3
  231. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~rm9q.._.js +0 -3
  232. package/.next/standalone/.next/server/chunks/[root-of-the-server]__12c9noi._.js +0 -3
  233. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0i7es1w._.js +0 -3
  234. package/.next/standalone/.next/server/chunks/ssr/_02acmsq._.js +0 -3
  235. package/.next/standalone/.next/server/chunks/ssr/_06-jig2._.js +0 -3
  236. package/.next/standalone/.next/server/chunks/ssr/_0eete9d._.js +0 -3
  237. package/.next/standalone/.next/server/chunks/ssr/_0gk20rx._.js +0 -3
  238. package/.next/standalone/.next/server/chunks/ssr/_0jeo~zr._.js +0 -4
  239. package/.next/standalone/.next/server/chunks/ssr/_0rny90z._.js +0 -3
  240. package/.next/standalone/.next/server/chunks/ssr/_0rr~oe~._.js +0 -3
  241. package/.next/standalone/.next/server/chunks/ssr/_0yvg9ie._.js +0 -3
  242. package/.next/standalone/.next/server/chunks/ssr/_13esy08._.js +0 -3
  243. package/.next/standalone/.next/static/chunks/00fcxpwt-xz7b.js +0 -1
  244. package/.next/standalone/.next/static/chunks/02.0.zsh_o-10.js +0 -1
  245. package/.next/standalone/.next/static/chunks/05dryiv53wj6h.js +0 -5
  246. package/.next/standalone/.next/static/chunks/099fxtzvpw3be.js +0 -1
  247. package/.next/standalone/.next/static/chunks/0ce8gr~q3rs9k.js +0 -1
  248. package/.next/standalone/.next/static/chunks/0iyxegei1fjbp.js +0 -1
  249. package/.next/standalone/.next/static/chunks/0n.isvqurxe72.js +0 -1
  250. package/.next/standalone/.next/static/chunks/0nl7~2pju.abl.js +0 -1
  251. package/.next/standalone/.next/static/chunks/0okjtk-a.5lz0.css +0 -1
  252. package/.next/standalone/.next/static/chunks/0p5wczoq4gvin.js +0 -1
  253. package/.next/standalone/.next/static/chunks/0ur66aluu.t0b.js +0 -1
  254. package/.next/standalone/.next/static/chunks/0wa8r89hd0y0b.js +0 -1
  255. package/.next/standalone/.next/static/chunks/0yjkfr0qay7z6.js +0 -1
  256. package/.next/standalone/.next/static/chunks/16ndme6.~2w1x.js +0 -2
  257. /package/.next/standalone/.next/static/{biyHBSA-7nbhZk25VrdWY → oV8mD-RwRHyXZf4Iv1-cU}/_buildManifest.js +0 -0
  258. /package/.next/standalone/.next/static/{biyHBSA-7nbhZk25VrdWY → oV8mD-RwRHyXZf4Iv1-cU}/_clientMiddlewareManifest.js +0 -0
  259. /package/.next/standalone/.next/static/{biyHBSA-7nbhZk25VrdWY → oV8mD-RwRHyXZf4Iv1-cU}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- module.exports=[976268,a=>{"use strict";let b=(0,a.i(711796).default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);a.s(["default",0,b])},607884,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(553798),e=a.i(634910),f=a.i(607219),g=a.i(774881),h=a.i(690251),i=a.i(975231),j=a.i(336771),k=a.i(91756),l=a.i(881107),m=a.i(350739),n=a.i(347165),o=a.i(711796);let p=(0,o.default)("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);var q=a.i(335732),r=a.i(269876),s=a.i(814574),t=a.i(785259),u=a.i(699570),v=a.i(866718),w=a.i(780410);let x=(0,w.createServerReference)("405034ec856e7ada8e4aaca22cb95ce5f7a62d4250",w.callServer,void 0,w.findSourceMapURL,"createWorkspace"),y=(0,w.createServerReference)("60386b08cc497fab02579444f114bdde29daddbb57",w.callServer,void 0,w.findSourceMapURL,"updateWorkspace"),z=(0,w.createServerReference)("40c84ff01dd528e1e7c26b38249183e6e0456f2ba8",w.callServer,void 0,w.findSourceMapURL,"deleteWorkspace"),A=(0,w.createServerReference)("40efe84137024cf9e73bab5a49211774817facb903",w.callServer,void 0,w.findSourceMapURL,"reorderWorkspaces");var B=a.i(890649);let C=(0,w.createServerReference)("405a870c63934bf127b570c94b653f1c5d13d7e638",w.callServer,void 0,w.findSourceMapURL,"createLabel"),D=(0,w.createServerReference)("40581325722ffd1c588020a3d2610615550e6ef286",w.callServer,void 0,w.findSourceMapURL,"deleteLabel");var E=a.i(951192),F=a.i(952313),G=a.i(643228),H=a.i(859103),I=a.i(514126);let J=["📋","🚀","🎯","💡","🔧","📦","🎨","📊","🔬","🌟","📝","🏗️"];function K({workspaces:a}){let h,i=(0,d.useRouter)(),j=(0,d.usePathname)(),{t:l}=(0,E.useI18n)(),[o,q]=(0,c.useState)(!1);(0,c.useEffect)(()=>{"true"===localStorage.getItem("sidebar-collapsed")&&q(!0)},[]);let[s,v]=(0,c.useState)(!1),[w,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(!1),[I,N]=(0,c.useState)(null),[P,Q]=(0,c.useState)(""),[R,S]=(0,c.useState)(J[0]),[T,U]=(0,c.useState)(null),[V,W]=(0,c.useState)(a);(0,c.useEffect)(()=>{W(a)},[a]);let X=(0,G.useSensors)((0,G.useSensor)(G.PointerSensor,{activationConstraint:{distance:8}})),Y=(0,c.useCallback)(b=>{let{active:c,over:d}=b;if(!d||c.id===d.id)return;let e=V.findIndex(a=>a.id===c.id),f=V.findIndex(a=>a.id===d.id);if(-1===e||-1===f)return;let g=(0,H.arrayMove)(V,e,f);W(g),A(g.map(a=>a.id)).then(()=>i.refresh()).catch(()=>{W(a),F.toast.error(l("sidebar.reorderError"))})},[V,a,i,l]),Z=j.split("/workspaces/")[1]?.split("/")[0],$=(0,c.useCallback)(()=>{q(a=>{let b=!a;return localStorage.setItem("sidebar-collapsed",String(b)),b})},[]),_=(0,c.useCallback)(async()=>{if(!P.trim())return;let a=await x({name:P.trim(),description:R});Q(""),S(J[0]),v(!1),i.refresh(),i.push(`/workspaces/${a.id}`)},[P,R,i]),aa=(0,c.useCallback)(async()=>{P.trim()&&T&&(await y(T,{name:P.trim(),description:R}),Q(""),B(!1),U(null),i.refresh())},[P,R,T,i]),ab=(0,c.useCallback)(a=>{U(a.id),Q(a.name),S(a.description&&J.includes(a.description)?a.description:J[0]),B(!0)},[]),ac=(0,c.useCallback)(async(b,c)=>{if(a.length<=1)return void F.toast.error(l("sidebar.lastWorkspaceError"));if(confirm(l("sidebar.deleteConfirm",{name:c})))try{await z(b),i.refresh(),Z===b&&i.push("/workspaces")}catch{F.toast.error(l("sidebar.lastWorkspaceError"))}},[Z,i,l,a.length]),ad=(0,c.useCallback)(a=>{N(a),D(!0)},[]),ae=a=>a.description&&J.includes(a.description)?a.description:a.name.charAt(0).toUpperCase();if(o){let c;return(0,b.jsxs)("aside",{className:"flex h-screen w-14 flex-col items-center border-r border-border bg-sidebar py-3",children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:$,className:"mb-4 flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10 ring-1 ring-primary/20 transition-transform hover:scale-105"}),children:(0,b.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-6 w-6 rounded"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.expand")})]}),(0,b.jsx)(r.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsxs)("div",{className:"flex flex-col items-center gap-1 px-0.5 pt-1",children:[a.map(a=>{let c=Z===a.id,d=ae(a);return(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>{c||i.push(`/workspaces/${a.id}`)},className:`flex h-9 w-9 items-center justify-center rounded-lg transition-all ${c?"ring-1 ring-primary/20 text-foreground cursor-default":"text-muted-foreground hover:text-foreground cursor-pointer"}`}),children:(0,b.jsx)("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-muted text-sm",children:J.includes(d)?d:(0,b.jsx)("span",{className:"text-xs font-semibold",children:d})})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:a.name})]},a.id)}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{"data-tour":"create-workspace",onClick:()=>v(!0),className:"flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"}),children:(0,b.jsx)(g.Plus,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.newWorkspace")})]})]})}),(0,b.jsxs)("div",{className:"mt-2 flex flex-col items-center gap-1",children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>i.push("/missions"),className:`rounded-lg p-2 transition-colors ${"/missions"===j?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(p,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("missions.navLabel")})]}),(c=Z||a[0]?.id)?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>i.push(`/workspaces/${c}/notes`),className:`rounded-lg p-2 transition-colors ${j.includes("/notes")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(m.FileText,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.notes")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>i.push(`/workspaces/${c}/assets`),className:`rounded-lg p-2 transition-colors ${j.includes("/assets")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(n.FolderOpen,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.assets")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>i.push(`/workspaces/${c}/archive`),className:`rounded-lg p-2 transition-colors ${j.includes("/archive")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(f.Archive,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.archive")})]})]}):null]}),(0,b.jsx)(M,{open:s,onOpenChange:v,title:l("workspace.create"),name:P,onNameChange:Q,icon:R,onIconChange:S,onSubmit:_,submitLabel:l("common.create"),nameLabel:l("workspace.name"),iconLabel:l("workspace.icon"),namePlaceholder:l("workspace.namePlaceholder"),cancelLabel:l("common.cancel")})]})}return(0,b.jsxs)("aside",{className:"noise relative flex h-screen w-56 flex-col border-r border-border bg-sidebar",children:[(0,b.jsxs)("div",{className:"relative z-10 flex items-center gap-3 px-4 py-4",children:[(0,b.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-9 w-9 rounded-lg"}),(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("div",{className:"text-sm font-semibold tracking-tight text-foreground",children:"Tower"}),(0,b.jsx)("div",{className:"text-[10px] font-medium uppercase tracking-widest text-muted-foreground",children:"Studio"})]}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon-xs",onClick:$,className:"text-muted-foreground",title:l("sidebar.collapse"),children:(0,b.jsx)(k.ChevronsLeft,{className:"h-4 w-4"})})]}),(0,b.jsxs)("div",{className:"relative z-10 flex items-center justify-between px-4 py-2",children:[(0,b.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:l("sidebar.workspace")}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground","data-tour":"create-workspace",onClick:()=>{Q(""),S(J[0]),v(!0)},title:l("sidebar.newWorkspace"),children:(0,b.jsx)(g.Plus,{className:"h-3.5 w-3.5"})})]}),(0,b.jsx)(r.ScrollArea,{className:"relative z-10 mt-2 flex-1 min-h-0",children:(0,b.jsx)("div",{className:"px-2 py-1",children:(0,b.jsx)(G.DndContext,{id:"workspace-sidebar",sensors:X,collisionDetection:G.closestCenter,onDragEnd:Y,children:(0,b.jsx)(H.SortableContext,{items:V.map(a=>a.id),strategy:H.verticalListSortingStrategy,children:V.map(a=>(0,b.jsx)(L,{ws:a,isActive:Z===a.id,icon:ae(a),disableDelete:V.length<=1,t:l,onSelect:()=>{Z!==a.id&&i.push(`/workspaces/${a.id}`)},onEdit:()=>ab(a),onManageLabels:()=>ad(a.id),onDelete:()=>ac(a.id,a.name)},a.id))})})})}),(0,b.jsxs)(e.default,{href:"/missions",className:`relative z-10 flex items-center gap-2 border-t border-border px-4 py-3 text-[11px] cursor-pointer transition-colors ${"/missions"===j?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,b.jsx)(p,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:l("missions.navLabel")})]}),(h=Z||a[0]?.id)?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(e.default,{href:`/workspaces/${h}/notes`,className:"relative z-10 flex items-center gap-2 border-t border-border px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,b.jsx)(m.FileText,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:l("sidebar.notes")})]}),(0,b.jsxs)(e.default,{href:`/workspaces/${h}/assets`,className:"relative z-10 flex items-center gap-2 px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,b.jsx)(n.FolderOpen,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:l("sidebar.assets")})]}),(0,b.jsxs)(e.default,{href:`/workspaces/${h}/archive`,className:"relative z-10 flex items-center gap-2 px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,b.jsx)(f.Archive,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:l("sidebar.archive")})]})]}):null,(0,b.jsx)(M,{open:s,onOpenChange:v,title:l("workspace.create"),name:P,onNameChange:Q,icon:R,onIconChange:S,onSubmit:_,submitLabel:l("common.create"),nameLabel:l("workspace.name"),iconLabel:l("workspace.icon"),namePlaceholder:l("workspace.namePlaceholder"),cancelLabel:l("common.cancel")}),(0,b.jsx)(M,{open:w,onOpenChange:a=>{B(a),a||U(null)},title:l("workspace.edit"),name:P,onNameChange:Q,icon:R,onIconChange:S,onSubmit:aa,submitLabel:l("common.save"),nameLabel:l("workspace.name"),iconLabel:l("workspace.icon"),namePlaceholder:l("workspace.namePlaceholder"),cancelLabel:l("common.cancel")}),I&&(0,b.jsx)(O,{open:C,onOpenChange:a=>{D(a),a||N(null)},workspaceId:I})]})}function L({ws:a,isActive:c,icon:d,disableDelete:e,t:f,onSelect:g,onEdit:k,onManageLabels:m,onDelete:n}){var o;let p,r,s,{attributes:t,listeners:u,setNodeRef:v,transform:w,transition:x,isDragging:y}=(0,H.useSortable)({id:a.id}),z={transform:I.CSS.Transform.toString(w),transition:x,opacity:y?.4:1};return(0,b.jsxs)("div",{ref:v,style:z,...t,...u,className:`group relative flex touch-none items-center rounded-lg transition-all ${c?"bg-accent ring-1 ring-primary/15":"hover:bg-accent/60"}`,children:[(0,b.jsxs)("button",{onClick:g,className:`flex flex-1 items-center gap-2.5 px-3 py-2.5 text-left ${c?"cursor-default":"cursor-pointer"}`,children:[(0,b.jsx)("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-muted text-sm",children:J.includes(d)?d:(0,b.jsx)("span",{className:"text-xs font-semibold text-muted-foreground",children:d})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("div",{className:`truncate text-sm font-medium ${c?"text-foreground":"text-secondary-foreground"}`,children:a.name}),(0,b.jsx)("div",{className:"text-[11px] text-muted-foreground",children:(o=a.updatedAt,r=Math.floor((p=Date.now()-new Date(o).getTime())/6e4),s=Math.floor(p/36e5),r<60?`${r}m ago`:s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`)})]})]}),(0,b.jsxs)(q.DropdownMenu,{children:[(0,b.jsx)(q.DropdownMenuTrigger,{render:(0,b.jsx)("button",{className:"mr-2 rounded-md p-1 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)(j.MoreHorizontal,{className:"h-3.5 w-3.5"})}),(0,b.jsxs)(q.DropdownMenuContent,{align:"start",side:"right",children:[(0,b.jsxs)(q.DropdownMenuItem,{onClick:k,children:[(0,b.jsx)(h.Pencil,{className:"mr-2 h-3.5 w-3.5"}),f("sidebar.rename")]}),(0,b.jsxs)(q.DropdownMenuItem,{onClick:m,children:[(0,b.jsx)(l.Tag,{className:"mr-2 h-3.5 w-3.5"}),f("sidebar.manageLabels")]}),(0,b.jsxs)(q.DropdownMenuItem,{className:e?"text-muted-foreground opacity-50":"text-rose-400",disabled:e,onClick:n,children:[(0,b.jsx)(i.Trash2,{className:"mr-2 h-3.5 w-3.5"}),f("sidebar.delete")]})]})]})]})}function M({open:a,onOpenChange:c,title:d,name:e,onNameChange:f,icon:g,onIconChange:h,onSubmit:i,submitLabel:j,nameLabel:k,iconLabel:l,namePlaceholder:m,cancelLabel:n}){return(0,b.jsx)(s.Dialog,{open:a,onOpenChange:c,disablePointerDismissal:!0,children:(0,b.jsxs)(s.DialogContent,{className:"sm:max-w-sm",children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:d})}),(0,b.jsxs)("div",{className:"space-y-4 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:k}),(0,b.jsx)(v.Input,{placeholder:m,value:e,onChange:a=>f(a.target.value),onKeyDown:a=>"Enter"===a.key&&a.preventDefault(),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:l}),(0,b.jsx)("div",{className:"mt-1.5 grid grid-cols-6 gap-1.5",children:J.map(a=>(0,b.jsx)("button",{onClick:()=>h(a),className:`flex h-10 w-10 items-center justify-center rounded-lg text-lg transition-all ${g===a?"bg-primary/15 ring-2 ring-primary/30 scale-110":"bg-muted hover:bg-accent"}`,children:a},a))})]})]}),(0,b.jsxs)(s.DialogFooter,{children:[(0,b.jsx)(u.Button,{variant:"outline",onClick:()=>c(!1),children:n}),(0,b.jsx)(u.Button,{onClick:i,disabled:!e.trim(),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:j})]})]})})}let N=["#3b82f6","#ef4444","#f59e0b","#10b981","#8b5cf6","#ec4899","#06b6d4","#f97316"];function O({open:a,onOpenChange:d,workspaceId:e}){let{t:f}=(0,E.useI18n)(),[g,h]=(0,c.useState)([]),[i,j]=(0,c.useState)(""),[k,l]=(0,c.useState)(N[0]);(0,c.useEffect)(()=>{a&&(0,B.getLabelsForWorkspace)(e).then(h)},[a,e]);let m=async()=>{i.trim()&&(await C({name:i.trim(),color:k,workspaceId:e}),h(await (0,B.getLabelsForWorkspace)(e)),j(""))},n=async a=>{await D(a),h(b=>b.filter(b=>b.id!==a))};return(0,b.jsx)(s.Dialog,{open:a,onOpenChange:d,disablePointerDismissal:!0,children:(0,b.jsxs)(s.DialogContent,{className:"sm:max-w-sm",children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:f("label.manage")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[g.map(a=>(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"h-3 w-3 rounded-full",style:{backgroundColor:a.color}}),(0,b.jsx)("span",{className:"flex-1 text-sm text-foreground",children:a.name}),a.isBuiltin?(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:f("label.builtin")}):(0,b.jsx)("button",{onClick:()=>n(a.id),className:"text-xs text-rose-400 hover:text-rose-300",children:f("common.delete")})]},a.id)),(0,b.jsxs)("div",{className:"border-t border-border pt-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(v.Input,{placeholder:f("label.name"),value:i,onChange:a=>j(a.target.value),onKeyDown:a=>"Enter"===a.key&&a.preventDefault(),className:"flex-1 h-8"}),(0,b.jsx)(u.Button,{size:"sm",onClick:m,disabled:!i.trim(),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:f("label.add")})]}),(0,b.jsx)("div",{className:"mt-2 flex gap-1.5",children:N.map(a=>(0,b.jsx)("button",{onClick:()=>l(a),className:`h-5 w-5 rounded-full transition-all ${k===a?"ring-2 ring-offset-2 ring-offset-background ring-foreground/30 scale-110":""}`,style:{backgroundColor:a}},a))})]})]})]})})}var P=a.i(940271),Q=a.i(573242),R=a.i(369289);let S=(0,o.default)("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);var T=a.i(851378);let U=(0,o.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);var V=a.i(761052),W=a.i(86354);a.s([],516474),a.i(516474);var X=a.i(213200),Y=a.i(862306);let Z=c.createContext(void 0);function $(){let a=c.useContext(Z);if(void 0===a)throw Error((0,Y.default)(13));return a}let _={imageLoadingStatus:()=>null},aa=c.forwardRef(function(a,d){let{className:e,render:f,...g}=a,[h,i]=c.useState("idle"),j=c.useMemo(()=>({imageLoadingStatus:h,setImageLoadingStatus:i}),[h,i]),k=(0,X.useRenderElement)("span",a,{state:{imageLoadingStatus:h},ref:d,props:g,stateAttributesMapping:_});return(0,b.jsx)(Z.Provider,{value:j,children:k})});var ab=a.i(74686),ac=a.i(830067),ad=a.i(398312),ae=a.i(380562),af=a.i(904531),ag=a.i(535011);let ah={..._,...ae.transitionStatusMapping},ai=c.forwardRef(function(a,b){let{className:d,render:e,onLoadingStatusChange:f,referrerPolicy:g,crossOrigin:h,...i}=a,j=$(),k=function(a,{referrerPolicy:b,crossOrigin:d}){let[e,f]=c.useState("idle");return(0,ac.useIsoLayoutEffect)(()=>{if(!a)return f("error"),ag.NOOP;let c=!0,e=new window.Image,g=a=>()=>{c&&f(a)};return f("loading"),e.onload=g("loaded"),e.onerror=g("error"),b&&(e.referrerPolicy=b),e.crossOrigin=d??null,e.src=a,()=>{c=!1}},[a,d,b]),e}(a.src,{referrerPolicy:g,crossOrigin:h}),l="loaded"===k,{mounted:m,transitionStatus:n,setMounted:o}=(0,af.useTransitionStatus)(l),p=c.useRef(null),q=(0,ab.useStableCallback)(a=>{f?.(a),j.setImageLoadingStatus(a)});(0,ac.useIsoLayoutEffect)(()=>{"idle"!==k&&q(k)},[k,q]),(0,ad.useOpenChangeComplete)({open:l,ref:p,onComplete(){l||o(!1)}});let r=(0,X.useRenderElement)("img",a,{state:{imageLoadingStatus:k,transitionStatus:n},ref:[b,p],props:i,stateAttributesMapping:ah,enabled:m});return m?r:null});var aj=a.i(102934);let ak=c.forwardRef(function(a,b){let{className:d,render:e,delay:f,...g}=a,{imageLoadingStatus:h}=$(),[i,j]=c.useState(void 0===f),k=(0,aj.useTimeout)();return c.useEffect(()=>(void 0!==f&&k.start(f,()=>j(!0)),k.clear),[k,f]),(0,X.useRenderElement)("span",a,{state:{imageLoadingStatus:h},ref:b,props:g,stateAttributesMapping:_,enabled:"loaded"!==h&&i})});a.s(["Fallback",0,ak,"Image",0,ai,"Root",0,aa],991134);var al=a.i(991134),al=al,am=a.i(368114);function an({className:a,size:c="default",...d}){return(0,b.jsx)(al.Root,{"data-slot":"avatar","data-size":c,className:(0,am.cn)("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",a),...d})}function ao({className:a,...c}){return(0,b.jsx)(al.Fallback,{"data-slot":"avatar-fallback",className:(0,am.cn)("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",a),...c})}let ap=(0,o.default)("folder-kanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);var aq=a.i(577565);let ar=(0,o.default)("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]]),as=(0,o.default)("package-2",[["path",{d:"M12 3v6",key:"1holv5"}],["path",{d:"M16.76 3a2 2 0 0 1 1.8 1.1l2.23 4.479a2 2 0 0 1 .21.891V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9.472a2 2 0 0 1 .211-.894L5.45 4.1A2 2 0 0 1 7.24 3z",key:"187q7i"}],["path",{d:"M3.054 9.013h17.893",key:"grwhos"}]]);var at=a.i(54384);let au=(0,w.createServerReference)("60578a5373ee9eacae399ca2b7dfa2be2f0f34ed63",w.callServer,void 0,w.findSourceMapURL,"globalSearch");var av=a.i(723876);let aw=[{id:"all",key:"search.all",icon:Q.Search},{id:"task",key:"search.task",icon:m.FileText},{id:"project",key:"search.project",icon:ap},{id:"repository",key:"search.repository",icon:aq.GitBranch},{id:"note",key:"search.note",icon:ar},{id:"asset",key:"search.asset",icon:as}],ax=["task","project","repository","note","asset"],ay={task:"search.task",project:"search.project",repository:"search.repository",note:"search.note",asset:"search.asset"};function az({result:a,onSelect:c}){let d=aw.find(b=>b.id===a.type)?.icon??m.FileText;return(0,b.jsxs)("button",{onClick:()=>c(a),className:"flex w-full items-center gap-3 border-b border-border/30 px-4 py-3 text-left transition-colors hover:bg-accent last:border-b-0",children:[(0,b.jsx)("div",{className:"rounded-md bg-muted p-1.5",children:(0,b.jsx)(d,{className:"h-3.5 w-3.5 text-muted-foreground"})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("div",{className:"text-sm font-medium text-foreground truncate",children:a.title}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:a.subtitle}),a.snippet&&(0,b.jsx)("div",{className:"text-xs text-muted-foreground/70 truncate mt-0.5",children:a.snippet})]})]})}function aA({open:a,onOpenChange:e}){let f,{t:g}=(0,E.useI18n)(),h=(0,d.useRouter)(),[i,j]=(0,c.useState)(""),[k,l]=(0,c.useState)("all"),[m,n]=(0,c.useState)([]),[o,p]=(0,c.useState)(!1),[q,t]=(0,c.useState)(250),v=(0,c.useRef)(null),w=(0,c.useRef)(null);(0,c.useEffect)(()=>{a&&((0,av.getConfigValue)("search.debounceMs",250).then(t),setTimeout(()=>v.current?.focus(),100),j(""),n([]))},[a]),(0,c.useEffect)(()=>{if(w.current&&clearTimeout(w.current),!i.trim()){n([]),p(!1);return}p(!0);let a=!1;return w.current=setTimeout(async()=>{let b=await au(i,k);a||(n(b),p(!1))},q),()=>{w.current&&clearTimeout(w.current),a=!0}},[i,k,q]);let x=(0,c.useCallback)(a=>{h.push(a.navigateTo),e(!1)},[h,e]);return(0,b.jsx)(s.Dialog,{open:a,onOpenChange:e,children:(0,b.jsxs)(s.DialogContent,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden !top-[10vh] !-translate-y-0",showCloseButton:!1,children:[(0,b.jsxs)("div",{className:"flex items-center border-b border-border px-4",children:[(0,b.jsx)(Q.Search,{className:"h-4 w-4 text-muted-foreground"}),(0,b.jsx)("input",{ref:v,value:i,onChange:a=>j(a.target.value),placeholder:g("search.placeholder"),className:"flex-1 bg-transparent px-3 py-3.5 text-sm text-foreground placeholder-muted-foreground outline-none"}),i&&(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",onClick:()=>{j(""),n([])},className:"text-muted-foreground",children:(0,b.jsx)(at.X,{className:"h-3.5 w-3.5"})})]}),(0,b.jsx)("div",{className:"flex items-center gap-1 border-b border-border px-4 py-2",children:aw.map(a=>{let c=a.icon;return(0,b.jsxs)("button",{onClick:()=>l(a.id),className:`flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-all ${k===a.id?"bg-primary/10 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent hover:text-foreground"}`,children:[(0,b.jsx)(c,{className:"h-3 w-3"}),g(a.key)]},a.id)})}),(0,b.jsxs)(r.ScrollArea,{className:"max-h-80",children:[!i.trim()&&(0,b.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:g("search.typeToSearch")}),i.trim()&&0===m.length&&!o&&(0,b.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:g("search.noResults")}),"all"===k&&m.length>0&&(f=m.reduce((a,b)=>((a[b.type]??=[]).push(b),a),{}),ax.filter(a=>f[a]?.length).map(a=>(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"px-4 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50",children:g(ay[a])}),f[a].map(a=>(0,b.jsx)(az,{result:a,onSelect:x},`${a.type}-${a.id}`))]},a))),"all"!==k&&m.map(a=>(0,b.jsx)(az,{result:a,onSelect:x},`${a.type}-${a.id}`))]})]})})}function aB(a){}let aC=(0,c.createContext)(null);function aD(){return"u">typeof crypto&&crypto.randomUUID?crypto.randomUUID():`msg-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}let aE="assistant-attachment-cache";function aF(a,b,c){try{let d=sessionStorage.getItem(aE),e=d?JSON.parse(d):{};e[a]||(e[a]={}),e[a][b]=c,sessionStorage.setItem(aE,JSON.stringify(e))}catch{}}function aG({children:a}){let[d,e]=(0,c.useState)(!1),[f,g]=(0,c.useState)(!1),[h,i]=(0,c.useState)("sidebar"),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)([]),[n,o]=(0,c.useState)("idle"),[p,q]=(0,c.useState)(!1),r=(0,c.useRef)([]),s=(0,c.useRef)(null),t=(0,c.useRef)(null),[u,v]=(0,c.useState)([]),[w,x]=(0,c.useState)(null),y=(0,c.useRef)(!1),z=(0,c.useCallback)(()=>{m([...r.current])},[]),A=(0,c.useCallback)(async()=>{i("dialog"===await (0,av.getConfigValue)("assistant.displayMode","sidebar")?"dialog":"sidebar")},[]);(0,c.useEffect)(()=>{A()},[A]);let B=(0,c.useCallback)(async()=>{v([])},[]),C=(0,c.useCallback)(async a=>{q(!0);try{let b=await fetch(`/api/internal/assistant/sessions?sessionId=${encodeURIComponent(a)}`);if(!b.ok)return;let c=await b.json();if(Array.isArray(c.messages)){r.current=c.messages;let b=function(a){try{let b=sessionStorage.getItem(aE);if(!b)return{};return JSON.parse(b)[a]??{}}catch{return{}}}(a);if(Object.keys(b).length>0){let a=0;r.current=r.current.map(c=>{if("user"===c.role){let d=b[a];if(a++,d?.length)return{...c,attachmentFilenames:d}}return c})}m([...r.current])}}catch{}finally{q(!1)}},[]);(0,c.useEffect)(()=>{B()},[B,C]);let D=(0,c.useCallback)(()=>{t.current?.abort(),s.current=null,y.current=!1,x(null),aB(null),r.current=[],m([]),o("idle")},[]),E=(0,c.useCallback)(a=>{t.current?.abort(),s.current=a,y.current=!0,x(a),aB(a),r.current=[],m([]),o("idle"),C(a)},[C]),F=(0,c.useCallback)(a=>{v([]),w===a&&D()},[w,D]),G=(0,c.useCallback)(async()=>{g(!0);try{await A(),e(!0)}finally{g(!1)}},[A]),H=(0,c.useCallback)(()=>{e(!1),t.current?.abort()},[]),I=(0,c.useCallback)(()=>{d||f?H():G()},[d,f,H,G]);(0,c.useEffect)(()=>{let a=a=>{(a.metaKey||a.ctrlKey)&&"l"===a.key&&(a.preventDefault(),I())};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[I]);let J=(0,c.useCallback)(async(a,b)=>{if(!a.trim()&&!b?.attachmentFilenames?.length)return;t.current?.abort();let c=new AbortController;t.current=c;let d=0!==r.current.length||y.current?null:a,e=aD();if(r.current=[...r.current,{id:aD(),role:"user",content:a,attachmentFilenames:b?.attachmentFilenames?.length?b.attachmentFilenames:void 0},{id:e,role:"thinking",content:"",isStreaming:!0}],z(),b?.attachmentFilenames?.length&&s.current){let a=r.current.filter(a=>"user"===a.role).length-1;aF(s.current,a,b.attachmentFilenames)}o("connecting");let f=null;try{let g=await fetch("/api/internal/assistant/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:a,sessionId:s.current,attachmentFilenames:b?.attachmentFilenames??[]}),signal:c.signal});if(!g.ok||!g.body)throw Error(`HTTP ${g.status}`);o("streaming");let h=g.body.getReader(),i=new TextDecoder,j="";for(;;){let{done:a,value:c}=await h.read();if(a)break;let g=(j+=i.decode(c,{stream:!0})).split("\n");for(let a of(j=g.pop()??"",g)){let c;if(a.startsWith("data: ")){try{c=JSON.parse(a.slice(6).trim())}catch{continue}if(c.sessionId){let a=s.current;if(s.current=c.sessionId,d&&!y.current&&c.sessionId!==a){y.current=!0;new Date().toISOString();c.sessionId,function(a){let b=a.trim();b&&b.length>30&&b.slice(0,30)}(d),v([]),x(c.sessionId),aB(c.sessionId),b?.attachmentFilenames?.length&&aF(c.sessionId,0,b.attachmentFilenames)}}switch(c.type){case"text_delta":{let a=r.current.filter(a=>a.id!==e);f?r.current=a.map(a=>a.id===f?{...a,content:a.content+(c.content??""),isStreaming:!0}:a):(f=aD(),r.current=[...a,{id:f,role:"assistant",content:c.content??"",isStreaming:!0}]),z();break}case"text":{let a=r.current.filter(a=>a.id!==e);f?r.current=a.map(a=>a.id===f?{...a,content:c.content??a.content,isStreaming:!0}:a):(f=aD(),r.current=[...a,{id:f,role:"assistant",content:c.content??"",isStreaming:!0}]),z();break}case"tool_start":{let a=r.current.filter(a=>a.id!==e);f?(r.current=a.map(a=>a.id===f?{...a,isStreaming:!1}:a),f=null):r.current=a,r.current=[...r.current,{id:aD(),role:"tool",content:`Calling ${c.content??"tool"}...`,toolName:c.content,isStreaming:!0}],z();break}case"tool_use":{let a=r.current.filter(a=>a.id!==e),b=f?a.map(a=>a.id===f?{...a,isStreaming:!1}:a):a;f=null,r.current=[...b,{id:aD(),role:"tool",content:JSON.stringify(c.toolInput??{},null,2),toolName:c.content}],z();break}case"tool_result":r.current=[...r.current,{id:aD(),role:"tool",content:String(c.toolOutput??""),toolName:`${c.content??"tool"} (result)`}],z();break;case"error":r.current=[...r.current.filter(a=>a.id!==e),{id:aD(),role:"assistant",content:`Error: ${c.content??"Unknown error"}`}],z(),o("error");break;case"done":f&&(r.current=r.current.map(a=>a.id===f?{...a,isStreaming:!1}:a)),r.current=r.current.filter(a=>a.id!==e),z(),o("idle")}}}}r.current=r.current.filter(a=>a.id!==e),z(),o(a=>"streaming"===a?"idle":a),B()}catch(a){if("AbortError"===a.name)return;r.current=[...r.current.filter(a=>a.id!==e),{id:aD(),role:"assistant",content:`Connection error: ${a.message??"Unknown error"}`}],z(),o("error")}},[z,B]),K=(0,c.useCallback)(()=>{t.current?.abort(),t.current=null;let a=[...r.current].reverse().find(a=>"user"===a.role),b=a?.content??null;if(a){let b=r.current.lastIndexOf(a);r.current=r.current.slice(0,b),m([...r.current])}return o("idle"),b},[]),L=l[l.length-1],M="connecting"===n||"streaming"===n||L?.role==="thinking"&&!0===L.isStreaming;return(0,b.jsx)(aC.Provider,{value:{isOpen:d,isStarting:f,displayMode:h,worktreePath:j,toggleAssistant:I,closeAssistant:H,chatMessages:l,chatStatus:n,isChatThinking:M,isLoadingHistory:p,sendChatMessage:J,cancelChat:K,sessions:u,activeSessionId:w,createNewSession:D,switchSession:E,removeSession:F,refreshSessions:B},children:a})}function aH(){let a=(0,c.useContext)(aC);if(!a)throw Error("useAssistant must be used within an AssistantProvider");return a}var aI=a.i(704494),aJ=a.i(668116),aK=a.i(616335),aL=a.i(394259),aM=a.i(487410),aN=a.i(429246);function aO(a){return a.replace(/\.git\/?$/,"")}a.i(446786),a.i(814747);let aP=(0,w.createServerReference)("4038649f70ecf76055867dc0b626910f6872581e5e",w.callServer,void 0,w.findSourceMapURL,"resolveGitLocalPath");var aQ=a.i(566967),aR=a.i(43775);function aS({open:a,onOpenChange:d,onCreateProject:e}){let{t:f,locale:g}=(0,E.useI18n)(),[h,i]=(0,c.useState)(""),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[o,p]=(0,c.useState)(""),[q,r]=(0,c.useState)(""),[w,x]=(0,c.useState)(!1),[y,z]=(0,c.useState)("FRONTEND"),[A,B]=(0,c.useState)("idle"),[C,D]=(0,c.useState)(""),[G,H]=(0,c.useState)(!1),[I,J]=(0,c.useState)(!1),K=()=>{i(""),k(""),m(""),p(""),r(""),x(!1),z("FRONTEND"),B("idle"),D(""),H(!1)},L=async()=>{if(q.trim()&&!G&&"success"===A){H(!0);try{let a=await (0,aQ.analyzeProjectDirectory)(q.trim(),g);m(a)}catch{F.toast.error(f("project.analyzeError"))}finally{H(!1)}}},M=async a=>{p(a),B("idle"),D("");let b=function(a){let b,c=a.match(/^git@([^:]+):(.+)$/);if(c)return{host:c[1],pathSegments:aO(c[2]).split("/").filter(Boolean)};try{b=new URL(a)}catch{return null}return{host:b.hostname,pathSegments:aO(decodeURIComponent(b.pathname)).split("/").filter(Boolean)}}(a);b&&b.pathSegments.length>0&&i(b.pathSegments[b.pathSegments.length-1]),w||r(await aP(a))},N=async()=>{if(o.trim()&&q.trim()){B("cloning"),D("");try{let a=function(a){let b=a.trim();if(!b)return"";if(b.startsWith("git@")||b.startsWith("ssh://")||b.endsWith(".git"))return b;try{let a=new URL(b),c=a.hostname,d=decodeURIComponent(a.pathname).split("/").filter(Boolean);if("code.iflytek.com"===c){let a=[...d];"osc"===a[0]&&"_source"===a[1]&&(a=a.slice(2));let e=a.indexOf("-");if(e>0&&(a=a.slice(0,e)),0===a.length)return b;return`https://${c}/${a.join("/")}.git`}return`${a.origin}${a.pathname.replace(/\/$/,"")}.git`}catch{return b}}(o.trim()),b=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clone",url:a,path:q.trim()})}),c=await b.json();if(!b.ok){B("error"),D(c.error||"Clone failed");return}B("success")}catch{B("error"),D("Network error")}}},O=async()=>{h.trim()&&(await e?.({name:h.trim(),alias:j.trim()||void 0,description:l.trim()||void 0,gitUrl:o.trim()||void 0,localPath:q.trim()||void 0,projectType:y}),K(),d(!1))};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(s.Dialog,{open:a,onOpenChange:a=>{d(a),a||K()},disablePointerDismissal:!0,children:(0,b.jsxs)(s.DialogContent,{style:{maxWidth:"32rem"},children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:f("topbar.newProject")})}),(0,b.jsxs)("div",{className:"space-y-4 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.gitUrl")}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:f("project.gitUrlHint")}),(0,b.jsx)(v.Input,{placeholder:f("project.gitPlaceholder"),value:o,onChange:a=>M(a.target.value),className:"mt-1.5 font-mono text-xs"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:f("project.localPathHint")}),(0,b.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,b.jsx)(v.Input,{placeholder:f("project.localPathPlaceholder"),value:q,onChange:a=>{r(a.target.value),x(!0)},className:"flex-1 min-w-0 font-mono text-xs"}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsxs)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{type:"button",variant:"outline",onClick:()=>J(!0),className:"shrink-0 gap-1.5 px-2.5 text-xs text-muted-foreground"}),children:[(0,b.jsx)(n.FolderOpen,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:f("folder.browse")})]}),(0,b.jsx)(t.TooltipContent,{children:f("folder.selectFolder")})]})]}),q.trim().startsWith("~")&&(0,b.jsxs)("p",{className:"mt-1 flex items-center gap-1 text-[11px] text-amber-400",children:[(0,b.jsx)(aK.AlertCircle,{className:"h-3 w-3"}),f("project.tildeWarning")]}),o.trim()&&q.trim()&&(0,b.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,b.jsxs)(u.Button,{type:"button",disabled:"cloning"===A||"success"===A,onClick:N,className:"gap-1.5 text-xs bg-emerald-500/15 text-emerald-300 ring-1 ring-emerald-500/25 hover:bg-emerald-500/25 disabled:opacity-50",children:["cloning"===A?(0,b.jsx)(aI.Loader2,{className:"h-3 w-3 animate-spin"}):"success"===A?(0,b.jsx)(aJ.Check,{className:"h-3 w-3"}):(0,b.jsx)(aq.GitBranch,{className:"h-3 w-3"}),"cloning"===A?f("git.cloning"):"success"===A?f("git.cloned"):f("git.clone")]}),"error"===A&&(0,b.jsxs)("span",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,b.jsx)(aK.AlertCircle,{className:"h-3 w-3"}),C]}),"success"===A&&(0,b.jsx)("span",{className:"text-[11px] text-emerald-400",children:f("git.cloneSuccess")})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(v.Input,{placeholder:f("project.namePlaceholder"),value:h,onChange:a=>i(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)(aM.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:y,onChange:z})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(v.Input,{placeholder:f("project.aliasPlaceholder"),value:j,onChange:a=>k(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mt-0.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsxs)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{type:"button",variant:"ghost",onClick:L,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!q.trim()||G?"opacity-50":""}`}),children:[G?(0,b.jsx)(aI.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aL.Sparkles,{className:"h-3 w-3"}),G?f("project.analyzing"):f("project.genDesc")]}),(0,b.jsx)(t.TooltipContent,{children:q.trim()?"success"!==A?f("project.genDescNotCloned"):f("project.genDescReady"):f("project.genDescNoPath")})]})]}),(0,b.jsx)(aN.Textarea,{placeholder:f("project.descPlaceholder"),value:l,onChange:a=>m(a.target.value),rows:3,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)(s.DialogFooter,{children:[(0,b.jsx)(u.Button,{variant:"outline",onClick:()=>{d(!1),K()},children:f("common.cancel")}),(0,b.jsx)(u.Button,{onClick:O,disabled:!h.trim()||G,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:f("common.create")})]})]})}),(0,b.jsx)(aR.FolderBrowserDialog,{open:I,onOpenChange:J,onSelect:a=>{if(r(a),x(!0),!h.trim()){let b=a.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean).pop()??"";b&&i(b)}}})]})}var aT=a.i(976268),aT=aT,aU=a.i(563658);let aV=(0,w.createServerReference)("604269c8f1bf13a507d2a33c1bb103c710232d3a40",w.callServer,void 0,w.findSourceMapURL,"migrateProjectPath"),aW=(0,w.createServerReference)("4072ca35118cb57de16a6ea9447267ffc678259049",w.callServer,void 0,w.findSourceMapURL,"checkMigrationSafety");function aX({open:a,onOpenChange:d,onCreateProject:e}){let{t:f,locale:g}=(0,E.useI18n)(),[h,i]=(0,c.useState)(""),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[o,p]=(0,c.useState)(""),[q,r]=(0,c.useState)(""),[w,x]=(0,c.useState)(!1),[y,z]=(0,c.useState)("FRONTEND"),[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(!1),[G,H]=(0,c.useState)(""),[I,J]=(0,c.useState)(!1),[K,L]=(0,c.useState)(""),[M,N]=(0,c.useState)(""),[O,P]=(0,c.useState)(!1),[Q,R]=(0,c.useState)(!1),S=()=>{i(""),k(""),m(""),p(""),r(""),z("FRONTEND"),B(!1),D(!1),H(""),J(!1),L(""),N(""),P(!1),R(!1)},T=async a=>{r(a),B(!1),D(!1),H(""),L(""),N(""),P(!1),i(a.split("/").filter(Boolean).pop()??"");try{let b=await fetch(`/api/git?path=${encodeURIComponent(a)}`);if(b.ok){let a=await b.json();if(a.isGit&&a.remoteUrl){p(a.remoteUrl),B(!0);let b=a.remoteUrl.match(/\/([^/]+?)(?:\.git)?$/);b&&i(b[1])}}}catch{}},U=(0,c.useCallback)(async a=>{if(D(a),L(""),N(""),P(!1),!a)return void H("");if(o)try{let a=await aP(o);a&&(H(a),a===q&&P(!0))}catch{}if(q)try{let a=await fetch(`/api/git?path=${encodeURIComponent(q)}&checkWorktrees=true`);a.ok&&(await a.json()).hasWorktrees&&N(f("project.worktreeWarning"))}catch{}},[o,q]),V=async()=>{if(q&&!Q){R(!0);try{let a=await (0,aQ.analyzeProjectDirectory)(q.trim(),g);m(a)}catch{F.toast.error(f("project.analyzeError"))}finally{R(!1)}}},W=async()=>{if(!h.trim())return;let a={name:h.trim(),alias:j.trim()||void 0,description:l.trim()||void 0,gitUrl:o.trim()||void 0,localPath:q.trim()||void 0,projectType:y},b=await e?.(a);if(C&&G&&G!==q&&b&&"id"in b){J(!0),L("");try{let a=await aW(b.id);if(!a.safe)return void L(a.reason);let c=await aV(b.id,G);if(!c.success)return void L(c.error??f("project.migrateError"));F.toast.success(f("project.migrateSuccess"))}catch(b){let a=b instanceof Error?b.message:String(b);L(`${f("project.migrateError")}:${a}`);return}finally{J(!1)}}S(),d(!1)},X=!h.trim()||!q.trim()||I||Q||C&&!!M;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(s.Dialog,{open:a,onOpenChange:a=>{d(a),a||S()},disablePointerDismissal:!0,children:(0,b.jsxs)(s.DialogContent,{style:{maxWidth:"32rem"},children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:f("topbar.importProject")})}),(0,b.jsxs)("div",{className:"space-y-4 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)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:f("project.importHint")}),(0,b.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,b.jsx)(v.Input,{value:q,readOnly:!0,placeholder:f("project.localPathPlaceholder"),className:"flex-1 font-mono text-xs bg-muted/30"}),(0,b.jsxs)(u.Button,{type:"button",variant:"outline",onClick:()=>x(!0),className:"shrink-0 gap-1.5",children:[(0,b.jsx)(n.FolderOpen,{className:"h-3.5 w-3.5"}),f("folder.browse")]})]}),A&&(0,b.jsx)("p",{className:"mt-1.5 text-[11px] text-emerald-400",children:f("project.autoDetected")})]}),o&&(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.gitUrl")}),(0,b.jsx)(v.Input,{value:o,onChange:a=>p(a.target.value),className:"mt-1.5 font-mono text-xs"})]}),A&&q&&(0,b.jsxs)("div",{className:"rounded-md border border-border p-3 space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-xs font-medium",children:f("project.migrate")}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:f("project.migrateHint")})]}),(0,b.jsx)(aU.Switch,{checked:C,onCheckedChange:a=>U(a)})]}),C&&(0,b.jsxs)("div",{className:"space-y-2 pt-1",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-[10px] font-medium text-muted-foreground",children:f("project.targetPath")}),(0,b.jsx)(v.Input,{value:G,onChange:a=>{H(a.target.value),P(a.target.value===q)},placeholder:"/path/to/canonical/location",className:"mt-1 font-mono text-xs"})]}),O&&(0,b.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-sky-400",children:[(0,b.jsx)(aT.default,{className:"h-3 w-3"}),f("project.samePathInfo")]}),M&&(0,b.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-amber-400",children:[(0,b.jsx)(aK.AlertCircle,{className:"h-3 w-3"}),M]}),K&&(0,b.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,b.jsx)(aK.AlertCircle,{className:"h-3 w-3"}),K]})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(v.Input,{placeholder:f("project.namePlaceholder"),value:h,onChange:a=>i(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)(aM.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:y,onChange:z})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(v.Input,{placeholder:f("project.aliasPlaceholder"),value:j,onChange:a=>k(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mt-0.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsxs)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{type:"button",variant:"ghost",onClick:V,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!q||Q?"opacity-50":""}`}),children:[Q?(0,b.jsx)(aI.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aL.Sparkles,{className:"h-3 w-3"}),Q?f("project.analyzing"):f("project.genDesc")]}),(0,b.jsx)(t.TooltipContent,{children:q?f("project.genDescReady"):f("project.genDescNoPath")})]})]}),(0,b.jsx)(aN.Textarea,{placeholder:f("project.descPlaceholder"),value:l,onChange:a=>m(a.target.value),rows:3,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)(s.DialogFooter,{children:[(0,b.jsx)(u.Button,{variant:"outline",onClick:()=>{d(!1),S()},children:f("common.cancel")}),(0,b.jsx)(u.Button,{onClick:W,disabled:X,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:I?f("project.migrating"):f("common.create")})]})]})}),(0,b.jsx)(aR.FolderBrowserDialog,{open:w,onOpenChange:x,onSelect:a=>T(a)})]})}function aY({className:a}){return(0,b.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:a,children:(0,b.jsx)("path",{d:"M12 .5C5.65.5.5 5.65.5 12.02c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.56v-2c-3.2.7-3.87-1.36-3.87-1.36-.52-1.34-1.27-1.7-1.27-1.7-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.18 1.76 1.18 1.02 1.76 2.68 1.25 3.34.96.1-.74.4-1.25.72-1.54-2.56-.29-5.25-1.28-5.25-5.69 0-1.26.45-2.28 1.18-3.09-.12-.29-.51-1.46.11-3.04 0 0 .97-.31 3.18 1.18a11.1 11.1 0 0 1 5.79 0c2.2-1.49 3.18-1.18 3.18-1.18.62 1.58.23 2.75.11 3.04.74.81 1.18 1.83 1.18 3.09 0 4.42-2.69 5.4-5.25 5.69.41.36.78 1.05.78 2.12v3.14c0 .31.21.68.79.56A11.52 11.52 0 0 0 23.5 12.02C23.5 5.65 18.35.5 12 .5Z"})})}function aZ({onCreateProject:a,username:e}){let{t:f,locale:h,setLocale:i}=(0,E.useI18n)(),{isOpen:j,toggleAssistant:k}=aH(),{resolvedTheme:l,toggleTheme:m,triggerRef:o}=function(){let{resolvedTheme:a,setTheme:b}=(0,P.useTheme)(),d=(0,c.useRef)(null),e=(0,c.useCallback)(c=>{let d="dark"===a?"light":"dark";if("u">typeof document&&"startViewTransition"in document&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){let a=c?.clientX??window.innerWidth/2,e=c?.clientY??0,f=Math.hypot(Math.max(a,window.innerWidth-a),Math.max(e,window.innerHeight-e));document.startViewTransition(()=>{b(d)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${a}px ${e}px)`,`circle(${f}px at ${a}px ${e}px)`]},{duration:400,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})}else b(d)},[a,b]);return{resolvedTheme:a,toggleTheme:e,triggerRef:d}}(),p=(0,d.useRouter)(),[r,s]=(0,c.useState)(!1),[v,w]=(0,c.useState)(!1),[x,y]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{let a=a=>{(a.metaKey||a.ctrlKey)&&"k"===a.key&&(a.preventDefault(),s(!0))};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("header",{className:"flex h-12 items-center justify-between border-b border-border bg-background/80 px-5 backdrop-blur-sm",children:[(0,b.jsx)("div",{className:"w-40"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsxs)(u.Button,{variant:"outline",onClick:()=>s(!0),className:"h-8 w-[400px] justify-start gap-2 bg-muted/50 text-muted-foreground hover:bg-muted",children:[(0,b.jsx)(Q.Search,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"flex-1 text-left",suppressHydrationWarning:!0,children:f("topbar.searchPlaceholder")}),(0,b.jsxs)("kbd",{className:"mr-1 flex items-center gap-0.5 rounded border border-border bg-background px-1.5 py-0.5 text-[10px] font-mono",children:[(0,b.jsx)(S,{className:"h-2.5 w-2.5"}),"K"]})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{delay:500,render:(0,b.jsx)("button",{"data-tour":"open-assistant",onClick:k,"aria-label":f("assistant.iconLabel"),className:["cursor-pointer rounded-lg p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",j?"bg-accent text-foreground":""].join(" ")}),children:(0,b.jsx)(U,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{children:f("assistant.iconLabel")})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsxs)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{variant:"ghost",onClick:()=>i("zh"===h?"en":"zh"),className:"text-muted-foreground"}),children:[(0,b.jsx)(T.Globe,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"text-[11px] font-semibold",children:"zh"===h?"EN":"中"})]}),(0,b.jsx)(t.TooltipContent,{children:f("settings.language")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{ref:o,variant:"ghost",size:"icon",onClick:m,className:"text-muted-foreground"}),children:"dark"===l?(0,b.jsx)(V.Sun,{className:"h-4 w-4"}):(0,b.jsx)(W.Moon,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{children:f("settings.theme")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",onClick:()=>window.open("https://github.com/jp-liu/tower","_blank","noopener,noreferrer"),className:"text-muted-foreground","aria-label":f("topbar.github")}),children:(0,b.jsx)(aY,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{children:f("topbar.github")})]}),(0,b.jsx)("div",{className:"h-4 w-px bg-border"}),(0,b.jsxs)(u.Button,{variant:"outline",className:"gap-1.5 ring-1 ring-border hover:bg-accent",onClick:()=>y(!0),children:[(0,b.jsx)(n.FolderOpen,{className:"h-3.5 w-3.5"}),f("topbar.importProject")]}),(0,b.jsxs)(u.Button,{"data-tour":"create-project",className:"gap-1.5 bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",onClick:()=>w(!0),children:[(0,b.jsx)(g.Plus,{className:"h-3.5 w-3.5"}),f("topbar.newProject")]}),(0,b.jsxs)(q.DropdownMenu,{children:[(0,b.jsx)(q.DropdownMenuTrigger,{render:(0,b.jsxs)("button",{className:"ml-0.5 flex cursor-pointer items-center gap-1.5 rounded-lg px-2.5 py-1 transition-colors hover:bg-accent",children:[e&&(0,b.jsx)("span",{className:"max-w-[80px] truncate text-xs text-muted-foreground",children:e}),(0,b.jsx)(an,{className:"h-7 w-7 ring-1 ring-border",children:(0,b.jsx)(ao,{className:"bg-emerald-500/20 text-emerald-400 text-[10px] font-semibold",children:e?e.trim().split(/\s+/).filter(a=>a.length>0).slice(0,2).map(a=>a[0].toUpperCase()).join(""):"U"})})]})}),(0,b.jsx)(q.DropdownMenuContent,{align:"end",sideOffset:8,className:"w-40",children:(0,b.jsxs)(q.DropdownMenuItem,{onClick:()=>p.push("/settings"),children:[(0,b.jsx)(R.Settings,{className:"mr-2 h-3.5 w-3.5"}),f("settings.title")]})})]})]})]}),(0,b.jsx)(aA,{open:r,onOpenChange:s}),(0,b.jsx)(aS,{open:v,onOpenChange:w,onCreateProject:a}),(0,b.jsx)(aX,{open:x,onOpenChange:y,onCreateProject:a})]})}var a$=a.i(347872),a_=a.i(595999),a0=a.i(166281),a1=a.i(969032),a2=a.i(442620);let a3=(0,a1.default)(async()=>{},{loadableGenerated:{modules:[103363]},ssr:!1});function a4({mode:a}){let{isOpen:c,closeAssistant:d,sessions:e,activeSessionId:f,createNewSession:h,switchSession:j,removeSession:k}=aH(),{t:l}=(0,E.useI18n)(),m=e.find(a=>a.id===f),n=m?.title??l("assistant.newSession");return(0,b.jsxs)("div",{className:"sidebar"===a?"min-w-[320px] max-w-[480px] w-[30vw] shrink-0 border-r border-border flex flex-col bg-sidebar overflow-hidden":"flex flex-col h-full overflow-hidden",children:[(0,b.jsxs)("div",{className:"header-sm flex items-center px-4 gap-2 bg-sidebar",children:[(0,b.jsx)(U,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"text-sm font-semibold text-foreground shrink-0",children:l("assistant.title")}),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"flex-1"}),(0,b.jsxs)(q.DropdownMenu,{children:[(0,b.jsxs)(q.DropdownMenuTrigger,{className:"flex items-center gap-1 h-8 px-2 rounded-md text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground max-w-[120px] truncate","aria-label":l("assistant.sessionList"),children:[(0,b.jsx)("span",{className:"truncate",children:n}),(0,b.jsx)(a2.ChevronDown,{className:"h-3 w-3 shrink-0"})]}),(0,b.jsxs)(q.DropdownMenuContent,{side:"bottom",align:"end",sideOffset:4,children:[0===e.length?(0,b.jsx)("div",{className:"px-2 py-4 text-xs text-muted-foreground text-center",children:l("assistant.noSessions")}):e.map(a=>(0,b.jsxs)(q.DropdownMenuItem,{className:"flex items-center justify-between gap-2 pr-1",onClick:()=>j(a.id),children:[(0,b.jsxs)("div",{className:"flex flex-col gap-0.5 min-w-0",children:[(0,b.jsx)("span",{className:"text-xs truncate max-w-[140px]",children:a.title}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(a){let b=Math.floor((Date.now()-new Date(a).getTime())/1e3);if(b<60)return`${b}s ago`;let c=Math.floor(b/60);if(c<60)return`${c}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);return`${e}d ago`}(a.updatedAt)})]}),(0,b.jsx)(u.Button,{variant:"ghost",className:"h-6 w-6 p-0 shrink-0 opacity-50 hover:opacity-100 hover:text-destructive",onClick:b=>{b.stopPropagation(),k(a.id)},"aria-label":l("assistant.deleteSession"),children:(0,b.jsx)(i.Trash2,{className:"h-3 w-3"})})]},a.id)),e.length>0&&(0,b.jsx)(q.DropdownMenuSeparator,{}),(0,b.jsxs)(q.DropdownMenuItem,{onClick:h,children:[(0,b.jsx)(g.Plus,{className:"h-3 w-3 mr-1"}),(0,b.jsx)("span",{className:"text-xs",children:l("assistant.newSession")})]})]})]}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:h,"aria-label":l("assistant.newSession"),children:(0,b.jsx)(g.Plus,{className:"h-4 w-4"})})]}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:d,"aria-label":l("assistant.closeLabel"),children:(0,b.jsx)(at.X,{className:"h-4 w-4"})})]}),(0,b.jsx)("div",{className:"flex-1 overflow-hidden",children:c?(0,b.jsx)(a3,{}):null})]})}var a5=a.i(190076);function a6({onDismiss:a}){let{t:d}=(0,E.useI18n)(),[e,f]=(0,c.useState)(!1);(0,c.useEffect)(()=>{},[]);let g=async()=>{"default"!==await window.Notification.requestPermission()&&(f(!1),a?.())};return e?(0,b.jsxs)("div",{className:"fixed top-3 left-1/2 -translate-x-1/2 z-[9999] w-auto max-w-lg bg-card border rounded-lg shadow-lg px-4 py-2.5 flex items-center gap-3 animate-in fade-in slide-in-from-top-4 duration-500",children:[(0,b.jsx)(a5.Bell,{className:"h-4 w-4 shrink-0 text-primary"}),(0,b.jsx)("span",{className:"flex-1 text-sm",children:d("notification.permissionPrompt")}),(0,b.jsx)(u.Button,{size:"default",onClick:g,children:d("notification.allow")}),(0,b.jsx)(u.Button,{variant:"ghost",size:"default",onClick:()=>{f(!1),a?.()},children:d("notification.dismiss")})]}):null}a.i(569123);var a7=a.i(704784);let a8=[{target:"create-workspace",titleKey:"tour.step1.title",descKey:"tour.step1.desc",placement:"right"},{target:"create-project",titleKey:"tour.step2.title",descKey:"tour.step2.desc",placement:"bottom",waitForTarget:!0},{target:"open-assistant",titleKey:"tour.step3.title",descKey:"tour.step3.desc",placement:"bottom"}];function a9({onComplete:a}){let{t:d}=(0,E.useI18n)(),[e,f]=(0,c.useState)(0),[g,h]=(0,c.useState)(null),[i,j]=(0,c.useState)(!1),k=(0,c.useRef)(null),l=a8[e],m=(0,c.useCallback)(async()=>{await (0,a7.setConfigValue)("onboarding.tourCompleted",!0),a()},[a]),n=(0,c.useCallback)(()=>l?document.querySelector(`[data-tour="${l.target}"]`):null,[l]),o=(0,c.useCallback)(()=>{let a=n();a?(h(a.getBoundingClientRect()),j(!0)):j(!1)},[n]);(0,c.useEffect)(()=>{o();let a=null;!i&&l?.waitForTarget&&(k.current=new MutationObserver(()=>{let b=n();b&&(h(b.getBoundingClientRect()),j(!0),k.current?.disconnect(),a&&clearTimeout(a))}),k.current.observe(document.body,{childList:!0,subtree:!0}),a=setTimeout(()=>{!n()&&(f(a=>{let b=a+1;return b<a8.length?b:a}),e>=a8.length-1&&m())},5e3));let b=()=>o();return window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),()=>{k.current?.disconnect(),a&&clearTimeout(a),window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}},[e,l,n,o,i,m]),(0,c.useEffect)(()=>{let a=setInterval(o,1e3);return()=>clearInterval(a)},[o]);let p=(0,c.useCallback)(()=>{e<a8.length-1?(f(a=>a+1),j(!1)):m()},[e]);return l?(0,b.jsx)(b.Fragment,{children:i&&g&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"fixed inset-0 z-[10000]",style:{background:`radial-gradient(
1
+ module.exports=[976268,a=>{"use strict";let b=(0,a.i(711796).default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);a.s(["default",0,b])},607884,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(553798),e=a.i(634910),f=a.i(607219),g=a.i(774881),h=a.i(690251),i=a.i(975231),j=a.i(336771),k=a.i(91756),l=a.i(881107),m=a.i(350739),n=a.i(347165),o=a.i(711796);let p=(0,o.default)("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);var q=a.i(335732),r=a.i(269876),s=a.i(814574),t=a.i(785259),u=a.i(699570),v=a.i(866718),w=a.i(780410);let x=(0,w.createServerReference)("40469b034e6de56a6378c251eb79f5e80e4b5f0f99",w.callServer,void 0,w.findSourceMapURL,"createWorkspace"),y=(0,w.createServerReference)("60485f7068c2514f1e8ba9cb5fd985ede50fc4eae9",w.callServer,void 0,w.findSourceMapURL,"updateWorkspace"),z=(0,w.createServerReference)("407af08f0f956503bb1eb1951efbe2cc0d7c6c02bc",w.callServer,void 0,w.findSourceMapURL,"deleteWorkspace"),A=(0,w.createServerReference)("4018f181099aa2129c597e6f1a918043d574e8ab13",w.callServer,void 0,w.findSourceMapURL,"reorderWorkspaces");var B=a.i(966235);let C=(0,w.createServerReference)("40b72c1f0fd2f6719f6e51b303736967788b1a05f1",w.callServer,void 0,w.findSourceMapURL,"createLabel"),D=(0,w.createServerReference)("40825460d9f93dd4bd5271ba4c8cc7b231ffc8698d",w.callServer,void 0,w.findSourceMapURL,"deleteLabel");var E=a.i(951192),F=a.i(952313),G=a.i(643228),H=a.i(859103),I=a.i(514126);let J=["📋","🚀","🎯","💡","🔧","📦","🎨","📊","🔬","🌟","📝","🏗️"];function K({workspaces:a}){let h,i=(0,d.useRouter)(),j=(0,d.usePathname)(),{t:l}=(0,E.useI18n)(),[o,q]=(0,c.useState)(!1);(0,c.useEffect)(()=>{"true"===localStorage.getItem("sidebar-collapsed")&&q(!0)},[]);let[s,v]=(0,c.useState)(!1),[w,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(!1),[I,N]=(0,c.useState)(null),[P,Q]=(0,c.useState)(""),[R,S]=(0,c.useState)(J[0]),[T,U]=(0,c.useState)(null),[V,W]=(0,c.useState)(a);(0,c.useEffect)(()=>{W(a)},[a]);let X=(0,G.useSensors)((0,G.useSensor)(G.PointerSensor,{activationConstraint:{distance:8}})),Y=(0,c.useCallback)(b=>{let{active:c,over:d}=b;if(!d||c.id===d.id)return;let e=V.findIndex(a=>a.id===c.id),f=V.findIndex(a=>a.id===d.id);if(-1===e||-1===f)return;let g=(0,H.arrayMove)(V,e,f);W(g),A(g.map(a=>a.id)).then(()=>i.refresh()).catch(()=>{W(a),F.toast.error(l("sidebar.reorderError"))})},[V,a,i,l]),Z=j.split("/workspaces/")[1]?.split("/")[0],$=(0,c.useCallback)(()=>{q(a=>{let b=!a;return localStorage.setItem("sidebar-collapsed",String(b)),b})},[]),_=(0,c.useCallback)(async()=>{if(!P.trim())return;let a=await x({name:P.trim(),description:R});Q(""),S(J[0]),v(!1),i.refresh(),i.push(`/workspaces/${a.id}`)},[P,R,i]),aa=(0,c.useCallback)(async()=>{P.trim()&&T&&(await y(T,{name:P.trim(),description:R}),Q(""),B(!1),U(null),i.refresh())},[P,R,T,i]),ab=(0,c.useCallback)(a=>{U(a.id),Q(a.name),S(a.description&&J.includes(a.description)?a.description:J[0]),B(!0)},[]),ac=(0,c.useCallback)(async(b,c)=>{if(a.length<=1)return void F.toast.error(l("sidebar.lastWorkspaceError"));if(confirm(l("sidebar.deleteConfirm",{name:c})))try{await z(b),i.refresh(),Z===b&&i.push("/workspaces")}catch{F.toast.error(l("sidebar.lastWorkspaceError"))}},[Z,i,l,a.length]),ad=(0,c.useCallback)(a=>{N(a),D(!0)},[]),ae=a=>a.description&&J.includes(a.description)?a.description:a.name.charAt(0).toUpperCase();if(o){let c;return(0,b.jsxs)("aside",{className:"flex h-screen w-14 flex-col items-center border-r border-border bg-sidebar py-3",children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:$,className:"mb-4 flex h-9 w-9 items-center justify-center rounded-lg bg-primary/10 ring-1 ring-primary/20 transition-transform hover:scale-105"}),children:(0,b.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-6 w-6 rounded"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.expand")})]}),(0,b.jsx)(r.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsxs)("div",{className:"flex flex-col items-center gap-1 px-0.5 pt-1",children:[a.map(a=>{let c=Z===a.id,d=ae(a);return(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>{c||i.push(`/workspaces/${a.id}`)},className:`flex h-9 w-9 items-center justify-center rounded-lg transition-all ${c?"ring-1 ring-primary/20 text-foreground cursor-default":"text-muted-foreground hover:text-foreground cursor-pointer"}`}),children:(0,b.jsx)("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-muted text-sm",children:J.includes(d)?d:(0,b.jsx)("span",{className:"text-xs font-semibold",children:d})})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:a.name})]},a.id)}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{"data-tour":"create-workspace",onClick:()=>v(!0),className:"flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"}),children:(0,b.jsx)(g.Plus,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.newWorkspace")})]})]})}),(0,b.jsxs)("div",{className:"mt-2 flex flex-col items-center gap-1",children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>i.push("/missions"),className:`rounded-lg p-2 transition-colors ${"/missions"===j?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(p,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("missions.navLabel")})]}),(c=Z||a[0]?.id)?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>i.push(`/workspaces/${c}/notes`),className:`rounded-lg p-2 transition-colors ${j.includes("/notes")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(m.FileText,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.notes")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>i.push(`/workspaces/${c}/assets`),className:`rounded-lg p-2 transition-colors ${j.includes("/assets")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(n.FolderOpen,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.assets")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{onClick:()=>i.push(`/workspaces/${c}/archive`),className:`rounded-lg p-2 transition-colors ${j.includes("/archive")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,b.jsx)(f.Archive,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{side:"right",sideOffset:8,children:l("sidebar.archive")})]})]}):null]}),(0,b.jsx)(M,{open:s,onOpenChange:v,title:l("workspace.create"),name:P,onNameChange:Q,icon:R,onIconChange:S,onSubmit:_,submitLabel:l("common.create"),nameLabel:l("workspace.name"),iconLabel:l("workspace.icon"),namePlaceholder:l("workspace.namePlaceholder"),cancelLabel:l("common.cancel")})]})}return(0,b.jsxs)("aside",{className:"noise relative flex h-screen w-56 flex-col border-r border-border bg-sidebar",children:[(0,b.jsxs)("div",{className:"relative z-10 flex items-center gap-3 px-4 py-4",children:[(0,b.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-9 w-9 rounded-lg"}),(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("div",{className:"text-sm font-semibold tracking-tight text-foreground",children:"Tower"}),(0,b.jsx)("div",{className:"text-[10px] font-medium uppercase tracking-widest text-muted-foreground",children:"Studio"})]}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon-xs",onClick:$,className:"text-muted-foreground",title:l("sidebar.collapse"),children:(0,b.jsx)(k.ChevronsLeft,{className:"h-4 w-4"})})]}),(0,b.jsxs)("div",{className:"relative z-10 flex items-center justify-between px-4 py-2",children:[(0,b.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:l("sidebar.workspace")}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground","data-tour":"create-workspace",onClick:()=>{Q(""),S(J[0]),v(!0)},title:l("sidebar.newWorkspace"),children:(0,b.jsx)(g.Plus,{className:"h-3.5 w-3.5"})})]}),(0,b.jsx)(r.ScrollArea,{className:"relative z-10 mt-2 flex-1 min-h-0",children:(0,b.jsx)("div",{className:"px-2 py-1",children:(0,b.jsx)(G.DndContext,{id:"workspace-sidebar",sensors:X,collisionDetection:G.closestCenter,onDragEnd:Y,children:(0,b.jsx)(H.SortableContext,{items:V.map(a=>a.id),strategy:H.verticalListSortingStrategy,children:V.map(a=>(0,b.jsx)(L,{ws:a,isActive:Z===a.id,icon:ae(a),disableDelete:V.length<=1,t:l,onSelect:()=>{Z!==a.id&&i.push(`/workspaces/${a.id}`)},onEdit:()=>ab(a),onManageLabels:()=>ad(a.id),onDelete:()=>ac(a.id,a.name)},a.id))})})})}),(0,b.jsxs)(e.default,{href:"/missions",className:`relative z-10 flex items-center gap-2 border-t border-border px-4 py-3 text-[11px] cursor-pointer transition-colors ${"/missions"===j?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,b.jsx)(p,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:l("missions.navLabel")})]}),(h=Z||a[0]?.id)?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(e.default,{href:`/workspaces/${h}/notes`,className:"relative z-10 flex items-center gap-2 border-t border-border px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,b.jsx)(m.FileText,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:l("sidebar.notes")})]}),(0,b.jsxs)(e.default,{href:`/workspaces/${h}/assets`,className:"relative z-10 flex items-center gap-2 px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,b.jsx)(n.FolderOpen,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:l("sidebar.assets")})]}),(0,b.jsxs)(e.default,{href:`/workspaces/${h}/archive`,className:"relative z-10 flex items-center gap-2 px-4 py-3 text-[11px] text-muted-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,b.jsx)(f.Archive,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:l("sidebar.archive")})]})]}):null,(0,b.jsx)(M,{open:s,onOpenChange:v,title:l("workspace.create"),name:P,onNameChange:Q,icon:R,onIconChange:S,onSubmit:_,submitLabel:l("common.create"),nameLabel:l("workspace.name"),iconLabel:l("workspace.icon"),namePlaceholder:l("workspace.namePlaceholder"),cancelLabel:l("common.cancel")}),(0,b.jsx)(M,{open:w,onOpenChange:a=>{B(a),a||U(null)},title:l("workspace.edit"),name:P,onNameChange:Q,icon:R,onIconChange:S,onSubmit:aa,submitLabel:l("common.save"),nameLabel:l("workspace.name"),iconLabel:l("workspace.icon"),namePlaceholder:l("workspace.namePlaceholder"),cancelLabel:l("common.cancel")}),I&&(0,b.jsx)(O,{open:C,onOpenChange:a=>{D(a),a||N(null)},workspaceId:I})]})}function L({ws:a,isActive:c,icon:d,disableDelete:e,t:f,onSelect:g,onEdit:k,onManageLabels:m,onDelete:n}){var o;let p,r,s,{attributes:t,listeners:u,setNodeRef:v,transform:w,transition:x,isDragging:y}=(0,H.useSortable)({id:a.id}),z={transform:I.CSS.Transform.toString(w),transition:x,opacity:y?.4:1};return(0,b.jsxs)("div",{ref:v,style:z,...t,...u,className:`group relative flex touch-none items-center rounded-lg transition-all ${c?"bg-accent ring-1 ring-primary/15":"hover:bg-accent/60"}`,children:[(0,b.jsxs)("button",{onClick:g,className:`flex flex-1 items-center gap-2.5 px-3 py-2.5 text-left ${c?"cursor-default":"cursor-pointer"}`,children:[(0,b.jsx)("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-muted text-sm",children:J.includes(d)?d:(0,b.jsx)("span",{className:"text-xs font-semibold text-muted-foreground",children:d})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("div",{className:`truncate text-sm font-medium ${c?"text-foreground":"text-secondary-foreground"}`,children:a.name}),(0,b.jsx)("div",{className:"text-[11px] text-muted-foreground",children:(o=a.updatedAt,r=Math.floor((p=Date.now()-new Date(o).getTime())/6e4),s=Math.floor(p/36e5),r<60?`${r}m ago`:s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`)})]})]}),(0,b.jsxs)(q.DropdownMenu,{children:[(0,b.jsx)(q.DropdownMenuTrigger,{render:(0,b.jsx)("button",{className:"mr-2 rounded-md p-1 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)(j.MoreHorizontal,{className:"h-3.5 w-3.5"})}),(0,b.jsxs)(q.DropdownMenuContent,{align:"start",side:"right",children:[(0,b.jsxs)(q.DropdownMenuItem,{onClick:k,children:[(0,b.jsx)(h.Pencil,{className:"mr-2 h-3.5 w-3.5"}),f("sidebar.rename")]}),(0,b.jsxs)(q.DropdownMenuItem,{onClick:m,children:[(0,b.jsx)(l.Tag,{className:"mr-2 h-3.5 w-3.5"}),f("sidebar.manageLabels")]}),(0,b.jsxs)(q.DropdownMenuItem,{className:e?"text-muted-foreground opacity-50":"text-rose-400",disabled:e,onClick:n,children:[(0,b.jsx)(i.Trash2,{className:"mr-2 h-3.5 w-3.5"}),f("sidebar.delete")]})]})]})]})}function M({open:a,onOpenChange:c,title:d,name:e,onNameChange:f,icon:g,onIconChange:h,onSubmit:i,submitLabel:j,nameLabel:k,iconLabel:l,namePlaceholder:m,cancelLabel:n}){return(0,b.jsx)(s.Dialog,{open:a,onOpenChange:c,disablePointerDismissal:!0,children:(0,b.jsxs)(s.DialogContent,{className:"sm:max-w-sm",children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:d})}),(0,b.jsxs)("div",{className:"space-y-4 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:k}),(0,b.jsx)(v.Input,{placeholder:m,value:e,onChange:a=>f(a.target.value),onKeyDown:a=>"Enter"===a.key&&a.preventDefault(),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:l}),(0,b.jsx)("div",{className:"mt-1.5 grid grid-cols-6 gap-1.5",children:J.map(a=>(0,b.jsx)("button",{onClick:()=>h(a),className:`flex h-10 w-10 items-center justify-center rounded-lg text-lg transition-all ${g===a?"bg-primary/15 ring-2 ring-primary/30 scale-110":"bg-muted hover:bg-accent"}`,children:a},a))})]})]}),(0,b.jsxs)(s.DialogFooter,{children:[(0,b.jsx)(u.Button,{variant:"outline",onClick:()=>c(!1),children:n}),(0,b.jsx)(u.Button,{onClick:i,disabled:!e.trim(),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:j})]})]})})}let N=["#3b82f6","#ef4444","#f59e0b","#10b981","#8b5cf6","#ec4899","#06b6d4","#f97316"];function O({open:a,onOpenChange:d,workspaceId:e}){let{t:f}=(0,E.useI18n)(),[g,h]=(0,c.useState)([]),[i,j]=(0,c.useState)(""),[k,l]=(0,c.useState)(N[0]);(0,c.useEffect)(()=>{a&&(0,B.getLabelsForWorkspace)(e).then(h)},[a,e]);let m=async()=>{i.trim()&&(await C({name:i.trim(),color:k,workspaceId:e}),h(await (0,B.getLabelsForWorkspace)(e)),j(""))},n=async a=>{await D(a),h(b=>b.filter(b=>b.id!==a))};return(0,b.jsx)(s.Dialog,{open:a,onOpenChange:d,disablePointerDismissal:!0,children:(0,b.jsxs)(s.DialogContent,{className:"sm:max-w-sm",children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:f("label.manage")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[g.map(a=>(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"h-3 w-3 rounded-full",style:{backgroundColor:a.color}}),(0,b.jsx)("span",{className:"flex-1 text-sm text-foreground",children:a.name}),a.isBuiltin?(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:f("label.builtin")}):(0,b.jsx)("button",{onClick:()=>n(a.id),className:"text-xs text-rose-400 hover:text-rose-300",children:f("common.delete")})]},a.id)),(0,b.jsxs)("div",{className:"border-t border-border pt-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(v.Input,{placeholder:f("label.name"),value:i,onChange:a=>j(a.target.value),onKeyDown:a=>"Enter"===a.key&&a.preventDefault(),className:"flex-1 h-8"}),(0,b.jsx)(u.Button,{size:"sm",onClick:m,disabled:!i.trim(),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:f("label.add")})]}),(0,b.jsx)("div",{className:"mt-2 flex gap-1.5",children:N.map(a=>(0,b.jsx)("button",{onClick:()=>l(a),className:`h-5 w-5 rounded-full transition-all ${k===a?"ring-2 ring-offset-2 ring-offset-background ring-foreground/30 scale-110":""}`,style:{backgroundColor:a}},a))})]})]})]})})}var P=a.i(940271),Q=a.i(573242),R=a.i(369289);let S=(0,o.default)("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);var T=a.i(851378);let U=(0,o.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);var V=a.i(761052),W=a.i(86354);a.s([],516474),a.i(516474);var X=a.i(213200),Y=a.i(862306);let Z=c.createContext(void 0);function $(){let a=c.useContext(Z);if(void 0===a)throw Error((0,Y.default)(13));return a}let _={imageLoadingStatus:()=>null},aa=c.forwardRef(function(a,d){let{className:e,render:f,...g}=a,[h,i]=c.useState("idle"),j=c.useMemo(()=>({imageLoadingStatus:h,setImageLoadingStatus:i}),[h,i]),k=(0,X.useRenderElement)("span",a,{state:{imageLoadingStatus:h},ref:d,props:g,stateAttributesMapping:_});return(0,b.jsx)(Z.Provider,{value:j,children:k})});var ab=a.i(74686),ac=a.i(830067),ad=a.i(398312),ae=a.i(380562),af=a.i(904531),ag=a.i(535011);let ah={..._,...ae.transitionStatusMapping},ai=c.forwardRef(function(a,b){let{className:d,render:e,onLoadingStatusChange:f,referrerPolicy:g,crossOrigin:h,...i}=a,j=$(),k=function(a,{referrerPolicy:b,crossOrigin:d}){let[e,f]=c.useState("idle");return(0,ac.useIsoLayoutEffect)(()=>{if(!a)return f("error"),ag.NOOP;let c=!0,e=new window.Image,g=a=>()=>{c&&f(a)};return f("loading"),e.onload=g("loaded"),e.onerror=g("error"),b&&(e.referrerPolicy=b),e.crossOrigin=d??null,e.src=a,()=>{c=!1}},[a,d,b]),e}(a.src,{referrerPolicy:g,crossOrigin:h}),l="loaded"===k,{mounted:m,transitionStatus:n,setMounted:o}=(0,af.useTransitionStatus)(l),p=c.useRef(null),q=(0,ab.useStableCallback)(a=>{f?.(a),j.setImageLoadingStatus(a)});(0,ac.useIsoLayoutEffect)(()=>{"idle"!==k&&q(k)},[k,q]),(0,ad.useOpenChangeComplete)({open:l,ref:p,onComplete(){l||o(!1)}});let r=(0,X.useRenderElement)("img",a,{state:{imageLoadingStatus:k,transitionStatus:n},ref:[b,p],props:i,stateAttributesMapping:ah,enabled:m});return m?r:null});var aj=a.i(102934);let ak=c.forwardRef(function(a,b){let{className:d,render:e,delay:f,...g}=a,{imageLoadingStatus:h}=$(),[i,j]=c.useState(void 0===f),k=(0,aj.useTimeout)();return c.useEffect(()=>(void 0!==f&&k.start(f,()=>j(!0)),k.clear),[k,f]),(0,X.useRenderElement)("span",a,{state:{imageLoadingStatus:h},ref:b,props:g,stateAttributesMapping:_,enabled:"loaded"!==h&&i})});a.s(["Fallback",0,ak,"Image",0,ai,"Root",0,aa],991134);var al=a.i(991134),al=al,am=a.i(368114);function an({className:a,size:c="default",...d}){return(0,b.jsx)(al.Root,{"data-slot":"avatar","data-size":c,className:(0,am.cn)("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",a),...d})}function ao({className:a,...c}){return(0,b.jsx)(al.Fallback,{"data-slot":"avatar-fallback",className:(0,am.cn)("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",a),...c})}let ap=(0,o.default)("folder-kanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);var aq=a.i(577565);let ar=(0,o.default)("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]]),as=(0,o.default)("package-2",[["path",{d:"M12 3v6",key:"1holv5"}],["path",{d:"M16.76 3a2 2 0 0 1 1.8 1.1l2.23 4.479a2 2 0 0 1 .21.891V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9.472a2 2 0 0 1 .211-.894L5.45 4.1A2 2 0 0 1 7.24 3z",key:"187q7i"}],["path",{d:"M3.054 9.013h17.893",key:"grwhos"}]]);var at=a.i(54384);let au=(0,w.createServerReference)("604331353a8ec4283a61d5b48c086dfb91b631a30e",w.callServer,void 0,w.findSourceMapURL,"globalSearch");var av=a.i(997104);let aw=[{id:"all",key:"search.all",icon:Q.Search},{id:"task",key:"search.task",icon:m.FileText},{id:"project",key:"search.project",icon:ap},{id:"repository",key:"search.repository",icon:aq.GitBranch},{id:"note",key:"search.note",icon:ar},{id:"asset",key:"search.asset",icon:as}],ax=["task","project","repository","note","asset"],ay={task:"search.task",project:"search.project",repository:"search.repository",note:"search.note",asset:"search.asset"};function az({result:a,onSelect:c}){let d=aw.find(b=>b.id===a.type)?.icon??m.FileText;return(0,b.jsxs)("button",{onClick:()=>c(a),className:"flex w-full items-center gap-3 border-b border-border/30 px-4 py-3 text-left transition-colors hover:bg-accent last:border-b-0",children:[(0,b.jsx)("div",{className:"rounded-md bg-muted p-1.5",children:(0,b.jsx)(d,{className:"h-3.5 w-3.5 text-muted-foreground"})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("div",{className:"text-sm font-medium text-foreground truncate",children:a.title}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:a.subtitle}),a.snippet&&(0,b.jsx)("div",{className:"text-xs text-muted-foreground/70 truncate mt-0.5",children:a.snippet})]})]})}function aA({open:a,onOpenChange:e}){let f,{t:g}=(0,E.useI18n)(),h=(0,d.useRouter)(),[i,j]=(0,c.useState)(""),[k,l]=(0,c.useState)("all"),[m,n]=(0,c.useState)([]),[o,p]=(0,c.useState)(!1),[q,t]=(0,c.useState)(250),v=(0,c.useRef)(null),w=(0,c.useRef)(null);(0,c.useEffect)(()=>{a&&((0,av.getConfigValue)("search.debounceMs",250).then(t),setTimeout(()=>v.current?.focus(),100),j(""),n([]))},[a]),(0,c.useEffect)(()=>{if(w.current&&clearTimeout(w.current),!i.trim()){n([]),p(!1);return}p(!0);let a=!1;return w.current=setTimeout(async()=>{let b=await au(i,k);a||(n(b),p(!1))},q),()=>{w.current&&clearTimeout(w.current),a=!0}},[i,k,q]);let x=(0,c.useCallback)(a=>{h.push(a.navigateTo),e(!1)},[h,e]);return(0,b.jsx)(s.Dialog,{open:a,onOpenChange:e,children:(0,b.jsxs)(s.DialogContent,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden !top-[10vh] !-translate-y-0",showCloseButton:!1,children:[(0,b.jsxs)("div",{className:"flex items-center border-b border-border px-4",children:[(0,b.jsx)(Q.Search,{className:"h-4 w-4 text-muted-foreground"}),(0,b.jsx)("input",{ref:v,value:i,onChange:a=>j(a.target.value),placeholder:g("search.placeholder"),className:"flex-1 bg-transparent px-3 py-3.5 text-sm text-foreground placeholder-muted-foreground outline-none"}),i&&(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",onClick:()=>{j(""),n([])},className:"text-muted-foreground",children:(0,b.jsx)(at.X,{className:"h-3.5 w-3.5"})})]}),(0,b.jsx)("div",{className:"flex items-center gap-1 border-b border-border px-4 py-2",children:aw.map(a=>{let c=a.icon;return(0,b.jsxs)("button",{onClick:()=>l(a.id),className:`flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-all ${k===a.id?"bg-primary/10 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent hover:text-foreground"}`,children:[(0,b.jsx)(c,{className:"h-3 w-3"}),g(a.key)]},a.id)})}),(0,b.jsxs)(r.ScrollArea,{className:"max-h-80",children:[!i.trim()&&(0,b.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:g("search.typeToSearch")}),i.trim()&&0===m.length&&!o&&(0,b.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:g("search.noResults")}),"all"===k&&m.length>0&&(f=m.reduce((a,b)=>((a[b.type]??=[]).push(b),a),{}),ax.filter(a=>f[a]?.length).map(a=>(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"px-4 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50",children:g(ay[a])}),f[a].map(a=>(0,b.jsx)(az,{result:a,onSelect:x},`${a.type}-${a.id}`))]},a))),"all"!==k&&m.map(a=>(0,b.jsx)(az,{result:a,onSelect:x},`${a.type}-${a.id}`))]})]})})}function aB(a){}let aC=(0,c.createContext)(null);function aD(){return"u">typeof crypto&&crypto.randomUUID?crypto.randomUUID():`msg-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}let aE="assistant-attachment-cache";function aF(a,b,c){try{let d=sessionStorage.getItem(aE),e=d?JSON.parse(d):{};e[a]||(e[a]={}),e[a][b]=c,sessionStorage.setItem(aE,JSON.stringify(e))}catch{}}function aG({children:a}){let[d,e]=(0,c.useState)(!1),[f,g]=(0,c.useState)(!1),[h,i]=(0,c.useState)("sidebar"),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)([]),[n,o]=(0,c.useState)("idle"),[p,q]=(0,c.useState)(!1),r=(0,c.useRef)([]),s=(0,c.useRef)(null),t=(0,c.useRef)(null),[u,v]=(0,c.useState)([]),[w,x]=(0,c.useState)(null),y=(0,c.useRef)(!1),z=(0,c.useCallback)(()=>{m([...r.current])},[]),A=(0,c.useCallback)(async()=>{i("dialog"===await (0,av.getConfigValue)("assistant.displayMode","sidebar")?"dialog":"sidebar")},[]);(0,c.useEffect)(()=>{A()},[A]);let B=(0,c.useCallback)(async()=>{v([])},[]),C=(0,c.useCallback)(async a=>{q(!0);try{let b=await fetch(`/api/internal/assistant/sessions?sessionId=${encodeURIComponent(a)}`);if(!b.ok)return;let c=await b.json();if(Array.isArray(c.messages)){r.current=c.messages;let b=function(a){try{let b=sessionStorage.getItem(aE);if(!b)return{};return JSON.parse(b)[a]??{}}catch{return{}}}(a);if(Object.keys(b).length>0){let a=0;r.current=r.current.map(c=>{if("user"===c.role){let d=b[a];if(a++,d?.length)return{...c,attachmentFilenames:d}}return c})}m([...r.current])}}catch{}finally{q(!1)}},[]);(0,c.useEffect)(()=>{B()},[B,C]);let D=(0,c.useCallback)(()=>{t.current?.abort(),s.current=null,y.current=!1,x(null),aB(null),r.current=[],m([]),o("idle")},[]),E=(0,c.useCallback)(a=>{t.current?.abort(),s.current=a,y.current=!0,x(a),aB(a),r.current=[],m([]),o("idle"),C(a)},[C]),F=(0,c.useCallback)(a=>{v([]),w===a&&D()},[w,D]),G=(0,c.useCallback)(async()=>{g(!0);try{await A(),e(!0)}finally{g(!1)}},[A]),H=(0,c.useCallback)(()=>{e(!1),t.current?.abort()},[]),I=(0,c.useCallback)(()=>{d||f?H():G()},[d,f,H,G]);(0,c.useEffect)(()=>{let a=a=>{(a.metaKey||a.ctrlKey)&&"l"===a.key&&(a.preventDefault(),I())};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[I]);let J=(0,c.useCallback)(async(a,b)=>{if(!a.trim()&&!b?.attachmentFilenames?.length)return;t.current?.abort();let c=new AbortController;t.current=c;let d=0!==r.current.length||y.current?null:a,e=aD();if(r.current=[...r.current,{id:aD(),role:"user",content:a,attachmentFilenames:b?.attachmentFilenames?.length?b.attachmentFilenames:void 0},{id:e,role:"thinking",content:"",isStreaming:!0}],z(),b?.attachmentFilenames?.length&&s.current){let a=r.current.filter(a=>"user"===a.role).length-1;aF(s.current,a,b.attachmentFilenames)}o("connecting");let f=null;try{let g=await fetch("/api/internal/assistant/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:a,sessionId:s.current,attachmentFilenames:b?.attachmentFilenames??[]}),signal:c.signal});if(!g.ok||!g.body)throw Error(`HTTP ${g.status}`);o("streaming");let h=g.body.getReader(),i=new TextDecoder,j="";for(;;){let{done:a,value:c}=await h.read();if(a)break;let g=(j+=i.decode(c,{stream:!0})).split("\n");for(let a of(j=g.pop()??"",g)){let c;if(a.startsWith("data: ")){try{c=JSON.parse(a.slice(6).trim())}catch{continue}if(c.sessionId){let a=s.current;if(s.current=c.sessionId,d&&!y.current&&c.sessionId!==a){y.current=!0;new Date().toISOString();c.sessionId,function(a){let b=a.trim();b&&b.length>30&&b.slice(0,30)}(d),v([]),x(c.sessionId),aB(c.sessionId),b?.attachmentFilenames?.length&&aF(c.sessionId,0,b.attachmentFilenames)}}switch(c.type){case"text_delta":{let a=r.current.filter(a=>a.id!==e);f?r.current=a.map(a=>a.id===f?{...a,content:a.content+(c.content??""),isStreaming:!0}:a):(f=aD(),r.current=[...a,{id:f,role:"assistant",content:c.content??"",isStreaming:!0}]),z();break}case"text":{let a=r.current.filter(a=>a.id!==e);f?r.current=a.map(a=>a.id===f?{...a,content:c.content??a.content,isStreaming:!0}:a):(f=aD(),r.current=[...a,{id:f,role:"assistant",content:c.content??"",isStreaming:!0}]),z();break}case"tool_start":{let a=r.current.filter(a=>a.id!==e);f?(r.current=a.map(a=>a.id===f?{...a,isStreaming:!1}:a),f=null):r.current=a,r.current=[...r.current,{id:aD(),role:"tool",content:`Calling ${c.content??"tool"}...`,toolName:c.content,isStreaming:!0}],z();break}case"tool_use":{let a=r.current.filter(a=>a.id!==e),b=f?a.map(a=>a.id===f?{...a,isStreaming:!1}:a):a;f=null,r.current=[...b,{id:aD(),role:"tool",content:JSON.stringify(c.toolInput??{},null,2),toolName:c.content}],z();break}case"tool_result":r.current=[...r.current,{id:aD(),role:"tool",content:String(c.toolOutput??""),toolName:`${c.content??"tool"} (result)`}],z();break;case"error":r.current=[...r.current.filter(a=>a.id!==e),{id:aD(),role:"assistant",content:`Error: ${c.content??"Unknown error"}`}],z(),o("error");break;case"done":f&&(r.current=r.current.map(a=>a.id===f?{...a,isStreaming:!1}:a)),r.current=r.current.filter(a=>a.id!==e),z(),o("idle")}}}}r.current=r.current.filter(a=>a.id!==e),z(),o(a=>"streaming"===a?"idle":a),B()}catch(a){if("AbortError"===a.name)return;r.current=[...r.current.filter(a=>a.id!==e),{id:aD(),role:"assistant",content:`Connection error: ${a.message??"Unknown error"}`}],z(),o("error")}},[z,B]),K=(0,c.useCallback)(()=>{t.current?.abort(),t.current=null;let a=[...r.current].reverse().find(a=>"user"===a.role),b=a?.content??null;if(a){let b=r.current.lastIndexOf(a);r.current=r.current.slice(0,b),m([...r.current])}return o("idle"),b},[]),L=l[l.length-1],M="connecting"===n||"streaming"===n||L?.role==="thinking"&&!0===L.isStreaming;return(0,b.jsx)(aC.Provider,{value:{isOpen:d,isStarting:f,displayMode:h,worktreePath:j,toggleAssistant:I,closeAssistant:H,chatMessages:l,chatStatus:n,isChatThinking:M,isLoadingHistory:p,sendChatMessage:J,cancelChat:K,sessions:u,activeSessionId:w,createNewSession:D,switchSession:E,removeSession:F,refreshSessions:B},children:a})}function aH(){let a=(0,c.useContext)(aC);if(!a)throw Error("useAssistant must be used within an AssistantProvider");return a}var aI=a.i(704494),aJ=a.i(668116),aK=a.i(616335),aL=a.i(394259),aM=a.i(487410),aN=a.i(429246);function aO(a){return a.replace(/\.git\/?$/,"")}a.i(446786),a.i(814747);let aP=(0,w.createServerReference)("405b08c9a95f0708154a6bde2634cdb01ef6237cac",w.callServer,void 0,w.findSourceMapURL,"resolveGitLocalPath");var aQ=a.i(476387),aR=a.i(43775);function aS({open:a,onOpenChange:d,onCreateProject:e}){let{t:f,locale:g}=(0,E.useI18n)(),[h,i]=(0,c.useState)(""),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[o,p]=(0,c.useState)(""),[q,r]=(0,c.useState)(""),[w,x]=(0,c.useState)(!1),[y,z]=(0,c.useState)("FRONTEND"),[A,B]=(0,c.useState)("idle"),[C,D]=(0,c.useState)(""),[G,H]=(0,c.useState)(!1),[I,J]=(0,c.useState)(!1),K=()=>{i(""),k(""),m(""),p(""),r(""),x(!1),z("FRONTEND"),B("idle"),D(""),H(!1)},L=async()=>{if(q.trim()&&!G&&"success"===A){H(!0);try{let a=await (0,aQ.analyzeProjectDirectory)(q.trim(),g);m(a)}catch{F.toast.error(f("project.analyzeError"))}finally{H(!1)}}},M=async a=>{p(a),B("idle"),D("");let b=function(a){let b,c=a.match(/^git@([^:]+):(.+)$/);if(c)return{host:c[1],pathSegments:aO(c[2]).split("/").filter(Boolean)};try{b=new URL(a)}catch{return null}return{host:b.hostname,pathSegments:aO(decodeURIComponent(b.pathname)).split("/").filter(Boolean)}}(a);b&&b.pathSegments.length>0&&i(b.pathSegments[b.pathSegments.length-1]),w||r(await aP(a))},N=async()=>{if(o.trim()&&q.trim()){B("cloning"),D("");try{let a=function(a){let b=a.trim();if(!b)return"";if(b.startsWith("git@")||b.startsWith("ssh://")||b.endsWith(".git"))return b;try{let a=new URL(b),c=a.hostname,d=decodeURIComponent(a.pathname).split("/").filter(Boolean);if("code.iflytek.com"===c){let a=[...d];"osc"===a[0]&&"_source"===a[1]&&(a=a.slice(2));let e=a.indexOf("-");if(e>0&&(a=a.slice(0,e)),0===a.length)return b;return`https://${c}/${a.join("/")}.git`}return`${a.origin}${a.pathname.replace(/\/$/,"")}.git`}catch{return b}}(o.trim()),b=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clone",url:a,path:q.trim()})}),c=await b.json();if(!b.ok){B("error"),D(c.error||"Clone failed");return}B("success")}catch{B("error"),D("Network error")}}},O=async()=>{h.trim()&&(await e?.({name:h.trim(),alias:j.trim()||void 0,description:l.trim()||void 0,gitUrl:o.trim()||void 0,localPath:q.trim()||void 0,projectType:y}),K(),d(!1))};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(s.Dialog,{open:a,onOpenChange:a=>{d(a),a||K()},disablePointerDismissal:!0,children:(0,b.jsxs)(s.DialogContent,{style:{maxWidth:"32rem"},children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:f("topbar.newProject")})}),(0,b.jsxs)("div",{className:"space-y-4 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.gitUrl")}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:f("project.gitUrlHint")}),(0,b.jsx)(v.Input,{placeholder:f("project.gitPlaceholder"),value:o,onChange:a=>M(a.target.value),className:"mt-1.5 font-mono text-xs"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:f("project.localPathHint")}),(0,b.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,b.jsx)(v.Input,{placeholder:f("project.localPathPlaceholder"),value:q,onChange:a=>{r(a.target.value),x(!0)},className:"flex-1 min-w-0 font-mono text-xs"}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsxs)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{type:"button",variant:"outline",onClick:()=>J(!0),className:"shrink-0 gap-1.5 px-2.5 text-xs text-muted-foreground"}),children:[(0,b.jsx)(n.FolderOpen,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{children:f("folder.browse")})]}),(0,b.jsx)(t.TooltipContent,{children:f("folder.selectFolder")})]})]}),q.trim().startsWith("~")&&(0,b.jsxs)("p",{className:"mt-1 flex items-center gap-1 text-[11px] text-amber-400",children:[(0,b.jsx)(aK.AlertCircle,{className:"h-3 w-3"}),f("project.tildeWarning")]}),o.trim()&&q.trim()&&(0,b.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,b.jsxs)(u.Button,{type:"button",disabled:"cloning"===A||"success"===A,onClick:N,className:"gap-1.5 text-xs bg-emerald-500/15 text-emerald-300 ring-1 ring-emerald-500/25 hover:bg-emerald-500/25 disabled:opacity-50",children:["cloning"===A?(0,b.jsx)(aI.Loader2,{className:"h-3 w-3 animate-spin"}):"success"===A?(0,b.jsx)(aJ.Check,{className:"h-3 w-3"}):(0,b.jsx)(aq.GitBranch,{className:"h-3 w-3"}),"cloning"===A?f("git.cloning"):"success"===A?f("git.cloned"):f("git.clone")]}),"error"===A&&(0,b.jsxs)("span",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,b.jsx)(aK.AlertCircle,{className:"h-3 w-3"}),C]}),"success"===A&&(0,b.jsx)("span",{className:"text-[11px] text-emerald-400",children:f("git.cloneSuccess")})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(v.Input,{placeholder:f("project.namePlaceholder"),value:h,onChange:a=>i(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)(aM.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:y,onChange:z})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(v.Input,{placeholder:f("project.aliasPlaceholder"),value:j,onChange:a=>k(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mt-0.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsxs)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{type:"button",variant:"ghost",onClick:L,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!q.trim()||G?"opacity-50":""}`}),children:[G?(0,b.jsx)(aI.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aL.Sparkles,{className:"h-3 w-3"}),G?f("project.analyzing"):f("project.genDesc")]}),(0,b.jsx)(t.TooltipContent,{children:q.trim()?"success"!==A?f("project.genDescNotCloned"):f("project.genDescReady"):f("project.genDescNoPath")})]})]}),(0,b.jsx)(aN.Textarea,{placeholder:f("project.descPlaceholder"),value:l,onChange:a=>m(a.target.value),rows:3,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)(s.DialogFooter,{children:[(0,b.jsx)(u.Button,{variant:"outline",onClick:()=>{d(!1),K()},children:f("common.cancel")}),(0,b.jsx)(u.Button,{onClick:O,disabled:!h.trim()||G,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:f("common.create")})]})]})}),(0,b.jsx)(aR.FolderBrowserDialog,{open:I,onOpenChange:J,onSelect:a=>{if(r(a),x(!0),!h.trim()){let b=a.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean).pop()??"";b&&i(b)}}})]})}var aT=a.i(976268),aT=aT,aU=a.i(563658);let aV=(0,w.createServerReference)("6059f58c02ee38eb52f94082487474f7965884c1de",w.callServer,void 0,w.findSourceMapURL,"migrateProjectPath"),aW=(0,w.createServerReference)("4039977d4a89dd7ca12f4f55dbe5a90f732a785491",w.callServer,void 0,w.findSourceMapURL,"checkMigrationSafety");function aX({open:a,onOpenChange:d,onCreateProject:e}){let{t:f,locale:g}=(0,E.useI18n)(),[h,i]=(0,c.useState)(""),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[o,p]=(0,c.useState)(""),[q,r]=(0,c.useState)(""),[w,x]=(0,c.useState)(!1),[y,z]=(0,c.useState)("FRONTEND"),[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(!1),[G,H]=(0,c.useState)(""),[I,J]=(0,c.useState)(!1),[K,L]=(0,c.useState)(""),[M,N]=(0,c.useState)(""),[O,P]=(0,c.useState)(!1),[Q,R]=(0,c.useState)(!1),S=()=>{i(""),k(""),m(""),p(""),r(""),z("FRONTEND"),B(!1),D(!1),H(""),J(!1),L(""),N(""),P(!1),R(!1)},T=async a=>{r(a),B(!1),D(!1),H(""),L(""),N(""),P(!1),i(a.split("/").filter(Boolean).pop()??"");try{let b=await fetch(`/api/git?path=${encodeURIComponent(a)}`);if(b.ok){let a=await b.json();if(a.isGit&&a.remoteUrl){p(a.remoteUrl),B(!0);let b=a.remoteUrl.match(/\/([^/]+?)(?:\.git)?$/);b&&i(b[1])}}}catch{}},U=(0,c.useCallback)(async a=>{if(D(a),L(""),N(""),P(!1),!a)return void H("");if(o)try{let a=await aP(o);a&&(H(a),a===q&&P(!0))}catch{}if(q)try{let a=await fetch(`/api/git?path=${encodeURIComponent(q)}&checkWorktrees=true`);a.ok&&(await a.json()).hasWorktrees&&N(f("project.worktreeWarning"))}catch{}},[o,q]),V=async()=>{if(q&&!Q){R(!0);try{let a=await (0,aQ.analyzeProjectDirectory)(q.trim(),g);m(a)}catch{F.toast.error(f("project.analyzeError"))}finally{R(!1)}}},W=async()=>{if(!h.trim())return;let a={name:h.trim(),alias:j.trim()||void 0,description:l.trim()||void 0,gitUrl:o.trim()||void 0,localPath:q.trim()||void 0,projectType:y},b=await e?.(a);if(C&&G&&G!==q&&b&&"id"in b){J(!0),L("");try{let a=await aW(b.id);if(!a.safe)return void L(a.reason);let c=await aV(b.id,G);if(!c.success)return void L(c.error??f("project.migrateError"));F.toast.success(f("project.migrateSuccess"))}catch(b){let a=b instanceof Error?b.message:String(b);L(`${f("project.migrateError")}:${a}`);return}finally{J(!1)}}S(),d(!1)},X=!h.trim()||!q.trim()||I||Q||C&&!!M;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(s.Dialog,{open:a,onOpenChange:a=>{d(a),a||S()},disablePointerDismissal:!0,children:(0,b.jsxs)(s.DialogContent,{style:{maxWidth:"32rem"},children:[(0,b.jsx)(s.DialogHeader,{children:(0,b.jsx)(s.DialogTitle,{children:f("topbar.importProject")})}),(0,b.jsxs)("div",{className:"space-y-4 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)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:f("project.importHint")}),(0,b.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,b.jsx)(v.Input,{value:q,readOnly:!0,placeholder:f("project.localPathPlaceholder"),className:"flex-1 font-mono text-xs bg-muted/30"}),(0,b.jsxs)(u.Button,{type:"button",variant:"outline",onClick:()=>x(!0),className:"shrink-0 gap-1.5",children:[(0,b.jsx)(n.FolderOpen,{className:"h-3.5 w-3.5"}),f("folder.browse")]})]}),A&&(0,b.jsx)("p",{className:"mt-1.5 text-[11px] text-emerald-400",children:f("project.autoDetected")})]}),o&&(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.gitUrl")}),(0,b.jsx)(v.Input,{value:o,onChange:a=>p(a.target.value),className:"mt-1.5 font-mono text-xs"})]}),A&&q&&(0,b.jsxs)("div",{className:"rounded-md border border-border p-3 space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-xs font-medium",children:f("project.migrate")}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:f("project.migrateHint")})]}),(0,b.jsx)(aU.Switch,{checked:C,onCheckedChange:a=>U(a)})]}),C&&(0,b.jsxs)("div",{className:"space-y-2 pt-1",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-[10px] font-medium text-muted-foreground",children:f("project.targetPath")}),(0,b.jsx)(v.Input,{value:G,onChange:a=>{H(a.target.value),P(a.target.value===q)},placeholder:"/path/to/canonical/location",className:"mt-1 font-mono text-xs"})]}),O&&(0,b.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-sky-400",children:[(0,b.jsx)(aT.default,{className:"h-3 w-3"}),f("project.samePathInfo")]}),M&&(0,b.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-amber-400",children:[(0,b.jsx)(aK.AlertCircle,{className:"h-3 w-3"}),M]}),K&&(0,b.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,b.jsx)(aK.AlertCircle,{className:"h-3 w-3"}),K]})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(v.Input,{placeholder:f("project.namePlaceholder"),value:h,onChange:a=>i(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)(aM.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:y,onChange:z})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(v.Input,{placeholder:f("project.aliasPlaceholder"),value:j,onChange:a=>k(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mt-0.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsxs)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{type:"button",variant:"ghost",onClick:V,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!q||Q?"opacity-50":""}`}),children:[Q?(0,b.jsx)(aI.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aL.Sparkles,{className:"h-3 w-3"}),Q?f("project.analyzing"):f("project.genDesc")]}),(0,b.jsx)(t.TooltipContent,{children:q?f("project.genDescReady"):f("project.genDescNoPath")})]})]}),(0,b.jsx)(aN.Textarea,{placeholder:f("project.descPlaceholder"),value:l,onChange:a=>m(a.target.value),rows:3,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)(s.DialogFooter,{children:[(0,b.jsx)(u.Button,{variant:"outline",onClick:()=>{d(!1),S()},children:f("common.cancel")}),(0,b.jsx)(u.Button,{onClick:W,disabled:X,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:I?f("project.migrating"):f("common.create")})]})]})}),(0,b.jsx)(aR.FolderBrowserDialog,{open:w,onOpenChange:x,onSelect:a=>T(a)})]})}function aY({className:a}){return(0,b.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:a,children:(0,b.jsx)("path",{d:"M12 .5C5.65.5.5 5.65.5 12.02c0 5.08 3.29 9.39 7.86 10.91.58.11.79-.25.79-.56v-2c-3.2.7-3.87-1.36-3.87-1.36-.52-1.34-1.27-1.7-1.27-1.7-1.04-.71.08-.7.08-.7 1.15.08 1.76 1.18 1.76 1.18 1.02 1.76 2.68 1.25 3.34.96.1-.74.4-1.25.72-1.54-2.56-.29-5.25-1.28-5.25-5.69 0-1.26.45-2.28 1.18-3.09-.12-.29-.51-1.46.11-3.04 0 0 .97-.31 3.18 1.18a11.1 11.1 0 0 1 5.79 0c2.2-1.49 3.18-1.18 3.18-1.18.62 1.58.23 2.75.11 3.04.74.81 1.18 1.83 1.18 3.09 0 4.42-2.69 5.4-5.25 5.69.41.36.78 1.05.78 2.12v3.14c0 .31.21.68.79.56A11.52 11.52 0 0 0 23.5 12.02C23.5 5.65 18.35.5 12 .5Z"})})}function aZ({onCreateProject:a,username:e}){let{t:f,locale:h,setLocale:i}=(0,E.useI18n)(),{isOpen:j,toggleAssistant:k}=aH(),{resolvedTheme:l,toggleTheme:m,triggerRef:o}=function(){let{resolvedTheme:a,setTheme:b}=(0,P.useTheme)(),d=(0,c.useRef)(null),e=(0,c.useCallback)(c=>{let d="dark"===a?"light":"dark";if("u">typeof document&&"startViewTransition"in document&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){let a=c?.clientX??window.innerWidth/2,e=c?.clientY??0,f=Math.hypot(Math.max(a,window.innerWidth-a),Math.max(e,window.innerHeight-e));document.startViewTransition(()=>{b(d)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${a}px ${e}px)`,`circle(${f}px at ${a}px ${e}px)`]},{duration:400,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})}else b(d)},[a,b]);return{resolvedTheme:a,toggleTheme:e,triggerRef:d}}(),p=(0,d.useRouter)(),[r,s]=(0,c.useState)(!1),[v,w]=(0,c.useState)(!1),[x,y]=(0,c.useState)(!1);return(0,c.useEffect)(()=>{let a=a=>{(a.metaKey||a.ctrlKey)&&"k"===a.key&&(a.preventDefault(),s(!0))};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("header",{className:"flex h-12 items-center justify-between border-b border-border bg-background/80 px-5 backdrop-blur-sm",children:[(0,b.jsx)("div",{className:"w-40"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsxs)(u.Button,{variant:"outline",onClick:()=>s(!0),className:"h-8 w-[400px] justify-start gap-2 bg-muted/50 text-muted-foreground hover:bg-muted",children:[(0,b.jsx)(Q.Search,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"flex-1 text-left",suppressHydrationWarning:!0,children:f("topbar.searchPlaceholder")}),(0,b.jsxs)("kbd",{className:"mr-1 flex items-center gap-0.5 rounded border border-border bg-background px-1.5 py-0.5 text-[10px] font-mono",children:[(0,b.jsx)(S,{className:"h-2.5 w-2.5"}),"K"]})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{delay:500,render:(0,b.jsx)("button",{"data-tour":"open-assistant",onClick:k,"aria-label":f("assistant.iconLabel"),className:["cursor-pointer rounded-lg p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",j?"bg-accent text-foreground":""].join(" ")}),children:(0,b.jsx)(U,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{children:f("assistant.iconLabel")})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsxs)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{variant:"ghost",onClick:()=>i("zh"===h?"en":"zh"),className:"text-muted-foreground"}),children:[(0,b.jsx)(T.Globe,{className:"h-3.5 w-3.5"}),(0,b.jsx)("span",{className:"text-[11px] font-semibold",children:"zh"===h?"EN":"中"})]}),(0,b.jsx)(t.TooltipContent,{children:f("settings.language")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{ref:o,variant:"ghost",size:"icon",onClick:m,className:"text-muted-foreground"}),children:"dark"===l?(0,b.jsx)(V.Sun,{className:"h-4 w-4"}):(0,b.jsx)(W.Moon,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{children:f("settings.theme")})]}),(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",onClick:()=>window.open("https://github.com/jp-liu/tower","_blank","noopener,noreferrer"),className:"text-muted-foreground","aria-label":f("topbar.github")}),children:(0,b.jsx)(aY,{className:"h-4 w-4"})}),(0,b.jsx)(t.TooltipContent,{children:f("topbar.github")})]}),(0,b.jsx)("div",{className:"h-4 w-px bg-border"}),(0,b.jsxs)(u.Button,{variant:"outline",className:"gap-1.5 ring-1 ring-border hover:bg-accent",onClick:()=>y(!0),children:[(0,b.jsx)(n.FolderOpen,{className:"h-3.5 w-3.5"}),f("topbar.importProject")]}),(0,b.jsxs)(u.Button,{"data-tour":"create-project",className:"gap-1.5 bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",onClick:()=>w(!0),children:[(0,b.jsx)(g.Plus,{className:"h-3.5 w-3.5"}),f("topbar.newProject")]}),(0,b.jsxs)(q.DropdownMenu,{children:[(0,b.jsx)(q.DropdownMenuTrigger,{render:(0,b.jsxs)("button",{className:"ml-0.5 flex cursor-pointer items-center gap-1.5 rounded-lg px-2.5 py-1 transition-colors hover:bg-accent",children:[e&&(0,b.jsx)("span",{className:"max-w-[80px] truncate text-xs text-muted-foreground",children:e}),(0,b.jsx)(an,{className:"h-7 w-7 ring-1 ring-border",children:(0,b.jsx)(ao,{className:"bg-emerald-500/20 text-emerald-400 text-[10px] font-semibold",children:e?e.trim().split(/\s+/).filter(a=>a.length>0).slice(0,2).map(a=>a[0].toUpperCase()).join(""):"U"})})]})}),(0,b.jsx)(q.DropdownMenuContent,{align:"end",sideOffset:8,className:"w-40",children:(0,b.jsxs)(q.DropdownMenuItem,{onClick:()=>p.push("/settings"),children:[(0,b.jsx)(R.Settings,{className:"mr-2 h-3.5 w-3.5"}),f("settings.title")]})})]})]})]}),(0,b.jsx)(aA,{open:r,onOpenChange:s}),(0,b.jsx)(aS,{open:v,onOpenChange:w,onCreateProject:a}),(0,b.jsx)(aX,{open:x,onOpenChange:y,onCreateProject:a})]})}var a$=a.i(347872),a_=a.i(595999),a0=a.i(813845),a1=a.i(969032),a2=a.i(442620);let a3=(0,a1.default)(async()=>{},{loadableGenerated:{modules:[103363]},ssr:!1});function a4({mode:a}){let{isOpen:c,closeAssistant:d,sessions:e,activeSessionId:f,createNewSession:h,switchSession:j,removeSession:k}=aH(),{t:l}=(0,E.useI18n)(),m=e.find(a=>a.id===f),n=m?.title??l("assistant.newSession");return(0,b.jsxs)("div",{className:"sidebar"===a?"min-w-[320px] max-w-[480px] w-[30vw] shrink-0 border-r border-border flex flex-col bg-sidebar overflow-hidden":"flex flex-col h-full overflow-hidden",children:[(0,b.jsxs)("div",{className:"header-sm flex items-center px-4 gap-2 bg-sidebar",children:[(0,b.jsx)(U,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"text-sm font-semibold text-foreground shrink-0",children:l("assistant.title")}),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"flex-1"}),(0,b.jsxs)(q.DropdownMenu,{children:[(0,b.jsxs)(q.DropdownMenuTrigger,{className:"flex items-center gap-1 h-8 px-2 rounded-md text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground max-w-[120px] truncate","aria-label":l("assistant.sessionList"),children:[(0,b.jsx)("span",{className:"truncate",children:n}),(0,b.jsx)(a2.ChevronDown,{className:"h-3 w-3 shrink-0"})]}),(0,b.jsxs)(q.DropdownMenuContent,{side:"bottom",align:"end",sideOffset:4,children:[0===e.length?(0,b.jsx)("div",{className:"px-2 py-4 text-xs text-muted-foreground text-center",children:l("assistant.noSessions")}):e.map(a=>(0,b.jsxs)(q.DropdownMenuItem,{className:"flex items-center justify-between gap-2 pr-1",onClick:()=>j(a.id),children:[(0,b.jsxs)("div",{className:"flex flex-col gap-0.5 min-w-0",children:[(0,b.jsx)("span",{className:"text-xs truncate max-w-[140px]",children:a.title}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(a){let b=Math.floor((Date.now()-new Date(a).getTime())/1e3);if(b<60)return`${b}s ago`;let c=Math.floor(b/60);if(c<60)return`${c}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);return`${e}d ago`}(a.updatedAt)})]}),(0,b.jsx)(u.Button,{variant:"ghost",className:"h-6 w-6 p-0 shrink-0 opacity-50 hover:opacity-100 hover:text-destructive",onClick:b=>{b.stopPropagation(),k(a.id)},"aria-label":l("assistant.deleteSession"),children:(0,b.jsx)(i.Trash2,{className:"h-3 w-3"})})]},a.id)),e.length>0&&(0,b.jsx)(q.DropdownMenuSeparator,{}),(0,b.jsxs)(q.DropdownMenuItem,{onClick:h,children:[(0,b.jsx)(g.Plus,{className:"h-3 w-3 mr-1"}),(0,b.jsx)("span",{className:"text-xs",children:l("assistant.newSession")})]})]})]}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:h,"aria-label":l("assistant.newSession"),children:(0,b.jsx)(g.Plus,{className:"h-4 w-4"})})]}),(0,b.jsx)(u.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:d,"aria-label":l("assistant.closeLabel"),children:(0,b.jsx)(at.X,{className:"h-4 w-4"})})]}),(0,b.jsx)("div",{className:"flex-1 overflow-hidden",children:c?(0,b.jsx)(a3,{}):null})]})}var a5=a.i(190076);function a6({onDismiss:a}){let{t:d}=(0,E.useI18n)(),[e,f]=(0,c.useState)(!1);(0,c.useEffect)(()=>{},[]);let g=async()=>{"default"!==await window.Notification.requestPermission()&&(f(!1),a?.())};return e?(0,b.jsxs)("div",{className:"fixed top-3 left-1/2 -translate-x-1/2 z-[9999] w-auto max-w-lg bg-card border rounded-lg shadow-lg px-4 py-2.5 flex items-center gap-3 animate-in fade-in slide-in-from-top-4 duration-500",children:[(0,b.jsx)(a5.Bell,{className:"h-4 w-4 shrink-0 text-primary"}),(0,b.jsx)("span",{className:"flex-1 text-sm",children:d("notification.permissionPrompt")}),(0,b.jsx)(u.Button,{size:"default",onClick:g,children:d("notification.allow")}),(0,b.jsx)(u.Button,{variant:"ghost",size:"default",onClick:()=>{f(!1),a?.()},children:d("notification.dismiss")})]}):null}a.i(190065);var a7=a.i(353092);let a8=[{target:"create-workspace",titleKey:"tour.step1.title",descKey:"tour.step1.desc",placement:"right"},{target:"create-project",titleKey:"tour.step2.title",descKey:"tour.step2.desc",placement:"bottom",waitForTarget:!0},{target:"open-assistant",titleKey:"tour.step3.title",descKey:"tour.step3.desc",placement:"bottom"}];function a9({onComplete:a}){let{t:d}=(0,E.useI18n)(),[e,f]=(0,c.useState)(0),[g,h]=(0,c.useState)(null),[i,j]=(0,c.useState)(!1),k=(0,c.useRef)(null),l=a8[e],m=(0,c.useCallback)(async()=>{await (0,a7.setConfigValue)("onboarding.tourCompleted",!0),a()},[a]),n=(0,c.useCallback)(()=>l?document.querySelector(`[data-tour="${l.target}"]`):null,[l]),o=(0,c.useCallback)(()=>{let a=n();a?(h(a.getBoundingClientRect()),j(!0)):j(!1)},[n]);(0,c.useEffect)(()=>{o();let a=null;!i&&l?.waitForTarget&&(k.current=new MutationObserver(()=>{let b=n();b&&(h(b.getBoundingClientRect()),j(!0),k.current?.disconnect(),a&&clearTimeout(a))}),k.current.observe(document.body,{childList:!0,subtree:!0}),a=setTimeout(()=>{!n()&&(f(a=>{let b=a+1;return b<a8.length?b:a}),e>=a8.length-1&&m())},5e3));let b=()=>o();return window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),()=>{k.current?.disconnect(),a&&clearTimeout(a),window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}},[e,l,n,o,i,m]),(0,c.useEffect)(()=>{let a=setInterval(o,1e3);return()=>clearInterval(a)},[o]);let p=(0,c.useCallback)(()=>{e<a8.length-1?(f(a=>a+1),j(!1)):m()},[e]);return l?(0,b.jsx)(b.Fragment,{children:i&&g&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"fixed inset-0 z-[10000]",style:{background:`radial-gradient(
2
2
  ellipse at ${g.left+g.width/2}px ${g.top+g.height/2}px,
3
3
  transparent ${Math.max(g.width,g.height)}px,
4
4
  rgba(0,0,0,0.6) ${Math.max(g.width,g.height)+30}px
@@ -0,0 +1,3 @@
1
+ module.exports=[10390,a=>{"use strict";var b=a.i(421992);a.s(["ChevronRight",()=>b.default])},747798,a=>{"use strict";let b=(0,a.i(711796).default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);a.s(["RotateCcw",0,b],747798)},579834,a=>{"use strict";var b=a.i(728778),c=a.i(368114);a.s(["EmptyState",0,function({icon:a,title:d,description:e,action:f,className:g}){return(0,b.jsxs)("div",{className:(0,c.cn)("flex h-48 flex-col items-center justify-center gap-2 text-center",g),children:[a&&(0,b.jsx)(a,{className:"h-10 w-10 text-muted-foreground/40"}),(0,b.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:d}),e&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60",children:e}),f&&(0,b.jsx)("div",{className:"mt-2",children:f})]})}])},509405,a=>{"use strict";let b=(0,a.i(711796).default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);a.s(["Eye",0,b],509405)},324954,a=>{"use strict";let b=(0,a.i(711796).default)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);a.s(["Upload",0,b],324954)},912868,a=>{"use strict";let b=(0,a.i(711796).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);a.s(["ChevronLeft",0,b],912868)},757942,950314,a=>{"use strict";var b=a.i(90393);a.s([],757942),a.s(["Streamdown",()=>b.C],950314)},613863,a=>{"use strict";var b=a.i(780410);let c=(0,b.createServerReference)("4096c293684f07ba7d35b743e71fcb8360d45f019a",b.callServer,void 0,b.findSourceMapURL,"deleteAsset");a.s(["deleteAsset",0,c])},161181,a=>{"use strict";let b=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif","apng"]);a.s(["isImageAsset",0,function(a,c){if(c?.startsWith("image/"))return!0;let d=a.split(".").pop()?.toLowerCase();return!!d&&b.has(d)},"localPathToApiUrl",0,function(a){let b=a.replace(/\\/g,"/").match(/\/assets\/([^/]+)\/([^/]+)$/);return b?`/api/files/assets/${b[1]}/${b[2]}`:a}])},524526,a=>{"use strict";var b=a.i(780410);let c=(0,b.createServerReference)("4024668e147009115a8a82cb8f99d906f8cb5a0ac3",b.callServer,void 0,b.findSourceMapURL,"uploadAsset");a.s(["uploadAsset",0,c])},532615,894148,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(986099),e=a.i(54384),f=a.i(912868),g=a.i(10390),h=a.i(91756);let i=(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 j=a.i(747798),k=a.i(951192);function l({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.s(["ImageLightbox",0,function({imageUrl:a,filename:m,open:n,onOpenChange:o,assets:p,currentIndex:q,onIndexChange:r}){let{t:s}=(0,k.useI18n)(),[t,u]=(0,c.useState)(1),[v,w]=(0,c.useState)({x:0,y:0}),[x,y]=(0,c.useState)(!1),z=(0,c.useRef)(null),[A,B]=(0,c.useState)(!1),C=!!p&&p.length>1&&"number"==typeof q&&!!r,D=C&&q>0,E=C&&q<p.length-1,F=C?p.length:0,G=F>0?Math.ceil(F/10):0,H=C?Math.floor(q/10):0,I=10*H,J=Math.min(I+10,F),K=G>1,L=C&&H>0,M=C&&H<G-1;(0,c.useEffect)(()=>{B(!0)},[]),(0,c.useEffect)(()=>{u(1),w({x:0,y:0})},[a]),(0,c.useEffect)(()=>{if(!n)return;let a=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=a}},[n]);let N=(0,c.useCallback)(()=>o(!1),[o]),O=(0,c.useCallback)(()=>{C&&D&&r(q-1)},[C,D,r,q]),P=(0,c.useCallback)(()=>{C&&E&&r(q+1)},[C,E,r,q]),Q=(0,c.useCallback)(()=>{C&&L&&r((H-1)*10)},[C,L,r,H]),R=(0,c.useCallback)(()=>{C&&M&&r(Math.min((H+1)*10,F-1))},[C,M,r,H,F]),S=(0,c.useCallback)(()=>{u(a=>Math.min(8,1.25*a))},[]),T=(0,c.useCallback)(()=>{u(a=>{let b=Math.max(.1,a/1.25);return b<=1&&w({x:0,y:0}),b})},[]),U=(0,c.useCallback)(()=>{u(1),w({x:0,y:0})},[]);(0,c.useEffect)(()=>{if(!n)return;let a=a=>{switch(a.key){case"Escape":a.preventDefault(),N();break;case"ArrowLeft":C&&(a.preventDefault(),O());break;case"ArrowRight":C&&(a.preventDefault(),P());break;case"+":case"=":a.preventDefault(),S();break;case"-":case"_":a.preventDefault(),T();break;case"0":a.preventDefault(),U()}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[n,C,N,O,P,S,T,U]);let V=(0,c.useRef)(!1),W=()=>{x&&y(!1),z.current=null},X=x?"cursor-grabbing":"cursor-grab";if(!n||!A)return null;let Y=(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":s("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:[m,C?` \xb7 ${q+1} / ${p.length}`:""]}),(0,b.jsx)("div",{className:`absolute inset-0 flex items-center justify-center overflow-hidden select-none ${X}`,onClick:a=>{a.target===a.currentTarget&&N()},onWheel:a=>{a.preventDefault();let b=-a.deltaY>0?1.25:.8;u(a=>{let c=Math.min(8,Math.max(.1,a*b));return c<=1&&w({x:0,y:0}),c})},children:a&&(0,b.jsx)("img",{src:a,alt:m,onClick:a=>{a.stopPropagation(),V.current&&(V.current=!1)},onPointerDown:a=>{0===a.button&&(a.stopPropagation(),V.current=!1,a.target.setPointerCapture?.(a.pointerId),z.current={x:a.clientX,y:a.clientY,panX:v.x,panY:v.y},y(!0))},onPointerMove:a=>{if(!z.current)return;let b=a.clientX-z.current.x,c=a.clientY-z.current.y;Math.abs(b)+Math.abs(c)>5&&(V.current=!0),x&&w({x:z.current.panX+b,y:z.current.panY+c})},onPointerUp:W,onPointerLeave:W,onPointerCancel:W,className:"max-h-[88vh] max-w-[92vw] object-contain pointer-events-auto",style:{transform:`translate3d(${v.x}px, ${v.y}px, 0) scale(${t})`,transformOrigin:"center center",transition:x?"none":"transform 120ms ease-out",willChange:x?"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:[C&&(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:[K&&(0,b.jsx)(l,{onClick:Q,title:`${s("assets.lightbox.prev")} (-10)`,"aria-label":`${s("assets.lightbox.prev")} (-10)`,disabled:!L,children:(0,b.jsx)(h.ChevronsLeft,{className:"h-4 w-4"})}),(0,b.jsx)(l,{onClick:O,title:s("assets.lightbox.prev"),"aria-label":s("assets.lightbox.prev"),disabled:!D,children:(0,b.jsx)(f.ChevronLeft,{className:"h-4 w-4"})}),(0,b.jsx)("div",{className:"flex items-center gap-1.5",children:p.slice(I,J).map((a,c)=>{let d=I+c,e=d===q;return(0,b.jsx)("button",{type:"button",onClick:a=>{a.stopPropagation(),e||r(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)(l,{onClick:P,title:s("assets.lightbox.next"),"aria-label":s("assets.lightbox.next"),disabled:!E,children:(0,b.jsx)(g.ChevronRight,{className:"h-4 w-4"})}),K&&(0,b.jsx)(l,{onClick:R,title:`${s("assets.lightbox.next")} (+10)`,"aria-label":`${s("assets.lightbox.next")} (+10)`,disabled:!M,children:(0,b.jsx)(i,{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*t),"%"]}),(0,b.jsx)(l,{onClick:U,title:s("assets.lightbox.reset"),"aria-label":s("assets.lightbox.reset"),disabled:1===t&&0===v.x&&0===v.y,children:(0,b.jsx)(j.RotateCcw,{className:"h-4 w-4"})}),(0,b.jsx)("div",{className:"mx-1 h-5 w-px bg-white/20"}),(0,b.jsx)(l,{onClick:N,title:s("assets.lightbox.close"),"aria-label":s("assets.lightbox.close"),children:(0,b.jsx)(e.X,{className:"h-4 w-4"})})]})]})]});return(0,d.createPortal)(Y,document.body)}],532615);var m=a.i(704494);a.i(757942);var n=a.i(950314),o=a.i(814574);a.s(["TextPreviewDialog",0,function({url:a,filename:d,open:e,onOpenChange:f}){let{t:g}=(0,k.useI18n)(),[h,i]=(0,c.useState)(null),[j,l]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null);(0,c.useEffect)(()=>{if(!e||!a){i(null),q(null);return}let b=!1;return l(!0),q(null),i(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||(i(a),l(!1))}).catch(a=>{b||(a instanceof Error&&"FILE_TOO_LARGE"===a.message?q(g("assets.fileTooLarge")):q(g("assets.previewError")),l(!1))}),()=>{b=!0}},[e,a,g]);let r=d.split(".").pop()?.toLowerCase();return(0,b.jsx)(o.Dialog,{open:e,onOpenChange:f,children:(0,b.jsxs)(o.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:d}),(0,b.jsx)("div",{className:"flex-1 overflow-auto px-5 py-4",children:(()=>{if(j)return(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 gap-2",children:[(0,b.jsx)(m.Loader2,{className:"size-5 animate-spin text-muted-foreground"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:g("assets.loadingPreview")})]});if(p)return(0,b.jsx)("p",{className:"text-sm text-destructive",children:p});if(null===h)return null;if("md"===r)return(0,b.jsx)("div",{className:"text-sm leading-relaxed",children:(0,b.jsx)(n.Streamdown,{children:h})});if("json"===r){let a;try{a=JSON.stringify(JSON.parse(h),null,2)}catch{a=h}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:h})})()})]})})}],894148)}];
2
+
3
+ //# sourceMappingURL=_0eqcb.s._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[283857,a=>{"use strict";let b=(0,a.i(711796).default)("lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);a.s(["Lightbulb",0,b],283857)},324263,a=>{"use strict";let b=(0,a.i(711796).default)("arrow-up-from-line",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]);a.s(["ArrowUpFromLine",0,b],324263)},7285,a=>{"use strict";async function b(a,c,d={}){let e=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:c,path:a,...d})});if(!e.ok)throw Error((await e.json()).error||`${c} failed`);return e.json()}a.s(["gitAction",0,b])},140597,694116,a=>{"use strict";let b=(0,a.i(711796).default)("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]);a.s(["default",0,b],694116),a.s(["File",0,b],140597)},771313,307373,646788,806671,114884,604456,703903,a=>{"use strict";var b=a.i(711796);let c=(0,b.default)("file-plus",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);a.s(["FilePlus",0,c],771313);let d=(0,b.default)("file-minus",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}]]);a.s(["FileMinus",0,d],307373);let e=(0,b.default)("file-question-mark",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);a.s(["FileQuestion",0,e],646788);let f=(0,b.default)("file-pen",[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]]);a.s(["FileEdit",0,f],806671);let g=(0,b.default)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);a.s(["ArrowDown",0,g],114884);let h=(0,b.default)("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);a.s(["ArrowUp",0,h],604456);let i=(0,b.default)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);a.s(["Minus",0,i],703903)},985716,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(140597),e=a.i(771313),f=a.i(307373),g=a.i(646788),h=a.i(806671),i=a.i(704494),j=a.i(114884),k=a.i(604456),l=a.i(668116),m=a.i(10390),n=a.i(442620),o=a.i(146758),p=a.i(703903),q=a.i(774881),r=a.i(336771),s=a.i(192369),t=a.i(607219),u=a.i(324263);let v=(0,a.i(711796).default)("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);var w=a.i(577565),x=a.i(573242),y=a.i(851378),z=a.i(975231),A=a.i(699570),B=a.i(335732),C=a.i(269876),D=a.i(599209),E=a.i(785259),F=a.i(814574),G=a.i(866718),H=a.i(429246),I=a.i(951192);function J({open:a,onOpenChange:d,branches:e,currentBranch:f,localPath:g,onCreated:h,onError:j}){let{t:k}=(0,I.useI18n)(),[m,o]=(0,c.useState)(""),[p,q]=(0,c.useState)(f),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(!1),[v,y]=(0,c.useState)(""),[z,B]=(0,c.useState)(!1);(0,c.useEffect)(()=>{a&&(o(""),q(f),s(""),y(""))},[a,f]);let C=[...new Set(e)].filter(a=>a.toLowerCase().includes(v.toLowerCase())),D=async()=>{if(m.trim()){u(!0);try{let a=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create-branch",path:g,branch:m.trim(),baseBranch:p})});if(a.ok)d(!1),h();else{let b=await a.json();j(b.error||"Unknown error")}}catch{j("Network error")}finally{u(!1)}}};return(0,b.jsx)(F.Dialog,{open:a,onOpenChange:d,children:(0,b.jsxs)(F.DialogContent,{className:"sm:max-w-sm",children:[(0,b.jsx)(F.DialogHeader,{children:(0,b.jsx)(F.DialogTitle,{children:k("git.createBranch")})}),(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:k("git.branchName")}),(0,b.jsx)(G.Input,{value:m,onChange:a=>o(a.target.value),placeholder:k("git.branchNamePlaceholder"),className:"mt-1.5 font-mono text-xs",onKeyDown:a=>"Enter"===a.key&&D()})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:k("git.baseBranch")}),(0,b.jsxs)("div",{className:"relative mt-1.5",children:[(0,b.jsxs)("button",{onClick:()=>B(!z),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 min-w-0 items-center gap-2",children:[(0,b.jsx)(w.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}),(0,b.jsx)("span",{className:"truncate font-mono text-xs text-foreground",title:p,children:p})]}),(0,b.jsx)(n.ChevronDown,{className:`h-3 w-3 text-muted-foreground transition-transform ${z?"rotate-180":""}`})]}),z&&(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)(x.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),(0,b.jsx)("input",{value:v,onChange:a=>y(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.jsx)("div",{className:"max-h-40 overflow-auto py-1",children:C.map(a=>(0,b.jsxs)("button",{onClick:()=>{q(a),B(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors ${a===p?"bg-emerald-500/10 text-emerald-400":"text-secondary-foreground hover:bg-accent"}`,children:[(0,b.jsx)(w.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate font-mono text-xs",title:a,children:a}),a===p&&(0,b.jsx)(l.Check,{className:"h-3 w-3 ml-auto shrink-0"})]},a))})]})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:k("git.branchDesc")}),(0,b.jsx)(H.Textarea,{value:r,onChange:a=>s(a.target.value),placeholder:k("git.branchDescPlaceholder"),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)(F.DialogFooter,{children:[(0,b.jsx)(A.Button,{variant:"outline",onClick:()=>d(!1),children:k("common.cancel")}),(0,b.jsxs)(A.Button,{onClick:D,disabled:!m.trim()||t,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[t?(0,b.jsx)(i.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,k("common.create")]})]})]})})}var K=a.i(952313),L=a.i(7285);let M={modified:h.FileEdit,added:e.FilePlus,deleted:f.FileMinus,untracked:g.FileQuestion,renamed:h.FileEdit},N={modified:"text-amber-400",added:"text-emerald-400",deleted:"text-rose-400",untracked:"text-muted-foreground",renamed:"text-sky-400"},O={modified:"M",added:"A",deleted:"D",untracked:"U",renamed:"R"};function P(a){let b={name:"",path:"",isDir:!0,children:[]};for(let c of a){let a=c.file.split("/").filter(Boolean);if(0===a.length)continue;let d=b;for(let b=0;b<a.length;b++){let e=a[b],f=b===a.length-1,g=a.slice(0,b+1).join("/");if(f)d.children.push({name:e,path:g,isDir:!1,children:[],file:c});else{let a=d.children.find(a=>a.isDir&&a.name===e);a||(a={name:e,path:g,isDir:!0,children:[]},d.children.push(a)),d=a}}}return(function a(b){if(b.isDir&&(b.children=b.children.map(a),1===b.children.length&&b.children[0].isDir&&""!==b.name)){let a=b.children[0];return{...a,name:`${b.name}/${a.name}`}}return b})(b).children.sort((a,b)=>a.isDir!==b.isDir?a.isDir?-1:1:a.name.localeCompare(b.name))}function Q({scroll:a,children:c}){return a?(0,b.jsx)(C.ScrollArea,{className:"flex-1 min-h-0",children:c}):(0,b.jsx)("div",{children:c})}function R({label:a,count:d,labelColor:e,tree:f,batchAction:g,batchLabel:h,batchIcon:i,onFileClick:j,onFileAction:k,fileActionIcon:l,fileActionLabel:o,onFileSecondaryAction:p,fileSecondaryIcon:q,fileSecondaryLabel:r}){let[s,t]=(0,c.useState)(!0);return 0===d?null:(0,b.jsxs)("div",{className:"border-b border-border",children:[(0,b.jsxs)("div",{className:"group flex items-center justify-between px-2 py-1.5 hover:bg-accent/50 transition-colors",children:[(0,b.jsxs)("button",{onClick:()=>t(!s),className:"flex items-center gap-1 flex-1 min-w-0",children:[s?(0,b.jsx)(n.ChevronDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,b.jsx)(m.ChevronRight,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsxs)("span",{className:`text-[10px] font-semibold uppercase tracking-wider ${e}`,children:[a," (",d,")"]})]}),(0,b.jsx)(A.Button,{variant:"ghost",size:"icon-xs",onClick:g,className:"text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity","aria-label":h,children:i})]}),s&&(0,b.jsx)("div",{className:"pb-1",children:f.map(a=>(0,b.jsx)(S,{node:a,depth:0,onFileClick:j,onFileAction:k,fileActionIcon:l,fileActionLabel:o,onFileSecondaryAction:p,fileSecondaryIcon:q,fileSecondaryLabel:r},a.path))})]})}function S({node:a,depth:e,onFileClick:f,onFileAction:g,fileActionIcon:h,fileActionLabel:i,onFileSecondaryAction:j,fileSecondaryIcon:k,fileSecondaryLabel:l}){let[p,q]=(0,c.useState)(!0),r={paddingLeft:`calc(${e} * 8px + 4px)`};if(a.isDir)return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("button",{onClick:()=>q(!p),className:"flex w-full items-center gap-1 py-0.5 px-1 rounded-sm min-h-[28px] hover:bg-accent hover:text-accent-foreground transition-colors text-left",style:r,children:[p?(0,b.jsx)(n.ChevronDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,b.jsx)(m.ChevronRight,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsx)(o.Folder,{className:"h-3.5 w-3.5 shrink-0 text-amber-400"}),(0,b.jsx)("span",{className:"text-[13px] text-muted-foreground truncate",children:a.name})]}),p&&a.children.sort((a,b)=>a.isDir!==b.isDir?a.isDir?-1:1:a.name.localeCompare(b.name)).map(a=>(0,b.jsx)(S,{node:a,depth:e+1,onFileClick:f,onFileAction:g,fileActionIcon:h,fileActionLabel:i,onFileSecondaryAction:j,fileSecondaryIcon:k,fileSecondaryLabel:l},a.path))]});let s=a.file,t=M[s.status]||d.File,u=N[s.status]||"text-muted-foreground",v=O[s.status]||"?";return(0,b.jsxs)("div",{className:"group flex items-center gap-1 py-0.5 px-1 rounded-sm min-h-[28px] hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer",style:r,onClick:()=>f(s),children:[(0,b.jsx)("span",{className:"h-3 w-3 shrink-0"}),(0,b.jsx)(t,{className:`h-3.5 w-3.5 shrink-0 ${u}`}),(0,b.jsx)("span",{className:"text-[13px] text-foreground truncate flex-1",children:a.name}),(0,b.jsx)("span",{className:`text-[11px] font-mono font-bold shrink-0 mr-1 ${u}`,children:v}),j&&(0,b.jsxs)(E.Tooltip,{children:[(0,b.jsx)(E.TooltipTrigger,{onClick:a=>{a.stopPropagation(),j(s.file)},className:"shrink-0 rounded p-0.5 text-muted-foreground opacity-0 group-hover:opacity-100 hover:bg-destructive/20 hover:text-destructive transition-all","aria-label":l??"",children:k}),l&&(0,b.jsx)(E.TooltipContent,{side:"bottom",children:l})]}),(0,b.jsxs)(E.Tooltip,{children:[(0,b.jsx)(E.TooltipTrigger,{onClick:a=>{a.stopPropagation(),g(s.file)},className:"shrink-0 rounded px-1 text-xs font-mono text-muted-foreground opacity-0 group-hover:opacity-100 hover:bg-background hover:text-foreground transition-all mr-1","aria-label":i??"",children:h}),i&&(0,b.jsx)(E.TooltipContent,{side:"bottom",children:i})]})]})}a.s(["EditorGitPanel",0,function({localPath:a,onFileSelect:d,mode:e="project"}){let f="task"===e,{t:g}=(0,I.useI18n)(),[h,m]=(0,c.useState)(null),[o,C]=(0,c.useState)(!0),[F,G]=(0,c.useState)(""),[H,M]=(0,c.useState)(!1),[N,O]=(0,c.useState)(!1),[S,T]=(0,c.useState)(!1),[U,V]=(0,c.useState)(!1),[W,X]=(0,c.useState)(!1),[Y,Z]=(0,c.useState)(""),[$,_]=(0,c.useState)(!1),aa=(0,c.useCallback)(async()=>{try{let b=await fetch(`/api/git?path=${encodeURIComponent(a)}`);if(b.ok){let c=await b.json();m({changedFiles:c.changedFiles??[],ahead:c.ahead??0,behind:c.behind??0,remoteUrl:c.remoteUrl??"",currentBranch:c.currentBranch??"",branches:c.branches??[],remoteBranches:c.remoteBranches??[],topLevel:c.topLevel??a})}}catch{}finally{C(!1)}},[a]);(0,c.useEffect)(()=>{aa();let a=setInterval(aa,5e3);return()=>clearInterval(a)},[aa]);let ab=async b=>{try{await (0,L.gitAction)(a,"stage",{files:b}),await aa()}catch(a){K.toast.error(a instanceof Error?a.message:String(a))}},ac=async b=>{try{await (0,L.gitAction)(a,"unstage",{files:b}),await aa()}catch(a){K.toast.error(a instanceof Error?a.message:String(a))}},ad=async()=>{if(F.trim()){M(!0);try{await (0,L.gitAction)(a,"commit",{message:F}),G(""),K.toast.success(g("git.commitSuccess")),await aa()}catch(a){K.toast.error(a instanceof Error?a.message:String(a))}finally{M(!1)}}},ae=async b=>{O(!0);try{await (0,L.gitAction)(a,"pull",b?{branch:b}:{}),K.toast.success(g("git.pullSuccess")),await aa()}catch(a){K.toast.error(a instanceof Error?a.message:String(a))}finally{O(!1)}},af=async b=>{T(!0);try{await (0,L.gitAction)(a,"push",b?{branch:b}:{}),K.toast.success(g("git.pushSuccess")),await aa()}catch(a){K.toast.error(a instanceof Error?a.message:String(a))}finally{T(!1)}},ag=async()=>{V(!0);try{await (0,L.gitAction)(a,"fetch"),K.toast.success(g("git.fetchSuccess")),await aa()}catch(a){K.toast.error(a instanceof Error?a.message:String(a))}finally{V(!1)}},ah=async b=>{try{await (0,L.gitAction)(a,"checkout",{branch:b}),X(!1),K.toast.success(`${g("git.switchSuccess")} ${b}`),await aa()}catch(a){K.toast.error(a instanceof Error?a.message:String(a))}},ai=async()=>{try{await (0,L.gitAction)(a,"stash-save",{message:F||void 0}),G(""),K.toast.success(g("git.stashSaved")),await aa()}catch(a){K.toast.error(a instanceof Error?a.message:String(a))}},aj=async()=>{try{await (0,L.gitAction)(a,"stash-pop",{index:0}),K.toast.success(g("git.stashApplied")),await aa()}catch(a){K.toast.error(a instanceof Error?a.message:String(a))}},ak=async b=>{try{await (0,L.gitAction)(a,"discard-file",{file:b}),K.toast.success(g("git.discardFileSuccess")),await aa()}catch(a){K.toast.error(a instanceof Error?a.message:String(a))}},al=async()=>{try{await (0,L.gitAction)(a,"discard-all"),K.toast.success(g("git.discardSuccess")),await aa()}catch(a){K.toast.error(a instanceof Error?a.message:String(a))}},am=async b=>{if("deleted"===b.status)return;let c=h?.topLevel??a;try{let e=await (0,L.gitAction)(a,"show",{file:b.file});d?.(b.file,e.content??"",c)}catch{d?.(b.file,"",c)}},an=h?.changedFiles.filter(a=>a.staged)??[],ao=h?.changedFiles.filter(a=>!a.staged)??[],ap=(0,c.useMemo)(()=>P(an),[an]),aq=(0,c.useMemo)(()=>P(ao),[ao]);if(o)return(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)(i.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"})});if(!h)return null;function ar(a){let b=[];for(let c of a)c.isDir?b.push(...ar(c.children)):c.file&&b.push(c.file.file);return b}let as=[...h?.branches??[],...(h?.remoteBranches??[]).filter(a=>!h?.branches?.includes(a))],at=Y?as.filter(a=>a.toLowerCase().includes(Y.toLowerCase())):as;return(0,b.jsxs)("div",{className:f?"flex flex-col h-full overflow-hidden":"flex flex-col",children:[(0,b.jsxs)("div",{className:"shrink-0 px-2 pt-2 pb-1 flex items-center gap-1",children:[f?(0,b.jsxs)(E.Tooltip,{children:[(0,b.jsx)(E.TooltipTrigger,{render:(0,b.jsxs)("div",{className:"flex flex-1 min-w-0 items-center gap-1.5 rounded-md border border-border bg-muted/30 px-2 py-1.5",children:[(0,b.jsx)(w.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}),(0,b.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:h?.currentBranch||"—"})]})}),(0,b.jsx)(E.TooltipContent,{side:"bottom",className:"font-mono text-xs",children:h?.currentBranch||"—"})]}):(0,b.jsxs)(D.Popover,{open:W,onOpenChange:a=>{X(a),a&&Z("")},children:[(0,b.jsxs)(D.PopoverTrigger,{className:"flex flex-1 min-w-0 items-center justify-between rounded-md border border-border bg-muted/50 px-2 py-1.5 text-left transition-colors hover:bg-accent",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,b.jsx)(w.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}),(0,b.jsx)("span",{className:"truncate font-mono text-xs text-foreground",title:h?.currentBranch||void 0,children:h?.currentBranch||"—"})]}),(0,b.jsx)(n.ChevronDown,{className:`h-3 w-3 shrink-0 text-muted-foreground transition-transform ${W?"rotate-180":""}`})]}),(0,b.jsxs)(D.PopoverContent,{align:"start",sideOffset:4,className:"w-max min-w-[var(--anchor-width)] max-w-[320px] gap-0 overflow-hidden p-0",children:[(0,b.jsx)("div",{className:"border-b border-border p-1.5",children:(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)(x.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),(0,b.jsx)("input",{value:Y,onChange:a=>Z(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-48 overflow-auto py-1",children:[(h?.branches??[]).filter(a=>a.toLowerCase().includes(Y.toLowerCase())).length>0&&(0,b.jsx)("p",{className:"px-3 pt-1 pb-0.5 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("git.localBranches")}),(h?.branches??[]).filter(a=>a.toLowerCase().includes(Y.toLowerCase())).map(a=>{let c=a===h?.currentBranch;return(0,b.jsxs)("button",{onClick:()=>{c?X(!1):ah(a)},className:`flex w-full items-center gap-2 px-3 py-1 text-left transition-colors ${c?"bg-emerald-500/10 text-emerald-400":"text-secondary-foreground hover:bg-accent"}`,children:[(0,b.jsx)(w.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate font-mono text-xs",title:a,children:a}),c&&(0,b.jsx)(l.Check,{className:"h-3 w-3 ml-auto shrink-0"})]},`local-${a}`)}),(h?.remoteBranches??[]).filter(a=>!h?.branches?.includes(a)).filter(a=>a.toLowerCase().includes(Y.toLowerCase())).length>0&&(0,b.jsx)("p",{className:"px-3 pt-2 pb-0.5 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("git.remoteBranches")}),(h?.remoteBranches??[]).filter(a=>!h?.branches?.includes(a)).filter(a=>a.toLowerCase().includes(Y.toLowerCase())).map(a=>(0,b.jsxs)("button",{onClick:()=>ah(a),className:"flex w-full items-center gap-2 px-3 py-1 text-left text-secondary-foreground transition-colors hover:bg-accent",children:[(0,b.jsx)(y.Globe,{className:"h-3 w-3 shrink-0 text-sky-400"}),(0,b.jsx)("span",{className:"truncate font-mono text-xs",title:a,children:a})]},`remote-${a}`)),0===at.length&&(0,b.jsx)("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No branches found"})]})]})]}),!f&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(E.Tooltip,{children:[(0,b.jsx)(E.TooltipTrigger,{onClick:ag,disabled:U,className:"shrink-0 inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Fetch",children:(0,b.jsx)(s.RefreshCw,{className:`h-3.5 w-3.5 ${U?"animate-spin":""}`})}),(0,b.jsx)(E.TooltipContent,{side:"bottom",children:"Fetch"})]}),(0,b.jsxs)(E.Tooltip,{children:[(0,b.jsx)(E.TooltipTrigger,{onClick:()=>{X(!1),_(!0)},className:"shrink-0 inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors","aria-label":g("git.createBranch"),children:(0,b.jsx)(q.Plus,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(E.TooltipContent,{side:"bottom",children:g("git.createBranch")})]})]})]}),(0,b.jsxs)("div",{className:"shrink-0 px-2 pb-2 space-y-1.5 border-b border-border",children:[(0,b.jsx)("textarea",{value:F,onChange:a=>G(a.target.value),placeholder:g("git.commitMsgPlaceholder"),rows:3,className:"w-full rounded-md border border-border bg-background px-2 py-1.5 text-xs text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none",onKeyDown:a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&ad()}}),(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsxs)(A.Button,{variant:"default",className:"flex-1 h-7 gap-1.5 text-xs",onClick:ad,disabled:H||!F.trim()||0===an.length,children:[H?(0,b.jsx)(i.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(l.Check,{className:"h-3 w-3"}),g("git.commit")]}),(0,b.jsxs)(B.DropdownMenu,{children:[(0,b.jsx)(B.DropdownMenuTrigger,{render:(0,b.jsx)(A.Button,{variant:"outline",size:"icon-xs",className:"h-7 w-7 shrink-0"}),children:(0,b.jsx)(r.MoreHorizontal,{className:"h-3.5 w-3.5"})}),(0,b.jsxs)(B.DropdownMenuContent,{align:"end",side:"bottom",className:"w-52",children:[(0,b.jsxs)(B.DropdownMenuGroup,{children:[(0,b.jsx)(B.DropdownMenuLabel,{children:g("git.commit")}),(0,b.jsxs)(B.DropdownMenuItem,{onClick:ad,disabled:!F.trim()||0===an.length,children:[(0,b.jsx)(l.Check,{className:"h-3.5 w-3.5 mr-2"}),g("git.commit")]})]}),(0,b.jsx)(B.DropdownMenuSeparator,{}),(0,b.jsxs)(B.DropdownMenuGroup,{children:[(0,b.jsx)(B.DropdownMenuLabel,{children:g("git.changes")}),(0,b.jsxs)(B.DropdownMenuItem,{onClick:()=>ab(ar(aq)),disabled:0===ao.length,children:[(0,b.jsx)(q.Plus,{className:"h-3.5 w-3.5 mr-2"}),g("git.stageAll")]}),(0,b.jsxs)(B.DropdownMenuItem,{onClick:()=>ac(ar(ap)),disabled:0===an.length,children:[(0,b.jsx)(p.Minus,{className:"h-3.5 w-3.5 mr-2"}),g("git.unstageAll")]}),(0,b.jsxs)(B.DropdownMenuItem,{onClick:al,disabled:0===ao.length,children:[(0,b.jsx)(v,{className:"h-3.5 w-3.5 mr-2"}),g("git.discardAll")]})]}),!f&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(B.DropdownMenuSeparator,{}),(0,b.jsxs)(B.DropdownMenuGroup,{children:[(0,b.jsx)(B.DropdownMenuLabel,{children:g("git.sync")}),(0,b.jsxs)(B.DropdownMenuItem,{onClick:()=>ae(),disabled:N,children:[(0,b.jsx)(j.ArrowDown,{className:"h-3.5 w-3.5 mr-2"}),g("git.pull")]}),(0,b.jsxs)(B.DropdownMenuItem,{onClick:()=>af(),disabled:S,children:[(0,b.jsx)(k.ArrowUp,{className:"h-3.5 w-3.5 mr-2"}),g("git.push")]}),(0,b.jsxs)(B.DropdownMenuSub,{children:[(0,b.jsxs)(B.DropdownMenuSubTrigger,{disabled:N,children:[(0,b.jsx)(j.ArrowDown,{className:"h-3.5 w-3.5 mr-2"}),g("git.pullFrom"),"..."]}),(0,b.jsxs)(B.DropdownMenuSubContent,{className:"max-h-60 overflow-y-auto",children:[(0,b.jsxs)(B.DropdownMenuItem,{onClick:()=>ae(),children:[(0,b.jsx)(w.GitBranch,{className:"h-3 w-3 mr-2 text-emerald-400"}),h.currentBranch,h.behind>0&&(0,b.jsxs)("span",{className:"ml-auto text-[10px] text-muted-foreground",children:["↓",h.behind]})]}),h.remoteBranches.filter(a=>a!==h.currentBranch).map(a=>(0,b.jsxs)(B.DropdownMenuItem,{onClick:()=>ae(a),children:[(0,b.jsx)(w.GitBranch,{className:"h-3 w-3 mr-2 text-sky-400"}),a]},a))]})]}),(0,b.jsxs)(B.DropdownMenuSub,{children:[(0,b.jsxs)(B.DropdownMenuSubTrigger,{disabled:S,children:[(0,b.jsx)(k.ArrowUp,{className:"h-3.5 w-3.5 mr-2"}),g("git.pushTo"),"..."]}),(0,b.jsxs)(B.DropdownMenuSubContent,{className:"max-h-60 overflow-y-auto",children:[(0,b.jsxs)(B.DropdownMenuItem,{onClick:()=>af(),children:[(0,b.jsx)(w.GitBranch,{className:"h-3 w-3 mr-2 text-emerald-400"}),h.currentBranch,h.ahead>0&&(0,b.jsxs)("span",{className:"ml-auto text-[10px] text-muted-foreground",children:["↑",h.ahead]})]}),h.remoteBranches.filter(a=>a!==h.currentBranch).map(a=>(0,b.jsxs)(B.DropdownMenuItem,{onClick:()=>af(a),children:[(0,b.jsx)(w.GitBranch,{className:"h-3 w-3 mr-2 text-sky-400"}),a]},a))]})]}),(0,b.jsxs)(B.DropdownMenuItem,{onClick:ag,disabled:U,children:[(0,b.jsx)(s.RefreshCw,{className:`h-3.5 w-3.5 mr-2 ${U?"animate-spin":""}`}),g("git.fetchAll")]})]}),(0,b.jsx)(B.DropdownMenuSeparator,{}),(0,b.jsxs)(B.DropdownMenuGroup,{children:[(0,b.jsx)(B.DropdownMenuLabel,{children:g("git.stash")}),(0,b.jsxs)(B.DropdownMenuItem,{onClick:ai,disabled:0===h.changedFiles.length,children:[(0,b.jsx)(t.Archive,{className:"h-3.5 w-3.5 mr-2"}),g("git.stashSave")]}),(0,b.jsxs)(B.DropdownMenuItem,{onClick:aj,children:[(0,b.jsx)(u.ArrowUpFromLine,{className:"h-3.5 w-3.5 mr-2"}),g("git.stashPopLatest")]})]})]}),(0,b.jsx)(B.DropdownMenuSeparator,{}),(0,b.jsxs)(B.DropdownMenuItem,{disabled:!0,className:"text-muted-foreground",children:[(0,b.jsx)(w.GitBranch,{className:"h-3.5 w-3.5 mr-2"}),h.currentBranch]})]})]})]})]}),(0,b.jsxs)(Q,{scroll:f,children:[(0,b.jsx)(R,{label:g("git.stagedChanges"),count:an.length,labelColor:"text-emerald-400",tree:ap,batchAction:()=>ac(ar(ap)),batchLabel:g("git.unstageAll"),batchIcon:(0,b.jsx)(p.Minus,{className:"h-3 w-3"}),onFileClick:am,onFileAction:a=>ac([a]),fileActionIcon:"−",fileActionLabel:g("git.unstageFile")}),(0,b.jsx)(R,{label:g("git.unstagedChanges"),count:ao.length,labelColor:"text-muted-foreground",tree:aq,batchAction:()=>ab(ar(aq)),batchLabel:g("git.stageAll"),batchIcon:(0,b.jsx)(q.Plus,{className:"h-3 w-3"}),onFileClick:am,onFileAction:a=>ab([a]),fileActionIcon:"+",fileActionLabel:g("git.stageFile"),onFileSecondaryAction:a=>ak(a),fileSecondaryIcon:(0,b.jsx)(z.Trash2,{className:"h-2.5 w-2.5"}),fileSecondaryLabel:g("git.discardFile")}),0===h.changedFiles.length&&(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[(0,b.jsx)(l.Check,{className:"h-5 w-5 text-emerald-400 mb-2"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g("git.noChanges")})]})]}),(0,b.jsx)(J,{open:$,onOpenChange:_,branches:[...h?.branches??[],...h?.remoteBranches??[]],currentBranch:h?.currentBranch??"",localPath:a,onCreated:async()=>{K.toast.success(g("git.createSuccess")),await aa()},onError:a=>K.toast.error(`${g("git.createFailed")}: ${a}`)})]})}],985716)},300141,639138,88757,a=>{"use strict";var b=a.i(711796);let c=(0,b.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);a.s(["Square",0,c],300141);var d=a.i(728778),e=a.i(374637),f=a.i(10390),g=a.i(442620),h=a.i(811344),i=a.i(394869),j=a.i(207339),k=a.i(704494),l=a.i(699570),m=a.i(579834),n=a.i(786304),o=a.i(814574),p=a.i(429246),q=a.i(951192);function r({patchState:a,isLargeFold:b,onLoad:c}){let{t:e}=(0,q.useI18n)();return b?(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center gap-1 py-6",children:[(0,d.jsx)(l.Button,{variant:"link",onClick:c,className:"h-auto p-0 text-sm",children:e("diff.loadDiff")}),(0,d.jsx)("span",{className:"text-xs text-muted-foreground",children:e("diff.foldedLarge")})]}):a&&"loading"!==a.kind?"error"===a.kind?(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-6 text-sm text-muted-foreground",children:[(0,d.jsx)("span",{children:e("diff.loadFailed")}),(0,d.jsx)(l.Button,{variant:"ghost",onClick:c,children:e("diff.retry")})]}):"binary"===a.kind?(0,d.jsx)("div",{className:"flex items-center justify-center py-6 text-sm text-muted-foreground",children:e("diff.binaryNotShown")}):"empty"===a.kind?(0,d.jsx)("div",{className:"flex items-center justify-center py-6 text-sm text-muted-foreground",children:e("diff.noChanges")}):(0,d.jsx)(s,{patch:a.patch??""}):(0,d.jsx)("div",{className:"flex items-center justify-center py-6",children:(0,d.jsx)(k.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})})}function s({patch:a}){let{t:b}=(0,q.useI18n)(),c=a.split("\n"),e=c.length>500,f=e?c.slice(0,500):c;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("pre",{className:"overflow-x-auto p-0 text-xs font-mono leading-5",children:f.map((a,b)=>{let c=a.startsWith("+++")||a.startsWith("---")?"px-4 block text-muted-foreground":a.startsWith("+")?"px-4 block bg-green-500/10 text-green-400":a.startsWith("-")?"px-4 block bg-red-500/10 text-red-400":a.startsWith("@@")?"px-4 block bg-blue-500/10 text-blue-300":"px-4 block text-muted-foreground";return(0,d.jsx)("span",{className:c,children:a||" "},b)})}),e&&(0,d.jsx)("div",{className:"px-4 py-2 text-xs text-muted-foreground border-t border-border",children:b("diff.patchTruncated",{n:String(500),total:String(c.length)})})]})}a.s(["TaskDiffView",0,function({taskId:a,files:b,totalAdded:c,totalRemoved:k,hasConflicts:s,conflictFiles:t,onCommit:u,hasUncommitted:v}){let{t:w}=(0,q.useI18n)(),[x,y]=(0,e.useState)(new Set),[z,A]=(0,e.useState)(new Map),[B,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)(""),[F,G]=(0,e.useState)(!1),H=b=>{A(a=>new Map(a).set(b,{kind:"loading"})),fetch(`/api/tasks/${a}/diff-patch?file=${encodeURIComponent(b)}`).then(a=>a.ok?a.json():Promise.reject(Error(`HTTP ${a.status}`))).then(a=>{A(c=>{let d=new Map(c);return"binary"===a.kind?d.set(b,{kind:"binary"}):"empty"===a.kind?d.set(b,{kind:"empty"}):d.set(b,{kind:"ready",patch:a.patch??""}),d})}).catch(()=>{A(a=>new Map(a).set(b,{kind:"error"}))})};return(0,d.jsxs)("div",{className:"flex flex-col h-full",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-3 flex-shrink-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[(0,d.jsxs)("span",{className:"font-medium text-foreground",children:[b.length," files changed"]}),(0,d.jsxs)("span",{className:"text-green-400 font-mono text-xs",children:["+",c]}),(0,d.jsxs)("span",{className:"text-red-400 font-mono text-xs",children:["-",k]})]}),(0,d.jsx)("div",{className:"flex items-center gap-2",children:v&&u&&(0,d.jsxs)(l.Button,{variant:"outline",onClick:()=>C(!0),className:"gap-2",children:[(0,d.jsx)(j.GitCommitHorizontal,{className:"h-4 w-4"}),w("diff.commit")]})})]}),s&&(0,d.jsxs)("div",{className:"flex flex-col gap-2 border-b border-border bg-amber-500/5 px-4 py-3 flex-shrink-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-amber-400",children:[(0,d.jsx)(h.AlertTriangle,{className:"h-4 w-4 flex-shrink-0"}),(0,d.jsxs)("span",{className:"text-sm font-medium",children:["Merge blocked: ",t.length," conflicting file",1!==t.length?"s":""]})]}),(0,d.jsx)("ul",{className:"ml-6 space-y-1",children:t.map(a=>(0,d.jsx)("li",{className:"text-xs font-mono text-amber-300/80",children:a},a))})]}),(0,d.jsx)("div",{className:"flex-1 overflow-auto",children:0===b.length?(0,d.jsx)(m.EmptyState,{icon:i.GitCompare,title:w("diff.noChanges"),className:"h-full"}):(0,d.jsx)("div",{className:"divide-y divide-border",children:b.map(a=>{let b=x.has(a.filename),c=z.get(a.filename),e=a.added+a.removed;return(0,d.jsxs)("div",{children:[(0,d.jsxs)(l.Button,{variant:"ghost",type:"button",onClick:()=>{let b;return b=x.has(a.filename),void(y(b=>{let c=new Set(b);return c.has(a.filename)?c.delete(a.filename):c.add(a.filename),c}),b||a.isBinary||z.has(a.filename)||a.added+a.removed<=200&&H(a.filename))},className:"flex w-full items-center gap-2 px-4 py-2.5 text-left hover:bg-accent/50 transition-colors rounded-none h-auto",children:[b?(0,d.jsx)(g.ChevronDown,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}):(0,d.jsx)(f.ChevronRight,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),(0,d.jsx)("span",{className:"flex-1 truncate text-sm font-mono text-foreground",children:a.filename}),a.isBinary?(0,d.jsx)(n.Badge,{variant:"secondary",className:"text-[10px] bg-muted text-muted-foreground border border-border",children:w("diff.binary")}):(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsxs)("span",{className:"text-xs font-mono text-green-400",children:["+",a.added]}),(0,d.jsxs)("span",{className:"text-xs font-mono text-red-400",children:["-",a.removed]})]})]}),b&&!a.isBinary&&(0,d.jsx)("div",{className:"border-t border-border bg-background",children:(0,d.jsx)(r,{filename:a.filename,patchState:c,isLargeFold:!c&&e>200,onLoad:()=>H(a.filename)})})]},a.filename)})})}),(0,d.jsx)(o.Dialog,{open:B,onOpenChange:C,children:(0,d.jsxs)(o.DialogContent,{className:"max-w-md",children:[(0,d.jsx)(o.DialogHeader,{children:(0,d.jsx)(o.DialogTitle,{children:w("diff.commitChanges")})}),(0,d.jsx)("div",{className:"flex flex-col gap-3",children:(0,d.jsx)(p.Textarea,{value:D,onChange:a=>E(a.target.value),placeholder:w("diff.commitMessagePlaceholder"),rows:5,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none resize-y min-h-[80px]"})}),(0,d.jsxs)(o.DialogFooter,{children:[(0,d.jsx)(l.Button,{variant:"ghost",onClick:()=>C(!1),children:w("common.cancel")}),(0,d.jsx)(l.Button,{onClick:async()=>{if(D.trim()&&u){G(!0);try{await u(D.trim()),E(""),C(!1)}finally{G(!1)}}},disabled:!D.trim()||F,children:F?"...":w("diff.commit")})]})]})})]})}],639138);var t=a.i(553798);let u=(0,b.default)("git-merge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);a.s(["TaskMergeConfirmDialog",0,function({open:a,onOpenChange:b,taskId:c,taskTitle:f,baseBranch:g,fileCount:h,commitCount:i,commitLog:j=[],onMergeComplete:m}){let n=(0,t.useRouter)(),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(null),v=async()=>{q(!0),s(null);try{let a=await fetch(`/api/tasks/${c}/merge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(a.ok){b(!1),m(),n.refresh();return}let d=await a.json().catch(()=>({error:"Merge failed"}));409===a.status?s(`Merge conflicts detected: ${Array.isArray(d.conflictFiles)?d.conflictFiles.join(", "):"unknown files"}`):s(d.error??"Merge failed")}catch{s("Network error — merge failed")}finally{q(!1)}};return(0,d.jsx)(o.Dialog,{open:a,onOpenChange:b,children:(0,d.jsxs)(o.DialogContent,{showCloseButton:!0,className:"sm:max-w-md",children:[(0,d.jsx)(o.DialogHeader,{children:(0,d.jsxs)(o.DialogTitle,{className:"flex items-center gap-2",children:[(0,d.jsx)(u,{className:"h-4 w-4 text-emerald-400"}),"Confirm Merge"]})}),(0,d.jsxs)("div",{className:"space-y-3 py-2",children:[(0,d.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 p-3 space-y-2.5",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,d.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Target branch"}),(0,d.jsx)("code",{className:"text-xs font-mono bg-muted px-2 py-0.5 rounded text-foreground",children:g})]}),(0,d.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,d.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Changed files"}),(0,d.jsx)("span",{className:"text-xs font-medium text-foreground",children:h})]}),(0,d.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,d.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Commits"}),(0,d.jsx)("span",{className:"text-xs font-medium text-foreground",children:i})]})]}),j.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("span",{className:"text-xs text-muted-foreground mb-1 block",children:"Commits"}),(0,d.jsx)("div",{className:"rounded-md border border-border bg-muted/30 p-2 space-y-1 max-h-32 overflow-y-auto",children:j.map((a,b)=>(0,d.jsx)("div",{className:"text-xs font-mono text-foreground/80",children:a},b))})]}),r&&(0,d.jsx)("div",{className:"rounded-lg border border-red-500/20 bg-red-500/10 px-3 py-2",children:(0,d.jsx)("p",{className:"text-xs text-red-400",children:r})})]}),(0,d.jsxs)(o.DialogFooter,{children:[(0,d.jsx)(l.Button,{variant:"outline",onClick:()=>b(!1),disabled:p,children:"Cancel"}),(0,d.jsx)(l.Button,{onClick:v,disabled:p,className:"gap-2",children:p?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(k.Loader2,{className:"h-4 w-4 animate-spin"}),"Merging..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(u,{className:"h-4 w-4"}),"Confirm Merge"]})})]})]})})}],88757)},704076,a=>{"use strict";var b=a.i(780410);let c=(0,b.createServerReference)("4093f512a6711e351a5f163cb5dd0c422b7088b8e6",b.callServer,void 0,b.findSourceMapURL,"getTaskExecutions");a.s(["getTaskExecutions",0,c])},2809,89186,a=>{"use strict";var b=a.i(780410);let c=(0,b.createServerReference)("7c908b3e41ccc1c29fbf3081d9cae8f042782896f2",b.callServer,void 0,b.findSourceMapURL,"startPtyExecutionSafe");a.s(["startPtyExecutionSafe",0,c],2809);let d=(0,b.createServerReference)("40b6087daf2f484ecc97b4071abee9712b522edb53",b.callServer,void 0,b.findSourceMapURL,"continueLatestPtyExecution");a.s(["continueLatestPtyExecution",0,d],89186)},564674,793448,352392,a=>{"use strict";var b=a.i(780410);let c=(0,b.createServerReference)("6011d24a8b185dde779f24bb9ef6257474b248f51c",b.callServer,void 0,b.findSourceMapURL,"updateTaskStatus");a.s(["updateTaskStatus",0,c],564674);let d=(0,b.createServerReference)("40273a85f094063f26344ddcca0f224d49c97e70df",b.callServer,void 0,b.findSourceMapURL,"checkWorktreeClean");a.s(["checkWorktreeClean",0,d],793448);let e=(0,b.createServerReference)("6041421beb9018f2ec91cf0b87c875c95efd9e1a11",b.callServer,void 0,b.findSourceMapURL,"commitWorktreeChanges");a.s(["commitWorktreeChanges",0,e],352392)},970535,359948,a=>{"use strict";var b=a.i(711796);let c=(0,b.default)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]);a.s(["Clock",0,c],970535);let d=(0,b.default)("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);a.s(["History",0,d],359948)},715525,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(442620),e=a.i(745539),f=a.i(913284),g=a.i(468862),h=a.i(704494),i=a.i(970535),j=a.i(165614),k=a.i(747798),l=a.i(283857),m=a.i(359948),n=a.i(699570),o=a.i(579834),p=a.i(951192);function q({status:a}){switch(a){case"COMPLETED":return(0,b.jsx)(f.CheckCircle2,{className:"h-4 w-4 text-emerald-400"});case"FAILED":return(0,b.jsx)(g.XCircle,{className:"h-4 w-4 text-red-400"});case"RUNNING":return(0,b.jsx)(h.Loader2,{className:"h-4 w-4 text-blue-400 animate-spin"});default:return(0,b.jsx)(i.Clock,{className:"h-4 w-4 text-neutral-500"})}}a.s(["ExecutionTimeline",0,function({executions:a,onResume:f,onContinueLatest:g}){let{t:h,locale:i}=(0,p.useI18n)(),[r,s]=(0,c.useState)(null),[t,u]=(0,c.useState)(null);return 0===a.length?(0,b.jsx)(o.EmptyState,{icon:m.History,title:h("execution.noHistory")}):(0,b.jsxs)("div",{className:"space-y-2 p-3",children:[(0,b.jsx)("p",{className:"px-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:h("execution.history")}),a.map(c=>{let m=function(a){if(!a)return null;try{return JSON.parse(a)}catch{return null}}(c.gitStats??null),o=function(a,b){if(!a||!b)return"";let c=new Date(b).getTime()-new Date(a).getTime();if(c<0)return"";let d=Math.floor(c/1e3);if(d<60)return`${d}s`;let e=Math.floor(d/60);if(e<60)return`${e}m ${d%60}s`;let f=Math.floor(e/60);return`${f}h ${e%60}m`}(c.startedAt??null,c.endedAt??null),p=r===c.id;return(0,b.jsxs)("div",{className:"rounded-lg border border-border bg-background/50 overflow-hidden",children:[(0,b.jsxs)("div",{className:"p-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,b.jsx)(q,{status:c.status}),(0,b.jsx)("span",{className:`font-medium ${function(a){switch(a){case"COMPLETED":return"text-emerald-400";case"FAILED":return"text-red-400";case"RUNNING":return"text-blue-400";default:return"text-neutral-400"}}(c.status)}`,children:function(a,b){switch(a){case"COMPLETED":return b("execution.success");case"FAILED":return b("execution.failed");case"RUNNING":return b("execution.running");default:return a}}(c.status,h)}),(0,b.jsx)("span",{className:"text-muted-foreground",children:function(a,b="zh"){if(!a)return"";let c=new Date(a),d=Math.floor((new Date().getTime()-c.getTime())/864e5),e="zh"===b?"zh-CN":"en-US",f=c.toLocaleTimeString(e,{hour:"2-digit",minute:"2-digit"});return 0===d?f:1===d?"zh"===b?`昨天 ${f}`:`Yesterday ${f}`:d<7?"zh"===b?`${d}天前 ${f}`:`${d}d ago ${f}`:c.toLocaleDateString(e,{month:"2-digit",day:"2-digit"})+" "+f}(c.startedAt??null,i)}),o&&(0,b.jsxs)("span",{className:"text-muted-foreground/60",children:["(",o,")"]})]}),(0,b.jsx)("p",{className:"mt-1.5 text-sm text-foreground/80 line-clamp-2",children:c.summary||h("execution.noSummary")}),m&&(m.commits||m.filesChanged)&&(0,b.jsxs)("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-muted-foreground font-mono",children:[m.commits?(0,b.jsxs)("span",{children:[m.commits," ",h("execution.commits")]}):null,m.filesChanged?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{children:"·"}),(0,b.jsxs)("span",{children:[m.filesChanged," ",h("execution.files")]})]}):null,m.insertions||m.deletions?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{children:"·"}),m.insertions?(0,b.jsxs)("span",{className:"text-emerald-500",children:["+",m.insertions]}):null,m.deletions?(0,b.jsxs)("span",{className:"text-red-400",children:["-",m.deletions]}):null]}):null]}),c.insightNote&&(0,b.jsxs)("div",{className:"mt-2",children:[(0,b.jsxs)("button",{onClick:()=>u(t===c.id?null:c.id),className:"flex items-center gap-1.5 text-xs text-primary/90 hover:text-primary transition-colors",children:[(0,b.jsx)(l.Lightbulb,{className:"h-3.5 w-3.5"}),(0,b.jsxs)("span",{className:"font-medium",children:[h("execution.insight"),":"]}),(0,b.jsx)("span",{className:"text-foreground/70 truncate max-w-[200px]",children:c.insightNote.title}),t===c.id?(0,b.jsx)(e.ChevronUp,{className:"h-3 w-3"}):(0,b.jsx)(d.ChevronDown,{className:"h-3 w-3"})]}),t===c.id&&(0,b.jsx)("div",{className:"mt-2 rounded-md bg-primary/[0.06] border border-primary/10 p-3 text-xs text-foreground/80 whitespace-pre-wrap",children:c.insightNote.content})]}),(0,b.jsxs)("div",{className:"mt-2.5 flex items-center gap-2",children:[c.sessionId&&f?(0,b.jsxs)(n.Button,{size:"sm",onClick:()=>f(c.sessionId),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[(0,b.jsx)(j.PlayCircle,{className:"h-3.5 w-3.5"}),h("execution.resume")]}):!c.sessionId&&"FAILED"===c.status&&c.id===a[0]?.id&&g?(0,b.jsxs)(n.Button,{size:"sm",onClick:g,className:"bg-blue-500/15 text-blue-300 ring-1 ring-blue-500/20 hover:bg-blue-500/25",children:[(0,b.jsx)(k.RotateCcw,{className:"h-3.5 w-3.5"}),h("execution.tryRecover")]}):null,(0,b.jsxs)(n.Button,{variant:"ghost",size:"sm",onClick:()=>s(p?null:c.id),className:"bg-muted text-muted-foreground",children:[p?(0,b.jsx)(e.ChevronUp,{className:"h-3.5 w-3.5"}):(0,b.jsx)(d.ChevronDown,{className:"h-3.5 w-3.5"}),p?h("execution.collapse"):h("execution.details")]})]})]}),p&&(0,b.jsxs)("div",{className:"border-t border-border px-3 pb-3 space-y-3",children:[c.gitLog&&(0,b.jsxs)("div",{className:"mt-3",children:[(0,b.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5",children:h("execution.gitLog")}),(0,b.jsx)("pre",{className:"rounded-md bg-muted/50 p-2.5 text-xs font-mono text-foreground/70 overflow-x-auto whitespace-pre-wrap",children:c.gitLog.split("\n").slice(0,3).join("\n")})]}),c.terminalLog&&(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5",children:h("execution.terminalOutput")}),(0,b.jsx)("pre",{className:"rounded-md bg-[#0f1419] p-2.5 text-xs font-mono text-neutral-300 overflow-x-auto max-h-48 overflow-y-auto whitespace-pre-wrap",children:c.terminalLog})]}),"FAILED"===c.status&&null!=c.exitCode&&(0,b.jsxs)("p",{className:"text-xs text-red-400/70",children:["Exit code: ",c.exitCode]})]})]},c.id)})]})}])},137621,a=>{"use strict";var b=a.i(780410);let c=(0,b.createServerReference)("608bc23dda2af02295d6d52057fb29a40dadd07caf",b.callServer,void 0,b.findSourceMapURL,"updateTask");a.s(["updateTask",0,c])}];
2
+
3
+ //# sourceMappingURL=_0hp.0s8._.js.map