tower-studio 0.1.14 → 0.1.16

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 (208) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/cache/.previewinfo +1 -1
  4. package/.next/cache/.rscinfo +1 -1
  5. package/.next/cache/.tsbuildinfo +1 -1
  6. package/.next/diagnostics/route-bundle-stats.json +95 -95
  7. package/.next/fallback-build-manifest.json +3 -3
  8. package/.next/prerender-manifest.json +3 -3
  9. package/.next/server/app/_global-error.html +1 -1
  10. package/.next/server/app/_global-error.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -1
  17. package/.next/server/app/_not-found/page/server-reference-manifest.json +23 -23
  18. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/.next/server/app/_not-found.html +1 -1
  21. package/.next/server/app/_not-found.rsc +14 -14
  22. package/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
  23. package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  24. package/.next/server/app/_not-found.segments/_index.segment.rsc +9 -9
  25. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  26. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  27. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  28. package/.next/server/app/api/internal/assistant/route.js +1 -1
  29. package/.next/server/app/api/internal/assistant/route.js.nft.json +1 -1
  30. package/.next/server/app/api/internal/terminal/[taskId]/start/route.js +2 -2
  31. package/.next/server/app/api/internal/terminal/[taskId]/start/route.js.nft.json +1 -1
  32. package/.next/server/app/index.html +1 -1
  33. package/.next/server/app/index.rsc +14 -14
  34. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  35. package/.next/server/app/index.segments/_full.segment.rsc +14 -14
  36. package/.next/server/app/index.segments/_head.segment.rsc +4 -4
  37. package/.next/server/app/index.segments/_index.segment.rsc +9 -9
  38. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  39. package/.next/server/app/missions/page/react-loadable-manifest.json +1 -1
  40. package/.next/server/app/missions/page/server-reference-manifest.json +49 -49
  41. package/.next/server/app/missions/page.js +1 -1
  42. package/.next/server/app/missions/page.js.nft.json +1 -1
  43. package/.next/server/app/missions/page_client-reference-manifest.js +1 -1
  44. package/.next/server/app/onboarding/page/react-loadable-manifest.json +1 -1
  45. package/.next/server/app/onboarding/page/server-reference-manifest.json +23 -23
  46. package/.next/server/app/onboarding/page.js.nft.json +1 -1
  47. package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  48. package/.next/server/app/onboarding.html +1 -1
  49. package/.next/server/app/onboarding.rsc +16 -16
  50. package/.next/server/app/onboarding.segments/_full.segment.rsc +16 -16
  51. package/.next/server/app/onboarding.segments/_head.segment.rsc +4 -4
  52. package/.next/server/app/onboarding.segments/_index.segment.rsc +9 -9
  53. package/.next/server/app/onboarding.segments/_tree.segment.rsc +2 -2
  54. package/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +4 -4
  55. package/.next/server/app/onboarding.segments/onboarding.segment.rsc +3 -3
  56. package/.next/server/app/page/react-loadable-manifest.json +1 -1
  57. package/.next/server/app/page/server-reference-manifest.json +23 -23
  58. package/.next/server/app/page.js.nft.json +1 -1
  59. package/.next/server/app/page_client-reference-manifest.js +1 -1
  60. package/.next/server/app/settings/page/react-loadable-manifest.json +1 -1
  61. package/.next/server/app/settings/page/server-reference-manifest.json +56 -80
  62. package/.next/server/app/settings/page.js +1 -1
  63. package/.next/server/app/settings/page.js.nft.json +1 -1
  64. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  65. package/.next/server/app/settings.html +1 -1
  66. package/.next/server/app/settings.rsc +16 -16
  67. package/.next/server/app/settings.segments/_full.segment.rsc +16 -16
  68. package/.next/server/app/settings.segments/_head.segment.rsc +4 -4
  69. package/.next/server/app/settings.segments/_index.segment.rsc +9 -9
  70. package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  71. package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
  72. package/.next/server/app/settings.segments/settings.segment.rsc +3 -3
  73. package/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +1 -1
  74. package/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +77 -77
  75. package/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
  76. package/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
  77. package/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +1 -1
  78. package/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +62 -62
  79. package/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
  80. package/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
  81. package/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +1 -1
  82. package/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +53 -53
  83. package/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
  84. package/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
  85. package/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +1 -1
  86. package/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +51 -51
  87. package/.next/server/app/workspaces/[workspaceId]/page.js +1 -1
  88. package/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
  89. package/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
  90. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +1 -1
  91. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +23 -23
  92. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
  93. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
  94. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +1 -1
  95. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +52 -52
  96. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js +2 -2
  97. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
  98. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  99. package/.next/server/app/workspaces/page/react-loadable-manifest.json +1 -1
  100. package/.next/server/app/workspaces/page/server-reference-manifest.json +43 -43
  101. package/.next/server/app/workspaces/page.js.nft.json +1 -1
  102. package/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
  103. package/.next/server/chunks/0uz~_next_dist_esm_build_templates_app-route_05yec2y.js +2 -2
  104. package/.next/server/chunks/[root-of-the-server]__00~8_qz._.js +4 -0
  105. package/.next/server/chunks/[root-of-the-server]__05mc_xk._.js +1 -1
  106. package/.next/server/chunks/[root-of-the-server]__0p5iuez._.js +2 -2
  107. package/.next/server/chunks/[root-of-the-server]__0rb-ear._.js +4 -0
  108. package/.next/server/chunks/project_f_tower_0n1s3ym._.js +1 -1
  109. package/.next/server/chunks/project_f_tower_src_11e.cv5._.js +1 -1
  110. package/.next/server/chunks/ssr/04uy_src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_01.s1p0._.js +1 -1
  111. package/.next/server/chunks/ssr/0y0r_f_tower_src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0n4g3bn._.js +1 -1
  112. package/.next/server/chunks/ssr/[root-of-the-server]__00.lowc._.js +1 -1
  113. package/.next/server/chunks/ssr/[root-of-the-server]__007tg36._.js +1 -1
  114. package/.next/server/chunks/ssr/[root-of-the-server]__025.0xa._.js +1 -1
  115. package/.next/server/chunks/ssr/[root-of-the-server]__04u4kb4._.js +1 -1
  116. package/.next/server/chunks/ssr/[root-of-the-server]__05a17ca._.js +1 -1
  117. package/.next/server/chunks/ssr/[root-of-the-server]__06qzctf._.js +1 -1
  118. package/.next/server/chunks/ssr/{[root-of-the-server]__0wkjslq._.js → [root-of-the-server]__08-2pn1._.js} +1 -1
  119. package/.next/server/chunks/ssr/[root-of-the-server]__0_47k-j._.js +3 -0
  120. package/.next/server/chunks/ssr/[root-of-the-server]__0aidehy._.js +3 -0
  121. package/.next/server/chunks/ssr/[root-of-the-server]__0bqzhpe._.js +3 -0
  122. package/.next/server/chunks/ssr/[root-of-the-server]__0ex911v._.js +30 -0
  123. package/.next/server/chunks/ssr/[root-of-the-server]__0ffdrwp._.js +1 -1
  124. package/.next/server/chunks/ssr/[root-of-the-server]__0h38s6n._.js +3 -0
  125. package/.next/server/chunks/ssr/[root-of-the-server]__0h8nl.m._.js +3 -0
  126. package/.next/server/chunks/ssr/[root-of-the-server]__0i4rk9v._.js +3 -3
  127. package/.next/server/chunks/ssr/[root-of-the-server]__0r6gkos._.js +1 -1
  128. package/.next/server/chunks/ssr/[root-of-the-server]__0u26l~e._.js +1 -1
  129. package/.next/server/chunks/ssr/[root-of-the-server]__0uca1bc._.js +1 -1
  130. package/.next/server/chunks/ssr/[root-of-the-server]__0w7gbe7._.js +1 -1
  131. package/.next/server/chunks/ssr/[root-of-the-server]__0xe-o3g._.js +1 -1
  132. package/.next/server/chunks/ssr/[root-of-the-server]__0zaw-fl._.js +3 -0
  133. package/.next/server/chunks/ssr/[root-of-the-server]__13eo85g._.js +1 -1
  134. package/.next/server/chunks/ssr/[root-of-the-server]__13x5mmo._.js +1 -1
  135. package/.next/server/chunks/ssr/project_f_tower_0.txwd8._.js +1 -1
  136. package/.next/server/chunks/ssr/project_f_tower_047pa2s._.js +3 -0
  137. package/.next/server/chunks/ssr/project_f_tower_0f0-wva._.js +1 -1
  138. package/.next/server/chunks/ssr/project_f_tower_0hgtev9._.js +1 -1
  139. package/.next/server/chunks/ssr/{project_f_tower_0pf464l._.js → project_f_tower_0i96rjz._.js} +2 -2
  140. package/.next/server/chunks/ssr/project_f_tower_0ivvjwd._.js +1 -1
  141. package/.next/server/chunks/ssr/{project_f_tower_0ntkd-l._.js → project_f_tower_0jhlcus._.js} +2 -2
  142. package/.next/server/chunks/ssr/project_f_tower_0jy~1uf._.js +1 -1
  143. package/.next/server/chunks/ssr/project_f_tower_0l6ssf8._.js +1 -1
  144. package/.next/server/chunks/ssr/project_f_tower_0o5.y1e._.js +1 -1
  145. package/.next/server/chunks/ssr/project_f_tower_0ps2~v1._.js +3 -0
  146. package/.next/server/chunks/ssr/project_f_tower_0ssr2sl._.js +3 -0
  147. package/.next/server/chunks/ssr/{project_f_tower_08mqp19._.js → project_f_tower_0tlnklr._.js} +2 -2
  148. package/.next/server/chunks/ssr/project_f_tower_0w01kgd._.js +3 -0
  149. package/.next/server/chunks/ssr/project_f_tower_0ym-aea._.js +1 -1
  150. package/.next/server/chunks/ssr/project_f_tower_12oax__._.js +3 -0
  151. package/.next/server/chunks/ssr/project_f_tower_src_10.nkh7._.js +3 -0
  152. package/.next/server/chunks/ssr/project_f_tower_src_actions_agent-actions_ts_0.s4~m-._.js +2 -2
  153. package/.next/server/chunks/ssr/project_f_tower_src_actions_file-actions_ts_02i742t._.js +1 -1
  154. package/.next/server/chunks/ssr/project_f_tower_src_app_missions_missions-client_tsx_0ums4qx._.js +1 -1
  155. package/.next/server/chunks/ssr/project_f_tower_src_app_onboarding_page_tsx_0_9_yoq._.js +1 -1
  156. package/.next/server/chunks/ssr/project_f_tower_src_app_settings_page_tsx_0oo06~d._.js +1 -1
  157. package/.next/server/chunks/ssr/project_f_tower_src_app_workspaces_[workspaceId]_board-page-client_tsx_0jmj1xz._.js +1 -1
  158. package/.next/server/chunks/ssr/{project_f_tower_0u6dr5n._.js → project_f_tower_src_components_ui_input_tsx_02yu4ri._.js} +2 -2
  159. package/.next/server/middleware-build-manifest.js +3 -3
  160. package/.next/server/pages/404.html +1 -1
  161. package/.next/server/pages/500.html +1 -1
  162. package/.next/server/server-reference-manifest.js +1 -1
  163. package/.next/server/server-reference-manifest.json +217 -241
  164. package/.next/static/chunks/{0z2rpkmoqlr-v.js → 06~5p79536pfs.js} +1 -1
  165. package/.next/static/chunks/{17ckwfwqtxcv7.js → 076vhlm6g1m9n.js} +1 -1
  166. package/.next/static/chunks/{1660q32oalq26.js → 08x0olwzpsczv.js} +2 -2
  167. package/.next/static/chunks/0amzt~927k5f5.js +1 -0
  168. package/.next/static/chunks/{0z-6e_hc3z22b.js → 0gwxdr2ihtu8z.js} +1 -1
  169. package/.next/static/chunks/{0x-v4tzitjxub.js → 0jef3e_wsh4mf.js} +1 -1
  170. package/.next/static/chunks/{08gl4lr7zkm6b.js → 0jfknbbi-cjcl.js} +1 -1
  171. package/.next/static/chunks/{11gkyogd_hqv~.js → 0l5tqul.pwfze.js} +1 -1
  172. package/.next/static/chunks/0pez9k2q~8lom.js +1 -0
  173. package/.next/static/chunks/0s4zpgzk~au6x.css +1 -0
  174. package/.next/static/chunks/{0qnz9q6uieuv8.js → 0sszltblb5pss.js} +1 -1
  175. package/.next/static/chunks/0uxf3e~tjkjuz.js +1 -0
  176. package/.next/static/chunks/1034h4copyi13.js +1 -0
  177. package/.next/static/chunks/11j_4bpiqb5on.js +1 -0
  178. package/.next/static/chunks/{12btaaeo1ik-t.js → 12q1f_9u6eduf.js} +1 -1
  179. package/.next/static/chunks/{14zxctn8~z26r.js → 14xrab1qyw2yw.js} +1 -1
  180. package/.next/static/chunks/{0qnvx~5op5b9e.js → 181v0f2l.x5_p.js} +1 -1
  181. package/.next/trace +2 -2
  182. package/.next/trace-build +1 -1
  183. package/package.json +2 -4
  184. package/scripts/init-db.ts +0 -17
  185. package/.next/server/chunks/[root-of-the-server]__02~bq0q._.js +0 -4
  186. package/.next/server/chunks/[root-of-the-server]__0~33o~m._.js +0 -4
  187. package/.next/server/chunks/ssr/[root-of-the-server]__0.4j53v._.js +0 -3
  188. package/.next/server/chunks/ssr/[root-of-the-server]__09bcer6._.js +0 -3
  189. package/.next/server/chunks/ssr/[root-of-the-server]__0fwuc5u._.js +0 -3
  190. package/.next/server/chunks/ssr/[root-of-the-server]__0gpx.d~._.js +0 -3
  191. package/.next/server/chunks/ssr/[root-of-the-server]__0nmyvwk._.js +0 -3
  192. package/.next/server/chunks/ssr/[root-of-the-server]__11j4k9o._.js +0 -3
  193. package/.next/server/chunks/ssr/[root-of-the-server]__13cjs8r._.js +0 -3
  194. package/.next/server/chunks/ssr/project_f_tower_01tnhbx._.js +0 -3
  195. package/.next/server/chunks/ssr/project_f_tower_04g3~44._.js +0 -30
  196. package/.next/server/chunks/ssr/project_f_tower_0760i8j._.js +0 -3
  197. package/.next/server/chunks/ssr/project_f_tower_0ddfsyt._.js +0 -3
  198. package/.next/server/chunks/ssr/project_f_tower_0sy7ynr._.js +0 -3
  199. package/.next/server/chunks/ssr/project_f_tower_src_0bqbs-1._.js +0 -3
  200. package/.next/static/chunks/04pjsuj.mivbh.css +0 -1
  201. package/.next/static/chunks/0brwcgj_cjdcc.js +0 -1
  202. package/.next/static/chunks/0q40u78uovc7y.js +0 -1
  203. package/.next/static/chunks/0w90t_ngr5_pj.js +0 -1
  204. package/.next/static/chunks/11y3rfp3d4n.0.js +0 -1
  205. package/.next/static/chunks/12.91avyb6b7-.js +0 -1
  206. /package/.next/static/{VzTy7iJ2D58ZvnVnTJZJi → UuR3rJNr0J0cwFZgsovkL}/_buildManifest.js +0 -0
  207. /package/.next/static/{VzTy7iJ2D58ZvnVnTJZJi → UuR3rJNr0J0cwFZgsovkL}/_clientMiddlewareManifest.js +0 -0
  208. /package/.next/static/{VzTy7iJ2D58ZvnVnTJZJi → UuR3rJNr0J0cwFZgsovkL}/_ssgManifest.js +0 -0
@@ -2,6 +2,6 @@ module.exports=[257179,a=>{"use strict";let b,c,d;var e,f,g,h,i,j,k,l,m,n,o=a.i(
2
2
 
3
3
  If you want to hide the \`${b.titleName}\`, you can wrap it with our VisuallyHidden component.
4
4
 
5
- For more information, see https://radix-ui.com/primitives/docs/components/${b.docsSlug}`;return p.useEffect(()=>{a&&(document.getElementById(a)||console.error(c))},[c,a]),null},c_=({contentRef:a,descriptionId:b})=>{let c=cZ("DialogDescriptionWarning"),d=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${c.contentName}}.`;return p.useEffect(()=>{let c=a.current?.getAttribute("aria-describedby");b&&c&&(document.getElementById(b)||console.warn(d))},[d,a,b]),null},c0=Symbol.for("react.lazy"),c1=p[" use ".trim().toString()];function c2(a){var b;return null!=a&&"object"==typeof a&&"$$typeof"in a&&a.$$typeof===c0&&"_payload"in a&&"object"==typeof(b=a._payload)&&null!==b&&"then"in b}var c3=Symbol("radix.slottable");function c4(a){return p.isValidElement(a)&&"function"==typeof a.type&&"__radixId"in a.type&&a.type.__radixId===c3}var c5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((a,b)=>{var c,d;let e,f,g,h=(d=c=`Primitive.${b}`,(e=p.forwardRef((a,b)=>{let{children:c,...d}=a;if(c2(c)&&"function"==typeof c1&&(c=c1(c._payload)),p.isValidElement(c)){var e;let a,f,g=(e=c,(f=(a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.ref:(f=(a=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.props.ref:e.props.ref||e.ref),h=function(a,b){let c={...b};for(let d in b){let e=a[d],f=b[d];/^on[A-Z]/.test(d)?e&&f?c[d]=(...a)=>{let b=f(...a);return e(...a),b}:e&&(c[d]=e):"style"===d?c[d]={...e,...f}:"className"===d&&(c[d]=[e,f].filter(Boolean).join(" "))}return{...a,...c}}(d,c.props);return c.type!==p.Fragment&&(h.ref=b?bs(b,g):g),p.cloneElement(c,h)}return p.Children.count(c)>1?p.Children.only(null):null})).displayName=`${d}.SlotClone`,f=e,(g=p.forwardRef((a,b)=>{let{children:c,...d}=a;c2(c)&&"function"==typeof c1&&(c=c1(c._payload));let e=p.Children.toArray(c),g=e.find(c4);if(g){let a=g.props.children,c=e.map(b=>b!==g?b:p.Children.count(a)>1?p.Children.only(null):p.isValidElement(a)?a.props.children:null);return(0,o.jsx)(f,{...d,ref:b,children:p.isValidElement(a)?p.cloneElement(a,void 0,c):null})}return(0,o.jsx)(f,{...d,ref:b,children:c})})).displayName=`${c}.Slot`,g),i=p.forwardRef((a,c)=>{let{asChild:d,...e}=a;return(0,o.jsx)(d?h:b,{...e,ref:c})});return i.displayName=`Primitive.${b}`,{...a,[b]:i}},{}),c6='[cmdk-group=""]',c7='[cmdk-group-items=""]',c8='[cmdk-item=""]',c9=`${c8}:not([aria-disabled="true"])`,da="cmdk-item-select",db="data-value",dc=(a,b,c)=>{var d;return d=a,function a(b,c,d,e,f,g,h){if(g===c.length)return f===b.length?1:.99;var i=`${f},${g}`;if(void 0!==h[i])return h[i];for(var j,k,l,m,n=e.charAt(g),o=d.indexOf(n,f),p=0;o>=0;)(j=a(b,c,d,e,o+1,g+1,h))>p&&(o===f?j*=1:bl.test(b.charAt(o-1))?(j*=.8,(l=b.slice(f,o-1).match(bm))&&f>0&&(j*=Math.pow(.999,l.length))):bn.test(b.charAt(o-1))?(j*=.9,(m=b.slice(f,o-1).match(bo))&&f>0&&(j*=Math.pow(.999,m.length))):(j*=.17,f>0&&(j*=Math.pow(.999,o-f))),b.charAt(o)!==c.charAt(g)&&(j*=.9999)),(j<.1&&d.charAt(o-1)===e.charAt(g+1)||e.charAt(g+1)===e.charAt(g)&&d.charAt(o-1)!==e.charAt(g))&&.1*(k=a(b,c,d,e,o+1,g+2,h))>j&&(j=.1*k),j>p&&(p=j),o=d.indexOf(n,o+1);return h[i]=p,p}(d=c&&c.length>0?`${d+" "+c.join(" ")}`:d,b,bp(d),bp(b),0,0,{})},dd=p.createContext(void 0),de=p.createContext(void 0),df=p.createContext(void 0),dg=p.forwardRef((a,b)=>{let c=dr(()=>{var b,c;return{search:"",value:null!=(c=null!=(b=a.value)?b:a.defaultValue)?c:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),d=dr(()=>new Set),e=dr(()=>new Map),f=dr(()=>new Map),g=dr(()=>new Set),h=dp(a),{label:i,children:j,value:k,onValueChange:l,filter:m,shouldFilter:n,loop:o,disablePointerSelection:q=!1,vimBindings:r=!0,...s}=a,t=bx(),u=bx(),v=bx(),w=p.useRef(null),x=du();dq(()=>{if(void 0!==k){let a=k.trim();c.current.value=a,y.emit()}},[k]),dq(()=>{x(6,E)},[]);let y=p.useMemo(()=>({subscribe:a=>(g.current.add(a),()=>g.current.delete(a)),snapshot:()=>c.current,setState:(a,b,d)=>{var e,f,g,i;if(!Object.is(c.current[a],b)){if(c.current[a]=b,"search"===a)D(),B(),x(1,C);else if("value"===a){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let a=document.getElementById(v);a?a.focus():null==(e=document.getElementById(t))||e.focus()}if(x(7,()=>{var a;c.current.selectedItemId=null==(a=F())?void 0:a.id,y.emit()}),d||x(5,E),(null==(f=h.current)?void 0:f.value)!==void 0){null==(i=(g=h.current).onValueChange)||i.call(g,null!=b?b:"");return}}y.emit()}},emit:()=>{g.current.forEach(a=>a())}}),[]),z=p.useMemo(()=>({value:(a,b,d)=>{var e;b!==(null==(e=f.current.get(a))?void 0:e.value)&&(f.current.set(a,{value:b,keywords:d}),c.current.filtered.items.set(a,A(b,d)),x(2,()=>{B(),y.emit()}))},item:(a,b)=>(d.current.add(a),b&&(e.current.has(b)?e.current.get(b).add(a):e.current.set(b,new Set([a]))),x(3,()=>{D(),B(),c.current.value||C(),y.emit()}),()=>{f.current.delete(a),d.current.delete(a),c.current.filtered.items.delete(a);let b=F();x(4,()=>{D(),(null==b?void 0:b.getAttribute("id"))===a&&C(),y.emit()})}),group:a=>(e.current.has(a)||e.current.set(a,new Set),()=>{f.current.delete(a),e.current.delete(a)}),filter:()=>h.current.shouldFilter,label:i||a["aria-label"],getDisablePointerSelection:()=>h.current.disablePointerSelection,listId:t,inputId:v,labelId:u,listInnerRef:w}),[]);function A(a,b){var d,e;let f=null!=(e=null==(d=h.current)?void 0:d.filter)?e:dc;return a?f(a,c.current.search,b):0}function B(){if(!c.current.search||!1===h.current.shouldFilter)return;let a=c.current.filtered.items,b=[];c.current.filtered.groups.forEach(c=>{let d=e.current.get(c),f=0;d.forEach(b=>{f=Math.max(a.get(b),f)}),b.push([c,f])});let d=w.current;G().sort((b,c)=>{var d,e;let f=b.getAttribute("id"),g=c.getAttribute("id");return(null!=(d=a.get(g))?d:0)-(null!=(e=a.get(f))?e:0)}).forEach(a=>{let b=a.closest(c7);b?b.appendChild(a.parentElement===b?a:a.closest(`${c7} > *`)):d.appendChild(a.parentElement===d?a:a.closest(`${c7} > *`))}),b.sort((a,b)=>b[1]-a[1]).forEach(a=>{var b;let c=null==(b=w.current)?void 0:b.querySelector(`${c6}[${db}="${encodeURIComponent(a[0])}"]`);null==c||c.parentElement.appendChild(c)})}function C(){let a=G().find(a=>"true"!==a.getAttribute("aria-disabled")),b=null==a?void 0:a.getAttribute(db);y.setState("value",b||void 0)}function D(){var a,b,g,i;if(!c.current.search||!1===h.current.shouldFilter){c.current.filtered.count=d.current.size;return}c.current.filtered.groups=new Set;let j=0;for(let e of d.current){let d=A(null!=(b=null==(a=f.current.get(e))?void 0:a.value)?b:"",null!=(i=null==(g=f.current.get(e))?void 0:g.keywords)?i:[]);c.current.filtered.items.set(e,d),d>0&&j++}for(let[a,b]of e.current)for(let d of b)if(c.current.filtered.items.get(d)>0){c.current.filtered.groups.add(a);break}c.current.filtered.count=j}function E(){var a,b,c;let d=F();d&&((null==(a=d.parentElement)?void 0:a.firstChild)===d&&(null==(c=null==(b=d.closest(c6))?void 0:b.querySelector('[cmdk-group-heading=""]'))||c.scrollIntoView({block:"nearest"})),d.scrollIntoView({block:"nearest"}))}function F(){var a;return null==(a=w.current)?void 0:a.querySelector(`${c8}[aria-selected="true"]`)}function G(){var a;return Array.from((null==(a=w.current)?void 0:a.querySelectorAll(c9))||[])}function H(a){let b=G()[a];b&&y.setState("value",b.getAttribute(db))}function I(a){var b;let c=F(),d=G(),e=d.findIndex(a=>a===c),f=d[e+a];null!=(b=h.current)&&b.loop&&(f=e+a<0?d[d.length-1]:e+a===d.length?d[0]:d[e+a]),f&&y.setState("value",f.getAttribute(db))}function J(a){let b=F(),c=null==b?void 0:b.closest(c6),d;for(;c&&!d;)d=null==(c=a>0?function(a,b){let c=a.nextElementSibling;for(;c;){if(c.matches(b))return c;c=c.nextElementSibling}}(c,c6):function(a,b){let c=a.previousElementSibling;for(;c;){if(c.matches(b))return c;c=c.previousElementSibling}}(c,c6))?void 0:c.querySelector(c9);d?y.setState("value",d.getAttribute(db)):I(a)}let K=()=>H(G().length-1),L=a=>{a.preventDefault(),a.metaKey?K():a.altKey?J(1):I(1)},M=a=>{a.preventDefault(),a.metaKey?H(0):a.altKey?J(-1):I(-1)};return p.createElement(c5.div,{ref:b,tabIndex:-1,...s,"cmdk-root":"",onKeyDown:a=>{var b;null==(b=s.onKeyDown)||b.call(s,a);let c=a.nativeEvent.isComposing||229===a.keyCode;if(!(a.defaultPrevented||c))switch(a.key){case"n":case"j":r&&a.ctrlKey&&L(a);break;case"ArrowDown":L(a);break;case"p":case"k":r&&a.ctrlKey&&M(a);break;case"ArrowUp":M(a);break;case"Home":a.preventDefault(),H(0);break;case"End":a.preventDefault(),K();break;case"Enter":{a.preventDefault();let b=F();if(b){let a=new Event(da);b.dispatchEvent(a)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:z.inputId,id:z.labelId,style:dw},i),dv(a,a=>p.createElement(de.Provider,{value:y},p.createElement(dd.Provider,{value:z},a))))}),dh=p.forwardRef((a,b)=>{var c,d;let e=bx(),f=p.useRef(null),g=p.useContext(df),h=p.useContext(dd),i=dp(a),j=null!=(d=null==(c=i.current)?void 0:c.forceMount)?d:null==g?void 0:g.forceMount;dq(()=>{if(!j)return h.item(e,null==g?void 0:g.id)},[j]);let k=dt(e,f,[a.value,a.children,f],a.keywords),l=p.useContext(de),m=ds(a=>a.value&&a.value===k.current),n=ds(a=>!!j||!1===h.filter()||!a.search||a.filtered.items.get(e)>0);function o(){var a,b;q(),null==(b=(a=i.current).onSelect)||b.call(a,k.current)}function q(){l.setState("value",k.current,!0)}if(p.useEffect(()=>{let b=f.current;if(!(!b||a.disabled))return b.addEventListener(da,o),()=>b.removeEventListener(da,o)},[n,a.onSelect,a.disabled]),!n)return null;let{disabled:r,value:s,onSelect:t,forceMount:u,keywords:v,...w}=a;return p.createElement(c5.div,{ref:bs(f,b),...w,id:e,"cmdk-item":"",role:"option","aria-disabled":!!r,"aria-selected":!!m,"data-disabled":!!r,"data-selected":!!m,onPointerMove:r||h.getDisablePointerSelection()?void 0:q,onClick:r?void 0:o},a.children)}),di=p.forwardRef((a,b)=>{let{heading:c,children:d,forceMount:e,...f}=a,g=bx(),h=p.useRef(null),i=p.useRef(null),j=bx(),k=p.useContext(dd),l=ds(a=>!!e||!1===k.filter()||!a.search||a.filtered.groups.has(g));dq(()=>k.group(g),[]),dt(g,h,[a.value,a.heading,i]);let m=p.useMemo(()=>({id:g,forceMount:e}),[e]);return p.createElement(c5.div,{ref:bs(h,b),...f,"cmdk-group":"",role:"presentation",hidden:!l||void 0},c&&p.createElement("div",{ref:i,"cmdk-group-heading":"","aria-hidden":!0,id:j},c),dv(a,a=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":c?j:void 0},p.createElement(df.Provider,{value:m},a))))}),dj=p.forwardRef((a,b)=>{let{alwaysRender:c,...d}=a,e=p.useRef(null),f=ds(a=>!a.search);return c||f?p.createElement(c5.div,{ref:bs(e,b),...d,"cmdk-separator":"",role:"separator"}):null}),dk=p.forwardRef((a,b)=>{let{onValueChange:c,...d}=a,e=null!=a.value,f=p.useContext(de),g=ds(a=>a.search),h=ds(a=>a.selectedItemId),i=p.useContext(dd);return p.useEffect(()=>{null!=a.value&&f.setState("search",a.value)},[a.value]),p.createElement(c5.input,{ref:b,...d,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":i.listId,"aria-labelledby":i.labelId,"aria-activedescendant":h,id:i.inputId,type:"text",value:e?a.value:g,onChange:a=>{e||f.setState("search",a.target.value),null==c||c(a.target.value)}})}),dl=p.forwardRef((a,b)=>{let{children:c,label:d="Suggestions",...e}=a,f=p.useRef(null),g=p.useRef(null),h=ds(a=>a.selectedItemId),i=p.useContext(dd);return p.useEffect(()=>{if(g.current&&f.current){let a=g.current,b=f.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let c=a.offsetHeight;b.style.setProperty("--cmdk-list-height",c.toFixed(1)+"px")})});return d.observe(a),()=>{cancelAnimationFrame(c),d.unobserve(a)}}},[]),p.createElement(c5.div,{ref:bs(f,b),...e,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":h,"aria-label":d,id:i.listId},dv(a,a=>p.createElement("div",{ref:bs(g,i.listInnerRef),"cmdk-list-sizer":""},a)))}),dm=p.forwardRef((a,b)=>{let{open:c,onOpenChange:d,overlayClassName:e,contentClassName:f,container:g,...h}=a;return p.createElement(cE,{open:c,onOpenChange:d},p.createElement(cJ,{container:g},p.createElement(cL,{"cmdk-overlay":"",className:e}),p.createElement(cP,{"aria-label":a.label,"cmdk-dialog":"",className:f},p.createElement(dg,{ref:b,...h}))))}),dn=Object.assign(dg,{List:dl,Item:dh,Input:dk,Group:di,Separator:dj,Dialog:dm,Empty:p.forwardRef((a,b)=>ds(a=>0===a.filtered.count)?p.createElement(c5.div,{ref:b,...a,"cmdk-empty":"",role:"presentation"}):null),Loading:p.forwardRef((a,b)=>{let{progress:c,children:d,label:e="Loading...",...f}=a;return p.createElement(c5.div,{ref:b,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":c,"aria-valuemin":0,"aria-valuemax":100,"aria-label":e},dv(a,a=>p.createElement("div",{"aria-hidden":!0},a)))})});function dp(a){let b=p.useRef(a);return dq(()=>{b.current=a}),b}var dq=p.useEffect;function dr(a){let b=p.useRef();return void 0===b.current&&(b.current=a()),b}function ds(a){let b=p.useContext(de),c=()=>a(b.snapshot());return p.useSyncExternalStore(b.subscribe,c,c)}function dt(a,b,c,d=[]){let e=p.useRef(),f=p.useContext(dd);return dq(()=>{var g;let h=(()=>{var a;for(let b of c){if("string"==typeof b)return b.trim();if("object"==typeof b&&"current"in b)return b.current?null==(a=b.current.textContent)?void 0:a.trim():e.current}})(),i=d.map(a=>a.trim());f.value(a,h,i),null==(g=b.current)||g.setAttribute(db,h),e.current=h}),e}var du=()=>{let[a,b]=p.useState(),c=dr(()=>new Map);return dq(()=>{c.current.forEach(a=>a()),c.current=new Map},[a]),(a,d)=>{c.current.set(a,d),b({})}};function dv({asChild:a,children:b},c){let d;return a&&p.isValidElement(b)?p.cloneElement("function"==typeof(d=b.type)?d(b.props):"render"in d?d.render(b.props):b,{ref:b.ref},c(b.props.children)):c(b)}var dw={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},dx=a.i(488137);function dy({className:a,...b}){return(0,o.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,bh.cn)("group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",a),...b})}let dz=(0,dx.cva)("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function dA({className:a,align:b="inline-start",...c}){return(0,o.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":b,className:(0,bh.cn)(dz({align:b}),a),onClick:a=>{a.target.closest("button")||a.currentTarget.parentElement?.querySelector("input")?.focus()},...c})}(0,dx.cva)("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});var dB=a.i(458415),dB=dB,dC=a.i(659503);function dD({className:a,...b}){return(0,o.jsx)(dn,{"data-slot":"command",className:(0,bh.cn)("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",a),...b})}function dE({className:a,...b}){return(0,o.jsx)("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:(0,o.jsxs)(dy,{className:"h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!",children:[(0,o.jsx)(dn.Input,{"data-slot":"command-input",className:(0,bh.cn)("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",a),...b}),(0,o.jsx)(dA,{children:(0,o.jsx)(dB.default,{className:"size-4 shrink-0 opacity-50"})})]})})}function dF({className:a,...b}){return(0,o.jsx)(dn.List,{"data-slot":"command-list",className:(0,bh.cn)("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",a),...b})}function dG({className:a,...b}){return(0,o.jsx)(dn.Empty,{"data-slot":"command-empty",className:(0,bh.cn)("py-6 text-center text-sm",a),...b})}function dH({className:a,...b}){return(0,o.jsx)(dn.Group,{"data-slot":"command-group",className:(0,bh.cn)("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",a),...b})}function dI({className:a,children:b,...c}){return(0,o.jsxs)(dn.Item,{"data-slot":"command-item",className:(0,bh.cn)("group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground",a),...c,children:[b,(0,o.jsx)(dC.CheckIcon,{className:"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"})]})}var dJ=a.i(879876);let dK=(0,dJ.createServerReference)("4014ba9c54ad6a1c21619cdabfbe272a96517b3319",dJ.callServer,void 0,dJ.findSourceMapURL,"getProjectBranches"),dL=(0,dJ.createServerReference)("40d73e44905481a0aebd424628ff7cf8a9c78de0df",dJ.callServer,void 0,dJ.findSourceMapURL,"fetchRemoteBranches"),dM=(0,dJ.createServerReference)("4076a78d79fc639792e028377a4abbf4ad88c210a2",dJ.callServer,void 0,dJ.findSourceMapURL,"getCurrentBranch");function dN({open:a,onOpenChange:b,onSubmit:c,onUpdate:d,defaultStatus:e="TODO",editTask:f,editTaskLabelIds:g,labels:h,projectType:i,projectLocalPath:j}){let[k,l]=(0,p.useState)(""),[m,n]=(0,p.useState)(""),[q,r]=(0,p.useState)("MEDIUM"),[s,t]=(0,p.useState)(""),[u,w]=(0,p.useState)([]),[x,y]=(0,p.useState)([]),[A,B]=(0,p.useState)(!1),[D,E]=(0,p.useState)(""),[F,G]=(0,p.useState)(!1),[H,I]=(0,p.useState)(!0),{t:J}=(0,v.useI18n)(),K=!!f,L=!!j;return(0,p.useEffect)(()=>{f?(l(f.title),n(f.description??""),r(f.priority),t(f.subPath??""),w(g??[])):(l(""),n(""),r("MEDIUM"),t(""),w([]))},[f,g]),(0,p.useEffect)(()=>{a||f||(l(""),n(""),r("MEDIUM"),t(""),w([]),y([]),E(""),G(!1))},[a,f]),(0,p.useEffect)(()=>{a&&L&&!f&&(B(!0),Promise.all([dK(j),dM(j)]).then(([a,b])=>{y(a),E(b&&a.includes(b)?b:a[0]??""),B(!1),dL(j).then(()=>{setTimeout(()=>{dK(j).then(a=>{y(a),E(b=>a.includes(b)?b:a[0]??"")}).catch(()=>{})},3e3)})}).catch(()=>{y([]),E(""),B(!1)}))},[a,L,j,f]),(0,o.jsx)(Q.Dialog,{open:a,onOpenChange:b,disablePointerDismissal:!0,children:(0,o.jsxs)(Q.DialogContent,{className:"sm:max-w-md",children:[(0,o.jsx)(Q.DialogHeader,{children:(0,o.jsx)(Q.DialogTitle,{children:K?J("task.edit"):J("task.create")})}),(0,o.jsxs)("div",{className:"space-y-4 py-2",children:[(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{htmlFor:"title",children:J("task.title")}),(0,o.jsx)(V.Input,{id:"title","data-testid":"task-title",placeholder:J("task.titlePlaceholder"),value:k,onChange:a=>l(a.target.value),onKeyDown:a=>"Enter"===a.key&&a.preventDefault()})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{htmlFor:"description",children:J("task.description")}),(0,o.jsx)(W.Textarea,{id:"description",placeholder:J("task.descPlaceholder"),rows:4,value:m,onChange:a=>n(a.target.value),className:"max-h-[200px] overflow-y-auto"})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{htmlFor:"subPath",children:J("task.subPath")}),(0,o.jsx)(V.Input,{id:"subPath",placeholder:J("task.subPathPlaceholder"),value:s,onChange:a=>t(a.target.value)}),(0,o.jsx)("p",{className:"text-xs text-muted-foreground",children:J("task.subPathHint")})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{children:J("task.priority")}),(0,o.jsx)("div",{className:"flex gap-1.5",children:["LOW","MEDIUM","HIGH","CRITICAL"].map(a=>{let b={LOW:{label:J("task.priorityLow"),style:"text-slate-300 border-slate-500/30 bg-slate-500/10"},MEDIUM:{label:J("task.priorityMedium"),style:"text-amber-300 border-amber-500/30 bg-amber-500/10"},HIGH:{label:J("task.priorityHigh"),style:"text-orange-300 border-orange-500/30 bg-orange-500/10"},CRITICAL:{label:J("task.priorityCritical"),style:"text-rose-300 border-rose-500/30 bg-rose-500/10"}}[a];return(0,o.jsx)("button",{type:"button",onClick:()=>r(a),className:`rounded-lg border px-3 py-1.5 text-xs font-medium transition-all ${q===a?`${b.style} ring-1 ring-current/20`:"border-border text-muted-foreground hover:bg-accent"}`,children:b.label},a)})})]}),L&&!K&&(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{children:J("task.baseBranch")}),A?(0,o.jsx)("div",{className:"text-sm text-muted-foreground",children:J("task.branchLoading")}):x.length>0?(0,o.jsxs)(bi,{open:F,onOpenChange:G,children:[(0,o.jsxs)(bj,{className:"flex w-full items-center gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm font-mono transition-colors hover:bg-accent focus:outline-none focus:ring-1 focus:ring-ring","data-testid":"branch-selector",children:[(0,o.jsx)(Y.GitBranch,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,o.jsx)("span",{className:"flex-1 truncate text-left text-xs",children:D||J("task.branchNone")}),(0,o.jsx)(Z,{className:"h-3.5 w-3.5 shrink-0 opacity-50"})]}),(0,o.jsx)(bk,{className:"p-0",align:"start",children:(0,o.jsxs)(dD,{children:[(0,o.jsx)(dE,{placeholder:J("task.branchSearch")}),(0,o.jsxs)(dF,{children:[(0,o.jsx)(dG,{children:J("task.branchNone")}),(0,o.jsx)(dH,{children:x.map(a=>(0,o.jsxs)(dI,{value:a,onSelect:()=>{E(a),G(!1)},children:[(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3 text-muted-foreground shrink-0 mr-2"}),(0,o.jsx)("span",{className:"flex-1 truncate font-mono",children:a}),a===D&&(0,o.jsx)(C.Check,{className:"h-3 w-3 text-primary shrink-0 ml-auto"})]},a))})]})]})})]}):(0,o.jsx)("div",{className:"text-sm text-muted-foreground",children:J("task.branchNone")}),(0,o.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,o.jsx)(X.Label,{className:"text-xs text-muted-foreground",children:J("task.worktreeLabel")}),(0,o.jsx)("div",{className:"flex gap-1",children:[!0,!1].map(a=>(0,o.jsx)("button",{type:"button",onClick:()=>I(a),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${H===a?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:a?J("task.worktreeYes"):J("task.worktreeNo")},String(a)))})]})]}),h.length>0&&(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{children:J("task.labels")}),(0,o.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.map(a=>{let b=u.includes(a.id);return(0,o.jsx)("button",{type:"button",onClick:()=>{w(c=>b?c.filter(b=>b!==a.id):[...c,a.id])},className:`rounded-full px-2.5 py-1 text-xs font-medium transition-all ${b?"ring-1 ring-current/30":"opacity-50 hover:opacity-80"}`,style:{backgroundColor:a.color+"20",color:a.color,borderColor:b?a.color+"40":"transparent",borderWidth:"1px"},children:a.name},a.id)})})]})]}),(0,o.jsxs)(Q.DialogFooter,{children:[(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>b(!1),children:J("common.cancel")}),(0,o.jsx)(z.Button,{onClick:()=>{k.trim()&&(K&&d?d(f.id,{title:k,description:m,priority:q,labelIds:u,subPath:s.trim()||""}):c({title:k,description:m,priority:q,status:e,labelIds:u,...L&&H&&D?{baseBranch:D}:{},...s.trim()?{subPath:s.trim()}:{}}),l(""),n(""),r("MEDIUM"),t(""),w([]),y([]),E(""),I(!0),b(!1))},className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:K?J("common.save"):J("common.create")})]})]})})}var dO=a.i(354994),dP=a.i(506008),dQ=a.i(212765),dR=a.i(161604),dS=a.i(986379);let dT=(0,r.default)("git-commit-vertical",[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]);var dU=a.i(467034),dV=a.i(109434),dW=a.i(938899),dX=a.i(145685),dY=a.i(677647),dZ=a.i(134729);let d$=(0,dJ.createServerReference)("401a86ff2781c007191e772caa16e4b6e7441b15d0",dJ.callServer,void 0,dJ.findSourceMapURL,"deleteProject"),d_=(0,dJ.createServerReference)("400261a6fb1c366a989585444549d8506d4ba9db8c",dJ.callServer,void 0,dJ.findSourceMapURL,"getRecentLocalProjects"),d0=(0,dJ.createServerReference)("40f970bc0ca57ada0365f4088ef980b207fcf6a70c",dJ.callServer,void 0,dJ.findSourceMapURL,"getOrCreateTowerTaskId");var d1=a.i(413318),d2=a.i(942308),d3=a.i(563504),d4=a.i(845924),d5=a.i(929526);let d6=(0,r.default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);function d7({commits:a}){let{t:b}=(0,v.useI18n)(),[c,d]=(0,p.useState)(!1);return 0===a.length?null:(0,o.jsxs)("div",{children:[(0,o.jsxs)("button",{onClick:()=>d(!c),className:"flex w-full items-center justify-between py-1",children:[(0,o.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:b("git.commitLog")}),c?(0,o.jsx)(dO.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,o.jsx)(dP.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),c&&(0,o.jsx)("div",{className:"mt-1.5 space-y-0.5 max-h-64 overflow-y-auto",children:a.map(a=>(0,o.jsxs)("div",{className:"group flex items-start gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,o.jsx)(dT,{className:"h-3 w-3 shrink-0 text-muted-foreground mt-0.5"}),(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)("p",{className:"text-xs text-foreground line-clamp-1",children:a.message}),(0,o.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,o.jsxs)("button",{onClick:()=>{navigator.clipboard.writeText(a.shortHash),d2.toast.success(`Copied ${a.shortHash}`)},className:"flex items-center gap-0.5 font-mono text-[10px] text-primary/70 hover:text-primary transition-colors",children:[a.shortHash,(0,o.jsx)(d6,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]}),(0,o.jsx)("span",{className:"text-[10px] text-muted-foreground",children:a.author}),(0,o.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(a){let b=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(b<1)return"just now";if(b<60)return`${b}m`;let c=Math.floor(b/60);if(c<24)return`${c}h`;let d=Math.floor(c/24);return d<30?`${d}d`:`${Math.floor(d/30)}mo`}(a.date)})]})]})]},a.hash))})]})}var d8=a.i(14180),d9=a.i(460143),ea=a.i(820838);function eb({localPath:a,stashes:b,hasChanges:c,onRefresh:d}){let{t:e}=(0,v.useI18n)(),[f,g]=(0,p.useState)(!1),[h,i]=(0,p.useState)(!1),[j,k]=(0,p.useState)(""),[l,m]=(0,p.useState)(null),n=async()=>{i(!0);try{await (0,ea.gitAction)(a,"stash-save",{message:j}),k(""),d2.toast.success(e("git.stashSaved")),await d()}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}finally{i(!1)}},q=async b=>{m(b);try{await (0,ea.gitAction)(a,"stash-pop",{index:b}),d2.toast.success(e("git.stashApplied")),await d()}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}finally{m(null)}},r=async b=>{m(b);try{await (0,ea.gitAction)(a,"stash-drop",{index:b}),d2.toast.success(e("git.stashDropped")),await d()}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}finally{m(null)}};return c||0!==b.length?(0,o.jsxs)("div",{children:[(0,o.jsxs)("button",{onClick:()=>g(!f),className:"flex w-full items-center justify-between py-1",children:[(0,o.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[e("git.stash")," ",b.length>0&&`(${b.length})`]}),f?(0,o.jsx)(dO.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,o.jsx)(dP.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),f&&(0,o.jsxs)("div",{className:"mt-1.5 space-y-2",children:[c&&(0,o.jsxs)("div",{className:"flex gap-1.5",children:[(0,o.jsx)(V.Input,{value:j,onChange:a=>k(a.target.value),placeholder:e("git.stashMsgPlaceholder"),className:"h-7 text-xs flex-1",onKeyDown:a=>"Enter"===a.key&&n()}),(0,o.jsx)(z.Button,{variant:"outline",size:"icon-sm",onClick:n,disabled:h,className:"shrink-0",children:h?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin"}):(0,o.jsx)(d8.Archive,{className:"h-3 w-3"})})]}),b.length>0&&(0,o.jsx)("div",{className:"space-y-0.5",children:b.map(a=>(0,o.jsxs)("div",{className:"group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,o.jsx)(d8.Archive,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,o.jsx)("span",{className:"flex-1 min-w-0 truncate text-xs text-foreground",children:a.message||`stash@{${a.index}}`}),(0,o.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:()=>q(a.index),disabled:l===a.index,className:"text-muted-foreground","aria-label":e("git.stashApply"),children:l===a.index?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin"}):(0,o.jsx)(d9.ArrowUpFromLine,{className:"h-3 w-3"})}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:()=>r(a.index),disabled:l===a.index,className:"text-rose-400","aria-label":e("git.stashDrop"),children:(0,o.jsx)(L.Trash2,{className:"h-3 w-3"})})]})]},a.index))})]})]}):null}function ec({project:a,workspaceId:b}){let{t:c,locale:d}=(0,v.useI18n)(),e=(0,q.useRouter)(),[f,g]=(0,p.useState)(!0),[h,i]=(0,p.useState)(!0),[j,k]=(0,p.useState)(!1),[l,m]=(0,p.useState)(!1),[n,r]=(0,p.useState)(""),[s,t]=(0,p.useState)(!1),[u,w]=(0,p.useState)(!1),[x,y]=(0,p.useState)(!1),[A,B]=(0,p.useState)(a.name),[C,D]=(0,p.useState)(a.alias??""),[E,F]=(0,p.useState)(a.description??""),[G,H]=(0,p.useState)(a.localPath??""),[I,J]=(0,p.useState)(a.projectType??"FRONTEND"),[M,N]=(0,p.useState)([]);(0,p.useEffect)(()=>{d_(100).then(N)},[]);let[O,P]=(0,p.useState)(!1),[R,S]=(0,p.useState)(""),[T,U]=(0,p.useState)(""),[X,Z]=(0,p.useState)(""),[$,_]=(0,p.useState)(""),[aa,ab]=(0,p.useState)("FRONTEND"),[ac,ad]=(0,p.useState)(!1),[ae,af]=(0,p.useState)(!1),[ag,ah]=(0,p.useState)(null),[ai,aj]=(0,p.useState)(!1),[ak,al]=(0,p.useState)(!1),[am,an]=(0,p.useState)(!1),ao=a=>{d2.toast.info(a)},ap=(0,p.useCallback)(async()=>{if(a.localPath){aj(!0);try{let b=await fetch(`/api/git?path=${encodeURIComponent(a.localPath)}`);b.ok&&ah(await b.json())}catch{}finally{aj(!1)}}},[a.localPath]);(0,p.useEffect)(()=>{ap()},[ap]);let aq=async()=>{if(a.localPath){al(!0);try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",path:a.localPath})})).ok?(ao(c("git.initSuccess")),await ap()):ao(c("git.initFailed"))}catch{ao(c("git.initFailed"))}finally{al(!1)}}},ar=async b=>{if(a.localPath)try{let d=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"checkout",path:a.localPath,branch:b})});if(d.ok)ao(`${c("git.switchSuccess")} ${b}`),await ap();else{let a=await d.json();ao(`${c("git.switchFailed")}: ${a.error}`)}}catch{ao(c("git.switchFailed"))}},as=(a,b)=>{e.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1}),e.refresh()},at=async()=>{if(T.trim()){ad(!0);try{let a=await (0,dZ.createProject)({name:T.trim(),alias:X.trim()||void 0,description:$.trim()||void 0,localPath:R,projectType:aa,workspaceId:b});P(!1),as(b,a.id)}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}finally{ad(!1)}}},au=async()=>{if(G&&!ae){af(!0);try{let a=await (0,d1.analyzeProjectDirectory)(G.trim(),d);F(a)}catch{d2.toast.error(c("project.analyzeError"))}finally{af(!1)}}},av=async()=>{try{await (0,dY.updateProject)(a.id,{name:A.trim(),alias:C.trim()||void 0,description:E.trim()||void 0,localPath:G.trim()||void 0,projectType:I}),e.refresh(),k(!1)}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}};return(0,o.jsxs)("aside",{className:"relative w-72 flex-shrink-0 overflow-y-auto border-l border-border bg-sidebar",children:[(0,o.jsxs)("div",{className:"border-b border-border p-4",children:[(0,o.jsxs)("div",{className:"flex items-start justify-between",children:[(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)("h2",{className:"text-base font-semibold text-foreground",children:a.name}),a.alias&&(0,o.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:a.alias})]}),(0,o.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{B(a.name),D(a.alias??""),F(a.description??""),H(a.localPath??""),k(!0)},className:"text-muted-foreground",children:(0,o.jsx)(K.Pencil,{className:"h-3.5 w-3.5"})}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{r(""),m(!0)},className:"text-muted-foreground hover:text-rose-400",children:(0,o.jsx)(L.Trash2,{className:"h-3.5 w-3.5"})})]})]}),a.description&&(0,o.jsx)("p",{className:"mt-2 text-sm text-secondary-foreground leading-relaxed line-clamp-4",children:a.description}),(0,o.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:(0,o.jsx)("span",{className:`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium ${"GIT"===a.type?"bg-sky-500/15 text-sky-300 ring-1 ring-sky-500/20":"bg-muted text-muted-foreground ring-1 ring-border"}`,children:"GIT"===a.type?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3"}),c("sidebar.right.gitType")]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(dR.FileText,{className:"h-3 w-3"}),c("sidebar.right.normalType")]})})}),a.localPath&&(0,o.jsxs)("div",{className:"mt-3 flex items-start gap-2 rounded-md bg-muted/50 px-2.5 py-2 text-xs",children:[(0,o.jsx)(dS.FolderOpen,{className:"mt-0.5 h-3 w-3 shrink-0 text-muted-foreground"}),(0,o.jsx)("span",{className:"break-all font-mono text-secondary-foreground",children:a.localPath})]}),a.gitUrl&&(0,o.jsxs)("div",{className:"mt-2 flex items-start gap-2 rounded-md bg-muted/50 px-2.5 py-2 text-xs",children:[(0,o.jsx)(dQ.Globe,{className:"mt-0.5 h-3 w-3 shrink-0 text-muted-foreground"}),(0,o.jsx)("span",{className:"break-all text-secondary-foreground",children:a.gitUrl})]}),a.localPath&&(0,o.jsxs)(z.Button,{variant:"outline",className:"mt-3 w-full h-8 gap-1.5 text-xs",disabled:u,onClick:async()=>{w(!0);try{let c=await d0(a.id);e.push(`/workspaces/${b}/tasks/${c}`)}catch{d2.toast.error(c("git.openStudioFailed"))}finally{w(!1)}},children:[u?(0,o.jsx)(dV.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,o.jsx)(dS.FolderOpen,{className:"h-3.5 w-3.5"}),c("git.openStudio")]})]}),(0,o.jsxs)("div",{className:"border-b border-border p-4",children:[(0,o.jsxs)(z.Button,{variant:"ghost",onClick:()=>g(!f),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,o.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:c("git.section")}),f?(0,o.jsx)(dO.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,o.jsx)(dP.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),f&&(0,o.jsx)("div",{className:"mt-3",children:a.localPath?ai?(0,o.jsxs)("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:[(0,o.jsx)(dV.Loader2,{className:"h-4 w-4 animate-spin"}),(0,o.jsx)("span",{className:"ml-2 text-xs",children:c("git.loading")})]}):ag&&!ag.isGit?(0,o.jsxs)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,o.jsx)(dU.AlertCircle,{className:"h-3.5 w-3.5"}),(0,o.jsx)("p",{className:"text-xs",children:c("git.notInitialized")})]}),(0,o.jsxs)(z.Button,{className:"mt-3 h-7 w-full gap-1.5 bg-primary/10 text-xs text-primary ring-1 ring-primary/20 hover:bg-primary/15",onClick:aq,disabled:ak,children:[ak?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin"}):(0,o.jsx)(dT,{className:"h-3 w-3"}),c("git.initRepo")]})]}):ag?.isGit?(0,o.jsxs)("div",{className:"space-y-3",children:[(0,o.jsx)(ed,{localBranches:ag.branches??[],remoteBranches:(ag.remoteBranches??[]).filter(a=>!ag.branches?.includes(a)),currentBranch:ag.currentBranch??"",onSwitch:ar,onFetch:async()=>{a.localPath&&(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"fetch",path:a.localPath})}),await ap())},onCreateBranch:()=>an(!0)}),(0,o.jsx)(d7,{commits:ag.commits??[]}),(0,o.jsx)(eb,{localPath:a.localPath,stashes:ag.stashes??[],hasChanges:(ag.changedFiles??[]).length>0,onRefresh:ap})]}):null:(0,o.jsx)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:(0,o.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,o.jsx)(dU.AlertCircle,{className:"h-3.5 w-3.5"}),(0,o.jsx)("p",{className:"text-xs",children:c("git.noLocalPath")})]})})})]}),(0,o.jsxs)("div",{className:"p-4",children:[(0,o.jsxs)(z.Button,{variant:"ghost",onClick:()=>i(!h),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,o.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:c("sidebar.right.browseRepo")}),h?(0,o.jsx)(dO.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,o.jsx)(dP.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),h&&(0,o.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,o.jsxs)(z.Button,{variant:"outline",className:"w-full h-8 gap-1.5 text-xs",onClick:()=>y(!0),children:[(0,o.jsx)(dS.FolderOpen,{className:"h-3.5 w-3.5"}),c("sidebar.right.browseRepo")]}),M.length>0&&(0,o.jsxs)("div",{children:[(0,o.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5 px-1",children:c("sidebar.right.recent")}),(0,o.jsx)("div",{className:"space-y-0.5",children:M.map(b=>(0,o.jsxs)("button",{onClick:()=>{b.id!==a.id&&as(b.workspaceId,b.id)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors ${b.id===a.id?"bg-primary/10 text-primary cursor-default":"hover:bg-accent cursor-pointer"}`,children:["GIT"===b.type?(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,o.jsx)(dS.FolderOpen,{className:"h-3 w-3 shrink-0 text-primary/70"}),(0,o.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,o.jsx)("p",{className:"truncate text-xs font-medium text-foreground",children:b.name}),b.localPath&&(0,o.jsx)("p",{className:"truncate text-[10px] font-mono text-muted-foreground",children:b.localPath})]})]},b.id))})]})]})]}),(0,o.jsx)(Q.Dialog,{open:j,onOpenChange:k,children:(0,o.jsxs)(Q.DialogContent,{style:{maxWidth:"32rem"},children:[(0,o.jsx)(Q.DialogHeader,{children:(0,o.jsx)(Q.DialogTitle,{children:c("project.edit")})}),(0,o.jsxs)("div",{className:"space-y-3 py-2",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.name")}),(0,o.jsx)(V.Input,{value:A,onChange:a=>B(a.target.value),className:"mt-1.5"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.type.label")}),(0,o.jsx)("div",{className:"mt-1.5",children:(0,o.jsx)(d4.SegmentedControl,{options:[{value:"FRONTEND",label:c("project.type.frontend")},{value:"BACKEND",label:c("project.type.backend")}],value:I,onChange:J})})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.alias")}),(0,o.jsx)(V.Input,{value:C,onChange:a=>D(a.target.value),className:"mt-1.5"})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.description")}),(0,o.jsxs)(z.Button,{type:"button",variant:"ghost",onClick:au,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!G||ae?"opacity-50":""}`,children:[ae?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin"}):(0,o.jsx)(dW.Sparkles,{className:"h-3 w-3"}),ae?c("project.analyzing"):c("project.genDesc")]})]}),(0,o.jsx)(W.Textarea,{value:E,onChange:a=>F(a.target.value),rows:2,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none max-h-[200px] overflow-y-auto"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.localPath")}),(0,o.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,o.jsx)(V.Input,{value:G,onChange:a=>H(a.target.value),placeholder:c("project.localPathPlaceholder"),className:"flex-1 font-mono text-xs"}),(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>y(!0),className:"h-8 shrink-0",children:c("folder.browse")})]})]})]}),(0,o.jsxs)(Q.DialogFooter,{children:[(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>k(!1),children:c("common.cancel")}),(0,o.jsx)(z.Button,{onClick:av,disabled:!A.trim()||ae,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:c("common.save")})]})]})}),(0,o.jsx)(d3.FolderBrowserDialog,{open:x,onOpenChange:y,onSelect:a=>{j?H(a):(a=>{let b=M.find(b=>b.localPath===a);if(b)return as(b.workspaceId,b.id);let c=a.split("/").filter(Boolean).pop()??"";S(a),U(c),Z(""),_(""),P(!0)})(a)}}),(0,o.jsx)(Q.Dialog,{open:O,onOpenChange:P,children:(0,o.jsxs)(Q.DialogContent,{className:"sm:max-w-md",children:[(0,o.jsx)(Q.DialogHeader,{children:(0,o.jsx)(Q.DialogTitle,{children:c("topbar.newProject")})}),(0,o.jsxs)("div",{className:"space-y-3 py-2",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.localPath")}),(0,o.jsx)("div",{className:"mt-1.5 rounded-md border border-border bg-muted/50 px-3 py-2 font-mono text-xs text-muted-foreground",children:R})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.name")}),(0,o.jsx)(V.Input,{value:T,onChange:a=>U(a.target.value),placeholder:c("project.namePlaceholder"),className:"mt-1.5"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.type.label")}),(0,o.jsx)("div",{className:"mt-1.5",children:(0,o.jsx)(d4.SegmentedControl,{options:[{value:"FRONTEND",label:c("project.type.frontend")},{value:"BACKEND",label:c("project.type.backend")}],value:aa,onChange:ab})})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.alias")}),(0,o.jsx)(V.Input,{value:X,onChange:a=>Z(a.target.value),placeholder:c("project.aliasPlaceholder"),className:"mt-1.5"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.description")}),(0,o.jsx)(W.Textarea,{value:$,onChange:a=>_(a.target.value),placeholder:c("project.descPlaceholder"),rows:2,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none"})]})]}),(0,o.jsxs)(Q.DialogFooter,{children:[(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>P(!1),children:c("common.cancel")}),(0,o.jsxs)(z.Button,{onClick:at,disabled:!T.trim()||ac,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[ac?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,c("common.create")]})]})]})}),ag?.isGit&&(0,o.jsx)(d5.CreateBranchDialog,{open:am,onOpenChange:an,branches:ag.branches??[],currentBranch:ag.currentBranch??"",localPath:a.localPath,onCreated:async()=>{await ap(),ao(c("git.createSuccess"))},onError:a=>ao(`${c("git.createFailed")}: ${a}`)}),(0,o.jsx)(Q.Dialog,{open:l,onOpenChange:a=>{m(a),a||r("")},children:(0,o.jsxs)(Q.DialogContent,{className:"sm:max-w-md",children:[(0,o.jsx)(Q.DialogHeader,{children:(0,o.jsx)(Q.DialogTitle,{className:"text-rose-400",children:c("project.deleteTitle")})}),(0,o.jsxs)("div",{className:"space-y-3 py-2",children:[(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:c("project.deleteWarning",{name:a.name})}),(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:c("project.deleteIrreversible")}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.deleteConfirmLabel")}),(0,o.jsx)(V.Input,{value:n,onChange:a=>r(a.target.value),placeholder:c("project.deleteConfirmPlaceholder"),className:"mt-1.5",autoFocus:!0})]})]}),(0,o.jsxs)(Q.DialogFooter,{children:[(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>m(!1),children:c("common.cancel")}),(0,o.jsxs)(z.Button,{variant:"destructive",disabled:n!==c("project.deleteConfirmText")||s,onClick:async()=>{t(!0);try{await d$(a.id),d2.toast.success(c("project.deleteSuccess")),e.push(`/workspaces/${b}`)}catch{d2.toast.error(c("project.deleteFailed"))}finally{t(!1),m(!1)}},children:[s&&(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin mr-1"}),c("project.deleteButton")]})]})]})})]})}function ed({localBranches:a,remoteBranches:b,currentBranch:c,onSwitch:d,onFetch:e,onCreateBranch:f}){let{t:g}=(0,v.useI18n)(),[h,i]=(0,p.useState)(!1),[j,k]=(0,p.useState)(""),[l,m]=(0,p.useState)(!1),n=(0,p.useRef)(null);(0,p.useEffect)(()=>{if(h)return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a);function a(a){n.current&&!n.current.contains(a.target)&&i(!1)}},[h]);let q=j.toLowerCase(),r=a.filter(a=>a.toLowerCase().includes(q)),s=b.filter(a=>a.toLowerCase().includes(q)),t=r.length>0||s.length>0,u=async()=>{m(!0);try{await e()}finally{m(!1)}};return(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,o.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("git.currentBranch")}),(0,o.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:u,disabled:l,className:"text-muted-foreground","aria-label":"Fetch",children:(0,o.jsx)(dX.RefreshCw,{className:`h-3 w-3 ${l?"animate-spin":""}`})}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:f,className:"text-muted-foreground","aria-label":g("git.createBranch"),children:(0,o.jsx)(x.Plus,{className:"h-3 w-3"})})]})]}),(0,o.jsxs)("div",{className:"relative",ref:n,children:[(0,o.jsxs)("button",{onClick:()=>{i(!h),k("")},className:"flex w-full items-center justify-between rounded-lg border border-border bg-muted/50 px-3 py-2 text-left transition-colors hover:bg-accent",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}),(0,o.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:c||"—"})]}),(0,o.jsx)(dO.ChevronDown,{className:`h-3 w-3 shrink-0 text-muted-foreground transition-transform ${h?"rotate-180":""}`})]}),h&&(0,o.jsxs)("div",{className:"absolute left-0 right-0 top-full z-20 mt-1 rounded-lg border border-border bg-popover shadow-xl",children:[(0,o.jsx)("div",{className:"border-b border-border p-1.5",children:(0,o.jsxs)("div",{className:"relative",children:[(0,o.jsx)(y.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),(0,o.jsx)("input",{value:j,onChange:a=>k(a.target.value),placeholder:"Filter...",autoFocus:!0,className:"h-7 w-full rounded-md bg-muted/50 pl-7 pr-2 text-xs text-foreground placeholder-muted-foreground outline-none focus:ring-1 focus:ring-ring"})]})}),(0,o.jsxs)("div",{className:"max-h-60 overflow-auto py-1",children:[!t&&(0,o.jsx)("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No branches found"}),r.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{className:"px-3 pt-1.5 pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("git.localBranches")}),r.map(a=>{let b=a===c;return(0,o.jsxs)("button",{onClick:()=>{b||d(a),i(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors ${b?"bg-emerald-500/10 text-emerald-400":"text-secondary-foreground hover:bg-accent"}`,children:[(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,o.jsx)("span",{className:"truncate font-mono text-xs",children:a}),b&&(0,o.jsx)(C.Check,{className:"h-3 w-3 ml-auto shrink-0"})]},`local-${a}`)})]}),s.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{className:"px-3 pt-2.5 pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("git.remoteBranches")}),s.map(a=>(0,o.jsxs)("button",{onClick:()=>{d(a),i(!1)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-secondary-foreground transition-colors hover:bg-accent",children:[(0,o.jsx)(dQ.Globe,{className:"h-3 w-3 shrink-0 text-sky-400"}),(0,o.jsx)("span",{className:"truncate font-mono text-xs",children:a})]},`remote-${a}`))]})]})]})]})]})}let ee=(0,r.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var ef=a.i(236413),eg=a.i(105916),eh=a.i(57726),ei=a.i(224372),ej=a.i(95446),ek=a.i(59711);function el({title:a,description:b,branch:c,baseBranch:d,hasConversation:e,updatedAt:f,onBack:g}){let{t:h}=(0,v.useI18n)();return(0,o.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)(dW.Sparkles,{className:"h-3.5 w-3.5 text-primary"}),(0,o.jsx)("span",{className:"text-xs font-semibold text-primary",children:h("taskDetail.title")})]}),(0,o.jsxs)(z.Button,{variant:"ghost",onClick:g,className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground h-auto px-2 py-1",children:[(0,o.jsx)(ek.ArrowLeft,{className:"h-3.5 w-3.5"}),h("taskDetail.back")]})]}),(0,o.jsx)("h2",{className:"mt-2.5 text-lg font-bold tracking-tight text-foreground",children:a}),b&&(0,o.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:b}),(0,o.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[d?(0,o.jsxs)(N.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:[(0,o.jsx)(Y.GitBranch,{className:"mr-1 h-3 w-3"}),d," · worktree"]}):c?(0,o.jsx)(N.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:h("taskDetail.directMode")}):null,e&&(0,o.jsx)(N.Badge,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-400 text-[10px] border border-emerald-500/20",children:h("taskDetail.hasConversation")}),(0,o.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h("taskDetail.updatedAt")," ",(0,bh.formatRelativeTime)(f)]})]})]})}var em=a.i(641804),en=a.i(569720),eo=a.i(184083),ep=a.i(181366),eq=a.i(728368),er=a.i(429621),es=a.i(967086),et=a.i(457653),eu=a.i(481908),ev=a.i(918593),ew=a.i(605446),ex=a.i(988977),ey=a.i(884284),ez=a.i(208168);let eA=(0,r.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);var eB=a.i(54709),eC=a.i(589492);let eD=(0,dJ.createServerReference)("400451039c091db41044fd8a496545041bc12e3909",dJ.callServer,void 0,dJ.findSourceMapURL,"getTaskNotes");var eE=a.i(29602);let eF=(0,dJ.createServerReference)("40a8cc279e0ac90608e2af43dfb8227bf5cdd59d47",dJ.callServer,void 0,dJ.findSourceMapURL,"getTaskAssets");var eG=a.i(13207),eH=a.i(8761);function eI({taskId:a,projectId:b}){let{t:c}=(0,v.useI18n)(),d=(0,p.useRef)(null),[e,f]=(0,p.useState)([]),[g,h]=(0,p.useState)([]),[i,j]=(0,p.useState)(!1),[k,l]=(0,p.useState)(""),[m,n]=(0,p.useState)(""),[q,r]=(0,p.useState)(!1);async function s(){k.trim()&&(await (0,eC.createNote)({title:k.trim(),content:m.trim(),projectId:b,taskId:a,category:"task"}),l(""),n(""),j(!1),eD(a).then(f))}async function t(a){await (0,eE.deleteNote)(a),f(b=>b.filter(b=>b.id!==a))}async function u(c){let e=c.target.files?.[0];if(e){r(!0);try{let c=new FormData;c.set("file",e),c.set("projectId",b),c.set("taskId",a),await (0,eG.uploadAsset)(c),eF(a).then(h)}finally{r(!1),d.current&&(d.current.value="")}}}async function w(a){await (0,eH.deleteAsset)(a),h(b=>b.filter(b=>b.id!==a))}return(0,p.useEffect)(()=>{eD(a).then(f),eF(a).then(h)},[a]),(0,o.jsx)(R.ScrollArea,{className:"h-full",children:(0,o.jsxs)("div",{className:"flex flex-col",children:[(0,o.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,o.jsx)(dR.FileText,{className:"h-3.5 w-3.5"}),c("taskPage.notes")]}),(0,o.jsxs)(z.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>j(!i),children:[i?(0,o.jsx)(eB.X,{className:"h-3 w-3"}):(0,o.jsx)(x.Plus,{className:"h-3 w-3"}),i?"":c("taskPage.addNote")]})]}),i&&(0,o.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,o.jsx)("input",{type:"text",value:k,onChange:a=>l(a.target.value),placeholder:c("taskPage.noteTitle"),className:"h-8 w-full rounded-md border border-border bg-background px-3 text-sm focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),(0,o.jsx)("textarea",{value:m,onChange:a=>n(a.target.value),placeholder:c("taskPage.noteContent"),rows:3,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-primary resize-none"}),(0,o.jsx)(z.Button,{className:"text-xs",onClick:s,disabled:!k.trim(),children:c("taskPage.addNote")})]}),(0,o.jsxs)("div",{className:"mt-2 space-y-2",children:[0===e.length&&!i&&(0,o.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:c("taskPage.noNotes")}),e.map(a=>(0,o.jsx)("div",{className:"group rounded-md border border-border bg-card p-3",children:(0,o.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,o.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,o.jsx)("h4",{className:"text-sm font-medium truncate",children:a.title}),a.content&&(0,o.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-3 whitespace-pre-wrap",children:a.content}),(0,o.jsx)("p",{className:"mt-1 text-[10px] text-muted-foreground",children:new Date(a.createdAt).toLocaleString()})]}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:()=>t(a.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:c("taskPage.deleteNote"),children:(0,o.jsx)(L.Trash2,{className:"h-3.5 w-3.5"})})]})},a.id))]})]}),(0,o.jsxs)("div",{className:"px-4 py-3",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,o.jsx)(eA,{className:"h-3.5 w-3.5"}),c("taskPage.attachments")]}),(0,o.jsxs)(z.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>d.current?.click(),disabled:q,children:[(0,o.jsx)(ez.Upload,{className:"h-3 w-3"}),c("taskPage.uploadFile")]}),(0,o.jsx)("input",{ref:d,type:"file",className:"hidden",onChange:u})]}),(0,o.jsxs)("div",{className:"mt-2 space-y-1.5",children:[0===g.length&&(0,o.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:c("taskPage.noAttachments")}),g.map(a=>{var b;return(0,o.jsxs)("div",{className:"group flex items-center gap-2 rounded-md border border-border bg-card px-3 py-2",children:[(0,o.jsx)(eA,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,o.jsx)("span",{className:"flex-1 truncate text-sm",children:a.filename}),(0,o.jsx)("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:(b=a.size)?b<1024?`${b} B`:b<1048576?`${(b/1024).toFixed(1)} KB`:`${(b/1024/1024).toFixed(1)} MB`:""}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:()=>w(a.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:c("taskPage.deleteAttachment"),children:(0,o.jsx)(L.Trash2,{className:"h-3 w-3"})})]},a.id)})]})]})]})})}function eJ({task:a,workspaceId:b,projectLocalPath:c,onClose:d}){let{t:e}=(0,v.useI18n)(),f=(0,q.useRouter)(),{removePortal:g}=(0,eo.useTerminalPortal)(),[h,i]=(0,p.useState)("terminal"),[j,k]=(0,p.useState)(null),[l,m]=(0,p.useState)(!1),[n,r]=(0,p.useState)(a.status);(0,p.useEffect)(()=>{r(a.status)},[a.status]);let[s,t]=(0,p.useState)(null),[u,w]=(0,p.useState)(!1),[x,y]=(0,p.useState)(!1),[A,B]=(0,p.useState)([]);(0,p.useEffect)(()=>{t(null),w(!1),y(!1),B([]),k(null),i("terminal")},[a.id]);let[C,D]=(0,p.useState)([]),[E,F]=(0,p.useState)(null);(0,p.useEffect)(()=>{let a=!1;return(0,ex.getPrompts)().then(b=>{if(a)return;D(b.map(a=>({id:a.id,name:a.name,isDefault:a.isDefault})));let c=b.find(a=>a.isDefault);c&&F(c.id)}),()=>{a=!0}},[]),(0,p.useEffect)(()=>{t(null),y(!1);let b=!1;return(0,ep.getTaskExecutions)(a.id).then(a=>{if(b)return;let d=a[0];if(d?.status==="RUNNING"){let a=d.worktreePath||c||null;a&&t(a)}B(a.filter(a=>"RUNNING"!==a.status)),y(!0)}),()=>{b=!0}},[a.id]),(0,p.useEffect)(()=>{if("changes"!==h||"TODO"===n||"CANCELLED"===n)return;let b=!1;return m(!0),fetch(`/api/tasks/${a.id}/diff`).then(a=>{if(!a.ok)throw Error(`HTTP ${a.status}`);return a.json()}).then(a=>{b||k(a?.files||a?.branchDeleted?a:null)}).catch(()=>{b||k(null)}).finally(()=>{b||m(!1)}),()=>{b=!0}},[h,n,a.id]);let G=(0,p.useCallback)(async()=>{if(!u){w(!0);try{let{worktreePath:b}=await (0,eq.startPtyExecution)(a.id,"",E);t(b),r("IN_PROGRESS")}catch(a){w(!1),d2.toast.error(a instanceof Error?a.message:String(a))}}},[a.id,u,E]),H=(0,p.useCallback)(b=>{w(!1),t(null),g(a.id),0===b&&r("IN_REVIEW"),(0,ep.getTaskExecutions)(a.id).then(a=>{B(a.filter(a=>"RUNNING"!==a.status))}),f.refresh()},[f,a.id]),I=(0,p.useCallback)(async()=>{await (0,er.stopPtyExecution)(a.id),w(!1),t(null),r("IN_REVIEW"),(0,ep.getTaskExecutions)(a.id).then(a=>{B(a.filter(a=>"RUNNING"!==a.status))}),f.refresh()},[a.id,f]),J=(0,p.useCallback)(async b=>{w(!0),g(a.id),t(null);try{let{worktreePath:c}=await (0,es.resumePtyExecution)(a.id,b);t(c),r("IN_PROGRESS")}catch{w(!1)}},[a.id,g]),K=(0,p.useCallback)(async()=>{w(!0),g(a.id),t(null);try{let{worktreePath:b}=await (0,et.continueLatestPtyExecution)(a.id);t(b),r("IN_PROGRESS")}catch(a){w(!1),d2.toast.error(a instanceof Error?a.message:String(a))}},[a.id,g]),[L,M]=(0,p.useState)(!1),[N,O]=(0,p.useState)([]),P=(0,p.useCallback)(async()=>{try{let b=await (0,ev.checkWorktreeClean)(a.id);if(b.hasWorktree&&!b.clean)return void d2.toast.error(e("taskPage.uncommittedChanges",{count:String(b.files.length)}));if(b.hasWorktree&&b.clean&&!b.hasCommits)return void d2.toast.error(e("taskPage.noChangesToComplete"));if(b.hasWorktree&&b.hasCommits){O(b.commitLog),M(!0);return}await (0,eu.updateTaskStatus)(a.id,"DONE"),r("DONE"),d2.toast.success(e("taskPage.taskCompleted")),f.refresh()}catch{d2.toast.error("Failed to complete task")}},[a.id,f,e]),Q=(0,p.useCallback)(()=>{r("DONE"),M(!1),d2.toast.success(e("taskPage.taskCompleted")),f.refresh()},[f,e]),S=(0,p.useCallback)(async b=>{try{let{hash:c}=await (0,ew.commitWorktreeChanges)(a.id,b);d2.toast.success(e("diff.commitSuccess",{hash:c})),f.refresh();let d=await fetch(`/api/tasks/${a.id}/diff`);if(d.ok){let a=await d.json();k(a?.files?a:null)}}catch(a){d2.toast.error(a instanceof Error?a.message:"Commit failed")}},[a.id,f,e]);return(0,o.jsxs)("div",{className:"flex h-full w-[600px] flex-shrink-0 flex-col border-l border-border bg-sidebar","data-testid":"task-detail-panel",children:[(0,o.jsx)(el,{title:a.title,description:e("taskDetail.panelDescription"),branch:`task/${a.id}`,baseBranch:a.baseBranch,hasConversation:!1,updatedAt:a.updatedAt,onBack:d}),(0,o.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-2",children:[(0,o.jsxs)("div",{className:"flex gap-1",children:[(0,o.jsxs)("button",{onClick:()=>i("terminal"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"terminal"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,o.jsx)(ef.Terminal,{className:"h-3 w-3"}),e("terminal.execute")]}),(0,o.jsx)("button",{onClick:()=>i("changes"),className:`px-3 py-1 text-xs font-medium rounded-md ${"changes"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:e("taskPage.changes")}),(0,o.jsxs)("button",{onClick:()=>i("notes"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"notes"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,o.jsx)(dR.FileText,{className:"h-3 w-3"}),e("taskPage.notes")]})]}),(0,o.jsxs)("div",{className:"flex items-center gap-2",children:["IN_REVIEW"===n&&(0,o.jsxs)(z.Button,{size:"sm",onClick:P,className:"bg-emerald-500/15 text-emerald-400 ring-1 ring-emerald-500/20 hover:bg-emerald-500/25",children:[(0,o.jsx)(eh.CheckCircle2,{className:"h-3 w-3"}),e("taskPage.completeTask")]}),"DONE"!==n&&"CANCELLED"!==n&&(0,o.jsxs)(z.Button,{variant:"ghost",size:"sm",onClick:()=>f.push(`/workspaces/${b}/tasks/${a.id}`),className:"text-muted-foreground",children:[(0,o.jsx)(ee,{className:"h-3 w-3"}),e("taskPage.viewDetails")]})]})]}),"terminal"===h?(0,o.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:x?s?(0,o.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,o.jsxs)("div",{className:"shrink-0 flex items-center justify-between border-b border-neutral-800 px-3 py-2 bg-[#0f1419]",children:[(0,o.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-emerald-400",children:[(0,o.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"}),e("execution.running")]}),(0,o.jsxs)(ej.Tooltip,{children:[(0,o.jsxs)(ej.TooltipTrigger,{onClick:I,className:"flex items-center gap-1.5 rounded-md bg-red-500/15 px-3 py-1 text-xs font-medium text-red-400 hover:bg-red-500/25 transition-colors",children:[(0,o.jsx)(eg.Square,{className:"h-3 w-3"}),e("terminal.stopExecution")]}),(0,o.jsx)(ej.TooltipContent,{side:"bottom",children:e("terminal.stopHint")})]})]}),(0,o.jsx)("div",{className:"flex-1 min-h-0",children:(0,o.jsx)(eo.TerminalOutlet,{taskId:a.id,worktreePath:s,onSessionEnd:H})})]}):"DONE"===n||"CANCELLED"===n?(0,o.jsx)("div",{className:"flex h-full flex-col overflow-hidden",children:(0,o.jsx)(R.ScrollArea,{className:"flex-1 min-h-0",children:(0,o.jsx)(ey.ExecutionTimeline,{executions:A})})}):(0,o.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,o.jsxs)("div",{className:"shrink-0 flex items-center gap-2 border-b border-border px-4 py-3",children:[C.length>0&&(0,o.jsxs)(ei.Select,{defaultValue:E??"none",onValueChange:a=>F("none"===a?null:a),children:[(0,o.jsx)(ei.SelectTrigger,{size:"sm",className:"min-w-[120px]",children:(0,o.jsx)("span",{className:"text-left truncate",children:E?C.find(a=>a.id===E)?.name??e("terminal.noPrompt"):e("terminal.noPrompt")})}),(0,o.jsxs)(ei.SelectContent,{className:"min-w-[200px]",children:[(0,o.jsx)(ei.SelectItem,{value:"none",children:e("terminal.noPrompt")}),C.map(a=>(0,o.jsxs)(ei.SelectItem,{value:a.id,children:[a.name,a.isDefault?" ★":""]},a.id))]})]},`prompt-${C.length}`),(0,o.jsxs)(z.Button,{onClick:G,disabled:u,size:"sm",className:"gap-2 px-4",children:[u?(0,o.jsx)(dV.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,o.jsx)(ef.Terminal,{className:"h-3.5 w-3.5"}),u?e("terminal.executing"):e("terminal.launch")]})]}),(0,o.jsx)(R.ScrollArea,{className:"flex-1 min-h-0",children:(0,o.jsx)(ey.ExecutionTimeline,{executions:A,onResume:J,onContinueLatest:K})})]}):(0,o.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-[#0f1419]",children:[(0,o.jsx)(dV.Loader2,{className:"size-5 animate-spin text-neutral-500"}),(0,o.jsx)("span",{className:"text-xs text-neutral-500",children:e("execution.loading")})]})}):"changes"===h?(0,o.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:l?(0,o.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:e("taskPage.loadingDiff")})}):j?.branchDeleted?(0,o.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:e("taskPage.branchDeleted")})}):j?(0,o.jsx)(em.TaskDiffView,{files:j.files,totalAdded:j.totalAdded,totalRemoved:j.totalRemoved,hasConflicts:j.hasConflicts,conflictFiles:j.conflictFiles,onCommit:S,hasUncommitted:j.hasUncommitted}):(0,o.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:e("taskPage.noChanges")})})}):"notes"===h?(0,o.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,o.jsx)(eI,{taskId:a.id,projectId:a.projectId})}):null,(0,o.jsx)(en.TaskMergeConfirmDialog,{open:L,onOpenChange:M,taskId:a.id,taskTitle:a.title,baseBranch:a.baseBranch??"main",fileCount:j?.files?.length??0,commitCount:j?.commitCount??0,commitLog:N,onMergeComplete:Q})]})}let eK=(0,dJ.createServerReference)("405c7cdaed8a744b4636209fcc52ee74370aeac41f",dJ.callServer,void 0,dJ.findSourceMapURL,"createTask"),eL=(0,dJ.createServerReference)("60d789f18aebc022055dd1b9f3af1addb5fb991a80",dJ.callServer,void 0,dJ.findSourceMapURL,"updateTask"),eM=(0,dJ.createServerReference)("40922d01c2b3509a6c7e52b1991eb999c18d91681d",dJ.callServer,void 0,dJ.findSourceMapURL,"deleteTask"),eN=(0,dJ.createServerReference)("4076220a9a6176a45c796b35db195a40b577da3ff6",dJ.callServer,void 0,dJ.findSourceMapURL,"toggleTaskPinned");var eO=a.i(769726);function eP({projects:a,activeProjectId:b,onSelect:c}){let d=(0,p.useRef)(null),[e,f]=(0,p.useState)(!1),[g,h]=(0,p.useState)(!1),i=()=>{let a=d.current;a&&(f(a.scrollLeft>0),h(a.scrollLeft<a.scrollWidth-a.clientWidth-1))};(0,p.useEffect)(()=>{i();let a=d.current;if(a){a.addEventListener("scroll",i);let b=new ResizeObserver(i);return b.observe(a),()=>{a.removeEventListener("scroll",i),b.disconnect()}}},[a]);let j=a=>{let b=d.current;b&&b.scrollBy({left:"left"===a?-150:150,behavior:"smooth"})};return(0,o.jsxs)("div",{className:"relative flex items-center",children:[e&&(0,o.jsx)("button",{onClick:()=>j("left"),className:"absolute left-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,o.jsx)(eO.ChevronLeft,{className:"h-4 w-4"})}),(0,o.jsx)("div",{ref:d,className:"flex items-center gap-1.5 overflow-x-auto scrollbar-none px-1 py-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:a.map(a=>{let d=b===a.id;return(0,o.jsxs)("button",{onClick:()=>{d||c(a.id)},className:`shrink-0 rounded-lg border-b-2 px-4 py-2 text-sm font-medium transition-colors ${d?"border-primary bg-primary/10 text-primary ring-1 ring-primary/20 cursor-default":"border-transparent text-muted-foreground hover:bg-accent hover:text-foreground cursor-pointer"}`,children:[(0,o.jsx)("span",{children:a.name}),a.alias&&(0,o.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:a.alias})]},a.id)})}),g&&(0,o.jsx)("button",{onClick:()=>j("right"),className:"absolute right-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,o.jsx)(dP.ChevronRight,{className:"h-4 w-4"})})]})}a.s(["BoardPageClient",0,function({workspaceId:a,projectId:b,project:c,projects:d,initialTasks:e,labels:f,openTaskId:g}){let h=(0,q.useRouter)(),[,i]=(0,p.useTransition)(),[j,k]=(0,p.useState)(""),[l,m]=(0,p.useState)(!1),[n,r]=(0,p.useState)("TODO"),[s,t]=(0,p.useState)(g?e.find(a=>a.id===g)??null:null),[u,v]=(0,p.useState)(null),x=(0,p.useCallback)(()=>{i(()=>{h.refresh()})},[h]);(0,p.useEffect)(()=>{if(l)return;let a=setInterval(()=>{i(()=>{h.refresh()})},5e3);return()=>clearInterval(a)},[h,l]);let y=(0,p.useCallback)(a=>{k(a)},[]),z=(0,p.useCallback)(async(a,b)=>{await (0,eu.updateTaskStatus)(a,b),s?.id===a&&t({...s,status:b}),x()},[x,s]),B=(0,p.useCallback)(async a=>{await eK({title:a.title,description:a.description,projectId:b,priority:a.priority,status:a.status,labelIds:a.labelIds,baseBranch:a.baseBranch,subPath:a.subPath}),x()},[b,x]),C=(0,p.useCallback)(async(a,b)=>{await eL(a,{...b,labelIds:b.labelIds}),v(null),x()},[x]),E=(0,p.useCallback)(async a=>{await eM(a),s?.id===a&&t(null),x()},[x,s]),F=(0,p.useCallback)(async a=>{await eN(a),x()},[x]),G=(0,p.useCallback)(async b=>{try{await (0,eq.startPtyExecution)(b,"")}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}h.push(`/workspaces/${a}/tasks/${b}`)},[h,a]),H=(0,p.useCallback)(async(a,b)=>{await (0,eu.updateTaskStatus)(a,b),s?.id===a&&t({...s,status:b}),x()},[x,s]),I=(0,p.useCallback)(a=>{r(a),v(null),m(!0)},[]),J=(0,p.useCallback)(a=>{v(a),m(!0)},[]),K=e.filter(a=>!a.labels?.some(a=>a.label.name===D.TOWER_LABEL_NAME&&a.label.isBuiltin)),L=j.trim()?K.filter(a=>{let b=j.toLowerCase();return a.title.toLowerCase().includes(b)||(a.description?.toLowerCase().includes(b)??!1)}):K;return(0,o.jsxs)("div",{className:"flex h-full",children:[(0,o.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,o.jsx)("div",{className:"px-6 pt-3 pb-1",children:(0,o.jsx)(eP,{projects:d,activeProjectId:b,onSelect:b=>h.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1})})}),(0,o.jsx)(w,{totalTasks:K.length,runningTasks:K.filter(a=>"IN_PROGRESS"===a.status).length}),(0,o.jsx)(A,{searchQuery:j,onSearchChange:y,onCreateTask:()=>{v(null),m(!0)}}),(0,o.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:(0,o.jsx)(U,{initialTasks:L,onTaskMove:z,onTaskClick:a=>{t(a)},onEditTask:J,onAddTask:I,onDeleteTask:E,onTogglePin:F,workspaceId:a,onContextMenuStatusChange:H,onContextMenuLaunch:G})}),(0,o.jsx)(dN,{open:l,onOpenChange:a=>{m(a),a||v(null)},onSubmit:B,onUpdate:C,defaultStatus:n,editTask:u,editTaskLabelIds:u?.labels?u.labels.map(a=>a.labelId):[],labels:f.filter(a=>!(a.name===D.TOWER_LABEL_NAME&&a.isBuiltin)),projectType:c.type,projectLocalPath:c.localPath})]}),s?(0,o.jsx)(eJ,{task:s,workspaceId:a,projectLocalPath:c.localPath,onClose:()=>t(null)}):(0,o.jsx)(ec,{project:c,workspaceId:a})]})}],257179)}];
5
+ For more information, see https://radix-ui.com/primitives/docs/components/${b.docsSlug}`;return p.useEffect(()=>{a&&(document.getElementById(a)||console.error(c))},[c,a]),null},c_=({contentRef:a,descriptionId:b})=>{let c=cZ("DialogDescriptionWarning"),d=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${c.contentName}}.`;return p.useEffect(()=>{let c=a.current?.getAttribute("aria-describedby");b&&c&&(document.getElementById(b)||console.warn(d))},[d,a,b]),null},c0=Symbol.for("react.lazy"),c1=p[" use ".trim().toString()];function c2(a){var b;return null!=a&&"object"==typeof a&&"$$typeof"in a&&a.$$typeof===c0&&"_payload"in a&&"object"==typeof(b=a._payload)&&null!==b&&"then"in b}var c3=Symbol("radix.slottable");function c4(a){return p.isValidElement(a)&&"function"==typeof a.type&&"__radixId"in a.type&&a.type.__radixId===c3}var c5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((a,b)=>{var c,d;let e,f,g,h=(d=c=`Primitive.${b}`,(e=p.forwardRef((a,b)=>{let{children:c,...d}=a;if(c2(c)&&"function"==typeof c1&&(c=c1(c._payload)),p.isValidElement(c)){var e;let a,f,g=(e=c,(f=(a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.ref:(f=(a=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.props.ref:e.props.ref||e.ref),h=function(a,b){let c={...b};for(let d in b){let e=a[d],f=b[d];/^on[A-Z]/.test(d)?e&&f?c[d]=(...a)=>{let b=f(...a);return e(...a),b}:e&&(c[d]=e):"style"===d?c[d]={...e,...f}:"className"===d&&(c[d]=[e,f].filter(Boolean).join(" "))}return{...a,...c}}(d,c.props);return c.type!==p.Fragment&&(h.ref=b?bs(b,g):g),p.cloneElement(c,h)}return p.Children.count(c)>1?p.Children.only(null):null})).displayName=`${d}.SlotClone`,f=e,(g=p.forwardRef((a,b)=>{let{children:c,...d}=a;c2(c)&&"function"==typeof c1&&(c=c1(c._payload));let e=p.Children.toArray(c),g=e.find(c4);if(g){let a=g.props.children,c=e.map(b=>b!==g?b:p.Children.count(a)>1?p.Children.only(null):p.isValidElement(a)?a.props.children:null);return(0,o.jsx)(f,{...d,ref:b,children:p.isValidElement(a)?p.cloneElement(a,void 0,c):null})}return(0,o.jsx)(f,{...d,ref:b,children:c})})).displayName=`${c}.Slot`,g),i=p.forwardRef((a,c)=>{let{asChild:d,...e}=a;return(0,o.jsx)(d?h:b,{...e,ref:c})});return i.displayName=`Primitive.${b}`,{...a,[b]:i}},{}),c6='[cmdk-group=""]',c7='[cmdk-group-items=""]',c8='[cmdk-item=""]',c9=`${c8}:not([aria-disabled="true"])`,da="cmdk-item-select",db="data-value",dc=(a,b,c)=>{var d;return d=a,function a(b,c,d,e,f,g,h){if(g===c.length)return f===b.length?1:.99;var i=`${f},${g}`;if(void 0!==h[i])return h[i];for(var j,k,l,m,n=e.charAt(g),o=d.indexOf(n,f),p=0;o>=0;)(j=a(b,c,d,e,o+1,g+1,h))>p&&(o===f?j*=1:bl.test(b.charAt(o-1))?(j*=.8,(l=b.slice(f,o-1).match(bm))&&f>0&&(j*=Math.pow(.999,l.length))):bn.test(b.charAt(o-1))?(j*=.9,(m=b.slice(f,o-1).match(bo))&&f>0&&(j*=Math.pow(.999,m.length))):(j*=.17,f>0&&(j*=Math.pow(.999,o-f))),b.charAt(o)!==c.charAt(g)&&(j*=.9999)),(j<.1&&d.charAt(o-1)===e.charAt(g+1)||e.charAt(g+1)===e.charAt(g)&&d.charAt(o-1)!==e.charAt(g))&&.1*(k=a(b,c,d,e,o+1,g+2,h))>j&&(j=.1*k),j>p&&(p=j),o=d.indexOf(n,o+1);return h[i]=p,p}(d=c&&c.length>0?`${d+" "+c.join(" ")}`:d,b,bp(d),bp(b),0,0,{})},dd=p.createContext(void 0),de=p.createContext(void 0),df=p.createContext(void 0),dg=p.forwardRef((a,b)=>{let c=dr(()=>{var b,c;return{search:"",value:null!=(c=null!=(b=a.value)?b:a.defaultValue)?c:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),d=dr(()=>new Set),e=dr(()=>new Map),f=dr(()=>new Map),g=dr(()=>new Set),h=dp(a),{label:i,children:j,value:k,onValueChange:l,filter:m,shouldFilter:n,loop:o,disablePointerSelection:q=!1,vimBindings:r=!0,...s}=a,t=bx(),u=bx(),v=bx(),w=p.useRef(null),x=du();dq(()=>{if(void 0!==k){let a=k.trim();c.current.value=a,y.emit()}},[k]),dq(()=>{x(6,E)},[]);let y=p.useMemo(()=>({subscribe:a=>(g.current.add(a),()=>g.current.delete(a)),snapshot:()=>c.current,setState:(a,b,d)=>{var e,f,g,i;if(!Object.is(c.current[a],b)){if(c.current[a]=b,"search"===a)D(),B(),x(1,C);else if("value"===a){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let a=document.getElementById(v);a?a.focus():null==(e=document.getElementById(t))||e.focus()}if(x(7,()=>{var a;c.current.selectedItemId=null==(a=F())?void 0:a.id,y.emit()}),d||x(5,E),(null==(f=h.current)?void 0:f.value)!==void 0){null==(i=(g=h.current).onValueChange)||i.call(g,null!=b?b:"");return}}y.emit()}},emit:()=>{g.current.forEach(a=>a())}}),[]),z=p.useMemo(()=>({value:(a,b,d)=>{var e;b!==(null==(e=f.current.get(a))?void 0:e.value)&&(f.current.set(a,{value:b,keywords:d}),c.current.filtered.items.set(a,A(b,d)),x(2,()=>{B(),y.emit()}))},item:(a,b)=>(d.current.add(a),b&&(e.current.has(b)?e.current.get(b).add(a):e.current.set(b,new Set([a]))),x(3,()=>{D(),B(),c.current.value||C(),y.emit()}),()=>{f.current.delete(a),d.current.delete(a),c.current.filtered.items.delete(a);let b=F();x(4,()=>{D(),(null==b?void 0:b.getAttribute("id"))===a&&C(),y.emit()})}),group:a=>(e.current.has(a)||e.current.set(a,new Set),()=>{f.current.delete(a),e.current.delete(a)}),filter:()=>h.current.shouldFilter,label:i||a["aria-label"],getDisablePointerSelection:()=>h.current.disablePointerSelection,listId:t,inputId:v,labelId:u,listInnerRef:w}),[]);function A(a,b){var d,e;let f=null!=(e=null==(d=h.current)?void 0:d.filter)?e:dc;return a?f(a,c.current.search,b):0}function B(){if(!c.current.search||!1===h.current.shouldFilter)return;let a=c.current.filtered.items,b=[];c.current.filtered.groups.forEach(c=>{let d=e.current.get(c),f=0;d.forEach(b=>{f=Math.max(a.get(b),f)}),b.push([c,f])});let d=w.current;G().sort((b,c)=>{var d,e;let f=b.getAttribute("id"),g=c.getAttribute("id");return(null!=(d=a.get(g))?d:0)-(null!=(e=a.get(f))?e:0)}).forEach(a=>{let b=a.closest(c7);b?b.appendChild(a.parentElement===b?a:a.closest(`${c7} > *`)):d.appendChild(a.parentElement===d?a:a.closest(`${c7} > *`))}),b.sort((a,b)=>b[1]-a[1]).forEach(a=>{var b;let c=null==(b=w.current)?void 0:b.querySelector(`${c6}[${db}="${encodeURIComponent(a[0])}"]`);null==c||c.parentElement.appendChild(c)})}function C(){let a=G().find(a=>"true"!==a.getAttribute("aria-disabled")),b=null==a?void 0:a.getAttribute(db);y.setState("value",b||void 0)}function D(){var a,b,g,i;if(!c.current.search||!1===h.current.shouldFilter){c.current.filtered.count=d.current.size;return}c.current.filtered.groups=new Set;let j=0;for(let e of d.current){let d=A(null!=(b=null==(a=f.current.get(e))?void 0:a.value)?b:"",null!=(i=null==(g=f.current.get(e))?void 0:g.keywords)?i:[]);c.current.filtered.items.set(e,d),d>0&&j++}for(let[a,b]of e.current)for(let d of b)if(c.current.filtered.items.get(d)>0){c.current.filtered.groups.add(a);break}c.current.filtered.count=j}function E(){var a,b,c;let d=F();d&&((null==(a=d.parentElement)?void 0:a.firstChild)===d&&(null==(c=null==(b=d.closest(c6))?void 0:b.querySelector('[cmdk-group-heading=""]'))||c.scrollIntoView({block:"nearest"})),d.scrollIntoView({block:"nearest"}))}function F(){var a;return null==(a=w.current)?void 0:a.querySelector(`${c8}[aria-selected="true"]`)}function G(){var a;return Array.from((null==(a=w.current)?void 0:a.querySelectorAll(c9))||[])}function H(a){let b=G()[a];b&&y.setState("value",b.getAttribute(db))}function I(a){var b;let c=F(),d=G(),e=d.findIndex(a=>a===c),f=d[e+a];null!=(b=h.current)&&b.loop&&(f=e+a<0?d[d.length-1]:e+a===d.length?d[0]:d[e+a]),f&&y.setState("value",f.getAttribute(db))}function J(a){let b=F(),c=null==b?void 0:b.closest(c6),d;for(;c&&!d;)d=null==(c=a>0?function(a,b){let c=a.nextElementSibling;for(;c;){if(c.matches(b))return c;c=c.nextElementSibling}}(c,c6):function(a,b){let c=a.previousElementSibling;for(;c;){if(c.matches(b))return c;c=c.previousElementSibling}}(c,c6))?void 0:c.querySelector(c9);d?y.setState("value",d.getAttribute(db)):I(a)}let K=()=>H(G().length-1),L=a=>{a.preventDefault(),a.metaKey?K():a.altKey?J(1):I(1)},M=a=>{a.preventDefault(),a.metaKey?H(0):a.altKey?J(-1):I(-1)};return p.createElement(c5.div,{ref:b,tabIndex:-1,...s,"cmdk-root":"",onKeyDown:a=>{var b;null==(b=s.onKeyDown)||b.call(s,a);let c=a.nativeEvent.isComposing||229===a.keyCode;if(!(a.defaultPrevented||c))switch(a.key){case"n":case"j":r&&a.ctrlKey&&L(a);break;case"ArrowDown":L(a);break;case"p":case"k":r&&a.ctrlKey&&M(a);break;case"ArrowUp":M(a);break;case"Home":a.preventDefault(),H(0);break;case"End":a.preventDefault(),K();break;case"Enter":{a.preventDefault();let b=F();if(b){let a=new Event(da);b.dispatchEvent(a)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:z.inputId,id:z.labelId,style:dw},i),dv(a,a=>p.createElement(de.Provider,{value:y},p.createElement(dd.Provider,{value:z},a))))}),dh=p.forwardRef((a,b)=>{var c,d;let e=bx(),f=p.useRef(null),g=p.useContext(df),h=p.useContext(dd),i=dp(a),j=null!=(d=null==(c=i.current)?void 0:c.forceMount)?d:null==g?void 0:g.forceMount;dq(()=>{if(!j)return h.item(e,null==g?void 0:g.id)},[j]);let k=dt(e,f,[a.value,a.children,f],a.keywords),l=p.useContext(de),m=ds(a=>a.value&&a.value===k.current),n=ds(a=>!!j||!1===h.filter()||!a.search||a.filtered.items.get(e)>0);function o(){var a,b;q(),null==(b=(a=i.current).onSelect)||b.call(a,k.current)}function q(){l.setState("value",k.current,!0)}if(p.useEffect(()=>{let b=f.current;if(!(!b||a.disabled))return b.addEventListener(da,o),()=>b.removeEventListener(da,o)},[n,a.onSelect,a.disabled]),!n)return null;let{disabled:r,value:s,onSelect:t,forceMount:u,keywords:v,...w}=a;return p.createElement(c5.div,{ref:bs(f,b),...w,id:e,"cmdk-item":"",role:"option","aria-disabled":!!r,"aria-selected":!!m,"data-disabled":!!r,"data-selected":!!m,onPointerMove:r||h.getDisablePointerSelection()?void 0:q,onClick:r?void 0:o},a.children)}),di=p.forwardRef((a,b)=>{let{heading:c,children:d,forceMount:e,...f}=a,g=bx(),h=p.useRef(null),i=p.useRef(null),j=bx(),k=p.useContext(dd),l=ds(a=>!!e||!1===k.filter()||!a.search||a.filtered.groups.has(g));dq(()=>k.group(g),[]),dt(g,h,[a.value,a.heading,i]);let m=p.useMemo(()=>({id:g,forceMount:e}),[e]);return p.createElement(c5.div,{ref:bs(h,b),...f,"cmdk-group":"",role:"presentation",hidden:!l||void 0},c&&p.createElement("div",{ref:i,"cmdk-group-heading":"","aria-hidden":!0,id:j},c),dv(a,a=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":c?j:void 0},p.createElement(df.Provider,{value:m},a))))}),dj=p.forwardRef((a,b)=>{let{alwaysRender:c,...d}=a,e=p.useRef(null),f=ds(a=>!a.search);return c||f?p.createElement(c5.div,{ref:bs(e,b),...d,"cmdk-separator":"",role:"separator"}):null}),dk=p.forwardRef((a,b)=>{let{onValueChange:c,...d}=a,e=null!=a.value,f=p.useContext(de),g=ds(a=>a.search),h=ds(a=>a.selectedItemId),i=p.useContext(dd);return p.useEffect(()=>{null!=a.value&&f.setState("search",a.value)},[a.value]),p.createElement(c5.input,{ref:b,...d,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":i.listId,"aria-labelledby":i.labelId,"aria-activedescendant":h,id:i.inputId,type:"text",value:e?a.value:g,onChange:a=>{e||f.setState("search",a.target.value),null==c||c(a.target.value)}})}),dl=p.forwardRef((a,b)=>{let{children:c,label:d="Suggestions",...e}=a,f=p.useRef(null),g=p.useRef(null),h=ds(a=>a.selectedItemId),i=p.useContext(dd);return p.useEffect(()=>{if(g.current&&f.current){let a=g.current,b=f.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let c=a.offsetHeight;b.style.setProperty("--cmdk-list-height",c.toFixed(1)+"px")})});return d.observe(a),()=>{cancelAnimationFrame(c),d.unobserve(a)}}},[]),p.createElement(c5.div,{ref:bs(f,b),...e,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":h,"aria-label":d,id:i.listId},dv(a,a=>p.createElement("div",{ref:bs(g,i.listInnerRef),"cmdk-list-sizer":""},a)))}),dm=p.forwardRef((a,b)=>{let{open:c,onOpenChange:d,overlayClassName:e,contentClassName:f,container:g,...h}=a;return p.createElement(cE,{open:c,onOpenChange:d},p.createElement(cJ,{container:g},p.createElement(cL,{"cmdk-overlay":"",className:e}),p.createElement(cP,{"aria-label":a.label,"cmdk-dialog":"",className:f},p.createElement(dg,{ref:b,...h}))))}),dn=Object.assign(dg,{List:dl,Item:dh,Input:dk,Group:di,Separator:dj,Dialog:dm,Empty:p.forwardRef((a,b)=>ds(a=>0===a.filtered.count)?p.createElement(c5.div,{ref:b,...a,"cmdk-empty":"",role:"presentation"}):null),Loading:p.forwardRef((a,b)=>{let{progress:c,children:d,label:e="Loading...",...f}=a;return p.createElement(c5.div,{ref:b,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":c,"aria-valuemin":0,"aria-valuemax":100,"aria-label":e},dv(a,a=>p.createElement("div",{"aria-hidden":!0},a)))})});function dp(a){let b=p.useRef(a);return dq(()=>{b.current=a}),b}var dq=p.useEffect;function dr(a){let b=p.useRef();return void 0===b.current&&(b.current=a()),b}function ds(a){let b=p.useContext(de),c=()=>a(b.snapshot());return p.useSyncExternalStore(b.subscribe,c,c)}function dt(a,b,c,d=[]){let e=p.useRef(),f=p.useContext(dd);return dq(()=>{var g;let h=(()=>{var a;for(let b of c){if("string"==typeof b)return b.trim();if("object"==typeof b&&"current"in b)return b.current?null==(a=b.current.textContent)?void 0:a.trim():e.current}})(),i=d.map(a=>a.trim());f.value(a,h,i),null==(g=b.current)||g.setAttribute(db,h),e.current=h}),e}var du=()=>{let[a,b]=p.useState(),c=dr(()=>new Map);return dq(()=>{c.current.forEach(a=>a()),c.current=new Map},[a]),(a,d)=>{c.current.set(a,d),b({})}};function dv({asChild:a,children:b},c){let d;return a&&p.isValidElement(b)?p.cloneElement("function"==typeof(d=b.type)?d(b.props):"render"in d?d.render(b.props):b,{ref:b.ref},c(b.props.children)):c(b)}var dw={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},dx=a.i(488137);function dy({className:a,...b}){return(0,o.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,bh.cn)("group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",a),...b})}let dz=(0,dx.cva)("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function dA({className:a,align:b="inline-start",...c}){return(0,o.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":b,className:(0,bh.cn)(dz({align:b}),a),onClick:a=>{a.target.closest("button")||a.currentTarget.parentElement?.querySelector("input")?.focus()},...c})}(0,dx.cva)("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});var dB=a.i(458415),dB=dB,dC=a.i(659503);function dD({className:a,...b}){return(0,o.jsx)(dn,{"data-slot":"command",className:(0,bh.cn)("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",a),...b})}function dE({className:a,...b}){return(0,o.jsx)("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:(0,o.jsxs)(dy,{className:"h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!",children:[(0,o.jsx)(dn.Input,{"data-slot":"command-input",className:(0,bh.cn)("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",a),...b}),(0,o.jsx)(dA,{children:(0,o.jsx)(dB.default,{className:"size-4 shrink-0 opacity-50"})})]})})}function dF({className:a,...b}){return(0,o.jsx)(dn.List,{"data-slot":"command-list",className:(0,bh.cn)("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",a),...b})}function dG({className:a,...b}){return(0,o.jsx)(dn.Empty,{"data-slot":"command-empty",className:(0,bh.cn)("py-6 text-center text-sm",a),...b})}function dH({className:a,...b}){return(0,o.jsx)(dn.Group,{"data-slot":"command-group",className:(0,bh.cn)("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",a),...b})}function dI({className:a,children:b,...c}){return(0,o.jsxs)(dn.Item,{"data-slot":"command-item",className:(0,bh.cn)("group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground",a),...c,children:[b,(0,o.jsx)(dC.CheckIcon,{className:"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100"})]})}var dJ=a.i(879876);let dK=(0,dJ.createServerReference)("40ec6cebc45d82f25afeda06252061cc522d907389",dJ.callServer,void 0,dJ.findSourceMapURL,"getProjectBranches"),dL=(0,dJ.createServerReference)("40a928ea3c1ea8dab6165bbe44c32cea6bd834df56",dJ.callServer,void 0,dJ.findSourceMapURL,"fetchRemoteBranches"),dM=(0,dJ.createServerReference)("40d694278e59ec3bde2dd1db6a33744304acbd0f5a",dJ.callServer,void 0,dJ.findSourceMapURL,"getCurrentBranch");function dN({open:a,onOpenChange:b,onSubmit:c,onUpdate:d,defaultStatus:e="TODO",editTask:f,editTaskLabelIds:g,labels:h,projectType:i,projectLocalPath:j}){let[k,l]=(0,p.useState)(""),[m,n]=(0,p.useState)(""),[q,r]=(0,p.useState)("MEDIUM"),[s,t]=(0,p.useState)(""),[u,w]=(0,p.useState)([]),[x,y]=(0,p.useState)([]),[A,B]=(0,p.useState)(!1),[D,E]=(0,p.useState)(""),[F,G]=(0,p.useState)(!1),[H,I]=(0,p.useState)(!0),{t:J}=(0,v.useI18n)(),K=!!f,L=!!j;return(0,p.useEffect)(()=>{f?(l(f.title),n(f.description??""),r(f.priority),t(f.subPath??""),w(g??[])):(l(""),n(""),r("MEDIUM"),t(""),w([]))},[f,g]),(0,p.useEffect)(()=>{a||f||(l(""),n(""),r("MEDIUM"),t(""),w([]),y([]),E(""),G(!1))},[a,f]),(0,p.useEffect)(()=>{a&&L&&!f&&(B(!0),Promise.all([dK(j),dM(j)]).then(([a,b])=>{y(a),E(b&&a.includes(b)?b:a[0]??""),B(!1),dL(j).then(()=>{setTimeout(()=>{dK(j).then(a=>{y(a),E(b=>a.includes(b)?b:a[0]??"")}).catch(()=>{})},3e3)})}).catch(()=>{y([]),E(""),B(!1)}))},[a,L,j,f]),(0,o.jsx)(Q.Dialog,{open:a,onOpenChange:b,disablePointerDismissal:!0,children:(0,o.jsxs)(Q.DialogContent,{className:"sm:max-w-md",children:[(0,o.jsx)(Q.DialogHeader,{children:(0,o.jsx)(Q.DialogTitle,{children:K?J("task.edit"):J("task.create")})}),(0,o.jsxs)("div",{className:"space-y-4 py-2",children:[(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{htmlFor:"title",children:J("task.title")}),(0,o.jsx)(V.Input,{id:"title","data-testid":"task-title",placeholder:J("task.titlePlaceholder"),value:k,onChange:a=>l(a.target.value),onKeyDown:a=>"Enter"===a.key&&a.preventDefault()})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{htmlFor:"description",children:J("task.description")}),(0,o.jsx)(W.Textarea,{id:"description",placeholder:J("task.descPlaceholder"),rows:4,value:m,onChange:a=>n(a.target.value),className:"max-h-[200px] overflow-y-auto"})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{htmlFor:"subPath",children:J("task.subPath")}),(0,o.jsx)(V.Input,{id:"subPath",placeholder:J("task.subPathPlaceholder"),value:s,onChange:a=>t(a.target.value)}),(0,o.jsx)("p",{className:"text-xs text-muted-foreground",children:J("task.subPathHint")})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{children:J("task.priority")}),(0,o.jsx)("div",{className:"flex gap-1.5",children:["LOW","MEDIUM","HIGH","CRITICAL"].map(a=>{let b={LOW:{label:J("task.priorityLow"),style:"text-slate-300 border-slate-500/30 bg-slate-500/10"},MEDIUM:{label:J("task.priorityMedium"),style:"text-amber-300 border-amber-500/30 bg-amber-500/10"},HIGH:{label:J("task.priorityHigh"),style:"text-orange-300 border-orange-500/30 bg-orange-500/10"},CRITICAL:{label:J("task.priorityCritical"),style:"text-rose-300 border-rose-500/30 bg-rose-500/10"}}[a];return(0,o.jsx)("button",{type:"button",onClick:()=>r(a),className:`rounded-lg border px-3 py-1.5 text-xs font-medium transition-all ${q===a?`${b.style} ring-1 ring-current/20`:"border-border text-muted-foreground hover:bg-accent"}`,children:b.label},a)})})]}),L&&!K&&(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{children:J("task.baseBranch")}),A?(0,o.jsx)("div",{className:"text-sm text-muted-foreground",children:J("task.branchLoading")}):x.length>0?(0,o.jsxs)(bi,{open:F,onOpenChange:G,children:[(0,o.jsxs)(bj,{className:"flex w-full items-center gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm font-mono transition-colors hover:bg-accent focus:outline-none focus:ring-1 focus:ring-ring","data-testid":"branch-selector",children:[(0,o.jsx)(Y.GitBranch,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,o.jsx)("span",{className:"flex-1 truncate text-left text-xs",children:D||J("task.branchNone")}),(0,o.jsx)(Z,{className:"h-3.5 w-3.5 shrink-0 opacity-50"})]}),(0,o.jsx)(bk,{className:"p-0",align:"start",children:(0,o.jsxs)(dD,{children:[(0,o.jsx)(dE,{placeholder:J("task.branchSearch")}),(0,o.jsxs)(dF,{children:[(0,o.jsx)(dG,{children:J("task.branchNone")}),(0,o.jsx)(dH,{children:x.map(a=>(0,o.jsxs)(dI,{value:a,onSelect:()=>{E(a),G(!1)},children:[(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3 text-muted-foreground shrink-0 mr-2"}),(0,o.jsx)("span",{className:"flex-1 truncate font-mono",children:a}),a===D&&(0,o.jsx)(C.Check,{className:"h-3 w-3 text-primary shrink-0 ml-auto"})]},a))})]})]})})]}):(0,o.jsx)("div",{className:"text-sm text-muted-foreground",children:J("task.branchNone")}),(0,o.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,o.jsx)(X.Label,{className:"text-xs text-muted-foreground",children:J("task.worktreeLabel")}),(0,o.jsx)("div",{className:"flex gap-1",children:[!0,!1].map(a=>(0,o.jsx)("button",{type:"button",onClick:()=>I(a),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${H===a?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:a?J("task.worktreeYes"):J("task.worktreeNo")},String(a)))})]})]}),h.length>0&&(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(X.Label,{children:J("task.labels")}),(0,o.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.map(a=>{let b=u.includes(a.id);return(0,o.jsx)("button",{type:"button",onClick:()=>{w(c=>b?c.filter(b=>b!==a.id):[...c,a.id])},className:`rounded-full px-2.5 py-1 text-xs font-medium transition-all ${b?"ring-1 ring-current/30":"opacity-50 hover:opacity-80"}`,style:{backgroundColor:a.color+"20",color:a.color,borderColor:b?a.color+"40":"transparent",borderWidth:"1px"},children:a.name},a.id)})})]})]}),(0,o.jsxs)(Q.DialogFooter,{children:[(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>b(!1),children:J("common.cancel")}),(0,o.jsx)(z.Button,{onClick:()=>{k.trim()&&(K&&d?d(f.id,{title:k,description:m,priority:q,labelIds:u,subPath:s.trim()||""}):c({title:k,description:m,priority:q,status:e,labelIds:u,...L&&H&&D?{baseBranch:D}:{},...s.trim()?{subPath:s.trim()}:{}}),l(""),n(""),r("MEDIUM"),t(""),w([]),y([]),E(""),I(!0),b(!1))},className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:K?J("common.save"):J("common.create")})]})]})})}var dO=a.i(354994),dP=a.i(506008),dQ=a.i(212765),dR=a.i(161604),dS=a.i(986379);let dT=(0,r.default)("git-commit-vertical",[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]);var dU=a.i(467034),dV=a.i(109434),dW=a.i(938899),dX=a.i(145685),dY=a.i(627183),dZ=a.i(550790);let d$=(0,dJ.createServerReference)("401ce808277c60ba0267c139ba81fdb582d814d0b5",dJ.callServer,void 0,dJ.findSourceMapURL,"deleteProject"),d_=(0,dJ.createServerReference)("407153200c62c4323580f364a8ee04c47f4482e8bf",dJ.callServer,void 0,dJ.findSourceMapURL,"getRecentLocalProjects"),d0=(0,dJ.createServerReference)("406b12d737455e73410f87f1d19e45a002438f6195",dJ.callServer,void 0,dJ.findSourceMapURL,"getOrCreateTowerTaskId");var d1=a.i(410051),d2=a.i(942308),d3=a.i(563504),d4=a.i(845924),d5=a.i(929526);let d6=(0,r.default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);function d7({commits:a}){let{t:b}=(0,v.useI18n)(),[c,d]=(0,p.useState)(!1);return 0===a.length?null:(0,o.jsxs)("div",{children:[(0,o.jsxs)("button",{onClick:()=>d(!c),className:"flex w-full items-center justify-between py-1",children:[(0,o.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:b("git.commitLog")}),c?(0,o.jsx)(dO.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,o.jsx)(dP.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),c&&(0,o.jsx)("div",{className:"mt-1.5 space-y-0.5 max-h-64 overflow-y-auto",children:a.map(a=>(0,o.jsxs)("div",{className:"group flex items-start gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,o.jsx)(dT,{className:"h-3 w-3 shrink-0 text-muted-foreground mt-0.5"}),(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)("p",{className:"text-xs text-foreground line-clamp-1",children:a.message}),(0,o.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,o.jsxs)("button",{onClick:()=>{navigator.clipboard.writeText(a.shortHash),d2.toast.success(`Copied ${a.shortHash}`)},className:"flex items-center gap-0.5 font-mono text-[10px] text-primary/70 hover:text-primary transition-colors",children:[a.shortHash,(0,o.jsx)(d6,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]}),(0,o.jsx)("span",{className:"text-[10px] text-muted-foreground",children:a.author}),(0,o.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(a){let b=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(b<1)return"just now";if(b<60)return`${b}m`;let c=Math.floor(b/60);if(c<24)return`${c}h`;let d=Math.floor(c/24);return d<30?`${d}d`:`${Math.floor(d/30)}mo`}(a.date)})]})]})]},a.hash))})]})}var d8=a.i(14180),d9=a.i(460143),ea=a.i(820838);function eb({localPath:a,stashes:b,hasChanges:c,onRefresh:d}){let{t:e}=(0,v.useI18n)(),[f,g]=(0,p.useState)(!1),[h,i]=(0,p.useState)(!1),[j,k]=(0,p.useState)(""),[l,m]=(0,p.useState)(null),n=async()=>{i(!0);try{await (0,ea.gitAction)(a,"stash-save",{message:j}),k(""),d2.toast.success(e("git.stashSaved")),await d()}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}finally{i(!1)}},q=async b=>{m(b);try{await (0,ea.gitAction)(a,"stash-pop",{index:b}),d2.toast.success(e("git.stashApplied")),await d()}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}finally{m(null)}},r=async b=>{m(b);try{await (0,ea.gitAction)(a,"stash-drop",{index:b}),d2.toast.success(e("git.stashDropped")),await d()}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}finally{m(null)}};return c||0!==b.length?(0,o.jsxs)("div",{children:[(0,o.jsxs)("button",{onClick:()=>g(!f),className:"flex w-full items-center justify-between py-1",children:[(0,o.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[e("git.stash")," ",b.length>0&&`(${b.length})`]}),f?(0,o.jsx)(dO.ChevronDown,{className:"h-3 w-3 text-muted-foreground"}):(0,o.jsx)(dP.ChevronRight,{className:"h-3 w-3 text-muted-foreground"})]}),f&&(0,o.jsxs)("div",{className:"mt-1.5 space-y-2",children:[c&&(0,o.jsxs)("div",{className:"flex gap-1.5",children:[(0,o.jsx)(V.Input,{value:j,onChange:a=>k(a.target.value),placeholder:e("git.stashMsgPlaceholder"),className:"h-7 text-xs flex-1",onKeyDown:a=>"Enter"===a.key&&n()}),(0,o.jsx)(z.Button,{variant:"outline",size:"icon-sm",onClick:n,disabled:h,className:"shrink-0",children:h?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin"}):(0,o.jsx)(d8.Archive,{className:"h-3 w-3"})})]}),b.length>0&&(0,o.jsx)("div",{className:"space-y-0.5",children:b.map(a=>(0,o.jsxs)("div",{className:"group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,o.jsx)(d8.Archive,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,o.jsx)("span",{className:"flex-1 min-w-0 truncate text-xs text-foreground",children:a.message||`stash@{${a.index}}`}),(0,o.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:()=>q(a.index),disabled:l===a.index,className:"text-muted-foreground","aria-label":e("git.stashApply"),children:l===a.index?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin"}):(0,o.jsx)(d9.ArrowUpFromLine,{className:"h-3 w-3"})}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:()=>r(a.index),disabled:l===a.index,className:"text-rose-400","aria-label":e("git.stashDrop"),children:(0,o.jsx)(L.Trash2,{className:"h-3 w-3"})})]})]},a.index))})]})]}):null}function ec({project:a,workspaceId:b}){let{t:c,locale:d}=(0,v.useI18n)(),e=(0,q.useRouter)(),[f,g]=(0,p.useState)(!0),[h,i]=(0,p.useState)(!0),[j,k]=(0,p.useState)(!1),[l,m]=(0,p.useState)(!1),[n,r]=(0,p.useState)(""),[s,t]=(0,p.useState)(!1),[u,w]=(0,p.useState)(!1),[x,y]=(0,p.useState)(!1),[A,B]=(0,p.useState)(a.name),[C,D]=(0,p.useState)(a.alias??""),[E,F]=(0,p.useState)(a.description??""),[G,H]=(0,p.useState)(a.localPath??""),[I,J]=(0,p.useState)(a.projectType??"FRONTEND"),[M,N]=(0,p.useState)([]);(0,p.useEffect)(()=>{d_(100).then(N)},[]);let[O,P]=(0,p.useState)(!1),[R,S]=(0,p.useState)(""),[T,U]=(0,p.useState)(""),[X,Z]=(0,p.useState)(""),[$,_]=(0,p.useState)(""),[aa,ab]=(0,p.useState)("FRONTEND"),[ac,ad]=(0,p.useState)(!1),[ae,af]=(0,p.useState)(!1),[ag,ah]=(0,p.useState)(null),[ai,aj]=(0,p.useState)(!1),[ak,al]=(0,p.useState)(!1),[am,an]=(0,p.useState)(!1),ao=a=>{d2.toast.info(a)},ap=(0,p.useCallback)(async()=>{if(a.localPath){aj(!0);try{let b=await fetch(`/api/git?path=${encodeURIComponent(a.localPath)}`);b.ok&&ah(await b.json())}catch{}finally{aj(!1)}}},[a.localPath]);(0,p.useEffect)(()=>{ap()},[ap]);let aq=async()=>{if(a.localPath){al(!0);try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",path:a.localPath})})).ok?(ao(c("git.initSuccess")),await ap()):ao(c("git.initFailed"))}catch{ao(c("git.initFailed"))}finally{al(!1)}}},ar=async b=>{if(a.localPath)try{let d=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"checkout",path:a.localPath,branch:b})});if(d.ok)ao(`${c("git.switchSuccess")} ${b}`),await ap();else{let a=await d.json();ao(`${c("git.switchFailed")}: ${a.error}`)}}catch{ao(c("git.switchFailed"))}},as=(a,b)=>{e.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1}),e.refresh()},at=async()=>{if(T.trim()){ad(!0);try{let a=await (0,dZ.createProject)({name:T.trim(),alias:X.trim()||void 0,description:$.trim()||void 0,localPath:R,projectType:aa,workspaceId:b});P(!1),as(b,a.id)}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}finally{ad(!1)}}},au=async()=>{if(G&&!ae){af(!0);try{let a=await (0,d1.analyzeProjectDirectory)(G.trim(),d);F(a)}catch{d2.toast.error(c("project.analyzeError"))}finally{af(!1)}}},av=async()=>{try{await (0,dY.updateProject)(a.id,{name:A.trim(),alias:C.trim()||void 0,description:E.trim()||void 0,localPath:G.trim()||void 0,projectType:I}),e.refresh(),k(!1)}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}};return(0,o.jsxs)("aside",{className:"relative w-72 flex-shrink-0 overflow-y-auto border-l border-border bg-sidebar",children:[(0,o.jsxs)("div",{className:"border-b border-border p-4",children:[(0,o.jsxs)("div",{className:"flex items-start justify-between",children:[(0,o.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,o.jsx)("h2",{className:"text-base font-semibold text-foreground",children:a.name}),a.alias&&(0,o.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:a.alias})]}),(0,o.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{B(a.name),D(a.alias??""),F(a.description??""),H(a.localPath??""),k(!0)},className:"text-muted-foreground",children:(0,o.jsx)(K.Pencil,{className:"h-3.5 w-3.5"})}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{r(""),m(!0)},className:"text-muted-foreground hover:text-rose-400",children:(0,o.jsx)(L.Trash2,{className:"h-3.5 w-3.5"})})]})]}),a.description&&(0,o.jsx)("p",{className:"mt-2 text-sm text-secondary-foreground leading-relaxed line-clamp-4",children:a.description}),(0,o.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:(0,o.jsx)("span",{className:`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium ${"GIT"===a.type?"bg-sky-500/15 text-sky-300 ring-1 ring-sky-500/20":"bg-muted text-muted-foreground ring-1 ring-border"}`,children:"GIT"===a.type?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3"}),c("sidebar.right.gitType")]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(dR.FileText,{className:"h-3 w-3"}),c("sidebar.right.normalType")]})})}),a.localPath&&(0,o.jsxs)("div",{className:"mt-3 flex items-start gap-2 rounded-md bg-muted/50 px-2.5 py-2 text-xs",children:[(0,o.jsx)(dS.FolderOpen,{className:"mt-0.5 h-3 w-3 shrink-0 text-muted-foreground"}),(0,o.jsx)("span",{className:"break-all font-mono text-secondary-foreground",children:a.localPath})]}),a.gitUrl&&(0,o.jsxs)("div",{className:"mt-2 flex items-start gap-2 rounded-md bg-muted/50 px-2.5 py-2 text-xs",children:[(0,o.jsx)(dQ.Globe,{className:"mt-0.5 h-3 w-3 shrink-0 text-muted-foreground"}),(0,o.jsx)("span",{className:"break-all text-secondary-foreground",children:a.gitUrl})]}),a.localPath&&(0,o.jsxs)(z.Button,{variant:"outline",className:"mt-3 w-full h-8 gap-1.5 text-xs",disabled:u,onClick:async()=>{w(!0);try{let c=await d0(a.id);e.push(`/workspaces/${b}/tasks/${c}`)}catch{d2.toast.error(c("git.openStudioFailed"))}finally{w(!1)}},children:[u?(0,o.jsx)(dV.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,o.jsx)(dS.FolderOpen,{className:"h-3.5 w-3.5"}),c("git.openStudio")]})]}),(0,o.jsxs)("div",{className:"border-b border-border p-4",children:[(0,o.jsxs)(z.Button,{variant:"ghost",onClick:()=>g(!f),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,o.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:c("git.section")}),f?(0,o.jsx)(dO.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,o.jsx)(dP.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),f&&(0,o.jsx)("div",{className:"mt-3",children:a.localPath?ai?(0,o.jsxs)("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:[(0,o.jsx)(dV.Loader2,{className:"h-4 w-4 animate-spin"}),(0,o.jsx)("span",{className:"ml-2 text-xs",children:c("git.loading")})]}):ag&&!ag.isGit?(0,o.jsxs)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,o.jsx)(dU.AlertCircle,{className:"h-3.5 w-3.5"}),(0,o.jsx)("p",{className:"text-xs",children:c("git.notInitialized")})]}),(0,o.jsxs)(z.Button,{className:"mt-3 h-7 w-full gap-1.5 bg-primary/10 text-xs text-primary ring-1 ring-primary/20 hover:bg-primary/15",onClick:aq,disabled:ak,children:[ak?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin"}):(0,o.jsx)(dT,{className:"h-3 w-3"}),c("git.initRepo")]})]}):ag?.isGit?(0,o.jsxs)("div",{className:"space-y-3",children:[(0,o.jsx)(ed,{localBranches:ag.branches??[],remoteBranches:(ag.remoteBranches??[]).filter(a=>!ag.branches?.includes(a)),currentBranch:ag.currentBranch??"",onSwitch:ar,onFetch:async()=>{a.localPath&&(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"fetch",path:a.localPath})}),await ap())},onCreateBranch:()=>an(!0)}),(0,o.jsx)(d7,{commits:ag.commits??[]}),(0,o.jsx)(eb,{localPath:a.localPath,stashes:ag.stashes??[],hasChanges:(ag.changedFiles??[]).length>0,onRefresh:ap})]}):null:(0,o.jsx)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:(0,o.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,o.jsx)(dU.AlertCircle,{className:"h-3.5 w-3.5"}),(0,o.jsx)("p",{className:"text-xs",children:c("git.noLocalPath")})]})})})]}),(0,o.jsxs)("div",{className:"p-4",children:[(0,o.jsxs)(z.Button,{variant:"ghost",onClick:()=>i(!h),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,o.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:c("sidebar.right.browseRepo")}),h?(0,o.jsx)(dO.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,o.jsx)(dP.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),h&&(0,o.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,o.jsxs)(z.Button,{variant:"outline",className:"w-full h-8 gap-1.5 text-xs",onClick:()=>y(!0),children:[(0,o.jsx)(dS.FolderOpen,{className:"h-3.5 w-3.5"}),c("sidebar.right.browseRepo")]}),M.length>0&&(0,o.jsxs)("div",{children:[(0,o.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5 px-1",children:c("sidebar.right.recent")}),(0,o.jsx)("div",{className:"space-y-0.5",children:M.map(b=>(0,o.jsxs)("button",{onClick:()=>{b.id!==a.id&&as(b.workspaceId,b.id)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors ${b.id===a.id?"bg-primary/10 text-primary cursor-default":"hover:bg-accent cursor-pointer"}`,children:["GIT"===b.type?(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,o.jsx)(dS.FolderOpen,{className:"h-3 w-3 shrink-0 text-primary/70"}),(0,o.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,o.jsx)("p",{className:"truncate text-xs font-medium text-foreground",children:b.name}),b.localPath&&(0,o.jsx)("p",{className:"truncate text-[10px] font-mono text-muted-foreground",children:b.localPath})]})]},b.id))})]})]})]}),(0,o.jsx)(Q.Dialog,{open:j,onOpenChange:k,children:(0,o.jsxs)(Q.DialogContent,{style:{maxWidth:"32rem"},children:[(0,o.jsx)(Q.DialogHeader,{children:(0,o.jsx)(Q.DialogTitle,{children:c("project.edit")})}),(0,o.jsxs)("div",{className:"space-y-3 py-2",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.name")}),(0,o.jsx)(V.Input,{value:A,onChange:a=>B(a.target.value),className:"mt-1.5"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.type.label")}),(0,o.jsx)("div",{className:"mt-1.5",children:(0,o.jsx)(d4.SegmentedControl,{options:[{value:"FRONTEND",label:c("project.type.frontend")},{value:"BACKEND",label:c("project.type.backend")}],value:I,onChange:J})})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.alias")}),(0,o.jsx)(V.Input,{value:C,onChange:a=>D(a.target.value),className:"mt-1.5"})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.description")}),(0,o.jsxs)(z.Button,{type:"button",variant:"ghost",onClick:au,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!G||ae?"opacity-50":""}`,children:[ae?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin"}):(0,o.jsx)(dW.Sparkles,{className:"h-3 w-3"}),ae?c("project.analyzing"):c("project.genDesc")]})]}),(0,o.jsx)(W.Textarea,{value:E,onChange:a=>F(a.target.value),rows:2,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none max-h-[200px] overflow-y-auto"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.localPath")}),(0,o.jsxs)("div",{className:"mt-1.5 flex gap-2",children:[(0,o.jsx)(V.Input,{value:G,onChange:a=>H(a.target.value),placeholder:c("project.localPathPlaceholder"),className:"flex-1 font-mono text-xs"}),(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>y(!0),className:"h-8 shrink-0",children:c("folder.browse")})]})]})]}),(0,o.jsxs)(Q.DialogFooter,{children:[(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>k(!1),children:c("common.cancel")}),(0,o.jsx)(z.Button,{onClick:av,disabled:!A.trim()||ae,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:c("common.save")})]})]})}),(0,o.jsx)(d3.FolderBrowserDialog,{open:x,onOpenChange:y,onSelect:a=>{j?H(a):(a=>{let b=M.find(b=>b.localPath===a);if(b)return as(b.workspaceId,b.id);let c=a.split("/").filter(Boolean).pop()??"";S(a),U(c),Z(""),_(""),P(!0)})(a)}}),(0,o.jsx)(Q.Dialog,{open:O,onOpenChange:P,children:(0,o.jsxs)(Q.DialogContent,{className:"sm:max-w-md",children:[(0,o.jsx)(Q.DialogHeader,{children:(0,o.jsx)(Q.DialogTitle,{children:c("topbar.newProject")})}),(0,o.jsxs)("div",{className:"space-y-3 py-2",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.localPath")}),(0,o.jsx)("div",{className:"mt-1.5 rounded-md border border-border bg-muted/50 px-3 py-2 font-mono text-xs text-muted-foreground",children:R})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.name")}),(0,o.jsx)(V.Input,{value:T,onChange:a=>U(a.target.value),placeholder:c("project.namePlaceholder"),className:"mt-1.5"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.type.label")}),(0,o.jsx)("div",{className:"mt-1.5",children:(0,o.jsx)(d4.SegmentedControl,{options:[{value:"FRONTEND",label:c("project.type.frontend")},{value:"BACKEND",label:c("project.type.backend")}],value:aa,onChange:ab})})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.alias")}),(0,o.jsx)(V.Input,{value:X,onChange:a=>Z(a.target.value),placeholder:c("project.aliasPlaceholder"),className:"mt-1.5"})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.description")}),(0,o.jsx)(W.Textarea,{value:$,onChange:a=>_(a.target.value),placeholder:c("project.descPlaceholder"),rows:2,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none"})]})]}),(0,o.jsxs)(Q.DialogFooter,{children:[(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>P(!1),children:c("common.cancel")}),(0,o.jsxs)(z.Button,{onClick:at,disabled:!T.trim()||ac,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[ac?(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,c("common.create")]})]})]})}),ag?.isGit&&(0,o.jsx)(d5.CreateBranchDialog,{open:am,onOpenChange:an,branches:ag.branches??[],currentBranch:ag.currentBranch??"",localPath:a.localPath,onCreated:async()=>{await ap(),ao(c("git.createSuccess"))},onError:a=>ao(`${c("git.createFailed")}: ${a}`)}),(0,o.jsx)(Q.Dialog,{open:l,onOpenChange:a=>{m(a),a||r("")},children:(0,o.jsxs)(Q.DialogContent,{className:"sm:max-w-md",children:[(0,o.jsx)(Q.DialogHeader,{children:(0,o.jsx)(Q.DialogTitle,{className:"text-rose-400",children:c("project.deleteTitle")})}),(0,o.jsxs)("div",{className:"space-y-3 py-2",children:[(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:c("project.deleteWarning",{name:a.name})}),(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:c("project.deleteIrreversible")}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:c("project.deleteConfirmLabel")}),(0,o.jsx)(V.Input,{value:n,onChange:a=>r(a.target.value),placeholder:c("project.deleteConfirmPlaceholder"),className:"mt-1.5",autoFocus:!0})]})]}),(0,o.jsxs)(Q.DialogFooter,{children:[(0,o.jsx)(z.Button,{variant:"outline",onClick:()=>m(!1),children:c("common.cancel")}),(0,o.jsxs)(z.Button,{variant:"destructive",disabled:n!==c("project.deleteConfirmText")||s,onClick:async()=>{t(!0);try{await d$(a.id),d2.toast.success(c("project.deleteSuccess")),e.push(`/workspaces/${b}`)}catch{d2.toast.error(c("project.deleteFailed"))}finally{t(!1),m(!1)}},children:[s&&(0,o.jsx)(dV.Loader2,{className:"h-3 w-3 animate-spin mr-1"}),c("project.deleteButton")]})]})]})})]})}function ed({localBranches:a,remoteBranches:b,currentBranch:c,onSwitch:d,onFetch:e,onCreateBranch:f}){let{t:g}=(0,v.useI18n)(),[h,i]=(0,p.useState)(!1),[j,k]=(0,p.useState)(""),[l,m]=(0,p.useState)(!1),n=(0,p.useRef)(null);(0,p.useEffect)(()=>{if(h)return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a);function a(a){n.current&&!n.current.contains(a.target)&&i(!1)}},[h]);let q=j.toLowerCase(),r=a.filter(a=>a.toLowerCase().includes(q)),s=b.filter(a=>a.toLowerCase().includes(q)),t=r.length>0||s.length>0,u=async()=>{m(!0);try{await e()}finally{m(!1)}};return(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,o.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("git.currentBranch")}),(0,o.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:u,disabled:l,className:"text-muted-foreground","aria-label":"Fetch",children:(0,o.jsx)(dX.RefreshCw,{className:`h-3 w-3 ${l?"animate-spin":""}`})}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:f,className:"text-muted-foreground","aria-label":g("git.createBranch"),children:(0,o.jsx)(x.Plus,{className:"h-3 w-3"})})]})]}),(0,o.jsxs)("div",{className:"relative",ref:n,children:[(0,o.jsxs)("button",{onClick:()=>{i(!h),k("")},className:"flex w-full items-center justify-between rounded-lg border border-border bg-muted/50 px-3 py-2 text-left transition-colors hover:bg-accent",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}),(0,o.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:c||"—"})]}),(0,o.jsx)(dO.ChevronDown,{className:`h-3 w-3 shrink-0 text-muted-foreground transition-transform ${h?"rotate-180":""}`})]}),h&&(0,o.jsxs)("div",{className:"absolute left-0 right-0 top-full z-20 mt-1 rounded-lg border border-border bg-popover shadow-xl",children:[(0,o.jsx)("div",{className:"border-b border-border p-1.5",children:(0,o.jsxs)("div",{className:"relative",children:[(0,o.jsx)(y.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),(0,o.jsx)("input",{value:j,onChange:a=>k(a.target.value),placeholder:"Filter...",autoFocus:!0,className:"h-7 w-full rounded-md bg-muted/50 pl-7 pr-2 text-xs text-foreground placeholder-muted-foreground outline-none focus:ring-1 focus:ring-ring"})]})}),(0,o.jsxs)("div",{className:"max-h-60 overflow-auto py-1",children:[!t&&(0,o.jsx)("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No branches found"}),r.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{className:"px-3 pt-1.5 pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("git.localBranches")}),r.map(a=>{let b=a===c;return(0,o.jsxs)("button",{onClick:()=>{b||d(a),i(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors ${b?"bg-emerald-500/10 text-emerald-400":"text-secondary-foreground hover:bg-accent"}`,children:[(0,o.jsx)(Y.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,o.jsx)("span",{className:"truncate font-mono text-xs",children:a}),b&&(0,o.jsx)(C.Check,{className:"h-3 w-3 ml-auto shrink-0"})]},`local-${a}`)})]}),s.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{className:"px-3 pt-2.5 pb-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:g("git.remoteBranches")}),s.map(a=>(0,o.jsxs)("button",{onClick:()=>{d(a),i(!1)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-secondary-foreground transition-colors hover:bg-accent",children:[(0,o.jsx)(dQ.Globe,{className:"h-3 w-3 shrink-0 text-sky-400"}),(0,o.jsx)("span",{className:"truncate font-mono text-xs",children:a})]},`remote-${a}`))]})]})]})]})]})}let ee=(0,r.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var ef=a.i(236413),eg=a.i(105916),eh=a.i(57726),ei=a.i(224372),ej=a.i(95446),ek=a.i(59711);function el({title:a,description:b,branch:c,baseBranch:d,hasConversation:e,updatedAt:f,onBack:g}){let{t:h}=(0,v.useI18n)();return(0,o.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2",children:[(0,o.jsx)(dW.Sparkles,{className:"h-3.5 w-3.5 text-primary"}),(0,o.jsx)("span",{className:"text-xs font-semibold text-primary",children:h("taskDetail.title")})]}),(0,o.jsxs)(z.Button,{variant:"ghost",onClick:g,className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground h-auto px-2 py-1",children:[(0,o.jsx)(ek.ArrowLeft,{className:"h-3.5 w-3.5"}),h("taskDetail.back")]})]}),(0,o.jsx)("h2",{className:"mt-2.5 text-lg font-bold tracking-tight text-foreground",children:a}),b&&(0,o.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:b}),(0,o.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[d?(0,o.jsxs)(N.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:[(0,o.jsx)(Y.GitBranch,{className:"mr-1 h-3 w-3"}),d," · worktree"]}):c?(0,o.jsx)(N.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:h("taskDetail.directMode")}):null,e&&(0,o.jsx)(N.Badge,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-400 text-[10px] border border-emerald-500/20",children:h("taskDetail.hasConversation")}),(0,o.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h("taskDetail.updatedAt")," ",(0,bh.formatRelativeTime)(f)]})]})]})}var em=a.i(641804),en=a.i(569720),eo=a.i(184083),ep=a.i(218074),eq=a.i(957087),er=a.i(976621),es=a.i(941497),et=a.i(658437),eu=a.i(359959),ev=a.i(607602),ew=a.i(913363),ex=a.i(687495),ey=a.i(884284),ez=a.i(208168);let eA=(0,r.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);var eB=a.i(54709),eC=a.i(942733);let eD=(0,dJ.createServerReference)("40109b1b8537b50dffdd8c7df111ae18dbfb7f4e8c",dJ.callServer,void 0,dJ.findSourceMapURL,"getTaskNotes");var eE=a.i(145443);let eF=(0,dJ.createServerReference)("407e1a70d0fb408f9f9ff3a2999d0e404405047fd1",dJ.callServer,void 0,dJ.findSourceMapURL,"getTaskAssets");var eG=a.i(914521),eH=a.i(199915);function eI({taskId:a,projectId:b}){let{t:c}=(0,v.useI18n)(),d=(0,p.useRef)(null),[e,f]=(0,p.useState)([]),[g,h]=(0,p.useState)([]),[i,j]=(0,p.useState)(!1),[k,l]=(0,p.useState)(""),[m,n]=(0,p.useState)(""),[q,r]=(0,p.useState)(!1);async function s(){k.trim()&&(await (0,eC.createNote)({title:k.trim(),content:m.trim(),projectId:b,taskId:a,category:"task"}),l(""),n(""),j(!1),eD(a).then(f))}async function t(a){await (0,eE.deleteNote)(a),f(b=>b.filter(b=>b.id!==a))}async function u(c){let e=c.target.files?.[0];if(e){r(!0);try{let c=new FormData;c.set("file",e),c.set("projectId",b),c.set("taskId",a),await (0,eG.uploadAsset)(c),eF(a).then(h)}finally{r(!1),d.current&&(d.current.value="")}}}async function w(a){await (0,eH.deleteAsset)(a),h(b=>b.filter(b=>b.id!==a))}return(0,p.useEffect)(()=>{eD(a).then(f),eF(a).then(h)},[a]),(0,o.jsx)(R.ScrollArea,{className:"h-full",children:(0,o.jsxs)("div",{className:"flex flex-col",children:[(0,o.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,o.jsx)(dR.FileText,{className:"h-3.5 w-3.5"}),c("taskPage.notes")]}),(0,o.jsxs)(z.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>j(!i),children:[i?(0,o.jsx)(eB.X,{className:"h-3 w-3"}):(0,o.jsx)(x.Plus,{className:"h-3 w-3"}),i?"":c("taskPage.addNote")]})]}),i&&(0,o.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,o.jsx)("input",{type:"text",value:k,onChange:a=>l(a.target.value),placeholder:c("taskPage.noteTitle"),className:"h-8 w-full rounded-md border border-border bg-background px-3 text-sm focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),(0,o.jsx)("textarea",{value:m,onChange:a=>n(a.target.value),placeholder:c("taskPage.noteContent"),rows:3,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-primary resize-none"}),(0,o.jsx)(z.Button,{className:"text-xs",onClick:s,disabled:!k.trim(),children:c("taskPage.addNote")})]}),(0,o.jsxs)("div",{className:"mt-2 space-y-2",children:[0===e.length&&!i&&(0,o.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:c("taskPage.noNotes")}),e.map(a=>(0,o.jsx)("div",{className:"group rounded-md border border-border bg-card p-3",children:(0,o.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,o.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,o.jsx)("h4",{className:"text-sm font-medium truncate",children:a.title}),a.content&&(0,o.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-3 whitespace-pre-wrap",children:a.content}),(0,o.jsx)("p",{className:"mt-1 text-[10px] text-muted-foreground",children:new Date(a.createdAt).toLocaleString()})]}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:()=>t(a.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:c("taskPage.deleteNote"),children:(0,o.jsx)(L.Trash2,{className:"h-3.5 w-3.5"})})]})},a.id))]})]}),(0,o.jsxs)("div",{className:"px-4 py-3",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,o.jsx)(eA,{className:"h-3.5 w-3.5"}),c("taskPage.attachments")]}),(0,o.jsxs)(z.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>d.current?.click(),disabled:q,children:[(0,o.jsx)(ez.Upload,{className:"h-3 w-3"}),c("taskPage.uploadFile")]}),(0,o.jsx)("input",{ref:d,type:"file",className:"hidden",onChange:u})]}),(0,o.jsxs)("div",{className:"mt-2 space-y-1.5",children:[0===g.length&&(0,o.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:c("taskPage.noAttachments")}),g.map(a=>{var b;return(0,o.jsxs)("div",{className:"group flex items-center gap-2 rounded-md border border-border bg-card px-3 py-2",children:[(0,o.jsx)(eA,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,o.jsx)("span",{className:"flex-1 truncate text-sm",children:a.filename}),(0,o.jsx)("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:(b=a.size)?b<1024?`${b} B`:b<1048576?`${(b/1024).toFixed(1)} KB`:`${(b/1024/1024).toFixed(1)} MB`:""}),(0,o.jsx)(z.Button,{variant:"ghost",size:"icon-xs",onClick:()=>w(a.id),className:"shrink-0 text-muted-foreground opacity-0 hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100",title:c("taskPage.deleteAttachment"),children:(0,o.jsx)(L.Trash2,{className:"h-3 w-3"})})]},a.id)})]})]})]})})}function eJ({task:a,workspaceId:b,projectLocalPath:c,onClose:d}){let{t:e}=(0,v.useI18n)(),f=(0,q.useRouter)(),{removePortal:g}=(0,eo.useTerminalPortal)(),[h,i]=(0,p.useState)("terminal"),[j,k]=(0,p.useState)(null),[l,m]=(0,p.useState)(!1),[n,r]=(0,p.useState)(a.status);(0,p.useEffect)(()=>{r(a.status)},[a.status]);let[s,t]=(0,p.useState)(null),[u,w]=(0,p.useState)(!1),[x,y]=(0,p.useState)(!1),[A,B]=(0,p.useState)([]);(0,p.useEffect)(()=>{t(null),w(!1),y(!1),B([]),k(null),i("terminal")},[a.id]);let[C,D]=(0,p.useState)([]),[E,F]=(0,p.useState)(null);(0,p.useEffect)(()=>{let a=!1;return(0,ex.getPrompts)().then(b=>{if(a)return;D(b.map(a=>({id:a.id,name:a.name,isDefault:a.isDefault})));let c=b.find(a=>a.isDefault);c&&F(c.id)}),()=>{a=!0}},[]),(0,p.useEffect)(()=>{t(null),y(!1);let b=!1;return(0,ep.getTaskExecutions)(a.id).then(a=>{if(b)return;let d=a[0];if(d?.status==="RUNNING"){let a=d.worktreePath||c||null;a&&t(a)}B(a.filter(a=>"RUNNING"!==a.status)),y(!0)}),()=>{b=!0}},[a.id]),(0,p.useEffect)(()=>{if("changes"!==h||"TODO"===n||"CANCELLED"===n)return;let b=!1;return m(!0),fetch(`/api/tasks/${a.id}/diff`).then(a=>{if(!a.ok)throw Error(`HTTP ${a.status}`);return a.json()}).then(a=>{b||k(a?.files||a?.branchDeleted?a:null)}).catch(()=>{b||k(null)}).finally(()=>{b||m(!1)}),()=>{b=!0}},[h,n,a.id]);let G=(0,p.useCallback)(async()=>{if(!u){w(!0);try{let{worktreePath:b}=await (0,eq.startPtyExecution)(a.id,"",E);t(b),r("IN_PROGRESS")}catch(a){w(!1),d2.toast.error(a instanceof Error?a.message:String(a))}}},[a.id,u,E]),H=(0,p.useCallback)(b=>{w(!1),t(null),g(a.id),0===b&&r("IN_REVIEW"),(0,ep.getTaskExecutions)(a.id).then(a=>{B(a.filter(a=>"RUNNING"!==a.status))}),f.refresh()},[f,a.id]),I=(0,p.useCallback)(async()=>{await (0,er.stopPtyExecution)(a.id),w(!1),t(null),r("IN_REVIEW"),(0,ep.getTaskExecutions)(a.id).then(a=>{B(a.filter(a=>"RUNNING"!==a.status))}),f.refresh()},[a.id,f]),J=(0,p.useCallback)(async b=>{w(!0),g(a.id),t(null);try{let{worktreePath:c}=await (0,es.resumePtyExecution)(a.id,b);t(c),r("IN_PROGRESS")}catch{w(!1)}},[a.id,g]),K=(0,p.useCallback)(async()=>{w(!0),g(a.id),t(null);try{let{worktreePath:b}=await (0,et.continueLatestPtyExecution)(a.id);t(b),r("IN_PROGRESS")}catch(a){w(!1),d2.toast.error(a instanceof Error?a.message:String(a))}},[a.id,g]),[L,M]=(0,p.useState)(!1),[N,O]=(0,p.useState)([]),P=(0,p.useCallback)(async()=>{try{let b=await (0,ev.checkWorktreeClean)(a.id);if(b.hasWorktree&&!b.clean)return void d2.toast.error(e("taskPage.uncommittedChanges",{count:String(b.files.length)}));if(b.hasWorktree&&b.clean&&!b.hasCommits)return void d2.toast.error(e("taskPage.noChangesToComplete"));if(b.hasWorktree&&b.hasCommits){O(b.commitLog),M(!0);return}await (0,eu.updateTaskStatus)(a.id,"DONE"),r("DONE"),d2.toast.success(e("taskPage.taskCompleted")),f.refresh()}catch{d2.toast.error("Failed to complete task")}},[a.id,f,e]),Q=(0,p.useCallback)(()=>{r("DONE"),M(!1),d2.toast.success(e("taskPage.taskCompleted")),f.refresh()},[f,e]),S=(0,p.useCallback)(async b=>{try{let{hash:c}=await (0,ew.commitWorktreeChanges)(a.id,b);d2.toast.success(e("diff.commitSuccess",{hash:c})),f.refresh();let d=await fetch(`/api/tasks/${a.id}/diff`);if(d.ok){let a=await d.json();k(a?.files?a:null)}}catch(a){d2.toast.error(a instanceof Error?a.message:"Commit failed")}},[a.id,f,e]);return(0,o.jsxs)("div",{className:"flex h-full w-[600px] flex-shrink-0 flex-col border-l border-border bg-sidebar","data-testid":"task-detail-panel",children:[(0,o.jsx)(el,{title:a.title,description:e("taskDetail.panelDescription"),branch:`task/${a.id}`,baseBranch:a.baseBranch,hasConversation:!1,updatedAt:a.updatedAt,onBack:d}),(0,o.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-2",children:[(0,o.jsxs)("div",{className:"flex gap-1",children:[(0,o.jsxs)("button",{onClick:()=>i("terminal"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"terminal"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,o.jsx)(ef.Terminal,{className:"h-3 w-3"}),e("terminal.execute")]}),(0,o.jsx)("button",{onClick:()=>i("changes"),className:`px-3 py-1 text-xs font-medium rounded-md ${"changes"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:e("taskPage.changes")}),(0,o.jsxs)("button",{onClick:()=>i("notes"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"notes"===h?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,o.jsx)(dR.FileText,{className:"h-3 w-3"}),e("taskPage.notes")]})]}),(0,o.jsxs)("div",{className:"flex items-center gap-2",children:["IN_REVIEW"===n&&(0,o.jsxs)(z.Button,{size:"sm",onClick:P,className:"bg-emerald-500/15 text-emerald-400 ring-1 ring-emerald-500/20 hover:bg-emerald-500/25",children:[(0,o.jsx)(eh.CheckCircle2,{className:"h-3 w-3"}),e("taskPage.completeTask")]}),"DONE"!==n&&"CANCELLED"!==n&&(0,o.jsxs)(z.Button,{variant:"ghost",size:"sm",onClick:()=>f.push(`/workspaces/${b}/tasks/${a.id}`),className:"text-muted-foreground",children:[(0,o.jsx)(ee,{className:"h-3 w-3"}),e("taskPage.viewDetails")]})]})]}),"terminal"===h?(0,o.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:x?s?(0,o.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,o.jsxs)("div",{className:"shrink-0 flex items-center justify-between border-b border-neutral-800 px-3 py-2 bg-[#0f1419]",children:[(0,o.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-emerald-400",children:[(0,o.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"}),e("execution.running")]}),(0,o.jsxs)(ej.Tooltip,{children:[(0,o.jsxs)(ej.TooltipTrigger,{onClick:I,className:"flex items-center gap-1.5 rounded-md bg-red-500/15 px-3 py-1 text-xs font-medium text-red-400 hover:bg-red-500/25 transition-colors",children:[(0,o.jsx)(eg.Square,{className:"h-3 w-3"}),e("terminal.stopExecution")]}),(0,o.jsx)(ej.TooltipContent,{side:"bottom",children:e("terminal.stopHint")})]})]}),(0,o.jsx)("div",{className:"flex-1 min-h-0",children:(0,o.jsx)(eo.TerminalOutlet,{taskId:a.id,worktreePath:s,onSessionEnd:H})})]}):"DONE"===n||"CANCELLED"===n?(0,o.jsx)("div",{className:"flex h-full flex-col overflow-hidden",children:(0,o.jsx)(R.ScrollArea,{className:"flex-1 min-h-0",children:(0,o.jsx)(ey.ExecutionTimeline,{executions:A})})}):(0,o.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,o.jsxs)("div",{className:"shrink-0 flex items-center gap-2 border-b border-border px-4 py-3",children:[C.length>0&&(0,o.jsxs)(ei.Select,{defaultValue:E??"none",onValueChange:a=>F("none"===a?null:a),children:[(0,o.jsx)(ei.SelectTrigger,{size:"sm",className:"min-w-[120px]",children:(0,o.jsx)("span",{className:"text-left truncate",children:E?C.find(a=>a.id===E)?.name??e("terminal.noPrompt"):e("terminal.noPrompt")})}),(0,o.jsxs)(ei.SelectContent,{className:"min-w-[200px]",children:[(0,o.jsx)(ei.SelectItem,{value:"none",children:e("terminal.noPrompt")}),C.map(a=>(0,o.jsxs)(ei.SelectItem,{value:a.id,children:[a.name,a.isDefault?" ★":""]},a.id))]})]},`prompt-${C.length}`),(0,o.jsxs)(z.Button,{onClick:G,disabled:u,size:"sm",className:"gap-2 px-4",children:[u?(0,o.jsx)(dV.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,o.jsx)(ef.Terminal,{className:"h-3.5 w-3.5"}),u?e("terminal.executing"):e("terminal.launch")]})]}),(0,o.jsx)(R.ScrollArea,{className:"flex-1 min-h-0",children:(0,o.jsx)(ey.ExecutionTimeline,{executions:A,onResume:J,onContinueLatest:K})})]}):(0,o.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-[#0f1419]",children:[(0,o.jsx)(dV.Loader2,{className:"size-5 animate-spin text-neutral-500"}),(0,o.jsx)("span",{className:"text-xs text-neutral-500",children:e("execution.loading")})]})}):"changes"===h?(0,o.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:l?(0,o.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:e("taskPage.loadingDiff")})}):j?.branchDeleted?(0,o.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:e("taskPage.branchDeleted")})}):j?(0,o.jsx)(em.TaskDiffView,{files:j.files,totalAdded:j.totalAdded,totalRemoved:j.totalRemoved,hasConflicts:j.hasConflicts,conflictFiles:j.conflictFiles,onCommit:S,hasUncommitted:j.hasUncommitted}):(0,o.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:e("taskPage.noChanges")})})}):"notes"===h?(0,o.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,o.jsx)(eI,{taskId:a.id,projectId:a.projectId})}):null,(0,o.jsx)(en.TaskMergeConfirmDialog,{open:L,onOpenChange:M,taskId:a.id,taskTitle:a.title,baseBranch:a.baseBranch??"main",fileCount:j?.files?.length??0,commitCount:j?.commitCount??0,commitLog:N,onMergeComplete:Q})]})}let eK=(0,dJ.createServerReference)("400a54a655d5e42e9fd42e248f57ade7d783a9112c",dJ.callServer,void 0,dJ.findSourceMapURL,"createTask"),eL=(0,dJ.createServerReference)("604e33de27080212522c7823c6a0ab28de9605544a",dJ.callServer,void 0,dJ.findSourceMapURL,"updateTask"),eM=(0,dJ.createServerReference)("40b50a4cc59eca82c5f5c49d37b6be157e1e065dfd",dJ.callServer,void 0,dJ.findSourceMapURL,"deleteTask"),eN=(0,dJ.createServerReference)("409d0fe22194f52b40651ac4340b63759f96ddcea6",dJ.callServer,void 0,dJ.findSourceMapURL,"toggleTaskPinned");var eO=a.i(769726);function eP({projects:a,activeProjectId:b,onSelect:c}){let d=(0,p.useRef)(null),[e,f]=(0,p.useState)(!1),[g,h]=(0,p.useState)(!1),i=()=>{let a=d.current;a&&(f(a.scrollLeft>0),h(a.scrollLeft<a.scrollWidth-a.clientWidth-1))};(0,p.useEffect)(()=>{i();let a=d.current;if(a){a.addEventListener("scroll",i);let b=new ResizeObserver(i);return b.observe(a),()=>{a.removeEventListener("scroll",i),b.disconnect()}}},[a]);let j=a=>{let b=d.current;b&&b.scrollBy({left:"left"===a?-150:150,behavior:"smooth"})};return(0,o.jsxs)("div",{className:"relative flex items-center",children:[e&&(0,o.jsx)("button",{onClick:()=>j("left"),className:"absolute left-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,o.jsx)(eO.ChevronLeft,{className:"h-4 w-4"})}),(0,o.jsx)("div",{ref:d,className:"flex items-center gap-1.5 overflow-x-auto scrollbar-none px-1 py-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:a.map(a=>{let d=b===a.id;return(0,o.jsxs)("button",{onClick:()=>{d||c(a.id)},className:`shrink-0 rounded-lg border-b-2 px-4 py-2 text-sm font-medium transition-colors ${d?"border-primary bg-primary/10 text-primary ring-1 ring-primary/20 cursor-default":"border-transparent text-muted-foreground hover:bg-accent hover:text-foreground cursor-pointer"}`,children:[(0,o.jsx)("span",{children:a.name}),a.alias&&(0,o.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:a.alias})]},a.id)})}),g&&(0,o.jsx)("button",{onClick:()=>j("right"),className:"absolute right-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,o.jsx)(dP.ChevronRight,{className:"h-4 w-4"})})]})}a.s(["BoardPageClient",0,function({workspaceId:a,projectId:b,project:c,projects:d,initialTasks:e,labels:f,openTaskId:g}){let h=(0,q.useRouter)(),[,i]=(0,p.useTransition)(),[j,k]=(0,p.useState)(""),[l,m]=(0,p.useState)(!1),[n,r]=(0,p.useState)("TODO"),[s,t]=(0,p.useState)(g?e.find(a=>a.id===g)??null:null),[u,v]=(0,p.useState)(null),x=(0,p.useCallback)(()=>{i(()=>{h.refresh()})},[h]);(0,p.useEffect)(()=>{if(l)return;let a=setInterval(()=>{i(()=>{h.refresh()})},5e3);return()=>clearInterval(a)},[h,l]);let y=(0,p.useCallback)(a=>{k(a)},[]),z=(0,p.useCallback)(async(a,b)=>{await (0,eu.updateTaskStatus)(a,b),s?.id===a&&t({...s,status:b}),x()},[x,s]),B=(0,p.useCallback)(async a=>{await eK({title:a.title,description:a.description,projectId:b,priority:a.priority,status:a.status,labelIds:a.labelIds,baseBranch:a.baseBranch,subPath:a.subPath}),x()},[b,x]),C=(0,p.useCallback)(async(a,b)=>{await eL(a,{...b,labelIds:b.labelIds}),v(null),x()},[x]),E=(0,p.useCallback)(async a=>{await eM(a),s?.id===a&&t(null),x()},[x,s]),F=(0,p.useCallback)(async a=>{await eN(a),x()},[x]),G=(0,p.useCallback)(async b=>{try{await (0,eq.startPtyExecution)(b,"")}catch(a){d2.toast.error(a instanceof Error?a.message:String(a))}h.push(`/workspaces/${a}/tasks/${b}`)},[h,a]),H=(0,p.useCallback)(async(a,b)=>{await (0,eu.updateTaskStatus)(a,b),s?.id===a&&t({...s,status:b}),x()},[x,s]),I=(0,p.useCallback)(a=>{r(a),v(null),m(!0)},[]),J=(0,p.useCallback)(a=>{v(a),m(!0)},[]),K=e.filter(a=>!a.labels?.some(a=>a.label.name===D.TOWER_LABEL_NAME&&a.label.isBuiltin)),L=j.trim()?K.filter(a=>{let b=j.toLowerCase();return a.title.toLowerCase().includes(b)||(a.description?.toLowerCase().includes(b)??!1)}):K;return(0,o.jsxs)("div",{className:"flex h-full",children:[(0,o.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,o.jsx)("div",{className:"px-6 pt-3 pb-1",children:(0,o.jsx)(eP,{projects:d,activeProjectId:b,onSelect:b=>h.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1})})}),(0,o.jsx)(w,{totalTasks:K.length,runningTasks:K.filter(a=>"IN_PROGRESS"===a.status).length}),(0,o.jsx)(A,{searchQuery:j,onSearchChange:y,onCreateTask:()=>{v(null),m(!0)}}),(0,o.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:(0,o.jsx)(U,{initialTasks:L,onTaskMove:z,onTaskClick:a=>{t(a)},onEditTask:J,onAddTask:I,onDeleteTask:E,onTogglePin:F,workspaceId:a,onContextMenuStatusChange:H,onContextMenuLaunch:G})}),(0,o.jsx)(dN,{open:l,onOpenChange:a=>{m(a),a||v(null)},onSubmit:B,onUpdate:C,defaultStatus:n,editTask:u,editTaskLabelIds:u?.labels?u.labels.map(a=>a.labelId):[],labels:f.filter(a=>!(a.name===D.TOWER_LABEL_NAME&&a.isBuiltin)),projectType:c.type,projectLocalPath:c.localPath})]}),s?(0,o.jsx)(eJ,{task:s,workspaceId:a,projectLocalPath:c.localPath,onClose:()=>t(null)}):(0,o.jsx)(ec,{project:c,workspaceId:a})]})}],257179)}];
6
6
 
7
7
  //# sourceMappingURL=project_f_tower_src_app_workspaces_%5BworkspaceId%5D_board-page-client_tsx_0jmj1xz._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[620235,a=>{"use strict";var b=a.i(858360),c=a.i(175391);a.s([],578712),a.i(578712);var d=a.i(825863),e=a.i(969626),f=a.i(170469),g=a.i(545264);let h=c.createContext({legendId:void 0,setLegendId:()=>{},disabled:void 0});var i=a.i(506489),j=a.i(150155),k=a.i(293785),l=a.i(128429),m=a.i(176174);let n=function(a){let e=(0,l.useBaseUiId)(),f=void 0===a.controlId?e:a.controlId,[g,h]=c.useState(f),[i,n]=c.useState(a.labelId),[o,p]=c.useState([]),q=(0,j.useRefWithInit)(()=>new Map),{messageIds:r}=(0,m.useLabelableContext)(),s=(0,d.useStableCallback)((a,b)=>{let c=q.current;void 0===b?c.delete(a):(c.set(a,b),h(a=>{let b;if(0!==c.size){for(let d of c.values()){if(void 0!==a&&d===a)return a;void 0===b&&(b=d)}return b}}))}),t=c.useCallback(a=>(0,k.mergeProps)({"aria-describedby":r.concat(o).join(" ")||void 0},a),[r,o]),u=c.useMemo(()=>({controlId:g,registerControlId:s,labelId:i,setLabelId:n,messageIds:o,setMessageIds:p,getDescriptionProps:t}),[g,s,i,n,o,p,t]);return(0,b.jsx)(m.LabelableContext.Provider,{value:u,children:a.children})};var o=a.i(256116),p=a.i(302398),q=a.i(313668),r=a.i(553902);let s=Object.keys(f.DEFAULT_VALIDITY_STATE),t=c.forwardRef(function(a,j){let{errors:l,validationMode:n,submitAttemptedRef:t}=(0,i.useFormContext)(),{render:u,className:v,validate:w,validationDebounceTime:x=0,validationMode:y=n,name:z,disabled:A=!1,invalid:B,dirty:C,touched:D,actionsRef:E,...F}=a,{disabled:G}=function(a=!1){let b=c.useContext(h);if(!b&&!a)throw Error((0,g.default)(86));return b}(),H=(0,d.useStableCallback)(w||(()=>null)),I=G||A,[J,K]=c.useState(!1),[L,M]=c.useState(!1),[N,O]=c.useState(!1),[P,Q]=c.useState(!1),R=C??L,S=D??J,T=c.useRef(!1),U=(0,d.useStableCallback)(a=>{void 0===C&&(a&&(T.current=!0),M(a))}),V=(0,d.useStableCallback)(a=>{void 0===D&&K(a)}),W=(0,d.useStableCallback)(()=>"onChange"===y||"onSubmit"===y&&t.current),X=!!z&&Object.hasOwn(l,z)&&void 0!==l[z],Y=!0===B||X,[Z,$]=c.useState({state:f.DEFAULT_VALIDITY_STATE,error:"",errors:[],value:null,initialValue:null}),_=!Y&&Z.state.valid,aa=c.useMemo(()=>({disabled:I,touched:S,dirty:R,valid:_,filled:N,focused:P}),[I,S,R,_,N,P]),ab=function(a){let{formRef:b,clearErrors:e}=(0,i.useFormContext)(),{setValidityData:g,validate:h,validityData:j,validationDebounceTime:l,invalid:n,markedDirtyRef:o,state:t,name:u,shouldValidateOnChange:v}=a,{controlId:w,getDescriptionProps:x}=(0,m.useLabelableContext)(),y=(0,q.useTimeout)(),z=c.useRef(null),A=(0,d.useStableCallback)(async(a,c=!1)=>{let d,e=z.current;if(!e)return;if(c){if(!1!==t.valid)return;let c=e.validity;if(!c.valueMissing){let c={value:a,state:{...f.DEFAULT_VALIDITY_STATE,valid:!0},error:"",errors:[],initialValue:j.initialValue};if(e.setCustomValidity(""),w){let a=b.current.fields.get(w);a&&b.current.fields.set(w,{...a,...(0,r.getCombinedFieldValidityData)(c,!1)})}g(c);return}let d=s.reduce((a,b)=>(a[b]=c[b],a),{});if(!d.valid&&!function(a){if(!a||a.valid||!a.valueMissing)return!1;let b=!1;for(let c of s)"valid"!==c&&("valueMissing"===c&&(b=a[c]),a[c]&&(b=!1));return b}(d))return}y.clear();let i=null,k=[],l=function(a){let b=s.reduce((b,c)=>(b[c]=a.validity[c],b),{}),c=!1;for(let a of s)if("valid"!==a){if("valueMissing"===a&&b[a])c=!0;else if(b[a])return b}return c&&!o.current&&(b.valid=!0,b.valueMissing=!1),b}(e),m=v();if(e.validationMessage&&!m)d=e.validationMessage,k=[e.validationMessage];else{let c=h(a,Array.from(b.current.fields.values()).reduce((a,b)=>(b.name&&(a[b.name]=b.getValue()),a),{}));null!==(i="object"==typeof c&&null!==c&&"then"in c?await c:c)?(l.valid=!1,l.customError=!0,Array.isArray(i)?(k=i,e.setCustomValidity(i.join("\n"))):i&&(k=[i],e.setCustomValidity(i))):m&&(e.setCustomValidity(""),l.customError=!1,e.validationMessage?(d=e.validationMessage,k=[e.validationMessage]):e.validity.valid&&!l.valid&&(l.valid=!0))}let p={value:a,state:l,error:d??(Array.isArray(i)?i[0]:i??""),errors:k,initialValue:j.initialValue};if(w){let a=b.current.fields.get(w);a&&b.current.fields.set(w,{...a,...(0,r.getCombinedFieldValidityData)(p,n)})}g(p)}),B=c.useCallback((a={})=>(0,k.mergeProps)(x,!1===t.valid?{"aria-invalid":!0}:p.EMPTY_OBJECT,a),[x,t.valid]),C=c.useCallback((a={})=>(0,k.mergeProps)({onChange(a){if(a.nativeEvent.defaultPrevented)return;if(e(u),!v())return void A(a.currentTarget.value,!0);let b=a.currentTarget;""===b.value?A(b.value):(y.clear(),l?y.start(l,()=>{A(b.value)}):A(b.value))}},B(a)),[B,e,u,y,A,l,v]);return c.useMemo(()=>({getValidationProps:B,getInputValidationProps:C,inputRef:z,commit:A}),[B,C,A])}({setValidityData:$,validate:H,validityData:Z,validationDebounceTime:x,invalid:Y,markedDirtyRef:T,state:aa,name:z,shouldValidateOnChange:W}),ac=c.useCallback(()=>{T.current=!0,ab.commit(Z.value)},[ab,Z]);c.useImperativeHandle(E,()=>({validate:ac}),[ac]);let ad=c.useMemo(()=>({invalid:Y,name:z,validityData:Z,setValidityData:$,disabled:I,touched:S,setTouched:V,dirty:R,setDirty:U,filled:N,setFilled:O,focused:P,setFocused:Q,validate:H,validationMode:y,validationDebounceTime:x,shouldValidateOnChange:W,state:aa,markedDirtyRef:T,validation:ab}),[Y,z,Z,I,S,V,R,U,N,O,P,Q,H,y,x,W,aa,ab]),ae=(0,o.useRenderElement)("div",a,{ref:j,state:aa,props:F,stateAttributesMapping:f.fieldValidityMapping});return(0,b.jsx)(e.FieldRootContext.Provider,{value:ad,children:ae})}),u=c.forwardRef(function(a,c){return(0,b.jsx)(n,{children:(0,b.jsx)(t,{...a,ref:c})})});var v=a.i(799823);let w=c.forwardRef(function(a,b){let{render:d,className:g,id:h,nativeLabel:i=!0,...j}=a,k=(0,e.useFieldRootContext)(!1),{labelId:l}=(0,m.useLabelableContext)(),n=c.useRef(null),p=(0,v.useLabel)({id:l??h,native:i});return(0,o.useRenderElement)("label",a,{ref:[b,n],state:k.state,props:[p,j],stateAttributesMapping:f.fieldValidityMapping})});var x=a.i(527993),y=a.i(759002),z=a.i(163323),A=a.i(6644);let B={...f.fieldValidityMapping,...z.transitionStatusMapping},C=c.forwardRef(function(a,d){let{render:f,id:g,className:h,match:j,...k}=a,n=(0,l.useBaseUiId)(g),{validityData:p,state:q,name:r}=(0,e.useFieldRootContext)(!1),{setMessageIds:s}=(0,m.useLabelableContext)(),{errors:t}=(0,i.useFormContext)(),u=r?t[r]:null,v=!1;v=!!u||!0===j||(j?!!p.state[j]:!1===p.state.valid);let{mounted:w,transitionStatus:z,setMounted:C}=(0,A.useTransitionStatus)(v);(0,x.useIsoLayoutEffect)(()=>{if(v&&n)return s(a=>a.concat(n)),()=>{s(a=>a.filter(a=>a!==n))}},[v,n,s]);let D=c.useRef(null),[E,F]=c.useState(null),[G,H]=c.useState(null),I=u||(p.errors.length>1?(0,b.jsx)("ul",{children:p.errors.map(a=>(0,b.jsx)("li",{children:a},a))}):p.error),J=p.error;null!=u?J=Array.isArray(u)?JSON.stringify(u):u:p.errors.length>1&&(J=JSON.stringify(p.errors)),v&&J!==G&&(H(J),F(I)),(0,y.useOpenChangeComplete)({open:v,ref:D,onComplete(){v||C(!1)}});let K={...q,transitionStatus:z},L=(0,o.useRenderElement)("div",a,{ref:[d,D],state:K,props:[{id:n,children:v?I:E},k],stateAttributesMapping:B,enabled:w});return w?L:null}),D=c.forwardRef(function(a,b){let{render:c,id:d,className:g,...h}=a,i=(0,l.useBaseUiId)(d),j=(0,e.useFieldRootContext)(!1),{setMessageIds:k}=(0,m.useLabelableContext)();return(0,x.useIsoLayoutEffect)(()=>{if(i)return k(a=>a.concat(i)),()=>{k(a=>a.filter(a=>a!==i))}},[i,k]),(0,o.useRenderElement)("p",a,{ref:b,state:j.state,props:[{id:i},h],stateAttributesMapping:f.fieldValidityMapping})});var E=a.i(910600),F=a.i(848275),G=a.i(648172),H=a.i(98719),I=a.i(703599),J=a.i(107432),K=a.i(394395);let L=c.forwardRef(function(a,b){let{render:d,className:g,id:h,name:i,value:j,disabled:k=!1,onValueChange:l,defaultValue:n,autoFocus:p=!1,...q}=a,{state:r,name:s,disabled:t,setTouched:u,setDirty:v,validityData:w,setFocused:y,setFilled:z,validationMode:A,validation:B}=(0,e.useFieldRootContext)(),C=t||k,D=s??i,L={...r,disabled:C},{labelId:M}=(0,m.useLabelableContext)(),N=(0,G.useLabelableId)({id:h});(0,x.useIsoLayoutEffect)(()=>{let a=null!=j;B.inputRef.current?.value||a&&""!==j?z(!0):a&&""===j&&z(!1)},[B.inputRef,z,j]);let O=c.useRef(null);(0,x.useIsoLayoutEffect)(()=>{p&&O.current===(0,K.activeElement)((0,F.ownerDocument)(O.current))&&y(!0)},[p,y]);let[P]=(0,E.useControlled)({controlled:j,default:n,name:"FieldControl",state:"value"}),Q=void 0!==j,R=Q?P:void 0;return(0,H.useField)({id:N,name:D,commit:B.commit,value:R,getValue:()=>B.inputRef.current?.value,controlRef:B.inputRef}),(0,o.useRenderElement)("input",a,{ref:[b,O],state:L,props:[{id:N,disabled:C,name:D,ref:B.inputRef,"aria-labelledby":M,autoFocus:p,...Q?{value:R}:{defaultValue:n},onChange(a){let b=a.currentTarget.value;l?.(b,(0,I.createChangeEventDetails)(J.REASONS.none,a.nativeEvent)),v(b!==w.initialValue),z(""!==b)},onFocus(){y(!0)},onBlur(a){u(!0),y(!1),"onBlur"===A&&B.commit(a.currentTarget.value)},onKeyDown(a){"INPUT"===a.currentTarget.tagName&&"Enter"===a.key&&(u(!0),B.commit(a.currentTarget.value))}},B.getInputValidationProps(),q],stateAttributesMapping:f.fieldValidityMapping})}),M=c.createContext({disabled:!1}),N=c.createContext(void 0),O=c.forwardRef(function(a,d){let{render:h,className:i,disabled:j=!1,...k}=a,{state:l,disabled:m}=(0,e.useFieldRootContext)(!1),p=m||j,q=function(a=!0){let b=c.useContext(N);if(void 0===b&&!a)throw Error((0,g.default)(3));return b}(),r=q?.parent.id,s=q?.allValues!==void 0,t=c.useMemo(()=>({disabled:p}),[p]),u=(0,o.useRenderElement)("div",a,{ref:d,state:l,props:k,stateAttributesMapping:f.fieldValidityMapping});return(0,b.jsx)(n,{controlId:s?r:void 0,children:(0,b.jsx)(M.Provider,{value:t,children:u})})});a.s(["Control",0,L,"Description",0,D,"Error",0,C,"Item",0,O,"Label",0,w,"Root",0,u,"Validity",0,function(a){let{children:d}=a,{validityData:f,invalid:g}=(0,e.useFieldRootContext)(!1),h=c.useMemo(()=>(0,r.getCombinedFieldValidityData)(f,g),[f,g]),i=!1===h.state.valid,{transitionStatus:j}=(0,A.useTransitionStatus)(i),k=c.useMemo(()=>({...h,validity:h.state,transitionStatus:j}),[h,j]);return(0,b.jsx)(c.Fragment,{children:d(k)})}],937644);var P=a.i(937644),P=P;let Q=c.forwardRef(function(a,c){return(0,b.jsx)(P.Control,{ref:c,...a})});var R=a.i(44585);a.s(["Input",0,function({className:a,type:c,...d}){return(0,b.jsx)(Q,{type:c,"data-slot":"input",className:(0,R.cn)("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",a),...d})}],620235)},858967,a=>{"use strict";var b=a.i(669794);a.s(["Check",()=>b.default])}];
1
+ module.exports=[620235,a=>{"use strict";var b=a.i(858360),c=a.i(175391);a.s([],578712),a.i(578712);var d=a.i(825863),e=a.i(969626),f=a.i(170469),g=a.i(545264);let h=c.createContext({legendId:void 0,setLegendId:()=>{},disabled:void 0});var i=a.i(506489),j=a.i(150155),k=a.i(293785),l=a.i(128429),m=a.i(176174);let n=function(a){let e=(0,l.useBaseUiId)(),f=void 0===a.controlId?e:a.controlId,[g,h]=c.useState(f),[i,n]=c.useState(a.labelId),[o,p]=c.useState([]),q=(0,j.useRefWithInit)(()=>new Map),{messageIds:r}=(0,m.useLabelableContext)(),s=(0,d.useStableCallback)((a,b)=>{let c=q.current;void 0===b?c.delete(a):(c.set(a,b),h(a=>{let b;if(0!==c.size){for(let d of c.values()){if(void 0!==a&&d===a)return a;void 0===b&&(b=d)}return b}}))}),t=c.useCallback(a=>(0,k.mergeProps)({"aria-describedby":r.concat(o).join(" ")||void 0},a),[r,o]),u=c.useMemo(()=>({controlId:g,registerControlId:s,labelId:i,setLabelId:n,messageIds:o,setMessageIds:p,getDescriptionProps:t}),[g,s,i,n,o,p,t]);return(0,b.jsx)(m.LabelableContext.Provider,{value:u,children:a.children})};var o=a.i(256116),p=a.i(302398),q=a.i(313668),r=a.i(553902);let s=Object.keys(f.DEFAULT_VALIDITY_STATE),t=c.forwardRef(function(a,j){let{errors:l,validationMode:n,submitAttemptedRef:t}=(0,i.useFormContext)(),{render:u,className:v,validate:w,validationDebounceTime:x=0,validationMode:y=n,name:z,disabled:A=!1,invalid:B,dirty:C,touched:D,actionsRef:E,...F}=a,{disabled:G}=function(a=!1){let b=c.useContext(h);if(!b&&!a)throw Error((0,g.default)(86));return b}(),H=(0,d.useStableCallback)(w||(()=>null)),I=G||A,[J,K]=c.useState(!1),[L,M]=c.useState(!1),[N,O]=c.useState(!1),[P,Q]=c.useState(!1),R=C??L,S=D??J,T=c.useRef(!1),U=(0,d.useStableCallback)(a=>{void 0===C&&(a&&(T.current=!0),M(a))}),V=(0,d.useStableCallback)(a=>{void 0===D&&K(a)}),W=(0,d.useStableCallback)(()=>"onChange"===y||"onSubmit"===y&&t.current),X=!!z&&Object.hasOwn(l,z)&&void 0!==l[z],Y=!0===B||X,[Z,$]=c.useState({state:f.DEFAULT_VALIDITY_STATE,error:"",errors:[],value:null,initialValue:null}),_=!Y&&Z.state.valid,aa=c.useMemo(()=>({disabled:I,touched:S,dirty:R,valid:_,filled:N,focused:P}),[I,S,R,_,N,P]),ab=function(a){let{formRef:b,clearErrors:e}=(0,i.useFormContext)(),{setValidityData:g,validate:h,validityData:j,validationDebounceTime:l,invalid:n,markedDirtyRef:o,state:t,name:u,shouldValidateOnChange:v}=a,{controlId:w,getDescriptionProps:x}=(0,m.useLabelableContext)(),y=(0,q.useTimeout)(),z=c.useRef(null),A=(0,d.useStableCallback)(async(a,c=!1)=>{let d,e=z.current;if(!e)return;if(c){if(!1!==t.valid)return;let c=e.validity;if(!c.valueMissing){let c={value:a,state:{...f.DEFAULT_VALIDITY_STATE,valid:!0},error:"",errors:[],initialValue:j.initialValue};if(e.setCustomValidity(""),w){let a=b.current.fields.get(w);a&&b.current.fields.set(w,{...a,...(0,r.getCombinedFieldValidityData)(c,!1)})}g(c);return}let d=s.reduce((a,b)=>(a[b]=c[b],a),{});if(!d.valid&&!function(a){if(!a||a.valid||!a.valueMissing)return!1;let b=!1;for(let c of s)"valid"!==c&&("valueMissing"===c&&(b=a[c]),a[c]&&(b=!1));return b}(d))return}y.clear();let i=null,k=[],l=function(a){let b=s.reduce((b,c)=>(b[c]=a.validity[c],b),{}),c=!1;for(let a of s)if("valid"!==a){if("valueMissing"===a&&b[a])c=!0;else if(b[a])return b}return c&&!o.current&&(b.valid=!0,b.valueMissing=!1),b}(e),m=v();if(e.validationMessage&&!m)d=e.validationMessage,k=[e.validationMessage];else{let c=h(a,Array.from(b.current.fields.values()).reduce((a,b)=>(b.name&&(a[b.name]=b.getValue()),a),{}));null!==(i="object"==typeof c&&null!==c&&"then"in c?await c:c)?(l.valid=!1,l.customError=!0,Array.isArray(i)?(k=i,e.setCustomValidity(i.join("\n"))):i&&(k=[i],e.setCustomValidity(i))):m&&(e.setCustomValidity(""),l.customError=!1,e.validationMessage?(d=e.validationMessage,k=[e.validationMessage]):e.validity.valid&&!l.valid&&(l.valid=!0))}let p={value:a,state:l,error:d??(Array.isArray(i)?i[0]:i??""),errors:k,initialValue:j.initialValue};if(w){let a=b.current.fields.get(w);a&&b.current.fields.set(w,{...a,...(0,r.getCombinedFieldValidityData)(p,n)})}g(p)}),B=c.useCallback((a={})=>(0,k.mergeProps)(x,!1===t.valid?{"aria-invalid":!0}:p.EMPTY_OBJECT,a),[x,t.valid]),C=c.useCallback((a={})=>(0,k.mergeProps)({onChange(a){if(a.nativeEvent.defaultPrevented)return;if(e(u),!v())return void A(a.currentTarget.value,!0);let b=a.currentTarget;""===b.value?A(b.value):(y.clear(),l?y.start(l,()=>{A(b.value)}):A(b.value))}},B(a)),[B,e,u,y,A,l,v]);return c.useMemo(()=>({getValidationProps:B,getInputValidationProps:C,inputRef:z,commit:A}),[B,C,A])}({setValidityData:$,validate:H,validityData:Z,validationDebounceTime:x,invalid:Y,markedDirtyRef:T,state:aa,name:z,shouldValidateOnChange:W}),ac=c.useCallback(()=>{T.current=!0,ab.commit(Z.value)},[ab,Z]);c.useImperativeHandle(E,()=>({validate:ac}),[ac]);let ad=c.useMemo(()=>({invalid:Y,name:z,validityData:Z,setValidityData:$,disabled:I,touched:S,setTouched:V,dirty:R,setDirty:U,filled:N,setFilled:O,focused:P,setFocused:Q,validate:H,validationMode:y,validationDebounceTime:x,shouldValidateOnChange:W,state:aa,markedDirtyRef:T,validation:ab}),[Y,z,Z,I,S,V,R,U,N,O,P,Q,H,y,x,W,aa,ab]),ae=(0,o.useRenderElement)("div",a,{ref:j,state:aa,props:F,stateAttributesMapping:f.fieldValidityMapping});return(0,b.jsx)(e.FieldRootContext.Provider,{value:ad,children:ae})}),u=c.forwardRef(function(a,c){return(0,b.jsx)(n,{children:(0,b.jsx)(t,{...a,ref:c})})});var v=a.i(799823);let w=c.forwardRef(function(a,b){let{render:d,className:g,id:h,nativeLabel:i=!0,...j}=a,k=(0,e.useFieldRootContext)(!1),{labelId:l}=(0,m.useLabelableContext)(),n=c.useRef(null),p=(0,v.useLabel)({id:l??h,native:i});return(0,o.useRenderElement)("label",a,{ref:[b,n],state:k.state,props:[p,j],stateAttributesMapping:f.fieldValidityMapping})});var x=a.i(527993),y=a.i(759002),z=a.i(163323),A=a.i(6644);let B={...f.fieldValidityMapping,...z.transitionStatusMapping},C=c.forwardRef(function(a,d){let{render:f,id:g,className:h,match:j,...k}=a,n=(0,l.useBaseUiId)(g),{validityData:p,state:q,name:r}=(0,e.useFieldRootContext)(!1),{setMessageIds:s}=(0,m.useLabelableContext)(),{errors:t}=(0,i.useFormContext)(),u=r?t[r]:null,v=!1;v=!!u||!0===j||(j?!!p.state[j]:!1===p.state.valid);let{mounted:w,transitionStatus:z,setMounted:C}=(0,A.useTransitionStatus)(v);(0,x.useIsoLayoutEffect)(()=>{if(v&&n)return s(a=>a.concat(n)),()=>{s(a=>a.filter(a=>a!==n))}},[v,n,s]);let D=c.useRef(null),[E,F]=c.useState(null),[G,H]=c.useState(null),I=u||(p.errors.length>1?(0,b.jsx)("ul",{children:p.errors.map(a=>(0,b.jsx)("li",{children:a},a))}):p.error),J=p.error;null!=u?J=Array.isArray(u)?JSON.stringify(u):u:p.errors.length>1&&(J=JSON.stringify(p.errors)),v&&J!==G&&(H(J),F(I)),(0,y.useOpenChangeComplete)({open:v,ref:D,onComplete(){v||C(!1)}});let K={...q,transitionStatus:z},L=(0,o.useRenderElement)("div",a,{ref:[d,D],state:K,props:[{id:n,children:v?I:E},k],stateAttributesMapping:B,enabled:w});return w?L:null}),D=c.forwardRef(function(a,b){let{render:c,id:d,className:g,...h}=a,i=(0,l.useBaseUiId)(d),j=(0,e.useFieldRootContext)(!1),{setMessageIds:k}=(0,m.useLabelableContext)();return(0,x.useIsoLayoutEffect)(()=>{if(i)return k(a=>a.concat(i)),()=>{k(a=>a.filter(a=>a!==i))}},[i,k]),(0,o.useRenderElement)("p",a,{ref:b,state:j.state,props:[{id:i},h],stateAttributesMapping:f.fieldValidityMapping})});var E=a.i(910600),F=a.i(848275),G=a.i(648172),H=a.i(98719),I=a.i(703599),J=a.i(107432),K=a.i(394395);let L=c.forwardRef(function(a,b){let{render:d,className:g,id:h,name:i,value:j,disabled:k=!1,onValueChange:l,defaultValue:n,autoFocus:p=!1,...q}=a,{state:r,name:s,disabled:t,setTouched:u,setDirty:v,validityData:w,setFocused:y,setFilled:z,validationMode:A,validation:B}=(0,e.useFieldRootContext)(),C=t||k,D=s??i,L={...r,disabled:C},{labelId:M}=(0,m.useLabelableContext)(),N=(0,G.useLabelableId)({id:h});(0,x.useIsoLayoutEffect)(()=>{let a=null!=j;B.inputRef.current?.value||a&&""!==j?z(!0):a&&""===j&&z(!1)},[B.inputRef,z,j]);let O=c.useRef(null);(0,x.useIsoLayoutEffect)(()=>{p&&O.current===(0,K.activeElement)((0,F.ownerDocument)(O.current))&&y(!0)},[p,y]);let[P]=(0,E.useControlled)({controlled:j,default:n,name:"FieldControl",state:"value"}),Q=void 0!==j,R=Q?P:void 0;return(0,H.useField)({id:N,name:D,commit:B.commit,value:R,getValue:()=>B.inputRef.current?.value,controlRef:B.inputRef}),(0,o.useRenderElement)("input",a,{ref:[b,O],state:L,props:[{id:N,disabled:C,name:D,ref:B.inputRef,"aria-labelledby":M,autoFocus:p,...Q?{value:R}:{defaultValue:n},onChange(a){let b=a.currentTarget.value;l?.(b,(0,I.createChangeEventDetails)(J.REASONS.none,a.nativeEvent)),v(b!==w.initialValue),z(""!==b)},onFocus(){y(!0)},onBlur(a){u(!0),y(!1),"onBlur"===A&&B.commit(a.currentTarget.value)},onKeyDown(a){"INPUT"===a.currentTarget.tagName&&"Enter"===a.key&&(u(!0),B.commit(a.currentTarget.value))}},B.getInputValidationProps(),q],stateAttributesMapping:f.fieldValidityMapping})}),M=c.createContext({disabled:!1}),N=c.createContext(void 0),O=c.forwardRef(function(a,d){let{render:h,className:i,disabled:j=!1,...k}=a,{state:l,disabled:m}=(0,e.useFieldRootContext)(!1),p=m||j,q=function(a=!0){let b=c.useContext(N);if(void 0===b&&!a)throw Error((0,g.default)(3));return b}(),r=q?.parent.id,s=q?.allValues!==void 0,t=c.useMemo(()=>({disabled:p}),[p]),u=(0,o.useRenderElement)("div",a,{ref:d,state:l,props:k,stateAttributesMapping:f.fieldValidityMapping});return(0,b.jsx)(n,{controlId:s?r:void 0,children:(0,b.jsx)(M.Provider,{value:t,children:u})})});a.s(["Control",0,L,"Description",0,D,"Error",0,C,"Item",0,O,"Label",0,w,"Root",0,u,"Validity",0,function(a){let{children:d}=a,{validityData:f,invalid:g}=(0,e.useFieldRootContext)(!1),h=c.useMemo(()=>(0,r.getCombinedFieldValidityData)(f,g),[f,g]),i=!1===h.state.valid,{transitionStatus:j}=(0,A.useTransitionStatus)(i),k=c.useMemo(()=>({...h,validity:h.state,transitionStatus:j}),[h,j]);return(0,b.jsx)(c.Fragment,{children:d(k)})}],937644);var P=a.i(937644),P=P;let Q=c.forwardRef(function(a,c){return(0,b.jsx)(P.Control,{ref:c,...a})});var R=a.i(44585);a.s(["Input",0,function({className:a,type:c,...d}){return(0,b.jsx)(Q,{type:c,"data-slot":"input",className:(0,R.cn)("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",a),...d})}],620235)}];
2
2
 
3
- //# sourceMappingURL=project_f_tower_0u6dr5n._.js.map
3
+ //# sourceMappingURL=project_f_tower_src_components_ui_input_tsx_02yu4ri._.js.map
@@ -7,9 +7,9 @@ globalThis.__BUILD_MANIFEST = {
7
7
  "static/chunks/03~yq9q893hmn.js"
8
8
  ],
9
9
  "lowPriorityFiles": [
10
- "static/VzTy7iJ2D58ZvnVnTJZJi/_buildManifest.js",
11
- "static/VzTy7iJ2D58ZvnVnTJZJi/_ssgManifest.js",
12
- "static/VzTy7iJ2D58ZvnVnTJZJi/_clientMiddlewareManifest.js"
10
+ "static/UuR3rJNr0J0cwFZgsovkL/_buildManifest.js",
11
+ "static/UuR3rJNr0J0cwFZgsovkL/_ssgManifest.js",
12
+ "static/UuR3rJNr0J0cwFZgsovkL/_clientMiddlewareManifest.js"
13
13
  ],
14
14
  "rootMainFiles": [
15
15
  "static/chunks/0-49z0i7n9z_u.js",