@open-mercato/cezar 0.15.0 → 0.15.1
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/dist/automations/github-poller.d.ts +8 -1
- package/dist/automations/github-poller.js +78 -13
- package/dist/automations/github-poller.js.map +1 -1
- package/dist/automations/pr-head.js +15 -1
- package/dist/automations/pr-head.js.map +1 -1
- package/dist/automations/prompts.js +2 -2
- package/dist/automations/types.d.ts +10 -0
- package/dist/automations/types.js +12 -1
- package/dist/automations/types.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/contract/automations.d.ts +31 -1
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +161 -17
- package/dist/contract/projects.d.ts +46 -0
- package/dist/contract/runs.d.ts +15 -0
- package/dist/contract/skills.d.ts +1 -0
- package/dist/contract/telemetry.d.ts +124 -0
- package/dist/contract/workspace.d.ts +3 -0
- package/dist/core/cursor-agent-runner.d.ts +11 -0
- package/dist/core/cursor-agent-runner.js +48 -4
- package/dist/core/cursor-agent-runner.js.map +1 -1
- package/dist/core/disclaim-spawn.d.ts +10 -0
- package/dist/core/disclaim-spawn.js +105 -8
- package/dist/core/disclaim-spawn.js.map +1 -1
- package/dist/git-diff-base.js +26 -19
- package/dist/git-diff-base.js.map +1 -1
- package/dist/git-remotes.d.ts +43 -0
- package/dist/git-remotes.js +127 -0
- package/dist/git-remotes.js.map +1 -0
- package/dist/git-worktree.d.ts +43 -19
- package/dist/git-worktree.js +138 -54
- package/dist/git-worktree.js.map +1 -1
- package/dist/index.js +46 -6
- package/dist/index.js.map +1 -1
- package/dist/runs/auto-name.d.ts +17 -0
- package/dist/runs/auto-name.js +47 -2
- package/dist/runs/auto-name.js.map +1 -1
- package/dist/runs/event-history.d.ts +10 -2
- package/dist/runs/event-history.js +290 -120
- package/dist/runs/event-history.js.map +1 -1
- package/dist/runs/retention.js +1 -1
- package/dist/runs/retention.js.map +1 -1
- package/dist/runs/store.d.ts +16 -3
- package/dist/runs/store.js +89 -10
- package/dist/runs/store.js.map +1 -1
- package/dist/server/checkout.d.ts +4 -0
- package/dist/server/checkout.js +9 -5
- package/dist/server/checkout.js.map +1 -1
- package/dist/server/create-project.d.ts +77 -0
- package/dist/server/create-project.js +342 -0
- package/dist/server/create-project.js.map +1 -0
- package/dist/server/forge/github.d.ts +2 -0
- package/dist/server/forge/github.js +32 -10
- package/dist/server/forge/github.js.map +1 -1
- package/dist/server/forge/index.d.ts +1 -12
- package/dist/server/forge/index.js +7 -29
- package/dist/server/forge/index.js.map +1 -1
- package/dist/server/forge/types.d.ts +2 -0
- package/dist/server/git-changes.d.ts +15 -0
- package/dist/server/git-changes.js +51 -1
- package/dist/server/git-changes.js.map +1 -1
- package/dist/server/git.d.ts +3 -2
- package/dist/server/git.js +4 -3
- package/dist/server/git.js.map +1 -1
- package/dist/server/project-context.js +1 -1
- package/dist/server/project-context.js.map +1 -1
- package/dist/server/server.d.ts +609 -302
- package/dist/server/server.js +191 -12
- package/dist/server/server.js.map +1 -1
- package/dist/server/star-count.d.ts +27 -11
- package/dist/server/star-count.js +57 -28
- package/dist/server/star-count.js.map +1 -1
- package/dist/telemetry-cli.d.ts +10 -0
- package/dist/telemetry-cli.js +54 -0
- package/dist/telemetry-cli.js.map +1 -0
- package/dist/telemetry-service.json +1 -0
- package/dist/telemetry.d.ts +79 -0
- package/dist/telemetry.js +453 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/workflows/run.d.ts +28 -0
- package/dist/workflows/run.js +111 -16
- package/dist/workflows/run.js.map +1 -1
- package/dist/workspace/config.d.ts +10 -0
- package/dist/workspace/config.js +16 -0
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/projects-cli.js +3 -0
- package/dist/workspace/projects-cli.js.map +1 -1
- package/package.json +3 -3
- package/scripts/mock-claude.mjs +32 -17
- package/scripts/stamp-telemetry-service.mjs +20 -0
- package/web/dist/assets/agent-task-pickers-mJzYn0UB.js +1 -0
- package/web/dist/assets/{alert-dialog-CF_-dmQ1.js → alert-dialog-Dd1WPOaz.js} +1 -1
- package/web/dist/assets/arrow-left-fsST4JqT.js +1 -0
- package/web/dist/assets/{automation-format-D1nqk0ID.js → automation-format-BTIFWfjt.js} +1 -1
- package/web/dist/assets/automations-route-DJjhwqug.js +1 -0
- package/web/dist/assets/button-BNnH7COh.js +100 -0
- package/web/dist/assets/{centered-state-T0J7VmBb.js → centered-state-sEYB3bgq.js} +1 -1
- package/web/dist/assets/check-DA37PQLT.js +1 -0
- package/web/dist/assets/chevron-left-zbXV2Qbu.js +1 -0
- package/web/dist/assets/chevron-right-Beu1pd6H.js +1 -0
- package/web/dist/assets/{collapsible-RD4hkew7.js → collapsible-MuXfYnM8.js} +1 -1
- package/web/dist/assets/commit-list-Bps23fvP.js +1 -0
- package/web/dist/assets/compare-variants-CQskdfDW.js +1 -0
- package/web/dist/assets/composer-DKWLJeo9.js +18 -0
- package/web/dist/assets/dashboard-BCNe_6p7.js +44 -0
- package/web/dist/assets/diff-CrLUECGW.js +3 -0
- package/web/dist/assets/{diff-stat-CFoeFye2.js → diff-stat-SpfygteL.js} +1 -1
- package/web/dist/assets/diff-view-DP4Gw3QJ.js +13 -0
- package/web/dist/assets/{download-BFQEsJRY.js → download-CBwSbmy_.js} +1 -1
- package/web/dist/assets/dropdown-menu-CxPGHgWX.js +1 -0
- package/web/dist/assets/ellipsis-BmusVE8U.js +1 -0
- package/web/dist/assets/{file-Df5WtpM_.js → file-DkvcUwxT.js} +1 -1
- package/web/dist/assets/file-preview-DxFusXAO.js +2 -0
- package/web/dist/assets/file-text-DBeC0yKb.js +1 -0
- package/web/dist/assets/file-tree-BTJZXRkM.js +1 -0
- package/web/dist/assets/{git-commit-horizontal-DawNm4qg.js → git-commit-horizontal-BM9_nEW7.js} +1 -1
- package/web/dist/assets/git-toolbar-DXyPCDkQ.js +1 -0
- package/web/dist/assets/github-G5fU4gJd.js +1 -0
- package/web/dist/assets/index-BN3w52uE.js +21 -0
- package/web/dist/assets/index-CAvSSpvF.css +2 -0
- package/web/dist/assets/{markdown-Bmfy_1Ll.js → markdown-BpZ4p95p.js} +1 -1
- package/web/dist/assets/{markdown-B_O1ys3h.js → markdown-C5F95Rt-.js} +1 -1
- package/web/dist/assets/{message-square-BOO9s3qX.js → message-square-BFQln9c4.js} +1 -1
- package/web/dist/assets/{pill-bO5OcHuK.js → pill-BcIQGDbn.js} +1 -1
- package/web/dist/assets/project-router-CWMOKp_H.js +3 -0
- package/web/dist/assets/reference-chip-B7lU_Pyh.js +1 -0
- package/web/dist/assets/reference-overflow-ClRRXWez.js +1 -0
- package/web/dist/assets/{refresh-cw-BaFyjVUz.js → refresh-cw-BBEYC6z2.js} +1 -1
- package/web/dist/assets/repo-git-CgxxZ7cO.js +1 -0
- package/web/dist/assets/{run-diff-GZbNs8fA.js → run-diff-BTB7nBeD.js} +1 -1
- package/web/dist/assets/run-header-BPNBEaOy.js +1 -0
- package/web/dist/assets/{image-preview-4SVDrBvn.js → scroll-within-DRt7mAnQ.js} +1 -1
- package/web/dist/assets/{search-x-bpAfQtVY.js → search-x-6BavY3mg.js} +1 -1
- package/web/dist/assets/sheet-D9PeyyRZ.js +1 -0
- package/web/dist/assets/skills-SIMzpL0l.js +1 -0
- package/web/dist/assets/square-DsFAQaY9.js +1 -0
- package/web/dist/assets/tab-link-DEUSZU49.js +1 -0
- package/web/dist/assets/{tag-DLwUkUsN.js → tag-DvCVnA6I.js} +1 -1
- package/web/dist/assets/task-changes-D-aajoMU.js +1 -0
- package/web/dist/assets/task-commits-BYD1GVkS.js +1 -0
- package/web/dist/assets/task-composer-7bdNNMP_.js +12 -0
- package/web/dist/assets/task-files-BfIOz-eN.js +1 -0
- package/web/dist/assets/task-graph-B5-5_IPh.js +1 -0
- package/web/dist/assets/task-notes-CfkTBgo8.js +1 -0
- package/web/dist/assets/task-thread-eEkjTDxr.js +10 -0
- package/web/dist/assets/{terminal-CwrL1hAi.js → terminal-xRHwWarr.js} +1 -1
- package/web/dist/assets/textarea-rKUFh5lI.js +1 -0
- package/web/dist/assets/thread-loading-DLlbK51g.js +1 -0
- package/web/dist/assets/{token-metrics-C149OWmd.js → token-metrics-BcPjL36-.js} +1 -1
- package/web/dist/assets/tooltip-BVqBAGNb.js +1 -0
- package/web/dist/assets/tracker-2DfMzsIE.js +4 -0
- package/web/dist/assets/triangle-alert-CP3Xp0FU.js +1 -0
- package/web/dist/assets/upload-bwO_2kok.js +1 -0
- package/web/dist/assets/use-automations-PceYR6ss.js +5 -0
- package/web/dist/assets/use-now-BAKdIYLG.js +1 -0
- package/web/dist/assets/use-submit-shortcut-BA4NVpJl.js +1 -0
- package/web/dist/assets/workflow-graph-HopaWPea.js +13 -0
- package/web/dist/assets/x-HaVPcg_B.js +1 -0
- package/web/dist/index.html +28 -31
- package/web/dist/assets/agent-task-pickers-C3ydGatB.js +0 -1
- package/web/dist/assets/arrow-left-BxBdc5DC.js +0 -1
- package/web/dist/assets/automations-route-BsflncpV.js +0 -1
- package/web/dist/assets/button-CjSjKnkd.js +0 -100
- package/web/dist/assets/check-DAAMuI4o.js +0 -1
- package/web/dist/assets/chevron-left-CvcqxpQZ.js +0 -1
- package/web/dist/assets/chevron-right-DKiL3NWw.js +0 -1
- package/web/dist/assets/commit-list-BJac2uO6.js +0 -1
- package/web/dist/assets/compare-variants-CfqICvRy.js +0 -1
- package/web/dist/assets/composer-DZx3cwQW.js +0 -18
- package/web/dist/assets/dashboard-CpCDiZdE.js +0 -44
- package/web/dist/assets/diff-LG2cl0PE.js +0 -3
- package/web/dist/assets/diff-controls-QgdH-r3F.js +0 -1
- package/web/dist/assets/diff-view-BVwSaBb2.js +0 -13
- package/web/dist/assets/dropdown-menu-DkEK7m00.js +0 -1
- package/web/dist/assets/editable-title-CJSWyCcL.js +0 -1
- package/web/dist/assets/ellipsis-vertical-CB0adfr7.js +0 -1
- package/web/dist/assets/external-link-DPKRidDg.js +0 -1
- package/web/dist/assets/eye-CEHQ0c-s.js +0 -1
- package/web/dist/assets/file-preview-kYsqZiLU.js +0 -2
- package/web/dist/assets/file-text-m0tZu8sU.js +0 -1
- package/web/dist/assets/git-merge-B7oVXcKc.js +0 -1
- package/web/dist/assets/git-toolbar-B0K4Q5Zv.js +0 -1
- package/web/dist/assets/github-C4WaHPni.js +0 -1
- package/web/dist/assets/index-CiQrbvAq.js +0 -21
- package/web/dist/assets/index-WWaEax-B.css +0 -2
- package/web/dist/assets/pencil-CCR9uUZ1.js +0 -1
- package/web/dist/assets/reference-chip-Bx_mG9QG.js +0 -1
- package/web/dist/assets/repo-git-Mn3_jrGP.js +0 -1
- package/web/dist/assets/run-header-i1D5Lvfs.js +0 -1
- package/web/dist/assets/sheet-DCdZVHFk.js +0 -1
- package/web/dist/assets/skills-Dea5ynJK.js +0 -1
- package/web/dist/assets/tab-link-BVItTl_Y.js +0 -1
- package/web/dist/assets/task-changes-xNbBM7FO.js +0 -1
- package/web/dist/assets/task-commits-BYozE_X3.js +0 -1
- package/web/dist/assets/task-composer-Brx0sa7_.js +0 -12
- package/web/dist/assets/task-files-MAPO-efK.js +0 -1
- package/web/dist/assets/task-graph-BSLCUr1E.js +0 -1
- package/web/dist/assets/task-thread-CRVmwchQ.js +0 -9
- package/web/dist/assets/textarea-Bb0_Hz53.js +0 -1
- package/web/dist/assets/thread-loading-Bo6IOu3Y.js +0 -1
- package/web/dist/assets/toaster-Hj_czp_o.js +0 -3
- package/web/dist/assets/tooltip--PYfu68E.js +0 -1
- package/web/dist/assets/tracker-DM5WtYD0.js +0 -4
- package/web/dist/assets/trash-2-EdjdGvEo.js +0 -1
- package/web/dist/assets/triangle-alert-DpH3QFz6.js +0 -1
- package/web/dist/assets/use-automations-XKvBTPM-.js +0 -5
- package/web/dist/assets/use-now-CrM50BFB.js +0 -1
- package/web/dist/assets/use-submit-shortcut-BJ10ZshV.js +0 -1
- package/web/dist/assets/workflow-graph-Y2Pr7ubb.js +0 -13
- package/web/dist/assets/x-BkwTUDpG.js +0 -1
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dashboard-CpCDiZdE.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/toaster-Hj_czp_o.js","assets/button-CjSjKnkd.js","assets/bundle-mjs-BT31bpU6.js","assets/use-automations-XKvBTPM-.js","assets/sheet-DCdZVHFk.js","assets/x-BkwTUDpG.js","assets/reference-chip-Bx_mG9QG.js","assets/git-merge-B7oVXcKc.js","assets/triangle-alert-DpH3QFz6.js","assets/tooltip--PYfu68E.js","assets/token-metrics-C149OWmd.js","assets/check-DAAMuI4o.js","assets/use-now-CrM50BFB.js","assets/automation-format-D1nqk0ID.js","assets/chevron-right-DKiL3NWw.js","assets/download-BFQEsJRY.js","assets/task-thread-CRVmwchQ.js","assets/editable-title-CJSWyCcL.js","assets/trash-2-EdjdGvEo.js","assets/dropdown-menu-DkEK7m00.js","assets/external-link-DPKRidDg.js","assets/composer-DZx3cwQW.js","assets/use-submit-shortcut-BJ10ZshV.js","assets/run-header-i1D5Lvfs.js","assets/file-text-m0tZu8sU.js","assets/ellipsis-vertical-CB0adfr7.js","assets/centered-state-T0J7VmBb.js","assets/pencil-CCR9uUZ1.js","assets/collapsible-RD4hkew7.js","assets/alert-dialog-CF_-dmQ1.js","assets/diff-stat-CFoeFye2.js","assets/pill-bO5OcHuK.js","assets/markdown-Bmfy_1Ll.js","assets/chunk-BO2N2NFS-MDrqQfMl.js","assets/lib-BxQXEXDF.js","assets/tab-link-BVItTl_Y.js","assets/eye-CEHQ0c-s.js","assets/search-x-bpAfQtVY.js","assets/textarea-Bb0_Hz53.js","assets/thread-loading-Bo6IOu3Y.js","assets/lib-BQXq3kEf.js","assets/image-preview-4SVDrBvn.js","assets/run-diff-GZbNs8fA.js","assets/task-composer-Brx0sa7_.js","assets/file-Df5WtpM_.js","assets/types-BTlmexWF.js","assets/diff-LG2cl0PE.js","assets/compare-variants-CfqICvRy.js","assets/task-changes-xNbBM7FO.js","assets/git-commit-horizontal-DawNm4qg.js","assets/markdown-B_O1ys3h.js","assets/message-square-BOO9s3qX.js","assets/git-toolbar-B0K4Q5Zv.js","assets/diff-controls-QgdH-r3F.js","assets/task-files-MAPO-efK.js","assets/file-preview-kYsqZiLU.js","assets/task-commits-BYozE_X3.js","assets/arrow-left-BxBdc5DC.js","assets/commit-list-BJac2uO6.js","assets/repo-git-Mn3_jrGP.js","assets/github-C4WaHPni.js","assets/chevron-left-CvcqxpQZ.js","assets/refresh-cw-BaFyjVUz.js","assets/tag-DLwUkUsN.js","assets/agent-task-pickers-C3ydGatB.js","assets/tracker-DM5WtYD0.js","assets/task-graph-BSLCUr1E.js","assets/workflow-graph-Y2Pr7ubb.js","assets/terminal-CwrL1hAi.js","assets/workflow-graph-DLioOiRN.css","assets/skills-Dea5ynJK.js","assets/automations-route-BsflncpV.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r,t as i}from"./react-runtime-CCIEwYL0.js";import{$ as a,$i as o,$r as s,$t as c,A as l,Ai as u,An as d,At as f,Bi as p,Bn as m,Bt as h,C as g,Cn as _,Cr as v,D as y,Dn as b,Dr as x,Dt as S,Ei as C,En as w,Et as T,Fi as E,Ft as D,G as O,Gi as k,Gn as A,Gr as j,Gt as M,Hi as N,Hr as P,Ii as F,In as ee,It as te,Ji as I,Jn as ne,Jr as re,Jt as ie,Ki as ae,Kr as oe,Kt as se,Li as L,Ln as ce,Lr as le,Lt as ue,Mi as de,Mt as fe,Ni as pe,Nn as me,O as he,Ot as ge,Pi as _e,Pt as ve,Q as ye,Qi as R,Qr as be,Qt as xe,R as Se,Ri as Ce,Rn as we,Rt as Te,S as Ee,Sn as De,T as Oe,Tn as z,Tt as ke,Ui as Ae,V as je,Vi as Me,Vn as Ne,Vt as Pe,W as Fe,Wr as Ie,Wt as Le,X as Re,Xi as ze,Xn as Be,Xt as Ve,Yi as He,Yt as Ue,Z as We,Zi as Ge,Zr as Ke,Zt as qe,_ as Je,_n as Ye,_r as Xe,_t as Ze,a as Qe,aa as $e,an as et,at as tt,b as nt,bn as rt,c as it,ca as at,ci as ot,cn as st,ct,d as lt,dt as ut,ea as dt,ei as ft,en as pt,er as mt,et as ht,fi as gt,fn as _t,gi as vt,gn as yt,gr as bt,gt as xt,h as St,hi as Ct,hn as wt,i as Tt,ia as Et,it as Dt,ji as Ot,jr as kt,jt as At,ki as jt,kr as Mt,kt as Nt,l as Pt,la as Ft,ln as It,lt as Lt,m as B,mi as Rt,n as V,na as zt,nn as Bt,nt as Vt,o as Ht,oa as Ut,oi as Wt,on as Gt,ot as Kt,pi as qt,q as Jt,qi as Yt,r as H,ra as Xt,rn as Zt,s as Qt,sa as $t,si as en,sn as tn,sr as nn,st as rn,t as an,ta as on,ti as sn,tn as cn,tt as ln,u as un,ui as dn,v as fn,vi as pn,vn as mn,w as hn,wn as gn,x as _n,y as vn,yn,zi as bn,zt as xn}from"./toaster-Hj_czp_o.js";import{A as Sn,At as Cn,B as wn,C as Tn,D as U,E as En,F as W,H as Dn,K as On,N as kn,P as An,S as jn,T as G,W as Mn,_ as Nn,b as Pn,g as Fn,h as In,i as Ln,k as Rn,kt as zn,m as Bn,pt as Vn,q as Hn,r as K,t as q,v as Un,w as Wn,wt as Gn,x as Kn,y as qn}from"./button-CjSjKnkd.js";import{i as Jn}from"./bundle-mjs-BT31bpU6.js";import{C as Yn,D as Xn,E as Zn,O as Qn,S as $n,T as er,_ as tr,a as nr,b as rr,c as ir,d as ar,f as or,g as sr,h as cr,i as lr,k as ur,l as dr,m as fr,p as pr,s as mr,u as hr,v as gr,w as _r,x as vr,y as yr}from"./use-automations-XKvBTPM-.js";import{i as br,n as xr,o as Sr,r as Cr,s as wr,t as Tr}from"./sheet-DCdZVHFk.js";import{B as Er,F as Dr,H as Or,I as kr,L as Ar,M as jr,P as Mr,R as Nr,S as Pr,U as Fr,W as Ir,_ as Lr,c as Rr,d as zr,f as Br,g as Vr,h as Hr,j as Ur,l as Wr,m as Gr,n as Kr,p as qr,s as Jr,t as Yr,u as Xr,v as Zr,x as Qr,y as $r,z as ei}from"./editable-title-CJSWyCcL.js";import{a as ti,c as ni,f as ri,h as ii,i as ai,l as oi,m as si,o as ci,r as li,t as ui}from"./reference-chip-Bx_mG9QG.js";import{A as di,C as fi,D as pi,E as mi,O as hi,S as gi,T as _i,_ as vi,a as yi,b as bi,c as xi,d as Si,g as Ci,h as wi,i as Ti,k as Ei,l as Di,m as Oi,n as ki,o as Ai,p as ji,r as Mi,s as Ni,t as Pi,u as Fi,v as Ii,w as Li,y as Ri}from"./composer-DZx3cwQW.js";import{n as zi,r as Bi,t as Vi}from"./trash-2-EdjdGvEo.js";import{t as Hi}from"./check-DAAMuI4o.js";import{t as Ui}from"./chevron-right-DKiL3NWw.js";import{c as Wi,d as Gi,f as Ki,h as qi,i as Ji,l as Yi,n as Xi,p as Zi,r as Qi,s as $i,t as ea,u as ta}from"./dropdown-menu-DkEK7m00.js";import{t as na}from"./external-link-DPKRidDg.js";import{t as ra}from"./eye-CEHQ0c-s.js";import{t as ia}from"./triangle-alert-DpH3QFz6.js";import{n as aa,r as oa,t as J}from"./centered-state-T0J7VmBb.js";import{t as sa}from"./pencil-CCR9uUZ1.js";import{t as ca}from"./search-x-bpAfQtVY.js";import{_ as la,a as ua,c as da,d as fa,f as pa,g as ma,h as ha,i as ga,l as _a,m as va,n as ya,o as ba,p as xa,r as Sa,s as Ca,t as wa,u as Ta}from"./use-now-CrM50BFB.js";import{t as Ea}from"./x-BkwTUDpG.js";import{a as Da,c as Oa,d as ka,i as Aa,l as ja,n as Ma,o as Na,r as Pa,s as Fa,t as Ia,u as La}from"./tooltip--PYfu68E.js";import{a as Ra,c as za,i as Ba,n as Va,o as Ha,r as Ua,s as Wa,t as Ga}from"./alert-dialog-CF_-dmQ1.js";import{i as Ka,r as qa,t as Ja}from"./token-metrics-C149OWmd.js";import{t as Ya}from"./diff-stat-CFoeFye2.js";import{n as Xa,r as Za,t as Qa}from"./pill-bO5OcHuK.js";import{t as $a}from"./textarea-Bb0_Hz53.js";import{n as eo}from"./use-submit-shortcut-BJ10ZshV.js";import{i as to,n as no,r as ro,t as io}from"./markdown-Bmfy_1Ll.js";import{t as ao}from"./thread-loading-Bo6IOu3Y.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var oo=class extends Ft{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new He({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=so(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=so(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=so(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=so(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){R.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>zt(t,e))}findAll(e={}){return this.getAll().filter(t=>zt(e,t))}notify(e){R.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return R.batch(()=>Promise.all(e.map(e=>e.continue().catch(Et))))}};function so(e){return e.options.scope?.id}var co=class extends Ft{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??on(r,t),a=this.get(i);return a||(a=new ze({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){R.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Xt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Xt(e,t)):t}notify(e){R.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){R.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){R.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},lo=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new co,this.#t=e.mutationCache||new oo,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=at.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ge.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ut(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=o(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return R.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;R.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return R.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=R.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Et).catch(Et)}invalidateQueries(e,t={}){return R.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=R.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Et)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Et)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Ut(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Et).catch(Et)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Et).catch(Et)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Ge.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(dt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{$e(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(dt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{$e(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=on(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===$t&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Y=e(t(),1),uo=n();function fo(e){let t=e.container;if(t===void 0)return{hasContainer:!1,cpuLimited:!1,cpuCores:e.cpuCount,...e.cpuPct===void 0?{}:{cpuPct:e.cpuPct},cpuIsEffective:!1,memLimited:!1,memTotalBytes:e.memTotalBytes,...e.memUsedBytes===void 0?{}:{memUsedBytes:e.memUsedBytes},memIsEffective:!1,cgroupUnknown:e.cgroupProbe===`unavailable`};let n=t.cpuQuotaCores!==void 0||t.cpuAffinityCores!==void 0,r=t.cpuQuotaCores===void 0?t.cpuAffinityCores===void 0?void 0:`cpuset`:`quota`,i=n?Math.min(e.cpuCount,e.hostCpuCount??1/0,t.cpuQuotaCores??1/0,t.cpuAffinityCores??1/0):e.cpuCount,a=t.memLimitBytes!==void 0,o=n?t.cpuPct:e.cpuPct,s=a?t.memUsedBytes:e.memUsedBytes;return{hasContainer:!0,source:t.source,cpuLimited:n,...r===void 0?{}:{cpuLimitKind:r},cpuCores:i,...o===void 0?{}:{cpuPct:o},cpuIsEffective:n,memLimited:a,memTotalBytes:a?t.memLimitBytes??e.memTotalBytes:e.memTotalBytes,...s===void 0?{}:{memUsedBytes:s},memIsEffective:a,...e.hostCpuCount===void 0?{}:{hostCpuCount:e.hostCpuCount},cgroupUnknown:e.cgroupProbe===`unavailable`}}function po(e){let t=Math.round(e*10)/10;return`${Number.isInteger(t)?t:t.toFixed(1)} CPU`}function mo(e,t){let n=It(t);if(e===void 0)return`— / ${n}`;let r=It(e),i=n.split(` `)[1];return i!==void 0&&r.endsWith(` ${i}`)?`${r.slice(0,-(i.length+1))}/${n}`:`${r}/${n}`}function ho(){let[e,t]=(0,Y.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches);return(0,Y.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 768px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var X=i(),go=2500,_o=2e3,vo=(e,t)=>new Promise((n,r)=>{if(t?.aborted){r(new DOMException(`Aborted`,`AbortError`));return}let i=()=>{clearTimeout(a),r(new DOMException(`Aborted`,`AbortError`))},a=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e);t?.addEventListener(`abort`,i,{once:!0})});async function yo(e){let t=await x({signal:e});return t.cpuPct===void 0?(await vo(go,e),x({signal:e})):t}function bo(){let e=Se().data;if(e!==void 0)return e.capabilities?.localHandoff===!0?`local`:`remote`}var xo=Object.freeze([]),So=Object.freeze({history:xo});function Co(){let e=So,t,n=new Set;return{subscribe(e){return n.add(e),()=>n.delete(e)},get:()=>e,push(r,i,a){let o=e,s=t!==void 0&&t!==a;t=a;let c=o.latest?.sampledAt===r.sampledAt;if(c&&o.latest===r&&o.lastFrameAt===i&&!s)return;let l=o.history[o.history.length-1],u=!c&&l!==void 0&&Date.parse(r.sampledAt)-Date.parse(l.sampledAt)>8e3,d=a!==`route`,f=s||u||!d?[]:o.history,p=fo(r).cpuPct,m=f[f.length-1];e={latest:r,lastFrameAt:i,history:d&&p!==void 0&&m?.sampledAt!==r.sampledAt?[...f,{sampledAt:r.sampledAt,receivedAt:i,cpuPct:p}].slice(-30):f,...o.topicUnavailable===!0?{topicUnavailable:!0}:{}};for(let e of n)e()},markTopicUnavailable(){if(e.topicUnavailable!==!0){e={...e,topicUnavailable:!0};for(let e of n)e()}},reset(){t=void 0,e=So;for(let e of n)e()}}}var wo=(0,Y.createContext)(null);function To({children:e}){let[t]=(0,Y.useState)(Co);return(0,X.jsxs)(wo.Provider,{value:t,children:[e,(0,X.jsx)(Eo,{})]})}function Eo(){return Po(),null}var Do=()=>()=>void 0;function Oo(){let e=(0,Y.useContext)(wo);return(0,Y.useSyncExternalStore)(e?e.subscribe:Do,()=>e?.get().latest,()=>void 0)}function ko(){let e=(0,Y.useContext)(wo);return(0,Y.useSyncExternalStore)(e?e.subscribe:Do,()=>e?.get().history??So.history,()=>So.history)}function Ao(){let e=(0,Y.useContext)(wo);return(0,Y.useSyncExternalStore)(e?e.subscribe:Do,()=>e?.get().lastFrameAt,()=>void 0)}function jo(){let e=(0,Y.useContext)(wo);return(0,Y.useSyncExternalStore)(e?e.subscribe:Do,()=>e?.get().topicUnavailable===!0,()=>!1)}function Mo(){let e=Oo(),t=Ao(),[n,r]=(0,Y.useState)(()=>Date.now());if((0,Y.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),1e3);return()=>clearInterval(e)},[]),e===void 0)return;let i=Date.parse(e.sampledAt);return Number.isNaN(i)?t===void 0?void 0:Math.max(0,Math.round((n-t)/1e3)):Math.max(0,Math.round((n-i)/1e3))}function No(e,t){let n=(0,Y.useContext)(wo),r=bo(),i=jo();(0,Y.useEffect)(()=>{if(!(!n||!t||r!==`local`))return cn(`host`,t=>{let r=On.safeParse(t);r.success&&n.push(r.data,Date.now(),e)},()=>n.markTopicUnavailable())},[n,t,r,e]);let a=ae({queryKey:[...c.hostUsage,`poll`],queryFn:({signal:e})=>x({signal:e}),enabled:n!==null&&t&&r===`local`&&i,refetchInterval:_o,staleTime:0,retry:!1}).data;(0,Y.useEffect)(()=>{!n||a===void 0||n.push(a,Date.now(),e)},[n,a,e])}function Po(){No(`root`,ho())}function Fo(e={}){No(`card`,e.enabled??!0)}function Io(){let e=(0,Y.useContext)(wo),t=bo(),n=ae({queryKey:c.hostUsage,queryFn:({signal:e})=>yo(e),enabled:t===`remote`,staleTime:0,retry:!1}),r=n.data;return(0,Y.useEffect)(()=>{!e||r===void 0||e.push(r,Date.now(),`route`)},[e,r]),n}function Lo(){return new lo({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof we&&t.status>=400&&t.status<500?!1:e<1},mutations:{retry:!1}}})}var Ro=W(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),zo=W(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Bo=W(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),Vo=W(`bookmark`,[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]),Ho=W(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Uo=W(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),Wo=W(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),Go=W(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Ko=W(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),qo=W(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),Jo=W(`corner-left-up`,[[`path`,{d:`M14 9 9 4 4 9`,key:`1af5af`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),Yo=W(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Xo=W(`file-cog`,[[`path`,{d:`M15 8a1 1 0 0 1-1-1V2a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8z`,key:`1ckgky`}],[`path`,{d:`M20 8v12a2 2 0 0 1-2 2h-4.182`,key:`1726p0`}],[`path`,{d:`m3.305 19.53.923-.382`,key:`ao1pio`}],[`path`,{d:`M4 10.592V4a2 2 0 0 1 2-2h8`,key:`1foop0`}],[`path`,{d:`m4.228 16.852-.924-.383`,key:`1fv9zy`}],[`path`,{d:`m5.852 15.228-.383-.923`,key:`1a9hc2`}],[`path`,{d:`m5.852 20.772-.383.924`,key:`1sh9ke`}],[`path`,{d:`m8.148 15.228.383-.923`,key:`4yu6lf`}],[`path`,{d:`m8.53 21.696-.382-.924`,key:`18b0s9`}],[`path`,{d:`m9.773 16.852.922-.383`,key:`ti6xop`}],[`path`,{d:`m9.773 19.148.922.383`,key:`rws47d`}],[`circle`,{cx:`7`,cy:`18`,r:`3`,key:`lvkj7j`}]]),Zo=W(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),Qo=W(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),$o=W(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),es=W(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),ts=W(`folders`,[[`path`,{d:`M20 5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h2.5a1.5 1.5 0 0 1 1.2.6l.6.8a1.5 1.5 0 0 0 1.2.6z`,key:`a4852j`}],[`path`,{d:`M3 8.268a2 2 0 0 0-1 1.738V19a2 2 0 0 0 2 2h11a2 2 0 0 0 1.732-1`,key:`yxbcw3`}]]),ns=W(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),rs=W(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),is=W(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),as=W(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),os=W(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),ss=W(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),cs=W(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),ls=W(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),us=W(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),ds=W(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),fs=W(`memory-stick`,[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]),ps=W(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),ms=W(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),hs=W(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),gs=W(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),_s=W(`notebook-pen`,[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`,key:`re6nr2`}],[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`pqwjuv`}]]),vs=W(`package-check`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16 17 2 2 4-4`,key:`uh5qu3`}],[`path`,{d:`M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753`,key:`kpkbpo`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),ys=W(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),bs=W(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),xs=W(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),Ss=W(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Cs=W(`split`,[[`path`,{d:`M16 3h5v5`,key:`1806ms`}],[`path`,{d:`M8 3H3v5`,key:`15dfkv`}],[`path`,{d:`M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3`,key:`1qrqzj`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}]]),ws=W(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Ts=W(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Es=W(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Ds=W(`ticket`,[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]),Os=W(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),ks=W(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),As=W(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),js={jira:{label:`Jira`,scopeLabel:`Jira projects`},linear:{label:`Linear`,scopeLabel:`Linear teams`}},Ms=Gn.options.map(e=>({kind:e,...js[e]}));function Ns(e){let t=Y.useRef({value:e,previous:e});return Y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Ps=`Label`,Fs=Y.forwardRef((e,t)=>(0,X.jsx)(U.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Fs.displayName=Ps;var Is=Fs;function Ls(e,[t,n]){return Math.min(n,Math.max(t,e))}var Rs=e(r(),1),zs=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Bs=[` `,`Enter`],Vs=`Select`,[Hs,Us,Ws]=Zi(Vs),[Gs,Ks]=En(Vs,[Ws,ja]),qs=ja(),[Js,Ys]=Gs(Vs),[Xs,Zs]=Gs(Vs),Qs=`SelectProvider`;function $s(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=qs(t),[_,v]=Y.useState(null),[y,b]=Y.useState(null),[x,S]=Y.useState(!1),C=Ki(l),[w,T]=Tn({prop:r,defaultProp:i??!1,onChange:a,caller:Vs}),[E,D]=Tn({prop:o,defaultProp:s,onChange:c,caller:Vs}),O=Y.useRef(null),k=Y.useRef(E);Y.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=()=>D(k.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,D]);let A=!_||!!m||!!_.closest(`form`),[j,M]=Y.useState(new Set),N=Kn(),P=Array.from(j).map(e=>e.props.value).join(`;`),F=Y.useCallback(e=>{M(t=>new Set(t).add(e))},[]),ee=Y.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),te={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:N,value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:j,nativeSelectKey:P,isFormControl:A};return(0,X.jsx)(Oa,{...g,children:(0,X.jsx)(Js,{scope:t,...te,children:(0,X.jsx)(Hs.Provider,{scope:t,children:(0,X.jsx)(Xs,{scope:t,onNativeOptionAdd:F,onNativeOptionRemove:ee,children:$c(h)?h(te):n})})})})}$s.displayName=Qs;var ec=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,X.jsx)($s,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,X.jsxs)(X.Fragment,{children:[n,e?(0,X.jsx)(Qc,{__scopeSelect:t}):null]})})};ec.displayName=Vs;var tc=`SelectTrigger`,nc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=qs(n),o=Ys(tc,n),s=o.disabled||r,c=kn(t,o.onTriggerChange),l=Us(n),u=Y.useRef(`touch`),[d,f,p]=tl(e=>{let t=l().filter(e=>!e.disabled),n=nl(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,X.jsx)(Da,{asChild:!0,...a,children:(0,X.jsx)(U.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":el(o.value)?``:void 0,...i,ref:c,onClick:G(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:G(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:G(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&zs.includes(e.key)&&(m(),e.preventDefault())})})})});nc.displayName=tc;var rc=`SelectValue`,ic=Y.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=Ys(rc,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=kn(t,c.onValueNodeChange);Wn(()=>{l(u)},[l,u]);let f=el(c.value);return(0,X.jsx)(U.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,X.jsx)(Y.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});ic.displayName=rc;var ac=`SelectIcon`,oc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,X.jsx)(U.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});oc.displayName=ac;var sc=`SelectPortal`,[cc,lc]=Gs(sc,{forceMount:void 0}),uc=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,X.jsx)(cc,{scope:e.__scopeSelect,forceMount:n,children:(0,X.jsx)(Nn,{asChild:!0,...r})})};uc.displayName=sc;var dc=`SelectContent`,fc=Y.forwardRef((e,t)=>{let n=lc(dc,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=Ys(dc,e.__scopeSelect),[o,s]=Y.useState();return Wn(()=>{s(new DocumentFragment)},[]),(0,X.jsx)(jn,{present:r||a.open,children:({present:e})=>e?(0,X.jsx)(yc,{...i,ref:t}):(0,X.jsx)(pc,{...i,fragment:o})})});fc.displayName=dc;var pc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?Rs.createPortal((0,X.jsx)(hc,{scope:n,children:(0,X.jsx)(Hs.Slot,{scope:n,children:(0,X.jsx)(`div`,{ref:t,children:r})})}),i):null});pc.displayName=`SelectContentFragment`;var mc=10,[hc,gc]=Gs(dc),_c=`SelectContentImpl`,vc=Sn(`SelectContent.RemoveScroll`),yc=Y.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=Ys(dc,n),[y,b]=Y.useState(null),[x,S]=Y.useState(null),C=kn(t,b),[w,T]=Y.useState(null),[E,D]=Y.useState(null),O=Us(n),[k,A]=Y.useState(!1),j=Y.useRef(!1);Y.useEffect(()=>{if(y)return Bn(y)},[y]),Fn();let M=Y.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),N=Y.useCallback(()=>M([w,y]),[M,w,y]);Y.useEffect(()=>{k&&N()},[k,N]);let{onOpenChange:P,triggerPointerDownPosRef:F}=v;Y.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||P(!1),document.removeEventListener(`pointermove`,t),F.current=null};return F.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,P,F]),Y.useEffect(()=>{let e=()=>P(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[P]);let[ee,te]=tl(e=>{let t=O().filter(e=>!e.disabled),n=nl(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),I=Y.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(j.current=!0))},[v.value]),ne=Y.useCallback(()=>y?.focus(),[y]),re=Y.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),ie=r===`popper`?Cc:xc,ae=ie===Cc?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,X.jsx)(hc,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:I,selectedItem:w,onItemLeave:ne,itemTextRefCallback:re,focusSelectedItem:N,selectedItemText:E,position:r,isPositioned:k,searchRef:ee,children:(0,X.jsx)(In,{as:vc,allowPinchZoom:!0,children:(0,X.jsx)(Un,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:G(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,X.jsx)(qn,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,X.jsx)(ie,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...ae,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:G(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&te(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>M(t)),e.preventDefault()}})})})})})})});yc.displayName=_c;var bc=`SelectItemAlignedPosition`,xc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=Ys(dc,n),o=gc(dc,n),[s,c]=Y.useState(null),[l,u]=Y.useState(null),d=kn(t,u),f=Us(n),p=Y.useRef(!1),m=Y.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=Y.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-mc,d=Ls(a,[mc,Math.max(mc,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-mc,d=Ls(a,[mc,Math.max(mc,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-mc*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-mc,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${mc}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);Wn(()=>y(),[y]);let[b,x]=Y.useState();return Wn(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,X.jsx)(wc,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:Y.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,X.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,X.jsx)(U.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});xc.displayName=bc;var Sc=`SelectPopperPosition`,Cc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=mc,...a}=e,o=qs(n);return(0,X.jsx)(Fa,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Cc.displayName=Sc;var[wc,Tc]=Gs(dc,{}),Ec=`SelectViewport`,Dc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=gc(Ec,n),o=Tc(Ec,n),s=kn(t,a.onViewportChange),c=Y.useRef(0);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,X.jsx)(Hs.Slot,{scope:n,children:(0,X.jsx)(U.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:G(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-mc*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Dc.displayName=Ec;var Oc=`SelectGroup`,[kc,Ac]=Gs(Oc),jc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Kn();return(0,X.jsx)(kc,{scope:n,id:i,children:(0,X.jsx)(U.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});jc.displayName=Oc;var Mc=`SelectLabel`,Nc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Ac(Mc,n);return(0,X.jsx)(U.div,{id:i.id,...r,ref:t})});Nc.displayName=Mc;var Pc=`SelectItem`,[Fc,Ic]=Gs(Pc),Lc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=Ys(Pc,n),c=gc(Pc,n),l=s.value===r,[u,d]=Y.useState(a??``),[f,p]=Y.useState(!1),m=kn(t,Pn(e=>c.itemRefCallback?.(e,r,i))),h=Kn(),g=Y.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,X.jsx)(Fc,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:Y.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,X.jsx)(Hs.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,X.jsx)(U.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:G(o.onFocus,()=>p(!0)),onBlur:G(o.onBlur,()=>p(!1)),onClick:G(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:G(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:G(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:G(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:G(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:G(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(Bs.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});Lc.displayName=Pc;var Rc=`SelectItemText`,zc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=Ys(Rc,n),s=gc(Rc,n),c=Ic(Rc,n),l=Zs(Rc,n),[u,d]=Y.useState(null),f=Pn(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=kn(t,d,c.onItemTextChange,f),m=u?.textContent,h=Y.useMemo(()=>(0,X.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return Wn(()=>(g(h),()=>_(h)),[g,_,h]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(U.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!el(o.value)?Rs.createPortal(a.children,o.valueNode):null]})});zc.displayName=Rc;var Bc=`SelectItemIndicator`,Vc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Ic(Bc,n).isSelected?(0,X.jsx)(U.span,{"aria-hidden":!0,...r,ref:t}):null});Vc.displayName=Bc;var Hc=`SelectScrollUpButton`,Uc=Y.forwardRef((e,t)=>{let n=gc(Hc,e.__scopeSelect),r=Tc(Hc,e.__scopeSelect),[i,a]=Y.useState(!1),o=kn(t,r.onScrollButtonChange);return Wn(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,X.jsx)(Kc,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Uc.displayName=Hc;var Wc=`SelectScrollDownButton`,Gc=Y.forwardRef((e,t)=>{let n=gc(Wc,e.__scopeSelect),r=Tc(Wc,e.__scopeSelect),[i,a]=Y.useState(!1),o=kn(t,r.onScrollButtonChange);return Wn(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,X.jsx)(Kc,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Gc.displayName=Wc;var Kc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=gc(`SelectScrollButton`,n),o=Y.useRef(null),s=Us(n),c=Y.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return Y.useEffect(()=>()=>c(),[c]),Wn(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,X.jsx)(U.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:G(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:G(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:G(i.onPointerLeave,()=>{c()})})}),qc=`SelectSeparator`,Jc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,X.jsx)(U.div,{"aria-hidden":!0,...r,ref:t})});Jc.displayName=qc;var Yc=`SelectArrow`,Xc=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=qs(n);return gc(Yc,n).position===`popper`?(0,X.jsx)(Na,{...i,...r,ref:t}):null});Xc.displayName=Yc;var Zc=`SelectBubbleInput`,Qc=Y.forwardRef(({__scopeSelect:e,...t},n)=>{let r=Ys(Zc,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=Y.useRef(null),m=kn(n,p),h=i??``,g=Ns(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return Y.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,X.jsxs)(U.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...ka,...t.style},ref:m,defaultValue:h,children:[el(i)&&!_?(0,X.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});Qc.displayName=Zc;function $c(e){return typeof e==`function`}function el(e){return e===``||e===void 0}function tl(e){let t=Pn(e),n=Y.useRef(``),r=Y.useRef(0),i=Y.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=Y.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return Y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function nl(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=rl(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function rl(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var il=`Switch`,[al,ol]=En(il),[sl,cl]=al(il);function ll(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=Tn({prop:n,defaultProp:i??!1,onChange:c,caller:il}),[m,h]=Y.useState(null),[g,_]=Y.useState(null),v={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:Y.useRef(!1),required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,X.jsx)(sl,{scope:t,...v,children:_l(d)?d(v):r})}var ul=`SwitchTrigger`,dl=Y.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=cl(ul,e),h=kn(r,u),g=Y.useRef(c);return Y.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,X.jsx)(U.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":vl(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:h,onClick:G(t,e=>{d(e=>!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});dl.displayName=ul;var fl=Y.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,X.jsx)(ll,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(dl,{...d,ref:t,__scopeSwitch:n}),e&&(0,X.jsx)(gl,{__scopeSwitch:n})]})})});fl.displayName=il;var pl=`SwitchThumb`,ml=Y.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=cl(pl,n);return(0,X.jsx)(U.span,{"data-state":vl(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});ml.displayName=pl;var hl=`SwitchBubbleInput`,gl=Y.forwardRef(({__scopeSwitch:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=cl(hl,e),m=kn(n,p),h=Ns(a),g=La(r);Y.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});n.call(e,a),e.dispatchEvent(t)}},[f,h,a,i]);let _=Y.useRef(a);return(0,X.jsx)(U.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});gl.displayName=hl;function _l(e){return typeof e==`function`}function vl(e){return e?`checked`:`unchecked`}var yl=`Tabs`,[bl,xl]=En(yl,[Gi]),Sl=Gi(),[Cl,wl]=bl(yl),Tl=Y.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Ki(s),[d,f]=Tn({prop:r,onChange:i,defaultProp:a??``,caller:yl});return(0,X.jsx)(Cl,{scope:n,baseId:Kn(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,X.jsx)(U.div,{dir:u,"data-orientation":o,...l,ref:t})})});Tl.displayName=yl;var El=`TabsList`,Dl=Y.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=wl(El,n),o=Sl(n);return(0,X.jsx)(ta,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,X.jsx)(U.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Dl.displayName=El;var Ol=`TabsTrigger`,kl=Y.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=wl(Ol,n),s=Sl(n),c=Ml(o.baseId,r),l=Nl(o.baseId,r),u=r===o.value;return(0,X.jsx)(Yi,{asChild:!0,...s,focusable:!i,active:u,children:(0,X.jsx)(U.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:G(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:G(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:G(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});kl.displayName=Ol;var Al=`TabsContent`,jl=Y.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=wl(Al,n),c=Ml(s.baseId,r),l=Nl(s.baseId,r),u=r===s.value,d=Y.useRef(u);return Y.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,X.jsx)(jn,{present:i||u,children:({present:n})=>(0,X.jsx)(U.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});jl.displayName=Al;function Ml(e,t){return`${e}-trigger-${t}`}function Nl(e,t){return`${e}-content-${t}`}var Pl=Tl,Fl=Dl,Il=kl,Ll=jl,Rl=An(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-destructive-foreground focus-visible:ring-destructive/20 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function Z({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,X.jsx)(n?Rn:`span`,{"data-slot":`badge`,"data-variant":t,className:K(Rl({variant:t}),e),...r})}var zl=`x-apple.systempreferences:com.apple.preference.security?Privacy_FilesAndFolders`,Bl=`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-foreground hover:bg-muted`;function Vl(e){let t=e.replace(/[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?null:n===0?t.slice(0,1):t.slice(0,n)}function Hl({path:e,selected:t,onSelect:n,onEnter:r,decorate:i,emptyHint:a,showHidden:o=!1}){let s=l(e,o),c=s.data?.parent??null;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-[11.5px] text-soft-foreground`,title:s.data?.path??void 0,children:s.data?.path??(s.isError?``:`Loading…`)}),s.isError?(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,X.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not list that folder`}),s.error instanceof we&&s.error.status===403?(0,X.jsx)(`p`,{"data-slot":`fs-privacy-hint`,className:`text-[12.5px] text-soft-foreground`,children:`Allow it under Privacy & Security ▸ Files & Folders, then try again.`}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[12.5px]`,children:[e!==null&&Vl(e)!==null?(0,X.jsxs)(`button`,{type:`button`,"data-slot":`fs-error-back`,onClick:()=>r(Vl(e)),className:Bl,children:[(0,X.jsx)(Jo,{className:`size-3.5`,"aria-hidden":!0}),`Back`]}):null,s.error instanceof we&&s.error.status===403?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`a`,{"data-slot":`fs-privacy-settings`,href:zl,target:`_blank`,rel:`noreferrer`,className:Bl,children:`Open Privacy Settings`}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`fs-retry`,onClick:()=>void s.refetch(),className:Bl,children:`Try again`})]}):null]})]}):(0,X.jsxs)(`ul`,{"data-slot":`fs-listing`,className:`max-h-64 divide-y divide-border/60 overflow-y-auto overscroll-contain rounded-md border border-border`,children:[c===null?null:(0,X.jsx)(`li`,{className:`flex`,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`fs-up`,onClick:()=>r(c),className:`flex flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,X.jsx)(Jo,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(s.data?.dirs??[]).map(e=>(0,X.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,X.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":t?.path===e.path,onClick:()=>n(e),onDoubleClick:()=>r(e.path),className:K(`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,t?.path===e.path&&`bg-muted`),children:[(0,X.jsx)(qi,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.name}),i?.(e)]}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`fs-enter`,"aria-label":`Open ${e.name}`,onClick:()=>r(e.path),className:`flex shrink-0 items-center px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,X.jsx)(Ui,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),s.data&&s.data.dirs.length===0?(0,X.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:a}):null]}),s.data?.truncated?(0,X.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-[11.5px] text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function Ul(e,t,n=!1){let r=l(e,n);return t?.path??r.data?.path??null}function Wl({open:e,onOpenChange:t}){let[n,r]=(0,Y.useState)(null),[i,a]=(0,Y.useState)(null),o=ye(),s=rn(),c=Me(),l=new Set((o.data?.projects??[]).filter(e=>!e.unregistered).map(e=>e.root)),u=e=>{r(e),a(null),s.reset()},d=Ul(n,i);return(0,X.jsx)(fa,{open:e,onOpenChange:t,children:(0,X.jsxs)(pa,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(ha,{children:[(0,X.jsx)(ma,{children:`Open local folder`}),(0,X.jsx)(xa,{children:`Pick the folder cezar should run in. Git repos are marked; any folder works.`})]}),(0,X.jsx)(Hl,{path:n,selected:i,onSelect:a,onEnter:u,emptyHint:`No subfolders here — “Add project” registers this folder.`,decorate:e=>(0,X.jsxs)(X.Fragment,{children:[e.isRepo?(0,X.jsx)(Z,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`git`}):null,l.has(e.path)?(0,X.jsx)(Z,{variant:`ghost`,className:`shrink-0 text-[10px] text-muted-foreground`,children:`already added`}):null]})}),s.isError?(0,X.jsx)(`p`,{"data-slot":`add-project-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not add that folder`}):null,(0,X.jsxs)(va,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,X.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-[11.5px] text-muted-foreground`,title:d??void 0,children:d??``}),(0,X.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,X.jsx)(q,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(q,{"data-slot":`add-project-confirm`,disabled:d===null||s.isPending,onClick:()=>{d===null||s.isPending||s.mutate(d,{onSuccess:({project:e})=>{t(!1),c(`/p/${encodeURIComponent(e.id)}/`)}})},children:s.isPending?`Adding…`:`Add project`})]})]})]})})}function Gl({className:e,type:t,...n}){return(0,X.jsx)(`input`,{type:t,"data-slot":`input`,className:K(`h-9 w-full min-w-0 rounded-md border border-input bg-card px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-soft-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20`,e),...n})}function Kl({className:e,...t}){return(0,X.jsx)(Is,{"data-slot":`label`,className:K(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function ql(e){return e instanceof Error?e.message.match(/https:\/\/github\.com\/orgs\/[A-Za-z0-9._-]+\/sso\?authorization_request=[A-Za-z0-9._~-]+(?![^\s'"<>])/)?.[0]??null:null}function Jl({open:e,onOpenChange:t}){let[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(!1),u=(0,Y.useRef)(!1),d=ye(),f=g(),{mutate:p,isPending:m}=f,h=Me(),_=ql(f.error),v=(0,Y.useMemo)(()=>`co-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),y=(0,Y.useRef)(v);y.current=v,(0,Y.useEffect)(()=>Qn((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===y.current&&(n.phase===`cloning`&&n.line?s(n.line):n.phase!==`cloning`&&s(null))}),[]);let b=(0,Y.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),x=i.trim()===``?b:i.trim(),S=d.data?.projectsDir??``,C=x===``?``:`${S.replace(/\/+$/,``)}/${x}`,w=(0,Y.useCallback)(()=>{n.trim()===``||m||(u.current=!1,l(!1),s(null),p({url:n.trim(),checkoutId:v,...i.trim()===``?{}:{name:i.trim()}},{onSuccess:({project:e})=>{t(!1),h(`/p/${encodeURIComponent(e.id)}/`)}}))},[p,m,v,i,h,t,n]);return(0,Y.useEffect)(()=>{if(!c)return;let e=()=>{u.current&&(u.current=!1,l(!1),w())},t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[c,w]),(0,X.jsx)(fa,{open:e,onOpenChange:e=>f.isPending?void 0:t(e),children:(0,X.jsxs)(pa,{"data-slot":`clone-project-dialog`,className:`min-w-0 max-h-[calc(100dvh-2rem)] overflow-x-hidden overflow-y-auto sm:max-w-lg`,children:[(0,X.jsxs)(ha,{children:[(0,X.jsx)(ma,{children:`Clone from GitHub`}),(0,X.jsxs)(xa,{children:[`The service clones with `,(0,X.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(Kl,{htmlFor:`clone-url`,children:`Repository`}),(0,X.jsx)(Gl,{id:`clone-url`,"data-slot":`clone-url`,autoFocus:!0,placeholder:`owner/repo or https://github.com/owner/repo`,value:n,disabled:f.isPending,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&w()}})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(Kl,{htmlFor:`clone-name`,children:`Folder name`}),(0,X.jsx)(Gl,{id:`clone-name`,"data-slot":`clone-name`,placeholder:b===``?`repo`:b,value:i,disabled:f.isPending,onChange:e=>a(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-[11.5px] text-soft-foreground`,title:C,children:C}),f.isPending?(0,X.jsx)(q,{"data-slot":`clone-root-settings`,variant:`ghost`,size:`icon-sm`,className:`size-7`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,disabled:!0,children:(0,X.jsx)(Ss,{className:`size-3.5`,"aria-hidden":`true`})}):(0,X.jsx)(q,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,X.jsx)(pe,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,X.jsx)(Ss,{className:`size-3.5`,"aria-hidden":`true`})})})]})]}),f.isPending?(0,X.jsx)(`p`,{"data-slot":`clone-progress`,className:`truncate font-mono text-[11.5px] text-muted-foreground`,children:o??`Starting the clone…`}):null,f.isError?(0,X.jsx)(`div`,{"data-slot":`clone-error`,className:`grid min-w-0 gap-1.5 text-[13px] text-danger`,children:_?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{children:`GitHub requires SAML authorization for this organization.`}),(0,X.jsxs)(`p`,{children:[(0,X.jsx)(`a`,{"data-slot":`clone-sso-link`,className:`font-medium underline underline-offset-2`,href:_,target:`_blank`,rel:`noreferrer`,onClick:()=>{u.current=!0,l(!0)},children:`Authorize this GitHub organization`}),c?` — return here after authorizing, or choose Retry clone.`:` — return to this tab to retry, or choose Retry clone.`]}),(0,X.jsxs)(`details`,{className:`min-w-0`,children:[(0,X.jsx)(`summary`,{children:`Error details`}),(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-all`,children:f.error instanceof Error?f.error.message:null})]})]}):(0,X.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-all`,children:f.error instanceof Error?f.error.message:`could not clone that repository`})}):null,(0,X.jsxs)(va,{children:[(0,X.jsx)(q,{variant:`outline`,disabled:f.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(q,{"data-slot":`clone-confirm`,disabled:n.trim()===``||x===``||f.isPending,onClick:w,children:f.isPending?`Cloning…`:f.isError?`Retry clone`:`Clone`})]})]})})}function Yl(e){return(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,X.jsx)(`path`,{d:`M12 1.9a10.1 10.1 0 0 0-3.2 19.7c.5.1.7-.2.7-.5v-1.8c-2.8.6-3.4-1.2-3.4-1.2-.5-1.2-1.1-1.5-1.1-1.5-.9-.6.1-.6.1-.6 1 .1 1.5 1 1.5 1 .9 1.6 2.4 1.1 3 .9.1-.7.4-1.1.6-1.4-2.2-.3-4.6-1.1-4.6-5 0-1.1.4-2 1-2.7-.1-.3-.4-1.3.1-2.7 0 0 .9-.3 2.8 1a9.6 9.6 0 0 1 5 0c1.9-1.3 2.8-1 2.8-1 .5 1.4.2 2.4.1 2.7.6.7 1 1.6 1 2.7 0 3.9-2.4 4.7-4.6 5 .4.3.7.9.7 1.9v2.8c0 .3.2.6.7.5A10.1 10.1 0 0 0 12 1.9z`})})}var Xl=[{to:`/`,label:`Tasks`,icon:ds,match:[`/`,`/tasks`,`/compare`],badge:`tasks-unread`},{to:`/inbox`,label:`Inbox`,icon:os,match:[`/inbox`],badge:`inbox-count`,inbox:!0},{to:`/git`,label:`Git`,icon:rs,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:Yl,match:[`/github`],forge:!0},{to:`/tracker`,label:`Tracker`,icon:Ds,match:[`/tracker`],tracker:!0},{to:`/automations`,label:`Automations`,icon:Nr,match:[`/automations`],automations:!0},{to:`/skills`,label:`Skills`,icon:ei,match:[`/skills`],badge:`skills-update`},{to:`/workflows`,label:`Workflows`,icon:As,match:[`/workflows`]},{to:`/settings`,label:`Settings`,icon:Ss,match:[`/settings`]}];function Zl({forge:e=!1,inbox:t=!1,automations:n=!1,tracker:r}={}){return Xl.filter(i=>(!i.forge||e)&&(!i.inbox||t)&&(!i.automations||n)&&(!i.tracker||r!==void 0)).map(e=>e.tracker?{...e,label:r?js[r].label:e.label}:e)}function Ql(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function $l(e){let t=null;for(let n of Xl)for(let r of n.match)Ql(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function eu(e){let t=$l(e);return Xl.find(e=>e.to===t)??null}var tu=`cez-theme`,nu=`(prefers-color-scheme: light)`,ru=`dark`;function iu(e){return e===`light`||e===`dark`||e===`system`?e:ru}function au(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function ou(){try{return iu(localStorage.getItem(tu))}catch{return ru}}function su(e){try{localStorage.setItem(tu,e)}catch{}}function cu(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(nu).matches}function lu(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t}var uu=Y.createContext(null);function du({children:e}){let[t,n]=Y.useState(ou),[r,i]=Y.useState(cu);Y.useEffect(()=>{let e=window.matchMedia?.(nu);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=au(t,r);Y.useLayoutEffect(()=>{lu(document.documentElement,a)},[a]);let o=Y.useCallback(e=>{n(e),su(e)},[]),s=Y.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,X.jsx)(uu.Provider,{value:s,children:e})}function fu(){let e=Y.useContext(uu);if(!e)throw Error(`cezar: useTheme() must be called inside <ThemeProvider>`);return e}var pu={light:`dark`,dark:`system`,system:`light`},mu={light:Es,dark:gs,system:hs},hu={light:`light`,dark:`dark`,system:`system`};function gu({className:e}){let{theme:t,setTheme:n}=fu(),r=pu[t],i=mu[t];return(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":t,title:`Theme: ${hu[t]}`,"aria-label":`Theme: ${hu[t]}. Switch to ${hu[r]}.`,onClick:()=>n(r),children:(0,X.jsx)(i,{"aria-hidden":`true`})})}function _u(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(e===``||t.has(e))&&(t.add(e),t.size>=200))break}return[...t]}function vu(e){return[...e].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt))}function yu(e,t){let n=_u(t);if(n.length===0)return vu(e);let r=new Map(n.map((e,t)=>[e,t])),i=[],a=[];for(let t of e)r.has(t.id)?i.push(t):a.push(t);return i.sort((e,t)=>r.get(e.id)-r.get(t.id)),[...vu(a),...i]}function bu(e,t,n){return t===n||t<0||n<0||t>=e.length||n>=e.length?[...e]:or([...e],t,n)}function xu(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Su(){let e=I(),t=qe(),n=Y.useRef(0),r=Y.useRef(Promise.resolve()),i=Y.useMemo(()=>_u(t.data?.sidebar?.projectOrder),[t.data?.sidebar?.projectOrder]),a=Y.useCallback(t=>{let i=e.getQueryData(c.uiState);if(i===void 0)return;let{projectOrder:a,...o}=xu(i.sidebar),s=t===null?o:{...o,projectOrder:t};e.setQueryData(c.uiState,{...i,sidebar:s});let l=++n.current,u=r.current.then(async()=>{let t=await oe({sidebar:s},{keepalive:!0});l===n.current&&e.setQueryData(c.uiState,t)});r.current=u.catch(t=>{V(t instanceof Error?t.message:String(t),{tone:`danger`}),l===n.current&&e.invalidateQueries({queryKey:c.uiState})})},[e]),o=Y.useCallback(e=>{let t=_u(e);t.length!==0&&a(t.slice(0,200))},[a]),s=Y.useCallback(()=>a(null),[a]);return{order:i,canReorder:t.data!==void 0,setOrder:o,reset:s}}var Cu=`cezar:open-command-palette`;function wu(){window.dispatchEvent(new Event(Cu))}function Tu(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function Eu(e,t,n){let r=t.trim().toLowerCase();if(r===``)return 1;let i=(n?.length?`${e} ${n.join(` `)}`:e).toLowerCase(),a=r.split(/\s+/),o=0;for(let e of a){let t=i.indexOf(e);if(t===-1)return 0;let n=t===0||!/[a-z0-9]/.test(i[t-1]??``);o+=(n?1:.5)/(1+t/48)}return o/a.length}function Du(e,t,n){let r=Tu(e).map(e=>({projectId:t,id:e.id,title:e.title,titleSummary:e.titleSummary,titleOrigin:e.titleOrigin,status:e.status,activity:e.activity,createdAt:e.createdAt,finishedAt:e.finishedAt,seenAt:e.seenAt,archived:e.archived,autoResumeAt:e.autoResumeAt,awaitingAnswerSince:e.awaitingAnswerSince,workflow:e.workflow,branch:e.branch,startedAt:e.startedAt})),i=new Set(r.map(Ou)),a=(n??[]).filter(e=>!i.has(Ou(e))).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return[...r,...a]}var Ou=e=>`${e.projectId??``}/${e.id}`;function ku(e){let t=e.filter(e=>kr(e)).sort((e,t)=>(t.finishedAt??``).localeCompare(e.finishedAt??``)),n=new Set(t.map(Ou));return{recentlyFinished:t,otherTasks:e.filter(e=>!n.has(Ou(e)))}}function Au(e,t,n=[]){let r=yu(e,n);return[...r.filter(e=>e.id!==t),...r.filter(e=>e.id===t)]}function ju(){let[e,t]=Y.useState(!1),n=un();Ii(`k`,()=>t(e=>!e));let r=Y.useCallback(()=>{t(!1),n(`/new`)},[n]);return Ii(`n`,r),Ri(`c`,r),Y.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(Cu,e),()=>window.removeEventListener(Cu,e)},[]),(0,X.jsx)(Sa,{open:e,onOpenChange:t,title:`Command palette`,description:`Search projects, tasks, views, actions, and skills`,showCloseButton:!1,filter:Eu,className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,X.jsx)(Nu,{close:()=>t(!1)})})}function Mu({task:e,projectName:t,showProject:n,now:r,onSelect:i}){let a=d(e),o=z(e);return(0,X.jsxs)(Ca,{value:`task ${o} ${e.id}`,keywords:t?[t]:void 0,"data-slot":`palette-task`,"data-run-id":e.id,"data-project-id":e.projectId??void 0,onSelect:()=>i(e),children:[(0,X.jsx)(Ka,{tone:a.tone,pulse:a.pulse,"aria-label":a.label,role:`img`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:o}),n&&t?(0,X.jsx)(`span`,{"data-slot":`palette-task-project`,className:`shrink-0 truncate text-xs text-soft-foreground`,children:t}):null,(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:qa(e.finishedAt??e.createdAt,r)})]})}function Nu({close:e}){let t=un(),n=Me(),[r,i]=Y.useState(``),a=r.trim()!==``,o=Pt(),{theme:s,setTheme:c}=fu(),l=ye(),u=Se(),d=l.data,f=d?.bootProject??u.data?.bootProject??null,p=ge(o,f),m=D(),h=Le(),g=Date.now(),_=d!==void 0&&d.projects.length>1,v=Nt(_),{order:y}=Su(),b=Y.useMemo(()=>_?Au(d.projects,o,y):[],[_,d,o,y]),x=Y.useMemo(()=>new Map((d?.projects??[]).map(e=>[e.id,e.name])),[d]),S=(o==="default"?null:o)??f,C=Y.useMemo(()=>Du(p.data??[],S,v.data?.runs),[p.data,S,v.data]),w=Y.useMemo(()=>ku(C),[C]),T=a?[]:w.recentlyFinished,E=a?C:w.otherTasks,O=_,k=e=>e.projectId===null?null:x.get(e.projectId)??null,A=h.data?.skillUsage,j=Y.useMemo(()=>_i(m.data??[],A),[m.data,A]),M=n=>{e(),t(n)},N=t=>{e(),n(t)},P=n=>{e(),t(Qt(n,`/`))},F=n=>{e(),t(n.projectId===null?`/tasks/${n.id}`:Qt(n.projectId,`/tasks/${n.id}`))},ee=pu[s];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ba,{placeholder:`Search projects, tasks, views, actions, skills…`,value:r,onValueChange:i}),(0,X.jsxs)(da,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:[(0,X.jsx)(ga,{children:`Nothing matches.`}),(0,X.jsx)(ua,{children:(0,X.jsxs)(Ca,{value:`new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>M(`/new`),children:[(0,X.jsx)(bs,{"aria-hidden":`true`}),`New task`,(0,X.jsx)(Ta,{children:`C`})]})}),!a&&T.length>0?(0,X.jsx)(ua,{heading:`Recently finished`,children:T.map(e=>(0,X.jsx)(Mu,{task:e,projectName:k(e),showProject:O,now:g,onSelect:F},Ou(e)))}):null,(0,X.jsxs)(ua,{heading:`Views`,children:[_?(0,X.jsxs)(Ca,{value:`view All tasks`,"data-slot":`palette-view`,"data-nav-to":`/tasks`,onSelect:()=>N(`/tasks`),children:[(0,X.jsx)(ls,{"aria-hidden":`true`}),`All tasks`]}):null,Zl({forge:u.data?.forge?.available===!0,inbox:u.data?.capabilities.followups===!0,automations:u.data?.capabilities.automations===!0,tracker:d?.projects.find(e=>e.id===(o??d.bootProject))?.tracker}).map(e=>{let t=e.icon;return(0,X.jsxs)(Ca,{value:`view ${e.label}`,"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>M(e.to),children:[(0,X.jsx)(t,{"aria-hidden":`true`}),e.label]},e.to)})]}),b.length>0?(0,X.jsx)(ua,{heading:`Projects`,children:b.map(e=>{let t=e.id===o,n=e.status===`missing`;return(0,X.jsxs)(Ca,{value:`project ${e.name} ${e.id}`,keywords:[e.root],"data-slot":`palette-project`,"data-project-id":e.id,disabled:n,onSelect:()=>P(e.id),children:[(0,X.jsx)($o,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),n?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-soft-foreground`,children:e.branch}),t?(0,X.jsx)(Hi,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id)})}):null,E.length>0?(0,X.jsx)(ua,{heading:`Tasks`,children:E.map(e=>(0,X.jsx)(Mu,{task:e,projectName:k(e),showProject:O,now:g,onSelect:F},Ou(e)))}):null,(0,X.jsx)(ua,{heading:`Actions`,children:(0,X.jsxs)(Ca,{value:`action toggle theme`,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{c(ee),e()},children:[(0,X.jsx)(gs,{"aria-hidden":`true`}),`Toggle theme`,(0,X.jsxs)(Ta,{className:`tracking-normal`,children:[s,` → `,ee]})]})}),j.length>0?(0,X.jsx)(ua,{heading:`Skills`,children:j.map(e=>(0,X.jsxs)(Ca,{value:`skill ${e.name} ${e.path}`,keywords:e.description?[e.description]:void 0,"data-slot":`palette-skill`,"data-skill":e.name,onSelect:()=>M(`/new?skill=${encodeURIComponent(e.name)}`),children:[(0,X.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.path))}):null]})]})}var Pu=`https://github.com/open-mercato/cezar`,Fu=`cez:star-toast-seen`;function Iu(e){if(!Number.isFinite(e)||e<0)return`0`;let t=Math.floor(e);if(t<1e3)return String(t);let n=t/1e3,r=Math.floor(n*10)/10;return r<100?`${r.toFixed(1).replace(/\.0$/,``)}k`:`${Math.floor(n)}k`}var Lu=`cez:star-ask`,Ru=1500;function zu(e=Wu()){if(!e)return null;try{let t=e.getItem(Lu);if(t!==null){let e=JSON.parse(t);return{asks:Number.isInteger(e.asks)&&e.asks>=0?e.asks:3,...typeof e.lastAskedAt==`string`?{lastAskedAt:e.lastAskedAt}:{},...e.outcome===`starred`||e.outcome===`never`?{outcome:e.outcome}:{}}}let n=e.getItem(Fu);return n===null?{asks:0}:{asks:1,lastAskedAt:n}}catch{return null}}function Bu(e,t=Wu()){try{t?.setItem(Lu,JSON.stringify(e))}catch{}}function Vu(e,t){if(!e||e.outcome||e.asks>=3)return!1;if(!e.lastAskedAt)return!0;let n=Date.parse(e.lastAskedAt);return!Number.isFinite(n)||t-n>=12096e5}function Hu(e){return(e??[]).filter(e=>Gu.has(e.status)).length}function Uu(e){return e.visible&&e.focused&&!e.typing&&!e.dialogOpen&&e.now-e.lastInteractionAt>=0&&e.now-e.lastInteractionAt<=6e4}function Wu(){try{return globalThis.localStorage??null}catch{return null}}var Gu=new Set([`done`,`review`]);function Ku(e,t){let n=new Map,r=!1,i=!1;for(let a of t??[]){n.set(a.id,a.status);let t=e.get(a.id);t===void 0||t===a.status||Gu.has(a.status)&&(r=!0,a.pullRequestUrl&&(i=!0))}return{succeeded:r,withPullRequest:i,statuses:n}}var qu=[`354.6,217.3 511.0,307.6 421.0,359.6 354.6,321.2 267.9,371.2 267.9,471.3 444.6,573.3 354.6,625.3 177.9,523.3 177.9,319.3`,`177.9,284.6 354.6,182.6 354.6,78.7 177.9,180.7`,`354.6,372.3 397.0,396.8 397.0,445.8 354.6,470.3 312.1,445.8 312.1,396.8`,`483.7,372.3 526.1,396.8 526.1,445.8 483.7,470.3 441.2,445.8 441.2,396.8`],Ju={x:177.9,y:78.7,width:348.2,height:546.6},Yu={mark:26,name:19,gap:11.4};function Xu({height:e=Yu.mark,className:t}){return(0,X.jsx)(`svg`,{"data-slot":`brand-mark`,"aria-hidden":`true`,focusable:`false`,viewBox:`${Ju.x} ${Ju.y} ${Ju.width} ${Ju.height}`,height:e,width:e*Ju.width/Ju.height,fill:`currentColor`,className:K(`shrink-0`,t),children:qu.map(e=>(0,X.jsx)(`polygon`,{points:e},e))})}function Zu({className:e,name:t=`cezar`,logoUrl:n=null}){return(0,X.jsxs)(`span`,{"data-slot":`brand-lockup`,className:K(`flex min-w-0 items-center text-foreground`,e),style:{gap:Yu.gap},children:[n?(0,X.jsx)(`img`,{"data-slot":`brand-logo`,src:n,alt:``,className:`size-[26px] shrink-0 object-contain`}):(0,X.jsx)(Xu,{}),(0,X.jsx)(`span`,{"data-slot":`brand-name`,className:K(`max-w-full truncate leading-none font-semibold tracking-normal`,t===`cezar`&&`lowercase`),style:{fontFamily:`var(--brand)`,fontSize:Yu.name},children:t})]})}function Qu({...e}){return(0,X.jsx)(ec,{"data-slot":`select`,...e})}function $u({...e}){return(0,X.jsx)(ic,{"data-slot":`select-value`,...e})}function ed({className:e,size:t=`default`,children:n,...r}){return(0,X.jsxs)(nc,{"data-slot":`select-trigger`,"data-size":t,className:K(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-card px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,X.jsx)(oc,{asChild:!0,children:(0,X.jsx)(si,{className:`size-4 opacity-50`})})]})}function td({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,X.jsx)(uc,{children:(0,X.jsxs)(fc,{"data-slot":`select-content`,className:K(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,X.jsx)(rd,{}),(0,X.jsx)(Dc,{className:K(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,X.jsx)(id,{})]})})}function nd({className:e,children:t,...n}){return(0,X.jsxs)(Lc,{"data-slot":`select-item`,className:K(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,X.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,X.jsx)(Vc,{children:(0,X.jsx)(Hi,{className:`size-4`})})}),(0,X.jsx)(zc,{children:t})]})}function rd({className:e,...t}){return(0,X.jsx)(Uc,{"data-slot":`select-scroll-up-button`,className:K(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,X.jsx)(Ho,{className:`size-4`})})}function id({className:e,...t}){return(0,X.jsx)(Gc,{"data-slot":`select-scroll-down-button`,className:K(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,X.jsx)(si,{className:`size-4`})})}function ad(e){let t=/-pr(\d+)\./.exec(e);return t?Number(t[1]):null}function od({data:e,onApply:t,applying:n}){let r=fe(),i=Kt(),[a,o]=(0,Y.useState)(`worktrees`),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(!1),p=e.job?.status===`running`||e.job?.status===`restarting`,m=e.installed.find(e=>e.active),h=r.data?.checkouts??[],g=r.data?.pulls,_=!r.data||h.length>0,v=_?a:`pulls`,y=s.trim().toLowerCase(),b=(0,Y.useMemo)(()=>h.filter(e=>!y||[e.branch,e.task?.title,e.task?.id,e.commit?.subject,e.worktree,e.pr?`#${e.pr}`:``].filter(Boolean).some(e=>e.toLowerCase().includes(y))),[h,y]),x=(0,Y.useMemo)(()=>(g?.items??[]).filter(e=>!e.version&&!d?!1:!y||[`#${e.number}`,String(e.number),e.title,e.branch,e.author??``].some(e=>e.toLowerCase().includes(y))),[g,y,d]),S=(g?.items??[]).filter(e=>!e.version).length,C=v===`worktrees`?h.find(e=>e.id===l):void 0,w=v===`pulls`?g?.items.find(e=>e.version&&e.version===l):void 0,T=C?.id??w?.version??null,E=!!C&&(!C.built||C.stale),D=!!T&&T===m?.id&&!E,O=w&&!w.installed?`Install & restart`:E?`${C.built?`Rebuild`:`Build`} & ${C.id===m?.id?`restart`:`switch`}`:`Switch & restart`;return(0,X.jsxs)(`div`,{"data-slot":`self-update-development`,className:`flex min-w-0 flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsx)(`div`,{role:`tablist`,"aria-label":`Development builds`,className:`flex rounded-md border border-border bg-muted/40 p-0.5`,children:[..._?[{value:`worktrees`,label:`Worktrees`,count:h.length}]:[],{value:`pulls`,label:`Pull requests`,count:(g?.items.length??0)-S}].map(e=>(0,X.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":v===e.value,onClick:()=>{o(e.value),u(null)},className:K(`rounded-[5px] px-3 py-1 text-[12.5px] font-semibold transition-colors`,v===e.value?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[e.label,r.data?(0,X.jsx)(`span`,{className:`ml-1.5 font-normal text-muted-foreground`,children:e.count}):null]},e.value))}),(0,X.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>i.mutate(),disabled:i.isPending||r.isFetching,children:i.isPending?`Refreshing…`:`Refresh`})]}),(0,X.jsx)(Gl,{"aria-label":`Filter`,value:s,onChange:e=>c(e.target.value),placeholder:v===`worktrees`?`Filter by task, branch, commit or #PR`:`Filter by #number, title, branch or author`,className:`h-8 text-[13px]`}),(0,X.jsx)(`div`,{className:`max-h-72 min-h-24 overflow-y-auto rounded-md border border-border`,children:r.isPending?(0,X.jsx)(`p`,{className:`px-3 py-3 text-[12.5px] text-muted-foreground`,children:`Looking for worktrees and pull requests…`}):r.error?(0,X.jsx)(`p`,{className:`px-3 py-3 text-[12.5px] text-danger`,children:r.error.message}):v===`worktrees`?(0,X.jsxs)(X.Fragment,{children:[b.length===0?(0,X.jsx)(`p`,{className:`px-3 py-3 text-[12.5px] text-muted-foreground`,children:`Nothing matches.`}):null,(0,X.jsx)(`div`,{role:`listbox`,"aria-label":`Worktrees`,children:b.map(e=>(0,X.jsx)(cd,{checkout:e,active:e.id===m?.id,selected:l===e.id,onSelect:()=>u(e.id)},e.worktree))})]}):(0,X.jsxs)(X.Fragment,{children:[g&&!g.available?(0,X.jsx)(`p`,{className:`px-3 py-2 text-[12px] text-muted-foreground`,children:g.reason}):null,g?.available&&x.length===0?(0,X.jsx)(`p`,{className:`px-3 py-3 text-[12.5px] text-muted-foreground`,children:g.items.length===0?`No open pull requests on ${g.repo}.`:y?`Nothing matches.`:`No open pull request has a preview build.`}):null,(0,X.jsx)(`div`,{role:`listbox`,"aria-label":`Pull requests`,children:x.map(e=>(0,X.jsx)(ld,{pull:e,active:!!e.version&&e.version===m?.id,selected:!!e.version&&l===e.version,onSelect:()=>e.version&&u(e.version)},e.number))}),S>0?(0,X.jsx)(`button`,{type:`button`,onClick:()=>f(e=>!e),className:`w-full border-t border-border px-3 py-2 text-left text-[12px] text-muted-foreground hover:text-foreground`,children:d?`Hide the ${S} without a preview build`:`${S} more without a preview build (forks, CI not green yet) — show`}):null]})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,X.jsx)(`p`,{className:`min-w-0 truncate text-[11.5px] text-muted-foreground`,title:C?.worktree,children:C?E?`${C.built?`Built before its last commit`:`Not built yet`} — runs npm run build in ${C.worktree} first (about a minute).`:C.worktree:w?`Installs ${w.version} from npm.`:v===`worktrees`?`Linked, not copied: a worktree that is not built, or built before its last commit, is built before the switch.`:`Preview builds CI publishes for green same-repo pull requests.`}),(0,X.jsx)(q,{size:`sm`,variant:`contrast`,onClick:()=>T&&t(T),disabled:!T||D||!e.canSelfUpdate||n||p,children:O})]})]})}function sd({selected:e,disabled:t,onSelect:n,title:r,children:i}){return(0,X.jsx)(`div`,{role:`option`,"aria-selected":e,"aria-disabled":t,tabIndex:t?-1:0,title:r,onClick:()=>!t&&n(),onKeyDown:e=>{!t&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},className:K(`flex min-w-0 flex-col gap-0.5 border-b border-border px-3 py-2 last:border-b-0 outline-none`,t?`cursor-not-allowed opacity-55`:`cursor-pointer hover:bg-muted/50 focus-visible:bg-muted/60`,e&&`bg-primary/10 hover:bg-primary/10`),children:i})}function cd({checkout:e,active:t,selected:n,onSelect:r}){let i=e.task?.title??e.commit?.subject??e.branch;return(0,X.jsxs)(sd,{selected:n,disabled:!e.id,onSelect:r,title:e.worktree,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:i}),e.pr?(0,X.jsxs)(Z,{variant:`outline`,children:[`#`,e.pr]}):null,t?(0,X.jsx)(Z,{variant:`secondary`,children:`current`}):null,e.built?e.stale?(0,X.jsx)(Z,{variant:`outline`,children:`needs rebuild`}):null:(0,X.jsx)(Z,{variant:`outline`,children:`not built`})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11.5px] text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono`,children:e.branch}),e.task?(0,X.jsxs)(`span`,{className:`shrink-0`,children:[`· `,e.task.status]}):null,e.commit?(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,e.commit.sha,` `,e.task?e.commit.subject:``,` · `,qa(e.commit.at),` ago`]}):null,e.builtAt?(0,X.jsxs)(`span`,{className:`shrink-0`,children:[`· built `,qa(e.builtAt),` ago`]}):null]})]})}function ld({pull:e,active:t,selected:n,onSelect:r}){return(0,X.jsxs)(sd,{selected:n,disabled:!e.version,onSelect:r,title:e.url,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsxs)(`span`,{className:`shrink-0 text-[13px] text-muted-foreground`,children:[`#`,e.number]}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:e.title}),e.draft?(0,X.jsx)(Z,{variant:`outline`,children:`draft`}):null,t?(0,X.jsx)(Z,{variant:`secondary`,children:`current`}):e.version?e.installed?(0,X.jsx)(Z,{variant:`outline`,children:`installed`}):null:(0,X.jsx)(Z,{variant:`outline`,children:`no build`})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11.5px] text-muted-foreground`,children:[e.author?(0,X.jsx)(`span`,{className:`shrink-0`,children:e.author}):null,(0,X.jsxs)(`span`,{className:`min-w-0 truncate font-mono`,children:[`· `,e.branch]}),(0,X.jsxs)(`span`,{className:`shrink-0`,children:[`· updated `,qa(e.updatedAt),` ago`]}),e.version?(0,X.jsxs)(`span`,{className:`shrink-0`,children:[`· build `,e.publishedAt?`${qa(e.publishedAt)} ago`:e.version]}):null]})]})}function ud({open:e,onOpenChange:t,autoApply:n,brandName:r=`cezar`}){let i=At(e),a=tt(),o=ve(),s=Ee(),[c,l]=(0,Y.useState)(``),u=i.data,d=(0,Y.useRef)(null),f=(0,Y.useRef)(!1);return(0,Y.useEffect)(()=>{!n||f.current||!u||!u.canSelfUpdate||u.job||(f.current=!0,!(u.activeRuns>0)&&s.mutate(n))},[n,u,s]),(0,X.jsx)(fa,{open:e,onOpenChange:e=>{!e&&u?.job?.status===`running`||t(e)},children:(0,X.jsxs)(pa,{"data-slot":`self-update-dialog`,className:`sm:max-w-xl`,ref:d,onOpenAutoFocus:e=>{e.preventDefault(),d.current?.focus()},children:[(0,X.jsxs)(ha,{children:[(0,X.jsxs)(ma,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(`span`,{children:[r,` `,u?`v${u.version}`:``]}),(0,X.jsx)(gd,{data:u})]}),(0,X.jsxs)(xa,{className:`sr-only`,children:[`Update `,r,`, pick a release channel or switch versions.`]})]}),u?(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5`,children:[(0,X.jsx)(pd,{data:u,busy:o.isPending,onChange:e=>{l(``),o.mutate(e)}}),(0,X.jsx)(md,{data:u,checking:a.isPending,onCheck:()=>a.mutate(),onApply:e=>s.mutate(e),applying:s.isPending}),u.channel===`development`?(0,X.jsx)(od,{data:u,onApply:e=>s.mutate(e),applying:s.isPending}):(0,X.jsx)(hd,{data:u,picked:c,onPick:l,onApply:e=>s.mutate(e),applying:s.isPending}),u.canSelfUpdate?null:(0,X.jsx)(_d,{data:u}),u.activeRuns>0&&u.canSelfUpdate?(0,X.jsxs)(`p`,{className:`rounded-md border border-pending/50 bg-pending/10 px-3 py-2 text-[12.5px] text-foreground`,children:[u.activeRuns,` task`,u.activeRuns===1?` is`:`s are`,` running. A restart interrupts them; `,r,` re-queues or resumes them on the way back up.`]}):null,o.error?(0,X.jsxs)(`p`,{className:`text-[12.5px] text-danger`,children:[`Could not switch the channel: `,o.error.message,o.variables===`development`?` The running ${r} server predates the Development channel — restart ${r} to load it.`:null]}):null,s.error?(0,X.jsx)(`p`,{className:`text-[12.5px] text-danger`,children:s.error.message}):null,u.job?(0,X.jsx)(vd,{data:u}):null]}):i.error?(0,X.jsx)(`p`,{className:`text-[13px] text-danger`,children:i.error.message}):null]})})}var dd=[{value:`stable`,label:`Stable`},{value:`nightly`,label:`Nightly`},{value:`development`,label:`Development`}],fd={stable:`Tagged releases.`,nightly:`A fresh build of main every night.`,development:`A cezar worktree or an open pull request. Never updates on its own.`};function pd({data:e,busy:t,onChange:n}){return(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`text-[13px] font-semibold`,children:`Release channel`}),(0,X.jsx)(`div`,{className:`text-[12px] text-muted-foreground`,children:fd[e.channel]})]}),(0,X.jsx)(`div`,{role:`radiogroup`,"aria-label":`Release channel`,"data-slot":`channel-toggle`,className:`flex shrink-0 rounded-md border border-border bg-muted/40 p-0.5`,children:dd.map(r=>{let i=e.channel===r.value;return(0,X.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":i,disabled:t,onClick:()=>!i&&n(r.value),className:K(`rounded-[5px] px-3 py-1 text-[12.5px] font-semibold transition-colors`,i?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:r.label},r.value)})})]})}function md({data:e,checking:t,onCheck:n,onApply:r,applying:i}){let a=e.job?.status===`running`||e.job?.status===`restarting`,o=e.installed.find(e=>e.active),s=o?.source===`registry`?ad(o.version):null,c=o&&(o.source===`link`||o.source===`local`||s!==null)?o:null;if(c||e.channel===`development`){let o=e.channel===`development`?null:e.latest[e.channel],l=o!==null&&e.installed.some(e=>e.source===`registry`&&e.id===o);return(0,X.jsxs)(`div`,{"data-slot":`self-update-latest`,className:`flex flex-col gap-2 rounded-md border border-border bg-card px-3 py-2.5`,children:[(0,X.jsx)(`div`,{className:`min-w-0 text-[13px] break-words`,children:c?.source===`link`?(0,X.jsxs)(X.Fragment,{children:[`Running worktree `,(0,X.jsx)(`span`,{className:`font-mono text-[12.5px] font-semibold`,children:c.branch??c.id}),`, not a release.`]}):c?.source===`local`?(0,X.jsx)(X.Fragment,{children:`Running a local build, not a release.`}):s===null?(0,X.jsxs)(X.Fragment,{children:[`Running `,(0,X.jsxs)(`span`,{className:`font-semibold`,children:[`v`,e.version]}),`. Pick a worktree or a pull request below.`]}):(0,X.jsxs)(X.Fragment,{children:[`Running the preview build of `,(0,X.jsxs)(`span`,{className:`font-semibold`,children:[`PR #`,s]}),`, not a release.`]})}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,X.jsx)(`div`,{className:`min-w-0 text-[11.5px] break-words text-muted-foreground`,children:e.channel===`development`?`Switch the channel back to Stable or Nightly to follow releases again.`:e.checkedAt?(0,X.jsxs)(X.Fragment,{children:[o?(0,X.jsxs)(X.Fragment,{children:[`Newest `,e.channel,`: `,(0,X.jsxs)(`span`,{className:`font-mono text-foreground`,children:[`v`,o]}),` ·`,` `]}):null,`checked `,new Date(e.checkedAt).toLocaleTimeString()]}):`The npm registry has not answered yet.`}),e.channel===`development`?null:(0,X.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,X.jsx)(q,{variant:`ghost`,size:`sm`,onClick:n,disabled:t||a,children:t?`Checking…`:`Check again`}),o?(0,X.jsx)(q,{size:`sm`,"aria-label":l?`Back to v${o}`:`Install v${o} & restart`,onClick:()=>r(o),disabled:!e.canSelfUpdate||i||a,children:l?`Switch back`:`Install & restart`}):null]})]})]})}let l=e.updateAvailable;return(0,X.jsxs)(`div`,{"data-slot":`self-update-latest`,className:K(`flex items-center justify-between gap-3 rounded-md border px-3 py-2.5`,l?`border-primary/40 bg-primary/5`:`border-border bg-card`),children:[(0,X.jsxs)(`div`,{className:`min-w-0 text-[13px]`,children:[e.checkedAt?l?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{className:`font-semibold`,children:[`v`,l]}),` is available on `,e.channel,`.`]}):(0,X.jsxs)(X.Fragment,{children:[`You are on the newest `,e.channel,` version`,e.channel===`nightly`&&e.latest.nightly?` (v${e.latest.nightly})`:``,`.`]}):(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`The npm registry has not answered yet.`}),e.checkedAt?(0,X.jsxs)(`div`,{className:`text-[11.5px] text-muted-foreground`,children:[`checked `,new Date(e.checkedAt).toLocaleTimeString()]}):null]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,X.jsx)(q,{variant:`ghost`,size:`sm`,onClick:n,disabled:t||a,children:t?`Checking…`:`Check again`}),l?(0,X.jsx)(q,{size:`sm`,onClick:()=>r(l),disabled:!e.canSelfUpdate||i||a,children:`Update & restart`}):null]})]})}function hd({data:e,picked:t,onPick:n,onApply:r,applying:i}){let a=e.job?.status===`running`||e.job?.status===`restarting`,o=(0,Y.useMemo)(()=>{let t=e.channel===`stable`?e.installed.filter(e=>e.source===`local`).map(e=>({value:e.id,label:`v${e.version} · local build`,installed:!0,active:e.active})):[],n=e.available.filter(t=>t.channel===e.channel).map(t=>({value:t.version,label:`v${t.version}${t.publishedAt?` · ${t.publishedAt.slice(0,10)}`:``}`,installed:t.installed,active:e.installed.some(e=>e.active&&e.id===t.version)}));return[...t,...n]},[e]),s=o.find(e=>e.value===t);return(0,X.jsxs)(`div`,{"data-slot":`self-update-picker`,className:`flex min-w-0 flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`text-[13px] font-semibold`,children:[`Pick a version `,(0,X.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,e.channel]})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsxs)(Qu,{value:t,onValueChange:n,disabled:o.length===0||a,children:[(0,X.jsx)(ed,{size:`sm`,"aria-label":`Version`,className:`w-0 min-w-0 flex-1 text-[13px]`,children:(0,X.jsx)($u,{placeholder:o.length===0?`No versions known`:`Choose a version to install`})}),(0,X.jsx)(td,{className:`max-h-72`,children:o.map(e=>(0,X.jsx)(nd,{value:e.value,children:(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.label,e.active?(0,X.jsx)(Z,{variant:`secondary`,children:`current`}):e.installed?(0,X.jsx)(Z,{variant:`outline`,children:`installed`}):null]})},e.value))})]}),(0,X.jsx)(q,{size:`sm`,variant:`contrast`,onClick:()=>s&&r(s.value),disabled:!s||s.active||!e.canSelfUpdate||i||a,children:s?.installed?`Switch & restart`:`Install & restart`})]}),(0,X.jsx)(`p`,{className:`text-[11.5px] text-muted-foreground`,children:`Any version, older ones included. Installed versions stay on disk, so switching back is instant.`})]})}function gd({data:e}){let t=e?.installed.find(e=>e.active);if(t?.source===`local`)return(0,X.jsx)(Z,{variant:`outline`,children:`local build`});if(t?.source===`link`)return(0,X.jsxs)(Z,{variant:`outline`,children:[`worktree · `,t.branch??t.id]});let n=t?ad(t.version):null;return n===null?null:(0,X.jsxs)(Z,{variant:`outline`,children:[`PR #`,n,` build`]})}function _d({data:e}){let t=e.installKind===`checkout`?`node packages/cezar/dist/index.js install`:e.installKind===`global-npm`?`cezar install`:`npx cezar-cli install`;return(0,X.jsxs)(`div`,{"data-slot":`self-update-install-hint`,className:`rounded-md border border-border bg-muted/40 px-3 py-2.5 text-[12.5px]`,children:[(0,X.jsx)(`p`,{children:e.reason}),(0,X.jsx)(`p`,{className:`mt-1.5 text-muted-foreground`,children:`Run this once, then start cezar with the plain command:`}),(0,X.jsx)(`pre`,{className:`mt-1.5 overflow-x-auto rounded bg-background px-2 py-1.5 font-mono text-[12px]`,children:t})]})}function vd({data:e}){let t=e.job,n=I(),r=(0,Y.useRef)(null),[i,a]=(0,Y.useState)(`waiting`);return(0,Y.useEffect)(()=>{r.current?.scrollTo({top:r.current.scrollHeight})},[t.log.length]),(0,Y.useEffect)(()=>{if(t.status!==`restarting`)return;let r=!1,i=Date.now(),o=()=>{a(`back`),n.removeQueries({queryKey:c.selfUpdate}),window.setTimeout(()=>window.location.reload(),400)},s=async()=>{if(!r){try{if((await bt()).version!==e.version)return o();let t=await v().catch(()=>null);if(t&&!t.job)return o()}catch{}if(Date.now()-i>9e4){a(`timeout`);return}window.setTimeout(s,1e3)}};return window.setTimeout(s,1500),()=>{r=!0}},[t.status,e.version,n]),(0,X.jsxs)(`div`,{"data-slot":`self-update-job`,className:`flex min-w-0 flex-col gap-1.5`,children:[(0,X.jsx)(`div`,{className:`flex items-center justify-between text-[12.5px]`,children:(0,X.jsx)(`span`,{className:`font-semibold`,children:t.status===`running`?`Installing ${t.target}…`:t.status===`failed`?`Install of ${t.target} failed`:i===`back`?`Back — reloading`:i===`timeout`?`Restart took too long — reload the page by hand`:`Restarting into ${t.target}…`})}),(0,X.jsx)(`pre`,{ref:r,className:`max-h-40 min-w-0 overflow-y-auto rounded-md border border-border bg-background px-2 py-1.5 font-mono text-[11px] leading-[1.5] break-all whitespace-pre-wrap text-muted-foreground`,children:t.log.join(`
|
|
3
|
-
`)}),t.error?(0,X.jsx)(`p`,{className:`text-[12.5px] text-danger`,children:t.error}):null]})}var yd=`cez-sidebar-width`;function bd(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(420,Math.max(264,Math.round(t))):264}function xd(){try{let e=localStorage.getItem(yd);return e===null?264:bd(e)}catch{return 264}}function Sd(e){try{localStorage.setItem(yd,String(bd(e)))}catch{}}var Cd=`(min-width: 768px)`,wd=Y.createContext(void 0),Td=Y.memo(function({children:e,mainRef:t}){return(0,X.jsx)(`main`,{ref:t,"data-slot":`main`,className:`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,children:e})});function Ed(){return Y.useContext(wd)}function Dd(e){return bn({path:`/tasks/:id`,end:!0},it(e))!==null}var Od=Y.memo(function({children:e,repo:t=null,inboxCount:n=null,unreadCount:r=null,skillsUpdateAvailable:i=!1,version:a=null,latestVersion:o=null,starCount:s=null,taskQuickList:c,hostWidget:l,toolsMenu:u,forgeAvailable:d=!0,inboxAvailable:f=!0,automationsAvailable:m=!0,tracker:h,singleProject:g=!1,banner:_,projectGroups:v,brandName:y=`cezar`,brandLogoUrl:b=null}){let{pathname:x}=p(),S=it(x),C=$l(S),w=eu(S),T=w?.to===`/tracker`&&h?{...w,label:js[h].label}:w,[E,D]=Y.useState(!1),O=Y.useCallback(()=>D(!1),[]),k=Y.useRef(null),A=Dd(x),[j,M]=Y.useState(xd),N=Y.useCallback(e=>{let t=bd(e);M(t),Sd(t)},[]);Y.useLayoutEffect(()=>{if(A)return;let e=k.current;e&&(e.scrollTop=0)},[x,A]),Y.useEffect(()=>{D(!1)},[x]),Y.useEffect(()=>{let e=window.matchMedia?.(Cd);if(!e)return;e.matches&&D(!1);let t=e=>{e.matches&&D(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let P={activeTo:C,items:Y.useMemo(()=>Zl({forge:d,inbox:f,automations:m,tracker:h}),[d,f,m,h]),repo:t,inboxCount:f?n:null,unreadCount:r,skillsUpdateAvailable:i,version:a,latestVersion:o,starCount:s,taskQuickList:c,hostWidget:l,toolsMenu:u,projectGroups:v,singleProject:g,brandName:y,brandLogoUrl:b},F=Ad();return(0,X.jsxs)(`div`,{"data-slot":`app-shell`,"data-desktop":F??void 0,className:`flex h-dvh overflow-hidden bg-background text-foreground pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)]`,children:[F===`macos`?(0,X.jsx)(`div`,{"data-slot":`desktop-titlebar`,"data-tauri-drag-region":``,className:`fixed inset-x-0 top-0 z-[60] flex h-[28px] select-none items-center pl-[80px]`,children:a&&o&&o!==a?(0,X.jsx)(kd,{latestVersion:o,brandName:y}):null}):null,(0,X.jsx)(jd,{...P,width:j,onWidthChange:N,desktop:F}),(0,X.jsxs)(`div`,{className:K(`grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,F===`macos`&&`pt-[28px]`),children:[(0,X.jsxs)(Tr,{open:E,onOpenChange:D,children:[(0,X.jsx)(Wd,{title:T?.label??y}),(0,X.jsx)(Nd,{...P,onNavigate:O})]}),_?(0,X.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:_}):null,(0,X.jsx)(Td,{mainRef:k,children:e}),(0,X.jsx)(`div`,{"data-slot":`composer`,className:`row-start-4 pb-[env(safe-area-inset-bottom)]`})]})]})});function kd({latestVersion:e,brandName:t}){let[n,r]=Y.useState(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,"data-slot":`titlebar-update`,onClick:()=>r(!0),title:`Update ${t} to v${e} and restart`,className:`inline-flex h-[18px] items-center gap-1 rounded-full border border-primary/40 bg-primary/15 px-2 text-[11px] font-semibold text-foreground transition-colors hover:bg-primary/30`,children:[(0,X.jsx)(Ka,{tone:`pending`,pulse:!0,className:`size-[5px] shrink-0`}),`Update `,t,(0,X.jsxs)(`span`,{className:`font-mono font-medium text-muted-foreground`,children:[`v`,e]})]}),n?(0,X.jsx)(ud,{open:n,onOpenChange:r,autoApply:e,brandName:t}):null]})}function Ad(){let[e]=Y.useState(()=>{if(typeof document>`u`)return null;let e=document.documentElement.dataset.cezDesktop;return e===`macos`||e===`windows`||e===`linux`?e:null});return e}var jd=Y.memo(function({width:e,onWidthChange:t,desktop:n=null,...r}){return(0,X.jsxs)(`aside`,{"data-slot":`sidebar`,style:{width:e},className:K(`relative hidden shrink-0 flex-col border-r border-border bg-sidebar md:flex`,n===`macos`&&`pt-[28px]`),children:[(0,X.jsx)(Pd,{...r,compactHeader:n===`macos`}),(0,X.jsx)(Md,{width:e,onWidthChange:t})]})});function Md({width:e,onWidthChange:t}){let n=Y.useRef(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(bd(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,X.jsx)(`div`,{"data-slot":`sidebar-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the sidebar`,"aria-valuenow":e,"aria-valuemin":264,"aria-valuemax":420,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?264:n.key===`End`?420:null;r!==null&&(n.preventDefault(),t(bd(r)))},onDoubleClick:()=>t(264),title:`Drag to resize the sidebar — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-violet/40 focus-visible:bg-violet/60 focus-visible:outline-none`})}var Nd=Y.memo(function({onNavigate:e,...t}){return(0,X.jsxs)(Cr,{side:`left`,"data-slot":`mobile-nav-drawer`,showCloseButton:!1,className:`w-[264px] gap-0 border-border bg-sidebar p-0 sm:max-w-none md:hidden`,"aria-describedby":void 0,children:[(0,X.jsx)(Sr,{className:`sr-only`,children:`Navigation`}),(0,X.jsx)(Pd,{...t,onNavigate:e,headerAction:(0,X.jsx)(xr,{asChild:!0,children:(0,X.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`-mr-2 size-11`,children:(0,X.jsx)(Ea,{className:`size-[17px]`,"aria-hidden":`true`})})})})]})});function Pd({activeTo:e,items:t,repo:n,inboxCount:r,unreadCount:i,skillsUpdateAvailable:a,version:o,latestVersion:s,starCount:c,taskQuickList:l,hostWidget:u,toolsMenu:d,projectGroups:f,singleProject:p,brandName:m,brandLogoUrl:h,onNavigate:g,headerAction:_,compactHeader:v=!1}){return(0,X.jsxs)(`div`,{"data-slot":`sidebar-content`,className:`@container/sidebar flex min-h-0 flex-1 flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,X.jsxs)(`div`,{className:K(`flex items-center gap-[9px] px-3.5 pb-2.5`,v?`pt-1.5`:`pt-3.5`),children:[(0,X.jsx)(Zu,{name:m,logoUrl:h}),n&&!f?(0,X.jsxs)(`span`,{"data-slot":`repo-chip`,className:`ml-auto truncate font-mono text-[11px] font-medium text-soft-foreground`,children:[n.name,` / `,n.branch]}):null,_?(0,X.jsx)(`div`,{className:K(`shrink-0`,(!n||f)&&`ml-auto`),children:_}):null]}),(0,X.jsxs)(`div`,{className:`flex gap-1.5 px-2.5 pt-1 pb-2`,children:[(0,X.jsx)(q,{asChild:!0,variant:`contrast`,className:`relative min-w-0 flex-1 justify-center`,children:(0,X.jsxs)(H,{to:`/new`,onClick:g,children:[(0,X.jsx)(bs,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`absolute right-2.5 rounded-[5px] border border-b-2 border-contrast-foreground/25 bg-transparent px-[5px] py-px font-mono text-[10.5px] font-medium text-contrast-foreground/60`,children:`C`})]})}),p?null:(0,X.jsx)(Bd,{})]}),(0,X.jsx)(`div`,{className:`shrink-0 px-1.5`,children:(0,X.jsx)(Ld,{onNavigate:g})}),f?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`shrink-0 border-b border-border px-1.5 pt-0.5 pb-2`,children:(0,X.jsx)(Rd,{onNavigate:g})}),(0,X.jsx)(`div`,{"data-slot":`project-groups`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pt-1.5 pb-2`,children:(0,X.jsx)(wd.Provider,{value:g,children:f})})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`nav`,{"aria-label":`Main`,className:`px-2.5 py-1.5`,children:t.map(t=>{let n=t.to===e,o=t.icon;return(0,X.jsxs)(H,{to:t.to,onClick:g,"aria-current":n?`page`:void 0,className:K(`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-[13.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground md:h-[34px]`,n&&`bg-muted font-semibold text-foreground`),children:[(0,X.jsx)(o,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&r?(0,X.jsx)(`span`,{"data-slot":`nav-badge`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:r}):null,t.badge===`tasks-unread`&&i?(0,X.jsx)(`span`,{"data-slot":`nav-unread-badge`,title:`${i} unread finished ${i===1?`task`:`tasks`}`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:i}):null,t.badge===`skills-update`&&a?(0,X.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,X.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,X.jsx)(`div`,{"data-slot":`task-quick-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2.5 pb-2`,children:l})]}),(0,X.jsxs)(`div`,{"data-slot":`sidebar-footer`,className:`flex flex-col gap-1.5 border-t border-border px-3.5 py-2.5`,children:[u,(0,X.jsx)(Vd,{}),(0,X.jsxs)(`div`,{"data-slot":`sidebar-footer-controls`,className:`flex items-center gap-2`,children:[(0,X.jsx)(`div`,{"data-slot":`tools-menu`,className:`shrink-0`,children:d}),o?(0,X.jsx)(Hd,{version:o,latestVersion:s,brandName:m}):null,c===null?null:(0,X.jsx)(Ud,{count:c}),(0,X.jsx)(zd,{onNavigate:g,className:`ml-auto`}),(0,X.jsx)(gu,{})]})]})]})}var Fd=`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-[13.5px] font-semibold text-foreground transition-colors hover:bg-muted md:h-9`;function Id(e){return K(`size-4 shrink-0`,e?`text-violet`:`text-violet/70`)}function Ld({onNavigate:e}){return(0,X.jsx)(_e,{to:`/dashboard`,"data-slot":`dashboard-link`,onClick:e,className:({isActive:e})=>K(Fd,e&&`bg-muted`),children:({isActive:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(_r,{className:Id(e),"aria-hidden":`true`}),`Dashboard`]})})}function Rd({onNavigate:e}){let{pathname:t}=p(),n=t===`/tasks`;return(0,X.jsxs)(pe,{to:`/tasks`,"data-slot":`all-tasks-link`,onClick:e,"aria-current":n?`page`:void 0,className:K(Fd,n&&`bg-muted`),children:[(0,X.jsx)(ls,{className:Id(n),"aria-hidden":`true`}),`All tasks`]})}function zd({className:e,onNavigate:t}){return(0,X.jsx)(q,{asChild:!0,variant:`ghost`,size:`icon`,className:K(`size-7`,e),children:(0,X.jsx)(pe,{to:`/settings/global`,"data-slot":`global-settings-link`,"aria-label":`Global settings`,title:`Global settings`,onClick:t,children:(0,X.jsx)(Ss,{className:`size-4`,"aria-hidden":`true`})})})}function Bd(){let[e,t]=Y.useState(!1),[n,r]=Y.useState(!1);return(0,X.jsxs)(ea,{children:[(0,X.jsx)(Wi,{asChild:!0,children:(0,X.jsx)(q,{variant:`outline`,size:`icon`,"aria-label":`Add project`,title:`Add project`,className:`size-11 shrink-0 md:size-9`,children:(0,X.jsx)($o,{className:`size-4`,"aria-hidden":`true`})})}),(0,X.jsxs)(Xi,{align:`start`,className:`w-56`,children:[(0,X.jsx)(Ji,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,X.jsxs)(Qi,{"data-slot":`add-project-local`,onSelect:()=>t(!0),children:[(0,X.jsx)(qi,{"aria-hidden":`true`}),`Open local folder…`]}),(0,X.jsxs)(Qi,{"data-slot":`add-project-clone`,onSelect:()=>r(!0),children:[(0,X.jsx)(Yl,{"aria-hidden":`true`}),`Clone from GitHub…`]})]}),e?(0,X.jsx)(Wl,{open:!0,onOpenChange:t}):null,n?(0,X.jsx)(Jl,{open:!0,onOpenChange:r}):null]})}function Vd(){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search — command palette (⌘K / Ctrl+K)`,onClick:()=>wu(),className:`flex w-full items-center gap-1.5 rounded-md border border-border bg-muted/30 px-2 py-1 text-left text-xs font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,X.jsx)(la,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate`,children:`Search…`}),(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`ml-auto shrink-0 rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:vi(`k`)})]})}function Hd({version:e,latestVersion:t,brandName:n}){let r=!!(t&&t!==e),[i,a]=Y.useState(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,"data-slot":`version-chip`,"data-update-available":r?`true`:void 0,title:r?`v${e} — update available: v${t}`:`v${e}`,"aria-label":r?`${n} v${e}, update to v${t} available — open updater`:`${n} v${e} — open updater`,onClick:()=>a(!0),className:`flex min-w-0 cursor-pointer items-center gap-1 rounded-full border border-border px-1.5 py-px font-mono text-[10px] font-medium text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[r?(0,X.jsx)(Ka,{tone:`pending`,pulse:!0,className:`size-[5px] shrink-0`}):null,(0,X.jsxs)(`span`,{className:`truncate`,children:[`v`,e]})]}),i?(0,X.jsx)(ud,{open:i,onOpenChange:a,brandName:n}):null]})}function Ud({count:e}){let t=Iu(e);return(0,X.jsxs)(`a`,{"data-slot":`star-chip`,href:Pu,target:`_blank`,rel:`noopener noreferrer`,title:`Star cezar on GitHub — ${e.toLocaleString()} stars`,"aria-label":`Star cezar on GitHub — ${e.toLocaleString()} stars`,className:`flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px font-mono text-[10px] font-medium text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`⭐`}),(0,X.jsx)(`span`,{children:t})]})}function Wd({title:e}){return(0,X.jsx)(`header`,{"data-slot":`mobile-top-bar`,className:`row-start-1 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,X.jsxs)(`div`,{className:`flex h-11 items-center gap-2.5 px-3`,children:[(0,X.jsx)(wr,{asChild:!0,children:(0,X.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":`Open menu`,className:`-ml-1.5 size-11`,children:(0,X.jsx)(ps,{className:`size-[17px]`,"aria-hidden":`true`})})}),(0,X.jsx)(`span`,{className:`truncate text-[14.5px] font-semibold`,children:e}),(0,X.jsx)(`div`,{"data-slot":`mobile-status`,className:`ml-auto flex items-center gap-2`})]})})}var Gd=Y.createContext(null);function Kd({children:e}){let[t,n]=Y.useState(`active`),r=Y.useMemo(()=>[t,n],[t]);return(0,X.jsx)(Gd.Provider,{value:r,children:e})}function qd(){let e=Y.useContext(Gd);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}var Jd=1e4,Yd=e=>Math.min(100,Math.max(0,e)),Xd=e=>e===void 0||e<80?`ok`:e<90?`warn`:`critical`;function Zd(){let e=ho(),t=bo();return!e||t!==`local`?null:(0,X.jsx)(Qd,{})}function Qd(){let e=Oo(),t=ko(),n=Ao(),[r,i]=(0,Y.useState)(!1);(0,Y.useEffect)(()=>{if(n===void 0){i(!1);return}let e=n+Jd-Date.now();if(e<=0){i(!0);return}i(!1);let t=setTimeout(()=>i(!0),e);return()=>clearTimeout(t)},[n]);let a=e===void 0?void 0:fo(e),o=a?.cpuPct,s=r?`stale`:a!==void 0&&a.cpuLimited&&o===void 0?`—`:o===void 0?t.length===0?`sampling…`:`—`:`${Math.round(o)}%`,c=a===void 0||a.memUsedBytes===void 0||a.memTotalBytes<=0?void 0:a.memUsedBytes/a.memTotalBytes*100,l=r?`stale`:c===void 0?`—`:`${Math.round(c)}%`,u=a===void 0?`—`:mo(a.memUsedBytes,a.memTotalBytes),d=a?.cpuLimited===!0?`${a.cpuLimitKind===`cpuset`?`cpuset `:``}${po(a.cpuCores)}`:void 0,f=`CPU ${s}${d===void 0?``:` of ${d}`}, RAM ${l} (${u})`;return(0,X.jsxs)(H,{to:`/settings/resources`,"data-slot":`host-usage-widget`,"data-state":r?`stale`:`live`,"data-frames":t.length,"aria-label":`Machine usage: ${f}. Open Settings, Resources.`,title:f,className:K(`grid grid-cols-[auto_minmax(0,1fr)_auto_auto_minmax(0,1fr)_auto] items-center gap-x-1.5 rounded-md border border-border px-2 py-1 text-[11px] leading-[14px] text-soft-foreground transition-colors hover:bg-muted hover:text-foreground`,r?`opacity-70`:null),children:[(0,X.jsx)($d,{label:`CPU`,pct:r?void 0:o,valueSlot:`host-usage-widget-cpu`,value:s}),(0,X.jsx)($d,{label:`RAM`,pct:r?void 0:c,valueSlot:`host-usage-widget-mem-pct`,value:l,gutter:!0})]})}function $d({label:e,pct:t,valueSlot:n,value:r,gutter:i}){let a=Xd(t);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:K(`font-medium tracking-wide text-muted-foreground`,i===!0?`ml-1`:null),children:e}),(0,X.jsx)(`span`,{"data-slot":`host-usage-widget-${e.toLowerCase()}-bar`,"data-level":a,role:`meter`,"aria-label":e,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t===void 0?void 0:Math.round(Yd(t)),className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,X.jsx)(`span`,{className:K(`block h-full rounded-full transition-[width] duration-500`,a===`critical`?`bg-destructive`:a===`warn`?`bg-pending`:`bg-primary`),style:{width:`${t===void 0?0:Yd(t)}%`}})}),(0,X.jsx)(`span`,{"data-slot":n,className:K(`text-right font-medium tabular-nums`,a===`critical`?`text-destructive`:a===`warn`?`text-pending-strong`:`text-foreground`),children:r})]})}var ef=[`claude`,`codex`,`junie`,`opencode`,`cursor`,`pi`,`copilot`],tf={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,junie:`Junie`,copilot:`GitHub Copilot CLI`};function nf(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t=e,n={};for(let e of ef){let r=t[e];typeof r==`string`&&r.length>0&&r.length<=128&&(n[e]=r)}return n}function rf(e,t){if(!e)return[];let n=new Map(e.providers.map(e=>[e.provider,e]));return ef.flatMap(e=>{let r=n.get(e);return r?.status!==`disconnected`||!r.authFailureId||t[e]===r.authFailureId?[]:[{provider:e,label:tf[e],authFailureId:r.authFailureId}]})}function af(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function of({status:e,pending:t,error:n,dismissals:r,onDismissAuthFailures:i}){if(t||!e)return null;let a;try{a=jt(e)}catch{return null}let o=rf(a,r);if(o.length>0)return(0,X.jsxs)(`div`,{"data-slot":`provider-banner`,role:`alert`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-destructive/10 px-4 text-sm text-foreground`,children:[(0,X.jsx)(Ka,{tone:`danger`}),(0,X.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,o.map(({label:e})=>e).join(`, `),`.`]}),(0,X.jsx)(H,{to:`/settings/agents#providers`,className:`ml-auto shrink-0 font-medium underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:`Open agent settings`}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Dismiss provider authentication alert`,onClick:()=>i(o),className:`shrink-0 rounded-sm p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,X.jsx)(Ea,{className:`size-4`,"aria-hidden":`true`})})]});if(n||a.providers.some(e=>e.enabled&&e.status===`connected`))return null;let s=a.providers.some(e=>e.status===`connected`),c=a.providers.some(e=>e.status===`unknown`);return(0,X.jsxs)(`div`,{"data-slot":`provider-banner`,role:`status`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-muted/50 px-4 text-sm text-muted-foreground`,children:[(0,X.jsx)(Ka,{tone:c?`danger`:`pending`}),(0,X.jsx)(`span`,{children:s?`No agent provider is enabled.`:c?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,X.jsx)(H,{to:`/settings/agents#providers`,className:`ml-auto shrink-0 font-medium text-foreground underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:`Configure providers`})]})}function sf(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function cf(){let e=a(),t=qe(),n=I(),r=(0,Y.useRef)(Promise.resolve()),i=(0,Y.useRef)(0),o=(0,Y.useRef)(0),s=(0,Y.useRef)(sf(t.data));(0,Y.useEffect)(()=>{o.current===0&&(s.current=sf(t.data))},[t.data]);let l=(0,Y.useCallback)(e=>{let t=c.uiState,a=sf(n.getQueryData(t)),l=af(nf(a?.dismissedProviderAuthFailures),e),u={...a,dismissedProviderAuthFailures:l};o.current+=1,n.setQueryData(t,u);let d=++i.current;r.current=r.current.then(async()=>{try{let e=await oe({dismissedProviderAuthFailures:l});s.current=sf(e),d===i.current&&n.setQueryData(t,e)}catch(e){d===i.current&&(s.current===void 0?n.removeQueries({queryKey:t,exact:!0}):n.setQueryData(t,s.current),n.invalidateQueries({queryKey:t}),V(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--o.current}})},[n]);return(0,X.jsx)(of,{status:e.data,pending:e.isPending,error:e.isError,dismissals:nf(sf(t.data)?.dismissedProviderAuthFailures),onDismissAuthFailures:l})}function lf({pinned:e,onToggle:t,className:n}){return(0,X.jsx)(`button`,{type:`button`,"data-slot":`pin-toggle`,"data-pinned":e?`true`:void 0,"aria-pressed":e,"aria-label":e?`Unpin task`:`Pin task`,title:e?`Unpin from the top of the list`:`Pin to the top of the list`,onClick:n=>{n.stopPropagation(),t(!e)},className:K(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-soft-foreground transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,e&&`text-violet hover:text-violet`,n),children:(0,X.jsx)(Er,{className:K(`size-3`,e&&`fill-current`),"aria-hidden":`true`})})}function uf(){return(0,X.jsx)(`span`,{"data-slot":`unread-marker`,className:`sr-only`,children:`, unread`})}var df=`regular`,ff=[{value:`regular`,label:`Regular`},{value:`automation`,label:`Automations`},{value:`all`,label:`All`}],pf=`cez-task-origin`;function mf(e){return e.automationId??e.automation?.automationId??e.automationTrigger?.automationId??e.automationTracker?.automationId}function hf(e,t){let n=mf(e);if(n!==void 0)return n;let r=e.dispatch?.rootRunId;if(r===void 0||r===e.id)return;let i=t(r);return i===void 0?void 0:mf(i)}function gf(e,t){return t===`all`?!0:t===`automation`?e!==void 0:e===void 0}function _f(e){return e===`regular`||e===`automation`||e===`all`?e:df}function vf(){try{return _f(localStorage.getItem(pf))}catch{return df}}var yf=new Set,bf;function xf(e){try{localStorage.setItem(pf,e)}catch{bf=e}for(let e of yf)e()}function Sf(){return bf??vf()}function Cf(e){yf.add(e);let t=t=>{(t.key===null||t.key===`cez-task-origin`)&&e()};return window.addEventListener(`storage`,t),()=>{yf.delete(e),window.removeEventListener(`storage`,t)}}function wf(){return[Y.useSyncExternalStore(Cf,Sf,()=>df),xf]}var Tf={statuses:[],workflows:[],automations:[]};function Ef(e){return e.statuses.length+e.workflows.length+e.automations.length}function Df(e){let t=new Map(e.map(e=>[e.id,e]));return new Map(e.map(e=>[e.id,hf(e,e=>t.get(e))]))}var Of=(e,t)=>e.length===0||t!==void 0&&e.includes(t);function kf(e,t,n,r){return e.filter(e=>{let i=r.get(e.id);return!(!gf(i,t)||!Of(n.statuses,e.status)||!Of(n.workflows,mn(e))||t!==`regular`&&!Of(n.automations,i))})}function Af(e,t){return t===`all`?[...e]:kf(e,t,Tf,Df(e))}function jf(e,t,n,r,i){let a=new Map;for(let o of kf(e,t,{...n,[i]:[]},r)){let e=i===`statuses`?o.status:i===`workflows`?mn(o):r.get(o.id);e!==void 0&&a.set(e,(a.get(e)??0)+1)}return a}function Mf(e,t,n){return{regular:kf(e,`regular`,t,n).length,automation:kf(e,`automation`,t,n).length,all:kf(e,`all`,t,n).length}}function Nf(e){let t=new Set;for(let n of e)n!==void 0&&t.add(n);return[...t].sort((e,t)=>e.localeCompare(t))}function Pf(e){let t=new Map;for(let n of e)t.has(n.id)||t.set(n.id,{run:n,depth:0,children:[],childCount:0,descendantCount:0});let n=e=>{let n=e.dispatch?.parentRunId;if(n===void 0||n===e.id)return null;let r=t.get(n);if(r===void 0)return null;let i=new Set([e.id]),a=r;for(;a!==void 0;){if(i.has(a.run.id))return null;i.add(a.run.id);let e=a.run.dispatch?.parentRunId;a=e===void 0?void 0:t.get(e)}return r},r=[];for(let i of e){let e=t.get(i.id);if(e===void 0||e.run!==i)continue;let a=n(i);a===null?r.push(e):a.children.push(e)}let i=(e,t)=>{e.depth=t,e.childCount=e.children.length;let n=0;for(let r of e.children)n+=1+i(r,t+1);return e.descendantCount=n,n};for(let e of r)i(e,0);return r}function Ff(e,t){let n=[],r=e=>{for(let i of e)n.push(i),(i.children.length===0||t===void 0||t(i.run.id))&&r(i.children)};return r(e),n}function If(e,t){return Ff(Pf(e),t)}function Lf(e){return e<=0?null:`${e} subtask${e===1?``:`s`}`}function Rf(e){return e.dispatch?.parentRunId===void 0?null:e.dispatch.kind??`implement`}function zf({runs:e,view:t,onViewChange:n,currentRunId:r=null,now:i=Date.now(),showTokens:a=!0,showCost:o=!0,onTogglePin:s}){let c=De(e),l=rt(e,t),u=t===`archived`?void 0:s;return(0,X.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,X.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,X.jsxs)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,X.jsxs)(Hf,{view:`active`,current:t,onSelect:n,count:c.active,children:[`Active`,c.waiting>0&&t!==`active`?(0,X.jsx)(Ka,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`needs you`}):null]}),(0,X.jsx)(Hf,{view:`archived`,current:t,onSelect:n,count:c.archived,children:`Archived`})]})}),l.length===0?(0,X.jsx)(`p`,{className:`px-3 py-3.5 text-xs text-soft-foreground`,children:t===`archived`?`Nothing archived yet.`:`No tasks yet — describe one.`}):(0,X.jsx)(Bf,{buckets:l,currentRunId:r,now:i,showTokens:a,showCost:o,onTogglePin:u})]})}function Bf({buckets:e,currentRunId:t=null,now:n=Date.now(),scope:r=null,showTokens:i=!0,showCost:a=!0,onTogglePin:o}){let[s,c]=Y.useState(()=>new Set),l=e=>c(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,X.jsx)(X.Fragment,{children:e.map(e=>(0,X.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":e.label,children:[(0,X.jsx)(`h2`,{className:`px-3 pt-2.5 pb-1 text-[11px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:e.label}),Vf(e.rows).map(e=>(0,X.jsx)(Uf,{row:e.run.row,depth:e.depth,childCount:e.childCount,currentRunId:t,now:n,scope:r,showTokens:i,showCost:a,expanded:e.run.row.kind===`group`&&s.has(e.run.row.groupId),onToggle:l,onTogglePin:o},e.run.id))]},e.label))})}function Vf(e){return If(e.map(e=>e.kind===`group`?{id:`group:${e.groupId}`,row:e}:{id:e.run.id,dispatch:e.run.dispatch,row:e}))}function Hf({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`view-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:K(`flex h-7 flex-1 items-center justify-center gap-1.5 rounded-[7px] text-[12.5px] font-medium text-muted-foreground`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,X.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function Uf({row:e,depth:t,childCount:n,currentRunId:r,now:i,scope:a,expanded:o,onToggle:s,showTokens:c,showCost:l,onTogglePin:u}){return e.kind===`run`?(0,X.jsx)(Kf,{run:e.run,depth:t,childCount:n,queuePosition:e.queuePosition,currentRunId:r,now:i,scope:a,showTokens:c,showCost:l,onTogglePin:u}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex items-center rounded-sm hover:bg-muted`,children:[(0,X.jsxs)(`button`,{type:`button`,"data-slot":`group-tile`,"data-group-id":e.groupId,"aria-expanded":o,onClick:()=>s(e.groupId),className:`flex min-w-0 flex-1 items-center gap-2 px-2.5 py-[7px] text-left`,children:[(0,X.jsx)(si,{className:K(`size-3 shrink-0 text-soft-foreground transition-transform`,!o&&`-rotate-90`),"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`min-w-[7rem] flex-1 truncate text-[13px] font-medium`,children:e.title}),(0,X.jsxs)(`span`,{className:`shrink-0 rounded-full bg-muted px-1.5 py-px font-mono text-[10.5px] font-semibold text-muted-foreground`,children:[`×`,e.members.length]})]}),(0,X.jsx)(H,{to:Qt(a,`/compare/${e.groupId}`),"data-slot":`group-compare`,title:`Compare the variants`,"aria-label":`Compare the variants of ${e.title}`,className:`mr-1.5 inline-flex size-6 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-violet/10 hover:text-violet`,children:(0,X.jsx)(xs,{className:`size-3.5`,"aria-hidden":`true`})})]}),o?e.members.map(e=>(0,X.jsx)(Kf,{run:e,queuePosition:null,currentRunId:r,now:i,scope:a,variant:!0,showTokens:c,showCost:l,onTogglePin:u},e.id)):null]})}var Wf=`w-0 overflow-hidden opacity-0 group-hover/task-row:-ml-1 group-hover/task-row:mr-1 group-hover/task-row:w-5 group-hover/task-row:opacity-100 group-focus-within/task-row:-ml-1 group-focus-within/task-row:mr-1 group-focus-within/task-row:w-5 group-focus-within/task-row:opacity-100 no-hover:-ml-1 no-hover:mr-1 no-hover:size-7 no-hover:opacity-100 data-[pinned=true]:-ml-1 data-[pinned=true]:mr-1 data-[pinned=true]:w-5 data-[pinned=true]:opacity-100`,Gf=`group-hover/task-row:hidden group-focus-within/task-row:hidden no-hover:hidden`,Kf=Y.memo(function({run:e,depth:t=0,childCount:n=0,queuePosition:r,currentRunId:i,now:a,scope:o,variant:s=!1,showTokens:c,showCost:l,onTogglePin:u}){let f=d(e),p=e.id===i,m=wt(e),h=z(e),g=gn(h,m?.number)?b(h).rest:h,_=kr(e),v=Dr(e),y=s?``:r===null?qa(e.finishedAt??e.createdAt,a):`#${r}`,x=Lf(n),S=Rf(e);return(0,X.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":p?`true`:void 0,"data-depth":t,style:t>0?{paddingLeft:`${10+t*14}px`}:void 0,className:K(`group/task-row flex items-center gap-2 rounded-sm pl-2.5 hover:bg-muted`,p&&`bg-muted`,s&&`pl-[26px]`),children:[(0,X.jsx)(Ka,{tone:f.tone,pulse:f.pulse,"aria-label":f.label,role:`img`}),m?(0,X.jsx)(Pr,{run:e,reference:m,compact:!0,className:`h-auto shrink-0 gap-[2px] px-1.5 py-px text-[10.5px]`}):null,(0,X.jsxs)(H,{to:Qt(o,`/tasks/${e.id}`),title:h,"aria-current":p?`page`:void 0,className:K(`flex min-w-0 flex-1 items-center gap-2 py-[7px]`,u?`pr-0.5`:`pr-2.5`),children:[s?(0,X.jsx)(`span`,{className:`inline-flex size-[15px] shrink-0 items-center justify-center rounded-full bg-violet/15 font-mono text-[9.5px] font-semibold text-violet`,children:e.variant??`?`}):null,(0,X.jsx)(`span`,{"data-slot":`task-row-title`,className:K(`min-w-[7rem] flex-1 truncate text-[13px]`,_?`font-semibold text-foreground`:v?`font-medium text-muted-foreground`:`font-medium`),children:s?qf(e,c,l):g}),S?(0,X.jsx)(`span`,{"data-slot":`dispatch-kind`,className:K(`shrink-0 rounded-full bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,u&&(e.pinned?`hidden`:Gf)),children:S}):null,e.diffStat?(0,X.jsx)(Ya,{stat:e.diffStat,className:`hidden shrink-0 text-[10.5px] @min-[23rem]/sidebar:inline`}):null,x?(0,X.jsx)(`span`,{"data-slot":`subtask-count`,title:x,className:`hidden shrink-0 rounded-full bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground @min-[19rem]/sidebar:inline`,children:n}):null,y&&(r!==null||!m)?(0,X.jsx)(`span`,{"data-slot":`task-row-age`,className:K(`shrink-0 text-[11px] text-soft-foreground tabular-nums`,S&&t>0&&r===null&&`hidden @min-[19rem]/sidebar:inline`),children:y}):null,_?(0,X.jsx)(uf,{}):null]}),u?(0,X.jsx)(lf,{pinned:!!e.pinned,onToggle:t=>u(e,t),className:Wf}):null]})});function qf(e,t,n){let r=[e.runner??`claude`];t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&r.push(Za(e.inputTokens,e.outputTokens));let i=st(e.costUsd);return n&&i&&r.push(i),r.join(` · `)}function Jf(){let e=Se(),t=ge(Pt(),e.data?.bootProject??null),n=Jt(),r=Ja(e.data),[i,a]=qd(),[o]=wf(),s=Y.useMemo(()=>t.data?Af(t.data,o):void 0,[t.data,o]),c=lt(`/tasks/:id/*`),l=lt(`/tasks/:id`),u=wa(3e4),d=Y.useCallback((e,t)=>n.mutate({id:e.id,pinned:t},{onError:e=>V(e.message,{tone:`danger`})}),[n.mutate]),f=Vt(),p=Y.useMemo(()=>f===void 0?[]:(s??[]).flatMap(e=>yt(e).map(e=>({projectId:f,kind:e.kind,number:e.number}))),[s,f]);return s?(0,X.jsx)(ni,{projectId:f,requests:p,children:(0,X.jsx)(zf,{runs:s,view:i,onViewChange:a,currentRunId:c?.params.id??l?.params.id??null,now:u,showTokens:r.tokens,showCost:r.cost,onTogglePin:d})}):null}var Yf=`cez-sidebar-collapsed`;function Xf(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))typeof r==`boolean`&&(t[n]=r);return t}function Zf(){try{let e=localStorage.getItem(Yf);return e===null?{}:Xf(JSON.parse(e))}catch{return{}}}function Qf(e){try{localStorage.setItem(Yf,JSON.stringify(e))}catch{}}function $f(e,t,n){let r=e?.[t];return r===void 0?t!==n:r}var ep=10;function tp(e){let[t,n]=Y.useState(Zf),r=Y.useRef(t),i=Y.useCallback(e=>{r.current=e,Qf(e),n(e)},[]);return{collapsed:t,toggle:Y.useCallback(t=>{i({...r.current,[t]:!$f(r.current,t,e)})},[e,i]),expand:Y.useCallback(e=>{if(!(e in r.current))return;let t={...r.current};delete t[e],i(t)},[i])}}function np({projects:e,bootProjectId:t,inboxAvailable:n=!1,automationsAvailable:r=!1,inboxCount:i=null,skillsUpdateAvailable:a=!1}){let{pathname:o}=p(),s=Ht(o),c=s??t,{collapsed:l,toggle:u,expand:d}=tp(c),[f]=qd(),m=$l(it(o)),h=lt(`/tasks/:id/*`),g=lt(`/tasks/:id`),_=h?.params.id??g?.params.id??null,v=wa(3e4),y=Ja(Se().data),{order:b,canReorder:x,setOrder:S}=Su(),C=Y.useMemo(()=>{let t=yu(e,b),n=t.filter(e=>e.unregistered);return n.length===0?t:[...n,...t.filter(e=>!e.unregistered)]},[e,b]),w=Y.useMemo(()=>C.map(e=>e.id),[C]),T=vr(rr(gr,{activationConstraint:{distance:4}}),rr(tr,{coordinateGetter:fr})),E=x&&C.length>1,D=Y.useCallback(e=>{let{active:t,over:n}=e;if(n===null||n.id===t.id)return;let r=w.indexOf(String(t.id)),i=w.indexOf(String(n.id));r===-1||i===-1||S(bu(w,r,i))},[w,S]),O=Y.useMemo(()=>{let e=e=>{let t=w.indexOf(String(e));return{name:C[t]?.name??String(e),position:`position ${t+1} of ${w.length}`}};return{onDragStart:({active:t})=>{let{name:n,position:r}=e(t.id);return`Picked up ${n}, ${r}.`},onDragOver:({active:t,over:n})=>n?`${e(t.id).name} moved to ${e(n.id).position}.`:`${e(t.id).name} is not over a drop position.`,onDragEnd:({active:t,over:n})=>n?`${e(t.id).name} dropped at ${e(n.id).position}.`:`${e(t.id).name} dropped. The order is unchanged.`,onDragCancel:({active:t})=>`Reordering cancelled. ${e(t.id).name} returned to ${e(t.id).position}.`}},[C,w]),k=C.map(e=>(0,X.jsx)(ip,{project:e,boot:e.id===t,active:e.id===s,collapsed:$f(l,e.id,c),onToggle:u,onSelect:d,view:f,activeTo:m,currentRunId:_,now:v,inboxAvailable:n,automationsAvailable:r,inboxCount:i,skillsUpdateAvailable:a,showTokens:y.tokens,showCost:y.cost,sortable:E,position:w.indexOf(e.id)+1,total:w.length},e.id));return(0,X.jsx)(`div`,{"data-slot":`project-group-list`,children:(0,X.jsx)(sr,{sensors:T,collisionDetection:yr,accessibility:{announcements:O},onDragEnd:D,children:(0,X.jsx)(ar,{items:w,strategy:pr,children:k})})})}function rp({name:e,position:t,total:n,disabled:r,handleProps:i}){return(0,X.jsx)(`button`,{type:`button`,"data-slot":`project-group-grip`,disabled:r,"aria-label":`Reorder ${e}, position ${t} of ${n}`,className:K(`flex h-11 w-6 shrink-0 cursor-grab items-center justify-center rounded text-muted-foreground opacity-0 outline-none transition-opacity md:h-[34px] md:w-4`,`touch-none focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50`,`group-hover/row:opacity-100 group-focus-within/row:opacity-100`,`[@media(hover:none)]:opacity-100`,r&&`cursor-default group-hover/row:opacity-0 group-focus-within/row:opacity-0 [@media(hover:none)]:opacity-0`),...i,children:(0,X.jsx)(is,{"aria-hidden":`true`,className:`size-3.5`})})}function ip({project:e,boot:t,active:n,collapsed:r,onToggle:i,onSelect:a,view:o,activeTo:s,currentRunId:c,now:l,inboxAvailable:u,automationsAvailable:d,inboxCount:f,skillsUpdateAvailable:p,showTokens:m,showCost:h,sortable:g,position:_,total:v}){let y=e.status===`missing`,b=g&&!y&&!e.unregistered,{attributes:x,listeners:S,setNodeRef:C,transform:w,transition:T,isDragging:E}=cr({id:e.id,disabled:!b}),D={transform:$n.Translate.toString(w),transition:T},O=(0,X.jsx)(rp,{name:e.name,position:_,total:v,disabled:!b,handleProps:{...x,...S}}),k=Re(e.id,!r&&!y,t),A=Ed(),j=Jt(e.id,t?`default`:e.id),M=Y.useCallback((e,t)=>j.mutate({id:e.id,pinned:t},{onError:e=>V(e.message,{tone:`danger`})}),[j.mutate]),[N]=wf(),P=k.data?De(k.data).waiting:0,F=k.data?yn(rt(Af(k.data,N),o),ep):[],ee=F.flatMap(t=>t.rows.flatMap(t=>yt(t.kind===`run`?t.run:t.members[0]).map(t=>({projectId:e.id,kind:t.kind,number:t.number}))));if(y)return(0,X.jsx)(`div`,{ref:C,style:D,"data-slot":`project-group`,"data-project":e.id,"data-status":`missing`,className:K(`mb-1`,E&&`relative z-10 opacity-40`),children:(0,X.jsxs)(`div`,{className:`flex items-center`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`w-6 shrink-0 md:w-4`}),(0,X.jsxs)(`div`,{"data-slot":`project-group-header`,title:`${e.root} is gone — remove it in Global settings → Projects`,className:`flex h-11 min-w-0 flex-1 items-center gap-[7px] rounded-lg px-2 text-[13px] font-semibold opacity-55 md:h-[34px]`,children:[(0,X.jsx)(`span`,{className:`w-3 shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.name}),(0,X.jsx)(`span`,{"data-slot":`project-missing`,className:`ml-auto shrink-0 rounded-full bg-danger/15 px-[7px] py-px text-[10px] font-medium text-danger`,children:`folder not found`})]})]})});let te=`project-group-${e.id}`;return(0,X.jsxs)(`div`,{ref:C,style:D,"data-slot":`project-group`,"data-project":e.id,"data-status":e.status,"data-collapsed":r?``:void 0,"data-dragging":E?``:void 0,"data-active":n?``:void 0,className:K(`mb-1`,E&&`relative z-10 opacity-40`),children:[(0,X.jsxs)(`div`,{className:`group/row flex items-center`,children:[O,(0,X.jsxs)(`div`,{"data-slot":`project-group-row`,className:K(`flex min-w-0 flex-1 items-center rounded-lg transition-colors hover:bg-muted`,n&&`bg-muted`),children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>i(e.id),"aria-expanded":!r,"aria-controls":te,"aria-label":`${r?`Expand`:`Collapse`} ${e.name}`,"data-slot":`project-group-disclosure`,className:K(`flex h-11 w-[27px] shrink-0 items-center justify-center rounded-lg md:h-[34px]`),children:(0,X.jsx)(si,{className:K(`size-3 shrink-0 text-muted-foreground transition-transform`,r&&`-rotate-90`),"aria-hidden":`true`})}),(0,X.jsxs)(H,{to:Qt(e.id,`/`),onClick:()=>{a(e.id),A?.()},"aria-current":n?`true`:void 0,"data-slot":`project-group-header`,className:K(`flex h-11 min-w-0 flex-1 items-center gap-[7px] rounded-lg pr-2 text-left text-[13px] font-semibold md:h-[34px]`,n&&`text-foreground`),children:[(0,X.jsx)(`span`,{className:`truncate`,children:e.name}),e.unregistered?(0,X.jsx)(`span`,{"data-slot":`project-unregistered`,title:`cezar is serving this folder — it is not in your saved projects. Add it in Global settings → Projects.`,className:`shrink-0 rounded-full bg-muted px-[7px] py-px text-[10px] font-medium text-soft-foreground`,children:`not saved`}):null,P?(0,X.jsx)(`span`,{"data-slot":`project-attention`,title:`${P} task${P===1?``:`s`} need${P===1?`s`:``} you`,className:`shrink-0 rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:P}):null,e.branch?(0,X.jsx)(`span`,{"data-slot":`project-branch`,className:`ml-auto max-w-[92px] truncate font-mono text-[10.5px] font-medium text-soft-foreground`,children:e.branch}):null]})]})]}),r?null:(0,X.jsxs)(`div`,{id:te,"data-slot":`project-group-body`,className:`mt-1 ml-[14px] border-l border-border pl-2`,children:[(0,X.jsx)(`nav`,{"aria-label":`${e.name} navigation`,children:Zl({forge:e.forge===`github`,inbox:u,automations:d,tracker:e.tracker}).map(t=>{let r=n&&t.to===s,i=t.icon;return(0,X.jsxs)(H,{to:Qt(e.id,t.to),onClick:A,"aria-current":r?`page`:void 0,className:K(`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-[13px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground md:h-[30px]`,r&&`bg-muted font-semibold text-foreground`),children:[(0,X.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&n&&f?(0,X.jsx)(`span`,{"data-slot":`nav-badge`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:f}):null,t.badge===`skills-update`&&n&&p?(0,X.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,X.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,X.jsx)(ni,{projectId:e.id,requests:ee,children:(0,X.jsx)(Bf,{buckets:F,currentRunId:n?c:null,now:l,scope:e.id,showTokens:m,showCost:h,onTogglePin:o===`archived`?void 0:M})}),(0,X.jsx)(H,{to:Qt(e.id,`/`),onClick:A,"data-slot":`project-group-more`,className:`flex h-9 items-center rounded-md px-3 text-[12px] text-muted-foreground transition-colors hover:text-foreground md:h-7`,children:`More…`})]})]})}var ap={claude:!0,codex:!0,junie:!0,opencode:!0,cursor:!0,pi:!0,copilot:!0},op=e=>Object.hasOwn(ap,e.name);function sp(e){let t=e.checks.filter(op);if(t.length&&!t.some(e=>e.available))return`no agent CLI found — install one to run tasks`;let n=t.find(t=>t.name===e.defaultRunner);return n&&!n.available?`default runner (${e.defaultRunner}) not found`:null}function cp(e){let t=`cezar v${e.version}`,n=sp(e);if(n)return`${t} · ${n}`;let r=e.checks.filter(e=>!e.available).map(e=>e.name);return r.length?`${t} · optional: ${r.join(`, `)} not installed`:t}function lp(e){return e.forge?.available?null:e.forge?`GitHub is unreachable — ${e.forge.reason??`unknown reason`}. The GitHub tab is hidden until it comes back.`:`No GitHub remote detected — the GitHub tab is hidden. Every plain-git feature still works.`}function up({health:e}){if(!e)return null;let t=sp(e);return(0,X.jsxs)(ea,{children:[(0,X.jsx)(Wi,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,title:cp(e),className:`flex items-center gap-1.5 rounded-full border border-border px-2 py-0.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,X.jsx)(Ka,{tone:t?`pending`:`success`}),`Tools`,(0,X.jsx)(si,{className:`size-[11px]`,"aria-hidden":`true`})]})}),(0,X.jsxs)(Xi,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[(0,X.jsx)(Ji,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,X.jsx)(dp,{check:e},e.name):(0,X.jsx)(fp,{check:e},e.name)),lp(e)?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($i,{}),(0,X.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-[11px] leading-snug text-muted-foreground`,children:lp(e)})]}):null,(0,X.jsx)($i,{}),(0,X.jsx)(Qi,{asChild:!0,children:(0,X.jsxs)(H,{to:`/settings/agents`,"data-slot":`tools-settings`,className:`gap-2 text-[12.5px] text-muted-foreground`,children:[(0,X.jsx)(Ss,{className:`size-3.5`,"aria-hidden":`true`}),`Tool settings`]})})]})]})}function dp({check:e}){return(0,X.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":`true`,className:`flex items-center gap-2 rounded-sm px-2 py-1.5`,children:[(0,X.jsx)(Ka,{tone:`success`}),(0,X.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,X.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11.5px] font-medium text-muted-foreground tabular-nums`,children:e.version??`not found`})]})}function fp({check:e}){return(0,X.jsx)(Qi,{asChild:!0,children:(0,X.jsxs)(H,{to:`/settings/agents`,"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Ka,{tone:`danger`}),(0,X.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,X.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11.5px] font-medium text-muted-foreground`,children:`not found`})]}),(0,X.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[e.hint?(0,X.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-[11px] leading-snug text-muted-foreground`,children:e.hint}):null,(0,X.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-[11.5px] font-semibold text-violet`,children:`Set up →`})]})]})})}function pp(e){return e?.trim()||null}function mp({projectName:e,pageLabel:t,brandName:n}){let r=pp(e),i=pp(t),a=pp(n??null)??`cezar`;return r&&i?`${r} — ${i} · ${a}`:r?`${r} · ${a}`:i?`${i} · ${a}`:a}function hp(e){let t=mp(e);(0,Y.useEffect)(()=>{document.title=t},[t]),(0,Y.useEffect)(()=>{let t=document.querySelector(`link[rel="icon"]`);t||(t=document.createElement(`link`),t.rel=`icon`,document.head.append(t)),t.href=e.brandLogoUrl??`/icon.svg`,t.type=e.brandLogoUrl?.includes(`.svg?`)?`image/svg+xml`:``},[e.brandLogoUrl])}var gp=`cez-last-location`;function _p(){try{let e=localStorage.getItem(gp);return e===null?null:JSON.parse(e)}catch{return null}}function vp(e){try{localStorage.setItem(gp,JSON.stringify(e))}catch{}}var yp=new Set([`projectId`,`pathname`,`search`,`hash`]);function bp(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(Object.keys(t).some(e=>!yp.has(e))||typeof t.projectId!=`string`||t.projectId.length<1||t.projectId.length>64||typeof t.pathname!=`string`||t.pathname.length<1||t.pathname.length>2048||!t.pathname.startsWith(`/p/`)||t.search!==void 0&&(typeof t.search!=`string`||t.search.length>4096||!t.search.startsWith(`?`))||t.hash!==void 0&&(typeof t.hash!=`string`||t.hash.length>2048||!t.hash.startsWith(`#`)))return null;try{if(Ht(t.pathname)!==t.projectId)return null}catch{return null}return{projectId:t.projectId,pathname:t.pathname,...t.search===void 0?{}:{search:t.search},...t.hash===void 0?{}:{hash:t.hash}}}function xp(e,t){let n=t.projects.find(t=>t.id===e);return n!==void 0&&n.status!==`missing`}function Sp(e,t){if(t===void 0)return null;let n;try{n=Ht(e.pathname)}catch{return null}return n===null||!xp(n,t)?null:bp({projectId:n,pathname:e.pathname,...e.search===``?{}:{search:e.search},...e.hash===``?{}:{hash:e.hash}})}function Cp(e,t,n){let r=bp(e);return r===null||!(t===void 0?n!==void 0&&r.projectId===n:xp(r.projectId,t))?null:`${r.pathname}${r.search??``}${r.hash??``}`}function wp(e,t){if(e===void 0)return t;let{projects:n}=e;return n.length===0||n.some(e=>e.id===t)?t:yu(n.filter(e=>e.status!==`missing`),[])[0]?.id??t}function Tp(e,t){let n=bp(e);return n!==null&&n.projectId===t.projectId&&n.pathname===t.pathname&&(n.search??``)===(t.search??``)&&(n.hash??``)===(t.hash??``)}function Ep(){return(0,X.jsxs)(`div`,{"data-route":`automations`,className:`flex min-h-full flex-col`,children:[(0,X.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,X.jsx)(`h1`,{className:`text-base font-semibold`,children:`Automations`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Scheduled and GitHub-triggered runs.`})]}),(0,X.jsx)(`p`,{"data-slot":`automations-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading automations…`})]})}function Dp(){return(0,X.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(oa,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading variants…`,subtitle:`Fetching every variant's status, spend and diff summary.`})})}function Op(){return(0,X.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(oa,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}var kp={workflow:null,skills:[],runner:null,model:null},Ap=`cez-followup-selection`,jp=Jr.map(e=>e.id);function Mp(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[],runner:jp.includes(t.runner)?t.runner:null,model:typeof t.model==`string`?t.model:null}}function Np(){try{let e=localStorage.getItem(Ap);return e?Mp(JSON.parse(e)):{...kp}}catch{return{...kp}}}function Pp(e){try{localStorage.setItem(Ap,JSON.stringify({...Np(),...e}))}catch{}}var Fp=`cez-followup-prompt:`;function Ip(e){try{return localStorage.getItem(Fp+e)??``}catch{return``}}function Lp(e,t){try{t===``?localStorage.removeItem(Fp+e):localStorage.setItem(Fp+e,t)}catch{}}function Rp(e){let t=a(),n=hn(),r=Ot(t.data),i=n.data?.defaultRunner,o=Hr(e.runner,r,i??r[0]??`claude`),s=T(o),c=n.data?.modelsLocked===!0,{accounts:l,repoAccount:u}=Ci(),d=l.some(t=>t.provider===o&&t.id===e.account)?e.account:null;return{runner:o,runnerExplicit:e.runner!==null,model:Gr(c?null:e.model,o,n.data?.defaultModels,s.data),runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:c,providerPending:t.isPending,providerError:t.isError,accounts:l,account:d,repoAccount:u}}function zp(e){let[t,n]=(0,Y.useState)(Bp);return(0,Y.useEffect)(()=>{e&&Pp({runner:t.runner,model:t.model})},[e,t.runner,t.model]),Up(t,n),[t,n]}function Bp(){let e=Np();return{runner:e.runner,model:e.model,account:null}}function Vp(){return zp(!0)}function Hp(){return zp(!1)}function Up(e,t){let n=a(),r=hn(),i=Ot(n.data),o=Hr(e.runner,i,r.data?.defaultRunner??i[0]??`claude`),s=n.isSuccess&&i.length>0,c=s&&e.runner!==null&&!i.includes(e.runner),l=s&&e.model!==null&&zr(e.model,o);(0,Y.useEffect)(()=>{!c&&!l||t({...e,runner:c?null:e.runner,model:l?null:e.model})},[c,l,e,t])}function Wp(e){return{runner:Lr(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0}}function Gp(e){return{...Wp(e),...e.account?{agentProfile:e.account}:{}}}function Kp({pick:e,onChange:t,disabled:n=!1,accounts:r=!1}){let i=Rp(e),{runner:a,model:o,runners:s,canRun:c,modelsLocked:l}=i,u=hn(),d=T(a),f=Br(a,d.data,[e.model,u.data?.defaultModels?.[a]]),p=n||!c,m=r?i.accounts:[];return(0,X.jsxs)(X.Fragment,{children:[s.length>1||s.some(e=>wi(m,e))?(0,X.jsx)(Si,{runners:s,value:a,accounts:m,account:r?i.account:null,repoAccount:r?i.repoAccount:void 0,disabled:p,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===a?e.model:null}:{runner:n,account:null,model:null})}):null,(0,X.jsx)(Fi,{slot:`model-pill`,ariaLabel:`Model`,label:f.find(e=>e.id===o).label,value:o,disabled:p,readOnly:l===!0,disabledHint:l?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,model:n}),options:f.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Xr(a,d.data,d.isError)})]})}function qp({templates:e,onInsert:t,triggerClassName:n,disabled:r,iconOnly:i=!1}){let[a,o]=(0,Y.useState)(!1),s=(0,Y.useRef)(null),c=un();return e.length===0?null:(0,X.jsxs)(li,{open:a,onOpenChange:o,children:[(0,X.jsx)(ci,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:r,className:K(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,i?`w-[26px] justify-center px-0`:`px-2.5`,n),children:[(0,X.jsx)(_s,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),i?null:(0,X.jsxs)(X.Fragment,{children:[`templates`,(0,X.jsx)(si,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})]})}),(0,X.jsx)(ti,{align:`start`,sideOffset:8,"data-slot":`prompt-template-menu`,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,onCloseAutoFocus:e=>e.preventDefault(),children:(0,X.jsxs)(ya,{filter:fi,children:[(0,X.jsx)(ba,{placeholder:`search templates…`,onInput:()=>s.current?.scrollTo(0,0)}),(0,X.jsxs)(da,{ref:s,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,X.jsx)(ga,{children:`Nothing matches.`}),(0,X.jsx)(ua,{heading:`Insert a template`,children:e.map(e=>(0,X.jsxs)(Ca,{value:`template ${e.label} ${e.id}`,keywords:[e.text,...e.skills??[]],"data-slot":`prompt-template-option`,"data-template":e.id,title:e.text,className:`flex-col items-start gap-0.5`,onSelect:()=>{t(e.text),o(!1)},children:[(0,X.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12.5px] font-medium text-foreground`,children:e.label}),e.skills&&e.skills.length>0?(0,X.jsxs)(`span`,{"data-slot":`prompt-template-assigned`,title:`Applied automatically with: ${e.skills.join(`, `)}`,className:`inline-flex shrink-0 items-center gap-0.5 text-[10px] font-medium text-violet`,children:[(0,X.jsx)(ei,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,X.jsx)(`span`,{className:`line-clamp-1 text-[11px] text-soft-foreground`,children:e.text})]},e.id))}),(0,X.jsx)(_a,{}),(0,X.jsx)(ua,{children:(0,X.jsx)(Ca,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-[12px] text-muted-foreground`,onSelect:()=>{o(!1),c(`/settings/prompt-templates`)},children:`Edit templates…`})})]})]})})]})}var Jp=d({status:`waiting`});function Yp(e){return e.filter(e=>!e.startedTaskId)}function Xp(e){return e.runnable??!!(e.suggestedSkill||e.suggestedPrompt)}function Zp(){let e=Se(),t=e.data?.capabilities.followups===!0,n=e.data!==void 0&&!t,r=Te(!n),i=S(),a=r.data===void 0?void 0:Yp(r.data);return(0,X.jsxs)(`div`,{"data-route":`inbox`,className:`flex min-h-full flex-col`,children:[(0,X.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,X.jsx)(`h1`,{className:`text-base font-semibold`,children:`Inbox`}),(0,X.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:n?`Disabled for this server; per-task Notes still run.`:`Follow-ups agents suggested when they finished a task.`})]}),(0,X.jsx)(`div`,{className:`flex flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:n?(0,X.jsx)(J,{icon:(0,X.jsx)(os,{}),tone:`neutral`,title:`The follow-up inbox is off`,subtitle:`Agents are not asked to leave follow-ups. Set CEZ_FOLLOWUPS=1 and restart the service to turn the inbox on.`,heading:`h2`}):a===void 0?r.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(ia,{}),tone:`danger`,title:`Could not load the inbox`,subtitle:r.error.message,heading:`h2`}):null:a.length===0?e.isPending?null:(0,X.jsx)(J,{icon:(0,X.jsx)(os,{}),tone:`neutral`,title:`Inbox empty`,subtitle:`Agents drop follow-up suggestions here when they finish a task.`,heading:`h2`}):(0,X.jsx)(`ul`,{"data-slot":`todo-list`,className:`mx-auto flex w-full max-w-3xl flex-col gap-2.5`,children:a.map(e=>(0,X.jsx)(Qp,{todo:e,sourceTaskExists:e.taskId===void 0?null:i.data?.some(t=>t.id===e.taskId)??!1},e.id))})})]})}function Qp({todo:e,sourceTaskExists:t}){let n=un(),r=I(),i=Le(),[a,o]=Hp(),c=Rp(a),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(``),p=(0,Y.useRef)(null),m=Se(),h=yi(xi(i.data?.promptTemplates),m.data?.capabilities),g=e=>{let t=p.current?.selectionStart??d.length,n=Ai(d,t,e);f(n.text),requestAnimationFrame(()=>{p.current?.focus(),p.current?.setSelectionRange(n.caret,n.caret)})},_=k({mutationFn:async()=>c.canRun?Ct(e.id,{...Wp(c),prompt:d.trim()||void 0}):null,onSuccess:e=>{if(e===null)return;let{run:t}=e;r.invalidateQueries({queryKey:B.todos}),r.invalidateQueries({queryKey:B.runs.all}),n(`/tasks/${t.id}`)},onError:e=>V(e.message,{tone:`danger`})}),v=k({mutationFn:()=>s(e.id),onSuccess:()=>{r.setQueryData(B.todos,t=>t?.filter(t=>t.id!==e.id)),r.invalidateQueries({queryKey:B.todos})},onError:e=>V(e.message,{tone:`danger`})}),y=_.isPending||v.isPending,b=Xp(e);return(0,X.jsxs)(`li`,{"data-slot":`todo-card`,"data-id":e.id,className:`flex flex-col gap-2.5 rounded-lg border border-border bg-card p-4 shadow-xs`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(Ka,{tone:Jp.tone,pulse:Jp.pulse,title:Jp.label,className:`mt-[5px]`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{"data-slot":`todo-summary`,className:`text-sm leading-snug font-medium text-foreground`,children:e.summary}),(0,X.jsxs)(`div`,{"data-slot":`todo-meta`,className:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-soft-foreground`,children:[e.ts?(0,X.jsxs)(`span`,{children:[qa(e.ts),` ago`]}):null,e.action?(0,X.jsx)(`span`,{children:e.action}):null,e.taskId===void 0?null:t?(0,X.jsx)(H,{to:`/tasks/${e.taskId}`,"data-slot":`todo-source`,className:`text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`source task`}):(0,X.jsx)(`span`,{"data-slot":`todo-source-gone`,children:`source task deleted`}),Ln(e.prUrl)?(0,X.jsx)(`a`,{href:e.prUrl,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`todo-pr`,className:`text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`PR`}):null,e.suggestedSkill?(0,X.jsxs)(`span`,{"data-slot":`todo-skill`,className:`font-mono`,children:[`skill: `,e.suggestedSkill]}):null]})]}),(0,X.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5 self-center`,children:b?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(q,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-run`,title:`Start a task from this follow-up`,disabled:y||!c.canRun,onClick:()=>_.mutate(),children:[(0,X.jsx)(zi,{"aria-hidden":`true`,className:`size-3`}),`Run`]}),(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`todo-dismiss`,title:`Check off (remove)`,disabled:y,onClick:()=>v.mutate(),children:`Dismiss`})]}):(0,X.jsxs)(q,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-acknowledge`,title:`Acknowledge and remove this note`,disabled:y,onClick:()=>v.mutate(),children:[(0,X.jsx)(Hi,{"aria-hidden":`true`,className:`size-3`}),`Acknowledge`]})})]}),b?(0,X.jsxs)(`div`,{"data-slot":`todo-engine`,className:`flex flex-wrap items-center gap-2 pl-5`,children:[(0,X.jsx)(Kp,{pick:a,onChange:o,disabled:y||!c.canRun}),!c.providerPending&&!c.canRun?(0,X.jsxs)(`span`,{"data-slot":`todo-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[c.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this follow-up.`,(0,X.jsx)(H,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}):null,b?l?(0,X.jsxs)(`div`,{"data-slot":`todo-instructions`,className:`flex flex-col gap-2 pl-5`,children:[(0,X.jsx)($a,{ref:p,"data-slot":`todo-instructions-input`,"aria-label":`Extra instructions for this follow-up`,value:d,onChange:e=>f(e.target.value),placeholder:`Add instructions for the agent… (appended to the suggestion above)`,maxLength:2e4,className:`min-h-16 text-[13px]`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(qp,{templates:h,onInsert:g}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-hide`,onClick:()=>u(!1),className:`text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`Hide`})]})]}):(0,X.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-toggle`,onClick:()=>u(!0),className:`self-start pl-5 text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:d.trim()?`Edit instructions (added)`:`+ Add instructions`}):null]})}function $p({className:e,size:t=`default`,...n}){return(0,X.jsx)(fl,{"data-slot":`switch`,"data-size":t,className:K(`peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...n,children:(0,X.jsx)(ml,{"data-slot":`switch-thumb`,className:K(`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0`)})})}function em({onLongPress:e,onClick:t,delayMs:n=450,moveTolerance:r=8}){let i=(0,Y.useRef)({onLongPress:e,onClick:t});i.current={onLongPress:e,onClick:t};let a=(0,Y.useRef)(null),o=(0,Y.useRef)({x:0,y:0}),s=(0,Y.useRef)(!1),c=(0,Y.useCallback)(()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},[]);return(0,Y.useEffect)(()=>c,[c]),{onPointerDown:(0,Y.useCallback)(e=>{s.current=!1,c(),e.button===0&&(o.current={x:e.clientX??0,y:e.clientY??0},a.current=setTimeout(()=>{a.current=null,s.current=!0,i.current.onLongPress()},n))},[c,n]),onPointerMove:(0,Y.useCallback)(e=>{if(a.current===null)return;let t=(e.clientX??0)-o.current.x,n=(e.clientY??0)-o.current.y;Math.hypot(t,n)>r&&c()},[c,r]),onPointerUp:c,onPointerCancel:c,onContextMenu:(0,Y.useCallback)(e=>{e.preventDefault(),c(),!s.current&&(s.current=!0,i.current.onLongPress())},[c]),onClick:(0,Y.useCallback)(e=>{if(s.current){s.current=!1,e.preventDefault();return}i.current.onClick?.()},[]),onKeyDown:(0,Y.useCallback)(e=>{(e.key===`ArrowDown`||e.key===`Enter`&&e.shiftKey)&&(e.preventDefault(),i.current.onLongPress())},[])}}function tm({available:e,value:t,onChange:n,onSettingsOpenChange:r,runners:i,parentRunner:a,parentModels:o}){let[s,c]=(0,Y.useState)(!1),l=ho(),u=(0,Y.useRef)({});t!==null&&(u.current=t);let d=(t??u.current).runner??a,f=T(d,e&&d!==a),p=d===a?o:Br(d,f.data),m=e=>{c(e),r?.(e)},h=t!==null,g=em({onLongPress:()=>m(!0),onClick:()=>n(h?null:u.current)});if(!e)return null;let _=(0,X.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":h,"aria-label":`Dispatch`,"data-slot":`dispatch-toggle`,"data-state":h?`on`:`off`,...g,className:K(l?`inline-flex h-full w-[26px] items-center justify-center transition-colors hover:bg-muted`:K(Oi,`w-[26px] justify-center px-0`),h&&(l?`hover:bg-primary/15`:`border-primary/60 bg-primary/10 text-primary hover:bg-primary/15 hover:text-primary`)),children:(0,X.jsx)(Cs,{"aria-hidden":`true`,className:K(`size-3 shrink-0`,h?`text-primary`:`text-soft-foreground`)})}),v=(0,X.jsx)(cm,{value:t,remembered:u.current,onChange:n,runners:i,models:p}),y=(0,X.jsxs)(Ma,{side:`top`,sideOffset:6,className:`max-w-[260px]`,children:[(0,X.jsx)(`div`,{className:`font-medium`,children:h?`Dispatch — on`:`Dispatch — off`}),(0,X.jsx)(`div`,{className:`text-contrast-foreground/80`,children:h?`Splits this task into subtasks it runs as separate tasks`:`Let this task split into subtasks`}),l?(0,X.jsx)(`div`,{className:`mt-0.5 text-contrast-foreground/60`,children:`▾ limits and subtask defaults`}):null]}),b=l?(0,X.jsxs)(`span`,{"data-slot":`dispatch-control`,"data-state":h?`on`:`off`,className:K(`inline-flex h-[26px] items-stretch overflow-hidden rounded-full border border-border bg-card text-muted-foreground transition-colors`,h&&`border-primary/60 bg-primary/10 text-primary`),children:[(0,X.jsx)(Pa,{delayDuration:300,children:(0,X.jsxs)(Ia,{children:[(0,X.jsx)(Aa,{asChild:!0,children:_}),y]})}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Dispatch settings`,"aria-haspopup":`dialog`,"aria-expanded":s,"data-slot":`dispatch-settings-trigger`,onClick:()=>m(!s),className:K(`inline-flex w-[18px] items-center justify-center border-l border-border transition-colors hover:bg-muted`,h&&`border-primary/40 hover:bg-primary/15`),children:(0,X.jsx)(si,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})})]}):(0,X.jsx)(Pa,{delayDuration:300,children:(0,X.jsxs)(Ia,{children:[(0,X.jsx)(Aa,{asChild:!0,children:_}),y]})});return l?(0,X.jsxs)(li,{open:s,onOpenChange:m,children:[(0,X.jsx)(ai,{asChild:!0,children:b}),(0,X.jsx)(ti,{align:`start`,sideOffset:8,"data-slot":`dispatch-settings`,className:`w-[340px] max-w-[calc(100vw-2rem)] p-3.5`,children:v})]}):(0,X.jsxs)(X.Fragment,{children:[b,(0,X.jsx)(Tr,{open:s,onOpenChange:m,children:(0,X.jsxs)(Cr,{side:`bottom`,"data-slot":`dispatch-settings`,className:`rounded-t-xl p-4 pt-16 pb-[max(1rem,env(safe-area-inset-bottom))]`,children:[(0,X.jsx)(Sr,{className:`sr-only`,children:`Dispatch`}),(0,X.jsx)(br,{className:`sr-only`,children:`Split this task into subtasks run as separate tasks`}),v]})})]})}function nm({label:e,htmlFor:t,children:n}){return(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`label`,{htmlFor:t,className:`shrink-0 text-xs text-foreground`,children:e}),n]})}var rm=`h-7 max-w-[180px] rounded-md border border-input bg-card px-2 text-xs shadow-xs outline-none transition-[color,box-shadow] hover:bg-muted focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,im=[2,3,4,5,8,10,15,20,30,50],am=.5,om=1e4;function sm(e){let t={};return e.maxSubtasks!==void 0&&(t.maxSubtasks=e.maxSubtasks),e.inFlight!==void 0&&(t.inFlight=e.inFlight),e.runner!==void 0&&(t.runner=e.runner),e.model!==void 0&&(t.model=e.model),e.budgetUsd!==void 0&&(t.budgetUsd=e.budgetUsd),t}function cm({value:e,remembered:t,onChange:n,runners:r,models:i}){let a=(0,Y.useId)(),o=e!==null,s=e??t,c=e=>n(sm({...s,...e})),l=i.filter(e=>e.id!==``),u=Jr.filter(e=>r.includes(e.id)),d=s.maxSubtasks!==void 0&&!im.some(e=>e===s.maxSubtasks)?[...im,s.maxSubtasks].sort((e,t)=>e-t):[...im];return(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsxs)(`header`,{className:`flex items-start gap-2.5`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary`,children:(0,X.jsx)(Cs,{className:`size-3.5`})}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`div`,{className:`text-[13px] font-semibold leading-tight text-foreground`,children:`Dispatch`}),(0,X.jsx)(`p`,{className:`mt-0.5 text-xs leading-snug text-muted-foreground`,children:`Split this task into subtasks run as separate tasks`})]}),(0,X.jsx)($p,{"aria-label":`Dispatch`,"data-slot":`dispatch-settings-switch`,checked:o,onCheckedChange:e=>n(e?t:null)})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border pt-3`,children:[(0,X.jsx)(nm,{label:`Max subtasks`,htmlFor:`${a}-max`,children:(0,X.jsxs)(`select`,{id:`${a}-max`,"data-slot":`dispatch-max-subtasks`,className:rm,value:s.maxSubtasks??``,onChange:e=>c({maxSubtasks:e.target.value===``?void 0:Number(e.target.value)}),children:[(0,X.jsx)(`option`,{value:``,children:`unlimited`}),d.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))]})}),(0,X.jsx)(nm,{label:`In flight at once`,htmlFor:`${a}-flight`,children:(0,X.jsx)(`select`,{id:`${a}-flight`,"data-slot":`dispatch-in-flight`,className:rm,value:s.inFlight??4,onChange:e=>{let t=Number(e.target.value);c({inFlight:t===4?void 0:t})},children:Array.from({length:4},(e,t)=>t+1).map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})}),(0,X.jsx)(nm,{label:`Subtask runner`,htmlFor:`${a}-runner`,children:(0,X.jsxs)(`select`,{id:`${a}-runner`,"data-slot":`dispatch-runner`,className:rm,value:s.runner??``,onChange:e=>c({runner:e.target.value===``?void 0:e.target.value,model:void 0}),children:[(0,X.jsx)(`option`,{value:``,children:`same as parent`}),u.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}),(0,X.jsx)(nm,{label:`Subtask model`,htmlFor:`${a}-model`,children:(0,X.jsxs)(`select`,{id:`${a}-model`,"data-slot":`dispatch-model`,className:rm,value:s.model??``,onChange:e=>c({model:e.target.value===``?void 0:e.target.value}),children:[(0,X.jsx)(`option`,{value:``,children:`same as parent`}),l.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.label},e.id)),s.model!==void 0&&!l.some(e=>e.id===s.model)?(0,X.jsx)(`option`,{value:s.model,children:s.model}):null]})}),(0,X.jsx)(nm,{label:`Budget per subtask`,htmlFor:`${a}-budget`,children:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(Gl,{id:`${a}-budget`,"data-slot":`dispatch-budget`,type:`number`,inputMode:`decimal`,placeholder:`none`,step:.5,min:am,max:om,className:`h-7 w-24 px-2 text-xs md:text-xs`,value:s.budgetUsd??``,onChange:e=>{let t=e.target.value,n=Number(t);c({budgetUsd:t===``||!Number.isFinite(n)||n<=0?void 0:Math.min(om,Math.max(am,n))})}}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`USD`})]})})]}),(0,X.jsxs)(`p`,{className:`text-xs leading-snug text-muted-foreground`,children:[`The engine keeps its own brakes: `,4,` in flight and budgets carved out of this task's. These only tell the agent what you want.`]})]})}var lm=38,um=280,dm=900,fm=600,pm=5500,mm=1400,Q=e=>({text:e,tone:`key`}),hm=e=>({text:e,tone:`str`}),gm=e=>({text:e,tone:`fn`}),_m=e=>({text:e,tone:`com`}),vm=e=>({text:e,tone:`num`}),$=e=>({text:e}),ym=[[[_m(`// task accepted — isolating a worktree`)],[Q(`const`),$(` tree = `),Q(`await`),$(` git.`),gm(`worktree`),$(`(task.branch)`)],[Q(`const`),$(` agent = `),gm(`spawn`),$(`(runner, { tree, skills })`)],[Q(`for await`),$(` (`),Q(`const`),$(` event `),Q(`of`),$(` agent.`),gm(`stream`),$(`()) {`)],[$(` cockpit.`),gm(`render`),$(`(event)`)],[$(`}`)]],[[$(`$ cezar run `),hm(`--worktree --autonomous`)],[hm(`✓`),$(` worktree ready · base `),hm(`main`)],[hm(`✓`),$(` agent started`)],[_m(`… editing src/routes/new-task.tsx`)],[hm(`✓`),$(` tests green · `),vm(`+42 −7`)],[hm(`✓`),$(` pull request opened`)]],[[_m(`# flaky: replay before touching code`)],[Q(`def`),$(` `),gm(`stabilize`),$(`(test):`)],[$(` `),Q(`for`),$(` attempt `),Q(`in`),$(` `),gm(`range`),$(`(`),vm(`3`),$(`):`)],[$(` `),Q(`if`),$(` `),gm(`run`),$(`(test).ok:`)],[$(` `),Q(`return`),$(` `),hm(`'green'`)],[$(` `),Q(`return`),$(` `),gm(`quarantine`),$(`(test)`)]],[[_m(`// apply the reviewed plan, step by step`)],[Q(`let`),$(` diff = worktree.`),gm(`diff`),$(`()?;`)],[Q(`match`),$(` `),gm(`review`),$(`(diff) {`)],[$(` Ok(pr) => gh::`),gm(`open`),$(`(pr),`)],[$(` Err(e) => `),gm(`retry`),$(`(e, backoff),`)],[$(`}`)]],[[_m(`// merge when every check is green`)],[Q(`func`),$(` `),gm(`merge`),$(`(pr *PullRequest) `),Q(`error`),$(` {`)],[$(` `),Q(`if`),$(` err := ci.`),gm(`Wait`),$(`(pr); err != `),Q(`nil`),$(` {`)],[$(` `),Q(`return`),$(` err`)],[$(` }`)],[$(` `),Q(`return`),$(` gh.`),gm(`Merge`),$(`(pr)`)],[$(`}`)]],[[_m(`-- which branches ship the most?`)],[Q(`select`),$(` branch, `),gm(`count`),$(`(*) `),Q(`as`),$(` runs`)],[Q(`from`),$(` tasks`)],[Q(`where`),$(` status = `),hm(`'green'`)],[Q(`group by`),$(` branch`)],[Q(`order by`),$(` runs `),Q(`desc`),$(`;`)]],[[_m(`/* the composer glow, one token deep */`)],[$(`.composer`),Q(`:focus-within`),$(` {`)],[$(` border-color: `),gm(`var`),$(`(--primary);`)],[$(` box-shadow: `),vm(`0 0 0 3px`),$(` `),gm(`var`),$(`(--ring);`)],[$(` transition: box-shadow `),vm(`120ms`),$(` ease;`)],[$(`}`)]]],bm=[[`left-[3%] top-[12%]`,`left-[5%] top-[36%]`,`left-[8%] top-[58%]`],[`right-[3%] top-[14%]`,`right-[6%] top-[40%]`,`right-[4%] top-[62%]`],[`left-[28%] top-[66%]`,`left-[45%] top-[72%]`,`right-[26%] top-[70%]`]],xm={key:`var(--syn-key)`,str:`var(--syn-str)`,fn:`var(--syn-fn)`,com:`var(--syn-com)`,num:`var(--syn-num)`},Sm=e=>e.reduce((e,t)=>e+t.text.length,0),Cm=e=>e.reduce((e,t)=>e+Sm(t)*lm+um,0);function wm(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1)),r=t[e];t[e]=t[n],t[n]=r}return t}function Tm(){let e=wm(ym).slice(0,bm.length),t=wm(bm.map(e=>e[Math.floor(Math.random()*e.length)]??``)),n=fm;return{blocks:e.map((e,r)=>{let i=n;return n+=Cm(e)+dm,{lines:e,slot:t[r]??``,startMs:i}}),cycleMs:n-dm+pm+mm}}function Em({block:e,cycleMs:t}){let n=e.startMs;return(0,X.jsx)(`div`,{className:K(`ghost-code-block absolute font-mono text-[11.5px] leading-[1.9] text-soft-foreground`,e.slot),style:{"--cycle":`${t}ms`},children:e.lines.map((e,t)=>{let r=Sm(e),i=n;return n+=r*lm+um,(0,X.jsx)(`div`,{className:`ghost-code-line`,style:{"--n":r,"--t":`${r*lm}ms`,"--d":`${i}ms`},children:e.map((e,t)=>(0,X.jsx)(`span`,{style:e.tone?{color:xm[e.tone]}:void 0,children:e.text},t))},t)})})}var Dm=`(prefers-reduced-motion: reduce)`;function Om(){let[e,t]=(0,Y.useState)(()=>typeof window.matchMedia==`function`&&!window.matchMedia(Dm).matches);return(0,Y.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(Dm),n=e=>t(!e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function km(){let[e,t]=(0,Y.useState)(0),n=Om(),r=(0,Y.useMemo)(()=>Tm(),[e]);return(0,Y.useEffect)(()=>{if(!n)return;let e=window.setTimeout(()=>t(e=>e+1),r.cycleMs);return()=>window.clearTimeout(e)},[e,n,r.cycleMs]),(0,X.jsx)(`div`,{"data-slot":`ghost-code-backdrop`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 -z-10 overflow-hidden max-xl:hidden [mask-image:linear-gradient(to_bottom,black_30%,transparent_96%)]`,children:(0,X.jsx)(`div`,{className:`contents`,children:r.blocks.map((e,t)=>(0,X.jsx)(Em,{block:e,cycleMs:r.cycleMs},t))},e)})}function Am({label:e,url:t,hint:n,showIcon:r=!0,copySlot:i=`bm-copy`}){let a=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{a.current?.setAttribute(`href`,t)},[t]);let o=async()=>{try{await navigator.clipboard.writeText(t),V(`Bookmarklet URL copied.`)}catch{V(`Copy failed — drag the button instead.`,{tone:`danger`})}};return(0,X.jsxs)(`div`,{"data-slot":`bm-row`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,X.jsxs)(`a`,{ref:a,draggable:!0,"data-slot":`bm-link`,title:`Drag me to your bookmarks bar`,onClick:e=>{e.preventDefault(),V(`Drag me to your bookmarks bar`)},className:`inline-flex shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 py-1 font-mono text-xs font-medium text-foreground shadow-xs transition-colors hover:bg-muted`,children:[r?(0,X.jsx)(Nr,{"aria-hidden":`true`,className:`size-3 text-primary`}):null,e]}),(0,X.jsx)(`button`,{type:`button`,"data-slot":i,title:`Copy the bookmarklet URL`,onClick:()=>void o(),className:`shrink-0 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:`Copy`}),n?(0,X.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-soft-foreground`,children:n}):null]})}var jm=`http://localhost:4321`;function Mm(e,t,n,r=jm,i=null){let a=e=>encodeURIComponent(e).replaceAll(`'`,`%27`),o=`(()=>{const m=location.href.match(/^https:\\/\\/github\\.com\\/([^\\/]+)\\/([^\\/]+)\\/(pull|issues)\\/\\d+/);if(!m){alert('Open a GitHub PR or issue first');return;}const q='${`${e?`skill=${a(e)}&`:``}auto=${t?`1`:`0`}&key=${a(n)}&ref=`}'+encodeURIComponent(location.href);open('${r.replaceAll(`'`,`%27`)}${i===null||i===``?`/new`:`/p/${a(i)}/new`}?'+q,'_blank');})();`;return`javascript:${encodeURIComponent(o)}`}var Nm={ai:`From this project’s .ai/skills; always enabled while present.`,cezar:`From this project’s .ai/cezar/skills; always enabled while present.`,agents:`From .agents/skills or an agent-specific folder; always enabled while present.`,global:`User-wide from ~/.agents/skills or ~/.claude/skills, shared across projects.`,team:`Shared from a team repository configured for this project; importable skills can be enabled or disabled here.`,builtin:`Built into Cezar rather than installed from a skill repository.`};function Pm({source:e,className:t,teamRepo:n}){let r=gi({source:e}),i=e===`team`&&n?`Shared from ${n}, a team skills repository configured for this project.`:Nm[e];return(0,X.jsx)(Pa,{delayDuration:300,children:(0,X.jsxs)(Ia,{children:[(0,X.jsx)(Aa,{asChild:!0,children:(0,X.jsx)(`span`,{"data-slot":`skill-source`,"data-source":e,"aria-label":i,className:K(`shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px]`,r?`font-semibold text-foreground`:`text-soft-foreground`,t),children:e})}),(0,X.jsx)(Ma,{side:`top`,sideOffset:6,className:`max-w-[260px]`,children:i})]})})}function Fm({skill:e,usedBy:t,heading:n=`h2`,enabled:r=!0,activation:i}){return(0,X.jsxs)(`div`,{"data-slot":`skill-detail`,className:`mx-auto w-full min-w-0 max-w-[var(--measure)]`,children:[(0,X.jsxs)(`section`,{"data-slot":`skill-properties`,className:`rounded-lg border border-border bg-muted/20 p-4`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2.5`,children:[(0,X.jsx)(n,{className:`min-w-0 font-mono text-lg font-semibold break-all`,children:e.name}),(0,X.jsx)(Pm,{source:e.source,teamRepo:e.team?.repo})]}),(0,X.jsxs)(`p`,{"data-slot":`skill-path`,className:`mt-1 font-mono text-[10.5px] break-all text-soft-foreground`,children:[e.path,e.team?` · from ${e.team.repo}`:``]}),e.description?(0,X.jsx)(`p`,{"data-slot":`skill-description`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:e.description}):null]}),i?(0,X.jsx)($p,{"data-slot":`skill-activation-detail`,"aria-label":i.ariaLabel,checked:i.checked,disabled:i.disabled,onCheckedChange:i.onCheckedChange,size:`sm`,className:`mt-1.5 shrink-0`}):null]}),r?(0,X.jsx)(Im,{skill:e}):null,t===void 0?null:(0,X.jsxs)(`section`,{"data-slot":`skill-used-by`,className:`mt-4 border-t border-border pt-4`,children:[(0,X.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Used by`}),t.length>0?(0,X.jsx)(`ul`,{className:`mt-1.5 flex flex-col gap-1`,children:t.map(e=>(0,X.jsxs)(`li`,{className:`flex items-center gap-1.5 font-mono text-xs text-muted-foreground`,children:[(0,X.jsx)(Ro,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),e]},e))}):(0,X.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Not referenced by any workflow yet — quick-task picks it up when the task mentions it.`})]})]}),(0,X.jsxs)(`section`,{"data-slot":`skill-content`,className:`mt-6 min-w-0 border-t border-border pt-5`,children:[(0,X.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Content`}),(0,X.jsx)(`div`,{"data-slot":`skill-body`,className:`mt-3 text-sm`,children:(0,X.jsx)(io,{children:e.body})})]})]})}function Im({skill:e}){let t=je(),n=Se(),r=ye(),[i,a]=(0,Y.useState)(!1),o=t.data?.key??``,s=window.location.origin,c=Pt()??n.data?.bootProject??null,l=r.data?.projects.find(e=>e.id===c)?.name??mb(n.data)?.name??null,u=Mm(e.name,i,o,s,c);return(0,X.jsxs)(`section`,{"data-slot":`skill-run-from-github`,className:`mt-5 border-t border-border pt-4`,children:[(0,X.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Run from GitHub`}),(0,X.jsx)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:`Drag the button to your bookmarks bar, then click it on a GitHub PR or issue.`}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-xs font-medium`,children:[(0,X.jsx)($p,{"data-slot":`bookmarklet-auto`,size:`sm`,"aria-label":`Start automatically`,checked:i,onCheckedChange:a}),(0,X.jsx)(`span`,{children:`Start automatically`})]}),(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsx)(Am,{label:l?`/${e.name} (${l})`:`/${e.name}`,url:u,showIcon:!1,copySlot:`skill-bookmarklet-copy`})}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`To update an existing bookmarklet after changing this option, drag the button to your bookmarks bar again.`}),(0,X.jsx)(H,{to:`/settings/bookmarklets`,"data-slot":`skill-bookmarklets-settings`,className:`mt-2 inline-block text-xs font-medium text-violet hover:underline`,children:`Manage saved bookmarklets`})]})}function Lm({skill:e,onClose:t}){return(0,X.jsx)(fa,{open:e!==null,onOpenChange:e=>e?void 0:t(),children:(0,X.jsx)(pa,{"data-slot":`skill-preview`,className:`block max-h-[80dvh] overflow-y-auto sm:max-w-2xl`,children:e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ma,{className:`sr-only`,children:e.name}),(0,X.jsx)(xa,{className:`sr-only`,children:`Skill preview with GitHub launcher`}),(0,X.jsx)(Fm,{skill:e,heading:`h3`}),(0,X.jsx)(`p`,{className:`mt-5`,children:(0,X.jsx)(H,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-preview-manage`,onClick:t,className:`text-xs font-semibold text-violet hover:underline`,children:`Open in the Skills catalog`})})]}):null})})}function Rm({source:e,ready:t,skills:n,skillUsage:r,workflows:i,onPick:a}){let[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(null),f=(0,Y.useRef)(null),{mostUsed:p,project:m,global:h}=mi(hi(n,c,r),r),g=i.find(e=>e.name===$r),_=Ei(i,c).filter(e=>e.name!==$r),v=pi(`no skill`,`none plain ${$r} ${g?.description??``}`,c)>0,y=!v&&p.length===0&&m.length===0&&h.length===0&&_.length===0,b=e=>{a(e),s(!1)},x=t=>b(e?.source===t.source&&e.ref===t.ref?null:t),S=(t,n)=>{let r=e?.source===`skill`&&e.ref===t.name;return(0,X.jsxs)(Ca,{value:`skill ${t.name} ${t.path}`,keywords:di(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.name,onSelect:()=>x({source:`skill`,ref:t.name}),children:[(0,X.jsx)(`span`,{className:K(`shrink-0 font-mono text-xs`,n&&`font-semibold`),children:t.name}),t.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,(0,X.jsx)(`button`,{type:`button`,"data-slot":`source-skill-view`,"aria-label":`View skill ${t.name}`,title:`View skill`,onClick:e=>{e.preventDefault(),e.stopPropagation(),d(t)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,X.jsx)(ra,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,X.jsx)(Hi,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},t.path)},C=e===null?bs:e.source===`skill`?ei:As,w=(0,X.jsxs)(`button`,{type:`button`,"data-slot":`source-pill`,"data-source-kind":e?.source??`none`,"aria-label":`Choose a skill or workflow`,title:e===null?`No skill — the task runs as one plain agent step. Pick a skill or workflow to change that.`:`Runs the ${e.source} "${e.ref}" — pick it again, or press ✕, to run without it`,disabled:!t,onKeyDown:t=>{e===null||t.metaKey||t.ctrlKey||t.altKey||t.key!==`Backspace`&&t.key!==`Delete`||(t.preventDefault(),a(null))},className:K(Oi,`font-mono text-[11.5px]`,e===null?`border-dashed text-soft-foreground`:`rounded-r-none border-r-0 border-foreground/60 pr-1.5 font-semibold text-foreground`),children:[(0,X.jsx)(C,{"aria-hidden":`true`,className:K(`size-3 shrink-0`,e===null?`text-soft-foreground`:`text-violet`)}),(0,X.jsx)(`span`,{className:`max-w-44 truncate`,children:t?e?.ref??`Skill`:`…`}),ji]});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Lm,{skill:u,onClose:()=>d(null)}),(0,X.jsxs)(li,{open:o,onOpenChange:e=>{s(e),e||l(``)},children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,X.jsx)(ci,{asChild:!0,children:w}),e!==null&&t?(0,X.jsx)(`button`,{type:`button`,"data-slot":`source-pill-clear`,"aria-label":`Clear the ${e.source} ${e.ref}`,title:`Run without it`,onClick:()=>a(null),className:K(Oi,`rounded-l-none border-foreground/60 pl-1.5 pr-2 text-soft-foreground hover:text-foreground`),children:(0,X.jsx)(Ea,{"aria-hidden":`true`,className:`size-3`})}):null]}),(0,X.jsx)(ti,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(ya,{shouldFilter:!1,children:[(0,X.jsx)(ba,{placeholder:`search skills & workflows…`,value:c,onValueChange:l,onInput:()=>f.current?.scrollTo(0,0)}),(0,X.jsxs)(da,{ref:f,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[y?(0,X.jsx)(ga,{children:`Nothing matches.`}):null,v?(0,X.jsx)(ua,{children:(0,X.jsxs)(Ca,{value:`none no-skill`,keywords:[`none`,`plain`,...di($r)],"data-slot":`source-option`,"data-source-kind":`none`,onSelect:()=>b(null),children:[(0,X.jsx)(ri,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:`No skill`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:g?.description??`One agent run on your task — no ceremony.`}),e===null?(0,X.jsx)(Hi,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]})}):null,p.length>0?(0,X.jsx)(ua,{heading:`Most used`,children:p.map(e=>S(e,gi(e)))}):null,m.length>0?(0,X.jsx)(ua,{heading:`Project skills`,children:m.map(e=>S(e,!0))}):null,_.length>0?(0,X.jsx)(ua,{heading:`Workflows`,children:_.map(t=>{let n=e?.source===`workflow`&&e.ref===t.name;return(0,X.jsxs)(Ca,{value:`workflow ${t.name}`,keywords:di(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>x({source:`workflow`,ref:t.name}),children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:t.name}),t.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,n?(0,X.jsx)(Hi,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},t.name)})}):null,h.length>0?(0,X.jsx)(ua,{heading:`Global`,children:h.map(e=>S(e,!1))}):null]})]})})]})]})}function zm(e,t,n){let r=e.skill===``?{source:`workflow`,ref:`quick-task`}:{source:`skill`,ref:e.skill};return Wr({task:e.ref,source:r,model:``,runner:t,defaultRunner:n,variants:1,images:[],todoId:e.todo})}function Bm(e,t){return e.kind===`failed`?{message:`Auto-start failed: ${e.message} — review and press Start`,tone:`danger`}:e.kind===`blocked`?{message:`Auto-start blocked (bad key) — review and press Start`,tone:`danger`}:t===``?{message:`Prefilled from link — review and press Start`,tone:`default`}:{message:`Unknown skill "${t}" — prefilled for quick-task; review and press Start`,tone:`danger`}}function Vm(e,t){return`Use the "${e}" skill on: ${t}`}function Hm(e){let t=e.dispatch===!0,n=e.configuredAutonomous===`source-dependent`?e.source===`skill`:e.configuredAutonomous,r=e.interactive!==!0&&void 0;return{autonomous:e.explicitAutonomous??(t?!0:void 0)??r??n,worktree:e.hasGit?e.variants>1||t?!0:e.explicitWorktree??r??e.configuredWorktree:!1}}function Um(e){return e.dispatch===!0?e.autonomous===!0?`Runs on its own and fans work out to subtasks — it will not pause for you.`:`Fans work out to subtasks in isolated worktrees.`:e.worktree?`Runs in an isolated worktree — review everything before it lands.`:e.hasGit?`Runs in the repo working tree — your checkout is modified directly.`:`Runs in place — no git repository detected, so there is no worktree to isolate in.`}var Wm={text:``,source:null,runner:null,agentProfile:null,model:null,variants:1,worktree:null,autonomous:null,generateFollowups:null,dispatch:null},Gm=`cez-new-task-draft`;function Km(e){return e===null?Gm:`${Gm}:${e}`}function qm(e){let t=e&&typeof e==`object`?e:{};return{text:typeof t.text==`string`?t.text:``,source:Ym(t.source)?t.source:null,runner:typeof t.runner==`string`?t.runner:null,agentProfile:typeof t.agentProfile==`string`?t.agentProfile:null,model:typeof t.model==`string`?t.model:null,variants:t.variants===2||t.variants===3?t.variants:1,worktree:typeof t.worktree==`boolean`?t.worktree:null,autonomous:typeof t.autonomous==`boolean`?t.autonomous:null,generateFollowups:typeof t.generateFollowups==`boolean`?t.generateFollowups:null,dispatch:Jm(t.dispatch)}}function Jm(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n={},r=(e,t)=>typeof e==`number`&&Number.isInteger(e)&&e>=1&&e<=t?e:void 0,i=r(t.maxSubtasks,50);i!==void 0&&(n.maxSubtasks=i);let a=r(t.inFlight,4);return a!==void 0&&(n.inFlight=a),typeof t.runner==`string`&&Jr.some(e=>e.id===t.runner)&&(n.runner=t.runner),typeof t.model==`string`&&t.model!==``&&t.model.length<=120&&(n.model=t.model),typeof t.budgetUsd==`number`&&Number.isFinite(t.budgetUsd)&&t.budgetUsd>0&&t.budgetUsd<=1e4&&(n.budgetUsd=t.budgetUsd),n}function Ym(e){return!!e&&typeof e==`object`&&(e.source===`skill`||e.source===`workflow`)&&typeof e.ref==`string`}var Xm=new Map;function Zm(e=null){let t=Km(e),n=Xm.get(t);if(n)return{...n};let r;try{let e=localStorage.getItem(t);r=e?qm(JSON.parse(e)):{...Wm}}catch{r={...Wm}}return Xm.set(t,r),{...r}}function Qm(e,t=null){let n=Km(t);Xm.set(n,{...e});try{localStorage.setItem(n,JSON.stringify(e))}catch{}}function $m(e=null){Qm({...Zm(e),text:``,source:null},e)}var eh=new Map;function th(e=null){return[...eh.get(Km(e))??[]]}function nh(e,t=null){let n=Km(t);e.length===0?eh.delete(n):eh.set(n,[...e])}function rh(e,t){if(e===t)return{moved:!1,reason:`same-project`};let n=Zm(e),r=th(e);if(n.text===``&&r.length===0)return{moved:!1,reason:`nothing-to-move`};let i=Zm(t);return i.text!==``||th(t).length>0?{moved:!1,reason:`destination-busy`}:(Qm({...i,text:n.text},t),Qm({...n,text:``},e),nh(r,t),nh([],e),{moved:!0})}function ih(e){let t=typeof e==`string`?new URLSearchParams(e):e;return{skill:(t.get(`skill`)??``).trim(),ref:(t.get(`ref`)??t.get(`task`)??``).trim(),auto:t.get(`auto`)===`1`,key:t.get(`key`)??``,todo:(t.get(`todo`)??``).trim()}}function ah(){let[e]=Ae(),t=un(),n=I(),{projectId:r}=N(),i=ce().projectId,o=ye(),[s]=(0,Y.useState)(()=>ih(e)),c=Se(),l=ie(),u=D(),d=ut(),f=Le(),p=hn(),m=Ue(),[h,g]=(0,Y.useState)(()=>({...Zm(i),...s.ref===``?{}:{text:s.ref},...s.skill===``?{}:{source:{source:`skill`,ref:s.skill}}}));(0,Y.useEffect)(()=>{Qm(h,i)},[h,i]);let _=e=>g(t=>({...t,...e})),[v,y]=(0,Y.useState)(()=>th(i));(0,Y.useEffect)(()=>{nh(v,i)},[v,i]);let b=f.data?.recentSources,x=u.data,S=f.data?.skillUsage,C=(0,Y.useMemo)(()=>_i(x??[],S),[x,S]),w=l.data?.workflows??[],E=o.data?.projects??[],O=e=>o.data?.bootProject===e?null:e,k=u.data!==void 0&&l.data!==void 0&&!f.isPending,A=Vr(h.source,C,w),j=A?.source===`skill`?C.find(e=>e.name===A.ref):void 0,M=(0,Y.useRef)(null),P=(0,Y.useMemo)(()=>yi(xi(f.data?.promptTemplates),c.data?.capabilities),[f.data?.promptTemplates,c.data?.capabilities]),F=Ti(P,A?.source===`skill`?[A.ref]:[]),ee=(0,Y.useRef)(h.text);ee.current=h.text;let te=(0,Y.useRef)(``);(0,Y.useEffect)(()=>{if(!k)return;let e=Di(ee.current,te.current,F);te.current=e.applied,e.text!==ee.current&&_({text:e.text})},[F,k]);let ne=a(),re=Ot(ne.data),ae=p.data?.defaultRunner,oe=ae??`claude`,se=re.length>0?Hr(h.runner,re,oe):null,L=se??oe,le=ne.isSuccess&&re.length>0,ue=T(L),de=p.data?.modelsLocked===!0,fe=se===null?[]:Br(se,ue.data,[h.model,p.data?.defaultModels?.[se]]),pe=se===null?``:Gr(de?null:h.model,se,p.data?.defaultModels,ue.data),{accounts:me,repoAccount:he}=Ci(),ge=me.some(e=>e.provider===L&&e.id===h.agentProfile)?h.agentProfile:null,_e=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{let e=le&&!_e.current;_e.current=le,e&&document.activeElement===document.body&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[le]);let ve=d.data===void 0||d.data.info!==null,R=ve?h.variants:1,be=ve,xe=c.data?.capabilities.dispatch===!0&&ve,Ce=xe?h.dispatch:null,we=Ce!==null,[Te,Ee]=(0,Y.useState)(!1),[De,Oe]=(0,Y.useState)(!1),z=(0,Y.useRef)(null),ke=e=>{_({dispatch:e}),z.current!==null&&clearTimeout(z.current),z.current=null,Ee(e!==null),e!==null&&(z.current=setTimeout(()=>Ee(!1),6e3))};(0,Y.useEffect)(()=>()=>{z.current!==null&&clearTimeout(z.current)},[]);let je=R>1||we,Me=Hm({hasGit:ve,variants:R,explicitAutonomous:h.autonomous,explicitWorktree:h.worktree,interactive:j?.interactive,configuredAutonomous:m.data?.composerDefaults?.autonomous??m.data?.composerDefaults?.inheritedAutonomous??`source-dependent`,configuredWorktree:m.data?.composerDefaults?.worktree??m.data?.composerDefaults?.inheritedWorktree??!0,source:A?.source??`workflow`,dispatch:we}),Ne=Me.worktree,Pe=Me.autonomous,Fe=c.data===void 0||c.data.capabilities.followups,Re=Fe?h.generateFollowups??f.data?.lastGenerateFollowups??!0:!1,[ze,Be]=(0,Y.useState)(()=>s.auto&&s.ref!==``),[Ve,He]=(0,Y.useState)(()=>!s.auto&&s.ref!==``?{kind:`prefill`}:null),We=(0,Y.useRef)(!1),Ge=(0,Y.useRef)(!1);return(0,Y.useEffect)(()=>{We.current||(We.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[]),(0,Y.useEffect)(()=>{if(!Ge.current&&!(!s.auto||s.ref===``)&&!ne.isPending){if(!le||se===null){Ge.current=!0,He({kind:`prefill`}),Be(!1);return}if(!p.isPending){if(Ge.current=!0,ae===void 0){He({kind:`prefill`}),Be(!1);return}if(se!==ae){He({kind:`prefill`}),Be(!1);return}(async()=>{let e=``;try{e=(await Xe()).key}catch{}if(e!==``&&s.key===e)try{let e=await mt(zm(s,se,ae));$m(i),n.invalidateQueries({queryKey:B.runs.all}),t(Zr(e));return}catch(e){He({kind:`failed`,message:e instanceof Error?e.message:String(e)})}else He({kind:`blocked`});Be(!1)})()}}},[p.isPending,ae,ne.isPending,le,se]),(0,Y.useEffect)(()=>{if(Ve===null||!k)return;He(null);let e=s.skill!==``&&!C.some(e=>e.name===s.skill)?s.skill:``;e!==``&&_({text:Vm(s.skill,s.ref),source:null});let{message:t,tone:n}=Bm(Ve,e);V(t,{tone:n}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"]`)?.focus()},[Ve,k]),ze?(0,X.jsxs)(`div`,{"data-route":`new`,className:`relative isolate flex min-h-full flex-col items-center justify-center overflow-x-clip px-6`,children:[(0,X.jsx)(aa,{}),(0,X.jsxs)(`div`,{"data-slot":`auto-starting`,role:`status`,className:`text-center`,children:[(0,X.jsx)(`h1`,{className:`animate-pulse text-lg font-semibold tracking-tight`,children:`Starting task…`}),(0,X.jsx)(`p`,{className:`mt-1.5 text-[13.5px] text-muted-foreground`,children:`Launched from a bookmarklet — taking you to the run.`})]})]}):(0,X.jsxs)(`div`,{"data-route":`new`,className:`relative isolate flex min-h-full flex-col items-center overflow-x-clip px-6 pt-[clamp(32px,7vh,84px)] pb-16 max-md:px-3.5 max-md:pt-7`,children:[(0,X.jsx)(aa,{}),(0,X.jsx)(km,{}),(0,X.jsxs)(`div`,{className:`w-full max-w-[720px]`,children:[(0,X.jsxs)(`header`,{className:`mb-6 text-center max-md:mb-4`,children:[(0,X.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight max-md:text-base`,children:`What should the agent work on?`}),(0,X.jsx)(`p`,{"data-slot":`run-mode-note`,className:`mt-1.5 text-[13.5px] text-muted-foreground max-md:text-xs`,children:Um({worktree:Ne,hasGit:ve,dispatch:we,autonomous:Pe})})]}),(0,X.jsx)(Pi,{ref:M,onSubmit:async(e,r)=>{if(!le||se===null)throw Error(ne.isPending?`Checking agent providers…`:ne.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`);if(!k)throw Error(`Still loading workflows and skills — try again in a second.`);let a=await mt(Wr({task:e,source:A,model:pe,modelsLocked:de,runner:se,runnerExplicit:h.runner!==null,agentProfile:ge,defaultRunner:ae,variants:R,images:r,worktree:Ne,autonomous:Pe,generateFollowups:Re,todoId:s.todo,dispatch:Ce}));Ie({lastTask:A,...A?{recentSources:qr(b,A)}:{},...Fe?{lastGenerateFollowups:Re}:{},...A?.source===`skill`&&f.data!==void 0?{skillUsage:bi(f.data.skillUsage,A.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:B.uiState})).catch(()=>{}),$m(i),n.invalidateQueries({queryKey:B.runs.all}),t(Zr(a))},value:h.text,onValueChange:e=>_({text:e}),images:v,onImagesChange:y,autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:`Start task`,disabled:!le,disabledReason:ne.isPending?`Checking agent providers…`:ne.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,autocompleteSkills:!0,footerStart:(0,X.jsxs)(X.Fragment,{children:[E.length>1&&r!==void 0?(0,X.jsx)(dh,{projects:E,projectId:r,onPick:e=>{let n=rh(i,O(e));!n.moved&&n.reason===`destination-busy`&&V(`Kept your draft in ${E.find(e=>e.id===(i??o.data?.bootProject))?.name??r}; ${E.find(t=>t.id===e)?.name??e} already has an unsent draft.`,{tone:`danger`}),t(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}}):null,(0,X.jsx)(Rm,{source:A,ready:k,skills:C,skillUsage:S,workflows:w,onPick:e=>_({source:e})}),re.length>1||re.some(e=>wi(me,e))?(0,X.jsx)(Si,{runners:re,value:L,accounts:me,account:ge,repoAccount:he,onPick:(e,t)=>_({runner:e,agentProfile:t,...e===L?{}:{model:null}}),disabled:!le}):null,(0,X.jsx)(Fi,{slot:`model-pill`,ariaLabel:`Model`,label:fe.find(e=>e.id===pe)?.label??`auto`,value:pe,disabled:!le,readOnly:de,disabledHint:de?`Model selection is locked to native coding-agent settings.`:void 0,onPick:e=>_({model:e}),options:fe.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Xr(L,ue.data,ue.isError)}),(0,X.jsx)(Fi,{slot:`variants-pill`,ariaLabel:`Parallel variants`,label:R>1?`×${R} variants`:`×1`,value:String(R),onPick:e=>_({variants:Number(e)}),disabled:!ve,hint:`How many times to run this task in parallel — each variant gets its own worktree, and you pick the diff you keep. ×1 runs it once.`,disabledHint:`Parallel variants need a git repository — each variant runs in its own worktree.`,options:[{value:`1`,label:`×1`,desc:`One run`},{value:`2`,label:`×2 variants`,desc:`Two competing runs — pick the diff you keep`},{value:`3`,label:`×3 variants`,desc:`Three competing runs — pick the diff you keep`}]}),(0,X.jsx)(oh,{}),be?(0,X.jsx)(sh,{on:Ne,disabled:je,disabledReason:we?`Dispatch forks this task's commits — subtasks need a worktree`:`Parallel variants always use isolated worktrees`,onChange:e=>_({worktree:e})}):null,(0,X.jsx)(ch,{on:Pe,onChange:e=>_({autonomous:e})}),Fe?(0,X.jsx)(lh,{on:Re,onChange:e=>_({generateFollowups:e})}):null,P.length>0||xe?(0,X.jsx)(oh,{}):null,(0,X.jsx)(qp,{templates:P,iconOnly:!0,onInsert:e=>M.current?.insertAtCaret(e)}),(0,X.jsx)(tm,{available:xe,value:Ce,onChange:ke,onSettingsOpenChange:Oe,runners:re,parentRunner:L,parentModels:fe}),d.data?.info?(0,X.jsx)(oh,{}):null,d.data?(0,X.jsx)(fh,{repo:d.data}):null,j?.interactive&&(h.autonomous===null||h.worktree===null)?(0,X.jsx)(`p`,{className:`basis-full text-xs text-muted-foreground`,"data-slot":`interactive-skill-hint`,children:`This skill recommends an interactive run in the current checkout. You can change either setting.`}):null]}),footerEnd:(0,X.jsxs)(X.Fragment,{children:[!le&&!ne.isPending?(0,X.jsx)(H,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:eo()})]})}),we&&(De||Te)?(0,X.jsxs)(`p`,{"data-slot":`dispatch-hint`,className:`mt-2 rounded-md border border-primary/25 bg-primary/[0.07] px-3 py-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`strong`,{className:`font-semibold text-foreground`,children:`Dispatch is on.`}),` Splits this task into subtasks it runs as separate tasks. Worktree stays on. Long-press the icon for limits.`]}):null,(0,X.jsx)(mh,{onPick:e=>_({text:e})})]})]})}function oh(){return(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`mx-0.5 h-3.5 w-px shrink-0 bg-border max-md:hidden`})}function sh({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"data-slot":`worktree-toggle`,onClick:()=>r(!e),title:t?n:e?`Runs in an isolated worktree — uncheck to run in the repo working tree`:`Runs in the repo working tree — check to isolate in a worktree`,className:K(Oi,e&&`border-primary/60 text-foreground`),children:[e?(0,X.jsx)(Hi,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,X.jsx)(ws,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Worktree`]})}function ch({on:e,disabled:t,onChange:n}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"data-slot":`autonomous-toggle`,onClick:()=>n(!e),title:t?`Plan-first runs are interactive — autonomous is unavailable`:e?`Autonomous — the agent runs to completion without pausing for you`:`Runs interactively — check to let the agent finish without pausing for you`,className:K(Oi,e&&!t&&`border-primary/60 text-foreground`),children:[e?(0,X.jsx)(Hi,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,X.jsx)(ws,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Autonomous`]})}function lh({on:e,onChange:t}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"data-slot":`generate-followups-toggle`,onClick:()=>t(!e),title:e?`Agents can add newly discovered follow-up work to the task inbox`:`Follow-up generation is off; agents still maintain the handoff journal`,className:K(Oi,e&&`border-primary/60 text-foreground`),children:[e?(0,X.jsx)(Hi,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,X.jsx)(ws,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Follow-ups`]})}function uh(e,t){let n=t.trim().toLowerCase();if(n===``)return[...e];let r=e=>{let t=e.name.toLowerCase(),r=e.id.toLowerCase();return t.startsWith(n)||r.startsWith(n)?0:t.includes(n)||r.includes(n)?1:2};return e.map((e,t)=>({project:e,rank:r(e),index:t})).filter(e=>e.rank<2).sort((e,t)=>e.rank-t.rank||e.index-t.index).map(e=>e.project)}function dh({projects:e,projectId:t,onPick:n}){let[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(``),s=e.find(e=>e.id===t),c=uh(e,a);return(0,X.jsxs)(li,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,X.jsx)(ci,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`project-pill`,"aria-label":`Project`,title:`Which project this task runs in — its skills, workflows, settings and draft`,className:K(Oi,`border-foreground/60 font-semibold text-foreground`),children:[(0,X.jsx)($o,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,X.jsx)(`span`,{className:`max-w-40 truncate`,children:s?.name??t}),ji]})}),(0,X.jsx)(ti,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(ya,{shouldFilter:!1,children:[(0,X.jsx)(ba,{placeholder:`search projects…`,value:a,onValueChange:o}),(0,X.jsxs)(da,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,X.jsx)(ga,{children:`Nothing matches.`}):null,c.map(e=>(0,X.jsxs)(Ca,{value:e.id,keywords:[e.name],"data-slot":`project-option`,"data-project-id":e.id,disabled:e.status===`missing`,onSelect:()=>{n(e.id),i(!1)},children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,X.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground`,children:e.branch}),e.id===t?(0,X.jsx)(Hi,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id))]}),(0,X.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-[11px] leading-snug text-soft-foreground`,children:`Skills, workflows, settings and the draft re-resolve against the selected project.`})]})})]})}function fh({repo:e}){let t=I(),n=k({mutationFn:e=>P({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:B.repo}),V(e.baseBranch?`New tasks will branch off "${e.baseBranch}" (PRs target it too).`:`Base branch cleared — new tasks fork from the checked-out branch.`)},onError:e=>V(e.message,{tone:`danger`})});return e.info?(0,X.jsx)(Fi,{slot:`base-pill`,ariaLabel:`Base branch`,label:(0,X.jsxs)(`span`,{className:`font-mono text-[11.5px]`,children:[`base: `,e.baseBranch??e.info.branch]}),value:e.baseBranch??``,onPick:e=>n.mutate(e===``?null:e),searchPlaceholder:`Search branches…`,options:[{value:``,label:`follow checked-out branch (${e.info.branch})`,desc:`New task worktrees fork from whatever branch is checked out`},...e.branches.map(e=>({value:e,label:e}))]}):null}var ph=[`Fix a failing or flaky test`,`Summarize recent commits on this branch`,`Update the README for recent changes`];function mh({onPick:e}){return(0,X.jsx)(`div`,{className:`mt-7 flex flex-wrap justify-center gap-2 max-md:justify-start`,children:ph.map(t=>(0,X.jsxs)(`button`,{type:`button`,"data-slot":`suggested-chip`,onClick:()=>e(t),className:`inline-flex h-[30px] items-center gap-1.5 rounded-full border border-border px-3 text-[12.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,X.jsx)(ei,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),t]},t))})}function hh(){return(0,X.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(qo,{}),tone:`neutral`,title:`Page not found`,subtitle:`Nothing lives at this address. The link may be mistyped, or it points at something that is gone.`,actions:(0,X.jsx)(q,{asChild:!0,variant:`outline`,children:(0,X.jsx)(H,{to:`/`,children:`Back to tasks`})})})})}function gh(){return(0,X.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(oa,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})})}function _h(){return(0,X.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,X.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,X.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,X.jsx)(`p`,{"data-slot":`skills-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading skills…`})]})}function vh({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,X.jsx)(`div`,{"data-route":`unknown-project`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(es,{}),tone:`neutral`,title:`“${e}” isn’t registered here`,subtitle:`This workspace doesn’t serve a project by that id. The link may come from another machine’s workspace — these are the projects this one can open:`,children:(0,X.jsx)(`ul`,{"data-slot":`registered-projects`,className:`mx-auto flex w-full max-w-xs flex-col gap-1.5 text-left`,children:n.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(pe,{to:`/p/${encodeURIComponent(e.id)}/`,className:`flex items-baseline gap-2 rounded-md border border-border bg-card px-3 py-2 text-sm font-medium text-foreground shadow-xs transition-colors hover:bg-card-2`,children:[e.name||e.id,(0,X.jsxs)(`span`,{className:`font-mono text-[11px] font-normal text-soft-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function yh(){return(0,X.jsx)(`div`,{"data-route":`workflows`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(oa,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading workflows…`,subtitle:`Fetching the saved workflows and the node catalog.`})})}function bh({tab:e}){return(0,X.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(oa,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:e===`changes`?`Loading changes…`:`Loading files…`,subtitle:`Fetching the run record.`})})}function xh({tab:e,error:t}){let n=t instanceof we&&t.status===404;return(0,X.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:n?(0,X.jsx)(ca,{}):(0,X.jsx)(ia,{}),tone:n?`neutral`:`danger`,title:n?`Task not found`:`Could not load this task`,subtitle:n?`No run has this id. It may have been deleted, or the link is from another machine.`:t.message,actions:(0,X.jsx)(q,{asChild:!0,variant:`outline`,children:(0,X.jsx)(H,{to:`/`,children:`Back to tasks`})})})})}function Sh({className:e,orientation:t=`horizontal`,...n}){return(0,X.jsx)(Pl,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:K(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var Ch=An(`group/tabs-list inline-flex w-fit items-center justify-center rounded-md p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function wh({className:e,variant:t=`default`,...n}){return(0,X.jsx)(Fl,{"data-slot":`tabs-list`,"data-variant":t,className:K(Ch({variant:t}),e),...n})}function Th({className:e,...t}){return(0,X.jsx)(Il,{"data-slot":`tabs-trigger`,className:K(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-sm border border-transparent px-3 py-1 text-[12.5px] font-medium whitespace-nowrap text-muted-foreground transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-xs group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-card data-[state=active]:font-semibold data-[state=active]:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function Eh({className:e,...t}){return(0,X.jsx)(Ll,{"data-slot":`tabs-content`,className:K(`flex-1 outline-none`,e),...t})}function Dh(e){return Jr.flatMap(t=>{let n=e.filter(e=>e.provider===t.id);return n.length<2?[{runner:t,account:null,label:t.label,desc:t.desc,missing:!1}]:n.map(e=>({runner:t,account:e.isDefault?null:e.id,label:`${t.label} · ${e.label}`,desc:e.exists?e.configDir:`${e.configDir} — folder not created yet`,missing:!e.exists}))})}var Oh=e=>e.length>Jr.length;function kh({rows:e,runner:t,accountFor:n,providerStatus:r,disabled:i=!1,accountDisabled:a=!1,onPick:o}){let s=Oh(e);return(0,X.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:K(`gap-0.5 rounded-md border border-border bg-card p-0.5`,s?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(c=>{let l=u(r.data,c.runner.id),d=!r.isPending&&!r.isError&&l?.enabled===!0&&l.status===`connected`,f=r.isPending?`Checking provider authentication…`:r.isError?`Provider authentication could not be verified.`:l?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:d?void 0:`Connect this provider before selecting it.`,p=e.filter(e=>e.runner.id===c.runner.id).length>1,m=c.runner.id===t&&c.account===n(c.runner.id);return(0,X.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":m,"data-value":c.runner.id,"data-account":c.account??``,title:f??c.desc,disabled:i||!d||p&&a,onClick:()=>o(c.runner.id,c.account,p),className:K(`rounded-sm px-3 py-1.5 text-left font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,m?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[c.label,s?(0,X.jsx)(`span`,{"data-slot":c.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":c.runner.id,className:`ml-2 font-sans text-[11.5px] text-soft-foreground`,children:c.desc}):null]},`${c.runner.id}:${c.account??``}`)})})}function Ah({open:e,onOpenChange:t,providers:n,initialProvider:r}){let[i,a]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(r??n[0]??`claude`),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(!1),g=y(),_=f.trim();return(0,X.jsx)(fa,{open:e,onOpenChange:t,children:(0,X.jsxs)(pa,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(ha,{children:[(0,X.jsx)(ma,{children:`Add agent account`}),(0,X.jsx)(xa,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,X.jsx)(`select`,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:c,onChange:e=>l(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:n.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,X.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:u,placeholder:`Work`,onChange:e=>d(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:f,placeholder:c===`codex`?`~/.codex-second`:`~/.claude-second`,onChange:e=>{p(e.target.value),s(null),g.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[12.5px] outline-none focus-visible:border-ring`}),(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":m,onClick:()=>h(e=>!e),children:m?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-[11.5px] text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),m?(0,X.jsx)(Hl,{path:i,selected:o,onSelect:e=>{s(e),p(e.path),g.reset()},onEnter:e=>{a(e),s(null),g.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,g.isError?(0,X.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:g.error instanceof Error?g.error.message:`could not add that folder`}):null,(0,X.jsxs)(va,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(q,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(q,{"data-slot":`add-account-confirm`,disabled:_===``||g.isPending,onClick:()=>{_===``||g.isPending||g.mutate({provider:c,configDir:_,...u.trim()?{label:u.trim()}:{}},{onSuccess:()=>{t(!1),d(``),p(``),s(null),h(!1),V(`Account added — use Connect to sign in`)}})},children:g.isPending?`Adding…`:`Add account`})]})]})})}var jh={claude:`Claude Code`,codex:`Codex`,junie:`Junie`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,copilot:`GitHub Copilot CLI`},Mh={claude:`curl -fsSL https://claude.ai/install.sh | bash`,codex:`npm i -g @openai/codex`,junie:`https://www.jetbrains.com/junie/`,opencode:`https://opencode.ai`,cursor:`curl https://cursor.com/install -fsS | bash`,pi:`https://github.com/badlogic/pi-mono`,copilot:`npm i -g @github/copilot`},Nh={connected:{label:`Connected`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function Ph(){let e=_n();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent accounts…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(as,{}),tone:`danger`,title:`Agent accounts did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(Fh,{data:e.data})}function Fh({data:e}){let t=Se(),[n,r]=(0,Y.useState)(null),[i,a]=(0,Y.useState)(null),o=ct(),s=C;return e.editable?(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Agent accounts`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`One agent per tab: whether it is installed, and which logins you have. Add a second config folder to keep a work account beside a personal one; each project picks which it uses in its own Agents settings.`})]}),(0,X.jsx)(Lh,{profiles:e}),(0,X.jsxs)(Sh,{defaultValue:`claude`,children:[(0,X.jsx)(wh,{variant:`line`,"data-slot":`accounts-tabs`,children:s.map(e=>(0,X.jsx)(Th,{value:e,"data-provider":e,children:jh[e]},e))}),s.map(n=>(0,X.jsx)(Eh,{value:n,className:`pt-4`,children:(0,X.jsx)(Ih,{provider:n,check:t.data?.checks?.find(e=>e.name===n),accounts:e.profiles.filter(e=>e.provider===n),canCarryAccounts:e.profileCapableProviders.includes(n),onAdd:()=>r(n),onRemove:a})},n))]}),n===null?null:(0,X.jsx)(Ah,{open:!0,onOpenChange:e=>!e&&r(null),providers:e.profileCapableProviders,initialProvider:n},n),(0,X.jsx)(Ga,{open:i!==null,onOpenChange:e=>!e&&a(null),children:(0,X.jsxs)(Ba,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(Wa,{children:[(0,X.jsxs)(za,{children:[`Remove “`,i?.label,`”?`]}),(0,X.jsxs)(Ra,{children:[`This only forgets the account. Nothing in `,i?.configDir,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,X.jsxs)(Ha,{children:[(0,X.jsx)(Ua,{children:`Cancel`}),(0,X.jsx)(Va,{"data-action":`accounts-remove-confirm`,disabled:o.isPending,onClick:()=>{let e=i;e&&o.mutate(e.id,{onSuccess:()=>{a(null),V(`Removed ${e.label}`)},onError:e=>V(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]}):(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 md:p-6`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Agent accounts`}),(0,X.jsx)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-soft-foreground`,children:`Agent accounts are managed from the machine that owns the checkout — this cockpit runs in hosted mode.`})]})}function Ih({provider:e,check:t,accounts:n,canCarryAccounts:r,onAdd:i,onRemove:a}){let o=t?.available===!0;return(0,X.jsxs)(`div`,{"data-slot":`accounts-provider`,"data-provider":e,className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`dl`,{className:`divide-y divide-border/60 overflow-hidden rounded-md border border-border bg-card text-[13px]`,children:[(0,X.jsx)(Rh,{label:`Installed`,children:t===void 0?(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Checking…`}):o?(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`Yes`}):(0,X.jsxs)(`span`,{"data-slot":`agent-installed`,className:`text-muted-foreground`,children:[`No — `,(0,X.jsx)(`code`,{className:`text-[12px]`,children:Mh[e]})]})}),o&&t?.version?(0,X.jsx)(Rh,{label:`Version`,children:(0,X.jsx)(`span`,{"data-slot":`agent-version`,className:`font-mono text-[12.5px]`,children:t.version})}):null,(0,X.jsx)(Rh,{label:`Accounts`,children:(0,X.jsx)(`span`,{children:n.length===1?`the discovered one`:`${n.length} (1 discovered, ${n.length-1} added)`})})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Logins`}),r?(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":e,onClick:i,children:`Add account`}):null]}),(0,X.jsx)(`ul`,{className:`divide-y divide-border/60 rounded-md border border-border bg-card`,children:n.map(e=>(0,X.jsx)(zh,{account:e,onRemove:()=>a(e)},e.id))}),r?null:(0,X.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`text-[11.5px] text-soft-foreground`,children:[jh[e],` can only hold one account here: it keeps its credentials outside its config folder, so a second folder would change settings without changing the login — which would say “work account” while billing the other one.`]})]})}function Lh({profiles:e}){let t=I(),n=Ue(),r=a(),i=ke(),o=f(),s=k({mutationFn:e=>j(e),onSuccess:e=>t.setQueryData(c.config,e),onError:e=>V(e.message,{tone:`danger`})});if(n.data===void 0)return null;let l=Dh(e.profiles),u=n.data.agentDefaults.runner??`claude`,d=n.data.agentDefaults.models??{};return(0,X.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own.`})]}),(0,X.jsx)(kh,{rows:l,runner:u,accountFor:t=>e.defaults[t]??null,providerStatus:r,disabled:s.isPending,accountDisabled:o.isPending,onPick:(e,t,n)=>{e!==u&&s.mutate({agentDefaults:{runner:e}}),n&&o.mutate({projectId:null,provider:e,profileId:t},{onError:e=>V(e.message,{tone:`danger`})})}}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Default model per agent`}),Jr.map(e=>(0,X.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:e.label}),(0,X.jsxs)(`select`,{"aria-label":`Default model for ${e.label}`,"data-slot":`accounts-default-model`,"data-runner":e.id,value:d[e.id]??``,disabled:s.isPending,onChange:t=>s.mutate({agentDefaults:{models:{[e.id]:t.target.value||null}}}),className:`block w-full max-w-xs rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[Br(e.id,i[e.id].data,[d[e.id]]).map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),Xr(e.id,i[e.id].data,i[e.id].isError)?(0,X.jsx)(`option`,{disabled:!0,children:Xr(e.id,i[e.id].data,i[e.id].isError)}):null]})]},e.id))]})]})}function Rh({label:e,children:t}){return(0,X.jsxs)(`div`,{className:`flex items-baseline gap-3 px-3.5 py-2.5`,children:[(0,X.jsx)(`dt`,{className:`w-28 shrink-0 text-muted-foreground`,children:e}),(0,X.jsx)(`dd`,{className:`min-w-0 flex-1`,children:t})]})}function zh({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),i=Vn(e),a=Oe(),o=ln(),s=fn(i,e.status===void 0),c=e.status??s.data?.status,l=c?Nh[c.status]:void 0;return(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`flex flex-col gap-2 px-3.5 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium text-foreground`,children:e.label}),e.isDefault?(0,X.jsx)(Z,{variant:`ghost`,className:`shrink-0 text-[10px] text-muted-foreground`,children:`discovered`}):null]}),(0,X.jsx)(`p`,{"data-slot":`account-path`,className:`mt-0.5 truncate font-mono text-[11.5px] text-soft-foreground`,title:e.path,children:e.configDir}),(0,X.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(Ka,{tone:l?.tone??`neutral`,pulse:l===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,children:l?.label??`Checking…`}),e.exists?e.looksValid?null:(0,X.jsxs)(`span`,{"data-slot":`account-unrecognised`,children:[`— this folder does not look like `,jh[e.provider],` config yet`]}):(0,X.jsx)(`span`,{"data-slot":`account-missing`,children:`— folder not created yet; Connect will make it`})]})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[c?.status===`connected`?null:(0,X.jsx)(q,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:a.isPending,onClick:()=>a.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>V(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>V(e instanceof we&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}),(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`account-recheck`,disabled:o.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>o.mutate(i,{onError:e=>V(e.message,{tone:`danger`})}),children:`Check again`}),(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`account-details-toggle`,"aria-expanded":n,onClick:()=>r(e=>!e),children:n?`Hide details`:`Show details`})]})]}),n?(0,X.jsx)(Bh,{account:e,routeId:i,onRemove:t}):null]})}function Bh({account:e,routeId:t,onRemove:n}){let r=Je(t,!0),i=Fe(),a=O(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(e.label),u=M(),d=a.data?.targets??[],f=d.filter(e=>jr(e.id)===void 0&&e.id!==`terminal`&&e.id!==`finder`).map(e=>({target:e})),p=d.filter(e=>jr(e.id)===void 0).map(e=>({target:e})),m=(e,n,r)=>i.mutate({routeId:t,file:e,...r?{target:r}:{}},{onError:e=>V(e.message,{tone:`danger`}),onSuccess:()=>V(`Opened ${n}`)});return(0,X.jsxs)(`div`,{"data-slot":`account-details`,className:`rounded-md border border-border/60 bg-muted/30 p-3`,children:[r.isPending?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Reading account details…`}):r.isError?(0,X.jsx)(`p`,{"data-slot":`account-details-error`,className:`text-xs text-danger`,children:r.error.message}):r.data.available?(0,X.jsx)(`dl`,{"data-slot":`account-identity`,className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs`,children:r.data.fields.map(e=>(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,X.jsx)(`dd`,{className:`min-w-0 truncate text-foreground`,title:e.value,children:e.value})]},e.label))}):(0,X.jsx)(`p`,{"data-slot":`account-identity-unavailable`,className:`text-xs text-muted-foreground`,children:r.data.reason??`No account details to show.`}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5 border-t border-border/60 pt-2.5`,children:[(0,X.jsx)(`span`,{className:`mr-1 text-xs text-muted-foreground`,children:`Config files`}),e.files.map(e=>(0,X.jsx)(Ur,{slot:`account-open-file`,label:e.label,triggerVariant:`outline`,disabled:i.isPending,title:e.exists?e.path:`${e.path} — not created yet`,choices:f,onPick:t=>m(e.id,e.label,t),leading:(0,X.jsxs)(Qi,{"data-target":`system`,onSelect:()=>m(e.id,e.label),children:[(0,X.jsx)(na,{"aria-hidden":`true`}),`System default`]})},e.id)),(0,X.jsx)(Ur,{slot:`account-open-folder`,label:`Folder`,disabled:i.isPending,title:e.path,choices:p,onPick:e=>m(`folder`,`folder`,e),leading:(0,X.jsxs)(Qi,{"data-target":`system`,onSelect:()=>m(`folder`,`folder`),children:[(0,X.jsx)(na,{"aria-hidden":`true`}),`System default`]})})]}),e.isDefault?null:(0,X.jsxs)(`div`,{"data-slot":`account-manage`,className:`mt-3 flex flex-wrap items-center gap-2 border-t border-border/60 pt-2.5`,children:[(0,X.jsx)(`span`,{className:`mr-1 text-xs text-muted-foreground`,children:`Account`}),o?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:c,onChange:e=>l(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,X.jsx)(q,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:u.isPending||c.trim()===``||c.trim()===e.label,onClick:()=>u.mutate({id:e.id,label:c.trim()},{onSuccess:()=>s(!1),onError:e=>V(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{l(e.label),s(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>s(!0),children:`Rename`}),(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:n,children:`Remove`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what cezar calls this account, not its folder.`})]})]})]})}var Vh=1500;function Hh(e,t){let n=(0,Y.useMemo)(()=>e.split(`
|
|
4
|
-
`).map(e=>[{content:e}]),[e]),r=(0,Y.useMemo)(()=>no(t),[t]),i=n.length>Vh,[a,o]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{if(r===null||i)return;let t=!1;return ro(e,r).then(n=>{t||o({key:e,tokens:n.tokens})}),()=>{t=!0}},[e,r,i]),r===null||i?n:a?.key===e?a.tokens:to(e,r)?.tokens??n}var Uh=`m-0 min-h-full w-full whitespace-pre font-mono text-xs leading-[1.7] px-3 py-2 [tab-size:2]`;function Wh({value:e,onChange:t,language:n,readOnly:r,className:i,...a}){let o=Hh(e,n),s=(0,Y.useRef)(null),c=(0,Y.useRef)(null),l=()=>{let e=c.current,t=s.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,Y.useLayoutEffect)(l,[e]),(0,X.jsxs)(`div`,{"data-slot":`code-editor`,className:K(`relative overflow-hidden rounded-md border border-input bg-card`,i),children:[(0,X.jsx)(`pre`,{ref:s,"aria-hidden":`true`,className:K(Uh,`pointer-events-none absolute inset-0 overflow-auto text-soft-foreground`),children:o.map((e,t)=>(0,X.jsx)(`span`,{className:`block`,children:e.length===0?`
|
|
5
|
-
`:(0,X.jsxs)(X.Fragment,{children:[e.map((e,t)=>(0,X.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),`
|
|
6
|
-
`]})},t))}),(0,X.jsx)(`textarea`,{ref:c,"data-slot":`code-editor-input`,value:e,readOnly:r,onChange:e=>t?.(e.target.value),onScroll:l,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`,autoComplete:`off`,wrap:`off`,className:K(Uh,`relative block resize-none overflow-auto bg-transparent text-transparent caret-foreground outline-none`,`selection:bg-primary/30 focus-visible:ring-0`,r&&`cursor-default`),...a})]})}var Gh=`An editor-plus-commit: a saved change reaches a run after you commit it to the base branch.`;function Kh(e){return t=>t.runners.includes(e)}function qh(e,t,n,r){let i=Kh(e);return{id:t,label:n,note:r,files:t===`mcp`?e=>i(e)&&(e.holdsMcp===!0||e.kind===`mcp`):e=>i(e)&&e.kind===t}}var Jh=[{id:`claude`,label:`Claude`,groups:[qh(`claude`,`settings`,`Settings`),qh(`claude`,`mcp`,`MCP`,`A dedicated .mcp.json (key: mcpServers), shared via version control.`),qh(`claude`,`memory`,`Memory & instructions`)]},{id:`codex`,label:`Codex`,note:Gh,groups:[qh(`codex`,`settings`,`Settings`),qh(`codex`,`mcp`,`MCP`,`Inside config.toml under [mcp_servers.<id>] — the same file as Codex’s settings.`),qh(`codex`,`memory`,`Memory & instructions`)]},{id:`copilot`,label:`GitHub Copilot`,note:Gh,groups:[qh(`copilot`,`settings`,`Settings`),qh(`copilot`,`mcp`,`MCP`,`A dedicated ~/.copilot/mcp-config.json. Per-run --additional-mcp-config augments it rather than replacing it.`),qh(`copilot`,`memory`,`Memory & instructions`)]},{id:`opencode`,label:`OpenCode`,note:Gh,groups:[qh(`opencode`,`settings`,`Settings`),qh(`opencode`,`mcp`,`MCP`,`Under the "mcp" key in opencode.json — the same file as OpenCode’s settings.`),qh(`opencode`,`memory`,`Memory & instructions`)]},{id:`cursor`,label:`Cursor`,note:"Cursor Agent CLI (`agent`). Auth via `agent login` or CURSOR_API_KEY. No separate memory file — instructions live in rules/MCP elsewhere.",groups:[qh(`cursor`,`settings`,`Settings`),qh(`cursor`,`mcp`,`MCP`,`User ~/.cursor/mcp.json and project .cursor/mcp.json.`)]}];function Yh(e){let t=Jh.find(t=>t.id===e);if(!t)throw Error(`no agent descriptor for ${e}`);return t}var Xh=`{
|
|
7
|
-
"mcpServers": {
|
|
8
|
-
"example-stdio": {
|
|
9
|
-
"command": "/absolute/path/to/your-mcp-server",
|
|
10
|
-
"args": [],
|
|
11
|
-
"env": { "API_TOKEN": "your-personal-token" }
|
|
12
|
-
},
|
|
13
|
-
"example-http": {
|
|
14
|
-
"type": "http",
|
|
15
|
-
"url": "https://mcp.example.com/mcp",
|
|
16
|
-
"headers": { "Authorization": "Bearer your-personal-token" }
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
`;function Zh(e){return e.private?`Private to this project — added to every run at launch, takes effect on the next session. Never committed.`:e.seeded?`Copied into each run’s worktree — takes effect on your next run.`:e.tracked===`tracked`?`Runs read the committed copy — this edit applies after you commit it.`:e.tracked===`outside-repo`?`Applies to every session on this machine.`:`Personal, git-ignored.`}function Qh(){let e=vn(),t=Se(),n=(0,Y.useMemo)(()=>t.data?Rr(t.data.checks):Jh.map(e=>e.id),[t.data]);return e.isPending?(0,X.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(Xo,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)($h,{listing:e.data,installed:n})}function $h({listing:e,installed:t}){let[n,r]=(0,Y.useState)(`claude`),[i,a]=(0,Y.useState)(null),o=Yh(n),s=e.files.find(e=>e.id===i)??null,c=e=>{r(e),a(null)};return(0,X.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[!e.editable&&(0,X.jsx)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-soft-foreground`,children:`Read-only: agent config is edited from the machine that owns the checkout (this cockpit runs in hosted mode). You can still see every file and which one wins.`}),(0,X.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1 rounded-md bg-muted/40 p-1`,children:Jh.map(e=>(0,X.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===o.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===o.id,onClick:()=>c(e.id),className:K(`flex items-center gap-2 rounded-md px-3 py-1.5 text-[13px] transition-colors`,e.id===o.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!t.includes(e.id)&&(0,X.jsx)(Z,{variant:`outline`,className:`text-[10px] text-soft-foreground`,children:`not installed`})]},e.id))}),o.note&&(0,X.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-[12px] text-soft-foreground`,children:o.note}),(0,X.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,20rem)_minmax(0,1fr)]`,children:[(0,X.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex flex-col gap-5`,children:(0,X.jsx)(eg,{agent:o,listing:e,selectedId:i,onSelect:a})}),(0,X.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,children:s?(0,X.jsx)(ng,{file:s},s.id):(0,X.jsx)(`div`,{className:`flex h-full min-h-40 items-center justify-center rounded-md border border-dashed border-border text-[13px] text-soft-foreground`,children:`Select a config file to view or edit it.`})})]})]})}function eg({agent:e,listing:t,selectedId:n,onSelect:r}){return(0,X.jsx)(X.Fragment,{children:e.groups.map(i=>{let a=t.files.filter(i.files),o=e.id===`claude`&&i.id===`mcp`;return a.length===0&&!(o&&t.userMcp)?null:(0,X.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":i.id,"data-agent":e.id,children:[(0,X.jsx)(`p`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-soft-foreground`,children:i.label}),i.note&&(0,X.jsx)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:i.note}),(0,X.jsx)(`ul`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>r(e.id),className:K(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-primary/15 text-foreground`:`hover:bg-muted/60`),children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px]`,children:e.label}),e.seeded&&(0,X.jsx)(Z,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`seeded`}),e.private&&(0,X.jsx)(Z,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`private`}),!e.exists&&(0,X.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`absent`})]})},e.id))}),o&&t.userMcp&&(0,X.jsx)(tg,{userMcp:t.userMcp})]},i.id)})})}function tg({userMcp:e}){return(0,X.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,X.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,X.jsxs)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:[`Managed by `,(0,X.jsx)(`code`,{className:`font-mono`,children:`claude mcp add`}),` in `,e.path,` — cezar does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,X.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(Z,{variant:`outline`,className:`font-mono text-[11px]`,children:e})},e))}):(0,X.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`No user-scoped MCP servers.`}):(0,X.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`Could not read the file.`})]})}function ng({file:e}){let t=nt(e.id),n=ht(e.id),[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),l=t.data?.version??null;(0,Y.useEffect)(()=>{t.data&&(i(e.private&&!t.data.exists?Xh:t.data.content),o(!1),c(null))},[t.data?.version,t.data]);let u=r??t.data?.content??``,d=t.data?u!==t.data.content:!1,f=e.writable;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,X.jsx)(Z,{variant:`outline`,className:`text-[10px] uppercase`,children:e.format}),(0,X.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,X.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-[12px] text-soft-foreground`,children:e.precedence}),(0,X.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-[12px] text-foreground/80`,children:[Zh(e),e.hotReload?` ${e.hotReload}`:``]}),t.isPending?(0,X.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,X.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,X.jsx)(Wh,{value:u,language:e.format,readOnly:!f,onChange:i,"aria-label":`${e.label} contents`,className:`h-[26rem]`}),s&&(0,X.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-[12px] text-destructive`,children:s}),a&&(0,X.jsxs)(`div`,{"data-slot":`agent-config-conflict`,className:`flex items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px]`,children:[(0,X.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,X.jsx)(q,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),children:`Reload from disk`})]}),f&&(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(q,{size:`sm`,onClick:()=>{c(null),o(!1),n.mutate({content:u,version:l},{onSuccess:()=>{i(null),V(`${e.exists?`Saved`:`Created`} ${e.label}`)},onError:e=>{e instanceof we&&e.status===409?o(!0):e instanceof we&&e.status===400?c(e.message):V(e.message,{tone:`danger`})}})},disabled:!d||n.isPending,children:e.exists?`Save`:`Create`}),(0,X.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>i(null),disabled:!d||n.isPending,children:`Revert`}),d&&(0,X.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Unsaved changes`})]})]})}var rg=[{id:`claude`,label:`Claude Code`,login:`claude auth login`},{id:`codex`,label:`Codex`,login:`codex login`},{id:`junie`,label:`Junie`,login:`junie login`},{id:`opencode`,label:`OpenCode`,login:`opencode auth login`},{id:`cursor`,label:`Cursor`,login:`agent login`},{id:`pi`,label:`pi`,login:`pi /login`},{id:`copilot`,label:`GitHub Copilot CLI`,login:`copilot login`}],ig=e=>({claude:e,codex:e,junie:e,opencode:e,cursor:e,pi:e,copilot:e}),ag={connected:{label:`Credentials found`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function og(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function sg(){let e=a(),t=Dt(),n=xt(),r=I(),[i,o]=(0,Y.useState)(null),s=(0,Y.useRef)(Promise.resolve()),l=(0,Y.useRef)(ig(0)),d=(0,Y.useRef)(ig(0)),f=(0,Y.useRef)(e.data);(0,Y.useEffect)(()=>{i&&u(e.data,i.provider)?.status===`connected`&&o(null)},[i,e.data]),(0,Y.useEffect)(()=>{if(e.data){if(Object.values(d.current).every(e=>e===0)||!f.current){f.current=e.data;return}f.current={providers:e.data.providers.map(e=>({...e,enabled:d.current[e.provider]>0?u(f.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[e.data]);let p=(0,Y.useCallback)((e,t)=>{let n=c.providerStatus,i=r.getQueryData(n);if(!i)return;f.current||=i;let a=og(i,e,t);d.current[e]+=1,r.setQueryData(n,a);let o=++l.current[e];s.current=s.current.then(async()=>{try{let i=await qt(e,t),a=u(i,e)?.enabled;if(a===void 0)return;if(f.current=og(f.current??i,e,a),o===l.current[e]){let t=r.getQueryData(n);r.setQueryData(n,t?og(t,e,a):i)}}catch(t){if(o===l.current[e]){let i=u(f.current,e)?.enabled,a=r.getQueryData(n);a&&i!==void 0?r.setQueryData(n,og(a,e,i)):f.current?r.setQueryData(n,f.current):r.removeQueries({queryKey:n,exact:!0}),V(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{--d.current[e]}})},[r]),m=k({mutationFn:e=>Be(e),onSuccess:async e=>{o(null),V(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await r.invalidateQueries({queryKey:c.providerStatus})},onError:(e,t)=>{if(e instanceof we&&e.command){let n=rg.find(e=>e.id===t)?.label??t;o({provider:t,label:n,message:e.message,command:e.command});return}V(e.message,{tone:`danger`})}}),h=async e=>{try{await navigator.clipboard.writeText(e),V(`Command copied`)}catch{V(`Could not copy the command`,{tone:`danger`})}};return(0,X.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,X.jsxs)(`div`,{className:`mb-2`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),e.isError?(0,X.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.error.message})]}),(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:rg.map(r=>{let a=u(e.data,r.id),o=a?.status,s=o?ag[o]:e.isPending?{label:`Checking…`,tone:`neutral`}:ag.unknown,c=m.isPending&&m.variables===r.id,l=o===`disconnected`||o===`unknown`,d=a?.authFailureId;return(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":r.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:r.label}),(0,X.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(Ka,{tone:s.tone,pulse:e.isPending}),(0,X.jsx)(`span`,{children:s.label}),a?.enabled===!1?(0,X.jsx)(`span`,{children:`Disabled`}):null]}),o===`not-installed`?(0,X.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,r.label,`, then run `,(0,X.jsx)(`code`,{children:r.login}),`.`]}):o===`unknown`||e.isError&&!o?(0,X.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:a?.hint??`Verification failed. Check again when the provider is available.`}):a?.hint?(0,X.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:a.hint}):null]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o===`not-installed`?null:(0,X.jsx)($p,{checked:a?.enabled??!0,"aria-label":`Use ${r.label}`,onCheckedChange:e=>p(r.id,e)}),l?(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(void 0,{onError:e=>V(e.message,{tone:`danger`})}),children:`Check again`}):null,o===`disconnected`?(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,disabled:m.isPending,onClick:()=>m.mutate(r.id),children:c?`Opening…`:`Connect`}):null,d===void 0?null:(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,disabled:n.isPending,onClick:()=>n.mutate({provider:r.id,authFailureId:d},{onSuccess:()=>V(`${r.label} can be tried again.`),onError:e=>V(e.message,{tone:`danger`})}),children:`Try again`})]})]}),d===void 0?null:(0,X.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. cezar cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),i?.provider===r.id&&o!==`connected`?(0,X.jsxs)(`div`,{role:`region`,"aria-label":`${i.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,X.jsx)(`p`,{className:`text-[13px] text-foreground`,children:i.message}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:i.command}),(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void h(i.command),children:`Copy command`})]})]}):null]},r.id)})})]})}var cg=2e4;function lg(){let e=hn(),t=ke(),n=a();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(Bi,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(ug,{config:e.data,catalogs:t,providerStatus:n})}function ug({config:e,catalogs:t,providerStatus:n}){let r=ut(),i=I(),a=k({mutationFn:e=>P(e),onSuccess:e=>{i.setQueryData(B.config,e),i.invalidateQueries({queryKey:B.health}),i.invalidateQueries({queryKey:B.repo})},onError:e=>V(e.message,{tone:`danger`})}),[o,s]=(0,Y.useState)(e.systemPrompt??``),c=o.trim(),l=c===(e.systemPrompt??``),d=c.length>cg;return(0,X.jsxs)(`div`,{"data-slot":`agents-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(sg,{}),(0,X.jsx)(dg,{defaultRunner:e.defaultRunner,providerStatus:n,saving:a.isPending,onPick:e=>a.mutate({defaultRunner:e})}),(0,X.jsx)(fg,{title:`Default models`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,X.jsx)(`div`,{className:`flex max-w-md flex-col gap-2`,children:Jr.map(r=>{let i=u(n.data,r.id),o=!n.isPending&&!n.isError&&i?.enabled===!0&&i.status===`connected`,s=n.isPending?`Checking provider authentication…`:n.isError?`Provider authentication could not be verified.`:i?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:o?void 0:`Connect this provider before selecting it.`,c=t[r.id],l=Xr(r.id,c.data,c.isError),d=Br(r.id,c.data,[e.defaultModels[r.id]]),f=e.defaultModels[r.id]??``,p=d.find(e=>e.id===f)?.label??f??`auto (default)`;return(0,X.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:r.label}),e.modelsLocked?(0,X.jsx)(`output`,{"aria-label":`Default model for ${r.label}`,"data-slot":`agents-model`,"data-runner":r.id,title:`Model selection is locked to native coding-agent settings.`,className:`block w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:p}):(0,X.jsxs)(`select`,{"aria-label":`Default model for ${r.label}`,"data-slot":`agents-model`,"data-runner":r.id,value:f,title:s??r.desc,disabled:a.isPending||!o,onChange:e=>a.mutate({defaultModels:{[r.id]:e.target.value||null},defaultModelsAuto:{[r.id]:e.target.value===``}}),className:`block w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[d.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),l?(0,X.jsx)(`option`,{disabled:!0,children:l}):null]})]},r.id)})})}),(0,X.jsxs)(fg,{title:`System prompt`,hint:`Extra instructions appended to every run, whichever runner executes it. This is the only place it is edited.`,children:[(0,X.jsx)($a,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:o,onChange:e=>s(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-32 max-w-xl`}),(0,X.jsxs)(`div`,{className:`flex max-w-xl items-center gap-3`,children:[(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,"data-action":`agents-save-prompt`,disabled:l||d||a.isPending,onClick:()=>a.mutate({systemPrompt:c===``?null:c},{onSuccess:()=>V(c===``?`System prompt cleared`:`System prompt saved`)}),children:`Save`}),d?(0,X.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-[11px] text-danger`,children:[c.length.toLocaleString(),` characters — the limit is`,` `,cg.toLocaleString(),`.`]}):(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]}),(0,X.jsx)(fg,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,children:(0,X.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,X.jsx)($p,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:a.isPending,onCheckedChange:e=>a.mutate({liveTitleUpdates:e},{onSuccess:()=>V(e?`Live title updates on`:`Live title updates off`)})}),(0,X.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,X.jsx)(fg,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,children:(0,X.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,X.jsx)($p,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:a.isPending,onCheckedChange:e=>a.mutate({reviewGate:e},{onSuccess:()=>V(e?`Review gate on`:`Review gate off`)})}),(0,X.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,X.jsx)(fg,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:r.data?.info?(0,X.jsxs)(`select`,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:a.isPending,onChange:e=>a.mutate({baseBranch:e.target.value||null}),className:`block w-full max-w-md rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,X.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),r.data.branches.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))]}):(0,X.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:r.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]})}function dg({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let i=_n(),a=ye(),o=ce(),s=ut(),c=f(),l=o.projectId??`default`,d=s.data?.info?.root,p=d?i.data?.selections[d]:void 0,m=i.data?.defaults,h=Dh(i.data?.profiles??[]),g=Oh(h);return(0,X.jsxs)(fg,{title:g?`Default agent`:`Default runner`,hint:g?`Preselected for new tasks in THIS repo, and used by the chain planner. Each task can still pick another agent or account. The account is stored on this machine only — it is never committed, so a teammate keeps their own.`:`Preselected for new tasks in THIS repo, and used by the chain planner. Each task can still pick another runner.`,children:[(0,X.jsx)(kh,{rows:h,runner:e,accountFor:e=>p?.[e]??m?.[e]??null,providerStatus:t,disabled:n,accountDisabled:c.isPending||a.data===void 0,onPick:(t,n,i)=>{t!==e&&r(t),i&&c.mutate({projectId:l,provider:t,profileId:n},{onError:e=>V(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&u(t.data,e)?.enabled===!1?(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,g?(0,X.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function fg({title:e,hint:t,children:n}){return(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var pg=`cez-accent`,mg=`cez-density`,hg=`cez-width`,gg=`lime`,_g=`comfortable`,vg=`narrow`;function yg(e){return e===`lime`||e===`violet`?e:gg}function bg(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:_g}function xg(e){return e===`narrow`||e===`wide`?e:vg}function Sg(e){let t=e&&typeof e==`object`?e:{};return{accent:yg(t.accent),density:bg(t.density),width:xg(t.width)}}function Cg(){try{return{accent:yg(localStorage.getItem(pg)),density:bg(localStorage.getItem(mg)),width:xg(localStorage.getItem(hg))}}catch{return{accent:gg,density:_g,width:vg}}}function wg(e){try{localStorage.setItem(pg,e.accent),localStorage.setItem(mg,e.density),localStorage.setItem(hg,e.width)}catch{}}function Tg(e,t){t.accent===`lime`?delete e.dataset.accent:e.dataset.accent=t.accent,t.density===`comfortable`?delete e.dataset.density:e.dataset.density=t.density,t.width===`narrow`?delete e.dataset.width:e.dataset.width=t.width}var Eg=Y.createContext(null);function Dg({children:e}){let t=I(),n=qe(),[r,i]=Y.useState(Cg),a=n.data;Y.useEffect(()=>{if(a===void 0)return;let e=Sg(a.appearance);i(e),wg(e)},[a]),Y.useLayoutEffect(()=>{Tg(document.documentElement,r)},[r]);let o=Y.useCallback(e=>{i(e),wg(e),oe({appearance:e}).then(e=>t.setQueryData(c.uiState,e)).catch(e=>{V(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:c.uiState})})},[t]),s=Y.useCallback(e=>o({...r,accent:e}),[o,r]),l=Y.useCallback(e=>o({...r,density:e}),[o,r]),u=Y.useCallback(e=>o({...r,width:e}),[o,r]),d=Y.useMemo(()=>({accent:r.accent,density:r.density,width:r.width,setAccent:s,setDensity:l,setWidth:u}),[r,s,l,u]);return(0,X.jsx)(Eg.Provider,{value:d,children:e})}function Og(){let e=Y.useContext(Eg);if(!e)throw Error(`cezar: useAppearance() must be called inside <AppearanceProvider>`);return e}var kg=[{value:`system`,label:`System`,icon:hs},{value:`light`,label:`Light`,icon:Es},{value:`dark`,label:`Dark`,icon:gs}],Ag=[{value:`lime`,label:`Lime`,swatch:`var(--accent-lime)`},{value:`violet`,label:`Violet`,swatch:`var(--violet)`}],jg=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}],Mg=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function Ng({slot:e,label:t,value:n,options:r,onChange:i}){return(0,X.jsx)(`div`,{role:`radiogroup`,"aria-label":t,"data-slot":e,className:`inline-flex w-fit gap-0.5 rounded-md border border-border bg-card p-0.5`,children:r.map(e=>{let t=e.value===n;return(0,X.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,"data-value":e.value,onClick:()=>i(e.value),className:K(`flex items-center gap-2 rounded-sm px-3 py-1.5 text-[13px] font-medium transition-colors`,t?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,X.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function Pg({title:e,hint:t,children:n}){return(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function Fg(){let e=ye(),{order:t,canReorder:n,reset:r}=Su();return!((e.data?.projects.length??0)>1)||t.length===0?null:(0,X.jsx)(Pg,{title:`Project order`,hint:`The sidebar is in the order you dragged it into. Reset puts it back to most-recently-opened first. Shared with every browser signed in to this cezar.`,children:(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`appearance-project-order-reset`,disabled:!n,onClick:r,className:`w-fit`,children:`Reset order`})})}function Ig(){let e=Ue(),t=I(),n=(0,Y.useRef)(null),[r,i]=(0,Y.useState)(null);(0,Y.useEffect)(()=>()=>{r&&URL.revokeObjectURL(r.url)},[r]);let a=k({mutationFn:e=>j(e),onSuccess:e=>t.setQueryData(c.config,e),onError:e=>V(e.message,{tone:`danger`})}),o=k({mutationFn:async e=>e?pn(e):nn(),onSuccess:e=>{let n=t.getQueryData(c.config);n&&t.setQueryData(c.config,{...n,branding:{...n.branding,logoUrl:e}}),i(null)},onError:e=>V(e.message,{tone:`danger`})}),s=e.data?.branding,[l,u]=(0,Y.useState)(s?.name??`cezar`),[d,f]=(0,Y.useState)(s?.name??`cezar`);return(0,Y.useEffect)(()=>{s&&l===d&&(u(s.name),f(s.name))},[s?.name]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Pg,{title:`Instance name`,hint:`Shown in the sidebar and browser tab across this workspace.`,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`input`,{"data-slot":`branding-name`,"aria-label":`Instance name`,maxLength:80,value:l,onChange:e=>u(e.currentTarget.value),onBlur:()=>{let e=l.trim();if(!e){u(s?.name??`cezar`);return}e!==s?.name&&a.mutate({branding:{name:e}}),f(e)},className:`h-9 w-64 rounded-md border border-border bg-background px-3 text-sm`}),(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,disabled:!s||s.name===`cezar`||a.isPending,onClick:()=>a.mutate({branding:{name:null}}),children:`Reset name`})]})}),(0,X.jsx)(Pg,{title:`Logo`,hint:`PNG, JPEG, WebP, GIF, AVIF, or safe SVG up to 2 MB. Stored on this machine and shared by its browsers.`,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-lg border border-border bg-card p-3`,children:[r?(0,X.jsx)(`img`,{src:r.url,alt:`Logo preview`,className:`size-10 rounded-md border border-border bg-background object-contain p-1`}):s?.logoUrl?(0,X.jsx)(`img`,{src:s.logoUrl,alt:`Current instance logo`,className:`size-10 rounded-md border border-border bg-background object-contain p-1`}):(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-10 rounded-md border border-dashed border-border bg-background`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground`,children:r?.file.name??(s?.logoUrl?`Current logo`:`No logo selected`)}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Choose an image to preview it before saving.`})]}),(0,X.jsx)(`input`,{ref:n,"data-slot":`branding-logo`,"aria-label":`Upload logo`,type:`file`,accept:`image/png,image/jpeg,image/webp,image/gif,image/avif,image/svg+xml`,disabled:o.isPending,hidden:!0,onChange:e=>{let t=e.currentTarget.files?.[0];t&&i({file:t,url:URL.createObjectURL(t)}),e.currentTarget.value=``}}),(0,X.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,disabled:!s||o.isPending,onClick:()=>n.current?.click(),children:[(0,X.jsx)(ks,{"aria-hidden":`true`,className:`size-3.5`}),`Choose logo`]}),r?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{type:`button`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(r.file),children:`Save logo`}),(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>i(null),children:`Cancel`})]}):s?.logoUrl?(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(null),children:`Remove logo`}):null]})})]})}function Lg(){let{theme:e,setTheme:t}=fu(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:s}=Og();return(0,X.jsxs)(`div`,{"data-slot":`appearance-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(Ig,{}),(0,X.jsx)(Pg,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,X.jsx)(Ng,{slot:`appearance-theme`,label:`Theme`,value:e,options:kg,onChange:t})}),(0,X.jsx)(Pg,{title:`Accent`,hint:`The primary action color. Saved with this repo's cockpit state.`,children:(0,X.jsx)(Ng,{slot:`appearance-accent`,label:`Accent`,value:n,options:Ag,onChange:a})}),(0,X.jsx)(Pg,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,X.jsx)(Ng,{slot:`appearance-density`,label:`Density`,value:r,options:jg,onChange:o})}),(0,X.jsx)(Pg,{title:`Reading width`,hint:`Wide gives task sessions, commits, and skill content more room. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,children:(0,X.jsx)(Ng,{slot:`appearance-width`,label:`Reading width`,value:i,options:Mg,onChange:s})}),(0,X.jsx)(Fg,{})]})}function Rg(){let e=D();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`bookmarklets-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading bookmarklets…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(ia,{}),tone:`danger`,heading:`h2`,title:`Could not load bookmarklets`,subtitle:e.error.message}):(0,X.jsx)(`div`,{className:`flex min-h-full flex-1 overflow-y-auto px-4 py-5 md:px-7`,children:(0,X.jsx)(zg,{skills:Li(e.data??[])})})}function zg({skills:e}){let t=je(),n=Se(),r=ye(),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(``),c=t.data?.key??``,l=window.location.origin,u=Pt()??n.data?.bootProject??null,d=r.data?.projects.find(e=>e.id===u)?.name??mb(n.data)?.name??null,f=o.trim().toLowerCase(),p=e.filter(e=>e.name.toLowerCase().includes(f));return(0,X.jsxs)(`div`,{"data-slot":`bookmarklet-panel`,className:`mx-auto w-full max-w-2xl`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Run from GitHub`}),(0,X.jsxs)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:[`Drag a button below to your browser's bookmarks bar. On any GitHub PR or issue, click it to open this cockpit directly. The cockpit must be running: `,(0,X.jsx)(`span`,{className:`font-mono`,children:`npx cezar`}),`.`]}),(0,X.jsxs)(`label`,{className:`mt-4 flex items-center gap-2 text-[13px] font-medium`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-slot":`bm-auto`,checked:i,onChange:e=>a(e.target.checked),className:`size-3.5`}),`One-click launch (auto-submit)`,` `,(0,X.jsx)(`span`,{className:`font-normal text-soft-foreground`,children:`— re-drag the buttons after changing this`})]}),(0,X.jsx)(`div`,{"data-slot":`bm-generic`,className:`mt-4`,children:(0,X.jsx)(Am,{label:d?`cezar (${d}): this PR/issue`:`cezar: this PR/issue`,url:Mm(``,!1,c,l,u),hint:`prefills the form — nothing starts by itself`})}),(0,X.jsx)(Gl,{"data-slot":`bm-filter`,placeholder:`Filter skills…`,"aria-label":`Filter bookmarklet skills`,value:o,onChange:e=>s(e.target.value),className:`mt-5 h-8 text-[13px]`}),(0,X.jsx)(`div`,{"data-slot":`bm-list`,className:`mt-3 flex flex-col gap-2`,children:p.length>0?p.map(e=>(0,X.jsx)(Am,{label:d?`/${e.name} (${d})`:`/${e.name}`,url:Mm(e.name,i,c,l,u),hint:e.source},e.path)):(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:e.length>0?`(no skills match)`:`(no skills yet — the generic launcher above still works)`})})]})}function Bg(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function Vg(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function Hg(e,t){let n=new Map,r=[];for(let i of t??[]){n.set(i.id,i.status);let t=e.get(i.id);t===void 0||t===i.status||me(i)&&r.push(i)}return{entering:r,statuses:n}}function Ug(e){return e.enabled&&e.hidden&&e.permission===`granted`}function Wg(e){let t=d(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`}}function Gg(){let e=I(),t=qe(),[n,r]=Y.useState(!1),[i,a]=Y.useState(Vg),o=t.data;Y.useEffect(()=>{o!==void 0&&r(Bg(o.notifications).enabled)},[o]);let s=Y.useCallback(t=>{r(t),oe({notifications:{enabled:t}}).then(t=>e.setQueryData(c.uiState,t)).catch(t=>{V(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:c.uiState})})},[e]),l=Y.useCallback(e=>{if(!e){s(!1);return}if(Vg()!=="default"){s(!0);return}s(!0),Notification.requestPermission().then(e=>a(e)).catch(()=>a(Vg()))},[s]),u=i===`unsupported`;return(0,X.jsx)(`div`,{"data-slot":`notifications-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,X.jsx)(`label`,{htmlFor:`notifications-enabled`,children:`Notify when an agent needs you`})}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`A browser notification when a task starts waiting, asks for review, or fails — only while this tab is in the background. Off by default.`})]}),(0,X.jsx)($p,{id:`notifications-enabled`,"data-slot":`notifications-toggle`,checked:n,disabled:u,onCheckedChange:l})]}),u?(0,X.jsx)(`p`,{"data-slot":`notifications-unsupported`,className:`text-[13px] text-muted-foreground`,children:`This browser does not support notifications, so the toggle is unavailable here.`}):null,!u&&n&&i===`denied`?(0,X.jsx)(`p`,{"data-slot":`notifications-denied`,className:`text-[13px] text-danger`,children:`This browser is blocking notifications for the cockpit. The preference is saved, but nothing will be delivered here until you allow notifications in the browser's site settings.`}):null]})})}var Kg=400,qg=Symbol(`none`),Jg=e=>e===null?``:String(e);function Yg({value:e,min:t,max:n,onCommit:r,allowEmpty:i=!1,emptyStepFrom:a,placeholder:o,disabled:s,"aria-label":c,"data-slot":l,className:u}){let d=(0,Y.useId)(),[f,p]=(0,Y.useState)(()=>Jg(e)),m=(0,Y.useRef)(f),h=(0,Y.useRef)(null),g=(0,Y.useRef)(qg),_=(0,Y.useRef)({value:e,onCommit:r});_.current={value:e,onCommit:r};let v=e=>{m.current=e,p(e)};(0,Y.useEffect)(()=>{g.current=qg,h.current===null&&v(Jg(e))},[e]);let y=(0,Y.useRef)(()=>{});(0,Y.useEffect)(()=>()=>{h.current!==null&&y.current()},[]);let b=e=>{let r=e.trim();if(r===``)return i?null:`invalid`;if(!/^-?\d+$/.test(r))return`invalid`;let a=Number(r);return a<t||a>n?`invalid`:a},x=b(f),S=x===`invalid`,C=()=>{h.current!==null&&(clearTimeout(h.current),h.current=null);let{value:e,onCommit:t}=_.current,n=b(m.current);if(n===`invalid`||n===e||g.current!==qg&&n===g.current)return;let r=t(n);r instanceof Promise&&(g.current=n,r.catch(()=>{g.current===n&&(g.current=qg),v(Jg(_.current.value))}))};y.current=C;let w=e=>{let r=b(m.current),i=r===null?a??t:r===`invalid`?(_.current.value??a??t)+e:r+e;v(String(Math.min(n,Math.max(t,i)))),h.current!==null&&clearTimeout(h.current),h.current=setTimeout(C,Kg)},T=t=>{t.key===`ArrowUp`||t.key===`ArrowDown`?(t.preventDefault(),w(t.key===`ArrowUp`?1:-1)):t.key===`Enter`?(t.preventDefault(),C()):t.key===`Escape`&&(h.current!==null&&clearTimeout(h.current),h.current=null,v(Jg(e)))},E=typeof x==`number`?x:null,D=`flex h-1/2 w-6 items-center justify-center text-soft-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-40`;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`div`,{className:K(`flex w-28 items-stretch overflow-hidden rounded-md border border-input bg-card shadow-xs focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50`,S&&`border-danger`,s&&`opacity-50`,u),children:[(0,X.jsx)(`input`,{type:`text`,inputMode:`numeric`,role:`spinbutton`,"aria-label":c,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":E??void 0,"aria-invalid":S||void 0,"aria-describedby":S?d:void 0,"data-slot":l,value:f,placeholder:o,disabled:s,onChange:e=>v(e.target.value),onBlur:C,onKeyDown:T,className:`min-w-0 flex-1 bg-transparent px-3 py-1.5 text-sm outline-none placeholder:text-soft-foreground`}),(0,X.jsxs)(`div`,{className:`flex flex-col border-l border-input`,children:[(0,X.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Increase ${c}`,"data-action":`stepper-increment`,disabled:s||E!==null&&E>=n,onMouseDown:e=>e.preventDefault(),onClick:()=>w(1),className:D,children:(0,X.jsx)(Ho,{className:`size-3.5`})}),(0,X.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Decrease ${c}`,"data-action":`stepper-decrement`,disabled:s||E!==null&&E<=t,onMouseDown:e=>e.preventDefault(),onClick:()=>w(-1),className:K(D,`border-t border-input`),children:(0,X.jsx)(si,{className:`size-3.5`})})]})]}),S?(0,X.jsxs)(`p`,{id:d,"data-slot":`stepper-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,t,` to `,n,i?`, or leave it empty`:``,`.`]}):null]})}function Xg(){let e=Lt();return{isPending:e.isPending,confirm:(t,n)=>e.mutate(t.id,{onSuccess:()=>{V(`${t.name} removed from the workspace — its files are untouched`),n?.()},onError:e=>V(e.message,{tone:`danger`})})}}function Zg({project:e,onOpenChange:t,onConfirm:n}){return(0,X.jsx)(Ga,{open:e!==null,onOpenChange:t,children:(0,X.jsxs)(Ba,{children:[(0,X.jsxs)(Wa,{children:[(0,X.jsxs)(za,{children:[`Remove `,e?.name,` from the workspace?`]}),(0,X.jsxs)(Ra,{children:[`This only unregisters the project — `,(0,X.jsx)(`strong`,{children:`nothing on disk is deleted`}),`. The folder, its git history and its task history all stay exactly where they are, and adding it back later finds everything intact.`,(0,X.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[11px] text-foreground`,title:e?.root,children:e?.root})]})]}),(0,X.jsxs)(Ha,{children:[(0,X.jsx)(Ua,{children:`Keep it`}),(0,X.jsx)(Va,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:n,children:`Remove from list`})]})]})})}function Qg({title:e,hint:t,children:n}){return(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var $g=1,e_=16,t_={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function n_(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function r_(){let e=Ue(),t=ye();return e.isPending||t.isPending?(0,X.jsx)(`p`,{"data-slot":`projects-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading projects…`}):e.isError||t.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(ts,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,X.jsx)(i_,{config:e.data,registry:t.data})}function i_({config:e,registry:t}){return(0,X.jsxs)(`div`,{"data-slot":`projects-section`,className:`mx-auto flex w-full max-w-4xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(a_,{configKey:`browseRoot`,value:e.browseRoot,title:`Default browse folder`,hint:`Where “Open local folder…” starts. The picker cannot navigate above this folder.`,placeholder:`~/`,slot:`browse`,savedLabel:`Browse folder`,footer:`Only affects folder browsing; GitHub checkouts use the separate checkout folder.`}),(0,X.jsx)(a_,{configKey:`projectsDir`,value:e.projectsDir,title:`Default checkout folder`,hint:`Where “Clone from GitHub” puts new projects: <folder>/<project name>.`,placeholder:`~/cezar/projects`,slot:`checkout`,savedLabel:`Checkout folder`,footer:`Only affects new checkouts; projects already registered keep their location.`,refreshProjects:!0}),(0,X.jsx)(o_,{registry:t,workspaceMax:e.resources.maxParallel})]})}function a_({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,savedLabel:o,footer:s,refreshProjects:l=!1}){let u=I(),d=k({mutationFn:t=>j(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{u.setQueryData(c.config,t),e===`browseRoot`?u.invalidateQueries({queryKey:c.fsBrowseRoot}):l&&u.invalidateQueries({queryKey:c.projects})}}),[f,p]=(0,Y.useState)(t),m=f.trim(),h=m===t,g=d.isError?d.error.message:null;return(0,X.jsxs)(Qg,{title:n,hint:`${r} ${e===`browseRoot`?`Choose an existing folder; it is verified writable before saving.`:`The folder is created recursively if needed, then verified writable before saving.`}`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,"aria-label":n,"aria-invalid":g!==null,"data-slot":`projects-${a}-root`,value:f,disabled:d.isPending,placeholder:i,onChange:e=>{p(e.target.value),d.isError&&d.reset()},className:`block w-full max-w-sm rounded-md border border-input bg-card px-3 py-1.5 font-mono text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-danger disabled:opacity-50`}),(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,"data-action":`projects-save-${a}-root`,disabled:h||m===``||d.isPending,onClick:()=>d.mutate(m,{onSuccess:()=>V(`${o} set to ${m}`)}),children:`Save`})]}),g===null?(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:s}):(0,X.jsxs)(`p`,{"data-slot":`projects-${a}-root-error`,role:`alert`,className:`text-[11px] text-danger`,children:[g,` — setting unchanged`]})]})}function o_({registry:e,workspaceMax:t}){let[n,r]=(0,Y.useState)(null),i=Xg(),a=(0,Y.useMemo)(()=>Bt(e.projects),[e.projects]);return(0,X.jsxs)(Qg,{title:`Registered projects`,hint:`The folders you have added. While this list is empty the folder cezar is serving is listed as “not registered” with an Add button; once you have projects, starting cezar somewhere new neither registers nor lists that folder — use “Add project” when you want to keep it. “Tags” group connected repositories — give the API, the web app and the design system a shared “storefront” tag and the global Tasks page can show all three as one piece of work. “Max parallel” caps how many of that project's tasks run at once (leave it empty to inherit the workspace limit); the workspace limit (${t}) still applies as an overall ceiling, so a per-project value above it has no extra effect until the workspace limit is raised. Removing a project only unregisters it — no files on disk are deleted.`,children:[e.projects.length===0?(0,X.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}):(0,X.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,X.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,X.jsx)(`caption`,{className:`sr-only`,children:`Projects in this workspace`}),(0,X.jsxs)(`colgroup`,{children:[(0,X.jsx)(`col`,{}),(0,X.jsx)(`col`,{style:{width:`104px`}}),(0,X.jsx)(`col`,{style:{width:`260px`}}),(0,X.jsx)(`col`,{style:{width:`150px`}}),(0,X.jsx)(`col`,{style:{width:`72px`}}),(0,X.jsx)(`col`,{style:{width:`92px`}})]}),(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Project`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Tags`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Max parallel`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Added`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,X.jsx)(`tbody`,{children:e.projects.map(n=>(0,X.jsx)(s_,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,vocabulary:a,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,X.jsx)(Zg,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{if(!n)return;let e=n;r(null),i.confirm(e)}})]})}function s_({project:e,isBoot:t,workspaceMax:n,vocabulary:r,disabled:i,onRemove:a}){return(0,X.jsxs)(`tr`,{"data-slot":`project-row`,"data-project":e.id,className:`border-b border-border last:border-0`,children:[(0,X.jsxs)(`th`,{scope:`row`,className:`max-w-0 px-3 py-2 text-left font-normal`,children:[(0,X.jsx)(`span`,{className:`block truncate text-foreground`,children:e.name}),(0,X.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,title:e.root,children:e.root})]}),(0,X.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,X.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-[12px] text-danger`:`text-[12px] text-soft-foreground`,children:t_[e.status]}),e.unregistered?(0,X.jsx)(`span`,{"data-slot":`project-unregistered`,className:`ml-1 text-[11px] text-soft-foreground`,children:`· not registered`}):e.status===`missing`?null:(0,X.jsxs)(`span`,{className:`ml-1 text-[11px] text-soft-foreground`,children:[`· `,e.source]})]}),(0,X.jsx)(`td`,{className:`px-3 py-2`,children:e.unregistered?(0,X.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`—`}):(0,X.jsx)(l_,{project:e,vocabulary:r})}),(0,X.jsx)(`td`,{className:`px-3 py-2`,children:e.unregistered?(0,X.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`—`}):(0,X.jsx)(u_,{project:e,workspaceMax:n})}),(0,X.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:e.unregistered?`—`:n_(e.addedAt)}),(0,X.jsx)(`td`,{className:`px-3 py-2 text-right`,children:e.unregistered?(0,X.jsx)(c_,{root:e.root,name:e.name,disabled:i}):(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`project-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:t?"cezar is serving this project — stop it and use `cezar projects remove`":void 0,disabled:i||t,onClick:a,children:`Remove`})})]})}function c_({root:e,name:t,disabled:n=!1}){let r=rn();return(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-add-boot`,"aria-label":`Add ${t} to your projects`,title:`cezar is serving this folder — save it to your projects`,disabled:n||r.isPending,onClick:()=>r.mutate(e,{onSuccess:()=>V(`${t} added to your projects`),onError:e=>V(e.message,{tone:`danger`})}),children:`Add project`})}function l_({project:e,vocabulary:t}){let n=se(),[r,i]=(0,Y.useState)(``),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(-1),l=(0,Y.useRef)(null),u=e.tags??[],d=Zt(t,u,r),f=a&&d.length>0,p=(t,r)=>{n.mutate({id:e.id,tags:t},{onSuccess:()=>V(r),onError:e=>V(e.message,{tone:`danger`})})},m=t=>{let n=t.trim().slice(0,32);if(c(-1),n){if(u.some(e=>e.toLowerCase()===n.toLowerCase())){i(``);return}if(u.length>=20){V(`${e.name} already has the maximum of 20 tags`,{tone:`danger`});return}i(``),p([...u,n],`${e.name} tagged \u201c${n}\u201d`)}},h=t=>{p(u.filter(e=>e!==t),`\u201c${t}\u201d removed from ${e.name}`)},g=`project-tag-suggestions-${e.id}`;return(0,X.jsxs)(`div`,{"data-slot":`project-tags`,className:`flex flex-wrap items-center gap-1`,children:[u.map(t=>(0,X.jsxs)(`span`,{"data-slot":`project-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full bg-violet/15 py-px pr-1 pl-2 text-[11px] font-medium whitespace-nowrap text-violet`,children:[t,(0,X.jsx)(`button`,{type:`button`,"data-action":`project-tag-remove`,"aria-label":`Remove tag ${t} from ${e.name}`,disabled:n.isPending,onClick:()=>h(t),className:`rounded-full p-0.5 hover:bg-violet/25 disabled:opacity-50`,children:(0,X.jsx)(Ea,{className:`size-3`,"aria-hidden":`true`})})]},t)),(0,X.jsxs)(li,{open:f,onOpenChange:o,children:[(0,X.jsx)(ai,{asChild:!0,children:(0,X.jsx)(`input`,{ref:l,type:`text`,"data-slot":`project-tag-input`,"aria-label":`Add a tag to ${e.name}`,role:`combobox`,"aria-expanded":f,"aria-controls":f?g:void 0,"aria-autocomplete":`list`,"aria-activedescendant":f&&s>=0?`${g}-${s}`:void 0,placeholder:u.length===0?`Add tag…`:`+`,value:r,maxLength:32,disabled:n.isPending,onFocus:()=>o(!0),onBlur:()=>o(!1),onChange:e=>{if(o(!0),c(-1),e.target.value.includes(`,`)){i(e.target.value.replace(/,/g,``));return}i(e.target.value)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(d.length===0)return;e.preventDefault(),o(!0);let t=e.key===`ArrowDown`?1:-1,n=s+t;c(n>=d.length?-1:n<-1?d.length-1:n);return}if(e.key===`Escape`&&f){e.preventDefault(),o(!1),c(-1);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),m(s>=0?d[s]??r:r);return}if(e.key===`Tab`){o(!1);return}if(e.key===`Backspace`&&r===``&&u.length>0){e.preventDefault();let t=u[u.length-1];t!==void 0&&h(t)}},className:`h-6 w-16 min-w-0 flex-1 rounded-md border border-input bg-card px-1.5 text-[12px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})}),(0,X.jsxs)(ti,{align:`start`,sideOffset:4,id:g,role:`listbox`,"data-slot":`project-tag-suggestions`,className:`w-56 p-1`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,X.jsx)(`p`,{className:`px-2 pt-1 pb-1.5 text-[10.5px] text-soft-foreground`,children:`Tags used in this workspace`}),d.map((e,t)=>(0,X.jsx)(`button`,{type:`button`,id:`${g}-${t}`,role:`option`,"aria-selected":t===s,"data-slot":`project-tag-suggestion`,onMouseDown:e=>e.preventDefault(),onClick:()=>{m(e),l.current?.focus()},onMouseEnter:()=>c(t),className:K(`flex w-full items-center rounded-sm px-2 py-1 text-left text-[12px] font-medium text-violet`,t===s&&`bg-muted`),children:e},e))]})]})]})}function u_({project:e,workspaceMax:t}){let n=se();return(0,X.jsx)(Yg,{"aria-label":`Max parallel tasks for ${e.name}`,"data-slot":`project-max-parallel`,value:e.maxParallel??null,min:$g,max:e_,allowEmpty:!0,emptyStepFrom:Math.min(e_,Math.max($g,t)),placeholder:`Inherit (${t})`,className:`w-40`,onCommit:r=>n.mutateAsync({id:e.id,maxParallel:r},{onSuccess:()=>V(r===null?`${e.name} inherits the workspace limit (${t})`:`${e.name} runs at most ${r} task${r===1?``:`s`} at a time`),onError:e=>V(e.message,{tone:`danger`})})})}function d_(){let e=Le();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`prompt-templates-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading prompt templates…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(_s,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(f_,{initial:xi(e.data.promptTemplates)})}function f_({initial:e}){let t=I(),n=D(),r=Le(),[i,a]=(0,Y.useState)(e),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(``),u=k({mutationFn:e=>Ie({promptTemplates:e}),onSuccess:e=>{t.setQueryData(B.uiState,e),V(`Prompt templates saved`)},onError:e=>V(e.message,{tone:`danger`})}),d=JSON.stringify(i)!==JSON.stringify(e),f=i.some(e=>e.label.trim()===``||e.text.trim()===``),p=(e,t)=>a(n=>n.map(n=>n.id===e?{...n,...t}:n)),m=(e,t)=>a(n=>n.map(n=>{if(n.id!==e)return n;let r=n.skills??[],i=r.includes(t)?r.filter(e=>e!==t):[...r,t],{skills:a,...o}=n;return i.length>0?{...o,skills:i}:o})),h=e=>a(t=>t.filter(t=>t.id!==e));return(0,X.jsx)(`div`,{"data-slot":`prompt-templates-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,X.jsxs)(m_,{title:`Prompt templates`,hint:`Reusable snippets you can insert into a prompt — the new-task composer, the GitHub hand-over, and the Inbox's “Add instructions” box all offer this list. Assign a template to a skill and it fills the prompt in for you when you pick that skill, as long as you have not typed anything yet.`,children:[(0,X.jsx)(`div`,{"data-slot":`prompt-template-list`,className:`flex flex-col gap-3`,children:i.length===0?(0,X.jsx)(`p`,{"data-slot":`prompt-templates-empty`,className:`text-[13px] text-soft-foreground`,children:`No templates. Add one below, or reset to the built-ins.`}):i.map(e=>(0,X.jsxs)(`div`,{"data-slot":`prompt-template-row`,"data-template":e.id,className:`flex flex-col gap-1.5 rounded-md border border-border bg-card p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Gl,{"aria-label":`Label for ${e.label||`this template`}`,"data-slot":`prompt-template-label-input`,value:e.label,maxLength:80,onChange:t=>p(e.id,{label:t.target.value}),className:`flex-1`}),(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>h(e.id),children:(0,X.jsx)(Ea,{"aria-hidden":`true`,className:`size-3.5`})})]}),(0,X.jsx)($a,{"aria-label":`Text for ${e.label||`this template`}`,"data-slot":`prompt-template-text-input`,value:e.text,maxLength:Mi,onChange:t=>p(e.id,{text:t.target.value}),className:`min-h-14 text-[13px]`}),(0,X.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(p_,{label:e.label,skills:n.data??[],skillUsage:r.data?.skillUsage,selected:e.skills??[],onToggle:t=>m(e.id,t)}),(e.skills??[]).map(t=>(0,X.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skill-chip`,"data-skill":t,title:`Stop applying “${e.label}” automatically with ${t}`,onClick:()=>m(e.id,t),className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[t,(0,X.jsx)(Ea,{"aria-hidden":`true`,className:`size-3`})]},t))]})]},e.id))}),(0,X.jsxs)(`div`,{"data-slot":`prompt-template-new`,className:`flex flex-col gap-1.5 rounded-md border border-dashed border-border p-3`,children:[(0,X.jsx)(Gl,{"aria-label":`New template label`,"data-slot":`prompt-template-new-label`,placeholder:`Label (e.g. "Add tests")`,value:o,maxLength:80,onChange:e=>s(e.target.value)}),(0,X.jsx)($a,{"aria-label":`New template text`,"data-slot":`prompt-template-new-text`,placeholder:`The instructions to insert…`,value:c,maxLength:Mi,onChange:e=>l(e.target.value),className:`min-h-14 text-[13px]`}),(0,X.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,"data-action":`prompt-template-add`,disabled:!o.trim()||!c.trim(),onClick:()=>{let e=o.trim(),t=c.trim();!e||!t||(a(n=>[...n,{id:Ni(),label:e,text:t}]),s(``),l(``))},className:`self-start`,children:[(0,X.jsx)(bs,{"aria-hidden":`true`,className:`size-3.5`}),`Add template`]})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(q,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`prompt-templates-save`,disabled:!d||f||u.isPending,onClick:()=>u.mutate(i),children:`Save`}),(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:u.isPending,onClick:()=>a(ki.map(e=>({...e}))),children:`Reset to defaults`}),f?(0,X.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-[11px] text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function p_({label:e,skills:t,skillUsage:n,selected:r,onToggle:i}){let[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(``),l=(0,Y.useRef)(null),{mostUsed:u,project:d,global:f}=mi(hi(t,s,n),n),p=(e,t)=>{let n=r.includes(e.name);return(0,X.jsxs)(Ca,{value:`skill ${e.name} ${e.path}`,keywords:di(e.name,e.description),"data-slot":`prompt-template-skill-option`,"data-skill":e.name,"data-selected":n?`true`:void 0,onSelect:()=>i(e.name),children:[(0,X.jsx)(`span`,{className:K(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,n?(0,X.jsx)(Hi,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.path)};return(0,X.jsxs)(li,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,X.jsx)(ci,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skills-trigger`,"aria-label":`Apply ${e||`this template`} automatically with a skill`,title:`Pick the skills this template applies itself to`,disabled:t.length===0,className:K(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,r.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,X.jsx)(ei,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),t.length===0?`no skills found`:`apply with…`,(0,X.jsx)(si,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,X.jsx)(ti,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(ya,{shouldFilter:!1,children:[(0,X.jsx)(ba,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>l.current?.scrollTo(0,0)}),(0,X.jsxs)(da,{ref:l,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[u.length===0&&d.length===0&&f.length===0?(0,X.jsx)(ga,{children:`Nothing matches.`}):null,u.length>0?(0,X.jsx)(ua,{heading:`Most used`,children:u.map(e=>p(e,gi(e)))}):null,d.length>0?(0,X.jsx)(ua,{heading:`Project skills`,children:d.map(e=>p(e,!0))}):null,f.length>0?(0,X.jsx)(ua,{heading:`Global`,children:f.map(e=>p(e,!1))}):null]})]})})]})}function m_({title:e,hint:t,children:n}){return(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var h_=30,g_=100,__=32,v_=60,y_=85,b_=e=>Math.min(100,Math.max(0,e));function x_(){Fo({enabled:!ho()});let e=bo(),t=jo(),{isError:n}=Io(),r=Oo(),i=ko(),a=Mo(),o=r===void 0?void 0:fo(r),s=o?.cpuPct,c=e===`local`,l=o?.memTotalBytes??0,u=o?.memUsedBytes!==void 0&&l>0?b_(o.memUsedBytes/l*100):0,d=s===void 0?void 0:s>y_?`bg-danger`:s>=v_?`bg-pending`:`bg-primary`,f=s===void 0?void 0:b_(s),p=i.length>=2?i.map((e,t)=>{let n=t/(h_-1)*g_,r=__-b_(e.cpuPct)/100*__;return`${n.toFixed(1)},${r.toFixed(1)}`}).join(` `):void 0,m=o===void 0||!o.cpuLimited?s===void 0?`sampling…`:`${Math.round(s)}%`:s===void 0?`—`:`${Math.round(s)}%`,h=o===void 0||!o.cpuLimited?void 0:`${o.cpuLimitKind===`cpuset`?`cpuset `:``}${po(o.cpuCores)}`,g=o===void 0?void 0:`${o.memUsedBytes===void 0?`—`:It(o.memUsedBytes)} / ${It(o.memTotalBytes)}`;return(0,X.jsxs)(`section`,{"data-slot":`machine-card`,"aria-labelledby":`machine-card-title`,className:`rounded-xl border border-border bg-card/60 p-4`,children:[(0,X.jsxs)(`header`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(Ka,{tone:c?`success`:`neutral`,pulse:c}),(0,X.jsx)(`h2`,{id:`machine-card-title`,className:`text-sm font-semibold`,children:`Machine`}),(0,X.jsx)(`span`,{"data-slot":`machine-card-mode`,className:`text-[11px] text-soft-foreground`,children:c?`live`:`last known`}),(0,X.jsx)(`span`,{"data-slot":`machine-card-freshness`,className:`ml-auto shrink-0 text-[11px] tabular-nums text-soft-foreground`,children:a===void 0?`waiting…`:`updated ${a} s ago`})]}),o?.hasContainer===!0?(0,X.jsxs)(`p`,{"data-slot":`machine-card-limits`,className:`mt-2 text-[11.5px] text-soft-foreground`,children:[`cgroup limits detected · `,o.source]}):null,t?(0,X.jsx)(`p`,{"data-slot":`machine-card-transport`,className:`mt-2 text-[11.5px] text-soft-foreground`,children:`The server refused this origin's host topic, so live values are polled from the authenticated route instead.`}):null,n&&r===void 0?(0,X.jsx)(`p`,{"data-slot":`machine-card-error`,className:`mt-3 text-[12.5px] text-soft-foreground`,children:`Host totals are unavailable right now.`}):null,(0,X.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,X.jsxs)(`div`,{"data-slot":`machine-card-cpu`,className:`grid grid-cols-[86px_1fr] items-start gap-3`,children:[(0,X.jsxs)(`span`,{className:`pt-0.5 text-[12.5px] text-soft-foreground`,children:[`CPU`,o?.cpuIsEffective===!0?` (effective)`:``]}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`span`,{"data-slot":`machine-card-cpu-value`,className:`w-32 shrink-0 text-[13px] tabular-nums`,children:h===void 0?m:`${h} · ${m}`}),(0,X.jsx)(`div`,{className:`h-2 min-w-0 flex-1 overflow-hidden rounded-full bg-muted`,children:d===void 0||f===void 0?null:(0,X.jsx)(`div`,{"data-slot":`machine-card-cpu-bar`,className:K(`h-full rounded-full`,d),style:{width:`${f}%`}})})]}),p===void 0?null:(0,X.jsx)(`svg`,{"data-slot":`machine-card-cpu-sparkline`,className:`mt-1.5 h-8 w-full text-primary`,viewBox:`0 0 ${g_} ${__}`,preserveAspectRatio:`none`,role:`img`,"aria-label":`CPU over the last up to ${i.length*2} seconds`,children:(0,X.jsx)(`polyline`,{points:p,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,vectorEffect:`non-scaling-stroke`})})]})]}),o===void 0?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{"data-slot":`machine-card-memory`,className:`grid grid-cols-[86px_1fr] items-center gap-3`,children:[(0,X.jsxs)(`span`,{className:`text-[12.5px] text-soft-foreground`,children:[`Memory`,o.memIsEffective?` (effective)`:``]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,X.jsx)(`span`,{"data-slot":`machine-card-memory-value`,className:`w-32 shrink-0 text-[13px] tabular-nums`,children:g}),(0,X.jsx)(`div`,{className:`h-2 min-w-0 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,X.jsx)(`div`,{className:`h-full rounded-full bg-primary`,style:{width:`${u}%`}})})]})]}),typeof r?.swapTotalBytes==`number`&&typeof r?.swapUsedBytes==`number`?(0,X.jsxs)(`div`,{"data-slot":`machine-card-swap`,className:`grid grid-cols-[86px_1fr] items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`text-[12.5px] text-soft-foreground`,children:`Swap`}),(0,X.jsxs)(`span`,{className:`text-[13px] tabular-nums`,children:[It(r.swapUsedBytes),` / `,It(r.swapTotalBytes)]})]}):null,r?.loadAvg===void 0?null:(0,X.jsxs)(`div`,{"data-slot":`machine-card-load`,className:`grid grid-cols-[86px_1fr] items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`text-[12.5px] text-soft-foreground`,children:`Load average`}),(0,X.jsxs)(`span`,{className:`flex items-center gap-2 text-[13px] tabular-nums`,children:[r.loadAvg.one.toFixed(2),` · `,r.loadAvg.five.toFixed(2),` ·`,` `,r.loadAvg.fifteen.toFixed(2),(0,X.jsx)(`span`,{"data-slot":`machine-card-load-cores`,className:`rounded-md border border-border px-1.5 py-0.5 text-[11px] text-soft-foreground`,children:o.hasContainer&&o.hostCpuCount!==void 0?`host ${o.hostCpuCount} cores`:`${r.cpuCount} cores`})]})]}),o.hasContainer&&o.hostCpuCount!==void 0?(0,X.jsxs)(`p`,{"data-slot":`machine-card-host-context`,className:`text-[11.5px] tabular-nums text-soft-foreground`,children:[`host `,po(o.hostCpuCount),` · `,It(r?.memTotalBytes??0),` RAM`]}):null]})]}),(0,X.jsx)(`p`,{"data-slot":`machine-card-caveat`,className:`mt-3 border-t border-border pt-2 text-[11px] text-soft-foreground`,children:o?.hasContainer===!0?`Effective values come from this process’s own cgroup; host totals are labelled.`:o?.cgroupUnknown===!0?`No cgroup information available for this process - host totals only.`:`Host totals - no cgroup limit tighter than the host detected for this process.`})]})}var S_=1,C_=16,w_=16,T_=1440,E_=1,D_=60,O_=256;function k_(){let e=Ue();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(ns,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(A_,{config:e.data})}function A_({config:e}){let t=I(),n=k({mutationFn:e=>j(e),onSuccess:e=>t.setQueryData(c.config,e),onError:e=>V(e.message,{tone:`danger`})}),[r,i]=(0,Y.useState)(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),a=e.resources.monitoringWakeIntervalMinutes??null,[o,s]=(0,Y.useState)(a===null?`park`:`interval`),[l,u]=(0,Y.useState)(String(a??5)),d=Number(l),f=!Number.isInteger(d)||d<E_||d>D_,p=o===`park`?a===null:!f&&a===d,m=()=>n.mutate({resources:{monitoringWakeIntervalMinutes:o===`park`?null:d}},{onSuccess:()=>V(o===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${d} minutes`)}),h=e.resources.autoResumeOnUsageLimit??!0,g=e=>n.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>V(e?`Tasks stopped by a usage limit will resume themselves`:`Tasks stopped by a usage limit will stay failed`)}),_=r.trim()===``?0:Number(r),v=r.trim()!==``&&(!Number.isInteger(_)||_<O_),y=(e.resources.memoryLimitMb??0)===(v?-1:_),b=()=>n.mutate({resources:{memoryLimitMb:_===0?null:_}},{onSuccess:()=>V(_===0?`Memory limit cleared`:`Memory limit set to ${_} MiB`)}),x=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0},S=(e,t)=>n.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}});return(0,X.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(x_,{}),(0,X.jsxs)(Qg,{title:`Max parallel tasks`,hint:`How many tasks run at once across every project. The rest wait in the queue. A non-git directory always runs one at a time.`,children:[(0,X.jsx)(Yg,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e.resources.maxParallel,min:S_,max:C_,onCommit:e=>n.mutateAsync({resources:{maxParallel:e??S_}})}),(0,X.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Need a different limit for one project?`,` `,(0,X.jsx)(pe,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Configure per-project limits`}),`.`]})]}),(0,X.jsxs)(Qg,{title:`Waiting-session idle timeout`,hint:`How long a plain waiting session may stay open without activity before its live backend session ends. Continue resumes it; set 0 to keep it open indefinitely.`,children:[(0,X.jsx)(Yg,{"aria-label":`Waiting-session idle timeout`,"data-slot":`resources-idle-timeout`,value:e.resources.idleTimeoutMinutes??0,min:0,max:T_,onCommit:e=>n.mutateAsync({resources:{idleTimeoutMinutes:e??0}})}),(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Minutes; 0 keeps plain waiting sessions alive. Monitoring sessions are already exempt.`})]}),(0,X.jsxs)(Qg,{title:`Extra monitoring sessions`,hint:`How many agent sessions may wait on CI, sub-agents, or monitored commands without using an active task slot. Extra sessions stay alive but pause the queue.`,children:[(0,X.jsx)(Yg,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:e.resources.maxMonitoringSessions??2,min:0,max:w_,onCommit:e=>n.mutateAsync({resources:{maxMonitoringSessions:e??0}})}),(0,X.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Capacity: `,e.resources.maxParallel,` active + `,e.resources.maxMonitoringSessions??2,` monitoring. Set 0 to make monitoring share active slots.`]})]}),(0,X.jsxs)(Qg,{title:`Monitoring wake-up`,hint:`Park uses no model turns. Re-check sends the same agent a follow-up on this cadence until work completes or the 40-wakeup safety cap is reached.`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`select`,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,value:o,disabled:n.isPending,onChange:e=>s(e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,X.jsx)(`option`,{value:`park`,children:`Park until resumed`}),(0,X.jsx)(`option`,{value:`interval`,children:`Re-check on an interval`})]}),o===`interval`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`number`,min:E_,max:D_,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:l,disabled:n.isPending,onChange:e=>u(e.target.value),className:`block w-24 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`minutes`})]}):null,(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-monitoring-wake`,disabled:p||o===`interval`&&f||n.isPending,onClick:m,children:`Save`})]}),o===`interval`&&f?(0,X.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-[11px] text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applied consistently to Claude, Codex and OpenCode.`})]}),(0,X.jsxs)(Qg,{title:`Auto-resume after a usage limit`,hint:`When an agent stops because its provider usage limit is reached, cezar waits for the reset the provider named and continues the task 30 seconds later — up to 12 times in a row without you. Off leaves the task failed with its Continue button.`,children:[(0,X.jsxs)(`select`,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,value:h?`on`:`off`,disabled:n.isPending,onChange:e=>g(e.target.value===`on`),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,X.jsx)(`option`,{value:`on`,children:`On`}),(0,X.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to Claude, Codex and OpenCode — whenever the provider says when the limit lifts.`})]}),(0,X.jsxs)(Qg,{title:`Per-task memory limit`,hint:`When a task's whole process tree crosses this, the engine pauses it with a warning and starts the next queued task. Leave empty for no limit.`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:O_,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:r,disabled:n.isPending,placeholder:`no limit`,onChange:e=>i(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`MiB`}),(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-memory`,disabled:y||v||n.isPending,onClick:b,children:`Save`})]}),v?(0,X.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number of at least `,O_,` MiB, or leave empty for no limit.`]}):(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to newly started tasks.`})]}),(0,X.jsxs)(Qg,{title:`New task defaults`,hint:`Set stable composer defaults across projects. Explicit choices and run-shape constraints still win.`,children:[(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Autonomous by default`}),(0,X.jsxs)(`select`,{"aria-label":`Autonomous by default`,value:x.autonomous===null?`inherit`:x.autonomous?`on`:`off`,disabled:n.isPending,onChange:e=>S(`autonomous`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,X.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,X.jsx)(`option`,{value:`on`,children:`On`}),(0,X.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,X.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,x.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:x.inheritedAutonomous?`On`:`Off`]})]}),(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Use a worktree by default`}),(0,X.jsxs)(`select`,{"aria-label":`Use a worktree by default`,value:x.worktree===null?`inherit`:x.worktree?`on`:`off`,disabled:n.isPending,onChange:e=>S(`worktree`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,X.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,X.jsx)(`option`,{value:`on`,children:`On`}),(0,X.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,X.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,x.inheritedWorktree?`On`:`Off`]})]})]}),(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated.`})]})]})}function j_(){let e=Ue();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`skills-settings-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading skill settings…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(vs,{}),tone:`danger`,title:`Skill settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(M_,{config:e.data})}function M_({config:e}){let t=I(),n=k({mutationFn:e=>j(e),onSuccess:e=>t.setQueryData(c.config,e),onError:e=>V(e.message,{tone:`danger`})}),r=e.skillsAutoUpdate===null;return(0,X.jsx)(`div`,{"data-slot":`skills-settings-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,X.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,X.jsx)(`label`,{htmlFor:`skills-auto-update`,children:`Update Open Mercato skills automatically`})}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Checks installed Open Mercato skills in the background and applies available updates. Other skills and untracked folders are never changed.`})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,X.jsx)($p,{id:`skills-auto-update`,"data-slot":`skills-auto-update`,checked:e.effectiveSkillsAutoUpdate,disabled:n.isPending,onCheckedChange:e=>n.mutate({skillsAutoUpdate:e})}),(0,X.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[e.effectiveSkillsAutoUpdate?`On`:`Off`,r?` (default)`:``]})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:r?`No override is saved. CEZ_SKILLS_AUTO_UPDATE supplies the inherited default when set; otherwise it is on.`:`An explicit workspace override is saved.`}),(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`skills-use-default`,disabled:r||n.isPending,onClick:()=>n.mutate({skillsAutoUpdate:null}),children:`Use default`})]})]})})}function N_(){let e=xe(),t=I(),[n,r]=(0,Y.useState)(null),i=()=>t.invalidateQueries({queryKey:B.worktrees}),a=k({mutationFn:()=>re(),onSuccess:e=>{i(),V(e.reclaimed.length===0?`Nothing to reclaim — all worktrees are within the limit`:`Reclaimed ${e.reclaimed.length} worktree${e.reclaimed.length===1?``:`s`} (branch kept)`)},onError:e=>V(e.message,{tone:`danger`})}),o=k({mutationFn:e=>be(e),onSuccess:()=>{i(),V(`Worktree removed`)},onError:e=>V(e.message,{tone:`danger`})});if(e.isPending)return(0,X.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,X.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:s,totalBytes:c,keep:l}=e.data,u=a.isPending||o.isPending;return(0,X.jsxs)(`div`,{"data-slot":`worktrees-panel`,className:`flex flex-col gap-3`,children:[s.length===0?(0,X.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`text-[13px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,X.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,X.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,X.jsx)(`caption`,{className:`sr-only`,children:`Task worktrees currently materialized on disk`}),(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Task`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Size`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Age`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,X.jsx)(`tbody`,{children:s.map(e=>(0,X.jsx)(P_,{worktree:e,disabled:u,onDelete:()=>r({kind:`delete`,runId:e.runId,title:e.title})},e.runId))})]})}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(`p`,{"data-slot":`worktrees-footer`,className:`text-[12px] text-soft-foreground`,children:[s.length,` worktree`,s.length===1?``:`s`,c===null?` · size unavailable`:` · ${It(c)||`0 kB`} on disk`,` · `,l===0?`keeping all (unlimited)`:`keeping the last ${l}`]}),(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,"data-action":`worktrees-reclaim-now`,disabled:u,onClick:()=>r({kind:`reclaim`}),children:`Reclaim now`})]}),(0,X.jsx)(Ga,{open:n!==null,onOpenChange:e=>!e&&r(null),children:(0,X.jsxs)(Ba,{children:[(0,X.jsxs)(Wa,{children:[(0,X.jsx)(za,{children:n?.kind===`delete`?`Delete this worktree?`:`Reclaim old worktrees?`}),(0,X.jsx)(Ra,{children:n?.kind===`delete`?(0,X.jsxs)(X.Fragment,{children:[`This removes the worktree directory and its branch — the local-only work is not recoverable afterwards.`,(0,X.jsx)(`span`,{className:`mt-1 block truncate font-medium text-foreground`,title:n.title,children:n.title})]}):`Finished worktrees beyond the keep-limit are reclaimed now (directory only). Their branches are kept, so the work stays recoverable.`})]}),(0,X.jsxs)(Ha,{children:[(0,X.jsx)(Ua,{children:`Keep it`}),(0,X.jsx)(Va,{"data-action":`worktrees-confirm`,className:n?.kind===`delete`?`bg-danger text-danger-foreground hover:brightness-[0.96]`:void 0,onClick:()=>{n?.kind===`reclaim`?a.mutate():n?.kind===`delete`&&o.mutate(n.runId),r(null)},children:n?.kind===`delete`?`Delete`:`Reclaim now`})]})]})})]})}function P_({worktree:e,disabled:t,onDelete:n}){return(0,X.jsxs)(`tr`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`border-b border-border last:border-0`,children:[(0,X.jsxs)(`th`,{scope:`row`,className:`max-w-[220px] px-3 py-2 text-left font-normal`,children:[(0,X.jsx)(`span`,{className:`block truncate text-foreground`,title:e.title,children:e.title}),(0,X.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,children:e.branch??e.runId.slice(0,8)})]}),(0,X.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,X.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:e.status}),e.reclaimable?(0,X.jsx)(`span`,{"data-slot":`worktree-reclaimable`,className:`ml-1 text-[11px] text-soft-foreground`,children:`(reclaimable)`}):null]}),(0,X.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:e.sizeBytes===null?`—`:It(e.sizeBytes)||`0 kB`}),(0,X.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:qa(e.finishedAt??void 0)||`—`}),(0,X.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,X.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`worktree-delete`,"aria-label":`Delete the worktree for ${e.title}`,disabled:t,onClick:n,children:`Delete`})})]})}var F_=0,I_=1e3;function L_(){let e=hn();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(Qo,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(R_,{config:e.data})}function R_({config:e}){let t=I(),n=k({mutationFn:e=>P(e),onSuccess:e=>t.setQueryData(B.config,e),onError:e=>V(e.message,{tone:`danger`})}),[r,i]=(0,Y.useState)(String(e.worktreeRetention)),a=Number(r),o=r.trim()===``||!Number.isInteger(a)||a<F_||a>I_,s=e.worktreeRetention===(o?-1:a);return(0,X.jsxs)(`div`,{"data-slot":`worktrees-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsxs)(Qg,{title:`Keep last N worktrees`,hint:`Older finished worktrees are reclaimed to free disk; their branch is kept so the work stays recoverable. 0 = unlimited. In-review and running tasks are never reclaimed, so the count on disk can exceed this.`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:F_,max:I_,step:1,"aria-label":`Keep last N finished worktrees`,"data-slot":`resources-worktree-retention`,value:r,disabled:n.isPending,onChange:e=>i(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`worktrees`}),(0,X.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-retention`,disabled:s||o||n.isPending,onClick:()=>n.mutate({worktreeRetention:a},{onSuccess:()=>{t.invalidateQueries({queryKey:B.worktrees}),V(a===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${a} finished worktree${a===1?``:`s`}`)}}),children:`Save`})]}),o?(0,X.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,F_,` to `,I_,` (0 = unlimited).`]}):(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:a===0?`Keeping every finished worktree.`:`Keeping the last ${a} finished worktree${a===1?``:`s`} on disk.`})]}),(0,X.jsx)(Qg,{title:`Worktrees`,hint:`Task worktrees currently on disk. Delete one to reclaim its space now, or reclaim everything past the keep-limit at once. Branches are always kept, so the work stays recoverable.`,children:(0,X.jsx)(N_,{})})]})}function z_(){let e=Pe(),t=xn(),n=I(),[r,i]=(0,Y.useState)(`jira`),[a,o]=(0,Y.useState)(null),[s,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(``),m=()=>{p(``),d(``),l(``),o(null)};(0,Y.useEffect)(()=>{m(),_(!1),x(null)},[wn()]);let[g,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(null),S=h(r,v,g),C=S.data?.pages??[],w=C.find(e=>e.available)?.available?C.find(e=>e.available).source:void 0,T=(0,Y.useMemo)(()=>C.flatMap(e=>e.available?e.candidates:[]),[C]);(0,Y.useEffect)(()=>{_(!1),x(null),m()},[e.data?.connection?.id]);let E=C.find(e=>!e.available),D=async e=>{await n.invalidateQueries({queryKey:B.tracker.allFor(e)}),await n.invalidateQueries({queryKey:c.projects})},O=k({mutationFn:async()=>{if(!b||!w)throw Error(`Choose a tracker project first.`);let t=wn(),n=B.tracker.associationFor(t);return{...await en({kind:r,sourceId:w.id,externalId:b.id,...e.data?.connection?{connectionId:e.data.connection.id}:{}}),projectId:t,associationKey:n}},onSuccess:async e=>{await Promise.all([n.cancelQueries({queryKey:B.tracker.allFor(e.projectId)}),n.cancelQueries({queryKey:c.projects})]),n.setQueryData(e.associationKey,{association:e.association}),_(!1),x(null),await D(e.projectId),V(`${e.association.externalName} connected`)},onError:e=>V(e.message,{tone:`danger`})}),A=k({mutationFn:async()=>{let e=wn(),t=B.tracker.associationFor(e);return{...await ne(),projectId:e,associationKey:t}},onSuccess:async e=>{await Promise.all([n.cancelQueries({queryKey:B.tracker.allFor(e.projectId)}),n.cancelQueries({queryKey:c.projects})]),n.setQueryData(e.associationKey,{association:null}),await D(e.projectId),V(`Tracker disconnected`)},onError:e=>V(e.message,{tone:`danger`})}),j=k({onMutate:()=>wn(),mutationFn:async()=>{let e=wn();if(!a)throw Error(`Choose a provider.`);return{...await ot(a===`jira`?{kind:`jira`,origin:s.trim(),email:u.trim(),token:f}:{kind:`linear`,key:f}),projectId:e}},onSuccess:async e=>{wn()===e.projectId&&(m(),_(!1),x(null)),await n.cancelQueries({queryKey:B.tracker.allFor(e.projectId)}),n.setQueryData([`tracker`,e.projectId,`connection`],{connection:e.connection,demo:e.demo}),await D(e.projectId),V(`Credentials saved for this project. Browse and connect a scope.`)},onError:(e,t,n)=>{wn()===n&&p(``),V(e.message,{tone:`danger`})}}),M=k({mutationFn:async()=>{let e=wn();return await ft(),e},onSuccess:async e=>{wn()===e&&(m(),_(!1),x(null)),await n.cancelQueries({queryKey:B.tracker.allFor(e)}),n.setQueryData([`tracker`,e,`connection`],{connection:null,demo:!1}),await D(e),V(`Project credentials removed`)},onError:e=>V(e.message,{tone:`danger`})}),N=j.isPending||M.isPending,P=t.data?.association,F=e.data?.connection,ee=!!P&&(e.data?.demo===!0||!!F&&F.kind===P.kind&&F.id===P.connectionId);return t.isPending?(0,X.jsx)(`p`,{className:`p-6 text-sm text-muted-foreground`,children:`Loading tracker settings…`}):t.isError?(0,X.jsx)(`p`,{className:`p-6 text-sm text-danger`,children:t.error.message}):(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-6 p-4 md:p-6`,"data-slot":`tracker-settings`,children:[(0,X.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Issue tracker`}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Connect a project or team from your issue tracker. Credentials belong only to this project and are stored locally outside the repository. Server-wide environment keys are not used.`}),ee&&t.data.association?(0,X.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium`,children:t.data.association.externalName}),(0,X.jsxs)(`a`,{className:`inline-flex items-center gap-1 text-xs text-violet hover:underline`,href:t.data.association.source.webUrl,target:`_blank`,rel:`noreferrer`,children:[js[t.data.association.kind].label,` `,(0,X.jsx)(na,{className:`size-3`})]})]}),(0,X.jsxs)(q,{variant:`outline`,onClick:()=>A.mutate(),disabled:A.isPending,children:[(0,X.jsx)(Os,{className:`size-3.5`}),` Disconnect`]})]}):(0,X.jsx)(`p`,{className:`mt-4 text-sm font-medium`,children:e.isPending?`Loading connection…`:e.isError?`Connection status unavailable.`:`No tracker connected.`})]}),P&&F&&!e.isError&&!e.data?.demo&&!ee?(0,X.jsx)(`p`,{className:`text-sm text-warning`,children:`This scope needs reconnection with this project's credentials. Configure a connection, then browse and select its scope again.`}):null,e.data?.error?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e.data.error}):null,(0,X.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`For local credential cleanup, run `,(0,X.jsx)(`code`,{children:`cez tracker-connections list`}),`, then `,(0,X.jsx)(`code`,{children:`cez tracker-connections remove <id>`}),`. Local deletion does not revoke the vendor token.`]}),e.isError?(0,X.jsxs)(`p`,{className:`text-sm text-danger`,children:[`Could not load project connection. `,(0,X.jsx)(`button`,{onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,X.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Connect a provider`}),(0,X.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:Ms.map(t=>{let n=!e.isError&&(e.data?.demo===!0||e.data?.connection?.kind===t.kind);return(0,X.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:t.label}),e.data?.demo?null:(0,X.jsxs)(q,{variant:`outline`,disabled:N||e.isPending||e.isError,onClick:()=>{m(),o(t.kind),_(!1),x(null)},children:[e.data?.connection?.kind===t.kind?`Replace`:`Configure`,` `,t.label,` credentials`]}),(0,X.jsxs)(q,{className:`mt-3`,variant:`outline`,disabled:!n||N,onClick:()=>{i(t.kind),_(!0),y(``),x(null)},children:[(0,X.jsx)(us,{className:`size-3.5`}),` Browse `,t.label]}),n?null:(0,X.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Configure credentials for this project to browse.`})]},t.kind)})})]}),e.data?.connection?(0,X.jsx)(q,{variant:`outline`,disabled:N,onClick:()=>M.mutate(),children:`Remove project credentials`}):null,a?(0,X.jsxs)(`form`,{className:`rounded-lg border border-border bg-card p-4`,onSubmit:e=>{e.preventDefault(),j.mutate()},autoComplete:`off`,children:[(0,X.jsxs)(`h2`,{className:`font-medium`,children:[js[a].label,` credentials for this project`]}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Saved in a private .env file for this project, without encryption. Use read-only access limited to this project's data. Saving replaces this project's connection and requires selecting its scope again.`}),a===`jira`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Jira site URL`,(0,X.jsx)(`input`,{"aria-label":`Jira site URL`,type:`url`,required:!0,value:s,onChange:e=>l(e.target.value),placeholder:`https://your-site.atlassian.net`,className:`mt-1 block w-full rounded border bg-background p-2`})]}),(0,X.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Account email`,(0,X.jsx)(`input`,{"aria-label":`Account email`,type:`email`,required:!0,value:u,onChange:e=>d(e.target.value),className:`mt-1 block w-full rounded border bg-background p-2`})]})]}):null,(0,X.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`API token`,(0,X.jsx)(`input`,{"aria-label":`API token`,type:`password`,autoComplete:`new-password`,required:!0,maxLength:8192,value:f,onChange:e=>p(e.target.value),className:`mt-1 block w-full rounded border bg-background p-2`})]}),(0,X.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,X.jsx)(q,{type:`submit`,disabled:N,children:`Save project credentials`}),(0,X.jsx)(q,{type:`button`,variant:`outline`,disabled:N,onClick:m,children:`Cancel`})]})]}):null,g?(0,X.jsxs)(`section`,{className:`rounded-lg border border-violet/40 bg-card p-4`,"aria-label":`${js[r].label} picker`,children:[(0,X.jsxs)(`label`,{className:`text-xs font-medium`,htmlFor:`tracker-candidate-search`,children:[`Search `,js[r].scopeLabel]}),(0,X.jsx)(`input`,{id:`tracker-candidate-search`,className:`mt-2 h-9 w-full rounded-md border border-border bg-background px-3 text-sm`,value:v,onChange:e=>{y(e.target.value),x(null)},placeholder:`Search by name…`}),(0,X.jsxs)(`div`,{className:`mt-3 max-h-64 space-y-1 overflow-auto`,children:[S.isPending?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):null,S.isError?(0,X.jsx)(B_,{reason:S.error.message,generation:S.errorUpdatedAt,retry:()=>void S.refetch()}):null,E&&!E.available?(0,X.jsx)(B_,{reason:E.reason,generation:S.dataUpdatedAt,retryAfterSeconds:E.code===`rate_limited`?E.retryAfterSeconds:void 0,retry:()=>void S.refetch()}):null,T.map(e=>(0,X.jsx)(`button`,{type:`button`,className:`block w-full rounded-md border px-3 py-2 text-left text-sm ${b?.id===e.id?`border-violet bg-violet/10`:`border-border`}`,onClick:()=>x(e),children:e.name},e.id)),!S.isPending&&!S.isError&&!E&&T.length===0?(0,X.jsx)(`p`,{className:`py-3 text-sm text-muted-foreground`,children:`No projects or teams match.`}):null,S.hasNextPage?(0,X.jsx)(q,{variant:`ghost`,onClick:()=>void S.fetchNextPage(),disabled:S.isFetchingNextPage,children:`Load more`}):null]}),(0,X.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,X.jsx)(q,{variant:`contrast`,disabled:!b||O.isPending||N,onClick:()=>O.mutate(),children:`Connect`}),(0,X.jsx)(q,{variant:`ghost`,onClick:()=>_(!1),children:`Cancel`})]})]}):null]})}function B_({reason:e,retry:t,retryAfterSeconds:n=0,generation:r}){let[i,a]=(0,Y.useState)(n);return(0,Y.useEffect)(()=>a(n),[e,n,r]),(0,Y.useEffect)(()=>{if(i<=0)return;let e=window.setInterval(()=>a(e=>Math.max(0,e-1)),1e3);return()=>window.clearInterval(e)},[i>0]),(0,X.jsxs)(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 p-3 text-sm`,children:[(0,X.jsx)(`p`,{className:`text-danger`,children:e}),(0,X.jsx)(q,{className:`mt-2`,variant:`outline`,disabled:i>0,onClick:t,children:i>0?`Retry in ${i}s`:`Retry`})]})}var V_={checks:`Check steps (workflow commands)`,cezar:`cezar itself (its own features — not the agents)`};function H_(e){return e===`keychain`?`Encrypted with a data key kept in your OS keychain.`:`Encrypted with a data key in ~/.cezar/secrets/.key (0600) — no OS keychain is available on this machine, so this is a private file, not a vault.`}function U_({scope:e,list:t,save:n,remove:r,invalidate:i}){let a=I(),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)([`checks`]),[f,p]=(0,Y.useState)(null),m=o===``?null:Cn(o),h=k({mutationFn:async()=>{let e=wn();return await n(o,{value:c,audiences:u}),{projectId:e,saved:o}},onSuccess:async({projectId:e,saved:t})=>{wn()===e&&(s(``),l(``),p(null)),await i(a,e),V(`${t} saved`)},onError:e=>p(e.message)}),g=k({mutationFn:async e=>{let t=wn();return await r(e),{projectId:t,removed:e}},onSuccess:async({projectId:e,removed:t})=>{await i(a,e),V(`${t} removed`)},onError:e=>V(e.message,{tone:`danger`})}),_=()=>{let e=Cn(o);if(e){p(e);return}if(u.length===0){p(`pick at least one audience`);return}p(null),h.mutate()},v=e=>d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),y=e===`project`?`Project secrets`:`Workspace secrets`,b=e===`project`?`Values for this project only — an e2e runner’s model key, a staging login. They reach the audiences you pick and never an agent session.`:`Values shared by every project on this machine — a key cezar’s own features use, a token every project’s checks need. A project secret of the same name wins. They never reach an agent session.`,x=t.data?.secrets??[];return(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-6 p-4 md:p-6`,"data-slot":`secrets-settings`,"data-scope":e,children:[(0,X.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:y}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:b}),t.isPending?(0,X.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:`Loading…`}):null,t.isError?(0,X.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:t.error?.message}):null,t.data&&x.length===0?(0,X.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:`No secrets stored.`}):null,t.data&&x.length>0?(0,X.jsx)(`ul`,{className:`mt-4 divide-y divide-border rounded-md border border-border`,"aria-label":`Stored ${e} secrets`,children:x.map(e=>(0,X.jsxs)(`li`,{className:`flex items-center justify-between gap-3 px-3 py-2`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`code`,{className:`text-sm`,children:e.name}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.audiences.map(e=>V_[e].split(` (`)[0]).join(` · `)})]}),(0,X.jsxs)(q,{variant:`outline`,"aria-label":`Delete ${e.name}`,disabled:g.isPending,onClick:()=>g.mutate(e.name),children:[(0,X.jsx)(Vi,{className:`size-3.5`}),` Delete`]})]},e.name))}):null,t.data?(0,X.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,"data-slot":`key-backend`,children:H_(t.data.keyBackend)}):null]}),(0,X.jsxs)(`form`,{className:`rounded-lg border border-border bg-card p-4`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),_()},children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Add or replace a secret`}),(0,X.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Name`,(0,X.jsx)(`input`,{"aria-label":`Name`,value:o,onChange:e=>{s(e.target.value.toUpperCase()),p(null)},autoComplete:`off`,spellCheck:!1,placeholder:`AI_GATEWAY_API_KEY`,"aria-invalid":m?!0:void 0,className:`mt-1 block w-full rounded border border-border bg-background p-2 font-mono`})]}),m?(0,X.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:m}):null,(0,X.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Value`,(0,X.jsx)(`input`,{"aria-label":`Value`,type:`password`,autoComplete:`off`,required:!0,value:c,onChange:e=>l(e.target.value),className:`mt-1 block w-full rounded border border-border bg-background p-2`})]}),(0,X.jsxs)(`fieldset`,{className:`mt-3`,children:[(0,X.jsx)(`legend`,{className:`text-sm`,children:`Who may read it`}),zn.map(e=>(0,X.jsxs)(`label`,{className:`mt-1 flex items-center gap-2 text-sm`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"aria-label":V_[e],checked:u.includes(e),onChange:()=>v(e)}),V_[e]]},e)),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Agents are never an audience: a secret cannot be handed to a Claude Code, Codex or OpenCode session.`})]}),f&&f!==m?(0,X.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:f}):null,(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsx)(q,{type:`submit`,disabled:h.isPending||o===``||c===``||u.length===0||!!m,children:`Save secret`})})]})]})}function W_(){return(0,X.jsx)(U_,{scope:`project`,list:We(),save:Wt,remove:Ke,invalidate:(e,t)=>e.invalidateQueries({queryKey:B.secrets.allFor(t??``)})})}function G_(){return(0,X.jsx)(U_,{scope:`workspace`,list:Ve(),save:dn,remove:sn,invalidate:e=>e.invalidateQueries({queryKey:c.secrets})})}var K_=`/assets/tester-army-tUUSV6JM.png`,q_=`https://github.com/tester-army/e2e`,J_={AI_GATEWAY_API_KEY:`Vercel AI Gateway`,OPENAI_API_KEY:`OpenAI`,ANTHROPIC_API_KEY:`Anthropic`,OPENROUTER_API_KEY:`OpenRouter`},Y_=new Set([`queued`,`running`,`waiting`]);function X_(e,t,n,r){if(Y_.has(e))return`Setting up — cezar is installing and configuring e2e in its own worktree.`;let i=r?`its draft PR is ready — merge it to finish.`:`merge ${n?`branch ${n}`:`the setup task’s branch`} to finish.`;return e===`review`?`Ready for review — ${i}`:e===`done`?t?`Setup finished.`:`Setup finished — ${i}`:e===`failed`?`The last setup failed — open the task to see why, then try again.`:`The last setup was cancelled.`}function Z_({ok:e,children:t}){return(0,X.jsxs)(`li`,{className:`flex items-center gap-2 text-sm`,"data-ok":e,children:[e?(0,X.jsx)(Hi,{className:`size-4 text-success`,"aria-hidden":!0}):(0,X.jsx)(ms,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:e?void 0:`text-muted-foreground`,children:t})]})}function Q_(){let e=I(),t=Me(),n=he(),r=Ze(n.data?.setup?.runId),[i,a]=(0,Y.useState)(void 0),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(null),u=r.data?.status??n.data?.setup?.status,d=r.data?.pullRequestUrl&&/^https?:\/\//.test(r.data.pullRequestUrl)?r.data.pullRequestUrl:void 0,f=u!==void 0&&Y_.has(u),p=n.data?.credentials??[],m=i??p[0]??`AI_GATEWAY_API_KEY`,h=!!(n.data?.configFile&&n.data.workflow),g=k({mutationFn:async()=>({projectId:wn(),runId:(await Rt(o?{credential:{name:m,value:o}}:{})).runId}),onSuccess:async({projectId:n,runId:r})=>{s(``),l(null),await Promise.all([e.invalidateQueries({queryKey:B.e2e.allFor(n??``)}),e.invalidateQueries({queryKey:B.secrets.allFor(n??``)})]),V(`e2e setup started`),wn()===n&&t(Qt(n,`/tasks/${r}`))},onError:e=>l(e.message)});return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,"data-slot":`e2e-settings`,children:[(0,X.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(`img`,{src:K_,alt:``,width:40,height:40,className:`size-10 shrink-0 rounded-md`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:`TesterArmy e2e`}),(0,X.jsx)(`span`,{"data-slot":`e2e-badge`,"data-state":f?`setting-up`:h?`installed`:`none`,className:h&&!f?`rounded-full bg-success/10 px-2 py-0.5 text-xs font-medium text-success`:`rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:f?`Setting up`:h?`Installed`:`Not set up`})]}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Agentic browser end-to-end testing`})]}),(0,X.jsxs)(`a`,{href:q_,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,children:[`tester-army/e2e `,(0,X.jsx)(na,{className:`size-3`,"aria-hidden":!0})]})]}),(0,X.jsxs)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:[`cezar installs it for this project, points it at your dev server, writes a smoke test and an`,` `,(0,X.jsx)(`code`,{children:`implement-and-e2e`}),` workflow, proves it all passes in a real browser and opens a draft PR for you to merge.`]}),n.isPending?(0,X.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:`Loading…`}):null,n.isError?(0,X.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:n.error.message}):null,n.data?(0,X.jsxs)(`ul`,{className:`mt-4 flex flex-col gap-1.5`,"aria-label":`e2e status`,children:[(0,X.jsx)(Z_,{ok:!!n.data.configFile,children:n.data.configFile?(0,X.jsxs)(X.Fragment,{children:[`Configured (`,(0,X.jsx)(`code`,{children:n.data.configFile}),`)`]}):`Not configured in this checkout`}),(0,X.jsxs)(Z_,{ok:n.data.workflow,children:[(0,X.jsx)(`code`,{children:`implement-and-e2e`}),` workflow `,n.data.workflow?`available`:`not added yet`]}),(0,X.jsx)(Z_,{ok:p.length>0,children:p.length>0?(0,X.jsxs)(X.Fragment,{children:[`Model key: `,(0,X.jsx)(`code`,{children:p.join(`, `)})]}):`No model key — smoke tests run without one; agent steps need one`})]}):null,n.data?.setup&&u?(0,X.jsxs)(`p`,{className:`mt-3 text-sm`,"data-slot":`e2e-setup-run`,"data-status":u,children:[X_(u,!!n.data.configFile,r.data?.branch,d),` `,d&&!n.data.configFile?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`a`,{className:`underline`,href:d,target:`_blank`,rel:`noreferrer`,children:`Open the draft PR`}),` · `]}):null,(0,X.jsx)(pe,{className:`underline`,to:Qt(wn(),`/tasks/${n.data.setup.runId}`),children:`Open the setup task`})]}):null]}),(0,X.jsxs)(`form`,{className:`rounded-lg border border-border bg-card p-4`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),g.mutate()},children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:h?`Set up again`:`Set up e2e`}),(0,X.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Model provider`,(0,X.jsx)(`select`,{"aria-label":`Model provider`,value:m,onChange:e=>a(e.target.value),className:`mt-1 block w-full rounded border border-border bg-background p-2 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:Mn.map(e=>(0,X.jsxs)(`option`,{value:e,children:[J_[e],` (`,e,`)`,p.includes(e)?` — stored`:``]},e))})]}),(0,X.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`API key `,(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`(optional)`}),(0,X.jsx)(`input`,{"aria-label":`API key`,type:`password`,autoComplete:`off`,value:o,onChange:e=>s(e.target.value),placeholder:p.includes(m)?`stored — leave empty to keep it`:``,className:`mt-1 block w-full rounded border border-border bg-background p-2`})]}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Stored encrypted as a project secret for check steps only — never handed to an agent session.`}),c?(0,X.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:c}):null,(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsx)(q,{type:`submit`,disabled:g.isPending||f||!n.data,children:f?`Setup in progress…`:h?`Set up again`:`Set up e2e`})})]})]})}function $_(){return(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 md:p-6`,"data-slot":`integrations-settings`,children:[(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Tools cezar can set up in this project for you — each one as a task you review and merge.`}),(0,X.jsxs)(Sh,{defaultValue:`test-frameworks`,children:[(0,X.jsx)(wh,{variant:`line`,"data-slot":`integrations-tabs`,children:(0,X.jsx)(Th,{value:`test-frameworks`,children:`Test frameworks`})}),(0,X.jsx)(Eh,{value:`test-frameworks`,className:`pt-4`,children:(0,X.jsx)(Q_,{})})]})]})}function ev(e,t){return function(){return(0,X.jsx)(J,{icon:(0,X.jsx)(t,{}),tone:`neutral`,title:e,subtitle:`This section arrives in a later phase of the redesign.`,heading:`h2`})}}var tv=[{id:`tracker`,title:`Issue tracker`,description:`Connect this project to Jira or Linear.`,icon:Ds,component:z_,scope:`project`},{id:`secrets`,title:`Secrets`,description:`Encrypted values for this project’s check steps and cezar — never for agents.`,icon:ss,component:W_,scope:`project`},{id:`integrations`,title:`External integrations`,description:`Third-party tools cezar installs and wires into this project — test frameworks first.`,icon:Bo,component:$_,scope:`project`},{id:`agents`,title:`Agents`,description:`Default runner, models and system prompt.`,icon:Bi,component:lg,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:Xo,component:Qh,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:Qo,component:L_,scope:`project`},{id:`bookmarklets`,title:`Bookmarklets`,description:`Launch skills from a GitHub PR or issue.`,icon:Vo,component:Rg,scope:`project`},{id:`prompt-templates`,title:`Prompt templates`,description:`Reusable snippets for follow-up instructions.`,icon:_s,component:d_,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, accent and density.`,icon:ys,component:Lg,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:zo,component:Gg,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:ns,component:k_,scope:`global`},{id:`skills`,title:`Skills`,description:`Updates for skills installed on this machine.`,icon:vs,component:j_,scope:`global`},{id:`workspace-secrets`,title:`Secrets`,description:`Encrypted values shared by every project on this machine — never for agents.`,icon:ss,component:G_,scope:`global`},{id:`accounts`,title:`Agent accounts`,description:`Second logins, and the agent and models a project uses when it has chosen none.`,icon:as,component:Ph,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:ts,component:r_,scope:`global`},{id:`keyboard`,title:`Keyboard`,description:`Shortcuts.`,icon:cs,component:ev(`Keyboard`,cs),scope:`global`,hidden:!0}];function nv(e,t){return tv.filter(n=>!n.hidden&&n.scope===e&&!(t?.singleProject===!0&&n.id===`projects`))}function rv(){let e=Pt(),t=ye().data;return e===null?null:t?.projects.find(t=>t.id===e)?.root??null}function iv(e){navigator.clipboard.writeText(e).then(()=>V(`Project folder copied`)).catch(()=>V(e))}function av(){let e=rv();return e===null?null:(0,X.jsx)(Qg,{title:`Project folder`,hint:`Where this project lives on disk. Every task worktree, git command and agent run resolves against it.`,children:(0,X.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`field`,className:`flex items-start gap-3 rounded-md border border-border bg-card p-3`,children:[(0,X.jsx)(`span`,{"data-slot":`project-location-path`,className:`min-w-0 flex-1 font-mono text-xs break-all text-foreground`,children:e}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,X.jsx)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`Copy the project folder path`,onClick:()=>iv(e),className:`text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:`Copy`}),(0,X.jsx)(sv,{root:e})]})]})})}function ov(){let e=rv();return e===null?null:(0,X.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`nav`,className:`mt-auto px-2.5 pt-3`,children:[(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Project folder`}),(0,X.jsx)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`${e} — click to copy`,onClick:()=>iv(e),className:`block w-full truncate text-left font-mono text-[11px] text-muted-foreground transition-colors hover:text-foreground`,children:e})]})}function sv({root:e}){let t=O(),n=k({mutationFn:e=>kt(e),onError:e=>V(e.message,{tone:`danger`})}),r=(t.data?.targets??[]).filter(e=>jr(e.id)===void 0).map(e=>({target:e}));return r.length===0?null:(0,X.jsx)(Ur,{slot:`project-location-open`,label:`Open with`,triggerVariant:`outline`,title:e,disabled:n.isPending,choices:r,onPick:e=>n.mutate(e,{onSuccess:()=>V(`Opening the project folder in ${r.find(t=>t.target.id===e)?.target.label??e}`)})})}function cv(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function lv({capabilities:e}){let t=Pt(),n=ye(),r=Ue();if(n.isPending)return(0,X.jsx)(`p`,{"data-slot":`project-general-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading project…`});if(n.isError)return(0,X.jsxs)(`p`,{"data-slot":`project-general-error`,className:`text-[13px] text-danger`,children:[`Could not read the project registry — `,n.error.message]});let i=n.data,a=i?.projects.find(e=>e.id===t);if(!i||!a)return null;let o=e?.singleProject!==!0&&a.unregistered!==!0;return(0,X.jsxs)(`div`,{"data-slot":`project-general`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7`,children:[(0,X.jsx)(av,{}),(0,X.jsx)(uv,{project:a,canRemove:o}),a.unregistered?(0,X.jsx)(Qg,{title:`Add to your projects`,hint:`cezar is serving this folder because you started it here — starting cezar somewhere new never adds it to your project list for you. Adding it keeps it in the sidebar between runs and gives it a registry entry to hold settings like the task cap. Nothing on disk changes either way.`,children:(0,X.jsx)(c_,{root:a.root,name:a.name})}):null,o?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Qg,{title:`Max parallel tasks`,hint:r.data?`How many of this project's tasks may run at once — leave it empty to inherit the workspace limit. The workspace limit (${r.data.resources.maxParallel}) still applies as an overall ceiling, so a higher value here has no extra effect until that one is raised.`:`How many of this project's tasks may run at once — leave it empty to inherit the workspace limit. The workspace limit still applies as an overall ceiling.`,children:r.data?(0,X.jsx)(u_,{project:a,workspaceMax:r.data.resources.maxParallel}):(0,X.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading the workspace limit…`})}),(0,X.jsx)(dv,{project:a,bootProject:i.bootProject})]}):null]})}function uv({project:e,canRemove:t}){return(0,X.jsx)(Qg,{title:`Project`,hint:`The registry entry for this checkout — re-probed every time the project list is read.`,children:(0,X.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-[8rem_minmax(0,1fr)] gap-x-3 gap-y-1.5 rounded-md border border-border bg-card p-3 text-[13px]`,children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Name`}),(0,X.jsx)(`dd`,{className:`min-w-0 truncate text-foreground`,children:e.name}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Status`}),(0,X.jsxs)(`dd`,{"data-slot":`project-general-status`,className:e.status===`missing`?`text-danger`:`text-foreground`,children:[t_[e.status],e.status===`missing`?t?` — remove it below, or restore the folder`:` — restore the folder at the path above`:null]}),e.branch===void 0?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Branch`}),(0,X.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-xs text-foreground`,children:e.branch})]}),e.unregistered?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`In your projects`}),(0,X.jsx)(`dd`,{"data-slot":`project-general-unregistered`,className:`text-foreground`,children:`No — served because cezar was started here`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Added`}),(0,X.jsxs)(`dd`,{className:`text-foreground`,children:[cv(e.addedAt),(0,X.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Last opened`}),(0,X.jsx)(`dd`,{className:`text-foreground`,children:cv(e.lastOpenedAt)})]})]})})}function dv({project:e,bootProject:t}){let[n,r]=(0,Y.useState)(null),i=Xg(),a=Me(),o=e.id===t;return(0,X.jsxs)(Qg,{title:`Remove from workspace`,hint:`Unregisters this project so it leaves the sidebar and the project list. Nothing on disk is deleted — the folder, its git history and its task history all stay, and adding it back later finds everything intact.`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-general-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:o?"cezar is serving this project — stop it and use `cezar projects remove`":void 0,disabled:o||i.isPending,onClick:()=>r(e),className:`text-danger`,children:[`Remove `,e.name]}),o?(0,X.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`text-[11px] text-soft-foreground`,children:"cezar is serving this project — stop cezar and run `cezar projects remove` to drop it."}):null]}),(0,X.jsx)(Zg,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function fv(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}function pv(e){return e===`global`?`/settings/global`:`/settings`}function mv(e){return e===`global`?{Link:pe,NavLink:_e}:{Link:H,NavLink:Tt}}function hv({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=mv(e);return(0,X.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav`,"data-scope":e,className:`hidden w-52 shrink-0 flex-col gap-1 border-r border-border p-3 md:flex`,children:[(0,X.jsxs)(r,{to:pv(e),end:!0,"data-slot":`settings-nav-index`,"aria-current":t===null?`page`:void 0,className:K(`flex items-center gap-2.5 rounded-md px-2.5 py-2 text-[13px] font-medium transition-colors`,t===null?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:[(0,X.jsx)(Yn,{"aria-hidden":`true`,className:`size-4 shrink-0`}),`General`]}),nv(e,n).map(n=>(0,X.jsxs)(r,{to:fv(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:K(`flex items-center gap-2.5 rounded-md px-2.5 py-2 text-[13px] font-medium transition-colors`,n.id===t?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:[(0,X.jsx)(n.icon,{"aria-hidden":`true`,className:`size-4 shrink-0`}),n.title]},n.id)),e===`global`?(0,X.jsx)(`p`,{className:`mt-auto px-2.5 pt-3 text-[11px] text-soft-foreground`,children:`Stored in ~/.cezar`}):(0,X.jsx)(ov,{})]})}function gv({scope:e,activeId:t,capabilities:n}){let{NavLink:r}=mv(e);return(0,X.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav-mobile`,className:`flex shrink-0 gap-1.5 overflow-x-auto border-b border-border px-3 py-2.5 md:hidden`,children:[(0,X.jsx)(r,{to:pv(e),end:!0,"data-slot":`settings-nav-index`,className:`rounded-full border border-border bg-card px-3 py-1.5 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors`,children:`General`}),nv(e,n).map(n=>(0,X.jsx)(r,{to:fv(e,n.id),"data-section":n.id,"aria-current":n.id===t?`page`:void 0,className:K(`rounded-full border px-3 py-1.5 text-[13px] font-medium whitespace-nowrap transition-colors`,n.id===t?`border-transparent bg-contrast text-contrast-foreground`:`border-border bg-card text-muted-foreground`),children:n.title},n.id))]})}function _v({section:e,scope:t,capabilities:n}){let r=e.component;return(0,X.jsxs)(`div`,{"data-route":t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,className:`flex min-h-full flex-col`,children:[(0,X.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,X.jsx)(`h1`,{className:`text-base font-semibold`,children:e.title}),(0,X.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:e.description}),t===`global`?(0,X.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`ml-auto text-[11px] text-soft-foreground`,children:`Global settings`}):null]}),(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,X.jsx)(hv,{scope:t,activeId:e.id,capabilities:n}),(0,X.jsx)(gv,{scope:t,activeId:e.id,capabilities:n}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,X.jsx)(r,{})})]})]})}function vv({scope:e,capabilities:t}){let{Link:n}=mv(e),r=e===`global`;return(0,X.jsxs)(`div`,{"data-route":r?`settings-global`:`settings`,className:`flex min-h-full flex-col`,children:[(0,X.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,X.jsx)(`h1`,{className:`text-base font-semibold`,children:r?`Global settings`:`Settings`}),(0,X.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:r?`Preferences for you and this machine, shared by every project.`:`Configure this project and its agents.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col md:flex-row`,children:[(0,X.jsx)(hv,{scope:e,activeId:null,capabilities:t}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[r?null:(0,X.jsx)(lv,{capabilities:t}),(0,X.jsx)(`ul`,{"data-slot":`settings-index`,className:K(`mx-auto flex w-full max-w-2xl flex-col gap-2.5`,r?null:`mt-7 md:hidden`),children:nv(e,t).map(t=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(n,{to:fv(e,t.id),"data-section":t.id,className:`flex items-center gap-3.5 rounded-lg border border-border bg-card p-4 shadow-xs transition-colors hover:bg-card-2`,children:[(0,X.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-muted text-muted-foreground`,children:(0,X.jsx)(t.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:t.title}),(0,X.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:t.description})]}),(0,X.jsx)(Ui,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},t.id))}),(0,X.jsx)(`p`,{className:`mx-auto mt-4 w-full max-w-2xl text-[12px] text-soft-foreground`,children:r?(0,X.jsx)(X.Fragment,{children:`Agents, worktrees, bookmarklets and prompt templates are per project.`}):(0,X.jsxs)(X.Fragment,{children:[`Appearance, notifications, host resources and the project registry live in`,` `,(0,X.jsx)(pe,{to:pv(`global`),"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})})]})]})]})}function yv({label:e,expanded:t,onToggle:n,className:r}){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`subtask-toggle`,"aria-expanded":t,"aria-label":`${t?`Collapse`:`Expand`} ${e}`,onClick:n,className:K(`inline-flex shrink-0 items-center gap-0.5 rounded-full bg-muted py-px pr-1.5 pl-1 text-[10.5px] font-medium text-muted-foreground hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,r),children:[(0,X.jsx)(Ui,{className:K(`size-3 transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),e]})}var bv=[{id:`status`,label:`Status`,canFold:!1,defaultExpanded:!0,align:`left`,width:`116px`},{id:`task`,label:`Task`,canFold:!1,defaultExpanded:!0,align:`left`},{id:`workflow`,label:`Workflow`,canFold:!0,defaultExpanded:!0,align:`left`,width:`124px`,icon:`workflow`},{id:`branch`,label:`Branch`,canFold:!0,defaultExpanded:!1,align:`left`,width:`128px`,icon:`branch`},{id:`diff`,label:`±`,canFold:!0,defaultExpanded:!0,align:`left`,width:`78px`,icon:`diff`},{id:`reference`,label:`Ref`,canFold:!0,defaultExpanded:!0,align:`left`,width:`76px`,icon:`reference`},{id:`tokens`,label:`IN / OUT`,canFold:!0,defaultExpanded:!0,align:`right`,width:`112px`,icon:`tokens`,capability:`tokens`},{id:`cost`,label:`Cost`,canFold:!0,defaultExpanded:!0,align:`right`,width:`76px`,icon:`cost`,capability:`cost`},{id:`cpu`,label:`CPU`,canFold:!0,defaultExpanded:!0,align:`right`,width:`68px`,icon:`cpu`},{id:`memory`,label:`Mem`,canFold:!0,defaultExpanded:!0,align:`right`,width:`88px`,icon:`memory`},{id:`started`,label:`Started`,canFold:!0,defaultExpanded:!0,align:`right`,width:`82px`,icon:`started`}],xv=new Map(bv.map(e=>[e.id,e]));function Sv(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`boolean`))}function Cv(e){let t={};for(let[n,r]of Object.entries(Sv(e))){let e=xv.get(n);e?.canFold&&(t[e.id]=r)}return t}function wv(e,t){let n=xv.get(e);return!n||!n.canFold?!0:t[e]??n.defaultExpanded}function Tv(e,t){let n=Sv(e);return xv.get(t)?.canFold?{...n,[t]:!wv(t,Cv(e))}:n}function Ev(e){return bv.filter(t=>t.capability===void 0||e[t.capability])}function Dv(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Ov(){let e=I(),t=qe(),n=Y.useRef(0),r=Y.useRef(0),i=Y.useRef(Promise.resolve()),a=Y.useMemo(()=>Cv(t.data?.taskTable?.expandedColumns),[t.data?.taskTable?.expandedColumns]),o=Y.useCallback(t=>{if(!bv.find(e=>e.id===t)?.canFold)return;let a=e.getQueryData(c.uiState);if(a===void 0)return;let o=Dv(a?.taskTable),s={...o,expandedColumns:Tv(o.expandedColumns,t)};e.setQueryData(c.uiState,{...a,taskTable:s});let l=++n.current;r.current=l;let u=i.current.then(async()=>{let t=await oe({taskTable:s},{keepalive:!0});l===r.current&&e.setQueryData(c.uiState,t)});i.current=u.catch(t=>{V(t instanceof Error?t.message:String(t),{tone:`danger`}),l===r.current&&e.invalidateQueries({queryKey:c.uiState})})},[e]);return{expandedColumns:a,isExpanded:Y.useCallback(e=>wv(e,a),[a]),toggleColumn:o,isPending:t.isPending}}function kv({runs:e,view:t,onViewChange:n,onArchiveFinished:r,onMarkAllRead:i,onRename:a,onTogglePin:o,now:s=Date.now(),showTokens:c=!0,showCost:l=!0,expandedColumns:u=Cv(void 0),onToggleColumn:d=()=>void 0,columnsPending:f=!1,origin:p=`all`,onOriginChange:m=()=>void 0,automationNames:h}){let[g,v]=Y.useState(``),[y,b]=Y.useState(new Set),x=e=>b(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),[S,C]=Y.useState(Tf),T=Y.useMemo(()=>e??[],[e]),E=Y.useMemo(()=>Df(T),[T]),D=kf(T,p,S,E),O=De(D),k=w(Gt(D,g),t),A=g.trim()!==``,j=If(k,e=>A||y.has(e)),M=_(T),N=et(Gt(D,g),t),P=tn(T),F=Ev({tokens:c,cost:l}),ee=Ar(T),te=t===`archived`?void 0:o;return(0,X.jsxs)(`div`,{"data-route":`tasks`,className:`flex min-h-full flex-col`,children:[(0,X.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,X.jsx)(`h1`,{className:`text-base font-semibold`,children:`Tasks`}),(0,X.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,X.jsx)(Mv,{view:`active`,current:t,onSelect:n,count:O.active,children:`Active`}),(0,X.jsx)(Mv,{view:`archived`,current:t,onSelect:n,count:O.archived,children:`Archived`})]}),(0,X.jsx)(`div`,{className:`flex-1`}),ee>0?(0,X.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`mark-all-read`,onClick:i,children:[(0,X.jsx)(Zn,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read`]}):null,t===`active`&&P>0?(0,X.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,onClick:r,children:[(0,X.jsx)(Fr,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`]}):null,(0,X.jsxs)(`div`,{className:`relative w-60`,children:[(0,X.jsx)(la,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-soft-foreground`,"aria-hidden":`true`}),(0,X.jsx)(`input`,{type:`text`,value:g,onChange:e=>v(e.target.value),placeholder:`Search tasks…`,"aria-label":`Search tasks`,className:`h-9 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[T.length>0?(0,X.jsx)(jv,{runs:T,view:t,origin:p,onOriginChange:m,filters:S,onFiltersChange:C,automations:E,automationNames:h}):null,e===void 0?null:k.length===0?(0,X.jsx)(Av,{view:t,query:g,filtered:Ef(S)>0,onClearFilters:()=>C(Tf),origin:p,hiddenByOrigin:p!==`all`&&kf(w(T,t),`all`,S,E).length>0,onShowAll:()=>m(`all`)}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{"data-slot":`tasks-table`,className:`hidden overflow-x-auto rounded-lg border border-border bg-card shadow-xs md:block`,children:(0,X.jsx)(Pa,{children:(0,X.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,X.jsx)(`colgroup`,{children:F.map(e=>{let t=wv(e.id,u);return(0,X.jsx)(`col`,{"data-column-id":e.id,"data-expanded":t,style:{width:t?e.width:`42px`}},e.id)})}),(0,X.jsx)(`thead`,{children:(0,X.jsx)(`tr`,{children:F.map(e=>(0,X.jsx)(Pv,{column:e,expanded:wv(e.id,u),onToggle:d,disabled:f},e.id))})}),(0,X.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:j.map(e=>(0,X.jsx)(Lv,{run:e.run,depth:e.depth,childCount:e.childCount,subtasksExpanded:A||y.has(e.run.id),onToggleSubtasks:x,queuePosition:e.run.status===`queued`?M.get(e.run.id)??null:null,onRename:a,onTogglePin:te,now:s,columns:F,expandedColumns:u},e.run.id))})]})})}),(0,X.jsx)(`div`,{"data-slot":`task-cards`,className:`flex flex-col gap-2.5 md:hidden`,children:j.map(e=>(0,X.jsx)(Uv,{run:e.run,depth:e.depth,childCount:e.childCount,subtasksExpanded:A||y.has(e.run.id),onToggleSubtasks:x,queuePosition:e.run.status===`queued`?M.get(e.run.id)??null:null,now:s,showTokens:c,showCost:l,onTogglePin:te},e.run.id))})]}),N.map(e=>(0,X.jsxs)(`div`,{"data-slot":`compare-strip`,"data-group-id":e.groupId,className:`mt-3.5 flex flex-wrap items-center gap-2.5 rounded-lg border border-border bg-card px-3.5 py-2.5 text-[12.5px] text-muted-foreground shadow-xs`,children:[(0,X.jsx)(xs,{className:`size-[15px] shrink-0 text-soft-foreground`,"aria-hidden":`true`}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e.title}),` — `,e.count,` variants finished`]}),(0,X.jsx)(q,{asChild:!0,variant:`outline`,size:`sm`,className:`md:ml-auto`,children:(0,X.jsx)(H,{to:`/compare/${e.groupId}`,children:`Compare`})})]},e.groupId))]}),(0,X.jsx)(H,{to:`/new`,"data-slot":`new-task-fab`,"aria-label":`New task`,className:`fixed right-4 bottom-[calc(16px+env(safe-area-inset-bottom))] z-20 inline-flex size-14 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-modal md:hidden`,children:(0,X.jsx)(bs,{className:`size-[22px]`,"aria-hidden":`true`})})]})}function Av({view:e,query:t,filtered:n=!1,onClearFilters:r=()=>void 0,origin:i=`all`,hiddenByOrigin:a=!1,onShowAll:o=()=>void 0}){let s=t.trim(),c=s?`search-miss`:n?`filtered`:a?`origin-hidden`:e===`archived`?`archive`:`no-tasks`;return(0,X.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":c,className:`flex flex-1 flex-col`,children:c===`filtered`?(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(ca,{}),tone:`neutral`,title:`No tasks match these filters`,actions:(0,X.jsx)(q,{type:`button`,variant:`outline`,onClick:r,children:`Clear filters`})}):c===`origin-hidden`?(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(As,{}),tone:`neutral`,title:i===`regular`?`No regular tasks here`:`No automation tasks here`,subtitle:i===`regular`?`Tasks started by automations are hidden.`:`Only tasks started by automations are shown.`,actions:(0,X.jsx)(q,{type:`button`,variant:`outline`,onClick:o,children:`Show all tasks`})}):c===`search-miss`?(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(ca,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No tasks match “${s}”.`}):c===`archive`?(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(Fr,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(ds,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,X.jsx)(q,{asChild:!0,children:(0,X.jsxs)(H,{to:`/new`,children:[(0,X.jsx)(bs,{"aria-hidden":`true`}),`New task`]})})})})}function jv({runs:e,view:t,origin:n,onOriginChange:r,filters:i,onFiltersChange:a,automations:o,automationNames:s}){let c=Y.useMemo(()=>e.filter(e=>t===`archived`?e.archived:!e.archived),[e,t]),l=Mf(c,i,o),u=e=>jf(c,n,i,o,e),d=u(`statuses`),f=u(`workflows`),p=u(`automations`),m=Nf(c.map(e=>o.get(e.id))),h=(e,t)=>a(n=>({...n,[e]:n[e].includes(t)?n[e].filter(e=>e!==t):[...n[e],t]})),g=e=>a(t=>({...t,[e]:[]})),_=Ef(i);return(0,X.jsxs)(`div`,{"data-slot":`tasks-filters`,className:`mb-3 flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(hr,{slot:`task-origin`,label:`Show tasks started by`,value:n,options:ff.map(e=>({...e,count:l[e.value]})),onChange:r}),(0,X.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,X.jsx)(mr,{slot:`status`,label:`Status`,selected:i.statuses,onToggle:e=>h(`statuses`,e),onClear:()=>g(`statuses`),options:Nf(c.map(e=>e.status)).map(e=>({value:e,label:e,count:d.get(e)??0})),emptyLabel:`No tasks to filter`}),(0,X.jsx)(mr,{slot:`workflow`,label:`Workflow`,selected:i.workflows,onToggle:e=>h(`workflows`,e),onClear:()=>g(`workflows`),options:Nf(c.map(e=>mn(e))).map(e=>({value:e,label:e,count:f.get(e)??0})),emptyLabel:`No tasks to filter`}),n!==`regular`&&m.length>0?(0,X.jsx)(mr,{slot:`automation`,label:`Automation`,selected:i.automations,onToggle:e=>h(`automations`,e),onClear:()=>g(`automations`),options:m.map(e=>({value:e,label:s?.get(e)??e,count:p.get(e)??0})),emptyLabel:`No automation tasks`}):null,_>0?(0,X.jsxs)(`button`,{type:`button`,"data-action":`clear-filters`,onClick:()=>a(()=>Tf),className:`inline-flex h-7 items-center gap-1 rounded-full px-2 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,X.jsx)(Ea,{className:`size-3`,"aria-hidden":`true`}),`Clear (`,_,`)`]}):null]})}function Mv({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:K(`flex h-7 items-center justify-center gap-1.5 rounded-[7px] px-3 text-[12.5px] font-medium text-muted-foreground`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,X.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function Nv({children:e,right:t=!1,columnId:n,folded:r=!1}){return(0,X.jsx)(`th`,{scope:`col`,"data-column-id":n,"data-folded":r||void 0,className:K(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-soft-foreground uppercase first:pl-4 last:pr-4`,t&&`text-right`,r&&`px-0 first:pl-0 last:pr-0`),children:e})}function Pv({column:e,expanded:t,onToggle:n,disabled:r}){if(!e.canFold)return(0,X.jsx)(Nv,{columnId:e.id,right:e.align===`right`,children:e.label});let i=t?`Fold`:`Expand`;return(0,X.jsx)(Nv,{columnId:e.id,right:e.align===`right`,folded:!t,children:(0,X.jsxs)(Ia,{children:[(0,X.jsx)(Aa,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`${i} ${e.label} column`,"aria-pressed":t,disabled:r,onClick:()=>n(e.id),className:K(`inline-flex h-8 w-full items-center gap-1 rounded-sm px-0.5 text-inherit outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-wait disabled:opacity-60`,e.align===`right`?`justify-end`:`justify-start`,!t&&`justify-center px-0`),children:t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:e.label}),(0,X.jsx)(Uo,{className:`size-3 opacity-55`,"aria-hidden":`true`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Fv,{icon:e.icon}),(0,X.jsx)(Wo,{className:`size-3 opacity-70`,"aria-hidden":`true`})]})})}),(0,X.jsxs)(Ma,{side:`top`,children:[e.label,` · `,i,` column`]})]})})}function Fv({icon:e}){let t=`size-3.5`;switch(e){case`workflow`:return(0,X.jsx)(As,{className:t,"aria-hidden":`true`});case`branch`:return(0,X.jsx)(rs,{className:t,"aria-hidden":`true`});case`diff`:return(0,X.jsx)(Zo,{className:t,"aria-hidden":`true`});case`reference`:return(0,X.jsx)(us,{className:t,"aria-hidden":`true`});case`tokens`:return(0,X.jsx)(Ko,{className:t,"aria-hidden":`true`});case`cost`:return(0,X.jsx)(er,{className:t,"aria-hidden":`true`});case`cpu`:return(0,X.jsx)(Or,{className:t,"aria-hidden":`true`});case`memory`:return(0,X.jsx)(fs,{className:t,"aria-hidden":`true`});case`started`:return(0,X.jsx)(Go,{className:t,"aria-hidden":`true`});default:return null}}var Iv=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function Lv({run:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,queuePosition:a,onRename:o,onTogglePin:s,now:c,columns:l,expandedColumns:u}){let f=un(),p=d(e),m=_t(e),h=`/tasks/${e.id}`,g=st(e.costUsd),_=wt(e);return(0,X.jsx)(`tr`,{"data-slot":`task-table-row`,"data-run-id":e.id,"data-depth":t,onClick:e=>{e.target.closest(`a, button, input`)||f(h)},className:`group/row cursor-pointer hover:bg-muted`,children:l.map(l=>{if(l.id===`memory`)return null;if(l.id===`cpu`){let t=wv(`cpu`,u),n=wv(`memory`,u);return a!==null&&(t||n)?(0,X.jsxs)(`td`,{"data-slot":`queue-note`,"data-column-id":`cpu-memory`,colSpan:2,className:K(Iv,`text-right font-mono text-[11.5px] text-soft-foreground`),children:[`#`,a,` in queue`]},l.id):(0,X.jsx)(Vv,{run:e,cpuExpanded:t,memoryExpanded:n},l.id)}return(0,X.jsx)(Rv,{column:l,expanded:wv(l.id,u),run:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,attention:p,scheduled:m,reference:_,cost:g,to:h,onRename:o,onTogglePin:s,now:c},l.id)})})}function Rv({column:e,expanded:t,run:n,depth:r,childCount:i,subtasksExpanded:a,onToggleSubtasks:o,attention:s,scheduled:c,reference:l,cost:u,to:d,onRename:f,onTogglePin:p,now:m}){if(!t)return(0,X.jsx)(zv,{column:e.id});switch(e.id){case`status`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:Iv,children:(0,X.jsxs)(Qa,{dot:s.tone,pulse:s.pulse,title:c?.title,children:[s.label,c?(0,X.jsx)(`span`,{className:`tabular-nums`,children:c.label}):null]})});case`task`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:K(Iv,`min-w-[220px] max-w-0`),children:(0,X.jsx)(Bv,{run:n,depth:r,childCount:i,subtasksExpanded:a,onToggleSubtasks:o,to:d,onRename:f,onTogglePin:p})});case`workflow`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:K(Iv,`text-[12.5px] text-muted-foreground`),children:mn(n)});case`branch`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:Iv,children:n.branch?(0,X.jsx)(Kv,{branch:n.branch}):(0,X.jsx)(Wv,{})});case`diff`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:Iv,children:n.diffStat?(0,X.jsx)(Ya,{stat:n.diffStat}):(0,X.jsx)(Wv,{})});case`reference`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:Iv,children:l?(0,X.jsx)(Pr,{run:n,reference:l}):(0,X.jsx)(Wv,{})});case`tokens`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:K(Iv,`text-right text-xs text-muted-foreground`),children:(0,X.jsx)(Xa,{inputTokens:n.inputTokens,outputTokens:n.outputTokens,variant:`table`,omitWhenUnknown:!1})});case`cost`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:K(Iv,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:u||(0,X.jsx)(Wv,{})});case`started`:return(0,X.jsx)(`td`,{"data-column-id":e.id,className:K(Iv,`text-right text-xs text-soft-foreground tabular-nums`),children:qa(n.startedAt??n.createdAt,m)});case`cpu`:case`memory`:return null}}function zv({column:e}){return(0,X.jsx)(`td`,{role:`presentation`,"aria-hidden":`true`,"data-column-id":e,"data-folded":`true`,className:K(Iv,`px-0 first:pl-0 last:pr-0`)})}function Bv({run:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,to:a,onRename:o,onTogglePin:s}){let c=z(e),l=Kr(c,t=>o(e.id,t)),u=kr(e),d=Dr(e),f=Lf(n),p=t>0?{paddingLeft:`${t*14}px`}:void 0;return l.editing?(0,X.jsx)(`span`,{className:`flex min-w-0 items-center`,style:p,children:(0,X.jsx)(Yr,{editor:l,className:`text-[13px] font-medium`})}):(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,style:p,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`subtask-tick`,className:`shrink-0 font-mono text-[11px] leading-none text-soft-foreground`,children:`└`}):null,(0,X.jsxs)(H,{to:a,title:c,className:K(`min-w-0 truncate text-[13px]`,u?`font-semibold text-foreground`:d?`font-medium text-muted-foreground`:`font-medium`),children:[c,u?(0,X.jsx)(uf,{}):null]}),Rf(e)?(0,X.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:Rf(e)}):null,f?(0,X.jsx)(yv,{label:f,expanded:r,onToggle:()=>i(e.id)}):null,(0,X.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:l.begin,className:`shrink-0 rounded-sm p-0.5 text-soft-foreground opacity-0 transition-opacity group-hover/row:opacity-100 hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(sa,{className:`size-3`,"aria-hidden":`true`})}),s?(0,X.jsx)(lf,{pinned:!!e.pinned,onToggle:t=>s(e,t),className:`size-[19px] opacity-0 group-hover/row:opacity-100 focus-visible:opacity-100 no-hover:opacity-100 data-[pinned=true]:opacity-100`}):null]})}function Vv({run:e,cpuExpanded:t,memoryExpanded:n}){let r=Ye(e,ur(e.id));return(0,X.jsxs)(X.Fragment,{children:[t?(0,X.jsx)(Hv,{column:`cpu`,cell:r.cpu}):(0,X.jsx)(zv,{column:`cpu`}),n?(0,X.jsx)(Hv,{column:`memory`,cell:r.mem}):(0,X.jsx)(zv,{column:`memory`})]})}function Hv({column:e,cell:t}){return(0,X.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-column-id":e,"data-usage-kind":t.kind,title:t.title,className:K(Iv,`text-right font-mono tabular-nums`,t.kind===`live`&&`bg-violet/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-[11.5px] text-soft-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:t.text||`—`})}function Uv({run:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,queuePosition:a,now:o,showTokens:s,showCost:c,onTogglePin:l}){let u=un(),f=d(e),p=_t(e),m=`/tasks/${e.id}`,h=wt(e),g=kr(e),_=Dr(e),v=st(e.costUsd),y=Lf(n),b=e.inputTokens!==void 0||e.outputTokens!==void 0;return(0,X.jsxs)(`div`,{"data-slot":`task-card`,"data-run-id":e.id,"data-depth":t,style:t>0?{marginLeft:`${t*14}px`}:void 0,onClick:e=>{e.target.closest(`a, button`)||u(m)},className:`cursor-pointer rounded-lg border border-border bg-card px-3.5 py-3 shadow-xs`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,X.jsxs)(Qa,{dot:f.tone,pulse:f.pulse,className:`mt-px shrink-0`,title:p?.title,children:[f.label,p?(0,X.jsx)(`span`,{className:`tabular-nums`,children:p.label}):null]}),(0,X.jsxs)(H,{to:m,className:K(`min-w-0 flex-1 text-[13.5px] leading-[1.35]`,g?`font-semibold text-foreground`:_?`font-medium text-muted-foreground`:`font-medium`),children:[z(e),g?(0,X.jsx)(uf,{}):null]}),Rf(e)?(0,X.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`mt-px shrink-0 rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:Rf(e)}):null,y?(0,X.jsx)(yv,{label:y,expanded:r,onToggle:()=>i(e.id),className:`mt-px`}):null,(0,X.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[11.5px] text-soft-foreground tabular-nums`,children:qa(e.finishedAt??e.createdAt,o)}),l?(0,X.jsx)(lf,{pinned:!!e.pinned,onToggle:t=>l(e,t),className:`-mr-1 mt-px`}):null]}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 font-mono text-[11.5px] font-medium text-muted-foreground tabular-nums`,children:[(0,X.jsx)(`span`,{children:mn(e)}),a===null?(0,X.jsxs)(X.Fragment,{children:[e.branch?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Gv,{}),(0,X.jsx)(`span`,{children:e.branch})]}):null,e.diffStat?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Gv,{}),(0,X.jsx)(Ya,{stat:e.diffStat,className:`text-[11.5px]`})]}):null,s&&b?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Gv,{}),(0,X.jsx)(Xa,{inputTokens:e.inputTokens,outputTokens:e.outputTokens})]}):null,c&&v?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Gv,{}),(0,X.jsx)(`span`,{children:v})]}):null]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Gv,{}),(0,X.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,a,` in queue`]})]}),h?(0,X.jsx)(Pr,{run:e,reference:h,className:`h-5`}):null]})]})}function Wv(){return(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function Gv(){return(0,X.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`})}function Kv({branch:e}){return(0,X.jsx)(`span`,{className:`rounded-[6px] bg-muted px-1.5 py-0.5 font-mono text-[11.5px] font-medium text-muted-foreground`,children:e})}function qv(){let e=S(),t=Ja(Se().data),[n,r]=qd(),i=I(),a=k({mutationFn:m,onSuccess:()=>i.invalidateQueries({queryKey:B.runs.all})}),o=k({mutationFn:Mt,onSuccess:()=>i.invalidateQueries({queryKey:B.runs.all}),onError:e=>V(e.message,{tone:`danger`})}),s=k({mutationFn:({id:e,title:t})=>le(e,{title:t}),onSuccess:e=>{pt(i,e),i.invalidateQueries({queryKey:B.runs.all})},onError:e=>V(e.message,{tone:`danger`})}),c=Jt(),l=wa(3e4),u=Ov(),[d,f]=wf(),p=lr(),h=Y.useMemo(()=>(e.data??[]).some(e=>e.automation??e.automationTrigger??e.automationTracker),[e.data]),g=nr(p.known&&!p.off&&h&&d!==`regular`),_=Y.useMemo(()=>new Map((g.data?.automations??[]).map(e=>[e.id,e.name])),[g.data]),v=Vt();return(0,X.jsx)(ni,{projectId:v,requests:Y.useMemo(()=>v===void 0?[]:(e.data??[]).flatMap(e=>yt(e).map(e=>({projectId:v,kind:e.kind,number:e.number}))),[e.data,v]),children:(0,X.jsx)(kv,{runs:e.data,view:n,onViewChange:r,onArchiveFinished:()=>a.mutate(),onMarkAllRead:()=>o.mutate(),onRename:(e,t)=>s.mutate({id:e,title:t}),onTogglePin:(e,t)=>c.mutate({id:e.id,pinned:t},{onError:e=>V(e.message,{tone:`danger`})}),now:l,showTokens:t.tokens,showCost:t.cost,expandedColumns:u.expandedColumns,onToggleColumn:u.toggleColumn,columnsPending:u.isPending,origin:d,onOriginChange:f,automationNames:_})})}var Jv=` untagged`,Yv=[{value:`project`,label:`Project`},{value:`tag`,label:`Tag`},{value:`status`,label:`Status`},{value:`workflow`,label:`Workflow`}];function Xv(e,t){return e===t?`none`:t}var Zv={query:``,tags:[],statuses:[],workflows:[]};function Qv(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function $v(e){return e.tags.length+e.statuses.length+e.workflows.length}function ey(e){return e.query.trim()!==``||$v(e)>0}function ty(e){return $v(e.filters)+(e.filters.query.trim()===``?0:1)+(e.groupBy===`none`?0:1)}function ny(e){return ty(e)>0}function ry(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.projectId);return{run:e,project:t,projectName:t?.name||e.projectId,tags:t?.tags??[]}})}var iy=e=>`${e.projectId}/${e.id}`;function ay(e){let t=new Map(e.map(e=>[iy(e.run),e.run]));return new Map(e.map(e=>[iy(e.run),hf(e.run,n=>t.get(`${e.run.projectId}/${n}`))]))}function oy(e,t,n){return e.filter(e=>gf(n.get(iy(e.run)),t))}function sy(e){let t=new Set;for(let n of e)t.add(n.run.workflow);return[...t].sort((e,t)=>e.localeCompare(t))}function cy(e){let t=new Set;for(let n of e)t.add(n.run.status);return[...t].sort((e,t)=>e.localeCompare(t))}function ly(e,t){let n=new Map;for(let r of e)for(let e of t(r))n.set(e,(n.get(e)??0)+1);return n}var uy=e=>e.tags.length===0?[Jv]:e.tags,dy=(e,t)=>e.length===0||t.some(t=>e.includes(t)),fy=(e,t)=>{if(t.length===0)return!0;let n=uy(e).map(e=>e.toLowerCase());return t.some(e=>n.includes(e.toLowerCase()))};function py(e){return[z(e.run),e.projectName,e.run.workflow,e.run.branch??``,...e.tags].join(`
|
|
21
|
-
`).toLowerCase()}function my(e,t,n){let r=t.query.trim().toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>{if((n===`archived`?!e.run.archived:e.run.archived)||!dy(t.statuses,[e.run.status])||!dy(t.workflows,[e.run.workflow])||!fy(e,t.tags))return!1;if(r.length===0)return!0;let i=py(e);return r.every(e=>i.includes(e))})}function hy(e,t,n,r){return my(e,{...t,[r]:[]},n)}function gy(e,t){if(t===`none`)return[{key:`all`,label:``,tasks:[...e]}];let n=new Map,r=(e,t,r)=>{let i=n.get(e);i?i.tasks.push(r):n.set(e,{key:e,label:t,tasks:[r]})};for(let n of e)if(t===`project`)r(n.run.projectId,n.projectName,n);else if(t===`status`)r(n.run.status,n.run.status,n);else if(t===`workflow`)r(n.run.workflow,n.run.workflow,n);else if(n.tags.length===0)r(Jv,`Untagged`,n);else for(let e of n.tags)r(e.toLowerCase(),e,n);return[...n.values()].sort((e,t)=>e.key===` untagged`?1:t.key===` untagged`?-1:t.tasks.length-e.tasks.length||e.label.localeCompare(t.label))}function _y(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var vy={query:`q`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,archived:`archived`},yy=new Set(Yv.map(e=>e.value));function by(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set(vy.query,n);for(let n of e.filters.tags)n===` untagged`?t.set(vy.untagged,`1`):t.append(vy.tag,n);for(let n of e.filters.statuses)t.append(vy.status,n);for(let n of e.filters.workflows)t.append(vy.workflow,n);return e.groupBy!==`none`&&t.set(vy.groupBy,e.groupBy),e.view===`archived`&&t.set(vy.archived,`1`),t}function xy(e){let t=e.getAll(vy.tag).filter(e=>e!==``);e.get(vy.untagged)===`1`&&t.push(Jv);let n=e.get(vy.groupBy)??``;return{filters:{query:e.get(vy.query)??``,tags:t,statuses:e.getAll(vy.status).filter(e=>e!==``),workflows:e.getAll(vy.workflow).filter(e=>e!==``)},groupBy:yy.has(n)?n:`none`,view:e.get(vy.archived)===`1`?`archived`:`active`}}var Sy=15e3,Cy=250,wy=1,Ty=220,Ey=new Set([`done`,`failed`,`cancelled`]);function Dy(){return ky({request:({task:e,archived:t})=>Ne(e.run.projectId,e.run.id,t),patch:({archived:e})=>t=>({...t,archived:e})})}function Oy(){return ky({request:({task:e,read:t})=>gt(e.run.projectId,e.run.id,t),patch:({read:e})=>t=>{if(e)return{...t,seenAt:new Date().toISOString()};let{seenAt:n,...r}=t;return r}})}function ky({request:e,patch:t}){let n=I();return k({mutationFn:e,onMutate:async e=>{await n.cancelQueries({queryKey:c.runsIndex});let r=n.getQueryData(c.runsIndex),i=t(e),{task:a}=e;return n.setQueryData(c.runsIndex,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===a.run.projectId&&e.id===a.run.id?i(e):e)}),{previous:r}},onError:(e,t,r)=>{r?.previous&&n.setQueryData(c.runsIndex,r.previous),V(e.message,{tone:`danger`})},onSettled:(e,t,{task:r})=>{n.invalidateQueries({queryKey:c.runsIndex}),n.invalidateQueries({queryKey:B.runs.all}),n.invalidateQueries({queryKey:[r.run.projectId,`runs`,`list`]})}})}function Ay(){let e=ye(),t=Ja(Se().data),n=Nt(!0,Sy),[r,i]=Ae(),{filters:a,groupBy:o,view:s}=Y.useMemo(()=>xy(r),[r]),[c,l]=qd();Y.useEffect(()=>{c!==s&&l(s)},[s,c,l]);let u=wa(3e4),d=e=>i(t=>by(e(xy(t))),{replace:!0}),f=e=>d(t=>({...t,filters:e(t.filters)})),p=e=>d(t=>({...t,groupBy:e})),m=e=>d(t=>({...t,view:e})),[h,g]=Y.useState(a.query),[_,v]=Y.useState(new Set),y=e=>v(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),b=a.query.trim()!==``,x=e=>b||_.has(e),S=Y.useRef(a.query);Y.useEffect(()=>{a.query!==S.current&&g(a.query),S.current=a.query},[a.query]),Y.useEffect(()=>{if(h===S.current)return;let e=setTimeout(()=>{S.current=h,f(e=>({...e,query:h}))},Cy);return()=>clearTimeout(e)},[h]);let C=n.data?.referenceStatuses;Y.useEffect(()=>{C&&St(C)},[C]);let w=Y.useMemo(()=>e.data?.projects??[],[e.data]),T=Y.useMemo(()=>ry(n.data?.runs??[],w),[n.data,w]),[E,D]=wf(),O=Y.useMemo(()=>ay(T),[T]),k=Y.useMemo(()=>oy(T,E,O),[T,E,O]),A=Y.useMemo(()=>{let e=e=>my(oy(T,e,O),a,s).length;return{regular:e(`regular`),automation:e(`automation`),all:e(`all`)}},[T,O,a,s]),j=Y.useMemo(()=>my(k,a,s),[k,a,s]),M=Y.useMemo(()=>gy(j,o),[j,o]),N=Y.useMemo(()=>j.flatMap(e=>yt(e.run,e.project?.repoUrl).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[j]),P=_y(n.data?.truncated??[],w),F=(e,t)=>f(n=>({...n,[e]:Qv(n[e],t)})),ee=e=>f(t=>({...t,[e]:[]})),te=Dy(),I=Oy();if(n.isError||e.isError)return(0,X.jsx)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(ls,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:(n.error??e.error)?.message})});let ne=(0,X.jsxs)(`div`,{className:`relative w-full md:w-60`,children:[(0,X.jsx)(la,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-soft-foreground`,"aria-hidden":`true`}),(0,X.jsx)(`input`,{type:`text`,value:h,onChange:e=>g(e.target.value),placeholder:`Search every project…`,"aria-label":`Search tasks across projects`,className:`h-9 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]});return(0,X.jsxs)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:[(0,X.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,X.jsx)(`h1`,{className:`text-base font-semibold`,children:`All tasks`}),(0,X.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,X.jsx)(jy,{view:`active`,current:s,onSelect:m,children:`Active`}),(0,X.jsx)(jy,{view:`archived`,current:s,onSelect:m,children:`Archived`})]}),(0,X.jsx)(`div`,{className:`flex-1`}),(0,X.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`text-[12.5px] text-soft-foreground tabular-nums`,children:[j.length,` of `,T.length]}),ne]}),(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col gap-3 p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[(0,X.jsx)(`div`,{className:`md:hidden`,children:ne}),(0,X.jsx)(My,{filters:a,onToggle:F,onClearFacet:ee,onClearAll:()=>{g(``),d(e=>({...e,filters:Zv,groupBy:`none`}))},groupBy:o,onGroupByChange:p,projects:w,tasks:k,view:s,origin:E,onOriginChange:D,originCounts:A}),P.length>0?(0,X.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-[11.5px] text-soft-foreground`,children:[`Showing the newest `,n.data?.perProjectLimit,` tasks per project — older ones in`,` `,P.join(`, `),` are only in that project’s own Tasks page.`]}):null,n.data===void 0?null:j.length===0?(0,X.jsx)(Gy,{view:s,filtered:ey(a),origin:E,hiddenByOrigin:E!==`all`&&A.all>0,onShowAll:()=>D(`all`)}):(0,X.jsx)(ni,{requests:N,children:M.map(e=>(0,X.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":e.key,children:[o===`none`?null:(0,X.jsxs)(`h2`,{className:`mb-1.5 flex items-center gap-2 text-[12px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:[o===`project`?(0,X.jsx)(pe,{to:Qt(e.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:e.label}):e.label,(0,X.jsx)(`span`,{className:`font-mono text-[11px] font-medium tabular-nums`,children:e.tasks.length})]}),(0,X.jsx)(Py,{tasks:e.tasks,now:u,isSubtasksExpanded:x,onToggleSubtasks:y,showProject:o!==`project`,onArchive:(e,t)=>te.mutate({task:e,archived:t}),onSetRead:(e,t)=>I.mutate({task:e,read:t}),busy:te.isPending||I.isPending,showCost:t.cost})]},e.key))})]})]})}function jy({view:e,current:t,onSelect:n,children:r}){let i=e===t;return(0,X.jsx)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":i,onClick:()=>n(e),className:K(`flex h-7 items-center justify-center rounded-[7px] px-3 text-[12.5px] font-medium text-muted-foreground`,i&&`bg-card font-semibold text-foreground shadow-xs`),children:r})}function My({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,projects:o,tasks:s,view:c,origin:l,onOriginChange:u,originCounts:d}){let f=Y.useMemo(()=>Bt(o),[o]),p=Y.useMemo(()=>{let t=(t,n)=>ly(hy(s,e,c,t),n);return{tags:t(`tags`,uy),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[s,e,c]),m=e=>t=>({...t,count:e.get(t.value)??0});return(0,X.jsxs)(`div`,{"data-slot":`global-tasks-filters`,className:`flex flex-col gap-2 rounded-lg border border-border bg-card p-2.5 shadow-xs`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(hr,{slot:`task-origin`,label:`Show tasks started by`,value:l,options:ff.map(e=>({...e,count:d[e.value]})),onChange:u}),(0,X.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,X.jsx)(mr,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:cy(s).map(e=>({value:e,label:e})).map(m(p.statuses)),emptyLabel:`No tasks to filter`}),(0,X.jsx)(mr,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:sy(s).map(e=>({value:e,label:e})).map(m(p.workflows)),emptyLabel:`No tasks to filter`}),(0,X.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Group by`}),(0,X.jsx)(ir,{slot:`group-by`,label:`Group tasks by`,value:i,options:Yv,onChange:e=>a(Xv(i,e))}),ny({filters:e,groupBy:i})?(0,X.jsxs)(`button`,{type:`button`,"data-action":`clear-filters`,onClick:r,className:`ml-auto inline-flex h-7 items-center gap-1 rounded-full px-2 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,X.jsx)(Ea,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${ty({filters:e,groupBy:i})})`]}):null]}),f.length>0?(0,X.jsxs)(`div`,{"data-slot":`tag-filters`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Tags`}),f.map(n=>(0,X.jsx)(dr,{slot:`tag-filter`,tone:`tag`,label:n,count:p.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,X.jsx)(dr,{slot:`tag-filter`,label:`Untagged`,count:p.tags.get(` untagged`)??0,selected:e.tags.includes(Jv),onToggle:()=>t(`tags`,Jv)})]}):(0,X.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-[11px] text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,X.jsx)(pe,{to:`/settings/global/projects`,className:`font-medium text-violet hover:underline`,children:`Settings → Projects`}),` `,`to group their tasks together here.`]})]})}var Ny=e=>e.dispatch;function Py({tasks:e,now:t,isSubtasksExpanded:n,onToggleSubtasks:r,showProject:i,onArchive:a,onSetRead:o,busy:s,showCost:c}){return(0,X.jsx)(`div`,{"data-slot":`global-tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card shadow-xs`,children:(0,X.jsx)(Pa,{children:(0,X.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(Fy,{className:`w-[104px]`,children:`Status`}),(0,X.jsx)(Fy,{children:`Task`}),i?(0,X.jsx)(Fy,{className:`w-[124px]`,children:`Project`}):null,(0,X.jsx)(Fy,{className:`hidden w-[120px] xl:table-cell`,children:`Tags`}),(0,X.jsx)(Fy,{className:`w-[84px]`,children:`Ref`}),(0,X.jsx)(Fy,{className:`hidden w-[108px] xl:table-cell`,children:`Workflow`}),c?(0,X.jsx)(Fy,{className:`hidden w-[64px] text-right lg:table-cell`,children:`Cost`}):null,(0,X.jsx)(Fy,{className:`hidden w-[56px] text-right xl:table-cell`,children:`CPU`}),(0,X.jsx)(Fy,{className:`hidden w-[84px] text-right xl:table-cell`,children:`Mem`}),(0,X.jsx)(Fy,{className:`w-[56px] text-right`,children:`Age`}),(0,X.jsx)(Fy,{className:`w-[64px] text-right`,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,X.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:If(e.map(e=>({id:e.run.id,dispatch:Ny(e.run),task:e})),n).map(e=>(0,X.jsx)(Ly,{task:e.run.task,depth:e.depth,childCount:e.childCount,subtasksExpanded:n(e.run.id),onToggleSubtasks:r,now:t,showProject:i,onArchive:a,onSetRead:o,busy:s,showCost:c},`${e.run.task.run.projectId}/${e.run.task.run.id}`))})]})})})}function Fy({children:e,className:t}){return(0,X.jsx)(`th`,{scope:`col`,className:K(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-soft-foreground uppercase first:pl-4 last:pr-4`,t),children:e})}var Iy=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function Ly({task:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,now:a,showProject:o,onArchive:s,onSetRead:c,busy:l,showCost:u}){let{run:f}=e,p=d(f),m=Qt(f.projectId,`/tasks/${f.id}`),h=kr(f),g=Dr(f),_=yt(f,e.project?.repoUrl),v=Lf(n),y=Ye(f,f.usage);return(0,X.jsxs)(`tr`,{"data-slot":`global-task-row`,"data-run-id":f.id,"data-project":f.projectId,"data-depth":t,className:`hover:bg-muted`,children:[(0,X.jsx)(`td`,{className:Iy,children:(0,X.jsx)(Qa,{dot:p.tone,pulse:p.pulse,children:p.label})}),(0,X.jsx)(`td`,{className:K(Iy,`min-w-[320px] max-w-0`),children:(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,style:t>0?{paddingLeft:`${t*14}px`}:void 0,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`subtask-tick`,className:`shrink-0 font-mono text-[11px] leading-none text-soft-foreground`,children:`└`}):null,(0,X.jsxs)(pe,{to:m,title:z(f),className:K(`min-w-0 truncate text-[13px]`,h?`font-semibold text-foreground`:g?`font-medium text-muted-foreground`:`font-medium`),children:[z(f),h?(0,X.jsx)(uf,{}):null]}),Rf(f)?(0,X.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:Rf(f)}):null,v?(0,X.jsx)(yv,{label:v,expanded:r,onToggle:()=>i(f.id)}):null]})}),o?(0,X.jsx)(`td`,{className:K(Iy,`text-[12.5px] text-muted-foreground`),children:(0,X.jsx)(pe,{to:Qt(f.projectId,`/`),className:`truncate hover:text-foreground`,children:e.projectName})}):null,(0,X.jsx)(`td`,{className:K(Iy,`hidden xl:table-cell`),children:e.tags.length>0?(0,X.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:e.tags.map(e=>(0,X.jsx)(Hy,{tag:e},e))}):(0,X.jsx)(Wy,{})}),(0,X.jsx)(`td`,{className:Iy,children:_.length>0?(0,X.jsx)(By,{references:_,run:f}):(0,X.jsx)(Wy,{})}),(0,X.jsx)(`td`,{className:K(Iy,`hidden text-[12.5px] text-muted-foreground xl:table-cell`),children:f.workflow}),u?(0,X.jsx)(`td`,{className:K(Iy,`hidden text-right font-mono text-xs text-muted-foreground tabular-nums lg:table-cell`),children:st(f.costUsd)||(0,X.jsx)(Wy,{})}):null,(0,X.jsx)(Uy,{column:`cpu`,cell:y.cpu}),(0,X.jsx)(Uy,{column:`memory`,cell:y.mem}),(0,X.jsx)(`td`,{className:K(Iy,`text-right text-xs text-soft-foreground tabular-nums`),children:qa(f.startedAt??f.createdAt,a)}),(0,X.jsx)(`td`,{className:K(Iy,`text-right`),children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,X.jsx)(Ry,{task:e,busy:l,onSetRead:c}),(0,X.jsx)(zy,{task:e,busy:l,onArchive:s})]})})]})}function Ry({task:e,busy:t,onSetRead:n}){if(!Mr(e.run))return null;let r=kr(e.run),i=z(e.run),a=r?`Mark ${i} read`:`Mark ${i} unread`,o=r?ra:Yo;return(0,X.jsxs)(Ia,{children:[(0,X.jsx)(Aa,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"data-action":r?`mark-read`:`mark-unread`,"aria-label":a,disabled:t,onClick:()=>n(e,r),className:K(`inline-flex size-7 items-center justify-center rounded-md transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,r?`text-violet`:`text-soft-foreground`),children:(0,X.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(Ma,{side:`left`,children:r?`Mark read`:`Mark unread`})]})}function zy({task:e,busy:t,onArchive:n}){let r=e.run.archived;if(!r&&!Ey.has(e.run.status))return null;let i=r?`Restore ${z(e.run)} to the active list`:`Archive ${z(e.run)}`;return(0,X.jsxs)(Ia,{children:[(0,X.jsx)(Aa,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"data-action":r?`unarchive-run`:`archive-run`,"aria-label":i,disabled:t,onClick:()=>n(e,!r),className:`inline-flex size-7 items-center justify-center rounded-md text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,children:(0,X.jsx)(r?Ir:Fr,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(Ma,{side:`left`,children:r?`Restore`:`Archive`})]})}function By({references:e,run:t}){let n=e.slice(0,wy),r=e.length-n.length,i=z(t);return(0,X.jsxs)(`span`,{className:`flex flex-nowrap items-center gap-1`,children:[n.map(e=>(0,X.jsx)(ui,{reference:e,taskTitle:i,projectId:t.projectId,conflictAction:(0,X.jsx)(Qr,{projectId:t.projectId,runId:t.id,prNumber:e.number}),className:`shrink-0`},`${e.kind}#${e.number}`)),r>0?(0,X.jsx)(Vy,{references:e,taskTitle:i,hidden:r,projectId:t.projectId}):null]})}function Vy({references:e,taskTitle:t,hidden:n,projectId:r}){let[i,a]=Y.useState(!1),o=Y.useRef(!1),s=Y.useRef(void 0);Y.useEffect(()=>()=>clearTimeout(s.current),[]);let c=e=>e.pointerType!==`touch`,l=()=>clearTimeout(s.current),u=e=>{c(e)&&(l(),o.current=!0,a(!0))},d=e=>{c(e)&&(l(),s.current=setTimeout(()=>a(!1),Ty))};return(0,X.jsxs)(li,{open:i,onOpenChange:a,children:[(0,X.jsx)(ci,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`reference-overflow`,"aria-label":`Show all ${e.length} references for ${t}`,onPointerEnter:u,onPointerLeave:d,onPointerDown:()=>{o.current=!1},onClick:()=>{o.current=!1},className:`shrink-0 rounded-full px-1 text-[11px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[`+`,n]})}),(0,X.jsxs)(ti,{align:`start`,className:`w-auto min-w-40 p-1.5`,"data-slot":`reference-overflow-list`,onPointerEnter:u,onPointerLeave:d,onOpenAutoFocus:e=>{o.current&&e.preventDefault()},onCloseAutoFocus:e=>{o.current&&e.preventDefault()},children:[(0,X.jsx)(`p`,{className:`px-1 pb-1.5 text-[10.5px] text-soft-foreground`,children:`References`}),(0,X.jsx)(`span`,{className:`flex flex-col items-start gap-1`,children:e.map(e=>(0,X.jsx)(ui,{reference:e,taskTitle:t,projectId:r},`${e.kind}#${e.number}`))})]})]})}function Hy({tag:e,className:t}){return(0,X.jsx)(`span`,{"data-slot":`project-tag`,className:K(`inline-flex max-w-full items-center truncate rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,t),children:e})}function Uy({column:e,cell:t}){return(0,X.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-usage-kind":t.kind,title:t.title,className:K(Iy,`hidden text-right font-mono tabular-nums xl:table-cell`,t.kind===`live`&&`bg-violet/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-[11.5px] text-soft-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:t.text||`—`})}function Wy(){return(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function Gy({view:e,filtered:t,origin:n=`all`,hiddenByOrigin:r=!1,onShowAll:i=()=>void 0}){return r?(0,X.jsx)(`div`,{"data-slot":`global-tasks-empty`,"data-empty-kind":`origin-hidden`,children:(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(ls,{}),tone:`neutral`,title:n===`regular`?`No regular tasks here`:`No automation tasks here`,subtitle:n===`regular`?`Tasks started by automations are hidden.`:`Only tasks started by automations are shown.`,actions:(0,X.jsx)(q,{type:`button`,variant:`outline`,onClick:i,children:`Show all tasks`})})}):t?(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(ca,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(Fr,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(ds,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}var Ky=(0,Y.lazy)(()=>Jn(()=>import(`./dashboard-CpCDiZdE.js`).then(e=>({default:e.DashboardRoute})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]))),qy=(0,Y.lazy)(()=>Jn(()=>import(`./task-thread-CRVmwchQ.js`).then(e=>({default:e.TaskThreadRoute})),__vite__mapDeps([19,1,2,3,4,5,7,8,20,9,10,11,12,13,21,22,23,24,14,15,25,17,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49]))),Jy=(0,Y.lazy)(()=>Jn(()=>import(`./compare-variants-CfqICvRy.js`).then(e=>({default:e.CompareVariantsRoute})),__vite__mapDeps([50,1,2,3,4,5,14,17,29,40,31,32,13,34,35,36,37,45]))),Yy=(0,Y.lazy)(()=>Jn(()=>import(`./task-changes-xNbBM7FO.js`).then(e=>({default:e.TaskChangesRoute})),__vite__mapDeps([51,1,2,3,4,5,20,9,10,11,12,13,21,22,23,26,14,27,28,29,30,31,32,33,34,35,36,37,38,52,15,8,41,25,53,54,49,44,55,17,47,56,39,46,24,48]))),Xy=(0,Y.lazy)(()=>Jn(()=>import(`./task-files-MAPO-efK.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([57,1,2,3,4,5,17,26,20,9,10,11,12,13,21,22,23,14,27,28,29,30,31,32,33,34,35,36,37,38,58,47]))),Zy=(0,Y.lazy)(()=>Jn(()=>import(`./task-commits-BYozE_X3.js`).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([59,1,2,3,4,5,20,9,10,11,12,13,21,22,23,60,26,14,27,28,29,30,31,32,33,34,35,36,37,38,52,40,56,39,49,44,61,43]))),Qy=(0,Y.lazy)(()=>Jn(()=>import(`./repo-git-Mn3_jrGP.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([62,1,2,3,4,5,60,14,17,22,12,58,11,29,35,32,36,37,47,52,40,56,39,33,53,54,49,44,38,55,28,23,61,43]))),$y=(0,Y.lazy)(()=>Jn(()=>import(`./github-C4WaHPni.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([63,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,20,21,22,23,60,24,25,64,17,29,54,65,66,41,35,32,36,37,43,67,39,49,33,44,38]))),eb=(0,Y.lazy)(()=>Jn(()=>import(`./tracker-DM5WtYD0.js`).then(e=>({default:e.TrackerRoute})),__vite__mapDeps([68,1,2,3,4,5,20,9,10,11,12,13,21,22,23,60,14,29,65,15,8,66,41,25,35,32,36,37,67,24,39]))),tb=(0,Y.lazy)(()=>Jn(()=>import(`./task-graph-BSLCUr1E.js`).then(e=>({default:e.TaskGraphRoute})),__vite__mapDeps([69,1,2,3,4,5,26,20,9,10,11,12,13,21,22,23,14,27,28,29,30,31,32,33,34,35,36,37,38,70,18,52,71,54,66,8,41,72]))),nb=(0,Y.lazy)(()=>Jn(()=>import(`./workflow-graph-Y2Pr7ubb.js`).then(e=>({default:e.WorkflowGraphRoute})),__vite__mapDeps([70,1,2,3,4,5,21,10,18,23,52,71,11,29,54,66,8,32,41,72]))),rb=(0,Y.lazy)(()=>Jn(()=>import(`./skills-Dea5ynJK.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([73,1,2,3,4,5,20,9,10,11,12,13,21,22,23,60,24,14,15,8,25,29,65]))),ib=(0,Y.lazy)(()=>Jn(()=>import(`./automations-route-BsflncpV.js`).then(e=>({default:e.AutomationsRoute})),__vite__mapDeps([74,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,20,21,22,23,60,24,25,16,64,17,27,39,71,29,30,31,32,34,41])));function ab(){let e=p();return new URLSearchParams(e.search).get(`skill`)===`__bm`?(0,X.jsx)(Qe,{to:{pathname:`/settings/bookmarklets`,hash:e.hash},replace:!0}):(0,X.jsx)(Qe,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function ob({sectionId:e}){let t=p();return(0,X.jsx)(E,{to:{pathname:fv(`global`,e),search:t.search,hash:t.hash},replace:!0})}function sb(){return(0,X.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function cb(){let{projectId:e=``}=N(),t=p(),n=ye(),r=Se();if(e==="default"){let e=n.data?.bootProject??(n.isError?r.data?.bootProject:void 0);if(e!==void 0){let n=t.pathname.replace(/^\/p\/default(?=\/|$)/,``);return(0,X.jsx)(E,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,X.jsx)(sb,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,X.jsx)(vh,{projectId:e,registry:n.data})}else if(!n.isError)return(0,X.jsx)(sb,{});return(0,X.jsx)(ee,{projectId:n.data?.bootProject===e?null:e,children:(0,X.jsx)(F,{},e)})}function lb(){let{projectId:e=``}=N();return(0,X.jsx)(ah,{},e)}function ub(){let e=p(),t=Se(),n=ye(),r=t.data?.bootProject??n.data?.bootProject,i=(t.data!==void 0||t.isError)&&(n.data!==void 0||n.isError);if(r===void 0&&!i)return(0,X.jsx)(sb,{});let a=r??`default`;if(e.pathname===`/`&&e.search===``&&e.hash===``){if(n.data===void 0&&!n.isError)return(0,X.jsx)(sb,{});let e=Cp(_p(),n.data,r);if(e!==null)return(0,X.jsx)(E,{to:e,replace:!0});let t=wp(n.data,a);if(t!==a)return(0,X.jsx)(E,{to:`/p/${encodeURIComponent(t)}/`,replace:!0})}let o=e.pathname===`/p`||e.pathname===`/p/`?`/`:e.pathname;return(0,X.jsx)(E,{to:`/p/${encodeURIComponent(a)}${o}${e.search}${e.hash}`,replace:!0})}var db=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/tasks`,pageLabel:`All tasks`},{pattern:`/dashboard`,pageLabel:`Dashboard`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/compare/:groupId`,pageLabel:`Compare`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/tracker/*`,pageLabel:`Tracker`},{pattern:`/automations/*`,pageLabel:`Automations`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/inbox`,pageLabel:`Inbox`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function fb(e){let t=it(e),n=bn({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:db.find(({pattern:e})=>bn({path:e,end:!0},t))?.pageLabel??null,taskId:null}}var pb=(0,Y.memo)(function(){let e=Se().data?.capabilities;return(0,X.jsxs)(Ce,{children:[(0,X.jsxs)(L,{path:`/p/:projectId`,element:(0,X.jsx)(cb,{}),children:[(0,X.jsx)(L,{index:!0,element:(0,X.jsx)(qv,{})}),(0,X.jsx)(L,{path:`new`,element:(0,X.jsx)(lb,{})}),(0,X.jsx)(L,{path:`tasks/:id`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(ao,{}),children:(0,X.jsx)(qy,{})})}),(0,X.jsx)(L,{path:`tasks/:id/changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(bh,{tab:`changes`}),children:(0,X.jsx)(Yy,{})})}),(0,X.jsx)(L,{path:`tasks/:id/files`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(bh,{tab:`files`}),children:(0,X.jsx)(Xy,{})})}),(0,X.jsx)(L,{path:`tasks/:id/graph`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(bh,{tab:`changes`}),children:(0,X.jsx)(tb,{})})}),(0,X.jsx)(L,{path:`tasks/:id/commits`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(bh,{tab:`changes`}),children:(0,X.jsx)(Zy,{})})}),(0,X.jsx)(L,{path:`tasks/:id/commits/:sha`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(bh,{tab:`changes`}),children:(0,X.jsx)(Zy,{})})}),(0,X.jsx)(L,{path:`compare/:groupId`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Dp,{}),children:(0,X.jsx)(Jy,{})})}),(0,X.jsx)(L,{path:`git`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gh,{}),children:(0,X.jsx)(Qy,{tab:`changes`})})}),(0,X.jsx)(L,{path:`git/commits`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gh,{}),children:(0,X.jsx)(Qy,{tab:`commits`})})}),(0,X.jsx)(L,{path:`git/commits/:sha`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gh,{}),children:(0,X.jsx)(Qy,{tab:`commits`})})}),(0,X.jsx)(L,{path:`git/branches`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gh,{}),children:(0,X.jsx)(Qy,{tab:`branches`})})}),(0,X.jsx)(L,{path:`git/files`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gh,{}),children:(0,X.jsx)(Qy,{tab:`files`})})}),(0,X.jsx)(L,{path:`git/files/*`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(gh,{}),children:(0,X.jsx)(Qy,{tab:`files`})})}),(0,X.jsx)(L,{path:`github`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Op,{}),children:(0,X.jsx)($y,{view:`issues`,index:!0})})}),(0,X.jsx)(L,{path:`tracker`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(sb,{}),children:(0,X.jsx)(eb,{})})}),(0,X.jsx)(L,{path:`tracker/:id`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(sb,{}),children:(0,X.jsx)(eb,{})})}),(0,X.jsx)(L,{path:`github/prs`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Op,{}),children:(0,X.jsx)($y,{view:`prs`})})}),(0,X.jsx)(L,{path:`github/issues/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Op,{}),children:(0,X.jsx)($y,{view:`issues`})})}),(0,X.jsx)(L,{path:`github/prs/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Op,{}),children:(0,X.jsx)($y,{view:`prs`})})}),(0,X.jsx)(L,{path:`github/prs/:n/changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Op,{}),children:(0,X.jsx)($y,{view:`prs`,changes:!0})})}),(0,X.jsx)(L,{path:`automations`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ep,{}),children:(0,X.jsx)(ib,{})})}),(0,X.jsx)(L,{path:`automations/new`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ep,{}),children:(0,X.jsx)(ib,{mode:`new`})})}),(0,X.jsx)(L,{path:`automations/:automationId`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ep,{}),children:(0,X.jsx)(ib,{mode:`edit`})})}),(0,X.jsx)(L,{path:`automations/:automationId/log`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ep,{}),children:(0,X.jsx)(ib,{mode:`log`})})}),(0,X.jsx)(L,{path:`skills`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(_h,{}),children:(0,X.jsx)(rb,{})})}),(0,X.jsx)(L,{path:`inbox`,element:(0,X.jsx)(Zp,{})}),(0,X.jsx)(L,{path:`workflows`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(yh,{}),children:(0,X.jsx)(nb,{})})}),(0,X.jsx)(L,{path:`workflows/:name`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(yh,{}),children:(0,X.jsx)(nb,{})})}),(0,X.jsx)(L,{path:`workflows-new/*`,element:(0,X.jsx)(Qe,{to:`/workflows`,replace:!0})}),(0,X.jsx)(L,{path:`settings`,element:(0,X.jsx)(vv,{scope:`project`,capabilities:e})}),(0,X.jsx)(L,{path:`settings/skills`,element:(0,X.jsx)(ab,{})}),nv(`project`,e).map(t=>(0,X.jsx)(L,{path:`settings/${t.id}`,element:(0,X.jsx)(_v,{section:t,scope:`project`,capabilities:e})},t.id)),nv(`global`,e).map(e=>(0,X.jsx)(L,{path:`settings/${e.id}`,element:(0,X.jsx)(ob,{sectionId:e.id})},e.id)),(0,X.jsx)(L,{path:`*`,element:(0,X.jsx)(hh,{})})]}),(0,X.jsx)(L,{path:`/tasks`,element:(0,X.jsx)(Ay,{})}),(0,X.jsx)(L,{path:`/dashboard`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`div`,{role:`status`,className:`p-6 text-sm text-muted-foreground`,children:`Loading dashboard…`}),children:(0,X.jsx)(Ky,{})})}),(0,X.jsx)(L,{path:`/settings/global`,element:(0,X.jsx)(vv,{scope:`global`,capabilities:e})}),nv(`global`,e).map(t=>(0,X.jsx)(L,{path:fv(`global`,t.id),element:(0,X.jsx)(_v,{section:t,scope:`global`,capabilities:e})},t.id)),(0,X.jsx)(L,{path:`*`,element:(0,X.jsx)(ub,{})})]})});function mb(e){let t=e?.repo;if(!t)return null;let n=t.root.replace(/[\\/]+$/,``).split(/[\\/]/).pop();return n?{name:n,branch:t.branch}:null}function hb(e){return e?.available===!0&&(e.status===`available`||e.status===`error`)}var gb=(0,Y.memo)(function({children:e}){let{pathname:t}=p(),n=Pt(),r=Se(),i=Ue(),a=i.data?.branding,o=a!==void 0&&(a.name!==`cezar`||a.logoUrl!==null),s=ue(!o&&i.data!==void 0),c=r.data?.capabilities.followups===!0,l=r.data?.capabilities.automations===!0,u=Te(c),d=hb(te(n??``,n!==null).data),f=ye().data,m=fb(t),h=f?.bootProject??r.data?.bootProject??null,g=ge(n,h,(0,Y.useMemo)(()=>Ar,[])),_=n!==null&&n===h,v=f?.projects.find(e=>e.id===n),y=f?.projects.find(e=>e.id===h),b=n===null?y?.tracker:v?.tracker,x=m.taskId,S=Re(n??``,v!==void 0&&x!==null,f?.bootProject===n,(0,Y.useMemo)(()=>e=>{let t=x?e.find(e=>e.id===x):void 0;return t?z(t):void 0},[x])).data;hp({projectName:t===`/settings/global`||t.startsWith(`/settings/global/`)?null:v?.name??(_?mb(r.data)?.name??null:null),pageLabel:S??m.pageLabel,brandName:i.data?.branding.name,brandLogoUrl:i.data?.branding.logoUrl});let C=f&&f.projects.length>1?f:null,w=(0,Y.useMemo)(()=>mb(r.data),[r.data?.repo?.root,r.data?.repo?.branch]),T=(0,Y.useMemo)(()=>(0,X.jsx)(cf,{}),[]),E=(0,Y.useMemo)(()=>(0,X.jsx)(Jf,{}),[]),D=(0,Y.useMemo)(()=>(0,X.jsx)(Zd,{}),[]),O=(0,Y.useMemo)(()=>C?(0,X.jsx)(np,{projects:C.projects,bootProjectId:C.bootProject,inboxAvailable:c,automationsAvailable:l,inboxCount:u.data?.length??null,skillsUpdateAvailable:d}):void 0,[C,c,l,u.data?.length,d]),k=(0,Y.useMemo)(()=>(0,X.jsx)(up,{health:r.data}),[r.data]);return(0,X.jsxs)(Kd,{children:[(0,X.jsx)(Od,{repo:w,brandName:i.data?.branding.name??`cezar`,brandLogoUrl:i.data?.branding.logoUrl??null,version:r.data?.version??null,latestVersion:r.data?.latestVersion??null,starCount:!o&&s.data?.available?s.data.count??null:null,inboxCount:u.data?.length??null,unreadCount:g.data??null,skillsUpdateAvailable:d,forgeAvailable:r.data?.forge?.available===!0,inboxAvailable:c,automationsAvailable:l,tracker:b,banner:T,singleProject:r.data?.capabilities.singleProject===!0,taskQuickList:E,hostWidget:D,projectGroups:O,toolsMenu:k,children:e}),(0,X.jsx)(ju,{})]})});function _b(){let e=p(),t=ye();return(0,Y.useEffect)(()=>{let n=Sp(e,t.data);n!==null&&(Tp(_p(),n)||vp(n))},[e.hash,e.pathname,e.search,t.data]),null}function vb(){let e=I(),t=Bg(qe().data?.notifications).enabled,n=(0,Y.useRef)(t);n.current=t;let r=(0,Y.useRef)(new Map);return(0,Y.useEffect)(()=>{let t=dt(B.runs.list()),i=e=>{let{entering:t,statuses:i}=Hg(r.current,e);if(r.current=i,t.length!==0&&Ug({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:Vg()}))for(let e of t)yb(e)};return i(e.getQueryData(B.runs.list())),e.getQueryCache().subscribe(e=>{e.query.queryHash!==t||e.type!==`updated`||i(e.query.state.data)})},[e]),null}function yb(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=Wg(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}function bb(e,t=!0){return ae({queryKey:[...c.dashboard,`insights`,e],enabled:t,staleTime:5e3,refetchInterval:t?15e3:!1,refetchIntervalInBackground:!1,retry:!1,queryFn:async({signal:t})=>Hn.parse(await vt(await A.api.v1.workspace.dashboard.insights.$get({query:{period:e,tzOffsetMinutes:String(new Date().getTimezoneOffset())}},{init:{signal:t}}),`/workspace/dashboard/insights`))})}var xb=[`pointerdown`,`pointermove`,`keydown`,`wheel`,`touchstart`];function Sb(){let e=document.activeElement;return e?e.isContentEditable||e.tagName===`TEXTAREA`||e.tagName===`INPUT`&&e.type!==`checkbox`:!1}var Cb=()=>document.querySelector(`[role="dialog"],[role="alertdialog"]`)!==null;function wb(){let e=I(),t=Ue(),n=t.data?.branding,r=n!==void 0&&(n.name!==`cezar`||n.logoUrl!==null),i=ue(t.data!==void 0&&!r),a=!r&&i.data?.available===!0,o=!r&&i.data?.available?i.data.count??null:null,[s,c]=(0,Y.useState)(!1),l=(0,Y.useRef)(a);l.current=a;let u=(0,Y.useRef)(new Map),d=(0,Y.useRef)(null),f=(0,Y.useRef)(0);return(0,Y.useEffect)(()=>{let t=dt(B.runs.list()),n,r=()=>Uu({now:Date.now(),visible:document.visibilityState===`visible`,focused:document.hasFocus(),lastInteractionAt:f.current,typing:Sb(),dialogOpen:Cb()}),i=()=>{let e=d.current;if(!(e===null||n)){if(Date.now()-e>18e5){d.current=null;return}r()&&(n=setTimeout(()=>{n=void 0;let e=zu();if(!(d.current===null||!r()||!l.current)){if(!Vu(e,Date.now())){d.current=null;return}d.current=null,Bu({...e,asks:e.asks+1,lastAskedAt:new Date().toISOString()}),c(!0)}},Ru))}},a=e=>{let{succeeded:t,statuses:n}=Ku(u.current,e);u.current=n,!(!t||!l.current)&&(Hu(e)<3||Vu(zu(),Date.now())&&(d.current=Date.now(),i()))},o=()=>{f.current=Date.now(),i()};for(let e of xb)window.addEventListener(e,o,{passive:!0});document.addEventListener(`visibilitychange`,i),window.addEventListener(`focus`,i),a(e.getQueryData(B.runs.list()));let s=e.getQueryCache().subscribe(e=>{e.query.queryHash!==t||e.type!==`updated`||a(e.query.state.data)});return()=>{s(),clearTimeout(n);for(let e of xb)window.removeEventListener(e,o);document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`focus`,i)}},[e]),r?null:(0,X.jsx)(Eb,{open:s,onOpenChange:c,count:o})}function Tb(e){let t=zu();t&&Bu({...t,outcome:e})}function Eb({open:e,onOpenChange:t,count:n}){let r=bb(`30d`,e).data?.delivered,i=r&&r.completedTasks>0?[{label:`Tasks done`,n:r.completedTasks,value:r.completedTasks.toLocaleString(`en-US`)},{label:`PRs opened`,n:r.prsOpened,value:r.prsOpened.toLocaleString(`en-US`)},{label:`Lines written`,n:r.additions,value:`+${r.additions.toLocaleString(`en-US`)}`}].filter(e=>e.n>0):null;return(0,X.jsx)(fa,{open:e,onOpenChange:t,children:(0,X.jsxs)(pa,{"data-slot":`star-ask`,className:`gap-0 overflow-hidden p-0 sm:max-w-[440px]`,children:[(0,X.jsxs)(`div`,{className:`relative flex h-36 items-center justify-center overflow-hidden border-b bg-card-2`,children:[(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`absolute inset-0 bg-[radial-gradient(circle_at_22%_35%,color-mix(in_oklab,var(--accent-lime)_32%,transparent),transparent_55%),radial-gradient(circle_at_80%_70%,color-mix(in_oklab,var(--violet)_38%,transparent),transparent_55%)]`}),(0,X.jsxs)(`div`,{"aria-hidden":`true`,className:`relative flex items-center gap-4`,children:[(0,X.jsx)(Xu,{height:52,className:`text-foreground`}),(0,X.jsx)(`span`,{className:`flex size-12 items-center justify-center rounded-full border bg-card shadow-md`,children:(0,X.jsx)(Ts,{className:`size-6 fill-current text-pending-strong`})})]}),n!==null&&(0,X.jsxs)(`span`,{className:`absolute bottom-3 left-1/2 -translate-x-1/2 rounded-full border bg-card/80 px-2.5 py-0.5 font-mono text-[11px] text-muted-foreground backdrop-blur`,children:[`⭐ `,Iu(n),` stars on GitHub`]})]}),(0,X.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`span`,{className:`section-mark block font-mono text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:`Open source · MIT`}),(0,X.jsx)(ma,{className:`text-xl font-semibold tracking-tight`,children:`Is cezar pulling its weight?`}),(0,X.jsx)(xa,{className:`text-sm leading-relaxed text-muted-foreground`,children:`cezar is free, open source and runs on your machine, with no account to create. A GitHub star is how other developers find it, and how we know what to keep building.`})]}),i&&(0,X.jsxs)(`div`,{className:`rounded-lg border bg-card-2 p-3`,children:[(0,X.jsx)(`span`,{className:`block font-mono text-[10.5px] uppercase tracking-[0.12em] text-soft-foreground`,children:`Your last 30 days with cezar`}),(0,X.jsx)(`dl`,{className:`mt-2 grid gap-2`,style:{gridTemplateColumns:`repeat(${i.length}, minmax(0, 1fr))`},children:i.map(e=>(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse`,children:[(0,X.jsx)(`dt`,{className:`text-xs text-soft-foreground`,children:e.label}),(0,X.jsx)(`dd`,{className:`truncate text-lg font-semibold tabular-nums`,children:e.value})]},e.label))})]}),(0,X.jsx)(q,{asChild:!0,className:`h-11 w-full text-sm font-semibold`,children:(0,X.jsxs)(`a`,{href:Pu,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{Tb(`starred`),t(!1)},children:[(0,X.jsx)(Ts,{className:`size-4 fill-current`,"aria-hidden":`true`}),`Star cezar on GitHub`,(0,X.jsx)(ii,{className:`size-4`,"aria-hidden":`true`})]})}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsx)(q,{variant:`ghost`,className:`min-h-11`,onClick:()=>t(!1),children:`Maybe later`}),(0,X.jsx)(q,{variant:`ghost`,className:`min-h-11 text-soft-foreground`,onClick:()=>{Tb(`never`),t(!1)},children:`Don’t ask again`})]})]})]})})}function Db(){let[e]=(0,Y.useState)(Lo);return(0,X.jsx)(Yt,{client:e,children:(0,X.jsx)(Xn,{children:(0,X.jsxs)(To,{children:[(0,X.jsx)(vb,{}),(0,X.jsx)(wb,{}),(0,X.jsx)(du,{children:(0,X.jsx)(Dg,{children:(0,X.jsxs)(de,{children:[(0,X.jsx)(_b,{}),(0,X.jsx)(oi,{children:(0,X.jsx)(gb,{children:(0,X.jsx)(pb,{})})}),(0,X.jsx)(an,{})]})})})]})})})}function Ob(){return(document.querySelector(`meta[name="cez-api-base"]`)?.getAttribute(`content`))?.trim()||``}Dn(Ob());var kb=document.getElementById(`root`);if(!kb)throw Error(`cezar: #root container is missing from index.html`);(0,uo.createRoot)(kb).render((0,X.jsx)(Y.StrictMode,{children:(0,X.jsx)(Db,{})}));export{Gl as A,rs as B,Qu as C,$u as D,ed as E,ws as F,Go as H,Cs as I,Ss as L,As as M,ks as N,Yl as O,Ds as P,xs as R,Dp as S,nd as T,ho as U,Zo as V,Ip as _,yh as a,Pp as b,Fm as c,$p as d,qp as f,Rp as g,Vp as h,bh as i,js as j,Kl as k,Lm as l,Gp as m,fv as n,gh as o,Kp as p,xh as r,Rm as s,bb as t,Pm as u,Np as v,td as w,Op as x,Lp as y,bs as z};
|