tower-studio 0.2.31 → 0.2.32
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.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +30 -30
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/browse-fs/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/missions/page/react-loadable-manifest.json +1 -1
- package/.next/standalone/.next/server/app/missions/page/server-reference-manifest.json +67 -67
- package/.next/standalone/.next/server/app/missions/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/missions/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/onboarding/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/onboarding/page/server-reference-manifest.json +30 -30
- package/.next/standalone/.next/server/app/onboarding/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +30 -30
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +47 -47
- package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +84 -84
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +84 -84
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +62 -62
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +63 -63
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +30 -30
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page/server-reference-manifest.json +72 -72
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/versions/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +3 -3
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +77 -77
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspaces/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/workspaces/page/server-reference-manifest.json +50 -50
- package/.next/standalone/.next/server/app/workspaces/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0eh8dj_.js +5 -5
- package/.next/standalone/.next/server/chunks/0se9_next_dist_esm_build_templates_app-route_0hrprmi.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0122.hq._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__01n7exm._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0c513um._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0clvf~t._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0fey.8j._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0gk6ftq._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0kay2~d._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0lioghc._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0mw.9lg._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qif839._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0tys9pv._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__12ohpl.._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_0bkvm8c._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_lib_02llcit._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_lib_0aowbzy._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/0iu._[workspaceId]_projects_[projectId]_versions_version-timeline-client_tsx_07o_kyi._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01pn3ol._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02p4lry._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0b77ayk._.js +3 -3
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0bs_c.t._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0cle18b._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0q6m-fw._.js → [root-of-the-server]__0dzfucv._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0e25s-_._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0jymb~t._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0lx7sf8._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0cjnw12._.js → [root-of-the-server]__0pik08u._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0rara9.._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0rv7-_r._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0ggwnea._.js → [root-of-the-server]__0t0.u9.._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0z7je5_._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1307ll-._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{_0sj20-h._.js → _0-frleg._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0.sfgns._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_0fc7rh_._.js → _0.y2of~._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/_04ia97a._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_06~9axc._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_070t_mh._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0_kfemp._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_01jctji._.js → _0_vq_9m._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{_0v~zkwi._.js → _0a5f4n.._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0bkb_.9._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0cj9a7y._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0ex2yo6._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_0.5wuxq._.js → _0fb1op1._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{_0lr6c.q._.js → _0ia4gik._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_0jg.s-g._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{_010l~rd._.js → _0kqe7k7._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{_12e8ueo._.js → _0lw1tq2._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{_0e2s44q._.js → _0mci_e0._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/_0qd7u-y._.js +4 -0
- package/.next/standalone/.next/server/chunks/ssr/_0rdyrfd._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0tb5sv.._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0ttg7a2._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/_0vl82nb._.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/{_0.i2.1y._.js → _0vz_pgd._.js} +3 -3
- package/.next/standalone/.next/server/chunks/ssr/src_075s.rk._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_0djxlqx._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_0eufeyj._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_actions_agent-actions_ts_0~wc.sy._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_actions_file-actions_ts_0gcvqwm._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_missions_missions-client_tsx_11429lj._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_onboarding_page_tsx_0xf7hpz._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_settings_page_tsx_0h9v7dr._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0wyzpam._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_board-page-client_tsx_0gips66._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_02t7blt._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +264 -264
- package/.next/standalone/.next/static/chunks/01iha~qq-s2iq.js +1 -0
- package/.next/standalone/.next/static/chunks/{030ac851xd~gu.js → 024-z6hhx6kj8.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0jdea_ondwo2z.js → 02cdl9l647nfw.js} +1 -1
- package/.next/standalone/.next/static/chunks/02hkeaf1dqmhz.js +1 -0
- package/.next/standalone/.next/static/chunks/08fee4dmmdj39.js +5 -0
- package/.next/standalone/.next/static/chunks/{0z42w8y2ktwst.js → 08hbrv30ik~i9.js} +1 -1
- package/.next/standalone/.next/static/chunks/0b6cq1pd_clzr.js +2 -0
- package/.next/standalone/.next/static/chunks/0cx03gmt.9kfo.js +1 -0
- package/.next/standalone/.next/static/chunks/0dsr03qh0epy8.js +1 -0
- package/.next/standalone/.next/static/chunks/{0q0hf~j_0ho6u.js → 0g7kwivg0c5zn.js} +1 -1
- package/.next/standalone/.next/static/chunks/0mov-lr-7u237.js +5 -0
- package/.next/standalone/.next/static/chunks/{0204r--~nsp18.js → 0nkn227~1tu4_.js} +1 -1
- package/.next/standalone/.next/static/chunks/{05lkncv5~cymd.js → 0nxf2s5ppbm.b.js} +1 -1
- package/.next/standalone/.next/static/chunks/0n~h~45imnm42.js +1 -0
- package/.next/standalone/.next/static/chunks/{0486duu_3efe7.js → 0o.a8t_h5vwy-.js} +1 -1
- package/.next/standalone/.next/static/chunks/0qmzg_a-~~1-1.js +2 -0
- package/.next/standalone/.next/static/chunks/0s86miqs3h9gi.js +1 -0
- package/.next/standalone/.next/static/chunks/0serb6jug2wgz.js +1 -0
- package/.next/standalone/.next/static/chunks/{15jqo~pexyrdp.js → 0w6~b9luhbk1x.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0qrh5-j~zd5nb.js → 0x.izf3-isfsq.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0.0j755cvqmrp.js → 0y_s_afcrfp3_.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0jj53.l_c5mi9.js → 0~moqlrzya~z_.js} +2 -2
- package/.next/standalone/.next/static/chunks/{07frdan9tq1_3.js → 13dz~n5.w6hta.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0.buvrbvzfwyy.js → 13iipzi9xw35f.js} +1 -1
- package/.next/standalone/.next/static/chunks/{13l5bumoa7m-8.js → 15550tahnp.5j.js} +1 -1
- package/.next/standalone/.next/static/chunks/17.p0kyu6y24w.js +1 -0
- package/.next/standalone/package.json +1 -1
- package/dist/mcp-server.cjs +9 -2
- package/package.json +1 -1
- package/prisma/schema.prisma +0 -7
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0lho64y._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_070.dxf._.js +0 -4
- package/.next/standalone/.next/server/chunks/ssr/_0jartlx._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0jixh5l._.js +0 -3
- package/.next/standalone/.next/server/chunks/ssr/_0p523x3._.js +0 -3
- package/.next/standalone/.next/static/chunks/03kiyommty8e..js +0 -1
- package/.next/standalone/.next/static/chunks/08i7p_8fg0alm.js +0 -5
- package/.next/standalone/.next/static/chunks/090nszcq3.6j3.js +0 -1
- package/.next/standalone/.next/static/chunks/0buf_9f~42bcs.js +0 -1
- package/.next/standalone/.next/static/chunks/0c37kkv-_mqh1.js +0 -5
- package/.next/standalone/.next/static/chunks/0ch2~x.r._~9f.js +0 -1
- package/.next/standalone/.next/static/chunks/0eskfzrdlc5ka.js +0 -1
- package/.next/standalone/.next/static/chunks/0g0ui9x6~.du4.js +0 -2
- package/.next/standalone/.next/static/chunks/0ox7k.va.hxke.js +0 -1
- package/.next/standalone/.next/static/chunks/0ps1bcdktah3z.js +0 -1
- package/.next/standalone/.next/static/chunks/0~qog0fhbtq68.js +0 -2
- package/.next/standalone/.next/static/chunks/11qbnyfcew125.js +0 -1
- /package/.next/standalone/.next/static/{91SkA26N5DQokm5Txl-cb → v4Xp8QqFHgGyfY7YcmgRm}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{91SkA26N5DQokm5Txl-cb → v4Xp8QqFHgGyfY7YcmgRm}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{91SkA26N5DQokm5Txl-cb → v4Xp8QqFHgGyfY7YcmgRm}/_ssgManifest.js +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[473935,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(553798),e=a.i(711796);let f=(0,e.default)("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]),g=(0,e.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);var h=a.i(283857),i=a.i(951192);function j({totalTasks:a,runningTasks:c}){let{t:d}=(0,i.useI18n)();return(0,b.jsxs)("div",{className:"grid grid-cols-3 gap-3 px-6 py-4",children:[(0,b.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"rounded-lg bg-sky-500/10 p-2 ring-1 ring-sky-500/20",children:(0,b.jsx)(f,{className:"h-4 w-4 text-sky-400"})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:d("board.overview")}),(0,b.jsx)("p",{className:"text-2xl font-bold font-mono tracking-tight text-foreground",children:a})]})]})}),(0,b.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"rounded-lg bg-primary/10 p-2 ring-1 ring-primary/20",children:(0,b.jsx)(g,{className:"h-4 w-4 text-primary"})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:d("board.running")}),(0,b.jsx)("p",{className:"text-2xl font-bold font-mono tracking-tight text-foreground",children:c})]})]})}),(0,b.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"rounded-lg bg-emerald-500/10 p-2 ring-1 ring-emerald-500/20",children:(0,b.jsx)(h.Lightbulb,{className:"h-4 w-4 text-emerald-400"})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:d("board.tip")}),(0,b.jsx)("p",{className:"text-xs font-medium text-foreground/80",children:d("board.tipText")})]})]})})]})}var k=a.i(634910),l=a.i(774881),m=a.i(573242),n=a.i(577565),o=a.i(699570),p=a.i(866718),q=a.i(580701);function r({searchQuery:a,onSearchChange:c,versions:d=[],versionFilter:e="all",onVersionFilterChange:f,versionsHref:g,onCreateTask:h}){let j,{t:s}=(0,i.useI18n)(),t="all"===e?s("board.allVersions"):"backlog"===e?s("board.backlogFilter"):(j=d.find(a=>a.id===e))?`${j.number} ${j.name}`:s("board.allVersions");return(0,b.jsxs)("div",{className:"flex items-center gap-2 px-6 py-2",children:[f&&(0,b.jsxs)(q.Select,{value:e,onValueChange:a=>f(a||"all"),children:[(0,b.jsxs)(q.SelectTrigger,{className:"h-8 w-44 shrink-0 gap-1.5 text-xs text-muted-foreground",children:[(0,b.jsx)(n.GitBranch,{className:"h-3.5 w-3.5 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:t})]}),(0,b.jsxs)(q.SelectContent,{children:[(0,b.jsx)(q.SelectItem,{value:"all",children:s("board.allVersions")}),(0,b.jsx)(q.SelectItem,{value:"backlog",children:s("board.backlogFilter")}),d.map(a=>(0,b.jsxs)(q.SelectItem,{value:a.id,children:[(0,b.jsx)("span",{className:"font-mono",children:a.number})," ",a.name]},a.id))]})]}),(0,b.jsxs)("div",{className:"relative flex-1 max-w-xs",children:[(0,b.jsx)(m.Search,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),(0,b.jsx)(p.Input,{type:"text",value:a,onChange:a=>c(a.target.value),placeholder:s("board.searchPlaceholder"),className:"pl-8 pr-3 text-xs"})]}),(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[g&&(0,b.jsx)(k.default,{href:g,children:(0,b.jsxs)(o.Button,{variant:"outline",className:"h-8 gap-1.5 text-xs text-muted-foreground",children:[(0,b.jsx)(n.GitBranch,{className:"h-3.5 w-3.5"}),s("version.timeline")]})}),(0,b.jsxs)(o.Button,{"data-tour":"create-task",variant:"outline",className:"gap-1.5 border-border text-xs text-muted-foreground hover:border-primary/30 hover:text-primary",onClick:h,children:[(0,b.jsx)(l.Plus,{className:"h-3.5 w-3.5"}),s("board.newTask")]})]})]})}var s=a.i(986099),t=a.i(668116),u=a.i(521007);function v({x:a,y:e,taskId:f,currentStatus:g,hasExecutions:h,workspaceId:j,onClose:k,onStatusChange:l,onLaunch:m}){let{t:n}=(0,i.useI18n)(),o=(0,d.useRouter)(),p=(0,c.useRef)(null);(0,c.useEffect)(()=>{let a=a=>{p.current&&!p.current.contains(a.target)&&k()},b=a=>{"Escape"===a.key&&k()};return document.addEventListener("mousedown",a),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",b)}},[k]);let q="flex items-center px-3 py-1.5 text-xs cursor-pointer hover:bg-accent rounded-sm w-full text-left",r=(0,b.jsxs)("div",{ref:p,style:{position:"fixed",top:e,left:a,zIndex:9999},className:"bg-popover border border-border rounded-md shadow-md py-1 min-w-[180px]",children:[(0,b.jsx)("div",{className:"px-3 py-1 text-[10px] text-muted-foreground uppercase tracking-wider",children:n("board.contextMenu.changeStatus")}),u.BOARD_COLUMNS.map(a=>(0,b.jsxs)("button",{type:"button",className:q,onClick:()=>{l(f,a.id),k()},children:[g===a.id?(0,b.jsx)(t.Check,{className:"h-3 w-3 mr-2 flex-shrink-0"}):(0,b.jsx)("span",{className:"w-5 flex-shrink-0"}),a.label]},a.id)),(0,b.jsx)("hr",{className:"my-1 border-border"}),(0,b.jsx)("button",{type:"button",className:`${q} ${h?"opacity-50 cursor-not-allowed":""}`,disabled:h,onClick:()=>{h||(m(f),k())},children:n("board.contextMenu.launch")}),"DONE"!==g&&"CANCELLED"!==g&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("hr",{className:"my-1 border-border"}),(0,b.jsx)("button",{type:"button",className:q,onClick:()=>{o.push(`/workspaces/${j}/tasks/${f}`),k()},children:n("board.contextMenu.goToDetail")})]})]});return"u"<typeof document?null:(0,s.createPortal)(r,document.body)}var w=a.i(643228),x=a.i(859103);let y=(0,e.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);var z=a.i(514126),A=a.i(336771),B=a.i(690251),C=a.i(975231);let D=(0,e.default)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);var E=a.i(786304),F=a.i(785259),G=a.i(335732),H=a.i(551578);function I({task:a,onClick:c,onEdit:d,onDelete:e,onTogglePin:f,onContextMenu:g}){let{t:h}=(0,i.useI18n)(),{attributes:j,listeners:k,setNodeRef:l,transform:m,transition:p,isDragging:q}=(0,x.useSortable)({id:a.id,data:{type:"task",task:a}}),r={transform:z.CSS.Transform.toString(m),transition:p,opacity:q?.4:1},s=u.PRIORITY_CONFIG[a.priority],t=!!a.baseBranch;return(0,b.jsxs)("div",{ref:l,style:r,...j,...k,className:"group cursor-grab rounded-lg border border-border bg-card p-3 transition-all hover:border-primary/20 hover:bg-accent/50 active:cursor-grabbing",onClick:c,onContextMenu:b=>{b.preventDefault(),b.stopPropagation(),g?.(a,b.clientX,b.clientY)},"data-testid":"task-card",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between",children:[(0,b.jsx)("h4",{className:"text-sm font-medium text-foreground",children:a.title}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",className:`transition-all ${a.pinned?"text-primary opacity-100":"text-muted-foreground opacity-0 group-hover:opacity-100"}`,onClick:b=>{b.stopPropagation(),f?.(a.id)},"aria-label":h(a.pinned?"board.unpin":"board.pin"),children:(0,b.jsx)(D,{className:`h-3.5 w-3.5 ${a.pinned?"-rotate-45":""}`})}),(0,b.jsxs)(G.DropdownMenu,{children:[(0,b.jsx)(G.DropdownMenuTrigger,{render:(0,b.jsx)("button",{className:"rounded-md p-0.5 text-muted-foreground opacity-0 transition-all hover:bg-background hover:text-foreground group-hover:opacity-100",onClick:a=>a.stopPropagation()}),children:(0,b.jsx)(A.MoreHorizontal,{className:"h-4 w-4"})}),(0,b.jsxs)(G.DropdownMenuContent,{align:"end",children:[(0,b.jsxs)(G.DropdownMenuItem,{onClick:b=>{b.stopPropagation(),d?.(a)},children:[(0,b.jsx)(B.Pencil,{className:"mr-2 h-3.5 w-3.5"}),h("common.edit")]}),(0,b.jsxs)(G.DropdownMenuItem,{className:"text-rose-400",onClick:b=>{b.stopPropagation(),e?.(a.id)},children:[(0,b.jsx)(C.Trash2,{className:"mr-2 h-3.5 w-3.5"}),h("common.delete")]})]})]})]})]}),a.description&&(0,b.jsx)("p",{className:"mt-1.5 line-clamp-3 text-xs leading-relaxed text-muted-foreground",children:a.description}),(0,b.jsxs)("div",{className:"mt-2.5 flex flex-wrap items-center gap-1.5",children:[(0,b.jsx)(E.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${s.color}`,children:s.label}),a.labels?.map(a=>(0,b.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-medium",style:{backgroundColor:a.label.color+"20",color:a.label.color},children:a.label.name},a.label.id)),(t||a.version)&&(0,b.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[t&&(0,b.jsxs)(F.Tooltip,{disableHoverablePopup:!0,children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)("span",{className:"inline-flex cursor-default items-center rounded-md border border-border bg-muted px-1 py-0.5 text-muted-foreground",onPointerDown:a=>a.stopPropagation(),children:(0,b.jsx)(n.GitBranch,{className:"h-2.5 w-2.5 shrink-0"})})}),(0,b.jsx)(F.TooltipContent,{side:"top",children:h("board.card.worktree",{branch:a.baseBranch??""})})]}),a.version&&(0,b.jsxs)(F.Tooltip,{disableHoverablePopup:!0,children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)("span",{className:"cursor-default",onPointerDown:a=>a.stopPropagation(),children:(0,b.jsx)(H.TaskVersionTag,{number:a.version.number,title:""})})}),(0,b.jsx)(F.TooltipContent,{side:"top",children:h("board.card.version",{number:a.version.number,name:a.version.name})})]})]})]})]})}var J=a.i(814574),K=a.i(269876);function L({open:a,onOpenChange:c,columnLabel:d,columnColor:e,tasks:f,onTaskClick:g}){let{t:h}=(0,i.useI18n)();return(0,b.jsx)(J.Dialog,{open:a,onOpenChange:c,children:(0,b.jsxs)(J.DialogContent,{className:"sm:max-w-6xl max-h-[80vh]",children:[(0,b.jsx)(J.DialogHeader,{children:(0,b.jsxs)(J.DialogTitle,{className:"flex items-center gap-2",children:[(0,b.jsx)("div",{className:`h-2.5 w-2.5 rounded-full ${e}`}),(0,b.jsx)("span",{children:d}),(0,b.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-mono font-medium text-muted-foreground",children:f.length})]})}),(0,b.jsx)(K.ScrollArea,{className:"max-h-[680px]",children:(0,b.jsxs)("div",{className:"grid grid-cols-4 gap-3 pr-3",children:[f.map(a=>{let d=u.PRIORITY_CONFIG[a.priority];return(0,b.jsxs)("div",{className:"cursor-pointer rounded-lg border border-border bg-card p-3 transition-all hover:border-primary/20 hover:bg-accent/50",onClick:()=>{g?.(a),c(!1)},children:[(0,b.jsx)("h4",{className:"text-sm font-medium text-foreground line-clamp-2",children:a.title}),a.description&&(0,b.jsx)("p",{className:"mt-1.5 line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:a.description}),(0,b.jsxs)("div",{className:"mt-2 flex items-center gap-1.5 flex-wrap",children:[(0,b.jsx)(E.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${d.color}`,children:d.label}),a.labels?.map(a=>(0,b.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-medium",style:{backgroundColor:a.label.color+"20",color:a.label.color},children:a.label.name},a.label.id))]})]},a.id)}),0===f.length&&(0,b.jsx)("div",{className:"col-span-4 py-8 text-center text-sm text-muted-foreground",children:h("board.noTasks")})]})})]})})}function M({id:a,label:d,color:e,tasks:f,onTaskClick:g,onEditTask:h,onAddTask:j,onDeleteTask:k,onTogglePin:m,onContextMenu:n}){let{setNodeRef:p,isOver:q}=(0,w.useDroppable)({id:a}),[r,s]=(0,c.useState)(!1),{t}=(0,i.useI18n)();return(0,b.jsxs)("div",{className:`flex w-0 min-w-[220px] flex-1 flex-col min-h-0 border-r border-border/50 last:border-r-0 transition-colors ${q?"bg-primary/[0.06]":""}`,children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-3 py-2.5 border-b border-border/30",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("div",{className:`h-2 w-2 rounded-full ${e}`}),(0,b.jsx)("span",{className:"text-xs font-semibold tracking-wide text-secondary-foreground",children:d}),(0,b.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-mono font-medium text-muted-foreground",children:f.length})]}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>s(!0),className:"text-muted-foreground","aria-label":t("board.viewAll"),children:(0,b.jsx)(y,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:j,className:"text-muted-foreground","aria-label":"add",children:(0,b.jsx)(l.Plus,{className:"h-3.5 w-3.5"})})]})]}),(0,b.jsx)(L,{open:r,onOpenChange:s,columnLabel:d,columnColor:e,tasks:f,onTaskClick:g}),(0,b.jsx)(K.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)("div",{ref:p,className:"flex flex-col gap-2 p-2",children:(0,b.jsx)(x.SortableContext,{items:f.map(a=>a.id),strategy:x.verticalListSortingStrategy,children:f.map(a=>(0,b.jsx)(I,{task:a,onClick:()=>g?.(a),onEdit:h,onDelete:k,onTogglePin:m,onContextMenu:n},a.id))})})})]})}function N({initialTasks:a,onTaskMove:d,onTaskClick:e,onEditTask:f,onAddTask:g,onDeleteTask:h,onTogglePin:i,onContextMenuStatusChange:j,onContextMenuLaunch:k,workspaceId:l}){let[m,n]=(0,c.useState)(a),[o,p]=(0,c.useState)(null),[q,r]=(0,c.useState)(null);(0,c.useEffect)(()=>{n(a)},[a]);let s=(0,w.useSensors)((0,w.useSensor)(w.PointerSensor,{activationConstraint:{distance:8}})),t=(0,c.useCallback)((a,b,c)=>{r({task:a,x:b,y:c})},[]),x=(0,c.useCallback)(a=>{let b=m.find(b=>b.id===a.active.id);b&&p(b)},[m]),y=(0,c.useCallback)(a=>{let b,{active:c,over:e}=a;if(p(null),!e)return;let f=c.id,g=e.id;if(u.BOARD_COLUMNS.some(a=>a.id===g))b=g;else{let a=m.find(a=>a.id===g);b=a?.status}b&&(n(a=>a.map(a=>a.id===f?{...a,status:b}:a)),d?.(f,b))},[m,d]);return(0,b.jsxs)(w.DndContext,{id:"kanban-board",sensors:s,collisionDetection:w.closestCorners,onDragStart:x,onDragEnd:y,children:[(0,b.jsx)("div",{className:"mx-2 flex h-full overflow-x-auto rounded-xl border border-border bg-card/50",children:u.BOARD_COLUMNS.map(a=>(0,b.jsx)(M,{id:a.id,label:a.label,color:a.color,tasks:m.filter(b=>b.status===a.id),onTaskClick:e,onEditTask:f,onAddTask:()=>g?.(a.id),onDeleteTask:h,onTogglePin:i,onContextMenu:t},a.id))}),(0,b.jsx)(w.DragOverlay,{children:o?(0,b.jsx)("div",{className:"rotate-3 scale-105",children:(0,b.jsx)(I,{task:o})}):null}),q&&(0,b.jsx)(v,{x:q.x,y:q.y,taskId:q.task.id,currentStatus:q.task.status,hasExecutions:(q.task._count?.executions??0)>0,workspaceId:l??"",onClose:()=>r(null),onStatusChange:(a,b)=>{j?.(a,b),r(null)},onLaunch:a=>{k?.(a),r(null)}})]})}var O=a.i(445798);function P(a,b,c){return Math.min(Math.max(a,b),c)}var Q=a.i(442620),R=a.i(10390),S=a.i(350739),T=a.i(347165);let U=(0,e.default)("git-commit-vertical",[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]);var V=a.i(616335),W=a.i(704494),X=a.i(394259),Y=a.i(625892),Z=a.i(939859),$=a.i(648512),_=a.i(22761),aa=a.i(429246),ab=a.i(780410);let ac=(0,ab.createServerReference)("60d291d9c2b53e5c8179298270b3d4f8cad2dd74e4",ab.callServer,void 0,ab.findSourceMapURL,"updateProject");var ad=a.i(57479);let ae=(0,ab.createServerReference)("40d4c680d37cb1cb4ee270a2998732f3c9499b4353",ab.callServer,void 0,ab.findSourceMapURL,"deleteProject"),af=(0,ab.createServerReference)("404a26b12f97eb642cff398fad6213f8e31d8b4a74",ab.callServer,void 0,ab.findSourceMapURL,"getRecentLocalProjects"),ag=(0,ab.createServerReference)("40d9088d9202c36bc28ef6f9278e20b3603bf9c709",ab.callServer,void 0,ab.findSourceMapURL,"getOrCreateTowerTaskId");var ah=a.i(144806),ai=a.i(155912),aj=a.i(510413),ak=a.i(273468),al=a.i(952313),am=a.i(43775),an=a.i(487410);function ao({commits:a}){let{t:d}=(0,i.useI18n)(),[e,f]=(0,c.useState)(!1);return 0===a.length?null:(0,b.jsxs)("div",{className:"border-b border-border",children:[(0,b.jsxs)("button",{onClick:()=>f(!e),className:"flex w-full items-center gap-1 px-2 py-1.5 hover:bg-accent/50 transition-colors",children:[e?(0,b.jsx)(Q.ChevronDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,b.jsx)(R.ChevronRight,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[d("git.commitLog")," (",a.length,")"]})]}),e&&(0,b.jsx)("div",{className:"mt-0.5 mb-1.5 space-y-0.5 max-h-64 overflow-y-auto",children:a.map(a=>(0,b.jsxs)("div",{className:"group flex items-start gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,b.jsx)(U,{className:"h-3 w-3 shrink-0 text-muted-foreground mt-0.5"}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("p",{className:"text-xs text-foreground line-clamp-1",children:a.message}),(0,b.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,b.jsxs)("button",{onClick:()=>{navigator.clipboard.writeText(a.shortHash),al.toast.success(`Copied ${a.shortHash}`)},className:"flex items-center gap-0.5 font-mono text-[10px] text-primary/70 hover:text-primary transition-colors",children:[a.shortHash,(0,b.jsx)(_.Copy,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:a.author}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(a){let b=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(b<1)return"just now";if(b<60)return`${b}m`;let c=Math.floor(b/60);if(c<24)return`${c}h`;let d=Math.floor(c/24);return d<30?`${d}d`:`${Math.floor(d/30)}mo`}(a.date)})]})]})]},a.hash))})]})}var ap=a.i(607219),aq=a.i(324263),ar=a.i(7285);function as({localPath:a,stashes:d,hasChanges:e,onRefresh:f}){let{t:g}=(0,i.useI18n)(),[h,j]=(0,c.useState)(!1),[k,l]=(0,c.useState)(!1),[m,n]=(0,c.useState)(""),[q,r]=(0,c.useState)(null),s=async()=>{l(!0);try{await (0,ar.gitAction)(a,"stash-save",{message:m}),n(""),al.toast.success(g("git.stashSaved")),await f()}catch(a){al.toast.error(a instanceof Error?a.message:String(a))}finally{l(!1)}},t=async b=>{r(b);try{await (0,ar.gitAction)(a,"stash-pop",{index:b}),al.toast.success(g("git.stashApplied")),await f()}catch(a){al.toast.error(a instanceof Error?a.message:String(a))}finally{r(null)}},u=async b=>{r(b);try{await (0,ar.gitAction)(a,"stash-drop",{index:b}),al.toast.success(g("git.stashDropped")),await f()}catch(a){al.toast.error(a instanceof Error?a.message:String(a))}finally{r(null)}};return e||0!==d.length?(0,b.jsxs)("div",{className:"border-b border-border",children:[(0,b.jsxs)("button",{onClick:()=>j(!h),className:"flex w-full items-center gap-1 px-2 py-1.5 hover:bg-accent/50 transition-colors",children:[h?(0,b.jsx)(Q.ChevronDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,b.jsx)(R.ChevronRight,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[g("git.stash")," ",d.length>0&&`(${d.length})`]})]}),h&&(0,b.jsxs)("div",{className:"mt-0.5 mb-1.5 space-y-2",children:[e&&(0,b.jsxs)("div",{className:"flex gap-1.5",children:[(0,b.jsx)(p.Input,{value:m,onChange:a=>n(a.target.value),placeholder:g("git.stashMsgPlaceholder"),className:"h-7 text-xs flex-1",onKeyDown:a=>"Enter"===a.key&&s()}),(0,b.jsx)(o.Button,{variant:"outline",size:"icon-sm",onClick:s,disabled:k,className:"shrink-0",children:k?(0,b.jsx)(W.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(ap.Archive,{className:"h-3 w-3"})})]}),d.length>0&&(0,b.jsx)("div",{className:"space-y-0.5",children:d.map(a=>(0,b.jsxs)("div",{className:"group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,b.jsx)(ap.Archive,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"flex-1 min-w-0 truncate text-xs text-foreground",children:a.message||`stash@{${a.index}}`}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>t(a.index),disabled:q===a.index,className:"text-muted-foreground","aria-label":g("git.stashApply"),children:q===a.index?(0,b.jsx)(W.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aq.ArrowUpFromLine,{className:"h-3 w-3"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>u(a.index),disabled:q===a.index,className:"text-rose-400","aria-label":g("git.stashDrop"),children:(0,b.jsx)(C.Trash2,{className:"h-3 w-3"})})]})]},a.index))})]})]}):null}var at=a.i(985716);function au({value:a,ariaLabel:d}){let{t:e}=(0,i.useI18n)(),[f,g]=(0,c.useState)(!1),h=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(a);else{let b=document.createElement("textarea");b.value=a,document.body.appendChild(b),b.select(),document.execCommand("copy"),document.body.removeChild(b)}g(!0),al.toast.success(e("common.copied")),setTimeout(()=>g(!1),1500)}catch{al.toast.error(e("common.copyFailed"))}};return(0,b.jsxs)("div",{className:"flex items-center gap-1 rounded-md border border-border bg-muted/50 pl-3 pr-1 py-1.5",children:[(0,b.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",title:a,children:a}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",className:"shrink-0 text-muted-foreground","aria-label":d,onClick:h,children:f?(0,b.jsx)(t.Check,{className:"h-3 w-3 text-emerald-400"}):(0,b.jsx)(_.Copy,{className:"h-3 w-3"})})}),(0,b.jsx)(F.TooltipContent,{children:f?e("common.copied"):e("common.copy")})]})]})}function av({project:a,workspaceId:e}){let{t:f,locale:g}=(0,i.useI18n)(),h=(0,d.useRouter)(),{width:j,isDragging:k,startResize:l}=function(a){let{storageKey:b,defaultWidth:d,minWidth:e,maxWidth:f,edge:g="left"}=a,[h,i]=(0,c.useState)(d),[j,k]=(0,c.useState)(!1),l=(0,c.useRef)(null);(0,c.useEffect)(()=>{try{let a=window.localStorage.getItem(b),c=null==a?NaN:Number(a);Number.isFinite(c)&&i(P(c,e,f))}catch{}},[b,e,f]);let m=(0,c.useCallback)(a=>{let b=l.current;b&&i(function(a,b,c,d,e,f="left"){return P(a+("left"===f?b-c:c-b),d,e)}(b.width,b.x,a.clientX,e,f,g))},[e,f,g]),n=(0,c.useCallback)(()=>{l.current&&(l.current=null,k(!1),window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",n),i(a=>{try{window.localStorage.setItem(b,String(a))}catch{}return a}))},[m,b]),o=(0,c.useCallback)(a=>{a.preventDefault(),l.current={x:a.clientX,width:h},k(!0),window.addEventListener("pointermove",m),window.addEventListener("pointerup",n)},[h,m,n]);return(0,c.useEffect)(()=>()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",n)},[m,n]),{width:h,isDragging:j,startResize:o}}({storageKey:"tower:repo-sidebar-width",defaultWidth:288,minWidth:240,maxWidth:560,edge:"left"}),[m,q]=(0,c.useState)(!0),[r,s]=(0,c.useState)(!0),[t,u]=(0,c.useState)(!1),[v,w]=(0,c.useState)(!1),[x,y]=(0,c.useState)(""),[z,A]=(0,c.useState)(!1),[D,E]=(0,c.useState)(!1),[G,H]=(0,c.useState)(!1),[I,K]=(0,c.useState)(a.name),[L,M]=(0,c.useState)(a.alias??""),[N,O]=(0,c.useState)(a.description??""),[_,ab]=(0,c.useState)(a.localPath??""),[ap,aq]=(0,c.useState)(a.projectType??"FRONTEND"),[ar,aw]=(0,c.useState)([]);(0,c.useEffect)(()=>{af(100).then(aw)},[]);let[ax,ay]=(0,c.useState)(!1),[az,aA]=(0,c.useState)(""),[aB,aC]=(0,c.useState)(""),[aD,aE]=(0,c.useState)(""),[aF,aG]=(0,c.useState)(""),[aH,aI]=(0,c.useState)("FRONTEND"),[aJ,aK]=(0,c.useState)(!1),[aL,aM]=(0,c.useState)(!1),[aN,aO]=(0,c.useState)(null),[aP,aQ]=(0,c.useState)(!1),[aR,aS]=(0,c.useState)(!1),aT=a=>{al.toast.info(a)},aU=(0,c.useCallback)(async()=>{if(a.localPath){aQ(!0);try{let b=await fetch(`/api/git?path=${encodeURIComponent(a.localPath)}`);b.ok&&aO(await b.json())}catch{}finally{aQ(!1)}}},[a.localPath]);(0,c.useEffect)(()=>{aU()},[aU]);let aV=async()=>{if(a.localPath){aS(!0);try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",path:a.localPath})})).ok?(aT(f("git.initSuccess")),await aU()):aT(f("git.initFailed"))}catch{aT(f("git.initFailed"))}finally{aS(!1)}}},aW=(a,b)=>{h.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1}),h.refresh()},aX=async()=>{if(aB.trim()){aK(!0);try{let a=await (0,ad.createProject)({name:aB.trim(),alias:aD.trim()||void 0,description:aF.trim()||void 0,localPath:az,projectType:aH,workspaceId:e});ay(!1),aW(e,a.id)}catch(a){al.toast.error(a instanceof Error?a.message:String(a))}finally{aK(!1)}}},aY=async()=>{if(_&&!aL){aM(!0);try{let a=await (0,ak.analyzeProjectDirectory)(_.trim(),g);O(a)}catch{al.toast.error(f("project.analyzeError"))}finally{aM(!1)}}},aZ=async()=>{try{await ac(a.id,{name:I.trim(),alias:L.trim()||void 0,description:N.trim()||void 0,localPath:_.trim()||void 0,projectType:ap}),h.refresh(),u(!1)}catch(a){al.toast.error(a instanceof Error?a.message:String(a))}};return(0,b.jsxs)("aside",{className:"relative flex-shrink-0 border-l border-border bg-sidebar",style:{width:j},children:[(0,b.jsx)("div",{onPointerDown:l,className:`absolute left-0 top-0 z-20 h-full w-1 -translate-x-1/2 cursor-col-resize transition-colors hover:bg-primary/20 ${k?"bg-primary/40":"bg-transparent"}`,role:"separator","aria-orientation":"vertical","aria-label":f("sidebar.right.resize")}),(0,b.jsxs)("div",{className:"h-full overflow-y-auto",children:[(0,b.jsxs)("div",{className:"border-b border-border p-4",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("h2",{className:"text-base font-semibold text-foreground",children:a.name}),a.alias&&(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:a.alias})]}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{K(a.name),M(a.alias??""),O(a.description??""),ab(a.localPath??""),u(!0)},className:"text-muted-foreground",children:(0,b.jsx)(B.Pencil,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{y(""),w(!0)},className:"text-muted-foreground hover:text-rose-400",children:(0,b.jsx)(C.Trash2,{className:"h-3.5 w-3.5"})})]})]}),a.description&&(0,b.jsx)("p",{className:"mt-2 text-sm text-secondary-foreground leading-relaxed line-clamp-4",children:a.description}),(0,b.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:(0,b.jsx)("span",{className:`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium ${"GIT"===a.type?"bg-sky-500/15 text-sky-300 ring-1 ring-sky-500/20":"bg-muted text-muted-foreground ring-1 ring-border"}`,children:"GIT"===a.type?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.GitBranch,{className:"h-3 w-3"}),f("sidebar.right.gitType")]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S.FileText,{className:"h-3 w-3"}),f("sidebar.right.normalType")]})})}),a.gitUrl&&(0,b.jsx)("div",{className:"mt-3 space-y-1.5",children:(0,b.jsx)(au,{value:a.gitUrl,ariaLabel:f("project.gitUrl")})}),a.localPath&&(0,b.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,ah.openInFileManager)(a.localPath)}catch(a){console.error("openInFileManager failed:",a),al.toast.error(f("git.openInFileManagerFailed"))}},children:(0,b.jsx)(Y.FolderSearch,{className:"h-4 w-4"})})}),(0,b.jsx)(F.TooltipContent,{children:f("git.openInFileManager")})]}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,ai.openInEditor)(a.localPath)}catch(a){console.error("openInEditor failed:",a),al.toast.error(f("git.openInEditorFailed"))}},children:(0,b.jsx)(Z.Code,{className:"h-4 w-4"})})}),(0,b.jsx)(F.TooltipContent,{children:f("git.openInEditor")})]}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,aj.openInTerminal)(a.localPath)}catch(a){console.error("openInTerminal failed:",a),al.toast.error(f("git.openInTerminalFailed"))}},children:(0,b.jsx)($.Terminal,{className:"h-4 w-4"})})}),(0,b.jsx)(F.TooltipContent,{children:f("git.openInTerminal")})]})]}),(0,b.jsxs)(o.Button,{variant:"outline",className:"w-full h-9 gap-1.5 text-xs",disabled:D,onClick:async()=>{E(!0);try{let b=await ag(a.id);h.push(`/workspaces/${e}/tasks/${b}`)}catch{al.toast.error(f("git.openStudioFailed"))}finally{E(!1)}},children:[D?(0,b.jsx)(W.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,b.jsx)(T.FolderOpen,{className:"h-3.5 w-3.5"}),f("git.openStudio")]})]})]}),(0,b.jsxs)("div",{className:"border-b border-border p-4",children:[(0,b.jsxs)(o.Button,{variant:"ghost",onClick:()=>q(!m),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,b.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:f("git.section")}),m?(0,b.jsx)(Q.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,b.jsx)(R.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),m&&(0,b.jsx)("div",{className:"mt-3",children:a.localPath?aP?(0,b.jsxs)("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:[(0,b.jsx)(W.Loader2,{className:"h-4 w-4 animate-spin"}),(0,b.jsx)("span",{className:"ml-2 text-xs",children:f("git.loading")})]}):aN&&!aN.isGit?(0,b.jsxs)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,b.jsx)(V.AlertCircle,{className:"h-3.5 w-3.5"}),(0,b.jsx)("p",{className:"text-xs",children:f("git.notInitialized")})]}),(0,b.jsxs)(o.Button,{className:"mt-3 h-7 w-full gap-1.5 bg-primary/10 text-xs text-primary ring-1 ring-primary/20 hover:bg-primary/15",onClick:aV,disabled:aR,children:[aR?(0,b.jsx)(W.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(U,{className:"h-3 w-3"}),f("git.initRepo")]})]}):aN?.isGit?(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"flex flex-col",children:(0,b.jsx)(at.EditorGitPanel,{localPath:a.localPath,mode:"project"})}),(0,b.jsx)(ao,{commits:aN.commits??[]}),(0,b.jsx)(as,{localPath:a.localPath,stashes:aN.stashes??[],hasChanges:(aN.changedFiles??[]).length>0,onRefresh:aU})]}):null:(0,b.jsx)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:(0,b.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,b.jsx)(V.AlertCircle,{className:"h-3.5 w-3.5"}),(0,b.jsx)("p",{className:"text-xs",children:f("git.noLocalPath")})]})})})]}),(0,b.jsxs)("div",{className:"p-4",children:[(0,b.jsxs)(o.Button,{variant:"ghost",onClick:()=>s(!r),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,b.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:f("sidebar.right.browseRepo")}),r?(0,b.jsx)(Q.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,b.jsx)(R.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),r&&(0,b.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,b.jsxs)(o.Button,{variant:"outline",className:"w-full h-8 gap-1.5 text-xs",onClick:()=>H(!0),children:[(0,b.jsx)(T.FolderOpen,{className:"h-3.5 w-3.5"}),f("sidebar.right.browseRepo")]}),ar.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5 px-1",children:f("sidebar.right.recent")}),(0,b.jsx)("div",{className:"space-y-0.5",children:ar.map(c=>(0,b.jsxs)("button",{onClick:()=>{c.id!==a.id&&aW(c.workspaceId,c.id)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors ${c.id===a.id?"bg-primary/10 text-primary cursor-default":"hover:bg-accent cursor-pointer"}`,children:["GIT"===c.type?(0,b.jsx)(n.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,b.jsx)(T.FolderOpen,{className:"h-3 w-3 shrink-0 text-primary/70"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsx)("p",{className:"truncate text-xs font-medium text-foreground",children:c.name}),c.localPath&&(0,b.jsx)("p",{className:"truncate text-[10px] font-mono text-muted-foreground",children:c.localPath})]})]},c.id))})]})]})]})]}),(0,b.jsx)(J.Dialog,{open:t,onOpenChange:u,children:(0,b.jsxs)(J.DialogContent,{style:{maxWidth:"32rem"},children:[(0,b.jsx)(J.DialogHeader,{children:(0,b.jsx)(J.DialogTitle,{children:f("project.edit")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(p.Input,{value:I,onChange:a=>K(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.type.label")}),(0,b.jsx)("div",{className:"mt-1.5",children:(0,b.jsx)(an.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:ap,onChange:aq})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(p.Input,{value:L,onChange:a=>M(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsxs)(o.Button,{type:"button",variant:"ghost",onClick:aY,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!_||aL?"opacity-50":""}`,children:[aL?(0,b.jsx)(W.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(X.Sparkles,{className:"h-3 w-3"}),aL?f("project.analyzing"):f("project.genDesc")]})]}),(0,b.jsx)(aa.Textarea,{value:N,onChange:a=>O(a.target.value),rows:2,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none max-h-[200px] overflow-y-auto"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.jsx)("div",{className:"mt-1.5 break-all rounded-md border border-border bg-muted/50 px-3 py-2 font-mono text-xs text-muted-foreground",children:_||"—"})]})]}),(0,b.jsxs)(J.DialogFooter,{children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>u(!1),children:f("common.cancel")}),(0,b.jsx)(o.Button,{onClick:aZ,disabled:!I.trim()||aL,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:f("common.save")})]})]})}),(0,b.jsx)(am.FolderBrowserDialog,{open:G,onOpenChange:H,onSelect:a=>{t?ab(a):(a=>{let b=ar.find(b=>b.localPath===a);if(b)return aW(b.workspaceId,b.id);let c=a.split("/").filter(Boolean).pop()??"";aA(a),aC(c),aE(""),aG(""),ay(!0)})(a)}}),(0,b.jsx)(J.Dialog,{open:ax,onOpenChange:ay,children:(0,b.jsxs)(J.DialogContent,{className:"sm:max-w-md",children:[(0,b.jsx)(J.DialogHeader,{children:(0,b.jsx)(J.DialogTitle,{children:f("topbar.newProject")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.jsx)("div",{className:"mt-1.5 rounded-md border border-border bg-muted/50 px-3 py-2 font-mono text-xs text-muted-foreground",children:az})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(p.Input,{value:aB,onChange:a=>aC(a.target.value),placeholder:f("project.namePlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.type.label")}),(0,b.jsx)("div",{className:"mt-1.5",children:(0,b.jsx)(an.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:aH,onChange:aI})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(p.Input,{value:aD,onChange:a=>aE(a.target.value),placeholder:f("project.aliasPlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsx)(aa.Textarea,{value:aF,onChange:a=>aG(a.target.value),placeholder:f("project.descPlaceholder"),rows:2,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none"})]})]}),(0,b.jsxs)(J.DialogFooter,{children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>ay(!1),children:f("common.cancel")}),(0,b.jsxs)(o.Button,{onClick:aX,disabled:!aB.trim()||aJ,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[aJ?(0,b.jsx)(W.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,f("common.create")]})]})]})}),(0,b.jsx)(J.Dialog,{open:v,onOpenChange:a=>{w(a),a||y("")},children:(0,b.jsxs)(J.DialogContent,{className:"sm:max-w-md",children:[(0,b.jsx)(J.DialogHeader,{children:(0,b.jsx)(J.DialogTitle,{className:"text-rose-400",children:f("project.deleteTitle")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:f("project.deleteWarning",{name:a.name})}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:f("project.deleteIrreversible")}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.deleteConfirmLabel")}),(0,b.jsx)(p.Input,{value:x,onChange:a=>y(a.target.value),placeholder:f("project.deleteConfirmPlaceholder"),className:"mt-1.5",autoFocus:!0})]})]}),(0,b.jsxs)(J.DialogFooter,{children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>w(!1),children:f("common.cancel")}),(0,b.jsxs)(o.Button,{variant:"destructive",disabled:x!==f("project.deleteConfirmText")||z,onClick:async()=>{A(!0);try{await ae(a.id),al.toast.success(f("project.deleteSuccess")),h.push(`/workspaces/${e}`)}catch{al.toast.error(f("project.deleteFailed"))}finally{A(!1),w(!1)}},children:[z&&(0,b.jsx)(W.Loader2,{className:"h-3 w-3 animate-spin mr-1"}),f("project.deleteButton")]})]})]})})]})}var aw=a.i(963326),ax=a.i(300141),ay=a.i(913284),az=a.i(269280),aA=a.i(368114);function aB({title:a,description:c,branch:d,baseBranch:e,version:f,hasConversation:g,updatedAt:h,openDir:j,onBack:k}){let{t:l}=(0,i.useI18n)();return(0,b.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(X.Sparkles,{className:"h-3.5 w-3.5 text-primary"}),(0,b.jsx)("span",{className:"text-xs font-semibold text-primary",children:l("taskDetail.title")})]}),(0,b.jsxs)(o.Button,{variant:"ghost",onClick:k,className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground h-auto px-2 py-1",children:[(0,b.jsx)(az.ArrowLeft,{className:"h-3.5 w-3.5"}),l("taskDetail.back")]})]}),(0,b.jsx)("h2",{className:"mt-2.5 text-lg font-bold tracking-tight text-foreground",children:a}),c&&(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:c}),(0,b.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e?(0,b.jsxs)(E.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:[(0,b.jsx)(n.GitBranch,{className:"mr-1 h-3 w-3"}),e," · worktree"]}):d?(0,b.jsx)(E.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:l("taskDetail.directMode")}):null,f&&(0,b.jsx)(H.TaskVersionTag,{number:f.number,name:f.name,showName:!0}),g&&(0,b.jsx)(E.Badge,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-400 text-[10px] border border-emerald-500/20",children:l("taskDetail.hasConversation")}),(0,b.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[l("taskDetail.updatedAt")," ",(0,aA.formatRelativeTime)(h)]}),j&&(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-0.5",children:[(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,ah.openInFileManager)(j)}catch(a){console.error("openInFileManager failed:",a),al.toast.error(l("git.openInFileManagerFailed"))}},children:(0,b.jsx)(Y.FolderSearch,{className:"h-3.5 w-3.5"})})}),(0,b.jsx)(F.TooltipContent,{side:"bottom",children:l("git.openInFileManager")})]}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,ai.openInEditor)(j)}catch(a){console.error("openInEditor failed:",a),al.toast.error(l("git.openInEditorFailed"))}},children:(0,b.jsx)(Z.Code,{className:"h-3.5 w-3.5"})})}),(0,b.jsx)(F.TooltipContent,{side:"bottom",children:l("git.openInEditor")})]}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,aj.openInTerminal)(j)}catch(a){console.error("openInTerminal failed:",a),al.toast.error(l("git.openInTerminalFailed"))}},children:(0,b.jsx)($.Terminal,{className:"h-3.5 w-3.5"})})}),(0,b.jsx)(F.TooltipContent,{side:"bottom",children:l("git.openInTerminal")})]})]})]})]})}var aC=a.i(639138),aD=a.i(88757),aE=a.i(347872),aF=a.i(10307),aG=a.i(133378),aH=a.i(589729),aI=a.i(841785),aJ=a.i(262427),aK=a.i(244843),aL=a.i(398194),aM=a.i(817823),aN=a.i(300585),aO=a.i(715525),aP=a.i(324954);let aQ=(0,e.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);var aR=a.i(54384),aS=a.i(509405),aT=a.i(458407);let aU=(0,ab.createServerReference)("407904b2f898c265e2f0fb28111275c650c9541492",ab.callServer,void 0,ab.findSourceMapURL,"getTaskNotes");var aV=a.i(689788);let aW=(0,ab.createServerReference)("400f9b8c66d445e99f9083c508d85d30b190d703e8",ab.callServer,void 0,ab.findSourceMapURL,"getTaskAssets");var aX=a.i(693275),aY=a.i(880571),aZ=a.i(532615),a$=a.i(894148);a.i(757942);var a_=a.i(950314);function a0({note:a,open:c,onOpenChange:d}){let{t:e}=(0,i.useI18n)();return(0,b.jsx)(J.Dialog,{open:c,onOpenChange:d,children:(0,b.jsxs)(J.DialogContent,{className:"w-[min(960px,92vw)] max-w-none sm:max-w-none h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0",children:[(0,b.jsx)("h3",{className:"text-sm font-medium truncate px-5 py-3 border-b border-border/50",children:a?.title}),(0,b.jsx)("div",{className:"flex-1 overflow-auto px-5 py-4",children:a&&a.content.trim()?(0,b.jsx)("div",{className:"text-sm leading-relaxed",children:(0,b.jsx)(a_.Streamdown,{children:a.content})}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:e("taskPage.noteEmpty")})})]})})}var a1=a.i(161181);let a2=/\.(txt|md|json)$/i;function a3({taskId:a,projectId:d}){let{t:e}=(0,i.useI18n)(),f=(0,c.useRef)(null),[g,h]=(0,c.useState)([]),[j,k]=(0,c.useState)([]),[m,n]=(0,c.useState)(!1),[p,q]=(0,c.useState)(""),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(!1),[v,w]=(0,c.useState)(null),[x,y]=(0,c.useState)(null);async function z(){p.trim()&&(await (0,aT.createNote)({title:p.trim(),content:r.trim(),projectId:d,taskId:a,category:"task"}),q(""),s(""),n(!1),aU(a).then(h))}async function A(a){await (0,aV.deleteNote)(a),h(b=>b.filter(b=>b.id!==a))}async function B(b){let c=b.target.files?.[0];if(c){u(!0);try{let b=new FormData;b.set("file",c),b.set("projectId",d),b.set("taskId",a),await (0,aX.uploadAsset)(b),aW(a).then(k)}finally{u(!1),f.current&&(f.current.value="")}}}async function D(a){await (0,aY.deleteAsset)(a),k(b=>b.filter(b=>b.id!==a))}function E(a){return(0,a1.isImageAsset)(a.filename,a.mimeType)||a2.test(a.filename)}function F(a){E(a)?w(a):al.toast.info(e("assets.previewNotSupported"))}async function G(a){try{let b=await fetch("/api/internal/assets/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a.path})});if(!b.ok){let a=await b.json().catch(()=>({}));al.toast.error(a.error||"Failed to reveal file")}}catch{al.toast.error("Failed to reveal file")}}(0,c.useEffect)(()=>{aU(a).then(h),aW(a).then(k)},[a]);let H=v?(0,a1.isImageAsset)(v.filename,v.mimeType)?"image":a2.test(v.filename)?"text":null:null,I=j.filter(a=>(0,a1.isImageAsset)(a.filename,a.mimeType)).map(a=>({id:a.id,url:(0,a1.localPathToApiUrl)(a.path),filename:a.filename})),J=v?I.findIndex(a=>a.id===v.id):-1;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(K.ScrollArea,{className:"h-full",children:(0,b.jsxs)("div",{className:"flex flex-col",children:[(0,b.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,b.jsx)(S.FileText,{className:"h-3.5 w-3.5"}),e("taskPage.notes")]}),(0,b.jsxs)(o.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>n(!m),children:[m?(0,b.jsx)(aR.X,{className:"h-3 w-3"}):(0,b.jsx)(l.Plus,{className:"h-3 w-3"}),m?"":e("taskPage.addNote")]})]}),m&&(0,b.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,b.jsx)("input",{type:"text",value:p,onChange:a=>q(a.target.value),placeholder:e("taskPage.noteTitle"),className:"h-8 w-full rounded-md border border-border bg-background px-3 text-sm focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),(0,b.jsx)("textarea",{value:r,onChange:a=>s(a.target.value),placeholder:e("taskPage.noteContent"),rows:3,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-primary resize-none"}),(0,b.jsx)(o.Button,{className:"text-xs",onClick:z,disabled:!p.trim(),children:e("taskPage.addNote")})]}),(0,b.jsxs)("div",{className:"mt-2 space-y-2",children:[0===g.length&&!m&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:e("taskPage.noNotes")}),g.map(a=>(0,b.jsx)("div",{className:"group rounded-md border border-border bg-card p-3",children:(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>y(a),className:"min-w-0 flex-1 cursor-pointer text-left",title:e("taskPage.previewNote"),children:[(0,b.jsx)("h4",{className:"text-sm font-medium truncate hover:underline",children:a.title}),a.content&&(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-3 whitespace-pre-wrap",children:a.content}),(0,b.jsx)("p",{className:"mt-1 text-[10px] text-muted-foreground",children:new Date(a.createdAt).toLocaleString()})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>y(a),className:"text-muted-foreground hover:bg-accent",title:e("taskPage.previewNote"),children:(0,b.jsx)(aS.Eye,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>A(a.id),className:"text-muted-foreground hover:bg-destructive/10 hover:text-destructive",title:e("taskPage.deleteNote"),children:(0,b.jsx)(C.Trash2,{className:"h-3.5 w-3.5"})})]})]})},a.id))]})]}),(0,b.jsxs)("div",{className:"px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,b.jsx)(aQ,{className:"h-3.5 w-3.5"}),e("taskPage.attachments")]}),(0,b.jsxs)(o.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>f.current?.click(),disabled:t,children:[(0,b.jsx)(aP.Upload,{className:"h-3 w-3"}),e("taskPage.uploadFile")]}),(0,b.jsx)("input",{ref:f,type:"file",className:"hidden",onChange:B})]}),(0,b.jsxs)("div",{className:"mt-2 space-y-1.5",children:[0===j.length&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:e("taskPage.noAttachments")}),j.map(a=>{var c;let d=E(a);return(0,b.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border bg-card px-3 py-2",children:[(0,b.jsx)(aQ,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,b.jsx)("button",{type:"button",onClick:()=>F(a),disabled:!d,className:`min-w-0 flex-1 truncate text-left text-sm ${d?"cursor-pointer hover:underline":"cursor-default"}`,title:d?e("assets.preview"):a.filename,children:a.filename}),(0,b.jsx)("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:(c=a.size)?c<1024?`${c} B`:c<1048576?`${(c/1024).toFixed(1)} KB`:`${(c/1024/1024).toFixed(1)} MB`:""}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[d&&(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>F(a),className:"shrink-0 text-muted-foreground hover:bg-accent",title:e("assets.preview"),children:(0,b.jsx)(aS.Eye,{className:"h-3 w-3"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>G(a),className:"shrink-0 text-muted-foreground hover:bg-accent",title:e("assets.revealInFinder"),children:(0,b.jsx)(T.FolderOpen,{className:"h-3 w-3"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>D(a.id),className:"shrink-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",title:e("taskPage.deleteAttachment"),children:(0,b.jsx)(C.Trash2,{className:"h-3 w-3"})})]})]},a.id)})]})]})]})}),(0,b.jsx)(aZ.ImageLightbox,{imageUrl:"image"===H&&J>=0?I[J].url:null,filename:"image"===H&&J>=0?I[J].filename:"",open:"image"===H,onOpenChange:a=>{a||w(null)},assets:I.map(({url:a,filename:b})=>({url:a,filename:b})),currentIndex:J>=0?J:void 0,onIndexChange:a=>{let b=I[a];if(!b)return;let c=j.find(a=>a.id===b.id);c&&w(c)}}),(0,b.jsx)(a$.TextPreviewDialog,{url:"text"===H&&v?(0,a1.localPathToApiUrl)(v.path):null,filename:v?.filename??"",open:"text"===H,onOpenChange:a=>{a||w(null)}}),(0,b.jsx)(a0,{note:x,open:null!==x,onOpenChange:a=>{a||y(null)}})]})}function a4({task:a,workspaceId:e,projectLocalPath:f,onClose:g}){let{t:h}=(0,i.useI18n)(),j=(0,d.useRouter)(),{removePortal:k}=(0,aE.useTerminalPortal)(),[l,m]=(0,c.useState)("terminal"),[n,p]=(0,c.useState)(null),[r,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)(a.status);(0,c.useEffect)(()=>{u(a.status)},[a.status]);let[v,w]=(0,c.useState)(null),[x,y]=(0,c.useState)(!1),[z,A]=(0,c.useState)(!1),[B,C]=(0,c.useState)([]);(0,c.useEffect)(()=>{w(null),y(!1),A(!1),C([]),p(null),m("terminal")},[a.id]);let[D,E]=(0,c.useState)([]),[G,H]=(0,c.useState)(null);(0,c.useEffect)(()=>{let a=!1;return(0,aN.getPrompts)().then(b=>{if(a)return;E(b.map(a=>({id:a.id,name:a.name,isDefault:a.isDefault})));let c=b.find(a=>a.isDefault);c&&H(c.id)}),()=>{a=!0}},[]),(0,c.useEffect)(()=>{w(null),A(!1);let b=!1;return(0,aF.getTaskExecutions)(a.id).then(a=>{if(b)return;let c=a[0];if(c?.status==="RUNNING"){let a=c.worktreePath||f||null;a&&w(a)}C(a.filter(a=>"RUNNING"!==a.status)),A(!0)}),()=>{b=!0}},[a.id]),(0,c.useEffect)(()=>{if("changes"!==l||"TODO"===t||"CANCELLED"===t)return;let b=!1;return s(!0),fetch(`/api/tasks/${a.id}/diff`).then(a=>{if(!a.ok)throw Error(`HTTP ${a.status}`);return a.json()}).then(a=>{b||p(a?.files||a?.branchDeleted?a:null)}).catch(()=>{b||p(null)}).finally(()=>{b||s(!1)}),()=>{b=!0}},[l,t,a.id]);let I=(0,c.useCallback)(async()=>{if(!x){y(!0),k(a.id);try{let b=await (0,aG.startPtyExecutionSafe)(a.id,"",G);if(!b.ok){y(!1),al.toast.error(b.error||h("terminal.startFailed"));return}w(b.worktreePath??null),u("IN_PROGRESS")}catch(a){y(!1),al.toast.error(a instanceof Error&&a.message?a.message:h("terminal.startFailed"))}}},[a.id,x,G,h]),J=(0,c.useCallback)(b=>{y(!1),w(null),k(a.id),0===b&&u("IN_REVIEW"),(0,aF.getTaskExecutions)(a.id).then(a=>{C(a.filter(a=>"RUNNING"!==a.status))}),j.refresh()},[j,a.id]),L=(0,c.useCallback)(async()=>{await (0,aH.stopPtyExecution)(a.id),y(!1),k(a.id),w(null),u("IN_REVIEW"),(0,aF.getTaskExecutions)(a.id).then(a=>{C(a.filter(a=>"RUNNING"!==a.status))}),j.refresh()},[a.id,j]),M=(0,c.useCallback)(async b=>{y(!0),k(a.id),w(null);try{let{worktreePath:c}=await (0,aI.resumePtyExecution)(a.id,b);w(c),u("IN_PROGRESS")}catch{y(!1)}},[a.id,k]),N=(0,c.useCallback)(async()=>{y(!0),k(a.id),w(null);try{let{worktreePath:b}=await (0,aJ.continueLatestPtyExecution)(a.id);w(b),u("IN_PROGRESS")}catch(a){y(!1),al.toast.error(a instanceof Error?a.message:String(a))}},[a.id,k]),[O,P]=(0,c.useState)(!1),[Q,R]=(0,c.useState)([]),T=(0,c.useCallback)(async()=>{try{let b=await (0,aL.checkWorktreeClean)(a.id);if(b.hasWorktree&&!b.clean)return void al.toast.error(h("taskPage.uncommittedChanges",{count:String(b.files.length)}));if(b.hasWorktree&&b.clean&&!b.hasCommits)return void al.toast.error(h("taskPage.noChangesToComplete"),{action:{label:h("taskPage.markAsCancelled"),onClick:()=>{(0,aK.updateTaskStatus)(a.id,"CANCELLED").then(()=>{u("CANCELLED"),al.toast.success(h("taskPage.taskCancelled")),j.refresh()}).catch(()=>al.toast.error("Failed to cancel task"))}}});if(b.hasWorktree&&b.hasCommits){R(b.commitLog),P(!0);return}await (0,aK.updateTaskStatus)(a.id,"DONE"),u("DONE"),al.toast.success(h("taskPage.taskCompleted")),j.refresh()}catch{al.toast.error("Failed to complete task")}},[a.id,j,h]),U=(0,c.useCallback)(()=>{u("DONE"),P(!1),al.toast.success(h("taskPage.taskCompleted")),j.refresh()},[j,h]),V=(0,c.useCallback)(async b=>{try{let{hash:c}=await (0,aM.commitWorktreeChanges)(a.id,b);al.toast.success(h("diff.commitSuccess",{hash:c})),j.refresh();let d=await fetch(`/api/tasks/${a.id}/diff`);if(d.ok){let a=await d.json();p(a?.files?a:null)}}catch(a){al.toast.error(a instanceof Error?a.message:"Commit failed")}},[a.id,j,h]);return(0,b.jsxs)("div",{className:"flex h-full w-[600px] flex-shrink-0 flex-col border-l border-border bg-sidebar","data-testid":"task-detail-panel",children:[(0,b.jsx)(aB,{title:a.title,description:h("taskDetail.panelDescription"),branch:`task/${a.id}`,baseBranch:a.baseBranch,version:a.version??null,hasConversation:!1,updatedAt:a.updatedAt,openDir:v??(f?a.subPath?`${f}/${a.subPath}`:f:null),onBack:g}),(0,b.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-2",children:[(0,b.jsxs)("div",{className:"flex gap-1",children:[(0,b.jsxs)("button",{onClick:()=>m("terminal"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"terminal"===l?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,b.jsx)($.Terminal,{className:"h-3 w-3"}),h("terminal.execute")]}),(0,b.jsx)("button",{onClick:()=>m("changes"),className:`px-3 py-1 text-xs font-medium rounded-md ${"changes"===l?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:h("taskPage.changes")}),(0,b.jsxs)("button",{onClick:()=>m("notes"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"notes"===l?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,b.jsx)(S.FileText,{className:"h-3 w-3"}),h("taskPage.notes")]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:["IN_REVIEW"===t&&(0,b.jsxs)(o.Button,{size:"sm",onClick:T,className:"bg-emerald-500/15 text-emerald-400 ring-1 ring-emerald-500/20 hover:bg-emerald-500/25",children:[(0,b.jsx)(ay.CheckCircle2,{className:"h-3 w-3"}),h("taskPage.completeTask")]}),"DONE"!==t&&"CANCELLED"!==t&&(0,b.jsxs)(o.Button,{variant:"ghost",size:"sm",onClick:()=>j.push(`/workspaces/${e}/tasks/${a.id}`),className:"text-muted-foreground",children:[(0,b.jsx)(aw.ExternalLink,{className:"h-3 w-3"}),h("taskPage.viewDetails")]})]})]}),"terminal"===l?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:z?v?(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsxs)("div",{className:"shrink-0 flex items-center justify-between border-b border-neutral-800 px-3 py-2 bg-[#0f1419]",children:[(0,b.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-emerald-400",children:[(0,b.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"}),h("execution.running")]}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsxs)(F.TooltipTrigger,{onClick:L,className:"flex items-center gap-1.5 rounded-md bg-red-500/15 px-3 py-1 text-xs font-medium text-red-400 hover:bg-red-500/25 transition-colors",children:[(0,b.jsx)(ax.Square,{className:"h-3 w-3"}),h("terminal.stopExecution")]}),(0,b.jsx)(F.TooltipContent,{side:"bottom",children:h("terminal.stopHint")})]})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0",children:(0,b.jsx)(aE.TerminalOutlet,{taskId:a.id,worktreePath:v,onSessionEnd:J})})]}):"DONE"===t||"CANCELLED"===t?(0,b.jsx)("div",{className:"flex h-full flex-col overflow-hidden",children:(0,b.jsx)(K.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)(aO.ExecutionTimeline,{executions:B})})}):(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsxs)("div",{className:"shrink-0 flex items-center gap-2 border-b border-border px-4 py-3",children:[D.length>0&&(0,b.jsxs)(q.Select,{defaultValue:G??"none",onValueChange:a=>H("none"===a?null:a),children:[(0,b.jsx)(q.SelectTrigger,{size:"sm",className:"min-w-[120px]",children:(0,b.jsx)("span",{className:"text-left truncate",children:G?D.find(a=>a.id===G)?.name??h("terminal.noPrompt"):h("terminal.noPrompt")})}),(0,b.jsxs)(q.SelectContent,{className:"min-w-[200px]",children:[(0,b.jsx)(q.SelectItem,{value:"none",children:h("terminal.noPrompt")}),D.map(a=>(0,b.jsxs)(q.SelectItem,{value:a.id,children:[a.name,a.isDefault?" ★":""]},a.id))]})]},`prompt-${D.length}`),(0,b.jsxs)(o.Button,{onClick:I,disabled:x,size:"sm",className:"gap-2 px-4",children:[x?(0,b.jsx)(W.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,b.jsx)($.Terminal,{className:"h-3.5 w-3.5"}),x?h("terminal.executing"):h("terminal.launch")]})]}),(0,b.jsx)(K.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)(aO.ExecutionTimeline,{executions:B,onResume:M,onContinueLatest:N})})]}):(0,b.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-[#0f1419]",children:[(0,b.jsx)(W.Loader2,{className:"size-5 animate-spin text-neutral-500"}),(0,b.jsx)("span",{className:"text-xs text-neutral-500",children:h("execution.loading")})]})}):"changes"===l?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:r?(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.loadingDiff")})}):n?.branchDeleted?(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.branchDeleted")})}):n?(0,b.jsx)(aC.TaskDiffView,{taskId:a.id,files:n.files,totalAdded:n.totalAdded,totalRemoved:n.totalRemoved,hasConflicts:n.hasConflicts,conflictFiles:n.conflictFiles,onCommit:V,hasUncommitted:n.hasUncommitted}):(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.noChanges")})})}):"notes"===l?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,b.jsx)(a3,{taskId:a.id,projectId:a.projectId})}):null,(0,b.jsx)(aD.TaskMergeConfirmDialog,{open:O,onOpenChange:P,taskId:a.id,taskTitle:a.title,baseBranch:a.baseBranch??"main",fileCount:n?.files?.length??0,commitCount:n?.commitCount??0,commitLog:Q,onMergeComplete:U})]})}var a5=a.i(359132),a6=a.i(944438);let a7=(0,ab.createServerReference)("40984a6a27170b47de4b9bb024eb7c3d730a46499c",ab.callServer,void 0,ab.findSourceMapURL,"deleteTask"),a8=(0,ab.createServerReference)("40662fe4cab98eb6134a7af9874b81110f59fd1e16",ab.callServer,void 0,ab.findSourceMapURL,"toggleTaskPinned");var a9=a.i(633039);let ba=(0,ab.createServerReference)("40c43cd5ab1a4faa300122ffdd906a60964e8f2cdb",ab.callServer,void 0,ab.findSourceMapURL,"getVersionsForPicker");var bb=a.i(912868);function bc({projects:a,activeProjectId:d,onSelect:e}){let f=(0,c.useRef)(null),[g,h]=(0,c.useState)(!1),[i,j]=(0,c.useState)(!1),k=()=>{let a=f.current;a&&(h(a.scrollLeft>0),j(a.scrollLeft<a.scrollWidth-a.clientWidth-1))};(0,c.useEffect)(()=>{k();let a=f.current;if(a){a.addEventListener("scroll",k);let b=new ResizeObserver(k);return b.observe(a),()=>{a.removeEventListener("scroll",k),b.disconnect()}}},[a]);let l=a=>{let b=f.current;b&&b.scrollBy({left:"left"===a?-150:150,behavior:"smooth"})};return(0,b.jsxs)("div",{className:"relative flex items-center",children:[g&&(0,b.jsx)("button",{onClick:()=>l("left"),className:"absolute left-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,b.jsx)(bb.ChevronLeft,{className:"h-4 w-4"})}),(0,b.jsx)("div",{ref:f,className:"flex items-center gap-1.5 overflow-x-auto scrollbar-none px-1 py-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:a.map(a=>{let c=d===a.id;return(0,b.jsxs)("button",{onClick:()=>{c||e(a.id)},className:`shrink-0 rounded-lg border-b-2 px-4 py-2 text-sm font-medium transition-colors ${c?"border-primary bg-primary/10 text-primary ring-1 ring-primary/20 cursor-default":"border-transparent text-muted-foreground hover:bg-accent hover:text-foreground cursor-pointer"}`,children:[(0,b.jsx)("span",{children:a.name}),a.alias&&(0,b.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:a.alias})]},a.id)})}),i&&(0,b.jsx)("button",{onClick:()=>l("right"),className:"absolute right-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,b.jsx)(R.ChevronRight,{className:"h-4 w-4"})})]})}var bd=a.i(811344);function be({open:a,onOpenChange:c,taskTitle:d,uncommittedFiles:e,commitLog:f,onConfirm:g}){let{t:h}=(0,i.useI18n)(),j=e.length,k=f.length,l=0===j&&0===k;return(0,b.jsx)(J.Dialog,{open:a,onOpenChange:c,children:(0,b.jsxs)(J.DialogContent,{showCloseButton:!0,className:"sm:max-w-md",children:[(0,b.jsx)(J.DialogHeader,{children:(0,b.jsxs)(J.DialogTitle,{className:"flex items-center gap-2",children:[(0,b.jsx)(bd.AlertTriangle,{className:"h-4 w-4 text-amber-400"}),h("taskCancel.title")]})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{className:"rounded-lg border border-amber-500/20 bg-amber-500/10 p-3 space-y-1.5",children:[(0,b.jsx)("p",{className:"text-xs text-foreground",children:h("taskCancel.intro",{title:d})}),(0,b.jsx)("p",{className:"text-xs text-amber-300",children:h("taskCancel.irreversible")})]}),l?(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:h("taskCancel.cleanNotice")}):(0,b.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 p-3 space-y-2.5",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:h("taskCancel.uncommittedFiles")}),(0,b.jsx)("span",{className:"text-xs font-medium text-foreground",children:j})]}),(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:h("taskCancel.unmergedCommits")}),(0,b.jsx)("span",{className:"text-xs font-medium text-foreground",children:k})]})]}),j>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground mb-1 block",children:h("taskCancel.filesList")}),(0,b.jsx)("div",{className:"rounded-md border border-border bg-muted/30 p-2 space-y-1 max-h-32 overflow-y-auto",children:e.map((a,c)=>(0,b.jsx)("div",{className:"text-xs font-mono text-foreground/80",children:a},c))})]}),k>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground mb-1 block",children:h("taskCancel.commitsList")}),(0,b.jsx)("div",{className:"rounded-md border border-border bg-muted/30 p-2 space-y-1 max-h-32 overflow-y-auto",children:f.map((a,c)=>(0,b.jsx)("div",{className:"text-xs font-mono text-foreground/80",children:a},c))}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-1.5",children:h("taskCancel.reflogHint")})]})]}),(0,b.jsxs)(J.DialogFooter,{children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>c(!1),children:h("taskCancel.keep")}),(0,b.jsxs)(o.Button,{variant:"destructive",onClick:g,className:"gap-2",children:[(0,b.jsx)(bd.AlertTriangle,{className:"h-4 w-4"}),h("taskCancel.confirm")]})]})]})})}a.s(["BoardPageClient",0,function({workspaceId:a,projectId:e,project:f,projects:g,initialTasks:h,labels:k,openTaskId:l}){let m=(0,d.useRouter)(),{t:n}=(0,i.useI18n)(),[,o]=(0,c.useTransition)(),[p,q]=(0,c.useState)(""),[s,t]=(0,c.useState)("all"),[v,w]=(0,c.useState)(!1),[x,y]=(0,c.useState)("TODO"),[z,A]=(0,c.useState)(l??null),[B,C]=(0,c.useState)([]),D=z?h.find(a=>a.id===z)??null:null,[E,F]=(0,c.useState)(null),[G,H]=(0,c.useState)(null),[I,J]=(0,c.useState)(null);(0,c.useEffect)(()=>{ba(e).then(C).catch(()=>C([]))},[e]);let K=B.find(a=>a.isCurrent)?.id??null,L=(0,c.useCallback)(()=>{o(()=>{m.refresh()})},[m]);(0,c.useEffect)(()=>{if(v)return;let a=setInterval(()=>{o(()=>{m.refresh()})},5e3);return()=>clearInterval(a)},[m,v]);let M=(0,c.useCallback)(a=>{q(a)},[]),P=(0,c.useCallback)(async a=>{let b=h.find(b=>b.id===a);if(b)try{let c=await (0,aL.checkWorktreeClean)(a);if(c.hasWorktree&&!c.clean){al.toast.error(n("taskPage.uncommittedChanges",{count:String(c.files.length)})),L();return}if(c.hasWorktree&&c.clean&&!c.hasCommits){al.toast.error(n("taskPage.noChangesToComplete"),{action:{label:n("taskPage.markAsCancelled"),onClick:()=>{(0,aK.updateTaskStatus)(a,"CANCELLED").then(()=>{al.toast.success(n("taskPage.taskCancelled")),L()}).catch(()=>al.toast.error("Failed to cancel task"))}}}),L();return}if(c.hasWorktree&&c.hasCommits){H({task:b,commitLog:c.commitLog,commitCount:c.commitLog.length}),L();return}await (0,aK.updateTaskStatus)(a,"DONE"),al.toast.success(n("taskPage.taskCompleted")),L()}catch{al.toast.error("Failed to complete task"),L()}},[h,L,n]),Q=(0,c.useCallback)(async a=>{let b=h.find(b=>b.id===a);if(b)try{let c=await (0,aL.checkWorktreeClean)(a);if(!c.hasWorktree){await (0,aK.updateTaskStatus)(a,"CANCELLED"),al.toast.success(n("taskPage.taskCancelled")),L();return}J({task:b,files:c.files,commitLog:c.commitLog}),L()}catch{al.toast.error("Failed to cancel task"),L()}},[h,L,n]),R=(0,c.useCallback)(async(a,b)=>{"DONE"===b?await P(a):"CANCELLED"===b?await Q(a):(await (0,aK.updateTaskStatus)(a,b),L())},[L,P,Q]),S=(0,c.useCallback)(async a=>{let b=await (0,a5.createTask)({title:a.title,description:a.description,projectId:e,priority:a.priority,status:a.status,labelIds:a.labelIds,baseBranch:a.baseBranch,subPath:a.subPath,versionId:a.versionId??void 0});if(a.autoStart&&b?.id)try{await (0,a9.startPtyExecution)(b.id,""),A(b.id)}catch(a){al.toast.error(a instanceof Error?a.message:String(a))}L()},[e,L]),T=(0,c.useCallback)(async(a,b)=>{await (0,a6.updateTask)(a,{...b,labelIds:b.labelIds}),F(null),L()},[L]),U=(0,c.useCallback)(async a=>{await a7(a),z===a&&A(null),L()},[L,z]),V=(0,c.useCallback)(async a=>{await a8(a),L()},[L]),W=(0,c.useCallback)(async b=>{try{await (0,a9.startPtyExecution)(b,"")}catch(a){al.toast.error(a instanceof Error?a.message:String(a))}m.push(`/workspaces/${a}/tasks/${b}`)},[m,a]),X=(0,c.useCallback)(async(a,b)=>{"DONE"===b?await P(a):"CANCELLED"===b?await Q(a):(await (0,aK.updateTaskStatus)(a,b),L())},[L,P,Q]),Y=(0,c.useCallback)(a=>{y(a),F(null),w(!0)},[]),Z=(0,c.useCallback)(a=>{F(a),w(!0)},[]),$=h.filter(a=>!a.labels?.some(a=>a.label.name===u.TOWER_LABEL_NAME&&a.label.isBuiltin)),_=$.filter(a=>{if("backlog"===s){if(a.versionId)return!1}else if("all"!==s&&a.versionId!==s)return!1;if(p.trim()){let b=p.toLowerCase();if(!a.title.toLowerCase().includes(b)&&!a.description?.toLowerCase().includes(b))return!1}return!0});return(0,b.jsxs)("div",{className:"flex h-full",children:[(0,b.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,b.jsx)("div",{className:"px-6 pt-3 pb-1",children:(0,b.jsx)(bc,{projects:g,activeProjectId:e,onSelect:b=>m.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1})})}),(0,b.jsx)(j,{totalTasks:$.length,runningTasks:$.filter(a=>"IN_PROGRESS"===a.status).length}),(0,b.jsx)(r,{searchQuery:p,onSearchChange:M,versions:B,versionFilter:s,onVersionFilterChange:t,versionsHref:`/workspaces/${a}/projects/${e}/versions`,onCreateTask:()=>{F(null),w(!0)}}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:(0,b.jsx)(N,{initialTasks:_,onTaskMove:R,onTaskClick:a=>{A(a.id)},onEditTask:Z,onAddTask:Y,onDeleteTask:U,onTogglePin:V,workspaceId:a,onContextMenuStatusChange:X,onContextMenuLaunch:W})}),(0,b.jsx)(O.CreateTaskDialog,{open:v,onOpenChange:a=>{w(a),a||F(null)},onSubmit:S,onUpdate:T,defaultStatus:x,editTask:E,editTaskLabelIds:E?.labels?E.labels.map(a=>a.labelId):[],labels:k.filter(a=>!(a.name===u.TOWER_LABEL_NAME&&a.isBuiltin)),projectType:f.type,projectLocalPath:f.localPath,versions:B,defaultVersionId:K})]}),D?(0,b.jsx)(a4,{task:D,workspaceId:a,projectLocalPath:f.localPath,onClose:()=>A(null)}):(0,b.jsx)(av,{project:f,workspaceId:a}),G&&(0,b.jsx)(aD.TaskMergeConfirmDialog,{open:!0,onOpenChange:a=>{a||H(null)},taskId:G.task.id,taskTitle:G.task.title,baseBranch:G.task.baseBranch??"main",fileCount:0,commitCount:G.commitCount,commitLog:G.commitLog,onMergeComplete:()=>{H(null),al.toast.success(n("taskPage.taskCompleted")),L()}}),I&&(0,b.jsx)(be,{open:!0,onOpenChange:a=>{a||J(null)},taskTitle:I.task.title,uncommittedFiles:I.files,commitLog:I.commitLog,onConfirm:()=>{let a=I.task.id;J(null),(0,aK.updateTaskStatus)(a,"CANCELLED").then(()=>{al.toast.success(n("taskPage.taskCancelled")),L()}).catch(()=>al.toast.error("Failed to cancel task"))}})]})}],473935)}];
|
|
1
|
+
module.exports=[473935,a=>{"use strict";var b=a.i(728778),c=a.i(374637),d=a.i(553798),e=a.i(711796);let f=(0,e.default)("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]),g=(0,e.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);var h=a.i(283857),i=a.i(951192);function j({totalTasks:a,runningTasks:c}){let{t:d}=(0,i.useI18n)();return(0,b.jsxs)("div",{className:"grid grid-cols-3 gap-3 px-6 py-4",children:[(0,b.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"rounded-lg bg-sky-500/10 p-2 ring-1 ring-sky-500/20",children:(0,b.jsx)(f,{className:"h-4 w-4 text-sky-400"})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:d("board.overview")}),(0,b.jsx)("p",{className:"text-2xl font-bold font-mono tracking-tight text-foreground",children:a})]})]})}),(0,b.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"rounded-lg bg-primary/10 p-2 ring-1 ring-primary/20",children:(0,b.jsx)(g,{className:"h-4 w-4 text-primary"})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:d("board.running")}),(0,b.jsx)("p",{className:"text-2xl font-bold font-mono tracking-tight text-foreground",children:c})]})]})}),(0,b.jsx)("div",{className:"rounded-xl border border-border bg-card p-4",children:(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"rounded-lg bg-emerald-500/10 p-2 ring-1 ring-emerald-500/20",children:(0,b.jsx)(h.Lightbulb,{className:"h-4 w-4 text-emerald-400"})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:d("board.tip")}),(0,b.jsx)("p",{className:"text-xs font-medium text-foreground/80",children:d("board.tipText")})]})]})})]})}var k=a.i(634910),l=a.i(774881),m=a.i(573242),n=a.i(577565),o=a.i(699570),p=a.i(866718),q=a.i(580701);function r({searchQuery:a,onSearchChange:c,versions:d=[],versionFilter:e="all",onVersionFilterChange:f,versionsHref:g,onCreateTask:h}){let j,{t:s}=(0,i.useI18n)(),t="all"===e?s("board.allVersions"):"backlog"===e?s("board.backlogFilter"):(j=d.find(a=>a.id===e))?`${j.number} ${j.name}`:s("board.allVersions");return(0,b.jsxs)("div",{className:"flex items-center gap-2 px-6 py-2",children:[f&&(0,b.jsxs)(q.Select,{value:e,onValueChange:a=>f(a||"all"),children:[(0,b.jsxs)(q.SelectTrigger,{className:"h-8 w-44 shrink-0 gap-1.5 text-xs text-muted-foreground",children:[(0,b.jsx)(n.GitBranch,{className:"h-3.5 w-3.5 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:t})]}),(0,b.jsxs)(q.SelectContent,{children:[(0,b.jsx)(q.SelectItem,{value:"all",children:s("board.allVersions")}),(0,b.jsx)(q.SelectItem,{value:"backlog",children:s("board.backlogFilter")}),d.map(a=>(0,b.jsxs)(q.SelectItem,{value:a.id,children:[(0,b.jsx)("span",{className:"font-mono",children:a.number})," ",a.name]},a.id))]})]}),(0,b.jsxs)("div",{className:"relative flex-1 max-w-xs",children:[(0,b.jsx)(m.Search,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),(0,b.jsx)(p.Input,{type:"text",value:a,onChange:a=>c(a.target.value),placeholder:s("board.searchPlaceholder"),className:"pl-8 pr-3 text-xs"})]}),(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[g&&(0,b.jsx)(k.default,{href:g,children:(0,b.jsxs)(o.Button,{variant:"outline",className:"h-8 gap-1.5 text-xs text-muted-foreground",children:[(0,b.jsx)(n.GitBranch,{className:"h-3.5 w-3.5"}),s("version.timeline")]})}),(0,b.jsxs)(o.Button,{"data-tour":"create-task",variant:"outline",className:"gap-1.5 border-border text-xs text-muted-foreground hover:border-primary/30 hover:text-primary",onClick:h,children:[(0,b.jsx)(l.Plus,{className:"h-3.5 w-3.5"}),s("board.newTask")]})]})]})}var s=a.i(986099),t=a.i(668116),u=a.i(521007);function v({x:a,y:e,taskId:f,currentStatus:g,hasExecutions:h,workspaceId:j,onClose:k,onStatusChange:l,onLaunch:m}){let{t:n}=(0,i.useI18n)(),o=(0,d.useRouter)(),p=(0,c.useRef)(null);(0,c.useEffect)(()=>{let a=a=>{p.current&&!p.current.contains(a.target)&&k()},b=a=>{"Escape"===a.key&&k()};return document.addEventListener("mousedown",a),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",b)}},[k]);let q="flex items-center px-3 py-1.5 text-xs cursor-pointer hover:bg-accent rounded-sm w-full text-left",r=(0,b.jsxs)("div",{ref:p,style:{position:"fixed",top:e,left:a,zIndex:9999},className:"bg-popover border border-border rounded-md shadow-md py-1 min-w-[180px]",children:[(0,b.jsx)("div",{className:"px-3 py-1 text-[10px] text-muted-foreground uppercase tracking-wider",children:n("board.contextMenu.changeStatus")}),u.BOARD_COLUMNS.map(a=>(0,b.jsxs)("button",{type:"button",className:q,onClick:()=>{l(f,a.id),k()},children:[g===a.id?(0,b.jsx)(t.Check,{className:"h-3 w-3 mr-2 flex-shrink-0"}):(0,b.jsx)("span",{className:"w-5 flex-shrink-0"}),a.label]},a.id)),(0,b.jsx)("hr",{className:"my-1 border-border"}),(0,b.jsx)("button",{type:"button",className:`${q} ${h?"opacity-50 cursor-not-allowed":""}`,disabled:h,onClick:()=>{h||(m(f),k())},children:n("board.contextMenu.launch")}),"DONE"!==g&&"CANCELLED"!==g&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("hr",{className:"my-1 border-border"}),(0,b.jsx)("button",{type:"button",className:q,onClick:()=>{o.push(`/workspaces/${j}/tasks/${f}`),k()},children:n("board.contextMenu.goToDetail")})]})]});return"u"<typeof document?null:(0,s.createPortal)(r,document.body)}var w=a.i(643228),x=a.i(859103);let y=(0,e.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);var z=a.i(514126),A=a.i(336771),B=a.i(690251),C=a.i(975231);let D=(0,e.default)("pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);var E=a.i(786304),F=a.i(785259),G=a.i(335732),H=a.i(551578);function I({task:a,onClick:c,onEdit:d,onDelete:e,onTogglePin:f,onContextMenu:g}){let{t:h}=(0,i.useI18n)(),{attributes:j,listeners:k,setNodeRef:l,transform:m,transition:p,isDragging:q}=(0,x.useSortable)({id:a.id,data:{type:"task",task:a}}),r={transform:z.CSS.Transform.toString(m),transition:p,opacity:q?.4:1},s=u.PRIORITY_CONFIG[a.priority],t=!!a.baseBranch;return(0,b.jsxs)("div",{ref:l,style:r,...j,...k,className:"group cursor-grab rounded-lg border border-border bg-card p-3 transition-all hover:border-primary/20 hover:bg-accent/50 active:cursor-grabbing",onClick:c,onContextMenu:b=>{b.preventDefault(),b.stopPropagation(),g?.(a,b.clientX,b.clientY)},"data-testid":"task-card",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between",children:[(0,b.jsx)("h4",{className:"text-sm font-medium text-foreground",children:a.title}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",className:`transition-all ${a.pinned?"text-primary opacity-100":"text-muted-foreground opacity-0 group-hover:opacity-100"}`,onClick:b=>{b.stopPropagation(),f?.(a.id)},"aria-label":h(a.pinned?"board.unpin":"board.pin"),children:(0,b.jsx)(D,{className:`h-3.5 w-3.5 ${a.pinned?"-rotate-45":""}`})}),(0,b.jsxs)(G.DropdownMenu,{children:[(0,b.jsx)(G.DropdownMenuTrigger,{render:(0,b.jsx)("button",{className:"rounded-md p-0.5 text-muted-foreground opacity-0 transition-all hover:bg-background hover:text-foreground group-hover:opacity-100",onClick:a=>a.stopPropagation()}),children:(0,b.jsx)(A.MoreHorizontal,{className:"h-4 w-4"})}),(0,b.jsxs)(G.DropdownMenuContent,{align:"end",children:[(0,b.jsxs)(G.DropdownMenuItem,{onClick:b=>{b.stopPropagation(),d?.(a)},children:[(0,b.jsx)(B.Pencil,{className:"mr-2 h-3.5 w-3.5"}),h("common.edit")]}),(0,b.jsxs)(G.DropdownMenuItem,{className:"text-rose-400",onClick:b=>{b.stopPropagation(),e?.(a.id)},children:[(0,b.jsx)(C.Trash2,{className:"mr-2 h-3.5 w-3.5"}),h("common.delete")]})]})]})]})]}),a.description&&(0,b.jsx)("p",{className:"mt-1.5 line-clamp-3 text-xs leading-relaxed text-muted-foreground",children:a.description}),(0,b.jsxs)("div",{className:"mt-2.5 flex flex-wrap items-center gap-1.5",children:[(0,b.jsx)(E.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${s.color}`,children:s.label}),a.labels?.map(a=>(0,b.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-medium",style:{backgroundColor:a.label.color+"20",color:a.label.color},children:a.label.name},a.label.id)),(t||a.version)&&(0,b.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[t&&(0,b.jsxs)(F.Tooltip,{disableHoverablePopup:!0,children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)("span",{className:"inline-flex cursor-default items-center rounded-md border border-border bg-muted px-1 py-0.5 text-muted-foreground",onPointerDown:a=>a.stopPropagation(),children:(0,b.jsx)(n.GitBranch,{className:"h-2.5 w-2.5 shrink-0"})})}),(0,b.jsx)(F.TooltipContent,{side:"top",children:h("board.card.worktree",{branch:a.baseBranch??""})})]}),a.version&&(0,b.jsxs)(F.Tooltip,{disableHoverablePopup:!0,children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)("span",{className:"cursor-default",onPointerDown:a=>a.stopPropagation(),children:(0,b.jsx)(H.TaskVersionTag,{number:a.version.number,title:""})})}),(0,b.jsx)(F.TooltipContent,{side:"top",children:h("board.card.version",{number:a.version.number,name:a.version.name})})]})]})]})]})}var J=a.i(814574),K=a.i(269876);function L({open:a,onOpenChange:c,columnLabel:d,columnColor:e,tasks:f,onTaskClick:g}){let{t:h}=(0,i.useI18n)();return(0,b.jsx)(J.Dialog,{open:a,onOpenChange:c,children:(0,b.jsxs)(J.DialogContent,{className:"sm:max-w-6xl max-h-[80vh]",children:[(0,b.jsx)(J.DialogHeader,{children:(0,b.jsxs)(J.DialogTitle,{className:"flex items-center gap-2",children:[(0,b.jsx)("div",{className:`h-2.5 w-2.5 rounded-full ${e}`}),(0,b.jsx)("span",{children:d}),(0,b.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-mono font-medium text-muted-foreground",children:f.length})]})}),(0,b.jsx)(K.ScrollArea,{className:"max-h-[680px]",children:(0,b.jsxs)("div",{className:"grid grid-cols-4 gap-3 pr-3",children:[f.map(a=>{let d=u.PRIORITY_CONFIG[a.priority];return(0,b.jsxs)("div",{className:"cursor-pointer rounded-lg border border-border bg-card p-3 transition-all hover:border-primary/20 hover:bg-accent/50",onClick:()=>{g?.(a),c(!1)},children:[(0,b.jsx)("h4",{className:"text-sm font-medium text-foreground line-clamp-2",children:a.title}),a.description&&(0,b.jsx)("p",{className:"mt-1.5 line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:a.description}),(0,b.jsxs)("div",{className:"mt-2 flex items-center gap-1.5 flex-wrap",children:[(0,b.jsx)(E.Badge,{variant:"secondary",className:`text-[10px] font-semibold ${d.color}`,children:d.label}),a.labels?.map(a=>(0,b.jsx)("span",{className:"rounded-full px-1.5 py-0.5 text-[10px] font-medium",style:{backgroundColor:a.label.color+"20",color:a.label.color},children:a.label.name},a.label.id))]})]},a.id)}),0===f.length&&(0,b.jsx)("div",{className:"col-span-4 py-8 text-center text-sm text-muted-foreground",children:h("board.noTasks")})]})})]})})}function M({id:a,label:d,color:e,tasks:f,onTaskClick:g,onEditTask:h,onAddTask:j,onDeleteTask:k,onTogglePin:m,onContextMenu:n}){let{setNodeRef:p,isOver:q}=(0,w.useDroppable)({id:a}),[r,s]=(0,c.useState)(!1),{t}=(0,i.useI18n)();return(0,b.jsxs)("div",{className:`flex w-0 min-w-[220px] flex-1 flex-col min-h-0 border-r border-border/50 last:border-r-0 transition-colors ${q?"bg-primary/[0.06]":""}`,children:[(0,b.jsxs)("div",{className:"flex items-center justify-between px-3 py-2.5 border-b border-border/30",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("div",{className:`h-2 w-2 rounded-full ${e}`}),(0,b.jsx)("span",{className:"text-xs font-semibold tracking-wide text-secondary-foreground",children:d}),(0,b.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-mono font-medium text-muted-foreground",children:f.length})]}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>s(!0),className:"text-muted-foreground","aria-label":t("board.viewAll"),children:(0,b.jsx)(y,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:j,className:"text-muted-foreground","aria-label":"add",children:(0,b.jsx)(l.Plus,{className:"h-3.5 w-3.5"})})]})]}),(0,b.jsx)(L,{open:r,onOpenChange:s,columnLabel:d,columnColor:e,tasks:f,onTaskClick:g}),(0,b.jsx)(K.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)("div",{ref:p,className:"flex flex-col gap-2 p-2",children:(0,b.jsx)(x.SortableContext,{items:f.map(a=>a.id),strategy:x.verticalListSortingStrategy,children:f.map(a=>(0,b.jsx)(I,{task:a,onClick:()=>g?.(a),onEdit:h,onDelete:k,onTogglePin:m,onContextMenu:n},a.id))})})})]})}function N({initialTasks:a,onTaskMove:d,onTaskClick:e,onEditTask:f,onAddTask:g,onDeleteTask:h,onTogglePin:i,onContextMenuStatusChange:j,onContextMenuLaunch:k,workspaceId:l}){let[m,n]=(0,c.useState)(a),[o,p]=(0,c.useState)(null),[q,r]=(0,c.useState)(null);(0,c.useEffect)(()=>{n(a)},[a]);let s=(0,w.useSensors)((0,w.useSensor)(w.PointerSensor,{activationConstraint:{distance:8}})),t=(0,c.useCallback)((a,b,c)=>{r({task:a,x:b,y:c})},[]),x=(0,c.useCallback)(a=>{let b=m.find(b=>b.id===a.active.id);b&&p(b)},[m]),y=(0,c.useCallback)(a=>{let b,{active:c,over:e}=a;if(p(null),!e)return;let f=c.id,g=e.id;if(u.BOARD_COLUMNS.some(a=>a.id===g))b=g;else{let a=m.find(a=>a.id===g);b=a?.status}b&&(n(a=>a.map(a=>a.id===f?{...a,status:b}:a)),d?.(f,b))},[m,d]);return(0,b.jsxs)(w.DndContext,{id:"kanban-board",sensors:s,collisionDetection:w.closestCorners,onDragStart:x,onDragEnd:y,children:[(0,b.jsx)("div",{className:"mx-2 flex h-full overflow-x-auto rounded-xl border border-border bg-card/50",children:u.BOARD_COLUMNS.map(a=>(0,b.jsx)(M,{id:a.id,label:a.label,color:a.color,tasks:m.filter(b=>b.status===a.id),onTaskClick:e,onEditTask:f,onAddTask:()=>g?.(a.id),onDeleteTask:h,onTogglePin:i,onContextMenu:t},a.id))}),(0,b.jsx)(w.DragOverlay,{children:o?(0,b.jsx)("div",{className:"rotate-3 scale-105",children:(0,b.jsx)(I,{task:o})}):null}),q&&(0,b.jsx)(v,{x:q.x,y:q.y,taskId:q.task.id,currentStatus:q.task.status,hasExecutions:(q.task._count?.executions??0)>0,workspaceId:l??"",onClose:()=>r(null),onStatusChange:(a,b)=>{j?.(a,b),r(null)},onLaunch:a=>{k?.(a),r(null)}})]})}var O=a.i(445798);function P(a,b,c){return Math.min(Math.max(a,b),c)}var Q=a.i(442620),R=a.i(10390),S=a.i(350739),T=a.i(347165);let U=(0,e.default)("git-commit-vertical",[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]);var V=a.i(616335),W=a.i(704494),X=a.i(394259),Y=a.i(625892),Z=a.i(939859),$=a.i(648512),_=a.i(22761),aa=a.i(429246),ab=a.i(780410);let ac=(0,ab.createServerReference)("60b0380e165f524a2d94cf6eeea69d6a79b8c869e3",ab.callServer,void 0,ab.findSourceMapURL,"updateProject");var ad=a.i(464462);let ae=(0,ab.createServerReference)("401507e22bdf8ed89380da82391a5cc3b4680d6523",ab.callServer,void 0,ab.findSourceMapURL,"deleteProject"),af=(0,ab.createServerReference)("40f4bc7d33dfc4192f63cea49ce2d3321a9a6daf65",ab.callServer,void 0,ab.findSourceMapURL,"getRecentLocalProjects"),ag=(0,ab.createServerReference)("40cdddf74c4871e58a967171910cd4e70f66d9fcb9",ab.callServer,void 0,ab.findSourceMapURL,"getOrCreateTowerTaskId");var ah=a.i(629750),ai=a.i(824710),aj=a.i(179787),ak=a.i(426016),al=a.i(952313),am=a.i(43775),an=a.i(487410);function ao({commits:a}){let{t:d}=(0,i.useI18n)(),[e,f]=(0,c.useState)(!1);return 0===a.length?null:(0,b.jsxs)("div",{className:"border-b border-border",children:[(0,b.jsxs)("button",{onClick:()=>f(!e),className:"flex w-full items-center gap-1 px-2 py-1.5 hover:bg-accent/50 transition-colors",children:[e?(0,b.jsx)(Q.ChevronDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,b.jsx)(R.ChevronRight,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[d("git.commitLog")," (",a.length,")"]})]}),e&&(0,b.jsx)("div",{className:"mt-0.5 mb-1.5 space-y-0.5 max-h-64 overflow-y-auto",children:a.map(a=>(0,b.jsxs)("div",{className:"group flex items-start gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,b.jsx)(U,{className:"h-3 w-3 shrink-0 text-muted-foreground mt-0.5"}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("p",{className:"text-xs text-foreground line-clamp-1",children:a.message}),(0,b.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,b.jsxs)("button",{onClick:()=>{navigator.clipboard.writeText(a.shortHash),al.toast.success(`Copied ${a.shortHash}`)},className:"flex items-center gap-0.5 font-mono text-[10px] text-primary/70 hover:text-primary transition-colors",children:[a.shortHash,(0,b.jsx)(_.Copy,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:a.author}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(a){let b=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(b<1)return"just now";if(b<60)return`${b}m`;let c=Math.floor(b/60);if(c<24)return`${c}h`;let d=Math.floor(c/24);return d<30?`${d}d`:`${Math.floor(d/30)}mo`}(a.date)})]})]})]},a.hash))})]})}var ap=a.i(607219),aq=a.i(324263),ar=a.i(7285);function as({localPath:a,stashes:d,hasChanges:e,onRefresh:f}){let{t:g}=(0,i.useI18n)(),[h,j]=(0,c.useState)(!1),[k,l]=(0,c.useState)(!1),[m,n]=(0,c.useState)(""),[q,r]=(0,c.useState)(null),s=async()=>{l(!0);try{await (0,ar.gitAction)(a,"stash-save",{message:m}),n(""),al.toast.success(g("git.stashSaved")),await f()}catch(a){al.toast.error(a instanceof Error?a.message:String(a))}finally{l(!1)}},t=async b=>{r(b);try{await (0,ar.gitAction)(a,"stash-pop",{index:b}),al.toast.success(g("git.stashApplied")),await f()}catch(a){al.toast.error(a instanceof Error?a.message:String(a))}finally{r(null)}},u=async b=>{r(b);try{await (0,ar.gitAction)(a,"stash-drop",{index:b}),al.toast.success(g("git.stashDropped")),await f()}catch(a){al.toast.error(a instanceof Error?a.message:String(a))}finally{r(null)}};return e||0!==d.length?(0,b.jsxs)("div",{className:"border-b border-border",children:[(0,b.jsxs)("button",{onClick:()=>j(!h),className:"flex w-full items-center gap-1 px-2 py-1.5 hover:bg-accent/50 transition-colors",children:[h?(0,b.jsx)(Q.ChevronDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,b.jsx)(R.ChevronRight,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsxs)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:[g("git.stash")," ",d.length>0&&`(${d.length})`]})]}),h&&(0,b.jsxs)("div",{className:"mt-0.5 mb-1.5 space-y-2",children:[e&&(0,b.jsxs)("div",{className:"flex gap-1.5",children:[(0,b.jsx)(p.Input,{value:m,onChange:a=>n(a.target.value),placeholder:g("git.stashMsgPlaceholder"),className:"h-7 text-xs flex-1",onKeyDown:a=>"Enter"===a.key&&s()}),(0,b.jsx)(o.Button,{variant:"outline",size:"icon-sm",onClick:s,disabled:k,className:"shrink-0",children:k?(0,b.jsx)(W.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(ap.Archive,{className:"h-3 w-3"})})]}),d.length>0&&(0,b.jsx)("div",{className:"space-y-0.5",children:d.map(a=>(0,b.jsxs)("div",{className:"group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-accent transition-colors",children:[(0,b.jsx)(ap.Archive,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),(0,b.jsx)("span",{className:"flex-1 min-w-0 truncate text-xs text-foreground",children:a.message||`stash@{${a.index}}`}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>t(a.index),disabled:q===a.index,className:"text-muted-foreground","aria-label":g("git.stashApply"),children:q===a.index?(0,b.jsx)(W.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aq.ArrowUpFromLine,{className:"h-3 w-3"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>u(a.index),disabled:q===a.index,className:"text-rose-400","aria-label":g("git.stashDrop"),children:(0,b.jsx)(C.Trash2,{className:"h-3 w-3"})})]})]},a.index))})]})]}):null}var at=a.i(985716);function au({value:a,ariaLabel:d}){let{t:e}=(0,i.useI18n)(),[f,g]=(0,c.useState)(!1),h=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(a);else{let b=document.createElement("textarea");b.value=a,document.body.appendChild(b),b.select(),document.execCommand("copy"),document.body.removeChild(b)}g(!0),al.toast.success(e("common.copied")),setTimeout(()=>g(!1),1500)}catch{al.toast.error(e("common.copyFailed"))}};return(0,b.jsxs)("div",{className:"flex items-center gap-1 rounded-md border border-border bg-muted/50 pl-3 pr-1 py-1.5",children:[(0,b.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",title:a,children:a}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",className:"shrink-0 text-muted-foreground","aria-label":d,onClick:h,children:f?(0,b.jsx)(t.Check,{className:"h-3 w-3 text-emerald-400"}):(0,b.jsx)(_.Copy,{className:"h-3 w-3"})})}),(0,b.jsx)(F.TooltipContent,{children:f?e("common.copied"):e("common.copy")})]})]})}function av({project:a,workspaceId:e}){let{t:f,locale:g}=(0,i.useI18n)(),h=(0,d.useRouter)(),{width:j,isDragging:k,startResize:l}=function(a){let{storageKey:b,defaultWidth:d,minWidth:e,maxWidth:f,edge:g="left"}=a,[h,i]=(0,c.useState)(d),[j,k]=(0,c.useState)(!1),l=(0,c.useRef)(null);(0,c.useEffect)(()=>{try{let a=window.localStorage.getItem(b),c=null==a?NaN:Number(a);Number.isFinite(c)&&i(P(c,e,f))}catch{}},[b,e,f]);let m=(0,c.useCallback)(a=>{let b=l.current;b&&i(function(a,b,c,d,e,f="left"){return P(a+("left"===f?b-c:c-b),d,e)}(b.width,b.x,a.clientX,e,f,g))},[e,f,g]),n=(0,c.useCallback)(()=>{l.current&&(l.current=null,k(!1),window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",n),i(a=>{try{window.localStorage.setItem(b,String(a))}catch{}return a}))},[m,b]),o=(0,c.useCallback)(a=>{a.preventDefault(),l.current={x:a.clientX,width:h},k(!0),window.addEventListener("pointermove",m),window.addEventListener("pointerup",n)},[h,m,n]);return(0,c.useEffect)(()=>()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",n)},[m,n]),{width:h,isDragging:j,startResize:o}}({storageKey:"tower:repo-sidebar-width",defaultWidth:288,minWidth:240,maxWidth:560,edge:"left"}),[m,q]=(0,c.useState)(!0),[r,s]=(0,c.useState)(!0),[t,u]=(0,c.useState)(!1),[v,w]=(0,c.useState)(!1),[x,y]=(0,c.useState)(""),[z,A]=(0,c.useState)(!1),[D,E]=(0,c.useState)(!1),[G,H]=(0,c.useState)(!1),[I,K]=(0,c.useState)(a.name),[L,M]=(0,c.useState)(a.alias??""),[N,O]=(0,c.useState)(a.description??""),[_,ab]=(0,c.useState)(a.localPath??""),[ap,aq]=(0,c.useState)(a.projectType??"FRONTEND"),[ar,aw]=(0,c.useState)([]);(0,c.useEffect)(()=>{af(100).then(aw)},[]);let[ax,ay]=(0,c.useState)(!1),[az,aA]=(0,c.useState)(""),[aB,aC]=(0,c.useState)(""),[aD,aE]=(0,c.useState)(""),[aF,aG]=(0,c.useState)(""),[aH,aI]=(0,c.useState)("FRONTEND"),[aJ,aK]=(0,c.useState)(!1),[aL,aM]=(0,c.useState)(!1),[aN,aO]=(0,c.useState)(null),[aP,aQ]=(0,c.useState)(!1),[aR,aS]=(0,c.useState)(!1),aT=a=>{al.toast.info(a)},aU=(0,c.useCallback)(async()=>{if(a.localPath){aQ(!0);try{let b=await fetch(`/api/git?path=${encodeURIComponent(a.localPath)}`);b.ok&&aO(await b.json())}catch{}finally{aQ(!1)}}},[a.localPath]);(0,c.useEffect)(()=>{aU()},[aU]);let aV=async()=>{if(a.localPath){aS(!0);try{(await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"init",path:a.localPath})})).ok?(aT(f("git.initSuccess")),await aU()):aT(f("git.initFailed"))}catch{aT(f("git.initFailed"))}finally{aS(!1)}}},aW=(a,b)=>{h.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1}),h.refresh()},aX=async()=>{if(aB.trim()){aK(!0);try{let a=await (0,ad.createProject)({name:aB.trim(),alias:aD.trim()||void 0,description:aF.trim()||void 0,localPath:az,projectType:aH,workspaceId:e});ay(!1),aW(e,a.id)}catch(a){al.toast.error(a instanceof Error?a.message:String(a))}finally{aK(!1)}}},aY=async()=>{if(_&&!aL){aM(!0);try{let a=await (0,ak.analyzeProjectDirectory)(_.trim(),g);O(a)}catch{al.toast.error(f("project.analyzeError"))}finally{aM(!1)}}},aZ=async()=>{try{await ac(a.id,{name:I.trim(),alias:L.trim()||void 0,description:N.trim()||void 0,localPath:_.trim()||void 0,projectType:ap}),h.refresh(),u(!1)}catch(a){al.toast.error(a instanceof Error?a.message:String(a))}};return(0,b.jsxs)("aside",{className:"relative flex-shrink-0 border-l border-border bg-sidebar",style:{width:j},children:[(0,b.jsx)("div",{onPointerDown:l,className:`absolute left-0 top-0 z-20 h-full w-1 -translate-x-1/2 cursor-col-resize transition-colors hover:bg-primary/20 ${k?"bg-primary/40":"bg-transparent"}`,role:"separator","aria-orientation":"vertical","aria-label":f("sidebar.right.resize")}),(0,b.jsxs)("div",{className:"h-full overflow-y-auto",children:[(0,b.jsxs)("div",{className:"border-b border-border p-4",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("h2",{className:"text-base font-semibold text-foreground",children:a.name}),a.alias&&(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:a.alias})]}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{K(a.name),M(a.alias??""),O(a.description??""),ab(a.localPath??""),u(!0)},className:"text-muted-foreground",children:(0,b.jsx)(B.Pencil,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{y(""),w(!0)},className:"text-muted-foreground hover:text-rose-400",children:(0,b.jsx)(C.Trash2,{className:"h-3.5 w-3.5"})})]})]}),a.description&&(0,b.jsx)("p",{className:"mt-2 text-sm text-secondary-foreground leading-relaxed line-clamp-4",children:a.description}),(0,b.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:(0,b.jsx)("span",{className:`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium ${"GIT"===a.type?"bg-sky-500/15 text-sky-300 ring-1 ring-sky-500/20":"bg-muted text-muted-foreground ring-1 ring-border"}`,children:"GIT"===a.type?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.GitBranch,{className:"h-3 w-3"}),f("sidebar.right.gitType")]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(S.FileText,{className:"h-3 w-3"}),f("sidebar.right.normalType")]})})}),a.gitUrl&&(0,b.jsx)("div",{className:"mt-3 space-y-1.5",children:(0,b.jsx)(au,{value:a.gitUrl,ariaLabel:f("project.gitUrl")})}),a.localPath&&(0,b.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,ah.openInFileManager)(a.localPath)}catch(a){console.error("openInFileManager failed:",a),al.toast.error(f("git.openInFileManagerFailed"))}},children:(0,b.jsx)(Y.FolderSearch,{className:"h-4 w-4"})})}),(0,b.jsx)(F.TooltipContent,{children:f("git.openInFileManager")})]}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,ai.openInEditor)(a.localPath)}catch(a){console.error("openInEditor failed:",a),al.toast.error(f("git.openInEditorFailed"))}},children:(0,b.jsx)(Z.Code,{className:"h-4 w-4"})})}),(0,b.jsx)(F.TooltipContent,{children:f("git.openInEditor")})]}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",className:"text-muted-foreground",onClick:async()=>{try{await (0,aj.openInTerminal)(a.localPath)}catch(a){console.error("openInTerminal failed:",a),al.toast.error(f("git.openInTerminalFailed"))}},children:(0,b.jsx)($.Terminal,{className:"h-4 w-4"})})}),(0,b.jsx)(F.TooltipContent,{children:f("git.openInTerminal")})]})]}),(0,b.jsxs)(o.Button,{variant:"outline",className:"w-full h-9 gap-1.5 text-xs",disabled:D,onClick:async()=>{E(!0);try{let b=await ag(a.id);h.push(`/workspaces/${e}/tasks/${b}`)}catch{al.toast.error(f("git.openStudioFailed"))}finally{E(!1)}},children:[D?(0,b.jsx)(W.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,b.jsx)(T.FolderOpen,{className:"h-3.5 w-3.5"}),f("git.openStudio")]})]})]}),(0,b.jsxs)("div",{className:"border-b border-border p-4",children:[(0,b.jsxs)(o.Button,{variant:"ghost",onClick:()=>q(!m),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,b.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:f("git.section")}),m?(0,b.jsx)(Q.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,b.jsx)(R.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),m&&(0,b.jsx)("div",{className:"mt-3",children:a.localPath?aP?(0,b.jsxs)("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:[(0,b.jsx)(W.Loader2,{className:"h-4 w-4 animate-spin"}),(0,b.jsx)("span",{className:"ml-2 text-xs",children:f("git.loading")})]}):aN&&!aN.isGit?(0,b.jsxs)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,b.jsx)(V.AlertCircle,{className:"h-3.5 w-3.5"}),(0,b.jsx)("p",{className:"text-xs",children:f("git.notInitialized")})]}),(0,b.jsxs)(o.Button,{className:"mt-3 h-7 w-full gap-1.5 bg-primary/10 text-xs text-primary ring-1 ring-primary/20 hover:bg-primary/15",onClick:aV,disabled:aR,children:[aR?(0,b.jsx)(W.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(U,{className:"h-3 w-3"}),f("git.initRepo")]})]}):aN?.isGit?(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"flex flex-col",children:(0,b.jsx)(at.EditorGitPanel,{localPath:a.localPath,mode:"project"})}),(0,b.jsx)(ao,{commits:aN.commits??[]}),(0,b.jsx)(as,{localPath:a.localPath,stashes:aN.stashes??[],hasChanges:(aN.changedFiles??[]).length>0,onRefresh:aU})]}):null:(0,b.jsx)("div",{className:"rounded-lg border border-border bg-muted/50 p-3",children:(0,b.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,b.jsx)(V.AlertCircle,{className:"h-3.5 w-3.5"}),(0,b.jsx)("p",{className:"text-xs",children:f("git.noLocalPath")})]})})})]}),(0,b.jsxs)("div",{className:"p-4",children:[(0,b.jsxs)(o.Button,{variant:"ghost",onClick:()=>s(!r),className:"flex w-full cursor-pointer justify-between px-2 py-2",children:[(0,b.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:f("sidebar.right.browseRepo")}),r?(0,b.jsx)(Q.ChevronDown,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,b.jsx)(R.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),r&&(0,b.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,b.jsxs)(o.Button,{variant:"outline",className:"w-full h-8 gap-1.5 text-xs",onClick:()=>H(!0),children:[(0,b.jsx)(T.FolderOpen,{className:"h-3.5 w-3.5"}),f("sidebar.right.browseRepo")]}),ar.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5 px-1",children:f("sidebar.right.recent")}),(0,b.jsx)("div",{className:"space-y-0.5",children:ar.map(c=>(0,b.jsxs)("button",{onClick:()=>{c.id!==a.id&&aW(c.workspaceId,c.id)},className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors ${c.id===a.id?"bg-primary/10 text-primary cursor-default":"hover:bg-accent cursor-pointer"}`,children:["GIT"===c.type?(0,b.jsx)(n.GitBranch,{className:"h-3 w-3 shrink-0 text-emerald-400"}):(0,b.jsx)(T.FolderOpen,{className:"h-3 w-3 shrink-0 text-primary/70"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsx)("p",{className:"truncate text-xs font-medium text-foreground",children:c.name}),c.localPath&&(0,b.jsx)("p",{className:"truncate text-[10px] font-mono text-muted-foreground",children:c.localPath})]})]},c.id))})]})]})]})]}),(0,b.jsx)(J.Dialog,{open:t,onOpenChange:u,children:(0,b.jsxs)(J.DialogContent,{style:{maxWidth:"32rem"},children:[(0,b.jsx)(J.DialogHeader,{children:(0,b.jsx)(J.DialogTitle,{children:f("project.edit")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(p.Input,{value:I,onChange:a=>K(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.type.label")}),(0,b.jsx)("div",{className:"mt-1.5",children:(0,b.jsx)(an.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:ap,onChange:aq})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(p.Input,{value:L,onChange:a=>M(a.target.value),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsxs)(o.Button,{type:"button",variant:"ghost",onClick:aY,className:`h-6 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground ${!_||aL?"opacity-50":""}`,children:[aL?(0,b.jsx)(W.Loader2,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(X.Sparkles,{className:"h-3 w-3"}),aL?f("project.analyzing"):f("project.genDesc")]})]}),(0,b.jsx)(aa.Textarea,{value:N,onChange:a=>O(a.target.value),rows:2,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none max-h-[200px] overflow-y-auto"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.jsx)("div",{className:"mt-1.5 break-all rounded-md border border-border bg-muted/50 px-3 py-2 font-mono text-xs text-muted-foreground",children:_||"—"})]})]}),(0,b.jsxs)(J.DialogFooter,{children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>u(!1),children:f("common.cancel")}),(0,b.jsx)(o.Button,{onClick:aZ,disabled:!I.trim()||aL,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:f("common.save")})]})]})}),(0,b.jsx)(am.FolderBrowserDialog,{open:G,onOpenChange:H,onSelect:a=>{t?ab(a):(a=>{let b=ar.find(b=>b.localPath===a);if(b)return aW(b.workspaceId,b.id);let c=a.replace(/[\\/]+$/,"").split(/[\\/]/).filter(Boolean).pop()??"";aA(a),aC(c),aE(""),aG(""),ay(!0)})(a)}}),(0,b.jsx)(J.Dialog,{open:ax,onOpenChange:ay,children:(0,b.jsxs)(J.DialogContent,{className:"sm:max-w-md",children:[(0,b.jsx)(J.DialogHeader,{children:(0,b.jsx)(J.DialogTitle,{children:f("topbar.newProject")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.localPath")}),(0,b.jsx)("div",{className:"mt-1.5 rounded-md border border-border bg-muted/50 px-3 py-2 font-mono text-xs text-muted-foreground",children:az})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.name")}),(0,b.jsx)(p.Input,{value:aB,onChange:a=>aC(a.target.value),placeholder:f("project.namePlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.type.label")}),(0,b.jsx)("div",{className:"mt-1.5",children:(0,b.jsx)(an.SegmentedControl,{options:[{value:"FRONTEND",label:f("project.type.frontend")},{value:"BACKEND",label:f("project.type.backend")}],value:aH,onChange:aI})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.alias")}),(0,b.jsx)(p.Input,{value:aD,onChange:a=>aE(a.target.value),placeholder:f("project.aliasPlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.description")}),(0,b.jsx)(aa.Textarea,{value:aF,onChange:a=>aG(a.target.value),placeholder:f("project.descPlaceholder"),rows:2,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none"})]})]}),(0,b.jsxs)(J.DialogFooter,{children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>ay(!1),children:f("common.cancel")}),(0,b.jsxs)(o.Button,{onClick:aX,disabled:!aB.trim()||aJ,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[aJ?(0,b.jsx)(W.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,f("common.create")]})]})]})}),(0,b.jsx)(J.Dialog,{open:v,onOpenChange:a=>{w(a),a||y("")},children:(0,b.jsxs)(J.DialogContent,{className:"sm:max-w-md",children:[(0,b.jsx)(J.DialogHeader,{children:(0,b.jsx)(J.DialogTitle,{className:"text-rose-400",children:f("project.deleteTitle")})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:f("project.deleteWarning",{name:a.name})}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:f("project.deleteIrreversible")}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:f("project.deleteConfirmLabel")}),(0,b.jsx)(p.Input,{value:x,onChange:a=>y(a.target.value),placeholder:f("project.deleteConfirmPlaceholder"),className:"mt-1.5",autoFocus:!0})]})]}),(0,b.jsxs)(J.DialogFooter,{children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>w(!1),children:f("common.cancel")}),(0,b.jsxs)(o.Button,{variant:"destructive",disabled:x!==f("project.deleteConfirmText")||z,onClick:async()=>{A(!0);try{await ae(a.id),al.toast.success(f("project.deleteSuccess")),h.push(`/workspaces/${e}`)}catch{al.toast.error(f("project.deleteFailed"))}finally{A(!1),w(!1)}},children:[z&&(0,b.jsx)(W.Loader2,{className:"h-3 w-3 animate-spin mr-1"}),f("project.deleteButton")]})]})]})})]})}var aw=a.i(963326),ax=a.i(300141),ay=a.i(913284),az=a.i(269280),aA=a.i(368114);function aB({title:a,description:c,branch:d,baseBranch:e,version:f,hasConversation:g,updatedAt:h,openDir:j,onBack:k}){let{t:l}=(0,i.useI18n)();return(0,b.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(X.Sparkles,{className:"h-3.5 w-3.5 text-primary"}),(0,b.jsx)("span",{className:"text-xs font-semibold text-primary",children:l("taskDetail.title")})]}),(0,b.jsxs)(o.Button,{variant:"ghost",onClick:k,className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground h-auto px-2 py-1",children:[(0,b.jsx)(az.ArrowLeft,{className:"h-3.5 w-3.5"}),l("taskDetail.back")]})]}),(0,b.jsx)("h2",{className:"mt-2.5 text-lg font-bold tracking-tight text-foreground",children:a}),c&&(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:c}),(0,b.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e?(0,b.jsxs)(E.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:[(0,b.jsx)(n.GitBranch,{className:"mr-1 h-3 w-3"}),e," · worktree"]}):d?(0,b.jsx)(E.Badge,{variant:"secondary",className:"bg-muted text-muted-foreground text-[10px] font-mono border border-border",children:l("taskDetail.directMode")}):null,f&&(0,b.jsx)(H.TaskVersionTag,{number:f.number,name:f.name,showName:!0}),g&&(0,b.jsx)(E.Badge,{variant:"secondary",className:"bg-emerald-500/10 text-emerald-400 text-[10px] border border-emerald-500/20",children:l("taskDetail.hasConversation")}),(0,b.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[l("taskDetail.updatedAt")," ",(0,aA.formatRelativeTime)(h)]}),j&&(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-0.5",children:[(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,ah.openInFileManager)(j)}catch(a){console.error("openInFileManager failed:",a),al.toast.error(l("git.openInFileManagerFailed"))}},children:(0,b.jsx)(Y.FolderSearch,{className:"h-3.5 w-3.5"})})}),(0,b.jsx)(F.TooltipContent,{side:"bottom",children:l("git.openInFileManager")})]}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,ai.openInEditor)(j)}catch(a){console.error("openInEditor failed:",a),al.toast.error(l("git.openInEditorFailed"))}},children:(0,b.jsx)(Z.Code,{className:"h-3.5 w-3.5"})})}),(0,b.jsx)(F.TooltipContent,{side:"bottom",children:l("git.openInEditor")})]}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsx)(F.TooltipTrigger,{render:(0,b.jsx)(o.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:async()=>{try{await (0,aj.openInTerminal)(j)}catch(a){console.error("openInTerminal failed:",a),al.toast.error(l("git.openInTerminalFailed"))}},children:(0,b.jsx)($.Terminal,{className:"h-3.5 w-3.5"})})}),(0,b.jsx)(F.TooltipContent,{side:"bottom",children:l("git.openInTerminal")})]})]})]})]})}var aC=a.i(639138),aD=a.i(88757),aE=a.i(347872),aF=a.i(372178),aG=a.i(643701),aH=a.i(759047),aI=a.i(800645),aJ=a.i(997775),aK=a.i(473858),aL=a.i(485673),aM=a.i(91473),aN=a.i(810462),aO=a.i(715525),aP=a.i(324954);let aQ=(0,e.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]);var aR=a.i(54384),aS=a.i(509405),aT=a.i(779960);let aU=(0,ab.createServerReference)("404290c2b774945a1dc10ec3449dc7d417d5ef1a37",ab.callServer,void 0,ab.findSourceMapURL,"getTaskNotes");var aV=a.i(239957);let aW=(0,ab.createServerReference)("408ff93b09853c3e48be0285dba399f40396ce4e07",ab.callServer,void 0,ab.findSourceMapURL,"getTaskAssets");var aX=a.i(429741),aY=a.i(887802),aZ=a.i(532615),a$=a.i(894148);a.i(757942);var a_=a.i(950314);function a0({note:a,open:c,onOpenChange:d}){let{t:e}=(0,i.useI18n)();return(0,b.jsx)(J.Dialog,{open:c,onOpenChange:d,children:(0,b.jsxs)(J.DialogContent,{className:"w-[min(960px,92vw)] max-w-none sm:max-w-none h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0",children:[(0,b.jsx)("h3",{className:"text-sm font-medium truncate px-5 py-3 border-b border-border/50",children:a?.title}),(0,b.jsx)("div",{className:"flex-1 overflow-auto px-5 py-4",children:a&&a.content.trim()?(0,b.jsx)("div",{className:"text-sm leading-relaxed",children:(0,b.jsx)(a_.Streamdown,{children:a.content})}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:e("taskPage.noteEmpty")})})]})})}var a1=a.i(161181);let a2=/\.(txt|md|json)$/i;function a3({taskId:a,projectId:d}){let{t:e}=(0,i.useI18n)(),f=(0,c.useRef)(null),[g,h]=(0,c.useState)([]),[j,k]=(0,c.useState)([]),[m,n]=(0,c.useState)(!1),[p,q]=(0,c.useState)(""),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(!1),[v,w]=(0,c.useState)(null),[x,y]=(0,c.useState)(null);async function z(){p.trim()&&(await (0,aT.createNote)({title:p.trim(),content:r.trim(),projectId:d,taskId:a,category:"task"}),q(""),s(""),n(!1),aU(a).then(h))}async function A(a){await (0,aV.deleteNote)(a),h(b=>b.filter(b=>b.id!==a))}async function B(b){let c=b.target.files?.[0];if(c){u(!0);try{let b=new FormData;b.set("file",c),b.set("projectId",d),b.set("taskId",a),await (0,aX.uploadAsset)(b),aW(a).then(k)}finally{u(!1),f.current&&(f.current.value="")}}}async function D(a){await (0,aY.deleteAsset)(a),k(b=>b.filter(b=>b.id!==a))}function E(a){return(0,a1.isImageAsset)(a.filename,a.mimeType)||a2.test(a.filename)}function F(a){E(a)?w(a):al.toast.info(e("assets.previewNotSupported"))}async function G(a){try{let b=await fetch("/api/internal/assets/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a.path})});if(!b.ok){let a=await b.json().catch(()=>({}));al.toast.error(a.error||"Failed to reveal file")}}catch{al.toast.error("Failed to reveal file")}}(0,c.useEffect)(()=>{aU(a).then(h),aW(a).then(k)},[a]);let H=v?(0,a1.isImageAsset)(v.filename,v.mimeType)?"image":a2.test(v.filename)?"text":null:null,I=j.filter(a=>(0,a1.isImageAsset)(a.filename,a.mimeType)).map(a=>({id:a.id,url:(0,a1.localPathToApiUrl)(a.path),filename:a.filename})),J=v?I.findIndex(a=>a.id===v.id):-1;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(K.ScrollArea,{className:"h-full",children:(0,b.jsxs)("div",{className:"flex flex-col",children:[(0,b.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,b.jsx)(S.FileText,{className:"h-3.5 w-3.5"}),e("taskPage.notes")]}),(0,b.jsxs)(o.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>n(!m),children:[m?(0,b.jsx)(aR.X,{className:"h-3 w-3"}):(0,b.jsx)(l.Plus,{className:"h-3 w-3"}),m?"":e("taskPage.addNote")]})]}),m&&(0,b.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,b.jsx)("input",{type:"text",value:p,onChange:a=>q(a.target.value),placeholder:e("taskPage.noteTitle"),className:"h-8 w-full rounded-md border border-border bg-background px-3 text-sm focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),(0,b.jsx)("textarea",{value:r,onChange:a=>s(a.target.value),placeholder:e("taskPage.noteContent"),rows:3,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-primary resize-none"}),(0,b.jsx)(o.Button,{className:"text-xs",onClick:z,disabled:!p.trim(),children:e("taskPage.addNote")})]}),(0,b.jsxs)("div",{className:"mt-2 space-y-2",children:[0===g.length&&!m&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:e("taskPage.noNotes")}),g.map(a=>(0,b.jsx)("div",{className:"group rounded-md border border-border bg-card p-3",children:(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>y(a),className:"min-w-0 flex-1 cursor-pointer text-left",title:e("taskPage.previewNote"),children:[(0,b.jsx)("h4",{className:"text-sm font-medium truncate hover:underline",children:a.title}),a.content&&(0,b.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-3 whitespace-pre-wrap",children:a.content}),(0,b.jsx)("p",{className:"mt-1 text-[10px] text-muted-foreground",children:new Date(a.createdAt).toLocaleString()})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>y(a),className:"text-muted-foreground hover:bg-accent",title:e("taskPage.previewNote"),children:(0,b.jsx)(aS.Eye,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>A(a.id),className:"text-muted-foreground hover:bg-destructive/10 hover:text-destructive",title:e("taskPage.deleteNote"),children:(0,b.jsx)(C.Trash2,{className:"h-3.5 w-3.5"})})]})]})},a.id))]})]}),(0,b.jsxs)("div",{className:"px-4 py-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("h3",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[(0,b.jsx)(aQ,{className:"h-3.5 w-3.5"}),e("taskPage.attachments")]}),(0,b.jsxs)(o.Button,{variant:"ghost",className:"h-6 gap-1 px-2 text-xs",onClick:()=>f.current?.click(),disabled:t,children:[(0,b.jsx)(aP.Upload,{className:"h-3 w-3"}),e("taskPage.uploadFile")]}),(0,b.jsx)("input",{ref:f,type:"file",className:"hidden",onChange:B})]}),(0,b.jsxs)("div",{className:"mt-2 space-y-1.5",children:[0===j.length&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:e("taskPage.noAttachments")}),j.map(a=>{var c;let d=E(a);return(0,b.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border bg-card px-3 py-2",children:[(0,b.jsx)(aQ,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,b.jsx)("button",{type:"button",onClick:()=>F(a),disabled:!d,className:`min-w-0 flex-1 truncate text-left text-sm ${d?"cursor-pointer hover:underline":"cursor-default"}`,title:d?e("assets.preview"):a.filename,children:a.filename}),(0,b.jsx)("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:(c=a.size)?c<1024?`${c} B`:c<1048576?`${(c/1024).toFixed(1)} KB`:`${(c/1024/1024).toFixed(1)} MB`:""}),(0,b.jsxs)("div",{className:"flex items-center gap-0.5",children:[d&&(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>F(a),className:"shrink-0 text-muted-foreground hover:bg-accent",title:e("assets.preview"),children:(0,b.jsx)(aS.Eye,{className:"h-3 w-3"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>G(a),className:"shrink-0 text-muted-foreground hover:bg-accent",title:e("assets.revealInFinder"),children:(0,b.jsx)(T.FolderOpen,{className:"h-3 w-3"})}),(0,b.jsx)(o.Button,{variant:"ghost",size:"icon-xs",onClick:()=>D(a.id),className:"shrink-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",title:e("taskPage.deleteAttachment"),children:(0,b.jsx)(C.Trash2,{className:"h-3 w-3"})})]})]},a.id)})]})]})]})}),(0,b.jsx)(aZ.ImageLightbox,{imageUrl:"image"===H&&J>=0?I[J].url:null,filename:"image"===H&&J>=0?I[J].filename:"",open:"image"===H,onOpenChange:a=>{a||w(null)},assets:I.map(({url:a,filename:b})=>({url:a,filename:b})),currentIndex:J>=0?J:void 0,onIndexChange:a=>{let b=I[a];if(!b)return;let c=j.find(a=>a.id===b.id);c&&w(c)}}),(0,b.jsx)(a$.TextPreviewDialog,{url:"text"===H&&v?(0,a1.localPathToApiUrl)(v.path):null,filename:v?.filename??"",open:"text"===H,onOpenChange:a=>{a||w(null)}}),(0,b.jsx)(a0,{note:x,open:null!==x,onOpenChange:a=>{a||y(null)}})]})}function a4({task:a,workspaceId:e,projectLocalPath:f,onClose:g}){let{t:h}=(0,i.useI18n)(),j=(0,d.useRouter)(),{removePortal:k}=(0,aE.useTerminalPortal)(),[l,m]=(0,c.useState)("terminal"),[n,p]=(0,c.useState)(null),[r,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)(a.status);(0,c.useEffect)(()=>{u(a.status)},[a.status]);let[v,w]=(0,c.useState)(null),[x,y]=(0,c.useState)(!1),[z,A]=(0,c.useState)(!1),[B,C]=(0,c.useState)([]);(0,c.useEffect)(()=>{w(null),y(!1),A(!1),C([]),p(null),m("terminal")},[a.id]);let[D,E]=(0,c.useState)([]),[G,H]=(0,c.useState)(null);(0,c.useEffect)(()=>{let a=!1;return(0,aN.getPrompts)().then(b=>{if(a)return;E(b.map(a=>({id:a.id,name:a.name,isDefault:a.isDefault})));let c=b.find(a=>a.isDefault);c&&H(c.id)}),()=>{a=!0}},[]),(0,c.useEffect)(()=>{w(null),A(!1);let b=!1;return(0,aF.getTaskExecutions)(a.id).then(a=>{if(b)return;let c=a[0];if(c?.status==="RUNNING"){let a=c.worktreePath||f||null;a&&w(a)}C(a.filter(a=>"RUNNING"!==a.status)),A(!0)}),()=>{b=!0}},[a.id]),(0,c.useEffect)(()=>{if("changes"!==l||"TODO"===t||"CANCELLED"===t)return;let b=!1;return s(!0),fetch(`/api/tasks/${a.id}/diff`).then(a=>{if(!a.ok)throw Error(`HTTP ${a.status}`);return a.json()}).then(a=>{b||p(a?.files||a?.branchDeleted?a:null)}).catch(()=>{b||p(null)}).finally(()=>{b||s(!1)}),()=>{b=!0}},[l,t,a.id]);let I=(0,c.useCallback)(async()=>{if(!x){y(!0),k(a.id);try{let b=await (0,aG.startPtyExecutionSafe)(a.id,"",G);if(!b.ok){y(!1),al.toast.error(b.error||h("terminal.startFailed"));return}w(b.worktreePath??null),u("IN_PROGRESS")}catch(a){y(!1),al.toast.error(a instanceof Error&&a.message?a.message:h("terminal.startFailed"))}}},[a.id,x,G,h]),J=(0,c.useCallback)(b=>{y(!1),w(null),k(a.id),0===b&&u("IN_REVIEW"),(0,aF.getTaskExecutions)(a.id).then(a=>{C(a.filter(a=>"RUNNING"!==a.status))}),j.refresh()},[j,a.id]),L=(0,c.useCallback)(async()=>{await (0,aH.stopPtyExecution)(a.id),y(!1),k(a.id),w(null),u("IN_REVIEW"),(0,aF.getTaskExecutions)(a.id).then(a=>{C(a.filter(a=>"RUNNING"!==a.status))}),j.refresh()},[a.id,j]),M=(0,c.useCallback)(async b=>{y(!0),k(a.id),w(null);try{let{worktreePath:c}=await (0,aI.resumePtyExecution)(a.id,b);w(c),u("IN_PROGRESS")}catch{y(!1)}},[a.id,k]),N=(0,c.useCallback)(async()=>{y(!0),k(a.id),w(null);try{let{worktreePath:b}=await (0,aJ.continueLatestPtyExecution)(a.id);w(b),u("IN_PROGRESS")}catch(a){y(!1),al.toast.error(a instanceof Error?a.message:String(a))}},[a.id,k]),[O,P]=(0,c.useState)(!1),[Q,R]=(0,c.useState)([]),T=(0,c.useCallback)(async()=>{try{let b=await (0,aL.checkWorktreeClean)(a.id);if(b.hasWorktree&&!b.clean)return void al.toast.error(h("taskPage.uncommittedChanges",{count:String(b.files.length)}));if(b.hasWorktree&&b.clean&&!b.hasCommits)return void al.toast.error(h("taskPage.noChangesToComplete"),{action:{label:h("taskPage.markAsCancelled"),onClick:()=>{(0,aK.updateTaskStatus)(a.id,"CANCELLED").then(()=>{u("CANCELLED"),al.toast.success(h("taskPage.taskCancelled")),j.refresh()}).catch(()=>al.toast.error("Failed to cancel task"))}}});if(b.hasWorktree&&b.hasCommits){R(b.commitLog),P(!0);return}await (0,aK.updateTaskStatus)(a.id,"DONE"),u("DONE"),al.toast.success(h("taskPage.taskCompleted")),j.refresh()}catch{al.toast.error("Failed to complete task")}},[a.id,j,h]),U=(0,c.useCallback)(()=>{u("DONE"),P(!1),al.toast.success(h("taskPage.taskCompleted")),j.refresh()},[j,h]),V=(0,c.useCallback)(async b=>{try{let{hash:c}=await (0,aM.commitWorktreeChanges)(a.id,b);al.toast.success(h("diff.commitSuccess",{hash:c})),j.refresh();let d=await fetch(`/api/tasks/${a.id}/diff`);if(d.ok){let a=await d.json();p(a?.files?a:null)}}catch(a){al.toast.error(a instanceof Error?a.message:"Commit failed")}},[a.id,j,h]);return(0,b.jsxs)("div",{className:"flex h-full w-[600px] flex-shrink-0 flex-col border-l border-border bg-sidebar","data-testid":"task-detail-panel",children:[(0,b.jsx)(aB,{title:a.title,description:h("taskDetail.panelDescription"),branch:`task/${a.id}`,baseBranch:a.baseBranch,version:a.version??null,hasConversation:!1,updatedAt:a.updatedAt,openDir:v??(f?a.subPath?`${f}/${a.subPath}`:f:null),onBack:g}),(0,b.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-2",children:[(0,b.jsxs)("div",{className:"flex gap-1",children:[(0,b.jsxs)("button",{onClick:()=>m("terminal"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"terminal"===l?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,b.jsx)($.Terminal,{className:"h-3 w-3"}),h("terminal.execute")]}),(0,b.jsx)("button",{onClick:()=>m("changes"),className:`px-3 py-1 text-xs font-medium rounded-md ${"changes"===l?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:h("taskPage.changes")}),(0,b.jsxs)("button",{onClick:()=>m("notes"),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md ${"notes"===l?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,b.jsx)(S.FileText,{className:"h-3 w-3"}),h("taskPage.notes")]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:["IN_REVIEW"===t&&(0,b.jsxs)(o.Button,{size:"sm",onClick:T,className:"bg-emerald-500/15 text-emerald-400 ring-1 ring-emerald-500/20 hover:bg-emerald-500/25",children:[(0,b.jsx)(ay.CheckCircle2,{className:"h-3 w-3"}),h("taskPage.completeTask")]}),"DONE"!==t&&"CANCELLED"!==t&&(0,b.jsxs)(o.Button,{variant:"ghost",size:"sm",onClick:()=>j.push(`/workspaces/${e}/tasks/${a.id}`),className:"text-muted-foreground",children:[(0,b.jsx)(aw.ExternalLink,{className:"h-3 w-3"}),h("taskPage.viewDetails")]})]})]}),"terminal"===l?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:z?v?(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsxs)("div",{className:"shrink-0 flex items-center justify-between border-b border-neutral-800 px-3 py-2 bg-[#0f1419]",children:[(0,b.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-emerald-400",children:[(0,b.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"}),h("execution.running")]}),(0,b.jsxs)(F.Tooltip,{children:[(0,b.jsxs)(F.TooltipTrigger,{onClick:L,className:"flex items-center gap-1.5 rounded-md bg-red-500/15 px-3 py-1 text-xs font-medium text-red-400 hover:bg-red-500/25 transition-colors",children:[(0,b.jsx)(ax.Square,{className:"h-3 w-3"}),h("terminal.stopExecution")]}),(0,b.jsx)(F.TooltipContent,{side:"bottom",children:h("terminal.stopHint")})]})]}),(0,b.jsx)("div",{className:"flex-1 min-h-0",children:(0,b.jsx)(aE.TerminalOutlet,{taskId:a.id,worktreePath:v,onSessionEnd:J})})]}):"DONE"===t||"CANCELLED"===t?(0,b.jsx)("div",{className:"flex h-full flex-col overflow-hidden",children:(0,b.jsx)(K.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)(aO.ExecutionTimeline,{executions:B})})}):(0,b.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,b.jsxs)("div",{className:"shrink-0 flex items-center gap-2 border-b border-border px-4 py-3",children:[D.length>0&&(0,b.jsxs)(q.Select,{defaultValue:G??"none",onValueChange:a=>H("none"===a?null:a),children:[(0,b.jsx)(q.SelectTrigger,{size:"sm",className:"min-w-[120px]",children:(0,b.jsx)("span",{className:"text-left truncate",children:G?D.find(a=>a.id===G)?.name??h("terminal.noPrompt"):h("terminal.noPrompt")})}),(0,b.jsxs)(q.SelectContent,{className:"min-w-[200px]",children:[(0,b.jsx)(q.SelectItem,{value:"none",children:h("terminal.noPrompt")}),D.map(a=>(0,b.jsxs)(q.SelectItem,{value:a.id,children:[a.name,a.isDefault?" ★":""]},a.id))]})]},`prompt-${D.length}`),(0,b.jsxs)(o.Button,{onClick:I,disabled:x,size:"sm",className:"gap-2 px-4",children:[x?(0,b.jsx)(W.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,b.jsx)($.Terminal,{className:"h-3.5 w-3.5"}),x?h("terminal.executing"):h("terminal.launch")]})]}),(0,b.jsx)(K.ScrollArea,{className:"flex-1 min-h-0",children:(0,b.jsx)(aO.ExecutionTimeline,{executions:B,onResume:M,onContinueLatest:N})})]}):(0,b.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 bg-[#0f1419]",children:[(0,b.jsx)(W.Loader2,{className:"size-5 animate-spin text-neutral-500"}),(0,b.jsx)("span",{className:"text-xs text-neutral-500",children:h("execution.loading")})]})}):"changes"===l?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:r?(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.loadingDiff")})}):n?.branchDeleted?(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.branchDeleted")})}):n?(0,b.jsx)(aC.TaskDiffView,{taskId:a.id,files:n.files,totalAdded:n.totalAdded,totalRemoved:n.totalRemoved,hasConflicts:n.hasConflicts,conflictFiles:n.conflictFiles,onCommit:V,hasUncommitted:n.hasUncommitted}):(0,b.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:h("taskPage.noChanges")})})}):"notes"===l?(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:(0,b.jsx)(a3,{taskId:a.id,projectId:a.projectId})}):null,(0,b.jsx)(aD.TaskMergeConfirmDialog,{open:O,onOpenChange:P,taskId:a.id,taskTitle:a.title,baseBranch:a.baseBranch??"main",fileCount:n?.files?.length??0,commitCount:n?.commitCount??0,commitLog:Q,onMergeComplete:U})]})}var a5=a.i(427554),a6=a.i(392260);let a7=(0,ab.createServerReference)("4013b9828f76da6ef384da254c66fd3fc8ecdf3bc9",ab.callServer,void 0,ab.findSourceMapURL,"deleteTask"),a8=(0,ab.createServerReference)("4053189dd4be4a63b0b6ebbe38776b3175fe73347e",ab.callServer,void 0,ab.findSourceMapURL,"toggleTaskPinned");var a9=a.i(266437);let ba=(0,ab.createServerReference)("401fa8f1bf774434d568a2918568d4ed0e14d9e711",ab.callServer,void 0,ab.findSourceMapURL,"getVersionsForPicker");var bb=a.i(912868);function bc({projects:a,activeProjectId:d,onSelect:e}){let f=(0,c.useRef)(null),[g,h]=(0,c.useState)(!1),[i,j]=(0,c.useState)(!1),k=()=>{let a=f.current;a&&(h(a.scrollLeft>0),j(a.scrollLeft<a.scrollWidth-a.clientWidth-1))};(0,c.useEffect)(()=>{k();let a=f.current;if(a){a.addEventListener("scroll",k);let b=new ResizeObserver(k);return b.observe(a),()=>{a.removeEventListener("scroll",k),b.disconnect()}}},[a]);let l=a=>{let b=f.current;b&&b.scrollBy({left:"left"===a?-150:150,behavior:"smooth"})};return(0,b.jsxs)("div",{className:"relative flex items-center",children:[g&&(0,b.jsx)("button",{onClick:()=>l("left"),className:"absolute left-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,b.jsx)(bb.ChevronLeft,{className:"h-4 w-4"})}),(0,b.jsx)("div",{ref:f,className:"flex items-center gap-1.5 overflow-x-auto scrollbar-none px-1 py-1",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:a.map(a=>{let c=d===a.id;return(0,b.jsxs)("button",{onClick:()=>{c||e(a.id)},className:`shrink-0 rounded-lg border-b-2 px-4 py-2 text-sm font-medium transition-colors ${c?"border-primary bg-primary/10 text-primary ring-1 ring-primary/20 cursor-default":"border-transparent text-muted-foreground hover:bg-accent hover:text-foreground cursor-pointer"}`,children:[(0,b.jsx)("span",{children:a.name}),a.alias&&(0,b.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:a.alias})]},a.id)})}),i&&(0,b.jsx)("button",{onClick:()=>l("right"),className:"absolute right-0 z-10 flex h-8 w-8 items-center justify-center rounded-md bg-background/90 text-muted-foreground shadow-sm ring-1 ring-border backdrop-blur-sm transition-colors hover:text-foreground",children:(0,b.jsx)(R.ChevronRight,{className:"h-4 w-4"})})]})}var bd=a.i(811344);function be({open:a,onOpenChange:c,taskTitle:d,uncommittedFiles:e,commitLog:f,onConfirm:g}){let{t:h}=(0,i.useI18n)(),j=e.length,k=f.length,l=0===j&&0===k;return(0,b.jsx)(J.Dialog,{open:a,onOpenChange:c,children:(0,b.jsxs)(J.DialogContent,{showCloseButton:!0,className:"sm:max-w-md",children:[(0,b.jsx)(J.DialogHeader,{children:(0,b.jsxs)(J.DialogTitle,{className:"flex items-center gap-2",children:[(0,b.jsx)(bd.AlertTriangle,{className:"h-4 w-4 text-amber-400"}),h("taskCancel.title")]})}),(0,b.jsxs)("div",{className:"space-y-3 py-2",children:[(0,b.jsxs)("div",{className:"rounded-lg border border-amber-500/20 bg-amber-500/10 p-3 space-y-1.5",children:[(0,b.jsx)("p",{className:"text-xs text-foreground",children:h("taskCancel.intro",{title:d})}),(0,b.jsx)("p",{className:"text-xs text-amber-300",children:h("taskCancel.irreversible")})]}),l?(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:h("taskCancel.cleanNotice")}):(0,b.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 p-3 space-y-2.5",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:h("taskCancel.uncommittedFiles")}),(0,b.jsx)("span",{className:"text-xs font-medium text-foreground",children:j})]}),(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:h("taskCancel.unmergedCommits")}),(0,b.jsx)("span",{className:"text-xs font-medium text-foreground",children:k})]})]}),j>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground mb-1 block",children:h("taskCancel.filesList")}),(0,b.jsx)("div",{className:"rounded-md border border-border bg-muted/30 p-2 space-y-1 max-h-32 overflow-y-auto",children:e.map((a,c)=>(0,b.jsx)("div",{className:"text-xs font-mono text-foreground/80",children:a},c))})]}),k>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground mb-1 block",children:h("taskCancel.commitsList")}),(0,b.jsx)("div",{className:"rounded-md border border-border bg-muted/30 p-2 space-y-1 max-h-32 overflow-y-auto",children:f.map((a,c)=>(0,b.jsx)("div",{className:"text-xs font-mono text-foreground/80",children:a},c))}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground mt-1.5",children:h("taskCancel.reflogHint")})]})]}),(0,b.jsxs)(J.DialogFooter,{children:[(0,b.jsx)(o.Button,{variant:"outline",onClick:()=>c(!1),children:h("taskCancel.keep")}),(0,b.jsxs)(o.Button,{variant:"destructive",onClick:g,className:"gap-2",children:[(0,b.jsx)(bd.AlertTriangle,{className:"h-4 w-4"}),h("taskCancel.confirm")]})]})]})})}a.s(["BoardPageClient",0,function({workspaceId:a,projectId:e,project:f,projects:g,initialTasks:h,labels:k,openTaskId:l}){let m=(0,d.useRouter)(),{t:n}=(0,i.useI18n)(),[,o]=(0,c.useTransition)(),[p,q]=(0,c.useState)(""),[s,t]=(0,c.useState)("all"),[v,w]=(0,c.useState)(!1),[x,y]=(0,c.useState)("TODO"),[z,A]=(0,c.useState)(l??null),[B,C]=(0,c.useState)([]),D=z?h.find(a=>a.id===z)??null:null,[E,F]=(0,c.useState)(null),[G,H]=(0,c.useState)(null),[I,J]=(0,c.useState)(null);(0,c.useEffect)(()=>{ba(e).then(C).catch(()=>C([]))},[e]);let K=B.find(a=>a.isCurrent)?.id??null,L=(0,c.useCallback)(()=>{o(()=>{m.refresh()})},[m]);(0,c.useEffect)(()=>{if(v)return;let a=setInterval(()=>{o(()=>{m.refresh()})},5e3);return()=>clearInterval(a)},[m,v]);let M=(0,c.useCallback)(a=>{q(a)},[]),P=(0,c.useCallback)(async a=>{let b=h.find(b=>b.id===a);if(b)try{let c=await (0,aL.checkWorktreeClean)(a);if(c.hasWorktree&&!c.clean){al.toast.error(n("taskPage.uncommittedChanges",{count:String(c.files.length)})),L();return}if(c.hasWorktree&&c.clean&&!c.hasCommits){al.toast.error(n("taskPage.noChangesToComplete"),{action:{label:n("taskPage.markAsCancelled"),onClick:()=>{(0,aK.updateTaskStatus)(a,"CANCELLED").then(()=>{al.toast.success(n("taskPage.taskCancelled")),L()}).catch(()=>al.toast.error("Failed to cancel task"))}}}),L();return}if(c.hasWorktree&&c.hasCommits){H({task:b,commitLog:c.commitLog,commitCount:c.commitLog.length}),L();return}await (0,aK.updateTaskStatus)(a,"DONE"),al.toast.success(n("taskPage.taskCompleted")),L()}catch{al.toast.error("Failed to complete task"),L()}},[h,L,n]),Q=(0,c.useCallback)(async a=>{let b=h.find(b=>b.id===a);if(b)try{let c=await (0,aL.checkWorktreeClean)(a);if(!c.hasWorktree){await (0,aK.updateTaskStatus)(a,"CANCELLED"),al.toast.success(n("taskPage.taskCancelled")),L();return}J({task:b,files:c.files,commitLog:c.commitLog}),L()}catch{al.toast.error("Failed to cancel task"),L()}},[h,L,n]),R=(0,c.useCallback)(async(a,b)=>{"DONE"===b?await P(a):"CANCELLED"===b?await Q(a):(await (0,aK.updateTaskStatus)(a,b),L())},[L,P,Q]),S=(0,c.useCallback)(async a=>{let b=await (0,a5.createTask)({title:a.title,description:a.description,projectId:e,priority:a.priority,status:a.status,labelIds:a.labelIds,baseBranch:a.baseBranch,subPath:a.subPath,versionId:a.versionId??void 0});if(a.autoStart&&b?.id)try{await (0,a9.startPtyExecution)(b.id,""),A(b.id)}catch(a){al.toast.error(a instanceof Error?a.message:String(a))}L()},[e,L]),T=(0,c.useCallback)(async(a,b)=>{await (0,a6.updateTask)(a,{...b,labelIds:b.labelIds}),F(null),L()},[L]),U=(0,c.useCallback)(async a=>{await a7(a),z===a&&A(null),L()},[L,z]),V=(0,c.useCallback)(async a=>{await a8(a),L()},[L]),W=(0,c.useCallback)(async b=>{try{await (0,a9.startPtyExecution)(b,"")}catch(a){al.toast.error(a instanceof Error?a.message:String(a))}m.push(`/workspaces/${a}/tasks/${b}`)},[m,a]),X=(0,c.useCallback)(async(a,b)=>{"DONE"===b?await P(a):"CANCELLED"===b?await Q(a):(await (0,aK.updateTaskStatus)(a,b),L())},[L,P,Q]),Y=(0,c.useCallback)(a=>{y(a),F(null),w(!0)},[]),Z=(0,c.useCallback)(a=>{F(a),w(!0)},[]),$=h.filter(a=>!a.labels?.some(a=>a.label.name===u.TOWER_LABEL_NAME&&a.label.isBuiltin)),_=$.filter(a=>{if("backlog"===s){if(a.versionId)return!1}else if("all"!==s&&a.versionId!==s)return!1;if(p.trim()){let b=p.toLowerCase();if(!a.title.toLowerCase().includes(b)&&!a.description?.toLowerCase().includes(b))return!1}return!0});return(0,b.jsxs)("div",{className:"flex h-full",children:[(0,b.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,b.jsx)("div",{className:"px-6 pt-3 pb-1",children:(0,b.jsx)(bc,{projects:g,activeProjectId:e,onSelect:b=>m.push(`/workspaces/${a}?projectId=${b}`,{scroll:!1})})}),(0,b.jsx)(j,{totalTasks:$.length,runningTasks:$.filter(a=>"IN_PROGRESS"===a.status).length}),(0,b.jsx)(r,{searchQuery:p,onSearchChange:M,versions:B,versionFilter:s,onVersionFilterChange:t,versionsHref:`/workspaces/${a}/projects/${e}/versions`,onCreateTask:()=>{F(null),w(!0)}}),(0,b.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden p-4",children:(0,b.jsx)(N,{initialTasks:_,onTaskMove:R,onTaskClick:a=>{A(a.id)},onEditTask:Z,onAddTask:Y,onDeleteTask:U,onTogglePin:V,workspaceId:a,onContextMenuStatusChange:X,onContextMenuLaunch:W})}),(0,b.jsx)(O.CreateTaskDialog,{open:v,onOpenChange:a=>{w(a),a||F(null)},onSubmit:S,onUpdate:T,defaultStatus:x,editTask:E,editTaskLabelIds:E?.labels?E.labels.map(a=>a.labelId):[],labels:k.filter(a=>!(a.name===u.TOWER_LABEL_NAME&&a.isBuiltin)),projectType:f.type,projectLocalPath:f.localPath,versions:B,defaultVersionId:K})]}),D?(0,b.jsx)(a4,{task:D,workspaceId:a,projectLocalPath:f.localPath,onClose:()=>A(null)}):(0,b.jsx)(av,{project:f,workspaceId:a}),G&&(0,b.jsx)(aD.TaskMergeConfirmDialog,{open:!0,onOpenChange:a=>{a||H(null)},taskId:G.task.id,taskTitle:G.task.title,baseBranch:G.task.baseBranch??"main",fileCount:0,commitCount:G.commitCount,commitLog:G.commitLog,onMergeComplete:()=>{H(null),al.toast.success(n("taskPage.taskCompleted")),L()}}),I&&(0,b.jsx)(be,{open:!0,onOpenChange:a=>{a||J(null)},taskTitle:I.task.title,uncommittedFiles:I.files,commitLog:I.commitLog,onConfirm:()=>{let a=I.task.id;J(null),(0,aK.updateTaskStatus)(a,"CANCELLED").then(()=>{al.toast.success(n("taskPage.taskCancelled")),L()}).catch(()=>al.toast.error("Failed to cancel task"))}})]})}],473935)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=src_app_workspaces_%5BworkspaceId%5D_board-page-client_tsx_0gips66._.js.map
|