@wjarka/cezarion 0.18.0-dev.8156 → 0.18.0-dev.8161

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 (64) hide show
  1. package/package.json +2 -2
  2. package/web/dist/assets/{accounts-section-CZzEOP8R.js → accounts-section-xFYT_zfY.js} +1 -1
  3. package/web/dist/assets/{activity-motion-Jmq2_2yL.js → activity-motion-OAYNqxZ2.js} +1 -1
  4. package/web/dist/assets/{activity-route-SFwjSBCp.js → activity-route-cdDIR26F.js} +1 -1
  5. package/web/dist/assets/{agent-config-section-BumcXk5K.js → agent-config-section-B8yx4Ftt.js} +1 -1
  6. package/web/dist/assets/{agent-defaults-section-VUhgYmuN.js → agent-defaults-section-BUJi0JBr.js} +1 -1
  7. package/web/dist/assets/{appearance-CpDAS_Ul.js → appearance-L-Mcz7xt.js} +1 -1
  8. package/web/dist/assets/{archive-on-merge-field-DlkEGuaI.js → archive-on-merge-field-BJoirmK5.js} +1 -1
  9. package/web/dist/assets/attention-D8ku2yDQ.js +1 -0
  10. package/web/dist/assets/{automation-format-BsnXeUET.js → automation-format-CUP262Tk.js} +1 -1
  11. package/web/dist/assets/{automations-route-BwDLBy9v.js → automations-route-DndFRPQ2.js} +1 -1
  12. package/web/dist/assets/{cez-idle-Crszm9Ts.js → cez-idle-CQtDz5jk.js} +1 -1
  13. package/web/dist/assets/{commit-diff-panel-DE6af9SI.js → commit-diff-panel-uXKNbpAQ.js} +1 -1
  14. package/web/dist/assets/{diff-DKigJrIK.js → diff-DcmpXzlx.js} +2 -2
  15. package/web/dist/assets/{diff-view-BV41OEIW.js → diff-view-Bu3mxoNK.js} +1 -1
  16. package/web/dist/assets/{file-preview-CXXKcpBz.js → file-preview-DmLdg1Ak.js} +1 -1
  17. package/web/dist/assets/{folder-browser-zsT1W215.js → folder-browser-DwKXxvit.js} +1 -1
  18. package/web/dist/assets/{git-toolbar-DM1Z5LRO.js → git-toolbar-CBMk5v-t.js} +1 -1
  19. package/web/dist/assets/{github-Z2_nA6EI.js → github-ktVA2Gmk.js} +1 -1
  20. package/web/dist/assets/{global-activity-route-DcQEMY2A.js → global-activity-route-Rx7cgzpu.js} +1 -1
  21. package/web/dist/assets/{index-jtycbyRq.js → index-CilVqe_c.js} +5 -5
  22. package/web/dist/assets/{label-9ElpAxAO.js → label-DozlouK_.js} +1 -1
  23. package/web/dist/assets/{live-protocol-BXzu6cSE.js → live-protocol-DteqtbyN.js} +1 -1
  24. package/web/dist/assets/{markdown-BDx7WnW8.js → markdown-CoC8_Mxa.js} +1 -1
  25. package/web/dist/assets/{notifications-section-CjgS2_uZ.js → notifications-section-CRVfC723.js} +1 -1
  26. package/web/dist/assets/{open-in-menu-jthe8d7_.js → open-in-menu-9Hic-2Jh.js} +1 -1
  27. package/web/dist/assets/{preview-pane-connected-BdpApHW4.js → preview-pane-connected-BcePJL41.js} +1 -1
  28. package/web/dist/assets/{project-location-Do0zCjuE.js → project-location-YHLlezCN.js} +1 -1
  29. package/web/dist/assets/{project-router-DtTvMbeA.js → project-router-CYJwJlJL.js} +1 -1
  30. package/web/dist/assets/{project-scope-context-Dgq8_2JZ.js → project-scope-context-DqBHMdSb.js} +1 -1
  31. package/web/dist/assets/{projects-section-B94Rc_Ig.js → projects-section-BzJOvGbU.js} +1 -1
  32. package/web/dist/assets/{prompt-templates-section-Bm4SvXEV.js → prompt-templates-section-DCXEFZeZ.js} +1 -1
  33. package/web/dist/assets/{queries-DfxoqDBz.js → queries-DeeY9cGJ.js} +1 -1
  34. package/web/dist/assets/{reference-chip-B9Cnr6jR.js → reference-chip-BSXiknFh.js} +1 -1
  35. package/web/dist/assets/{remote-settings-notice-DXgS_yXZ.js → remote-settings-notice-B6gmSQmK.js} +1 -1
  36. package/web/dist/assets/{repo-git-C99FduHG.js → repo-git-f5cKDC-i.js} +1 -1
  37. package/web/dist/assets/{report-reader-BjVZrGCz.js → report-reader-D_SwO-8H.js} +1 -1
  38. package/web/dist/assets/{reports-DnQPedky.js → reports-CyP79G2S.js} +1 -1
  39. package/web/dist/assets/{resources-section-DVi14Dy4.js → resources-section-21R3ObSS.js} +1 -1
  40. package/web/dist/assets/{run-header-CCO4OIcD.js → run-header-CmEgf2OE.js} +1 -1
  41. package/web/dist/assets/{settings-agent-picker-DjvmMcxd.js → settings-agent-picker-CIUuXcrv.js} +1 -1
  42. package/web/dist/assets/{settings-shell-BGvilCiB.js → settings-shell-DuQAKYA0.js} +1 -1
  43. package/web/dist/assets/{sidebar-section-BR6GFKTd.js → sidebar-section-D7e8bdCc.js} +1 -1
  44. package/web/dist/assets/{skills-BjtkIMxL.js → skills-CBHa5_n1.js} +1 -1
  45. package/web/dist/assets/{tab-link-Dl5Mmavw.js → tab-link-Bc33InzJ.js} +1 -1
  46. package/web/dist/assets/{task-changes-B8siIdj_.js → task-changes-B-daTy0n.js} +1 -1
  47. package/web/dist/assets/{task-commits-CGYaXoYl.js → task-commits-B8JcUxwa.js} +1 -1
  48. package/web/dist/assets/{task-files-HaulqF8i.js → task-files-QGAAGN7K.js} +1 -1
  49. package/web/dist/assets/{task-github-item-DumSw4lZ.js → task-github-item-BUQ-EaXP.js} +1 -1
  50. package/web/dist/assets/{task-groups-BWeTwWTP.js → task-groups-CC8zwSMv.js} +1 -1
  51. package/web/dist/assets/{task-thread-CeJ8GbmR.js → task-thread-BDXHF8cV.js} +1 -1
  52. package/web/dist/assets/{tasks-table-DS9DShj0.js → tasks-table-_5cXATkO.js} +1 -1
  53. package/web/dist/assets/{thread-state-BeRGkUTA.js → thread-state-CiVcAJSc.js} +1 -1
  54. package/web/dist/assets/{use-hand-to-agent-state-DAmqctoU.js → use-hand-to-agent-state-qYz6wj5e.js} +1 -1
  55. package/web/dist/assets/{useInfiniteQuery-BnyaEFle.js → useInfiniteQuery-BswGDVd8.js} +1 -1
  56. package/web/dist/assets/useQuery-IS5tPlew.js +1 -0
  57. package/web/dist/assets/{workflows-bPgltsoh.js → workflows-CmaJn4ba.js} +1 -1
  58. package/web/dist/assets/{workspace-tools-Clb89tgJ.js → workspace-tools-CJ8gOVwz.js} +1 -1
  59. package/web/dist/assets/{worktrees-section-DdChlr21.js → worktrees-section-DmsaW6FZ.js} +1 -1
  60. package/web/dist/assets/{ws-Bal5BUy2.js → ws-CKLbENkm.js} +1 -1
  61. package/web/dist/index.html +16 -16
  62. package/web/dist/live-worker.js +1 -1
  63. package/web/dist/assets/attention-otQlgfRj.js +0 -1
  64. package/web/dist/assets/useQuery-BUslvRIM.js +0 -1
@@ -1,8 +1,8 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-rail-sortable-BmVI4_-T.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/project-order-AcHI4Dcl.js","assets/sortable.esm-CAVTYaA3.js","assets/accounts-section-CZzEOP8R.js","assets/project-scope-context-Dgq8_2JZ.js","assets/utils-DSMR_WLb.js","assets/bundle-mjs-rHxsej31.js","assets/live-protocol-BXzu6cSE.js","assets/queries-DfxoqDBz.js","assets/live-refetch-CZb2VOyu.js","assets/useInfiniteQuery-BnyaEFle.js","assets/useQuery-BUslvRIM.js","assets/ws-Bal5BUy2.js","assets/toaster-Bo5vCbz-.js","assets/chunk-KS7C4IRE-Cg8l-LDN.js","assets/preload-helper-Czpn1I53.js","assets/design-icons-CzEoMH9c.js","assets/createLucideIcon-BHp8sXmF.js","assets/folder-browser-zsT1W215.js","assets/chevron-right-BENZ-1ZN.js","assets/folder-o-AvL3y3.js","assets/button-BQ2y4XRB.js","assets/dist-BW234Kg5.js","assets/badge-D9JrXe0o.js","assets/dialog-BVF6dIeS.js","assets/dist-Da4ckcJG.js","assets/dist-C5mlVBmd.js","assets/es2015-CQth82uv.js","assets/status-dot-DtAOFiIi.js","assets/bot-TkDIw4y-.js","assets/agents-settings-path-7X6_cvUg.js","assets/centered-state-V15AR_qo.js","assets/settings-agent-picker-DjvmMcxd.js","assets/agent-config-section-BumcXk5K.js","assets/highlighter-DvLzHjjY.js","assets/own-lookup-DS54wXvD.js","assets/remote-settings-notice-DXgS_yXZ.js","assets/agent-defaults-section-VUhgYmuN.js","assets/switch-Bv2Zf1uU.js","assets/dist-DXO3xwbC.js","assets/textarea-vJt9undk.js","assets/appearance-CpDAS_Ul.js","assets/moon-CRE9nU5R.js","assets/notifications-section-CjgS2_uZ.js","assets/projects-section-B94Rc_Ig.js","assets/popover-BPgUYFyu.js","assets/dist-BAoXdNsT.js","assets/settings-field-Bl6WuvGX.js","assets/prompt-templates-section-Bm4SvXEV.js","assets/command-CDt1BsZy.js","assets/skills-pM_PouEs.js","assets/resources-section-DVi14Dy4.js","assets/sidebar-section-BR6GFKTd.js","assets/worktrees-section-DdChlr21.js","assets/project-router-DtTvMbeA.js","assets/project-location-Do0zCjuE.js","assets/open-in-menu-jthe8d7_.js","assets/external-link-BE6y205O.js","assets/smartphone-Lr8Ug2z_.js","assets/square-terminal-B6RYYieR.js","assets/dropdown-menu-4e2iKSMT.js","assets/archive-on-merge-field-DlkEGuaI.js","assets/preview-pane-connected-BdpApHW4.js","assets/arrow-right-Dh_Lx3um.js","assets/dist-C28wFbz0.js","assets/chevron-down-CHGyCDBH.js","assets/hourglass-B0lPAJvT.js","assets/info-DA1x_4bz.js","assets/format-BNCkW110.js","assets/play-CmVAj_fu.js","assets/thread-state-BeRGkUTA.js","assets/app-window-CSHwDX9N.js","assets/report-reader-BjVZrGCz.js","assets/file-preview-CXXKcpBz.js","assets/markdown-BDx7WnW8.js","assets/chunk-BO2N2NFS-DQrpGzb-.js","assets/lib-DrPFkMXk.js","assets/automations-route-BwDLBy9v.js","assets/label-9ElpAxAO.js","assets/cez-idle-Crszm9Ts.js","assets/collapsible-BEV4FO-1.js","assets/automation-format-BsnXeUET.js","assets/workspace-tools-Clb89tgJ.js","assets/tasks-table-DS9DShj0.js","assets/task-groups-BWeTwWTP.js","assets/attention-otQlgfRj.js","assets/settings-shell-BGvilCiB.js","assets/settings-shell-xK8txSJo.css","assets/task-thread-CeJ8GbmR.js","assets/run-header-CCO4OIcD.js","assets/message-square-B-MD-8rD.js","assets/reference-chip-B9Cnr6jR.js","assets/tab-link-Dl5Mmavw.js","assets/run-header-CC7VUTg9.css","assets/eye-B8okNWXU.js","assets/zoomable-image-CIQl1Wpe.js","assets/report-title-D4Mbu2Er.js","assets/task-thread-DtQ6uGfQ.css","assets/task-changes-B8siIdj_.js","assets/git-toolbar-DM1Z5LRO.js","assets/diff-controls-BSWICnsb.js","assets/markdown-BBDDg-4t.js","assets/diff-DKigJrIK.js","assets/image-preview-CNBuRrK5.js","assets/task-files-HaulqF8i.js","assets/task-commits-CGYaXoYl.js","assets/commit-diff-panel-DE6af9SI.js","assets/task-github-item-DumSw4lZ.js","assets/use-hand-to-agent-state-DAmqctoU.js","assets/use-hand-to-agent-state-C7esPJ-N.css","assets/repo-git-C99FduHG.js","assets/nav-row-styles-DqKjMToI.js","assets/repo-git-DVXNOJDT.css","assets/github-Z2_nA6EI.js","assets/reports-DnQPedky.js","assets/reports-B7QAzibP.css","assets/workflows-bPgltsoh.js","assets/workflows-C21NystW.css","assets/activity-route-SFwjSBCp.js","assets/activity-motion-Jmq2_2yL.js","assets/activity-motion-0wHCeUs7.css","assets/global-activity-route-DcQEMY2A.js","assets/skills-BjtkIMxL.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r,t as i}from"./react-runtime-CCIEwYL0.js";import{c as a,i as o,r as s,t as c,u as l}from"./utils-DSMR_WLb.js";import{n as u,r as d}from"./live-refetch-CZb2VOyu.js";import{Ai as f,B as p,Bt as m,C as h,Ci as g,Cr as _,Dr as v,Dt as y,Er as b,Ft as x,G as S,Gr as C,Hn as w,Hr as T,Ht as E,Jn as D,Kr as O,Kt as k,Ln as A,Mn as j,Mt as M,Oi as ee,Or as te,P as ne,Q as re,Rr as ie,S as N,Si as P,Sn as ae,Sr as oe,St as se,T as ce,Ti as le,Tr as ue,Un as de,Ut as fe,Vt as pe,W as me,Wr as he,Yn as ge,Yt as _e,_i as ve,a as ye,ar as be,bi as xe,br as Se,bt as Ce,ci as F,cr as we,f as Te,ft as Ee,gi as De,hi as Oe,hn as ke,ht as Ae,i as je,ir as Me,jn as Ne,jt as Pe,ki as Fe,li as Ie,n as Le,o as Re,pn as ze,pt as Be,qt as Ve,r as He,si as Ue,sr as We,t as Ge,ui as Ke,vi as qe,wr as Je,xi as Ye,xr as Xe,xt as Ze,yr as Qe}from"./project-scope-context-Dgq8_2JZ.js";import{B as $e,F as et,I as tt,N as nt,P as rt,V as it,W as at,Y as ot,Z as I}from"./live-protocol-BXzu6cSE.js";import{t as st}from"./useInfiniteQuery-BnyaEFle.js";import{At as ct,B as lt,Bt as ut,Ct as dt,Ft as ft,G as pt,Gt as mt,H as ht,Ht as gt,It as _t,J as vt,K as yt,L as bt,Lt as xt,M as St,Nt as L,O as Ct,P as wt,Pt as Tt,Rt as Et,St as Dt,Tt as Ot,U as kt,Ut as At,V as jt,Vt as Mt,W as Nt,Wt as Pt,Xt as Ft,Z as It,Zt as Lt,_ as Rt,an as zt,at as Bt,bt as Vt,d as Ht,en as Ut,et as Wt,f as Gt,h as Kt,in as qt,jt as Jt,kt as Yt,n as Xt,nn as Zt,o as Qt,on as $t,p as en,q as tn,qt as nn,rn,s as an,t as on,tn as sn,ut as cn,vt as ln,yt as un,z as dn,zt as fn}from"./queries-DfxoqDBz.js";import{t as pn}from"./useQuery-BUslvRIM.js";import{t as R}from"./preload-helper-Czpn1I53.js";import{a as mn,c as hn,f as gn,g as _n,h as vn,i as yn,l as bn,m as xn,n as z,o as B,p as Sn,r as Cn,s as wn,t as Tn,u as En}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{i as Dn,n as On,r as kn,t as An}from"./label-9ElpAxAO.js";import{t as jn}from"./cez-idle-Crszm9Ts.js";import{_ as Mn,a as Nn,c as Pn,f as Fn,g as In,h as Ln,i as Rn,l as zn,n as Bn,p as Vn,r as Hn,s as Un,t as Wn,u as Gn,v as Kn,y as qn}from"./tasks-table-DS9DShj0.js";import{t as Jn}from"./ws-Bal5BUy2.js";import{n as V,t as Yn}from"./toaster-Bo5vCbz-.js";import{$ as Xn,A as Zn,B as Qn,C as $n,D as er,E as tr,F as nr,G as rr,I as ir,J as ar,K as or,L as sr,O as cr,Q as lr,R as ur,T as dr,U as fr,V as pr,W as mr,X as hr,Z as gr,c as _r,ct as vr,dt as yr,et as br,ft as xr,g as Sr,h as Cr,i as wr,it as Tr,j as Er,k as Dr,l as Or,n as kr,nt as Ar,o as jr,ot as Mr,p as Nr,pt as Pr,r as Fr,rt as Ir,s as Lr,t as Rr,tt as zr,u as Br,ut as Vr,v as Hr,x as Ur,y as Wr,z as Gr}from"./design-icons-CzEoMH9c.js";import{t as H}from"./createLucideIcon-BHp8sXmF.js";import{n as Kr,r as qr}from"./open-in-menu-jthe8d7_.js";import{r as Jr,t as Yr}from"./dist-C28wFbz0.js";import{t as Xr}from"./chevron-down-CHGyCDBH.js";import{_ as Zr,a as Qr,c as $r,d as ei,f as ti,g as ni,h as ri,i as ii,m as ai,o as oi,p as si,r as ci,s as li,u as ui,y as di}from"./nav-row-styles-DqKjMToI.js";import{n as fi,t as pi}from"./folder-browser-zsT1W215.js";import{t as mi}from"./external-link-BE6y205O.js";import{t as hi}from"./eye-B8okNWXU.js";import{a as gi,i as _i,n as vi,r as yi,t as bi}from"./format-BNCkW110.js";import{t as xi}from"./play-CmVAj_fu.js";import{a as Si,i as Ci,l as wi,r as Ti,s as Ei,t as Di,u as Oi}from"./reference-chip-B9Cnr6jR.js";import{n as ki,t as U}from"./button-BQ2y4XRB.js";import{a as Ai,r as ji}from"./dist-BW234Kg5.js";import{a as Mi,i as Ni,r as Pi,t as Fi}from"./dist-C5mlVBmd.js";import{a as Ii,c as Li,d as Ri,f as zi,i as W,l as Bi,o as Vi,p as Hi,r as Ui,s as Wi,t as Gi,u as Ki}from"./dropdown-menu-4e2iKSMT.js";import{i as qi,l as Ji,o as Yi,u as Xi}from"./es2015-CQth82uv.js";import{a as Zi,c as Qi,i as $i,l as ea,n as ta,o as na,r as ra,s as ia,t as aa}from"./dist-Da4ckcJG.js";import{t as oa}from"./switch-Bv2Zf1uU.js";import{a as sa,i as ca,n as la,r as ua,t as da}from"./dist-BAoXdNsT.js";import{i as fa,n as pa,o as ma,r as ha,t as ga}from"./popover-BPgUYFyu.js";import{t as _a}from"./badge-D9JrXe0o.js";import{a as va,i as ya,n as ba,o as xa,r as Sa,s as Ca,t as wa}from"./dialog-BVF6dIeS.js";import{t as Ta}from"./own-lookup-DS54wXvD.js";import{a as Ea,c as Da,i as Oa,l as ka,o as Aa,r as ja,s as Ma,t as G}from"./project-router-DtTvMbeA.js";import{t as Na}from"./attention-otQlgfRj.js";import{C as Pa,O as Fa,S as Ia,T as La,_ as Ra,a as za,b as Ba,c as Va,d as Ha,f as K,g as Ua,h as Wa,i as Ga,l as Ka,m as qa,n as Ja,o as Ya,p as Xa,r as Za,s as Qa,t as $a,u as eo,v as to,w as no,y as ro}from"./task-groups-BWeTwWTP.js";import{t as q}from"./status-dot-DtAOFiIi.js";import{a as io,c as ao,i as J,l as oo,n as so,o as co,r as lo,s as uo,t as fo}from"./command-CDt1BsZy.js";import{i as po,r as mo,t as ho}from"./project-order-AcHI4Dcl.js";import{a as go,c as _o,d as vo,f as yo,i as bo,n as xo,o as So,p as Co,r as wo,t as To,u as Eo}from"./skills-pM_PouEs.js";import{r as Do,t as Oo}from"./agents-settings-path-7X6_cvUg.js";import{t as ko}from"./centered-state-V15AR_qo.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 Ao=class extends f{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 $t({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=jo(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=jo(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=jo(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=jo(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){I.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=>xe(t,e))}findAll(e={}){return this.getAll().filter(t=>xe(e,t))}notify(e){I.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return I.batch(()=>Promise.all(e.map(e=>e.continue().catch(P))))}};function jo(e){return e.options.scope?.id}var Mo=class extends f{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??qe(r,t),a=this.get(i);return a||(a=new Ke({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(){I.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=>Ye(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ye(e,t)):t}notify(e){I.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){I.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){I.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},No=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Mo,this.#t=e.mutationCache||new Ao,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Fe.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Oe.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(le(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=De(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return I.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;I.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return I.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=I.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(P).catch(P)}invalidateQueries(e,t={}){return I.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=I.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(P)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(P)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(le(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(P).catch(P)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(P).catch(P)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Oe.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(ve(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{g(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ve(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{g(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||=qe(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===ee&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Y=e(t(),1),Po=n(),Fo=at().regex(/^(?:(?:config\.json(?:\.bak)?|agent-accounts\.json|ui-state\.json|server\.json|server\.install\.lock)|(?:remote-settings|server-instances)\/[a-zA-Z0-9-]+\.(?:json|install\.lock))$/),Io=$e({file:Fo,detectedAt:ot(),canRestore:rt()}),Lo=[`reset`,`outside-write`,`legacy-change`],Ro=$e({files:nt(et(`reason`,[Io.extend({reason:tt(`reset`)}),Io.extend({reason:tt(`outside-write`)}),Io.extend({reason:tt(`legacy-change`),canImport:rt()})]))});function zo(e,t){return!e||typeof e!=`object`||!(`files`in e)||!Array.isArray(e.files)?e:{...e,files:e.files.filter(e=>!(e&&typeof e==`object`&&`reason`in e&&typeof e.reason==`string`&&!t.includes(e.reason)))}}var Bo=it(e=>zo(e,Lo),Ro);$e({file:Fo,detectedAt:ot()}).strict();async function Vo(e,t,n){n.throwIfAborted();let r=new Ie(e,{queryKey:t.queryKey,queryFn:t.queryFn,retry:!1,enabled:!1}).subscribe(()=>void 0);n.addEventListener(`abort`,r,{once:!0});try{return await e.fetchQuery({...t,retry:!1})}finally{n.removeEventListener(`abort`,r),r()}}var Ho=[`workspace`,`home-recovery`];function Uo(e){let t=Bo.safeParse(e);if(!t.success)throw new je(200,`the Squawk server answered /home/recovery with an unexpected body`);return t.data}async function Wo(e){return Uo(await ke(await Te.api.v1.home.recovery.$get({},Pe(e)),`/home/recovery`))}function Go(){return pn({queryKey:Ho,queryFn:({signal:e})=>Wo({signal:e}),enabled:O(),staleTime:1/0,retry:!1})}function Ko(){let e=F();(0,Y.useEffect)(()=>{let t=!0,n=new AbortController,r,i=async t=>{he()&&await Vo(e,{queryKey:Ho,queryFn:({signal:e})=>Wo({signal:e}),staleTime:0},t?AbortSignal.any([n.signal,t]):n.signal)},a=n=>{let r;try{r=Uo(n)}catch{i().catch(()=>{});return}e.cancelQueries({queryKey:Ho,exact:!0}).then(()=>{t&&he()&&e.setQueryData(Ho,r)})},o=()=>{he()&&!r?r=Jn(`home:recovery`,a):!he()&&r&&(r(),r=void 0)};o();let s=C(t=>{o(),t?i().catch(()=>{}):e.cancelQueries({queryKey:Ho,exact:!0})}),c=ie(e=>i(e));return()=>{t=!1,n.abort(),c(),s(),r?.()}},[e])}function qo(e,t){let n=t===`config.json`?[L.projects,L.config,L.runsIndex]:t===`agent-accounts.json`?[L.agentProfiles,L.providerStatus]:t===`ui-state.json`?[L.uiState]:[];for(let t of n)e.invalidateQueries({queryKey:t})}function Jo(e){let t=F();return qt({mutationFn:async t=>Uo(await ke(await Te.api.v1.home.recovery[e].$post({json:t}),`/home/recovery/${e}`)),onSuccess:async(e,n)=>{await t.cancelQueries({queryKey:Ho,exact:!0}),t.setQueryData(Ho,e),qo(t,n.file)}})}var Yo=()=>Jo(`restore`),Xo=()=>Jo(`accept`),Zo=()=>Jo(`import`);function Qo(){return Ko(),null}function $o(){return new No({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof je&&t.status>=400&&t.status<500?!1:e<1},mutations:{retry:!1}}})}var es=Y.createContext(null),X=i(),ts=class extends Y.Component{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:Error(String(e))}}componentDidCatch(e,t){console.error(`Squawk cockpit: uncaught render error`,e,t.componentStack)}render(){let{error:e}=this.state;return e?(0,X.jsxs)(`div`,{"data-slot":`app-error`,role:`alert`,style:{display:`flex`,minHeight:`100dvh`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:`12px`,padding:`24px`,textAlign:`center`,font:`14px/1.5 system-ui, sans-serif`},children:[(0,X.jsx)(`h1`,{style:{fontSize:`20px`,fontWeight:600,margin:0},children:`The cockpit hit an error`}),(0,X.jsxs)(`p`,{style:{margin:0,maxWidth:`52ch`},children:[`Reload to carry on. Nothing on disk changed — Squawk’s state lives in`,` `,(0,X.jsx)(`code`,{children:`.ai/cezar/`}),`, and this page never wrote to it.`]}),(0,X.jsx)(`pre`,{"data-slot":`app-error-detail`,style:{margin:0,maxWidth:`100%`,overflowX:`auto`,textAlign:`left`,opacity:.75},children:e.message}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>location.reload(),style:{padding:`6px 14px`,cursor:`pointer`},children:`Reload`})]}):this.props.children}},ns=H(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),rs=H(`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`}]]),is=H(`brush`,[[`path`,{d:`m11 10 3 3`,key:`fzmg1i`}],[`path`,{d:`M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z`,key:`p4q2r7`}],[`path`,{d:`M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031`,key:`wy6l02`}]]),as=H(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),os=H(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ss=H(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),cs=H(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),ls=H(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),us=H(`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`}]]),ds=H(`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`}]]),fs=H(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),ps=H(`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`}]]),ms=H(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),hs=H(`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`}]]),gs=H(`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`}]]),_s=H(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),vs=H(`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`}]]),ys=H(`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`}]]),bs=H(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),xs=H(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Ss=H(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),Cs=H(`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`}]]),ws=H(`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`}]]),Ts=H(`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`}]]),Es=H(`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`}]]),Ds=H(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Os=H(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),ks=H(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),As=H(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),js=H(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Ms=`cezar:open-command-palette`;function Ns(){window.dispatchEvent(new Event(Ms))}var Ps=`cez-sidebar-width`;function Fs(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(420,Math.max(264,Math.round(t))):264}function Is(){try{let e=localStorage.getItem(Ps);return e===null?264:Fs(e)}catch{return 264}}function Ls(e){try{localStorage.setItem(Ps,String(Fs(e)))}catch{}}var Rs=Y.createContext(264),zs=Y.createContext(void 0);function Bs(){return Y.useContext(zs)}var Vs=`AlertDialog`,[Hs,Us]=Ni(Vs,[ea]),Ws=ea(),Gs=e=>{let{__scopeAlertDialog:t,...n}=e,r=Ws(t);return(0,X.jsx)(aa,{...r,...n,modal:!0})};Gs.displayName=Vs;var Ks=`AlertDialogTrigger`,qs=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Ws(n);return(0,X.jsx)(Qi,{...i,...r,ref:t})});qs.displayName=Ks;var Js=`AlertDialogPortal`,Ys=e=>{let{__scopeAlertDialog:t,...n}=e,r=Ws(t);return(0,X.jsx)(na,{...r,...n})};Ys.displayName=Js;var Xs=`AlertDialogOverlay`,Zs=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Ws(n);return(0,X.jsx)(Zi,{...i,...r,ref:t})});Zs.displayName=Xs;var Qs=`AlertDialogContent`,[$s,ec]=Hs(Qs),tc=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=Ws(n),o=Ai(t,Y.useRef(null)),s=Y.useRef(null);return(0,X.jsx)($s,{scope:n,cancelRef:s,children:(0,X.jsx)(ra,{role:`alertdialog`,...a,...i,ref:o,onOpenAutoFocus:Pi(i.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})});tc.displayName=Qs;var nc=`AlertDialogTitle`,rc=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Ws(n);return(0,X.jsx)(ia,{...i,...r,ref:t})});rc.displayName=nc;var ic=`AlertDialogDescription`,ac=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Ws(n);return(0,X.jsx)($i,{...i,...r,ref:t})});ac.displayName=ic;var oc=`AlertDialogAction`,sc=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Ws(n);return(0,X.jsx)(ta,{...i,...r,ref:t})});sc.displayName=oc;var cc=`AlertDialogCancel`,lc=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=ec(cc,n),a=Ws(n),o=Ai(t,i);return(0,X.jsx)(ta,{...a,...r,ref:o})});lc.displayName=cc;var uc=Gs,dc=Ys,fc=Zs,pc=tc,mc=sc,hc=lc,gc=rc,_c=ac,[vc,yc]=Ni(`Tooltip`,[sa]),bc=sa(),xc=`TooltipProvider`,Sc=700,Cc=`tooltip.open`,[wc,Tc]=vc(xc),Ec=e=>{let{__scopeTooltip:t,delayDuration:n=Sc,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=Y.useRef(!0),s=Y.useRef(!1),c=Y.useRef(0);return Y.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,X.jsx)(wc,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:Y.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:Y.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:Y.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Ec.displayName=xc;var Dc=`Tooltip`,[Oc,kc]=vc(Dc),Ac=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Tc(Dc,e.__scopeTooltip),l=bc(t),[u,d]=Y.useState(null),f=Ji(),p=Y.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=Y.useRef(!1),[_,v]=Fi({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Cc))):c.onClose(),a?.(e)},caller:Dc}),y=Y.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=Y.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=Y.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=Y.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return Y.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,X.jsx)(ca,{...l,children:(0,X.jsx)(Oc,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:Y.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:Y.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};Ac.displayName=Dc;var jc=`TooltipTrigger`,Mc=Y.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=kc(jc,n),a=Tc(jc,n),o=bc(n),s=Ai(t,Y.useRef(null),i.onTriggerChange),c=Y.useRef(!1),l=Y.useRef(!1),u=Y.useCallback(()=>c.current=!1,[]);return Y.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,X.jsx)(da,{asChild:!0,...o,children:(0,X.jsx)(Mi.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:Pi(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:Pi(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:Pi(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:Pi(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Pi(e.onBlur,i.onClose),onClick:Pi(e.onClick,i.onClose)})})});Mc.displayName=jc;var Nc=`TooltipPortal`,[Pc,Fc]=vc(Nc,{forceMount:void 0}),Ic=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=kc(Nc,t);return(0,X.jsx)(Pc,{scope:t,forceMount:n,children:(0,X.jsx)(Xi,{present:n||a.open,children:(0,X.jsx)(qi,{asChild:!0,container:i,children:r})})})};Ic.displayName=Nc;var Lc=`TooltipContent`,Rc=Y.forwardRef((e,t)=>{let n=Fc(Lc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=kc(Lc,e.__scopeTooltip);return(0,X.jsx)(Xi,{present:r||o.open,children:o.disableHoverableContent?(0,X.jsx)(Uc,{side:i,...a,ref:t}):(0,X.jsx)(zc,{side:i,...a,ref:t})})}),zc=Y.forwardRef((e,t)=>{let n=kc(Lc,e.__scopeTooltip),r=Tc(Lc,e.__scopeTooltip),i=Y.useRef(null),a=Ai(t,i),[o,s]=Y.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=Y.useCallback(()=>{s(null),d(!1)},[d]),p=Y.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=qc(r,Kc(r,n.getBoundingClientRect())),a=Jc(t.getBoundingClientRect()),o=Xc([...i,...a]);s(o),d(!0)},[d]);return Y.useEffect(()=>()=>f(),[f]),Y.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),Y.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Yc(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,X.jsx)(Uc,{...e,ref:a})}),[Bc,Vc]=vc(Dc,{isInside:!1}),Hc=ji(`TooltipContent`),Uc=Y.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=kc(Lc,n),l=bc(n),{onClose:u}=c;return Y.useEffect(()=>(document.addEventListener(Cc,u),()=>document.removeEventListener(Cc,u)),[u]),Y.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,X.jsx)(Yi,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,X.jsxs)(ua,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,X.jsx)(Hc,{children:r}),(0,X.jsx)(Bc,{scope:n,isInside:!0,children:(0,X.jsx)(Yr,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Rc.displayName=Lc;var Wc=`TooltipArrow`,Gc=Y.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=bc(n);return Vc(Wc,n).isInside?null:(0,X.jsx)(la,{...i,...r,ref:t})});Gc.displayName=Wc;function Kc(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function qc(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Jc(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Yc(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Xc(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Zc(t)}function Zc(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Qc=Ec,$c=Ac,el=Mc,tl=Ic,nl=Rc,rl=Gc;function il({open:e,onOpenChange:t}){let[n,r]=(0,Y.useState)(null),[i,a]=(0,Y.useState)(null),o=tn(),s=Wt(),c=Sn(),l=new Set((o.data?.projects??[]).map(e=>e.root)),u=e=>{r(e),a(null),s.reset()},d=fi(n,i);return(0,X.jsx)(wa,{open:e,onOpenChange:t,children:(0,X.jsxs)(Sa,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(xa,{children:[(0,X.jsx)(Ca,{children:`Open local folder`}),(0,X.jsx)(ya,{children:`Pick the folder Squawk should run in. Git repos are marked; any folder works.`})]}),(0,X.jsxs)(ba,{className:`space-y-4`,children:[(0,X.jsx)(pi,{path:n,selected:i,onSelect:a,onEnter:u,emptyHint:`No subfolders here — “Add project” registers this folder.`,decorate:e=>(0,X.jsxs)(X.Fragment,{children:[e.isRepo?(0,X.jsx)(_a,{variant:`outline`,className:`shrink-0 text-[12px]`,children:`git`}):null,l.has(e.path)?(0,X.jsx)(_a,{variant:`ghost`,className:`shrink-0 text-[12px] text-muted-foreground`,children:`already added`}):null]})}),s.isError?(0,X.jsx)(`p`,{"data-slot":`add-project-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not add that folder`}):null]}),(0,X.jsxs)(va,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,X.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-[11px] text-muted-foreground`,title:d??void 0,children:d??``}),(0,X.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,X.jsx)(U,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(U,{"data-slot":`add-project-confirm`,disabled:d===null||s.isPending,onClick:()=>{d===null||s.isPending||s.mutate(d,{onSuccess:({project:e})=>{t(!1),c(`/p/${encodeURIComponent(e.id)}/`)}})},children:s.isPending?`Adding…`:`Add project`})]})]})]})})}function al(e,t){let[n,r]=(0,Y.useState)(null),i=(0,Y.useMemo)(()=>`${e}${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),a=(0,Y.useRef)(i);return a.current=i,(0,Y.useEffect)(()=>kn((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===a.current&&(n.phase===`cloning`&&n.line?r(n.line):n.phase!==`cloning`&&r(null))}),[]),(0,Y.useEffect)(()=>ie(async e=>{if(!t)return;let n=await S(i,{signal:e}).catch(()=>null);if(!n)return;let{progress:o}=n;e.aborted||o?.checkoutId!==a.current||r(o?.phase===`cloning`?o.line??null:null)}),[t,i]),{checkoutId:i,progress:n,setProgress:r}}function ol({className:e,type:t,...n}){return(0,X.jsx)(`input`,{type:t,"data-slot":`input`,className:c(`h-11 w-full min-w-0 rounded-md border border-control-border bg-[var(--task-brand-bg)] px-3 py-1 text-base shadow-none transition-[color,box-shadow] outline-hidden selection:bg-accent-strong selection:text-accent-strong-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-soft-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20`,e),...n})}function sl(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 cl({open:e,onOpenChange:t}){let[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(!1),c=(0,Y.useRef)(!1),l=tn(),u=Gt(),{mutate:d,isPending:f}=u,p=Sn(),m=sl(u.error),{checkoutId:h,progress:g,setProgress:_}=al(`co-`,f),v=(0,Y.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),y=i.trim()===``?v:i.trim(),b=l.data?.projectsDir??``,x=y===``?``:`${b.replace(/\/+$/,``)}/${y}`,S=(0,Y.useCallback)(()=>{n.trim()===``||f||(c.current=!1,s(!1),_(null),d({url:n.trim(),checkoutId:h,...i.trim()===``?{}:{name:i.trim()}},{onSuccess:({project:e})=>{t(!1),p(`/p/${encodeURIComponent(e.id)}/`)}}))},[d,f,h,i,p,t,n]);return(0,Y.useEffect)(()=>{if(!o)return;let e=()=>{c.current&&(c.current=!1,s(!1),S())},t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[o,S]),(0,X.jsx)(wa,{open:e,onOpenChange:e=>u.isPending?void 0:t(e),children:(0,X.jsxs)(Sa,{"data-slot":`clone-project-dialog`,className:`min-w-0 max-h-[calc(100dvh-2rem)] overflow-x-hidden overflow-y-auto sm:max-w-lg`,children:[(0,X.jsxs)(xa,{children:[(0,X.jsx)(Ca,{children:`Clone from GitHub`}),(0,X.jsxs)(ya,{children:[`Squawk clones with `,(0,X.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(An,{htmlFor:`clone-url`,children:`Repository`}),(0,X.jsx)(ol,{id:`clone-url`,"data-slot":`clone-url`,autoFocus:!0,placeholder:`owner/repo or https://github.com/owner/repo`,value:n,disabled:u.isPending,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&S()}})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(An,{htmlFor:`clone-name`,children:`Folder name`}),(0,X.jsx)(ol,{id:`clone-name`,"data-slot":`clone-name`,placeholder:v===``?`repo`:v,value:i,disabled:u.isPending,onChange:e=>a(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-[11px] text-soft-foreground`,title:x,children:x}),u.isPending?(0,X.jsx)(U,{"data-slot":`clone-root-settings`,variant:`ghost`,size:`icon-sm`,className:`size-7`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,disabled:!0,children:(0,X.jsx)(lr,{className:`size-3.5`,"aria-hidden":`true`})}):(0,X.jsx)(U,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,X.jsx)(z,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,X.jsx)(lr,{className:`size-3.5`,"aria-hidden":`true`})})})]})]}),u.isPending?(0,X.jsx)(`p`,{"data-slot":`clone-progress`,className:`truncate font-mono text-[11px] text-muted-foreground`,children:g??`Starting the clone…`}):null,u.isError?(0,X.jsx)(`div`,{"data-slot":`clone-error`,className:`grid min-w-0 gap-1.5 text-[13px] text-danger`,children:m?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{children:`GitHub requires SAML authorization for this organization.`}),(0,X.jsxs)(`p`,{children:[(0,X.jsx)(`a`,{"data-slot":`clone-sso-link`,className:`inline-flex min-h-11 items-center font-medium underline underline-offset-2`,href:m,target:`_blank`,rel:`noreferrer`,onClick:()=>{c.current=!0,s(!0)},children:`Authorize this GitHub organization`}),o?` — return here after authorizing, or choose Retry clone.`:` — return to this tab to retry, or choose Retry clone.`]}),(0,X.jsxs)(`details`,{className:`min-w-0`,children:[(0,X.jsx)(`summary`,{className:`min-h-11 content-center`,children:`Error details`}),(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-all`,children:u.error instanceof Error?u.error.message:null})]})]}):(0,X.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-all`,children:u.error instanceof Error?u.error.message:`could not clone that repository`})}):null,(0,X.jsxs)(va,{children:[(0,X.jsx)(U,{variant:`outline`,disabled:u.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(U,{"data-slot":`clone-confirm`,disabled:n.trim()===``||y===``||u.isPending,onClick:S,children:u.isPending?`Cloning…`:u.isError?`Retry clone`:`Clone`})]})]})})}var ll=[{slug:`github/codespaces-nextjs`,label:`Next.js`,description:`Minimal Next.js app (GitHub)`},{slug:`vercel/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 ul(e){let t=e.trim().toLowerCase();return t===``||ll.some(e=>e.slug.toLowerCase()===t)?ll:ll.filter(e=>[e.label,e.slug,e.description].some(e=>e.toLowerCase().includes(t)))}function dl({value:e,onChange:t,disabled:n,id:r}){let i=(0,Y.useId)(),a=ul(e),[o,s]=(0,Y.useState)(-1),l=(0,Y.useRef)(null);(0,Y.useEffect)(()=>s(-1),[e]),(0,Y.useEffect)(()=>{o<0||l.current?.querySelector(`[data-index="${o}"]`)?.scrollIntoView?.({block:`nearest`})},[o]);let u=e=>`${i}-option-${e}`;return(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-1.5`,children:[(0,X.jsx)(ol,{id:r,"data-slot":`create-project-template`,role:`combobox`,"aria-expanded":`true`,"aria-controls":i,"aria-autocomplete":`list`,"aria-activedescendant":o>=0?u(o):void 0,autoComplete:`off`,spellCheck:!1,placeholder:`owner/repo or https://github.com/owner/repo`,value:e,disabled:n,onChange:e=>t(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),a.length===0)return;let t=e.key===`ArrowDown`;s(e=>e<0?t?0:a.length-1:(e+(t?1:-1)+a.length)%a.length)}else if(e.key===`Enter`&&o>=0){e.preventDefault(),e.stopPropagation();let n=a[o];n&&t(n.slug)}}}),(0,X.jsx)(`ul`,{ref:l,id:i,role:`listbox`,"aria-label":`Suggested templates`,"data-slot":`create-project-template-list`,className:`max-h-48 min-h-0 overflow-y-auto overscroll-contain rounded-md border border-border`,children:a.length===0?(0,X.jsx)(`li`,{className:`px-3 py-2 text-xs text-muted-foreground`,role:`presentation`,children:`No suggestion matches — any GitHub template repository works.`}):a.map((r,i)=>{let a=r.slug.toLowerCase()===e.trim().toLowerCase();return(0,X.jsxs)(`li`,{id:u(i),role:`option`,"aria-selected":a,"data-index":i,"data-value":r.slug,"data-slot":`create-project-template-option`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n||t(r.slug)},className:c(`grid min-h-11 cursor-pointer content-center gap-0.5 px-3 py-1.5 text-start`,`pointer-hover:hover:bg-accent`,i===o&&`bg-accent`,a&&`font-medium`),children:[(0,X.jsxs)(`span`,{className:`truncate text-[13px]`,children:[r.label,` `,(0,X.jsx)(`span`,{className:`font-mono text-[11px] text-soft-foreground`,children:r.slug})]}),(0,X.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:r.description})]},r.slug)})})]})}function fl({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`skeleton`,className:c(`animate-pulse rounded-md bg-accent`,e),...t})}function pl(e){return{available:e.data?.available?e.data.owners:null,unavailableReason:e.isError?`GitHub is unavailable: ${e.error instanceof Error?e.error.message:`could not ask gh`}`:e.data&&!e.data.available?e.data.reason:null}}function ml(e,t){return e&&t!==null&&t.length>0}function hl(e,t){return e??t?.[0]?.login??null}function gl(e){return(e.data?.projectsDir??``).replace(/\/+$/,``)}function _l({nameValid:e,isPending:t,created:n,github:r,chosenOwner:i,effectiveStart:a,template:o}){return e&&!t&&n===null&&(!r||i!==null&&(a===`empty`||o.trim()!==``))}function vl({trimmed:e,checkoutId:t,github:n,chosenOwner:r,effectiveStart:i,template:a}){return{name:e,checkoutId:t,...n&&r?{github:{owner:r,...i===`template`?{template:a.trim()}:{}}}:{}}}function yl({created:e}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Mr,{"aria-hidden":`true`,className:`mbs-0.5 size-5 shrink-0 text-warning`}),(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:`The project was created, but its GitHub repository is not finished.`}),(0,X.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-words font-mono text-xs`,children:e.warning})]})]})}function bl({fieldId:e,name:t,setName:n,trimmed:r,nameValid:i,projectsDir:a,isPending:o,create:s}){let c=`${e}-name-hint`;return(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(An,{htmlFor:`${e}-name`,children:`Name`}),(0,X.jsx)(ol,{id:`${e}-name`,"data-slot":`create-project-name`,autoFocus:!0,autoComplete:`off`,spellCheck:!1,placeholder:`my-project`,value:t,disabled:o,"aria-invalid":r!==``&&!i,"aria-describedby":r!==``&&!i?c:void 0,onChange:e=>n(e.target.value.replace(/\s/g,`-`)),onKeyDown:e=>{e.key===`Enter`&&s()}}),r!==``&&!i?(0,X.jsx)(`p`,{id:c,"data-slot":`create-project-name-hint`,className:`text-xs text-danger`,children:`Use letters, digits, “.”, “-” and “_” only, starting with a letter or digit — it names the folder and the repository.`}):null,(0,X.jsx)(`p`,{"data-slot":`create-project-path`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,title:`${a}/${r}`,children:r===``?`${a}/…`:`${a}/${r}`})]})}function xl({fieldId:e,github:t,setGithubOn:n,isPending:r,available:i}){return(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(oa,{id:`${e}-github`,"data-slot":`create-project-github`,checked:t,disabled:r||i===null||i.length===0,onCheckedChange:n,className:`mbs-0.5`}),(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-0.5`,children:[(0,X.jsx)(An,{htmlFor:`${e}-github`,children:`Also create a private GitHub repository`}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Under the account you choose. You can change its visibility on GitHub later.`})]})]})}function Sl({fieldId:e,effectiveStart:t,setStart:n,isPending:r,github:i,template:a,setTemplate:o}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`fieldset`,{className:`grid gap-2`,disabled:r,children:[(0,X.jsx)(`legend`,{className:`mbe-2 text-sm font-medium`,children:`Start with`}),(0,X.jsx)(El,{slot:`create-project-start-empty`,name:`${e}-start`,checked:t===`empty`,disabled:r,onChange:()=>n(`empty`),title:`Empty repository`,detail:`One empty first commit, no files.`}),(0,X.jsx)(El,{slot:`create-project-start-template`,name:`${e}-start`,checked:t===`template`,disabled:r||!i,onChange:()=>n(`template`),title:`From a template`,detail:i?`GitHub generates the repository from a template.`:`Needs the GitHub repository.`})]}),t===`template`?(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(An,{htmlFor:`${e}-template`,children:`Template`}),(0,X.jsx)(dl,{id:`${e}-template`,value:a,onChange:o,disabled:r})]}):null]})}function Cl({isPending:e,progress:t,failed:n,error:r}){return(0,X.jsxs)(X.Fragment,{children:[e?(0,X.jsx)(`p`,{"data-slot":`create-project-progress`,className:`flex-none truncate font-mono text-[11px] text-muted-foreground`,children:t??`Starting…`}):null,n?(0,X.jsx)(`p`,{"data-slot":`create-project-error`,role:`alert`,className:`flex-none min-w-0 whitespace-pre-wrap break-words text-[13px] text-danger`,children:r instanceof Error?r.message:`could not create the project`}):null]})}function wl({created:e,goToProject:t,isPending:n,onCancel:r,ready:i,onCreate:a,failed:o}){return(0,X.jsx)(va,{className:`flex-none`,children:e?(0,X.jsx)(U,{"data-slot":`create-project-open`,onClick:t,children:`Go to project`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(U,{variant:`outline`,disabled:n,onClick:r,children:`Cancel`}),(0,X.jsx)(U,{"data-slot":`create-project-submit`,disabled:!i,onClick:a,children:n?`Creating…`:o?`Try again`:`Create project`})]})})}function Tl({open:e,onOpenChange:t}){let[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(`empty`),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(null),m=tn(),h=Ct({enabled:e}),g=Rt(),{mutate:_,isPending:v}=g,y=Sn(),b=(0,Y.useId)(),x=(0,Y.useRef)(!1),{checkoutId:S,progress:C,setProgress:w}=al(`np-`,v),{available:T,unavailableReason:E}=pl(h),D=ml(i,T),O=hl(o,T),k=D?c:`empty`,A=n.trim(),j=ae.test(A),M=gl(m),ee=_l({nameValid:j,isPending:v,created:f,github:D,chosenOwner:O,effectiveStart:k,template:u}),te=(0,Y.useCallback)(()=>{!ee||x.current||(x.current=!0,w(null),_(vl({trimmed:A,checkoutId:S,github:D,chosenOwner:O,effectiveStart:k,template:u}),{onSettled:()=>{x.current=!1},onSuccess:({project:e,warning:n})=>{if(n){p({projectId:e.id,warning:n});return}t(!1),y(`/p/${encodeURIComponent(e.id)}/`)}}))},[ee,_,A,S,D,O,k,u,t,y]);return(0,X.jsx)(wa,{open:e,onOpenChange:e=>v?void 0:t(e),children:(0,X.jsxs)(Sa,{"data-slot":`create-project-dialog`,className:`flex min-w-0 flex-col overflow-y-clip overflow-x-clip sm:max-w-2xl`,children:[(0,X.jsxs)(xa,{className:`flex-none`,children:[(0,X.jsx)(Ca,{children:`New project`}),(0,X.jsx)(ya,{children:`Squawk creates a git repository with one empty commit in your checkout root and adds it as a project.`})]}),f?(0,X.jsx)(`div`,{"data-slot":`create-project-warning`,role:`status`,className:`flex min-h-0 flex-1 gap-3 overflow-y-auto overscroll-contain rounded-md border border-border bg-muted p-4 text-[13px]`,children:(0,X.jsx)(yl,{created:f})}):(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-wrap gap-6 overflow-y-auto overscroll-contain`,children:[(0,X.jsxs)(`div`,{className:`grid min-w-[50%] grow-[999] basis-0 content-start gap-5`,children:[(0,X.jsx)(bl,{fieldId:b,name:n,setName:r,trimmed:A,nameValid:j,projectsDir:M,isPending:v,create:te}),(0,X.jsx)(xl,{fieldId:b,github:D,setGithubOn:a,isPending:v,available:T}),(0,X.jsx)(Sl,{fieldId:b,effectiveStart:k,setStart:l,isPending:v,github:D,template:u,setTemplate:d})]}),(0,X.jsx)(Dl,{owners:T,unavailableReason:E,enabled:D&&!v,chosen:O,onChoose:s,groupName:`${b}-owner`})]}),(0,X.jsx)(Cl,{isPending:v,progress:C,failed:g.isError,error:g.error}),(0,X.jsx)(wl,{created:f,goToProject:()=>{f&&(t(!1),y(`/p/${encodeURIComponent(f.projectId)}/`))},isPending:v,onCancel:()=>t(!1),ready:ee,onCreate:te,failed:g.isError})]})})}function El({slot:e,name:t,checked:n,disabled:r,onChange:i,title:a,detail:o}){return(0,X.jsxs)(`label`,{className:c(`flex min-h-11 items-start gap-3 rounded-md border border-border p-3`,`has-[:checked]:border-accent-strong has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-ring`,r?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,X.jsx)(`input`,{type:`radio`,"data-slot":e,name:t,checked:n,disabled:r,onChange:i,className:`mbs-0.5 size-4 accent-[var(--color-accent-strong)]`}),(0,X.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium`,children:a}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o})]})]})}function Dl({owners:e,unavailableReason:t,enabled:n,chosen:r,onChoose:i,groupName:a}){return(0,X.jsxs)(`fieldset`,{"data-slot":`create-project-owners`,disabled:!n,className:`grid min-w-0 grow basis-56 content-start gap-2`,children:[(0,X.jsx)(`legend`,{className:`mbe-2 text-sm font-medium`,children:`Repository owner`}),t===null?e===null?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(fl,{className:`h-14 w-full`}),(0,X.jsx)(fl,{className:`h-14 w-full`})]}):e.map(e=>(0,X.jsxs)(`label`,{"data-slot":`create-project-owner`,className:c(`flex min-h-11 min-w-0 items-center gap-3 rounded-md border border-border p-2.5`,`has-[:checked]:border-accent-strong has-[:checked]:bg-accent`,`has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-ring`,n?`cursor-pointer pointer-hover:hover:bg-accent`:`cursor-not-allowed opacity-60`),children:[(0,X.jsx)(`input`,{type:`radio`,name:a,value:e.login,checked:r===e.login,disabled:!n,onChange:()=>i(e.login),className:`sr-only`}),e.avatarUrl?(0,X.jsx)(`img`,{src:e.avatarUrl,alt:``,className:`size-8 shrink-0 rounded-full object-cover`}):(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-8 shrink-0 place-items-center rounded-full bg-muted text-xs font-medium uppercase`,children:e.login.slice(0,1)}),(0,X.jsxs)(`span`,{className:`grid min-w-0`,children:[(0,X.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.login}),(0,X.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.personal?`Personal account`:e.description??`Organization`})]})]},e.login)):(0,X.jsxs)(`p`,{"data-slot":`create-project-github-unavailable`,className:`rounded-md border border-border bg-muted p-3 text-xs text-muted-foreground break-words`,children:[t,`. Local projects still work.`]})]})}function Ol({triggerClassName:e,icon:t=er,iconClassName:n=`size-4`,side:r,origin:i,label:a,iconFrameClassName:o}={}){let[l,u]=Y.useState(!1),[d,f]=Y.useState(!1),[p,m]=Y.useState(!1);return(0,X.jsxs)(Gi,{children:[(0,X.jsx)(Hi,{asChild:!0,children:(0,X.jsxs)(U,{variant:`ghost`,"aria-label":`Add project`,title:`Add project`,"data-origin":i,className:c(`size-9 p-0 text-muted-foreground`,e),children:[o?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:o,children:(0,X.jsx)(t,{className:n,"aria-hidden":`true`})}):(0,X.jsx)(t,{className:n,"aria-hidden":`true`}),a?(0,X.jsx)(`span`,{children:a}):(0,X.jsx)(`span`,{className:`sr-only`,children:`Add project`})]})}),(0,X.jsxs)(Ui,{align:`start`,...s({side:r}),className:`w-56`,children:[(0,X.jsx)(Ii,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,X.jsxs)(W,{"data-slot":`add-project-new`,onSelect:()=>m(!0),children:[(0,X.jsx)(er,{"aria-hidden":`true`}),`New project…`]}),(0,X.jsxs)(W,{"data-slot":`add-project-local`,onSelect:()=>u(!0),children:[(0,X.jsx)(dr,{"aria-hidden":`true`}),`Open local folder…`]}),(0,X.jsxs)(W,{"data-slot":`add-project-clone`,onSelect:()=>f(!0),children:[(0,X.jsx)(ir,{"aria-hidden":`true`}),`Clone from GitHub…`]})]}),l?(0,X.jsx)(il,{open:!0,onOpenChange:u}):null,d?(0,X.jsx)(cl,{open:!0,onOpenChange:f}):null,p?(0,X.jsx)(Tl,{open:!0,onOpenChange:m}):null]})}var kl=[`done`,`failed`,`cancelled`];function Al(e){return kl.includes(e)}function jl(e){return!ge(e)&&Al(e.status)&&!no(e)}function Ml(e){return e.reduce((e,t)=>Ya(t)||!no(t)?e:e+1,0)}function Nl(e){return e.status===`failed`?`danger`:`success`}var Pl={needsYou:0,failedUnread:0,inMotion:0,finishedUnread:0};function Fl(e){let t={...Pl};for(let n of e)n.archived||Ya(n)||(j(n)?t.needsYou+=1:Ne(n).tone===`running`?t.inMotion+=1:no(n)&&(n.status===`failed`?t.failedUnread+=1:n.status===`done`&&(t.finishedUnread+=1)));return t}function Il(e){let t=new Map;for(let n of e){let e=t.get(n.projectId);e?e.push(n):t.set(n.projectId,[n])}return new Map([...t].map(([e,t])=>[e,Fl(t)]))}function Ll(e,t,n={}){if(n.unknown)return`${e} · activity unknown`;let r=Rl(t).map(e=>e.text);return[e,r.length>0?r.join(` · `):`idle`].join(` · `)}function Rl(e){let{needsYou:t,failedUnread:n,inMotion:r,finishedUnread:i}=e??Pl,a=[];return t>0&&a.push({tone:`amber`,text:`${t} needs you`}),n>0&&a.push({tone:`red`,text:`${n} failed`}),r>0&&a.push({tone:`violet`,text:`${r} working`}),i>0&&a.push({tone:`green`,text:`${i} finished`}),a}function zl(e){let t={...Pl};for(let n of e)n&&(t.needsYou+=n.needsYou,t.failedUnread+=n.failedUnread,t.inMotion+=n.inMotion,t.finishedUnread+=n.finishedUnread);return t}function Bl(e){let t=e.split(/[-_ .]+/).filter(e=>e!==``);return(t.length>=2?[t[0],t[1]].map(e=>[...e][0]):[...t[0]??``].slice(0,2)).join(``).toLowerCase()}var Vl=`w-[228px] rounded-[10px] border-border bg-sidebar p-[5px] text-foreground shadow-[0_10px_28px_#00000047] motion-reduce:animate-none`,Hl=`h-8 gap-2.5 rounded-[6px] px-[9px] py-0 text-[13px] focus:bg-sidebar-row-hover focus:text-foreground [&_svg]:size-[15px] [&_svg]:text-soft-foreground focus:[&_svg]:text-foreground max-md:min-h-11`;function Ul(){let e=Ma(),t=St(),n=tn(),r=n.data?.bootProject??t.data?.bootProject,i=e??r??null,a=n.data?.projects.find(e=>e.id===i),o=i===r?t.data?.repo:void 0,s=a?.root??o?.root;return{health:t,registry:n,projectId:i,project:a,root:s,name:a?.name??s?.split(/[\\/]/).filter(Boolean).at(-1),branch:o?.branch??a?.branch}}function Wl({onNavigate:e}={}){let t=(0,Y.useRef)(null),n=(0,Y.useRef)(null),[r,i]=(0,Y.useState)(0),{health:a,registry:o,projectId:s,root:c,name:l,branch:u}=Ul(),d=a.data?.capabilities.localHandoff===!0,f=l??(o.isPending?`Loading project…`:`Project unavailable`),p=[d?c:void 0,u].filter(Boolean).join(` · `);return(0,X.jsxs)(`div`,{"data-slot":`project-header`,className:`flex min-w-0 items-center gap-2.5 px-[14px] pt-[14px] pb-2.5`,children:[(0,X.jsx)(`span`,{ref:t,"aria-hidden":`true`,"data-slot":`project-header-mark`,className:`flex size-7 shrink-0 items-center justify-center rounded-[7px] border border-soft-foreground bg-sidebar-row-selected text-[11px] leading-none font-semibold text-foreground`,children:l?Bl(l):`…`}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-px`,children:[(0,X.jsx)(`div`,{"data-slot":`project-header-name`,className:`truncate text-[14px] font-semibold text-foreground`,title:f,children:f}),(0,X.jsx)(`div`,{"data-slot":`project-header-detail`,dir:`rtl`,className:`truncate text-left font-mono text-[10.5px] text-soft-foreground`,title:p||void 0,children:(0,X.jsx)(`bdi`,{dir:`ltr`,children:p||(o.isPending?`Loading…`:`Branch unavailable`)})})]}),(0,X.jsx)(Yl,{projectId:s,onNavigate:e,triggerRef:n,triggerClassName:`size-7 max-md:size-11`,align:`start`,alignOffset:r,onOpenChange:e=>{e&&t.current&&n.current&&i(t.current.getBoundingClientRect().left-n.current.getBoundingClientRect().left)}})]})}function Gl(e,t,n){let r=e.data?.bootProject??t.data?.bootProject,i=e.data?.projects.find(e=>e.id===n),a=n===r?t.data?.repo:void 0;return{bootId:r,project:i,root:i?.root??a?.root}}function Kl({marking:e,runs:t,unread:n,projectId:r}){return e||t.isError||t.data===void 0||n.length===0||r===null}function ql({marking:e,runs:t,unread:n}){return e?`Marking…`:t.isError?`Unavailable`:t.data===void 0?`Loading…`:`${n.length} unread`}function Jl(e,t){return!e||t?.status===`missing`}function Yl({projectId:e,onNavigate:t,triggerRef:n,triggerClassName:r,align:i=`start`,alignOffset:a,side:o,onOpenChange:l}){let u=Bs(),d=St(),f=tn(),[p,m]=(0,Y.useState)(!1),{bootId:h,project:g,root:_}=Gl(f,d,e),v=sn(e??`default`,e!==null,e===h),y=wt(Zt({projectId:e??`default`,boot:e===h})),b=(0,Y.useRef)(e);b.current=e;let x=d.data?.capabilities.localHandoff===!0,S=(v.data??[]).filter(e=>!Ya(e)&&no(e));async function C(){m(!0);let t=0;try{for(let n of S){if(b.current!==e)break;try{await y.mutateAsync(n.id)}catch{t+=1}}t>0&&V(`Could not mark ${t} task${t===1?``:`s`} read. Try again.`,{tone:`danger`})}finally{m(!1)}}async function w(){if(_)try{await navigator.clipboard.writeText(_),V(`Project folder copied`)}catch{V(`Could not copy path: ${_}`,{tone:`danger`})}}return(0,X.jsxs)(Gi,{...s({onOpenChange:l}),children:[(0,X.jsx)(Hi,{asChild:!0,children:(0,X.jsx)(`button`,{"data-slot":`project-menu-trigger`,ref:n,type:`button`,"aria-label":`Project menu`,className:c(`flex shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-[state=open]:bg-sidebar-row-selected data-[state=open]:text-foreground`,r),children:(0,X.jsx)(ms,{"aria-hidden":`true`,className:`size-[15px]`})})}),(0,X.jsxs)(Ui,{align:i,...s({alignOffset:a,side:o}),sideOffset:4,className:Vl,children:[(0,X.jsxs)(W,{className:Hl,disabled:Kl({marking:p,runs:v,unread:S,projectId:e}),onSelect:()=>{C()},children:[(0,X.jsx)(as,{"aria-hidden":`true`}),` Mark all read`,(0,X.jsx)(`span`,{className:`ml-auto text-[11.5px] text-soft-foreground`,children:ql({marking:p,runs:v,unread:S})})]}),(0,X.jsx)(Bi,{className:`mx-0`}),x&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Xl,{projectId:e??`default`,disabled:Jl(_,g)}),(0,X.jsxs)(W,{className:Hl,disabled:!_,onSelect:()=>{w()},children:[(0,X.jsx)(fs,{"aria-hidden":`true`}),` Copy path`]}),(0,X.jsx)(Bi,{className:`mx-0`})]}),(0,X.jsx)(W,{asChild:!0,className:Hl,children:(0,X.jsxs)(G,{to:`/settings`,onClick:t??u,children:[(0,X.jsx)(As,{"aria-hidden":`true`}),` Project settings`]})})]})]})}function Xl({disabled:e,projectId:t}){let n=bt(),r=qt({mutationFn:e=>x(e,t),onError:e=>V(e.message,{tone:`danger`}),onSuccess:()=>V(`Opening project folder`)}),i=(n.data?.targets??[]).filter(e=>Kr(e.id)===void 0);return(0,X.jsxs)(Ki,{children:[(0,X.jsxs)(zi,{className:Hl,disabled:e||r.isPending,children:[(0,X.jsx)(mi,{"aria-hidden":`true`}),` Open in`]}),(0,X.jsx)(Vi,{children:(0,X.jsxs)(Ri,{className:Vl,children:[i.map(e=>{let t=qr(e);return(0,X.jsxs)(W,{className:Hl,"data-target":e.id,onSelect:()=>r.mutate(e.id),children:[(0,X.jsx)(t,{"aria-hidden":`true`}),e.label]},e.id)}),i.length===0&&(0,X.jsx)(W,{className:Hl,disabled:!0,children:n.isError?`Apps unavailable`:n.isPending?`Loading apps…`:`No apps available`})]})})]})}var Zl={amber:`text-signal-word-amber`,red:`text-signal-word-red`,violet:`text-status-running`,green:`text-success`};function Ql({signal:e,known:t,current:n,maxParts:r,slot:i,className:a}){let o=Rl(e).slice(0,r);return(0,X.jsx)(`span`,{"data-slot":i,className:c(`flex min-w-0 items-center font-medium`,n?`text-muted-foreground`:`text-soft-foreground`,a),children:t?o.length===0?`idle`:o.map((e,t)=>(0,X.jsxs)(`span`,{className:`flex items-center gap-x-[inherit]`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,(0,X.jsx)(`span`,{"data-tone":e.tone,className:Zl[e.tone],children:e.text})]},e.tone)):`activity unknown`})}function $l(e,t){let n=e=>e.split(`.`).slice(0,3).map(e=>Number.parseInt(e,10)||0),r=n(e),i=n(t);for(let e=0;e<3;e++){let t=(r[e]??0)-(i[e]??0);if(t!==0)return t>0}return!1}var eu={amber:`bg-pending text-signal-ink-amber`,red:`bg-danger text-signal-ink`,violet:`bg-status-running text-signal-ink`,green:`bg-success text-signal-ink`};function tu(e,t,n){return e>9&&!(n&&t>1)?22:t===1?18:14}function nu({position:e,segments:t,className:n,compact:r=!1}){let i=t.filter(e=>e.count>0);return i.length===0?null:(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`rail-pill-${e}`,className:c(`pointer-events-none absolute -right-[4px] box-border flex h-[17px] overflow-hidden rounded-[9px] border-2 border-background`,e===`top`?`-top-[6px]`:`top-[25px]`,n),children:i.map(({tone:e,count:t})=>(0,X.jsx)(`span`,{"data-segment":e,"data-count":t,style:{width:tu(t,i.length,r)},className:c(`flex items-center justify-center text-[10px] leading-[13px] font-bold tabular-nums`,eu[e]),children:t>9?`9+`:t},e))})}function ru(e){return{top:[{tone:`amber`,count:e?.needsYou??0},{tone:`red`,count:e?.failedUnread??0}],bottom:[{tone:`violet`,count:e?.inMotion??0},{tone:`green`,count:e?.finishedUnread??0}]}}var iu=`cez-theme`,au=`(prefers-color-scheme: light)`,ou=`dark`;function su(e){return e===`light`||e===`dark`||e===`system`?e:ou}function cu(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function lu(){try{return su(localStorage.getItem(iu))}catch{return ou}}function uu(e){try{localStorage.setItem(iu,e)}catch{}}function du(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(au).matches}function fu(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t}function pu(e){return`/cezarion-mark-${e}.svg`}function mu(e){let t=document.querySelector(`link[rel="icon"]`);t&&(t.href=pu(e))}function hu(e){let t=document.querySelector(`meta[name="theme-color"]`),n=getComputedStyle(e).getPropertyValue(`--card`).trim();t&&n&&(t.content=n)}var gu=Y.createContext(null);function _u({children:e}){let[t,n]=Y.useState(lu),[r,i]=Y.useState(du);Y.useEffect(()=>{let e=window.matchMedia?.(au);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=cu(t,r);Y.useLayoutEffect(()=>{fu(document.documentElement,a),mu(a),hu(document.documentElement)},[a]);let o=Y.useCallback(e=>{n(e),uu(e)},[]),s=Y.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,X.jsx)(gu.Provider,{value:s,children:e})}function vu(){let e=Y.useContext(gu);if(!e)throw Error(`Squawk: useTheme() must be called inside <ThemeProvider>`);return e}var yu={light:`dark`,dark:`system`,system:`light`},bu={light:`light`,dark:`dark`,system:`system`};function xu({className:e,showLabel:t=!1,labelClassName:n}){let{theme:r,setTheme:i}=vu(),a=yu[r],o=Ir;return(0,X.jsxs)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":r,title:`Theme: ${bu[r]}`,"aria-label":`Theme: ${bu[r]}. Switch to ${bu[a]}.`,onClick:()=>i(a),children:[(0,X.jsx)(o,{"aria-hidden":`true`}),t?(0,X.jsxs)(`span`,{className:n,children:[`Theme · `,r.charAt(0).toUpperCase()+r.slice(1)]}):null]})}function Su({...e}){return(0,X.jsx)(aa,{"data-slot":`sheet`,...e})}function Cu({...e}){return(0,X.jsx)(Qi,{"data-slot":`sheet-trigger`,...e})}function wu({...e}){return(0,X.jsx)(ta,{"data-slot":`sheet-close`,...e})}function Tu({...e}){return(0,X.jsx)(na,{"data-slot":`sheet-portal`,...e})}function Eu({className:e,...t}){return(0,X.jsx)(Zi,{"data-slot":`sheet-overlay`,className:c(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Du({className:e,children:t,side:n=`right`,showCloseButton:r=!0,overlayClassName:i,...a}){return(0,X.jsxs)(Tu,{children:[(0,X.jsx)(Eu,{className:i}),(0,X.jsxs)(ra,{"data-slot":`sheet-content`,className:c(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition-colors ease-in-out motion-safe:data-[state=closed]:animate-out data-[state=closed]:duration-300 motion-safe:data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 end-0 h-full w-3/4 border-s motion-safe:data-[state=closed]:slide-out-to-right motion-safe:data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 start-0 h-full w-3/4 border-e motion-safe:data-[state=closed]:slide-out-to-left motion-safe:data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 inset-bs-0 h-auto border-be motion-safe:data-[state=closed]:slide-out-to-top motion-safe:data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 inset-be-0 h-auto border-bs motion-safe:data-[state=closed]:slide-out-to-bottom motion-safe:data-[state=open]:slide-in-from-bottom`,e),...a,children:[t,r&&(0,X.jsxs)(ta,{className:`absolute inset-bs-4 end-4 rounded-sm opacity-70 ring-offset-background transition-opacity pointer-hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,X.jsx)(xr,{className:`size-4`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Ou({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`sheet-header`,className:c(`flex flex-col gap-1.5 p-4`,e),...t})}function ku({className:e,...t}){return(0,X.jsx)(ia,{"data-slot":`sheet-title`,className:c(`font-semibold text-foreground`,e),...t})}function Au({className:e,...t}){return(0,X.jsx)($i,{"data-slot":`sheet-description`,className:c(`text-sm text-muted-foreground`,e),...t})}function ju(e,t){if(!e?.signals)return null;let n=e.signals;return zl(e.projects.filter(e=>e.id!==t).map(e=>n.get(e.id)))}function Mu(e){let t=Rl(e??void 0).map(e=>e.text);return t.length>0?`Open projects. Elsewhere: ${t.join(`, `)}`:`Open projects`}function Nu({elsewhere:e}){if(!e)return null;let{top:t,bottom:n}=ru(e),r=`right-[2px] border-card`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(nu,{position:`top`,segments:t,compact:!0,className:c(r,`top-[3px]`)}),(0,X.jsx)(nu,{position:`bottom`,segments:n,compact:!0,className:c(r,`top-[24px]`)})]})}function Pu({version:e,latestVersion:t=null}){let{resolvedTheme:n}=vu(),r=!!(e&&t&&$l(t,e));return(0,X.jsxs)(`div`,{"data-slot":`drawer-identity`,className:`flex shrink-0 items-center gap-[12px] border-b border-border pt-[env(safe-area-inset-top)] pr-[14px] pb-[14px] pl-[18px]`,children:[(0,X.jsx)(`img`,{src:`/cezarion-mark-${n}.svg`,alt:``,"aria-hidden":`true`,className:`mt-[14px] size-[32px] rounded-lg`}),(0,X.jsx)(`span`,{"data-slot":`drawer-wordmark`,className:`mt-[14px] text-[18px] leading-none font-bold tracking-[-0.02em] text-foreground`,children:`Squawk`}),e?(0,X.jsxs)(`span`,{"data-slot":`drawer-version`,"data-update-available":r?`true`:void 0,title:r?`v${e} — update available: v${t}`:`v${e}`,className:`mt-[14px] min-w-0 truncate text-[11px] leading-none text-soft-foreground`,children:[r?(0,X.jsx)(q,{tone:`pending`,className:`mr-1 inline-block size-[5px] align-middle`}):null,`v`,e]}):null,(0,X.jsx)(wu,{asChild:!0,children:(0,X.jsx)(U,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`mt-[14px] ml-auto size-[44px] text-foreground`,children:(0,X.jsx)(xr,{className:`size-[19px]`,"aria-hidden":`true`})})})]})}function Fu({project:e,signal:t,known:n,current:r,onNavigate:i}){let{top:a,bottom:o}=ru(t),s=r?`border-sidebar-row-selected`:`border-sidebar`,l=`right-[-4px]`,u=(0,X.jsxs)(z,{to:Ea(e.id,`/`),onClick:i,"data-slot":`drawer-project`,"data-project-id":e.id,"aria-current":r?`page`:void 0,className:c(`flex h-[64px] min-w-0 items-center gap-[12px] rounded-[10px] px-[10px] text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r&&`flex-1 hover:bg-sidebar-row-selected`),children:[(0,X.jsxs)(`span`,{"aria-hidden":`true`,className:c(`relative flex size-[40px] shrink-0 items-center justify-center rounded-[10px] border text-[13px] leading-none font-semibold`,r?`border-soft-foreground bg-sidebar text-foreground`:`border-transparent bg-muted text-muted-foreground`),children:[Bl(e.name),(0,X.jsx)(nu,{position:`top`,segments:a,className:c(l,s)}),(0,X.jsx)(nu,{position:`bottom`,segments:o,className:c(l,s,`top-[29px]`)})]}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsx)(`span`,{className:`truncate text-[14.5px] leading-tight font-semibold`,children:e.name}),(0,X.jsx)(Ql,{signal:t,known:n,current:r,slot:`drawer-project-state`,className:`flex-wrap gap-x-[6px] text-[11.5px] leading-tight`})]}),r?(0,X.jsx)(_r,{"aria-hidden":`true`,className:`size-[16px] shrink-0 text-foreground`}):null]});return r?(0,X.jsxs)(`div`,{"data-slot":`drawer-project-current`,className:`flex items-center rounded-[10px] bg-sidebar-row-selected pr-[4px]`,children:[u,(0,X.jsx)(Yl,{projectId:e.id,onNavigate:i,triggerClassName:`size-[44px]`,align:`end`})]}):u}var Iu=`flex h-[48px] w-full items-center gap-[12px] rounded-[10px] px-[10px] text-[14.5px] font-normal text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring [&_svg]:size-[18px] [&_svg]:shrink-0 [&_svg]:text-soft-foreground`;function Lu({nav:e,currentProjectId:t,onNavigate:n}){return(0,X.jsxs)(`div`,{"data-slot":`drawer-projects`,className:`shrink-0`,children:[(0,X.jsx)(`div`,{className:`px-[18px] pt-[14px] pb-[6px] text-[12px] font-medium text-soft-foreground`,id:`drawer-projects-label`,children:`Projects`}),(0,X.jsx)(`div`,{role:`group`,"data-slot":`drawer-projects-group`,"aria-labelledby":`drawer-projects-label`,className:`flex flex-col gap-[2px] px-[8px] pb-[8px]`,children:e.projects.map(r=>(0,X.jsx)(Fu,{project:r,signal:e.signals?.get(r.id),known:e.signals!==null,current:r.id===t,onNavigate:n},r.id))}),(0,X.jsxs)(`div`,{"data-slot":`drawer-workspace`,className:`flex flex-col gap-[2px] border-t border-border px-[8px] py-[8px]`,children:[(0,X.jsxs)(z,{to:`/tasks`,onClick:n,"data-slot":`drawer-all-projects`,className:Iu,children:[(0,X.jsx)(Gr,{"aria-hidden":`true`}),`All projects · task overview`]}),(0,X.jsx)(Ol,{origin:`mobile`,icon:er,iconClassName:`size-[18px]`,label:`Add project`,triggerClassName:c(Iu,`h-[48px] justify-start p-0 px-[10px] text-foreground`)})]})]})}function Ru({onNavigate:e,tools:t}){let{theme:n,setTheme:r}=vu(),i=yu[n],a=n.charAt(0).toUpperCase()+n.slice(1);return(0,X.jsxs)(`div`,{"data-slot":`drawer-global`,className:`flex shrink-0 flex-col gap-[2px] border-t border-border px-[8px] pt-[8px] pb-[max(8px,env(safe-area-inset-bottom))]`,children:[t?(0,X.jsxs)(z,{to:`/tools`,onClick:e,"data-slot":`drawer-tools`,"aria-label":t.blocked?`Tools, needs setup`:void 0,"aria-describedby":t.blocked&&t.note?`drawer-tools-note`:void 0,className:c(Iu,t.note&&`h-auto min-h-[48px] py-[6px]`),children:[(0,X.jsxs)(`span`,{className:`relative flex shrink-0`,children:[(0,X.jsx)(yr,{"aria-hidden":`true`}),t.blocked?(0,X.jsx)(q,{tone:`pending`,"data-slot":`drawer-tools-dot`,className:`absolute -top-[2px] -right-[3px] ring-[1.5px] ring-sidebar`}):null]}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{children:`Tools`}),t.note?(0,X.jsx)(`span`,{id:`drawer-tools-note`,"data-slot":`drawer-tools-note`,className:`text-[11.5px] leading-tight text-soft-foreground`,children:t.note}):null]})]}):null,(0,X.jsxs)(z,{to:`/settings/global/appearance`,onClick:e,"data-slot":`drawer-global-settings`,className:Iu,children:[(0,X.jsx)(gr,{"aria-hidden":`true`}),`Global settings`]}),(0,X.jsxs)(`button`,{type:`button`,"data-slot":`theme-toggle`,"data-theme-pref":n,"aria-label":`Theme: ${n.toLowerCase()}. Switch to ${i}.`,onClick:()=>r(i),className:Iu,children:[(0,X.jsx)(Ir,{"aria-hidden":`true`}),`Theme · `,a]})]})}function zu(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function Bu(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function Vu(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||zu(e.target)&&!Bu(e.target))}function Hu(e,t){let n=Y.useRef(t);Y.useLayoutEffect(()=>{n.current=t}),Y.useEffect(()=>{let t=t=>{Vu(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function Uu(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||zu(e.target))}function Wu(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function Gu(e,t){let n=Y.useRef(t);Y.useLayoutEffect(()=>{n.current=t}),Y.useEffect(()=>{let t=t=>{Uu(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}var Ku=e(r(),1),qu=Y.createContext(null);function Ju(){return Y.useContext(qu)}function Yu({slot:e,children:t}){return(0,Ku.createPortal)(t,e)}var Xu=`(min-width: 768px)`;function Zu(){let[e,t]=Y.useState(()=>window.matchMedia?.(Xu).matches??!0);return Y.useEffect(()=>{let e=window.matchMedia?.(Xu);if(!e)return;let n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function Qu({delayDuration:e=0,...t}){return(0,X.jsx)(Qc,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function $u({...e}){return(0,X.jsx)($c,{"data-slot":`tooltip`,...e})}function ed({...e}){return(0,X.jsx)(el,{"data-slot":`tooltip-trigger`,...e})}function td({className:e,sideOffset:t=0,children:n,...r}){return(0,X.jsx)(tl,{children:(0,X.jsxs)(nl,{"data-slot":`tooltip-content`,sideOffset:t,className:c(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) motion-safe:animate-in rounded-md bg-contrast px-3 py-1.5 text-xs text-balance text-contrast-foreground fade-in-0 motion-safe:zoom-in-95 motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,X.jsx)(rl,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-contrast fill-contrast`})]})})}var nd=[`/git`,`/automations`,`/workflows`,`/reports`];function rd({items:e,activeTo:t,needsYou:n=!1,onNavigate:r}){let[i,a]=(0,Y.useState)(!1),o=(0,Y.useRef)(null),s=e.filter(e=>nd.includes(e.to)),l=e.filter(e=>!s.includes(e)),u=s.some(e=>e.to===t);return(0,X.jsx)(Qu,{children:(0,X.jsxs)(`nav`,{ref:o,"aria-label":`Main`,"data-slot":`view-tabs`,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;let t=Array.from(o.current?.querySelectorAll(`[data-view-tab]`)??[]),n=t.indexOf(document.activeElement);n<0||(e.preventDefault(),t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowRight`?1:-1)+t.length)%t.length]?.focus())},className:`flex shrink-0 items-center justify-between max-md:justify-start max-md:gap-1 max-md:overflow-x-auto border-b border-border px-3 pt-2.5 pb-2`,children:[l.map(e=>{let i=e.to===t,a=e.icon,o=e.to===`/`&&n&&!i;return(0,X.jsxs)($u,{children:[(0,X.jsx)(ed,{asChild:!0,children:(0,X.jsxs)(G,{to:e.to,onClick:r,"data-view-tab":!0,"aria-label":e.label,"aria-current":i?`page`:void 0,className:c(`relative flex h-[30px] min-w-0 items-center justify-center rounded-[7px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11`,i?`shrink-0 gap-1.5 bg-sidebar-row-selected px-[9px] text-[12px] font-semibold text-foreground`:`w-7 shrink-0`),children:[(0,X.jsxs)(`span`,{className:`relative`,children:[(0,X.jsx)(a,{className:`size-[15px] shrink-0`,"aria-hidden":`true`}),o?(0,X.jsx)(`span`,{"aria-label":`Tasks need you`,"data-slot":`nav-needs-you-dot`,className:`absolute -top-1 -right-1 size-[7px] rounded-full border-[1.5px] border-sidebar bg-pending-strong`}):null]}),i?(0,X.jsx)(`span`,{className:`truncate`,children:e.label}):null]})}),(0,X.jsx)(td,{side:`bottom`,sideOffset:6,style:{pointerEvents:`none`},children:e.label})]},e.to)}),s.length?(0,X.jsxs)(Gi,{open:i,onOpenChange:a,children:[(0,X.jsxs)($u,{children:[(0,X.jsx)(ed,{asChild:!0,children:(0,X.jsx)(Hi,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"data-view-tab":!0,"aria-label":`More views`,"data-active":u?`true`:void 0,className:c(`relative flex h-[30px] w-7 shrink-0 items-center justify-center rounded-[7px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11`,(i||u)&&`bg-sidebar-row-selected text-foreground`),children:(0,X.jsx)(ms,{className:`size-[15px]`,"aria-hidden":`true`})})})}),(0,X.jsx)(td,{side:`bottom`,sideOffset:6,style:{pointerEvents:`none`},children:`More views`})]}),(0,X.jsx)(Ui,{align:`end`,sideOffset:4,className:`w-48 rounded-[10px] border-border bg-sidebar p-[5px] shadow-[0_10px_28px_#00000047]`,children:s.map(e=>{let n=e.icon,i=e.to===t;return(0,X.jsx)(W,{asChild:!0,className:c(`h-8 max-md:min-h-11 gap-2.5 rounded-md px-[9px] text-[13px] text-foreground focus:bg-sidebar-row-hover`,i&&`bg-sidebar-row-selected font-medium`),children:(0,X.jsxs)(G,{to:e.to,onClick:r,"aria-current":i?`page`:void 0,children:[(0,X.jsx)(n,{className:`size-[15px] text-soft-foreground`}),e.label]})},e.to)})})]}):null]})})}var id=[{to:`/`,label:`Tasks`,icon:Qn,match:[`/`,`/tasks`],badge:`tasks-unread`},{to:`/activity`,label:`Activity`,icon:ns,match:[`/activity`]},{to:`/git`,label:`Git`,icon:Zn,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:ir,match:[`/github`],forge:!0},{to:`/automations`,label:`Automations`,icon:Pr,match:[`/automations`],automations:!0},{to:`/skills`,label:`Skills`,icon:zr,match:[`/skills`]},{to:`/workflows`,label:`Workflows`,icon:Vr,match:[`/workflows`]},{to:`/reports`,label:`Reports`,icon:_s,match:[`/reports`]},{to:`/settings`,label:`Settings`,icon:lr,match:[`/settings`]}];function ad({forge:e=!1,automations:t=!1}={}){return id.filter(n=>(!n.forge||e)&&(!n.automations||t))}function od(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function sd(e){let t=null;for(let n of id)for(let r of n.match)od(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function cd(e){let t=sd(e);return id.find(e=>e.to===t)??null}function ld(e){return/^\/tasks\/[^/]+(?:\/|$)/.test(Aa(e))}function ud(e,t){let n=Aa(e);return/^\/git\/?$/.test(n)?new URLSearchParams(t).get(`view`)===`repo`:n.startsWith(`/git/`)}var dd=[`/`,`/activity`,`/github`],fd=[`/git`,`/skills`,`/workflows`,`/reports`,`/settings`,`/automations`];function pd(e,t,n){let r=Aa(e),i=r===`/new`,a=ld(e);return{activeTo:i?`/new`:sd(r),current:cd(r),currentProjectId:Oa(e),newTask:i,pushed:a,showTabBar:!a&&!ud(e,t)&&!n,gitRepositoryView:r===`/git`&&new URLSearchParams(t).get(`view`)===`repo`}}var md=[{to:`/git`,label:`Git`},{to:`/skills`,label:`Skills`},{to:`/workflows`,label:`Workflows`},{to:`/reports`,label:`Reports`},{to:`/settings`,label:`Project settings`}],hd=[`/automations`],gd=`flex h-[50px] min-h-11 w-full items-center gap-[14px] rounded-[10px] px-[10px] text-[14.5px] text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-ring [&_svg]:size-[18px] [&_svg]:shrink-0 [&_svg]:text-muted-foreground`;function _d({open:e,onOpenChange:t,onCloseAutoFocus:n,projectName:r,items:i,activeTo:a}){let o=new Map(i.map(e=>[e.to,e])),s=md.flatMap(({to:e,label:t})=>{let n=o.get(e);return n?[{to:e,label:t,icon:n.icon}]:[]}),l=hd.flatMap(e=>{let t=o.get(e);return t?[{to:e,label:t.label,icon:t.icon}]:[]}),u=()=>t(!1),d=({to:e,label:t,icon:n})=>{let r=e===a;return(0,X.jsxs)(G,{to:e,onClick:u,"data-slot":`more-row`,"data-more-row":e,"aria-current":r?`page`:void 0,className:c(gd,r&&`bg-sidebar-row-selected hover:bg-sidebar-row-selected`),children:[(0,X.jsx)(n,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),(0,X.jsx)(Br,{"aria-hidden":`true`,className:`!size-[15px]`})]},e)};return(0,X.jsx)(Su,{open:e,onOpenChange:t,children:(0,X.jsxs)(Du,{side:`bottom`,"data-slot":`more-sheet`,showCloseButton:!1,onCloseAutoFocus:n,"aria-describedby":void 0,className:`gap-0 rounded-t-[20px] border-border bg-sidebar px-[14px] pt-[10px] pb-[max(14px,env(safe-area-inset-bottom))] md:hidden`,children:[(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`mx-auto mb-[14px] h-[5px] w-[36px] rounded-[3px] bg-border`}),(0,X.jsxs)(`div`,{className:`flex items-baseline gap-[10px] px-[10px] pb-[6px]`,children:[(0,X.jsx)(ku,{className:`text-[17px] leading-tight font-bold`,children:`More`}),r?(0,X.jsx)(`span`,{"data-slot":`more-project`,className:`min-w-0 truncate text-[12.5px] text-soft-foreground`,children:r}):null]}),(0,X.jsx)(`div`,{className:`flex flex-col gap-[2px]`,children:s.map(d)}),l.length>0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{role:`separator`,className:`mx-[10px] mt-[8px] border-t border-border`}),(0,X.jsx)(`div`,{className:`px-[10px] pt-[12px] pb-[4px] text-[12px] font-medium text-soft-foreground`,children:`Shown when their flag is on`}),(0,X.jsx)(`div`,{className:`flex flex-col gap-[2px]`,children:l.map(d)})]}):null]})})}var vd=`(min-width: 768px)`;function yd({items:e,activeTo:t,signal:n,projectName:r,showNewTask:i=!0}){let[a,o]=Y.useState(!1),s=Y.useRef(null),{pathname:l}=gn();Y.useEffect(()=>{o(!1)},[l]),Y.useEffect(()=>{let e=window.matchMedia?.(vd);if(!e)return;e.matches&&o(!1);let t=e=>{e.matches&&o(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let u=e.filter(e=>dd.includes(e.to)),d=t!==null&&fd.includes(t),{top:f}=ru(n),p=f.some(e=>e.count>0),m=e=>c(`relative flex h-full min-h-11 min-w-11 flex-1 flex-col items-center justify-center gap-[3px] text-[10.5px] leading-none focus-visible:outline-2 focus-visible:outline-ring`,e?`font-semibold text-foreground`:`font-medium text-soft-foreground`);return(0,X.jsxs)(X.Fragment,{children:[i?(0,X.jsxs)(G,{to:`/new`,"data-slot":`mobile-new-task`,className:`group-has-[[data-new-task-action]]/shell:hidden absolute right-4 bottom-full z-30 mb-4 flex h-12 items-center gap-2 rounded-[24px] bg-foreground px-[18px] text-[14px] font-semibold text-background shadow-[0_8px_24px_#00000055] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,X.jsx)(ar,{"aria-hidden":`true`,className:`size-[18px]`}),`New task`]}):null,(0,X.jsxs)(`nav`,{"aria-label":`Views`,"data-slot":`mobile-tab-bar`,className:`flex h-[54px] items-stretch`,children:[u.map(e=>{let n=e.to===t,r=e.icon,i=e.to===`/`&&p;return(0,X.jsxs)(G,{to:e.to,"data-tab":e.to,"aria-current":n?`page`:void 0,className:m(n),children:[(0,X.jsxs)(`span`,{className:`relative`,children:[(0,X.jsx)(r,{"aria-hidden":`true`,className:`size-[21px]`}),i?(0,X.jsx)(nu,{position:`top`,segments:f,className:`-top-[6px] -right-[10px] border-sidebar`}):null]}),e.label]},e.to)}),(0,X.jsxs)(`button`,{ref:s,type:`button`,"data-tab":`more`,"aria-haspopup":`dialog`,"aria-expanded":a,"data-active":d?`true`:void 0,onClick:()=>o(!0),className:m(d),children:[(0,X.jsx)(`span`,{className:`relative`,children:(0,X.jsx)(Ur,{"aria-hidden":`true`,className:`size-[21px]`})}),`More`]})]}),(0,X.jsx)(_d,{open:a,onOpenChange:o,onCloseAutoFocus:e=>{s.current?.isConnected&&(e.preventDefault(),s.current.focus())},projectName:r,items:e,activeTo:t})]})}var bd=`(min-width: 768px)`;function xd(e){return bn({path:`/tasks/:id`,end:!0},Aa(e))!==null}function Sd(e){let t=Aa(e);return t===`/github`||t.startsWith(`/github/`)}function Cd({children:e,breadcrumb:t,repo:n=null,version:r=null,latestVersion:i=null,sidebarList:a,taskQuickList:o,sessionScope:s,toolsMenu:l,forgeAvailable:u=!0,automationsAvailable:d=!0,banner:f,mobileProjects:p,projectHeader:m,sidebarProjectId:h,needsYou:g,projectRail:_,toolsStatus:v}){let{pathname:y,search:b}=gn(),{activeTo:x,current:S,currentProjectId:C,newTask:w,pushed:T,showTabBar:E,gitRepositoryView:D}=pd(y,b,ma()),[O,k]=Y.useState(!1),[A,j]=Y.useState(null),M=Y.useRef(null),ee=Y.useRef(null),te=Y.useRef(null),ne=xd(y);Y.useLayoutEffect(()=>{let e=te.current;if(te.current=y,ne||e!==null&&Oa(e)===Oa(y)&&Sd(e)&&Sd(y))return;let t=ee.current;t&&(t.scrollTop=0)},[y,ne,D]);let re=xn(),ie=Y.useRef(y);Y.useEffect(()=>{let e=ie.current;ie.current=y,e!==y&&(re===`REPLACE`&&Ad(e,y)||k(!1))},[y,re]),Y.useEffect(()=>{let e=window.matchMedia?.(bd);if(!e)return;e.matches&&k(!1);let t=e=>{e.matches&&k(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let N=ad({forge:u,automations:d}),P={version:r,latestVersion:i};return(0,X.jsx)(Su,{open:O,onOpenChange:k,children:(0,X.jsxs)(`div`,{"data-slot":`app-shell`,className:`flex h-dvh overflow-hidden bg-background text-foreground pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)]`,children:[(0,X.jsx)(Ed,{projectRail:_,activeTo:x,items:N,repo:n,release:P,sidebarList:a,taskQuickList:o,sessionScope:s,toolsMenu:l,projectHeader:m,sidebarProjectId:h,needsYou:g}),(0,X.jsx)(kd,{release:P,taskQuickList:o,sidebarProjectId:h,mobileProjects:p,currentProjectId:C,toolsStatus:v,onNavigate:()=>k(!1),onCloseAutoFocus:e=>{M.current?.isConnected&&(e.preventDefault(),M.current.focus())}}),(0,X.jsxs)(`div`,{className:`group/shell grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,children:[(0,X.jsx)(Id,{title:S?.label??`Squawk`,pushed:T?{onSlot:j}:null,repo:n,elsewhere:ju(p,C),onTrigger:e=>{M.current=e}}),(0,X.jsx)(wd,{breadcrumb:t,repo:n,label:S?.label,newTask:w}),f?(0,X.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:f}):null,(0,X.jsx)(`main`,{ref:ee,"data-slot":`main`,className:c(`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,E&&!w&&`max-md:pb-20`),children:(0,X.jsx)(qu.Provider,{value:T?A:null,children:e})}),(0,X.jsx)(Td,{showTabBar:E,items:N,activeTo:x,mobileProjects:p,currentProjectId:C,repo:n,newTask:w})]})]})})}function wd({breadcrumb:e,repo:t,label:n,newTask:r}){let i=e?.project??t?.name,a=e?.branch??t?.branch;return(0,X.jsxs)(`header`,{"data-slot":`desktop-breadcrumb`,className:c(`row-start-1 hidden min-w-0 items-center gap-3 border-b border-border text-[13px] text-muted-foreground md:flex`,r?`h-[72px] px-11`:`h-16 px-9`),children:[(0,X.jsx)(dr,{"aria-hidden":`true`,className:`size-4 shrink-0`}),i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:i}),(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`/`})]}):null,(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e?.page??n??`Squawk`}),a?(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 text-[11px]`,children:[(0,X.jsx)(Xn,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),a]}):null]})}function Td({showTabBar:e,items:t,activeTo:n,mobileProjects:r,currentProjectId:i,repo:a,newTask:o}){let s=i===null?void 0:r?.signals?.get(i);return(0,X.jsx)(`div`,{"data-slot":`composer`,className:c(`row-start-4 pb-[max(env(safe-area-inset-bottom),var(--kb,0px))]`,e&&`relative max-md:border-t max-md:border-border max-md:bg-sidebar`),children:e?(0,X.jsx)(`div`,{className:`md:hidden`,children:(0,X.jsx)(yd,{items:t,activeTo:n,signal:s,projectName:r?.projects.find(e=>e.id===i)?.name??a?.name??null,showNewTask:!o})}):null})}function Ed({projectRail:e,...t}){let[n,r]=Y.useState(Is),i=Y.useCallback(e=>{let t=Fs(e);r(t),Ls(t)},[]);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Rs.Provider,{value:n,children:e}),(0,X.jsx)(Dd,{...t,width:n,onWidthChange:i})]})}function Dd({width:e,onWidthChange:t,...n}){return(0,X.jsxs)(`aside`,{"data-slot":`sidebar`,style:{width:e},className:`relative hidden shrink-0 flex-col border-r border-border bg-sidebar md:flex`,children:[(0,X.jsx)(Md,{...n}),(0,X.jsx)(Od,{width:e,onWidthChange:t})]})}function Od({width:e,onWidthChange:t}){let n=Y.useRef(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(Fs(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,X.jsx)(`div`,{"data-slot":`sidebar-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the sidebar`,"aria-valuenow":e,"aria-valuemin":264,"aria-valuemax":420,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?264:n.key===`End`?420:null;r!==null&&(n.preventDefault(),t(Fs(r)))},onDoubleClick:()=>t(264),title:`Drag to resize the sidebar — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-[var(--composer-border)] focus-visible:bg-[var(--composer-border)] focus-visible:outline-none`})}function kd({onNavigate:e,onCloseAutoFocus:t,mobileProjects:n,currentProjectId:r,toolsStatus:i,release:a,taskQuickList:o,sidebarProjectId:s}){return(0,X.jsxs)(Du,{side:`left`,"data-slot":`mobile-nav-drawer`,onCloseAutoFocus:t,overlayClassName:`bg-[var(--nav-scrim)]`,showCloseButton:!1,className:`w-[calc(100%-68px)] max-w-[334px] gap-0 border-border bg-sidebar p-0 sm:max-w-[334px] md:hidden`,"aria-describedby":void 0,children:[(0,X.jsx)(ku,{className:`sr-only`,children:`Navigation`}),(0,X.jsx)(Pu,{version:a.version,latestVersion:a.latestVersion}),(0,X.jsxs)(`div`,{"data-slot":`drawer-scroll`,className:`flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,children:[n?(0,X.jsx)(Lu,{nav:n,currentProjectId:r,onNavigate:e}):null,o?(0,X.jsx)(jd,{projectId:s,onNavigate:e,children:(0,X.jsx)(`div`,{"data-slot":`drawer-tasks`,className:`border-t border-border px-[8px] py-[8px]`,children:o})}):null]}),(0,X.jsx)(Ru,{onNavigate:e,tools:i})]})}function Ad(e,t){return Oa(e)==="default"&&Oa(t)!==null&&Oa(t)!=="default"&&Aa(e)===Aa(t)}function jd({projectId:e,onNavigate:t,children:n}){let r=He(),i=e===void 0?r:{projectId:e,apiBase:`${o}/p/${encodeURIComponent(e)}`};return(0,X.jsx)(Ge.Provider,{value:i,children:(0,X.jsx)(zs.Provider,{value:t,children:n})})}function Md({activeTo:e,items:t,repo:n,release:r,sidebarList:i,taskQuickList:a,sessionScope:o,toolsMenu:s,projectHeader:l,sidebarProjectId:u,needsYou:d,onNavigate:f}){return(0,X.jsx)(jd,{projectId:u,onNavigate:f,children:(0,X.jsxs)(`div`,{"data-slot":`sidebar-content`,className:`@container/sidebar flex min-h-0 flex-1 flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,X.jsx)(`div`,{"data-slot":`sidebar-header`,className:`shrink-0`,children:l??(n?(0,X.jsxs)(`div`,{className:`px-[14px] pt-[14px] pb-2.5`,children:[(0,X.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:n.name}),(0,X.jsx)(`div`,{className:`truncate font-mono text-[10.5px] text-soft-foreground`,children:n.branch})]}):null)}),(0,X.jsxs)(`div`,{"data-slot":`sidebar-actions`,className:`flex flex-col gap-2 px-3`,children:[(0,X.jsx)(Pd,{}),(0,X.jsx)(U,{asChild:!0,variant:`ghost`,className:c(`relative h-[32px] max-md:min-h-11 rounded-[7px] bg-muted w-full min-w-0 justify-start gap-2 px-2.5 text-[12.5px] font-medium text-foreground hover:bg-sidebar-row-hover hover:text-foreground`,e===`/new`&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:(0,X.jsxs)(G,{to:`/new`,onClick:f,"data-sidebar-item":`new-task`,"aria-current":e===`/new`?`page`:void 0,children:[(0,X.jsx)(ar,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`sr-only`,children:`C`})]})})]}),o?(0,X.jsx)(`div`,{className:`shrink-0 px-3 pt-2`,children:o}):null,(0,X.jsx)(rd,{items:t,activeTo:e,needsYou:d,onNavigate:f}),(0,X.jsx)(`div`,{"data-slot":`project-task-navigation`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-3`,children:(0,X.jsx)(zs.Provider,{value:f,children:i??(0,X.jsx)(`div`,{"data-slot":`task-quick-list`,children:a})})}),(0,X.jsx)(Nd,{toolsMenu:s,release:r})]})})}function Nd({toolsMenu:e,release:t}){return(0,X.jsx)(`div`,{"data-slot":`sidebar-footer`,className:`shrink-0`,children:(0,X.jsxs)(`div`,{"data-slot":`sidebar-footer-controls`,className:`flex h-11 items-center justify-between gap-1 border-t border-border px-3`,children:[(0,X.jsx)(`div`,{"data-slot":`tools-menu`,className:`shrink-0`,children:e}),(0,X.jsx)(`div`,{className:`flex min-w-0 items-center gap-1`,"data-slot":`version-action`,children:t.version?(0,X.jsx)(Fd,{version:t.version,latestVersion:t.latestVersion}):null})]})})}function Pd(){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search — command palette (⌘K / Ctrl+K)`,onClick:()=>Ns(),className:`flex h-[32px] max-md:min-h-11 w-full items-center gap-2 rounded-[7px] border border-border bg-background px-2.5 text-left text-[12.5px] font-normal text-soft-foreground transition-colors hover:border-border hover:text-foreground`,children:[(0,X.jsx)(hr,{className:`size-[14px] shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate`,children:`Search…`}),(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`ml-auto shrink-0 font-sans text-[11px] font-normal text-soft-foreground`,children:Wu(`k`)})]})}function Fd({version:e,latestVersion:t}){let n=!!(t&&$l(t,e));return(0,X.jsxs)(`span`,{"data-slot":`version-chip`,"data-update-available":n?`true`:void 0,title:n?`v${e} — update available: v${t}`:`v${e}`,className:`flex min-w-0 items-center gap-1 font-mono text-[11px] text-soft-foreground`,children:[n?(0,X.jsx)(q,{tone:`pending`,className:`size-[5px] shrink-0`}):null,(0,X.jsxs)(`span`,{className:`truncate`,children:[`v`,e]})]})}function Id({title:e,pushed:t,repo:n,elsewhere:r,onTrigger:i}){return t?(0,X.jsx)(Ld,{onSlot:t.onSlot}):(0,X.jsx)(`header`,{"data-slot":`mobile-top-bar`,className:`row-start-1 min-w-0 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,X.jsxs)(`div`,{className:`flex h-[56px] min-w-0 items-center gap-[8px] px-[8px]`,children:[(0,X.jsx)(Cu,{asChild:!0,children:(0,X.jsxs)(U,{variant:`ghost`,"aria-label":Mu(r),onClick:e=>i(e.currentTarget),className:`relative h-[44px] w-[64px] shrink-0 justify-start rounded-md p-0 pl-[10px] text-foreground`,children:[(0,X.jsx)(pr,{className:`size-[20px]`,"aria-hidden":`true`}),(0,X.jsx)(Nu,{elsewhere:r})]})}),n?(0,X.jsx)(Cu,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`mobile-project-picker`,"aria-label":`Switch project: ${n.name}`,onClick:e=>i(e.currentTarget),className:`flex h-[44px] min-w-0 flex-1 items-center justify-start gap-[10px] rounded-md text-left focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-[28px] shrink-0 items-center justify-center rounded-[8px] border border-soft-foreground bg-sidebar-row-selected text-[11px] leading-none font-semibold text-foreground`,children:Bl(n.name)}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,children:n.name}),n.branch?(0,X.jsx)(`span`,{className:`truncate font-mono text-[10.5px] leading-tight text-soft-foreground`,children:n.branch}):null]}),(0,X.jsx)(Or,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`})]})}):null,e===`Squawk`?n?null:(0,X.jsx)(`span`,{className:`flex-1`}):(0,X.jsx)(`span`,{"data-slot":`mobile-route-title`,className:c(`truncate text-[15px] font-semibold text-foreground`,n?`sr-only`:`min-w-0 flex-1 pl-[8px]`),children:e}),(0,X.jsx)(U,{variant:`ghost`,"aria-label":`Search`,"data-slot":`mobile-search`,onClick:()=>Ns(),className:`ml-auto size-[44px] shrink-0 p-0 text-foreground`,children:(0,X.jsx)(hr,{className:`size-[19px]`,"aria-hidden":`true`})})]})})}function Ld({onSlot:e}){let t=Da();return(0,X.jsx)(`header`,{"data-slot":`mobile-top-bar`,"data-mode":`task`,className:`row-start-1 min-w-0 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,X.jsxs)(`div`,{className:`flex h-[56px] min-w-0 items-center gap-[4px] px-[8px]`,children:[(0,X.jsx)(U,{variant:`ghost`,"aria-label":`Back`,"data-slot":`mobile-back`,onClick:()=>{let e=window.history.state?.idx;t(typeof e==`number`&&e>0?-1:`/`)},className:`size-[44px] shrink-0 p-0 text-foreground`,children:(0,X.jsx)(os,{className:`size-[22px]`,"aria-hidden":`true`})}),(0,X.jsx)(`div`,{"data-slot":`mobile-run-bar`,ref:e,className:`flex min-w-0 flex-1 items-center gap-[4px]`})]})})}function Rd(e,t){let n=typeof e==`string`?new URLSearchParams(e):e,r=n.get(`runner`),i=r!==null&&(t?.runners.some(e=>e.id===r)??!1),a=n.get(`skillPath`);return{skill:(n.get(`skill`)??``).trim(),...a?{skillPath:a}:{},...i?{runner:r}:{},...n.has(`account`)?{account:n.get(`account`)}:{},ref:(n.get(`ref`)??n.get(`task`)??``).trim()}}function zd(e){let t=new URLSearchParams;e.skill&&t.set(`skill`,e.skill),e.skillPath!==void 0&&t.set(`skillPath`,e.skillPath),e.runner&&t.set(`runner`,e.runner),e.account!==void 0&&t.set(`account`,e.account),e.ref&&t.set(`ref`,e.ref);let n=t.toString();return n?`/new?${n}`:`/new`}var Bd=`cez-last-location`;function Vd(){try{let e=localStorage.getItem(Bd);return e===null?null:JSON.parse(e)}catch{return null}}function Hd(e){try{localStorage.setItem(Bd,JSON.stringify(e))}catch{}}var Ud=new Set([`projectId`,`pathname`,`search`,`hash`]);function Wd(e){return typeof e!=`string`||e.length<1||e.length>64?null:e}function Gd(e){return typeof e!=`string`||e.length<1||e.length>2048||!e.startsWith(`/p/`)?null:e}function Kd(e){return e!==void 0&&(typeof e!=`string`||e.length>4096||!e.startsWith(`?`))?null:e}function qd(e){return e!==void 0&&(typeof e!=`string`||e.length>2048||!e.startsWith(`#`))?null:e}function Jd(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(Object.keys(t).some(e=>!Ud.has(e)))return null;let n=Wd(t.projectId);if(n===null)return null;let r=Gd(t.pathname);if(r===null)return null;let i=Kd(t.search);if(i===null)return null;let a=qd(t.hash);if(a===null)return null;try{if(Oa(r)!==n)return null}catch{return null}return{projectId:n,pathname:r,...i===void 0?{}:{search:i},...a===void 0?{}:{hash:a}}}function Yd(e,t){let n=t.projects.find(t=>t.id===e);return n!==void 0&&n.status!==`missing`}function Xd(e,t){if(t===void 0)return null;let n;try{n=Oa(e.pathname)}catch{return null}return n===null||!Yd(n,t)?null:Jd({projectId:n,pathname:e.pathname,...e.search===``?{}:{search:e.search},...e.hash===``?{}:{hash:e.hash}})}function Zd(e,t,n){let r=Jd(e);return r===null||!(t===void 0?n!==void 0&&r.projectId===n:Yd(r.projectId,t))?null:`${r.pathname}${r.search??``}${r.hash??``}`}function Qd(e,t){let n=Jd(e);return n!==null&&n.projectId===t.projectId&&n.pathname===t.pathname&&(n.search??``)===(t.search??``)&&(n.hash??``)===(t.hash??``)}var $d=`cez-project-locations`;function ef(){try{let e=localStorage.getItem($d),t=e===null?null:JSON.parse(e);return typeof t==`object`&&t&&!Array.isArray(t)?t:{}}catch{return{}}}function tf(e){let t=ef()[e];return t===void 0?null:t}function nf(e){try{localStorage.setItem($d,JSON.stringify({...ef(),[e.projectId]:e}))}catch{}}function rf(e,t,n){let r=Jd(t);return r===null||r.projectId!==e||n===void 0||!Yd(e,n)?null:`${r.pathname}${r.search??``}${r.hash??``}`}var af=2500,of=e=>String(Ea(e,`/`));function sf(e,t,n){let r={href:of(e),verify:!1},i=rf(e,t,n.registry);if(i===null)return r;try{let e=i.replace(/[?#].*$/,``),t=n.matchRoute(e);return t===null?r:{href:i,verify:Object.keys(t.params).some(e=>e!==`projectId`)}}catch{return r}}var cf=e=>Be(rn(e.params.id??``,{projectId:e.opts.projectId}),{signal:e.opts.signal});function lf(e){let t=Number(e);return Number.isSafeInteger(t)&&t>=1?t:null}async function uf(e,t,n){let r=await re(e,t,{},n.opts);return r.available?r.item!==null:null}var df=async e=>(await cf(e),!0),ff=async e=>(await cf(e),await Ae(e.params.id??``,e.params.sha??``,e.opts),!0);async function pf(e,t){let n=await cf(e),r=lf(e.params.n);return r===null?!1:Vn(n,e.repoBase).some(e=>e.kind===t&&e.number===r)?uf(t,r,e):e.repoBase===void 0&&null}var mf=async e=>(await Ee(e.params.sha??``,e.opts),!0);async function hf(e,t){let n=lf(e.params.n);return n!==null&&uf(t,n,e)}var gf=[{matches:e=>e===`/tasks/:id/commits/:sha`,check:ff},{matches:e=>e===`/tasks/:id/issue/:n`,check:e=>pf(e,`issue`)},{matches:e=>e===`/tasks/:id/pr/:n`,check:e=>pf(e,`pr`)},{matches:e=>e.startsWith(`/tasks/:id`),check:df},{matches:e=>e===`/git/commits/:sha`,check:mf},{matches:e=>e===`/github/issues/:n`,check:e=>hf(e,`issue`)},{matches:e=>e.startsWith(`/github/prs/:n`),check:e=>hf(e,`pr`)},{matches:e=>e===`/workflows/:name`,check:async e=>{let{workflows:t,issues:n}=await y(e.opts);return t.some(t=>t.name===e.params.name)?!0:n.length>0&&null}},{matches:e=>e.startsWith(`/automations/:automationId`),check:async e=>{let t=await me(e.opts);return t.available?t.automations.some(t=>t.id===e.params.automationId):null}}];async function _f(e,t,n,r,i){let a=``;try{let o=i(t);if(o===null)return!1;a=o.pattern;let s=gf.find(e=>e.matches(o.pattern));return s===void 0?null:await s.check({projectId:e,pattern:a,params:o.params,repoBase:r,opts:{projectId:e,signal:n}})}catch(e){return!yf(e,a)&&null}}var vf=/unknown revision|bad object|bad revision|unknown commit|not a commit hash|needed a single revision/i;function yf(e,t){return e instanceof je?e.status===404||(t===`/git/commits/:sha`||t===`/tasks/:id/commits/:sha`)&&e.status===409&&vf.test(e.message):!1}async function bf(e,t,n){let r=sf(e,t,n);if(!r.verify)return r.href;let i=new AbortController,a=setTimeout(()=>i.abort(),af);try{return await _f(e,r.href.replace(/[?#].*$/,``),i.signal,n.repoBaseOf?.(e),n.matchRoute)===!1?of(e):r.href}finally{clearTimeout(a)}}var xf={key:``,navigate:null,ticket:0};function Sf(e,t){e!==xf.key&&xf.ticket++,xf.key=e,xf.navigate=t}function Cf(){xf.ticket++}async function wf(e,t,n){let r=++xf.ticket,i=xf.key,a=await bf(e,t,n);r===xf.ticket&&i===xf.key&&xf.navigate?.(a)}function Tf(){let e=Sn(),t=gn();Y.useLayoutEffect(()=>{Sf(`${t.key}|${t.pathname}${t.search}${t.hash}`,e)},[e,t.key,t.pathname,t.search,t.hash])}function Ef(){let e=Y.useContext(es);if(e===null)throw Error(`useProjectSwitch needs a ProjectRouteMatcherContext provider (App provides matchProjectRoute)`);let t=tn().data,n=St().data,r=Y.useCallback(e=>t?.projects.find(t=>t.id===e)?.repoUrl??(e===(n?.bootProject??t?.bootProject)?nn(n?.repo?.remote):void 0),[t,n]);Tf();let{pathname:i,search:a,hash:o}=gn(),s=Oa(i),c=`${i}${a}${o}`;return{target:Y.useCallback(n=>n===s?{href:c,verify:!1}:sf(n,tf(n),{registry:t,matchRoute:e}),[t,e,s,c]),go:Y.useCallback(async n=>{if(n===s)return Cf();await wf(n,tf(n),{registry:t,repoBaseOf:r,matchRoute:e})},[t,r,e,s])}}function Df(e){return e?.capabilities?.automations===!0}function Of(){let e=St().data,t=(0,Y.useRef)(void 0);(0,Y.useEffect)(()=>{e&&(t.current=e)},[e]);let n=e??t.current;return n?Df(n)?`available`:`unavailable`:`unknown`}function kf(){return Of()===`available`}function Af(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function jf(){let e=F(),t=Jt(),n=Y.useRef(0),r=Y.useRef(Promise.resolve()),i=Y.useMemo(()=>mo(t.data?.sidebar?.projectOrder),[t.data?.sidebar?.projectOrder]),a=Y.useCallback(t=>{let i=e.getQueryData(L.uiState);if(i===void 0)return;let{projectOrder:a,...o}=Af(i.sidebar),s=t===null?o:{...o,projectOrder:t};e.setQueryData(L.uiState,{...i,sidebar:s});let c=++n.current,l=r.current.then(async()=>{let t=await _e({sidebar:s},{keepalive:!0});c===n.current&&e.setQueryData(L.uiState,t)});r.current=l.catch(t=>{V(t instanceof Error?t.message:String(t),{tone:`danger`}),c===n.current&&e.invalidateQueries({queryKey:L.uiState})})},[e]),o=Y.useCallback(e=>{let t=mo(e);t.length===0||!ho(e.length)||a(t)},[a]),s=Y.useCallback(()=>a(null),[a]);return{order:i,canReorder:t.data!==void 0,setOrder:o,reset:s}}function Mf(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function Nf(e,t,n){let r=t.trim().toLowerCase();if(r===``)return 1;let i=(n?.length?`${e} ${n.join(` `)}`:e).toLowerCase(),a=r.split(/\s+/),o=0;for(let e of a){let t=i.indexOf(e);if(t===-1)return 0;let n=t===0||!/[a-z0-9]/.test(i[t-1]??``);o+=(n?1:.5)/(1+t/48)}return o/a.length}function Pf(e,t){if(t.trim()===``)return e;let n=e=>e.rows.reduce((e,n)=>Math.max(e,Nf(n.value,t,n.keywords)),0);return e.map(e=>({group:e,score:n(e)})).sort((e,t)=>t.score-e.score).map(({group:e})=>e)}function Ff(e,t){return{value:`task ${K(e)} ${e.id}`,keywords:[...t?[t]:[],...Hf(e),...[e.branch,e.workflow,e.workflowLabel,e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl].filter(e=>!!e)]}}var If=e=>({value:`view ${e}`}),Lf=e=>({value:`project ${e.name} ${e.id}`,keywords:[e.root]}),Rf=e=>({value:`skill ${e.id} ${e.name} ${e.path??``}`,...s({keywords:e.description?[e.description]:void 0})}),zf={value:`action toggle theme`},Bf=150;function Vf(e,t,n,r=[]){let i=Mf(e.filter(e=>!Ya(e))).map(e=>({...e,projectId:t})),a=new Set(i.map(Uf)),o=[...n??[],...r].filter(e=>Ya(e)||a.has(Uf(e))?!1:(a.add(Uf(e)),!0)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return[...i,...o]}function Hf(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?/\/(\d+)\/?$/.exec(n):null;e&&t.add(Number(e[1]))}for(let n of[e.prNumber,e.issueNumber,e.markerRefs?.pr,e.markerRefs?.issue])typeof n==`number`&&Number.isInteger(n)&&n>0&&t.add(n);return[...t].flatMap(e=>[String(e),`#${e}`])}var Uf=e=>`${e.projectId??``}/${e.id}`;function Wf(e){let t=e.filter(e=>no(e)).sort((e,t)=>(t.finishedAt??``).localeCompare(e.finishedAt??``)),n=new Set(t.map(Uf));return{recentlyFinished:t,otherTasks:e.filter(e=>!n.has(Uf(e)))}}function Gf(e,t,n=[]){let r=po(e,n);return[...r.filter(e=>e.id!==t),...r.filter(e=>e.id===t)]}function Kf(){let[e,t]=Y.useState(!1),n=Da();Hu(`k`,()=>t(e=>!e));let r=Y.useCallback(()=>{t(!1),n(`/new`)},[n]);return Hu(`n`,r),Gu(`c`,r),Y.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(Ms,e),()=>window.removeEventListener(Ms,e)},[]),(0,X.jsx)(so,{open:e,onOpenChange:t,title:`Command palette`,description:`Search projects, tasks, views, actions, and skills`,showCloseButton:!1,filter:Nf,className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,X.jsx)(ep,{close:()=>t(!1)})})}function qf({heading:e,tasks:t,projectName:n,showProject:r,now:i,onSelect:a}){return(0,X.jsx)(J,{heading:e,children:t.map(e=>(0,X.jsx)(Jf,{task:e,projectName:n(e),showProject:r,now:i,onSelect:a},Uf(e)))})}function Jf({task:e,projectName:t,showProject:n,now:r,onSelect:i}){let a=Ne(e),o=K(e);return(0,X.jsxs)(co,{...Ff(e,t),"data-slot":`palette-task`,"data-run-id":e.id,"data-project-id":e.projectId??void 0,onSelect:()=>i(e),children:[(0,X.jsx)(q,{tone:a.tone,shape:a.shape,pulse:a.pulse,"aria-label":a.label,role:`img`}),e.delegation?.role===`worker`?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:o}),n&&t?(0,X.jsx)(`span`,{"data-slot":`palette-task-project`,className:`shrink-0 truncate text-xs text-soft-foreground`,children:t}):null,(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:_i(e.finishedAt??e.createdAt,r)})]})}function Yf({multiProject:e,health:t}){return[...e?[{label:`All tasks`,to:`/tasks`,icon:Gr,global:!0}]:[],...ad({forge:t.data?.forge?.available===!0,automations:Df(t.data)}).map(e=>({label:e.label,to:e.to,icon:e.icon,global:!1}))]}function Xf({views:e,go:t,goGlobal:n,orderedProjects:r,activeProjectId:i,goProject:a,otherTasks:o,searching:s,taskProjectName:c,showProjectOnTasks:l,now:u,selectTask:d,orderedSkills:f,skillRunner:p,theme:m,nextTheme:h,setTheme:g,close:_}){let v=[{rows:e.map(e=>If(e.label)),node:(0,X.jsx)(J,{heading:`Views`,children:e.map(e=>{let r=e.icon;return(0,X.jsxs)(co,{...If(e.label),"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>e.global?n(e.to):t(e.to),children:[(0,X.jsx)(r,{"aria-hidden":`true`}),e.label]},e.to)})},`views`)}];return r.length>0&&v.push({rows:r.map(Lf),node:(0,X.jsx)(J,{heading:`Projects`,children:r.map(e=>{let t=e.id===i,n=e.status===`missing`;return(0,X.jsxs)(co,{...Lf(e),"data-slot":`palette-project`,"data-project-id":e.id,disabled:n,onSelect:()=>a(e.id),children:[(0,X.jsx)(tr,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),n?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-soft-foreground`,children:e.branch}),t?(0,X.jsx)(_r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.id)})},`projects`)}),o.length>0&&v.push({rows:s?o.map(e=>Ff(e,c(e))):[],node:(0,X.jsx)(qf,{heading:`Tasks`,tasks:o,projectName:c,showProject:l,now:u,onSelect:d},`tasks`)}),v.push({rows:[zf],node:(0,X.jsx)(J,{heading:`Actions`,children:(0,X.jsxs)(co,{...zf,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{g(h),_()},children:[(0,X.jsx)(Ir,{"aria-hidden":`true`}),`Toggle theme`,(0,X.jsxs)(oo,{className:`tracking-normal`,children:[m,` → `,h]})]})},`actions`)}),f.length>0&&v.push({rows:f.map(Rf),node:(0,X.jsx)(J,{heading:`Skills`,children:f.map(e=>(0,X.jsxs)(co,{...Rf(e),"data-slot":`palette-skill`,"data-skill":e.id,onSelect:()=>t(zd({skill:e.id,skillPath:e.path,runner:p})),children:[(0,X.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.path?(0,X.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},JSON.stringify([e.id,e.path])))},`skills`)}),v}function Zf({search:e,setSearch:t}){return(0,X.jsx)(io,{placeholder:`Search projects, tasks, views, actions, skills…`,value:e,onValueChange:t})}function Qf({search:e,searching:t,recentlyFinished:n,groups:r,taskProjectName:i,showProjectOnTasks:a,now:o,selectTask:s,go:c}){return(0,X.jsxs)(uo,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:[(0,X.jsx)(lo,{children:`Nothing matches.`}),(0,X.jsx)(J,{children:(0,X.jsxs)(co,{value:`new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>c(`/new`),children:[(0,X.jsx)(ar,{"aria-hidden":`true`}),`New task`,(0,X.jsx)(oo,{children:`C`})]})}),!t&&n.length>0?(0,X.jsx)(qf,{heading:`Recently finished`,tasks:n,projectName:i,showProject:a,now:o,onSelect:s}):null,Pf(r,e).map(e=>e.node)]})}function $f({cappedProjects:e}){return e.length===0?null:(0,X.jsxs)(`p`,{"data-slot":`palette-search-truncated`,role:`status`,className:`border-t border-border px-3 py-2 text-[11px] text-soft-foreground`,children:[`More matches in `,e.join(`, `),`. Type more to narrow them.`]})}function ep({close:e}){let t=Da(),n=Sn(),[r,i]=Y.useState(``),a=r.trim()!==``,o=Ma(),{theme:s,setTheme:c}=vu(),l=ln(),u=Tt(),d=tn(),f=Ot(),p=St(),m=Date.now(),h=d.data,g=h!==void 0&&h.projects.length>1,_=un(g),{order:v}=jf(),y=Y.useMemo(()=>g?Gf(h.projects,o,v):[],[g,h,o,v]),b=Y.useMemo(()=>new Map((h?.projects??[]).map(e=>[e.id,e.name])),[h]),x=o??h?.bootProject??null,[S,C]=Y.useState(``);Y.useEffect(()=>{let e=setTimeout(()=>C(r),Bf);return()=>clearTimeout(e)},[r]);let w=Vt(S),T=a?w.data?.runs:void 0,E=a&&!w.isPlaceholderData?(w.data?.truncated??[]).map(e=>b.get(e)??e):[],D=Y.useMemo(()=>Vf(l.data??[],x,_.data?.runs,T),[l.data,x,_.data,T]),O=Y.useMemo(()=>Wf(D),[D]),k=a?[]:O.recentlyFinished,A=a?D:O.otherTasks,j=g,M=e=>e.projectId===null?null:b.get(e.projectId)??null,ee=f.data?.skillUsage,te=Y.useMemo(()=>So(u.data??[],ee),[u.data,ee]),ne=n=>{e(),t(n)},re=t=>{e(),n(t)},ie=Ef(),N=t=>{e(),ie.go(t)},P=n=>{e(),t(n.projectId===null?`/tasks/${n.id}`:Ea(n.projectId,`/tasks/${n.id}`))},ae=yu[s],oe=Xf({views:Yf({multiProject:g,health:p}),go:ne,goGlobal:re,orderedProjects:y,activeProjectId:o,goProject:N,otherTasks:A,searching:a,taskProjectName:M,showProjectOnTasks:j,now:m,selectTask:P,orderedSkills:te,skillRunner:u.runner,theme:s,nextTheme:ae,setTheme:c,close:e});return(u.isError||u.list?.source===`unavailable`)&&a&&oe.push({rows:[{value:r.trim()}],node:(0,X.jsx)(J,{heading:`Skills`,children:(0,X.jsxs)(co,{value:r.trim(),onSelect:()=>ne(zd({skill:r.trim(),runner:u.runner})),children:[`Use skill id “`,r.trim(),`” (unchecked)`]})},`unchecked-skill`)}),(0,X.jsxs)(X.Fragment,{children:[Zf({search:r,setSearch:i}),Qf({search:r,searching:a,recentlyFinished:k,groups:oe,taskProjectName:M,showProjectOnTasks:j,now:m,selectTask:P,go:ne}),$f({cappedProjects:E})]})}var tp=Y.createContext(null);function np({children:e}){let[t,n]=Y.useState(`active`),r=kf(),i=r?t:`active`,a=Y.useMemo(()=>[i,n,r],[i,r]);return(0,X.jsx)(tp.Provider,{value:a,children:e})}function rp(){let e=Y.useContext(tp);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}function ip(e){let t=e.filter(e=>!e.isDefault&&e.status===void 0),n=zt({queries:t.map(e=>({queryKey:L.agentAccountStatus(e.id),queryFn:({signal:t})=>ne(e.id,{signal:t}),staleTime:6e4,retry:!1}))}),r=new Map;return t.forEach((e,t)=>{let i=n[t]?.data?.status?.status;i!==void 0&&r.set(e.id,i)}),r}function ap(){let e=Qt().data?.profiles??[],t=ip(e);return e.map(e=>{let n=e.status?.status??t.get(e.id);return{provider:e.provider,id:e.id,label:e.label,configDir:e.configDir,isDefault:e.isDefault,...n===void 0?{}:{status:n}}})}function op(){let e=Qt(),t=Bt(),n=ap(),r=t.data?.info?.root;return{accounts:n,repoAccount:r?e.data?.selections?.[r]:void 0}}function sp(e,t){return e.filter(e=>e.provider===t).length>1}function cp(){let e=vt(),t=At(),{accounts:n,repoAccount:r}=op();return{runners:te(e.data,t.data,n),uninstalled:v(e.data,t.data),signedOut:b(e.data,t.data,n),accounts:oe(e.data,n),repoAccount:r,accountFor:(t,i)=>Xe(e.data,n,t,i,r),runnersOn:r=>ue(e.data,t.data,n,r),readyOn:(t,r)=>_(e.data,n,t,r)}}function lp(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return{};let n=e,r={};for(let{id:e}of t?.runners??[]){let t=n[e];typeof t==`string`&&t.length>0&&t.length<=128&&(r[e]=t)}return r}function up(e,t,n){if(!e||!n)return[];let r=new Map(e.providers.map(e=>[e.provider,e]));return n.runners.flatMap(({id:e,displayName:n})=>{let i=r.get(e);return i?.status!==`disconnected`||!i.authFailureId||t[e]===i.authFailureId?[]:[{provider:e,label:n,authFailureId:i.authFailureId}]})}function dp(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function fp({status:e,runners:t,pending:n,error:r,dismissals:i,onDismissAuthFailures:a,accounts:o=[]}){if(n||!e)return null;let s;try{s=Qe(e)}catch{return null}let c=up(s,i,t);if(c.length>0)return(0,X.jsxs)(`div`,{"data-slot":`provider-banner`,role:`alert`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-destructive/10 px-4 text-sm text-foreground`,children:[(0,X.jsx)(q,{tone:`danger`}),(0,X.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,c.map(({label:e})=>e).join(`, `),`.`]}),(0,X.jsx)(G,{to:`/settings/agent-defaults#providers`,className:`ml-auto shrink-0 font-medium underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:`Open agent settings`}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Dismiss provider authentication alert`,onClick:()=>a(c),className:`shrink-0 rounded-sm p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,X.jsx)(js,{className:`size-4`,"aria-hidden":`true`})})]});if(r||s.providers.some(e=>e.enabled&&Je(e,o)))return null;let l=s.providers.some(e=>Je(e,o)),u=s.providers.some(e=>e.status===`unknown`);return(0,X.jsxs)(`div`,{"data-slot":`provider-banner`,role:`status`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-muted/50 px-4 text-sm text-muted-foreground`,children:[(0,X.jsx)(q,{tone:u?`danger`:`pending`}),(0,X.jsx)(`span`,{children:l?`No agent provider is enabled.`:u?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,X.jsx)(G,{to:`/settings/agent-defaults#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 pp(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function mp(){let e=vt(),t=At().data,n=ap(),r=Jt(),i=F(),a=(0,Y.useRef)(Promise.resolve()),o=(0,Y.useRef)(0),s=(0,Y.useRef)(0),c=(0,Y.useRef)(pp(r.data));(0,Y.useEffect)(()=>{s.current===0&&(c.current=pp(r.data))},[r.data]);let l=(0,Y.useCallback)(e=>{let n=L.uiState,r=pp(i.getQueryData(n)),l=dp(lp(r?.dismissedProviderAuthFailures,t),e),u={...r,dismissedProviderAuthFailures:l};s.current+=1,i.setQueryData(n,u);let d=++o.current;a.current=a.current.then(async()=>{try{let e=await _e({dismissedProviderAuthFailures:l});c.current=pp(e),d===o.current&&i.setQueryData(n,e)}catch(e){d===o.current&&(c.current===void 0?i.removeQueries({queryKey:n,exact:!0}):i.setQueryData(n,c.current),i.invalidateQueries({queryKey:n}),V(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--s.current}})},[i,t]);return(0,X.jsx)(fp,{status:e.data,runners:t,pending:e.isPending,error:e.isError,dismissals:lp(pp(r.data)?.dismissedProviderAuthFailures,t),onDismissAuthFailures:l,accounts:n})}function hp(e={displayName:`Squawk`,command:`hsq`,npx:`npx -p @hearsay-tools/squawk hsq`}){return e.command}function gp(e){return e.reason===`legacy-change`?e.canImport?`${e.file} changed in the old home. Import keeps live-only changes. Old-home changes win when both homes changed the same key or entry.`:`${e.file} changed in the old home. Import is unavailable. Ignore keeps the live file and skips these old-home changes.`:e.reason===`outside-write`?`${e.file} changed outside Squawk. Restore the previous version or accept the file as found.`:e.file===`config.json`?`The project registry was reset. Restore the previous projects?`:`The account list was reset. Restore the previous accounts?`}function _p({file:e,editable:t}){let n=Yo(),r=Xo(),i=Zo(),a=e.reason===`legacy-change`,o=n.isPending||r.isPending||i.isPending,s=n.error??r.error??i.error,c=t=>{n.reset(),r.reset(),i.reset();let a={file:e.file,detectedAt:e.detectedAt};t===`restore`?n.mutate(a):t===`accept`?r.mutate(a):i.mutate(a)};return(0,X.jsxs)(`div`,{"data-slot":`home-recovery`,"data-home-file":e.file,role:`status`,"aria-live":`polite`,"aria-busy":o,className:`flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-border bg-muted/50 p-3 text-sm text-foreground`,children:[(0,X.jsx)(`span`,{className:`flex-[1_1_24rem] [min-inline-size:0] [overflow-wrap:break-word]`,children:gp(e)}),t?(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a?e.canImport&&(0,X.jsx)(U,{type:`button`,"data-action":`import`,disabled:o,onClick:()=>c(`import`),children:`Import changes from the old home`}):(0,X.jsx)(U,{type:`button`,"data-action":`restore`,disabled:o||!e.canRestore,onClick:()=>c(`restore`),children:`Restore`}),(0,X.jsx)(U,{type:`button`,variant:`outline`,"data-action":`accept`,disabled:o,onClick:()=>c(`accept`),children:a?`Ignore`:`Accept as found`})]}):t===!1&&(0,X.jsxs)(`p`,{className:`basis-full`,children:[a?e.canImport?`Only the host operator can import or ignore this file.`:`Only the host operator can ignore this file.`:`Only the host operator can restore or accept this file.`,e.file.startsWith(`remote-settings/`)&&(a?(0,X.jsxs)(X.Fragment,{children:[` `,e.canImport&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`code`,{children:[hp(),` backup import `,e.file]}),` or `]}),(0,X.jsxs)(`code`,{children:[hp(),` backup ignore `,e.file]})]}):(0,X.jsxs)(X.Fragment,{children:[` `,(0,X.jsxs)(`code`,{children:[hp(),` backup restore `,e.file]})]}))]}),t&&s&&(0,X.jsx)(`p`,{role:`alert`,className:`basis-full text-danger`,children:s.message})]})}function vp(){let e=Go(),t=St().data?.capabilities?.localHandoff;return(0,X.jsx)(`div`,{"data-slot":`home-recovery-state`,"data-state":e.isSuccess?`ready`:e.isError?`error`:`pending`,children:e.data?.files.map(e=>(0,X.jsx)(_p,{file:e,editable:!e.file.startsWith(`remote-settings/`)&&t},e.file))})}var yp=`hsq:reloaded-for-version`,bp=new WeakMap;function xp(e,t){if(!t)return null;let n=bp.get(e);return n===void 0?(bp.set(e,t),null):t===n?null:t}function Sp(e,t=Np()){try{return t?.getItem(yp)===e}catch{return!1}}function Cp(e,t=()=>window.location.reload()){try{Np()?.setItem(yp,e)}catch{}t()}var wp=[`textarea`,`input${[`search`,`checkbox`,`radio`,`hidden`,`button`,`submit`,`reset`,`image`,`file`,`range`,`color`].map(e=>`:not([type="${e}"])`).join(``)}`,`[contenteditable=""]`,`[contenteditable="true"]`].join(`, `),Tp=new WeakSet,Ep=new Set;function Dp(e){(0,Y.useEffect)(()=>{if(!e)return;let t=Symbol(`unsent-draft`);return Ep.add(t),()=>{Ep.delete(t)}},[e])}var Op=new WeakMap;function kp(e){return e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement?e.value:e.textContent??``}function Ap(e=document){let t=e=>{let t=e.target;t instanceof Element&&t.matches(wp)&&!Op.has(t)&&Op.set(t,kp(t))},n=e=>{e.target&&Tp.add(e.target)};return e.addEventListener(`focusin`,t,!0),e.addEventListener(`input`,n,!0),()=>{e.removeEventListener(`focusin`,t,!0),e.removeEventListener(`input`,n,!0)}}function jp(e){if(!Tp.has(e)||e.closest(`[data-persisted-draft], [data-slot="composer"]`)||(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement)&&(e.disabled||e.readOnly))return!1;let t=kp(e).trim(),n=Op.get(e);return n===void 0?t!==``:t!==n.trim()}function Mp(e=document){return Ep.size>0||Array.from(e.querySelectorAll(wp)).some(jp)}function Np(){try{return typeof window>`u`?void 0:window.sessionStorage}catch{return}}var Pp=2e3;function Fp({reload:e}){let t=St().data?.version,n=F(),[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(`reloading`);return(0,Y.useEffect)(()=>Ap(),[]),(0,Y.useEffect)(()=>{let e=xp(n,t);e!==null&&i(e)},[n,t]),(0,Y.useEffect)(()=>{if(r===null)return;if(Sp(r)){o(`manual`);return}let t=()=>Mp()?(o(`waiting-for-input`),!1):(o(`reloading`),Cp(r,e),!0);if(t())return;let n=window.setInterval(()=>{t()&&window.clearInterval(n)},Pp);return()=>window.clearInterval(n)},[r,e]),r===null?null:(0,X.jsxs)(`div`,{"data-slot":`version-reload`,"data-phase":a,role:`status`,className:`flex min-h-9 flex-wrap items-center gap-x-3 gap-y-1 border-b border-border bg-muted/50 px-4 py-1 text-sm text-foreground`,children:[(0,X.jsx)(`span`,{children:a===`reloading`?`Squawk was updated to ${r}. Reloading…`:a===`waiting-for-input`?`Squawk was updated to ${r}. It reloads once your unsent message is sent or cleared.`:`Squawk was updated to ${r}. Reload to use the new version.`}),a===`reloading`?null:(0,X.jsx)(U,{type:`button`,size:`sm`,variant:`outline`,className:`ml-auto max-md:min-h-11`,"data-action":`version-reload`,onClick:()=>Cp(r,e),children:`Reload now`})]})}var Ip=`cez-project-rail-expanded`;function Lp(e,t){return e-232-t>=640}function Rp(){try{return localStorage.getItem(Ip)===`1`}catch{return!1}}function zp(e){try{localStorage.setItem(Ip,e?`1`:`0`)}catch{}}var Bp=Y.lazy(()=>R(()=>import(`./project-rail-sortable-BmVI4_-T.js`),__vite__mapDeps([0,1,2,3,4])));function Vp(e){if(e!==void 0)return e.isDragging?`relative z-10 opacity-40 [-webkit-touch-callout:none]`:`[-webkit-touch-callout:none]`}function Hp({project:e,signal:t,known:n,current:r,target:i,onSwitchProject:a,onSelectProject:o,sort:s}){let l=Ll(e.name,t,{unknown:!n});return(0,X.jsxs)(`div`,{ref:s?.setNodeRef,style:s?.style,...s?.listeners,"data-slot":`rail-project`,"data-project-id":e.id,"data-dragging":s?.isDragging?``:void 0,className:c(`relative flex h-[52px] w-full shrink-0 items-center justify-center`,Vp(s)),children:[r?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`rail-current-bar`,className:`absolute top-1/2 left-0 h-5 w-[3px] -translate-y-1/2 rounded-r-[2px] bg-foreground`}):null,(0,X.jsxs)(`div`,{className:`relative size-9`,children:[(0,X.jsx)(z,{ref:s?.setActivatorNodeRef,"aria-describedby":s?.attributes[`aria-describedby`],to:i.href,onClick:t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(o?.(e.id),i.verify&&a&&(t.preventDefault(),a(e.id)))},"aria-label":l,title:l,"aria-current":r?`page`:void 0,className:c(`flex size-full items-center justify-center rounded-[9px] border text-[12px] leading-none font-semibold focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r?`border-soft-foreground bg-sidebar-row-selected text-foreground`:`border-transparent bg-muted text-muted-foreground hover:text-foreground`),children:Bl(e.name)}),(0,X.jsx)(nu,{position:`top`,segments:ru(t).top}),(0,X.jsx)(nu,{position:`bottom`,segments:ru(t).bottom})]})]})}var Up=`motion-safe:rail-text-in`;function Wp({project:e,signal:t,known:n,current:r,target:i,onSwitchProject:a,onSelectProject:o,sort:s}){let l=Ll(e.name,t,{unknown:!n}),{top:u,bottom:d}=ru(t),f=r?`border-sidebar-row-selected`:`border-background group-hover:border-sidebar-row-hover`;return(0,X.jsxs)(`div`,{ref:s?.setNodeRef,style:s?.style,...s?.listeners,"data-slot":`rail-project`,"data-project-id":e.id,"data-dragging":s?.isDragging?``:void 0,className:c(`group/row relative w-full shrink-0`,Vp(s)),children:[(0,X.jsxs)(z,{to:i.href,onClick:t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(o?.(e.id),i.verify&&a&&(t.preventDefault(),a(e.id)))},"aria-label":l,"aria-current":r?`page`:void 0,className:c(`group flex h-[52px] w-full items-center gap-[10px] rounded-[8px] px-[6px] pr-6 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r?`bg-sidebar-row-selected`:`hover:bg-sidebar-row-hover`),children:[(0,X.jsxs)(`span`,{"aria-hidden":`true`,"data-slot":`rail-mark`,className:c(`relative flex size-9 shrink-0 items-center justify-center rounded-[9px] border text-[12px] leading-none font-semibold`,r?`border-soft-foreground bg-sidebar text-foreground`:`border-transparent bg-muted text-muted-foreground`),children:[Bl(e.name),(0,X.jsx)(nu,{position:`top`,segments:u,className:f}),(0,X.jsx)(nu,{position:`bottom`,segments:d,className:f})]}),(0,X.jsxs)(`span`,{className:c(`flex min-w-0 flex-1 flex-col gap-px`,Up),children:[(0,X.jsx)(`span`,{"data-slot":`rail-project-name`,className:c(`truncate text-[13.5px] leading-[18px] font-semibold`,r?`text-foreground`:`text-muted-foreground`),children:e.name}),(0,X.jsx)(Ql,{signal:t,known:n,current:r,maxParts:2,slot:`rail-project-state`,className:`h-4 gap-x-[4px] overflow-hidden text-[11px] leading-4 whitespace-nowrap`})]})]}),s?(0,X.jsx)(Gp,{name:e.name,sort:s}):null]})}function Gp({name:e,sort:t}){return(0,X.jsx)(`button`,{type:`button`,ref:t.setActivatorNodeRef,"data-slot":`rail-project-grip`,...t.attributes,"aria-label":`Reorder ${e}, position ${t.position} of ${t.total}`,className:c(`absolute top-1/2 right-0.5 flex h-10 w-5 -translate-y-1/2 cursor-grab touch-none items-center justify-center rounded text-soft-foreground opacity-0 outline-none transition-opacity hover:text-foreground motion-reduce:transition-none`,`focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50`,`group-hover/row:opacity-100 group-focus-within/row:opacity-100 [@media(hover:none)]:opacity-100`),children:(0,X.jsx)(xs,{"aria-hidden":`true`,className:`size-3.5`})})}function Kp(e){return c(`flex shrink-0 items-center rounded-[8px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,e?`size-auto h-9 w-full justify-start gap-3 px-2.5 text-[13px] font-normal`:`size-9 justify-center`)}var qp=c(`truncate text-muted-foreground group-hover:text-foreground`,Up);function Jp({to:e,label:t,slot:n,active:r,expanded:i,children:a}){return(0,X.jsxs)(z,{to:e,"data-slot":n,"aria-label":t,title:i?void 0:t,"aria-current":r?`page`:void 0,className:c(`group`,Kp(i),r&&`bg-sidebar-row-selected text-foreground hover:bg-sidebar-row-selected`),children:[a,i?(0,X.jsx)(`span`,{className:qp,children:t}):null]})}function Yp(e){let[t,n]=Y.useState(()=>window.innerWidth);return Y.useEffect(()=>{let e=()=>n(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),Lp(t,e)}function Xp(){let e=Yp(Y.useContext(Rs));return(0,X.jsx)(`div`,{"aria-hidden":`true`,"data-slot":`project-rail-placeholder`,style:{width:Rp()&&e?232:60},className:`hidden shrink-0 border-r border-border bg-background md:block`})}var Zp=e=>({href:String(Ea(e,`/`)),verify:!1});function Qp({expanded:e,resolvedTheme:t,version:n}){let r=n?`Squawk v${n}`:`Squawk`;return e?(0,X.jsxs)(`div`,{"data-slot":`rail-identity`,className:`flex shrink-0 flex-col gap-0.5`,children:[(0,X.jsxs)(`div`,{className:`flex h-[34px] items-center gap-[10px] px-0.5`,children:[(0,X.jsx)(`img`,{src:`/cezarion-mark-${t}.svg`,alt:``,"aria-hidden":`true`,"data-slot":`rail-app-mark`,className:`size-[34px] shrink-0 rounded-[8px]`}),(0,X.jsxs)(`span`,{className:c(`flex min-w-0 items-baseline gap-[10px] whitespace-nowrap`,Up),"aria-label":r,children:[(0,X.jsx)(`span`,{className:`text-[15px] leading-none font-bold text-foreground`,children:`Squawk`}),n?(0,X.jsxs)(`span`,{"data-slot":`rail-version`,title:`v${n}`,className:`min-w-0 truncate text-[11px] leading-none text-soft-foreground`,children:[`v`,n]}):null]})]}),(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`h-px w-full bg-border`}),(0,X.jsx)(`div`,{className:c(`px-1 pt-2.5 pb-1 text-[11px] font-medium text-soft-foreground`,Up),children:`Projects`})]}):(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-0.5`,children:[(0,X.jsx)(`img`,{src:`/cezarion-mark-${t}.svg`,alt:r,title:r,"data-slot":`rail-app-mark`,className:`size-[34px] rounded-[9px]`}),(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`mt-0.5 mb-1.5 h-px w-6 bg-border`})]})}function $p({expanded:e}){return e?(0,X.jsx)(Ol,{origin:`rail`,icon:ar,iconClassName:`size-[15px] text-soft-foreground`,iconFrameClassName:`flex size-9 shrink-0 items-center justify-center rounded-[9px] border border-border`,label:`Add project`,side:`right`,triggerClassName:c(`h-[44px] w-full shrink-0 justify-start gap-[10px] rounded-[8px] px-[6px] text-[13px] font-normal text-muted-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring motion-safe:[&>span:last-child]:rail-text-in`)}):(0,X.jsx)(Ol,{origin:`rail`,icon:ar,iconClassName:`size-[15px]`,side:`right`,triggerClassName:`shrink-0 rounded-[9px] border border-border text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`})}function em({roomToExpand:e,expanded:t,toggle:n,railId:r,allProjectsActive:i,settingsActive:a}){return(0,X.jsxs)(`div`,{"data-slot":`rail-bottom`,className:c(`flex shrink-0 flex-col gap-0.5 pt-2`,t?`items-stretch`:`items-center`),children:[e?(0,X.jsxs)(`button`,{type:`button`,"data-slot":`rail-expand-toggle`,"aria-expanded":t,"aria-controls":r,"aria-label":t?`Collapse projects`:`Expand projects`,title:t?void 0:`Expand projects`,onClick:n,className:c(`group`,Kp(t)),children:[t?(0,X.jsx)(Ts,{className:`size-4 shrink-0`,"aria-hidden":`true`}):(0,X.jsx)(Es,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t?(0,X.jsx)(`span`,{className:qp,children:`Collapse`}):null]}):null,(0,X.jsx)(Jp,{to:`/tasks`,label:`All projects`,slot:`rail-all-projects`,active:i,expanded:t,children:(0,X.jsx)(Gr,{className:`size-4 shrink-0`,"aria-hidden":`true`})}),(0,X.jsx)(Jp,{to:`/settings/global/appearance`,label:`Global settings`,slot:`rail-global-settings`,active:a,expanded:t,children:(0,X.jsx)(gr,{className:`size-4 shrink-0`,"aria-hidden":`true`})}),(0,X.jsx)(xu,{showLabel:t,labelClassName:qp,className:c(`group`,Kp(t),`[&_svg]:size-4`)})]})}function tm({children:e,rememberFocus:t,restoreFocus:n}){return Y.useLayoutEffect(()=>(n(),t),[t,n]),(0,X.jsx)(X.Fragment,{children:e})}function nm({projects:e,signals:t,version:n,projectTarget:r=Zp,onSwitchProject:i,onSelectProject:a,canReorder:o=!1,onReorder:s}){let{pathname:l}=gn(),{resolvedTheme:u}=vu(),d=Y.useContext(Rs),[f,p]=Y.useState(Rp),m=Yp(d),h=f&&m,g=()=>{let e=!h;p(e),zp(e)},_=Oa(l),v=l===`/tasks`,y=l===`/settings/global`||l.startsWith(`/settings/global/`),b=Y.useId(),x=Y.useRef(null),S=Y.useRef(null),C=Y.useCallback(()=>{let e=document.activeElement;if(!(e instanceof HTMLAnchorElement)||!x.current?.contains(e))return;let t=e.closest(`[data-project-id]`)?.dataset.projectId;t&&(S.current={link:e,projectId:t})},[]),w=Y.useCallback(()=>{let e=S.current;if(S.current=null,!e||e.link.isConnected||document.activeElement!==document.body)return;let t=x.current?.querySelectorAll(`[data-project-id]`)??[];for(let n of t)if(n.dataset.projectId===e.projectId){n.querySelector(`a`)?.focus({preventScroll:!0});break}},[]),T=o&&s!==void 0&&e.length>1,E=(e,n)=>(0,X.jsx)(h?Wp:Hp,{project:e,signal:t?.get(e.id),known:t!==null,current:e.id===_,target:r(e.id),onSwitchProject:i,onSelectProject:a,sort:n},e.id),D=(0,X.jsx)(tm,{rememberFocus:C,restoreFocus:w,children:e.map(e=>E(e))});return(0,X.jsxs)(`nav`,{id:b,"aria-label":`Projects`,"data-slot":`project-rail`,"data-expanded":h?`true`:`false`,style:{width:h?232:60},className:c(`hidden shrink-0 flex-col overflow-hidden border-r border-border bg-background pt-3 pb-3.5 transition-[width] duration-[160ms] ease-out motion-reduce:transition-none md:flex`,h?`items-stretch px-2.5`:`items-center`),children:[(0,X.jsx)(Qp,{expanded:h,resolvedTheme:u,version:n}),(0,X.jsxs)(`div`,{ref:x,"data-slot":`rail-projects`,className:c(`flex min-h-0 w-full flex-1 flex-col gap-0.5 overflow-y-auto overscroll-contain [scrollbar-width:none]`,h?`items-stretch`:`items-center`),children:[T?(0,X.jsx)(Y.Suspense,{fallback:D,children:(0,X.jsx)(Bp,{projects:e,onReorder:s,renderProject:E,onReady:w})}):D,(0,X.jsx)($p,{expanded:h})]}),(0,X.jsx)(em,{roomToExpand:m,expanded:h,toggle:g,railId:b,allProjectsActive:v,settingsActive:y})]})}function rm(){let e=F(),t=tn().data?.projects,{order:n,canReorder:r,setOrder:i}=jf(),a=r&&t!==void 0&&ho(t.length),o=Y.useMemo(()=>t?po(t,n):void 0,[t,n]),s=un(!0,void 0,Y.useMemo(()=>{let e;return t=>{let n=Il(t.runs);return e&&e.size===n.size&&[...n].every(([t,n])=>{let r=e.get(t);return r&&r.needsYou===n.needsYou&&r.failedUnread===n.failedUnread&&r.inMotion===n.inMotion&&r.finishedUnread===n.finishedUnread})?e:(e=n,n)}},[])).data??null,c=t?.map(e=>e.id).sort().join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-rail-sortable-BmVI4_-T.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/project-order-AcHI4Dcl.js","assets/sortable.esm-CAVTYaA3.js","assets/accounts-section-xFYT_zfY.js","assets/project-scope-context-DqBHMdSb.js","assets/utils-DSMR_WLb.js","assets/bundle-mjs-rHxsej31.js","assets/live-protocol-DteqtbyN.js","assets/queries-DeeY9cGJ.js","assets/live-refetch-CZb2VOyu.js","assets/useInfiniteQuery-BswGDVd8.js","assets/useQuery-IS5tPlew.js","assets/ws-CKLbENkm.js","assets/toaster-Bo5vCbz-.js","assets/chunk-KS7C4IRE-Cg8l-LDN.js","assets/preload-helper-Czpn1I53.js","assets/design-icons-CzEoMH9c.js","assets/createLucideIcon-BHp8sXmF.js","assets/folder-browser-DwKXxvit.js","assets/chevron-right-BENZ-1ZN.js","assets/folder-o-AvL3y3.js","assets/button-BQ2y4XRB.js","assets/dist-BW234Kg5.js","assets/badge-D9JrXe0o.js","assets/dialog-BVF6dIeS.js","assets/dist-Da4ckcJG.js","assets/dist-C5mlVBmd.js","assets/es2015-CQth82uv.js","assets/status-dot-DtAOFiIi.js","assets/bot-TkDIw4y-.js","assets/agents-settings-path-7X6_cvUg.js","assets/centered-state-V15AR_qo.js","assets/settings-agent-picker-CIUuXcrv.js","assets/agent-config-section-B8yx4Ftt.js","assets/highlighter-DvLzHjjY.js","assets/own-lookup-DS54wXvD.js","assets/remote-settings-notice-B6gmSQmK.js","assets/agent-defaults-section-BUJi0JBr.js","assets/switch-Bv2Zf1uU.js","assets/dist-DXO3xwbC.js","assets/textarea-vJt9undk.js","assets/appearance-L-Mcz7xt.js","assets/moon-CRE9nU5R.js","assets/notifications-section-CRVfC723.js","assets/projects-section-BzJOvGbU.js","assets/popover-BPgUYFyu.js","assets/dist-BAoXdNsT.js","assets/settings-field-Bl6WuvGX.js","assets/prompt-templates-section-DCXEFZeZ.js","assets/command-CDt1BsZy.js","assets/skills-pM_PouEs.js","assets/resources-section-21R3ObSS.js","assets/sidebar-section-D7e8bdCc.js","assets/worktrees-section-DmsaW6FZ.js","assets/project-router-CYJwJlJL.js","assets/project-location-YHLlezCN.js","assets/open-in-menu-9Hic-2Jh.js","assets/external-link-BE6y205O.js","assets/smartphone-Lr8Ug2z_.js","assets/square-terminal-B6RYYieR.js","assets/dropdown-menu-4e2iKSMT.js","assets/archive-on-merge-field-BJoirmK5.js","assets/preview-pane-connected-BcePJL41.js","assets/arrow-right-Dh_Lx3um.js","assets/dist-C28wFbz0.js","assets/chevron-down-CHGyCDBH.js","assets/hourglass-B0lPAJvT.js","assets/info-DA1x_4bz.js","assets/format-BNCkW110.js","assets/play-CmVAj_fu.js","assets/thread-state-CiVcAJSc.js","assets/app-window-CSHwDX9N.js","assets/report-reader-D_SwO-8H.js","assets/file-preview-DmLdg1Ak.js","assets/markdown-CoC8_Mxa.js","assets/chunk-BO2N2NFS-DQrpGzb-.js","assets/lib-DrPFkMXk.js","assets/automations-route-DndFRPQ2.js","assets/label-DozlouK_.js","assets/cez-idle-CQtDz5jk.js","assets/collapsible-BEV4FO-1.js","assets/automation-format-CUP262Tk.js","assets/workspace-tools-CJ8gOVwz.js","assets/tasks-table-_5cXATkO.js","assets/task-groups-CC8zwSMv.js","assets/attention-D8ku2yDQ.js","assets/settings-shell-DuQAKYA0.js","assets/settings-shell-xK8txSJo.css","assets/task-thread-BDXHF8cV.js","assets/run-header-CmEgf2OE.js","assets/message-square-B-MD-8rD.js","assets/reference-chip-BSXiknFh.js","assets/tab-link-Bc33InzJ.js","assets/run-header-CC7VUTg9.css","assets/eye-B8okNWXU.js","assets/zoomable-image-CIQl1Wpe.js","assets/report-title-D4Mbu2Er.js","assets/task-thread-DtQ6uGfQ.css","assets/task-changes-B-daTy0n.js","assets/git-toolbar-CBMk5v-t.js","assets/diff-controls-BSWICnsb.js","assets/markdown-BBDDg-4t.js","assets/diff-DcmpXzlx.js","assets/image-preview-CNBuRrK5.js","assets/task-files-QGAAGN7K.js","assets/task-commits-B8JcUxwa.js","assets/commit-diff-panel-uXKNbpAQ.js","assets/task-github-item-BUQ-EaXP.js","assets/use-hand-to-agent-state-qYz6wj5e.js","assets/use-hand-to-agent-state-C7esPJ-N.css","assets/repo-git-f5cKDC-i.js","assets/nav-row-styles-DqKjMToI.js","assets/repo-git-DVXNOJDT.css","assets/github-ktVA2Gmk.js","assets/reports-CyP79G2S.js","assets/reports-B7QAzibP.css","assets/workflows-CmaJn4ba.js","assets/workflows-C21NystW.css","assets/activity-route-cdDIR26F.js","assets/activity-motion-OAYNqxZ2.js","assets/activity-motion-0wHCeUs7.css","assets/global-activity-route-Rx7cgzpu.js","assets/skills-CBHa5_n1.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r,t as i}from"./react-runtime-CCIEwYL0.js";import{c as a,i as o,r as s,t as c,u as l}from"./utils-DSMR_WLb.js";import{n as u,r as d}from"./live-refetch-CZb2VOyu.js";import{Ai as f,B as p,Bt as m,C as h,Ci as g,Cr as _,Dr as v,Dt as y,Er as b,Ft as x,G as S,Gr as C,Hn as w,Hr as T,Ht as E,Jn as D,Kr as O,Kt as k,Ln as A,Mn as j,Mt as M,Oi as ee,Or as te,P as ne,Q as re,Rr as ie,S as N,Si as P,Sn as ae,Sr as oe,St as se,T as ce,Ti as le,Tr as ue,Un as de,Ut as fe,Vt as pe,W as me,Wr as he,Yn as ge,Yt as _e,_i as ve,a as ye,ar as be,bi as xe,br as Se,bt as Ce,ci as F,cr as we,f as Te,ft as Ee,gi as De,hi as Oe,hn as ke,ht as Ae,i as je,ir as Me,jn as Ne,jt as Pe,ki as Fe,li as Ie,n as Le,o as Re,pn as ze,pt as Be,qt as Ve,r as He,si as Ue,sr as We,t as Ge,ui as Ke,vi as qe,wr as Je,xi as Ye,xr as Xe,xt as Ze,yr as Qe}from"./project-scope-context-DqBHMdSb.js";import{B as $e,F as et,I as tt,N as nt,P as rt,V as it,W as at,Y as ot,Z as I}from"./live-protocol-DteqtbyN.js";import{t as st}from"./useInfiniteQuery-BswGDVd8.js";import{At as ct,B as lt,Bt as ut,Ct as dt,Ft as ft,G as pt,Gt as mt,H as ht,Ht as gt,It as _t,J as vt,K as yt,L as bt,Lt as xt,M as St,Nt as L,O as Ct,P as wt,Pt as Tt,Rt as Et,St as Dt,Tt as Ot,U as kt,Ut as At,V as jt,Vt as Mt,W as Nt,Wt as Pt,Xt as Ft,Z as It,Zt as Lt,_ as Rt,an as zt,at as Bt,bt as Vt,d as Ht,en as Ut,et as Wt,f as Gt,h as Kt,in as qt,jt as Jt,kt as Yt,n as Xt,nn as Zt,o as Qt,on as $t,p as en,q as tn,qt as nn,rn,s as an,t as on,tn as sn,ut as cn,vt as ln,yt as un,z as dn,zt as fn}from"./queries-DeeY9cGJ.js";import{t as pn}from"./useQuery-IS5tPlew.js";import{t as R}from"./preload-helper-Czpn1I53.js";import{a as mn,c as hn,f as gn,g as _n,h as vn,i as yn,l as bn,m as xn,n as z,o as B,p as Sn,r as Cn,s as wn,t as Tn,u as En}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{i as Dn,n as On,r as kn,t as An}from"./label-DozlouK_.js";import{t as jn}from"./cez-idle-CQtDz5jk.js";import{_ as Mn,a as Nn,c as Pn,f as Fn,g as In,h as Ln,i as Rn,l as zn,n as Bn,p as Vn,r as Hn,s as Un,t as Wn,u as Gn,v as Kn,y as qn}from"./tasks-table-_5cXATkO.js";import{t as Jn}from"./ws-CKLbENkm.js";import{n as V,t as Yn}from"./toaster-Bo5vCbz-.js";import{$ as Xn,A as Zn,B as Qn,C as $n,D as er,E as tr,F as nr,G as rr,I as ir,J as ar,K as or,L as sr,O as cr,Q as lr,R as ur,T as dr,U as fr,V as pr,W as mr,X as hr,Z as gr,c as _r,ct as vr,dt as yr,et as br,ft as xr,g as Sr,h as Cr,i as wr,it as Tr,j as Er,k as Dr,l as Or,n as kr,nt as Ar,o as jr,ot as Mr,p as Nr,pt as Pr,r as Fr,rt as Ir,s as Lr,t as Rr,tt as zr,u as Br,ut as Vr,v as Hr,x as Ur,y as Wr,z as Gr}from"./design-icons-CzEoMH9c.js";import{t as H}from"./createLucideIcon-BHp8sXmF.js";import{n as Kr,r as qr}from"./open-in-menu-9Hic-2Jh.js";import{r as Jr,t as Yr}from"./dist-C28wFbz0.js";import{t as Xr}from"./chevron-down-CHGyCDBH.js";import{_ as Zr,a as Qr,c as $r,d as ei,f as ti,g as ni,h as ri,i as ii,m as ai,o as oi,p as si,r as ci,s as li,u as ui,y as di}from"./nav-row-styles-DqKjMToI.js";import{n as fi,t as pi}from"./folder-browser-DwKXxvit.js";import{t as mi}from"./external-link-BE6y205O.js";import{t as hi}from"./eye-B8okNWXU.js";import{a as gi,i as _i,n as vi,r as yi,t as bi}from"./format-BNCkW110.js";import{t as xi}from"./play-CmVAj_fu.js";import{a as Si,i as Ci,l as wi,r as Ti,s as Ei,t as Di,u as Oi}from"./reference-chip-BSXiknFh.js";import{n as ki,t as U}from"./button-BQ2y4XRB.js";import{a as Ai,r as ji}from"./dist-BW234Kg5.js";import{a as Mi,i as Ni,r as Pi,t as Fi}from"./dist-C5mlVBmd.js";import{a as Ii,c as Li,d as Ri,f as zi,i as W,l as Bi,o as Vi,p as Hi,r as Ui,s as Wi,t as Gi,u as Ki}from"./dropdown-menu-4e2iKSMT.js";import{i as qi,l as Ji,o as Yi,u as Xi}from"./es2015-CQth82uv.js";import{a as Zi,c as Qi,i as $i,l as ea,n as ta,o as na,r as ra,s as ia,t as aa}from"./dist-Da4ckcJG.js";import{t as oa}from"./switch-Bv2Zf1uU.js";import{a as sa,i as ca,n as la,r as ua,t as da}from"./dist-BAoXdNsT.js";import{i as fa,n as pa,o as ma,r as ha,t as ga}from"./popover-BPgUYFyu.js";import{t as _a}from"./badge-D9JrXe0o.js";import{a as va,i as ya,n as ba,o as xa,r as Sa,s as Ca,t as wa}from"./dialog-BVF6dIeS.js";import{t as Ta}from"./own-lookup-DS54wXvD.js";import{a as Ea,c as Da,i as Oa,l as ka,o as Aa,r as ja,s as Ma,t as G}from"./project-router-CYJwJlJL.js";import{t as Na}from"./attention-D8ku2yDQ.js";import{C as Pa,O as Fa,S as Ia,T as La,_ as Ra,a as za,b as Ba,c as Va,d as Ha,f as K,g as Ua,h as Wa,i as Ga,l as Ka,m as qa,n as Ja,o as Ya,p as Xa,r as Za,s as Qa,t as $a,u as eo,v as to,w as no,y as ro}from"./task-groups-CC8zwSMv.js";import{t as q}from"./status-dot-DtAOFiIi.js";import{a as io,c as ao,i as J,l as oo,n as so,o as co,r as lo,s as uo,t as fo}from"./command-CDt1BsZy.js";import{i as po,r as mo,t as ho}from"./project-order-AcHI4Dcl.js";import{a as go,c as _o,d as vo,f as yo,i as bo,n as xo,o as So,p as Co,r as wo,t as To,u as Eo}from"./skills-pM_PouEs.js";import{r as Do,t as Oo}from"./agents-settings-path-7X6_cvUg.js";import{t as ko}from"./centered-state-V15AR_qo.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 Ao=class extends f{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 $t({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=jo(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=jo(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=jo(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=jo(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){I.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=>xe(t,e))}findAll(e={}){return this.getAll().filter(t=>xe(e,t))}notify(e){I.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return I.batch(()=>Promise.all(e.map(e=>e.continue().catch(P))))}};function jo(e){return e.options.scope?.id}var Mo=class extends f{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??qe(r,t),a=this.get(i);return a||(a=new Ke({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(){I.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=>Ye(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ye(e,t)):t}notify(e){I.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){I.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){I.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},No=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Mo,this.#t=e.mutationCache||new Ao,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Fe.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Oe.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(le(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=De(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return I.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;I.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return I.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=I.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(P).catch(P)}invalidateQueries(e,t={}){return I.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=I.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(P)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(P)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(le(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(P).catch(P)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(P).catch(P)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Oe.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(ve(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{g(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ve(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{g(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||=qe(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===ee&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Y=e(t(),1),Po=n(),Fo=at().regex(/^(?:(?:config\.json(?:\.bak)?|agent-accounts\.json|ui-state\.json|server\.json|server\.install\.lock)|(?:remote-settings|server-instances)\/[a-zA-Z0-9-]+\.(?:json|install\.lock))$/),Io=$e({file:Fo,detectedAt:ot(),canRestore:rt()}),Lo=[`reset`,`outside-write`,`legacy-change`],Ro=$e({files:nt(et(`reason`,[Io.extend({reason:tt(`reset`)}),Io.extend({reason:tt(`outside-write`)}),Io.extend({reason:tt(`legacy-change`),canImport:rt()})]))});function zo(e,t){return!e||typeof e!=`object`||!(`files`in e)||!Array.isArray(e.files)?e:{...e,files:e.files.filter(e=>!(e&&typeof e==`object`&&`reason`in e&&typeof e.reason==`string`&&!t.includes(e.reason)))}}var Bo=it(e=>zo(e,Lo),Ro);$e({file:Fo,detectedAt:ot()}).strict();async function Vo(e,t,n){n.throwIfAborted();let r=new Ie(e,{queryKey:t.queryKey,queryFn:t.queryFn,retry:!1,enabled:!1}).subscribe(()=>void 0);n.addEventListener(`abort`,r,{once:!0});try{return await e.fetchQuery({...t,retry:!1})}finally{n.removeEventListener(`abort`,r),r()}}var Ho=[`workspace`,`home-recovery`];function Uo(e){let t=Bo.safeParse(e);if(!t.success)throw new je(200,`the Squawk server answered /home/recovery with an unexpected body`);return t.data}async function Wo(e){return Uo(await ke(await Te.api.v1.home.recovery.$get({},Pe(e)),`/home/recovery`))}function Go(){return pn({queryKey:Ho,queryFn:({signal:e})=>Wo({signal:e}),enabled:O(),staleTime:1/0,retry:!1})}function Ko(){let e=F();(0,Y.useEffect)(()=>{let t=!0,n=new AbortController,r,i=async t=>{he()&&await Vo(e,{queryKey:Ho,queryFn:({signal:e})=>Wo({signal:e}),staleTime:0},t?AbortSignal.any([n.signal,t]):n.signal)},a=n=>{let r;try{r=Uo(n)}catch{i().catch(()=>{});return}e.cancelQueries({queryKey:Ho,exact:!0}).then(()=>{t&&he()&&e.setQueryData(Ho,r)})},o=()=>{he()&&!r?r=Jn(`home:recovery`,a):!he()&&r&&(r(),r=void 0)};o();let s=C(t=>{o(),t?i().catch(()=>{}):e.cancelQueries({queryKey:Ho,exact:!0})}),c=ie(e=>i(e));return()=>{t=!1,n.abort(),c(),s(),r?.()}},[e])}function qo(e,t){let n=t===`config.json`?[L.projects,L.config,L.runsIndex]:t===`agent-accounts.json`?[L.agentProfiles,L.providerStatus]:t===`ui-state.json`?[L.uiState]:[];for(let t of n)e.invalidateQueries({queryKey:t})}function Jo(e){let t=F();return qt({mutationFn:async t=>Uo(await ke(await Te.api.v1.home.recovery[e].$post({json:t}),`/home/recovery/${e}`)),onSuccess:async(e,n)=>{await t.cancelQueries({queryKey:Ho,exact:!0}),t.setQueryData(Ho,e),qo(t,n.file)}})}var Yo=()=>Jo(`restore`),Xo=()=>Jo(`accept`),Zo=()=>Jo(`import`);function Qo(){return Ko(),null}function $o(){return new No({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof je&&t.status>=400&&t.status<500?!1:e<1},mutations:{retry:!1}}})}var es=Y.createContext(null),X=i(),ts=class extends Y.Component{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:Error(String(e))}}componentDidCatch(e,t){console.error(`Squawk cockpit: uncaught render error`,e,t.componentStack)}render(){let{error:e}=this.state;return e?(0,X.jsxs)(`div`,{"data-slot":`app-error`,role:`alert`,style:{display:`flex`,minHeight:`100dvh`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:`12px`,padding:`24px`,textAlign:`center`,font:`14px/1.5 system-ui, sans-serif`},children:[(0,X.jsx)(`h1`,{style:{fontSize:`20px`,fontWeight:600,margin:0},children:`The cockpit hit an error`}),(0,X.jsxs)(`p`,{style:{margin:0,maxWidth:`52ch`},children:[`Reload to carry on. Nothing on disk changed — Squawk’s state lives in`,` `,(0,X.jsx)(`code`,{children:`.ai/cezar/`}),`, and this page never wrote to it.`]}),(0,X.jsx)(`pre`,{"data-slot":`app-error-detail`,style:{margin:0,maxWidth:`100%`,overflowX:`auto`,textAlign:`left`,opacity:.75},children:e.message}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>location.reload(),style:{padding:`6px 14px`,cursor:`pointer`},children:`Reload`})]}):this.props.children}},ns=H(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),rs=H(`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`}]]),is=H(`brush`,[[`path`,{d:`m11 10 3 3`,key:`fzmg1i`}],[`path`,{d:`M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z`,key:`p4q2r7`}],[`path`,{d:`M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031`,key:`wy6l02`}]]),as=H(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),os=H(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ss=H(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),cs=H(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),ls=H(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),us=H(`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`}]]),ds=H(`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`}]]),fs=H(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),ps=H(`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`}]]),ms=H(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),hs=H(`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`}]]),gs=H(`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`}]]),_s=H(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),vs=H(`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`}]]),ys=H(`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`}]]),bs=H(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),xs=H(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Ss=H(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),Cs=H(`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`}]]),ws=H(`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`}]]),Ts=H(`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`}]]),Es=H(`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`}]]),Ds=H(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Os=H(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),ks=H(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),As=H(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),js=H(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Ms=`cezar:open-command-palette`;function Ns(){window.dispatchEvent(new Event(Ms))}var Ps=`cez-sidebar-width`;function Fs(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(420,Math.max(264,Math.round(t))):264}function Is(){try{let e=localStorage.getItem(Ps);return e===null?264:Fs(e)}catch{return 264}}function Ls(e){try{localStorage.setItem(Ps,String(Fs(e)))}catch{}}var Rs=Y.createContext(264),zs=Y.createContext(void 0);function Bs(){return Y.useContext(zs)}var Vs=`AlertDialog`,[Hs,Us]=Ni(Vs,[ea]),Ws=ea(),Gs=e=>{let{__scopeAlertDialog:t,...n}=e,r=Ws(t);return(0,X.jsx)(aa,{...r,...n,modal:!0})};Gs.displayName=Vs;var Ks=`AlertDialogTrigger`,qs=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Ws(n);return(0,X.jsx)(Qi,{...i,...r,ref:t})});qs.displayName=Ks;var Js=`AlertDialogPortal`,Ys=e=>{let{__scopeAlertDialog:t,...n}=e,r=Ws(t);return(0,X.jsx)(na,{...r,...n})};Ys.displayName=Js;var Xs=`AlertDialogOverlay`,Zs=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Ws(n);return(0,X.jsx)(Zi,{...i,...r,ref:t})});Zs.displayName=Xs;var Qs=`AlertDialogContent`,[$s,ec]=Hs(Qs),tc=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=Ws(n),o=Ai(t,Y.useRef(null)),s=Y.useRef(null);return(0,X.jsx)($s,{scope:n,cancelRef:s,children:(0,X.jsx)(ra,{role:`alertdialog`,...a,...i,ref:o,onOpenAutoFocus:Pi(i.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})});tc.displayName=Qs;var nc=`AlertDialogTitle`,rc=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Ws(n);return(0,X.jsx)(ia,{...i,...r,ref:t})});rc.displayName=nc;var ic=`AlertDialogDescription`,ac=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Ws(n);return(0,X.jsx)($i,{...i,...r,ref:t})});ac.displayName=ic;var oc=`AlertDialogAction`,sc=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Ws(n);return(0,X.jsx)(ta,{...i,...r,ref:t})});sc.displayName=oc;var cc=`AlertDialogCancel`,lc=Y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=ec(cc,n),a=Ws(n),o=Ai(t,i);return(0,X.jsx)(ta,{...a,...r,ref:o})});lc.displayName=cc;var uc=Gs,dc=Ys,fc=Zs,pc=tc,mc=sc,hc=lc,gc=rc,_c=ac,[vc,yc]=Ni(`Tooltip`,[sa]),bc=sa(),xc=`TooltipProvider`,Sc=700,Cc=`tooltip.open`,[wc,Tc]=vc(xc),Ec=e=>{let{__scopeTooltip:t,delayDuration:n=Sc,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=Y.useRef(!0),s=Y.useRef(!1),c=Y.useRef(0);return Y.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,X.jsx)(wc,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:Y.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:Y.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:Y.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Ec.displayName=xc;var Dc=`Tooltip`,[Oc,kc]=vc(Dc),Ac=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Tc(Dc,e.__scopeTooltip),l=bc(t),[u,d]=Y.useState(null),f=Ji(),p=Y.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=Y.useRef(!1),[_,v]=Fi({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Cc))):c.onClose(),a?.(e)},caller:Dc}),y=Y.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=Y.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=Y.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=Y.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return Y.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,X.jsx)(ca,{...l,children:(0,X.jsx)(Oc,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:Y.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:Y.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};Ac.displayName=Dc;var jc=`TooltipTrigger`,Mc=Y.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=kc(jc,n),a=Tc(jc,n),o=bc(n),s=Ai(t,Y.useRef(null),i.onTriggerChange),c=Y.useRef(!1),l=Y.useRef(!1),u=Y.useCallback(()=>c.current=!1,[]);return Y.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,X.jsx)(da,{asChild:!0,...o,children:(0,X.jsx)(Mi.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:Pi(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:Pi(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:Pi(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:Pi(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Pi(e.onBlur,i.onClose),onClick:Pi(e.onClick,i.onClose)})})});Mc.displayName=jc;var Nc=`TooltipPortal`,[Pc,Fc]=vc(Nc,{forceMount:void 0}),Ic=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=kc(Nc,t);return(0,X.jsx)(Pc,{scope:t,forceMount:n,children:(0,X.jsx)(Xi,{present:n||a.open,children:(0,X.jsx)(qi,{asChild:!0,container:i,children:r})})})};Ic.displayName=Nc;var Lc=`TooltipContent`,Rc=Y.forwardRef((e,t)=>{let n=Fc(Lc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=kc(Lc,e.__scopeTooltip);return(0,X.jsx)(Xi,{present:r||o.open,children:o.disableHoverableContent?(0,X.jsx)(Uc,{side:i,...a,ref:t}):(0,X.jsx)(zc,{side:i,...a,ref:t})})}),zc=Y.forwardRef((e,t)=>{let n=kc(Lc,e.__scopeTooltip),r=Tc(Lc,e.__scopeTooltip),i=Y.useRef(null),a=Ai(t,i),[o,s]=Y.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=Y.useCallback(()=>{s(null),d(!1)},[d]),p=Y.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=qc(r,Kc(r,n.getBoundingClientRect())),a=Jc(t.getBoundingClientRect()),o=Xc([...i,...a]);s(o),d(!0)},[d]);return Y.useEffect(()=>()=>f(),[f]),Y.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),Y.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Yc(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,X.jsx)(Uc,{...e,ref:a})}),[Bc,Vc]=vc(Dc,{isInside:!1}),Hc=ji(`TooltipContent`),Uc=Y.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=kc(Lc,n),l=bc(n),{onClose:u}=c;return Y.useEffect(()=>(document.addEventListener(Cc,u),()=>document.removeEventListener(Cc,u)),[u]),Y.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,X.jsx)(Yi,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,X.jsxs)(ua,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,X.jsx)(Hc,{children:r}),(0,X.jsx)(Bc,{scope:n,isInside:!0,children:(0,X.jsx)(Yr,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Rc.displayName=Lc;var Wc=`TooltipArrow`,Gc=Y.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=bc(n);return Vc(Wc,n).isInside?null:(0,X.jsx)(la,{...i,...r,ref:t})});Gc.displayName=Wc;function Kc(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function qc(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Jc(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Yc(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Xc(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Zc(t)}function Zc(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Qc=Ec,$c=Ac,el=Mc,tl=Ic,nl=Rc,rl=Gc;function il({open:e,onOpenChange:t}){let[n,r]=(0,Y.useState)(null),[i,a]=(0,Y.useState)(null),o=tn(),s=Wt(),c=Sn(),l=new Set((o.data?.projects??[]).map(e=>e.root)),u=e=>{r(e),a(null),s.reset()},d=fi(n,i);return(0,X.jsx)(wa,{open:e,onOpenChange:t,children:(0,X.jsxs)(Sa,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(xa,{children:[(0,X.jsx)(Ca,{children:`Open local folder`}),(0,X.jsx)(ya,{children:`Pick the folder Squawk should run in. Git repos are marked; any folder works.`})]}),(0,X.jsxs)(ba,{className:`space-y-4`,children:[(0,X.jsx)(pi,{path:n,selected:i,onSelect:a,onEnter:u,emptyHint:`No subfolders here — “Add project” registers this folder.`,decorate:e=>(0,X.jsxs)(X.Fragment,{children:[e.isRepo?(0,X.jsx)(_a,{variant:`outline`,className:`shrink-0 text-[12px]`,children:`git`}):null,l.has(e.path)?(0,X.jsx)(_a,{variant:`ghost`,className:`shrink-0 text-[12px] text-muted-foreground`,children:`already added`}):null]})}),s.isError?(0,X.jsx)(`p`,{"data-slot":`add-project-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not add that folder`}):null]}),(0,X.jsxs)(va,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,X.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-[11px] text-muted-foreground`,title:d??void 0,children:d??``}),(0,X.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,X.jsx)(U,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(U,{"data-slot":`add-project-confirm`,disabled:d===null||s.isPending,onClick:()=>{d===null||s.isPending||s.mutate(d,{onSuccess:({project:e})=>{t(!1),c(`/p/${encodeURIComponent(e.id)}/`)}})},children:s.isPending?`Adding…`:`Add project`})]})]})]})})}function al(e,t){let[n,r]=(0,Y.useState)(null),i=(0,Y.useMemo)(()=>`${e}${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),a=(0,Y.useRef)(i);return a.current=i,(0,Y.useEffect)(()=>kn((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===a.current&&(n.phase===`cloning`&&n.line?r(n.line):n.phase!==`cloning`&&r(null))}),[]),(0,Y.useEffect)(()=>ie(async e=>{if(!t)return;let n=await S(i,{signal:e}).catch(()=>null);if(!n)return;let{progress:o}=n;e.aborted||o?.checkoutId!==a.current||r(o?.phase===`cloning`?o.line??null:null)}),[t,i]),{checkoutId:i,progress:n,setProgress:r}}function ol({className:e,type:t,...n}){return(0,X.jsx)(`input`,{type:t,"data-slot":`input`,className:c(`h-11 w-full min-w-0 rounded-md border border-control-border bg-[var(--task-brand-bg)] px-3 py-1 text-base shadow-none transition-[color,box-shadow] outline-hidden selection:bg-accent-strong selection:text-accent-strong-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-soft-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20`,e),...n})}function sl(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 cl({open:e,onOpenChange:t}){let[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(!1),c=(0,Y.useRef)(!1),l=tn(),u=Gt(),{mutate:d,isPending:f}=u,p=Sn(),m=sl(u.error),{checkoutId:h,progress:g,setProgress:_}=al(`co-`,f),v=(0,Y.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),y=i.trim()===``?v:i.trim(),b=l.data?.projectsDir??``,x=y===``?``:`${b.replace(/\/+$/,``)}/${y}`,S=(0,Y.useCallback)(()=>{n.trim()===``||f||(c.current=!1,s(!1),_(null),d({url:n.trim(),checkoutId:h,...i.trim()===``?{}:{name:i.trim()}},{onSuccess:({project:e})=>{t(!1),p(`/p/${encodeURIComponent(e.id)}/`)}}))},[d,f,h,i,p,t,n]);return(0,Y.useEffect)(()=>{if(!o)return;let e=()=>{c.current&&(c.current=!1,s(!1),S())},t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[o,S]),(0,X.jsx)(wa,{open:e,onOpenChange:e=>u.isPending?void 0:t(e),children:(0,X.jsxs)(Sa,{"data-slot":`clone-project-dialog`,className:`min-w-0 max-h-[calc(100dvh-2rem)] overflow-x-hidden overflow-y-auto sm:max-w-lg`,children:[(0,X.jsxs)(xa,{children:[(0,X.jsx)(Ca,{children:`Clone from GitHub`}),(0,X.jsxs)(ya,{children:[`Squawk clones with `,(0,X.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(An,{htmlFor:`clone-url`,children:`Repository`}),(0,X.jsx)(ol,{id:`clone-url`,"data-slot":`clone-url`,autoFocus:!0,placeholder:`owner/repo or https://github.com/owner/repo`,value:n,disabled:u.isPending,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&S()}})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(An,{htmlFor:`clone-name`,children:`Folder name`}),(0,X.jsx)(ol,{id:`clone-name`,"data-slot":`clone-name`,placeholder:v===``?`repo`:v,value:i,disabled:u.isPending,onChange:e=>a(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-[11px] text-soft-foreground`,title:x,children:x}),u.isPending?(0,X.jsx)(U,{"data-slot":`clone-root-settings`,variant:`ghost`,size:`icon-sm`,className:`size-7`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,disabled:!0,children:(0,X.jsx)(lr,{className:`size-3.5`,"aria-hidden":`true`})}):(0,X.jsx)(U,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,X.jsx)(z,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,X.jsx)(lr,{className:`size-3.5`,"aria-hidden":`true`})})})]})]}),u.isPending?(0,X.jsx)(`p`,{"data-slot":`clone-progress`,className:`truncate font-mono text-[11px] text-muted-foreground`,children:g??`Starting the clone…`}):null,u.isError?(0,X.jsx)(`div`,{"data-slot":`clone-error`,className:`grid min-w-0 gap-1.5 text-[13px] text-danger`,children:m?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{children:`GitHub requires SAML authorization for this organization.`}),(0,X.jsxs)(`p`,{children:[(0,X.jsx)(`a`,{"data-slot":`clone-sso-link`,className:`inline-flex min-h-11 items-center font-medium underline underline-offset-2`,href:m,target:`_blank`,rel:`noreferrer`,onClick:()=>{c.current=!0,s(!0)},children:`Authorize this GitHub organization`}),o?` — return here after authorizing, or choose Retry clone.`:` — return to this tab to retry, or choose Retry clone.`]}),(0,X.jsxs)(`details`,{className:`min-w-0`,children:[(0,X.jsx)(`summary`,{className:`min-h-11 content-center`,children:`Error details`}),(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-all`,children:u.error instanceof Error?u.error.message:null})]})]}):(0,X.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-all`,children:u.error instanceof Error?u.error.message:`could not clone that repository`})}):null,(0,X.jsxs)(va,{children:[(0,X.jsx)(U,{variant:`outline`,disabled:u.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(U,{"data-slot":`clone-confirm`,disabled:n.trim()===``||y===``||u.isPending,onClick:S,children:u.isPending?`Cloning…`:u.isError?`Retry clone`:`Clone`})]})]})})}var ll=[{slug:`github/codespaces-nextjs`,label:`Next.js`,description:`Minimal Next.js app (GitHub)`},{slug:`vercel/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 ul(e){let t=e.trim().toLowerCase();return t===``||ll.some(e=>e.slug.toLowerCase()===t)?ll:ll.filter(e=>[e.label,e.slug,e.description].some(e=>e.toLowerCase().includes(t)))}function dl({value:e,onChange:t,disabled:n,id:r}){let i=(0,Y.useId)(),a=ul(e),[o,s]=(0,Y.useState)(-1),l=(0,Y.useRef)(null);(0,Y.useEffect)(()=>s(-1),[e]),(0,Y.useEffect)(()=>{o<0||l.current?.querySelector(`[data-index="${o}"]`)?.scrollIntoView?.({block:`nearest`})},[o]);let u=e=>`${i}-option-${e}`;return(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-1.5`,children:[(0,X.jsx)(ol,{id:r,"data-slot":`create-project-template`,role:`combobox`,"aria-expanded":`true`,"aria-controls":i,"aria-autocomplete":`list`,"aria-activedescendant":o>=0?u(o):void 0,autoComplete:`off`,spellCheck:!1,placeholder:`owner/repo or https://github.com/owner/repo`,value:e,disabled:n,onChange:e=>t(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),a.length===0)return;let t=e.key===`ArrowDown`;s(e=>e<0?t?0:a.length-1:(e+(t?1:-1)+a.length)%a.length)}else if(e.key===`Enter`&&o>=0){e.preventDefault(),e.stopPropagation();let n=a[o];n&&t(n.slug)}}}),(0,X.jsx)(`ul`,{ref:l,id:i,role:`listbox`,"aria-label":`Suggested templates`,"data-slot":`create-project-template-list`,className:`max-h-48 min-h-0 overflow-y-auto overscroll-contain rounded-md border border-border`,children:a.length===0?(0,X.jsx)(`li`,{className:`px-3 py-2 text-xs text-muted-foreground`,role:`presentation`,children:`No suggestion matches — any GitHub template repository works.`}):a.map((r,i)=>{let a=r.slug.toLowerCase()===e.trim().toLowerCase();return(0,X.jsxs)(`li`,{id:u(i),role:`option`,"aria-selected":a,"data-index":i,"data-value":r.slug,"data-slot":`create-project-template-option`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n||t(r.slug)},className:c(`grid min-h-11 cursor-pointer content-center gap-0.5 px-3 py-1.5 text-start`,`pointer-hover:hover:bg-accent`,i===o&&`bg-accent`,a&&`font-medium`),children:[(0,X.jsxs)(`span`,{className:`truncate text-[13px]`,children:[r.label,` `,(0,X.jsx)(`span`,{className:`font-mono text-[11px] text-soft-foreground`,children:r.slug})]}),(0,X.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:r.description})]},r.slug)})})]})}function fl({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`skeleton`,className:c(`animate-pulse rounded-md bg-accent`,e),...t})}function pl(e){return{available:e.data?.available?e.data.owners:null,unavailableReason:e.isError?`GitHub is unavailable: ${e.error instanceof Error?e.error.message:`could not ask gh`}`:e.data&&!e.data.available?e.data.reason:null}}function ml(e,t){return e&&t!==null&&t.length>0}function hl(e,t){return e??t?.[0]?.login??null}function gl(e){return(e.data?.projectsDir??``).replace(/\/+$/,``)}function _l({nameValid:e,isPending:t,created:n,github:r,chosenOwner:i,effectiveStart:a,template:o}){return e&&!t&&n===null&&(!r||i!==null&&(a===`empty`||o.trim()!==``))}function vl({trimmed:e,checkoutId:t,github:n,chosenOwner:r,effectiveStart:i,template:a}){return{name:e,checkoutId:t,...n&&r?{github:{owner:r,...i===`template`?{template:a.trim()}:{}}}:{}}}function yl({created:e}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Mr,{"aria-hidden":`true`,className:`mbs-0.5 size-5 shrink-0 text-warning`}),(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:`The project was created, but its GitHub repository is not finished.`}),(0,X.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-words font-mono text-xs`,children:e.warning})]})]})}function bl({fieldId:e,name:t,setName:n,trimmed:r,nameValid:i,projectsDir:a,isPending:o,create:s}){let c=`${e}-name-hint`;return(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(An,{htmlFor:`${e}-name`,children:`Name`}),(0,X.jsx)(ol,{id:`${e}-name`,"data-slot":`create-project-name`,autoFocus:!0,autoComplete:`off`,spellCheck:!1,placeholder:`my-project`,value:t,disabled:o,"aria-invalid":r!==``&&!i,"aria-describedby":r!==``&&!i?c:void 0,onChange:e=>n(e.target.value.replace(/\s/g,`-`)),onKeyDown:e=>{e.key===`Enter`&&s()}}),r!==``&&!i?(0,X.jsx)(`p`,{id:c,"data-slot":`create-project-name-hint`,className:`text-xs text-danger`,children:`Use letters, digits, “.”, “-” and “_” only, starting with a letter or digit — it names the folder and the repository.`}):null,(0,X.jsx)(`p`,{"data-slot":`create-project-path`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,title:`${a}/${r}`,children:r===``?`${a}/…`:`${a}/${r}`})]})}function xl({fieldId:e,github:t,setGithubOn:n,isPending:r,available:i}){return(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(oa,{id:`${e}-github`,"data-slot":`create-project-github`,checked:t,disabled:r||i===null||i.length===0,onCheckedChange:n,className:`mbs-0.5`}),(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-0.5`,children:[(0,X.jsx)(An,{htmlFor:`${e}-github`,children:`Also create a private GitHub repository`}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Under the account you choose. You can change its visibility on GitHub later.`})]})]})}function Sl({fieldId:e,effectiveStart:t,setStart:n,isPending:r,github:i,template:a,setTemplate:o}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`fieldset`,{className:`grid gap-2`,disabled:r,children:[(0,X.jsx)(`legend`,{className:`mbe-2 text-sm font-medium`,children:`Start with`}),(0,X.jsx)(El,{slot:`create-project-start-empty`,name:`${e}-start`,checked:t===`empty`,disabled:r,onChange:()=>n(`empty`),title:`Empty repository`,detail:`One empty first commit, no files.`}),(0,X.jsx)(El,{slot:`create-project-start-template`,name:`${e}-start`,checked:t===`template`,disabled:r||!i,onChange:()=>n(`template`),title:`From a template`,detail:i?`GitHub generates the repository from a template.`:`Needs the GitHub repository.`})]}),t===`template`?(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(An,{htmlFor:`${e}-template`,children:`Template`}),(0,X.jsx)(dl,{id:`${e}-template`,value:a,onChange:o,disabled:r})]}):null]})}function Cl({isPending:e,progress:t,failed:n,error:r}){return(0,X.jsxs)(X.Fragment,{children:[e?(0,X.jsx)(`p`,{"data-slot":`create-project-progress`,className:`flex-none truncate font-mono text-[11px] text-muted-foreground`,children:t??`Starting…`}):null,n?(0,X.jsx)(`p`,{"data-slot":`create-project-error`,role:`alert`,className:`flex-none min-w-0 whitespace-pre-wrap break-words text-[13px] text-danger`,children:r instanceof Error?r.message:`could not create the project`}):null]})}function wl({created:e,goToProject:t,isPending:n,onCancel:r,ready:i,onCreate:a,failed:o}){return(0,X.jsx)(va,{className:`flex-none`,children:e?(0,X.jsx)(U,{"data-slot":`create-project-open`,onClick:t,children:`Go to project`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(U,{variant:`outline`,disabled:n,onClick:r,children:`Cancel`}),(0,X.jsx)(U,{"data-slot":`create-project-submit`,disabled:!i,onClick:a,children:n?`Creating…`:o?`Try again`:`Create project`})]})})}function Tl({open:e,onOpenChange:t}){let[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(`empty`),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(null),m=tn(),h=Ct({enabled:e}),g=Rt(),{mutate:_,isPending:v}=g,y=Sn(),b=(0,Y.useId)(),x=(0,Y.useRef)(!1),{checkoutId:S,progress:C,setProgress:w}=al(`np-`,v),{available:T,unavailableReason:E}=pl(h),D=ml(i,T),O=hl(o,T),k=D?c:`empty`,A=n.trim(),j=ae.test(A),M=gl(m),ee=_l({nameValid:j,isPending:v,created:f,github:D,chosenOwner:O,effectiveStart:k,template:u}),te=(0,Y.useCallback)(()=>{!ee||x.current||(x.current=!0,w(null),_(vl({trimmed:A,checkoutId:S,github:D,chosenOwner:O,effectiveStart:k,template:u}),{onSettled:()=>{x.current=!1},onSuccess:({project:e,warning:n})=>{if(n){p({projectId:e.id,warning:n});return}t(!1),y(`/p/${encodeURIComponent(e.id)}/`)}}))},[ee,_,A,S,D,O,k,u,t,y]);return(0,X.jsx)(wa,{open:e,onOpenChange:e=>v?void 0:t(e),children:(0,X.jsxs)(Sa,{"data-slot":`create-project-dialog`,className:`flex min-w-0 flex-col overflow-y-clip overflow-x-clip sm:max-w-2xl`,children:[(0,X.jsxs)(xa,{className:`flex-none`,children:[(0,X.jsx)(Ca,{children:`New project`}),(0,X.jsx)(ya,{children:`Squawk creates a git repository with one empty commit in your checkout root and adds it as a project.`})]}),f?(0,X.jsx)(`div`,{"data-slot":`create-project-warning`,role:`status`,className:`flex min-h-0 flex-1 gap-3 overflow-y-auto overscroll-contain rounded-md border border-border bg-muted p-4 text-[13px]`,children:(0,X.jsx)(yl,{created:f})}):(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-wrap gap-6 overflow-y-auto overscroll-contain`,children:[(0,X.jsxs)(`div`,{className:`grid min-w-[50%] grow-[999] basis-0 content-start gap-5`,children:[(0,X.jsx)(bl,{fieldId:b,name:n,setName:r,trimmed:A,nameValid:j,projectsDir:M,isPending:v,create:te}),(0,X.jsx)(xl,{fieldId:b,github:D,setGithubOn:a,isPending:v,available:T}),(0,X.jsx)(Sl,{fieldId:b,effectiveStart:k,setStart:l,isPending:v,github:D,template:u,setTemplate:d})]}),(0,X.jsx)(Dl,{owners:T,unavailableReason:E,enabled:D&&!v,chosen:O,onChoose:s,groupName:`${b}-owner`})]}),(0,X.jsx)(Cl,{isPending:v,progress:C,failed:g.isError,error:g.error}),(0,X.jsx)(wl,{created:f,goToProject:()=>{f&&(t(!1),y(`/p/${encodeURIComponent(f.projectId)}/`))},isPending:v,onCancel:()=>t(!1),ready:ee,onCreate:te,failed:g.isError})]})})}function El({slot:e,name:t,checked:n,disabled:r,onChange:i,title:a,detail:o}){return(0,X.jsxs)(`label`,{className:c(`flex min-h-11 items-start gap-3 rounded-md border border-border p-3`,`has-[:checked]:border-accent-strong has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-ring`,r?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,X.jsx)(`input`,{type:`radio`,"data-slot":e,name:t,checked:n,disabled:r,onChange:i,className:`mbs-0.5 size-4 accent-[var(--color-accent-strong)]`}),(0,X.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium`,children:a}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o})]})]})}function Dl({owners:e,unavailableReason:t,enabled:n,chosen:r,onChoose:i,groupName:a}){return(0,X.jsxs)(`fieldset`,{"data-slot":`create-project-owners`,disabled:!n,className:`grid min-w-0 grow basis-56 content-start gap-2`,children:[(0,X.jsx)(`legend`,{className:`mbe-2 text-sm font-medium`,children:`Repository owner`}),t===null?e===null?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(fl,{className:`h-14 w-full`}),(0,X.jsx)(fl,{className:`h-14 w-full`})]}):e.map(e=>(0,X.jsxs)(`label`,{"data-slot":`create-project-owner`,className:c(`flex min-h-11 min-w-0 items-center gap-3 rounded-md border border-border p-2.5`,`has-[:checked]:border-accent-strong has-[:checked]:bg-accent`,`has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-ring`,n?`cursor-pointer pointer-hover:hover:bg-accent`:`cursor-not-allowed opacity-60`),children:[(0,X.jsx)(`input`,{type:`radio`,name:a,value:e.login,checked:r===e.login,disabled:!n,onChange:()=>i(e.login),className:`sr-only`}),e.avatarUrl?(0,X.jsx)(`img`,{src:e.avatarUrl,alt:``,className:`size-8 shrink-0 rounded-full object-cover`}):(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-8 shrink-0 place-items-center rounded-full bg-muted text-xs font-medium uppercase`,children:e.login.slice(0,1)}),(0,X.jsxs)(`span`,{className:`grid min-w-0`,children:[(0,X.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.login}),(0,X.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.personal?`Personal account`:e.description??`Organization`})]})]},e.login)):(0,X.jsxs)(`p`,{"data-slot":`create-project-github-unavailable`,className:`rounded-md border border-border bg-muted p-3 text-xs text-muted-foreground break-words`,children:[t,`. Local projects still work.`]})]})}function Ol({triggerClassName:e,icon:t=er,iconClassName:n=`size-4`,side:r,origin:i,label:a,iconFrameClassName:o}={}){let[l,u]=Y.useState(!1),[d,f]=Y.useState(!1),[p,m]=Y.useState(!1);return(0,X.jsxs)(Gi,{children:[(0,X.jsx)(Hi,{asChild:!0,children:(0,X.jsxs)(U,{variant:`ghost`,"aria-label":`Add project`,title:`Add project`,"data-origin":i,className:c(`size-9 p-0 text-muted-foreground`,e),children:[o?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:o,children:(0,X.jsx)(t,{className:n,"aria-hidden":`true`})}):(0,X.jsx)(t,{className:n,"aria-hidden":`true`}),a?(0,X.jsx)(`span`,{children:a}):(0,X.jsx)(`span`,{className:`sr-only`,children:`Add project`})]})}),(0,X.jsxs)(Ui,{align:`start`,...s({side:r}),className:`w-56`,children:[(0,X.jsx)(Ii,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,X.jsxs)(W,{"data-slot":`add-project-new`,onSelect:()=>m(!0),children:[(0,X.jsx)(er,{"aria-hidden":`true`}),`New project…`]}),(0,X.jsxs)(W,{"data-slot":`add-project-local`,onSelect:()=>u(!0),children:[(0,X.jsx)(dr,{"aria-hidden":`true`}),`Open local folder…`]}),(0,X.jsxs)(W,{"data-slot":`add-project-clone`,onSelect:()=>f(!0),children:[(0,X.jsx)(ir,{"aria-hidden":`true`}),`Clone from GitHub…`]})]}),l?(0,X.jsx)(il,{open:!0,onOpenChange:u}):null,d?(0,X.jsx)(cl,{open:!0,onOpenChange:f}):null,p?(0,X.jsx)(Tl,{open:!0,onOpenChange:m}):null]})}var kl=[`done`,`failed`,`cancelled`];function Al(e){return kl.includes(e)}function jl(e){return!ge(e)&&Al(e.status)&&!no(e)}function Ml(e){return e.reduce((e,t)=>Ya(t)||!no(t)?e:e+1,0)}function Nl(e){return e.status===`failed`?`danger`:`success`}var Pl={needsYou:0,failedUnread:0,inMotion:0,finishedUnread:0};function Fl(e){let t={...Pl};for(let n of e)n.archived||Ya(n)||(j(n)?t.needsYou+=1:Ne(n).tone===`running`?t.inMotion+=1:no(n)&&(n.status===`failed`?t.failedUnread+=1:n.status===`done`&&(t.finishedUnread+=1)));return t}function Il(e){let t=new Map;for(let n of e){let e=t.get(n.projectId);e?e.push(n):t.set(n.projectId,[n])}return new Map([...t].map(([e,t])=>[e,Fl(t)]))}function Ll(e,t,n={}){if(n.unknown)return`${e} · activity unknown`;let r=Rl(t).map(e=>e.text);return[e,r.length>0?r.join(` · `):`idle`].join(` · `)}function Rl(e){let{needsYou:t,failedUnread:n,inMotion:r,finishedUnread:i}=e??Pl,a=[];return t>0&&a.push({tone:`amber`,text:`${t} needs you`}),n>0&&a.push({tone:`red`,text:`${n} failed`}),r>0&&a.push({tone:`violet`,text:`${r} working`}),i>0&&a.push({tone:`green`,text:`${i} finished`}),a}function zl(e){let t={...Pl};for(let n of e)n&&(t.needsYou+=n.needsYou,t.failedUnread+=n.failedUnread,t.inMotion+=n.inMotion,t.finishedUnread+=n.finishedUnread);return t}function Bl(e){let t=e.split(/[-_ .]+/).filter(e=>e!==``);return(t.length>=2?[t[0],t[1]].map(e=>[...e][0]):[...t[0]??``].slice(0,2)).join(``).toLowerCase()}var Vl=`w-[228px] rounded-[10px] border-border bg-sidebar p-[5px] text-foreground shadow-[0_10px_28px_#00000047] motion-reduce:animate-none`,Hl=`h-8 gap-2.5 rounded-[6px] px-[9px] py-0 text-[13px] focus:bg-sidebar-row-hover focus:text-foreground [&_svg]:size-[15px] [&_svg]:text-soft-foreground focus:[&_svg]:text-foreground max-md:min-h-11`;function Ul(){let e=Ma(),t=St(),n=tn(),r=n.data?.bootProject??t.data?.bootProject,i=e??r??null,a=n.data?.projects.find(e=>e.id===i),o=i===r?t.data?.repo:void 0,s=a?.root??o?.root;return{health:t,registry:n,projectId:i,project:a,root:s,name:a?.name??s?.split(/[\\/]/).filter(Boolean).at(-1),branch:o?.branch??a?.branch}}function Wl({onNavigate:e}={}){let t=(0,Y.useRef)(null),n=(0,Y.useRef)(null),[r,i]=(0,Y.useState)(0),{health:a,registry:o,projectId:s,root:c,name:l,branch:u}=Ul(),d=a.data?.capabilities.localHandoff===!0,f=l??(o.isPending?`Loading project…`:`Project unavailable`),p=[d?c:void 0,u].filter(Boolean).join(` · `);return(0,X.jsxs)(`div`,{"data-slot":`project-header`,className:`flex min-w-0 items-center gap-2.5 px-[14px] pt-[14px] pb-2.5`,children:[(0,X.jsx)(`span`,{ref:t,"aria-hidden":`true`,"data-slot":`project-header-mark`,className:`flex size-7 shrink-0 items-center justify-center rounded-[7px] border border-soft-foreground bg-sidebar-row-selected text-[11px] leading-none font-semibold text-foreground`,children:l?Bl(l):`…`}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-px`,children:[(0,X.jsx)(`div`,{"data-slot":`project-header-name`,className:`truncate text-[14px] font-semibold text-foreground`,title:f,children:f}),(0,X.jsx)(`div`,{"data-slot":`project-header-detail`,dir:`rtl`,className:`truncate text-left font-mono text-[10.5px] text-soft-foreground`,title:p||void 0,children:(0,X.jsx)(`bdi`,{dir:`ltr`,children:p||(o.isPending?`Loading…`:`Branch unavailable`)})})]}),(0,X.jsx)(Yl,{projectId:s,onNavigate:e,triggerRef:n,triggerClassName:`size-7 max-md:size-11`,align:`start`,alignOffset:r,onOpenChange:e=>{e&&t.current&&n.current&&i(t.current.getBoundingClientRect().left-n.current.getBoundingClientRect().left)}})]})}function Gl(e,t,n){let r=e.data?.bootProject??t.data?.bootProject,i=e.data?.projects.find(e=>e.id===n),a=n===r?t.data?.repo:void 0;return{bootId:r,project:i,root:i?.root??a?.root}}function Kl({marking:e,runs:t,unread:n,projectId:r}){return e||t.isError||t.data===void 0||n.length===0||r===null}function ql({marking:e,runs:t,unread:n}){return e?`Marking…`:t.isError?`Unavailable`:t.data===void 0?`Loading…`:`${n.length} unread`}function Jl(e,t){return!e||t?.status===`missing`}function Yl({projectId:e,onNavigate:t,triggerRef:n,triggerClassName:r,align:i=`start`,alignOffset:a,side:o,onOpenChange:l}){let u=Bs(),d=St(),f=tn(),[p,m]=(0,Y.useState)(!1),{bootId:h,project:g,root:_}=Gl(f,d,e),v=sn(e??`default`,e!==null,e===h),y=wt(Zt({projectId:e??`default`,boot:e===h})),b=(0,Y.useRef)(e);b.current=e;let x=d.data?.capabilities.localHandoff===!0,S=(v.data??[]).filter(e=>!Ya(e)&&no(e));async function C(){m(!0);let t=0;try{for(let n of S){if(b.current!==e)break;try{await y.mutateAsync(n.id)}catch{t+=1}}t>0&&V(`Could not mark ${t} task${t===1?``:`s`} read. Try again.`,{tone:`danger`})}finally{m(!1)}}async function w(){if(_)try{await navigator.clipboard.writeText(_),V(`Project folder copied`)}catch{V(`Could not copy path: ${_}`,{tone:`danger`})}}return(0,X.jsxs)(Gi,{...s({onOpenChange:l}),children:[(0,X.jsx)(Hi,{asChild:!0,children:(0,X.jsx)(`button`,{"data-slot":`project-menu-trigger`,ref:n,type:`button`,"aria-label":`Project menu`,className:c(`flex shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-[state=open]:bg-sidebar-row-selected data-[state=open]:text-foreground`,r),children:(0,X.jsx)(ms,{"aria-hidden":`true`,className:`size-[15px]`})})}),(0,X.jsxs)(Ui,{align:i,...s({alignOffset:a,side:o}),sideOffset:4,className:Vl,children:[(0,X.jsxs)(W,{className:Hl,disabled:Kl({marking:p,runs:v,unread:S,projectId:e}),onSelect:()=>{C()},children:[(0,X.jsx)(as,{"aria-hidden":`true`}),` Mark all read`,(0,X.jsx)(`span`,{className:`ml-auto text-[11.5px] text-soft-foreground`,children:ql({marking:p,runs:v,unread:S})})]}),(0,X.jsx)(Bi,{className:`mx-0`}),x&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Xl,{projectId:e??`default`,disabled:Jl(_,g)}),(0,X.jsxs)(W,{className:Hl,disabled:!_,onSelect:()=>{w()},children:[(0,X.jsx)(fs,{"aria-hidden":`true`}),` Copy path`]}),(0,X.jsx)(Bi,{className:`mx-0`})]}),(0,X.jsx)(W,{asChild:!0,className:Hl,children:(0,X.jsxs)(G,{to:`/settings`,onClick:t??u,children:[(0,X.jsx)(As,{"aria-hidden":`true`}),` Project settings`]})})]})]})}function Xl({disabled:e,projectId:t}){let n=bt(),r=qt({mutationFn:e=>x(e,t),onError:e=>V(e.message,{tone:`danger`}),onSuccess:()=>V(`Opening project folder`)}),i=(n.data?.targets??[]).filter(e=>Kr(e.id)===void 0);return(0,X.jsxs)(Ki,{children:[(0,X.jsxs)(zi,{className:Hl,disabled:e||r.isPending,children:[(0,X.jsx)(mi,{"aria-hidden":`true`}),` Open in`]}),(0,X.jsx)(Vi,{children:(0,X.jsxs)(Ri,{className:Vl,children:[i.map(e=>{let t=qr(e);return(0,X.jsxs)(W,{className:Hl,"data-target":e.id,onSelect:()=>r.mutate(e.id),children:[(0,X.jsx)(t,{"aria-hidden":`true`}),e.label]},e.id)}),i.length===0&&(0,X.jsx)(W,{className:Hl,disabled:!0,children:n.isError?`Apps unavailable`:n.isPending?`Loading apps…`:`No apps available`})]})})]})}var Zl={amber:`text-signal-word-amber`,red:`text-signal-word-red`,violet:`text-status-running`,green:`text-success`};function Ql({signal:e,known:t,current:n,maxParts:r,slot:i,className:a}){let o=Rl(e).slice(0,r);return(0,X.jsx)(`span`,{"data-slot":i,className:c(`flex min-w-0 items-center font-medium`,n?`text-muted-foreground`:`text-soft-foreground`,a),children:t?o.length===0?`idle`:o.map((e,t)=>(0,X.jsxs)(`span`,{className:`flex items-center gap-x-[inherit]`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,(0,X.jsx)(`span`,{"data-tone":e.tone,className:Zl[e.tone],children:e.text})]},e.tone)):`activity unknown`})}function $l(e,t){let n=e=>e.split(`.`).slice(0,3).map(e=>Number.parseInt(e,10)||0),r=n(e),i=n(t);for(let e=0;e<3;e++){let t=(r[e]??0)-(i[e]??0);if(t!==0)return t>0}return!1}var eu={amber:`bg-pending text-signal-ink-amber`,red:`bg-danger text-signal-ink`,violet:`bg-status-running text-signal-ink`,green:`bg-success text-signal-ink`};function tu(e,t,n){return e>9&&!(n&&t>1)?22:t===1?18:14}function nu({position:e,segments:t,className:n,compact:r=!1}){let i=t.filter(e=>e.count>0);return i.length===0?null:(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`rail-pill-${e}`,className:c(`pointer-events-none absolute -right-[4px] box-border flex h-[17px] overflow-hidden rounded-[9px] border-2 border-background`,e===`top`?`-top-[6px]`:`top-[25px]`,n),children:i.map(({tone:e,count:t})=>(0,X.jsx)(`span`,{"data-segment":e,"data-count":t,style:{width:tu(t,i.length,r)},className:c(`flex items-center justify-center text-[10px] leading-[13px] font-bold tabular-nums`,eu[e]),children:t>9?`9+`:t},e))})}function ru(e){return{top:[{tone:`amber`,count:e?.needsYou??0},{tone:`red`,count:e?.failedUnread??0}],bottom:[{tone:`violet`,count:e?.inMotion??0},{tone:`green`,count:e?.finishedUnread??0}]}}var iu=`cez-theme`,au=`(prefers-color-scheme: light)`,ou=`dark`;function su(e){return e===`light`||e===`dark`||e===`system`?e:ou}function cu(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function lu(){try{return su(localStorage.getItem(iu))}catch{return ou}}function uu(e){try{localStorage.setItem(iu,e)}catch{}}function du(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(au).matches}function fu(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t}function pu(e){return`/cezarion-mark-${e}.svg`}function mu(e){let t=document.querySelector(`link[rel="icon"]`);t&&(t.href=pu(e))}function hu(e){let t=document.querySelector(`meta[name="theme-color"]`),n=getComputedStyle(e).getPropertyValue(`--card`).trim();t&&n&&(t.content=n)}var gu=Y.createContext(null);function _u({children:e}){let[t,n]=Y.useState(lu),[r,i]=Y.useState(du);Y.useEffect(()=>{let e=window.matchMedia?.(au);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=cu(t,r);Y.useLayoutEffect(()=>{fu(document.documentElement,a),mu(a),hu(document.documentElement)},[a]);let o=Y.useCallback(e=>{n(e),uu(e)},[]),s=Y.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,X.jsx)(gu.Provider,{value:s,children:e})}function vu(){let e=Y.useContext(gu);if(!e)throw Error(`Squawk: useTheme() must be called inside <ThemeProvider>`);return e}var yu={light:`dark`,dark:`system`,system:`light`},bu={light:`light`,dark:`dark`,system:`system`};function xu({className:e,showLabel:t=!1,labelClassName:n}){let{theme:r,setTheme:i}=vu(),a=yu[r],o=Ir;return(0,X.jsxs)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":r,title:`Theme: ${bu[r]}`,"aria-label":`Theme: ${bu[r]}. Switch to ${bu[a]}.`,onClick:()=>i(a),children:[(0,X.jsx)(o,{"aria-hidden":`true`}),t?(0,X.jsxs)(`span`,{className:n,children:[`Theme · `,r.charAt(0).toUpperCase()+r.slice(1)]}):null]})}function Su({...e}){return(0,X.jsx)(aa,{"data-slot":`sheet`,...e})}function Cu({...e}){return(0,X.jsx)(Qi,{"data-slot":`sheet-trigger`,...e})}function wu({...e}){return(0,X.jsx)(ta,{"data-slot":`sheet-close`,...e})}function Tu({...e}){return(0,X.jsx)(na,{"data-slot":`sheet-portal`,...e})}function Eu({className:e,...t}){return(0,X.jsx)(Zi,{"data-slot":`sheet-overlay`,className:c(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Du({className:e,children:t,side:n=`right`,showCloseButton:r=!0,overlayClassName:i,...a}){return(0,X.jsxs)(Tu,{children:[(0,X.jsx)(Eu,{className:i}),(0,X.jsxs)(ra,{"data-slot":`sheet-content`,className:c(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition-colors ease-in-out motion-safe:data-[state=closed]:animate-out data-[state=closed]:duration-300 motion-safe:data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 end-0 h-full w-3/4 border-s motion-safe:data-[state=closed]:slide-out-to-right motion-safe:data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 start-0 h-full w-3/4 border-e motion-safe:data-[state=closed]:slide-out-to-left motion-safe:data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 inset-bs-0 h-auto border-be motion-safe:data-[state=closed]:slide-out-to-top motion-safe:data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 inset-be-0 h-auto border-bs motion-safe:data-[state=closed]:slide-out-to-bottom motion-safe:data-[state=open]:slide-in-from-bottom`,e),...a,children:[t,r&&(0,X.jsxs)(ta,{className:`absolute inset-bs-4 end-4 rounded-sm opacity-70 ring-offset-background transition-opacity pointer-hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,X.jsx)(xr,{className:`size-4`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Ou({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`sheet-header`,className:c(`flex flex-col gap-1.5 p-4`,e),...t})}function ku({className:e,...t}){return(0,X.jsx)(ia,{"data-slot":`sheet-title`,className:c(`font-semibold text-foreground`,e),...t})}function Au({className:e,...t}){return(0,X.jsx)($i,{"data-slot":`sheet-description`,className:c(`text-sm text-muted-foreground`,e),...t})}function ju(e,t){if(!e?.signals)return null;let n=e.signals;return zl(e.projects.filter(e=>e.id!==t).map(e=>n.get(e.id)))}function Mu(e){let t=Rl(e??void 0).map(e=>e.text);return t.length>0?`Open projects. Elsewhere: ${t.join(`, `)}`:`Open projects`}function Nu({elsewhere:e}){if(!e)return null;let{top:t,bottom:n}=ru(e),r=`right-[2px] border-card`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(nu,{position:`top`,segments:t,compact:!0,className:c(r,`top-[3px]`)}),(0,X.jsx)(nu,{position:`bottom`,segments:n,compact:!0,className:c(r,`top-[24px]`)})]})}function Pu({version:e,latestVersion:t=null}){let{resolvedTheme:n}=vu(),r=!!(e&&t&&$l(t,e));return(0,X.jsxs)(`div`,{"data-slot":`drawer-identity`,className:`flex shrink-0 items-center gap-[12px] border-b border-border pt-[env(safe-area-inset-top)] pr-[14px] pb-[14px] pl-[18px]`,children:[(0,X.jsx)(`img`,{src:`/cezarion-mark-${n}.svg`,alt:``,"aria-hidden":`true`,className:`mt-[14px] size-[32px] rounded-lg`}),(0,X.jsx)(`span`,{"data-slot":`drawer-wordmark`,className:`mt-[14px] text-[18px] leading-none font-bold tracking-[-0.02em] text-foreground`,children:`Squawk`}),e?(0,X.jsxs)(`span`,{"data-slot":`drawer-version`,"data-update-available":r?`true`:void 0,title:r?`v${e} — update available: v${t}`:`v${e}`,className:`mt-[14px] min-w-0 truncate text-[11px] leading-none text-soft-foreground`,children:[r?(0,X.jsx)(q,{tone:`pending`,className:`mr-1 inline-block size-[5px] align-middle`}):null,`v`,e]}):null,(0,X.jsx)(wu,{asChild:!0,children:(0,X.jsx)(U,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`mt-[14px] ml-auto size-[44px] text-foreground`,children:(0,X.jsx)(xr,{className:`size-[19px]`,"aria-hidden":`true`})})})]})}function Fu({project:e,signal:t,known:n,current:r,onNavigate:i}){let{top:a,bottom:o}=ru(t),s=r?`border-sidebar-row-selected`:`border-sidebar`,l=`right-[-4px]`,u=(0,X.jsxs)(z,{to:Ea(e.id,`/`),onClick:i,"data-slot":`drawer-project`,"data-project-id":e.id,"aria-current":r?`page`:void 0,className:c(`flex h-[64px] min-w-0 items-center gap-[12px] rounded-[10px] px-[10px] text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r&&`flex-1 hover:bg-sidebar-row-selected`),children:[(0,X.jsxs)(`span`,{"aria-hidden":`true`,className:c(`relative flex size-[40px] shrink-0 items-center justify-center rounded-[10px] border text-[13px] leading-none font-semibold`,r?`border-soft-foreground bg-sidebar text-foreground`:`border-transparent bg-muted text-muted-foreground`),children:[Bl(e.name),(0,X.jsx)(nu,{position:`top`,segments:a,className:c(l,s)}),(0,X.jsx)(nu,{position:`bottom`,segments:o,className:c(l,s,`top-[29px]`)})]}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsx)(`span`,{className:`truncate text-[14.5px] leading-tight font-semibold`,children:e.name}),(0,X.jsx)(Ql,{signal:t,known:n,current:r,slot:`drawer-project-state`,className:`flex-wrap gap-x-[6px] text-[11.5px] leading-tight`})]}),r?(0,X.jsx)(_r,{"aria-hidden":`true`,className:`size-[16px] shrink-0 text-foreground`}):null]});return r?(0,X.jsxs)(`div`,{"data-slot":`drawer-project-current`,className:`flex items-center rounded-[10px] bg-sidebar-row-selected pr-[4px]`,children:[u,(0,X.jsx)(Yl,{projectId:e.id,onNavigate:i,triggerClassName:`size-[44px]`,align:`end`})]}):u}var Iu=`flex h-[48px] w-full items-center gap-[12px] rounded-[10px] px-[10px] text-[14.5px] font-normal text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring [&_svg]:size-[18px] [&_svg]:shrink-0 [&_svg]:text-soft-foreground`;function Lu({nav:e,currentProjectId:t,onNavigate:n}){return(0,X.jsxs)(`div`,{"data-slot":`drawer-projects`,className:`shrink-0`,children:[(0,X.jsx)(`div`,{className:`px-[18px] pt-[14px] pb-[6px] text-[12px] font-medium text-soft-foreground`,id:`drawer-projects-label`,children:`Projects`}),(0,X.jsx)(`div`,{role:`group`,"data-slot":`drawer-projects-group`,"aria-labelledby":`drawer-projects-label`,className:`flex flex-col gap-[2px] px-[8px] pb-[8px]`,children:e.projects.map(r=>(0,X.jsx)(Fu,{project:r,signal:e.signals?.get(r.id),known:e.signals!==null,current:r.id===t,onNavigate:n},r.id))}),(0,X.jsxs)(`div`,{"data-slot":`drawer-workspace`,className:`flex flex-col gap-[2px] border-t border-border px-[8px] py-[8px]`,children:[(0,X.jsxs)(z,{to:`/tasks`,onClick:n,"data-slot":`drawer-all-projects`,className:Iu,children:[(0,X.jsx)(Gr,{"aria-hidden":`true`}),`All projects · task overview`]}),(0,X.jsx)(Ol,{origin:`mobile`,icon:er,iconClassName:`size-[18px]`,label:`Add project`,triggerClassName:c(Iu,`h-[48px] justify-start p-0 px-[10px] text-foreground`)})]})]})}function Ru({onNavigate:e,tools:t}){let{theme:n,setTheme:r}=vu(),i=yu[n],a=n.charAt(0).toUpperCase()+n.slice(1);return(0,X.jsxs)(`div`,{"data-slot":`drawer-global`,className:`flex shrink-0 flex-col gap-[2px] border-t border-border px-[8px] pt-[8px] pb-[max(8px,env(safe-area-inset-bottom))]`,children:[t?(0,X.jsxs)(z,{to:`/tools`,onClick:e,"data-slot":`drawer-tools`,"aria-label":t.blocked?`Tools, needs setup`:void 0,"aria-describedby":t.blocked&&t.note?`drawer-tools-note`:void 0,className:c(Iu,t.note&&`h-auto min-h-[48px] py-[6px]`),children:[(0,X.jsxs)(`span`,{className:`relative flex shrink-0`,children:[(0,X.jsx)(yr,{"aria-hidden":`true`}),t.blocked?(0,X.jsx)(q,{tone:`pending`,"data-slot":`drawer-tools-dot`,className:`absolute -top-[2px] -right-[3px] ring-[1.5px] ring-sidebar`}):null]}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{children:`Tools`}),t.note?(0,X.jsx)(`span`,{id:`drawer-tools-note`,"data-slot":`drawer-tools-note`,className:`text-[11.5px] leading-tight text-soft-foreground`,children:t.note}):null]})]}):null,(0,X.jsxs)(z,{to:`/settings/global/appearance`,onClick:e,"data-slot":`drawer-global-settings`,className:Iu,children:[(0,X.jsx)(gr,{"aria-hidden":`true`}),`Global settings`]}),(0,X.jsxs)(`button`,{type:`button`,"data-slot":`theme-toggle`,"data-theme-pref":n,"aria-label":`Theme: ${n.toLowerCase()}. Switch to ${i}.`,onClick:()=>r(i),className:Iu,children:[(0,X.jsx)(Ir,{"aria-hidden":`true`}),`Theme · `,a]})]})}function zu(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function Bu(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function Vu(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||zu(e.target)&&!Bu(e.target))}function Hu(e,t){let n=Y.useRef(t);Y.useLayoutEffect(()=>{n.current=t}),Y.useEffect(()=>{let t=t=>{Vu(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function Uu(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||zu(e.target))}function Wu(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function Gu(e,t){let n=Y.useRef(t);Y.useLayoutEffect(()=>{n.current=t}),Y.useEffect(()=>{let t=t=>{Uu(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}var Ku=e(r(),1),qu=Y.createContext(null);function Ju(){return Y.useContext(qu)}function Yu({slot:e,children:t}){return(0,Ku.createPortal)(t,e)}var Xu=`(min-width: 768px)`;function Zu(){let[e,t]=Y.useState(()=>window.matchMedia?.(Xu).matches??!0);return Y.useEffect(()=>{let e=window.matchMedia?.(Xu);if(!e)return;let n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function Qu({delayDuration:e=0,...t}){return(0,X.jsx)(Qc,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function $u({...e}){return(0,X.jsx)($c,{"data-slot":`tooltip`,...e})}function ed({...e}){return(0,X.jsx)(el,{"data-slot":`tooltip-trigger`,...e})}function td({className:e,sideOffset:t=0,children:n,...r}){return(0,X.jsx)(tl,{children:(0,X.jsxs)(nl,{"data-slot":`tooltip-content`,sideOffset:t,className:c(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) motion-safe:animate-in rounded-md bg-contrast px-3 py-1.5 text-xs text-balance text-contrast-foreground fade-in-0 motion-safe:zoom-in-95 motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,X.jsx)(rl,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-contrast fill-contrast`})]})})}var nd=[`/git`,`/automations`,`/workflows`,`/reports`];function rd({items:e,activeTo:t,needsYou:n=!1,onNavigate:r}){let[i,a]=(0,Y.useState)(!1),o=(0,Y.useRef)(null),s=e.filter(e=>nd.includes(e.to)),l=e.filter(e=>!s.includes(e)),u=s.some(e=>e.to===t);return(0,X.jsx)(Qu,{children:(0,X.jsxs)(`nav`,{ref:o,"aria-label":`Main`,"data-slot":`view-tabs`,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;let t=Array.from(o.current?.querySelectorAll(`[data-view-tab]`)??[]),n=t.indexOf(document.activeElement);n<0||(e.preventDefault(),t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowRight`?1:-1)+t.length)%t.length]?.focus())},className:`flex shrink-0 items-center justify-between max-md:justify-start max-md:gap-1 max-md:overflow-x-auto border-b border-border px-3 pt-2.5 pb-2`,children:[l.map(e=>{let i=e.to===t,a=e.icon,o=e.to===`/`&&n&&!i;return(0,X.jsxs)($u,{children:[(0,X.jsx)(ed,{asChild:!0,children:(0,X.jsxs)(G,{to:e.to,onClick:r,"data-view-tab":!0,"aria-label":e.label,"aria-current":i?`page`:void 0,className:c(`relative flex h-[30px] min-w-0 items-center justify-center rounded-[7px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11`,i?`shrink-0 gap-1.5 bg-sidebar-row-selected px-[9px] text-[12px] font-semibold text-foreground`:`w-7 shrink-0`),children:[(0,X.jsxs)(`span`,{className:`relative`,children:[(0,X.jsx)(a,{className:`size-[15px] shrink-0`,"aria-hidden":`true`}),o?(0,X.jsx)(`span`,{"aria-label":`Tasks need you`,"data-slot":`nav-needs-you-dot`,className:`absolute -top-1 -right-1 size-[7px] rounded-full border-[1.5px] border-sidebar bg-pending-strong`}):null]}),i?(0,X.jsx)(`span`,{className:`truncate`,children:e.label}):null]})}),(0,X.jsx)(td,{side:`bottom`,sideOffset:6,style:{pointerEvents:`none`},children:e.label})]},e.to)}),s.length?(0,X.jsxs)(Gi,{open:i,onOpenChange:a,children:[(0,X.jsxs)($u,{children:[(0,X.jsx)(ed,{asChild:!0,children:(0,X.jsx)(Hi,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"data-view-tab":!0,"aria-label":`More views`,"data-active":u?`true`:void 0,className:c(`relative flex h-[30px] w-7 shrink-0 items-center justify-center rounded-[7px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11`,(i||u)&&`bg-sidebar-row-selected text-foreground`),children:(0,X.jsx)(ms,{className:`size-[15px]`,"aria-hidden":`true`})})})}),(0,X.jsx)(td,{side:`bottom`,sideOffset:6,style:{pointerEvents:`none`},children:`More views`})]}),(0,X.jsx)(Ui,{align:`end`,sideOffset:4,className:`w-48 rounded-[10px] border-border bg-sidebar p-[5px] shadow-[0_10px_28px_#00000047]`,children:s.map(e=>{let n=e.icon,i=e.to===t;return(0,X.jsx)(W,{asChild:!0,className:c(`h-8 max-md:min-h-11 gap-2.5 rounded-md px-[9px] text-[13px] text-foreground focus:bg-sidebar-row-hover`,i&&`bg-sidebar-row-selected font-medium`),children:(0,X.jsxs)(G,{to:e.to,onClick:r,"aria-current":i?`page`:void 0,children:[(0,X.jsx)(n,{className:`size-[15px] text-soft-foreground`}),e.label]})},e.to)})})]}):null]})})}var id=[{to:`/`,label:`Tasks`,icon:Qn,match:[`/`,`/tasks`],badge:`tasks-unread`},{to:`/activity`,label:`Activity`,icon:ns,match:[`/activity`]},{to:`/git`,label:`Git`,icon:Zn,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:ir,match:[`/github`],forge:!0},{to:`/automations`,label:`Automations`,icon:Pr,match:[`/automations`],automations:!0},{to:`/skills`,label:`Skills`,icon:zr,match:[`/skills`]},{to:`/workflows`,label:`Workflows`,icon:Vr,match:[`/workflows`]},{to:`/reports`,label:`Reports`,icon:_s,match:[`/reports`]},{to:`/settings`,label:`Settings`,icon:lr,match:[`/settings`]}];function ad({forge:e=!1,automations:t=!1}={}){return id.filter(n=>(!n.forge||e)&&(!n.automations||t))}function od(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function sd(e){let t=null;for(let n of id)for(let r of n.match)od(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function cd(e){let t=sd(e);return id.find(e=>e.to===t)??null}function ld(e){return/^\/tasks\/[^/]+(?:\/|$)/.test(Aa(e))}function ud(e,t){let n=Aa(e);return/^\/git\/?$/.test(n)?new URLSearchParams(t).get(`view`)===`repo`:n.startsWith(`/git/`)}var dd=[`/`,`/activity`,`/github`],fd=[`/git`,`/skills`,`/workflows`,`/reports`,`/settings`,`/automations`];function pd(e,t,n){let r=Aa(e),i=r===`/new`,a=ld(e);return{activeTo:i?`/new`:sd(r),current:cd(r),currentProjectId:Oa(e),newTask:i,pushed:a,showTabBar:!a&&!ud(e,t)&&!n,gitRepositoryView:r===`/git`&&new URLSearchParams(t).get(`view`)===`repo`}}var md=[{to:`/git`,label:`Git`},{to:`/skills`,label:`Skills`},{to:`/workflows`,label:`Workflows`},{to:`/reports`,label:`Reports`},{to:`/settings`,label:`Project settings`}],hd=[`/automations`],gd=`flex h-[50px] min-h-11 w-full items-center gap-[14px] rounded-[10px] px-[10px] text-[14.5px] text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-ring [&_svg]:size-[18px] [&_svg]:shrink-0 [&_svg]:text-muted-foreground`;function _d({open:e,onOpenChange:t,onCloseAutoFocus:n,projectName:r,items:i,activeTo:a}){let o=new Map(i.map(e=>[e.to,e])),s=md.flatMap(({to:e,label:t})=>{let n=o.get(e);return n?[{to:e,label:t,icon:n.icon}]:[]}),l=hd.flatMap(e=>{let t=o.get(e);return t?[{to:e,label:t.label,icon:t.icon}]:[]}),u=()=>t(!1),d=({to:e,label:t,icon:n})=>{let r=e===a;return(0,X.jsxs)(G,{to:e,onClick:u,"data-slot":`more-row`,"data-more-row":e,"aria-current":r?`page`:void 0,className:c(gd,r&&`bg-sidebar-row-selected hover:bg-sidebar-row-selected`),children:[(0,X.jsx)(n,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),(0,X.jsx)(Br,{"aria-hidden":`true`,className:`!size-[15px]`})]},e)};return(0,X.jsx)(Su,{open:e,onOpenChange:t,children:(0,X.jsxs)(Du,{side:`bottom`,"data-slot":`more-sheet`,showCloseButton:!1,onCloseAutoFocus:n,"aria-describedby":void 0,className:`gap-0 rounded-t-[20px] border-border bg-sidebar px-[14px] pt-[10px] pb-[max(14px,env(safe-area-inset-bottom))] md:hidden`,children:[(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`mx-auto mb-[14px] h-[5px] w-[36px] rounded-[3px] bg-border`}),(0,X.jsxs)(`div`,{className:`flex items-baseline gap-[10px] px-[10px] pb-[6px]`,children:[(0,X.jsx)(ku,{className:`text-[17px] leading-tight font-bold`,children:`More`}),r?(0,X.jsx)(`span`,{"data-slot":`more-project`,className:`min-w-0 truncate text-[12.5px] text-soft-foreground`,children:r}):null]}),(0,X.jsx)(`div`,{className:`flex flex-col gap-[2px]`,children:s.map(d)}),l.length>0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{role:`separator`,className:`mx-[10px] mt-[8px] border-t border-border`}),(0,X.jsx)(`div`,{className:`px-[10px] pt-[12px] pb-[4px] text-[12px] font-medium text-soft-foreground`,children:`Shown when their flag is on`}),(0,X.jsx)(`div`,{className:`flex flex-col gap-[2px]`,children:l.map(d)})]}):null]})})}var vd=`(min-width: 768px)`;function yd({items:e,activeTo:t,signal:n,projectName:r,showNewTask:i=!0}){let[a,o]=Y.useState(!1),s=Y.useRef(null),{pathname:l}=gn();Y.useEffect(()=>{o(!1)},[l]),Y.useEffect(()=>{let e=window.matchMedia?.(vd);if(!e)return;e.matches&&o(!1);let t=e=>{e.matches&&o(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let u=e.filter(e=>dd.includes(e.to)),d=t!==null&&fd.includes(t),{top:f}=ru(n),p=f.some(e=>e.count>0),m=e=>c(`relative flex h-full min-h-11 min-w-11 flex-1 flex-col items-center justify-center gap-[3px] text-[10.5px] leading-none focus-visible:outline-2 focus-visible:outline-ring`,e?`font-semibold text-foreground`:`font-medium text-soft-foreground`);return(0,X.jsxs)(X.Fragment,{children:[i?(0,X.jsxs)(G,{to:`/new`,"data-slot":`mobile-new-task`,className:`group-has-[[data-new-task-action]]/shell:hidden absolute right-4 bottom-full z-30 mb-4 flex h-12 items-center gap-2 rounded-[24px] bg-foreground px-[18px] text-[14px] font-semibold text-background shadow-[0_8px_24px_#00000055] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,X.jsx)(ar,{"aria-hidden":`true`,className:`size-[18px]`}),`New task`]}):null,(0,X.jsxs)(`nav`,{"aria-label":`Views`,"data-slot":`mobile-tab-bar`,className:`flex h-[54px] items-stretch`,children:[u.map(e=>{let n=e.to===t,r=e.icon,i=e.to===`/`&&p;return(0,X.jsxs)(G,{to:e.to,"data-tab":e.to,"aria-current":n?`page`:void 0,className:m(n),children:[(0,X.jsxs)(`span`,{className:`relative`,children:[(0,X.jsx)(r,{"aria-hidden":`true`,className:`size-[21px]`}),i?(0,X.jsx)(nu,{position:`top`,segments:f,className:`-top-[6px] -right-[10px] border-sidebar`}):null]}),e.label]},e.to)}),(0,X.jsxs)(`button`,{ref:s,type:`button`,"data-tab":`more`,"aria-haspopup":`dialog`,"aria-expanded":a,"data-active":d?`true`:void 0,onClick:()=>o(!0),className:m(d),children:[(0,X.jsx)(`span`,{className:`relative`,children:(0,X.jsx)(Ur,{"aria-hidden":`true`,className:`size-[21px]`})}),`More`]})]}),(0,X.jsx)(_d,{open:a,onOpenChange:o,onCloseAutoFocus:e=>{s.current?.isConnected&&(e.preventDefault(),s.current.focus())},projectName:r,items:e,activeTo:t})]})}var bd=`(min-width: 768px)`;function xd(e){return bn({path:`/tasks/:id`,end:!0},Aa(e))!==null}function Sd(e){let t=Aa(e);return t===`/github`||t.startsWith(`/github/`)}function Cd({children:e,breadcrumb:t,repo:n=null,version:r=null,latestVersion:i=null,sidebarList:a,taskQuickList:o,sessionScope:s,toolsMenu:l,forgeAvailable:u=!0,automationsAvailable:d=!0,banner:f,mobileProjects:p,projectHeader:m,sidebarProjectId:h,needsYou:g,projectRail:_,toolsStatus:v}){let{pathname:y,search:b}=gn(),{activeTo:x,current:S,currentProjectId:C,newTask:w,pushed:T,showTabBar:E,gitRepositoryView:D}=pd(y,b,ma()),[O,k]=Y.useState(!1),[A,j]=Y.useState(null),M=Y.useRef(null),ee=Y.useRef(null),te=Y.useRef(null),ne=xd(y);Y.useLayoutEffect(()=>{let e=te.current;if(te.current=y,ne||e!==null&&Oa(e)===Oa(y)&&Sd(e)&&Sd(y))return;let t=ee.current;t&&(t.scrollTop=0)},[y,ne,D]);let re=xn(),ie=Y.useRef(y);Y.useEffect(()=>{let e=ie.current;ie.current=y,e!==y&&(re===`REPLACE`&&Ad(e,y)||k(!1))},[y,re]),Y.useEffect(()=>{let e=window.matchMedia?.(bd);if(!e)return;e.matches&&k(!1);let t=e=>{e.matches&&k(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let N=ad({forge:u,automations:d}),P={version:r,latestVersion:i};return(0,X.jsx)(Su,{open:O,onOpenChange:k,children:(0,X.jsxs)(`div`,{"data-slot":`app-shell`,className:`flex h-dvh overflow-hidden bg-background text-foreground pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)]`,children:[(0,X.jsx)(Ed,{projectRail:_,activeTo:x,items:N,repo:n,release:P,sidebarList:a,taskQuickList:o,sessionScope:s,toolsMenu:l,projectHeader:m,sidebarProjectId:h,needsYou:g}),(0,X.jsx)(kd,{release:P,taskQuickList:o,sidebarProjectId:h,mobileProjects:p,currentProjectId:C,toolsStatus:v,onNavigate:()=>k(!1),onCloseAutoFocus:e=>{M.current?.isConnected&&(e.preventDefault(),M.current.focus())}}),(0,X.jsxs)(`div`,{className:`group/shell grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,children:[(0,X.jsx)(Id,{title:S?.label??`Squawk`,pushed:T?{onSlot:j}:null,repo:n,elsewhere:ju(p,C),onTrigger:e=>{M.current=e}}),(0,X.jsx)(wd,{breadcrumb:t,repo:n,label:S?.label,newTask:w}),f?(0,X.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:f}):null,(0,X.jsx)(`main`,{ref:ee,"data-slot":`main`,className:c(`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,E&&!w&&`max-md:pb-20`),children:(0,X.jsx)(qu.Provider,{value:T?A:null,children:e})}),(0,X.jsx)(Td,{showTabBar:E,items:N,activeTo:x,mobileProjects:p,currentProjectId:C,repo:n,newTask:w})]})]})})}function wd({breadcrumb:e,repo:t,label:n,newTask:r}){let i=e?.project??t?.name,a=e?.branch??t?.branch;return(0,X.jsxs)(`header`,{"data-slot":`desktop-breadcrumb`,className:c(`row-start-1 hidden min-w-0 items-center gap-3 border-b border-border text-[13px] text-muted-foreground md:flex`,r?`h-[72px] px-11`:`h-16 px-9`),children:[(0,X.jsx)(dr,{"aria-hidden":`true`,className:`size-4 shrink-0`}),i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:i}),(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`/`})]}):null,(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e?.page??n??`Squawk`}),a?(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 text-[11px]`,children:[(0,X.jsx)(Xn,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),a]}):null]})}function Td({showTabBar:e,items:t,activeTo:n,mobileProjects:r,currentProjectId:i,repo:a,newTask:o}){let s=i===null?void 0:r?.signals?.get(i);return(0,X.jsx)(`div`,{"data-slot":`composer`,className:c(`row-start-4 pb-[max(env(safe-area-inset-bottom),var(--kb,0px))]`,e&&`relative max-md:border-t max-md:border-border max-md:bg-sidebar`),children:e?(0,X.jsx)(`div`,{className:`md:hidden`,children:(0,X.jsx)(yd,{items:t,activeTo:n,signal:s,projectName:r?.projects.find(e=>e.id===i)?.name??a?.name??null,showNewTask:!o})}):null})}function Ed({projectRail:e,...t}){let[n,r]=Y.useState(Is),i=Y.useCallback(e=>{let t=Fs(e);r(t),Ls(t)},[]);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Rs.Provider,{value:n,children:e}),(0,X.jsx)(Dd,{...t,width:n,onWidthChange:i})]})}function Dd({width:e,onWidthChange:t,...n}){return(0,X.jsxs)(`aside`,{"data-slot":`sidebar`,style:{width:e},className:`relative hidden shrink-0 flex-col border-r border-border bg-sidebar md:flex`,children:[(0,X.jsx)(Md,{...n}),(0,X.jsx)(Od,{width:e,onWidthChange:t})]})}function Od({width:e,onWidthChange:t}){let n=Y.useRef(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(Fs(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,X.jsx)(`div`,{"data-slot":`sidebar-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the sidebar`,"aria-valuenow":e,"aria-valuemin":264,"aria-valuemax":420,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?264:n.key===`End`?420:null;r!==null&&(n.preventDefault(),t(Fs(r)))},onDoubleClick:()=>t(264),title:`Drag to resize the sidebar — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-[var(--composer-border)] focus-visible:bg-[var(--composer-border)] focus-visible:outline-none`})}function kd({onNavigate:e,onCloseAutoFocus:t,mobileProjects:n,currentProjectId:r,toolsStatus:i,release:a,taskQuickList:o,sidebarProjectId:s}){return(0,X.jsxs)(Du,{side:`left`,"data-slot":`mobile-nav-drawer`,onCloseAutoFocus:t,overlayClassName:`bg-[var(--nav-scrim)]`,showCloseButton:!1,className:`w-[calc(100%-68px)] max-w-[334px] gap-0 border-border bg-sidebar p-0 sm:max-w-[334px] md:hidden`,"aria-describedby":void 0,children:[(0,X.jsx)(ku,{className:`sr-only`,children:`Navigation`}),(0,X.jsx)(Pu,{version:a.version,latestVersion:a.latestVersion}),(0,X.jsxs)(`div`,{"data-slot":`drawer-scroll`,className:`flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,children:[n?(0,X.jsx)(Lu,{nav:n,currentProjectId:r,onNavigate:e}):null,o?(0,X.jsx)(jd,{projectId:s,onNavigate:e,children:(0,X.jsx)(`div`,{"data-slot":`drawer-tasks`,className:`border-t border-border px-[8px] py-[8px]`,children:o})}):null]}),(0,X.jsx)(Ru,{onNavigate:e,tools:i})]})}function Ad(e,t){return Oa(e)==="default"&&Oa(t)!==null&&Oa(t)!=="default"&&Aa(e)===Aa(t)}function jd({projectId:e,onNavigate:t,children:n}){let r=He(),i=e===void 0?r:{projectId:e,apiBase:`${o}/p/${encodeURIComponent(e)}`};return(0,X.jsx)(Ge.Provider,{value:i,children:(0,X.jsx)(zs.Provider,{value:t,children:n})})}function Md({activeTo:e,items:t,repo:n,release:r,sidebarList:i,taskQuickList:a,sessionScope:o,toolsMenu:s,projectHeader:l,sidebarProjectId:u,needsYou:d,onNavigate:f}){return(0,X.jsx)(jd,{projectId:u,onNavigate:f,children:(0,X.jsxs)(`div`,{"data-slot":`sidebar-content`,className:`@container/sidebar flex min-h-0 flex-1 flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,X.jsx)(`div`,{"data-slot":`sidebar-header`,className:`shrink-0`,children:l??(n?(0,X.jsxs)(`div`,{className:`px-[14px] pt-[14px] pb-2.5`,children:[(0,X.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:n.name}),(0,X.jsx)(`div`,{className:`truncate font-mono text-[10.5px] text-soft-foreground`,children:n.branch})]}):null)}),(0,X.jsxs)(`div`,{"data-slot":`sidebar-actions`,className:`flex flex-col gap-2 px-3`,children:[(0,X.jsx)(Pd,{}),(0,X.jsx)(U,{asChild:!0,variant:`ghost`,className:c(`relative h-[32px] max-md:min-h-11 rounded-[7px] bg-muted w-full min-w-0 justify-start gap-2 px-2.5 text-[12.5px] font-medium text-foreground hover:bg-sidebar-row-hover hover:text-foreground`,e===`/new`&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:(0,X.jsxs)(G,{to:`/new`,onClick:f,"data-sidebar-item":`new-task`,"aria-current":e===`/new`?`page`:void 0,children:[(0,X.jsx)(ar,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`sr-only`,children:`C`})]})})]}),o?(0,X.jsx)(`div`,{className:`shrink-0 px-3 pt-2`,children:o}):null,(0,X.jsx)(rd,{items:t,activeTo:e,needsYou:d,onNavigate:f}),(0,X.jsx)(`div`,{"data-slot":`project-task-navigation`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-3`,children:(0,X.jsx)(zs.Provider,{value:f,children:i??(0,X.jsx)(`div`,{"data-slot":`task-quick-list`,children:a})})}),(0,X.jsx)(Nd,{toolsMenu:s,release:r})]})})}function Nd({toolsMenu:e,release:t}){return(0,X.jsx)(`div`,{"data-slot":`sidebar-footer`,className:`shrink-0`,children:(0,X.jsxs)(`div`,{"data-slot":`sidebar-footer-controls`,className:`flex h-11 items-center justify-between gap-1 border-t border-border px-3`,children:[(0,X.jsx)(`div`,{"data-slot":`tools-menu`,className:`shrink-0`,children:e}),(0,X.jsx)(`div`,{className:`flex min-w-0 items-center gap-1`,"data-slot":`version-action`,children:t.version?(0,X.jsx)(Fd,{version:t.version,latestVersion:t.latestVersion}):null})]})})}function Pd(){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search — command palette (⌘K / Ctrl+K)`,onClick:()=>Ns(),className:`flex h-[32px] max-md:min-h-11 w-full items-center gap-2 rounded-[7px] border border-border bg-background px-2.5 text-left text-[12.5px] font-normal text-soft-foreground transition-colors hover:border-border hover:text-foreground`,children:[(0,X.jsx)(hr,{className:`size-[14px] shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate`,children:`Search…`}),(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`ml-auto shrink-0 font-sans text-[11px] font-normal text-soft-foreground`,children:Wu(`k`)})]})}function Fd({version:e,latestVersion:t}){let n=!!(t&&$l(t,e));return(0,X.jsxs)(`span`,{"data-slot":`version-chip`,"data-update-available":n?`true`:void 0,title:n?`v${e} — update available: v${t}`:`v${e}`,className:`flex min-w-0 items-center gap-1 font-mono text-[11px] text-soft-foreground`,children:[n?(0,X.jsx)(q,{tone:`pending`,className:`size-[5px] shrink-0`}):null,(0,X.jsxs)(`span`,{className:`truncate`,children:[`v`,e]})]})}function Id({title:e,pushed:t,repo:n,elsewhere:r,onTrigger:i}){return t?(0,X.jsx)(Ld,{onSlot:t.onSlot}):(0,X.jsx)(`header`,{"data-slot":`mobile-top-bar`,className:`row-start-1 min-w-0 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,X.jsxs)(`div`,{className:`flex h-[56px] min-w-0 items-center gap-[8px] px-[8px]`,children:[(0,X.jsx)(Cu,{asChild:!0,children:(0,X.jsxs)(U,{variant:`ghost`,"aria-label":Mu(r),onClick:e=>i(e.currentTarget),className:`relative h-[44px] w-[64px] shrink-0 justify-start rounded-md p-0 pl-[10px] text-foreground`,children:[(0,X.jsx)(pr,{className:`size-[20px]`,"aria-hidden":`true`}),(0,X.jsx)(Nu,{elsewhere:r})]})}),n?(0,X.jsx)(Cu,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`mobile-project-picker`,"aria-label":`Switch project: ${n.name}`,onClick:e=>i(e.currentTarget),className:`flex h-[44px] min-w-0 flex-1 items-center justify-start gap-[10px] rounded-md text-left focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-[28px] shrink-0 items-center justify-center rounded-[8px] border border-soft-foreground bg-sidebar-row-selected text-[11px] leading-none font-semibold text-foreground`,children:Bl(n.name)}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,children:n.name}),n.branch?(0,X.jsx)(`span`,{className:`truncate font-mono text-[10.5px] leading-tight text-soft-foreground`,children:n.branch}):null]}),(0,X.jsx)(Or,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`})]})}):null,e===`Squawk`?n?null:(0,X.jsx)(`span`,{className:`flex-1`}):(0,X.jsx)(`span`,{"data-slot":`mobile-route-title`,className:c(`truncate text-[15px] font-semibold text-foreground`,n?`sr-only`:`min-w-0 flex-1 pl-[8px]`),children:e}),(0,X.jsx)(U,{variant:`ghost`,"aria-label":`Search`,"data-slot":`mobile-search`,onClick:()=>Ns(),className:`ml-auto size-[44px] shrink-0 p-0 text-foreground`,children:(0,X.jsx)(hr,{className:`size-[19px]`,"aria-hidden":`true`})})]})})}function Ld({onSlot:e}){let t=Da();return(0,X.jsx)(`header`,{"data-slot":`mobile-top-bar`,"data-mode":`task`,className:`row-start-1 min-w-0 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,X.jsxs)(`div`,{className:`flex h-[56px] min-w-0 items-center gap-[4px] px-[8px]`,children:[(0,X.jsx)(U,{variant:`ghost`,"aria-label":`Back`,"data-slot":`mobile-back`,onClick:()=>{let e=window.history.state?.idx;t(typeof e==`number`&&e>0?-1:`/`)},className:`size-[44px] shrink-0 p-0 text-foreground`,children:(0,X.jsx)(os,{className:`size-[22px]`,"aria-hidden":`true`})}),(0,X.jsx)(`div`,{"data-slot":`mobile-run-bar`,ref:e,className:`flex min-w-0 flex-1 items-center gap-[4px]`})]})})}function Rd(e,t){let n=typeof e==`string`?new URLSearchParams(e):e,r=n.get(`runner`),i=r!==null&&(t?.runners.some(e=>e.id===r)??!1),a=n.get(`skillPath`);return{skill:(n.get(`skill`)??``).trim(),...a?{skillPath:a}:{},...i?{runner:r}:{},...n.has(`account`)?{account:n.get(`account`)}:{},ref:(n.get(`ref`)??n.get(`task`)??``).trim()}}function zd(e){let t=new URLSearchParams;e.skill&&t.set(`skill`,e.skill),e.skillPath!==void 0&&t.set(`skillPath`,e.skillPath),e.runner&&t.set(`runner`,e.runner),e.account!==void 0&&t.set(`account`,e.account),e.ref&&t.set(`ref`,e.ref);let n=t.toString();return n?`/new?${n}`:`/new`}var Bd=`cez-last-location`;function Vd(){try{let e=localStorage.getItem(Bd);return e===null?null:JSON.parse(e)}catch{return null}}function Hd(e){try{localStorage.setItem(Bd,JSON.stringify(e))}catch{}}var Ud=new Set([`projectId`,`pathname`,`search`,`hash`]);function Wd(e){return typeof e!=`string`||e.length<1||e.length>64?null:e}function Gd(e){return typeof e!=`string`||e.length<1||e.length>2048||!e.startsWith(`/p/`)?null:e}function Kd(e){return e!==void 0&&(typeof e!=`string`||e.length>4096||!e.startsWith(`?`))?null:e}function qd(e){return e!==void 0&&(typeof e!=`string`||e.length>2048||!e.startsWith(`#`))?null:e}function Jd(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(Object.keys(t).some(e=>!Ud.has(e)))return null;let n=Wd(t.projectId);if(n===null)return null;let r=Gd(t.pathname);if(r===null)return null;let i=Kd(t.search);if(i===null)return null;let a=qd(t.hash);if(a===null)return null;try{if(Oa(r)!==n)return null}catch{return null}return{projectId:n,pathname:r,...i===void 0?{}:{search:i},...a===void 0?{}:{hash:a}}}function Yd(e,t){let n=t.projects.find(t=>t.id===e);return n!==void 0&&n.status!==`missing`}function Xd(e,t){if(t===void 0)return null;let n;try{n=Oa(e.pathname)}catch{return null}return n===null||!Yd(n,t)?null:Jd({projectId:n,pathname:e.pathname,...e.search===``?{}:{search:e.search},...e.hash===``?{}:{hash:e.hash}})}function Zd(e,t,n){let r=Jd(e);return r===null||!(t===void 0?n!==void 0&&r.projectId===n:Yd(r.projectId,t))?null:`${r.pathname}${r.search??``}${r.hash??``}`}function Qd(e,t){let n=Jd(e);return n!==null&&n.projectId===t.projectId&&n.pathname===t.pathname&&(n.search??``)===(t.search??``)&&(n.hash??``)===(t.hash??``)}var $d=`cez-project-locations`;function ef(){try{let e=localStorage.getItem($d),t=e===null?null:JSON.parse(e);return typeof t==`object`&&t&&!Array.isArray(t)?t:{}}catch{return{}}}function tf(e){let t=ef()[e];return t===void 0?null:t}function nf(e){try{localStorage.setItem($d,JSON.stringify({...ef(),[e.projectId]:e}))}catch{}}function rf(e,t,n){let r=Jd(t);return r===null||r.projectId!==e||n===void 0||!Yd(e,n)?null:`${r.pathname}${r.search??``}${r.hash??``}`}var af=2500,of=e=>String(Ea(e,`/`));function sf(e,t,n){let r={href:of(e),verify:!1},i=rf(e,t,n.registry);if(i===null)return r;try{let e=i.replace(/[?#].*$/,``),t=n.matchRoute(e);return t===null?r:{href:i,verify:Object.keys(t.params).some(e=>e!==`projectId`)}}catch{return r}}var cf=e=>Be(rn(e.params.id??``,{projectId:e.opts.projectId}),{signal:e.opts.signal});function lf(e){let t=Number(e);return Number.isSafeInteger(t)&&t>=1?t:null}async function uf(e,t,n){let r=await re(e,t,{},n.opts);return r.available?r.item!==null:null}var df=async e=>(await cf(e),!0),ff=async e=>(await cf(e),await Ae(e.params.id??``,e.params.sha??``,e.opts),!0);async function pf(e,t){let n=await cf(e),r=lf(e.params.n);return r===null?!1:Vn(n,e.repoBase).some(e=>e.kind===t&&e.number===r)?uf(t,r,e):e.repoBase===void 0&&null}var mf=async e=>(await Ee(e.params.sha??``,e.opts),!0);async function hf(e,t){let n=lf(e.params.n);return n!==null&&uf(t,n,e)}var gf=[{matches:e=>e===`/tasks/:id/commits/:sha`,check:ff},{matches:e=>e===`/tasks/:id/issue/:n`,check:e=>pf(e,`issue`)},{matches:e=>e===`/tasks/:id/pr/:n`,check:e=>pf(e,`pr`)},{matches:e=>e.startsWith(`/tasks/:id`),check:df},{matches:e=>e===`/git/commits/:sha`,check:mf},{matches:e=>e===`/github/issues/:n`,check:e=>hf(e,`issue`)},{matches:e=>e.startsWith(`/github/prs/:n`),check:e=>hf(e,`pr`)},{matches:e=>e===`/workflows/:name`,check:async e=>{let{workflows:t,issues:n}=await y(e.opts);return t.some(t=>t.name===e.params.name)?!0:n.length>0&&null}},{matches:e=>e.startsWith(`/automations/:automationId`),check:async e=>{let t=await me(e.opts);return t.available?t.automations.some(t=>t.id===e.params.automationId):null}}];async function _f(e,t,n,r,i){let a=``;try{let o=i(t);if(o===null)return!1;a=o.pattern;let s=gf.find(e=>e.matches(o.pattern));return s===void 0?null:await s.check({projectId:e,pattern:a,params:o.params,repoBase:r,opts:{projectId:e,signal:n}})}catch(e){return!yf(e,a)&&null}}var vf=/unknown revision|bad object|bad revision|unknown commit|not a commit hash|needed a single revision/i;function yf(e,t){return e instanceof je?e.status===404||(t===`/git/commits/:sha`||t===`/tasks/:id/commits/:sha`)&&e.status===409&&vf.test(e.message):!1}async function bf(e,t,n){let r=sf(e,t,n);if(!r.verify)return r.href;let i=new AbortController,a=setTimeout(()=>i.abort(),af);try{return await _f(e,r.href.replace(/[?#].*$/,``),i.signal,n.repoBaseOf?.(e),n.matchRoute)===!1?of(e):r.href}finally{clearTimeout(a)}}var xf={key:``,navigate:null,ticket:0};function Sf(e,t){e!==xf.key&&xf.ticket++,xf.key=e,xf.navigate=t}function Cf(){xf.ticket++}async function wf(e,t,n){let r=++xf.ticket,i=xf.key,a=await bf(e,t,n);r===xf.ticket&&i===xf.key&&xf.navigate?.(a)}function Tf(){let e=Sn(),t=gn();Y.useLayoutEffect(()=>{Sf(`${t.key}|${t.pathname}${t.search}${t.hash}`,e)},[e,t.key,t.pathname,t.search,t.hash])}function Ef(){let e=Y.useContext(es);if(e===null)throw Error(`useProjectSwitch needs a ProjectRouteMatcherContext provider (App provides matchProjectRoute)`);let t=tn().data,n=St().data,r=Y.useCallback(e=>t?.projects.find(t=>t.id===e)?.repoUrl??(e===(n?.bootProject??t?.bootProject)?nn(n?.repo?.remote):void 0),[t,n]);Tf();let{pathname:i,search:a,hash:o}=gn(),s=Oa(i),c=`${i}${a}${o}`;return{target:Y.useCallback(n=>n===s?{href:c,verify:!1}:sf(n,tf(n),{registry:t,matchRoute:e}),[t,e,s,c]),go:Y.useCallback(async n=>{if(n===s)return Cf();await wf(n,tf(n),{registry:t,repoBaseOf:r,matchRoute:e})},[t,r,e,s])}}function Df(e){return e?.capabilities?.automations===!0}function Of(){let e=St().data,t=(0,Y.useRef)(void 0);(0,Y.useEffect)(()=>{e&&(t.current=e)},[e]);let n=e??t.current;return n?Df(n)?`available`:`unavailable`:`unknown`}function kf(){return Of()===`available`}function Af(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function jf(){let e=F(),t=Jt(),n=Y.useRef(0),r=Y.useRef(Promise.resolve()),i=Y.useMemo(()=>mo(t.data?.sidebar?.projectOrder),[t.data?.sidebar?.projectOrder]),a=Y.useCallback(t=>{let i=e.getQueryData(L.uiState);if(i===void 0)return;let{projectOrder:a,...o}=Af(i.sidebar),s=t===null?o:{...o,projectOrder:t};e.setQueryData(L.uiState,{...i,sidebar:s});let c=++n.current,l=r.current.then(async()=>{let t=await _e({sidebar:s},{keepalive:!0});c===n.current&&e.setQueryData(L.uiState,t)});r.current=l.catch(t=>{V(t instanceof Error?t.message:String(t),{tone:`danger`}),c===n.current&&e.invalidateQueries({queryKey:L.uiState})})},[e]),o=Y.useCallback(e=>{let t=mo(e);t.length===0||!ho(e.length)||a(t)},[a]),s=Y.useCallback(()=>a(null),[a]);return{order:i,canReorder:t.data!==void 0,setOrder:o,reset:s}}function Mf(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function Nf(e,t,n){let r=t.trim().toLowerCase();if(r===``)return 1;let i=(n?.length?`${e} ${n.join(` `)}`:e).toLowerCase(),a=r.split(/\s+/),o=0;for(let e of a){let t=i.indexOf(e);if(t===-1)return 0;let n=t===0||!/[a-z0-9]/.test(i[t-1]??``);o+=(n?1:.5)/(1+t/48)}return o/a.length}function Pf(e,t){if(t.trim()===``)return e;let n=e=>e.rows.reduce((e,n)=>Math.max(e,Nf(n.value,t,n.keywords)),0);return e.map(e=>({group:e,score:n(e)})).sort((e,t)=>t.score-e.score).map(({group:e})=>e)}function Ff(e,t){return{value:`task ${K(e)} ${e.id}`,keywords:[...t?[t]:[],...Hf(e),...[e.branch,e.workflow,e.workflowLabel,e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl].filter(e=>!!e)]}}var If=e=>({value:`view ${e}`}),Lf=e=>({value:`project ${e.name} ${e.id}`,keywords:[e.root]}),Rf=e=>({value:`skill ${e.id} ${e.name} ${e.path??``}`,...s({keywords:e.description?[e.description]:void 0})}),zf={value:`action toggle theme`},Bf=150;function Vf(e,t,n,r=[]){let i=Mf(e.filter(e=>!Ya(e))).map(e=>({...e,projectId:t})),a=new Set(i.map(Uf)),o=[...n??[],...r].filter(e=>Ya(e)||a.has(Uf(e))?!1:(a.add(Uf(e)),!0)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return[...i,...o]}function Hf(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?/\/(\d+)\/?$/.exec(n):null;e&&t.add(Number(e[1]))}for(let n of[e.prNumber,e.issueNumber,e.markerRefs?.pr,e.markerRefs?.issue])typeof n==`number`&&Number.isInteger(n)&&n>0&&t.add(n);return[...t].flatMap(e=>[String(e),`#${e}`])}var Uf=e=>`${e.projectId??``}/${e.id}`;function Wf(e){let t=e.filter(e=>no(e)).sort((e,t)=>(t.finishedAt??``).localeCompare(e.finishedAt??``)),n=new Set(t.map(Uf));return{recentlyFinished:t,otherTasks:e.filter(e=>!n.has(Uf(e)))}}function Gf(e,t,n=[]){let r=po(e,n);return[...r.filter(e=>e.id!==t),...r.filter(e=>e.id===t)]}function Kf(){let[e,t]=Y.useState(!1),n=Da();Hu(`k`,()=>t(e=>!e));let r=Y.useCallback(()=>{t(!1),n(`/new`)},[n]);return Hu(`n`,r),Gu(`c`,r),Y.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(Ms,e),()=>window.removeEventListener(Ms,e)},[]),(0,X.jsx)(so,{open:e,onOpenChange:t,title:`Command palette`,description:`Search projects, tasks, views, actions, and skills`,showCloseButton:!1,filter:Nf,className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,X.jsx)(ep,{close:()=>t(!1)})})}function qf({heading:e,tasks:t,projectName:n,showProject:r,now:i,onSelect:a}){return(0,X.jsx)(J,{heading:e,children:t.map(e=>(0,X.jsx)(Jf,{task:e,projectName:n(e),showProject:r,now:i,onSelect:a},Uf(e)))})}function Jf({task:e,projectName:t,showProject:n,now:r,onSelect:i}){let a=Ne(e),o=K(e);return(0,X.jsxs)(co,{...Ff(e,t),"data-slot":`palette-task`,"data-run-id":e.id,"data-project-id":e.projectId??void 0,onSelect:()=>i(e),children:[(0,X.jsx)(q,{tone:a.tone,shape:a.shape,pulse:a.pulse,"aria-label":a.label,role:`img`}),e.delegation?.role===`worker`?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:o}),n&&t?(0,X.jsx)(`span`,{"data-slot":`palette-task-project`,className:`shrink-0 truncate text-xs text-soft-foreground`,children:t}):null,(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:_i(e.finishedAt??e.createdAt,r)})]})}function Yf({multiProject:e,health:t}){return[...e?[{label:`All tasks`,to:`/tasks`,icon:Gr,global:!0}]:[],...ad({forge:t.data?.forge?.available===!0,automations:Df(t.data)}).map(e=>({label:e.label,to:e.to,icon:e.icon,global:!1}))]}function Xf({views:e,go:t,goGlobal:n,orderedProjects:r,activeProjectId:i,goProject:a,otherTasks:o,searching:s,taskProjectName:c,showProjectOnTasks:l,now:u,selectTask:d,orderedSkills:f,skillRunner:p,theme:m,nextTheme:h,setTheme:g,close:_}){let v=[{rows:e.map(e=>If(e.label)),node:(0,X.jsx)(J,{heading:`Views`,children:e.map(e=>{let r=e.icon;return(0,X.jsxs)(co,{...If(e.label),"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>e.global?n(e.to):t(e.to),children:[(0,X.jsx)(r,{"aria-hidden":`true`}),e.label]},e.to)})},`views`)}];return r.length>0&&v.push({rows:r.map(Lf),node:(0,X.jsx)(J,{heading:`Projects`,children:r.map(e=>{let t=e.id===i,n=e.status===`missing`;return(0,X.jsxs)(co,{...Lf(e),"data-slot":`palette-project`,"data-project-id":e.id,disabled:n,onSelect:()=>a(e.id),children:[(0,X.jsx)(tr,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),n?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-soft-foreground`,children:e.branch}),t?(0,X.jsx)(_r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.id)})},`projects`)}),o.length>0&&v.push({rows:s?o.map(e=>Ff(e,c(e))):[],node:(0,X.jsx)(qf,{heading:`Tasks`,tasks:o,projectName:c,showProject:l,now:u,onSelect:d},`tasks`)}),v.push({rows:[zf],node:(0,X.jsx)(J,{heading:`Actions`,children:(0,X.jsxs)(co,{...zf,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{g(h),_()},children:[(0,X.jsx)(Ir,{"aria-hidden":`true`}),`Toggle theme`,(0,X.jsxs)(oo,{className:`tracking-normal`,children:[m,` → `,h]})]})},`actions`)}),f.length>0&&v.push({rows:f.map(Rf),node:(0,X.jsx)(J,{heading:`Skills`,children:f.map(e=>(0,X.jsxs)(co,{...Rf(e),"data-slot":`palette-skill`,"data-skill":e.id,onSelect:()=>t(zd({skill:e.id,skillPath:e.path,runner:p})),children:[(0,X.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.path?(0,X.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},JSON.stringify([e.id,e.path])))},`skills`)}),v}function Zf({search:e,setSearch:t}){return(0,X.jsx)(io,{placeholder:`Search projects, tasks, views, actions, skills…`,value:e,onValueChange:t})}function Qf({search:e,searching:t,recentlyFinished:n,groups:r,taskProjectName:i,showProjectOnTasks:a,now:o,selectTask:s,go:c}){return(0,X.jsxs)(uo,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:[(0,X.jsx)(lo,{children:`Nothing matches.`}),(0,X.jsx)(J,{children:(0,X.jsxs)(co,{value:`new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>c(`/new`),children:[(0,X.jsx)(ar,{"aria-hidden":`true`}),`New task`,(0,X.jsx)(oo,{children:`C`})]})}),!t&&n.length>0?(0,X.jsx)(qf,{heading:`Recently finished`,tasks:n,projectName:i,showProject:a,now:o,onSelect:s}):null,Pf(r,e).map(e=>e.node)]})}function $f({cappedProjects:e}){return e.length===0?null:(0,X.jsxs)(`p`,{"data-slot":`palette-search-truncated`,role:`status`,className:`border-t border-border px-3 py-2 text-[11px] text-soft-foreground`,children:[`More matches in `,e.join(`, `),`. Type more to narrow them.`]})}function ep({close:e}){let t=Da(),n=Sn(),[r,i]=Y.useState(``),a=r.trim()!==``,o=Ma(),{theme:s,setTheme:c}=vu(),l=ln(),u=Tt(),d=tn(),f=Ot(),p=St(),m=Date.now(),h=d.data,g=h!==void 0&&h.projects.length>1,_=un(g),{order:v}=jf(),y=Y.useMemo(()=>g?Gf(h.projects,o,v):[],[g,h,o,v]),b=Y.useMemo(()=>new Map((h?.projects??[]).map(e=>[e.id,e.name])),[h]),x=o??h?.bootProject??null,[S,C]=Y.useState(``);Y.useEffect(()=>{let e=setTimeout(()=>C(r),Bf);return()=>clearTimeout(e)},[r]);let w=Vt(S),T=a?w.data?.runs:void 0,E=a&&!w.isPlaceholderData?(w.data?.truncated??[]).map(e=>b.get(e)??e):[],D=Y.useMemo(()=>Vf(l.data??[],x,_.data?.runs,T),[l.data,x,_.data,T]),O=Y.useMemo(()=>Wf(D),[D]),k=a?[]:O.recentlyFinished,A=a?D:O.otherTasks,j=g,M=e=>e.projectId===null?null:b.get(e.projectId)??null,ee=f.data?.skillUsage,te=Y.useMemo(()=>So(u.data??[],ee),[u.data,ee]),ne=n=>{e(),t(n)},re=t=>{e(),n(t)},ie=Ef(),N=t=>{e(),ie.go(t)},P=n=>{e(),t(n.projectId===null?`/tasks/${n.id}`:Ea(n.projectId,`/tasks/${n.id}`))},ae=yu[s],oe=Xf({views:Yf({multiProject:g,health:p}),go:ne,goGlobal:re,orderedProjects:y,activeProjectId:o,goProject:N,otherTasks:A,searching:a,taskProjectName:M,showProjectOnTasks:j,now:m,selectTask:P,orderedSkills:te,skillRunner:u.runner,theme:s,nextTheme:ae,setTheme:c,close:e});return(u.isError||u.list?.source===`unavailable`)&&a&&oe.push({rows:[{value:r.trim()}],node:(0,X.jsx)(J,{heading:`Skills`,children:(0,X.jsxs)(co,{value:r.trim(),onSelect:()=>ne(zd({skill:r.trim(),runner:u.runner})),children:[`Use skill id “`,r.trim(),`” (unchecked)`]})},`unchecked-skill`)}),(0,X.jsxs)(X.Fragment,{children:[Zf({search:r,setSearch:i}),Qf({search:r,searching:a,recentlyFinished:k,groups:oe,taskProjectName:M,showProjectOnTasks:j,now:m,selectTask:P,go:ne}),$f({cappedProjects:E})]})}var tp=Y.createContext(null);function np({children:e}){let[t,n]=Y.useState(`active`),r=kf(),i=r?t:`active`,a=Y.useMemo(()=>[i,n,r],[i,r]);return(0,X.jsx)(tp.Provider,{value:a,children:e})}function rp(){let e=Y.useContext(tp);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}function ip(e){let t=e.filter(e=>!e.isDefault&&e.status===void 0),n=zt({queries:t.map(e=>({queryKey:L.agentAccountStatus(e.id),queryFn:({signal:t})=>ne(e.id,{signal:t}),staleTime:6e4,retry:!1}))}),r=new Map;return t.forEach((e,t)=>{let i=n[t]?.data?.status?.status;i!==void 0&&r.set(e.id,i)}),r}function ap(){let e=Qt().data?.profiles??[],t=ip(e);return e.map(e=>{let n=e.status?.status??t.get(e.id);return{provider:e.provider,id:e.id,label:e.label,configDir:e.configDir,isDefault:e.isDefault,...n===void 0?{}:{status:n}}})}function op(){let e=Qt(),t=Bt(),n=ap(),r=t.data?.info?.root;return{accounts:n,repoAccount:r?e.data?.selections?.[r]:void 0}}function sp(e,t){return e.filter(e=>e.provider===t).length>1}function cp(){let e=vt(),t=At(),{accounts:n,repoAccount:r}=op();return{runners:te(e.data,t.data,n),uninstalled:v(e.data,t.data),signedOut:b(e.data,t.data,n),accounts:oe(e.data,n),repoAccount:r,accountFor:(t,i)=>Xe(e.data,n,t,i,r),runnersOn:r=>ue(e.data,t.data,n,r),readyOn:(t,r)=>_(e.data,n,t,r)}}function lp(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return{};let n=e,r={};for(let{id:e}of t?.runners??[]){let t=n[e];typeof t==`string`&&t.length>0&&t.length<=128&&(r[e]=t)}return r}function up(e,t,n){if(!e||!n)return[];let r=new Map(e.providers.map(e=>[e.provider,e]));return n.runners.flatMap(({id:e,displayName:n})=>{let i=r.get(e);return i?.status!==`disconnected`||!i.authFailureId||t[e]===i.authFailureId?[]:[{provider:e,label:n,authFailureId:i.authFailureId}]})}function dp(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function fp({status:e,runners:t,pending:n,error:r,dismissals:i,onDismissAuthFailures:a,accounts:o=[]}){if(n||!e)return null;let s;try{s=Qe(e)}catch{return null}let c=up(s,i,t);if(c.length>0)return(0,X.jsxs)(`div`,{"data-slot":`provider-banner`,role:`alert`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-destructive/10 px-4 text-sm text-foreground`,children:[(0,X.jsx)(q,{tone:`danger`}),(0,X.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,c.map(({label:e})=>e).join(`, `),`.`]}),(0,X.jsx)(G,{to:`/settings/agent-defaults#providers`,className:`ml-auto shrink-0 font-medium underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:`Open agent settings`}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Dismiss provider authentication alert`,onClick:()=>a(c),className:`shrink-0 rounded-sm p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,X.jsx)(js,{className:`size-4`,"aria-hidden":`true`})})]});if(r||s.providers.some(e=>e.enabled&&Je(e,o)))return null;let l=s.providers.some(e=>Je(e,o)),u=s.providers.some(e=>e.status===`unknown`);return(0,X.jsxs)(`div`,{"data-slot":`provider-banner`,role:`status`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-muted/50 px-4 text-sm text-muted-foreground`,children:[(0,X.jsx)(q,{tone:u?`danger`:`pending`}),(0,X.jsx)(`span`,{children:l?`No agent provider is enabled.`:u?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,X.jsx)(G,{to:`/settings/agent-defaults#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 pp(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function mp(){let e=vt(),t=At().data,n=ap(),r=Jt(),i=F(),a=(0,Y.useRef)(Promise.resolve()),o=(0,Y.useRef)(0),s=(0,Y.useRef)(0),c=(0,Y.useRef)(pp(r.data));(0,Y.useEffect)(()=>{s.current===0&&(c.current=pp(r.data))},[r.data]);let l=(0,Y.useCallback)(e=>{let n=L.uiState,r=pp(i.getQueryData(n)),l=dp(lp(r?.dismissedProviderAuthFailures,t),e),u={...r,dismissedProviderAuthFailures:l};s.current+=1,i.setQueryData(n,u);let d=++o.current;a.current=a.current.then(async()=>{try{let e=await _e({dismissedProviderAuthFailures:l});c.current=pp(e),d===o.current&&i.setQueryData(n,e)}catch(e){d===o.current&&(c.current===void 0?i.removeQueries({queryKey:n,exact:!0}):i.setQueryData(n,c.current),i.invalidateQueries({queryKey:n}),V(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--s.current}})},[i,t]);return(0,X.jsx)(fp,{status:e.data,runners:t,pending:e.isPending,error:e.isError,dismissals:lp(pp(r.data)?.dismissedProviderAuthFailures,t),onDismissAuthFailures:l,accounts:n})}function hp(e={displayName:`Squawk`,command:`hsq`,npx:`npx -p @hearsay-tools/squawk hsq`}){return e.command}function gp(e){return e.reason===`legacy-change`?e.canImport?`${e.file} changed in the old home. Import keeps live-only changes. Old-home changes win when both homes changed the same key or entry.`:`${e.file} changed in the old home. Import is unavailable. Ignore keeps the live file and skips these old-home changes.`:e.reason===`outside-write`?`${e.file} changed outside Squawk. Restore the previous version or accept the file as found.`:e.file===`config.json`?`The project registry was reset. Restore the previous projects?`:`The account list was reset. Restore the previous accounts?`}function _p({file:e,editable:t}){let n=Yo(),r=Xo(),i=Zo(),a=e.reason===`legacy-change`,o=n.isPending||r.isPending||i.isPending,s=n.error??r.error??i.error,c=t=>{n.reset(),r.reset(),i.reset();let a={file:e.file,detectedAt:e.detectedAt};t===`restore`?n.mutate(a):t===`accept`?r.mutate(a):i.mutate(a)};return(0,X.jsxs)(`div`,{"data-slot":`home-recovery`,"data-home-file":e.file,role:`status`,"aria-live":`polite`,"aria-busy":o,className:`flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-border bg-muted/50 p-3 text-sm text-foreground`,children:[(0,X.jsx)(`span`,{className:`flex-[1_1_24rem] [min-inline-size:0] [overflow-wrap:break-word]`,children:gp(e)}),t?(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a?e.canImport&&(0,X.jsx)(U,{type:`button`,"data-action":`import`,disabled:o,onClick:()=>c(`import`),children:`Import changes from the old home`}):(0,X.jsx)(U,{type:`button`,"data-action":`restore`,disabled:o||!e.canRestore,onClick:()=>c(`restore`),children:`Restore`}),(0,X.jsx)(U,{type:`button`,variant:`outline`,"data-action":`accept`,disabled:o,onClick:()=>c(`accept`),children:a?`Ignore`:`Accept as found`})]}):t===!1&&(0,X.jsxs)(`p`,{className:`basis-full`,children:[a?e.canImport?`Only the host operator can import or ignore this file.`:`Only the host operator can ignore this file.`:`Only the host operator can restore or accept this file.`,e.file.startsWith(`remote-settings/`)&&(a?(0,X.jsxs)(X.Fragment,{children:[` `,e.canImport&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`code`,{children:[hp(),` backup import `,e.file]}),` or `]}),(0,X.jsxs)(`code`,{children:[hp(),` backup ignore `,e.file]})]}):(0,X.jsxs)(X.Fragment,{children:[` `,(0,X.jsxs)(`code`,{children:[hp(),` backup restore `,e.file]})]}))]}),t&&s&&(0,X.jsx)(`p`,{role:`alert`,className:`basis-full text-danger`,children:s.message})]})}function vp(){let e=Go(),t=St().data?.capabilities?.localHandoff;return(0,X.jsx)(`div`,{"data-slot":`home-recovery-state`,"data-state":e.isSuccess?`ready`:e.isError?`error`:`pending`,children:e.data?.files.map(e=>(0,X.jsx)(_p,{file:e,editable:!e.file.startsWith(`remote-settings/`)&&t},e.file))})}var yp=`hsq:reloaded-for-version`,bp=new WeakMap;function xp(e,t){if(!t)return null;let n=bp.get(e);return n===void 0?(bp.set(e,t),null):t===n?null:t}function Sp(e,t=Np()){try{return t?.getItem(yp)===e}catch{return!1}}function Cp(e,t=()=>window.location.reload()){try{Np()?.setItem(yp,e)}catch{}t()}var wp=[`textarea`,`input${[`search`,`checkbox`,`radio`,`hidden`,`button`,`submit`,`reset`,`image`,`file`,`range`,`color`].map(e=>`:not([type="${e}"])`).join(``)}`,`[contenteditable=""]`,`[contenteditable="true"]`].join(`, `),Tp=new WeakSet,Ep=new Set;function Dp(e){(0,Y.useEffect)(()=>{if(!e)return;let t=Symbol(`unsent-draft`);return Ep.add(t),()=>{Ep.delete(t)}},[e])}var Op=new WeakMap;function kp(e){return e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement?e.value:e.textContent??``}function Ap(e=document){let t=e=>{let t=e.target;t instanceof Element&&t.matches(wp)&&!Op.has(t)&&Op.set(t,kp(t))},n=e=>{e.target&&Tp.add(e.target)};return e.addEventListener(`focusin`,t,!0),e.addEventListener(`input`,n,!0),()=>{e.removeEventListener(`focusin`,t,!0),e.removeEventListener(`input`,n,!0)}}function jp(e){if(!Tp.has(e)||e.closest(`[data-persisted-draft], [data-slot="composer"]`)||(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement)&&(e.disabled||e.readOnly))return!1;let t=kp(e).trim(),n=Op.get(e);return n===void 0?t!==``:t!==n.trim()}function Mp(e=document){return Ep.size>0||Array.from(e.querySelectorAll(wp)).some(jp)}function Np(){try{return typeof window>`u`?void 0:window.sessionStorage}catch{return}}var Pp=2e3;function Fp({reload:e}){let t=St().data?.version,n=F(),[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(`reloading`);return(0,Y.useEffect)(()=>Ap(),[]),(0,Y.useEffect)(()=>{let e=xp(n,t);e!==null&&i(e)},[n,t]),(0,Y.useEffect)(()=>{if(r===null)return;if(Sp(r)){o(`manual`);return}let t=()=>Mp()?(o(`waiting-for-input`),!1):(o(`reloading`),Cp(r,e),!0);if(t())return;let n=window.setInterval(()=>{t()&&window.clearInterval(n)},Pp);return()=>window.clearInterval(n)},[r,e]),r===null?null:(0,X.jsxs)(`div`,{"data-slot":`version-reload`,"data-phase":a,role:`status`,className:`flex min-h-9 flex-wrap items-center gap-x-3 gap-y-1 border-b border-border bg-muted/50 px-4 py-1 text-sm text-foreground`,children:[(0,X.jsx)(`span`,{children:a===`reloading`?`Squawk was updated to ${r}. Reloading…`:a===`waiting-for-input`?`Squawk was updated to ${r}. It reloads once your unsent message is sent or cleared.`:`Squawk was updated to ${r}. Reload to use the new version.`}),a===`reloading`?null:(0,X.jsx)(U,{type:`button`,size:`sm`,variant:`outline`,className:`ml-auto max-md:min-h-11`,"data-action":`version-reload`,onClick:()=>Cp(r,e),children:`Reload now`})]})}var Ip=`cez-project-rail-expanded`;function Lp(e,t){return e-232-t>=640}function Rp(){try{return localStorage.getItem(Ip)===`1`}catch{return!1}}function zp(e){try{localStorage.setItem(Ip,e?`1`:`0`)}catch{}}var Bp=Y.lazy(()=>R(()=>import(`./project-rail-sortable-BmVI4_-T.js`),__vite__mapDeps([0,1,2,3,4])));function Vp(e){if(e!==void 0)return e.isDragging?`relative z-10 opacity-40 [-webkit-touch-callout:none]`:`[-webkit-touch-callout:none]`}function Hp({project:e,signal:t,known:n,current:r,target:i,onSwitchProject:a,onSelectProject:o,sort:s}){let l=Ll(e.name,t,{unknown:!n});return(0,X.jsxs)(`div`,{ref:s?.setNodeRef,style:s?.style,...s?.listeners,"data-slot":`rail-project`,"data-project-id":e.id,"data-dragging":s?.isDragging?``:void 0,className:c(`relative flex h-[52px] w-full shrink-0 items-center justify-center`,Vp(s)),children:[r?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`rail-current-bar`,className:`absolute top-1/2 left-0 h-5 w-[3px] -translate-y-1/2 rounded-r-[2px] bg-foreground`}):null,(0,X.jsxs)(`div`,{className:`relative size-9`,children:[(0,X.jsx)(z,{ref:s?.setActivatorNodeRef,"aria-describedby":s?.attributes[`aria-describedby`],to:i.href,onClick:t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(o?.(e.id),i.verify&&a&&(t.preventDefault(),a(e.id)))},"aria-label":l,title:l,"aria-current":r?`page`:void 0,className:c(`flex size-full items-center justify-center rounded-[9px] border text-[12px] leading-none font-semibold focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r?`border-soft-foreground bg-sidebar-row-selected text-foreground`:`border-transparent bg-muted text-muted-foreground hover:text-foreground`),children:Bl(e.name)}),(0,X.jsx)(nu,{position:`top`,segments:ru(t).top}),(0,X.jsx)(nu,{position:`bottom`,segments:ru(t).bottom})]})]})}var Up=`motion-safe:rail-text-in`;function Wp({project:e,signal:t,known:n,current:r,target:i,onSwitchProject:a,onSelectProject:o,sort:s}){let l=Ll(e.name,t,{unknown:!n}),{top:u,bottom:d}=ru(t),f=r?`border-sidebar-row-selected`:`border-background group-hover:border-sidebar-row-hover`;return(0,X.jsxs)(`div`,{ref:s?.setNodeRef,style:s?.style,...s?.listeners,"data-slot":`rail-project`,"data-project-id":e.id,"data-dragging":s?.isDragging?``:void 0,className:c(`group/row relative w-full shrink-0`,Vp(s)),children:[(0,X.jsxs)(z,{to:i.href,onClick:t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(o?.(e.id),i.verify&&a&&(t.preventDefault(),a(e.id)))},"aria-label":l,"aria-current":r?`page`:void 0,className:c(`group flex h-[52px] w-full items-center gap-[10px] rounded-[8px] px-[6px] pr-6 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r?`bg-sidebar-row-selected`:`hover:bg-sidebar-row-hover`),children:[(0,X.jsxs)(`span`,{"aria-hidden":`true`,"data-slot":`rail-mark`,className:c(`relative flex size-9 shrink-0 items-center justify-center rounded-[9px] border text-[12px] leading-none font-semibold`,r?`border-soft-foreground bg-sidebar text-foreground`:`border-transparent bg-muted text-muted-foreground`),children:[Bl(e.name),(0,X.jsx)(nu,{position:`top`,segments:u,className:f}),(0,X.jsx)(nu,{position:`bottom`,segments:d,className:f})]}),(0,X.jsxs)(`span`,{className:c(`flex min-w-0 flex-1 flex-col gap-px`,Up),children:[(0,X.jsx)(`span`,{"data-slot":`rail-project-name`,className:c(`truncate text-[13.5px] leading-[18px] font-semibold`,r?`text-foreground`:`text-muted-foreground`),children:e.name}),(0,X.jsx)(Ql,{signal:t,known:n,current:r,maxParts:2,slot:`rail-project-state`,className:`h-4 gap-x-[4px] overflow-hidden text-[11px] leading-4 whitespace-nowrap`})]})]}),s?(0,X.jsx)(Gp,{name:e.name,sort:s}):null]})}function Gp({name:e,sort:t}){return(0,X.jsx)(`button`,{type:`button`,ref:t.setActivatorNodeRef,"data-slot":`rail-project-grip`,...t.attributes,"aria-label":`Reorder ${e}, position ${t.position} of ${t.total}`,className:c(`absolute top-1/2 right-0.5 flex h-10 w-5 -translate-y-1/2 cursor-grab touch-none items-center justify-center rounded text-soft-foreground opacity-0 outline-none transition-opacity hover:text-foreground motion-reduce:transition-none`,`focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50`,`group-hover/row:opacity-100 group-focus-within/row:opacity-100 [@media(hover:none)]:opacity-100`),children:(0,X.jsx)(xs,{"aria-hidden":`true`,className:`size-3.5`})})}function Kp(e){return c(`flex shrink-0 items-center rounded-[8px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,e?`size-auto h-9 w-full justify-start gap-3 px-2.5 text-[13px] font-normal`:`size-9 justify-center`)}var qp=c(`truncate text-muted-foreground group-hover:text-foreground`,Up);function Jp({to:e,label:t,slot:n,active:r,expanded:i,children:a}){return(0,X.jsxs)(z,{to:e,"data-slot":n,"aria-label":t,title:i?void 0:t,"aria-current":r?`page`:void 0,className:c(`group`,Kp(i),r&&`bg-sidebar-row-selected text-foreground hover:bg-sidebar-row-selected`),children:[a,i?(0,X.jsx)(`span`,{className:qp,children:t}):null]})}function Yp(e){let[t,n]=Y.useState(()=>window.innerWidth);return Y.useEffect(()=>{let e=()=>n(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),Lp(t,e)}function Xp(){let e=Yp(Y.useContext(Rs));return(0,X.jsx)(`div`,{"aria-hidden":`true`,"data-slot":`project-rail-placeholder`,style:{width:Rp()&&e?232:60},className:`hidden shrink-0 border-r border-border bg-background md:block`})}var Zp=e=>({href:String(Ea(e,`/`)),verify:!1});function Qp({expanded:e,resolvedTheme:t,version:n}){let r=n?`Squawk v${n}`:`Squawk`;return e?(0,X.jsxs)(`div`,{"data-slot":`rail-identity`,className:`flex shrink-0 flex-col gap-0.5`,children:[(0,X.jsxs)(`div`,{className:`flex h-[34px] items-center gap-[10px] px-0.5`,children:[(0,X.jsx)(`img`,{src:`/cezarion-mark-${t}.svg`,alt:``,"aria-hidden":`true`,"data-slot":`rail-app-mark`,className:`size-[34px] shrink-0 rounded-[8px]`}),(0,X.jsxs)(`span`,{className:c(`flex min-w-0 items-baseline gap-[10px] whitespace-nowrap`,Up),"aria-label":r,children:[(0,X.jsx)(`span`,{className:`text-[15px] leading-none font-bold text-foreground`,children:`Squawk`}),n?(0,X.jsxs)(`span`,{"data-slot":`rail-version`,title:`v${n}`,className:`min-w-0 truncate text-[11px] leading-none text-soft-foreground`,children:[`v`,n]}):null]})]}),(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`h-px w-full bg-border`}),(0,X.jsx)(`div`,{className:c(`px-1 pt-2.5 pb-1 text-[11px] font-medium text-soft-foreground`,Up),children:`Projects`})]}):(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-0.5`,children:[(0,X.jsx)(`img`,{src:`/cezarion-mark-${t}.svg`,alt:r,title:r,"data-slot":`rail-app-mark`,className:`size-[34px] rounded-[9px]`}),(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`mt-0.5 mb-1.5 h-px w-6 bg-border`})]})}function $p({expanded:e}){return e?(0,X.jsx)(Ol,{origin:`rail`,icon:ar,iconClassName:`size-[15px] text-soft-foreground`,iconFrameClassName:`flex size-9 shrink-0 items-center justify-center rounded-[9px] border border-border`,label:`Add project`,side:`right`,triggerClassName:c(`h-[44px] w-full shrink-0 justify-start gap-[10px] rounded-[8px] px-[6px] text-[13px] font-normal text-muted-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring motion-safe:[&>span:last-child]:rail-text-in`)}):(0,X.jsx)(Ol,{origin:`rail`,icon:ar,iconClassName:`size-[15px]`,side:`right`,triggerClassName:`shrink-0 rounded-[9px] border border-border text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`})}function em({roomToExpand:e,expanded:t,toggle:n,railId:r,allProjectsActive:i,settingsActive:a}){return(0,X.jsxs)(`div`,{"data-slot":`rail-bottom`,className:c(`flex shrink-0 flex-col gap-0.5 pt-2`,t?`items-stretch`:`items-center`),children:[e?(0,X.jsxs)(`button`,{type:`button`,"data-slot":`rail-expand-toggle`,"aria-expanded":t,"aria-controls":r,"aria-label":t?`Collapse projects`:`Expand projects`,title:t?void 0:`Expand projects`,onClick:n,className:c(`group`,Kp(t)),children:[t?(0,X.jsx)(Ts,{className:`size-4 shrink-0`,"aria-hidden":`true`}):(0,X.jsx)(Es,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t?(0,X.jsx)(`span`,{className:qp,children:`Collapse`}):null]}):null,(0,X.jsx)(Jp,{to:`/tasks`,label:`All projects`,slot:`rail-all-projects`,active:i,expanded:t,children:(0,X.jsx)(Gr,{className:`size-4 shrink-0`,"aria-hidden":`true`})}),(0,X.jsx)(Jp,{to:`/settings/global/appearance`,label:`Global settings`,slot:`rail-global-settings`,active:a,expanded:t,children:(0,X.jsx)(gr,{className:`size-4 shrink-0`,"aria-hidden":`true`})}),(0,X.jsx)(xu,{showLabel:t,labelClassName:qp,className:c(`group`,Kp(t),`[&_svg]:size-4`)})]})}function tm({children:e,rememberFocus:t,restoreFocus:n}){return Y.useLayoutEffect(()=>(n(),t),[t,n]),(0,X.jsx)(X.Fragment,{children:e})}function nm({projects:e,signals:t,version:n,projectTarget:r=Zp,onSwitchProject:i,onSelectProject:a,canReorder:o=!1,onReorder:s}){let{pathname:l}=gn(),{resolvedTheme:u}=vu(),d=Y.useContext(Rs),[f,p]=Y.useState(Rp),m=Yp(d),h=f&&m,g=()=>{let e=!h;p(e),zp(e)},_=Oa(l),v=l===`/tasks`,y=l===`/settings/global`||l.startsWith(`/settings/global/`),b=Y.useId(),x=Y.useRef(null),S=Y.useRef(null),C=Y.useCallback(()=>{let e=document.activeElement;if(!(e instanceof HTMLAnchorElement)||!x.current?.contains(e))return;let t=e.closest(`[data-project-id]`)?.dataset.projectId;t&&(S.current={link:e,projectId:t})},[]),w=Y.useCallback(()=>{let e=S.current;if(S.current=null,!e||e.link.isConnected||document.activeElement!==document.body)return;let t=x.current?.querySelectorAll(`[data-project-id]`)??[];for(let n of t)if(n.dataset.projectId===e.projectId){n.querySelector(`a`)?.focus({preventScroll:!0});break}},[]),T=o&&s!==void 0&&e.length>1,E=(e,n)=>(0,X.jsx)(h?Wp:Hp,{project:e,signal:t?.get(e.id),known:t!==null,current:e.id===_,target:r(e.id),onSwitchProject:i,onSelectProject:a,sort:n},e.id),D=(0,X.jsx)(tm,{rememberFocus:C,restoreFocus:w,children:e.map(e=>E(e))});return(0,X.jsxs)(`nav`,{id:b,"aria-label":`Projects`,"data-slot":`project-rail`,"data-expanded":h?`true`:`false`,style:{width:h?232:60},className:c(`hidden shrink-0 flex-col overflow-hidden border-r border-border bg-background pt-3 pb-3.5 transition-[width] duration-[160ms] ease-out motion-reduce:transition-none md:flex`,h?`items-stretch px-2.5`:`items-center`),children:[(0,X.jsx)(Qp,{expanded:h,resolvedTheme:u,version:n}),(0,X.jsxs)(`div`,{ref:x,"data-slot":`rail-projects`,className:c(`flex min-h-0 w-full flex-1 flex-col gap-0.5 overflow-y-auto overscroll-contain [scrollbar-width:none]`,h?`items-stretch`:`items-center`),children:[T?(0,X.jsx)(Y.Suspense,{fallback:D,children:(0,X.jsx)(Bp,{projects:e,onReorder:s,renderProject:E,onReady:w})}):D,(0,X.jsx)($p,{expanded:h})]}),(0,X.jsx)(em,{roomToExpand:m,expanded:h,toggle:g,railId:b,allProjectsActive:v,settingsActive:y})]})}function rm(){let e=F(),t=tn().data?.projects,{order:n,canReorder:r,setOrder:i}=jf(),a=r&&t!==void 0&&ho(t.length),o=Y.useMemo(()=>t?po(t,n):void 0,[t,n]),s=un(!0,void 0,Y.useMemo(()=>{let e;return t=>{let n=Il(t.runs);return e&&e.size===n.size&&[...n].every(([t,n])=>{let r=e.get(t);return r&&r.needsYou===n.needsYou&&r.failedUnread===n.failedUnread&&r.inMotion===n.inMotion&&r.finishedUnread===n.finishedUnread})?e:(e=n,n)}},[])).data??null,c=t?.map(e=>e.id).sort().join(`
3
3
  `),l=Y.useRef(void 0);return Y.useEffect(()=>{if(c===void 0)return;let t=l.current;if(l.current=c,t===void 0||t===c)return;let n=new Set(t.split(`
4
4
  `)),r=new Set(c.split(`
5
- `)),i=Ft(e);for(let e of n)r.has(e)||i.dropProject(e);let a=[...r].filter(e=>!n.has(e));for(let e of a)i.restoreProject(e);a.length>0&&i.reconcile({hold:!0})},[e,c]),Y.useMemo(()=>o?{projects:o,signals:s,canReorder:a,onReorder:i}:null,[o,s,a,i])}var im=60;function am(e){return`title`in e?`Archived "${e.title.length>im?`${e.title.slice(0,im-1)}…`:e.title}"`:`Archived ${e.count} ${e.count===1?`task`:`tasks`}`}async function om(e,t,n){let r=new Set(n),i=(await Promise.allSettled(t.map(async t=>{await Re(rn(t,{projectId:e}),!1),r.has(t)&&await pe(rn(t,{projectId:e}),!0)}))).find(e=>e.status===`rejected`);i&&V(i.reason instanceof Error?i.reason.message:`Could not undo the archive.`,{tone:`danger`})}function sm(){let e=document.activeElement;return!e||e===document.body||!e.isConnected}function cm(e,t){if(!e.isConnected)return t();let n=new MutationObserver(()=>{e.isConnected||(n.disconnect(),clearTimeout(r),t())}),r=setTimeout(()=>n.disconnect(),5e3);n.observe(document.body,{childList:!0,subtree:!0})}function lm(e,t){if(!sm())return;let n=e?.isConnected?e:t?.isConnected?t:null;n instanceof HTMLElement&&(n.tabIndex<0&&!n.hasAttribute(`tabindex`)&&(n.tabIndex=-1),n.focus({preventScroll:!0}))}function um(e,t,n){if(!e)return()=>{};let r=t(e);return()=>cm(e,()=>lm(r,n))}function dm(e){let t=document.activeElement?.closest(`[data-slot="task-row"]`);return t?.getAttribute(`data-run-id`)===e?t:Array.from(document.querySelectorAll(`[data-slot="task-row"]`)).find(t=>t.getAttribute(`data-run-id`)===e)??null}var fm=e=>e?.querySelector(`a`)??null;function pm(e,t){let n=e?.projectId,r=e?.cacheScope,i=Lt(),[o,s]=Y.useState(null),c=e=>i.invalidateAfter(`runs`,Zt({projectId:n,cacheScope:e})),l=(e,t,r,i)=>V(e,{action:{label:`Undo`,onAction:()=>void om(n,r,i).finally(()=>void c(t))}}),u=Y.useRef(new Map);return{archiveOne:e=>{let i=u.current.get(e.id);if(i)return i;let o=r??a(),s=!!e.pinned,d=dm(e.id),f=um(d,e=>{let t=Array.from(e.closest(`[data-slot="quick-list-bucket"]`)?.querySelectorAll(`[data-slot="task-row"]`)??[]),n=t.indexOf(e);return fm(t[n+1]??t[n-1])},d?.closest(`[data-slot="quick-list-bucket"]`)?.parentElement??null),p=Re(rn(e.id,{projectId:n}),!0).then(()=>(c(o),l(am({title:K(e)}),o,[e.id],s?[e.id]:[]),f(),t?.(),!0),e=>(V(e.message,{tone:`danger`}),!1)).finally(()=>u.current.delete(e.id));return u.current.set(e.id,p),p},sweep:(e,i)=>{let o=r??a();s(e);let u=document.activeElement,d=u?.matches(`[data-action="archive-group"]`)?u:null,f=um(d,e=>fm(e.closest(`[data-slot="quick-list-bucket"]`)?.nextElementSibling?.querySelector(`[data-slot="task-row"]`)??void 0),d?.closest(`[data-slot="quick-list-bucket"]`)?.parentElement??null);ye(Zt({projectId:n}),e,i).then(({ids:e,pinnedIds:n})=>{c(o),e.length>0&&l(am({count:e.length}),o,e,n),f(),e.length>0&&t?.()},e=>V(e.message,{tone:`danger`})).finally(()=>s(null))},sweeping:o}}var mm=.6,hm=300,gm=100,_m={offset:0,phase:`idle`,past:!1},vm=null;function ym(e,t){vm&&vm.id!==e&&vm.close(),vm={id:e,close:t}}function bm(e){vm?.id===e&&(vm=null)}function xm(){if(!(typeof navigator>`u`||typeof navigator.vibrate!=`function`))try{navigator.vibrate(10)}catch{}}function Sm({id:e,enabled:t,onArchive:n}){let[r,i]=Y.useState(_m),a=Y.useRef(null),o=Y.useRef(null),s=Y.useRef(!1),c=Y.useRef(!1),l=Y.useRef(void 0),u=()=>{c.current=!0,clearTimeout(l.current),l.current=void 0},d=()=>{c.current&&(clearTimeout(l.current),l.current=setTimeout(()=>{c.current=!1},hm))};Y.useEffect(()=>()=>clearTimeout(l.current),[]);let f=Y.useRef(r);f.current=r;let p=Y.useRef(n);p.current=n;let m=Y.useCallback(()=>{o.current=null,s.current=!1,bm(e),i(_m)},[e]);Y.useEffect(()=>{!t&&f.current.phase!==`committing`&&m()},[t,m]),Y.useEffect(()=>()=>bm(e),[e]);let h=r.phase===`open`;Y.useEffect(()=>{if(!h)return;let e=()=>m(),t=e=>{let t=a.current;t&&e.target instanceof Node&&t.contains(e.target)||m()};return document.addEventListener(`scroll`,e,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,t,!0),()=>{document.removeEventListener(`scroll`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,!0)}},[h,m]);let g=t=>{bm(e),i({offset:-t,phase:`committing`,past:!0});let n=e=>{e===!1&&m()};try{let e=p.current();e&&typeof e.then==`function`&&e.then(n,m)}catch{m()}};return{offset:r.offset,phase:r.phase,past:r.past,surfaceRef:a,bind:{onPointerDown:e=>{if(c.current=!1,!t||f.current.phase===`committing`||e.pointerType===`mouse`&&e.button!==0)return;let n=(a.current??e.currentTarget).getBoundingClientRect();o.current={pointerId:e.pointerId,x0:e.clientX,y0:e.clientY,base:f.current.phase===`open`?-88:0,width:n.width>0?n.width:320,axis:null,wasOpen:f.current.phase===`open`,samples:[{x:e.clientX,t:Date.now()}]}},onPointerMove:t=>{let n=o.current;if(!n||t.pointerId!==n.pointerId)return;let r=t.clientX-n.x0,a=t.clientY-n.y0;if(n.axis===null){if(Math.max(Math.abs(r),Math.abs(a))<10||(n.axis=Math.abs(r)>Math.abs(a)?`x`:`y`,n.axis===`y`))return;try{t.currentTarget.setPointerCapture?.(t.pointerId)}catch{}ym(e,m),u()}if(n.axis!==`x`)return;let c=Math.min(0,Math.max(-n.width,n.base+r)),l=-c>=mm*n.width;l&&!s.current&&xm(),s.current=l,n.samples.push({x:t.clientX,t:Date.now()}),n.samples.length>8&&n.samples.shift(),i({offset:c,phase:`dragging`,past:l})},onPointerUp:t=>{let n=o.current;if(!n||t.pointerId!==n.pointerId)return;if(o.current=null,n.axis!==`x`){n.axis===null&&n.wasOpen&&(u(),d(),m());return}d();let r=f.current.offset,a=Date.now(),c={x:t.clientX,t:a},l=n.samples.find(e=>a-e.t<=gm&&e.t<a),p=l?(c.x-l.x)/(c.t-l.t):0;s.current=!1,f.current.past||p<=-1&&-r>=40?g(n.width):p<1&&-r>=40?(ym(e,m),i({offset:-88,phase:`open`,past:!1})):m()},onPointerCancel:e=>{let t=o.current;!t||e.pointerId!==t.pointerId||(o.current=null,d(),t.axis===`x`&&m())},onClickCapture:e=>{c.current&&(c.current=!1,e.preventDefault(),e.stopPropagation())},onKeyDownCapture:()=>{c.current=!1}},close:m}}function Cm(e){if(e<1e3)return String(e);let t=[`k`,`M`,`B`,`T`],n=Math.floor(Math.log10(e)/3);return n>t.length?e.toExponential(0).replace(`+`,``):`${Math.floor(e/1e3**n)}${t[n-1]}`}function wm({stat:e,className:t,compact:n=!1}){let r=`+${e.adds} −${e.dels} across ${e.files} ${e.files===1?`file`:`files`}`,i=e.repointed?`${r} — measured against another branch checked out in this task's worktree, as this task found it`:void 0;return(0,X.jsxs)(`span`,{"data-slot":`diff-stat`,...i?{"data-repointed":`true`,"aria-label":i}:{},...n&&!i?{"aria-label":r}:{},title:i??r,className:c(`font-mono text-xs font-semibold tabular-nums`,e.repointed&&`cursor-help underline decoration-dotted underline-offset-2`,t),children:[(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,n?Cm(e.adds):e.adds.toLocaleString(`en-US`)]}),` `,(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,n?Cm(e.dels):e.dels.toLocaleString(`en-US`)]})]})}function Tm(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}function Em(e){return Fa(e)?.runner??e.runner??`claude`}function Dm(e,t,n,r,i,a){return a?e.workflowDef?.steps.find(n=>n.command===void 0&&n.kind!==`plugin`&&(n.runner??e.runner??`claude`)===t)?.agentProfile??(t===n?e.agentProfile:void 0)??i?.[t]:t===r?Fa(e)?.agentProfile:i?.[t]}function Om(e,t,n,r,i=!1){let a=r?.original??Em(e),o=r?.target??a;if(e.delegation?.role===`worker`){let r=Dm(e,t,a,o,n,i);if(r!==void 0||i)return r}if(t!==o)return n?.[t];let s=La(e),c=s.profileId??`default`;return s.sessionId!==void 0&&s.backend===o&&(e.agentProfile??c)===c?c:(o===a?e.agentProfile:void 0)??n?.[t]}function km(e,t,n){let r=La(e),i=r.sessionId===void 0?{runner:e.runner??`claude`,account:e.agentProfile}:{runner:r.backend,account:r.profileId??e.agentProfile};return(i.runner===t?i.account:void 0)??n?.[t]}function Am(e,t,n){let r=e.find(e=>e.provider===t&&e.id===n);return r?.isDefault?void 0:r}function jm(e,t,n,r){return Am(n,t,Om(e,t,r))}function Mm(e,t,n,r){let i=Se(t,e);return i?.enabled===!1?{provider:e,usable:!1,reason:`${_t(n,e)} is disabled. Enable it in ${wi(`providers`)}.`}:r&&i?.authFailureId===void 0?r.status===void 0||r.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${_t(n,e)} account "${r.label}" is not signed in. Sign in in ${wi(`providers`)}.`}:i?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${_t(n,e)} credentials are unavailable. Authorize it in ${wi(`providers`)}.`}}function Nm(e,t,n,r){return Mm(Tm(e),t,n,r)}function Pm(e,t,n,r){return Mm(Em(e),t,n,r)}function Fm(e){let t=vt(),n=At().data,r=Tm(e),{accounts:i,repoAccount:a}=op(),o=Am(i,r,km(e,r,a));return t.isSuccess&&t.data&&n?Nm(e,t.data,n,o):{provider:r,usable:!0}}function Im(e){let t=vt(),n=At(),r=Em(e),{accounts:i,repoAccount:a}=op(),o=jm(e,r,i,a);return t.isSuccess&&t.data&&n.data?Pm(e,t.data,n.data,o):t.isError||n.isError?{provider:r,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:r,usable:!1,reason:`Checking agent providers…`}}function Lm(e){return La(e).sessionId}function Rm(e){return La(e).backend}function zm(e){if(Ba(e)||e.cliHandoff===!1)return;let t=e.cliResumeCommand;if(t!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${t}`:t}function Bm(e,t){let n=Kr(t);return!n||Ba(e)?!1:n===Rm(e)&&Lm(e)!==void 0}function Vm(e){return(e.status===`failed`||ge(e))&&(e.waits?.length??0)>0}function Hm(e,t){return t&&e.delegation?.role===`root`&&(e.status===`failed`||ge(e))}function Um(e){return e.status===`cancelled`&&e.startedAt===void 0&&e.workflowDef!==void 0&&e.steps.every(e=>e.status===`pending`&&e.startedAt===void 0&&!e.sessionId)}function Wm(e){return Ia(e)&&e.removedRunner===void 0}function Gm(e,t=!1){let n=Ba(e),r=Lm(e)!==void 0;return{finish:e.status===`waiting`&&n||e.status===`review`,continueRun:(!n||e.removedRunner!==void 0&&e.status!==`queued`)&&!e.stopping&&e.delegation?.role!==`invalid`&&!(e.delegation?.role===`worker`&&e.delegation.destroy)&&(r||Um(e)||e.removedRunner!==void 0),terminal:Zm(e,n,r),notes:!0,archive:!n,pin:!e.archived&&!Ya(e),markUnread:ro(e)&&!no(e),cancel:n||Vm(e)||Hm(e,t),deleteRun:!n}}function Km(e,t=!1){let n=Gm(e,t);return n.archive&&!n.cancel&&!e.archiveBlocker}function qm(e){return e.status===`waiting`&&e.finishBlocked===null&&Ne(e).bucket===`waiting`}function Jm(e){return`Merge head branch and resolve conflicts in ${e?`PR number ${e}`:`this pull request`}`}function Ym(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function Xm(e,t){let n=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).findIndex(e=>e.id===t);return n>=0?n+1:void 0}function Zm(e,t,n){return e.cliHandoff!==!1&&!t&&n}var Qm=[50,100,200,400,800,1e3,1e3,1e3,1e3],$m=e=>new Promise(t=>setTimeout(t,e));function eh(e){return e instanceof je&&e.status===409&&e.message===`run is still active`}async function th(e,t=$m){for(let n=0;;n+=1)try{return await e()}catch(e){let r=Qm[n];if(!eh(e)||r===void 0)throw e;await t(r)}}function nh(e){return Ba(e)?`live`:Gm(e).continueRun?`resume`:`unavailable`}function rh(e,t){let n=Dt(e.id,t),r=Kt(e.id,t),i=Fm(e),a=Im(e),[o,s]=(0,Y.useState)(void 0),[c,l]=(0,Y.useState)(!1),u=(0,Y.useRef)(!1),d=nh(e),f=d===`resume`?!a.usable:d===`live`&&!i.usable,p=d===`unavailable`?`no-session`:f?`provider`:void 0,m=p===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:p===`provider`?d===`resume`?a.reason:i.reason:void 0,h=(e,t)=>a.usable?r.mutateAsync({text:e,...t===void 0?{}:{images:t}}):Promise.reject(Error(a.reason??`The run provider is unavailable.`));return{mode:d,blockedBy:p,reason:m,isPending:c||n.isPending||r.isPending,error:o,send:async(t,r)=>{if(p||u.current)return m;u.current=!0,l(!0),s(void 0);try{if(d===`resume`){await th(()=>h(t,r));return}try{await n.mutateAsync({text:t,...r===void 0?{}:{images:r}})}catch(n){if(n instanceof je&&n.status===409&&Lm(e)!==void 0){try{await th(()=>h(t,r))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Session closed. Retry to reopen the session. ${t}`)}return}throw n}return}catch(e){let t=e instanceof Error?e.message:String(e);return s(t),t}finally{u.current=!1,l(!1)}}}}function ih({run:e,projectId:t,prNumber:n}){let r=rh(e,t),i=Ti(),[a,o]=(0,Y.useState)(!1),s=a||r.isPending,c=!!r.blockedBy,l=async()=>{if(s||c)return;let e=r.mode===`resume`;o(!0);try{let t=await r.send(Jm(n));t?V(t,{tone:`danger`}):(V(`${e?`Task reopened`:`Sent to the task`} — resolving conflicts${n?` in PR #${n}`:``}`),i())}finally{o(!1)}};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(U,{type:`button`,size:`sm`,"data-slot":`reference-conflict-action`,disabled:c||s,onClick:()=>void l(),className:`h-7 w-full text-xs`,children:s?`Sending…`:`Resolve conflicts`}),c&&r.reason?(0,X.jsx)(`span`,{className:`block opacity-70`,children:r.reason}):null]})}function ah({projectId:e,runId:t,prNumber:n}){let r=Nt(e,t);return r.data?(0,X.jsx)(ih,{run:r.data,projectId:e,prNumber:n}):(0,X.jsx)(U,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:r.isError?`Unavailable`:`Loading…`})}function oh({runId:e,prNumber:t}){let{projectId:n}=Ei();return n===void 0?(0,X.jsx)(sh,{runId:e,prNumber:t}):(0,X.jsx)(ah,{projectId:n,runId:e,prNumber:t})}function sh({runId:e,prNumber:t}){let n=cn(e);return n.data?(0,X.jsx)(ih,{run:n.data,prNumber:t}):(0,X.jsx)(U,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:n.isError?`Unavailable`:`Loading…`})}function ch({run:e,reference:t,className:n,compact:r=!1,plain:i=!1,inert:a=!1}){let{projectId:o,repoBase:s}=Ei(),c=o!==void 0&&t.number!==void 0?Fn(o,e.id,{kind:t.kind,number:t.number,url:t.url},s):void 0;return(0,X.jsx)(Di,{reference:t,taskTitle:K(e),to:c,conflictAction:Nn({...t,number:t.number??0},s)?(0,X.jsx)(oh,{runId:e.id,prNumber:t.number}):void 0,className:n,compact:r,plain:i,inert:a})}var lh=220;function uh({references:e,taskTitle:t,visibleCount:n,plain:r=!1,projectId:i,runId:a,repoBase:o}){let[s,c]=Y.useState(!1),l=Y.useRef(!1),u=Y.useRef(!1),d=Y.useRef(null),f=Y.useRef(void 0);Y.useEffect(()=>()=>clearTimeout(f.current),[]);let p=e=>e.pointerType!==`touch`,m=()=>clearTimeout(f.current),h=e=>{p(e)&&(m(),s||(l.current=!0),c(!0))},g=e=>{p(e)&&(m(),f.current=setTimeout(()=>c(!1),lh))},_=e.length-n,v=e.slice(n).map(t=>{let n=e.some(e=>e!==t&&e.kind===t.kind&&e.number===t.number)&&t.url?new URL(t.url).pathname.split(`/`).slice(1,3).join(`/`):``;return`${t.kind} #${t.number}${n?` (${n})`:``}`}).join(`, `);return _<=0?null:(0,X.jsxs)(ga,{open:s,onOpenChange:c,children:[(0,X.jsx)(fa,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`reference-overflow`,title:v,"aria-label":`Show all ${e.length} references for ${t}`,onPointerEnter:h,onPointerLeave:g,onPointerDown:e=>{e.stopPropagation(),u.current=s&&l.current,l.current=!1},onClick:e=>{e.stopPropagation(),s&&(u.current||l.current)&&(e.preventDefault(),m(),d.current?.focus()),u.current=!1,l.current=!1},className:`no-hover:min-h-[44px] no-hover:min-w-[44px] max-md:min-h-[44px] max-md:min-w-[44px] shrink-0 rounded-full px-1 text-[11px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[`+`,_]})}),(0,X.jsxs)(ha,{ref:d,align:`start`,collisionPadding:8,className:`w-auto min-w-40 max-h-(--radix-popover-content-available-height) overflow-y-auto overscroll-contain p-1.5`,"data-slot":`reference-overflow-list`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onPointerEnter:h,onPointerLeave:g,onOpenAutoFocus:e=>{e.preventDefault(),!l.current&&e.target instanceof HTMLElement&&e.target.focus()},onKeyDownCapture:e=>{e.key===`Escape`&&(e.preventDefault(),l.current=!1,c(!1))},onCloseAutoFocus:e=>{l.current&&e.preventDefault()},children:[(0,X.jsx)(`p`,{className:`px-1 pb-1.5 text-[11px] text-soft-foreground`,children:`References`}),(0,X.jsx)(`span`,{className:`flex flex-col items-start gap-1`,children:e.map(e=>(0,X.jsx)(Di,{reference:e,taskTitle:t,projectId:i,repoBase:o,to:i===void 0?void 0:Fn(i,a,e,o),plain:r,className:`no-hover:min-h-[44px] max-md:min-h-[44px]`,conflictAction:i&&Nn(e,o)?(0,X.jsx)(ah,{projectId:i,runId:a,prNumber:e.number}):void 0},Un(e)))})]})]})}function dh({references:e,maxVisible:t,taskTitle:n,projectId:r,runId:i,repoBase:a,plain:o=!1,compact:s=!1,inertInline:c=!1,fitContainer:l=!1,overflowContainer:u}){let d=Y.useRef(null),[f,p]=Y.useState(t),m=Y.useRef(new Map),h=e.map(Un).join(`|`);Y.useLayoutEffect(()=>{let n=d.current;if(!l||!n?.parentElement){p(t);return}let r=n.parentElement,i=()=>{[...n.querySelectorAll(`:scope > [data-slot="pr-chip"], :scope > [data-slot="issue-chip"]`)].forEach((t,n)=>{let r=t.getBoundingClientRect().width;r&&m.current.set(Un(e[n]),r)});let i=r.getBoundingClientRect();if(!i.width)return;let a=Math.min(t,e.length);n.dataset.referenceWidth=String(e.slice(0,a).reduce((e,t)=>e+(m.current.get(Un(t))??48),0)+Math.max(0,a-1)*4);let o=0;for(let e=n.nextElementSibling;e;e=e.nextElementSibling){if(e.getAttribute(`data-slot`)===`task-row-age`||e.getAttribute(`aria-hidden`)===`true`&&e.nextElementSibling?.getAttribute(`data-slot`)===`task-row-age`)continue;let t=getComputedStyle(e);o+=e.getBoundingClientRect().width+(parseFloat(t.marginLeft)||0)+(parseFloat(t.marginRight)||0)}let s=i.right-n.getBoundingClientRect().left-o,l=n.querySelector(`[data-slot="reference-overflow"]`)?.getBoundingClientRect().width||(c?44:26),d=Math.min(t,e.length);for(;d>0&&!(e.slice(0,d).reduce((e,t)=>e+(m.current.get(Un(t))??48)+4,0)+(u===void 0&&d<e.length?l:0)<=s+(d===e.length?u?.getBoundingClientRect().width??0:0));)d--;p(d)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);return a.observe(r),a.observe(n),()=>a.disconnect()},[l,t,h,c,e,u]);let g=Math.min(f,t,e.length),_=(0,X.jsx)(uh,{references:e,visibleCount:g,taskTitle:n,projectId:r,runId:i,repoBase:a,plain:o});return(0,X.jsxs)(`span`,{ref:d,"data-slot":`reference-list`,className:`inline-flex max-w-full flex-nowrap items-center gap-1 align-middle`,children:[e.slice(0,g).map(e=>(0,X.jsx)(Di,{reference:e,taskTitle:n,projectId:r,repoBase:a,to:r===void 0?void 0:Fn(r,i,e,a),plain:o,compact:s,inert:c,className:`shrink-0`,conflictAction:r&&Nn(e,a)?(0,X.jsx)(ah,{projectId:r,runId:i,prNumber:e.number}):void 0},Un(e))),u===void 0?_:u?(0,Ku.createPortal)(_,u):null]})}function fh({pinned:e,onToggle:t,className:n}){return(0,X.jsx)(`button`,{type:`button`,"data-slot":`pin-toggle`,"data-pinned":e?`true`:void 0,"aria-pressed":e,"aria-label":e?`Unpin task`:`Pin task`,title:e?`Unpin from the top of the list`:`Pin to the top of the list`,onClick:n=>{n.stopPropagation(),t(!e)},className:c(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-soft-foreground transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,n,`max-md:min-h-11 max-md:min-w-11 no-hover:min-h-11 no-hover:min-w-11`),children:(0,X.jsx)(Os,{"data-slot":`pin-icon`,className:`size-[12px]`,fill:e?`currentColor`:`none`,"aria-hidden":`true`})})}var ph=`opacity-0 group-hover/task-row:opacity-100 focus-visible:opacity-100 group-has-[:focus-visible]/task-row:opacity-100 no-hover:opacity-100`,mh=`opacity-0 group-hover/task-row:opacity-100 focus-visible:opacity-100 group-has-[:focus-visible]/task-row:opacity-100`,hh=`transition-opacity motion-reduce:transition-none group-hover/task-row:opacity-0 group-has-[:focus-visible]/task-row:opacity-0 max-md:absolute max-md:top-1/2 max-md:left-0 max-md:-translate-y-1/2 max-md:opacity-100 no-hover:absolute no-hover:top-1/2 no-hover:left-0 no-hover:-translate-y-1/2 no-hover:opacity-100`;function gh({run:e,title:t,unread:n,inertReferences:r,onTogglePin:i,onArchiveRun:a}){return(0,X.jsxs)(`span`,{"data-slot":`task-row-trailing`,className:`relative flex h-[19px] w-[16px] shrink-0 items-center justify-center max-md:h-auto max-md:w-11 max-md:self-stretch no-hover:h-auto no-hover:w-11 no-hover:self-stretch`,children:[n?(0,X.jsx)(q,{tone:Nl(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,"data-slot":`unread-marker`,className:i?hh:void 0}):null,i?(0,X.jsx)(fh,{pinned:!!e.pinned,onToggle:t=>i(e,t),className:c(`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2`,ph)}):null,a&&!r&&Pa(e)?(0,X.jsx)(`button`,{type:`button`,"data-action":`archive-run`,"aria-label":`Archive ${t}`,title:`Archive task`,onClick:t=>{t.stopPropagation(),a(e)},className:c(`absolute top-[19.5px] left-1/2 inline-flex size-5 -translate-x-1/2 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none motion-reduce:transition-none`,mh),children:(0,X.jsx)(Rr,{className:`size-[12px] -translate-y-[2.5px]`,"aria-hidden":`true`})}):null]})}function _h({inertReferences:e,swipeable:t,swipe:n,title:r,onArchive:i,children:a}){return e?(0,X.jsxs)(`div`,{ref:n.surfaceRef,"data-slot":`task-row-swipe`,"data-swipe":t?`on`:void 0,"data-phase":t?n.phase:void 0,className:c(`relative rounded-[6px]`,t&&`touch-pan-y touch-pinch-zoom overflow-hidden`),children:[n.offset<0?(0,X.jsx)(vh,{width:-n.offset,past:n.past,title:r,onArchive:i}):null,a]}):a}function vh({width:e,past:t,title:n,onArchive:r}){return(0,X.jsx)(`div`,{"data-slot":`task-row-swipe-action`,"data-past":t?`true`:void 0,"aria-hidden":`true`,style:{width:e},className:c(`absolute inset-y-0 right-0 flex items-stretch justify-end overflow-hidden rounded-[6px]`,t?`bg-info text-signal-ink`:`bg-muted text-foreground`),children:t?(0,X.jsxs)(`span`,{className:`flex w-full items-center justify-center gap-2 text-[12px] font-semibold whitespace-nowrap`,children:[(0,X.jsx)(Rr,{className:`size-[16px] shrink-0`,"aria-hidden":`true`}),`Release to archive`]}):(0,X.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Archive ${n}`,onClick:e=>{e.stopPropagation(),r()},className:`flex w-[88px] shrink-0 flex-col items-center justify-center gap-1 text-[12px] font-semibold`,children:[(0,X.jsx)(Rr,{className:`size-[16px]`,"aria-hidden":`true`}),`Archive`]})})}var yh=`[&>[data-ellipsis-hidden]]:pointer-events-none`,bh=`data-ellipsis-hidden`,xh=new Map;function Sh(e){let t=getComputedStyle(e),n=`${t.fontStyle} ${t.fontWeight} ${t.fontSize} ${t.fontFamily} ${t.letterSpacing}`,r=xh.get(n);if(r!==void 0)return r;let i=document.createElement(`span`);i.textContent=`…`,i.setAttribute(`aria-hidden`,`true`),Object.assign(i.style,{position:`absolute`,visibility:`hidden`,whiteSpace:`pre`,fontStyle:t.fontStyle,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFamily:t.fontFamily,letterSpacing:t.letterSpacing}),document.body.appendChild(i);let a=i.getBoundingClientRect().width;i.remove();let o=a||parseFloat(t.fontSize)||12;return a&&(!document.fonts||document.fonts.status===`loaded`)&&xh.set(n,o),o}function Ch(e,t){if(e.scrollWidth<=e.clientWidth)return[];let n=e.getBoundingClientRect(),r=parseFloat(getComputedStyle(e).paddingRight)||0,i=n.left+e.clientLeft+e.clientWidth-r-t+.5;return Array.from(e.children).filter(e=>e.getBoundingClientRect().right>i)}function wh(e,t,n){Y.useLayoutEffect(()=>{let n=e.current;if(!t||!n||typeof ResizeObserver>`u`)return;let r=!0,i=()=>{if(!r)return;let e=new Set(Ch(n,Sh(n)));for(let t of Array.from(n.children))t.hasAttribute(bh)!==e.has(t)&&t.toggleAttribute(bh,e.has(t))},a=new ResizeObserver(i),o=new Set,s=()=>{for(let e of Array.from(n.children))o.has(e)||(o.add(e),a.observe(e))};a.observe(n),s(),i();let c=typeof MutationObserver>`u`?null:new MutationObserver(()=>{s(),i()});return c?.observe(n,{childList:!0}),document.fonts&&document.fonts.status!==`loaded`&&document.fonts.ready.then(i),()=>{r=!1,a.disconnect(),c?.disconnect();for(let e of Array.from(n.children))e.removeAttribute(bh)}},[e,t,n])}var Th=`(hover: none)`;function Eh(){let[e,t]=(0,Y.useState)(()=>typeof window.matchMedia==`function`&&window.matchMedia(Th).matches);return(0,Y.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(Th);t(e.matches);let n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var Dh=`(min-width: 48rem)`;function Oh(){let[e,t]=(0,Y.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 48rem)`).matches);return(0,Y.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(Dh),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var kh={"needs-permission":`label`,failed:`label`,"needs-you":`none`,"needs-review":`label`,running:`label`,"usage-limit":`resume`,"waiting-on-workers":`label`,"waiting-on-subagents":`label`,"waiting-for-ci":`label`,"waiting-for-merge":`label`,"waiting-for-command":`until`,monitoring:`next-check`,"waiting-for-capacity":`label`,queued:`queue-position`,done:`none`,cancelled:`none`,unseen:`label`};function Ah(e,t,n,r){let{label:i}=e;switch(kh[e.rung]){case`none`:return;case`queue-position`:return t===null?i:`queued #${t}`;case`resume`:{let e=yi(n.autoResumeAt,r),t=n.autoResumeReason===`provider-error`?`provider error`:i;return e===`scheduled`?t:`${t}, ${e}`}case`next-check`:{let e=D(n),t=e?.kind===`timer`?new Date(e.at):void 0;return t&&Number.isFinite(t.getTime())?`${i}, next check ${bi(t,new Date(r))}`:i}case`until`:{let e=D(n),t=e?.kind===`process`?new Date(e.deadline):void 0;return t&&Number.isFinite(t.getTime())?`${i}, until ${bi(t,new Date(r))}`:i}case`label`:return i}}function jh({run:e,attention:t,queuePosition:n,inWorkingGroup:r,scope:i,now:a}){let o=In(e,void 0,i??void 0),s=n===null?_i(e.finishedAt??e.createdAt,a):``,c=r&&t.rung===`running`?void 0:Ah(t,n,e,a);return{stateWord:c,references:o,age:s,key:`${s}|${c??``}|${o.map(e=>`${e.kind}-${e.number}-${e.url}`).join(`,`)}|${+!!e.notify}`}}function Mh(e){let t=K(e);return{title:t,displayTitle:Ha(t,Ln(e)?.number)?Ra(t).rest:t}}function Nh(e){let[t,n]=Y.useState(()=>Date.now());return Y.useEffect(()=>{if(u())return;let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var Ph=`cez-sidebar-collapsed`,Fh=`cez-sidebar-sections-collapsed`;function Ih(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))typeof r==`boolean`&&(t[n]=r);return t}function Lh(e=Ph){try{let t=localStorage.getItem(e);return t===null?{}:Ih(JSON.parse(t))}catch{return{}}}function Rh(e,t=Ph){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}var zh=`cez-sidebar-sections-changed`;function Bh(e){let[t,n]=(0,Y.useState)(()=>Lh(Fh)),[r,i]=(0,Y.useState)({}),a=(0,Y.useRef)(t);(0,Y.useEffect)(()=>{let e=e=>{if(e instanceof StorageEvent&&e.key!==null&&e.key!==`cez-sidebar-sections-collapsed`)return;let t=e instanceof CustomEvent?e.detail:Lh(Fh);a.current=t,n(t)};return window.addEventListener(`storage`,e),window.addEventListener(zh,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(zh,e)}},[]),(0,Y.useEffect)(()=>{if(e===null||Object.keys(r).length===0)return;let t={...a.current};for(let[n,i]of Object.entries(r))t[JSON.stringify([e,n])]=i;i({}),a.current=t,n(t),Rh(t,Fh),window.dispatchEvent(new CustomEvent(zh,{detail:t}))},[e,r]);let o=t=>JSON.stringify([e,t]);return{isCollapsed:e=>e!==`Archived`&&(r[e]??t[o(e)])===!0,toggle:t=>{if(e===null){i(e=>({...e,[t]:e[t]!==!0}));return}let r=o(t),s={...a.current,[r]:a.current[r]!==!0};a.current=s,n(s),Rh(s,Fh),window.dispatchEvent(new CustomEvent(zh,{detail:s}))}}}function Vh({runs:e,view:t,automations:n,onViewChange:r,currentRunId:i=null,now:a=Date.now(),onTogglePin:o,onArchiveRun:s,onSweep:c,sweeping:l=null,showViewControls:u=!0,rowLimit:d,sidebarLimits:f,projectId:p=null}){let m=Bs(),h=Wa(e,n),g=Ua(e,t,n),_=za(g,`active`),v=Ga(_,f??d??{overall:null}),y=c?Hh(g):void 0;return(0,X.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,X.jsxs)(`div`,{"data-slot":`quick-list-header`,className:`flex min-h-11 items-center gap-1.5 pr-[6px] pl-[10px] md:min-h-[26px]`,children:[(0,X.jsx)(`h2`,{className:`text-[13px] font-semibold text-foreground`,children:`Tasks`}),(0,X.jsx)(`span`,{className:`text-[11.5px] text-soft-foreground`,children:h[t]}),(0,X.jsxs)(G,{to:`/`,onClick:m,className:`ml-auto flex min-h-11 items-center gap-0.5 text-[12px] text-soft-foreground hover:text-foreground md:min-h-[26px]`,children:[`All`,(0,X.jsx)(Br,{className:`size-[13px]`,"aria-hidden":`true`})]})]}),u?(0,X.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,X.jsx)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[2px]`,children:(0,X.jsx)(ng,{view:t,automations:n,onSelect:r,counts:h})})}):null,_.length===0?(0,X.jsx)(`p`,{className:`px-3 py-3.5 text-xs text-soft-foreground`,children:t===`automations`?`No automation tasks.`:`No tasks yet — describe one.`}):(0,X.jsx)(Uh,{buckets:v,allBuckets:_,sectionProjectId:p,currentRunId:qa(i,e),now:a,onTogglePin:o,onArchiveRun:s,onSweep:c,sweeping:l,sweepCounts:y,view:t,automations:n})]})}function Hh(e){return{unpinned:Gn(e,`unpinned`),pinned:Gn(e,`pinned`)}}function Uh({buckets:e,currentRunId:t=null,now:n=Date.now(),scope:r=null,onTogglePin:i,onArchiveRun:a,onSweep:o,sweeping:s=null,sweepCounts:c,projectName:l,allBuckets:u=e,sectionProjectId:d=r,view:f=`active`,automations:p}){let m=Y.useId(),h=Bh(d),g=Y.useRef(null),_=Y.useRef(null);Y.useLayoutEffect(()=>{let e=_.current;if(!e||e.element.isConnected||(_.current=null,document.activeElement!==document.body))return;let t=u.find(t=>t.rows.some(t=>t.run.id===e.id));if(!t)return;let n=Array.from(g.current?.children??[]).find(e=>e.dataset.bucket===t.label);(Array.from(n?.querySelectorAll(`[data-slot="task-row"]`)??[]).find(t=>t.dataset.runId===e.id)?.querySelector(`a`)??n?.querySelector(`[data-slot="section-toggle"]`))?.focus({preventScroll:!0})});let v=(e,o=!1)=>(0,X.jsx)(Zh,{inWorkingGroup:o,run:e.run,queuePosition:e.queuePosition,currentRunId:t,now:n,scope:r,onTogglePin:i,onArchiveRun:a});return(0,X.jsx)(`div`,{ref:g,className:`flex flex-col gap-3`,onFocusCapture:e=>{let t=e.target.closest(`[data-slot="task-row"]`);_.current=t?.dataset.runId?{id:t.dataset.runId,element:e.target}:null},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||(_.current=null)},children:u.map(t=>{let n=t.label===`Archived`,i=h.isCollapsed(t.label),a=e.find(({label:e})=>e===t.label)?.rows??[],u=t.rows.length,d=!n&&!i&&a.length<u,g=`${m}-${t.label.replaceAll(` `,`-`)}`;return(0,X.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":t.label,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pr-[6px]`,children:[(0,X.jsx)(Gh,{id:g,bucket:t,collapsed:i,cut:d,onToggle:h.toggle}),d?(0,X.jsx)(Wh,{section:t.label,shown:a.length,total:u,scope:r,view:f,automations:p}):null,o&&c?(0,X.jsx)(eg,{label:t.label,headingId:g,projectName:l,counts:c,onSweep:o,sweeping:s}):null]}),(0,X.jsx)(`div`,{id:`${g}-rows`,hidden:i,children:!i&&a.map(e=>(0,X.jsx)(`div`,{children:v(e,t.label===`Working`)},e.run.id))})]},t.label)})})}function Wh({section:e,shown:t,total:n,scope:r,view:i,automations:a}){let o=Bs();return(0,X.jsxs)(G,{to:Ea(r,Xa(e,i,a)),onClick:o,"data-slot":`section-cut-link`,"aria-label":`${e}: showing ${t} of ${n}, see all`,title:`The sidebar shows ${t} of ${n} ${e} tasks. Click to see all of them. Change the limit in ${wi(`sidebar`)}.`,className:`mr-auto -ml-1 flex min-h-[44px] min-w-[44px] shrink-0 items-center rounded-[4px] px-1 text-[11px] font-normal text-soft-foreground tabular-nums underline decoration-dotted underline-offset-[3px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground md:min-h-[26px] md:min-w-0 no-hover:min-h-[44px] no-hover:min-w-[44px]`,children:[t,` of `,n]})}function Gh({id:e,bucket:t,collapsed:n,cut:r,onToggle:i}){let a=t.rows.length;if(t.label===`Archived`)return(0,X.jsx)(`h2`,{id:e,className:`min-w-0 flex-1 text-[11px] font-medium text-soft-foreground`,children:(0,X.jsxs)(`span`,{className:`px-[10px] pt-[2px] pb-[4px]`,children:[t.label,` `,a]})});let o=t.label,s=t.rows.map(e=>e.run),l=s.length?Ne(Va(s)):null,u=s.some(no),d=n?Br:Or;return(0,X.jsx)(`h2`,{id:e,className:c(`min-w-0 text-[11px] font-medium text-soft-foreground`,r?`shrink-0`:`flex-1`),children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`section-toggle`,"aria-expanded":!n,"aria-controls":`${e}-rows`,"aria-label":`${o} ${a}`,onClick:()=>i(o),className:c(`flex min-h-[44px] items-center gap-1.5 rounded-[4px] px-[10px] text-left hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground md:min-h-[26px] no-hover:min-h-[44px]`,r?`pr-[4px]`:`w-full`),children:[(0,X.jsx)(d,{className:`size-[12px] shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:o}),r?null:(0,X.jsxs)(X.Fragment,{children:[` `,(0,X.jsx)(`span`,{className:`font-normal tabular-nums`,children:a})]}),l&&(o===`Needs you`||n)?(0,X.jsx)(q,{tone:l.tone,shape:l.shape,pulse:l.pulse,role:`img`,"aria-label":l.label,title:l.label}):null,n&&u?(0,X.jsx)(`span`,{role:`img`,"aria-label":`unread`,title:`Unread tasks`,className:`size-[5px] shrink-0 rounded-full bg-foreground`}):null]})})}function Kh({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`view-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:c(`flex min-h-11 min-w-0 flex-1 items-center justify-center gap-1.5 rounded-[7px] text-[11px] font-medium text-muted-foreground md:min-h-[22px]`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,X.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function qh(){let e=Eh(),t=Oh();return e||!t}function Jh(e){let t=document.createRange();t.selectNodeContents(e);let n=t.getBoundingClientRect?.().width,r=e.querySelector(`[data-reference-width]`),i=r?Math.max(0,Number(r.dataset.referenceWidth)-r.getBoundingClientRect().width):0;return Math.ceil((n||e.scrollWidth)+i)}function Yh(e,t,n){let[r,i]=Y.useState(!1),[a,o]=Y.useState(0),s=Y.useRef(!1),c=Y.useRef(!1),l=Y.useRef(null),u=Y.useCallback(e=>{s.current=e,i(e)},[]);return Y.useLayoutEffect(()=>{let r=e.current;if(!t||!r||typeof ResizeObserver>`u`){l.current=null,u(!1);return}let i=!0,a=()=>{if(i){if(l.current?.key!==n){if(s.current){u(!1),o(e=>e+1);return}l.current={key:n,width:Jh(r)}}u(l.current.width>r.clientWidth)}};a();let d=new ResizeObserver(a);d.observe(r);let f=new WeakMap,p=new ResizeObserver(e=>{let t=!1;for(let n of e??[]){let e=n.borderBoxSize?.[0]?.inlineSize??n.contentRect.width,r=f.get(n.target);f.set(n.target,e),r!==void 0&&r!==e&&(t=!0)}!t||!i||(l.current=null,a())}),m=new Set,h=()=>{let e=!1;for(let t of[...r.children,...r.querySelectorAll(`[data-slot="reference-list"] [data-slot="pr-chip"], [data-slot="reference-list"] [data-slot="issue-chip"]`)]){let{slot:n}=t.dataset;n===`task-row-age`||t.getAttribute(`aria-hidden`)===`true`||m.has(t)||(m.add(t),f.set(t,t.getBoundingClientRect().width),p.observe(t),e=!0)}return e};h();let g=typeof MutationObserver>`u`?null:new MutationObserver(()=>{!h()||!i||(l.current=null,a())});return g?.observe(r,{childList:!0,subtree:!0}),document.fonts&&document.fonts.status!==`loaded`&&!c.current&&document.fonts.ready.then(()=>{c.current=!0,i&&(l.current=null,a())}),()=>{i=!1,d.disconnect(),p.disconnect(),g?.disconnect()}},[e,t,n,a,u]),t&&r}function Xh(){return(0,X.jsx)(`span`,{"aria-hidden":`true`,children:` · `})}function Zh({run:e,queuePosition:t,currentRunId:n,now:r,scope:i,inWorkingGroup:a=!1,onTogglePin:o,onArchiveRun:s}){let l=Da(),u=Bs(),d=qh(),f=!!s&&d&&Pa(e),p=Sm({id:e.id,enabled:f,onArchive:()=>s?.(e)}),m=Ea(i,`/tasks/${e.id}`),h=Ne(e),g=e.id===n,{title:_,displayTitle:v}=Mh(e),y=no(e),b=jh({run:e,attention:h,queuePosition:t,inWorkingGroup:a,scope:i,now:r}),[x,S]=Y.useState(null);return(0,X.jsx)(_h,{inertReferences:d,swipeable:f,swipe:p,title:_,onArchive:()=>void s?.(e),children:(0,X.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":g?`true`:void 0,onClick:e=>{e.currentTarget.contains(e.target)&&(e.target.closest(`a, button, input`)||(l(m),u?.()))},...f?p.bind:{},style:p.offset?{transform:`translateX(${p.offset}px)`}:void 0,className:c(`selection-row group/task-row flex cursor-pointer items-start gap-2.5 rounded-[6px] py-1.5 pr-2 pl-2.5 hover:bg-sidebar-row-hover`,f&&`select-none`,f&&p.phase!==`dragging`&&`motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-out`,g&&`bg-sidebar-row-selected hover:bg-sidebar-row-selected`),children:[(0,X.jsx)(`span`,{"data-slot":`task-row-dot`,className:`flex h-[19px] w-[12px] shrink-0 items-center justify-center`,children:(0,X.jsx)(q,{tone:h.tone,shape:h.shape,pulse:h.pulse,"aria-label":h.label,title:h.label,role:`img`})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(Qh,{run:e,to:m,title:_,displayTitle:v,isActive:g,unread:y,swipeable:f,onNavigate:u}),(0,X.jsx)($h,{run:e,meta:b,title:_,scope:i,isActive:g,inertReferences:d,overflowContainer:x})]}),b.references.length?(0,X.jsx)(`span`,{ref:S,"data-slot":`protected-reference-overflow`,className:c(`shrink-0 self-end`,d&&`-my-1.5 self-center`)}):null,e.delegation?.role===`worker`?(0,X.jsxs)(`span`,{className:`sr-only`,children:[`Worker · `,h.label]}):null,(0,X.jsx)(gh,{run:e,title:_,unread:y,inertReferences:d,onTogglePin:o,onArchiveRun:s})]})})}function Qh({run:e,to:t,title:n,displayTitle:r,isActive:i,unread:a,swipeable:o,onNavigate:s}){return(0,X.jsxs)(G,{to:t,onClick:s,title:n,"aria-current":i?`page`:void 0,draggable:!o&&void 0,className:`flex h-[19px] min-w-0 items-center gap-2 rounded-[2px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,children:[(0,X.jsx)(`span`,{"data-slot":`task-row-title`,className:c(`min-w-[7rem] flex-1 truncate text-[13px] leading-[1.45] font-medium text-muted-foreground`,a&&`font-semibold text-foreground`,i&&`text-foreground`),children:r}),e.diffStat?(0,X.jsx)(wm,{stat:e.diffStat,className:`hidden shrink-0 text-[12px] @min-[23rem]/sidebar:inline`}):null]})}function $h({run:e,meta:t,title:n,scope:r,isActive:i,inertReferences:a,overflowContainer:o}){let{stateWord:s,references:l,age:u,key:d}=t,f=Ei(),p=Y.useRef(null),m=Yh(p,!!u,d);wh(p,!a&&l.length>0,`${d}|${+!!m}`);let h=[];return s&&h.push((0,X.jsx)(`span`,{"data-slot":`task-row-state`,children:s},`state`)),l.length&&h.push((0,X.jsx)(dh,{references:l,maxVisible:2,taskTitle:n,projectId:r??f.projectId,repoBase:f.repoBase,runId:e.id,plain:!0,compact:!0,inertInline:a,fitContainer:!0,overflowContainer:o},`references`)),u&&!m&&h.push((0,X.jsx)(`span`,{"data-slot":`task-row-age`,className:`tabular-nums`,children:u},`age`)),(0,X.jsxs)(`div`,{ref:p,"data-slot":`task-row-meta`,className:c(`h-[16px] min-w-0 truncate text-[11.5px] leading-[1.4] font-normal text-soft-foreground`,yh,i&&`text-muted-foreground`),children:[e.notify===!0?(0,X.jsx)(`span`,{"data-slot":`task-row-notify`,role:`img`,"aria-label":`Notifying the task webhook`,title:`Notifying the task webhook`,className:`mr-[4px] inline-block shrink-0 align-[-1px]`,children:(0,X.jsx)(ks,{"aria-hidden":`true`,className:`size-[10px]`})}):null,h.length?h.flatMap((e,t)=>t?[(0,X.jsx)(Xh,{},`sep-${t}`),e]:[e]):e.notify===!0?null:`\xA0`]})}function eg({label:e,headingId:t,projectName:n,counts:r,onSweep:i,sweeping:a}){let o=e===`Finished`?`unpinned`:null;if(!o||r[o]===0)return null;let s=a===o,c=`Archive all`;return(0,X.jsxs)(`button`,{type:`button`,"data-action":`archive-group`,"data-scope":o,disabled:s,"aria-busy":s?`true`:void 0,"aria-label":n?`${c}, ${n}`:void 0,"aria-describedby":t,onClick:()=>i(o),className:`relative inline-flex shrink-0 items-center gap-1 rounded-[4px] px-1.5 py-0.5 font-sans text-[11px] leading-[1.4] text-muted-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground disabled:opacity-60 max-md:before:absolute max-md:before:top-1/2 max-md:before:left-0 max-md:before:h-11 max-md:before:w-full max-md:before:-translate-y-1/2 max-md:before:content-[''] no-hover:before:absolute no-hover:before:top-1/2 no-hover:before:left-0 no-hover:before:h-11 no-hover:before:w-full no-hover:before:-translate-y-1/2 no-hover:before:content-['']`,children:[(0,X.jsx)(Rr,{className:`size-[11px]`,"aria-hidden":`true`}),c]})}function tg({showViewControls:e=!0,projectId:t,boot:n=!1}){let r=Bs(),i=t??a(),o=sn(i,!0,n),s=pt(i,!0,n).data?.sidebarLimits??{},c=dn(Zt({projectId:i,boot:n})),l=pm(Zt({projectId:i,boot:n}),r),u=St(),[d,f,p]=rp(),m=ka(`/tasks/:id/*`),h=ka(`/tasks/:id`),g=Nh(3e4),_=It(),v=t??_,y=kt(v),b=Ga(za(Ua(o.data??[],d,p),`active`),s),x=v===void 0?[]:b.flatMap(e=>e.rows.flatMap(({run:e})=>In(e,y).filter(e=>Nn(e,y)).map(e=>({projectId:v,kind:e.kind,number:e.number}))));return o.data?(0,X.jsx)(Ci,{projectId:v,repoBase:y,requests:x,children:(0,X.jsx)(Vh,{showViewControls:e,sidebarLimits:s,projectId:v==="default"?u.data?.bootProject??null:v??null,runs:o.data,view:d,automations:p,onViewChange:f,currentRunId:m?.params.id??h?.params.id??null,now:g,onTogglePin:(e,t)=>c.mutate({id:e.id,pinned:t}),onArchiveRun:l.archiveOne,onSweep:e=>l.sweep(e,p?d===`automations`:void 0),sweeping:l.sweeping})}):null}function ng({view:e,automations:t,onSelect:n,counts:r}){let i=(0,X.jsx)(q,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`needs you`});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Kh,{view:`active`,current:e,onSelect:n,count:r.active,children:[`Active`,r.activeWaiting>0&&e!==`active`?i:null]}),t?(0,X.jsxs)(Kh,{view:`automations`,current:e,onSelect:n,count:r.automations,children:[`Automations`,r.automationsWaiting>0&&e!==`automations`?i:null]}):null]})}var rg=e=>e.available?`success`:`danger`,ig=e=>e.available?`Installed`:`Not installed`,ag=e=>e.available?null:e.hint??null,og=`inline-flex items-center rounded-sm text-xs font-medium text-foreground hover:underline focus-visible:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring max-md:min-h-11 no-hover:min-h-11`,sg=(e,t)=>fn(t).includes(e.name);function cg(e,t){let n=e.checks.filter(e=>sg(e,t));if(n.length&&!n.some(e=>e.available))return`no agent CLI found — install one to run tasks`;let r=n.find(t=>t.name===e.defaultRunner);return r&&!r.available?`default runner (${e.defaultRunner}) not found`:null}function lg(e,t){let n=`Squawk v${e.version}`;if(t===void 0)return n;let r=cg(e,t);if(r)return`${n} · ${r}`;let i=e.checks.filter(e=>!e.available).map(e=>e.name);return i.length?`${n} · optional: ${i.join(`, `)} not installed`:n}function ug(e){return e.forge?.available?null:e.forge?`GitHub is unreachable — ${e.forge.reason??`unknown reason`}. The GitHub tab is hidden until it comes back.`:`No GitHub remote detected — the GitHub tab is hidden. Every plain-git feature still works.`}function dg({health:e,runners:t,sessionScope:n}){if(!e)return null;let r=cg(e,t);return(0,X.jsxs)(Gi,{children:[(0,X.jsx)(Hi,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,"aria-label":`Tools`,title:lg(e,t),className:`relative flex items-center gap-1.5 rounded-[6px] px-2 py-1.5 text-[12px] font-normal text-soft-foreground transition-colors hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-[state=open]:bg-sidebar-row-selected data-[state=open]:text-foreground`,children:[(0,X.jsx)(yr,{className:`size-[15px]`,"aria-hidden":`true`}),r?(0,X.jsx)(q,{tone:`pending`,className:`absolute top-1 left-5 size-1.5`}):null,`Tools`]})}),(0,X.jsxs)(Ui,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[n?(0,X.jsx)(`div`,{className:`px-2 py-2`,children:n}):null,(0,X.jsx)(Ii,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,X.jsx)(fg,{check:e},e.name):(0,X.jsx)(pg,{check:e},e.name)),ug(e)?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Bi,{}),(0,X.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-[11px] leading-snug text-muted-foreground`,children:ug(e)})]}):null,(0,X.jsx)(Bi,{}),(0,X.jsx)(W,{asChild:!0,children:(0,X.jsx)(z,{to:`/tools`,children:`Tools diagnostics`})}),(0,X.jsx)(W,{asChild:!0,children:(0,X.jsxs)(z,{to:Oo,"data-slot":`tools-settings`,className:`gap-2 text-[13px] text-muted-foreground`,children:[(0,X.jsx)(lr,{className:`size-3.5`,"aria-hidden":`true`}),`Tool settings`]})})]})]})}function fg({check:e}){return(0,X.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":`true`,className:`flex items-center gap-2 rounded-sm px-2 py-1.5`,children:[(0,X.jsx)(q,{tone:rg(e)}),(0,X.jsx)(`span`,{className:`font-mono text-[13px] font-medium`,children:e.name}),(0,X.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11px] font-medium text-muted-foreground tabular-nums`,children:e.version??`not found`})]})}function pg({check:e}){let t=ag(e);return(0,X.jsx)(W,{asChild:!0,children:(0,X.jsxs)(z,{to:Do(e.name),"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(q,{tone:rg(e)}),(0,X.jsx)(`span`,{className:`font-mono text-[13px] font-medium`,children:e.name}),(0,X.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11px] font-medium text-muted-foreground`,children:`not found`})]}),(0,X.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[t?(0,X.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-[11px] leading-snug text-muted-foreground`,children:t}):null,(0,X.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-[11px] font-semibold text-accent-text`,children:`Set up →`})]})]})})}function mg(e){return e?.trim()||null}function hg({projectName:e,pageLabel:t}){let n=mg(e),r=mg(t);return n&&r?`${n} — ${r} · Squawk`:n?`${n} · Squawk`:r?`${r} · Squawk`:`Squawk`}function gg(e){let t=hg(e);(0,Y.useEffect)(()=>{document.title=t},[t])}function _g({...e}){return(0,X.jsx)(uc,{"data-slot":`alert-dialog`,...e})}function vg({...e}){return(0,X.jsx)(dc,{"data-slot":`alert-dialog-portal`,...e})}function yg({className:e,...t}){return(0,X.jsx)(fc,{"data-slot":`alert-dialog-overlay`,className:c(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none`,e),...t})}function bg({className:e,...t}){return(0,X.jsxs)(vg,{children:[(0,X.jsx)(yg,{}),(0,X.jsx)(pc,{"data-slot":`alert-dialog-content`,className:c(`fixed inset-bs-[50%] start-[50%] z-50 grid max-h-[calc(100dvh-2rem)] overflow-y-auto overscroll-contain w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-hidden motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95 motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none sm:max-w-md`,e),...t})]})}function xg({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:c(`flex flex-col gap-2 text-center sm:text-start`,e),...t})}function Sg({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:c(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function Cg({className:e,...t}){return(0,X.jsx)(gc,{"data-slot":`alert-dialog-title`,className:c(`text-lg leading-none font-semibold`,e),...t})}function wg({className:e,...t}){return(0,X.jsx)(_c,{"data-slot":`alert-dialog-description`,className:c(`text-sm text-muted-foreground`,e),...t})}function Tg({className:e,...t}){return(0,X.jsx)(mc,{"data-slot":`alert-dialog-action`,className:c(ki({variant:`contrast`}),e),...t})}function Eg({className:e,...t}){return(0,X.jsx)(hc,{"data-slot":`alert-dialog-cancel`,className:c(ki({variant:`outline`}),e),...t})}function Dg(e){let t=Aa(e);return/^\/git\/branches(?:\/|$)/.test(t)?`branches`:/^\/git\/not-landed(?:\/|$)/.test(t)?`not-landed`:/^\/git\/cleanup(?:\/|$)/.test(t)?`cleanup`:/^\/git\/changes(?:\/|$)/.test(t)?`changes`:/^\/git(?:\/commits(?:\/[^/]+)?)?\/?$/.test(t)?`main`:null}var Og={main:`/git`,"not-landed":`/git/not-landed`,cleanup:`/git/cleanup`,branches:`/git/branches`,changes:`/git/changes`},kg=`/git?view=repo`,Ag={second:`s`,minute:`m`,hour:`h`,day:`d`,week:`w`,month:`mo`,year:`y`};function jg(e){let t=/^(\d+) (second|minute|hour|day|week|month|year)s? ago$/.exec(e.trim());return t?`${t[1]}${Ag[t[2]]}`:e}function Mg(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}var Ng=new Intl.DateTimeFormat(`en-US`,{weekday:`short`,month:`short`,day:`numeric`}),Pg=new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,year:`numeric`});function Fg(e,t){let n=Date.parse(e);if(Number.isNaN(n))return`Earlier`;let r=Mg(t);if(n>=r)return`Today`;if(n>=Mg(r-1))return`Yesterday`;let i=new Date(n);return(i.getFullYear()===new Date(t).getFullYear()?Ng:Pg).format(i)}function Ig(e,t=Date.now()){let n=[];for(let r of e){let e=Fg(r.at,t),i=n.at(-1);i?.label===e?i.commits.push(r):n.push({label:e,commits:[r]})}return n}function Lg(e,t=Date.now()){return e.filter(e=>Fg(e.at,t)===`Today`).length}function Rg(e,t){return(e.baseBranch??t.branch)===t.branch?e.tracking:null}function zg(e,t=Date.now()){let n=e.fetchedAt?_i(e.fetchedAt,t):``;return n?`fetched ${n} ago`:`never fetched`}function Bg(e,t){let n=F(),r=[e,`repo`],i=[e,`health`],[a,o]=(0,Y.useState)(null),s=e=>V(e.message,{tone:`danger`}),c=()=>Promise.all([n.invalidateQueries({queryKey:r}),n.invalidateQueries({queryKey:i}),n.invalidateQueries({queryKey:L.projects})]),l=qt({mutationFn:t=>fe(t,e)}),u=async(e=!1)=>{let n=a?.branch??t.branch;try{let t=await l.mutateAsync(e?{branch:n,confirm:!0}:{branch:n});if(`risks`in t){o(t);return}o(null),V(t.summary),await c()}catch(e){o(null),V(e instanceof Error?e.message:String(e),{tone:`danger`}),await c()}},d=qt({mutationFn:t=>N({name:t},e),onSuccess:async e=>{V(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await c(),n.setQueryData(r,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),n.setQueryData(i,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:s}),f=qt({mutationFn:t=>k({baseBranch:t},e),onSuccess:t=>{V(t.baseBranch?`New tasks now start from ${t.baseBranch}`:`New tasks now start from the checked-out branch`),n.invalidateQueries({queryKey:r}),n.invalidateQueries({queryKey:[e,`config`]})},onError:s});return{hasRemote:!!t.remote,pull:u,pulling:l.isPending,confirmation:a,dismissConfirmation:()=>{l.isPending||o(null)},switchBranch:d,setBase:f}}var Vg={sidebar:{card:`gap-[8px] rounded-[8px] p-[10px]`,branchRow:`gap-[6px]`,branchIcon:`size-[14px]`,branch:`text-[12.5px]`,chevron:`size-[12px]`,pull:`h-[24px] gap-[4px] rounded-[6px] px-[8px] text-[11.5px] [&>svg]:size-[12px]`,line:`text-[11px]`,lineChevron:`size-[11px]`,dirty:`gap-[6px] pt-[6px] text-[11px] [&>svg]:size-[12px]`},screen:{card:`gap-[10px] rounded-[10px] p-[12px]`,branchRow:`gap-[8px]`,branchIcon:`size-[16px]`,branch:`text-[14px]`,chevron:`size-[14px]`,pull:`h-[36px] gap-[6px] rounded-[8px] px-[14px] text-[13px] [&>svg]:size-[14px]`,line:`text-[12px]`,lineChevron:`size-[12px]`,dirty:`h-[40px] gap-[8px] pt-[4px] text-[13px] [&>svg:first-child]:size-[14px] [&>svg:last-child]:size-[15px]`}};function Hg({scope:e,repo:t,info:n,variant:r,onNavigate:i}){let a=Vg[r],o=Bg(e,n),s=t.baseBranch??n.branch,l=t.status.length,u=Rg(t,n),d=o.switchBranch.isPending,f=(0,Y.useRef)(null);return(0,X.jsxs)(`section`,{"aria-label":`Checkout`,"data-slot":`git-checkout`,"data-variant":r,className:c(`flex flex-col border border-border`,a.card),children:[(0,X.jsxs)(`div`,{className:c(`flex min-w-0 items-center`,a.branchRow),children:[(0,X.jsxs)(Gi,{children:[(0,X.jsxs)(Hi,{"data-slot":`git-branch-menu`,"aria-label":`Branch ${n.branch}. Switch branch`,disabled:d,className:c(`group flex min-w-0 flex-1 items-center rounded-[4px] text-left outline-none focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,a.branchRow,r===`screen`&&`min-h-11`),children:[(0,X.jsx)(Zn,{"aria-hidden":`true`,className:c(`shrink-0 text-muted-foreground`,a.branchIcon)}),(0,X.jsx)(`span`,{"data-slot":`git-checkout-branch`,className:c(`min-w-0 flex-1 truncate font-mono font-semibold text-foreground`,a.branch),children:n.branch}),(0,X.jsx)(Or,{"aria-hidden":`true`,className:c(`shrink-0 text-soft-foreground group-hover:text-foreground`,a.chevron)})]}),(0,X.jsxs)(Ui,{align:`start`,className:`w-64`,children:[(0,X.jsx)(Ii,{className:`text-xs text-soft-foreground`,children:`Switch branch`}),(0,X.jsx)(Wi,{value:n.branch,onValueChange:e=>{e!==n.branch&&o.switchBranch.mutate(e)},children:t.branches.map(e=>(0,X.jsx)(Li,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,X.jsx)(`span`,{className:`truncate`,children:e})},e))}),(0,X.jsx)(Bi,{}),(0,X.jsx)(W,{asChild:!0,children:(0,X.jsx)(G,{to:Og.branches,"data-slot":`git-branch-menu-all`,onClick:i,children:`Create or find a branch…`})})]})]}),(0,X.jsxs)(`button`,{ref:f,type:`button`,"data-action":`repo-pull`,disabled:!o.hasRemote||o.pulling,title:o.hasRemote?`Pull ${n.branch}`:`No remote configured. Add a Git remote before pulling.`,onClick:()=>void o.pull(),className:c(`inline-flex shrink-0 items-center bg-muted font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100`,a.pull),children:[o.pulling?(0,X.jsx)(gi,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,X.jsx)(kr,{"aria-hidden":`true`}),`Pull`]})]}),u?(0,X.jsx)(Ug,{tracking:u,className:a.line}):null,(0,X.jsxs)(Gi,{children:[(0,X.jsxs)(Hi,{"data-slot":`base-branch-picker`,"aria-label":`New tasks start from ${s}. Change the base branch`,disabled:o.setBase.isPending,className:c(`group flex min-w-0 items-center gap-[4px] self-start rounded-[4px] text-soft-foreground outline-none hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,a.line,r===`screen`&&`min-h-[32px]`),children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:`New tasks start from`}),(0,X.jsx)(`span`,{"data-slot":`base-branch`,className:`min-w-0 truncate font-mono text-muted-foreground group-hover:text-foreground`,children:s}),(0,X.jsx)(Or,{"aria-hidden":`true`,className:c(`shrink-0`,a.lineChevron)})]}),(0,X.jsxs)(Ui,{align:`start`,className:`w-64`,children:[(0,X.jsx)(Ii,{className:`text-xs text-soft-foreground`,children:`New tasks start from`}),(0,X.jsxs)(Wi,{value:t.baseBranch??``,onValueChange:e=>o.setBase.mutate(e===``?null:e),children:[(0,X.jsx)(Li,{value:``,"data-branch":``,className:`text-[12.5px]`,children:`The checked-out branch (default)`}),t.branches.map(e=>(0,X.jsx)(Li,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,X.jsx)(`span`,{className:`truncate`,children:e})},e))]})]})]}),l>0?(0,X.jsxs)(G,{to:Og.changes,"data-slot":`git-uncommitted`,onClick:i,className:c(`flex min-w-0 items-center border-t border-border text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,a.dirty),children:[(0,X.jsx)(Mr,{"aria-hidden":`true`,className:`shrink-0 text-inbox-count-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[l,` uncommitted file`,l===1?``:`s`]}),(0,X.jsx)(Br,{"aria-hidden":`true`,className:`shrink-0 text-soft-foreground`})]}):null,(0,X.jsx)(Wg,{checkout:o,returnFocus:f})]})}function Ug({tracking:e,className:t}){let n=e.ref.split(`/`)[0]||e.ref,r=zg(e);return(0,X.jsx)(`p`,{"data-slot":`git-freshness`,className:c(`flex min-w-0 items-center gap-[4px] text-soft-foreground`,t),children:e.behind>0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{"data-slot":`git-behind`,className:`shrink-0 font-medium text-inbox-count-foreground`,children:[e.behind,` behind `,n]}),(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,r]})]}):(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`up to date · `,r]})})}function Wg({checkout:e,returnFocus:t}){return(0,X.jsx)(_g,{open:e.confirmation!==null,onOpenChange:t=>!t&&e.dismissConfirmation(),children:(0,X.jsxs)(bg,{onCloseAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,X.jsxs)(xg,{children:[(0,X.jsxs)(Cg,{children:[`Pull `,e.confirmation?.branch,` anyway?`]}),(0,X.jsx)(wg,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[e.confirmation?.risks.includes(`active_runs`)?(0,X.jsx)(`p`,{children:`An active session is using this repository. Pulling can change files while it works.`}):null,e.confirmation?.risks.includes(`dirty_tree`)?(0,X.jsx)(`p`,{children:`The checkout has dirty files. Git may refuse the pull to protect them.`}):null]})})]}),(0,X.jsxs)(Sg,{children:[(0,X.jsx)(Eg,{className:`h-11`,disabled:e.pulling,children:`Cancel`}),(0,X.jsx)(Tg,{className:`h-11`,disabled:e.pulling||e.confirmation===null,onClick:t=>{t.preventDefault(),e.pull(!0)},children:e.pulling?`Pulling…`:`Pull anyway`})]})]})})}var Gg={main:Er,"not-landed":bs,cleanup:is,branches:Zn};function Kg(e,t){switch(e){case`main`:return t?`Recently on ${t}`:`Recent commits`;case`not-landed`:return`Not landed`;case`cleanup`:return`Cleanup`;case`branches`:return`All branches`;case`changes`:return`Uncommitted changes`}}var qg=[`main`,`not-landed`,`cleanup`,`branches`];function Jg({branch:e,counts:t,variant:n,active:r,onNavigate:i}){let a=n===`screen`;return(0,X.jsx)(`nav`,{"aria-label":`Git sections`,"data-slot":`git-sections`,className:a?Qr:Zr,children:qg.map(n=>{let o=Gg[n],s=!a&&r===n,l=t[n];return(0,X.jsxs)(G,{to:a&&n===`main`?kg:Og[n],"data-git-section":n,"aria-current":s?`page`:void 0,onClick:i,className:c(a?$r:c(ri,`text-[12.5px]`),ni,s&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:[(0,X.jsx)(o,{"aria-hidden":`true`,className:a?li:ai}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:Kg(n,e)}),l?(0,X.jsx)(`span`,{"data-slot":`git-section-count`,className:a?ii:ei,children:l}):null,a?(0,X.jsx)(Br,{"aria-hidden":`true`,className:ci}):null]},n)})})}async function Yg(e,t){return ke(await Te.api.v1.p[`:projectId`].repo.branches.counts.$get({param:{projectId:t??a()}},Pe(e)),`/repo/branches/counts`)}function Xg(e){return pn({queryKey:[e,`repo`,`branches`,`counts`],queryFn:({signal:t})=>Yg({signal:t},e)})}function Zg(e,t,n){let r=yt(e),i=Xg(e),a=r.data?.totalBytes??null,o=i.data?.counts??null,s=t&&n===`screen`?Lg(t.log):0;return{main:s>0?`${s} today`:null,"not-landed":o?.notLanded?String(o.notLanded):null,cleanup:a?Rn(a):r.data&&a===null&&o?.cleanup?String(o.cleanup):null,branches:t?String(i.data?.allBranches??t.branches.length):null}}function Qg({scope:e}){let t=ht(e),{pathname:n}=gn(),r=Bs(),i=t.data?.info?t.data:null,a=Zg(e,i,`sidebar`);return(0,X.jsxs)(`div`,{"data-slot":`git-sidebar`,role:`region`,"aria-label":`Git`,className:ui,children:[i?.info?(0,X.jsx)(Hg,{scope:e,repo:i,info:i.info,variant:`sidebar`,onNavigate:r},e):t.isPending?(0,X.jsx)(`div`,{"data-slot":`git-checkout-placeholder`,"aria-hidden":`true`,className:`h-[94px] rounded-[8px] border border-border`}):null,t.isPending?null:(0,X.jsx)(Jg,{branch:i?.info?.branch??null,counts:a,variant:`sidebar`,active:Dg(n),onNavigate:r})]})}var $g=[`assigned`,`no-task`,`has-task`,`all`],e_=[`review`,`mine`,`failing`,`all`],t_=50,n_=`is:open review-requested:@me`,r_=`is:open status:failure`;function i_(e,t){return e===`prs`&&(t===`review`||t===`failing`)}function a_(e){return e===`review`?n_:e===`failing`?r_:null}function o_(e,t){return t===null?null:(e===`issues`?$g:e_).includes(t)?t:`all`}function s_(e,t,n,r=``){let i=`${n===void 0?e===`issues`?`/github`:`/github/prs`:`${e===`issues`?`/github/issues`:`/github/prs`}/${n}`}${r}`;return t===null?i:`${i}?filter=${encodeURIComponent(t)}`}function c_(e,t){let n=t??`all`;return n===`all`?e===`issues`?`all`:`all-prs`:n}function l_(e){return e===`all`?{view:`issues`,filter:`all`}:e===`all-prs`?{view:`prs`,filter:`all`}:{view:e===`review`||e===`mine`||e===`failing`?`prs`:`issues`,filter:e}}var u_=[{id:`assigned`,label:`Assigned to me`},{id:`no-task`,label:`No task yet`},{id:`has-task`,label:`Has a task`},{id:`all`,label:`All open`}],d_=[{id:`review`,label:`Review requested`},{id:`mine`,label:`Mine`},{id:`failing`,label:`Checks failing`},{id:`all-prs`,label:`All open`}],f_=Object.fromEntries([...u_,...d_].map(e=>[e.id,e.label]));function p_(e){return e===null?``:`${e.value}${e.bound===`atLeast`?`+`:``}`}function m_(e,t){if(t?.bound===`atLeast`)return e===`review`||e===`failing`?`At least ${t.value}: GitHub search returns at most ${t_} results.`:`At least ${t.value}: only the loaded pages are counted. Scroll to load more.`}var h_=(e,t)=>e!==void 0&&t!==void 0&&e.toLowerCase()===t.toLowerCase();function g_(e){try{let t=new URL(e).pathname.split(`/`).filter(Boolean);return t.length>=2?`${t[0]}/${t[1]}`.toLowerCase():null}catch{return null}}function __(e,t,n){return new Set(e.filter(e=>!e.archived).flatMap(e=>v_(e,t,n)))}function v_(e,t,n){let r=t?.toLowerCase();return In(e,void 0,n).filter(e=>e.kind===`Issue`&&(!e.url||r!==void 0&&g_(e.url)===r)).map(e=>e.number)}function y_(e,t,n,r){let i=new Map;for(let a of e)!Ya(a)&&v_(a,n,r).includes(t)&&i.set(a.id,a);return[...i.values()].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt)||e.id.localeCompare(t.id))}function b_(e,t){let n=new Map(t.map(e=>[e.number,e]));return e.map(e=>n.get(e.number)??e)}function x_(e){return e?.available?{value:e.items.length,bound:e.truncated?`atLeast`:`exact`}:null}function S_({gh:e,tasks:t,review:n,failing:r}){let i={assigned:null,"no-task":null,"has-task":null,all:null,review:x_(n),mine:null,failing:x_(r),"all-prs":null};if(!e?.available)return i;let a=!Pt(e,`issues`),o=!Pt(e,`prs`),s=(e,t)=>({value:e,bound:t?`atLeast`:`exact`}),c=t?e.issues.filter(e=>t.has(e.number)).length:null;return{...i,all:s(e.issuesTotal??e.issues.length,!1),"all-prs":s(e.prsTotal??e.prs.length,!1),assigned:e.viewerLogin?s(e.issues.filter(t=>t.assignees?.some(t=>h_(t,e.viewerLogin))).length,a):null,mine:e.viewerLogin?s(e.prs.filter(t=>h_(t.author,e.viewerLogin)).length,o):null,"has-task":c===null?null:s(c,a),"no-task":c===null?null:s(e.issues.length-c,a)}}var C_={assigned:vr,"no-task":di,"has-task":Lr,all:Nr,review:hi,mine:nr,failing:Sr,"all-prs":Nr};function w_(e,t){return e===`assigned`||e===`mine`?t.identity:e===`no-task`||e===`has-task`?t.tasks:null}function T_({model:e,variant:t,activeId:n,onNavigate:r}){let i=t===`screen`;return(0,X.jsx)(X.Fragment,{children:[{key:`issues`,label:`Issues`,rows:u_},{key:`prs`,label:`Pull requests`,rows:d_}].map(t=>(0,X.jsxs)(`nav`,{"aria-label":t.label,"data-slot":`github-filter-group`,"data-group":t.key,className:i?Qr:c(ti,t.key===`prs`&&`pt-[6px]`),children:[(0,X.jsx)(`h3`,{className:i?oi:si,children:t.label}),t.rows.map(({id:t,label:a})=>{let o=C_[t],s=n===t,l=w_(t,e.blocked),u=e.counts[t],d=p_(u),f=c(i?$r:c(ri,`text-[12.5px]`),l?`cursor-not-allowed opacity-60`:ni,s&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),p=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{"aria-hidden":`true`,className:i?li:ai}),(0,X.jsx)(`span`,{className:`truncate`,children:a}),d?(0,X.jsx)(`span`,{"data-slot":`gh-filter-count`,title:m_(t,u),className:i?ii:ei,children:d}):null,i?(0,X.jsx)(Br,{"aria-hidden":`true`,className:c(ci,!d&&`ml-auto`)}):null]});if(l)return(0,X.jsxs)(`div`,{"data-gh-filter":t,"aria-disabled":`true`,title:l,className:f,children:[p,(0,X.jsx)(`span`,{className:`sr-only`,children:l})]},t);let{view:m,filter:h}=l_(t);return(0,X.jsx)(G,{to:s_(m,h),"data-gh-filter":t,"aria-current":s?`page`:void 0,onClick:r,className:f,children:p},t)})]},t.key))})}function E_(e){let t=lt(e,50).data,n=t?.available===!0,r=sn(e,!0,e==="default"),i=jt(e,`pr`,n_,n),a=jt(e,`pr`,r_,n),o=(0,Y.useMemo)(()=>r.data?__(r.data,t?.repo,e):null,[r.data,t?.repo,e]);return{gh:t,counts:(0,Y.useMemo)(()=>S_({gh:t,tasks:o,review:i.data,failing:a.data}),[t,o,i.data,a.data]),blocked:{identity:t?.available===!0&&!t.viewerLogin?`GitHub login unavailable.`:null,tasks:r.isError&&!r.data?`Task list unavailable.`:null}}}function D_(e){return/^\/github\/prs(?:\/|$)/.test(Aa(e))?`prs`:`issues`}function O_({scope:e}){let t=E_(e),{pathname:n}=gn(),[r]=_n(),i=Bs(),a=D_(n);return(0,X.jsx)(`div`,{"data-slot":`github-sidebar`,role:`region`,"aria-label":`GitHub`,className:ui,children:(0,X.jsx)(T_,{model:t,variant:`sidebar`,activeId:c_(a,o_(a,r.get(`filter`))),onNavigate:i})})}var k_=(0,Y.lazy)(()=>R(()=>import(`./accounts-section-CZzEOP8R.js`).then(e=>({default:e.GlobalAgentsSection})),__vite__mapDeps([5,1,2,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]))),A_=(0,Y.lazy)(()=>R(()=>import(`./agent-config-section-BumcXk5K.js`).then(e=>({default:e.AgentConfigSection})),__vite__mapDeps([35,1,2,7,8,6,9,10,11,12,13,14,15,23,24,25,33,36,17,37,38]))),j_=(0,Y.lazy)(()=>R(()=>import(`./agent-defaults-section-VUhgYmuN.js`).then(e=>({default:e.AgentDefaultsSection})),__vite__mapDeps([39,1,2,6,7,8,9,10,11,12,13,14,15,18,23,24,40,28,41,30,31,19,33,42,34,26,27,29]))),M_=(0,Y.lazy)(()=>R(()=>import(`./appearance-CpDAS_Ul.js`).then(e=>({default:e.AppearanceSection})),__vite__mapDeps([43,2,1,7,8,10,11,6,9,12,13,14,15,19,44,23,24]))),N_=(0,Y.lazy)(()=>R(()=>import(`./notifications-section-CjgS2_uZ.js`).then(e=>({default:e.NotificationsSection})),__vite__mapDeps([45,1,2,6,7,8,9,10,11,12,13,14,15,40,24,28,41]))),P_=(0,Y.lazy)(()=>R(()=>import(`./projects-section-B94Rc_Ig.js`).then(e=>e.r).then(e=>({default:e.ProjectsSection})),__vite__mapDeps([46,1,2,7,8,6,9,10,11,12,13,14,15,16,17,18,23,24,47,28,29,48,41,33,49]))),F_=(0,Y.lazy)(()=>R(()=>import(`./prompt-templates-section-Bm4SvXEV.js`).then(e=>({default:e.PromptTemplatesSection})),__vite__mapDeps([50,1,2,7,8,6,9,10,11,12,13,14,15,18,23,24,47,28,29,48,41,51,27,26,52,33,42]))),I_=(0,Y.lazy)(()=>R(()=>import(`./resources-section-DVi14Dy4.js`).then(e=>({default:e.ResourcesSection})),__vite__mapDeps([53,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,23,24,40,28,41,33,49]))),L_=(0,Y.lazy)(()=>R(()=>import(`./sidebar-section-BR6GFKTd.js`).then(e=>({default:e.SidebarSection})),__vite__mapDeps([54,1,2,7,8,6,9,10,11,12,13,14,15,23,24]))),R_=(0,Y.lazy)(()=>R(()=>import(`./worktrees-section-DdChlr21.js`).then(e=>({default:e.WorktreesSection})),__vite__mapDeps([55,1,2,6,7,8,9,10,11,12,13,14,15,18,23,24,56,16,17,33,38,49,57,58,19,31,59,22,60,61,62,28,29,48,41,37]))),z_=(0,Y.lazy)(()=>R(()=>import(`./archive-on-merge-field-DlkEGuaI.js`).then(e=>({default:e.TasksSection})),__vite__mapDeps([63,1,2,6,7,8,9,10,11,12,13,14,15]))),B_=[{id:`sidebar`,title:`Sidebar`,description:`Overall and per-section task limits for this project.`,icon:Dr,component:L_,scope:`project`},{id:`agent-defaults`,title:`Agent defaults`,description:`Default runner, models and system prompt.`,icon:Lr,component:j_,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:gs,component:A_,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:vs,component:R_,scope:`project`},{id:`prompt-templates`,title:`Prompt templates`,description:`Reusable snippets for follow-up instructions.`,icon:_s,component:F_,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, accent and density.`,icon:rr,component:M_,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:jr,component:N_,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:Dr,component:I_,scope:`global`},{id:`tasks`,title:`Tasks`,description:`Automatic task archiving after pull requests merge.`,icon:vs,component:z_,scope:`global`},{id:`agents`,title:`Agents`,description:`Install, version and sign-in for each agent, and the agent and models a project uses when it has chosen none.`,icon:ur,component:k_,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:cr,component:P_,scope:`global`}];function V_(e){return B_.filter(t=>t.scope===e)}function H_(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}var U_=H_(`global`,`appearance`);function W_({projectId:e,projectName:t}){return(0,X.jsx)(`div`,{"data-slot":`settings-sidebar`,className:ui,children:[`project`,`global`].map(n=>{let r=n===`project`?`This project${t?` · ${t}`:``}`:`Global · every project`,i=n===`project`?`/p/${encodeURIComponent(e)}/settings`:`/settings/global`,a=V_(n).map(e=>({id:e.id,title:e.title,icon:e.icon,to:`${i}/${e.id}`})),o=n===`project`?[{id:`general`,title:`General`,icon:lr,to:i},...a]:a;return(0,X.jsxs)(`nav`,{"aria-label":r,"data-slot":`settings-nav`,"data-scope":n,className:c(`flex flex-col gap-px`,n===`global`&&`pt-[6px]`),children:[(0,X.jsx)(`h3`,{title:r,className:si,children:r}),o.map(({id:e,title:t,icon:n,to:r})=>(0,X.jsxs)(Cn,{to:r,end:!0,"data-section":e,className:({isActive:e})=>c(ri,ni,e&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:[(0,X.jsx)(n,{"aria-hidden":`true`,className:ai}),(0,X.jsx)(`span`,{className:`truncate`,children:t})]},e))]},n)})})}var G_=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/tasks`,pageLabel:`All tasks`},{pattern:`/tools`,pageLabel:`Workspace tools`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/activity`,pageLabel:`Activity`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/automations/*`,pageLabel:`Automations`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/reports`,pageLabel:`Reports`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function K_(e){let t=Aa(e),n=bn({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:G_.find(({pattern:e})=>bn({path:e,end:!0},t))?.pageLabel??null,taskId:null}}function q_(e){let t=e?.repo;if(!t)return null;let n=t.root.replace(/[\\/]+$/,``).split(/[\\/]/).pop();return n?{name:n,branch:t.branch}:null}var J_=e=>Qa(e).waiting>0;function Y_(e,t,n){let r=t?.bootProject??n?.bootProject??null,i=e??r??`default`;return{bootProjectId:r,sidebarProjectId:i,sidebarBoot:i===r,isBootProject:e!==null&&e===r,activeProject:t?.projects.find(t=>t.id===e)}}function X_(e,t,n,r,i,a){let o=e===`/tools`||e===`/settings/global`||e.startsWith(`/settings/global/`);return{globalSettings:o,projectName:o?null:t?.name??(n?q_(r)?.name??null:null),titleRun:a,pageLabel:a?K(a):i.pageLabel}}function Z_(e,t){return e?e.forge===`github`:t?.forge?.available===!0}function Q_(e,t,n,r,i,a){return/^\/settings(?:\/|$)/.test(e)?(0,X.jsx)(W_,{projectId:n,projectName:i?.projects.find(e=>e.id===n)?.name??(r?q_(a)?.name??null:null)}):/^\/github(?:\/|$)/.test(e)&&t?(0,X.jsx)(O_,{scope:Zt({projectId:n,boot:r}).cacheScope}):/^\/git(?:\/|$)/.test(e)?(0,X.jsx)(Qg,{scope:Zt({projectId:n,boot:r}).cacheScope}):void 0}function $_(e,t,n,r,i){return e===`/tools`?q_(i):t?null:n?{name:n.name,branch:n.id===r?i?.repo?.branch??``:``}:q_(i)}function ev(e,t,n,r){return{project:e===`/tools`?`Workspace`:t,page:n?`Tasks / ${r}`:r??`Squawk`,branch:n?.worktreePath?`Isolated worktree`:void 0}}function tv(e,t,n,r){return e?(0,X.jsx)(nm,{...e,projectTarget:t.target,onSwitchProject:e=>void t.go(e),version:r}):n?(0,X.jsx)(Xp,{}):null}function nv({children:e}){let{pathname:t}=gn(),n=Ma(),r=St(),i=At(),a=(0,Y.useRef)(void 0);(0,Y.useEffect)(()=>{r.data&&(a.current=r.data)},[r.data]);let o=r.data??a.current,s=Df(o),c=tn(),l=c.data,u=rm(),d=Ef(),f=K_(t),{bootProjectId:p,sidebarProjectId:m,sidebarBoot:h,isBootProject:g,activeProject:_}=Y_(n,l,r.data),v=sn(m,!0,h,J_).data??!1,y=(0,Y.useCallback)(e=>{let t=e.find(e=>e.id===f.taskId);return t?{title:t.title,titleSummary:t.titleSummary,titleOrigin:t.titleOrigin,worktreePath:t.worktreePath}:void 0},[f.taskId]),b=sn(n??``,_!==void 0&&f.taskId!==null,l?.bootProject===n,y).data,{globalSettings:x,projectName:S,titleRun:C,pageLabel:w}=X_(t,_,g,r.data,f,b);gg({projectName:S,pageLabel:w});let T=Z_(_,r.data),E=Q_(Aa(t),T,m,h,l,r.data),D=o?.version??null;return(0,X.jsxs)(np,{children:[(0,X.jsx)(Cd,{repo:$_(t,x,_,p,r.data),breadcrumb:ev(t,S,C,w),version:D,latestVersion:o?.latestVersion??null,forgeAvailable:T,automationsAvailable:s,banner:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Fp,{}),(0,X.jsx)(vp,{}),(0,X.jsx)(mp,{})]}),sidebarList:E,taskQuickList:(0,X.jsx)(tg,{projectId:m,boot:h}),sidebarProjectId:m,projectHeader:(0,X.jsx)(Wl,{}),mobileProjects:u,needsYou:v,toolsMenu:(0,X.jsx)(dg,{health:r.data,runners:i.data}),toolsStatus:r.data?{blocked:cg(r.data,i.data)!==null,note:ug(r.data)}:null,projectRail:tv(u,d,c.isPending,D),children:e}),(0,X.jsx)(Kf,{})]})}var rv=`cez-accent`,iv=`cez-density`,av=`cez-width`,ov=`cezarion`,sv=`comfortable`,cv=`narrow`;function lv(e){return ov}function uv(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:sv}function dv(e){return e===`narrow`||e===`wide`?e:cv}function fv(e){let t=e&&typeof e==`object`?e:{};return{accent:lv(t.accent),density:uv(t.density),width:dv(t.width)}}function pv(){try{return{accent:lv(localStorage.getItem(rv)),density:uv(localStorage.getItem(iv)),width:dv(localStorage.getItem(av))}}catch{return{accent:ov,density:sv,width:cv}}}function mv(e){try{localStorage.setItem(rv,e.accent),localStorage.setItem(iv,e.density),localStorage.setItem(av,e.width)}catch{}}function hv(e,t){t.accent===`cezarion`?delete e.dataset.accent:e.dataset.accent=t.accent,t.density===`comfortable`?delete e.dataset.density:e.dataset.density=t.density,t.width===`narrow`?delete e.dataset.width:e.dataset.width=t.width}var gv=Y.createContext(null);function _v({children:e}){let t=F(),n=Jt(),[r,i]=Y.useState(pv),a=n.data;Y.useEffect(()=>{if(a===void 0)return;let e=fv(a.appearance);i(e),mv(e)},[a]),Y.useLayoutEffect(()=>{hv(document.documentElement,r)},[r]);let o=Y.useCallback(e=>{i(e),mv(e),_e({appearance:e}).then(e=>t.setQueryData(L.uiState,e)).catch(e=>{V(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:L.uiState})})},[t]),s=Y.useCallback(e=>o({...r,accent:e}),[o,r]),c=Y.useCallback(e=>o({...r,density:e}),[o,r]),l=Y.useCallback(e=>o({...r,width:e}),[o,r]),u=Y.useMemo(()=>({accent:r.accent,density:r.density,width:r.width,setAccent:s,setDensity:c,setWidth:l}),[r,s,c,l]);return(0,X.jsx)(gv.Provider,{value:u,children:e})}function vv(){let e=Y.useContext(gv);if(!e)throw Error(`Squawk: useAppearance() must be called inside <AppearanceProvider>`);return e}function yv(){let e=gn(),t=tn();return Tf(),(0,Y.useEffect)(()=>{let n=Xd(e,t.data);n!==null&&(Qd(Vd(),n)||Hd(n),Qd(tf(n.projectId),n)||nf(n))},[e.hash,e.pathname,e.search,t.data]),null}function bv(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function xv(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function Sv(e,t){let n=new Map,r=[];for(let i of t??[]){let t={status:i.status,wantsAttention:Na(i)};n.set(i.id,t);let a=e.get(i.id);a!==void 0&&(a.status===t.status&&a.wantsAttention===t.wantsAttention||t.wantsAttention&&r.push(i))}return{entering:r,statuses:n}}function Cv(e){return e.enabled&&e.hidden&&e.permission===`granted`}function wv(e){let t=Ne(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`}}function Tv(){let e=F(),t=bv(Jt().data?.notifications).enabled,n=(0,Y.useRef)(t);return n.current=t,(0,Y.useEffect)(()=>{let t=e.getQueryCache(),r=new Map,i=new Map,a=new Map,o=new Set,s=new Map,c=0,l=e=>e.length===3&&typeof e[0]==`string`&&e[1]===`runs`&&e[2]===`list`,u=()=>{let e=new Set([...r.values()].flatMap(e=>[...e.keys()]));for(let t of i.keys())e.has(t)||(i.delete(t),a.delete(t),o.delete(t))},d=(e,t,s=!1,l=1/0)=>{let d=r.get(e),{statuses:f}=Sv(new Map,t),p=t.filter(e=>{if((a.get(e.id)??0)>l)return!1;let t=d?.get(e.id),n=f.get(e.id),r=l===1/0?t:i.get(e.id);return t!==void 0&&r!==void 0&&(r.status!==n.status||r.wantsAttention!==n.wantsAttention)}),{entering:m,statuses:h}=Sv(i,p);for(let[e,t]of f)!d?.has(e)&&!o.has(e)&&(a.get(e)??0)<=l&&(i.set(e,t),a.set(e,++c));for(let[e,t]of h){let n=i.get(e);n?.status===t.status&&n.wantsAttention===t.wantsAttention||(i.set(e,t),a.set(e,++c),o.add(e))}if(r.set(e,f),u(),!s&&m.length!==0&&Cv({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:xv()}))for(let e of m)Ev(e)};for(let e of t.getAll().sort((e,t)=>e.state.dataUpdatedAt-t.state.dataUpdatedAt))l(e.queryKey)&&Array.isArray(e.state.data)&&d(e.queryHash,e.state.data,!0);return t.subscribe(e=>{if(l(e.query.queryKey)){if(e.type===`removed`)r.delete(e.query.queryHash),s.delete(e.query.queryHash),u();else if(e.type===`updated`&&(e.action.type===`fetch`&&s.set(e.query.queryHash,c),e.action.type===`success`&&Array.isArray(e.query.state.data))){let t=e.action.manual?1/0:s.get(e.query.queryHash)??0;d(e.query.queryHash,e.query.state.data,!1,t),e.action.manual||s.delete(e.query.queryHash)}}})},[e]),null}function Ev(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=wv(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}function Dv(){return(0,X.jsxs)(`div`,{"data-route":`activity`,"aria-busy":`true`,className:`min-h-full w-full px-[18px] py-6 md:px-7`,children:[(0,X.jsx)(`h1`,{className:`text-[18px] font-semibold`,children:`Activity`}),(0,X.jsx)(`p`,{"data-slot":`activity-loading`,role:`status`,className:`mt-4 text-xs text-muted-foreground`,children:`Loading activity…`})]})}function Ov(){return(0,X.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(ko,{icon:(0,X.jsx)(gi,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}function kv({skill:e,emphasized:t}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:c(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,X.jsx)(`span`,{title:e.description,className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,e.path?(0,X.jsx)(`span`,{title:e.path,className:`min-w-0 truncate text-xs text-soft-foreground`,children:e.path}):null]})}var Av=80,jv=2e3,Mv=50,Nv=200,Pv=50,Fv=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`}];function Iv(e){return!!e&&typeof e==`object`}function Lv(e){if(e===void 0||!Array.isArray(e))return Fv.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!Iv(r))continue;let e=typeof r.id==`string`?r.id.trim():``;if(e===`create-automation`)continue;let i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=Rv(r.skills);if(n.push({id:e,label:i.slice(0,Av),text:a.slice(0,jv),...o.length>0?{skills:o}:{}}),n.length>=Mv)break}return n}function Rv(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,Nv)),t.size>=Pv))break}return[...t]}function zv(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function Bv(e,t){return zv(e,t).map(e=>e.text).join(`
5
+ `)),i=Ft(e);for(let e of n)r.has(e)||i.dropProject(e);let a=[...r].filter(e=>!n.has(e));for(let e of a)i.restoreProject(e);a.length>0&&i.reconcile({hold:!0})},[e,c]),Y.useMemo(()=>o?{projects:o,signals:s,canReorder:a,onReorder:i}:null,[o,s,a,i])}var im=60;function am(e){return`title`in e?`Archived "${e.title.length>im?`${e.title.slice(0,im-1)}…`:e.title}"`:`Archived ${e.count} ${e.count===1?`task`:`tasks`}`}async function om(e,t,n){let r=new Set(n),i=(await Promise.allSettled(t.map(async t=>{await Re(rn(t,{projectId:e}),!1),r.has(t)&&await pe(rn(t,{projectId:e}),!0)}))).find(e=>e.status===`rejected`);i&&V(i.reason instanceof Error?i.reason.message:`Could not undo the archive.`,{tone:`danger`})}function sm(){let e=document.activeElement;return!e||e===document.body||!e.isConnected}function cm(e,t){if(!e.isConnected)return t();let n=new MutationObserver(()=>{e.isConnected||(n.disconnect(),clearTimeout(r),t())}),r=setTimeout(()=>n.disconnect(),5e3);n.observe(document.body,{childList:!0,subtree:!0})}function lm(e,t){if(!sm())return;let n=e?.isConnected?e:t?.isConnected?t:null;n instanceof HTMLElement&&(n.tabIndex<0&&!n.hasAttribute(`tabindex`)&&(n.tabIndex=-1),n.focus({preventScroll:!0}))}function um(e,t,n){if(!e)return()=>{};let r=t(e);return()=>cm(e,()=>lm(r,n))}function dm(e){let t=document.activeElement?.closest(`[data-slot="task-row"]`);return t?.getAttribute(`data-run-id`)===e?t:Array.from(document.querySelectorAll(`[data-slot="task-row"]`)).find(t=>t.getAttribute(`data-run-id`)===e)??null}var fm=e=>e?.querySelector(`a`)??null;function pm(e,t){let n=e?.projectId,r=e?.cacheScope,i=Lt(),[o,s]=Y.useState(null),c=e=>i.invalidateAfter(`runs`,Zt({projectId:n,cacheScope:e})),l=(e,t,r,i)=>V(e,{action:{label:`Undo`,onAction:()=>void om(n,r,i).finally(()=>void c(t))}}),u=Y.useRef(new Map);return{archiveOne:e=>{let i=u.current.get(e.id);if(i)return i;let o=r??a(),s=!!e.pinned,d=dm(e.id),f=um(d,e=>{let t=Array.from(e.closest(`[data-slot="quick-list-bucket"]`)?.querySelectorAll(`[data-slot="task-row"]`)??[]),n=t.indexOf(e);return fm(t[n+1]??t[n-1])},d?.closest(`[data-slot="quick-list-bucket"]`)?.parentElement??null),p=Re(rn(e.id,{projectId:n}),!0).then(()=>(c(o),l(am({title:K(e)}),o,[e.id],s?[e.id]:[]),f(),t?.(),!0),e=>(V(e.message,{tone:`danger`}),!1)).finally(()=>u.current.delete(e.id));return u.current.set(e.id,p),p},sweep:(e,i)=>{let o=r??a();s(e);let u=document.activeElement,d=u?.matches(`[data-action="archive-group"]`)?u:null,f=um(d,e=>fm(e.closest(`[data-slot="quick-list-bucket"]`)?.nextElementSibling?.querySelector(`[data-slot="task-row"]`)??void 0),d?.closest(`[data-slot="quick-list-bucket"]`)?.parentElement??null);ye(Zt({projectId:n}),e,i).then(({ids:e,pinnedIds:n})=>{c(o),e.length>0&&l(am({count:e.length}),o,e,n),f(),e.length>0&&t?.()},e=>V(e.message,{tone:`danger`})).finally(()=>s(null))},sweeping:o}}var mm=.6,hm=300,gm=100,_m={offset:0,phase:`idle`,past:!1},vm=null;function ym(e,t){vm&&vm.id!==e&&vm.close(),vm={id:e,close:t}}function bm(e){vm?.id===e&&(vm=null)}function xm(){if(!(typeof navigator>`u`||typeof navigator.vibrate!=`function`))try{navigator.vibrate(10)}catch{}}function Sm({id:e,enabled:t,onArchive:n}){let[r,i]=Y.useState(_m),a=Y.useRef(null),o=Y.useRef(null),s=Y.useRef(!1),c=Y.useRef(!1),l=Y.useRef(void 0),u=()=>{c.current=!0,clearTimeout(l.current),l.current=void 0},d=()=>{c.current&&(clearTimeout(l.current),l.current=setTimeout(()=>{c.current=!1},hm))};Y.useEffect(()=>()=>clearTimeout(l.current),[]);let f=Y.useRef(r);f.current=r;let p=Y.useRef(n);p.current=n;let m=Y.useCallback(()=>{o.current=null,s.current=!1,bm(e),i(_m)},[e]);Y.useEffect(()=>{!t&&f.current.phase!==`committing`&&m()},[t,m]),Y.useEffect(()=>()=>bm(e),[e]);let h=r.phase===`open`;Y.useEffect(()=>{if(!h)return;let e=()=>m(),t=e=>{let t=a.current;t&&e.target instanceof Node&&t.contains(e.target)||m()};return document.addEventListener(`scroll`,e,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,t,!0),()=>{document.removeEventListener(`scroll`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,!0)}},[h,m]);let g=t=>{bm(e),i({offset:-t,phase:`committing`,past:!0});let n=e=>{e===!1&&m()};try{let e=p.current();e&&typeof e.then==`function`&&e.then(n,m)}catch{m()}};return{offset:r.offset,phase:r.phase,past:r.past,surfaceRef:a,bind:{onPointerDown:e=>{if(c.current=!1,!t||f.current.phase===`committing`||e.pointerType===`mouse`&&e.button!==0)return;let n=(a.current??e.currentTarget).getBoundingClientRect();o.current={pointerId:e.pointerId,x0:e.clientX,y0:e.clientY,base:f.current.phase===`open`?-88:0,width:n.width>0?n.width:320,axis:null,wasOpen:f.current.phase===`open`,samples:[{x:e.clientX,t:Date.now()}]}},onPointerMove:t=>{let n=o.current;if(!n||t.pointerId!==n.pointerId)return;let r=t.clientX-n.x0,a=t.clientY-n.y0;if(n.axis===null){if(Math.max(Math.abs(r),Math.abs(a))<10||(n.axis=Math.abs(r)>Math.abs(a)?`x`:`y`,n.axis===`y`))return;try{t.currentTarget.setPointerCapture?.(t.pointerId)}catch{}ym(e,m),u()}if(n.axis!==`x`)return;let c=Math.min(0,Math.max(-n.width,n.base+r)),l=-c>=mm*n.width;l&&!s.current&&xm(),s.current=l,n.samples.push({x:t.clientX,t:Date.now()}),n.samples.length>8&&n.samples.shift(),i({offset:c,phase:`dragging`,past:l})},onPointerUp:t=>{let n=o.current;if(!n||t.pointerId!==n.pointerId)return;if(o.current=null,n.axis!==`x`){n.axis===null&&n.wasOpen&&(u(),d(),m());return}d();let r=f.current.offset,a=Date.now(),c={x:t.clientX,t:a},l=n.samples.find(e=>a-e.t<=gm&&e.t<a),p=l?(c.x-l.x)/(c.t-l.t):0;s.current=!1,f.current.past||p<=-1&&-r>=40?g(n.width):p<1&&-r>=40?(ym(e,m),i({offset:-88,phase:`open`,past:!1})):m()},onPointerCancel:e=>{let t=o.current;!t||e.pointerId!==t.pointerId||(o.current=null,d(),t.axis===`x`&&m())},onClickCapture:e=>{c.current&&(c.current=!1,e.preventDefault(),e.stopPropagation())},onKeyDownCapture:()=>{c.current=!1}},close:m}}function Cm(e){if(e<1e3)return String(e);let t=[`k`,`M`,`B`,`T`],n=Math.floor(Math.log10(e)/3);return n>t.length?e.toExponential(0).replace(`+`,``):`${Math.floor(e/1e3**n)}${t[n-1]}`}function wm({stat:e,className:t,compact:n=!1}){let r=`+${e.adds} −${e.dels} across ${e.files} ${e.files===1?`file`:`files`}`,i=e.repointed?`${r} — measured against another branch checked out in this task's worktree, as this task found it`:void 0;return(0,X.jsxs)(`span`,{"data-slot":`diff-stat`,...i?{"data-repointed":`true`,"aria-label":i}:{},...n&&!i?{"aria-label":r}:{},title:i??r,className:c(`font-mono text-xs font-semibold tabular-nums`,e.repointed&&`cursor-help underline decoration-dotted underline-offset-2`,t),children:[(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,n?Cm(e.adds):e.adds.toLocaleString(`en-US`)]}),` `,(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,n?Cm(e.dels):e.dels.toLocaleString(`en-US`)]})]})}function Tm(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}function Em(e){return Fa(e)?.runner??e.runner??`claude`}function Dm(e,t,n,r,i,a){return a?e.workflowDef?.steps.find(n=>n.command===void 0&&n.kind!==`plugin`&&(n.runner??e.runner??`claude`)===t)?.agentProfile??(t===n?e.agentProfile:void 0)??i?.[t]:t===r?Fa(e)?.agentProfile:i?.[t]}function Om(e,t,n,r,i=!1){let a=r?.original??Em(e),o=r?.target??a;if(e.delegation?.role===`worker`){let r=Dm(e,t,a,o,n,i);if(r!==void 0||i)return r}if(t!==o)return n?.[t];let s=La(e),c=s.profileId??`default`;return s.sessionId!==void 0&&s.backend===o&&(e.agentProfile??c)===c?c:(o===a?e.agentProfile:void 0)??n?.[t]}function km(e,t,n){let r=La(e),i=r.sessionId===void 0?{runner:e.runner??`claude`,account:e.agentProfile}:{runner:r.backend,account:r.profileId??e.agentProfile};return(i.runner===t?i.account:void 0)??n?.[t]}function Am(e,t,n){let r=e.find(e=>e.provider===t&&e.id===n);return r?.isDefault?void 0:r}function jm(e,t,n,r){return Am(n,t,Om(e,t,r))}function Mm(e,t,n,r){let i=Se(t,e);return i?.enabled===!1?{provider:e,usable:!1,reason:`${_t(n,e)} is disabled. Enable it in ${wi(`providers`)}.`}:r&&i?.authFailureId===void 0?r.status===void 0||r.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${_t(n,e)} account "${r.label}" is not signed in. Sign in in ${wi(`providers`)}.`}:i?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${_t(n,e)} credentials are unavailable. Authorize it in ${wi(`providers`)}.`}}function Nm(e,t,n,r){return Mm(Tm(e),t,n,r)}function Pm(e,t,n,r){return Mm(Em(e),t,n,r)}function Fm(e){let t=vt(),n=At().data,r=Tm(e),{accounts:i,repoAccount:a}=op(),o=Am(i,r,km(e,r,a));return t.isSuccess&&t.data&&n?Nm(e,t.data,n,o):{provider:r,usable:!0}}function Im(e){let t=vt(),n=At(),r=Em(e),{accounts:i,repoAccount:a}=op(),o=jm(e,r,i,a);return t.isSuccess&&t.data&&n.data?Pm(e,t.data,n.data,o):t.isError||n.isError?{provider:r,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:r,usable:!1,reason:`Checking agent providers…`}}function Lm(e){return La(e).sessionId}function Rm(e){return La(e).backend}function zm(e){if(Ba(e)||e.cliHandoff===!1)return;let t=e.cliResumeCommand;if(t!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${t}`:t}function Bm(e,t){let n=Kr(t);return!n||Ba(e)?!1:n===Rm(e)&&Lm(e)!==void 0}function Vm(e){return(e.status===`failed`||ge(e))&&(e.waits?.length??0)>0}function Hm(e,t){return t&&e.delegation?.role===`root`&&(e.status===`failed`||ge(e))}function Um(e){return e.status===`cancelled`&&e.startedAt===void 0&&e.workflowDef!==void 0&&e.steps.every(e=>e.status===`pending`&&e.startedAt===void 0&&!e.sessionId)}function Wm(e){return Ia(e)&&e.removedRunner===void 0}function Gm(e,t=!1){let n=Ba(e),r=Lm(e)!==void 0;return{finish:e.status===`waiting`&&n||e.status===`review`,continueRun:(!n||e.removedRunner!==void 0&&e.status!==`queued`)&&!e.stopping&&e.delegation?.role!==`invalid`&&!(e.delegation?.role===`worker`&&e.delegation.destroy)&&(r||Um(e)||e.removedRunner!==void 0),terminal:Zm(e,n,r),notes:!0,archive:!n,pin:!e.archived&&!Ya(e),markUnread:ro(e)&&!no(e),cancel:n||Vm(e)||Hm(e,t),deleteRun:!n}}function Km(e,t=!1){let n=Gm(e,t);return n.archive&&!n.cancel&&!e.archiveBlocker}function qm(e){return e.status===`waiting`&&e.finishBlocked===null&&Ne(e).bucket===`waiting`}function Jm(e){return`Merge head branch and resolve conflicts in ${e?`PR number ${e}`:`this pull request`}`}function Ym(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function Xm(e,t){let n=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).findIndex(e=>e.id===t);return n>=0?n+1:void 0}function Zm(e,t,n){return e.cliHandoff!==!1&&!t&&n}var Qm=[50,100,200,400,800,1e3,1e3,1e3,1e3],$m=e=>new Promise(t=>setTimeout(t,e));function eh(e){return e instanceof je&&e.status===409&&e.message===`run is still active`}async function th(e,t=$m){for(let n=0;;n+=1)try{return await e()}catch(e){let r=Qm[n];if(!eh(e)||r===void 0)throw e;await t(r)}}function nh(e){return Ba(e)?`live`:Gm(e).continueRun?`resume`:`unavailable`}function rh(e,t){let n=Dt(e.id,t),r=Kt(e.id,t),i=Fm(e),a=Im(e),[o,s]=(0,Y.useState)(void 0),[c,l]=(0,Y.useState)(!1),u=(0,Y.useRef)(!1),d=nh(e),f=d===`resume`?!a.usable:d===`live`&&!i.usable,p=d===`unavailable`?`no-session`:f?`provider`:void 0,m=p===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:p===`provider`?d===`resume`?a.reason:i.reason:void 0,h=(e,t)=>a.usable?r.mutateAsync({text:e,...t===void 0?{}:{images:t}}):Promise.reject(Error(a.reason??`The run provider is unavailable.`));return{mode:d,blockedBy:p,reason:m,isPending:c||n.isPending||r.isPending,error:o,send:async(t,r)=>{if(p||u.current)return m;u.current=!0,l(!0),s(void 0);try{if(d===`resume`){await th(()=>h(t,r));return}try{await n.mutateAsync({text:t,...r===void 0?{}:{images:r}})}catch(n){if(n instanceof je&&n.status===409&&Lm(e)!==void 0){try{await th(()=>h(t,r))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Session closed. Retry to reopen the session. ${t}`)}return}throw n}return}catch(e){let t=e instanceof Error?e.message:String(e);return s(t),t}finally{u.current=!1,l(!1)}}}}function ih({run:e,projectId:t,prNumber:n}){let r=rh(e,t),i=Ti(),[a,o]=(0,Y.useState)(!1),s=a||r.isPending,c=!!r.blockedBy,l=async()=>{if(s||c)return;let e=r.mode===`resume`;o(!0);try{let t=await r.send(Jm(n));t?V(t,{tone:`danger`}):(V(`${e?`Task reopened`:`Sent to the task`} — resolving conflicts${n?` in PR #${n}`:``}`),i())}finally{o(!1)}};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(U,{type:`button`,size:`sm`,"data-slot":`reference-conflict-action`,disabled:c||s,onClick:()=>void l(),className:`h-7 w-full text-xs`,children:s?`Sending…`:`Resolve conflicts`}),c&&r.reason?(0,X.jsx)(`span`,{className:`block opacity-70`,children:r.reason}):null]})}function ah({projectId:e,runId:t,prNumber:n}){let r=Nt(e,t);return r.data?(0,X.jsx)(ih,{run:r.data,projectId:e,prNumber:n}):(0,X.jsx)(U,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:r.isError?`Unavailable`:`Loading…`})}function oh({runId:e,prNumber:t}){let{projectId:n}=Ei();return n===void 0?(0,X.jsx)(sh,{runId:e,prNumber:t}):(0,X.jsx)(ah,{projectId:n,runId:e,prNumber:t})}function sh({runId:e,prNumber:t}){let n=cn(e);return n.data?(0,X.jsx)(ih,{run:n.data,prNumber:t}):(0,X.jsx)(U,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:n.isError?`Unavailable`:`Loading…`})}function ch({run:e,reference:t,className:n,compact:r=!1,plain:i=!1,inert:a=!1}){let{projectId:o,repoBase:s}=Ei(),c=o!==void 0&&t.number!==void 0?Fn(o,e.id,{kind:t.kind,number:t.number,url:t.url},s):void 0;return(0,X.jsx)(Di,{reference:t,taskTitle:K(e),to:c,conflictAction:Nn({...t,number:t.number??0},s)?(0,X.jsx)(oh,{runId:e.id,prNumber:t.number}):void 0,className:n,compact:r,plain:i,inert:a})}var lh=220;function uh({references:e,taskTitle:t,visibleCount:n,plain:r=!1,projectId:i,runId:a,repoBase:o}){let[s,c]=Y.useState(!1),l=Y.useRef(!1),u=Y.useRef(!1),d=Y.useRef(null),f=Y.useRef(void 0);Y.useEffect(()=>()=>clearTimeout(f.current),[]);let p=e=>e.pointerType!==`touch`,m=()=>clearTimeout(f.current),h=e=>{p(e)&&(m(),s||(l.current=!0),c(!0))},g=e=>{p(e)&&(m(),f.current=setTimeout(()=>c(!1),lh))},_=e.length-n,v=e.slice(n).map(t=>{let n=e.some(e=>e!==t&&e.kind===t.kind&&e.number===t.number)&&t.url?new URL(t.url).pathname.split(`/`).slice(1,3).join(`/`):``;return`${t.kind} #${t.number}${n?` (${n})`:``}`}).join(`, `);return _<=0?null:(0,X.jsxs)(ga,{open:s,onOpenChange:c,children:[(0,X.jsx)(fa,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`reference-overflow`,title:v,"aria-label":`Show all ${e.length} references for ${t}`,onPointerEnter:h,onPointerLeave:g,onPointerDown:e=>{e.stopPropagation(),u.current=s&&l.current,l.current=!1},onClick:e=>{e.stopPropagation(),s&&(u.current||l.current)&&(e.preventDefault(),m(),d.current?.focus()),u.current=!1,l.current=!1},className:`no-hover:min-h-[44px] no-hover:min-w-[44px] max-md:min-h-[44px] max-md:min-w-[44px] shrink-0 rounded-full px-1 text-[11px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[`+`,_]})}),(0,X.jsxs)(ha,{ref:d,align:`start`,collisionPadding:8,className:`w-auto min-w-40 max-h-(--radix-popover-content-available-height) overflow-y-auto overscroll-contain p-1.5`,"data-slot":`reference-overflow-list`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onPointerEnter:h,onPointerLeave:g,onOpenAutoFocus:e=>{e.preventDefault(),!l.current&&e.target instanceof HTMLElement&&e.target.focus()},onKeyDownCapture:e=>{e.key===`Escape`&&(e.preventDefault(),l.current=!1,c(!1))},onCloseAutoFocus:e=>{l.current&&e.preventDefault()},children:[(0,X.jsx)(`p`,{className:`px-1 pb-1.5 text-[11px] text-soft-foreground`,children:`References`}),(0,X.jsx)(`span`,{className:`flex flex-col items-start gap-1`,children:e.map(e=>(0,X.jsx)(Di,{reference:e,taskTitle:t,projectId:i,repoBase:o,to:i===void 0?void 0:Fn(i,a,e,o),plain:r,className:`no-hover:min-h-[44px] max-md:min-h-[44px]`,conflictAction:i&&Nn(e,o)?(0,X.jsx)(ah,{projectId:i,runId:a,prNumber:e.number}):void 0},Un(e)))})]})]})}function dh({references:e,maxVisible:t,taskTitle:n,projectId:r,runId:i,repoBase:a,plain:o=!1,compact:s=!1,inertInline:c=!1,fitContainer:l=!1,overflowContainer:u}){let d=Y.useRef(null),[f,p]=Y.useState(t),m=Y.useRef(new Map),h=e.map(Un).join(`|`);Y.useLayoutEffect(()=>{let n=d.current;if(!l||!n?.parentElement){p(t);return}let r=n.parentElement,i=()=>{[...n.querySelectorAll(`:scope > [data-slot="pr-chip"], :scope > [data-slot="issue-chip"]`)].forEach((t,n)=>{let r=t.getBoundingClientRect().width;r&&m.current.set(Un(e[n]),r)});let i=r.getBoundingClientRect();if(!i.width)return;let a=Math.min(t,e.length);n.dataset.referenceWidth=String(e.slice(0,a).reduce((e,t)=>e+(m.current.get(Un(t))??48),0)+Math.max(0,a-1)*4);let o=0;for(let e=n.nextElementSibling;e;e=e.nextElementSibling){if(e.getAttribute(`data-slot`)===`task-row-age`||e.getAttribute(`aria-hidden`)===`true`&&e.nextElementSibling?.getAttribute(`data-slot`)===`task-row-age`)continue;let t=getComputedStyle(e);o+=e.getBoundingClientRect().width+(parseFloat(t.marginLeft)||0)+(parseFloat(t.marginRight)||0)}let s=i.right-n.getBoundingClientRect().left-o,l=n.querySelector(`[data-slot="reference-overflow"]`)?.getBoundingClientRect().width||(c?44:26),d=Math.min(t,e.length);for(;d>0&&!(e.slice(0,d).reduce((e,t)=>e+(m.current.get(Un(t))??48)+4,0)+(u===void 0&&d<e.length?l:0)<=s+(d===e.length?u?.getBoundingClientRect().width??0:0));)d--;p(d)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);return a.observe(r),a.observe(n),()=>a.disconnect()},[l,t,h,c,e,u]);let g=Math.min(f,t,e.length),_=(0,X.jsx)(uh,{references:e,visibleCount:g,taskTitle:n,projectId:r,runId:i,repoBase:a,plain:o});return(0,X.jsxs)(`span`,{ref:d,"data-slot":`reference-list`,className:`inline-flex max-w-full flex-nowrap items-center gap-1 align-middle`,children:[e.slice(0,g).map(e=>(0,X.jsx)(Di,{reference:e,taskTitle:n,projectId:r,repoBase:a,to:r===void 0?void 0:Fn(r,i,e,a),plain:o,compact:s,inert:c,className:`shrink-0`,conflictAction:r&&Nn(e,a)?(0,X.jsx)(ah,{projectId:r,runId:i,prNumber:e.number}):void 0},Un(e))),u===void 0?_:u?(0,Ku.createPortal)(_,u):null]})}function fh({pinned:e,onToggle:t,className:n}){return(0,X.jsx)(`button`,{type:`button`,"data-slot":`pin-toggle`,"data-pinned":e?`true`:void 0,"aria-pressed":e,"aria-label":e?`Unpin task`:`Pin task`,title:e?`Unpin from the top of the list`:`Pin to the top of the list`,onClick:n=>{n.stopPropagation(),t(!e)},className:c(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-soft-foreground transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,n,`max-md:min-h-11 max-md:min-w-11 no-hover:min-h-11 no-hover:min-w-11`),children:(0,X.jsx)(Os,{"data-slot":`pin-icon`,className:`size-[12px]`,fill:e?`currentColor`:`none`,"aria-hidden":`true`})})}var ph=`opacity-0 group-hover/task-row:opacity-100 focus-visible:opacity-100 group-has-[:focus-visible]/task-row:opacity-100 no-hover:opacity-100`,mh=`opacity-0 group-hover/task-row:opacity-100 focus-visible:opacity-100 group-has-[:focus-visible]/task-row:opacity-100`,hh=`transition-opacity motion-reduce:transition-none group-hover/task-row:opacity-0 group-has-[:focus-visible]/task-row:opacity-0 max-md:absolute max-md:top-1/2 max-md:left-0 max-md:-translate-y-1/2 max-md:opacity-100 no-hover:absolute no-hover:top-1/2 no-hover:left-0 no-hover:-translate-y-1/2 no-hover:opacity-100`;function gh({run:e,title:t,unread:n,inertReferences:r,onTogglePin:i,onArchiveRun:a}){return(0,X.jsxs)(`span`,{"data-slot":`task-row-trailing`,className:`relative flex h-[19px] w-[16px] shrink-0 items-center justify-center max-md:h-auto max-md:w-11 max-md:self-stretch no-hover:h-auto no-hover:w-11 no-hover:self-stretch`,children:[n?(0,X.jsx)(q,{tone:Nl(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,"data-slot":`unread-marker`,className:i?hh:void 0}):null,i?(0,X.jsx)(fh,{pinned:!!e.pinned,onToggle:t=>i(e,t),className:c(`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2`,ph)}):null,a&&!r&&Pa(e)?(0,X.jsx)(`button`,{type:`button`,"data-action":`archive-run`,"aria-label":`Archive ${t}`,title:`Archive task`,onClick:t=>{t.stopPropagation(),a(e)},className:c(`absolute top-[19.5px] left-1/2 inline-flex size-5 -translate-x-1/2 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none motion-reduce:transition-none`,mh),children:(0,X.jsx)(Rr,{className:`size-[12px] -translate-y-[2.5px]`,"aria-hidden":`true`})}):null]})}function _h({inertReferences:e,swipeable:t,swipe:n,title:r,onArchive:i,children:a}){return e?(0,X.jsxs)(`div`,{ref:n.surfaceRef,"data-slot":`task-row-swipe`,"data-swipe":t?`on`:void 0,"data-phase":t?n.phase:void 0,className:c(`relative rounded-[6px]`,t&&`touch-pan-y touch-pinch-zoom overflow-hidden`),children:[n.offset<0?(0,X.jsx)(vh,{width:-n.offset,past:n.past,title:r,onArchive:i}):null,a]}):a}function vh({width:e,past:t,title:n,onArchive:r}){return(0,X.jsx)(`div`,{"data-slot":`task-row-swipe-action`,"data-past":t?`true`:void 0,"aria-hidden":`true`,style:{width:e},className:c(`absolute inset-y-0 right-0 flex items-stretch justify-end overflow-hidden rounded-[6px]`,t?`bg-info text-signal-ink`:`bg-muted text-foreground`),children:t?(0,X.jsxs)(`span`,{className:`flex w-full items-center justify-center gap-2 text-[12px] font-semibold whitespace-nowrap`,children:[(0,X.jsx)(Rr,{className:`size-[16px] shrink-0`,"aria-hidden":`true`}),`Release to archive`]}):(0,X.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Archive ${n}`,onClick:e=>{e.stopPropagation(),r()},className:`flex w-[88px] shrink-0 flex-col items-center justify-center gap-1 text-[12px] font-semibold`,children:[(0,X.jsx)(Rr,{className:`size-[16px]`,"aria-hidden":`true`}),`Archive`]})})}var yh=`[&>[data-ellipsis-hidden]]:pointer-events-none`,bh=`data-ellipsis-hidden`,xh=new Map;function Sh(e){let t=getComputedStyle(e),n=`${t.fontStyle} ${t.fontWeight} ${t.fontSize} ${t.fontFamily} ${t.letterSpacing}`,r=xh.get(n);if(r!==void 0)return r;let i=document.createElement(`span`);i.textContent=`…`,i.setAttribute(`aria-hidden`,`true`),Object.assign(i.style,{position:`absolute`,visibility:`hidden`,whiteSpace:`pre`,fontStyle:t.fontStyle,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFamily:t.fontFamily,letterSpacing:t.letterSpacing}),document.body.appendChild(i);let a=i.getBoundingClientRect().width;i.remove();let o=a||parseFloat(t.fontSize)||12;return a&&(!document.fonts||document.fonts.status===`loaded`)&&xh.set(n,o),o}function Ch(e,t){if(e.scrollWidth<=e.clientWidth)return[];let n=e.getBoundingClientRect(),r=parseFloat(getComputedStyle(e).paddingRight)||0,i=n.left+e.clientLeft+e.clientWidth-r-t+.5;return Array.from(e.children).filter(e=>e.getBoundingClientRect().right>i)}function wh(e,t,n){Y.useLayoutEffect(()=>{let n=e.current;if(!t||!n||typeof ResizeObserver>`u`)return;let r=!0,i=()=>{if(!r)return;let e=new Set(Ch(n,Sh(n)));for(let t of Array.from(n.children))t.hasAttribute(bh)!==e.has(t)&&t.toggleAttribute(bh,e.has(t))},a=new ResizeObserver(i),o=new Set,s=()=>{for(let e of Array.from(n.children))o.has(e)||(o.add(e),a.observe(e))};a.observe(n),s(),i();let c=typeof MutationObserver>`u`?null:new MutationObserver(()=>{s(),i()});return c?.observe(n,{childList:!0}),document.fonts&&document.fonts.status!==`loaded`&&document.fonts.ready.then(i),()=>{r=!1,a.disconnect(),c?.disconnect();for(let e of Array.from(n.children))e.removeAttribute(bh)}},[e,t,n])}var Th=`(hover: none)`;function Eh(){let[e,t]=(0,Y.useState)(()=>typeof window.matchMedia==`function`&&window.matchMedia(Th).matches);return(0,Y.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(Th);t(e.matches);let n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var Dh=`(min-width: 48rem)`;function Oh(){let[e,t]=(0,Y.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 48rem)`).matches);return(0,Y.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(Dh),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var kh={"needs-permission":`label`,failed:`label`,"needs-you":`none`,"needs-review":`label`,running:`label`,"usage-limit":`resume`,"waiting-on-workers":`label`,"waiting-on-subagents":`label`,"waiting-for-ci":`label`,"waiting-for-merge":`label`,"waiting-for-command":`until`,monitoring:`next-check`,"waiting-for-capacity":`label`,queued:`queue-position`,done:`none`,cancelled:`none`,unseen:`label`};function Ah(e,t,n,r){let{label:i}=e;switch(kh[e.rung]){case`none`:return;case`queue-position`:return t===null?i:`queued #${t}`;case`resume`:{let e=yi(n.autoResumeAt,r),t=n.autoResumeReason===`provider-error`?`provider error`:i;return e===`scheduled`?t:`${t}, ${e}`}case`next-check`:{let e=D(n),t=e?.kind===`timer`?new Date(e.at):void 0;return t&&Number.isFinite(t.getTime())?`${i}, next check ${bi(t,new Date(r))}`:i}case`until`:{let e=D(n),t=e?.kind===`process`?new Date(e.deadline):void 0;return t&&Number.isFinite(t.getTime())?`${i}, until ${bi(t,new Date(r))}`:i}case`label`:return i}}function jh({run:e,attention:t,queuePosition:n,inWorkingGroup:r,scope:i,now:a}){let o=In(e,void 0,i??void 0),s=n===null?_i(e.finishedAt??e.createdAt,a):``,c=r&&t.rung===`running`?void 0:Ah(t,n,e,a);return{stateWord:c,references:o,age:s,key:`${s}|${c??``}|${o.map(e=>`${e.kind}-${e.number}-${e.url}`).join(`,`)}|${+!!e.notify}`}}function Mh(e){let t=K(e);return{title:t,displayTitle:Ha(t,Ln(e)?.number)?Ra(t).rest:t}}function Nh(e){let[t,n]=Y.useState(()=>Date.now());return Y.useEffect(()=>{if(u())return;let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var Ph=`cez-sidebar-collapsed`,Fh=`cez-sidebar-sections-collapsed`;function Ih(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e))typeof r==`boolean`&&(t[n]=r);return t}function Lh(e=Ph){try{let t=localStorage.getItem(e);return t===null?{}:Ih(JSON.parse(t))}catch{return{}}}function Rh(e,t=Ph){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}var zh=`cez-sidebar-sections-changed`;function Bh(e){let[t,n]=(0,Y.useState)(()=>Lh(Fh)),[r,i]=(0,Y.useState)({}),a=(0,Y.useRef)(t);(0,Y.useEffect)(()=>{let e=e=>{if(e instanceof StorageEvent&&e.key!==null&&e.key!==`cez-sidebar-sections-collapsed`)return;let t=e instanceof CustomEvent?e.detail:Lh(Fh);a.current=t,n(t)};return window.addEventListener(`storage`,e),window.addEventListener(zh,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(zh,e)}},[]),(0,Y.useEffect)(()=>{if(e===null||Object.keys(r).length===0)return;let t={...a.current};for(let[n,i]of Object.entries(r))t[JSON.stringify([e,n])]=i;i({}),a.current=t,n(t),Rh(t,Fh),window.dispatchEvent(new CustomEvent(zh,{detail:t}))},[e,r]);let o=t=>JSON.stringify([e,t]);return{isCollapsed:e=>e!==`Archived`&&(r[e]??t[o(e)])===!0,toggle:t=>{if(e===null){i(e=>({...e,[t]:e[t]!==!0}));return}let r=o(t),s={...a.current,[r]:a.current[r]!==!0};a.current=s,n(s),Rh(s,Fh),window.dispatchEvent(new CustomEvent(zh,{detail:s}))}}}function Vh({runs:e,view:t,automations:n,onViewChange:r,currentRunId:i=null,now:a=Date.now(),onTogglePin:o,onArchiveRun:s,onSweep:c,sweeping:l=null,showViewControls:u=!0,rowLimit:d,sidebarLimits:f,projectId:p=null}){let m=Bs(),h=Wa(e,n),g=Ua(e,t,n),_=za(g,`active`),v=Ga(_,f??d??{overall:null}),y=c?Hh(g):void 0;return(0,X.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,X.jsxs)(`div`,{"data-slot":`quick-list-header`,className:`flex min-h-11 items-center gap-1.5 pr-[6px] pl-[10px] md:min-h-[26px]`,children:[(0,X.jsx)(`h2`,{className:`text-[13px] font-semibold text-foreground`,children:`Tasks`}),(0,X.jsx)(`span`,{className:`text-[11.5px] text-soft-foreground`,children:h[t]}),(0,X.jsxs)(G,{to:`/`,onClick:m,className:`ml-auto flex min-h-11 items-center gap-0.5 text-[12px] text-soft-foreground hover:text-foreground md:min-h-[26px]`,children:[`All`,(0,X.jsx)(Br,{className:`size-[13px]`,"aria-hidden":`true`})]})]}),u?(0,X.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,X.jsx)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[2px]`,children:(0,X.jsx)(ng,{view:t,automations:n,onSelect:r,counts:h})})}):null,_.length===0?(0,X.jsx)(`p`,{className:`px-3 py-3.5 text-xs text-soft-foreground`,children:t===`automations`?`No automation tasks.`:`No tasks yet — describe one.`}):(0,X.jsx)(Uh,{buckets:v,allBuckets:_,sectionProjectId:p,currentRunId:qa(i,e),now:a,onTogglePin:o,onArchiveRun:s,onSweep:c,sweeping:l,sweepCounts:y,view:t,automations:n})]})}function Hh(e){return{unpinned:Gn(e,`unpinned`),pinned:Gn(e,`pinned`)}}function Uh({buckets:e,currentRunId:t=null,now:n=Date.now(),scope:r=null,onTogglePin:i,onArchiveRun:a,onSweep:o,sweeping:s=null,sweepCounts:c,projectName:l,allBuckets:u=e,sectionProjectId:d=r,view:f=`active`,automations:p}){let m=Y.useId(),h=Bh(d),g=Y.useRef(null),_=Y.useRef(null);Y.useLayoutEffect(()=>{let e=_.current;if(!e||e.element.isConnected||(_.current=null,document.activeElement!==document.body))return;let t=u.find(t=>t.rows.some(t=>t.run.id===e.id));if(!t)return;let n=Array.from(g.current?.children??[]).find(e=>e.dataset.bucket===t.label);(Array.from(n?.querySelectorAll(`[data-slot="task-row"]`)??[]).find(t=>t.dataset.runId===e.id)?.querySelector(`a`)??n?.querySelector(`[data-slot="section-toggle"]`))?.focus({preventScroll:!0})});let v=(e,o=!1)=>(0,X.jsx)(Zh,{inWorkingGroup:o,run:e.run,queuePosition:e.queuePosition,currentRunId:t,now:n,scope:r,onTogglePin:i,onArchiveRun:a});return(0,X.jsx)(`div`,{ref:g,className:`flex flex-col gap-3`,onFocusCapture:e=>{let t=e.target.closest(`[data-slot="task-row"]`);_.current=t?.dataset.runId?{id:t.dataset.runId,element:e.target}:null},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||(_.current=null)},children:u.map(t=>{let n=t.label===`Archived`,i=h.isCollapsed(t.label),a=e.find(({label:e})=>e===t.label)?.rows??[],u=t.rows.length,d=!n&&!i&&a.length<u,g=`${m}-${t.label.replaceAll(` `,`-`)}`;return(0,X.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":t.label,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pr-[6px]`,children:[(0,X.jsx)(Gh,{id:g,bucket:t,collapsed:i,cut:d,onToggle:h.toggle}),d?(0,X.jsx)(Wh,{section:t.label,shown:a.length,total:u,scope:r,view:f,automations:p}):null,o&&c?(0,X.jsx)(eg,{label:t.label,headingId:g,projectName:l,counts:c,onSweep:o,sweeping:s}):null]}),(0,X.jsx)(`div`,{id:`${g}-rows`,hidden:i,children:!i&&a.map(e=>(0,X.jsx)(`div`,{children:v(e,t.label===`Working`)},e.run.id))})]},t.label)})})}function Wh({section:e,shown:t,total:n,scope:r,view:i,automations:a}){let o=Bs();return(0,X.jsxs)(G,{to:Ea(r,Xa(e,i,a)),onClick:o,"data-slot":`section-cut-link`,"aria-label":`${e}: showing ${t} of ${n}, see all`,title:`The sidebar shows ${t} of ${n} ${e} tasks. Click to see all of them. Change the limit in ${wi(`sidebar`)}.`,className:`mr-auto -ml-1 flex min-h-[44px] min-w-[44px] shrink-0 items-center rounded-[4px] px-1 text-[11px] font-normal text-soft-foreground tabular-nums underline decoration-dotted underline-offset-[3px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground md:min-h-[26px] md:min-w-0 no-hover:min-h-[44px] no-hover:min-w-[44px]`,children:[t,` of `,n]})}function Gh({id:e,bucket:t,collapsed:n,cut:r,onToggle:i}){let a=t.rows.length;if(t.label===`Archived`)return(0,X.jsx)(`h2`,{id:e,className:`min-w-0 flex-1 text-[11px] font-medium text-soft-foreground`,children:(0,X.jsxs)(`span`,{className:`px-[10px] pt-[2px] pb-[4px]`,children:[t.label,` `,a]})});let o=t.label,s=t.rows.map(e=>e.run),l=s.length?Ne(Va(s)):null,u=s.some(no),d=n?Br:Or;return(0,X.jsx)(`h2`,{id:e,className:c(`min-w-0 text-[11px] font-medium text-soft-foreground`,r?`shrink-0`:`flex-1`),children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`section-toggle`,"aria-expanded":!n,"aria-controls":`${e}-rows`,"aria-label":`${o} ${a}`,onClick:()=>i(o),className:c(`flex min-h-[44px] items-center gap-1.5 rounded-[4px] px-[10px] text-left hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground md:min-h-[26px] no-hover:min-h-[44px]`,r?`pr-[4px]`:`w-full`),children:[(0,X.jsx)(d,{className:`size-[12px] shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:o}),r?null:(0,X.jsxs)(X.Fragment,{children:[` `,(0,X.jsx)(`span`,{className:`font-normal tabular-nums`,children:a})]}),l&&(o===`Needs you`||n)?(0,X.jsx)(q,{tone:l.tone,shape:l.shape,pulse:l.pulse,role:`img`,"aria-label":l.label,title:l.label}):null,n&&u?(0,X.jsx)(`span`,{role:`img`,"aria-label":`unread`,title:`Unread tasks`,className:`size-[5px] shrink-0 rounded-full bg-foreground`}):null]})})}function Kh({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`view-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:c(`flex min-h-11 min-w-0 flex-1 items-center justify-center gap-1.5 rounded-[7px] text-[11px] font-medium text-muted-foreground md:min-h-[22px]`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,X.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function qh(){let e=Eh(),t=Oh();return e||!t}function Jh(e){let t=document.createRange();t.selectNodeContents(e);let n=t.getBoundingClientRect?.().width,r=e.querySelector(`[data-reference-width]`),i=r?Math.max(0,Number(r.dataset.referenceWidth)-r.getBoundingClientRect().width):0;return Math.ceil((n||e.scrollWidth)+i)}function Yh(e,t,n){let[r,i]=Y.useState(!1),[a,o]=Y.useState(0),s=Y.useRef(!1),c=Y.useRef(!1),l=Y.useRef(null),u=Y.useCallback(e=>{s.current=e,i(e)},[]);return Y.useLayoutEffect(()=>{let r=e.current;if(!t||!r||typeof ResizeObserver>`u`){l.current=null,u(!1);return}let i=!0,a=()=>{if(i){if(l.current?.key!==n){if(s.current){u(!1),o(e=>e+1);return}l.current={key:n,width:Jh(r)}}u(l.current.width>r.clientWidth)}};a();let d=new ResizeObserver(a);d.observe(r);let f=new WeakMap,p=new ResizeObserver(e=>{let t=!1;for(let n of e??[]){let e=n.borderBoxSize?.[0]?.inlineSize??n.contentRect.width,r=f.get(n.target);f.set(n.target,e),r!==void 0&&r!==e&&(t=!0)}!t||!i||(l.current=null,a())}),m=new Set,h=()=>{let e=!1;for(let t of[...r.children,...r.querySelectorAll(`[data-slot="reference-list"] [data-slot="pr-chip"], [data-slot="reference-list"] [data-slot="issue-chip"]`)]){let{slot:n}=t.dataset;n===`task-row-age`||t.getAttribute(`aria-hidden`)===`true`||m.has(t)||(m.add(t),f.set(t,t.getBoundingClientRect().width),p.observe(t),e=!0)}return e};h();let g=typeof MutationObserver>`u`?null:new MutationObserver(()=>{!h()||!i||(l.current=null,a())});return g?.observe(r,{childList:!0,subtree:!0}),document.fonts&&document.fonts.status!==`loaded`&&!c.current&&document.fonts.ready.then(()=>{c.current=!0,i&&(l.current=null,a())}),()=>{i=!1,d.disconnect(),p.disconnect(),g?.disconnect()}},[e,t,n,a,u]),t&&r}function Xh(){return(0,X.jsx)(`span`,{"aria-hidden":`true`,children:` · `})}function Zh({run:e,queuePosition:t,currentRunId:n,now:r,scope:i,inWorkingGroup:a=!1,onTogglePin:o,onArchiveRun:s}){let l=Da(),u=Bs(),d=qh(),f=!!s&&d&&Pa(e),p=Sm({id:e.id,enabled:f,onArchive:()=>s?.(e)}),m=Ea(i,`/tasks/${e.id}`),h=Ne(e),g=e.id===n,{title:_,displayTitle:v}=Mh(e),y=no(e),b=jh({run:e,attention:h,queuePosition:t,inWorkingGroup:a,scope:i,now:r}),[x,S]=Y.useState(null);return(0,X.jsx)(_h,{inertReferences:d,swipeable:f,swipe:p,title:_,onArchive:()=>void s?.(e),children:(0,X.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":g?`true`:void 0,onClick:e=>{e.currentTarget.contains(e.target)&&(e.target.closest(`a, button, input`)||(l(m),u?.()))},...f?p.bind:{},style:p.offset?{transform:`translateX(${p.offset}px)`}:void 0,className:c(`selection-row group/task-row flex cursor-pointer items-start gap-2.5 rounded-[6px] py-1.5 pr-2 pl-2.5 hover:bg-sidebar-row-hover`,f&&`select-none`,f&&p.phase!==`dragging`&&`motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-out`,g&&`bg-sidebar-row-selected hover:bg-sidebar-row-selected`),children:[(0,X.jsx)(`span`,{"data-slot":`task-row-dot`,className:`flex h-[19px] w-[12px] shrink-0 items-center justify-center`,children:(0,X.jsx)(q,{tone:h.tone,shape:h.shape,pulse:h.pulse,"aria-label":h.label,title:h.label,role:`img`})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,X.jsx)(Qh,{run:e,to:m,title:_,displayTitle:v,isActive:g,unread:y,swipeable:f,onNavigate:u}),(0,X.jsx)($h,{run:e,meta:b,title:_,scope:i,isActive:g,inertReferences:d,overflowContainer:x})]}),b.references.length?(0,X.jsx)(`span`,{ref:S,"data-slot":`protected-reference-overflow`,className:c(`shrink-0 self-end`,d&&`-my-1.5 self-center`)}):null,e.delegation?.role===`worker`?(0,X.jsxs)(`span`,{className:`sr-only`,children:[`Worker · `,h.label]}):null,(0,X.jsx)(gh,{run:e,title:_,unread:y,inertReferences:d,onTogglePin:o,onArchiveRun:s})]})})}function Qh({run:e,to:t,title:n,displayTitle:r,isActive:i,unread:a,swipeable:o,onNavigate:s}){return(0,X.jsxs)(G,{to:t,onClick:s,title:n,"aria-current":i?`page`:void 0,draggable:!o&&void 0,className:`flex h-[19px] min-w-0 items-center gap-2 rounded-[2px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,children:[(0,X.jsx)(`span`,{"data-slot":`task-row-title`,className:c(`min-w-[7rem] flex-1 truncate text-[13px] leading-[1.45] font-medium text-muted-foreground`,a&&`font-semibold text-foreground`,i&&`text-foreground`),children:r}),e.diffStat?(0,X.jsx)(wm,{stat:e.diffStat,className:`hidden shrink-0 text-[12px] @min-[23rem]/sidebar:inline`}):null]})}function $h({run:e,meta:t,title:n,scope:r,isActive:i,inertReferences:a,overflowContainer:o}){let{stateWord:s,references:l,age:u,key:d}=t,f=Ei(),p=Y.useRef(null),m=Yh(p,!!u,d);wh(p,!a&&l.length>0,`${d}|${+!!m}`);let h=[];return s&&h.push((0,X.jsx)(`span`,{"data-slot":`task-row-state`,children:s},`state`)),l.length&&h.push((0,X.jsx)(dh,{references:l,maxVisible:2,taskTitle:n,projectId:r??f.projectId,repoBase:f.repoBase,runId:e.id,plain:!0,compact:!0,inertInline:a,fitContainer:!0,overflowContainer:o},`references`)),u&&!m&&h.push((0,X.jsx)(`span`,{"data-slot":`task-row-age`,className:`tabular-nums`,children:u},`age`)),(0,X.jsxs)(`div`,{ref:p,"data-slot":`task-row-meta`,className:c(`h-[16px] min-w-0 truncate text-[11.5px] leading-[1.4] font-normal text-soft-foreground`,yh,i&&`text-muted-foreground`),children:[e.notify===!0?(0,X.jsx)(`span`,{"data-slot":`task-row-notify`,role:`img`,"aria-label":`Notifying the task webhook`,title:`Notifying the task webhook`,className:`mr-[4px] inline-block shrink-0 align-[-1px]`,children:(0,X.jsx)(ks,{"aria-hidden":`true`,className:`size-[10px]`})}):null,h.length?h.flatMap((e,t)=>t?[(0,X.jsx)(Xh,{},`sep-${t}`),e]:[e]):e.notify===!0?null:`\xA0`]})}function eg({label:e,headingId:t,projectName:n,counts:r,onSweep:i,sweeping:a}){let o=e===`Finished`?`unpinned`:null;if(!o||r[o]===0)return null;let s=a===o,c=`Archive all`;return(0,X.jsxs)(`button`,{type:`button`,"data-action":`archive-group`,"data-scope":o,disabled:s,"aria-busy":s?`true`:void 0,"aria-label":n?`${c}, ${n}`:void 0,"aria-describedby":t,onClick:()=>i(o),className:`relative inline-flex shrink-0 items-center gap-1 rounded-[4px] px-1.5 py-0.5 font-sans text-[11px] leading-[1.4] text-muted-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground disabled:opacity-60 max-md:before:absolute max-md:before:top-1/2 max-md:before:left-0 max-md:before:h-11 max-md:before:w-full max-md:before:-translate-y-1/2 max-md:before:content-[''] no-hover:before:absolute no-hover:before:top-1/2 no-hover:before:left-0 no-hover:before:h-11 no-hover:before:w-full no-hover:before:-translate-y-1/2 no-hover:before:content-['']`,children:[(0,X.jsx)(Rr,{className:`size-[11px]`,"aria-hidden":`true`}),c]})}function tg({showViewControls:e=!0,projectId:t,boot:n=!1}){let r=Bs(),i=t??a(),o=sn(i,!0,n),s=pt(i,!0,n).data?.sidebarLimits??{},c=dn(Zt({projectId:i,boot:n})),l=pm(Zt({projectId:i,boot:n}),r),u=St(),[d,f,p]=rp(),m=ka(`/tasks/:id/*`),h=ka(`/tasks/:id`),g=Nh(3e4),_=It(),v=t??_,y=kt(v),b=Ga(za(Ua(o.data??[],d,p),`active`),s),x=v===void 0?[]:b.flatMap(e=>e.rows.flatMap(({run:e})=>In(e,y).filter(e=>Nn(e,y)).map(e=>({projectId:v,kind:e.kind,number:e.number}))));return o.data?(0,X.jsx)(Ci,{projectId:v,repoBase:y,requests:x,children:(0,X.jsx)(Vh,{showViewControls:e,sidebarLimits:s,projectId:v==="default"?u.data?.bootProject??null:v??null,runs:o.data,view:d,automations:p,onViewChange:f,currentRunId:m?.params.id??h?.params.id??null,now:g,onTogglePin:(e,t)=>c.mutate({id:e.id,pinned:t}),onArchiveRun:l.archiveOne,onSweep:e=>l.sweep(e,p?d===`automations`:void 0),sweeping:l.sweeping})}):null}function ng({view:e,automations:t,onSelect:n,counts:r}){let i=(0,X.jsx)(q,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`needs you`});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Kh,{view:`active`,current:e,onSelect:n,count:r.active,children:[`Active`,r.activeWaiting>0&&e!==`active`?i:null]}),t?(0,X.jsxs)(Kh,{view:`automations`,current:e,onSelect:n,count:r.automations,children:[`Automations`,r.automationsWaiting>0&&e!==`automations`?i:null]}):null]})}var rg=e=>e.available?`success`:`danger`,ig=e=>e.available?`Installed`:`Not installed`,ag=e=>e.available?null:e.hint??null,og=`inline-flex items-center rounded-sm text-xs font-medium text-foreground hover:underline focus-visible:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring max-md:min-h-11 no-hover:min-h-11`,sg=(e,t)=>fn(t).includes(e.name);function cg(e,t){let n=e.checks.filter(e=>sg(e,t));if(n.length&&!n.some(e=>e.available))return`no agent CLI found — install one to run tasks`;let r=n.find(t=>t.name===e.defaultRunner);return r&&!r.available?`default runner (${e.defaultRunner}) not found`:null}function lg(e,t){let n=`Squawk v${e.version}`;if(t===void 0)return n;let r=cg(e,t);if(r)return`${n} · ${r}`;let i=e.checks.filter(e=>!e.available).map(e=>e.name);return i.length?`${n} · optional: ${i.join(`, `)} not installed`:n}function ug(e){return e.forge?.available?null:e.forge?`GitHub is unreachable — ${e.forge.reason??`unknown reason`}. The GitHub tab is hidden until it comes back.`:`No GitHub remote detected — the GitHub tab is hidden. Every plain-git feature still works.`}function dg({health:e,runners:t,sessionScope:n}){if(!e)return null;let r=cg(e,t);return(0,X.jsxs)(Gi,{children:[(0,X.jsx)(Hi,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,"aria-label":`Tools`,title:lg(e,t),className:`relative flex items-center gap-1.5 rounded-[6px] px-2 py-1.5 text-[12px] font-normal text-soft-foreground transition-colors hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-[state=open]:bg-sidebar-row-selected data-[state=open]:text-foreground`,children:[(0,X.jsx)(yr,{className:`size-[15px]`,"aria-hidden":`true`}),r?(0,X.jsx)(q,{tone:`pending`,className:`absolute top-1 left-5 size-1.5`}):null,`Tools`]})}),(0,X.jsxs)(Ui,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[n?(0,X.jsx)(`div`,{className:`px-2 py-2`,children:n}):null,(0,X.jsx)(Ii,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,X.jsx)(fg,{check:e},e.name):(0,X.jsx)(pg,{check:e},e.name)),ug(e)?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Bi,{}),(0,X.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-[11px] leading-snug text-muted-foreground`,children:ug(e)})]}):null,(0,X.jsx)(Bi,{}),(0,X.jsx)(W,{asChild:!0,children:(0,X.jsx)(z,{to:`/tools`,children:`Tools diagnostics`})}),(0,X.jsx)(W,{asChild:!0,children:(0,X.jsxs)(z,{to:Oo,"data-slot":`tools-settings`,className:`gap-2 text-[13px] text-muted-foreground`,children:[(0,X.jsx)(lr,{className:`size-3.5`,"aria-hidden":`true`}),`Tool settings`]})})]})]})}function fg({check:e}){return(0,X.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":`true`,className:`flex items-center gap-2 rounded-sm px-2 py-1.5`,children:[(0,X.jsx)(q,{tone:rg(e)}),(0,X.jsx)(`span`,{className:`font-mono text-[13px] font-medium`,children:e.name}),(0,X.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11px] font-medium text-muted-foreground tabular-nums`,children:e.version??`not found`})]})}function pg({check:e}){let t=ag(e);return(0,X.jsx)(W,{asChild:!0,children:(0,X.jsxs)(z,{to:Do(e.name),"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(q,{tone:rg(e)}),(0,X.jsx)(`span`,{className:`font-mono text-[13px] font-medium`,children:e.name}),(0,X.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11px] font-medium text-muted-foreground`,children:`not found`})]}),(0,X.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[t?(0,X.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-[11px] leading-snug text-muted-foreground`,children:t}):null,(0,X.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-[11px] font-semibold text-accent-text`,children:`Set up →`})]})]})})}function mg(e){return e?.trim()||null}function hg({projectName:e,pageLabel:t}){let n=mg(e),r=mg(t);return n&&r?`${n} — ${r} · Squawk`:n?`${n} · Squawk`:r?`${r} · Squawk`:`Squawk`}function gg(e){let t=hg(e);(0,Y.useEffect)(()=>{document.title=t},[t])}function _g({...e}){return(0,X.jsx)(uc,{"data-slot":`alert-dialog`,...e})}function vg({...e}){return(0,X.jsx)(dc,{"data-slot":`alert-dialog-portal`,...e})}function yg({className:e,...t}){return(0,X.jsx)(fc,{"data-slot":`alert-dialog-overlay`,className:c(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none`,e),...t})}function bg({className:e,...t}){return(0,X.jsxs)(vg,{children:[(0,X.jsx)(yg,{}),(0,X.jsx)(pc,{"data-slot":`alert-dialog-content`,className:c(`fixed inset-bs-[50%] start-[50%] z-50 grid max-h-[calc(100dvh-2rem)] overflow-y-auto overscroll-contain w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-hidden motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95 motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none sm:max-w-md`,e),...t})]})}function xg({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:c(`flex flex-col gap-2 text-center sm:text-start`,e),...t})}function Sg({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:c(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function Cg({className:e,...t}){return(0,X.jsx)(gc,{"data-slot":`alert-dialog-title`,className:c(`text-lg leading-none font-semibold`,e),...t})}function wg({className:e,...t}){return(0,X.jsx)(_c,{"data-slot":`alert-dialog-description`,className:c(`text-sm text-muted-foreground`,e),...t})}function Tg({className:e,...t}){return(0,X.jsx)(mc,{"data-slot":`alert-dialog-action`,className:c(ki({variant:`contrast`}),e),...t})}function Eg({className:e,...t}){return(0,X.jsx)(hc,{"data-slot":`alert-dialog-cancel`,className:c(ki({variant:`outline`}),e),...t})}function Dg(e){let t=Aa(e);return/^\/git\/branches(?:\/|$)/.test(t)?`branches`:/^\/git\/not-landed(?:\/|$)/.test(t)?`not-landed`:/^\/git\/cleanup(?:\/|$)/.test(t)?`cleanup`:/^\/git\/changes(?:\/|$)/.test(t)?`changes`:/^\/git(?:\/commits(?:\/[^/]+)?)?\/?$/.test(t)?`main`:null}var Og={main:`/git`,"not-landed":`/git/not-landed`,cleanup:`/git/cleanup`,branches:`/git/branches`,changes:`/git/changes`},kg=`/git?view=repo`,Ag={second:`s`,minute:`m`,hour:`h`,day:`d`,week:`w`,month:`mo`,year:`y`};function jg(e){let t=/^(\d+) (second|minute|hour|day|week|month|year)s? ago$/.exec(e.trim());return t?`${t[1]}${Ag[t[2]]}`:e}function Mg(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}var Ng=new Intl.DateTimeFormat(`en-US`,{weekday:`short`,month:`short`,day:`numeric`}),Pg=new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,year:`numeric`});function Fg(e,t){let n=Date.parse(e);if(Number.isNaN(n))return`Earlier`;let r=Mg(t);if(n>=r)return`Today`;if(n>=Mg(r-1))return`Yesterday`;let i=new Date(n);return(i.getFullYear()===new Date(t).getFullYear()?Ng:Pg).format(i)}function Ig(e,t=Date.now()){let n=[];for(let r of e){let e=Fg(r.at,t),i=n.at(-1);i?.label===e?i.commits.push(r):n.push({label:e,commits:[r]})}return n}function Lg(e,t=Date.now()){return e.filter(e=>Fg(e.at,t)===`Today`).length}function Rg(e,t){return(e.baseBranch??t.branch)===t.branch?e.tracking:null}function zg(e,t=Date.now()){let n=e.fetchedAt?_i(e.fetchedAt,t):``;return n?`fetched ${n} ago`:`never fetched`}function Bg(e,t){let n=F(),r=[e,`repo`],i=[e,`health`],[a,o]=(0,Y.useState)(null),s=e=>V(e.message,{tone:`danger`}),c=()=>Promise.all([n.invalidateQueries({queryKey:r}),n.invalidateQueries({queryKey:i}),n.invalidateQueries({queryKey:L.projects})]),l=qt({mutationFn:t=>fe(t,e)}),u=async(e=!1)=>{let n=a?.branch??t.branch;try{let t=await l.mutateAsync(e?{branch:n,confirm:!0}:{branch:n});if(`risks`in t){o(t);return}o(null),V(t.summary),await c()}catch(e){o(null),V(e instanceof Error?e.message:String(e),{tone:`danger`}),await c()}},d=qt({mutationFn:t=>N({name:t},e),onSuccess:async e=>{V(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await c(),n.setQueryData(r,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),n.setQueryData(i,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:s}),f=qt({mutationFn:t=>k({baseBranch:t},e),onSuccess:t=>{V(t.baseBranch?`New tasks now start from ${t.baseBranch}`:`New tasks now start from the checked-out branch`),n.invalidateQueries({queryKey:r}),n.invalidateQueries({queryKey:[e,`config`]})},onError:s});return{hasRemote:!!t.remote,pull:u,pulling:l.isPending,confirmation:a,dismissConfirmation:()=>{l.isPending||o(null)},switchBranch:d,setBase:f}}var Vg={sidebar:{card:`gap-[8px] rounded-[8px] p-[10px]`,branchRow:`gap-[6px]`,branchIcon:`size-[14px]`,branch:`text-[12.5px]`,chevron:`size-[12px]`,pull:`h-[24px] gap-[4px] rounded-[6px] px-[8px] text-[11.5px] [&>svg]:size-[12px]`,line:`text-[11px]`,lineChevron:`size-[11px]`,dirty:`gap-[6px] pt-[6px] text-[11px] [&>svg]:size-[12px]`},screen:{card:`gap-[10px] rounded-[10px] p-[12px]`,branchRow:`gap-[8px]`,branchIcon:`size-[16px]`,branch:`text-[14px]`,chevron:`size-[14px]`,pull:`h-[36px] gap-[6px] rounded-[8px] px-[14px] text-[13px] [&>svg]:size-[14px]`,line:`text-[12px]`,lineChevron:`size-[12px]`,dirty:`h-[40px] gap-[8px] pt-[4px] text-[13px] [&>svg:first-child]:size-[14px] [&>svg:last-child]:size-[15px]`}};function Hg({scope:e,repo:t,info:n,variant:r,onNavigate:i}){let a=Vg[r],o=Bg(e,n),s=t.baseBranch??n.branch,l=t.status.length,u=Rg(t,n),d=o.switchBranch.isPending,f=(0,Y.useRef)(null);return(0,X.jsxs)(`section`,{"aria-label":`Checkout`,"data-slot":`git-checkout`,"data-variant":r,className:c(`flex flex-col border border-border`,a.card),children:[(0,X.jsxs)(`div`,{className:c(`flex min-w-0 items-center`,a.branchRow),children:[(0,X.jsxs)(Gi,{children:[(0,X.jsxs)(Hi,{"data-slot":`git-branch-menu`,"aria-label":`Branch ${n.branch}. Switch branch`,disabled:d,className:c(`group flex min-w-0 flex-1 items-center rounded-[4px] text-left outline-none focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,a.branchRow,r===`screen`&&`min-h-11`),children:[(0,X.jsx)(Zn,{"aria-hidden":`true`,className:c(`shrink-0 text-muted-foreground`,a.branchIcon)}),(0,X.jsx)(`span`,{"data-slot":`git-checkout-branch`,className:c(`min-w-0 flex-1 truncate font-mono font-semibold text-foreground`,a.branch),children:n.branch}),(0,X.jsx)(Or,{"aria-hidden":`true`,className:c(`shrink-0 text-soft-foreground group-hover:text-foreground`,a.chevron)})]}),(0,X.jsxs)(Ui,{align:`start`,className:`w-64`,children:[(0,X.jsx)(Ii,{className:`text-xs text-soft-foreground`,children:`Switch branch`}),(0,X.jsx)(Wi,{value:n.branch,onValueChange:e=>{e!==n.branch&&o.switchBranch.mutate(e)},children:t.branches.map(e=>(0,X.jsx)(Li,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,X.jsx)(`span`,{className:`truncate`,children:e})},e))}),(0,X.jsx)(Bi,{}),(0,X.jsx)(W,{asChild:!0,children:(0,X.jsx)(G,{to:Og.branches,"data-slot":`git-branch-menu-all`,onClick:i,children:`Create or find a branch…`})})]})]}),(0,X.jsxs)(`button`,{ref:f,type:`button`,"data-action":`repo-pull`,disabled:!o.hasRemote||o.pulling,title:o.hasRemote?`Pull ${n.branch}`:`No remote configured. Add a Git remote before pulling.`,onClick:()=>void o.pull(),className:c(`inline-flex shrink-0 items-center bg-muted font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100`,a.pull),children:[o.pulling?(0,X.jsx)(gi,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,X.jsx)(kr,{"aria-hidden":`true`}),`Pull`]})]}),u?(0,X.jsx)(Ug,{tracking:u,className:a.line}):null,(0,X.jsxs)(Gi,{children:[(0,X.jsxs)(Hi,{"data-slot":`base-branch-picker`,"aria-label":`New tasks start from ${s}. Change the base branch`,disabled:o.setBase.isPending,className:c(`group flex min-w-0 items-center gap-[4px] self-start rounded-[4px] text-soft-foreground outline-none hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,a.line,r===`screen`&&`min-h-[32px]`),children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:`New tasks start from`}),(0,X.jsx)(`span`,{"data-slot":`base-branch`,className:`min-w-0 truncate font-mono text-muted-foreground group-hover:text-foreground`,children:s}),(0,X.jsx)(Or,{"aria-hidden":`true`,className:c(`shrink-0`,a.lineChevron)})]}),(0,X.jsxs)(Ui,{align:`start`,className:`w-64`,children:[(0,X.jsx)(Ii,{className:`text-xs text-soft-foreground`,children:`New tasks start from`}),(0,X.jsxs)(Wi,{value:t.baseBranch??``,onValueChange:e=>o.setBase.mutate(e===``?null:e),children:[(0,X.jsx)(Li,{value:``,"data-branch":``,className:`text-[12.5px]`,children:`The checked-out branch (default)`}),t.branches.map(e=>(0,X.jsx)(Li,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,X.jsx)(`span`,{className:`truncate`,children:e})},e))]})]})]}),l>0?(0,X.jsxs)(G,{to:Og.changes,"data-slot":`git-uncommitted`,onClick:i,className:c(`flex min-w-0 items-center border-t border-border text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,a.dirty),children:[(0,X.jsx)(Mr,{"aria-hidden":`true`,className:`shrink-0 text-inbox-count-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[l,` uncommitted file`,l===1?``:`s`]}),(0,X.jsx)(Br,{"aria-hidden":`true`,className:`shrink-0 text-soft-foreground`})]}):null,(0,X.jsx)(Wg,{checkout:o,returnFocus:f})]})}function Ug({tracking:e,className:t}){let n=e.ref.split(`/`)[0]||e.ref,r=zg(e);return(0,X.jsx)(`p`,{"data-slot":`git-freshness`,className:c(`flex min-w-0 items-center gap-[4px] text-soft-foreground`,t),children:e.behind>0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{"data-slot":`git-behind`,className:`shrink-0 font-medium text-inbox-count-foreground`,children:[e.behind,` behind `,n]}),(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,r]})]}):(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`up to date · `,r]})})}function Wg({checkout:e,returnFocus:t}){return(0,X.jsx)(_g,{open:e.confirmation!==null,onOpenChange:t=>!t&&e.dismissConfirmation(),children:(0,X.jsxs)(bg,{onCloseAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,X.jsxs)(xg,{children:[(0,X.jsxs)(Cg,{children:[`Pull `,e.confirmation?.branch,` anyway?`]}),(0,X.jsx)(wg,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[e.confirmation?.risks.includes(`active_runs`)?(0,X.jsx)(`p`,{children:`An active session is using this repository. Pulling can change files while it works.`}):null,e.confirmation?.risks.includes(`dirty_tree`)?(0,X.jsx)(`p`,{children:`The checkout has dirty files. Git may refuse the pull to protect them.`}):null]})})]}),(0,X.jsxs)(Sg,{children:[(0,X.jsx)(Eg,{className:`h-11`,disabled:e.pulling,children:`Cancel`}),(0,X.jsx)(Tg,{className:`h-11`,disabled:e.pulling||e.confirmation===null,onClick:t=>{t.preventDefault(),e.pull(!0)},children:e.pulling?`Pulling…`:`Pull anyway`})]})]})})}var Gg={main:Er,"not-landed":bs,cleanup:is,branches:Zn};function Kg(e,t){switch(e){case`main`:return t?`Recently on ${t}`:`Recent commits`;case`not-landed`:return`Not landed`;case`cleanup`:return`Cleanup`;case`branches`:return`All branches`;case`changes`:return`Uncommitted changes`}}var qg=[`main`,`not-landed`,`cleanup`,`branches`];function Jg({branch:e,counts:t,variant:n,active:r,onNavigate:i}){let a=n===`screen`;return(0,X.jsx)(`nav`,{"aria-label":`Git sections`,"data-slot":`git-sections`,className:a?Qr:Zr,children:qg.map(n=>{let o=Gg[n],s=!a&&r===n,l=t[n];return(0,X.jsxs)(G,{to:a&&n===`main`?kg:Og[n],"data-git-section":n,"aria-current":s?`page`:void 0,onClick:i,className:c(a?$r:c(ri,`text-[12.5px]`),ni,s&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:[(0,X.jsx)(o,{"aria-hidden":`true`,className:a?li:ai}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:Kg(n,e)}),l?(0,X.jsx)(`span`,{"data-slot":`git-section-count`,className:a?ii:ei,children:l}):null,a?(0,X.jsx)(Br,{"aria-hidden":`true`,className:ci}):null]},n)})})}async function Yg(e,t){return ke(await Te.api.v1.p[`:projectId`].repo.branches.counts.$get({param:{projectId:t??a()}},Pe(e)),`/repo/branches/counts`)}function Xg(e){return pn({queryKey:[e,`repo`,`branches`,`counts`],queryFn:({signal:t})=>Yg({signal:t},e)})}function Zg(e,t,n){let r=yt(e),i=Xg(e),a=r.data?.totalBytes??null,o=i.data?.counts??null,s=t&&n===`screen`?Lg(t.log):0;return{main:s>0?`${s} today`:null,"not-landed":o?.notLanded?String(o.notLanded):null,cleanup:a?Rn(a):r.data&&a===null&&o?.cleanup?String(o.cleanup):null,branches:t?String(i.data?.allBranches??t.branches.length):null}}function Qg({scope:e}){let t=ht(e),{pathname:n}=gn(),r=Bs(),i=t.data?.info?t.data:null,a=Zg(e,i,`sidebar`);return(0,X.jsxs)(`div`,{"data-slot":`git-sidebar`,role:`region`,"aria-label":`Git`,className:ui,children:[i?.info?(0,X.jsx)(Hg,{scope:e,repo:i,info:i.info,variant:`sidebar`,onNavigate:r},e):t.isPending?(0,X.jsx)(`div`,{"data-slot":`git-checkout-placeholder`,"aria-hidden":`true`,className:`h-[94px] rounded-[8px] border border-border`}):null,t.isPending?null:(0,X.jsx)(Jg,{branch:i?.info?.branch??null,counts:a,variant:`sidebar`,active:Dg(n),onNavigate:r})]})}var $g=[`assigned`,`no-task`,`has-task`,`all`],e_=[`review`,`mine`,`failing`,`all`],t_=50,n_=`is:open review-requested:@me`,r_=`is:open status:failure`;function i_(e,t){return e===`prs`&&(t===`review`||t===`failing`)}function a_(e){return e===`review`?n_:e===`failing`?r_:null}function o_(e,t){return t===null?null:(e===`issues`?$g:e_).includes(t)?t:`all`}function s_(e,t,n,r=``){let i=`${n===void 0?e===`issues`?`/github`:`/github/prs`:`${e===`issues`?`/github/issues`:`/github/prs`}/${n}`}${r}`;return t===null?i:`${i}?filter=${encodeURIComponent(t)}`}function c_(e,t){let n=t??`all`;return n===`all`?e===`issues`?`all`:`all-prs`:n}function l_(e){return e===`all`?{view:`issues`,filter:`all`}:e===`all-prs`?{view:`prs`,filter:`all`}:{view:e===`review`||e===`mine`||e===`failing`?`prs`:`issues`,filter:e}}var u_=[{id:`assigned`,label:`Assigned to me`},{id:`no-task`,label:`No task yet`},{id:`has-task`,label:`Has a task`},{id:`all`,label:`All open`}],d_=[{id:`review`,label:`Review requested`},{id:`mine`,label:`Mine`},{id:`failing`,label:`Checks failing`},{id:`all-prs`,label:`All open`}],f_=Object.fromEntries([...u_,...d_].map(e=>[e.id,e.label]));function p_(e){return e===null?``:`${e.value}${e.bound===`atLeast`?`+`:``}`}function m_(e,t){if(t?.bound===`atLeast`)return e===`review`||e===`failing`?`At least ${t.value}: GitHub search returns at most ${t_} results.`:`At least ${t.value}: only the loaded pages are counted. Scroll to load more.`}var h_=(e,t)=>e!==void 0&&t!==void 0&&e.toLowerCase()===t.toLowerCase();function g_(e){try{let t=new URL(e).pathname.split(`/`).filter(Boolean);return t.length>=2?`${t[0]}/${t[1]}`.toLowerCase():null}catch{return null}}function __(e,t,n){return new Set(e.filter(e=>!e.archived).flatMap(e=>v_(e,t,n)))}function v_(e,t,n){let r=t?.toLowerCase();return In(e,void 0,n).filter(e=>e.kind===`Issue`&&(!e.url||r!==void 0&&g_(e.url)===r)).map(e=>e.number)}function y_(e,t,n,r){let i=new Map;for(let a of e)!Ya(a)&&v_(a,n,r).includes(t)&&i.set(a.id,a);return[...i.values()].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt)||e.id.localeCompare(t.id))}function b_(e,t){let n=new Map(t.map(e=>[e.number,e]));return e.map(e=>n.get(e.number)??e)}function x_(e){return e?.available?{value:e.items.length,bound:e.truncated?`atLeast`:`exact`}:null}function S_({gh:e,tasks:t,review:n,failing:r}){let i={assigned:null,"no-task":null,"has-task":null,all:null,review:x_(n),mine:null,failing:x_(r),"all-prs":null};if(!e?.available)return i;let a=!Pt(e,`issues`),o=!Pt(e,`prs`),s=(e,t)=>({value:e,bound:t?`atLeast`:`exact`}),c=t?e.issues.filter(e=>t.has(e.number)).length:null;return{...i,all:s(e.issuesTotal??e.issues.length,!1),"all-prs":s(e.prsTotal??e.prs.length,!1),assigned:e.viewerLogin?s(e.issues.filter(t=>t.assignees?.some(t=>h_(t,e.viewerLogin))).length,a):null,mine:e.viewerLogin?s(e.prs.filter(t=>h_(t.author,e.viewerLogin)).length,o):null,"has-task":c===null?null:s(c,a),"no-task":c===null?null:s(e.issues.length-c,a)}}var C_={assigned:vr,"no-task":di,"has-task":Lr,all:Nr,review:hi,mine:nr,failing:Sr,"all-prs":Nr};function w_(e,t){return e===`assigned`||e===`mine`?t.identity:e===`no-task`||e===`has-task`?t.tasks:null}function T_({model:e,variant:t,activeId:n,onNavigate:r}){let i=t===`screen`;return(0,X.jsx)(X.Fragment,{children:[{key:`issues`,label:`Issues`,rows:u_},{key:`prs`,label:`Pull requests`,rows:d_}].map(t=>(0,X.jsxs)(`nav`,{"aria-label":t.label,"data-slot":`github-filter-group`,"data-group":t.key,className:i?Qr:c(ti,t.key===`prs`&&`pt-[6px]`),children:[(0,X.jsx)(`h3`,{className:i?oi:si,children:t.label}),t.rows.map(({id:t,label:a})=>{let o=C_[t],s=n===t,l=w_(t,e.blocked),u=e.counts[t],d=p_(u),f=c(i?$r:c(ri,`text-[12.5px]`),l?`cursor-not-allowed opacity-60`:ni,s&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),p=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{"aria-hidden":`true`,className:i?li:ai}),(0,X.jsx)(`span`,{className:`truncate`,children:a}),d?(0,X.jsx)(`span`,{"data-slot":`gh-filter-count`,title:m_(t,u),className:i?ii:ei,children:d}):null,i?(0,X.jsx)(Br,{"aria-hidden":`true`,className:c(ci,!d&&`ml-auto`)}):null]});if(l)return(0,X.jsxs)(`div`,{"data-gh-filter":t,"aria-disabled":`true`,title:l,className:f,children:[p,(0,X.jsx)(`span`,{className:`sr-only`,children:l})]},t);let{view:m,filter:h}=l_(t);return(0,X.jsx)(G,{to:s_(m,h),"data-gh-filter":t,"aria-current":s?`page`:void 0,onClick:r,className:f,children:p},t)})]},t.key))})}function E_(e){let t=lt(e,50).data,n=t?.available===!0,r=sn(e,!0,e==="default"),i=jt(e,`pr`,n_,n),a=jt(e,`pr`,r_,n),o=(0,Y.useMemo)(()=>r.data?__(r.data,t?.repo,e):null,[r.data,t?.repo,e]);return{gh:t,counts:(0,Y.useMemo)(()=>S_({gh:t,tasks:o,review:i.data,failing:a.data}),[t,o,i.data,a.data]),blocked:{identity:t?.available===!0&&!t.viewerLogin?`GitHub login unavailable.`:null,tasks:r.isError&&!r.data?`Task list unavailable.`:null}}}function D_(e){return/^\/github\/prs(?:\/|$)/.test(Aa(e))?`prs`:`issues`}function O_({scope:e}){let t=E_(e),{pathname:n}=gn(),[r]=_n(),i=Bs(),a=D_(n);return(0,X.jsx)(`div`,{"data-slot":`github-sidebar`,role:`region`,"aria-label":`GitHub`,className:ui,children:(0,X.jsx)(T_,{model:t,variant:`sidebar`,activeId:c_(a,o_(a,r.get(`filter`))),onNavigate:i})})}var k_=(0,Y.lazy)(()=>R(()=>import(`./accounts-section-xFYT_zfY.js`).then(e=>({default:e.GlobalAgentsSection})),__vite__mapDeps([5,1,2,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]))),A_=(0,Y.lazy)(()=>R(()=>import(`./agent-config-section-B8yx4Ftt.js`).then(e=>({default:e.AgentConfigSection})),__vite__mapDeps([35,1,2,7,8,6,9,10,11,12,13,14,15,23,24,25,33,36,17,37,38]))),j_=(0,Y.lazy)(()=>R(()=>import(`./agent-defaults-section-BUJi0JBr.js`).then(e=>({default:e.AgentDefaultsSection})),__vite__mapDeps([39,1,2,6,7,8,9,10,11,12,13,14,15,18,23,24,40,28,41,30,31,19,33,42,34,26,27,29]))),M_=(0,Y.lazy)(()=>R(()=>import(`./appearance-L-Mcz7xt.js`).then(e=>({default:e.AppearanceSection})),__vite__mapDeps([43,2,1,7,8,10,11,6,9,12,13,14,15,19,44,23,24]))),N_=(0,Y.lazy)(()=>R(()=>import(`./notifications-section-CRVfC723.js`).then(e=>({default:e.NotificationsSection})),__vite__mapDeps([45,1,2,6,7,8,9,10,11,12,13,14,15,40,24,28,41]))),P_=(0,Y.lazy)(()=>R(()=>import(`./projects-section-BzJOvGbU.js`).then(e=>e.r).then(e=>({default:e.ProjectsSection})),__vite__mapDeps([46,1,2,7,8,6,9,10,11,12,13,14,15,16,17,18,23,24,47,28,29,48,41,33,49]))),F_=(0,Y.lazy)(()=>R(()=>import(`./prompt-templates-section-DCXEFZeZ.js`).then(e=>({default:e.PromptTemplatesSection})),__vite__mapDeps([50,1,2,7,8,6,9,10,11,12,13,14,15,18,23,24,47,28,29,48,41,51,27,26,52,33,42]))),I_=(0,Y.lazy)(()=>R(()=>import(`./resources-section-21R3ObSS.js`).then(e=>({default:e.ResourcesSection})),__vite__mapDeps([53,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,23,24,40,28,41,33,49]))),L_=(0,Y.lazy)(()=>R(()=>import(`./sidebar-section-D7e8bdCc.js`).then(e=>({default:e.SidebarSection})),__vite__mapDeps([54,1,2,7,8,6,9,10,11,12,13,14,15,23,24]))),R_=(0,Y.lazy)(()=>R(()=>import(`./worktrees-section-DmsaW6FZ.js`).then(e=>({default:e.WorktreesSection})),__vite__mapDeps([55,1,2,6,7,8,9,10,11,12,13,14,15,18,23,24,56,16,17,33,38,49,57,58,19,31,59,22,60,61,62,28,29,48,41,37]))),z_=(0,Y.lazy)(()=>R(()=>import(`./archive-on-merge-field-BJoirmK5.js`).then(e=>({default:e.TasksSection})),__vite__mapDeps([63,1,2,6,7,8,9,10,11,12,13,14,15]))),B_=[{id:`sidebar`,title:`Sidebar`,description:`Overall and per-section task limits for this project.`,icon:Dr,component:L_,scope:`project`},{id:`agent-defaults`,title:`Agent defaults`,description:`Default runner, models and system prompt.`,icon:Lr,component:j_,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:gs,component:A_,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:vs,component:R_,scope:`project`},{id:`prompt-templates`,title:`Prompt templates`,description:`Reusable snippets for follow-up instructions.`,icon:_s,component:F_,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, accent and density.`,icon:rr,component:M_,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:jr,component:N_,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:Dr,component:I_,scope:`global`},{id:`tasks`,title:`Tasks`,description:`Automatic task archiving after pull requests merge.`,icon:vs,component:z_,scope:`global`},{id:`agents`,title:`Agents`,description:`Install, version and sign-in for each agent, and the agent and models a project uses when it has chosen none.`,icon:ur,component:k_,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:cr,component:P_,scope:`global`}];function V_(e){return B_.filter(t=>t.scope===e)}function H_(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}var U_=H_(`global`,`appearance`);function W_({projectId:e,projectName:t}){return(0,X.jsx)(`div`,{"data-slot":`settings-sidebar`,className:ui,children:[`project`,`global`].map(n=>{let r=n===`project`?`This project${t?` · ${t}`:``}`:`Global · every project`,i=n===`project`?`/p/${encodeURIComponent(e)}/settings`:`/settings/global`,a=V_(n).map(e=>({id:e.id,title:e.title,icon:e.icon,to:`${i}/${e.id}`})),o=n===`project`?[{id:`general`,title:`General`,icon:lr,to:i},...a]:a;return(0,X.jsxs)(`nav`,{"aria-label":r,"data-slot":`settings-nav`,"data-scope":n,className:c(`flex flex-col gap-px`,n===`global`&&`pt-[6px]`),children:[(0,X.jsx)(`h3`,{title:r,className:si,children:r}),o.map(({id:e,title:t,icon:n,to:r})=>(0,X.jsxs)(Cn,{to:r,end:!0,"data-section":e,className:({isActive:e})=>c(ri,ni,e&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:[(0,X.jsx)(n,{"aria-hidden":`true`,className:ai}),(0,X.jsx)(`span`,{className:`truncate`,children:t})]},e))]},n)})})}var G_=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/tasks`,pageLabel:`All tasks`},{pattern:`/tools`,pageLabel:`Workspace tools`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/activity`,pageLabel:`Activity`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/automations/*`,pageLabel:`Automations`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/reports`,pageLabel:`Reports`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function K_(e){let t=Aa(e),n=bn({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:G_.find(({pattern:e})=>bn({path:e,end:!0},t))?.pageLabel??null,taskId:null}}function q_(e){let t=e?.repo;if(!t)return null;let n=t.root.replace(/[\\/]+$/,``).split(/[\\/]/).pop();return n?{name:n,branch:t.branch}:null}var J_=e=>Qa(e).waiting>0;function Y_(e,t,n){let r=t?.bootProject??n?.bootProject??null,i=e??r??`default`;return{bootProjectId:r,sidebarProjectId:i,sidebarBoot:i===r,isBootProject:e!==null&&e===r,activeProject:t?.projects.find(t=>t.id===e)}}function X_(e,t,n,r,i,a){let o=e===`/tools`||e===`/settings/global`||e.startsWith(`/settings/global/`);return{globalSettings:o,projectName:o?null:t?.name??(n?q_(r)?.name??null:null),titleRun:a,pageLabel:a?K(a):i.pageLabel}}function Z_(e,t){return e?e.forge===`github`:t?.forge?.available===!0}function Q_(e,t,n,r,i,a){return/^\/settings(?:\/|$)/.test(e)?(0,X.jsx)(W_,{projectId:n,projectName:i?.projects.find(e=>e.id===n)?.name??(r?q_(a)?.name??null:null)}):/^\/github(?:\/|$)/.test(e)&&t?(0,X.jsx)(O_,{scope:Zt({projectId:n,boot:r}).cacheScope}):/^\/git(?:\/|$)/.test(e)?(0,X.jsx)(Qg,{scope:Zt({projectId:n,boot:r}).cacheScope}):void 0}function $_(e,t,n,r,i){return e===`/tools`?q_(i):t?null:n?{name:n.name,branch:n.id===r?i?.repo?.branch??``:``}:q_(i)}function ev(e,t,n,r){return{project:e===`/tools`?`Workspace`:t,page:n?`Tasks / ${r}`:r??`Squawk`,branch:n?.worktreePath?`Isolated worktree`:void 0}}function tv(e,t,n,r){return e?(0,X.jsx)(nm,{...e,projectTarget:t.target,onSwitchProject:e=>void t.go(e),version:r}):n?(0,X.jsx)(Xp,{}):null}function nv({children:e}){let{pathname:t}=gn(),n=Ma(),r=St(),i=At(),a=(0,Y.useRef)(void 0);(0,Y.useEffect)(()=>{r.data&&(a.current=r.data)},[r.data]);let o=r.data??a.current,s=Df(o),c=tn(),l=c.data,u=rm(),d=Ef(),f=K_(t),{bootProjectId:p,sidebarProjectId:m,sidebarBoot:h,isBootProject:g,activeProject:_}=Y_(n,l,r.data),v=sn(m,!0,h,J_).data??!1,y=(0,Y.useCallback)(e=>{let t=e.find(e=>e.id===f.taskId);return t?{title:t.title,titleSummary:t.titleSummary,titleOrigin:t.titleOrigin,worktreePath:t.worktreePath}:void 0},[f.taskId]),b=sn(n??``,_!==void 0&&f.taskId!==null,l?.bootProject===n,y).data,{globalSettings:x,projectName:S,titleRun:C,pageLabel:w}=X_(t,_,g,r.data,f,b);gg({projectName:S,pageLabel:w});let T=Z_(_,r.data),E=Q_(Aa(t),T,m,h,l,r.data),D=o?.version??null;return(0,X.jsxs)(np,{children:[(0,X.jsx)(Cd,{repo:$_(t,x,_,p,r.data),breadcrumb:ev(t,S,C,w),version:D,latestVersion:o?.latestVersion??null,forgeAvailable:T,automationsAvailable:s,banner:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Fp,{}),(0,X.jsx)(vp,{}),(0,X.jsx)(mp,{})]}),sidebarList:E,taskQuickList:(0,X.jsx)(tg,{projectId:m,boot:h}),sidebarProjectId:m,projectHeader:(0,X.jsx)(Wl,{}),mobileProjects:u,needsYou:v,toolsMenu:(0,X.jsx)(dg,{health:r.data,runners:i.data}),toolsStatus:r.data?{blocked:cg(r.data,i.data)!==null,note:ug(r.data)}:null,projectRail:tv(u,d,c.isPending,D),children:e}),(0,X.jsx)(Kf,{})]})}var rv=`cez-accent`,iv=`cez-density`,av=`cez-width`,ov=`cezarion`,sv=`comfortable`,cv=`narrow`;function lv(e){return ov}function uv(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:sv}function dv(e){return e===`narrow`||e===`wide`?e:cv}function fv(e){let t=e&&typeof e==`object`?e:{};return{accent:lv(t.accent),density:uv(t.density),width:dv(t.width)}}function pv(){try{return{accent:lv(localStorage.getItem(rv)),density:uv(localStorage.getItem(iv)),width:dv(localStorage.getItem(av))}}catch{return{accent:ov,density:sv,width:cv}}}function mv(e){try{localStorage.setItem(rv,e.accent),localStorage.setItem(iv,e.density),localStorage.setItem(av,e.width)}catch{}}function hv(e,t){t.accent===`cezarion`?delete e.dataset.accent:e.dataset.accent=t.accent,t.density===`comfortable`?delete e.dataset.density:e.dataset.density=t.density,t.width===`narrow`?delete e.dataset.width:e.dataset.width=t.width}var gv=Y.createContext(null);function _v({children:e}){let t=F(),n=Jt(),[r,i]=Y.useState(pv),a=n.data;Y.useEffect(()=>{if(a===void 0)return;let e=fv(a.appearance);i(e),mv(e)},[a]),Y.useLayoutEffect(()=>{hv(document.documentElement,r)},[r]);let o=Y.useCallback(e=>{i(e),mv(e),_e({appearance:e}).then(e=>t.setQueryData(L.uiState,e)).catch(e=>{V(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:L.uiState})})},[t]),s=Y.useCallback(e=>o({...r,accent:e}),[o,r]),c=Y.useCallback(e=>o({...r,density:e}),[o,r]),l=Y.useCallback(e=>o({...r,width:e}),[o,r]),u=Y.useMemo(()=>({accent:r.accent,density:r.density,width:r.width,setAccent:s,setDensity:c,setWidth:l}),[r,s,c,l]);return(0,X.jsx)(gv.Provider,{value:u,children:e})}function vv(){let e=Y.useContext(gv);if(!e)throw Error(`Squawk: useAppearance() must be called inside <AppearanceProvider>`);return e}function yv(){let e=gn(),t=tn();return Tf(),(0,Y.useEffect)(()=>{let n=Xd(e,t.data);n!==null&&(Qd(Vd(),n)||Hd(n),Qd(tf(n.projectId),n)||nf(n))},[e.hash,e.pathname,e.search,t.data]),null}function bv(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function xv(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function Sv(e,t){let n=new Map,r=[];for(let i of t??[]){let t={status:i.status,wantsAttention:Na(i)};n.set(i.id,t);let a=e.get(i.id);a!==void 0&&(a.status===t.status&&a.wantsAttention===t.wantsAttention||t.wantsAttention&&r.push(i))}return{entering:r,statuses:n}}function Cv(e){return e.enabled&&e.hidden&&e.permission===`granted`}function wv(e){let t=Ne(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`}}function Tv(){let e=F(),t=bv(Jt().data?.notifications).enabled,n=(0,Y.useRef)(t);return n.current=t,(0,Y.useEffect)(()=>{let t=e.getQueryCache(),r=new Map,i=new Map,a=new Map,o=new Set,s=new Map,c=0,l=e=>e.length===3&&typeof e[0]==`string`&&e[1]===`runs`&&e[2]===`list`,u=()=>{let e=new Set([...r.values()].flatMap(e=>[...e.keys()]));for(let t of i.keys())e.has(t)||(i.delete(t),a.delete(t),o.delete(t))},d=(e,t,s=!1,l=1/0)=>{let d=r.get(e),{statuses:f}=Sv(new Map,t),p=t.filter(e=>{if((a.get(e.id)??0)>l)return!1;let t=d?.get(e.id),n=f.get(e.id),r=l===1/0?t:i.get(e.id);return t!==void 0&&r!==void 0&&(r.status!==n.status||r.wantsAttention!==n.wantsAttention)}),{entering:m,statuses:h}=Sv(i,p);for(let[e,t]of f)!d?.has(e)&&!o.has(e)&&(a.get(e)??0)<=l&&(i.set(e,t),a.set(e,++c));for(let[e,t]of h){let n=i.get(e);n?.status===t.status&&n.wantsAttention===t.wantsAttention||(i.set(e,t),a.set(e,++c),o.add(e))}if(r.set(e,f),u(),!s&&m.length!==0&&Cv({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:xv()}))for(let e of m)Ev(e)};for(let e of t.getAll().sort((e,t)=>e.state.dataUpdatedAt-t.state.dataUpdatedAt))l(e.queryKey)&&Array.isArray(e.state.data)&&d(e.queryHash,e.state.data,!0);return t.subscribe(e=>{if(l(e.query.queryKey)){if(e.type===`removed`)r.delete(e.query.queryHash),s.delete(e.query.queryHash),u();else if(e.type===`updated`&&(e.action.type===`fetch`&&s.set(e.query.queryHash,c),e.action.type===`success`&&Array.isArray(e.query.state.data))){let t=e.action.manual?1/0:s.get(e.query.queryHash)??0;d(e.query.queryHash,e.query.state.data,!1,t),e.action.manual||s.delete(e.query.queryHash)}}})},[e]),null}function Ev(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=wv(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}function Dv(){return(0,X.jsxs)(`div`,{"data-route":`activity`,"aria-busy":`true`,className:`min-h-full w-full px-[18px] py-6 md:px-7`,children:[(0,X.jsx)(`h1`,{className:`text-[18px] font-semibold`,children:`Activity`}),(0,X.jsx)(`p`,{"data-slot":`activity-loading`,role:`status`,className:`mt-4 text-xs text-muted-foreground`,children:`Loading activity…`})]})}function Ov(){return(0,X.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(ko,{icon:(0,X.jsx)(gi,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}function kv({skill:e,emphasized:t}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:c(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,X.jsx)(`span`,{title:e.description,className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,e.path?(0,X.jsx)(`span`,{title:e.path,className:`min-w-0 truncate text-xs text-soft-foreground`,children:e.path}):null]})}var Av=80,jv=2e3,Mv=50,Nv=200,Pv=50,Fv=[{id:`add-tests`,label:`Add tests`,text:`Also add or update tests covering this change.`},{id:`explain-change`,label:`Explain the change`,text:`Explain what changed and why before finishing.`},{id:`keep-minimal`,label:`Keep it minimal`,text:`Keep the change as small and targeted as possible — no unrelated refactors.`},{id:`update-docs`,label:`Update docs`,text:`Also update any relevant documentation or comments.`},{id:`check-edge-cases`,label:`Double-check edge cases`,text:`Double-check edge cases and error handling before finishing.`}];function Iv(e){return!!e&&typeof e==`object`}function Lv(e){if(e===void 0||!Array.isArray(e))return Fv.map(e=>({...e}));let t=new Set,n=[];for(let r of e){if(!Iv(r))continue;let e=typeof r.id==`string`?r.id.trim():``;if(e===`create-automation`)continue;let i=typeof r.label==`string`?r.label.trim():``,a=typeof r.text==`string`?r.text.trim():``;if(!e||!i||!a||t.has(e))continue;t.add(e);let o=Rv(r.skills);if(n.push({id:e,label:i.slice(0,Av),text:a.slice(0,jv),...o.length>0?{skills:o}:{}}),n.length>=Mv)break}return n}function Rv(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(!e||t.has(e))&&(t.add(e.slice(0,Nv)),t.size>=Pv))break}return[...t]}function zv(e,t){if(t.length===0)return[];let n=new Set(t);return e.filter(e=>e.skills?.some(e=>n.has(e)))}function Bv(e,t){return zv(e,t).map(e=>e.text).join(`
6
6
 
7
7
  `)}function Vv(e,t,n,r=``){if(e===``||e===r||e===t){let e=r&&n?`${r}\n\n${n}`:r||n;return{text:e,applied:n?e:``}}return{text:e,applied:t}}function Hv(){return`tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function Uv(e,t,n){let r=Math.max(0,Math.min(t,e.length)),i=e.slice(0,r),a=e.slice(r),o=``;i.length>0&&(o=i.endsWith(`
8
8
 
@@ -17,5 +17,5 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r,t as i}from
17
17
  `:`
18
18
 
19
19
  `),{text:i+o+n+c+s,caret:i.length+o.length+n.length}}function Wv({prompt:e,base:t,selectionStart:n,focused:r,remembered:i}){return e===t?e.length:r&&n!=null||n!=null&&n>0?n:i??e.length}var Gv=`(hover: none) and (pointer: coarse)`;function Kv(){return typeof globalThis.matchMedia==`function`&&globalThis.matchMedia(Gv).matches}function qv(e){return e.key!==`Enter`||e.shiftKey||e.altKey||e.repeat||e.isComposing?!1:e.metaKey||e.ctrlKey?!0:!Kv()}function Jv(e=typeof navigator>`u`?``:navigator.platform){return/mac|iphone|ipad|ipod/i.test(e)?`⌘↵`:`Ctrl+↵`}var Yv={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,bmp:`image/bmp`,avif:`image/avif`,md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,log:`text/plain`,pdf:`application/pdf`};function Xv(e){return be(e.type)?e.type:Ta(Yv,e.name.split(`.`).pop()?.toLowerCase()??``)??null}async function Zv(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));let r=btoa(n),i=Xv(e)??`application/octet-stream`,a=We(i);return{mediaType:i,data:r,...a?{preview:`data:${i};base64,${r}`}:{},name:e.name||(a?`pasted image`:`pasted.${Me(i)}`),isImage:a}}function Qv(e,t){let n=[],r=[],i=t;for(let t of e){let e=t.name||`attachment`;if(Xv(t)===null){r.push(`${e} is not a supported attachment (images, PDF and plain-text files such as TXT or MD)`);continue}if(t.size>5242880){r.push(`${e} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${e} skipped — max 4 attachments per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}var $v=new Set([`/`,`@`]);function ey(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if($v.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function ty(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function ny(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function ry(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}function iy(e,t){switch(e){case`aborted`:return null;case`network`:case`service-not-allowed`:return{message:`Dictation couldn't reach this browser's speech service. Some Chromium builds, such as Helium, block it. Use your system dictation instead (macOS: press Fn/Globe twice), or open the cockpit in Chrome or Safari.`,retryable:e===`network`};case`not-allowed`:return{message:`Microphone access is blocked. Allow it in this site's browser settings, then try again.`,retryable:!0};case`audio-capture`:return{message:`No microphone was found. Connect one, then try again.`,retryable:!0};case`language-not-supported`:return{message:`This browser can't recognize speech in ${t}. Use your system dictation instead (macOS: press Fn/Globe twice).`,retryable:!1};case`no-speech`:return{message:`No speech was heard. Check the microphone, then try again.`,retryable:!0};default:return{message:`Dictation failed${e?` — ${e}`:``}`,retryable:!0}}}function ay(e){let[t,n]=Y.useState(null),r=Y.useRef(null),i=Y.useRef(``),a=Y.useRef(!1),o=Y.useRef(()=>{}),[s]=Y.useState(()=>ny()!==void 0),c=Y.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);Y.useEffect(()=>(a.current=!0,()=>{a.current=!1,c()}),[c]);let l=Y.useCallback(()=>o.current(),[]),u=Y.useCallback(()=>{if(!a.current||r.current)return;let t=ny();if(!t)return;let o;try{o=new t,o.lang=navigator.language||`en-US`,o.continuous=!0,o.interimResults=!0;let a=Date.now();o.onresult=e=>{let t=ry(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:a})},o.onerror=t=>{console.warn(`[dictation] recognition error`,t.error,t.message);let n=iy(t.error,o.lang);c(),n&&e(n.message,n.retryable?l:void 0)},o.start(),r.current=o,n({transcript:``,startedAt:a})}catch{e(`Dictation failed — the microphone could not be started`,l),c()}},[e,l,c]);return o.current=u,{supported:s,recording:t,start:u,cancel:Y.useCallback(()=>c(),[c]),finish:Y.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function oy(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}function sy(e,t){return e.trim()!==``||t>0}function cy(e,t,n,r){return!e&&(t!==void 0&&n||r)}function ly(e,t,n){return!e&&!t&&n!==void 0}function uy(e,t,n,r){return e||t||!n&&r!==void 0}function dy(e,t,n){return!e&&t?t:n}function fy(e,t,n){return e||t&&n}function py(e,t,n){return e||t&&n}function my(e,t,n,r,i,a){return e||t||n||i.trim()===``&&a===0&&!r}function hy(e,t){return e&&!t}function gy(e){return e??`default`}function _y(e,t){return e.get(t)??!1}function vy(e){return e instanceof Error?e.message:String(e)}function yy(e,t){return e===``?t:`${t}\n${e}`}function by(e){return`${e||`Attachment`} could not be read — try attaching it again`}function xy(e){return[...e??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null)}function Sy(e){return[...e??[]]}function Cy(e,t){return e.trim()===``?t:`${e.replace(/\s*$/,``)} ${t}`}function wy(e,t,n,r,i){return e||t||n&&(r||i)}function Ty(e,t,n){return!e||t||n}function Ey(e,t,n){return(e+t+n)%n}function Dy(e,t){return e??t}function Oy(){return typeof CSS<`u`&&CSS.supports(`field-sizing`,`content`)}function ky(e,t){return e!==t}function Ay(e){return e||void 0}function jy(e,t){return e&&!t||void 0}function My(e,t,n){return e?t??``:n}function Ny(e,t){return e?`${t}-submission`:void 0}function Py(e,t,n){return e?`${t} ${n}`:t}function Fy(e,t,n,r){return e||t||n!==null||r!=null}function Iy(e,t,n){return e||!!t||n}function Ly(e,t){return!!e||t}function Ry(e,t){return!e&&!t}function zy(e,t){return!!e||!!t}function By(e,t){return e===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:t?`Loading skills…`:`No matching skills.`}function Vy(e,t){return c(`shrink-0 truncate`,e&&`font-semibold`,t&&`font-mono text-xs`)}function Hy(e,t,n){return c(e&&`new-task-composer`,t&&`session-composer`,n&&`opacity-80`)}function Uy(e){return c(`rounded-xl border border-[var(--composer-border)] bg-card shadow-none transition-[border-color,box-shadow] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,e&&`new-task-editor`)}function Wy(e){return c(`group relative shrink-0 overflow-hidden rounded-md border border-border`,e?`size-12`:`flex h-12 min-w-11 max-w-[200px] items-center gap-1.5 bg-muted/40 px-2.5 text-xs text-muted-foreground`)}function Gy(e,t){return c(`block field-sizing-content min-h-11 w-full overflow-y-auto resize-none bg-transparent px-3 pbs-2.5 pbe-1 text-base leading-normal outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed md:min-h-[54px] md:px-4 md:pbs-3 md:text-sm`,e?`max-h-11 md:max-h-[220px]`:`max-h-[220px]`,t&&`md:text-base`)}function Ky(e,t){return e?`Task description`:t}function qy(e){return e?`hidden px-5 pbs-5 text-xs text-muted-foreground md:block`:`sr-only`}function Jy(e){return c(`ms-auto flex min-w-0 flex-wrap items-center justify-end gap-1 md:flex-nowrap`,e&&`new-task-submission`)}function Yy(e){return c(`min-w-0 flex-wrap items-center gap-1.5 md:flex-nowrap`,e.executionOptions&&`me-auto`,e.mobileCollapsible&&`max-md:[&_button]:min-h-11 max-md:[&_button]:min-w-11`,e.mobileCompact?`hidden md:flex`:`flex`)}function Xy(e,t){return c(e.executionOptions?`h-12 w-full gap-2 px-6`:e.sessionControls?`h-11 w-auto gap-2 px-5`:`size-11`,!e.hasContent&&t&&`w-auto px-3`,`active:opacity-80`)}function Zy(e,t){return c(`overflow-y-auto text-xs leading-5 text-muted-foreground`,e&&!t?`h-0`:`px-3 pbe-2 md:px-4`,e?t&&`min-h-6`:`h-24 md:h-20`)}function Qy(e){return c(`h-11 min-w-11 active:opacity-80`,e?`w-auto px-3`:`w-11`)}function $y(e){return c(`flex min-w-0 flex-wrap items-center gap-1`,e&&`w-full`)}function eb(e){return c(`transition-transform motion-reduce:transition-none`,!e&&`rotate-180`)}function tb(e){return c(`h-11 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground md:h-8`,e&&`hidden md:inline-flex`)}function nb(e){return e.disabled||e.busy||e.stopPending||!e.hasContent&&!e.allowEmptySubmit}function rb(e,t){return!e.sessionControls&&!e.hasContent&&!!t}function ib(e,t){return e.executionOptions||e.sessionControls||!e.hasContent&&!!t}function ab(e,t){return e.sessionControls||e.hasContent||!t}function ob(e){return e?`Finishing…`:`Finish`}function sb({mode:e,onStart:t}){return(0,X.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e.disabled||e.readOnly,"aria-label":`Start dictation`,title:`Dictation`,className:tb(e.mobileCompact),onClick:t,children:[(0,X.jsx)(fr,{"aria-hidden":`true`,className:`size-3.5`}),zy(e.executionOptions,e.sessionControls)?null:`Dictation`]})}function cb({mode:e,onFinish:t}){return(0,X.jsxs)(U,{type:`button`,"data-slot":`composer-finish`,"aria-label":e.finishLabel,"aria-busy":e.finishing||void 0,title:e.finishTitle,disabled:e.busy||e.stopPending||e.finishing,className:`h-11 w-auto gap-[7px] px-5 active:opacity-80`,onClick:t,children:[(0,X.jsx)(_r,{"aria-hidden":`true`}),e.finishLabel]})}function lb({mode:e,onStop:t}){return(0,X.jsxs)(U,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":e.stopPending?`Stopping…`:`Stop`,"aria-busy":e.stopPending||void 0,title:e.stopPending?`Waiting for execution to stop`:`Stop execution; keep existing work`,disabled:e.busy||e.stopPending,className:Qy(e.labelledStop),onClick:t,children:[(0,X.jsx)(Ar,{"aria-hidden":`true`,className:`size-3 fill-current`}),e.labelledStop?e.stopPending?`Stopping…`:`Stop`:null]})}function ub({shown:e,compactFeedback:t,hasCompactFeedback:n,textareaId:r,submissionError:i,stopPending:a,busy:o,pendingLabel:s,failureHint:c,idleFeedback:l}){return e?(0,X.jsx)(`div`,{className:Zy(t,n),children:(0,X.jsx)(`div`,{id:`${r}-submission`,role:i===null?`status`:`alert`,"aria-atomic":`true`,tabIndex:i===null?void 0:0,className:`break-words`,children:a?`Stopping execution. Your draft is kept.`:o?s:i===null?l??null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`font-medium text-foreground`,children:i}),(0,X.jsx)(`p`,{children:c})]})})}):null}function db({mode:e,emptySubmitLabel:t,optionsId:n,dictationButton:r,footerEnd:i,stopControl:a,secondaryAction:o,finishControl:s,onSubmit:c}){return(0,X.jsxs)(`div`,{"data-slot":`composer-submit-row`,className:Jy(e.executionOptions),children:[zy(e.executionOptions,e.sessionControls)?null:r,i?(0,X.jsx)(`div`,{id:n,"data-slot":`composer-footer-end`,className:Yy(e),children:(0,X.jsx)(`div`,{className:`contents`,inert:Ay(e.readOnly),children:i})}):null,(0,X.jsxs)(`div`,{className:`flex min-w-[100px] items-center justify-end gap-1`,"data-slot":`composer-actions`,children:[a??o,s,Ry(e.primaryStop,e.primaryFinish)?(0,X.jsxs)(U,{type:`button`,size:`icon-sm`,"aria-label":e.submitLabel,"aria-busy":jy(e.busy,e.stopPending),disabled:nb(e),className:Xy(e,t),onClick:c,children:[rb(e,t)?(0,X.jsx)(xi,{"aria-hidden":`true`}):null,ib(e,t)?e.submitLabel:null,ab(e,t)?(0,X.jsx)(wr,{"aria-hidden":`true`}):null]}):null]})]})}function fb({images:e,readOnly:t,onRemove:n}){return e.length===0?null:(0,X.jsx)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-nowrap items-center gap-2 overflow-x-auto px-4 pbs-3 md:flex-wrap md:overflow-visible`,children:e.map((e,r)=>(0,X.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:t?`Attachment submitted`:`Click to remove`,disabled:t,className:Wy(e.isImage),onClick:()=>n(r),children:[e.isImage?(0,X.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(or,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,X.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,X.jsx)(xr,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${r}`))})}function pb({menuListRef:e,trigger:t,activeValue:n,skillsPending:r,candidates:i,onValueChange:a,onPick:o}){return(0,X.jsx)(fo,{shouldFilter:!1,value:n??``,onValueChange:a,children:(0,X.jsx)(uo,{ref:e,"data-slot":`composer-menu`,"data-trigger":t,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:i.length===0?(0,X.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:By(t,r)}):i.map(e=>(0,X.jsxs)(co,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>o(e),children:[(0,X.jsx)(`span`,{className:Vy(e.emphasized,t===`@`),children:e.label}),e.description?(0,X.jsx)(`span`,{title:e.description,className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})}function mb({recording:e,insertionDisabled:t,onCancel:n,onInsert:r,onInsertAndSend:i,now:a}){return(0,X.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-bs border-border bg-muted/60 px-3 py-2`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,X.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:oy(e.startedAt,a)}),(0,X.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e.transcript===``?(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e.transcript}),(0,X.jsx)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-11 text-muted-foreground md:size-8`,onClick:n,children:(0,X.jsx)(xr,{"aria-hidden":`true`})}),(0,X.jsx)(U,{type:`button`,variant:`outline`,size:`icon-sm`,disabled:t,"aria-label":`Insert transcription`,className:`size-11 md:size-8`,onClick:r,children:(0,X.jsx)(_r,{"aria-hidden":`true`})}),(0,X.jsx)(U,{type:`button`,size:`icon-sm`,disabled:t,"aria-label":`Insert transcription and send`,className:`size-11 md:size-8`,onClick:i,children:(0,X.jsx)(wr,{"aria-hidden":`true`})})]})}function hb({mobileOpen:e,controls:t,onToggle:n}){return(0,X.jsx)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`size-11 md:hidden`,"aria-label":e?`Collapse composer`:`Expand composer`,"aria-expanded":e,"aria-controls":t,onClick:n,children:(0,X.jsx)(Or,{"aria-hidden":`true`,className:eb(e)})})}function gb(){return(0,X.jsxs)(`p`,{"data-slot":`composer-skill-hint`,className:`flex items-center gap-2 px-5 pbs-3 pbe-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(Tr,{"aria-hidden":`true`,className:`size-[15px] shrink-0`}),`Type / for a skill or workflow`]})}function _b({disabled:e,onFiles:t,inputRef:n}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,title:`Attach an image, PDF, TXT or MD file (or paste a screenshot)`,disabled:e,className:`size-11 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,X.jsx)(or,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,X.jsx)(`input`,{ref:n,type:`file`,accept:`image/*,application/pdf,text/plain,text/markdown,.pdf,.txt,.md,.markdown,.log`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function vb({mode:e,executionOptions:t,sessionControls:n,images:r,onRemoveImage:i,textareaId:a,textareaRef:o,text:s,disabled:c,retainDraftUntilSuccess:l,ariaLabel:u,disabledReason:d,placeholder:f,onTextChange:p,onKeyDown:m,onSelect:h,onPaste:g,recording:_,onCancelDictation:v,onInsertTranscript:y,onInsertAndSend:b,stopControl:x,mobileCollapsible:S,mobileOpen:C,optionsId:w,footerEnd:T,onToggleMobile:E,footerStart:D,attachInputRef:O,addFiles:k,dictationButton:A,submissionControls:j,feedback:M,agentOptions:ee}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{"data-slot":`composer-editor`,className:Uy(t),children:[(0,X.jsx)(fb,{images:r,readOnly:e.readOnly,onRemove:i}),(0,X.jsx)(`label`,{htmlFor:a,className:qy(t),children:Ky(t,u)}),(0,X.jsx)(`textarea`,{ref:o,id:a,autoComplete:`off`,rows:1,value:s,disabled:c,readOnly:e.readOnly,"aria-busy":e.readOnly||void 0,"aria-describedby":Ny(l,a),"aria-label":u,placeholder:My(c,d,f),className:Gy(e.mobileCompact,t),onChange:e=>p(e.target.value),onKeyDown:m,onSelect:h,onPaste:g}),t?(0,X.jsx)(gb,{}):null,n&&_?(0,X.jsx)(`div`,{"data-slot":`session-controls`,inert:Ay(e.readOnly),children:n}):null,_?(0,X.jsx)(yb,{recording:_,mode:e,onCancel:v,onInsert:y,onInsertAndSend:b,stopControl:x}):(0,X.jsx)(bb,{mode:e,sessionControls:n,executionOptions:t,mobileCollapsible:S,mobileOpen:C,optionsId:w,textareaId:a,footerEnd:T,onToggleMobile:E,footerStart:D,attachInputRef:O,addFiles:k,disabled:c,dictationButton:A,submissionControls:j}),t?null:M]}),t?(0,X.jsx)(xb,{mode:e,agentOptions:ee,executionOptions:t,submissionControls:j,feedback:M}):null]})}function yb({recording:e,mode:t,onCancel:n,onInsert:r,onInsertAndSend:i,stopControl:a}){let o=Nh(1e3);return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(mb,{recording:e,insertionDisabled:t.readOnly,onCancel:n,onInsert:r,onInsertAndSend:i,now:o}),a?(0,X.jsx)(`div`,{className:`flex justify-end px-2 pbe-2`,children:a}):null]})}function bb(e){return(0,X.jsxs)(`div`,{"data-slot":`composer-toolbar`,className:`flex flex-wrap items-center gap-1 gap-y-1 px-1.5 pbs-1 pbe-1.5 md:gap-y-1.5 md:px-2 md:pbs-1.5 md:pbe-2`,children:[e.sessionControls?(0,X.jsx)(`div`,{"data-slot":`session-controls`,inert:Ay(e.mode.readOnly),children:e.sessionControls}):null,(0,X.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:$y(e.executionOptions),children:[(0,X.jsx)(_b,{disabled:e.disabled||e.mode.readOnly,onFiles:e.addFiles,inputRef:e.attachInputRef}),e.mobileCollapsible?(0,X.jsx)(hb,{mobileOpen:e.mobileOpen,controls:Py(!!e.footerEnd,e.textareaId,e.optionsId),onToggle:e.onToggleMobile}):null,(0,X.jsx)(`div`,{className:`contents`,inert:Ay(e.mode.readOnly),children:e.footerStart}),zy(e.executionOptions,e.sessionControls)?(0,X.jsx)(`div`,{children:e.dictationButton}):null]}),e.executionOptions?null:e.submissionControls]})}function xb({mode:e,agentOptions:t,executionOptions:n,submissionControls:r,feedback:i}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{"data-slot":`composer-agent-options`,inert:Ay(e.readOnly),children:t}),(0,X.jsx)(`div`,{"data-slot":`composer-execution-panel`,inert:Ay(e.readOnly),children:n}),r,(0,X.jsx)(`div`,{"data-slot":`composer-feedback`,children:i})]})}function Sb({open:e,onClose:t,rootRef:n,disabled:r,onDrop:i,className:a,children:o,menu:s}){return(0,X.jsxs)(ga,{open:e,onOpenChange:e=>e?void 0:t(),children:[(0,X.jsx)(pa,{asChild:!0,children:(0,X.jsx)(`div`,{ref:n,"data-slot":`composer`,"data-disabled":r||void 0,onDrop:i,onDragOver:e=>e.preventDefault(),className:a,children:o})}),(0,X.jsx)(ha,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{n.current?.contains(e.target)&&e.preventDefault()},children:s})]})}var Cb=new Map,wb={KeyA:`Yes, approved.`,KeyC:`Continue.`},Z={retainDraftUntilSuccess:!1,finishing:!1,stopOnEmpty:!1,stopping:!1,compactFeedback:!1,pendingLabel:`Starting task…`,failureHint:`Could not confirm submission. Check Tasks before you retry. Your draft is kept.`,clearOnSuccess:!0,autoFocus:!1,mobileCollapsible:!1,sendAriaLabel:`Send`,disabled:!1,disabledReason:`Session closed — Continue to reopen.`,allowEmptySubmit:!1,placeholder:`Reply — / for skills, @ for files…`,ariaLabel:`Reply to the agent`,autocompleteSkills:!0,quickReplies:!1};function Q(e,t){return e===void 0?t:e}function Tb(e,t,n,r){return t>0||n||!r&&e.trim()!==``}function Eb(e){return{...e,retainDraftUntilSuccess:Q(e.retainDraftUntilSuccess,Z.retainDraftUntilSuccess),finishing:Q(e.finishing,Z.finishing),stopOnEmpty:Q(e.stopOnEmpty,Z.stopOnEmpty),stopping:Q(e.stopping,Z.stopping),compactFeedback:Q(e.compactFeedback,Z.compactFeedback),pendingLabel:Q(e.pendingLabel,Z.pendingLabel),failureHint:Q(e.failureHint,Z.failureHint),clearOnSuccess:Q(e.clearOnSuccess,Z.clearOnSuccess),autoFocus:Q(e.autoFocus,Z.autoFocus),mobileCollapsible:Q(e.mobileCollapsible,Z.mobileCollapsible),sendAriaLabel:Q(e.sendAriaLabel,Z.sendAriaLabel),disabled:Q(e.disabled,Z.disabled),disabledReason:Q(e.disabledReason,Z.disabledReason),allowEmptySubmit:Q(e.allowEmptySubmit,Z.allowEmptySubmit),placeholder:Q(e.placeholder,Z.placeholder),ariaLabel:Q(e.ariaLabel,Z.ariaLabel),autocompleteSkills:Q(e.autocompleteSkills,Z.autocompleteSkills),quickReplies:Q(e.quickReplies,Z.quickReplies)}}function Db(e,t,n,r){if(e===null)return[];if(e.trigger===`/`){let r=new Set;return xo(t,e.query,n).filter(e=>r.has(e.id)?!1:(r.add(e.id),!0)).map(e=>({value:e.id,insert:e.id,label:e.name,description:Ob(e,t),emphasized:bo(e)}))}return(r?.()??[]).filter(t=>wo(t,e.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1}))}function Ob(e,t){let n=t.filter(t=>t.id===e.id);return[e.description,...n.map(e=>e.path),n.length>1?`Runner scope picks the copy. Use the task skill picker to choose a specific copy.`:void 0].filter(Boolean).join(` · `)}function kb(e,t){return e.some(e=>e.value===t)?t:e[0]?.value}function Ab(e,t,n,r,i,a,o){!e||!t||!n||(r&&a(),i&&o())}function jb(e,t,n,r,i,a,o,s){if(e){a(n);return}V(n,{tone:`danger`}),t&&(o(e=>yy(e,r)),s(e=>[...i,...e].slice(0,4)))}function Mb(e,t){let[n,r]=(0,Y.useState)(``),i=e??n,a=(0,Y.useRef)(i);a.current=i;let o=(0,Y.useRef)(t);return o.current=t,{text:i,textRef:a,setText:(0,Y.useCallback)(e=>{let t=typeof e==`function`?e(a.current):e;r(t),o.current?.(t)},[])}}function Nb(e){let{onSubmit:t,retainDraftUntilSuccess:n,onStop:r,onFinish:i,finishing:a,secondaryAction:o,stopOnEmpty:s,stopping:c,emptySubmitLabel:l,compactFeedback:u,idleFeedback:d,pendingLabel:f,failureHint:p,clearOnSuccess:m,onPendingChange:h,value:g,onValueChange:_,autoFocus:v,mobileCollapsible:y,mobileDisclosureKey:b,footerStart:x,footerEnd:S,sessionControls:C,executionOptions:w,agentOptions:T,sendAriaLabel:E,disabled:D,disabledReason:O,allowEmptySubmit:k,placeholder:A,ariaLabel:j,autocompleteSkills:M,skillRunner:ee,skillAccount:te,quickReplies:ne,getMentionCandidates:re,ref:ie,draftPersisted:N}=Eb(e),{text:P,textRef:ae,setText:oe}=Mb(g,_),[se,ce]=(0,Y.useState)([]),le=(0,Y.useRef)(se);le.current=se;let[ue,de]=(0,Y.useState)(!1),fe=c||ue,pe=(0,Y.useRef)(fe);pe.current=fe;let[me,he]=(0,Y.useState)(!1),ge=(0,Y.useRef)(!1),_e=(0,Y.useRef)(0),ve=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>(ve.current=!0,()=>{ve.current=!1}),[]);let[ye,be]=(0,Y.useState)(null),xe=()=>py(pe.current,n,ge.current),[Se,Ce]=(0,Y.useState)(null),[we,Te]=(0,Y.useState)(``),[Ee,De]=(0,Y.useState)(!1),Oe=(0,Y.useRef)(null),ke=(0,Y.useId)(),Ae=(0,Y.useId)(),je=(0,Y.useRef)(null),Me=(0,Y.useRef)(new Map),Ne=b===void 0?Me.current:Cb,Pe=gy(b),[,Fe]=(0,Y.useReducer)(e=>e+1,0),Ie=_y(Ne,Pe),Le=(0,Y.useRef)(null),Re=(0,Y.useRef)(null),ze=(0,Y.useRef)(null),Be=Tt(ee,te,M&&Ee),He=Ot(),Ue=F(),We=(0,Y.useRef)(D);We.current=D;let Ge=ay((e,t)=>V(e,{tone:`danger`,...t?{action:{label:`Try again`,onAction:()=>{!We.current&&!xe()&&t()}}}:{}}));(0,Y.useEffect)(()=>{v&&Oe.current?.focus()},[]);let Ke=(0,Y.useCallback)(()=>{let e=Oe.current;if(!e||D||xe()){Ce(null);return}let t=ey(e.value,Dy(e.selectionStart,e.value.length));if(t?.trigger===`/`&&!M||t?.trigger===`@`&&re===void 0)return Ce(null);t?.trigger===`/`&&De(!0),Ce(t)},[M,D,re,n]),qe=(0,Y.useMemo)(()=>Db(Se,Be.data??[],He.data?.skillUsage,re),[re,Be.data,Se,He.data?.skillUsage]),Je=kb(qe,we),Ye=Se!==null;(0,Y.useLayoutEffect)(()=>{!Ye||!Je||[...Re.current?.querySelectorAll(`[data-slot="composer-menu-item"]`)??[]].find(e=>e.getAttribute(`data-value`)===Je)?.scrollIntoView({block:`nearest`})},[Je,Ye]);let Xe=(0,Y.useCallback)(()=>Ce(null),[]),Ze=e=>{let t=Oe.current;if(!t||Se===null||xe())return;let n=Dy(t.selectionStart,t.value.length),r=ty(t.value,Se,n,e.insert);Se.trigger===`/`&&He.data!==void 0&&Ve({skillUsage:To(He.data.skillUsage,e.insert)}).then(()=>Ue.invalidateQueries({queryKey:on.uiState})).catch(()=>{}),oe(r.text),ze.current=r.caret,Ce(null),t.focus()};(0,Y.useLayoutEffect)(()=>{let e=ze.current,t=Oe.current;e!==null&&t&&(t.setSelectionRange(e,e),ze.current=null)},[P]),(0,Y.useLayoutEffect)(()=>{let e=Oe.current;if(!e||Oy())return;let t=()=>{e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`};t();let n=e.clientWidth,r=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>{ky(e.clientWidth,n)&&(n=e.clientWidth,t())});r?.observe(e);let i=!1;return document.fonts?.ready.then(()=>{i||t()}),()=>{i=!0,r?.disconnect()}},[P,Ie]);let Qe=(0,Y.useCallback)(e=>{if(D||xe())return;let t=_e.current,r=Qv(e,le.current.length);for(let e of r.rejected)V(e,{tone:`danger`});for(let e of r.accepted)Zv(e).then(e=>{!ve.current||n&&ge.current&&!pe.current||t!==_e.current||ce(t=>t.length>=4?t:[...t,e])},()=>V(by(e.name),{tone:`danger`}))},[D,n]),$e=e=>{let t=Sy(e.dataTransfer?.files);t.length!==0&&(e.preventDefault(),Qe(t))},et=(0,Y.useCallback)((e,t)=>my(D,c,ge.current,k,e,t.length),[D,c,k]),tt=(0,Y.useCallback)(async(e,r,i)=>{let a=e.trim();if(!et(e,r)){ge.current=!0,n&&(_e.current+=1),he(!0),be(null),h?.(!0),Ce(null),i&&!n&&(oe(``),ce([]));try{await t(a,r.map(({mediaType:e,data:t})=>({mediaType:e,data:t}))),Ab(ve.current,n,m,ae.current===e,le.current===r,()=>oe(``),()=>ce([]))}catch(t){if(!ve.current&&n)return;jb(n,i,vy(t),e,r,be,oe,ce)}finally{ge.current=!1,ve.current&&(h?.(!1),he(!1))}}},[et,t,n,m,h,oe]),nt=(0,Y.useCallback)(()=>et(ae.current,le.current)?!1:(tt(ae.current,le.current,!0),!0),[et,tt]);(0,Y.useImperativeHandle)(ie,()=>({insertAtCaret:e=>{if(xe())return;let t=Oe.current,n=Dy(t?.selectionStart??null,ae.current.length),r=Uv(ae.current,n,e);oe(r.text),ze.current=r.caret,t?.focus()}}),[oe,n]);let rt=async()=>{if(!Ty(r,c,ge.current)){ge.current=!0,he(!0),de(!0),be(null);try{await r?.()}catch(e){ve.current&&be(vy(e))}finally{ge.current=!1,ve.current&&(he(!1),de(!1))}}},it=e=>{Ye&&at(e)||qv({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),nt())},at=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),qe.length===0)return!0;let t=qe.findIndex(e=>e.value===Je),n=e.key===`ArrowDown`?1:-1,r=qe[Ey(t,n,qe.length)];return Te(r.value),!0}if(e.key===`Escape`)return e.preventDefault(),Xe(),!0;if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=qe.find(e=>e.value===Je);if(t)return e.preventDefault(),Ze(t),!0;Xe()}return!1};(0,Y.useEffect)(()=>{if(!ne||D)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||zu(e.target))return;let t=wb[e.code];t!==void 0&&(e.preventDefault(),tt(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[D,ne,tt]);let ot=e=>{if(wy(D,pe.current,ge.current,e,n))return;let t=Ge.finish();if(t===``)return;let r=Cy(P,t);if(e){n&&oe(r),tt(r,se,!0);return}oe(r),ze.current=r.length,Oe.current?.focus()},I=sy(P,se.length),st=cy(I,r,s,fe),ct=ly(I,st,i),lt={hasContent:I,primaryStop:st,primaryFinish:ct,labelledStop:uy(st,ct,I,l),submitLabel:dy(I,l,E),busy:me,stopPending:fe,finishing:a,finishLabel:ob(a),finishTitle:`Close the session and mark this task done`,disabled:D,allowEmptySubmit:k,readOnly:fy(fe,n,me),mobileCompact:hy(y,Ie),mobileCollapsible:y,executionOptions:!!w,sessionControls:!!C,showStop:Ly(r,fe)},ut=Ge.recording;Dp(Tb(P,se.length,ut!==null,N===!0));let dt=Ge.supported?(0,X.jsx)(sb,{mode:lt,onStart:()=>{xe()||Ge.start()}}):null,ft=lt.primaryFinish?(0,X.jsx)(cb,{mode:lt,onFinish:()=>void i?.()}):null,pt=lt.showStop?(0,X.jsx)(lb,{mode:lt,onStop:()=>void rt()}):null,mt=(0,X.jsx)(ub,{shown:Iy(n,r,c),compactFeedback:u,hasCompactFeedback:Fy(fe,me,ye,d),textareaId:ke,submissionError:ye,stopPending:fe,busy:me,pendingLabel:f,failureHint:p,idleFeedback:d}),ht=(0,X.jsx)(db,{mode:lt,emptySubmitLabel:l,optionsId:Ae,dictationButton:dt,footerEnd:S,stopControl:pt,secondaryAction:o,finishControl:ft,onSubmit:nt});return(0,X.jsx)(Sb,{open:Ye,onClose:Xe,rootRef:Le,disabled:D,onDrop:$e,className:Hy(w,C,D),menu:(0,X.jsx)(pb,{menuListRef:Re,trigger:Se?.trigger,activeValue:Je,skillsPending:Be.isPending,candidates:qe,onValueChange:Te,onPick:Ze}),children:(0,X.jsx)(vb,{mode:lt,executionOptions:w,sessionControls:C,images:se,onRemoveImage:e=>{xe()||ce(t=>t.filter((t,n)=>n!==e))},textareaId:ke,textareaRef:Oe,text:P,disabled:D,retainDraftUntilSuccess:n,ariaLabel:j,disabledReason:O,placeholder:A,onTextChange:e=>{xe()||(oe(e),Ke())},onKeyDown:it,onSelect:Ke,onPaste:e=>{let t=xy(e.clipboardData?.items);t.length!==0&&(e.preventDefault(),Qe(t))},recording:ut,onCancelDictation:Ge.cancel,onInsertTranscript:()=>ot(!1),onInsertAndSend:()=>ot(!0),stopControl:pt,mobileCollapsible:y,mobileOpen:Ie,optionsId:Ae,footerEnd:S,onToggleMobile:()=>{Ne.set(Pe,!Ie),Fe()},footerStart:x,attachInputRef:je,addFiles:Qe,dictationButton:dt,submissionControls:ht,feedback:mt,agentOptions:T})})}var Pb=`inline-flex h-[26px] min-w-0 max-w-full items-center gap-1.5 rounded-full border border-control-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:border-dashed disabled:bg-muted`,Fb=(0,X.jsx)(Or,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-supporting-foreground`}),Ib=(0,Y.createContext)(null),Lb=e=>Number.parseFloat(e)||0;function Rb({pill:e,box:t,full:n}){let r=getComputedStyle(e),i=[...e.children].filter(e=>{if(e===t)return!1;let n=getComputedStyle(e);return n.display!==`none`&&n.position!==`absolute`});return i.reduce((e,t)=>e+t.getBoundingClientRect().width,0)+Lb(r.columnGap)*i.length+n.getBoundingClientRect().width+Lb(r.paddingLeft)+Lb(r.paddingRight)+Lb(r.borderLeftWidth)+Lb(r.borderRightWidth)}function zb(e){for(let t=e.parentElement;t;t=t.parentElement){if(t.dataset.slot===`picker-pill-disabled-wrapper`)continue;let e=getComputedStyle(t).display;if(e===`grid`||e===`flex`)return t}return e.parentElement}function Bb(e){let t=new Map;for(let n of e){let e=zb(n.pill),r=t.get(e)??new Map,i=Math.round(n.pill.getBoundingClientRect().top);r.set(i,[...r.get(i)??[],n]),t.set(e,r)}for(let[e,n]of t){let t=getComputedStyle(e),r=e.clientWidth-Lb(t.paddingLeft)-Lb(t.paddingRight);for(let e of n.values())if(e.reduce((e,t)=>e+Rb(t),0)+Lb(t.columnGap)*(e.length-1)>r+.5)return!1}return!0}function Vb({children:e}){let t=(0,Y.useRef)(new Map),n=(0,Y.useRef)(null),[r,i]=(0,Y.useState)(!0),a=(0,Y.useCallback)(()=>i(Bb([...t.current.values()])),[]),o=(0,Y.useCallback)((e,r)=>{if(t.current.set(e,r),typeof ResizeObserver<`u`){n.current??=new ResizeObserver(a);for(let e of[r.box,r.full,zb(r.pill)])n.current.observe(e)}return a(),()=>{if(t.current.delete(e),typeof ResizeObserver<`u`)for(let e of[r.box,r.full])n.current?.unobserve(e);a()}},[a]);(0,Y.useLayoutEffect)(()=>()=>n.current?.disconnect(),[]);let s=(0,Y.useMemo)(()=>({register:o,showPrefixes:r}),[o,r]);return(0,X.jsx)(Ib.Provider,{value:s,children:e})}function Hb({field:e,children:t}){let n=(0,Y.useRef)(null),r=(0,Y.useRef)(null),i=(0,Y.useContext)(Ib),a=i?.register,o=(0,Y.useId)(),[s,l]=(0,Y.useState)(!0);(0,Y.useLayoutEffect)(()=>{let e=n.current,t=r.current;if(a){let n=e.closest(`[data-slot$="pill"]`);return n?a(o,{pill:n,box:e,full:t}):void 0}let i=()=>l(t.getBoundingClientRect().width<=e.getBoundingClientRect().width+.5);if(i(),typeof ResizeObserver>`u`)return;let s=new ResizeObserver(i);return s.observe(e),s.observe(t),()=>s.disconnect()},[e,t,o,a]);let u=i!==null,d=u?i.showPrefixes:s,f=u&&!d;return(0,X.jsxs)(`span`,{ref:n,className:`relative min-w-0 overflow-hidden`,"aria-hidden":`true`,children:[(0,X.jsxs)(`span`,{ref:r,className:c(`invisible w-max whitespace-nowrap`,f?`absolute left-0 top-0`:`block`),children:[e,` · `,t]}),(0,X.jsxs)(`span`,{"data-slot":`picker-label`,className:c(`block truncate`,f?`relative`:`absolute inset-0`),children:[d?(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[e,` · `]}):null,t]})]})}function Ub({fieldLabel:e,ariaLabel:t,label:n,options:r,value:i}){return e?`${t} · ${typeof n==`string`?n:r.find(e=>e.value===i)?.label??i}`:t}function Wb({readOnly:e,disabled:t,hint:n,disabledHint:r}){return e?r??n:t?r:n}function Gb({fieldLabel:e,fullLabel:t,explanation:n}){return e?[t,n].filter(Boolean).join(` — `):n}function Kb({icon:e,fieldLabel:t,ariaLabel:n,label:r}){return(0,X.jsxs)(X.Fragment,{children:[e,t?(0,X.jsx)(Hb,{field:n,children:r}):(0,X.jsx)(`span`,{className:`min-w-0 truncate`,title:typeof r==`string`?r:void 0,children:r})]})}function qb({slot:e,ariaLabel:t,label:n,value:r,options:i,onPick:a,disabled:o=!1,choicesDisabled:s=!1,readOnly:l=!1,hint:u,disabledHint:d,status:f,searchPlaceholder:p,icon:m,fieldLabel:h=!1,footer:g}){let[_,v]=(0,Y.useState)(!1),[y,b]=(0,Y.useState)(``),x=(0,Y.useRef)(null),S=(0,Y.useRef)(null),C=p?i.filter(e=>e.label.toLowerCase().includes(y.trim().toLowerCase())):i;(0,Y.useEffect)(()=>{if(!_||!p)return;let e=window.setTimeout(()=>x.current?.focus());return()=>window.clearTimeout(e)},[_,p]);let w=e=>{x.current&&document.activeElement===x.current&&e.preventDefault()},T=m?` h-11 gap-2 rounded-lg border-border px-3 text-foreground`:``,E=Ub({fieldLabel:h,ariaLabel:t,label:n,options:i,value:r}),D=Gb({fieldLabel:h,fullLabel:E,explanation:Wb({readOnly:l,disabled:o,hint:u,disabledHint:d})}),O=Kb({icon:m,fieldLabel:h,ariaLabel:t,label:n});if(l)return(0,X.jsxs)(`span`,{"data-slot":e,"aria-label":E,title:D,className:c(Pb,T,`cursor-default hover:bg-card hover:text-muted-foreground`),children:[O,h?(0,X.jsx)(`span`,{className:`sr-only`,children:E}):null]});let k=(0,X.jsxs)(`button`,{type:`button`,"data-slot":e,"aria-label":E,disabled:o,title:D,className:c(Pb,T),children:[O,m?(0,X.jsx)(Or,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-muted-foreground`}):Fb]});return o?(0,X.jsx)(`span`,{"data-slot":`picker-pill-disabled-wrapper`,title:D,className:`inline-flex min-w-0 max-w-full`,children:k}):(0,X.jsxs)(Gi,{open:_,onOpenChange:e=>{v(e),e||b(``)},children:[(0,X.jsx)(Hi,{asChild:!0,children:k}),(0,X.jsxs)(Ui,{ref:S,align:`start`,"data-testid":`${e}-menu`,children:[p?(0,X.jsxs)(`div`,{"data-slot":`picker-search`,className:`mbe-1 flex min-h-11 min-w-56 items-center gap-2 border-b border-border px-2`,children:[(0,X.jsx)(hr,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,X.jsx)(`input`,{ref:x,type:`search`,"aria-label":p,placeholder:p,value:y,onChange:e=>b(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=S.current?.querySelectorAll(`[role="menuitemradio"]:not([data-disabled])`);(e.key===`ArrowDown`?t?.[0]:t?.[t.length-1])?.focus()}else e.key!==`Escape`&&e.stopPropagation()},className:`h-11 w-0 min-w-0 flex-1 bg-transparent text-sm placeholder:text-muted-foreground`})]}):null,(0,X.jsx)(Wi,{value:r,onValueChange:a,children:C.map(e=>(0,X.jsx)(Li,{value:e.value,disabled:s,className:c(`gap-2.5`,p&&`min-h-11`),onPointerMove:w,onPointerLeave:w,onKeyDown:t=>{x.current&&(t.key===`ArrowUp`&&e===C[0]||t.key===`Tab`&&t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),x.current.focus())},children:(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium`,children:e.label}),e.desc?(0,X.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.desc}):null]})},e.value))}),p&&C.length===0?(0,X.jsx)(`p`,{role:`status`,className:`px-2 py-5 text-center text-xs text-muted-foreground`,children:`No matches found.`}):null,f?(0,X.jsx)(W,{disabled:!0,onPointerMove:w,onPointerLeave:w,className:`border-t border-border text-[11px] text-muted-foreground`,children:f}):null,g]})]})}var Jb=(e,t)=>t===null?e:`${e}:${t}`;function Yb({runners:e,value:t,onPick:n,disabled:r=!1,accounts:i=[],account:a=null,repoAccount:o,icon:s,fieldLabel:c,uninstalled:l=[],signedOut:u=[]}){let d=At().data,f=xt(d).filter(t=>e.includes(t.id)).flatMap(e=>{let t=i.filter(t=>t.provider===e.id);return t.length<2?[{value:Jb(e.id,null),label:e.id,desc:e.pickerDescription}]:t.map(t=>({value:Jb(e.id,t.id),label:`${e.id} · ${t.label}`,desc:t.configDir}))}),p=r&&(l.length>0||u.length>0),m=a??o?.[t]??`default`,h=f.some(e=>e.value===Jb(t,m))?Jb(t,m):Jb(t,null);return(0,X.jsx)(qb,{icon:s,fieldLabel:c,slot:`runner-pill`,ariaLabel:`Runner`,label:f.find(e=>e.value===h)?.label??t,value:h,disabled:r&&!p,choicesDisabled:p,onPick:e=>{let[t,r]=e.split(`:`);n(t,r??null)},options:f,footer:(0,X.jsx)(Xb,{uninstalled:l,signedOut:u})})}function Xb({uninstalled:e,signedOut:t}){let n=At().data,r=xt(n).flatMap(n=>e.includes(n.id)?[{id:n.id,state:`Not installed`,action:`Install in Settings`}]:t.includes(n.id)?[{id:n.id,state:`Not signed in`,action:`Sign in in Settings`}]:[]);return r.length===0?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Bi,{}),r.map(e=>(0,X.jsx)(W,{asChild:!0,className:`gap-2.5 ps-8`,children:(0,X.jsx)(z,{to:Do(e.id),"data-slot":`runner-install-link`,"data-runner":e.id,children:(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium text-muted-foreground`,children:e.id}),(0,X.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[e.state,` · `,(0,X.jsx)(`span`,{className:`font-medium text-accent-text`,children:e.action})]})]})})},e.id))]})}function Zb({templates:e,onInsert:t,triggerClassName:n,disabled:r,iconOnly:i=!1,label:a=`Template`}){let[o,s]=(0,Y.useState)(!1),l=(0,Y.useRef)(null),u=Da();return e.length===0?null:(0,X.jsxs)(ga,{open:o,onOpenChange:s,children:[(0,X.jsx)(fa,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:r,className:c(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,i?`w-[26px] justify-center px-0`:`h-11 gap-2 rounded-lg px-3 text-foreground`,n),children:[(0,X.jsx)(mr,{"aria-hidden":`true`,className:i?`size-3 shrink-0 text-accent-icon`:`size-[18px] shrink-0 text-muted-foreground`}),i?null:(0,X.jsxs)(X.Fragment,{children:[a,(0,X.jsx)(Or,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-soft-foreground`})]})]})}),(0,X.jsx)(ha,{align:`start`,sideOffset:8,"data-slot":`prompt-template-menu`,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,onCloseAutoFocus:e=>e.preventDefault(),children:(0,X.jsxs)(fo,{filter:go,children:[(0,X.jsx)(io,{placeholder:`search templates…`,onInput:()=>l.current?.scrollTo(0,0)}),(0,X.jsxs)(uo,{ref:l,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,X.jsx)(lo,{children:`Nothing matches.`}),(0,X.jsx)(J,{heading:`Insert a template`,children:e.map(e=>(0,X.jsxs)(co,{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),s(!1)},children:[(0,X.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium text-foreground`,children:e.label}),e.skills&&e.skills.length>0?(0,X.jsxs)(`span`,{"data-slot":`prompt-template-assigned`,title:`Applied automatically with: ${e.skills.join(`, `)}`,className:`inline-flex shrink-0 items-center gap-0.5 text-[12px] font-medium text-accent-text`,children:[(0,X.jsx)(zr,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,X.jsx)(`span`,{className:`line-clamp-1 text-[11px] text-soft-foreground`,children:e.text})]},e.id))}),(0,X.jsx)(ao,{}),(0,X.jsx)(J,{children:(0,X.jsx)(co,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-[12px] text-muted-foreground`,onSelect:()=>{s(!1),u(`/settings/prompt-templates`)},children:`Edit templates…`})})]})]})})]})}var Qb={repo:`Project`,user:`User`,system:`Built in`,other:null};function $b(e){return[e.scope?Qb[e.scope]:null,e.plugin?`Plugin ${e.plugin}`:null].filter(Boolean).join(` · `)||null}function ex({skill:e,heading:t=`h2`,actions:n}){let r=$b(e);return(0,X.jsxs)(`div`,{"data-slot":`skill-detail`,className:`grid min-w-0 gap-3 break-words`,children:[t?(0,X.jsx)(t,{className:`text-xl font-semibold`,children:e.name}):null,e.description?(0,X.jsx)(`p`,{"data-slot":`skill-description`,className:`max-w-[78ch] text-[13.5px] leading-relaxed`,children:e.description}):(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`This runner reports no description.`}),(0,X.jsxs)(`dl`,{className:`grid grid-cols-[max-content_minmax(0,1fr)] items-center gap-x-4 gap-y-1.5 text-[12.5px]`,children:[(0,X.jsx)(tx,{label:`Id`,children:(0,X.jsx)(nx,{value:e.id,label:`Copy id`})}),r?(0,X.jsx)(tx,{label:`Source`,children:(0,X.jsx)(`span`,{"data-slot":`skill-source`,children:r})}):null,e.path?(0,X.jsx)(tx,{label:`File`,children:(0,X.jsx)(nx,{value:e.path,label:`Copy path`,slot:`skill-path`})}):null]}),n?(0,X.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n}):null]})}function tx({label:e,children:t}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-soft-foreground`,children:e}),(0,X.jsx)(`dd`,{className:`flex min-w-0 items-center gap-1`,children:t})]})}function nx({value:e,label:t,slot:n}){let r=()=>Promise.resolve().then(()=>navigator.clipboard.writeText(e)).then(()=>V(`Copied.`),e=>V(e instanceof Error?e.message:String(e),{tone:`danger`}));return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`code`,{"data-slot":n,title:e,className:`min-w-0 truncate rounded-sm border border-border bg-background px-1.5 py-px font-mono text-xs`,children:e}),(0,X.jsx)(`button`,{type:`button`,"aria-label":t,onClick:()=>void r(),className:`inline-flex size-7 shrink-0 items-center justify-center rounded-sm text-soft-foreground focus-visible:outline-2 pointer-hover:bg-muted pointer-hover:text-foreground`,children:(0,X.jsx)(Hr,{"aria-hidden":`true`,className:`size-3.5`})})]})}function rx({skill:e,onClose:t}){return(0,X.jsx)(wa,{open:e!==null,onOpenChange:e=>{e||t()},children:(0,X.jsx)(Sa,{"data-slot":`skill-preview`,className:`max-h-[80dvh] overflow-y-auto`,children:e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ca,{className:`sr-only`,children:e.name}),(0,X.jsx)(ya,{className:`sr-only`,children:`Runner skill metadata`}),(0,X.jsx)(ex,{skill:e,heading:`h3`})]}):null})})}function ix(e){try{let t=new URL(e),n=t.pathname===`/`?``:t.pathname.replace(/\/$/,``);return`${t.host}${n}`||e}catch{return e}}function ax(e){return e?e.webhooks?e.webhooks.filter(e=>e.tasks).map(({id:e,name:t,url:n})=>({id:e,name:t,url:n})):e.webhook?[{id:`task-webhook`,name:`Task webhook`,url:e.webhook.url}]:[]:[]}function ox(e){let t=e.map(e=>e.name);return t.length<=2?t.join(` and `):t.length===3?`${t[0]}, ${t[1]} and ${t[2]}`:`${t[0]}, ${t[1]} and ${t.length-2} more`}function sx(e,t){return e===``?{message:`Prefilled from link — review and press Start`,tone:`default`}:{message:t?`Unknown skill "${e}" — prefilled for quick-task; review and press Start`:`Unknown skill "${e}" — no skill selected; review before starting`,tone:`danger`}}function cx(e,t){return`Use the "${e}" skill on: ${t}`}function lx(e){let t=e.configuredAutonomous===`source-dependent`?e.source===`skill`:e.configuredAutonomous;return{autonomous:e.planFirst?!1:e.explicitAutonomous??t,worktree:e.hasGit?e.explicitWorktree??e.configuredWorktree:!1}}function ux(e){return e.worktree?`Runs in an isolated worktree — review everything before it lands.`:e.hasGit?`Runs in the repo working tree — your checkout is modified directly.`:`Runs in place — no git repository detected, so there is no worktree to isolate in.`}var dx={text:``,source:null,runner:null,agentProfile:null,model:null,effort:null,planFirst:!1,worktree:null,autonomous:null,archiveWhenDone:!1,autoMergePr:!1,allowWorkers:!0,allowMessaging:!0},fx=`cez-new-task-draft`;function px(e){return e===null?fx:`${fx}:${e}`}function mx(e){let t=e&&typeof e==`object`?e:{};return{text:typeof t.text==`string`?t.text:``,source:hx(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,effort:typeof t.effort==`string`?t.effort:null,planFirst:t.planFirst===!0,worktree:typeof t.worktree==`boolean`?t.worktree:null,autonomous:typeof t.autonomous==`boolean`?t.autonomous:null,archiveWhenDone:t.archiveWhenDone===!0,autoMergePr:t.autoMergePr===!0,allowWorkers:t.allowWorkers!==!1,allowMessaging:t.allowMessaging!==!1}}function hx(e){return!!e&&typeof e==`object`&&(e.source===`skill`||e.source===`workflow`)&&typeof e.ref==`string`}var gx=new Map,_x=new Map,vx=new Map;function yx(e=null){return _x.get(px(e))??0}function bx(e=null){let t=px(e),n=gx.get(t);if(n)return{...n};let r;try{let e=localStorage.getItem(t);r=e?mx(JSON.parse(e)):{...dx}}catch{r={...dx}}return gx.set(t,r),{...r}}function xx(e,t=null){let n=px(t);_x.set(n,yx(t)+1),gx.set(n,{...e});try{localStorage.setItem(n,JSON.stringify(e)),vx.set(n,!0)}catch{vx.set(n,!1)}}function Sx(e=null){return vx.get(px(e))??!1}function Cx(e=null,t){t!==void 0&&yx(e)!==t||xx({...bx(e),text:``,source:null},e)}var wx=`quick-task`;function Tx(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}function Ex(e,t){return Et(e,t)?.models.suggested}var Dx=[{value:``,label:`auto`,desc:`Harness default`},{value:`low`,label:`low`,desc:`Less reasoning, faster replies`},{value:`medium`,label:`medium`,desc:`Balanced reasoning`},{value:`high`,label:`high`,desc:`More reasoning for hard tasks`},{value:`xhigh`,label:`xhigh`,desc:`Extra-high reasoning`},{value:`max`,label:`max`,desc:`Maximum reasoning`}];function Ox(e,t){let n=Dx,r=t?.models.find(t=>t.id===e)?.effortLevels;if(r===void 0)return n;let i=[Dx[0]],a=new Set;for(let e of r){if(a.has(e))continue;let t=Dx.find(t=>t.value===e);t&&(a.add(e),i.push(t))}return i}function kx(e,t){let n=e??``;return t.some(e=>e.value===n)?n:``}function Ax(e,t,n){if(!e||Ex(n,t)?.some(t=>t.id===e))return!1;let r=(n?.runners??[]).filter(e=>e.id!==t);return r.some(t=>t.models.retired.includes(e))?!0:r.some(t=>t.modelIdScope!==`provider-spanning`&&t.models.suggested.some(t=>t.id!==``&&t.id===e))}function jx(e,t,n,r=[]){let i=n?.runner===e?n.models:[],a=Ex(t,e)??Ex(t,`claude`)??[],o=[...i.length?a.slice(0,1):a],s=new Set(o.map(e=>e.id));for(let e of i)!e.id||s.has(e.id)||(s.add(e.id),o.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let n of r)!n||s.has(n)||Ax(n,e,t)||(s.add(n),o.push({id:n,label:n,desc:`Custom or legacy model`}));return o}function Mx(e,t,n,r=!1,i=!1){let a=ut(t,e);if(a!==void 0){if(n?.stale)return`Using cached ${a} model list`;if(r||n?.source===`unavailable`)return`Latest ${a} models unavailable`;if(i&&!n)return`Loading ${a} models…`}}function Nx(e,t,n){return Mx(e,t,n?.data,n?.isError,n?.isFetching)}function Px(e,t){let n=fn(t).filter(t=>e.some(e=>e.name===t&&e.available));return n.length>0?n:[`claude`]}function Fx(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function Ix(e,t,n=!1){return!n&&e===t?void 0:e}function Lx(e,t,n,r,i){let a=jx(t,n,i,[e,r?.[t]]);if(e!==null&&a.some(t=>t.id===e))return e;let o=r?.[t];return o!==void 0&&a.some(e=>e.id===o)?o:``}function Rx(e,t,n){return e.source===`skill`?t.some(t=>t.id===e.ref&&(e.path===void 0||t.path===e.path)):n.some(t=>t.name===e.ref)}function zx(e,t,n,r=!1){return e?.source===`skill`&&(r||e.typed)||e&&Rx(e,t,n)?e:null}function Bx(e){let{task:t,source:n,model:r,modelsLocked:i,effort:a,runner:o,runnerExplicit:s,defaultRunner:c,agentProfile:l,images:u,worktree:d,autonomous:f,archiveWhenDone:p,autoMergePr:m,allowWorkers:h,allowMessaging:g}=e;return{task:t,...n?.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,...n.path===void 0?{}:{skillPath:n.path},prompt:`{{task}}`}]}:{workflow:n?.ref??`quick-task`},model:i?void 0:r||void 0,effort:i?void 0:a||void 0,runner:Ix(o,c,s),agentProfile:l||void 0,images:u.length>0?[...u]:void 0,worktree:d!==!1&&void 0,autonomous:f===!0||void 0,...Vx({archiveWhenDone:p,autoMergePr:m,allowWorkers:h,allowMessaging:g})}}function Vx(e){return{...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers===!1?{allowWorkers:!1}:{},...e.allowMessaging===!1?{allowMessaging:!1}:{}}}function Hx(e,t){return t?{...e,notify:!0}:e}function Ux(e){return`/tasks/${e.id}`}function Wx(e,t,n){return{task:e,steps:[...n.steps],rationale:n.rationale,fallback:n.fallback,images:[...t]}}function Gx(e,t){return!Number.isInteger(t)||t<0||t>=e.length?[...e]:e.filter((e,n)=>n!==t)}function Kx(e,t,n){let r=[...e];if(!Number.isInteger(t)||t<0||t>=r.length)return r;let i=Math.max(0,Math.min(r.length-1,n));if(i===t)return r;let[a]=r.splice(t,1);return r.splice(i,0,a),r}function qx(e){return e.command??e.prompt??``}function Jx(e,t=120){let n=e.split(`
20
- `)[0]??``;return n.length>t?`${n.slice(0,t-1)}…`:n}function Yx(e){let{task:t,steps:n,agentProfile:r,model:i,modelsLocked:a,effort:o,runner:s,runnerExplicit:c,defaultRunner:l,images:u,archiveWhenDone:d,autoMergePr:f,allowWorkers:p,allowMessaging:m}=e;return{task:t,steps:[...n],...r?{agentProfile:r}:{},model:a?void 0:i||void 0,effort:a?void 0:o||void 0,runner:Ix(s,l,c),images:u.length>0?[...u]:void 0,...Vx({archiveWhenDone:d,autoMergePr:f,allowWorkers:p,allowMessaging:m})}}function Xx(e,t,n){return{runner:e,agentProfile:t||null,...e===n?{}:{model:null,effort:null}}}function Zx(e,t){let n=bx(e);return{...n,...t.runner===void 0?{}:Xx(t.runner,t.account,n.runner),...t.ref===``?{}:{text:t.ref},...t.skill===``?{}:{source:{source:`skill`,ref:t.skill,...t.skillPath===void 0?{}:{path:t.skillPath}}}}}function Qx(e,t,n){let[r,i]=(0,Y.useState)(()=>Zx(e,t)),a=(0,Y.useRef)(r);(0,Y.useEffect)(()=>{xx(a.current,e)},[e]);let o=(0,Y.useRef)(!1),s=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]);let c=t=>{if(!s.current||o.current)return;let n={...a.current,...t};a.current=n,xx(n,e),i(n)},l=(0,Y.useRef)(t.runner===void 0);return(0,Y.useEffect)(()=>{!l.current||n===void 0||(l.current=!1,c(Xx(n,t.account,a.current.runner)))},[n]),{draft:r,update:c,clearStarted:t=>{if(yx(e)!==t)return;Cx(e,t);let n=bx(e);a.current=n,s.current&&i(n)},submissionPending:o,mounted:s}}function $x(e,t,n,r){let i=Yt(),a=Tt(n,r),o=a.data,s=t.data?.skillUsage,c=(0,Y.useMemo)(()=>So(o??[],s),[o,s]),l=i.data?.workflows??[],u=i.data!==void 0&&!t.isPending,d=zx(e,c,l,a.unchecked),f=d?.source===`skill`?c.find(e=>e.id===d.ref&&(d.path===void 0||e.path===d.path)):void 0;return{skillList:c,skillUsage:s,workflowList:l,sourcesReady:u,source:d,selectedSkill:f,skillsSettled:!a.isPending,listUnchecked:a.unchecked,unchecked:a.unchecked||d?.source===`skill`&&!f}}function eS(e){let{uiState:t,source:n,sourcesReady:r,draftText:i,submissionPending:a,update:o}=e,s=t.data?.promptTemplates,c=(0,Y.useMemo)(()=>Lv(s),[s]),l=Bv(c,n?.source===`skill`?[n.ref]:[]),u=(0,Y.useRef)(i);u.current=i;let d=(0,Y.useRef)(``);return(0,Y.useEffect)(()=>{if(!r||a.current)return;let e=Vv(u.current,d.current,l);d.current=e.applied,e.text!==u.current&&o({text:e.text})},[l,r]),c}function tS(e,t){let n=vt(),r=At(),i=cp(),{runners:a,uninstalled:o,signedOut:s}=i,c=t.data?.defaultRunner,l=c??`claude`,u=a.length>0?Fx(e.runner,a,l):null,{runner:d,ready:f}=gt(u??l),p=n.isSuccess&&a.length>0,m={isPending:n.isPending||r.isPending,isError:n.isError||r.isError},h=i.accountFor(d,e.agentProfile)??i.repoAccount?.[d],g=ft(c,fn(r.data)),_=g===void 0?null:i.accountFor(g,u===g?e.agentProfile:null),v=Ut(d,f,h),y=t.data?.modelsLocked===!0,b=t.data?.defaultModels,x=u===null?[]:jx(u,r.data,v.data,[e.model,b?.[u]]),S=u===null?``:Lx(y?null:e.model,u,r.data,b,v.data),C=Ox(S,v.data);return{providers:m,registered:r,runners:a,uninstalled:o,signedOut:s,defaultRunner:c,planAccount:_,runner:u,displayRunner:d,providersReady:p,catalog:v,modelsLocked:y,models:x,model:S,effortOptions:C,effort:y?``:kx(e.effort,C)}}function nS(e,t){let n=Qt(),{accounts:r,repoAccount:i,accountFor:a}=cp();return{accountChoices:r,repoAccount:i,accountsSettled:!n.isPending,agentProfile:a(e,t)}}function rS(e){let t=(0,Y.useRef)(!1),n=(0,Y.useRef)(void 0);(0,Y.useEffect)(()=>{n.current===void 0&&(n.current=document.activeElement);let r=e&&!t.current;t.current=e,r&&(document.activeElement===document.body||document.activeElement===n.current)&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[e])}function iS(e){let t=e.workspaceConfig.data?.composerDefaults;return lx({hasGit:e.hasGit,planFirst:e.draft.planFirst,explicitAutonomous:e.draft.autonomous,explicitWorktree:e.draft.worktree,configuredAutonomous:t?.autonomous??t?.inheritedAutonomous??`source-dependent`,configuredWorktree:t?.worktree??t?.inheritedWorktree??!0,source:e.source?.source??`workflow`})}function aS(e){let t=tn(),n=t.data?.projects??[],r=e??t.data?.bootProject,i=ax(n.find(e=>e.id===r)),[a,o]=(0,Y.useState)(!1);return{projectList:n,webhookTargets:i,notifyOn:i.length>0&&a,setNotifyChoice:o}}function oS(e){let[t,n]=(0,Y.useState)(()=>typeof window<`u`&&window.innerWidth<=767);return(0,Y.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=()=>n(window.innerWidth<=767||t.getBoundingClientRect().width<550);r();let i=typeof ResizeObserver>`u`?null:new ResizeObserver(r);return i?.observe(t),window.addEventListener(`resize`,r),()=>{i?.disconnect(),window.removeEventListener(`resize`,r)}},[]),t}function sS(e){let t=Da(),[n,r]=(0,Y.useState)(()=>e.deepLink.ref!==``||e.deepLink.skillPath!==void 0);cS(e.search,t),lS({pending:n,setPending:r,deepLink:e.deepLink,sourcesReady:e.sourcesReady,listUnchecked:e.listUnchecked,skillList:e.skillList,update:e.update})}function cS(e,t){let n=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{n.current||(n.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[])}function lS(e){let{pending:t,sourcesReady:n,deepLink:r}=e;(0,Y.useEffect)(()=>{if(!t||!n)return;e.setPending(!1);let i=!e.listUnchecked&&r.skill!==``&&!Rx({source:`skill`,ref:r.skill,...r.skillPath===void 0?{}:{path:r.skillPath}},e.skillList,[])?r.skill:``;i!==``&&r.ref!==``&&e.update({text:cx(r.skill,r.ref),source:null});let{message:a,tone:o}=sx(i,r.ref!==``);V(a,{tone:o}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"], [data-slot="composer"] button[aria-label="Plan task"]`)?.focus()},[t,n])}function uS(e){return e.isPending?`Checking agent providers…`:e.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`}function dS(e,t,n){Ve({lastTask:e?{source:e.source,ref:e.ref}:null,...e?{recentSources:Tx(t.data?.recentSources,{source:e.source,ref:e.ref})}:{},...e?.source===`skill`&&t.data!==void 0?{skillUsage:To(t.data.skillUsage,e.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:on.uiState})).catch(()=>{})}function fS(e){let t=Da(),n=F(),[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(!1),{draft:l,draftProjectId:u,engine:d,mounted:f}=e,{providers:p,providersReady:m,runner:g}=d,_=(r,i)=>{e.clearStarted(i),n.invalidateQueries({queryKey:on.runs.all}),f.current&&t(Ux(r))};return{plan:r,setPlan:i,planning:a,starting:s,submit:async(t,r)=>{let a=yx(u);if(!m||g===null)throw Error(uS(p));if(!e.sourcesReady)throw Error(`Still loading workflows and skills — try again in a second.`);if(l.agentProfile&&!e.accountsSettled)throw Error(`Still loading agent accounts — try again in a second.`);if(l.planFirst){o(!0);try{let e=await E(t,d.planAccount);f.current&&i(Wx(t,r,e))}finally{o(!1)}return}let s=await h(Hx(Bx({task:t,source:e.source,model:d.model,modelsLocked:d.modelsLocked,effort:d.effort,runner:g,runnerExplicit:l.runner!==null,agentProfile:e.agentProfile,defaultRunner:d.defaultRunner,images:r,worktree:e.runMode.worktree,autonomous:e.runMode.autonomous,archiveWhenDone:l.archiveWhenDone,autoMergePr:l.autoMergePr,allowWorkers:l.allowWorkers,allowMessaging:l.allowMessaging}),e.notifyOn));dS(e.source,e.uiState,n),_(s,a)},startPlanned:async()=>{if(r===null||r.steps.length===0||s||!m||g===null||l.agentProfile&&!e.accountsSettled)return;let t=yx(u);c(!0);try{let n=await h(Hx(Yx({task:r.task,steps:r.steps,agentProfile:e.agentProfile,model:d.model,modelsLocked:d.modelsLocked,effort:d.effort,runner:g,runnerExplicit:l.runner!==null,defaultRunner:d.defaultRunner,images:r.images,archiveWhenDone:l.archiveWhenDone,autoMergePr:l.autoMergePr,allowWorkers:l.allowWorkers,allowMessaging:l.allowMessaging}),e.notifyOn));i(null),_(n,t)}catch(e){V(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{c(!1)}}}}function pS({archiveWhenDone:e,autoMergePr:t,onChange:n,disabled:r=!1,embedded:i=!1}){let a=(0,Y.useId)();return(0,X.jsxs)(`fieldset`,{"data-slot":`completion-controls`,"data-embedded":i||void 0,className:`grid min-w-0 gap-3`,children:[(0,X.jsx)(`legend`,{className:i?`sr-only`:`text-sm font-medium [margin-block-end:0.5rem]`,children:`After Done`}),(0,X.jsxs)(`label`,{htmlFor:`${a}-archive`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,X.jsx)(`span`,{id:`${a}-archive-label`,children:`Archive when Done`}),i?(0,X.jsx)(`span`,{id:`${a}-archive-help`,className:`completion-control-help`,children:`Move to Archived after Done, even without a PR. You can restore it later.`}):null]}),(0,X.jsx)(oa,{id:`${a}-archive`,className:`completion-switch`,checked:e,disabled:r,"aria-labelledby":`${a}-archive-label`,"aria-describedby":`${a}-archive-help`,onCheckedChange:e=>n({archiveWhenDone:e})})]}),i?null:(0,X.jsx)(`p`,{id:`${a}-archive-help`,className:`text-xs break-words text-muted-foreground`,children:`Move the task to Archived after it reaches Done. You can restore it later.`}),(0,X.jsxs)(`label`,{htmlFor:`${a}-merge`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,X.jsx)(`span`,{id:`${a}-merge-label`,children:`Auto-merge PR`}),i?(0,X.jsx)(`span`,{id:`${a}-merge-help`,className:`completion-control-help`,children:`After Done, mark the PR ready and merge when current-head CI and GitHub rules allow.`}):null]}),(0,X.jsx)(oa,{id:`${a}-merge`,className:`completion-switch`,checked:t,disabled:r,"aria-labelledby":`${a}-merge-label`,"aria-describedby":`${a}-merge-help`,onCheckedChange:e=>n({autoMergePr:e})})]}),i?null:(0,X.jsx)(`p`,{id:`${a}-merge-help`,className:`text-xs break-words text-muted-foreground`,children:`After Done, mark a draft PR ready and merge when current-head CI and GitHub rules allow it.`}),!i||e&&t?(0,X.jsx)(`p`,{className:`completion-order-note text-xs break-words text-muted-foreground`,children:i?`Merge runs before archive when both are on.`:`When both are on, merge comes before archive. Without a PR, Archive when Done still archives the task.`}):null]})}var mS=[{key:`allowWorkers`,slot:`workers`,label:`Allow Squawk workers`,help:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`},{key:`allowMessaging`,slot:`messaging`,label:`Allow task messaging`,help:`Agents in this task can message other tasks in this project.`}];function hS({allowWorkers:e,allowMessaging:t,onChange:n,disabled:r=!1,embedded:i=!1}){let a=(0,Y.useId)(),o={allowWorkers:e,allowMessaging:t};return(0,X.jsxs)(`fieldset`,{"data-slot":`task-access-controls`,"data-embedded":i||void 0,className:`grid min-w-0 gap-3`,children:[(0,X.jsx)(`legend`,{className:i?`sr-only`:`text-sm font-medium [margin-block-end:0.5rem]`,children:`Task access`}),mS.map(e=>(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsxs)(`label`,{htmlFor:`${a}-${e.slot}`,"data-slot":`task-access-${e.slot}`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,X.jsx)(`span`,{id:`${a}-${e.slot}-label`,children:e.label}),i?(0,X.jsx)(`span`,{id:`${a}-${e.slot}-help`,className:`completion-control-help`,children:e.help}):null]}),(0,X.jsx)(oa,{id:`${a}-${e.slot}`,className:`completion-switch shrink-0`,checked:o[e.key],disabled:r,"aria-labelledby":`${a}-${e.slot}-label`,"aria-describedby":`${a}-${e.slot}-help`,onCheckedChange:t=>n({[e.key]:t})})]}),i?null:(0,X.jsx)(`p`,{id:`${a}-${e.slot}-help`,className:`text-xs break-words text-muted-foreground`,children:e.help})]},e.key))]})}function gS(){return(0,X.jsxs)(`header`,{className:`mb-7 max-md:mb-5`,children:[(0,X.jsx)(`p`,{"data-slot":`page-eyebrow`,className:`mb-2 text-[11px] font-semibold tracking-[0.16em] text-[var(--accent-text)] uppercase`,children:`NEW TASK`}),(0,X.jsx)(`h1`,{className:`text-[30px] leading-[normal] font-semibold tracking-[-0.9px] max-md:text-[22px] max-md:leading-[29px] max-md:tracking-[-0.6px]`,children:`What should the agent work on?`}),(0,X.jsx)(`p`,{"data-slot":`page-description`,className:`mt-2 hidden text-[13px] text-muted-foreground md:block`,children:`Describe the outcome. Configure the run. Review everything before it lands.`})]})}function _S({groupRef:e,compact:t,engine:n,accounts:r,draftEffort:i,update:a}){let o=n.runners.length>1||n.uninstalled.length>0||n.signedOut.length>0||n.runners.some(e=>sp(r.accountChoices,e))?(0,X.jsx)(vS,{engine:n,accounts:r,update:a},`runner`):null,s=(0,X.jsx)(yS,{engine:n,draftEffort:i,update:a},`model`),c=(0,X.jsx)(bS,{engine:n,update:a},`effort`);return(0,X.jsx)(`div`,{ref:e,"data-slot":`agent-options`,role:`group`,"aria-label":`Agent settings`,className:`new-task-agent-options`,children:(0,X.jsx)(Vb,{children:t?[o,c,s]:[o,s,c]})})}function vS({engine:e,accounts:t,update:n}){return(0,X.jsx)(Yb,{icon:(0,X.jsx)(Tr,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:e.runners,uninstalled:e.uninstalled,signedOut:e.signedOut,value:e.displayRunner,accounts:t.accountChoices,account:t.agentProfile,repoAccount:t.repoAccount,onPick:(t,r)=>n({runner:t,agentProfile:r,...t===e.displayRunner?{}:{model:null}}),disabled:!e.providersReady})}function yS({engine:e,draftEffort:t,update:n}){let{catalog:r,displayRunner:i}=e;return(0,X.jsx)(qb,{icon:(0,X.jsx)(Wr,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:e.models.find(t=>t.id===e.model)?.label??`auto`,value:e.model,disabled:!e.providersReady,readOnly:e.modelsLocked,disabledHint:e.modelsLocked?`Model selection is locked to native coding-agent settings.`:void 0,onPick:e=>{let i=Ox(e,r.data);n({model:e,effort:t===null?null:kx(t,i)})},options:e.models.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Nx(i,e.registered.data,r)})}function bS({engine:e,update:t}){return(0,X.jsx)(qb,{icon:(0,X.jsx)(Dr,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:e.effortOptions.find(t=>t.value===e.effort)?.label??`auto`,value:e.effort,disabled:!e.providersReady,readOnly:e.modelsLocked,disabledHint:e.modelsLocked?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:e=>t({effort:e}),options:e.effortOptions.map(e=>({value:e.value,label:e.label,desc:e.desc}))})}function xS({engine:e,draft:t,update:n,repo:r,hasGit:i,runMode:a,webhook:o,completionDisabled:s}){let{displayRunner:c}=e,l=At().data;return(0,X.jsxs)(`details`,{"data-slot":`execution-options`,open:!0,className:`group rounded-xl border border-border bg-card xl:self-start`,children:[(0,X.jsxs)(`summary`,{className:`flex min-h-[44px] cursor-pointer list-none flex-wrap items-center gap-x-2 gap-y-1 px-3 py-2 text-xs text-muted-foreground pointer-hover:bg-muted/50 active:bg-muted/50 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground [&::-webkit-details-marker]:hidden`,children:[(0,X.jsx)(br,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:`Execution settings`}),(0,X.jsxs)(`span`,{"data-slot":`execution-summary`,hidden:!0,className:`min-w-0 basis-full truncate pl-5 xl:ml-auto xl:basis-auto xl:pl-0`,children:[Mt(l,c),` · `,e.models.find(t=>t.id===e.model)?.label??`auto`]}),(0,X.jsx)(Or,{"aria-hidden":`true`,className:`new-task-settings-chevron size-4 shrink-0`})]}),(0,X.jsxs)(`div`,{className:`new-task-settings-body`,children:[(0,X.jsx)(`p`,{className:`new-task-settings-description`,children:`Control this run and what happens after Done.`}),(0,X.jsxs)(`div`,{role:`group`,"aria-label":`Run settings`,className:`new-task-run-settings`,children:[i?(0,X.jsx)(CS,{on:a.worktree,onChange:e=>n({worktree:e})}):null,(0,X.jsx)(ES,{repo:r}),(0,X.jsx)(wS,{on:a.autonomous,disabled:t.planFirst,onChange:e=>n({autonomous:e})}),o.targets.length>0?(0,X.jsx)(TS,{on:o.on,targets:o.targets,onChange:o.onChange}):null]}),(0,X.jsx)(pS,{embedded:!0,archiveWhenDone:t.archiveWhenDone,autoMergePr:t.autoMergePr,onChange:n,disabled:s}),(0,X.jsx)(hS,{embedded:!0,allowWorkers:t.allowWorkers,allowMessaging:t.allowMessaging,onChange:n,disabled:s})]})]})}function SS({showConfigureProviders:e,planFirst:t,planning:n,onModeChange:r}){return(0,X.jsxs)(X.Fragment,{children:[e?(0,X.jsx)(G,{to:`/settings/agent-defaults#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,X.jsx)(OS,{planFirst:t,planning:n,onModeChange:r}),(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`hidden rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground md:inline`,children:Jv()})]})}function CS({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"aria-label":`Worktree`,"data-slot":`worktree-toggle`,onClick:()=>r(!e),title:t?n:e?`Runs in an isolated worktree — uncheck to run in the repo working tree`:`Runs in the repo working tree — check to isolate in a worktree`,className:`flex items-center justify-between gap-3 px-0 py-3 text-left`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Worktree`}),(0,X.jsx)(`span`,{className:`block text-[12px] text-muted-foreground`,children:e?`Changes stay in a separate working copy.`:`Changes are made in the current working directory.`})]}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:c(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,X.jsx)(`span`,{className:c(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function wS({on:e,disabled:t,onChange:n}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"aria-label":`Autonomous`,"data-slot":`autonomous-toggle`,onClick:()=>n(!e),title:t?`Plan-first runs are interactive — autonomous is unavailable`:e?`Autonomous — the agent runs to completion without pausing for you`:`Runs interactively — check to let the agent finish without pausing for you`,className:`flex items-center justify-between gap-3 px-0 py-3 text-left disabled:opacity-50`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Autonomous`}),(0,X.jsx)(`span`,{className:`block text-[12px] text-muted-foreground`,children:`Let the agent proceed without prompts`})]}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:c(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,X.jsx)(`span`,{className:c(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function TS({on:e,targets:t,onChange:n}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"aria-label":`Notify webhook`,"data-slot":`notify-webhook-toggle`,onClick:()=>n(!e),title:`${e?`Status changes go to`:`Check to send this task's status changes to`} ${ox(t)} (${t.map(e=>ix(e.url)).join(`, `)})`,className:`flex min-h-11 items-center justify-between gap-3 px-0 py-3 text-left`,children:[(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Notify webhook`}),(0,X.jsx)(`span`,{"data-slot":`notify-webhook-subtitle`,className:`block truncate text-[12px] text-muted-foreground`,children:`Send status changes`})]}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:c(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,X.jsx)(`span`,{className:c(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function ES({repo:e}){return(0,X.jsxs)(`div`,{"data-slot":`base-branch-row`,className:`new-task-base-branch flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:`Base branch`}),e?(0,X.jsx)(DS,{repo:e}):null]})}function DS({repo:e}){let t=F(),n=qt({mutationFn:e=>k({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:on.repo}),V(e.baseBranch?`New tasks will branch off "${e.baseBranch}" (PRs target it too).`:`Base branch cleared — new tasks fork from the checked-out branch.`)},onError:e=>V(e.message,{tone:`danger`})});return e.info?(0,X.jsx)(qb,{searchPlaceholder:`Search branches…`,slot:`base-pill`,ariaLabel:`Base branch`,label:(0,X.jsx)(`span`,{className:`text-[11px]`,children:e.baseBranch??e.info.branch}),value:e.baseBranch??``,onPick:e=>n.mutate(e===``?null:e),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}function OS({planFirst:e,planning:t,onModeChange:n}){return(0,X.jsxs)(`div`,{"data-slot":`mode-seg`,role:`radiogroup`,"aria-label":`Run mode`,className:`inline-flex items-center gap-0.5 rounded-lg bg-muted p-[3px]`,children:[(0,X.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":!e,onClick:()=>n(!1),className:c(`h-6 rounded-md px-2 text-xs transition-colors`,e?`font-medium text-muted-foreground hover:text-foreground`:`bg-card font-semibold text-foreground shadow-xs`),children:[e?null:(0,X.jsx)(_r,{"aria-hidden":`true`,className:`size-3.5`}),`Start`]}),(0,X.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-busy":t||void 0,"data-slot":`mode-plan`,onClick:()=>n(!0),className:c(`h-6 rounded-md px-2 text-xs transition-colors`,e?`bg-contrast font-semibold text-contrast-foreground ring-2 ring-ring/55`:`font-medium text-muted-foreground hover:text-foreground`,t&&`animate-pulse`),children:t?`Planning…`:`Plan first`})]})}function kS({plan:e,starting:t,startAvailable:n,startUnavailableReason:r,startUnavailableAction:i,onStepsChange:a,onStart:o,onDiscard:s}){let[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(null),p=(0,Y.useRef)(null),m=(0,Y.useId)();(0,Y.useEffect)(()=>{p.current?.focus({preventScroll:!0});let e=p.current?.closest(`[data-slot="main"]`);e&&(e.scrollTop=0)},[]);let h=()=>{u(null),f(null)},g=(t,n)=>{t.preventDefault(),l!==null&&l!==n&&a(Kx(e.steps,l,n)),h()},_=e.steps.length===0;return(0,X.jsxs)(`div`,{"data-slot":`plan-page`,children:[(0,X.jsxs)(`header`,{"data-slot":`plan-page-header`,children:[(0,X.jsx)(`h1`,{children:`New task / Plan first`}),(0,X.jsx)(`p`,{children:`Review the proposed chain before launching.`})]}),(0,X.jsx)(`div`,{"data-slot":`plan-canvas`,children:(0,X.jsxs)(`section`,{ref:p,tabIndex:-1,"aria-labelledby":m,"data-slot":`plan-review`,className:`flex flex-col outline-none`,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||e.target.closest(`[role="dialog"], [role="alertdialog"]`)||(e.preventDefault(),s())},children:[(0,X.jsxs)(`header`,{"data-slot":`dialog-header`,className:`flex flex-col gap-1 px-5 pt-4 pb-3.5 text-left`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsx)(`h2`,{id:m,"data-slot":`dialog-title`,className:`text-[11px] font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:`Proposed chain`}),(0,X.jsx)(`button`,{type:`button`,onClick:s,"aria-label":`Discard the plan`,className:`-mt-1 -mr-1 rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,X.jsx)(xr,{"aria-hidden":`true`,className:`size-4`})})]}),(0,X.jsx)(`p`,{"data-slot":`plan-task`,title:e.task,className:`text-[18px] font-medium text-foreground`,children:Jx(e.task)}),e.fallback?(0,X.jsx)(`p`,{"data-slot":`plan-fallback`,className:`text-xs text-soft-foreground italic`,children:`planner unavailable — single-step plan`}):e.rationale===``?null:(0,X.jsx)(`p`,{"data-slot":`plan-rationale`,className:`text-xs text-muted-foreground`,children:e.rationale})]}),(0,X.jsx)(`ol`,{"data-slot":`plan-steps`,className:`flex-1 space-y-2 overflow-y-auto px-5 py-4`,children:_?(0,X.jsx)(`li`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`(no steps left — discard and plan again)`}):e.steps.map((t,n)=>(0,X.jsxs)(`li`,{"data-slot":`plan-step`,"data-step-id":t.id,draggable:!0,onDragStart:()=>u(n),onDragOver:e=>{e.preventDefault(),f(n)},onDragLeave:()=>f(e=>e===n?null:e),onDrop:e=>g(e,n),onDragEnd:h,className:c(`flex items-center gap-2.5 rounded-lg border border-border bg-card-2 px-3 py-2.5`,l===n&&`opacity-50`,d===n&&l!==null&&l!==n&&`border-ring`),children:[(0,X.jsx)(sr,{"aria-hidden":`true`,className:`size-3.5 shrink-0 cursor-grab text-soft-foreground`}),(0,X.jsx)(`span`,{className:`w-5 shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:String(n+1).padStart(2,`0`)}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium`,children:t.name??t.id}),t.skill?(0,X.jsx)(`span`,{"data-slot":`plan-badge-skill`,title:`skill`,className:`shrink-0 rounded-full bg-accent-strong/15 px-1.5 py-px font-mono text-[11px] font-medium text-accent-text`,children:t.skill}):null,t.command?(0,X.jsx)(`span`,{"data-slot":`plan-badge-check`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[11px] font-medium text-muted-foreground`,children:`check`}):null]}),(0,X.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap break-words font-mono text-[11px] text-muted-foreground`,children:qx(t)})]}),(0,X.jsxs)(`span`,{"data-slot":`plan-step-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-up`,"aria-label":`Move step ${n+1} up`,disabled:n===0,className:`size-7 text-muted-foreground`,onClick:()=>a(Kx(e.steps,n,n-1)),children:`Move up`}),(0,X.jsx)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-down`,"aria-label":`Move step ${n+1} down`,disabled:n===e.steps.length-1,className:`size-7 text-muted-foreground`,onClick:()=>a(Kx(e.steps,n,n+1)),children:`Move down`}),(0,X.jsx)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-remove`,"aria-label":`Remove step ${n+1}`,className:`size-7 text-muted-foreground hover:text-danger`,onClick:()=>a(Gx(e.steps,n)),children:`Remove`})]})]},t.id))}),!n&&r?(0,X.jsxs)(`p`,{id:`plan-start-guidance`,className:`flex flex-wrap items-center gap-1.5 border-t border-border px-5 pt-3 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:r}),i]}):null,(0,X.jsxs)(`div`,{"data-slot":`plan-actions`,className:`flex flex-wrap items-center gap-3 px-6 pt-3 pb-6`,children:[(0,X.jsxs)(U,{type:`button`,"data-slot":`plan-start`,disabled:_||t||!n,title:n?void 0:r,"aria-describedby":!n&&r?`plan-start-guidance`:void 0,onClick:o,children:[(0,X.jsx)(xi,{"aria-hidden":`true`,className:`size-3.5`}),t?`Starting…`:`Start`]}),(0,X.jsx)(AS,{steps:e.steps,disabled:_}),(0,X.jsx)(U,{type:`button`,variant:`outline`,onClick:s,children:`Discard`})]}),(0,X.jsx)(`p`,{className:`px-6 pb-6 text-xs text-muted-foreground`,children:`No steps left? Start is disabled. A planner failure shows a single-step fallback.`})]})})]})}function AS({steps:e,disabled:t}){let n=F(),[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1),d=async t=>{let r=a.trim();if(!(r===``||l)){u(!0);try{let a=await ce({name:r,steps:e,...t?{overwrite:!0}:{}});V(`Saved — ${a.path.split(`/`).pop()??a.path}`),n.invalidateQueries({queryKey:on.workflows}),c(!1),i(!1),o(``)}catch(e){e instanceof je&&e.exists===!0?c(!0):V(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{u(!1)}}};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(U,{type:`button`,variant:`outline`,"data-slot":`plan-save`,disabled:t,onClick:()=>i(!0),children:`Save as chain`}),(0,X.jsx)(wa,{open:r,onOpenChange:e=>i(!!e),children:(0,X.jsxs)(Sa,{"data-slot":`plan-save-dialog`,className:`sm:max-w-sm`,showCloseButton:!1,children:[(0,X.jsxs)(xa,{children:[(0,X.jsx)(Ca,{children:`Save as chain`}),(0,X.jsx)(ya,{children:`Saves these steps as a reusable workflow — it joins the picker like any other chain.`})]}),(0,X.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d(!1)},children:[(0,X.jsx)(`label`,{htmlFor:`plan-chain-name`,className:`mb-2 block text-[11px] text-muted-foreground`,children:`Chain name`}),(0,X.jsx)(ol,{id:`plan-chain-name`,value:a,onChange:e=>o(e.target.value),"aria-label":`Chain name`,placeholder:`e.g. fix-and-verify-v2`,maxLength:80,autoFocus:!0}),(0,X.jsxs)(va,{className:`mt-4`,children:[(0,X.jsx)(U,{type:`button`,variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,X.jsx)(U,{type:`submit`,disabled:a.trim()===``||l,children:l?`Saving…`:`Save chain`})]})]})]})}),(0,X.jsx)(_g,{open:s,onOpenChange:e=>e?void 0:c(!1),children:(0,X.jsxs)(bg,{"data-slot":`plan-overwrite-dialog`,children:[(0,X.jsxs)(xg,{children:[(0,X.jsxs)(Cg,{children:[`Overwrite “`,a.trim(),`”?`]}),(0,X.jsx)(wg,{children:`A chain with this name already exists. Overwriting replaces its steps with this plan.`})]}),(0,X.jsxs)(Sg,{children:[(0,X.jsx)(Eg,{children:`Cancel`}),(0,X.jsx)(Tg,{onClick:()=>void d(!0),children:`Overwrite chain`})]})]})})]})}var jS={start:{note:`Start immediately with the selected configuration.`,pendingLabel:`Starting task…`,failureHint:void 0,clearOnSuccess:!0,sendAriaLabel:`Start task`},plan:{note:`Review the plan before starting the task.`,pendingLabel:`Planning task…`,failureHint:`Could not create the plan. Your draft is kept. Please retry.`,clearOnSuccess:!1,sendAriaLabel:`Plan task`}};function MS(){let[e]=_n(),t=(0,Y.useRef)(null),n=(0,Y.useRef)(null),r=(0,Y.useRef)(null),{projectId:i}=vn(),a=He().projectId,o=At().data,[s]=(0,Y.useState)(()=>e.toString()),[c]=(0,Y.useState)(()=>Rd(s,o)),l=Rd(s,o).runner,u=Bt(),d=Ot(),f=en(),p=ct(),{draft:m,update:h,clearStarted:g,submissionPending:_,mounted:v}=Qx(a,c,l),y=Sx(a),b=tS(m,f),x=nS(b.displayRunner,m.agentProfile),S=$x(m.source,d,b.displayRunner,x.agentProfile),{source:C,sourcesReady:w,skillList:T}=S,E=aS(i),D=eS({uiState:d,source:C,sourcesReady:w,draftText:m.text,submissionPending:_,update:h});rS(b.providersReady);let O=u.data===void 0||u.data.info!==null,k=iS({hasGit:O,draft:m,selectedSkill:S.selectedSkill,workspaceConfig:p,source:C}),{plan:A,setPlan:j,planning:M,starting:ee,submit:te,startPlanned:ne}=fS({draft:m,draftProjectId:a,engine:b,agentProfile:x.agentProfile,accountsSettled:x.accountsSettled,sourcesReady:w,source:C,runMode:k,notifyOn:E.notifyOn,uiState:d,mounted:v,clearStarted:g});sS({deepLink:c,search:e,sourcesReady:w&&S.skillsSettled&&!b.providers.isPending&&x.accountsSettled,listUnchecked:S.listUnchecked,skillList:T,update:h});let re=oS(t),{providers:ie,providersReady:N}=b,P=m.planFirst?jS.plan:jS.start,ae=uS(ie);return(0,X.jsxs)(`div`,{"data-route":`new`,"data-plan-review":A===null?void 0:`true`,className:`relative isolate flex min-h-full flex-col overflow-x-clip pb-16`,children:[(0,X.jsxs)(`div`,{"data-slot":`new-task-layout`,"data-persisted-draft":y||void 0,ref:r,style:A===null?void 0:{display:`none`},className:`relative z-[1] mx-auto w-full max-w-none px-11 pt-12 max-md:px-[18px] max-md:pt-[22px]`,children:[(0,X.jsx)(gS,{}),(0,X.jsx)(Nb,{ref:n,onSubmit:te,retainDraftUntilSuccess:!0,idleFeedback:(0,X.jsxs)(`div`,{"data-slot":`new-task-mode-note`,className:`flex items-center justify-between gap-3 text-[11px] text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:P.note}),(0,X.jsx)(`kbd`,{className:`hidden font-sans md:inline`,children:Jv()})]}),pendingLabel:P.pendingLabel,failureHint:P.failureHint,clearOnSuccess:P.clearOnSuccess,onPendingChange:e=>{_.current=e},value:m.text,onValueChange:e=>h({text:e}),draftPersisted:y,autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:P.sendAriaLabel,disabled:!N||ee,disabledReason:ae,autocompleteSkills:!0,skillRunner:b.displayRunner,skillAccount:x.agentProfile,footerStart:(0,X.jsx)(NS,{projects:E.projectList,urlProjectId:i,templates:D,onInsertTemplate:e=>n.current?.insertAtCaret(e),sources:S,onPickSource:e=>h({source:e})}),agentOptions:(0,X.jsx)(_S,{groupRef:t,compact:re,engine:b,accounts:x,draftEffort:m.effort,update:h}),executionOptions:(0,X.jsx)(xS,{engine:b,draft:m,update:h,repo:u.data,hasGit:O,runMode:k,webhook:{targets:E.webhookTargets,on:E.notifyOn,onChange:E.setNotifyChoice},completionDisabled:ee||M}),footerEnd:(0,X.jsx)(SS,{showConfigureProviders:!N&&!ie.isPending,planFirst:m.planFirst,planning:M,onModeChange:e=>h({planFirst:e})})}),(0,X.jsx)(`p`,{"data-slot":`run-mode-note`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:ux({worktree:k.worktree,hasGit:O})})]}),A===null?null:(0,X.jsx)(kS,{plan:A,starting:ee,startAvailable:N,startUnavailableReason:ae,startUnavailableAction:ie.isPending?void 0:(0,X.jsx)(G,{to:`/settings/agent-defaults#providers`,children:`Configure providers`}),onStepsChange:e=>j(t=>t&&{...t,steps:e}),onStart:()=>void ne(),onDiscard:()=>{j(null),requestAnimationFrame(()=>r.current?.querySelector(`textarea`)?.focus())}})]})}function NS({projects:e,urlProjectId:t,templates:n,onInsertTemplate:r,sources:i,onPickSource:a}){let o=Da();return(0,X.jsxs)(X.Fragment,{children:[e.length>1&&t!==void 0?(0,X.jsx)(FS,{projects:e,projectId:t,onPick:e=>o(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}):null,(0,X.jsx)(Zb,{label:`Template`,templates:n,onInsert:r}),(0,X.jsx)(US,{source:i.source,unchecked:i.unchecked,ready:i.sourcesReady,skills:i.skillList,skillUsage:i.skillUsage,workflows:i.workflowList,onPick:a})]})}function PS(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 FS({projects:e,projectId:t,onPick:n}){let[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(``),{order:s}=jf(),l=e.find(e=>e.id===t),u=PS(po(e,s),a);return(0,X.jsxs)(ga,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,X.jsx)(fa,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`project-pill`,"aria-label":`Project`,title:`Which project this task runs in — its skills, workflows, settings and draft`,className:c(Pb,`border-foreground/60 font-semibold text-foreground`),children:[(0,X.jsx)(tr,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,X.jsx)(`span`,{className:`max-w-40 truncate`,children:l?.name??t}),Fb]})}),(0,X.jsx)(ha,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(fo,{shouldFilter:!1,children:[(0,X.jsx)(io,{placeholder:`search projects…`,value:a,onValueChange:o}),(0,X.jsxs)(uo,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[u.length===0?(0,X.jsx)(lo,{children:`Nothing matches.`}):null,u.map(e=>(0,X.jsxs)(co,{value:e.id,keywords:[e.name],"data-slot":`project-option`,"data-project-id":e.id,disabled:e.status===`missing`,onSelect:()=>{n(e.id),i(!1)},children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,X.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground`,children:e.branch}),e.id===t?(0,X.jsx)(_r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.id))]}),(0,X.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-[11px] leading-snug text-soft-foreground`,children:`Skills, workflows, settings and the draft re-resolve against the selected project.`})]})})]})}function IS(e,t,n){return!e&&(t.ranked?t.ranked.length===0:t.mostUsed.length===0&&t.project.length===0&&t.global.length===0)&&n.length===0}function LS(e,t){return _o(`no skill`,`none plain ${wx} ${e?.description??``}`,t)>0}function RS({source:e,ready:t,offersWorkflows:n,onPick:r,skillLabel:i}){let a=e===null||e.source===`skill`?zr:Vr;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`source-pill`,"data-source-kind":e?.source??`none`,"aria-label":`Choose a skill or workflow`,title:e===null?`No skill — the task runs as one plain agent step. Pick a skill or workflow to change that.`:`Runs the ${e.source} "${e.ref}" — pick it again, or press ✕, to run without it`,disabled:!t,onKeyDown:t=>{e===null||t.metaKey||t.ctrlKey||t.altKey||t.key!==`Backspace`&&t.key!==`Delete`||(t.preventDefault(),r(null))},className:c(Pb,`font-mono text-[11px]`,e===null?`text-muted-foreground`:`rounded-r-none border-r-0 border-foreground/60 pr-1.5 font-semibold text-foreground`),children:[(0,X.jsx)(a,{"aria-hidden":`true`,className:c(`size-3 shrink-0`,e===null?`text-muted-foreground`:`text-accent-icon`)}),(0,X.jsx)(`span`,{className:`max-w-44 truncate`,children:t?i??e?.ref??(n?`Skill or workflow`:`Skill`):`…`}),Fb]})}function zS({source:e,quickTask:t,onPick:n}){return(0,X.jsx)(J,{children:(0,X.jsxs)(co,{value:`none no-skill`,keywords:[`none`,`plain`,...Co(wx)],"data-slot":`source-option`,"data-source-kind":`none`,onSelect:()=>n(null),children:[(0,X.jsx)(Cr,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:`No skill`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t?.description??`One agent run on your task — no ceremony.`}),e===null?(0,X.jsx)(_r,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]})})}function BS({ranked:e,mostUsed:t,project:n,skillItem:r}){return(0,X.jsx)(X.Fragment,{children:e?e.length>0?(0,X.jsx)(J,{children:e.map(e=>r(e,bo(e)))}):null:(0,X.jsxs)(X.Fragment,{children:[t.length>0?(0,X.jsx)(J,{heading:`Most used`,children:t.map(e=>r(e,bo(e)))}):null,n.length>0?(0,X.jsx)(J,{heading:`Project skills`,children:n.map(e=>r(e,!0))}):null]})})}function VS({source:e,matchedWorkflows:t,toggle:n}){return t.length>0?(0,X.jsx)(J,{heading:`Workflows`,children:t.map(t=>{let r=e?.source===`workflow`&&e.ref===t.name;return(0,X.jsxs)(co,{value:`workflow ${t.name}`,keywords:Co(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>n({source:`workflow`,ref:t.name}),children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:t.name}),t.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,r?(0,X.jsx)(_r,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},t.name)})}):null}function HS({global:e,skillItem:t}){return e.length>0?(0,X.jsx)(J,{heading:`Global`,children:e.map(e=>t(e,!1))}):null}function US({source:e,unchecked:t,ready:n,skills:r,skillUsage:i,workflows:a,onPick:o}){let[s,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(null),m=(0,Y.useRef)(null),{mostUsed:h,project:g,global:_,ranked:v}=Eo(r,u,i),y=a.find(e=>e.name===wx),b=vo(a,u).filter(e=>e.name!==wx),x=a.some(e=>e.name!==wx),S=LS(y,u),C=IS(S,{ranked:v,mostUsed:h,project:g,global:_},b),w=e=>{o(e),l(!1)},T=t=>w(e?.source===t.source&&e.ref===t.ref&&(e.source!==`skill`||t.source!==`skill`||e.path===t.path)?null:t),E=(t,n)=>{let r=e?.source===`skill`&&e.ref===t.id&&e.path===t.path;return(0,X.jsxs)(co,{value:yo(t),keywords:Co(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.id,onSelect:()=>T({source:`skill`,ref:t.id,...t.path===void 0?{}:{path:t.path}}),children:[(0,X.jsx)(kv,{skill:t,emphasized:n}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`source-skill-view`,"aria-label":`View skill ${t.name}`,title:`View skill`,onClick:e=>{e.preventDefault(),e.stopPropagation(),p(t)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,X.jsx)(hi,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,X.jsx)(_r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},yo(t))},D=RS({source:e,ready:n,offersWorkflows:x,onPick:o,skillLabel:e?.source===`skill`?r.find(t=>t.id===e.ref&&(e.path===void 0||e.path===t.path))?.name:void 0});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(rx,{skill:f,onClose:()=>p(null)}),(0,X.jsxs)(ga,{open:s,onOpenChange:e=>{l(e),e||d(``)},children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,X.jsx)(fa,{asChild:!0,children:D}),e?.source===`skill`&&t?(0,X.jsx)(`span`,{role:`status`,children:`Unchecked`}):null,e!==null&&n?(0,X.jsx)(`button`,{type:`button`,"data-slot":`source-pill-clear`,"aria-label":`Clear the ${e.source} ${e.ref}`,title:`Run without it`,onClick:()=>o(null),className:c(Pb,`rounded-l-none border-foreground/60 pl-1.5 pr-2 text-soft-foreground hover:text-foreground`),children:(0,X.jsx)(xr,{"aria-hidden":`true`,className:`size-3`})}):null]}),(0,X.jsx)(ha,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(fo,{shouldFilter:!1,children:[(0,X.jsx)(io,{placeholder:`search skills & workflows…`,value:u,onValueChange:d,onInput:()=>m.current?.scrollTo(0,0)}),(0,X.jsxs)(uo,{ref:m,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[u.trim()&&!r.some(e=>e.id===u.trim())?(0,X.jsx)(J,{children:(0,X.jsxs)(co,{value:`typed-skill`,onSelect:()=>w({source:`skill`,ref:u.trim(),typed:!0}),children:[`Use skill id “`,u.trim(),`” (unchecked)`]})}):null,C?(0,X.jsx)(lo,{children:`Nothing matches.`}):null,S?(0,X.jsx)(zS,{source:e,quickTask:y,onPick:w}):null,(0,X.jsx)(BS,{ranked:v,mostUsed:h,project:g,skillItem:E}),(0,X.jsx)(VS,{source:e,matchedWorkflows:b,toggle:T}),(0,X.jsx)(HS,{global:_,skillItem:E})]})]})})]})]})}function WS(){return(0,X.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(ko,{icon:(0,X.jsx)(ds,{}),tone:`neutral`,title:`Page not found`,subtitle:`Nothing lives at this address. The link may be mistyped, or it points at something that is gone.`,actions:(0,X.jsx)(U,{asChild:!0,variant:`outline`,children:(0,X.jsx)(G,{to:`/`,children:`Back to tasks`})})})})}function GS(){return(0,X.jsx)(`div`,{className:`px-[18px] pt-2 md:hidden`,children:(0,X.jsxs)(G,{to:`/git`,"data-slot":`git-back`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,X.jsx)(Fr,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to Git`]})})}function KS(){let{pathname:e,search:t}=gn();return(0,X.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[Aa(e)!==`/git`||new URLSearchParams(t).get(`view`)===`repo`?(0,X.jsx)(GS,{}):null,(0,X.jsx)(ko,{icon:(0,X.jsx)(gi,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})]})}function qS(){return(0,X.jsxs)(`div`,{"data-route":`skills`,"aria-busy":`true`,className:`mx-auto min-h-full w-full max-w-[1100px] px-[18px] py-6 md:p-9`,children:[(0,X.jsx)(`h1`,{className:`text-[25px] font-semibold tracking-tight md:text-[30px]`,children:`Skills`}),(0,X.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`The skills each agent loads in this project, as its runner reports them.`}),(0,X.jsx)(`p`,{"data-slot":`skills-loading`,role:`status`,className:`mt-6 text-xs text-muted-foreground`,children:`Loading skills…`}),(0,X.jsxs)(`div`,{"aria-hidden":`true`,className:`mt-4 flex flex-col gap-[22px] motion-safe:animate-pulse`,children:[(0,X.jsx)(`div`,{className:`h-11 rounded-lg border border-border bg-card`}),(0,X.jsx)(`div`,{className:`h-80 rounded-xl border border-border bg-card`})]})]})}function JS({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,X.jsx)(`div`,{"data-route":`unknown-project`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(ko,{icon:(0,X.jsx)(ys,{}),tone:`neutral`,title:`“${e}” isn’t registered here`,subtitle:`This Squawk doesn’t serve a project by that id. The link may come from another machine’s workspace — these are the projects registered on this one:`,children:(0,X.jsx)(`ul`,{"data-slot":`registered-projects`,className:`mx-auto flex w-full max-w-xs flex-col gap-1.5 text-left`,children:n.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(z,{to:`/p/${encodeURIComponent(e.id)}/`,className:`flex items-baseline gap-2 rounded-md border border-border bg-card px-3 py-2 text-sm font-medium text-foreground shadow-xs transition-colors hover:bg-card-2`,children:[e.name||e.id,(0,X.jsxs)(`span`,{className:`font-mono text-[11px] font-normal text-soft-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function YS(){return(0,X.jsxs)(`div`,{"data-route":`workflows`,"aria-busy":`true`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,X.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`Workflows`}),(0,X.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`Portable skill chains. Steps run from top to bottom.`}),(0,X.jsx)(`p`,{"data-slot":`workflows-loading`,role:`status`,className:`mt-6 text-xs text-muted-foreground`,children:`Loading workflows…`}),(0,X.jsxs)(`div`,{"aria-hidden":`true`,className:`mt-4 flex flex-col gap-[22px] motion-safe:animate-pulse`,children:[(0,X.jsx)(`div`,{className:`h-11 rounded-lg border border-border bg-card`}),(0,X.jsx)(`div`,{className:`h-80 rounded-xl border border-border bg-card`})]})]})}function XS({tab:e}){return(0,X.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(ko,{icon:(0,X.jsx)(gi,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:e===`changes`?`Loading changes…`:`Loading files…`,subtitle:`Fetching the run record.`})})}function ZS({tab:e,error:t}){let n=t instanceof je&&t.status===404;return(0,X.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(ko,{icon:n?(0,X.jsx)(Oi,{}):(0,X.jsx)(Mr,{size:16}),tone:n?`neutral`:`danger`,title:n?`Task not found`:`Could not load this task`,subtitle:n?`No run has this id. It may have been deleted, or the link is from another machine.`:t.message,actions:(0,X.jsx)(U,{asChild:!0,variant:`outline`,children:(0,X.jsx)(G,{to:`/`,children:`Back to tasks`})})})})}var QS={issue:`issue`,pr:`pull request`};function $S({kind:e,number:t,heading:n=`h1`}){let r=(0,X.jsx)(`div`,{"data-slot":`task-github-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,X.jsx)(ko,{icon:(0,X.jsx)(gi,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:n,title:`Loading ${QS[e]}${t===void 0?``:` #${t}`}…`,subtitle:t===void 0?`Fetching the run record.`:`Asking GitHub.`})});return n===`h2`?r:(0,X.jsx)(`div`,{"data-route":`task-github-item`,className:`flex min-h-full flex-col`,children:r})}function eC(){return(0,X.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(ko,{icon:(0,X.jsx)(gi,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}async function tC(e,t,n,r,i){try{return await Vo(e,{queryKey:[t,`runs`,`artifact-metadata`,n,r],queryFn:({signal:e})=>p(n,r,{signal:e})},i),!0}catch(e){if(e instanceof je&&e.status===404)return!1;throw e}}async function nC(e,t,n,r,i,a){if(await tC(e,t,n,r,i))return n;i.throwIfAborted();let o=await Vo(e,{queryKey:[t,`runs`,`relationships`,n],queryFn:({signal:e})=>se(n,{signal:e})},i),s=new Set(o.workers.map(e=>e.workerId));a&&s.add(a),s.delete(n);for(let n of s){if(i.aborted)throw i.reason;if(await tC(e,t,n,r,i))return n}throw new je(404,`Report missing or deleted`)}function rC(e,t,n){let r=F(),i=a();return pn({queryKey:[i,`runs`,`report-source`,e,t,n],queryFn:({signal:a})=>nC(r,i,e,t,a,n),enabled:!!(e&&t),retry:!1})}function iC(){let[e]=_n(),t=gn(),n=Sn(),r=xn(),i=Y.useRef(Math.random()),a=Y.useRef({renderedKey:``,next:e,seq:0,latestSeq:0});return Y.useLayoutEffect(()=>{if(a.current.renderedKey===t.key)return;let n=t.state,o=n?.__writerSession===i.current?n.__writerSeq:void 0;r===`REPLACE`&&o!==void 0&&o<=a.current.latestSeq?(a.current.renderedKey=t.key,o===a.current.latestSeq&&(a.current.next=e)):a.current={renderedKey:t.key,next:e,seq:a.current.seq,latestSeq:0}},[e,t,r]),[e,Y.useCallback(e=>{let t=e(new URLSearchParams(a.current.next));if(t.toString()===a.current.next.toString())return;let r=a.current.seq+1;a.current={...a.current,next:t,seq:r,latestSeq:r},n({search:`?${t}`},{replace:!0,state:{__writerSession:i.current,__writerSeq:r}})},[n])]}var aC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function oC(e){let t=e.get(`report`);return!t||!aC.test(t)||e.getAll(`report`).length!==1||e.getAll(`card`).length>1?null:{artifactId:t,card:e.get(`card`)||null}}var sC=(0,Y.createContext)(null);function cC(e){let t=gn(),n=Sn(),[r,i]=iC(),a=oC(r),[o,s]=(0,Y.useState)(()=>({runId:e,entries:new Map}));o.runId!==e&&s({runId:e,entries:new Map});let c=(0,Y.useCallback)((t,n)=>(s(r=>{if(r.runId===e&&r.entries.get(t)===n)return r;let i=new Map(r.runId===e?r.entries:[]);return i.set(t,n),{runId:e,entries:i}}),()=>void 0),[e]),l=(0,Y.useRef)({runId:e,callbacks:new Map});l.current.runId!==e&&(l.current={runId:e,callbacks:new Map});let u=(0,Y.useCallback)((e,t)=>(l.current.callbacks.set(e,t),()=>{l.current.callbacks.get(e)===t&&l.current.callbacks.delete(e)}),[]),d=(0,Y.useMemo)(()=>({register:c,registerOpener:u}),[c,u]),f=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{r.has(`report`)&&!a&&i(e=>(e.delete(`report`),e.delete(`card`),e))},[r,a,i]),(0,Y.useEffect)(()=>{let n=f.current;!a&&n&&n.runId===e&&n.card&&l.current.callbacks.get(n.card)?.(n.artifactId,n.scrollTop),f.current=a?{...a,runId:e,scrollTop:t.state?.reportScrollTop}:null},[e,a,t.state]),{selection:a,sourceRunId:o.runId===e&&a?o.entries.get(a.artifactId)??(a.card?void 0:e):void 0,registry:d,close:()=>{let e=t.state,r=window.navigation;if(e?.reportReturnKey&&r){r.traverseTo(e.reportReturnKey);return}if(e?.reportReturnTo){n(e.reportReturnTo,{replace:!0});return}i(e=>(e.delete(`report`),e.delete(`card`),e))}}}var lC=class extends Y.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){console.error(`Squawk cockpit: the preview pane crashed`,e,t.componentStack)}render(){return this.state.failed?(0,X.jsxs)(`div`,{"data-slot":`preview-pane-error`,role:`alert`,className:`flex h-full flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,X.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:`The preview hit an error`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The task is unaffected. Close the preview and open it again.`}),(0,X.jsx)(U,{variant:`outline`,onClick:this.props.onClose,children:`Close preview`})]}):this.props.children}},uC=`cez-preview-tasks`,dC=`cez.preview.pane-width`,fC=e=>Math.min(75,Math.max(30,Math.round(e)));function pC(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function mC(e){if(!pC(e))return;let{port:t,agent:n,url:r}=e;if(typeof t==`number`&&Number.isInteger(t)&&t>=1&&t<=65535)return{port:t};if(n===!0)return{agent:!0};if(typeof r==`string`&&/^https?:\/\//i.test(r))return{url:r}}function hC(e){if(!pC(e))return;let t=mC(e.target),n=typeof e.percent==`number`&&Number.isFinite(e.percent)?e.percent:void 0;return{open:e.open===!0,...t?{target:t}:{},...n===void 0?{}:{percent:n},at:typeof e.at==`number`?e.at:0}}function gC(){try{let e=localStorage.getItem(uC),t=e===null?null:JSON.parse(e);return pC(t)?t:{}}catch{return{}}}function _C(e){let t=hC(gC()[e]);if(!t)return;let{at:n,...r}=t;return r}function vC(e,t,n=Date.now()){let r=gC(),i={open:!1,...hC(r[e]),...t,at:n};for(let e of Object.keys(i))i[e]===void 0&&delete i[e];r[e]=i;let a=Object.keys(r);if(a.length>100){let e=e=>hC(r[e])?.at??0;for(let t of a.sort((t,n)=>e(t)-e(n)).slice(0,a.length-100))delete r[t]}try{localStorage.setItem(uC,JSON.stringify(r))}catch{}}function yC(){try{let e=Number(localStorage.getItem(dC));return e>0?e:void 0}catch{return}}function bC(e){let t=(e===void 0?void 0:_C(e)?.percent)??yC();return t===void 0?58:fC(t)}function xC(e,t){try{localStorage.setItem(dC,String(t))}catch{}e!==void 0&&vC(e,{percent:t})}var SC=`(min-width: 1180px)`,CC=`(max-width: 767px)`;function wC(e,t){let[n,r]=(0,Y.useState)(()=>window.matchMedia?.(e).matches??t);return(0,Y.useEffect)(()=>{let t=window.matchMedia?.(e);if(!t)return;let n=()=>r(t.matches);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),n}var TC=(0,Y.lazy)(()=>R(()=>import(`./preview-pane-connected-BdpApHW4.js`).then(e=>({default:e.ConnectedPreviewPane})),__vite__mapDeps([64,1,2,7,8,6,9,15,19,65,66,28,24,67,68,60,69,70,44,71,72,73,61,23,30,31,62,18,29,48,41,56,16,17]))),EC=2;function DC(e){let[t,n]=(0,Y.useState)(void 0);return(0,Y.useEffect)(()=>{let t=e.current?.closest(`[data-slot="main"]`);if(!t)return;let r=()=>n(t.clientHeight||void 0);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function OC({run:e,state:t,children:n,report:r}){let i=wC(SC,!0),a=wC(CC,!1),o=(0,Y.useRef)(null),s=DC(o),{percent:c,setPercent:l}=t,u=!!r||t.open&&e!==void 0,d=u&&!i,f=!r&&t.session,p=d&&!f,m=d&&f,h=e=>{let t=o.current?.getBoundingClientRect();!t||t.width===0||l(fC((t.right-e)/t.width*100))},g=e=>{e.currentTarget.setPointerCapture?.(e.pointerId)},_=e=>{e.currentTarget.hasPointerCapture?.(e.pointerId)&&h(e.clientX)},v=e=>{if(e.key===`ArrowLeft`)l(fC(c+EC));else if(e.key===`ArrowRight`)l(fC(c-EC));else return;e.preventDefault()},y={"--preview-pane":`${c}%`,...s===void 0?{}:{"--preview-h":`${s}px`}};return(0,X.jsxs)(`div`,{ref:o,"data-slot":`task-split`,"data-pane":u?`open`:`closed`,"data-takeover":p?``:void 0,className:`preview-split flex min-h-full`,style:y,children:[(0,X.jsx)(`div`,{"data-slot":`task-main`,hidden:p&&a,"data-collapsed":p&&!a?``:void 0,className:`min-w-0 flex-1`,children:n}),u?(0,X.jsxs)(X.Fragment,{children:[i?(0,X.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize preview`,"aria-valuemin":30,"aria-valuemax":75,"aria-valuenow":c,tabIndex:0,"data-slot":`preview-divider`,className:`preview-divider`,onPointerDown:g,onPointerMove:_,onKeyDown:v}):null,(0,X.jsxs)(`aside`,{"data-slot":`preview-pane`,"data-phone":a?``:void 0,hidden:m,className:`preview-pane`,children:[r,(0,X.jsx)(`div`,{hidden:!!r,className:`h-full`,children:t.open&&e?(0,X.jsx)(lC,{onClose:t.closePane,children:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,className:`p-6 text-sm text-muted-foreground`,children:`Opening the preview…`}),children:(0,X.jsx)(TC,{run:e,servers:e.previewServers??[],request:t.request,onSession:p?t.showSession:void 0,onTarget:t.setTarget,onLive:t.setLive,onClose:t.closePane},e.id)})}):null})]})]}):null]})}function kC(e){if(!e.worktreePath||e.worktreeReclaimedAt)return!0;let t=e.delegation?.role===`worker`?e.delegation.destroy:void 0;return t!==void 0&&!t.remaining.includes(`worktree`)}function AC(e){let{state:t,server:n}=e,r=_i(e.stateAt);switch(t){case`registered`:return n.answeredAtRegistration?{tone:`neutral`,ring:!1,pulse:!1,text:`was running when registered`}:{tone:`neutral`,ring:!0,pulse:!1,text:`registered · not started`};case`adopted`:return{tone:`neutral`,ring:!1,pulse:!1,text:`was running when registered`};case`starting`:return{tone:`pending`,ring:!1,pulse:!0,text:`starting`};case`up`:return{tone:`success`,ring:!1,pulse:!1,text:r?`up · ${r}`:`up`};case`stalled`:return{tone:`pending`,ring:!1,pulse:!1,text:`stalled · port silent 2 min`};case`exited`:return{tone:`danger`,ring:!1,pulse:!1,text:e.exitCode===void 0?`exited`:`exited · code ${e.exitCode}`};case`stopped`:return{tone:`neutral`,ring:!0,pulse:!1,text:e.reason===`idle`?`stopped after 15 min idle`:`stopped`};case`unavailable`:return{tone:`neutral`,ring:!0,pulse:!1,text:`unavailable`}}}function jC(e){return{kind:`preview-server`,id:`preview-server:${e.port}`,server:e,state:`registered`,stateAt:e.registeredAt}}function MC(e,t){return t?.get(e.port)??jC(e)}function NC(e){return e.state===`registered`?e.server.answeredAtRegistration:e.state===`up`||e.state===`starting`||e.state===`adopted`}function PC(e){return e.split(` -- `)[0].trim()}var FC=(0,Y.createContext)(null);function IC(){return(0,Y.useContext)(FC)}var LC=e=>e&&`port`in e?e.port:void 0;function RC(){return typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 1180px)`).matches}function zC(e){let t=e===void 0?void 0:_C(e),n=t?.open===!0,r=n?t.target:void 0;return{open:n,target:r,request:n?{...r,restored:!0}:void 0,session:n&&!RC(),percent:bC(e)}}function BC(e,t=!1){let[n]=(0,Y.useState)(()=>zC(e)),[r,i]=(0,Y.useState)(n.open),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(n.target),[l,u]=(0,Y.useState)(n.session),[d,f]=(0,Y.useState)(n.request),[p,m]=(0,Y.useState)(n.percent),[h,g]=(0,Y.useState)(e),_=(0,Y.useRef)(r);if(_.current=r,h!==e){let t=zC(e);g(e),i(t.open),o(!1),c(t.target),u(t.session),f(t.request),m(t.percent)}t&&r&&d?.restored&&(i(!1),c(void 0),f(void 0),u(!1));let v=(0,Y.useCallback)(t=>{e!==void 0&&vC(e,t)},[e]),y=(0,Y.useCallback)(e=>{f({...e});let t=e.port===void 0?e.agent?{agent:!0}:void 0:{port:e.port};u(!1),i(!0),t?(c(t),v({open:!0,target:t})):_.current?v({open:!0}):(c(void 0),v({open:!0,target:void 0}))},[v]),b=(0,Y.useCallback)(()=>{i(!1),o(!1),u(!1),c(void 0),v({open:!1})},[v]),x=(0,Y.useCallback)(e=>{c(e),v({target:e})},[v]),S=(0,Y.useCallback)(t=>{m(t),xC(e,t)},[e]),C=(0,Y.useCallback)(()=>u(!0),[]),w=LC(s);return(0,Y.useMemo)(()=>({open:r,live:a,port:w,target:s,percent:p,request:d,session:l,openPane:y,closePane:b,showSession:C,setLive:o,setTarget:x,setPercent:S}),[r,a,w,s,p,d,l,y,b,C,x,S])}function VC(e,t={}){let[n,r]=(0,Y.useState)([]),{cursor:i,afterSeq:o=0,maxEvents:s,compactAt:c,onCompact:l,onReset:u}=t;return(0,Y.useEffect)(()=>{if(r([]),!e)return;let t=o,n=!1,d=!1,f=a(),p=[],m,h,g=()=>{if(m!==void 0&&globalThis.cancelAnimationFrame?.(m),clearTimeout(h),m=void 0,h=void 0,n||p.length===0)return;let e=p;p=[],r(t=>{let r=[...t,...e];return!d&&c!==void 0&&r.length>=c&&(d=!0,queueMicrotask(()=>{n||l?.()})),s===void 0||r.length<=s?r:r.slice(-s)})},_=()=>{h===void 0&&(h=setTimeout(g,50),typeof globalThis.requestAnimationFrame==`function`&&(m=globalThis.requestAnimationFrame(g)))},v=T({kind:`run`,projectId:f,runId:e,afterSeq:o,...i?{cursor:i}:{}},{frame:e=>{!(`type`in e)||e.type!==`event`||e.event.seq<=t||(t=e.event.seq,p.push(e.event),_())},reset:async(e,n)=>{g();let r=await u?.(e,n);return r&&(t=Math.max(t,r.afterSeq)),r}});return()=>{n=!0,m!==void 0&&globalThis.cancelAnimationFrame?.(m),clearTimeout(h),v()}},[e,i,o,s,c,l,u]),n}var HC=5,UC=200,WC=5e3;function GC(...e){let t=[],n=-1/0,r=!0;for(let i of e){for(let e of i){if(e.seq<=n){r=!1;break}t.push(e),n=e.seq}if(!r)break}if(r)return t;let i=new Map;for(let t of e)for(let e of t)i.set(e.seq,e);return[...i.values()].sort((e,t)=>e.seq-t.seq)}function KC(e,t,n){e.setQueryData(t,e=>{if(!e)return{pages:[n],pageParams:[void 0]};let t=[...e.pages],r=[...e.pageParams],i=-1;for(let e=0;e<t.length;e+=1)(i===-1||t[e].asOfSeq>t[i].asOfSeq)&&(i=e);if(i>=0&&t[i].asOfSeq>n.asOfSeq)return e;for(i>=0&&t[i].newerCursor===void 0?(t[i]=n,r[i]=void 0):(t.push(n),r.push(void 0));t.length>HC;)t.shift(),r.shift();return{pages:t,pageParams:r}})}function qC(e,t){return e!==void 0&&(t===void 0||e.asOfSeq>=t.asOfSeq)}function JC(e,t,n,r){let i=(0,Y.useRef)(void 0),a=r&&t.data!==void 0&&!t.isFetching&&!qC(t.data,n),o=e===void 0||n===void 0?void 0:`${e}:${n.asOfSeq}`;(0,Y.useEffect)(()=>{!a||o===void 0||i.current===o||(i.current=o,t.refetch())},[a,t,o])}function YC(e,t){return e!==void 0&&e.asOfSeq>t.asOfSeq?e:t}function XC(e){let t=a(),n=F(),r=[`run-history`,t,e],i=[`run-history-context`,t,e],o=st({queryKey:r,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>Ce(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:HC,staleTime:1/0,retry:1}),s=pn({queryKey:i,enabled:e!==void 0,queryFn:async({signal:t})=>{let r=await Ze(e,{signal:t});return YC(n.getQueryData(i),r)},retry:1}),c=(0,Y.useCallback)(async r=>{let i=r?{signal:r}:void 0,a=await Ce(e,void 0,i),o=await Ze(e,i);return r?.throwIfAborted(),KC(n,[`run-history`,t,e],a),n.setQueryData([`run-history-context`,t,e],e=>YC(e,o)),a},[n,e,t]),l=(0,Y.useCallback)(async(t,n)=>{if(e===void 0)return;let r=await c(n);return{cursor:r.liveCursor,afterSeq:r.asOfSeq}},[c,e]),u=o.isError||s.isError,d=VC(u?e:void 0,{onReset:l}),f=o.data?.pages??[],p=f.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),m=(0,Y.useRef)(!1),h=(0,Y.useCallback)(()=>{e===void 0||m.current||(m.current=!0,c().catch(()=>{}).finally(()=>{m.current=!1}))},[c,e]),g=e=>e!==void 0&&n.getQueryData([`run-history`,t,e])!==void 0,[_,v]=(0,Y.useState)(()=>({runId:e,pending:g(e)})),y=_.pending;_.runId!==e&&(y=g(e),v({runId:e,pending:y})),(0,Y.useEffect)(()=>{if(!y||e===void 0)return;let t=!1,n=new AbortController;return c(n.signal).catch(()=>{}).finally(()=>{t||v({runId:e,pending:!1})}),()=>{t=!0,n.abort()}},[c,y,e]);let b=VC(!u&&p&&!y?e:void 0,{cursor:p?.liveCursor,afterSeq:p?.asOfSeq,maxEvents:WC,compactAt:UC,onCompact:h,onReset:l}),x=(0,Y.useRef)(0);x.current=b.length,(0,Y.useEffect)(()=>()=>{x.current>0&&h()},[h]);let S=(0,Y.useMemo)(()=>GC(...f.map(e=>e.events)),[f]),C=(0,Y.useMemo)(()=>u?d:GC(S,b),[u,d,S,b]);JC(e,s,p,!u);let w=u||qC(s.data,p),T=(0,Y.useMemo)(()=>{if(u)return d;let e=s.data?.contextEvents??[],t=s.data?.asOfSeq??0;return GC(e,C.filter(({seq:e})=>e>t))},[s.data,u,d,C]),E=(0,Y.useCallback)(async()=>{await o.fetchPreviousPage()},[o.fetchPreviousPage]),D=(0,Y.useCallback)(async()=>{u||(await n.resetQueries({queryKey:[`run-history`,t,e],exact:!0}),n.invalidateQueries({queryKey:[`run-history-context`,t,e],exact:!0}))},[u,n,e,t]);return{visibleEvents:C,currentEvents:T,currentComplete:w,isPending:!u&&o.isPending,contextPending:!u&&s.isPending,fallback:u,hasOlder:!u&&!!o.hasPreviousPage,isFetchingOlder:o.isFetchingPreviousPage,olderError:o.isFetchPreviousPageError?o.error instanceof Error?o.error.message:`Could not load earlier items`:void 0,loadOlder:E,jumpToLatest:D,retainedPages:f.length}}function ZC(e){for(let t=e.length-1;t>=0;--t){let n=we.safeParse(e[t]);if(n.success)return n.data.state===`connected`}return!1}function QC(e){let{currentEvents:t}=XC(e);return(0,Y.useMemo)(()=>ZC(t),[t])}var $C=(0,Y.lazy)(()=>R(()=>import(`./report-reader-BjVZrGCz.js`).then(e=>({default:e.ReportReader})),__vite__mapDeps([74,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,75,19,33,36,37,76,77,78,23,24])));function ew(){let{id:e}=vn(),t=cn(e),n=gn(),r=St().data?.capabilities?.preview===!0,i=t.data?kC(t.data):!1,a=BC(e,i),o=cC(e),s=rC(e,o.selection?.artifactId,o.sourceRunId),c=o.selection?(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading report…`}),children:(0,X.jsx)($C,{runId:s.data??e??``,selection:{artifactId:o.selection.artifactId},fragment:n.hash,onBack:o.close,variant:`pane`,sourceLookup:s},`${e}:${o.selection.artifactId}`)}):void 0,l=r?(0,X.jsx)(tw,{id:e,run:t.data,pane:a,removed:i,report:c,children:(0,X.jsx)(mn,{})}):(0,X.jsx)(OC,{run:t.data,state:{...a,open:!1},report:c,children:(0,X.jsx)(mn,{})});return(0,X.jsx)(sC.Provider,{value:o.registry,children:l})}function tw({id:e,run:t,pane:n,removed:r,children:i,report:a}){let o=QC(e),s=(0,Y.useMemo)(()=>({...n,worktreeRemoved:r,agentLive:o}),[n,r,o]);return(0,X.jsx)(FC.Provider,{value:s,children:(0,X.jsx)(OC,{run:t,state:n,report:a,children:i})})}function nw(){let[e,t]=(0,Y.useState)(()=>new Set);return{expandedRuns:e,toggleExpandedRun:(0,Y.useCallback)(e=>t(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[])}}var rw=[{id:`status`,label:`Status`,canFold:!1,defaultExpanded:!0,align:`left`,width:`120px`},{id:`task`,label:`Task`,canFold:!1,defaultExpanded:!0,align:`left`,width:`320px`},{id:`workflow`,label:`Workflow`,canFold:!0,defaultExpanded:!0,align:`left`,width:`84px`,icon:`workflow`},{id:`branch`,label:`Branch`,canFold:!0,defaultExpanded:!1,align:`left`,width:`120px`,icon:`branch`},{id:`diff`,label:`±`,canFold:!0,defaultExpanded:!0,align:`left`,width:`84px`,icon:`diff`},{id:`reference`,label:`Ref`,canFold:!0,defaultExpanded:!0,align:`left`,width:`104px`,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:`64px`,icon:`cost`,capability:`cost`},{id:`cpu`,label:`CPU`,canFold:!0,defaultExpanded:!0,align:`right`,width:`60px`,icon:`cpu`},{id:`memory`,label:`Mem`,canFold:!0,defaultExpanded:!0,align:`right`,width:`80px`,icon:`memory`},{id:`started`,label:`Started`,canFold:!0,defaultExpanded:!0,align:`right`,width:`68px`,icon:`started`}],iw=new Map(rw.map(e=>[e.id,e]));function aw(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`boolean`))}function ow(e){let t={};for(let[n,r]of Object.entries(aw(e))){let e=iw.get(n);e?.canFold&&(t[e.id]=r)}return t}function sw(e,t){let n=iw.get(e);return!n||!n.canFold?!0:t[e]??n.defaultExpanded}function cw(e,t){let n=aw(e);return iw.get(t)?.canFold?{...n,[t]:!sw(t,ow(e))}:n}function lw(e){return rw.filter(t=>t.capability===void 0||e[t.capability])}function uw(e,t){return t===`flat`?!1:t===`virtual`||e>=100}function dw(e,t){let n=t===null?-1:e.indexOf(t);return n<0?[]:[n-1,n,n+1].filter(t=>t>=0&&t<e.length)}function fw(e,t){let n=e.map(e=>sw(e.id,t)?e.id===`workflow`||e.id===`memory`?120:Number.parseFloat(e.width??`100`):42);return{"--task-columns":e.map((e,t)=>e.id===`task`?`minmax(${n[t]}px, 1fr)`:`${n[t]}px`).join(` `),minInlineSize:Math.max(1240,n.reduce((e,t)=>e+t,0))}}function pw(e,t){let n=2;return{indexes:e.map(e=>{let r=n;return n+=t.has(e)?2:1,r}),rowCount:n-1}}var mw=null,{min:hw,max:gw,abs:_w,floor:vw}=Math,yw=(e,t,n)=>hw(n,gw(t,e)),bw=e=>[...e].sort((e,t)=>e-t),xw=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)},Sw=()=>{let e;return[new Promise(t=>{e=t}),e]},Cw=e=>{let t;return()=>(e&&=(t=e(),void 0),t)},ww=(e,t,n)=>{let r=n?`unshift`:`push`;for(let n=0;n<t;n++)e[r](-1);return e},Tw=(e,t)=>{let n=e.t[t];return n===-1?e.o:n},Ew=(e,t,n)=>{let r=e.t[t]===-1;return e.t[t]=n,e.i=hw(t,e.i),r},Dw=(e,t)=>{if(!e.l)return 0;if(e.i>=t)return e.u[t];e.i<0&&(e.u[0]=0,e.i=0);let n=e.i,r=e.u[n];for(;n<t;)r+=Tw(e,n),e.u[++n]=r;return e.i=t,r},Ow=(e,t,n=0,r=e.l-1)=>{let i=n;for(;n<=r;){let a=vw((n+r)/2);Dw(e,a)<=t?(i=a,n=a+1):r=a-1}return yw(i,0,e.l-1)},kw=(e,t,n)=>{let r=t-e.l;return e.i=n?-1:hw(t-1,e.i),e.l=t,r>0?(ww(e.u,r),ww(e.t,r,n),e.o*r):(e.u.splice(r),(n?e.t.splice(0,-r):e.t.splice(r)).reduce((t,n)=>t-(n===-1?e.o:n),0))},Aw=typeof window<`u`,jw=e=>e.documentElement,Mw=e=>e.ownerDocument,Nw=e=>e.defaultView,Pw=Cw(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>0),Fw=Cw(()=>`scrollBehavior`in jw(document).style),Iw=e=>gw(e.h(),e.p()),Lw=(e,t=40,n=0,r,i=!1)=>{let a=!!n,o=1,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=mw,g=[0,a?gw(n-1,0):-1],_=0,v=!1,y=((e,t,n)=>({o:t,t:n?ww(n.slice(0,hw(e,n.length)),gw(0,e-n.length)):ww([],e),l:e,i:-1,u:ww([],e+1)}))(e,r?r[1]:t,r&&r[0]),b=new Set,x=()=>l-c,S=()=>x()+d+u,C=(e,t)=>((e,t,n,r)=>{if(r=hw(r,e.l-1),Dw(e,r)<=t){let i=Ow(e,n,r);return[Ow(e,t,r,i),i]}{let i=Ow(e,t,void 0,r);return[i,Ow(e,n,i)]}})(y,e,t,g[0]),w=()=>Dw(y,y.l),T=(e,t)=>{let n=Dw(y,e)-d;return t?w()-n-E(e):n},E=e=>Tw(y,e),D=(e,t=-1)=>y.t[e]===t,O=e=>{e&&(Pw()&&p!==0||h&&m===1?d+=e:u+=e)};return{v:()=>{b.clear()},m:()=>o,_:()=>(e=>[e.t.slice(),e.o])(y),S:(e=200)=>{if(!v||a)return g;let t,n;if(f)[t,n]=g;else{let r=gw(0,S()),a=r+s;i||(e=gw(0,e),p!==1&&(r-=e),p!==2&&(a+=e)),[t,n]=g=C(gw(0,r),gw(0,a)),h&&(t=hw(t,h[0]),n=gw(n,h[1]))}return[gw(t,0),hw(n,y.l-1)]},$:e=>Ow(y,e-c),I:D,k:T,R:E,T:()=>y.l,C:()=>l,M:()=>p!==0,p:()=>s,O:()=>c,h:w,H:()=>(f=u,u=0,[f,m===2]),W:(e,t)=>{let n=[e,t];return b.add(n),()=>{b.delete(n)}},B:(e,t)=>{let n,r,g=0;switch(e){case 1:{if(t===l&&m===0)break;let e=f;f=0;let n=t-l,i=_w(n);e&&i<_w(e)+1||m!==0||(p=n<0?2:1),a&&=!1,l=t,g=4;let o=x();o>=-s&&o<=w()&&(g+=1,r=i>s);break}case 2:g=8,p!==0&&(n=!0,g+=1),p=0,m=0,h=mw;break;case 3:{let e=t.filter(([e,t])=>!D(e,t));if(!e.length)break;O(e.reduce((e,[t,n])=>{let r;if(m===2)r=!0;else if(h&&m===1)r=t<h[0];else{let e=x(),n=T(t),i=E(t);r=p!==1&&m===0?n+i<=e:n<e&&n+i<e+s}return r&&(e+=n-E(t)),e},0));for(let[t,n]of e){let e=E(t),r=Ew(y,t,n);i&&(_+=r?n:n-e)}i&&s&&_>s&&(O(((e,t)=>{let n=0,r=[];e.t.forEach((e,i)=>{e!==-1&&(r.push(e),i<t&&n++)}),e.i=-1;let i=bw(r),a=i.length,o=a/2|0,s=a%2==0?(i[o-1]+i[o])/2:i[o],c=e.o;return((e.o=s)-c)*gw(t-n,0)})(y,Ow(y,S()))),i=!1),g=3,r=!0;break}case 4:s!==t&&(s||(v=r=!0),s=t,g=3);break;case 5:t[1]?(O(kw(y,t[0],!0)),m=2,g=1):(kw(y,t[0]),g=1);break;case 6:c=t;break;case 7:m=1;break;case 8:h=C(t,t+s),g=1}g&&(o=1+(2147483647&o),n&&d&&(u+=d,d=0),b.forEach(([e,t])=>{g&e&&t(r)}))}}},Rw=setTimeout,zw=(e,t)=>t?-e:e,Bw=(e,t,n,r,i,a)=>{let o=Date.now,s=0,c=!1,l=!1,u=!1,d=!1,f=(()=>{let t,n=()=>{t!=mw&&clearTimeout(t)},r=()=>{n(),t=Rw(()=>{t=mw,(()=>{if(c||l)return c=!1,void f();u=!1,e.B(2)})()},150)};return r.J=n,r})(),p=()=>{s=o(),u&&(d=!0),a&&e.B(6,a()),e.B(1,r()),f()},m=t=>{if(c||!e.M()||t.ctrlKey)return;let r=o()-s;150>r&&50<r&&(n?t.deltaX:t.deltaY)&&(c=!0)},h=()=>{l=!0,u=d=!1},g=()=>{l=!1,Pw()&&(u=!0)};return t.addEventListener(`scroll`,p),t.addEventListener(`wheel`,m,{passive:!0}),t.addEventListener(`touchstart`,h,{passive:!0}),t.addEventListener(`touchend`,g,{passive:!0}),{A:()=>{t.removeEventListener(`scroll`,p),t.removeEventListener(`wheel`,m),t.removeEventListener(`touchstart`,h),t.removeEventListener(`touchend`,g),f.J()},L:()=>{let[t,n]=e.H();t&&(i(t,n,d),d=!1,n&&e.p()>e.h()&&e.B(1,r()))}}},Vw=(e,t,n)=>{let r;return[async(i,a)=>{if(!await t())return;r&&r();let o=()=>{let[t,n]=Sw();return r=()=>{n(!1)},e.p()&&Rw(r,150),[t,e.W(2,()=>{n(!0)})]};if(a&&Fw())e.B(8,i()),xw(async()=>{for(;;){let t=!0;for(let[n,r]=e.S();n<=r;n++)if(e.I(n)){t=!1;break}if(t)break;let[n,r]=o();try{if(!await n)return}finally{r()}}e.B(7),n(i(),a)});else for(;;){let[t,r]=o();try{if(e.B(7),n(i()),!await t)return}finally{r()}}},()=>{r&&r()}]},Hw=(e,t)=>{let n,r,i=Sw(),a=!1,o=t?`scrollLeft`:`scrollTop`,s=t?`overflowX`:`overflowY`,[c,l]=Vw(e,()=>i[0],(e,r)=>{e=zw(e,a),r?n.scrollTo({[t?`left`:`top`]:e,behavior:`smooth`}):n[o]=e});return{N(c,u){n=u,t&&(a=getComputedStyle(u).direction===`rtl`),r=Bw(e,u,t,()=>zw(u[o],a),(t,n,r)=>{if(r){let e=u.style,t=e[s];e[s]=`hidden`,Rw(()=>{e[s]=t})}u[o]=zw(e.C()+t,a),n&&l()}),i[1](!0)},v(){r&&r.A(),i[1](!1),i=Sw()},P:()=>a,V(e){c(()=>e)},X(t){t+=e.C(),c(()=>t)},Y(t,{align:n,smooth:r,offset:i=0}={}){if(t=yw(t,0,e.T()-1),n===`nearest`){let r=e.k(t),i=e.C();if(r<i)n=`start`;else{if(!(r+e.R(t)>i+e.p()))return;n=`end`}}c(()=>i+e.O()+e.k(t)+(n===`end`?e.R(t)-e.p():n===`center`?(e.R(t)-e.p())/2:0),r)},q:()=>{r&&r.L()}}},Uw=e=>{let t;return{j(n){(t||=new(Nw(Mw(n))).ResizeObserver(e)).observe(n)},D(e){t.unobserve(e)},A(){t&&t.disconnect()}}},Ww=(e,t)=>{let n,r=t?`width`:`height`,i=new WeakMap,a=Uw(t=>{let a=[];for(let{target:o,contentRect:s}of t)if(o.offsetParent)if(o===n)e.B(4,s[r]);else{let e=i.get(o);e!=mw&&a.push([e,s[r]])}a.length&&e.B(3,a)});return{G(e){a.j(n=e)},U:(e,t)=>(i.set(e,t),a.j(e),()=>{i.delete(e),a.D(e)}),v:a.A}},Gw=Aw?Y.useLayoutEffect:Y.useEffect,Kw=`current`,qw=(e,t)=>{if(Array.isArray(e))for(let n of e)qw(n,t);else e==null||typeof e==`boolean`||t.push(e)},Jw=(e,t)=>e.key??`_`+t,Yw=e=>{let t=(0,Y.useRef)(null);return t[Kw]||(t[Kw]=e())},Xw=e=>{let t=(0,Y.useRef)(e);return Gw(()=>{t[Kw]=e},[e]),t},Zw=(0,Y.memo)(({Z:e,ee:t,te:n,oe:r,ne:i,re:a,se:o,ie:s})=>{let c=(0,Y.useRef)(null);Gw(()=>t(c[Kw],n),[n]);let l=(0,Y.useMemo)(()=>{let e={contain:`layout style`,position:i&&s?void 0:`absolute`,[o?`height`:`width`]:`100%`,[o?`top`:`left`]:0,[o?`left`:`top`]:r,visibility:!i||s?void 0:`hidden`};return o&&(e.display=`inline-flex`),e},[r,i,s,o]);return(0,X.jsx)(a,typeof a==`string`?{ref:c,style:l,children:e}:{ref:c,style:l,index:n,children:e})}),Qw=(e,t)=>(0,Y.useMemo)(()=>{if(typeof e==`function`)return[n=>e(t[n],n),t.length];let n=(e=>{let t=[];return qw(e,t),t})(e);return[e=>n[e],n.length]},[e,t]),$w=(0,Y.forwardRef)(({children:e,data:t,bufferSize:n,itemSize:r,shift:i,horizontal:a,keepMounted:o,cache:s,startMargin:c=0,ssrCount:l,as:u=`div`,item:d=`div`,scrollRef:f,onScroll:p,onScrollEnd:m},h)=>{let[g,_]=Qw(e,t),v=(0,Y.useRef)(null),y=(0,Y.useRef)(!!l),b=Xw(p),x=Xw(m),[S,C,w,T]=Yw(()=>{let e=!!a,t=Lw(_,r,l,s,!r);return[t,Ww(t,e),Hw(t,e),e]});_!==S.T()&&S.B(5,[_,i]),c!==S.O()&&S.B(6,c);let[E,D]=(0,Y.useReducer)(S.m,void 0,S.m),O=S.M(),k=S.h(),A=w.P(),j=[],M=e=>{let t=g(e);return(0,X.jsx)(Zw,{ee:C.U,te:e,oe:S.k(e,A),ne:S.I(e),re:d,Z:t,se:T,ie:y[Kw]},Jw(t,e))};if(Gw(()=>{y[Kw]=!1,S.W(1,e=>{e?(0,Ku.flushSync)(D):D()}),S.W(4,()=>{b[Kw]&&b[Kw](S.C())}),S.W(8,()=>{x[Kw]&&x[Kw]()});let e=v[Kw],t=t=>{C.G(t),w.N(e,t)};return f?xw(()=>{f[Kw]&&t(f[Kw])}):t(e.parentElement),()=>{S.v(),C.v(),w.v()}},[]),Gw(()=>{w.q()},[E]),(0,Y.useImperativeHandle)(h,()=>({get cache(){return S._()},get scrollOffset(){return S.C()},get scrollSize(){return Iw(S)},get viewportSize(){return S.p()},findItemIndex:S.$,getItemOffset:S.k,getItemSize:S.R,scrollToIndex:w.Y,scrollTo:w.V,scrollBy:w.X}),[]),o){let e=new Set(o);for(let[t,r]=S.S(n);t<=r;t++)e.add(t);bw([...e]).forEach(e=>{j.push(M(e))})}else for(let[e,t]=S.S(n);e<=t;e++)j.push(M(e));return(0,X.jsx)(u,{ref:v,style:{contain:`size style`,overflowAnchor:`none`,flex:`none`,position:`relative`,width:T?k:`100%`,height:T?`100%`:k,pointerEvents:O?`none`:void 0},children:j})});function eT(e,t){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(``),o=(0,Y.useRef)(!1);return{editing:n,draft:i,setDraft:a,begin:()=>{a(e),o.current=!1,r(!0)},commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function tT({editor:e,className:t}){return(0,X.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:e.commit,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:c(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}function nT(e){let t=new Map,n=new Set,r;return{begin:e,editingId:()=>r?.id??null,subscribeSelection(e){return n.add(e),()=>{n.delete(e)}},snapshot:e=>r?.id===e?r.editor:null,subscribe(e,n){let r=t.get(e);return r||(r=new Set,t.set(e,r)),r.add(n),()=>{r.delete(n),r.size||t.delete(e)}},publish(e,i){let a=r?.id;if(r=e&&i.editing?{id:e,editor:i}:void 0,a!==r?.id)for(let e of n)e();for(let e of new Set([a,r?.id]))if(e)for(let n of t.get(e)??[])n()}}}var rT=(0,Y.createContext)(null),iT={editing:!1,draft:``,begin(){},setDraft(){},commit(){},cancel(){}};function aT({children:e,runs:t,onRename:n}){let[r,i]=(0,Y.useState)(),[a]=(0,Y.useState)(()=>nT(e=>i({run:e}))),o=t.find(e=>e.id===r?.run.id),s=eT(o?K(o):``,e=>{o&&n(o.id,e)});return(0,Y.useEffect)(()=>{r&&s.begin()},[r]),(0,Y.useEffect)(()=>{r&&!o&&(s.cancel(),i(void 0))},[r,o,s]),(0,Y.useLayoutEffect)(()=>{a.publish(o?.id,s)},[a,o?.id,s]),(0,X.jsx)(rT,{value:a,children:e})}function oT(e){let t=(0,Y.useContext)(rT);if(!t)throw Error(`Task title editor needs its page provider`);return{...(0,Y.useSyncExternalStore)((0,Y.useCallback)(n=>t.subscribe(e.id,n),[t,e.id]),(0,Y.useCallback)(()=>t.snapshot(e.id),[t,e.id]))??iT,begin:()=>t.begin(e)}}var sT=()=>null;function cT(){return lT}function lT(){}function uT(){let e=(0,Y.useContext)(rT);return(0,Y.useSyncExternalStore)(e?.subscribeSelection??cT,e?.editingId??sT)}var dT=(0,Y.createContext)(null);function fT(e,t,n=!1){let[r,i]=(0,Y.useState)(null),a=(0,Y.useRef)(new Map),o=(0,Y.useCallback)((e,t)=>{t?a.current.set(e,t):a.current.delete(e)},[]),s=(0,Y.useCallback)(e=>[...a.current.values()].some(t=>t.includes(e)),[]);return{props:pT(e,t,i,n?s:void 0),value:(0,Y.useMemo)(()=>({focused:r,revision:t,registerList:n?o:void 0}),[r,t,o,n])}}function pT(e,t,n,r){let i=(0,Y.useRef)(r);(0,Y.useLayoutEffect)(()=>{i.current=r});let a=(0,Y.useRef)(null),o=(0,Y.useRef)(null);return(0,Y.useLayoutEffect)(()=>{let e=o.current;if(!e||e.element.isConnected||document.activeElement!==document.body)return;let t=()=>{o.current===e&&(o.current=null,n?.(null))},r=()=>{let n=e.project?`${e.project}/${e.runId}`:e.runId;if(i.current&&!i.current(n)||document.activeElement!==document.body||e.element.isConnected)return t(),!0;let r=[...a.current?.querySelectorAll(`[data-run-id]`)??[]].filter(t=>t.dataset.runId===e.runId&&t.dataset.project===e.project).flatMap(e=>[...e.querySelectorAll(`a,button,input`)]),o=r.find(t=>e.control?t.dataset.taskControl===e.control:t.tagName===e.tag&&t.getAttribute(`aria-label`)===e.label)??r.find(e=>e.tagName===`A`);return o?.focus({preventScroll:!0}),!!o&&document.activeElement===o};if(r()||!a.current)return;let s=()=>{l.disconnect(),document.removeEventListener(`pointerdown`,c,!0),document.removeEventListener(`keydown`,c,!0)},c=()=>{t(),s()},l=new MutationObserver(()=>{r()&&s()});return document.addEventListener(`pointerdown`,c,!0),document.addEventListener(`keydown`,c,!0),l.observe(a.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`style`]}),s},[e,t]),{ref:a,onFocusCapture:e=>{let t=e.target,r=t.closest(`[data-run-id]`);o.current=r?{element:t,runId:r.dataset.runId,project:r.dataset.project,control:t.dataset.taskControl??null,label:t.getAttribute(`aria-label`),tag:t.tagName}:null,n?.(r?r.dataset.project?`${r.dataset.project}/${r.dataset.runId}`:r.dataset.runId:null)},onBlurCapture:e=>{let t=e.target,r=e.currentTarget;queueMicrotask(()=>{o.current?.element===t&&t.isConnected&&!r.contains(document.activeElement)&&(o.current=null,n?.(null))})}}}var mT=new WeakMap;function hT({items:e,itemKey:t,children:n,itemSize:r}){let[i]=_n(),a=(0,Y.useRef)(null),o=(0,Y.useRef)(null),[s,c]=(0,Y.useState)({available:null,margin:0}),[l,u]=(0,Y.useState)(null),d=uT(),f=(0,Y.useContext)(dT),p=e.map(t),m=uw(e.length,i.get(`tasks`)),h=s.available===!0&&m,g=(0,Y.useRef)(Symbol(`task-list`)),_=(0,Y.useRef)(()=>{});(0,Y.useLayoutEffect)(()=>{f?.registerList?.(g.current,p);let e=y.current;return e&&mT.set(e,{keys:p,handle:o,measure:()=>_.current()}),()=>{f?.registerList?.(g.current,null),e&&mT.delete(e)}});let v=pT(String(h),void 0,void 0,e=>p.includes(e)),y=v.ref;return(0,Y.useLayoutEffect)(()=>{let e=y.current,t=e?.closest(`[data-slot="main"]`);if(a.current=t??null,!e||!t){c(e=>e.available===!1?e:{available:!1,margin:0});return}let n=null,r=()=>{let r=Math.max(0,e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop);r!==n&&(n=r,c(e=>e.available===!0&&e.margin===r?e:{available:!0,margin:r}))};r(),_.current=r;let i=new ResizeObserver(r);for(let n=e;n&&n!==t;n=n.parentElement){i.observe(n);for(let e of n.parentElement?.children??[])i.observe(e)}return i.observe(t),()=>i.disconnect()},[]),(0,X.jsx)(`div`,{ref:y,"data-slot":`task-list-items`,"data-virtualized":h,onFocusCapture:e=>{v.onFocusCapture(e),u(e.target.closest(`[data-task-item]`)?.dataset.taskItem??null)},onBlurCapture:e=>{v.onBlurCapture(e),e.relatedTarget&&!e.currentTarget.contains(e.relatedTarget)&&u(null)},children:h?(0,X.jsx)(_T,{itemSize:r,items:e,keys:p,handle:o,scroll:a,margin:s.margin,focused:f?.focused??l,editing:d,children:n}):(s.available===null&&m?[]:e).map((t,r)=>(0,X.jsx)(`div`,{"data-task-item":p[r],"data-first":r===0,"data-last":r===e.length-1,className:`task-list-flat-item`,children:n(t,r)},p[r]))})}function gT({layout:e,revision:t,visibilityRevision:n=``,children:r,...i}){let a=fT(e,t,!0);return(0,X.jsx)(dT,{value:a.value,children:(0,X.jsx)(yT,{revision:t,visibilityRevision:`${e}:${n}`,children:(0,X.jsx)(`div`,{...i,...a.props,children:r})})})}function _T({items:e,keys:t,handle:n,scroll:r,margin:i,focused:a,editing:o,children:s,itemSize:c}){let[l,u]=(0,Y.useState)(!1),d=vT(r);return(0,Y.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(e=>{e.some(e=>e.contentRect.height>0)&&(u(!0),t.disconnect())});return t.observe(e),()=>t.disconnect()},[r]),(0,X.jsx)($w,{ref:n,...c===void 0?{}:{itemSize:c},scrollRef:r,startMargin:i,keepMounted:[...new Set([...!l&&e.length?[0]:[],...dw(t,a),...dw(t,d),...dw(t,o)])],data:e,children:(n,r)=>(0,X.jsx)(`div`,{"data-task-item":t[r],"data-first":r===0,"data-last":r===e.length-1,children:s(n,r)},t[r])})}function vT(e){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(t);return(0,Y.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let i=e=>{if(e.target!==t)return;let i=t.contains(document.activeElement)?document.activeElement.closest(`[data-task-item]`)?.dataset.taskItem??null:null;i!==r.current&&(r.current=i,(0,Ku.flushSync)(()=>n(i)))};return document.addEventListener(`scroll`,i,{capture:!0,passive:!0}),()=>document.removeEventListener(`scroll`,i,{capture:!0})},[e]),t}var yT=class extends Y.Component{root={current:null};owner(){return this.root.current?.closest(`[data-slot="main"]`)??null}getSnapshotBeforeUpdate(e){if(e.revision===this.props.revision&&e.visibilityRevision===this.props.visibilityRevision)return null;let t=this.owner();if(!t||!this.root.current)return null;let n=t.getBoundingClientRect();for(let e of this.root.current.querySelectorAll(`[data-task-item]`)){let r=e.getBoundingClientRect();if(r.bottom>n.top&&r.top<n.bottom)return{key:e.dataset.taskItem,top:r.top,scrollTop:t.scrollTop}}return{key:null,top:0,scrollTop:t.scrollTop}}componentDidUpdate(e,t,n){let r=this.owner();if(!n||!r)return;let i=n.key===null?null:this.currentTop(n.key);i!==null&&Math.abs(i-n.top)>.5&&(r.scrollTop+=i-n.top),queueMicrotask(()=>{r.isConnected&&(0,Ku.flushSync)(()=>{for(let e of this.root.current?.querySelectorAll(`[data-slot="task-list-items"]`)??[])mT.get(e)?.measure();r.scrollTop!==n.scrollTop&&r.dispatchEvent(new Event(`scroll`))})})}currentTop(e){for(let t of this.root.current?.querySelectorAll(`[data-task-item]`)??[])if(t.dataset.taskItem===e)return t.getBoundingClientRect().top;for(let t of this.root.current?.querySelectorAll(`[data-slot="task-list-items"]`)??[]){let n=mT.get(t),r=n?.keys.indexOf(e)??-1,i=n?.handle.current;if(r>=0&&i)return t.getBoundingClientRect().top+i.getItemOffset(r)}return null}render(){return(0,X.jsx)(`div`,{ref:this.root,style:{display:`contents`},children:this.props.children})}};function bT(e){return e===void 0?`unknown`:new Intl.NumberFormat().format(e)}function xT(e,t){return`Input tokens: ${bT(e)}; output tokens: ${bT(t)}`}function ST(e,t,n=`compact`){let r=e===void 0?`—`:vi(e),i=t===void 0?`—`:vi(t);return n===`table`?`${r} / ${i}`:`IN ${r} · OUT ${i}`}function CT({inputTokens:e,outputTokens:t,variant:n=`compact`,omitWhenUnknown:r=!0,className:i,title:a}){return r&&e===void 0&&t===void 0?null:(0,X.jsx)(`span`,{"data-slot":`directional-usage`,"aria-label":xT(e,t),title:a,className:c(`font-mono tabular-nums`,i),children:ST(e,t,n)})}function wT({className:e,dot:t,shape:n=`filled`,pulse:r=!1,children:i,...a}){return(0,X.jsxs)(`span`,{"data-slot":`pill`,className:c(`inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-[3px] text-xs font-medium whitespace-nowrap text-muted-foreground`,e),...a,children:[t?(0,X.jsx)(q,{tone:t,shape:n,pulse:r}):null,i]})}var TT=[{value:`all`,label:`All`},{value:`direct`,label:`Direct tasks`},{value:`automations`,label:`Automations`}];function ET(e){return e?TT:TT.filter(e=>e.value!==`automations`)}function DT(e,t){return e===`automations`&&!t?`all`:e}function OT(e){return e===`direct`||e===`automations`?e:`all`}function kT(e,t){return t===`all`||A(e)===(t===`automations`)}function AT(e){return e===`all`?void 0:e===`automations`}function jT(e,t){let n={all:0,direct:0,automations:0};for(let r of e)Ya(r)||r.archived!==(t===`archived`)||(n.all+=1,A(r)?n.automations+=1:n.direct+=1);return n}function MT(e,t,n,r,i){let a=Qa(e).archived,o=a>=200;if(n===`all`)return i??(o?`200+`:a);let s=jT(t,`archived`)[n];return o&&r!==!1?`${s}+`:s}function NT(e){return e.rows.map(e=>e.run)}function PT(e,t){switch(e){case`Needs you`:return`pending`;case`Working`:return`running`;case`Archived`:return`neutral`;case`Finished`:return t.some(e=>Ne(e).bucket===`error`)?`danger`:`success`}}function FT(e,t,n){return za(e,t,eo(n))}var IT=(e,t)=>JSON.stringify([e,t]);function LT(e,t,n){let r=new Map,i=e.map(e=>{let{run:t}=e,n=IT(t.projectId,t.id);r.set(n,e);let i=t.delegation;return{...t,id:n,...i&&`parentRunId`in i?{delegation:{...i,parentRunId:IT(t.projectId,i.parentRunId)}}:{}}}),a=new Map;for(let e of n){let t=a.get(e.projectId);t?t.push(e):a.set(e.projectId,[e])}let o=new Map;for(let[e,t]of a)for(let[n,r]of eo(t))o.set(IT(e,n),r);let s=e=>r.get(e.id);return za(i,t,o).map(e=>({label:e.label,rows:e.rows.map(e=>({kind:`run`,run:s(e.run),queuePosition:e.queuePosition}))}))}function RT(e){return[e.run]}var zT=/^- \S+ — (?:(?:turn complete|step ".*" complete|step ".*" ended without done|session idle-closed) — |worktree setup (?:done in|failed —|skipped —) )/;function BT(e,t=3){let n=w(e,`## Progress log`);if(n<0)return[];let r=[];for(let i of e.slice(de(e,n)).split(`
21
- `)){if(r.length>=t||i.startsWith(`## `))break;let e=i.trim();!e||zT.test(e)||r.push(e.replace(/^[-*] /,``))}return r}function VT({origin:e,counts:t,automations:n,onChange:r}){return(0,X.jsx)(`div`,{role:`group`,"aria-label":`Task origin`,"data-slot":`origin-filter`,className:`flex flex-wrap items-center gap-1.5`,children:ET(n).map(n=>{let i=n.value===e;return(0,X.jsxs)(`button`,{type:`button`,"data-origin":n.value,"aria-pressed":i,onClick:()=>r(n.value),className:c(`inline-flex min-h-11 items-center gap-1.5 rounded-full border border-border px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,i&&`border-accent-strong bg-accent-strong/10 text-accent-text`),children:[n.label,` `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:t[n.value]})]},n.value)})})}function HT({onExpand:e,onCollapse:t}){return(0,X.jsxs)(`div`,{"data-slot":`group-fold-controls`,className:`hidden flex-wrap items-center gap-2 md:ml-auto md:flex`,children:[(0,X.jsx)(U,{type:`button`,variant:`ghost`,className:`min-h-11`,"data-action":`expand-groups`,onClick:e,children:`Expand groups`}),(0,X.jsx)(U,{type:`button`,variant:`ghost`,className:`min-h-11`,"data-action":`collapse-groups`,onClick:t,children:`Collapse groups`})]})}function UT({origin:e,counts:t,automations:n,onChange:r,labels:i,onSetAll:a}){return(0,X.jsxs)(`div`,{"data-slot":`task-origin-row`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,X.jsx)(VT,{origin:e,counts:t,automations:n,onChange:r}),i.length>0?(0,X.jsx)(HT,{onExpand:()=>a(i,!1),onCollapse:()=>a(i,!0)}):null]})}var WT={pending:`needs you`,running:`working`,success:`finished`,danger:`contains failed tasks`,neutral:`archived`};function GT({id:e,label:t,count:n,tone:r,folded:i,collapsed:a,onToggle:o,children:s}){let c=a?Br:Or;return(0,X.jsxs)(`section`,{"data-slot":`task-status-group`,"data-bucket":t,"data-folded":i,"data-tone":r,"aria-labelledby":`${e}-heading`,className:`flex flex-col gap-2.5`,children:[(0,X.jsx)(`h2`,{id:`${e}-heading`,className:`text-[13px] font-semibold text-foreground`,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`status-group-toggle`,"aria-expanded":!a,"aria-controls":`${e}-rows`,"aria-label":`${t} ${n}${r===`danger`?`, contains failed tasks`:``}`,onClick:o,className:`inline-flex min-h-11 items-center gap-2 rounded-md pr-2 hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,children:[(0,X.jsx)(c,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,X.jsx)(q,{tone:r,role:`img`,"aria-label":WT[r],title:WT[r]}),(0,X.jsx)(`span`,{children:t}),` `,(0,X.jsx)(`span`,{className:`font-normal tabular-nums text-muted-foreground`,children:n})]})}),(0,X.jsx)(`div`,{id:`${e}-rows`,hidden:a,children:a?null:s})]})}function KT({automationId:e,automationName:t,project:n}){let r=e===void 0?`Direct task`:t??e;return(0,X.jsxs)(`span`,{"data-slot":`task-origin`,"data-origin":e===void 0?`direct`:`automation`,className:`flex min-w-0 flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[n?(0,X.jsxs)(X.Fragment,{children:[n,(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`·`})]}):null,(0,X.jsx)(`span`,{className:`min-w-0 break-words`,title:e===void 0?void 0:`Automation ${e}`,children:r})]})}function qT({projectId:e,runId:t,status:n,error:r,open:i}){let a=dt(e,t,!0),o=a.data===void 0?[]:BT(a.data);return(0,X.jsxs)(`div`,{"data-slot":`task-preview`,className:`flex flex-col gap-3 rounded-md bg-muted/50 p-4 text-xs`,children:[(0,X.jsx)(`p`,{className:`font-medium text-foreground first-letter:uppercase`,children:n}),r?(0,X.jsx)(`p`,{"data-slot":`task-preview-error`,className:`break-words text-danger`,children:r}):null,a.isPending?(0,X.jsx)(`p`,{role:`status`,className:`text-muted-foreground`,children:`Loading latest progress…`}):a.isError?(0,X.jsx)(`p`,{"data-slot":`task-preview-unavailable`,className:`text-muted-foreground`,children:`Latest progress is unavailable.`}):o.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`No progress recorded yet.`}):(0,X.jsx)(`ul`,{"aria-label":`Latest progress`,className:`flex flex-col gap-1 text-muted-foreground`,children:o.map((e,t)=>(0,X.jsx)(`li`,{className:`break-words`,children:e},t))}),(0,X.jsx)(`div`,{children:i})]})}var JT=`cez-task-list-folds`,YT=`cez-task-list-folds-changed`;function XT(e,t,n=new Set){let[r,i]=(0,Y.useState)(()=>Lh(JT));(0,Y.useEffect)(()=>{let e=e=>{e instanceof StorageEvent&&e.key!==null&&e.key!==`cez-task-list-folds`||i(e instanceof CustomEvent?e.detail:Lh(JT))};return window.addEventListener(`storage`,e),window.addEventListener(YT,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(YT,e)}},[]);let a=(0,Y.useCallback)(n=>JSON.stringify([e,t,n]),[e,t]),o=(0,Y.useCallback)(e=>{i(t=>{let n=e(t);return Rh(n,JT),queueMicrotask(()=>window.dispatchEvent(new CustomEvent(YT,{detail:n}))),n})},[]),s=e=>r[a(e)]===!0;return{isFolded:s,isCollapsed:e=>s(e)&&!n.has(e),toggle:e=>o(t=>({...t,[a(e)]:t[a(e)]!==!0})),setAll:(e,t)=>o(n=>({...n,...Object.fromEntries(e.map(e=>[a(e),t]))})),only:(0,Y.useCallback)((e,t)=>o(n=>({...n,...Object.fromEntries(t.map(t=>[a(t),t!==e]))})),[o,a])}}function ZT(e,t,n,r){let i=XT(e,t,n),a=(0,Y.useRef)(r);a.current=r;let[o,s]=iC(),c=t===`active`?Ka(o.get(Ja)):null,{only:l}=i;return(0,Y.useEffect)(()=>{c!==null&&(l(c,Za),a.current?.(),s(e=>(e.delete(Ja),e)))},[c,l,s]),i}function QT(e){let t=e?.capabilities,n=t?.tokenMetrics!==!1;return{tokens:t?.tokenUsageMetrics??n,cost:t?.costMetrics??n}}function $T(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function eE(){let e=F(),t=Jt(),n=Y.useRef(0),r=Y.useRef(0),i=Y.useRef(Promise.resolve()),a=Y.useMemo(()=>ow(t.data?.taskTable?.expandedColumns),[t.data?.taskTable?.expandedColumns]),o=Y.useCallback(t=>{if(!rw.find(e=>e.id===t)?.canFold)return;let a=e.getQueryData(L.uiState);if(a===void 0)return;let o=$T(a?.taskTable),s={...o,expandedColumns:cw(o.expandedColumns,t)};e.setQueryData(L.uiState,{...a,taskTable:s});let c=++n.current;r.current=c;let l=i.current.then(async()=>{let t=await _e({taskTable:s},{keepalive:!0});c===r.current&&e.setQueryData(L.uiState,t)});i.current=l.catch(t=>{V(t instanceof Error?t.message:String(t),{tone:`danger`}),c===r.current&&e.invalidateQueries({queryKey:L.uiState})})},[e]);return{expandedColumns:a,isExpanded:Y.useCallback(e=>sw(e,a),[a]),toggleColumn:o,isPending:t.isPending}}var tE=()=>void 0;function nE({runs:e,view:t,onViewChange:n,onArchiveFinished:r,archivePending:i=!1,onMarkAllRead:a,onRename:o,onTogglePin:s,now:c=Date.now(),showTokens:l=!0,showCost:u=!0,expandedColumns:d=ow(void 0),onToggleColumn:f=()=>void 0,columnsPending:p=!1,projectName:m,error:h,onRetry:g,archivedPages:_,archivedTotal:v,onArchivedSearch:y,origin:b,onOriginChange:x,automations:S,urlQuery:C=``,onQueryChange:w,foldScope:T=`project`,automationName:E=tE}){let[D,O]=rE(C,w);Y.useEffect(()=>{y?.(D.trim())},[y,D]);let[k,A]=aE(b,x,S),[j,M]=Y.useState(!1),ee=Oh(),{expandedRuns:te,toggleExpandedRun:ne}=nw(),re=Y.useRef(null),ie=Y.useMemo(()=>e??[],[e]),N=Y.useMemo(()=>oE({all:ie,view:t,query:D,origin:k,archivedPages:_,archivedTotal:v,automationName:E}),[ie,t,D,k,_,v,E]),{groups:P,needle:ae}=N,oe=Y.useMemo(()=>lw({tokens:l,cost:u}),[l,u]),se=ZT(T,t,new Set(ae?P.map(e=>e.label):[]),()=>O(``)),ce=t===`archived`?void 0:s;return(0,X.jsx)(aT,{runs:_?[...ie,..._.runs]:ie,onRename:o,children:(0,X.jsxs)(gT,{layout:`${ee}:${j}`,revision:P,visibilityRevision:JSON.stringify([$a.map(se.isCollapsed),[...te].sort(),t,d]),"data-route":`tasks`,"data-presentation":j?`resources`:`summary`,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:[(0,X.jsxs)(`header`,{ref:re,className:`flex shrink-0 flex-col gap-[22px]`,children:[(0,X.jsx)(iE,{projectName:m,detailedTable:j}),(0,X.jsxs)(`div`,{className:`flex gap-6 border-b border-border`,children:[(0,X.jsx)(vE,{view:`active`,current:t,onSelect:n,count:N.activeCount,children:`Active`}),(0,X.jsx)(vE,{view:`archived`,current:t,onSelect:n,count:N.archivedCount,children:`Archived`})]}),(0,X.jsxs)(`div`,{"data-slot":`tasks-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,X.jsx)(cE,{view:t,unread:N.unread,finished:N.finished,archivePending:i,headerRef:re,onMarkAllRead:()=>a(AT(k)),onArchiveFinished:()=>r(AT(k))}),(0,X.jsxs)(`div`,{className:`relative order-first w-full md:w-auto md:min-w-64 md:flex-1`,children:[(0,X.jsx)(hr,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-soft-foreground`,"aria-hidden":`true`}),(0,X.jsx)(`input`,{type:`text`,value:D,onChange:e=>O(e.target.value),placeholder:`Search tasks or automations…`,"aria-label":`Search tasks`,className:`h-11 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,X.jsx)(lE,{columns:oe,expandedColumns:d,columnsPending:p,onToggleColumn:f,detailedTable:j,onToggleDetailed:()=>M(e=>!e)}),(0,X.jsx)(U,{asChild:!0,"data-slot":`new-task-inline`,className:`min-h-11 inline-flex max-md:hidden`,children:(0,X.jsxs)(G,{to:`/new`,children:[(0,X.jsx)(ar,{"aria-hidden":`true`}),`New task`]})})]}),(0,X.jsx)(UT,{origin:k,counts:N.originTotals,automations:S,onChange:A,labels:P.map(e=>e.label),onSetAll:se.setAll})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[e===void 0?(0,X.jsx)(dE,{error:h,onRetry:g}):(0,X.jsx)(uE,{view:t,query:D,origin:k,onShowAll:()=>{O(``),A(`all`)},caption:sE(N.visibleCount,N.incomplete,ae),captionOnPhones:ae!==``||N.incomplete,groups:P,folds:se,grouped:{desktop:ee,expandedRuns:te,toggleExpandedRun:ne,detailedTable:j,columns:oe,expandedColumns:d,onToggleColumn:f,columnsPending:p,onRename:o,onTogglePin:ce,now:c,showTokens:l,showCost:u,automationName:E}}),t===`archived`&&_?(0,X.jsx)(fE,{pages:_}):null]})]})})}function rE(e,t){let[n,r]=Y.useState(e),i=Y.useRef(e),a=Y.useRef(e),o=Y.useRef([]);return Y.useEffect(()=>{if(e===i.current)return;i.current=e;let t=o.current.indexOf(e);o.current=t===-1?[]:o.current.slice(t+1),t===-1&&e!==a.current&&r(e)},[e]),Y.useEffect(()=>{a.current=n.trim(),t?.(n,e=>{o.current.push(e)})},[t,n]),[n,r]}function iE({projectName:e,detailedTable:t}){return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`Project tasks`}),(0,X.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[e?`${e} · `:``,t?`Every resource column shown. Fold columns without losing the saved view.`:`Review runs, pull requests and resource usage.`]})]})}function aE(e,t,n){let[r,i]=Y.useState(`all`);return[DT(e??r,n),t??i]}function oE({all:e,view:t,query:n,origin:r,archivedPages:i,archivedTotal:a,automationName:o}){let s=n.trim(),c=e=>e.automationId===void 0?``:o(e.automationId)??e.automationId,l=i?.query===s,u=new Set(l?i.runs.map(e=>e.id):[]),d=to(e,l||s===``?i?.runs??[]:[]).slice(e.length),f=Wn(e,n,c),p=new Set(f.map(e=>e.id)),m=Wn(e.filter(e=>u.has(e.id)&&!p.has(e.id)),``),h=e=>kT(e,r),g=FT([...f,...m,...Wn(d,``)].filter(h),t,e),_=to(e,i?.query===``?i.runs:[]),v=Qa(e).archived>=200,y=e.filter(h);return{groups:g,needle:s,visibleCount:g.reduce((e,t)=>e+NT(t).length,0),originTotals:jT(_,t),activeCount:jT(e,`active`)[r],archivedCount:MT(e,_,r,i?.plainHasMore,a),incomplete:t===`archived`&&v&&i?.hasMore!==!1,finished:Bn(y),unread:Ml(y)}}function sE(e,t,n){return`${e} ${e===1?`task`:`tasks`}${t?` loaded`:``}${n?` matching “${n}”`:``}`}function cE({view:e,unread:t,finished:n,archivePending:r,headerRef:i,onMarkAllRead:a,onArchiveFinished:o}){let s=Y.useRef(!1),[c,l]=Y.useState(!1),u=n>0||r;return Y.useEffect(()=>{let e=window.matchMedia?.(Dh);if(!e)return;let t=()=>{e.matches&&l(!1)};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,X.jsxs)(X.Fragment,{children:[t>0?(0,X.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`mark-all-read`,className:`hidden md:inline-flex`,onClick:a,children:[(0,X.jsx)(as,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read`,` `,(0,X.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:t})]}):null,e===`active`&&n>0?(0,X.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,className:`inline-flex`,disabled:r,"aria-busy":r,onClick:o,children:[(0,X.jsx)(Rr,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`,` `,(0,X.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:n})]}):null,e===`active`&&(u||t>0)?(0,X.jsxs)(Gi,{open:c,onOpenChange:l,children:[(0,X.jsx)(Hi,{asChild:!0,children:(0,X.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`md:hidden`,"aria-label":`Task actions`,"aria-busy":r,children:(0,X.jsx)(ms,{"aria-hidden":`true`})})}),(0,X.jsxs)(Ui,{align:`end`,className:`md:hidden`,onCloseAutoFocus:e=>{(s.current||window.matchMedia?.(`(min-width: 48rem)`).matches)&&(e.preventDefault(),s.current=!1,i.current?.querySelector(`[data-view="active"]`)?.focus())},children:[u?(0,X.jsxs)(W,{disabled:r||n===0,onSelect:()=>{s.current=!0,o()},children:[(0,X.jsx)(Rr,{"aria-hidden":`true`}),r?`Archiving…`:`Archive finished (${n})`]}):null,t>0?(0,X.jsxs)(W,{onSelect:a,children:[(0,X.jsx)(as,{"aria-hidden":`true`}),`Mark all read (${t})`]}):null]})]}):null]})}function lE({columns:e,expandedColumns:t,columnsPending:n,onToggleColumn:r,detailedTable:i,onToggleDetailed:a}){return(0,X.jsxs)(ga,{children:[(0,X.jsx)(fa,{asChild:!0,children:(0,X.jsx)(U,{"data-slot":`task-columns-trigger`,variant:`outline`,className:`hidden min-h-11 md:inline-flex`,children:`Columns`})}),(0,X.jsxs)(ha,{align:`end`,className:`w-72`,children:[(0,X.jsx)(`h2`,{className:`mb-2 text-base font-medium`,children:`Visible columns`}),(0,X.jsx)(`p`,{className:`mb-4 text-xs text-muted-foreground`,children:`Status and Task · Always visible`}),(0,X.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:e.filter(e=>e.canFold).map(e=>(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,X.jsx)(`input`,{"data-column-toggle":e.id,type:`checkbox`,checked:sw(e.id,t),disabled:n,onChange:()=>r(e.id)}),e.id===`diff`?`Diff`:e.id===`reference`?`Reference`:e.id===`memory`?`Memory`:e.label]},e.id))}),(0,X.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Saved automatically. Tokens and cost appear only when supported.`}),(0,X.jsx)(U,{variant:`outline`,className:`mt-4`,onClick:a,children:i?`Summary view`:`Resource columns`})]})]})}function uE({view:e,query:t,origin:n,onShowAll:r,caption:i,captionOnPhones:a,groups:o,folds:s,grouped:l}){return o.length===0?(0,X.jsx)(pE,{view:e,query:t,origin:n,onShowAll:r}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{"data-slot":`tasks-result-count`,className:c(`mb-3 text-[12px] text-muted-foreground tabular-nums`,!a&&`max-md:hidden`),children:i}),(0,X.jsx)(`div`,{className:`flex flex-col gap-[22px]`,children:o.map(t=>{let n=NT(t);return(0,X.jsx)(GT,{id:`tasks-group-${e}-${t.label.replaceAll(` `,`-`)}`,label:t.label,count:n.length,tone:PT(t.label,n),folded:s.isFolded(t.label),collapsed:s.isCollapsed(t.label),onToggle:()=>s.toggle(t.label),children:(0,X.jsx)(gE,{group:t,...l})},t.label)})}),(0,X.jsx)(`p`,{className:`mt-[22px] text-[11px] text-muted-foreground`,children:`Resource details—including tokens, cost, CPU and peak memory—are available when a task row is expanded.`})]})}function dE({error:e,onRetry:t}){return e?(0,X.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-border bg-card p-6`,children:[(0,X.jsx)(`h2`,{className:`text-lg`,children:`Could not load tasks`}),(0,X.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e}),(0,X.jsx)(U,{variant:`outline`,className:`mt-4`,onClick:t,children:`Retry`})]}):(0,X.jsx)(`div`,{role:`status`,"aria-label":`Loading tasks`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading tasks…`})}function fE({pages:e}){return e.failed?(0,X.jsxs)(`p`,{role:`alert`,"data-slot":`archived-older-error`,className:`mt-3.5 flex items-center justify-center gap-2.5 text-[13px] text-muted-foreground`,children:[`Could not load older archived tasks.`,(0,X.jsx)(U,{variant:`outline`,className:`min-h-11`,onClick:e.onLoadMore,children:`Retry`})]}):e.hasMore?(0,X.jsx)(U,{"data-slot":`archived-older`,variant:`outline`,className:`mt-3.5 min-h-11 self-center`,disabled:e.loading,onClick:e.onLoadMore,children:e.loading?`Loading older archived…`:`Show older archived`}):null}function pE({view:e,query:t,origin:n=`all`,onShowAll:r}){let i=t.trim(),a=i||n!==`all`?`search-miss`:e===`archived`?`archive`:`no-tasks`;return(0,X.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":a,className:`flex flex-1 flex-col`,children:a===`search-miss`?(0,X.jsx)(ko,{heading:`h2`,icon:(0,X.jsx)(Oi,{}),tone:`neutral`,title:`No matching tasks`,subtitle:i?`No tasks match “${i}”.`:n===`automations`?`No automation started a task here.`:`No task here was started directly.`,actions:r?(0,X.jsx)(U,{variant:`outline`,className:`min-h-11`,"data-action":`clear-task-filters`,onClick:r,children:`Show all tasks`}):void 0}):a===`archive`?(0,X.jsx)(ko,{heading:`h2`,icon:(0,X.jsx)(Rr,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,X.jsx)(ko,{heading:`h2`,icon:(0,X.jsx)(Cs,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,X.jsx)(U,{asChild:!0,children:(0,X.jsxs)(G,{to:`/new`,"data-new-task-action":!0,children:[(0,X.jsx)(ar,{"aria-hidden":`true`}),`New task`]})})})})}function mE({rows:e,onRename:t,onTogglePin:n,now:r,showTokens:i,showCost:a,automationName:o,expandedRuns:s,toggleExpandedRun:c}){let l=pw(e.map(({run:e})=>e.id),s);return(0,X.jsx)(`div`,{"data-slot":`tasks-summary`,children:(0,X.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-5`,role:`table`,"aria-rowcount":l.rowCount,children:[(0,X.jsx)(`div`,{role:`row`,"aria-rowindex":1,className:`task-summary-grid`,children:[`Task`,`Workflow`,`Changes`,`Pull request`,`Started`].map(e=>(0,X.jsx)(`div`,{role:`columnheader`,className:`h-8 border-b border-border text-start text-[12px] font-medium uppercase text-muted-foreground`,children:e},e))}),(0,X.jsx)(hT,{itemSize:103,items:e,itemKey:({run:e})=>e.id,children:({run:e,queuePosition:u},d)=>(0,X.jsx)(hE,{run:e,queuePosition:u,rowIndex:l.indexes[d],onRename:t,onTogglePin:n,now:r,showTokens:i,showCost:a,automationName:o,open:s.has(e.id),toggleExpandedRun:c})})]})})}var hE=Y.memo(function({run:e,queuePosition:t,rowIndex:n,onRename:r,onTogglePin:i,now:a,showTokens:o,showCost:s,automationName:c,open:l,toggleExpandedRun:u}){let d=Ne(e),f=Pn(e),p=Ln(e),m=`task-resources-${e.id}`;return(0,X.jsxs)(`div`,{role:`rowgroup`,children:[(0,X.jsxs)(`div`,{role:`row`,"aria-rowindex":n,"data-status":e.status,"data-slot":`task-summary-row`,"data-run-id":e.id,className:`task-summary-grid group/row`,children:[(0,X.jsxs)(`div`,{role:`cell`,className:`py-5 pr-4 align-top`,children:[(0,X.jsx)(DE,{run:e,to:`/tasks/${e.id}`,onRename:r,onTogglePin:i}),(0,X.jsx)(`div`,{className:`mt-1`,children:(0,X.jsx)(TE,{run:e,automationName:c})}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`button`,{type:`button`,"data-task-control":`resources`,"aria-label":`${l?`Hide`:`Show`} resources for ${K(e)}`,"aria-expanded":l,"aria-controls":m,"aria-describedby":`summary-status-${e.id}`,onClick:()=>u(e.id),className:`inline-flex min-h-[26px] items-center gap-1 rounded-md p-0 text-[11px] text-muted-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:(0,X.jsxs)(wT,{id:`summary-status-${e.id}`,dot:d.tone,shape:d.shape,pulse:d.pulse,children:[d.label,f?` ${f.label}`:``]})}),e.status===`queued`&&t!==null?(0,X.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`#`,t,` in queue`]}):null]})]}),(0,X.jsx)(`div`,{role:`cell`,className:`truncate pr-3 text-xs text-muted-foreground`,title:Kn(e),children:Kn(e)}),(0,X.jsx)(`div`,{role:`cell`,className:`pr-2 text-xs`,children:e.diffStat?(0,X.jsx)(wm,{stat:e.diffStat}):(0,X.jsx)(NE,{})}),(0,X.jsx)(`div`,{role:`cell`,className:`pr-2`,children:p?(0,X.jsx)(ch,{run:e,reference:p,compact:!0}):(0,X.jsx)(NE,{})}),(0,X.jsx)(`div`,{role:`cell`,className:`text-xs text-muted-foreground`,children:_i(e.startedAt??e.createdAt,a)})]}),l?(0,X.jsx)(`div`,{role:`row`,"aria-rowindex":n+1,"data-run-id":e.id,children:(0,X.jsx)(`div`,{role:`cell`,"aria-colspan":5,className:`border-b border-border pb-5`,children:(0,X.jsxs)(`div`,{id:m,className:`flex flex-col gap-3`,children:[(0,X.jsx)(qT,{runId:e.id,status:d.label,error:e.error,open:(0,X.jsx)(U,{asChild:!0,variant:`outline`,className:`min-h-11`,children:(0,X.jsxs)(G,{"data-task-control":`open`,to:`/tasks/${e.id}`,children:[`Open task`,(0,X.jsxs)(`span`,{className:`sr-only`,children:[`: `,K(e)]})]})})}),(0,X.jsx)(`div`,{className:`rounded-md bg-muted/50 p-4`,children:(0,X.jsx)(_E,{run:e,showTokens:o,showCost:s})})]})})}):null]})});function gE({desktop:e,expandedRuns:t,toggleExpandedRun:n,group:r,detailedTable:i,columns:a,expandedColumns:o,onToggleColumn:s,columnsPending:c,onRename:l,onTogglePin:u,now:d,showTokens:f,showCost:p,automationName:m}){let h=r.rows.flatMap(e=>RT(e).map(t=>({run:t,queuePosition:t.status===`queued`?e.queuePosition:null})));return(0,X.jsxs)(X.Fragment,{children:[e&&!i?(0,X.jsx)(mE,{expandedRuns:t,toggleExpandedRun:n,rows:h,onRename:l,onTogglePin:u,now:d,showTokens:f,showCost:p,automationName:m}):null,e&&i?(0,X.jsx)(`div`,{"data-slot":`tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card`,children:(0,X.jsx)(Qu,{children:(0,X.jsxs)(`div`,{role:`table`,"aria-rowcount":h.length+1,className:`task-resource-grid`,style:fw(a,o),children:[(0,X.jsx)(`div`,{role:`row`,"aria-rowindex":1,className:`task-resource-row`,children:a.map(e=>(0,X.jsx)(bE,{column:e,expanded:sw(e.id,o),onToggle:s,disabled:c},e.id))}),(0,X.jsx)(hT,{itemSize:50,items:h,itemKey:({run:e})=>e.id,children:({run:e,queuePosition:t},n)=>(0,X.jsx)(CE,{rowIndex:n+2,run:e,queuePosition:t,onRename:l,onTogglePin:u,now:d,columns:a,expandedColumns:o,automationName:m})})]})})}):null,e?null:(0,X.jsx)(`div`,{"data-slot":`task-cards`,className:`flex flex-col rounded-lg border border-border bg-card p-5`,children:(0,X.jsx)(hT,{itemSize:178,items:h,itemKey:({run:e})=>e.id,children:({run:e,queuePosition:r})=>(0,X.jsx)(jE,{resourcesOpen:t.has(e.id),onToggleResources:n,run:e,queuePosition:r,now:d,showTokens:f,showCost:p,onTogglePin:u,automationName:m},e.id)})})]})}function _E({run:e,showTokens:t,showCost:n}){let r=Mn(e,Dn(e.id));return(0,X.jsxs)(`dl`,{className:`grid grid-cols-2 gap-4 text-xs md:grid-cols-4`,children:[t?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Tokens in / out`}),(0,X.jsx)(`dd`,{className:`mt-1`,children:(0,X.jsx)(CT,{inputTokens:e.inputTokens,outputTokens:e.outputTokens,omitWhenUnknown:!1})})]}):null,n?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Cost`}),(0,X.jsx)(`dd`,{className:`mt-1`,children:Hn(e.costUsd)||`—`})]}):null,(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`CPU`}),(0,X.jsx)(`dd`,{className:`mt-1`,title:r.cpu.title,children:r.cpu.text||`—`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Memory`}),(0,X.jsx)(`dd`,{className:`mt-1`,title:r.mem.title,children:r.mem.text||`—`})]}),e.branch?(0,X.jsxs)(`div`,{className:`col-span-2`,children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Branch`}),(0,X.jsx)(`dd`,{className:`mt-1 break-all`,children:e.branch})]}):null]})}function vE({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:c(`flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground`,a&&`border-accent-strong font-semibold text-accent-text`),children:[i,r===0?null:(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[` · `,r]})]})}function yE({children:e,right:t=!1,columnId:n,folded:r=!1}){return(0,X.jsx)(`div`,{role:`columnheader`,"data-column-id":n,"data-folded":r||void 0,className:c(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-supporting-foreground uppercase first:pl-4 last:pr-4`,t&&`text-right`,r&&`px-0 first:pl-0 last:pr-0`),children:e})}function bE({column:e,expanded:t,onToggle:n,disabled:r}){if(!e.canFold)return(0,X.jsx)(yE,{columnId:e.id,right:e.align===`right`,children:e.label});let i=t?`Fold`:`Expand`;return(0,X.jsx)(yE,{columnId:e.id,right:e.align===`right`,folded:!t,children:(0,X.jsxs)($u,{children:[(0,X.jsx)(ed,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`${i} ${e.label} column`,"aria-pressed":t,disabled:r,onClick:()=>n(e.id),className:c(`inline-flex h-8 w-full items-center gap-1 rounded-sm px-0.5 text-inherit outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-wait disabled:opacity-60`,e.align===`right`?`justify-end`:`justify-start`,!t&&`justify-center px-0`),children:t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:e.label}),(0,X.jsx)(ss,{className:`size-3 opacity-55`,"aria-hidden":`true`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(xE,{icon:e.icon}),(0,X.jsx)(cs,{className:`size-3 opacity-70`,"aria-hidden":`true`})]})})}),(0,X.jsxs)(td,{side:`top`,children:[e.label,` · `,i,` column`]})]})})}function xE({icon:e}){let t=`size-3.5`;switch(e){case`workflow`:return(0,X.jsx)(Vr,{className:t,"aria-hidden":`true`});case`branch`:return(0,X.jsx)(Zn,{className:t,"aria-hidden":`true`});case`diff`:return(0,X.jsx)($n,{className:t,"aria-hidden":`true`});case`reference`:return(0,X.jsx)(Ss,{className:t,"aria-hidden":`true`});case`tokens`:return(0,X.jsx)(us,{className:t,"aria-hidden":`true`});case`cost`:return(0,X.jsx)(ps,{className:t,"aria-hidden":`true`});case`cpu`:return(0,X.jsx)(Wr,{className:t,"aria-hidden":`true`});case`memory`:return(0,X.jsx)(ws,{className:t,"aria-hidden":`true`});case`started`:return(0,X.jsx)(ls,{className:t,"aria-hidden":`true`});default:return null}}var SE=`h-[88px] border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`,CE=Y.memo(function({rowIndex:e,run:t,queuePosition:n,onRename:r,onTogglePin:i,now:a,columns:o,expandedColumns:s,automationName:l}){let u=Da(),d=Ne(t),f=Pn(t),p=`/tasks/${t.id}`,m=Hn(t.costUsd),h=Ln(t);return(0,X.jsx)(`div`,{role:`row`,"aria-rowindex":e,"data-slot":`task-table-row`,"data-run-id":t.id,onClick:e=>{e.target.closest(`a, button, input`)||u(p)},className:`task-resource-row group/row cursor-pointer hover:bg-muted`,children:o.map(e=>{if(e.id===`memory`)return null;if(e.id===`cpu`){let r=sw(`cpu`,s),i=sw(`memory`,s);return n!==null&&(r||i)?(0,X.jsxs)(`div`,{role:`cell`,"data-slot":`queue-note`,"data-column-id":`cpu-memory`,"aria-colspan":2,style:{gridColumn:`span 2`},className:c(SE,`text-right font-mono text-[11px] text-supporting-foreground`),children:[`#`,n,` in queue`]},e.id):(0,X.jsx)(OE,{run:t,cpuExpanded:r,memoryExpanded:i},e.id)}return(0,X.jsx)(wE,{column:e,expanded:sw(e.id,s),run:t,attention:d,scheduled:f,reference:h,cost:m,to:p,onRename:r,onTogglePin:i,now:a,automationName:l},e.id)})})});function wE({column:e,expanded:t,run:n,attention:r,scheduled:i,reference:a,cost:o,to:s,onRename:l,onTogglePin:u,now:d,automationName:f}){if(!t)return(0,X.jsx)(EE,{column:e.id});switch(e.id){case`status`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`overflow-hidden`),children:(0,X.jsx)(wT,{dot:r.tone,shape:r.shape,pulse:r.pulse,title:i?.title??r.label,className:`w-full max-w-full overflow-hidden`,children:(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[r.label,i?(0,X.jsxs)(X.Fragment,{children:[` `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:i.label})]}):null]})})});case`task`:return(0,X.jsxs)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`min-w-[320px] max-w-0 whitespace-normal`),children:[(0,X.jsx)(DE,{run:n,to:s,onRename:l,onTogglePin:u}),(0,X.jsx)(`div`,{className:`mt-1`,children:(0,X.jsx)(TE,{run:n,automationName:f})})]});case`workflow`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`max-w-0 truncate text-[13px] text-muted-foreground`),children:Kn(n)});case`branch`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`max-w-0 overflow-hidden`),children:n.branch?(0,X.jsx)(PE,{branch:n.branch}):(0,X.jsx)(NE,{})});case`diff`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`overflow-hidden`),children:n.diffStat?(0,X.jsx)(wm,{stat:n.diffStat,compact:!0,className:`block max-w-full`}):(0,X.jsx)(NE,{})});case`reference`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`overflow-hidden`),children:a?(0,X.jsx)(ch,{run:n,reference:a,compact:!0,className:`max-w-full overflow-hidden`}):(0,X.jsx)(NE,{})});case`tokens`:let t=xT(n.inputTokens,n.outputTokens);return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`text-right text-xs text-muted-foreground`),children:(0,X.jsx)(CT,{inputTokens:n.inputTokens,outputTokens:n.outputTokens,variant:`table`,omitWhenUnknown:!1,title:t,className:`block max-w-full overflow-hidden text-ellipsis`})});case`cost`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:o?(0,X.jsx)(AE,{text:o,accessibleText:`$${n.costUsd}`}):(0,X.jsx)(NE,{})});case`started`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`text-right text-xs text-supporting-foreground tabular-nums`),children:_i(n.startedAt??n.createdAt,d)});default:return null}}function TE({run:e,automationName:t}){return(0,X.jsx)(KT,{automationId:e.automationId,automationName:e.automationId===void 0?void 0:t(e.automationId)})}function EE({column:e}){return(0,X.jsx)(`div`,{role:`cell`,"aria-hidden":`true`,"data-column-id":e,"data-folded":`true`,className:c(SE,`px-0 first:pl-0 last:pr-0`)})}function DE({run:e,to:t,onTogglePin:n}){let r=K(e),i=oT(e),a=no(e),o=jl(e);return i.editing?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-slot":`table-title-editor`,children:[(0,X.jsx)(tT,{editor:i,className:`basis-full text-[13px] font-medium`}),(0,X.jsx)(U,{size:`sm`,"aria-label":`Save title`,onMouseDown:e=>e.preventDefault(),onClick:i.commit,children:`Save`}),(0,X.jsx)(U,{size:`sm`,variant:`outline`,"aria-label":`Cancel rename`,onMouseDown:e=>e.preventDefault(),onClick:i.cancel,children:`Cancel`})]}):(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.delegation?.role===`worker`?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,X.jsx)(G,{"data-task-control":`title`,to:t,title:r,className:c(`line-clamp-2 min-w-0 flex-1 whitespace-normal rounded-sm text-[13px] leading-[18px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,a?`font-semibold text-foreground`:o?`font-normal text-foreground`:`font-medium`),children:r}),a?(0,X.jsx)(q,{tone:Nl(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null,(0,X.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:i.begin,className:`shrink-0 rounded-sm p-0.5 text-soft-foreground opacity-0 transition-opacity group-hover/row:opacity-100 hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(Ds,{className:`size-3`,"aria-hidden":`true`})}),n?(0,X.jsx)(fh,{pinned:!!e.pinned,onToggle:t=>n(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 OE({run:e,cpuExpanded:t,memoryExpanded:n}){let r=Mn(e,Dn(e.id));return(0,X.jsxs)(X.Fragment,{children:[t?(0,X.jsx)(kE,{column:`cpu`,cell:r.cpu}):(0,X.jsx)(EE,{column:`cpu`}),n?(0,X.jsx)(kE,{column:`memory`,cell:r.mem}):(0,X.jsx)(EE,{column:`memory`})]})}function kE({column:e,cell:t}){let n=t.text&&t.title?`${t.text}; ${t.title}`:t.text;return(0,X.jsx)(`div`,{role:`cell`,"data-usage":e===`memory`?`mem`:e,"data-column-id":e,"data-usage-kind":t.kind,className:c(SE,`overflow-hidden`,`text-right font-mono tabular-nums`,t.kind===`live`&&`bg-accent-strong/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-[11px] text-supporting-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:(0,X.jsx)(AE,{text:t.text||`—`,accessibleText:n||void 0})})}function AE({text:e,accessibleText:t}){return(0,X.jsx)(`span`,{"data-slot":`bounded-metric`,...t?{"aria-label":t,title:t}:{},className:`block max-w-full overflow-hidden text-ellipsis`,children:e})}var jE=Y.memo(function({resourcesOpen:e,onToggleResources:t,run:n,queuePosition:r,now:i,showTokens:a,showCost:o,onTogglePin:s,automationName:l}){let u=Da(),d=Ne(n),f=Pn(n),p=`/tasks/${n.id}`,m=Ln(n),h=no(n),g=jl(n);return(0,X.jsxs)(`div`,{"data-slot":`task-card`,"data-status":n.status,"data-run-id":n.id,onClick:e=>{e.target.closest(`a, button`)||u(p)},className:`cursor-pointer border-b border-border py-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2.5`,children:[(0,X.jsx)(`button`,{"data-slot":`mobile-resources-toggle`,"data-task-control":`resources`,type:`button`,"aria-controls":`mobile-resources-${n.id}`,"aria-describedby":`mobile-status-${n.id}`,"aria-label":e?`Hide resources`:`Show resources`,title:e?`Hide resources`:`Show resources`,"aria-expanded":e,onClick:()=>t(n.id),children:(0,X.jsxs)(wT,{id:`mobile-status-${n.id}`,dot:d.tone,shape:d.shape,pulse:d.pulse,className:`mt-px shrink-0`,title:f?.title,children:[d.label,f?(0,X.jsx)(`span`,{className:`tabular-nums`,children:f.label}):null]})}),(0,X.jsxs)(G,{"data-task-control":`title`,to:p,className:c(`order-first w-full min-w-0 rounded-sm text-[14px] leading-[1.35] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,h?`font-semibold text-foreground`:g?`font-normal text-foreground`:`font-medium`),children:[n.delegation?.role===`worker`?(0,X.jsx)(`span`,{className:`mr-2 text-xs text-muted-foreground`,children:`Worker`}):null,K(n)]}),h?(0,X.jsx)(q,{tone:Nl(n),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`mt-1.5 shrink-0`}):null,(0,X.jsx)(`div`,{className:`order-first w-full`,children:(0,X.jsx)(TE,{run:n,automationName:l})}),s?(0,X.jsx)(fh,{pinned:!!n.pinned,onToggle:e=>s(n,e),className:`mt-px`}):null]}),(0,X.jsxs)(`div`,{"data-slot":`mobile-task-meta`,className:`mt-4 grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-3 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:Kn(n)}),r===null?n.diffStat?(0,X.jsx)(wm,{stat:n.diffStat}):(0,X.jsx)(NE,{}):(0,X.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,r,` in queue`]}),(0,X.jsx)(`span`,{children:_i(n.startedAt??n.createdAt,i)})]}),m?(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsx)(ch,{run:n,reference:m})}):null,e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsx)(qT,{runId:n.id,status:d.label,error:n.error,open:(0,X.jsx)(U,{asChild:!0,variant:`outline`,className:`min-h-11`,children:(0,X.jsxs)(G,{"data-task-control":`open`,to:p,children:[`Open task`,(0,X.jsxs)(`span`,{className:`sr-only`,children:[`: `,K(n)]})]})})})}),(0,X.jsx)(ME,{run:n,showTokens:a,showCost:o})]}):null]})});function ME({run:e,showTokens:t,showCost:n}){let r=Mn(e,Dn(e.id));return(0,X.jsxs)(`dl`,{id:`mobile-resources-${e.id}`,className:`mt-3 grid grid-cols-2 gap-3 rounded-md bg-muted p-3 text-xs`,children:[e.branch?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Branch`}),(0,X.jsx)(`dd`,{children:e.branch})]}):null,(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`CPU`}),(0,X.jsx)(`dd`,{children:r.cpu.text||`—`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Memory`}),(0,X.jsx)(`dd`,{children:r.mem.text||`—`})]}),t?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`IN / OUT`}),(0,X.jsx)(`dd`,{children:(0,X.jsx)(CT,{inputTokens:e.inputTokens,outputTokens:e.outputTokens})})]}):null,n?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Cost`}),(0,X.jsx)(`dd`,{children:Hn(e.costUsd)||`—`})]}):null]})}function NE(){return(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function PE({branch:e}){return(0,X.jsx)(`span`,{title:e,className:`block truncate rounded-[6px] bg-muted px-1.5 py-0.5 font-mono text-[11px] font-medium text-muted-foreground`,children:e})}function FE(){let e=ln(),t=QT(St().data),n=kf(),{view:r,setView:i,origin:a,setOrigin:o,urlQuery:s,writeQuery:c}=LE(),l=Lt(),u=F(),d=BE(e.data,r),f=qt({mutationFn:e=>ye(Zt(),void 0,e),onSuccess:()=>l.invalidateAfter(`runs`,()=>Zt()),onError:e=>V(e.message,{tone:`danger`})}),p=qt({mutationFn:e=>M(e),onSuccess:()=>u.invalidateQueries({queryKey:on.runs.all}),onError:e=>V(e.message,{tone:`danger`})}),h=qt({mutationFn:({id:e,title:t})=>m(e,{title:t}),onSuccess:()=>u.invalidateQueries({queryKey:on.runs.all}),onError:e=>V(e.message,{tone:`danger`})}),g=dn(),_=Nh(3e4),v=eE(),y=It(),b=kt(void 0,{retryOnMount:!1}),x=tn({retryOnMount:!1}).data?.projects?.find(e=>e.id===y)?.name,S=[...e.data??[],...d.pages?.runs??[]].some(e=>e.automationId!==void 0),C=Ht([void 0],n&&S),w=Y.useCallback(e=>C(void 0,e),[C]),T=Y.useMemo(()=>y===void 0?[]:(e.data??[]).flatMap(e=>{let t=Ln(e);return t?[{projectId:y,kind:t.kind,number:t.number}]:[]}),[e.data,y]),E=Y.useCallback((e,t)=>h.mutate({id:e,title:t}),[h.mutate]),D=Y.useCallback((e,t)=>g.mutate({id:e.id,pinned:t}),[g.mutate]);return(0,X.jsx)(Ci,{projectId:y,repoBase:b,requests:T,children:(0,X.jsx)(nE,{runs:e.data,projectName:x,error:e.error?.message,onRetry:()=>void e.refetch(),view:r,onViewChange:i,origin:a,onOriginChange:o,automations:n,urlQuery:s,onQueryChange:c,foldScope:`project:${y??`default`}`,automationName:w,onArchiveFinished:e=>{f.isPending||f.mutate(e)},archivePending:f.isPending,onMarkAllRead:e=>p.mutate(e),onRename:E,onTogglePin:D,now:_,showTokens:t.tokens,showCost:t.cost,expandedColumns:v.expandedColumns,onToggleColumn:v.toggleColumn,columnsPending:v.isPending,archivedPages:d.pages,archivedTotal:d.total,onArchivedSearch:d.search})})}function IE(e,t){return n=>(t===null?n.delete(e):n.set(e,t),n)}function LE(){let[e,t]=iC(),n=e.get(`archived`)===`1`?`archived`:`active`,r=OT(e.get(`origin`)),[i,a]=Y.useState(n),[o,s]=Y.useState(r);Y.useEffect(()=>a(n),[n]),Y.useEffect(()=>s(r),[r]);let c=e.get(`q`)??``,l=Y.useRef(void 0);return Y.useEffect(()=>{let e=l;return()=>clearTimeout(e.current)},[]),{view:i,setView:e=>{a(e),t(IE(`archived`,e===`archived`?`1`:null))},origin:o,setOrigin:e=>{s(e),t(IE(`origin`,e===`all`?null:e))},urlQuery:c,writeQuery:Y.useCallback((e,n)=>{clearTimeout(l.current);let r=e.trim();l.current=setTimeout(()=>t(e=>{let t=e.get(`q`),i=IE(`q`,r===``?null:r)(e);return i.get(`q`)!==t&&n(r),i}),RE)},[t])}}var RE=250,zE=150;function BE(e,t){Lt();let n=F(),[r,i]=Y.useState(``),[a,o]=Y.useState(``);Y.useEffect(()=>{let e=setTimeout(()=>o(r),zE);return()=>clearTimeout(e)},[r]);let s=e!==void 0&&Qa(e).archived>=200,{data:c,isError:l,isPlaceholderData:u,hasNextPage:d,isFetchingNextPage:f,fetchNextPage:p,refetch:m}=an(a,t===`archived`&&(a!==``||s)),h=c?.pages,g=Y.useMemo(()=>h||l?{runs:(h??[]).flatMap(e=>e.runs),query:u?null:a,hasMore:d,loading:f,onLoadMore:()=>void(h?p():m()),failed:l}:void 0,[h,l,u,a,d,f,p,m]),_=a===``?h:n.getQueryData(on.runs.archived(``))?.pages,v=_===void 0?void 0:_.at(-1)?.nextCursor!=null;return{pages:Y.useMemo(()=>g&&{...g,plainHasMore:v},[g,v]),total:_?.[0]?.total,search:i}}function VE({projects:e,perProjectLimit:t}){return e.length===0?null:(0,X.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-[11px] text-soft-foreground`,children:[`Showing every active task and the newest `,t,` archived tasks per project — older archived tasks in`,` `,e.join(`, `),` are in that project’s own Tasks page.`]})}function HE({registry:e}){return e.length<=1?null:(0,X.jsxs)(`section`,{"data-slot":`other-projects`,className:`rounded-lg border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Other projects`}),(0,X.jsx)(`div`,{className:`mt-3 flex flex-col divide-y divide-border`,children:e.map(e=>(0,X.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-[13px]`,children:e.name}),(0,X.jsxs)(z,{to:Ea(e.id,`/`),className:`inline-flex min-h-11 shrink-0 items-center rounded-md px-3 text-xs text-accent-text hover:bg-accent-strong/10`,children:[`View tasks`,(0,X.jsxs)(`span`,{className:`sr-only`,children:[` for `,e.name]})]})]},e.id))})]})}function UE({view:e,filtered:t}){return t?(0,X.jsx)(ko,{heading:`h2`,icon:(0,X.jsx)(Oi,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,X.jsx)(ko,{heading:`h2`,icon:(0,X.jsx)(Rr,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,X.jsx)(ko,{heading:`h2`,icon:(0,X.jsx)(Cs,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}function WE({groupBy:e,filterDetailsOpen:t,message:n,onRetry:r}){return(0,X.jsx)(`div`,{"data-route":`global-tasks`,"data-presentation":e===`none`?`summary`:`cards`,"data-filter-details":t,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:(0,X.jsx)(ko,{icon:(0,X.jsx)(Gr,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:n,actions:(0,X.jsx)(U,{variant:`outline`,onClick:r,children:`Retry`})})})}function GE({slot:e,label:t,options:n,selected:r,onToggle:i,onClear:a,searchPlaceholder:o,emptyLabel:s=`Nothing to filter by`}){let[l,u]=Y.useState(!1),d=r.length>0,f=r.length===1?n.find(e=>e.value===r[0])?.label??r[0]:`${r.length} selected`;return(0,X.jsxs)(ga,{open:l,onOpenChange:u,children:[(0,X.jsx)(fa,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`facet-${e}`,"data-active":d?`true`:void 0,"aria-label":`Filter by ${t.toLowerCase()}`,className:c(`inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,d&&`border-accent-strong/40 bg-accent-strong/10 text-foreground`),children:[(0,X.jsx)(`span`,{className:c(d&&`text-soft-foreground`),children:t}),d?(0,X.jsx)(`span`,{className:`max-w-[140px] truncate font-semibold`,children:f}):null,(0,X.jsx)(Xr,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,X.jsxs)(ha,{align:`start`,className:`w-64 p-0`,"data-testid":`facet-${e}-menu`,children:[(0,X.jsxs)(fo,{children:[(0,X.jsx)(io,{placeholder:o??`Search ${t.toLowerCase()}…`}),(0,X.jsxs)(uo,{children:[(0,X.jsx)(lo,{children:s}),(0,X.jsx)(J,{children:n.map(e=>{let t=r.includes(e.value);return(0,X.jsxs)(co,{value:e.label,onSelect:()=>i(e.value),"data-slot":`facet-option`,"data-value":e.value,"aria-checked":t,role:`option`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:c(`flex size-4 shrink-0 items-center justify-center rounded-[4px] border`,t?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-input`),children:t?(0,X.jsx)(Jr,{className:`size-3`}):null}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.count===void 0?null:(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:e.count})]},e.value)})})]})]}),d?(0,X.jsx)(`div`,{className:`border-t border-border p-1`,children:(0,X.jsxs)(`button`,{type:`button`,"data-action":`facet-${e}-clear`,onClick:()=>a(),className:`w-full rounded-sm px-2 py-1.5 text-left text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[`Clear `,t.toLowerCase()]})}):null]})]})}function KE({label:e,count:t,selected:n,onToggle:r,slot:i,tone:a=`neutral`}){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":i,"data-selected":n?`true`:void 0,"aria-pressed":n,onClick:r,className:c(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-xs font-medium transition-colors`,a===`tag`?`border-accent-strong/25 bg-accent-strong/10 text-accent-text hover:bg-accent-strong/20`:`border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground`,n&&`border-accent-strong bg-accent-strong text-accent-strong-foreground hover:bg-accent-strong`),children:[e,t===void 0?null:(0,X.jsx)(`span`,{className:c(`font-mono text-[11px] tabular-nums`,!n&&`text-soft-foreground`),children:t})]})}function qE({slot:e,label:t,value:n,options:r,onChange:i,size:a=`compact`}){return(0,X.jsx)(`div`,{"data-slot":e,role:`group`,"aria-label":t,className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:r.map(e=>{let t=e.value===n;return(0,X.jsx)(`button`,{type:`button`,"data-value":e.value,"aria-pressed":t,disabled:e.disabled,title:e.title,onClick:()=>i(e.value),className:c(`flex h-6 items-center justify-center rounded-[6px] px-2.5 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,a===`touch`&&`h-11 px-4 text-[13px]`,t&&`bg-card font-semibold text-foreground shadow-xs`),children:e.label},e.value)})})}var JE=` untagged`,YE=[{value:`project`,label:`Project`},{value:`tag`,label:`Tag`},{value:`status`,label:`Status`},{value:`workflow`,label:`Workflow`}];function XE(e,t){return e===t?`none`:t}var ZE={query:``,tags:[],statuses:[],workflows:[]};function QE(e,t){let{origin:n,...r}=e;return t===`all`?r:{...r,origin:t}}function $E(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function eD(e){return(e.projects?.length??0)+e.tags.length+e.statuses.length+e.workflows.length+(e.origin===void 0||e.origin===`all`?0:1)}function tD(e){return e.query.trim()!==``||eD(e)>0}function nD(e){return eD(e.filters)+(e.filters.query.trim()===``?0:1)+(e.groupBy===`none`?0:1)}function rD(e){return nD(e)>0}function iD(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.filter(e=>!Ya(e)).map(e=>{let t=n.get(e.projectId);return{run:e,project:t,projectName:t?.name||e.projectId,tags:t?.tags??[]}})}function aD(e){let t=new Set;for(let n of e)t.add(n.run.workflow);return[...t].sort((e,t)=>e.localeCompare(t))}function oD(e){let t=new Set;for(let n of e)t.add(n.run.status);return[...t].sort((e,t)=>e.localeCompare(t))}function sD(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 cD=e=>e.tags.length===0?[JE]:e.tags,lD=(e,t)=>e.length===0||t.some(t=>e.includes(t)),uD=(e,t)=>{if(t.length===0)return!0;let n=cD(e).map(e=>e.toLowerCase());return t.some(e=>n.includes(e.toLowerCase()))};function dD(e,t){return{displayTitle:K(e.run),projectName:e.projectName,tags:e.tags,automation:e.run.automationId===void 0?void 0:t(e)??e.run.automationId,references:()=>zn(e.run)}}function fD(e,t,n,r=()=>void 0){let i=t.query.trim()!==``;return e.filter(e=>(n===`archived`?!e.run.archived:e.run.archived)||!kT(e.run,t.origin??`all`)||!lD(t.projects??[],[e.run.projectId])||!lD(t.statuses,[e.run.status])||!lD(t.workflows,[e.run.workflow])||!uD(e,t.tags)?!1:!i||qn(e.run,t.query,{scope:`shown`,extras:dD(e,r)}))}function pD(e,t,n,r,i){return fD(e,r===`origin`?{...t,origin:`all`}:{...t,[r]:[]},n,i)}function mD(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(JE,`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 hD(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var $={query:`q`,project:`project`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,archived:`archived`,origin:`origin`},gD=new Set(YE.map(e=>e.value));function _D(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set($.query,n);for(let n of e.filters.tags)n===` untagged`?t.set($.untagged,`1`):t.append($.tag,n);for(let n of e.filters.projects??[])t.append($.project,n);for(let n of e.filters.statuses)t.append($.status,n);for(let n of e.filters.workflows)t.append($.workflow,n);return e.groupBy!==`none`&&t.set($.groupBy,e.groupBy),e.view===`archived`&&t.set($.archived,`1`),e.filters.origin!==void 0&&e.filters.origin!==`all`&&t.set($.origin,e.filters.origin),t}function vD(e,t){let n=e.getAll($.tag).filter(e=>e!==``);e.get($.untagged)===`1`&&n.push(JE);let r=e.get($.groupBy)??``,i=DT(OT(e.get($.origin)),t);return{filters:{query:e.get($.query)??``,...e.has($.project)?{projects:e.getAll($.project).filter(Boolean)}:{},tags:n,statuses:e.getAll($.status).filter(e=>e!==``),workflows:e.getAll($.workflow).filter(e=>e!==``),...i===`all`?{}:{origin:i}},groupBy:gD.has(r)?r:`none`,view:e.get($.archived)===`1`?`archived`:`active`}}var yD=15e3,bD=250,xD=1,SD=new Set([`done`,`failed`,`cancelled`]);function CD(){return TD({request:({task:e,archived:t})=>Re(rn(e.run.id,{projectId:e.run.projectId}),t),patch:({archived:e})=>t=>({...t,archived:e})})}function wD(){return TD({request:({task:e,read:t})=>ze(rn(e.run.id,{projectId:e.run.projectId}),t),patch:({read:e})=>t=>{if(e)return{...t,seenAt:new Date().toISOString()};let{seenAt:n,...r}=t;return r}})}function TD({request:e,patch:t}){let n=Lt();return qt({mutationFn:e,onMutate:e=>n.patchIndex(rn(e.task.run.id,{projectId:e.task.run.projectId}),()=>t(e)),onError:(e,t,n)=>{n?.rollback(),V(e.message,{tone:`danger`})},onSettled:(e,t,{task:r},i)=>{i?i.settle():n.invalidateAfter(`indexed`,rn(r.run.id,{projectId:r.run.projectId}))}})}function ED(){let{expandedRuns:e,toggleExpandedRun:t}=nw(),n=tn(),r=QT(St().data),i=un(!0,yD),[a,o]=iC(),s=kf(),{filters:c,groupBy:l,view:u}=Y.useMemo(()=>vD(a,s),[a,s]),d=Nh(3e4),f=e=>o(t=>{let n=_D(e(vD(t,!0))),r=t.get(`tasks`);return(r===`flat`||r===`virtual`)&&n.set(`tasks`,r),n}),p=e=>f(t=>({...t,filters:e(t.filters)})),m=e=>f(t=>({...t,groupBy:e})),h=e=>f(t=>({...t,view:e})),[g,_]=Y.useState(l!==`none`||c.tags.length>0),[v,y]=kD(c.query,e=>p(t=>({...t,query:e}))),b=i.data?.referenceStatuses;Y.useEffect(()=>{b&&Xt(b)},[b]);let x=Y.useMemo(()=>n.data?.projects??[],[n.data]),S=Y.useMemo(()=>i.data?.runs??[],[i.data]),C=Y.useMemo(()=>iD(S,x),[S,x]),{nameOf:w,visible:T,originTotals:E,statusGroups:D,folds:O}=AD({tasks:C,filters:c,view:u,groupBy:l,index:S,automationsOn:s}),k=Y.useMemo(()=>mD(T,l),[T,l]),A=c.origin??`all`,j=e=>p(t=>QE(t,e)),M=Y.useMemo(()=>T.flatMap(e=>In(e.run,e.project?.repoUrl).filter(t=>Nn(t,e.project?.repoUrl)).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[T]),ee=hD(i.data?.truncated??[],x),te=(e,t)=>p(n=>({...n,[e]:$E(n[e]??[],t)})),ne=e=>p(t=>({...t,[e]:[]})),re=CD(),ie=wD(),N=Y.useCallback((e,t)=>re.mutate({task:e,archived:t}),[re.mutate]),P=Y.useCallback((e,t)=>ie.mutate({task:e,read:t}),[ie.mutate]),ae=i.error??n.error;if(ae)return(0,X.jsx)(WE,{groupBy:l,filterDetailsOpen:g,message:ae.message,onRetry:()=>{i.refetch(),n.refetch()}});let oe=(0,X.jsxs)(`div`,{className:`relative w-full`,children:[(0,X.jsx)(hr,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-soft-foreground`,"aria-hidden":`true`}),(0,X.jsx)(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`Search every project…`,"aria-label":`Search tasks across projects`,className:`h-11 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]});return(0,X.jsxs)(gT,{layout:l,revision:k,visibilityRevision:JSON.stringify([$a.map(O.isCollapsed),[...e].sort(),u,g]),"data-route":`global-tasks`,"data-presentation":l===`none`?`summary`:`cards`,"data-filter-details":g,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:[(0,X.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-[22px]`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`All tasks`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:l===`none`?`Every project. One place to review what your agents have shipped.`:`Filter across projects and act on each run without opening the session.`})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-6 border-b border-border`,children:[(0,X.jsx)(jD,{view:`active`,current:u,onSelect:h,children:`Active`}),(0,X.jsx)(jD,{view:`archived`,current:u,onSelect:h,children:`Archived`}),(0,X.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`ml-auto text-[13px] text-soft-foreground tabular-nums`,children:[T.length,` of `,C.length,ee.length>0?` loaded`:``]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,X.jsx)(`div`,{className:`min-w-0 basis-full md:flex-1 md:basis-auto`,children:oe}),(0,X.jsxs)(U,{variant:`outline`,"aria-expanded":g,onClick:()=>_(e=>!e),children:[(0,X.jsx)(br,{"aria-hidden":`true`}),`Filters`]}),(0,X.jsx)(U,{asChild:!0,className:`min-h-11`,children:(0,X.jsxs)(z,{to:Ea(n.data?.bootProject??`default`,`/new`),children:[(0,X.jsx)(ar,{"aria-hidden":`true`}),`New task`]})})]}),(0,X.jsx)(UT,{origin:A,counts:E,automations:s,onChange:j,labels:D.map(e=>e.label),onSetAll:O.setAll})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[22px]`,children:[(0,X.jsx)(MD,{filters:c,onToggle:te,onClearFacet:ne,onClearAll:()=>{y(``),f(e=>({...e,filters:ZE,groupBy:`none`}))},groupBy:l,onGroupByChange:m,projects:x,tasks:C,view:u,automationName:w}),(0,X.jsx)(VE,{projects:ee,perProjectLimit:i.data?.perProjectLimit}),i.data===void 0?(0,X.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading tasks…`}):(0,X.jsx)(DD,{view:u,filtered:tD(c),visibleCount:T.length,referenceRequests:M,lists:{groupBy:l,view:u,statusGroups:D,groups:k,folds:O,row:{now:d,onArchive:N,expandedRuns:e,toggleExpandedRun:t,onSetRead:P,busy:re.isPending||ie.isPending,showCost:r.cost,automationName:w}}}),(0,X.jsx)(HE,{registry:x})]})]})}function DD({view:e,filtered:t,visibleCount:n,referenceRequests:r,lists:i}){return n===0?(0,X.jsx)(UE,{view:e,filtered:t}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ci,{requests:r,children:(0,X.jsx)(OD,{...i})}),i.groupBy===`none`?(0,X.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Resource details—including tokens, cost, CPU and peak memory—are available when a task row is expanded.`}):null]})}function OD({groupBy:e,view:t,statusGroups:n,groups:r,folds:i,row:a}){return(0,X.jsx)(X.Fragment,{children:e===`none`?n.map(e=>{let n=NT(e);return(0,X.jsx)(GT,{id:`global-group-${t}-${e.label.replaceAll(` `,`-`)}`,label:e.label,count:n.length,tone:PT(e.label,n.map(e=>e.run)),folded:i.isFolded(e.label),collapsed:i.isCollapsed(e.label),onToggle:()=>i.toggle(e.label),children:(0,X.jsx)(ND,{summary:!0,tasks:e.rows.flatMap(RT),showProject:!0,...a})},e.label)}):r.map(t=>(0,X.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":t.key,children:[(0,X.jsxs)(`h2`,{className:`mb-1.5 flex items-center gap-2 text-[12px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:[e===`project`?(0,X.jsx)(z,{to:Ea(t.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:t.label}):t.label,(0,X.jsx)(`span`,{className:`font-mono text-[11px] font-medium tabular-nums`,children:t.tasks.length})]}),(0,X.jsx)(ND,{tasks:t.tasks,showProject:e!==`project`,...a})]},t.key))})}function kD(e,t){let[n,r]=Y.useState(e),i=Y.useRef(e);return Y.useEffect(()=>{e!==i.current&&r(e),i.current=e},[e]),Y.useEffect(()=>{if(n===i.current)return;let e=setTimeout(()=>{i.current=n,t(n)},bD);return()=>clearTimeout(e)},[n]),[n,r]}function AD({tasks:e,filters:t,view:n,groupBy:r,index:i,automationsOn:a}){let o=Y.useMemo(()=>[...new Set(e.filter(e=>e.run.automationId!==void 0).map(e=>e.run.projectId))],[e]),s=Ht(o,a&&o.length>0),c=Y.useCallback(e=>e.run.automationId===void 0?void 0:s(e.run.projectId,e.run.automationId),[s]),l=Y.useMemo(()=>fD(e,t,n,c),[e,t,n,c]),u=jT(pD(e,t,n,`origin`,c).map(e=>e.run),n),d=r===`none`?LT(l,n,i):[];return{nameOf:c,visible:l,originTotals:u,statusGroups:d,folds:XT(`global`,n,new Set(t.query.trim()===``?[]:d.map(e=>e.label)))}}function jD({view:e,current:t,onSelect:n,children:r}){let i=e===t;return(0,X.jsx)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":i,onClick:()=>n(e),className:c(`flex min-h-11 items-center justify-center border-b-2 border-transparent text-[13px] font-medium text-muted-foreground`,i&&`border-accent-strong font-semibold text-accent-text`),children:r})}function MD({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,projects:o,tasks:s,view:c,automationName:l}){let u=Y.useMemo(()=>mt(o),[o]),d=Y.useMemo(()=>{let t=(t,n)=>sD(pD(s,e,c,t,l),n);return{projects:t(`projects`,e=>[e.run.projectId]),tags:t(`tags`,cD),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[s,e,c,l]),f=e=>t=>({...t,count:e.get(t.value)??0});return(0,X.jsxs)(`div`,{"data-slot":`global-tasks-filters`,className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(GE,{slot:`project`,label:`Project`,selected:e.projects??[],onToggle:e=>t(`projects`,e),onClear:()=>n(`projects`),options:[...new Map(s.map(e=>[e.run.projectId,e.projectName])).entries()].map(([e,t])=>({value:e,label:t})).map(f(d.projects)),emptyLabel:`No tasks to filter`}),(0,X.jsx)(GE,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:oD(s).map(e=>({value:e,label:e})).map(f(d.statuses)),emptyLabel:`No tasks to filter`}),(0,X.jsx)(GE,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:aD(s).map(e=>({value:e,label:e})).map(f(d.workflows)),emptyLabel:`No tasks to filter`}),(0,X.jsxs)(`div`,{"data-slot":`group-controls`,className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Group by`}),(0,X.jsx)(qE,{slot:`group-by`,label:`Group tasks by`,value:i,options:YE,onChange:e=>a(XE(i,e))})]}),rD({filters:e,groupBy:i})?(0,X.jsxs)(`button`,{type:`button`,"data-action":`clear-filters`,onClick:r,className:`ml-auto inline-flex h-7 items-center gap-1 rounded-full px-2 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,X.jsx)(xr,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${nD({filters:e,groupBy:i})})`]}):null]}),u.length>0?(0,X.jsxs)(`div`,{"data-slot":`tag-filters`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Tags`}),u.map(n=>(0,X.jsx)(KE,{slot:`tag-filter`,tone:`tag`,label:n,count:d.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,X.jsx)(KE,{slot:`tag-filter`,label:`Untagged`,count:d.tags.get(` untagged`)??0,selected:e.tags.includes(JE),onToggle:()=>t(`tags`,JE)})]}):(0,X.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-[11px] text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,X.jsx)(z,{to:`/settings/global/projects`,className:`font-medium text-accent-text hover:underline`,children:wi(`projects`)}),` `,`to group their tasks together here.`]})]})}function ND({summary:e=!1,expandedRuns:t,toggleExpandedRun:n,tasks:r,now:i,showProject:a,onArchive:o,onSetRead:s,busy:c,showCost:l,automationName:u}){let d=pw(r.map(e=>`${e.run.projectId}/${e.run.id}`),t),f=Oh();return(0,X.jsxs)(`div`,{role:e?`table`:void 0,"aria-rowcount":e?d.rowCount:void 0,"data-slot":`global-tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card p-5`,children:[(0,X.jsx)(`div`,{"data-slot":`global-summary-head`,className:`text-[12px]`,role:`row`,"aria-rowindex":1,children:[`Task`,`Workflow`,`Changes`,`Pull request`,`Started`].map(e=>(0,X.jsx)(`span`,{role:`columnheader`,children:e},e))}),(0,X.jsx)(Qu,{children:(0,X.jsx)(hT,{...e?{itemSize:f?115:218}:{},items:r,itemKey:e=>`${e.run.projectId}/${e.run.id}`,children:(r,f)=>(0,X.jsx)(PD,{task:r,summary:e,rowIndex:d.indexes[f],resourcesOpen:t.has(`${r.run.projectId}/${r.run.id}`),toggleExpandedRun:n,now:i,showProject:a,onArchive:o,onSetRead:s,busy:c,showCost:l,automationName:u(r)},`${r.run.projectId}/${r.run.id}`)})})]})}var PD=Y.memo(function({rowIndex:e,resourcesOpen:t,toggleExpandedRun:n,summary:r,task:i,now:a,showProject:o,onArchive:s,onSetRead:c,busy:l,showCost:u,automationName:d}){let f=r?`row`:void 0,p=r?`cell`:void 0,{run:m}=i,h=Ne(m),g=Ea(m.projectId,`/tasks/${m.id}`),_=In(m,i.project?.repoUrl),v=Mn(m,m.usage);return(0,X.jsxs)(`article`,{role:r?`rowgroup`:void 0,"data-status":m.status,"data-expanded":t,"data-slot":`global-task-row`,"data-run-id":m.id,"data-project":m.projectId,className:`hover:bg-muted max-md:flex max-md:flex-wrap max-md:items-center max-md:gap-x-3 max-md:gap-y-2 max-md:border-b max-md:border-border max-md:py-5 `,children:[(0,X.jsxs)(`div`,{"data-slot":`global-task-cells`,className:`contents`,role:f,"aria-rowindex":r?e:void 0,children:[(0,X.jsx)(FD,{summary:r,task:i,showProject:o,automationName:d,resourcesOpen:t,toggleExpandedRun:n}),(0,X.jsx)(`div`,{role:p,"data-slot":`global-task-workflow`,className:`text-[13px] text-muted-foreground`,children:m.workflow}),(0,X.jsx)(`div`,{role:p,"data-slot":`global-task-diff`,className:`text-xs text-muted-foreground`,children:(0,X.jsx)(`span`,{title:`Change totals are available in the project task list`,children:`—`})}),(0,X.jsx)(`div`,{role:p,"data-slot":`global-task-references`,children:_.length>0?(0,X.jsx)(RD,{references:_,run:m,repoBase:i.project?.repoUrl}):(0,X.jsx)(BD,{})}),(0,X.jsx)(`div`,{role:p,"data-slot":`global-task-age`,className:`text-right text-xs text-soft-foreground tabular-nums`,children:_i(m.startedAt??m.createdAt,a)})]}),!r||t?(0,X.jsx)(`div`,{className:`contents`,role:f,"aria-rowindex":r?e+1:void 0,children:(0,X.jsxs)(`div`,{"data-slot":`global-task-detail-cell`,role:p,"aria-colspan":r?5:void 0,className:r?`col-span-full flex flex-col gap-3`:`contents`,children:[(0,X.jsx)(`div`,{"data-slot":`global-task-actions`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,X.jsx)(ID,{task:i,busy:l,onSetRead:c}),(0,X.jsx)(LD,{task:i,busy:l,onArchive:s}),(0,X.jsx)(U,{asChild:!0,variant:`outline`,children:(0,X.jsx)(z,{to:g,children:`Open task`})})]})}),t?(0,X.jsxs)(`div`,{"data-slot":`global-task-resources`,className:`col-span-full flex flex-col gap-3`,children:[(0,X.jsx)(qT,{projectId:m.projectId,runId:m.id,status:h.label,error:m.error,open:(0,X.jsx)(U,{asChild:!0,variant:`outline`,className:`min-h-11`,children:(0,X.jsxs)(z,{to:g,children:[`Open task`,(0,X.jsxs)(`span`,{className:`sr-only`,children:[`: `,K(m)]})]})})}),(0,X.jsxs)(`dl`,{className:`grid grid-cols-2 gap-4 rounded-md bg-muted/50 p-4 text-xs md:grid-cols-3`,children:[u?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Cost`}),(0,X.jsx)(`dd`,{className:`mt-1`,children:Hn(m.costUsd)||`—`})]}):null,(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`CPU`}),(0,X.jsx)(`dd`,{"data-usage":`cpu`,"data-usage-kind":v.cpu.kind,title:v.cpu.title,className:`mt-1`,children:v.cpu.text||`—`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Memory`}),(0,X.jsx)(`dd`,{"data-usage":`mem`,"data-usage-kind":v.mem.kind,title:v.mem.title,className:`mt-1`,children:v.mem.text||`—`})]})]})]}):null]})}):null]})},(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.length===i.tags.length&&n.tags.every((e,t)=>e===i.tags[t])&&Object.keys(r).every(e=>r[e]===a[e])});function FD({summary:e,task:t,showProject:n,automationName:r,resourcesOpen:i,toggleExpandedRun:a}){let{run:o}=t,s=Ne(o),l=Ea(o.projectId,`/tasks/${o.id}`),u=no(o),d=jl(o);return(0,X.jsxs)(`div`,{role:e?`cell`:void 0,"data-slot":`global-task-title`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[o.delegation?.role===`worker`?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,X.jsx)(z,{to:l,title:K(o),"data-task-control":`title`,className:c(`min-w-0 truncate text-[14px] md:text-[13px]`,u?`font-semibold text-foreground`:d?`font-medium text-muted-foreground`:`font-medium`),children:K(o)}),u?(0,X.jsx)(q,{tone:Nl(o),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null]}),(0,X.jsx)(`div`,{className:`mt-1`,children:(0,X.jsx)(KT,{automationId:o.automationId,automationName:r,project:n?(0,X.jsx)(z,{to:Ea(o.projectId,`/`),"data-slot":`task-project`,className:`truncate hover:text-foreground`,children:t.projectName}):void 0})}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`button`,{type:`button`,"data-task-control":`resources`,"aria-expanded":i,"aria-label":`${i?`Hide`:`Show`} resources for ${K(o)}`,onClick:()=>a(`${o.projectId}/${o.id}`),"aria-describedby":`global-status-${o.projectId}-${o.id}`,title:`Resources and actions`,className:`min-h-[26px] rounded-md p-0 text-[11px] text-muted-foreground hover:bg-muted`,children:(0,X.jsx)(wT,{id:`global-status-${o.projectId}-${o.id}`,dot:s.tone,shape:s.shape,pulse:s.pulse,children:s.label})}),(0,X.jsx)(`span`,{children:t.tags.length>0?(0,X.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:t.tags.map(e=>(0,X.jsx)(zD,{tag:e},e))}):null})]})]})}function ID({task:e,busy:t,onSetRead:n}){if(!ro(e.run))return null;let r=no(e.run),i=K(e.run),a=r?`Mark ${i} read`:`Mark ${i} unread`,o=r?hi:hs;return(0,X.jsxs)($u,{children:[(0,X.jsx)(ed,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-action":r?`mark-read`:`mark-unread`,"aria-label":a,disabled:t,onClick:()=>n(e,r),className:c(`inline-flex size-11 items-center justify-center md:size-8 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-accent-icon`:`text-soft-foreground`),children:[(0,X.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:r?`Mark read`:`Mark unread`})]})}),(0,X.jsx)(td,{side:`left`,children:r?`Mark read`:`Mark unread`})]})}function LD({task:e,busy:t,onArchive:n}){let r=e.run.archived;if(!r&&!SD.has(e.run.status))return null;let i=r?`Restore ${K(e.run)} to the active list`:`Archive ${K(e.run)}`;return(0,X.jsxs)($u,{children:[(0,X.jsx)(ed,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-action":r?`unarchive-run`:`archive-run`,"aria-label":i,disabled:t,onClick:()=>n(e,!r),className:`inline-flex size-11 items-center justify-center md:size-8 rounded-md text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,children:[(0,X.jsx)(r?rs:Rr,{className:`size-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:r?`Unarchive`:`Archive`})]})}),(0,X.jsx)(td,{side:`left`,children:r?`Restore`:`Archive`})]})}function RD({references:e,run:t,repoBase:n}){return(0,X.jsx)(dh,{references:e,maxVisible:xD,taskTitle:K(t),projectId:t.projectId,runId:t.id,repoBase:n})}function zD({tag:e,className:t}){return(0,X.jsx)(`span`,{"data-slot":`project-tag`,className:c(`inline-flex max-w-full items-center truncate rounded-full bg-muted px-1.5 py-px text-[11px] font-medium text-muted-foreground`,t),children:e})}function BD(){return(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}var VD=(0,Y.lazy)(()=>R(()=>import(`./automations-route-BwDLBy9v.js`).then(e=>({default:e.AutomationsRoute})),__vite__mapDeps([79,1,2,7,8,6,9,10,11,12,13,14,15,16,17,80,81,28,24,18,66,19,23,62,29,48,41,82,40,56,33,83,42]))),HD=(0,Y.lazy)(()=>R(()=>import(`./workspace-tools-Clb89tgJ.js`).then(e=>({default:e.WorkspaceToolsRoute})),__vite__mapDeps([84,1,2,10,7,8,11,6,9,12,13,14,15,16,17,85,86,87,23,24,30,31,19,32]))),UD=(0,Y.lazy)(()=>R(()=>import(`./settings-shell-BGvilCiB.js`).then(e=>({default:e.SettingsIndexRoute})),__vite__mapDeps([88,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19,23,24,82,28,29,40,41,25,56,87,42,63,46,47,48,33,49,57,58,31,59,22,60,61,62,37,89]))),WD=(0,Y.lazy)(()=>R(()=>import(`./settings-shell-BGvilCiB.js`).then(e=>({default:e.SettingsSectionRoute})),__vite__mapDeps([88,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19,23,24,82,28,29,40,41,25,56,87,42,63,46,47,48,33,49,57,58,31,59,22,60,61,62,37,89]))),GD=(0,Y.lazy)(()=>R(()=>import(`./task-thread-CeJ8GbmR.js`).then(e=>({default:e.TaskThreadRoute})),__vite__mapDeps([90,1,2,7,8,11,6,9,10,12,13,14,15,16,17,85,86,87,18,19,91,73,58,31,59,22,60,61,23,24,62,28,29,48,41,37,69,70,92,93,47,26,27,56,30,76,77,78,36,83,42,94,95,21,96,72,71,82,33,97,98,99]))),KD=(0,Y.lazy)(()=>R(()=>import(`./task-changes-B8siIdj_.js`).then(e=>({default:e.TaskChangesRoute})),__vite__mapDeps([100,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,91,85,86,87,19,73,58,31,59,22,60,61,23,24,62,28,29,48,41,37,69,70,92,93,47,26,27,56,30,76,77,78,36,83,42,94,95,101,102,96,33,103,104,105,97]))),qD=(0,Y.lazy)(()=>R(()=>import(`./task-files-HaulqF8i.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([106,1,2,7,8,6,9,10,11,12,13,14,15,16,17,18,19,91,85,86,87,73,58,31,59,22,60,61,23,24,62,28,29,48,41,37,69,70,92,93,47,26,27,56,30,76,77,78,36,83,42,94,95,75,33]))),JD=(0,Y.lazy)(async()=>{let{TaskReportRoute:e}=await R(async()=>{let{TaskReportRoute:e}=await import(`./report-reader-BjVZrGCz.js`);return{TaskReportRoute:e}},__vite__mapDeps([74,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,75,19,33,36,37,76,77,78,23,24]));return{default:e}}),YD=(0,Y.lazy)(()=>R(()=>import(`./task-commits-CGYaXoYl.js`).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([107,1,2,7,8,6,9,10,11,12,13,14,15,16,17,18,91,85,86,87,19,73,58,31,59,22,60,61,23,24,62,28,29,48,41,37,69,70,92,93,47,26,27,56,30,76,77,78,36,83,42,94,95,33,108,102,96,104,105,97]))),XD=(0,Y.lazy)(()=>R(()=>import(`./task-github-item-DumSw4lZ.js`).then(e=>({default:e.TaskGithubItemRoute})),__vite__mapDeps([109,2,1,7,8,6,9,10,11,12,13,14,15,16,17,85,86,87,18,91,19,73,58,31,59,22,60,61,23,24,62,28,29,48,41,37,69,70,92,93,47,26,27,56,30,76,77,78,36,83,42,94,95,33,110,96,71,51,52,104,105,97,111]))),ZD=(0,Y.lazy)(()=>R(()=>import(`./repo-git-C99FduHG.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([112,1,2,7,8,6,9,10,11,12,13,14,15,16,17,85,86,87,18,19,113,102,96,23,24,101,59,61,62,28,29,48,41,69,70,93,47,56,30,31,33,103,104,105,97,108,114]))),QD=(0,Y.lazy)(()=>R(()=>import(`./github-Z2_nA6EI.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([115,1,2,7,8,6,9,10,11,12,13,14,15,16,17,18,67,19,21,113,70,23,24,47,28,29,48,41,56,87,86,30,31,51,27,26,33,110,59,96,92,71,52,76,77,78,36,37,42,104,105,97,94,111]))),$D=(0,Y.lazy)(()=>R(()=>import(`./reports-DnQPedky.js`).then(e=>({default:e.ReportsRoute})),__vite__mapDeps([116,1,2,7,8,6,9,12,16,17,14,23,24,56,98,117]))),eO=(0,Y.lazy)(()=>R(()=>import(`./workflows-bPgltsoh.js`).then(e=>({default:e.WorkflowsRoute})),__vite__mapDeps([118,1,2,7,8,6,9,10,11,12,13,14,15,16,17,18,23,24,62,28,29,48,41,26,27,52,33,4,42,119]))),tO=(0,Y.lazy)(()=>R(()=>import(`./activity-route-SFwjSBCp.js`).then(e=>({default:e.ProjectActivityRoute})),__vite__mapDeps([120,1,2,7,8,65,19,121,11,6,9,13,16,17,14,31,68,96,92,23,24,56,87,30,122]))),nO=(0,Y.lazy)(()=>R(()=>import(`./global-activity-route-DcQEMY2A.js`).then(e=>({default:e.GlobalActivityRoute})),__vite__mapDeps([123,1,2,7,8,10,11,6,9,12,13,14,15,16,17,121,19,31,68,96,92,23,24,56,87,30,122,3]))),rO=(0,Y.lazy)(()=>R(()=>import(`./skills-BjtkIMxL.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([124,1,2,7,8,6,9,10,11,12,13,14,15,16,17,18,23,24,56,52])));function iO(){let e=gn();return(0,X.jsx)(ja,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function aO({sectionId:e}){let t=gn();return(0,X.jsx)(yn,{to:{pathname:H_(`global`,e),search:t.search,hash:t.hash},replace:!0})}function oO(){return(0,X.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function sO(){let{projectId:e=``}=vn(),t=gn(),n=tn(),r=St();if(e==="default"){let e=n.data?.bootProject??(n.isError?r.data?.bootProject:void 0);if(e!==void 0){let n=t.pathname.replace(/^\/p\/default(?=\/|$)/,``);return(0,X.jsx)(yn,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,X.jsx)(oO,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,X.jsx)(JS,{projectId:e,registry:n.data})}else if(!n.isError)return(0,X.jsx)(oO,{});return(0,X.jsx)(Le,{projectId:n.data?.bootProject===e?null:e,children:(0,X.jsx)(mn,{},e)})}function cO(){let{projectId:e=``}=vn();return(0,X.jsx)(MS,{},e)}var lO=/^\/tasks\/([0-9a-f-]{36})(?=\/|$)/i;function uO(e,t){let n=e.data?.bootProject??t.data?.bootProject;return{resolved:n,settled:(e.data!==void 0||e.isError)&&(t.data!==void 0||t.isError),boot:n??`default`}}function dO(e,t,n){if(!(e.pathname===`/`&&e.search===``&&e.hash===``))return;if(t.data===void 0&&!t.isError)return(0,X.jsx)(oO,{});let r=Zd(Vd(),t.data,n);if(r!==null)return(0,X.jsx)(yn,{to:r,replace:!0})}function fO(e,t,n,r,i,a){if(!n)return null;let o=i.data?.runs.find(t=>t.id===e)?.projectId;return o===void 0?r?a.data===void 0&&!a.isError?null:a.data?.runs.find(t=>t.id===e)?.projectId??t:t:o}function pO(e,t){let n=t.pathname===`/p`||t.pathname===`/p/`?`/`:t.pathname;return(0,X.jsx)(yn,{to:`/p/${encodeURIComponent(e)}${n}${t.search}${t.hash}`,replace:!0})}function mO(){let e=gn(),t=St(),n=tn(),r=lO.exec(e.pathname)?.[1]??null,i=un(r!==null),a=i.data!==void 0||i.isError,o=i.data!==void 0&&!i.data.runs.some(e=>e.id===r),s=Vt(r!==null&&o?r:``),{resolved:c,settled:l,boot:u}=uO(t,n);if(c===void 0&&!l)return(0,X.jsx)(oO,{});let d=dO(e,n,c);if(d!==void 0)return d;let f=u;if(r!==null){let e=fO(r,u,a,o,i,s);if(e===null)return(0,X.jsx)(oO,{});f=e}return pO(f,e)}function hO(){return(0,X.jsxs)(B,{path:`/p/:projectId`,element:(0,X.jsx)(sO,{}),children:[(0,X.jsx)(B,{index:!0,element:(0,X.jsx)(FE,{})}),(0,X.jsx)(B,{path:`new`,element:(0,X.jsx)(cO,{})}),(0,X.jsx)(B,{path:`activity`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Dv,{}),children:(0,X.jsx)(tO,{})})}),(0,X.jsxs)(B,{path:`tasks/:id`,element:(0,X.jsx)(ew,{}),children:[(0,X.jsx)(B,{index:!0,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(eC,{}),children:(0,X.jsx)(GD,{})})}),(0,X.jsx)(B,{path:`changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(XS,{tab:`changes`}),children:(0,X.jsx)(KD,{})})}),(0,X.jsx)(B,{path:`files`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(XS,{tab:`files`}),children:(0,X.jsx)(qD,{})})}),(0,X.jsx)(B,{path:`report`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`div`,{"data-route":`task-report`,children:(0,X.jsx)(`h1`,{className:`p-4 text-sm text-soft-foreground`,children:`Loading report…`})}),children:(0,X.jsx)(JD,{})})}),(0,X.jsx)(B,{path:`commits`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(XS,{tab:`changes`}),children:(0,X.jsx)(YD,{})})}),(0,X.jsx)(B,{path:`commits/:sha`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(XS,{tab:`changes`}),children:(0,X.jsx)(YD,{})})}),(0,X.jsx)(B,{path:`issue/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)($S,{kind:`issue`}),children:(0,X.jsx)(XD,{kind:`issue`})})}),(0,X.jsx)(B,{path:`pr/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)($S,{kind:`pr`}),children:(0,X.jsx)(XD,{kind:`pr`})})})]}),(0,X.jsx)(B,{path:`git`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KS,{}),children:(0,X.jsx)(ZD,{section:`main`,index:!0})})}),(0,X.jsx)(B,{path:`git/commits`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KS,{}),children:(0,X.jsx)(ZD,{section:`main`})})}),(0,X.jsx)(B,{path:`git/commits/:sha`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KS,{}),children:(0,X.jsx)(ZD,{section:`main`})})}),(0,X.jsx)(B,{path:`git/not-landed`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KS,{}),children:(0,X.jsx)(ZD,{section:`not-landed`})})}),(0,X.jsx)(B,{path:`git/cleanup`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KS,{}),children:(0,X.jsx)(ZD,{section:`cleanup`})})}),(0,X.jsx)(B,{path:`git/branches`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KS,{}),children:(0,X.jsx)(ZD,{section:`branches`})})}),(0,X.jsx)(B,{path:`git/changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KS,{}),children:(0,X.jsx)(ZD,{section:`changes`})})}),(0,X.jsx)(B,{path:`github`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ov,{}),children:(0,X.jsx)(QD,{view:`issues`,index:!0})})}),(0,X.jsx)(B,{path:`github/prs`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ov,{}),children:(0,X.jsx)(QD,{view:`prs`})})}),(0,X.jsx)(B,{path:`github/issues/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ov,{}),children:(0,X.jsx)(QD,{view:`issues`})})}),(0,X.jsx)(B,{path:`github/prs/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ov,{}),children:(0,X.jsx)(QD,{view:`prs`})})}),(0,X.jsx)(B,{path:`github/prs/:n/changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ov,{}),children:(0,X.jsx)(QD,{view:`prs`,changes:!0})})}),(0,X.jsx)(B,{path:`automations`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading automations…`}),children:(0,X.jsx)(VD,{})})}),(0,X.jsx)(B,{path:`automations/new`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading automations…`}),children:(0,X.jsx)(VD,{mode:`new`})})}),(0,X.jsx)(B,{path:`automations/:automationId`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading automations…`}),children:(0,X.jsx)(VD,{mode:`edit`})})}),(0,X.jsx)(B,{path:`automations/:automationId/log`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading automations…`}),children:(0,X.jsx)(VD,{mode:`log`})})}),(0,X.jsx)(B,{path:`skills`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(qS,{}),children:(0,X.jsx)(rO,{})})}),(0,X.jsx)(B,{path:`reports`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading reports…`}),children:(0,X.jsx)($D,{})})}),(0,X.jsx)(B,{path:`workflows`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(YS,{}),children:(0,X.jsx)(eO,{})})}),(0,X.jsx)(B,{path:`workflows/:name`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(YS,{}),children:(0,X.jsx)(eO,{})})}),(0,X.jsx)(B,{path:`settings`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading settings…`}),children:(0,X.jsx)(UD,{})})}),(0,X.jsx)(B,{path:`settings/skills`,element:(0,X.jsx)(iO,{})}),V_(`project`).map(e=>(0,X.jsx)(B,{path:`settings/${e.id}`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading settings…`}),children:(0,X.jsx)(WD,{section:e,scope:`project`})})},e.id)),V_(`global`).map(e=>(0,X.jsx)(B,{path:`settings/${e.id}`,element:(0,X.jsx)(aO,{sectionId:e.id})},e.id)),(0,X.jsx)(B,{path:`*`,element:(0,X.jsx)(WS,{})})]})}function gO(e){let t=En(hn(hO()),e),n=t?.at(-1);return!t||!n||n.route.path===`*`?null:{pattern:`/${t.slice(1).map(e=>e.route.path).filter(e=>e!==void 0).join(`/`)}`.replace(/\/$/,``)||`/`,params:n.params}}function _O(){return(0,X.jsxs)(wn,{children:[hO(),(0,X.jsx)(B,{path:`/tasks`,element:(0,X.jsx)(ED,{})}),(0,X.jsx)(B,{path:`/tools`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading workspace tools…`}),children:(0,X.jsx)(HD,{})})}),(0,X.jsx)(B,{path:`/activity`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Dv,{}),children:(0,X.jsx)(nO,{})})}),(0,X.jsx)(B,{path:`/settings/global`,element:(0,X.jsx)(yn,{to:U_,replace:!0})}),(0,X.jsx)(B,{path:`/settings/global/skills`,element:(0,X.jsx)(yn,{to:`/skills`,replace:!0})}),V_(`global`).map(e=>(0,X.jsx)(B,{path:H_(`global`,e.id),element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading settings…`}),children:(0,X.jsx)(WD,{section:e,scope:`global`})})},e.id)),(0,X.jsx)(B,{path:`*`,element:(0,X.jsx)(mO,{})})]})}function vO(){let[e]=(0,Y.useState)($o);return(0,Y.useEffect)(()=>jn(e),[e]),(0,X.jsx)(ts,{children:(0,X.jsx)(Ue,{client:e,children:(0,X.jsxs)(On,{children:[(0,X.jsx)(Qo,{}),(0,X.jsx)(Tv,{}),(0,X.jsx)(_u,{children:(0,X.jsx)(_v,{children:(0,X.jsxs)(Tn,{children:[(0,X.jsx)(yv,{}),(0,X.jsx)(es.Provider,{value:gO,children:(0,X.jsx)(Si,{children:(0,X.jsx)(nv,{children:(0,X.jsx)(_O,{})})})}),(0,X.jsx)(Yn,{})]})})})]})})})}var yO=document.querySelector(`meta[name="cez-api-base"]`)?.getAttribute(`content`);l(d(yO,void 0,void 0));var bO=document.getElementById(`root`);if(!bO)throw Error(`Squawk: #root container is missing from index.html`);(0,Po.createRoot)(bO).render((0,X.jsx)(Y.StrictMode,{children:(0,X.jsx)(vO,{})}));export{Bv as $,fs as $n,Oh as $t,Px as A,Zu as An,Kg as At,ox as B,fl as Bn,_g as Bt,ZS as C,kf as Cn,__ as Ct,GS as D,Qu as Dn,a_ as Dt,KS as E,td as En,b_ as Et,Lx as F,Ou as Fn,Og as Ft,Vb as G,ks as Gn,Sg as Gt,rx as H,ol as Hn,Eg as Ht,Fx as I,ku as In,Rg as It,Pb as J,bs as Jn,og as Jt,Yb as K,Ds as Kn,xg as Kt,Ix as L,vu as Ln,zg as Lt,Ox as M,Su as Mn,Wg as Mt,jx as N,Du as Nn,Bg as Nt,hS as O,ed as On,Zg as Ot,kx as P,Au as Pn,kg as Pt,Fv as Q,ms as Qn,Nh as Qt,ax as R,Ul as Rn,Ig as Rt,$S as S,Of as Sn,i_ as St,YS as T,$u as Tn,o_ as Tt,Zb as U,il as Un,bg as Ut,ex as V,cl as Vn,Tg as Vt,qb as W,js as Wn,wg as Wt,qv as X,_s as Xn,ig as Xt,Nb as Y,vs as Yn,ag as Yt,Jv as Z,gs as Zn,rg as Zt,wC as _,sp as _n,r_ as _t,tT as a,Wm as an,kv as at,iC as b,jf as bn,n_ as bt,QC as c,Lm as cn,bv as ct,NC as d,zm as dn,U_ as dt,ih as en,os as er,Uv as et,PC as f,Gm as fn,H_ as ft,CC as g,hp as gn,f_ as gt,SC as h,wm as hn,T_ as ht,CT as i,Ym as in,Wv as it,Nx as j,Ju as jn,Hg as jt,pS as k,Yu as kn,Jg as kt,XC as l,qm as ln,xv as lt,IC as m,Fm as mn,E_ as mt,QT as n,Km as nn,rs as nr,Lv as nt,eT as o,Um as on,Ov as ot,AC as p,Om as pn,V_ as pt,Xb as q,Ss as qn,Cg as qt,wT as r,Bm as rn,Vv as rt,$w as s,Rm as sn,Dv as st,qE as t,rh as tn,is as tr,Hv as tt,MC as u,Xm as un,vv as ut,lC as v,op as vn,u_ as vt,XS as w,zd as wn,y_ as wt,eC as x,Df as xn,s_ as xt,sC as y,cp as yn,d_ as yt,ix as z,Tl as zn,jg as zt};
20
+ `)[0]??``;return n.length>t?`${n.slice(0,t-1)}…`:n}function Yx(e){let{task:t,steps:n,agentProfile:r,model:i,modelsLocked:a,effort:o,runner:s,runnerExplicit:c,defaultRunner:l,images:u,archiveWhenDone:d,autoMergePr:f,allowWorkers:p,allowMessaging:m}=e;return{task:t,steps:[...n],...r?{agentProfile:r}:{},model:a?void 0:i||void 0,effort:a?void 0:o||void 0,runner:Ix(s,l,c),images:u.length>0?[...u]:void 0,...Vx({archiveWhenDone:d,autoMergePr:f,allowWorkers:p,allowMessaging:m})}}function Xx(e,t,n){return{runner:e,agentProfile:t||null,...e===n?{}:{model:null,effort:null}}}function Zx(e,t){let n=bx(e);return{...n,...t.runner===void 0?{}:Xx(t.runner,t.account,n.runner),...t.ref===``?{}:{text:t.ref},...t.skill===``?{}:{source:{source:`skill`,ref:t.skill,...t.skillPath===void 0?{}:{path:t.skillPath}}}}}function Qx(e,t,n){let[r,i]=(0,Y.useState)(()=>Zx(e,t)),a=(0,Y.useRef)(r);(0,Y.useEffect)(()=>{xx(a.current,e)},[e]);let o=(0,Y.useRef)(!1),s=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]);let c=t=>{if(!s.current||o.current)return;let n={...a.current,...t};a.current=n,xx(n,e),i(n)},l=(0,Y.useRef)(t.runner===void 0);return(0,Y.useEffect)(()=>{!l.current||n===void 0||(l.current=!1,c(Xx(n,t.account,a.current.runner)))},[n]),{draft:r,update:c,clearStarted:t=>{if(yx(e)!==t)return;Cx(e,t);let n=bx(e);a.current=n,s.current&&i(n)},submissionPending:o,mounted:s}}function $x(e,t,n,r){let i=Yt(),a=Tt(n,r),o=a.data,s=t.data?.skillUsage,c=(0,Y.useMemo)(()=>So(o??[],s),[o,s]),l=i.data?.workflows??[],u=i.data!==void 0&&!t.isPending,d=zx(e,c,l,a.unchecked),f=d?.source===`skill`?c.find(e=>e.id===d.ref&&(d.path===void 0||e.path===d.path)):void 0;return{skillList:c,skillUsage:s,workflowList:l,sourcesReady:u,source:d,selectedSkill:f,skillsSettled:!a.isPending,listUnchecked:a.unchecked,unchecked:a.unchecked||d?.source===`skill`&&!f}}function eS(e){let{uiState:t,source:n,sourcesReady:r,draftText:i,submissionPending:a,update:o}=e,s=t.data?.promptTemplates,c=(0,Y.useMemo)(()=>Lv(s),[s]),l=Bv(c,n?.source===`skill`?[n.ref]:[]),u=(0,Y.useRef)(i);u.current=i;let d=(0,Y.useRef)(``);return(0,Y.useEffect)(()=>{if(!r||a.current)return;let e=Vv(u.current,d.current,l);d.current=e.applied,e.text!==u.current&&o({text:e.text})},[l,r]),c}function tS(e,t){let n=vt(),r=At(),i=cp(),{runners:a,uninstalled:o,signedOut:s}=i,c=t.data?.defaultRunner,l=c??`claude`,u=a.length>0?Fx(e.runner,a,l):null,{runner:d,ready:f}=gt(u??l),p=n.isSuccess&&a.length>0,m={isPending:n.isPending||r.isPending,isError:n.isError||r.isError},h=i.accountFor(d,e.agentProfile)??i.repoAccount?.[d],g=ft(c,fn(r.data)),_=g===void 0?null:i.accountFor(g,u===g?e.agentProfile:null),v=Ut(d,f,h),y=t.data?.modelsLocked===!0,b=t.data?.defaultModels,x=u===null?[]:jx(u,r.data,v.data,[e.model,b?.[u]]),S=u===null?``:Lx(y?null:e.model,u,r.data,b,v.data),C=Ox(S,v.data);return{providers:m,registered:r,runners:a,uninstalled:o,signedOut:s,defaultRunner:c,planAccount:_,runner:u,displayRunner:d,providersReady:p,catalog:v,modelsLocked:y,models:x,model:S,effortOptions:C,effort:y?``:kx(e.effort,C)}}function nS(e,t){let n=Qt(),{accounts:r,repoAccount:i,accountFor:a}=cp();return{accountChoices:r,repoAccount:i,accountsSettled:!n.isPending,agentProfile:a(e,t)}}function rS(e){let t=(0,Y.useRef)(!1),n=(0,Y.useRef)(void 0);(0,Y.useEffect)(()=>{n.current===void 0&&(n.current=document.activeElement);let r=e&&!t.current;t.current=e,r&&(document.activeElement===document.body||document.activeElement===n.current)&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[e])}function iS(e){let t=e.workspaceConfig.data?.composerDefaults;return lx({hasGit:e.hasGit,planFirst:e.draft.planFirst,explicitAutonomous:e.draft.autonomous,explicitWorktree:e.draft.worktree,configuredAutonomous:t?.autonomous??t?.inheritedAutonomous??`source-dependent`,configuredWorktree:t?.worktree??t?.inheritedWorktree??!0,source:e.source?.source??`workflow`})}function aS(e){let t=tn(),n=t.data?.projects??[],r=e??t.data?.bootProject,i=ax(n.find(e=>e.id===r)),[a,o]=(0,Y.useState)(!1);return{projectList:n,webhookTargets:i,notifyOn:i.length>0&&a,setNotifyChoice:o}}function oS(e){let[t,n]=(0,Y.useState)(()=>typeof window<`u`&&window.innerWidth<=767);return(0,Y.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=()=>n(window.innerWidth<=767||t.getBoundingClientRect().width<550);r();let i=typeof ResizeObserver>`u`?null:new ResizeObserver(r);return i?.observe(t),window.addEventListener(`resize`,r),()=>{i?.disconnect(),window.removeEventListener(`resize`,r)}},[]),t}function sS(e){let t=Da(),[n,r]=(0,Y.useState)(()=>e.deepLink.ref!==``||e.deepLink.skillPath!==void 0);cS(e.search,t),lS({pending:n,setPending:r,deepLink:e.deepLink,sourcesReady:e.sourcesReady,listUnchecked:e.listUnchecked,skillList:e.skillList,update:e.update})}function cS(e,t){let n=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{n.current||(n.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[])}function lS(e){let{pending:t,sourcesReady:n,deepLink:r}=e;(0,Y.useEffect)(()=>{if(!t||!n)return;e.setPending(!1);let i=!e.listUnchecked&&r.skill!==``&&!Rx({source:`skill`,ref:r.skill,...r.skillPath===void 0?{}:{path:r.skillPath}},e.skillList,[])?r.skill:``;i!==``&&r.ref!==``&&e.update({text:cx(r.skill,r.ref),source:null});let{message:a,tone:o}=sx(i,r.ref!==``);V(a,{tone:o}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"], [data-slot="composer"] button[aria-label="Plan task"]`)?.focus()},[t,n])}function uS(e){return e.isPending?`Checking agent providers…`:e.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`}function dS(e,t,n){Ve({lastTask:e?{source:e.source,ref:e.ref}:null,...e?{recentSources:Tx(t.data?.recentSources,{source:e.source,ref:e.ref})}:{},...e?.source===`skill`&&t.data!==void 0?{skillUsage:To(t.data.skillUsage,e.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:on.uiState})).catch(()=>{})}function fS(e){let t=Da(),n=F(),[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(!1),{draft:l,draftProjectId:u,engine:d,mounted:f}=e,{providers:p,providersReady:m,runner:g}=d,_=(r,i)=>{e.clearStarted(i),n.invalidateQueries({queryKey:on.runs.all}),f.current&&t(Ux(r))};return{plan:r,setPlan:i,planning:a,starting:s,submit:async(t,r)=>{let a=yx(u);if(!m||g===null)throw Error(uS(p));if(!e.sourcesReady)throw Error(`Still loading workflows and skills — try again in a second.`);if(l.agentProfile&&!e.accountsSettled)throw Error(`Still loading agent accounts — try again in a second.`);if(l.planFirst){o(!0);try{let e=await E(t,d.planAccount);f.current&&i(Wx(t,r,e))}finally{o(!1)}return}let s=await h(Hx(Bx({task:t,source:e.source,model:d.model,modelsLocked:d.modelsLocked,effort:d.effort,runner:g,runnerExplicit:l.runner!==null,agentProfile:e.agentProfile,defaultRunner:d.defaultRunner,images:r,worktree:e.runMode.worktree,autonomous:e.runMode.autonomous,archiveWhenDone:l.archiveWhenDone,autoMergePr:l.autoMergePr,allowWorkers:l.allowWorkers,allowMessaging:l.allowMessaging}),e.notifyOn));dS(e.source,e.uiState,n),_(s,a)},startPlanned:async()=>{if(r===null||r.steps.length===0||s||!m||g===null||l.agentProfile&&!e.accountsSettled)return;let t=yx(u);c(!0);try{let n=await h(Hx(Yx({task:r.task,steps:r.steps,agentProfile:e.agentProfile,model:d.model,modelsLocked:d.modelsLocked,effort:d.effort,runner:g,runnerExplicit:l.runner!==null,defaultRunner:d.defaultRunner,images:r.images,archiveWhenDone:l.archiveWhenDone,autoMergePr:l.autoMergePr,allowWorkers:l.allowWorkers,allowMessaging:l.allowMessaging}),e.notifyOn));i(null),_(n,t)}catch(e){V(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{c(!1)}}}}function pS({archiveWhenDone:e,autoMergePr:t,onChange:n,disabled:r=!1,embedded:i=!1}){let a=(0,Y.useId)();return(0,X.jsxs)(`fieldset`,{"data-slot":`completion-controls`,"data-embedded":i||void 0,className:`grid min-w-0 gap-3`,children:[(0,X.jsx)(`legend`,{className:i?`sr-only`:`text-sm font-medium [margin-block-end:0.5rem]`,children:`After Done`}),(0,X.jsxs)(`label`,{htmlFor:`${a}-archive`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,X.jsx)(`span`,{id:`${a}-archive-label`,children:`Archive when Done`}),i?(0,X.jsx)(`span`,{id:`${a}-archive-help`,className:`completion-control-help`,children:`Move to Archived after Done, even without a PR. You can restore it later.`}):null]}),(0,X.jsx)(oa,{id:`${a}-archive`,className:`completion-switch`,checked:e,disabled:r,"aria-labelledby":`${a}-archive-label`,"aria-describedby":`${a}-archive-help`,onCheckedChange:e=>n({archiveWhenDone:e})})]}),i?null:(0,X.jsx)(`p`,{id:`${a}-archive-help`,className:`text-xs break-words text-muted-foreground`,children:`Move the task to Archived after it reaches Done. You can restore it later.`}),(0,X.jsxs)(`label`,{htmlFor:`${a}-merge`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,X.jsx)(`span`,{id:`${a}-merge-label`,children:`Auto-merge PR`}),i?(0,X.jsx)(`span`,{id:`${a}-merge-help`,className:`completion-control-help`,children:`After Done, mark the PR ready and merge when current-head CI and GitHub rules allow.`}):null]}),(0,X.jsx)(oa,{id:`${a}-merge`,className:`completion-switch`,checked:t,disabled:r,"aria-labelledby":`${a}-merge-label`,"aria-describedby":`${a}-merge-help`,onCheckedChange:e=>n({autoMergePr:e})})]}),i?null:(0,X.jsx)(`p`,{id:`${a}-merge-help`,className:`text-xs break-words text-muted-foreground`,children:`After Done, mark a draft PR ready and merge when current-head CI and GitHub rules allow it.`}),!i||e&&t?(0,X.jsx)(`p`,{className:`completion-order-note text-xs break-words text-muted-foreground`,children:i?`Merge runs before archive when both are on.`:`When both are on, merge comes before archive. Without a PR, Archive when Done still archives the task.`}):null]})}var mS=[{key:`allowWorkers`,slot:`workers`,label:`Allow Squawk workers`,help:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`},{key:`allowMessaging`,slot:`messaging`,label:`Allow task messaging`,help:`Agents in this task can message other tasks in this project.`}];function hS({allowWorkers:e,allowMessaging:t,onChange:n,disabled:r=!1,embedded:i=!1}){let a=(0,Y.useId)(),o={allowWorkers:e,allowMessaging:t};return(0,X.jsxs)(`fieldset`,{"data-slot":`task-access-controls`,"data-embedded":i||void 0,className:`grid min-w-0 gap-3`,children:[(0,X.jsx)(`legend`,{className:i?`sr-only`:`text-sm font-medium [margin-block-end:0.5rem]`,children:`Task access`}),mS.map(e=>(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsxs)(`label`,{htmlFor:`${a}-${e.slot}`,"data-slot":`task-access-${e.slot}`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,X.jsx)(`span`,{id:`${a}-${e.slot}-label`,children:e.label}),i?(0,X.jsx)(`span`,{id:`${a}-${e.slot}-help`,className:`completion-control-help`,children:e.help}):null]}),(0,X.jsx)(oa,{id:`${a}-${e.slot}`,className:`completion-switch shrink-0`,checked:o[e.key],disabled:r,"aria-labelledby":`${a}-${e.slot}-label`,"aria-describedby":`${a}-${e.slot}-help`,onCheckedChange:t=>n({[e.key]:t})})]}),i?null:(0,X.jsx)(`p`,{id:`${a}-${e.slot}-help`,className:`text-xs break-words text-muted-foreground`,children:e.help})]},e.key))]})}function gS(){return(0,X.jsxs)(`header`,{className:`mb-7 max-md:mb-5`,children:[(0,X.jsx)(`p`,{"data-slot":`page-eyebrow`,className:`mb-2 text-[11px] font-semibold tracking-[0.16em] text-[var(--accent-text)] uppercase`,children:`NEW TASK`}),(0,X.jsx)(`h1`,{className:`text-[30px] leading-[normal] font-semibold tracking-[-0.9px] max-md:text-[22px] max-md:leading-[29px] max-md:tracking-[-0.6px]`,children:`What should the agent work on?`}),(0,X.jsx)(`p`,{"data-slot":`page-description`,className:`mt-2 hidden text-[13px] text-muted-foreground md:block`,children:`Describe the outcome. Configure the run. Review everything before it lands.`})]})}function _S({groupRef:e,compact:t,engine:n,accounts:r,draftEffort:i,update:a}){let o=n.runners.length>1||n.uninstalled.length>0||n.signedOut.length>0||n.runners.some(e=>sp(r.accountChoices,e))?(0,X.jsx)(vS,{engine:n,accounts:r,update:a},`runner`):null,s=(0,X.jsx)(yS,{engine:n,draftEffort:i,update:a},`model`),c=(0,X.jsx)(bS,{engine:n,update:a},`effort`);return(0,X.jsx)(`div`,{ref:e,"data-slot":`agent-options`,role:`group`,"aria-label":`Agent settings`,className:`new-task-agent-options`,children:(0,X.jsx)(Vb,{children:t?[o,c,s]:[o,s,c]})})}function vS({engine:e,accounts:t,update:n}){return(0,X.jsx)(Yb,{icon:(0,X.jsx)(Tr,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:e.runners,uninstalled:e.uninstalled,signedOut:e.signedOut,value:e.displayRunner,accounts:t.accountChoices,account:t.agentProfile,repoAccount:t.repoAccount,onPick:(t,r)=>n({runner:t,agentProfile:r,...t===e.displayRunner?{}:{model:null}}),disabled:!e.providersReady})}function yS({engine:e,draftEffort:t,update:n}){let{catalog:r,displayRunner:i}=e;return(0,X.jsx)(qb,{icon:(0,X.jsx)(Wr,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:e.models.find(t=>t.id===e.model)?.label??`auto`,value:e.model,disabled:!e.providersReady,readOnly:e.modelsLocked,disabledHint:e.modelsLocked?`Model selection is locked to native coding-agent settings.`:void 0,onPick:e=>{let i=Ox(e,r.data);n({model:e,effort:t===null?null:kx(t,i)})},options:e.models.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Nx(i,e.registered.data,r)})}function bS({engine:e,update:t}){return(0,X.jsx)(qb,{icon:(0,X.jsx)(Dr,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:e.effortOptions.find(t=>t.value===e.effort)?.label??`auto`,value:e.effort,disabled:!e.providersReady,readOnly:e.modelsLocked,disabledHint:e.modelsLocked?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:e=>t({effort:e}),options:e.effortOptions.map(e=>({value:e.value,label:e.label,desc:e.desc}))})}function xS({engine:e,draft:t,update:n,repo:r,hasGit:i,runMode:a,webhook:o,completionDisabled:s}){let{displayRunner:c}=e,l=At().data;return(0,X.jsxs)(`details`,{"data-slot":`execution-options`,open:!0,className:`group rounded-xl border border-border bg-card xl:self-start`,children:[(0,X.jsxs)(`summary`,{className:`flex min-h-[44px] cursor-pointer list-none flex-wrap items-center gap-x-2 gap-y-1 px-3 py-2 text-xs text-muted-foreground pointer-hover:bg-muted/50 active:bg-muted/50 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground [&::-webkit-details-marker]:hidden`,children:[(0,X.jsx)(br,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:`Execution settings`}),(0,X.jsxs)(`span`,{"data-slot":`execution-summary`,hidden:!0,className:`min-w-0 basis-full truncate pl-5 xl:ml-auto xl:basis-auto xl:pl-0`,children:[Mt(l,c),` · `,e.models.find(t=>t.id===e.model)?.label??`auto`]}),(0,X.jsx)(Or,{"aria-hidden":`true`,className:`new-task-settings-chevron size-4 shrink-0`})]}),(0,X.jsxs)(`div`,{className:`new-task-settings-body`,children:[(0,X.jsx)(`p`,{className:`new-task-settings-description`,children:`Control this run and what happens after Done.`}),(0,X.jsxs)(`div`,{role:`group`,"aria-label":`Run settings`,className:`new-task-run-settings`,children:[i?(0,X.jsx)(CS,{on:a.worktree,onChange:e=>n({worktree:e})}):null,(0,X.jsx)(ES,{repo:r}),(0,X.jsx)(wS,{on:a.autonomous,disabled:t.planFirst,onChange:e=>n({autonomous:e})}),o.targets.length>0?(0,X.jsx)(TS,{on:o.on,targets:o.targets,onChange:o.onChange}):null]}),(0,X.jsx)(pS,{embedded:!0,archiveWhenDone:t.archiveWhenDone,autoMergePr:t.autoMergePr,onChange:n,disabled:s}),(0,X.jsx)(hS,{embedded:!0,allowWorkers:t.allowWorkers,allowMessaging:t.allowMessaging,onChange:n,disabled:s})]})]})}function SS({showConfigureProviders:e,planFirst:t,planning:n,onModeChange:r}){return(0,X.jsxs)(X.Fragment,{children:[e?(0,X.jsx)(G,{to:`/settings/agent-defaults#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,X.jsx)(OS,{planFirst:t,planning:n,onModeChange:r}),(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`hidden rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground md:inline`,children:Jv()})]})}function CS({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"aria-label":`Worktree`,"data-slot":`worktree-toggle`,onClick:()=>r(!e),title:t?n:e?`Runs in an isolated worktree — uncheck to run in the repo working tree`:`Runs in the repo working tree — check to isolate in a worktree`,className:`flex items-center justify-between gap-3 px-0 py-3 text-left`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Worktree`}),(0,X.jsx)(`span`,{className:`block text-[12px] text-muted-foreground`,children:e?`Changes stay in a separate working copy.`:`Changes are made in the current working directory.`})]}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:c(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,X.jsx)(`span`,{className:c(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function wS({on:e,disabled:t,onChange:n}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"aria-label":`Autonomous`,"data-slot":`autonomous-toggle`,onClick:()=>n(!e),title:t?`Plan-first runs are interactive — autonomous is unavailable`:e?`Autonomous — the agent runs to completion without pausing for you`:`Runs interactively — check to let the agent finish without pausing for you`,className:`flex items-center justify-between gap-3 px-0 py-3 text-left disabled:opacity-50`,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Autonomous`}),(0,X.jsx)(`span`,{className:`block text-[12px] text-muted-foreground`,children:`Let the agent proceed without prompts`})]}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:c(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,X.jsx)(`span`,{className:c(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function TS({on:e,targets:t,onChange:n}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"aria-label":`Notify webhook`,"data-slot":`notify-webhook-toggle`,onClick:()=>n(!e),title:`${e?`Status changes go to`:`Check to send this task's status changes to`} ${ox(t)} (${t.map(e=>ix(e.url)).join(`, `)})`,className:`flex min-h-11 items-center justify-between gap-3 px-0 py-3 text-left`,children:[(0,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Notify webhook`}),(0,X.jsx)(`span`,{"data-slot":`notify-webhook-subtitle`,className:`block truncate text-[12px] text-muted-foreground`,children:`Send status changes`})]}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:c(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,X.jsx)(`span`,{className:c(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function ES({repo:e}){return(0,X.jsxs)(`div`,{"data-slot":`base-branch-row`,className:`new-task-base-branch flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:`Base branch`}),e?(0,X.jsx)(DS,{repo:e}):null]})}function DS({repo:e}){let t=F(),n=qt({mutationFn:e=>k({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:on.repo}),V(e.baseBranch?`New tasks will branch off "${e.baseBranch}" (PRs target it too).`:`Base branch cleared — new tasks fork from the checked-out branch.`)},onError:e=>V(e.message,{tone:`danger`})});return e.info?(0,X.jsx)(qb,{searchPlaceholder:`Search branches…`,slot:`base-pill`,ariaLabel:`Base branch`,label:(0,X.jsx)(`span`,{className:`text-[11px]`,children:e.baseBranch??e.info.branch}),value:e.baseBranch??``,onPick:e=>n.mutate(e===``?null:e),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}function OS({planFirst:e,planning:t,onModeChange:n}){return(0,X.jsxs)(`div`,{"data-slot":`mode-seg`,role:`radiogroup`,"aria-label":`Run mode`,className:`inline-flex items-center gap-0.5 rounded-lg bg-muted p-[3px]`,children:[(0,X.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":!e,onClick:()=>n(!1),className:c(`h-6 rounded-md px-2 text-xs transition-colors`,e?`font-medium text-muted-foreground hover:text-foreground`:`bg-card font-semibold text-foreground shadow-xs`),children:[e?null:(0,X.jsx)(_r,{"aria-hidden":`true`,className:`size-3.5`}),`Start`]}),(0,X.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-busy":t||void 0,"data-slot":`mode-plan`,onClick:()=>n(!0),className:c(`h-6 rounded-md px-2 text-xs transition-colors`,e?`bg-contrast font-semibold text-contrast-foreground ring-2 ring-ring/55`:`font-medium text-muted-foreground hover:text-foreground`,t&&`animate-pulse`),children:t?`Planning…`:`Plan first`})]})}function kS({plan:e,starting:t,startAvailable:n,startUnavailableReason:r,startUnavailableAction:i,onStepsChange:a,onStart:o,onDiscard:s}){let[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(null),p=(0,Y.useRef)(null),m=(0,Y.useId)();(0,Y.useEffect)(()=>{p.current?.focus({preventScroll:!0});let e=p.current?.closest(`[data-slot="main"]`);e&&(e.scrollTop=0)},[]);let h=()=>{u(null),f(null)},g=(t,n)=>{t.preventDefault(),l!==null&&l!==n&&a(Kx(e.steps,l,n)),h()},_=e.steps.length===0;return(0,X.jsxs)(`div`,{"data-slot":`plan-page`,children:[(0,X.jsxs)(`header`,{"data-slot":`plan-page-header`,children:[(0,X.jsx)(`h1`,{children:`New task / Plan first`}),(0,X.jsx)(`p`,{children:`Review the proposed chain before launching.`})]}),(0,X.jsx)(`div`,{"data-slot":`plan-canvas`,children:(0,X.jsxs)(`section`,{ref:p,tabIndex:-1,"aria-labelledby":m,"data-slot":`plan-review`,className:`flex flex-col outline-none`,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||e.target.closest(`[role="dialog"], [role="alertdialog"]`)||(e.preventDefault(),s())},children:[(0,X.jsxs)(`header`,{"data-slot":`dialog-header`,className:`flex flex-col gap-1 px-5 pt-4 pb-3.5 text-left`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,X.jsx)(`h2`,{id:m,"data-slot":`dialog-title`,className:`text-[11px] font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:`Proposed chain`}),(0,X.jsx)(`button`,{type:`button`,onClick:s,"aria-label":`Discard the plan`,className:`-mt-1 -mr-1 rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,X.jsx)(xr,{"aria-hidden":`true`,className:`size-4`})})]}),(0,X.jsx)(`p`,{"data-slot":`plan-task`,title:e.task,className:`text-[18px] font-medium text-foreground`,children:Jx(e.task)}),e.fallback?(0,X.jsx)(`p`,{"data-slot":`plan-fallback`,className:`text-xs text-soft-foreground italic`,children:`planner unavailable — single-step plan`}):e.rationale===``?null:(0,X.jsx)(`p`,{"data-slot":`plan-rationale`,className:`text-xs text-muted-foreground`,children:e.rationale})]}),(0,X.jsx)(`ol`,{"data-slot":`plan-steps`,className:`flex-1 space-y-2 overflow-y-auto px-5 py-4`,children:_?(0,X.jsx)(`li`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`(no steps left — discard and plan again)`}):e.steps.map((t,n)=>(0,X.jsxs)(`li`,{"data-slot":`plan-step`,"data-step-id":t.id,draggable:!0,onDragStart:()=>u(n),onDragOver:e=>{e.preventDefault(),f(n)},onDragLeave:()=>f(e=>e===n?null:e),onDrop:e=>g(e,n),onDragEnd:h,className:c(`flex items-center gap-2.5 rounded-lg border border-border bg-card-2 px-3 py-2.5`,l===n&&`opacity-50`,d===n&&l!==null&&l!==n&&`border-ring`),children:[(0,X.jsx)(sr,{"aria-hidden":`true`,className:`size-3.5 shrink-0 cursor-grab text-soft-foreground`}),(0,X.jsx)(`span`,{className:`w-5 shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:String(n+1).padStart(2,`0`)}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium`,children:t.name??t.id}),t.skill?(0,X.jsx)(`span`,{"data-slot":`plan-badge-skill`,title:`skill`,className:`shrink-0 rounded-full bg-accent-strong/15 px-1.5 py-px font-mono text-[11px] font-medium text-accent-text`,children:t.skill}):null,t.command?(0,X.jsx)(`span`,{"data-slot":`plan-badge-check`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[11px] font-medium text-muted-foreground`,children:`check`}):null]}),(0,X.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap break-words font-mono text-[11px] text-muted-foreground`,children:qx(t)})]}),(0,X.jsxs)(`span`,{"data-slot":`plan-step-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-up`,"aria-label":`Move step ${n+1} up`,disabled:n===0,className:`size-7 text-muted-foreground`,onClick:()=>a(Kx(e.steps,n,n-1)),children:`Move up`}),(0,X.jsx)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-down`,"aria-label":`Move step ${n+1} down`,disabled:n===e.steps.length-1,className:`size-7 text-muted-foreground`,onClick:()=>a(Kx(e.steps,n,n+1)),children:`Move down`}),(0,X.jsx)(U,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-remove`,"aria-label":`Remove step ${n+1}`,className:`size-7 text-muted-foreground hover:text-danger`,onClick:()=>a(Gx(e.steps,n)),children:`Remove`})]})]},t.id))}),!n&&r?(0,X.jsxs)(`p`,{id:`plan-start-guidance`,className:`flex flex-wrap items-center gap-1.5 border-t border-border px-5 pt-3 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:r}),i]}):null,(0,X.jsxs)(`div`,{"data-slot":`plan-actions`,className:`flex flex-wrap items-center gap-3 px-6 pt-3 pb-6`,children:[(0,X.jsxs)(U,{type:`button`,"data-slot":`plan-start`,disabled:_||t||!n,title:n?void 0:r,"aria-describedby":!n&&r?`plan-start-guidance`:void 0,onClick:o,children:[(0,X.jsx)(xi,{"aria-hidden":`true`,className:`size-3.5`}),t?`Starting…`:`Start`]}),(0,X.jsx)(AS,{steps:e.steps,disabled:_}),(0,X.jsx)(U,{type:`button`,variant:`outline`,onClick:s,children:`Discard`})]}),(0,X.jsx)(`p`,{className:`px-6 pb-6 text-xs text-muted-foreground`,children:`No steps left? Start is disabled. A planner failure shows a single-step fallback.`})]})})]})}function AS({steps:e,disabled:t}){let n=F(),[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1),d=async t=>{let r=a.trim();if(!(r===``||l)){u(!0);try{let a=await ce({name:r,steps:e,...t?{overwrite:!0}:{}});V(`Saved — ${a.path.split(`/`).pop()??a.path}`),n.invalidateQueries({queryKey:on.workflows}),c(!1),i(!1),o(``)}catch(e){e instanceof je&&e.exists===!0?c(!0):V(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{u(!1)}}};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(U,{type:`button`,variant:`outline`,"data-slot":`plan-save`,disabled:t,onClick:()=>i(!0),children:`Save as chain`}),(0,X.jsx)(wa,{open:r,onOpenChange:e=>i(!!e),children:(0,X.jsxs)(Sa,{"data-slot":`plan-save-dialog`,className:`sm:max-w-sm`,showCloseButton:!1,children:[(0,X.jsxs)(xa,{children:[(0,X.jsx)(Ca,{children:`Save as chain`}),(0,X.jsx)(ya,{children:`Saves these steps as a reusable workflow — it joins the picker like any other chain.`})]}),(0,X.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d(!1)},children:[(0,X.jsx)(`label`,{htmlFor:`plan-chain-name`,className:`mb-2 block text-[11px] text-muted-foreground`,children:`Chain name`}),(0,X.jsx)(ol,{id:`plan-chain-name`,value:a,onChange:e=>o(e.target.value),"aria-label":`Chain name`,placeholder:`e.g. fix-and-verify-v2`,maxLength:80,autoFocus:!0}),(0,X.jsxs)(va,{className:`mt-4`,children:[(0,X.jsx)(U,{type:`button`,variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,X.jsx)(U,{type:`submit`,disabled:a.trim()===``||l,children:l?`Saving…`:`Save chain`})]})]})]})}),(0,X.jsx)(_g,{open:s,onOpenChange:e=>e?void 0:c(!1),children:(0,X.jsxs)(bg,{"data-slot":`plan-overwrite-dialog`,children:[(0,X.jsxs)(xg,{children:[(0,X.jsxs)(Cg,{children:[`Overwrite “`,a.trim(),`”?`]}),(0,X.jsx)(wg,{children:`A chain with this name already exists. Overwriting replaces its steps with this plan.`})]}),(0,X.jsxs)(Sg,{children:[(0,X.jsx)(Eg,{children:`Cancel`}),(0,X.jsx)(Tg,{onClick:()=>void d(!0),children:`Overwrite chain`})]})]})})]})}var jS={start:{note:`Start immediately with the selected configuration.`,pendingLabel:`Starting task…`,failureHint:void 0,clearOnSuccess:!0,sendAriaLabel:`Start task`},plan:{note:`Review the plan before starting the task.`,pendingLabel:`Planning task…`,failureHint:`Could not create the plan. Your draft is kept. Please retry.`,clearOnSuccess:!1,sendAriaLabel:`Plan task`}};function MS(){let[e]=_n(),t=(0,Y.useRef)(null),n=(0,Y.useRef)(null),r=(0,Y.useRef)(null),{projectId:i}=vn(),a=He().projectId,o=At().data,[s]=(0,Y.useState)(()=>e.toString()),[c]=(0,Y.useState)(()=>Rd(s,o)),l=Rd(s,o).runner,u=Bt(),d=Ot(),f=en(),p=ct(),{draft:m,update:h,clearStarted:g,submissionPending:_,mounted:v}=Qx(a,c,l),y=Sx(a),b=tS(m,f),x=nS(b.displayRunner,m.agentProfile),S=$x(m.source,d,b.displayRunner,x.agentProfile),{source:C,sourcesReady:w,skillList:T}=S,E=aS(i),D=eS({uiState:d,source:C,sourcesReady:w,draftText:m.text,submissionPending:_,update:h});rS(b.providersReady);let O=u.data===void 0||u.data.info!==null,k=iS({hasGit:O,draft:m,selectedSkill:S.selectedSkill,workspaceConfig:p,source:C}),{plan:A,setPlan:j,planning:M,starting:ee,submit:te,startPlanned:ne}=fS({draft:m,draftProjectId:a,engine:b,agentProfile:x.agentProfile,accountsSettled:x.accountsSettled,sourcesReady:w,source:C,runMode:k,notifyOn:E.notifyOn,uiState:d,mounted:v,clearStarted:g});sS({deepLink:c,search:e,sourcesReady:w&&S.skillsSettled&&!b.providers.isPending&&x.accountsSettled,listUnchecked:S.listUnchecked,skillList:T,update:h});let re=oS(t),{providers:ie,providersReady:N}=b,P=m.planFirst?jS.plan:jS.start,ae=uS(ie);return(0,X.jsxs)(`div`,{"data-route":`new`,"data-plan-review":A===null?void 0:`true`,className:`relative isolate flex min-h-full flex-col overflow-x-clip pb-16`,children:[(0,X.jsxs)(`div`,{"data-slot":`new-task-layout`,"data-persisted-draft":y||void 0,ref:r,style:A===null?void 0:{display:`none`},className:`relative z-[1] mx-auto w-full max-w-none px-11 pt-12 max-md:px-[18px] max-md:pt-[22px]`,children:[(0,X.jsx)(gS,{}),(0,X.jsx)(Nb,{ref:n,onSubmit:te,retainDraftUntilSuccess:!0,idleFeedback:(0,X.jsxs)(`div`,{"data-slot":`new-task-mode-note`,className:`flex items-center justify-between gap-3 text-[11px] text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:P.note}),(0,X.jsx)(`kbd`,{className:`hidden font-sans md:inline`,children:Jv()})]}),pendingLabel:P.pendingLabel,failureHint:P.failureHint,clearOnSuccess:P.clearOnSuccess,onPendingChange:e=>{_.current=e},value:m.text,onValueChange:e=>h({text:e}),draftPersisted:y,autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:P.sendAriaLabel,disabled:!N||ee,disabledReason:ae,autocompleteSkills:!0,skillRunner:b.displayRunner,skillAccount:x.agentProfile,footerStart:(0,X.jsx)(NS,{projects:E.projectList,urlProjectId:i,templates:D,onInsertTemplate:e=>n.current?.insertAtCaret(e),sources:S,onPickSource:e=>h({source:e})}),agentOptions:(0,X.jsx)(_S,{groupRef:t,compact:re,engine:b,accounts:x,draftEffort:m.effort,update:h}),executionOptions:(0,X.jsx)(xS,{engine:b,draft:m,update:h,repo:u.data,hasGit:O,runMode:k,webhook:{targets:E.webhookTargets,on:E.notifyOn,onChange:E.setNotifyChoice},completionDisabled:ee||M}),footerEnd:(0,X.jsx)(SS,{showConfigureProviders:!N&&!ie.isPending,planFirst:m.planFirst,planning:M,onModeChange:e=>h({planFirst:e})})}),(0,X.jsx)(`p`,{"data-slot":`run-mode-note`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:ux({worktree:k.worktree,hasGit:O})})]}),A===null?null:(0,X.jsx)(kS,{plan:A,starting:ee,startAvailable:N,startUnavailableReason:ae,startUnavailableAction:ie.isPending?void 0:(0,X.jsx)(G,{to:`/settings/agent-defaults#providers`,children:`Configure providers`}),onStepsChange:e=>j(t=>t&&{...t,steps:e}),onStart:()=>void ne(),onDiscard:()=>{j(null),requestAnimationFrame(()=>r.current?.querySelector(`textarea`)?.focus())}})]})}function NS({projects:e,urlProjectId:t,templates:n,onInsertTemplate:r,sources:i,onPickSource:a}){let o=Da();return(0,X.jsxs)(X.Fragment,{children:[e.length>1&&t!==void 0?(0,X.jsx)(FS,{projects:e,projectId:t,onPick:e=>o(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}):null,(0,X.jsx)(Zb,{label:`Template`,templates:n,onInsert:r}),(0,X.jsx)(US,{source:i.source,unchecked:i.unchecked,ready:i.sourcesReady,skills:i.skillList,skillUsage:i.skillUsage,workflows:i.workflowList,onPick:a})]})}function PS(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 FS({projects:e,projectId:t,onPick:n}){let[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(``),{order:s}=jf(),l=e.find(e=>e.id===t),u=PS(po(e,s),a);return(0,X.jsxs)(ga,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,X.jsx)(fa,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`project-pill`,"aria-label":`Project`,title:`Which project this task runs in — its skills, workflows, settings and draft`,className:c(Pb,`border-foreground/60 font-semibold text-foreground`),children:[(0,X.jsx)(tr,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,X.jsx)(`span`,{className:`max-w-40 truncate`,children:l?.name??t}),Fb]})}),(0,X.jsx)(ha,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(fo,{shouldFilter:!1,children:[(0,X.jsx)(io,{placeholder:`search projects…`,value:a,onValueChange:o}),(0,X.jsxs)(uo,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[u.length===0?(0,X.jsx)(lo,{children:`Nothing matches.`}):null,u.map(e=>(0,X.jsxs)(co,{value:e.id,keywords:[e.name],"data-slot":`project-option`,"data-project-id":e.id,disabled:e.status===`missing`,onSelect:()=>{n(e.id),i(!1)},children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,X.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground`,children:e.branch}),e.id===t?(0,X.jsx)(_r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.id))]}),(0,X.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-[11px] leading-snug text-soft-foreground`,children:`Skills, workflows, settings and the draft re-resolve against the selected project.`})]})})]})}function IS(e,t,n){return!e&&(t.ranked?t.ranked.length===0:t.mostUsed.length===0&&t.project.length===0&&t.global.length===0)&&n.length===0}function LS(e,t){return _o(`no skill`,`none plain ${wx} ${e?.description??``}`,t)>0}function RS({source:e,ready:t,offersWorkflows:n,onPick:r,skillLabel:i}){let a=e===null||e.source===`skill`?zr:Vr;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`source-pill`,"data-source-kind":e?.source??`none`,"aria-label":`Choose a skill or workflow`,title:e===null?`No skill — the task runs as one plain agent step. Pick a skill or workflow to change that.`:`Runs the ${e.source} "${e.ref}" — pick it again, or press ✕, to run without it`,disabled:!t,onKeyDown:t=>{e===null||t.metaKey||t.ctrlKey||t.altKey||t.key!==`Backspace`&&t.key!==`Delete`||(t.preventDefault(),r(null))},className:c(Pb,`font-mono text-[11px]`,e===null?`text-muted-foreground`:`rounded-r-none border-r-0 border-foreground/60 pr-1.5 font-semibold text-foreground`),children:[(0,X.jsx)(a,{"aria-hidden":`true`,className:c(`size-3 shrink-0`,e===null?`text-muted-foreground`:`text-accent-icon`)}),(0,X.jsx)(`span`,{className:`max-w-44 truncate`,children:t?i??e?.ref??(n?`Skill or workflow`:`Skill`):`…`}),Fb]})}function zS({source:e,quickTask:t,onPick:n}){return(0,X.jsx)(J,{children:(0,X.jsxs)(co,{value:`none no-skill`,keywords:[`none`,`plain`,...Co(wx)],"data-slot":`source-option`,"data-source-kind":`none`,onSelect:()=>n(null),children:[(0,X.jsx)(Cr,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:`No skill`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t?.description??`One agent run on your task — no ceremony.`}),e===null?(0,X.jsx)(_r,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]})})}function BS({ranked:e,mostUsed:t,project:n,skillItem:r}){return(0,X.jsx)(X.Fragment,{children:e?e.length>0?(0,X.jsx)(J,{children:e.map(e=>r(e,bo(e)))}):null:(0,X.jsxs)(X.Fragment,{children:[t.length>0?(0,X.jsx)(J,{heading:`Most used`,children:t.map(e=>r(e,bo(e)))}):null,n.length>0?(0,X.jsx)(J,{heading:`Project skills`,children:n.map(e=>r(e,!0))}):null]})})}function VS({source:e,matchedWorkflows:t,toggle:n}){return t.length>0?(0,X.jsx)(J,{heading:`Workflows`,children:t.map(t=>{let r=e?.source===`workflow`&&e.ref===t.name;return(0,X.jsxs)(co,{value:`workflow ${t.name}`,keywords:Co(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>n({source:`workflow`,ref:t.name}),children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:t.name}),t.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,r?(0,X.jsx)(_r,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},t.name)})}):null}function HS({global:e,skillItem:t}){return e.length>0?(0,X.jsx)(J,{heading:`Global`,children:e.map(e=>t(e,!1))}):null}function US({source:e,unchecked:t,ready:n,skills:r,skillUsage:i,workflows:a,onPick:o}){let[s,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(null),m=(0,Y.useRef)(null),{mostUsed:h,project:g,global:_,ranked:v}=Eo(r,u,i),y=a.find(e=>e.name===wx),b=vo(a,u).filter(e=>e.name!==wx),x=a.some(e=>e.name!==wx),S=LS(y,u),C=IS(S,{ranked:v,mostUsed:h,project:g,global:_},b),w=e=>{o(e),l(!1)},T=t=>w(e?.source===t.source&&e.ref===t.ref&&(e.source!==`skill`||t.source!==`skill`||e.path===t.path)?null:t),E=(t,n)=>{let r=e?.source===`skill`&&e.ref===t.id&&e.path===t.path;return(0,X.jsxs)(co,{value:yo(t),keywords:Co(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.id,onSelect:()=>T({source:`skill`,ref:t.id,...t.path===void 0?{}:{path:t.path}}),children:[(0,X.jsx)(kv,{skill:t,emphasized:n}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`source-skill-view`,"aria-label":`View skill ${t.name}`,title:`View skill`,onClick:e=>{e.preventDefault(),e.stopPropagation(),p(t)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,X.jsx)(hi,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,X.jsx)(_r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},yo(t))},D=RS({source:e,ready:n,offersWorkflows:x,onPick:o,skillLabel:e?.source===`skill`?r.find(t=>t.id===e.ref&&(e.path===void 0||e.path===t.path))?.name:void 0});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(rx,{skill:f,onClose:()=>p(null)}),(0,X.jsxs)(ga,{open:s,onOpenChange:e=>{l(e),e||d(``)},children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,X.jsx)(fa,{asChild:!0,children:D}),e?.source===`skill`&&t?(0,X.jsx)(`span`,{role:`status`,children:`Unchecked`}):null,e!==null&&n?(0,X.jsx)(`button`,{type:`button`,"data-slot":`source-pill-clear`,"aria-label":`Clear the ${e.source} ${e.ref}`,title:`Run without it`,onClick:()=>o(null),className:c(Pb,`rounded-l-none border-foreground/60 pl-1.5 pr-2 text-soft-foreground hover:text-foreground`),children:(0,X.jsx)(xr,{"aria-hidden":`true`,className:`size-3`})}):null]}),(0,X.jsx)(ha,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(fo,{shouldFilter:!1,children:[(0,X.jsx)(io,{placeholder:`search skills & workflows…`,value:u,onValueChange:d,onInput:()=>m.current?.scrollTo(0,0)}),(0,X.jsxs)(uo,{ref:m,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[u.trim()&&!r.some(e=>e.id===u.trim())?(0,X.jsx)(J,{children:(0,X.jsxs)(co,{value:`typed-skill`,onSelect:()=>w({source:`skill`,ref:u.trim(),typed:!0}),children:[`Use skill id “`,u.trim(),`” (unchecked)`]})}):null,C?(0,X.jsx)(lo,{children:`Nothing matches.`}):null,S?(0,X.jsx)(zS,{source:e,quickTask:y,onPick:w}):null,(0,X.jsx)(BS,{ranked:v,mostUsed:h,project:g,skillItem:E}),(0,X.jsx)(VS,{source:e,matchedWorkflows:b,toggle:T}),(0,X.jsx)(HS,{global:_,skillItem:E})]})]})})]})]})}function WS(){return(0,X.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(ko,{icon:(0,X.jsx)(ds,{}),tone:`neutral`,title:`Page not found`,subtitle:`Nothing lives at this address. The link may be mistyped, or it points at something that is gone.`,actions:(0,X.jsx)(U,{asChild:!0,variant:`outline`,children:(0,X.jsx)(G,{to:`/`,children:`Back to tasks`})})})})}function GS(){return(0,X.jsx)(`div`,{className:`px-[18px] pt-2 md:hidden`,children:(0,X.jsxs)(G,{to:`/git`,"data-slot":`git-back`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,X.jsx)(Fr,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to Git`]})})}function KS(){let{pathname:e,search:t}=gn();return(0,X.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[Aa(e)!==`/git`||new URLSearchParams(t).get(`view`)===`repo`?(0,X.jsx)(GS,{}):null,(0,X.jsx)(ko,{icon:(0,X.jsx)(gi,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})]})}function qS(){return(0,X.jsxs)(`div`,{"data-route":`skills`,"aria-busy":`true`,className:`mx-auto min-h-full w-full max-w-[1100px] px-[18px] py-6 md:p-9`,children:[(0,X.jsx)(`h1`,{className:`text-[25px] font-semibold tracking-tight md:text-[30px]`,children:`Skills`}),(0,X.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`The skills each agent loads in this project, as its runner reports them.`}),(0,X.jsx)(`p`,{"data-slot":`skills-loading`,role:`status`,className:`mt-6 text-xs text-muted-foreground`,children:`Loading skills…`}),(0,X.jsxs)(`div`,{"aria-hidden":`true`,className:`mt-4 flex flex-col gap-[22px] motion-safe:animate-pulse`,children:[(0,X.jsx)(`div`,{className:`h-11 rounded-lg border border-border bg-card`}),(0,X.jsx)(`div`,{className:`h-80 rounded-xl border border-border bg-card`})]})]})}function JS({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,X.jsx)(`div`,{"data-route":`unknown-project`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(ko,{icon:(0,X.jsx)(ys,{}),tone:`neutral`,title:`“${e}” isn’t registered here`,subtitle:`This Squawk doesn’t serve a project by that id. The link may come from another machine’s workspace — these are the projects registered on this one:`,children:(0,X.jsx)(`ul`,{"data-slot":`registered-projects`,className:`mx-auto flex w-full max-w-xs flex-col gap-1.5 text-left`,children:n.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(z,{to:`/p/${encodeURIComponent(e.id)}/`,className:`flex items-baseline gap-2 rounded-md border border-border bg-card px-3 py-2 text-sm font-medium text-foreground shadow-xs transition-colors hover:bg-card-2`,children:[e.name||e.id,(0,X.jsxs)(`span`,{className:`font-mono text-[11px] font-normal text-soft-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function YS(){return(0,X.jsxs)(`div`,{"data-route":`workflows`,"aria-busy":`true`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,X.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`Workflows`}),(0,X.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`Portable skill chains. Steps run from top to bottom.`}),(0,X.jsx)(`p`,{"data-slot":`workflows-loading`,role:`status`,className:`mt-6 text-xs text-muted-foreground`,children:`Loading workflows…`}),(0,X.jsxs)(`div`,{"aria-hidden":`true`,className:`mt-4 flex flex-col gap-[22px] motion-safe:animate-pulse`,children:[(0,X.jsx)(`div`,{className:`h-11 rounded-lg border border-border bg-card`}),(0,X.jsx)(`div`,{className:`h-80 rounded-xl border border-border bg-card`})]})]})}function XS({tab:e}){return(0,X.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(ko,{icon:(0,X.jsx)(gi,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:e===`changes`?`Loading changes…`:`Loading files…`,subtitle:`Fetching the run record.`})})}function ZS({tab:e,error:t}){let n=t instanceof je&&t.status===404;return(0,X.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(ko,{icon:n?(0,X.jsx)(Oi,{}):(0,X.jsx)(Mr,{size:16}),tone:n?`neutral`:`danger`,title:n?`Task not found`:`Could not load this task`,subtitle:n?`No run has this id. It may have been deleted, or the link is from another machine.`:t.message,actions:(0,X.jsx)(U,{asChild:!0,variant:`outline`,children:(0,X.jsx)(G,{to:`/`,children:`Back to tasks`})})})})}var QS={issue:`issue`,pr:`pull request`};function $S({kind:e,number:t,heading:n=`h1`}){let r=(0,X.jsx)(`div`,{"data-slot":`task-github-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,X.jsx)(ko,{icon:(0,X.jsx)(gi,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:n,title:`Loading ${QS[e]}${t===void 0?``:` #${t}`}…`,subtitle:t===void 0?`Fetching the run record.`:`Asking GitHub.`})});return n===`h2`?r:(0,X.jsx)(`div`,{"data-route":`task-github-item`,className:`flex min-h-full flex-col`,children:r})}function eC(){return(0,X.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(ko,{icon:(0,X.jsx)(gi,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}async function tC(e,t,n,r,i){try{return await Vo(e,{queryKey:[t,`runs`,`artifact-metadata`,n,r],queryFn:({signal:e})=>p(n,r,{signal:e})},i),!0}catch(e){if(e instanceof je&&e.status===404)return!1;throw e}}async function nC(e,t,n,r,i,a){if(await tC(e,t,n,r,i))return n;i.throwIfAborted();let o=await Vo(e,{queryKey:[t,`runs`,`relationships`,n],queryFn:({signal:e})=>se(n,{signal:e})},i),s=new Set(o.workers.map(e=>e.workerId));a&&s.add(a),s.delete(n);for(let n of s){if(i.aborted)throw i.reason;if(await tC(e,t,n,r,i))return n}throw new je(404,`Report missing or deleted`)}function rC(e,t,n){let r=F(),i=a();return pn({queryKey:[i,`runs`,`report-source`,e,t,n],queryFn:({signal:a})=>nC(r,i,e,t,a,n),enabled:!!(e&&t),retry:!1})}function iC(){let[e]=_n(),t=gn(),n=Sn(),r=xn(),i=Y.useRef(Math.random()),a=Y.useRef({renderedKey:``,next:e,seq:0,latestSeq:0});return Y.useLayoutEffect(()=>{if(a.current.renderedKey===t.key)return;let n=t.state,o=n?.__writerSession===i.current?n.__writerSeq:void 0;r===`REPLACE`&&o!==void 0&&o<=a.current.latestSeq?(a.current.renderedKey=t.key,o===a.current.latestSeq&&(a.current.next=e)):a.current={renderedKey:t.key,next:e,seq:a.current.seq,latestSeq:0}},[e,t,r]),[e,Y.useCallback(e=>{let t=e(new URLSearchParams(a.current.next));if(t.toString()===a.current.next.toString())return;let r=a.current.seq+1;a.current={...a.current,next:t,seq:r,latestSeq:r},n({search:`?${t}`},{replace:!0,state:{__writerSession:i.current,__writerSeq:r}})},[n])]}var aC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function oC(e){let t=e.get(`report`);return!t||!aC.test(t)||e.getAll(`report`).length!==1||e.getAll(`card`).length>1?null:{artifactId:t,card:e.get(`card`)||null}}var sC=(0,Y.createContext)(null);function cC(e){let t=gn(),n=Sn(),[r,i]=iC(),a=oC(r),[o,s]=(0,Y.useState)(()=>({runId:e,entries:new Map}));o.runId!==e&&s({runId:e,entries:new Map});let c=(0,Y.useCallback)((t,n)=>(s(r=>{if(r.runId===e&&r.entries.get(t)===n)return r;let i=new Map(r.runId===e?r.entries:[]);return i.set(t,n),{runId:e,entries:i}}),()=>void 0),[e]),l=(0,Y.useRef)({runId:e,callbacks:new Map});l.current.runId!==e&&(l.current={runId:e,callbacks:new Map});let u=(0,Y.useCallback)((e,t)=>(l.current.callbacks.set(e,t),()=>{l.current.callbacks.get(e)===t&&l.current.callbacks.delete(e)}),[]),d=(0,Y.useMemo)(()=>({register:c,registerOpener:u}),[c,u]),f=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{r.has(`report`)&&!a&&i(e=>(e.delete(`report`),e.delete(`card`),e))},[r,a,i]),(0,Y.useEffect)(()=>{let n=f.current;!a&&n&&n.runId===e&&n.card&&l.current.callbacks.get(n.card)?.(n.artifactId,n.scrollTop),f.current=a?{...a,runId:e,scrollTop:t.state?.reportScrollTop}:null},[e,a,t.state]),{selection:a,sourceRunId:o.runId===e&&a?o.entries.get(a.artifactId)??(a.card?void 0:e):void 0,registry:d,close:()=>{let e=t.state,r=window.navigation;if(e?.reportReturnKey&&r){r.traverseTo(e.reportReturnKey);return}if(e?.reportReturnTo){n(e.reportReturnTo,{replace:!0});return}i(e=>(e.delete(`report`),e.delete(`card`),e))}}}var lC=class extends Y.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){console.error(`Squawk cockpit: the preview pane crashed`,e,t.componentStack)}render(){return this.state.failed?(0,X.jsxs)(`div`,{"data-slot":`preview-pane-error`,role:`alert`,className:`flex h-full flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,X.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:`The preview hit an error`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The task is unaffected. Close the preview and open it again.`}),(0,X.jsx)(U,{variant:`outline`,onClick:this.props.onClose,children:`Close preview`})]}):this.props.children}},uC=`cez-preview-tasks`,dC=`cez.preview.pane-width`,fC=e=>Math.min(75,Math.max(30,Math.round(e)));function pC(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function mC(e){if(!pC(e))return;let{port:t,agent:n,url:r}=e;if(typeof t==`number`&&Number.isInteger(t)&&t>=1&&t<=65535)return{port:t};if(n===!0)return{agent:!0};if(typeof r==`string`&&/^https?:\/\//i.test(r))return{url:r}}function hC(e){if(!pC(e))return;let t=mC(e.target),n=typeof e.percent==`number`&&Number.isFinite(e.percent)?e.percent:void 0;return{open:e.open===!0,...t?{target:t}:{},...n===void 0?{}:{percent:n},at:typeof e.at==`number`?e.at:0}}function gC(){try{let e=localStorage.getItem(uC),t=e===null?null:JSON.parse(e);return pC(t)?t:{}}catch{return{}}}function _C(e){let t=hC(gC()[e]);if(!t)return;let{at:n,...r}=t;return r}function vC(e,t,n=Date.now()){let r=gC(),i={open:!1,...hC(r[e]),...t,at:n};for(let e of Object.keys(i))i[e]===void 0&&delete i[e];r[e]=i;let a=Object.keys(r);if(a.length>100){let e=e=>hC(r[e])?.at??0;for(let t of a.sort((t,n)=>e(t)-e(n)).slice(0,a.length-100))delete r[t]}try{localStorage.setItem(uC,JSON.stringify(r))}catch{}}function yC(){try{let e=Number(localStorage.getItem(dC));return e>0?e:void 0}catch{return}}function bC(e){let t=(e===void 0?void 0:_C(e)?.percent)??yC();return t===void 0?58:fC(t)}function xC(e,t){try{localStorage.setItem(dC,String(t))}catch{}e!==void 0&&vC(e,{percent:t})}var SC=`(min-width: 1180px)`,CC=`(max-width: 767px)`;function wC(e,t){let[n,r]=(0,Y.useState)(()=>window.matchMedia?.(e).matches??t);return(0,Y.useEffect)(()=>{let t=window.matchMedia?.(e);if(!t)return;let n=()=>r(t.matches);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),n}var TC=(0,Y.lazy)(()=>R(()=>import(`./preview-pane-connected-BcePJL41.js`).then(e=>({default:e.ConnectedPreviewPane})),__vite__mapDeps([64,1,2,7,8,6,9,15,19,65,66,28,24,67,68,60,69,70,44,71,72,73,61,23,30,31,62,18,29,48,41,56,16,17]))),EC=2;function DC(e){let[t,n]=(0,Y.useState)(void 0);return(0,Y.useEffect)(()=>{let t=e.current?.closest(`[data-slot="main"]`);if(!t)return;let r=()=>n(t.clientHeight||void 0);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function OC({run:e,state:t,children:n,report:r}){let i=wC(SC,!0),a=wC(CC,!1),o=(0,Y.useRef)(null),s=DC(o),{percent:c,setPercent:l}=t,u=!!r||t.open&&e!==void 0,d=u&&!i,f=!r&&t.session,p=d&&!f,m=d&&f,h=e=>{let t=o.current?.getBoundingClientRect();!t||t.width===0||l(fC((t.right-e)/t.width*100))},g=e=>{e.currentTarget.setPointerCapture?.(e.pointerId)},_=e=>{e.currentTarget.hasPointerCapture?.(e.pointerId)&&h(e.clientX)},v=e=>{if(e.key===`ArrowLeft`)l(fC(c+EC));else if(e.key===`ArrowRight`)l(fC(c-EC));else return;e.preventDefault()},y={"--preview-pane":`${c}%`,...s===void 0?{}:{"--preview-h":`${s}px`}};return(0,X.jsxs)(`div`,{ref:o,"data-slot":`task-split`,"data-pane":u?`open`:`closed`,"data-takeover":p?``:void 0,className:`preview-split flex min-h-full`,style:y,children:[(0,X.jsx)(`div`,{"data-slot":`task-main`,hidden:p&&a,"data-collapsed":p&&!a?``:void 0,className:`min-w-0 flex-1`,children:n}),u?(0,X.jsxs)(X.Fragment,{children:[i?(0,X.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize preview`,"aria-valuemin":30,"aria-valuemax":75,"aria-valuenow":c,tabIndex:0,"data-slot":`preview-divider`,className:`preview-divider`,onPointerDown:g,onPointerMove:_,onKeyDown:v}):null,(0,X.jsxs)(`aside`,{"data-slot":`preview-pane`,"data-phone":a?``:void 0,hidden:m,className:`preview-pane`,children:[r,(0,X.jsx)(`div`,{hidden:!!r,className:`h-full`,children:t.open&&e?(0,X.jsx)(lC,{onClose:t.closePane,children:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,className:`p-6 text-sm text-muted-foreground`,children:`Opening the preview…`}),children:(0,X.jsx)(TC,{run:e,servers:e.previewServers??[],request:t.request,onSession:p?t.showSession:void 0,onTarget:t.setTarget,onLive:t.setLive,onClose:t.closePane},e.id)})}):null})]})]}):null]})}function kC(e){if(!e.worktreePath||e.worktreeReclaimedAt)return!0;let t=e.delegation?.role===`worker`?e.delegation.destroy:void 0;return t!==void 0&&!t.remaining.includes(`worktree`)}function AC(e){let{state:t,server:n}=e,r=_i(e.stateAt);switch(t){case`registered`:return n.answeredAtRegistration?{tone:`neutral`,ring:!1,pulse:!1,text:`was running when registered`}:{tone:`neutral`,ring:!0,pulse:!1,text:`registered · not started`};case`adopted`:return{tone:`neutral`,ring:!1,pulse:!1,text:`was running when registered`};case`starting`:return{tone:`pending`,ring:!1,pulse:!0,text:`starting`};case`up`:return{tone:`success`,ring:!1,pulse:!1,text:r?`up · ${r}`:`up`};case`stalled`:return{tone:`pending`,ring:!1,pulse:!1,text:`stalled · port silent 2 min`};case`exited`:return{tone:`danger`,ring:!1,pulse:!1,text:e.exitCode===void 0?`exited`:`exited · code ${e.exitCode}`};case`stopped`:return{tone:`neutral`,ring:!0,pulse:!1,text:e.reason===`idle`?`stopped after 15 min idle`:`stopped`};case`unavailable`:return{tone:`neutral`,ring:!0,pulse:!1,text:`unavailable`}}}function jC(e){return{kind:`preview-server`,id:`preview-server:${e.port}`,server:e,state:`registered`,stateAt:e.registeredAt}}function MC(e,t){return t?.get(e.port)??jC(e)}function NC(e){return e.state===`registered`?e.server.answeredAtRegistration:e.state===`up`||e.state===`starting`||e.state===`adopted`}function PC(e){return e.split(` -- `)[0].trim()}var FC=(0,Y.createContext)(null);function IC(){return(0,Y.useContext)(FC)}var LC=e=>e&&`port`in e?e.port:void 0;function RC(){return typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 1180px)`).matches}function zC(e){let t=e===void 0?void 0:_C(e),n=t?.open===!0,r=n?t.target:void 0;return{open:n,target:r,request:n?{...r,restored:!0}:void 0,session:n&&!RC(),percent:bC(e)}}function BC(e,t=!1){let[n]=(0,Y.useState)(()=>zC(e)),[r,i]=(0,Y.useState)(n.open),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(n.target),[l,u]=(0,Y.useState)(n.session),[d,f]=(0,Y.useState)(n.request),[p,m]=(0,Y.useState)(n.percent),[h,g]=(0,Y.useState)(e),_=(0,Y.useRef)(r);if(_.current=r,h!==e){let t=zC(e);g(e),i(t.open),o(!1),c(t.target),u(t.session),f(t.request),m(t.percent)}t&&r&&d?.restored&&(i(!1),c(void 0),f(void 0),u(!1));let v=(0,Y.useCallback)(t=>{e!==void 0&&vC(e,t)},[e]),y=(0,Y.useCallback)(e=>{f({...e});let t=e.port===void 0?e.agent?{agent:!0}:void 0:{port:e.port};u(!1),i(!0),t?(c(t),v({open:!0,target:t})):_.current?v({open:!0}):(c(void 0),v({open:!0,target:void 0}))},[v]),b=(0,Y.useCallback)(()=>{i(!1),o(!1),u(!1),c(void 0),v({open:!1})},[v]),x=(0,Y.useCallback)(e=>{c(e),v({target:e})},[v]),S=(0,Y.useCallback)(t=>{m(t),xC(e,t)},[e]),C=(0,Y.useCallback)(()=>u(!0),[]),w=LC(s);return(0,Y.useMemo)(()=>({open:r,live:a,port:w,target:s,percent:p,request:d,session:l,openPane:y,closePane:b,showSession:C,setLive:o,setTarget:x,setPercent:S}),[r,a,w,s,p,d,l,y,b,C,x,S])}function VC(e,t={}){let[n,r]=(0,Y.useState)([]),{cursor:i,afterSeq:o=0,maxEvents:s,compactAt:c,onCompact:l,onReset:u}=t;return(0,Y.useEffect)(()=>{if(r([]),!e)return;let t=o,n=!1,d=!1,f=a(),p=[],m,h,g=()=>{if(m!==void 0&&globalThis.cancelAnimationFrame?.(m),clearTimeout(h),m=void 0,h=void 0,n||p.length===0)return;let e=p;p=[],r(t=>{let r=[...t,...e];return!d&&c!==void 0&&r.length>=c&&(d=!0,queueMicrotask(()=>{n||l?.()})),s===void 0||r.length<=s?r:r.slice(-s)})},_=()=>{h===void 0&&(h=setTimeout(g,50),typeof globalThis.requestAnimationFrame==`function`&&(m=globalThis.requestAnimationFrame(g)))},v=T({kind:`run`,projectId:f,runId:e,afterSeq:o,...i?{cursor:i}:{}},{frame:e=>{!(`type`in e)||e.type!==`event`||e.event.seq<=t||(t=e.event.seq,p.push(e.event),_())},reset:async(e,n)=>{g();let r=await u?.(e,n);return r&&(t=Math.max(t,r.afterSeq)),r}});return()=>{n=!0,m!==void 0&&globalThis.cancelAnimationFrame?.(m),clearTimeout(h),v()}},[e,i,o,s,c,l,u]),n}var HC=5,UC=200,WC=5e3;function GC(...e){let t=[],n=-1/0,r=!0;for(let i of e){for(let e of i){if(e.seq<=n){r=!1;break}t.push(e),n=e.seq}if(!r)break}if(r)return t;let i=new Map;for(let t of e)for(let e of t)i.set(e.seq,e);return[...i.values()].sort((e,t)=>e.seq-t.seq)}function KC(e,t,n){e.setQueryData(t,e=>{if(!e)return{pages:[n],pageParams:[void 0]};let t=[...e.pages],r=[...e.pageParams],i=-1;for(let e=0;e<t.length;e+=1)(i===-1||t[e].asOfSeq>t[i].asOfSeq)&&(i=e);if(i>=0&&t[i].asOfSeq>n.asOfSeq)return e;for(i>=0&&t[i].newerCursor===void 0?(t[i]=n,r[i]=void 0):(t.push(n),r.push(void 0));t.length>HC;)t.shift(),r.shift();return{pages:t,pageParams:r}})}function qC(e,t){return e!==void 0&&(t===void 0||e.asOfSeq>=t.asOfSeq)}function JC(e,t,n,r){let i=(0,Y.useRef)(void 0),a=r&&t.data!==void 0&&!t.isFetching&&!qC(t.data,n),o=e===void 0||n===void 0?void 0:`${e}:${n.asOfSeq}`;(0,Y.useEffect)(()=>{!a||o===void 0||i.current===o||(i.current=o,t.refetch())},[a,t,o])}function YC(e,t){return e!==void 0&&e.asOfSeq>t.asOfSeq?e:t}function XC(e){let t=a(),n=F(),r=[`run-history`,t,e],i=[`run-history-context`,t,e],o=st({queryKey:r,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>Ce(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:HC,staleTime:1/0,retry:1}),s=pn({queryKey:i,enabled:e!==void 0,queryFn:async({signal:t})=>{let r=await Ze(e,{signal:t});return YC(n.getQueryData(i),r)},retry:1}),c=(0,Y.useCallback)(async r=>{let i=r?{signal:r}:void 0,a=await Ce(e,void 0,i),o=await Ze(e,i);return r?.throwIfAborted(),KC(n,[`run-history`,t,e],a),n.setQueryData([`run-history-context`,t,e],e=>YC(e,o)),a},[n,e,t]),l=(0,Y.useCallback)(async(t,n)=>{if(e===void 0)return;let r=await c(n);return{cursor:r.liveCursor,afterSeq:r.asOfSeq}},[c,e]),u=o.isError||s.isError,d=VC(u?e:void 0,{onReset:l}),f=o.data?.pages??[],p=f.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),m=(0,Y.useRef)(!1),h=(0,Y.useCallback)(()=>{e===void 0||m.current||(m.current=!0,c().catch(()=>{}).finally(()=>{m.current=!1}))},[c,e]),g=e=>e!==void 0&&n.getQueryData([`run-history`,t,e])!==void 0,[_,v]=(0,Y.useState)(()=>({runId:e,pending:g(e)})),y=_.pending;_.runId!==e&&(y=g(e),v({runId:e,pending:y})),(0,Y.useEffect)(()=>{if(!y||e===void 0)return;let t=!1,n=new AbortController;return c(n.signal).catch(()=>{}).finally(()=>{t||v({runId:e,pending:!1})}),()=>{t=!0,n.abort()}},[c,y,e]);let b=VC(!u&&p&&!y?e:void 0,{cursor:p?.liveCursor,afterSeq:p?.asOfSeq,maxEvents:WC,compactAt:UC,onCompact:h,onReset:l}),x=(0,Y.useRef)(0);x.current=b.length,(0,Y.useEffect)(()=>()=>{x.current>0&&h()},[h]);let S=(0,Y.useMemo)(()=>GC(...f.map(e=>e.events)),[f]),C=(0,Y.useMemo)(()=>u?d:GC(S,b),[u,d,S,b]);JC(e,s,p,!u);let w=u||qC(s.data,p),T=(0,Y.useMemo)(()=>{if(u)return d;let e=s.data?.contextEvents??[],t=s.data?.asOfSeq??0;return GC(e,C.filter(({seq:e})=>e>t))},[s.data,u,d,C]),E=(0,Y.useCallback)(async()=>{await o.fetchPreviousPage()},[o.fetchPreviousPage]),D=(0,Y.useCallback)(async()=>{u||(await n.resetQueries({queryKey:[`run-history`,t,e],exact:!0}),n.invalidateQueries({queryKey:[`run-history-context`,t,e],exact:!0}))},[u,n,e,t]);return{visibleEvents:C,currentEvents:T,currentComplete:w,isPending:!u&&o.isPending,contextPending:!u&&s.isPending,fallback:u,hasOlder:!u&&!!o.hasPreviousPage,isFetchingOlder:o.isFetchingPreviousPage,olderError:o.isFetchPreviousPageError?o.error instanceof Error?o.error.message:`Could not load earlier items`:void 0,loadOlder:E,jumpToLatest:D,retainedPages:f.length}}function ZC(e){for(let t=e.length-1;t>=0;--t){let n=we.safeParse(e[t]);if(n.success)return n.data.state===`connected`}return!1}function QC(e){let{currentEvents:t}=XC(e);return(0,Y.useMemo)(()=>ZC(t),[t])}var $C=(0,Y.lazy)(()=>R(()=>import(`./report-reader-D_SwO-8H.js`).then(e=>({default:e.ReportReader})),__vite__mapDeps([74,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,75,19,33,36,37,76,77,78,23,24])));function ew(){let{id:e}=vn(),t=cn(e),n=gn(),r=St().data?.capabilities?.preview===!0,i=t.data?kC(t.data):!1,a=BC(e,i),o=cC(e),s=rC(e,o.selection?.artifactId,o.sourceRunId),c=o.selection?(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading report…`}),children:(0,X.jsx)($C,{runId:s.data??e??``,selection:{artifactId:o.selection.artifactId},fragment:n.hash,onBack:o.close,variant:`pane`,sourceLookup:s},`${e}:${o.selection.artifactId}`)}):void 0,l=r?(0,X.jsx)(tw,{id:e,run:t.data,pane:a,removed:i,report:c,children:(0,X.jsx)(mn,{})}):(0,X.jsx)(OC,{run:t.data,state:{...a,open:!1},report:c,children:(0,X.jsx)(mn,{})});return(0,X.jsx)(sC.Provider,{value:o.registry,children:l})}function tw({id:e,run:t,pane:n,removed:r,children:i,report:a}){let o=QC(e),s=(0,Y.useMemo)(()=>({...n,worktreeRemoved:r,agentLive:o}),[n,r,o]);return(0,X.jsx)(FC.Provider,{value:s,children:(0,X.jsx)(OC,{run:t,state:n,report:a,children:i})})}function nw(){let[e,t]=(0,Y.useState)(()=>new Set);return{expandedRuns:e,toggleExpandedRun:(0,Y.useCallback)(e=>t(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[])}}var rw=[{id:`status`,label:`Status`,canFold:!1,defaultExpanded:!0,align:`left`,width:`120px`},{id:`task`,label:`Task`,canFold:!1,defaultExpanded:!0,align:`left`,width:`320px`},{id:`workflow`,label:`Workflow`,canFold:!0,defaultExpanded:!0,align:`left`,width:`84px`,icon:`workflow`},{id:`branch`,label:`Branch`,canFold:!0,defaultExpanded:!1,align:`left`,width:`120px`,icon:`branch`},{id:`diff`,label:`±`,canFold:!0,defaultExpanded:!0,align:`left`,width:`84px`,icon:`diff`},{id:`reference`,label:`Ref`,canFold:!0,defaultExpanded:!0,align:`left`,width:`104px`,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:`64px`,icon:`cost`,capability:`cost`},{id:`cpu`,label:`CPU`,canFold:!0,defaultExpanded:!0,align:`right`,width:`60px`,icon:`cpu`},{id:`memory`,label:`Mem`,canFold:!0,defaultExpanded:!0,align:`right`,width:`80px`,icon:`memory`},{id:`started`,label:`Started`,canFold:!0,defaultExpanded:!0,align:`right`,width:`68px`,icon:`started`}],iw=new Map(rw.map(e=>[e.id,e]));function aw(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`boolean`))}function ow(e){let t={};for(let[n,r]of Object.entries(aw(e))){let e=iw.get(n);e?.canFold&&(t[e.id]=r)}return t}function sw(e,t){let n=iw.get(e);return!n||!n.canFold?!0:t[e]??n.defaultExpanded}function cw(e,t){let n=aw(e);return iw.get(t)?.canFold?{...n,[t]:!sw(t,ow(e))}:n}function lw(e){return rw.filter(t=>t.capability===void 0||e[t.capability])}function uw(e,t){return t===`flat`?!1:t===`virtual`||e>=100}function dw(e,t){let n=t===null?-1:e.indexOf(t);return n<0?[]:[n-1,n,n+1].filter(t=>t>=0&&t<e.length)}function fw(e,t){let n=e.map(e=>sw(e.id,t)?e.id===`workflow`||e.id===`memory`?120:Number.parseFloat(e.width??`100`):42);return{"--task-columns":e.map((e,t)=>e.id===`task`?`minmax(${n[t]}px, 1fr)`:`${n[t]}px`).join(` `),minInlineSize:Math.max(1240,n.reduce((e,t)=>e+t,0))}}function pw(e,t){let n=2;return{indexes:e.map(e=>{let r=n;return n+=t.has(e)?2:1,r}),rowCount:n-1}}var mw=null,{min:hw,max:gw,abs:_w,floor:vw}=Math,yw=(e,t,n)=>hw(n,gw(t,e)),bw=e=>[...e].sort((e,t)=>e-t),xw=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)},Sw=()=>{let e;return[new Promise(t=>{e=t}),e]},Cw=e=>{let t;return()=>(e&&=(t=e(),void 0),t)},ww=(e,t,n)=>{let r=n?`unshift`:`push`;for(let n=0;n<t;n++)e[r](-1);return e},Tw=(e,t)=>{let n=e.t[t];return n===-1?e.o:n},Ew=(e,t,n)=>{let r=e.t[t]===-1;return e.t[t]=n,e.i=hw(t,e.i),r},Dw=(e,t)=>{if(!e.l)return 0;if(e.i>=t)return e.u[t];e.i<0&&(e.u[0]=0,e.i=0);let n=e.i,r=e.u[n];for(;n<t;)r+=Tw(e,n),e.u[++n]=r;return e.i=t,r},Ow=(e,t,n=0,r=e.l-1)=>{let i=n;for(;n<=r;){let a=vw((n+r)/2);Dw(e,a)<=t?(i=a,n=a+1):r=a-1}return yw(i,0,e.l-1)},kw=(e,t,n)=>{let r=t-e.l;return e.i=n?-1:hw(t-1,e.i),e.l=t,r>0?(ww(e.u,r),ww(e.t,r,n),e.o*r):(e.u.splice(r),(n?e.t.splice(0,-r):e.t.splice(r)).reduce((t,n)=>t-(n===-1?e.o:n),0))},Aw=typeof window<`u`,jw=e=>e.documentElement,Mw=e=>e.ownerDocument,Nw=e=>e.defaultView,Pw=Cw(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>0),Fw=Cw(()=>`scrollBehavior`in jw(document).style),Iw=e=>gw(e.h(),e.p()),Lw=(e,t=40,n=0,r,i=!1)=>{let a=!!n,o=1,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=mw,g=[0,a?gw(n-1,0):-1],_=0,v=!1,y=((e,t,n)=>({o:t,t:n?ww(n.slice(0,hw(e,n.length)),gw(0,e-n.length)):ww([],e),l:e,i:-1,u:ww([],e+1)}))(e,r?r[1]:t,r&&r[0]),b=new Set,x=()=>l-c,S=()=>x()+d+u,C=(e,t)=>((e,t,n,r)=>{if(r=hw(r,e.l-1),Dw(e,r)<=t){let i=Ow(e,n,r);return[Ow(e,t,r,i),i]}{let i=Ow(e,t,void 0,r);return[i,Ow(e,n,i)]}})(y,e,t,g[0]),w=()=>Dw(y,y.l),T=(e,t)=>{let n=Dw(y,e)-d;return t?w()-n-E(e):n},E=e=>Tw(y,e),D=(e,t=-1)=>y.t[e]===t,O=e=>{e&&(Pw()&&p!==0||h&&m===1?d+=e:u+=e)};return{v:()=>{b.clear()},m:()=>o,_:()=>(e=>[e.t.slice(),e.o])(y),S:(e=200)=>{if(!v||a)return g;let t,n;if(f)[t,n]=g;else{let r=gw(0,S()),a=r+s;i||(e=gw(0,e),p!==1&&(r-=e),p!==2&&(a+=e)),[t,n]=g=C(gw(0,r),gw(0,a)),h&&(t=hw(t,h[0]),n=gw(n,h[1]))}return[gw(t,0),hw(n,y.l-1)]},$:e=>Ow(y,e-c),I:D,k:T,R:E,T:()=>y.l,C:()=>l,M:()=>p!==0,p:()=>s,O:()=>c,h:w,H:()=>(f=u,u=0,[f,m===2]),W:(e,t)=>{let n=[e,t];return b.add(n),()=>{b.delete(n)}},B:(e,t)=>{let n,r,g=0;switch(e){case 1:{if(t===l&&m===0)break;let e=f;f=0;let n=t-l,i=_w(n);e&&i<_w(e)+1||m!==0||(p=n<0?2:1),a&&=!1,l=t,g=4;let o=x();o>=-s&&o<=w()&&(g+=1,r=i>s);break}case 2:g=8,p!==0&&(n=!0,g+=1),p=0,m=0,h=mw;break;case 3:{let e=t.filter(([e,t])=>!D(e,t));if(!e.length)break;O(e.reduce((e,[t,n])=>{let r;if(m===2)r=!0;else if(h&&m===1)r=t<h[0];else{let e=x(),n=T(t),i=E(t);r=p!==1&&m===0?n+i<=e:n<e&&n+i<e+s}return r&&(e+=n-E(t)),e},0));for(let[t,n]of e){let e=E(t),r=Ew(y,t,n);i&&(_+=r?n:n-e)}i&&s&&_>s&&(O(((e,t)=>{let n=0,r=[];e.t.forEach((e,i)=>{e!==-1&&(r.push(e),i<t&&n++)}),e.i=-1;let i=bw(r),a=i.length,o=a/2|0,s=a%2==0?(i[o-1]+i[o])/2:i[o],c=e.o;return((e.o=s)-c)*gw(t-n,0)})(y,Ow(y,S()))),i=!1),g=3,r=!0;break}case 4:s!==t&&(s||(v=r=!0),s=t,g=3);break;case 5:t[1]?(O(kw(y,t[0],!0)),m=2,g=1):(kw(y,t[0]),g=1);break;case 6:c=t;break;case 7:m=1;break;case 8:h=C(t,t+s),g=1}g&&(o=1+(2147483647&o),n&&d&&(u+=d,d=0),b.forEach(([e,t])=>{g&e&&t(r)}))}}},Rw=setTimeout,zw=(e,t)=>t?-e:e,Bw=(e,t,n,r,i,a)=>{let o=Date.now,s=0,c=!1,l=!1,u=!1,d=!1,f=(()=>{let t,n=()=>{t!=mw&&clearTimeout(t)},r=()=>{n(),t=Rw(()=>{t=mw,(()=>{if(c||l)return c=!1,void f();u=!1,e.B(2)})()},150)};return r.J=n,r})(),p=()=>{s=o(),u&&(d=!0),a&&e.B(6,a()),e.B(1,r()),f()},m=t=>{if(c||!e.M()||t.ctrlKey)return;let r=o()-s;150>r&&50<r&&(n?t.deltaX:t.deltaY)&&(c=!0)},h=()=>{l=!0,u=d=!1},g=()=>{l=!1,Pw()&&(u=!0)};return t.addEventListener(`scroll`,p),t.addEventListener(`wheel`,m,{passive:!0}),t.addEventListener(`touchstart`,h,{passive:!0}),t.addEventListener(`touchend`,g,{passive:!0}),{A:()=>{t.removeEventListener(`scroll`,p),t.removeEventListener(`wheel`,m),t.removeEventListener(`touchstart`,h),t.removeEventListener(`touchend`,g),f.J()},L:()=>{let[t,n]=e.H();t&&(i(t,n,d),d=!1,n&&e.p()>e.h()&&e.B(1,r()))}}},Vw=(e,t,n)=>{let r;return[async(i,a)=>{if(!await t())return;r&&r();let o=()=>{let[t,n]=Sw();return r=()=>{n(!1)},e.p()&&Rw(r,150),[t,e.W(2,()=>{n(!0)})]};if(a&&Fw())e.B(8,i()),xw(async()=>{for(;;){let t=!0;for(let[n,r]=e.S();n<=r;n++)if(e.I(n)){t=!1;break}if(t)break;let[n,r]=o();try{if(!await n)return}finally{r()}}e.B(7),n(i(),a)});else for(;;){let[t,r]=o();try{if(e.B(7),n(i()),!await t)return}finally{r()}}},()=>{r&&r()}]},Hw=(e,t)=>{let n,r,i=Sw(),a=!1,o=t?`scrollLeft`:`scrollTop`,s=t?`overflowX`:`overflowY`,[c,l]=Vw(e,()=>i[0],(e,r)=>{e=zw(e,a),r?n.scrollTo({[t?`left`:`top`]:e,behavior:`smooth`}):n[o]=e});return{N(c,u){n=u,t&&(a=getComputedStyle(u).direction===`rtl`),r=Bw(e,u,t,()=>zw(u[o],a),(t,n,r)=>{if(r){let e=u.style,t=e[s];e[s]=`hidden`,Rw(()=>{e[s]=t})}u[o]=zw(e.C()+t,a),n&&l()}),i[1](!0)},v(){r&&r.A(),i[1](!1),i=Sw()},P:()=>a,V(e){c(()=>e)},X(t){t+=e.C(),c(()=>t)},Y(t,{align:n,smooth:r,offset:i=0}={}){if(t=yw(t,0,e.T()-1),n===`nearest`){let r=e.k(t),i=e.C();if(r<i)n=`start`;else{if(!(r+e.R(t)>i+e.p()))return;n=`end`}}c(()=>i+e.O()+e.k(t)+(n===`end`?e.R(t)-e.p():n===`center`?(e.R(t)-e.p())/2:0),r)},q:()=>{r&&r.L()}}},Uw=e=>{let t;return{j(n){(t||=new(Nw(Mw(n))).ResizeObserver(e)).observe(n)},D(e){t.unobserve(e)},A(){t&&t.disconnect()}}},Ww=(e,t)=>{let n,r=t?`width`:`height`,i=new WeakMap,a=Uw(t=>{let a=[];for(let{target:o,contentRect:s}of t)if(o.offsetParent)if(o===n)e.B(4,s[r]);else{let e=i.get(o);e!=mw&&a.push([e,s[r]])}a.length&&e.B(3,a)});return{G(e){a.j(n=e)},U:(e,t)=>(i.set(e,t),a.j(e),()=>{i.delete(e),a.D(e)}),v:a.A}},Gw=Aw?Y.useLayoutEffect:Y.useEffect,Kw=`current`,qw=(e,t)=>{if(Array.isArray(e))for(let n of e)qw(n,t);else e==null||typeof e==`boolean`||t.push(e)},Jw=(e,t)=>e.key??`_`+t,Yw=e=>{let t=(0,Y.useRef)(null);return t[Kw]||(t[Kw]=e())},Xw=e=>{let t=(0,Y.useRef)(e);return Gw(()=>{t[Kw]=e},[e]),t},Zw=(0,Y.memo)(({Z:e,ee:t,te:n,oe:r,ne:i,re:a,se:o,ie:s})=>{let c=(0,Y.useRef)(null);Gw(()=>t(c[Kw],n),[n]);let l=(0,Y.useMemo)(()=>{let e={contain:`layout style`,position:i&&s?void 0:`absolute`,[o?`height`:`width`]:`100%`,[o?`top`:`left`]:0,[o?`left`:`top`]:r,visibility:!i||s?void 0:`hidden`};return o&&(e.display=`inline-flex`),e},[r,i,s,o]);return(0,X.jsx)(a,typeof a==`string`?{ref:c,style:l,children:e}:{ref:c,style:l,index:n,children:e})}),Qw=(e,t)=>(0,Y.useMemo)(()=>{if(typeof e==`function`)return[n=>e(t[n],n),t.length];let n=(e=>{let t=[];return qw(e,t),t})(e);return[e=>n[e],n.length]},[e,t]),$w=(0,Y.forwardRef)(({children:e,data:t,bufferSize:n,itemSize:r,shift:i,horizontal:a,keepMounted:o,cache:s,startMargin:c=0,ssrCount:l,as:u=`div`,item:d=`div`,scrollRef:f,onScroll:p,onScrollEnd:m},h)=>{let[g,_]=Qw(e,t),v=(0,Y.useRef)(null),y=(0,Y.useRef)(!!l),b=Xw(p),x=Xw(m),[S,C,w,T]=Yw(()=>{let e=!!a,t=Lw(_,r,l,s,!r);return[t,Ww(t,e),Hw(t,e),e]});_!==S.T()&&S.B(5,[_,i]),c!==S.O()&&S.B(6,c);let[E,D]=(0,Y.useReducer)(S.m,void 0,S.m),O=S.M(),k=S.h(),A=w.P(),j=[],M=e=>{let t=g(e);return(0,X.jsx)(Zw,{ee:C.U,te:e,oe:S.k(e,A),ne:S.I(e),re:d,Z:t,se:T,ie:y[Kw]},Jw(t,e))};if(Gw(()=>{y[Kw]=!1,S.W(1,e=>{e?(0,Ku.flushSync)(D):D()}),S.W(4,()=>{b[Kw]&&b[Kw](S.C())}),S.W(8,()=>{x[Kw]&&x[Kw]()});let e=v[Kw],t=t=>{C.G(t),w.N(e,t)};return f?xw(()=>{f[Kw]&&t(f[Kw])}):t(e.parentElement),()=>{S.v(),C.v(),w.v()}},[]),Gw(()=>{w.q()},[E]),(0,Y.useImperativeHandle)(h,()=>({get cache(){return S._()},get scrollOffset(){return S.C()},get scrollSize(){return Iw(S)},get viewportSize(){return S.p()},findItemIndex:S.$,getItemOffset:S.k,getItemSize:S.R,scrollToIndex:w.Y,scrollTo:w.V,scrollBy:w.X}),[]),o){let e=new Set(o);for(let[t,r]=S.S(n);t<=r;t++)e.add(t);bw([...e]).forEach(e=>{j.push(M(e))})}else for(let[e,t]=S.S(n);e<=t;e++)j.push(M(e));return(0,X.jsx)(u,{ref:v,style:{contain:`size style`,overflowAnchor:`none`,flex:`none`,position:`relative`,width:T?k:`100%`,height:T?`100%`:k,pointerEvents:O?`none`:void 0},children:j})});function eT(e,t){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(``),o=(0,Y.useRef)(!1);return{editing:n,draft:i,setDraft:a,begin:()=>{a(e),o.current=!1,r(!0)},commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function tT({editor:e,className:t}){return(0,X.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:e.commit,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:c(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}function nT(e){let t=new Map,n=new Set,r;return{begin:e,editingId:()=>r?.id??null,subscribeSelection(e){return n.add(e),()=>{n.delete(e)}},snapshot:e=>r?.id===e?r.editor:null,subscribe(e,n){let r=t.get(e);return r||(r=new Set,t.set(e,r)),r.add(n),()=>{r.delete(n),r.size||t.delete(e)}},publish(e,i){let a=r?.id;if(r=e&&i.editing?{id:e,editor:i}:void 0,a!==r?.id)for(let e of n)e();for(let e of new Set([a,r?.id]))if(e)for(let n of t.get(e)??[])n()}}}var rT=(0,Y.createContext)(null),iT={editing:!1,draft:``,begin(){},setDraft(){},commit(){},cancel(){}};function aT({children:e,runs:t,onRename:n}){let[r,i]=(0,Y.useState)(),[a]=(0,Y.useState)(()=>nT(e=>i({run:e}))),o=t.find(e=>e.id===r?.run.id),s=eT(o?K(o):``,e=>{o&&n(o.id,e)});return(0,Y.useEffect)(()=>{r&&s.begin()},[r]),(0,Y.useEffect)(()=>{r&&!o&&(s.cancel(),i(void 0))},[r,o,s]),(0,Y.useLayoutEffect)(()=>{a.publish(o?.id,s)},[a,o?.id,s]),(0,X.jsx)(rT,{value:a,children:e})}function oT(e){let t=(0,Y.useContext)(rT);if(!t)throw Error(`Task title editor needs its page provider`);return{...(0,Y.useSyncExternalStore)((0,Y.useCallback)(n=>t.subscribe(e.id,n),[t,e.id]),(0,Y.useCallback)(()=>t.snapshot(e.id),[t,e.id]))??iT,begin:()=>t.begin(e)}}var sT=()=>null;function cT(){return lT}function lT(){}function uT(){let e=(0,Y.useContext)(rT);return(0,Y.useSyncExternalStore)(e?.subscribeSelection??cT,e?.editingId??sT)}var dT=(0,Y.createContext)(null);function fT(e,t,n=!1){let[r,i]=(0,Y.useState)(null),a=(0,Y.useRef)(new Map),o=(0,Y.useCallback)((e,t)=>{t?a.current.set(e,t):a.current.delete(e)},[]),s=(0,Y.useCallback)(e=>[...a.current.values()].some(t=>t.includes(e)),[]);return{props:pT(e,t,i,n?s:void 0),value:(0,Y.useMemo)(()=>({focused:r,revision:t,registerList:n?o:void 0}),[r,t,o,n])}}function pT(e,t,n,r){let i=(0,Y.useRef)(r);(0,Y.useLayoutEffect)(()=>{i.current=r});let a=(0,Y.useRef)(null),o=(0,Y.useRef)(null);return(0,Y.useLayoutEffect)(()=>{let e=o.current;if(!e||e.element.isConnected||document.activeElement!==document.body)return;let t=()=>{o.current===e&&(o.current=null,n?.(null))},r=()=>{let n=e.project?`${e.project}/${e.runId}`:e.runId;if(i.current&&!i.current(n)||document.activeElement!==document.body||e.element.isConnected)return t(),!0;let r=[...a.current?.querySelectorAll(`[data-run-id]`)??[]].filter(t=>t.dataset.runId===e.runId&&t.dataset.project===e.project).flatMap(e=>[...e.querySelectorAll(`a,button,input`)]),o=r.find(t=>e.control?t.dataset.taskControl===e.control:t.tagName===e.tag&&t.getAttribute(`aria-label`)===e.label)??r.find(e=>e.tagName===`A`);return o?.focus({preventScroll:!0}),!!o&&document.activeElement===o};if(r()||!a.current)return;let s=()=>{l.disconnect(),document.removeEventListener(`pointerdown`,c,!0),document.removeEventListener(`keydown`,c,!0)},c=()=>{t(),s()},l=new MutationObserver(()=>{r()&&s()});return document.addEventListener(`pointerdown`,c,!0),document.addEventListener(`keydown`,c,!0),l.observe(a.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`style`]}),s},[e,t]),{ref:a,onFocusCapture:e=>{let t=e.target,r=t.closest(`[data-run-id]`);o.current=r?{element:t,runId:r.dataset.runId,project:r.dataset.project,control:t.dataset.taskControl??null,label:t.getAttribute(`aria-label`),tag:t.tagName}:null,n?.(r?r.dataset.project?`${r.dataset.project}/${r.dataset.runId}`:r.dataset.runId:null)},onBlurCapture:e=>{let t=e.target,r=e.currentTarget;queueMicrotask(()=>{o.current?.element===t&&t.isConnected&&!r.contains(document.activeElement)&&(o.current=null,n?.(null))})}}}var mT=new WeakMap;function hT({items:e,itemKey:t,children:n,itemSize:r}){let[i]=_n(),a=(0,Y.useRef)(null),o=(0,Y.useRef)(null),[s,c]=(0,Y.useState)({available:null,margin:0}),[l,u]=(0,Y.useState)(null),d=uT(),f=(0,Y.useContext)(dT),p=e.map(t),m=uw(e.length,i.get(`tasks`)),h=s.available===!0&&m,g=(0,Y.useRef)(Symbol(`task-list`)),_=(0,Y.useRef)(()=>{});(0,Y.useLayoutEffect)(()=>{f?.registerList?.(g.current,p);let e=y.current;return e&&mT.set(e,{keys:p,handle:o,measure:()=>_.current()}),()=>{f?.registerList?.(g.current,null),e&&mT.delete(e)}});let v=pT(String(h),void 0,void 0,e=>p.includes(e)),y=v.ref;return(0,Y.useLayoutEffect)(()=>{let e=y.current,t=e?.closest(`[data-slot="main"]`);if(a.current=t??null,!e||!t){c(e=>e.available===!1?e:{available:!1,margin:0});return}let n=null,r=()=>{let r=Math.max(0,e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop);r!==n&&(n=r,c(e=>e.available===!0&&e.margin===r?e:{available:!0,margin:r}))};r(),_.current=r;let i=new ResizeObserver(r);for(let n=e;n&&n!==t;n=n.parentElement){i.observe(n);for(let e of n.parentElement?.children??[])i.observe(e)}return i.observe(t),()=>i.disconnect()},[]),(0,X.jsx)(`div`,{ref:y,"data-slot":`task-list-items`,"data-virtualized":h,onFocusCapture:e=>{v.onFocusCapture(e),u(e.target.closest(`[data-task-item]`)?.dataset.taskItem??null)},onBlurCapture:e=>{v.onBlurCapture(e),e.relatedTarget&&!e.currentTarget.contains(e.relatedTarget)&&u(null)},children:h?(0,X.jsx)(_T,{itemSize:r,items:e,keys:p,handle:o,scroll:a,margin:s.margin,focused:f?.focused??l,editing:d,children:n}):(s.available===null&&m?[]:e).map((t,r)=>(0,X.jsx)(`div`,{"data-task-item":p[r],"data-first":r===0,"data-last":r===e.length-1,className:`task-list-flat-item`,children:n(t,r)},p[r]))})}function gT({layout:e,revision:t,visibilityRevision:n=``,children:r,...i}){let a=fT(e,t,!0);return(0,X.jsx)(dT,{value:a.value,children:(0,X.jsx)(yT,{revision:t,visibilityRevision:`${e}:${n}`,children:(0,X.jsx)(`div`,{...i,...a.props,children:r})})})}function _T({items:e,keys:t,handle:n,scroll:r,margin:i,focused:a,editing:o,children:s,itemSize:c}){let[l,u]=(0,Y.useState)(!1),d=vT(r);return(0,Y.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(e=>{e.some(e=>e.contentRect.height>0)&&(u(!0),t.disconnect())});return t.observe(e),()=>t.disconnect()},[r]),(0,X.jsx)($w,{ref:n,...c===void 0?{}:{itemSize:c},scrollRef:r,startMargin:i,keepMounted:[...new Set([...!l&&e.length?[0]:[],...dw(t,a),...dw(t,d),...dw(t,o)])],data:e,children:(n,r)=>(0,X.jsx)(`div`,{"data-task-item":t[r],"data-first":r===0,"data-last":r===e.length-1,children:s(n,r)},t[r])})}function vT(e){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(t);return(0,Y.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let i=e=>{if(e.target!==t)return;let i=t.contains(document.activeElement)?document.activeElement.closest(`[data-task-item]`)?.dataset.taskItem??null:null;i!==r.current&&(r.current=i,(0,Ku.flushSync)(()=>n(i)))};return document.addEventListener(`scroll`,i,{capture:!0,passive:!0}),()=>document.removeEventListener(`scroll`,i,{capture:!0})},[e]),t}var yT=class extends Y.Component{root={current:null};owner(){return this.root.current?.closest(`[data-slot="main"]`)??null}getSnapshotBeforeUpdate(e){if(e.revision===this.props.revision&&e.visibilityRevision===this.props.visibilityRevision)return null;let t=this.owner();if(!t||!this.root.current)return null;let n=t.getBoundingClientRect();for(let e of this.root.current.querySelectorAll(`[data-task-item]`)){let r=e.getBoundingClientRect();if(r.bottom>n.top&&r.top<n.bottom)return{key:e.dataset.taskItem,top:r.top,scrollTop:t.scrollTop}}return{key:null,top:0,scrollTop:t.scrollTop}}componentDidUpdate(e,t,n){let r=this.owner();if(!n||!r)return;let i=n.key===null?null:this.currentTop(n.key);i!==null&&Math.abs(i-n.top)>.5&&(r.scrollTop+=i-n.top),queueMicrotask(()=>{r.isConnected&&(0,Ku.flushSync)(()=>{for(let e of this.root.current?.querySelectorAll(`[data-slot="task-list-items"]`)??[])mT.get(e)?.measure();r.scrollTop!==n.scrollTop&&r.dispatchEvent(new Event(`scroll`))})})}currentTop(e){for(let t of this.root.current?.querySelectorAll(`[data-task-item]`)??[])if(t.dataset.taskItem===e)return t.getBoundingClientRect().top;for(let t of this.root.current?.querySelectorAll(`[data-slot="task-list-items"]`)??[]){let n=mT.get(t),r=n?.keys.indexOf(e)??-1,i=n?.handle.current;if(r>=0&&i)return t.getBoundingClientRect().top+i.getItemOffset(r)}return null}render(){return(0,X.jsx)(`div`,{ref:this.root,style:{display:`contents`},children:this.props.children})}};function bT(e){return e===void 0?`unknown`:new Intl.NumberFormat().format(e)}function xT(e,t){return`Input tokens: ${bT(e)}; output tokens: ${bT(t)}`}function ST(e,t,n=`compact`){let r=e===void 0?`—`:vi(e),i=t===void 0?`—`:vi(t);return n===`table`?`${r} / ${i}`:`IN ${r} · OUT ${i}`}function CT({inputTokens:e,outputTokens:t,variant:n=`compact`,omitWhenUnknown:r=!0,className:i,title:a}){return r&&e===void 0&&t===void 0?null:(0,X.jsx)(`span`,{"data-slot":`directional-usage`,"aria-label":xT(e,t),title:a,className:c(`font-mono tabular-nums`,i),children:ST(e,t,n)})}function wT({className:e,dot:t,shape:n=`filled`,pulse:r=!1,children:i,...a}){return(0,X.jsxs)(`span`,{"data-slot":`pill`,className:c(`inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-[3px] text-xs font-medium whitespace-nowrap text-muted-foreground`,e),...a,children:[t?(0,X.jsx)(q,{tone:t,shape:n,pulse:r}):null,i]})}var TT=[{value:`all`,label:`All`},{value:`direct`,label:`Direct tasks`},{value:`automations`,label:`Automations`}];function ET(e){return e?TT:TT.filter(e=>e.value!==`automations`)}function DT(e,t){return e===`automations`&&!t?`all`:e}function OT(e){return e===`direct`||e===`automations`?e:`all`}function kT(e,t){return t===`all`||A(e)===(t===`automations`)}function AT(e){return e===`all`?void 0:e===`automations`}function jT(e,t){let n={all:0,direct:0,automations:0};for(let r of e)Ya(r)||r.archived!==(t===`archived`)||(n.all+=1,A(r)?n.automations+=1:n.direct+=1);return n}function MT(e,t,n,r,i){let a=Qa(e).archived,o=a>=200;if(n===`all`)return i??(o?`200+`:a);let s=jT(t,`archived`)[n];return o&&r!==!1?`${s}+`:s}function NT(e){return e.rows.map(e=>e.run)}function PT(e,t){switch(e){case`Needs you`:return`pending`;case`Working`:return`running`;case`Archived`:return`neutral`;case`Finished`:return t.some(e=>Ne(e).bucket===`error`)?`danger`:`success`}}function FT(e,t,n){return za(e,t,eo(n))}var IT=(e,t)=>JSON.stringify([e,t]);function LT(e,t,n){let r=new Map,i=e.map(e=>{let{run:t}=e,n=IT(t.projectId,t.id);r.set(n,e);let i=t.delegation;return{...t,id:n,...i&&`parentRunId`in i?{delegation:{...i,parentRunId:IT(t.projectId,i.parentRunId)}}:{}}}),a=new Map;for(let e of n){let t=a.get(e.projectId);t?t.push(e):a.set(e.projectId,[e])}let o=new Map;for(let[e,t]of a)for(let[n,r]of eo(t))o.set(IT(e,n),r);let s=e=>r.get(e.id);return za(i,t,o).map(e=>({label:e.label,rows:e.rows.map(e=>({kind:`run`,run:s(e.run),queuePosition:e.queuePosition}))}))}function RT(e){return[e.run]}var zT=/^- \S+ — (?:(?:turn complete|step ".*" complete|step ".*" ended without done|session idle-closed) — |worktree setup (?:done in|failed —|skipped —) )/;function BT(e,t=3){let n=w(e,`## Progress log`);if(n<0)return[];let r=[];for(let i of e.slice(de(e,n)).split(`
21
+ `)){if(r.length>=t||i.startsWith(`## `))break;let e=i.trim();!e||zT.test(e)||r.push(e.replace(/^[-*] /,``))}return r}function VT({origin:e,counts:t,automations:n,onChange:r}){return(0,X.jsx)(`div`,{role:`group`,"aria-label":`Task origin`,"data-slot":`origin-filter`,className:`flex flex-wrap items-center gap-1.5`,children:ET(n).map(n=>{let i=n.value===e;return(0,X.jsxs)(`button`,{type:`button`,"data-origin":n.value,"aria-pressed":i,onClick:()=>r(n.value),className:c(`inline-flex min-h-11 items-center gap-1.5 rounded-full border border-border px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,i&&`border-accent-strong bg-accent-strong/10 text-accent-text`),children:[n.label,` `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:t[n.value]})]},n.value)})})}function HT({onExpand:e,onCollapse:t}){return(0,X.jsxs)(`div`,{"data-slot":`group-fold-controls`,className:`hidden flex-wrap items-center gap-2 md:ml-auto md:flex`,children:[(0,X.jsx)(U,{type:`button`,variant:`ghost`,className:`min-h-11`,"data-action":`expand-groups`,onClick:e,children:`Expand groups`}),(0,X.jsx)(U,{type:`button`,variant:`ghost`,className:`min-h-11`,"data-action":`collapse-groups`,onClick:t,children:`Collapse groups`})]})}function UT({origin:e,counts:t,automations:n,onChange:r,labels:i,onSetAll:a}){return(0,X.jsxs)(`div`,{"data-slot":`task-origin-row`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,X.jsx)(VT,{origin:e,counts:t,automations:n,onChange:r}),i.length>0?(0,X.jsx)(HT,{onExpand:()=>a(i,!1),onCollapse:()=>a(i,!0)}):null]})}var WT={pending:`needs you`,running:`working`,success:`finished`,danger:`contains failed tasks`,neutral:`archived`};function GT({id:e,label:t,count:n,tone:r,folded:i,collapsed:a,onToggle:o,children:s}){let c=a?Br:Or;return(0,X.jsxs)(`section`,{"data-slot":`task-status-group`,"data-bucket":t,"data-folded":i,"data-tone":r,"aria-labelledby":`${e}-heading`,className:`flex flex-col gap-2.5`,children:[(0,X.jsx)(`h2`,{id:`${e}-heading`,className:`text-[13px] font-semibold text-foreground`,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`status-group-toggle`,"aria-expanded":!a,"aria-controls":`${e}-rows`,"aria-label":`${t} ${n}${r===`danger`?`, contains failed tasks`:``}`,onClick:o,className:`inline-flex min-h-11 items-center gap-2 rounded-md pr-2 hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,children:[(0,X.jsx)(c,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,X.jsx)(q,{tone:r,role:`img`,"aria-label":WT[r],title:WT[r]}),(0,X.jsx)(`span`,{children:t}),` `,(0,X.jsx)(`span`,{className:`font-normal tabular-nums text-muted-foreground`,children:n})]})}),(0,X.jsx)(`div`,{id:`${e}-rows`,hidden:a,children:a?null:s})]})}function KT({automationId:e,automationName:t,project:n}){let r=e===void 0?`Direct task`:t??e;return(0,X.jsxs)(`span`,{"data-slot":`task-origin`,"data-origin":e===void 0?`direct`:`automation`,className:`flex min-w-0 flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[n?(0,X.jsxs)(X.Fragment,{children:[n,(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`·`})]}):null,(0,X.jsx)(`span`,{className:`min-w-0 break-words`,title:e===void 0?void 0:`Automation ${e}`,children:r})]})}function qT({projectId:e,runId:t,status:n,error:r,open:i}){let a=dt(e,t,!0),o=a.data===void 0?[]:BT(a.data);return(0,X.jsxs)(`div`,{"data-slot":`task-preview`,className:`flex flex-col gap-3 rounded-md bg-muted/50 p-4 text-xs`,children:[(0,X.jsx)(`p`,{className:`font-medium text-foreground first-letter:uppercase`,children:n}),r?(0,X.jsx)(`p`,{"data-slot":`task-preview-error`,className:`break-words text-danger`,children:r}):null,a.isPending?(0,X.jsx)(`p`,{role:`status`,className:`text-muted-foreground`,children:`Loading latest progress…`}):a.isError?(0,X.jsx)(`p`,{"data-slot":`task-preview-unavailable`,className:`text-muted-foreground`,children:`Latest progress is unavailable.`}):o.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`No progress recorded yet.`}):(0,X.jsx)(`ul`,{"aria-label":`Latest progress`,className:`flex flex-col gap-1 text-muted-foreground`,children:o.map((e,t)=>(0,X.jsx)(`li`,{className:`break-words`,children:e},t))}),(0,X.jsx)(`div`,{children:i})]})}var JT=`cez-task-list-folds`,YT=`cez-task-list-folds-changed`;function XT(e,t,n=new Set){let[r,i]=(0,Y.useState)(()=>Lh(JT));(0,Y.useEffect)(()=>{let e=e=>{e instanceof StorageEvent&&e.key!==null&&e.key!==`cez-task-list-folds`||i(e instanceof CustomEvent?e.detail:Lh(JT))};return window.addEventListener(`storage`,e),window.addEventListener(YT,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(YT,e)}},[]);let a=(0,Y.useCallback)(n=>JSON.stringify([e,t,n]),[e,t]),o=(0,Y.useCallback)(e=>{i(t=>{let n=e(t);return Rh(n,JT),queueMicrotask(()=>window.dispatchEvent(new CustomEvent(YT,{detail:n}))),n})},[]),s=e=>r[a(e)]===!0;return{isFolded:s,isCollapsed:e=>s(e)&&!n.has(e),toggle:e=>o(t=>({...t,[a(e)]:t[a(e)]!==!0})),setAll:(e,t)=>o(n=>({...n,...Object.fromEntries(e.map(e=>[a(e),t]))})),only:(0,Y.useCallback)((e,t)=>o(n=>({...n,...Object.fromEntries(t.map(t=>[a(t),t!==e]))})),[o,a])}}function ZT(e,t,n,r){let i=XT(e,t,n),a=(0,Y.useRef)(r);a.current=r;let[o,s]=iC(),c=t===`active`?Ka(o.get(Ja)):null,{only:l}=i;return(0,Y.useEffect)(()=>{c!==null&&(l(c,Za),a.current?.(),s(e=>(e.delete(Ja),e)))},[c,l,s]),i}function QT(e){let t=e?.capabilities,n=t?.tokenMetrics!==!1;return{tokens:t?.tokenUsageMetrics??n,cost:t?.costMetrics??n}}function $T(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function eE(){let e=F(),t=Jt(),n=Y.useRef(0),r=Y.useRef(0),i=Y.useRef(Promise.resolve()),a=Y.useMemo(()=>ow(t.data?.taskTable?.expandedColumns),[t.data?.taskTable?.expandedColumns]),o=Y.useCallback(t=>{if(!rw.find(e=>e.id===t)?.canFold)return;let a=e.getQueryData(L.uiState);if(a===void 0)return;let o=$T(a?.taskTable),s={...o,expandedColumns:cw(o.expandedColumns,t)};e.setQueryData(L.uiState,{...a,taskTable:s});let c=++n.current;r.current=c;let l=i.current.then(async()=>{let t=await _e({taskTable:s},{keepalive:!0});c===r.current&&e.setQueryData(L.uiState,t)});i.current=l.catch(t=>{V(t instanceof Error?t.message:String(t),{tone:`danger`}),c===r.current&&e.invalidateQueries({queryKey:L.uiState})})},[e]);return{expandedColumns:a,isExpanded:Y.useCallback(e=>sw(e,a),[a]),toggleColumn:o,isPending:t.isPending}}var tE=()=>void 0;function nE({runs:e,view:t,onViewChange:n,onArchiveFinished:r,archivePending:i=!1,onMarkAllRead:a,onRename:o,onTogglePin:s,now:c=Date.now(),showTokens:l=!0,showCost:u=!0,expandedColumns:d=ow(void 0),onToggleColumn:f=()=>void 0,columnsPending:p=!1,projectName:m,error:h,onRetry:g,archivedPages:_,archivedTotal:v,onArchivedSearch:y,origin:b,onOriginChange:x,automations:S,urlQuery:C=``,onQueryChange:w,foldScope:T=`project`,automationName:E=tE}){let[D,O]=rE(C,w);Y.useEffect(()=>{y?.(D.trim())},[y,D]);let[k,A]=aE(b,x,S),[j,M]=Y.useState(!1),ee=Oh(),{expandedRuns:te,toggleExpandedRun:ne}=nw(),re=Y.useRef(null),ie=Y.useMemo(()=>e??[],[e]),N=Y.useMemo(()=>oE({all:ie,view:t,query:D,origin:k,archivedPages:_,archivedTotal:v,automationName:E}),[ie,t,D,k,_,v,E]),{groups:P,needle:ae}=N,oe=Y.useMemo(()=>lw({tokens:l,cost:u}),[l,u]),se=ZT(T,t,new Set(ae?P.map(e=>e.label):[]),()=>O(``)),ce=t===`archived`?void 0:s;return(0,X.jsx)(aT,{runs:_?[...ie,..._.runs]:ie,onRename:o,children:(0,X.jsxs)(gT,{layout:`${ee}:${j}`,revision:P,visibilityRevision:JSON.stringify([$a.map(se.isCollapsed),[...te].sort(),t,d]),"data-route":`tasks`,"data-presentation":j?`resources`:`summary`,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:[(0,X.jsxs)(`header`,{ref:re,className:`flex shrink-0 flex-col gap-[22px]`,children:[(0,X.jsx)(iE,{projectName:m,detailedTable:j}),(0,X.jsxs)(`div`,{className:`flex gap-6 border-b border-border`,children:[(0,X.jsx)(vE,{view:`active`,current:t,onSelect:n,count:N.activeCount,children:`Active`}),(0,X.jsx)(vE,{view:`archived`,current:t,onSelect:n,count:N.archivedCount,children:`Archived`})]}),(0,X.jsxs)(`div`,{"data-slot":`tasks-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,X.jsx)(cE,{view:t,unread:N.unread,finished:N.finished,archivePending:i,headerRef:re,onMarkAllRead:()=>a(AT(k)),onArchiveFinished:()=>r(AT(k))}),(0,X.jsxs)(`div`,{className:`relative order-first w-full md:w-auto md:min-w-64 md:flex-1`,children:[(0,X.jsx)(hr,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-soft-foreground`,"aria-hidden":`true`}),(0,X.jsx)(`input`,{type:`text`,value:D,onChange:e=>O(e.target.value),placeholder:`Search tasks or automations…`,"aria-label":`Search tasks`,className:`h-11 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,X.jsx)(lE,{columns:oe,expandedColumns:d,columnsPending:p,onToggleColumn:f,detailedTable:j,onToggleDetailed:()=>M(e=>!e)}),(0,X.jsx)(U,{asChild:!0,"data-slot":`new-task-inline`,className:`min-h-11 inline-flex max-md:hidden`,children:(0,X.jsxs)(G,{to:`/new`,children:[(0,X.jsx)(ar,{"aria-hidden":`true`}),`New task`]})})]}),(0,X.jsx)(UT,{origin:k,counts:N.originTotals,automations:S,onChange:A,labels:P.map(e=>e.label),onSetAll:se.setAll})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[e===void 0?(0,X.jsx)(dE,{error:h,onRetry:g}):(0,X.jsx)(uE,{view:t,query:D,origin:k,onShowAll:()=>{O(``),A(`all`)},caption:sE(N.visibleCount,N.incomplete,ae),captionOnPhones:ae!==``||N.incomplete,groups:P,folds:se,grouped:{desktop:ee,expandedRuns:te,toggleExpandedRun:ne,detailedTable:j,columns:oe,expandedColumns:d,onToggleColumn:f,columnsPending:p,onRename:o,onTogglePin:ce,now:c,showTokens:l,showCost:u,automationName:E}}),t===`archived`&&_?(0,X.jsx)(fE,{pages:_}):null]})]})})}function rE(e,t){let[n,r]=Y.useState(e),i=Y.useRef(e),a=Y.useRef(e),o=Y.useRef([]);return Y.useEffect(()=>{if(e===i.current)return;i.current=e;let t=o.current.indexOf(e);o.current=t===-1?[]:o.current.slice(t+1),t===-1&&e!==a.current&&r(e)},[e]),Y.useEffect(()=>{a.current=n.trim(),t?.(n,e=>{o.current.push(e)})},[t,n]),[n,r]}function iE({projectName:e,detailedTable:t}){return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`Project tasks`}),(0,X.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[e?`${e} · `:``,t?`Every resource column shown. Fold columns without losing the saved view.`:`Review runs, pull requests and resource usage.`]})]})}function aE(e,t,n){let[r,i]=Y.useState(`all`);return[DT(e??r,n),t??i]}function oE({all:e,view:t,query:n,origin:r,archivedPages:i,archivedTotal:a,automationName:o}){let s=n.trim(),c=e=>e.automationId===void 0?``:o(e.automationId)??e.automationId,l=i?.query===s,u=new Set(l?i.runs.map(e=>e.id):[]),d=to(e,l||s===``?i?.runs??[]:[]).slice(e.length),f=Wn(e,n,c),p=new Set(f.map(e=>e.id)),m=Wn(e.filter(e=>u.has(e.id)&&!p.has(e.id)),``),h=e=>kT(e,r),g=FT([...f,...m,...Wn(d,``)].filter(h),t,e),_=to(e,i?.query===``?i.runs:[]),v=Qa(e).archived>=200,y=e.filter(h);return{groups:g,needle:s,visibleCount:g.reduce((e,t)=>e+NT(t).length,0),originTotals:jT(_,t),activeCount:jT(e,`active`)[r],archivedCount:MT(e,_,r,i?.plainHasMore,a),incomplete:t===`archived`&&v&&i?.hasMore!==!1,finished:Bn(y),unread:Ml(y)}}function sE(e,t,n){return`${e} ${e===1?`task`:`tasks`}${t?` loaded`:``}${n?` matching “${n}”`:``}`}function cE({view:e,unread:t,finished:n,archivePending:r,headerRef:i,onMarkAllRead:a,onArchiveFinished:o}){let s=Y.useRef(!1),[c,l]=Y.useState(!1),u=n>0||r;return Y.useEffect(()=>{let e=window.matchMedia?.(Dh);if(!e)return;let t=()=>{e.matches&&l(!1)};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,X.jsxs)(X.Fragment,{children:[t>0?(0,X.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`mark-all-read`,className:`hidden md:inline-flex`,onClick:a,children:[(0,X.jsx)(as,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read`,` `,(0,X.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:t})]}):null,e===`active`&&n>0?(0,X.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,className:`inline-flex`,disabled:r,"aria-busy":r,onClick:o,children:[(0,X.jsx)(Rr,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`,` `,(0,X.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:n})]}):null,e===`active`&&(u||t>0)?(0,X.jsxs)(Gi,{open:c,onOpenChange:l,children:[(0,X.jsx)(Hi,{asChild:!0,children:(0,X.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`md:hidden`,"aria-label":`Task actions`,"aria-busy":r,children:(0,X.jsx)(ms,{"aria-hidden":`true`})})}),(0,X.jsxs)(Ui,{align:`end`,className:`md:hidden`,onCloseAutoFocus:e=>{(s.current||window.matchMedia?.(`(min-width: 48rem)`).matches)&&(e.preventDefault(),s.current=!1,i.current?.querySelector(`[data-view="active"]`)?.focus())},children:[u?(0,X.jsxs)(W,{disabled:r||n===0,onSelect:()=>{s.current=!0,o()},children:[(0,X.jsx)(Rr,{"aria-hidden":`true`}),r?`Archiving…`:`Archive finished (${n})`]}):null,t>0?(0,X.jsxs)(W,{onSelect:a,children:[(0,X.jsx)(as,{"aria-hidden":`true`}),`Mark all read (${t})`]}):null]})]}):null]})}function lE({columns:e,expandedColumns:t,columnsPending:n,onToggleColumn:r,detailedTable:i,onToggleDetailed:a}){return(0,X.jsxs)(ga,{children:[(0,X.jsx)(fa,{asChild:!0,children:(0,X.jsx)(U,{"data-slot":`task-columns-trigger`,variant:`outline`,className:`hidden min-h-11 md:inline-flex`,children:`Columns`})}),(0,X.jsxs)(ha,{align:`end`,className:`w-72`,children:[(0,X.jsx)(`h2`,{className:`mb-2 text-base font-medium`,children:`Visible columns`}),(0,X.jsx)(`p`,{className:`mb-4 text-xs text-muted-foreground`,children:`Status and Task · Always visible`}),(0,X.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:e.filter(e=>e.canFold).map(e=>(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,X.jsx)(`input`,{"data-column-toggle":e.id,type:`checkbox`,checked:sw(e.id,t),disabled:n,onChange:()=>r(e.id)}),e.id===`diff`?`Diff`:e.id===`reference`?`Reference`:e.id===`memory`?`Memory`:e.label]},e.id))}),(0,X.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Saved automatically. Tokens and cost appear only when supported.`}),(0,X.jsx)(U,{variant:`outline`,className:`mt-4`,onClick:a,children:i?`Summary view`:`Resource columns`})]})]})}function uE({view:e,query:t,origin:n,onShowAll:r,caption:i,captionOnPhones:a,groups:o,folds:s,grouped:l}){return o.length===0?(0,X.jsx)(pE,{view:e,query:t,origin:n,onShowAll:r}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{"data-slot":`tasks-result-count`,className:c(`mb-3 text-[12px] text-muted-foreground tabular-nums`,!a&&`max-md:hidden`),children:i}),(0,X.jsx)(`div`,{className:`flex flex-col gap-[22px]`,children:o.map(t=>{let n=NT(t);return(0,X.jsx)(GT,{id:`tasks-group-${e}-${t.label.replaceAll(` `,`-`)}`,label:t.label,count:n.length,tone:PT(t.label,n),folded:s.isFolded(t.label),collapsed:s.isCollapsed(t.label),onToggle:()=>s.toggle(t.label),children:(0,X.jsx)(gE,{group:t,...l})},t.label)})}),(0,X.jsx)(`p`,{className:`mt-[22px] text-[11px] text-muted-foreground`,children:`Resource details—including tokens, cost, CPU and peak memory—are available when a task row is expanded.`})]})}function dE({error:e,onRetry:t}){return e?(0,X.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-border bg-card p-6`,children:[(0,X.jsx)(`h2`,{className:`text-lg`,children:`Could not load tasks`}),(0,X.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e}),(0,X.jsx)(U,{variant:`outline`,className:`mt-4`,onClick:t,children:`Retry`})]}):(0,X.jsx)(`div`,{role:`status`,"aria-label":`Loading tasks`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading tasks…`})}function fE({pages:e}){return e.failed?(0,X.jsxs)(`p`,{role:`alert`,"data-slot":`archived-older-error`,className:`mt-3.5 flex items-center justify-center gap-2.5 text-[13px] text-muted-foreground`,children:[`Could not load older archived tasks.`,(0,X.jsx)(U,{variant:`outline`,className:`min-h-11`,onClick:e.onLoadMore,children:`Retry`})]}):e.hasMore?(0,X.jsx)(U,{"data-slot":`archived-older`,variant:`outline`,className:`mt-3.5 min-h-11 self-center`,disabled:e.loading,onClick:e.onLoadMore,children:e.loading?`Loading older archived…`:`Show older archived`}):null}function pE({view:e,query:t,origin:n=`all`,onShowAll:r}){let i=t.trim(),a=i||n!==`all`?`search-miss`:e===`archived`?`archive`:`no-tasks`;return(0,X.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":a,className:`flex flex-1 flex-col`,children:a===`search-miss`?(0,X.jsx)(ko,{heading:`h2`,icon:(0,X.jsx)(Oi,{}),tone:`neutral`,title:`No matching tasks`,subtitle:i?`No tasks match “${i}”.`:n===`automations`?`No automation started a task here.`:`No task here was started directly.`,actions:r?(0,X.jsx)(U,{variant:`outline`,className:`min-h-11`,"data-action":`clear-task-filters`,onClick:r,children:`Show all tasks`}):void 0}):a===`archive`?(0,X.jsx)(ko,{heading:`h2`,icon:(0,X.jsx)(Rr,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,X.jsx)(ko,{heading:`h2`,icon:(0,X.jsx)(Cs,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,X.jsx)(U,{asChild:!0,children:(0,X.jsxs)(G,{to:`/new`,"data-new-task-action":!0,children:[(0,X.jsx)(ar,{"aria-hidden":`true`}),`New task`]})})})})}function mE({rows:e,onRename:t,onTogglePin:n,now:r,showTokens:i,showCost:a,automationName:o,expandedRuns:s,toggleExpandedRun:c}){let l=pw(e.map(({run:e})=>e.id),s);return(0,X.jsx)(`div`,{"data-slot":`tasks-summary`,children:(0,X.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-5`,role:`table`,"aria-rowcount":l.rowCount,children:[(0,X.jsx)(`div`,{role:`row`,"aria-rowindex":1,className:`task-summary-grid`,children:[`Task`,`Workflow`,`Changes`,`Pull request`,`Started`].map(e=>(0,X.jsx)(`div`,{role:`columnheader`,className:`h-8 border-b border-border text-start text-[12px] font-medium uppercase text-muted-foreground`,children:e},e))}),(0,X.jsx)(hT,{itemSize:103,items:e,itemKey:({run:e})=>e.id,children:({run:e,queuePosition:u},d)=>(0,X.jsx)(hE,{run:e,queuePosition:u,rowIndex:l.indexes[d],onRename:t,onTogglePin:n,now:r,showTokens:i,showCost:a,automationName:o,open:s.has(e.id),toggleExpandedRun:c})})]})})}var hE=Y.memo(function({run:e,queuePosition:t,rowIndex:n,onRename:r,onTogglePin:i,now:a,showTokens:o,showCost:s,automationName:c,open:l,toggleExpandedRun:u}){let d=Ne(e),f=Pn(e),p=Ln(e),m=`task-resources-${e.id}`;return(0,X.jsxs)(`div`,{role:`rowgroup`,children:[(0,X.jsxs)(`div`,{role:`row`,"aria-rowindex":n,"data-status":e.status,"data-slot":`task-summary-row`,"data-run-id":e.id,className:`task-summary-grid group/row`,children:[(0,X.jsxs)(`div`,{role:`cell`,className:`py-5 pr-4 align-top`,children:[(0,X.jsx)(DE,{run:e,to:`/tasks/${e.id}`,onRename:r,onTogglePin:i}),(0,X.jsx)(`div`,{className:`mt-1`,children:(0,X.jsx)(TE,{run:e,automationName:c})}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`button`,{type:`button`,"data-task-control":`resources`,"aria-label":`${l?`Hide`:`Show`} resources for ${K(e)}`,"aria-expanded":l,"aria-controls":m,"aria-describedby":`summary-status-${e.id}`,onClick:()=>u(e.id),className:`inline-flex min-h-[26px] items-center gap-1 rounded-md p-0 text-[11px] text-muted-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:(0,X.jsxs)(wT,{id:`summary-status-${e.id}`,dot:d.tone,shape:d.shape,pulse:d.pulse,children:[d.label,f?` ${f.label}`:``]})}),e.status===`queued`&&t!==null?(0,X.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`#`,t,` in queue`]}):null]})]}),(0,X.jsx)(`div`,{role:`cell`,className:`truncate pr-3 text-xs text-muted-foreground`,title:Kn(e),children:Kn(e)}),(0,X.jsx)(`div`,{role:`cell`,className:`pr-2 text-xs`,children:e.diffStat?(0,X.jsx)(wm,{stat:e.diffStat}):(0,X.jsx)(NE,{})}),(0,X.jsx)(`div`,{role:`cell`,className:`pr-2`,children:p?(0,X.jsx)(ch,{run:e,reference:p,compact:!0}):(0,X.jsx)(NE,{})}),(0,X.jsx)(`div`,{role:`cell`,className:`text-xs text-muted-foreground`,children:_i(e.startedAt??e.createdAt,a)})]}),l?(0,X.jsx)(`div`,{role:`row`,"aria-rowindex":n+1,"data-run-id":e.id,children:(0,X.jsx)(`div`,{role:`cell`,"aria-colspan":5,className:`border-b border-border pb-5`,children:(0,X.jsxs)(`div`,{id:m,className:`flex flex-col gap-3`,children:[(0,X.jsx)(qT,{runId:e.id,status:d.label,error:e.error,open:(0,X.jsx)(U,{asChild:!0,variant:`outline`,className:`min-h-11`,children:(0,X.jsxs)(G,{"data-task-control":`open`,to:`/tasks/${e.id}`,children:[`Open task`,(0,X.jsxs)(`span`,{className:`sr-only`,children:[`: `,K(e)]})]})})}),(0,X.jsx)(`div`,{className:`rounded-md bg-muted/50 p-4`,children:(0,X.jsx)(_E,{run:e,showTokens:o,showCost:s})})]})})}):null]})});function gE({desktop:e,expandedRuns:t,toggleExpandedRun:n,group:r,detailedTable:i,columns:a,expandedColumns:o,onToggleColumn:s,columnsPending:c,onRename:l,onTogglePin:u,now:d,showTokens:f,showCost:p,automationName:m}){let h=r.rows.flatMap(e=>RT(e).map(t=>({run:t,queuePosition:t.status===`queued`?e.queuePosition:null})));return(0,X.jsxs)(X.Fragment,{children:[e&&!i?(0,X.jsx)(mE,{expandedRuns:t,toggleExpandedRun:n,rows:h,onRename:l,onTogglePin:u,now:d,showTokens:f,showCost:p,automationName:m}):null,e&&i?(0,X.jsx)(`div`,{"data-slot":`tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card`,children:(0,X.jsx)(Qu,{children:(0,X.jsxs)(`div`,{role:`table`,"aria-rowcount":h.length+1,className:`task-resource-grid`,style:fw(a,o),children:[(0,X.jsx)(`div`,{role:`row`,"aria-rowindex":1,className:`task-resource-row`,children:a.map(e=>(0,X.jsx)(bE,{column:e,expanded:sw(e.id,o),onToggle:s,disabled:c},e.id))}),(0,X.jsx)(hT,{itemSize:50,items:h,itemKey:({run:e})=>e.id,children:({run:e,queuePosition:t},n)=>(0,X.jsx)(CE,{rowIndex:n+2,run:e,queuePosition:t,onRename:l,onTogglePin:u,now:d,columns:a,expandedColumns:o,automationName:m})})]})})}):null,e?null:(0,X.jsx)(`div`,{"data-slot":`task-cards`,className:`flex flex-col rounded-lg border border-border bg-card p-5`,children:(0,X.jsx)(hT,{itemSize:178,items:h,itemKey:({run:e})=>e.id,children:({run:e,queuePosition:r})=>(0,X.jsx)(jE,{resourcesOpen:t.has(e.id),onToggleResources:n,run:e,queuePosition:r,now:d,showTokens:f,showCost:p,onTogglePin:u,automationName:m},e.id)})})]})}function _E({run:e,showTokens:t,showCost:n}){let r=Mn(e,Dn(e.id));return(0,X.jsxs)(`dl`,{className:`grid grid-cols-2 gap-4 text-xs md:grid-cols-4`,children:[t?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Tokens in / out`}),(0,X.jsx)(`dd`,{className:`mt-1`,children:(0,X.jsx)(CT,{inputTokens:e.inputTokens,outputTokens:e.outputTokens,omitWhenUnknown:!1})})]}):null,n?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Cost`}),(0,X.jsx)(`dd`,{className:`mt-1`,children:Hn(e.costUsd)||`—`})]}):null,(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`CPU`}),(0,X.jsx)(`dd`,{className:`mt-1`,title:r.cpu.title,children:r.cpu.text||`—`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Memory`}),(0,X.jsx)(`dd`,{className:`mt-1`,title:r.mem.title,children:r.mem.text||`—`})]}),e.branch?(0,X.jsxs)(`div`,{className:`col-span-2`,children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Branch`}),(0,X.jsx)(`dd`,{className:`mt-1 break-all`,children:e.branch})]}):null]})}function vE({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:c(`flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground`,a&&`border-accent-strong font-semibold text-accent-text`),children:[i,r===0?null:(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[` · `,r]})]})}function yE({children:e,right:t=!1,columnId:n,folded:r=!1}){return(0,X.jsx)(`div`,{role:`columnheader`,"data-column-id":n,"data-folded":r||void 0,className:c(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-supporting-foreground uppercase first:pl-4 last:pr-4`,t&&`text-right`,r&&`px-0 first:pl-0 last:pr-0`),children:e})}function bE({column:e,expanded:t,onToggle:n,disabled:r}){if(!e.canFold)return(0,X.jsx)(yE,{columnId:e.id,right:e.align===`right`,children:e.label});let i=t?`Fold`:`Expand`;return(0,X.jsx)(yE,{columnId:e.id,right:e.align===`right`,folded:!t,children:(0,X.jsxs)($u,{children:[(0,X.jsx)(ed,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`${i} ${e.label} column`,"aria-pressed":t,disabled:r,onClick:()=>n(e.id),className:c(`inline-flex h-8 w-full items-center gap-1 rounded-sm px-0.5 text-inherit outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-wait disabled:opacity-60`,e.align===`right`?`justify-end`:`justify-start`,!t&&`justify-center px-0`),children:t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:e.label}),(0,X.jsx)(ss,{className:`size-3 opacity-55`,"aria-hidden":`true`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(xE,{icon:e.icon}),(0,X.jsx)(cs,{className:`size-3 opacity-70`,"aria-hidden":`true`})]})})}),(0,X.jsxs)(td,{side:`top`,children:[e.label,` · `,i,` column`]})]})})}function xE({icon:e}){let t=`size-3.5`;switch(e){case`workflow`:return(0,X.jsx)(Vr,{className:t,"aria-hidden":`true`});case`branch`:return(0,X.jsx)(Zn,{className:t,"aria-hidden":`true`});case`diff`:return(0,X.jsx)($n,{className:t,"aria-hidden":`true`});case`reference`:return(0,X.jsx)(Ss,{className:t,"aria-hidden":`true`});case`tokens`:return(0,X.jsx)(us,{className:t,"aria-hidden":`true`});case`cost`:return(0,X.jsx)(ps,{className:t,"aria-hidden":`true`});case`cpu`:return(0,X.jsx)(Wr,{className:t,"aria-hidden":`true`});case`memory`:return(0,X.jsx)(ws,{className:t,"aria-hidden":`true`});case`started`:return(0,X.jsx)(ls,{className:t,"aria-hidden":`true`});default:return null}}var SE=`h-[88px] border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`,CE=Y.memo(function({rowIndex:e,run:t,queuePosition:n,onRename:r,onTogglePin:i,now:a,columns:o,expandedColumns:s,automationName:l}){let u=Da(),d=Ne(t),f=Pn(t),p=`/tasks/${t.id}`,m=Hn(t.costUsd),h=Ln(t);return(0,X.jsx)(`div`,{role:`row`,"aria-rowindex":e,"data-slot":`task-table-row`,"data-run-id":t.id,onClick:e=>{e.target.closest(`a, button, input`)||u(p)},className:`task-resource-row group/row cursor-pointer hover:bg-muted`,children:o.map(e=>{if(e.id===`memory`)return null;if(e.id===`cpu`){let r=sw(`cpu`,s),i=sw(`memory`,s);return n!==null&&(r||i)?(0,X.jsxs)(`div`,{role:`cell`,"data-slot":`queue-note`,"data-column-id":`cpu-memory`,"aria-colspan":2,style:{gridColumn:`span 2`},className:c(SE,`text-right font-mono text-[11px] text-supporting-foreground`),children:[`#`,n,` in queue`]},e.id):(0,X.jsx)(OE,{run:t,cpuExpanded:r,memoryExpanded:i},e.id)}return(0,X.jsx)(wE,{column:e,expanded:sw(e.id,s),run:t,attention:d,scheduled:f,reference:h,cost:m,to:p,onRename:r,onTogglePin:i,now:a,automationName:l},e.id)})})});function wE({column:e,expanded:t,run:n,attention:r,scheduled:i,reference:a,cost:o,to:s,onRename:l,onTogglePin:u,now:d,automationName:f}){if(!t)return(0,X.jsx)(EE,{column:e.id});switch(e.id){case`status`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`overflow-hidden`),children:(0,X.jsx)(wT,{dot:r.tone,shape:r.shape,pulse:r.pulse,title:i?.title??r.label,className:`w-full max-w-full overflow-hidden`,children:(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[r.label,i?(0,X.jsxs)(X.Fragment,{children:[` `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:i.label})]}):null]})})});case`task`:return(0,X.jsxs)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`min-w-[320px] max-w-0 whitespace-normal`),children:[(0,X.jsx)(DE,{run:n,to:s,onRename:l,onTogglePin:u}),(0,X.jsx)(`div`,{className:`mt-1`,children:(0,X.jsx)(TE,{run:n,automationName:f})})]});case`workflow`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`max-w-0 truncate text-[13px] text-muted-foreground`),children:Kn(n)});case`branch`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`max-w-0 overflow-hidden`),children:n.branch?(0,X.jsx)(PE,{branch:n.branch}):(0,X.jsx)(NE,{})});case`diff`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`overflow-hidden`),children:n.diffStat?(0,X.jsx)(wm,{stat:n.diffStat,compact:!0,className:`block max-w-full`}):(0,X.jsx)(NE,{})});case`reference`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`overflow-hidden`),children:a?(0,X.jsx)(ch,{run:n,reference:a,compact:!0,className:`max-w-full overflow-hidden`}):(0,X.jsx)(NE,{})});case`tokens`:let t=xT(n.inputTokens,n.outputTokens);return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`text-right text-xs text-muted-foreground`),children:(0,X.jsx)(CT,{inputTokens:n.inputTokens,outputTokens:n.outputTokens,variant:`table`,omitWhenUnknown:!1,title:t,className:`block max-w-full overflow-hidden text-ellipsis`})});case`cost`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:o?(0,X.jsx)(AE,{text:o,accessibleText:`$${n.costUsd}`}):(0,X.jsx)(NE,{})});case`started`:return(0,X.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:c(SE,`text-right text-xs text-supporting-foreground tabular-nums`),children:_i(n.startedAt??n.createdAt,d)});default:return null}}function TE({run:e,automationName:t}){return(0,X.jsx)(KT,{automationId:e.automationId,automationName:e.automationId===void 0?void 0:t(e.automationId)})}function EE({column:e}){return(0,X.jsx)(`div`,{role:`cell`,"aria-hidden":`true`,"data-column-id":e,"data-folded":`true`,className:c(SE,`px-0 first:pl-0 last:pr-0`)})}function DE({run:e,to:t,onTogglePin:n}){let r=K(e),i=oT(e),a=no(e),o=jl(e);return i.editing?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-slot":`table-title-editor`,children:[(0,X.jsx)(tT,{editor:i,className:`basis-full text-[13px] font-medium`}),(0,X.jsx)(U,{size:`sm`,"aria-label":`Save title`,onMouseDown:e=>e.preventDefault(),onClick:i.commit,children:`Save`}),(0,X.jsx)(U,{size:`sm`,variant:`outline`,"aria-label":`Cancel rename`,onMouseDown:e=>e.preventDefault(),onClick:i.cancel,children:`Cancel`})]}):(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.delegation?.role===`worker`?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,X.jsx)(G,{"data-task-control":`title`,to:t,title:r,className:c(`line-clamp-2 min-w-0 flex-1 whitespace-normal rounded-sm text-[13px] leading-[18px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,a?`font-semibold text-foreground`:o?`font-normal text-foreground`:`font-medium`),children:r}),a?(0,X.jsx)(q,{tone:Nl(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null,(0,X.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:i.begin,className:`shrink-0 rounded-sm p-0.5 text-soft-foreground opacity-0 transition-opacity group-hover/row:opacity-100 hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(Ds,{className:`size-3`,"aria-hidden":`true`})}),n?(0,X.jsx)(fh,{pinned:!!e.pinned,onToggle:t=>n(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 OE({run:e,cpuExpanded:t,memoryExpanded:n}){let r=Mn(e,Dn(e.id));return(0,X.jsxs)(X.Fragment,{children:[t?(0,X.jsx)(kE,{column:`cpu`,cell:r.cpu}):(0,X.jsx)(EE,{column:`cpu`}),n?(0,X.jsx)(kE,{column:`memory`,cell:r.mem}):(0,X.jsx)(EE,{column:`memory`})]})}function kE({column:e,cell:t}){let n=t.text&&t.title?`${t.text}; ${t.title}`:t.text;return(0,X.jsx)(`div`,{role:`cell`,"data-usage":e===`memory`?`mem`:e,"data-column-id":e,"data-usage-kind":t.kind,className:c(SE,`overflow-hidden`,`text-right font-mono tabular-nums`,t.kind===`live`&&`bg-accent-strong/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-[11px] text-supporting-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:(0,X.jsx)(AE,{text:t.text||`—`,accessibleText:n||void 0})})}function AE({text:e,accessibleText:t}){return(0,X.jsx)(`span`,{"data-slot":`bounded-metric`,...t?{"aria-label":t,title:t}:{},className:`block max-w-full overflow-hidden text-ellipsis`,children:e})}var jE=Y.memo(function({resourcesOpen:e,onToggleResources:t,run:n,queuePosition:r,now:i,showTokens:a,showCost:o,onTogglePin:s,automationName:l}){let u=Da(),d=Ne(n),f=Pn(n),p=`/tasks/${n.id}`,m=Ln(n),h=no(n),g=jl(n);return(0,X.jsxs)(`div`,{"data-slot":`task-card`,"data-status":n.status,"data-run-id":n.id,onClick:e=>{e.target.closest(`a, button`)||u(p)},className:`cursor-pointer border-b border-border py-5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2.5`,children:[(0,X.jsx)(`button`,{"data-slot":`mobile-resources-toggle`,"data-task-control":`resources`,type:`button`,"aria-controls":`mobile-resources-${n.id}`,"aria-describedby":`mobile-status-${n.id}`,"aria-label":e?`Hide resources`:`Show resources`,title:e?`Hide resources`:`Show resources`,"aria-expanded":e,onClick:()=>t(n.id),children:(0,X.jsxs)(wT,{id:`mobile-status-${n.id}`,dot:d.tone,shape:d.shape,pulse:d.pulse,className:`mt-px shrink-0`,title:f?.title,children:[d.label,f?(0,X.jsx)(`span`,{className:`tabular-nums`,children:f.label}):null]})}),(0,X.jsxs)(G,{"data-task-control":`title`,to:p,className:c(`order-first w-full min-w-0 rounded-sm text-[14px] leading-[1.35] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,h?`font-semibold text-foreground`:g?`font-normal text-foreground`:`font-medium`),children:[n.delegation?.role===`worker`?(0,X.jsx)(`span`,{className:`mr-2 text-xs text-muted-foreground`,children:`Worker`}):null,K(n)]}),h?(0,X.jsx)(q,{tone:Nl(n),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`mt-1.5 shrink-0`}):null,(0,X.jsx)(`div`,{className:`order-first w-full`,children:(0,X.jsx)(TE,{run:n,automationName:l})}),s?(0,X.jsx)(fh,{pinned:!!n.pinned,onToggle:e=>s(n,e),className:`mt-px`}):null]}),(0,X.jsxs)(`div`,{"data-slot":`mobile-task-meta`,className:`mt-4 grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-3 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:Kn(n)}),r===null?n.diffStat?(0,X.jsx)(wm,{stat:n.diffStat}):(0,X.jsx)(NE,{}):(0,X.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,r,` in queue`]}),(0,X.jsx)(`span`,{children:_i(n.startedAt??n.createdAt,i)})]}),m?(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsx)(ch,{run:n,reference:m})}):null,e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsx)(qT,{runId:n.id,status:d.label,error:n.error,open:(0,X.jsx)(U,{asChild:!0,variant:`outline`,className:`min-h-11`,children:(0,X.jsxs)(G,{"data-task-control":`open`,to:p,children:[`Open task`,(0,X.jsxs)(`span`,{className:`sr-only`,children:[`: `,K(n)]})]})})})}),(0,X.jsx)(ME,{run:n,showTokens:a,showCost:o})]}):null]})});function ME({run:e,showTokens:t,showCost:n}){let r=Mn(e,Dn(e.id));return(0,X.jsxs)(`dl`,{id:`mobile-resources-${e.id}`,className:`mt-3 grid grid-cols-2 gap-3 rounded-md bg-muted p-3 text-xs`,children:[e.branch?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Branch`}),(0,X.jsx)(`dd`,{children:e.branch})]}):null,(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`CPU`}),(0,X.jsx)(`dd`,{children:r.cpu.text||`—`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Memory`}),(0,X.jsx)(`dd`,{children:r.mem.text||`—`})]}),t?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`IN / OUT`}),(0,X.jsx)(`dd`,{children:(0,X.jsx)(CT,{inputTokens:e.inputTokens,outputTokens:e.outputTokens})})]}):null,n?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Cost`}),(0,X.jsx)(`dd`,{children:Hn(e.costUsd)||`—`})]}):null]})}function NE(){return(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function PE({branch:e}){return(0,X.jsx)(`span`,{title:e,className:`block truncate rounded-[6px] bg-muted px-1.5 py-0.5 font-mono text-[11px] font-medium text-muted-foreground`,children:e})}function FE(){let e=ln(),t=QT(St().data),n=kf(),{view:r,setView:i,origin:a,setOrigin:o,urlQuery:s,writeQuery:c}=LE(),l=Lt(),u=F(),d=BE(e.data,r),f=qt({mutationFn:e=>ye(Zt(),void 0,e),onSuccess:()=>l.invalidateAfter(`runs`,()=>Zt()),onError:e=>V(e.message,{tone:`danger`})}),p=qt({mutationFn:e=>M(e),onSuccess:()=>u.invalidateQueries({queryKey:on.runs.all}),onError:e=>V(e.message,{tone:`danger`})}),h=qt({mutationFn:({id:e,title:t})=>m(e,{title:t}),onSuccess:()=>u.invalidateQueries({queryKey:on.runs.all}),onError:e=>V(e.message,{tone:`danger`})}),g=dn(),_=Nh(3e4),v=eE(),y=It(),b=kt(void 0,{retryOnMount:!1}),x=tn({retryOnMount:!1}).data?.projects?.find(e=>e.id===y)?.name,S=[...e.data??[],...d.pages?.runs??[]].some(e=>e.automationId!==void 0),C=Ht([void 0],n&&S),w=Y.useCallback(e=>C(void 0,e),[C]),T=Y.useMemo(()=>y===void 0?[]:(e.data??[]).flatMap(e=>{let t=Ln(e);return t?[{projectId:y,kind:t.kind,number:t.number}]:[]}),[e.data,y]),E=Y.useCallback((e,t)=>h.mutate({id:e,title:t}),[h.mutate]),D=Y.useCallback((e,t)=>g.mutate({id:e.id,pinned:t}),[g.mutate]);return(0,X.jsx)(Ci,{projectId:y,repoBase:b,requests:T,children:(0,X.jsx)(nE,{runs:e.data,projectName:x,error:e.error?.message,onRetry:()=>void e.refetch(),view:r,onViewChange:i,origin:a,onOriginChange:o,automations:n,urlQuery:s,onQueryChange:c,foldScope:`project:${y??`default`}`,automationName:w,onArchiveFinished:e=>{f.isPending||f.mutate(e)},archivePending:f.isPending,onMarkAllRead:e=>p.mutate(e),onRename:E,onTogglePin:D,now:_,showTokens:t.tokens,showCost:t.cost,expandedColumns:v.expandedColumns,onToggleColumn:v.toggleColumn,columnsPending:v.isPending,archivedPages:d.pages,archivedTotal:d.total,onArchivedSearch:d.search})})}function IE(e,t){return n=>(t===null?n.delete(e):n.set(e,t),n)}function LE(){let[e,t]=iC(),n=e.get(`archived`)===`1`?`archived`:`active`,r=OT(e.get(`origin`)),[i,a]=Y.useState(n),[o,s]=Y.useState(r);Y.useEffect(()=>a(n),[n]),Y.useEffect(()=>s(r),[r]);let c=e.get(`q`)??``,l=Y.useRef(void 0);return Y.useEffect(()=>{let e=l;return()=>clearTimeout(e.current)},[]),{view:i,setView:e=>{a(e),t(IE(`archived`,e===`archived`?`1`:null))},origin:o,setOrigin:e=>{s(e),t(IE(`origin`,e===`all`?null:e))},urlQuery:c,writeQuery:Y.useCallback((e,n)=>{clearTimeout(l.current);let r=e.trim();l.current=setTimeout(()=>t(e=>{let t=e.get(`q`),i=IE(`q`,r===``?null:r)(e);return i.get(`q`)!==t&&n(r),i}),RE)},[t])}}var RE=250,zE=150;function BE(e,t){Lt();let n=F(),[r,i]=Y.useState(``),[a,o]=Y.useState(``);Y.useEffect(()=>{let e=setTimeout(()=>o(r),zE);return()=>clearTimeout(e)},[r]);let s=e!==void 0&&Qa(e).archived>=200,{data:c,isError:l,isPlaceholderData:u,hasNextPage:d,isFetchingNextPage:f,fetchNextPage:p,refetch:m}=an(a,t===`archived`&&(a!==``||s)),h=c?.pages,g=Y.useMemo(()=>h||l?{runs:(h??[]).flatMap(e=>e.runs),query:u?null:a,hasMore:d,loading:f,onLoadMore:()=>void(h?p():m()),failed:l}:void 0,[h,l,u,a,d,f,p,m]),_=a===``?h:n.getQueryData(on.runs.archived(``))?.pages,v=_===void 0?void 0:_.at(-1)?.nextCursor!=null;return{pages:Y.useMemo(()=>g&&{...g,plainHasMore:v},[g,v]),total:_?.[0]?.total,search:i}}function VE({projects:e,perProjectLimit:t}){return e.length===0?null:(0,X.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-[11px] text-soft-foreground`,children:[`Showing every active task and the newest `,t,` archived tasks per project — older archived tasks in`,` `,e.join(`, `),` are in that project’s own Tasks page.`]})}function HE({registry:e}){return e.length<=1?null:(0,X.jsxs)(`section`,{"data-slot":`other-projects`,className:`rounded-lg border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Other projects`}),(0,X.jsx)(`div`,{className:`mt-3 flex flex-col divide-y divide-border`,children:e.map(e=>(0,X.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate text-[13px]`,children:e.name}),(0,X.jsxs)(z,{to:Ea(e.id,`/`),className:`inline-flex min-h-11 shrink-0 items-center rounded-md px-3 text-xs text-accent-text hover:bg-accent-strong/10`,children:[`View tasks`,(0,X.jsxs)(`span`,{className:`sr-only`,children:[` for `,e.name]})]})]},e.id))})]})}function UE({view:e,filtered:t}){return t?(0,X.jsx)(ko,{heading:`h2`,icon:(0,X.jsx)(Oi,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,X.jsx)(ko,{heading:`h2`,icon:(0,X.jsx)(Rr,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,X.jsx)(ko,{heading:`h2`,icon:(0,X.jsx)(Cs,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}function WE({groupBy:e,filterDetailsOpen:t,message:n,onRetry:r}){return(0,X.jsx)(`div`,{"data-route":`global-tasks`,"data-presentation":e===`none`?`summary`:`cards`,"data-filter-details":t,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:(0,X.jsx)(ko,{icon:(0,X.jsx)(Gr,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:n,actions:(0,X.jsx)(U,{variant:`outline`,onClick:r,children:`Retry`})})})}function GE({slot:e,label:t,options:n,selected:r,onToggle:i,onClear:a,searchPlaceholder:o,emptyLabel:s=`Nothing to filter by`}){let[l,u]=Y.useState(!1),d=r.length>0,f=r.length===1?n.find(e=>e.value===r[0])?.label??r[0]:`${r.length} selected`;return(0,X.jsxs)(ga,{open:l,onOpenChange:u,children:[(0,X.jsx)(fa,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`facet-${e}`,"data-active":d?`true`:void 0,"aria-label":`Filter by ${t.toLowerCase()}`,className:c(`inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,d&&`border-accent-strong/40 bg-accent-strong/10 text-foreground`),children:[(0,X.jsx)(`span`,{className:c(d&&`text-soft-foreground`),children:t}),d?(0,X.jsx)(`span`,{className:`max-w-[140px] truncate font-semibold`,children:f}):null,(0,X.jsx)(Xr,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,X.jsxs)(ha,{align:`start`,className:`w-64 p-0`,"data-testid":`facet-${e}-menu`,children:[(0,X.jsxs)(fo,{children:[(0,X.jsx)(io,{placeholder:o??`Search ${t.toLowerCase()}…`}),(0,X.jsxs)(uo,{children:[(0,X.jsx)(lo,{children:s}),(0,X.jsx)(J,{children:n.map(e=>{let t=r.includes(e.value);return(0,X.jsxs)(co,{value:e.label,onSelect:()=>i(e.value),"data-slot":`facet-option`,"data-value":e.value,"aria-checked":t,role:`option`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:c(`flex size-4 shrink-0 items-center justify-center rounded-[4px] border`,t?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-input`),children:t?(0,X.jsx)(Jr,{className:`size-3`}):null}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.count===void 0?null:(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:e.count})]},e.value)})})]})]}),d?(0,X.jsx)(`div`,{className:`border-t border-border p-1`,children:(0,X.jsxs)(`button`,{type:`button`,"data-action":`facet-${e}-clear`,onClick:()=>a(),className:`w-full rounded-sm px-2 py-1.5 text-left text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[`Clear `,t.toLowerCase()]})}):null]})]})}function KE({label:e,count:t,selected:n,onToggle:r,slot:i,tone:a=`neutral`}){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":i,"data-selected":n?`true`:void 0,"aria-pressed":n,onClick:r,className:c(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-xs font-medium transition-colors`,a===`tag`?`border-accent-strong/25 bg-accent-strong/10 text-accent-text hover:bg-accent-strong/20`:`border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground`,n&&`border-accent-strong bg-accent-strong text-accent-strong-foreground hover:bg-accent-strong`),children:[e,t===void 0?null:(0,X.jsx)(`span`,{className:c(`font-mono text-[11px] tabular-nums`,!n&&`text-soft-foreground`),children:t})]})}function qE({slot:e,label:t,value:n,options:r,onChange:i,size:a=`compact`}){return(0,X.jsx)(`div`,{"data-slot":e,role:`group`,"aria-label":t,className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:r.map(e=>{let t=e.value===n;return(0,X.jsx)(`button`,{type:`button`,"data-value":e.value,"aria-pressed":t,disabled:e.disabled,title:e.title,onClick:()=>i(e.value),className:c(`flex h-6 items-center justify-center rounded-[6px] px-2.5 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,a===`touch`&&`h-11 px-4 text-[13px]`,t&&`bg-card font-semibold text-foreground shadow-xs`),children:e.label},e.value)})})}var JE=` untagged`,YE=[{value:`project`,label:`Project`},{value:`tag`,label:`Tag`},{value:`status`,label:`Status`},{value:`workflow`,label:`Workflow`}];function XE(e,t){return e===t?`none`:t}var ZE={query:``,tags:[],statuses:[],workflows:[]};function QE(e,t){let{origin:n,...r}=e;return t===`all`?r:{...r,origin:t}}function $E(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function eD(e){return(e.projects?.length??0)+e.tags.length+e.statuses.length+e.workflows.length+(e.origin===void 0||e.origin===`all`?0:1)}function tD(e){return e.query.trim()!==``||eD(e)>0}function nD(e){return eD(e.filters)+(e.filters.query.trim()===``?0:1)+(e.groupBy===`none`?0:1)}function rD(e){return nD(e)>0}function iD(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.filter(e=>!Ya(e)).map(e=>{let t=n.get(e.projectId);return{run:e,project:t,projectName:t?.name||e.projectId,tags:t?.tags??[]}})}function aD(e){let t=new Set;for(let n of e)t.add(n.run.workflow);return[...t].sort((e,t)=>e.localeCompare(t))}function oD(e){let t=new Set;for(let n of e)t.add(n.run.status);return[...t].sort((e,t)=>e.localeCompare(t))}function sD(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 cD=e=>e.tags.length===0?[JE]:e.tags,lD=(e,t)=>e.length===0||t.some(t=>e.includes(t)),uD=(e,t)=>{if(t.length===0)return!0;let n=cD(e).map(e=>e.toLowerCase());return t.some(e=>n.includes(e.toLowerCase()))};function dD(e,t){return{displayTitle:K(e.run),projectName:e.projectName,tags:e.tags,automation:e.run.automationId===void 0?void 0:t(e)??e.run.automationId,references:()=>zn(e.run)}}function fD(e,t,n,r=()=>void 0){let i=t.query.trim()!==``;return e.filter(e=>(n===`archived`?!e.run.archived:e.run.archived)||!kT(e.run,t.origin??`all`)||!lD(t.projects??[],[e.run.projectId])||!lD(t.statuses,[e.run.status])||!lD(t.workflows,[e.run.workflow])||!uD(e,t.tags)?!1:!i||qn(e.run,t.query,{scope:`shown`,extras:dD(e,r)}))}function pD(e,t,n,r,i){return fD(e,r===`origin`?{...t,origin:`all`}:{...t,[r]:[]},n,i)}function mD(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(JE,`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 hD(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var $={query:`q`,project:`project`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,archived:`archived`,origin:`origin`},gD=new Set(YE.map(e=>e.value));function _D(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set($.query,n);for(let n of e.filters.tags)n===` untagged`?t.set($.untagged,`1`):t.append($.tag,n);for(let n of e.filters.projects??[])t.append($.project,n);for(let n of e.filters.statuses)t.append($.status,n);for(let n of e.filters.workflows)t.append($.workflow,n);return e.groupBy!==`none`&&t.set($.groupBy,e.groupBy),e.view===`archived`&&t.set($.archived,`1`),e.filters.origin!==void 0&&e.filters.origin!==`all`&&t.set($.origin,e.filters.origin),t}function vD(e,t){let n=e.getAll($.tag).filter(e=>e!==``);e.get($.untagged)===`1`&&n.push(JE);let r=e.get($.groupBy)??``,i=DT(OT(e.get($.origin)),t);return{filters:{query:e.get($.query)??``,...e.has($.project)?{projects:e.getAll($.project).filter(Boolean)}:{},tags:n,statuses:e.getAll($.status).filter(e=>e!==``),workflows:e.getAll($.workflow).filter(e=>e!==``),...i===`all`?{}:{origin:i}},groupBy:gD.has(r)?r:`none`,view:e.get($.archived)===`1`?`archived`:`active`}}var yD=15e3,bD=250,xD=1,SD=new Set([`done`,`failed`,`cancelled`]);function CD(){return TD({request:({task:e,archived:t})=>Re(rn(e.run.id,{projectId:e.run.projectId}),t),patch:({archived:e})=>t=>({...t,archived:e})})}function wD(){return TD({request:({task:e,read:t})=>ze(rn(e.run.id,{projectId:e.run.projectId}),t),patch:({read:e})=>t=>{if(e)return{...t,seenAt:new Date().toISOString()};let{seenAt:n,...r}=t;return r}})}function TD({request:e,patch:t}){let n=Lt();return qt({mutationFn:e,onMutate:e=>n.patchIndex(rn(e.task.run.id,{projectId:e.task.run.projectId}),()=>t(e)),onError:(e,t,n)=>{n?.rollback(),V(e.message,{tone:`danger`})},onSettled:(e,t,{task:r},i)=>{i?i.settle():n.invalidateAfter(`indexed`,rn(r.run.id,{projectId:r.run.projectId}))}})}function ED(){let{expandedRuns:e,toggleExpandedRun:t}=nw(),n=tn(),r=QT(St().data),i=un(!0,yD),[a,o]=iC(),s=kf(),{filters:c,groupBy:l,view:u}=Y.useMemo(()=>vD(a,s),[a,s]),d=Nh(3e4),f=e=>o(t=>{let n=_D(e(vD(t,!0))),r=t.get(`tasks`);return(r===`flat`||r===`virtual`)&&n.set(`tasks`,r),n}),p=e=>f(t=>({...t,filters:e(t.filters)})),m=e=>f(t=>({...t,groupBy:e})),h=e=>f(t=>({...t,view:e})),[g,_]=Y.useState(l!==`none`||c.tags.length>0),[v,y]=kD(c.query,e=>p(t=>({...t,query:e}))),b=i.data?.referenceStatuses;Y.useEffect(()=>{b&&Xt(b)},[b]);let x=Y.useMemo(()=>n.data?.projects??[],[n.data]),S=Y.useMemo(()=>i.data?.runs??[],[i.data]),C=Y.useMemo(()=>iD(S,x),[S,x]),{nameOf:w,visible:T,originTotals:E,statusGroups:D,folds:O}=AD({tasks:C,filters:c,view:u,groupBy:l,index:S,automationsOn:s}),k=Y.useMemo(()=>mD(T,l),[T,l]),A=c.origin??`all`,j=e=>p(t=>QE(t,e)),M=Y.useMemo(()=>T.flatMap(e=>In(e.run,e.project?.repoUrl).filter(t=>Nn(t,e.project?.repoUrl)).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[T]),ee=hD(i.data?.truncated??[],x),te=(e,t)=>p(n=>({...n,[e]:$E(n[e]??[],t)})),ne=e=>p(t=>({...t,[e]:[]})),re=CD(),ie=wD(),N=Y.useCallback((e,t)=>re.mutate({task:e,archived:t}),[re.mutate]),P=Y.useCallback((e,t)=>ie.mutate({task:e,read:t}),[ie.mutate]),ae=i.error??n.error;if(ae)return(0,X.jsx)(WE,{groupBy:l,filterDetailsOpen:g,message:ae.message,onRetry:()=>{i.refetch(),n.refetch()}});let oe=(0,X.jsxs)(`div`,{className:`relative w-full`,children:[(0,X.jsx)(hr,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-soft-foreground`,"aria-hidden":`true`}),(0,X.jsx)(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`Search every project…`,"aria-label":`Search tasks across projects`,className:`h-11 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]});return(0,X.jsxs)(gT,{layout:l,revision:k,visibilityRevision:JSON.stringify([$a.map(O.isCollapsed),[...e].sort(),u,g]),"data-route":`global-tasks`,"data-presentation":l===`none`?`summary`:`cards`,"data-filter-details":g,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:[(0,X.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-[22px]`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`All tasks`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:l===`none`?`Every project. One place to review what your agents have shipped.`:`Filter across projects and act on each run without opening the session.`})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-6 border-b border-border`,children:[(0,X.jsx)(jD,{view:`active`,current:u,onSelect:h,children:`Active`}),(0,X.jsx)(jD,{view:`archived`,current:u,onSelect:h,children:`Archived`}),(0,X.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`ml-auto text-[13px] text-soft-foreground tabular-nums`,children:[T.length,` of `,C.length,ee.length>0?` loaded`:``]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,X.jsx)(`div`,{className:`min-w-0 basis-full md:flex-1 md:basis-auto`,children:oe}),(0,X.jsxs)(U,{variant:`outline`,"aria-expanded":g,onClick:()=>_(e=>!e),children:[(0,X.jsx)(br,{"aria-hidden":`true`}),`Filters`]}),(0,X.jsx)(U,{asChild:!0,className:`min-h-11`,children:(0,X.jsxs)(z,{to:Ea(n.data?.bootProject??`default`,`/new`),children:[(0,X.jsx)(ar,{"aria-hidden":`true`}),`New task`]})})]}),(0,X.jsx)(UT,{origin:A,counts:E,automations:s,onChange:j,labels:D.map(e=>e.label),onSetAll:O.setAll})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[22px]`,children:[(0,X.jsx)(MD,{filters:c,onToggle:te,onClearFacet:ne,onClearAll:()=>{y(``),f(e=>({...e,filters:ZE,groupBy:`none`}))},groupBy:l,onGroupByChange:m,projects:x,tasks:C,view:u,automationName:w}),(0,X.jsx)(VE,{projects:ee,perProjectLimit:i.data?.perProjectLimit}),i.data===void 0?(0,X.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading tasks…`}):(0,X.jsx)(DD,{view:u,filtered:tD(c),visibleCount:T.length,referenceRequests:M,lists:{groupBy:l,view:u,statusGroups:D,groups:k,folds:O,row:{now:d,onArchive:N,expandedRuns:e,toggleExpandedRun:t,onSetRead:P,busy:re.isPending||ie.isPending,showCost:r.cost,automationName:w}}}),(0,X.jsx)(HE,{registry:x})]})]})}function DD({view:e,filtered:t,visibleCount:n,referenceRequests:r,lists:i}){return n===0?(0,X.jsx)(UE,{view:e,filtered:t}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ci,{requests:r,children:(0,X.jsx)(OD,{...i})}),i.groupBy===`none`?(0,X.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Resource details—including tokens, cost, CPU and peak memory—are available when a task row is expanded.`}):null]})}function OD({groupBy:e,view:t,statusGroups:n,groups:r,folds:i,row:a}){return(0,X.jsx)(X.Fragment,{children:e===`none`?n.map(e=>{let n=NT(e);return(0,X.jsx)(GT,{id:`global-group-${t}-${e.label.replaceAll(` `,`-`)}`,label:e.label,count:n.length,tone:PT(e.label,n.map(e=>e.run)),folded:i.isFolded(e.label),collapsed:i.isCollapsed(e.label),onToggle:()=>i.toggle(e.label),children:(0,X.jsx)(ND,{summary:!0,tasks:e.rows.flatMap(RT),showProject:!0,...a})},e.label)}):r.map(t=>(0,X.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":t.key,children:[(0,X.jsxs)(`h2`,{className:`mb-1.5 flex items-center gap-2 text-[12px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:[e===`project`?(0,X.jsx)(z,{to:Ea(t.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:t.label}):t.label,(0,X.jsx)(`span`,{className:`font-mono text-[11px] font-medium tabular-nums`,children:t.tasks.length})]}),(0,X.jsx)(ND,{tasks:t.tasks,showProject:e!==`project`,...a})]},t.key))})}function kD(e,t){let[n,r]=Y.useState(e),i=Y.useRef(e);return Y.useEffect(()=>{e!==i.current&&r(e),i.current=e},[e]),Y.useEffect(()=>{if(n===i.current)return;let e=setTimeout(()=>{i.current=n,t(n)},bD);return()=>clearTimeout(e)},[n]),[n,r]}function AD({tasks:e,filters:t,view:n,groupBy:r,index:i,automationsOn:a}){let o=Y.useMemo(()=>[...new Set(e.filter(e=>e.run.automationId!==void 0).map(e=>e.run.projectId))],[e]),s=Ht(o,a&&o.length>0),c=Y.useCallback(e=>e.run.automationId===void 0?void 0:s(e.run.projectId,e.run.automationId),[s]),l=Y.useMemo(()=>fD(e,t,n,c),[e,t,n,c]),u=jT(pD(e,t,n,`origin`,c).map(e=>e.run),n),d=r===`none`?LT(l,n,i):[];return{nameOf:c,visible:l,originTotals:u,statusGroups:d,folds:XT(`global`,n,new Set(t.query.trim()===``?[]:d.map(e=>e.label)))}}function jD({view:e,current:t,onSelect:n,children:r}){let i=e===t;return(0,X.jsx)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":i,onClick:()=>n(e),className:c(`flex min-h-11 items-center justify-center border-b-2 border-transparent text-[13px] font-medium text-muted-foreground`,i&&`border-accent-strong font-semibold text-accent-text`),children:r})}function MD({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,projects:o,tasks:s,view:c,automationName:l}){let u=Y.useMemo(()=>mt(o),[o]),d=Y.useMemo(()=>{let t=(t,n)=>sD(pD(s,e,c,t,l),n);return{projects:t(`projects`,e=>[e.run.projectId]),tags:t(`tags`,cD),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[s,e,c,l]),f=e=>t=>({...t,count:e.get(t.value)??0});return(0,X.jsxs)(`div`,{"data-slot":`global-tasks-filters`,className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(GE,{slot:`project`,label:`Project`,selected:e.projects??[],onToggle:e=>t(`projects`,e),onClear:()=>n(`projects`),options:[...new Map(s.map(e=>[e.run.projectId,e.projectName])).entries()].map(([e,t])=>({value:e,label:t})).map(f(d.projects)),emptyLabel:`No tasks to filter`}),(0,X.jsx)(GE,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:oD(s).map(e=>({value:e,label:e})).map(f(d.statuses)),emptyLabel:`No tasks to filter`}),(0,X.jsx)(GE,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:aD(s).map(e=>({value:e,label:e})).map(f(d.workflows)),emptyLabel:`No tasks to filter`}),(0,X.jsxs)(`div`,{"data-slot":`group-controls`,className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Group by`}),(0,X.jsx)(qE,{slot:`group-by`,label:`Group tasks by`,value:i,options:YE,onChange:e=>a(XE(i,e))})]}),rD({filters:e,groupBy:i})?(0,X.jsxs)(`button`,{type:`button`,"data-action":`clear-filters`,onClick:r,className:`ml-auto inline-flex h-7 items-center gap-1 rounded-full px-2 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,X.jsx)(xr,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${nD({filters:e,groupBy:i})})`]}):null]}),u.length>0?(0,X.jsxs)(`div`,{"data-slot":`tag-filters`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Tags`}),u.map(n=>(0,X.jsx)(KE,{slot:`tag-filter`,tone:`tag`,label:n,count:d.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,X.jsx)(KE,{slot:`tag-filter`,label:`Untagged`,count:d.tags.get(` untagged`)??0,selected:e.tags.includes(JE),onToggle:()=>t(`tags`,JE)})]}):(0,X.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-[11px] text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,X.jsx)(z,{to:`/settings/global/projects`,className:`font-medium text-accent-text hover:underline`,children:wi(`projects`)}),` `,`to group their tasks together here.`]})]})}function ND({summary:e=!1,expandedRuns:t,toggleExpandedRun:n,tasks:r,now:i,showProject:a,onArchive:o,onSetRead:s,busy:c,showCost:l,automationName:u}){let d=pw(r.map(e=>`${e.run.projectId}/${e.run.id}`),t),f=Oh();return(0,X.jsxs)(`div`,{role:e?`table`:void 0,"aria-rowcount":e?d.rowCount:void 0,"data-slot":`global-tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card p-5`,children:[(0,X.jsx)(`div`,{"data-slot":`global-summary-head`,className:`text-[12px]`,role:`row`,"aria-rowindex":1,children:[`Task`,`Workflow`,`Changes`,`Pull request`,`Started`].map(e=>(0,X.jsx)(`span`,{role:`columnheader`,children:e},e))}),(0,X.jsx)(Qu,{children:(0,X.jsx)(hT,{...e?{itemSize:f?115:218}:{},items:r,itemKey:e=>`${e.run.projectId}/${e.run.id}`,children:(r,f)=>(0,X.jsx)(PD,{task:r,summary:e,rowIndex:d.indexes[f],resourcesOpen:t.has(`${r.run.projectId}/${r.run.id}`),toggleExpandedRun:n,now:i,showProject:a,onArchive:o,onSetRead:s,busy:c,showCost:l,automationName:u(r)},`${r.run.projectId}/${r.run.id}`)})})]})}var PD=Y.memo(function({rowIndex:e,resourcesOpen:t,toggleExpandedRun:n,summary:r,task:i,now:a,showProject:o,onArchive:s,onSetRead:c,busy:l,showCost:u,automationName:d}){let f=r?`row`:void 0,p=r?`cell`:void 0,{run:m}=i,h=Ne(m),g=Ea(m.projectId,`/tasks/${m.id}`),_=In(m,i.project?.repoUrl),v=Mn(m,m.usage);return(0,X.jsxs)(`article`,{role:r?`rowgroup`:void 0,"data-status":m.status,"data-expanded":t,"data-slot":`global-task-row`,"data-run-id":m.id,"data-project":m.projectId,className:`hover:bg-muted max-md:flex max-md:flex-wrap max-md:items-center max-md:gap-x-3 max-md:gap-y-2 max-md:border-b max-md:border-border max-md:py-5 `,children:[(0,X.jsxs)(`div`,{"data-slot":`global-task-cells`,className:`contents`,role:f,"aria-rowindex":r?e:void 0,children:[(0,X.jsx)(FD,{summary:r,task:i,showProject:o,automationName:d,resourcesOpen:t,toggleExpandedRun:n}),(0,X.jsx)(`div`,{role:p,"data-slot":`global-task-workflow`,className:`text-[13px] text-muted-foreground`,children:m.workflow}),(0,X.jsx)(`div`,{role:p,"data-slot":`global-task-diff`,className:`text-xs text-muted-foreground`,children:(0,X.jsx)(`span`,{title:`Change totals are available in the project task list`,children:`—`})}),(0,X.jsx)(`div`,{role:p,"data-slot":`global-task-references`,children:_.length>0?(0,X.jsx)(RD,{references:_,run:m,repoBase:i.project?.repoUrl}):(0,X.jsx)(BD,{})}),(0,X.jsx)(`div`,{role:p,"data-slot":`global-task-age`,className:`text-right text-xs text-soft-foreground tabular-nums`,children:_i(m.startedAt??m.createdAt,a)})]}),!r||t?(0,X.jsx)(`div`,{className:`contents`,role:f,"aria-rowindex":r?e+1:void 0,children:(0,X.jsxs)(`div`,{"data-slot":`global-task-detail-cell`,role:p,"aria-colspan":r?5:void 0,className:r?`col-span-full flex flex-col gap-3`:`contents`,children:[(0,X.jsx)(`div`,{"data-slot":`global-task-actions`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,X.jsx)(ID,{task:i,busy:l,onSetRead:c}),(0,X.jsx)(LD,{task:i,busy:l,onArchive:s}),(0,X.jsx)(U,{asChild:!0,variant:`outline`,children:(0,X.jsx)(z,{to:g,children:`Open task`})})]})}),t?(0,X.jsxs)(`div`,{"data-slot":`global-task-resources`,className:`col-span-full flex flex-col gap-3`,children:[(0,X.jsx)(qT,{projectId:m.projectId,runId:m.id,status:h.label,error:m.error,open:(0,X.jsx)(U,{asChild:!0,variant:`outline`,className:`min-h-11`,children:(0,X.jsxs)(z,{to:g,children:[`Open task`,(0,X.jsxs)(`span`,{className:`sr-only`,children:[`: `,K(m)]})]})})}),(0,X.jsxs)(`dl`,{className:`grid grid-cols-2 gap-4 rounded-md bg-muted/50 p-4 text-xs md:grid-cols-3`,children:[u?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Cost`}),(0,X.jsx)(`dd`,{className:`mt-1`,children:Hn(m.costUsd)||`—`})]}):null,(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`CPU`}),(0,X.jsx)(`dd`,{"data-usage":`cpu`,"data-usage-kind":v.cpu.kind,title:v.cpu.title,className:`mt-1`,children:v.cpu.text||`—`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Memory`}),(0,X.jsx)(`dd`,{"data-usage":`mem`,"data-usage-kind":v.mem.kind,title:v.mem.title,className:`mt-1`,children:v.mem.text||`—`})]})]})]}):null]})}):null]})},(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.length===i.tags.length&&n.tags.every((e,t)=>e===i.tags[t])&&Object.keys(r).every(e=>r[e]===a[e])});function FD({summary:e,task:t,showProject:n,automationName:r,resourcesOpen:i,toggleExpandedRun:a}){let{run:o}=t,s=Ne(o),l=Ea(o.projectId,`/tasks/${o.id}`),u=no(o),d=jl(o);return(0,X.jsxs)(`div`,{role:e?`cell`:void 0,"data-slot":`global-task-title`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[o.delegation?.role===`worker`?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,X.jsx)(z,{to:l,title:K(o),"data-task-control":`title`,className:c(`min-w-0 truncate text-[14px] md:text-[13px]`,u?`font-semibold text-foreground`:d?`font-medium text-muted-foreground`:`font-medium`),children:K(o)}),u?(0,X.jsx)(q,{tone:Nl(o),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null]}),(0,X.jsx)(`div`,{className:`mt-1`,children:(0,X.jsx)(KT,{automationId:o.automationId,automationName:r,project:n?(0,X.jsx)(z,{to:Ea(o.projectId,`/`),"data-slot":`task-project`,className:`truncate hover:text-foreground`,children:t.projectName}):void 0})}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`button`,{type:`button`,"data-task-control":`resources`,"aria-expanded":i,"aria-label":`${i?`Hide`:`Show`} resources for ${K(o)}`,onClick:()=>a(`${o.projectId}/${o.id}`),"aria-describedby":`global-status-${o.projectId}-${o.id}`,title:`Resources and actions`,className:`min-h-[26px] rounded-md p-0 text-[11px] text-muted-foreground hover:bg-muted`,children:(0,X.jsx)(wT,{id:`global-status-${o.projectId}-${o.id}`,dot:s.tone,shape:s.shape,pulse:s.pulse,children:s.label})}),(0,X.jsx)(`span`,{children:t.tags.length>0?(0,X.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:t.tags.map(e=>(0,X.jsx)(zD,{tag:e},e))}):null})]})]})}function ID({task:e,busy:t,onSetRead:n}){if(!ro(e.run))return null;let r=no(e.run),i=K(e.run),a=r?`Mark ${i} read`:`Mark ${i} unread`,o=r?hi:hs;return(0,X.jsxs)($u,{children:[(0,X.jsx)(ed,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-action":r?`mark-read`:`mark-unread`,"aria-label":a,disabled:t,onClick:()=>n(e,r),className:c(`inline-flex size-11 items-center justify-center md:size-8 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-accent-icon`:`text-soft-foreground`),children:[(0,X.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:r?`Mark read`:`Mark unread`})]})}),(0,X.jsx)(td,{side:`left`,children:r?`Mark read`:`Mark unread`})]})}function LD({task:e,busy:t,onArchive:n}){let r=e.run.archived;if(!r&&!SD.has(e.run.status))return null;let i=r?`Restore ${K(e.run)} to the active list`:`Archive ${K(e.run)}`;return(0,X.jsxs)($u,{children:[(0,X.jsx)(ed,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-action":r?`unarchive-run`:`archive-run`,"aria-label":i,disabled:t,onClick:()=>n(e,!r),className:`inline-flex size-11 items-center justify-center md:size-8 rounded-md text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,children:[(0,X.jsx)(r?rs:Rr,{className:`size-3.5`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{children:r?`Unarchive`:`Archive`})]})}),(0,X.jsx)(td,{side:`left`,children:r?`Restore`:`Archive`})]})}function RD({references:e,run:t,repoBase:n}){return(0,X.jsx)(dh,{references:e,maxVisible:xD,taskTitle:K(t),projectId:t.projectId,runId:t.id,repoBase:n})}function zD({tag:e,className:t}){return(0,X.jsx)(`span`,{"data-slot":`project-tag`,className:c(`inline-flex max-w-full items-center truncate rounded-full bg-muted px-1.5 py-px text-[11px] font-medium text-muted-foreground`,t),children:e})}function BD(){return(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}var VD=(0,Y.lazy)(()=>R(()=>import(`./automations-route-DndFRPQ2.js`).then(e=>({default:e.AutomationsRoute})),__vite__mapDeps([79,1,2,7,8,6,9,10,11,12,13,14,15,16,17,80,81,28,24,18,66,19,23,62,29,48,41,82,40,56,33,83,42]))),HD=(0,Y.lazy)(()=>R(()=>import(`./workspace-tools-CJ8gOVwz.js`).then(e=>({default:e.WorkspaceToolsRoute})),__vite__mapDeps([84,1,2,10,7,8,11,6,9,12,13,14,15,16,17,85,86,87,23,24,30,31,19,32]))),UD=(0,Y.lazy)(()=>R(()=>import(`./settings-shell-DuQAKYA0.js`).then(e=>({default:e.SettingsIndexRoute})),__vite__mapDeps([88,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19,23,24,82,28,29,40,41,25,56,87,42,63,46,47,48,33,49,57,58,31,59,22,60,61,62,37,89]))),WD=(0,Y.lazy)(()=>R(()=>import(`./settings-shell-DuQAKYA0.js`).then(e=>({default:e.SettingsSectionRoute})),__vite__mapDeps([88,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19,23,24,82,28,29,40,41,25,56,87,42,63,46,47,48,33,49,57,58,31,59,22,60,61,62,37,89]))),GD=(0,Y.lazy)(()=>R(()=>import(`./task-thread-BDXHF8cV.js`).then(e=>({default:e.TaskThreadRoute})),__vite__mapDeps([90,1,2,7,8,11,6,9,10,12,13,14,15,16,17,85,86,87,18,19,91,73,58,31,59,22,60,61,23,24,62,28,29,48,41,37,69,70,92,93,47,26,27,56,30,76,77,78,36,83,42,94,95,21,96,72,71,82,33,97,98,99]))),KD=(0,Y.lazy)(()=>R(()=>import(`./task-changes-B-daTy0n.js`).then(e=>({default:e.TaskChangesRoute})),__vite__mapDeps([100,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,91,85,86,87,19,73,58,31,59,22,60,61,23,24,62,28,29,48,41,37,69,70,92,93,47,26,27,56,30,76,77,78,36,83,42,94,95,101,102,96,33,103,104,105,97]))),qD=(0,Y.lazy)(()=>R(()=>import(`./task-files-QGAAGN7K.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([106,1,2,7,8,6,9,10,11,12,13,14,15,16,17,18,19,91,85,86,87,73,58,31,59,22,60,61,23,24,62,28,29,48,41,37,69,70,92,93,47,26,27,56,30,76,77,78,36,83,42,94,95,75,33]))),JD=(0,Y.lazy)(async()=>{let{TaskReportRoute:e}=await R(async()=>{let{TaskReportRoute:e}=await import(`./report-reader-D_SwO-8H.js`);return{TaskReportRoute:e}},__vite__mapDeps([74,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,75,19,33,36,37,76,77,78,23,24]));return{default:e}}),YD=(0,Y.lazy)(()=>R(()=>import(`./task-commits-B8JcUxwa.js`).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([107,1,2,7,8,6,9,10,11,12,13,14,15,16,17,18,91,85,86,87,19,73,58,31,59,22,60,61,23,24,62,28,29,48,41,37,69,70,92,93,47,26,27,56,30,76,77,78,36,83,42,94,95,33,108,102,96,104,105,97]))),XD=(0,Y.lazy)(()=>R(()=>import(`./task-github-item-BUQ-EaXP.js`).then(e=>({default:e.TaskGithubItemRoute})),__vite__mapDeps([109,2,1,7,8,6,9,10,11,12,13,14,15,16,17,85,86,87,18,91,19,73,58,31,59,22,60,61,23,24,62,28,29,48,41,37,69,70,92,93,47,26,27,56,30,76,77,78,36,83,42,94,95,33,110,96,71,51,52,104,105,97,111]))),ZD=(0,Y.lazy)(()=>R(()=>import(`./repo-git-f5cKDC-i.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([112,1,2,7,8,6,9,10,11,12,13,14,15,16,17,85,86,87,18,19,113,102,96,23,24,101,59,61,62,28,29,48,41,69,70,93,47,56,30,31,33,103,104,105,97,108,114]))),QD=(0,Y.lazy)(()=>R(()=>import(`./github-ktVA2Gmk.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([115,1,2,7,8,6,9,10,11,12,13,14,15,16,17,18,67,19,21,113,70,23,24,47,28,29,48,41,56,87,86,30,31,51,27,26,33,110,59,96,92,71,52,76,77,78,36,37,42,104,105,97,94,111]))),$D=(0,Y.lazy)(()=>R(()=>import(`./reports-CyP79G2S.js`).then(e=>({default:e.ReportsRoute})),__vite__mapDeps([116,1,2,7,8,6,9,12,16,17,14,23,24,56,98,117]))),eO=(0,Y.lazy)(()=>R(()=>import(`./workflows-CmaJn4ba.js`).then(e=>({default:e.WorkflowsRoute})),__vite__mapDeps([118,1,2,7,8,6,9,10,11,12,13,14,15,16,17,18,23,24,62,28,29,48,41,26,27,52,33,4,42,119]))),tO=(0,Y.lazy)(()=>R(()=>import(`./activity-route-cdDIR26F.js`).then(e=>({default:e.ProjectActivityRoute})),__vite__mapDeps([120,1,2,7,8,65,19,121,11,6,9,13,16,17,14,31,68,96,92,23,24,56,87,30,122]))),nO=(0,Y.lazy)(()=>R(()=>import(`./global-activity-route-Rx7cgzpu.js`).then(e=>({default:e.GlobalActivityRoute})),__vite__mapDeps([123,1,2,7,8,10,11,6,9,12,13,14,15,16,17,121,19,31,68,96,92,23,24,56,87,30,122,3]))),rO=(0,Y.lazy)(()=>R(()=>import(`./skills-CBHa5_n1.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([124,1,2,7,8,6,9,10,11,12,13,14,15,16,17,18,23,24,56,52])));function iO(){let e=gn();return(0,X.jsx)(ja,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function aO({sectionId:e}){let t=gn();return(0,X.jsx)(yn,{to:{pathname:H_(`global`,e),search:t.search,hash:t.hash},replace:!0})}function oO(){return(0,X.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function sO(){let{projectId:e=``}=vn(),t=gn(),n=tn(),r=St();if(e==="default"){let e=n.data?.bootProject??(n.isError?r.data?.bootProject:void 0);if(e!==void 0){let n=t.pathname.replace(/^\/p\/default(?=\/|$)/,``);return(0,X.jsx)(yn,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,X.jsx)(oO,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,X.jsx)(JS,{projectId:e,registry:n.data})}else if(!n.isError)return(0,X.jsx)(oO,{});return(0,X.jsx)(Le,{projectId:n.data?.bootProject===e?null:e,children:(0,X.jsx)(mn,{},e)})}function cO(){let{projectId:e=``}=vn();return(0,X.jsx)(MS,{},e)}var lO=/^\/tasks\/([0-9a-f-]{36})(?=\/|$)/i;function uO(e,t){let n=e.data?.bootProject??t.data?.bootProject;return{resolved:n,settled:(e.data!==void 0||e.isError)&&(t.data!==void 0||t.isError),boot:n??`default`}}function dO(e,t,n){if(!(e.pathname===`/`&&e.search===``&&e.hash===``))return;if(t.data===void 0&&!t.isError)return(0,X.jsx)(oO,{});let r=Zd(Vd(),t.data,n);if(r!==null)return(0,X.jsx)(yn,{to:r,replace:!0})}function fO(e,t,n,r,i,a){if(!n)return null;let o=i.data?.runs.find(t=>t.id===e)?.projectId;return o===void 0?r?a.data===void 0&&!a.isError?null:a.data?.runs.find(t=>t.id===e)?.projectId??t:t:o}function pO(e,t){let n=t.pathname===`/p`||t.pathname===`/p/`?`/`:t.pathname;return(0,X.jsx)(yn,{to:`/p/${encodeURIComponent(e)}${n}${t.search}${t.hash}`,replace:!0})}function mO(){let e=gn(),t=St(),n=tn(),r=lO.exec(e.pathname)?.[1]??null,i=un(r!==null),a=i.data!==void 0||i.isError,o=i.data!==void 0&&!i.data.runs.some(e=>e.id===r),s=Vt(r!==null&&o?r:``),{resolved:c,settled:l,boot:u}=uO(t,n);if(c===void 0&&!l)return(0,X.jsx)(oO,{});let d=dO(e,n,c);if(d!==void 0)return d;let f=u;if(r!==null){let e=fO(r,u,a,o,i,s);if(e===null)return(0,X.jsx)(oO,{});f=e}return pO(f,e)}function hO(){return(0,X.jsxs)(B,{path:`/p/:projectId`,element:(0,X.jsx)(sO,{}),children:[(0,X.jsx)(B,{index:!0,element:(0,X.jsx)(FE,{})}),(0,X.jsx)(B,{path:`new`,element:(0,X.jsx)(cO,{})}),(0,X.jsx)(B,{path:`activity`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Dv,{}),children:(0,X.jsx)(tO,{})})}),(0,X.jsxs)(B,{path:`tasks/:id`,element:(0,X.jsx)(ew,{}),children:[(0,X.jsx)(B,{index:!0,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(eC,{}),children:(0,X.jsx)(GD,{})})}),(0,X.jsx)(B,{path:`changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(XS,{tab:`changes`}),children:(0,X.jsx)(KD,{})})}),(0,X.jsx)(B,{path:`files`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(XS,{tab:`files`}),children:(0,X.jsx)(qD,{})})}),(0,X.jsx)(B,{path:`report`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`div`,{"data-route":`task-report`,children:(0,X.jsx)(`h1`,{className:`p-4 text-sm text-soft-foreground`,children:`Loading report…`})}),children:(0,X.jsx)(JD,{})})}),(0,X.jsx)(B,{path:`commits`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(XS,{tab:`changes`}),children:(0,X.jsx)(YD,{})})}),(0,X.jsx)(B,{path:`commits/:sha`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(XS,{tab:`changes`}),children:(0,X.jsx)(YD,{})})}),(0,X.jsx)(B,{path:`issue/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)($S,{kind:`issue`}),children:(0,X.jsx)(XD,{kind:`issue`})})}),(0,X.jsx)(B,{path:`pr/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)($S,{kind:`pr`}),children:(0,X.jsx)(XD,{kind:`pr`})})})]}),(0,X.jsx)(B,{path:`git`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KS,{}),children:(0,X.jsx)(ZD,{section:`main`,index:!0})})}),(0,X.jsx)(B,{path:`git/commits`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KS,{}),children:(0,X.jsx)(ZD,{section:`main`})})}),(0,X.jsx)(B,{path:`git/commits/:sha`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KS,{}),children:(0,X.jsx)(ZD,{section:`main`})})}),(0,X.jsx)(B,{path:`git/not-landed`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KS,{}),children:(0,X.jsx)(ZD,{section:`not-landed`})})}),(0,X.jsx)(B,{path:`git/cleanup`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KS,{}),children:(0,X.jsx)(ZD,{section:`cleanup`})})}),(0,X.jsx)(B,{path:`git/branches`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KS,{}),children:(0,X.jsx)(ZD,{section:`branches`})})}),(0,X.jsx)(B,{path:`git/changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(KS,{}),children:(0,X.jsx)(ZD,{section:`changes`})})}),(0,X.jsx)(B,{path:`github`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ov,{}),children:(0,X.jsx)(QD,{view:`issues`,index:!0})})}),(0,X.jsx)(B,{path:`github/prs`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ov,{}),children:(0,X.jsx)(QD,{view:`prs`})})}),(0,X.jsx)(B,{path:`github/issues/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ov,{}),children:(0,X.jsx)(QD,{view:`issues`})})}),(0,X.jsx)(B,{path:`github/prs/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ov,{}),children:(0,X.jsx)(QD,{view:`prs`})})}),(0,X.jsx)(B,{path:`github/prs/:n/changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ov,{}),children:(0,X.jsx)(QD,{view:`prs`,changes:!0})})}),(0,X.jsx)(B,{path:`automations`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading automations…`}),children:(0,X.jsx)(VD,{})})}),(0,X.jsx)(B,{path:`automations/new`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading automations…`}),children:(0,X.jsx)(VD,{mode:`new`})})}),(0,X.jsx)(B,{path:`automations/:automationId`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading automations…`}),children:(0,X.jsx)(VD,{mode:`edit`})})}),(0,X.jsx)(B,{path:`automations/:automationId/log`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading automations…`}),children:(0,X.jsx)(VD,{mode:`log`})})}),(0,X.jsx)(B,{path:`skills`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(qS,{}),children:(0,X.jsx)(rO,{})})}),(0,X.jsx)(B,{path:`reports`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading reports…`}),children:(0,X.jsx)($D,{})})}),(0,X.jsx)(B,{path:`workflows`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(YS,{}),children:(0,X.jsx)(eO,{})})}),(0,X.jsx)(B,{path:`workflows/:name`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(YS,{}),children:(0,X.jsx)(eO,{})})}),(0,X.jsx)(B,{path:`settings`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading settings…`}),children:(0,X.jsx)(UD,{})})}),(0,X.jsx)(B,{path:`settings/skills`,element:(0,X.jsx)(iO,{})}),V_(`project`).map(e=>(0,X.jsx)(B,{path:`settings/${e.id}`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading settings…`}),children:(0,X.jsx)(WD,{section:e,scope:`project`})})},e.id)),V_(`global`).map(e=>(0,X.jsx)(B,{path:`settings/${e.id}`,element:(0,X.jsx)(aO,{sectionId:e.id})},e.id)),(0,X.jsx)(B,{path:`*`,element:(0,X.jsx)(WS,{})})]})}function gO(e){let t=En(hn(hO()),e),n=t?.at(-1);return!t||!n||n.route.path===`*`?null:{pattern:`/${t.slice(1).map(e=>e.route.path).filter(e=>e!==void 0).join(`/`)}`.replace(/\/$/,``)||`/`,params:n.params}}function _O(){return(0,X.jsxs)(wn,{children:[hO(),(0,X.jsx)(B,{path:`/tasks`,element:(0,X.jsx)(ED,{})}),(0,X.jsx)(B,{path:`/tools`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading workspace tools…`}),children:(0,X.jsx)(HD,{})})}),(0,X.jsx)(B,{path:`/activity`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Dv,{}),children:(0,X.jsx)(nO,{})})}),(0,X.jsx)(B,{path:`/settings/global`,element:(0,X.jsx)(yn,{to:U_,replace:!0})}),(0,X.jsx)(B,{path:`/settings/global/skills`,element:(0,X.jsx)(yn,{to:`/skills`,replace:!0})}),V_(`global`).map(e=>(0,X.jsx)(B,{path:H_(`global`,e.id),element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`p`,{role:`status`,children:`Loading settings…`}),children:(0,X.jsx)(WD,{section:e,scope:`global`})})},e.id)),(0,X.jsx)(B,{path:`*`,element:(0,X.jsx)(mO,{})})]})}function vO(){let[e]=(0,Y.useState)($o);return(0,Y.useEffect)(()=>jn(e),[e]),(0,X.jsx)(ts,{children:(0,X.jsx)(Ue,{client:e,children:(0,X.jsxs)(On,{children:[(0,X.jsx)(Qo,{}),(0,X.jsx)(Tv,{}),(0,X.jsx)(_u,{children:(0,X.jsx)(_v,{children:(0,X.jsxs)(Tn,{children:[(0,X.jsx)(yv,{}),(0,X.jsx)(es.Provider,{value:gO,children:(0,X.jsx)(Si,{children:(0,X.jsx)(nv,{children:(0,X.jsx)(_O,{})})})}),(0,X.jsx)(Yn,{})]})})})]})})})}var yO=document.querySelector(`meta[name="cez-api-base"]`)?.getAttribute(`content`);l(d(yO,void 0,void 0));var bO=document.getElementById(`root`);if(!bO)throw Error(`Squawk: #root container is missing from index.html`);(0,Po.createRoot)(bO).render((0,X.jsx)(Y.StrictMode,{children:(0,X.jsx)(vO,{})}));export{Bv as $,fs as $n,Oh as $t,Px as A,Zu as An,Kg as At,ox as B,fl as Bn,_g as Bt,ZS as C,kf as Cn,__ as Ct,GS as D,Qu as Dn,a_ as Dt,KS as E,td as En,b_ as Et,Lx as F,Ou as Fn,Og as Ft,Vb as G,ks as Gn,Sg as Gt,rx as H,ol as Hn,Eg as Ht,Fx as I,ku as In,Rg as It,Pb as J,bs as Jn,og as Jt,Yb as K,Ds as Kn,xg as Kt,Ix as L,vu as Ln,zg as Lt,Ox as M,Su as Mn,Wg as Mt,jx as N,Du as Nn,Bg as Nt,hS as O,ed as On,Zg as Ot,kx as P,Au as Pn,kg as Pt,Fv as Q,ms as Qn,Nh as Qt,ax as R,Ul as Rn,Ig as Rt,$S as S,Of as Sn,i_ as St,YS as T,$u as Tn,o_ as Tt,Zb as U,il as Un,bg as Ut,ex as V,cl as Vn,Tg as Vt,qb as W,js as Wn,wg as Wt,qv as X,_s as Xn,ig as Xt,Nb as Y,vs as Yn,ag as Yt,Jv as Z,gs as Zn,rg as Zt,wC as _,sp as _n,r_ as _t,tT as a,Wm as an,kv as at,iC as b,jf as bn,n_ as bt,QC as c,Lm as cn,bv as ct,NC as d,zm as dn,U_ as dt,ih as en,os as er,Uv as et,PC as f,Gm as fn,H_ as ft,CC as g,hp as gn,f_ as gt,SC as h,wm as hn,T_ as ht,CT as i,Ym as in,Wv as it,Nx as j,Ju as jn,Hg as jt,pS as k,Yu as kn,Jg as kt,XC as l,qm as ln,xv as lt,IC as m,Fm as mn,E_ as mt,QT as n,Km as nn,rs as nr,Lv as nt,eT as o,Um as on,Ov as ot,AC as p,Om as pn,V_ as pt,Xb as q,Ss as qn,Cg as qt,wT as r,Bm as rn,Vv as rt,$w as s,Rm as sn,Dv as st,qE as t,rh as tn,is as tr,Hv as tt,MC as u,Xm as un,vv as ut,lC as v,op as vn,u_ as vt,XS as w,zd as wn,y_ as wt,eC as x,Df as xn,s_ as xt,sC as y,cp as yn,d_ as yt,ix as z,Tl as zn,jg as zt};