@open-mercato/cezar 0.20.0-pr2192.5251 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/server/agent-setup-routes.d.ts +14 -14
  2. package/dist/server/dashboard.d.ts +54 -54
  3. package/dist/server/server.d.ts +68 -68
  4. package/dist/server/worktree-lifecycle.d.ts +90 -90
  5. package/dist/telemetry-service.json +1 -0
  6. package/dist/workflows/run-env-keys.d.ts +8 -0
  7. package/dist/workflows/run-env-keys.js +14 -0
  8. package/dist/workflows/run-env-keys.js.map +1 -0
  9. package/package.json +5 -5
  10. package/web/dist/assets/{active-forge-KyXM3uG9.js → active-forge-CkAcQPDz.js} +1 -1
  11. package/web/dist/assets/{agent-task-pickers-UkVtTCna.js → agent-task-pickers-BXCIulS3.js} +1 -1
  12. package/web/dist/assets/{alert-dialog-DT465VL4.js → alert-dialog-B2Vi6MQZ.js} +1 -1
  13. package/web/dist/assets/{ask-card-DVv8mY_R.js → ask-card-DPIjQSs8.js} +1 -1
  14. package/web/dist/assets/{assets-view-D22vr-oN.js → assets-view-CsFjfV2n.js} +1 -1
  15. package/web/dist/assets/{automation-format-KxcnBz7L.js → automation-format-CMG-6CYi.js} +1 -1
  16. package/web/dist/assets/{automations-route-3gfbxDq2.js → automations-route-Dd7F6b4F.js} +1 -1
  17. package/web/dist/assets/{button-CEskWahs.js → button-CJXK1JqU.js} +1 -1
  18. package/web/dist/assets/{centered-state-Cpzaj75Y.js → centered-state-DE6sgEMs.js} +1 -1
  19. package/web/dist/assets/{chip-CEZRGBV7.js → chip-DTCkrr8F.js} +1 -1
  20. package/web/dist/assets/{collapsible-ZLdkcdMa.js → collapsible-DHALizq-.js} +1 -1
  21. package/web/dist/assets/{command-CcbuBum7.js → command-CwP_dLx3.js} +1 -1
  22. package/web/dist/assets/{commit-list-BSjLQA6p.js → commit-list-BJeaIEp4.js} +1 -1
  23. package/web/dist/assets/{compare-variants-C9soYpuE.js → compare-variants-CYv97XSw.js} +1 -1
  24. package/web/dist/assets/{composer-Bz8ZfbHr.js → composer-C-aBJhY0.js} +1 -1
  25. package/web/dist/assets/{composer-attachments-BD2enHFJ.js → composer-attachments-ChelZhq4.js} +1 -1
  26. package/web/dist/assets/{dashboard-Bl6qWW8i.js → dashboard-Dh65_Yi7.js} +1 -1
  27. package/web/dist/assets/{dialog-nn9sCNvn.js → dialog-DVZE8yAO.js} +1 -1
  28. package/web/dist/assets/{diff-FrEDv09S.js → diff-aKT-mpn8.js} +2 -2
  29. package/web/dist/assets/{diff-stat-zisAayZW.js → diff-stat-DPetRUXO.js} +1 -1
  30. package/web/dist/assets/{diff-view-BeoeZVcx.js → diff-view-m4TvXu0y.js} +1 -1
  31. package/web/dist/assets/{dist-B_KqW6o6.js → dist-Bsi6zLdE.js} +1 -1
  32. package/web/dist/assets/{dropdown-menu-ayNafd3n.js → dropdown-menu-BKvUsb5Y.js} +1 -1
  33. package/web/dist/assets/{file-preview-Dzc3RFUx.js → file-preview-C2EkjhOh.js} +1 -1
  34. package/web/dist/assets/{follow-up-engine-Dul_3U9s.js → follow-up-engine-BnRCTyQ4.js} +1 -1
  35. package/web/dist/assets/{git-tab-loading-DG4p-eF4.js → git-tab-loading-DpG2D8Vl.js} +1 -1
  36. package/web/dist/assets/{github-DvZE0hDJ.js → github-CWRtsamJ.js} +1 -1
  37. package/web/dist/assets/{host-usage-GTjB03IM.js → host-usage-B8ohHYHR.js} +1 -1
  38. package/web/dist/assets/{icon-tooltip-DRhwcic2.js → icon-tooltip-DYk5cjLx.js} +1 -1
  39. package/web/dist/assets/{impact-control-CTdtyfcn.js → impact-control-ClslFBBA.js} +1 -1
  40. package/web/dist/assets/{impact-model-CpNcUgTV.js → impact-model-DCDyRxcf.js} +1 -1
  41. package/web/dist/assets/{index-BMA7ZpLG.js → index-BfbbA0lF.js} +4 -4
  42. package/web/dist/assets/{input-BtDLUR9Q.js → input-DofKzJZl.js} +1 -1
  43. package/web/dist/assets/{loading-state-BTvZxCb2.js → loading-state-NiNQtJ5H.js} +1 -1
  44. package/web/dist/assets/{manager-avatar-Ct1uVuvZ.js → manager-avatar-CKfqcoJQ.js} +1 -1
  45. package/web/dist/assets/{manager-chat-BfxPyXv3.js → manager-chat-BdigDKYZ.js} +1 -1
  46. package/web/dist/assets/{manager-index-CeMdRtKd.js → manager-index-D0TOmxr6.js} +1 -1
  47. package/web/dist/assets/{manager-new-Bs8_CMUR.js → manager-new-CCet_7u8.js} +1 -1
  48. package/web/dist/assets/{manager-settings-Bv2EqZvs.js → manager-settings-I1AeATjr.js} +1 -1
  49. package/web/dist/assets/{managers-DDPXJoKR.js → managers-Dr63u21Y.js} +1 -1
  50. package/web/dist/assets/{markdown-3rt1rOmI.js → markdown-CXJIKz2i.js} +1 -1
  51. package/web/dist/assets/{markdown-LlPZylt7.js → markdown-YSf01kqC.js} +1 -1
  52. package/web/dist/assets/{mascot-picker-BuGxdrpW.js → mascot-picker-C4s7n9Fc.js} +1 -1
  53. package/web/dist/assets/{new-task-form-BoiK41PS.js → new-task-form-2p4cXcVQ.js} +1 -1
  54. package/web/dist/assets/{picker-pill-CzANlEqt.js → picker-pill-Dv9H0dRF.js} +1 -1
  55. package/web/dist/assets/{pill-C2wRS9lg.js → pill-CoDPUIcJ.js} +1 -1
  56. package/web/dist/assets/{popover-DPba6FvD.js → popover-DUg9gBOn.js} +1 -1
  57. package/web/dist/assets/{project-router-CnMbTz-a.js → project-router-B1Q3upIJ.js} +1 -1
  58. package/web/dist/assets/{project-terminal-sfYncenW.js → project-terminal-DbIohh5G.js} +2 -2
  59. package/web/dist/assets/{provider-auth-alert-DbNH_-XT.js → provider-auth-alert-GxIEkIvw.js} +1 -1
  60. package/web/dist/assets/{queries-DVZ1lYAo.js → queries-BQUz3Wnb.js} +1 -1
  61. package/web/dist/assets/{reasoning-effort-pill-al6bbPpw.js → reasoning-effort-pill-BOV3C0If.js} +1 -1
  62. package/web/dist/assets/{reference-chip-DdxKs2_A.js → reference-chip-BpbybBvl.js} +1 -1
  63. package/web/dist/assets/{reference-conflict-action-Ci4LDmIm.js → reference-conflict-action-ByDYwT-Y.js} +1 -1
  64. package/web/dist/assets/{repo-git-BcEGYBrc.js → repo-git-ikURCYEK.js} +1 -1
  65. package/web/dist/assets/{run-actions-CDKK-8MP.js → run-actions-ChUnbFA7.js} +1 -1
  66. package/web/dist/assets/{run-diff-JJOUeclX.js → run-diff-B08Fk7dR.js} +1 -1
  67. package/web/dist/assets/{scroll-within-CfS_Ia4E.js → scroll-within-DMA4ZbQV.js} +1 -1
  68. package/web/dist/assets/{segmented-Chb1Y4ie.js → segmented-DI7abdqX.js} +1 -1
  69. package/web/dist/assets/{select-DG3hFvx2.js → select-DL5E3ZAD.js} +1 -1
  70. package/web/dist/assets/{sheet-DirfZrZD.js → sheet-DPwaj6sk.js} +1 -1
  71. package/web/dist/assets/{skills-CxWFZgjH.js → skills-BNiKFlUw.js} +1 -1
  72. package/web/dist/assets/{spinner-CwKcijCN.js → spinner-hSpq0sPM.js} +1 -1
  73. package/web/dist/assets/{status-dot-CZAbXsOs.js → status-dot-AP_4obOJ.js} +1 -1
  74. package/web/dist/assets/{tabs-r4PCzkHp.js → tabs-DrhZb97I.js} +1 -1
  75. package/web/dist/assets/{task-commits-CHnonzuD.js → task-commits-Di0Mc8MX.js} +1 -1
  76. package/web/dist/assets/{task-graph-DZAjkdmH.js → task-graph-Bpi3lEER.js} +1 -1
  77. package/web/dist/assets/{task-notes-CHs_WZf5.js → task-notes-DCHLinAF.js} +1 -1
  78. package/web/dist/assets/{task-workspace-DWGBLHlR.js → task-workspace-DHl5akxu.js} +3 -3
  79. package/web/dist/assets/{telemetry-onLa6CTl.js → telemetry-3DhVDxf8.js} +1 -1
  80. package/web/dist/assets/{terminal-drawer-DV7kUP0D.js → terminal-drawer-CEktqC3z.js} +1 -1
  81. package/web/dist/assets/{terminal-pane-DQAHtCtb.js → terminal-pane-CmmTwiTX.js} +1 -1
  82. package/web/dist/assets/{terminal-scope-CEQdw5Tz.js → terminal-scope-okFE6qRP.js} +1 -1
  83. package/web/dist/assets/{textarea-BqeSvPOp.js → textarea-DDyYxCcO.js} +1 -1
  84. package/web/dist/assets/{thread-items-CNxMLcOo.js → thread-items-C-4IW5zi.js} +1 -1
  85. package/web/dist/assets/{toaster-4t61QM_C.js → toaster-BoJZiTRl.js} +1 -1
  86. package/web/dist/assets/{tracker-B7u8exjG.js → tracker-bQUG9SkJ.js} +1 -1
  87. package/web/dist/assets/{tree-pane-resize-XHzIJDtc.js → tree-pane-resize-xgVK7J9r.js} +1 -1
  88. package/web/dist/assets/utils-Dp6vCdiU.js +55 -0
  89. package/web/dist/assets/{workflow-graph-BaZd6m6v.js → workflow-graph-CGMeFErv.js} +1 -1
  90. package/web/dist/assets/{worktree-lifecycle-YFVatYLd.js → worktree-lifecycle-C18dBDW4.js} +1 -1
  91. package/web/dist/assets/{worktree-lifecycle-operation-CYHhFvQF.js → worktree-lifecycle-operation-_xqKBVKB.js} +1 -1
  92. package/web/dist/assets/{zoomable-image-D4B6jvp-.js → zoomable-image-BiM5LfTG.js} +1 -1
  93. package/web/dist/index.html +46 -46
  94. package/web/dist/assets/utils-DWwoYTjU.js +0 -60
@@ -1,7 +1,7 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/manager-settings-Bv2EqZvs.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/queries-DVZ1lYAo.js","assets/utils-DWwoYTjU.js","assets/bundle-mjs-rHxsej31.js","assets/managers-DDPXJoKR.js","assets/createLucideIcon-BHp8sXmF.js","assets/reference-chip-DdxKs2_A.js","assets/circle-check-BpDFgE5h.js","assets/git-pull-request-DUnpdU6m.js","assets/git-pull-request-draft-BdwbaFQ3.js","assets/triangle-alert-CIzim6ZN.js","assets/popover-DPba6FvD.js","assets/button-CEskWahs.js","assets/status-dot-CZAbXsOs.js","assets/select-DG3hFvx2.js","assets/dist-B_KqW6o6.js","assets/circle-alert-ClwRNTQt.js","assets/manager-avatar-Ct1uVuvZ.js","assets/mascot-portrait--NiRJOA5.js","assets/external-link-BE6y205O.js","assets/plus-CxRU2X8C.js","assets/refresh-cw-BIgmYimN.js","assets/textarea-BqeSvPOp.js","assets/user-round-V2FYByS8.js","assets/zap-2VEI5zT4.js","assets/managers-DbnCHnb6.js","assets/alert-dialog-DT465VL4.js","assets/dialog-nn9sCNvn.js","assets/x-BqECUykl.js","assets/input-BtDLUR9Q.js","assets/toaster-4t61QM_C.js","assets/enter-key-Bsscx4Nx.js","assets/use-submit-shortcut-Cfam5eE7.js","assets/mascot-picker-BuGxdrpW.js","assets/dropdown-menu-ayNafd3n.js","assets/command-CcbuBum7.js","assets/search-BjsZLqse.js","assets/new-task-form-BoiK41PS.js","assets/host-usage-GTjB03IM.js","assets/use-desktop-BNN3U2y9.js","assets/provider-auth-alert-DbNH_-XT.js","assets/terminal-pane-DQAHtCtb.js","assets/preload-helper-Czpn1I53.js","assets/clipboard-DvCUPLwM.js","assets/terminal-pane-BrP-ENHg.css","assets/dashboard-Bl6qWW8i.js","assets/project-router-CnMbTz-a.js","assets/segmented-Chb1Y4ie.js","assets/worktree-lifecycle-YFVatYLd.js","assets/sheet-DirfZrZD.js","assets/automation-format-KxcnBz7L.js","assets/circle-question-mark-X2pmbDJg.js","assets/download-CfgyYHf7.js","assets/sortable.esm-B7aanBL9.js","assets/icon-tooltip-DRhwcic2.js","assets/format-BUbPQpzw.js","assets/token-metrics-DXeuToH8.js","assets/use-now-C8dG5uIP.js","assets/compare-variants-C9soYpuE.js","assets/search-x-I9Q8pgUa.js","assets/collapsible-ZLdkcdMa.js","assets/pill-C2wRS9lg.js","assets/centered-state-Cpzaj75Y.js","assets/markdown-LlPZylt7.js","assets/chunk-BO2N2NFS-BueWQOks.js","assets/lib-BxQXEXDF.js","assets/run-diff-JJOUeclX.js","assets/diff-stat-zisAayZW.js","assets/task-commits-CHnonzuD.js","assets/git-tab-loading-DG4p-eF4.js","assets/arrow-left-BfRd_mrv.js","assets/run-actions-CDKK-8MP.js","assets/bot-TkDIw4y-.js","assets/folder-o-AvL3y3.js","assets/pencil-BWoe1EL-.js","assets/workflow-BEP63Wt4.js","assets/impact-model-CpNcUgTV.js","assets/active-forge-KyXM3uG9.js","assets/upload-BE8GV7hh.js","assets/loader-circle-CPBhhDbB.js","assets/layout-grid-BRGu4YPj.js","assets/terminal-CxnJmFUC.js","assets/composer-attachments-BD2enHFJ.js","assets/telemetry-onLa6CTl.js","assets/reference-conflict-action-Ci4LDmIm.js","assets/spinner-CwKcijCN.js","assets/diff-FrEDv09S.js","assets/scroll-within-CfS_Ia4E.js","assets/zoomable-image-D4B6jvp-.js","assets/commit-list-BSjLQA6p.js","assets/lib-BQXq3kEf.js","assets/task-notes-CHs_WZf5.js","assets/thread-items-CNxMLcOo.js","assets/file-text-D2QdCz-z.js","assets/file--aqoYe_k.js","assets/paperclip-B8bavbGm.js","assets/save-C73AnLGl.js","assets/types-BTlmexWF.js","assets/thread-scroll-upiJ0Jtj.js","assets/task-workspace-DWGBLHlR.js","assets/arrow-down-NfQPLFhe.js","assets/worktree-lifecycle-operation-CYHhFvQF.js","assets/loading-state-BTvZxCb2.js","assets/file-preview-Dzc3RFUx.js","assets/tree-pane-resize-XHzIJDtc.js","assets/markdown-3rt1rOmI.js","assets/message-square-B-MD-8rD.js","assets/composer-Bz8ZfbHr.js","assets/arrow-up-CssRwnnv.js","assets/square-wDIzrTDO.js","assets/play-CmVAj_fu.js","assets/follow-up-engine-Dul_3U9s.js","assets/picker-pill-CzANlEqt.js","assets/chip-CEZRGBV7.js","assets/reasoning-effort-pill-al6bbPpw.js","assets/tabs-r4PCzkHp.js","assets/drawer-state-DasOAIpO.js","assets/ask-card-DVv8mY_R.js","assets/terminal-scope-CEQdw5Tz.js","assets/repo-git-BcEGYBrc.js","assets/impact-control-CTdtyfcn.js","assets/github-DvZE0hDJ.js","assets/chevron-left-D0UFBpi5.js","assets/tag-k3n7EuAm.js","assets/agent-task-pickers-UkVtTCna.js","assets/tracker-B7u8exjG.js","assets/workflow-graph-BaZd6m6v.js","assets/settings-2-B8aEkWqd.js","assets/message-circle-question-mark-CRiaNaMJ.js","assets/workflow-graph-DLioOiRN.css","assets/project-terminal-sfYncenW.js","assets/skills-CxWFZgjH.js","assets/manager-index-CeMdRtKd.js","assets/manager-focus-B42UUMVK.js","assets/manager-new-Bs8_CMUR.js","assets/manager-chat-BfxPyXv3.js","assets/panel-right-BOIRp-Hi.js","assets/automations-route-3gfbxDq2.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,t as r}from"./react-runtime-CCIEwYL0.js";import{$ as i,$a as a,$i as o,$n as s,$r as c,$t as l,A as u,Aa as d,Ao as f,B as p,Bn as m,Bt as h,C as g,Ca as _,Cn as v,Co as y,Do as b,Dr as x,E as S,Ei as C,Eo as w,Er as T,F as E,Fa as D,Fn as O,Fo as k,Ft as A,G as j,Gn as M,Gt as N,Ha as P,Hi as ee,Hn as te,Ht as ne,In as re,Io as ie,It as F,J as ae,Ja as oe,Ji as se,Jn as ce,Jt as le,K as I,Kn as ue,Kr as L,Kt as de,La as fe,Ln as pe,Lo as me,Lr as he,Lt as ge,Ma as _e,Mn as ve,Mo as ye,Mr as be,Nn as xe,No as Se,Nr as Ce,Nt as we,Oa as Te,On as Ee,Oo as De,Pa as Oe,Pn as ke,Po as Ae,Pr as je,Pt as Me,Q as Ne,Qa as Pe,Qt as Fe,Ra as Ie,Rt as Le,S as Re,Sn as ze,So as Be,Sr as Ve,St as He,T as Ue,To as We,Un as Ge,Ut as Ke,V as qe,Va as Je,Vn as Ye,Vr as Xe,Vt as Ze,W as Qe,Wa as $e,Wn as et,Xa as tt,Xn as nt,Y as rt,Yn as it,Yt as at,Z as ot,Zn as st,Zt as ct,_ as lt,_a as ut,_n as dt,_o as ft,_t as pt,an as mt,ao as ht,ba as gt,bn as _t,bo as vt,br as yt,c as bt,ca as xt,ci as St,cn as Ct,ct as wt,d as Tt,dn as Et,dt as Dt,ea as Ot,ei as kt,en as At,er as jt,et as Mt,f as Nt,fn as Pt,fo as Ft,g as It,gn as Lt,go as Rt,h as zt,ho as Bt,i as Vt,in as Ht,io as Ut,it as Wt,j as Gt,ja as Kt,jo as qt,jr as Jt,kn as Yt,ko as Xt,kr as Zt,l as Qt,la as $t,li as en,ln as tn,lt as nn,m as rn,ma as an,mn as on,mr as sn,ni as cn,nr as ln,nt as un,o as dn,oa as fn,on as pn,ot as mn,p as hn,pn as R,po as gn,pt as _n,q as vn,qa as yn,qn as bn,qt as xn,r as z,ra as Sn,ro as Cn,rt as wn,s as Tn,sa as En,so as Dn,st as On,ti as kn,tn as An,tr as jn,tt as Mn,u as Nn,ua as Pn,un as Fn,uo as In,ut as Ln,v as Rn,va as zn,vo as B,wn as Bn,wo as Vn,wr as Hn,x as Un,xa as Wn,xn as Gn,xo as V,xt as Kn,y as qn,ya as Jn,yn as Yn,yo as Xn,yr as Zn,z as Qn,zi as $n,zn as er,zt as tr}from"./queries-DVZ1lYAo.js";import{At as nr,Ct as rr,Dt as ir,E as ar,H as or,Mt as sr,R as cr,St as lr,Y as ur,a as dr,c as fr,f as pr,ft as mr,g as hr,i as gr,kt as _r,m as vr,n as yr,o as br,p as xr,r as Sr,s as Cr,t as H,u as wr,y as Tr,z as Er}from"./utils-DWwoYTjU.js";import{t as Dr}from"./preload-helper-Czpn1I53.js";import{C as Or,S as kr,_ as Ar,a as jr,b as Mr,c as Nr,d as Pr,f as U,g as W,h as Fr,i as Ir,l as Lr,m as Rr,n as zr,o as Br,p as Vr,r as Hr,s as Ur,t as G,u as Wr,v as Gr,y as Kr}from"./project-router-CnMbTz-a.js";import{o as qr,t as Jr}from"./worktree-lifecycle-YFVatYLd.js";import{C as Yr,D as Xr,E as Zr,O as Qr,T as $r,d as ei,g as ti,l as ni,w as ri,x as ii}from"./managers-DDPXJoKR.js";import{a as ai,c as oi,d as si,f as ci,i as li,l as ui,m as di,n as fi,o as pi,p as mi,r as hi,s as gi,t as _i,u as vi}from"./segmented-Chb1Y4ie.js";import{i as yi,n as bi,o as xi,r as Si,s as Ci,t as wi}from"./sheet-DirfZrZD.js";import{a as Ti,c as Ei,d as Di,f as Oi,i as ki,l as Ai,n as ji,o as Mi,r as Ni,s as Pi,t as Fi,u as Ii}from"./host-usage-GTjB03IM.js";import{t as Li}from"./use-desktop-BNN3U2y9.js";import{t as K}from"./createLucideIcon-BHp8sXmF.js";import{At as Ri,Dt as zi,Tt as Bi,_t as Vi,a as Hi,b as Ui,c as Wi,d as Gi,f as Ki,g as qi,gt as Ji,ht as Yi,i as Xi,jt as Zi,kt as Qi,m as $i,mt as ea,n as ta,o as na,p as ra,pt as ia,s as aa,xt as oa,y as sa,yt as ca}from"./git-tab-loading-DG4p-eF4.js";import{t as la}from"./arrow-down-NfQPLFhe.js";import{t as ua}from"./arrow-left-BfRd_mrv.js";import{a as da,c as fa,d as pa,i as ma,o as ha,r as ga,s as _a,t as va,u as ya}from"./worktree-lifecycle-operation-CYHhFvQF.js";import{c as ba,i as xa,l as Sa,r as Ca,s as wa,t as Ta,u as Ea}from"./reference-chip-DdxKs2_A.js";import{t as Da}from"./arrow-up-CssRwnnv.js";import{t as Oa}from"./bot-TkDIw4y-.js";import{C as ka,E as Aa,M as ja,P as Ma,S as Na,T as Pa,b as Fa,g as Ia,j as La,k as Ra,w as za,x as Ba,y as Va}from"./run-actions-CDKK-8MP.js";import{B as Ha,F as Ua,H as Wa,V as Ga,n as Ka,t as q}from"./button-CEskWahs.js";import{r as qa}from"./dist-B_KqW6o6.js";import{i as J,n as Ja,o as Ya,s as Xa,t as Za}from"./select-DG3hFvx2.js";import{t as Qa}from"./circle-check-BpDFgE5h.js";import{a as $a,c as eo,d as to,f as no,i as ro,n as io,o as ao,p as oo,r as so,s as co,t as lo,u as uo}from"./dropdown-menu-ayNafd3n.js";import{a as fo,i as po,n as mo,r as ho,t as go}from"./manager-avatar-Ct1uVuvZ.js";import{n as _o,t as vo}from"./pencil-BWoe1EL-.js";import{n as yo,t as bo}from"./workflow-BEP63Wt4.js";import{t as xo}from"./external-link-BE6y205O.js";import{_ as So,g as Co}from"./impact-model-CpNcUgTV.js";import{t as wo}from"./file-text-D2QdCz-z.js";import{t as To}from"./file--aqoYe_k.js";import{t as Eo}from"./folder-o-AvL3y3.js";import{n as Do,r as Oo,t as ko}from"./active-forge-KyXM3uG9.js";import{n as Ao,t as jo}from"./upload-BE8GV7hh.js";import{t as Mo}from"./loader-circle-CPBhhDbB.js";import{t as No}from"./message-square-B-MD-8rD.js";import{S as Po,_ as Fo,a as Io,b as Lo,c as Ro,d as zo,g as Bo,h as Vo,i as Ho,l as Uo,m as Wo,n as Go,o as Ko,r as qo,s as Jo,t as Yo,u as Xo,v as Zo,x as Qo,y as $o}from"./composer-Bz8ZfbHr.js";import{t as es}from"./play-CmVAj_fu.js";import{t as ts}from"./plus-CxRU2X8C.js";import{t as ns}from"./refresh-cw-BIgmYimN.js";import{t as rs}from"./search-x-I9Q8pgUa.js";import{t as is}from"./search-BjsZLqse.js";import{t as as}from"./square-wDIzrTDO.js";import{t as os}from"./terminal-CxnJmFUC.js";import{n as ss,t as cs}from"./textarea-BqeSvPOp.js";import{t as ls}from"./triangle-alert-CIzim6ZN.js";import{t as us}from"./x-BqECUykl.js";import{t as ds}from"./zap-2VEI5zT4.js";import{S as fs,c as ps,d as ms,f as hs,g as gs,h as _s,i as vs,l as ys,n as bs,o as xs,p as Ss,r as Cs,s as ws,t as Ts,u as Es,v as Ds,y as Os}from"./popover-DPba6FvD.js";import{D as ks,E as As,N as js,T as Ms,a as Ns,g as Ps,l as Fs,n as Is,r as Ls,v as Rs,w as zs,x as Bs,y as Vs}from"./managers-DbnCHnb6.js";import{a as Hs,c as Us,d as Ws,f as Gs,i as Ks,l as qs,n as Js,o as Ys,p as Xs,s as Zs,t as Qs,u as $s}from"./sortable.esm-B7aanBL9.js";import{A as ec,B as tc,C as nc,D as rc,E as ic,F as ac,H as oc,I as sc,L as cc,M as lc,N as uc,O as dc,P as fc,R as pc,S as mc,T as hc,U as gc,V as _c,W as vc,_ as yc,b as bc,c as xc,f as Sc,g as Cc,h as wc,j as Tc,k as Ec,l as Dc,u as Oc,v as kc,w as Ac,x as jc,y as Mc,z as Nc}from"./composer-attachments-BD2enHFJ.js";import{i as Pc,n as Fc,r as Ic,t as Lc}from"./provider-auth-alert-DbNH_-XT.js";import{a as Rc,c as zc,i as Bc,n as Vc,o as Hc,r as Uc,s as Wc,t as Gc}from"./alert-dialog-DT465VL4.js";import{i as Kc,n as qc,r as Jc,t as Yc}from"./tabs-r4PCzkHp.js";import{a as Xc,i as Zc,n as Qc,r as $c,t as el}from"./icon-tooltip-DRhwcic2.js";import{a as tl,i as nl,n as rl,o as il,r as al,t as ol}from"./dialog-nn9sCNvn.js";import{a as sl,i as cl,l as ll,n as ul,o as dl,r as fl,s as pl,t as ml}from"./loading-state-BTvZxCb2.js";import{t as hl}from"./spinner-CwKcijCN.js";import{t as gl}from"./input-BtDLUR9Q.js";import{r as Y,t as _l}from"./toaster-4t61QM_C.js";import{C as vl,S as yl,_ as bl,g as xl,h as Sl,i as Cl,l as wl,m as Tl,n as El,r as Dl,s as Ol,t as kl,v as Al,x as jl}from"./telemetry-onLa6CTl.js";import{r as Ml,t as Nl}from"./format-BUbPQpzw.js";import{t as Pl}from"./status-dot-CZAbXsOs.js";import{i as Fl,n as Il,o as Ll,r as Rl}from"./reference-conflict-action-Ci4LDmIm.js";import{a as zl,c as Bl,i as Vl,l as Hl,n as Ul,o as Wl,r as Gl,s as Kl,t as ql}from"./command-CcbuBum7.js";import{t as Jl}from"./pill-C2wRS9lg.js";import{t as Yl}from"./diff-stat-zisAayZW.js";import{t as Xl}from"./clipboard-DvCUPLwM.js";import{t as Zl}from"./token-metrics-DXeuToH8.js";import{t as Ql}from"./use-now-C8dG5uIP.js";import{n as $l,t as eu}from"./centered-state-Cpzaj75Y.js";import{n as tu,r as nu,t as ru}from"./chip-CEZRGBV7.js";import{S as iu,_ as au,a as ou,b as su,c as cu,d as lu,f as uu,g as du,h as fu,l as pu,m as mu,n as hu,o as gu,p as _u,r as vu,s as yu,t as bu,u as xu,v as Su,y as Cu}from"./new-task-form-BoiK41PS.js";import{t as wu}from"./lib-BQXq3kEf.js";import{a as Tu,i as Eu,n as Du,r as Ou,t as ku}from"./picker-pill-CzANlEqt.js";import{n as Au,t as ju}from"./reasoning-effort-pill-al6bbPpw.js";import{a as Mu,o as Nu,r as Pu,t as Fu}from"./markdown-LlPZylt7.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 Iu=class extends me{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 Be({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=Lu(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=Lu(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=Lu(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=Lu(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){We.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=>f(t,e))}findAll(e={}){return this.getAll().filter(t=>f(e,t))}notify(e){We.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return We.batch(()=>Promise.all(e.map(e=>e.continue().catch(ye))))}};function Lu(e){return e.options.scope?.id}var Ru=class extends me{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??De(r,t),a=this.get(i);return a||(a=new y({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(){We.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=>qt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>qt(e,t)):t}notify(e){We.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){We.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){We.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},zu=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ru,this.#t=e.mutationCache||new Iu,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ie.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Vn.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(Ae(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=w(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return We.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;We.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return We.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=We.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(ye).catch(ye)}invalidateQueries(e,t={}){return We.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=We.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(ye)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(ye)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Ae(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ye).catch(ye)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ye).catch(ye)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Vn.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(b(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Se(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(b(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Se(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||=De(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===k&&(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()}},X=e(t(),1),Bu=n();function Vu(){return new zu({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof sn&&t.status>=400&&t.status<500?!1:t instanceof sn&&t.status===0?e<3:e<1,retryDelay:(e,t)=>t instanceof sn&&t.status===0?Math.min(250*2**e,1e3):Math.min(1e3*2**e,3e4)},mutations:{retry:!1}}})}var Hu=K(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),Uu=K(`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`}]]),Wu=K(`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`}]]),Gu=K(`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`}]]),Ku=K(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),qu=K(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),Ju=K(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Yu=K(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Xu=K(`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`}]]),Zu=K(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),Qu=K(`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`}]]),$u=K(`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`}]]),ed=K(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),td=K(`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`}]]),nd=K(`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`}]]),rd=K(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),id=K(`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`}]]),ad=K(`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`}]]),od=K(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),sd=K(`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`}]]),cd=K(`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`}]]),ld=K(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),ud=K(`gift`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8`,key:`1sqzm4`}],[`path`,{d:`M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5`,key:`kc0143`}],[`rect`,{x:`3`,y:`7`,width:`18`,height:`4`,rx:`1`,key:`1hberx`}]]),dd=K(`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`}]]),fd=K(`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`}]]),pd=K(`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`}]]),md=K(`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`}]]),hd=K(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),gd=K(`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`}]]),_d=K(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),vd=K(`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`}]]),yd=K(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),bd=K(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),xd=K(`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`}]]),Sd=K(`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`}]]),Cd=K(`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`}]]),wd=K(`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`}]]),Td=K(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 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.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),Ed=K(`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`}]]),Dd=K(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Od=K(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),kd=K(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Ad=K(`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`}]]),jd=K(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Md=K(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),Nd=K(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Pd=K(`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`}]]),Fd=K(`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`}]]),Id=K(`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`}]]),Ld=K(`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`}]]),Rd=K(`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`}]]),zd=K(`webhook`,[[`path`,{d:`M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2`,key:`q3hayz`}],[`path`,{d:`m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06`,key:`1go1hn`}],[`path`,{d:`m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8`,key:`qlwsc0`}]]),Bd={jira:{label:`Jira`,scopeLabel:`Jira projects`},linear:{label:`Linear`,scopeLabel:`Linear teams`}},Vd=sr.options.map(e=>({kind:e,...Bd[e]})),Hd=`cez-last-manager`;function Ud(e){if(!e.startsWith(`/manager/new`))try{sessionStorage.setItem(Hd,e)}catch{}}function Wd(e){let t=null;try{t=sessionStorage.getItem(Hd)}catch{return`/manager`}if(t===null||!/^\/manager(?:[/?]|$)/.test(t))return`/manager`;let n=/^\/manager\/([^/?#]+)/.exec(t)?.[1];return n!==void 0&&e!==void 0&&!e.includes(decodeURIComponent(n))?`/manager`:t}var Gd=`cez-last-tasks`;function Kd(e){try{sessionStorage.setItem(Gd,e)}catch{}}function qd(){try{let e=sessionStorage.getItem(Gd);return e===null||!e.startsWith(`/`)||/^\/manager(?:[/?]|$)/.test(e)?null:e}catch{return null}}var Jd=`cez-last-project`;function Yd(e){try{sessionStorage.setItem(Jd,e)}catch{}}function Xd(){try{return sessionStorage.getItem(Jd)}catch{return null}}var Zd=`https://github.com/open-mercato/cezar`,Qd=`cez:star-toast-seen`;function $d(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 ef=`cez:star-ask`,tf=1500;function nf(e=cf()){if(!e)return null;try{let t=e.getItem(ef);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(Qd);return n===null?{asks:0}:{asks:1,lastAskedAt:n}}catch{return null}}function rf(e,t=cf()){try{t?.setItem(ef,JSON.stringify(e))}catch{}}function af(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 of(e){return(e??[]).filter(e=>lf.has(e.status)).length}function sf(e){return e.visible&&e.focused&&!e.typing&&!e.dialogOpen&&e.now-e.lastInteractionAt>=0&&e.now-e.lastInteractionAt<=6e4}function cf(){try{return globalThis.localStorage??null}catch{return null}}var lf=new Set([`done`,`review`]);function uf(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||lf.has(a.status)&&(r=!0,a.pullRequestUrl&&(i=!0))}return{succeeded:r,withPullRequest:i,statuses:n}}var Z=r(),df=Ha(`inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 text-ui 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 ff({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,Z.jsx)(n?Ua:`span`,{"data-slot":`badge`,"data-variant":t,className:H(df({variant:t}),e),...r})}var pf=/^(?:\\\\\?\\)?[A-Za-z]:$/,mf=/^(?:[\\/]{2}(?!\?[\\/])|\\\\\?\\UNC\\)[^\\/]+[\\/][^\\/]+$/i;function hf(e){let t=e.replace(/[\\/]+$/,``);if(pf.test(t)||mf.test(t))return null;let n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));if(n<0)return null;if(n===0)return t.slice(0,1);let r=t.slice(0,n);return pf.test(r)?t.slice(0,n+1):r}var gf=`x-apple.systempreferences:com.apple.preference.security?Privacy_FilesAndFolders`,_f=`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-foreground hover:bg-muted`;function vf({path:e,selected:t,onSelect:n,onEnter:r,decorate:i,emptyHint:a,showHidden:o=!1}){let s=Ue(e,o),c=s.data?.parent??null,l=e===null?null:hf(e);return(0,Z.jsxs)(Z.Fragment,{children:[s.data||s.isError?(0,Z.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-meta text-soft-foreground`,title:s.data?.path??void 0,children:s.data?.path??``}):(0,Z.jsx)(cl,{label:`Loading folder…`,"data-slot":`fs-breadcrumb`,children:(0,Z.jsx)(ll,{className:`my-[3px] h-3 w-48 max-w-full`})}),!s.isError&&s.data?.parent===null?(0,Z.jsxs)(`p`,{"data-slot":`fs-root-hint`,className:`text-label text-soft-foreground`,children:[`This is the browse root. To browse elsewhere, change`,` `,(0,Z.jsx)(`a`,{href:`/settings/global/projects`,className:`text-foreground underline underline-offset-4 hover:text-muted-foreground`,children:`Default browse folder in Settings → Projects`}),`.`]}):null,s.isError?(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-ui text-danger`,children:s.error instanceof Error?s.error.message:`could not list that folder`}),s.error instanceof sn&&s.error.status===403?(0,Z.jsx)(`p`,{"data-slot":`fs-privacy-hint`,className:`text-label text-soft-foreground`,children:`Allow it under Privacy & Security ▸ Files & Folders, then try again.`}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-label`,children:[l===null?null:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`fs-error-back`,onClick:()=>r(l),className:_f,children:[(0,Z.jsx)($u,{className:`size-3.5`,"aria-hidden":!0}),`Back`]}),s.error instanceof sn&&s.error.status===403?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`a`,{"data-slot":`fs-privacy-settings`,href:gf,target:`_blank`,rel:`noreferrer`,className:_f,children:`Open Privacy Settings`}),(0,Z.jsx)(`button`,{type:`button`,"data-slot":`fs-retry`,onClick:()=>void s.refetch(),className:_f,children:`Try again`})]}):null]})]}):(0,Z.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,Z.jsx)(`li`,{className:`flex`,children:(0,Z.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-ui hover:bg-muted`,children:[(0,Z.jsx)($u,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(s.data?.dirs??[]).map(e=>(0,Z.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":t?.path===e.path,onClick:()=>n(e),onDoubleClick:()=>r(e.path),className:H(`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left text-ui hover:bg-muted`,t?.path===e.path&&`bg-muted`),children:[(0,Z.jsx)(Eo,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.name}),i?.(e)]}),(0,Z.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,Z.jsx)(Ga,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),s.data&&s.data.dirs.length===0?(0,Z.jsx)(`li`,{className:`px-3 py-2 text-ui text-muted-foreground`,children:a}):null]}),s.data?.truncated?(0,Z.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-meta text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function yf(e,t,n=!1){let r=Ue(e,n);return t?.path??r.data?.path??null}function bf({open:e,onOpenChange:t}){let[n,r]=(0,X.useState)(null),[a,o]=(0,X.useState)(null),s=i(),c=nn(),l=Mr(),u=new Set((s.data?.projects??[]).filter(e=>!e.unregistered).map(e=>e.root)),d=e=>{r(e),o(null),c.reset()},f=yf(n,a);return(0,Z.jsx)(ol,{open:e,onOpenChange:t,children:(0,Z.jsxs)(rl,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,Z.jsxs)(tl,{children:[(0,Z.jsx)(il,{children:`Open local folder`}),(0,Z.jsx)(al,{children:`Pick the folder cezar should run in. Git repos are marked; any folder works.`})]}),(0,Z.jsx)(vf,{path:n,selected:a,onSelect:o,onEnter:d,emptyHint:`No subfolders here — “Add project” registers this folder.`,decorate:e=>(0,Z.jsxs)(Z.Fragment,{children:[e.isRepo?(0,Z.jsx)(ff,{variant:`outline`,className:`shrink-0 text-micro`,children:`git`}):null,u.has(e.path)?(0,Z.jsx)(ff,{variant:`ghost`,className:`shrink-0 text-micro text-muted-foreground`,children:`already added`}):null]})}),c.isError?(0,Z.jsx)(`p`,{"data-slot":`add-project-error`,className:`min-w-0 break-words text-ui text-danger`,children:c.error instanceof Error?c.error.message:`could not add that folder`}):null,(0,Z.jsxs)(nl,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,Z.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-meta text-muted-foreground`,title:f??void 0,children:f??``}),(0,Z.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,Z.jsx)(q,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Z.jsx)(q,{"data-slot":`add-project-confirm`,disabled:f===null||c.isPending,onClick:()=>{f===null||c.isPending||c.mutate(f,{onSuccess:({project:e})=>{t(!1),l(`/p/${encodeURIComponent(e.id)}/`)}})},children:c.isPending?`Adding…`:`Add project`})]})]})]})})}function xf(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 Sf({open:e,onOpenChange:t}){let[n,r]=(0,X.useState)(``),[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(!1),d=(0,X.useRef)(!1),f=i(),p=lt(),{mutate:m,isPending:h}=p,g=Mr(),_=xf(p.error),v=(0,X.useMemo)(()=>`co-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),y=(0,X.useRef)(v);y.current=v,(0,X.useEffect)(()=>ai((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===y.current&&(n.phase===`cloning`&&n.line?c(n.line):n.phase!==`cloning`&&c(null))}),[]);let b=(0,X.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),x=a.trim()===``?b:a.trim(),S=f.data?.projectsDir??``,C=x===``?``:`${S.replace(/\/+$/,``)}/${x}`,w=(0,X.useCallback)(()=>{n.trim()===``||h||(d.current=!1,u(!1),c(null),m({url:n.trim(),checkoutId:v,...a.trim()===``?{}:{name:a.trim()}},{onSuccess:({project:e})=>{t(!1),g(`/p/${encodeURIComponent(e.id)}/`)}}))},[m,h,v,a,g,t,n]);return(0,X.useEffect)(()=>{if(!l)return;let e=()=>{d.current&&(d.current=!1,u(!1),w())},t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[l,w]),(0,Z.jsx)(ol,{open:e,onOpenChange:e=>p.isPending?void 0:t(e),children:(0,Z.jsxs)(rl,{"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,Z.jsxs)(tl,{children:[(0,Z.jsx)(il,{children:`Clone from GitHub`}),(0,Z.jsxs)(al,{children:[`The service clones with `,(0,Z.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,Z.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Z.jsx)(ho,{htmlFor:`clone-url`,children:`Repository`}),(0,Z.jsx)(gl,{id:`clone-url`,"data-slot":`clone-url`,autoFocus:!0,placeholder:`owner/repo or https://github.com/owner/repo`,value:n,disabled:p.isPending,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&w()}})]}),(0,Z.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Z.jsx)(ho,{htmlFor:`clone-name`,children:`Folder name`}),(0,Z.jsx)(gl,{id:`clone-name`,"data-slot":`clone-name`,placeholder:b===``?`repo`:b,value:a,disabled:p.isPending,onChange:e=>o(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Z.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-meta text-soft-foreground`,title:C,children:C}),p.isPending?(0,Z.jsx)(q,{"data-slot":`clone-root-settings`,variant:`ghost`,size:`icon-sm`,className:`size-7`,"aria-label":`Edit checkout root`,disabled:!0,children:(0,Z.jsx)(po,{className:`size-3.5`,"aria-hidden":`true`})}):(0,Z.jsx)(el,{label:`Edit checkout root`,children:(0,Z.jsx)(q,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,Z.jsx)(U,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,children:(0,Z.jsx)(po,{className:`size-3.5`,"aria-hidden":`true`})})})})]})]}),p.isPending?(0,Z.jsx)(`p`,{"data-slot":`clone-progress`,className:`truncate font-mono text-meta text-muted-foreground`,children:s??`Starting the clone…`}):null,p.isError?(0,Z.jsx)(`div`,{"data-slot":`clone-error`,className:`grid min-w-0 gap-1.5 text-ui text-danger`,children:_?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{children:`GitHub requires SAML authorization for this organization.`}),(0,Z.jsxs)(`p`,{children:[(0,Z.jsx)(`a`,{"data-slot":`clone-sso-link`,className:`font-medium underline underline-offset-2`,href:_,target:`_blank`,rel:`noreferrer`,onClick:()=>{d.current=!0,u(!0)},children:`Authorize this GitHub organization`}),l?` — return here after authorizing, or choose Retry clone.`:` — return to this tab to retry, or choose Retry clone.`]}),(0,Z.jsxs)(`details`,{className:`min-w-0`,children:[(0,Z.jsx)(`summary`,{children:`Error details`}),(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap break-all`,children:p.error instanceof Error?p.error.message:null})]})]}):(0,Z.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-all`,children:p.error instanceof Error?p.error.message:`could not clone that repository`})}):null,(0,Z.jsxs)(nl,{children:[(0,Z.jsx)(q,{variant:`outline`,disabled:p.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,Z.jsx)(q,{"data-slot":`clone-confirm`,disabled:n.trim()===``||x===``||p.isPending,onClick:w,children:p.isPending?`Cloning…`:p.isError?`Retry clone`:`Clone`})]})]})})}var Cf=[{slug:`github/codespaces-nextjs`,label:`Next.js`,description:`Minimal Next.js app (GitHub)`},{slug:`vercel/ai-chatbot`,label:`Next.js AI chatbot`,description:`Full-featured AI chat app (Vercel)`},{slug:`vercel/nextjs-postgres-nextauth-tailwindcss-template`,label:`Next.js admin dashboard`,description:`Postgres, Auth.js and Tailwind (Vercel)`},{slug:`github/codespaces-react`,label:`React + Vite`,description:`React single-page app (GitHub)`},{slug:`antfu-collective/vitesse`,label:`Vue + Vite`,description:`Opinionated Vue starter (Vitesse)`},{slug:`nuxt-ui-templates/starter-vue`,label:`Vue + Nuxt UI`,description:`Vue + Vite with Nuxt UI (Nuxt)`},{slug:`mugnavo/cove`,label:`Vite+`,description:`TanStack Start on Vite+ (vp), Better Auth`},{slug:`w3cj/hono-open-api-starter`,label:`Hono`,description:`Type-safe JSON API with OpenAPI docs`},{slug:`github/codespaces-express`,label:`Express`,description:`Node.js web server (GitHub)`},{slug:`andrewmcodes/obsidian-beginner-vault-template`,label:`Obsidian vault`,description:`Your own knowledge base in Markdown`},{slug:`chibat/chrome-extension-typescript-starter`,label:`Chrome extension`,description:`TypeScript extension starter`},{slug:`actions/typescript-action`,label:`GitHub Action`,description:`TypeScript action with tests (GitHub)`},{slug:`microsoft/python-package-template`,label:`Python package`,description:`Packaging, tests and CI (Microsoft)`},{slug:`github/codespaces-flask`,label:`Flask`,description:`Python web app (GitHub)`},{slug:`github/codespaces-django`,label:`Django`,description:`Python web framework (GitHub)`},{slug:`github/codespaces-rails`,label:`Ruby on Rails`,description:`Rails app (GitHub)`},{slug:`github/codespaces-jupyter`,label:`Jupyter notebooks`,description:`Data science and ML (GitHub)`}];function wf(e){let t=e.trim().toLowerCase();return t===``||Cf.some(e=>e.slug.toLowerCase()===t)?Cf:Cf.filter(e=>[e.label,e.slug,e.description].some(e=>e.toLowerCase().includes(t)))}function Tf({value:e,onChange:t,disabled:n,id:r}){let[i,a]=(0,X.useState)(-1),o=(0,X.useId)(),s=wf(e),c=(0,X.useRef)(null),l=e.trim();(0,X.useEffect)(()=>{i<0||c.current?.querySelector(`[data-index="${i}"]`)?.scrollIntoView?.({block:`nearest`})},[i]),(0,X.useEffect)(()=>{c.current?.querySelector(`[aria-selected="true"]`)?.scrollIntoView?.({block:`nearest`})},[l]);let u=e=>{n||(t(e),a(-1))};return(0,Z.jsxs)(`div`,{className:`grid gap-2 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,Z.jsx)(gl,{id:r,"data-slot":`create-template`,role:`combobox`,"aria-expanded":s.length>0,"aria-controls":o,"aria-autocomplete":`list`,"aria-activedescendant":i>=0?`${o}-${i}`:void 0,autoComplete:`off`,placeholder:`Search, or paste owner/repo or a URL`,value:e,disabled:n,onBlur:()=>a(-1),onChange:e=>{t(e.target.value),a(-1)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;a(e=>s.length===0?-1:(e+t+s.length)%s.length)}else if(e.key===`Enter`&&i>=0){e.preventDefault();let t=s[i];t&&u(t.slug)}}}),s.length>0?(0,Z.jsx)(`ul`,{ref:c,id:o,role:`listbox`,"aria-label":`Suggested templates`,"aria-disabled":n||void 0,"data-slot":`create-template-suggestions`,className:H(`max-h-56 overflow-y-auto overscroll-contain rounded-md border border-border p-1`,`md:max-h-none md:min-h-36 md:flex-1`,n?`pointer-events-none opacity-50`:void 0),children:s.map((e,t)=>{let n=e.slug===l;return(0,Z.jsxs)(`li`,{id:`${o}-${t}`,role:`option`,"aria-selected":n,"data-index":t,"data-slot":`create-template-suggestion`,"data-template":e.slug,onMouseDown:e=>e.preventDefault(),onClick:()=>u(e.slug),onMouseEnter:()=>a(t),onMouseLeave:()=>a(-1),className:H(`grid cursor-pointer gap-0.5 rounded-sm border px-2 py-1.5`,n?`border-primary bg-primary/5`:`border-transparent`,t===i&&!n?`bg-accent text-accent-foreground`:void 0),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline justify-between gap-2`,children:[(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-sm font-medium`,children:[e.label,n?(0,Z.jsx)(Qa,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":`true`}):null]}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-meta text-muted-foreground`,children:e.description})]}),(0,Z.jsx)(`span`,{className:`truncate font-mono text-meta text-soft-foreground`,children:e.slug})]},e.slug)})}):(0,Z.jsxs)(`p`,{"data-slot":`create-template-no-match`,className:`px-1 text-label text-muted-foreground`,children:[`No suggested template matches — any `,(0,Z.jsx)(`span`,{className:`font-mono`,children:`owner/repo`}),` or GitHub URL works.`]})]})}function Ef(e){return e.trimStart().replace(/\s+/g,`-`)}function Df({open:e,onOpenChange:t}){let[n,r]=(0,X.useState)(``),[a,o]=(0,X.useState)(!0),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(`empty`),[p,m]=(0,X.useState)(null),h=i(),g=Gt(),_=Re(),v=Mr(),y=(0,X.useMemo)(()=>`np-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),b=(0,X.useRef)(y);b.current=y,(0,X.useEffect)(()=>ai((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===b.current&&(n.phase===`cloning`&&n.line?m(n.line):n.phase!==`cloning`&&m(null))}),[]);let x=g.data,S=x?.available===!0&&Array.isArray(x.owners)&&x.owners.length>0,C=(0,X.useMemo)(()=>x?.available&&Array.isArray(x.owners)?x.owners:[],[x]),w=C.some(e=>e.login===s)?s:C[0]?.login??``,T=a&&S,E=n.trim(),D=mr.test(E),O=E===``||D?null:E.length>100?`At most 100 characters.`:`Use letters, digits, “.”, “-” and “_” only.`,k=h.data?.projectsDir??``,A=D?`${k.replace(/\/+$/,``)}/${E}`:``,j=T&&d===`template`,M=j&&l.trim()===``,N=()=>{if(!D||_.isPending||a&&g.isPending||M)return;m(null);let e=l.trim();_.mutate({name:E,checkoutId:y,...T?{github:{owner:w,...j&&e!==``?{template:e}:{}}}:{}},{onSuccess:({project:e})=>{t(!1),v(`/p/${encodeURIComponent(e.id)}/`)}})},P=_.isPending,ee=g.isPending||S;return(0,Z.jsx)(ol,{open:e,onOpenChange:e=>P?void 0:t(e),children:(0,Z.jsxs)(rl,{"data-slot":`create-project-dialog`,className:H(`max-h-[calc(100dvh-2rem)] overflow-y-auto`,ee?`md:h-[min(50rem,calc(100dvh-4rem))] md:max-w-3xl md:grid-rows-[auto_minmax(0,1fr)_auto] md:overflow-hidden`:void 0),children:[(0,Z.jsxs)(tl,{children:[(0,Z.jsx)(il,{children:`New project`}),(0,Z.jsx)(al,{children:`cezar creates a new git repository in your checkout root and adds it as a project.`})]}),(0,Z.jsxs)(`div`,{"data-slot":`create-layout`,className:H(`grid gap-6`,ee?`md:min-h-0 md:grid-cols-[minmax(0,5fr)_minmax(0,6fr)]`:void 0),children:[ee?(0,Z.jsx)(`div`,{"data-slot":`create-owners-column`,className:`min-w-0 md:flex md:min-h-0 md:flex-col md:border-r md:border-border md:pr-6`,children:S?(0,Z.jsx)(Of,{owners:C,value:w,disabled:P||!T,onChange:c}):(0,Z.jsx)(Af,{})}):null,(0,Z.jsxs)(`div`,{"data-slot":`create-form-column`,className:H(`grid min-w-0 content-start gap-4`,ee?`md:-m-1 md:flex md:min-h-0 md:flex-col md:overflow-y-auto md:p-1`:void 0),children:[(0,Z.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Z.jsx)(ho,{htmlFor:`create-name`,children:`Name`}),(0,Z.jsx)(gl,{id:`create-name`,"data-slot":`create-name`,autoFocus:!0,placeholder:`my-project`,value:n,disabled:P,"aria-invalid":O!==null,"aria-describedby":`create-name-hint`,onChange:e=>r(Ef(e.target.value)),onKeyDown:e=>{e.key===`Enter`&&N()}}),O?(0,Z.jsx)(`p`,{id:`create-name-hint`,"data-slot":`create-name-error`,className:`text-label text-danger`,children:O}):(0,Z.jsx)(`p`,{id:`create-name-hint`,"data-slot":`create-target`,className:`min-w-0 truncate font-mono text-meta text-soft-foreground`,title:A,children:A})]}),(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-border p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(ho,{htmlFor:`create-github`,className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(_d,{className:`size-3.5`,"aria-hidden":`true`}),`Create a private GitHub repository`]}),(0,Z.jsx)(mo,{id:`create-github`,"data-slot":`create-github`,checked:T,disabled:P||!S,onCheckedChange:o})]}),g.isPending?(0,Z.jsx)(`p`,{className:`text-label text-muted-foreground`,children:`Checking GitHub…`}):S?null:(0,Z.jsx)(`p`,{"data-slot":`create-github-unavailable`,className:`text-label text-muted-foreground`,children:x&&!x.available?x.reason:`Could not read your GitHub accounts — the project will be created locally only.`}),T?(0,Z.jsxs)(`p`,{className:`text-label text-muted-foreground`,children:[`Created as `,(0,Z.jsx)(`strong`,{children:`private`}),` under `,(0,Z.jsx)(`strong`,{children:w}),` — you can change its visibility on GitHub.`]}):null]}),(0,Z.jsxs)(`div`,{"data-slot":`create-start`,className:`grid gap-3 rounded-md border border-border p-3 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,Z.jsx)(`span`,{id:`create-start-label`,className:`text-sm font-medium`,children:`Start with`}),(0,Z.jsxs)(`div`,{role:`radiogroup`,"aria-labelledby":`create-start-label`,className:`grid gap-2 sm:grid-cols-2`,children:[(0,Z.jsx)(kf,{slot:`create-start-empty`,checked:!j,disabled:P,title:`Empty repository`,hint:`One empty commit, no files.`,onSelect:()=>f(`empty`)}),(0,Z.jsx)(kf,{slot:`create-start-template`,checked:j,disabled:P||!T,title:`From a template`,hint:T?`Copy a GitHub template.`:`Needs a GitHub repository.`,onSelect:()=>f(`template`)})]}),j?(0,Z.jsxs)(`div`,{className:`grid gap-1.5 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,Z.jsx)(ho,{htmlFor:`create-template`,children:`Template`}),(0,Z.jsx)(Tf,{id:`create-template`,value:l,disabled:P,onChange:u})]}):null]}),P?(0,Z.jsx)(`p`,{"data-slot":`create-progress`,className:`truncate font-mono text-meta text-muted-foreground`,children:p??`Starting…`}):null,_.isError?(0,Z.jsx)(`p`,{"data-slot":`create-error`,className:`whitespace-pre-line text-ui text-danger`,children:_.error instanceof Error?_.error.message:`could not create the project`}):null]})]}),(0,Z.jsxs)(nl,{children:[(0,Z.jsx)(q,{variant:`outline`,disabled:P,onClick:()=>t(!1),children:`Cancel`}),(0,Z.jsx)(q,{"data-slot":`create-confirm`,disabled:!D||P||M||a&&g.isPending,onClick:N,children:P?`Creating…`:`Create`})]})]})})}function Of({owners:e,value:t,disabled:n,onChange:r}){let i=(0,X.useRef)([]),a=(t,n)=>{if(e.length===0)return;let a=(t+n+e.length)%e.length,o=e[a]?.login;o!==void 0&&(r(o),i.current[a]?.focus())};return(0,Z.jsxs)(`div`,{className:`grid gap-3 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,Z.jsx)(`span`,{id:`create-owner-label`,className:`eyebrow text-muted-foreground`,children:`Select organization`}),(0,Z.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`create-owner-label`,"data-slot":`create-owner`,className:`-mx-1 grid max-h-64 content-start gap-2 overflow-y-auto px-1 py-0.5 md:max-h-none md:min-h-0 md:flex-1`,children:e.map((e,o)=>{let s=e.login===t;return(0,Z.jsxs)(`button`,{ref:e=>{i.current[o]=e},type:`button`,role:`radio`,"aria-checked":s,tabIndex:s?0:-1,disabled:n,"data-slot":`create-owner-option`,"data-owner":e.login,onClick:()=>r(e.login),onKeyDown:e=>{e.key===`ArrowDown`||e.key===`ArrowRight`?(e.preventDefault(),a(o,1)):(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(e.preventDefault(),a(o,-1))},className:H(`flex w-full items-center gap-3 rounded-lg border bg-card px-3 py-2.5 text-left outline-none transition-colors`,`focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,s?`border-primary bg-primary/5`:`border-border hover:bg-muted/50`),children:[(0,Z.jsx)(jf,{owner:e}),(0,Z.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate text-sm font-semibold`,children:[e.login,s?(0,Z.jsx)(Qa,{className:`size-4 shrink-0 text-primary`,"aria-hidden":`true`}):null]}),e.personal?(0,Z.jsx)(`span`,{className:`text-label text-muted-foreground`,children:`Personal account`}):e.description?(0,Z.jsx)(`span`,{className:`line-clamp-2 text-label text-muted-foreground`,children:e.description}):null]})]},e.login)})})]})}function kf({slot:e,checked:t,disabled:n,title:r,hint:i,onSelect:a}){return(0,Z.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,disabled:n,"data-slot":e,onClick:a,className:H(`grid gap-0.5 rounded-md border px-3 py-2 text-left outline-none transition-colors`,`focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50`,t?`border-primary bg-primary/5`:`border-border hover:bg-muted/50`),children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:r}),(0,Z.jsx)(`span`,{className:`text-label text-muted-foreground`,children:i})]})}function Af(){return(0,Z.jsxs)(`div`,{className:`grid gap-3`,"data-slot":`create-owners-loading`,"aria-hidden":`true`,children:[(0,Z.jsx)(`span`,{className:`eyebrow text-muted-foreground`,children:`Select organization`}),[0,1].map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-border px-3 py-2.5`,children:[(0,Z.jsx)(`span`,{className:`size-9 shrink-0 animate-pulse rounded-full bg-muted`}),(0,Z.jsx)(`span`,{className:`h-3 w-24 animate-pulse rounded bg-muted`})]},e))]})}function jf({owner:e}){let[t,n]=(0,X.useState)(!1),r=e.personal?`rounded-full`:`rounded-md`;return e.avatarUrl&&!t?(0,Z.jsx)(`img`,{src:e.avatarUrl,alt:``,width:36,height:36,loading:`lazy`,onError:()=>n(!0),"data-slot":`create-owner-avatar`,className:H(`size-9 shrink-0 bg-muted`,r)}):(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:H(`flex size-9 shrink-0 items-center justify-center bg-muted text-sm font-semibold text-muted-foreground uppercase`,r),children:e.login.slice(0,1)})}var Mf=class extends X.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){console.error(`[cezar] ${this.props.label} failed to render`,e),Y(`${this.props.label} failed to open: ${e instanceof Error?e.message:String(e)}`,{tone:`danger`}),this.props.onError()}render(){return this.state.failed?null:this.props.children}};function Nf(e){return(0,Z.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,Z.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`})})}function Pf({className:e}){let[t,n]=X.useState(!1),[r,i]=X.useState(!1),[a,o]=X.useState(!1);return(0,Z.jsxs)(lo,{children:[(0,Z.jsx)(oo,{asChild:!0,children:(0,Z.jsxs)(q,{variant:`ghost`,size:`sm`,"data-slot":`add-project`,"aria-label":`Add project`,className:e,children:[(0,Z.jsx)(ts,{className:`size-3.5`,"aria-hidden":`true`}),`Add project`]})}),(0,Z.jsxs)(so,{align:`start`,className:`w-56`,children:[(0,Z.jsx)($a,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,Z.jsxs)(ro,{"data-slot":`add-project-local`,onSelect:()=>{n(!0),wl(`folder`)},children:[(0,Z.jsx)(Eo,{"aria-hidden":`true`}),`Open local folder…`]}),(0,Z.jsxs)(ro,{"data-slot":`add-project-clone`,onSelect:()=>{i(!0),wl(`clone`)},children:[(0,Z.jsx)(Nf,{"aria-hidden":`true`}),`Clone from GitHub…`]}),(0,Z.jsxs)(ro,{"data-slot":`add-project-create`,onSelect:()=>{o(!0),wl(`new`)},children:[(0,Z.jsx)(od,{"aria-hidden":`true`}),`New project…`]})]}),t?(0,Z.jsx)(Mf,{label:`Open local folder`,onError:()=>n(!1),children:(0,Z.jsx)(bf,{open:!0,onOpenChange:n})}):null,r?(0,Z.jsx)(Mf,{label:`Clone from GitHub`,onError:()=>i(!1),children:(0,Z.jsx)(Sf,{open:!0,onOpenChange:i})}):null,a?(0,Z.jsx)(Mf,{label:`New project`,onError:()=>o(!1),children:(0,Z.jsx)(Df,{open:!0,onOpenChange:o})}):null]})}var Ff=[`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`],If={x:177.9,y:78.7,width:348.2,height:546.6},Lf={mark:26,name:19,gap:11.4};function Rf({height:e=Lf.mark,className:t}){return(0,Z.jsx)(`svg`,{"data-slot":`brand-mark`,"aria-hidden":`true`,focusable:`false`,viewBox:`${If.x} ${If.y} ${If.width} ${If.height}`,height:e,width:e*If.width/If.height,fill:`currentColor`,className:H(`shrink-0`,t),children:Ff.map(e=>(0,Z.jsx)(`polygon`,{points:e},e))})}function zf({className:e,name:t=`cezar`,logoUrl:n=null}){return(0,Z.jsxs)(`span`,{"data-slot":`brand-lockup`,className:H(`flex min-w-0 items-center text-foreground`,e),style:{gap:Lf.gap},children:[n?(0,Z.jsx)(`img`,{"data-slot":`brand-logo`,src:n,alt:``,className:`size-[26px] shrink-0 object-contain`}):(0,Z.jsx)(Rf,{}),(0,Z.jsx)(`span`,{"data-slot":`brand-name`,className:H(`max-w-full truncate leading-none font-semibold tracking-normal`,t===`cezar`&&`lowercase`),style:{fontFamily:`var(--brand)`,fontSize:Lf.name},children:t})]})}var Bf=`, tasks need you`,Vf={"needs-you":`, a manager needs you`,unread:`, a manager has news`},Hf=`relative flex h-7 min-w-0 items-center justify-center gap-1.5 rounded-[7px] px-2 text-ui font-medium text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 max-md:h-9`,Uf=`bg-card font-semibold text-foreground shadow-xs`;function Wf({managerMode:e,projectsTo:t,managerTo:n,projectsAttention:r,managerAttention:i}){return{projects:{to:t,active:!e,dot:e&&r?`bg-info`:null,dotText:Bf},manager:{to:n,active:e,dot:!e&&i?Is[i]:null,dotText:i?Vf[i]:``}}}function Gf(e){let{projects:t,manager:n}=Wf(e),{managerMode:r,onNavigate:i}=e;return(0,Z.jsxs)(`nav`,{"aria-label":`Mode`,"data-slot":`mode-switch`,className:`mx-3 mb-2 grid grid-cols-2 gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,Z.jsxs)(U,{to:t.to,"data-mode":`projects`,"aria-current":t.active?`page`:void 0,onClick:i,className:H(Hf,t.active&&Uf),children:[(0,Z.jsx)(cd,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),`Projects`,t.dot?(0,Z.jsx)(Kf,{tone:t.dot,text:t.dotText}):null]}),(0,Z.jsxs)(U,{to:n.to,"data-mode":`manager`,"aria-current":n.active?`page`:void 0,onClick:()=>{r||Oc(`sidebar`),i?.()},className:H(Hf,n.active&&Uf),children:[(0,Z.jsx)(Oa,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),`Manager`,n.dot?(0,Z.jsx)(Kf,{tone:n.dot,text:n.dotText}):null]})]})}function Kf({tone:e,text:t}){return(0,Z.jsxs)(`span`,{"data-slot":`mode-switch-dot`,className:`flex shrink-0`,children:[(0,Z.jsx)(`span`,{className:H(`size-1.5 rounded-full`,e),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t})]})}var qf=`relative flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`;function Jf(e){let{projects:t,manager:n}=Wf(e),{managerMode:r}=e;return(0,Z.jsxs)(`nav`,{"aria-label":`Mode`,"data-slot":`rail-mode-switch`,className:`flex flex-col items-center gap-1 border-b border-border pb-1.5`,children:[(0,Z.jsx)(el,{label:`Projects`,side:`right`,children:(0,Z.jsxs)(U,{to:t.to,"data-mode":`projects`,"aria-label":`Projects${t.dot?t.dotText:``}`,"aria-current":t.active?`page`:void 0,className:H(qf,t.active&&`bg-muted text-foreground`),children:[(0,Z.jsx)(cd,{className:`size-4`,"aria-hidden":`true`}),t.dot?(0,Z.jsx)(`span`,{"data-slot":`mode-switch-dot`,"aria-hidden":`true`,className:H(`absolute top-1 right-1 size-1.5 rounded-full`,t.dot)}):null]})}),(0,Z.jsx)(el,{label:`Manager`,side:`right`,children:(0,Z.jsxs)(U,{to:n.to,"data-mode":`manager`,"aria-label":`Manager${n.dot?n.dotText:``}`,"aria-current":n.active?`page`:void 0,onClick:()=>{r||Oc(`sidebar`)},className:H(qf,n.active&&`bg-muted text-foreground`),children:[(0,Z.jsx)(Oa,{className:`size-4`,"aria-hidden":`true`}),n.dot?(0,Z.jsx)(`span`,{"data-slot":`mode-switch-dot`,"aria-hidden":`true`,className:H(`absolute top-1 right-1 size-1.5 rounded-full`,n.dot)}):null]})})]})}var Yf=[{to:`/`,label:`Now`,icon:Sa,match:[`/`],badge:`needs-you`},{to:`/tasks`,label:`Tasks`,icon:gd,match:[`/tasks`,`/compare`],badge:`tasks-unread`},{to:`/inbox`,label:`Inbox`,icon:fd,match:[`/inbox`],badge:`inbox-count`,inbox:!0,group:`workspace`},{to:`/git`,label:`Git`,icon:Oo,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:Nf,match:[`/github`],forge:!0},{to:`/tracker`,label:`Tracker`,icon:Ld,match:[`/tracker`],tracker:!0},{to:`/assets`,label:`Assets`,icon:ja,match:[`/assets`]},{to:`/terminal`,label:`Terminal`,icon:os,match:[`/terminal`],terminal:!0},{to:`/automations`,label:`Automations`,icon:ds,match:[`/automations`],automations:!0},{to:`/skills`,label:`Skills`,icon:La,match:[`/skills`],badge:`skills-update`},{to:`/workflows`,label:`Workflows`,icon:bo,match:[`/workflows`]},{to:`/settings`,label:`Settings`,icon:po,match:[`/settings`],group:`workspace`}];function Xf({forge:e=!1,inbox:t=!1,automations:n=!1,tracker:r,terminal:i=!1}={}){return Yf.filter(a=>(!a.forge||e)&&(!a.inbox||t)&&(!a.automations||n)&&(!a.terminal||i)&&(!a.tracker||r!==void 0)).map(e=>e.tracker?{...e,label:r?Bd[r].label:e.label}:e)}function Zf(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function Qf(e){let t=null;for(let n of Yf)for(let r of n.match)Zf(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function $f(e){let t=Qf(e);return Yf.find(e=>e.to===t)??null}var ep=`relative flex h-14 min-w-0 flex-1 flex-col items-center justify-center gap-0.5 text-meta font-medium text-muted-foreground outline-none transition-colors focus-visible:ring-[3px] focus-visible:ring-ring/50`,tp=`font-semibold text-foreground`;function np({menuOpen:e,onMore:t,manager:n=!1,attention:r=null,managerTo:a=`/manager`}){let o=xs(),s=E(),c=i(),l=Kr();if(o)return null;let u=c.data?.bootProject??s.data?.bootProject,d=kc(cc(l,c.data)??pc(),c.data,u),f=l.pathname===`/tasks`?null:Qf(Ur(l.pathname)),p=(e,t,n,r)=>(0,Z.jsxs)(U,{to:`${d}${e}`,"aria-current":f===r?`page`:void 0,className:H(ep,f===r&&tp),children:[(0,Z.jsx)(n,{className:`size-5`,"aria-hidden":`true`}),t]});return(0,Z.jsxs)(`nav`,{"aria-label":`App`,"data-slot":`phone-bottom-bar`,className:`flex border-t border-border bg-background md:hidden`,children:[p(``,`Now`,Sa,`/`),p(`tasks`,`Tasks`,gd,`/tasks`),(0,Z.jsx)(U,{to:`${d}new`,"aria-label":`New task`,"data-slot":`bottom-bar-new-task`,className:H(ep,`text-foreground`),children:(0,Z.jsx)(`span`,{className:`flex size-9 items-center justify-center rounded-full bg-primary text-primary-foreground`,children:(0,Z.jsx)(ts,{className:`size-5`,"aria-hidden":`true`})})}),(0,Z.jsxs)(U,{to:n?l.pathname===`/manager`?`/manager${l.search}`:`/manager?all=1`:a,"aria-current":n?`page`:void 0,onClick:()=>{n||Oc(`bottom_bar`)},"data-slot":`bottom-bar-manager`,className:H(ep,n&&tp),children:[(0,Z.jsx)(Oa,{className:`size-5`,"aria-hidden":`true`}),`Manager`,r?(0,Z.jsxs)(`span`,{"data-slot":`bottom-bar-attention`,className:`absolute top-2 left-[calc(50%+8px)] flex`,children:[(0,Z.jsx)(`span`,{className:H(`size-1.5 rounded-full`,Is[r]),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:Ls[r]})]}):null]}),(0,Z.jsxs)(`button`,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":e,onClick:t,className:ep,children:[(0,Z.jsx)(yo,{className:`size-5`,"aria-hidden":`true`}),`More`]})]})}function rp(e){return/^\d/.test(e)&&!e.includes(`+`)?`v${e}`:e}function ip(e,t){return!!t&&e.activeRuns>0&&e.scheduled?.target!==t}function ap({label:e=`Update when idle`,doing:t,onClick:n,disabled:r}){return(0,Z.jsx)(Zc,{delayDuration:300,children:(0,Z.jsxs)(Qc,{children:[(0,Z.jsx)(Xc,{asChild:!0,children:(0,Z.jsx)(q,{variant:`outline`,size:`sm`,onClick:n,disabled:r,children:e})}),(0,Z.jsxs)($c,{"data-slot":`update-when-idle-tooltip`,side:`bottom`,children:[`Waits until no task is running or queued, then `,t,` and restarts`]})]})})}function op(e){let t=/-pr(\d+)\./.exec(e);return t?Number(t[1]):null}function sp({data:e,onApply:t,onSchedule:n,applying:r}){let i=Ke(),a=wt(),[o,s]=(0,X.useState)(`worktrees`),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(!1),m=e.job?.status===`running`||e.job?.status===`restarting`,h=e.installed.find(e=>e.active),g=i.data?.checkouts??[],_=i.data?.pulls,v=!i.data||g.length>0,y=v?o:`pulls`,b=c.trim().toLowerCase(),x=(0,X.useMemo)(()=>g.filter(e=>!b||[e.branch,e.task?.title,e.task?.id,e.commit?.subject,e.worktree,e.pr?`#${e.pr}`:``].filter(Boolean).some(e=>e.toLowerCase().includes(b))),[g,b]),S=(0,X.useMemo)(()=>(_?.items??[]).filter(e=>!e.version&&!f?!1:!b||[`#${e.number}`,String(e.number),e.title,e.branch,e.author??``].some(e=>e.toLowerCase().includes(b))),[_,b,f]),C=(_?.items??[]).filter(e=>!e.version).length,w=y===`worktrees`?g.find(e=>e.id===u):void 0,T=y===`pulls`?_?.items.find(e=>e.version&&e.version===u):void 0,E=w?.id??T?.version??null,D=!!w&&(!w.built||w.stale),O=!!E&&E===h?.id&&!D,k=T&&!T.installed?`Install & restart`:D?`${w.built?`Rebuild`:`Build`} & ${w.id===h?.id?`restart`:`switch`}`:`Switch & restart`;return(0,Z.jsxs)(`div`,{"data-slot":`self-update-development`,className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`div`,{role:`tablist`,"aria-label":`Development builds`,className:`flex rounded-md border border-border bg-muted/40 p-0.5`,children:[...v?[{value:`worktrees`,label:`Worktrees`,count:g.length}]:[],{value:`pulls`,label:`Pull requests`,count:(_?.items.length??0)-C}].map(e=>(0,Z.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":y===e.value,onClick:()=>{s(e.value),d(null)},className:H(`rounded-[5px] px-3 py-1 text-label font-semibold transition-colors`,y===e.value?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[e.label,i.data?(0,Z.jsx)(`span`,{className:`ml-1.5 font-normal text-muted-foreground`,children:e.count}):null]},e.value))}),(0,Z.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>a.mutate(),disabled:a.isPending||i.isFetching,children:a.isPending?`Refreshing…`:`Refresh`})]}),(0,Z.jsx)(gl,{"aria-label":`Filter`,value:c,onChange:e=>l(e.target.value),placeholder:y===`worktrees`?`Filter by task, branch, commit or #PR`:`Filter by #number, title, branch or author`,className:`h-8 text-ui`}),(0,Z.jsx)(`div`,{className:`max-h-72 min-h-24 overflow-y-auto rounded-md border border-border`,children:i.isPending?(0,Z.jsx)(`p`,{className:`px-3 py-3 text-label text-muted-foreground`,children:`Looking for worktrees and pull requests…`}):i.error?(0,Z.jsx)(`p`,{className:`px-3 py-3 text-label text-danger`,children:i.error.message}):y===`worktrees`?(0,Z.jsxs)(Z.Fragment,{children:[x.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-3 text-label text-muted-foreground`,children:`Nothing matches.`}):null,(0,Z.jsx)(`div`,{role:`listbox`,"aria-label":`Worktrees`,children:x.map(e=>(0,Z.jsx)(lp,{checkout:e,active:e.id===h?.id,selected:u===e.id,onSelect:()=>d(e.id)},e.worktree))})]}):(0,Z.jsxs)(Z.Fragment,{children:[_&&!_.available?(0,Z.jsx)(`p`,{className:`px-3 py-2 text-label text-muted-foreground`,children:_.reason}):null,_?.available&&S.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-3 text-label text-muted-foreground`,children:_.items.length===0?`No open pull requests on ${_.repo}.`:b?`Nothing matches.`:`No open pull request has a preview build.`}):null,(0,Z.jsx)(`div`,{role:`listbox`,"aria-label":`Pull requests`,children:S.map(e=>(0,Z.jsx)(up,{pull:e,active:!!e.version&&e.version===h?.id,selected:!!e.version&&u===e.version,onSelect:()=>e.version&&d(e.version)},e.number))}),C>0?(0,Z.jsx)(`button`,{type:`button`,onClick:()=>p(e=>!e),className:`w-full border-t border-border px-3 py-2 text-left text-label text-muted-foreground hover:text-foreground`,children:f?`Hide the ${C} without a preview build`:`${C} more without a preview build (forks, CI not green yet) — show`}):null]})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,Z.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-meta text-muted-foreground`,title:w?.worktree,children:w?D?`${w.built?`Built before its last commit`:`Not built yet`} — runs npm run build in ${w.worktree} first (about a minute).`:w.worktree:T?`Installs ${T.version} from npm.`:y===`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.`}),!O&&ip(e,E)?(0,Z.jsx)(ap,{label:`When idle`,doing:T?`${T.installed?`switches to`:`installs`} PR #${T.number}'s build`:`${D?`builds and switches to`:`switches to`} ${w.branch}`,onClick:()=>n(E),disabled:!e.canSelfUpdate||r||m}):null,(0,Z.jsx)(q,{size:`sm`,variant:`contrast`,onClick:()=>E&&t(E),disabled:!E||O||!e.canSelfUpdate||r||m,children:k})]})]})}function cp({selected:e,disabled:t,onSelect:n,title:r,children:i}){return(0,Z.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:H(`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 lp({checkout:e,active:t,selected:n,onSelect:r}){let i=e.task?.title??e.commit?.subject??e.branch;return(0,Z.jsxs)(cp,{selected:n,disabled:!e.id,onSelect:r,title:e.worktree,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ui font-medium`,children:i}),e.pr?(0,Z.jsxs)(ff,{variant:`outline`,children:[`#`,e.pr]}):null,t?(0,Z.jsx)(ff,{variant:`secondary`,children:`current`}):null,e.built?e.stale?(0,Z.jsx)(ff,{variant:`outline`,children:`needs rebuild`}):null:(0,Z.jsx)(ff,{variant:`outline`,children:`not built`})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-meta text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono`,children:e.branch}),e.task?(0,Z.jsxs)(`span`,{className:`shrink-0`,children:[`· `,e.task.status]}):null,e.commit?(0,Z.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,e.commit.sha,` `,e.task?e.commit.subject:``,` · `,Ml(e.commit.at),` ago`]}):null,e.builtAt?(0,Z.jsxs)(`span`,{className:`shrink-0`,children:[`· built `,Ml(e.builtAt),` ago`]}):null]})]})}function up({pull:e,active:t,selected:n,onSelect:r}){return(0,Z.jsxs)(cp,{selected:n,disabled:!e.version,onSelect:r,title:e.url,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsxs)(`span`,{className:`shrink-0 text-ui text-muted-foreground`,children:[`#`,e.number]}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ui font-medium`,children:e.title}),e.draft?(0,Z.jsx)(ff,{variant:`outline`,children:`draft`}):null,t?(0,Z.jsx)(ff,{variant:`secondary`,children:`current`}):e.version?e.installed?(0,Z.jsx)(ff,{variant:`outline`,children:`installed`}):null:(0,Z.jsx)(ff,{variant:`outline`,children:`no build`})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-meta text-muted-foreground`,children:[e.author?(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.author}):null,(0,Z.jsxs)(`span`,{className:`min-w-0 truncate font-mono`,children:[`· `,e.branch]}),(0,Z.jsxs)(`span`,{className:`shrink-0`,children:[`· updated `,Ml(e.updatedAt),` ago`]}),e.version?(0,Z.jsxs)(`span`,{className:`shrink-0`,children:[`· build `,e.publishedAt?`${Ml(e.publishedAt)} ago`:e.version]}):null]})]})}function dp({open:e,onOpenChange:t,autoApply:n,brandName:r=`cezar`}){let i=ne(e),a=On(),o=N(),s=hn(),c=h(),l=It(),[u,d]=(0,X.useState)(``),f=i.data,p=(0,X.useRef)(null),m=(0,X.useRef)(!1);return(0,X.useEffect)(()=>{!n||m.current||!f||!f.canSelfUpdate||f.job||(m.current=!0,!(f.activeRuns>0)&&s.mutate(n))},[n,f,s]),(0,Z.jsx)(ol,{open:e,onOpenChange:e=>{!e&&f?.job?.status===`running`||t(e)},children:(0,Z.jsxs)(rl,{"data-slot":`self-update-dialog`,className:`sm:max-w-xl`,ref:p,onOpenAutoFocus:e=>{e.preventDefault(),p.current?.focus()},children:[(0,Z.jsxs)(tl,{children:[(0,Z.jsxs)(il,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(`span`,{children:[r,` `,f?`v${f.version}`:``]}),(0,Z.jsx)(_p,{data:f})]}),(0,Z.jsxs)(al,{className:`sr-only`,children:[`Update `,r,`, pick a release channel or switch versions.`]})]}),f?(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5`,children:[(0,Z.jsx)(mp,{data:f,busy:o.isPending,onChange:e=>{d(``),o.mutate(e)}}),(0,Z.jsx)(hp,{data:f,checking:a.isPending,onCheck:()=>a.mutate(),onApply:e=>s.mutate(e),onSchedule:e=>c.mutate(e),applying:s.isPending||c.isPending}),f.channel===`development`?(0,Z.jsx)(sp,{data:f,onApply:e=>s.mutate(e),onSchedule:e=>c.mutate(e),applying:s.isPending||c.isPending}):(0,Z.jsx)(gp,{data:f,picked:u,onPick:d,onApply:e=>s.mutate(e),onSchedule:e=>c.mutate(e),applying:s.isPending||c.isPending}),f.canSelfUpdate?null:(0,Z.jsx)(vp,{data:f}),f.scheduled?(0,Z.jsxs)(`div`,{"data-slot":`self-update-scheduled`,className:`flex items-center justify-between gap-3 rounded-md border border-primary/40 bg-primary/5 px-3 py-2 text-label`,children:[(0,Z.jsxs)(`p`,{className:`min-w-0`,children:[r,` switches to `,(0,Z.jsx)(`span`,{className:`font-semibold`,children:rp(f.scheduled.target)}),` as soon as no task is running. You can close this window and keep working.`]}),(0,Z.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>l.mutate(),disabled:l.isPending,children:`Cancel`})]}):f.activeRuns>0&&f.canSelfUpdate?(0,Z.jsxs)(`p`,{className:`rounded-md border border-pending/50 bg-pending/10 px-3 py-2 text-label text-foreground`,children:[f.activeRuns,` task`,f.activeRuns===1?` is`:`s are`,` running. A restart interrupts them; `,r,` re-queues or resumes them on the way back up.`,` `,`The “when idle” buttons wait for them to finish instead.`]}):null,o.error?(0,Z.jsxs)(`p`,{className:`text-label 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,Z.jsx)(`p`,{className:`text-label text-danger`,children:s.error.message}):null,c.error?(0,Z.jsx)(`p`,{className:`text-label text-danger`,children:c.error.message}):null,l.error?(0,Z.jsx)(`p`,{className:`text-label text-danger`,children:l.error.message}):null,f.job?(0,Z.jsx)(yp,{data:f}):null]}):i.error?(0,Z.jsx)(`p`,{className:`text-ui text-danger`,children:i.error.message}):null]})})}var fp=[{value:`stable`,label:`Stable`},{value:`nightly`,label:`Nightly`},{value:`development`,label:`Development`}],pp={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 mp({data:e,busy:t,onChange:n}){return(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-ui font-semibold`,children:`Release channel`}),(0,Z.jsx)(`div`,{className:`text-label text-muted-foreground`,children:pp[e.channel]})]}),(0,Z.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:fp.map(r=>{let i=e.channel===r.value;return(0,Z.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":i,disabled:t,onClick:()=>!i&&n(r.value),className:H(`rounded-[5px] px-3 py-1 text-label font-semibold transition-colors`,i?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:r.label},r.value)})})]})}function hp({data:e,checking:t,onCheck:n,onApply:r,onSchedule:i,applying:a}){let o=e.job?.status===`running`||e.job?.status===`restarting`,s=e.installed.find(e=>e.active),c=s?.source===`registry`?op(s.version):null,l=s&&(s.source===`link`||s.source===`local`||c!==null)?s:null;if(l||e.channel===`development`){let i=e.channel===`development`?null:e.latest[e.channel],s=i!==null&&e.installed.some(e=>e.source===`registry`&&e.id===i);return(0,Z.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,Z.jsx)(`div`,{className:`min-w-0 text-ui break-words`,children:l?.source===`link`?(0,Z.jsxs)(Z.Fragment,{children:[`Running worktree `,(0,Z.jsx)(`span`,{className:`font-mono text-label font-semibold`,children:l.branch??l.id}),`, not a release.`]}):l?.source===`local`?(0,Z.jsx)(Z.Fragment,{children:`Running a local build, not a release.`}):c===null?(0,Z.jsxs)(Z.Fragment,{children:[`Running `,(0,Z.jsxs)(`span`,{className:`font-semibold`,children:[`v`,e.version]}),`. Pick a worktree or a pull request below.`]}):(0,Z.jsxs)(Z.Fragment,{children:[`Running the preview build of `,(0,Z.jsxs)(`span`,{className:`font-semibold`,children:[`PR #`,c]}),`, not a release.`]})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 text-meta break-words text-muted-foreground`,children:e.channel===`development`?`Switch the channel back to Stable or Nightly to follow releases again.`:e.checkedAt?(0,Z.jsxs)(Z.Fragment,{children:[i?(0,Z.jsxs)(Z.Fragment,{children:[`Newest `,e.channel,`: `,(0,Z.jsxs)(`span`,{className:`font-mono text-foreground`,children:[`v`,i]}),` ·`,` `]}):null,`checked `,new Date(e.checkedAt).toLocaleTimeString()]}):`The npm registry has not answered yet.`}),e.channel===`development`?null:(0,Z.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,Z.jsx)(q,{variant:`ghost`,size:`sm`,onClick:n,disabled:t||o,children:t?`Checking…`:`Check again`}),i?(0,Z.jsx)(q,{size:`sm`,"aria-label":s?`Back to v${i}`:`Install v${i} & restart`,onClick:()=>r(i),disabled:!e.canSelfUpdate||a||o,children:s?`Switch back`:`Install & restart`}):null]})]})]})}let u=e.updateAvailable;return(0,Z.jsxs)(`div`,{"data-slot":`self-update-latest`,className:H(`flex flex-wrap items-center justify-between gap-x-3 gap-y-2 rounded-md border px-3 py-2.5`,u?`border-primary/40 bg-primary/5`:`border-border bg-card`),children:[(0,Z.jsxs)(`div`,{className:`min-w-[14rem] flex-1 text-ui break-words`,children:[e.checkedAt?u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`font-semibold`,children:[`v`,u]}),` is available on `,e.channel,`.`]}):(0,Z.jsxs)(Z.Fragment,{children:[`You are on the newest `,e.channel,` version`,e.channel===`nightly`&&e.latest.nightly?` (v${e.latest.nightly})`:``,`.`]}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`The npm registry has not answered yet.`}),e.checkedAt?(0,Z.jsxs)(`div`,{className:`text-meta text-muted-foreground`,children:[`checked `,new Date(e.checkedAt).toLocaleTimeString()]}):null]}),(0,Z.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,Z.jsx)(q,{variant:`ghost`,size:`sm`,onClick:n,disabled:t||o,children:t?`Checking…`:`Check again`}),ip(e,u)?(0,Z.jsx)(ap,{doing:`installs ${rp(u)}`,onClick:()=>i(u),disabled:!e.canSelfUpdate||a||o}):null,u?(0,Z.jsx)(q,{size:`sm`,onClick:()=>r(u),disabled:!e.canSelfUpdate||a||o,children:`Update & restart`}):null]})]})}function gp({data:e,picked:t,onPick:n,onApply:r,onSchedule:i,applying:a}){let o=e.job?.status===`running`||e.job?.status===`restarting`,s=(0,X.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]),c=s.find(e=>e.value===t);return(0,Z.jsxs)(`div`,{"data-slot":`self-update-picker`,className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`text-ui font-semibold`,children:[`Pick a version `,(0,Z.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,e.channel]})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsxs)(Za,{value:t,onValueChange:n,disabled:s.length===0||o,children:[(0,Z.jsx)(Ya,{size:`sm`,"aria-label":`Version`,className:`w-0 min-w-0 flex-1 text-ui`,children:(0,Z.jsx)(Xa,{placeholder:s.length===0?`No versions known`:`Choose a version to install`})}),(0,Z.jsx)(Ja,{className:`max-h-72`,children:s.map(e=>(0,Z.jsx)(J,{value:e.value,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.label,e.active?(0,Z.jsx)(ff,{variant:`secondary`,children:`current`}):e.installed?(0,Z.jsx)(ff,{variant:`outline`,children:`installed`}):null]})},e.value))})]}),c&&!c.active&&ip(e,c.value)?(0,Z.jsx)(ap,{label:`When idle`,doing:`${c.installed?`switches to`:`installs`} ${rp(c.value)}`,onClick:()=>i(c.value),disabled:!e.canSelfUpdate||a||o}):null,(0,Z.jsx)(q,{size:`sm`,variant:`contrast`,onClick:()=>c&&r(c.value),disabled:!c||c.active||!e.canSelfUpdate||a||o,children:c?.installed?`Switch & restart`:`Install & restart`})]}),(0,Z.jsx)(`p`,{className:`text-meta text-muted-foreground`,children:`Any version, older ones included. Installed versions stay on disk, so switching back is instant.`})]})}function _p({data:e}){let t=e?.installed.find(e=>e.active);if(t?.source===`local`)return(0,Z.jsx)(ff,{variant:`outline`,children:`local build`});if(t?.source===`link`)return(0,Z.jsxs)(ff,{variant:`outline`,children:[`worktree · `,t.branch??t.id]});let n=t?op(t.version):null;return n===null?null:(0,Z.jsxs)(ff,{variant:`outline`,children:[`PR #`,n,` build`]})}function vp({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,Z.jsxs)(`div`,{"data-slot":`self-update-install-hint`,className:`rounded-md border border-border bg-muted/40 px-3 py-2.5 text-label`,children:[(0,Z.jsx)(`p`,{children:e.reason}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-muted-foreground`,children:`Run this once, then start cezar with the plain command:`}),(0,Z.jsx)(`pre`,{className:`mt-1.5 overflow-x-auto rounded bg-background px-2 py-1.5 font-mono text-label`,children:t})]})}function yp({data:e}){let t=e.job,n=V(),r=(0,X.useRef)(null),[i,a]=(0,X.useState)(`waiting`);return(0,X.useEffect)(()=>{r.current?.scrollTo({top:r.current.scrollHeight})},[t.log.length]),(0,X.useEffect)(()=>{if(t.status!==`restarting`)return;let r=!1,i=Date.now(),o=()=>{a(`back`),n.removeQueries({queryKey:R.selfUpdate}),window.setTimeout(()=>window.location.reload(),400)},s=async()=>{if(!r){try{if((await St()).version!==e.version)return o();let t=await C().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,Z.jsxs)(`div`,{"data-slot":`self-update-job`,className:`flex min-w-0 flex-col gap-1.5`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-between text-label`,children:(0,Z.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,Z.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-meta leading-[1.5] break-all whitespace-pre-wrap text-muted-foreground`,children:t.log.join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/manager-settings-I1AeATjr.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/queries-BQUz3Wnb.js","assets/utils-Dp6vCdiU.js","assets/bundle-mjs-rHxsej31.js","assets/managers-Dr63u21Y.js","assets/createLucideIcon-BHp8sXmF.js","assets/reference-chip-BpbybBvl.js","assets/circle-check-BpDFgE5h.js","assets/git-pull-request-DUnpdU6m.js","assets/git-pull-request-draft-BdwbaFQ3.js","assets/triangle-alert-CIzim6ZN.js","assets/popover-DUg9gBOn.js","assets/button-CJXK1JqU.js","assets/status-dot-AP_4obOJ.js","assets/select-DL5E3ZAD.js","assets/dist-Bsi6zLdE.js","assets/circle-alert-ClwRNTQt.js","assets/manager-avatar-CKfqcoJQ.js","assets/mascot-portrait--NiRJOA5.js","assets/external-link-BE6y205O.js","assets/plus-CxRU2X8C.js","assets/refresh-cw-BIgmYimN.js","assets/textarea-DDyYxCcO.js","assets/user-round-V2FYByS8.js","assets/zap-2VEI5zT4.js","assets/managers-DbnCHnb6.js","assets/alert-dialog-B2Vi6MQZ.js","assets/dialog-DVZE8yAO.js","assets/x-BqECUykl.js","assets/input-DofKzJZl.js","assets/toaster-BoJZiTRl.js","assets/enter-key-Bsscx4Nx.js","assets/use-submit-shortcut-Cfam5eE7.js","assets/mascot-picker-C4s7n9Fc.js","assets/dropdown-menu-BKvUsb5Y.js","assets/command-CwP_dLx3.js","assets/search-BjsZLqse.js","assets/new-task-form-2p4cXcVQ.js","assets/host-usage-B8ohHYHR.js","assets/use-desktop-BNN3U2y9.js","assets/provider-auth-alert-GxIEkIvw.js","assets/terminal-pane-CmmTwiTX.js","assets/preload-helper-Czpn1I53.js","assets/clipboard-DvCUPLwM.js","assets/terminal-pane-BrP-ENHg.css","assets/dashboard-Dh65_Yi7.js","assets/project-router-B1Q3upIJ.js","assets/segmented-DI7abdqX.js","assets/worktree-lifecycle-C18dBDW4.js","assets/sheet-DPwaj6sk.js","assets/automation-format-CMG-6CYi.js","assets/circle-question-mark-X2pmbDJg.js","assets/download-CfgyYHf7.js","assets/sortable.esm-B7aanBL9.js","assets/icon-tooltip-DYk5cjLx.js","assets/format-BUbPQpzw.js","assets/token-metrics-DXeuToH8.js","assets/use-now-C8dG5uIP.js","assets/compare-variants-CYv97XSw.js","assets/search-x-I9Q8pgUa.js","assets/collapsible-DHALizq-.js","assets/pill-CoDPUIcJ.js","assets/centered-state-DE6sgEMs.js","assets/markdown-YSf01kqC.js","assets/chunk-BO2N2NFS-BueWQOks.js","assets/lib-BxQXEXDF.js","assets/run-diff-B08Fk7dR.js","assets/diff-stat-DPetRUXO.js","assets/task-commits-Di0Mc8MX.js","assets/git-tab-loading-DpG2D8Vl.js","assets/arrow-left-BfRd_mrv.js","assets/run-actions-ChUnbFA7.js","assets/bot-TkDIw4y-.js","assets/folder-o-AvL3y3.js","assets/pencil-BWoe1EL-.js","assets/workflow-BEP63Wt4.js","assets/impact-model-DCDyRxcf.js","assets/active-forge-CkAcQPDz.js","assets/upload-BE8GV7hh.js","assets/loader-circle-CPBhhDbB.js","assets/layout-grid-BRGu4YPj.js","assets/terminal-CxnJmFUC.js","assets/composer-attachments-ChelZhq4.js","assets/telemetry-3DhVDxf8.js","assets/reference-conflict-action-ByDYwT-Y.js","assets/spinner-hSpq0sPM.js","assets/diff-aKT-mpn8.js","assets/scroll-within-DMA4ZbQV.js","assets/zoomable-image-BiM5LfTG.js","assets/commit-list-BJeaIEp4.js","assets/lib-BQXq3kEf.js","assets/task-notes-DCHLinAF.js","assets/thread-items-C-4IW5zi.js","assets/file-text-D2QdCz-z.js","assets/file--aqoYe_k.js","assets/paperclip-B8bavbGm.js","assets/save-C73AnLGl.js","assets/types-BTlmexWF.js","assets/thread-scroll-upiJ0Jtj.js","assets/task-workspace-DHl5akxu.js","assets/arrow-down-NfQPLFhe.js","assets/worktree-lifecycle-operation-_xqKBVKB.js","assets/loading-state-NiNQtJ5H.js","assets/file-preview-C2EkjhOh.js","assets/tree-pane-resize-xgVK7J9r.js","assets/markdown-CXJIKz2i.js","assets/message-square-B-MD-8rD.js","assets/composer-C-aBJhY0.js","assets/arrow-up-CssRwnnv.js","assets/square-wDIzrTDO.js","assets/play-CmVAj_fu.js","assets/follow-up-engine-BnRCTyQ4.js","assets/picker-pill-Dv9H0dRF.js","assets/chip-DTCkrr8F.js","assets/reasoning-effort-pill-BOV3C0If.js","assets/tabs-DrhZb97I.js","assets/drawer-state-DasOAIpO.js","assets/ask-card-DPIjQSs8.js","assets/terminal-scope-okFE6qRP.js","assets/repo-git-ikURCYEK.js","assets/impact-control-ClslFBBA.js","assets/github-CWRtsamJ.js","assets/chevron-left-D0UFBpi5.js","assets/tag-k3n7EuAm.js","assets/agent-task-pickers-BXCIulS3.js","assets/tracker-bQUG9SkJ.js","assets/workflow-graph-CGMeFErv.js","assets/settings-2-B8aEkWqd.js","assets/message-circle-question-mark-CRiaNaMJ.js","assets/workflow-graph-DLioOiRN.css","assets/project-terminal-DbIohh5G.js","assets/skills-BNiKFlUw.js","assets/manager-index-D0TOmxr6.js","assets/manager-focus-B42UUMVK.js","assets/manager-new-CCet_7u8.js","assets/manager-chat-BdigDKYZ.js","assets/panel-right-BOIRp-Hi.js","assets/automations-route-Dd7F6b4F.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,t as r}from"./react-runtime-CCIEwYL0.js";import{$ as i,$a as a,$i as o,$n as s,$r as c,$t as l,A as u,Aa as d,Ao as f,B as p,Bn as m,Bt as h,C as g,Ca as _,Cn as v,Co as y,Do as b,Dr as x,E as S,Ei as C,Eo as w,Er as T,F as E,Fa as D,Fn as O,Fo as k,Ft as A,G as j,Gn as M,Gt as N,Ha as P,Hi as ee,Hn as te,Ht as ne,In as re,Io as ie,It as F,J as ae,Ja as oe,Ji as se,Jn as ce,Jt as le,K as I,Kn as ue,Kr as L,Kt as de,La as fe,Ln as pe,Lo as me,Lr as he,Lt as ge,Ma as _e,Mn as ve,Mo as ye,Mr as be,Nn as xe,No as Se,Nr as Ce,Nt as we,Oa as Te,On as Ee,Oo as De,Pa as Oe,Pn as ke,Po as Ae,Pr as je,Pt as Me,Q as Ne,Qa as Pe,Qt as Fe,Ra as Ie,Rt as Le,S as Re,Sn as ze,So as Be,Sr as Ve,St as He,T as Ue,To as We,Un as Ge,Ut as Ke,V as qe,Va as Je,Vn as Ye,Vr as Xe,Vt as Ze,W as Qe,Wa as $e,Wn as et,Xa as tt,Xn as nt,Y as rt,Yn as it,Yt as at,Z as ot,Zn as st,Zt as ct,_ as lt,_a as ut,_n as dt,_o as ft,_t as pt,an as mt,ao as ht,ba as gt,bn as _t,bo as vt,br as yt,c as bt,ca as xt,ci as St,cn as Ct,ct as wt,d as Tt,dn as Et,dt as Dt,ea as Ot,ei as kt,en as At,er as jt,et as Mt,f as Nt,fn as Pt,fo as Ft,g as It,gn as Lt,go as Rt,h as zt,ho as Bt,i as Vt,in as Ht,io as Ut,it as Wt,j as Gt,ja as Kt,jo as qt,jr as Jt,kn as Yt,ko as Xt,kr as Zt,l as Qt,la as $t,li as en,ln as tn,lt as nn,m as rn,ma as an,mn as on,mr as sn,ni as cn,nr as ln,nt as un,o as dn,oa as fn,on as pn,ot as mn,p as hn,pn as R,po as gn,pt as _n,q as vn,qa as yn,qn as bn,qt as xn,r as z,ra as Sn,ro as Cn,rt as wn,s as Tn,sa as En,so as Dn,st as On,ti as kn,tn as An,tr as jn,tt as Mn,u as Nn,ua as Pn,un as Fn,uo as In,ut as Ln,v as Rn,va as zn,vo as B,wn as Bn,wo as Vn,wr as Hn,x as Un,xa as Wn,xn as Gn,xo as V,xt as Kn,y as qn,ya as Jn,yn as Yn,yo as Xn,yr as Zn,z as Qn,zi as $n,zn as er,zt as tr}from"./queries-BQUz3Wnb.js";import{At as nr,Ct as rr,Dt as ir,E as ar,H as or,Mt as sr,R as cr,St as lr,Y as ur,a as dr,c as fr,f as pr,ft as mr,g as hr,i as gr,kt as _r,m as vr,n as yr,o as br,p as xr,r as Sr,s as Cr,t as H,u as wr,y as Tr,z as Er}from"./utils-Dp6vCdiU.js";import{t as Dr}from"./preload-helper-Czpn1I53.js";import{C as Or,S as kr,_ as Ar,a as jr,b as Mr,c as Nr,d as Pr,f as U,g as W,h as Fr,i as Ir,l as Lr,m as Rr,n as zr,o as Br,p as Vr,r as Hr,s as Ur,t as G,u as Wr,v as Gr,y as Kr}from"./project-router-B1Q3upIJ.js";import{o as qr,t as Jr}from"./worktree-lifecycle-C18dBDW4.js";import{C as Yr,D as Xr,E as Zr,O as Qr,T as $r,d as ei,g as ti,l as ni,w as ri,x as ii}from"./managers-Dr63u21Y.js";import{a as ai,c as oi,d as si,f as ci,i as li,l as ui,m as di,n as fi,o as pi,p as mi,r as hi,s as gi,t as _i,u as vi}from"./segmented-DI7abdqX.js";import{i as yi,n as bi,o as xi,r as Si,s as Ci,t as wi}from"./sheet-DPwaj6sk.js";import{a as Ti,c as Ei,d as Di,f as Oi,i as ki,l as Ai,n as ji,o as Mi,r as Ni,s as Pi,t as Fi,u as Ii}from"./host-usage-B8ohHYHR.js";import{t as Li}from"./use-desktop-BNN3U2y9.js";import{t as K}from"./createLucideIcon-BHp8sXmF.js";import{At as Ri,Dt as zi,Tt as Bi,_t as Vi,a as Hi,b as Ui,c as Wi,d as Gi,f as Ki,g as qi,gt as Ji,ht as Yi,i as Xi,jt as Zi,kt as Qi,m as $i,mt as ea,n as ta,o as na,p as ra,pt as ia,s as aa,xt as oa,y as sa,yt as ca}from"./git-tab-loading-DpG2D8Vl.js";import{t as la}from"./arrow-down-NfQPLFhe.js";import{t as ua}from"./arrow-left-BfRd_mrv.js";import{a as da,c as fa,d as pa,i as ma,o as ha,r as ga,s as _a,t as va,u as ya}from"./worktree-lifecycle-operation-_xqKBVKB.js";import{c as ba,i as xa,l as Sa,r as Ca,s as wa,t as Ta,u as Ea}from"./reference-chip-BpbybBvl.js";import{t as Da}from"./arrow-up-CssRwnnv.js";import{t as Oa}from"./bot-TkDIw4y-.js";import{C as ka,E as Aa,M as ja,P as Ma,S as Na,T as Pa,b as Fa,g as Ia,j as La,k as Ra,w as za,x as Ba,y as Va}from"./run-actions-ChUnbFA7.js";import{B as Ha,F as Ua,H as Wa,V as Ga,n as Ka,t as q}from"./button-CJXK1JqU.js";import{r as qa}from"./dist-Bsi6zLdE.js";import{i as J,n as Ja,o as Ya,s as Xa,t as Za}from"./select-DL5E3ZAD.js";import{t as Qa}from"./circle-check-BpDFgE5h.js";import{a as $a,c as eo,d as to,f as no,i as ro,n as io,o as ao,p as oo,r as so,s as co,t as lo,u as uo}from"./dropdown-menu-BKvUsb5Y.js";import{a as fo,i as po,n as mo,r as ho,t as go}from"./manager-avatar-CKfqcoJQ.js";import{n as _o,t as vo}from"./pencil-BWoe1EL-.js";import{n as yo,t as bo}from"./workflow-BEP63Wt4.js";import{t as xo}from"./external-link-BE6y205O.js";import{_ as So,g as Co}from"./impact-model-DCDyRxcf.js";import{t as wo}from"./file-text-D2QdCz-z.js";import{t as To}from"./file--aqoYe_k.js";import{t as Eo}from"./folder-o-AvL3y3.js";import{n as Do,r as Oo,t as ko}from"./active-forge-CkAcQPDz.js";import{n as Ao,t as jo}from"./upload-BE8GV7hh.js";import{t as Mo}from"./loader-circle-CPBhhDbB.js";import{t as No}from"./message-square-B-MD-8rD.js";import{S as Po,_ as Fo,a as Io,b as Lo,c as Ro,d as zo,g as Bo,h as Vo,i as Ho,l as Uo,m as Wo,n as Go,o as Ko,r as qo,s as Jo,t as Yo,u as Xo,v as Zo,x as Qo,y as $o}from"./composer-C-aBJhY0.js";import{t as es}from"./play-CmVAj_fu.js";import{t as ts}from"./plus-CxRU2X8C.js";import{t as ns}from"./refresh-cw-BIgmYimN.js";import{t as rs}from"./search-x-I9Q8pgUa.js";import{t as is}from"./search-BjsZLqse.js";import{t as as}from"./square-wDIzrTDO.js";import{t as os}from"./terminal-CxnJmFUC.js";import{n as ss,t as cs}from"./textarea-DDyYxCcO.js";import{t as ls}from"./triangle-alert-CIzim6ZN.js";import{t as us}from"./x-BqECUykl.js";import{t as ds}from"./zap-2VEI5zT4.js";import{S as fs,c as ps,d as ms,f as hs,g as gs,h as _s,i as vs,l as ys,n as bs,o as xs,p as Ss,r as Cs,s as ws,t as Ts,u as Es,v as Ds,y as Os}from"./popover-DUg9gBOn.js";import{D as ks,E as As,N as js,T as Ms,a as Ns,g as Ps,l as Fs,n as Is,r as Ls,v as Rs,w as zs,x as Bs,y as Vs}from"./managers-DbnCHnb6.js";import{a as Hs,c as Us,d as Ws,f as Gs,i as Ks,l as qs,n as Js,o as Ys,p as Xs,s as Zs,t as Qs,u as $s}from"./sortable.esm-B7aanBL9.js";import{A as ec,B as tc,C as nc,D as rc,E as ic,F as ac,H as oc,I as sc,L as cc,M as lc,N as uc,O as dc,P as fc,R as pc,S as mc,T as hc,U as gc,V as _c,W as vc,_ as yc,b as bc,c as xc,f as Sc,g as Cc,h as wc,j as Tc,k as Ec,l as Dc,u as Oc,v as kc,w as Ac,x as jc,y as Mc,z as Nc}from"./composer-attachments-ChelZhq4.js";import{i as Pc,n as Fc,r as Ic,t as Lc}from"./provider-auth-alert-GxIEkIvw.js";import{a as Rc,c as zc,i as Bc,n as Vc,o as Hc,r as Uc,s as Wc,t as Gc}from"./alert-dialog-B2Vi6MQZ.js";import{i as Kc,n as qc,r as Jc,t as Yc}from"./tabs-DrhZb97I.js";import{a as Xc,i as Zc,n as Qc,r as $c,t as el}from"./icon-tooltip-DYk5cjLx.js";import{a as tl,i as nl,n as rl,o as il,r as al,t as ol}from"./dialog-DVZE8yAO.js";import{a as sl,i as cl,l as ll,n as ul,o as dl,r as fl,s as pl,t as ml}from"./loading-state-NiNQtJ5H.js";import{t as hl}from"./spinner-hSpq0sPM.js";import{t as gl}from"./input-DofKzJZl.js";import{r as Y,t as _l}from"./toaster-BoJZiTRl.js";import{C as vl,S as yl,_ as bl,g as xl,h as Sl,i as Cl,l as wl,m as Tl,n as El,r as Dl,s as Ol,t as kl,v as Al,x as jl}from"./telemetry-3DhVDxf8.js";import{r as Ml,t as Nl}from"./format-BUbPQpzw.js";import{t as Pl}from"./status-dot-AP_4obOJ.js";import{i as Fl,n as Il,o as Ll,r as Rl}from"./reference-conflict-action-ByDYwT-Y.js";import{a as zl,c as Bl,i as Vl,l as Hl,n as Ul,o as Wl,r as Gl,s as Kl,t as ql}from"./command-CwP_dLx3.js";import{t as Jl}from"./pill-CoDPUIcJ.js";import{t as Yl}from"./diff-stat-DPetRUXO.js";import{t as Xl}from"./clipboard-DvCUPLwM.js";import{t as Zl}from"./token-metrics-DXeuToH8.js";import{t as Ql}from"./use-now-C8dG5uIP.js";import{n as $l,t as eu}from"./centered-state-DE6sgEMs.js";import{n as tu,r as nu,t as ru}from"./chip-DTCkrr8F.js";import{S as iu,_ as au,a as ou,b as su,c as cu,d as lu,f as uu,g as du,h as fu,l as pu,m as mu,n as hu,o as gu,p as _u,r as vu,s as yu,t as bu,u as xu,v as Su,y as Cu}from"./new-task-form-2p4cXcVQ.js";import{t as wu}from"./lib-BQXq3kEf.js";import{a as Tu,i as Eu,n as Du,r as Ou,t as ku}from"./picker-pill-Dv9H0dRF.js";import{n as Au,t as ju}from"./reasoning-effort-pill-BOV3C0If.js";import{a as Mu,o as Nu,r as Pu,t as Fu}from"./markdown-YSf01kqC.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 Iu=class extends me{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 Be({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=Lu(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=Lu(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=Lu(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=Lu(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){We.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=>f(t,e))}findAll(e={}){return this.getAll().filter(t=>f(e,t))}notify(e){We.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return We.batch(()=>Promise.all(e.map(e=>e.continue().catch(ye))))}};function Lu(e){return e.options.scope?.id}var Ru=class extends me{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??De(r,t),a=this.get(i);return a||(a=new y({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(){We.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=>qt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>qt(e,t)):t}notify(e){We.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){We.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){We.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},zu=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ru,this.#t=e.mutationCache||new Iu,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ie.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Vn.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(Ae(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=w(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return We.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;We.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return We.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=We.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(ye).catch(ye)}invalidateQueries(e,t={}){return We.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=We.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(ye)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(ye)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Ae(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ye).catch(ye)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ye).catch(ye)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Vn.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(b(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Se(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(b(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Se(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||=De(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===k&&(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()}},X=e(t(),1),Bu=n();function Vu(){return new zu({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof sn&&t.status>=400&&t.status<500?!1:t instanceof sn&&t.status===0?e<3:e<1,retryDelay:(e,t)=>t instanceof sn&&t.status===0?Math.min(250*2**e,1e3):Math.min(1e3*2**e,3e4)},mutations:{retry:!1}}})}var Hu=K(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),Uu=K(`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`}]]),Wu=K(`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`}]]),Gu=K(`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`}]]),Ku=K(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),qu=K(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),Ju=K(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Yu=K(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Xu=K(`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`}]]),Zu=K(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),Qu=K(`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`}]]),$u=K(`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`}]]),ed=K(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),td=K(`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`}]]),nd=K(`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`}]]),rd=K(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),id=K(`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`}]]),ad=K(`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`}]]),od=K(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),sd=K(`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`}]]),cd=K(`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`}]]),ld=K(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),ud=K(`gift`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8`,key:`1sqzm4`}],[`path`,{d:`M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5`,key:`kc0143`}],[`rect`,{x:`3`,y:`7`,width:`18`,height:`4`,rx:`1`,key:`1hberx`}]]),dd=K(`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`}]]),fd=K(`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`}]]),pd=K(`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`}]]),md=K(`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`}]]),hd=K(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),gd=K(`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`}]]),_d=K(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),vd=K(`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`}]]),yd=K(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),bd=K(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),xd=K(`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`}]]),Sd=K(`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`}]]),Cd=K(`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`}]]),wd=K(`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`}]]),Td=K(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 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.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),Ed=K(`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`}]]),Dd=K(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Od=K(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),kd=K(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Ad=K(`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`}]]),jd=K(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Md=K(`shield-off`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),Nd=K(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Pd=K(`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`}]]),Fd=K(`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`}]]),Id=K(`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`}]]),Ld=K(`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`}]]),Rd=K(`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`}]]),zd=K(`webhook`,[[`path`,{d:`M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2`,key:`q3hayz`}],[`path`,{d:`m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06`,key:`1go1hn`}],[`path`,{d:`m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8`,key:`qlwsc0`}]]),Bd={jira:{label:`Jira`,scopeLabel:`Jira projects`},linear:{label:`Linear`,scopeLabel:`Linear teams`}},Vd=sr.options.map(e=>({kind:e,...Bd[e]})),Hd=`cez-last-manager`;function Ud(e){if(!e.startsWith(`/manager/new`))try{sessionStorage.setItem(Hd,e)}catch{}}function Wd(e){let t=null;try{t=sessionStorage.getItem(Hd)}catch{return`/manager`}if(t===null||!/^\/manager(?:[/?]|$)/.test(t))return`/manager`;let n=/^\/manager\/([^/?#]+)/.exec(t)?.[1];return n!==void 0&&e!==void 0&&!e.includes(decodeURIComponent(n))?`/manager`:t}var Gd=`cez-last-tasks`;function Kd(e){try{sessionStorage.setItem(Gd,e)}catch{}}function qd(){try{let e=sessionStorage.getItem(Gd);return e===null||!e.startsWith(`/`)||/^\/manager(?:[/?]|$)/.test(e)?null:e}catch{return null}}var Jd=`cez-last-project`;function Yd(e){try{sessionStorage.setItem(Jd,e)}catch{}}function Xd(){try{return sessionStorage.getItem(Jd)}catch{return null}}var Zd=`https://github.com/open-mercato/cezar`,Qd=`cez:star-toast-seen`;function $d(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 ef=`cez:star-ask`,tf=1500;function nf(e=cf()){if(!e)return null;try{let t=e.getItem(ef);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(Qd);return n===null?{asks:0}:{asks:1,lastAskedAt:n}}catch{return null}}function rf(e,t=cf()){try{t?.setItem(ef,JSON.stringify(e))}catch{}}function af(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 of(e){return(e??[]).filter(e=>lf.has(e.status)).length}function sf(e){return e.visible&&e.focused&&!e.typing&&!e.dialogOpen&&e.now-e.lastInteractionAt>=0&&e.now-e.lastInteractionAt<=6e4}function cf(){try{return globalThis.localStorage??null}catch{return null}}var lf=new Set([`done`,`review`]);function uf(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||lf.has(a.status)&&(r=!0,a.pullRequestUrl&&(i=!0))}return{succeeded:r,withPullRequest:i,statuses:n}}var Z=r(),df=Ha(`inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 text-ui 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 ff({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,Z.jsx)(n?Ua:`span`,{"data-slot":`badge`,"data-variant":t,className:H(df({variant:t}),e),...r})}var pf=/^(?:\\\\\?\\)?[A-Za-z]:$/,mf=/^(?:[\\/]{2}(?!\?[\\/])|\\\\\?\\UNC\\)[^\\/]+[\\/][^\\/]+$/i;function hf(e){let t=e.replace(/[\\/]+$/,``);if(pf.test(t)||mf.test(t))return null;let n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));if(n<0)return null;if(n===0)return t.slice(0,1);let r=t.slice(0,n);return pf.test(r)?t.slice(0,n+1):r}var gf=`x-apple.systempreferences:com.apple.preference.security?Privacy_FilesAndFolders`,_f=`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-foreground hover:bg-muted`;function vf({path:e,selected:t,onSelect:n,onEnter:r,decorate:i,emptyHint:a,showHidden:o=!1}){let s=Ue(e,o),c=s.data?.parent??null,l=e===null?null:hf(e);return(0,Z.jsxs)(Z.Fragment,{children:[s.data||s.isError?(0,Z.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-meta text-soft-foreground`,title:s.data?.path??void 0,children:s.data?.path??``}):(0,Z.jsx)(cl,{label:`Loading folder…`,"data-slot":`fs-breadcrumb`,children:(0,Z.jsx)(ll,{className:`my-[3px] h-3 w-48 max-w-full`})}),!s.isError&&s.data?.parent===null?(0,Z.jsxs)(`p`,{"data-slot":`fs-root-hint`,className:`text-label text-soft-foreground`,children:[`This is the browse root. To browse elsewhere, change`,` `,(0,Z.jsx)(`a`,{href:`/settings/global/projects`,className:`text-foreground underline underline-offset-4 hover:text-muted-foreground`,children:`Default browse folder in Settings → Projects`}),`.`]}):null,s.isError?(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-ui text-danger`,children:s.error instanceof Error?s.error.message:`could not list that folder`}),s.error instanceof sn&&s.error.status===403?(0,Z.jsx)(`p`,{"data-slot":`fs-privacy-hint`,className:`text-label text-soft-foreground`,children:`Allow it under Privacy & Security ▸ Files & Folders, then try again.`}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-label`,children:[l===null?null:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`fs-error-back`,onClick:()=>r(l),className:_f,children:[(0,Z.jsx)($u,{className:`size-3.5`,"aria-hidden":!0}),`Back`]}),s.error instanceof sn&&s.error.status===403?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`a`,{"data-slot":`fs-privacy-settings`,href:gf,target:`_blank`,rel:`noreferrer`,className:_f,children:`Open Privacy Settings`}),(0,Z.jsx)(`button`,{type:`button`,"data-slot":`fs-retry`,onClick:()=>void s.refetch(),className:_f,children:`Try again`})]}):null]})]}):(0,Z.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,Z.jsx)(`li`,{className:`flex`,children:(0,Z.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-ui hover:bg-muted`,children:[(0,Z.jsx)($u,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(s.data?.dirs??[]).map(e=>(0,Z.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":t?.path===e.path,onClick:()=>n(e),onDoubleClick:()=>r(e.path),className:H(`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left text-ui hover:bg-muted`,t?.path===e.path&&`bg-muted`),children:[(0,Z.jsx)(Eo,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.name}),i?.(e)]}),(0,Z.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,Z.jsx)(Ga,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),s.data&&s.data.dirs.length===0?(0,Z.jsx)(`li`,{className:`px-3 py-2 text-ui text-muted-foreground`,children:a}):null]}),s.data?.truncated?(0,Z.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-meta text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function yf(e,t,n=!1){let r=Ue(e,n);return t?.path??r.data?.path??null}function bf({open:e,onOpenChange:t}){let[n,r]=(0,X.useState)(null),[a,o]=(0,X.useState)(null),s=i(),c=nn(),l=Mr(),u=new Set((s.data?.projects??[]).filter(e=>!e.unregistered).map(e=>e.root)),d=e=>{r(e),o(null),c.reset()},f=yf(n,a);return(0,Z.jsx)(ol,{open:e,onOpenChange:t,children:(0,Z.jsxs)(rl,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,Z.jsxs)(tl,{children:[(0,Z.jsx)(il,{children:`Open local folder`}),(0,Z.jsx)(al,{children:`Pick the folder cezar should run in. Git repos are marked; any folder works.`})]}),(0,Z.jsx)(vf,{path:n,selected:a,onSelect:o,onEnter:d,emptyHint:`No subfolders here — “Add project” registers this folder.`,decorate:e=>(0,Z.jsxs)(Z.Fragment,{children:[e.isRepo?(0,Z.jsx)(ff,{variant:`outline`,className:`shrink-0 text-micro`,children:`git`}):null,u.has(e.path)?(0,Z.jsx)(ff,{variant:`ghost`,className:`shrink-0 text-micro text-muted-foreground`,children:`already added`}):null]})}),c.isError?(0,Z.jsx)(`p`,{"data-slot":`add-project-error`,className:`min-w-0 break-words text-ui text-danger`,children:c.error instanceof Error?c.error.message:`could not add that folder`}):null,(0,Z.jsxs)(nl,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,Z.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-meta text-muted-foreground`,title:f??void 0,children:f??``}),(0,Z.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,Z.jsx)(q,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Z.jsx)(q,{"data-slot":`add-project-confirm`,disabled:f===null||c.isPending,onClick:()=>{f===null||c.isPending||c.mutate(f,{onSuccess:({project:e})=>{t(!1),l(`/p/${encodeURIComponent(e.id)}/`)}})},children:c.isPending?`Adding…`:`Add project`})]})]})]})})}function xf(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 Sf({open:e,onOpenChange:t}){let[n,r]=(0,X.useState)(``),[a,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(!1),d=(0,X.useRef)(!1),f=i(),p=lt(),{mutate:m,isPending:h}=p,g=Mr(),_=xf(p.error),v=(0,X.useMemo)(()=>`co-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),y=(0,X.useRef)(v);y.current=v,(0,X.useEffect)(()=>ai((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===y.current&&(n.phase===`cloning`&&n.line?c(n.line):n.phase!==`cloning`&&c(null))}),[]);let b=(0,X.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),x=a.trim()===``?b:a.trim(),S=f.data?.projectsDir??``,C=x===``?``:`${S.replace(/\/+$/,``)}/${x}`,w=(0,X.useCallback)(()=>{n.trim()===``||h||(d.current=!1,u(!1),c(null),m({url:n.trim(),checkoutId:v,...a.trim()===``?{}:{name:a.trim()}},{onSuccess:({project:e})=>{t(!1),g(`/p/${encodeURIComponent(e.id)}/`)}}))},[m,h,v,a,g,t,n]);return(0,X.useEffect)(()=>{if(!l)return;let e=()=>{d.current&&(d.current=!1,u(!1),w())},t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[l,w]),(0,Z.jsx)(ol,{open:e,onOpenChange:e=>p.isPending?void 0:t(e),children:(0,Z.jsxs)(rl,{"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,Z.jsxs)(tl,{children:[(0,Z.jsx)(il,{children:`Clone from GitHub`}),(0,Z.jsxs)(al,{children:[`The service clones with `,(0,Z.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,Z.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Z.jsx)(ho,{htmlFor:`clone-url`,children:`Repository`}),(0,Z.jsx)(gl,{id:`clone-url`,"data-slot":`clone-url`,autoFocus:!0,placeholder:`owner/repo or https://github.com/owner/repo`,value:n,disabled:p.isPending,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&w()}})]}),(0,Z.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Z.jsx)(ho,{htmlFor:`clone-name`,children:`Folder name`}),(0,Z.jsx)(gl,{id:`clone-name`,"data-slot":`clone-name`,placeholder:b===``?`repo`:b,value:a,disabled:p.isPending,onChange:e=>o(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Z.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-meta text-soft-foreground`,title:C,children:C}),p.isPending?(0,Z.jsx)(q,{"data-slot":`clone-root-settings`,variant:`ghost`,size:`icon-sm`,className:`size-7`,"aria-label":`Edit checkout root`,disabled:!0,children:(0,Z.jsx)(po,{className:`size-3.5`,"aria-hidden":`true`})}):(0,Z.jsx)(el,{label:`Edit checkout root`,children:(0,Z.jsx)(q,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,Z.jsx)(U,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,children:(0,Z.jsx)(po,{className:`size-3.5`,"aria-hidden":`true`})})})})]})]}),p.isPending?(0,Z.jsx)(`p`,{"data-slot":`clone-progress`,className:`truncate font-mono text-meta text-muted-foreground`,children:s??`Starting the clone…`}):null,p.isError?(0,Z.jsx)(`div`,{"data-slot":`clone-error`,className:`grid min-w-0 gap-1.5 text-ui text-danger`,children:_?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{children:`GitHub requires SAML authorization for this organization.`}),(0,Z.jsxs)(`p`,{children:[(0,Z.jsx)(`a`,{"data-slot":`clone-sso-link`,className:`font-medium underline underline-offset-2`,href:_,target:`_blank`,rel:`noreferrer`,onClick:()=>{d.current=!0,u(!0)},children:`Authorize this GitHub organization`}),l?` — return here after authorizing, or choose Retry clone.`:` — return to this tab to retry, or choose Retry clone.`]}),(0,Z.jsxs)(`details`,{className:`min-w-0`,children:[(0,Z.jsx)(`summary`,{children:`Error details`}),(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap break-all`,children:p.error instanceof Error?p.error.message:null})]})]}):(0,Z.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-all`,children:p.error instanceof Error?p.error.message:`could not clone that repository`})}):null,(0,Z.jsxs)(nl,{children:[(0,Z.jsx)(q,{variant:`outline`,disabled:p.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,Z.jsx)(q,{"data-slot":`clone-confirm`,disabled:n.trim()===``||x===``||p.isPending,onClick:w,children:p.isPending?`Cloning…`:p.isError?`Retry clone`:`Clone`})]})]})})}var Cf=[{slug:`github/codespaces-nextjs`,label:`Next.js`,description:`Minimal Next.js app (GitHub)`},{slug:`vercel/ai-chatbot`,label:`Next.js AI chatbot`,description:`Full-featured AI chat app (Vercel)`},{slug:`vercel/nextjs-postgres-nextauth-tailwindcss-template`,label:`Next.js admin dashboard`,description:`Postgres, Auth.js and Tailwind (Vercel)`},{slug:`github/codespaces-react`,label:`React + Vite`,description:`React single-page app (GitHub)`},{slug:`antfu-collective/vitesse`,label:`Vue + Vite`,description:`Opinionated Vue starter (Vitesse)`},{slug:`nuxt-ui-templates/starter-vue`,label:`Vue + Nuxt UI`,description:`Vue + Vite with Nuxt UI (Nuxt)`},{slug:`mugnavo/cove`,label:`Vite+`,description:`TanStack Start on Vite+ (vp), Better Auth`},{slug:`w3cj/hono-open-api-starter`,label:`Hono`,description:`Type-safe JSON API with OpenAPI docs`},{slug:`github/codespaces-express`,label:`Express`,description:`Node.js web server (GitHub)`},{slug:`andrewmcodes/obsidian-beginner-vault-template`,label:`Obsidian vault`,description:`Your own knowledge base in Markdown`},{slug:`chibat/chrome-extension-typescript-starter`,label:`Chrome extension`,description:`TypeScript extension starter`},{slug:`actions/typescript-action`,label:`GitHub Action`,description:`TypeScript action with tests (GitHub)`},{slug:`microsoft/python-package-template`,label:`Python package`,description:`Packaging, tests and CI (Microsoft)`},{slug:`github/codespaces-flask`,label:`Flask`,description:`Python web app (GitHub)`},{slug:`github/codespaces-django`,label:`Django`,description:`Python web framework (GitHub)`},{slug:`github/codespaces-rails`,label:`Ruby on Rails`,description:`Rails app (GitHub)`},{slug:`github/codespaces-jupyter`,label:`Jupyter notebooks`,description:`Data science and ML (GitHub)`}];function wf(e){let t=e.trim().toLowerCase();return t===``||Cf.some(e=>e.slug.toLowerCase()===t)?Cf:Cf.filter(e=>[e.label,e.slug,e.description].some(e=>e.toLowerCase().includes(t)))}function Tf({value:e,onChange:t,disabled:n,id:r}){let[i,a]=(0,X.useState)(-1),o=(0,X.useId)(),s=wf(e),c=(0,X.useRef)(null),l=e.trim();(0,X.useEffect)(()=>{i<0||c.current?.querySelector(`[data-index="${i}"]`)?.scrollIntoView?.({block:`nearest`})},[i]),(0,X.useEffect)(()=>{c.current?.querySelector(`[aria-selected="true"]`)?.scrollIntoView?.({block:`nearest`})},[l]);let u=e=>{n||(t(e),a(-1))};return(0,Z.jsxs)(`div`,{className:`grid gap-2 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,Z.jsx)(gl,{id:r,"data-slot":`create-template`,role:`combobox`,"aria-expanded":s.length>0,"aria-controls":o,"aria-autocomplete":`list`,"aria-activedescendant":i>=0?`${o}-${i}`:void 0,autoComplete:`off`,placeholder:`Search, or paste owner/repo or a URL`,value:e,disabled:n,onBlur:()=>a(-1),onChange:e=>{t(e.target.value),a(-1)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;a(e=>s.length===0?-1:(e+t+s.length)%s.length)}else if(e.key===`Enter`&&i>=0){e.preventDefault();let t=s[i];t&&u(t.slug)}}}),s.length>0?(0,Z.jsx)(`ul`,{ref:c,id:o,role:`listbox`,"aria-label":`Suggested templates`,"aria-disabled":n||void 0,"data-slot":`create-template-suggestions`,className:H(`max-h-56 overflow-y-auto overscroll-contain rounded-md border border-border p-1`,`md:max-h-none md:min-h-36 md:flex-1`,n?`pointer-events-none opacity-50`:void 0),children:s.map((e,t)=>{let n=e.slug===l;return(0,Z.jsxs)(`li`,{id:`${o}-${t}`,role:`option`,"aria-selected":n,"data-index":t,"data-slot":`create-template-suggestion`,"data-template":e.slug,onMouseDown:e=>e.preventDefault(),onClick:()=>u(e.slug),onMouseEnter:()=>a(t),onMouseLeave:()=>a(-1),className:H(`grid cursor-pointer gap-0.5 rounded-sm border px-2 py-1.5`,n?`border-primary bg-primary/5`:`border-transparent`,t===i&&!n?`bg-accent text-accent-foreground`:void 0),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline justify-between gap-2`,children:[(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-sm font-medium`,children:[e.label,n?(0,Z.jsx)(Qa,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":`true`}):null]}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-meta text-muted-foreground`,children:e.description})]}),(0,Z.jsx)(`span`,{className:`truncate font-mono text-meta text-soft-foreground`,children:e.slug})]},e.slug)})}):(0,Z.jsxs)(`p`,{"data-slot":`create-template-no-match`,className:`px-1 text-label text-muted-foreground`,children:[`No suggested template matches — any `,(0,Z.jsx)(`span`,{className:`font-mono`,children:`owner/repo`}),` or GitHub URL works.`]})]})}function Ef(e){return e.trimStart().replace(/\s+/g,`-`)}function Df({open:e,onOpenChange:t}){let[n,r]=(0,X.useState)(``),[a,o]=(0,X.useState)(!0),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(`empty`),[p,m]=(0,X.useState)(null),h=i(),g=Gt(),_=Re(),v=Mr(),y=(0,X.useMemo)(()=>`np-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),b=(0,X.useRef)(y);b.current=y,(0,X.useEffect)(()=>ai((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===b.current&&(n.phase===`cloning`&&n.line?m(n.line):n.phase!==`cloning`&&m(null))}),[]);let x=g.data,S=x?.available===!0&&Array.isArray(x.owners)&&x.owners.length>0,C=(0,X.useMemo)(()=>x?.available&&Array.isArray(x.owners)?x.owners:[],[x]),w=C.some(e=>e.login===s)?s:C[0]?.login??``,T=a&&S,E=n.trim(),D=mr.test(E),O=E===``||D?null:E.length>100?`At most 100 characters.`:`Use letters, digits, “.”, “-” and “_” only.`,k=h.data?.projectsDir??``,A=D?`${k.replace(/\/+$/,``)}/${E}`:``,j=T&&d===`template`,M=j&&l.trim()===``,N=()=>{if(!D||_.isPending||a&&g.isPending||M)return;m(null);let e=l.trim();_.mutate({name:E,checkoutId:y,...T?{github:{owner:w,...j&&e!==``?{template:e}:{}}}:{}},{onSuccess:({project:e})=>{t(!1),v(`/p/${encodeURIComponent(e.id)}/`)}})},P=_.isPending,ee=g.isPending||S;return(0,Z.jsx)(ol,{open:e,onOpenChange:e=>P?void 0:t(e),children:(0,Z.jsxs)(rl,{"data-slot":`create-project-dialog`,className:H(`max-h-[calc(100dvh-2rem)] overflow-y-auto`,ee?`md:h-[min(50rem,calc(100dvh-4rem))] md:max-w-3xl md:grid-rows-[auto_minmax(0,1fr)_auto] md:overflow-hidden`:void 0),children:[(0,Z.jsxs)(tl,{children:[(0,Z.jsx)(il,{children:`New project`}),(0,Z.jsx)(al,{children:`cezar creates a new git repository in your checkout root and adds it as a project.`})]}),(0,Z.jsxs)(`div`,{"data-slot":`create-layout`,className:H(`grid gap-6`,ee?`md:min-h-0 md:grid-cols-[minmax(0,5fr)_minmax(0,6fr)]`:void 0),children:[ee?(0,Z.jsx)(`div`,{"data-slot":`create-owners-column`,className:`min-w-0 md:flex md:min-h-0 md:flex-col md:border-r md:border-border md:pr-6`,children:S?(0,Z.jsx)(Of,{owners:C,value:w,disabled:P||!T,onChange:c}):(0,Z.jsx)(Af,{})}):null,(0,Z.jsxs)(`div`,{"data-slot":`create-form-column`,className:H(`grid min-w-0 content-start gap-4`,ee?`md:-m-1 md:flex md:min-h-0 md:flex-col md:overflow-y-auto md:p-1`:void 0),children:[(0,Z.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Z.jsx)(ho,{htmlFor:`create-name`,children:`Name`}),(0,Z.jsx)(gl,{id:`create-name`,"data-slot":`create-name`,autoFocus:!0,placeholder:`my-project`,value:n,disabled:P,"aria-invalid":O!==null,"aria-describedby":`create-name-hint`,onChange:e=>r(Ef(e.target.value)),onKeyDown:e=>{e.key===`Enter`&&N()}}),O?(0,Z.jsx)(`p`,{id:`create-name-hint`,"data-slot":`create-name-error`,className:`text-label text-danger`,children:O}):(0,Z.jsx)(`p`,{id:`create-name-hint`,"data-slot":`create-target`,className:`min-w-0 truncate font-mono text-meta text-soft-foreground`,title:A,children:A})]}),(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-border p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(ho,{htmlFor:`create-github`,className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(_d,{className:`size-3.5`,"aria-hidden":`true`}),`Create a private GitHub repository`]}),(0,Z.jsx)(mo,{id:`create-github`,"data-slot":`create-github`,checked:T,disabled:P||!S,onCheckedChange:o})]}),g.isPending?(0,Z.jsx)(`p`,{className:`text-label text-muted-foreground`,children:`Checking GitHub…`}):S?null:(0,Z.jsx)(`p`,{"data-slot":`create-github-unavailable`,className:`text-label text-muted-foreground`,children:x&&!x.available?x.reason:`Could not read your GitHub accounts — the project will be created locally only.`}),T?(0,Z.jsxs)(`p`,{className:`text-label text-muted-foreground`,children:[`Created as `,(0,Z.jsx)(`strong`,{children:`private`}),` under `,(0,Z.jsx)(`strong`,{children:w}),` — you can change its visibility on GitHub.`]}):null]}),(0,Z.jsxs)(`div`,{"data-slot":`create-start`,className:`grid gap-3 rounded-md border border-border p-3 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,Z.jsx)(`span`,{id:`create-start-label`,className:`text-sm font-medium`,children:`Start with`}),(0,Z.jsxs)(`div`,{role:`radiogroup`,"aria-labelledby":`create-start-label`,className:`grid gap-2 sm:grid-cols-2`,children:[(0,Z.jsx)(kf,{slot:`create-start-empty`,checked:!j,disabled:P,title:`Empty repository`,hint:`One empty commit, no files.`,onSelect:()=>f(`empty`)}),(0,Z.jsx)(kf,{slot:`create-start-template`,checked:j,disabled:P||!T,title:`From a template`,hint:T?`Copy a GitHub template.`:`Needs a GitHub repository.`,onSelect:()=>f(`template`)})]}),j?(0,Z.jsxs)(`div`,{className:`grid gap-1.5 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,Z.jsx)(ho,{htmlFor:`create-template`,children:`Template`}),(0,Z.jsx)(Tf,{id:`create-template`,value:l,disabled:P,onChange:u})]}):null]}),P?(0,Z.jsx)(`p`,{"data-slot":`create-progress`,className:`truncate font-mono text-meta text-muted-foreground`,children:p??`Starting…`}):null,_.isError?(0,Z.jsx)(`p`,{"data-slot":`create-error`,className:`whitespace-pre-line text-ui text-danger`,children:_.error instanceof Error?_.error.message:`could not create the project`}):null]})]}),(0,Z.jsxs)(nl,{children:[(0,Z.jsx)(q,{variant:`outline`,disabled:P,onClick:()=>t(!1),children:`Cancel`}),(0,Z.jsx)(q,{"data-slot":`create-confirm`,disabled:!D||P||M||a&&g.isPending,onClick:N,children:P?`Creating…`:`Create`})]})]})})}function Of({owners:e,value:t,disabled:n,onChange:r}){let i=(0,X.useRef)([]),a=(t,n)=>{if(e.length===0)return;let a=(t+n+e.length)%e.length,o=e[a]?.login;o!==void 0&&(r(o),i.current[a]?.focus())};return(0,Z.jsxs)(`div`,{className:`grid gap-3 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,Z.jsx)(`span`,{id:`create-owner-label`,className:`eyebrow text-muted-foreground`,children:`Select organization`}),(0,Z.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`create-owner-label`,"data-slot":`create-owner`,className:`-mx-1 grid max-h-64 content-start gap-2 overflow-y-auto px-1 py-0.5 md:max-h-none md:min-h-0 md:flex-1`,children:e.map((e,o)=>{let s=e.login===t;return(0,Z.jsxs)(`button`,{ref:e=>{i.current[o]=e},type:`button`,role:`radio`,"aria-checked":s,tabIndex:s?0:-1,disabled:n,"data-slot":`create-owner-option`,"data-owner":e.login,onClick:()=>r(e.login),onKeyDown:e=>{e.key===`ArrowDown`||e.key===`ArrowRight`?(e.preventDefault(),a(o,1)):(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(e.preventDefault(),a(o,-1))},className:H(`flex w-full items-center gap-3 rounded-lg border bg-card px-3 py-2.5 text-left outline-none transition-colors`,`focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,s?`border-primary bg-primary/5`:`border-border hover:bg-muted/50`),children:[(0,Z.jsx)(jf,{owner:e}),(0,Z.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate text-sm font-semibold`,children:[e.login,s?(0,Z.jsx)(Qa,{className:`size-4 shrink-0 text-primary`,"aria-hidden":`true`}):null]}),e.personal?(0,Z.jsx)(`span`,{className:`text-label text-muted-foreground`,children:`Personal account`}):e.description?(0,Z.jsx)(`span`,{className:`line-clamp-2 text-label text-muted-foreground`,children:e.description}):null]})]},e.login)})})]})}function kf({slot:e,checked:t,disabled:n,title:r,hint:i,onSelect:a}){return(0,Z.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,disabled:n,"data-slot":e,onClick:a,className:H(`grid gap-0.5 rounded-md border px-3 py-2 text-left outline-none transition-colors`,`focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50`,t?`border-primary bg-primary/5`:`border-border hover:bg-muted/50`),children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:r}),(0,Z.jsx)(`span`,{className:`text-label text-muted-foreground`,children:i})]})}function Af(){return(0,Z.jsxs)(`div`,{className:`grid gap-3`,"data-slot":`create-owners-loading`,"aria-hidden":`true`,children:[(0,Z.jsx)(`span`,{className:`eyebrow text-muted-foreground`,children:`Select organization`}),[0,1].map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-border px-3 py-2.5`,children:[(0,Z.jsx)(`span`,{className:`size-9 shrink-0 animate-pulse rounded-full bg-muted`}),(0,Z.jsx)(`span`,{className:`h-3 w-24 animate-pulse rounded bg-muted`})]},e))]})}function jf({owner:e}){let[t,n]=(0,X.useState)(!1),r=e.personal?`rounded-full`:`rounded-md`;return e.avatarUrl&&!t?(0,Z.jsx)(`img`,{src:e.avatarUrl,alt:``,width:36,height:36,loading:`lazy`,onError:()=>n(!0),"data-slot":`create-owner-avatar`,className:H(`size-9 shrink-0 bg-muted`,r)}):(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:H(`flex size-9 shrink-0 items-center justify-center bg-muted text-sm font-semibold text-muted-foreground uppercase`,r),children:e.login.slice(0,1)})}var Mf=class extends X.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){console.error(`[cezar] ${this.props.label} failed to render`,e),Y(`${this.props.label} failed to open: ${e instanceof Error?e.message:String(e)}`,{tone:`danger`}),this.props.onError()}render(){return this.state.failed?null:this.props.children}};function Nf(e){return(0,Z.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,Z.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`})})}function Pf({className:e}){let[t,n]=X.useState(!1),[r,i]=X.useState(!1),[a,o]=X.useState(!1);return(0,Z.jsxs)(lo,{children:[(0,Z.jsx)(oo,{asChild:!0,children:(0,Z.jsxs)(q,{variant:`ghost`,size:`sm`,"data-slot":`add-project`,"aria-label":`Add project`,className:e,children:[(0,Z.jsx)(ts,{className:`size-3.5`,"aria-hidden":`true`}),`Add project`]})}),(0,Z.jsxs)(so,{align:`start`,className:`w-56`,children:[(0,Z.jsx)($a,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,Z.jsxs)(ro,{"data-slot":`add-project-local`,onSelect:()=>{n(!0),wl(`folder`)},children:[(0,Z.jsx)(Eo,{"aria-hidden":`true`}),`Open local folder…`]}),(0,Z.jsxs)(ro,{"data-slot":`add-project-clone`,onSelect:()=>{i(!0),wl(`clone`)},children:[(0,Z.jsx)(Nf,{"aria-hidden":`true`}),`Clone from GitHub…`]}),(0,Z.jsxs)(ro,{"data-slot":`add-project-create`,onSelect:()=>{o(!0),wl(`new`)},children:[(0,Z.jsx)(od,{"aria-hidden":`true`}),`New project…`]})]}),t?(0,Z.jsx)(Mf,{label:`Open local folder`,onError:()=>n(!1),children:(0,Z.jsx)(bf,{open:!0,onOpenChange:n})}):null,r?(0,Z.jsx)(Mf,{label:`Clone from GitHub`,onError:()=>i(!1),children:(0,Z.jsx)(Sf,{open:!0,onOpenChange:i})}):null,a?(0,Z.jsx)(Mf,{label:`New project`,onError:()=>o(!1),children:(0,Z.jsx)(Df,{open:!0,onOpenChange:o})}):null]})}var Ff=[`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`],If={x:177.9,y:78.7,width:348.2,height:546.6},Lf={mark:26,name:19,gap:11.4};function Rf({height:e=Lf.mark,className:t}){return(0,Z.jsx)(`svg`,{"data-slot":`brand-mark`,"aria-hidden":`true`,focusable:`false`,viewBox:`${If.x} ${If.y} ${If.width} ${If.height}`,height:e,width:e*If.width/If.height,fill:`currentColor`,className:H(`shrink-0`,t),children:Ff.map(e=>(0,Z.jsx)(`polygon`,{points:e},e))})}function zf({className:e,name:t=`cezar`,logoUrl:n=null}){return(0,Z.jsxs)(`span`,{"data-slot":`brand-lockup`,className:H(`flex min-w-0 items-center text-foreground`,e),style:{gap:Lf.gap},children:[n?(0,Z.jsx)(`img`,{"data-slot":`brand-logo`,src:n,alt:``,className:`size-[26px] shrink-0 object-contain`}):(0,Z.jsx)(Rf,{}),(0,Z.jsx)(`span`,{"data-slot":`brand-name`,className:H(`max-w-full truncate leading-none font-semibold tracking-normal`,t===`cezar`&&`lowercase`),style:{fontFamily:`var(--brand)`,fontSize:Lf.name},children:t})]})}var Bf=`, tasks need you`,Vf={"needs-you":`, a manager needs you`,unread:`, a manager has news`},Hf=`relative flex h-7 min-w-0 items-center justify-center gap-1.5 rounded-[7px] px-2 text-ui font-medium text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 max-md:h-9`,Uf=`bg-card font-semibold text-foreground shadow-xs`;function Wf({managerMode:e,projectsTo:t,managerTo:n,projectsAttention:r,managerAttention:i}){return{projects:{to:t,active:!e,dot:e&&r?`bg-info`:null,dotText:Bf},manager:{to:n,active:e,dot:!e&&i?Is[i]:null,dotText:i?Vf[i]:``}}}function Gf(e){let{projects:t,manager:n}=Wf(e),{managerMode:r,onNavigate:i}=e;return(0,Z.jsxs)(`nav`,{"aria-label":`Mode`,"data-slot":`mode-switch`,className:`mx-3 mb-2 grid grid-cols-2 gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,Z.jsxs)(U,{to:t.to,"data-mode":`projects`,"aria-current":t.active?`page`:void 0,onClick:i,className:H(Hf,t.active&&Uf),children:[(0,Z.jsx)(cd,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),`Projects`,t.dot?(0,Z.jsx)(Kf,{tone:t.dot,text:t.dotText}):null]}),(0,Z.jsxs)(U,{to:n.to,"data-mode":`manager`,"aria-current":n.active?`page`:void 0,onClick:()=>{r||Oc(`sidebar`),i?.()},className:H(Hf,n.active&&Uf),children:[(0,Z.jsx)(Oa,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),`Manager`,n.dot?(0,Z.jsx)(Kf,{tone:n.dot,text:n.dotText}):null]})]})}function Kf({tone:e,text:t}){return(0,Z.jsxs)(`span`,{"data-slot":`mode-switch-dot`,className:`flex shrink-0`,children:[(0,Z.jsx)(`span`,{className:H(`size-1.5 rounded-full`,e),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t})]})}var qf=`relative flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`;function Jf(e){let{projects:t,manager:n}=Wf(e),{managerMode:r}=e;return(0,Z.jsxs)(`nav`,{"aria-label":`Mode`,"data-slot":`rail-mode-switch`,className:`flex flex-col items-center gap-1 border-b border-border pb-1.5`,children:[(0,Z.jsx)(el,{label:`Projects`,side:`right`,children:(0,Z.jsxs)(U,{to:t.to,"data-mode":`projects`,"aria-label":`Projects${t.dot?t.dotText:``}`,"aria-current":t.active?`page`:void 0,className:H(qf,t.active&&`bg-muted text-foreground`),children:[(0,Z.jsx)(cd,{className:`size-4`,"aria-hidden":`true`}),t.dot?(0,Z.jsx)(`span`,{"data-slot":`mode-switch-dot`,"aria-hidden":`true`,className:H(`absolute top-1 right-1 size-1.5 rounded-full`,t.dot)}):null]})}),(0,Z.jsx)(el,{label:`Manager`,side:`right`,children:(0,Z.jsxs)(U,{to:n.to,"data-mode":`manager`,"aria-label":`Manager${n.dot?n.dotText:``}`,"aria-current":n.active?`page`:void 0,onClick:()=>{r||Oc(`sidebar`)},className:H(qf,n.active&&`bg-muted text-foreground`),children:[(0,Z.jsx)(Oa,{className:`size-4`,"aria-hidden":`true`}),n.dot?(0,Z.jsx)(`span`,{"data-slot":`mode-switch-dot`,"aria-hidden":`true`,className:H(`absolute top-1 right-1 size-1.5 rounded-full`,n.dot)}):null]})})]})}var Yf=[{to:`/`,label:`Now`,icon:Sa,match:[`/`],badge:`needs-you`},{to:`/tasks`,label:`Tasks`,icon:gd,match:[`/tasks`,`/compare`],badge:`tasks-unread`},{to:`/inbox`,label:`Inbox`,icon:fd,match:[`/inbox`],badge:`inbox-count`,inbox:!0,group:`workspace`},{to:`/git`,label:`Git`,icon:Oo,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:Nf,match:[`/github`],forge:!0},{to:`/tracker`,label:`Tracker`,icon:Ld,match:[`/tracker`],tracker:!0},{to:`/assets`,label:`Assets`,icon:ja,match:[`/assets`]},{to:`/terminal`,label:`Terminal`,icon:os,match:[`/terminal`],terminal:!0},{to:`/automations`,label:`Automations`,icon:ds,match:[`/automations`],automations:!0},{to:`/skills`,label:`Skills`,icon:La,match:[`/skills`],badge:`skills-update`},{to:`/workflows`,label:`Workflows`,icon:bo,match:[`/workflows`]},{to:`/settings`,label:`Settings`,icon:po,match:[`/settings`],group:`workspace`}];function Xf({forge:e=!1,inbox:t=!1,automations:n=!1,tracker:r,terminal:i=!1}={}){return Yf.filter(a=>(!a.forge||e)&&(!a.inbox||t)&&(!a.automations||n)&&(!a.terminal||i)&&(!a.tracker||r!==void 0)).map(e=>e.tracker?{...e,label:r?Bd[r].label:e.label}:e)}function Zf(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function Qf(e){let t=null;for(let n of Yf)for(let r of n.match)Zf(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function $f(e){let t=Qf(e);return Yf.find(e=>e.to===t)??null}var ep=`relative flex h-14 min-w-0 flex-1 flex-col items-center justify-center gap-0.5 text-meta font-medium text-muted-foreground outline-none transition-colors focus-visible:ring-[3px] focus-visible:ring-ring/50`,tp=`font-semibold text-foreground`;function np({menuOpen:e,onMore:t,manager:n=!1,attention:r=null,managerTo:a=`/manager`}){let o=xs(),s=E(),c=i(),l=Kr();if(o)return null;let u=c.data?.bootProject??s.data?.bootProject,d=kc(cc(l,c.data)??pc(),c.data,u),f=l.pathname===`/tasks`?null:Qf(Ur(l.pathname)),p=(e,t,n,r)=>(0,Z.jsxs)(U,{to:`${d}${e}`,"aria-current":f===r?`page`:void 0,className:H(ep,f===r&&tp),children:[(0,Z.jsx)(n,{className:`size-5`,"aria-hidden":`true`}),t]});return(0,Z.jsxs)(`nav`,{"aria-label":`App`,"data-slot":`phone-bottom-bar`,className:`flex border-t border-border bg-background md:hidden`,children:[p(``,`Now`,Sa,`/`),p(`tasks`,`Tasks`,gd,`/tasks`),(0,Z.jsx)(U,{to:`${d}new`,"aria-label":`New task`,"data-slot":`bottom-bar-new-task`,className:H(ep,`text-foreground`),children:(0,Z.jsx)(`span`,{className:`flex size-9 items-center justify-center rounded-full bg-primary text-primary-foreground`,children:(0,Z.jsx)(ts,{className:`size-5`,"aria-hidden":`true`})})}),(0,Z.jsxs)(U,{to:n?l.pathname===`/manager`?`/manager${l.search}`:`/manager?all=1`:a,"aria-current":n?`page`:void 0,onClick:()=>{n||Oc(`bottom_bar`)},"data-slot":`bottom-bar-manager`,className:H(ep,n&&tp),children:[(0,Z.jsx)(Oa,{className:`size-5`,"aria-hidden":`true`}),`Manager`,r?(0,Z.jsxs)(`span`,{"data-slot":`bottom-bar-attention`,className:`absolute top-2 left-[calc(50%+8px)] flex`,children:[(0,Z.jsx)(`span`,{className:H(`size-1.5 rounded-full`,Is[r]),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:Ls[r]})]}):null]}),(0,Z.jsxs)(`button`,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":e,onClick:t,className:ep,children:[(0,Z.jsx)(yo,{className:`size-5`,"aria-hidden":`true`}),`More`]})]})}function rp(e){return/^\d/.test(e)&&!e.includes(`+`)?`v${e}`:e}function ip(e,t){return!!t&&e.activeRuns>0&&e.scheduled?.target!==t}function ap({label:e=`Update when idle`,doing:t,onClick:n,disabled:r}){return(0,Z.jsx)(Zc,{delayDuration:300,children:(0,Z.jsxs)(Qc,{children:[(0,Z.jsx)(Xc,{asChild:!0,children:(0,Z.jsx)(q,{variant:`outline`,size:`sm`,onClick:n,disabled:r,children:e})}),(0,Z.jsxs)($c,{"data-slot":`update-when-idle-tooltip`,side:`bottom`,children:[`Waits until no task is running or queued, then `,t,` and restarts`]})]})})}function op(e){let t=/-pr(\d+)\./.exec(e);return t?Number(t[1]):null}function sp({data:e,onApply:t,onSchedule:n,applying:r}){let i=Ke(),a=wt(),[o,s]=(0,X.useState)(`worktrees`),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(!1),m=e.job?.status===`running`||e.job?.status===`restarting`,h=e.installed.find(e=>e.active),g=i.data?.checkouts??[],_=i.data?.pulls,v=!i.data||g.length>0,y=v?o:`pulls`,b=c.trim().toLowerCase(),x=(0,X.useMemo)(()=>g.filter(e=>!b||[e.branch,e.task?.title,e.task?.id,e.commit?.subject,e.worktree,e.pr?`#${e.pr}`:``].filter(Boolean).some(e=>e.toLowerCase().includes(b))),[g,b]),S=(0,X.useMemo)(()=>(_?.items??[]).filter(e=>!e.version&&!f?!1:!b||[`#${e.number}`,String(e.number),e.title,e.branch,e.author??``].some(e=>e.toLowerCase().includes(b))),[_,b,f]),C=(_?.items??[]).filter(e=>!e.version).length,w=y===`worktrees`?g.find(e=>e.id===u):void 0,T=y===`pulls`?_?.items.find(e=>e.version&&e.version===u):void 0,E=w?.id??T?.version??null,D=!!w&&(!w.built||w.stale),O=!!E&&E===h?.id&&!D,k=T&&!T.installed?`Install & restart`:D?`${w.built?`Rebuild`:`Build`} & ${w.id===h?.id?`restart`:`switch`}`:`Switch & restart`;return(0,Z.jsxs)(`div`,{"data-slot":`self-update-development`,className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`div`,{role:`tablist`,"aria-label":`Development builds`,className:`flex rounded-md border border-border bg-muted/40 p-0.5`,children:[...v?[{value:`worktrees`,label:`Worktrees`,count:g.length}]:[],{value:`pulls`,label:`Pull requests`,count:(_?.items.length??0)-C}].map(e=>(0,Z.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":y===e.value,onClick:()=>{s(e.value),d(null)},className:H(`rounded-[5px] px-3 py-1 text-label font-semibold transition-colors`,y===e.value?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[e.label,i.data?(0,Z.jsx)(`span`,{className:`ml-1.5 font-normal text-muted-foreground`,children:e.count}):null]},e.value))}),(0,Z.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>a.mutate(),disabled:a.isPending||i.isFetching,children:a.isPending?`Refreshing…`:`Refresh`})]}),(0,Z.jsx)(gl,{"aria-label":`Filter`,value:c,onChange:e=>l(e.target.value),placeholder:y===`worktrees`?`Filter by task, branch, commit or #PR`:`Filter by #number, title, branch or author`,className:`h-8 text-ui`}),(0,Z.jsx)(`div`,{className:`max-h-72 min-h-24 overflow-y-auto rounded-md border border-border`,children:i.isPending?(0,Z.jsx)(`p`,{className:`px-3 py-3 text-label text-muted-foreground`,children:`Looking for worktrees and pull requests…`}):i.error?(0,Z.jsx)(`p`,{className:`px-3 py-3 text-label text-danger`,children:i.error.message}):y===`worktrees`?(0,Z.jsxs)(Z.Fragment,{children:[x.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-3 text-label text-muted-foreground`,children:`Nothing matches.`}):null,(0,Z.jsx)(`div`,{role:`listbox`,"aria-label":`Worktrees`,children:x.map(e=>(0,Z.jsx)(lp,{checkout:e,active:e.id===h?.id,selected:u===e.id,onSelect:()=>d(e.id)},e.worktree))})]}):(0,Z.jsxs)(Z.Fragment,{children:[_&&!_.available?(0,Z.jsx)(`p`,{className:`px-3 py-2 text-label text-muted-foreground`,children:_.reason}):null,_?.available&&S.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-3 text-label text-muted-foreground`,children:_.items.length===0?`No open pull requests on ${_.repo}.`:b?`Nothing matches.`:`No open pull request has a preview build.`}):null,(0,Z.jsx)(`div`,{role:`listbox`,"aria-label":`Pull requests`,children:S.map(e=>(0,Z.jsx)(up,{pull:e,active:!!e.version&&e.version===h?.id,selected:!!e.version&&u===e.version,onSelect:()=>e.version&&d(e.version)},e.number))}),C>0?(0,Z.jsx)(`button`,{type:`button`,onClick:()=>p(e=>!e),className:`w-full border-t border-border px-3 py-2 text-left text-label text-muted-foreground hover:text-foreground`,children:f?`Hide the ${C} without a preview build`:`${C} more without a preview build (forks, CI not green yet) — show`}):null]})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,Z.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-meta text-muted-foreground`,title:w?.worktree,children:w?D?`${w.built?`Built before its last commit`:`Not built yet`} — runs npm run build in ${w.worktree} first (about a minute).`:w.worktree:T?`Installs ${T.version} from npm.`:y===`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.`}),!O&&ip(e,E)?(0,Z.jsx)(ap,{label:`When idle`,doing:T?`${T.installed?`switches to`:`installs`} PR #${T.number}'s build`:`${D?`builds and switches to`:`switches to`} ${w.branch}`,onClick:()=>n(E),disabled:!e.canSelfUpdate||r||m}):null,(0,Z.jsx)(q,{size:`sm`,variant:`contrast`,onClick:()=>E&&t(E),disabled:!E||O||!e.canSelfUpdate||r||m,children:k})]})]})}function cp({selected:e,disabled:t,onSelect:n,title:r,children:i}){return(0,Z.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:H(`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 lp({checkout:e,active:t,selected:n,onSelect:r}){let i=e.task?.title??e.commit?.subject??e.branch;return(0,Z.jsxs)(cp,{selected:n,disabled:!e.id,onSelect:r,title:e.worktree,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ui font-medium`,children:i}),e.pr?(0,Z.jsxs)(ff,{variant:`outline`,children:[`#`,e.pr]}):null,t?(0,Z.jsx)(ff,{variant:`secondary`,children:`current`}):null,e.built?e.stale?(0,Z.jsx)(ff,{variant:`outline`,children:`needs rebuild`}):null:(0,Z.jsx)(ff,{variant:`outline`,children:`not built`})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-meta text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono`,children:e.branch}),e.task?(0,Z.jsxs)(`span`,{className:`shrink-0`,children:[`· `,e.task.status]}):null,e.commit?(0,Z.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,e.commit.sha,` `,e.task?e.commit.subject:``,` · `,Ml(e.commit.at),` ago`]}):null,e.builtAt?(0,Z.jsxs)(`span`,{className:`shrink-0`,children:[`· built `,Ml(e.builtAt),` ago`]}):null]})]})}function up({pull:e,active:t,selected:n,onSelect:r}){return(0,Z.jsxs)(cp,{selected:n,disabled:!e.version,onSelect:r,title:e.url,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsxs)(`span`,{className:`shrink-0 text-ui text-muted-foreground`,children:[`#`,e.number]}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ui font-medium`,children:e.title}),e.draft?(0,Z.jsx)(ff,{variant:`outline`,children:`draft`}):null,t?(0,Z.jsx)(ff,{variant:`secondary`,children:`current`}):e.version?e.installed?(0,Z.jsx)(ff,{variant:`outline`,children:`installed`}):null:(0,Z.jsx)(ff,{variant:`outline`,children:`no build`})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-meta text-muted-foreground`,children:[e.author?(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.author}):null,(0,Z.jsxs)(`span`,{className:`min-w-0 truncate font-mono`,children:[`· `,e.branch]}),(0,Z.jsxs)(`span`,{className:`shrink-0`,children:[`· updated `,Ml(e.updatedAt),` ago`]}),e.version?(0,Z.jsxs)(`span`,{className:`shrink-0`,children:[`· build `,e.publishedAt?`${Ml(e.publishedAt)} ago`:e.version]}):null]})]})}function dp({open:e,onOpenChange:t,autoApply:n,brandName:r=`cezar`}){let i=ne(e),a=On(),o=N(),s=hn(),c=h(),l=It(),[u,d]=(0,X.useState)(``),f=i.data,p=(0,X.useRef)(null),m=(0,X.useRef)(!1);return(0,X.useEffect)(()=>{!n||m.current||!f||!f.canSelfUpdate||f.job||(m.current=!0,!(f.activeRuns>0)&&s.mutate(n))},[n,f,s]),(0,Z.jsx)(ol,{open:e,onOpenChange:e=>{!e&&f?.job?.status===`running`||t(e)},children:(0,Z.jsxs)(rl,{"data-slot":`self-update-dialog`,className:`sm:max-w-xl`,ref:p,onOpenAutoFocus:e=>{e.preventDefault(),p.current?.focus()},children:[(0,Z.jsxs)(tl,{children:[(0,Z.jsxs)(il,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(`span`,{children:[r,` `,f?`v${f.version}`:``]}),(0,Z.jsx)(_p,{data:f})]}),(0,Z.jsxs)(al,{className:`sr-only`,children:[`Update `,r,`, pick a release channel or switch versions.`]})]}),f?(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5`,children:[(0,Z.jsx)(mp,{data:f,busy:o.isPending,onChange:e=>{d(``),o.mutate(e)}}),(0,Z.jsx)(hp,{data:f,checking:a.isPending,onCheck:()=>a.mutate(),onApply:e=>s.mutate(e),onSchedule:e=>c.mutate(e),applying:s.isPending||c.isPending}),f.channel===`development`?(0,Z.jsx)(sp,{data:f,onApply:e=>s.mutate(e),onSchedule:e=>c.mutate(e),applying:s.isPending||c.isPending}):(0,Z.jsx)(gp,{data:f,picked:u,onPick:d,onApply:e=>s.mutate(e),onSchedule:e=>c.mutate(e),applying:s.isPending||c.isPending}),f.canSelfUpdate?null:(0,Z.jsx)(vp,{data:f}),f.scheduled?(0,Z.jsxs)(`div`,{"data-slot":`self-update-scheduled`,className:`flex items-center justify-between gap-3 rounded-md border border-primary/40 bg-primary/5 px-3 py-2 text-label`,children:[(0,Z.jsxs)(`p`,{className:`min-w-0`,children:[r,` switches to `,(0,Z.jsx)(`span`,{className:`font-semibold`,children:rp(f.scheduled.target)}),` as soon as no task is running. You can close this window and keep working.`]}),(0,Z.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>l.mutate(),disabled:l.isPending,children:`Cancel`})]}):f.activeRuns>0&&f.canSelfUpdate?(0,Z.jsxs)(`p`,{className:`rounded-md border border-pending/50 bg-pending/10 px-3 py-2 text-label text-foreground`,children:[f.activeRuns,` task`,f.activeRuns===1?` is`:`s are`,` running. A restart interrupts them; `,r,` re-queues or resumes them on the way back up.`,` `,`The “when idle” buttons wait for them to finish instead.`]}):null,o.error?(0,Z.jsxs)(`p`,{className:`text-label 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,Z.jsx)(`p`,{className:`text-label text-danger`,children:s.error.message}):null,c.error?(0,Z.jsx)(`p`,{className:`text-label text-danger`,children:c.error.message}):null,l.error?(0,Z.jsx)(`p`,{className:`text-label text-danger`,children:l.error.message}):null,f.job?(0,Z.jsx)(yp,{data:f}):null]}):i.error?(0,Z.jsx)(`p`,{className:`text-ui text-danger`,children:i.error.message}):null]})})}var fp=[{value:`stable`,label:`Stable`},{value:`nightly`,label:`Nightly`},{value:`development`,label:`Development`}],pp={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 mp({data:e,busy:t,onChange:n}){return(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-ui font-semibold`,children:`Release channel`}),(0,Z.jsx)(`div`,{className:`text-label text-muted-foreground`,children:pp[e.channel]})]}),(0,Z.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:fp.map(r=>{let i=e.channel===r.value;return(0,Z.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":i,disabled:t,onClick:()=>!i&&n(r.value),className:H(`rounded-[5px] px-3 py-1 text-label font-semibold transition-colors`,i?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:r.label},r.value)})})]})}function hp({data:e,checking:t,onCheck:n,onApply:r,onSchedule:i,applying:a}){let o=e.job?.status===`running`||e.job?.status===`restarting`,s=e.installed.find(e=>e.active),c=s?.source===`registry`?op(s.version):null,l=s&&(s.source===`link`||s.source===`local`||c!==null)?s:null;if(l||e.channel===`development`){let i=e.channel===`development`?null:e.latest[e.channel],s=i!==null&&e.installed.some(e=>e.source===`registry`&&e.id===i);return(0,Z.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,Z.jsx)(`div`,{className:`min-w-0 text-ui break-words`,children:l?.source===`link`?(0,Z.jsxs)(Z.Fragment,{children:[`Running worktree `,(0,Z.jsx)(`span`,{className:`font-mono text-label font-semibold`,children:l.branch??l.id}),`, not a release.`]}):l?.source===`local`?(0,Z.jsx)(Z.Fragment,{children:`Running a local build, not a release.`}):c===null?(0,Z.jsxs)(Z.Fragment,{children:[`Running `,(0,Z.jsxs)(`span`,{className:`font-semibold`,children:[`v`,e.version]}),`. Pick a worktree or a pull request below.`]}):(0,Z.jsxs)(Z.Fragment,{children:[`Running the preview build of `,(0,Z.jsxs)(`span`,{className:`font-semibold`,children:[`PR #`,c]}),`, not a release.`]})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,Z.jsx)(`div`,{className:`min-w-0 text-meta break-words text-muted-foreground`,children:e.channel===`development`?`Switch the channel back to Stable or Nightly to follow releases again.`:e.checkedAt?(0,Z.jsxs)(Z.Fragment,{children:[i?(0,Z.jsxs)(Z.Fragment,{children:[`Newest `,e.channel,`: `,(0,Z.jsxs)(`span`,{className:`font-mono text-foreground`,children:[`v`,i]}),` ·`,` `]}):null,`checked `,new Date(e.checkedAt).toLocaleTimeString()]}):`The npm registry has not answered yet.`}),e.channel===`development`?null:(0,Z.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,Z.jsx)(q,{variant:`ghost`,size:`sm`,onClick:n,disabled:t||o,children:t?`Checking…`:`Check again`}),i?(0,Z.jsx)(q,{size:`sm`,"aria-label":s?`Back to v${i}`:`Install v${i} & restart`,onClick:()=>r(i),disabled:!e.canSelfUpdate||a||o,children:s?`Switch back`:`Install & restart`}):null]})]})]})}let u=e.updateAvailable;return(0,Z.jsxs)(`div`,{"data-slot":`self-update-latest`,className:H(`flex flex-wrap items-center justify-between gap-x-3 gap-y-2 rounded-md border px-3 py-2.5`,u?`border-primary/40 bg-primary/5`:`border-border bg-card`),children:[(0,Z.jsxs)(`div`,{className:`min-w-[14rem] flex-1 text-ui break-words`,children:[e.checkedAt?u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`font-semibold`,children:[`v`,u]}),` is available on `,e.channel,`.`]}):(0,Z.jsxs)(Z.Fragment,{children:[`You are on the newest `,e.channel,` version`,e.channel===`nightly`&&e.latest.nightly?` (v${e.latest.nightly})`:``,`.`]}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`The npm registry has not answered yet.`}),e.checkedAt?(0,Z.jsxs)(`div`,{className:`text-meta text-muted-foreground`,children:[`checked `,new Date(e.checkedAt).toLocaleTimeString()]}):null]}),(0,Z.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,Z.jsx)(q,{variant:`ghost`,size:`sm`,onClick:n,disabled:t||o,children:t?`Checking…`:`Check again`}),ip(e,u)?(0,Z.jsx)(ap,{doing:`installs ${rp(u)}`,onClick:()=>i(u),disabled:!e.canSelfUpdate||a||o}):null,u?(0,Z.jsx)(q,{size:`sm`,onClick:()=>r(u),disabled:!e.canSelfUpdate||a||o,children:`Update & restart`}):null]})]})}function gp({data:e,picked:t,onPick:n,onApply:r,onSchedule:i,applying:a}){let o=e.job?.status===`running`||e.job?.status===`restarting`,s=(0,X.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]),c=s.find(e=>e.value===t);return(0,Z.jsxs)(`div`,{"data-slot":`self-update-picker`,className:`flex min-w-0 flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`text-ui font-semibold`,children:[`Pick a version `,(0,Z.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,e.channel]})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsxs)(Za,{value:t,onValueChange:n,disabled:s.length===0||o,children:[(0,Z.jsx)(Ya,{size:`sm`,"aria-label":`Version`,className:`w-0 min-w-0 flex-1 text-ui`,children:(0,Z.jsx)(Xa,{placeholder:s.length===0?`No versions known`:`Choose a version to install`})}),(0,Z.jsx)(Ja,{className:`max-h-72`,children:s.map(e=>(0,Z.jsx)(J,{value:e.value,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.label,e.active?(0,Z.jsx)(ff,{variant:`secondary`,children:`current`}):e.installed?(0,Z.jsx)(ff,{variant:`outline`,children:`installed`}):null]})},e.value))})]}),c&&!c.active&&ip(e,c.value)?(0,Z.jsx)(ap,{label:`When idle`,doing:`${c.installed?`switches to`:`installs`} ${rp(c.value)}`,onClick:()=>i(c.value),disabled:!e.canSelfUpdate||a||o}):null,(0,Z.jsx)(q,{size:`sm`,variant:`contrast`,onClick:()=>c&&r(c.value),disabled:!c||c.active||!e.canSelfUpdate||a||o,children:c?.installed?`Switch & restart`:`Install & restart`})]}),(0,Z.jsx)(`p`,{className:`text-meta text-muted-foreground`,children:`Any version, older ones included. Installed versions stay on disk, so switching back is instant.`})]})}function _p({data:e}){let t=e?.installed.find(e=>e.active);if(t?.source===`local`)return(0,Z.jsx)(ff,{variant:`outline`,children:`local build`});if(t?.source===`link`)return(0,Z.jsxs)(ff,{variant:`outline`,children:[`worktree · `,t.branch??t.id]});let n=t?op(t.version):null;return n===null?null:(0,Z.jsxs)(ff,{variant:`outline`,children:[`PR #`,n,` build`]})}function vp({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,Z.jsxs)(`div`,{"data-slot":`self-update-install-hint`,className:`rounded-md border border-border bg-muted/40 px-3 py-2.5 text-label`,children:[(0,Z.jsx)(`p`,{children:e.reason}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-muted-foreground`,children:`Run this once, then start cezar with the plain command:`}),(0,Z.jsx)(`pre`,{className:`mt-1.5 overflow-x-auto rounded bg-background px-2 py-1.5 font-mono text-label`,children:t})]})}function yp({data:e}){let t=e.job,n=V(),r=(0,X.useRef)(null),[i,a]=(0,X.useState)(`waiting`);return(0,X.useEffect)(()=>{r.current?.scrollTo({top:r.current.scrollHeight})},[t.log.length]),(0,X.useEffect)(()=>{if(t.status!==`restarting`)return;let r=!1,i=Date.now(),o=()=>{a(`back`),n.removeQueries({queryKey:R.selfUpdate}),window.setTimeout(()=>window.location.reload(),400)},s=async()=>{if(!r){try{if((await St()).version!==e.version)return o();let t=await C().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,Z.jsxs)(`div`,{"data-slot":`self-update-job`,className:`flex min-w-0 flex-col gap-1.5`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-between text-label`,children:(0,Z.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,Z.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-meta leading-[1.5] break-all whitespace-pre-wrap text-muted-foreground`,children:t.log.join(`
3
3
  `)}),t.error?(0,Z.jsx)(`p`,{className:`text-label text-danger`,children:t.error}):null]})}var bp=`cez-theme`,xp=`(prefers-color-scheme: light)`,Sp=`dark`,Cp={light:`#ffffff`,dark:`#0d0d0d`};function wp(e){return e===`light`||e===`dark`||e===`system`?e:Sp}function Tp(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function Ep(){try{return wp(localStorage.getItem(bp))}catch{return Sp}}function Dp(e){try{localStorage.setItem(bp,e)}catch{}}function Op(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(xp).matches}function kp(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t,e.ownerDocument.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,Cp[t])}var Ap=X.createContext(null);function jp({children:e}){let[t,n]=X.useState(Ep),[r,i]=X.useState(Op);X.useEffect(()=>{let e=window.matchMedia?.(xp);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=Tp(t,r);X.useLayoutEffect(()=>{kp(document.documentElement,a)},[a]);let o=X.useCallback(e=>{n(e),Dp(e)},[]),s=X.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,Z.jsx)(Ap.Provider,{value:s,children:e})}function Mp(){return X.useContext(Ap)?.resolvedTheme??Tp(Ep(),Op())}function Np(){let e=X.useContext(Ap);if(!e)throw Error(`cezar: useTheme() must be called inside <ThemeProvider>`);return e}var Pp={light:`dark`,dark:`system`,system:`light`},Fp=`regular`,Ip=[{value:`regular`,label:`Regular`},{value:`automation`,label:`Automations`},{value:`all`,label:`All`}],Lp=`cez-task-origin`;function Rp(e){if(!e.deferredBinding)return e.automationId??e.automation?.automationId??e.automationTrigger?.automationId??e.automationTracker?.automationId}function zp(e,t){let n=Rp(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:Rp(i)}function Bp(e,t,n){return(t?.get(e)??n?.get(e))||`${t?`Removed automation`:`Automation`} · ${e.slice(0,8)}`}function Vp(e){let t=new Map;for(let n of e)for(let e of[n.automation,n.automationTrigger,n.automationTracker]){let n=e?.automationName;e&&typeof n==`string`&&n.trim()&&!t.has(e.automationId)&&t.set(e.automationId,n)}return t}function Hp(e,t){return t===`all`?!0:t===`automation`?e!==void 0:e===void 0}function Up(e){return e===`regular`||e===`automation`||e===`all`?e:Fp}function Wp(){try{return Up(localStorage.getItem(Lp))}catch{return Fp}}var Gp=new Set,Kp;function qp(e){try{localStorage.setItem(Lp,e)}catch{Kp=e}for(let e of Gp)e()}function Jp(){return Kp??Wp()}function Yp(e){Gp.add(e);let t=t=>{(t.key===null||t.key===`cez-task-origin`)&&e()};return window.addEventListener(`storage`,t),()=>{Gp.delete(e),window.removeEventListener(`storage`,t)}}function Xp(){return[X.useSyncExternalStore(Yp,Jp,()=>Fp),qp]}var Zp=`cezar:open-task-palette`;function Qp(e){window.dispatchEvent(new CustomEvent(Zp,{detail:e}))}function $p(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function em(){let e=V(),t=Et(),n=X.useRef(0),r=X.useRef(Promise.resolve()),i=X.useMemo(()=>gc(t.data?.sidebar?.projectOrder),[t.data?.sidebar?.projectOrder]),a=X.useCallback(t=>{let i=e.getQueryData(R.uiState);if(i===void 0)return;let{projectOrder:a,...o}=$p(i.sidebar),s=t===null?o:{...o,projectOrder:t};e.setQueryData(R.uiState,{...i,sidebar:s});let c=++n.current,l=r.current.then(async()=>{let t=await $t({sidebar:s},{keepalive:!0});c===n.current&&e.setQueryData(R.uiState,t)});r.current=l.catch(t=>{Y(t instanceof Error?t.message:String(t),{tone:`danger`}),c===n.current&&e.invalidateQueries({queryKey:R.uiState})})},[e]),o=X.useCallback(e=>{let t=gc(e);t.length!==0&&a(t.slice(0,200))},[a]),s=X.useCallback(()=>a(null),[a]);return{order:i,canReorder:t.data!==void 0,setOrder:o,reset:s}}var tm=`cezar:open-command-palette`;function nm(){window.dispatchEvent(new Event(tm))}function rm(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function im(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,t]of a.entries()){let n=e=>e!==void 0&&/^#?\d+$/.test(e),r=n(t)||/^(pr|issue)$/.test(t)&&n(a[e+1]),s=0;for(let e=i.indexOf(t);e!==-1;e=i.indexOf(t,e+1)){let n=e===0||!/[a-z0-9]/.test(i[e-1]??``),a=!/[a-z0-9]/.test(i[e+t.length]??``);s=Math.max(s,r&&n&&a?1:(n?1:.5)*(a?1:.8)/(1+e/48))}if(s===0)return 0;o+=s}return o/a.length}var am=e=>({pullRequestUrl:e.pullRequestUrl,referencedPullRequestUrl:e.referencedPullRequestUrl,referencedPrCandidates:e.referencedPrCandidates,prNumber:e.prNumber,prRefs:e.prRefs,issueNumber:e.issueNumber,referencedIssueUrl:e.referencedIssueUrl,referencedIssueCandidates:e.referencedIssueCandidates,markerRefs:e.markerRefs});function om(e,t,n){let r=rm(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,idleClosedAt:e.idleClosedAt,workflow:e.workflow,branch:e.branch,startedAt:e.startedAt,lastActivityAt:er(e),...vm(am(e)),...vm({automationId:Rp(e),dispatch:e.dispatch&&{rootRunId:e.dispatch.rootRunId,parentRunId:e.dispatch.parentRunId,kind:e.dispatch.kind}})})),i=new Set(r.map(ym)),a=(n??[]).filter(e=>!i.has(ym(e))).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),o=[...r,...a],s=new Map(o.map(e=>[e.id,e]));return o.map(e=>{if(e.automationId!==void 0)return e;let t=zp(e,e=>s.get(e));return t===void 0?e:{...e,automationId:t}})}var sm=`w-12 text-right`;function cm({label:e}){return(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1`,children:e}),(0,Z.jsxs)(`span`,{"aria-hidden":`true`,className:`flex shrink-0 gap-1 text-meta font-normal`,children:[(0,Z.jsx)(`span`,{className:H(sm,`after:content-['Updated']`)}),(0,Z.jsx)(`span`,{className:H(sm,`after:content-['Created']`)})]})]})}function lm(e){return e.status===`running`&&e.activity!==`monitoring`}function um(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:fm().format(t)}var dm,fm=()=>dm??=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function pm(e,t,n=new Map){return e.map(e=>{let r=Ge(e),i=xe(e,e.projectId===null?void 0:n.get(e.projectId)),a=i.map(e=>`${e.kind} #${e.number}`).join(` `),o=e.projectId===null?null:t.get(e.projectId)??null;return{task:e,key:ym(e),label:r,references:a,refList:i,value:`task ${r} ${a} ${e.id}`,keywords:[...o?[o]:[],...e.automationId?[`automation`,`automatic`]:[]],projectName:o,title:`${lm(e)?`Working now`:`Updated ${um(e.lastActivityAt)}`} · created ${um(e.createdAt)}`}})}function mm(e,t,n=50){if(t.trim()===``)return{shown:e.slice(0,n),total:e.length};let r=[];return e.forEach((e,n)=>{let i=im(e.value,t,e.keywords);i>0&&r.push({entry:e,score:i,index:n})}),r.sort((e,t)=>t.score-e.score||e.index-t.index),{shown:r.slice(0,n).map(e=>e.entry),total:r.length}}function hm({entries:e,children:t}){let n=Wt(),r=X.useMemo(()=>e.flatMap(e=>e.refList.map(t=>({projectId:e.task.projectId??n??``,kind:t.kind,number:t.number}))).filter(e=>e.projectId!==``),[e,n]),i=r.map(e=>`${e.projectId} ${e.kind}#${e.number}`).join(`|`),a=X.useRef(r);a.current=r;let[o,s]=X.useState(r);return X.useEffect(()=>{let e=setTimeout(()=>s(a.current),250);return()=>clearTimeout(e)},[i]),(0,Z.jsx)(Ca,{projectId:n,requests:o,children:t})}var gm=`[&_[cmdk-group-items]]:flex [&_[cmdk-group-items]]:flex-col`;function _m({hidden:e}){return e<=0?null:(0,Z.jsxs)(Wl,{forceMount:!0,disabled:!0,value:`__more-tasks`,"data-slot":`palette-more-tasks`,className:`order-last py-1.5! text-label text-soft-foreground data-[disabled=true]:opacity-100`,children:[e,` more — keep typing to narrow`]})}function vm(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}var ym=e=>`${e.projectId??``}/${e.id}`;function bm(e){let t=e.filter(e=>ka(e)).sort((e,t)=>(t.finishedAt??``).localeCompare(e.finishedAt??``)),n=new Set(t.map(ym));return{recentlyFinished:t,otherTasks:e.filter(e=>!n.has(ym(e)))}}function xm(e,t,n=[]){let r=vc(e,n);return[...r.filter(e=>e.id!==t),...r.filter(e=>e.id===t)]}function Sm(){let e=Nr(),t=i(),n=E(),r=t.data,a=r?.bootProject??n.data?.bootProject??null,o=ge(e,a),s=r!==void 0&&r.projects.length>1,c=Le(s),l=c.data?.referenceStatuses;X.useEffect(()=>{l&&Vt(l)},[l]);let u=X.useMemo(()=>new Map((r?.projects??[]).map(e=>[e.id,e.name])),[r]),d=(e==="default"?null:e)??a,f=X.useMemo(()=>om(o.data??[],d,c.data?.runs),[o.data,d,c.data]),p=rt();return{activeProjectId:e,registry:r,health:n,multiProject:s,projectNames:u,repoBases:X.useMemo(()=>{let e=new Map;for(let t of r?.projects??[])t.repoUrl&&e.set(t.id,t.repoUrl);return d&&p&&!e.has(d)&&e.set(d,p),e},[r,d,p]),runsProjectId:d,tasks:f}}function Cm(e,t=``){let n=`/tasks/${e.id}${t}`;return e.projectId===null?n:Br(e.projectId,n)}var wm=`cezar:palette-opened`;function Tm(e){window.dispatchEvent(new CustomEvent(wm,{detail:e}))}function Em(e,t,n){X.useEffect(()=>{t&&Tm(e)},[t,e]),X.useEffect(()=>{let t=t=>{t.detail!==e&&n()};return window.addEventListener(wm,t),()=>window.removeEventListener(wm,t)},[e,n])}function Dm(){let[e,t]=X.useState(!1),n=Lr();ys(`k`,()=>t(e=>!e));let r=X.useCallback(()=>{t(!1),n(`/new`)},[n]);ys(`n`,r),Es(`c`,r),X.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(tm,e),()=>window.removeEventListener(tm,e)},[]);let i=X.useCallback(()=>t(!1),[]);return Em(`command`,e,i),X.useEffect(()=>{e&&bl(`command`)},[e]),(0,Z.jsx)(Ul,{open:e,onOpenChange:e=>{e||Sl(`command`),t(e)},title:`Command palette`,description:`Search projects, tasks, views, actions, and skills`,showCloseButton:!1,filter:im,commandProps:{onKeyDown:X.useCallback(e=>{if(e.key!==`Tab`||e.shiftKey||e.altKey||e.metaKey||e.ctrlKey)return;let n=e.currentTarget.querySelector(`[cmdk-item][data-selected="true"][data-slot="palette-task"]`),r=n?.dataset.runId;r&&(e.preventDefault(),vl(`cmdk_tab`),t(!1),Qp({runId:r,projectId:n.dataset.projectId??null}))},[])},className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,Z.jsx)(km,{close:i})})}var Om=X.memo(function({entry:e,showProject:t,now:n,onSelect:r,slot:i=`palette-task`,current:a=!1}){let{task:o,label:c,projectName:l}=e,u=s(o),d=o.projectId?e.refList[0]:void 0;return(0,Z.jsxs)(Wl,{value:e.value,keywords:e.keywords,"data-slot":i,"data-run-id":o.id,"data-project-id":o.projectId??void 0,onSelect:()=>r(o),children:[(0,Z.jsx)(Pl,{tone:u.tone,pulse:u.pulse,"aria-label":u.label,role:`img`}),d&&o.projectId?(0,Z.jsx)(`span`,{"data-slot":`palette-task-refs`,className:`flex shrink-0 items-center gap-1 [&_svg]:size-3!`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(Rl,{run:o,projectId:o.projectId,reference:d,compact:!0,className:`h-auto shrink-0 gap-[2px] px-1.5 py-px text-micro`})}):null,(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:c,children:te(c,d?.number)?ce(c).rest:c}),o.automationId?(0,Z.jsxs)(`span`,{"data-slot":`palette-task-automation`,"aria-label":`Started by an automation`,className:`flex shrink-0 items-center gap-0.5 text-label text-soft-foreground`,children:[(0,Z.jsx)(ds,{"aria-hidden":`true`,className:`size-3!`}),`auto`]}):null,t&&l?(0,Z.jsx)(`span`,{"data-slot":`palette-task-project`,className:`shrink-0 truncate text-label text-muted-foreground`,children:l}):null,a?(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-primary`,children:`open`}):null,(0,Z.jsxs)(`span`,{"data-slot":`palette-task-age`,title:e.title,className:`flex shrink-0 gap-1 text-xs tabular-nums`,children:[(0,Z.jsx)(`span`,{"data-slot":`palette-task-updated`,className:H(sm,`text-muted-foreground`),children:lm(o)?`now`:Ml(o.lastActivityAt,n)}),(0,Z.jsx)(`span`,{"data-slot":`palette-task-created`,className:H(sm,`text-soft-foreground`),children:Ml(o.createdAt,n)})]})]})});function km({close:e}){let t=Lr(),n=Mr(),[r,i]=X.useState(``),a=r.trim()!==``,o=X.useRef(new Set);X.useEffect(()=>{for(let e of Ol(r))o.current.add(e)},[r]),X.useEffect(()=>()=>xl(o.current),[]);let{theme:s,setTheme:c}=Np(),{activeProjectId:l,registry:u,health:d,multiProject:f,projectNames:p,repoBases:m,tasks:h}=Sm(),g=d.data?.capabilities.managers===!0,_=ii(g),v=ko(),y=de(),b=Ht(),[x]=X.useState(Date.now),{order:S}=em(),C=X.useMemo(()=>f&&u?xm(u.projects,l,S):[],[f,u,l,S]),w=X.useMemo(()=>{let{recentlyFinished:e,otherTasks:t}=bm(h);return{all:pm(h,p,m),recentlyFinished:pm(e,p,m),otherTasks:pm(t,p,m)}},[h,p,m]),T=a?{shown:[],total:0}:mm(w.recentlyFinished,``,20),E=mm(a?w.all:w.otherTasks,r),D=f,O=b.data?.skillUsage,k=X.useMemo(()=>Fo(y.data??[],O),[y.data,O]),A=n=>{e(),t(n)},j=t=>{e(),n(t)},M=n=>{e(),t(Br(n,`/`))},N=X.useCallback(n=>{vl(`cmdk`),e(),t(Cm(n))},[e,t]),P=Pp[s];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(zl,{placeholder:`Search projects, tasks, views, actions, skills…`,value:r,onValueChange:i}),(0,Z.jsxs)(Kl,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:[(0,Z.jsx)(Gl,{children:`Nothing matches.`}),(0,Z.jsx)(Vl,{children:(0,Z.jsxs)(Wl,{value:`new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>A(`/new`),children:[(0,Z.jsx)(ts,{"aria-hidden":`true`}),`New task`,(0,Z.jsx)(Hl,{children:`C`})]})}),(0,Z.jsxs)(hm,{entries:[...T.shown,...E.shown],children:[!a&&T.shown.length>0?(0,Z.jsxs)(Vl,{heading:(0,Z.jsx)(cm,{label:`Recently finished`}),className:gm,children:[T.shown.map(e=>(0,Z.jsx)(Om,{entry:e,showProject:D,now:x,onSelect:N},e.key)),(0,Z.jsx)(_m,{hidden:T.total-T.shown.length})]}):null,(0,Z.jsxs)(Vl,{heading:`Views`,children:[f?(0,Z.jsxs)(Wl,{value:`view All tasks`,"data-slot":`palette-view`,"data-nav-to":`/tasks`,onSelect:()=>j(`/tasks`),children:[(0,Z.jsx)(ja,{"aria-hidden":`true`}),`All tasks`]}):null,Xf({forge:v!=null,inbox:d.data?.capabilities.followups===!0,automations:d.data?.capabilities.automations===!0,terminal:d.data?.capabilities.terminal===!0,tracker:u?.projects.find(e=>e.id===(l??u.bootProject))?.tracker}).map(e=>{let t=e.icon;return(0,Z.jsxs)(Wl,{value:`view ${e.label}`,"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>A(e.to),children:[(0,Z.jsx)(t,{"aria-hidden":`true`}),e.label]},e.to)}),g?(0,Z.jsxs)(Wl,{value:`view Manager`,"data-slot":`palette-view`,"data-nav-to":`/manager`,onSelect:()=>{Oc(`palette`),j(`/manager`)},children:[(0,Z.jsx)(Oa,{"aria-hidden":`true`}),`Manager`]}):null,ei(_.data?.managers??[]).map(e=>(0,Z.jsxs)(Wl,{value:`manager ${e.name} ${e.id}`,"data-slot":`palette-manager`,"data-nav-to":`/manager/${e.id}`,onSelect:()=>j(`/manager/${encodeURIComponent(e.id)}`),children:[(0,Z.jsx)(Oa,{"aria-hidden":`true`}),e.name]},e.id)),g?(0,Z.jsxs)(Wl,{value:`new manager`,"data-slot":`palette-view`,"data-nav-to":`/manager/new`,onSelect:()=>{Oc(`palette`),j(`/manager/new`)},children:[(0,Z.jsx)(ts,{"aria-hidden":`true`}),`New manager`]}):null,(0,Z.jsxs)(Wl,{value:`view global settings`,"data-slot":`palette-view`,"data-nav-to":`/settings/global`,onSelect:()=>j(`/settings/global`),children:[(0,Z.jsx)(po,{"aria-hidden":`true`}),`Global settings`]})]}),C.length>0?(0,Z.jsx)(Vl,{heading:`Projects`,children:C.map(e=>{let t=e.id===l,n=e.status===`missing`;return(0,Z.jsxs)(Wl,{value:`project ${e.name} ${e.id}`,keywords:[e.root],"data-slot":`palette-project`,"data-project-id":e.id,disabled:n,onSelect:()=>M(e.id),children:[(0,Z.jsx)(ad,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),n?(0,Z.jsx)(`span`,{className:`shrink-0 text-label text-muted-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-ui text-muted-foreground`,children:e.branch}),t?(0,Z.jsx)(Wa,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id)})}):null,E.shown.length>0?(0,Z.jsxs)(Vl,{heading:(0,Z.jsx)(cm,{label:`Tasks`}),className:gm,children:[E.shown.map(e=>(0,Z.jsx)(Om,{entry:e,showProject:D,now:x,onSelect:N},e.key)),(0,Z.jsx)(_m,{hidden:E.total-E.shown.length})]}):null]}),(0,Z.jsx)(Vl,{heading:`Actions`,children:(0,Z.jsxs)(Wl,{value:`action toggle theme`,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{c(P),e()},children:[(0,Z.jsx)(Sd,{"aria-hidden":`true`}),`Toggle theme`,(0,Z.jsxs)(Hl,{className:`tracking-normal`,children:[s,` → `,P]})]})}),k.length>0?(0,Z.jsx)(Vl,{heading:`Skills`,children:k.map(e=>(0,Z.jsxs)(Wl,{value:`skill ${e.name} ${e.path}`,keywords:e.description?[e.description]:void 0,"data-slot":`palette-skill`,"data-skill":e.name,onSelect:()=>A(`/new?skill=${encodeURIComponent(e.name)}`),children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-label text-muted-foreground`,children:e.description}):null]},e.path))}):null]})]})}function Am(e,t){let n=e===null?`Connecting…`:e===`healthy`?`Healthy`:`Needs attention`;return t?`${n} · ${t} running`:n}var jm=[{value:`system`,label:`System`,Icon:xd},{value:`dark`,label:`Dark`,Icon:Sd},{value:`light`,label:`Light`,Icon:Id}],Mm=`outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`;function Nm({health:e,runningCount:t=null,brandName:n,version:r,latestVersion:i,starCount:a,hostWidget:o,toolsMenu:s,whatsNew:c,whatsNewUnseen:l=!1,healthReason:u=null}){let[d,f]=X.useState(!1),{theme:p,setTheme:m}=Np(),h=(0,Z.jsx)(`span`,{"data-slot":`sidebar-status`,tabIndex:e===`attention`&&u?0:void 0,className:H(`min-w-0 truncate rounded-sm`,Mm),children:Am(e??null,t)});return(0,Z.jsxs)(`div`,{"data-slot":`sidebar-footer`,className:`flex shrink-0 flex-col gap-1.5 border-t border-border px-3 py-2.5`,children:[(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search tasks, pages, commands (⌘K / Ctrl+K)`,onClick:()=>nm(),className:H(`flex h-8 w-full min-w-0 items-center gap-2 rounded-md border border-border bg-muted/40 px-2.5 text-ui text-soft-foreground transition-colors hover:bg-muted hover:text-muted-foreground`,Mm),children:[(0,Z.jsx)(is,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:`Search tasks, pages, commands…`}),(0,Z.jsx)(Xo,{className:`shrink-0`,children:ws(`k`)})]}),(0,Z.jsxs)(`div`,{"data-slot":`sidebar-footer-controls`,className:`flex h-6 min-w-0 items-center gap-2 text-meta text-muted-foreground`,children:[e===void 0?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Pl,{"data-slot":`sidebar-health-dot`,tone:e===null?`neutral`:e===`healthy`?`success`:`pending`,pulse:e===null}),e===`attention`&&u?(0,Z.jsx)(el,{label:u,side:`top`,children:h}):h]}),(0,Z.jsxs)(`div`,{className:`ml-auto flex min-w-0 items-center gap-1`,children:[r?(0,Z.jsx)(Pm,{version:r,latestVersion:i,brandName:n,onOpen:()=>f(!0)}):null,(0,Z.jsx)(Fm,{health:e,starCount:a,hostWidget:o,toolsMenu:s,whatsNew:c,whatsNewUnseen:l,theme:p,setTheme:m})]})]}),d?(0,Z.jsx)(dp,{open:d,onOpenChange:f,brandName:n}):null]})}function Pm({version:e,latestVersion:t,brandName:n,onOpen:r}){let i=!!(t&&t!==e);return(0,Z.jsx)(el,{side:`top`,label:i?`Update available: v${t} (running v${e})`:`${n} v${e}`,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`version-chip`,"data-update-available":i?`true`:void 0,"aria-label":i?`${n} v${e}, update to v${t} available — open updater`:`${n} v${e} — open updater`,onClick:r,className:H(`flex h-6 min-w-0 items-center gap-1.5 rounded-md px-1.5 text-micro transition-colors hover:bg-muted hover:text-foreground`,i?`border border-border bg-card`:`text-soft-foreground`,Mm),children:[i?(0,Z.jsx)(Pl,{tone:`pending`,pulse:!0,className:`size-[5px]`}):null,(0,Z.jsxs)(`span`,{className:`min-w-0 truncate font-mono`,children:[`v`,e]}),i?(0,Z.jsx)(`span`,{"data-slot":`version-chip-update`,className:`shrink-0 font-medium text-pending-strong`,children:`Update`}):null]})})}function Fm({health:e,starCount:t,hostWidget:n,toolsMenu:r,whatsNew:i,whatsNewUnseen:a,theme:o,setTheme:s}){return(0,Z.jsxs)(lo,{children:[(0,Z.jsx)(oo,{asChild:!0,children:(0,Z.jsxs)(q,{variant:`ghost`,size:`icon-xs`,"data-slot":`sidebar-more`,"aria-label":`More`,title:`More`,className:`relative shrink-0`,children:[(0,Z.jsx)(yo,{"aria-hidden":`true`}),a?(0,Z.jsx)(`span`,{"data-slot":`sidebar-more-update`,"data-reason":`whats-new`,"aria-hidden":`true`,className:`absolute top-0.5 right-0.5 size-1.5 rounded-full bg-violet`}):null]})}),(0,Z.jsxs)(so,{side:`top`,align:`end`,"data-slot":`sidebar-more-content`,className:`w-64 max-w-[calc(100vw-2rem)]`,children:[n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($a,{className:`eyebrow px-2 pt-1.5 pb-1 text-meta font-semibold text-soft-foreground`,children:`This machine`}),(0,Z.jsx)(`div`,{"data-slot":`sidebar-more-host`,className:`px-1 pb-1`,children:n}),(0,Z.jsx)(eo,{})]}):null,r?(0,Z.jsxs)(uo,{children:[(0,Z.jsxs)(no,{"data-slot":`tools-menu`,className:`text-ui`,children:[(0,Z.jsx)(Do,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:`Tools`}),e===`attention`?(0,Z.jsx)(Pl,{"data-slot":`tools-menu-attention`,tone:`pending`,className:`size-1.5`,"aria-hidden":`true`}):null]}),(0,Z.jsx)(to,{"data-slot":`tools-menu-content`,className:`w-[240px]`,children:r})]}):null,i,t===null?null:(0,Z.jsx)(ro,{asChild:!0,className:`text-ui`,children:(0,Z.jsxs)(`a`,{"data-slot":`star-chip`,href:Zd,target:`_blank`,rel:`noopener noreferrer`,title:`Star cezar on GitHub — ${t.toLocaleString()} stars`,"aria-label":`Star cezar on GitHub — ${t.toLocaleString()} stars`,children:[(0,Z.jsx)(Fd,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Star cezar on GitHub`}),(0,Z.jsx)(`span`,{className:`shrink-0 text-label text-soft-foreground tabular-nums`,children:$d(t)})]})}),(0,Z.jsx)(eo,{}),(0,Z.jsx)($a,{className:`eyebrow px-2 pt-1.5 pb-1 text-meta font-semibold text-soft-foreground`,children:`Theme`}),(0,Z.jsx)(ao,{value:o,onValueChange:e=>s(e),"data-slot":`theme-toggle`,"data-theme-pref":o,className:`grid grid-cols-3 gap-1 px-1 pb-1`,children:jm.map(({value:e,label:t,Icon:n})=>(0,Z.jsxs)(co,{value:e,"data-theme":e,className:H(`flex-col justify-center gap-1 rounded-md px-1 py-2 text-micro text-muted-foreground [&>span:first-child]:hidden`,`data-[state=checked]:bg-muted data-[state=checked]:text-foreground data-[state=checked]:ring-1 data-[state=checked]:ring-border`),children:[(0,Z.jsx)(n,{className:`size-4`,"aria-hidden":`true`}),t]},e))})]})]})}var Im=`cez-sidebar-width`;function Lm(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(420,Math.max(264,Math.round(t))):264}function Rm(){try{let e=localStorage.getItem(Im);return e===null?264:Lm(e)}catch{return 264}}function zm(e){try{localStorage.setItem(Im,String(Lm(e)))}catch{}}function Bm(){let[e]=X.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 Vm=new Set;function Hm(e){Vm.add(e);let t=t=>{t.key!==null&&t.key!==`cez-sidebar-width`||(Um=null,e())};return window.addEventListener(`storage`,t),()=>{Vm.delete(e),window.removeEventListener(`storage`,t)}}var Um=null;function Wm(){return Um??Rm()}function Gm(e){let t=Lm(e);zm(t),Um=Rm()===t?null:t;for(let e of Vm)e()}function Km(){return[X.useSyncExternalStore(Hm,Wm,Wm),Gm]}var qm=`cez-sidebar-folded`,Jm=new Set,Ym=null;function Xm(){try{return localStorage.getItem(qm)===`1`}catch{return!1}}function Zm(){return Ym??Xm()}function Qm(e){Jm.add(e);let t=t=>{t.key!==null&&t.key!==`cez-sidebar-folded`||(Ym=null,e())};return window.addEventListener(`storage`,t),()=>{Jm.delete(e),window.removeEventListener(`storage`,t)}}function $m(e){try{e?localStorage.setItem(qm,`1`):localStorage.removeItem(qm)}catch{}Ym=Xm()===e?null:e;for(let e of Jm)e()}function eh(){return[X.useSyncExternalStore(Qm,Zm,Zm),$m]}var th=Os()?`Meta+B`:`Control+B`;function nh({onFold:e,ref:t}){return(0,Z.jsx)(el,{label:`Hide sidebar (${Ds(`Mod+B`)})`,children:(0,Z.jsx)(q,{ref:t,variant:`ghost`,size:`icon-sm`,"data-slot":`sidebar-fold`,"aria-label":`Hide sidebar`,"aria-keyshortcuts":th,onClick:e,className:`-mr-1.5 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,Z.jsx)(Dd,{className:`size-4`,"aria-hidden":`true`})})})}function rh({slot:e=`sidebar`,width:t,onWidthChange:n,titlebarInset:r=!1,children:i}){return(0,Z.jsxs)(`aside`,{"data-slot":e,style:{width:t},className:H(`relative hidden shrink-0 flex-col border-r border-border bg-sidebar md:flex`,r&&`pt-[28px]`),children:[i,(0,Z.jsx)(ih,{width:t,onWidthChange:n})]})}function ih({width:e,onWidthChange:t}){let n=X.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(Lm(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,Z.jsx)(el,{label:`Drag to resize — double-click to reset`,side:`right`,children:(0,Z.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(Lm(r)))},onDoubleClick:()=>t(264),"aria-description":`Drag to resize, 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`})})}function ah({slot:e,title:t,children:n}){return(0,Z.jsxs)(Si,{side:`left`,"data-slot":e,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,Z.jsx)(xi,{className:`sr-only`,children:t}),n((0,Z.jsx)(bi,{asChild:!0,children:(0,Z.jsx)(q,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`-mr-2 size-11`,children:(0,Z.jsx)(us,{className:`size-[17px]`,"aria-hidden":`true`})})}))]})}var oh=[],sh=new Set;function ch(){for(let e of sh)e()}function lh(e){return sh.add(e),()=>{sh.delete(e)}}function uh(){return oh.length>0}function dh(e){let t={onExit:e};return oh.push(t),ch(),()=>{let e=oh.indexOf(t);e<0||(oh.splice(e,1),ch())}}function fh(){for(let e of[...oh])e.onExit()}function ph(){return(0,X.useSyncExternalStore)(lh,uh,uh)}var mh=`(min-width: 768px)`,hh=X.createContext(void 0),gh=X.createContext(!1);function _h(){return X.useContext(gh)}var vh=X.memo(function({children:e,mainRef:t}){return(0,Z.jsx)(`main`,{ref:t,"data-slot":`main`,className:`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,children:e})});function yh(){return X.useContext(hh)}var bh=new Set;function xh(e){return Gr({path:`/tasks/:id`,end:!0},Ur(e))!==null}var Sh=X.memo(function({children:e,repo:t=null,inboxCount:n=null,unreadCount:r=null,nowCount:i=null,runningCount:a=null,healthStatus:o=null,skillsUpdateAvailable:s=!1,newNavItems:c=bh,version:l=null,latestVersion:u=null,starCount:d=null,currentTasks:f,switcher:p,hostWidget:m,whatsNew:h,whatsNewUnseen:g=!1,healthReason:_=null,linkProjectId:v=null,offerAddProject:y=!1,toolsMenu:b,forgeAvailable:x=!0,inboxAvailable:S=!0,automationsAvailable:C=!0,terminalAvailable:w=!1,tracker:T,singleProject:E=!1,banner:D,footerBanner:O,brandName:k=`cezar`,brandLogoUrl:A=null,managersAvailable:j=!1,managerAttention:M=null,managerTo:N=`/manager`,managerSidebar:P,managerRail:ee,managerHeads:te,projectSwitcher:ne=null}){let{pathname:re,search:ie}=Kr(),F=Ur(re),ae=re===`/tasks`,oe=ae?null:Qf(F),se=ae?null:$f(F),ce=se?.to===`/tracker`&&T?{...se,label:Bd[T].label}:se,le=_c(re),I=j&&Ps(re),ue=Gr({path:`/tasks/:id/*`,end:!0},F)!==null,[L,de]=X.useState(!1),fe=X.useCallback(()=>de(!1),[]),pe=X.useCallback(()=>de(!0),[]),[me]=X.useState(jc),he=me&&j&&!le&&!ue,ge=X.useRef(null),_e=xh(re),[ve,ye]=Km();X.useEffect(()=>{!I&&!le&&Kd(`${re}${ie}`)},[I,le,re,ie]),X.useLayoutEffect(()=>{if(_e)return;let e=ge.current;e&&(e.scrollTop=0)},[re,_e]),X.useEffect(()=>{de(!1)},[re]),X.useEffect(()=>{let e=window.matchMedia?.(mh);if(!e)return;e.matches&&de(!1);let t=e=>{e.matches&&de(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let be={activeTo:oe,globalTasks:ae,items:X.useMemo(()=>Xf({forge:x,inbox:S,automations:C,terminal:w,tracker:T}),[x,S,C,w,T]),repo:t,inboxCount:S?n:null,unreadCount:r,nowCount:i,runningCount:a,healthStatus:o,skillsUpdateAvailable:s,newNavItems:c,version:l,latestVersion:u,starCount:d,currentTasks:f,switcher:p,hostWidget:m,whatsNew:h,whatsNewUnseen:g,healthReason:_,offerAddProject:y&&!E,toolsMenu:b,singleProject:E,brandName:k,brandLogoUrl:A,managersAvailable:j,managerMode:I,managerAttention:M,managerTo:N,projectsTo:I?kh(qd(),ne,t?.name??k).to:`${re}${ie}`,managerSwitchTo:I?`${re}${ie}`:N,managerSidebar:P,managerRail:ee},xe=Bm(),Se=ph(),[Ce]=eh(),we=!le&&(Se||Ce),Te=jr(re)===null?v:null;return(0,Z.jsxs)(`div`,{"data-slot":`app-shell`,"data-desktop":xe??void 0,"data-chromeless":le?``:void 0,style:he?{"--phone-bar":`3.5rem`}: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:[xe===`macos`?(0,Z.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:l&&u&&u!==l?(0,Z.jsx)(Ch,{latestVersion:u,brandName:k}):null}):null,(0,Z.jsx)(zr,{projectId:Te,children:le?null:Se?(0,Z.jsx)(Eh,{...be,desktop:xe}):(0,Z.jsx)(Th,{...be,width:ve,onWidthChange:ye,desktop:xe})}),(0,Z.jsxs)(`div`,{"data-slot":`main-column`,className:H(`relative grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,xe===`macos`&&`pt-[28px]`),children:[le?null:(0,Z.jsxs)(wi,{open:L,onOpenChange:de,children:[(0,Z.jsx)(Rh,{title:I?`Manager`:ae?`All tasks`:ce?.label??k,attention:j&&!I?M:null}),(0,Z.jsx)(zr,{projectId:Te,children:(0,Z.jsx)(Ah,{...be,onNavigate:fe})})]}),we&&!I?(0,Z.jsx)(Oh,{switcher:ne,fallbackName:t?.name??k,activeTo:oe}):null,D?(0,Z.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:D}):null,(0,Z.jsx)(gh.Provider,{value:I,children:(0,Z.jsx)(vh,{mainRef:ge,children:e})}),j&&!I?te:null,(0,Z.jsxs)(`div`,{"data-slot":`composer`,className:`row-start-4 pb-[env(safe-area-inset-bottom)]`,children:[O,he?(0,Z.jsx)(np,{menuOpen:L,onMore:pe,manager:I,attention:M,managerTo:N}):null]})]})]})});function Ch({latestVersion:e,brandName:t}){let[n,r]=X.useState(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.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-meta font-semibold text-foreground transition-colors hover:bg-primary/30`,children:[(0,Z.jsx)(Pl,{tone:`pending`,pulse:!0,className:`size-[5px] shrink-0`}),`Update `,t,(0,Z.jsxs)(`span`,{className:`font-mono font-medium text-muted-foreground`,children:[`v`,e]})]}),n?(0,Z.jsx)(dp,{open:n,onOpenChange:r,autoApply:e,brandName:t}):null]})}function wh(e,t){return{managerMode:e.managerMode,projectsTo:e.projectsTo,managerTo:e.managerSwitchTo,projectsAttention:!!e.nowCount,managerAttention:e.managerAttention,onNavigate:t}}var Th=X.memo(function({width:e,onWidthChange:t,desktop:n=null,...r}){let[i,a]=eh(),[o,s]=X.useState(!1),c=X.useRef(null);X.useEffect(()=>{o&&!i&&c.current?.focus()},[o,i]);let l=e=>{s(!0),a(e)};return ys(`b`,()=>{if(fs())return;let e=document.activeElement;s(!e||e===document.body||e.closest(`[data-slot="sidebar"], [data-slot="sidebar-rail"]`)!==null),a(!i)},{inEditable:!0}),i?(0,Z.jsx)(Dh,{...r,slot:`sidebar-rail`,onExpand:()=>l(!1),expandTitle:`Show sidebar (${Ds(`Mod+B`)})`,expandShortcut:th,autoFocus:o,desktop:n}):(0,Z.jsx)(rh,{width:e,onWidthChange:t,titlebarInset:n===`macos`,children:(0,Z.jsx)(jh,{...r,compactHeader:n===`macos`,headerAction:(0,Z.jsx)(nh,{ref:c,onFold:()=>l(!0)})})})});function Eh({desktop:e,...t}){return ys(`b`,()=>{fs()||fh()},{inEditable:!0}),(0,Z.jsx)(Dh,{...t,slot:`focus-sidebar-rail`,onExpand:fh,expandTitle:`Show sidebar (${Ds(`Mod+B`)}, turns Focus off)`,expandShortcut:th,desktop:e})}function Dh({slot:e,onExpand:t,expandTitle:n,expandShortcut:r,autoFocus:i=!1,desktop:a,...o}){let{items:s,activeTo:c,inboxCount:l,unreadCount:u,nowCount:d,skillsUpdateAvailable:f,newNavItems:p,brandName:m,brandLogoUrl:h,managersAvailable:g,managerMode:_}=o;return(0,Z.jsxs)(`aside`,{"data-slot":e,className:H(`hidden w-12 shrink-0 flex-col items-center gap-1 border-r border-border bg-sidebar pt-[max(env(safe-area-inset-top),0.75rem)] pb-[max(env(safe-area-inset-bottom),0.5rem)] md:flex`,a===`macos`&&`pt-[36px]`),children:[(0,Z.jsx)(`span`,{"data-slot":`rail-brand`,role:`img`,"aria-label":m,title:m,className:`flex h-8 items-center text-foreground`,children:h?(0,Z.jsx)(`img`,{src:h,alt:``,className:`size-[22px] object-contain`}):(0,Z.jsx)(Rf,{height:22})}),g?(0,Z.jsx)(Jf,{...wh(o)}):null,_?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{asChild:!0,variant:`contrast`,size:`icon-sm`,className:`mt-1`,children:(0,Z.jsx)(U,{to:`/manager/new`,"data-slot":`rail-new-manager`,"aria-label":`New manager`,title:`New manager`,children:(0,Z.jsx)(ts,{className:`size-4`,"aria-hidden":`true`})})}),o.managerRail]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{asChild:!0,variant:`contrast`,size:`icon-sm`,className:`mt-1`,children:(0,Z.jsx)(G,{to:`/new`,"data-slot":`rail-new-task`,"aria-label":`New task`,title:`New task (C)`,children:(0,Z.jsx)(ts,{className:`size-4`,"aria-hidden":`true`})})}),(0,Z.jsxs)(`nav`,{"aria-label":`Main`,className:`flex min-h-0 flex-col items-center gap-1 overflow-y-auto pt-2`,children:[s.filter(e=>e.group!==`workspace`).map(e=>{let t=e.icon,n=e.to===c,r=e.badge===`tasks-unread`&&!!u||e.badge===`needs-you`&&!!d||e.badge===`skills-update`&&f||p.has(e.to);return(0,Z.jsxs)(G,{to:e.to,"aria-label":e.label,title:e.label,"aria-current":n?`page`:void 0,className:H(`relative flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,n&&`bg-muted text-foreground`),children:[(0,Z.jsx)(t,{className:`size-4`,"aria-hidden":`true`}),r?(0,Z.jsx)(`span`,{"data-slot":`rail-marker`,"aria-hidden":`true`,className:`absolute top-1 right-1 size-1.5 rounded-full bg-violet`}):null]},e.to)}),s.filter(e=>e.group===`workspace`).map(e=>{let t=e.icon,n=e.to===c,r=e.badge===`inbox-count`&&!!l||p.has(e.to);return(0,Z.jsxs)(G,{to:e.to,"aria-label":e.label,title:e.label,"aria-current":n?`page`:void 0,className:H(`relative flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,n&&`bg-muted text-foreground`),children:[(0,Z.jsx)(t,{className:`size-4`,"aria-hidden":`true`}),r?(0,Z.jsx)(`span`,{"data-slot":`rail-marker`,"aria-hidden":`true`,className:`absolute top-1 right-1 size-1.5 rounded-full bg-violet`}):null]},e.to)})]})]}),(0,Z.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":e===`sidebar-rail`?`sidebar-unfold`:void 0,"data-action":e===`focus-sidebar-rail`?`expand-sidebar`:void 0,"aria-label":`Show sidebar`,"aria-keyshortcuts":r,title:n,autoFocus:i,onClick:t,className:`mt-auto shrink-0 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,Z.jsx)(Od,{className:`size-4`,"aria-hidden":`true`})})]})}function Oh({switcher:e,fallbackName:t,activeTo:n}){let r=e?.activeName??t,i=e?.projects??[];return(0,Z.jsx)(`header`,{"data-slot":`project-header`,className:`row-start-1 hidden h-11 shrink-0 items-center border-b border-border bg-card px-3 md:flex`,children:i.length===0?(0,Z.jsx)(`span`,{"data-slot":`project-header-name`,className:`truncate px-2 text-body font-semibold`,children:r}):(0,Z.jsxs)(lo,{children:[(0,Z.jsx)(oo,{asChild:!0,children:(0,Z.jsxs)(q,{variant:`ghost`,size:`sm`,"data-slot":`project-switcher`,"aria-label":`Project: ${r} — switch project`,className:`min-w-0 gap-1.5 px-2 text-body font-semibold`,children:[(0,Z.jsx)(`span`,{className:`truncate`,children:r}),(0,Z.jsx)(qa,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`})]})}),(0,Z.jsxs)(so,{align:`start`,className:`w-60`,children:[(0,Z.jsx)($a,{className:`text-xs text-soft-foreground`,children:`Projects`}),(0,Z.jsx)(eo,{}),i.map(t=>{let r=t.id===e?.activeId;return(0,Z.jsx)(ro,{asChild:!0,children:(0,Z.jsxs)(U,{to:`/p/${encodeURIComponent(t.id)}${n&&n!==`/`?n:`/`}`,"data-slot":`project-switcher-item`,"aria-current":r?`true`:void 0,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.name}),r?(0,Z.jsx)(Wa,{className:`size-4`,"aria-hidden":`true`}):null]})},t.id)})]})]})})}function kh(e,t,n){let r=t?.projects??[],i=t?.activeName??n;if(e!==null){let t=jr(e),n=t===null?void 0:r.find(e=>e.id===t);if(t===null||n||r.length===0)return{to:e,name:n?.name??i}}let a=t?.activeId??null;return{to:a===null?`/`:`/p/${encodeURIComponent(a)}/`,name:i}}var Ah=X.memo(function({onNavigate:e,...t}){return(0,Z.jsx)(ah,{slot:`mobile-nav-drawer`,title:`Navigation`,children:n=>(0,Z.jsx)(jh,{...t,onNavigate:e,headerAction:n})})});function jh({onNavigate:e,headerAction:t,compactHeader:n=!1,...r}){let{activeTo:i,globalTasks:a,items:o,repo:s,inboxCount:c,unreadCount:l,nowCount:u,runningCount:d,healthStatus:f,skillsUpdateAvailable:p,newNavItems:m,version:h,latestVersion:g,starCount:_,currentTasks:v,switcher:y,hostWidget:b,whatsNew:x,whatsNewUnseen:S,healthReason:C,offerAddProject:w,toolsMenu:T,brandName:E,brandLogoUrl:D,managersAvailable:O,managerMode:k,managerSidebar:A}=r,j=o.filter(e=>e.group!==`workspace`),M=o.filter(e=>e.group===`workspace`);return(0,Z.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,Z.jsxs)(`div`,{className:H(`flex items-center gap-[9px] px-3.5 pb-2`,n?`pt-1.5`:`pt-3.5`),children:[(0,Z.jsx)(zf,{name:E,logoUrl:D}),t?(0,Z.jsx)(`div`,{className:`ml-auto shrink-0`,children:t}):null]}),O?(0,Z.jsx)(Gf,{...wh(r,e)}):null,k?(0,Z.jsx)(hh.Provider,{value:e,children:A}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(hh.Provider,{value:e,children:y}),!y&&s?(0,Z.jsxs)(`div`,{"data-slot":`repo-chip`,className:`mx-3 mb-2 flex h-9 items-center gap-2 rounded-md border border-border bg-card px-2.5 text-ui font-semibold`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:s.name}),(0,Z.jsx)(`span`,{className:`ml-auto min-w-0 truncate font-mono text-micro font-medium text-soft-foreground`,children:s.branch})]}):null,!y&&w?(0,Z.jsx)(`div`,{"data-slot":`sidebar-add-project`,className:`mx-3 mb-2`,children:(0,Z.jsx)(Pf,{className:`w-full justify-start`})}):null,(0,Z.jsx)(`div`,{className:`px-3 pb-2`,children:(0,Z.jsx)(q,{asChild:!0,variant:`primary`,className:`relative w-full justify-center`,children:(0,Z.jsxs)(G,{to:`/new`,onClick:e,children:[(0,Z.jsx)(ts,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,Z.jsx)(`kbd`,{"aria-hidden":`true`,className:`absolute right-2.5 rounded-[5px] border border-b-2 border-primary-foreground/25 bg-transparent px-[5px] py-px font-mono text-micro font-medium text-primary-foreground/70`,children:`C`})]})})}),(0,Z.jsxs)(`div`,{"data-slot":`sidebar-scroll`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pb-2`,children:[(0,Z.jsx)(`nav`,{"aria-label":`Main`,className:`px-2.5`,children:j.map(t=>(0,Z.jsx)(Fh,{item:t,isActive:t.to===i,onNavigate:e,count:t.badge===`needs-you`?u:t.badge===`tasks-unread`?l:null,countSlot:t.badge===`needs-you`?`nav-needs-you-badge`:`nav-unread-badge`,countTitle:Mh(t,t.badge===`needs-you`?u:l),marker:t.badge===`skills-update`&&p?`Skills update available`:m.has(t.to)?`New`:null,markerSlot:t.badge===`skills-update`&&p?`nav-update-marker`:`nav-new-marker`},t.to))}),(0,Z.jsx)(`div`,{"data-slot":`current-tasks-slot`,className:`px-2.5`,children:(0,Z.jsx)(hh.Provider,{value:e,children:v})}),(0,Z.jsxs)(`nav`,{"aria-label":`Workspace`,className:`px-2.5`,children:[(0,Z.jsx)(`h2`,{className:`px-3 pt-3 pb-1 eyebrow text-soft-foreground`,children:`Workspace`}),(0,Z.jsx)(Ih,{onNavigate:e}),(0,Z.jsx)(Lh,{active:a,onNavigate:e}),M.map(t=>(0,Z.jsx)(Fh,{item:t,isActive:t.to===i,onNavigate:e,count:t.badge===`inbox-count`?c:null,countSlot:`nav-badge`,marker:m.has(t.to)?`New`:null,markerSlot:`nav-new-marker`},t.to))]})]})]}),(0,Z.jsx)(Nm,{health:f,runningCount:d,brandName:E,version:h,latestVersion:g,starCount:_,hostWidget:b,toolsMenu:T,whatsNew:x,whatsNewUnseen:S,healthReason:C})]})}function Mh(e,t){if(!t)return;let n=t===1;if(e.badge===`tasks-unread`)return`${t} unread finished ${n?`task`:`tasks`}`;if(e.badge===`needs-you`)return`${t} ${n?`task needs`:`tasks need`} you`}var Nh=`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-ui font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground md:h-[34px]`,Ph=`ml-auto rounded-full bg-violet px-1.5 py-px text-micro font-semibold text-violet-foreground tabular-nums`;function Fh({item:e,isActive:t,onNavigate:n,count:r,countSlot:i,countTitle:a,marker:o,markerSlot:s}){let c=e.icon;return(0,Z.jsxs)(G,{to:e.to,onClick:n,"aria-current":t?`page`:void 0,className:H(Nh,t&&`bg-muted font-semibold text-foreground`),children:[(0,Z.jsx)(c,{className:`size-4 shrink-0`,"aria-hidden":`true`}),e.label,r?(0,Z.jsx)(`span`,{"data-slot":i,title:a,className:Ph,children:r}):o?(0,Z.jsxs)(`span`,{"data-slot":s,className:`ml-auto flex items-center`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:o})]}):null]})}function Ih({onNavigate:e}){return(0,Z.jsxs)(Vr,{to:`/dashboard`,"data-slot":`dashboard-link`,onClick:e,className:({isActive:e})=>H(Nh,e&&`bg-muted font-semibold text-foreground`),children:[(0,Z.jsx)(fi,{className:`size-4 shrink-0`,"aria-hidden":`true`}),`Dashboard`]})}function Lh({active:e,onNavigate:t}){return(0,Z.jsxs)(U,{to:`/tasks`,"data-slot":`all-tasks-link`,onClick:t,"aria-current":e?`page`:void 0,className:H(Nh,e&&`bg-muted font-semibold text-foreground`),children:[(0,Z.jsx)(ja,{className:`size-4 shrink-0`,"aria-hidden":`true`}),`All tasks`]})}function Rh({title:e,attention:t=null}){return(0,Z.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,Z.jsxs)(`div`,{className:`flex h-11 items-center gap-2.5 px-3`,children:[(0,Z.jsx)(Ci,{asChild:!0,children:(0,Z.jsxs)(q,{variant:`ghost`,size:`icon`,"aria-label":`Open menu`,className:`relative -ml-1.5 size-11`,children:[(0,Z.jsx)(yd,{className:`size-[17px]`,"aria-hidden":`true`}),t?(0,Z.jsxs)(`span`,{"data-slot":`mobile-manager-attention`,className:`absolute top-2.5 right-2.5 flex`,children:[(0,Z.jsx)(`span`,{className:H(`size-1.5 rounded-full`,Is[t]),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t===`needs-you`?`A manager needs you`:`A manager has news`})]}):null]})}),(0,Z.jsx)(`span`,{className:`truncate text-body font-semibold`,children:e}),(0,Z.jsx)(`div`,{"data-slot":`mobile-status`,className:`ml-auto flex items-center gap-2`})]})})}function zh(e,t){return e.startsWith(`@`)?{mode:`tasks`,query:e.slice(1)}:e.startsWith(`>`)?{mode:t?`commands`:`tasks`,query:e.slice(1)}:e.startsWith(`#`)?{mode:t?`files`:`tasks`,query:e.slice(1)}:{mode:t?`all`:`tasks`,query:e}}var Bh=e=>e.replace(/^[@>#]/,``),Vh=(e,t,n)=>im(e,Bh(t),n);function Hh(e){return(Gr(`/p/:projectId/tasks/:id/*`,e)??Gr(`/tasks/:id/*`,e))?.params.id}function Uh(e,t,n=50){let r=t.trim();if(r===``)return e.slice(0,n);let i=[];for(let t of e){let e=t.slice(t.lastIndexOf(`/`)+1),n=im(t,r)+im(e,r);n>0&&i.push({path:t,score:n})}return i.sort((e,t)=>t.score-e.score||e.path.length-t.path.length),i.slice(0,n).map(e=>e.path)}var Wh=6,Gh=`task-palette-task`;function Kh(){let e=Kr(),t=Hh(e.pathname),n=Lr(),r=Jh(),[i,a]=X.useState(!1),[o,s]=X.useState(null),[c,l]=X.useState(``),[u,d]=X.useState(``),[f,p]=X.useState(!1),[m,h]=X.useState(null),[g,_]=X.useState(null),[v,y]=X.useState(null),b=X.useRef(null),x=X.useRef(null),S=X.useRef(!1),C=X.useRef(!1),w=X.useRef(null),T=Vi();Em(`task`,i,X.useCallback(()=>a(!1),[]));let E=X.useRef(new Set),D=X.useRef(!1),O=X.useRef(i);O.current=i;let k=X.useCallback((e,t,{reopen:n=!1}={})=>{!O.current&&!n&&bl(e?`task`:`task_switch`),D.current=!1,s(e),l(t),d(``),p(!1),y(null),h(null),S.current=!1,C.current=!1,a(!0)},[]),A=()=>[...x.current?.querySelectorAll(`[cmdk-item][data-slot="${Gh}"]`)??[]];ys(`p`,()=>{if(v)return;if(!i){t?k(t,``):k(null,`@`);return}if(p(!1),(f||!c.startsWith(`@`))&&o){l(`@`),D.current=!0,h({step:1});return}let e=A(),n=e.findIndex(e=>e.dataset.value===u);D.current=!0,h({step:n+1>=e.length?0:n+1})},{inEditable:!0}),X.useEffect(()=>{if(!m)return;let e=setTimeout(()=>{let e=A(),t=e[Math.min(m.step,e.length-1)];t?.dataset.value&&d(t.dataset.value),h(null)},0);return()=>clearTimeout(e)},[m,c]);let j=X.useCallback(e=>{if(e.projectId===null||e.projectId===r){k(e.runId,``);return}w.current=e.runId,a(!1),n(Cm({id:e.runId,projectId:e.projectId}))},[r,n,k]);X.useEffect(()=>{let e=e=>{let n=e.detail;n?j(n):t?k(t,``):k(null,`@`)};return window.addEventListener(Zp,e),()=>window.removeEventListener(Zp,e)},[j,t,k]),X.useEffect(()=>{i||s(null)},[e.pathname]),X.useEffect(()=>{!i&&!C.current&&s(null)},[i]),X.useEffect(()=>{w.current&&w.current===t&&(w.current=null,k(t,``,{reopen:!0}))},[t,k]);let M=X.useCallback(()=>{C.current&&(C.current=!1,re.current.open||s(null))},[]),N=(e,t=!1)=>{let n=b.current?.build().find(t=>t.id===e);if(!n||n.unavailable)return;if(Dl(n.id,`palette`),n.id===`rename`){n.perform();return}S.current=!0,C.current=$h(n.id),a(!1);let r=t&&n.performBeside?n.performBeside:n.perform;if(eg(n.id))return r();setTimeout(r,0)},P=X.useCallback(e=>{S.current=!0,vl(D.current?`cycle`:`enter`),a(!1),n(Cm(e))},[n]),ee=X.useCallback(()=>{let e=b.current?.run;e&&(p(!0),l(Ge(e)),setTimeout(()=>x.current?.querySelector(`[cmdk-input]`)?.select(),0))},[]),te=()=>{let e=c.trim();e&&b.current&&b.current.rename(e),S.current=!0,a(!1)},ne=e=>{T.ready&&y({id:e,label:ng(e,b.current?.commands)})},re=X.useRef({open:i,recording:v,pageTaskId:t,byChord:new Map,show:k,beginRename:ee});re.current={open:i,recording:v,pageTaskId:t,byChord:new Map([...T.bindings].map(([e,t])=>[t,e])),show:k,beginRename:ee},X.useEffect(()=>{let e=e=>{if(e.repeat||e.defaultPrevented)return;let t=re.current;if(t.open||t.recording||!t.pageTaskId)return;let n=_s(e),r=n?t.byChord.get(n):void 0;if(!n||!r||!rg(e.target,n)||fs())return;let i=b.current;if(!i||i.run.id!==t.pageTaskId)return;let a=i.build().find(e=>e.id===r);if(a){if(e.preventDefault(),a.unavailable)return void Y(a.unavailable);if(Dl(a.id,`shortcut`),a.id===`rename`){t.show(t.pageTaskId,``,{reopen:!0}),setTimeout(t.beginRename,0);return}a.perform(`shortcut`)}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let ie=e=>{if(v){if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`)return y(null);if(!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&(e.key===`Backspace`||e.key===`Delete`))return T.assign(v.id,null),Y(`Removed the shortcut for ${v.label}`),y(null);let t=_s(e.nativeEvent);if(!t){let t=Ss(e.nativeEvent);t&&y({...v,problem:t});return}let n=gs(t);if(n)return y({...v,problem:`${Ds(t)} — ${n}`});let r=[...T.bindings].find(([e,n])=>n===t&&e!==v.id)?.[0];return T.assign(v.id,t),Y(`${Ds(t)} → ${v.label}${r?` (was ${ng(r,b.current?.commands)})`:``}`),y(null)}if(e.nativeEvent.isComposing||e.keyCode===229)return;if(f){e.key===`Enter`&&(e.preventDefault(),te());return}let n=x.current?.querySelector(`[cmdk-item][data-selected="true"]`);if(e.key===`Tab`&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey){let t=n?.dataset.slot===Gh?n.dataset.runId:void 0;if(!t)return;e.preventDefault(),vl(`tab`),j({runId:t,projectId:n?.dataset.projectId??null});return}if(e.key===`Enter`&&e.altKey&&n?.dataset.commandId){e.preventDefault(),N(n.dataset.commandId,!0);return}if(e.key===`Enter`&&e.shiftKey&&n?.dataset.commandId&&tg(n.dataset.commandId)){e.preventDefault(),ne(n.dataset.commandId);return}e.key===`Backspace`&&c===``&&o!==null&&o!==t&&(e.preventDefault(),k(t??null,`@`))},{mode:F,query:ae}=f?{mode:`all`,query:``}:zh(c,o!==null);return X.useEffect(()=>{if(!(!i||f||v))for(let e of Ol(ae,F===`all`?void 0:F))E.current.add(e)},[i,f,v,ae,F]),X.useEffect(()=>{i||E.current.size===0||(xl(E.current),E.current=new Set)},[i]),(0,Z.jsxs)(Z.Fragment,{children:[o??t?(0,Z.jsx)(sg,{runId:o??t,apiRef:b,onCommands:_,onRename:ee,onDialogDone:M,open:i},o??t):null,(0,Z.jsx)(Ul,{open:i,onOpenChange:e=>{e||Sl(F===`tasks`?`tasks`:F===`files`?`files`:`actions`),a(e)},title:`Task palette`,description:`Act on a task, switch tasks, or open one of its files`,showCloseButton:!1,filter:Vh,commandProps:{value:u,onValueChange:d,onKeyDown:ie,shouldFilter:!f&&!v&&F!==`files`},onOpenAutoFocus:e=>{let t=e.currentTarget?.querySelector(`[cmdk-input]`);t&&(e.preventDefault(),t.focus(),t.setSelectionRange(t.value.length,t.value.length))},onCloseAutoFocus:e=>{S.current&&e.preventDefault()},onEscapeKeyDown:e=>{if(v)return e.preventDefault(),y(null);f&&(e.preventDefault(),p(!1),l(``))},className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,Z.jsxs)(`div`,{ref:x,"data-slot":`task-palette`,"data-mode":v?`record`:f?`rename`:F,className:`contents`,children:[(0,Z.jsx)(zl,{placeholder:v?`Press a shortcut — ⌫ removes it, esc cancels`:qh(f?`rename`:F),value:c,onValueChange:l}),o&&!f&&F!==`tasks`?(0,Z.jsx)(Yh,{runId:o,picked:o!==t}):null,(0,Z.jsx)(Kl,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:v?(0,Z.jsx)(Vl,{heading:`Shortcut for ${v.label}`,children:(0,Z.jsxs)(Wl,{value:`record`,"data-slot":`task-palette-recorder`,onSelect:()=>{},children:[(0,Z.jsx)(md,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:v.problem??`Press the keys for this command…`}),T.bindings.get(v.id)?(0,Z.jsx)(Hl,{children:Ds(T.bindings.get(v.id))}):null]})}):f?(0,Z.jsx)(Vl,{heading:`Rename`,children:(0,Z.jsxs)(Wl,{value:`rename`,"data-slot":`task-palette-rename`,onSelect:te,children:[(0,Z.jsx)(vo,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:c.trim()?`Rename to “${c.trim()}”`:`Type the new name`}),(0,Z.jsx)(Hl,{children:`↵`})]})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Gl,{children:`Nothing matches.`}),F===`all`||F===`commands`?(0,Z.jsx)(Xh,{commands:g?.runId===o?g.commands:[],bindings:T.bindings,onPerform:N,onRecord:ne}):null,F===`files`&&o?(0,Z.jsx)(ag,{runId:o,query:ae,onPick:e=>{S.current=!0,a(!1);let t=oa(o);t?setTimeout(()=>t.openFile(e),0):(ca(o,e),n(`/tasks/${o}`))}}):null,F===`all`||F===`tasks`?(0,Z.jsx)(ig,{recentOnly:F===`all`,exclude:F===`all`?o:null,current:t,query:ae,onPick:P}):null]})}),(0,Z.jsx)(og,{mode:v?`record`:f?`rename`:F})]})})]})}function qh(e){switch(e){case`rename`:return`New name…`;case`tasks`:return`Switch to a task…`;case`files`:return`Open a file in this task…`;case`commands`:return`Run a command on this task…`;default:return`Act on this task — @ tasks · > commands · # files`}}function Jh(){let e=Nr(),t=i(),n=E(),r=t.data?.bootProject??n.data?.bootProject??null;return(e==="default"?null:e)??r}function Yh({runId:e,picked:t}){let n=He(e).data;if(!n)return null;let r=s(n);return(0,Z.jsxs)(`div`,{"data-slot":`task-palette-subject`,className:`flex min-w-0 items-center gap-2 border-b border-border px-3 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:`Task`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground`,children:Ge(n)}),(0,Z.jsx)(Jl,{className:`shrink-0`,dot:r.tone,pulse:r.pulse,children:r.label}),t?(0,Z.jsx)(`span`,{className:`shrink-0 text-soft-foreground`,children:`⌫ back to tasks`}):null]})}function Xh({commands:e,bindings:t,onPerform:n,onRecord:r}){return(0,Z.jsx)(Z.Fragment,{children:sa.map(i=>{let a=e.filter(e=>e.group===i.id&&!e.hidden);return a.length===0?null:(0,Z.jsx)(Vl,{heading:i.heading,children:a.map(e=>{let a=Zh(e,t);return(0,Z.jsxs)(Wl,{value:`${i.heading} ${e.label} ${e.id}`,keywords:e.keywords,disabled:e.unavailable!==void 0,"data-slot":`task-palette-command`,"data-command-id":e.id,"aria-checked":e.pressed,onSelect:()=>n(e.id),className:H(`group/command`,e.danger&&`data-[selected=true]:text-danger`),children:[e.icon,(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.unavailable?(0,Z.jsx)(`span`,{className:`shrink-0 truncate text-label text-muted-foreground`,children:e.unavailable}):e.pressed?(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-primary`,children:`on`}):null,tg(e.id)?(0,Z.jsx)(el,{label:`Set a shortcut (⇧↵)`,children:(0,Z.jsx)(`button`,{type:`button`,"data-slot":`task-palette-record`,"aria-label":`Set a shortcut for ${e.label}`,className:`hidden shrink-0 rounded p-0.5 text-soft-foreground group-hover/command:inline-flex hover:text-foreground`,onPointerDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),r(e.id)},children:(0,Z.jsx)(md,{"aria-hidden":`true`,className:`size-3.5!`})})}):null,a?(0,Z.jsx)(Hl,{children:a}):null]},e.id)})},i.id)})})}function Zh(e,t){let n=t.get(e.id);if(n)return Ds(n);let r=e.shortcut&&/^[1-9]$/.test(e.shortcut)?t.get(`tab:${e.shortcut}`):void 0;return r?Ds(r):e.shortcut}var Qh=new Set([`stop`,`delete`,`remove-worktree`]),$h=e=>Qh.has(e)||e.startsWith(`git:`),eg=e=>e.startsWith(`copy:`)||e===`open-pr`,tg=e=>!e.startsWith(`layout:`);function ng(e,t=[]){return ms.find(t=>t.id===e)?.label??t.find(t=>t.id===e)?.label??e}function rg(e,t){let n=t.split(`+`).includes(`Mod`);return e instanceof HTMLElement&&e.closest(`.xterm`)?n&&Os():ps(e)&&!(e instanceof HTMLElement&&e.closest(`[cmdk-input]`))?n:!0}function ig({recentOnly:e,exclude:t,current:n,query:r,onPick:i}){let{tasks:a,multiProject:o,projectNames:s,repoBases:c}=Sm(),l=fa(),u=X.useMemo(()=>{let n=_a(a,e=>e.id,l),r=new Set(l);return pm(e?n.filter(e=>r.has(e.id)&&e.id!==t).slice(0,Wh):n,s,c)},[a,l,e,t,s,c]),{shown:d,total:f}=X.useMemo(()=>mm(u,r),[u,r]),[p]=X.useState(Date.now);return d.length===0?null:(0,Z.jsx)(hm,{entries:d,children:(0,Z.jsxs)(Vl,{heading:(0,Z.jsx)(cm,{label:e?`Recent tasks`:`Tasks`}),className:gm,children:[d.map(e=>(0,Z.jsx)(Om,{entry:e,slot:Gh,showProject:o,now:p,onSelect:i,current:e.task.id===n},e.key)),(0,Z.jsx)(_m,{hidden:f-d.length})]})})}function ag({runId:e,query:t,onPick:n}){let r=we(e),i=X.useMemo(()=>Uh(r.data?.paths??[],t),[r.data,t]);return r.isPending?(0,Z.jsx)(cl,{label:`Loading files…`,className:`px-3 py-3`,children:(0,Z.jsx)(sl,{rows:4})}):r.isError?(0,Z.jsx)(`p`,{className:`px-3 py-6 text-center text-label text-muted-foreground`,children:r.error.message}):(0,Z.jsx)(Vl,{heading:`Files`,children:i.map(e=>{let t=e.lastIndexOf(`/`);return(0,Z.jsxs)(Wl,{value:`file ${e}`,"data-slot":`task-palette-file`,onSelect:()=>n(e),children:[(0,Z.jsx)(To,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.slice(t+1)}),t>0?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-label text-soft-foreground`,children:e.slice(0,t)}):null]},e)})})}function og({mode:e}){return(0,Z.jsx)(`div`,{"data-slot":`task-palette-footer`,className:`flex flex-wrap gap-x-3 gap-y-1 border-t border-border px-3 py-1.5 text-meta text-soft-foreground`,children:(e===`record`?[`⌫ remove`,`esc cancel`]:e===`rename`?[`↵ save`,`esc cancel`]:e===`tasks`?[`↵ open`,`tab act on it`,`${ws(`p`)} next`]:e===`files`?[`↵ open in Code`]:[`↵ run`,`⌥↵ open beside`,`⇧↵ set shortcut`,`@ tasks`,`> commands`,`# files`]).map(e=>(0,Z.jsx)(`span`,{children:e},e))})}var sg=X.memo(function(e){let t=He(e.runId).data;return t?(0,Z.jsx)(cg,{run:t,...e}):null});function cg(e){let t=Xi(e.run);return(0,Z.jsx)(Ca,{projectId:t.projectId,requests:t.requests,children:(0,Z.jsx)(lg,{...e})})}function lg({run:e,apiRef:t,onCommands:n,onRename:r,onDialogDone:i}){let a=oa(e.id),o=Hh(Kr().pathname)===e.id,s=aa(e,{surface:`palette`,onMarkedUnread:a?.markedUnread,onScreen:o}),c=Ji(e),l=Wi(e,na(e)),u=E().data?.capabilities?.terminal===!0,d=I(e.id),f=Lr(),p=Jh(),m=Bn(e),h=()=>Ui({run:e,canResume:l.canResumeHere,git:c.action,gitPending:c.pending,workspace:oa(e.id),terminalAvailable:u,openChoices:l.choices,prUrl:m?.url,taskUrl:`${window.location.origin}${p?Br(p,`/tasks/${e.id}`):`/tasks/${e.id}`}`},{markRead:()=>s.markRead.mutate(),markUnread:()=>s.markUnread.mutate(),pin:e=>s.pin.mutate(e===`shortcut`?`shortcut`:void 0),archive:e=>s.archive.mutate(e===`shortcut`?`shortcut`:void 0),rename:r,finish:()=>s.finish.mutate(),confirmStop:()=>s.setConfirming(`cancel`),confirmDelete:()=>s.setConfirming(`delete`),resumeInTerminal:()=>s.terminal.mutate(),removeWorktree:()=>s.setWorktreeRemovalOpen(!0),gitAction:c.onAction,openIn:l.open,navigate:e=>f(e),openUrl:e=>window.open(e,`_blank`,`noopener,noreferrer`),copy:(e,t)=>void Hi(e,`${t} copied`)}),g=h();t.current={run:e,commands:g,build:h,rename:e=>d.mutate({title:e},{onError:e=>Y(e.message,{tone:`danger`})})};let _=g.map(e=>`${e.id}|${e.label}|${e.unavailable??``}|${+!!e.pressed}|${e.shortcut??``}`).join(`
4
- `),v=X.useRef(g);v.current=g,X.useEffect(()=>n({runId:e.id,commands:v.current}),[_,n,e.id]);let y=s.confirming!==null||s.worktreeRemovalOpen||c.commitOpen||c.pending!==null||s.delete.isPending||s.cancel.isPending,b=X.useRef(y);return X.useEffect(()=>{b.current&&!y&&i(),b.current=y},[y,i]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($i,{run:e,confirming:s.confirming,lifecycleDelete:s.lifecycleDelete,onOpenChange:e=>!e&&s.setConfirming(null),onConfirm:e=>e===`delete`?s.delete.mutate():s.cancel.mutate()}),s.worktreeRemovalOpen?(0,Z.jsx)(ra,{run:e,pending:s.removeWorktree.isPending,onClose:()=>s.setWorktreeRemovalOpen(!1),onConfirm:()=>s.removeWorktree.mutate()},e.id):null,c.dialogs]})}var ug=X.createContext(null);function dg({children:e}){let[t,n]=X.useState(`active`),r=X.useMemo(()=>[t,n],[t]);return(0,Z.jsx)(ug.Provider,{value:r,children:e})}function fg(){let e=X.useContext(ug);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}var pg=1e4,mg=e=>Math.min(100,Math.max(0,e)),hg=e=>e===void 0||e<80?`ok`:e<90?`warn`:`critical`;function gg(){let e=Li(),t=Mi();return!e||t!==`local`?null:(0,Z.jsx)(_g,{})}function _g(){let e=Pi(),t=ji(),n=Ni(),[r,i]=(0,X.useState)(void 0),a=n!==void 0&&r===n;(0,X.useEffect)(()=>{if(n===void 0)return;let e=Math.max(0,n+pg-Date.now()),t=setTimeout(()=>i(n),e);return()=>clearTimeout(t)},[n]);let o=e===void 0?void 0:Ii(e),s=o?.cpuPct,c=a?`stale`:o!==void 0&&o.cpuLimited&&s===void 0?`—`:s===void 0?t.length===0?`sampling…`:`—`:`${Math.round(s)}%`,l=o===void 0||o.memUsedBytes===void 0||o.memTotalBytes<=0?void 0:o.memUsedBytes/o.memTotalBytes*100,u=a?`stale`:l===void 0?`—`:`${Math.round(l)}%`,d=o===void 0?`—`:Oi(o.memUsedBytes,o.memTotalBytes),f=o?.cpuLimited===!0?`${o.cpuLimitKind===`cpuset`?`cpuset `:``}${Di(o.cpuCores)}`:void 0,p=`CPU ${c}${f===void 0?``:` of ${f}`}, RAM ${u} (${d})`;return(0,Z.jsxs)(G,{to:`/settings/resources`,"data-slot":`host-usage-widget`,"data-state":a?`stale`:`live`,"data-frames":t.length,"aria-label":`Machine usage: ${p}. Open Settings, Behaviour.`,title:p,className:H(`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-meta leading-[14px] text-soft-foreground transition-colors hover:bg-muted hover:text-foreground`,a?`opacity-70`:null),children:[(0,Z.jsx)(vg,{label:`CPU`,pct:a?void 0:s,valueSlot:`host-usage-widget-cpu`,value:c}),(0,Z.jsx)(vg,{label:`RAM`,pct:a?void 0:l,valueSlot:`host-usage-widget-mem-pct`,value:u,gutter:!0})]})}function vg({label:e,pct:t,valueSlot:n,value:r,gutter:i}){let a=hg(t);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:H(`font-medium tracking-wide text-muted-foreground`,i===!0?`ml-1`:null),children:e}),(0,Z.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(mg(t)),className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,Z.jsx)(`span`,{className:H(`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:mg(t)}%`}})}),(0,Z.jsx)(`span`,{"data-slot":n,className:H(`text-right font-medium tabular-nums`,a===`critical`?`text-destructive`:a===`warn`?`text-pending-strong`:`text-foreground`),children:r})]})}function yg({status:e,pending:t,error:n,dismissals:r,onDismissAuthFailures:i}){if(t||!e)return null;let a;try{a=In(e)}catch{return null}let o=Pc(a,r);if(o.length>0)return(0,Z.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,Z.jsx)(Pl,{tone:`danger`}),(0,Z.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,o.map(({label:e})=>e).join(`, `),`.`]}),(0,Z.jsx)(G,{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,Z.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,Z.jsx)(us,{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,Z.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,Z.jsx)(Pl,{tone:c?`danger`:`pending`}),(0,Z.jsx)(`span`,{children:s?`No agent provider is enabled.`:c?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,Z.jsx)(G,{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 bg(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function xg(){let e=Mt(),t=Et(),n=V(),r=(0,X.useRef)(Promise.resolve()),i=(0,X.useRef)(0),a=(0,X.useRef)(0),o=(0,X.useRef)(bg(t.data));(0,X.useEffect)(()=>{a.current===0&&(o.current=bg(t.data))},[t.data]);let s=(0,X.useCallback)(e=>{let t=R.uiState,s=bg(n.getQueryData(t)),c=Fc(Ic(s?.dismissedProviderAuthFailures),e),l={...s,dismissedProviderAuthFailures:c};a.current+=1,n.setQueryData(t,l);let u=++i.current;r.current=r.current.then(async()=>{try{let e=await $t({dismissedProviderAuthFailures:c});o.current=bg(e),u===i.current&&n.setQueryData(t,e)}catch(e){u===i.current&&(o.current===void 0?n.removeQueries({queryKey:t,exact:!0}):n.setQueryData(t,o.current),n.invalidateQueries({queryKey:t}),Y(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--a.current}})},[n]);return(0,Z.jsx)(yg,{status:e.data,pending:e.isPending,error:e.isError,dismissals:Ic(bg(t.data)?.dismissedProviderAuthFailures),onDismissAuthFailures:s})}function Sg(e){return(0,X.useSyncExternalStore)(Qr,$r,$r),ri(e)}function Cg(e,t){let[n,r]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{if(!e){r(!1);return}let n=setTimeout(()=>r(!0),t);return()=>clearTimeout(n)},[e,t]),e&&n}function wg(e,t=Date.now()){let n=new Date(e),r=n.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});return new Date(t).toDateString()===n.toDateString()?r:`${n.toLocaleDateString([],{month:`short`,day:`numeric`})} ${r}`}function Tg({queryKey:e,isFetching:t,isError:n,className:r}){let i=Sg(e);if(!Cg(i!==void 0,600)||i===void 0)return null;let a=n&&!t,o=wg(i);return(0,Z.jsx)(`span`,{role:`status`,"data-slot":`cache-status`,"data-state":a?`failed`:t?`updating`:`cached`,title:`Saved ${new Date(i).toLocaleString()}`,className:H(`inline-flex min-w-0 items-center gap-1 rounded-full px-2 py-0.5 text-meta`,a?`bg-warning/10 text-warning`:`bg-muted text-muted-foreground`,r),children:a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Yu,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsxs)(`span`,{className:`truncate`,children:[`Showing cached data from `,o,` — couldn't refresh`]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ns,{"aria-hidden":`true`,className:H(`size-3 shrink-0`,t&&`motion-safe:animate-spin`)}),(0,Z.jsx)(`span`,{className:`truncate`,children:t?`Cached · updating…`:`Cached · ${o}`})]})})}var Eg=()=>typeof globalThis.EventSource==`function`;function Dg(){return(0,X.useSyncExternalStore)(e=>(window.addEventListener(`online`,e),window.addEventListener(`offline`,e),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}),()=>navigator.onLine!==!1,()=>!0)}function Og(){return(0,X.useSyncExternalStore)(e=>(document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)),()=>document.visibilityState!==`hidden`,()=>!0)}function kg(){let e=(0,X.useSyncExternalStore)(di.subscribeConnected,di.isConnected,()=>!0),t=Dg(),n=Og(),[r,i]=(0,X.useState)(e);return e&&!r&&i(!0),Cg(Eg()&&n&&(!e||!t),t?r?5e3:15e3:0)?(0,Z.jsxs)(`div`,{role:`status`,"data-slot":`connection-banner`,"data-state":t?`reconnecting`:`offline`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-warning/10 px-4 text-sm text-foreground`,children:[(0,Z.jsx)(Yu,{"aria-hidden":`true`,className:`size-4 shrink-0 text-warning`}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[t?`Can't reach cezar — reconnecting…`:`You're offline — reconnecting when the network is back.`,(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:` What you see may be out of date.`})]})]}):null}var Ag=`https://github.com/open-mercato/cezar/blob/main/docs/telemetry.md`,jg=`https://github.com/open-mercato/cezar/blob/main/packages/cezar/src/telemetry.ts`;function Mg(e){return e!==void 0&&e.consent===`unknown`&&e.blockedBy===null}var Ng=[`How many tasks you start (agent, model)`,`How many messages you send`,`Which pages you open`,`Errors, with your paths removed`,`Version, OS, app or CLI`,`A random install id`],Pg=[`Prompts, messages, code, diffs`,`File paths`,`Repo, branch or project names`,`Keys or credentials`,`Your IP, in any payload`];function Fg(){let e=V();return(0,X.useCallback)(async t=>{try{let n=await fn({consent:t});return e.setQueryData(R.telemetryConsent,n),t===`denied`&&Ut(),!0}catch(e){return Y(e instanceof Error?e.message:String(e),{tone:`danger`}),!1}},[e])}function Ig({busy:e,onAnswer:t,size:n}){let r=n===`lg`?`min-h-11`:`h-9`;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{variant:`outline`,className:r,disabled:e,"data-slot":`telemetry-deny`,onClick:()=>t(`denied`),children:`Don’t share`}),(0,Z.jsx)(q,{className:r,disabled:e,"data-slot":`telemetry-grant`,onClick:()=>t(`granted`),children:`Share usage data`})]})}function Lg(){let e=ct(),t=Fg(),[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(!1);if(!Mg(e.data))return null;let o=async e=>{r(!0);let n=await t(e);r(!1),n&&a(!1)};return(0,Z.jsxs)(`div`,{"data-slot":`telemetry-consent-banner`,className:`px-4 pb-3 md:px-5 md:pb-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 rounded-lg border bg-card px-4 py-3 shadow-lg`,children:[(0,Z.jsx)(jd,{className:`hidden size-[18px] shrink-0 text-violet sm:block`,"aria-hidden":`true`}),(0,Z.jsxs)(`p`,{className:`min-w-0 flex-1 basis-[280px] text-ui leading-relaxed text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:`Help improve cezar?`}),` With your OK we send task counts and crash reports to the maintainers — never prompts, code, paths or repo names. Change it anytime in Settings → Data & privacy.`,` `,(0,Z.jsx)(`button`,{type:`button`,"data-slot":`telemetry-details`,className:`underline underline-offset-2 hover:text-foreground`,onClick:()=>a(!0),children:`Details`})]}),(0,Z.jsx)(`div`,{className:`flex gap-2`,children:(0,Z.jsx)(Ig,{busy:n,onAnswer:e=>void o(e),size:`sm`})})]}),(0,Z.jsx)(zg,{open:i,onOpenChange:a,busy:n,onAnswer:e=>void o(e)})]})}function Rg({title:e,tone:t,items:n}){let r=t===`ok`?Wa:us;return(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{className:`block text-ui font-medium text-foreground`,children:e}),(0,Z.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:n.map(e=>(0,Z.jsxs)(`li`,{className:`flex gap-2 text-ui leading-snug text-muted-foreground`,children:[(0,Z.jsx)(r,{className:`mt-0.5 size-3.5 shrink-0 ${t===`ok`?`text-success`:`text-soft-foreground`}`,"aria-hidden":`true`}),e]},e))})]})}function zg({open:e,onOpenChange:t,busy:n,onAnswer:r}){return(0,Z.jsx)(ol,{open:e,onOpenChange:t,children:(0,Z.jsx)(rl,{"data-slot":`telemetry-details-dialog`,className:`max-h-[calc(100dvh-2rem)] gap-0 overflow-y-auto p-0 sm:max-w-[480px]`,onOpenAutoFocus:e=>{e.preventDefault(),e.currentTarget.focus()},children:(0,Z.jsxs)(`div`,{className:`space-y-5 p-6`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`span`,{className:`block eyebrow text-muted-foreground`,children:`What is sent`}),(0,Z.jsx)(il,{className:`text-xl font-semibold tracking-tight`,children:`Usage data, in full`}),(0,Z.jsx)(al,{className:`text-sm leading-relaxed text-muted-foreground`,children:`Counts of what you use and reports of what broke, so cezar’s maintainers at Open Mercato can fix bugs without you filing them. Off until you say yes.`})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(Rg,{title:`Shared`,tone:`ok`,items:Ng}),(0,Z.jsx)(Rg,{title:`Never shared`,tone:`no`,items:Pg})]}),(0,Z.jsxs)(`p`,{className:`text-label leading-relaxed text-soft-foreground`,children:[`Every label is a closed list the server enforces. Withdraw anytime in Settings → Data & privacy or with `,(0,Z.jsx)(`code`,{className:`font-mono`,children:`cezar telemetry disable`}),` — the install id is deleted.`,` `,(0,Z.jsx)(`a`,{href:jg,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:`Read the code`}),` · `,(0,Z.jsx)(`a`,{href:Ag,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:`Privacy notice`})]}),(0,Z.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:(0,Z.jsx)(Ig,{busy:n,onAnswer:r,size:`lg`})})]})})})}function Bg({projects:e,folder:t,onClose:n,onSave:r}){let[i,a]=X.useState(t?.name??``),[o,s]=X.useState(t?.projectIds??[]),[c,l]=X.useState(!1);return(0,Z.jsx)(ol,{open:!0,onOpenChange:e=>{e||n()},children:(0,Z.jsxs)(rl,{"data-slot":`project-folder-dialog`,children:[(0,Z.jsxs)(tl,{children:[(0,Z.jsx)(il,{children:t?`Organise folder`:`Create project folder`}),(0,Z.jsx)(al,{children:`Group projects for a client or any other part of your work.`})]}),(0,Z.jsxs)(`label`,{className:`grid gap-2 text-sm font-medium`,children:[`Folder name`,(0,Z.jsx)(gl,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:`Client name`})]}),(0,Z.jsxs)(`fieldset`,{role:`group`,"aria-label":`Select projects`,className:`grid max-h-60 gap-1 overflow-y-auto`,children:[(0,Z.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:`Projects`}),e.map(e=>(0,Z.jsxs)(`label`,{className:`flex min-h-9 items-center gap-2 rounded px-2 text-sm hover:bg-muted`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:o.includes(e.id),onChange:t=>s(n=>t.target.checked?[...n,e.id]:n.filter(t=>t!==e.id))}),(0,Z.jsx)(Eo,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`}),e.name]},e.id))]}),(0,Z.jsxs)(nl,{className:`sm:justify-between`,children:[t?c?(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(q,{type:`button`,variant:`danger-ghost`,onClick:()=>r(null,t.id),children:`Confirm delete`}),(0,Z.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>l(!1),children:`Keep folder`})]}):(0,Z.jsx)(q,{type:`button`,variant:`danger-ghost`,onClick:()=>l(!0),children:`Delete folder`}):(0,Z.jsx)(`span`,{}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:n,children:`Cancel`}),(0,Z.jsx)(q,{type:`button`,disabled:!i.trim(),onClick:()=>r({id:t?.id??crypto.randomUUID(),name:i.trim(),projectIds:o},t?.id),children:`Save folder`})]})]})]})})}var Vg=`cez-project-folders`;function Hg(e){if(!Array.isArray(e))return[];let t=new Set,n=new Set;return e.flatMap(e=>{if(typeof e!=`object`||!e)return[];let r=e,i=typeof r.id==`string`?r.id.trim():``;if(!i||t.has(i)||typeof r.name!=`string`||!r.name.trim())return[];t.add(i);let a=Array.isArray(r.projectIds)?[...new Set(r.projectIds.filter(e=>typeof e==`string`&&!n.has(e)))]:[];return a.forEach(e=>n.add(e)),[{id:i,name:r.name.trim(),projectIds:a}]})}function Ug(){try{let e=localStorage.getItem(Vg);return e===null?[]:Hg(JSON.parse(e))}catch{return[]}}function Wg(e){try{localStorage.setItem(Vg,JSON.stringify(e))}catch{}}function Gg(e,t,n){let r=e.filter(e=>e.id!==n&&e.id!==t?.id);return t&&(r=r.map(e=>({...e,projectIds:e.projectIds.filter(e=>!t.projectIds.includes(e))})),r.push(t)),r}function Kg(e,t,n){return e.map(e=>e.id===n?e.projectIds.includes(t)?e:{...e,projectIds:[...e.projectIds,t]}:e.projectIds.includes(t)?{...e,projectIds:e.projectIds.filter(e=>e!==t)}:e)}var qg=`folder:`;function Jg(e){let[t,n]=X.useState(Ug),[r,i]=X.useState(void 0),a=X.useCallback((e,r)=>{let a=Gg(t,e,r);n(a),Wg(a),i(void 0)},[t]),{order:o,canReorder:s,setOrder:c}=em(),l=X.useMemo(()=>{let t=vc(e,o),n=t.filter(e=>e.unregistered);return n.length===0?t:[...n,...t.filter(e=>!e.unregistered)]},[e,o]),u=X.useMemo(()=>l.map(e=>e.id),[l]),d=X.useMemo(()=>{let e=t.map(e=>({folder:e,projects:l.filter(t=>e.projectIds.includes(t.id))})),n=l.filter(e=>!t.some(t=>t.projectIds.includes(e.id)));return n.length>0||t.length===0?[...e,{folder:null,projects:n}]:e},[t,l]),f=Gs(Ws(qs,{activationConstraint:{distance:4}}),Ws(Us,{coordinateGetter:Ks})),p=s&&l.length>1,m=X.useCallback(e=>e.startsWith(`folder:`)?t.find(t=>t.id===e.slice(7)):t.find(t=>t.projectIds.includes(e)),[t]),h=X.useCallback(e=>{let{active:r,over:i}=e;if(i===null||i.id===r.id)return;let a=String(r.id),o=String(i.id);if(a.startsWith(`folder:`)){let e=t.findIndex(e=>e.id===a.slice(7)),r=m(o),i=r===void 0?-1:t.findIndex(e=>e.id===r.id);if(e===-1||i===-1||e===i)return;let s=Js(t,e,i);n(s),Wg(s);return}let s=m(o);if(m(a)?.id!==s?.id){let e=Kg(t,a,s?.id??null);n(e),Wg(e)}if(o.startsWith(`folder:`))return;let l=u.indexOf(a),d=u.indexOf(o);l===-1||d===-1||c(oc(u,l,d))},[t,m,u,c]);return{ordered:l,orderedIds:u,folders:t,sections:d,sortable:p,sensors:f,announcements:X.useMemo(()=>{let e=e=>{let n=String(e);if(n.startsWith(`folder:`)){let e=t.findIndex(e=>e.id===n.slice(7));return{name:t[e]?.name??n,position:`folder ${e+1} of ${t.length}`}}let r=u.indexOf(n);return{name:l[r]?.name??n,position:`position ${r+1} of ${u.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}.`}},[t,l,u]),handleDragEnd:h,editingFolder:r,setEditingFolder:i,saveFolder:a}}var Yg=`Mod+Shift+P`;function Xg(e){return!(typeof e.key!=`string`||e.key.toLowerCase()!==`p`||!(e.metaKey||e.ctrlKey)||!e.shiftKey||e.altKey||e.repeat)}function Zg(e){return e===`ok`?`success`:e===`missing`?`danger`:`pending`}function Qg(e){let t=new Map;for(let n of e??[]){if(n.archived)continue;let e=t.get(n.projectId)??{needsYou:0,running:0};ln(n)?e.needsYou+=1:n.status===`running`&&(e.running+=1),t.set(n.projectId,e)}return t}function $g(e,t){let n=0;for(let[r,i]of e)r!==t&&(n+=i.needsYou);return n}function e_(e,t){let n=t.trim().toLowerCase();return n===``||e.name.toLowerCase().includes(n)||(e.branch?.toLowerCase().includes(n)??!1)}function t_({projects:e,activeId:t,singleProject:n=!1,onNavigate:r}){let i=yh(),a=r??i,[o,s]=X.useState(!1),[c,l]=X.useState(``),u=Mr(),{sections:d,sortable:f,sensors:p,announcements:m,handleDragEnd:h,editingFolder:g,setEditingFolder:_,saveFolder:v}=Jg(e),y=Le(o||e.length>1),b=X.useMemo(()=>Qg(y.data?.runs),[y.data?.runs]),x=$g(b,t),S=e.find(e=>e.id===t)??null,[C,w]=X.useState(null),T=X.useCallback(e=>{s(!1),l(``),w(e),wl(e)},[]),E=X.useCallback(e=>{e||w(null)},[]);X.useEffect(()=>{let e=e=>{Xg(e)&&(ps(e.target)&&!(e.target instanceof HTMLElement&&e.target.closest(`[cmdk-input]`))||!o&&fs()||(e.preventDefault(),s(e=>!e)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[o]);let D=X.useCallback(e=>{s(!1),a?.(),u(`/p/${encodeURIComponent(e.id)}/`)},[u,a]),O=d.map(e=>({...e,projects:e.projects.filter(e=>e_(e,c))})).filter(e=>c.trim()===``||e.projects.length>0),k=O.flatMap(e=>[...e.folder?[`${qg}${e.folder.id}`]:[],...e.projects.map(e=>e.id)]),A=Ds(Yg);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ts,{modal:!0,open:o,onOpenChange:e=>{s(e),e||l(``)},children:[(0,Z.jsx)(vs,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`project-switcher`,"aria-label":S?`Project: ${S.name} — switch project`:`Switch project`,"aria-keyshortcuts":`Meta+Shift+P Control+Shift+P`,title:`Switch project (${A})`,className:H(`mx-3 mb-2 flex h-9 items-center gap-2 rounded-md border border-border bg-card px-2.5 text-left text-ui font-semibold outline-none transition-colors hover:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50`,o&&`border-violet ring-[3px] ring-violet/25`),children:[S?(0,Z.jsx)(Pl,{tone:Zg(S.status)}):null,(0,Z.jsx)(`span`,{"data-slot":`project-switcher-name`,className:`min-w-0 truncate`,children:S?.name??`Projects`}),S?.branch?(0,Z.jsx)(`span`,{"data-slot":`project-switcher-branch`,className:`ml-auto min-w-0 max-w-[45%] truncate font-mono text-micro font-medium text-soft-foreground`,children:S.branch}):null,x?(0,Z.jsxs)(`span`,{"data-slot":`project-switcher-elsewhere`,className:`flex shrink-0 items-center`,children:[(0,Z.jsx)(Pl,{tone:`info`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`${x} ${x===1?`task needs`:`tasks need`} you in other projects`})]}):null,(0,Z.jsx)(qa,{className:H(`size-3.5 shrink-0 text-soft-foreground`,!S?.branch&&!x&&`ml-auto`),"aria-hidden":`true`})]})}),(0,Z.jsx)(Cs,{align:`start`,sideOffset:6,"data-slot":`project-switcher-popover`,className:`w-[min(23rem,calc(100vw-2rem))] p-0`,children:(0,Z.jsxs)(ql,{shouldFilter:!1,loop:!0,label:`Switch project`,defaultValue:t??void 0,children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(zl,{placeholder:`Search projects…`,value:c,onValueChange:l,className:`pr-12`}),(0,Z.jsx)(Xo,{className:`pointer-events-none absolute top-1/2 right-3 -translate-y-1/2`,children:A})]}),(0,Z.jsxs)(Kl,{label:`Switch project`,className:`max-h-[min(24rem,60vh)]`,children:[(0,Z.jsx)(Gl,{children:`No project matches.`}),(0,Z.jsx)(Zs,{sensors:p,collisionDetection:$s,accessibility:{announcements:m},onDragEnd:h,children:(0,Z.jsx)(Qs,{items:k,strategy:Ys,children:O.map(e=>(0,Z.jsx)(r_,{section:e,searching:c.trim()!==``,activeId:t,counts:b,sortable:f,onSelect:D,onEditFolder:e=>_(e)},e.folder?.id??`ungrouped`))})})]}),(0,Z.jsxs)(`div`,{"data-slot":`project-switcher-footer`,className:`flex items-center gap-1 border-t border-border px-2 py-1.5`,children:[n?null:(0,Z.jsx)(n_,{onPick:T}),(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`project-folder-create`,onClick:()=>_(null),className:`flex h-[30px] items-center gap-[7px] rounded-sm px-2.5 text-label font-semibold text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,Z.jsx)(od,{className:`size-3.5`,"aria-hidden":`true`}),`New folder`]}),(0,Z.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 text-micro text-soft-foreground`,"aria-hidden":`true`,children:[(0,Z.jsx)(Xo,{children:`↑↓`}),(0,Z.jsx)(Xo,{children:`↵`}),(0,Z.jsx)(Xo,{children:`esc`})]})]})]})})]}),C===`folder`?(0,Z.jsx)(Mf,{label:`Open local folder`,onError:()=>w(null),children:(0,Z.jsx)(bf,{open:!0,onOpenChange:E})}):C===`clone`?(0,Z.jsx)(Mf,{label:`Clone from GitHub`,onError:()=>w(null),children:(0,Z.jsx)(Sf,{open:!0,onOpenChange:E})}):C===`new`?(0,Z.jsx)(Mf,{label:`New project`,onError:()=>w(null),children:(0,Z.jsx)(Df,{open:!0,onOpenChange:E})}):null,g===void 0?null:(0,Z.jsx)(Bg,{projects:e,folder:g,onClose:()=>_(void 0),onSave:v})]})}function n_({onPick:e}){return(0,Z.jsxs)(lo,{children:[(0,Z.jsx)(oo,{asChild:!0,children:(0,Z.jsxs)(q,{variant:`ghost`,size:`sm`,"data-slot":`add-project`,"aria-label":`Add project`,children:[(0,Z.jsx)(ts,{className:`size-3.5`,"aria-hidden":`true`}),`Add project`]})}),(0,Z.jsxs)(so,{align:`start`,className:`w-56`,children:[(0,Z.jsx)($a,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,Z.jsxs)(ro,{"data-slot":`add-project-local`,onSelect:()=>e(`folder`),children:[(0,Z.jsx)(Eo,{"aria-hidden":`true`}),`Open local folder…`]}),(0,Z.jsxs)(ro,{"data-slot":`add-project-clone`,onSelect:()=>e(`clone`),children:[(0,Z.jsx)(Nf,{"aria-hidden":`true`}),`Clone from GitHub…`]}),(0,Z.jsxs)(ro,{"data-slot":`add-project-create`,onSelect:()=>e(`new`),children:[(0,Z.jsx)(od,{"aria-hidden":`true`}),`New project…`]})]})]})}function r_({section:e,searching:t,activeId:n,counts:r,sortable:i,onSelect:a,onEditFolder:o}){let{folder:s}=e,c=s?`${qg}${s.id}`:null,l=i&&s!==null&&!t,{attributes:u,listeners:d,setNodeRef:f,transform:p,transition:m,isDragging:h}=Hs({id:c??`ungrouped`,disabled:!l}),g=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[s?(0,Z.jsx)(Eo,{className:`size-3 shrink-0`,"aria-hidden":`true`}):null,(0,Z.jsx)(`span`,{className:`truncate`,children:s?s.name:`No folder`}),(0,Z.jsxs)(`span`,{className:`font-mono font-normal tracking-normal`,"aria-label":`${e.projects.length} project${e.projects.length===1?``:`s`}`,children:[`· `,e.projects.length]}),s?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Edit ${s.name}`,onClick:()=>o(s),className:`ml-auto rounded px-1 text-xs tracking-normal text-muted-foreground hover:bg-muted hover:text-foreground`,children:`…`}),(0,Z.jsx)(`button`,{type:`button`,"data-slot":`project-folder-grip`,disabled:!l,"aria-label":`Reorder folder ${s.name}`,className:H(`flex size-5 shrink-0 cursor-grab touch-none items-center justify-center rounded text-soft-foreground outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,!l&&`invisible`),...u,...d,children:(0,Z.jsx)(ya,{className:`size-3`,"aria-hidden":`true`})})]}):null]});return(0,Z.jsx)(`div`,{ref:s?f:void 0,style:s?{transform:Xs.Translate.toString(p),transition:m}:void 0,"data-slot":`switcher-section`,"data-folder":s?.id??void 0,className:H(h&&`relative z-10 opacity-40`),children:(0,Z.jsxs)(Vl,{heading:g,className:`[&_[cmdk-group-heading]]:eyebrow [&_[cmdk-group-heading]]:flex [&_[cmdk-group-heading]]:text-soft-foreground`,children:[e.projects.length===0&&!t?(0,Z.jsx)(`p`,{className:`px-2 py-1 text-xs text-soft-foreground`,children:`No projects`}):null,e.projects.map(e=>(0,Z.jsx)(i_,{project:e,current:e.id===n,counts:r.get(e.id),sortable:i&&!t,onSelect:a},e.id))]})})}function i_({project:e,current:t,counts:n,sortable:r,onSelect:i}){let a=e.status===`missing`,o=r&&!a&&!e.unregistered,{attributes:s,listeners:c,setNodeRef:l,transform:u,transition:d,isDragging:f}=Hs({id:e.id,disabled:!o});return(0,Z.jsx)(`div`,{ref:l,style:{transform:Xs.Translate.toString(u),transition:d},"data-slot":`switcher-project`,"data-project":e.id,"data-status":e.status,"data-current":t?``:void 0,"data-dragging":f?``:void 0,className:H(f&&`relative z-10 opacity-40`),children:(0,Z.jsxs)(Wl,{value:e.id,disabled:a,onSelect:()=>i(e),title:a?`${e.root} is gone — remove it in Global settings → Projects`:e.root,"aria-current":t?`true`:void 0,className:`group/row gap-2 py-1.5 pl-1 pr-2`,children:[(0,Z.jsx)(`button`,{type:`button`,"data-slot":`project-grip`,disabled:!o,"aria-label":`Reorder ${e.name}`,onClick:e=>e.stopPropagation(),className:H(`flex size-5 shrink-0 cursor-grab touch-none items-center justify-center rounded text-soft-foreground opacity-0 outline-none transition-opacity`,`focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 group-hover/row:opacity-70 group-data-[selected=true]/row:opacity-70 [@media(hover:none)]:opacity-70`,!o&&`cursor-default opacity-0 group-hover/row:opacity-0 group-data-[selected=true]/row:opacity-0 [@media(hover:none)]:opacity-0`),...s,...c,children:(0,Z.jsx)(ya,{className:`size-3.5`,"aria-hidden":`true`})}),(0,Z.jsx)(Pl,{tone:Zg(e.status)}),(0,Z.jsxs)(`span`,{className:H(`flex min-w-0 flex-1 items-baseline gap-2`,a&&`opacity-55`),children:[(0,Z.jsx)(`span`,{"data-slot":`switcher-project-name`,className:`truncate font-medium`,children:e.name}),e.branch?(0,Z.jsx)(`span`,{"data-slot":`switcher-project-branch`,className:`truncate font-mono text-micro text-soft-foreground`,children:e.branch}):null]}),e.unregistered?(0,Z.jsx)(`span`,{"data-slot":`project-unregistered`,title:`cezar is serving this folder — it is not in your saved projects.`,className:`shrink-0 rounded-full bg-muted px-[7px] py-px text-micro font-medium text-soft-foreground`,children:`not saved`}):null,a?(0,Z.jsx)(`span`,{"data-slot":`project-missing`,className:`shrink-0 rounded-full bg-danger/15 px-[7px] py-px text-micro font-medium text-danger`,children:`folder not found`}):null,n?.needsYou?(0,Z.jsx)(`span`,{"data-slot":`project-attention`,title:`${n.needsYou} task${n.needsYou===1?``:`s`} need${n.needsYou===1?`s`:``} you`,className:`shrink-0 rounded-full bg-violet px-1.5 py-px text-micro font-semibold text-violet-foreground tabular-nums`,children:n.needsYou}):null,n?.running?(0,Z.jsxs)(`span`,{"data-slot":`project-running`,title:`${n.running} running`,className:`flex shrink-0 items-center gap-0.5 text-micro text-violet tabular-nums`,children:[(0,Z.jsx)(Mo,{className:`size-3 animate-spin motion-reduce:animate-none`,"aria-hidden":`true`}),n.running]}):null,(0,Z.jsx)(`span`,{className:`flex w-3.5 shrink-0 justify-center text-violet`,"aria-hidden":`true`,children:t?(0,Z.jsx)(Wa,{className:`size-3.5`}):null})]})})}function a_({archived:e,onToggle:t,className:n}){let r=e?Hu:Zi;return(0,Z.jsx)(el,{label:e?`Move back to the active list`:`Move to the archived list`,children:(0,Z.jsx)(`button`,{type:`button`,"data-slot":`archive-toggle`,"aria-label":e?`Unarchive task`:`Archive task`,onClick:n=>{n.stopPropagation(),t(!e)},className:H(`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`,n),children:(0,Z.jsx)(r,{className:`size-3`,"aria-hidden":`true`})})})}function o_(e){return e.kind===`tracker`&&!!e.trackerTrigger&&(!e.trackerTrigger.access||e.trackerTrigger.access.writes.length>0)}var s_=`Creates a paused, read-only automation. Review its prompt and grant any required writes in the cockpit editor before enabling.`,c_=e=>`"${e.replace(/(["\\$`!])/g,`\\$1`)}"`;function l_(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function u_(e){if(e.schedules&&e.schedules.length>1||e.kind===`tracker`)return!1;if(e.kind===`schedule`)return!!e.schedule&&(e.schedule.type!==`once`||!!e.schedule.date);if(!e.events?.length)return!1;let t=e.filters??{};return!([`assignees`,`allLabels`,`excludeLabels`,`changedLabels`].some(e=>(t[e]?.length??0)>0)||t.lookbackDays!==void 0&&t.lookbackDays!==7||t.maxRecords!==void 0&&t.maxRecords!==25)}function d_(e){let t=[`cez automation add`,`--name ${c_(e.name||`untitled`)}`];if(e.kind===`schedule`&&e.schedule?.type===`once`){let n=or(e.schedule);t.push(`--at ${c_(`${n.date} ${Er(n.hour,n.minute)}`)}`)}else if(e.kind===`schedule`&&e.schedule)t.push(`--cron ${c_(cr(e.schedule))}`);else{t.push(`--on ${(e.events??[]).join(`,`)}`),t.push(`--every ${l_(e.intervalSeconds??300)}`);for(let n of e.filters?.anyLabels??[])t.push(`--label ${c_(n)}`);for(let n of e.filters?.authors??[])t.push(`--author ${c_(n)}`)}let{task:n}=e;return n.workflow&&t.push(`--workflow ${c_(n.workflow)}`),n.runner&&t.push(`--runner ${c_(n.runner)}`),n.model&&t.push(`--model ${c_(n.model)}`),n.autonomous===!1?t.push(`--no-autonomous`):n.autonomous&&t.push(`--autonomous`),n.dispatch&&(t.push(`--dispatch`),n.dispatch.maxSubtasks!==void 0&&t.push(`--max-subtasks ${n.dispatch.maxSubtasks}`),n.dispatch.reviewChild&&t.push(`--review-child`)),e.enable&&t.push(`--enable`),t.push(`--prompt ${c_(n.prompt||`…`)}`),t.join(` `)}function f_(e){let t={name:e.name||`untitled`,kind:e.kind,...e.kind===`schedule`?{schedule:e.schedule,...e.schedules?{schedules:e.schedules}:{}}:e.kind===`tracker`?{trackerTrigger:e.trackerTrigger?{...e.trackerTrigger,access:{version:1,writes:[]}}:void 0,intervalSeconds:e.intervalSeconds??1800,filters:{lookbackDays:7,maxRecords:25,...e.filters}}:{events:e.events,intervalSeconds:e.intervalSeconds??300,filters:{lookbackDays:7,maxRecords:25,...e.filters}},task:e.task,...e.enable&&!o_(e)?{enable:!0}:{}};return`cez automation create --json '${JSON.stringify(t).replace(/'/g,`'\\''`)}'`}function p_(e){return u_(e)?d_(e):f_(e)}var m_=()=>[fr(),`automations`];function h_(){let e=E(),t=e.data!==void 0;return{known:t,off:t&&e.data?.capabilities?.automations!==!0}}function g_(e){let t=V(),n=Nr(),r=Xn({queryKey:m_(),queryFn:({signal:e})=>kt({signal:e}),enabled:e});return(0,X.useEffect)(()=>ai((e,r)=>{if(e!==`automation-change`)return;let i=r;typeof i.project==`string`&&(n===null||i.project===n)&&t.invalidateQueries({queryKey:m_()})}),[n,t]),r}function __(e){let t=V(),n=()=>t.invalidateQueries({queryKey:m_()}),r=e=>Y(e instanceof Error?e.message:String(e),{tone:`danger`}),i=B({mutationFn:async e=>{e.kind===`schedule`?(await Te(e.id),Y(`Started "${e.name}" — the task is queued.`)):(await x(e.id,`execute`),Y(`Checking events for "${e.name}" now.`))},onSuccess:()=>void n(),onError:r}),a=B({mutationFn:async e=>{await x(e.id,`preview`),Y(`Preview queued for "${e.name}" — no tasks will launch. See the execution log for results.`)},onSuccess:()=>void n(),onError:r}),o=B({mutationFn:e=>D(e.id,!e.enabled),onSuccess:()=>void n(),onError:r}),s=B({mutationFn:async e=>{let{cancelled:t,kept:n}=await Hn(e.id),r=n.length?` ${n.length} kept: ${n.length===1?`it has`:`they have`} running subtasks — stop ${n.length===1?`it`:`them`} from Tasks.`:``;Y(`Cancelled ${t.length} queued task${t.length===1?``:`s`} of "${e.name}".${r}`)},onSuccess:()=>void n(),onError:r}),l=B({mutationFn:e=>Ce({name:`${e.name} (copy)`,...e.description?{description:e.description}:{},kind:e.kind,...e.kind===`schedule`?{schedule:e.schedule,...e.schedules?{schedules:e.schedules}:{}}:e.kind===`tracker`?{trackerTrigger:e.trackerTrigger,intervalSeconds:e.intervalSeconds,filters:e.filters}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:e.task}),onSuccess:e=>{Y(`Duplicated as "${e.automation.name}", paused.`),n()},onError:r}),u=B({mutationFn:e=>Xe(e.id),onSuccess:()=>void n(),onError:r});return{preview:e=>a.mutateAsync(e).then(()=>void 0,()=>void 0),runNow:e=>i.mutateAsync(e).then(()=>void 0,()=>void 0),toggleEnabled:e=>o.mutateAsync(e).then(()=>void 0,()=>void 0),loadWork:e=>c(e.id).catch(e=>{r(e)}),cancelQueued:e=>s.mutateAsync(e).then(()=>void 0,()=>void 0),duplicate:e=>l.mutateAsync(e).then(()=>void 0,()=>void 0),remove:e=>u.mutateAsync(e).then(()=>void 0,()=>void 0),copyCli:async e=>{await v_(p_({name:e.name,kind:e.kind,trackerTrigger:e.trackerTrigger,schedule:e.schedule,schedules:e.schedules,events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters,task:e.task}),o_(e)?s_:void 0)},busy:a.isPending||i.isPending||o.isPending||s.isPending||l.isPending||u.isPending}}async function v_(e,t){try{await Xl(e),Y(t?`Copied to the clipboard. ${t}`:`Copied to the clipboard.`)}catch{Y(`Copy failed — select the text to copy it.`,{tone:`danger`})}}function y_({compact:e=!1,enabled:t=!0}){let[n,r]=(0,X.useState)([]),i=h_(),a=g_(t&&i.known&&!i.off).data?.automations.filter(e=>e.deferredStart)??[];return!a.length&&!n.length?null:(0,Z.jsxs)(`section`,{"aria-label":`Scheduled tasks`,className:e?`px-2 py-3`:`border-b p-4 md:px-5`,children:[(0,Z.jsxs)(`h2`,{className:`mb-2 eyebrow text-muted-foreground`,children:[`Scheduled · `,a.length]}),n.length>0&&(0,Z.jsxs)(`p`,{role:`status`,children:[`This scheduled task already started. `,n.map((e,t)=>(0,Z.jsxs)(G,{to:`/tasks/${e}`,className:`mr-3 underline`,children:[`View run `,t+1]},e))]}),e?a.map(e=>(0,Z.jsxs)(G,{to:`/#scheduled-${e.id}`,className:`block truncate rounded px-2 py-1.5 text-sm`,children:[`◷ `,e.name]},e.id)):(0,Z.jsx)(`div`,{className:`grid gap-3`,children:a.map(e=>(0,Z.jsx)(b_,{item:e,onAlreadyStarted:r},e.id))})]})}function b_({item:e,onAlreadyStarted:t}){let n=Kr(),r=e.deferredStart,i=Lr(),a=V(),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(``),g=()=>{if(u){d(null);return}p(e.schedule?.date??``),h(`${String(e.schedule?.hour??0).padStart(2,`0`)}:${String(e.schedule?.minute??0).padStart(2,`0`)}`),d(e),l(``)},_=async e=>{s(!0),l(``);try{await e()}catch(e){e instanceof sn&&e.runIds?.length?t(e.runIds):l(e instanceof Error?e.message:String(e))}finally{await a.invalidateQueries({queryKey:m_()}),s(!1)}},v=r.runIds.length>0,y=v&&r.status===`failed`&&r.failureKind===`ambiguous`,b=r.failureKind===`binding-invalid`,x=`scheduled-${e.id}`,[S,C]=(0,X.useState)(!1);(0,X.useEffect)(()=>{n.hash===`#${x}`&&(C(!0),document.getElementById(x)?.scrollIntoView?.({block:`nearest`}))},[x,n.hash,n.key]);let w=e.task.steps?.flatMap(e=>e.skill?[e.skill]:[])??[],T=e.task.workflow??(w.length?`Skills: ${w.join(`, `)}`:`Inline steps`),E=r.binding.models?.map(e=>`${e.step?`${e.step}: `:``}${e.runner} / ${e.model??`Provider default`}`).join(`; `)??e.task.model??`Resolved step models unavailable`,D=r.status===`failed`?`Couldn't start`:r.status===`missed`?`Missed`:r.status===`launching`?`Starting…`:r.holdUntil?`Waiting for reset`:`Scheduled`;return(0,Z.jsxs)(`details`,{id:x,open:S,onToggle:e=>C(e.currentTarget.open),className:`rounded-lg border p-3`,children:[(0,Z.jsxs)(`summary`,{className:`cursor-pointer text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,Z.jsxs)(`span`,{className:`ml-2 text-muted-foreground`,children:[D,` · `,new Date(r.notBefore).toLocaleString(`en-GB`,{timeZone:r.timeZone}),` · `,r.timeZone]})]}),(0,Z.jsxs)(`div`,{className:`mt-3 space-y-3 text-sm`,children:[(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:e.task.prompt}),(0,Z.jsxs)(`p`,{className:`text-muted-foreground`,children:[T,` · `,E,` · `,r.binding.accounts.map(e=>`${e.runner} / ${e.id}`).join(`, `)]}),(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`The server must be running. This is the earliest start; account holds and queue limits still apply.`}),r.holdUntil&&(0,Z.jsxs)(`p`,{children:[`Waiting until `,new Date(r.holdUntil).toLocaleString(`en-GB`,{timeZone:r.timeZone}),` for a newer observed reset.`]}),r.error&&(0,Z.jsx)(`p`,{role:`status`,children:r.error}),y&&(0,Z.jsx)(`p`,{children:`Check the runs below. Start missing runs creates only the ones that do not exist yet — a run you deleted starts again. Dismiss removes this entry and starts nothing.`}),r.runIds.map((e,t)=>(0,Z.jsxs)(G,{to:`/tasks/${e}`,className:`mr-3 underline`,children:[`Check run `,t+1]},e)),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(q,{size:`sm`,variant:`ghost`,disabled:o,onClick:()=>void _(()=>Xl(e.task.prompt)),children:`Copy prompt`}),(0,Z.jsx)(q,{size:`sm`,variant:`outline`,disabled:o||v&&!y,onClick:()=>void _(async()=>{let t=await Te(e.id,e.revision);i(`/tasks/${t.runId}`)}),children:y?`Start missing runs`:r.status===`failed`?`Retry`:`Run now`}),(0,Z.jsx)(q,{size:`sm`,variant:`ghost`,disabled:o||v||b,onClick:g,children:`Change time`}),(0,Z.jsx)(q,{size:`sm`,variant:`ghost`,disabled:o||v&&!y,onClick:()=>void _(()=>Xe(e.id,e.revision)),children:y?`Dismiss`:`Cancel`})]}),u&&!b&&(0,Z.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:t=>{t.preventDefault(),_(async()=>{let[t,n]=m.split(`:`).map(Number);await oe(e.id,{expectedRevision:u.revision,name:u.name,kind:`schedule`,task:u.task,schedule:{type:`once`,date:f,hour:t??0,minute:n??0},enabled:!0}),d(null)})},children:[(0,Z.jsxs)(`label`,{children:[`Date`,(0,Z.jsx)(gl,{type:`date`,required:!0,value:f,onChange:e=>p(e.target.value)})]}),(0,Z.jsxs)(`label`,{children:[`Time (server time zone)`,(0,Z.jsx)(gl,{type:`time`,required:!0,value:m,onChange:e=>h(e.target.value)})]}),(0,Z.jsx)(q,{type:`submit`,disabled:o,children:`Save time`})]}),c&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:c})]})]})}var x_=new Map,S_=new Set,C_=()=>{for(let e of S_)e()},w_=e=>(S_.add(e),()=>{S_.delete(e)});function T_(e=fr()){x_.delete(e),C_()}function E_(){let e=h_(),t=Nr(),n=t??fr(),r=(0,X.useSyncExternalStore)(w_,()=>x_.has(n)),i=g_(!1),a=i.data?.automations.some(e=>e.deferredStart)??!1;return(0,X.useEffect)(()=>ai((e,r)=>{e===`automation-change`&&(t===null||r.project===t)&&T_(n)}),[t,n]),(0,X.useEffect)(()=>{i.data&&!a&&!x_.has(n)&&(x_.set(n,i.dataUpdatedAt),C_())},[i.data,i.dataUpdatedAt,a,n]),e.known&&!e.off&&(!r||a)}function D_(){return(0,Z.jsx)(`span`,{"data-slot":`unread-marker`,className:`sr-only`,children:`, unread`})}function O_(e){return e===void 0?`unknown`:new Intl.NumberFormat().format(e)}function k_(e,t){return`Input tokens: ${O_(e)}; output tokens: ${O_(t)}`}function A_(e,t,n=`compact`){let r=e===void 0?`—`:Nl(e),i=t===void 0?`—`:Nl(t);return n===`table`?`${r} / ${i}`:`IN ${r} · OUT ${i}`}function j_({inputTokens:e,outputTokens:t,variant:n=`compact`,omitWhenUnknown:r=!0,className:i}){return r&&e===void 0&&t===void 0?null:(0,Z.jsx)(`span`,{"data-slot":`directional-usage`,"aria-label":k_(e,t),className:H(`font-mono tabular-nums`,i),children:A_(e,t,n)})}var M_={statuses:[],workflows:[],automations:[]};function N_(e){return e.statuses.length+e.workflows.length+e.automations.length}function P_(e){let t=new Map(e.map(e=>[e.id,e]));return new Map(e.map(e=>[e.id,zp(e,e=>t.get(e))]))}var F_=(e,t)=>e.length===0||t!==void 0&&e.includes(t);function I_(e,t,n,r){return e.filter(e=>{let i=r.get(e.id);return!(!Hp(i,t)||!F_(n.statuses,e.status)||!F_(n.workflows,O(e))||t!==`regular`&&!F_(n.automations,i))})}function L_(e,t){return t===`all`?[...e]:I_(e,t,M_,P_(e))}function R_(e,t,n,r,i){let a=new Map;for(let o of I_(e,t,{...n,[i]:[]},r)){let e=i===`statuses`?o.status:i===`workflows`?O(o):r.get(o.id);e!==void 0&&a.set(e,(a.get(e)??0)+1)}return a}function z_(e,t,n){return{regular:I_(e,`regular`,t,n).length,automation:I_(e,`automation`,t,n).length,all:I_(e,`all`,t,n).length}}function B_(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 V_(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 H_(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 U_(e,t){return H_(V_(e),t)}function W_(e){return e<=0?null:`${e} subtask${e===1?``:`s`}`}function G_(e){return e.dispatch?.parentRunId===void 0?null:e.dispatch.kind??`implement`}var K_=X.createContext(void 0),q_=`flex w-0 shrink-0 items-center gap-0.5 overflow-hidden opacity-0 group-hover/task-row:mr-1.5 group-hover/task-row:w-auto group-hover/task-row:opacity-100 group-focus-within/task-row:mr-1.5 group-focus-within/task-row:w-auto group-focus-within/task-row:opacity-100 no-hover:mr-1.5 no-hover:w-auto no-hover:opacity-100`,J_=`no-hover:size-7`,Y_=`no-hover:hidden`,X_=`group-hover/task-row:min-w-0 group-focus-within/task-row:min-w-0 no-hover:min-w-0`;X.memo(function({run:e,depth:t=0,childCount:n=0,queuePosition:r,currentRunId:i,now:a,scope:o,variant:c=!1,showTokens:l,showCost:u,onTogglePin:d,onToggleArchive:f}){let p=!!f&&(!!e.archived||!Va(e.status)),m=!!d||p,h=s(e),g=X.useId(),_=e.id===i,v=ve(e,X.useContext(K_)),y=Ge(e),b=te(y,v?.number)?ce(y).rest:y,x=ka(e),S=Na(e),C=c?``:r===null?Ml(er(e),a):`#${r}`,w=W_(n),T=G_(e);return(0,Z.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":_?`true`:void 0,"data-depth":t,style:t>0?{paddingLeft:`${10+t*14}px`}:void 0,className:H(`group/task-row flex items-center gap-2 rounded-sm pl-2.5 hover:bg-muted`,_&&`bg-muted`,c&&`pl-[26px]`),children:[(0,Z.jsx)(G,{to:Br(o,`/tasks/${e.id}`),tabIndex:-1,"aria-hidden":`true`,"data-slot":`task-row-dot-link`,className:`-ml-2.5 flex shrink-0 items-center self-stretch pl-2.5`,children:(0,Z.jsx)(Pl,{id:g,tone:h.tone,pulse:h.pulse,"aria-label":h.label,role:`img`})}),v?(0,Z.jsx)(Rl,{run:e,reference:v,compact:!0,className:`h-auto shrink-0 gap-[2px] px-1.5 py-px text-micro`}):null,(0,Z.jsxs)(G,{to:Br(o,`/tasks/${e.id}`),title:y,"aria-current":_?`page`:void 0,"aria-describedby":g,"data-slot":`task-row-link`,className:H(`flex min-w-0 flex-1 items-center gap-2 py-[7px]`,m?`pr-0.5`:`pr-2.5`),children:[c?(0,Z.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,Z.jsxs)(`span`,{"data-slot":`task-row-title`,className:H(`min-w-[7rem] flex-1 truncate text-ui`,m&&X_,x?`font-semibold text-foreground`:S?`font-medium text-muted-foreground`:`font-medium`),children:[c?Z_(e,l,u):b,e.queueWaitReason&&(0,Z.jsx)(`span`,{className:`block truncate text-meta font-normal text-muted-foreground`,children:ha(e.queueWaitReason)})]}),(0,Z.jsxs)(`span`,{"data-slot":`task-row-meta`,className:H(`contents`,m&&`group-hover/task-row:hidden group-focus-within/task-row:hidden`),children:[(0,Z.jsxs)(`span`,{"data-slot":`task-row-meta-droppable`,className:H(`contents`,m&&Y_),children:[T?(0,Z.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,children:T}):null,e.diffStat?(0,Z.jsx)(Yl,{stat:e.diffStat,className:`hidden shrink-0 text-micro @min-[23rem]/sidebar:inline`}):null,w?(0,Z.jsx)(`span`,{"data-slot":`subtask-count`,title:w,className:`hidden shrink-0 rounded-full bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground @min-[19rem]/sidebar:inline`,children:n}):null]}),C&&(r!==null||!v)?(0,Z.jsx)(`span`,{"data-slot":`task-row-age`,className:H(`shrink-0 text-meta text-soft-foreground tabular-nums`,T&&t>0&&r===null&&`hidden @min-[19rem]/sidebar:inline`),children:C}):null]}),x?(0,Z.jsx)(D_,{}):null]}),o===null&&e.subject?(0,Z.jsx)(qi,{run:e,className:m?`mr-0.5`:`mr-2.5`}):null,m?(0,Z.jsxs)(`div`,{"data-slot":`task-row-actions`,className:q_,children:[d?(0,Z.jsx)(ia,{pinned:!!e.pinned,onToggle:t=>d(e,t),className:J_}):null,p&&f?(0,Z.jsx)(a_,{archived:!!e.archived,onToggle:t=>f(e,t),className:J_}):null]}):null]})});function Z_(e,t,n){let r=[e.runner??`claude`];t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&r.push(A_(e.inputTokens,e.outputTokens));let i=ze(e.costUsd);return n&&i&&r.push(i),r.join(` · `)}var Q_={permission:0,error:0,waiting:0,running:1,unseen:2,none:2};function $_(e,t=6){return e.filter(e=>!e.archived).map(e=>({run:e,rank:nt[s(e).bucket]})).sort((e,t)=>{let n=Q_[s(e.run).bucket]-Q_[s(t.run).bucket];if(n!==0)return n;let r=Number(!!t.run.pinned)-Number(!!e.run.pinned);return r===0?e.rank===t.rank?pe(er(e.run),er(t.run)):e.rank-t.rank:r}).slice(0,t).map(({run:e})=>e)}function ev({runs:e,currentRunId:t=null,now:n=Date.now(),onTogglePin:r,onToggleArchive:i}){let a=$_(e),o=Ye(e),s=yh();return(0,Z.jsxs)(`div`,{"data-slot":`current-tasks`,children:[(0,Z.jsx)(`h2`,{className:`px-3 pt-3 pb-1 eyebrow text-soft-foreground`,children:`Current tasks`}),a.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-1.5 text-xs text-soft-foreground`,children:`No tasks yet — describe one.`}):a.map(e=>(0,Z.jsx)(tv,{run:e,current:e.id===t,queuePosition:o.get(e.id)??null,now:n,onTogglePin:r,onToggleArchive:i},e.id)),(0,Z.jsx)(G,{to:`/tasks`,onClick:s,"data-slot":`current-tasks-more`,className:`flex h-9 items-center rounded-md px-3 text-label text-muted-foreground transition-colors hover:text-foreground md:h-7`,children:`More…`})]})}var tv=X.memo(function({run:e,current:t,queuePosition:n,now:r,onTogglePin:i,onToggleArchive:a}){let o=yh(),c=!!a&&(!!e.archived||!Va(e.status)),l=!!i||c,u=s(e),d=X.useId(),f=ve(e,X.useContext(K_)),p=Ge(e),m=te(p,f?.number)?ce(p).rest:p,h=ka(e),g=Na(e),_=n===null?Ml(er(e),r):`#${n}`;return(0,Z.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":t?`true`:void 0,className:H(`group/task-row flex items-center gap-2 rounded-sm pl-2.5 hover:bg-muted`,t&&`bg-muted`),children:[(0,Z.jsx)(G,{to:`/tasks/${e.id}`,tabIndex:-1,"aria-hidden":`true`,"data-slot":`task-row-dot-link`,onClick:o,className:`-ml-2.5 flex shrink-0 items-center self-stretch pl-2.5`,children:(0,Z.jsx)(Pl,{id:d,tone:u.tone,pulse:u.pulse,"aria-label":u.label,role:`img`})}),f?(0,Z.jsx)(Rl,{run:e,reference:f,compact:!0,className:`h-auto shrink-0 gap-[2px] px-1.5 py-px text-micro`}):null,(0,Z.jsxs)(G,{to:`/tasks/${e.id}`,title:p,"aria-current":t?`page`:void 0,"aria-describedby":d,"data-slot":`task-row-link`,onClick:o,className:H(`flex min-w-0 flex-1 items-center gap-2 py-[7px]`,l?`pr-0.5`:`pr-2.5`),children:[(0,Z.jsx)(`span`,{"data-slot":`task-row-title`,className:H(`min-w-0 flex-1 truncate text-ui`,h?`font-semibold text-foreground`:g?`font-medium text-muted-foreground`:`font-medium`),children:m}),_?(0,Z.jsx)(`span`,{"data-slot":`task-row-age`,className:H(`shrink-0 text-meta text-soft-foreground tabular-nums`,l&&`group-hover/task-row:hidden group-focus-within/task-row:hidden`),children:_}):null,h?(0,Z.jsx)(D_,{}):null]}),l?(0,Z.jsxs)(`div`,{"data-slot":`task-row-actions`,className:q_,children:[i?(0,Z.jsx)(ia,{pinned:!!e.pinned,onToggle:t=>i(e,t),className:J_}):null,c&&a?(0,Z.jsx)(a_,{archived:!!e.archived,onToggle:t=>a(e,t),className:J_}):null]}):null]})});function nv(){let e=E(),t=Nr(),n=ge(t,e.data?.bootProject??null),[r]=Xp(),i=X.useMemo(()=>n.data?L_(n.data,r):void 0,[n.data,r]),a=E_(),o=jr(Kr().pathname)!==null,s=a&&(o||t===null||t===e.data?.bootProject),c=Wr(`/tasks/:id/*`),l=Wr(`/tasks/:id`),u=Ql(3e4),d=vn(`sidebar`),f=X.useCallback((e,t)=>d.mutate({id:e.id,pinned:t},{onError:e=>Y(e.message,{tone:`danger`})}),[d.mutate]),p=rn(`sidebar`),m=X.useCallback((e,t)=>p.mutate({id:e.id,archived:t},{onError:e=>Y(e.message,{tone:`danger`})}),[p.mutate]),h=Wt(),g=rt(),_=X.useMemo(()=>i?$_(i):[],[i]),v=X.useMemo(()=>h===void 0?[]:_.flatMap(e=>xe(e).map(e=>({projectId:h,kind:e.kind,number:e.number}))),[_,h]);return i?(0,Z.jsx)(Ca,{projectId:h,requests:v,children:(0,Z.jsxs)(K_.Provider,{value:g,children:[s?(0,Z.jsx)(y_,{compact:!0}):null,(0,Z.jsx)(ev,{runs:i,currentRunId:c?.params.id??l?.params.id??null,now:u,onTogglePin:f,onToggleArchive:m})]})}):null}var rv={claude:!0,codex:!0,junie:!0,opencode:!0,cursor:!0,pi:!0,copilot:!0,omp:!0,antigravity:!0,gemini:!0,kimi:!0},iv=e=>Object.hasOwn(rv,e.name);function av(e){let t=e.checks.filter(iv);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`:e.disk?.level===`critical`?`disk almost full — ${ov(e.disk.freeBytes)} free`:null}function ov(e){return v(e)||`under 100 MB`}function sv(e){let t=e.disk;if(!t||t.level===`ok`)return null;let n=t.worktreesBytes?` Task worktrees use ${v(t.worktreesBytes)}.`:``,r=t.level===`critical`?` New agents will not start until space is freed.`:``;return`Only ${ov(t.freeBytes)} free on the disk holding task worktrees.${n}${r} Reclaim finished tasks' worktrees (branches are kept) or delete old tasks.`}function cv(e){let t=`cezar v${e.version}`,n=av(e);if(n)return`${t} · ${n}`;let r=e.disk?.level===`low`?` · low disk space (${ov(e.disk.freeBytes)} free)`:``,i=e.checks.filter(e=>!e.available).map(e=>e.name);return r?`${t}${r}`:i.length?`${t} · optional: ${i.join(`, `)} not installed`:t}function lv(e){return e===void 0||e?.available?null:e?e.available===void 0?null:`GitHub is unreachable — ${e.reason??`unknown reason`}. The GitHub tab can retry.`:`No GitHub remote detected — the GitHub tab is hidden. Every plain-git feature still works.`}function uv(e){return av(e)||sv(e)?`pending`:`success`}function dv({health:e,forge:t}){let n=lv(t),r=sv(e);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($a,{className:`eyebrow text-soft-foreground`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,Z.jsx)(fv,{check:e},e.name):(0,Z.jsx)(mv,{check:e},e.name)),n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(eo,{}),(0,Z.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-meta leading-snug text-muted-foreground`,children:n})]}):null,r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(eo,{}),(0,Z.jsx)(`p`,{"data-slot":`disk-note`,className:`px-2 pt-1.5 text-meta leading-snug text-muted-foreground`,children:r}),(0,Z.jsx)(ro,{asChild:!0,children:(0,Z.jsx)(G,{to:`/settings/worktrees`,"data-slot":`disk-reclaim`,className:`text-meta font-semibold text-violet`,children:`Manage worktrees →`})})]}):null,(0,Z.jsx)(eo,{}),(0,Z.jsx)(ro,{asChild:!0,children:(0,Z.jsxs)(U,{to:pv,"data-slot":`tools-settings`,className:`gap-2 text-label text-muted-foreground`,children:[(0,Z.jsx)(po,{className:`size-3.5`,"aria-hidden":`true`}),`Agent accounts`]})})]})}function fv({check:e}){return(0,Z.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,Z.jsx)(Pl,{tone:`success`}),(0,Z.jsx)(`span`,{className:`font-mono text-label font-medium`,children:e.name}),(0,Z.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-meta font-medium text-muted-foreground tabular-nums`,children:e.version??`not found`})]})}var pv=`/settings/global/accounts`;function mv({check:e}){let t=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Pl,{tone:`danger`}),(0,Z.jsx)(`span`,{className:`font-mono text-label font-medium`,children:e.name}),(0,Z.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-meta font-medium text-muted-foreground`,children:`not found`})]}),e.hint||iv(e)?(0,Z.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[e.hint?(0,Z.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-meta leading-snug text-muted-foreground`,children:e.hint}):null,iv(e)?(0,Z.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-meta font-semibold text-violet`,children:`Set up →`}):null]}):null]});return iv(e)?(0,Z.jsx)(ro,{asChild:!0,children:(0,Z.jsx)(U,{to:`${pv}?agent=${encodeURIComponent(e.name)}`,"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:t})}):(0,Z.jsx)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex flex-col items-stretch gap-1 rounded-sm px-2 py-1.5`,children:t})}function hv(e){return e.unread>0&&e.pendingActions>0?`approval`:e.unread>0&&e.pendingQuestions>0?`question`:e.important>0?`news`:null}function gv(e){return e.pendingActions+e.pendingQuestions+e.important}var _v=e=>e!==`news`,vv={approval:`Approval`,question:`Question`,news:`News`},yv={approval:`needs an approval`,question:`has a question`,news:`has news`},bv={approval:`asks for an approval`,question:`has a question`,news:`has news`};function xv(e,t){return t===`news`?e.headline??e.preview??`New message`:e.preview??zs(e)}function Sv(e,t){return`${e.name} ${bv[t]}: ${xv(e,t)}`}var Cv=`cez-manager-heads-seen`,wv=`cez-manager-heads-later`;function Tv(e){try{let t=JSON.parse(sessionStorage.getItem(e)??`{}`);return typeof t!=`object`||!t||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).filter(e=>typeof e[1]==`number`))}catch{return{}}}function Ev(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch{}}function Dv(e,t){let n=e[t.id];return n!==void 0&&gv(t)<=n}function Ov(e,t){let n={},r=!1;for(let[i,a]of Object.entries(e)){let e=t.find(e=>e.id===i),o=e?gv(e):0;if(o===0){r=!0;continue}n[i]=Math.min(a,o),n[i]!==a&&(r=!0)}return r?n:e}function kv(e,t){let n=e=>Date.parse(e.lastActivityAt??e.createdAt)||0;return e.flatMap(e=>{let n=hv(e);return n&&!Dv(t,e)?[{manager:e,kind:n}]:[]}).sort((e,t)=>n(e.manager)-n(t.manager))}function Av(e,t,n){return{arrivals:n.filter(t=>gv(t.manager)>(e[t.manager.id]??0)),seen:Object.fromEntries(t.map(e=>[e.id,gv(e)]))}}var jv=`cez-manager-heads`,Mv=`cez-manager-heads-change`;function Nv(){try{return localStorage.getItem(jv)!==`off`}catch{return!0}}function Pv(e){try{localStorage.setItem(jv,e?`on`:`off`)}catch{}window.dispatchEvent(new Event(Mv))}function Fv(e){return window.addEventListener(Mv,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(Mv,e),window.removeEventListener(`storage`,e)}}function Iv(){return(0,X.useSyncExternalStore)(Fv,Nv,()=>!0)}var Lv=8e3,Rv=12,zv=16,Bv=`[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]`,Vv=[`[data-slot="thread-dock"]`,`[data-slot="phone-bottom-bar"]`,`[data-slot="new-task-fab"]`],Hv=e=>e.width>0||e.height>0;function Uv(){let e=Vv.flatMap(e=>{let t=document.querySelector(e)?.getBoundingClientRect();return t&&Hv(t)?[{selector:e,rect:t}]:[]}),t=e.length===0?null:Math.min(...e.map(({rect:e})=>e.top)),n=e.find(({selector:e})=>e===Vv[0])?.rect;return{dialogOpen:document.querySelector(Bv)!==null,bottom:t===null?null:Math.round(window.innerHeight-t+Rv),right:n?Math.max(zv,Math.round(window.innerWidth-n.right+zv)):zv}}var Wv=(e,t)=>e.dialogOpen===t.dialogOpen&&e.bottom===t.bottom&&e.right===t.right;function Gv(e){let[t,n]=(0,X.useState)({dialogOpen:!1,bottom:null,right:zv});return(0,X.useEffect)(()=>{if(!e)return;let t=[],r=()=>{let e=Uv();n(t=>Wv(t,e)?t:e);let r=Vv.flatMap(e=>{let t=document.querySelector(e);return t?[t]:[]});(r.length!==t.length||r.some((e,n)=>e!==t[n]))&&(i.disconnect(),r.forEach(e=>i.observe(e)),t=r)},i=new ResizeObserver(r);r();let a=new MutationObserver(r);return a.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-state`]}),window.addEventListener(`resize`,r),()=>{a.disconnect(),i.disconnect(),window.removeEventListener(`resize`,r)}},[e]),t}function Kv(){let{pathname:e}=Kr(),t=E().data?.capabilities.managers===!0,n=Iv(),r=ii(!1).data?.managers,i=t&&n&&r!==void 0&&!Ps(e),a=Gv(i);return!i||a.dialogOpen?null:(0,Z.jsx)(Yv,{managers:r,bottom:a.bottom,right:a.right})}var qv=(e,t)=>`/manager/${encodeURIComponent(e.id)}${t&&_v(t)?`#needs-you`:``}`,Jv=e=>e===null?`calc(${zv}px + env(safe-area-inset-bottom, 0px))`:`${e}px`;function Yv({managers:e,bottom:t,right:n}){let[r,a]=(0,X.useState)(()=>Tv(wv)),o=Ov(r,e);(0,X.useEffect)(()=>{o!==r&&(a(o),Ev(wv,o))},[o,r]);let s=(0,X.useMemo)(()=>kv(e,o),[e,o]),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(null),[m,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(null);(0,X.useEffect)(()=>{let{arrivals:t,seen:n}=Av(Tv(Cv),e,s);if(Ev(Cv,n),t.length===0)return;l(t.map(e=>Sv(e.manager,e.kind)).join(` `));let r=t.filter(e=>_v(e.kind)).at(-1);r&&(d(r.manager.id),_(null))},[e,s]),(0,X.useEffect)(()=>{if(u===null)return;let e=setTimeout(()=>d(null),Lv);return()=>clearTimeout(e)},[u]);let v=(0,X.useCallback)(e=>{let t={...o,[e.id]:gv(e)};a(t),Ev(wv,t),d(t=>t===e.id?null:t)},[o]),y=(0,X.useRef)(null),b=(0,X.useRef)(null);(0,X.useEffect)(()=>{let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.shiftKey||e.code!==`KeyM`)return;let t=y.current&&y.current.checkVisibility?.()!==!1?y.current:b.current;t&&(e.preventDefault(),t.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let x=i().data?.projects,S=(0,X.useCallback)(e=>x?.find(t=>t.id===e)?.name,[x]),C=s.slice(-2),w=s.length-C.length,T=[f,m,u].find(e=>e!==null&&e!==g)??null,E=s.at(-1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{"aria-live":`polite`,"data-slot":`manager-heads-announcer`,className:`sr-only`,children:c}),C.length>0?(0,Z.jsxs)(`div`,{"data-slot":`manager-heads`,style:{right:`calc(${n}px + env(safe-area-inset-right, 0px))`,bottom:Jv(t)},className:`pointer-events-none fixed z-20 flex flex-col items-end gap-2 max-md:hidden`,children:[w>0?(0,Z.jsxs)(U,{to:`/manager`,"data-slot":`manager-heads-more`,"aria-label":`${w} more ${w===1?`manager`:`managers`} waiting`,className:`pointer-events-auto rounded-full bg-card px-2 py-0.5 text-meta font-semibold text-muted-foreground shadow-md outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[`+`,w]}):null,C.map((e,t)=>{let n=e.manager.id,r=t===C.length-1;return(0,Z.jsxs)(`div`,{"data-slot":`manager-head-row`,"data-manager-id":n,className:`pointer-events-auto flex items-end gap-2.5`,onMouseEnter:()=>{p(n),_(null)},onMouseLeave:()=>p(e=>e===n?null:e),onFocus:()=>h(n),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(h(e=>e===n?null:e),_(e=>e===n?null:e))},onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),d(e=>e===n?null:e),_(n))},children:[T===n?(0,Z.jsx)(Zv,{head:e,project:js(e.manager.projects,S),onDismiss:()=>v(e.manager)}):null,(0,Z.jsx)(Xv,{head:e,large:r,arriving:u===n,onOpen:()=>v(e.manager),ref:r?y:void 0})]},n)})]}):null,E?(0,Z.jsxs)(U,{ref:b,to:qv(E.manager,E.kind),"data-slot":`manager-head-pill`,onClick:()=>v(E.manager),style:{bottom:Jv(t)},className:`fixed left-1/2 z-20 flex max-w-[calc(100%-32px)] -translate-x-1/2 items-center gap-2 rounded-full border border-border bg-card py-1 pr-2.5 pl-1 text-label whitespace-nowrap shadow-md outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 md:hidden`,children:[(0,Z.jsx)(go,{avatar:E.manager.avatar,mascot:E.manager.mascot,sizes:`24px`,className:`size-6 rounded-full object-cover`}),(0,Z.jsxs)(`span`,{className:`truncate`,children:[(0,Z.jsx)(`span`,{className:`font-semibold`,children:E.manager.name}),` `,yv[E.kind]]}),(0,Z.jsx)(Ga,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`})]}):null]})}function Xv({head:e,large:t,arriving:n,onOpen:r,ref:i}){let{manager:a,kind:o}=e;return(0,Z.jsxs)(U,{ref:i,to:qv(a,o),onClick:r,"data-slot":`manager-head`,"data-kind":o,"aria-label":`${a.name} ${yv[o]}`,className:H(`relative block shrink-0 rounded-full bg-card p-0.5 shadow-md outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t?`size-11`:`size-9`,n&&`motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-bottom-2 motion-safe:duration-500`),children:[(0,Z.jsx)(go,{avatar:a.avatar,mascot:a.mascot,sizes:t?`40px`:`32px`,className:H(`rounded-full object-cover`,t?`size-10`:`size-8`)}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`manager-head-badge`,className:H(`absolute -top-px -right-px size-3 rounded-full border-2 border-card`,_v(o)?`bg-info`:`bg-violet`)})]})}function Zv({head:e,project:t,onDismiss:n}){let{manager:r,kind:i}=e;return(0,Z.jsxs)(`div`,{role:`group`,"aria-label":`${r.name}: ${vv[i]}`,"data-slot":`manager-head-bubble`,className:`grid w-[262px] gap-2 rounded-[12px_12px_4px_12px] border border-border bg-card px-3 py-2.5 shadow-md motion-safe:animate-in motion-safe:fade-in-0`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-meta text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`truncate text-label font-semibold text-foreground`,children:r.name}),t?(0,Z.jsxs)(`span`,{className:`truncate`,children:[`· `,t]}):null,(0,Z.jsx)(`span`,{"data-slot":`manager-head-kind`,className:H(`ml-auto shrink-0 rounded-full px-[7px] py-px text-micro font-semibold`,_v(i)?`bg-info/10 text-info`:`bg-violet/10 text-violet`),children:vv[i]})]}),(0,Z.jsx)(`p`,{"data-slot":`manager-head-line`,className:`line-clamp-2 text-label text-foreground`,children:xv(r,i)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(q,{asChild:!0,size:`sm`,children:(0,Z.jsx)(U,{to:qv(r,i),onClick:n,"data-slot":`manager-head-open`,children:`Open chat`})}),(0,Z.jsx)(q,{size:`sm`,variant:`ghost`,onClick:n,"data-slot":`manager-head-later`,children:`Later`}),(0,Z.jsx)(Xo,{className:`ml-auto`,children:Ds(`Alt+M`)})]})]})}var Qv=(0,X.memo)(function({manager:e,active:t,now:n,onNavigate:r,state:i,source:a=`sidebar`}){let o=Rs(e),s=ks(e);return(0,Z.jsxs)(U,{to:`/manager/${encodeURIComponent(e.id)}`,state:i,"data-slot":`manager-row`,"data-unread":o?!0:void 0,"data-attention":o??void 0,"aria-current":t?`page`:void 0,onClick:()=>{Dc(a),r?.()},className:H(`flex min-h-16 items-center gap-2.5 rounded-xl px-2 py-1.5 outline-none transition-colors hover:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50`,t&&`bg-muted`),children:[(0,Z.jsx)(go,{avatar:e.avatar,mascot:e.mascot}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsxs)(`span`,{className:H(`min-w-0 flex-1 truncate text-ui`,o?`font-semibold text-foreground`:`font-medium`),children:[e.name,o?(0,Z.jsx)(`span`,{"data-slot":`unread-marker`,className:`sr-only`,children:Ls[o]}):null]}),(0,Z.jsx)(`span`,{className:`shrink-0 text-meta text-muted-foreground`,children:Ms(e.lastActivityAt,new Date(n))})]}),(0,Z.jsx)(`span`,{className:`block truncate text-meta text-muted-foreground`,children:zs(e)})]}),o===`needs-you`?(0,Z.jsx)(`span`,{"data-slot":`manager-unread`,"data-attention":o,"aria-hidden":`true`,className:`flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full bg-info px-1.5 text-micro font-semibold text-background`,children:s}):o?(0,Z.jsx)(`span`,{"data-slot":`manager-unread`,"data-attention":o,className:H(`size-2 shrink-0 rounded-full`,Is[o]),"aria-hidden":`true`}):null]})});function $v(){let e=E().data?.capabilities.managers,t=ii(e===!0),n=t.data?.managers;return{ordered:(0,X.useMemo)(()=>ei(n??[]),[n]),loading:t.isPending&&e!==!1,isFetching:t.isFetching,isError:t.isError}}var ey=(0,X.memo)(function({manager:e,active:t}){let n=Rs(e);return(0,Z.jsxs)(U,{to:`/manager/${encodeURIComponent(e.id)}`,"data-slot":`manager-rail-item`,"data-unread":n?!0:void 0,"data-attention":n??void 0,"aria-current":t?`page`:void 0,"aria-label":n?`${e.name}${Ls[n]}`:e.name,title:e.name,onClick:()=>Dc(`sidebar`),className:H(`relative flex size-9 shrink-0 items-center justify-center rounded-md outline-none transition-colors hover:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50`,t&&`bg-muted ring-1 ring-border`),children:[(0,Z.jsx)(go,{avatar:e.avatar,mascot:e.mascot,className:`size-7`}),n?(0,Z.jsx)(`span`,{"data-slot":`manager-unread`,"data-attention":n,className:H(`absolute top-0.5 right-0.5 size-2 rounded-full ring-2 ring-sidebar`,Is[n]),"aria-hidden":`true`}):null]})});function ty(){let{pathname:e}=Kr(),{ordered:t}=$v();return t.length===0?null:(0,Z.jsx)(`nav`,{"aria-label":`Managers`,"data-slot":`manager-rail`,className:`flex min-h-0 flex-col items-center gap-1 overflow-y-auto overscroll-contain pt-2`,children:t.map(t=>(0,Z.jsx)(ey,{manager:t,active:e===`/manager/${encodeURIComponent(t.id)}`},t.id))})}var ny=(0,X.memo)(function({manager:e,active:t,now:n,onNavigate:r}){let i=Rs(e),a=Ml(e.lastActivityAt??e.createdAt,n);return(0,Z.jsxs)(U,{to:`/manager/${encodeURIComponent(e.id)}`,"data-slot":`manager-row`,"data-attention":i??void 0,"aria-current":t?`page`:void 0,onClick:()=>{Dc(`sidebar`),r?.()},className:H(`grid grid-cols-[30px_minmax(0,1fr)_auto] items-center gap-2.5 rounded-md px-2 py-1.5 outline-none transition-colors hover:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50 max-md:min-h-11`,t&&`bg-muted`),children:[(0,Z.jsx)(go,{avatar:e.avatar,mascot:e.mascot,className:`size-[30px]`,sizes:`30px`}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsxs)(`span`,{className:H(`block truncate text-ui text-foreground`,i?`font-semibold`:`font-medium`),children:[e.name,i?(0,Z.jsx)(`span`,{"data-slot":`unread-marker`,className:`sr-only`,children:Ls[i]}):null]}),(0,Z.jsx)(`span`,{"data-slot":`manager-row-preview`,className:H(`block truncate text-label`,i===`needs-you`?`text-info`:`text-muted-foreground`),children:zs(e)})]}),(0,Z.jsxs)(`span`,{className:`flex flex-col items-end gap-1`,children:[i?(0,Z.jsx)(`span`,{"data-slot":`manager-unread`,"data-attention":i,className:H(`size-1.5 rounded-full`,Is[i]),"aria-hidden":`true`}):null,a?(0,Z.jsx)(`span`,{"data-slot":`manager-row-age`,className:`text-meta text-muted-foreground tabular-nums`,children:a}):null]})]})}),ry=(0,X.lazy)(()=>Dr(()=>import(`./manager-settings-Bv2EqZvs.js`).then(e=>({default:e.JobsDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42])));function iy({manager:e}){let[t,n]=(0,X.useState)(!1),r=(0,X.useRef)(null),i=Yr(e.id);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{ref:r,type:`button`,"data-slot":`manager-sidebar-jobs`,"aria-haspopup":`dialog`,onClick:()=>n(!0),className:Nh,children:[(0,Z.jsx)(fo,{className:`size-4 shrink-0`,"aria-hidden":`true`}),`Jobs`,e.jobs.length>0?(0,Z.jsx)(`span`,{className:ay,children:e.jobs.length}):null]}),t?(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(ry,{manager:e,open:!0,onOpenChange:e=>{e||n(!1)},onCloseAutoFocus:e=>{e.preventDefault(),r.current?.focus()},onSave:e=>i.mutateAsync({jobs:e})})}):null]})}var ay=`ml-auto rounded-full bg-muted px-1.5 py-px text-micro font-semibold text-muted-foreground tabular-nums`;function oy(){let{pathname:e}=Kr(),t=yh(),{ordered:n,loading:r,isFetching:i,isError:a}=$v(),o=Ql(6e4),s=/^\/manager\/([^/?#]+)$/.exec(e)?.[1],c=s===void 0||s===`new`?void 0:n.find(e=>e.id===decodeURIComponent(s)),l=n.reduce((e,t)=>e+ks(t),0),u=n.find(e=>ks(e)>0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`px-3 pb-2`,children:(0,Z.jsx)(q,{asChild:!0,variant:`primary`,className:`w-full justify-center`,children:(0,Z.jsxs)(U,{to:`/manager/new`,"data-slot":`new-manager`,onClick:t,children:[(0,Z.jsx)(ts,{className:`size-[15px]`,"aria-hidden":`true`}),`New manager`]})})}),(0,Z.jsxs)(`div`,{"data-slot":`manager-sidebar`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pb-2`,children:[(0,Z.jsxs)(`nav`,{"aria-label":`Managers`,className:`flex flex-col gap-0.5 px-2.5`,children:[(0,Z.jsxs)(`h2`,{className:`px-2 pt-1 pb-1 eyebrow text-muted-foreground`,children:[`Managers`,r?``:` · ${n.length}`]}),(0,Z.jsx)(Tg,{queryKey:ni.list,isFetching:i,isError:a,className:`mx-2 mb-1 self-start`}),r?(0,Z.jsx)(cl,{label:`Loading managers…`,"data-slot":`manager-sidebar-loading`,children:(0,Z.jsx)(fl,{rows:3})}):n.map(e=>(0,Z.jsx)(ny,{manager:e,active:e.id===c?.id,now:o,onNavigate:t},e.id))]}),(0,Z.jsxs)(`nav`,{"aria-label":`Workspace`,"data-slot":`manager-sidebar-workspace`,className:`px-2.5`,children:[(0,Z.jsx)(`h2`,{className:`px-3 pt-3 pb-1 eyebrow text-muted-foreground`,children:`Workspace`}),u?(0,Z.jsxs)(U,{to:`/manager/${encodeURIComponent(u.id)}`,"data-slot":`manager-sidebar-approvals`,onClick:()=>{Dc(`sidebar`),t?.()},className:Nh,children:[(0,Z.jsx)(hi,{className:`size-4 shrink-0`,"aria-hidden":`true`}),`Approvals`,(0,Z.jsxs)(`span`,{className:ay,children:[l,(0,Z.jsx)(`span`,{className:`sr-only`,children:` waiting on you`})]})]}):null,c?(0,Z.jsx)(iy,{manager:c},c.id):null,(0,Z.jsxs)(U,{to:`/settings/global/manager`,"data-slot":`manager-sidebar-settings`,onClick:t,className:Nh,children:[(0,Z.jsx)(po,{className:`size-4 shrink-0`,"aria-hidden":`true`}),`Manager settings`]})]})]})]})}function sy({activeId:e}){let{ordered:t,loading:n}=$v(),r=Ql(6e4);return(0,Z.jsxs)(`aside`,{"data-slot":`manager-list-rail`,"aria-label":`Managers`,className:`flex w-60 shrink-0 flex-col border-r border-border bg-card max-md:hidden`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3.5 pt-3.5 pb-2`,children:[(0,Z.jsx)(`h2`,{className:`text-ui font-semibold`,children:`Managers`}),(0,Z.jsx)(q,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`ml-auto`,children:(0,Z.jsx)(U,{to:`/manager/new`,"aria-label":`New manager`,"data-slot":`new-manager`,children:(0,Z.jsx)(ts,{"aria-hidden":`true`})})})]}),(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto overscroll-contain px-1.5 pb-2`,children:n?(0,Z.jsx)(cl,{label:`Loading managers…`,"data-slot":`manager-sidebar-loading`,children:(0,Z.jsx)(fl,{rows:3})}):t.map(t=>(0,Z.jsx)(Qv,{manager:t,active:t.id===e,now:r},t.id))}),t.length>0?(0,Z.jsx)(`p`,{"data-slot":`manager-rail-summary`,className:`border-t border-border px-3.5 py-2.5 text-meta text-muted-foreground`,children:Bs(t)}):null]})}function cy(e){return e?.trim()||null}function ly({projectName:e,pageLabel:t,brandName:n}){let r=cy(e),i=cy(t),a=cy(n??null)??`cezar`;return r&&i?`${r} — ${i} · ${a}`:r?`${r} · ${a}`:i?`${i} · ${a}`:a}function uy(e){let t=ly(e);(0,X.useEffect)(()=>{document.title=t},[t]),(0,X.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])}function dy(e,t,n){if(e===void 0||n===void 0||t===null||t!==e.bootProject||n.bootProject!==t||n.capabilities?.localHandoff!==!0||e.projects.some(e=>e.id===t))return e;let r=n.repoRoot,i=r?.replace(/[\\/]+$/,``).split(/[\\/]/).pop();return i?{...e,projects:[{id:t,root:r,name:i,addedAt:``,lastOpenedAt:``,source:`local`,status:n.repo?`ok`:`not-git`,unregistered:!0,...n.repo?{branch:n.repo.branch}:{}},...e.projects]}:e}var fy={claude:`Anthropic’s coding agent. Uses your Claude account.`,codex:`OpenAI’s coding agent. Uses your ChatGPT account.`,opencode:`Open-source agent. Works with many model providers.`,cursor:`Cursor’s agent, without the editor. Uses your Cursor account.`,copilot:`GitHub’s coding agent. Uses your Copilot plan.`};function py(e,t){let n=new Map((t?.providers??[]).map(e=>[e.provider,e])),r=e.agents.flatMap(e=>{let t=n.get(e.provider);if(t?.status===`connected`||t?.enabled===!1)return[];let r=t===void 0||t.status===`not-installed`?`missing`:`signed-out`;return[{...e,label:Lc[e.provider],description:fy[e.provider],state:r}]});return[...r.filter(e=>e.state===`signed-out`),...r.filter(e=>e.state===`missing`)]}var my=/\u001B\][^\u0007\u001B]*(?:\u0007|\u001B\\)|\u001B\[[0-?]*[ -/]*[@-~]/g,hy=/https?:\/\/[^\s"'<>\u0007\u001B]+/g;function gy(e){let t=e.replace(my,` `).match(hy)??[];for(let e of t.reverse()){let t=_y(e.replace(/[.,;:)\]]+$/,``));if(t&&![`localhost`,`127.0.0.1`,`[::1]`].includes(t.hostname))return t.href}return null}function _y(e){try{return new URL(e)}catch{return null}}var vy=X.lazy(()=>Dr(()=>import(`./terminal-pane-DQAHtCtb.js`).then(e=>({default:e.TerminalPane})),__vite__mapDeps([43,1,2,3,4,5,44,40,41,45,46]))),yy=3e3,by=60,xy=4,Sy=1e4;function Cy(e,t){return py(e,t).some(e=>e.state===`signed-out`)?`Sign in to an agent`:`Pick your agent`}function wy({setup:e,status:t}){let n=p(),r=at(),i=zt(),a=mn(),o=a.mutateAsync,s=a.mutate,c=py(e,t),[l,u]=X.useState(e.session),[d,f]=X.useState(null),m=e.session;X.useEffect(()=>{m&&(u(m),m.exitCode===null&&f(null))},[m]);let h=r.mutate,g=X.useCallback((e,t)=>{f(null),h({provider:e,action:t},{onSuccess:e=>u(e),onError:n=>{f({provider:e,action:t,message:n.message}),s()}})},[s,h]),_=X.useRef(null),v=X.useCallback((e,t)=>{if(_.current===e.id)return;_.current=e.id;let{provider:r,action:i}=e,a=Lc[r];i===`install`&&n(),o().then(e=>{let n=e.providers.find(e=>e.provider===r);if(n?.status===`connected`)return;let o=n!==void 0&&n.status!==`not-installed`;i===`install`&&o?g(r,`login`):f(i===`login`||t?{provider:r,action:i,message:t||`The sign-in to ${a} did not finish.`}:{provider:r,action:i,message:`${a} installed, but cezar cannot find it. Restart cezar from a new terminal, or check that npm’s global folder is on your PATH.`})},()=>f({provider:r,action:i,message:`cezar could not check the agent. Try again.`}))},[g,n,o]),y=m?.exitCode??null;X.useEffect(()=>{if(!(!m||y===null)){if(m.action===`install`&&y!==0){if(_.current===m.id)return;_.current=m.id,n(),f({provider:m.provider,action:m.action,message:`${Lc[m.provider]} did not install. The terminal says why.`});return}v(m,``)}},[y,n,m,v]);let b=X.useRef(null);m&&(b.current=m.id),X.useEffect(()=>{m||!l||l.exitCode!==null||b.current!==l.id||(u(null),v(l,`The terminal closed before it finished.`))},[m,v,l]);let x=l!==null&&l.exitCode===null,S=x&&l?.action===`install`,C=x&&l?.action===`login`;X.useEffect(()=>{if(!C)return;let e=0,t=window.setInterval(()=>{e+=1,(e<=by||e%xy===0)&&s()},yy);return()=>window.clearInterval(t)},[s,C]),X.useEffect(()=>{if(x)return;let e=window.setInterval(()=>s(),Sy);return()=>window.clearInterval(e)},[s,x]);let w=X.useRef(null);w.current=C&&l?l.id:null;let T=X.useRef(!1);X.useEffect(()=>(T.current=!0,()=>{T.current=!1;let e=w.current;window.setTimeout(()=>{!T.current&&e&&Ve(e).catch(()=>{})},0)}),[]);let E=()=>{l&&i.mutate(l.id),u(null)},D=()=>{f(null),x||u(null)};return(0,Z.jsx)(`div`,{className:`mt-7 flex w-full flex-col gap-3 text-left`,children:c.map(e=>{let t=l?.provider===e.provider,n=d?.provider===e.provider?d:null,i=x||r.isPending;return(0,Z.jsxs)(`div`,{"data-slot":`agent-row`,"data-state":e.state,"data-provider":e.provider,className:`rounded-xl border border-border bg-card p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`text-lead text-foreground`,children:e.label}),(0,Z.jsx)(`div`,{className:`text-ui text-muted-foreground`,children:e.state===`missing`?e.description:`Installed, not signed in`})]}),(0,Z.jsx)(Ty,{row:e,open:t,busy:i,onStart:g})]}),!t&&!n&&e.state===`missing`&&e.installCommand===null?(0,Z.jsx)(`p`,{className:`mt-3 text-ui text-soft-foreground`,children:e.installHint}):null,!t&&!n&&e.state===`missing`&&e.installCommand?(0,Z.jsx)(Ey,{command:e.installCommand}):null,t&&l?(0,Z.jsx)(Dy,{session:l,running:x,installing:S},l.id):null,n&&!t?(0,Z.jsx)(Ey,{command:(n.action===`install`?e.installCommand:e.loginCommand)??``}):null,n?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsx)(`p`,{role:`alert`,className:`min-w-0 flex-1 text-ui text-danger`,children:n.message}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(q,{size:`sm`,variant:`outline`,className:`font-normal`,onClick:D,children:`Close`}),(0,Z.jsx)(q,{size:`sm`,className:`font-normal`,disabled:r.isPending,onClick:()=>g(n.provider,n.action),children:`Try again`})]})]}):null,t&&x?(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`p`,{className:`text-ui text-soft-foreground`,children:S?`Sign-in comes next.`:`This page continues by itself.`}),(0,Z.jsx)(q,{size:`sm`,variant:`outline`,className:`font-normal`,onClick:E,children:`Cancel`})]}):null]},e.provider)})})}function Ty({row:e,open:t,busy:n,onStart:r}){return t?null:e.state===`signed-out`?(0,Z.jsx)(q,{className:`font-normal`,disabled:n||e.loginCommand===null,onClick:()=>r(e.provider,`login`),children:`Sign in`}):e.installCommand===null?null:(0,Z.jsx)(q,{className:`font-normal`,disabled:n,onClick:()=>r(e.provider,`install`),children:`Install`})}function Ey({command:e}){return(0,Z.jsxs)(`code`,{className:`mt-3 block truncate font-mono text-meta text-soft-foreground`,title:e,children:[(0,Z.jsx)(`span`,{className:`select-none`,children:`$ `}),e]})}function Dy({session:e,running:t,installing:n}){let[r,i]=X.useState(null),o=e.id,s=X.useRef(``),c=e.action===`login`,l=X.useMemo(()=>({read:async e=>{let t=await Pn(o,e);return c&&t.data&&(s.current=(s.current+t.data).slice(-16384),i(gy(s.current))),t},write:e=>a(o,e),resize:(e,t)=>_(o,e,t)}),[o,c]),u=X.useMemo(()=>({id:o,exitCode:t?null:e.exitCode,topic:t?e.topic:null}),[o,t,e.exitCode,e.topic]),d=Lc[e.provider];return(0,Z.jsxs)(`div`,{"data-slot":`agent-setup-terminal`,className:`mt-3 flex flex-col gap-2`,children:[t?(0,Z.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-ui text-muted-foreground`,children:[(0,Z.jsx)(Mo,{className:`size-3.5 shrink-0 motion-safe:animate-spin`,"aria-hidden":`true`}),n?e.command.startsWith(`sudo `)?`Installing ${d}. Click the terminal and type your computer password if it asks.`:`Installing ${d}…`:`Sign in to ${d}. Click the terminal to answer its questions.`]}):null,(0,Z.jsx)(Ey,{command:e.command}),(0,Z.jsx)(`div`,{className:`relative h-72 overflow-hidden rounded-lg border border-border bg-card-2`,children:(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(vy,{runId:e.runId,session:u,active:!0,io:l})})}),c&&r&&t?(0,Z.jsx)(q,{asChild:!0,size:`sm`,variant:`outline`,className:`self-start font-normal`,children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,children:[`Open sign-in page`,(0,Z.jsx)(xo,{"aria-hidden":`true`})]})}):null]})}function Oy(){let e=V();return X.useCallback(t=>{let n=R.uiState,r=e.getQueryData(n),i={...r?.onboarding,...typeof t==`function`?t(r?.onboarding):t};e.setQueryData(n,{...r,onboarding:i}),$t({onboarding:i}).then(t=>e.setQueryData(n,t)).catch(t=>{e.setQueryData(n,r),Y(t instanceof Error?t.message:String(t),{tone:`danger`})})},[e])}function ky({title:e,slot:t,rail:n,why:r,subtitle:i,banner:a,wide:o=!1,children:s}){return(0,Z.jsxs)(`section`,{"data-onboarding":``,"data-slot":`first-run`,"data-first-run":t,className:H(`mx-auto flex w-full flex-1 flex-col items-center px-1 pt-6 pb-12 text-center md:pt-12`,o?`max-w-3xl`:`max-w-2xl`),children:[a,n,(0,Z.jsx)(`h2`,{className:H(`text-4xl font-light tracking-tight text-balance text-foreground`,n&&`mt-8`),children:e}),r?(0,Z.jsx)(`p`,{className:`mt-3 max-w-md text-lead text-muted-foreground`,children:r}):null,i?(0,Z.jsx)(`p`,{className:`mt-2 text-body text-muted-foreground`,children:i}):null,s]})}var Ay=`inline-flex items-center gap-1.5 text-ui text-muted-foreground transition-colors hover:text-foreground`,jy=`inline-flex h-[30px] items-center gap-1.5 rounded-full border border-border px-3 text-label text-muted-foreground transition-colors hover:border-muted-foreground hover:text-foreground`,My=`inline-flex h-8 items-center gap-2 rounded-full px-3 text-ui text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`;function Ny(){let[e,t]=X.useState(0);return X.useLayoutEffect(()=>{let e=()=>{let e=document.querySelector(`aside[data-slot="sidebar"]`);t(e?Math.max(0,e.getBoundingClientRect().right)/2:0)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function Py({title:e,description:t,onOpenChange:n,onSubmit:r,footer:i,wide:a=!1,children:o}){let s=Ny();return(0,Z.jsx)(ol,{open:!0,onOpenChange:n,children:(0,Z.jsxs)(rl,{"data-onboarding":``,className:H(`gap-0 p-0`,a?`sm:max-w-lg`:`sm:max-w-md`),style:s?{left:`calc(50% + ${s}px)`}:void 0,onKeyDown:e=>{r&&e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),r())},children:[(0,Z.jsxs)(tl,{className:`border-b border-border px-6 py-5 text-left`,children:[(0,Z.jsx)(il,{className:`text-xl font-light tracking-tight`,children:e}),(0,Z.jsx)(al,{children:t})]}),(0,Z.jsx)(`div`,{className:`px-6 py-5 text-left`,children:o}),(0,Z.jsx)(nl,{className:`border-t border-border px-6 py-4`,children:i})]})})}function Fy({title:e,description:t,pages:n,slot:r,onOpenChange:i}){let[a,o]=X.useState(0),s=n[Math.min(a,n.length-1)];if(!s)return null;let c=a>=n.length-1,l=()=>c?i(!1):o(a+1);return(0,Z.jsx)(Py,{wide:!0,title:e,description:t,onOpenChange:i,onSubmit:l,footer:(0,Z.jsxs)(`div`,{className:`flex w-full items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`mr-auto flex items-center gap-1.5`,"aria-label":`${a+1} of ${n.length}`,children:n.map((e,t)=>(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:H(`h-1.5 rounded-full transition-all`,t===a?`w-4 bg-violet`:`w-1.5 bg-border`)},e.id))}),a>0?(0,Z.jsx)(q,{variant:`outline`,className:`font-normal`,onClick:()=>o(a-1),children:`Back`}):null,(0,Z.jsx)(q,{className:`font-normal`,onClick:l,children:c?`Done`:`Next`})]}),children:(0,Z.jsxs)(`div`,{"data-slot":r,"data-page":s.id,onKeyDown:e=>{e.key===`ArrowRight`&&!c&&o(a+1),e.key===`ArrowLeft`&&a>0&&o(a-1)},children:[(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`onboarding-preview flex h-44 items-end justify-center overflow-hidden rounded-lg border border-border px-8 pt-6`,children:s.picture}),(0,Z.jsxs)(`div`,{className:`mt-5 flex min-h-28 flex-col`,children:[(0,Z.jsx)(`h3`,{className:`text-lg font-light tracking-tight text-foreground`,children:s.title}),(0,Z.jsx)(`p`,{className:`mt-1 text-ui text-muted-foreground`,children:s.body}),s.action?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{i(!1),s.action?.onClick()},className:`mt-3 inline-flex items-center gap-1 self-start text-ui text-violet hover:underline`,children:[s.action.label,(0,Z.jsx)(pa,{className:`size-3.5`,"aria-hidden":`true`})]}):null]})]})})}function Iy({title:e,description:t,picture:n,recommended:r=!1,badge:i=`Start here`,onClick:a}){return(0,Z.jsxs)(`button`,{type:`button`,onClick:a,"data-recommended":r||void 0,className:H(`group relative flex flex-col items-center gap-4 rounded-xl border px-4 pt-7 pb-5 text-center transition-colors`,r?`onboarding-announcement`:`border-border bg-card hover:border-muted-foreground`),children:[r?(0,Z.jsx)(`span`,{className:`absolute top-3 right-3 eyebrow text-violet`,children:i}):null,(0,Z.jsx)(`span`,{className:`grid h-16 place-items-center`,"aria-hidden":`true`,children:n}),(0,Z.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-lg font-light text-foreground`,children:e}),(0,Z.jsx)(`span`,{className:`text-label text-muted-foreground`,children:t})]})]})}function Ly({title:e,description:t,picture:n,value:r,selected:i,disabled:a=!1,reason:o,onClick:s}){return(0,Z.jsxs)(`button`,{type:`button`,"data-value":r,"aria-pressed":i,"aria-label":e,disabled:a,title:o,onClick:s,className:H(`flex items-center gap-3 rounded-xl border px-4 py-3 text-left transition-colors disabled:opacity-50`,i?`onboarding-announcement border-violet/60`:`border-border bg-card hover:border-muted-foreground`),children:[(0,Z.jsx)(`span`,{className:`grid size-12 shrink-0 place-items-center`,"aria-hidden":`true`,children:n}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-lead text-foreground`,children:e}),(0,Z.jsx)(`span`,{className:`text-label text-muted-foreground`,children:t})]})]})}function Ry({steps:e}){return(0,Z.jsx)(`ol`,{"data-slot":`step-rail`,className:`flex items-center gap-2 text-label`,children:e.map((e,t)=>(0,Z.jsxs)(`li`,{"data-step":e.id,"data-state":e.state,className:`flex items-center gap-2`,children:[t>0?(0,Z.jsx)(`span`,{className:H(`h-px w-6`,e.state===`next`?`bg-border`:`bg-violet/60`),"aria-hidden":`true`}):null,(0,Z.jsxs)(`span`,{className:H(`inline-flex items-center gap-1.5`,e.state===`current`?`text-foreground`:e.state===`done`?`text-muted-foreground`:`text-soft-foreground`),children:[(0,Z.jsx)(`span`,{className:H(`grid size-5 place-items-center rounded-full border font-mono text-micro`,e.state===`done`&&`border-violet/60 bg-violet/15 text-violet`,e.state===`current`&&`border-violet text-foreground`,e.state===`next`&&`border-border text-soft-foreground`),"aria-hidden":`true`,children:e.state===`done`?(0,Z.jsx)(Wa,{className:`size-3`}):t+1}),e.label,e.state===`current`?(0,Z.jsx)(`span`,{className:`sr-only`,children:`(current step)`}):null]})]},e.id))})}function zy({bar:e,children:t,className:n}){return(0,Z.jsxs)(`div`,{className:H(`w-full max-w-xs rounded-t-lg border border-b-0 border-border bg-background shadow-[0_-12px_40px_-20px_var(--violet)]`,n),children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border px-3 py-2`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),e]}),(0,Z.jsx)(`div`,{className:`p-3`,children:t})]})}var By=`h-2 rounded bg-muted`;function Vy(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 Hy(e){let t=new URLSearchParams;e.skill&&t.set(`skill`,e.skill),e.ref&&t.set(`ref`,e.ref),e.todo&&t.set(`todo`,e.todo);let n=t.toString();return n?`/new?${n}`:`/new`}function Uy(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Wy(e,t=[]){let n=Uy(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Gy(t)),n}function Gy(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function Ky(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function qy(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function Jy(e,t,n){let r=(n??``).trim();if(!r)return Wy(e,t);let i=Uy(e),a=r.startsWith(i)?i+Ky(r.slice(i.length),e):Ky(r,e),o=qy(a,e)?a:`${i}\n\n${a}`;return t.length?o+Gy(t):o}function Yy(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function Xy(e,t,n,r,i={}){return t?{...i,workflow:t,task:Jy(e,n,r)}:n.length?{...i,steps:Yy(n),task:Jy(e,[],r)}:{...i,workflow:`quick-task`,task:Jy(e,[],r)}}function Zy(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function Qy(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function $y(e,t){let n=t===`oldest`?1:-1;return[...e].sort((e,t)=>e.createdAt===t.createdAt?(e.number-t.number)*n:e.createdAt<t.createdAt?-n:n)}function eb(e,t){return e.trim()!==``&&t===0}function tb(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function nb({gitRepo:e}){let t=Mt(),n=Et().data?.onboarding?.agentCheckSkipped===!0;return t.data===void 0&&!n?null:hc(t.data)===!1&&!n?(0,Z.jsx)(Pb,{}):e===void 0?null:e?(0,Z.jsx)(xb,{}):(0,Z.jsx)(Vb,{})}function rb({step:e,...t}){return(0,Z.jsx)(ky,{...t,rail:e?(0,Z.jsx)(ab,{current:e}):void 0})}var ib=[{id:`agent`,label:`Agent`},{id:`project`,label:`Project`},{id:`task`,label:`First task`}];function ab({current:e}){let t=ib.findIndex(t=>t.id===e);return(0,Z.jsx)(`ol`,{"data-slot":`step-rail`,className:`flex items-center gap-2 text-label`,children:ib.map((e,n)=>{let r=n<t?`done`:n===t?`current`:`next`;return(0,Z.jsxs)(`li`,{"data-step":e.id,"data-state":r,className:`flex items-center gap-2`,children:[n>0?(0,Z.jsx)(`span`,{className:H(`h-px w-6`,n<=t?`bg-violet/60`:`bg-border`),"aria-hidden":`true`}):null,(0,Z.jsxs)(`span`,{className:H(`inline-flex items-center gap-1.5`,r===`current`?`text-foreground`:r===`done`?`text-muted-foreground`:`text-soft-foreground`),children:[(0,Z.jsx)(`span`,{className:H(`grid size-5 place-items-center rounded-full border font-mono text-micro`,r===`done`&&`border-violet/60 bg-violet/15 text-violet`,r===`current`&&`border-violet text-foreground`,r===`next`&&`border-border text-soft-foreground`),"aria-hidden":`true`,children:r===`done`?(0,Z.jsx)(Wa,{className:`size-3`}):n+1}),e.label,r===`current`?(0,Z.jsx)(`span`,{className:`sr-only`,children:`(current step)`}):null]})]},e.id)})})}var ob=Ay,sb=jy;function cb({children:e}){return(0,Z.jsx)(`ol`,{className:`flex list-decimal flex-col gap-2.5 pl-5 text-ui text-muted-foreground marker:text-soft-foreground`,children:e})}var lb=`https://cli.github.com`;function ub(e,t){let n=u(t),r=n.start.mutate;return X.useEffect(()=>{e&&r()},[e,r]),n}function db(e){let t=e.state;return e.start.error?fb(e.start.error)?`The GitHub CLI is not installed.`:`Sign-in did not finish.`:t?.status===`pending`?`Enter this code on GitHub. It opened in your browser.`:t?.status===`failed`?`Sign-in did not finish.`:t?.status===`done`?`Signed in.`:`Signing in through your browser.`}function fb(e){return e instanceof sn&&e.status===503}function pb(e,t){let n=navigator.clipboard?.writeText(e);if(!n){Y(t);return}n.then(()=>Y(`Copied`),()=>Y(t))}function mb({children:e}){return(0,Z.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-ui text-muted-foreground`,children:[(0,Z.jsx)(Mo,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),e]})}function hb({signIn:e}){let t=e.state;return e.start.error?fb(e.start.error)?(0,Z.jsxs)(cb,{children:[(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`a`,{href:lb,target:`_blank`,rel:`noopener noreferrer`,className:`text-violet hover:underline`,children:`Install the GitHub CLI`})}),(0,Z.jsx)(`li`,{children:`Come back and press Try again.`})]}):(0,Z.jsx)(`p`,{role:`alert`,className:`text-ui whitespace-pre-line text-danger`,children:e.start.error.message}):t?.status===`failed`?(0,Z.jsx)(`p`,{role:`alert`,className:`text-ui whitespace-pre-line text-danger`,children:t.error}):t?.status===`done`?(0,Z.jsx)(mb,{children:t.login?`Signed in as ${t.login}.`:`Signed in.`}):t?.status===`pending`?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border bg-background py-3 pr-2 pl-5`,children:[(0,Z.jsx)(`span`,{"data-testid":`github-login-code`,"aria-label":`One-time code`,className:`font-mono text-2xl tracking-widest text-foreground select-all`,children:t.code}),(0,Z.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-8 shrink-0`,"aria-label":`Copy code`,onClick:()=>pb(t.code,`Select the code and copy it`),children:(0,Z.jsx)(_o,{"aria-hidden":`true`})})]}),(0,Z.jsx)(mb,{children:`Waiting for GitHub…`})]}):(0,Z.jsx)(mb,{children:`Starting…`})}function gb({signIn:e,onClose:t}){let n=e.state;return e.start.error!==null||n?.status===`failed`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{variant:`outline`,className:`font-normal`,onClick:t,children:`Close`}),(0,Z.jsx)(q,{className:`font-normal`,onClick:()=>e.start.mutate(),disabled:e.start.isPending,children:`Try again`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{variant:`outline`,className:`font-normal`,onClick:()=>{n?.status!==`done`&&e.cancel.mutate(),t()},children:n?.status===`done`?`Close`:`Cancel`}),n?.status===`pending`?(0,Z.jsx)(q,{asChild:!0,className:`font-normal`,children:(0,Z.jsx)(`a`,{href:n.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open GitHub`})}):null]})}function _b({command:e}){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-border bg-background px-3 py-2.5`,children:[(0,Z.jsxs)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-ui text-foreground select-all`,children:[(0,Z.jsx)(`span`,{className:`text-soft-foreground select-none`,children:`$ `}),e]}),(0,Z.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"aria-label":`Copy ${e}`,onClick:()=>pb(e,`Select the command and copy it`),children:(0,Z.jsx)(_o,{"aria-hidden":`true`})})]})}var vb=`flex h-14 w-full items-center gap-3 rounded-xl border border-border bg-card px-5 transition-colors focus-within:border-primary focus-within:shadow-[0_0_0_4px_color-mix(in_srgb,var(--violet)_14%,transparent)]`,yb=[{icon:rd,label:`Fix a failing test`,task:`Find a failing or flaky test and fix it.`},{icon:Ao,label:`Summarize recent commits`,task:`Summarize the recent commits on this branch.`},{icon:wo,label:`Update the README`,task:`Update the README for the recent changes.`}],bb=[{icon:wo,label:`Write a README`,task:`Write a README that explains what this project is for and how to run it.`},{icon:rd,label:`Set up tests`,task:`Set up a test runner with one passing example test.`},{icon:Ao,label:`Add a CI workflow`,task:`Add a CI workflow that installs dependencies and runs the tests on every push.`}];function xb(){let e=Lr(),t=E(),n=_n(),r=t.data?.forge,i=S({limit:3},r?.kind===`github`&&r.available!==!1),a=i.data?.available?i.data.issues.filter(e=>e.kind===`issue`).slice(0,3):[],[o,s]=X.useState(``),c=t=>e(Hy({ref:t.trim()})),l=n.data?.info!==void 0&&n.data.info!==null&&n.data.log.length<=1&&a.length===0&&!i.isFetching,u=l?bb:yb;return(0,Z.jsxs)(rb,{title:`What should we build?`,slot:`welcome`,banner:(0,Z.jsx)(Sb,{}),children:[(0,Z.jsxs)(`form`,{className:H(vb,`mt-7`),onSubmit:e=>{e.preventDefault(),c(o)},children:[(0,Z.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:`Describe a task for the agent…`,"aria-label":`Describe a task for the agent`,className:`h-full min-w-0 flex-1 bg-transparent text-lead text-foreground outline-none placeholder:text-soft-foreground`}),(0,Z.jsx)(q,{type:`submit`,size:`icon`,variant:`ghost`,"aria-label":`Continue to the composer`,className:`size-9 shrink-0`,children:(0,Z.jsx)(pa,{"aria-hidden":`true`})})]}),(0,Z.jsx)(`div`,{className:`mt-3 flex flex-wrap justify-center gap-2`,children:u.map(({icon:e,label:t,task:n})=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>c(n),className:`inline-flex h-8 items-center gap-2 rounded-full px-3 text-ui text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,Z.jsx)(e,{className:`size-3.5`,"aria-hidden":`true`}),t]},t))}),(0,Z.jsx)(Ob,{}),(0,Z.jsx)(kb,{fresh:l,issues:a,colors:i.data?.labelColors??{}})]})}function Sb(){let e=E(),t=Et(),n=Oy(),r=Lr(),i=t.data?.onboarding?.dismissedAnnouncements,a=t.data?Ac({dismissed:i,designMode:e.data?.capabilities.designMode}):null;if(!a)return null;let o=()=>n({dismissedAnnouncements:[...i??[],a.id]});return(0,Z.jsxs)(`div`,{"data-slot":`announcement`,className:`onboarding-announcement relative mb-14 flex w-full items-stretch overflow-hidden rounded-xl border text-left`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col justify-center p-6`,children:[(0,Z.jsx)(`span`,{className:`eyebrow text-violet`,children:`New`}),(0,Z.jsx)(`span`,{className:`mt-1 text-2xl font-light tracking-tight text-foreground`,children:a.title}),(0,Z.jsx)(`p`,{className:`mt-2 max-w-sm text-ui text-muted-foreground`,children:a.description}),(0,Z.jsxs)(q,{size:`sm`,className:`mt-5 self-start font-normal`,onClick:()=>{o(),r(Hy({ref:a.hero.task}))},children:[a.hero.action,(0,Z.jsx)(pa,{"aria-hidden":`true`})]})]}),(0,Z.jsx)(Cb,{}),(0,Z.jsx)(`button`,{type:`button`,onClick:o,"aria-label":`Close ${a.title} announcement`,className:`absolute top-3 right-3 grid size-7 place-items-center rounded-full text-soft-foreground hover:text-foreground`,children:(0,Z.jsx)(us,{className:`size-3.5`,"aria-hidden":`true`})})]})}function Cb(){return(0,Z.jsx)(`div`,{className:`onboarding-picture hidden w-64 shrink-0 items-end justify-center pt-6 pr-6 sm:flex`,"aria-hidden":`true`,children:(0,Z.jsxs)(`div`,{className:`w-full rounded-t-lg border border-b-0 border-border bg-background p-3 shadow-[0_-12px_40px_-20px_var(--violet)]`,children:[(0,Z.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`})]}),(0,Z.jsx)(`div`,{className:`mt-3 h-2 w-2/3 rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`mt-2 h-2 w-1/2 rounded bg-muted`}),(0,Z.jsxs)(`div`,{className:`relative mt-4 flex items-center gap-2`,children:[(0,Z.jsxs)(`span`,{className:`relative h-6 w-16 rounded-md border border-violet bg-violet/15 outline-2 outline-offset-2 outline-violet/40`,children:[(0,Z.jsx)(`span`,{className:`absolute -top-1 -left-1 size-1.5 rounded-[2px] bg-violet`}),(0,Z.jsx)(`span`,{className:`absolute -top-1 -right-1 size-1.5 rounded-[2px] bg-violet`}),(0,Z.jsx)(`span`,{className:`absolute -bottom-1 -left-1 size-1.5 rounded-[2px] bg-violet`}),(0,Z.jsx)(`span`,{className:`absolute -right-1 -bottom-1 size-1.5 rounded-[2px] bg-violet`})]}),(0,Z.jsx)(`span`,{className:`h-6 w-10 rounded-md bg-muted`}),(0,Z.jsx)(`span`,{className:`absolute top-7 left-6 rounded-md rounded-tl-sm border border-border bg-card px-2 py-1 text-micro whitespace-nowrap text-foreground shadow-md`,children:`Make this button larger`})]}),(0,Z.jsx)(`div`,{className:`mt-9 h-2 w-3/4 rounded bg-muted`})]})})}function wb(){let e=Rn(),t=E(),n=_n(),r=Et(),i=Oy(),a=e.data?.worktreeLifecycle,o=dc({worktreeSetupConfigured:e.data?(a?.afterCreate.length??0)>0:void 0,forge:t.data?.forge}),s=n.data?.info,c=s!=null&&!s.remote&&t.data?.capabilities.singleProject!==!0,l=r.data?.onboarding?.setupDismissed===!0,u=X.useCallback(()=>i({setupDismissed:!0}),[i]);return{steps:o,unpublished:c,folder:s?Gb(s.root):``,dismissed:l||!r.data,dismiss:u}}var Tb={worktrees:Td,github:Nf},Eb=30,Db=6;function Ob(){let e=F(),t=X.useMemo(()=>{let t=new Date;t.setHours(0,0,0,0);let n=Array.from({length:Eb},(e,n)=>{let r=new Date(t);return r.setDate(t.getDate()-(Eb-1-n)),{date:r,count:0}}),r=n[0]?.date.getTime()??0;for(let t of e.data??[]){let e=new Date(t.createdAt);e.setHours(0,0,0,0);let i=n[Math.round((e.getTime()-r)/864e5)];i&&(i.count+=1)}return n},[e.data]),n=t.reduce((e,t)=>e+t.count,0);if(n===0)return null;let r=Math.max(1,...t.map(e=>e.count)),i=e=>e===0?0:Math.max(1,Math.round(e/r*Math.min(r,Db))),a=e=>e.toLocaleDateString(void 0,{month:`short`,day:`numeric`});return(0,Z.jsxs)(`div`,{"data-slot":`activity-strip`,className:`mt-12 w-full`,children:[(0,Z.jsxs)(`div`,{className:`mb-3 flex items-baseline justify-between text-ui`,children:[(0,Z.jsx)(`span`,{className:`text-soft-foreground`,children:`Activity`}),(0,Z.jsxs)(`span`,{className:`text-soft-foreground`,children:[n,` `,n===1?`task`:`tasks`,` in the last `,Eb,` days`]})]}),(0,Z.jsx)(Zc,{delayDuration:100,children:(0,Z.jsx)(`div`,{className:`flex items-end justify-between`,role:`img`,"aria-label":`${n} tasks in the last ${Eb} days`,children:t.map(e=>(0,Z.jsxs)(Qc,{children:[(0,Z.jsx)(Xc,{asChild:!0,children:(0,Z.jsx)(`span`,{className:`flex flex-col-reverse gap-1 py-1`,children:Array.from({length:Math.max(1,i(e.count))},(t,n)=>(0,Z.jsx)(`span`,{className:H(`size-2.5 rounded-[3px]`,e.count>0?`bg-violet`:`bg-muted`)},n))})}),(0,Z.jsx)($c,{children:`${a(e.date)}: ${e.count} ${e.count===1?`task`:`tasks`}`})]},e.date.toISOString()))})}),(0,Z.jsx)(`div`,{className:`mt-2 flex justify-between font-mono text-micro text-soft-foreground`,children:t.filter((e,t)=>t%7==1||t===Eb-1).map(e=>(0,Z.jsx)(`span`,{children:a(e.date)},e.date.toISOString()))})]})}function kb({fresh:e,issues:t,colors:n}){let r=_n(),i=r.data?.info&&!e?r.data.log.slice(0,3):[],a=jb(de(t.length===0&&i.length===0).data??[]);return t.length>0?(0,Z.jsx)(Ab,{label:`Or pick up an issue`,slot:`issues`,children:(0,Z.jsx)(`ul`,{className:`w-full divide-y divide-border rounded-xl border border-border bg-card p-1.5 text-left`,children:t.map(e=>(0,Z.jsx)(`li`,{className:`first:[&>a]:rounded-t-lg last:[&>a]:rounded-b-lg`,children:(0,Z.jsxs)(G,{to:Hy({ref:Uy(e)}),className:`group flex flex-col gap-1.5 px-3 py-2.5 transition-colors hover:bg-muted`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-body text-foreground`,children:e.title}),(0,Z.jsx)(pa,{className:`ml-auto size-3.5 shrink-0 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100`,"aria-hidden":`true`})]}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-meta text-soft-foreground`,children:[(0,Z.jsxs)(`span`,{className:`font-mono`,children:[`#`,e.number]}),(0,Z.jsx)(`span`,{children:e.author}),(0,Z.jsxs)(`span`,{children:[Ml(e.createdAt),` ago`]}),e.comments>0?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Z.jsx)(No,{className:`size-3`,"aria-hidden":`true`}),e.comments]}):null,e.labels.map(e=>(0,Z.jsx)(`span`,{style:tb(n[e]),className:`rounded-full border px-1.5 py-px text-micro`,children:e},e))]})]})},e.number))})}):i.length>0?(0,Z.jsx)(Ab,{label:`Or continue recent work`,slot:`commits`,children:(0,Z.jsx)(`ul`,{className:`w-full divide-y divide-border rounded-xl border border-border bg-card p-1.5 text-left`,children:i.map(e=>(0,Z.jsx)(`li`,{className:`first:[&>a]:rounded-t-lg last:[&>a]:rounded-b-lg`,children:(0,Z.jsxs)(G,{to:Hy({ref:`Continue the work from commit ${e.hash} (${e.subject}).`}),className:`group flex flex-col gap-1 px-3 py-2.5 transition-colors hover:bg-muted`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-body text-foreground`,children:e.subject}),(0,Z.jsx)(pa,{className:`ml-auto size-3.5 shrink-0 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100`,"aria-hidden":`true`})]}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 text-meta text-soft-foreground`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.hash}),(0,Z.jsx)(`span`,{children:e.author}),(0,Z.jsx)(`span`,{children:e.when})]})]})},e.hash))})}):a.length>0?(0,Z.jsx)(Ab,{label:`Or start with a skill`,slot:`skills`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:a.map(e=>(0,Z.jsx)(G,{to:Hy({skill:e.name}),className:sb,title:e.description,children:e.name},e.name))})}):null}function Ab({label:e,slot:t,children:n}){return(0,Z.jsxs)(`div`,{"data-slot":`start-from`,"data-start-from":t,className:`mt-14 flex w-full flex-col items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`text-ui text-soft-foreground`,children:e}),n]})}function jb(e){let t=e.filter(e=>e.source!==`global`&&e.source!==`builtin`),n=e.filter(e=>e.source===`global`);return[...t,...n].slice(0,4)}function Mb({folder:e,onOpenChange:t}){let{projectId:n}=Rt(),r=Gt(),i=Mn(),a=r.data?.available===!0?r.data.owners:null,[o,s]=X.useState(null),[c,l]=X.useState(()=>Kb(e)),u=o??a?.[0]?.login??``,d=()=>{i.isPending||!u||!c.trim()||i.mutate({projectId:n??`default`,owner:u,name:c.trim()},{onSuccess:({slug:e})=>{t(!1),Y(`Published to ${e}`)}})},f=a!==null,p=ub(!r.isPending&&!f,()=>void r.refetch()),m=p.state?.status===`done`&&!r.isFetching&&r.data?.available===!1?r.data.reason:null;return(0,Z.jsxs)(Py,{title:`Publish to GitHub`,description:f?`A new private repository. You can make it public on GitHub later.`:m?`Signed in, but GitHub listed no accounts.`:db(p),onOpenChange:t,onSubmit:f?d:void 0,footer:m?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{variant:`outline`,className:`font-normal`,onClick:()=>t(!1),children:`Close`}),(0,Z.jsx)(q,{className:`font-normal`,onClick:()=>void r.refetch(),children:`Check again`})]}):f?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{variant:`outline`,className:`font-normal`,onClick:()=>t(!1),children:`Cancel`}),(0,Z.jsx)(q,{className:`font-normal`,onClick:d,disabled:i.isPending||!u||!c.trim(),children:i.isPending?`Publishing…`:`Publish`})]}):(0,Z.jsx)(gb,{signIn:p,onClose:()=>t(!1)}),children:[r.isPending?(0,Z.jsx)(`p`,{className:`text-ui text-soft-foreground`,children:`Checking GitHub…`}):m?(0,Z.jsx)(`p`,{role:`alert`,className:`text-ui text-danger`,children:m}):f?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Owner`,children:a.map(e=>(0,Z.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e.login===u,onClick:()=>s(e.login),className:H(`inline-flex h-8 items-center gap-2 rounded-full border px-3 text-ui transition-colors`,e.login===u?`border-primary text-foreground`:`border-border text-muted-foreground hover:text-foreground`),children:e.login},e.login))}),(0,Z.jsxs)(`label`,{className:`flex items-center gap-1 rounded-lg border border-input bg-background px-3 font-mono text-ui focus-within:border-ring`,children:[(0,Z.jsxs)(`span`,{className:`text-soft-foreground`,children:[u,`/`]}),(0,Z.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),"aria-label":`Repository name`,className:`h-9 min-w-0 flex-1 bg-transparent text-foreground outline-none`})]})]}):(0,Z.jsx)(hb,{signIn:p}),i.error?(0,Z.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs whitespace-pre-line text-danger`,children:i.error.message}):null]})}function Nb(){let{steps:e,unpublished:t,folder:n,dismissed:r,dismiss:i}=wb(),[a,o]=X.useState(!1),s=e[0];if(r||s===void 0&&!t)return null;let c=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s?Tb[s.id]:Nf,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),s?s.label:`Publish to GitHub`,(0,Z.jsx)(pa,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]}),l=`inline-flex h-7 items-center gap-1.5 rounded-full bg-muted px-3 text-foreground`;return(0,Z.jsxs)(`div`,{"data-onboarding":``,"data-slot":`setup-pill`,className:`mb-3 inline-flex items-center gap-2 self-start rounded-full border border-border bg-card py-1 pr-1 pl-3 text-ui`,children:[(0,Z.jsx)(`span`,{className:`text-soft-foreground`,children:`Setup`}),s?(0,Z.jsx)(G,{to:s.to,className:l,children:c}):(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>o(!0),"data-setup-step":`publish`,children:c}),(0,Z.jsx)(`button`,{type:`button`,onClick:i,"aria-label":`Hide setup`,className:`grid size-7 place-items-center rounded-full text-soft-foreground hover:text-foreground`,children:(0,Z.jsx)(us,{className:`size-3.5`,"aria-hidden":`true`})}),a?(0,Z.jsx)(Mb,{folder:n,onOpenChange:o}):null]})}function Pb(){let e=Nt();return e.isPending?null:e.data?.available?(0,Z.jsx)(Fb,{setup:e.data}):(0,Z.jsx)(Ib,{})}function Fb({setup:e}){let t=Mt(),n=mn(),r=Oy(),i=py(e,t.data).length===0;return(0,Z.jsxs)(rb,{title:Cy(e,t.data),slot:`sign-in`,step:`agent`,why:`cezar installs the coding agent and signs you in, right here. No API key needed.`,children:[i?(0,Z.jsxs)(`div`,{"data-slot":`agents-off`,className:`mt-7 flex w-full flex-col gap-3 rounded-xl border border-border bg-card p-4 text-left sm:flex-row sm:items-center sm:justify-between`,children:[(0,Z.jsx)(`span`,{className:`text-body text-foreground`,children:`All agents are turned off.`}),(0,Z.jsx)(q,{asChild:!0,size:`sm`,className:`font-normal`,children:(0,Z.jsx)(G,{to:`/settings/agents#providers`,children:`Turn one on`})})]}):(0,Z.jsx)(wy,{setup:e,status:t.data}),(0,Z.jsxs)(`div`,{className:`mt-7 flex flex-wrap justify-center gap-5`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>n.mutate(),disabled:n.isPending,className:ob,children:n.isPending?`Checking…`:`Check again`}),(0,Z.jsx)(G,{to:`/settings/agents`,className:ob,children:`Other agents`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r({agentCheckSkipped:!0}),className:ob,children:`Continue anyway`})]})]})}function Ib(){let e=Mt(),t=mn(),n=qn(),r=Oy(),i=mc(e.data),[a,o]=X.useState(null),[s,c]=X.useState(null),l=t.mutate;X.useEffect(()=>{let e=window.setInterval(()=>l(),Rb);return()=>window.clearInterval(e)},[l]),X.useEffect(()=>{if(!a)return;let e=0,t=window.setInterval(()=>{if(e+=1,e>zb){window.clearInterval(t),o(null);return}l()},Lb);return()=>window.clearInterval(t)},[a,l]);let u=e=>{c(null),n.mutate({provider:e},{onSuccess:t=>{t.opened?o(e):l()},onError:t=>c({provider:e,message:t.message})})};return(0,Z.jsxs)(rb,{title:`Sign in to an agent`,slot:`sign-in`,step:`agent`,why:`cezar runs the coding agent you already use. No API key needed.`,children:[(0,Z.jsxs)(`div`,{className:`mt-7 flex w-full flex-col gap-3 text-left`,children:[i.length===0?(0,Z.jsxs)(`div`,{"data-slot":`agents-off`,className:`flex flex-col gap-3 rounded-xl border border-border bg-card p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Z.jsx)(`span`,{className:`text-body text-foreground`,children:`All agents are turned off.`}),(0,Z.jsx)(q,{asChild:!0,size:`sm`,className:`font-normal`,children:(0,Z.jsx)(G,{to:`/settings/agents#providers`,children:`Turn one on`})})]}):null,i.map(e=>{let t=a===e.provider,r=s?.provider===e.provider?s.message:null;return(0,Z.jsxs)(`div`,{"data-slot":`agent-row`,"data-state":e.state,className:`rounded-xl border border-border bg-card p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`text-lead text-foreground`,children:e.label}),(0,Z.jsx)(`div`,{className:`text-ui text-muted-foreground`,children:t?`Finish in Terminal`:e.state===`missing`?`Not installed`:`Installed, not signed in`})]}),e.state===`signed-out`?t?(0,Z.jsx)(Mo,{className:`size-4 shrink-0 text-violet motion-safe:animate-spin`,"aria-label":`Waiting for sign-in`}):(0,Z.jsx)(q,{className:`font-normal`,onClick:()=>u(e.provider),disabled:n.isPending,children:`Sign in`}):null]}),e.state===`signed-out`&&!t&&!r?(0,Z.jsx)(`p`,{className:`mt-3 text-ui text-soft-foreground`,children:`Opens the login in Terminal.`}):null,t?(0,Z.jsx)(`p`,{className:`mt-3 text-ui text-soft-foreground`,children:`This page continues by itself.`}):null,r?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-col gap-3`,children:[(0,Z.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:r}),(0,Z.jsxs)(cb,{children:[(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:`Open Terminal and paste:`}),(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(_b,{command:e.command})})]}),(0,Z.jsx)(`li`,{children:`Come back. cezar checks by itself.`})]})]}):null,e.state===`missing`?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-col gap-3`,children:[(0,Z.jsxs)(cb,{children:[(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:`Open Terminal and paste:`}),(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(_b,{command:e.command})})]}),(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:`Then sign in:`}),(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(_b,{command:e.login})})]}),(0,Z.jsx)(`li`,{children:`Come back. cezar checks by itself.`})]}),(0,Z.jsxs)(`p`,{className:`text-label text-soft-foreground`,children:[`Needs Node.js.`,` `,(0,Z.jsx)(`a`,{href:`https://nodejs.org`,target:`_blank`,rel:`noopener noreferrer`,className:`text-violet hover:underline`,children:`Get it`})]})]}):null]},e.provider)})]}),(0,Z.jsxs)(`div`,{className:`mt-7 flex flex-wrap justify-center gap-5`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>l(),disabled:t.isPending,className:ob,children:t.isPending?`Checking…`:`Check again`}),(0,Z.jsx)(G,{to:`/settings/agents`,className:ob,children:`Other agents`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r({agentCheckSkipped:!0}),className:ob,children:`Continue anyway`})]})]})}var Lb=3e3,Rb=1e4,zb=60;function Bb(){let{projectId:e}=Rt(),t=i(),n=E(),r=e??t.data?.bootProject,a=t.data?.projects.find(e=>e.id===r);return a?a.root:e===null||e===n.data?.bootProject?n.data?.repoRoot:void 0}function Vb(){let e=E().data?.capabilities.singleProject===!0,t=Bb(),n=t?Gb(t):`This folder`,[r,i]=X.useState(!1);return(0,Z.jsxs)(rb,{title:`Pick a project`,slot:`pick-project`,step:`project`,why:`Tasks run inside a git repository, each in its own worktree.`,subtitle:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:n}),` isn’t a git repository.`,e?null:(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsx)(`button`,{type:`button`,onClick:()=>i(!0),className:`text-violet hover:underline`,children:`Initialize git here`})]})]}),children:[e?null:(0,Z.jsx)(Hb,{}),r?(0,Z.jsx)(Wb,{folder:n,onOpenChange:i}):null]})}function Hb(){let e=pt(),t=Gt(),n=nn(),r=Mr(),[i,a]=X.useState(``),[o,s]=X.useState(0),[c,l]=X.useState(null),u=(e.data?.repos??[]).filter(e=>e.name.toLowerCase().includes(i.trim().toLowerCase())).slice(0,6),d=t.data!==void 0&&!t.data.available,f=!e.isPending&&(e.data?.repos.length??0)===0,p=e=>{if(e.projectId){r(`/p/${encodeURIComponent(e.projectId)}/`);return}n.mutate(e.path,{onSuccess:({project:e})=>r(`/p/${encodeURIComponent(e.id)}/`),onError:e=>Y(e.message,{tone:`danger`})})},m=e=>{l(e),wl(e)};return(0,Z.jsxs)(Z.Fragment,{children:[f?(0,Z.jsxs)(`div`,{"data-slot":`no-repos`,className:`mt-8 grid w-full gap-3 sm:grid-cols-3`,children:[(0,Z.jsx)(Iy,{title:`New project`,description:`An empty repository here, or a new private one on GitHub.`,recommended:d,onClick:()=>m(`new`),picture:(0,Z.jsx)(`span`,{className:`grid size-12 place-items-center rounded-lg border border-dashed border-muted-foreground/60`,children:(0,Z.jsxs)(`span`,{className:`relative size-4`,children:[(0,Z.jsx)(`span`,{className:`absolute top-1/2 left-0 h-0.5 w-full -translate-y-1/2 rounded bg-muted-foreground`}),(0,Z.jsx)(`span`,{className:`absolute top-0 left-1/2 h-full w-0.5 -translate-x-1/2 rounded bg-muted-foreground`})]})})}),d?(0,Z.jsx)(Iy,{title:`Connect GitHub`,description:`Sign in to the GitHub CLI to clone and publish.`,onClick:()=>l(`connect`),picture:(0,Z.jsx)(Nf,{className:`size-9 text-muted-foreground`,"aria-hidden":!0})}):(0,Z.jsx)(Iy,{title:`Clone from GitHub`,description:`Any repository you can read, by URL or owner/name.`,recommended:!0,onClick:()=>m(`clone`),picture:(0,Z.jsxs)(`span`,{className:`flex w-16 flex-col gap-1.5`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-md border border-violet bg-violet/15 px-1.5 py-1`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`}),(0,Z.jsx)(`span`,{className:`h-1 flex-1 rounded bg-violet/60`})]}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-md border border-border px-1.5 py-1`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/50`}),(0,Z.jsx)(`span`,{className:`h-1 w-3/4 rounded bg-muted`})]}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-md border border-border px-1.5 py-1`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/50`}),(0,Z.jsx)(`span`,{className:`h-1 w-1/2 rounded bg-muted`})]})]})}),(0,Z.jsx)(Iy,{title:`Open a folder`,description:`A repository that already lives on this disk.`,onClick:()=>m(`folder`),picture:(0,Z.jsxs)(`span`,{className:`flex w-16 flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`h-2 w-10 rounded-sm bg-muted-foreground/70`}),(0,Z.jsx)(`span`,{className:`ml-3 h-1.5 w-9 rounded bg-muted`}),(0,Z.jsx)(`span`,{className:`ml-3 h-1.5 w-7 rounded bg-muted`}),(0,Z.jsx)(`span`,{className:`ml-3 h-1.5 w-8 rounded bg-muted`})]})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`mt-7 w-full rounded-xl border border-border bg-card p-1.5 text-left`,children:[(0,Z.jsxs)(`label`,{className:`flex h-11 items-center gap-2 rounded-lg border border-input bg-background px-3 focus-within:border-ring`,children:[(0,Z.jsx)(is,{className:`size-4 text-soft-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`input`,{value:i,onChange:e=>{a(e.target.value),s(0)},onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),s(e=>Math.min(e+1,u.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),s(e=>Math.max(e-1,0));else if(e.key===`Enter`){let e=u[o];e&&p(e)}},placeholder:`Search repositories`,"aria-label":`Search repositories`,className:`min-w-0 flex-1 bg-transparent text-lead text-foreground outline-none placeholder:text-soft-foreground`})]}),(0,Z.jsx)(`ul`,{role:`listbox`,"aria-label":`Repositories`,className:`mt-1`,children:e.isPending?(0,Z.jsx)(`li`,{className:`px-3 py-2.5 text-ui text-soft-foreground`,children:`Looking for repositories…`}):u.length===0?(0,Z.jsx)(`li`,{className:`px-3 py-2.5 text-ui text-soft-foreground`,children:`No repositories found`}):u.map((e,t)=>(0,Z.jsx)(`li`,{role:`option`,"aria-selected":t===o,children:(0,Z.jsxs)(`button`,{type:`button`,onMouseEnter:()=>s(t),onClick:()=>p(e),disabled:n.isPending,className:H(`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left`,t===o&&`bg-muted`),children:[(0,Z.jsx)(`span`,{className:`truncate text-lead text-foreground`,children:e.name}),(0,Z.jsx)(`span`,{className:`ml-auto truncate font-mono text-meta text-soft-foreground`,children:qb(e.path)})]})},e.path))})]}),(0,Z.jsxs)(`div`,{className:`mt-5 flex flex-wrap justify-center gap-6`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:ob,onClick:()=>m(`new`),children:[(0,Z.jsx)(ts,{className:`size-3.5`,"aria-hidden":`true`}),`New project`]}),d?(0,Z.jsxs)(`button`,{type:`button`,className:ob,onClick:()=>l(`connect`),"data-slot":`connect-github`,children:[(0,Z.jsx)(Nf,{className:`size-3.5`,"aria-hidden":!0}),`Connect GitHub`]}):(0,Z.jsxs)(`button`,{type:`button`,className:ob,onClick:()=>m(`clone`),children:[(0,Z.jsx)(Nf,{className:`size-3.5`,"aria-hidden":!0}),`Clone from GitHub`]}),(0,Z.jsxs)(`button`,{type:`button`,className:ob,onClick:()=>m(`folder`),children:[(0,Z.jsx)(Eo,{className:`size-3.5`,"aria-hidden":`true`}),`Browse…`]})]})]}),c===`new`?(0,Z.jsx)(Mf,{label:`New project`,onError:()=>l(null),children:(0,Z.jsx)(Df,{open:!0,onOpenChange:e=>!e&&l(null)})}):null,c===`clone`?(0,Z.jsx)(Mf,{label:`Clone from GitHub`,onError:()=>l(null),children:(0,Z.jsx)(Sf,{open:!0,onOpenChange:e=>!e&&l(null)})}):null,c===`folder`?(0,Z.jsx)(Mf,{label:`Open local folder`,onError:()=>l(null),children:(0,Z.jsx)(bf,{open:!0,onOpenChange:e=>!e&&l(null)})}):null,c===`connect`?(0,Z.jsx)(Ub,{onOpenChange:e=>!e&&l(null)}):null]})}function Ub({onOpenChange:e}){let t=X.useCallback(()=>e(!1),[e]),n=ub(!0,e=>{Y(e?`GitHub connected as ${e}`:`GitHub connected`),t()});return(0,Z.jsx)(Py,{title:`Connect GitHub`,description:db(n),onOpenChange:e,footer:(0,Z.jsx)(gb,{signIn:n,onClose:t}),children:(0,Z.jsx)(hb,{signIn:n})})}function Wb({folder:e,onOpenChange:t}){let{projectId:n}=Rt(),r=Qn(),i=()=>{r.isPending||r.mutate(n??`default`,{onSuccess:()=>{t(!1),Y(`Initialized git in ${e}`)}})};return(0,Z.jsxs)(Py,{title:`Initialize git in ${e}`,description:`Git keeps a history of your files. cezar runs this for you and uploads nothing. node_modules and .env files stay out.`,onOpenChange:t,onSubmit:i,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{variant:`outline`,onClick:()=>t(!1),className:`font-normal`,children:`Cancel`}),(0,Z.jsx)(q,{onClick:i,disabled:r.isPending,className:`font-normal`,children:r.isPending?`Initializing…`:`Initialize`})]}),children:[(0,Z.jsx)(`pre`,{className:`rounded-lg border border-border bg-background px-3 py-2.5 font-mono text-xs leading-relaxed text-foreground`,children:`$ git init -b main
4
+ `),v=X.useRef(g);v.current=g,X.useEffect(()=>n({runId:e.id,commands:v.current}),[_,n,e.id]);let y=s.confirming!==null||s.worktreeRemovalOpen||c.commitOpen||c.pending!==null||s.delete.isPending||s.cancel.isPending,b=X.useRef(y);return X.useEffect(()=>{b.current&&!y&&i(),b.current=y},[y,i]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($i,{run:e,confirming:s.confirming,lifecycleDelete:s.lifecycleDelete,onOpenChange:e=>!e&&s.setConfirming(null),onConfirm:e=>e===`delete`?s.delete.mutate():s.cancel.mutate()}),s.worktreeRemovalOpen?(0,Z.jsx)(ra,{run:e,pending:s.removeWorktree.isPending,onClose:()=>s.setWorktreeRemovalOpen(!1),onConfirm:()=>s.removeWorktree.mutate()},e.id):null,c.dialogs]})}var ug=X.createContext(null);function dg({children:e}){let[t,n]=X.useState(`active`),r=X.useMemo(()=>[t,n],[t]);return(0,Z.jsx)(ug.Provider,{value:r,children:e})}function fg(){let e=X.useContext(ug);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}var pg=1e4,mg=e=>Math.min(100,Math.max(0,e)),hg=e=>e===void 0||e<80?`ok`:e<90?`warn`:`critical`;function gg(){let e=Li(),t=Mi();return!e||t!==`local`?null:(0,Z.jsx)(_g,{})}function _g(){let e=Pi(),t=ji(),n=Ni(),[r,i]=(0,X.useState)(void 0),a=n!==void 0&&r===n;(0,X.useEffect)(()=>{if(n===void 0)return;let e=Math.max(0,n+pg-Date.now()),t=setTimeout(()=>i(n),e);return()=>clearTimeout(t)},[n]);let o=e===void 0?void 0:Ii(e),s=o?.cpuPct,c=a?`stale`:o!==void 0&&o.cpuLimited&&s===void 0?`—`:s===void 0?t.length===0?`sampling…`:`—`:`${Math.round(s)}%`,l=o===void 0||o.memUsedBytes===void 0||o.memTotalBytes<=0?void 0:o.memUsedBytes/o.memTotalBytes*100,u=a?`stale`:l===void 0?`—`:`${Math.round(l)}%`,d=o===void 0?`—`:Oi(o.memUsedBytes,o.memTotalBytes),f=o?.cpuLimited===!0?`${o.cpuLimitKind===`cpuset`?`cpuset `:``}${Di(o.cpuCores)}`:void 0,p=`CPU ${c}${f===void 0?``:` of ${f}`}, RAM ${u} (${d})`;return(0,Z.jsxs)(G,{to:`/settings/resources`,"data-slot":`host-usage-widget`,"data-state":a?`stale`:`live`,"data-frames":t.length,"aria-label":`Machine usage: ${p}. Open Settings, Behaviour.`,title:p,className:H(`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-meta leading-[14px] text-soft-foreground transition-colors hover:bg-muted hover:text-foreground`,a?`opacity-70`:null),children:[(0,Z.jsx)(vg,{label:`CPU`,pct:a?void 0:s,valueSlot:`host-usage-widget-cpu`,value:c}),(0,Z.jsx)(vg,{label:`RAM`,pct:a?void 0:l,valueSlot:`host-usage-widget-mem-pct`,value:u,gutter:!0})]})}function vg({label:e,pct:t,valueSlot:n,value:r,gutter:i}){let a=hg(t);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:H(`font-medium tracking-wide text-muted-foreground`,i===!0?`ml-1`:null),children:e}),(0,Z.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(mg(t)),className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,Z.jsx)(`span`,{className:H(`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:mg(t)}%`}})}),(0,Z.jsx)(`span`,{"data-slot":n,className:H(`text-right font-medium tabular-nums`,a===`critical`?`text-destructive`:a===`warn`?`text-pending-strong`:`text-foreground`),children:r})]})}function yg({status:e,pending:t,error:n,dismissals:r,onDismissAuthFailures:i}){if(t||!e)return null;let a;try{a=In(e)}catch{return null}let o=Pc(a,r);if(o.length>0)return(0,Z.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,Z.jsx)(Pl,{tone:`danger`}),(0,Z.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,o.map(({label:e})=>e).join(`, `),`.`]}),(0,Z.jsx)(G,{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,Z.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,Z.jsx)(us,{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,Z.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,Z.jsx)(Pl,{tone:c?`danger`:`pending`}),(0,Z.jsx)(`span`,{children:s?`No agent provider is enabled.`:c?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,Z.jsx)(G,{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 bg(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function xg(){let e=Mt(),t=Et(),n=V(),r=(0,X.useRef)(Promise.resolve()),i=(0,X.useRef)(0),a=(0,X.useRef)(0),o=(0,X.useRef)(bg(t.data));(0,X.useEffect)(()=>{a.current===0&&(o.current=bg(t.data))},[t.data]);let s=(0,X.useCallback)(e=>{let t=R.uiState,s=bg(n.getQueryData(t)),c=Fc(Ic(s?.dismissedProviderAuthFailures),e),l={...s,dismissedProviderAuthFailures:c};a.current+=1,n.setQueryData(t,l);let u=++i.current;r.current=r.current.then(async()=>{try{let e=await $t({dismissedProviderAuthFailures:c});o.current=bg(e),u===i.current&&n.setQueryData(t,e)}catch(e){u===i.current&&(o.current===void 0?n.removeQueries({queryKey:t,exact:!0}):n.setQueryData(t,o.current),n.invalidateQueries({queryKey:t}),Y(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--a.current}})},[n]);return(0,Z.jsx)(yg,{status:e.data,pending:e.isPending,error:e.isError,dismissals:Ic(bg(t.data)?.dismissedProviderAuthFailures),onDismissAuthFailures:s})}function Sg(e){return(0,X.useSyncExternalStore)(Qr,$r,$r),ri(e)}function Cg(e,t){let[n,r]=(0,X.useState)(!1);return(0,X.useEffect)(()=>{if(!e){r(!1);return}let n=setTimeout(()=>r(!0),t);return()=>clearTimeout(n)},[e,t]),e&&n}function wg(e,t=Date.now()){let n=new Date(e),r=n.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});return new Date(t).toDateString()===n.toDateString()?r:`${n.toLocaleDateString([],{month:`short`,day:`numeric`})} ${r}`}function Tg({queryKey:e,isFetching:t,isError:n,className:r}){let i=Sg(e);if(!Cg(i!==void 0,600)||i===void 0)return null;let a=n&&!t,o=wg(i);return(0,Z.jsx)(`span`,{role:`status`,"data-slot":`cache-status`,"data-state":a?`failed`:t?`updating`:`cached`,title:`Saved ${new Date(i).toLocaleString()}`,className:H(`inline-flex min-w-0 items-center gap-1 rounded-full px-2 py-0.5 text-meta`,a?`bg-warning/10 text-warning`:`bg-muted text-muted-foreground`,r),children:a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Yu,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsxs)(`span`,{className:`truncate`,children:[`Showing cached data from `,o,` — couldn't refresh`]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ns,{"aria-hidden":`true`,className:H(`size-3 shrink-0`,t&&`motion-safe:animate-spin`)}),(0,Z.jsx)(`span`,{className:`truncate`,children:t?`Cached · updating…`:`Cached · ${o}`})]})})}var Eg=()=>typeof globalThis.EventSource==`function`;function Dg(){return(0,X.useSyncExternalStore)(e=>(window.addEventListener(`online`,e),window.addEventListener(`offline`,e),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}),()=>navigator.onLine!==!1,()=>!0)}function Og(){return(0,X.useSyncExternalStore)(e=>(document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)),()=>document.visibilityState!==`hidden`,()=>!0)}function kg(){let e=(0,X.useSyncExternalStore)(di.subscribeConnected,di.isConnected,()=>!0),t=Dg(),n=Og(),[r,i]=(0,X.useState)(e);return e&&!r&&i(!0),Cg(Eg()&&n&&(!e||!t),t?r?5e3:15e3:0)?(0,Z.jsxs)(`div`,{role:`status`,"data-slot":`connection-banner`,"data-state":t?`reconnecting`:`offline`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-warning/10 px-4 text-sm text-foreground`,children:[(0,Z.jsx)(Yu,{"aria-hidden":`true`,className:`size-4 shrink-0 text-warning`}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[t?`Can't reach cezar — reconnecting…`:`You're offline — reconnecting when the network is back.`,(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:` What you see may be out of date.`})]})]}):null}var Ag=`https://github.com/open-mercato/cezar/blob/main/docs/telemetry.md`,jg=`https://github.com/open-mercato/cezar/blob/main/packages/cezar/src/telemetry.ts`;function Mg(e){return e!==void 0&&e.consent===`unknown`&&e.blockedBy===null}var Ng=[`How many tasks you start (agent, model)`,`How many messages you send`,`Which pages you open`,`Errors, with your paths removed`,`Version, OS, app or CLI`,`A random install id`],Pg=[`Prompts, messages, code, diffs`,`File paths`,`Repo, branch or project names`,`Keys or credentials`,`Your IP, in any payload`];function Fg(){let e=V();return(0,X.useCallback)(async t=>{try{let n=await fn({consent:t});return e.setQueryData(R.telemetryConsent,n),t===`denied`&&Ut(),!0}catch(e){return Y(e instanceof Error?e.message:String(e),{tone:`danger`}),!1}},[e])}function Ig({busy:e,onAnswer:t,size:n}){let r=n===`lg`?`min-h-11`:`h-9`;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{variant:`outline`,className:r,disabled:e,"data-slot":`telemetry-deny`,onClick:()=>t(`denied`),children:`Don’t share`}),(0,Z.jsx)(q,{className:r,disabled:e,"data-slot":`telemetry-grant`,onClick:()=>t(`granted`),children:`Share usage data`})]})}function Lg(){let e=ct(),t=Fg(),[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(!1);if(!Mg(e.data))return null;let o=async e=>{r(!0);let n=await t(e);r(!1),n&&a(!1)};return(0,Z.jsxs)(`div`,{"data-slot":`telemetry-consent-banner`,className:`px-4 pb-3 md:px-5 md:pb-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 rounded-lg border bg-card px-4 py-3 shadow-lg`,children:[(0,Z.jsx)(jd,{className:`hidden size-[18px] shrink-0 text-violet sm:block`,"aria-hidden":`true`}),(0,Z.jsxs)(`p`,{className:`min-w-0 flex-1 basis-[280px] text-ui leading-relaxed text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:`Help improve cezar?`}),` With your OK we send task counts and crash reports to the maintainers — never prompts, code, paths or repo names. Change it anytime in Settings → Data & privacy.`,` `,(0,Z.jsx)(`button`,{type:`button`,"data-slot":`telemetry-details`,className:`underline underline-offset-2 hover:text-foreground`,onClick:()=>a(!0),children:`Details`})]}),(0,Z.jsx)(`div`,{className:`flex gap-2`,children:(0,Z.jsx)(Ig,{busy:n,onAnswer:e=>void o(e),size:`sm`})})]}),(0,Z.jsx)(zg,{open:i,onOpenChange:a,busy:n,onAnswer:e=>void o(e)})]})}function Rg({title:e,tone:t,items:n}){let r=t===`ok`?Wa:us;return(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{className:`block text-ui font-medium text-foreground`,children:e}),(0,Z.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:n.map(e=>(0,Z.jsxs)(`li`,{className:`flex gap-2 text-ui leading-snug text-muted-foreground`,children:[(0,Z.jsx)(r,{className:`mt-0.5 size-3.5 shrink-0 ${t===`ok`?`text-success`:`text-soft-foreground`}`,"aria-hidden":`true`}),e]},e))})]})}function zg({open:e,onOpenChange:t,busy:n,onAnswer:r}){return(0,Z.jsx)(ol,{open:e,onOpenChange:t,children:(0,Z.jsx)(rl,{"data-slot":`telemetry-details-dialog`,className:`max-h-[calc(100dvh-2rem)] gap-0 overflow-y-auto p-0 sm:max-w-[480px]`,onOpenAutoFocus:e=>{e.preventDefault(),e.currentTarget.focus()},children:(0,Z.jsxs)(`div`,{className:`space-y-5 p-6`,children:[(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsx)(`span`,{className:`block eyebrow text-muted-foreground`,children:`What is sent`}),(0,Z.jsx)(il,{className:`text-xl font-semibold tracking-tight`,children:`Usage data, in full`}),(0,Z.jsx)(al,{className:`text-sm leading-relaxed text-muted-foreground`,children:`Counts of what you use and reports of what broke, so cezar’s maintainers at Open Mercato can fix bugs without you filing them. Off until you say yes.`})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsx)(Rg,{title:`Shared`,tone:`ok`,items:Ng}),(0,Z.jsx)(Rg,{title:`Never shared`,tone:`no`,items:Pg})]}),(0,Z.jsxs)(`p`,{className:`text-label leading-relaxed text-soft-foreground`,children:[`Every label is a closed list the server enforces. Withdraw anytime in Settings → Data & privacy or with `,(0,Z.jsx)(`code`,{className:`font-mono`,children:`cezar telemetry disable`}),` — the install id is deleted.`,` `,(0,Z.jsx)(`a`,{href:jg,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:`Read the code`}),` · `,(0,Z.jsx)(`a`,{href:Ag,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:`Privacy notice`})]}),(0,Z.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:(0,Z.jsx)(Ig,{busy:n,onAnswer:r,size:`lg`})})]})})})}function Bg({projects:e,folder:t,onClose:n,onSave:r}){let[i,a]=X.useState(t?.name??``),[o,s]=X.useState(t?.projectIds??[]),[c,l]=X.useState(!1);return(0,Z.jsx)(ol,{open:!0,onOpenChange:e=>{e||n()},children:(0,Z.jsxs)(rl,{"data-slot":`project-folder-dialog`,children:[(0,Z.jsxs)(tl,{children:[(0,Z.jsx)(il,{children:t?`Organise folder`:`Create project folder`}),(0,Z.jsx)(al,{children:`Group projects for a client or any other part of your work.`})]}),(0,Z.jsxs)(`label`,{className:`grid gap-2 text-sm font-medium`,children:[`Folder name`,(0,Z.jsx)(gl,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:`Client name`})]}),(0,Z.jsxs)(`fieldset`,{role:`group`,"aria-label":`Select projects`,className:`grid max-h-60 gap-1 overflow-y-auto`,children:[(0,Z.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:`Projects`}),e.map(e=>(0,Z.jsxs)(`label`,{className:`flex min-h-9 items-center gap-2 rounded px-2 text-sm hover:bg-muted`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:o.includes(e.id),onChange:t=>s(n=>t.target.checked?[...n,e.id]:n.filter(t=>t!==e.id))}),(0,Z.jsx)(Eo,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`}),e.name]},e.id))]}),(0,Z.jsxs)(nl,{className:`sm:justify-between`,children:[t?c?(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(q,{type:`button`,variant:`danger-ghost`,onClick:()=>r(null,t.id),children:`Confirm delete`}),(0,Z.jsx)(q,{type:`button`,variant:`ghost`,onClick:()=>l(!1),children:`Keep folder`})]}):(0,Z.jsx)(q,{type:`button`,variant:`danger-ghost`,onClick:()=>l(!0),children:`Delete folder`}):(0,Z.jsx)(`span`,{}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:n,children:`Cancel`}),(0,Z.jsx)(q,{type:`button`,disabled:!i.trim(),onClick:()=>r({id:t?.id??crypto.randomUUID(),name:i.trim(),projectIds:o},t?.id),children:`Save folder`})]})]})]})})}var Vg=`cez-project-folders`;function Hg(e){if(!Array.isArray(e))return[];let t=new Set,n=new Set;return e.flatMap(e=>{if(typeof e!=`object`||!e)return[];let r=e,i=typeof r.id==`string`?r.id.trim():``;if(!i||t.has(i)||typeof r.name!=`string`||!r.name.trim())return[];t.add(i);let a=Array.isArray(r.projectIds)?[...new Set(r.projectIds.filter(e=>typeof e==`string`&&!n.has(e)))]:[];return a.forEach(e=>n.add(e)),[{id:i,name:r.name.trim(),projectIds:a}]})}function Ug(){try{let e=localStorage.getItem(Vg);return e===null?[]:Hg(JSON.parse(e))}catch{return[]}}function Wg(e){try{localStorage.setItem(Vg,JSON.stringify(e))}catch{}}function Gg(e,t,n){let r=e.filter(e=>e.id!==n&&e.id!==t?.id);return t&&(r=r.map(e=>({...e,projectIds:e.projectIds.filter(e=>!t.projectIds.includes(e))})),r.push(t)),r}function Kg(e,t,n){return e.map(e=>e.id===n?e.projectIds.includes(t)?e:{...e,projectIds:[...e.projectIds,t]}:e.projectIds.includes(t)?{...e,projectIds:e.projectIds.filter(e=>e!==t)}:e)}var qg=`folder:`;function Jg(e){let[t,n]=X.useState(Ug),[r,i]=X.useState(void 0),a=X.useCallback((e,r)=>{let a=Gg(t,e,r);n(a),Wg(a),i(void 0)},[t]),{order:o,canReorder:s,setOrder:c}=em(),l=X.useMemo(()=>{let t=vc(e,o),n=t.filter(e=>e.unregistered);return n.length===0?t:[...n,...t.filter(e=>!e.unregistered)]},[e,o]),u=X.useMemo(()=>l.map(e=>e.id),[l]),d=X.useMemo(()=>{let e=t.map(e=>({folder:e,projects:l.filter(t=>e.projectIds.includes(t.id))})),n=l.filter(e=>!t.some(t=>t.projectIds.includes(e.id)));return n.length>0||t.length===0?[...e,{folder:null,projects:n}]:e},[t,l]),f=Gs(Ws(qs,{activationConstraint:{distance:4}}),Ws(Us,{coordinateGetter:Ks})),p=s&&l.length>1,m=X.useCallback(e=>e.startsWith(`folder:`)?t.find(t=>t.id===e.slice(7)):t.find(t=>t.projectIds.includes(e)),[t]),h=X.useCallback(e=>{let{active:r,over:i}=e;if(i===null||i.id===r.id)return;let a=String(r.id),o=String(i.id);if(a.startsWith(`folder:`)){let e=t.findIndex(e=>e.id===a.slice(7)),r=m(o),i=r===void 0?-1:t.findIndex(e=>e.id===r.id);if(e===-1||i===-1||e===i)return;let s=Js(t,e,i);n(s),Wg(s);return}let s=m(o);if(m(a)?.id!==s?.id){let e=Kg(t,a,s?.id??null);n(e),Wg(e)}if(o.startsWith(`folder:`))return;let l=u.indexOf(a),d=u.indexOf(o);l===-1||d===-1||c(oc(u,l,d))},[t,m,u,c]);return{ordered:l,orderedIds:u,folders:t,sections:d,sortable:p,sensors:f,announcements:X.useMemo(()=>{let e=e=>{let n=String(e);if(n.startsWith(`folder:`)){let e=t.findIndex(e=>e.id===n.slice(7));return{name:t[e]?.name??n,position:`folder ${e+1} of ${t.length}`}}let r=u.indexOf(n);return{name:l[r]?.name??n,position:`position ${r+1} of ${u.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}.`}},[t,l,u]),handleDragEnd:h,editingFolder:r,setEditingFolder:i,saveFolder:a}}var Yg=`Mod+Shift+P`;function Xg(e){return!(typeof e.key!=`string`||e.key.toLowerCase()!==`p`||!(e.metaKey||e.ctrlKey)||!e.shiftKey||e.altKey||e.repeat)}function Zg(e){return e===`ok`?`success`:e===`missing`?`danger`:`pending`}function Qg(e){let t=new Map;for(let n of e??[]){if(n.archived)continue;let e=t.get(n.projectId)??{needsYou:0,running:0};ln(n)?e.needsYou+=1:n.status===`running`&&(e.running+=1),t.set(n.projectId,e)}return t}function $g(e,t){let n=0;for(let[r,i]of e)r!==t&&(n+=i.needsYou);return n}function e_(e,t){let n=t.trim().toLowerCase();return n===``||e.name.toLowerCase().includes(n)||(e.branch?.toLowerCase().includes(n)??!1)}function t_({projects:e,activeId:t,singleProject:n=!1,onNavigate:r}){let i=yh(),a=r??i,[o,s]=X.useState(!1),[c,l]=X.useState(``),u=Mr(),{sections:d,sortable:f,sensors:p,announcements:m,handleDragEnd:h,editingFolder:g,setEditingFolder:_,saveFolder:v}=Jg(e),y=Le(o||e.length>1),b=X.useMemo(()=>Qg(y.data?.runs),[y.data?.runs]),x=$g(b,t),S=e.find(e=>e.id===t)??null,[C,w]=X.useState(null),T=X.useCallback(e=>{s(!1),l(``),w(e),wl(e)},[]),E=X.useCallback(e=>{e||w(null)},[]);X.useEffect(()=>{let e=e=>{Xg(e)&&(ps(e.target)&&!(e.target instanceof HTMLElement&&e.target.closest(`[cmdk-input]`))||!o&&fs()||(e.preventDefault(),s(e=>!e)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[o]);let D=X.useCallback(e=>{s(!1),a?.(),u(`/p/${encodeURIComponent(e.id)}/`)},[u,a]),O=d.map(e=>({...e,projects:e.projects.filter(e=>e_(e,c))})).filter(e=>c.trim()===``||e.projects.length>0),k=O.flatMap(e=>[...e.folder?[`${qg}${e.folder.id}`]:[],...e.projects.map(e=>e.id)]),A=Ds(Yg);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ts,{modal:!0,open:o,onOpenChange:e=>{s(e),e||l(``)},children:[(0,Z.jsx)(vs,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`project-switcher`,"aria-label":S?`Project: ${S.name} — switch project`:`Switch project`,"aria-keyshortcuts":`Meta+Shift+P Control+Shift+P`,title:`Switch project (${A})`,className:H(`mx-3 mb-2 flex h-9 items-center gap-2 rounded-md border border-border bg-card px-2.5 text-left text-ui font-semibold outline-none transition-colors hover:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50`,o&&`border-violet ring-[3px] ring-violet/25`),children:[S?(0,Z.jsx)(Pl,{tone:Zg(S.status)}):null,(0,Z.jsx)(`span`,{"data-slot":`project-switcher-name`,className:`min-w-0 truncate`,children:S?.name??`Projects`}),S?.branch?(0,Z.jsx)(`span`,{"data-slot":`project-switcher-branch`,className:`ml-auto min-w-0 max-w-[45%] truncate font-mono text-micro font-medium text-soft-foreground`,children:S.branch}):null,x?(0,Z.jsxs)(`span`,{"data-slot":`project-switcher-elsewhere`,className:`flex shrink-0 items-center`,children:[(0,Z.jsx)(Pl,{tone:`info`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`${x} ${x===1?`task needs`:`tasks need`} you in other projects`})]}):null,(0,Z.jsx)(qa,{className:H(`size-3.5 shrink-0 text-soft-foreground`,!S?.branch&&!x&&`ml-auto`),"aria-hidden":`true`})]})}),(0,Z.jsx)(Cs,{align:`start`,sideOffset:6,"data-slot":`project-switcher-popover`,className:`w-[min(23rem,calc(100vw-2rem))] p-0`,children:(0,Z.jsxs)(ql,{shouldFilter:!1,loop:!0,label:`Switch project`,defaultValue:t??void 0,children:[(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(zl,{placeholder:`Search projects…`,value:c,onValueChange:l,className:`pr-12`}),(0,Z.jsx)(Xo,{className:`pointer-events-none absolute top-1/2 right-3 -translate-y-1/2`,children:A})]}),(0,Z.jsxs)(Kl,{label:`Switch project`,className:`max-h-[min(24rem,60vh)]`,children:[(0,Z.jsx)(Gl,{children:`No project matches.`}),(0,Z.jsx)(Zs,{sensors:p,collisionDetection:$s,accessibility:{announcements:m},onDragEnd:h,children:(0,Z.jsx)(Qs,{items:k,strategy:Ys,children:O.map(e=>(0,Z.jsx)(r_,{section:e,searching:c.trim()!==``,activeId:t,counts:b,sortable:f,onSelect:D,onEditFolder:e=>_(e)},e.folder?.id??`ungrouped`))})})]}),(0,Z.jsxs)(`div`,{"data-slot":`project-switcher-footer`,className:`flex items-center gap-1 border-t border-border px-2 py-1.5`,children:[n?null:(0,Z.jsx)(n_,{onPick:T}),(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`project-folder-create`,onClick:()=>_(null),className:`flex h-[30px] items-center gap-[7px] rounded-sm px-2.5 text-label font-semibold text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,Z.jsx)(od,{className:`size-3.5`,"aria-hidden":`true`}),`New folder`]}),(0,Z.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 text-micro text-soft-foreground`,"aria-hidden":`true`,children:[(0,Z.jsx)(Xo,{children:`↑↓`}),(0,Z.jsx)(Xo,{children:`↵`}),(0,Z.jsx)(Xo,{children:`esc`})]})]})]})})]}),C===`folder`?(0,Z.jsx)(Mf,{label:`Open local folder`,onError:()=>w(null),children:(0,Z.jsx)(bf,{open:!0,onOpenChange:E})}):C===`clone`?(0,Z.jsx)(Mf,{label:`Clone from GitHub`,onError:()=>w(null),children:(0,Z.jsx)(Sf,{open:!0,onOpenChange:E})}):C===`new`?(0,Z.jsx)(Mf,{label:`New project`,onError:()=>w(null),children:(0,Z.jsx)(Df,{open:!0,onOpenChange:E})}):null,g===void 0?null:(0,Z.jsx)(Bg,{projects:e,folder:g,onClose:()=>_(void 0),onSave:v})]})}function n_({onPick:e}){return(0,Z.jsxs)(lo,{children:[(0,Z.jsx)(oo,{asChild:!0,children:(0,Z.jsxs)(q,{variant:`ghost`,size:`sm`,"data-slot":`add-project`,"aria-label":`Add project`,children:[(0,Z.jsx)(ts,{className:`size-3.5`,"aria-hidden":`true`}),`Add project`]})}),(0,Z.jsxs)(so,{align:`start`,className:`w-56`,children:[(0,Z.jsx)($a,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,Z.jsxs)(ro,{"data-slot":`add-project-local`,onSelect:()=>e(`folder`),children:[(0,Z.jsx)(Eo,{"aria-hidden":`true`}),`Open local folder…`]}),(0,Z.jsxs)(ro,{"data-slot":`add-project-clone`,onSelect:()=>e(`clone`),children:[(0,Z.jsx)(Nf,{"aria-hidden":`true`}),`Clone from GitHub…`]}),(0,Z.jsxs)(ro,{"data-slot":`add-project-create`,onSelect:()=>e(`new`),children:[(0,Z.jsx)(od,{"aria-hidden":`true`}),`New project…`]})]})]})}function r_({section:e,searching:t,activeId:n,counts:r,sortable:i,onSelect:a,onEditFolder:o}){let{folder:s}=e,c=s?`${qg}${s.id}`:null,l=i&&s!==null&&!t,{attributes:u,listeners:d,setNodeRef:f,transform:p,transition:m,isDragging:h}=Hs({id:c??`ungrouped`,disabled:!l}),g=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[s?(0,Z.jsx)(Eo,{className:`size-3 shrink-0`,"aria-hidden":`true`}):null,(0,Z.jsx)(`span`,{className:`truncate`,children:s?s.name:`No folder`}),(0,Z.jsxs)(`span`,{className:`font-mono font-normal tracking-normal`,"aria-label":`${e.projects.length} project${e.projects.length===1?``:`s`}`,children:[`· `,e.projects.length]}),s?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Edit ${s.name}`,onClick:()=>o(s),className:`ml-auto rounded px-1 text-xs tracking-normal text-muted-foreground hover:bg-muted hover:text-foreground`,children:`…`}),(0,Z.jsx)(`button`,{type:`button`,"data-slot":`project-folder-grip`,disabled:!l,"aria-label":`Reorder folder ${s.name}`,className:H(`flex size-5 shrink-0 cursor-grab touch-none items-center justify-center rounded text-soft-foreground outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,!l&&`invisible`),...u,...d,children:(0,Z.jsx)(ya,{className:`size-3`,"aria-hidden":`true`})})]}):null]});return(0,Z.jsx)(`div`,{ref:s?f:void 0,style:s?{transform:Xs.Translate.toString(p),transition:m}:void 0,"data-slot":`switcher-section`,"data-folder":s?.id??void 0,className:H(h&&`relative z-10 opacity-40`),children:(0,Z.jsxs)(Vl,{heading:g,className:`[&_[cmdk-group-heading]]:eyebrow [&_[cmdk-group-heading]]:flex [&_[cmdk-group-heading]]:text-soft-foreground`,children:[e.projects.length===0&&!t?(0,Z.jsx)(`p`,{className:`px-2 py-1 text-xs text-soft-foreground`,children:`No projects`}):null,e.projects.map(e=>(0,Z.jsx)(i_,{project:e,current:e.id===n,counts:r.get(e.id),sortable:i&&!t,onSelect:a},e.id))]})})}function i_({project:e,current:t,counts:n,sortable:r,onSelect:i}){let a=e.status===`missing`,o=r&&!a&&!e.unregistered,{attributes:s,listeners:c,setNodeRef:l,transform:u,transition:d,isDragging:f}=Hs({id:e.id,disabled:!o});return(0,Z.jsx)(`div`,{ref:l,style:{transform:Xs.Translate.toString(u),transition:d},"data-slot":`switcher-project`,"data-project":e.id,"data-status":e.status,"data-current":t?``:void 0,"data-dragging":f?``:void 0,className:H(f&&`relative z-10 opacity-40`),children:(0,Z.jsxs)(Wl,{value:e.id,disabled:a,onSelect:()=>i(e),title:a?`${e.root} is gone — remove it in Global settings → Projects`:e.root,"aria-current":t?`true`:void 0,className:`group/row gap-2 py-1.5 pl-1 pr-2`,children:[(0,Z.jsx)(`button`,{type:`button`,"data-slot":`project-grip`,disabled:!o,"aria-label":`Reorder ${e.name}`,onClick:e=>e.stopPropagation(),className:H(`flex size-5 shrink-0 cursor-grab touch-none items-center justify-center rounded text-soft-foreground opacity-0 outline-none transition-opacity`,`focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 group-hover/row:opacity-70 group-data-[selected=true]/row:opacity-70 [@media(hover:none)]:opacity-70`,!o&&`cursor-default opacity-0 group-hover/row:opacity-0 group-data-[selected=true]/row:opacity-0 [@media(hover:none)]:opacity-0`),...s,...c,children:(0,Z.jsx)(ya,{className:`size-3.5`,"aria-hidden":`true`})}),(0,Z.jsx)(Pl,{tone:Zg(e.status)}),(0,Z.jsxs)(`span`,{className:H(`flex min-w-0 flex-1 items-baseline gap-2`,a&&`opacity-55`),children:[(0,Z.jsx)(`span`,{"data-slot":`switcher-project-name`,className:`truncate font-medium`,children:e.name}),e.branch?(0,Z.jsx)(`span`,{"data-slot":`switcher-project-branch`,className:`truncate font-mono text-micro text-soft-foreground`,children:e.branch}):null]}),e.unregistered?(0,Z.jsx)(`span`,{"data-slot":`project-unregistered`,title:`cezar is serving this folder — it is not in your saved projects.`,className:`shrink-0 rounded-full bg-muted px-[7px] py-px text-micro font-medium text-soft-foreground`,children:`not saved`}):null,a?(0,Z.jsx)(`span`,{"data-slot":`project-missing`,className:`shrink-0 rounded-full bg-danger/15 px-[7px] py-px text-micro font-medium text-danger`,children:`folder not found`}):null,n?.needsYou?(0,Z.jsx)(`span`,{"data-slot":`project-attention`,title:`${n.needsYou} task${n.needsYou===1?``:`s`} need${n.needsYou===1?`s`:``} you`,className:`shrink-0 rounded-full bg-violet px-1.5 py-px text-micro font-semibold text-violet-foreground tabular-nums`,children:n.needsYou}):null,n?.running?(0,Z.jsxs)(`span`,{"data-slot":`project-running`,title:`${n.running} running`,className:`flex shrink-0 items-center gap-0.5 text-micro text-violet tabular-nums`,children:[(0,Z.jsx)(Mo,{className:`size-3 animate-spin motion-reduce:animate-none`,"aria-hidden":`true`}),n.running]}):null,(0,Z.jsx)(`span`,{className:`flex w-3.5 shrink-0 justify-center text-violet`,"aria-hidden":`true`,children:t?(0,Z.jsx)(Wa,{className:`size-3.5`}):null})]})})}function a_({archived:e,onToggle:t,className:n}){let r=e?Hu:Zi;return(0,Z.jsx)(el,{label:e?`Move back to the active list`:`Move to the archived list`,children:(0,Z.jsx)(`button`,{type:`button`,"data-slot":`archive-toggle`,"aria-label":e?`Unarchive task`:`Archive task`,onClick:n=>{n.stopPropagation(),t(!e)},className:H(`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`,n),children:(0,Z.jsx)(r,{className:`size-3`,"aria-hidden":`true`})})})}function o_(e){return e.kind===`tracker`&&!!e.trackerTrigger&&(!e.trackerTrigger.access||e.trackerTrigger.access.writes.length>0)}var s_=`Creates a paused, read-only automation. Review its prompt and grant any required writes in the cockpit editor before enabling.`,c_=e=>`"${e.replace(/(["\\$`!])/g,`\\$1`)}"`;function l_(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function u_(e){if(e.schedules&&e.schedules.length>1||e.kind===`tracker`)return!1;if(e.kind===`schedule`)return!!e.schedule&&(e.schedule.type!==`once`||!!e.schedule.date);if(!e.events?.length)return!1;let t=e.filters??{};return!([`assignees`,`allLabels`,`excludeLabels`,`changedLabels`].some(e=>(t[e]?.length??0)>0)||t.lookbackDays!==void 0&&t.lookbackDays!==7||t.maxRecords!==void 0&&t.maxRecords!==25)}function d_(e){let t=[`cez automation add`,`--name ${c_(e.name||`untitled`)}`];if(e.kind===`schedule`&&e.schedule?.type===`once`){let n=or(e.schedule);t.push(`--at ${c_(`${n.date} ${Er(n.hour,n.minute)}`)}`)}else if(e.kind===`schedule`&&e.schedule)t.push(`--cron ${c_(cr(e.schedule))}`);else{t.push(`--on ${(e.events??[]).join(`,`)}`),t.push(`--every ${l_(e.intervalSeconds??300)}`);for(let n of e.filters?.anyLabels??[])t.push(`--label ${c_(n)}`);for(let n of e.filters?.authors??[])t.push(`--author ${c_(n)}`)}let{task:n}=e;return n.workflow&&t.push(`--workflow ${c_(n.workflow)}`),n.runner&&t.push(`--runner ${c_(n.runner)}`),n.model&&t.push(`--model ${c_(n.model)}`),n.autonomous===!1?t.push(`--no-autonomous`):n.autonomous&&t.push(`--autonomous`),n.dispatch&&(t.push(`--dispatch`),n.dispatch.maxSubtasks!==void 0&&t.push(`--max-subtasks ${n.dispatch.maxSubtasks}`),n.dispatch.reviewChild&&t.push(`--review-child`)),e.enable&&t.push(`--enable`),t.push(`--prompt ${c_(n.prompt||`…`)}`),t.join(` `)}function f_(e){let t={name:e.name||`untitled`,kind:e.kind,...e.kind===`schedule`?{schedule:e.schedule,...e.schedules?{schedules:e.schedules}:{}}:e.kind===`tracker`?{trackerTrigger:e.trackerTrigger?{...e.trackerTrigger,access:{version:1,writes:[]}}:void 0,intervalSeconds:e.intervalSeconds??1800,filters:{lookbackDays:7,maxRecords:25,...e.filters}}:{events:e.events,intervalSeconds:e.intervalSeconds??300,filters:{lookbackDays:7,maxRecords:25,...e.filters}},task:e.task,...e.enable&&!o_(e)?{enable:!0}:{}};return`cez automation create --json '${JSON.stringify(t).replace(/'/g,`'\\''`)}'`}function p_(e){return u_(e)?d_(e):f_(e)}var m_=()=>[fr(),`automations`];function h_(){let e=E(),t=e.data!==void 0;return{known:t,off:t&&e.data?.capabilities?.automations!==!0}}function g_(e){let t=V(),n=Nr(),r=Xn({queryKey:m_(),queryFn:({signal:e})=>kt({signal:e}),enabled:e});return(0,X.useEffect)(()=>ai((e,r)=>{if(e!==`automation-change`)return;let i=r;typeof i.project==`string`&&(n===null||i.project===n)&&t.invalidateQueries({queryKey:m_()})}),[n,t]),r}function __(e){let t=V(),n=()=>t.invalidateQueries({queryKey:m_()}),r=e=>Y(e instanceof Error?e.message:String(e),{tone:`danger`}),i=B({mutationFn:async e=>{e.kind===`schedule`?(await Te(e.id),Y(`Started "${e.name}" — the task is queued.`)):(await x(e.id,`execute`),Y(`Checking events for "${e.name}" now.`))},onSuccess:()=>void n(),onError:r}),a=B({mutationFn:async e=>{await x(e.id,`preview`),Y(`Preview queued for "${e.name}" — no tasks will launch. See the execution log for results.`)},onSuccess:()=>void n(),onError:r}),o=B({mutationFn:e=>D(e.id,!e.enabled),onSuccess:()=>void n(),onError:r}),s=B({mutationFn:async e=>{let{cancelled:t,kept:n}=await Hn(e.id),r=n.length?` ${n.length} kept: ${n.length===1?`it has`:`they have`} running subtasks — stop ${n.length===1?`it`:`them`} from Tasks.`:``;Y(`Cancelled ${t.length} queued task${t.length===1?``:`s`} of "${e.name}".${r}`)},onSuccess:()=>void n(),onError:r}),l=B({mutationFn:e=>Ce({name:`${e.name} (copy)`,...e.description?{description:e.description}:{},kind:e.kind,...e.kind===`schedule`?{schedule:e.schedule,...e.schedules?{schedules:e.schedules}:{}}:e.kind===`tracker`?{trackerTrigger:e.trackerTrigger,intervalSeconds:e.intervalSeconds,filters:e.filters}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:e.task}),onSuccess:e=>{Y(`Duplicated as "${e.automation.name}", paused.`),n()},onError:r}),u=B({mutationFn:e=>Xe(e.id),onSuccess:()=>void n(),onError:r});return{preview:e=>a.mutateAsync(e).then(()=>void 0,()=>void 0),runNow:e=>i.mutateAsync(e).then(()=>void 0,()=>void 0),toggleEnabled:e=>o.mutateAsync(e).then(()=>void 0,()=>void 0),loadWork:e=>c(e.id).catch(e=>{r(e)}),cancelQueued:e=>s.mutateAsync(e).then(()=>void 0,()=>void 0),duplicate:e=>l.mutateAsync(e).then(()=>void 0,()=>void 0),remove:e=>u.mutateAsync(e).then(()=>void 0,()=>void 0),copyCli:async e=>{await v_(p_({name:e.name,kind:e.kind,trackerTrigger:e.trackerTrigger,schedule:e.schedule,schedules:e.schedules,events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters,task:e.task}),o_(e)?s_:void 0)},busy:a.isPending||i.isPending||o.isPending||s.isPending||l.isPending||u.isPending}}async function v_(e,t){try{await Xl(e),Y(t?`Copied to the clipboard. ${t}`:`Copied to the clipboard.`)}catch{Y(`Copy failed — select the text to copy it.`,{tone:`danger`})}}function y_({compact:e=!1,enabled:t=!0}){let[n,r]=(0,X.useState)([]),i=h_(),a=g_(t&&i.known&&!i.off).data?.automations.filter(e=>e.deferredStart)??[];return!a.length&&!n.length?null:(0,Z.jsxs)(`section`,{"aria-label":`Scheduled tasks`,className:e?`px-2 py-3`:`border-b p-4 md:px-5`,children:[(0,Z.jsxs)(`h2`,{className:`mb-2 eyebrow text-muted-foreground`,children:[`Scheduled · `,a.length]}),n.length>0&&(0,Z.jsxs)(`p`,{role:`status`,children:[`This scheduled task already started. `,n.map((e,t)=>(0,Z.jsxs)(G,{to:`/tasks/${e}`,className:`mr-3 underline`,children:[`View run `,t+1]},e))]}),e?a.map(e=>(0,Z.jsxs)(G,{to:`/#scheduled-${e.id}`,className:`block truncate rounded px-2 py-1.5 text-sm`,children:[`◷ `,e.name]},e.id)):(0,Z.jsx)(`div`,{className:`grid gap-3`,children:a.map(e=>(0,Z.jsx)(b_,{item:e,onAlreadyStarted:r},e.id))})]})}function b_({item:e,onAlreadyStarted:t}){let n=Kr(),r=e.deferredStart,i=Lr(),a=V(),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(``),g=()=>{if(u){d(null);return}p(e.schedule?.date??``),h(`${String(e.schedule?.hour??0).padStart(2,`0`)}:${String(e.schedule?.minute??0).padStart(2,`0`)}`),d(e),l(``)},_=async e=>{s(!0),l(``);try{await e()}catch(e){e instanceof sn&&e.runIds?.length?t(e.runIds):l(e instanceof Error?e.message:String(e))}finally{await a.invalidateQueries({queryKey:m_()}),s(!1)}},v=r.runIds.length>0,y=v&&r.status===`failed`&&r.failureKind===`ambiguous`,b=r.failureKind===`binding-invalid`,x=`scheduled-${e.id}`,[S,C]=(0,X.useState)(!1);(0,X.useEffect)(()=>{n.hash===`#${x}`&&(C(!0),document.getElementById(x)?.scrollIntoView?.({block:`nearest`}))},[x,n.hash,n.key]);let w=e.task.steps?.flatMap(e=>e.skill?[e.skill]:[])??[],T=e.task.workflow??(w.length?`Skills: ${w.join(`, `)}`:`Inline steps`),E=r.binding.models?.map(e=>`${e.step?`${e.step}: `:``}${e.runner} / ${e.model??`Provider default`}`).join(`; `)??e.task.model??`Resolved step models unavailable`,D=r.status===`failed`?`Couldn't start`:r.status===`missed`?`Missed`:r.status===`launching`?`Starting…`:r.holdUntil?`Waiting for reset`:`Scheduled`;return(0,Z.jsxs)(`details`,{id:x,open:S,onToggle:e=>C(e.currentTarget.open),className:`rounded-lg border p-3`,children:[(0,Z.jsxs)(`summary`,{className:`cursor-pointer text-sm`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,Z.jsxs)(`span`,{className:`ml-2 text-muted-foreground`,children:[D,` · `,new Date(r.notBefore).toLocaleString(`en-GB`,{timeZone:r.timeZone}),` · `,r.timeZone]})]}),(0,Z.jsxs)(`div`,{className:`mt-3 space-y-3 text-sm`,children:[(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:e.task.prompt}),(0,Z.jsxs)(`p`,{className:`text-muted-foreground`,children:[T,` · `,E,` · `,r.binding.accounts.map(e=>`${e.runner} / ${e.id}`).join(`, `)]}),(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`The server must be running. This is the earliest start; account holds and queue limits still apply.`}),r.holdUntil&&(0,Z.jsxs)(`p`,{children:[`Waiting until `,new Date(r.holdUntil).toLocaleString(`en-GB`,{timeZone:r.timeZone}),` for a newer observed reset.`]}),r.error&&(0,Z.jsx)(`p`,{role:`status`,children:r.error}),y&&(0,Z.jsx)(`p`,{children:`Check the runs below. Start missing runs creates only the ones that do not exist yet — a run you deleted starts again. Dismiss removes this entry and starts nothing.`}),r.runIds.map((e,t)=>(0,Z.jsxs)(G,{to:`/tasks/${e}`,className:`mr-3 underline`,children:[`Check run `,t+1]},e)),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(q,{size:`sm`,variant:`ghost`,disabled:o,onClick:()=>void _(()=>Xl(e.task.prompt)),children:`Copy prompt`}),(0,Z.jsx)(q,{size:`sm`,variant:`outline`,disabled:o||v&&!y,onClick:()=>void _(async()=>{let t=await Te(e.id,e.revision);i(`/tasks/${t.runId}`)}),children:y?`Start missing runs`:r.status===`failed`?`Retry`:`Run now`}),(0,Z.jsx)(q,{size:`sm`,variant:`ghost`,disabled:o||v||b,onClick:g,children:`Change time`}),(0,Z.jsx)(q,{size:`sm`,variant:`ghost`,disabled:o||v&&!y,onClick:()=>void _(()=>Xe(e.id,e.revision)),children:y?`Dismiss`:`Cancel`})]}),u&&!b&&(0,Z.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:t=>{t.preventDefault(),_(async()=>{let[t,n]=m.split(`:`).map(Number);await oe(e.id,{expectedRevision:u.revision,name:u.name,kind:`schedule`,task:u.task,schedule:{type:`once`,date:f,hour:t??0,minute:n??0},enabled:!0}),d(null)})},children:[(0,Z.jsxs)(`label`,{children:[`Date`,(0,Z.jsx)(gl,{type:`date`,required:!0,value:f,onChange:e=>p(e.target.value)})]}),(0,Z.jsxs)(`label`,{children:[`Time (server time zone)`,(0,Z.jsx)(gl,{type:`time`,required:!0,value:m,onChange:e=>h(e.target.value)})]}),(0,Z.jsx)(q,{type:`submit`,disabled:o,children:`Save time`})]}),c&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:c})]})]})}var x_=new Map,S_=new Set,C_=()=>{for(let e of S_)e()},w_=e=>(S_.add(e),()=>{S_.delete(e)});function T_(e=fr()){x_.delete(e),C_()}function E_(){let e=h_(),t=Nr(),n=t??fr(),r=(0,X.useSyncExternalStore)(w_,()=>x_.has(n)),i=g_(!1),a=i.data?.automations.some(e=>e.deferredStart)??!1;return(0,X.useEffect)(()=>ai((e,r)=>{e===`automation-change`&&(t===null||r.project===t)&&T_(n)}),[t,n]),(0,X.useEffect)(()=>{i.data&&!a&&!x_.has(n)&&(x_.set(n,i.dataUpdatedAt),C_())},[i.data,i.dataUpdatedAt,a,n]),e.known&&!e.off&&(!r||a)}function D_(){return(0,Z.jsx)(`span`,{"data-slot":`unread-marker`,className:`sr-only`,children:`, unread`})}function O_(e){return e===void 0?`unknown`:new Intl.NumberFormat().format(e)}function k_(e,t){return`Input tokens: ${O_(e)}; output tokens: ${O_(t)}`}function A_(e,t,n=`compact`){let r=e===void 0?`—`:Nl(e),i=t===void 0?`—`:Nl(t);return n===`table`?`${r} / ${i}`:`IN ${r} · OUT ${i}`}function j_({inputTokens:e,outputTokens:t,variant:n=`compact`,omitWhenUnknown:r=!0,className:i}){return r&&e===void 0&&t===void 0?null:(0,Z.jsx)(`span`,{"data-slot":`directional-usage`,"aria-label":k_(e,t),className:H(`font-mono tabular-nums`,i),children:A_(e,t,n)})}var M_={statuses:[],workflows:[],automations:[]};function N_(e){return e.statuses.length+e.workflows.length+e.automations.length}function P_(e){let t=new Map(e.map(e=>[e.id,e]));return new Map(e.map(e=>[e.id,zp(e,e=>t.get(e))]))}var F_=(e,t)=>e.length===0||t!==void 0&&e.includes(t);function I_(e,t,n,r){return e.filter(e=>{let i=r.get(e.id);return!(!Hp(i,t)||!F_(n.statuses,e.status)||!F_(n.workflows,O(e))||t!==`regular`&&!F_(n.automations,i))})}function L_(e,t){return t===`all`?[...e]:I_(e,t,M_,P_(e))}function R_(e,t,n,r,i){let a=new Map;for(let o of I_(e,t,{...n,[i]:[]},r)){let e=i===`statuses`?o.status:i===`workflows`?O(o):r.get(o.id);e!==void 0&&a.set(e,(a.get(e)??0)+1)}return a}function z_(e,t,n){return{regular:I_(e,`regular`,t,n).length,automation:I_(e,`automation`,t,n).length,all:I_(e,`all`,t,n).length}}function B_(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 V_(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 H_(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 U_(e,t){return H_(V_(e),t)}function W_(e){return e<=0?null:`${e} subtask${e===1?``:`s`}`}function G_(e){return e.dispatch?.parentRunId===void 0?null:e.dispatch.kind??`implement`}var K_=X.createContext(void 0),q_=`flex w-0 shrink-0 items-center gap-0.5 overflow-hidden opacity-0 group-hover/task-row:mr-1.5 group-hover/task-row:w-auto group-hover/task-row:opacity-100 group-focus-within/task-row:mr-1.5 group-focus-within/task-row:w-auto group-focus-within/task-row:opacity-100 no-hover:mr-1.5 no-hover:w-auto no-hover:opacity-100`,J_=`no-hover:size-7`,Y_=`no-hover:hidden`,X_=`group-hover/task-row:min-w-0 group-focus-within/task-row:min-w-0 no-hover:min-w-0`;X.memo(function({run:e,depth:t=0,childCount:n=0,queuePosition:r,currentRunId:i,now:a,scope:o,variant:c=!1,showTokens:l,showCost:u,onTogglePin:d,onToggleArchive:f}){let p=!!f&&(!!e.archived||!Va(e.status)),m=!!d||p,h=s(e),g=X.useId(),_=e.id===i,v=ve(e,X.useContext(K_)),y=Ge(e),b=te(y,v?.number)?ce(y).rest:y,x=ka(e),S=Na(e),C=c?``:r===null?Ml(er(e),a):`#${r}`,w=W_(n),T=G_(e);return(0,Z.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":_?`true`:void 0,"data-depth":t,style:t>0?{paddingLeft:`${10+t*14}px`}:void 0,className:H(`group/task-row flex items-center gap-2 rounded-sm pl-2.5 hover:bg-muted`,_&&`bg-muted`,c&&`pl-[26px]`),children:[(0,Z.jsx)(G,{to:Br(o,`/tasks/${e.id}`),tabIndex:-1,"aria-hidden":`true`,"data-slot":`task-row-dot-link`,className:`-ml-2.5 flex shrink-0 items-center self-stretch pl-2.5`,children:(0,Z.jsx)(Pl,{id:g,tone:h.tone,pulse:h.pulse,"aria-label":h.label,role:`img`})}),v?(0,Z.jsx)(Rl,{run:e,reference:v,compact:!0,className:`h-auto shrink-0 gap-[2px] px-1.5 py-px text-micro`}):null,(0,Z.jsxs)(G,{to:Br(o,`/tasks/${e.id}`),title:y,"aria-current":_?`page`:void 0,"aria-describedby":g,"data-slot":`task-row-link`,className:H(`flex min-w-0 flex-1 items-center gap-2 py-[7px]`,m?`pr-0.5`:`pr-2.5`),children:[c?(0,Z.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,Z.jsxs)(`span`,{"data-slot":`task-row-title`,className:H(`min-w-[7rem] flex-1 truncate text-ui`,m&&X_,x?`font-semibold text-foreground`:S?`font-medium text-muted-foreground`:`font-medium`),children:[c?Z_(e,l,u):b,e.queueWaitReason&&(0,Z.jsx)(`span`,{className:`block truncate text-meta font-normal text-muted-foreground`,children:ha(e.queueWaitReason)})]}),(0,Z.jsxs)(`span`,{"data-slot":`task-row-meta`,className:H(`contents`,m&&`group-hover/task-row:hidden group-focus-within/task-row:hidden`),children:[(0,Z.jsxs)(`span`,{"data-slot":`task-row-meta-droppable`,className:H(`contents`,m&&Y_),children:[T?(0,Z.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,children:T}):null,e.diffStat?(0,Z.jsx)(Yl,{stat:e.diffStat,className:`hidden shrink-0 text-micro @min-[23rem]/sidebar:inline`}):null,w?(0,Z.jsx)(`span`,{"data-slot":`subtask-count`,title:w,className:`hidden shrink-0 rounded-full bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground @min-[19rem]/sidebar:inline`,children:n}):null]}),C&&(r!==null||!v)?(0,Z.jsx)(`span`,{"data-slot":`task-row-age`,className:H(`shrink-0 text-meta text-soft-foreground tabular-nums`,T&&t>0&&r===null&&`hidden @min-[19rem]/sidebar:inline`),children:C}):null]}),x?(0,Z.jsx)(D_,{}):null]}),o===null&&e.subject?(0,Z.jsx)(qi,{run:e,className:m?`mr-0.5`:`mr-2.5`}):null,m?(0,Z.jsxs)(`div`,{"data-slot":`task-row-actions`,className:q_,children:[d?(0,Z.jsx)(ia,{pinned:!!e.pinned,onToggle:t=>d(e,t),className:J_}):null,p&&f?(0,Z.jsx)(a_,{archived:!!e.archived,onToggle:t=>f(e,t),className:J_}):null]}):null]})});function Z_(e,t,n){let r=[e.runner??`claude`];t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&r.push(A_(e.inputTokens,e.outputTokens));let i=ze(e.costUsd);return n&&i&&r.push(i),r.join(` · `)}var Q_={permission:0,error:0,waiting:0,running:1,unseen:2,none:2};function $_(e,t=6){return e.filter(e=>!e.archived).map(e=>({run:e,rank:nt[s(e).bucket]})).sort((e,t)=>{let n=Q_[s(e.run).bucket]-Q_[s(t.run).bucket];if(n!==0)return n;let r=Number(!!t.run.pinned)-Number(!!e.run.pinned);return r===0?e.rank===t.rank?pe(er(e.run),er(t.run)):e.rank-t.rank:r}).slice(0,t).map(({run:e})=>e)}function ev({runs:e,currentRunId:t=null,now:n=Date.now(),onTogglePin:r,onToggleArchive:i}){let a=$_(e),o=Ye(e),s=yh();return(0,Z.jsxs)(`div`,{"data-slot":`current-tasks`,children:[(0,Z.jsx)(`h2`,{className:`px-3 pt-3 pb-1 eyebrow text-soft-foreground`,children:`Current tasks`}),a.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-1.5 text-xs text-soft-foreground`,children:`No tasks yet — describe one.`}):a.map(e=>(0,Z.jsx)(tv,{run:e,current:e.id===t,queuePosition:o.get(e.id)??null,now:n,onTogglePin:r,onToggleArchive:i},e.id)),(0,Z.jsx)(G,{to:`/tasks`,onClick:s,"data-slot":`current-tasks-more`,className:`flex h-9 items-center rounded-md px-3 text-label text-muted-foreground transition-colors hover:text-foreground md:h-7`,children:`More…`})]})}var tv=X.memo(function({run:e,current:t,queuePosition:n,now:r,onTogglePin:i,onToggleArchive:a}){let o=yh(),c=!!a&&(!!e.archived||!Va(e.status)),l=!!i||c,u=s(e),d=X.useId(),f=ve(e,X.useContext(K_)),p=Ge(e),m=te(p,f?.number)?ce(p).rest:p,h=ka(e),g=Na(e),_=n===null?Ml(er(e),r):`#${n}`;return(0,Z.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":t?`true`:void 0,className:H(`group/task-row flex items-center gap-2 rounded-sm pl-2.5 hover:bg-muted`,t&&`bg-muted`),children:[(0,Z.jsx)(G,{to:`/tasks/${e.id}`,tabIndex:-1,"aria-hidden":`true`,"data-slot":`task-row-dot-link`,onClick:o,className:`-ml-2.5 flex shrink-0 items-center self-stretch pl-2.5`,children:(0,Z.jsx)(Pl,{id:d,tone:u.tone,pulse:u.pulse,"aria-label":u.label,role:`img`})}),f?(0,Z.jsx)(Rl,{run:e,reference:f,compact:!0,className:`h-auto shrink-0 gap-[2px] px-1.5 py-px text-micro`}):null,(0,Z.jsxs)(G,{to:`/tasks/${e.id}`,title:p,"aria-current":t?`page`:void 0,"aria-describedby":d,"data-slot":`task-row-link`,onClick:o,className:H(`flex min-w-0 flex-1 items-center gap-2 py-[7px]`,l?`pr-0.5`:`pr-2.5`),children:[(0,Z.jsx)(`span`,{"data-slot":`task-row-title`,className:H(`min-w-0 flex-1 truncate text-ui`,h?`font-semibold text-foreground`:g?`font-medium text-muted-foreground`:`font-medium`),children:m}),_?(0,Z.jsx)(`span`,{"data-slot":`task-row-age`,className:H(`shrink-0 text-meta text-soft-foreground tabular-nums`,l&&`group-hover/task-row:hidden group-focus-within/task-row:hidden`),children:_}):null,h?(0,Z.jsx)(D_,{}):null]}),l?(0,Z.jsxs)(`div`,{"data-slot":`task-row-actions`,className:q_,children:[i?(0,Z.jsx)(ia,{pinned:!!e.pinned,onToggle:t=>i(e,t),className:J_}):null,c&&a?(0,Z.jsx)(a_,{archived:!!e.archived,onToggle:t=>a(e,t),className:J_}):null]}):null]})});function nv(){let e=E(),t=Nr(),n=ge(t,e.data?.bootProject??null),[r]=Xp(),i=X.useMemo(()=>n.data?L_(n.data,r):void 0,[n.data,r]),a=E_(),o=jr(Kr().pathname)!==null,s=a&&(o||t===null||t===e.data?.bootProject),c=Wr(`/tasks/:id/*`),l=Wr(`/tasks/:id`),u=Ql(3e4),d=vn(`sidebar`),f=X.useCallback((e,t)=>d.mutate({id:e.id,pinned:t},{onError:e=>Y(e.message,{tone:`danger`})}),[d.mutate]),p=rn(`sidebar`),m=X.useCallback((e,t)=>p.mutate({id:e.id,archived:t},{onError:e=>Y(e.message,{tone:`danger`})}),[p.mutate]),h=Wt(),g=rt(),_=X.useMemo(()=>i?$_(i):[],[i]),v=X.useMemo(()=>h===void 0?[]:_.flatMap(e=>xe(e).map(e=>({projectId:h,kind:e.kind,number:e.number}))),[_,h]);return i?(0,Z.jsx)(Ca,{projectId:h,requests:v,children:(0,Z.jsxs)(K_.Provider,{value:g,children:[s?(0,Z.jsx)(y_,{compact:!0}):null,(0,Z.jsx)(ev,{runs:i,currentRunId:c?.params.id??l?.params.id??null,now:u,onTogglePin:f,onToggleArchive:m})]})}):null}var rv={claude:!0,codex:!0,junie:!0,opencode:!0,cursor:!0,pi:!0,copilot:!0,omp:!0,antigravity:!0,gemini:!0,kimi:!0},iv=e=>Object.hasOwn(rv,e.name);function av(e){let t=e.checks.filter(iv);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`:e.disk?.level===`critical`?`disk almost full — ${ov(e.disk.freeBytes)} free`:null}function ov(e){return v(e)||`under 100 MB`}function sv(e){let t=e.disk;if(!t||t.level===`ok`)return null;let n=t.worktreesBytes?` Task worktrees use ${v(t.worktreesBytes)}.`:``,r=t.level===`critical`?` New agents will not start until space is freed.`:``;return`Only ${ov(t.freeBytes)} free on the disk holding task worktrees.${n}${r} Reclaim finished tasks' worktrees (branches are kept) or delete old tasks.`}function cv(e){let t=`cezar v${e.version}`,n=av(e);if(n)return`${t} · ${n}`;let r=e.disk?.level===`low`?` · low disk space (${ov(e.disk.freeBytes)} free)`:``,i=e.checks.filter(e=>!e.available).map(e=>e.name);return r?`${t}${r}`:i.length?`${t} · optional: ${i.join(`, `)} not installed`:t}function lv(e){return e===void 0||e?.available?null:e?e.available===void 0?null:`GitHub is unreachable — ${e.reason??`unknown reason`}. The GitHub tab can retry.`:`No GitHub remote detected — the GitHub tab is hidden. Every plain-git feature still works.`}function uv(e){return av(e)||sv(e)?`pending`:`success`}function dv({health:e,forge:t}){let n=lv(t),r=sv(e);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($a,{className:`eyebrow text-soft-foreground`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,Z.jsx)(fv,{check:e},e.name):(0,Z.jsx)(mv,{check:e},e.name)),n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(eo,{}),(0,Z.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-meta leading-snug text-muted-foreground`,children:n})]}):null,r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(eo,{}),(0,Z.jsx)(`p`,{"data-slot":`disk-note`,className:`px-2 pt-1.5 text-meta leading-snug text-muted-foreground`,children:r}),(0,Z.jsx)(ro,{asChild:!0,children:(0,Z.jsx)(G,{to:`/settings/worktrees`,"data-slot":`disk-reclaim`,className:`text-meta font-semibold text-violet`,children:`Manage worktrees →`})})]}):null,(0,Z.jsx)(eo,{}),(0,Z.jsx)(ro,{asChild:!0,children:(0,Z.jsxs)(U,{to:pv,"data-slot":`tools-settings`,className:`gap-2 text-label text-muted-foreground`,children:[(0,Z.jsx)(po,{className:`size-3.5`,"aria-hidden":`true`}),`Agent accounts`]})})]})}function fv({check:e}){return(0,Z.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,Z.jsx)(Pl,{tone:`success`}),(0,Z.jsx)(`span`,{className:`font-mono text-label font-medium`,children:e.name}),(0,Z.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-meta font-medium text-muted-foreground tabular-nums`,children:e.version??`not found`})]})}var pv=`/settings/global/accounts`;function mv({check:e}){let t=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Pl,{tone:`danger`}),(0,Z.jsx)(`span`,{className:`font-mono text-label font-medium`,children:e.name}),(0,Z.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-meta font-medium text-muted-foreground`,children:`not found`})]}),e.hint||iv(e)?(0,Z.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[e.hint?(0,Z.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-meta leading-snug text-muted-foreground`,children:e.hint}):null,iv(e)?(0,Z.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-meta font-semibold text-violet`,children:`Set up →`}):null]}):null]});return iv(e)?(0,Z.jsx)(ro,{asChild:!0,children:(0,Z.jsx)(U,{to:`${pv}?agent=${encodeURIComponent(e.name)}`,"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:t})}):(0,Z.jsx)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex flex-col items-stretch gap-1 rounded-sm px-2 py-1.5`,children:t})}function hv(e){return e.unread>0&&e.pendingActions>0?`approval`:e.unread>0&&e.pendingQuestions>0?`question`:e.important>0?`news`:null}function gv(e){return e.pendingActions+e.pendingQuestions+e.important}var _v=e=>e!==`news`,vv={approval:`Approval`,question:`Question`,news:`News`},yv={approval:`needs an approval`,question:`has a question`,news:`has news`},bv={approval:`asks for an approval`,question:`has a question`,news:`has news`};function xv(e,t){return t===`news`?e.headline??e.preview??`New message`:e.preview??zs(e)}function Sv(e,t){return`${e.name} ${bv[t]}: ${xv(e,t)}`}var Cv=`cez-manager-heads-seen`,wv=`cez-manager-heads-later`;function Tv(e){try{let t=JSON.parse(sessionStorage.getItem(e)??`{}`);return typeof t!=`object`||!t||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).filter(e=>typeof e[1]==`number`))}catch{return{}}}function Ev(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch{}}function Dv(e,t){let n=e[t.id];return n!==void 0&&gv(t)<=n}function Ov(e,t){let n={},r=!1;for(let[i,a]of Object.entries(e)){let e=t.find(e=>e.id===i),o=e?gv(e):0;if(o===0){r=!0;continue}n[i]=Math.min(a,o),n[i]!==a&&(r=!0)}return r?n:e}function kv(e,t){let n=e=>Date.parse(e.lastActivityAt??e.createdAt)||0;return e.flatMap(e=>{let n=hv(e);return n&&!Dv(t,e)?[{manager:e,kind:n}]:[]}).sort((e,t)=>n(e.manager)-n(t.manager))}function Av(e,t,n){return{arrivals:n.filter(t=>gv(t.manager)>(e[t.manager.id]??0)),seen:Object.fromEntries(t.map(e=>[e.id,gv(e)]))}}var jv=`cez-manager-heads`,Mv=`cez-manager-heads-change`;function Nv(){try{return localStorage.getItem(jv)!==`off`}catch{return!0}}function Pv(e){try{localStorage.setItem(jv,e?`on`:`off`)}catch{}window.dispatchEvent(new Event(Mv))}function Fv(e){return window.addEventListener(Mv,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(Mv,e),window.removeEventListener(`storage`,e)}}function Iv(){return(0,X.useSyncExternalStore)(Fv,Nv,()=>!0)}var Lv=8e3,Rv=12,zv=16,Bv=`[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]`,Vv=[`[data-slot="thread-dock"]`,`[data-slot="phone-bottom-bar"]`,`[data-slot="new-task-fab"]`],Hv=e=>e.width>0||e.height>0;function Uv(){let e=Vv.flatMap(e=>{let t=document.querySelector(e)?.getBoundingClientRect();return t&&Hv(t)?[{selector:e,rect:t}]:[]}),t=e.length===0?null:Math.min(...e.map(({rect:e})=>e.top)),n=e.find(({selector:e})=>e===Vv[0])?.rect;return{dialogOpen:document.querySelector(Bv)!==null,bottom:t===null?null:Math.round(window.innerHeight-t+Rv),right:n?Math.max(zv,Math.round(window.innerWidth-n.right+zv)):zv}}var Wv=(e,t)=>e.dialogOpen===t.dialogOpen&&e.bottom===t.bottom&&e.right===t.right;function Gv(e){let[t,n]=(0,X.useState)({dialogOpen:!1,bottom:null,right:zv});return(0,X.useEffect)(()=>{if(!e)return;let t=[],r=()=>{let e=Uv();n(t=>Wv(t,e)?t:e);let r=Vv.flatMap(e=>{let t=document.querySelector(e);return t?[t]:[]});(r.length!==t.length||r.some((e,n)=>e!==t[n]))&&(i.disconnect(),r.forEach(e=>i.observe(e)),t=r)},i=new ResizeObserver(r);r();let a=new MutationObserver(r);return a.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-state`]}),window.addEventListener(`resize`,r),()=>{a.disconnect(),i.disconnect(),window.removeEventListener(`resize`,r)}},[e]),t}function Kv(){let{pathname:e}=Kr(),t=E().data?.capabilities.managers===!0,n=Iv(),r=ii(!1).data?.managers,i=t&&n&&r!==void 0&&!Ps(e),a=Gv(i);return!i||a.dialogOpen?null:(0,Z.jsx)(Yv,{managers:r,bottom:a.bottom,right:a.right})}var qv=(e,t)=>`/manager/${encodeURIComponent(e.id)}${t&&_v(t)?`#needs-you`:``}`,Jv=e=>e===null?`calc(${zv}px + env(safe-area-inset-bottom, 0px))`:`${e}px`;function Yv({managers:e,bottom:t,right:n}){let[r,a]=(0,X.useState)(()=>Tv(wv)),o=Ov(r,e);(0,X.useEffect)(()=>{o!==r&&(a(o),Ev(wv,o))},[o,r]);let s=(0,X.useMemo)(()=>kv(e,o),[e,o]),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(null),[m,h]=(0,X.useState)(null),[g,_]=(0,X.useState)(null);(0,X.useEffect)(()=>{let{arrivals:t,seen:n}=Av(Tv(Cv),e,s);if(Ev(Cv,n),t.length===0)return;l(t.map(e=>Sv(e.manager,e.kind)).join(` `));let r=t.filter(e=>_v(e.kind)).at(-1);r&&(d(r.manager.id),_(null))},[e,s]),(0,X.useEffect)(()=>{if(u===null)return;let e=setTimeout(()=>d(null),Lv);return()=>clearTimeout(e)},[u]);let v=(0,X.useCallback)(e=>{let t={...o,[e.id]:gv(e)};a(t),Ev(wv,t),d(t=>t===e.id?null:t)},[o]),y=(0,X.useRef)(null),b=(0,X.useRef)(null);(0,X.useEffect)(()=>{let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.shiftKey||e.code!==`KeyM`)return;let t=y.current&&y.current.checkVisibility?.()!==!1?y.current:b.current;t&&(e.preventDefault(),t.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let x=i().data?.projects,S=(0,X.useCallback)(e=>x?.find(t=>t.id===e)?.name,[x]),C=s.slice(-2),w=s.length-C.length,T=[f,m,u].find(e=>e!==null&&e!==g)??null,E=s.at(-1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{"aria-live":`polite`,"data-slot":`manager-heads-announcer`,className:`sr-only`,children:c}),C.length>0?(0,Z.jsxs)(`div`,{"data-slot":`manager-heads`,style:{right:`calc(${n}px + env(safe-area-inset-right, 0px))`,bottom:Jv(t)},className:`pointer-events-none fixed z-20 flex flex-col items-end gap-2 max-md:hidden`,children:[w>0?(0,Z.jsxs)(U,{to:`/manager`,"data-slot":`manager-heads-more`,"aria-label":`${w} more ${w===1?`manager`:`managers`} waiting`,className:`pointer-events-auto rounded-full bg-card px-2 py-0.5 text-meta font-semibold text-muted-foreground shadow-md outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[`+`,w]}):null,C.map((e,t)=>{let n=e.manager.id,r=t===C.length-1;return(0,Z.jsxs)(`div`,{"data-slot":`manager-head-row`,"data-manager-id":n,className:`pointer-events-auto flex items-end gap-2.5`,onMouseEnter:()=>{p(n),_(null)},onMouseLeave:()=>p(e=>e===n?null:e),onFocus:()=>h(n),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(h(e=>e===n?null:e),_(e=>e===n?null:e))},onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),d(e=>e===n?null:e),_(n))},children:[T===n?(0,Z.jsx)(Zv,{head:e,project:js(e.manager.projects,S),onDismiss:()=>v(e.manager)}):null,(0,Z.jsx)(Xv,{head:e,large:r,arriving:u===n,onOpen:()=>v(e.manager),ref:r?y:void 0})]},n)})]}):null,E?(0,Z.jsxs)(U,{ref:b,to:qv(E.manager,E.kind),"data-slot":`manager-head-pill`,onClick:()=>v(E.manager),style:{bottom:Jv(t)},className:`fixed left-1/2 z-20 flex max-w-[calc(100%-32px)] -translate-x-1/2 items-center gap-2 rounded-full border border-border bg-card py-1 pr-2.5 pl-1 text-label whitespace-nowrap shadow-md outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 md:hidden`,children:[(0,Z.jsx)(go,{avatar:E.manager.avatar,mascot:E.manager.mascot,sizes:`24px`,className:`size-6 rounded-full object-cover`}),(0,Z.jsxs)(`span`,{className:`truncate`,children:[(0,Z.jsx)(`span`,{className:`font-semibold`,children:E.manager.name}),` `,yv[E.kind]]}),(0,Z.jsx)(Ga,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`})]}):null]})}function Xv({head:e,large:t,arriving:n,onOpen:r,ref:i}){let{manager:a,kind:o}=e;return(0,Z.jsxs)(U,{ref:i,to:qv(a,o),onClick:r,"data-slot":`manager-head`,"data-kind":o,"aria-label":`${a.name} ${yv[o]}`,className:H(`relative block shrink-0 rounded-full bg-card p-0.5 shadow-md outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t?`size-11`:`size-9`,n&&`motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-bottom-2 motion-safe:duration-500`),children:[(0,Z.jsx)(go,{avatar:a.avatar,mascot:a.mascot,sizes:t?`40px`:`32px`,className:H(`rounded-full object-cover`,t?`size-10`:`size-8`)}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`manager-head-badge`,className:H(`absolute -top-px -right-px size-3 rounded-full border-2 border-card`,_v(o)?`bg-info`:`bg-violet`)})]})}function Zv({head:e,project:t,onDismiss:n}){let{manager:r,kind:i}=e;return(0,Z.jsxs)(`div`,{role:`group`,"aria-label":`${r.name}: ${vv[i]}`,"data-slot":`manager-head-bubble`,className:`grid w-[262px] gap-2 rounded-[12px_12px_4px_12px] border border-border bg-card px-3 py-2.5 shadow-md motion-safe:animate-in motion-safe:fade-in-0`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-meta text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`truncate text-label font-semibold text-foreground`,children:r.name}),t?(0,Z.jsxs)(`span`,{className:`truncate`,children:[`· `,t]}):null,(0,Z.jsx)(`span`,{"data-slot":`manager-head-kind`,className:H(`ml-auto shrink-0 rounded-full px-[7px] py-px text-micro font-semibold`,_v(i)?`bg-info/10 text-info`:`bg-violet/10 text-violet`),children:vv[i]})]}),(0,Z.jsx)(`p`,{"data-slot":`manager-head-line`,className:`line-clamp-2 text-label text-foreground`,children:xv(r,i)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(q,{asChild:!0,size:`sm`,children:(0,Z.jsx)(U,{to:qv(r,i),onClick:n,"data-slot":`manager-head-open`,children:`Open chat`})}),(0,Z.jsx)(q,{size:`sm`,variant:`ghost`,onClick:n,"data-slot":`manager-head-later`,children:`Later`}),(0,Z.jsx)(Xo,{className:`ml-auto`,children:Ds(`Alt+M`)})]})]})}var Qv=(0,X.memo)(function({manager:e,active:t,now:n,onNavigate:r,state:i,source:a=`sidebar`}){let o=Rs(e),s=ks(e);return(0,Z.jsxs)(U,{to:`/manager/${encodeURIComponent(e.id)}`,state:i,"data-slot":`manager-row`,"data-unread":o?!0:void 0,"data-attention":o??void 0,"aria-current":t?`page`:void 0,onClick:()=>{Dc(a),r?.()},className:H(`flex min-h-16 items-center gap-2.5 rounded-xl px-2 py-1.5 outline-none transition-colors hover:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50`,t&&`bg-muted`),children:[(0,Z.jsx)(go,{avatar:e.avatar,mascot:e.mascot}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,Z.jsxs)(`span`,{className:H(`min-w-0 flex-1 truncate text-ui`,o?`font-semibold text-foreground`:`font-medium`),children:[e.name,o?(0,Z.jsx)(`span`,{"data-slot":`unread-marker`,className:`sr-only`,children:Ls[o]}):null]}),(0,Z.jsx)(`span`,{className:`shrink-0 text-meta text-muted-foreground`,children:Ms(e.lastActivityAt,new Date(n))})]}),(0,Z.jsx)(`span`,{className:`block truncate text-meta text-muted-foreground`,children:zs(e)})]}),o===`needs-you`?(0,Z.jsx)(`span`,{"data-slot":`manager-unread`,"data-attention":o,"aria-hidden":`true`,className:`flex h-5 min-w-5 shrink-0 items-center justify-center rounded-full bg-info px-1.5 text-micro font-semibold text-background`,children:s}):o?(0,Z.jsx)(`span`,{"data-slot":`manager-unread`,"data-attention":o,className:H(`size-2 shrink-0 rounded-full`,Is[o]),"aria-hidden":`true`}):null]})});function $v(){let e=E().data?.capabilities.managers,t=ii(e===!0),n=t.data?.managers;return{ordered:(0,X.useMemo)(()=>ei(n??[]),[n]),loading:t.isPending&&e!==!1,isFetching:t.isFetching,isError:t.isError}}var ey=(0,X.memo)(function({manager:e,active:t}){let n=Rs(e);return(0,Z.jsxs)(U,{to:`/manager/${encodeURIComponent(e.id)}`,"data-slot":`manager-rail-item`,"data-unread":n?!0:void 0,"data-attention":n??void 0,"aria-current":t?`page`:void 0,"aria-label":n?`${e.name}${Ls[n]}`:e.name,title:e.name,onClick:()=>Dc(`sidebar`),className:H(`relative flex size-9 shrink-0 items-center justify-center rounded-md outline-none transition-colors hover:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50`,t&&`bg-muted ring-1 ring-border`),children:[(0,Z.jsx)(go,{avatar:e.avatar,mascot:e.mascot,className:`size-7`}),n?(0,Z.jsx)(`span`,{"data-slot":`manager-unread`,"data-attention":n,className:H(`absolute top-0.5 right-0.5 size-2 rounded-full ring-2 ring-sidebar`,Is[n]),"aria-hidden":`true`}):null]})});function ty(){let{pathname:e}=Kr(),{ordered:t}=$v();return t.length===0?null:(0,Z.jsx)(`nav`,{"aria-label":`Managers`,"data-slot":`manager-rail`,className:`flex min-h-0 flex-col items-center gap-1 overflow-y-auto overscroll-contain pt-2`,children:t.map(t=>(0,Z.jsx)(ey,{manager:t,active:e===`/manager/${encodeURIComponent(t.id)}`},t.id))})}var ny=(0,X.memo)(function({manager:e,active:t,now:n,onNavigate:r}){let i=Rs(e),a=Ml(e.lastActivityAt??e.createdAt,n);return(0,Z.jsxs)(U,{to:`/manager/${encodeURIComponent(e.id)}`,"data-slot":`manager-row`,"data-attention":i??void 0,"aria-current":t?`page`:void 0,onClick:()=>{Dc(`sidebar`),r?.()},className:H(`grid grid-cols-[30px_minmax(0,1fr)_auto] items-center gap-2.5 rounded-md px-2 py-1.5 outline-none transition-colors hover:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50 max-md:min-h-11`,t&&`bg-muted`),children:[(0,Z.jsx)(go,{avatar:e.avatar,mascot:e.mascot,className:`size-[30px]`,sizes:`30px`}),(0,Z.jsxs)(`span`,{className:`min-w-0`,children:[(0,Z.jsxs)(`span`,{className:H(`block truncate text-ui text-foreground`,i?`font-semibold`:`font-medium`),children:[e.name,i?(0,Z.jsx)(`span`,{"data-slot":`unread-marker`,className:`sr-only`,children:Ls[i]}):null]}),(0,Z.jsx)(`span`,{"data-slot":`manager-row-preview`,className:H(`block truncate text-label`,i===`needs-you`?`text-info`:`text-muted-foreground`),children:zs(e)})]}),(0,Z.jsxs)(`span`,{className:`flex flex-col items-end gap-1`,children:[i?(0,Z.jsx)(`span`,{"data-slot":`manager-unread`,"data-attention":i,className:H(`size-1.5 rounded-full`,Is[i]),"aria-hidden":`true`}):null,a?(0,Z.jsx)(`span`,{"data-slot":`manager-row-age`,className:`text-meta text-muted-foreground tabular-nums`,children:a}):null]})]})}),ry=(0,X.lazy)(()=>Dr(()=>import(`./manager-settings-I1AeATjr.js`).then(e=>({default:e.JobsDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42])));function iy({manager:e}){let[t,n]=(0,X.useState)(!1),r=(0,X.useRef)(null),i=Yr(e.id);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{ref:r,type:`button`,"data-slot":`manager-sidebar-jobs`,"aria-haspopup":`dialog`,onClick:()=>n(!0),className:Nh,children:[(0,Z.jsx)(fo,{className:`size-4 shrink-0`,"aria-hidden":`true`}),`Jobs`,e.jobs.length>0?(0,Z.jsx)(`span`,{className:ay,children:e.jobs.length}):null]}),t?(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(ry,{manager:e,open:!0,onOpenChange:e=>{e||n(!1)},onCloseAutoFocus:e=>{e.preventDefault(),r.current?.focus()},onSave:e=>i.mutateAsync({jobs:e})})}):null]})}var ay=`ml-auto rounded-full bg-muted px-1.5 py-px text-micro font-semibold text-muted-foreground tabular-nums`;function oy(){let{pathname:e}=Kr(),t=yh(),{ordered:n,loading:r,isFetching:i,isError:a}=$v(),o=Ql(6e4),s=/^\/manager\/([^/?#]+)$/.exec(e)?.[1],c=s===void 0||s===`new`?void 0:n.find(e=>e.id===decodeURIComponent(s)),l=n.reduce((e,t)=>e+ks(t),0),u=n.find(e=>ks(e)>0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`px-3 pb-2`,children:(0,Z.jsx)(q,{asChild:!0,variant:`primary`,className:`w-full justify-center`,children:(0,Z.jsxs)(U,{to:`/manager/new`,"data-slot":`new-manager`,onClick:t,children:[(0,Z.jsx)(ts,{className:`size-[15px]`,"aria-hidden":`true`}),`New manager`]})})}),(0,Z.jsxs)(`div`,{"data-slot":`manager-sidebar`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pb-2`,children:[(0,Z.jsxs)(`nav`,{"aria-label":`Managers`,className:`flex flex-col gap-0.5 px-2.5`,children:[(0,Z.jsxs)(`h2`,{className:`px-2 pt-1 pb-1 eyebrow text-muted-foreground`,children:[`Managers`,r?``:` · ${n.length}`]}),(0,Z.jsx)(Tg,{queryKey:ni.list,isFetching:i,isError:a,className:`mx-2 mb-1 self-start`}),r?(0,Z.jsx)(cl,{label:`Loading managers…`,"data-slot":`manager-sidebar-loading`,children:(0,Z.jsx)(fl,{rows:3})}):n.map(e=>(0,Z.jsx)(ny,{manager:e,active:e.id===c?.id,now:o,onNavigate:t},e.id))]}),(0,Z.jsxs)(`nav`,{"aria-label":`Workspace`,"data-slot":`manager-sidebar-workspace`,className:`px-2.5`,children:[(0,Z.jsx)(`h2`,{className:`px-3 pt-3 pb-1 eyebrow text-muted-foreground`,children:`Workspace`}),u?(0,Z.jsxs)(U,{to:`/manager/${encodeURIComponent(u.id)}`,"data-slot":`manager-sidebar-approvals`,onClick:()=>{Dc(`sidebar`),t?.()},className:Nh,children:[(0,Z.jsx)(hi,{className:`size-4 shrink-0`,"aria-hidden":`true`}),`Approvals`,(0,Z.jsxs)(`span`,{className:ay,children:[l,(0,Z.jsx)(`span`,{className:`sr-only`,children:` waiting on you`})]})]}):null,c?(0,Z.jsx)(iy,{manager:c},c.id):null,(0,Z.jsxs)(U,{to:`/settings/global/manager`,"data-slot":`manager-sidebar-settings`,onClick:t,className:Nh,children:[(0,Z.jsx)(po,{className:`size-4 shrink-0`,"aria-hidden":`true`}),`Manager settings`]})]})]})]})}function sy({activeId:e}){let{ordered:t,loading:n}=$v(),r=Ql(6e4);return(0,Z.jsxs)(`aside`,{"data-slot":`manager-list-rail`,"aria-label":`Managers`,className:`flex w-60 shrink-0 flex-col border-r border-border bg-card max-md:hidden`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3.5 pt-3.5 pb-2`,children:[(0,Z.jsx)(`h2`,{className:`text-ui font-semibold`,children:`Managers`}),(0,Z.jsx)(q,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`ml-auto`,children:(0,Z.jsx)(U,{to:`/manager/new`,"aria-label":`New manager`,"data-slot":`new-manager`,children:(0,Z.jsx)(ts,{"aria-hidden":`true`})})})]}),(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto overscroll-contain px-1.5 pb-2`,children:n?(0,Z.jsx)(cl,{label:`Loading managers…`,"data-slot":`manager-sidebar-loading`,children:(0,Z.jsx)(fl,{rows:3})}):t.map(t=>(0,Z.jsx)(Qv,{manager:t,active:t.id===e,now:r},t.id))}),t.length>0?(0,Z.jsx)(`p`,{"data-slot":`manager-rail-summary`,className:`border-t border-border px-3.5 py-2.5 text-meta text-muted-foreground`,children:Bs(t)}):null]})}function cy(e){return e?.trim()||null}function ly({projectName:e,pageLabel:t,brandName:n}){let r=cy(e),i=cy(t),a=cy(n??null)??`cezar`;return r&&i?`${r} — ${i} · ${a}`:r?`${r} · ${a}`:i?`${i} · ${a}`:a}function uy(e){let t=ly(e);(0,X.useEffect)(()=>{document.title=t},[t]),(0,X.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])}function dy(e,t,n){if(e===void 0||n===void 0||t===null||t!==e.bootProject||n.bootProject!==t||n.capabilities?.localHandoff!==!0||e.projects.some(e=>e.id===t))return e;let r=n.repoRoot,i=r?.replace(/[\\/]+$/,``).split(/[\\/]/).pop();return i?{...e,projects:[{id:t,root:r,name:i,addedAt:``,lastOpenedAt:``,source:`local`,status:n.repo?`ok`:`not-git`,unregistered:!0,...n.repo?{branch:n.repo.branch}:{}},...e.projects]}:e}var fy={claude:`Anthropic’s coding agent. Uses your Claude account.`,codex:`OpenAI’s coding agent. Uses your ChatGPT account.`,opencode:`Open-source agent. Works with many model providers.`,cursor:`Cursor’s agent, without the editor. Uses your Cursor account.`,copilot:`GitHub’s coding agent. Uses your Copilot plan.`};function py(e,t){let n=new Map((t?.providers??[]).map(e=>[e.provider,e])),r=e.agents.flatMap(e=>{let t=n.get(e.provider);if(t?.status===`connected`||t?.enabled===!1)return[];let r=t===void 0||t.status===`not-installed`?`missing`:`signed-out`;return[{...e,label:Lc[e.provider],description:fy[e.provider],state:r}]});return[...r.filter(e=>e.state===`signed-out`),...r.filter(e=>e.state===`missing`)]}var my=/\u001B\][^\u0007\u001B]*(?:\u0007|\u001B\\)|\u001B\[[0-?]*[ -/]*[@-~]/g,hy=/https?:\/\/[^\s"'<>\u0007\u001B]+/g;function gy(e){let t=e.replace(my,` `).match(hy)??[];for(let e of t.reverse()){let t=_y(e.replace(/[.,;:)\]]+$/,``));if(t&&![`localhost`,`127.0.0.1`,`[::1]`].includes(t.hostname))return t.href}return null}function _y(e){try{return new URL(e)}catch{return null}}var vy=X.lazy(()=>Dr(()=>import(`./terminal-pane-CmmTwiTX.js`).then(e=>({default:e.TerminalPane})),__vite__mapDeps([43,1,2,3,4,5,44,40,41,45,46]))),yy=3e3,by=60,xy=4,Sy=1e4;function Cy(e,t){return py(e,t).some(e=>e.state===`signed-out`)?`Sign in to an agent`:`Pick your agent`}function wy({setup:e,status:t}){let n=p(),r=at(),i=zt(),a=mn(),o=a.mutateAsync,s=a.mutate,c=py(e,t),[l,u]=X.useState(e.session),[d,f]=X.useState(null),m=e.session;X.useEffect(()=>{m&&(u(m),m.exitCode===null&&f(null))},[m]);let h=r.mutate,g=X.useCallback((e,t)=>{f(null),h({provider:e,action:t},{onSuccess:e=>u(e),onError:n=>{f({provider:e,action:t,message:n.message}),s()}})},[s,h]),_=X.useRef(null),v=X.useCallback((e,t)=>{if(_.current===e.id)return;_.current=e.id;let{provider:r,action:i}=e,a=Lc[r];i===`install`&&n(),o().then(e=>{let n=e.providers.find(e=>e.provider===r);if(n?.status===`connected`)return;let o=n!==void 0&&n.status!==`not-installed`;i===`install`&&o?g(r,`login`):f(i===`login`||t?{provider:r,action:i,message:t||`The sign-in to ${a} did not finish.`}:{provider:r,action:i,message:`${a} installed, but cezar cannot find it. Restart cezar from a new terminal, or check that npm’s global folder is on your PATH.`})},()=>f({provider:r,action:i,message:`cezar could not check the agent. Try again.`}))},[g,n,o]),y=m?.exitCode??null;X.useEffect(()=>{if(!(!m||y===null)){if(m.action===`install`&&y!==0){if(_.current===m.id)return;_.current=m.id,n(),f({provider:m.provider,action:m.action,message:`${Lc[m.provider]} did not install. The terminal says why.`});return}v(m,``)}},[y,n,m,v]);let b=X.useRef(null);m&&(b.current=m.id),X.useEffect(()=>{m||!l||l.exitCode!==null||b.current!==l.id||(u(null),v(l,`The terminal closed before it finished.`))},[m,v,l]);let x=l!==null&&l.exitCode===null,S=x&&l?.action===`install`,C=x&&l?.action===`login`;X.useEffect(()=>{if(!C)return;let e=0,t=window.setInterval(()=>{e+=1,(e<=by||e%xy===0)&&s()},yy);return()=>window.clearInterval(t)},[s,C]),X.useEffect(()=>{if(x)return;let e=window.setInterval(()=>s(),Sy);return()=>window.clearInterval(e)},[s,x]);let w=X.useRef(null);w.current=C&&l?l.id:null;let T=X.useRef(!1);X.useEffect(()=>(T.current=!0,()=>{T.current=!1;let e=w.current;window.setTimeout(()=>{!T.current&&e&&Ve(e).catch(()=>{})},0)}),[]);let E=()=>{l&&i.mutate(l.id),u(null)},D=()=>{f(null),x||u(null)};return(0,Z.jsx)(`div`,{className:`mt-7 flex w-full flex-col gap-3 text-left`,children:c.map(e=>{let t=l?.provider===e.provider,n=d?.provider===e.provider?d:null,i=x||r.isPending;return(0,Z.jsxs)(`div`,{"data-slot":`agent-row`,"data-state":e.state,"data-provider":e.provider,className:`rounded-xl border border-border bg-card p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`text-lead text-foreground`,children:e.label}),(0,Z.jsx)(`div`,{className:`text-ui text-muted-foreground`,children:e.state===`missing`?e.description:`Installed, not signed in`})]}),(0,Z.jsx)(Ty,{row:e,open:t,busy:i,onStart:g})]}),!t&&!n&&e.state===`missing`&&e.installCommand===null?(0,Z.jsx)(`p`,{className:`mt-3 text-ui text-soft-foreground`,children:e.installHint}):null,!t&&!n&&e.state===`missing`&&e.installCommand?(0,Z.jsx)(Ey,{command:e.installCommand}):null,t&&l?(0,Z.jsx)(Dy,{session:l,running:x,installing:S},l.id):null,n&&!t?(0,Z.jsx)(Ey,{command:(n.action===`install`?e.installCommand:e.loginCommand)??``}):null,n?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsx)(`p`,{role:`alert`,className:`min-w-0 flex-1 text-ui text-danger`,children:n.message}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(q,{size:`sm`,variant:`outline`,className:`font-normal`,onClick:D,children:`Close`}),(0,Z.jsx)(q,{size:`sm`,className:`font-normal`,disabled:r.isPending,onClick:()=>g(n.provider,n.action),children:`Try again`})]})]}):null,t&&x?(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`p`,{className:`text-ui text-soft-foreground`,children:S?`Sign-in comes next.`:`This page continues by itself.`}),(0,Z.jsx)(q,{size:`sm`,variant:`outline`,className:`font-normal`,onClick:E,children:`Cancel`})]}):null]},e.provider)})})}function Ty({row:e,open:t,busy:n,onStart:r}){return t?null:e.state===`signed-out`?(0,Z.jsx)(q,{className:`font-normal`,disabled:n||e.loginCommand===null,onClick:()=>r(e.provider,`login`),children:`Sign in`}):e.installCommand===null?null:(0,Z.jsx)(q,{className:`font-normal`,disabled:n,onClick:()=>r(e.provider,`install`),children:`Install`})}function Ey({command:e}){return(0,Z.jsxs)(`code`,{className:`mt-3 block truncate font-mono text-meta text-soft-foreground`,title:e,children:[(0,Z.jsx)(`span`,{className:`select-none`,children:`$ `}),e]})}function Dy({session:e,running:t,installing:n}){let[r,i]=X.useState(null),o=e.id,s=X.useRef(``),c=e.action===`login`,l=X.useMemo(()=>({read:async e=>{let t=await Pn(o,e);return c&&t.data&&(s.current=(s.current+t.data).slice(-16384),i(gy(s.current))),t},write:e=>a(o,e),resize:(e,t)=>_(o,e,t)}),[o,c]),u=X.useMemo(()=>({id:o,exitCode:t?null:e.exitCode,topic:t?e.topic:null}),[o,t,e.exitCode,e.topic]),d=Lc[e.provider];return(0,Z.jsxs)(`div`,{"data-slot":`agent-setup-terminal`,className:`mt-3 flex flex-col gap-2`,children:[t?(0,Z.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-ui text-muted-foreground`,children:[(0,Z.jsx)(Mo,{className:`size-3.5 shrink-0 motion-safe:animate-spin`,"aria-hidden":`true`}),n?e.command.startsWith(`sudo `)?`Installing ${d}. Click the terminal and type your computer password if it asks.`:`Installing ${d}…`:`Sign in to ${d}. Click the terminal to answer its questions.`]}):null,(0,Z.jsx)(Ey,{command:e.command}),(0,Z.jsx)(`div`,{className:`relative h-72 overflow-hidden rounded-lg border border-border bg-card-2`,children:(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(vy,{runId:e.runId,session:u,active:!0,io:l})})}),c&&r&&t?(0,Z.jsx)(q,{asChild:!0,size:`sm`,variant:`outline`,className:`self-start font-normal`,children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,children:[`Open sign-in page`,(0,Z.jsx)(xo,{"aria-hidden":`true`})]})}):null]})}function Oy(){let e=V();return X.useCallback(t=>{let n=R.uiState,r=e.getQueryData(n),i={...r?.onboarding,...typeof t==`function`?t(r?.onboarding):t};e.setQueryData(n,{...r,onboarding:i}),$t({onboarding:i}).then(t=>e.setQueryData(n,t)).catch(t=>{e.setQueryData(n,r),Y(t instanceof Error?t.message:String(t),{tone:`danger`})})},[e])}function ky({title:e,slot:t,rail:n,why:r,subtitle:i,banner:a,wide:o=!1,children:s}){return(0,Z.jsxs)(`section`,{"data-onboarding":``,"data-slot":`first-run`,"data-first-run":t,className:H(`mx-auto flex w-full flex-1 flex-col items-center px-1 pt-6 pb-12 text-center md:pt-12`,o?`max-w-3xl`:`max-w-2xl`),children:[a,n,(0,Z.jsx)(`h2`,{className:H(`text-4xl font-light tracking-tight text-balance text-foreground`,n&&`mt-8`),children:e}),r?(0,Z.jsx)(`p`,{className:`mt-3 max-w-md text-lead text-muted-foreground`,children:r}):null,i?(0,Z.jsx)(`p`,{className:`mt-2 text-body text-muted-foreground`,children:i}):null,s]})}var Ay=`inline-flex items-center gap-1.5 text-ui text-muted-foreground transition-colors hover:text-foreground`,jy=`inline-flex h-[30px] items-center gap-1.5 rounded-full border border-border px-3 text-label text-muted-foreground transition-colors hover:border-muted-foreground hover:text-foreground`,My=`inline-flex h-8 items-center gap-2 rounded-full px-3 text-ui text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`;function Ny(){let[e,t]=X.useState(0);return X.useLayoutEffect(()=>{let e=()=>{let e=document.querySelector(`aside[data-slot="sidebar"]`);t(e?Math.max(0,e.getBoundingClientRect().right)/2:0)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function Py({title:e,description:t,onOpenChange:n,onSubmit:r,footer:i,wide:a=!1,children:o}){let s=Ny();return(0,Z.jsx)(ol,{open:!0,onOpenChange:n,children:(0,Z.jsxs)(rl,{"data-onboarding":``,className:H(`gap-0 p-0`,a?`sm:max-w-lg`:`sm:max-w-md`),style:s?{left:`calc(50% + ${s}px)`}:void 0,onKeyDown:e=>{r&&e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),r())},children:[(0,Z.jsxs)(tl,{className:`border-b border-border px-6 py-5 text-left`,children:[(0,Z.jsx)(il,{className:`text-xl font-light tracking-tight`,children:e}),(0,Z.jsx)(al,{children:t})]}),(0,Z.jsx)(`div`,{className:`px-6 py-5 text-left`,children:o}),(0,Z.jsx)(nl,{className:`border-t border-border px-6 py-4`,children:i})]})})}function Fy({title:e,description:t,pages:n,slot:r,onOpenChange:i}){let[a,o]=X.useState(0),s=n[Math.min(a,n.length-1)];if(!s)return null;let c=a>=n.length-1,l=()=>c?i(!1):o(a+1);return(0,Z.jsx)(Py,{wide:!0,title:e,description:t,onOpenChange:i,onSubmit:l,footer:(0,Z.jsxs)(`div`,{className:`flex w-full items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`mr-auto flex items-center gap-1.5`,"aria-label":`${a+1} of ${n.length}`,children:n.map((e,t)=>(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:H(`h-1.5 rounded-full transition-all`,t===a?`w-4 bg-violet`:`w-1.5 bg-border`)},e.id))}),a>0?(0,Z.jsx)(q,{variant:`outline`,className:`font-normal`,onClick:()=>o(a-1),children:`Back`}):null,(0,Z.jsx)(q,{className:`font-normal`,onClick:l,children:c?`Done`:`Next`})]}),children:(0,Z.jsxs)(`div`,{"data-slot":r,"data-page":s.id,onKeyDown:e=>{e.key===`ArrowRight`&&!c&&o(a+1),e.key===`ArrowLeft`&&a>0&&o(a-1)},children:[(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`onboarding-preview flex h-44 items-end justify-center overflow-hidden rounded-lg border border-border px-8 pt-6`,children:s.picture}),(0,Z.jsxs)(`div`,{className:`mt-5 flex min-h-28 flex-col`,children:[(0,Z.jsx)(`h3`,{className:`text-lg font-light tracking-tight text-foreground`,children:s.title}),(0,Z.jsx)(`p`,{className:`mt-1 text-ui text-muted-foreground`,children:s.body}),s.action?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{i(!1),s.action?.onClick()},className:`mt-3 inline-flex items-center gap-1 self-start text-ui text-violet hover:underline`,children:[s.action.label,(0,Z.jsx)(pa,{className:`size-3.5`,"aria-hidden":`true`})]}):null]})]})})}function Iy({title:e,description:t,picture:n,recommended:r=!1,badge:i=`Start here`,onClick:a}){return(0,Z.jsxs)(`button`,{type:`button`,onClick:a,"data-recommended":r||void 0,className:H(`group relative flex flex-col items-center gap-4 rounded-xl border px-4 pt-7 pb-5 text-center transition-colors`,r?`onboarding-announcement`:`border-border bg-card hover:border-muted-foreground`),children:[r?(0,Z.jsx)(`span`,{className:`absolute top-3 right-3 eyebrow text-violet`,children:i}):null,(0,Z.jsx)(`span`,{className:`grid h-16 place-items-center`,"aria-hidden":`true`,children:n}),(0,Z.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-lg font-light text-foreground`,children:e}),(0,Z.jsx)(`span`,{className:`text-label text-muted-foreground`,children:t})]})]})}function Ly({title:e,description:t,picture:n,value:r,selected:i,disabled:a=!1,reason:o,onClick:s}){return(0,Z.jsxs)(`button`,{type:`button`,"data-value":r,"aria-pressed":i,"aria-label":e,disabled:a,title:o,onClick:s,className:H(`flex items-center gap-3 rounded-xl border px-4 py-3 text-left transition-colors disabled:opacity-50`,i?`onboarding-announcement border-violet/60`:`border-border bg-card hover:border-muted-foreground`),children:[(0,Z.jsx)(`span`,{className:`grid size-12 shrink-0 place-items-center`,"aria-hidden":`true`,children:n}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-lead text-foreground`,children:e}),(0,Z.jsx)(`span`,{className:`text-label text-muted-foreground`,children:t})]})]})}function Ry({steps:e}){return(0,Z.jsx)(`ol`,{"data-slot":`step-rail`,className:`flex items-center gap-2 text-label`,children:e.map((e,t)=>(0,Z.jsxs)(`li`,{"data-step":e.id,"data-state":e.state,className:`flex items-center gap-2`,children:[t>0?(0,Z.jsx)(`span`,{className:H(`h-px w-6`,e.state===`next`?`bg-border`:`bg-violet/60`),"aria-hidden":`true`}):null,(0,Z.jsxs)(`span`,{className:H(`inline-flex items-center gap-1.5`,e.state===`current`?`text-foreground`:e.state===`done`?`text-muted-foreground`:`text-soft-foreground`),children:[(0,Z.jsx)(`span`,{className:H(`grid size-5 place-items-center rounded-full border font-mono text-micro`,e.state===`done`&&`border-violet/60 bg-violet/15 text-violet`,e.state===`current`&&`border-violet text-foreground`,e.state===`next`&&`border-border text-soft-foreground`),"aria-hidden":`true`,children:e.state===`done`?(0,Z.jsx)(Wa,{className:`size-3`}):t+1}),e.label,e.state===`current`?(0,Z.jsx)(`span`,{className:`sr-only`,children:`(current step)`}):null]})]},e.id))})}function zy({bar:e,children:t,className:n}){return(0,Z.jsxs)(`div`,{className:H(`w-full max-w-xs rounded-t-lg border border-b-0 border-border bg-background shadow-[0_-12px_40px_-20px_var(--violet)]`,n),children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border px-3 py-2`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),e]}),(0,Z.jsx)(`div`,{className:`p-3`,children:t})]})}var By=`h-2 rounded bg-muted`;function Vy(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 Hy(e){let t=new URLSearchParams;e.skill&&t.set(`skill`,e.skill),e.ref&&t.set(`ref`,e.ref),e.todo&&t.set(`todo`,e.todo);let n=t.toString();return n?`/new?${n}`:`/new`}function Uy(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Wy(e,t=[]){let n=Uy(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Gy(t)),n}function Gy(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function Ky(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function qy(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function Jy(e,t,n){let r=(n??``).trim();if(!r)return Wy(e,t);let i=Uy(e),a=r.startsWith(i)?i+Ky(r.slice(i.length),e):Ky(r,e),o=qy(a,e)?a:`${i}\n\n${a}`;return t.length?o+Gy(t):o}function Yy(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function Xy(e,t,n,r,i={}){return t?{...i,workflow:t,task:Jy(e,n,r)}:n.length?{...i,steps:Yy(n),task:Jy(e,[],r)}:{...i,workflow:`quick-task`,task:Jy(e,[],r)}}function Zy(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function Qy(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function $y(e,t){let n=t===`oldest`?1:-1;return[...e].sort((e,t)=>e.createdAt===t.createdAt?(e.number-t.number)*n:e.createdAt<t.createdAt?-n:n)}function eb(e,t){return e.trim()!==``&&t===0}function tb(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function nb({gitRepo:e}){let t=Mt(),n=Et().data?.onboarding?.agentCheckSkipped===!0;return t.data===void 0&&!n?null:hc(t.data)===!1&&!n?(0,Z.jsx)(Pb,{}):e===void 0?null:e?(0,Z.jsx)(xb,{}):(0,Z.jsx)(Vb,{})}function rb({step:e,...t}){return(0,Z.jsx)(ky,{...t,rail:e?(0,Z.jsx)(ab,{current:e}):void 0})}var ib=[{id:`agent`,label:`Agent`},{id:`project`,label:`Project`},{id:`task`,label:`First task`}];function ab({current:e}){let t=ib.findIndex(t=>t.id===e);return(0,Z.jsx)(`ol`,{"data-slot":`step-rail`,className:`flex items-center gap-2 text-label`,children:ib.map((e,n)=>{let r=n<t?`done`:n===t?`current`:`next`;return(0,Z.jsxs)(`li`,{"data-step":e.id,"data-state":r,className:`flex items-center gap-2`,children:[n>0?(0,Z.jsx)(`span`,{className:H(`h-px w-6`,n<=t?`bg-violet/60`:`bg-border`),"aria-hidden":`true`}):null,(0,Z.jsxs)(`span`,{className:H(`inline-flex items-center gap-1.5`,r===`current`?`text-foreground`:r===`done`?`text-muted-foreground`:`text-soft-foreground`),children:[(0,Z.jsx)(`span`,{className:H(`grid size-5 place-items-center rounded-full border font-mono text-micro`,r===`done`&&`border-violet/60 bg-violet/15 text-violet`,r===`current`&&`border-violet text-foreground`,r===`next`&&`border-border text-soft-foreground`),"aria-hidden":`true`,children:r===`done`?(0,Z.jsx)(Wa,{className:`size-3`}):n+1}),e.label,r===`current`?(0,Z.jsx)(`span`,{className:`sr-only`,children:`(current step)`}):null]})]},e.id)})})}var ob=Ay,sb=jy;function cb({children:e}){return(0,Z.jsx)(`ol`,{className:`flex list-decimal flex-col gap-2.5 pl-5 text-ui text-muted-foreground marker:text-soft-foreground`,children:e})}var lb=`https://cli.github.com`;function ub(e,t){let n=u(t),r=n.start.mutate;return X.useEffect(()=>{e&&r()},[e,r]),n}function db(e){let t=e.state;return e.start.error?fb(e.start.error)?`The GitHub CLI is not installed.`:`Sign-in did not finish.`:t?.status===`pending`?`Enter this code on GitHub. It opened in your browser.`:t?.status===`failed`?`Sign-in did not finish.`:t?.status===`done`?`Signed in.`:`Signing in through your browser.`}function fb(e){return e instanceof sn&&e.status===503}function pb(e,t){let n=navigator.clipboard?.writeText(e);if(!n){Y(t);return}n.then(()=>Y(`Copied`),()=>Y(t))}function mb({children:e}){return(0,Z.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-ui text-muted-foreground`,children:[(0,Z.jsx)(Mo,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),e]})}function hb({signIn:e}){let t=e.state;return e.start.error?fb(e.start.error)?(0,Z.jsxs)(cb,{children:[(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`a`,{href:lb,target:`_blank`,rel:`noopener noreferrer`,className:`text-violet hover:underline`,children:`Install the GitHub CLI`})}),(0,Z.jsx)(`li`,{children:`Come back and press Try again.`})]}):(0,Z.jsx)(`p`,{role:`alert`,className:`text-ui whitespace-pre-line text-danger`,children:e.start.error.message}):t?.status===`failed`?(0,Z.jsx)(`p`,{role:`alert`,className:`text-ui whitespace-pre-line text-danger`,children:t.error}):t?.status===`done`?(0,Z.jsx)(mb,{children:t.login?`Signed in as ${t.login}.`:`Signed in.`}):t?.status===`pending`?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border bg-background py-3 pr-2 pl-5`,children:[(0,Z.jsx)(`span`,{"data-testid":`github-login-code`,"aria-label":`One-time code`,className:`font-mono text-2xl tracking-widest text-foreground select-all`,children:t.code}),(0,Z.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-8 shrink-0`,"aria-label":`Copy code`,onClick:()=>pb(t.code,`Select the code and copy it`),children:(0,Z.jsx)(_o,{"aria-hidden":`true`})})]}),(0,Z.jsx)(mb,{children:`Waiting for GitHub…`})]}):(0,Z.jsx)(mb,{children:`Starting…`})}function gb({signIn:e,onClose:t}){let n=e.state;return e.start.error!==null||n?.status===`failed`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{variant:`outline`,className:`font-normal`,onClick:t,children:`Close`}),(0,Z.jsx)(q,{className:`font-normal`,onClick:()=>e.start.mutate(),disabled:e.start.isPending,children:`Try again`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{variant:`outline`,className:`font-normal`,onClick:()=>{n?.status!==`done`&&e.cancel.mutate(),t()},children:n?.status===`done`?`Close`:`Cancel`}),n?.status===`pending`?(0,Z.jsx)(q,{asChild:!0,className:`font-normal`,children:(0,Z.jsx)(`a`,{href:n.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open GitHub`})}):null]})}function _b({command:e}){return(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-border bg-background px-3 py-2.5`,children:[(0,Z.jsxs)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-ui text-foreground select-all`,children:[(0,Z.jsx)(`span`,{className:`text-soft-foreground select-none`,children:`$ `}),e]}),(0,Z.jsx)(q,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"aria-label":`Copy ${e}`,onClick:()=>pb(e,`Select the command and copy it`),children:(0,Z.jsx)(_o,{"aria-hidden":`true`})})]})}var vb=`flex h-14 w-full items-center gap-3 rounded-xl border border-border bg-card px-5 transition-colors focus-within:border-primary focus-within:shadow-[0_0_0_4px_color-mix(in_srgb,var(--violet)_14%,transparent)]`,yb=[{icon:rd,label:`Fix a failing test`,task:`Find a failing or flaky test and fix it.`},{icon:Ao,label:`Summarize recent commits`,task:`Summarize the recent commits on this branch.`},{icon:wo,label:`Update the README`,task:`Update the README for the recent changes.`}],bb=[{icon:wo,label:`Write a README`,task:`Write a README that explains what this project is for and how to run it.`},{icon:rd,label:`Set up tests`,task:`Set up a test runner with one passing example test.`},{icon:Ao,label:`Add a CI workflow`,task:`Add a CI workflow that installs dependencies and runs the tests on every push.`}];function xb(){let e=Lr(),t=E(),n=_n(),r=t.data?.forge,i=S({limit:3},r?.kind===`github`&&r.available!==!1),a=i.data?.available?i.data.issues.filter(e=>e.kind===`issue`).slice(0,3):[],[o,s]=X.useState(``),c=t=>e(Hy({ref:t.trim()})),l=n.data?.info!==void 0&&n.data.info!==null&&n.data.log.length<=1&&a.length===0&&!i.isFetching,u=l?bb:yb;return(0,Z.jsxs)(rb,{title:`What should we build?`,slot:`welcome`,banner:(0,Z.jsx)(Sb,{}),children:[(0,Z.jsxs)(`form`,{className:H(vb,`mt-7`),onSubmit:e=>{e.preventDefault(),c(o)},children:[(0,Z.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:`Describe a task for the agent…`,"aria-label":`Describe a task for the agent`,className:`h-full min-w-0 flex-1 bg-transparent text-lead text-foreground outline-none placeholder:text-soft-foreground`}),(0,Z.jsx)(q,{type:`submit`,size:`icon`,variant:`ghost`,"aria-label":`Continue to the composer`,className:`size-9 shrink-0`,children:(0,Z.jsx)(pa,{"aria-hidden":`true`})})]}),(0,Z.jsx)(`div`,{className:`mt-3 flex flex-wrap justify-center gap-2`,children:u.map(({icon:e,label:t,task:n})=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>c(n),className:`inline-flex h-8 items-center gap-2 rounded-full px-3 text-ui text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,Z.jsx)(e,{className:`size-3.5`,"aria-hidden":`true`}),t]},t))}),(0,Z.jsx)(Ob,{}),(0,Z.jsx)(kb,{fresh:l,issues:a,colors:i.data?.labelColors??{}})]})}function Sb(){let e=E(),t=Et(),n=Oy(),r=Lr(),i=t.data?.onboarding?.dismissedAnnouncements,a=t.data?Ac({dismissed:i,designMode:e.data?.capabilities.designMode}):null;if(!a)return null;let o=()=>n({dismissedAnnouncements:[...i??[],a.id]});return(0,Z.jsxs)(`div`,{"data-slot":`announcement`,className:`onboarding-announcement relative mb-14 flex w-full items-stretch overflow-hidden rounded-xl border text-left`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col justify-center p-6`,children:[(0,Z.jsx)(`span`,{className:`eyebrow text-violet`,children:`New`}),(0,Z.jsx)(`span`,{className:`mt-1 text-2xl font-light tracking-tight text-foreground`,children:a.title}),(0,Z.jsx)(`p`,{className:`mt-2 max-w-sm text-ui text-muted-foreground`,children:a.description}),(0,Z.jsxs)(q,{size:`sm`,className:`mt-5 self-start font-normal`,onClick:()=>{o(),r(Hy({ref:a.hero.task}))},children:[a.hero.action,(0,Z.jsx)(pa,{"aria-hidden":`true`})]})]}),(0,Z.jsx)(Cb,{}),(0,Z.jsx)(`button`,{type:`button`,onClick:o,"aria-label":`Close ${a.title} announcement`,className:`absolute top-3 right-3 grid size-7 place-items-center rounded-full text-soft-foreground hover:text-foreground`,children:(0,Z.jsx)(us,{className:`size-3.5`,"aria-hidden":`true`})})]})}function Cb(){return(0,Z.jsx)(`div`,{className:`onboarding-picture hidden w-64 shrink-0 items-end justify-center pt-6 pr-6 sm:flex`,"aria-hidden":`true`,children:(0,Z.jsxs)(`div`,{className:`w-full rounded-t-lg border border-b-0 border-border bg-background p-3 shadow-[0_-12px_40px_-20px_var(--violet)]`,children:[(0,Z.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`}),(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/40`})]}),(0,Z.jsx)(`div`,{className:`mt-3 h-2 w-2/3 rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`mt-2 h-2 w-1/2 rounded bg-muted`}),(0,Z.jsxs)(`div`,{className:`relative mt-4 flex items-center gap-2`,children:[(0,Z.jsxs)(`span`,{className:`relative h-6 w-16 rounded-md border border-violet bg-violet/15 outline-2 outline-offset-2 outline-violet/40`,children:[(0,Z.jsx)(`span`,{className:`absolute -top-1 -left-1 size-1.5 rounded-[2px] bg-violet`}),(0,Z.jsx)(`span`,{className:`absolute -top-1 -right-1 size-1.5 rounded-[2px] bg-violet`}),(0,Z.jsx)(`span`,{className:`absolute -bottom-1 -left-1 size-1.5 rounded-[2px] bg-violet`}),(0,Z.jsx)(`span`,{className:`absolute -right-1 -bottom-1 size-1.5 rounded-[2px] bg-violet`})]}),(0,Z.jsx)(`span`,{className:`h-6 w-10 rounded-md bg-muted`}),(0,Z.jsx)(`span`,{className:`absolute top-7 left-6 rounded-md rounded-tl-sm border border-border bg-card px-2 py-1 text-micro whitespace-nowrap text-foreground shadow-md`,children:`Make this button larger`})]}),(0,Z.jsx)(`div`,{className:`mt-9 h-2 w-3/4 rounded bg-muted`})]})})}function wb(){let e=Rn(),t=E(),n=_n(),r=Et(),i=Oy(),a=e.data?.worktreeLifecycle,o=dc({worktreeSetupConfigured:e.data?(a?.afterCreate.length??0)>0:void 0,forge:t.data?.forge}),s=n.data?.info,c=s!=null&&!s.remote&&t.data?.capabilities.singleProject!==!0,l=r.data?.onboarding?.setupDismissed===!0,u=X.useCallback(()=>i({setupDismissed:!0}),[i]);return{steps:o,unpublished:c,folder:s?Gb(s.root):``,dismissed:l||!r.data,dismiss:u}}var Tb={worktrees:Td,github:Nf},Eb=30,Db=6;function Ob(){let e=F(),t=X.useMemo(()=>{let t=new Date;t.setHours(0,0,0,0);let n=Array.from({length:Eb},(e,n)=>{let r=new Date(t);return r.setDate(t.getDate()-(Eb-1-n)),{date:r,count:0}}),r=n[0]?.date.getTime()??0;for(let t of e.data??[]){let e=new Date(t.createdAt);e.setHours(0,0,0,0);let i=n[Math.round((e.getTime()-r)/864e5)];i&&(i.count+=1)}return n},[e.data]),n=t.reduce((e,t)=>e+t.count,0);if(n===0)return null;let r=Math.max(1,...t.map(e=>e.count)),i=e=>e===0?0:Math.max(1,Math.round(e/r*Math.min(r,Db))),a=e=>e.toLocaleDateString(void 0,{month:`short`,day:`numeric`});return(0,Z.jsxs)(`div`,{"data-slot":`activity-strip`,className:`mt-12 w-full`,children:[(0,Z.jsxs)(`div`,{className:`mb-3 flex items-baseline justify-between text-ui`,children:[(0,Z.jsx)(`span`,{className:`text-soft-foreground`,children:`Activity`}),(0,Z.jsxs)(`span`,{className:`text-soft-foreground`,children:[n,` `,n===1?`task`:`tasks`,` in the last `,Eb,` days`]})]}),(0,Z.jsx)(Zc,{delayDuration:100,children:(0,Z.jsx)(`div`,{className:`flex items-end justify-between`,role:`img`,"aria-label":`${n} tasks in the last ${Eb} days`,children:t.map(e=>(0,Z.jsxs)(Qc,{children:[(0,Z.jsx)(Xc,{asChild:!0,children:(0,Z.jsx)(`span`,{className:`flex flex-col-reverse gap-1 py-1`,children:Array.from({length:Math.max(1,i(e.count))},(t,n)=>(0,Z.jsx)(`span`,{className:H(`size-2.5 rounded-[3px]`,e.count>0?`bg-violet`:`bg-muted`)},n))})}),(0,Z.jsx)($c,{children:`${a(e.date)}: ${e.count} ${e.count===1?`task`:`tasks`}`})]},e.date.toISOString()))})}),(0,Z.jsx)(`div`,{className:`mt-2 flex justify-between font-mono text-micro text-soft-foreground`,children:t.filter((e,t)=>t%7==1||t===Eb-1).map(e=>(0,Z.jsx)(`span`,{children:a(e.date)},e.date.toISOString()))})]})}function kb({fresh:e,issues:t,colors:n}){let r=_n(),i=r.data?.info&&!e?r.data.log.slice(0,3):[],a=jb(de(t.length===0&&i.length===0).data??[]);return t.length>0?(0,Z.jsx)(Ab,{label:`Or pick up an issue`,slot:`issues`,children:(0,Z.jsx)(`ul`,{className:`w-full divide-y divide-border rounded-xl border border-border bg-card p-1.5 text-left`,children:t.map(e=>(0,Z.jsx)(`li`,{className:`first:[&>a]:rounded-t-lg last:[&>a]:rounded-b-lg`,children:(0,Z.jsxs)(G,{to:Hy({ref:Uy(e)}),className:`group flex flex-col gap-1.5 px-3 py-2.5 transition-colors hover:bg-muted`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-body text-foreground`,children:e.title}),(0,Z.jsx)(pa,{className:`ml-auto size-3.5 shrink-0 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100`,"aria-hidden":`true`})]}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-meta text-soft-foreground`,children:[(0,Z.jsxs)(`span`,{className:`font-mono`,children:[`#`,e.number]}),(0,Z.jsx)(`span`,{children:e.author}),(0,Z.jsxs)(`span`,{children:[Ml(e.createdAt),` ago`]}),e.comments>0?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Z.jsx)(No,{className:`size-3`,"aria-hidden":`true`}),e.comments]}):null,e.labels.map(e=>(0,Z.jsx)(`span`,{style:tb(n[e]),className:`rounded-full border px-1.5 py-px text-micro`,children:e},e))]})]})},e.number))})}):i.length>0?(0,Z.jsx)(Ab,{label:`Or continue recent work`,slot:`commits`,children:(0,Z.jsx)(`ul`,{className:`w-full divide-y divide-border rounded-xl border border-border bg-card p-1.5 text-left`,children:i.map(e=>(0,Z.jsx)(`li`,{className:`first:[&>a]:rounded-t-lg last:[&>a]:rounded-b-lg`,children:(0,Z.jsxs)(G,{to:Hy({ref:`Continue the work from commit ${e.hash} (${e.subject}).`}),className:`group flex flex-col gap-1 px-3 py-2.5 transition-colors hover:bg-muted`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-body text-foreground`,children:e.subject}),(0,Z.jsx)(pa,{className:`ml-auto size-3.5 shrink-0 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100`,"aria-hidden":`true`})]}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 text-meta text-soft-foreground`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.hash}),(0,Z.jsx)(`span`,{children:e.author}),(0,Z.jsx)(`span`,{children:e.when})]})]})},e.hash))})}):a.length>0?(0,Z.jsx)(Ab,{label:`Or start with a skill`,slot:`skills`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:a.map(e=>(0,Z.jsx)(G,{to:Hy({skill:e.name}),className:sb,title:e.description,children:e.name},e.name))})}):null}function Ab({label:e,slot:t,children:n}){return(0,Z.jsxs)(`div`,{"data-slot":`start-from`,"data-start-from":t,className:`mt-14 flex w-full flex-col items-center gap-3`,children:[(0,Z.jsx)(`div`,{className:`text-ui text-soft-foreground`,children:e}),n]})}function jb(e){let t=e.filter(e=>e.source!==`global`&&e.source!==`builtin`),n=e.filter(e=>e.source===`global`);return[...t,...n].slice(0,4)}function Mb({folder:e,onOpenChange:t}){let{projectId:n}=Rt(),r=Gt(),i=Mn(),a=r.data?.available===!0?r.data.owners:null,[o,s]=X.useState(null),[c,l]=X.useState(()=>Kb(e)),u=o??a?.[0]?.login??``,d=()=>{i.isPending||!u||!c.trim()||i.mutate({projectId:n??`default`,owner:u,name:c.trim()},{onSuccess:({slug:e})=>{t(!1),Y(`Published to ${e}`)}})},f=a!==null,p=ub(!r.isPending&&!f,()=>void r.refetch()),m=p.state?.status===`done`&&!r.isFetching&&r.data?.available===!1?r.data.reason:null;return(0,Z.jsxs)(Py,{title:`Publish to GitHub`,description:f?`A new private repository. You can make it public on GitHub later.`:m?`Signed in, but GitHub listed no accounts.`:db(p),onOpenChange:t,onSubmit:f?d:void 0,footer:m?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{variant:`outline`,className:`font-normal`,onClick:()=>t(!1),children:`Close`}),(0,Z.jsx)(q,{className:`font-normal`,onClick:()=>void r.refetch(),children:`Check again`})]}):f?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{variant:`outline`,className:`font-normal`,onClick:()=>t(!1),children:`Cancel`}),(0,Z.jsx)(q,{className:`font-normal`,onClick:d,disabled:i.isPending||!u||!c.trim(),children:i.isPending?`Publishing…`:`Publish`})]}):(0,Z.jsx)(gb,{signIn:p,onClose:()=>t(!1)}),children:[r.isPending?(0,Z.jsx)(`p`,{className:`text-ui text-soft-foreground`,children:`Checking GitHub…`}):m?(0,Z.jsx)(`p`,{role:`alert`,className:`text-ui text-danger`,children:m}):f?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Owner`,children:a.map(e=>(0,Z.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e.login===u,onClick:()=>s(e.login),className:H(`inline-flex h-8 items-center gap-2 rounded-full border px-3 text-ui transition-colors`,e.login===u?`border-primary text-foreground`:`border-border text-muted-foreground hover:text-foreground`),children:e.login},e.login))}),(0,Z.jsxs)(`label`,{className:`flex items-center gap-1 rounded-lg border border-input bg-background px-3 font-mono text-ui focus-within:border-ring`,children:[(0,Z.jsxs)(`span`,{className:`text-soft-foreground`,children:[u,`/`]}),(0,Z.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),"aria-label":`Repository name`,className:`h-9 min-w-0 flex-1 bg-transparent text-foreground outline-none`})]})]}):(0,Z.jsx)(hb,{signIn:p}),i.error?(0,Z.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs whitespace-pre-line text-danger`,children:i.error.message}):null]})}function Nb(){let{steps:e,unpublished:t,folder:n,dismissed:r,dismiss:i}=wb(),[a,o]=X.useState(!1),s=e[0];if(r||s===void 0&&!t)return null;let c=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s?Tb[s.id]:Nf,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),s?s.label:`Publish to GitHub`,(0,Z.jsx)(pa,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`})]}),l=`inline-flex h-7 items-center gap-1.5 rounded-full bg-muted px-3 text-foreground`;return(0,Z.jsxs)(`div`,{"data-onboarding":``,"data-slot":`setup-pill`,className:`mb-3 inline-flex items-center gap-2 self-start rounded-full border border-border bg-card py-1 pr-1 pl-3 text-ui`,children:[(0,Z.jsx)(`span`,{className:`text-soft-foreground`,children:`Setup`}),s?(0,Z.jsx)(G,{to:s.to,className:l,children:c}):(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>o(!0),"data-setup-step":`publish`,children:c}),(0,Z.jsx)(`button`,{type:`button`,onClick:i,"aria-label":`Hide setup`,className:`grid size-7 place-items-center rounded-full text-soft-foreground hover:text-foreground`,children:(0,Z.jsx)(us,{className:`size-3.5`,"aria-hidden":`true`})}),a?(0,Z.jsx)(Mb,{folder:n,onOpenChange:o}):null]})}function Pb(){let e=Nt();return e.isPending?null:e.data?.available?(0,Z.jsx)(Fb,{setup:e.data}):(0,Z.jsx)(Ib,{})}function Fb({setup:e}){let t=Mt(),n=mn(),r=Oy(),i=py(e,t.data).length===0;return(0,Z.jsxs)(rb,{title:Cy(e,t.data),slot:`sign-in`,step:`agent`,why:`cezar installs the coding agent and signs you in, right here. No API key needed.`,children:[i?(0,Z.jsxs)(`div`,{"data-slot":`agents-off`,className:`mt-7 flex w-full flex-col gap-3 rounded-xl border border-border bg-card p-4 text-left sm:flex-row sm:items-center sm:justify-between`,children:[(0,Z.jsx)(`span`,{className:`text-body text-foreground`,children:`All agents are turned off.`}),(0,Z.jsx)(q,{asChild:!0,size:`sm`,className:`font-normal`,children:(0,Z.jsx)(G,{to:`/settings/agents#providers`,children:`Turn one on`})})]}):(0,Z.jsx)(wy,{setup:e,status:t.data}),(0,Z.jsxs)(`div`,{className:`mt-7 flex flex-wrap justify-center gap-5`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>n.mutate(),disabled:n.isPending,className:ob,children:n.isPending?`Checking…`:`Check again`}),(0,Z.jsx)(G,{to:`/settings/agents`,className:ob,children:`Other agents`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r({agentCheckSkipped:!0}),className:ob,children:`Continue anyway`})]})]})}function Ib(){let e=Mt(),t=mn(),n=qn(),r=Oy(),i=mc(e.data),[a,o]=X.useState(null),[s,c]=X.useState(null),l=t.mutate;X.useEffect(()=>{let e=window.setInterval(()=>l(),Rb);return()=>window.clearInterval(e)},[l]),X.useEffect(()=>{if(!a)return;let e=0,t=window.setInterval(()=>{if(e+=1,e>zb){window.clearInterval(t),o(null);return}l()},Lb);return()=>window.clearInterval(t)},[a,l]);let u=e=>{c(null),n.mutate({provider:e},{onSuccess:t=>{t.opened?o(e):l()},onError:t=>c({provider:e,message:t.message})})};return(0,Z.jsxs)(rb,{title:`Sign in to an agent`,slot:`sign-in`,step:`agent`,why:`cezar runs the coding agent you already use. No API key needed.`,children:[(0,Z.jsxs)(`div`,{className:`mt-7 flex w-full flex-col gap-3 text-left`,children:[i.length===0?(0,Z.jsxs)(`div`,{"data-slot":`agents-off`,className:`flex flex-col gap-3 rounded-xl border border-border bg-card p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Z.jsx)(`span`,{className:`text-body text-foreground`,children:`All agents are turned off.`}),(0,Z.jsx)(q,{asChild:!0,size:`sm`,className:`font-normal`,children:(0,Z.jsx)(G,{to:`/settings/agents#providers`,children:`Turn one on`})})]}):null,i.map(e=>{let t=a===e.provider,r=s?.provider===e.provider?s.message:null;return(0,Z.jsxs)(`div`,{"data-slot":`agent-row`,"data-state":e.state,className:`rounded-xl border border-border bg-card p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`text-lead text-foreground`,children:e.label}),(0,Z.jsx)(`div`,{className:`text-ui text-muted-foreground`,children:t?`Finish in Terminal`:e.state===`missing`?`Not installed`:`Installed, not signed in`})]}),e.state===`signed-out`?t?(0,Z.jsx)(Mo,{className:`size-4 shrink-0 text-violet motion-safe:animate-spin`,"aria-label":`Waiting for sign-in`}):(0,Z.jsx)(q,{className:`font-normal`,onClick:()=>u(e.provider),disabled:n.isPending,children:`Sign in`}):null]}),e.state===`signed-out`&&!t&&!r?(0,Z.jsx)(`p`,{className:`mt-3 text-ui text-soft-foreground`,children:`Opens the login in Terminal.`}):null,t?(0,Z.jsx)(`p`,{className:`mt-3 text-ui text-soft-foreground`,children:`This page continues by itself.`}):null,r?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-col gap-3`,children:[(0,Z.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:r}),(0,Z.jsxs)(cb,{children:[(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:`Open Terminal and paste:`}),(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(_b,{command:e.command})})]}),(0,Z.jsx)(`li`,{children:`Come back. cezar checks by itself.`})]})]}):null,e.state===`missing`?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-col gap-3`,children:[(0,Z.jsxs)(cb,{children:[(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:`Open Terminal and paste:`}),(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(_b,{command:e.command})})]}),(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:`Then sign in:`}),(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(_b,{command:e.login})})]}),(0,Z.jsx)(`li`,{children:`Come back. cezar checks by itself.`})]}),(0,Z.jsxs)(`p`,{className:`text-label text-soft-foreground`,children:[`Needs Node.js.`,` `,(0,Z.jsx)(`a`,{href:`https://nodejs.org`,target:`_blank`,rel:`noopener noreferrer`,className:`text-violet hover:underline`,children:`Get it`})]})]}):null]},e.provider)})]}),(0,Z.jsxs)(`div`,{className:`mt-7 flex flex-wrap justify-center gap-5`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>l(),disabled:t.isPending,className:ob,children:t.isPending?`Checking…`:`Check again`}),(0,Z.jsx)(G,{to:`/settings/agents`,className:ob,children:`Other agents`}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r({agentCheckSkipped:!0}),className:ob,children:`Continue anyway`})]})]})}var Lb=3e3,Rb=1e4,zb=60;function Bb(){let{projectId:e}=Rt(),t=i(),n=E(),r=e??t.data?.bootProject,a=t.data?.projects.find(e=>e.id===r);return a?a.root:e===null||e===n.data?.bootProject?n.data?.repoRoot:void 0}function Vb(){let e=E().data?.capabilities.singleProject===!0,t=Bb(),n=t?Gb(t):`This folder`,[r,i]=X.useState(!1);return(0,Z.jsxs)(rb,{title:`Pick a project`,slot:`pick-project`,step:`project`,why:`Tasks run inside a git repository, each in its own worktree.`,subtitle:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:n}),` isn’t a git repository.`,e?null:(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsx)(`button`,{type:`button`,onClick:()=>i(!0),className:`text-violet hover:underline`,children:`Initialize git here`})]})]}),children:[e?null:(0,Z.jsx)(Hb,{}),r?(0,Z.jsx)(Wb,{folder:n,onOpenChange:i}):null]})}function Hb(){let e=pt(),t=Gt(),n=nn(),r=Mr(),[i,a]=X.useState(``),[o,s]=X.useState(0),[c,l]=X.useState(null),u=(e.data?.repos??[]).filter(e=>e.name.toLowerCase().includes(i.trim().toLowerCase())).slice(0,6),d=t.data!==void 0&&!t.data.available,f=!e.isPending&&(e.data?.repos.length??0)===0,p=e=>{if(e.projectId){r(`/p/${encodeURIComponent(e.projectId)}/`);return}n.mutate(e.path,{onSuccess:({project:e})=>r(`/p/${encodeURIComponent(e.id)}/`),onError:e=>Y(e.message,{tone:`danger`})})},m=e=>{l(e),wl(e)};return(0,Z.jsxs)(Z.Fragment,{children:[f?(0,Z.jsxs)(`div`,{"data-slot":`no-repos`,className:`mt-8 grid w-full gap-3 sm:grid-cols-3`,children:[(0,Z.jsx)(Iy,{title:`New project`,description:`An empty repository here, or a new private one on GitHub.`,recommended:d,onClick:()=>m(`new`),picture:(0,Z.jsx)(`span`,{className:`grid size-12 place-items-center rounded-lg border border-dashed border-muted-foreground/60`,children:(0,Z.jsxs)(`span`,{className:`relative size-4`,children:[(0,Z.jsx)(`span`,{className:`absolute top-1/2 left-0 h-0.5 w-full -translate-y-1/2 rounded bg-muted-foreground`}),(0,Z.jsx)(`span`,{className:`absolute top-0 left-1/2 h-full w-0.5 -translate-x-1/2 rounded bg-muted-foreground`})]})})}),d?(0,Z.jsx)(Iy,{title:`Connect GitHub`,description:`Sign in to the GitHub CLI to clone and publish.`,onClick:()=>l(`connect`),picture:(0,Z.jsx)(Nf,{className:`size-9 text-muted-foreground`,"aria-hidden":!0})}):(0,Z.jsx)(Iy,{title:`Clone from GitHub`,description:`Any repository you can read, by URL or owner/name.`,recommended:!0,onClick:()=>m(`clone`),picture:(0,Z.jsxs)(`span`,{className:`flex w-16 flex-col gap-1.5`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-md border border-violet bg-violet/15 px-1.5 py-1`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`}),(0,Z.jsx)(`span`,{className:`h-1 flex-1 rounded bg-violet/60`})]}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-md border border-border px-1.5 py-1`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/50`}),(0,Z.jsx)(`span`,{className:`h-1 w-3/4 rounded bg-muted`})]}),(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-md border border-border px-1.5 py-1`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground/50`}),(0,Z.jsx)(`span`,{className:`h-1 w-1/2 rounded bg-muted`})]})]})}),(0,Z.jsx)(Iy,{title:`Open a folder`,description:`A repository that already lives on this disk.`,onClick:()=>m(`folder`),picture:(0,Z.jsxs)(`span`,{className:`flex w-16 flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`h-2 w-10 rounded-sm bg-muted-foreground/70`}),(0,Z.jsx)(`span`,{className:`ml-3 h-1.5 w-9 rounded bg-muted`}),(0,Z.jsx)(`span`,{className:`ml-3 h-1.5 w-7 rounded bg-muted`}),(0,Z.jsx)(`span`,{className:`ml-3 h-1.5 w-8 rounded bg-muted`})]})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`mt-7 w-full rounded-xl border border-border bg-card p-1.5 text-left`,children:[(0,Z.jsxs)(`label`,{className:`flex h-11 items-center gap-2 rounded-lg border border-input bg-background px-3 focus-within:border-ring`,children:[(0,Z.jsx)(is,{className:`size-4 text-soft-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`input`,{value:i,onChange:e=>{a(e.target.value),s(0)},onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),s(e=>Math.min(e+1,u.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),s(e=>Math.max(e-1,0));else if(e.key===`Enter`){let e=u[o];e&&p(e)}},placeholder:`Search repositories`,"aria-label":`Search repositories`,className:`min-w-0 flex-1 bg-transparent text-lead text-foreground outline-none placeholder:text-soft-foreground`})]}),(0,Z.jsx)(`ul`,{role:`listbox`,"aria-label":`Repositories`,className:`mt-1`,children:e.isPending?(0,Z.jsx)(`li`,{className:`px-3 py-2.5 text-ui text-soft-foreground`,children:`Looking for repositories…`}):u.length===0?(0,Z.jsx)(`li`,{className:`px-3 py-2.5 text-ui text-soft-foreground`,children:`No repositories found`}):u.map((e,t)=>(0,Z.jsx)(`li`,{role:`option`,"aria-selected":t===o,children:(0,Z.jsxs)(`button`,{type:`button`,onMouseEnter:()=>s(t),onClick:()=>p(e),disabled:n.isPending,className:H(`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left`,t===o&&`bg-muted`),children:[(0,Z.jsx)(`span`,{className:`truncate text-lead text-foreground`,children:e.name}),(0,Z.jsx)(`span`,{className:`ml-auto truncate font-mono text-meta text-soft-foreground`,children:qb(e.path)})]})},e.path))})]}),(0,Z.jsxs)(`div`,{className:`mt-5 flex flex-wrap justify-center gap-6`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:ob,onClick:()=>m(`new`),children:[(0,Z.jsx)(ts,{className:`size-3.5`,"aria-hidden":`true`}),`New project`]}),d?(0,Z.jsxs)(`button`,{type:`button`,className:ob,onClick:()=>l(`connect`),"data-slot":`connect-github`,children:[(0,Z.jsx)(Nf,{className:`size-3.5`,"aria-hidden":!0}),`Connect GitHub`]}):(0,Z.jsxs)(`button`,{type:`button`,className:ob,onClick:()=>m(`clone`),children:[(0,Z.jsx)(Nf,{className:`size-3.5`,"aria-hidden":!0}),`Clone from GitHub`]}),(0,Z.jsxs)(`button`,{type:`button`,className:ob,onClick:()=>m(`folder`),children:[(0,Z.jsx)(Eo,{className:`size-3.5`,"aria-hidden":`true`}),`Browse…`]})]})]}),c===`new`?(0,Z.jsx)(Mf,{label:`New project`,onError:()=>l(null),children:(0,Z.jsx)(Df,{open:!0,onOpenChange:e=>!e&&l(null)})}):null,c===`clone`?(0,Z.jsx)(Mf,{label:`Clone from GitHub`,onError:()=>l(null),children:(0,Z.jsx)(Sf,{open:!0,onOpenChange:e=>!e&&l(null)})}):null,c===`folder`?(0,Z.jsx)(Mf,{label:`Open local folder`,onError:()=>l(null),children:(0,Z.jsx)(bf,{open:!0,onOpenChange:e=>!e&&l(null)})}):null,c===`connect`?(0,Z.jsx)(Ub,{onOpenChange:e=>!e&&l(null)}):null]})}function Ub({onOpenChange:e}){let t=X.useCallback(()=>e(!1),[e]),n=ub(!0,e=>{Y(e?`GitHub connected as ${e}`:`GitHub connected`),t()});return(0,Z.jsx)(Py,{title:`Connect GitHub`,description:db(n),onOpenChange:e,footer:(0,Z.jsx)(gb,{signIn:n,onClose:t}),children:(0,Z.jsx)(hb,{signIn:n})})}function Wb({folder:e,onOpenChange:t}){let{projectId:n}=Rt(),r=Qn(),i=()=>{r.isPending||r.mutate(n??`default`,{onSuccess:()=>{t(!1),Y(`Initialized git in ${e}`)}})};return(0,Z.jsxs)(Py,{title:`Initialize git in ${e}`,description:`Git keeps a history of your files. cezar runs this for you and uploads nothing. node_modules and .env files stay out.`,onOpenChange:t,onSubmit:i,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{variant:`outline`,onClick:()=>t(!1),className:`font-normal`,children:`Cancel`}),(0,Z.jsx)(q,{onClick:i,disabled:r.isPending,className:`font-normal`,children:r.isPending?`Initializing…`:`Initialize`})]}),children:[(0,Z.jsx)(`pre`,{className:`rounded-lg border border-border bg-background px-3 py-2.5 font-mono text-xs leading-relaxed text-foreground`,children:`$ git init -b main
5
5
  $ git add -A
6
6
  $ git commit -m "Initial commit"`}),r.error?(0,Z.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs whitespace-pre-line text-danger`,children:r.error.message}):null]})}function Gb(e){return e.split(/[\\/]/).filter(Boolean).pop()??e}function Kb(e){return e.trim().replace(/\s+/g,`-`).replace(/[^A-Za-z0-9._-]/g,``).slice(0,100)||`project`}function qb(e){let t=e.split(`/`);return t.pop(),t.join(`/`).replace(/^\/Users\/[^/]+|^\/home\/[^/]+/,`~`)}function Jb(e){let t=Et(),n=E(),r=Oy(),i=t.data?.onboarding,a=t.data!==void 0,o=X.useRef(!1);X.useEffect(()=>{if(!a||o.current)return;o.current=!0;let e=Tc(i,Date.now());e&&r(e)},[a,i,r]);let s=n.data?.capabilities.designMode,c=n.data?.capabilities.automations,l=X.useMemo(()=>a?rc(i,{designMode:s,automations:c},Date.now()):new Map,[a,i,s,c]);return X.useEffect(()=>{let t=[...l].filter(([t])=>e===t||e.startsWith(`${t}/`)).map(([,e])=>e);t.length>0&&r({dismissedAnnouncements:[...i?.dismissedAnnouncements??[],...t].slice(-50)})},[e,l,i,r]),X.useMemo(()=>new Set(Yf.filter(e=>[...l.keys()].some(t=>ic(e.to,t))).map(e=>e.to)),[l])}function Yb({runs:e}){let t=Et(),n=E(),r=Oy(),[i]=X.useState(()=>Date.now()),[a,o]=X.useState(!1),s=uc(t.data?.onboarding,i);if(!s)return null;let c=ec(e),l=nc(s,{designMode:n.data?.capabilities.designMode,automations:n.data?.capabilities.automations}),u=new Date(s).toLocaleString(`en`,{month:`long`}),d=c[0],f=lc(c,l.length);return f?(0,Z.jsxs)(`section`,{"data-onboarding":``,"data-slot":`welcome-back`,"aria-label":`Welcome back`,className:`onboarding-announcement relative mb-4 flex flex-col gap-4 rounded-xl border py-5 pr-14 pl-6 sm:flex-row sm:items-center sm:gap-8 sm:pr-20`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 sm:flex-1`,children:[(0,Z.jsx)(`h2`,{className:`text-xl font-light tracking-tight text-foreground`,children:`Welcome back`}),(0,Z.jsx)(`p`,{className:`mt-1 text-body text-muted-foreground`,children:f})]}),(0,Z.jsxs)(`div`,{className:`grid shrink-0 auto-cols-fr grid-flow-col gap-2`,children:[d?(0,Z.jsx)(q,{asChild:!0,size:`sm`,className:`w-full font-normal`,children:(0,Z.jsx)(G,{to:`/tasks/${d.id}`,"data-slot":`welcome-back-waiting`,children:c.length>1?`Open tasks`:d.status===`review`?`Review task`:`Open task`})}):null,l.length>0?(0,Z.jsx)(q,{variant:`outline`,size:`sm`,className:`w-full font-normal`,"data-slot":`welcome-back-news`,onClick:()=>{o(!0),r({whatsNewSeenAt:new Date().toISOString()})},children:`See what’s new`}):null]}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r({welcomeBackClosedAt:new Date().toISOString()}),"aria-label":`Close welcome back`,className:`absolute top-3 right-3 grid size-8 place-items-center rounded-full text-soft-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,Z.jsx)(us,{className:`size-4`,"aria-hidden":`true`})}),a?(0,Z.jsx)(Zb,{items:l,description:`${l.length} ${l.length===1?`change`:`changes`} since ${u}.`,onOpenChange:o}):null]}):null}function Xb({menuItem:e=!1}={}){let t=Et(),n=E(),r=Oy(),[i,a]=X.useState(!1),[o]=X.useState(()=>Date.now()),s={designMode:n.data?.capabilities.designMode,automations:n.data?.capabilities.automations},c=Ec(s,o);if(!t.data||c.length===0)return null;let l=fc(t.data.onboarding,s,o),u=()=>{a(!0),r({whatsNewSeenAt:new Date().toISOString()})},d=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ud,{className:`size-4 shrink-0`,"aria-hidden":`true`}),`What’s new`,l?(0,Z.jsxs)(`span`,{className:`ml-auto flex items-center`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Unread`})]}):null]});return(0,Z.jsxs)(Z.Fragment,{children:[e?(0,Z.jsx)(ro,{"data-slot":`whats-new`,onSelect:e=>{e.preventDefault(),u()},children:d}):(0,Z.jsx)(`button`,{type:`button`,"data-slot":`whats-new`,onClick:u,className:`flex h-8 w-full items-center gap-2.5 rounded-md px-2.5 text-ui text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:d}),i?(0,Z.jsx)(Zb,{items:c,description:`Recent changes in cezar.`,onOpenChange:a}):null]})}function Zb({items:e,description:t,onOpenChange:n}){let r=Lr(),[i,a]=X.useState(0),o=e[Math.min(i,e.length-1)];if(!o)return null;let s=i>=e.length-1,c=()=>s?n(!1):a(i+1),l=o.to?o.action:o.hero?.action;return(0,Z.jsx)(Py,{wide:!0,title:`What’s new`,description:t,onOpenChange:n,onSubmit:c,footer:(0,Z.jsxs)(`div`,{className:`flex w-full items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`mr-auto flex items-center gap-1.5`,"aria-label":`${i+1} of ${e.length}`,children:e.map((e,t)=>(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:H(`h-1.5 rounded-full transition-all`,t===i?`w-4 bg-violet`:`w-1.5 bg-border`)},e.id))}),i>0?(0,Z.jsx)(q,{variant:`outline`,className:`font-normal`,onClick:()=>a(i-1),children:`Back`}):null,(0,Z.jsx)(q,{className:`font-normal`,onClick:c,children:s?`Done`:`Next`})]}),children:(0,Z.jsxs)(`div`,{"data-slot":`whats-new-item`,"data-feature":o.preview,onKeyDown:e=>{e.key===`ArrowRight`&&!s&&a(i+1),e.key===`ArrowLeft`&&i>0&&a(i-1)},children:[(0,Z.jsx)(Qb,{id:o.preview}),(0,Z.jsxs)(`div`,{className:`mt-5 flex min-h-32 flex-col`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-label`,children:[(0,Z.jsx)(`span`,{className:`rounded-full bg-violet/15 px-2 py-0.5 text-violet`,children:`New`}),(0,Z.jsx)(`span`,{className:`text-soft-foreground`,children:new Date(o.releasedAt).toLocaleDateString(`en`,{month:`short`,day:`numeric`})})]}),(0,Z.jsx)(`h3`,{className:`mt-2 text-lg font-light tracking-tight text-foreground`,children:o.title}),(0,Z.jsx)(`p`,{className:`mt-1 text-ui text-muted-foreground`,children:o.description}),l?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{n(!1),o.to?r(o.to):o.hero&&r(Hy({ref:o.hero.task}))},className:`mt-3 inline-flex items-center gap-1 text-ui text-violet hover:underline`,children:[l,(0,Z.jsx)(pa,{className:`size-3.5`,"aria-hidden":`true`})]}):null]})]})})}function Qb({id:e}){return(0,Z.jsxs)(`div`,{"aria-hidden":`true`,className:`onboarding-preview flex h-44 items-end justify-center overflow-hidden rounded-lg border border-border px-8 pt-6`,children:[e===`tabs`?(0,Z.jsx)($b,{}):null,e===`palette`?(0,Z.jsx)(ex,{}):null,e===`design`?(0,Z.jsx)(tx,{}):null,e===`scripts`?(0,Z.jsx)(nx,{}):null,e===`workflow`?(0,Z.jsx)(rx,{}):null,e===`automations`?(0,Z.jsx)(ix,{}):null]})}function $b(){return(0,Z.jsxs)(zy,{bar:(0,Z.jsx)(`span`,{className:`ml-3 flex gap-3 text-micro`,children:[`Chat`,`Changes`,`Preview`,`Terminal`].map(e=>(0,Z.jsx)(`span`,{className:e===`Preview`?`text-foreground underline decoration-violet decoration-2 underline-offset-[9px]`:`text-soft-foreground`,children:e},e))}),children:[(0,Z.jsx)(`div`,{className:H(By,`w-3/4`)}),(0,Z.jsx)(`div`,{className:H(By,`mt-2 w-1/2`)}),(0,Z.jsx)(`div`,{className:`mt-3 h-12 rounded-md border border-border bg-card`})]})}function ex(){return(0,Z.jsxs)(`div`,{className:`w-full max-w-xs self-center rounded-lg border border-border bg-background p-2 shadow-[0_18px_40px_-20px_var(--violet)]`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-1 pb-2 text-meta text-soft-foreground`,children:[(0,Z.jsx)(`span`,{className:`rounded border border-border px-1 font-mono text-micro text-muted-foreground`,children:`⌘P`}),`Jump to a task or run an action`]}),[`Fix the login redirect`,`Open Changes`,`Terminal in a column`].map((e,t)=>(0,Z.jsx)(`div`,{className:H(`mt-1 rounded px-2 py-1.5 text-meta`,t===0?`bg-violet/15 text-foreground`:`text-muted-foreground`),children:e},e))]})}function tx(){return(0,Z.jsxs)(zy,{children:[(0,Z.jsx)(`div`,{className:H(By,`w-2/3`)}),(0,Z.jsxs)(`div`,{className:`relative mt-4 flex items-center gap-2`,children:[(0,Z.jsxs)(`span`,{className:`relative h-6 w-16 rounded-md border border-violet bg-violet/15`,children:[(0,Z.jsx)(`span`,{className:`absolute -top-1 -left-1 size-1.5 rounded-[2px] bg-violet`}),(0,Z.jsx)(`span`,{className:`absolute -top-1 -right-1 size-1.5 rounded-[2px] bg-violet`}),(0,Z.jsx)(`span`,{className:`absolute -bottom-1 -left-1 size-1.5 rounded-[2px] bg-violet`}),(0,Z.jsx)(`span`,{className:`absolute -right-1 -bottom-1 size-1.5 rounded-[2px] bg-violet`})]}),(0,Z.jsx)(`span`,{className:`h-6 w-10 rounded-md bg-muted`}),(0,Z.jsx)(`span`,{className:`absolute top-7 left-6 rounded-md rounded-tl-sm border border-border bg-card px-2 py-1 text-micro whitespace-nowrap text-foreground shadow-md`,children:`Make this button larger`})]}),(0,Z.jsx)(`div`,{className:H(By,`mt-10 w-3/4`)})]})}function nx(){return(0,Z.jsxs)(zy,{bar:(0,Z.jsx)(`span`,{className:`ml-3 text-micro text-soft-foreground`,children:`After worktree creation`}),children:[[`npm install`,`cp .env.example .env`].map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-1 font-mono text-meta`,children:[(0,Z.jsx)(`span`,{className:`text-soft-foreground`,children:`$`}),(0,Z.jsx)(`span`,{className:`flex-1 text-foreground`,children:e}),(0,Z.jsx)(`span`,{className:`text-success`,children:`done`})]},e)),(0,Z.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 font-mono text-meta text-soft-foreground`,children:[(0,Z.jsx)(`span`,{children:`$`}),(0,Z.jsx)(`span`,{className:`h-3 w-1.5 bg-violet`})]})]})}function rx(){return(0,Z.jsx)(`div`,{className:`flex w-full max-w-64 items-center self-center`,children:[`Plan`,`Build`,`Review`].map((e,t)=>(0,Z.jsxs)(X.Fragment,{children:[t>0?(0,Z.jsx)(`span`,{className:`h-px flex-1 bg-muted-foreground/40`}):null,(0,Z.jsx)(`span`,{className:H(`rounded-md border bg-background px-3 py-2 text-meta`,t===1?`border-violet text-foreground shadow-[0_10px_30px_-14px_var(--violet)]`:`border-border text-muted-foreground`),children:e})]},e))})}function ix(){return(0,Z.jsx)(zy,{children:[`Every weekday at 9:00`,`When a pull request is merged`].map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 py-1.5 text-meta text-foreground`,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:e}),(0,Z.jsx)(`span`,{className:`flex h-3.5 w-6 items-center justify-end rounded-full bg-violet px-0.5`,children:(0,Z.jsx)(`span`,{className:`size-2.5 rounded-full bg-violet-foreground`})})]},e))})}function ax(e,t){return et(e,`active`).filter(e=>!t||ln(e)).map(e=>e.id)}function ox(e,t,n){if(e.length===0)return null;let r=t===void 0?-1:e.indexOf(t);return r===-1?n===`next`?e[0]:e[e.length-1]:e.length===1?null:e[(r+(n===`next`?1:-1)+e.length)%e.length]}function sx(e){return!e.altKey||e.metaKey||e.ctrlKey||e.repeat||e.key!==`ArrowUp`&&e.key!==`ArrowDown`?null:{direction:e.key===`ArrowUp`?`previous`:`next`,needsYouOnly:e.shiftKey}}var cx=`cezar:switch-task`;function lx(){let{pathname:e}=Kr(),t=Lr(),n=Nr(),r=i(),a=E(),o=ge(n,r.data?.bootProject??a.data?.bootProject??null),s=X.useRef({pathname:e,runs:o.data,navigate:t});s.current={pathname:e,runs:o.data,navigate:t},X.useEffect(()=>{let e=(e,t)=>{let n=s.current,r=ox(ax(n.runs??[],t),Hh(n.pathname),e);return r===null?!1:(vl(`arrow`),n.navigate(`/tasks/${r}`),!0)},t=t=>{let n=sx(t);!n||t.defaultPrevented||t.target instanceof HTMLElement&&t.target.closest(`.xterm`)||fs()||(t.preventDefault(),e(n.direction,n.needsYouOnly))},n=t=>{let n=t.detail;n!==`previous`&&n!==`next`||fs()||e(n,!0)};return window.addEventListener(`keydown`,t),window.addEventListener(cx,n),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(cx,n)}},[])}function ux(){return lx(),null}var dx=e=>[e,`webhooks`];function fx(e,t){return Xn({queryKey:dx(e),queryFn:({signal:t})=>Pe.list(e,t),enabled:t,retry:!1})}function px(e,t){let n=V();(0,X.useEffect)(()=>{if(!t||!globalThis.EventSource)return;let r=!1,i,a=`${br()}${gr}/p/${encodeURIComponent(e)}/webhooks/events`,o=t=>{r||Sr(t.type,t.data)&&n.invalidateQueries({queryKey:dx(e)})},s=()=>{r||i||(i=new EventSource(a,{withCredentials:!0}),i.addEventListener(`change`,o),i.addEventListener(`resync`,o))},c=()=>{i?.removeEventListener(`change`,o),i?.removeEventListener(`resync`,o),i?.close(),i=void 0},l=t=>{!t.persisted||r||i||(n.invalidateQueries({queryKey:dx(e)}),s())};return window.addEventListener(`pagehide`,c),window.addEventListener(`pageshow`,l),s(),()=>{r=!0,window.removeEventListener(`pagehide`,c),window.removeEventListener(`pageshow`,l),c()}},[n,e,t])}function mx({projectId:e}){let t=E(),n=!t.isError&&t.data?.capabilities?.webhooks===!0,r=fx(e,n);return px(e,n),hx(e,n?r.data:void 0),null}function hx(e,t){let n=(0,X.useRef)(void 0);(0,X.useEffect)(()=>{if(!t){n.current=void 0;return}let r=n.current;if(n.current={projectId:e,data:t},!r||r.projectId!==e)return;let i=new Map(r.data.receivers.map(e=>[e.id,e.state]));for(let e of t.receivers)!i.has(e.id)||i.get(e.id)===e.state||(e.state===`active`||e.state===`disabled`)&&(e.state===`active`?Y(`${e.name} is now active`):Y(`${e.name} was disabled — open it to repair and test`,{tone:`danger`}));let a=t.webhookHealth.saturation?.dropped??0,o=r.data.webhookHealth.saturation?.dropped??0;a>o&&Y(`${a-o===1?`1 webhook delivery was`:`${a-o} webhook deliveries were`} dropped — webhook storage capacity was exceeded`,{tone:`danger`})},[e,t])}function gx(){return(0,Z.jsxs)(`div`,{"data-route":`automations`,className:`flex min-h-full flex-col`,children:[(0,Z.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,Z.jsx)(`h1`,{className:`text-base font-semibold`,children:`Automations`}),(0,Z.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`Scheduled and GitHub-triggered runs.`})]}),(0,Z.jsx)(`p`,{"data-slot":`automations-loading`,className:`px-4 py-6 text-center text-label text-muted-foreground md:px-6`,children:`Loading automations…`})]})}function _x(){return(0,Z.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(eu,{icon:(0,Z.jsx)(Mo,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading variants…`,subtitle:`Fetching every variant's status, spend and diff summary.`})})}function vx(){return(0,Z.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(eu,{icon:(0,Z.jsx)(Mo,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}var yx=[{id:`all`,label:`All`},{id:`impact`,label:`Impact`},{id:`html`,label:`HTML`},{id:`markdown`,label:`Markdown`},{id:`image`,label:`Images`}];function bx(e,t){return t===`all`?[...e]:t===`impact`?e.filter(e=>e.subject!==void 0):e.filter(e=>e.kind===t)}function xx(e,t){return t===`running`||t===`queued`?`running`:e.stale===!0?`stale`:e.stale===!1?`current`:`none`}function Sx(e){return`/tasks/${encodeURIComponent(e.runId)}/assets/${encodeURIComponent(e.name)}`}function Cx(e){return e.kind===`pr`?{to:`/github/prs/${e.number}`,label:`PR #${e.number}`,title:`Pull request #${e.number}`}:{to:`/git/files/${e.path.split(`/`).map(encodeURIComponent).join(`/`)}`,label:`spec ${e.path.split(`/`).pop()??e.path}`,title:e.path}}function wx(){let e=ae(),t=F(),[n,r]=(0,X.useState)(`all`),i=(0,X.useMemo)(()=>new Map((t.data??[]).map(e=>[e.id,e.status])),[t.data]),a=(0,X.useMemo)(()=>bx(e.data?.assets??[],n),[e.data,n]),o=e=>i.get(e.runId)??e.runStatus,s=e.data?.assets.length??0;return(0,Z.jsxs)(`div`,{"data-route":`assets`,className:`flex min-h-full flex-col`,children:[(0,Z.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,Z.jsx)(`h1`,{className:`text-base font-semibold`,children:`Assets`}),(0,Z.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`Every page and report your agents wrote, newest first.`})]}),(0,Z.jsx)(`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:e.isPending?(0,Z.jsx)(`p`,{"data-slot":`assets-loading`,className:`py-6 text-center text-label text-muted-foreground`,children:`Loading assets…`}):e.isError?(0,Z.jsx)(eu,{icon:(0,Z.jsx)(ls,{}),tone:`danger`,heading:`h2`,title:`Could not load assets`,subtitle:e.error instanceof Error?e.error.message:String(e.error),actions:(0,Z.jsx)(q,{type:`button`,variant:`outline`,"data-action":`assets-retry`,onClick:()=>void e.refetch(),children:`Try again`})}):s===0?(0,Z.jsx)(eu,{icon:(0,Z.jsx)(ja,{}),title:`No assets yet`,subtitle:`When an agent writes a page or report into its artifacts folder, it shows up here and in its task's Assets tab.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_i,{slot:`assets-filter`,label:`Filter assets`,value:n,options:yx.map(({id:e,label:t})=>({value:e,label:t})),onChange:r}),a.length===0?(0,Z.jsxs)(`p`,{"data-slot":`assets-filter-empty`,className:`py-6 text-center text-label text-muted-foreground`,children:[`No `,yx.find(e=>e.id===n)?.label.toLowerCase(),` assets.`]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`hidden overflow-x-auto rounded-lg border border-border md:block`,children:(0,Z.jsxs)(`table`,{"data-slot":`assets-table`,className:`w-full border-collapse text-ui`,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsxs)(`tr`,{className:`border-b border-border text-left`,children:[(0,Z.jsx)(`th`,{scope:`col`,className:`px-3 py-2 eyebrow text-soft-foreground`,children:`Asset`}),(0,Z.jsx)(`th`,{scope:`col`,className:`px-3 py-2 eyebrow text-soft-foreground`,children:`Subject`}),(0,Z.jsx)(`th`,{scope:`col`,className:`px-3 py-2 eyebrow text-soft-foreground`,children:`State`}),(0,Z.jsx)(`th`,{scope:`col`,className:`px-3 py-2 eyebrow text-soft-foreground`,children:`Version`}),(0,Z.jsx)(`th`,{scope:`col`,className:`px-3 py-2 eyebrow text-soft-foreground`,children:`Updated`})]})}),(0,Z.jsx)(`tbody`,{children:a.map(e=>(0,Z.jsxs)(`tr`,{"data-slot":`asset-row`,className:`border-b border-border last:border-b-0 hover:bg-muted/50`,children:[(0,Z.jsx)(`td`,{className:`max-w-0 px-3 py-2`,children:(0,Z.jsx)(Tx,{row:e})}),(0,Z.jsx)(`td`,{className:`px-3 py-2`,children:(0,Z.jsx)(Ex,{row:e})}),(0,Z.jsx)(`td`,{className:`px-3 py-2`,children:(0,Z.jsx)(Ox,{state:xx(e,o(e))})}),(0,Z.jsxs)(`td`,{className:`px-3 py-2 text-label tabular-nums`,children:[`v`,e.versionCount]}),(0,Z.jsx)(`td`,{className:`px-3 py-2 whitespace-nowrap text-label text-muted-foreground`,children:(0,Z.jsx)(kx,{iso:e.updatedAt})})]},`${e.runId}/${e.name}`))})]})}),(0,Z.jsx)(`ul`,{"data-slot":`assets-cards`,className:`flex flex-col gap-2 md:hidden`,children:a.map(e=>(0,Z.jsxs)(`li`,{"data-slot":`asset-card`,className:`flex flex-col gap-1.5 rounded-lg border border-border bg-card p-3 text-ui`,children:[(0,Z.jsx)(Tx,{row:e}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-label text-muted-foreground`,children:[(0,Z.jsx)(Ex,{row:e}),(0,Z.jsx)(Ox,{state:xx(e,o(e))}),(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[`v`,e.versionCount]}),(0,Z.jsx)(kx,{iso:e.updatedAt})]})]},`${e.runId}/${e.name}`))})]}),e.data?.truncated?(0,Z.jsxs)(`p`,{"data-slot":`assets-truncated`,className:`text-label text-muted-foreground`,children:[`Showing the newest `,s,` assets.`]}):null]})})]})}function Tx({row:e}){let t=Sx(e);return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(G,{"data-slot":`asset-link`,to:t,className:`truncate font-semibold text-foreground hover:underline focus-visible:underline focus-visible:outline-none`,children:e.title??e.name}),(0,Z.jsxs)(`span`,{className:`truncate text-label text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`font-mono`,children:e.name}),` · `,(0,Z.jsx)(G,{"data-slot":`asset-task-link`,to:t,className:`hover:text-foreground hover:underline`,children:e.runTitle})]})]})}function Ex({row:e}){if(!e.subject)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let t=Cx(e.subject);return(0,Z.jsx)(el,{label:t.title,children:(0,Z.jsx)(G,{"data-slot":`asset-subject`,to:t.to,className:`whitespace-nowrap text-foreground hover:underline`,children:t.label})})}var Dx={running:{label:`running`,dot:`violet`,pulse:!0},stale:{label:`stale`,dot:`pending`,pulse:!1},current:{label:`current`,dot:`success`,pulse:!1},none:{label:`—`,dot:null,pulse:!1}};function Ox({state:e}){let{label:t,dot:n,pulse:r}=Dx[e],i=(0,Z.jsxs)(`span`,{"data-slot":`asset-state`,"data-state":e,className:H(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border px-2 text-label font-medium whitespace-nowrap`,n?`text-foreground`:`text-muted-foreground`),children:[n?(0,Z.jsx)(Pl,{tone:n,pulse:r}):null,t]});return e===`none`?(0,Z.jsx)(el,{label:`No subject, or its state cannot be told`,children:i}):i}function kx({iso:e}){let t=Ml(e);return(0,Z.jsx)(el,{label:new Date(e).toLocaleString(),children:(0,Z.jsx)(`time`,{dateTime:e,children:t?`${t} ago`:``})})}var Ax={workflow:null,skills:[],runner:null,model:null},jx=`cez-followup-selection`,Mx=bu.map(e=>e.id);function Nx(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:Mx.includes(t.runner)?t.runner:null,model:typeof t.model==`string`?t.model:null}}function Px(){try{let e=localStorage.getItem(jx);return e?Nx(JSON.parse(e)):{...Ax}}catch{return{...Ax}}}function Fx(e){try{localStorage.setItem(jx,JSON.stringify({...Px(),...e}))}catch{}}var Ix=`cez-followup-prompt:`;function Lx(e){try{return localStorage.getItem(Ix+e)??``}catch{return``}}function Rx(e,t){try{t===``?localStorage.removeItem(Ix+e):localStorage.setItem(Ix+e,t)}catch{}}function zx(e){let t=Mt(),n=Rn(),r=gn(t.data),i=n.data?.defaultRunner,a=mu(e.runner,r,i??r[0]??`claude`),o=A(a),s=n.data?.modelsLocked===!0,c=uu(s?null:e.model,a,n.data?.defaultModels,o.data),l=lu(a,c,o.data),{accounts:u,repoAccount:d}=su(),f=u.some(t=>t.provider===a&&t.id===e.account)?e.account:null;return{runner:a,runnerExplicit:e.runner!==null,model:c,reasoningEffort:_u(e.reasoningEffort??null,a,c,o.data),reasoningEfforts:l,runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:s,providerPending:t.isPending,providerError:t.isError,accounts:u,account:f,repoAccount:d}}function Bx(e){let[t,n]=(0,X.useState)(Vx);return(0,X.useEffect)(()=>{e&&Fx({runner:t.runner,model:t.model})},[e,t.runner,t.model]),Wx(t,n),[t,n]}function Vx(){let e=Px();return{runner:e.runner,model:e.model,account:null}}function Hx(){return Bx(!0)}function Ux(){return Bx(!1)}function Wx(e,t){let n=Mt(),r=Rn(),i=gn(n.data),a=mu(e.runner,i,r.data?.defaultRunner??i[0]??`claude`),o=n.isSuccess&&i.length>0,s=o&&e.runner!==null&&!i.includes(e.runner),c=o&&e.model!==null&&yu(e.model,a);(0,X.useEffect)(()=>{!s&&!c||t({...e,runner:s?null:e.runner,model:c?null:e.model})},[s,c,e,t])}function Gx(e){return{runner:du(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,reasoningEffort:e.modelsLocked?void 0:e.reasoningEffort||void 0}}function Kx(e){return{...Gx(e),...e.account?{agentProfile:e.account}:{}}}function qx({pick:e,onChange:t,disabled:n=!1,accounts:r=!1}){let i=zx(e),{runner:a,model:o,reasoningEffort:s,reasoningEfforts:c,runners:l,canRun:u,modelsLocked:d}=i,f=Rn(),p=A(a),m=cu(a,p.data,[e.model,f.data?.defaultModels?.[a]]),h=n||!u,g=r?i.accounts:[];return(0,Z.jsxs)(Z.Fragment,{children:[l.length>1||l.some(e=>Cu(g,e))?(0,Z.jsx)(Du,{runners:l,value:a,accounts:g,account:r?i.account:null,repoAccount:r?i.repoAccount:void 0,disabled:h,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===a?e.model:null,reasoningEffort:n===a?e.reasoningEffort??null:null}:{runner:n,account:null,model:null,reasoningEffort:null})}):null,(0,Z.jsx)(ku,{slot:`model-pill`,ariaLabel:`Model`,label:m.find(e=>e.id===o).label,value:o,disabled:h,readOnly:d===!0,disabledHint:d?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,model:n,reasoningEffort:null}),options:m.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:gu(a,p.data,p.isError)}),(0,Z.jsx)(ju,{runner:a,model:o,value:s,options:c,disabled:h,modelsLocked:d,onPick:n=>t({...e,reasoningEffort:n||null})})]})}function Jx({templates:e,onInsert:t,triggerClassName:n,disabled:r,iconOnly:i=!1}){let[a,o]=(0,X.useState)(!1),s=(0,X.useRef)(null),c=Lr();return e.length===0?null:(0,Z.jsxs)(Ts,{open:a,onOpenChange:o,children:[(0,Z.jsx)(el,{label:`Insert a prompt template`,children:(0,Z.jsx)(vs,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,disabled:r,className:H(nu,i?`w-7 justify-center px-0`:`px-2.5`,n),children:[(0,Z.jsx)(Cd,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),i?null:(0,Z.jsxs)(Z.Fragment,{children:[`templates`,(0,Z.jsx)(qa,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})]})})}),(0,Z.jsx)(Cs,{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,Z.jsxs)(ql,{filter:Vo,children:[(0,Z.jsx)(zl,{placeholder:`search templates…`,onInput:()=>s.current?.scrollTo(0,0)}),(0,Z.jsxs)(Kl,{ref:s,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Z.jsx)(Gl,{children:`Nothing matches.`}),(0,Z.jsx)(Vl,{heading:`Insert a template`,children:e.map(e=>(0,Z.jsxs)(Wl,{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,Z.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-label font-medium text-foreground`,children:e.label}),e.skills&&e.skills.length>0?(0,Z.jsxs)(`span`,{"data-slot":`prompt-template-assigned`,"aria-label":`Applied automatically with: ${e.skills.join(`, `)}`,className:`inline-flex shrink-0 items-center gap-0.5 text-micro font-medium text-violet`,children:[(0,Z.jsx)(La,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,Z.jsx)(`span`,{className:`line-clamp-1 text-meta text-soft-foreground`,children:e.text})]},e.id))}),(0,Z.jsx)(Bl,{}),(0,Z.jsx)(Vl,{children:(0,Z.jsx)(Wl,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-label text-muted-foreground`,onSelect:()=>{o(!1),c(`/settings/instructions#prompt-templates`)},children:`Edit templates…`})})]})]})})]})}var Yx=s({status:`waiting`});function Xx(e){return e.filter(e=>!e.startedTaskId)}function Zx(e){return e.runnable??!!(e.suggestedSkill||e.suggestedPrompt)}function Qx(){let e=E(),t=e.data?.capabilities.followups===!0,n=e.data!==void 0&&!t,r=Fe(!n),i=F(),a=r.data===void 0?void 0:Xx(r.data);return(0,Z.jsxs)(`div`,{"data-route":`inbox`,className:`flex min-h-full flex-col`,children:[(0,Z.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,Z.jsx)(`h1`,{className:`text-base font-semibold`,children:`Inbox`}),(0,Z.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:n?`Disabled for this server; per-task Notes still run.`:`Follow-ups agents suggested when they finished a task.`})]}),(0,Z.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,Z.jsx)(eu,{icon:(0,Z.jsx)(fd,{}),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,Z.jsx)(eu,{icon:(0,Z.jsx)(ls,{}),tone:`danger`,title:`Could not load the inbox`,subtitle:r.error.message,heading:`h2`}):null:a.length===0?e.isPending?null:(0,Z.jsx)(eu,{icon:(0,Z.jsx)(fd,{}),tone:`neutral`,title:`Inbox empty`,subtitle:`Agents drop follow-up suggestions here when they finish a task.`,heading:`h2`}):(0,Z.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,Z.jsx)($x,{todo:e,sourceTaskExists:e.taskId===void 0?null:i.data?.some(t=>t.id===e.taskId)??!1},e.id))})})]})}function $x({todo:e,sourceTaskExists:t}){let n=Lr(),r=V(),i=Ht(),[a,o]=Ux(),s=zx(a),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(``),f=(0,X.useRef)(null),p=E(),m=Io(Ro(i.data?.promptTemplates),p.data?.capabilities),h=e=>{let t=f.current?.selectionStart??u.length,n=Ko(u,t,e);d(n.text),requestAnimationFrame(()=>{f.current?.focus(),f.current?.setSelectionRange(n.caret,n.caret)})},g=B({mutationFn:async()=>s.canRun?$e(e.id,{...Gx(s),prompt:u.trim()||void 0}):null,onSuccess:e=>{if(e===null)return;Tl(`inbox`);let{run:t}=e;r.invalidateQueries({queryKey:z.todos}),r.invalidateQueries({queryKey:z.runs.all}),n(`/tasks/${t.id}`)},onError:e=>Y(e.message,{tone:`danger`})}),_=B({mutationFn:()=>Jn(e.id),onSuccess:()=>{r.setQueryData(z.todos,t=>t?.filter(t=>t.id!==e.id)),r.invalidateQueries({queryKey:z.todos})},onError:e=>Y(e.message,{tone:`danger`})}),v=g.isPending||_.isPending,y=Zx(e);return(0,Z.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,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Z.jsx)(Pl,{tone:Yx.tone,pulse:Yx.pulse,"aria-label":Yx.label,className:`mt-[5px]`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`p`,{"data-slot":`todo-summary`,className:`text-sm leading-snug font-medium text-foreground`,children:e.summary}),(0,Z.jsxs)(`div`,{"data-slot":`todo-meta`,className:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-label text-muted-foreground`,children:[e.ts?(0,Z.jsxs)(`span`,{children:[Ml(e.ts),` ago`]}):null,e.action?(0,Z.jsx)(`span`,{children:e.action}):null,e.taskId===void 0?null:t?(0,Z.jsx)(G,{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,Z.jsx)(`span`,{"data-slot":`todo-source-gone`,children:`source task deleted`}),yr(e.prUrl)?(0,Z.jsxs)(`a`,{href:e.prUrl,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`todo-pr`,className:nu,children:[`PR`,(0,Z.jsx)(Ea,{"aria-hidden":`true`,className:`size-2.5`})]}):null,e.suggestedSkill?(0,Z.jsxs)(`span`,{"data-slot":`todo-skill`,children:[`skill: `,(0,Z.jsx)(`span`,{className:`font-mono text-ui`,children:e.suggestedSkill})]}):null]})]}),(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5 self-center`,children:y?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(q,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-run`,disabled:v||!s.canRun,onClick:()=>g.mutate(),children:[(0,Z.jsx)(es,{"aria-hidden":`true`,className:`size-3`}),`Run`]}),(0,Z.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`todo-dismiss`,disabled:v,onClick:()=>_.mutate(),children:`Dismiss`})]}):(0,Z.jsxs)(q,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-acknowledge`,disabled:v,onClick:()=>_.mutate(),children:[(0,Z.jsx)(Wa,{"aria-hidden":`true`,className:`size-3`}),`Acknowledge`]})})]}),y?(0,Z.jsxs)(`div`,{"data-slot":`todo-engine`,className:`flex flex-wrap items-center gap-2 pl-5`,children:[(0,Z.jsx)(qx,{pick:a,onChange:o,disabled:v||!s.canRun}),!s.providerPending&&!s.canRun?(0,Z.jsxs)(`span`,{"data-slot":`todo-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-label text-muted-foreground`,children:[s.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this follow-up.`,(0,Z.jsx)(G,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}):null,y?c?(0,Z.jsxs)(`div`,{"data-slot":`todo-instructions`,className:`flex flex-col gap-2 pl-5`,children:[(0,Z.jsx)(cs,{ref:f,"data-slot":`todo-instructions-input`,"aria-label":`Extra instructions for this follow-up`,value:u,onChange:e=>d(e.target.value),placeholder:`Add instructions for the agent… (appended to the suggestion above)`,maxLength:2e4,className:`min-h-16 text-ui`}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Jx,{templates:m,onInsert:h}),(0,Z.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-hide`,onClick:()=>l(!1),className:`text-label font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`Hide`})]})]}):(0,Z.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-toggle`,onClick:()=>l(!0),className:`self-start pl-5 text-label font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:u.trim()?`Edit instructions (added)`:`+ Add instructions`}):null]})}function eS(){return(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`w-60 shrink-0 border-r border-border bg-card px-1.5 pt-12 max-md:hidden`,children:(0,Z.jsx)(fl,{rows:3})}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border bg-card px-3 py-2.5 max-md:box-content max-md:h-13 max-md:py-0 max-md:pt-[env(safe-area-inset-top)] md:px-5`,children:[(0,Z.jsx)(ll,{className:`size-11 shrink-0 rounded-full md:hidden`}),(0,Z.jsx)(ll,{className:`size-10 shrink-0 rounded-full md:size-11`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(ll,{className:`h-5 w-40 md:h-4`}),(0,Z.jsx)(ll,{className:`h-3 w-64 max-md:hidden`})]})]}),(0,Z.jsx)(ml,{className:`mx-auto w-full max-w-[860px] px-4 py-6 md:px-6`})]})]})}function tS(){(0,X.useLayoutEffect)(()=>{let e=document.querySelector(`[data-slot="mobile-top-bar"]`);if(e)return e.hidden=!0,()=>{e.hidden=!1}},[])}function nS(){return tS(),(0,Z.jsx)(cl,{label:`Loading conversation…`,delayMs:0,className:`flex h-full min-h-0 flex-col`,children:(0,Z.jsx)(eS,{})})}function rS(){return(0,Z.jsxs)(cl,{label:`Loading managers…`,className:`flex h-full min-h-0 flex-col`,children:[(0,Z.jsx)(fl,{rows:4,className:`p-2 md:hidden`}),(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col max-md:hidden`,children:(0,Z.jsx)(eS,{})})]})}var iS=e=>String(e).padStart(2,`0`);function aS(e){return JSON.stringify({...e,task:``})}function oS(e,t){let n=t=>new Intl.DateTimeFormat(`en-CA`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).formatToParts(e),r;try{r=n(t)}catch{r=n()}let i=e=>r.find(t=>t.type===e)?.value??``;return{date:`${i(`year`)}-${i(`month`)}-${i(`day`)}`,hour:Number(i(`hour`)),minute:Number(i(`minute`))}}function sS(e,t,n,r){let i=Math.round((Date.parse(`${e}T00:00:00Z`)-Date.parse(`${r}T00:00:00Z`))/864e5),a=`${iS(t)}:${iS(n)}`;return i===0?`Today, ${a}`:i===1?`Tomorrow, ${a}`:`${new Date(`${e}T00:00:00Z`).toLocaleDateString(`en-GB`,{weekday:`short`,day:`numeric`,month:`short`,...e.slice(0,4)===r.slice(0,4)?{}:{year:`numeric`},timeZone:`UTC`}).replace(`,`,``)}, ${a}`}function cS(e,t,n,r=Date.now()){if(!e)return`Now`;let i=oS(r,t?.timeZone??n).date,a=t&&oS(Date.parse(t.notBefore),t.timeZone),o=a&&sS(a.date,a.hour,a.minute,i);return e.start.kind===`usage-reset`?o?`After reset · ${o}`:`After reset`:o||(dS(e.start.date)?fS(e.start)?sS(e.start.date,e.start.hour,e.start.minute,i):`Pick a time`:`Pick a date`)}function lS(e,t,n){if(!e)return`Schedule start`;if(!t)return cS(e,t,n);let r=new Date(t.notBefore).toLocaleString(`en-GB`,{dateStyle:`full`,timeStyle:`short`,timeZone:t.timeZone});return`${e.start.kind===`usage-reset`?`After the usage limit resets: `:`Starts `}${r} (${t.timeZone})`}function uS(e,t=Date.now()){let{date:n,hour:r}=oS(t+2*36e5,e);return{kind:`at`,date:n,hour:r,minute:0}}function dS(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=new Date(`${e}T00:00:00Z`);return Number.isFinite(t.getTime())&&t.toISOString().slice(0,10)===e}function fS(e){return Number.isInteger(e.hour)&&e.hour>=0&&e.hour<24&&Number.isInteger(e.minute)&&e.minute>=0&&e.minute<60}function pS(e){return dS(e.date)?fS(e)?Date.parse(`${e.date}T${iS(e.hour)}:${iS(e.minute)}:00Z`)+12*36e5<=Date.now()?{date:`Choose a future date and time.`}:{}:{time:`Enter a complete time.`}:{date:e.date?`Enter a complete, valid date.`:`Pick a date to schedule this task.`}}function mS({task:e,value:t,onChange:n,disabledReason:r,onBlockedChange:i,onLabelChange:a,open:s,onOpenChange:c}){let[l,u]=(0,X.useState)(!1),d=s??l,f=e=>{u(e),c?.(e)},p=(0,X.useRef)(d);(0,X.useEffect)(()=>{d&&!p.current&&Al(),p.current=d},[d]);let m=(e,t)=>{jl(e),n(t)},[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(``),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)(),[T,E]=(0,X.useState)(``),[D,O]=(0,X.useState)(0),[k,A]=(0,X.useState)(!1),j=t?.start.kind===`at`?pS(t.start):{},M=j.date??j.time,N=(0,X.useRef)(0),P=(0,X.useRef)(void 0),ee=(0,X.useRef)(null);t?.start.kind===`at`&&(ee.current=t.start);let te=(0,X.useId)(),ne=(0,X.useId)(),re=(0,X.useId)(),ie=aS(e),F=!!e.task.trim(),ae=JSON.stringify({...e,task:`Check scheduling options`}),oe=C?.key===ae?C.data:void 0,se=(0,X.useRef)(null);(0,X.useEffect)(()=>{let e=oe?.timeZone;if(!e||t?.start.kind!==`at`||!se.current)return;let r=JSON.stringify(t.start)===JSON.stringify(se.current),i=uS(e);se.current=null,r&&JSON.stringify(i)!==JSON.stringify(t.start)&&n({start:i})},[oe?.timeZone,t?.start.kind]);let ce=r??(T||(oe?oe.usageReset.available?void 0:oe.usageReset.message:`Checking scheduling options…`)),le=t?.start.kind===`usage-reset`;(0,X.useEffect)(()=>{if(!d&&!le)return;let e=!1;return E(``),cn({task:JSON.parse(ae)}).then(t=>{e||w({key:ae,data:t})}).catch(()=>{e||E(`Could not load scheduling options. Try again.`)}),()=>{e=!0}},[d,ae,D,le]);let I=JSON.stringify(t?.start);(0,X.useLayoutEffect)(()=>(N.current++,g(!1),v(t?.invalidated??``),b(!!t?.invalidated),A(!1),t?.preview&&(t.settingsKey!==ie||r)&&n({start:t.start}),()=>{N.current++}),[ie,I,r,t?.invalidated]),(0,X.useLayoutEffect)(()=>{t?.start.kind!==`usage-reset`||!ce||(N.current++,g(!1),t.preview&&n({start:t.start}))},[ce,t?.start.kind]);let ue=async()=>{if(clearTimeout(P.current),!t||r||t.start.kind===`usage-reset`&&ce||M||!e.task.trim())return;let i=++N.current;n({start:t.start,invalidated:t.invalidated}),g(!0),v(``),b(!1),A(!1);try{let r=await o({task:e,start:t.start});if(i!==N.current)return;r.available?n({start:t.start,preview:r,settingsKey:ie}):(v(r.message),A(r.reason===`window-over`),b(r.reason===`account-unverifiable`))}catch(e){i===N.current&&(v(t.start.kind===`at`?`Could not check the start time. Try again.`:e instanceof Error?e.message:String(e)),b(!0))}finally{i===N.current&&g(!1)}};(0,X.useEffect)(()=>{if(!(!t||r||!e.task.trim()||M)&&!(t.start.kind===`usage-reset`&&ce)&&!(t.preview&&t.settingsKey===ie))return P.current=setTimeout(()=>void ue(),600),()=>clearTimeout(P.current)},[ie,F,I,r,t?.start.kind===`usage-reset`&&ce]),(0,X.useEffect)(()=>{if(!t?.preview)return;let e,r=()=>{let i=Date.parse(t.preview.notBefore)-Date.now();i>0?e=setTimeout(r,Math.min(i,2147483647)):n({start:t.start,invalidated:`The previewed start time has passed. Check the start time again.`})};return r(),()=>clearTimeout(e)},[t?.preview]);let L=!(t?.start.kind===`usage-reset`&&ce)&&!h&&!M&&!r&&t?.settingsKey===ie&&t.preview&&Date.parse(t.preview.notBefore)>Date.now()?t.preview:void 0,de=!t||L?void 0:r??(t.start.kind===`usage-reset`&&ce?ce:h?`Checking the start time…`:_||M||(e.task.trim()?t.start.kind===`at`?`Checking the start time…`:`Finding when your usage limit resets…`:`Describe the task to schedule it.`));(0,X.useEffect)(()=>{i?.(de)},[de]);let fe=x?M:void 0,pe=_||M?ne:void 0,me=cS(t,L,oe?.timeZone),he=lS(t,L,oe?.timeZone);return(0,X.useEffect)(()=>{a?.(t?{text:me,title:he}:void 0)},[t?`${me}\n${he}`:void 0]),{task:e,value:t,onChange:n,disabledReason:r,open:d,setOpen:f,pick:m,busy:h,message:_,retry:y,touched:x,setTouched:S,setOptionsAttempt:O,optionsError:T,timeError:k,errors:j,fieldMessage:M,lastAt:ee,autoDefault:se,groupName:te,errorId:ne,eligibilityId:re,currentOptions:oe,resetReason:ce,check:ue,ready:L,blocked:de,visibleFieldMessage:fe,describedBy:pe,label:me,title:he}}function hS({state:e,trigger:t=`split`}){let{task:n,value:r,onChange:i,disabledReason:a,open:o,setOpen:s,pick:c,busy:l,message:u,retry:d,touched:f,setTouched:p,setOptionsAttempt:m,optionsError:h,timeError:g,errors:_,fieldMessage:v,lastAt:y,autoDefault:b,groupName:x,errorId:S,eligibilityId:C,currentOptions:w,resetReason:T,check:E,ready:D,blocked:O,visibleFieldMessage:k,describedBy:A,label:j,title:M}=e;return(0,Z.jsxs)(Ts,{open:o,onOpenChange:s,children:[(0,Z.jsx)(vs,{asChild:!0,children:t===`chip`?(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`start-time-trigger`,"aria-label":`Choose task start time`,title:M,className:nu,children:[r?j:`now`,tu]}):(0,Z.jsx)(q,{type:`button`,size:`icon-sm`,"data-slot":`start-time-trigger`,className:`h-8 w-7 rounded-l-none border-l border-primary-foreground/25`,"aria-label":`Choose task start time`,title:M,children:(0,Z.jsx)(qa,{"aria-hidden":`true`,className:H(`size-4 transition-transform`,o&&`rotate-180`)})})}),(0,Z.jsxs)(Cs,{align:t===`chip`?`start`:`end`,className:`w-80 max-w-[calc(100vw-2rem)] max-h-(--radix-popover-content-available-height) overflow-y-auto overscroll-contain space-y-3`,children:[(0,Z.jsxs)(`fieldset`,{className:`space-y-3`,children:[(0,Z.jsx)(`legend`,{className:`font-medium`,children:`Start task`}),(0,Z.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`input`,{type:`radio`,name:x,"aria-describedby":A,checked:!r,onChange:()=>c(`now`,null)}),`Now`]}),(0,Z.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`input`,{type:`radio`,name:x,"aria-describedby":A,disabled:!!a,checked:r?.start.kind===`at`,onChange:()=>{let e=y.current??uS(w?.timeZone);b.current=!y.current&&!w?e:null,c(`at`,{start:e})}}),`Pick date & time`]}),(0,Z.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`input`,{type:`radio`,name:x,"aria-describedby":T?C:A,disabled:!!T,checked:r?.start.kind===`usage-reset`,onChange:()=>c(`usage_reset`,{start:{kind:`usage-reset`}})}),`After usage limit resets`]})]}),T&&!a&&(0,Z.jsx)(`p`,{id:C,className:`text-sm text-muted-foreground`,children:T}),h&&(0,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:()=>m(e=>e+1),children:`Retry options`}),a&&(0,Z.jsx)(`p`,{id:C,role:`status`,className:`text-sm text-muted-foreground`,children:a}),r?.start.kind===`at`&&(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:w?`Server time zone: ${w.timeZone}`:`Loading server time zone…`}),(0,Z.jsxs)(`label`,{className:`block text-sm`,children:[`Date`,(0,Z.jsx)(gl,{"aria-describedby":A,onBlur:()=>p(!0),"aria-invalid":f&&_.date||g?!0:void 0,type:`date`,max:`9999-12-31`,value:r.start.date,onChange:e=>i({start:{...r.start,date:e.target.value}})})]}),(0,Z.jsxs)(`label`,{className:`block text-sm`,children:[`Time (server time zone)`,(0,Z.jsx)(gl,{"aria-describedby":A,onBlur:()=>p(!0),"aria-invalid":f&&_.time||g?!0:void 0,type:`time`,value:fS(r.start)?`${iS(r.start.hour)}:${iS(r.start.minute)}`:``,onChange:e=>{let[t,n]=e.target.value?e.target.value.split(`:`).map(Number):[-1,-1];i({start:{...r.start,hour:t??-1,minute:n??-1}})}})]})]}),r&&!a&&(0,Z.jsxs)(Z.Fragment,{children:[r.start.kind===`usage-reset`&&w?.usageReset.available&&(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:w.usageReset.provider===`claude`?`The task waits until your Claude usage limit resets, then starts. Cezar knows the reset time from limits your earlier Claude tasks hit.`:`The task waits until your Codex usage limit resets, then starts. Cezar reads the reset time from Codex.`}),r.start.kind===`usage-reset`&&!T&&!D&&!u&&(0,Z.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:O}),r.start.kind===`usage-reset`&&!T&&(D||u&&d)&&(0,Z.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,disabled:l||!n.task.trim(),onClick:()=>void E(),children:u?`Try again`:`Refresh`}),r.start.kind===`at`&&d&&(0,Z.jsx)(q,{type:`button`,variant:`outline`,disabled:l||!!v||!n.task.trim(),onClick:()=>void E(),children:`Retry`}),r.start.kind===`at`&&!D&&!u&&!v&&(0,Z.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:O}),D&&(0,Z.jsxs)(`div`,{role:`status`,className:`space-y-1 text-sm`,children:[(0,Z.jsxs)(`p`,{children:[`Earliest start: `,new Date(D.notBefore).toLocaleString(`en-GB`,{timeZone:D.timeZone}),` · `,D.timeZone]}),D.observation&&(0,Z.jsx)(`p`,{children:D.observation}),(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`The server must be running. Scheduling does not reserve allowance; account holds and queue limits still apply.`})]})]}),!f&&v&&!u&&(0,Z.jsx)(`p`,{id:S,className:`text-sm text-muted-foreground`,children:v}),(u||k)&&(0,Z.jsx)(`p`,{id:S,role:`alert`,className:`text-sm text-destructive`,children:u||k})]})]})}var gS=`[data-slot="composer-options-trigger"]`,_S=[{id:`slash-skills`,title:`Type / for a skill`,body:`A skill is a playbook the agent follows for one kind of job. Type / in the box to pick one as you write.`,anchor:`textarea`,picture:`slash`},{id:`source`,title:`Skills and workflows`,body:`Nothing picked runs the built-in quick task. A workflow chains steps with checks between them: plan, build, review.`,anchor:`[data-slot="source-pill"]`,picture:`source`},{id:`worktree`,title:`Each task in its own worktree`,body:`Options → Isolation: the agent works on a branch in a separate checkout, so your working tree stays yours. Pick "in place" to work in the checkout itself.`,anchor:gS,picture:`worktree`},{id:`autonomous`,title:`Autonomous runs do not wait`,body:`Options → Mode: autonomous carries on without asking you anything until it is done; supervised stops when it needs you.`,anchor:gS,picture:`autonomous`},{id:`model`,title:`Pick the model`,body:`auto follows the agent’s own default. Choose a larger model for hard work and a faster one for small fixes.`,anchor:`[data-slot="model-pill"]`,picture:`model`},{id:`attachments`,title:`Paste a screenshot`,body:`Drop or paste images and files into the box. The agent sees them with the task.`,anchor:`[aria-label="Attach files"]`,picture:`attachments`},{id:`options`,title:`Everything else is under Options`,body:`Run ×2 or ×3 variants and keep the better diff, change the base branch, start the task later, let it fan out into subtasks, or ask a question without changing anything. Your choices are remembered per project.`,anchor:gS,picture:`variants`},{id:`templates`,title:`Prompt templates`,body:`Insert a saved piece of text at the caret. A template assigned to a skill applies itself when you pick the skill.`,anchor:`[data-slot="prompt-template-trigger"]`,picture:`templates`},{id:`project`,title:`Which project`,body:`Skills, workflows, settings and the draft all follow the project picked here.`,anchor:`[data-slot="project-pill"]`,picture:`project`}];function vS(e){let t=_S.filter(t=>e.present.has(t.anchor));if(e.replay)return t;if(e.off)return[];let n=new Set(e.seen??[]);return t.filter(e=>!n.has(e.id)).slice(0,2)}function yS(e,t){return[...(e??[]).filter(e=>e!==t),t].slice(-50)}function bS(e,t){let n=new Set(e??[]);return _S.filter(e=>t.has(e.anchor)).every(e=>n.has(e.id))}var xS=5e3;function SS({anchorRoot:e,ready:t,loaded:n,seen:r,off:i,onSeen:a,onOff:o}){let[s,c]=X.useState(null),[l,u]=X.useState(0),[d,f]=X.useState(()=>new Set),[p,m]=X.useState(null),[h,g]=X.useState(null),_=X.useRef(null),v=X.useRef(null),y=X.useCallback(()=>e.current?.querySelector(`[data-slot="composer"]`)??null,[e]),b=X.useCallback(()=>{let e=y();return new Set(e?_S.filter(t=>e.querySelector(t.anchor)!==null).map(e=>e.anchor):[])},[y]);X.useEffect(()=>{if(!t||!n||s!==null)return;let e=b();f(e),c(vS({seen:r,off:i,present:e}))},[t,n,s,r,i,b]);let x=s&&t?s[l]:void 0,S=x?.id;X.useLayoutEffect(()=>{if(!x){m(null),g(null);return}let t=e.current,n=()=>{let e=y()?.querySelector(x.anchor);if(!t||!e){m(null),g(null);return}let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();m({top:r.top-n.top,left:r.left-n.left,width:r.width,height:r.height});let i=_.current?.getBoundingClientRect();g(i?Math.min(Math.max(r.left+r.width/2-i.left,18),Math.max(i.width-18,18)):null)};n(),window.addEventListener(`resize`,n);let r=t&&typeof ResizeObserver<`u`?new ResizeObserver(n):null;return t&&r?.observe(t),()=>{window.removeEventListener(`resize`,n),r?.disconnect()}},[x,e,y]);let C=X.useCallback(()=>{S&&(a(S),u(e=>e+1))},[S,a]);X.useEffect(()=>{if(!x||x.anchor===`textarea`)return;let e=y()?.querySelector(x.anchor);if(e)return e.addEventListener(`click`,C),()=>e.removeEventListener(`click`,C)},[x,y,C]),X.useEffect(()=>{v.current=S?Date.now():null},[S]);let w=X.useRef({currentId:S,onSeen:a});if(w.current={currentId:S,onSeen:a},X.useEffect(()=>()=>{let{currentId:e,onSeen:t}=w.current;e&&v.current!==null&&Date.now()-v.current>=xS&&t(e)},[]),!n||!t||s===null)return null;if(!x){let e=bS(r,d)||i===!0;return(0,Z.jsx)(`div`,{className:`mt-3 flex justify-center`,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`composer-tips-link`,onClick:()=>{i&&o(!1);let t=b();f(t),c(vS({seen:r,off:!1,present:t,replay:e})),u(0)},className:H(Ay,`text-label text-soft-foreground`),children:[(0,Z.jsx)(hd,{className:`size-3.5`,"aria-hidden":`true`}),e?`Show me around`:`Tips`]})})}let T=l>=s.length-1,E=p!==null&&p.height>40;return(0,Z.jsxs)(Z.Fragment,{children:[p?(0,Z.jsx)(`span`,{"data-slot":`composer-tip-halo`,"aria-hidden":`true`,className:H(`composer-tip-halo pointer-events-none absolute z-10`,E?`rounded-xl`:`rounded-full`),style:{top:p.top-4,left:p.left-4,width:p.width+8,height:p.height+8}}):null,(0,Z.jsxs)(`div`,{"data-slot":`composer-tip`,"data-tip":x.id,role:`note`,"aria-label":`Tip: ${x.title}`,className:`relative mt-3`,children:[h===null?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`composer-tip-arrow z-10`,style:{left:h}}),(0,Z.jsxs)(`div`,{ref:_,className:`onboarding-announcement relative flex items-stretch overflow-hidden rounded-xl border text-left`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col justify-center p-5 pr-10 sm:pr-5`,children:[(0,Z.jsxs)(`span`,{className:`eyebrow text-violet`,children:[`Tip `,l+1,` of `,s.length]}),(0,Z.jsx)(`span`,{className:`mt-1 text-lg font-light tracking-tight text-foreground`,children:x.title}),(0,Z.jsx)(`p`,{className:`mt-1 max-w-md text-ui text-muted-foreground`,children:x.body}),(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,Z.jsx)(q,{size:`sm`,className:`font-normal`,onClick:C,children:T?`Got it`:`Next tip`}),(0,Z.jsx)(`button`,{type:`button`,className:Ay,onClick:()=>{o(!0),u(s.length)},children:`Don’t show tips`})]})]}),(0,Z.jsx)(DS,{id:x.picture}),(0,Z.jsx)(`button`,{type:`button`,onClick:C,"aria-label":`Close tip`,className:`absolute top-3 right-3 grid size-7 place-items-center rounded-full text-soft-foreground hover:text-foreground`,children:(0,Z.jsx)(us,{className:`size-3.5`,"aria-hidden":`true`})})]})]})]})}var CS=`h-1.5 rounded bg-muted`,wS=`tip-rise flex items-center gap-2 rounded-md px-2 py-1 text-micro`;function TS({children:e}){return(0,Z.jsx)(`div`,{className:`onboarding-picture hidden w-60 shrink-0 items-end justify-center pt-5 pr-5 sm:flex`,"aria-hidden":`true`,children:(0,Z.jsx)(`div`,{className:`w-full rounded-t-lg border border-b-0 border-border bg-background p-3 shadow-[0_-12px_40px_-20px_var(--violet)]`,children:e})})}function ES({rows:e,pick:t=0,start:n=0}){return(0,Z.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.map((e,r)=>(0,Z.jsxs)(`div`,{style:{"--i":n+r},className:H(wS,r===t?`bg-violet/15 text-foreground`:`text-muted-foreground`),children:[(0,Z.jsx)(`span`,{className:H(`size-1.5 rounded-full`,r===t?`bg-violet`:`bg-muted-foreground/40`)}),e]},e))})}function DS({id:e}){switch(e){case`slash`:return(0,Z.jsxs)(TS,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-violet/60 px-2 py-1.5 font-mono text-meta text-foreground`,children:[(0,Z.jsx)(`span`,{className:`text-violet`,children:`/`}),`fix`,(0,Z.jsx)(`span`,{className:`tip-caret ml-px h-3 w-px bg-violet`})]}),(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(ES,{rows:[`fix-issue`,`write-tests`,`review-pr`]})})]});case`source`:return(0,Z.jsx)(TS,{children:(0,Z.jsx)(`div`,{className:`flex items-center py-3`,children:[`Plan`,`Build`,`Review`].map((e,t)=>(0,Z.jsxs)(X.Fragment,{children:[t>0?(0,Z.jsx)(`span`,{className:`h-px flex-1 bg-muted-foreground/40`}):null,(0,Z.jsx)(`span`,{style:{"--i":t},className:H(`tip-rise rounded-md border px-2 py-1 text-micro`,t===1?`border-violet text-foreground`:`border-border text-muted-foreground`),children:e})]},e))})});case`worktree`:case`base`:return(0,Z.jsxs)(TS,{children:[(0,Z.jsxs)(`svg`,{viewBox:`0 0 200 64`,className:`h-16 w-full`,fill:`none`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,Z.jsx)(`path`,{d:`M12 48 H188`,className:`stroke-muted-foreground/50`}),(0,Z.jsx)(`path`,{d:`M60 48 C 80 48, 84 20, 104 20 H188`,pathLength:1,className:`tip-draw stroke-violet`}),(0,Z.jsx)(`circle`,{cx:`60`,cy:`48`,r:`3.5`,className:`fill-background stroke-muted-foreground/70`}),(0,Z.jsx)(`circle`,{cx:`150`,cy:`20`,r:`3.5`,style:{"--i":2},className:`tip-rise fill-violet`})]}),(0,Z.jsxs)(`div`,{className:`flex justify-between font-mono text-micro text-soft-foreground`,children:[(0,Z.jsx)(`span`,{children:e===`base`?`base: main`:`main`}),(0,Z.jsx)(`span`,{className:`text-violet`,children:e===`base`?`cez/1a2b`:`worktree`})]})]});case`autonomous`:return(0,Z.jsxs)(TS,{children:[(0,Z.jsx)(`div`,{className:H(CS,`w-3/4`)}),(0,Z.jsx)(`div`,{className:H(CS,`mt-1.5 w-1/2`)}),(0,Z.jsx)(`div`,{className:`mt-3 h-1.5 w-full overflow-hidden rounded bg-muted`,children:(0,Z.jsx)(`div`,{className:`tip-progress h-full rounded bg-violet`})}),(0,Z.jsxs)(`div`,{className:`mt-2 flex items-center justify-between text-micro`,children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`No questions asked`}),(0,Z.jsxs)(`span`,{style:{"--i":10},className:`tip-rise inline-flex items-center gap-1 text-success`,children:[(0,Z.jsx)(Wa,{className:`size-3`}),` done`]})]})]});case`variants`:return(0,Z.jsxs)(TS,{children:[(0,Z.jsx)(`div`,{className:`grid grid-cols-3 gap-1.5`,children:[0,1,2].map(e=>(0,Z.jsxs)(`div`,{style:{"--i":e},className:H(`tip-rise rounded-md border p-1.5`,e===1?`border-violet`:`border-border`),children:[(0,Z.jsx)(`div`,{className:H(CS,`w-full`)}),(0,Z.jsx)(`div`,{className:H(CS,`mt-1 w-2/3`)}),(0,Z.jsx)(`div`,{className:`mt-2 flex justify-end`,children:e===1?(0,Z.jsx)(Wa,{className:`size-3 text-violet`}):(0,Z.jsx)(`span`,{className:`size-3`})})]},e))}),(0,Z.jsx)(`div`,{className:`mt-2 text-center font-mono text-micro text-soft-foreground`,children:`×3 · keep one`})]});case`model`:return(0,Z.jsx)(TS,{children:(0,Z.jsx)(ES,{rows:[`auto`,`opus · hard work`,`haiku · small fixes`],pick:1})});case`attachments`:return(0,Z.jsxs)(TS,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`tip-drop grid size-9 place-items-center rounded-md border border-violet/60 bg-violet/15`,children:(0,Z.jsx)(`span`,{className:`size-4 rounded-sm bg-violet/60`})}),(0,Z.jsx)(`span`,{className:`tip-drop grid h-9 items-center rounded-md border border-border px-2 text-micro text-muted-foreground`,style:{animationDelay:`900ms`},children:`design.pdf`})]}),(0,Z.jsx)(`div`,{className:H(CS,`mt-3 w-2/3`)})]});case`schedule`:return(0,Z.jsx)(TS,{children:(0,Z.jsx)(ES,{rows:[`Now`,`Tonight at 23:00`,`When the usage limit resets`],pick:1})});case`dispatch`:return(0,Z.jsx)(TS,{children:(0,Z.jsxs)(`svg`,{viewBox:`0 0 200 72`,className:`h-[72px] w-full`,fill:`none`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,Z.jsx)(`rect`,{x:`12`,y:`28`,width:`44`,height:`16`,rx:`4`,className:`stroke-violet`}),[12,36,60].map((e,t)=>(0,Z.jsxs)(X.Fragment,{children:[(0,Z.jsx)(`path`,{d:`M56 36 C 90 36, 100 ${e}, 128 ${e}`,pathLength:1,style:{"--i":t},className:`tip-draw stroke-muted-foreground/60`}),(0,Z.jsx)(`rect`,{x:`128`,y:e-7,width:`56`,height:`14`,rx:`4`,style:{"--i":t+2},className:`tip-rise stroke-border fill-card`})]},e))]})});case`ask`:return(0,Z.jsxs)(TS,{children:[(0,Z.jsx)(`div`,{className:`ml-auto w-3/4 rounded-lg rounded-br-sm bg-violet/15 px-2 py-1 text-micro text-foreground`,children:`Where is the retry logic?`}),(0,Z.jsxs)(`div`,{style:{"--i":2},className:`tip-rise mt-2 w-5/6 rounded-lg rounded-bl-sm border border-border px-2 py-1 text-micro text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-foreground`,children:`src/runs/retry.ts`}),`, nothing changed.`]})]});case`followups`:return(0,Z.jsxs)(TS,{children:[(0,Z.jsx)(`div`,{className:`mb-1 eyebrow text-soft-foreground`,children:`Inbox`}),(0,Z.jsx)(ES,{rows:[`Add a test for the empty case`,`Document the new flag`,`Remove the old helper`],pick:0})]});case`templates`:return(0,Z.jsxs)(TS,{children:[(0,Z.jsx)(`div`,{className:H(CS,`w-3/4`)}),(0,Z.jsx)(`div`,{style:{"--i":1},className:`tip-rise mt-1.5 rounded-sm border border-violet/60 bg-violet/15 px-1.5 py-1 text-micro text-foreground`,children:`Run the tests and report what you ran.`}),(0,Z.jsx)(`div`,{className:H(CS,`mt-1.5 w-1/2`)})]});case`project`:return(0,Z.jsx)(TS,{children:(0,Z.jsx)(ES,{rows:[`shop-web`,`billing-api`,`docs`],pick:1})})}}function OS({onLongPress:e,onClick:t,delayMs:n=450,moveTolerance:r=8}){let i=(0,X.useRef)({onLongPress:e,onClick:t});i.current={onLongPress:e,onClick:t};let a=(0,X.useRef)(null),o=(0,X.useRef)({x:0,y:0}),s=(0,X.useRef)(!1),c=(0,X.useCallback)(()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},[]);return(0,X.useEffect)(()=>c,[c]),{onPointerDown:(0,X.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,X.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,X.useCallback)(e=>{e.preventDefault(),c(),!s.current&&(s.current=!0,i.current.onLongPress())},[c]),onClick:(0,X.useCallback)(e=>{if(s.current){s.current=!1,e.preventDefault();return}i.current.onClick?.()},[]),onKeyDown:(0,X.useCallback)(e=>{(e.key===`ArrowDown`||e.key===`Enter`&&e.shiftKey)&&(e.preventDefault(),i.current.onLongPress())},[])}}function kS({available:e,value:t,onChange:n,onSettingsOpenChange:r,runners:i,parentRunner:a,parentModels:o}){let[s,c]=(0,X.useState)(!1),l=Li(),u=(0,X.useRef)({});t!==null&&(u.current=t);let d=(t??u.current).runner??a,f=A(d,e&&d!==a),p=d===a?o:cu(d,f.data),m=e=>{c(e),r?.(e)},h=t!==null,g=OS({onLongPress:()=>m(!0),onClick:()=>n(h?null:u.current)});if(!e)return null;let _=(0,Z.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":h,"aria-label":`Dispatch`,"data-slot":`dispatch-toggle`,"data-state":h?`on`:`off`,...g,className:H(l?`inline-flex h-full w-[26px] items-center justify-center transition-colors hover:bg-muted`:H(nu,`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,Z.jsx)(Pd,{"aria-hidden":`true`,className:H(`size-3 shrink-0`,h?`text-primary`:`text-soft-foreground`)})}),v=(0,Z.jsx)(RS,{value:t,remembered:u.current,onChange:n,runners:i,models:p}),y=(0,Z.jsxs)($c,{side:`top`,sideOffset:6,className:`max-w-[260px]`,children:[(0,Z.jsx)(`div`,{className:`font-medium`,children:h?`Dispatch — on`:`Dispatch — off`}),(0,Z.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,Z.jsx)(`div`,{className:`mt-0.5 text-contrast-foreground/60`,children:`▾ limits and subtask defaults`}):null]}),b=l?(0,Z.jsxs)(`span`,{"data-slot":`dispatch-control`,"data-state":h?`on`:`off`,className:H(`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,Z.jsx)(Zc,{delayDuration:300,children:(0,Z.jsxs)(Qc,{children:[(0,Z.jsx)(Xc,{asChild:!0,children:_}),y]})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Dispatch settings`,"aria-haspopup":`dialog`,"aria-expanded":s,"data-slot":`dispatch-settings-trigger`,onClick:()=>m(!s),className:H(`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,Z.jsx)(qa,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})})]}):(0,Z.jsx)(Zc,{delayDuration:300,children:(0,Z.jsxs)(Qc,{children:[(0,Z.jsx)(Xc,{asChild:!0,children:_}),y]})});return l?(0,Z.jsxs)(Ts,{open:s,onOpenChange:m,children:[(0,Z.jsx)(bs,{asChild:!0,children:b}),(0,Z.jsx)(Cs,{align:`start`,sideOffset:8,"data-slot":`dispatch-settings`,className:`w-[340px] max-w-[calc(100vw-2rem)] p-3.5`,children:v})]}):(0,Z.jsxs)(Z.Fragment,{children:[b,(0,Z.jsx)(wi,{open:s,onOpenChange:m,children:(0,Z.jsxs)(Si,{side:`bottom`,"data-slot":`dispatch-settings`,className:`rounded-t-xl p-4 pt-16 pb-[max(1rem,env(safe-area-inset-bottom))]`,children:[(0,Z.jsx)(xi,{className:`sr-only`,children:`Dispatch`}),(0,Z.jsx)(yi,{className:`sr-only`,children:`Split this task into subtasks run as separate tasks`}),v]})})]})}function AS({label:e,htmlFor:t,children:n}){return(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`label`,{htmlFor:t,className:`shrink-0 text-xs text-foreground`,children:e}),n]})}var jS=`h-7 max-w-[180px] px-2 text-xs`,MS=`__default__`;function NS({id:e,slot:t,value:n,onChange:r,options:i,none:a}){return(0,Z.jsxs)(Za,{value:n??MS,onValueChange:e=>r(e===MS?void 0:e),children:[(0,Z.jsx)(Ya,{id:e,size:`sm`,"data-slot":t,className:jS,children:(0,Z.jsx)(Xa,{})}),(0,Z.jsxs)(Ja,{children:[a===void 0?null:(0,Z.jsx)(J,{value:MS,children:a}),i.map(e=>(0,Z.jsx)(J,{value:e.value,children:e.label},e.value))]})]})}var PS=[2,3,4,5,8,10,15,20,30,50],FS=.5,IS=1e4;function LS(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 RS({value:e,remembered:t,onChange:n,runners:r,models:i}){let a=(0,X.useId)(),o=e!==null,s=e??t,c=e=>n(LS({...s,...e})),l=i.filter(e=>e.id!==``),u=bu.filter(e=>r.includes(e.id)),d=s.maxSubtasks!==void 0&&!PS.some(e=>e===s.maxSubtasks)?[...PS,s.maxSubtasks].sort((e,t)=>e-t):[...PS];return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`header`,{className:`flex items-start gap-2.5`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary`,children:(0,Z.jsx)(Pd,{className:`size-3.5`})}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`text-ui font-semibold leading-tight text-foreground`,children:`Dispatch`}),(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs leading-snug text-muted-foreground`,children:`Split this task into subtasks run as separate tasks`})]}),(0,Z.jsx)(mo,{"aria-label":`Dispatch`,"data-slot":`dispatch-settings-switch`,checked:o,onCheckedChange:e=>n(e?t:null)})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border pt-3`,children:[(0,Z.jsx)(AS,{label:`Max subtasks`,htmlFor:`${a}-max`,children:(0,Z.jsx)(NS,{id:`${a}-max`,slot:`dispatch-max-subtasks`,value:s.maxSubtasks===void 0?void 0:String(s.maxSubtasks),onChange:e=>c({maxSubtasks:e===void 0?void 0:Number(e)}),none:`unlimited`,options:d.map(e=>({value:String(e),label:String(e)}))})}),(0,Z.jsx)(AS,{label:`In flight at once`,htmlFor:`${a}-flight`,children:(0,Z.jsx)(NS,{id:`${a}-flight`,slot:`dispatch-in-flight`,value:String(s.inFlight??4),onChange:e=>{let t=Number(e);c({inFlight:t===4?void 0:t})},options:Array.from({length:4},(e,t)=>({value:String(t+1),label:String(t+1)}))})}),(0,Z.jsx)(AS,{label:`Subtask runner`,htmlFor:`${a}-runner`,children:(0,Z.jsx)(NS,{id:`${a}-runner`,slot:`dispatch-runner`,value:s.runner,onChange:e=>c({runner:e,model:void 0}),none:`same as parent`,options:u.map(e=>({value:e.id,label:e.label}))})}),(0,Z.jsx)(AS,{label:`Subtask model`,htmlFor:`${a}-model`,children:(0,Z.jsx)(NS,{id:`${a}-model`,slot:`dispatch-model`,value:s.model,onChange:e=>c({model:e}),none:`same as parent`,options:[...l.map(e=>({value:e.id,label:e.label})),...s.model!==void 0&&!l.some(e=>e.id===s.model)?[{value:s.model,label:s.model}]:[]]})}),(0,Z.jsx)(AS,{label:`Budget per subtask`,htmlFor:`${a}-budget`,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(gl,{id:`${a}-budget`,"data-slot":`dispatch-budget`,type:`text`,inputMode:`decimal`,placeholder:`none`,className:`h-7 w-24 px-2 text-ui md:text-ui`,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(IS,Math.max(FS,n))})}}),(0,Z.jsx)(`span`,{className:`text-label text-muted-foreground`,children:`USD`})]})})]}),(0,Z.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.`]})]})}function zS({label:e,url:t,hint:n,showIcon:r=!0,copySlot:i=`bm-copy`}){let a=(0,X.useRef)(null);(0,X.useEffect)(()=>{a.current?.setAttribute(`href`,t)},[t]);let o=async()=>{try{await Xl(t),Y(`Bookmarklet URL copied.`)}catch{Y(`Copy failed — drag the button instead.`,{tone:`danger`})}};return(0,Z.jsxs)(`div`,{"data-slot":`bm-row`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Z.jsx)(el,{label:`Drag me to your bookmarks bar`,children:(0,Z.jsxs)(`a`,{ref:a,draggable:!0,"data-slot":`bm-link`,onClick:e=>{e.preventDefault(),Y(`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-ui font-medium text-foreground shadow-xs transition-colors hover:bg-muted`,children:[r?(0,Z.jsx)(ds,{"aria-hidden":`true`,className:`size-3 text-primary`}):null,e]})}),(0,Z.jsx)(`button`,{type:`button`,"data-slot":i,"aria-label":`Copy the bookmarklet URL`,onClick:()=>void o(),className:`shrink-0 text-label font-medium text-muted-foreground transition-colors hover:text-foreground`,children:`Copy`}),n?(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-label text-soft-foreground`,children:n}):null]})}var BS=`http://localhost:4321`;function VS(e,t,n,r=BS,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 HS={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 US({source:e,className:t,teamRepo:n}){let r=Wo({source:e}),i=e===`team`&&n?`Shared from ${n}, a team skills repository configured for this project.`:HS[e];return(0,Z.jsx)(Zc,{delayDuration:300,children:(0,Z.jsxs)(Qc,{children:[(0,Z.jsx)(Xc,{asChild:!0,children:(0,Z.jsx)(`span`,{"data-slot":`skill-source`,"data-source":e,"aria-label":i,className:H(`shrink-0 rounded-full border border-border px-2 py-px font-mono text-micro`,r?`font-semibold text-foreground`:`text-soft-foreground`,t),children:e})}),(0,Z.jsx)($c,{side:`top`,sideOffset:6,children:i})]})})}function WS({skill:e,usedBy:t,heading:n=`h2`,enabled:r=!0,activation:i}){return(0,Z.jsxs)(`div`,{"data-slot":`skill-detail`,className:`mx-auto w-full min-w-0 max-w-[var(--measure)]`,children:[(0,Z.jsxs)(`section`,{"data-slot":`skill-properties`,className:`rounded-lg border border-border bg-muted/20 p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2.5`,children:[(0,Z.jsx)(n,{className:`min-w-0 font-mono text-lg font-semibold break-all`,children:e.name}),(0,Z.jsx)(US,{source:e.source,teamRepo:e.team?.repo})]}),(0,Z.jsxs)(`p`,{"data-slot":`skill-path`,className:`mt-1 font-mono text-micro break-all text-soft-foreground`,children:[e.path,e.team?` · from ${e.team.repo}`:``]}),e.variants&&e.variants.length>1?(0,Z.jsxs)(`p`,{"data-slot":`skill-variants`,className:`mt-1 font-mono text-micro break-all text-soft-foreground`,children:[`Also defined for: `,e.variants.slice(1).map(e=>`${e.runner} (${e.path})`).join(`, `)]}):null,e.description?(0,Z.jsx)(`p`,{"data-slot":`skill-description`,className:`mt-2.5 text-ui text-muted-foreground`,children:e.description}):null]}),i?(0,Z.jsx)(mo,{"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,Z.jsx)(GS,{skill:e}):null,t===void 0?null:(0,Z.jsxs)(`section`,{"data-slot":`skill-used-by`,className:`mt-4 border-t border-border pt-4`,children:[(0,Z.jsx)(`h3`,{className:`eyebrow text-soft-foreground`,children:`Used by`}),t.length>0?(0,Z.jsx)(`ul`,{className:`mt-1.5 flex flex-col gap-1`,children:t.map(e=>(0,Z.jsxs)(`li`,{className:`flex items-center gap-1.5 font-mono text-ui text-muted-foreground`,children:[(0,Z.jsx)(pa,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),e]},e))}):(0,Z.jsx)(`p`,{className:`mt-1.5 text-label text-muted-foreground`,children:`Not referenced by any workflow yet — quick-task picks it up when the task mentions it.`})]})]}),(0,Z.jsxs)(`section`,{"data-slot":`skill-content`,className:`mt-6 min-w-0 border-t border-border pt-5`,children:[(0,Z.jsx)(`h3`,{className:`eyebrow text-soft-foreground`,children:`Content`}),(0,Z.jsx)(`div`,{"data-slot":`skill-body`,className:`mt-3 text-sm`,children:(0,Z.jsx)(Fu,{children:e.body})})]})]})}function GS({skill:e}){let t=qe(),n=E(),r=i(),[a,o]=(0,X.useState)(!1),s=t.data?.key??``,c=window.location.origin,l=Nr()??n.data?.bootProject??null,u=r.data?.projects.find(e=>e.id===l)?.name??SM(n.data)?.name??null,d=VS(e.name,a,s,c,l);return(0,Z.jsxs)(`section`,{"data-slot":`skill-run-from-github`,className:`mt-5 border-t border-border pt-4`,children:[(0,Z.jsx)(`h3`,{className:`eyebrow text-soft-foreground`,children:`Run from GitHub`}),(0,Z.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,Z.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-xs font-medium`,children:[(0,Z.jsx)(mo,{"data-slot":`bookmarklet-auto`,size:`sm`,"aria-label":`Start automatically`,checked:a,onCheckedChange:o}),(0,Z.jsx)(`span`,{children:`Start automatically`})]}),(0,Z.jsx)(`div`,{className:`mt-3`,children:(0,Z.jsx)(zS,{label:u?`/${e.name} (${u})`:`/${e.name}`,url:d,showIcon:!1,copySlot:`skill-bookmarklet-copy`})}),(0,Z.jsx)(`p`,{className:`mt-2 text-label text-muted-foreground`,children:`To update an existing bookmarklet after changing this option, drag the button to your bookmarks bar again.`}),(0,Z.jsx)(G,{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 KS({skill:e,onClose:t}){return(0,Z.jsx)(ol,{open:e!==null,onOpenChange:e=>e?void 0:t(),children:(0,Z.jsx)(rl,{"data-slot":`skill-preview`,className:`block max-h-[80dvh] overflow-y-auto sm:max-w-2xl`,children:e?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(il,{className:`sr-only`,children:e.name}),(0,Z.jsx)(al,{className:`sr-only`,children:`Skill preview with GitHub launcher`}),(0,Z.jsx)(WS,{skill:e,heading:`h3`}),(0,Z.jsx)(`p`,{className:`mt-5`,children:(0,Z.jsx)(G,{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 qS({source:e,ready:t,skills:n,skillUsage:r,workflows:i,onPick:a}){let[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(!1),m=(0,X.useRef)(null),{mostUsed:h,project:g,global:_}=Zo(Lo(n,c,r),r),v=i.find(e=>e.name===Su),y=Qo(i,c).filter(e=>e.name!==Su),b=$o(`no skill`,`none plain ${Su} ${v?.description??``}`,c)>0,x=!b&&h.length===0&&g.length===0&&_.length===0&&y.length===0,S=e=>{a(e),s(!1)},C=t=>S(e?.source===t.source&&e.ref===t.ref?null:t),w=(t,n)=>{let r=e?.source===`skill`&&e.ref===t.name;return(0,Z.jsxs)(Wl,{value:`skill ${t.name} ${t.path}`,keywords:Po(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.name,onSelect:()=>C({source:`skill`,ref:t.name}),children:[(0,Z.jsx)(`span`,{className:H(`shrink-0 text-xs`,n&&`font-semibold`),children:t.name}),t.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-label text-muted-foreground`,children:t.description}):null,(0,Z.jsx)(el,{label:`View skill`,children:(0,Z.jsx)(`button`,{type:`button`,"data-slot":`source-skill-view`,"aria-label":`View skill ${t.name}`,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,Z.jsx)(So,{"aria-hidden":`true`,className:`size-3.5`})})}),r?(0,Z.jsx)(Wa,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},t.path)},T=e===null?ts:e.source===`skill`?La:bo,E=(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`source-pill`,"data-source-kind":e?.source??`none`,"aria-label":`Choose a skill or workflow`,"aria-description":e===null?`No skill — runs as one plain agent step`:`Runs the ${e.source} ${e.ref}`,disabled:!t,onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1),onPointerDown:()=>p(!1),onKeyDown:t=>{e===null||t.metaKey||t.ctrlKey||t.altKey||t.key!==`Backspace`&&t.key!==`Delete`||(t.preventDefault(),a(null))},className:H(nu,e===null?`border-dashed text-soft-foreground`:`rounded-r-none border-r-0 border-foreground/60 pr-1.5 text-foreground`),children:[(0,Z.jsx)(T,{"aria-hidden":`true`,className:H(`size-3 shrink-0`,e===null?`text-soft-foreground`:`text-violet`)}),(0,Z.jsx)(`span`,{className:`max-w-44 truncate`,children:t?e?.ref??`Skill`:`…`}),tu]});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(KS,{skill:u,onClose:()=>d(null)}),(0,Z.jsxs)(Ts,{open:o,onOpenChange:e=>{s(e),e||l(``)},children:[(0,Z.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,Z.jsx)(Zc,{children:(0,Z.jsxs)(Qc,{open:f&&!o&&e!==null&&t,children:[(0,Z.jsx)(Xc,{asChild:!0,children:(0,Z.jsx)(vs,{asChild:!0,children:E})}),(0,Z.jsx)($c,{side:`bottom`,sideOffset:6,"data-slot":`source-pill-hint`,children:`Pick it again, or press ✕, to run without it`})]})}),e!==null&&t?(0,Z.jsx)(el,{label:`Run without it`,children:(0,Z.jsx)(`button`,{type:`button`,"data-slot":`source-pill-clear`,"aria-label":`Clear the ${e.source} ${e.ref}`,onClick:()=>a(null),className:H(nu,`rounded-l-none border-foreground/60 pl-1.5 pr-2 text-soft-foreground hover:text-foreground`),children:(0,Z.jsx)(us,{"aria-hidden":`true`,className:`size-3`})})}):null]}),(0,Z.jsx)(Cs,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(ql,{shouldFilter:!1,children:[(0,Z.jsx)(zl,{placeholder:`search skills & workflows…`,value:c,onValueChange:l,onInput:()=>m.current?.scrollTo(0,0)}),(0,Z.jsxs)(Kl,{ref:m,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[x?(0,Z.jsx)(Gl,{children:`Nothing matches.`}):null,b?(0,Z.jsx)(Vl,{children:(0,Z.jsxs)(Wl,{value:`none no-skill`,keywords:[`none`,`plain`,...Po(Su)],"data-slot":`source-option`,"data-source-kind":`none`,onSelect:()=>S(null),children:[(0,Z.jsx)(ba,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:`No skill`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-label text-muted-foreground`,children:v?.description??`One agent run on your task — no ceremony.`}),e===null?(0,Z.jsx)(Wa,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]})}):null,h.length>0?(0,Z.jsx)(Vl,{heading:`Most used`,children:h.map(e=>w(e,Wo(e)))}):null,g.length>0?(0,Z.jsx)(Vl,{heading:`Project skills`,children:g.map(e=>w(e,!0))}):null,y.length>0?(0,Z.jsx)(Vl,{heading:`Workflows`,children:y.map(t=>{let n=e?.source===`workflow`&&e.ref===t.name;return(0,Z.jsxs)(Wl,{value:`workflow ${t.name}`,keywords:Po(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>C({source:`workflow`,ref:t.name}),children:[(0,Z.jsx)(`span`,{className:`shrink-0 text-xs`,children:t.name}),t.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-label text-muted-foreground`,children:t.description}):null,n?(0,Z.jsx)(Wa,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},t.name)})}):null,_.length>0?(0,Z.jsx)(Vl,{heading:`Global`,children:_.map(e=>w(e,!1))}):null]})]})})]})]})}function JS(e,t,n){let r=e.skill===``?{source:`workflow`,ref:`quick-task`}:{source:`skill`,ref:e.skill};return vu({task:e.ref,source:r,model:``,runner:t,defaultRunner:n,variants:1,images:[],todoId:e.todo})}function YS(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 XS(e,t){return`Use the "${e}" skill on: ${t}`}function ZS(e,t){return t&&e===`source-dependent`?!1:e}function QS(e,t){return e.worktree===null?null:(e.worktreeBasis??`default`)===(t??`default`)?e.worktree:null}function $S(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 eC(e){return e.readOnly===!0&&e.hasGit?`Asks a read-only question about the current checkout — no branch, nothing to clean up.`: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.variants!==void 0&&e.variants>1&&e.hasGit?e.autonomous===!0?`Runs ${e.variants} competing variants on their own, each in its own worktree — pick the diff you keep.`:`Runs ${e.variants} competing variants, each in its own worktree — pick the diff you keep.`:e.worktree?e.autonomous===!0?`Runs on its own in an isolated worktree — it will not pause for you; review everything before it lands.`:`Runs in an isolated worktree — review everything before it lands.`:e.hasGit&&e.newBranch?`Runs in the repo working tree on a new branch from base — your checkout switches to it.`:e.hasGit&&e.autoLand?e.autonomous===!0?`Runs in the repo working tree, one write task at a time — finished work is checked and lands on the base branch.`:`Runs in the repo working tree, one write task at a time — review the changes, then Commit lands them on the base branch.`: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.`}function tC(e){let t=[];return e.variants>1&&t.push({id:`variants`,label:`×${e.variants} variants`}),e.autonomous!==e.defaultAutonomous&&t.push({id:`mode`,label:e.autonomous?`autonomous`:`supervised`}),e.isolationChoosable&&e.worktree!==e.defaultWorktree&&t.push({id:`isolation`,label:e.worktree?`worktree`:`in place`}),e.dispatch&&t.push({id:`dispatch`,label:`dispatch`}),e.effort&&t.push({id:`effort`,label:`effort ${e.effort}`}),t}var nC={text:``,source:null,runner:null,agentProfile:null,model:null,reasoningEffort:null,variants:1,worktree:null,autonomous:null,generateFollowups:null,dispatch:null},rC=`cez-new-task-draft`;function iC(e){return e===null?rC:`${rC}:${e}`}function aC(e){let t=e&&typeof e==`object`?e:{};return{text:typeof t.text==`string`?t.text:``,source:sC(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,reasoningEffort:typeof t.reasoningEffort==`string`?t.reasoningEffort:null,variants:t.variants===2||t.variants===3?t.variants:1,worktree:typeof t.worktree==`boolean`?t.worktree:null,...typeof t.worktreeBasis==`string`?{worktreeBasis:t.worktreeBasis}:{},...t.newBranch===!0?{newBranch:!0}:{},...typeof t.branchName==`string`&&t.branchName?{branchName:t.branchName}:{},autonomous:typeof t.autonomous==`boolean`?t.autonomous:null,generateFollowups:typeof t.generateFollowups==`boolean`?t.generateFollowups:null,dispatch:oC(t.dispatch),...typeof t.readOnly==`boolean`?{readOnly:t.readOnly}:{}}}function oC(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`&&bu.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 sC(e){return!!e&&typeof e==`object`&&(e.source===`skill`||e.source===`workflow`)&&typeof e.ref==`string`}var cC=new Map;function lC(e=null){let t=iC(e),n=cC.get(t);if(n)return{...n};let r;try{let e=localStorage.getItem(t);r=e?aC(JSON.parse(e)):{...nC}}catch{r={...nC}}return cC.set(t,r),{...r}}function uC(e,t=null){let n=iC(t);cC.set(n,{...e});try{localStorage.setItem(n,JSON.stringify(e))}catch{}}function dC(e=null){let{branchName:t,readOnly:n,...r}=lC(e);uC({...r,text:``,source:null},e)}function fC(e=null){let{text:t}=lC(e);uC({...nC,text:t},e)}var pC=new Map;function mC(e=null){return[...pC.get(iC(e))??[]]}function hC(e,t=null){let n=iC(t);e.length===0?pC.delete(n):pC.set(n,[...e])}function gC(e,t){if(e===t)return{moved:!1,reason:`same-project`};let n=lC(e),r=mC(e);if(n.text===``&&r.length===0)return{moved:!1,reason:`nothing-to-move`};let i=lC(t);return i.text!==``||mC(t).length>0?{moved:!1,reason:`destination-busy`}:(uC({...i,text:n.text},t),uC({...n,text:``},e),hC(r,t),hC([],e),{moved:!0})}var _C=new Map;function vC(e){return`cez-pending-schedule:${e??`default`}`}function yC(e){let t=_C.get(e);if(t)return t;try{let t=JSON.parse(sessionStorage.getItem(e)??`null`);if(hr.safeParse(t).success)return t}catch{}return null}function bC(e,t){t?_C.set(e,t):_C.delete(e);try{t?sessionStorage.setItem(e,JSON.stringify(t)):sessionStorage.removeItem(e)}catch{}}function xC(e){return e?.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||void 0}function SC(){let[e]=Or(),t=Lr(),n=V(),{projectId:r}=kr(),a=Rt().projectId,o=i(),[s]=(0,X.useState)(()=>Vy(e)),c=E(),l=Ct(),u=de(),d=_n(),f=Ht(),p=Et(),m=Oy(),h=(0,X.useRef)(null),g=Rn(),_=tn(),[v,y]=(0,X.useState)(()=>({...lC(a),...s.ref===``?{}:{text:s.ref},...s.skill===``?{}:{source:{source:`skill`,ref:s.skill}}}));(0,X.useEffect)(()=>{uC(v,a)},[v,a]);let b=e=>y(t=>({...t,...e})),[x,S]=(0,X.useState)(()=>mC(a));(0,X.useEffect)(()=>{hC(x,a)},[x,a]);let C=f.data?.recentSources,w=u.data,T=f.data?.skillUsage,D=(0,X.useMemo)(()=>Fo(w??[],T),[w,T]),O=l.data?.workflows??[],k=o.data?.projects??[],j=e=>o.data?.bootProject===e?null:e,M=u.isError&&u.data===void 0||l.isError&&l.data===void 0,N=!u.isPending&&!l.isPending&&!f.isPending,P=g.data?.taskWorkspace===`in-place`,ee=d.data?.info!=null&&(P||g.data?.profile===`trunk`),te=ee&&v.variants<=1&&v.dispatch===null&&(v.readOnly??(g.data?.profile===`trunk`&&ou(v.text))),ne=(M?v.source:fu(v.source,D,O))??pu(g.data,te,M?null:D),re=ne?.source===`skill`?D.find(e=>e.name===ne.ref):void 0,ie=(0,X.useRef)(null),F=(0,X.useMemo)(()=>Io(Ro(f.data?.promptTemplates),c.data?.capabilities),[f.data?.promptTemplates,c.data?.capabilities]),ae=Ho(F,ne?.source===`skill`?[ne.ref]:[]),oe=(0,X.useRef)(v.text);oe.current=v.text;let se=(0,X.useRef)(``);(0,X.useEffect)(()=>{if(!N)return;let e=Uo(oe.current,se.current,ae);se.current=e.applied,e.text!==oe.current&&b({text:e.text})},[ae,N]);let ce=Mt(),le=gn(ce.data),I=g.data?.defaultRunner,ue=I??`claude`,L=le.length>0?mu(v.runner,le,ue):null,fe=L??ue,pe=ce.isSuccess&&le.length>0,me=A(fe),ge=g.data?.modelsLocked===!0,_e=L===null?[]:cu(L,me.data,[v.model,g.data?.defaultModels?.[L]]),ve=L===null?``:uu(ge?null:v.model,L,g.data?.defaultModels,me.data),ye=L===null?``:_u(v.reasoningEffort,L,ve,me.data),be=L===null?[]:lu(L,ve,me.data),{accounts:xe,repoAccount:Se}=su(),Ce=xe.some(e=>e.provider===fe&&e.id===v.agentProfile)?v.agentProfile:null,we=iu(fe,Ce??Se?.[fe]),Te=(0,X.useRef)(!1);(0,X.useEffect)(()=>{let e=pe&&!Te.current;Te.current=pe,e&&document.activeElement===document.body&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[pe]);let Ee=d.data===void 0||d.data.info!==null,De=Ee?v.variants:1,Oe=Ee,ke=c.data?.capabilities.dispatch===!0&&Ee,Ae=ke?v.dispatch:null,Me=Ae!==null,[Ne,Pe]=(0,X.useState)(!1),[Fe,Ie]=(0,X.useState)(!1),Le=(0,X.useRef)(null),Re=e=>{b({dispatch:e}),Le.current!==null&&clearTimeout(Le.current),Le.current=null,Pe(e!==null),e!==null&&(Le.current=setTimeout(()=>Pe(!1),6e3))};(0,X.useEffect)(()=>()=>{Le.current!==null&&clearTimeout(Le.current)},[]);let ze=De>1||Me,Be={hasGit:Ee,variants:De,explicitAutonomous:v.autonomous,explicitWorktree:QS(v,g.data?.taskWorkspace),interactive:re?.interactive,configuredAutonomous:ZS(_.data?.composerDefaults?.autonomous??_.data?.composerDefaults?.inheritedAutonomous??`source-dependent`,g.data?.landing===`auto`),configuredWorktree:g.data?.taskWorkspace?g.data.taskWorkspace===`worktree`:_.data?.composerDefaults?.worktree??_.data?.composerDefaults?.inheritedWorktree??!0,source:ne?.source??`workflow`,dispatch:Me},Ve=$S(Be),He=$S({...Be,variants:1,explicitAutonomous:null,explicitWorktree:null,dispatch:!1}),Ue=te&&!Me&&De<=1,We=Ve.worktree&&!Ue,Ge=Ve.autonomous,Ke=c.data===void 0||c.data.capabilities.followups,qe=Ke?v.generateFollowups??f.data?.lastGenerateFollowups??!0:!1,[Je,Ye]=(0,X.useState)(()=>s.auto&&s.ref!==``),[Xe,Ze]=(0,X.useState)(()=>!s.auto&&s.ref!==``?{kind:`prefill`}:null),Qe=(0,X.useRef)(!1),$e=(0,X.useRef)(!1);(0,X.useEffect)(()=>{Qe.current||(Qe.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[]),(0,X.useEffect)(()=>{if(!$e.current&&!(!s.auto||s.ref===``)&&!ce.isPending){if(dt.current){$e.current=!0,Ye(!1),Ze({kind:`prefill`});return}if(!pe||L===null){$e.current=!0,Ze({kind:`prefill`}),Ye(!1);return}if(!g.isPending){if($e.current=!0,I===void 0){Ze({kind:`prefill`}),Ye(!1);return}if(L!==I){Ze({kind:`prefill`}),Ye(!1);return}(async()=>{let e=``;try{e=(await en()).key}catch{}if(e!==``&&s.key===e)try{let e=await he(JS(s,L,I));Tl(`bookmarklet`),dC(a),n.invalidateQueries({queryKey:z.runs.all}),t(au(e));return}catch(e){Ze({kind:`failed`,message:e instanceof Error?e.message:String(e)})}else Ze({kind:`blocked`});Ye(!1)})()}}},[g.isPending,I,ce.isPending,pe,L]),(0,X.useEffect)(()=>{if(Xe===null||!N)return;Ze(null);let e=s.skill!==``&&!M&&!D.some(e=>e.name===s.skill)?s.skill:``;e!==``&&b({text:XS(s.skill,s.ref),source:null});let{message:t,tone:n}=YS(Xe,e);Y(t,{tone:n}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"]`)?.focus()},[Xe,N]);let[et,tt]=(0,X.useState)(null),[nt,rt]=(0,X.useState)(),[it,at]=(0,X.useState)(),[ot,st]=(0,X.useState)(!1),ct=vC(a),[lt,ut]=(0,X.useState)(()=>yC(ct)),dt=(0,X.useRef)(lt),[ft,pt]=(0,X.useState)(!1),[mt,ht]=(0,X.useState)(),gt=async(e,r)=>{bC(ct,null),T_(),r||dC(a),dt.current=null,ut(null),await n.invalidateQueries({queryKey:m_()}),e.outcome===`cancelled`&&Y(`The original schedule was already cancelled.`),t(e.outcome===`launched`&&e.runIds[0]?`/tasks/${e.runIds[0]}`:`/`)},_t=async(e,t=!1)=>{let n=dt.current!==null;dt.current=e,bC(ct,e);let r;try{r=await je(e)}catch(t){throw!n&&t instanceof sn&&(t.status===400||t.status===409&&(t.message===`Settings or reset time changed. Check the preview again.`||t.message===`Automations are off — this cockpit was started with CEZ_AUTOMATIONS=0`))?(bC(ct,null),dt.current=null,ut(null),tt(e=>e&&{start:e.start,invalidated:t.message})):ut(e),t}await gt(r.scheduled,t)},vt=async()=>{if(!(!dt.current||ft)){pt(!0),ht(void 0);try{await _t(dt.current,!0)}catch(e){ht(e instanceof Error?e.message:String(e))}finally{pt(!1)}}},yt=(e,t)=>vu({task:e.trim(),source:ne,model:ve,reasoningEffort:ye,modelsLocked:ge,runner:L??I??`claude`,runnerExplicit:v.runner!==null,agentProfile:Ce,defaultRunner:I,variants:De,images:t,worktree:We,newBranch:v.newBranch,branch:v.branchName,autonomous:Ge,generateFollowups:qe,todoId:s.todo,dispatch:Ae,readOnly:Ue,inPlaceByDefault:P}),bt=x.length?`Remove attachments to schedule this task.`:s.todo?`Tasks linked to a todo can only start now.`:c.data?.capabilities?.automations===!0?void 0:`Scheduling is disabled on this server.`,xt=yt(v.text,x),St=!bt&&!!et?.preview&&Date.parse(et.preview.notBefore)>Date.now()&&et.settingsKey===aS(xt),wt=mS({task:xt,value:et,onChange:tt,disabledReason:bt,onBlockedChange:rt,onLabelChange:at,open:ot,onOpenChange:st}),[Tt,Dt]=(0,X.useState)(!1),Ot=()=>{Dt(!0),st(!0)},kt=async(e,r)=>{if(dt.current)throw Error(`Recover the original schedule before starting another task.`);if(!pe||L===null)throw Error(ce.isPending?`Checking agent providers…`:ce.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`);if(we.blocked!==null){let e=await we.verify();if(e!==null)throw Error(e)}if(!N)throw Error(`Still loading workflows and skills — try again in a second.`);let i=yt(e,r);if(et){if(bt||!et.preview||Date.parse(et.preview.notBefore)<=Date.now()||et.settingsKey!==aS(i))throw Error(`Check the start time again after changing the task settings.`);await _t({task:i,start:et.start,previewRevision:et.preview.previewRevision,idempotencyKey:crypto.randomUUID()}),yl(et.start.kind===`at`?`at`:`usage_reset`);return}let o=await he(i);Tl(`new_task`),En({lastTask:ne,...ne?{recentSources:xu(C,ne)}:{},...Ke?{lastGenerateFollowups:qe}:{},...ne?.source===`skill`&&f.data!==void 0?{skillUsage:zo(f.data.skillUsage,ne.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:z.uiState})).catch(()=>{}),dC(a),n.invalidateQueries({queryKey:z.runs.all}),t(au(o))},At=k.find(e=>e.id===(r??o.data?.bootProject))?.name??xC(c.data?.repoRoot??d.data?.info?.root)??r??`this project`,jt=d.data?.info?d.data.baseBranch??d.data.info.branch:void 0,Nt=le.length>1||le.some(e=>Cu(xe,e)),Pt=_e.find(e=>e.id===ve)?.label??`auto`,Ft=(0,Z.jsxs)(`span`,{"data-slot":`engine-pill`,className:`inline-flex min-w-0 max-w-full items-center`,children:[Nt?(0,Z.jsx)(Du,{runners:le,value:fe,accounts:xe,account:Ce,repoAccount:Se,className:Ou,onPick:(e,t)=>b({runner:e,agentProfile:t,...e===fe?{}:{model:null,reasoningEffort:null}}),disabled:!pe}):null,(0,Z.jsx)(ku,{slot:`model-pill`,ariaLabel:`Model`,label:Nt?Pt:`${fe} · ${Pt}`,value:ve,disabled:!pe,readOnly:ge,className:Nt?Eu:Tu,hint:Pt,disabledHint:ge?`Model selection is locked to native coding-agent settings.`:void 0,onPick:e=>b({model:e,reasoningEffort:null}),options:_e.map(e=>({value:e.id,label:e.label,desc:e.desc})),searchPlaceholder:`Search models…`,status:gu(fe,me.data,me.isError)})]}),It=(0,Z.jsx)(qS,{source:ne,ready:N,skills:D,skillUsage:T,workflows:O,onPick:e=>b({source:e})}),Lt=xe.filter(e=>e.provider===fe),zt=Ce??Se?.[fe]??`default`,Bt=L!==null&&Au(fe,ve,be),Vt=Oe&&(!Ue||ke),Ut=tC({variants:De,autonomous:Ge,defaultAutonomous:He.autonomous,worktree:We,defaultWorktree:He.worktree,isolationChoosable:Ee&&!Ue&&!ze,dispatch:Me,effort:Bt&&v.reasoningEffort?ye:null}),Wt=[{id:`source`,label:`Skill · workflow`,control:It},{id:`variants`,label:`Variants`,control:(0,Z.jsx)(ku,{slot:`variants-pill`,ariaLabel:`Parallel variants`,label:De>1?`×${De} variants`:`×1`,value:String(De),onPick:e=>b({variants:Number(e)}),disabled:!Ee,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`}]})},{id:`engine`,label:`Agent · model`,control:Ft},...Bt?[{id:`effort`,label:`Effort`,control:(0,Z.jsx)(ju,{runner:fe,model:ve,value:ye,options:be,disabled:!pe,modelsLocked:ge,onPick:e=>b({reasoningEffort:e||null}),bare:!0})}]:[],...Lt.length>1?[{id:`account`,label:`Account`,control:(0,Z.jsx)(ku,{slot:`account-pill`,ariaLabel:`Account`,label:Lt.find(e=>e.id===zt)?.label??zt,value:zt,disabled:!pe,hint:`Which login of this agent runs the task`,onPick:e=>b({agentProfile:e}),options:Lt.map(e=>({value:e.id,label:e.label,desc:e.configDir}))})}]:[],...Vt?[{id:`isolation`,label:`Isolation`,wide:!0,control:(0,Z.jsxs)(Z.Fragment,{children:[Ue?null:(0,Z.jsx)(ku,{slot:`isolation-pill`,ariaLabel:`Isolation`,label:We?`worktree`:`in place`,value:We?`worktree`:`in-place`,disabled:ze,hint:`Where the agent works: an isolated worktree on its own branch, or the repo working tree`,disabledHint:Me?`Dispatch forks this task's commits — subtasks need a worktree`:`Parallel variants always use isolated worktrees`,onPick:e=>b({worktree:e===`worktree`,worktreeBasis:g.data?.taskWorkspace??`default`}),options:[{value:`worktree`,label:`worktree`,desc:`An isolated worktree on its own branch — review everything before it lands`},{value:`in-place`,label:`in place`,desc:`The repo working tree — your checkout is modified directly`}]}),!We&&!Ue?(0,Z.jsx)(wC,{on:v.newBranch===!0,name:v.branchName??``,onChange:e=>b({newBranch:e}),onNameChange:e=>b({branchName:e})}):null,(0,Z.jsx)(kS,{available:ke,value:Ae,onChange:Re,onSettingsOpenChange:Ie,runners:le,parentRunner:fe,parentModels:_e})]})}]:[],{id:`mode`,label:`Mode`,control:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ku,{slot:`mode-pill`,ariaLabel:`Mode`,label:Ge?`autonomous`:`supervised`,value:Ge?`autonomous`:`supervised`,hint:`Whether the agent pauses for you or runs to completion on its own`,onPick:e=>b({autonomous:e===`autonomous`}),options:[{value:`supervised`,label:`supervised`,desc:`Pauses when the agent needs you — nothing lands without your review`},{value:`autonomous`,label:`autonomous`,desc:`Runs to completion without pausing for you`}]}),ee?(0,Z.jsx)(CC,{on:Ue,auto:v.readOnly===void 0,onChange:e=>b({readOnly:e})}):null]})},...Ke?[{id:`followups`,label:`Follow-ups`,control:(0,Z.jsx)(TC,{on:qe,onChange:e=>b({generateFollowups:e})})}]:[],...d.data?.info?[{id:`base`,label:`Base branch`,control:(0,Z.jsx)(OC,{repo:d.data})}]:[],{id:`start`,label:`Start`,control:(0,Z.jsx)(hS,{state:wt,trigger:`chip`})}];return Je?(0,Z.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,Z.jsx)($l,{}),(0,Z.jsxs)(`div`,{"data-slot":`auto-starting`,role:`status`,className:`text-center`,children:[(0,Z.jsx)(`h1`,{className:`animate-pulse text-lg font-semibold tracking-tight`,children:`Starting task…`}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-ui text-muted-foreground`,children:`Launched from a bookmarklet — taking you to the run.`})]})]}):(0,Z.jsx)(`div`,{"data-route":`new`,"data-onboarding":``,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,Z.jsxs)(`div`,{ref:h,className:`relative w-full max-w-[720px]`,children:[(0,Z.jsxs)(`header`,{className:`mb-7 text-center max-md:mb-5`,children:[(0,Z.jsx)(`h1`,{className:`text-4xl font-light tracking-tight text-balance text-foreground max-md:text-3xl`,children:`What should the agent work on?`}),(0,Z.jsx)(`p`,{"data-slot":`run-mode-note`,className:`mx-auto mt-3 max-w-md text-lead text-muted-foreground max-md:text-ui`,children:eC({worktree:We,hasGit:Ee,dispatch:Me,autonomous:Ge,newBranch:v.newBranch,readOnly:Ue,variants:De,autoLand:g.data?.landing===`auto`&&g.data.landingBlocked===null})})]}),lt&&(0,Z.jsxs)(`div`,{role:`alert`,className:`mb-4 rounded-lg border p-4 text-sm`,children:[(0,Z.jsx)(`p`,{children:`The original task may already be scheduled. Recover it before starting another task.`}),(0,Z.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap`,children:lt.task.task}),(0,Z.jsx)(`p`,{className:`mt-2`,children:`Recovery uses the original prompt, settings and start time. Your current edits will not be submitted. If scheduling is disabled, restore it on the server and retry recovery; the original request is kept to prevent duplicates. Once recovered, you can manage the task in Scheduled.`}),(0,Z.jsx)(`button`,{type:`button`,className:`mt-3 underline`,disabled:ft,onClick:()=>void vt(),children:ft?`Recovering original schedule…`:`Recover original schedule`})]}),mt&&(0,Z.jsx)(`p`,{role:`alert`,className:`mb-3 text-sm`,children:mt}),(0,Z.jsx)(Yo,{ref:ie,onSubmit:kt,value:v.text,onValueChange:e=>b({text:e}),images:x,onImagesChange:S,autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:et?`Schedule task`:`Start task`,sendLabel:et?`Schedule task`:`Start`,submitDisabled:!!lt||ft||!N||!!et&&!St,disabled:!pe,disabledReason:ce.isPending?`Checking agent providers…`:ce.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,autocompleteSkills:!0,sendShortcut:`↵`,options:{eyebrow:`Options · remembered for ${At}`,rows:Wt,open:Tt,onOpenChange:e=>{Dt(e),e||st(!1)},onOpenAutoFocus:e=>{ot&&e.preventDefault()},onReset:()=>{fC(a),y(lC(a)),tt(null)},summary:Ut},footerStart:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Jx,{templates:F,iconOnly:!0,onInsert:e=>ie.current?.insertAtCaret(e)}),k.length>1&&r!==void 0?(0,Z.jsx)(DC,{projects:k,projectId:r,base:jt,onPick:e=>{let n=gC(a,j(e));!n.moved&&n.reason===`destination-busy`&&Y(`Kept your draft in ${k.find(e=>e.id===(a??o.data?.bootProject))?.name??r}; ${k.find(t=>t.id===e)?.name??e} already has an unsent draft.`,{tone:`danger`}),t(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}}):(0,Z.jsxs)(`span`,{"data-slot":`project-chip`,title:`Which project this task runs in — and the branch its worktree forks from`,className:H(nu,`cursor-default hover:bg-card hover:text-muted-foreground`),children:[(0,Z.jsx)(ad,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,Z.jsxs)(`span`,{className:`max-w-48 truncate`,children:[At,jt?` · from ${jt}`:``]})]}),It,Ft]}),footerEnd:(0,Z.jsxs)(Z.Fragment,{children:[et&&it&&!nt?(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`schedule-summary`,title:it.title,onClick:Ot,className:`flex max-w-[16rem] items-center gap-1 truncate rounded-md px-1.5 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,Z.jsx)(Ju,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:it.text})]}):null,et&&nt?(0,Z.jsx)(`span`,{role:`status`,"data-slot":`schedule-blocked`,title:nt,className:`max-w-[16rem] truncate text-xs text-muted-foreground`,children:nt}):null,!pe&&!ce.isPending?(0,Z.jsx)(G,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null]})}),re?.interactive&&(v.autonomous===null||v.worktree===null)?(0,Z.jsx)(`p`,{"data-slot":`interactive-skill-hint`,className:`mt-2 px-1 text-label text-muted-foreground`,children:`This skill recommends an interactive run in the current checkout. You can change either setting in Options.`}):null,we.blocked===null?null:(0,Z.jsxs)(`p`,{"data-slot":`account-signed-out`,role:`alert`,className:`mt-2 rounded-md border border-destructive/30 bg-destructive/[0.07] px-3 py-1.5 text-xs text-muted-foreground`,children:[we.blocked,` `,(0,Z.jsx)(U,{to:`/settings/global/accounts`,className:`font-medium text-foreground underline underline-offset-2`,children:`Agent accounts`})]}),Me&&(Fe||Ne)?(0,Z.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,Z.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,Z.jsx)(SS,{anchorRoot:h,ready:pe&&N&&!lt,loaded:p.data!==void 0,seen:p.data?.onboarding?.composerTipsSeen,off:p.data?.onboarding?.composerTipsOff,onSeen:e=>m(t=>({composerTipsSeen:yS(t?.composerTipsSeen,e)})),onOff:e=>m({composerTipsOff:e})}),(0,Z.jsx)(AC,{onPick:e=>b({text:e})})]})})}function CC({on:e,auto:t,onChange:n}){return(0,Z.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"data-slot":`ask-toggle`,onClick:()=>n(!e),title:e?`Read-only question — answers from the checkout, changes nothing${t?` (picked because the message is a question)`:``}`:`Check to ask a read-only question instead of filing a change`,className:H(nu,e&&`border-primary/60 text-foreground`),children:[e?(0,Z.jsx)(Wa,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,Z.jsx)(as,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Ask`]})}function wC({on:e,name:t,onChange:n,onNameChange:r}){return(0,Z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Z.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"data-slot":`new-branch-toggle`,onClick:()=>n(!e),title:e?`Switches the repo checkout to a new branch from the base before the agent starts`:`Runs on whatever branch is checked out — check to start a new branch from the base`,className:H(nu,e&&`border-primary/60 text-foreground`),children:[e?(0,Z.jsx)(Wa,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,Z.jsx)(as,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`New branch`]}),e?(0,Z.jsx)(`input`,{"aria-label":`New branch name`,"data-slot":`new-branch-name`,value:t,placeholder:`feat/… (auto)`,onChange:e=>r(e.target.value),className:`h-6 w-36 rounded-md border border-input bg-card px-2 font-mono text-meta outline-none focus-visible:border-ring`}):null]})}function TC({on:e,onChange:t}){return(0,Z.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:H(nu,e&&`border-primary/60 text-foreground`),children:[e?(0,Z.jsx)(Wa,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,Z.jsx)(as,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Follow-ups`]})}function EC(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 DC({projects:e,projectId:t,base:n,onPick:r}){let[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),c=e.find(e=>e.id===t),l=EC(e,o);return(0,Z.jsxs)(Ts,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(vs,{asChild:!0,children:(0,Z.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:H(nu,`border-foreground/60 text-foreground`),children:[(0,Z.jsx)(ad,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,Z.jsxs)(`span`,{className:`max-w-48 truncate`,children:[c?.name??t,n?` · from ${n}`:``]}),tu]})}),(0,Z.jsx)(Cs,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(ql,{shouldFilter:!1,children:[(0,Z.jsx)(zl,{placeholder:`search projects…`,value:o,onValueChange:s}),(0,Z.jsxs)(Kl,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,Z.jsx)(Gl,{children:`Nothing matches.`}):null,l.map(e=>(0,Z.jsxs)(Wl,{value:e.id,keywords:[e.name],"data-slot":`project-option`,"data-project-id":e.id,disabled:e.status===`missing`,onSelect:()=>{r(e.id),a(!1)},children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,Z.jsx)(`span`,{className:`shrink-0 text-meta text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-meta text-soft-foreground`,children:e.branch}),e.id===t?(0,Z.jsx)(Wa,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id))]}),(0,Z.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-meta leading-snug text-soft-foreground`,children:`Skills, workflows, settings and the draft re-resolve against the selected project.`})]})})]})}function OC({repo:e}){let t=V(),n=B({mutationFn:e=>Sn({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:z.repo}),Y(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=>Y(e.message,{tone:`danger`})});return e.info?(0,Z.jsx)(ku,{slot:`base-pill`,ariaLabel:`Base branch`,label:(0,Z.jsx)(`span`,{className:`font-mono text-meta`,children: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 kC=[{icon:rd,label:`Fix a failing test`,task:`Fix a failing or flaky test`},{icon:Ao,label:`Summarize recent commits`,task:`Summarize recent commits on this branch`},{icon:wo,label:`Update the README`,task:`Update the README for recent changes`}];function AC({onPick:e}){return(0,Z.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2 max-md:justify-start`,children:kC.map(({icon:t,label:n,task:r})=>(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`suggested-chip`,onClick:()=>e(r),className:My,children:[(0,Z.jsx)(t,{"aria-hidden":`true`,className:`size-3.5`}),n]},n))})}function jC(){return(0,Z.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(eu,{icon:(0,Z.jsx)(Qu,{}),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,Z.jsx)(q,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(G,{to:`/tasks`,children:`Back to tasks`})})})})}function MC(){return(0,Z.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(eu,{icon:(0,Z.jsx)(Mo,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})})}function NC(){return(0,Z.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,Z.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,Z.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,Z.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,Z.jsx)(`p`,{"data-slot":`skills-loading`,className:`px-4 py-6 text-center text-label text-muted-foreground md:px-6`,children:`Loading skills…`})]})}function PC({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,Z.jsx)(`div`,{"data-route":`unknown-project`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(eu,{icon:(0,Z.jsx)(sd,{}),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,Z.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,Z.jsx)(`li`,{children:(0,Z.jsxs)(U,{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,Z.jsxs)(`span`,{className:`font-mono text-meta font-normal text-soft-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function FC(){return(0,Z.jsx)(`div`,{"data-route":`workflows`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(eu,{icon:(0,Z.jsx)(Mo,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading workflows…`,subtitle:`Fetching the saved workflows and the node catalog.`})})}var IC=1500;function LC(e,t){let n=(0,X.useMemo)(()=>e.split(`
7
7
  `).map(e=>[{content:e}]),[e]),r=(0,X.useMemo)(()=>Pu(t),[t]),i=n.length>IC,[a,o]=(0,X.useState)(null);return(0,X.useEffect)(()=>{if(r===null||i)return;let t=!1;return Mu(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:Nu(e,r)?.tokens??n}var RC=`m-0 min-h-full w-full whitespace-pre font-mono text-xs leading-[1.7] px-3 py-2 [tab-size:2]`;function zC({value:e,onChange:t,language:n,readOnly:r,className:i,...a}){let o=LC(e,n),s=(0,X.useRef)(null),c=(0,X.useRef)(null),l=()=>{let e=c.current,t=s.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,X.useLayoutEffect)(l,[e]),(0,Z.jsxs)(`div`,{"data-slot":`code-editor`,className:H(`relative overflow-hidden rounded-md border border-input bg-card`,i),children:[(0,Z.jsx)(`pre`,{ref:s,"aria-hidden":`true`,className:H(RC,`pointer-events-none absolute inset-0 overflow-auto text-soft-foreground`),children:o.map((e,t)=>(0,Z.jsx)(`span`,{className:`block`,children:e.length===0?`
@@ -29,4 +29,4 @@ $ git commit -m "Initial commit"`}),r.error?(0,Z.jsx)(`p`,{role:`alert`,classNam
29
29
  `).map(e=>e.trim()).filter(Boolean);e.join(`
30
30
  `)!==n&&t.mutate({requiredChecks:e.length?e:null})};return(0,Z.jsx)($,{stacked:!0,saved:t.savedFor(`requiredChecks`),htmlFor:`tasks-required-checks`,label:`Required checks`,description:`Shell commands, one per line, run in the checkout before every auto-land (e.g. npm test). A failure goes back to the agent with its output. Saves when you leave the field or press ⌘↵.`,children:(0,Z.jsx)(cs,{id:`tasks-required-checks`,"data-slot":`tasks-required-checks`,value:r,rows:3,spellCheck:!1,placeholder:`npm test`,disabled:t.isPending,onChange:e=>i(e.target.value),onBlur:a,onKeyDown:e=>{cw(e,!0)&&(e.preventDefault(),a())},className:`max-w-xl font-mono text-ui`})})}var bD=`__follow__`;function xD(){let e=Rn();return e.isPending?(0,Z.jsx)(cl,{label:`Loading task settings…`,"data-slot":`tasks-loading`,children:(0,Z.jsx)(pl,{})}):e.isError?(0,Z.jsx)(eu,{icon:(0,Z.jsx)(gd,{}),tone:`danger`,title:`Task settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Z.jsx)(SD,{config:e.data})}function SD({config:e}){let t=_n(),n=Pw();return(0,Z.jsxs)(`div`,{"data-slot":`tasks-section`,className:`flex w-full flex-col gap-5`,children:[(0,Z.jsx)(_D,{config:e,children:(0,Z.jsx)($,{saved:n.savedFor(`baseBranch`),label:`Base branch`,description:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:t.data?.info?(0,Z.jsxs)(Za,{value:e.baseBranch??bD,disabled:n.isPending,onValueChange:e=>n.mutate({baseBranch:e===bD?null:e}),children:[(0,Z.jsx)(Ya,{size:`sm`,"aria-label":`Base branch`,"data-slot":`tasks-base-branch`,"data-value":e.baseBranch??``,className:`w-56 font-mono text-ui`,children:(0,Z.jsx)(Xa,{})}),(0,Z.jsxs)(Ja,{position:`popper`,children:[(0,Z.jsx)(J,{value:bD,className:`font-sans`,children:`Follow the checked-out branch`}),t.data.branches.map(e=>(0,Z.jsx)(J,{value:e,className:`font-mono text-ui`,children:e},e))]})]}):(0,Z.jsx)(`p`,{"data-slot":`tasks-base-branch-unavailable`,className:`text-ui text-muted-foreground`,children:t.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})}),(0,Z.jsxs)(Q,{id:`review`,title:`Review and titles`,children:[(0,Z.jsx)($,{saved:n.savedFor(`reviewGate`),htmlFor:`tasks-review-gate`,label:`Review changes before finishing`,description:`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.${e.reviewGate===null?` Default: off — tasks finish without asking.`:``}`,children:(0,Z.jsx)(mo,{id:`tasks-review-gate`,"aria-label":`Review changes before finishing`,"data-slot":`tasks-review-gate`,checked:e.reviewGate??!1,disabled:n.isPending,onCheckedChange:e=>n.mutate({reviewGate:e})})}),(0,Z.jsx)($,{saved:n.savedFor(`liveTitleUpdates`),htmlFor:`tasks-live-title-updates`,label:`Live title updates`,description:`Rename a task once through the namer model after its first turn, then keep that title. A manual rename always wins.${e.liveTitleUpdates===null?` Default: on.`:``}`,children:(0,Z.jsx)(mo,{id:`tasks-live-title-updates`,"aria-label":`Live title updates`,"data-slot":`tasks-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:n.isPending,onCheckedChange:e=>n.mutate({liveTitleUpdates:e})})})]})]})}function CD(){let e=Pt(),t=qr(),n=Rn(),[r,i]=(0,X.useState)(null),a=t.data?.worktrees??[],o=!!n.data?.worktreeLifecycle&&(n.data.worktreeLifecycle.afterCreate.length>0||n.data.worktreeLifecycle.beforeRemove.length>0),s=V(),[c,l]=(0,X.useState)(null),u=async()=>{await Promise.all([s.invalidateQueries({queryKey:z.worktrees}),s.invalidateQueries({queryKey:Jr.all()})])},d=B({mutationFn:()=>an(),onSuccess:e=>{u(),Y(e.reclaimed.length===0?o||a.some(e=>e.operation||e.autoCleanupSuppressed)?`No worktrees reclaimed yet. Pending cleanup or retained worktrees may keep usage above the limit.`:`Nothing to reclaim — all worktrees are within the limit`:`Reclaimed ${e.reclaimed.length} worktree${e.reclaimed.length===1?``:`s`} (branch kept)`)},onError:e=>Y(e.message,{tone:`danger`})}),f=B({mutationFn:async e=>o||a.some(t=>t.runId===e)?P({requestId:crypto.randomUUID(),runId:e,intent:`remove-worktree`}):zn(e),onSuccess:(t,n)=>{u(),`operation`in t?(i({id:t.operation.id,title:e.data?.worktrees.find(e=>e.runId===n)?.title??n}),Y(`Cleanup requested. The worktree remains until cleanup and removal complete.`)):Y(`Worktree removed`)},onError:e=>Y(e.message,{tone:`danger`})}),p=B({mutationFn:e=>P({requestId:crypto.randomUUID(),worktreeId:e,intent:`orphan`}),onSuccess:e=>{i({id:e.operation.id,title:`Orphan worktree`}),u(),Y(`Orphan cleanup requested. Review its progress below.`)},onError:e=>Y(e.message,{tone:`danger`})});if(e.isPending)return(0,Z.jsx)(cl,{label:`Loading worktrees…`,"data-slot":`worktrees-loading`,children:(0,Z.jsx)(sl,{rows:3})});if(e.isError)return(0,Z.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-ui text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:m,totalBytes:h,keep:g}=e.data,_=d.isPending||f.isPending||p.isPending;return(0,Z.jsxs)(`div`,{"data-slot":`worktrees-panel`,className:`flex flex-col gap-3`,children:[m.length===0?(0,Z.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`text-ui text-muted-foreground`,children:`No task worktrees on disk.`}):(0,Z.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,Z.jsxs)(`table`,{className:`w-full border-collapse text-ui`,children:[(0,Z.jsx)(`caption`,{className:`sr-only`,children:`Task worktrees currently materialized on disk`}),(0,Z.jsx)(`thead`,{children:(0,Z.jsxs)(`tr`,{className:`border-b border-border text-left text-label text-soft-foreground`,children:[(0,Z.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Task`}),(0,Z.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,Z.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Size`}),(0,Z.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Age`}),(0,Z.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,Z.jsx)(`tbody`,{children:m.map(e=>(0,Z.jsx)(wD,{worktree:e,lifecycle:a.find(t=>t.runId===e.runId),disabled:_||!!a.find(t=>t.runId===e.runId)?.operation,onDelete:()=>l({kind:`delete`,runId:e.runId,title:e.title})},e.runId))})]})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsxs)(`p`,{"data-slot":`worktrees-footer`,className:`text-label text-muted-foreground`,children:[m.length,` worktree`,m.length===1?``:`s`,h===null?` · size unavailable`:` · ${v(h)||`0 kB`} on disk`,` · `,g===0?`keeping all (unlimited)`:`keeping the last ${g}`]}),(0,Z.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,"data-action":`worktrees-reclaim-now`,disabled:_,onClick:()=>l({kind:`reclaim`}),children:`Reclaim now`})]}),t.isError&&(0,Z.jsxs)(`p`,{className:`text-label text-danger`,role:`alert`,children:[`Lifecycle state could not be loaded: `,t.error.message]}),a.filter(e=>e.operation||e.autoCleanupSuppressed||e.needsAttention||!e.task).map(e=>(0,Z.jsxs)(`section`,{className:`min-w-0 rounded-md border border-border p-3`,"data-slot":`lifecycle-worktree-row`,children:[(0,Z.jsx)(`h3`,{className:`text-ui font-medium`,children:e.task?.title??`Orphan worktree ${e.runId.slice(0,8)}`}),(0,Z.jsx)(`p`,{className:`break-all font-mono text-meta text-muted-foreground`,children:e.worktreePath}),e.error&&(0,Z.jsx)(`p`,{className:`mt-1 text-label text-danger`,children:e.error}),e.needsAttention&&(0,Z.jsxs)(`p`,{className:`mt-1 text-label text-danger`,children:[e.operation?.phase===`setup`?`Setup needs attention`:`Cleanup needs attention`,` — worktree retained.`]}),e.autoCleanupSuppressed&&(0,Z.jsx)(`p`,{className:`mt-1 text-label text-muted-foreground`,children:`Automatic cleanup is suppressed for this generation because it was kept or cancelled. Explicit removal is still available.`}),e.operation?(0,Z.jsx)(`div`,{id:`lifecycle-operation-${e.operation.id}`,className:`mt-3 scroll-mt-4`,children:(0,Z.jsx)(va,{operationId:e.operation.id,worktreePath:e.worktreePath,taskTitle:e.task?.title})}):!e.task&&!e.error&&e.onDisk?(0,Z.jsx)(q,{className:`mt-2`,type:`button`,variant:`outline`,size:`sm`,disabled:_,onClick:()=>l({kind:`orphan`,worktreeId:e.worktreeId,title:e.worktreePath}),children:`Remove orphan worktree`}):null]},e.worktreeId)),r&&!a.some(e=>e.operation?.id===r.id)&&(0,Z.jsx)(`div`,{id:`lifecycle-operation-${r.id}`,children:(0,Z.jsx)(va,{operationId:r.id,taskTitle:r.title})}),(0,Z.jsx)(Gc,{open:c!==null,onOpenChange:e=>!e&&l(null),children:(0,Z.jsxs)(Bc,{children:[(0,Z.jsxs)(Wc,{children:[(0,Z.jsx)(zc,{children:c?.kind===`delete`||c?.kind===`orphan`?`Delete this worktree?`:`Reclaim old worktrees?`}),(0,Z.jsx)(Rc,{children:c?.kind===`delete`||c?.kind===`orphan`?(0,Z.jsxs)(Z.Fragment,{children:[`This deletes the worktree directory and its branch — local-only work is gone and this cannot be undone. Configured cleanup scripts run first; failures retain the directory for your recovery choice.`,(0,Z.jsx)(`span`,{className:`mt-1 block break-all font-medium text-foreground`,children:c.title})]}):`Finished worktrees beyond the keep-limit are reclaimed now (directory only). Their branches are kept, so the work stays recoverable.`})]}),(0,Z.jsxs)(Hc,{children:[(0,Z.jsx)(Uc,{children:`Keep it`}),(0,Z.jsx)(Vc,{"data-action":`worktrees-confirm`,className:c?.kind===`delete`||c?.kind===`orphan`?Ka({variant:`destructive`}):void 0,onClick:()=>{c?.kind===`reclaim`?d.mutate():c?.kind===`delete`?f.mutate(c.runId):c?.kind===`orphan`&&p.mutate(c.worktreeId),l(null)},children:c?.kind===`delete`||c?.kind===`orphan`?`Delete`:`Reclaim now`})]})]})})]})}function wD({worktree:e,lifecycle:t,disabled:n,onDelete:r}){let i=s({status:e.status}),a=i.bucket===`none`,o=(0,Z.jsx)(q,{type:`button`,variant:`ghost`,size:`xs`,"data-action":`worktree-delete`,"aria-label":`Delete the worktree for ${e.title}`,disabled:n||!!e.inUse,onClick:r,children:`Delete`});return(0,Z.jsxs)(`tr`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`border-b border-border last:border-0`,children:[(0,Z.jsxs)(`th`,{scope:`row`,className:`max-w-[220px] px-3 py-2 text-left font-normal`,children:[(0,Z.jsx)(`span`,{className:`block truncate text-foreground`,children:e.title}),(0,Z.jsx)(`span`,{className:`block truncate font-mono text-meta text-soft-foreground`,children:e.branch??e.runId.slice(0,8)})]}),(0,Z.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,Z.jsxs)(`span`,{"data-slot":`worktree-status`,"data-tone":a?void 0:i.tone,className:`inline-flex items-center gap-1.5 text-label text-muted-foreground`,children:[a?null:(0,Z.jsx)(Pl,{tone:i.tone,pulse:i.pulse}),e.status]}),t?.needsAttention&&(0,Z.jsx)(`span`,{className:`block text-meta text-danger`,children:t.operation?.phase===`setup`?`Setup needs attention`:`Cleanup needs attention`}),t?.autoCleanupSuppressed&&(0,Z.jsx)(`span`,{className:`block text-meta text-muted-foreground`,children:`Automatic cleanup suppressed`}),e.inUse?(0,Z.jsxs)(`span`,{"data-slot":`worktree-in-use`,className:`block text-meta text-muted-foreground`,children:[`Protected — `,e.inUse]}):null,e.reclaimable&&!t?.autoCleanupSuppressed?(0,Z.jsx)(`span`,{"data-slot":`worktree-reclaimable`,className:`ml-1 text-meta text-soft-foreground`,children:`(reclaimable)`}):null]}),(0,Z.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:e.sizeBytes===null?`—`:v(e.sizeBytes)||`0 kB`}),(0,Z.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:Ml(e.finishedAt??void 0)||`—`}),(0,Z.jsx)(`td`,{className:`px-3 py-2 text-right`,children:e.inUse?(0,Z.jsx)(el,{label:`Protected — ${e.inUse}`,children:(0,Z.jsx)(`span`,{className:`inline-flex`,children:o})}):o})]})}var TD=()=>({afterCreate:[],beforeRemove:[]}),ED=[`afterCreate`,`beforeRemove`],DD={afterCreate:`After worktree creation`,beforeRemove:`Before worktree removal`},OD={afterCreate:`Run after a worktree is created and before its agent starts, including recreation after reclamation.`,beforeRemove:`Run while the worktree files still exist, before removal or reclamation. Failure retains the directory for recovery.`},kD=[[`root_path`,`The selected project’s root directory`],[`worktree_path`,`The isolated worktree directory`],[`worktree_id`,`Stable cez-prefixed resource identity`],[`task_id`,`The original task ID`]],AD=`__example__`,jD=1,MD=86400,ND=1800;function PD({config:e}){let t=V(),n=z.config,r=(0,X.useRef)(!0);(0,X.useEffect)(()=>(r.current=!0,()=>{r.current=!1}),[]);let i=qr(),[a,o]=(0,X.useState)(e.worktreeLifecycle??TD()),[s,c]=(0,X.useState)(e.worktreeLifecycle??TD()),[l,u]=(0,X.useState)(e.worktreeLifecycleRevision??null),[d,f]=(0,X.useState)({}),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(``),[_,v]=(0,X.useState)({}),[y,b]=(0,X.useState)(null),x=(0,X.useRef)(new Map),S=(0,X.useRef)({draft:a,previewWorktree:h});S.current={draft:a,previewWorktree:h};let C=JSON.stringify(a)!==JSON.stringify(s);(0,X.useEffect)(()=>{if(C)return;let t=e.worktreeLifecycle??TD();o(t),c(t),u(e.worktreeLifecycleRevision??null)},[e.worktreeLifecycle,e.worktreeLifecycleRevision,C]);let w=(e,t,n)=>{o(r=>({...r,[e]:r[e].map(e=>e.id===t?{...e,...n}:e)})),f(e=>({...e,[t]:``})),m(``),v(e=>{let n={...e};return delete n[t],n})},T=(e,t,n)=>{let r=x.current.get(t.id),i=r?.selectionStart??t.command.length,a=r?.selectionEnd??i,o=`{{ ${n} }}`;w(e,t.id,{command:t.command.slice(0,i)+o+t.command.slice(a)}),requestAnimationFrame(()=>{r?.focus(),r?.setSelectionRange(i+o.length,i+o.length)})},E=(e,t,n)=>{o(r=>{let i=[...r[e]],a=i.splice(t,1)[0];return i.splice(t+n,0,a),{...r,[e]:i}}),m(``)},D=async e=>{b(e.id);try{let t=await Ot({command:e.command,...h?{worktreeId:h}:{}}),n=ED.flatMap(e=>S.current.draft[e]).find(t=>t.id===e.id);if(!r.current||n?.command!==e.command||S.current.previewWorktree!==h)return;v(n=>({...n,[e.id]:t})),f(t=>({...t,[e.id]:``}))}catch(t){f(n=>({...n,[e.id]:t instanceof Error?t.message:`Preview failed`}))}finally{b(null)}},O=B({mutationFn:async()=>{f({}),m(``);let e=ir.safeParse(a);if(!e.success){let t={};for(let n of e.error.issues){let e=n.path[0],r=typeof n.path[1]==`number`?a[e]?.[n.path[1]]?.id:void 0;t[r??`form`]=n.message}throw f(t),Error(`Check the highlighted commands before saving.`)}for(let t of ED)for(let n of e.data[t]){if(!r.current)throw Error(`Settings closed; saving cancelled.`);try{await Ot({command:n.command})}catch(e){throw f({[n.id]:e instanceof Error?e.message:`Invalid template`}),Error(`Check the highlighted command before saving.`)}}if(!r.current)throw Error(`Settings closed; saving cancelled.`);return Sn({worktreeLifecycle:e.data,worktreeLifecycleRevision:l})},onSuccess:e=>{let r=e.worktreeLifecycle??TD();c(r),o(r),u(e.worktreeLifecycleRevision??null),t.setQueryData(n,e),m(`Saved. Retry uses these commands. Saving does not restart paused scripts.`)}}),k=async()=>{try{let e=await kn();t.setQueryData(n,e);let r=e.worktreeLifecycle??TD();o(r),c(r),u(e.worktreeLifecycleRevision??null),f({}),v({}),m(`Loaded saved scripts.`),O.reset()}catch(e){f({form:e instanceof Error?e.message:`Settings could not be loaded`})}},A=i.data?.worktrees.filter(e=>e.operation&&e.needsAttention)??[],j=i.data?.worktrees.filter(e=>e.onDisk)??[];return(0,Z.jsxs)(Q,{id:`worktree-lifecycle-scripts`,slot:`worktree-lifecycle-editor`,title:`Lifecycle scripts`,description:`Scripts apply only to this project. Saving commands opts in to running them as the Cezar host user, with that user’s local privileges. Runtime: noninteractive Bash, in the isolated worktree directory — Bash must be installed on the host; commands run in order and the default timeout is 30 minutes.`,children:[(0,Z.jsx)(lw,{children:(0,Z.jsxs)(`span`,{id:`lifecycle-variable-help`,children:[`Values are shell-escaped; do not wrap variable tokens in quotes. Use `,(0,Z.jsx)(`code`,{children:`\\{{`}),` for literal double braces, for example `,(0,Z.jsx)(`code`,{children:`docker inspect --format '\\{{.State.Status}}' container`}),`.`]})}),(0,Z.jsx)($,{label:`Preview context`,description:`Which worktree’s values a Preview renders with. Preview never executes commands.`,children:(0,Z.jsxs)(Za,{value:h||AD,onValueChange:e=>{g(e===AD?``:e),v({})},children:[(0,Z.jsx)(Ya,{size:`sm`,"aria-label":`Preview context`,"data-slot":`lifecycle-preview-context`,"data-value":h,className:`max-w-64`,children:(0,Z.jsx)(Xa,{})}),(0,Z.jsxs)(Ja,{position:`popper`,children:[(0,Z.jsx)(J,{value:AD,children:`Example values (illustrative)`}),j.map(e=>(0,Z.jsx)(J,{value:e.worktreeId,children:e.task?.title??`Orphan ${e.runId.slice(0,8)}`},e.worktreeId))]})]})}),ED.map(e=>(0,Z.jsxs)($,{stacked:!0,label:DD[e],description:OD[e],children:[a[e].length===0&&(0,Z.jsx)(`p`,{className:`text-label text-muted-foreground`,children:`No commands. This phase completes without running a script.`}),a[e].map((t,n)=>(0,Z.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-2 rounded-md border border-border p-3`,disabled:O.isPending,children:[(0,Z.jsxs)(`legend`,{className:`px-1 text-label font-medium`,children:[`Command `,n+1]}),(0,Z.jsx)(`label`,{className:`text-label text-muted-foreground`,htmlFor:`lifecycle-name-${t.id}`,children:`Display name (optional)`}),(0,Z.jsx)(gl,{id:`lifecycle-name-${t.id}`,value:t.name??``,maxLength:120,onChange:n=>w(e,t.id,{name:n.target.value})}),(0,Z.jsxs)(`label`,{className:`text-label text-muted-foreground`,htmlFor:`lifecycle-command-${t.id}`,children:[DD[e],` — command `,n+1]}),(0,Z.jsx)(cs,{id:`lifecycle-command-${t.id}`,ref:e=>{e?x.current.set(t.id,e):x.current.delete(t.id)},className:`min-h-24 resize-y font-mono text-ui`,value:t.command,maxLength:32*1024,spellCheck:!1,"aria-describedby":`lifecycle-variable-help${d[t.id]?` lifecycle-error-${t.id}`:``}`,"aria-invalid":!!d[t.id],onChange:n=>w(e,t.id,{command:n.target.value})}),d[t.id]&&(0,Z.jsx)(`p`,{id:`lifecycle-error-${t.id}`,className:`text-label text-danger`,role:`alert`,children:d[t.id]}),(0,Z.jsxs)(`details`,{className:`text-label`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer py-1`,children:`Variables`}),(0,Z.jsx)(`ul`,{className:`mt-1 space-y-2`,children:kD.map(([r,i])=>(0,Z.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,"aria-label":`Insert ${r} into ${DD[e].toLowerCase()} command ${n+1}`,onClick:()=>T(e,t,r),children:(0,Z.jsx)(`code`,{children:`{{ ${r} }}`})}),(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:i})]},r))})]}),(0,Z.jsxs)(`details`,{className:`text-label`,children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer py-1`,children:`Advanced timeout`}),(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`span`,{id:`lifecycle-timeout-label-${t.id}`,className:`text-muted-foreground`,children:`Timeout in seconds (1–86,400)`}),(0,Z.jsx)(wT,{"aria-label":`Timeout in seconds for ${DD[e].toLowerCase()} command ${n+1}`,"data-slot":`lifecycle-timeout`,value:t.timeoutSeconds??null,min:jD,max:MD,allowEmpty:!0,emptyStepFrom:ND,placeholder:`Default (${ND})`,onCommit:n=>w(e,t.id,{timeoutSeconds:n??void 0})})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,disabled:n===0,"aria-label":`Move ${DD[e].toLowerCase()} command ${n+1} up`,onClick:()=>E(e,n,-1),children:`Move up`}),(0,Z.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,disabled:n===a[e].length-1,"aria-label":`Move ${DD[e].toLowerCase()} command ${n+1} down`,onClick:()=>E(e,n,1),children:`Move down`}),(0,Z.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,disabled:!t.command.trim()||y!==null,"aria-label":`Preview ${DD[e].toLowerCase()} command ${n+1}`,onClick:()=>void D(t),children:y===t.id?`Previewing…`:`Preview`}),(0,Z.jsx)(q,{type:`button`,variant:`danger-ghost`,size:`sm`,"aria-label":`Remove ${DD[e].toLowerCase()} command ${n+1}`,onClick:()=>{o(n=>({...n,[e]:n[e].filter(e=>e.id!==t.id)})),m(``)},children:`Remove`})]}),_[t.id]&&(0,Z.jsxs)(`div`,{className:`min-w-0 rounded-md bg-muted p-2 text-label`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:_[t.id].illustrative?`Example preview — illustrative values`:`Selected worktree preview`}),(0,Z.jsxs)(`p`,{className:`break-all text-muted-foreground`,children:[`Working directory: `,_[t.id].cwd]}),(0,Z.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-all font-mono text-ui`,children:_[t.id].renderedCommand}),(0,Z.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Preview does not execute commands or expand shell expressions.`})]})]},t.id)),(0,Z.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,disabled:a[e].length>=32||O.isPending,onClick:()=>{o(t=>({...t,[e]:[...t[e],{id:crypto.randomUUID(),command:``}]})),m(``)},children:[`Add `,e===`afterCreate`?`setup`:`cleanup`,` command`]})]},e)),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3`,children:[(d.form||O.error)&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-ui text-danger`,children:d.form??O.error?.message}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(q,{type:`button`,size:`sm`,disabled:!C||O.isPending,onClick:()=>O.mutate(),children:O.isPending?`Saving…`:`Save scripts`}),O.isError&&(0,Z.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void k(),children:`Reload saved scripts`}),p&&(0,Z.jsx)(`p`,{role:`status`,className:`text-label text-muted-foreground`,children:p})]}),A.length>0&&(0,Z.jsxs)(`div`,{className:`text-label text-muted-foreground`,children:[(0,Z.jsx)(`p`,{children:`Paused scripts wait for an explicit recovery choice.`}),A.map(e=>(0,Z.jsxs)(`a`,{className:`mt-1 block text-violet underline underline-offset-2`,href:`#lifecycle-operation-${e.operation.id}`,children:[`Return to `,e.task?.title??`orphan worktree`,` and Retry`]},e.worktreeId))]})]})]})}var FD=0,ID=1e3;function LD(){let e=Rn();return e.isPending?(0,Z.jsx)(cl,{label:`Loading worktree settings…`,"data-slot":`worktrees-loading`,children:(0,Z.jsx)(pl,{})}):e.isError?(0,Z.jsx)(eu,{icon:(0,Z.jsx)(id,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Z.jsx)(RD,{config:e.data})}function RD({config:e}){let t=V(),[n,r]=ow(),i=B({mutationFn:e=>Sn(e),onSuccess:e=>{t.setQueryData(z.config,e),t.invalidateQueries({queryKey:z.worktrees}),r()},onError:e=>Y(e.message,{tone:`danger`})}),a=e.worktreeRetention;return(0,Z.jsxs)(`div`,{"data-slot":`worktrees-section`,className:`flex w-full flex-col gap-5`,children:[(0,Z.jsx)(Q,{id:`retention`,title:`Retention`,children:(0,Z.jsx)($,{saved:n,label:`Keep last N worktrees`,description:`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. ${a===0?`Keeping every finished worktree.`:`Keeping the last ${a} finished worktree${a===1?``:`s`} on disk.`}`,children:(0,Z.jsx)(wT,{"aria-label":`Keep last N finished worktrees`,"data-slot":`resources-worktree-retention`,value:a,min:FD,max:ID,disabled:i.isPending,onCommit:e=>i.mutateAsync({worktreeRetention:e??FD})})})}),(0,Z.jsx)(PD,{config:e}),(0,Z.jsx)(Q,{id:`on-disk`,title:`Worktrees on disk`,description:`Task worktrees currently on disk. Delete one to reclaim its space now, or reclaim everything past the keep-limit at once. Reclamation keeps branches; deleting a worktree also deletes its managed branch.`,children:(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(CD,{})})})]})}function zD(){let e=An(),t=l(),n=V(),[r,i]=(0,X.useState)(`jira`),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)(``),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(``),m=()=>{p(``),d(``),c(``),o(null)};(0,X.useEffect)(()=>{m(),g(!1),b(null)},[fr()]);let[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(``),[y,b]=(0,X.useState)(null),x=At(r,_,h),S=x.data?.pages??[],C=S.find(e=>e.available)?.available?S.find(e=>e.available).source:void 0,w=(0,X.useMemo)(()=>S.flatMap(e=>e.available?e.candidates:[]),[S]);(0,X.useEffect)(()=>{g(!1),b(null),m()},[e.data?.connection?.id]);let T=S.find(e=>!e.available),E=async e=>{await n.invalidateQueries({queryKey:z.tracker.allFor(e)}),await n.invalidateQueries({queryKey:R.projects})},D=B({mutationFn:async()=>{if(!y||!C)throw Error(`Choose a tracker project first.`);let t=fr(),n=z.tracker.associationFor(t);return{...await Kt({kind:r,sourceId:C.id,externalId:y.id,...e.data?.connection?{connectionId:e.data.connection.id}:{}}),projectId:t,associationKey:n}},onSuccess:async e=>{await Promise.all([n.cancelQueries({queryKey:z.tracker.allFor(e.projectId)}),n.cancelQueries({queryKey:R.projects})]),n.setQueryData(e.associationKey,{association:e.association}),g(!1),b(null),await E(e.projectId),Y(`${e.association.externalName} connected`)},onError:e=>Y(e.message,{tone:`danger`})}),O=B({mutationFn:async()=>{let e=fr(),t=z.tracker.associationFor(e);return{...await Zt(),projectId:e,associationKey:t}},onSuccess:async e=>{await Promise.all([n.cancelQueries({queryKey:z.tracker.allFor(e.projectId)}),n.cancelQueries({queryKey:R.projects})]),n.setQueryData(e.associationKey,{association:null}),await E(e.projectId),Y(`Tracker disconnected`)},onError:e=>Y(e.message,{tone:`danger`})}),k=B({onMutate:()=>fr(),mutationFn:async()=>{let e=fr();if(!a)throw Error(`Choose a provider.`);return{...await _e(a===`jira`?{kind:`jira`,origin:s.trim(),email:u.trim(),token:f}:{kind:`linear`,key:f}),projectId:e}},onSuccess:async e=>{fr()===e.projectId&&(m(),g(!1),b(null)),await n.cancelQueries({queryKey:z.tracker.allFor(e.projectId)}),n.setQueryData([`tracker`,e.projectId,`connection`],{connection:e.connection,demo:e.demo}),await E(e.projectId),Y(`Credentials saved for this project. Browse and connect a scope.`)},onError:(e,t,n)=>{fr()===n&&p(``),Y(e.message,{tone:`danger`})}}),A=B({mutationFn:async()=>{let e=fr();return await gt(),e},onSuccess:async e=>{fr()===e&&(m(),g(!1),b(null)),await n.cancelQueries({queryKey:z.tracker.allFor(e)}),n.setQueryData([`tracker`,e,`connection`],{connection:null,demo:!1}),await E(e),Y(`Project credentials removed`)},onError:e=>Y(e.message,{tone:`danger`})}),j=k.isPending||A.isPending,M=t.data?.association,N=e.data?.connection,P=!!M&&(e.data?.demo===!0||!!N&&N.kind===M.kind&&N.id===M.connectionId);if(t.isPending)return(0,Z.jsx)(`p`,{className:`p-6 text-ui text-muted-foreground`,children:`Loading tracker settings…`});if(t.isError)return(0,Z.jsx)(`p`,{className:`p-6 text-ui text-danger`,children:t.error.message});let ee=P?t.data.association:void 0;return(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-5`,"data-slot":`tracker-settings`,children:[(0,Z.jsxs)(Q,{title:`Issue tracker`,description:`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.`,children:[(0,Z.jsx)($,{label:ee?ee.externalName:`Connected scope`,description:ee?(0,Z.jsxs)(`a`,{className:`inline-flex items-center gap-1 text-violet hover:underline`,href:ee.source.webUrl,target:`_blank`,rel:`noreferrer`,children:[Bd[ee.kind].label,` `,(0,Z.jsx)(xo,{className:`size-3`})]}):e.isPending?`Loading connection…`:e.isError?`Connection status unavailable.`:`No tracker connected.`,children:ee?(0,Z.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>O.mutate(),disabled:O.isPending,children:[(0,Z.jsx)(Rd,{className:`size-3.5`}),` Disconnect`]}):null}),M&&N&&!e.isError&&!e.data?.demo&&!P?(0,Z.jsx)(lw,{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,Z.jsx)(lw,{tone:`danger`,children:(0,Z.jsx)(`span`,{role:`alert`,children:e.data.error})}):null,e.isError?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-4 py-2.5 text-meta text-danger`,children:[`Could not load project connection.`,(0,Z.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,Z.jsxs)(lw,{children:[`For local credential cleanup, run `,(0,Z.jsx)(`code`,{children:`cez tracker-connections list`}),`, then `,(0,Z.jsx)(`code`,{children:`cez tracker-connections remove <id>`}),`. Local deletion does not revoke the vendor token.`]})]}),(0,Z.jsx)(Q,{title:`Connect a provider`,action:e.data?.connection?(0,Z.jsx)(q,{variant:`outline`,size:`sm`,disabled:j,onClick:()=>A.mutate(),children:`Remove project credentials`}):null,children:Vd.map(t=>{let n=!e.isError&&(e.data?.demo===!0||e.data?.connection?.kind===t.kind);return(0,Z.jsxs)($,{label:t.label,description:n?void 0:`Configure credentials for this project to browse.`,children:[e.data?.demo?null:(0,Z.jsxs)(q,{variant:`outline`,size:`sm`,disabled:j||e.isPending||e.isError,onClick:()=>{m(),o(t.kind),g(!1),b(null)},children:[e.data?.connection?.kind===t.kind?`Replace`:`Configure`,` `,t.label,` credentials`]}),(0,Z.jsxs)(q,{variant:`outline`,size:`sm`,disabled:!n||j,onClick:()=>{i(t.kind),g(!0),v(``),b(null)},children:[(0,Z.jsx)(zi,{className:`size-3.5`}),` Browse `,t.label]})]},t.kind)})}),a?(0,Z.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),k.mutate()},autoComplete:`off`,children:(0,Z.jsxs)(Q,{title:`${Bd[a].label} credentials for this project`,description:`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.`,children:[a===`jira`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{htmlFor:`tracker-jira-origin`,label:`Jira site URL`,children:(0,Z.jsx)(gl,{id:`tracker-jira-origin`,"aria-label":`Jira site URL`,type:`url`,required:!0,value:s,onChange:e=>c(e.target.value),placeholder:`https://your-site.atlassian.net`,className:`h-8 w-72 max-w-full`})}),(0,Z.jsx)($,{htmlFor:`tracker-jira-email`,label:`Account email`,children:(0,Z.jsx)(gl,{id:`tracker-jira-email`,"aria-label":`Account email`,type:`email`,required:!0,value:u,onChange:e=>d(e.target.value),className:`h-8 w-72 max-w-full`})})]}):null,(0,Z.jsx)($,{htmlFor:`tracker-token`,label:`API token`,children:(0,Z.jsx)(gl,{id:`tracker-token`,"aria-label":`API token`,type:`password`,autoComplete:`new-password`,required:!0,maxLength:8192,value:f,onChange:e=>p(e.target.value),className:`h-8 w-72 max-w-full`})}),(0,Z.jsxs)(`div`,{className:`flex gap-2 px-4 py-3`,children:[(0,Z.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,disabled:j,onClick:m,children:`Cancel`}),(0,Z.jsx)(q,{type:`submit`,size:`sm`,disabled:j,children:`Save project credentials`})]})]})}):null,h?(0,Z.jsxs)(`section`,{className:`rounded-[10px] border border-violet/40 bg-card p-4`,"aria-label":`${Bd[r].label} picker`,children:[(0,Z.jsxs)(`label`,{className:`text-label font-medium`,htmlFor:`tracker-candidate-search`,children:[`Search `,Bd[r].scopeLabel]}),(0,Z.jsx)(gl,{id:`tracker-candidate-search`,className:`mt-2`,value:_,onChange:e=>{v(e.target.value),b(null)},placeholder:`Search by name…`}),(0,Z.jsxs)(`div`,{className:`mt-3 max-h-64 space-y-1 overflow-auto`,children:[x.isPending?(0,Z.jsx)(cl,{label:`Loading candidates…`,children:(0,Z.jsx)(sl,{rows:3})}):null,x.isError?(0,Z.jsx)(BD,{reason:x.error.message,generation:x.errorUpdatedAt,retry:()=>void x.refetch()}):null,T&&!T.available?(0,Z.jsx)(BD,{reason:T.reason,generation:x.dataUpdatedAt,retryAfterSeconds:T.code===`rate_limited`?T.retryAfterSeconds:void 0,retry:()=>void x.refetch()}):null,w.map(e=>(0,Z.jsx)(`button`,{type:`button`,className:`block w-full rounded-md border px-3 py-2 text-left text-ui ${y?.id===e.id?`border-violet bg-violet/10`:`border-border`}`,onClick:()=>b(e),children:e.name},e.id)),!x.isPending&&!x.isError&&!T&&w.length===0?(0,Z.jsx)(`p`,{className:`py-3 text-ui text-muted-foreground`,children:`No projects or teams match.`}):null,x.hasNextPage?(0,Z.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>void x.fetchNextPage(),disabled:x.isFetchingNextPage,children:`Load more`}):null]}),(0,Z.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,Z.jsx)(q,{variant:`ghost`,size:`sm`,onClick:()=>g(!1),children:`Cancel`}),(0,Z.jsx)(q,{variant:`contrast`,size:`sm`,disabled:!y||D.isPending||j,onClick:()=>D.mutate(),children:`Connect`})]})]}):null]})}function BD({reason:e,retry:t,retryAfterSeconds:n=0,generation:r}){let[i,a]=(0,X.useState)(n);return(0,X.useEffect)(()=>a(n),[e,n,r]),(0,X.useEffect)(()=>{if(i<=0)return;let e=window.setInterval(()=>a(e=>Math.max(0,e-1)),1e3);return()=>window.clearInterval(e)},[i>0]),(0,Z.jsxs)(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 p-3 text-ui`,children:[(0,Z.jsx)(`p`,{className:`text-danger`,children:e}),(0,Z.jsx)(q,{className:`mt-2`,variant:`outline`,size:`sm`,disabled:i>0,onClick:t,children:i>0?`Retry in ${i}s`:`Retry`})]})}var VD={"task.attention_required":`Needs your input`,"task.review_ready":`Ready for review`,"task.finished":`Task finished`,"task.failed":`Task failed`,"task.cancelled":`Task cancelled`,"webhook.test":`Test message`},HD=`text-label text-muted-foreground`;function UD(e){return{format:e?.format??`cezar.json.v1`,name:e?.name??``,url:``,profile:e?.profile??`minimal`,preset:e?.preset??`attention`,events:e?.events??[],scope:e?.scope??`main_and_questions`,graceSeconds:e?.graceSeconds??180,local:e?.allowLocalNetwork??!1,scheduled:e?.includeScheduledFailures??!1}}function WD({id:e,label:t,children:n}){return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e?(0,Z.jsx)(`label`,{htmlFor:e,className:`text-ui font-medium`,children:t}):(0,Z.jsx)(`span`,{className:`text-ui font-medium`,children:t}),n]})}function GD({id:e,slot:t,value:n,options:r,onChange:i}){return(0,Z.jsxs)(Za,{value:n,onValueChange:e=>i(e),children:[(0,Z.jsx)(Ya,{id:e,"data-slot":t,"data-value":n,className:`w-full`,children:(0,Z.jsx)(Xa,{})}),(0,Z.jsx)(Ja,{position:`popper`,children:r.map(e=>(0,Z.jsx)(J,{value:e.value,children:e.label},e.value))})]})}function KD({receiver:e,draft:t,setDraft:n,pending:r,blocked:i=!1,guideHref:a,save:o}){let s=(0,X.useId)(),{format:c,name:l,url:u,profile:d,preset:f,events:p,scope:m,graceSeconds:h,local:g,scheduled:_}=t,v=(e,r)=>n({...t,[e]:r}),[y,b]=(0,X.useState)(``),x=c!==`cezar.json.v1`,S=c===`slack.v1`?`Slack`:`Discord`,C;try{let e=new URL(u).hostname;e===`hooks.slack.com`&&(C=`slack.v1`),[`discord.com`,`discordapp.com`,`ptb.discord.com`,`canary.discord.com`].includes(e)&&(C=`discord.v1`)}catch{}let w=e=>n({...t,format:e,local:e===`cezar.json.v1`&&g});return(0,Z.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:t=>{if(t.preventDefault(),r||i)return;let n={format:c,name:l,...u||!e?{url:u}:{},profile:d,preset:f,events:p,scope:m,graceSeconds:h,allowLocalNetwork:!x&&g,includeScheduledFailures:_},a=e?nr.safeParse({...n,expectedRevision:e.revision}):_r.safeParse(n);if(!a.success){b([...new Set(a.error.issues.map(e=>e.message.replace(/\.?$/,`.`)))].join(` `));return}b(``),o(a.data)},children:[(0,Z.jsx)(WD,{id:`${s}-destination`,label:`Destination`,children:(0,Z.jsx)(GD,{id:`${s}-destination`,slot:`webhook-destination`,value:c,onChange:w,options:[{value:`cezar.json.v1`,label:`Custom receiver (signed cezar JSON)`},{value:`slack.v1`,label:`Slack channel (Incoming Webhook)`},{value:`discord.v1`,label:`Discord channel (Webhook URL)`}]})}),(0,Z.jsx)(WD,{id:`${s}-name`,label:`Name`,children:(0,Z.jsx)(gl,{id:`${s}-name`,value:l,onChange:e=>v(`name`,e.target.value),maxLength:100,required:!0,autoComplete:`off`})}),(0,Z.jsxs)(WD,{id:`${s}-url`,label:x?`Webhook URL`:`Receiver URL`,children:[(0,Z.jsx)(gl,{id:`${s}-url`,type:`url`,value:u,onChange:e=>v(`url`,e.target.value),required:!e,autoComplete:`off`,placeholder:e?`Leave blank to keep the current URL`:c===`slack.v1`?`https://hooks.slack.com/services/…`:c===`discord.v1`?`https://discord.com/api/webhooks/…`:`https://your-receiver.example/webhook`}),e&&(0,Z.jsxs)(`p`,{className:HD,children:[`Current: `,e.destination,` (path hidden)`]}),u.startsWith(`http:`)&&(0,Z.jsx)(`p`,{className:`text-label text-warning`,children:`Plain HTTP is not encrypted. Use HTTPS outside a trusted local network.`}),!x&&C&&(0,Z.jsxs)(`div`,{role:`status`,className:`flex flex-wrap items-center gap-2 text-label text-warning`,children:[(0,Z.jsxs)(`span`,{children:[`This is a `,C===`slack.v1`?`Slack`:`Discord`,` webhook. Switch the destination to post channel messages.`]}),(0,Z.jsxs)(q,{type:`button`,size:`sm`,variant:`outline`,className:`text-foreground`,onClick:()=>w(C),children:[`Use `,C===`slack.v1`?`Slack`:`Discord`]})]}),c===`slack.v1`&&(0,Z.jsxs)(`p`,{className:HD,children:[`In Slack, create an app with an Incoming Webhook, install it in your channel and paste its URL. `,(0,Z.jsx)(`a`,{className:`underline underline-offset-2 hover:text-foreground`,href:`https://docs.slack.dev/messaging/sending-messages-using-incoming-webhooks/`,target:`_blank`,rel:`noreferrer`,children:`Slack setup guide`})]}),c===`discord.v1`&&(0,Z.jsxs)(`p`,{className:HD,children:[`In Discord, open Server Settings → Integrations → Webhooks, create one and paste its URL. `,(0,Z.jsx)(`a`,{className:`underline underline-offset-2 hover:text-foreground`,href:`https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks`,target:`_blank`,rel:`noreferrer`,children:`Discord setup guide`})]}),x?(0,Z.jsxs)(`p`,{className:HD,children:[`Keep this URL secret — anyone who has it can post to the channel. `,S,` receivers need no signing key.`]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`label`,{className:`flex items-start gap-2 text-ui`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:g,onChange:e=>v(`local`,e.target.checked)}),`Allow a receiver on this computer or private network`]}),g&&(0,Z.jsx)(`p`,{className:HD,children:`Tests will contact this private address. Hosted cezar sends to public HTTPS receivers only.`}),(0,Z.jsx)(`a`,{className:`text-label text-muted-foreground underline underline-offset-2 hover:text-foreground`,href:`${a}#external-automation-receivers`,target:`_blank`,rel:`noreferrer`,children:`How to build a receiver`})]})]}),(0,Z.jsx)(WD,{id:`${s}-events`,label:`Events`,children:(0,Z.jsx)(GD,{id:`${s}-events`,slot:`webhook-preset`,value:f,onChange:e=>v(`preset`,e),options:[`attention`,`all`,`custom`].map(e=>({value:e,label:RE[e]}))})}),f===`custom`&&(0,Z.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`legend`,{className:`mb-1 text-ui font-medium`,children:`Choose events`}),Object.entries(VD).filter(([e])=>e!==`webhook.test`).map(([e,t])=>(0,Z.jsxs)(`label`,{className:`flex items-center gap-2 text-ui`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:p.includes(e),onChange:t=>v(`events`,t.target.checked?[...p,e]:p.filter(t=>t!==e))}),t]},e))]}),(0,Z.jsxs)(WD,{id:`${s}-profile`,label:`Message content`,children:[(0,Z.jsx)(GD,{id:`${s}-profile`,slot:`webhook-profile`,value:d,onChange:e=>v(`profile`,e),options:[{value:`minimal`,label:`Minimal — IDs, status and your own title`},{value:`standard`,label:`Standard — task titles, questions and errors`}]}),(0,Z.jsx)(`p`,{className:HD,children:`Prompts and transcripts are never sent. Redaction of other text is best effort.`}),x&&d===`standard`&&(0,Z.jsxs)(`p`,{className:`text-label text-warning`,children:[`Standard posts task titles, questions and error text to your `,S,` channel.`]})]}),x?(0,Z.jsx)(qD,{format:c,profile:d}):(0,Z.jsxs)(`details`,{children:[(0,Z.jsxs)(`summary`,{className:`cursor-pointer text-ui font-medium`,children:[`Preview JSON · `,d===`minimal`?`Minimal`:`Standard`]}),(0,Z.jsx)(`p`,{className:`mt-2 ${HD}`,children:`Example data only — nothing is sent.`}),(0,Z.jsx)(`pre`,{"aria-label":`Synthetic JSON sample`,className:`mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-all rounded-md bg-muted p-3 font-mono text-label`,children:JSON.stringify({id:`evt_00000000-0000-4000-8000-000000000001`,schemaVersion:1,sequence:1,occurredAt:`2026-01-01T12:00:00Z`,type:`task.attention_required`,source:{instanceId:`example-instance`,projectId:`example-project`,mode:`local`},task:{id:`example-task`,previousStatus:`running`,status:`waiting`,...d===`standard`?{title:`Example generated task title`}:{}},data:{episodeId:`example-episode`,since:`2026-01-01T12:00:00Z`,reason:`question`,requestId:`example-request`,...d===`standard`?{questions:[{question:`Which example option should be used?`,options:[{label:`Example A`},{label:`Example B`}]}]}:{}}},null,2)})]}),(0,Z.jsxs)(`details`,{children:[(0,Z.jsx)(`summary`,{className:`cursor-pointer text-ui font-medium`,children:`Advanced`}),(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-col gap-4`,children:[(0,Z.jsx)(WD,{id:`${s}-scope`,label:`Tasks`,children:(0,Z.jsx)(GD,{id:`${s}-scope`,slot:`webhook-scope`,value:m,onChange:e=>v(`scope`,e),options:[`main_and_questions`,`every_task`].map(e=>({value:e,label:LE[e]}))})}),(0,Z.jsxs)(WD,{id:`${s}-grace`,label:`Waiting and review delay`,children:[(0,Z.jsx)(GD,{id:`${s}-grace`,slot:`webhook-grace`,value:String(h),onChange:e=>v(`graceSeconds`,Number(e)),options:[0,60,180,600].map(e=>({value:String(e),label:zE[e]}))}),(0,Z.jsx)(`p`,{className:HD,children:`Skipped if you reply, or the task stops waiting or leaves review, before the delay ends.`})]}),(0,Z.jsxs)(`label`,{className:`flex items-start gap-2 text-ui`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:_,onChange:e=>v(`scheduled`,e.target.checked)}),`Include failures that will resume automatically (always included in All results)`]})]})]}),y&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-ui text-danger`,children:y}),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(q,{type:`submit`,disabled:r||i,children:r?`Saving…`:e?`Review changes`:`Save receiver`})})]})}function qD({format:e,profile:t}){let n=e===`slack.v1`?`Slack`:`Discord`;return(0,Z.jsxs)(`details`,{children:[(0,Z.jsxs)(`summary`,{className:`cursor-pointer text-ui font-medium`,children:[`Preview `,n,` message · `,t===`minimal`?`Minimal`:`Standard`]}),(0,Z.jsx)(`p`,{className:`mt-2 ${HD}`,children:`Example data only — nothing is sent.`}),(0,Z.jsxs)(`div`,{"aria-label":`${n} message sample`,className:`mt-2 space-y-2 rounded-md border border-border bg-muted p-3 text-ui ${e===`discord.v1`?`border-l-4 border-l-pending`:``}`,children:[(0,Z.jsxs)(`p`,{className:`font-medium`,children:[`Needs your input · `,t===`standard`?`Example generated task title`:`a1b2c3d4`]}),(0,Z.jsx)(`p`,{children:`running → waiting`}),(0,Z.jsx)(`p`,{className:`text-label text-muted-foreground`,children:`example-project · a1b2c3d4 · Jan 1, 2026, 12:00 UTC`}),t===`standard`&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{children:`Which example option should be used?`}),(0,Z.jsx)(`p`,{children:`Example A · Example B`})]}),(0,Z.jsx)(`p`,{className:`text-label text-muted-foreground`,children:`cezar`})]})]})}var JD={local_consent_required:`This address is on this computer or a private network. Edit the receiver and turn on “Allow a receiver on this computer or private network”.`,server_port:`This address points at the cezar server itself. Use your receiver's own port.`,https_required:`This server only sends to HTTPS receivers. Use an https:// URL.`,public_destination_required:`This server only sends to public receivers. Use a publicly reachable HTTPS URL.`,metadata_hostname:`Cloud metadata hostnames are never allowed as receivers.`,denied_address:`The receiver resolves to an address that is never allowed.`,mixed_dns:`The receiver hostname resolves to both public and private addresses. Use a hostname with one kind of address.`,invalid_dns:`The receiver hostname did not resolve to a usable address.`,dns_not_found:`The receiver hostname does not resolve. Check the URL.`,invalid_url:`The receiver URL is not allowed. Use a plain http(s) URL without credentials or a fragment.`};function YD({projectId:e,test:t,openHistory:n}){let r=Xn({queryKey:[...dx(e),`test-result`,t.receiverId,t.deliveryId],queryFn:()=>Pe.deliveries(e,t.receiverId),retry:!1}),i=r.data?.items.find(e=>e.deliveryId===t.deliveryId),a=r.data?.receiver,o=t.format??(a?.kind===`live`?a.format:void 0),s=i&&[`delivered`,`failed`,`cancelled`,`superseded`,`dropped`].includes(i.status),c=(0,X.useRef)(void 0),l=s?i.status:void 0,u=i?.reason===`outcome_unknown`;(0,X.useEffect)(()=>{let n=`${e}:${t.deliveryId}`;!l||c.current===n||(c.current=n,l===`delivered`&&!u?Y(`Test delivered to ${t.receiverName}`):Y(u?`Test result for ${t.receiverName} is unknown`:`Test to ${t.receiverName} failed`,{tone:`danger`}))},[e,t.deliveryId,t.receiverName,l,u]);let d=s&&i.status===`delivered`&&!u,f=r.error?`Test result is unavailable. Check the history.`:r.data&&!i?`Test sent. Its result is in the history.`:s?u?`Test result unknown — it may have arrived. Check your receiver before testing again.`:d?`Test delivered.${a?.kind===`live`&&[`inactive`,`paused`].includes(a.state)?` ${a.state===`paused`?`Resume`:`Activate`} the receiver to start sending task updates.`:``}`:`Test ${i.status===`failed`?`failed`:i.status}${i.reason?`: ${KE(i.reason)}`:``}.`:`Test sent — waiting for the result…`,p=!s||d||u?void 0:i.reason===`timeout`||i.reason===`connection_failed`?`Check that your receiver is reachable and responds within 10 seconds.`:/^http_(401|403)$/.test(i.reason??``)?o===`slack.v1`||o===`discord.v1`?`Check the webhook URL in Slack or Discord. If it was revoked or replaced, edit this receiver with the current URL and send a new test.`:`Check the receiver’s authentication and the signing key in its verifier.`:i.reason===`http_404`||i.reason===`http_410`?`Check the URL and that the endpoint still exists.`:JD[i.reason??``]?`${JD[i.reason]} Activation stays blocked until a test passes.`:`Fix the receiver, then send a new test. Tests are not retried automatically.`,m=d?`border-success/40`:s?`border-danger/30 bg-danger/5`:`border-border`;return(0,Z.jsxs)(`div`,{role:`status`,"data-test-delivery":t.deliveryId,className:`flex flex-wrap items-center justify-between gap-2 rounded-md border p-3 text-ui ${m}`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`p`,{children:f}),p&&(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:p})]}),(0,Z.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>n(t.receiverId),children:`View in history`})]})}var XD=Object.keys(VE),ZD={pending:`neutral`,in_flight:`violet`,retrying:`pending`,blocked_policy:`pending`,delivered:`success`,failed:`danger`,superseded:`neutral`,cancelled:`neutral`,dropped:`danger`};function QD({projectId:e,receiver:t,operation:n,tab:r,onTabChange:i}){let[a,o]=(0,X.useState)(`deliveries`),s=r??a,c=e=>{o(e),i?.(e)},[l,u]=(0,X.useState)(`all`),d=(0,X.useId)(),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(``),[g,_]=(0,X.useState)(),v=ft({queryKey:[...dx(e),t.id,`deliveries`,f],initialPageParam:void 0,queryFn:({pageParam:n})=>Pe.deliveries(e,t.id,n,f||void 0),getNextPageParam:e=>e.nextCursor,enabled:s===`deliveries`,retry:!1}),y=Xn({queryKey:[...dx(e),t.id,`activity`],queryFn:()=>Pe.activity(e,t.id),enabled:s===`activity`,retry:!1}),b=[...new Map((v.data?.pages.flatMap(e=>e.items)??[]).map(e=>[e.deliveryId,e])).values()],x=b.filter(e=>l===`all`||e.status===l),S=v.data?.pages[0]?.timezone,C=e=>XE(e,S);return(0,Z.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-3`,children:[t.kind===`history`&&(0,Z.jsxs)(`p`,{className:`rounded-md border border-border bg-muted p-3 text-ui text-muted-foreground`,children:[`Deleted `,XE(t.deletedAt),` — read-only. Its settings and signing keys are gone; history is kept for up to 30 days.`]}),(0,Z.jsxs)(Yc,{value:s,onValueChange:e=>c(e),children:[(0,Z.jsxs)(Jc,{"aria-label":`Receiver history`,children:[(0,Z.jsx)(Kc,{value:`deliveries`,children:`Deliveries`}),(0,Z.jsx)(Kc,{value:`activity`,children:`Activity`})]}),(0,Z.jsxs)(qc,{value:`activity`,className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[`Times in `,YE(y.data?.timezone).label,`.`]}),y.isPending&&(0,Z.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`Loading activity…`}),y.error&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-ui text-danger`,children:y.error.message}),y.data?.items.map(e=>(0,Z.jsxs)(`div`,{className:`rounded-md border border-border p-3 text-ui`,children:[(0,Z.jsxs)(`p`,{children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:qE(e.action)}),` `,(0,Z.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,XE(e.at,y.data?.timezone),` · via `,WE[e.source],e.revision!==void 0&&` · revision ${e.revision}`]})]}),e.fields.length>0&&(0,Z.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[`Changed: `,e.fields.join(`, `)]}),e.detail&&(0,Z.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:e.detail})]},e.id)),y.data?.items.length===0&&(0,Z.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`No activity in the retained history.`}),y.data?.hasMore&&(0,Z.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`Showing the latest 100 actions.`})]}),(0,Z.jsxs)(qc,{value:`deliveries`,className:`flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2`,children:[(0,Z.jsxs)(`form`,{className:`flex min-w-0 flex-1 items-end gap-2`,onSubmit:e=>{e.preventDefault(),p(m.trim())},children:[(0,Z.jsxs)(`label`,{className:`flex min-w-0 flex-1 flex-col gap-1.5 text-ui font-medium`,children:[`Task ID`,(0,Z.jsx)(gl,{value:m,onChange:e=>h(e.target.value),placeholder:`Optional — show one task’s deliveries`})]}),(0,Z.jsx)(q,{type:`submit`,variant:`outline`,children:`Find`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{id:d,className:`text-ui font-medium`,children:`Result`}),(0,Z.jsxs)(Za,{value:l,onValueChange:u,children:[(0,Z.jsx)(Ya,{"aria-labelledby":d,children:(0,Z.jsx)(Xa,{})}),(0,Z.jsxs)(Ja,{children:[(0,Z.jsx)(J,{value:`all`,children:`All results`}),XD.map(e=>(0,Z.jsx)(J,{value:e,children:VE[e]},e))]})]})]})]}),(0,Z.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[`Showing `,b.length?`1–${b.length}`:`0`,` of `,v.data?.pages[0]?.total??0,f?` for task ${f}`:``,`. The result filter applies to loaded entries. Times in `,YE(S).label,`.`]}),v.isPending&&(0,Z.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`Loading deliveries…`}),v.error&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-ui text-danger`,children:v.error.message}),!v.isPending&&x.length===0&&(0,Z.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`No deliveries match.`}),x.map(e=>(0,Z.jsxs)(`article`,{className:`min-w-0 rounded-md border border-border p-3 text-ui`,children:[(0,Z.jsxs)(`button`,{className:`w-full min-w-0 text-left`,type:`button`,"aria-expanded":g===e.deliveryId,onClick:()=>_(t=>t===e.deliveryId?void 0:e.deliveryId),children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:VD[e.eventType]}),` · `,(0,Z.jsxs)(`span`,{"data-slot":`delivery-status`,"data-status":e.status,className:`inline-flex items-center gap-1.5`,children:[(0,Z.jsx)(Pl,{tone:ZD[e.status],pulse:e.status===`in_flight`}),VE[e.status]]}),(0,Z.jsxs)(`span`,{className:`block text-label text-muted-foreground`,children:[C(e.createdAt),` · `,JE(e.attempts,`attempt`,`attempts`),e.taskId?` · task ${e.taskId.slice(0,8)}`:``]})]}),g===e.deliveryId&&(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 break-words border-t border-border pt-3 text-ui`,children:[(0,Z.jsxs)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 [overflow-wrap:anywhere]`,children:[e.reason&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Reason`}),(0,Z.jsx)(`dd`,{children:KE(e.reason)})]}),e.httpStatus&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`HTTP status`}),(0,Z.jsx)(`dd`,{children:e.httpStatus})]}),e.nextAttemptAt&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Next attempt`}),(0,Z.jsx)(`dd`,{children:C(e.nextAttemptAt)})]}),(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Retries until`}),(0,Z.jsx)(`dd`,{children:C(e.expiresAt)}),e.taskId&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Task`}),(0,Z.jsxs)(`dd`,{children:[e.taskAvailability===`available`?(0,Z.jsx)(G,{className:`underline underline-offset-2`,to:`/tasks/${encodeURIComponent(e.taskId)}`,children:e.taskId}):e.taskId,e.taskAvailability===`deleted`&&` (deleted)`,e.taskAvailability===`unknown`&&` (availability unknown)`]})]}),(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Destination`}),(0,Z.jsx)(`dd`,{children:e.destination}),(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Event ID`}),(0,Z.jsx)(`dd`,{className:`font-mono text-label`,children:e.eventId}),(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Delivery ID`}),(0,Z.jsx)(`dd`,{className:`font-mono text-label`,children:e.deliveryId}),e.payloadRetainedUntil&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Payload kept until`}),(0,Z.jsx)(`dd`,{children:C(e.payloadRetainedUntil)})]}),e.historyRetainedUntil&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`History kept until`}),(0,Z.jsxs)(`dd`,{children:[C(e.historyRetainedUntil),` at most`]})]})]}),e.payloadAvailability===`not_created`&&(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`No payload was created for this delivery.`}),e.payloadAvailability===`unknown`&&(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`Payload availability is unknown.`}),e.response&&(0,Z.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap rounded-md bg-muted p-2 font-mono text-label`,children:e.response}),t.kind===`live`&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(q,{size:`sm`,variant:`outline`,disabled:!e.retryAllowed,onClick:()=>n(`retry`,e,t),children:`Retry now`}),(0,Z.jsx)(q,{size:`sm`,variant:`outline`,disabled:!e.replayAllowed,onClick:()=>n(`replay`,e,t),children:`Replay`}),!e.replayAllowed&&(0,Z.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Replay unavailable: `,e.replayUnavailableReason?$D[e.replayUnavailableReason]:`the payload or receiver is no longer eligible.`]})]})]})]},e.deliveryId)),v.hasNextPage&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(q,{variant:`outline`,disabled:v.isFetchingNextPage,onClick:()=>void v.fetchNextPage(),children:`Load older`})})]})]})]})}var $D={receiver_deleted:`the receiver was deleted.`,receiver_inactive:`activate the receiver first.`,configuration_changed:`the receiver settings changed since.`,task_unavailable:`the task is deleted or its state cannot be checked.`,not_fresh:`the event is out of date.`,not_terminal:`the delivery has not finished yet.`,synthetic_test:`send a new test instead.`,payload_expired:`the payload is no longer kept.`,payload_unavailable:`the original payload is unavailable.`};function eO(){let e=Nr()??`default`,t=E();return t.isError?(0,Z.jsx)(`p`,{role:`status`,className:nO,children:`Webhook status unavailable — could not load server health.`}):t.data?(0,Z.jsx)(tO,{projectId:e,enabled:t.data?.capabilities.webhooks===!0,unsupportedPlatform:t.data?.capabilities.webhooksUnavailableReason===`unsupported_platform`},e):(0,Z.jsx)(`p`,{role:`status`,className:nO,children:`Loading webhook status…`})}function tO({projectId:e,enabled:t,unsupportedPlatform:n}){let r=V(),[i,a]=Or(),o=Kr(),s=(0,X.useRef)({mounted:!1,token:Symbol()});(0,X.useLayoutEffect)(()=>(s.current={mounted:!0,token:Symbol()},()=>{s.current.mounted=!1}),[o]);let c=e=>s.current.mounted&&s.current.token===e,l=i.get(`endpoint`)??``,u=i.get(`tab`)??`settings`,d=/^[A-Za-z0-9_-]{1,128}$/.test(l),f=[`settings`,`deliveries`,`activity`].includes(u),p=u===`activity`?`activity`:`deliveries`,m=(0,X.useRef)(i.toString());(0,X.useLayoutEffect)(()=>{m.current=i.toString()},[i]);let h=(e,t=`deliveries`)=>{let n=new URLSearchParams(m.current);e?(n.set(`endpoint`,e),n.set(`tab`,t)):(n.delete(`endpoint`),n.delete(`tab`)),n.toString()!==m.current&&(m.current=n.toString(),a(n))},g=ZE(Xn({queryKey:[`workspace`,`self-update`],queryFn:({signal:e})=>C({signal:e}),retry:!1}).data),_=fx(e,t),[v,y]=(0,X.useState)(),[b,x]=(0,X.useState)(()=>UD()),[S,w]=(0,X.useState)(!1),[T,E]=(0,X.useState)(``),[D,O]=(0,X.useState)(),[k,A]=(0,X.useState)(),j=(0,X.useRef)(null),M=(0,X.useRef)(null),N=(0,X.useRef)(null),P=(0,X.useRef)(null),ee=(e,t)=>{e.preventDefault();let n=[...document.querySelectorAll(`[role="dialog"][data-state="open"]`)];n.length&&!n.some(e=>t&&e.contains(t))||(t?.isConnected&&!t.matches(`:disabled`)?t.focus():j.current?.focus())},[te,ne]=(0,X.useState)(!1),[re,ie]=(0,X.useState)(!1);(0,X.useLayoutEffect)(()=>{v===`new`&&(y(void 0),x(UD()),w(!1),de(``))},[o]),(0,X.useLayoutEffect)(()=>{A(void 0),ne(!1),ie(!1)},[o]);let F=(0,X.useRef)(new Map),ae=(0,X.useRef)(new Map),oe=(0,X.useRef)(void 0);(0,X.useLayoutEffect)(()=>{d&&f&&u!==`settings`&&(oe.current=F.current.get(l))},[l,d,f,u,_.data]);let se=(0,X.useRef)(void 0),ce=_.data?.receivers.find(e=>e.id===l)??_.data?.history.find(e=>e.id===l),le=Xn({queryKey:[...dx(e),`resolve`,l,p],queryFn:async()=>(await(p===`activity`?Pe.activity(e,l):Pe.deliveries(e,l))).receiver,enabled:t&&d&&f&&u!==`settings`&&!ce,retry:!1});(0,X.useEffect)(()=>{if(t&&d&&u===`settings`){let e=_.data?.receivers.find(e=>e.id===l);e&&se.current!==l&&(se.current=l,y(e),x(UD(e)),w(!1),de(``))}else se.current&&(se.current=void 0,y(void 0),x(UD()),w(!1))},[t,l,d,u,_.data]);let[I,ue]=(0,X.useState)(!1),[L,de]=(0,X.useState)(``),[fe,pe]=(0,X.useState)();(0,X.useLayoutEffect)(()=>{pe(void 0)},[o.key]);let me=async(t,n)=>{let r=s.current.token,i=await Pe.test(e,t.id,n);c(r)&&pe({viewKey:o.key,deliveryId:i.deliveryId,receiverId:t.id,receiverName:t.name,initialState:t.state,deliveryRevision:t.deliveryRevision,format:t.format})},he=ft({queryKey:[...dx(e),`history`],initialPageParam:void 0,queryFn:({pageParam:t})=>Pe.history(e,t),getNextPageParam:e=>e.nextCursor,enabled:t&&I,retry:!1}),ge=B({onMutate:()=>({viewKey:s.current.token,form:v,confirmation:k}),mutationFn:async e=>{let t=s.current.token,n=await e();!(n&&typeof n==`object`&&`receiver`in n&&n.receiver&&typeof n.receiver==`object`&&`format`in n.receiver&&(n.receiver.format===`slack.v1`||n.receiver.format===`discord.v1`))&&c(t)&&n&&typeof n==`object`&&`secret`in n&&typeof n.secret==`string`&&n.secret.length>0&&(N.current=v?M.current:P.current,E(``),O(n.secret))},onSuccess:async(t,n,i)=>{if(!i||!c(i.viewKey)){await r.invalidateQueries({queryKey:dx(e)});return}v===i.form&&k===i.confirmation&&(v&&(P.current=M.current),k?.deletesReceiver&&(P.current=j.current),v&&l&&u===`settings`&&h(),y(void 0),x(UD()),w(!1),A(void 0),de(``)),await r.invalidateQueries({queryKey:dx(e)})},onError:(t,n,i)=>{if(!i||!c(i.viewKey)){r.invalidateQueries({queryKey:dx(e)});return}v===i.form&&k===i.confirmation?(de(t.message),`status`in t&&t.status===409&&w(!0)):Y(`Earlier webhook action failed: ${t.message}`,{tone:`danger`}),r.invalidateQueries({queryKey:dx(e)})}}),_e=(e,t=document.activeElement)=>{P.current=t instanceof HTMLElement?t:null,ne(!1),ie(!1),de(``),w(!1),A(e)},ve=(t,n,r)=>{let i={expectedRevision:r.revision,deliveryRevision:r.deliveryRevision,operationId:crypto.randomUUID()};_e(t===`replay`?{title:`Replay this event?`,text:`Sends the same event again with a new 72-hour retry window. Your receiver or channel may show it twice.`,run:()=>Pe.replay(e,n.deliveryId,i)}:{title:`Retry this delivery now?`,text:`Sends the same message again now. Rate limits and freshness checks still apply.`,run:()=>Pe.retry(e,n.deliveryId,i)})},ye=t=>({title:`Pause ${t.name}?`,text:`New events won’t be queued while it is paused.${iO(t.pendingCount)}`,run:()=>Pe.pause(e,t.id,t.revision)}),be=t=>({title:`Delete ${t.name}?`,text:`${iO(t.pendingCount).trim()} Its settings${rO(t)?``:` and signing keys`} are removed and cannot be restored; delivery history stays for up to 30 days.`.trim(),deletesReceiver:!0,run:()=>Pe.remove(e,t.id,t.revision)});if(n||!t)return(0,Z.jsx)(`div`,{"data-slot":`webhooks-settings`,className:nO,children:(0,Z.jsx)(Q,{title:n?`Webhooks aren’t available on this platform`:`Webhooks are off`,description:n?`Delivery needs an OS-verified process identity to keep a single sender. Linux, macOS and Windows provide one; this platform does not.`:`Send task updates to Slack, Discord or your own endpoint when a task needs you, is ready for review or finishes.`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3 text-ui`,children:[!n&&(0,Z.jsxs)(`p`,{children:[`Start cezar with `,(0,Z.jsx)(`code`,{children:`CEZ_WEBHOOKS=1`}),`, then reload this page. If someone else runs this server, ask them to turn webhooks on.`]}),(0,Z.jsx)(`a`,{className:`w-fit underline underline-offset-2 hover:text-foreground`,href:g.href,target:`_blank`,rel:`noreferrer`,children:g.note})]})})});let xe=_.data?.receivers??[],Se=d&&f&&u!==`settings`?ce??le.data:void 0,Ce=_.data?.notice,we=Ce?.receiverId?xe.find(e=>e.id===Ce.receiverId):void 0,Te=v&&v!==`new`?xe.find(e=>e.id===v.id):void 0,Ee=_.data?.historyCount??0,De=S&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border border-warning/50 bg-warning/10 p-3 text-ui`,role:`alert`,children:[(0,Z.jsx)(`p`,{children:`This receiver changed in the meantime, so nothing was applied. Review its latest state and confirm again.`}),v&&v!==`new`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{children:`Your draft is kept. Saving it replaces the latest settings below; a blank URL keeps the current destination.`}),_.isFetching?(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`Loading the latest settings…`}):_.error?(0,Z.jsx)(`p`,{className:`text-danger`,children:`Couldn’t load the latest settings.`}):Te?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`font-medium`,children:[`Latest: revision `,Te.revision,` · `,PE[Te.state]]}),(0,Z.jsx)(aO,{receiver:Te,projectId:e})]}):(0,Z.jsx)(`p`,{children:`This receiver no longer exists. Close this dialog to return to the list.`}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(q,{size:`sm`,variant:`outline`,disabled:_.isFetching,onClick:()=>void _.refetch(),children:`Refresh latest settings`}),(0,Z.jsx)(q,{size:`sm`,disabled:!Te||_.isFetching||!!_.error,onClick:()=>{Te&&(y(Te),w(!1),A(void 0),de(``))},children:`Keep draft and review again`})]})]}):(0,Z.jsx)(`p`,{children:`Cancel, check the refreshed receiver or its history, then choose the action again. Earlier consent is not reused.`})]});return(0,Z.jsxs)(`div`,{"data-slot":`webhooks-settings`,className:nO,children:[(0,Z.jsxs)(Q,{id:`receivers`,slot:`webhooks-receivers`,title:`Receivers`,description:(0,Z.jsxs)(Z.Fragment,{children:[`Each receiver gets the task updates you choose while cezar is running. New receivers stay Inactive until you test and activate them. `,(0,Z.jsx)(`a`,{className:`underline underline-offset-2 hover:text-foreground`,href:g.href,target:`_blank`,rel:`noreferrer`,children:g.note})]}),action:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(q,{variant:`ghost`,size:`sm`,"aria-label":`Refresh`,disabled:_.isFetching,onClick:()=>void _.refetch(),children:[(0,Z.jsx)(ns,{}),`Refresh`]}),(0,Z.jsxs)(q,{ref:j,size:`sm`,disabled:_.isPending||!!_.error,onClick:e=>{M.current=e.currentTarget,de(``),w(!1),x(UD()),y(`new`)},children:[(0,Z.jsx)(ts,{}),`Add receiver`]})]}),children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 py-3 empty:hidden`,children:[Ce&&(0,Z.jsxs)(`section`,{role:`status`,className:`flex min-w-0 flex-col gap-2 rounded-md border border-warning/50 bg-warning/10 p-3 text-ui [overflow-wrap:anywhere]`,children:[(0,Z.jsxs)(`p`,{children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:qE(Ce.action)}),Ce.receiverName?` — ${Ce.receiverName}`:``,(0,Z.jsxs)(`span`,{className:`text-muted-foreground`,children:[Ce.destination?` · ${Ce.destination}`:``,` · `,XE(Ce.at),Ce.source?` · via ${WE[Ce.source]}`:``]})]}),(0,Z.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`Any local process, including agents, can change receivers and read signing keys. If this wasn’t you, review it.`}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(q,{size:`sm`,variant:`outline`,disabled:ge.isPending,onClick:()=>ge.mutate(()=>Pe.acknowledge(e,_.data.changeSequence)),children:`Mark as reviewed`}),Ce.receiverId&&(0,Z.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>h(Ce.receiverId,`activity`),children:`View activity`}),we&&[`active`,`suspended`].includes(we.state)&&(0,Z.jsx)(q,{size:`sm`,variant:`ghost`,onClick:e=>_e(ye(we),e.currentTarget),children:`Pause receiver`}),we&&(0,Z.jsx)(q,{size:`sm`,variant:`danger-ghost`,onClick:e=>_e(be(we),e.currentTarget),children:`Delete receiver`})]})]}),l&&(!d||!f)&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-ui text-danger`,children:`This receiver link is invalid.`}),d&&u===`settings`&&!_.isPending&&!_.error&&!xe.some(e=>e.id===l)&&(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-2 text-ui`,children:[(0,Z.jsx)(`span`,{children:`This receiver’s settings are unavailable — it may have been deleted.`}),(0,Z.jsx)(q,{size:`sm`,variant:`outline`,onClick:()=>h(l,`deliveries`),children:`View its history`})]}),d&&f&&u!==`settings`&&!Se&&(0,Z.jsx)(`p`,{role:`status`,className:`text-ui text-muted-foreground`,children:le.error?`This receiver’s history is unavailable or no longer kept.`:`Loading history…`}),(L||_.error)&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-ui text-danger`,children:L||_.error?.message}),_.data?.webhookHealth.status!==`ready`&&_.data?.webhookHealth.reason&&(0,Z.jsx)(`p`,{role:`status`,className:`rounded-md border border-warning/50 bg-warning/10 p-3 text-ui`,children:_.data.webhookHealth.reason}),_.isPending&&(0,Z.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`Loading receivers…`}),!_.isPending&&!_.error&&!xe.length&&(0,Z.jsxs)(`div`,{className:`rounded-lg border border-dashed border-border p-6 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-ui font-medium`,children:`No receivers yet`}),(0,Z.jsx)(`p`,{className:`mt-1 text-ui text-muted-foreground`,children:`Add a Slack or Discord channel, or your own endpoint. Send a test, then activate it.`})]})]}),xe.map(t=>{let n=!rO(t),r=[`inactive`,`disabled`,`paused`].includes(t.state),i=t.state===`suspended`?`Test and recover`:t.state===`disabled`?`Test after repair`:`Send test`,a=[t.destination,`${IE[t.profile]} content`,`Last test: ${BE[t.lastTest].toLowerCase()}`,t.pendingCount?JE(t.pendingCount,`pending delivery`,`pending deliveries`):``,t.inFlightCount?`${t.inFlightCount} sending`:``].filter(Boolean).join(` · `);return(0,Z.jsxs)(`article`,{"data-slot":`webhook-receiver`,className:`flex min-w-0 flex-col gap-3 px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`h3`,{className:`flex flex-wrap items-center gap-2 text-ui font-semibold [overflow-wrap:anywhere]`,children:[t.name,(0,Z.jsx)(Jl,{dot:NE[t.state],children:PE[t.state]}),!n&&(0,Z.jsx)(Jl,{children:FE[t.format]})]}),(0,Z.jsx)(`p`,{className:`mt-1 break-words text-ui text-muted-foreground`,children:a}),t.consecutiveFailures>0&&(0,Z.jsxs)(`p`,{className:`mt-1 text-ui text-warning`,children:[JE(t.consecutiveFailures,`failed attempt`,`failed attempts`),` in a row.`,t.pendingCount>0?t.nextProbeAt?` Next retry ${XE(t.nextProbeAt)}.`:``:` Nothing is queued, so nothing will be retried until the next event.`]}),t.state===`paused`&&(0,Z.jsxs)(`p`,{className:`mt-1 text-ui text-muted-foreground`,children:[t.pauseReason===`project_removal`?`Paused when this project was removed from the workspace.`:`Paused.`,` New events aren’t queued.`]}),t.activationBlocked&&(0,Z.jsx)(`p`,{className:`mt-1 text-ui text-warning`,children:`Send a passing test of these settings before activating.`}),n&&t.retiredKeyExpiresAt&&(0,Z.jsxs)(`p`,{className:`mt-1 text-ui text-muted-foreground`,children:[`The previous signing key stops working `,XE(t.retiredKeyExpiresAt),`.`]})]}),fe&&fe.viewKey===o.key&&fe.receiverId===t.id&&(0,Z.jsx)(YD,{projectId:e,test:fe,openHistory:e=>h(e)},fe.deliveryId),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r&&(0,Z.jsx)(q,{size:`sm`,disabled:ge.isPending||t.activationBlocked||t.state===`disabled`&&t.lastTest!==`success`,onClick:n=>_e({title:`${t.state===`paused`?`Resume`:`Activate`} ${t.name}?`,text:`Only events from now on are sent — nothing from before ${t.state===`paused`?`resuming`:`activation`}.${t.lastTest===`transient_failure`?` The last test failed with a temporary error, so delivery may still fail.`:``}`,receiver:t,standard:t.profile===`standard`,local:t.allowLocalNetwork,run:()=>t.state===`paused`?Pe.resume(e,t.id,t.revision):Pe.activate(e,t.id,t.revision)},n.currentTarget),children:t.state===`paused`?`Resume`:`Activate`}),(0,Z.jsx)(q,{size:`sm`,variant:`outline`,disabled:ge.isPending,onClick:e=>{let n={expectedRevision:t.revision,deliveryRevision:t.deliveryRevision,operationId:crypto.randomUUID()};t.state===`suspended`?_e({title:`Test and recover?`,text:`If the test passes, ${t.name} becomes Active and sends its queued deliveries that are still current${t.pendingCount?` (${t.pendingCount} queued now)`:``}.`,run:()=>me(t,n)},e.currentTarget):ge.mutate(()=>me(t,n))},children:i}),!r&&(0,Z.jsx)(q,{size:`sm`,variant:`outline`,onClick:e=>_e(ye(t),e.currentTarget),children:`Pause`}),(0,Z.jsx)(q,{size:`sm`,variant:`outline`,onClick:e=>{M.current=e.currentTarget,x(UD(t)),w(!1),de(``),y(t),h(t.id,`settings`)},children:`Edit`}),(0,Z.jsx)(q,{size:`sm`,variant:`outline`,ref:e=>{e?F.current.set(t.id,e):F.current.delete(t.id)},onClick:()=>h(t.id),children:`History`}),(0,Z.jsxs)(lo,{children:[(0,Z.jsx)(oo,{asChild:!0,children:(0,Z.jsx)(q,{size:`icon-sm`,variant:`ghost`,"aria-label":`More actions for ${t.name}`,ref:e=>{e?ae.current.set(t.id,e):ae.current.delete(t.id)},children:(0,Z.jsx)(yo,{})})}),(0,Z.jsxs)(so,{align:`end`,className:`w-[220px]`,children:[n&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(ro,{disabled:!!t.retiredKeyExpiresAt&&Date.parse(t.retiredKeyExpiresAt)>Date.now(),onSelect:()=>_e({title:`Rotate signing key?`,text:`Old and new keys both sign deliveries for 24 hours. Install the new key in your receiver within that time.`,run:()=>Pe.rotate(e,t.id,t.revision,`graceful`)},ae.current.get(t.id)),children:[(0,Z.jsx)(pd,{}),`Rotate key`]}),(0,Z.jsxs)(ro,{onSelect:()=>_e({title:`Revoke old signing keys now?`,text:`Old keys stop signing immediately, and deliveries fail until your receiver uses the new key. Also remove old keys from your receiver — cezar can’t revoke keys it still accepts.`,run:()=>Pe.rotate(e,t.id,t.revision,`revoke_now`)},ae.current.get(t.id)),children:[(0,Z.jsx)(Md,{}),`Revoke old keys`]}),(0,Z.jsx)(eo,{})]}),(0,Z.jsxs)(ro,{variant:`destructive`,onSelect:()=>_e(be(t),ae.current.get(t.id)),children:[(0,Z.jsx)(ss,{}),`Delete`]})]})]})]})]},t.id)})]}),(Ee>0||I)&&(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`div`,{children:(0,Z.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>ue(e=>!e),children:I?`Hide deleted receivers`:`Show deleted receivers (${Ee})`})}),I&&(0,Z.jsxs)(Z.Fragment,{children:[he.error&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-ui text-danger`,children:he.error.message}),he.data?.pages.flatMap(e=>e.items).map(e=>(0,Z.jsxs)(q,{ref:t=>{t?F.current.set(e.id,t):F.current.delete(e.id)},variant:`outline`,className:`h-auto max-w-full justify-start whitespace-normal py-2 text-left font-normal [overflow-wrap:anywhere]`,onClick:()=>h(e.id),children:[e.name,` — deleted `,XE(e.deletedAt)]},e.id)),he.data&&!he.data.pages.some(e=>e.items.length)&&(0,Z.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`No deleted receivers are kept.`}),he.hasNextPage&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(q,{size:`sm`,variant:`outline`,disabled:he.isFetchingNextPage,onClick:()=>void he.fetchNextPage(),children:`Load older`})})]})]}),(0,Z.jsx)(ol,{open:v!==void 0&&!k,onOpenChange:e=>{!e&&!ge.isPending&&(y(void 0),x(UD()),w(!1),l&&h())},children:(0,Z.jsxs)(rl,{onCloseAutoFocus:e=>ee(e,M.current),className:`max-h-[90dvh] overflow-y-auto`,children:[(0,Z.jsxs)(tl,{children:[(0,Z.jsx)(il,{children:v===`new`?`Add receiver`:`Edit receiver`}),(0,Z.jsx)(al,{children:`New and changed receivers stay Inactive until you test and activate them.`})]}),v&&(0,Z.jsx)(KD,{receiver:v===`new`?void 0:v,guideHref:g.href,draft:b,setDraft:x,pending:ge.isPending,blocked:S,save:t=>{if(v===`new`)ge.mutate(()=>Pe.create(e,t));else{let n=v;_e({title:`Save changes?`,text:`Changing where or what ${n.name} sends makes it Inactive again${n.pendingCount?` and cancels ${JE(n.pendingCount,`pending delivery`,`pending deliveries`)}`:``}. A delivery already sending may still arrive. Renaming alone keeps it active.${n.format!==`cezar.json.v1`&&t.format===`cezar.json.v1`?` After saving, use Rotate key and copy the new signing key into your receiver before testing.`:``}`,run:()=>Pe.update(e,n.id,t)})}}},v===`new`?`new`:`${v.id}-${v.revision}`),De,L&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-ui text-danger`,children:L})]})}),(0,Z.jsx)(ol,{open:!!k,onOpenChange:e=>{!e&&!ge.isPending&&A(void 0)},children:(0,Z.jsxs)(rl,{onCloseAutoFocus:e=>ee(e,P.current),className:`max-h-[90dvh] overflow-y-auto`,children:[(0,Z.jsxs)(tl,{children:[(0,Z.jsx)(il,{children:k?.title}),(0,Z.jsx)(al,{children:k?.text})]}),k?.receiver&&(0,Z.jsx)(aO,{receiver:k.receiver,projectId:e}),k?.standard&&(0,Z.jsxs)(`label`,{className:`flex items-start gap-2 text-ui`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:te,onChange:e=>ne(e.target.checked)}),`I understand Standard sends task titles, questions and error text to this receiver.`]}),k?.local&&(0,Z.jsxs)(`label`,{className:`flex items-start gap-2 text-ui`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,className:`mt-0.5`,checked:re,onChange:e=>ie(e.target.checked)}),`I allow delivery to this computer or private network.`]}),De,L&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-ui text-danger`,children:L}),(0,Z.jsxs)(nl,{children:[(0,Z.jsx)(q,{variant:`outline`,disabled:ge.isPending,onClick:()=>A(void 0),children:`Cancel`}),(0,Z.jsx)(q,{variant:k?.deletesReceiver?`destructive`:`primary`,disabled:ge.isPending||S||!!k?.standard&&!te||!!k?.local&&!re,onClick:()=>k&&ge.mutate(k.run),children:ge.isPending?`Working…`:k?.deletesReceiver?`Delete`:`Confirm`})]})]})}),(0,Z.jsx)(ol,{open:!!D,onOpenChange:e=>{e||O(void 0)},children:(0,Z.jsxs)(rl,{onCloseAutoFocus:e=>ee(e,N.current),className:`max-h-[90dvh] overflow-y-auto`,children:[(0,Z.jsxs)(tl,{children:[(0,Z.jsx)(il,{children:`Save your signing key`}),(0,Z.jsx)(al,{children:`Copy it into your receiver now — it is shown only once. If you lose it, use Rotate key to get a new one (or Revoke old keys while a rotation is still overlapping).`})]}),(0,Z.jsx)(`code`,{tabIndex:0,className:`block select-text break-all rounded-md bg-muted p-3 font-mono text-ui`,children:D}),T&&(0,Z.jsx)(`p`,{role:`status`,className:`text-ui text-muted-foreground`,children:T}),(0,Z.jsxs)(nl,{children:[(0,Z.jsx)(q,{variant:`outline`,onClick:async()=>{try{if(!D||!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(D),E(`Key copied. Store it in your receiver.`)}catch{E(`Couldn’t copy — select the key and copy it manually before closing.`)}},children:`Copy key`}),(0,Z.jsx)(q,{onClick:()=>O(void 0),children:`I’ve saved the key`})]})]})}),(0,Z.jsx)(ol,{open:!!Se,onOpenChange:e=>{e||h()},children:(0,Z.jsxs)(rl,{className:`max-h-[90dvh] overflow-y-auto sm:max-w-2xl [overflow-wrap:anywhere]`,onCloseAutoFocus:e=>{let t=oe.current;t?.isConnected&&(e.preventDefault(),t.focus())},children:[(0,Z.jsxs)(tl,{className:`min-w-0`,children:[(0,Z.jsxs)(il,{children:[Se?.name,` — history`]}),(0,Z.jsx)(al,{children:`Delivery results and setting changes for this receiver.`})]}),Se&&(0,Z.jsx)(QD,{projectId:e,receiver:Se,tab:p,onTabChange:e=>h(Se.id,e),operation:ve},Se.id)]})})]})}var nO=`flex w-full min-w-0 flex-col gap-6`,rO=e=>(e.format??`cezar.json.v1`)!==`cezar.json.v1`,iO=e=>e?` ${JE(e,`pending delivery`,`pending deliveries`)} will be cancelled; one already sending may still arrive.`:``;function aO({receiver:e,projectId:t}){let n=e.preset===`custom`?e.events:e.preset===`all`?[`task.attention_required`,`task.review_ready`,`task.finished`,`task.failed`,`task.cancelled`]:[`task.attention_required`,`task.review_ready`,`task.finished`,`task.failed`],r=`text-muted-foreground`;return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 text-ui`,children:[(0,Z.jsxs)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-1 rounded-md border border-border bg-card p-3 [overflow-wrap:anywhere]`,children:[(0,Z.jsx)(`dt`,{className:r,children:`Receiver`}),(0,Z.jsx)(`dd`,{children:e.name}),(0,Z.jsx)(`dt`,{className:r,children:`Destination`}),(0,Z.jsx)(`dd`,{children:e.format===`cezar.json.v1`?`Custom receiver (signed cezar JSON)`:`${FE[e.format]} channel`}),(0,Z.jsx)(`dt`,{className:r,children:`URL`}),(0,Z.jsx)(`dd`,{children:e.destination}),(0,Z.jsx)(`dt`,{className:r,children:`Project`}),(0,Z.jsx)(`dd`,{children:t}),(0,Z.jsx)(`dt`,{className:r,children:`Message content`}),(0,Z.jsx)(`dd`,{children:IE[e.profile]}),(0,Z.jsx)(`dt`,{className:r,children:`Events`}),(0,Z.jsxs)(`dd`,{children:[RE[e.preset],`: `,n.map(e=>VD[e]).join(`, `)]}),(0,Z.jsx)(`dt`,{className:r,children:`Tasks`}),(0,Z.jsx)(`dd`,{children:LE[e.scope]}),(0,Z.jsx)(`dt`,{className:r,children:`Waiting and review delay`}),(0,Z.jsx)(`dd`,{children:zE[e.graceSeconds]}),e.format===`cezar.json.v1`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:r,children:`Private network`}),(0,Z.jsx)(`dd`,{children:e.allowLocalNetwork?`Allowed`:`Not allowed`})]}),(0,Z.jsx)(`dt`,{className:r,children:`Failures that resume automatically`}),(0,Z.jsx)(`dd`,{children:e.preset===`all`||e.includeScheduledFailures?`Included`:`Excluded`})]}),e.destination.startsWith(`http:`)&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-warning`,children:`HTTP is unencrypted — others on the network may read these messages. Use HTTPS where possible.`})]})}var oO=`/assets/tester-army-tUUSV6JM.png`,sO=`https://github.com/tester-army/e2e`,cO={AI_GATEWAY_API_KEY:`Vercel AI Gateway`,OPENAI_API_KEY:`OpenAI`,ANTHROPIC_API_KEY:`Anthropic`,OPENROUTER_API_KEY:`OpenRouter`},lO=new Set([`queued`,`running`,`waiting`]);function uO(e,t,n,r){if(lO.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 dO({ok:e,children:t}){return(0,Z.jsxs)(`li`,{className:`flex items-center gap-2 text-sm`,"data-ok":e,children:[e?(0,Z.jsx)(Wa,{className:`size-4 text-success`,"aria-hidden":!0}):(0,Z.jsx)(bd,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:e?void 0:`text-muted-foreground`,children:t})]})}function fO(){let e=V(),t=Mr(),n=g(),r=He(n.data?.setup?.runId),[i,a]=(0,X.useState)(void 0),[o,s]=(0,X.useState)(``),[c,l]=(0,X.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&&lO.has(u),p=n.data?.credentials??[],m=i??p[0]??`AI_GATEWAY_API_KEY`,h=!!(n.data?.configFile&&n.data.workflow),_=B({mutationFn:async()=>({projectId:fr(),runId:(await Je(o?{credential:{name:m,value:o}}:{})).runId}),onSuccess:async({projectId:n,runId:r})=>{s(``),l(null),await Promise.all([e.invalidateQueries({queryKey:z.e2e.allFor(n??``)}),e.invalidateQueries({queryKey:z.secrets.allFor(n??``)})]),Y(`e2e setup started`),fr()===n&&t(Br(n,`/tasks/${r}`))},onError:e=>l(e.message)});return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,"data-slot":`e2e-settings`,children:[(0,Z.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Z.jsx)(`img`,{src:oO,alt:``,width:40,height:40,className:`size-10 shrink-0 rounded-md`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold`,children:`TesterArmy e2e`}),(0,Z.jsx)(Jl,{"data-slot":`e2e-badge`,"data-state":f?`setting-up`:h?`installed`:`none`,dot:f?`pending`:h?`success`:`neutral`,pulse:f,children:f?`Setting up`:h?`Installed`:`Not set up`})]}),(0,Z.jsx)(`p`,{className:`text-label text-muted-foreground`,children:`Agentic browser end-to-end testing`})]}),(0,Z.jsxs)(`a`,{href:sO,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-label text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,children:[`tester-army/e2e `,(0,Z.jsx)(xo,{className:`size-3`,"aria-hidden":!0})]})]}),(0,Z.jsxs)(`p`,{className:`mt-3 text-ui text-muted-foreground`,children:[`cezar installs it for this project, points it at your dev server, writes a smoke test and an`,` `,(0,Z.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,Z.jsx)(cl,{label:`Loading status…`,className:`mt-4`,children:(0,Z.jsx)(ul,{lines:2})}):null,n.isError?(0,Z.jsx)(`p`,{role:`alert`,className:`mt-4 text-ui text-danger`,children:n.error.message}):null,n.data?(0,Z.jsxs)(`ul`,{className:`mt-4 flex flex-col gap-1.5`,"aria-label":`e2e status`,children:[(0,Z.jsx)(dO,{ok:!!n.data.configFile,children:n.data.configFile?(0,Z.jsxs)(Z.Fragment,{children:[`Configured (`,(0,Z.jsx)(`code`,{children:n.data.configFile}),`)`]}):`Not configured in this checkout`}),(0,Z.jsxs)(dO,{ok:n.data.workflow,children:[(0,Z.jsx)(`code`,{children:`implement-and-e2e`}),` workflow `,n.data.workflow?`available`:`not added yet`]}),(0,Z.jsx)(dO,{ok:p.length>0,children:p.length>0?(0,Z.jsxs)(Z.Fragment,{children:[`Model key: `,(0,Z.jsx)(`code`,{children:p.join(`, `)})]}):`No model key — smoke tests run without one; agent steps need one`})]}):null,n.data?.setup&&u?(0,Z.jsxs)(`p`,{className:`mt-3 text-ui`,"data-slot":`e2e-setup-run`,"data-status":u,children:[uO(u,!!n.data.configFile,r.data?.branch,d),` `,d&&!n.data.configFile?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`a`,{className:`underline`,href:d,target:`_blank`,rel:`noreferrer`,children:`Open the draft PR`}),` · `]}):null,(0,Z.jsx)(U,{className:`underline`,to:Br(fr(),`/tasks/${n.data.setup.runId}`),children:`Open the setup task`})]}):null]}),(0,Z.jsxs)(`form`,{className:`rounded-lg border border-border bg-card p-4`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),_.mutate()},children:[(0,Z.jsx)(`h2`,{className:`text-ui font-semibold`,children:h?`Set up again`:`Set up e2e`}),(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5 text-ui`,children:[(0,Z.jsx)(`label`,{htmlFor:`e2e-provider`,children:`Model provider`}),(0,Z.jsxs)(Za,{value:m,onValueChange:e=>a(e),children:[(0,Z.jsx)(Ya,{id:`e2e-provider`,size:`sm`,"aria-label":`Model provider`,"data-slot":`e2e-provider`,"data-value":m,className:`w-full max-w-sm`,children:(0,Z.jsx)(Xa,{})}),(0,Z.jsx)(Ja,{position:`popper`,children:Tr.map(e=>(0,Z.jsxs)(J,{value:e,children:[cO[e],` (`,e,`)`,p.includes(e)?` — stored`:``]},e))})]})]}),(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5 text-ui`,children:[(0,Z.jsxs)(`label`,{htmlFor:`e2e-key`,children:[`API key `,(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`(optional)`})]}),(0,Z.jsx)(gl,{id:`e2e-key`,"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:`h-8 max-w-sm`})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-label text-muted-foreground`,children:`Stored encrypted as a project secret for check steps only — never handed to an agent session.`}),c?(0,Z.jsx)(`p`,{role:`alert`,className:`mt-2 text-ui text-danger`,children:c}):null,(0,Z.jsx)(`div`,{className:`mt-3`,children:(0,Z.jsx)(q,{type:`submit`,disabled:_.isPending||f||!n.data,children:f?`Setup in progress…`:h?`Set up again`:`Set up e2e`})})]})]})}function pO(){return(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,"data-slot":`integrations-settings`,children:[(0,Z.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,Z.jsxs)(Yc,{defaultValue:`test-frameworks`,children:[(0,Z.jsx)(Jc,{variant:`line`,"data-slot":`integrations-tabs`,children:(0,Z.jsx)(Kc,{value:`test-frameworks`,children:`Test frameworks`})}),(0,Z.jsx)(qc,{value:`test-frameworks`,className:`pt-4`,children:(0,Z.jsx)(fO,{})})]})]})}function mO(){return null}var hO=(e,t,n)=>({id:e,title:t,description:``,icon:Oa,component:mO,scope:`global`,redirect:n}),gO=[{id:`instructions`,title:`Instructions`,description:`What you write for the models: system prompt, branch naming, prompt templates.`,icon:Bi,component:EE,scope:`project`},{id:`tracker`,title:`Issue tracker`,description:`Connect this project to Jira or Linear.`,icon:Ld,component:zD,scope:`project`},{id:`secrets`,title:`Secrets`,description:`Encrypted values for this project’s check steps and cezar — never for agents.`,icon:pd,component:WT,scope:`project`},{id:`webhooks`,title:`Webhooks`,description:`Send task updates to Slack, Discord or your own endpoint.`,icon:zd,component:eO,scope:`project`},{id:`agents`,title:`Agents`,description:`Providers, default runner and models.`,icon:Oa,component:Rw,scope:`project`},{id:`tasks`,title:`Tasks`,description:`Development model, landing, required checks, base branch, review, live titles.`,icon:gd,component:xD,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:nd,component:XC,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:id,component:LD,scope:`project`},{id:`bookmarklets`,title:`Bookmarklets`,description:`Launch skills from a GitHub PR or issue.`,icon:Gu,component:AE,scope:`project`},{id:`integrations`,title:`External integrations`,description:`Third-party tools cezar installs and wires into this project — test frameworks first.`,icon:Wu,component:pO,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Instance name and logo, theme, density and reading width.`,icon:Ed,component:uT,scope:`global`,group:`you`},{id:`keyboard`,title:`Keyboard`,description:`Shortcuts for task commands, with their current bindings.`,icon:md,component:OE,scope:`global`,group:`you`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:Uu,component:ME,scope:`global`,group:`you`},{id:`agents`,title:`Agents`,description:`Which coding agents run your tasks, with which logins, models and skills. A project can override any of this in its own Agents page.`,icon:Oa,component:Ow,scope:`global`,group:`workspace`},{id:`behaviour`,title:`Behaviour`,description:`How hard this machine works, how monitoring wakes up, and which approvals ask you first.`,icon:Nd,component:RT,scope:`global`,group:`workspace`},{id:`data-privacy`,title:`Data & privacy`,description:`Secrets shared by every project, configuration transfer, and what cezar shares with its maintainers.`,icon:jd,component:bE,scope:`global`,group:`workspace`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:cd,component:iD,scope:`global`,group:`workspace`},hO(`manager`,`Manager`,{to:`behaviour`,hash:`manager`}),hO(`resources`,`Resources`,{to:`behaviour`,hash:`resources`}),hO(`accounts`,`Agent accounts`,{to:`agents`,hash:`accounts`}),hO(`skills`,`Skills`,{to:`agents`,hash:`skills`}),hO(`global-instructions`,`Instructions`,{to:`agents`,hash:`global-instructions`}),hO(`workspace-secrets`,`Secrets`,{to:`data-privacy`,hash:`workspace-secrets`}),hO(`transfer`,`Transfer`,{to:`data-privacy`,hash:`transfer`}),hO(`privacy`,`Privacy`,{to:`data-privacy`,hash:`privacy`})];new Map(gO.flatMap(e=>e.redirect?[[e.id,e.redirect]]:[]));function _O(e,t){return gO.filter(n=>!n.hidden&&n.scope===e&&!(t?.singleProject===!0&&n.id===`projects`))}function vO(e){return{global:_O(`global`,e).filter(e=>!e.redirect),project:_O(`project`,e).filter(e=>!e.redirect)}}function yO(e,t){return vO(t).global.filter(t=>t.group===e)}function bO(e){let t=gO.filter(t=>t.scope===`project`&&!t.hidden&&!t.redirect&&!e.some(e=>e.id===t.id));if(t.length===0)return null;let n=t.map(e=>e.title);return`${n.length===1?n[0]:`${n.slice(0,-1).join(`, `)} and ${n[n.length-1]}`} ${n.length===1?`appears`:`appear`} when the project unlocks ${n.length===1?`it`:`them`}`}var xO=null;function SO(e){_c(e.pathname)||(xO={pathname:e.pathname,search:e.search,hash:e.hash})}function CO(){return xO}function wO(){let e=E(),t=!e.isError&&e.data?.capabilities?.webhooks===!0,n=e.data?.capabilities?.webhooksUnavailableReason===`unsupported_platform`,r=fx(Nr()??`default`,t),i=r.data?.receivers??[],a=i.filter(e=>[`suspended`,`disabled`].includes(e.state)).length,o=i.filter(e=>e.state===`inactive`).length,s=i.reduce((e,t)=>e+t.pendingCount,0),c=t&&!n&&!r.error&&r.data?.webhookHealth&&[`degraded`,`unavailable`].includes(r.data.webhookHealth.status);return(0,Z.jsx)($,{slot:`webhook-card`,label:`Webhooks`,description:`Task updates sent to Slack, Discord or your own endpoint.`,children:(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5 text-ui sm:items-end sm:text-right`,children:[e.isError?(0,Z.jsx)(`p`,{children:`Status unavailable — could not load server health.`}):e.data?n?(0,Z.jsx)(`p`,{children:`Not available on this server’s platform.`}):t?r.isPending?(0,Z.jsx)(cl,{label:`Loading receivers…`,children:(0,Z.jsx)(ll,{className:`my-1 h-3.5 w-44`})}):r.error?(0,Z.jsx)(`p`,{className:`text-danger`,children:`Status unavailable — open Webhooks for details.`}):i.length?(0,Z.jsxs)(`p`,{children:[i.filter(e=>e.state===`active`).length,` active · `,i.filter(e=>e.state===`paused`).length,` paused`,o?` · ${o} inactive`:``,a?(0,Z.jsxs)(Z.Fragment,{children:[` · `,(0,Z.jsxs)(`span`,{className:`text-warning`,children:[a,` need attention`]})]}):``,s?` · ${s} pending`:``]}):(0,Z.jsx)(`p`,{children:`No receivers yet.`}):(0,Z.jsx)(`p`,{children:`Off on this server.`}):(0,Z.jsx)(cl,{label:`Loading webhook status…`,children:(0,Z.jsx)(ll,{className:`my-1 h-3.5 w-44`})}),c&&(0,Z.jsx)(`p`,{role:`status`,className:`text-label text-warning`,children:r.data.webhookHealth.reason||`Webhook delivery needs attention. Open Webhooks for details.`}),(0,Z.jsx)(G,{className:`text-label text-muted-foreground underline underline-offset-2 hover:text-foreground`,to:`/settings/webhooks`,children:t&&!n?`Manage webhooks`:`Open webhook settings`})]})})}function TO(){let e=Nr(),t=dy(i().data,e,E().data);return e===null?null:t?.projects.find(t=>t.id===e)?.root??null}function EO(e){Xl(e).then(()=>Y(`Project folder copied`)).catch(()=>Y(e))}function DO(){let e=TO();return e===null?null:(0,Z.jsx)($,{stacked:!0,slot:`project-folder-row`,label:`Project folder`,description:`Where this project lives on disk. Every task worktree, git command and agent run resolves against it.`,children:(0,Z.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`field`,className:`flex flex-wrap items-center gap-3`,children:[(0,Z.jsx)(`span`,{"data-slot":`project-location-path`,className:`min-w-0 flex-1 font-mono text-ui break-all text-foreground`,children:e}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Z.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`project-location-copy`,"aria-label":`Copy the project folder path`,onClick:()=>EO(e),children:`Copy`}),(0,Z.jsx)(kO,{root:e})]})]})})}function OO(){let e=TO();return e===null?null:(0,Z.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`nav`,className:`mt-auto px-2.5 pt-3`,children:[(0,Z.jsx)(`p`,{className:`text-meta text-soft-foreground`,children:`Project folder`}),(0,Z.jsx)(`button`,{type:`button`,"data-action":`project-location-copy`,"aria-label":`Copy the project folder path ${e}`,title:e,onClick:()=>EO(e),className:`block w-full truncate text-left font-mono text-meta text-muted-foreground transition-colors hover:text-foreground`,children:e})]})}function kO({root:e}){let t=j(),n=B({mutationFn:e=>ee(e),onError:e=>Y(e.message,{tone:`danger`})}),r=(t.data?.targets??[]).filter(e=>Aa(e.id)===void 0).map(e=>({target:e}));return r.length===0?null:(0,Z.jsx)(Pa,{slot:`project-location-open`,label:`Open with`,triggerVariant:`outline`,disabled:n.isPending,choices:r,onPick:e=>n.mutate(e,{onSuccess:()=>Y(`Opening the project folder in ${r.find(t=>t.target.id===e)?.target.label??e}`)})})}function AO(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function jO({capabilities:e}){let t=Nr(),n=i(),r=E(),a=tn();if(n.isPending)return(0,Z.jsx)(cl,{label:`Loading project…`,"data-slot":`project-general-loading`,children:(0,Z.jsx)(sl,{rows:3})});if(n.isError)return(0,Z.jsxs)(`p`,{"data-slot":`project-general-error`,className:`text-ui text-danger`,children:[`Could not read the project registry — `,n.error.message]});let o=dy(n.data,t,r.data),s=o?.projects.find(e=>e.id===t);if(!o||!s)return null;let c=e?.singleProject!==!0&&s.unregistered!==!0;return(0,Z.jsxs)(`div`,{"data-slot":`project-general`,className:`flex w-full flex-col gap-5`,children:[(0,Z.jsxs)(Q,{id:`project`,title:`Project`,children:[(0,Z.jsx)(DO,{}),(0,Z.jsx)(MO,{project:s,canRemove:c}),(0,Z.jsx)(wO,{}),s.unregistered?(0,Z.jsx)($,{label:`Add to your projects`,description:`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,Z.jsx)(lD,{root:s.root,name:s.name,notAddable:s.notAddable===!0})}):null]}),c?(0,Z.jsxs)(Q,{id:`registry`,title:`In this workspace`,children:[(0,Z.jsx)($,{label:`Max parallel tasks`,description:a.data?`How many of this project's tasks may run at once — leave it empty to inherit the workspace limit. The workspace limit (${a.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:a.data?(0,Z.jsx)(fD,{project:s,workspaceMax:a.data.resources.maxParallel}):(0,Z.jsx)(`p`,{className:`text-ui text-muted-foreground`,children:`Loading the workspace limit…`})}),(0,Z.jsx)($,{stacked:!0,label:`Tags`,description:`Labels that 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.`,children:(0,Z.jsx)(`div`,{className:`max-w-sm`,"data-slot":`project-general-tags`,children:(0,Z.jsx)(dD,{project:s,vocabulary:Lt(o.projects)})})}),(0,Z.jsx)(NO,{project:s,bootProject:o.bootProject})]}):null]})}function MO({project:e,canRemove:t}){return(0,Z.jsx)($,{stacked:!0,label:`Registry entry`,description:`What cezar knows about this checkout — re-probed every time the project list is read.`,children:(0,Z.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-[8rem_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-ui`,children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Name`}),(0,Z.jsx)(`dd`,{className:`min-w-0 truncate text-foreground`,children:e.name}),(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Status`}),(0,Z.jsxs)(`dd`,{"data-slot":`project-general-status`,className:`flex items-center gap-1.5 text-foreground`,children:[e.status===`missing`?(0,Z.jsx)(Pl,{tone:`danger`}):null,(0,Z.jsxs)(`span`,{children:[nD[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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Branch`}),(0,Z.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-ui text-foreground`,children:e.branch})]}),e.unregistered?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`In your projects`}),(0,Z.jsx)(`dd`,{"data-slot":`project-general-unregistered`,className:`text-foreground`,children:`No — served because cezar was started here`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Added`}),(0,Z.jsxs)(`dd`,{className:`text-foreground`,children:[AO(e.addedAt),(0,Z.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]}),(0,Z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Last opened`}),(0,Z.jsx)(`dd`,{className:`text-foreground`,children:AO(e.lastOpenedAt)})]})]})})}function NO({project:e,bootProject:t}){let[n,r]=(0,X.useState)(null),i=QE(),a=Mr(),o=e.id===t;return(0,Z.jsxs)($,{label:`Remove from workspace`,description:(0,Z.jsxs)(Z.Fragment,{children:[`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.`,o?(0,Z.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`mt-1 block`,children:"cezar is serving this project — stop cezar and run `cezar projects remove` to drop it."}):null]}),children:[(0,Z.jsxs)(q,{type:`button`,variant:`danger-ghost`,size:`sm`,"data-action":`project-general-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,disabled:o||i.isPending,onClick:()=>r(e),children:[`Remove `,e.name]}),(0,Z.jsx)($E,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function PO(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}var FO=`/settings/global`;function IO(e,t){let n=`/p/${encodeURIComponent(e)}/settings`;return t===void 0?n:`${n}/${t}`}function LO(e){let{pathname:t}=Kr(),n=i().data,r=E().data,a=jr(t),o=n?.bootProject??r?.bootProject??null,s=X.useMemo(()=>[...n?.projects??[]].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt)).map(({id:e,name:t,status:n})=>({id:e,name:t,status:n})),[n]),c=X.useMemo(()=>{if(a!==null){let e=s.find(e=>e.id===a);if(e)return e;let t=a===o?r?.repo?.root.replace(/[\\/]+$/,``).split(/[\\/]/).pop():void 0;return{id:a,name:t||a,status:`ok`}}return s.find(e=>e.id===o)??s[0]??null},[s,a,o,r]),l=c!==null&&s.some(e=>e.id===c.id);return{projects:s,activeProjectId:a,current:c,bootProjectId:o,switchable:e?.singleProject!==!0&&s.length>1&&l}}function RO(e){let t=Mr();return X.useCallback(()=>{let n=CO();if(n!==null){t(n);return}t(e===null?`/`:`/p/${encodeURIComponent(e)}/`)},[t,e])}function zO(e){X.useEffect(()=>{let t=t=>{t.key!==`Escape`||t.defaultPrevented||(t.target instanceof Element?t.target:null)?.closest(`input, textarea, select, [contenteditable]`)||document.querySelector(`[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"]`)||e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}var BO=5e3;function VO(){let{hash:e,pathname:t}=Kr();X.useEffect(()=>{if(!e)return;let t=e.slice(1),n=()=>{let e=document.getElementById(t);return e?.scrollIntoView?.({block:`start`}),e!==null};if(n()||typeof MutationObserver>`u`)return;let r=new MutationObserver(()=>{n()&&a()}),i=setTimeout(()=>a(),BO),a=()=>{r.disconnect(),clearTimeout(i)};return r.observe(document.body,{childList:!0,subtree:!0}),a},[e,t])}var HO=(e,t=!1)=>H(`flex h-[34px] shrink-0 items-center gap-2.5 rounded-md px-2.5 text-ui font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,t&&`h-11`,e&&`bg-muted font-semibold text-foreground`),UO=X.createContext(!1);function WO({children:e}){return(0,Z.jsx)(`p`,{className:`shrink-0 px-2.5 pt-3 pb-1 eyebrow text-soft-foreground`,children:e})}function GO({sections:e,activeId:t}){let n=X.useContext(UO);return(0,Z.jsx)(Z.Fragment,{children:e.map(e=>(0,Z.jsxs)(Vr,{to:PO(`global`,e.id),"data-section":e.id,className:HO(e.id===t,n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":`true`,className:`size-4 shrink-0`}),e.title]},e.id))})}function KO({project:e,sections:t,active:n,activeId:r}){let i=X.useContext(UO);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Z.jsxs)(Vr,{to:IO(e.id),end:!0,"data-slot":`settings-project-general`,"data-project":e.id,className:HO(n&&r===null,i),children:[(0,Z.jsx)(Nd,{"aria-hidden":`true`,className:`size-4 shrink-0`}),`General`]}),t.map(t=>(0,Z.jsxs)(Vr,{to:Br(e.id,PO(`project`,t.id)),"data-project-section":t.id,"data-project":e.id,className:HO(n&&t.id===r,i),children:[(0,Z.jsx)(t.icon,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t.title]},t.id))]})}function qO({project:e}){return(0,Z.jsxs)(`p`,{"data-slot":`settings-project-missing`,"data-project":e.id,className:`px-2.5 py-1.5 text-meta text-soft-foreground`,children:[e.name,` is gone — remove it in Projects`]})}function JO({projects:e,current:t,switchable:n,openSectionId:r}){let i=X.useContext(UO),a=Mr(),[o,s]=X.useState(!1),c=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Pl,{tone:t.status===`missing`?`danger`:t.status===`not-git`?`pending`:`success`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:t.name})]}),l=H(`flex w-full items-center gap-2 rounded-[7px] border border-border bg-card-2 px-2.5 text-ui font-semibold text-foreground`,i?`h-11`:`h-9`);return n?(0,Z.jsxs)(Ts,{open:o,onOpenChange:s,children:[(0,Z.jsx)(vs,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`settings-project-switcher`,"data-project":t.id,"aria-label":`Project: ${t.name}. Switch project`,className:H(l,`transition-colors hover:bg-muted`),children:[c,(0,Z.jsx)(Ri,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(Cs,{align:`start`,sideOffset:6,className:`w-64 p-0`,children:(0,Z.jsxs)(ql,{label:`Switch project`,children:[(0,Z.jsx)(zl,{"aria-label":`Find a project`,placeholder:`Find a project…`}),(0,Z.jsxs)(Kl,{"data-slot":`settings-project-list`,className:`max-h-64`,children:[(0,Z.jsx)(Gl,{children:`No project matches.`}),e.map(e=>{let n=e.id===t.id,i=e.status===`missing`;return(0,Z.jsxs)(Wl,{value:`${e.name} ${e.id}`,"data-slot":`settings-project-option`,"data-project":e.id,"data-current":n?``:void 0,"aria-selected":n,disabled:i,onSelect:()=>{s(!1),n||a(IO(e.id,r??void 0))},children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),i?(0,Z.jsx)(`span`,{className:`shrink-0 text-micro text-danger`,children:`folder not found`}):n?(0,Z.jsx)(Wa,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id)})]})]})})]}):(0,Z.jsx)(`div`,{"data-slot":`settings-project-switcher`,"data-project":t.id,"data-static":``,className:l,children:c})}function YO(e){let[t,n]=Km();return(0,Z.jsx)(rh,{slot:`settings-sidebar`,width:t,onWidthChange:n,children:(0,Z.jsx)(ZO,{...e})})}function XO({onOpenChange:e,...t}){let{pathname:n}=Kr();return X.useEffect(()=>{e(!1)},[n,e]),X.useEffect(()=>{let t=window.matchMedia?.(`(min-width: 768px)`);if(!t)return;let n=t=>{t.matches&&e(!1)};return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),(0,Z.jsx)(ah,{slot:`settings-mobile-drawer`,title:`Settings navigation`,children:e=>(0,Z.jsx)(ZO,{...t,headerAction:e})})}function ZO({scope:e,activeId:t,capabilities:n,rail:r,leave:i,headerAction:a}){let o=vO(n).project,s=!!a,c=e===`global`,l=E().data,u=l?.version??null,d=l?.latestVersion??null,f=le().data,p=f?.available?f.count??null:null,m=tn().data?.branding,h=m?.name??`cezar`,g=m?.logoUrl??null,_=bO(o);return(0,Z.jsx)(UO.Provider,{value:s,children:(0,Z.jsxs)(`div`,{"data-slot":`settings-sidebar-content`,className:`flex min-h-0 flex-1 flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-[9px] px-3.5 pt-3.5 pb-2.5`,children:[(0,Z.jsx)(zf,{name:h,logoUrl:g}),(0,Z.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`settings-back`,title:`Back (Esc)`,onClick:i,className:H(`-mr-2 ml-auto shrink-0`,s?`h-11`:`h-[26px]`),children:[(0,Z.jsx)(ua,{"aria-hidden":`true`,className:`size-4`}),`Back`]}),a?(0,Z.jsx)(`div`,{className:`shrink-0`,children:a}):null]}),(0,Z.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav`,"data-scope":e,className:`flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto overscroll-contain px-2.5 py-1.5`,children:[(0,Z.jsxs)(`div`,{"data-slot":`settings-nav-group`,"data-group":`you`,className:`flex flex-col gap-0.5`,children:[(0,Z.jsx)(WO,{children:`You`}),(0,Z.jsx)(GO,{sections:yO(`you`,n),activeId:c?t:null})]}),(0,Z.jsxs)(`div`,{"data-slot":`settings-nav-group`,"data-group":`workspace`,className:`flex flex-col gap-0.5`,children:[(0,Z.jsx)(WO,{children:`Workspace`}),(0,Z.jsx)(`p`,{"data-slot":`settings-workspace-note`,className:`-mt-1 shrink-0 px-2.5 pb-1.5 text-xs text-muted-foreground`,children:`Stored in ~/.cezar`}),(0,Z.jsx)(GO,{sections:yO(`workspace`,n),activeId:c?t:null})]}),r.current?(0,Z.jsxs)(`div`,{"data-slot":`settings-nav-group`,"data-group":`project`,className:`flex shrink-0 flex-col gap-0.5`,children:[(0,Z.jsx)(WO,{children:`Project`}),(0,Z.jsx)(`div`,{className:`px-0.5 pb-1`,children:(0,Z.jsx)(JO,{projects:r.projects,current:r.current,switchable:r.switchable,openSectionId:e===`project`?t:null})}),r.current.status===`missing`?(0,Z.jsx)(qO,{project:r.current}):(0,Z.jsx)(KO,{project:r.current,sections:o,active:r.current.id===r.activeProjectId,activeId:t}),_?(0,Z.jsx)(`p`,{"data-slot":`settings-project-gated-hint`,className:`px-2.5 pt-2 text-meta leading-snug text-soft-foreground`,children:_}):null]}):null,e===`project`?(0,Z.jsx)(OO,{}):null]}),(0,Z.jsx)(Nm,{brandName:h,version:u,latestVersion:d,starCount:p})]})})}function QO({scope:e,activeId:t,capabilities:n}){let r=vO(n)[e],i=e===`global`?Vr:Hr,a=e=>H(`rounded-full border px-3 py-1.5 text-ui font-medium whitespace-nowrap transition-colors`,e?`border-transparent bg-contrast text-contrast-foreground`:`border-border bg-card text-muted-foreground`);return(0,Z.jsxs)(`nav`,{"aria-label":`Sections of this area`,"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:[e===`project`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(U,{to:FO,"data-slot":`settings-all-pill`,className:a(!1),children:`‹ Workspace`}),(0,Z.jsx)(i,{to:`/settings`,end:!0,"data-slot":`settings-nav-index`,className:a(!1),children:`General`})]}):null,r.map(n=>(0,Z.jsx)(i,{to:PO(e,n.id),"data-section":n.id,className:a(n.id===t),children:n.title},n.id))]})}function $O({title:e,projectName:t}){return(0,Z.jsx)(`div`,{"data-slot":`settings-mobile-bar`,className:`shrink-0 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,Z.jsxs)(`div`,{className:`flex h-[52px] items-center gap-1 px-2`,children:[(0,Z.jsx)(Ci,{asChild:!0,children:(0,Z.jsx)(q,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Open settings menu`,className:`size-11`,children:(0,Z.jsx)(yd,{"aria-hidden":`true`,className:`size-[17px]`})})}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`truncate text-body font-semibold text-muted-foreground`,children:t}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-body text-soft-foreground`,children:`/`})]}):null,(0,Z.jsx)(`span`,{className:`truncate text-body font-semibold`,children:e})]})]})})}function ek({scope:e,section:t,title:n,beside:r}){let i=t?.description??(e===`project`?`Project settings`:null);return(0,Z.jsxs)(`header`,{"data-slot":`settings-header`,className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`span`,{className:`hidden min-w-0 items-baseline gap-2 md:flex`,children:[r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`truncate text-xl font-semibold text-muted-foreground`,children:r}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-xl font-normal text-soft-foreground`,children:`/`})]}):null,(0,Z.jsx)(`h1`,{className:`truncate text-xl font-semibold`,children:n})]}),i?(0,Z.jsx)(`p`,{"data-slot":`settings-description`,className:`max-w-[60ch] text-ui text-muted-foreground`,children:i}):null]})}function tk({scope:e,section:t,capabilities:n,routeName:r,children:i}){let a=LO(n),o=RO(a.activeProjectId??a.bootProjectId);zO(o),VO();let s=(a.activeProjectId===null?null:a.current?.name)??a.activeProjectId,c=t?.title??(e===`global`?`Settings`:s??`Settings`),l=e===`project`&&t!==null?s:null,[u,d]=X.useState(!1),f={scope:e,activeId:t?.id??null,capabilities:n,rail:a,leave:o};return(0,Z.jsx)(wi,{open:u,onOpenChange:d,children:(0,Z.jsxs)(`div`,{"data-route":r,className:`flex h-full min-h-full`,children:[(0,Z.jsx)(YO,{...f}),(0,Z.jsx)(XO,{...f,onOpenChange:d}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col overflow-y-auto overscroll-contain`,children:[(0,Z.jsx)($O,{title:c,projectName:l}),t?(0,Z.jsx)(QO,{scope:e,activeId:t.id,capabilities:n}):null,(0,Z.jsxs)(`div`,{"data-slot":`settings-content`,className:`mx-auto flex w-full max-w-[720px] min-w-0 flex-1 flex-col gap-5 px-4 pt-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:px-8 md:pt-6 md:pb-8`,children:[(0,Z.jsx)(ek,{scope:e,section:t,title:c,beside:l}),i]})]})]})})}function nk({section:e,scope:t,capabilities:n}){let r=Kr();if(e.redirect)return(0,Z.jsx)(Rr,{to:{pathname:PO(t,e.redirect.to),search:r.search,hash:r.hash||(e.redirect.hash?`#${e.redirect.hash}`:``)},replace:!0});let i=e.component;return(0,Z.jsx)(tk,{scope:t,section:e,capabilities:n,routeName:t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,children:(0,Z.jsx)(i,{})})}var rk=`flex items-center gap-3.5 rounded-lg border border-border bg-card p-4 shadow-xs transition-colors hover:bg-card-2`;function ik({section:e}){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(G,{to:PO(`project`,e.id),"data-section":e.id,className:rk,children:[(0,Z.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-muted text-muted-foreground`,children:(0,Z.jsx)(e.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,Z.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:e.description})]}),(0,Z.jsx)(Ga,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})})}function ak({scope:e,capabilities:t}){let n=Kr(),r=vO(t)[e];if(e===`global`){let e=r[0];return(0,Z.jsx)(Rr,{to:{pathname:PO(`global`,e.id),search:n.search,hash:n.hash},replace:!0})}return(0,Z.jsxs)(tk,{scope:e,section:null,capabilities:t,routeName:`settings`,children:[(0,Z.jsx)(jO,{capabilities:t}),(0,Z.jsx)(`ul`,{"data-slot":`settings-index`,className:`mt-2 flex w-full flex-col gap-2.5 md:hidden`,children:r.map(e=>(0,Z.jsx)(ik,{section:e},e.id))})]})}var ok={archive:`Archive`,restore:`Restore`,read:`Mark read`,unread:`Mark unread`};function sk(e,t){return t===`restore`?!!e.archived:t===`archive`?!e.archived&&Ba(e.status):Fa(e)&&ka(e)===(t===`read`)}function ck(e,t){let[n,r]=X.useState(new Set),[i,a]=X.useState(!1),[o,s]=X.useState(``),c=X.useRef(!1),l=e.filter(e=>n.has(e.id));return X.useEffect(()=>{let t=new Set(e.map(e=>e.id));r(e=>{let n=new Set([...e].filter(e=>t.has(e)));return n.size===e.size?e:n})},[e]),{ids:n,selected:l,busy:i,message:o,toggle:X.useCallback(e=>{c.current||r(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},[]),clear:()=>{c.current||r(new Set)},toggleAll:()=>{c.current||r(l.length===e.length?new Set:new Set(e.map(e=>e.id)))},apply:X.useCallback(async(e,n)=>{if(c.current||!t)return;c.current=!0,a(!0),s(`${ok[e]} in progress…`);let i=n.filter(t=>sk(t,e)),o=new Set,l=[];for(let n of i)try{await t(n,e),o.add(n.id)}catch(e){l.push(`${Ge(n)}: ${e instanceof Error?e.message:`Request failed`}`)}r(e=>new Set([...e].filter(e=>!o.has(e)))),s(`${ok[e]}: ${o.size} succeeded, ${n.length-i.length} skipped, ${l.length} failed.${l.length?` ${l.join(`; `)}`:``}`),c.current=!1,a(!1)},[t])}}function lk({checked:e,mixed:t=!1,label:n,disabled:r,onChange:i}){let a=X.useRef(null);return X.useEffect(()=>{a.current&&(a.current.indeterminate=t)},[t]),(0,Z.jsx)(`input`,{ref:a,type:`checkbox`,"aria-label":n,checked:e,disabled:r,onChange:i,className:`size-4 shrink-0 cursor-pointer accent-primary focus-visible:outline-2 focus-visible:outline-ring`})}function uk({displayed:e,selection:t,archived:n,selecting:r=!1,onToggleSelecting:i}){let{selected:a,busy:o}=t,s=[n?`restore`:`archive`,`read`,`unread`];return(0,Z.jsxs)(`div`,{"data-slot":`tasks-selection`,"data-selecting":r||a.length>0||void 0,className:`mb-3 flex flex-wrap items-center gap-2 text-sm`,children:[i?(0,Z.jsxs)(q,{type:`button`,size:`sm`,variant:r?`outline`:`ghost`,"aria-pressed":r,"data-slot":`select-toggle`,disabled:o,onClick:i,children:[(0,Z.jsx)(gd,{className:`size-3.5`,"aria-hidden":`true`}),`Select`]}):null,(0,Z.jsx)(lk,{label:`Select displayed tasks`,checked:e.length>0&&a.length===e.length,mixed:a.length>0&&a.length<e.length,disabled:o||e.length===0,onChange:t.toggleAll}),a.length>0?(0,Z.jsx)(`span`,{children:`${a.length} selected`}):null,a.length>0?(0,Z.jsxs)(Z.Fragment,{children:[s.map(e=>{let n=a.filter(t=>sk(t,e)).length;return(0,Z.jsxs)(q,{type:`button`,size:`sm`,variant:`outline`,disabled:o||n===0,onClick:()=>void t.apply(e,a),children:[ok[e],` (`,n,`)`]},e)}),(0,Z.jsx)(q,{type:`button`,size:`sm`,variant:`ghost`,disabled:o,onClick:t.clear,children:`Clear selection`}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Only eligible selected tasks are changed; others are skipped.`})]}):null,(0,Z.jsx)(`p`,{role:`status`,"aria-label":`Task action status`,"aria-live":`polite`,className:`w-full empty:hidden text-xs text-muted-foreground`,children:t.message})]})}function dk({run:e,busy:t,onAction:n}){let r=[e.archived?`restore`:`archive`,ka(e)?`read`:`unread`],i={archive:Zi,restore:Hu,read:So,unread:td};return(0,Z.jsx)(`span`,{className:`inline-flex shrink-0 items-center gap-1`,children:r.filter(t=>sk(e,t)).map(r=>{let a=i[r],o=`${ok[r]}: ${Ge(e)}`;return(0,Z.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,title:o,"aria-label":o,disabled:t,onClick:()=>void n(r,[e]),children:(0,Z.jsx)(a,{className:`size-3.5`,"aria-hidden":`true`})},r)})})}function fk({slot:e,label:t,options:n,selected:r,onToggle:i,onClear:a,searchPlaceholder:o,emptyLabel:s=`Nothing to filter by`}){let[c,l]=X.useState(!1),u=r.length>0,d=r.length===1?n.find(e=>e.value===r[0])?.label??r[0]:`${r.length} selected`;return(0,Z.jsxs)(Ts,{open:c,onOpenChange:l,children:[(0,Z.jsx)(vs,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`facet-${e}`,"data-active":u?`true`:void 0,"aria-label":`Filter by ${t.toLowerCase()}`,className:H(nu,u&&`border-violet/40 bg-violet/10 text-foreground`),children:[(0,Z.jsx)(`span`,{className:H(u&&`text-soft-foreground`),children:t}),u?(0,Z.jsx)(`span`,{className:`max-w-[140px] truncate font-semibold`,children:d}):null,(0,Z.jsx)(qa,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsxs)(Cs,{align:`start`,className:`w-64 p-0`,"data-testid":`facet-${e}-menu`,children:[(0,Z.jsxs)(ql,{children:[(0,Z.jsx)(zl,{placeholder:o??`Search ${t.toLowerCase()}…`}),(0,Z.jsxs)(Kl,{children:[(0,Z.jsx)(Gl,{children:s}),(0,Z.jsx)(Vl,{children:n.map(e=>{let t=r.includes(e.value);return(0,Z.jsxs)(Wl,{value:e.label,onSelect:()=>i(e.value),"data-slot":`facet-option`,"data-value":e.value,"aria-checked":t,role:`option`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:H(`flex size-4 shrink-0 items-center justify-center rounded-[4px] border`,t?`border-violet bg-violet text-violet-foreground`:`border-input`),children:t?(0,Z.jsx)(Wa,{className:`size-3`}):null}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.count===void 0?null:(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-meta text-soft-foreground tabular-nums`,children:e.count})]},e.value)})})]})]}),u?(0,Z.jsx)(`div`,{className:`border-t border-border p-1`,children:(0,Z.jsxs)(`button`,{type:`button`,"data-action":`facet-${e}-clear`,onClick:()=>a(),className:`w-full rounded-sm px-2 py-1.5 text-left text-ui font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[`Clear `,t.toLowerCase()]})}):null]})]})}function pk({label:e,count:t,selected:n,onToggle:r,slot:i,tone:a=`neutral`}){return(0,Z.jsxs)(`button`,{type:`button`,"data-slot":i,"data-selected":n?`true`:void 0,"aria-pressed":n,onClick:r,className:H(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-ui font-medium transition-colors`,a===`tag`?`border-violet/25 bg-violet/10 text-violet hover:bg-violet/20`:`border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground`,n&&`border-violet bg-violet text-violet-foreground hover:bg-violet`),children:[e,t===void 0?null:(0,Z.jsx)(`span`,{className:H(`font-mono text-meta tabular-nums`,!n&&`text-soft-foreground`),children:t})]})}function mk({slot:e,label:t,value:n,options:r,onChange:i}){return(0,Z.jsx)(_i,{slot:e,label:t,value:n,options:r,onChange:i,allowRelease:!0})}function hk(e){if(e.bucket===`error`)return`failed`;if(e.bucket===`none`){if(e.label===`done`)return`done`;if(e.label===`cancelled`)return`cancelled`;if(e.label===`closed · idle`)return`idle`}}var gk={done:Qa,failed:wa,cancelled:ba,idle:Qi},_k={done:`text-success-strong`,failed:`text-danger`,cancelled:`text-soft-foreground`,idle:`text-conflict`};function vk({attention:e,showLabel:t=!1,className:n}){let r=hk(e),i=r?gk[r]:void 0,a=r&&i?(0,Z.jsx)(`span`,{"data-slot":`status-mark`,"data-state":r,"data-tone":e.tone,role:`img`,"aria-label":e.label,className:H(`inline-flex shrink-0`,_k[r]),children:(0,Z.jsx)(i,{className:`size-3.5`,strokeWidth:2,"aria-hidden":`true`})}):(0,Z.jsx)(Pl,{tone:e.tone,pulse:e.pulse,role:`img`,"aria-label":e.label});return t?(0,Z.jsxs)(`span`,{className:H(`inline-flex items-center gap-1.5`,n),children:[a,(0,Z.jsx)(`span`,{"data-slot":`status-mark-label`,"aria-hidden":`true`,className:`text-label text-muted-foreground`,children:e.label})]}):(0,Z.jsx)(el,{label:e.label,side:`top`,children:(0,Z.jsx)(`span`,{className:H(`inline-flex items-center`,n),children:a})})}function yk({id:e,attention:t}){return(0,Z.jsx)(`span`,{id:e,hidden:!0,"data-slot":`status-description`,children:t.label})}function bk({label:e,expanded:t,onToggle:n,className:r,wordClassName:i}){let[a,...o]=e.split(` `);return(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`subtask-toggle`,"aria-expanded":t,"aria-label":`${t?`Collapse`:`Expand`} ${e}`,onClick:n,className:H(`inline-flex shrink-0 items-center gap-0.5 rounded-full bg-muted py-px pr-1.5 pl-1 text-micro font-medium text-muted-foreground hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,r),children:[(0,Z.jsx)(Ga,{className:H(`size-3 transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),a,(0,Z.jsx)(`span`,{className:i,children:` ${o.join(` `)}`})]})}var xk=[{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`}],Sk=new Map(xk.map(e=>[e.id,e]));function Ck(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`boolean`))}function wk(e){let t={};for(let[n,r]of Object.entries(Ck(e))){let e=Sk.get(n);e?.canFold&&(t[e.id]=r)}return t}function Tk(e,t){let n=Sk.get(e);return!n||!n.canFold?!0:t[e]??n.defaultExpanded}function Ek(e,t){let n=Ck(e);return Sk.get(t)?.canFold?{...n,[t]:!Tk(t,wk(e))}:n}function Dk(e){return xk.filter(t=>t.capability===void 0||e[t.capability])}function Ok(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function kk(){let e=V(),t=Et(),n=X.useRef(0),r=X.useRef(0),i=X.useRef(Promise.resolve()),a=X.useMemo(()=>wk(t.data?.taskTable?.expandedColumns),[t.data?.taskTable?.expandedColumns]),o=X.useCallback(t=>{if(!xk.find(e=>e.id===t)?.canFold)return;let a=e.getQueryData(R.uiState);if(a===void 0)return;let o=Ok(a?.taskTable),s={...o,expandedColumns:Ek(o.expandedColumns,t)};e.setQueryData(R.uiState,{...a,taskTable:s});let c=++n.current;r.current=c;let l=i.current.then(async()=>{let t=await $t({taskTable:s},{keepalive:!0});c===r.current&&e.setQueryData(R.uiState,t)});i.current=l.catch(t=>{Y(t instanceof Error?t.message:String(t),{tone:`danger`}),c===r.current&&e.invalidateQueries({queryKey:R.uiState})})},[e]);return{expandedColumns:a,isExpanded:X.useCallback(e=>Tk(e,a),[a]),toggleColumn:o,isPending:t.isPending}}var Ak=X.createContext(null);function jk({intervalMs:e,now:t,children:n}){let r=Ql(e,t===void 0);return(0,Z.jsx)(Ak.Provider,{value:t??r,children:n})}function Mk({at:e}){return(0,Z.jsx)(Z.Fragment,{children:Ml(e,X.useContext(Ak)??Date.now())})}var Nk=12,Pk=40;function Fk({height:e,colSpan:t}){return e<=0?null:(0,Z.jsx)(`tr`,{"data-row-spacer":``,"aria-hidden":`true`,children:(0,Z.jsx)(`td`,{colSpan:t,style:{height:e,padding:0,border:0}})})}function Ik(e,t=45){let n=e>100,r=X.useRef(null),[i,a]=X.useState({start:0,end:Pk,height:t});if(X.useLayoutEffect(()=>{if(!n)return;let e=r.current;if(!e)return;let i=e.closest(`[data-slot="main"]`),o=()=>{let n=i?i.getBoundingClientRect().top:0,r=i?i.clientHeight:window.innerHeight,o=e.getBoundingClientRect().top-n,s=e.querySelector(`:scope > tr:not([data-row-spacer]):not([data-row-unsampled])`)?.getBoundingClientRect().height,c=s!==void 0&&s>0?s:t,l=Math.floor(Math.max(0,-o)/c),u=Math.ceil(Math.max(0,r-o)/c),d=Math.max(0,l-Nk),f=Math.max(d,u+Nk);a(e=>e.start===d&&e.end===f&&e.height===c?e:{start:d,end:f,height:c})};o();let s=0,c=()=>{s===0&&(s=requestAnimationFrame(()=>{s=0,o()}))},l=i??window;l.addEventListener(`scroll`,c,{passive:!0}),window.addEventListener(`resize`,o);let u=typeof ResizeObserver==`function`?new ResizeObserver(o):void 0;for(let e of i?Array.from(i.children):[document.body])u?.observe(e);return()=>{s!==0&&cancelAnimationFrame(s),l.removeEventListener(`scroll`,c),window.removeEventListener(`resize`,o),u?.disconnect()}},[n,e,t]),!n)return{anchorRef:r,windowed:n,start:0,end:e,padTop:0,padBottom:0,ariaRowCount:void 0,ariaRowIndex:Lk};let o=Math.max(1,i.end-i.start),s=Math.max(0,Math.min(i.start,e-o)),c=Math.min(Math.max(i.end,s+o),e);return{anchorRef:r,windowed:n,start:s,end:c,padTop:s*i.height,padBottom:(e-c)*i.height,ariaRowCount:e+1,ariaRowIndex:Rk}}var Lk=()=>void 0,Rk=e=>e+2,zk=[],Bk=wk(void 0),Vk=()=>void 0,Hk=3e4;function Uk({runs:e,view:t,onViewChange:n,onArchiveFinished:r,onMarkAllRead:i,onRename:a,onTogglePin:o,onTaskAction:s,now:c,showTokens:l=!0,showCost:u=!0,expandedColumns:d=Bk,onToggleColumn:f=Vk,columnsPending:p=!1,origin:h=`all`,onOriginChange:g=()=>void 0,automationNames:_,gitRepo:v=!0,scheduledTasks:y,hasScheduledTasks:b=!!y,firstRun:x,initialQuery:S=``,cacheStatus:C}){let[w,T]=X.useState(S),[E,D]=X.useState(new Set),O=X.useCallback(e=>D(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),[]),[k,A]=X.useState(M_),[j,N]=X.useState(`recent`),P=e??zk,ee=X.useMemo(()=>P.some(e=>t===`archived`===e.archived),[P,t]),te=X.useMemo(()=>P_(P),[P]),ne=X.useMemo(()=>I_(P,h,k,te),[P,h,k,te]),re=X.useMemo(()=>m(ne),[ne]),ie=X.useMemo(()=>_t(ne,w),[ne,w]),F=X.useMemo(()=>M(ie,t,j),[ie,t,j]),ae=w.trim()!==``,oe=X.useCallback(e=>ae||E.has(e),[ae,E]),se=X.useMemo(()=>it(F,t).map(e=>({...e,rows:U_(e.runs,oe),taskCount:U_(e.runs,()=>!1).length})),[F,t,oe]),ce=X.useMemo(()=>se.flatMap(e=>[...e.label?[{kind:`section`,section:e}]:[],...e.rows.map(e=>({kind:`row`,node:e}))]),[se]),le=X.useMemo(()=>se.flatMap(e=>e.rows.map(e=>e.run)),[se]),I=ck(le,s),[L,de]=X.useState(!1),fe=L||I.ids.size>0,pe=X.useMemo(()=>Ye(P),[P]),me=X.useMemo(()=>Yn(ie,t),[ie,t]),he=X.useMemo(()=>Gn(P),[P]),ge=X.useMemo(()=>Dk({tokens:l,cost:u}).map(e=>e.id===`started`?{...e,label:ue(j)}:e),[l,u,j]),_e=X.useMemo(()=>za(P),[P]),ve=Ik(ce.length),ye=t===`archived`?void 0:o;return(0,Z.jsx)(jk,{intervalMs:Hk,now:c,children:(0,Z.jsxs)(`div`,{"data-route":`tasks`,className:`flex min-h-full flex-col`,children:[(0,Z.jsxs)(`header`,{"data-slot":`tasks-header`,className:`sticky top-0 z-10 flex h-12 shrink-0 items-center gap-3 border-b border-border bg-background px-3 md:h-14 md:px-5`,children:[(0,Z.jsx)(`h1`,{className:`hidden text-base font-semibold md:block`,children:`Tasks`}),C,(0,Z.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,Z.jsx)(qk,{view:`active`,current:t,onSelect:n,count:re.active,children:`Active`}),(0,Z.jsx)(qk,{view:`archived`,current:t,onSelect:n,count:re.archived,children:`Archived`})]}),(0,Z.jsx)(`div`,{className:`flex-1`}),_e>0?(0,Z.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`mark-all-read`,className:`hidden md:inline-flex`,onClick:i,children:[(0,Z.jsx)(hi,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read`]}):null,t===`active`&&he>0?(0,Z.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,className:`hidden md:inline-flex`,onClick:r,children:[(0,Z.jsx)(Zi,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`]}):null,(0,Z.jsxs)(`div`,{className:`relative hidden w-60 md:block`,children:[(0,Z.jsx)(is,{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,Z.jsx)(`input`,{type:`text`,value:w,onChange:e=>T(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-ui text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]})]}),y,(0,Z.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:[ee?(0,Z.jsx)(Kk,{runs:P,view:t,origin:h,onOriginChange:g,filters:k,onFiltersChange:A,automations:te,automationNames:_,sortBy:j,onSortByChange:N,columns:(0,Z.jsx)(nA,{columns:ge,expandedColumns:d,onToggle:f,disabled:p})}):null,s?(0,Z.jsx)(uk,{displayed:le,selection:I,archived:t===`archived`,selecting:L,onToggleSelecting:()=>de(e=>!e)}):null,e===void 0?null:b&&P.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tasks have started yet.`}):F.length===0?(0,Z.jsx)(Gk,{view:t,query:w,filtered:N_(k)>0,onClearFilters:()=>A(M_),origin:h,hiddenByOrigin:h!==`all`&&I_(et(P,t),`all`,k,te).length>0,onShowAll:()=>g(`all`),firstRun:x}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"data-slot":`tasks-table`,className:`hidden overflow-x-auto rounded-lg border border-border bg-card shadow-xs md:block`,children:(0,Z.jsx)(Zc,{children:(0,Z.jsxs)(`table`,{className:`w-full table-fixed border-collapse`,"aria-rowcount":ve.ariaRowCount,children:[(0,Z.jsxs)(`colgroup`,{children:[s?(0,Z.jsx)(`col`,{"data-column-id":`controls`,style:{width:`36px`}}):null,ge.map(e=>{let t=Tk(e.id,d);return(0,Z.jsx)(`col`,{"data-column-id":e.id,"data-expanded":t,style:{width:t?e.width:`42px`}},e.id)})]}),(0,Z.jsx)(`thead`,{children:(0,Z.jsxs)(`tr`,{"aria-rowindex":ve.windowed?1:void 0,children:[s?(0,Z.jsx)(`th`,{scope:`col`,"data-column-id":`controls`,className:`h-[38px] border-b border-border px-2`,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Task controls`})}):null,ge.map(e=>(0,Z.jsx)(Yk,{column:e,expanded:Tk(e.id,d),onToggle:f,disabled:p},e.id))]})}),(0,Z.jsxs)(`tbody`,{ref:ve.anchorRef,className:`[&>tr:last-child>td]:border-b-0`,children:[(0,Z.jsx)(Fk,{height:ve.padTop,colSpan:ge.length+ +!!s}),ce.slice(ve.start,ve.end).map((e,t)=>e.kind===`section`?(0,Z.jsx)(`tr`,{"data-slot":`tasks-section`,"data-section":e.section.key,"data-row-unsampled":``,"aria-rowindex":ve.ariaRowIndex(ve.start+t),children:(0,Z.jsxs)(`th`,{scope:`rowgroup`,colSpan:ge.length+ +!!s,className:H(Zk,`border-b border-border bg-muted/40 px-3.5 py-1.5 text-left`),children:[e.section.label,` · `,e.section.taskCount]})},`section-${e.section.key}`):(0,Z.jsx)(rA,{ariaRowIndex:ve.ariaRowIndex(ve.start+t),gitRepo:v,run:e.node.run,depth:e.node.depth,childCount:e.node.childCount,subtasksExpanded:oe(e.node.run.id),onToggleSubtasks:O,queuePosition:e.node.run.status===`queued`?pe.get(e.node.run.id)??null:null,onRename:a,onTogglePin:ye,selectable:!!s,selectionMode:fe,selected:I.ids.has(e.node.run.id),onSelect:I.toggle,actionsBusy:I.busy,onAction:I.apply,sortBy:j,columns:ge,expandedColumns:d},e.node.run.id)),(0,Z.jsx)(Fk,{height:ve.padBottom,colSpan:ge.length+ +!!s})]})]})})}),(0,Z.jsx)(Wk,{cards:ce.map(e=>e.kind===`section`?(0,Z.jsxs)(`h2`,{"data-slot":`tasks-section`,"data-section":e.section.key,className:H(Zk,`px-1 pt-1`),children:[e.section.label,` · `,e.section.taskCount]},`section-${e.section.key}`):(0,Z.jsx)(lA,{run:e.node.run,depth:e.node.depth,childCount:e.node.childCount,subtasksExpanded:oe(e.node.run.id),onToggleSubtasks:O,queuePosition:e.node.run.status===`queued`?pe.get(e.node.run.id)??null:null,sortBy:j,showTokens:l,showCost:u,onTogglePin:ye,selectable:!!s,selected:I.ids.has(e.node.run.id),onSelect:I.toggle,actionsBusy:I.busy,onAction:I.apply,gitRepo:v},e.node.run.id))})]}),me.map(e=>(0,Z.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-label text-muted-foreground shadow-xs`,children:[(0,Z.jsx)(Ad,{className:`size-[15px] shrink-0 text-soft-foreground`,"aria-hidden":`true`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e.title}),` — `,e.count,` variants finished`]}),(0,Z.jsx)(q,{asChild:!0,variant:`outline`,size:`sm`,className:`md:ml-auto`,children:(0,Z.jsx)(G,{to:`/compare/${e.groupId}`,children:`Compare`})})]},e.groupId))]}),(0,Z.jsx)(G,{to:`/new`,"data-slot":`new-task-fab`,"aria-label":`New task`,className:`fixed right-4 bottom-[calc(16px+var(--phone-bar,0px)+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,Z.jsx)(ts,{className:`size-[22px]`,"aria-hidden":`true`})})]})})}function Wk({cards:e}){let t=e.length>100,n=X.useRef(null),r=X.useRef(null),[i,a]=X.useState(0);return X.useLayoutEffect(()=>{if(!t)return;let e=()=>{let e=n.current,t=r.current;!e||!t||a(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[t]),(0,Z.jsx)(`div`,{ref:e=>{n.current=e,e&&(r.current=e.closest(`[data-slot="main"]`))},"data-slot":`task-cards`,"data-virtualized":t,className:H(`flex flex-col md:hidden`,t?null:`gap-2.5`),children:t?(0,Z.jsx)(wu,{scrollRef:r,startMargin:i,children:e.map(e=>(0,Z.jsx)(`div`,{className:`pb-2.5`,children:e},e.key))}):e})}function Gk({view:e,query:t,filtered:n=!1,onClearFilters:r=()=>void 0,origin:i=`all`,hiddenByOrigin:a=!1,onShowAll:o=()=>void 0,firstRun:s}){let c=t.trim(),l=c?`search-miss`:n?`filtered`:a?`origin-hidden`:e===`archived`?`archive`:`no-tasks`;return(0,Z.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":l,className:`flex flex-1 flex-col`,children:l===`filtered`?(0,Z.jsx)(eu,{heading:`h2`,icon:(0,Z.jsx)(rs,{}),tone:`neutral`,title:`No tasks match these filters`,actions:(0,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:r,children:`Clear filters`})}):l===`origin-hidden`?(0,Z.jsx)(eu,{heading:`h2`,icon:(0,Z.jsx)(bo,{}),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,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:o,children:`Show all tasks`})}):l===`search-miss`?(0,Z.jsx)(eu,{heading:`h2`,icon:(0,Z.jsx)(rs,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No tasks match “${c}”.`}):l===`archive`?(0,Z.jsx)(eu,{heading:`h2`,icon:(0,Z.jsx)(Zi,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):s||(0,Z.jsx)(eu,{heading:`h2`,icon:(0,Z.jsx)(gd,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,Z.jsx)(q,{asChild:!0,children:(0,Z.jsxs)(G,{to:`/new`,children:[(0,Z.jsx)(ts,{"aria-hidden":`true`}),`New task`]})})})})}function Kk({runs:e,view:t,origin:n,onOriginChange:r,filters:i,onFiltersChange:a,automations:o,automationNames:s,sortBy:c,onSortByChange:l,columns:u}){let d=X.useMemo(()=>e.filter(e=>t===`archived`?e.archived:!e.archived),[e,t]),f=z_(d,i,o),p=e=>R_(d,n,i,o,e),m=p(`statuses`),h=p(`workflows`),g=p(`automations`),_=B_(d.map(e=>o.get(e.id))),v=X.useMemo(()=>Vp(e),[e]),y=(e,t)=>a(n=>({...n,[e]:n[e].includes(t)?n[e].filter(e=>e!==t):[...n[e],t]})),b=e=>a(t=>({...t,[e]:[]})),x=N_(i);return(0,Z.jsxs)(`div`,{"data-slot":`tasks-filters`,className:`mb-3 flex flex-wrap items-center gap-1.5`,children:[(0,Z.jsx)(_i,{slot:`task-origin`,label:`Show tasks started by`,value:n,options:Ip.map(e=>({...e,count:f[e.value]})),onChange:r}),(0,Z.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Z.jsx)(fk,{slot:`status`,label:`Status`,selected:i.statuses,onToggle:e=>y(`statuses`,e),onClear:()=>b(`statuses`),options:B_(d.map(e=>e.status)).map(e=>({value:e,label:e,count:m.get(e)??0})),emptyLabel:`No tasks to filter`}),(0,Z.jsx)(fk,{slot:`workflow`,label:`Workflow`,selected:i.workflows,onToggle:e=>y(`workflows`,e),onClear:()=>b(`workflows`),options:B_(d.map(e=>O(e))).map(e=>({value:e,label:e,count:h.get(e)??0})),emptyLabel:`No tasks to filter`}),n!==`regular`&&_.length>0?(0,Z.jsx)(fk,{slot:`automation`,label:`Automation`,selected:i.automations,onToggle:e=>y(`automations`,e),onClear:()=>b(`automations`),options:_.map(e=>({value:e,label:Bp(e,s,v),count:g.get(e)??0})),emptyLabel:`No automation tasks`}):null,x>0?(0,Z.jsxs)(`button`,{type:`button`,"data-action":`clear-filters`,onClick:()=>a(()=>M_),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,Z.jsx)(us,{className:`size-3`,"aria-hidden":`true`}),`Clear (`,x,`)`]}):null,(0,Z.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`text-meta font-medium text-soft-foreground`,children:`Sort by`}),(0,Z.jsx)(_i,{slot:`sort-by`,label:`Sort tasks by`,value:c,options:re,onChange:l}),u?(0,Z.jsx)(`span`,{className:`ml-auto`,children:u}):null]})}function qk({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:H(`flex h-7 items-center justify-center gap-1.5 rounded-[7px] px-3 text-label font-medium text-muted-foreground`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,Z.jsx)(`span`,{className:`font-mono text-meta tabular-nums`,children:r}):null]})}function Jk({children:e,right:t=!1,columnId:n,folded:r=!1}){return(0,Z.jsx)(`th`,{scope:`col`,"data-column-id":n,"data-folded":r||void 0,className:H(`group/th h-[38px] border-b border-border px-2.5 text-left eyebrow whitespace-nowrap text-soft-foreground first:pl-4 last:pr-4`,t&&`text-right`,r&&`px-0 first:pl-0 last:pr-0`),children:e})}function Yk({column:e,expanded:t,onToggle:n,disabled:r}){if(!e.canFold)return(0,Z.jsx)(Jk,{columnId:e.id,right:e.align===`right`,children:e.label});let i=t?`Fold`:`Expand`;return(0,Z.jsx)(Jk,{columnId:e.id,right:e.align===`right`,folded:!t,children:(0,Z.jsxs)(Qc,{children:[(0,Z.jsx)(Xc,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":`${i} ${e.label} column`,"aria-pressed":t,disabled:r,onClick:()=>n(e.id),className:H(`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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{children:e.label}),(0,Z.jsx)(Ku,{className:Qk,"aria-hidden":`true`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Xk,{icon:e.icon}),(0,Z.jsx)(qu,{className:Qk,"aria-hidden":`true`})]})})}),(0,Z.jsxs)($c,{side:`top`,children:[e.label,` · `,i,` column`]})]})})}function Xk({icon:e}){let t=`size-3.5`;switch(e){case`workflow`:return(0,Z.jsx)(bo,{className:t,"aria-hidden":`true`});case`branch`:return(0,Z.jsx)(Oo,{className:t,"aria-hidden":`true`});case`diff`:return(0,Z.jsx)(Co,{className:t,"aria-hidden":`true`});case`reference`:return(0,Z.jsx)(zi,{className:t,"aria-hidden":`true`});case`tokens`:return(0,Z.jsx)(Xu,{className:t,"aria-hidden":`true`});case`cost`:return(0,Z.jsx)(ed,{className:t,"aria-hidden":`true`});case`cpu`:return(0,Z.jsx)(Ma,{className:t,"aria-hidden":`true`});case`memory`:return(0,Z.jsx)(vd,{className:t,"aria-hidden":`true`});case`started`:return(0,Z.jsx)(Ju,{className:t,"aria-hidden":`true`});default:return null}}var Zk=`eyebrow text-soft-foreground`,Qk=`size-3 opacity-0 transition-opacity group-hover/th:opacity-70 group-focus-within/th:opacity-70 no-hover:opacity-55`,$k=`h-11 overflow-hidden border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function eA(e){return e.archived||e.status===`done`||e.status===`cancelled`||jn(e)}function tA({attention:e,archived:t,className:n}){return(0,Z.jsx)(`span`,{"data-slot":`status-quiet`,className:H(`inline-flex h-5 items-center px-2.5`,n),children:(0,Z.jsx)(vk,{attention:e,showLabel:t})})}function nA({columns:e,expandedColumns:t,onToggle:n,disabled:r}){let i=e.filter(e=>e.canFold),a=i.filter(e=>Tk(e.id,t)!==e.defaultExpanded);return(0,Z.jsxs)(lo,{children:[(0,Z.jsx)(oo,{asChild:!0,children:(0,Z.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`columns-menu`,disabled:r,className:`hidden md:inline-flex`,children:[(0,Z.jsx)(Zu,{className:`size-3.5`,"aria-hidden":`true`}),`Columns`]})}),(0,Z.jsxs)(so,{align:`end`,children:[i.map(e=>(0,Z.jsx)(io,{"data-column-id":e.id,checked:Tk(e.id,t),onCheckedChange:()=>n(e.id),children:e.label},e.id)),(0,Z.jsx)(eo,{}),(0,Z.jsx)(ro,{"data-action":`reset-columns`,disabled:a.length===0,onSelect:()=>{for(let e of a)n(e.id)},children:`Reset to defaults`})]})]})}var rA=X.memo(function({ariaRowIndex:e,gitRepo:t,run:n,depth:r,childCount:i,subtasksExpanded:a,onToggleSubtasks:o,queuePosition:c,onRename:l,onTogglePin:u,sortBy:d,columns:f,expandedColumns:p,selectable:m,selectionMode:h,selected:g,onSelect:_,actionsBusy:v,onAction:y}){let b=Lr(),x=s(n),S=Ee(n),C=`/tasks/${n.id}`,w=ze(n.costUsd),T=ve(n);return(0,Z.jsxs)(`tr`,{"data-slot":`task-table-row`,"data-run-id":n.id,"aria-rowindex":e,"data-depth":r,onClick:e=>{e.target.closest(`a, button, input`)||b(C)},className:`group/row cursor-pointer hover:bg-muted`,children:[m?(0,Z.jsx)(`td`,{"data-column-id":`controls`,className:`border-b border-border px-2`,children:(0,Z.jsxs)(`span`,{"data-slot":`row-controls`,"data-selection-mode":h||void 0,className:H(`relative inline-flex items-center`,!h&&`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 no-hover:opacity-100`),children:[(0,Z.jsx)(lk,{label:`Select ${Ge(n)}`,checked:g,disabled:v,onChange:()=>_(n.id)}),(0,Z.jsx)(`span`,{"data-slot":`row-quick-actions`,className:`pointer-events-none absolute top-1/2 left-full z-10 ml-1 -translate-y-1/2 rounded-md bg-muted opacity-0 transition-opacity group-hover/row:pointer-events-auto group-hover/row:opacity-100 group-focus-within/row:pointer-events-auto group-focus-within/row:opacity-100`,children:(0,Z.jsx)(dk,{run:n,busy:v,onAction:y})})]})}):null,f.map(e=>{if(e.id===`memory`)return null;if(e.id===`cpu`){let t=Tk(`cpu`,p),r=Tk(`memory`,p);return c!==null&&(t||r)?(0,Z.jsxs)(`td`,{"data-slot":`queue-note`,"data-column-id":`cpu-memory`,colSpan:2,className:H($k,`text-right font-mono text-meta text-soft-foreground`),children:[`#`,c,` in queue`]},e.id):(0,Z.jsx)(sA,{run:n,cpuExpanded:t,memoryExpanded:r},e.id)}return(0,Z.jsx)(iA,{gitRepo:t,column:e,expanded:Tk(e.id,p),run:n,depth:r,childCount:i,subtasksExpanded:a,onToggleSubtasks:o,attention:x,scheduled:S,reference:T,cost:w,to:C,onRename:l,onTogglePin:u,sortBy:d},e.id)})]})});function iA({gitRepo:e,column:t,expanded:n,run:r,depth:i,childCount:a,subtasksExpanded:o,onToggleSubtasks:s,attention:c,scheduled:l,reference:u,cost:d,to:f,onRename:p,onTogglePin:m,sortBy:h}){if(!n)return(0,Z.jsx)(aA,{column:t.id});switch(t.id){case`status`:return(0,Z.jsx)(`td`,{"data-column-id":t.id,className:$k,children:eA(r)?(0,Z.jsx)(tA,{attention:c,archived:!!r.archived}):(0,Z.jsxs)(Jl,{dot:c.tone,pulse:c.pulse,title:l?.title,children:[c.label,l?(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.label}):null]})});case`task`:return(0,Z.jsx)(`td`,{"data-column-id":t.id,className:H($k,`max-w-0`),style:{minWidth:`${Yt(i)}px`},children:(0,Z.jsx)(oA,{run:r,depth:i,childCount:a,subtasksExpanded:o,onToggleSubtasks:s,to:f,onRename:p,onTogglePin:m})});case`workflow`:return(0,Z.jsx)(`td`,{"data-column-id":t.id,className:H($k,`text-label text-muted-foreground`),children:O(r)});case`branch`:return(0,Z.jsx)(`td`,{"data-column-id":t.id,className:$k,children:r.branch?(0,Z.jsx)(fA,{branch:r.branch}):pA(r,e)?(0,Z.jsx)(mA,{}):(0,Z.jsx)(uA,{})});case`diff`:return(0,Z.jsx)(`td`,{"data-column-id":t.id,className:$k,children:r.diffStat?(0,Z.jsx)(Yl,{stat:r.diffStat}):(0,Z.jsx)(uA,{})});case`reference`:return(0,Z.jsx)(`td`,{"data-column-id":t.id,className:$k,children:u?(0,Z.jsx)(Rl,{run:r,reference:u}):(0,Z.jsx)(uA,{})});case`tokens`:return(0,Z.jsx)(`td`,{"data-column-id":t.id,className:H($k,`text-right text-xs text-muted-foreground`),children:(0,Z.jsx)(j_,{inputTokens:r.inputTokens,outputTokens:r.outputTokens,variant:`table`,omitWhenUnknown:!1})});case`cost`:return(0,Z.jsx)(`td`,{"data-column-id":t.id,className:H($k,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:d||(0,Z.jsx)(uA,{})});case`started`:return(0,Z.jsx)(`td`,{"data-column-id":t.id,className:H($k,`text-right text-xs text-soft-foreground tabular-nums`),children:(0,Z.jsx)(Mk,{at:bn(r,h)})});case`cpu`:case`memory`:return null}}function aA({column:e}){return(0,Z.jsx)(`td`,{role:`presentation`,"aria-hidden":`true`,"data-column-id":e,"data-folded":`true`,className:H($k,`px-0 first:pl-0 last:pr-0`)})}function oA({run:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,to:a,onRename:o,onTogglePin:c}){let l=Ge(e),u=Yi(l,t=>o(e.id,t)),d=X.useId(),f=eA(e),p=ka(e),m=Na(e),h=W_(n),g=t>0?{paddingLeft:`${t*14}px`}:void 0;return u.editing?(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center`,style:g,children:(0,Z.jsx)(ea,{editor:u,className:`text-ui font-medium`})}):(0,Z.jsxs)(`span`,{className:`@container flex min-w-0 items-center gap-1.5`,style:g,children:[t>0?(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`subtask-tick`,className:`shrink-0 font-mono text-meta leading-none text-soft-foreground`,children:`└`}):null,(0,Z.jsxs)(G,{to:a,title:l,"aria-describedby":f?d:void 0,className:H(`min-w-0 truncate text-ui`,p?`font-semibold text-foreground`:m?`font-medium text-muted-foreground`:`font-medium`),children:[l,f?(0,Z.jsx)(yk,{id:d,attention:s(e)}):null,p?(0,Z.jsx)(D_,{}):null]}),G_(e)?(0,Z.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground @max-[300px]:hidden`,children:G_(e)}):null,h?(0,Z.jsx)(bk,{label:h,expanded:r,onToggle:()=>i(e.id),wordClassName:`@max-[260px]:hidden`}):null,(0,Z.jsxs)(`span`,{"data-slot":`row-actions`,className:H(`flex shrink-0 items-center gap-1.5`,!e.pinned&&`-ml-1.5 w-0 overflow-hidden group-hover/row:ml-0 group-hover/row:w-auto group-hover/row:overflow-visible group-focus-within/row:ml-0 group-focus-within/row:w-auto group-focus-within/row:overflow-visible no-hover:ml-0 no-hover:w-auto no-hover:overflow-visible`),children:[(0,Z.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:u.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,Z.jsx)(vo,{className:`size-3`,"aria-hidden":`true`})}),c?(0,Z.jsx)(ia,{pinned:!!e.pinned,onToggle:t=>c(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 sA({run:e,cpuExpanded:t,memoryExpanded:n}){let r=ke(e,pi(e.id));return(0,Z.jsxs)(Z.Fragment,{children:[t?(0,Z.jsx)(cA,{column:`cpu`,cell:r.cpu}):(0,Z.jsx)(aA,{column:`cpu`}),n?(0,Z.jsx)(cA,{column:`memory`,cell:r.mem}):(0,Z.jsx)(aA,{column:`memory`})]})}function cA({column:e,cell:t}){return(0,Z.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-column-id":e,"data-usage-kind":t.kind,title:t.title,className:H($k,`text-right font-mono tabular-nums`,t.kind===`live`&&`bg-violet/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-meta text-soft-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:t.text||`—`})}var lA=X.memo(function({run:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,queuePosition:a,sortBy:o,showTokens:c,showCost:l,onTogglePin:u,gitRepo:d,selectable:f,selected:p,onSelect:m,actionsBusy:h,onAction:g}){let _=Lr(),v=s(e),y=Ee(e),b=`/tasks/${e.id}`,x=ve(e),S=ka(e),C=Na(e),w=ze(e.costUsd),T=W_(n),E=e.inputTokens!==void 0||e.outputTokens!==void 0,D=X.useId(),k=eA(e);return(0,Z.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, input`)||_(b)},className:`cursor-pointer rounded-lg border border-border bg-card px-3.5 py-3 shadow-xs`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[f?(0,Z.jsx)(lk,{label:`Select ${Ge(e)}`,checked:p,disabled:h,onChange:()=>m(e.id)}):null,k?(0,Z.jsx)(tA,{attention:v,archived:!!e.archived,className:`mt-1.5 px-1`}):(0,Z.jsxs)(Jl,{dot:v.tone,pulse:v.pulse,className:`mt-px shrink-0`,title:y?.title,children:[v.label,y?(0,Z.jsx)(`span`,{className:`tabular-nums`,children:y.label}):null]}),(0,Z.jsxs)(G,{to:b,"aria-describedby":k?D:void 0,className:H(`min-w-0 flex-1 text-ui leading-[1.35]`,S?`font-semibold text-foreground`:C?`font-medium text-muted-foreground`:`font-medium`),children:[Ge(e),k?(0,Z.jsx)(yk,{id:D,attention:v}):null,S?(0,Z.jsx)(D_,{}):null]}),G_(e)?(0,Z.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`mt-px shrink-0 rounded-full bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,children:G_(e)}):null,T?(0,Z.jsx)(bk,{label:T,expanded:r,onToggle:()=>i(e.id),className:`mt-px`}):null,(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0 text-meta text-soft-foreground tabular-nums`,children:(0,Z.jsx)(Mk,{at:bn(e,o)})}),u?(0,Z.jsx)(ia,{pinned:!!e.pinned,onToggle:t=>u(e,t),className:`-mr-1 mt-px`}):null]}),(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 font-mono text-meta font-medium text-muted-foreground tabular-nums`,children:[(0,Z.jsx)(`span`,{children:O(e)}),a===null?(0,Z.jsxs)(Z.Fragment,{children:[e.branch?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(dA,{}),(0,Z.jsx)(`span`,{children:e.branch})]}):pA(e,d)?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(dA,{}),(0,Z.jsx)(mA,{})]}):null,e.diffStat?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(dA,{}),(0,Z.jsx)(Yl,{stat:e.diffStat,className:`text-meta`})]}):null,c&&E?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(dA,{}),(0,Z.jsx)(j_,{inputTokens:e.inputTokens,outputTokens:e.outputTokens})]}):null,l&&w?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(dA,{}),(0,Z.jsx)(`span`,{children:w})]}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(dA,{}),(0,Z.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,a,` in queue`]})]}),x?(0,Z.jsx)(Rl,{run:e,reference:x,className:`h-5`}):null,f?(0,Z.jsx)(dk,{run:e,busy:h,onAction:g}):null]})]})});function uA(){return(0,Z.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function dA(){return(0,Z.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`})}function fA({branch:e}){return(0,Z.jsx)(`span`,{className:`rounded-[6px] bg-muted px-1.5 py-0.5 font-mono text-meta font-medium text-muted-foreground`,children:e})}function pA(e,t){return t&&e.status===`running`&&!e.branch&&e.worktree!==!1}function mA(){return(0,Z.jsx)(ll,{"data-slot":`branch-skeleton`,role:`status`,"aria-label":`naming branch`,className:`inline-block h-4 w-24 align-middle`})}function hA(){let e=F(),t=new URLSearchParams(Kr().search).get(`q`)??``,n=Zl(E().data),r=_n(),i=!r.data||r.data.info!==null,[a,o]=fg(),s=V(),c=fr(),l=X.useCallback(async(e,t)=>{let n=t===`archive`||t===`restore`?await yt(c,e.id,t===`archive`,`tasks_table`):await fe(c,e.id,t===`read`);fr()===c?on(s,n):s.invalidateQueries({queryKey:R.runsIndex}),s.invalidateQueries({queryKey:[c,`runs`]})},[c,s]),u=B({mutationFn:Zn,onSuccess:()=>s.invalidateQueries({queryKey:z.runs.all})}),d=B({mutationFn:$n,onSuccess:()=>s.invalidateQueries({queryKey:z.runs.all}),onError:e=>Y(e.message,{tone:`danger`})}),f=B({mutationFn:({id:e,title:t})=>se(e,{title:t}),onSuccess:e=>{on(s,e),s.invalidateQueries({queryKey:z.runs.all})},onError:e=>Y(e.message,{tone:`danger`})}),p=vn(`tasks_table`),m=f.mutate,h=X.useCallback((e,t)=>m({id:e,title:t}),[m]),g=p.mutate,_=X.useCallback((e,t)=>g({id:e.id,pinned:t},{onError:e=>Y(e.message,{tone:`danger`})}),[g]),v=kk(),[y,b]=Xp(),x=h_(),S=E_(),C=X.useMemo(()=>(e.data??[]).some(e=>e.automation??e.automationTrigger??e.automationTracker),[e.data]),w=g_(x.known&&!x.off&&(C&&y!==`regular`||S&&a===`active`)),T=X.useMemo(()=>w.data?new Map(w.data.automations.map(e=>[e.id,e.name])):void 0,[w.data]),D=Wt();return(0,Z.jsx)(Ca,{projectId:D,requests:X.useMemo(()=>D===void 0?[]:(e.data??[]).flatMap(e=>xe(e).map(e=>({projectId:D,kind:e.kind,number:e.number}))),[e.data,D]),children:(0,Z.jsx)(Uk,{scheduledTasks:a===`active`?(0,Z.jsx)(y_,{enabled:S}):void 0,hasScheduledTasks:a===`active`&&!!w.data?.automations.some(e=>e.deferredStart),runs:e.data,view:a,onViewChange:o,onArchiveFinished:()=>u.mutate(),onMarkAllRead:()=>d.mutate(),onRename:h,onTogglePin:_,onTaskAction:l,showTokens:n.tokens,showCost:n.cost,expandedColumns:v.expandedColumns,onToggleColumn:v.toggleColumn,columnsPending:v.isPending,origin:y,onOriginChange:b,gitRepo:i,automationNames:T,firstRun:a===`active`?(0,Z.jsx)(nb,{gitRepo:r.data?r.data.info!==null:r.isError?!0:void 0}):void 0,initialQuery:t,cacheStatus:(0,Z.jsx)(Tg,{queryKey:z.runs.list(),isFetching:e.isFetching,isError:e.isError})})})}var gA={question:0,review:1,budget:2,waiting:2,lifecycle:2,failed:3},_A={question:`answer`,review:`review`,budget:`resume`,waiting:`reply`,lifecycle:`open`,failed:`retry`},vA={answer:`Answer`,review:`Review changes`,resume:`Resume`,reply:`Reply`,open:`Open`,retry:`Retry`},yA=140;function bA(e){let t=e?.split(`
31
31
  `).find(e=>e.trim()!==``)?.trim();if(t)return t.length>yA?`${t.slice(0,yA-1)}…`:t}function xA(e){return`$${e>=10?e.toFixed(0):e.toFixed(2)}`}function SA(e){if(!e.archived){if(e.worktreeLifecycle?.needsAttention)return`lifecycle`;if(jt(e))return`question`;if(e.status===`review`)return`review`;if(e.status===`waiting`)return st(e)?`budget`:`waiting`;if(e.status===`failed`&&!e.autoResumeAt&&!jn(e))return`failed`}}function CA(e,t){let n=s(e),r={run:e,reason:t,action:_A[t],since:e.waitingSince??e.awaitingAnswerSince??er(e),tone:n.tone,pulse:n.pulse};switch(t){case`question`:return{...r,label:`Asked a question`};case`review`:return{...r,label:`Finished, waiting for review`};case`budget`:{let t=st(e);return{...r,label:`Budget reached`,...t?{detail:`${xA(t.spent)} of ${xA(t.ceiling)} spent`}:{}}}case`waiting`:return{...r,label:`Paused, waiting for your reply`};case`lifecycle`:return{...r,label:e.worktreeLifecycle?.phase===`setup`?`Worktree setup needs attention`:`Worktree cleanup needs attention`};case`failed`:{let t=bA(e.error);return{...r,label:`Failed`,...t?{detail:t}:{}}}}}function wA(e){let t=[];for(let n of e){let e=SA(n);e&&t.push(CA(n,e))}return t.sort((e,t)=>gA[e.reason]-gA[t.reason]||t.since.localeCompare(e.since))}function TA(e){let t=[];for(let n of e){if(n.archived)continue;let e=n.status===`running`?`running`:n.status===`queued`?`queued`:n.status===`failed`&&n.autoResumeAt?`scheduled`:void 0;if(!e)continue;let r=n.steps??[],i=Gi(r),a=r[i];t.push({run:n,kind:e,...a&&e===`running`?{step:{index:i+1,total:r.length,name:a.name}}:{},progress:e===`running`?Ki(r):0,label:s(n).label})}let n={running:0,queued:1,scheduled:2};return t.sort((e,t)=>n[e.kind]-n[t.kind]||(e.kind===`queued`?e.run.createdAt.localeCompare(t.run.createdAt):er(t.run).localeCompare(er(e.run))))}function EA(e){if(e===void 0)return;let t=new Date(e);if(!Number.isNaN(t.getTime()))return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function DA(e,t){let n=EA(t);return e.filter(e=>e.archived||!e.finishedAt?!1:(e.status===`done`||e.status===`cancelled`||jn(e))&&EA(e.finishedAt)===n).sort((e,t)=>(t.finishedAt??``).localeCompare(e.finishedAt??``))}function OA(e,t){return new Intl.DateTimeFormat(t,{weekday:`long`,day:`numeric`,month:`long`}).format(new Date(e))}var kA=[],AA=3e4;function jA({runs:e,projectName:t,now:n,onArchiveFinished:r,onRetry:i,firstRun:a,scheduledTasks:o,hasScheduledTasks:s=!1,setupPill:c,welcomeBack:l}){let u=Ql(AA,n===void 0),d=n??u,f=e??kA,p=X.useMemo(()=>wA(f),[f]),m=X.useMemo(()=>TA(f),[f]),h=X.useMemo(()=>DA(f,d),[f,d]),g=X.useMemo(()=>Ye(f),[f]),_=X.useMemo(()=>f.some(e=>!e.archived),[f]),v=Lr(),[y,b]=X.useState(``);return(0,Z.jsx)(jk,{intervalMs:AA,now:n,children:(0,Z.jsxs)(`div`,{"data-route":`now`,className:`flex min-h-full flex-col`,children:[(0,Z.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,Z.jsx)(`h1`,{className:`text-base font-semibold`,children:`Now`}),(0,Z.jsxs)(`span`,{"data-slot":`now-date`,className:`text-label text-soft-foreground`,children:[t?`${t} · `:``,OA(d)]}),(0,Z.jsx)(`div`,{className:`flex-1`}),(0,Z.jsxs)(`form`,{role:`search`,className:`relative w-60`,onSubmit:e=>{e.preventDefault();let t=y.trim();v(t?`/tasks?q=${encodeURIComponent(t)}`:`/tasks`)},children:[(0,Z.jsx)(is,{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,Z.jsx)(`input`,{type:`search`,value:y,onChange:e=>b(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-ui text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,Z.jsx)(q,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,Z.jsxs)(G,{to:`/tasks`,"data-slot":`all-tasks`,children:[`All tasks`,(0,Z.jsx)(pa,{className:`size-3.5`,"aria-hidden":`true`})]})})]}),o,(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-6 p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:e===void 0?null:_?(0,Z.jsxs)(Z.Fragment,{children:[l||c?(0,Z.jsxs)(`div`,{"data-slot":`now-onboarding`,className:`-mb-3 flex flex-col empty:hidden`,children:[l,c]}):null,(0,Z.jsx)(MA,{slot:`needs-you`,title:`Needs you`,count:p.length,empty:`Nothing needs you right now.`,children:p.map(e=>(0,Z.jsx)(FA,{row:e,onRetry:i},e.run.id))}),(0,Z.jsx)(MA,{slot:`running`,title:`Running`,count:m.length,empty:`Nothing is running.`,children:m.map(e=>(0,Z.jsx)(RA,{row:e,queuePosition:g.get(e.run.id)},e.run.id))}),(0,Z.jsxs)(MA,{slot:`finished-today`,title:`Finished today`,count:h.length,empty:`Nothing finished today.`,actions:h.length>0?(0,Z.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,onClick:r,children:[(0,Z.jsx)(Zi,{className:`size-3.5`,"aria-hidden":`true`}),`Archive all finished`]}):null,children:[h.slice(0,8).map(e=>(0,Z.jsx)(zA,{run:e},e.id)),h.length>8?(0,Z.jsxs)(G,{to:`/tasks`,"data-slot":`show-more`,className:`inline-flex h-8 items-center px-2 text-label text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,children:[`Show `,h.length-8,` more`]}):null]})]}):s?(0,Z.jsx)(`p`,{"data-slot":`now-nothing-started`,className:`text-label text-muted-foreground`,children:`No tasks have started yet.`}):a??(0,Z.jsx)(NA,{})}),(0,Z.jsx)(G,{to:`/new`,"data-slot":`new-task-fab`,"aria-label":`New task`,className:`fixed right-4 bottom-[calc(16px+var(--phone-bar,0px)+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,Z.jsx)(ts,{className:`size-[22px]`,"aria-hidden":`true`})})]})})}function MA({slot:e,title:t,count:n,empty:r,actions:i,children:a}){return(0,Z.jsxs)(`section`,{"data-slot":`now-${e}`,"data-count":n,"aria-labelledby":`now-${e}-heading`,className:`flex flex-col`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,Z.jsxs)(`h2`,{id:`now-${e}-heading`,className:`eyebrow flex items-center gap-2 text-soft-foreground`,children:[t,(0,Z.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 font-mono text-micro font-medium tracking-normal text-foreground tabular-nums normal-case`,children:n})]}),(0,Z.jsx)(`div`,{className:`flex-1`}),i]}),n===0?(0,Z.jsx)(`p`,{"data-slot":`now-empty`,className:`px-1 py-2 text-label text-soft-foreground`,children:r}):(0,Z.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:a})]})}function NA(){return(0,Z.jsx)(`div`,{"data-slot":`now-no-tasks`,className:`flex flex-1 flex-col`,children:(0,Z.jsx)(eu,{heading:`h2`,icon:(0,Z.jsx)(gd,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,Z.jsx)(q,{asChild:!0,children:(0,Z.jsxs)(G,{to:`/new`,children:[(0,Z.jsx)(ts,{"aria-hidden":`true`}),`New task`]})})})})}var PA=`grid grid-cols-[10px_minmax(0,1fr)] items-start gap-x-3 gap-y-1 rounded-[10px] border border-border bg-card px-3.5 py-3 md:grid-cols-[16px_minmax(0,1fr)_auto_auto] md:items-center md:gap-x-3.5`;function FA({row:e,onRetry:t}){let{run:n}=e,r=ve(n),i=ze(n.costUsd),a=`/tasks/${n.id}`;return(0,Z.jsxs)(`article`,{"data-slot":`now-row`,"data-run-id":n.id,"data-reason":e.reason,className:H(PA,e.reason===`failed`?`border-danger/45`:`border-info/50`),children:[(0,Z.jsx)(Pl,{tone:e.tone,pulse:e.pulse,className:`mt-1.5 md:mt-0`,"aria-label":e.label}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(G,{to:a,className:`block truncate text-ui font-medium text-foreground`,children:Ge(n)}),(0,Z.jsxs)(`div`,{"data-slot":`now-why`,className:`mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-label text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[e.label,` · `,(0,Z.jsx)(Mk,{at:e.since})]}),e.detail?(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.detail}):null,n.diffStat?(0,Z.jsxs)(`span`,{className:`font-mono text-meta`,children:[n.diffStat.files,` `,n.diffStat.files===1?`file`:`files`,` `,(0,Z.jsx)(Yl,{stat:n.diffStat,className:`text-meta`})]}):null,r?(0,Z.jsx)(Rl,{run:n,reference:r,className:`h-5`}):null]})]}),(0,Z.jsx)(`span`,{"data-slot":`now-cost`,className:`col-start-2 font-mono text-meta text-muted-foreground tabular-nums md:col-start-auto`,children:i||`—`}),(0,Z.jsx)(`div`,{className:`col-start-2 flex md:col-start-auto`,children:(0,Z.jsx)(IA,{row:e,onRetry:t})})]})}function IA({row:e,onRetry:t}){let{run:n,action:r}=e,i=vA[r];if(r===`retry`)return(0,Z.jsx)(LA,{run:n,onRetry:t});let a=r===`review`?`/tasks/${n.id}/changes`:r===`answer`?`/tasks/${n.id}#ask`:r===`open`?`/tasks/${n.id}`:`/tasks/${n.id}#reply`;return(0,Z.jsx)(q,{asChild:!0,size:`sm`,variant:r===`open`?`outline`:`primary`,children:(0,Z.jsx)(G,{to:a,"data-slot":`now-action`,"data-action":r,children:i})})}function LA({run:e,onRetry:t}){let[n,r]=X.useState(!1),i=Ra(e),a=Ia(e).continueRun,o=a?i.usable?void 0:i.reason:`No session to resume — open the task instead.`;return a?(0,Z.jsx)(q,{type:`button`,size:`sm`,variant:`outline`,"data-slot":`now-action`,"data-action":`retry`,disabled:n||o!==void 0,title:o??`Reopen the session and pick up where it stopped`,onClick:()=>{r(!0),t(e).finally(()=>r(!1))},children:n?`Retrying…`:vA.retry}):(0,Z.jsx)(q,{asChild:!0,size:`sm`,variant:`outline`,children:(0,Z.jsx)(G,{to:`/tasks/${e.id}`,"data-slot":`now-action`,"data-action":`open`,children:`Open`})})}function RA({row:e,queuePosition:t}){let{run:n}=e,r=ze(n.costUsd),i=e.kind===`scheduled`?Ee(n):void 0,a=Math.round(e.progress*100);return(0,Z.jsxs)(`article`,{"data-slot":`now-row`,"data-run-id":n.id,"data-kind":e.kind,className:PA,children:[(0,Z.jsx)(Pl,{tone:e.kind===`running`?`violet`:e.kind===`scheduled`?`pending`:`neutral`,pulse:e.kind===`running`,className:`mt-1.5 md:mt-0`,"aria-label":e.label}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(G,{to:`/tasks/${n.id}`,className:`block truncate text-ui font-medium text-foreground`,children:Ge(n)}),(0,Z.jsx)(`div`,{"data-slot":`now-why`,className:`mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-label text-muted-foreground`,children:(0,Z.jsxs)(`span`,{children:[O(n),e.step?` · step ${e.step.index} of ${e.step.total} · ${e.step.name}`:``,e.kind===`queued`&&t!==void 0?` · #${t} in queue`:``,i?` · resumes ${i.label}`:``,e.label===`monitoring`?` · watching`:``]})})]}),e.kind===`running`?(0,Z.jsx)(`div`,{role:`progressbar`,"aria-label":`Steps done`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a,"data-slot":`now-progress`,className:`col-start-2 h-1 w-24 overflow-hidden rounded-full bg-muted md:col-start-auto`,children:(0,Z.jsx)(`span`,{className:`block h-full rounded-full bg-violet`,style:{width:`${a}%`}})}):(0,Z.jsx)(`span`,{className:`hidden md:block`}),(0,Z.jsxs)(`span`,{"data-slot":`now-cost`,className:`col-start-2 font-mono text-meta text-muted-foreground tabular-nums md:col-start-auto`,children:[n.startedAt?(0,Z.jsx)(Mk,{at:n.startedAt}):null,n.startedAt&&r?` · `:``,r,!n.startedAt&&!r?`—`:``]})]})}function zA({run:e}){let t=ve(e),n=ka(e),r=s(e),i=X.useId();return(0,Z.jsxs)(`article`,{"data-slot":`now-row`,"data-run-id":e.id,"data-kind":`finished`,className:`grid grid-cols-[14px_minmax(0,1fr)_auto] items-center gap-x-3 px-3.5 py-1.5 md:grid-cols-[16px_minmax(0,1fr)_auto_auto] md:gap-x-3.5`,children:[(0,Z.jsx)(vk,{attention:r}),(0,Z.jsxs)(G,{to:`/tasks/${e.id}`,"aria-describedby":i,"data-unread":n||void 0,className:H(`min-w-0 truncate text-ui hover:text-foreground`,n?`font-semibold text-foreground`:`text-muted-foreground`),children:[Ge(e),(0,Z.jsx)(yk,{id:i,attention:r}),n?(0,Z.jsx)(D_,{}):null]}),t?(0,Z.jsx)(Rl,{run:e,reference:t,compact:!0,className:`hidden h-5 md:inline-flex`}):(0,Z.jsx)(`span`,{className:`hidden md:block`}),(0,Z.jsx)(`span`,{className:`text-meta text-soft-foreground tabular-nums`,children:e.finishedAt?(0,Z.jsx)(Mk,{at:e.finishedAt}):null})]})}function BA(){let e=F(),t=_n(),n=E(),r=Nr(),i=X.useMemo(()=>{let e=r??n.data?.bootProject;return n.data?.projects?.find(t=>t.id===e)?.name},[r,n.data]),a=V(),o=()=>a.invalidateQueries({queryKey:z.runs.all}),s=B({mutationFn:Zn,onSuccess:o}),c=B({mutationFn:e=>Fl(()=>be(e.id)),onSuccess:o,onError:e=>Y(e.message,{tone:`danger`})}),l=h_(),u=E_(),d=!!g_(l.known&&!l.off&&u).data?.automations.some(e=>e.deferredStart),f=c.mutateAsync,p=X.useCallback(e=>f(e).catch(()=>void 0),[f]),m=Wt();return(0,Z.jsx)(Ca,{projectId:m,requests:X.useMemo(()=>m===void 0?[]:(e.data??[]).flatMap(e=>xe(e).map(e=>({projectId:m,kind:e.kind,number:e.number}))),[e.data,m]),children:(0,Z.jsx)(jA,{runs:e.data,projectName:i,onArchiveFinished:()=>s.mutate(),onRetry:p,firstRun:(0,Z.jsx)(nb,{gitRepo:t.data?t.data.info!==null:t.isError?!0:void 0}),scheduledTasks:(0,Z.jsx)(y_,{enabled:u}),hasScheduledTasks:d,setupPill:(0,Z.jsx)(Nb,{}),welcomeBack:(0,Z.jsx)(Yb,{runs:e.data??kA})})})}var VA=[],HA=` untagged`,UA=[{value:`project`,label:`Project`},{value:`tag`,label:`Tag`},{value:`status`,label:`Status`},{value:`workflow`,label:`Workflow`}];function WA(e,t){return e===t?`none`:t}function GA(e,t){return[...e].sort((e,n)=>pe(bn(e.run,t),bn(n.run,t)))}var KA={query:``,tags:[],statuses:[],workflows:[]};function qA(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function JA(e){return e.tags.length+e.statuses.length+e.workflows.length}function YA(e){return e.query.trim()!==``||JA(e)>0}function XA(e){return JA(e.filters)+(e.filters.query.trim()===``?0:1)+(e.groupBy===`none`?0:1)}function ZA(e){return XA(e)>0}function QA(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??VA}})}var $A=e=>`${e.projectId}/${e.id}`;function ej(e){let t=new Map(e.map(e=>[$A(e.run),e.run]));return new Map(e.map(e=>[$A(e.run),zp(e.run,n=>t.get(`${e.run.projectId}/${n}`))]))}function tj(e,t,n){return e.filter(e=>Hp(n.get($A(e.run)),t))}function nj(e){let t=new Set;for(let n of e)t.add(n.run.workflow);return[...t].sort((e,t)=>e.localeCompare(t))}function rj(e){let t=new Set;for(let n of e)t.add(n.run.status);return[...t].sort((e,t)=>e.localeCompare(t))}function ij(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 aj=e=>e.tags.length===0?[HA]:e.tags,oj=(e,t)=>e.length===0||t.some(t=>e.includes(t)),sj=(e,t)=>{if(t.length===0)return!0;let n=aj(e).map(e=>e.toLowerCase());return t.some(e=>n.includes(e.toLowerCase()))};function cj(e){return[Ge(e.run),e.projectName,e.run.workflow,e.run.branch??``,...e.tags].join(`
32
- `).toLowerCase()}function lj(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)||!oj(t.statuses,[e.run.status])||!oj(t.workflows,[e.run.workflow])||!sj(e,t.tags))return!1;if(r.length===0)return!0;let i=cj(e);return r.every(e=>i.includes(e))})}function uj(e,t,n,r){return lj(e,{...t,[r]:[]},n)}function dj(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(HA,`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 fj(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var pj={query:`q`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,sort:`sort`,archived:`archived`},mj=new Set(UA.map(e=>e.value));function hj(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set(pj.query,n);for(let n of e.filters.tags)n===` untagged`?t.set(pj.untagged,`1`):t.append(pj.tag,n);for(let n of e.filters.statuses)t.append(pj.status,n);for(let n of e.filters.workflows)t.append(pj.workflow,n);return e.groupBy!==`none`&&t.set(pj.groupBy,e.groupBy),e.sortBy!==`recent`&&t.set(pj.sort,e.sortBy),e.view===`archived`&&t.set(pj.archived,`1`),t}function gj(e){let t=e.getAll(pj.tag).filter(e=>e!==``);e.get(pj.untagged)===`1`&&t.push(HA);let n=e.get(pj.groupBy)??``;return{filters:{query:e.get(pj.query)??``,tags:t,statuses:e.getAll(pj.status).filter(e=>e!==``),workflows:e.getAll(pj.workflow).filter(e=>e!==``)},groupBy:mj.has(n)?n:`none`,sortBy:e.get(pj.sort)===`created`?`created`:`recent`,view:e.get(pj.archived)===`1`?`archived`:`active`}}var _j=15e3,vj=e=>e?.runs.some(e=>e.usage!==void 0)?_j:!1,yj=3e4,bj=250,xj=1,Sj=new Set([`done`,`failed`,`cancelled`]);function Cj(){return Tj({request:({task:e,archived:t})=>yt(e.run.projectId,e.run.id,t,`all_tasks`),patch:({archived:e})=>t=>({...t,archived:e})})}function wj(){return Tj({request:({task:e,read:t})=>fe(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 Tj({request:e,patch:t}){let n=V();return B({mutationFn:e,onMutate:async e=>{await n.cancelQueries({queryKey:R.runsIndex});let r=n.getQueryData(R.runsIndex),i=t(e),{task:a}=e;return n.setQueryData(R.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(R.runsIndex,r.previous),Y(e.message,{tone:`danger`})},onSettled:(e,t,{task:r})=>{n.invalidateQueries({queryKey:R.runsIndex}),n.invalidateQueries({queryKey:z.runs.all}),n.invalidateQueries({queryKey:[r.run.projectId,`runs`,`list`]})}})}function Ej(){let e=i(),t=Zl(E().data),n=Le(!0,vj),[r,a]=Or(),{filters:o,groupBy:s,sortBy:c,view:l}=X.useMemo(()=>gj(r),[r]),[u,d]=fg();X.useEffect(()=>{u!==l&&d(l)},[l,u,d]);let f=e=>a(t=>hj(e(gj(t))),{replace:!0}),p=e=>f(t=>({...t,filters:e(t.filters)})),m=e=>f(t=>({...t,groupBy:e})),h=e=>f(t=>({...t,sortBy:e})),g=e=>f(t=>({...t,view:e})),[_,v]=X.useState(o.query),[y,b]=X.useState(new Set),x=X.useCallback(e=>b(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),[]),S=o.query.trim()!==``,C=X.useCallback(e=>S||y.has(e),[S,y]),w=X.useRef(o.query);X.useEffect(()=>{o.query!==w.current&&v(o.query),w.current=o.query},[o.query]),X.useEffect(()=>{if(_===w.current)return;let e=setTimeout(()=>{w.current=_,p(e=>({...e,query:_}))},bj);return()=>clearTimeout(e)},[_]);let T=n.data?.referenceStatuses;X.useEffect(()=>{T&&Vt(T)},[T]);let D=X.useMemo(()=>e.data?.projects??[],[e.data]),O=X.useMemo(()=>QA(n.data?.runs??[],D),[n.data,D]),[k,A]=Xp(),j=X.useMemo(()=>ej(O),[O]),M=X.useMemo(()=>tj(O,k,j),[O,k,j]),N=X.useMemo(()=>{let e=e=>lj(tj(O,e,j),o,l).length;return{regular:e(`regular`),automation:e(`automation`),all:e(`all`)}},[O,j,o,l]),P=X.useMemo(()=>GA(lj(M,o,l),c),[M,o,l,c]),ee=X.useMemo(()=>dj(P,s),[P,s]),te=X.useMemo(()=>P.flatMap(e=>xe(e.run,e.project?.repoUrl).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[P]),ne=fj(n.data?.truncated??[],D),re=(e,t)=>p(n=>({...n,[e]:qA(n[e],t)})),ie=e=>p(t=>({...t,[e]:[]})),F=Cj(),ae=wj(),oe=F.mutate,se=X.useCallback((e,t)=>oe({task:e,archived:t}),[oe]),ce=ae.mutate,le=X.useCallback((e,t)=>ce({task:e,read:t}),[ce]);if(n.isError||e.isError)return(0,Z.jsx)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(eu,{icon:(0,Z.jsx)(ja,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:(n.error??e.error)?.message,actions:(0,Z.jsx)(q,{type:`button`,variant:`outline`,"data-action":`retry-global-tasks`,onClick:()=>{n.refetch(),e.refetch()},children:`Try again`})})});let I=(0,Z.jsxs)(`div`,{className:`relative w-full md:w-60`,children:[(0,Z.jsx)(is,{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,Z.jsx)(`input`,{type:`text`,value:_,onChange:e=>v(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-ui text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]});return(0,Z.jsxs)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:[(0,Z.jsxs)(`header`,{"data-slot":`global-tasks-header`,className:`sticky top-0 z-10 flex h-12 shrink-0 items-center gap-3 border-b border-border bg-background px-3 md:h-14 md:px-5`,children:[(0,Z.jsx)(`h1`,{className:`hidden text-base font-semibold md:block`,children:`All tasks`}),(0,Z.jsx)(_i,{slot:`overview-tabs`,label:`Which tasks`,value:l,options:[{value:`active`,label:`Active`},{value:`archived`,label:`Archived`}],onChange:g}),(0,Z.jsx)(`div`,{className:`flex-1`}),(0,Z.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`hidden text-label text-soft-foreground tabular-nums md:inline`,children:[P.length,` of `,O.length]}),(0,Z.jsx)(`div`,{className:`hidden md:block`,children:I})]}),(0,Z.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,Z.jsx)(`div`,{className:`md:hidden`,children:I}),(0,Z.jsx)(Dj,{filters:o,onToggle:re,onClearFacet:ie,onClearAll:()=>{v(``),f(e=>({...e,filters:KA,groupBy:`none`}))},groupBy:s,onGroupByChange:m,sortBy:c,onSortByChange:h,projects:D,tasks:M,view:l,origin:k,onOriginChange:A,originCounts:N}),ne.length>0?(0,Z.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-meta text-soft-foreground`,children:[`Showing the `,n.data?.perProjectLimit,` most recently active tasks per project — older ones in`,` `,ne.join(`, `),` are only in that project’s own Tasks page.`]}):null,n.data===void 0?null:P.length===0?(0,Z.jsx)(Hj,{view:l,filtered:YA(o),origin:k,hiddenByOrigin:k!==`all`&&N.all>0,onShowAll:()=>A(`all`)}):(0,Z.jsx)(jk,{intervalMs:yj,children:(0,Z.jsx)(Ca,{requests:te,children:ee.map(e=>(0,Z.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":e.key,children:[s===`none`?null:(0,Z.jsxs)(`h2`,{className:`mb-1.5 flex items-center gap-2 eyebrow text-soft-foreground`,children:[s===`project`?(0,Z.jsx)(U,{to:Br(e.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:e.label}):e.label,(0,Z.jsx)(`span`,{className:`font-mono text-meta font-medium tabular-nums`,children:e.tasks.length})]}),(0,Z.jsx)(kj,{tasks:e.tasks,sortBy:c,isSubtasksExpanded:C,onToggleSubtasks:x,showProject:s!==`project`,onArchive:se,onSetRead:le,busy:F.isPending||ae.isPending,showCost:t.cost})]},e.key))})})]})]})}function Dj({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,sortBy:o,onSortByChange:s,projects:c,tasks:l,view:u,origin:d,onOriginChange:f,originCounts:p}){let m=X.useMemo(()=>Lt(c),[c]),h=X.useMemo(()=>{let t=(t,n)=>ij(uj(l,e,u,t),n);return{tags:t(`tags`,aj),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[l,e,u]),g=e=>t=>({...t,count:e.get(t.value)??0});return(0,Z.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,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Z.jsx)(_i,{slot:`task-origin`,label:`Show tasks started by`,value:d,options:Ip.map(e=>({...e,count:p[e.value]})),onChange:f}),(0,Z.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Z.jsx)(fk,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:rj(l).map(e=>({value:e,label:e})).map(g(h.statuses)),emptyLabel:`No tasks to filter`}),(0,Z.jsx)(fk,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:nj(l).map(e=>({value:e,label:e})).map(g(h.workflows)),emptyLabel:`No tasks to filter`}),(0,Z.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`text-meta font-medium text-soft-foreground`,children:`Group by`}),(0,Z.jsx)(mk,{slot:`group-by`,label:`Group tasks by`,value:i,options:UA,onChange:e=>a(WA(i,e))}),(0,Z.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`text-meta font-medium text-soft-foreground`,children:`Sort by`}),(0,Z.jsx)(_i,{slot:`sort-by`,label:`Sort tasks by`,value:o,options:re,onChange:s}),ZA({filters:e,groupBy:i})?(0,Z.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-label font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,Z.jsx)(us,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${XA({filters:e,groupBy:i})})`]}):null]}),m.length>0?(0,Z.jsxs)(`div`,{"data-slot":`tag-filters`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-meta font-medium text-soft-foreground`,children:`Tags`}),m.map(n=>(0,Z.jsx)(pk,{slot:`tag-filter`,tone:`tag`,label:n,count:h.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,Z.jsx)(pk,{slot:`tag-filter`,label:`Untagged`,count:h.tags.get(` untagged`)??0,selected:e.tags.includes(HA),onToggle:()=>t(`tags`,HA)})]}):(0,Z.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-meta text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,Z.jsx)(U,{to:`/settings/global/projects`,className:`font-medium text-violet hover:underline`,children:`Settings → Projects`}),` `,`to group their tasks together here.`]})]})}var Oj=e=>e.dispatch;function kj({tasks:e,sortBy:t,isSubtasksExpanded:n,onToggleSubtasks:r,showProject:i,onArchive:a,onSetRead:o,busy:s,showCost:c}){let l=X.useMemo(()=>U_(e.map(e=>({id:e.run.id,dispatch:Oj(e.run),task:e})),n),[e,n]),u=Ik(l.length),d=[(0,Z.jsx)(Aj,{className:`w-[104px]`,children:`Status`},`status`),(0,Z.jsx)(Aj,{children:`Task`},`task`),i?(0,Z.jsx)(Aj,{className:`w-[124px]`,children:`Project`},`project`):null,(0,Z.jsx)(Aj,{className:`hidden w-[120px] xl:table-cell`,children:`Tags`},`tags`),(0,Z.jsx)(Aj,{className:`w-[84px]`,children:`Ref`},`ref`),(0,Z.jsx)(Aj,{className:`hidden w-[108px] xl:table-cell`,children:`Workflow`},`workflow`),c?(0,Z.jsx)(Aj,{className:`hidden w-[64px] text-right lg:table-cell`,children:`Cost`},`cost`):null,(0,Z.jsx)(Aj,{className:`hidden w-[56px] text-right xl:table-cell`,children:`CPU`},`cpu`),(0,Z.jsx)(Aj,{className:`hidden w-[84px] text-right xl:table-cell`,children:`Mem`},`mem`),(0,Z.jsx)(Aj,{className:`w-[72px] text-right`,children:ue(t)},`age`),(0,Z.jsx)(Aj,{className:`w-[64px] text-right`,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})},`actions`)].filter(e=>e!==null),f=d.length;return(0,Z.jsx)(`div`,{"data-slot":`global-tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card shadow-xs`,children:(0,Z.jsx)(Zc,{children:(0,Z.jsxs)(`table`,{className:`w-full border-collapse`,"aria-rowcount":u.ariaRowCount,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsx)(`tr`,{"aria-rowindex":u.windowed?1:void 0,children:d})}),(0,Z.jsxs)(`tbody`,{ref:u.anchorRef,className:`[&>tr:last-child>td]:border-b-0`,children:[(0,Z.jsx)(Fk,{height:u.padTop,colSpan:f}),l.slice(u.start,u.end).map((e,l)=>(0,Z.jsx)(Pj,{ariaRowIndex:u.ariaRowIndex(u.start+l),task:e.run.task,depth:e.depth,childCount:e.childCount,subtasksExpanded:n(e.run.id),onToggleSubtasks:r,sortBy:t,showProject:i,onArchive:a,onSetRead:o,busy:s,showCost:c},`${e.run.task.run.projectId}/${e.run.task.run.id}`)),(0,Z.jsx)(Fk,{height:u.padBottom,colSpan:f})]})]})})})}function Aj({children:e,className:t}){return(0,Z.jsx)(`th`,{scope:`col`,className:H(`h-[38px] border-b border-border px-2.5 text-left eyebrow whitespace-nowrap text-soft-foreground first:pl-4 last:pr-4`,t),children:e})}var jj=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function Mj(e){return e.archived||e.status===`done`||e.status===`cancelled`||jn(e)}function Nj({attention:e,archived:t}){return(0,Z.jsx)(`span`,{"data-slot":`status-quiet`,className:`inline-flex h-5 items-center px-2.5`,children:(0,Z.jsx)(vk,{attention:e,showLabel:t})})}var Pj=X.memo(function({ariaRowIndex:e,task:t,depth:n,childCount:r,subtasksExpanded:i,onToggleSubtasks:a,sortBy:o,showProject:c,onArchive:l,onSetRead:u,busy:d,showCost:f}){let{run:p}=t,m=s(p),h=Br(p.projectId,`/tasks/${p.id}`),g=ka(p),_=Na(p),v=xe(p,t.project?.repoUrl),y=W_(r),b=ke(p,p.usage),x=X.useId(),S=Mj(p);return(0,Z.jsxs)(`tr`,{"data-slot":`global-task-row`,"data-run-id":p.id,"aria-rowindex":e,"data-project":p.projectId,"data-depth":n,className:`group/row hover:bg-muted`,children:[(0,Z.jsx)(`td`,{className:jj,children:S?(0,Z.jsx)(Nj,{attention:m,archived:!!p.archived}):(0,Z.jsx)(Jl,{dot:m.tone,pulse:m.pulse,children:m.label})}),(0,Z.jsx)(`td`,{className:H(jj,`min-w-[320px] max-w-0`),children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,style:n>0?{paddingLeft:`${n*14}px`}:void 0,children:[n>0?(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`subtask-tick`,className:`shrink-0 font-mono text-meta leading-none text-soft-foreground`,children:`└`}):null,(0,Z.jsxs)(U,{to:h,title:Ge(p),"aria-describedby":S?x:void 0,className:H(`min-w-0 truncate text-ui`,g?`font-semibold text-foreground`:_?`font-medium text-muted-foreground`:`font-medium`),children:[Ge(p),S?(0,Z.jsx)(yk,{id:x,attention:m}):null,g?(0,Z.jsx)(D_,{}):null]}),G_(p)?(0,Z.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,children:G_(p)}):null,y?(0,Z.jsx)(bk,{label:y,expanded:i,onToggle:()=>a(p.id)}):null]})}),c?(0,Z.jsx)(`td`,{className:H(jj,`text-label text-muted-foreground`),children:(0,Z.jsx)(U,{to:Br(p.projectId,`/`),className:`truncate hover:text-foreground`,children:t.projectName})}):null,(0,Z.jsx)(`td`,{className:H(jj,`hidden xl:table-cell`),children:t.tags.length>0?(0,Z.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:t.tags.map(e=>(0,Z.jsx)(zj,{tag:e},e))}):(0,Z.jsx)(Vj,{})}),(0,Z.jsx)(`td`,{className:jj,children:v.length>0?(0,Z.jsx)(Rj,{references:v,run:p}):(0,Z.jsx)(Vj,{})}),(0,Z.jsx)(`td`,{className:H(jj,`hidden text-label text-muted-foreground xl:table-cell`),children:p.workflow}),f?(0,Z.jsx)(`td`,{className:H(jj,`hidden text-right font-mono text-xs text-muted-foreground tabular-nums lg:table-cell`),children:ze(p.costUsd)||(0,Z.jsx)(Vj,{})}):null,(0,Z.jsx)(Bj,{column:`cpu`,cell:b.cpu}),(0,Z.jsx)(Bj,{column:`memory`,cell:b.mem}),(0,Z.jsx)(`td`,{className:H(jj,`text-right text-label text-muted-foreground tabular-nums`),children:(0,Z.jsx)(Mk,{at:bn(p,o)})}),(0,Z.jsx)(`td`,{className:H(jj,`text-right`),children:(0,Z.jsxs)(`span`,{"data-slot":`row-controls`,className:`inline-flex items-center gap-0.5 opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 no-hover:opacity-100`,children:[(0,Z.jsx)(Ij,{task:t,busy:d,onSetRead:u}),(0,Z.jsx)(Lj,{task:t,busy:d,onArchive:l})]})})]})},Fj);function Fj(e,t){let{task:n,...r}=e,{task:i,...a}=t;return n.run!==i.run||n.project!==i.project||n.projectName!==i.projectName||n.tags!==i.tags?!1:Object.keys(r).every(e=>r[e]===a[e])}function Ij({task:e,busy:t,onSetRead:n}){if(!Fa(e.run))return null;let r=ka(e.run),i=Ge(e.run),a=r?`Mark ${i} read`:`Mark ${i} unread`,o=r?So:td;return(0,Z.jsxs)(Qc,{children:[(0,Z.jsx)(Xc,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,"data-action":r?`mark-read`:`mark-unread`,"aria-label":a,disabled:t,onClick:()=>n(e,r),className:H(`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,Z.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Z.jsx)($c,{side:`left`,children:r?`Mark read`:`Mark unread`})]})}function Lj({task:e,busy:t,onArchive:n}){let r=e.run.archived;if(!r&&!Sj.has(e.run.status))return null;let i=r?`Restore ${Ge(e.run)} to the active list`:`Archive ${Ge(e.run)}`;return(0,Z.jsxs)(Qc,{children:[(0,Z.jsx)(Xc,{asChild:!0,children:(0,Z.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,Z.jsx)(r?Hu:Zi,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Z.jsx)($c,{side:`left`,children:r?`Restore`:`Archive`})]})}function Rj({references:e,run:t}){let n=e.slice(0,xj),r=e.length-n.length,i=Ge(t);return(0,Z.jsxs)(`span`,{className:`flex flex-nowrap items-center gap-1`,children:[n.map(e=>(0,Z.jsx)(Ta,{reference:e,taskTitle:i,projectId:t.projectId,conflictAction:(0,Z.jsx)(Il,{projectId:t.projectId,runId:t.id,prNumber:e.number}),className:`shrink-0`},`${e.kind}#${e.number}`)),r>0?(0,Z.jsx)(Ll,{references:e,taskTitle:i,hidden:r,projectId:t.projectId}):null]})}function zj({tag:e,className:t}){return(0,Z.jsx)(`span`,{"data-slot":`project-tag`,className:H(`inline-flex max-w-full items-center truncate rounded-full bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,t),children:e})}function Bj({column:e,cell:t}){return(0,Z.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-usage-kind":t.kind,title:t.title,className:H(jj,`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-meta text-soft-foreground`,t.kind===`none`&&`text-label text-soft-foreground`),children:t.text||`—`})}function Vj(){return(0,Z.jsx)(`span`,{className:`text-label text-soft-foreground`,children:`—`})}function Hj({view:e,filtered:t,origin:n=`all`,hiddenByOrigin:r=!1,onShowAll:i=()=>void 0}){return r?(0,Z.jsx)(`div`,{"data-slot":`global-tasks-empty`,"data-empty-kind":`origin-hidden`,children:(0,Z.jsx)(eu,{heading:`h2`,icon:(0,Z.jsx)(ja,{}),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,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:i,children:`Show all tasks`})})}):t?(0,Z.jsx)(eu,{heading:`h2`,icon:(0,Z.jsx)(rs,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,Z.jsx)(eu,{heading:`h2`,icon:(0,Z.jsx)(Zi,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,Z.jsx)(eu,{heading:`h2`,icon:(0,Z.jsx)(gd,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}var Uj=Cl(`dashboard`,()=>Dr(()=>import(`./dashboard-Bl6qWW8i.js`).then(e=>({default:e.DashboardRoute})),__vite__mapDeps([47,1,2,3,4,5,48,44,49,50,6,51,14,7,30,8,9,10,11,12,13,15,52,17,16,18,53,54,55,56,57,58,59]))),Wj=Cl(`compare`,()=>Dr(()=>import(`./compare-variants-C9soYpuE.js`).then(e=>({default:e.CompareVariantsRoute})),__vite__mapDeps([60,1,2,3,4,5,48,44,14,7,61,62,28,56,32,15,63,58,64,65,66,67,68,69]))),Gj=Cl(`task-commits`,()=>Dr(()=>import(`./task-commits-CHnonzuD.js`).then(e=>e.n).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([70,1,2,3,4,5,48,44,41,71,50,7,72,8,9,10,11,12,13,14,15,73,74,36,17,21,75,26,53,76,77,78,79,80,81,23,56,57,69,82,61,83,24,27,84,55,42,85,32,62,28,29,30,86,87,63,34,45,64,88,89,90,91,92]))),Kj=(0,X.lazy)(()=>Dr(()=>import(`./task-notes-CHs_WZf5.js`).then(e=>({default:e.TaskNotesRoute})),__vite__mapDeps([93,1,2,3,4,5,48,44,71,50,7,72,8,9,10,11,12,13,14,15,73,74,36,17,21,75,26,53,76,77,78,79,80,81,23,56,57,69,82,61,83,24,27,84,55,42,85,32,62,28,29,30,86,87,63,34,45,64,94,95,96,97,98,38,31,65,66,67,90,99,88,89,100]))),qj=Cl(`task-workspace`,()=>Dr(()=>import(`./task-workspace-DWGBLHlR.js`).then(e=>({default:e.TaskWorkspaceRoute})),__vite__mapDeps([101,1,2,3,4,5,44,48,51,14,7,30,41,71,50,72,8,9,10,11,12,13,15,73,74,36,17,21,75,26,53,76,77,78,79,80,81,23,56,57,69,82,61,83,24,27,84,55,42,85,32,62,28,29,86,87,63,34,45,64,102,103,104,94,95,96,97,98,38,31,65,66,67,90,99,88,89,100,105,106,107,108,109,110,16,22,111,37,59,33,112,113,39,40,114,115,92,116,117,118,58,68,119,120,70,91]))),Jj=Cl(`repo-git`,()=>Dr(()=>import(`./repo-git-BcEGYBrc.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([121,1,2,3,4,5,48,44,41,7,102,72,110,14,16,17,78,36,79,80,10,11,81,23,56,57,69,105,12,64,65,28,66,67,96,106,75,107,108,22,61,31,32,88,89,90,122,15,91,92]))),Yj=Cl(`github`,()=>Dr(()=>import(`./github-DvZE0hDJ.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([123,1,2,3,4,5,48,44,49,50,6,51,14,7,30,72,8,9,10,11,12,13,15,73,74,36,17,21,75,26,124,16,77,78,79,80,81,23,56,57,69,108,109,110,97,22,111,84,55,42,85,32,87,37,38,29,34,59,33,112,125,24,25,104,64,115,92,65,28,66,67,126,114,39,40,41,88,89,90,122]))),Xj=Cl(`tracker`,()=>Dr(()=>import(`./tracker-B7u8exjG.js`).then(e=>({default:e.TrackerRoute})),__vite__mapDeps([127,1,2,3,4,5,48,44,41,72,7,8,9,10,11,12,13,14,15,16,17,19,20,21,81,112,23,61,38,125,24,30,26,56,32,85,57,37,29,34,64,115,65,28,66,67,126,73,74,36,75,77,78,79,80,69,109,110,97,22,111,84,55,42,87,59,33,114,39,40,92]))),Zj=Cl(`workflow-graph`,()=>Dr(()=>import(`./workflow-graph-BaZd6m6v.js`).then(e=>({default:e.WorkflowGraphRoute})),__vite__mapDeps([128,1,2,3,4,5,48,44,7,74,14,16,17,9,36,54,77,21,80,129,10,82,130,108,112,22,98,111,125,83,24,12,30,13,28,56,31,32,15,45,64,131]))),Qj=Cl(`terminal`,()=>Dr(()=>import(`./project-terminal-sfYncenW.js`).then(e=>({default:e.ProjectTerminalRoute})),__vite__mapDeps([132,1,2,3,4,5,44,48,83,7,104,87,81,64,120]))),$j=Cl(`skills`,()=>Dr(()=>import(`./skills-CxWFZgjH.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([133,1,2,3,4,5,48,44,7,72,73,74,14,36,17,21,75,26,16,9,19,20,109,110,97,22,111,30,13,84,55,42,85,32,56,87,81,37,38,29,34,59,33,23,12,104,31,64,39,40,41])));function eM(e,t){let n,r=()=>t().then(e=>n=e),i=Cl(e,()=>r().then(e=>({default:e})));function a(){let[e]=(0,X.useState)(()=>n??i);return(0,Z.jsx)(e,{})}return{Route:a,preload:r}}var tM=eM(`manager`,()=>Dr(()=>import(`./manager-index-CeMdRtKd.js`).then(e=>e.ManagerIndexRoute),__vite__mapDeps([134,1,2,3,4,5,48,44,6,74,7,14,22,84,55,42,85,32,59,64,135,33,34,136,109,110,17,16,97,111,30,13,56,87,81,37,38,29,35,36,27,20,39,40,41]))),nM=eM(`manager`,()=>Dr(()=>import(`./manager-new-Bs8_CMUR.js`).then(e=>e.ManagerNewRoute),__vite__mapDeps([136,1,2,3,4,5,48,44,6,109,7,110,14,17,16,97,22,111,30,13,84,55,42,85,32,56,87,81,37,38,29,34,59,33,135,35,36,27,20,39,40,41]))),rM=eM(`manager`,()=>Dr(()=>import(`./manager-chat-BfxPyXv3.js`).then(e=>e.ManagerChatRoute),__vite__mapDeps([137,1,2,3,4,5,48,44,6,7,102,72,8,9,10,11,12,13,14,15,74,18,19,16,17,20,81,130,109,110,97,22,111,30,84,55,42,85,32,56,87,37,38,29,34,59,33,138,23,27,62,104,57,69,64,115,114,36,39,40,41,92,65,28,66,67,90,100,135,119,24,86,73,21,75,26,35,0,25,31]))),iM=tM.Route,aM=nM.Route,oM=rM.Route;function sM(){for(let e of[tM,nM,rM])e.preload().catch(()=>{})}var cM=Cl(`automations`,()=>Dr(()=>import(`./automations-route-3gfbxDq2.js`).then(e=>({default:e.AutomationsRoute})),__vite__mapDeps([139,1,2,3,4,5,48,44,6,49,50,51,14,7,30,102,72,103,28,104,87,81,8,9,10,11,12,13,15,110,52,124,17,16,53,36,19,20,76,54,77,78,79,80,23,56,57,69,95,129,109,97,22,111,84,55,42,85,32,37,38,29,34,59,33,112,83,24,26,62,31,63,64,115,39,40,41,114,92])));function lM(){let e=Kr();return new URLSearchParams(e.search).get(`skill`)===`__bm`?(0,Z.jsx)(Ir,{to:{pathname:`/settings/bookmarklets`,hash:e.hash},replace:!0}):(0,Z.jsx)(Ir,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function uM({sectionId:e}){let t=Kr();return(0,Z.jsx)(Rr,{to:{pathname:PO(`global`,e),search:t.search,hash:t.hash},replace:!0})}function dM(){return(0,Z.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(dl,{label:`Opening project…`})})}function fM(){let{projectId:e=``}=kr(),t=Kr(),n=i(),r=E();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,Z.jsx)(Rr,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,Z.jsx)(dM,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,Z.jsx)(PC,{projectId:e,registry:n.data})}else if(!n.isError)return(0,Z.jsx)(dM,{});return(0,Z.jsxs)(Bt,{projectId:n.data?.bootProject===e?null:e,children:[(0,Z.jsx)(mx,{projectId:e},`webhooks:${e}`),(0,Z.jsx)(Fr,{},e)]})}function pM(){let{projectId:e=``}=kr();return(0,Z.jsx)(SC,{},e)}function mM(){let e=Kr(),t=E(),n=i(),r=t.data?.bootProject??n.data?.bootProject,a=(t.data!==void 0||t.isError)&&(n.data!==void 0||n.isError);if(r===void 0&&!a)return(0,Z.jsx)(dM,{});let o=r??`default`;if(e.pathname===`/`&&e.search===``&&e.hash===``){if(n.data===void 0&&!n.isError)return(0,Z.jsx)(dM,{});let e=sc(pc(),n.data,r);if(e!==null)return(0,Z.jsx)(Rr,{to:e,replace:!0});let t=ac(n.data,o);if(t!==o)return(0,Z.jsx)(Rr,{to:`/p/${encodeURIComponent(t)}/`,replace:!0})}let s=e.pathname===`/p`||e.pathname===`/p/`?`/`:e.pathname;return(0,Z.jsx)(Rr,{to:`/p/${encodeURIComponent(o)}${s}${e.search}${e.hash}`,replace:!0})}function hM(){let e=E(),t=i(),n=Mt(),r=Et(),a=Mc({health:e.data,healthFailed:e.isError,registry:t.data,registryFailed:t.isError,providers:n.data,providersFailed:n.isError,agentCheckSkipped:r.data&&r.data.onboarding?.agentCheckSkipped===!0,uiStateFailed:r.isError});return a===`wait`?(0,Z.jsx)(dM,{}):(a===`manager`&&Oc(`phone_default`),a===`manager`?(0,Z.jsx)(Rr,{to:`/manager`,replace:!0}):(0,Z.jsx)(mM,{}))}function gM(){let e=Kr();return e.pathname===`/`&&e.search===``&&e.hash===``&&Cc(e.key)&&yc()?(0,Z.jsx)(hM,{}):(0,Z.jsx)(mM,{})}function _M(){return bc(Kr().key),null}var vM=[{pattern:`/`,pageLabel:`Now`},{pattern:`/tasks`,pageLabel:`Tasks`},{pattern:`/dashboard`,pageLabel:`Dashboard`},{pattern:`/manager/new`,pageLabel:`New manager`},{pattern:`/manager/*`,pageLabel:`Manager`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/compare/:groupId`,pageLabel:`Compare`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/tracker/*`,pageLabel:`Tracker`},{pattern:`/assets`,pageLabel:`Assets`},{pattern:`/terminal`,pageLabel:`Terminal`},{pattern:`/automations/*`,pageLabel:`Automations`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/inbox`,pageLabel:`Inbox`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function yM(e){let t=Ur(e),n=Gr({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:t===`/tasks`&&jr(e)===null?{pageLabel:`All tasks`,taskId:null}:{pageLabel:vM.find(({pattern:e})=>Gr({path:e,end:!0},t))?.pageLabel??null,taskId:null}}function bM({children:e,fallback:t}){let n=E();return n.data&&n.data.capabilities.managers!==!0?(0,Z.jsx)(Rr,{to:`/`,replace:!0}):(0,Z.jsx)(X.Suspense,{fallback:t,children:e})}var xM=(0,X.memo)(function(){let e=E().data?.capabilities;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_M,{}),(0,Z.jsxs)(Ar,{children:[(0,Z.jsxs)(W,{path:`/p/:projectId`,element:(0,Z.jsx)(fM,{}),children:[(0,Z.jsx)(W,{index:!0,element:(0,Z.jsx)(BA,{})}),(0,Z.jsx)(W,{path:`tasks`,element:(0,Z.jsx)(hA,{})}),(0,Z.jsx)(W,{path:`new`,element:(0,Z.jsx)(pM,{})}),(0,Z.jsx)(W,{path:`tasks/:id`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(da,{}),children:(0,Z.jsx)(qj,{})})}),(0,Z.jsx)(W,{path:`tasks/:id/chat`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(da,{}),children:(0,Z.jsx)(qj,{view:`session`})})}),(0,Z.jsx)(W,{path:`tasks/:id/changes`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`changes`}),children:(0,Z.jsx)(qj,{view:`changes`})})}),(0,Z.jsx)(W,{path:`tasks/:id/files`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`files`}),children:(0,Z.jsx)(qj,{view:`files`})})}),(0,Z.jsx)(W,{path:`tasks/:id/graph`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`changes`}),children:(0,Z.jsx)(qj,{view:`graph`})})}),(0,Z.jsx)(W,{path:`tasks/:id/commits`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`changes`}),children:(0,Z.jsx)(qj,{view:`commits`})})}),(0,Z.jsx)(W,{path:`tasks/:id/notes`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`notes`}),children:(0,Z.jsx)(Kj,{})})}),(0,Z.jsx)(W,{path:`tasks/:id/preview`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`preview`}),children:(0,Z.jsx)(qj,{view:`browser`})})}),(0,Z.jsx)(W,{path:`tasks/:id/assets`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`preview`}),children:(0,Z.jsx)(qj,{view:`assets`})})}),(0,Z.jsx)(W,{path:`tasks/:id/assets/:name`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`preview`}),children:(0,Z.jsx)(qj,{view:`assets`})})}),(0,Z.jsx)(W,{path:`tasks/:id/terminal`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`terminal`}),children:(0,Z.jsx)(qj,{view:`terminal`})})}),(0,Z.jsx)(W,{path:`tasks/:id/commits/:sha`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`changes`}),children:(0,Z.jsx)(Gj,{})})}),(0,Z.jsx)(W,{path:`compare/:groupId`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(_x,{}),children:(0,Z.jsx)(Wj,{})})}),(0,Z.jsx)(W,{path:`git`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(MC,{}),children:(0,Z.jsx)(Jj,{tab:`changes`})})}),(0,Z.jsx)(W,{path:`git/commits`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(MC,{}),children:(0,Z.jsx)(Jj,{tab:`commits`})})}),(0,Z.jsx)(W,{path:`git/commits/:sha`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(MC,{}),children:(0,Z.jsx)(Jj,{tab:`commits`})})}),(0,Z.jsx)(W,{path:`git/branches`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(MC,{}),children:(0,Z.jsx)(Jj,{tab:`branches`})})}),(0,Z.jsx)(W,{path:`git/files`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(MC,{}),children:(0,Z.jsx)(Jj,{tab:`files`})})}),(0,Z.jsx)(W,{path:`git/files/*`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(MC,{}),children:(0,Z.jsx)(Jj,{tab:`files`})})}),(0,Z.jsx)(W,{path:`github`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(vx,{}),children:(0,Z.jsx)(Yj,{view:`issues`,index:!0})})}),(0,Z.jsx)(W,{path:`tracker`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(dM,{}),children:(0,Z.jsx)(Xj,{})})}),(0,Z.jsx)(W,{path:`tracker/:id`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(dM,{}),children:(0,Z.jsx)(Xj,{})})}),(0,Z.jsx)(W,{path:`github/prs`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(vx,{}),children:(0,Z.jsx)(Yj,{view:`prs`})})}),(0,Z.jsx)(W,{path:`github/issues/:n`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(vx,{}),children:(0,Z.jsx)(Yj,{view:`issues`})})}),(0,Z.jsx)(W,{path:`github/prs/:n`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(vx,{}),children:(0,Z.jsx)(Yj,{view:`prs`})})}),(0,Z.jsx)(W,{path:`github/prs/:n/changes`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(vx,{}),children:(0,Z.jsx)(Yj,{view:`prs`,changes:!0})})}),(0,Z.jsx)(W,{path:`automations`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(gx,{}),children:(0,Z.jsx)(cM,{})})}),(0,Z.jsx)(W,{path:`automations/new`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(gx,{}),children:(0,Z.jsx)(cM,{mode:`new`})})}),(0,Z.jsx)(W,{path:`automations/:automationId`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(gx,{}),children:(0,Z.jsx)(cM,{mode:`edit`})})}),(0,Z.jsx)(W,{path:`automations/:automationId/log`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(gx,{}),children:(0,Z.jsx)(cM,{mode:`log`})})}),(0,Z.jsx)(W,{path:`skills`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(NC,{}),children:(0,Z.jsx)($j,{})})}),(0,Z.jsx)(W,{path:`inbox`,element:(0,Z.jsx)(Qx,{})}),(0,Z.jsx)(W,{path:`assets`,element:(0,Z.jsx)(wx,{})}),(0,Z.jsx)(W,{path:`terminal`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(dM,{}),children:(0,Z.jsx)(Qj,{})})}),(0,Z.jsx)(W,{path:`workflows`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(FC,{}),children:(0,Z.jsx)(Zj,{})})}),(0,Z.jsx)(W,{path:`workflows/:name`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(FC,{}),children:(0,Z.jsx)(Zj,{})})}),(0,Z.jsx)(W,{path:`workflows-new/*`,element:(0,Z.jsx)(Ir,{to:`/workflows`,replace:!0})}),(0,Z.jsx)(W,{path:`settings`,element:(0,Z.jsx)(ak,{scope:`project`,capabilities:e})}),(0,Z.jsx)(W,{path:`settings/skills`,element:(0,Z.jsx)(lM,{})}),(0,Z.jsx)(W,{path:`settings/prompt-templates`,element:(0,Z.jsx)(Ir,{to:{pathname:`/settings/instructions`,hash:`#prompt-templates`},replace:!0})}),_O(`project`,e).map(t=>(0,Z.jsx)(W,{path:`settings/${t.id}`,element:(0,Z.jsx)(nk,{section:t,scope:`project`,capabilities:e})},t.id)),_O(`global`,e).map(e=>(0,Z.jsx)(W,{path:`settings/${e.id}`,element:(0,Z.jsx)(uM,{sectionId:e.id})},e.id)),(0,Z.jsx)(W,{path:`*`,element:(0,Z.jsx)(jC,{})})]}),(0,Z.jsx)(W,{path:`/tasks`,element:(0,Z.jsx)(Ej,{})}),(0,Z.jsx)(W,{path:`/dashboard`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(dl,{label:`Loading dashboard…`}),children:(0,Z.jsx)(Uj,{})})}),(0,Z.jsx)(W,{path:`/manager`,element:(0,Z.jsx)(bM,{fallback:(0,Z.jsx)(rS,{}),children:(0,Z.jsx)(iM,{})})}),(0,Z.jsx)(W,{path:`/manager/new`,element:(0,Z.jsx)(bM,{fallback:(0,Z.jsx)(dl,{label:`Loading setup…`}),children:(0,Z.jsx)(aM,{})})}),(0,Z.jsx)(W,{path:`/manager/:id`,element:(0,Z.jsx)(bM,{fallback:(0,Z.jsx)(nS,{}),children:(0,Z.jsx)(oM,{})})}),(0,Z.jsx)(W,{path:`/settings/global`,element:(0,Z.jsx)(ak,{scope:`global`,capabilities:e})}),_O(`global`,e).map(t=>(0,Z.jsx)(W,{path:PO(`global`,t.id),element:(0,Z.jsx)(nk,{section:t,scope:`global`,capabilities:e})},t.id)),e!==void 0&&e.managers!==!0?(0,Z.jsx)(W,{path:PO(`global`,`manager`),element:(0,Z.jsx)(Rr,{to:`/settings/global`,replace:!0})}):null,(0,Z.jsx)(W,{path:`*`,element:(0,Z.jsx)(gM,{})})]})]})});function SM(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 CM(e){return e?.available===!0&&(e.status===`available`||e.status===`error`)}function wM(e,t,n,r){return e===null?t!==null&&n?.projects.some(e=>e.id===t&&e.status!==`missing`)?t:r:e}function TM(e){let t=0;for(let n of e)!n.archived&&n.status===`running`&&(t+=1);return{unread:za(e),needsYou:m(e).waiting,running:t}}var EM=(0,X.memo)(function({children:e}){let{pathname:t,search:n}=Kr(),r=Nr(),a=E(),o=tn(),s=o.data?.branding,c=s!==void 0&&(s.name!==`cezar`||s.logoUrl!==null),l=le(!c&&o.data!==void 0),u=a.data?.capabilities.followups===!0,d=a.data?.capabilities.automations===!0,f=a.data?.capabilities.terminal===!0,p=Fe(u),m=a.data?.capabilities.managers===!0,h=ii(m),g=m&&Ps(t);wc(g),(0,X.useEffect)(()=>{g&&Ud(`${t}${n}`)},[g,t,n]),(0,X.useEffect)(()=>{if(!m)return;let e=window.requestIdleCallback??(e=>window.setTimeout(e,1)),t=window.cancelIdleCallback??window.clearTimeout,n=e(()=>sM());return()=>t(n)},[m]);let _=(0,X.useMemo)(()=>h.data?.managers.map(e=>e.id),[h.data]),v=g?`/manager`:Wd(_),y=g?Gr(`/manager/:id`,t)?.params.id:void 0,b=y===void 0?void 0:h.data?.managers.find(e=>e.id===y)?.name,x=CM(xn(r??``,r!==null).data),S=Jb(Ur(t)),C=i(),w=C.data,T=jr(t);(0,X.useEffect)(()=>{T!==null&&Yd(T)},[T]);let D=w?.bootProject??a.data?.bootProject??null,O=wM(r,r===null?Xd():null,w,D),k=(0,X.useMemo)(()=>dy(w,O,a.data),[w,O,a.data]),A=yM(t),j=ge(O,D,(0,X.useMemo)(()=>TM,[])),M=r!==null&&r===D,N=k?.projects.find(e=>e.id===r),P=k?.projects.find(e=>e.id===O),ee=P?.tracker,te=A.taskId,ne=ot(r??``,N!==void 0&&te!==null,k?.bootProject===r,(0,X.useMemo)(()=>e=>{let t=te?e.find(e=>e.id===te):void 0;return t?Ge(t):void 0},[te])).data,re=t===`/settings/global`||t.startsWith(`/settings/global/`),ie=re?null:b??N?.name??(M?SM(a.data)?.name??null:null);uy({projectName:ie,pageLabel:ne??A.pageLabel,brandName:o.data?.branding.name,brandLogoUrl:o.data?.branding.logoUrl});let F=(0,X.useMemo)(()=>SM(a.data),[a.data?.repo?.root,a.data?.repo?.branch]),ae=(0,X.useMemo)(()=>re?null:{activeId:O,activeName:r===null?P?.name??ie:ie,projects:(k?.projects??[]).map(({id:e,name:t})=>({id:e,name:t}))},[re,O,r,P?.name,ie,k?.projects]),oe=(0,X.useMemo)(()=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(kg,{}),(0,Z.jsx)(xg,{})]}),[]),se=(0,X.useMemo)(()=>(0,Z.jsx)(Lg,{}),[]),ce=(0,X.useMemo)(()=>(0,Z.jsx)(nv,{}),[]),I=(0,X.useMemo)(()=>(0,Z.jsx)(gg,{}),[]),ue=(0,X.useMemo)(()=>(0,Z.jsx)(Xb,{menuItem:!0}),[]),L=a.data?.capabilities.singleProject===!0,de=(0,X.useMemo)(()=>k&&!re?(0,Z.jsx)(t_,{projects:k.projects,activeId:O,singleProject:L}):void 0,[k,re,O,L]),fe=ko(),pe=(0,X.useMemo)(()=>a.data?(0,Z.jsx)(dv,{health:a.data,forge:fe}):void 0,[a.data,fe]),me=a.data?uv(a.data)===`success`?`healthy`:`attention`:null,he=a.data&&me===`attention`?cv(a.data):null,_e=Et(),[ve]=(0,X.useState)(()=>Date.now()),ye=fc(_e.data?.onboarding,{designMode:a.data?.capabilities.designMode,automations:a.data?.capabilities.automations},ve),be=(0,X.useMemo)(()=>(0,Z.jsx)(oy,{}),[]),xe=(0,X.useMemo)(()=>(0,Z.jsx)(ty,{}),[]),Se=(0,X.useMemo)(()=>(0,Z.jsx)(Kv,{}),[]);return(0,Z.jsxs)(dg,{children:[(0,Z.jsx)(Sh,{repo:F,brandName:o.data?.branding.name??`cezar`,brandLogoUrl:o.data?.branding.logoUrl??null,version:a.data?.version??null,latestVersion:a.data?.latestVersion??null,starCount:!c&&l.data?.available?l.data.count??null:null,inboxCount:p.data?.length??null,unreadCount:j.data?.unread??null,nowCount:j.data?.needsYou??null,runningCount:j.data?.running??null,healthStatus:me,skillsUpdateAvailable:x,newNavItems:S,forgeAvailable:fe!=null,inboxAvailable:u,automationsAvailable:d,terminalAvailable:f,tracker:ee,banner:oe,whatsNew:ue,whatsNewUnseen:ye,healthReason:he,linkProjectId:re?null:O,offerAddProject:k===void 0&&C.isError,footerBanner:se,singleProject:L,currentTasks:ce,switcher:de,hostWidget:I,toolsMenu:pe,managersAvailable:m,managerAttention:As(h.data?.managers),managerTo:v,managerSidebar:be,managerRail:xe,managerHeads:Se,projectSwitcher:ae,children:e}),(0,Z.jsx)(Dm,{}),(0,Z.jsx)(Kh,{}),(0,Z.jsx)(ux,{})]})});function DM(){let e=Kr(),t=i();return(0,X.useEffect)(()=>{SO(e)},[e]),(0,X.useEffect)(()=>{let n=cc(e,t.data);n!==null&&(Nc(pc(),n)||tc(n))},[e.hash,e.pathname,e.search,t.data]),null}function OM(){let e=V(),t=Mr(),n=(0,X.useRef)(t);n.current=t;let r=si(Et().data?.notifications).enabled,i=(0,X.useRef)(r);i.current=r;let a=(0,X.useRef)(new Map),o=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let t=Cr(),r=b(z.runs.list()),s=b(ni.list),c=t=>{if(!t)return;let{entering:r,counts:i}=ui(o.current,t.managers);o.current=i;let a=e.getQueryData(z.health)?.capabilities.managerSystemNotifications===!0;if(!(r.length===0||a||!l()))for(let e of r){let t=xc(e);kM(gi(e),n.current,()=>Sc(t))}},l=()=>mi({enabled:i.current,hidden:document.visibilityState===`hidden`,permission:ci()}),u=e=>{let{entering:r,statuses:i}=vi(a.current,e);if(a.current=i,!(r.length===0||!l()))for(let e of r)kM({...oi(e),path:Br(t,`/tasks/${encodeURIComponent(e.id)}`)},n.current)};return u(e.getQueryData(z.runs.list())),c(e.getQueryData(ni.list)),e.getQueryCache().subscribe(e=>{e.type===`updated`&&(e.query.queryHash===r?u(e.query.state.data):e.query.queryHash===s&&c(e.query.state.data))})},[e]),null}function kM(e,t,n){let r=globalThis.Notification;if(typeof r==`function`)try{let i=new r(e.title,{body:e.body,tag:e.tag});i.onclick=()=>{n?.(),window.focus(),t(e.path),i.close()}}catch{}}function AM(e,t=!0){return Xn({queryKey:[...R.dashboard,`insights`,e],enabled:t,staleTime:5e3,refetchInterval:t?15e3:!1,refetchIntervalInBackground:!1,retry:!1,queryFn:async({signal:t})=>ar.parse(await yn(await T.api.v1.workspace.dashboard.insights.$get({query:{period:e,tzOffsetMinutes:String(new Date().getTimezoneOffset())}},{init:{signal:t}}),`/workspace/dashboard/insights`))})}var jM=[`pointerdown`,`pointermove`,`keydown`,`wheel`,`touchstart`];function MM(){let e=document.activeElement;return e?e.isContentEditable||e.tagName===`TEXTAREA`||e.tagName===`INPUT`&&e.type!==`checkbox`:!1}var NM=()=>document.querySelector(`[role="dialog"],[role="alertdialog"]`)!==null;function PM(){let e=V(),t=tn(),n=t.data?.branding,r=n!==void 0&&(n.name!==`cezar`||n.logoUrl!==null),i=le(t.data!==void 0&&!r),a=!r&&i.data?.available===!0,o=!r&&i.data?.available?i.data.count??null:null,[s,c]=(0,X.useState)(!1),l=(0,X.useRef)(a);l.current=a;let u=(0,X.useRef)(new Map),d=(0,X.useRef)(null),f=(0,X.useRef)(0);return(0,X.useEffect)(()=>{let t=b(z.runs.list()),n,r=()=>sf({now:Date.now(),visible:document.visibilityState===`visible`,focused:document.hasFocus(),lastInteractionAt:f.current,typing:MM(),dialogOpen:NM()}),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=nf();if(!(d.current===null||!r()||!l.current)){if(!af(e,Date.now())){d.current=null;return}d.current=null,rf({...e,asks:e.asks+1,lastAskedAt:new Date().toISOString()}),c(!0)}},tf))}},a=e=>{let{succeeded:t,statuses:n}=uf(u.current,e);u.current=n,!(!t||!l.current)&&(of(e)<3||af(nf(),Date.now())&&(d.current=Date.now(),i()))},o=()=>{f.current=Date.now(),i()};for(let e of jM)window.addEventListener(e,o,{passive:!0});document.addEventListener(`visibilitychange`,i),window.addEventListener(`focus`,i),a(e.getQueryData(z.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 jM)window.removeEventListener(e,o);document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`focus`,i)}},[e]),r?null:(0,Z.jsx)(IM,{open:s,onOpenChange:c,count:o})}function FM(e){let t=nf();t&&rf({...t,outcome:e})}function IM({open:e,onOpenChange:t,count:n}){let r=AM(`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,Z.jsx)(ol,{open:e,onOpenChange:t,children:(0,Z.jsxs)(rl,{"data-slot":`star-ask`,className:`gap-0 overflow-hidden p-0 sm:max-w-[440px]`,children:[(0,Z.jsxs)(`div`,{className:`relative flex h-36 items-center justify-center overflow-hidden border-b bg-card-2`,children:[(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`absolute inset-0 bg-[radial-gradient(circle_at_22%_35%,color-mix(in_oklab,var(--primary)_32%,transparent),transparent_55%),radial-gradient(circle_at_80%_70%,color-mix(in_oklab,var(--violet)_38%,transparent),transparent_55%)]`}),(0,Z.jsxs)(`div`,{"aria-hidden":`true`,className:`relative flex items-center gap-4`,children:[(0,Z.jsx)(Rf,{height:52,className:`text-foreground`}),(0,Z.jsx)(`span`,{className:`flex size-12 items-center justify-center rounded-full border bg-card shadow-md`,children:(0,Z.jsx)(Fd,{className:`size-6 fill-current text-pending-strong`})})]}),n!==null&&(0,Z.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-meta text-muted-foreground backdrop-blur`,children:[`⭐ `,$d(n),` stars on GitHub`]})]}),(0,Z.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`span`,{className:`section-mark block eyebrow text-muted-foreground`,children:`Open source · MIT`}),(0,Z.jsx)(il,{className:`text-xl font-semibold tracking-tight`,children:`Is cezar pulling its weight?`}),(0,Z.jsx)(al,{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,Z.jsxs)(`div`,{className:`rounded-lg border bg-card-2 p-3`,children:[(0,Z.jsx)(`span`,{className:`block eyebrow text-soft-foreground`,children:`Your last 30 days with cezar`}),(0,Z.jsx)(`dl`,{className:`mt-2 grid gap-2`,style:{gridTemplateColumns:`repeat(${i.length}, minmax(0, 1fr))`},children:i.map(e=>(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse`,children:[(0,Z.jsx)(`dt`,{className:`text-label text-muted-foreground`,children:e.label}),(0,Z.jsx)(`dd`,{className:`truncate text-lg font-semibold tabular-nums`,children:e.value})]},e.label))})]}),(0,Z.jsx)(q,{asChild:!0,className:`h-11 w-full text-sm font-semibold`,children:(0,Z.jsxs)(`a`,{href:Zd,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{FM(`starred`),t(!1)},children:[(0,Z.jsx)(Fd,{className:`size-4 fill-current`,"aria-hidden":`true`}),`Star cezar on GitHub`,(0,Z.jsx)(Ea,{className:`size-4`,"aria-hidden":`true`})]})}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(q,{variant:`ghost`,className:`min-h-11`,onClick:()=>t(!1),children:`Maybe later`}),(0,Z.jsx)(q,{variant:`ghost`,className:`min-h-11 text-soft-foreground`,onClick:()=>{FM(`never`),t(!1)},children:`Don’t ask again`})]})]})]})})}function LM(){let[e]=(0,X.useState)(()=>Xr(Vu())),t=e.queryClient;return(0,X.useEffect)(()=>Zr(e),[e]),(0,Z.jsx)(vt,{client:t,children:(0,Z.jsx)(li,{children:(0,Z.jsxs)(Fi,{children:[(0,Z.jsx)(PM,{}),(0,Z.jsx)(jp,{children:(0,Z.jsx)(tT,{children:(0,Z.jsxs)(Pr,{children:[(0,Z.jsx)(DM,{}),(0,Z.jsx)(OM,{}),(0,Z.jsx)(kl,{}),(0,Z.jsx)(xa,{children:(0,Z.jsx)(EM,{children:(0,Z.jsx)(xM,{})})}),(0,Z.jsx)(_l,{})]})})})]})})})}function RM(){return(document.querySelector(`meta[name="cez-api-base"]`)?.getAttribute(`content`))?.trim()||``}wr(RM());var zM=document.getElementById(`root`);if(!zM)throw Error(`cezar: #root container is missing from index.html`);(0,Bu.createRoot)(zM).render((0,Z.jsx)(X.StrictMode,{children:(0,Z.jsx)(LM,{})}));export{Tg as $,Xy as A,By as B,vx as C,tb as D,Qy as E,Fy as F,m_ as G,sy as H,ky as I,h_ as J,v_ as K,Ry as L,Uy as M,Yy as N,eb as O,Iy as P,o_ as Q,zy as R,Fx as S,Zy as T,Qv as U,Ay as V,j_ as W,s_ as X,g_ as Y,p_ as Z,Hx as _,Uu as _t,FC as a,Bd as at,Px as b,WS as c,Pd as ct,nS as d,Ad as dt,_h as et,rS as f,kd as ft,Kx as g,Ju as gt,qx as h,ed as ht,wT as i,ff as it,Wy as j,$y as k,KS as l,Nd as lt,Jx as m,Dd as mt,mk as n,Mp as nt,MC as o,zd as ot,tS as p,Od as pt,__ as q,PO as r,Nf as rt,qS as s,Ld as st,AM as t,dh as tt,US as u,jd as ut,zx as v,_x as w,Rx as x,Lx as y,Ly as z};
32
+ `).toLowerCase()}function lj(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)||!oj(t.statuses,[e.run.status])||!oj(t.workflows,[e.run.workflow])||!sj(e,t.tags))return!1;if(r.length===0)return!0;let i=cj(e);return r.every(e=>i.includes(e))})}function uj(e,t,n,r){return lj(e,{...t,[r]:[]},n)}function dj(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(HA,`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 fj(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var pj={query:`q`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,sort:`sort`,archived:`archived`},mj=new Set(UA.map(e=>e.value));function hj(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set(pj.query,n);for(let n of e.filters.tags)n===` untagged`?t.set(pj.untagged,`1`):t.append(pj.tag,n);for(let n of e.filters.statuses)t.append(pj.status,n);for(let n of e.filters.workflows)t.append(pj.workflow,n);return e.groupBy!==`none`&&t.set(pj.groupBy,e.groupBy),e.sortBy!==`recent`&&t.set(pj.sort,e.sortBy),e.view===`archived`&&t.set(pj.archived,`1`),t}function gj(e){let t=e.getAll(pj.tag).filter(e=>e!==``);e.get(pj.untagged)===`1`&&t.push(HA);let n=e.get(pj.groupBy)??``;return{filters:{query:e.get(pj.query)??``,tags:t,statuses:e.getAll(pj.status).filter(e=>e!==``),workflows:e.getAll(pj.workflow).filter(e=>e!==``)},groupBy:mj.has(n)?n:`none`,sortBy:e.get(pj.sort)===`created`?`created`:`recent`,view:e.get(pj.archived)===`1`?`archived`:`active`}}var _j=15e3,vj=e=>e?.runs.some(e=>e.usage!==void 0)?_j:!1,yj=3e4,bj=250,xj=1,Sj=new Set([`done`,`failed`,`cancelled`]);function Cj(){return Tj({request:({task:e,archived:t})=>yt(e.run.projectId,e.run.id,t,`all_tasks`),patch:({archived:e})=>t=>({...t,archived:e})})}function wj(){return Tj({request:({task:e,read:t})=>fe(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 Tj({request:e,patch:t}){let n=V();return B({mutationFn:e,onMutate:async e=>{await n.cancelQueries({queryKey:R.runsIndex});let r=n.getQueryData(R.runsIndex),i=t(e),{task:a}=e;return n.setQueryData(R.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(R.runsIndex,r.previous),Y(e.message,{tone:`danger`})},onSettled:(e,t,{task:r})=>{n.invalidateQueries({queryKey:R.runsIndex}),n.invalidateQueries({queryKey:z.runs.all}),n.invalidateQueries({queryKey:[r.run.projectId,`runs`,`list`]})}})}function Ej(){let e=i(),t=Zl(E().data),n=Le(!0,vj),[r,a]=Or(),{filters:o,groupBy:s,sortBy:c,view:l}=X.useMemo(()=>gj(r),[r]),[u,d]=fg();X.useEffect(()=>{u!==l&&d(l)},[l,u,d]);let f=e=>a(t=>hj(e(gj(t))),{replace:!0}),p=e=>f(t=>({...t,filters:e(t.filters)})),m=e=>f(t=>({...t,groupBy:e})),h=e=>f(t=>({...t,sortBy:e})),g=e=>f(t=>({...t,view:e})),[_,v]=X.useState(o.query),[y,b]=X.useState(new Set),x=X.useCallback(e=>b(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),[]),S=o.query.trim()!==``,C=X.useCallback(e=>S||y.has(e),[S,y]),w=X.useRef(o.query);X.useEffect(()=>{o.query!==w.current&&v(o.query),w.current=o.query},[o.query]),X.useEffect(()=>{if(_===w.current)return;let e=setTimeout(()=>{w.current=_,p(e=>({...e,query:_}))},bj);return()=>clearTimeout(e)},[_]);let T=n.data?.referenceStatuses;X.useEffect(()=>{T&&Vt(T)},[T]);let D=X.useMemo(()=>e.data?.projects??[],[e.data]),O=X.useMemo(()=>QA(n.data?.runs??[],D),[n.data,D]),[k,A]=Xp(),j=X.useMemo(()=>ej(O),[O]),M=X.useMemo(()=>tj(O,k,j),[O,k,j]),N=X.useMemo(()=>{let e=e=>lj(tj(O,e,j),o,l).length;return{regular:e(`regular`),automation:e(`automation`),all:e(`all`)}},[O,j,o,l]),P=X.useMemo(()=>GA(lj(M,o,l),c),[M,o,l,c]),ee=X.useMemo(()=>dj(P,s),[P,s]),te=X.useMemo(()=>P.flatMap(e=>xe(e.run,e.project?.repoUrl).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[P]),ne=fj(n.data?.truncated??[],D),re=(e,t)=>p(n=>({...n,[e]:qA(n[e],t)})),ie=e=>p(t=>({...t,[e]:[]})),F=Cj(),ae=wj(),oe=F.mutate,se=X.useCallback((e,t)=>oe({task:e,archived:t}),[oe]),ce=ae.mutate,le=X.useCallback((e,t)=>ce({task:e,read:t}),[ce]);if(n.isError||e.isError)return(0,Z.jsx)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(eu,{icon:(0,Z.jsx)(ja,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:(n.error??e.error)?.message,actions:(0,Z.jsx)(q,{type:`button`,variant:`outline`,"data-action":`retry-global-tasks`,onClick:()=>{n.refetch(),e.refetch()},children:`Try again`})})});let I=(0,Z.jsxs)(`div`,{className:`relative w-full md:w-60`,children:[(0,Z.jsx)(is,{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,Z.jsx)(`input`,{type:`text`,value:_,onChange:e=>v(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-ui text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]});return(0,Z.jsxs)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:[(0,Z.jsxs)(`header`,{"data-slot":`global-tasks-header`,className:`sticky top-0 z-10 flex h-12 shrink-0 items-center gap-3 border-b border-border bg-background px-3 md:h-14 md:px-5`,children:[(0,Z.jsx)(`h1`,{className:`hidden text-base font-semibold md:block`,children:`All tasks`}),(0,Z.jsx)(_i,{slot:`overview-tabs`,label:`Which tasks`,value:l,options:[{value:`active`,label:`Active`},{value:`archived`,label:`Archived`}],onChange:g}),(0,Z.jsx)(`div`,{className:`flex-1`}),(0,Z.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`hidden text-label text-soft-foreground tabular-nums md:inline`,children:[P.length,` of `,O.length]}),(0,Z.jsx)(`div`,{className:`hidden md:block`,children:I})]}),(0,Z.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,Z.jsx)(`div`,{className:`md:hidden`,children:I}),(0,Z.jsx)(Dj,{filters:o,onToggle:re,onClearFacet:ie,onClearAll:()=>{v(``),f(e=>({...e,filters:KA,groupBy:`none`}))},groupBy:s,onGroupByChange:m,sortBy:c,onSortByChange:h,projects:D,tasks:M,view:l,origin:k,onOriginChange:A,originCounts:N}),ne.length>0?(0,Z.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-meta text-soft-foreground`,children:[`Showing the `,n.data?.perProjectLimit,` most recently active tasks per project — older ones in`,` `,ne.join(`, `),` are only in that project’s own Tasks page.`]}):null,n.data===void 0?null:P.length===0?(0,Z.jsx)(Hj,{view:l,filtered:YA(o),origin:k,hiddenByOrigin:k!==`all`&&N.all>0,onShowAll:()=>A(`all`)}):(0,Z.jsx)(jk,{intervalMs:yj,children:(0,Z.jsx)(Ca,{requests:te,children:ee.map(e=>(0,Z.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":e.key,children:[s===`none`?null:(0,Z.jsxs)(`h2`,{className:`mb-1.5 flex items-center gap-2 eyebrow text-soft-foreground`,children:[s===`project`?(0,Z.jsx)(U,{to:Br(e.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:e.label}):e.label,(0,Z.jsx)(`span`,{className:`font-mono text-meta font-medium tabular-nums`,children:e.tasks.length})]}),(0,Z.jsx)(kj,{tasks:e.tasks,sortBy:c,isSubtasksExpanded:C,onToggleSubtasks:x,showProject:s!==`project`,onArchive:se,onSetRead:le,busy:F.isPending||ae.isPending,showCost:t.cost})]},e.key))})})]})]})}function Dj({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,sortBy:o,onSortByChange:s,projects:c,tasks:l,view:u,origin:d,onOriginChange:f,originCounts:p}){let m=X.useMemo(()=>Lt(c),[c]),h=X.useMemo(()=>{let t=(t,n)=>ij(uj(l,e,u,t),n);return{tags:t(`tags`,aj),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[l,e,u]),g=e=>t=>({...t,count:e.get(t.value)??0});return(0,Z.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,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Z.jsx)(_i,{slot:`task-origin`,label:`Show tasks started by`,value:d,options:Ip.map(e=>({...e,count:p[e.value]})),onChange:f}),(0,Z.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Z.jsx)(fk,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:rj(l).map(e=>({value:e,label:e})).map(g(h.statuses)),emptyLabel:`No tasks to filter`}),(0,Z.jsx)(fk,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:nj(l).map(e=>({value:e,label:e})).map(g(h.workflows)),emptyLabel:`No tasks to filter`}),(0,Z.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`text-meta font-medium text-soft-foreground`,children:`Group by`}),(0,Z.jsx)(mk,{slot:`group-by`,label:`Group tasks by`,value:i,options:UA,onChange:e=>a(WA(i,e))}),(0,Z.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`text-meta font-medium text-soft-foreground`,children:`Sort by`}),(0,Z.jsx)(_i,{slot:`sort-by`,label:`Sort tasks by`,value:o,options:re,onChange:s}),ZA({filters:e,groupBy:i})?(0,Z.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-label font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,Z.jsx)(us,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${XA({filters:e,groupBy:i})})`]}):null]}),m.length>0?(0,Z.jsxs)(`div`,{"data-slot":`tag-filters`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-meta font-medium text-soft-foreground`,children:`Tags`}),m.map(n=>(0,Z.jsx)(pk,{slot:`tag-filter`,tone:`tag`,label:n,count:h.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,Z.jsx)(pk,{slot:`tag-filter`,label:`Untagged`,count:h.tags.get(` untagged`)??0,selected:e.tags.includes(HA),onToggle:()=>t(`tags`,HA)})]}):(0,Z.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-meta text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,Z.jsx)(U,{to:`/settings/global/projects`,className:`font-medium text-violet hover:underline`,children:`Settings → Projects`}),` `,`to group their tasks together here.`]})]})}var Oj=e=>e.dispatch;function kj({tasks:e,sortBy:t,isSubtasksExpanded:n,onToggleSubtasks:r,showProject:i,onArchive:a,onSetRead:o,busy:s,showCost:c}){let l=X.useMemo(()=>U_(e.map(e=>({id:e.run.id,dispatch:Oj(e.run),task:e})),n),[e,n]),u=Ik(l.length),d=[(0,Z.jsx)(Aj,{className:`w-[104px]`,children:`Status`},`status`),(0,Z.jsx)(Aj,{children:`Task`},`task`),i?(0,Z.jsx)(Aj,{className:`w-[124px]`,children:`Project`},`project`):null,(0,Z.jsx)(Aj,{className:`hidden w-[120px] xl:table-cell`,children:`Tags`},`tags`),(0,Z.jsx)(Aj,{className:`w-[84px]`,children:`Ref`},`ref`),(0,Z.jsx)(Aj,{className:`hidden w-[108px] xl:table-cell`,children:`Workflow`},`workflow`),c?(0,Z.jsx)(Aj,{className:`hidden w-[64px] text-right lg:table-cell`,children:`Cost`},`cost`):null,(0,Z.jsx)(Aj,{className:`hidden w-[56px] text-right xl:table-cell`,children:`CPU`},`cpu`),(0,Z.jsx)(Aj,{className:`hidden w-[84px] text-right xl:table-cell`,children:`Mem`},`mem`),(0,Z.jsx)(Aj,{className:`w-[72px] text-right`,children:ue(t)},`age`),(0,Z.jsx)(Aj,{className:`w-[64px] text-right`,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:`Actions`})},`actions`)].filter(e=>e!==null),f=d.length;return(0,Z.jsx)(`div`,{"data-slot":`global-tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card shadow-xs`,children:(0,Z.jsx)(Zc,{children:(0,Z.jsxs)(`table`,{className:`w-full border-collapse`,"aria-rowcount":u.ariaRowCount,children:[(0,Z.jsx)(`thead`,{children:(0,Z.jsx)(`tr`,{"aria-rowindex":u.windowed?1:void 0,children:d})}),(0,Z.jsxs)(`tbody`,{ref:u.anchorRef,className:`[&>tr:last-child>td]:border-b-0`,children:[(0,Z.jsx)(Fk,{height:u.padTop,colSpan:f}),l.slice(u.start,u.end).map((e,l)=>(0,Z.jsx)(Pj,{ariaRowIndex:u.ariaRowIndex(u.start+l),task:e.run.task,depth:e.depth,childCount:e.childCount,subtasksExpanded:n(e.run.id),onToggleSubtasks:r,sortBy:t,showProject:i,onArchive:a,onSetRead:o,busy:s,showCost:c},`${e.run.task.run.projectId}/${e.run.task.run.id}`)),(0,Z.jsx)(Fk,{height:u.padBottom,colSpan:f})]})]})})})}function Aj({children:e,className:t}){return(0,Z.jsx)(`th`,{scope:`col`,className:H(`h-[38px] border-b border-border px-2.5 text-left eyebrow whitespace-nowrap text-soft-foreground first:pl-4 last:pr-4`,t),children:e})}var jj=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function Mj(e){return e.archived||e.status===`done`||e.status===`cancelled`||jn(e)}function Nj({attention:e,archived:t}){return(0,Z.jsx)(`span`,{"data-slot":`status-quiet`,className:`inline-flex h-5 items-center px-2.5`,children:(0,Z.jsx)(vk,{attention:e,showLabel:t})})}var Pj=X.memo(function({ariaRowIndex:e,task:t,depth:n,childCount:r,subtasksExpanded:i,onToggleSubtasks:a,sortBy:o,showProject:c,onArchive:l,onSetRead:u,busy:d,showCost:f}){let{run:p}=t,m=s(p),h=Br(p.projectId,`/tasks/${p.id}`),g=ka(p),_=Na(p),v=xe(p,t.project?.repoUrl),y=W_(r),b=ke(p,p.usage),x=X.useId(),S=Mj(p);return(0,Z.jsxs)(`tr`,{"data-slot":`global-task-row`,"data-run-id":p.id,"aria-rowindex":e,"data-project":p.projectId,"data-depth":n,className:`group/row hover:bg-muted`,children:[(0,Z.jsx)(`td`,{className:jj,children:S?(0,Z.jsx)(Nj,{attention:m,archived:!!p.archived}):(0,Z.jsx)(Jl,{dot:m.tone,pulse:m.pulse,children:m.label})}),(0,Z.jsx)(`td`,{className:H(jj,`min-w-[320px] max-w-0`),children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,style:n>0?{paddingLeft:`${n*14}px`}:void 0,children:[n>0?(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`subtask-tick`,className:`shrink-0 font-mono text-meta leading-none text-soft-foreground`,children:`└`}):null,(0,Z.jsxs)(U,{to:h,title:Ge(p),"aria-describedby":S?x:void 0,className:H(`min-w-0 truncate text-ui`,g?`font-semibold text-foreground`:_?`font-medium text-muted-foreground`:`font-medium`),children:[Ge(p),S?(0,Z.jsx)(yk,{id:x,attention:m}):null,g?(0,Z.jsx)(D_,{}):null]}),G_(p)?(0,Z.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,children:G_(p)}):null,y?(0,Z.jsx)(bk,{label:y,expanded:i,onToggle:()=>a(p.id)}):null]})}),c?(0,Z.jsx)(`td`,{className:H(jj,`text-label text-muted-foreground`),children:(0,Z.jsx)(U,{to:Br(p.projectId,`/`),className:`truncate hover:text-foreground`,children:t.projectName})}):null,(0,Z.jsx)(`td`,{className:H(jj,`hidden xl:table-cell`),children:t.tags.length>0?(0,Z.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:t.tags.map(e=>(0,Z.jsx)(zj,{tag:e},e))}):(0,Z.jsx)(Vj,{})}),(0,Z.jsx)(`td`,{className:jj,children:v.length>0?(0,Z.jsx)(Rj,{references:v,run:p}):(0,Z.jsx)(Vj,{})}),(0,Z.jsx)(`td`,{className:H(jj,`hidden text-label text-muted-foreground xl:table-cell`),children:p.workflow}),f?(0,Z.jsx)(`td`,{className:H(jj,`hidden text-right font-mono text-xs text-muted-foreground tabular-nums lg:table-cell`),children:ze(p.costUsd)||(0,Z.jsx)(Vj,{})}):null,(0,Z.jsx)(Bj,{column:`cpu`,cell:b.cpu}),(0,Z.jsx)(Bj,{column:`memory`,cell:b.mem}),(0,Z.jsx)(`td`,{className:H(jj,`text-right text-label text-muted-foreground tabular-nums`),children:(0,Z.jsx)(Mk,{at:bn(p,o)})}),(0,Z.jsx)(`td`,{className:H(jj,`text-right`),children:(0,Z.jsxs)(`span`,{"data-slot":`row-controls`,className:`inline-flex items-center gap-0.5 opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 no-hover:opacity-100`,children:[(0,Z.jsx)(Ij,{task:t,busy:d,onSetRead:u}),(0,Z.jsx)(Lj,{task:t,busy:d,onArchive:l})]})})]})},Fj);function Fj(e,t){let{task:n,...r}=e,{task:i,...a}=t;return n.run!==i.run||n.project!==i.project||n.projectName!==i.projectName||n.tags!==i.tags?!1:Object.keys(r).every(e=>r[e]===a[e])}function Ij({task:e,busy:t,onSetRead:n}){if(!Fa(e.run))return null;let r=ka(e.run),i=Ge(e.run),a=r?`Mark ${i} read`:`Mark ${i} unread`,o=r?So:td;return(0,Z.jsxs)(Qc,{children:[(0,Z.jsx)(Xc,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,"data-action":r?`mark-read`:`mark-unread`,"aria-label":a,disabled:t,onClick:()=>n(e,r),className:H(`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,Z.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Z.jsx)($c,{side:`left`,children:r?`Mark read`:`Mark unread`})]})}function Lj({task:e,busy:t,onArchive:n}){let r=e.run.archived;if(!r&&!Sj.has(e.run.status))return null;let i=r?`Restore ${Ge(e.run)} to the active list`:`Archive ${Ge(e.run)}`;return(0,Z.jsxs)(Qc,{children:[(0,Z.jsx)(Xc,{asChild:!0,children:(0,Z.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,Z.jsx)(r?Hu:Zi,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Z.jsx)($c,{side:`left`,children:r?`Restore`:`Archive`})]})}function Rj({references:e,run:t}){let n=e.slice(0,xj),r=e.length-n.length,i=Ge(t);return(0,Z.jsxs)(`span`,{className:`flex flex-nowrap items-center gap-1`,children:[n.map(e=>(0,Z.jsx)(Ta,{reference:e,taskTitle:i,projectId:t.projectId,conflictAction:(0,Z.jsx)(Il,{projectId:t.projectId,runId:t.id,prNumber:e.number}),className:`shrink-0`},`${e.kind}#${e.number}`)),r>0?(0,Z.jsx)(Ll,{references:e,taskTitle:i,hidden:r,projectId:t.projectId}):null]})}function zj({tag:e,className:t}){return(0,Z.jsx)(`span`,{"data-slot":`project-tag`,className:H(`inline-flex max-w-full items-center truncate rounded-full bg-muted px-1.5 py-px text-micro font-medium text-muted-foreground`,t),children:e})}function Bj({column:e,cell:t}){return(0,Z.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-usage-kind":t.kind,title:t.title,className:H(jj,`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-meta text-soft-foreground`,t.kind===`none`&&`text-label text-soft-foreground`),children:t.text||`—`})}function Vj(){return(0,Z.jsx)(`span`,{className:`text-label text-soft-foreground`,children:`—`})}function Hj({view:e,filtered:t,origin:n=`all`,hiddenByOrigin:r=!1,onShowAll:i=()=>void 0}){return r?(0,Z.jsx)(`div`,{"data-slot":`global-tasks-empty`,"data-empty-kind":`origin-hidden`,children:(0,Z.jsx)(eu,{heading:`h2`,icon:(0,Z.jsx)(ja,{}),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,Z.jsx)(q,{type:`button`,variant:`outline`,onClick:i,children:`Show all tasks`})})}):t?(0,Z.jsx)(eu,{heading:`h2`,icon:(0,Z.jsx)(rs,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,Z.jsx)(eu,{heading:`h2`,icon:(0,Z.jsx)(Zi,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,Z.jsx)(eu,{heading:`h2`,icon:(0,Z.jsx)(gd,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}var Uj=Cl(`dashboard`,()=>Dr(()=>import(`./dashboard-Dh65_Yi7.js`).then(e=>({default:e.DashboardRoute})),__vite__mapDeps([47,1,2,3,4,5,48,44,49,50,6,51,14,7,30,8,9,10,11,12,13,15,52,17,16,18,53,54,55,56,57,58,59]))),Wj=Cl(`compare`,()=>Dr(()=>import(`./compare-variants-CYv97XSw.js`).then(e=>({default:e.CompareVariantsRoute})),__vite__mapDeps([60,1,2,3,4,5,48,44,14,7,61,62,28,56,32,15,63,58,64,65,66,67,68,69]))),Gj=Cl(`task-commits`,()=>Dr(()=>import(`./task-commits-Di0Mc8MX.js`).then(e=>e.n).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([70,1,2,3,4,5,48,44,41,71,50,7,72,8,9,10,11,12,13,14,15,73,74,36,17,21,75,26,53,76,77,78,79,80,81,23,56,57,69,82,61,83,24,27,84,55,42,85,32,62,28,29,30,86,87,63,34,45,64,88,89,90,91,92]))),Kj=(0,X.lazy)(()=>Dr(()=>import(`./task-notes-DCHLinAF.js`).then(e=>({default:e.TaskNotesRoute})),__vite__mapDeps([93,1,2,3,4,5,48,44,71,50,7,72,8,9,10,11,12,13,14,15,73,74,36,17,21,75,26,53,76,77,78,79,80,81,23,56,57,69,82,61,83,24,27,84,55,42,85,32,62,28,29,30,86,87,63,34,45,64,94,95,96,97,98,38,31,65,66,67,90,99,88,89,100]))),qj=Cl(`task-workspace`,()=>Dr(()=>import(`./task-workspace-DHl5akxu.js`).then(e=>({default:e.TaskWorkspaceRoute})),__vite__mapDeps([101,1,2,3,4,5,44,48,51,14,7,30,41,71,50,72,8,9,10,11,12,13,15,73,74,36,17,21,75,26,53,76,77,78,79,80,81,23,56,57,69,82,61,83,24,27,84,55,42,85,32,62,28,29,86,87,63,34,45,64,102,103,104,94,95,96,97,98,38,31,65,66,67,90,99,88,89,100,105,106,107,108,109,110,16,22,111,37,59,33,112,113,39,40,114,115,92,116,117,118,58,68,119,120,70,91]))),Jj=Cl(`repo-git`,()=>Dr(()=>import(`./repo-git-ikURCYEK.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([121,1,2,3,4,5,48,44,41,7,102,72,110,14,16,17,78,36,79,80,10,11,81,23,56,57,69,105,12,64,65,28,66,67,96,106,75,107,108,22,61,31,32,88,89,90,122,15,91,92]))),Yj=Cl(`github`,()=>Dr(()=>import(`./github-CWRtsamJ.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([123,1,2,3,4,5,48,44,49,50,6,51,14,7,30,72,8,9,10,11,12,13,15,73,74,36,17,21,75,26,124,16,77,78,79,80,81,23,56,57,69,108,109,110,97,22,111,84,55,42,85,32,87,37,38,29,34,59,33,112,125,24,25,104,64,115,92,65,28,66,67,126,114,39,40,41,88,89,90,122]))),Xj=Cl(`tracker`,()=>Dr(()=>import(`./tracker-bQUG9SkJ.js`).then(e=>({default:e.TrackerRoute})),__vite__mapDeps([127,1,2,3,4,5,48,44,41,72,7,8,9,10,11,12,13,14,15,16,17,19,20,21,81,112,23,61,38,125,24,30,26,56,32,85,57,37,29,34,64,115,65,28,66,67,126,73,74,36,75,77,78,79,80,69,109,110,97,22,111,84,55,42,87,59,33,114,39,40,92]))),Zj=Cl(`workflow-graph`,()=>Dr(()=>import(`./workflow-graph-CGMeFErv.js`).then(e=>({default:e.WorkflowGraphRoute})),__vite__mapDeps([128,1,2,3,4,5,48,44,7,74,14,16,17,9,36,54,77,21,80,129,10,82,130,108,112,22,98,111,125,83,24,12,30,13,28,56,31,32,15,45,64,131]))),Qj=Cl(`terminal`,()=>Dr(()=>import(`./project-terminal-DbIohh5G.js`).then(e=>({default:e.ProjectTerminalRoute})),__vite__mapDeps([132,1,2,3,4,5,44,48,83,7,104,87,81,64,120]))),$j=Cl(`skills`,()=>Dr(()=>import(`./skills-BNiKFlUw.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([133,1,2,3,4,5,48,44,7,72,73,74,14,36,17,21,75,26,16,9,19,20,109,110,97,22,111,30,13,84,55,42,85,32,56,87,81,37,38,29,34,59,33,23,12,104,31,64,39,40,41])));function eM(e,t){let n,r=()=>t().then(e=>n=e),i=Cl(e,()=>r().then(e=>({default:e})));function a(){let[e]=(0,X.useState)(()=>n??i);return(0,Z.jsx)(e,{})}return{Route:a,preload:r}}var tM=eM(`manager`,()=>Dr(()=>import(`./manager-index-D0TOmxr6.js`).then(e=>e.ManagerIndexRoute),__vite__mapDeps([134,1,2,3,4,5,48,44,6,74,7,14,22,84,55,42,85,32,59,64,135,33,34,136,109,110,17,16,97,111,30,13,56,87,81,37,38,29,35,36,27,20,39,40,41]))),nM=eM(`manager`,()=>Dr(()=>import(`./manager-new-CCet_7u8.js`).then(e=>e.ManagerNewRoute),__vite__mapDeps([136,1,2,3,4,5,48,44,6,109,7,110,14,17,16,97,22,111,30,13,84,55,42,85,32,56,87,81,37,38,29,34,59,33,135,35,36,27,20,39,40,41]))),rM=eM(`manager`,()=>Dr(()=>import(`./manager-chat-BdigDKYZ.js`).then(e=>e.ManagerChatRoute),__vite__mapDeps([137,1,2,3,4,5,48,44,6,7,102,72,8,9,10,11,12,13,14,15,74,18,19,16,17,20,81,130,109,110,97,22,111,30,84,55,42,85,32,56,87,37,38,29,34,59,33,138,23,27,62,104,57,69,64,115,114,36,39,40,41,92,65,28,66,67,90,100,135,119,24,86,73,21,75,26,35,0,25,31]))),iM=tM.Route,aM=nM.Route,oM=rM.Route;function sM(){for(let e of[tM,nM,rM])e.preload().catch(()=>{})}var cM=Cl(`automations`,()=>Dr(()=>import(`./automations-route-Dd7F6b4F.js`).then(e=>({default:e.AutomationsRoute})),__vite__mapDeps([139,1,2,3,4,5,48,44,6,49,50,51,14,7,30,102,72,103,28,104,87,81,8,9,10,11,12,13,15,110,52,124,17,16,53,36,19,20,76,54,77,78,79,80,23,56,57,69,95,129,109,97,22,111,84,55,42,85,32,37,38,29,34,59,33,112,83,24,26,62,31,63,64,115,39,40,41,114,92])));function lM(){let e=Kr();return new URLSearchParams(e.search).get(`skill`)===`__bm`?(0,Z.jsx)(Ir,{to:{pathname:`/settings/bookmarklets`,hash:e.hash},replace:!0}):(0,Z.jsx)(Ir,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function uM({sectionId:e}){let t=Kr();return(0,Z.jsx)(Rr,{to:{pathname:PO(`global`,e),search:t.search,hash:t.hash},replace:!0})}function dM(){return(0,Z.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(dl,{label:`Opening project…`})})}function fM(){let{projectId:e=``}=kr(),t=Kr(),n=i(),r=E();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,Z.jsx)(Rr,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,Z.jsx)(dM,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,Z.jsx)(PC,{projectId:e,registry:n.data})}else if(!n.isError)return(0,Z.jsx)(dM,{});return(0,Z.jsxs)(Bt,{projectId:n.data?.bootProject===e?null:e,children:[(0,Z.jsx)(mx,{projectId:e},`webhooks:${e}`),(0,Z.jsx)(Fr,{},e)]})}function pM(){let{projectId:e=``}=kr();return(0,Z.jsx)(SC,{},e)}function mM(){let e=Kr(),t=E(),n=i(),r=t.data?.bootProject??n.data?.bootProject,a=(t.data!==void 0||t.isError)&&(n.data!==void 0||n.isError);if(r===void 0&&!a)return(0,Z.jsx)(dM,{});let o=r??`default`;if(e.pathname===`/`&&e.search===``&&e.hash===``){if(n.data===void 0&&!n.isError)return(0,Z.jsx)(dM,{});let e=sc(pc(),n.data,r);if(e!==null)return(0,Z.jsx)(Rr,{to:e,replace:!0});let t=ac(n.data,o);if(t!==o)return(0,Z.jsx)(Rr,{to:`/p/${encodeURIComponent(t)}/`,replace:!0})}let s=e.pathname===`/p`||e.pathname===`/p/`?`/`:e.pathname;return(0,Z.jsx)(Rr,{to:`/p/${encodeURIComponent(o)}${s}${e.search}${e.hash}`,replace:!0})}function hM(){let e=E(),t=i(),n=Mt(),r=Et(),a=Mc({health:e.data,healthFailed:e.isError,registry:t.data,registryFailed:t.isError,providers:n.data,providersFailed:n.isError,agentCheckSkipped:r.data&&r.data.onboarding?.agentCheckSkipped===!0,uiStateFailed:r.isError});return a===`wait`?(0,Z.jsx)(dM,{}):(a===`manager`&&Oc(`phone_default`),a===`manager`?(0,Z.jsx)(Rr,{to:`/manager`,replace:!0}):(0,Z.jsx)(mM,{}))}function gM(){let e=Kr();return e.pathname===`/`&&e.search===``&&e.hash===``&&Cc(e.key)&&yc()?(0,Z.jsx)(hM,{}):(0,Z.jsx)(mM,{})}function _M(){return bc(Kr().key),null}var vM=[{pattern:`/`,pageLabel:`Now`},{pattern:`/tasks`,pageLabel:`Tasks`},{pattern:`/dashboard`,pageLabel:`Dashboard`},{pattern:`/manager/new`,pageLabel:`New manager`},{pattern:`/manager/*`,pageLabel:`Manager`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/compare/:groupId`,pageLabel:`Compare`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/tracker/*`,pageLabel:`Tracker`},{pattern:`/assets`,pageLabel:`Assets`},{pattern:`/terminal`,pageLabel:`Terminal`},{pattern:`/automations/*`,pageLabel:`Automations`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/inbox`,pageLabel:`Inbox`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function yM(e){let t=Ur(e),n=Gr({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:t===`/tasks`&&jr(e)===null?{pageLabel:`All tasks`,taskId:null}:{pageLabel:vM.find(({pattern:e})=>Gr({path:e,end:!0},t))?.pageLabel??null,taskId:null}}function bM({children:e,fallback:t}){let n=E();return n.data&&n.data.capabilities.managers!==!0?(0,Z.jsx)(Rr,{to:`/`,replace:!0}):(0,Z.jsx)(X.Suspense,{fallback:t,children:e})}var xM=(0,X.memo)(function(){let e=E().data?.capabilities;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_M,{}),(0,Z.jsxs)(Ar,{children:[(0,Z.jsxs)(W,{path:`/p/:projectId`,element:(0,Z.jsx)(fM,{}),children:[(0,Z.jsx)(W,{index:!0,element:(0,Z.jsx)(BA,{})}),(0,Z.jsx)(W,{path:`tasks`,element:(0,Z.jsx)(hA,{})}),(0,Z.jsx)(W,{path:`new`,element:(0,Z.jsx)(pM,{})}),(0,Z.jsx)(W,{path:`tasks/:id`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(da,{}),children:(0,Z.jsx)(qj,{})})}),(0,Z.jsx)(W,{path:`tasks/:id/chat`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(da,{}),children:(0,Z.jsx)(qj,{view:`session`})})}),(0,Z.jsx)(W,{path:`tasks/:id/changes`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`changes`}),children:(0,Z.jsx)(qj,{view:`changes`})})}),(0,Z.jsx)(W,{path:`tasks/:id/files`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`files`}),children:(0,Z.jsx)(qj,{view:`files`})})}),(0,Z.jsx)(W,{path:`tasks/:id/graph`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`changes`}),children:(0,Z.jsx)(qj,{view:`graph`})})}),(0,Z.jsx)(W,{path:`tasks/:id/commits`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`changes`}),children:(0,Z.jsx)(qj,{view:`commits`})})}),(0,Z.jsx)(W,{path:`tasks/:id/notes`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`notes`}),children:(0,Z.jsx)(Kj,{})})}),(0,Z.jsx)(W,{path:`tasks/:id/preview`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`preview`}),children:(0,Z.jsx)(qj,{view:`browser`})})}),(0,Z.jsx)(W,{path:`tasks/:id/assets`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`preview`}),children:(0,Z.jsx)(qj,{view:`assets`})})}),(0,Z.jsx)(W,{path:`tasks/:id/assets/:name`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`preview`}),children:(0,Z.jsx)(qj,{view:`assets`})})}),(0,Z.jsx)(W,{path:`tasks/:id/terminal`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`terminal`}),children:(0,Z.jsx)(qj,{view:`terminal`})})}),(0,Z.jsx)(W,{path:`tasks/:id/commits/:sha`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(ta,{tab:`changes`}),children:(0,Z.jsx)(Gj,{})})}),(0,Z.jsx)(W,{path:`compare/:groupId`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(_x,{}),children:(0,Z.jsx)(Wj,{})})}),(0,Z.jsx)(W,{path:`git`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(MC,{}),children:(0,Z.jsx)(Jj,{tab:`changes`})})}),(0,Z.jsx)(W,{path:`git/commits`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(MC,{}),children:(0,Z.jsx)(Jj,{tab:`commits`})})}),(0,Z.jsx)(W,{path:`git/commits/:sha`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(MC,{}),children:(0,Z.jsx)(Jj,{tab:`commits`})})}),(0,Z.jsx)(W,{path:`git/branches`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(MC,{}),children:(0,Z.jsx)(Jj,{tab:`branches`})})}),(0,Z.jsx)(W,{path:`git/files`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(MC,{}),children:(0,Z.jsx)(Jj,{tab:`files`})})}),(0,Z.jsx)(W,{path:`git/files/*`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(MC,{}),children:(0,Z.jsx)(Jj,{tab:`files`})})}),(0,Z.jsx)(W,{path:`github`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(vx,{}),children:(0,Z.jsx)(Yj,{view:`issues`,index:!0})})}),(0,Z.jsx)(W,{path:`tracker`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(dM,{}),children:(0,Z.jsx)(Xj,{})})}),(0,Z.jsx)(W,{path:`tracker/:id`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(dM,{}),children:(0,Z.jsx)(Xj,{})})}),(0,Z.jsx)(W,{path:`github/prs`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(vx,{}),children:(0,Z.jsx)(Yj,{view:`prs`})})}),(0,Z.jsx)(W,{path:`github/issues/:n`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(vx,{}),children:(0,Z.jsx)(Yj,{view:`issues`})})}),(0,Z.jsx)(W,{path:`github/prs/:n`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(vx,{}),children:(0,Z.jsx)(Yj,{view:`prs`})})}),(0,Z.jsx)(W,{path:`github/prs/:n/changes`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(vx,{}),children:(0,Z.jsx)(Yj,{view:`prs`,changes:!0})})}),(0,Z.jsx)(W,{path:`automations`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(gx,{}),children:(0,Z.jsx)(cM,{})})}),(0,Z.jsx)(W,{path:`automations/new`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(gx,{}),children:(0,Z.jsx)(cM,{mode:`new`})})}),(0,Z.jsx)(W,{path:`automations/:automationId`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(gx,{}),children:(0,Z.jsx)(cM,{mode:`edit`})})}),(0,Z.jsx)(W,{path:`automations/:automationId/log`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(gx,{}),children:(0,Z.jsx)(cM,{mode:`log`})})}),(0,Z.jsx)(W,{path:`skills`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(NC,{}),children:(0,Z.jsx)($j,{})})}),(0,Z.jsx)(W,{path:`inbox`,element:(0,Z.jsx)(Qx,{})}),(0,Z.jsx)(W,{path:`assets`,element:(0,Z.jsx)(wx,{})}),(0,Z.jsx)(W,{path:`terminal`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(dM,{}),children:(0,Z.jsx)(Qj,{})})}),(0,Z.jsx)(W,{path:`workflows`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(FC,{}),children:(0,Z.jsx)(Zj,{})})}),(0,Z.jsx)(W,{path:`workflows/:name`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(FC,{}),children:(0,Z.jsx)(Zj,{})})}),(0,Z.jsx)(W,{path:`workflows-new/*`,element:(0,Z.jsx)(Ir,{to:`/workflows`,replace:!0})}),(0,Z.jsx)(W,{path:`settings`,element:(0,Z.jsx)(ak,{scope:`project`,capabilities:e})}),(0,Z.jsx)(W,{path:`settings/skills`,element:(0,Z.jsx)(lM,{})}),(0,Z.jsx)(W,{path:`settings/prompt-templates`,element:(0,Z.jsx)(Ir,{to:{pathname:`/settings/instructions`,hash:`#prompt-templates`},replace:!0})}),_O(`project`,e).map(t=>(0,Z.jsx)(W,{path:`settings/${t.id}`,element:(0,Z.jsx)(nk,{section:t,scope:`project`,capabilities:e})},t.id)),_O(`global`,e).map(e=>(0,Z.jsx)(W,{path:`settings/${e.id}`,element:(0,Z.jsx)(uM,{sectionId:e.id})},e.id)),(0,Z.jsx)(W,{path:`*`,element:(0,Z.jsx)(jC,{})})]}),(0,Z.jsx)(W,{path:`/tasks`,element:(0,Z.jsx)(Ej,{})}),(0,Z.jsx)(W,{path:`/dashboard`,element:(0,Z.jsx)(X.Suspense,{fallback:(0,Z.jsx)(dl,{label:`Loading dashboard…`}),children:(0,Z.jsx)(Uj,{})})}),(0,Z.jsx)(W,{path:`/manager`,element:(0,Z.jsx)(bM,{fallback:(0,Z.jsx)(rS,{}),children:(0,Z.jsx)(iM,{})})}),(0,Z.jsx)(W,{path:`/manager/new`,element:(0,Z.jsx)(bM,{fallback:(0,Z.jsx)(dl,{label:`Loading setup…`}),children:(0,Z.jsx)(aM,{})})}),(0,Z.jsx)(W,{path:`/manager/:id`,element:(0,Z.jsx)(bM,{fallback:(0,Z.jsx)(nS,{}),children:(0,Z.jsx)(oM,{})})}),(0,Z.jsx)(W,{path:`/settings/global`,element:(0,Z.jsx)(ak,{scope:`global`,capabilities:e})}),_O(`global`,e).map(t=>(0,Z.jsx)(W,{path:PO(`global`,t.id),element:(0,Z.jsx)(nk,{section:t,scope:`global`,capabilities:e})},t.id)),e!==void 0&&e.managers!==!0?(0,Z.jsx)(W,{path:PO(`global`,`manager`),element:(0,Z.jsx)(Rr,{to:`/settings/global`,replace:!0})}):null,(0,Z.jsx)(W,{path:`*`,element:(0,Z.jsx)(gM,{})})]})]})});function SM(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 CM(e){return e?.available===!0&&(e.status===`available`||e.status===`error`)}function wM(e,t,n,r){return e===null?t!==null&&n?.projects.some(e=>e.id===t&&e.status!==`missing`)?t:r:e}function TM(e){let t=0;for(let n of e)!n.archived&&n.status===`running`&&(t+=1);return{unread:za(e),needsYou:m(e).waiting,running:t}}var EM=(0,X.memo)(function({children:e}){let{pathname:t,search:n}=Kr(),r=Nr(),a=E(),o=tn(),s=o.data?.branding,c=s!==void 0&&(s.name!==`cezar`||s.logoUrl!==null),l=le(!c&&o.data!==void 0),u=a.data?.capabilities.followups===!0,d=a.data?.capabilities.automations===!0,f=a.data?.capabilities.terminal===!0,p=Fe(u),m=a.data?.capabilities.managers===!0,h=ii(m),g=m&&Ps(t);wc(g),(0,X.useEffect)(()=>{g&&Ud(`${t}${n}`)},[g,t,n]),(0,X.useEffect)(()=>{if(!m)return;let e=window.requestIdleCallback??(e=>window.setTimeout(e,1)),t=window.cancelIdleCallback??window.clearTimeout,n=e(()=>sM());return()=>t(n)},[m]);let _=(0,X.useMemo)(()=>h.data?.managers.map(e=>e.id),[h.data]),v=g?`/manager`:Wd(_),y=g?Gr(`/manager/:id`,t)?.params.id:void 0,b=y===void 0?void 0:h.data?.managers.find(e=>e.id===y)?.name,x=CM(xn(r??``,r!==null).data),S=Jb(Ur(t)),C=i(),w=C.data,T=jr(t);(0,X.useEffect)(()=>{T!==null&&Yd(T)},[T]);let D=w?.bootProject??a.data?.bootProject??null,O=wM(r,r===null?Xd():null,w,D),k=(0,X.useMemo)(()=>dy(w,O,a.data),[w,O,a.data]),A=yM(t),j=ge(O,D,(0,X.useMemo)(()=>TM,[])),M=r!==null&&r===D,N=k?.projects.find(e=>e.id===r),P=k?.projects.find(e=>e.id===O),ee=P?.tracker,te=A.taskId,ne=ot(r??``,N!==void 0&&te!==null,k?.bootProject===r,(0,X.useMemo)(()=>e=>{let t=te?e.find(e=>e.id===te):void 0;return t?Ge(t):void 0},[te])).data,re=t===`/settings/global`||t.startsWith(`/settings/global/`),ie=re?null:b??N?.name??(M?SM(a.data)?.name??null:null);uy({projectName:ie,pageLabel:ne??A.pageLabel,brandName:o.data?.branding.name,brandLogoUrl:o.data?.branding.logoUrl});let F=(0,X.useMemo)(()=>SM(a.data),[a.data?.repo?.root,a.data?.repo?.branch]),ae=(0,X.useMemo)(()=>re?null:{activeId:O,activeName:r===null?P?.name??ie:ie,projects:(k?.projects??[]).map(({id:e,name:t})=>({id:e,name:t}))},[re,O,r,P?.name,ie,k?.projects]),oe=(0,X.useMemo)(()=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(kg,{}),(0,Z.jsx)(xg,{})]}),[]),se=(0,X.useMemo)(()=>(0,Z.jsx)(Lg,{}),[]),ce=(0,X.useMemo)(()=>(0,Z.jsx)(nv,{}),[]),I=(0,X.useMemo)(()=>(0,Z.jsx)(gg,{}),[]),ue=(0,X.useMemo)(()=>(0,Z.jsx)(Xb,{menuItem:!0}),[]),L=a.data?.capabilities.singleProject===!0,de=(0,X.useMemo)(()=>k&&!re?(0,Z.jsx)(t_,{projects:k.projects,activeId:O,singleProject:L}):void 0,[k,re,O,L]),fe=ko(),pe=(0,X.useMemo)(()=>a.data?(0,Z.jsx)(dv,{health:a.data,forge:fe}):void 0,[a.data,fe]),me=a.data?uv(a.data)===`success`?`healthy`:`attention`:null,he=a.data&&me===`attention`?cv(a.data):null,_e=Et(),[ve]=(0,X.useState)(()=>Date.now()),ye=fc(_e.data?.onboarding,{designMode:a.data?.capabilities.designMode,automations:a.data?.capabilities.automations},ve),be=(0,X.useMemo)(()=>(0,Z.jsx)(oy,{}),[]),xe=(0,X.useMemo)(()=>(0,Z.jsx)(ty,{}),[]),Se=(0,X.useMemo)(()=>(0,Z.jsx)(Kv,{}),[]);return(0,Z.jsxs)(dg,{children:[(0,Z.jsx)(Sh,{repo:F,brandName:o.data?.branding.name??`cezar`,brandLogoUrl:o.data?.branding.logoUrl??null,version:a.data?.version??null,latestVersion:a.data?.latestVersion??null,starCount:!c&&l.data?.available?l.data.count??null:null,inboxCount:p.data?.length??null,unreadCount:j.data?.unread??null,nowCount:j.data?.needsYou??null,runningCount:j.data?.running??null,healthStatus:me,skillsUpdateAvailable:x,newNavItems:S,forgeAvailable:fe!=null,inboxAvailable:u,automationsAvailable:d,terminalAvailable:f,tracker:ee,banner:oe,whatsNew:ue,whatsNewUnseen:ye,healthReason:he,linkProjectId:re?null:O,offerAddProject:k===void 0&&C.isError,footerBanner:se,singleProject:L,currentTasks:ce,switcher:de,hostWidget:I,toolsMenu:pe,managersAvailable:m,managerAttention:As(h.data?.managers),managerTo:v,managerSidebar:be,managerRail:xe,managerHeads:Se,projectSwitcher:ae,children:e}),(0,Z.jsx)(Dm,{}),(0,Z.jsx)(Kh,{}),(0,Z.jsx)(ux,{})]})});function DM(){let e=Kr(),t=i();return(0,X.useEffect)(()=>{SO(e)},[e]),(0,X.useEffect)(()=>{let n=cc(e,t.data);n!==null&&(Nc(pc(),n)||tc(n))},[e.hash,e.pathname,e.search,t.data]),null}function OM(){let e=V(),t=Mr(),n=(0,X.useRef)(t);n.current=t;let r=si(Et().data?.notifications).enabled,i=(0,X.useRef)(r);i.current=r;let a=(0,X.useRef)(new Map),o=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let t=Cr(),r=b(z.runs.list()),s=b(ni.list),c=t=>{if(!t)return;let{entering:r,counts:i}=ui(o.current,t.managers);o.current=i;let a=e.getQueryData(z.health)?.capabilities.managerSystemNotifications===!0;if(!(r.length===0||a||!l()))for(let e of r){let t=xc(e);kM(gi(e),n.current,()=>Sc(t))}},l=()=>mi({enabled:i.current,hidden:document.visibilityState===`hidden`,permission:ci()}),u=e=>{let{entering:r,statuses:i}=vi(a.current,e);if(a.current=i,!(r.length===0||!l()))for(let e of r)kM({...oi(e),path:Br(t,`/tasks/${encodeURIComponent(e.id)}`)},n.current)};return u(e.getQueryData(z.runs.list())),c(e.getQueryData(ni.list)),e.getQueryCache().subscribe(e=>{e.type===`updated`&&(e.query.queryHash===r?u(e.query.state.data):e.query.queryHash===s&&c(e.query.state.data))})},[e]),null}function kM(e,t,n){let r=globalThis.Notification;if(typeof r==`function`)try{let i=new r(e.title,{body:e.body,tag:e.tag});i.onclick=()=>{n?.(),window.focus(),t(e.path),i.close()}}catch{}}function AM(e,t=!0){return Xn({queryKey:[...R.dashboard,`insights`,e],enabled:t,staleTime:5e3,refetchInterval:t?15e3:!1,refetchIntervalInBackground:!1,retry:!1,queryFn:async({signal:t})=>ar.parse(await yn(await T.api.v1.workspace.dashboard.insights.$get({query:{period:e,tzOffsetMinutes:String(new Date().getTimezoneOffset())}},{init:{signal:t}}),`/workspace/dashboard/insights`))})}var jM=[`pointerdown`,`pointermove`,`keydown`,`wheel`,`touchstart`];function MM(){let e=document.activeElement;return e?e.isContentEditable||e.tagName===`TEXTAREA`||e.tagName===`INPUT`&&e.type!==`checkbox`:!1}var NM=()=>document.querySelector(`[role="dialog"],[role="alertdialog"]`)!==null;function PM(){let e=V(),t=tn(),n=t.data?.branding,r=n!==void 0&&(n.name!==`cezar`||n.logoUrl!==null),i=le(t.data!==void 0&&!r),a=!r&&i.data?.available===!0,o=!r&&i.data?.available?i.data.count??null:null,[s,c]=(0,X.useState)(!1),l=(0,X.useRef)(a);l.current=a;let u=(0,X.useRef)(new Map),d=(0,X.useRef)(null),f=(0,X.useRef)(0);return(0,X.useEffect)(()=>{let t=b(z.runs.list()),n,r=()=>sf({now:Date.now(),visible:document.visibilityState===`visible`,focused:document.hasFocus(),lastInteractionAt:f.current,typing:MM(),dialogOpen:NM()}),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=nf();if(!(d.current===null||!r()||!l.current)){if(!af(e,Date.now())){d.current=null;return}d.current=null,rf({...e,asks:e.asks+1,lastAskedAt:new Date().toISOString()}),c(!0)}},tf))}},a=e=>{let{succeeded:t,statuses:n}=uf(u.current,e);u.current=n,!(!t||!l.current)&&(of(e)<3||af(nf(),Date.now())&&(d.current=Date.now(),i()))},o=()=>{f.current=Date.now(),i()};for(let e of jM)window.addEventListener(e,o,{passive:!0});document.addEventListener(`visibilitychange`,i),window.addEventListener(`focus`,i),a(e.getQueryData(z.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 jM)window.removeEventListener(e,o);document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`focus`,i)}},[e]),r?null:(0,Z.jsx)(IM,{open:s,onOpenChange:c,count:o})}function FM(e){let t=nf();t&&rf({...t,outcome:e})}function IM({open:e,onOpenChange:t,count:n}){let r=AM(`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,Z.jsx)(ol,{open:e,onOpenChange:t,children:(0,Z.jsxs)(rl,{"data-slot":`star-ask`,className:`gap-0 overflow-hidden p-0 sm:max-w-[440px]`,children:[(0,Z.jsxs)(`div`,{className:`relative flex h-36 items-center justify-center overflow-hidden border-b bg-card-2`,children:[(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`absolute inset-0 bg-[radial-gradient(circle_at_22%_35%,color-mix(in_oklab,var(--primary)_32%,transparent),transparent_55%),radial-gradient(circle_at_80%_70%,color-mix(in_oklab,var(--violet)_38%,transparent),transparent_55%)]`}),(0,Z.jsxs)(`div`,{"aria-hidden":`true`,className:`relative flex items-center gap-4`,children:[(0,Z.jsx)(Rf,{height:52,className:`text-foreground`}),(0,Z.jsx)(`span`,{className:`flex size-12 items-center justify-center rounded-full border bg-card shadow-md`,children:(0,Z.jsx)(Fd,{className:`size-6 fill-current text-pending-strong`})})]}),n!==null&&(0,Z.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-meta text-muted-foreground backdrop-blur`,children:[`⭐ `,$d(n),` stars on GitHub`]})]}),(0,Z.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`span`,{className:`section-mark block eyebrow text-muted-foreground`,children:`Open source · MIT`}),(0,Z.jsx)(il,{className:`text-xl font-semibold tracking-tight`,children:`Is cezar pulling its weight?`}),(0,Z.jsx)(al,{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,Z.jsxs)(`div`,{className:`rounded-lg border bg-card-2 p-3`,children:[(0,Z.jsx)(`span`,{className:`block eyebrow text-soft-foreground`,children:`Your last 30 days with cezar`}),(0,Z.jsx)(`dl`,{className:`mt-2 grid gap-2`,style:{gridTemplateColumns:`repeat(${i.length}, minmax(0, 1fr))`},children:i.map(e=>(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse`,children:[(0,Z.jsx)(`dt`,{className:`text-label text-muted-foreground`,children:e.label}),(0,Z.jsx)(`dd`,{className:`truncate text-lg font-semibold tabular-nums`,children:e.value})]},e.label))})]}),(0,Z.jsx)(q,{asChild:!0,className:`h-11 w-full text-sm font-semibold`,children:(0,Z.jsxs)(`a`,{href:Zd,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{FM(`starred`),t(!1)},children:[(0,Z.jsx)(Fd,{className:`size-4 fill-current`,"aria-hidden":`true`}),`Star cezar on GitHub`,(0,Z.jsx)(Ea,{className:`size-4`,"aria-hidden":`true`})]})}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(q,{variant:`ghost`,className:`min-h-11`,onClick:()=>t(!1),children:`Maybe later`}),(0,Z.jsx)(q,{variant:`ghost`,className:`min-h-11 text-soft-foreground`,onClick:()=>{FM(`never`),t(!1)},children:`Don’t ask again`})]})]})]})})}function LM(){let[e]=(0,X.useState)(()=>Xr(Vu())),t=e.queryClient;return(0,X.useEffect)(()=>Zr(e),[e]),(0,Z.jsx)(vt,{client:t,children:(0,Z.jsx)(li,{children:(0,Z.jsxs)(Fi,{children:[(0,Z.jsx)(PM,{}),(0,Z.jsx)(jp,{children:(0,Z.jsx)(tT,{children:(0,Z.jsxs)(Pr,{children:[(0,Z.jsx)(DM,{}),(0,Z.jsx)(OM,{}),(0,Z.jsx)(kl,{}),(0,Z.jsx)(xa,{children:(0,Z.jsx)(EM,{children:(0,Z.jsx)(xM,{})})}),(0,Z.jsx)(_l,{})]})})})]})})})}function RM(){return(document.querySelector(`meta[name="cez-api-base"]`)?.getAttribute(`content`))?.trim()||``}wr(RM());var zM=document.getElementById(`root`);if(!zM)throw Error(`cezar: #root container is missing from index.html`);(0,Bu.createRoot)(zM).render((0,Z.jsx)(X.StrictMode,{children:(0,Z.jsx)(LM,{})}));export{Tg as $,Xy as A,By as B,vx as C,tb as D,Qy as E,Fy as F,m_ as G,sy as H,ky as I,h_ as J,v_ as K,Ry as L,Uy as M,Yy as N,eb as O,Iy as P,o_ as Q,zy as R,Fx as S,Zy as T,Qv as U,Ay as V,j_ as W,s_ as X,g_ as Y,p_ as Z,Hx as _,Uu as _t,FC as a,Bd as at,Px as b,WS as c,Pd as ct,nS as d,Ad as dt,_h as et,rS as f,kd as ft,Kx as g,Ju as gt,qx as h,ed as ht,wT as i,ff as it,Wy as j,$y as k,KS as l,Nd as lt,Jx as m,Dd as mt,mk as n,Mp as nt,MC as o,zd as ot,tS as p,Od as pt,__ as q,PO as r,Nf as rt,qS as s,Ld as st,AM as t,dh as tt,US as u,jd as ut,zx as v,_x as w,Rx as x,Lx as y,Ly as z};