tower-studio 0.2.36 β†’ 0.2.37

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 (206) 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 +2 -2
  12. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +30 -30
  13. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  14. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/.next/server/app/api/adapters/test/route.js.nft.json +1 -1
  16. package/.next/standalone/.next/server/app/api/browse-fs/route.js.nft.json +1 -1
  17. package/.next/standalone/.next/server/app/api/files/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  18. package/.next/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
  19. package/.next/standalone/.next/server/app/api/internal/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  20. package/.next/standalone/.next/server/app/api/internal/assets/reveal/route.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/api/internal/assistant/attachments/route.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/api/internal/assistant/chat/route.js.nft.json +1 -1
  23. package/.next/standalone/.next/server/app/api/internal/assistant/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/internal/assistant/sessions/route.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/api/internal/backup/import/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/internal/cache/[...segments]/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/internal/hooks/install/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/internal/hooks/upload/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/internal/monaco/[...path]/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/internal/terminal/[taskId]/start/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/tasks/[taskId]/diff/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/tasks/[taskId]/merge/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/missions/page/react-loadable-manifest.json +1 -1
  34. package/.next/standalone/.next/server/app/missions/page/server-reference-manifest.json +63 -63
  35. package/.next/standalone/.next/server/app/missions/page.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/missions/page_client-reference-manifest.js +1 -1
  37. package/.next/standalone/.next/server/app/onboarding/page/react-loadable-manifest.json +2 -2
  38. package/.next/standalone/.next/server/app/onboarding/page/server-reference-manifest.json +30 -30
  39. package/.next/standalone/.next/server/app/onboarding/page.js.nft.json +1 -1
  40. package/.next/standalone/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  41. package/.next/standalone/.next/server/app/page/react-loadable-manifest.json +2 -2
  42. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +30 -30
  43. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  45. package/.next/standalone/.next/server/app/settings/page/react-loadable-manifest.json +2 -2
  46. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +47 -47
  47. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  49. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +2 -2
  50. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +105 -105
  51. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
  53. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +2 -2
  54. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +90 -90
  55. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
  56. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
  57. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +2 -2
  58. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +75 -75
  59. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
  60. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
  61. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +2 -2
  62. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +78 -78
  63. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
  64. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
  65. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +2 -2
  66. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +30 -30
  67. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
  68. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
  69. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/react-loadable-manifest.json +2 -2
  70. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/server-reference-manifest.json +74 -74
  71. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page.js.nft.json +1 -1
  72. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page_client-reference-manifest.js +1 -1
  73. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +3 -3
  74. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +77 -77
  75. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
  76. package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  77. package/.next/standalone/.next/server/app/workspaces/page/react-loadable-manifest.json +2 -2
  78. package/.next/standalone/.next/server/app/workspaces/page/server-reference-manifest.json +50 -50
  79. package/.next/standalone/.next/server/app/workspaces/page.js.nft.json +1 -1
  80. package/.next/standalone/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
  81. package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0hrprmi.js +1 -1
  82. package/.next/standalone/.next/server/chunks/[root-of-the-server]__00llstz._.js +1 -1
  83. package/.next/standalone/.next/server/chunks/[root-of-the-server]__01n7exm._.js +1 -1
  84. package/.next/standalone/.next/server/chunks/[root-of-the-server]__01yu.gw._.js +1 -1
  85. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05nz.tg._.js +1 -1
  86. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qif839._.js +1 -1
  87. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~foo~5._.js +2 -2
  88. package/.next/standalone/.next/server/chunks/src_0bkvm8c._.js +1 -1
  89. package/.next/standalone/.next/server/chunks/ssr/0iu._[workspaceId]_projects_[projectId]_versions_version-timeline-client_tsx_07o_kyi._.js +1 -1
  90. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0-tolks._.js +2 -2
  91. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0vv4hxw._.js β†’ [root-of-the-server]__05b5dyi._.js} +2 -2
  92. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__05sv58d._.js +1 -1
  93. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__05xg05r._.js +1 -1
  94. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__062b.yt._.js +2 -2
  95. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__093tt4a._.js +2 -2
  96. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0bgr0ql._.js +1 -1
  97. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0iatlhd._.js β†’ [root-of-the-server]__0csj88a._.js} +2 -2
  98. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0guqcva._.js +2 -2
  99. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0gzafdq._.js +1 -1
  100. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0jymb~t._.js +1 -1
  101. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__13~k9z5._.js β†’ [root-of-the-server]__0kdfgja._.js} +2 -2
  102. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0bsx096._.js β†’ [root-of-the-server]__0oy9qt7._.js} +2 -2
  103. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0p0te97._.js +2 -2
  104. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0rzkdlf._.js +3 -0
  105. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0siyg1p._.js +2 -2
  106. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0t6f4lq._.js +2 -2
  107. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0th-t1a._.js +2 -2
  108. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0pa9_bd._.js β†’ [root-of-the-server]__0vjz4a4._.js} +2 -2
  109. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0z7je5_._.js +1 -1
  110. package/.next/standalone/.next/server/chunks/ssr/_0-~9em3._.js +1 -1
  111. package/.next/standalone/.next/server/chunks/ssr/{_0ebel46._.js β†’ _0.-xze1._.js} +2 -2
  112. package/.next/standalone/.next/server/chunks/ssr/_00t6138._.js +2 -2
  113. package/.next/standalone/.next/server/chunks/ssr/_00z0339._.js +3 -0
  114. package/.next/standalone/.next/server/chunks/ssr/_070t_mh._.js +2 -2
  115. package/.next/standalone/.next/server/chunks/ssr/{_0zidle2._.js β†’ _09j.h2h._.js} +2 -2
  116. package/.next/standalone/.next/server/chunks/ssr/_0_r-f5a._.js +3 -0
  117. package/.next/standalone/.next/server/chunks/ssr/_0cj9a7y._.js +1 -1
  118. package/.next/standalone/.next/server/chunks/ssr/_0cxhub8._.js +2 -2
  119. package/.next/standalone/.next/server/chunks/ssr/_0gzdrnf._.js +3 -0
  120. package/.next/standalone/.next/server/chunks/ssr/_0hh17jg._.js +1 -1
  121. package/.next/standalone/.next/server/chunks/ssr/{_0reranf._.js β†’ _0lqxllh._.js} +2 -2
  122. package/.next/standalone/.next/server/chunks/ssr/_0mpce0d._.js +2 -2
  123. package/.next/standalone/.next/server/chunks/ssr/_0muaopo._.js +2 -2
  124. package/.next/standalone/.next/server/chunks/ssr/_0n1l7yo._.js +2 -2
  125. package/.next/standalone/.next/server/chunks/ssr/_0nk7qd4._.js +1 -1
  126. package/.next/standalone/.next/server/chunks/ssr/{_0soj-y2._.js β†’ _0pp8emp._.js} +2 -2
  127. package/.next/standalone/.next/server/chunks/ssr/{_0mhdb-a._.js β†’ _0r1f9zc._.js} +2 -2
  128. package/.next/standalone/.next/server/chunks/ssr/{_0jf91oa._.js β†’ _0r_ch71._.js} +3 -3
  129. package/.next/standalone/.next/server/chunks/ssr/_0rdyrfd._.js +1 -1
  130. package/.next/standalone/.next/server/chunks/ssr/{_0izxa9k._.js β†’ _0ub.iem._.js} +2 -2
  131. package/.next/standalone/.next/server/chunks/ssr/{_0xx4aa5._.js β†’ _0v0y2s~._.js} +2 -2
  132. package/.next/standalone/.next/server/chunks/ssr/_0wbcp88._.js +1 -1
  133. package/.next/standalone/.next/server/chunks/ssr/_0z7hp2l._.js +3 -0
  134. package/.next/standalone/.next/server/chunks/ssr/src_0djxlqx._.js +1 -1
  135. package/.next/standalone/.next/server/chunks/ssr/src_0eufeyj._.js +1 -1
  136. package/.next/standalone/.next/server/chunks/ssr/src_actions_agent-actions_ts_0~wc.sy._.js +1 -1
  137. package/.next/standalone/.next/server/chunks/ssr/src_actions_file-actions_ts_0gcvqwm._.js +1 -1
  138. package/.next/standalone/.next/server/chunks/ssr/src_app_missions_missions-client_tsx_11429lj._.js +1 -1
  139. package/.next/standalone/.next/server/chunks/ssr/src_app_onboarding_page_tsx_0xf7hpz._.js +1 -1
  140. package/.next/standalone/.next/server/chunks/ssr/src_app_settings_page_tsx_0h9v7dr._.js +1 -1
  141. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0wyzpam._.js +1 -1
  142. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_board-page-client_tsx_0gips66._.js +1 -1
  143. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_notes_notes-page-client_tsx_10gyo3v._.js +1 -1
  144. package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_02t7blt._.js +1 -1
  145. package/.next/standalone/.next/server/chunks/ssr/src_components_ui_select_tsx_0d2ra01._.js +1 -1
  146. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  147. package/.next/standalone/.next/server/pages/500.html +1 -1
  148. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  149. package/.next/standalone/.next/server/server-reference-manifest.json +289 -289
  150. package/.next/standalone/.next/static/chunks/00.kucs-nzw72.js +1 -0
  151. package/.next/standalone/.next/static/chunks/{0p0_.0f~k5o3x.js β†’ 00_-_qcmfqtqx.js} +1 -1
  152. package/.next/standalone/.next/static/chunks/014cs5ykpuy3m.js +1 -0
  153. package/.next/standalone/.next/static/chunks/{0ntang9wkuj-8.js β†’ 01f6i88h8guls.js} +1 -1
  154. package/.next/standalone/.next/static/chunks/034x~85_u-f26.js +1 -0
  155. package/.next/standalone/.next/static/chunks/{0m_l01d2lzffq.js β†’ 03tc~x4m3si-p.js} +1 -1
  156. package/.next/standalone/.next/static/chunks/03v.cnuy3h3rb.js +1 -0
  157. package/.next/standalone/.next/static/chunks/05dlhgy_00kj1.js +1 -0
  158. package/.next/standalone/.next/static/chunks/05p_suay02eo1.js +1 -0
  159. package/.next/standalone/.next/static/chunks/08cuzj12jsob5.js +1 -0
  160. package/.next/standalone/.next/static/chunks/08ewy5rmh_n_s.js +1 -0
  161. package/.next/standalone/.next/static/chunks/{0xy8x3-.0bopl.js β†’ 0950xt.ix3j1q.js} +1 -1
  162. package/.next/standalone/.next/static/chunks/09a43rligfn_v.js +1 -0
  163. package/.next/standalone/.next/static/chunks/0c.6n7.lv8~10.js +1 -0
  164. package/.next/standalone/.next/static/chunks/0ckcff42.pa_j.js +1 -0
  165. package/.next/standalone/.next/static/chunks/0dt3ljzz2pz0r.css +1 -0
  166. package/.next/standalone/.next/static/chunks/0kuz7yd.6hpd1.js +1 -0
  167. package/.next/standalone/.next/static/chunks/0m227i3p__4qz.js +2 -0
  168. package/.next/standalone/.next/static/chunks/0mk6~akqfc05t.js +1 -0
  169. package/.next/standalone/.next/static/chunks/{0xc5b.xin3frr.js β†’ 0o0ngxu962xwu.js} +1 -1
  170. package/.next/standalone/.next/static/chunks/{01tsz1~lswudb.js β†’ 0o3eu9q3qnvi..js} +1 -1
  171. package/.next/standalone/.next/static/chunks/{0n9bv.-ktyu9g.js β†’ 0oaelsx9hpsxi.js} +1 -1
  172. package/.next/standalone/.next/static/chunks/{093zwcwn8el.s.js β†’ 0p.-6dhm_nm9f.js} +1 -1
  173. package/.next/standalone/.next/static/chunks/0qc.bnyy68-yh.js +1 -0
  174. package/.next/standalone/.next/static/chunks/{0l~z-vsf.633k.js β†’ 0qfx4.vrc9a9n.js} +1 -1
  175. package/.next/standalone/.next/static/chunks/0s46.9vyvnj99.js +1 -0
  176. package/.next/standalone/.next/static/chunks/0u~0j4_f3gwi2.js +1 -0
  177. package/.next/standalone/.next/static/chunks/15~2jg4z8h54~.js +1 -0
  178. package/.next/standalone/package.json +2 -2
  179. package/package.json +2 -2
  180. package/scripts/migrations/0002-backfill-done-at.ts +29 -0
  181. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__10xjtl0._.js +0 -3
  182. package/.next/standalone/.next/server/chunks/ssr/_0.7vx4q._.js +0 -3
  183. package/.next/standalone/.next/server/chunks/ssr/_0gc019m._.js +0 -3
  184. package/.next/standalone/.next/server/chunks/ssr/_0m_1ssw._.js +0 -3
  185. package/.next/standalone/.next/server/chunks/ssr/_0nghgzi._.js +0 -3
  186. package/.next/standalone/.next/static/chunks/0-fc2i1mw_t-2.js +0 -2
  187. package/.next/standalone/.next/static/chunks/0.7r6od5..1~d.css +0 -1
  188. package/.next/standalone/.next/static/chunks/0.duc36elgwmt.js +0 -1
  189. package/.next/standalone/.next/static/chunks/02_isu4z4lk1~.js +0 -1
  190. package/.next/standalone/.next/static/chunks/06pdwir_r4uhn.js +0 -1
  191. package/.next/standalone/.next/static/chunks/0gx4n5njdyksz.js +0 -1
  192. package/.next/standalone/.next/static/chunks/0l49-stccar4a.js +0 -1
  193. package/.next/standalone/.next/static/chunks/0m5kd96epukmx.js +0 -1
  194. package/.next/standalone/.next/static/chunks/0m_9-3_hpbfly.js +0 -1
  195. package/.next/standalone/.next/static/chunks/0odml~1zfmatg.js +0 -1
  196. package/.next/standalone/.next/static/chunks/0sm78n1ikzixj.js +0 -1
  197. package/.next/standalone/.next/static/chunks/0v73i.x591~km.js +0 -1
  198. package/.next/standalone/.next/static/chunks/0wkd~xb2skr1g.js +0 -1
  199. package/.next/standalone/.next/static/chunks/0xyj_-7b.4l1l.js +0 -1
  200. package/.next/standalone/.next/static/chunks/10f-2fo.qg504.js +0 -1
  201. package/.next/standalone/.next/static/chunks/11p_dl5tngif4.js +0 -1
  202. package/.next/standalone/.next/static/chunks/153-zn4e8fta1.js +0 -1
  203. package/.next/standalone/.next/static/chunks/188_7xt~9qo5z.js +0 -1
  204. /package/.next/standalone/.next/static/{SCktqI1yaRGMJYovFwj4q β†’ FO1_JUKAw5Zm07Nlq0G6X}/_buildManifest.js +0 -0
  205. /package/.next/standalone/.next/static/{SCktqI1yaRGMJYovFwj4q β†’ FO1_JUKAw5Zm07Nlq0G6X}/_clientMiddlewareManifest.js +0 -0
  206. /package/.next/standalone/.next/static/{SCktqI1yaRGMJYovFwj4q β†’ FO1_JUKAw5Zm07Nlq0G6X}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,912505,e=>{"use strict";var t=e.i(289721),s=e.i(975157);e.s(["EmptyState",0,function({icon:e,title:a,description:r,action:n,className:l}){return(0,t.jsxs)("div",{className:(0,s.cn)("flex h-48 flex-col items-center justify-center gap-2 text-center",l),children:[e&&(0,t.jsx)(e,{className:"h-10 w-10 text-muted-foreground/40"}),(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:a}),r&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground/60",children:r}),n&&(0,t.jsx)("div",{className:"mt-2",children:n})]})}])},236967,e=>{"use strict";var t=e.i(289721),s=e.i(210702),a=e.i(538059),r=e.i(259846),n=e.i(645378),l=e.i(453889),i=e.i(487278),c=e.i(533499);let o=[{key:"notes",icon:n.FileText},{key:"assets",icon:l.FolderOpen},{key:"archive",icon:i.Archive}];e.s(["SubPageNav",0,function({workspaceId:e}){let{t:n}=(0,c.useI18n)(),l=(0,a.usePathname)(),i=o.find(e=>l.includes(`/${e.key}`))?.key;return(0,t.jsxs)("div",{className:"header-sm flex items-center gap-1 px-4",children:[(0,t.jsxs)(s.default,{href:`/workspaces/${e}`,className:"mr-2 inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:[(0,t.jsx)(r.ArrowLeft,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:n("archive.backToBoard")})]}),(0,t.jsx)("span",{className:"mr-2 h-4 w-px bg-border"}),o.map(a=>{let r=a.icon,l=i===a.key;return(0,t.jsxs)(s.default,{href:`/workspaces/${e}/${a.key}`,className:`inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs font-medium transition-colors ${l?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"}`,children:[(0,t.jsx)(r,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:n(`sidebar.${a.key}`)})]},a.key)})]})}])},695542,649574,e=>{"use strict";var t=e.i(514798);let s=(0,t.createServerReference)("40089446e14dfccae4d9cfae25d87fe426f881796b",t.callServer,void 0,t.findSourceMapURL,"createNote");e.s(["createNote",0,s],695542);let a=(0,t.createServerReference)("40eb2a344429aa574c7aa9c35c50ef2294b7e1f880",t.callServer,void 0,t.findSourceMapURL,"deleteNote");e.s(["deleteNote",0,a],649574)},497732,e=>{"use strict";var t=e.i(289721),s=e.i(965652),a=e.i(232545),r=e.i(400355),n=e.i(738690),l=e.i(236967),i=e.i(533499),c=e.i(685149),o=e.i(695542),d=e.i(514798);let x=(0,d.createServerReference)("603a47abed710c0d42bb7866767beb055bdc0b79ba",d.callServer,void 0,d.findSourceMapURL,"updateNote");var u=e.i(649574);let m=(0,d.createServerReference)("60780b5248de0826b96d55da66341a45449290a472",d.callServer,void 0,d.findSourceMapURL,"getProjectNotes");var h=e.i(975157);function p({active:e,onSelect:s}){let{t:a}=(0,i.useI18n)();return(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,t.jsx)("button",{onClick:()=>s("all"),className:(0,h.cn)("rounded-lg px-3 py-1 text-xs font-medium transition-colors","all"===e?"bg-primary/15 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent"),children:a("notes.allCategories")}),c.NOTE_CATEGORIES_PRESET.map(a=>(0,t.jsx)("button",{onClick:()=>s(a),className:(0,h.cn)("rounded-lg px-3 py-1 text-xs font-medium transition-colors",e===a?"bg-primary/15 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent"),children:a},a))]})}var g=e.i(519455),f=e.i(280027),j=e.i(645378),v=e.i(912505),N=e.i(464249),b=e.i(998626);let y=(0,e.i(572989).default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);e.i(254826);var S=e.i(309735);function w({note:e,onEdit:s,onDelete:a,onPreview:r,onTaskClick:n}){let{t:l}=(0,i.useI18n)(),c=e.content.slice(0,300);return(0,t.jsxs)("div",{className:"group relative rounded-lg border border-border bg-card p-4 transition-colors hover:border-border/80 hover:bg-accent/20",children:[(0,t.jsxs)("div",{className:"absolute right-3 top-3 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,t.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>s(e),className:"text-muted-foreground","aria-label":l("notes.edit"),children:(0,t.jsx)(N.Pencil,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>a(e.id),className:"text-muted-foreground hover:text-rose-400","aria-label":l("notes.delete"),children:(0,t.jsx)(b.Trash2,{className:"h-3.5 w-3.5"})})]}),(0,t.jsx)("div",{className:"mb-2 pr-16",children:(0,t.jsx)("h3",{className:"truncate text-sm font-semibold text-foreground",children:e.title})}),(0,t.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-1.5",children:[(0,t.jsx)("span",{className:"inline-block rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:e.category}),e.taskId&&e.taskTitle&&(0,t.jsxs)("button",{type:"button",onClick:()=>e.taskId&&n?.(e.taskId),disabled:!n,className:`inline-flex max-w-[160px] items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary ${n?"cursor-pointer hover:bg-primary/15":"cursor-default"}`,title:e.taskTitle,children:[(0,t.jsx)(y,{className:"h-2.5 w-2.5 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.taskTitle})]})]}),(0,t.jsx)("button",{type:"button",onClick:()=>r?.(e),disabled:!r,className:`block w-full text-left ${r?"cursor-pointer":"cursor-default"}`,title:r?l("notes.previewNote"):void 0,children:(0,t.jsx)("div",{className:"max-h-24 overflow-hidden text-sm leading-relaxed text-muted-foreground",children:(0,t.jsx)(S.Streamdown,{children:c})})})]})}function k({notes:e,onEdit:s,onDelete:a,onPreview:r,onTaskClick:n}){let{t:l}=(0,i.useI18n)();return 0===e.length?(0,t.jsx)(v.EmptyState,{icon:j.FileText,title:l("notes.empty"),description:l("notes.emptyHint")}):(0,t.jsx)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:e.map(e=>(0,t.jsx)(w,{note:e,onEdit:s,onDelete:a,onPreview:r,onTaskClick:n},e.id))})}var C=e.i(624687);function T({value:e,onChange:s}){return(0,t.jsxs)("div",{className:"relative grid grid-cols-2 gap-4 flex-1 min-h-64",children:[(0,t.jsx)(C.Textarea,{value:e,onChange:e=>s(e.target.value),className:"absolute inset-0 w-1/2 pr-2 resize-none font-mono text-sm border rounded-md p-3 bg-background text-foreground border-border focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Write Markdown here..."}),(0,t.jsx)("div",{className:"absolute inset-0 left-1/2 pl-2",children:(0,t.jsx)("div",{className:"h-full overflow-y-auto border rounded-md p-3 border-border text-sm leading-relaxed",children:(0,t.jsx)(S.Streamdown,{children:e})})})]})}var E=e.i(997025),I=e.i(759684),P=e.i(605005);e.s(["NotesPageClient",0,function({allWorkspaces:e,initialWorkspaceId:d,initialProjectId:h,initialNotes:j}){let v,N,{t:b}=(0,i.useI18n)(),[y,S]=(0,s.useTransition)(),[w,C]=(0,s.useState)(d),[R,$]=(0,s.useState)(h),[O,A]=(0,s.useState)(j),[_,L]=(0,s.useState)("all"),[B,z]=(0,s.useState)(""),[M,U]=(0,s.useState)(null),[D,V]=(0,s.useState)(null),[F,G]=(0,s.useState)(null),[H,K]=(0,s.useState)(!1),[q,W]=(0,s.useState)(""),[J,Q]=(0,s.useState)(""),[X,Y]=(0,s.useState)(c.NOTE_CATEGORIES_PRESET[3]),[Z,ee]=(0,s.useState)(d),[et,es]=(0,s.useState)(h),ea=e.find(e=>e.id===w),er=ea?.projects??[],en=e.find(e=>e.id===Z),el=en?.projects??[],ei=(0,s.useCallback)(e=>{e?S(async()=>{A(await m(e))}):A([])},[S]),ec=async()=>{et&&q.trim()&&(await (0,o.createNote)({title:q.trim(),content:J,category:X,projectId:et}),K(!1),et===R&&ei(R))},eo=async()=>{F&&q.trim()&&(await x(F.id,{title:q.trim(),content:J,category:X}),G(null),ei(R))},ed=async e=>{let t=O.find(t=>t.id===e);!t||confirm(b("notes.deleteConfirm",{title:t.title}))&&(await (0,u.deleteNote)(e),ei(R))},ex=B.trim().toLowerCase(),eu=O.filter(e=>"all"===_||e.category===_).filter(e=>!ex||e.title.toLowerCase().includes(ex)).map(e=>({id:e.id,title:e.title,content:e.content,category:e.category,updatedAt:new Date(e.updatedAt),taskId:e.taskId,taskTitle:e.task?.title??null})),em=H||null!==F;return(0,t.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,t.jsx)(l.SubPageNav,{workspaceId:w}),(0,t.jsxs)("div",{className:"header-sm flex items-center gap-3 px-6 py-2",children:[(0,t.jsxs)(f.Select,{value:w,onValueChange:t=>t&&(t=>{if(t===w)return;C(t);let s=e.find(e=>e.id===t),a=s?.projects[0]??null;$(a?.id??null),L("all"),ei(a?.id??null)})(t),children:[(0,t.jsx)(f.SelectTrigger,{className:"h-8 w-auto min-w-[120px]",children:(0,t.jsx)("span",{className:"truncate",children:e.find(e=>e.id===w)?.name??w})}),(0,t.jsx)(f.SelectContent,{children:e.map(e=>(0,t.jsx)(f.SelectItem,{value:e.id,children:e.name},e.id))})]}),er.length>0&&(0,t.jsxs)(f.Select,{value:R??"",onValueChange:e=>e&&void(e!==R&&($(e),L("all"),ei(e))),children:[(0,t.jsx)(f.SelectTrigger,{className:"h-8 w-auto min-w-[140px]",children:(0,t.jsx)("span",{className:"truncate",children:(v=er.find(e=>e.id===R))?v.alias?`${v.name} (${v.alias})`:v.name:""})}),(0,t.jsx)(f.SelectContent,{children:er.map(e=>(0,t.jsxs)(f.SelectItem,{value:e.id,children:[e.name,e.alias?` (${e.alias})`:""]},e.id))})]}),!em&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"relative ml-auto",children:[(0,t.jsx)(n.Search,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)("input",{type:"text",value:B,onChange:e=>z(e.target.value),placeholder:b("notes.searchPlaceholder"),className:"h-8 w-48 rounded-md border border-border bg-background pl-8 pr-3 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]}),(0,t.jsxs)(g.Button,{onClick:()=>{W(""),Q(""),Y(c.NOTE_CATEGORIES_PRESET[3]),ee(w),es(R),G(null),K(!0)},className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[(0,t.jsx)(a.Plus,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:b("notes.newNote")})]})]})]}),(0,t.jsx)("div",{className:"flex-1 overflow-hidden px-6 py-4 flex flex-col",children:em?(0,t.jsxs)("div",{className:"flex flex-col gap-4 flex-1 min-h-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[!F&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:b("notes.workspace")}),(0,t.jsxs)(f.Select,{value:Z,onValueChange:t=>t&&(t=>{if(t===Z)return;ee(t);let s=e.find(e=>e.id===t),a=s?.projects[0]??null;es(a?.id??null)})(t),children:[(0,t.jsx)(f.SelectTrigger,{className:"min-w-[140px] text-xs",children:(0,t.jsx)("span",{className:"truncate",children:e.find(e=>e.id===Z)?.name??Z})}),(0,t.jsx)(f.SelectContent,{children:e.map(e=>(0,t.jsx)(f.SelectItem,{value:e.id,children:e.name},e.id))})]})]}),!F&&el.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:b("notes.project")}),(0,t.jsxs)(f.Select,{value:et??"",onValueChange:e=>e&&es(e),children:[(0,t.jsx)(f.SelectTrigger,{className:"min-w-[160px] text-xs",children:(0,t.jsx)("span",{className:"truncate",children:(N=el.find(e=>e.id===et))?N.alias?`${N.name} (${N.alias})`:N.name:""})}),(0,t.jsx)(f.SelectContent,{children:el.map(e=>(0,t.jsxs)(f.SelectItem,{value:e.id,children:[e.name,e.alias?` (${e.alias})`:""]},e.id))})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:b("notes.categoryLabel")}),(0,t.jsxs)(f.Select,{value:X,onValueChange:e=>e&&Y(e),children:[(0,t.jsx)(f.SelectTrigger,{className:"min-w-[120px] text-xs",children:(0,t.jsx)("span",{className:"truncate",children:X})}),(0,t.jsx)(f.SelectContent,{children:c.NOTE_CATEGORIES_PRESET.map(e=>(0,t.jsx)(f.SelectItem,{value:e,children:e},e))})]})]})]}),(0,t.jsx)("input",{type:"text",value:q,onChange:e=>W(e.target.value),placeholder:b("notes.titlePlaceholder"),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),(0,t.jsx)(T,{value:J,onChange:Q}),(0,t.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,t.jsx)(g.Button,{variant:"outline",onClick:()=>{K(!1),G(null)},children:b("notes.cancel")}),(0,t.jsx)(g.Button,{onClick:F?eo:ec,disabled:!q.trim()||!F&&!et,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:b("notes.save")})]})]}):(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 gap-4",children:[(0,t.jsx)(p,{active:_,onSelect:L}),(0,t.jsx)(I.ScrollArea,{className:"flex-1 min-h-0",children:(0,t.jsxs)("div",{className:`relative ${y?"opacity-40 pointer-events-none":""} transition-opacity`,children:[y&&(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:(0,t.jsx)(r.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}),0===er.length?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-16 text-center",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:b("notes.noProject")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground/60",children:b("notes.noProjectHint")})]}):(0,t.jsx)(k,{notes:eu,onEdit:e=>{W(e.title),Q(e.content),Y(e.category),G(e),K(!1)},onDelete:ed,onPreview:U,onTaskClick:V})]})})]})}),(0,t.jsx)(E.NotePreviewDialog,{note:M,open:null!==M,onOpenChange:e=>{e||U(null)}}),(0,t.jsx)(P.TaskOverviewDrawer,{open:null!==D,onOpenChange:e=>{e||V(null)},taskId:D})]})}],497732)},244455,e=>{e.v(t=>Promise.all(["static/chunks/075e-zs_kgc_g.js"].map(t=>e.l(t))).then(()=>t(629495)))},800307,e=>{e.v(t=>Promise.all(["static/chunks/0zm4fvu.lntrp.js"].map(t=>e.l(t))).then(()=>t(267483)))}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,912505,e=>{"use strict";var t=e.i(289721),s=e.i(975157);e.s(["EmptyState",0,function({icon:e,title:r,description:a,action:n,className:l}){return(0,t.jsxs)("div",{className:(0,s.cn)("flex h-48 flex-col items-center justify-center gap-2 text-center",l),children:[e&&(0,t.jsx)(e,{className:"h-10 w-10 text-muted-foreground/40"}),(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:r}),a&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground/60",children:a}),n&&(0,t.jsx)("div",{className:"mt-2",children:n})]})}])},236967,e=>{"use strict";var t=e.i(289721),s=e.i(210702),r=e.i(538059),a=e.i(259846),n=e.i(645378),l=e.i(453889),i=e.i(487278),c=e.i(533499);let o=[{key:"notes",icon:n.FileText},{key:"assets",icon:l.FolderOpen},{key:"archive",icon:i.Archive}];e.s(["SubPageNav",0,function({workspaceId:e}){let{t:n}=(0,c.useI18n)(),l=(0,r.usePathname)(),i=o.find(e=>l.includes(`/${e.key}`))?.key;return(0,t.jsxs)("div",{className:"header-sm flex items-center gap-1 px-4",children:[(0,t.jsxs)(s.default,{href:`/workspaces/${e}`,className:"mr-2 inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:[(0,t.jsx)(a.ArrowLeft,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:n("archive.backToBoard")})]}),(0,t.jsx)("span",{className:"mr-2 h-4 w-px bg-border"}),o.map(r=>{let a=r.icon,l=i===r.key;return(0,t.jsxs)(s.default,{href:`/workspaces/${e}/${r.key}`,className:`inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs font-medium transition-colors ${l?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"}`,children:[(0,t.jsx)(a,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:n(`sidebar.${r.key}`)})]},r.key)})]})}])},388982,613272,e=>{"use strict";var t=e.i(514798);let s=(0,t.createServerReference)("40f36def1f9fcd5b092f8c06987d2d3b5794d20781",t.callServer,void 0,t.findSourceMapURL,"createNote");e.s(["createNote",0,s],388982);let r=(0,t.createServerReference)("4040fd5e9067d8880fb0bff6df48d38d31fd55db78",t.callServer,void 0,t.findSourceMapURL,"deleteNote");e.s(["deleteNote",0,r],613272)},497732,e=>{"use strict";var t=e.i(289721),s=e.i(965652),r=e.i(232545),a=e.i(400355),n=e.i(738690),l=e.i(236967),i=e.i(533499),c=e.i(685149),o=e.i(388982),d=e.i(514798);let x=(0,d.createServerReference)("60c9d6fa934ec141f76b963c25329967e923d198f3",d.callServer,void 0,d.findSourceMapURL,"updateNote");var u=e.i(613272);let m=(0,d.createServerReference)("605e05e2db7e6f592069bfeddbc1c18e9cd56e6c36",d.callServer,void 0,d.findSourceMapURL,"getProjectNotes");var h=e.i(975157);function p({active:e,onSelect:s}){let{t:r}=(0,i.useI18n)();return(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,t.jsx)("button",{onClick:()=>s("all"),className:(0,h.cn)("rounded-lg px-3 py-1 text-xs font-medium transition-colors","all"===e?"bg-primary/15 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent"),children:r("notes.allCategories")}),c.NOTE_CATEGORIES_PRESET.map(r=>(0,t.jsx)("button",{onClick:()=>s(r),className:(0,h.cn)("rounded-lg px-3 py-1 text-xs font-medium transition-colors",e===r?"bg-primary/15 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent"),children:r},r))]})}var f=e.i(519455),g=e.i(280027),j=e.i(645378),v=e.i(912505),N=e.i(464249),b=e.i(998626);let y=(0,e.i(572989).default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);e.i(254826);var S=e.i(309735);function w({note:e,onEdit:s,onDelete:r,onPreview:a,onTaskClick:n}){let{t:l}=(0,i.useI18n)(),c=e.content.slice(0,300);return(0,t.jsxs)("div",{className:"group relative rounded-lg border border-border bg-card p-4 transition-colors hover:border-border/80 hover:bg-accent/20",children:[(0,t.jsxs)("div",{className:"absolute right-3 top-3 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,t.jsx)(f.Button,{variant:"ghost",size:"icon-sm",onClick:()=>s(e),className:"text-muted-foreground","aria-label":l("notes.edit"),children:(0,t.jsx)(N.Pencil,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(f.Button,{variant:"ghost",size:"icon-sm",onClick:()=>r(e.id),className:"text-muted-foreground hover:text-rose-400","aria-label":l("notes.delete"),children:(0,t.jsx)(b.Trash2,{className:"h-3.5 w-3.5"})})]}),(0,t.jsx)("div",{className:"mb-2 pr-16",children:(0,t.jsx)("h3",{className:"truncate text-sm font-semibold text-foreground",children:e.title})}),(0,t.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-1.5",children:[(0,t.jsx)("span",{className:"inline-block rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:e.category}),e.taskId&&e.taskTitle&&(0,t.jsxs)("button",{type:"button",onClick:()=>e.taskId&&n?.(e.taskId),disabled:!n,className:`inline-flex max-w-[160px] items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary ${n?"cursor-pointer hover:bg-primary/15":"cursor-default"}`,title:e.taskTitle,children:[(0,t.jsx)(y,{className:"h-2.5 w-2.5 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.taskTitle})]})]}),(0,t.jsx)("button",{type:"button",onClick:()=>a?.(e),disabled:!a,className:`block w-full text-left ${a?"cursor-pointer":"cursor-default"}`,title:a?l("notes.previewNote"):void 0,children:(0,t.jsx)("div",{className:"max-h-24 overflow-hidden text-sm leading-relaxed text-muted-foreground",children:(0,t.jsx)(S.Streamdown,{children:c})})})]})}function k({notes:e,onEdit:s,onDelete:r,onPreview:a,onTaskClick:n}){let{t:l}=(0,i.useI18n)();return 0===e.length?(0,t.jsx)(v.EmptyState,{icon:j.FileText,title:l("notes.empty"),description:l("notes.emptyHint")}):(0,t.jsx)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:e.map(e=>(0,t.jsx)(w,{note:e,onEdit:s,onDelete:r,onPreview:a,onTaskClick:n},e.id))})}var C=e.i(624687);function T({value:e,onChange:s}){return(0,t.jsxs)("div",{className:"relative grid grid-cols-2 gap-4 flex-1 min-h-64",children:[(0,t.jsx)(C.Textarea,{value:e,onChange:e=>s(e.target.value),className:"absolute inset-0 w-1/2 pr-2 resize-none font-mono text-sm border rounded-md p-3 bg-background text-foreground border-border focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Write Markdown here..."}),(0,t.jsx)("div",{className:"absolute inset-0 left-1/2 pl-2",children:(0,t.jsx)("div",{className:"h-full overflow-y-auto border rounded-md p-3 border-border text-sm leading-relaxed",children:(0,t.jsx)(S.Streamdown,{children:e})})})]})}var E=e.i(997025),I=e.i(759684),P=e.i(605005);e.s(["NotesPageClient",0,function({allWorkspaces:e,initialWorkspaceId:d,initialProjectId:h,initialNotes:j}){let v,N,{t:b}=(0,i.useI18n)(),[y,S]=(0,s.useTransition)(),[w,C]=(0,s.useState)(d),[R,$]=(0,s.useState)(h),[O,A]=(0,s.useState)(j),[_,L]=(0,s.useState)("all"),[B,z]=(0,s.useState)(""),[M,U]=(0,s.useState)(null),[D,V]=(0,s.useState)(null),[F,G]=(0,s.useState)(null),[H,K]=(0,s.useState)(!1),[q,W]=(0,s.useState)(""),[J,Q]=(0,s.useState)(""),[X,Y]=(0,s.useState)(c.NOTE_CATEGORIES_PRESET[3]),[Z,ee]=(0,s.useState)(d),[et,es]=(0,s.useState)(h),er=e.find(e=>e.id===w),ea=er?.projects??[],en=e.find(e=>e.id===Z),el=en?.projects??[],ei=(0,s.useCallback)(e=>{e?S(async()=>{A(await m(e))}):A([])},[S]),ec=async()=>{et&&q.trim()&&(await (0,o.createNote)({title:q.trim(),content:J,category:X,projectId:et}),K(!1),et===R&&ei(R))},eo=async()=>{F&&q.trim()&&(await x(F.id,{title:q.trim(),content:J,category:X}),G(null),ei(R))},ed=async e=>{let t=O.find(t=>t.id===e);!t||confirm(b("notes.deleteConfirm",{title:t.title}))&&(await (0,u.deleteNote)(e),ei(R))},ex=B.trim().toLowerCase(),eu=O.filter(e=>"all"===_||e.category===_).filter(e=>!ex||e.title.toLowerCase().includes(ex)).map(e=>({id:e.id,title:e.title,content:e.content,category:e.category,updatedAt:new Date(e.updatedAt),taskId:e.taskId,taskTitle:e.task?.title??null})),em=H||null!==F;return(0,t.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,t.jsx)(l.SubPageNav,{workspaceId:w}),(0,t.jsxs)("div",{className:"header-sm flex items-center gap-3 px-6 py-2",children:[(0,t.jsxs)(g.Select,{value:w,onValueChange:t=>t&&(t=>{if(t===w)return;C(t);let s=e.find(e=>e.id===t),r=s?.projects[0]??null;$(r?.id??null),L("all"),ei(r?.id??null)})(t),children:[(0,t.jsx)(g.SelectTrigger,{className:"h-8 w-auto min-w-[120px]",children:(0,t.jsx)("span",{className:"truncate",children:e.find(e=>e.id===w)?.name??w})}),(0,t.jsx)(g.SelectContent,{children:e.map(e=>(0,t.jsx)(g.SelectItem,{value:e.id,children:e.name},e.id))})]}),ea.length>0&&(0,t.jsxs)(g.Select,{value:R??"",onValueChange:e=>e&&void(e!==R&&($(e),L("all"),ei(e))),children:[(0,t.jsx)(g.SelectTrigger,{className:"h-8 w-auto min-w-[140px]",children:(0,t.jsx)("span",{className:"truncate",children:(v=ea.find(e=>e.id===R))?v.alias?`${v.name} (${v.alias})`:v.name:""})}),(0,t.jsx)(g.SelectContent,{children:ea.map(e=>(0,t.jsxs)(g.SelectItem,{value:e.id,children:[e.name,e.alias?` (${e.alias})`:""]},e.id))})]}),!em&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"relative ml-auto",children:[(0,t.jsx)(n.Search,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)("input",{type:"text",value:B,onChange:e=>z(e.target.value),placeholder:b("notes.searchPlaceholder"),className:"h-8 w-48 rounded-md border border-border bg-background pl-8 pr-3 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]}),(0,t.jsxs)(f.Button,{onClick:()=>{W(""),Q(""),Y(c.NOTE_CATEGORIES_PRESET[3]),ee(w),es(R),G(null),K(!0)},className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[(0,t.jsx)(r.Plus,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:b("notes.newNote")})]})]})]}),(0,t.jsx)("div",{className:"flex-1 overflow-hidden px-6 py-4 flex flex-col",children:em?(0,t.jsxs)("div",{className:"flex flex-col gap-4 flex-1 min-h-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[!F&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:b("notes.workspace")}),(0,t.jsxs)(g.Select,{value:Z,onValueChange:t=>t&&(t=>{if(t===Z)return;ee(t);let s=e.find(e=>e.id===t),r=s?.projects[0]??null;es(r?.id??null)})(t),children:[(0,t.jsx)(g.SelectTrigger,{className:"min-w-[140px] text-xs",children:(0,t.jsx)("span",{className:"truncate",children:e.find(e=>e.id===Z)?.name??Z})}),(0,t.jsx)(g.SelectContent,{children:e.map(e=>(0,t.jsx)(g.SelectItem,{value:e.id,children:e.name},e.id))})]})]}),!F&&el.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:b("notes.project")}),(0,t.jsxs)(g.Select,{value:et??"",onValueChange:e=>e&&es(e),children:[(0,t.jsx)(g.SelectTrigger,{className:"min-w-[160px] text-xs",children:(0,t.jsx)("span",{className:"truncate",children:(N=el.find(e=>e.id===et))?N.alias?`${N.name} (${N.alias})`:N.name:""})}),(0,t.jsx)(g.SelectContent,{children:el.map(e=>(0,t.jsxs)(g.SelectItem,{value:e.id,children:[e.name,e.alias?` (${e.alias})`:""]},e.id))})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:b("notes.categoryLabel")}),(0,t.jsxs)(g.Select,{value:X,onValueChange:e=>e&&Y(e),children:[(0,t.jsx)(g.SelectTrigger,{className:"min-w-[120px] text-xs",children:(0,t.jsx)("span",{className:"truncate",children:X})}),(0,t.jsx)(g.SelectContent,{children:c.NOTE_CATEGORIES_PRESET.map(e=>(0,t.jsx)(g.SelectItem,{value:e,children:e},e))})]})]})]}),(0,t.jsx)("input",{type:"text",value:q,onChange:e=>W(e.target.value),placeholder:b("notes.titlePlaceholder"),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),(0,t.jsx)(T,{value:J,onChange:Q}),(0,t.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,t.jsx)(f.Button,{variant:"outline",onClick:()=>{K(!1),G(null)},children:b("notes.cancel")}),(0,t.jsx)(f.Button,{onClick:F?eo:ec,disabled:!q.trim()||!F&&!et,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:b("notes.save")})]})]}):(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 gap-4",children:[(0,t.jsx)(p,{active:_,onSelect:L}),(0,t.jsx)(I.ScrollArea,{className:"flex-1 min-h-0",children:(0,t.jsxs)("div",{className:`relative ${y?"opacity-40 pointer-events-none":""} transition-opacity`,children:[y&&(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:(0,t.jsx)(a.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}),0===ea.length?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-16 text-center",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:b("notes.noProject")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground/60",children:b("notes.noProjectHint")})]}):(0,t.jsx)(k,{notes:eu,onEdit:e=>{W(e.title),Q(e.content),Y(e.category),G(e),K(!1)},onDelete:ed,onPreview:U,onTaskClick:V})]})})]})}),(0,t.jsx)(E.NotePreviewDialog,{note:M,open:null!==M,onOpenChange:e=>{e||U(null)}}),(0,t.jsx)(P.TaskOverviewDrawer,{open:null!==D,onOpenChange:e=>{e||V(null)},taskId:D})]})}],497732)},244455,e=>{e.v(t=>Promise.all(["static/chunks/075e-zs_kgc_g.js"].map(t=>e.l(t))).then(()=>t(629495)))},800307,e=>{e.v(t=>Promise.all(["static/chunks/0zm4fvu.lntrp.js"].map(t=>e.l(t))).then(()=>t(267483)))}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,449636,e=>{"use strict";var t=e.i(289721),s=e.i(965652),r=e.i(533499),n=e.i(514798);let a=(0,n.createServerReference)("0071dfd5a1f5a0664caf5d4992d299f27fe650d0ec",n.callServer,void 0,n.findSourceMapURL,"getActiveExecutionsAcrossWorkspaces");var i=e.i(166407);let l=[{id:"1x1",label:"1Γ—1",cols:1,rows:1,minHeight:"480px",desc:"Focus mode"},{id:"2x1",label:"2Γ—1",cols:2,rows:1,minHeight:"480px",desc:"Side by side"},{id:"3x2",label:"3Γ—2",cols:3,rows:2,minHeight:"300px",desc:"Default"},{id:"2x2",label:"2Γ—2",cols:2,rows:2,minHeight:"300px",desc:"Balanced"},{id:"4x2",label:"4Γ—2",cols:4,rows:2,minHeight:"240px",desc:"Wide monitor"},{id:"3x3",label:"3Γ—3",cols:3,rows:3,minHeight:"240px",desc:"Max overview"}];var o=e.i(280027),c=e.i(519455),d=e.i(912505),u=e.i(572989);let m=(0,u.default)("rocket",[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]]);var x=e.i(360325),h=e.i(746798),p=e.i(56978);function f({cols:e,rows:s,active:r}){let n=Array.from({length:e*s});return(0,t.jsx)("div",{className:`grid gap-[1px] w-7 h-5 p-[3px] rounded-sm border shrink-0 ${r?"border-primary bg-primary/10":"border-border bg-muted"}`,style:{gridTemplateColumns:`repeat(${e}, 1fr)`,gridTemplateRows:`repeat(${s}, 1fr)`},children:n.map((e,s)=>(0,t.jsx)("div",{className:`rounded-[1px] min-w-0 min-h-0 ${r?"bg-primary":"bg-muted-foreground/40"}`},s))})}let g="custom";function b({value:e,customValue:n,onChange:a}){let{t:i}=(0,r.useI18n)(),[o,d]=(0,s.useState)(!1),u=(0,s.useRef)(null),m=e===g,x=m?null:l.find(t=>t.id===e)??l[2],[h,j]=(0,s.useState)(n?.cols??2),[v,k]=(0,s.useState)(n?.rows??2),[w,N]=(0,s.useState)({minCols:1,maxCols:5,minRows:1,maxRows:5});(0,s.useEffect)(()=>{(0,p.getConfigValues)(["missions.grid.minCols","missions.grid.maxCols","missions.grid.minRows","missions.grid.maxRows"]).then(e=>{N({minCols:e["missions.grid.minCols"]??1,maxCols:e["missions.grid.maxCols"]??5,minRows:e["missions.grid.minRows"]??1,maxRows:e["missions.grid.maxRows"]??5})})},[]),(0,s.useEffect)(()=>{n&&(j(n.cols),k(n.rows))},[n?.cols,n?.rows]),(0,s.useEffect)(()=>{if(o)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){u.current&&!u.current.contains(e.target)&&d(!1)}},[o]);let y=(e,t,s)=>Math.max(t,Math.min(s,e)),S=m?h:x?.cols??2,C=m?v:x?.rows??2,I=m?`${h}\xd7${v}`:x?.label??"";return(0,t.jsxs)("div",{ref:u,className:"relative",children:[(0,t.jsxs)(c.Button,{variant:"outline",onClick:()=>d(e=>!e),className:"gap-2",children:[(0,t.jsx)(f,{cols:S,rows:C,active:!1}),(0,t.jsx)("span",{children:I}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"β–Ό"})]}),o&&(0,t.jsxs)("div",{className:"absolute right-0 z-50 mt-1 w-72 rounded-lg border border-border bg-popover shadow-xl p-3",children:[(0,t.jsx)("h5",{className:"text-sm font-semibold text-foreground mb-3",children:i("missions.gridPreset")}),(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[l.map(s=>{let r=s.id===e;return(0,t.jsxs)("button",{onClick:()=>{a(s.id),d(!1)},className:`flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors ${r?"bg-primary/10":"hover:bg-accent"}`,children:[(0,t.jsx)(f,{cols:s.cols,rows:s.rows,active:r}),(0,t.jsx)("span",{className:`text-sm font-medium flex-1 text-left ${r?"text-primary":"text-foreground"}`,children:s.label}),(0,t.jsx)("span",{className:`text-xs ${r?"text-primary/60":"text-muted-foreground"}`,children:s.desc})]},s.id)}),(0,t.jsxs)("div",{className:"mt-1 border-t border-border pt-2",children:[(0,t.jsxs)("button",{onClick:()=>{m||a(g,{cols:h,rows:v})},className:`flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors w-full ${m?"bg-primary/10":"hover:bg-accent"}`,children:[(0,t.jsx)(f,{cols:h,rows:v,active:m}),(0,t.jsx)("span",{className:`text-sm font-medium flex-1 text-left ${m?"text-primary":"text-foreground"}`,children:i("missions.gridCustom")}),(0,t.jsxs)("span",{className:`text-xs ${m?"text-primary/60":"text-muted-foreground"}`,children:[h,"Γ—",v]})]}),m&&(0,t.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:i("missions.gridCols")}),(0,t.jsx)("input",{type:"number",min:w.minCols,max:w.maxCols,value:h,onChange:e=>{let t;j(t=y(Number(e.target.value),w.minCols,w.maxCols)),a(g,{cols:t,rows:v})},className:"h-7 w-14 rounded-md border border-border bg-background px-2 text-sm text-center"})]}),(0,t.jsx)("span",{className:"text-muted-foreground",children:"Γ—"}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:i("missions.gridRows")}),(0,t.jsx)("input",{type:"number",min:w.minRows,max:w.maxRows,value:v,onChange:e=>{let t;k(t=y(Number(e.target.value),w.minRows,w.maxRows)),a(g,{cols:h,rows:t})},className:"h-7 w-14 rounded-md border border-border bg-background px-2 text-sm text-center"})]})]})]})]})]})]})}var j=e.i(585012),v=e.i(670123),k=e.i(759684);let w="123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";function N(e,t,s){return t<=0?0:((e+s)%t+t)%t}function y({open:e,panes:n,selectedIndex:a,onSelect:i,onClose:l}){let{t:o}=(0,r.useI18n)();return((0,s.useEffect)(()=>{if(e)return window.addEventListener("keydown",t,{capture:!0}),()=>window.removeEventListener("keydown",t,{capture:!0});function t(e){if("Escape"===e.key){e.preventDefault(),e.stopPropagation(),l();return}if(e.metaKey||e.ctrlKey||e.altKey||/^[0-9]$/.test(e.key))return;let t=function(e){if(1!==e.length)return null;let t=w.indexOf(e.toUpperCase());return -1===t?null:t}(e.key);null===t||t>=n.length||(e.preventDefault(),e.stopPropagation(),i(t))}},[e,n.length,i,l]),!e||"u"<typeof document)?null:(0,j.createPortal)((0,t.jsxs)("div",{className:"fixed inset-0 z-50",children:[(0,t.jsx)("div",{className:"absolute inset-0 bg-black/10 supports-backdrop-filter:backdrop-blur-xs",onClick:l}),(0,t.jsxs)("div",{role:"dialog","aria-modal":"true",className:"fixed top-1/2 left-1/2 z-50 w-full max-w-[calc(100%-2rem)] sm:max-w-5xl -translate-x-1/2 -translate-y-1/2 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 outline-none",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 pr-8",children:[(0,t.jsx)("span",{className:"font-heading text-base font-medium leading-none",children:o("missions.selector.title")}),(0,t.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-mono font-medium text-muted-foreground",children:n.length}),(0,t.jsx)("span",{className:"ml-1 truncate text-xs text-muted-foreground",children:o("missions.selector.hint")})]}),(0,t.jsx)(c.Button,{variant:"ghost",size:"icon-sm",className:"absolute top-2 right-2",onClick:l,"aria-label":o("missions.launcher.cancel"),children:(0,t.jsx)(v.XIcon,{})}),(0,t.jsx)(k.ScrollArea,{className:"mt-4 max-h-[60vh]",children:(0,t.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3 pr-3",children:n.map((e,s)=>{let r=s<0||s>=w.length?null:w[s],n=s===a;return(0,t.jsxs)("button",{type:"button",onClick:()=>i(s),className:["flex flex-col gap-2 rounded-lg border bg-card p-3 text-left transition-all hover:border-primary/40 hover:bg-accent/50",n?"border-primary ring-2 ring-inset ring-primary":"border-border"].join(" "),children:[(0,t.jsxs)("span",{className:"truncate text-[11px] text-muted-foreground",children:[e.workspaceName," β€Ί"," ",e.projectAlias||e.projectName]}),(0,t.jsx)("div",{className:"flex items-center justify-center py-2",children:(0,t.jsx)("span",{className:["flex h-12 w-12 items-center justify-center rounded-md border text-2xl font-semibold tabular-nums",n?"bg-primary text-primary-foreground border-primary":"bg-muted/80 text-foreground border-border"].join(" "),children:r??"Β·"})}),(0,t.jsx)("span",{className:"line-clamp-2 text-sm font-medium text-foreground",children:e.taskTitle})]},e.executionId)})})})]})]}),document.body)}var S=e.i(720247),C=e.i(775712),I=e.i(19578),R=e.i(538059),T=e.i(67013);let E=(0,u.default)("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),M=(0,u.default)("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);var A=e.i(657153);let P=(0,u.default)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);var L=e.i(487486),$=e.i(502699),O=e.i(360112);let D=(0,I.default)(()=>e.A(243288).then(e=>e.TaskTerminal),{loadableGenerated:{modules:[346069]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"h-full w-full bg-[#0a0a0a] animate-pulse"})});function B({execution:e,isRemoving:n,removeReason:a,onStop:i,onSessionEnd:l,index:o,onRegisterControls:d}){let{t:u}=(0,r.useI18n)(),m=(0,R.useRouter)(),{attributes:x,listeners:p,setNodeRef:f,transform:g,transition:b}=(0,C.useSortable)({id:e.executionId}),j={transform:T.CSS.Transform.toString(g),transition:b,opacity:+!n},[v,k]=(0,s.useState)(()=>e.startedAt?Math.floor((Date.now()-new Date(e.startedAt).getTime())/1e3):0);(0,s.useEffect)(()=>{if(n)return;let t=setInterval(()=>{k(e.startedAt?Math.floor((Date.now()-new Date(e.startedAt).getTime())/1e3):0)},1e3);return()=>clearInterval(t)},[e.startedAt,n]);let w=Math.floor(v/60),N=`${w}m ${v%60}s`;async function y(){let t=e.worktreePath??e.projectLocalPath;if(!t)return;let s=e.subPath?`${t}/${e.subPath}`:t;try{await (0,$.openInTerminal)(s)}catch{O.toast.error(u("preview.terminalError"))}}return(0,t.jsxs)("div",{ref:f,style:j,"data-pane-index":o,className:"border border-border rounded-lg overflow-hidden flex flex-col transition-opacity duration-300",...x,children:[(0,t.jsxs)("div",{className:"h-10 px-3 flex items-center gap-1 border-b border-border bg-card shrink-0",children:[(0,t.jsx)("button",{...p,"aria-label":u("missions.dragHandle"),"aria-roledescription":"sortable",className:"cursor-grab text-muted-foreground hover:text-foreground mr-1",children:(0,t.jsx)(E,{className:"h-3.5 w-3.5"})}),(0,t.jsxs)("span",{className:"text-[11px] text-muted-foreground truncate flex-1",children:[e.workspaceName," β€Ί"," ",e.projectAlias||e.projectName," β€Ί"," ",(0,t.jsx)("span",{className:"text-foreground font-semibold",children:e.taskTitle})]}),n?(0,t.jsx)(L.Badge,{variant:"outline",className:"text-[11px] text-muted-foreground bg-muted ml-1 shrink-0",children:"stopped"===a?u("missions.statusStopped"):u("missions.statusCompleted")}):(0,t.jsx)(L.Badge,{variant:"outline",className:"text-[11px] text-primary border-primary/30 bg-primary/10 ml-1 shrink-0",children:u("missions.statusRunning")}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground ml-1 shrink-0",children:N}),e.projectLocalPath&&(0,t.jsxs)(h.Tooltip,{children:[(0,t.jsx)(h.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"ml-1 shrink-0 text-muted-foreground",onClick:y}),children:(0,t.jsx)(P,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(h.TooltipContent,{children:u("missions.openInTerminal")})]}),(0,t.jsxs)(h.Tooltip,{children:[(0,t.jsx)(h.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"ml-1 shrink-0 text-muted-foreground",onClick:()=>m.push(`/workspaces/${e.workspaceId}/tasks/${e.taskId}`)}),children:(0,t.jsx)(M,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(h.TooltipContent,{children:u("missions.openFullView")})]}),(0,t.jsxs)(h.Tooltip,{children:[(0,t.jsx)(h.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"destructive",size:"icon",className:"ml-1 shrink-0",onClick:()=>i(e.taskId),disabled:n}),children:(0,t.jsx)(A.X,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(h.TooltipContent,{children:u("missions.stopTask")})]})]}),(0,t.jsx)("div",{className:"relative flex-1 overflow-hidden",children:(0,t.jsx)(D,{taskId:e.taskId,worktreePath:e.worktreePath??e.projectLocalPath,onSessionEnd:t=>l?.(e.taskId,t),useCanvasRenderer:!0,onReady:t=>d(e.taskId,t)})})]})}var z=e.i(169751);let H=(0,n.createServerReference)("40f853112fcaa1cca93f27a775dd93d4463cca0dbf",n.callServer,void 0,n.findSourceMapURL,"getWorkspacesWithRecentTasks"),_=(0,n.createServerReference)("40d862f3200d9e4060d8c7f5ab39edb04fcfa1d5c1",n.callServer,void 0,n.findSourceMapURL,"getProjectTasks");var V=e.i(19825),W=e.i(608269),F=e.i(793479),U=e.i(776639),G=e.i(368490);let K=(0,u.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);var X=e.i(922541),q=e.i(738690);let J={TODO:"TODO",IN_PROGRESS:"Running",IN_REVIEW:"Review"},Q={LOW:"Low",MEDIUM:"Med",HIGH:"High",CRITICAL:"Crit"};function Y({status:e}){return(0,t.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${{TODO:"bg-slate-100 text-slate-600 dark:bg-slate-800 dark:text-slate-400",IN_PROGRESS:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",IN_REVIEW:"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400"}[e]??"bg-slate-100 text-slate-600"}`,children:J[e]??e})}function Z({task:e,isRunning:s,launchingId:r,onLaunchNew:n,onResume:a,t:i}){let l=e.executions?.[0]?.sessionId,o=r===e.id;return(0,t.jsxs)("div",{className:"group/task grid grid-cols-[minmax(0,1fr)_auto] items-center gap-2 px-3 py-1.5 hover:bg-accent/50 cursor-default",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:`text-sm truncate ${s?"italic text-muted-foreground":""}`,children:e.title}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mt-0.5",children:[(0,t.jsx)(Y,{status:e.status}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:Q[e.priority]??e.priority})]})]}),s?(0,t.jsx)("span",{className:"text-[10px] italic text-muted-foreground",children:i("missions.alreadyMonitored")}):(0,t.jsxs)("div",{className:"flex items-center gap-1 opacity-0 group-hover/task:opacity-100 transition-opacity",children:[l&&(0,t.jsxs)(c.Button,{variant:"outline",className:"h-6 px-2 text-xs",onClick:()=>a(e.id,l),disabled:o,title:i("missions.continueSession"),children:[(0,t.jsx)(X.RotateCcw,{className:"h-3 w-3 mr-1"}),i("missions.continueLabel")]}),(0,t.jsxs)(c.Button,{variant:"outline",className:"h-6 px-2 text-xs",onClick:()=>n(e.id),disabled:o,title:i("missions.launchNew"),children:[(0,t.jsx)(K,{className:"h-3 w-3 mr-1"}),o?"...":i("missions.launchNewLabel")]})]})]})}function ee({open:e,onOpenChange:n,onLaunchNew:a,onResume:i,runningTaskIds:l,launchingId:d}){let{t:u}=(0,r.useI18n)(),[m,x]=(0,s.useState)([]),[h,p]=(0,s.useState)(""),[f,g]=(0,s.useState)(""),[b,j]=(0,s.useState)([]),[v,w]=(0,s.useState)("");(0,s.useEffect)(()=>{e&&(p(""),g(""),j([]),w(""),H(100).then(x).catch(()=>O.toast.error(u("missions.error.launchFailed"))))},[e,u]),(0,s.useEffect)(()=>{f?_(f).then(e=>{j(e.filter(e=>"TODO"===e.status||"IN_PROGRESS"===e.status||"IN_REVIEW"===e.status))}).catch(()=>O.toast.error(u("missions.error.launchFailed"))):j([])},[f,u]);let N=(0,s.useMemo)(()=>{let e=[];for(let t of m)for(let s of t.projects)for(let r of s.tasks)("TODO"===r.status||"IN_PROGRESS"===r.status||"IN_REVIEW"===r.status)&&e.push({task:r,workspaceName:t.name,projectName:s.alias??s.name});return e},[m]),y=(0,s.useMemo)(()=>new z.default(N,{keys:["task.title"],threshold:.4,distance:200}),[N]),S=(0,s.useMemo)(()=>{let e=v.trim();return e?y.search(e,{limit:30}).map(e=>e.item):[]},[y,v]),C=v.trim().length>0,I=m.find(e=>e.id===h),R=I?.projects??[];return(0,t.jsx)(U.Dialog,{open:e,onOpenChange:n,children:(0,t.jsxs)(U.DialogContent,{className:"sm:max-w-2xl max-h-[80vh]",children:[(0,t.jsx)(U.DialogHeader,{children:(0,t.jsx)(U.DialogTitle,{children:u("missions.fullPickerTitle")})}),(0,t.jsxs)("div",{className:"flex flex-col gap-2 shrink-0",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(q.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,t.jsx)(F.Input,{value:v,onChange:e=>w(e.target.value),placeholder:u("missions.fullPicker.searchPlaceholder"),className:"pl-8 pr-8 h-8"}),v&&(0,t.jsx)(c.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 -translate-y-1/2 h-6 w-6",onClick:()=>w(""),"aria-label":u("missions.fullPicker.clearSearch"),children:(0,t.jsx)(A.X,{className:"h-3.5 w-3.5"})})]}),!C&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)(o.Select,{value:h,onValueChange:e=>{p(e??""),g("")},children:[(0,t.jsx)(o.SelectTrigger,{id:"full-picker-ws",className:"w-48 h-8",children:(0,t.jsx)("span",{className:"truncate",children:m.find(e=>e.id===h)?.name??u("missions.launcher.selectWorkspace")})}),(0,t.jsx)(o.SelectContent,{children:m.map(e=>(0,t.jsx)(o.SelectItem,{value:e.id,children:e.name},e.id))})]}),(0,t.jsxs)(o.Select,{value:f,onValueChange:e=>g(e??""),disabled:!h,children:[(0,t.jsx)(o.SelectTrigger,{id:"full-picker-proj",className:"w-48 h-8",children:(0,t.jsx)("span",{className:"truncate",children:R.find(e=>e.id===f)?.name??u("missions.launcher.selectProject")})}),(0,t.jsx)(o.SelectContent,{children:R.map(e=>(0,t.jsx)(o.SelectItem,{value:e.id,children:e.alias??e.name},e.id))})]})]})]}),(0,t.jsx)(k.ScrollArea,{className:"max-h-[60vh] -mx-2",children:C?0===S.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:u("missions.fullPicker.noSearchResults")}):S.map(e=>(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"px-3 pt-2 pb-0.5 text-[11px] text-muted-foreground",children:[e.workspaceName," Β· ",e.projectName]}),(0,t.jsx)(Z,{task:e.task,isRunning:l.has(e.task.id),launchingId:d,onLaunchNew:a,onResume:i,t:u})]},e.task.id)):0===b.length&&f?(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:u("missions.launcher.noTasks")}):0===b.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:u("missions.fullPickerHint")}):b.map(e=>(0,t.jsx)(Z,{task:e,isRunning:l.has(e.id),launchingId:d,onLaunchNew:a,onResume:i,t:u},e.id))})]})})}function et({open:e,onOpenChange:n,onLaunched:a,runningTaskIds:i=new Set,anchorRef:l}){let{t:o}=(0,r.useI18n)(),d=(0,s.useRef)(null),[u,m]=(0,s.useState)([]),[x,h]=(0,s.useState)(!1),[p,f]=(0,s.useState)(null),[g,b]=(0,s.useState)(!1),[j,v]=(0,s.useState)(new Set);(0,s.useEffect)(()=>{e&&(h(!0),H(5).then(m).catch(()=>O.toast.error(o("missions.error.launchFailed"))).finally(()=>h(!1)))},[e,o]);let w=(0,s.useMemo)(()=>u.filter(e=>e.projects.some(e=>e._count.tasks>0)),[u]),N=(0,s.useCallback)(e=>{v(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},[]);(0,s.useEffect)(()=>{if(e)return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t);function t(e){let t=e.target;if(d.current&&!d.current.contains(t)){if(l?.current&&l.current.contains(t))return;n(!1)}}},[e,n,l]);let y=(0,s.useCallback)(async e=>{try{f(e),await (0,V.startPtyExecution)(e,""),a(e),n(!1),b(!1)}catch{O.toast.error(o("missions.error.launchFailed"))}finally{f(null)}},[a,n,o]),S=(0,s.useCallback)(async(e,t)=>{try{f(e),await (0,W.resumePtyExecution)(e,t),a(e),n(!1),b(!1)}catch{O.toast.error(o("missions.error.launchFailed"))}finally{f(null)}},[a,n,o]),C=(0,s.useCallback)(()=>{n(!1),b(!0)},[n]);return e||g?(0,t.jsxs)(t.Fragment,{children:[e&&(0,t.jsxs)("div",{ref:d,className:"absolute right-0 z-50 mt-1 grid max-h-[480px] w-[28rem] grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden rounded-lg border border-border bg-popover shadow-xl",children:[(0,t.jsx)("div",{className:"px-3 py-2 border-b border-border",children:(0,t.jsx)("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:o("missions.pickerTitle")})}),(0,t.jsx)(k.ScrollArea,{children:x?(0,t.jsx)("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"Loading..."}):0===w.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:o("missions.noAvailableTasks")}):w.map(e=>{let s=j.has(e.id),r=e.projects.filter(e=>e._count.tasks>0);return(0,t.jsxs)("div",{children:[(0,t.jsxs)(c.Button,{variant:"ghost",onClick:()=>N(e.id),className:"flex h-auto w-full justify-start gap-1.5 rounded-none border-b border-border/50 px-3 py-1.5 hover:bg-accent",children:[(0,t.jsx)(G.ChevronRight,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform ${s?"":"rotate-90"}`}),(0,t.jsx)("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:e.name})]}),!s&&(0,t.jsx)("div",{className:"ml-[19px] mt-0.5 border-l border-border/50",children:r.map(e=>(0,t.jsxs)("div",{className:"py-0.5",children:[(0,t.jsx)("div",{className:"pl-3 pt-1.5 pb-1",children:(0,t.jsx)("span",{className:"text-xs font-medium text-foreground",children:e.alias??e.name})}),(0,t.jsx)("div",{className:"pl-3",children:e.tasks.map(e=>(0,t.jsx)(Z,{task:e,isRunning:i.has(e.id),launchingId:p,onLaunchNew:y,onResume:S,t:o},e.id))})]},e.id))})]},e.id)})}),(0,t.jsx)("div",{className:"border-t border-border",children:(0,t.jsx)(c.Button,{variant:"ghost",className:"w-full rounded-none text-xs text-primary font-medium",onClick:C,children:o("missions.showMoreTasks")})})]}),(0,t.jsx)(ee,{open:g,onOpenChange:b,onLaunchNew:y,onResume:S,runningTaskIds:i,launchingId:p})]}):null}e.i(508271);var es=e.i(841359);e.s(["MissionsClient",0,function({initialExecutions:e}){let{t:n}=(0,r.useI18n)(),[u,p]=(0,s.useState)(e),[f,g]=(0,s.useState)(()=>localStorage.getItem("missions-grid-preset")??"3x2"),[j,v]=(0,s.useState)(()=>{try{let e=localStorage.getItem("missions-grid-custom");if(e){let t=JSON.parse(e);if("number"==typeof t?.cols&&"number"==typeof t?.rows)return{cols:Math.max(1,Math.min(10,t.cols)),rows:Math.max(1,Math.min(10,t.rows))}}}catch{}return{cols:2,rows:2}}),[k,w]=(0,s.useState)(!1),[I,R]=(0,s.useState)(""),T=(0,s.useRef)(null),[E,M]=(0,s.useState)("input"),[A,P]=(0,s.useState)(0),L=(0,s.useRef)(new Map),$=(0,s.useRef)([]),D=(0,s.useRef)(2),z=(0,s.useRef)(A);z.current=A;let H=(0,s.useCallback)((e,t)=>{t?L.current.set(e,t):L.current.delete(e)},[]),[_,V]=(0,s.useState)(new Map),W=(0,s.useRef)(_);(0,s.useEffect)(()=>{W.current=_},[_]);let F=(0,s.useRef)(new Map),U=l.find(e=>e.id===f)??l[2],G="custom"===f?j.cols:U.cols,K="custom"===f?j.rows:U.rows,X=(0,s.useRef)(null),[q,J]=(0,s.useState)("480px");(0,s.useEffect)(()=>{let e=X.current;if(!e)return;let t=()=>{let t=(e.clientHeight-32-16*(K-1))/K;J(`${Math.max(t,200)}px`)};t();let s=new ResizeObserver(t);return s.observe(e),()=>s.disconnect()},[K]);let Q=(0,s.useCallback)((e,t)=>{e&&(g(e),localStorage.setItem("missions-grid-preset",e),"custom"===e&&t&&(v(t),localStorage.setItem("missions-grid-custom",JSON.stringify(t))))},[]),Y=(0,S.useSensors)((0,S.useSensor)(S.PointerSensor,{activationConstraint:{distance:8}})),Z=(0,s.useCallback)(e=>{let{active:t,over:s}=e;s&&t.id!==s.id&&p(e=>{let r=e.findIndex(e=>e.executionId===t.id),n=e.findIndex(e=>e.executionId===s.id);return(0,C.arrayMove)(e,r,n)})},[]),ee=(0,s.useCallback)((e,t)=>{if(W.current.has(e))return;V(s=>new Map([...s,[e,t]]));let s=setTimeout(()=>{p(t=>t.filter(t=>t.executionId!==e)),V(t=>{let s=new Map(t);return s.delete(e),s}),F.current.delete(e)},500);F.current.set(e,s)},[]);(0,s.useEffect)(()=>{let e=setInterval(async()=>{try{let e=await a();p(t=>{let s=W.current,{merged:r,goneIds:n}=function({prev:e,fresh:t,removingIds:s}){let r=new Set(t.map(e=>e.executionId)),n=[];e.forEach(e=>{r.has(e.executionId)||s.has(e.executionId)||n.push(e.executionId)});let a=e.filter(e=>r.has(e.executionId)||s.has(e.executionId)),i=new Set(e.map(e=>e.executionId));return{merged:[...a,...t.filter(e=>!i.has(e.executionId))],goneIds:n}}({prev:t,fresh:e,removingIds:new Set(s.keys())});return n.forEach(e=>ee(e,"completed")),r})}catch{}},4e3);return()=>clearInterval(e)},[ee]),(0,s.useEffect)(()=>{let e=F.current;return()=>{e.forEach(e=>clearTimeout(e))}},[]);let er=(0,s.useCallback)(async e=>{try{await (0,i.stopPtyExecution)(e),p(t=>{let s=t.find(t=>t.taskId===e);return s&&ee(s.executionId,"stopped"),t})}catch{O.toast.error(n("missions.error.stopFailed"))}},[ee,n]),en=(0,s.useCallback)((e,t)=>{p(t=>{let s=t.find(t=>t.taskId===e);return s&&ee(s.executionId,"completed"),t})},[ee]),ea=(0,s.useCallback)(e=>{a().then(e=>{p(t=>{let s=new Set(t.map(e=>e.executionId));return[...t,...e.filter(e=>!s.has(e.executionId))]})}).catch(()=>{})},[]),ei=(0,s.useCallback)(e=>{let t=$.current;e<0||e>=t.length||(t[e]?.focus(),P(e),M("input"),X.current?.querySelector(`[data-pane-index="${e}"]`)?.scrollIntoView({block:"nearest",inline:"nearest",behavior:"instant"}))},[]),el=(0,s.useCallback)(()=>{$.current[z.current]?.blur(),M("nav")},[]),eo=(0,s.useCallback)(()=>{ei(z.current)},[ei]),ec=(0,s.useCallback)(()=>{"input"===E?el():eo()},[E,el,eo]),ed=(0,s.useCallback)(()=>{let e=$.current.length;0!==e&&ei(N(z.current,e,1))},[ei]),eu=(0,s.useCallback)(()=>{let e=$.current.length;0!==e&&ei(N(z.current,e,-1))},[ei]),em=(0,s.useCallback)(e=>{let t=$.current.length;0!==t&&(M("nav"),P(s=>(function(e,t,s,r){if(s<=0)return 0;let n=Math.max(1,t);switch(r){case"left":return N(e,s,-1);case"right":return N(e,s,1);case"up":{let t=e-n;return t<0?e:t}case"down":{let t=e+n;return t>=s?e:t}default:return e}})(s,D.current,t,e)))},[]),ex=(0,s.useCallback)(e=>{let t=$.current.length;0!==t&&(M("nav"),P(s=>N(s,t,e)))},[]);(0,es.useActionShortcut)("missions.jump",e=>{let t=Number(e.key);Number.isInteger(t)&&t>=1&&ei(t-1)}),(0,es.useActionShortcut)("missions.moveSelection",e=>{em("ArrowUp"===e.key?"up":"ArrowDown"===e.key?"down":"ArrowLeft"===e.key?"left":"right")}),(0,es.useActionShortcut)("missions.cycle",()=>ex(1)),(0,es.useActionShortcut)("missions.cycleBack",()=>ex(-1)),(0,es.useActionShortcut)("missions.focus",()=>eo()),(0,es.useActionShortcut)("missions.next",()=>ed()),(0,es.useActionShortcut)("missions.prev",()=>eu()),(0,es.useActionShortcut)("missions.exit",()=>el()),(0,s.useEffect)(()=>{let e=X.current;if(!e)return;let t=e=>{let t=e.target,s=t?.closest("[data-pane-index]");if(!s)return;let r=Number(s.dataset.paneIndex);Number.isInteger(r)&&(P(r),M("input"))};return e.addEventListener("focusin",t),()=>e.removeEventListener("focusin",t)},[]);let eh=Array.from(new Map(u.map(e=>[e.workspaceId,e.workspaceName])).entries()).map(([e,t])=>({id:e,name:t})),ep=I?u.filter(e=>e.workspaceId===I):u;$.current=ep.map(e=>L.current.get(e.taskId)).filter(e=>!!e),D.current=G,(0,s.useEffect)(()=>{P(e=>{let t=ep.length;return 0===t?0:Math.min(e,t-1)})},[ep.length]);let ef=new Set(u.map(e=>e.taskId));return(0,t.jsxs)("div",{className:"flex h-full flex-col",children:[(0,t.jsxs)("div",{className:"header-sm shrink-0 px-4 flex items-center gap-3",children:[(0,t.jsx)("h1",{className:"text-base font-semibold",children:n("missions.pageTitle")}),(0,t.jsxs)(h.Tooltip,{children:[(0,t.jsxs)(h.TooltipTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",className:`h-7 gap-1.5 px-2 shrink-0 text-xs font-medium text-muted-foreground ${"nav"===E?"bg-accent text-foreground":""}`,onClick:ec,disabled:0===ep.length}),children:[(0,t.jsx)(x.Keyboard,{className:"h-3.5 w-3.5"}),"input"===E?n("missions.mode.input"):n("missions.mode.nav")]}),(0,t.jsx)(h.TooltipContent,{className:"max-w-xs",children:n("missions.mode.toggleHint")})]}),(0,t.jsxs)(o.Select,{value:I,onValueChange:e=>R(e??""),children:[(0,t.jsx)(o.SelectTrigger,{className:"w-36 h-8",children:(0,t.jsx)("span",{className:"truncate",children:I?eh.find(e=>e.id===I)?.name??n("missions.filterAll"):n("missions.filterAll")})}),(0,t.jsxs)(o.SelectContent,{children:[(0,t.jsx)(o.SelectItem,{value:"",children:n("missions.filterAll")}),eh.map(e=>(0,t.jsx)(o.SelectItem,{value:e.id,children:e.name},e.id))]})]}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(b,{value:f,customValue:j,onChange:Q}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(c.Button,{ref:T,onClick:()=>w(e=>!e),children:n("missions.launchTask")}),(0,t.jsx)(et,{open:k,onOpenChange:w,onLaunched:ea,runningTaskIds:ef,anchorRef:T})]})]}),(0,t.jsx)("div",{ref:X,className:"flex-1 overflow-auto min-h-0 p-4",children:0===ep.length&&0===_.size?(0,t.jsx)(d.EmptyState,{icon:m,title:n("missions.emptyTitle"),description:n("missions.emptyDesc"),className:"h-full",action:(0,t.jsx)(c.Button,{onClick:()=>w(!0),children:n("missions.launchTask")})}):(0,t.jsx)(S.DndContext,{id:"missions-dnd",sensors:Y,collisionDetection:S.closestCenter,onDragEnd:Z,children:(0,t.jsx)(C.SortableContext,{items:ep.map(e=>e.executionId),strategy:C.rectSortingStrategy,children:(0,t.jsx)("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${G}, 1fr)`,gridAutoRows:q},children:ep.map((e,s)=>(0,t.jsx)(B,{execution:e,isRemoving:_.has(e.executionId),removeReason:_.get(e.executionId),onStop:er,onSessionEnd:en,index:s,onRegisterControls:H},e.executionId))})})})}),(0,t.jsx)(y,{open:"nav"===E,panes:ep,selectedIndex:A,onSelect:ei,onClose:eo})]})}],449636)}]);
@@ -1,4 +1,4 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,465536,(e,t,r)=>{var s;"u">typeof __nccwpck_require__&&(__nccwpck_require__.ab="/ROOT/node_modules/.pnpm/next@16.2.1_@babel+core@7.29.0_@playwright+test@1.58.2_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/next/dist/compiled/os-browserify/"),(s={}).endianness=function(){return"LE"},s.hostname=function(){return"u">typeof location?location.hostname:""},s.loadavg=function(){return[]},s.uptime=function(){return 0},s.freemem=function(){return Number.MAX_VALUE},s.totalmem=function(){return Number.MAX_VALUE},s.cpus=function(){return[]},s.type=function(){return"Browser"},s.release=function(){return"u">typeof navigator?navigator.appVersion:""},s.networkInterfaces=s.getNetworkInterfaces=function(){return{}},s.arch=function(){return"javascript"},s.platform=function(){return"browser"},s.tmpdir=s.tmpDir=function(){return"/tmp"},s.EOL="\n",s.homedir=function(){return"/"},t.exports=s},930787,(e,t,r)=>{!function(){"use strict";var e={114:function(e){function t(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,s="",a=0,n=-1,o=0,i=0;i<=e.length;++i){if(i<e.length)r=e.charCodeAt(i);else if(47===r)break;else r=47;if(47===r){if(n===i-1||1===o);else if(n!==i-1&&2===o){if(s.length<2||2!==a||46!==s.charCodeAt(s.length-1)||46!==s.charCodeAt(s.length-2)){if(s.length>2){var l=s.lastIndexOf("/");if(l!==s.length-1){-1===l?(s="",a=0):a=(s=s.slice(0,l)).length-1-s.lastIndexOf("/"),n=i,o=0;continue}}else if(2===s.length||1===s.length){s="",a=0,n=i,o=0;continue}}t&&(s.length>0?s+="/..":s="..",a=2)}else s.length>0?s+="/"+e.slice(n+1,i):s=e.slice(n+1,i),a=i-n-1;n=i,o=0}else 46===r&&-1!==o?++o:o=-1}return s}var s={resolve:function(){for(var e,s,a="",n=!1,o=arguments.length-1;o>=-1&&!n;o--)o>=0?s=arguments[o]:(void 0===e&&(e=""),s=e),t(s),0!==s.length&&(a=s+"/"+a,n=47===s.charCodeAt(0));if(a=r(a,!n),n)if(a.length>0)return"/"+a;else return"/";return a.length>0?a:"."},normalize:function(e){if(t(e),0===e.length)return".";var s=47===e.charCodeAt(0),a=47===e.charCodeAt(e.length-1);return(0!==(e=r(e,!s)).length||s||(e="."),e.length>0&&a&&(e+="/"),s)?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0==arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var a=arguments[r];t(a),a.length>0&&(void 0===e?e=a:e+="/"+a)}return void 0===e?".":s.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r||(e=s.resolve(e))===(r=s.resolve(r)))return"";for(var a=1;a<e.length&&47===e.charCodeAt(a);++a);for(var n=e.length,o=n-a,i=1;i<r.length&&47===r.charCodeAt(i);++i);for(var l=r.length-i,c=o<l?o:l,d=-1,u=0;u<=c;++u){if(u===c){if(l>c){if(47===r.charCodeAt(i+u))return r.slice(i+u+1);else if(0===u)return r.slice(i+u)}else o>c&&(47===e.charCodeAt(a+u)?d=u:0===u&&(d=0));break}var m=e.charCodeAt(a+u);if(m!==r.charCodeAt(i+u))break;47===m&&(d=u)}var h="";for(u=a+d+1;u<=n;++u)(u===n||47===e.charCodeAt(u))&&(0===h.length?h+="..":h+="/..");return h.length>0?h+r.slice(i+d):(i+=d,47===r.charCodeAt(i)&&++i,r.slice(i))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),s=47===r,a=-1,n=!0,o=e.length-1;o>=1;--o)if(47===(r=e.charCodeAt(o))){if(!n){a=o;break}}else n=!1;return -1===a?s?"/":".":s&&1===a?"//":e.slice(0,a)},basename:function(e,r){if(void 0!==r&&"string"!=typeof r)throw TypeError('"ext" argument must be a string');t(e);var s,a=0,n=-1,o=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var i=r.length-1,l=-1;for(s=e.length-1;s>=0;--s){var c=e.charCodeAt(s);if(47===c){if(!o){a=s+1;break}}else -1===l&&(o=!1,l=s+1),i>=0&&(c===r.charCodeAt(i)?-1==--i&&(n=s):(i=-1,n=l))}return a===n?n=l:-1===n&&(n=e.length),e.slice(a,n)}for(s=e.length-1;s>=0;--s)if(47===e.charCodeAt(s)){if(!o){a=s+1;break}}else -1===n&&(o=!1,n=s+1);return -1===n?"":e.slice(a,n)},extname:function(e){t(e);for(var r=-1,s=0,a=-1,n=!0,o=0,i=e.length-1;i>=0;--i){var l=e.charCodeAt(i);if(47===l){if(!n){s=i+1;break}continue}-1===a&&(n=!1,a=i+1),46===l?-1===r?r=i:1!==o&&(o=1):-1!==r&&(o=-1)}return -1===r||-1===a||0===o||1===o&&r===a-1&&r===s+1?"":e.slice(r,a)},format:function(e){var t,r;if(null===e||"object"!=typeof e)throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return t=e.dir||e.root,r=e.base||(e.name||"")+(e.ext||""),t?t===e.root?t+r:t+"/"+r:r},parse:function(e){t(e);var r,s={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return s;var a=e.charCodeAt(0),n=47===a;n?(s.root="/",r=1):r=0;for(var o=-1,i=0,l=-1,c=!0,d=e.length-1,u=0;d>=r;--d){if(47===(a=e.charCodeAt(d))){if(!c){i=d+1;break}continue}-1===l&&(c=!1,l=d+1),46===a?-1===o?o=d:1!==u&&(u=1):-1!==o&&(u=-1)}return -1===o||-1===l||0===u||1===u&&o===l-1&&o===i+1?-1!==l&&(0===i&&n?s.base=s.name=e.slice(1,l):s.base=s.name=e.slice(i,l)):(0===i&&n?(s.name=e.slice(1,o),s.base=e.slice(1,l)):(s.name=e.slice(i,o),s.base=e.slice(i,l)),s.ext=e.slice(o,l)),i>0?s.dir=e.slice(0,i-1):n&&(s.dir="/"),s},sep:"/",delimiter:":",win32:null,posix:null};s.posix=s,e.exports=s}},r={};function s(t){var a=r[t];if(void 0!==a)return a.exports;var n=r[t]={exports:{}},o=!0;try{e[t](n,n.exports,s),o=!1}finally{o&&delete r[t]}return n.exports}s.ab="/ROOT/node_modules/.pnpm/next@16.2.1_@babel+core@7.29.0_@playwright+test@1.58.2_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/next/dist/compiled/path-browserify/",t.exports=s(114)}()},756502,e=>{"use strict";let t=(0,e.i(572989).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"}]]);e.s(["default",0,t])},914935,e=>{"use strict";var t=e.i(289721),r=e.i(965652),s=e.i(538059),a=e.i(210702),n=e.i(487278),o=e.i(232545),i=e.i(464249),l=e.i(998626),c=e.i(49007),d=e.i(902539),u=e.i(263938),m=e.i(645378),h=e.i(453889),x=e.i(572989);let p=(0,x.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 g=e.i(755146),f=e.i(759684),j=e.i(776639),b=e.i(746798),v=e.i(519455),w=e.i(793479),N=e.i(514798);let y=(0,N.createServerReference)("4092d91e17ecc8b9d804fe44cc6ba1c4b30220bd3d",N.callServer,void 0,N.findSourceMapURL,"createWorkspace"),k=(0,N.createServerReference)("606d63817790733987cad04de74b4c3d41d7065fa1",N.callServer,void 0,N.findSourceMapURL,"updateWorkspace"),C=(0,N.createServerReference)("40a96c0f2c1265c92ce7db1d2ffaed1b249956cd85",N.callServer,void 0,N.findSourceMapURL,"deleteWorkspace"),S=(0,N.createServerReference)("4040c9b07f2eb4fef73826c847a722f7e2a942bf80",N.callServer,void 0,N.findSourceMapURL,"reorderWorkspaces");var T=e.i(119063);let P=(0,N.createServerReference)("4030de70df142d2cb84decd359d55a09475bab253f",N.callServer,void 0,N.findSourceMapURL,"createLabel"),D=(0,N.createServerReference)("402be388a6bfb481b734ff5f0916e5f22ad4fe7bd0",N.callServer,void 0,N.findSourceMapURL,"deleteLabel");var O=e.i(889620),I=e.i(533499),M=e.i(360112),$=e.i(720247),A=e.i(775712),L=e.i(67013);let R=["πŸ“‹","πŸš€","🎯","πŸ’‘","πŸ”§","πŸ“¦","🎨","πŸ“Š","πŸ”¬","🌟","πŸ“","πŸ—οΈ"];function E({workspaces:e}){let i,l=(0,s.useRouter)(),c=(0,s.usePathname)(),{t:u}=(0,I.useI18n)(),[x,g]=(0,r.useState)(!1);(0,r.useEffect)(()=>{"true"===localStorage.getItem("sidebar-collapsed")&&g(!0)},[]);let[j,w]=(0,r.useState)(!1),[N,T]=(0,r.useState)(!1),[P,D]=(0,r.useState)(!1),[L,F]=(0,r.useState)(null),[W,U]=(0,r.useState)(""),[H,K]=(0,r.useState)(R[0]),[V,G]=(0,r.useState)(null),[q,X]=(0,r.useState)(e);(0,r.useEffect)(()=>{X(e)},[e]);let J=(0,$.useSensors)((0,$.useSensor)($.PointerSensor,{activationConstraint:{distance:8}})),Y=(0,r.useCallback)(t=>{let{active:r,over:s}=t;if(!s||r.id===s.id)return;let a=q.findIndex(e=>e.id===r.id),n=q.findIndex(e=>e.id===s.id);if(-1===a||-1===n)return;let o=(0,A.arrayMove)(q,a,n);X(o),S(o.map(e=>e.id)).then(()=>l.refresh()).catch(()=>{X(e),M.toast.error(u("sidebar.reorderError"))})},[q,e,l,u]),Z=c.split("/workspaces/")[1]?.split("/")[0],Q=(0,r.useCallback)(e=>{if(Z===e)return;let t=(0,O.getLastProjectId)(e);l.push(t?`/workspaces/${e}?projectId=${t}`:`/workspaces/${e}`)},[Z,l]),ee=(0,r.useCallback)(()=>{g(e=>{let t=!e;return localStorage.setItem("sidebar-collapsed",String(t)),t})},[]),et=(0,r.useCallback)(async()=>{if(!W.trim())return;let e=await y({name:W.trim(),description:H});U(""),K(R[0]),w(!1),l.refresh(),l.push(`/workspaces/${e.id}`)},[W,H,l]),er=(0,r.useCallback)(async()=>{W.trim()&&V&&(await k(V,{name:W.trim(),description:H}),U(""),T(!1),G(null),l.refresh())},[W,H,V,l]),es=(0,r.useCallback)(e=>{G(e.id),U(e.name),K(e.description&&R.includes(e.description)?e.description:R[0]),T(!0)},[]),ea=(0,r.useCallback)(async(t,r)=>{if(e.length<=1)return void M.toast.error(u("sidebar.lastWorkspaceError"));if(confirm(u("sidebar.deleteConfirm",{name:r})))try{await C(t),l.refresh(),Z===t&&l.push("/workspaces")}catch{M.toast.error(u("sidebar.lastWorkspaceError"))}},[Z,l,u,e.length]),en=(0,r.useCallback)(e=>{F(e),D(!0)},[]),eo=e=>e.description&&R.includes(e.description)?e.description:e.name.charAt(0).toUpperCase();if(x){let r;return(0,t.jsxs)("aside",{className:"flex h-screen w-14 flex-col items-center border-r border-border bg-sidebar py-3",children:[(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:ee,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,t.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-6 w-6 rounded"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:u("sidebar.expand")})]}),(0,t.jsx)(f.ScrollArea,{className:"flex-1 min-h-0",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-1 px-0.5 pt-1",children:[e.map(e=>{let r=Z===e.id,s=eo(e);return(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>Q(e.id),className:`flex h-9 w-9 items-center justify-center rounded-lg transition-all ${r?"ring-1 ring-primary/20 text-foreground cursor-default":"text-muted-foreground hover:text-foreground cursor-pointer"}`}),children:(0,t.jsx)("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-muted text-sm",children:R.includes(s)?s:(0,t.jsx)("span",{className:"text-xs font-semibold",children:s})})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:e.name})]},e.id)}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{"data-tour":"create-workspace",onClick:()=>w(!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,t.jsx)(o.Plus,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:u("sidebar.newWorkspace")})]})]})}),(0,t.jsxs)("div",{className:"mt-2 flex flex-col items-center gap-1",children:[(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>l.push("/missions"),className:`rounded-lg p-2 transition-colors ${"/missions"===c?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,t.jsx)(p,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:u("missions.navLabel")})]}),(r=Z||e[0]?.id)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>l.push(`/workspaces/${r}/notes`),className:`rounded-lg p-2 transition-colors ${c.includes("/notes")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,t.jsx)(m.FileText,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:u("sidebar.notes")})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>l.push(`/workspaces/${r}/assets`),className:`rounded-lg p-2 transition-colors ${c.includes("/assets")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,t.jsx)(h.FolderOpen,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:u("sidebar.assets")})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>l.push(`/workspaces/${r}/archive`),className:`rounded-lg p-2 transition-colors ${c.includes("/archive")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,t.jsx)(n.Archive,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:u("sidebar.archive")})]})]}):null]}),(0,t.jsx)(B,{open:j,onOpenChange:w,title:u("workspace.create"),name:W,onNameChange:U,icon:H,onIconChange:K,onSubmit:et,submitLabel:u("common.create"),nameLabel:u("workspace.name"),iconLabel:u("workspace.icon"),namePlaceholder:u("workspace.namePlaceholder"),cancelLabel:u("common.cancel")})]})}return(0,t.jsxs)("aside",{className:"noise relative flex h-screen w-56 flex-col border-r border-border bg-sidebar",children:[(0,t.jsxs)("div",{className:"relative z-10 flex items-center gap-3 px-4 py-4",children:[(0,t.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-9 w-9 rounded-lg"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("div",{className:"text-sm font-semibold tracking-tight text-foreground",children:"Tower"}),(0,t.jsx)("div",{className:"text-[10px] font-medium uppercase tracking-widest text-muted-foreground",children:"Studio"})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"icon-xs",onClick:ee,className:"text-muted-foreground",title:u("sidebar.collapse"),children:(0,t.jsx)(d.ChevronsLeft,{className:"h-4 w-4"})})]}),(0,t.jsxs)("div",{className:"relative z-10 flex items-center justify-between px-4 py-2",children:[(0,t.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:u("sidebar.workspace")}),(0,t.jsx)(v.Button,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground","data-tour":"create-workspace",onClick:()=>{U(""),K(R[0]),w(!0)},title:u("sidebar.newWorkspace"),children:(0,t.jsx)(o.Plus,{className:"h-3.5 w-3.5"})})]}),(0,t.jsx)(f.ScrollArea,{className:"relative z-10 mt-2 flex-1 min-h-0",children:(0,t.jsx)("div",{className:"px-2 py-1",children:(0,t.jsx)($.DndContext,{id:"workspace-sidebar",sensors:J,collisionDetection:$.closestCenter,onDragEnd:Y,children:(0,t.jsx)(A.SortableContext,{items:q.map(e=>e.id),strategy:A.verticalListSortingStrategy,children:q.map(e=>(0,t.jsx)(z,{ws:e,isActive:Z===e.id,icon:eo(e),disableDelete:q.length<=1,t:u,onSelect:()=>Q(e.id),onEdit:()=>es(e),onManageLabels:()=>en(e.id),onDelete:()=>ea(e.id,e.name)},e.id))})})})}),(0,t.jsxs)(a.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"===c?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,t.jsx)(p,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:u("missions.navLabel")})]}),(i=Z||e[0]?.id)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(a.default,{href:`/workspaces/${i}/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,t.jsx)(m.FileText,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:u("sidebar.notes")})]}),(0,t.jsxs)(a.default,{href:`/workspaces/${i}/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,t.jsx)(h.FolderOpen,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:u("sidebar.assets")})]}),(0,t.jsxs)(a.default,{href:`/workspaces/${i}/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,t.jsx)(n.Archive,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:u("sidebar.archive")})]})]}):null,(0,t.jsx)(B,{open:j,onOpenChange:w,title:u("workspace.create"),name:W,onNameChange:U,icon:H,onIconChange:K,onSubmit:et,submitLabel:u("common.create"),nameLabel:u("workspace.name"),iconLabel:u("workspace.icon"),namePlaceholder:u("workspace.namePlaceholder"),cancelLabel:u("common.cancel")}),(0,t.jsx)(B,{open:N,onOpenChange:e=>{T(e),e||G(null)},title:u("workspace.edit"),name:W,onNameChange:U,icon:H,onIconChange:K,onSubmit:er,submitLabel:u("common.save"),nameLabel:u("workspace.name"),iconLabel:u("workspace.icon"),namePlaceholder:u("workspace.namePlaceholder"),cancelLabel:u("common.cancel")}),L&&(0,t.jsx)(_,{open:P,onOpenChange:e=>{D(e),e||F(null)},workspaceId:L})]})}function z({ws:e,isActive:r,icon:s,disableDelete:a,t:n,onSelect:o,onEdit:d,onManageLabels:m,onDelete:h}){var x;let p,f,j,{attributes:b,listeners:v,setNodeRef:w,transform:N,transition:y,isDragging:k}=(0,A.useSortable)({id:e.id}),C={transform:L.CSS.Transform.toString(N),transition:y,opacity:k?.4:1};return(0,t.jsxs)("div",{ref:w,style:C,...b,...v,className:`group relative flex touch-none items-center rounded-lg transition-all ${r?"bg-accent ring-1 ring-primary/15":"hover:bg-accent/60"}`,children:[(0,t.jsxs)("button",{onClick:o,className:`flex flex-1 items-center gap-2.5 px-3 py-2.5 text-left ${r?"cursor-default":"cursor-pointer"}`,children:[(0,t.jsx)("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-muted text-sm",children:R.includes(s)?s:(0,t.jsx)("span",{className:"text-xs font-semibold text-muted-foreground",children:s})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:`truncate text-sm font-medium ${r?"text-foreground":"text-secondary-foreground"}`,children:e.name}),(0,t.jsx)("div",{className:"text-[11px] text-muted-foreground",children:(x=e.updatedAt,f=Math.floor((p=Date.now()-new Date(x).getTime())/6e4),j=Math.floor(p/36e5),f<60?`${f}m ago`:j<24?`${j}h ago`:`${Math.floor(j/24)}d ago`)})]})]}),(0,t.jsxs)(g.DropdownMenu,{children:[(0,t.jsx)(g.DropdownMenuTrigger,{render:(0,t.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:e=>e.stopPropagation()}),children:(0,t.jsx)(c.MoreHorizontal,{className:"h-3.5 w-3.5"})}),(0,t.jsxs)(g.DropdownMenuContent,{align:"start",side:"right",children:[(0,t.jsxs)(g.DropdownMenuItem,{onClick:d,children:[(0,t.jsx)(i.Pencil,{className:"mr-2 h-3.5 w-3.5"}),n("sidebar.rename")]}),(0,t.jsxs)(g.DropdownMenuItem,{onClick:m,children:[(0,t.jsx)(u.Tag,{className:"mr-2 h-3.5 w-3.5"}),n("sidebar.manageLabels")]}),(0,t.jsxs)(g.DropdownMenuItem,{className:a?"text-muted-foreground opacity-50":"text-rose-400",disabled:a,onClick:h,children:[(0,t.jsx)(l.Trash2,{className:"mr-2 h-3.5 w-3.5"}),n("sidebar.delete")]})]})]})]})}function B({open:e,onOpenChange:r,title:s,name:a,onNameChange:n,icon:o,onIconChange:i,onSubmit:l,submitLabel:c,nameLabel:d,iconLabel:u,namePlaceholder:m,cancelLabel:h}){return(0,t.jsx)(j.Dialog,{open:e,onOpenChange:r,disablePointerDismissal:!0,children:(0,t.jsxs)(j.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:s})}),(0,t.jsxs)("div",{className:"space-y-4 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:d}),(0,t.jsx)(w.Input,{placeholder:m,value:a,onChange:e=>n(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault(),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:u}),(0,t.jsx)("div",{className:"mt-1.5 grid grid-cols-6 gap-1.5",children:R.map(e=>(0,t.jsx)("button",{onClick:()=>i(e),className:`flex h-10 w-10 items-center justify-center rounded-lg text-lg transition-all ${o===e?"bg-primary/15 ring-2 ring-primary/30 scale-110":"bg-muted hover:bg-accent"}`,children:e},e))})]})]}),(0,t.jsxs)(j.DialogFooter,{children:[(0,t.jsx)(v.Button,{variant:"outline",onClick:()=>r(!1),children:h}),(0,t.jsx)(v.Button,{onClick:l,disabled:!a.trim(),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:c})]})]})})}let F=["#3b82f6","#ef4444","#f59e0b","#10b981","#8b5cf6","#ec4899","#06b6d4","#f97316"];function _({open:e,onOpenChange:s,workspaceId:a}){let{t:n}=(0,I.useI18n)(),[o,i]=(0,r.useState)([]),[l,c]=(0,r.useState)(""),[d,u]=(0,r.useState)(F[0]);(0,r.useEffect)(()=>{e&&(0,T.getLabelsForWorkspace)(a).then(i)},[e,a]);let m=async()=>{l.trim()&&(await P({name:l.trim(),color:d,workspaceId:a}),i(await (0,T.getLabelsForWorkspace)(a)),c(""))},h=async e=>{await D(e),i(t=>t.filter(t=>t.id!==e))};return(0,t.jsx)(j.Dialog,{open:e,onOpenChange:s,disablePointerDismissal:!0,children:(0,t.jsxs)(j.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:n("label.manage")})}),(0,t.jsxs)("div",{className:"space-y-3 py-2",children:[o.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"h-3 w-3 rounded-full",style:{backgroundColor:e.color}}),(0,t.jsx)("span",{className:"flex-1 text-sm text-foreground",children:e.name}),e.isBuiltin?(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:n("label.builtin")}):(0,t.jsx)("button",{onClick:()=>h(e.id),className:"text-xs text-rose-400 hover:text-rose-300",children:n("common.delete")})]},e.id)),(0,t.jsxs)("div",{className:"border-t border-border pt-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(w.Input,{placeholder:n("label.name"),value:l,onChange:e=>c(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault(),className:"flex-1 h-8"}),(0,t.jsx)(v.Button,{size:"sm",onClick:m,disabled:!l.trim(),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:n("label.add")})]}),(0,t.jsx)("div",{className:"mt-2 flex gap-1.5",children:F.map(e=>(0,t.jsx)("button",{onClick:()=>u(e),className:`h-5 w-5 rounded-full transition-all ${d===e?"ring-2 ring-offset-2 ring-offset-background ring-foreground/30 scale-110":""}`,style:{backgroundColor:e}},e))})]})]})]})})}e.i(508271);var W=e.i(841359),U=e.i(289813);let H=(0,U.create)(e=>({createProjectOpen:!1,importProjectOpen:!1,setCreateProjectOpen:t=>e({createProjectOpen:t}),setImportProjectOpen:t=>e({importProjectOpen:t})}));var K=e.i(821957),V=e.i(738690),G=e.i(386343);let q=(0,x.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 X=e.i(242941),J=e.i(989548),Y=e.i(387091),Z=e.i(15299);e.s([],678787),e.i(678787),e.i(708878);var Q=e.i(581263),ee=e.i(462902);let et=r.createContext(void 0);function er(){let e=r.useContext(et);if(void 0===e)throw Error((0,ee.default)(13));return e}let es={imageLoadingStatus:()=>null},ea=r.forwardRef(function(e,s){let{className:a,render:n,...o}=e,[i,l]=r.useState("idle"),c=r.useMemo(()=>({imageLoadingStatus:i,setImageLoadingStatus:l}),[i,l]),d=(0,Q.useRenderElement)("span",e,{state:{imageLoadingStatus:i},ref:s,props:o,stateAttributesMapping:es});return(0,t.jsx)(et.Provider,{value:c,children:d})});var en=e.i(887642),eo=e.i(804849),ei=e.i(504068),el=e.i(809058),ec=e.i(193214),ed=e.i(954588);let eu={...es,...el.transitionStatusMapping},em=r.forwardRef(function(e,t){let{className:s,render:a,onLoadingStatusChange:n,referrerPolicy:o,crossOrigin:i,...l}=e,c=er(),d=function(e,{referrerPolicy:t,crossOrigin:s}){let[a,n]=r.useState("idle");return(0,eo.useIsoLayoutEffect)(()=>{if(!e)return n("error"),ed.NOOP;let r=!0,a=new window.Image,o=e=>()=>{r&&n(e)};return n("loading"),a.onload=o("loaded"),a.onerror=o("error"),t&&(a.referrerPolicy=t),a.crossOrigin=s??null,a.src=e,()=>{r=!1}},[e,s,t]),a}(e.src,{referrerPolicy:o,crossOrigin:i}),u="loaded"===d,{mounted:m,transitionStatus:h,setMounted:x}=(0,ec.useTransitionStatus)(u),p=r.useRef(null),g=(0,en.useStableCallback)(e=>{n?.(e),c.setImageLoadingStatus(e)});(0,eo.useIsoLayoutEffect)(()=>{"idle"!==d&&g(d)},[d,g]),(0,ei.useOpenChangeComplete)({open:u,ref:p,onComplete(){u||x(!1)}});let f=(0,Q.useRenderElement)("img",e,{state:{imageLoadingStatus:d,transitionStatus:h},ref:[t,p],props:l,stateAttributesMapping:eu,enabled:m});return m?f:null});var eh=e.i(161476);let ex=r.forwardRef(function(e,t){let{className:s,render:a,delay:n,...o}=e,{imageLoadingStatus:i}=er(),[l,c]=r.useState(void 0===n),d=(0,eh.useTimeout)();return r.useEffect(()=>(void 0!==n&&d.start(n,()=>c(!0)),d.clear),[d,n]),(0,Q.useRenderElement)("span",e,{state:{imageLoadingStatus:i},ref:t,props:o,stateAttributesMapping:es,enabled:"loaded"!==i&&l})});e.s(["Fallback",0,ex,"Image",0,em,"Root",0,ea],129448);var ep=e.i(129448),ep=ep,eg=e.i(975157);function ef({className:e,size:r="default",...s}){return(0,t.jsx)(ep.Root,{"data-slot":"avatar","data-size":r,className:(0,eg.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",e),...s})}function ej({className:e,...r}){return(0,t.jsx)(ep.Fallback,{"data-slot":"avatar-fallback",className:(0,eg.cn)("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",e),...r})}let eb=(0,x.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 ev=e.i(226145);let ew=(0,x.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"}]]),eN=(0,x.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 ey=e.i(657153);let ek=(0,N.createServerReference)("60df8b59eb56eb5823f81294a8e3a9a67a737d9875",N.callServer,void 0,N.findSourceMapURL,"globalSearch");var eC=e.i(541022);let eS=[{id:"all",key:"search.all",icon:V.Search},{id:"task",key:"search.task",icon:m.FileText},{id:"project",key:"search.project",icon:eb},{id:"repository",key:"search.repository",icon:ev.GitBranch},{id:"note",key:"search.note",icon:ew},{id:"asset",key:"search.asset",icon:eN}],eT=["task","project","repository","note","asset"],eP={task:"search.task",project:"search.project",repository:"search.repository",note:"search.note",asset:"search.asset"};function eD({result:e,onSelect:r}){let s=eS.find(t=>t.id===e.type)?.icon??m.FileText;return(0,t.jsxs)("button",{onClick:()=>r(e),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,t.jsx)("div",{className:"rounded-md bg-muted p-1.5",children:(0,t.jsx)(s,{className:"h-3.5 w-3.5 text-muted-foreground"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"text-sm font-medium text-foreground truncate",children:e.title}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.subtitle}),e.snippet&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground/70 truncate mt-0.5",children:e.snippet})]})]})}function eO({open:e,onOpenChange:a}){let n,{t:o}=(0,I.useI18n)(),i=(0,s.useRouter)(),[l,c]=(0,r.useState)(""),[d,u]=(0,r.useState)("all"),[m,h]=(0,r.useState)([]),[x,p]=(0,r.useState)(!1),[g,b]=(0,r.useState)(250),w=(0,r.useRef)(null),N=(0,r.useRef)(null);(0,r.useEffect)(()=>{e&&((0,eC.getConfigValue)("search.debounceMs",250).then(b),setTimeout(()=>w.current?.focus(),100),c(""),h([]))},[e]),(0,r.useEffect)(()=>{if(N.current&&clearTimeout(N.current),!l.trim()){h([]),p(!1);return}p(!0);let e=!1;return N.current=setTimeout(async()=>{let t=await ek(l,d);e||(h(t),p(!1))},g),()=>{N.current&&clearTimeout(N.current),e=!0}},[l,d,g]);let y=(0,r.useCallback)(e=>{i.push(e.navigateTo),a(!1)},[i,a]);return(0,t.jsx)(j.Dialog,{open:e,onOpenChange:a,children:(0,t.jsxs)(j.DialogContent,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden !top-[10vh] !-translate-y-0",showCloseButton:!1,children:[(0,t.jsxs)("div",{className:"flex items-center border-b border-border px-4",children:[(0,t.jsx)(V.Search,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsx)("input",{ref:w,value:l,onChange:e=>c(e.target.value),placeholder:o("search.placeholder"),className:"flex-1 bg-transparent px-3 py-3.5 text-sm text-foreground placeholder-muted-foreground outline-none"}),l&&(0,t.jsx)(v.Button,{variant:"ghost",size:"icon",onClick:()=>{c(""),h([])},className:"text-muted-foreground",children:(0,t.jsx)(ey.X,{className:"h-3.5 w-3.5"})})]}),(0,t.jsx)("div",{className:"flex items-center gap-1 border-b border-border px-4 py-2",children:eS.map(e=>{let r=e.icon;return(0,t.jsxs)("button",{onClick:()=>u(e.id),className:`flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-all ${d===e.id?"bg-primary/10 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent hover:text-foreground"}`,children:[(0,t.jsx)(r,{className:"h-3 w-3"}),o(e.key)]},e.id)})}),(0,t.jsxs)(f.ScrollArea,{className:"max-h-80",children:[!l.trim()&&(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:o("search.typeToSearch")}),l.trim()&&0===m.length&&!x&&(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:o("search.noResults")}),"all"===d&&m.length>0&&(n=m.reduce((e,t)=>((e[t.type]??=[]).push(t),e),{}),eT.filter(e=>n[e]?.length).map(e=>(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"px-4 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50",children:o(eP[e])}),n[e].map(e=>(0,t.jsx)(eD,{result:e,onSelect:y},`${e.type}-${e.id}`))]},e))),"all"!==d&&m.map(e=>(0,t.jsx)(eD,{result:e,onSelect:y},`${e.type}-${e.id}`))]})]})})}var eI=e.i(338187),eM=e.i(400355),e$=e.i(597746),eA=e.i(938499),eL=e.i(233274),eR=e.i(905455),eE=e.i(624687);function ez(e){return e.replace(/\.git\/?$/,"")}e.i(465536),e.i(930787);let eB=(0,N.createServerReference)("402f41b94dc40a13d9b48c81b8ebc4c349935d9934",N.callServer,void 0,N.findSourceMapURL,"resolveGitLocalPath");var eF=e.i(327293),e_=e.i(224277);function eW({open:e,onOpenChange:s,onCreateProject:a}){let{t:n,locale:o}=(0,I.useI18n)(),[i,l]=(0,r.useState)(""),[c,d]=(0,r.useState)(""),[u,m]=(0,r.useState)(""),[x,p]=(0,r.useState)(""),[g,f]=(0,r.useState)(""),[N,y]=(0,r.useState)(!1),[k,C]=(0,r.useState)("FRONTEND"),[S,T]=(0,r.useState)("idle"),[P,D]=(0,r.useState)(""),[O,$]=(0,r.useState)(!1),[A,L]=(0,r.useState)(!1),R=()=>{l(""),d(""),m(""),p(""),f(""),y(!1),C("FRONTEND"),T("idle"),D(""),$(!1)},E=async()=>{if(g.trim()&&!O&&"success"===S){$(!0);try{let e=await (0,eF.analyzeProjectDirectory)(g.trim(),o);m(e)}catch{M.toast.error(n("project.analyzeError"))}finally{$(!1)}}},z=async e=>{p(e),T("idle"),D("");let t=function(e){let t,r=e.match(/^git@([^:]+):(.+)$/);if(r)return{host:r[1],pathSegments:ez(r[2]).split("/").filter(Boolean)};try{t=new URL(e)}catch{return null}return{host:t.hostname,pathSegments:ez(decodeURIComponent(t.pathname)).split("/").filter(Boolean)}}(e);t&&t.pathSegments.length>0&&l(t.pathSegments[t.pathSegments.length-1]),N||f(await eB(e))},B=async()=>{if(x.trim()&&g.trim()){T("cloning"),D("");try{let e=function(e){let t=e.trim();if(!t)return"";if(t.startsWith("git@")||t.startsWith("ssh://")||t.endsWith(".git"))return t;try{let e=new URL(t),r=e.hostname,s=decodeURIComponent(e.pathname).split("/").filter(Boolean);if("code.iflytek.com"===r){let e=[...s];"osc"===e[0]&&"_source"===e[1]&&(e=e.slice(2));let a=e.indexOf("-");if(a>0&&(e=e.slice(0,a)),0===e.length)return t;return`https://${r}/${e.join("/")}.git`}return`${e.origin}${e.pathname.replace(/\/$/,"")}.git`}catch{return t}}(x.trim()),t=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clone",url:e,path:g.trim()})}),r=await t.json();if(!t.ok){T("error"),D(r.error||"Clone failed");return}T("success")}catch{T("error"),D("Network error")}}},F=async()=>{i.trim()&&(await a?.({name:i.trim(),alias:c.trim()||void 0,description:u.trim()||void 0,gitUrl:x.trim()||void 0,localPath:g.trim()||void 0,projectType:k}),R(),s(!1))};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.Dialog,{open:e,onOpenChange:e=>{s(e),e||R()},disablePointerDismissal:!0,children:(0,t.jsxs)(j.DialogContent,{style:{maxWidth:"32rem"},children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:n("topbar.newProject")})}),(0,t.jsxs)("div",{className:"space-y-4 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.gitUrl")}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:n("project.gitUrlHint")}),(0,t.jsx)(w.Input,{placeholder:n("project.gitPlaceholder"),value:x,onChange:e=>z(e.target.value),className:"mt-1.5 font-mono text-xs"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.localPath")}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:n("project.localPathHint")}),(0,t.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,t.jsx)(w.Input,{placeholder:n("project.localPathPlaceholder"),value:g,onChange:e=>{f(e.target.value),y(!0)},className:"flex-1 min-w-0 font-mono text-xs"}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsxs)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{type:"button",variant:"outline",onClick:()=>L(!0),className:"shrink-0 gap-1.5 px-2.5 text-xs text-muted-foreground"}),children:[(0,t.jsx)(h.FolderOpen,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:n("folder.browse")})]}),(0,t.jsx)(b.TooltipContent,{children:n("folder.selectFolder")})]})]}),g.trim().startsWith("~")&&(0,t.jsxs)("p",{className:"mt-1 flex items-center gap-1 text-[11px] text-amber-400",children:[(0,t.jsx)(eA.AlertCircle,{className:"h-3 w-3"}),n("project.tildeWarning")]}),x.trim()&&g.trim()&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,t.jsxs)(v.Button,{type:"button",disabled:"cloning"===S||"success"===S,onClick:B,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"===S?(0,t.jsx)(eM.Loader2,{className:"h-3 w-3 animate-spin"}):"success"===S?(0,t.jsx)(e$.Check,{className:"h-3 w-3"}):(0,t.jsx)(ev.GitBranch,{className:"h-3 w-3"}),"cloning"===S?n("git.cloning"):"success"===S?n("git.cloned"):n("git.clone")]}),"error"===S&&(0,t.jsxs)("span",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,t.jsx)(eA.AlertCircle,{className:"h-3 w-3"}),P]}),"success"===S&&(0,t.jsx)("span",{className:"text-[11px] text-emerald-400",children:n("git.cloneSuccess")})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.name")}),(0,t.jsx)(w.Input,{placeholder:n("project.namePlaceholder"),value:i,onChange:e=>l(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.type.label")}),(0,t.jsx)("div",{className:"mt-1.5",children:(0,t.jsx)(eR.SegmentedControl,{options:[{value:"FRONTEND",label:n("project.type.frontend")},{value:"BACKEND",label:n("project.type.backend")}],value:k,onChange:C})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.alias")}),(0,t.jsx)(w.Input,{placeholder:n("project.aliasPlaceholder"),value:c,onChange:e=>d(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mt-0.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.description")}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsxs)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{type:"button",variant:"ghost",onClick:E,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!g.trim()||O?"opacity-50":""}`}),children:[O?(0,t.jsx)(eM.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(eL.Sparkles,{className:"h-3 w-3"}),O?n("project.analyzing"):n("project.genDesc")]}),(0,t.jsx)(b.TooltipContent,{children:g.trim()?"success"!==S?n("project.genDescNotCloned"):n("project.genDescReady"):n("project.genDescNoPath")})]})]}),(0,t.jsx)(eE.Textarea,{placeholder:n("project.descPlaceholder"),value:u,onChange:e=>m(e.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,t.jsxs)(j.DialogFooter,{children:[(0,t.jsx)(v.Button,{variant:"outline",onClick:()=>{s(!1),R()},children:n("common.cancel")}),(0,t.jsx)(v.Button,{onClick:F,disabled:!i.trim()||O,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:n("common.create")})]})]})}),(0,t.jsx)(e_.FolderBrowserDialog,{open:A,onOpenChange:L,onSelect:e=>{if(f(e),y(!0),!i.trim()){let t=e.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean).pop()??"";t&&l(t)}}})]})}var eU=e.i(756502),eU=eU,eH=e.i(699375);let eK=(0,N.createServerReference)("60e86293213deff9b6ad202299a44d1aac6ade5ea5",N.callServer,void 0,N.findSourceMapURL,"migrateProjectPath"),eV=(0,N.createServerReference)("40c34bf6c0b511ce7696a224456f1439e308c82cf8",N.callServer,void 0,N.findSourceMapURL,"checkMigrationSafety");function eG({open:e,onOpenChange:s,onCreateProject:a}){let{t:n,locale:o}=(0,I.useI18n)(),[i,l]=(0,r.useState)(""),[c,d]=(0,r.useState)(""),[u,m]=(0,r.useState)(""),[x,p]=(0,r.useState)(""),[g,f]=(0,r.useState)(""),[N,y]=(0,r.useState)(!1),[k,C]=(0,r.useState)("FRONTEND"),[S,T]=(0,r.useState)(!1),[P,D]=(0,r.useState)(!1),[O,$]=(0,r.useState)(""),[A,L]=(0,r.useState)(!1),[R,E]=(0,r.useState)(""),[z,B]=(0,r.useState)(""),[F,_]=(0,r.useState)(!1),[W,U]=(0,r.useState)(!1),H=()=>{l(""),d(""),m(""),p(""),f(""),C("FRONTEND"),T(!1),D(!1),$(""),L(!1),E(""),B(""),_(!1),U(!1)},K=async e=>{f(e),T(!1),D(!1),$(""),E(""),B(""),_(!1),l(e.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean).pop()??"");try{let t=await fetch(`/api/git?path=${encodeURIComponent(e)}`);if(t.ok){let e=await t.json();if(e.isGit&&e.remoteUrl){p(e.remoteUrl),T(!0);let t=e.remoteUrl.match(/\/([^/]+?)(?:\.git)?$/);t&&l(t[1])}}}catch{}},V=(0,r.useCallback)(async e=>{if(D(e),E(""),B(""),_(!1),!e)return void $("");if(x)try{let e=await eB(x);e&&($(e),e===g&&_(!0))}catch{}if(g)try{let e=await fetch(`/api/git?path=${encodeURIComponent(g)}&checkWorktrees=true`);e.ok&&(await e.json()).hasWorktrees&&B(n("project.worktreeWarning"))}catch{}},[x,g]),G=async()=>{if(g&&!W){U(!0);try{let e=await (0,eF.analyzeProjectDirectory)(g.trim(),o);m(e)}catch{M.toast.error(n("project.analyzeError"))}finally{U(!1)}}},q=async()=>{if(!i.trim())return;let e={name:i.trim(),alias:c.trim()||void 0,description:u.trim()||void 0,gitUrl:x.trim()||void 0,localPath:g.trim()||void 0,projectType:k},t=await a?.(e);if(P&&O&&O!==g&&t&&"id"in t){L(!0),E("");try{let e=await eV(t.id);if(!e.safe)return void E(e.reason);let r=await eK(t.id,O);if(!r.success)return void E(r.error??n("project.migrateError"));M.toast.success(n("project.migrateSuccess"))}catch(t){let e=t instanceof Error?t.message:String(t);E(`${n("project.migrateError")}:${e}`);return}finally{L(!1)}}H(),s(!1)},X=!i.trim()||!g.trim()||A||W||P&&!!z;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.Dialog,{open:e,onOpenChange:e=>{s(e),e||H()},disablePointerDismissal:!0,children:(0,t.jsxs)(j.DialogContent,{style:{maxWidth:"32rem"},children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:n("topbar.importProject")})}),(0,t.jsxs)("div",{className:"space-y-4 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.localPath")}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:n("project.importHint")}),(0,t.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,t.jsx)(w.Input,{value:g,readOnly:!0,placeholder:n("project.localPathPlaceholder"),className:"flex-1 font-mono text-xs bg-muted/30"}),(0,t.jsxs)(v.Button,{type:"button",variant:"outline",onClick:()=>y(!0),className:"shrink-0 gap-1.5",children:[(0,t.jsx)(h.FolderOpen,{className:"h-3.5 w-3.5"}),n("folder.browse")]})]}),S&&(0,t.jsx)("p",{className:"mt-1.5 text-[11px] text-emerald-400",children:n("project.autoDetected")})]}),x&&(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.gitUrl")}),(0,t.jsx)(w.Input,{value:x,onChange:e=>p(e.target.value),className:"mt-1.5 font-mono text-xs"})]}),S&&g&&(0,t.jsxs)("div",{className:"rounded-md border border-border p-3 space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:n("project.migrate")}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:n("project.migrateHint")})]}),(0,t.jsx)(eH.Switch,{checked:P,onCheckedChange:e=>V(e)})]}),P&&(0,t.jsxs)("div",{className:"space-y-2 pt-1",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-[10px] font-medium text-muted-foreground",children:n("project.targetPath")}),(0,t.jsx)(w.Input,{value:O,onChange:e=>{$(e.target.value),_(e.target.value===g)},placeholder:"/path/to/canonical/location",className:"mt-1 font-mono text-xs"})]}),F&&(0,t.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-sky-400",children:[(0,t.jsx)(eU.default,{className:"h-3 w-3"}),n("project.samePathInfo")]}),z&&(0,t.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-amber-400",children:[(0,t.jsx)(eA.AlertCircle,{className:"h-3 w-3"}),z]}),R&&(0,t.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,t.jsx)(eA.AlertCircle,{className:"h-3 w-3"}),R]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.name")}),(0,t.jsx)(w.Input,{placeholder:n("project.namePlaceholder"),value:i,onChange:e=>l(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.type.label")}),(0,t.jsx)("div",{className:"mt-1.5",children:(0,t.jsx)(eR.SegmentedControl,{options:[{value:"FRONTEND",label:n("project.type.frontend")},{value:"BACKEND",label:n("project.type.backend")}],value:k,onChange:C})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.alias")}),(0,t.jsx)(w.Input,{placeholder:n("project.aliasPlaceholder"),value:c,onChange:e=>d(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mt-0.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.description")}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsxs)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{type:"button",variant:"ghost",onClick:G,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!g||W?"opacity-50":""}`}),children:[W?(0,t.jsx)(eM.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(eL.Sparkles,{className:"h-3 w-3"}),W?n("project.analyzing"):n("project.genDesc")]}),(0,t.jsx)(b.TooltipContent,{children:g?n("project.genDescReady"):n("project.genDescNoPath")})]})]}),(0,t.jsx)(eE.Textarea,{placeholder:n("project.descPlaceholder"),value:u,onChange:e=>m(e.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,t.jsxs)(j.DialogFooter,{children:[(0,t.jsx)(v.Button,{variant:"outline",onClick:()=>{s(!1),H()},children:n("common.cancel")}),(0,t.jsx)(v.Button,{onClick:q,disabled:X,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:A?n("project.migrating"):n("common.create")})]})]})}),(0,t.jsx)(e_.FolderBrowserDialog,{open:N,onOpenChange:y,onSelect:e=>K(e)})]})}function eq({className:e}){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:e,children:(0,t.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 eX({onCreateProject:e,username:a}){let{t:n,locale:i,setLocale:l}=(0,I.useI18n)(),{isOpen:c,toggleAssistant:d}=(0,eI.useAssistant)(),{resolvedTheme:u,toggleTheme:m,triggerRef:x}=function(){let{resolvedTheme:e,setTheme:t}=(0,K.useTheme)(),s=(0,r.useRef)(null),a=(0,r.useCallback)(r=>{let s="dark"===e?"light":"dark";if("u">typeof document&&"startViewTransition"in document&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){let e=r?.clientX??window.innerWidth/2,a=r?.clientY??0,n=Math.hypot(Math.max(e,window.innerWidth-e),Math.max(a,window.innerHeight-a));document.startViewTransition(()=>{t(s)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${e}px ${a}px)`,`circle(${n}px at ${e}px ${a}px)`]},{duration:400,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})}else t(s)},[e,t]);return{resolvedTheme:e,toggleTheme:a,triggerRef:s}}(),p=(0,s.useRouter)(),[f,j]=(0,r.useState)(!1),[w,N]=(0,r.useState)(!1),[y,k]=(0,r.useState)(!1);(0,W.useActionShortcut)("global.search",()=>j(!0));let C=H(e=>e.createProjectOpen),S=H(e=>e.importProjectOpen),T=H(e=>e.setCreateProjectOpen),P=H(e=>e.setImportProjectOpen);return(0,r.useEffect)(()=>{C&&N(!0)},[C]),(0,r.useEffect)(()=>{S&&k(!0)},[S]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("header",{className:"flex h-12 items-center justify-between border-b border-border bg-background/80 px-5 backdrop-blur-sm",children:[(0,t.jsx)("div",{className:"w-40"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)(v.Button,{variant:"outline",onClick:()=>j(!0),className:"h-8 w-[400px] justify-start gap-2 bg-muted/50 text-muted-foreground hover:bg-muted",children:[(0,t.jsx)(V.Search,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"flex-1 text-left",suppressHydrationWarning:!0,children:n("topbar.searchPlaceholder")}),(0,t.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,t.jsx)(q,{className:"h-2.5 w-2.5"}),"K"]})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{delay:500,render:(0,t.jsx)("button",{"data-tour":"open-assistant",onClick:d,"aria-label":n("assistant.iconLabel"),className:["cursor-pointer rounded-lg p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",c?"bg-accent text-foreground":""].join(" ")}),children:(0,t.jsx)(J.Bot,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{children:n("assistant.iconLabel")})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsxs)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{variant:"ghost",onClick:()=>l("zh"===i?"en":"zh"),className:"text-muted-foreground"}),children:[(0,t.jsx)(X.Globe,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-[11px] font-semibold",children:"zh"===i?"EN":"δΈ­"})]}),(0,t.jsx)(b.TooltipContent,{children:n("settings.language")})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{ref:x,variant:"ghost",size:"icon",onClick:m,className:"text-muted-foreground"}),children:"dark"===u?(0,t.jsx)(Y.Sun,{className:"h-4 w-4"}):(0,t.jsx)(Z.Moon,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{children:n("settings.theme")})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{variant:"ghost",size:"icon",onClick:()=>window.open("https://github.com/jp-liu/tower","_blank","noopener,noreferrer"),className:"text-muted-foreground","aria-label":n("topbar.github")}),children:(0,t.jsx)(eq,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{children:n("topbar.github")})]}),(0,t.jsx)("div",{className:"h-4 w-px bg-border"}),(0,t.jsxs)(v.Button,{variant:"outline",className:"gap-1.5 ring-1 ring-border hover:bg-accent",onClick:()=>k(!0),children:[(0,t.jsx)(h.FolderOpen,{className:"h-3.5 w-3.5"}),n("topbar.importProject")]}),(0,t.jsxs)(v.Button,{"data-tour":"create-project",className:"gap-1.5 bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",onClick:()=>N(!0),children:[(0,t.jsx)(o.Plus,{className:"h-3.5 w-3.5"}),n("topbar.newProject")]}),(0,t.jsxs)(g.DropdownMenu,{children:[(0,t.jsx)(g.DropdownMenuTrigger,{render:(0,t.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:[a&&(0,t.jsx)("span",{className:"max-w-[80px] truncate text-xs text-muted-foreground",children:a}),(0,t.jsx)(ef,{className:"h-7 w-7 ring-1 ring-border",children:(0,t.jsx)(ej,{className:"bg-emerald-500/20 text-emerald-400 text-[10px] font-semibold",children:a?a.trim().split(/\s+/).filter(e=>e.length>0).slice(0,2).map(e=>e[0].toUpperCase()).join(""):"U"})})]})}),(0,t.jsx)(g.DropdownMenuContent,{align:"end",sideOffset:8,className:"w-40",children:(0,t.jsxs)(g.DropdownMenuItem,{onClick:()=>p.push("/settings"),children:[(0,t.jsx)(G.Settings,{className:"mr-2 h-3.5 w-3.5"}),n("settings.title")]})})]})]})]}),(0,t.jsx)(eO,{open:f,onOpenChange:j}),(0,t.jsx)(eW,{open:w,onOpenChange:e=>{N(e),e||T(!1)},onCreateProject:e}),(0,t.jsx)(eG,{open:y,onOpenChange:e=>{k(e),e||P(!1)},onCreateProject:e})]})}var eJ=e.i(83434),eY=e.i(966001),eZ=e.i(851618),eQ=e.i(19578),e0=e.i(232280);let e1=(0,eQ.default)(()=>e.A(427768).then(e=>({default:e.AssistantChat})),{loadableGenerated:{modules:[103363]},ssr:!1});function e2({mode:e}){let{isOpen:s,closeAssistant:a,sessions:n,activeSessionId:c,createNewSession:d,switchSession:u,removeSession:m,renameSession:h}=(0,eI.useAssistant)(),{t:x}=(0,I.useI18n)(),[p,f]=(0,r.useState)(null),[b,N]=(0,r.useState)(""),y=()=>{f(null),N("")},k=()=>{p&&b.trim()&&(h(p.id,b),y())},C=n.find(e=>e.id===c),S=C?.title??x("assistant.newSession");return(0,t.jsxs)("div",{className:"sidebar"===e?"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,t.jsxs)("div",{className:"header-sm flex items-center px-4 gap-2 bg-sidebar",children:[(0,t.jsx)(J.Bot,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-semibold text-foreground shrink-0",children:x("assistant.title")}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)(g.DropdownMenu,{children:[(0,t.jsxs)(g.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":x("assistant.sessionList"),children:[(0,t.jsx)("span",{className:"truncate",children:S}),(0,t.jsx)(e0.ChevronDown,{className:"h-3 w-3 shrink-0"})]}),(0,t.jsxs)(g.DropdownMenuContent,{side:"bottom",align:"end",sideOffset:4,className:"w-[280px]",children:[0===n.length?(0,t.jsx)("div",{className:"px-2 py-4 text-xs text-muted-foreground text-center",children:x("assistant.noSessions")}):n.map(e=>(0,t.jsxs)(g.DropdownMenuItem,{className:"flex items-center justify-between gap-1 pr-1",onClick:()=>u(e.id),children:[(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"text-xs truncate",children:e.title}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return`${t}s ago`;let r=Math.floor(t/60);if(r<60)return`${r}m ago`;let s=Math.floor(r/60);if(s<24)return`${s}h ago`;let a=Math.floor(s/24);return`${a}d ago`}(e.updatedAt)})]}),(0,t.jsx)(v.Button,{variant:"ghost",className:"h-6 w-6 p-0 shrink-0 opacity-50 hover:opacity-100",onClick:t=>{var r;t.stopPropagation(),f({id:e.id,title:r=e.title}),N(r)},"aria-label":x("assistant.renameSession"),children:(0,t.jsx)(i.Pencil,{className:"h-3 w-3"})}),(0,t.jsx)(v.Button,{variant:"ghost",className:"h-6 w-6 p-0 shrink-0 opacity-50 hover:opacity-100 hover:text-destructive",onClick:t=>{t.stopPropagation(),m(e.id)},"aria-label":x("assistant.deleteSession"),children:(0,t.jsx)(l.Trash2,{className:"h-3 w-3"})})]},e.id)),n.length>0&&(0,t.jsx)(g.DropdownMenuSeparator,{}),(0,t.jsxs)(g.DropdownMenuItem,{onClick:d,children:[(0,t.jsx)(o.Plus,{className:"h-3 w-3 mr-1"}),(0,t.jsx)("span",{className:"text-xs",children:x("assistant.newSession")})]})]})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:d,"aria-label":x("assistant.newSession"),children:(0,t.jsx)(o.Plus,{className:"h-4 w-4"})})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:a,"aria-label":x("assistant.closeLabel"),children:(0,t.jsx)(ey.X,{className:"h-4 w-4"})})]}),(0,t.jsx)("div",{className:"flex-1 overflow-hidden",children:s?(0,t.jsx)(e1,{}):null}),(0,t.jsx)(j.Dialog,{open:null!==p,onOpenChange:e=>{e||y()},children:(0,t.jsxs)(j.DialogContent,{children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:x("assistant.renameSessionTitle")})}),(0,t.jsx)(w.Input,{autoFocus:!0,value:b,onChange:e=>N(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),k())},placeholder:x("assistant.renameSessionPlaceholder")}),(0,t.jsxs)(j.DialogFooter,{children:[(0,t.jsx)(v.Button,{variant:"outline",onClick:y,children:x("common.cancel")}),(0,t.jsx)(v.Button,{onClick:k,disabled:!b.trim(),children:x("common.save")})]})]})})]})}var e5=e.i(125177);function e4({onDismiss:e}){let{t:s}=(0,I.useI18n)(),[a,n]=(0,r.useState)(!1);(0,r.useEffect)(()=>{"Notification"in window&&"default"===window.Notification.permission&&n(!0)},[]);let o=async()=>{"default"!==await window.Notification.requestPermission()&&(n(!1),e?.())};return a?(0,t.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,t.jsx)(e5.Bell,{className:"h-4 w-4 shrink-0 text-primary"}),(0,t.jsx)("span",{className:"flex-1 text-sm",children:s("notification.permissionPrompt")}),(0,t.jsx)(v.Button,{size:"default",onClick:o,children:s("notification.allow")}),(0,t.jsx)(v.Button,{variant:"ghost",size:"default",onClick:()=>{n(!1),e?.()},children:s("notification.dismiss")})]}):null}var e3=e.i(221343),e8=e.i(883776);let e6=[{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 e7({onComplete:e}){let{t:s}=(0,I.useI18n)(),[a,n]=(0,r.useState)(0),[o,i]=(0,r.useState)(null),[l,c]=(0,r.useState)(!1),d=(0,r.useRef)(null),u=e6[a],m=(0,r.useCallback)(async()=>{await (0,e8.setConfigValue)("onboarding.tourCompleted",!0),e()},[e]),h=(0,r.useCallback)(()=>u?document.querySelector(`[data-tour="${u.target}"]`):null,[u]),x=(0,r.useCallback)(()=>{let e=h();e?(i(e.getBoundingClientRect()),c(!0)):c(!1)},[h]);(0,r.useEffect)(()=>{x();let e=null;!l&&u?.waitForTarget&&(d.current=new MutationObserver(()=>{let t=h();t&&(i(t.getBoundingClientRect()),c(!0),d.current?.disconnect(),e&&clearTimeout(e))}),d.current.observe(document.body,{childList:!0,subtree:!0}),e=setTimeout(()=>{!h()&&(n(e=>{let t=e+1;return t<e6.length?t:e}),a>=e6.length-1&&m())},5e3));let t=()=>x();return window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{d.current?.disconnect(),e&&clearTimeout(e),window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[a,u,h,x,l,m]),(0,r.useEffect)(()=>{let e=setInterval(x,1e3);return()=>clearInterval(e)},[x]);let p=(0,r.useCallback)(()=>{a<e6.length-1?(n(e=>e+1),c(!1)):m()},[a]);return u?(0,t.jsx)(t.Fragment,{children:l&&o&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"fixed inset-0 z-[10000]",style:{background:`radial-gradient(
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,465536,(e,t,r)=>{var s;"u">typeof __nccwpck_require__&&(__nccwpck_require__.ab="/ROOT/node_modules/.pnpm/next@16.2.1_@babel+core@7.29.0_@playwright+test@1.58.2_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/next/dist/compiled/os-browserify/"),(s={}).endianness=function(){return"LE"},s.hostname=function(){return"u">typeof location?location.hostname:""},s.loadavg=function(){return[]},s.uptime=function(){return 0},s.freemem=function(){return Number.MAX_VALUE},s.totalmem=function(){return Number.MAX_VALUE},s.cpus=function(){return[]},s.type=function(){return"Browser"},s.release=function(){return"u">typeof navigator?navigator.appVersion:""},s.networkInterfaces=s.getNetworkInterfaces=function(){return{}},s.arch=function(){return"javascript"},s.platform=function(){return"browser"},s.tmpdir=s.tmpDir=function(){return"/tmp"},s.EOL="\n",s.homedir=function(){return"/"},t.exports=s},930787,(e,t,r)=>{!function(){"use strict";var e={114:function(e){function t(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,s="",a=0,n=-1,o=0,i=0;i<=e.length;++i){if(i<e.length)r=e.charCodeAt(i);else if(47===r)break;else r=47;if(47===r){if(n===i-1||1===o);else if(n!==i-1&&2===o){if(s.length<2||2!==a||46!==s.charCodeAt(s.length-1)||46!==s.charCodeAt(s.length-2)){if(s.length>2){var l=s.lastIndexOf("/");if(l!==s.length-1){-1===l?(s="",a=0):a=(s=s.slice(0,l)).length-1-s.lastIndexOf("/"),n=i,o=0;continue}}else if(2===s.length||1===s.length){s="",a=0,n=i,o=0;continue}}t&&(s.length>0?s+="/..":s="..",a=2)}else s.length>0?s+="/"+e.slice(n+1,i):s=e.slice(n+1,i),a=i-n-1;n=i,o=0}else 46===r&&-1!==o?++o:o=-1}return s}var s={resolve:function(){for(var e,s,a="",n=!1,o=arguments.length-1;o>=-1&&!n;o--)o>=0?s=arguments[o]:(void 0===e&&(e=""),s=e),t(s),0!==s.length&&(a=s+"/"+a,n=47===s.charCodeAt(0));if(a=r(a,!n),n)if(a.length>0)return"/"+a;else return"/";return a.length>0?a:"."},normalize:function(e){if(t(e),0===e.length)return".";var s=47===e.charCodeAt(0),a=47===e.charCodeAt(e.length-1);return(0!==(e=r(e,!s)).length||s||(e="."),e.length>0&&a&&(e+="/"),s)?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0==arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var a=arguments[r];t(a),a.length>0&&(void 0===e?e=a:e+="/"+a)}return void 0===e?".":s.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r||(e=s.resolve(e))===(r=s.resolve(r)))return"";for(var a=1;a<e.length&&47===e.charCodeAt(a);++a);for(var n=e.length,o=n-a,i=1;i<r.length&&47===r.charCodeAt(i);++i);for(var l=r.length-i,c=o<l?o:l,d=-1,u=0;u<=c;++u){if(u===c){if(l>c){if(47===r.charCodeAt(i+u))return r.slice(i+u+1);else if(0===u)return r.slice(i+u)}else o>c&&(47===e.charCodeAt(a+u)?d=u:0===u&&(d=0));break}var m=e.charCodeAt(a+u);if(m!==r.charCodeAt(i+u))break;47===m&&(d=u)}var h="";for(u=a+d+1;u<=n;++u)(u===n||47===e.charCodeAt(u))&&(0===h.length?h+="..":h+="/..");return h.length>0?h+r.slice(i+d):(i+=d,47===r.charCodeAt(i)&&++i,r.slice(i))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),s=47===r,a=-1,n=!0,o=e.length-1;o>=1;--o)if(47===(r=e.charCodeAt(o))){if(!n){a=o;break}}else n=!1;return -1===a?s?"/":".":s&&1===a?"//":e.slice(0,a)},basename:function(e,r){if(void 0!==r&&"string"!=typeof r)throw TypeError('"ext" argument must be a string');t(e);var s,a=0,n=-1,o=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var i=r.length-1,l=-1;for(s=e.length-1;s>=0;--s){var c=e.charCodeAt(s);if(47===c){if(!o){a=s+1;break}}else -1===l&&(o=!1,l=s+1),i>=0&&(c===r.charCodeAt(i)?-1==--i&&(n=s):(i=-1,n=l))}return a===n?n=l:-1===n&&(n=e.length),e.slice(a,n)}for(s=e.length-1;s>=0;--s)if(47===e.charCodeAt(s)){if(!o){a=s+1;break}}else -1===n&&(o=!1,n=s+1);return -1===n?"":e.slice(a,n)},extname:function(e){t(e);for(var r=-1,s=0,a=-1,n=!0,o=0,i=e.length-1;i>=0;--i){var l=e.charCodeAt(i);if(47===l){if(!n){s=i+1;break}continue}-1===a&&(n=!1,a=i+1),46===l?-1===r?r=i:1!==o&&(o=1):-1!==r&&(o=-1)}return -1===r||-1===a||0===o||1===o&&r===a-1&&r===s+1?"":e.slice(r,a)},format:function(e){var t,r;if(null===e||"object"!=typeof e)throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return t=e.dir||e.root,r=e.base||(e.name||"")+(e.ext||""),t?t===e.root?t+r:t+"/"+r:r},parse:function(e){t(e);var r,s={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return s;var a=e.charCodeAt(0),n=47===a;n?(s.root="/",r=1):r=0;for(var o=-1,i=0,l=-1,c=!0,d=e.length-1,u=0;d>=r;--d){if(47===(a=e.charCodeAt(d))){if(!c){i=d+1;break}continue}-1===l&&(c=!1,l=d+1),46===a?-1===o?o=d:1!==u&&(u=1):-1!==o&&(u=-1)}return -1===o||-1===l||0===u||1===u&&o===l-1&&o===i+1?-1!==l&&(0===i&&n?s.base=s.name=e.slice(1,l):s.base=s.name=e.slice(i,l)):(0===i&&n?(s.name=e.slice(1,o),s.base=e.slice(1,l)):(s.name=e.slice(i,o),s.base=e.slice(i,l)),s.ext=e.slice(o,l)),i>0?s.dir=e.slice(0,i-1):n&&(s.dir="/"),s},sep:"/",delimiter:":",win32:null,posix:null};s.posix=s,e.exports=s}},r={};function s(t){var a=r[t];if(void 0!==a)return a.exports;var n=r[t]={exports:{}},o=!0;try{e[t](n,n.exports,s),o=!1}finally{o&&delete r[t]}return n.exports}s.ab="/ROOT/node_modules/.pnpm/next@16.2.1_@babel+core@7.29.0_@playwright+test@1.58.2_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/next/dist/compiled/path-browserify/",t.exports=s(114)}()},756502,e=>{"use strict";let t=(0,e.i(572989).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"}]]);e.s(["default",0,t])},914935,e=>{"use strict";var t=e.i(289721),r=e.i(965652),s=e.i(538059),a=e.i(210702),n=e.i(487278),o=e.i(232545),i=e.i(464249),l=e.i(998626),c=e.i(49007),d=e.i(902539),u=e.i(263938),m=e.i(645378),h=e.i(453889),x=e.i(572989);let p=(0,x.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 g=e.i(755146),f=e.i(759684),j=e.i(776639),b=e.i(746798),v=e.i(519455),w=e.i(793479),N=e.i(514798);let y=(0,N.createServerReference)("40dc5994c5145791aa6b750c6db19b674339691e95",N.callServer,void 0,N.findSourceMapURL,"createWorkspace"),k=(0,N.createServerReference)("60de99d8abadfb18ea24da9fe6659ba6eb8f9b8b90",N.callServer,void 0,N.findSourceMapURL,"updateWorkspace"),C=(0,N.createServerReference)("4033f23e3fceeb4827b06ccb240c11c6786038f237",N.callServer,void 0,N.findSourceMapURL,"deleteWorkspace"),S=(0,N.createServerReference)("40d05a29d8dc5caa8d25e073a30ecc92f40fcd0db5",N.callServer,void 0,N.findSourceMapURL,"reorderWorkspaces");var T=e.i(578775);let P=(0,N.createServerReference)("40d973f296d8738cf4afb3d63fdcf700207ef10e8f",N.callServer,void 0,N.findSourceMapURL,"createLabel"),D=(0,N.createServerReference)("40021a9d736acd9bcfa12e8373f683a674b28086a3",N.callServer,void 0,N.findSourceMapURL,"deleteLabel");var O=e.i(889620),I=e.i(533499),M=e.i(360112),$=e.i(720247),A=e.i(775712),L=e.i(67013);let R=["πŸ“‹","πŸš€","🎯","πŸ’‘","πŸ”§","πŸ“¦","🎨","πŸ“Š","πŸ”¬","🌟","πŸ“","πŸ—οΈ"];function E({workspaces:e}){let i,l=(0,s.useRouter)(),c=(0,s.usePathname)(),{t:u}=(0,I.useI18n)(),[x,g]=(0,r.useState)(!1);(0,r.useEffect)(()=>{"true"===localStorage.getItem("sidebar-collapsed")&&g(!0)},[]);let[j,w]=(0,r.useState)(!1),[N,T]=(0,r.useState)(!1),[P,D]=(0,r.useState)(!1),[L,F]=(0,r.useState)(null),[W,U]=(0,r.useState)(""),[H,K]=(0,r.useState)(R[0]),[V,G]=(0,r.useState)(null),[q,X]=(0,r.useState)(e);(0,r.useEffect)(()=>{X(e)},[e]);let J=(0,$.useSensors)((0,$.useSensor)($.PointerSensor,{activationConstraint:{distance:8}})),Y=(0,r.useCallback)(t=>{let{active:r,over:s}=t;if(!s||r.id===s.id)return;let a=q.findIndex(e=>e.id===r.id),n=q.findIndex(e=>e.id===s.id);if(-1===a||-1===n)return;let o=(0,A.arrayMove)(q,a,n);X(o),S(o.map(e=>e.id)).then(()=>l.refresh()).catch(()=>{X(e),M.toast.error(u("sidebar.reorderError"))})},[q,e,l,u]),Z=c.split("/workspaces/")[1]?.split("/")[0],Q=(0,r.useCallback)(e=>{if(Z===e)return;let t=(0,O.getLastProjectId)(e);l.push(t?`/workspaces/${e}?projectId=${t}`:`/workspaces/${e}`)},[Z,l]),ee=(0,r.useCallback)(()=>{g(e=>{let t=!e;return localStorage.setItem("sidebar-collapsed",String(t)),t})},[]),et=(0,r.useCallback)(async()=>{if(!W.trim())return;let e=await y({name:W.trim(),description:H});U(""),K(R[0]),w(!1),l.refresh(),l.push(`/workspaces/${e.id}`)},[W,H,l]),er=(0,r.useCallback)(async()=>{W.trim()&&V&&(await k(V,{name:W.trim(),description:H}),U(""),T(!1),G(null),l.refresh())},[W,H,V,l]),es=(0,r.useCallback)(e=>{G(e.id),U(e.name),K(e.description&&R.includes(e.description)?e.description:R[0]),T(!0)},[]),ea=(0,r.useCallback)(async(t,r)=>{if(e.length<=1)return void M.toast.error(u("sidebar.lastWorkspaceError"));if(confirm(u("sidebar.deleteConfirm",{name:r})))try{await C(t),l.refresh(),Z===t&&l.push("/workspaces")}catch{M.toast.error(u("sidebar.lastWorkspaceError"))}},[Z,l,u,e.length]),en=(0,r.useCallback)(e=>{F(e),D(!0)},[]),eo=e=>e.description&&R.includes(e.description)?e.description:e.name.charAt(0).toUpperCase();if(x){let r;return(0,t.jsxs)("aside",{className:"flex h-screen w-14 flex-col items-center border-r border-border bg-sidebar py-3",children:[(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:ee,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,t.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-6 w-6 rounded"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:u("sidebar.expand")})]}),(0,t.jsx)(f.ScrollArea,{className:"flex-1 min-h-0",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-1 px-0.5 pt-1",children:[e.map(e=>{let r=Z===e.id,s=eo(e);return(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>Q(e.id),className:`flex h-9 w-9 items-center justify-center rounded-lg transition-all ${r?"ring-1 ring-primary/20 text-foreground cursor-default":"text-muted-foreground hover:text-foreground cursor-pointer"}`}),children:(0,t.jsx)("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-muted text-sm",children:R.includes(s)?s:(0,t.jsx)("span",{className:"text-xs font-semibold",children:s})})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:e.name})]},e.id)}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{"data-tour":"create-workspace",onClick:()=>w(!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,t.jsx)(o.Plus,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:u("sidebar.newWorkspace")})]})]})}),(0,t.jsxs)("div",{className:"mt-2 flex flex-col items-center gap-1",children:[(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>l.push("/missions"),className:`rounded-lg p-2 transition-colors ${"/missions"===c?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,t.jsx)(p,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:u("missions.navLabel")})]}),(r=Z||e[0]?.id)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>l.push(`/workspaces/${r}/notes`),className:`rounded-lg p-2 transition-colors ${c.includes("/notes")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,t.jsx)(m.FileText,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:u("sidebar.notes")})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>l.push(`/workspaces/${r}/assets`),className:`rounded-lg p-2 transition-colors ${c.includes("/assets")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,t.jsx)(h.FolderOpen,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:u("sidebar.assets")})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>l.push(`/workspaces/${r}/archive`),className:`rounded-lg p-2 transition-colors ${c.includes("/archive")?"text-foreground bg-accent":"text-muted-foreground hover:bg-accent hover:text-foreground"}`}),children:(0,t.jsx)(n.Archive,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{side:"right",sideOffset:8,children:u("sidebar.archive")})]})]}):null]}),(0,t.jsx)(B,{open:j,onOpenChange:w,title:u("workspace.create"),name:W,onNameChange:U,icon:H,onIconChange:K,onSubmit:et,submitLabel:u("common.create"),nameLabel:u("workspace.name"),iconLabel:u("workspace.icon"),namePlaceholder:u("workspace.namePlaceholder"),cancelLabel:u("common.cancel")})]})}return(0,t.jsxs)("aside",{className:"noise relative flex h-screen w-56 flex-col border-r border-border bg-sidebar",children:[(0,t.jsxs)("div",{className:"relative z-10 flex items-center gap-3 px-4 py-4",children:[(0,t.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-9 w-9 rounded-lg"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("div",{className:"text-sm font-semibold tracking-tight text-foreground",children:"Tower"}),(0,t.jsx)("div",{className:"text-[10px] font-medium uppercase tracking-widest text-muted-foreground",children:"Studio"})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"icon-xs",onClick:ee,className:"text-muted-foreground",title:u("sidebar.collapse"),children:(0,t.jsx)(d.ChevronsLeft,{className:"h-4 w-4"})})]}),(0,t.jsxs)("div",{className:"relative z-10 flex items-center justify-between px-4 py-2",children:[(0,t.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:u("sidebar.workspace")}),(0,t.jsx)(v.Button,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground","data-tour":"create-workspace",onClick:()=>{U(""),K(R[0]),w(!0)},title:u("sidebar.newWorkspace"),children:(0,t.jsx)(o.Plus,{className:"h-3.5 w-3.5"})})]}),(0,t.jsx)(f.ScrollArea,{className:"relative z-10 mt-2 flex-1 min-h-0",children:(0,t.jsx)("div",{className:"px-2 py-1",children:(0,t.jsx)($.DndContext,{id:"workspace-sidebar",sensors:J,collisionDetection:$.closestCenter,onDragEnd:Y,children:(0,t.jsx)(A.SortableContext,{items:q.map(e=>e.id),strategy:A.verticalListSortingStrategy,children:q.map(e=>(0,t.jsx)(z,{ws:e,isActive:Z===e.id,icon:eo(e),disableDelete:q.length<=1,t:u,onSelect:()=>Q(e.id),onEdit:()=>es(e),onManageLabels:()=>en(e.id),onDelete:()=>ea(e.id,e.name)},e.id))})})})}),(0,t.jsxs)(a.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"===c?"text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,t.jsx)(p,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:u("missions.navLabel")})]}),(i=Z||e[0]?.id)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(a.default,{href:`/workspaces/${i}/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,t.jsx)(m.FileText,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:u("sidebar.notes")})]}),(0,t.jsxs)(a.default,{href:`/workspaces/${i}/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,t.jsx)(h.FolderOpen,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:u("sidebar.assets")})]}),(0,t.jsxs)(a.default,{href:`/workspaces/${i}/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,t.jsx)(n.Archive,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:u("sidebar.archive")})]})]}):null,(0,t.jsx)(B,{open:j,onOpenChange:w,title:u("workspace.create"),name:W,onNameChange:U,icon:H,onIconChange:K,onSubmit:et,submitLabel:u("common.create"),nameLabel:u("workspace.name"),iconLabel:u("workspace.icon"),namePlaceholder:u("workspace.namePlaceholder"),cancelLabel:u("common.cancel")}),(0,t.jsx)(B,{open:N,onOpenChange:e=>{T(e),e||G(null)},title:u("workspace.edit"),name:W,onNameChange:U,icon:H,onIconChange:K,onSubmit:er,submitLabel:u("common.save"),nameLabel:u("workspace.name"),iconLabel:u("workspace.icon"),namePlaceholder:u("workspace.namePlaceholder"),cancelLabel:u("common.cancel")}),L&&(0,t.jsx)(_,{open:P,onOpenChange:e=>{D(e),e||F(null)},workspaceId:L})]})}function z({ws:e,isActive:r,icon:s,disableDelete:a,t:n,onSelect:o,onEdit:d,onManageLabels:m,onDelete:h}){var x;let p,f,j,{attributes:b,listeners:v,setNodeRef:w,transform:N,transition:y,isDragging:k}=(0,A.useSortable)({id:e.id}),C={transform:L.CSS.Transform.toString(N),transition:y,opacity:k?.4:1};return(0,t.jsxs)("div",{ref:w,style:C,...b,...v,className:`group relative flex touch-none items-center rounded-lg transition-all ${r?"bg-accent ring-1 ring-primary/15":"hover:bg-accent/60"}`,children:[(0,t.jsxs)("button",{onClick:o,className:`flex flex-1 items-center gap-2.5 px-3 py-2.5 text-left ${r?"cursor-default":"cursor-pointer"}`,children:[(0,t.jsx)("span",{className:"flex h-7 w-7 items-center justify-center rounded-md bg-muted text-sm",children:R.includes(s)?s:(0,t.jsx)("span",{className:"text-xs font-semibold text-muted-foreground",children:s})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:`truncate text-sm font-medium ${r?"text-foreground":"text-secondary-foreground"}`,children:e.name}),(0,t.jsx)("div",{className:"text-[11px] text-muted-foreground",children:(x=e.updatedAt,f=Math.floor((p=Date.now()-new Date(x).getTime())/6e4),j=Math.floor(p/36e5),f<60?`${f}m ago`:j<24?`${j}h ago`:`${Math.floor(j/24)}d ago`)})]})]}),(0,t.jsxs)(g.DropdownMenu,{children:[(0,t.jsx)(g.DropdownMenuTrigger,{render:(0,t.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:e=>e.stopPropagation()}),children:(0,t.jsx)(c.MoreHorizontal,{className:"h-3.5 w-3.5"})}),(0,t.jsxs)(g.DropdownMenuContent,{align:"start",side:"right",children:[(0,t.jsxs)(g.DropdownMenuItem,{onClick:d,children:[(0,t.jsx)(i.Pencil,{className:"mr-2 h-3.5 w-3.5"}),n("sidebar.rename")]}),(0,t.jsxs)(g.DropdownMenuItem,{onClick:m,children:[(0,t.jsx)(u.Tag,{className:"mr-2 h-3.5 w-3.5"}),n("sidebar.manageLabels")]}),(0,t.jsxs)(g.DropdownMenuItem,{className:a?"text-muted-foreground opacity-50":"text-rose-400",disabled:a,onClick:h,children:[(0,t.jsx)(l.Trash2,{className:"mr-2 h-3.5 w-3.5"}),n("sidebar.delete")]})]})]})]})}function B({open:e,onOpenChange:r,title:s,name:a,onNameChange:n,icon:o,onIconChange:i,onSubmit:l,submitLabel:c,nameLabel:d,iconLabel:u,namePlaceholder:m,cancelLabel:h}){return(0,t.jsx)(j.Dialog,{open:e,onOpenChange:r,disablePointerDismissal:!0,children:(0,t.jsxs)(j.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:s})}),(0,t.jsxs)("div",{className:"space-y-4 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:d}),(0,t.jsx)(w.Input,{placeholder:m,value:a,onChange:e=>n(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault(),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:u}),(0,t.jsx)("div",{className:"mt-1.5 grid grid-cols-6 gap-1.5",children:R.map(e=>(0,t.jsx)("button",{onClick:()=>i(e),className:`flex h-10 w-10 items-center justify-center rounded-lg text-lg transition-all ${o===e?"bg-primary/15 ring-2 ring-primary/30 scale-110":"bg-muted hover:bg-accent"}`,children:e},e))})]})]}),(0,t.jsxs)(j.DialogFooter,{children:[(0,t.jsx)(v.Button,{variant:"outline",onClick:()=>r(!1),children:h}),(0,t.jsx)(v.Button,{onClick:l,disabled:!a.trim(),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:c})]})]})})}let F=["#3b82f6","#ef4444","#f59e0b","#10b981","#8b5cf6","#ec4899","#06b6d4","#f97316"];function _({open:e,onOpenChange:s,workspaceId:a}){let{t:n}=(0,I.useI18n)(),[o,i]=(0,r.useState)([]),[l,c]=(0,r.useState)(""),[d,u]=(0,r.useState)(F[0]);(0,r.useEffect)(()=>{e&&(0,T.getLabelsForWorkspace)(a).then(i)},[e,a]);let m=async()=>{l.trim()&&(await P({name:l.trim(),color:d,workspaceId:a}),i(await (0,T.getLabelsForWorkspace)(a)),c(""))},h=async e=>{await D(e),i(t=>t.filter(t=>t.id!==e))};return(0,t.jsx)(j.Dialog,{open:e,onOpenChange:s,disablePointerDismissal:!0,children:(0,t.jsxs)(j.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:n("label.manage")})}),(0,t.jsxs)("div",{className:"space-y-3 py-2",children:[o.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"h-3 w-3 rounded-full",style:{backgroundColor:e.color}}),(0,t.jsx)("span",{className:"flex-1 text-sm text-foreground",children:e.name}),e.isBuiltin?(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:n("label.builtin")}):(0,t.jsx)("button",{onClick:()=>h(e.id),className:"text-xs text-rose-400 hover:text-rose-300",children:n("common.delete")})]},e.id)),(0,t.jsxs)("div",{className:"border-t border-border pt-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(w.Input,{placeholder:n("label.name"),value:l,onChange:e=>c(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault(),className:"flex-1 h-8"}),(0,t.jsx)(v.Button,{size:"sm",onClick:m,disabled:!l.trim(),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:n("label.add")})]}),(0,t.jsx)("div",{className:"mt-2 flex gap-1.5",children:F.map(e=>(0,t.jsx)("button",{onClick:()=>u(e),className:`h-5 w-5 rounded-full transition-all ${d===e?"ring-2 ring-offset-2 ring-offset-background ring-foreground/30 scale-110":""}`,style:{backgroundColor:e}},e))})]})]})]})})}e.i(508271);var W=e.i(841359),U=e.i(289813);let H=(0,U.create)(e=>({createProjectOpen:!1,importProjectOpen:!1,setCreateProjectOpen:t=>e({createProjectOpen:t}),setImportProjectOpen:t=>e({importProjectOpen:t})}));var K=e.i(821957),V=e.i(738690),G=e.i(386343);let q=(0,x.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 X=e.i(242941),J=e.i(989548),Y=e.i(387091),Z=e.i(15299);e.s([],678787),e.i(678787),e.i(708878);var Q=e.i(581263),ee=e.i(462902);let et=r.createContext(void 0);function er(){let e=r.useContext(et);if(void 0===e)throw Error((0,ee.default)(13));return e}let es={imageLoadingStatus:()=>null},ea=r.forwardRef(function(e,s){let{className:a,render:n,...o}=e,[i,l]=r.useState("idle"),c=r.useMemo(()=>({imageLoadingStatus:i,setImageLoadingStatus:l}),[i,l]),d=(0,Q.useRenderElement)("span",e,{state:{imageLoadingStatus:i},ref:s,props:o,stateAttributesMapping:es});return(0,t.jsx)(et.Provider,{value:c,children:d})});var en=e.i(887642),eo=e.i(804849),ei=e.i(504068),el=e.i(809058),ec=e.i(193214),ed=e.i(954588);let eu={...es,...el.transitionStatusMapping},em=r.forwardRef(function(e,t){let{className:s,render:a,onLoadingStatusChange:n,referrerPolicy:o,crossOrigin:i,...l}=e,c=er(),d=function(e,{referrerPolicy:t,crossOrigin:s}){let[a,n]=r.useState("idle");return(0,eo.useIsoLayoutEffect)(()=>{if(!e)return n("error"),ed.NOOP;let r=!0,a=new window.Image,o=e=>()=>{r&&n(e)};return n("loading"),a.onload=o("loaded"),a.onerror=o("error"),t&&(a.referrerPolicy=t),a.crossOrigin=s??null,a.src=e,()=>{r=!1}},[e,s,t]),a}(e.src,{referrerPolicy:o,crossOrigin:i}),u="loaded"===d,{mounted:m,transitionStatus:h,setMounted:x}=(0,ec.useTransitionStatus)(u),p=r.useRef(null),g=(0,en.useStableCallback)(e=>{n?.(e),c.setImageLoadingStatus(e)});(0,eo.useIsoLayoutEffect)(()=>{"idle"!==d&&g(d)},[d,g]),(0,ei.useOpenChangeComplete)({open:u,ref:p,onComplete(){u||x(!1)}});let f=(0,Q.useRenderElement)("img",e,{state:{imageLoadingStatus:d,transitionStatus:h},ref:[t,p],props:l,stateAttributesMapping:eu,enabled:m});return m?f:null});var eh=e.i(161476);let ex=r.forwardRef(function(e,t){let{className:s,render:a,delay:n,...o}=e,{imageLoadingStatus:i}=er(),[l,c]=r.useState(void 0===n),d=(0,eh.useTimeout)();return r.useEffect(()=>(void 0!==n&&d.start(n,()=>c(!0)),d.clear),[d,n]),(0,Q.useRenderElement)("span",e,{state:{imageLoadingStatus:i},ref:t,props:o,stateAttributesMapping:es,enabled:"loaded"!==i&&l})});e.s(["Fallback",0,ex,"Image",0,em,"Root",0,ea],129448);var ep=e.i(129448),ep=ep,eg=e.i(975157);function ef({className:e,size:r="default",...s}){return(0,t.jsx)(ep.Root,{"data-slot":"avatar","data-size":r,className:(0,eg.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",e),...s})}function ej({className:e,...r}){return(0,t.jsx)(ep.Fallback,{"data-slot":"avatar-fallback",className:(0,eg.cn)("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",e),...r})}let eb=(0,x.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 ev=e.i(226145);let ew=(0,x.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"}]]),eN=(0,x.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 ey=e.i(657153);let ek=(0,N.createServerReference)("6071f62865d7cc8fd3ab220abf5ecfbc0ec631d910",N.callServer,void 0,N.findSourceMapURL,"globalSearch");var eC=e.i(773535);let eS=[{id:"all",key:"search.all",icon:V.Search},{id:"task",key:"search.task",icon:m.FileText},{id:"project",key:"search.project",icon:eb},{id:"repository",key:"search.repository",icon:ev.GitBranch},{id:"note",key:"search.note",icon:ew},{id:"asset",key:"search.asset",icon:eN}],eT=["task","project","repository","note","asset"],eP={task:"search.task",project:"search.project",repository:"search.repository",note:"search.note",asset:"search.asset"};function eD({result:e,onSelect:r}){let s=eS.find(t=>t.id===e.type)?.icon??m.FileText;return(0,t.jsxs)("button",{onClick:()=>r(e),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,t.jsx)("div",{className:"rounded-md bg-muted p-1.5",children:(0,t.jsx)(s,{className:"h-3.5 w-3.5 text-muted-foreground"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"text-sm font-medium text-foreground truncate",children:e.title}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.subtitle}),e.snippet&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground/70 truncate mt-0.5",children:e.snippet})]})]})}function eO({open:e,onOpenChange:a}){let n,{t:o}=(0,I.useI18n)(),i=(0,s.useRouter)(),[l,c]=(0,r.useState)(""),[d,u]=(0,r.useState)("all"),[m,h]=(0,r.useState)([]),[x,p]=(0,r.useState)(!1),[g,b]=(0,r.useState)(250),w=(0,r.useRef)(null),N=(0,r.useRef)(null);(0,r.useEffect)(()=>{e&&((0,eC.getConfigValue)("search.debounceMs",250).then(b),setTimeout(()=>w.current?.focus(),100),c(""),h([]))},[e]),(0,r.useEffect)(()=>{if(N.current&&clearTimeout(N.current),!l.trim()){h([]),p(!1);return}p(!0);let e=!1;return N.current=setTimeout(async()=>{let t=await ek(l,d);e||(h(t),p(!1))},g),()=>{N.current&&clearTimeout(N.current),e=!0}},[l,d,g]);let y=(0,r.useCallback)(e=>{i.push(e.navigateTo),a(!1)},[i,a]);return(0,t.jsx)(j.Dialog,{open:e,onOpenChange:a,children:(0,t.jsxs)(j.DialogContent,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden !top-[10vh] !-translate-y-0",showCloseButton:!1,children:[(0,t.jsxs)("div",{className:"flex items-center border-b border-border px-4",children:[(0,t.jsx)(V.Search,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsx)("input",{ref:w,value:l,onChange:e=>c(e.target.value),placeholder:o("search.placeholder"),className:"flex-1 bg-transparent px-3 py-3.5 text-sm text-foreground placeholder-muted-foreground outline-none"}),l&&(0,t.jsx)(v.Button,{variant:"ghost",size:"icon",onClick:()=>{c(""),h([])},className:"text-muted-foreground",children:(0,t.jsx)(ey.X,{className:"h-3.5 w-3.5"})})]}),(0,t.jsx)("div",{className:"flex items-center gap-1 border-b border-border px-4 py-2",children:eS.map(e=>{let r=e.icon;return(0,t.jsxs)("button",{onClick:()=>u(e.id),className:`flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-all ${d===e.id?"bg-primary/10 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent hover:text-foreground"}`,children:[(0,t.jsx)(r,{className:"h-3 w-3"}),o(e.key)]},e.id)})}),(0,t.jsxs)(f.ScrollArea,{className:"max-h-80",children:[!l.trim()&&(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:o("search.typeToSearch")}),l.trim()&&0===m.length&&!x&&(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:o("search.noResults")}),"all"===d&&m.length>0&&(n=m.reduce((e,t)=>((e[t.type]??=[]).push(t),e),{}),eT.filter(e=>n[e]?.length).map(e=>(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"px-4 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground bg-muted/50",children:o(eP[e])}),n[e].map(e=>(0,t.jsx)(eD,{result:e,onSelect:y},`${e.type}-${e.id}`))]},e))),"all"!==d&&m.map(e=>(0,t.jsx)(eD,{result:e,onSelect:y},`${e.type}-${e.id}`))]})]})})}var eI=e.i(338187),eM=e.i(400355),e$=e.i(597746),eA=e.i(938499),eL=e.i(233274),eR=e.i(905455),eE=e.i(624687);function ez(e){return e.replace(/\.git\/?$/,"")}e.i(465536),e.i(930787);let eB=(0,N.createServerReference)("4092804c67622795f702440c3e64d76bd68b0f7dd4",N.callServer,void 0,N.findSourceMapURL,"resolveGitLocalPath");var eF=e.i(65021),e_=e.i(224277);function eW({open:e,onOpenChange:s,onCreateProject:a}){let{t:n,locale:o}=(0,I.useI18n)(),[i,l]=(0,r.useState)(""),[c,d]=(0,r.useState)(""),[u,m]=(0,r.useState)(""),[x,p]=(0,r.useState)(""),[g,f]=(0,r.useState)(""),[N,y]=(0,r.useState)(!1),[k,C]=(0,r.useState)("FRONTEND"),[S,T]=(0,r.useState)("idle"),[P,D]=(0,r.useState)(""),[O,$]=(0,r.useState)(!1),[A,L]=(0,r.useState)(!1),R=()=>{l(""),d(""),m(""),p(""),f(""),y(!1),C("FRONTEND"),T("idle"),D(""),$(!1)},E=async()=>{if(g.trim()&&!O&&"success"===S){$(!0);try{let e=await (0,eF.analyzeProjectDirectory)(g.trim(),o);m(e)}catch{M.toast.error(n("project.analyzeError"))}finally{$(!1)}}},z=async e=>{p(e),T("idle"),D("");let t=function(e){let t,r=e.match(/^git@([^:]+):(.+)$/);if(r)return{host:r[1],pathSegments:ez(r[2]).split("/").filter(Boolean)};try{t=new URL(e)}catch{return null}return{host:t.hostname,pathSegments:ez(decodeURIComponent(t.pathname)).split("/").filter(Boolean)}}(e);t&&t.pathSegments.length>0&&l(t.pathSegments[t.pathSegments.length-1]),N||f(await eB(e))},B=async()=>{if(x.trim()&&g.trim()){T("cloning"),D("");try{let e=function(e){let t=e.trim();if(!t)return"";if(t.startsWith("git@")||t.startsWith("ssh://")||t.endsWith(".git"))return t;try{let e=new URL(t),r=e.hostname,s=decodeURIComponent(e.pathname).split("/").filter(Boolean);if("code.iflytek.com"===r){let e=[...s];"osc"===e[0]&&"_source"===e[1]&&(e=e.slice(2));let a=e.indexOf("-");if(a>0&&(e=e.slice(0,a)),0===e.length)return t;return`https://${r}/${e.join("/")}.git`}return`${e.origin}${e.pathname.replace(/\/$/,"")}.git`}catch{return t}}(x.trim()),t=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clone",url:e,path:g.trim()})}),r=await t.json();if(!t.ok){T("error"),D(r.error||"Clone failed");return}T("success")}catch{T("error"),D("Network error")}}},F=async()=>{i.trim()&&(await a?.({name:i.trim(),alias:c.trim()||void 0,description:u.trim()||void 0,gitUrl:x.trim()||void 0,localPath:g.trim()||void 0,projectType:k}),R(),s(!1))};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.Dialog,{open:e,onOpenChange:e=>{s(e),e||R()},disablePointerDismissal:!0,children:(0,t.jsxs)(j.DialogContent,{style:{maxWidth:"32rem"},children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:n("topbar.newProject")})}),(0,t.jsxs)("div",{className:"space-y-4 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.gitUrl")}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:n("project.gitUrlHint")}),(0,t.jsx)(w.Input,{placeholder:n("project.gitPlaceholder"),value:x,onChange:e=>z(e.target.value),className:"mt-1.5 font-mono text-xs"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.localPath")}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:n("project.localPathHint")}),(0,t.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,t.jsx)(w.Input,{placeholder:n("project.localPathPlaceholder"),value:g,onChange:e=>{f(e.target.value),y(!0)},className:"flex-1 min-w-0 font-mono text-xs"}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsxs)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{type:"button",variant:"outline",onClick:()=>L(!0),className:"shrink-0 gap-1.5 px-2.5 text-xs text-muted-foreground"}),children:[(0,t.jsx)(h.FolderOpen,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:n("folder.browse")})]}),(0,t.jsx)(b.TooltipContent,{children:n("folder.selectFolder")})]})]}),g.trim().startsWith("~")&&(0,t.jsxs)("p",{className:"mt-1 flex items-center gap-1 text-[11px] text-amber-400",children:[(0,t.jsx)(eA.AlertCircle,{className:"h-3 w-3"}),n("project.tildeWarning")]}),x.trim()&&g.trim()&&(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,t.jsxs)(v.Button,{type:"button",disabled:"cloning"===S||"success"===S,onClick:B,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"===S?(0,t.jsx)(eM.Loader2,{className:"h-3 w-3 animate-spin"}):"success"===S?(0,t.jsx)(e$.Check,{className:"h-3 w-3"}):(0,t.jsx)(ev.GitBranch,{className:"h-3 w-3"}),"cloning"===S?n("git.cloning"):"success"===S?n("git.cloned"):n("git.clone")]}),"error"===S&&(0,t.jsxs)("span",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,t.jsx)(eA.AlertCircle,{className:"h-3 w-3"}),P]}),"success"===S&&(0,t.jsx)("span",{className:"text-[11px] text-emerald-400",children:n("git.cloneSuccess")})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.name")}),(0,t.jsx)(w.Input,{placeholder:n("project.namePlaceholder"),value:i,onChange:e=>l(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.type.label")}),(0,t.jsx)("div",{className:"mt-1.5",children:(0,t.jsx)(eR.SegmentedControl,{options:[{value:"FRONTEND",label:n("project.type.frontend")},{value:"BACKEND",label:n("project.type.backend")}],value:k,onChange:C})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.alias")}),(0,t.jsx)(w.Input,{placeholder:n("project.aliasPlaceholder"),value:c,onChange:e=>d(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mt-0.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.description")}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsxs)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{type:"button",variant:"ghost",onClick:E,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!g.trim()||O?"opacity-50":""}`}),children:[O?(0,t.jsx)(eM.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(eL.Sparkles,{className:"h-3 w-3"}),O?n("project.analyzing"):n("project.genDesc")]}),(0,t.jsx)(b.TooltipContent,{children:g.trim()?"success"!==S?n("project.genDescNotCloned"):n("project.genDescReady"):n("project.genDescNoPath")})]})]}),(0,t.jsx)(eE.Textarea,{placeholder:n("project.descPlaceholder"),value:u,onChange:e=>m(e.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,t.jsxs)(j.DialogFooter,{children:[(0,t.jsx)(v.Button,{variant:"outline",onClick:()=>{s(!1),R()},children:n("common.cancel")}),(0,t.jsx)(v.Button,{onClick:F,disabled:!i.trim()||O,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:n("common.create")})]})]})}),(0,t.jsx)(e_.FolderBrowserDialog,{open:A,onOpenChange:L,onSelect:e=>{if(f(e),y(!0),!i.trim()){let t=e.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean).pop()??"";t&&l(t)}}})]})}var eU=e.i(756502),eU=eU,eH=e.i(699375);let eK=(0,N.createServerReference)("60697db45fd919041164efede51525c37717402587",N.callServer,void 0,N.findSourceMapURL,"migrateProjectPath"),eV=(0,N.createServerReference)("4046e8aa9ca2e60552574e42d4b0ea37efacf35831",N.callServer,void 0,N.findSourceMapURL,"checkMigrationSafety");function eG({open:e,onOpenChange:s,onCreateProject:a}){let{t:n,locale:o}=(0,I.useI18n)(),[i,l]=(0,r.useState)(""),[c,d]=(0,r.useState)(""),[u,m]=(0,r.useState)(""),[x,p]=(0,r.useState)(""),[g,f]=(0,r.useState)(""),[N,y]=(0,r.useState)(!1),[k,C]=(0,r.useState)("FRONTEND"),[S,T]=(0,r.useState)(!1),[P,D]=(0,r.useState)(!1),[O,$]=(0,r.useState)(""),[A,L]=(0,r.useState)(!1),[R,E]=(0,r.useState)(""),[z,B]=(0,r.useState)(""),[F,_]=(0,r.useState)(!1),[W,U]=(0,r.useState)(!1),H=()=>{l(""),d(""),m(""),p(""),f(""),C("FRONTEND"),T(!1),D(!1),$(""),L(!1),E(""),B(""),_(!1),U(!1)},K=async e=>{f(e),T(!1),D(!1),$(""),E(""),B(""),_(!1),l(e.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean).pop()??"");try{let t=await fetch(`/api/git?path=${encodeURIComponent(e)}`);if(t.ok){let e=await t.json();if(e.isGit&&e.remoteUrl){p(e.remoteUrl),T(!0);let t=e.remoteUrl.match(/\/([^/]+?)(?:\.git)?$/);t&&l(t[1])}}}catch{}},V=(0,r.useCallback)(async e=>{if(D(e),E(""),B(""),_(!1),!e)return void $("");if(x)try{let e=await eB(x);e&&($(e),e===g&&_(!0))}catch{}if(g)try{let e=await fetch(`/api/git?path=${encodeURIComponent(g)}&checkWorktrees=true`);e.ok&&(await e.json()).hasWorktrees&&B(n("project.worktreeWarning"))}catch{}},[x,g]),G=async()=>{if(g&&!W){U(!0);try{let e=await (0,eF.analyzeProjectDirectory)(g.trim(),o);m(e)}catch{M.toast.error(n("project.analyzeError"))}finally{U(!1)}}},q=async()=>{if(!i.trim())return;let e={name:i.trim(),alias:c.trim()||void 0,description:u.trim()||void 0,gitUrl:x.trim()||void 0,localPath:g.trim()||void 0,projectType:k},t=await a?.(e);if(P&&O&&O!==g&&t&&"id"in t){L(!0),E("");try{let e=await eV(t.id);if(!e.safe)return void E(e.reason);let r=await eK(t.id,O);if(!r.success)return void E(r.error??n("project.migrateError"));M.toast.success(n("project.migrateSuccess"))}catch(t){let e=t instanceof Error?t.message:String(t);E(`${n("project.migrateError")}:${e}`);return}finally{L(!1)}}H(),s(!1)},X=!i.trim()||!g.trim()||A||W||P&&!!z;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.Dialog,{open:e,onOpenChange:e=>{s(e),e||H()},disablePointerDismissal:!0,children:(0,t.jsxs)(j.DialogContent,{style:{maxWidth:"32rem"},children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:n("topbar.importProject")})}),(0,t.jsxs)("div",{className:"space-y-4 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.localPath")}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:n("project.importHint")}),(0,t.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,t.jsx)(w.Input,{value:g,readOnly:!0,placeholder:n("project.localPathPlaceholder"),className:"flex-1 font-mono text-xs bg-muted/30"}),(0,t.jsxs)(v.Button,{type:"button",variant:"outline",onClick:()=>y(!0),className:"shrink-0 gap-1.5",children:[(0,t.jsx)(h.FolderOpen,{className:"h-3.5 w-3.5"}),n("folder.browse")]})]}),S&&(0,t.jsx)("p",{className:"mt-1.5 text-[11px] text-emerald-400",children:n("project.autoDetected")})]}),x&&(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.gitUrl")}),(0,t.jsx)(w.Input,{value:x,onChange:e=>p(e.target.value),className:"mt-1.5 font-mono text-xs"})]}),S&&g&&(0,t.jsxs)("div",{className:"rounded-md border border-border p-3 space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:n("project.migrate")}),(0,t.jsx)("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:n("project.migrateHint")})]}),(0,t.jsx)(eH.Switch,{checked:P,onCheckedChange:e=>V(e)})]}),P&&(0,t.jsxs)("div",{className:"space-y-2 pt-1",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-[10px] font-medium text-muted-foreground",children:n("project.targetPath")}),(0,t.jsx)(w.Input,{value:O,onChange:e=>{$(e.target.value),_(e.target.value===g)},placeholder:"/path/to/canonical/location",className:"mt-1 font-mono text-xs"})]}),F&&(0,t.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-sky-400",children:[(0,t.jsx)(eU.default,{className:"h-3 w-3"}),n("project.samePathInfo")]}),z&&(0,t.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-amber-400",children:[(0,t.jsx)(eA.AlertCircle,{className:"h-3 w-3"}),z]}),R&&(0,t.jsxs)("p",{className:"flex items-center gap-1 text-[11px] text-rose-400",children:[(0,t.jsx)(eA.AlertCircle,{className:"h-3 w-3"}),R]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.name")}),(0,t.jsx)(w.Input,{placeholder:n("project.namePlaceholder"),value:i,onChange:e=>l(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.type.label")}),(0,t.jsx)("div",{className:"mt-1.5",children:(0,t.jsx)(eR.SegmentedControl,{options:[{value:"FRONTEND",label:n("project.type.frontend")},{value:"BACKEND",label:n("project.type.backend")}],value:k,onChange:C})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.alias")}),(0,t.jsx)(w.Input,{placeholder:n("project.aliasPlaceholder"),value:c,onChange:e=>d(e.target.value),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mt-0.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:n("project.description")}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsxs)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{type:"button",variant:"ghost",onClick:G,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!g||W?"opacity-50":""}`}),children:[W?(0,t.jsx)(eM.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(eL.Sparkles,{className:"h-3 w-3"}),W?n("project.analyzing"):n("project.genDesc")]}),(0,t.jsx)(b.TooltipContent,{children:g?n("project.genDescReady"):n("project.genDescNoPath")})]})]}),(0,t.jsx)(eE.Textarea,{placeholder:n("project.descPlaceholder"),value:u,onChange:e=>m(e.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,t.jsxs)(j.DialogFooter,{children:[(0,t.jsx)(v.Button,{variant:"outline",onClick:()=>{s(!1),H()},children:n("common.cancel")}),(0,t.jsx)(v.Button,{onClick:q,disabled:X,className:"bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",children:A?n("project.migrating"):n("common.create")})]})]})}),(0,t.jsx)(e_.FolderBrowserDialog,{open:N,onOpenChange:y,onSelect:e=>K(e)})]})}function eq({className:e}){return(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:e,children:(0,t.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 eX({onCreateProject:e,username:a}){let{t:n,locale:i,setLocale:l}=(0,I.useI18n)(),{isOpen:c,toggleAssistant:d}=(0,eI.useAssistant)(),{resolvedTheme:u,toggleTheme:m,triggerRef:x}=function(){let{resolvedTheme:e,setTheme:t}=(0,K.useTheme)(),s=(0,r.useRef)(null),a=(0,r.useCallback)(r=>{let s="dark"===e?"light":"dark";if("u">typeof document&&"startViewTransition"in document&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches){let e=r?.clientX??window.innerWidth/2,a=r?.clientY??0,n=Math.hypot(Math.max(e,window.innerWidth-e),Math.max(a,window.innerHeight-a));document.startViewTransition(()=>{t(s)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${e}px ${a}px)`,`circle(${n}px at ${e}px ${a}px)`]},{duration:400,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})}else t(s)},[e,t]);return{resolvedTheme:e,toggleTheme:a,triggerRef:s}}(),p=(0,s.useRouter)(),[f,j]=(0,r.useState)(!1),[w,N]=(0,r.useState)(!1),[y,k]=(0,r.useState)(!1);(0,W.useActionShortcut)("global.search",()=>j(!0));let C=H(e=>e.createProjectOpen),S=H(e=>e.importProjectOpen),T=H(e=>e.setCreateProjectOpen),P=H(e=>e.setImportProjectOpen);return(0,r.useEffect)(()=>{C&&N(!0)},[C]),(0,r.useEffect)(()=>{S&&k(!0)},[S]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("header",{className:"flex h-12 items-center justify-between border-b border-border bg-background/80 px-5 backdrop-blur-sm",children:[(0,t.jsx)("div",{className:"w-40"}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)(v.Button,{variant:"outline",onClick:()=>j(!0),className:"h-8 w-[400px] justify-start gap-2 bg-muted/50 text-muted-foreground hover:bg-muted",children:[(0,t.jsx)(V.Search,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"flex-1 text-left",suppressHydrationWarning:!0,children:n("topbar.searchPlaceholder")}),(0,t.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,t.jsx)(q,{className:"h-2.5 w-2.5"}),"K"]})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{delay:500,render:(0,t.jsx)("button",{"data-tour":"open-assistant",onClick:d,"aria-label":n("assistant.iconLabel"),className:["cursor-pointer rounded-lg p-2 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",c?"bg-accent text-foreground":""].join(" ")}),children:(0,t.jsx)(J.Bot,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{children:n("assistant.iconLabel")})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsxs)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{variant:"ghost",onClick:()=>l("zh"===i?"en":"zh"),className:"text-muted-foreground"}),children:[(0,t.jsx)(X.Globe,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{className:"text-[11px] font-semibold",children:"zh"===i?"EN":"δΈ­"})]}),(0,t.jsx)(b.TooltipContent,{children:n("settings.language")})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{ref:x,variant:"ghost",size:"icon",onClick:m,className:"text-muted-foreground"}),children:"dark"===u?(0,t.jsx)(Y.Sun,{className:"h-4 w-4"}):(0,t.jsx)(Z.Moon,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{children:n("settings.theme")})]}),(0,t.jsxs)(b.Tooltip,{children:[(0,t.jsx)(b.TooltipTrigger,{render:(0,t.jsx)(v.Button,{variant:"ghost",size:"icon",onClick:()=>window.open("https://github.com/jp-liu/tower","_blank","noopener,noreferrer"),className:"text-muted-foreground","aria-label":n("topbar.github")}),children:(0,t.jsx)(eq,{className:"h-4 w-4"})}),(0,t.jsx)(b.TooltipContent,{children:n("topbar.github")})]}),(0,t.jsx)("div",{className:"h-4 w-px bg-border"}),(0,t.jsxs)(v.Button,{variant:"outline",className:"gap-1.5 ring-1 ring-border hover:bg-accent",onClick:()=>k(!0),children:[(0,t.jsx)(h.FolderOpen,{className:"h-3.5 w-3.5"}),n("topbar.importProject")]}),(0,t.jsxs)(v.Button,{"data-tour":"create-project",className:"gap-1.5 bg-primary/10 text-primary ring-1 ring-primary/25 hover:bg-primary/20",onClick:()=>N(!0),children:[(0,t.jsx)(o.Plus,{className:"h-3.5 w-3.5"}),n("topbar.newProject")]}),(0,t.jsxs)(g.DropdownMenu,{children:[(0,t.jsx)(g.DropdownMenuTrigger,{render:(0,t.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:[a&&(0,t.jsx)("span",{className:"max-w-[80px] truncate text-xs text-muted-foreground",children:a}),(0,t.jsx)(ef,{className:"h-7 w-7 ring-1 ring-border",children:(0,t.jsx)(ej,{className:"bg-emerald-500/20 text-emerald-400 text-[10px] font-semibold",children:a?a.trim().split(/\s+/).filter(e=>e.length>0).slice(0,2).map(e=>e[0].toUpperCase()).join(""):"U"})})]})}),(0,t.jsx)(g.DropdownMenuContent,{align:"end",sideOffset:8,className:"w-40",children:(0,t.jsxs)(g.DropdownMenuItem,{onClick:()=>p.push("/settings"),children:[(0,t.jsx)(G.Settings,{className:"mr-2 h-3.5 w-3.5"}),n("settings.title")]})})]})]})]}),(0,t.jsx)(eO,{open:f,onOpenChange:j}),(0,t.jsx)(eW,{open:w,onOpenChange:e=>{N(e),e||T(!1)},onCreateProject:e}),(0,t.jsx)(eG,{open:y,onOpenChange:e=>{k(e),e||P(!1)},onCreateProject:e})]})}var eJ=e.i(83434),eY=e.i(966001),eZ=e.i(174076),eQ=e.i(19578),e0=e.i(232280);let e1=(0,eQ.default)(()=>e.A(427768).then(e=>({default:e.AssistantChat})),{loadableGenerated:{modules:[103363]},ssr:!1});function e2({mode:e}){let{isOpen:s,closeAssistant:a,sessions:n,activeSessionId:c,createNewSession:d,switchSession:u,removeSession:m,renameSession:h}=(0,eI.useAssistant)(),{t:x}=(0,I.useI18n)(),[p,f]=(0,r.useState)(null),[b,N]=(0,r.useState)(""),y=()=>{f(null),N("")},k=()=>{p&&b.trim()&&(h(p.id,b),y())},C=n.find(e=>e.id===c),S=C?.title??x("assistant.newSession");return(0,t.jsxs)("div",{className:"sidebar"===e?"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,t.jsxs)("div",{className:"header-sm flex items-center px-4 gap-2 bg-sidebar",children:[(0,t.jsx)(J.Bot,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-semibold text-foreground shrink-0",children:x("assistant.title")}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)(g.DropdownMenu,{children:[(0,t.jsxs)(g.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":x("assistant.sessionList"),children:[(0,t.jsx)("span",{className:"truncate",children:S}),(0,t.jsx)(e0.ChevronDown,{className:"h-3 w-3 shrink-0"})]}),(0,t.jsxs)(g.DropdownMenuContent,{side:"bottom",align:"end",sideOffset:4,className:"w-[280px]",children:[0===n.length?(0,t.jsx)("div",{className:"px-2 py-4 text-xs text-muted-foreground text-center",children:x("assistant.noSessions")}):n.map(e=>(0,t.jsxs)(g.DropdownMenuItem,{className:"flex items-center justify-between gap-1 pr-1",onClick:()=>u(e.id),children:[(0,t.jsxs)("div",{className:"flex flex-col gap-0.5 flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"text-xs truncate",children:e.title}),(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return`${t}s ago`;let r=Math.floor(t/60);if(r<60)return`${r}m ago`;let s=Math.floor(r/60);if(s<24)return`${s}h ago`;let a=Math.floor(s/24);return`${a}d ago`}(e.updatedAt)})]}),(0,t.jsx)(v.Button,{variant:"ghost",className:"h-6 w-6 p-0 shrink-0 opacity-50 hover:opacity-100",onClick:t=>{var r;t.stopPropagation(),f({id:e.id,title:r=e.title}),N(r)},"aria-label":x("assistant.renameSession"),children:(0,t.jsx)(i.Pencil,{className:"h-3 w-3"})}),(0,t.jsx)(v.Button,{variant:"ghost",className:"h-6 w-6 p-0 shrink-0 opacity-50 hover:opacity-100 hover:text-destructive",onClick:t=>{t.stopPropagation(),m(e.id)},"aria-label":x("assistant.deleteSession"),children:(0,t.jsx)(l.Trash2,{className:"h-3 w-3"})})]},e.id)),n.length>0&&(0,t.jsx)(g.DropdownMenuSeparator,{}),(0,t.jsxs)(g.DropdownMenuItem,{onClick:d,children:[(0,t.jsx)(o.Plus,{className:"h-3 w-3 mr-1"}),(0,t.jsx)("span",{className:"text-xs",children:x("assistant.newSession")})]})]})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:d,"aria-label":x("assistant.newSession"),children:(0,t.jsx)(o.Plus,{className:"h-4 w-4"})})]}),(0,t.jsx)(v.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:a,"aria-label":x("assistant.closeLabel"),children:(0,t.jsx)(ey.X,{className:"h-4 w-4"})})]}),(0,t.jsx)("div",{className:"flex-1 overflow-hidden",children:s?(0,t.jsx)(e1,{}):null}),(0,t.jsx)(j.Dialog,{open:null!==p,onOpenChange:e=>{e||y()},children:(0,t.jsxs)(j.DialogContent,{children:[(0,t.jsx)(j.DialogHeader,{children:(0,t.jsx)(j.DialogTitle,{children:x("assistant.renameSessionTitle")})}),(0,t.jsx)(w.Input,{autoFocus:!0,value:b,onChange:e=>N(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),k())},placeholder:x("assistant.renameSessionPlaceholder")}),(0,t.jsxs)(j.DialogFooter,{children:[(0,t.jsx)(v.Button,{variant:"outline",onClick:y,children:x("common.cancel")}),(0,t.jsx)(v.Button,{onClick:k,disabled:!b.trim(),children:x("common.save")})]})]})})]})}var e5=e.i(125177);function e4({onDismiss:e}){let{t:s}=(0,I.useI18n)(),[a,n]=(0,r.useState)(!1);(0,r.useEffect)(()=>{"Notification"in window&&"default"===window.Notification.permission&&n(!0)},[]);let o=async()=>{"default"!==await window.Notification.requestPermission()&&(n(!1),e?.())};return a?(0,t.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,t.jsx)(e5.Bell,{className:"h-4 w-4 shrink-0 text-primary"}),(0,t.jsx)("span",{className:"flex-1 text-sm",children:s("notification.permissionPrompt")}),(0,t.jsx)(v.Button,{size:"default",onClick:o,children:s("notification.allow")}),(0,t.jsx)(v.Button,{variant:"ghost",size:"default",onClick:()=>{n(!1),e?.()},children:s("notification.dismiss")})]}):null}var e3=e.i(689199),e8=e.i(163241);let e6=[{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 e7({onComplete:e}){let{t:s}=(0,I.useI18n)(),[a,n]=(0,r.useState)(0),[o,i]=(0,r.useState)(null),[l,c]=(0,r.useState)(!1),d=(0,r.useRef)(null),u=e6[a],m=(0,r.useCallback)(async()=>{await (0,e8.setConfigValue)("onboarding.tourCompleted",!0),e()},[e]),h=(0,r.useCallback)(()=>u?document.querySelector(`[data-tour="${u.target}"]`):null,[u]),x=(0,r.useCallback)(()=>{let e=h();e?(i(e.getBoundingClientRect()),c(!0)):c(!1)},[h]);(0,r.useEffect)(()=>{x();let e=null;!l&&u?.waitForTarget&&(d.current=new MutationObserver(()=>{let t=h();t&&(i(t.getBoundingClientRect()),c(!0),d.current?.disconnect(),e&&clearTimeout(e))}),d.current.observe(document.body,{childList:!0,subtree:!0}),e=setTimeout(()=>{!h()&&(n(e=>{let t=e+1;return t<e6.length?t:e}),a>=e6.length-1&&m())},5e3));let t=()=>x();return window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{d.current?.disconnect(),e&&clearTimeout(e),window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[a,u,h,x,l,m]),(0,r.useEffect)(()=>{let e=setInterval(x,1e3);return()=>clearInterval(e)},[x]);let p=(0,r.useCallback)(()=>{a<e6.length-1?(n(e=>e+1),c(!1)):m()},[a]);return u?(0,t.jsx)(t.Fragment,{children:l&&o&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"fixed inset-0 z-[10000]",style:{background:`radial-gradient(
2
2
  ellipse at ${o.left+o.width/2}px ${o.top+o.height/2}px,
3
3
  transparent ${Math.max(o.width,o.height)}px,
4
4
  rgba(0,0,0,0.6) ${Math.max(o.width,o.height)+30}px