@open-mercato/cezar 0.16.2 → 0.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-origin.d.ts +6 -0
- package/dist/api-origin.js +32 -0
- package/dist/api-origin.js.map +1 -0
- package/dist/automations/schedule-runner.d.ts +1 -0
- package/dist/automations/schedule-runner.js +2 -2
- package/dist/automations/schedule-runner.js.map +1 -1
- package/dist/core/agent-errors.d.ts +5 -0
- package/dist/core/agent-errors.js +49 -0
- package/dist/core/agent-errors.js.map +1 -1
- package/dist/core/claude-cli-runner.d.ts +3 -0
- package/dist/core/claude-cli-runner.js +20 -4
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/codex-ui-mapper.js +4 -1
- package/dist/core/codex-ui-mapper.js.map +1 -1
- package/dist/core/copilot-acp-runner.d.ts +1 -1
- package/dist/core/copilot-acp-runner.js +26 -5
- package/dist/core/copilot-acp-runner.js.map +1 -1
- package/dist/core/model-presets.d.ts +11 -0
- package/dist/core/model-presets.js +35 -1
- package/dist/core/model-presets.js.map +1 -1
- package/dist/core/opencode-model-catalog.js +3 -0
- package/dist/core/opencode-model-catalog.js.map +1 -1
- package/dist/core/opencode-server-runner.d.ts +7 -0
- package/dist/core/opencode-server-runner.js +36 -1
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/pi-runner.js +2 -0
- package/dist/core/pi-runner.js.map +1 -1
- package/dist/core/provider-auth.d.ts +6 -0
- package/dist/core/provider-auth.js +59 -13
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/core/usage-limit.js +8 -2
- package/dist/core/usage-limit.js.map +1 -1
- package/dist/index.js +3 -19
- package/dist/index.js.map +1 -1
- package/dist/release/bump.d.ts +1 -1
- package/dist/release/bump.js +1 -1
- package/dist/release/stable.d.ts +21 -4
- package/dist/release/stable.js +48 -15
- package/dist/release/stable.js.map +1 -1
- package/dist/runs/agent-error-telemetry.js +4 -2
- package/dist/runs/agent-error-telemetry.js.map +1 -1
- package/dist/runs/store.d.ts +1 -1
- package/dist/runs/store.js +31 -4
- package/dist/runs/store.js.map +1 -1
- package/dist/server/git-changes.d.ts +22 -0
- package/dist/server/git-changes.js +19 -1
- package/dist/server/git-changes.js.map +1 -1
- package/dist/server/open-in-app.js +14 -3
- package/dist/server/open-in-app.js.map +1 -1
- package/dist/server/preview/location-reporter.d.ts +12 -0
- package/dist/server/preview/location-reporter.js +45 -0
- package/dist/server/preview/location-reporter.js.map +1 -0
- package/dist/server/preview/picker-script.d.ts +0 -22
- package/dist/server/preview/picker-script.js +3 -1
- package/dist/server/preview/picker-script.js.map +1 -1
- package/dist/server/provider-telemetry.d.ts +3 -1
- package/dist/server/provider-telemetry.js +4 -2
- package/dist/server/provider-telemetry.js.map +1 -1
- package/dist/server/repo-sync.js +5 -10
- package/dist/server/repo-sync.js.map +1 -1
- package/dist/server/server.d.ts +1854 -1854
- package/dist/server/server.js +7 -2
- package/dist/server/server.js.map +1 -1
- package/dist/server/worktree-lifecycle.d.ts +8 -8
- package/dist/telemetry.js +3 -1
- package/dist/telemetry.js.map +1 -1
- package/dist/workflows/continuation-context.d.ts +3 -1
- package/dist/workflows/continuation-context.js +22 -3
- package/dist/workflows/continuation-context.js.map +1 -1
- package/dist/workflows/run.d.ts +20 -9
- package/dist/workflows/run.js +49 -11
- package/dist/workflows/run.js.map +1 -1
- package/package.json +3 -3
- package/scripts/mock-copilot-acp.mjs +4 -0
- package/web/dist/assets/{agent-task-pickers-DEW3Vgdv.js → agent-task-pickers-CNuwgeJL.js} +1 -1
- package/web/dist/assets/{automations-route-Cx7mzYhD.js → automations-route-Cs1tsu1W.js} +1 -1
- package/web/dist/assets/{commit-list-xMdmPYbz.js → commit-list-Ti2arrt8.js} +1 -1
- package/web/dist/assets/{compare-variants-B6ja1M4D.js → compare-variants-CdchlJMs.js} +1 -1
- package/web/dist/assets/{dashboard-ClEGBFFq.js → dashboard-wi0EQack.js} +2 -2
- package/web/dist/assets/{file-preview-iucr8WDo.js → file-preview-pS9i9ZDR.js} +1 -1
- package/web/dist/assets/git-tab-loading-BC6WP7W4.js +1 -0
- package/web/dist/assets/{git-toolbar-DU5Ca6RI.js → git-toolbar-Dra1QlHb.js} +1 -1
- package/web/dist/assets/github-DZcdhMzw.js +1 -0
- package/web/dist/assets/{host-usage-DjDYDU0A.js → host-usage-DnkXF0CT.js} +1 -1
- package/web/dist/assets/index-qeFtKZ4e.js +22 -0
- package/web/dist/assets/{layout-cards-Sur4EWtx.js → layout-cards-CXMlrDUf.js} +1 -1
- package/web/dist/assets/{project-router-DZsR9P9C.js → project-router-CZzr7lzN.js} +2 -2
- package/web/dist/assets/queries-Bn7zl9OU.js +1 -0
- package/web/dist/assets/{reference-chip-DnemrSPW.js → reference-chip-CScP5y_O.js} +1 -1
- package/web/dist/assets/repo-git-CV-yXaSx.js +1 -0
- package/web/dist/assets/{run-diff-BPZ85gAE.js → run-diff-GHEaeAio.js} +2 -2
- package/web/dist/assets/{skills-BgCN1gTp.js → skills-DuSNv5op.js} +1 -1
- package/web/dist/assets/{task-commits-W1ZZiEt4.js → task-commits-D_gLpFQo.js} +1 -1
- package/web/dist/assets/{task-graph-DI2fn5M8.js → task-graph-BgHk8Y3v.js} +1 -1
- package/web/dist/assets/{task-notes-lmvd1UM7.js → task-notes-BBp0rdzM.js} +1 -1
- package/web/dist/assets/task-workspace-Cr9AjTxP.js +27 -0
- package/web/dist/assets/{terminal-drawer-DAkquqSe.js → terminal-drawer-CcPOjWwP.js} +2 -2
- package/web/dist/assets/{tracker-Cqdpt9RN.js → tracker-BHwMGsDY.js} +2 -2
- package/web/dist/assets/use-automations-Dh3Wj-79.js +5 -0
- package/web/dist/assets/{use-now-pBdvhv13.js → use-now-BB7W0F--.js} +1 -1
- package/web/dist/assets/{workflow-graph-l7O50dsV.js → workflow-graph-CcOTCItr.js} +3 -3
- package/web/dist/assets/worktree-lifecycle-operation-vTgExKUM.js +18 -0
- package/web/dist/index.html +10 -10
- package/web/dist/assets/git-tab-loading-BfC2ir8N.js +0 -1
- package/web/dist/assets/github-CELdSmld.js +0 -1
- package/web/dist/assets/index-BBND6Sg3.js +0 -22
- package/web/dist/assets/queries-CI0EmEcH.js +0 -1
- package/web/dist/assets/repo-git-Bj0PBOjX.js +0 -1
- package/web/dist/assets/task-workspace-B8Fpho3e.js +0 -27
- package/web/dist/assets/use-automations-v77gHYDG.js +0 -5
- package/web/dist/assets/worktree-lifecycle-operation-DOTiqQFx.js +0 -18
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dashboard-wi0EQack.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/queries-Bn7zl9OU.js","assets/button-Clwd6u4_.js","assets/bundle-mjs-BT31bpU6.js","assets/project-router-CZzr7lzN.js","assets/reference-chip-CScP5y_O.js","assets/tooltip-B628Gs7C.js","assets/circle-check-DnEaQ9Rj.js","assets/triangle-alert-BqI_9MkV.js","assets/git-pull-request-draft-Cn24ayXz.js","assets/x-DMIsmLBt.js","assets/token-metrics-Dk2ZNHb_.js","assets/use-automations-Dh3Wj-79.js","assets/use-now-BB7W0F--.js","assets/check-Dt8U0Zvm.js","assets/automation-format-BL4n19a2.js","assets/chevron-right-VbYrJ_st.js","assets/download-DOJ8Dqfh.js","assets/compare-variants-CdchlJMs.js","assets/search-x-CuinYQnl.js","assets/collapsible-Bdyuw-he.js","assets/alert-dialog-DvPnvVvK.js","assets/centered-state-nM7v9xtl.js","assets/markdown-Rbaca31B.js","assets/chunk-BO2N2NFS-MDrqQfMl.js","assets/lib-BxQXEXDF.js","assets/run-diff-GHEaeAio.js","assets/task-commits-D_gLpFQo.js","assets/use-desktop-BNN3U2y9.js","assets/git-tab-loading-BC6WP7W4.js","assets/textarea-ewNKsXDa.js","assets/icon-tooltip-YXzUubMO.js","assets/terminal-F3ZJ5fI8.js","assets/git-toolbar-Dra1QlHb.js","assets/upload-J0hBTVF7.js","assets/loader-circle-D-ter0qP.js","assets/diff-stat-CiWUpWY0.js","assets/use-submit-shortcut-hAaAH4HY.js","assets/arrow-left-BELOeFyX.js","assets/diff-CJKocK17.js","assets/scroll-within-Cm6fjjNd.js","assets/commit-list-Ti2arrt8.js","assets/task-notes-BBp0rdzM.js","assets/layout-cards-CXMlrDUf.js","assets/save-B8DEQI2V.js","assets/input-DIWTlsx6.js","assets/task-workspace-Cr9AjTxP.js","assets/file-preview-pS9i9ZDR.js","assets/file-1a6_DhLG.js","assets/markdown-BzqT8I8y.js","assets/message-square-EWpWB_Gr.js","assets/worktree-lifecycle-operation-vTgExKUM.js","assets/square-8OFxLPoA.js","assets/file-text-DmMQx3hx.js","assets/plus-CBVm02wz.js","assets/tabs-BUk8rSoE.js","assets/drawer-state-DasOAIpO.js","assets/types-BTlmexWF.js","assets/repo-git-CV-yXaSx.js","assets/github-DZcdhMzw.js","assets/chevron-left-Df5IsPem.js","assets/tag-yruQH0i-.js","assets/agent-task-pickers-CNuwgeJL.js","assets/tracker-BHwMGsDY.js","assets/workflow-graph-CcOTCItr.js","assets/settings-2-COky68xN.js","assets/workflow-graph-DLioOiRN.css","assets/skills-DuSNv5op.js","assets/automations-route-Cs1tsu1W.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r,t as i}from"./react-runtime-CCIEwYL0.js";import{$ as a,$i as o,$n as s,$t as c,Aa as l,Ai as u,An as d,At as f,B as p,Bi as m,Bn as h,Bt as g,Ca as _,Ci as v,Ct as y,D as b,Da as x,Dn as S,Dt as C,Ea as w,Ei as T,En as E,Et as D,Fa as O,Ft as k,G as A,Gi as j,Gt as M,Ia as N,It as P,J as F,Jt as I,K as ee,Ki as te,Kr as ne,L,Ln as re,Lt as ie,Ma as ae,Mi as oe,Mn as se,Mt as ce,Na as le,Ni as ue,Nn as de,Nr as fe,Nt as pe,Oa as me,On as he,Or as ge,Ot as _e,P as ve,Pa as ye,Pn as be,Pr as xe,Pt as Se,Q as Ce,Qt as R,R as we,Rt as Te,S as Ee,Sa as De,Si as Oe,Sn as ke,Sr as Ae,St as je,Ta as Me,Tn as Ne,Tt as Pe,U as Fe,Ui as Ie,Ut as Le,V as Re,Vi as ze,W as Be,Wt as Ve,Xi as He,Xt as Ue,Y as We,Yi as Ge,Yn as Ke,Yt as qe,Z as Je,Zi as Ye,Zt as Xe,_i as Ze,_n as Qe,ai as $e,an as et,b as tt,ba as nt,bi as rt,bn as it,c as at,cn as ot,d as st,di as ct,dt as lt,er as ut,et as dt,f as ft,fa as pt,fn as mt,ft as ht,g as gt,ga as _t,gn as vt,h as yt,ha as bt,hi as xt,hn as St,i as Ct,in as wt,ir as Tt,it as Et,j as Dt,ja as Ot,ji as kt,jn as At,ka as jt,ki as Mt,kn as Nt,kt as Pt,l as Ft,la as It,ln as Lt,lr as Rt,m as zt,ma as Bt,na as Vt,ni as Ht,nn as Ut,nt as Wt,o as Gt,on as Kt,p as qt,pa as Jt,pr as Yt,q as Xt,qt as Zt,r as z,s as Qt,sa as $t,sn as en,sr as tn,tn as nn,tt as rn,u as an,v as on,va as B,vn as sn,wa as cn,wn as ln,wt as un,xa as V,xi as dn,xn as fn,xt as pn,y as mn,ya as hn,yn as gn,z as _n,zi as vn,zt as yn}from"./queries-Bn7zl9OU.js";import{A as bn,B as xn,Bt as Sn,C as Cn,D as wn,E as Tn,F as H,H as En,N as Dn,P as On,Pt as kn,S as An,T as jn,Vt as Mn,W as Nn,X as Pn,_ as Fn,b as In,g as Ln,gt as Rn,h as zn,i as Bn,k as Vn,m as Hn,r as U,t as W,v as Un,w as Wn,wt as Gn,x as Kn,y as qn,zt as Jn}from"./button-Clwd6u4_.js";import{i as Yn}from"./bundle-mjs-BT31bpU6.js";import{S as Xn,T as Zn,_ as Qn,a as $n,b as er,c as tr,f as G,g as nr,h as rr,i as ir,l as ar,m as or,n as sr,o as cr,p as lr,r as ur,s as dr,t as K,u as fr,v as q,w as pr,x as mr,y as hr}from"./project-router-CZzr7lzN.js";import{C as gr,O as _r,S as vr,_ as yr,a as br,b as xr,c as Sr,f as Cr,g as wr,h as Tr,i as Er,l as Dr,m as Or,o as kr,p as Ar,r as jr,t as Mr,v as Nr}from"./reference-chip-CScP5y_O.js";import{C as Pr,D as Fr,E as Ir,O as Lr,S as Rr,T as zr,_ as Br,a as Vr,b as Hr,c as Ur,d as Wr,f as Gr,g as Kr,h as qr,i as Jr,k as Yr,l as Xr,m as Zr,p as Qr,s as $r,u as ei,v as ti,w as ni,x as ri,y as ii}from"./use-automations-Dh3Wj-79.js";import{_ as ai,a as oi,c as si,d as ci,f as li,g as ui,h as di,i as fi,l as pi,m as mi,n as hi,p as gi,r as _i,s as vi,t as yi,u as bi}from"./use-now-BB7W0F--.js";import{a as xi,c as Si,d as Ci,f as wi,i as Ti,l as Ei,n as Di,o as Oi,r as ki,s as Ai,t as ji,u as Mi}from"./host-usage-DnkXF0CT.js";import{t as Ni}from"./use-desktop-BNN3U2y9.js";import{$t as Pi,A as Fi,At as Ii,Bt as Li,C as Ri,Cn as zi,D as Bi,Dt as Vi,E as Hi,F as Ui,Ft as Wi,Ht as Gi,It as Ki,Jt as qi,L as Ji,Lt as Yi,M as Xi,Mn as Zi,Mt as Qi,N as $i,Nt as ea,O as ta,Ot as na,P as ra,Pt as ia,Qt as aa,R as oa,Rt as sa,S as ca,T as la,Tn as ua,Vt as da,Xt as fa,Yt as pa,Zt as ma,_ as ha,_n as ga,a as _a,b as va,bn as ya,c as ba,cn as xa,en as Sa,fn as Ca,hn as wa,i as Ta,in as Ea,j as Da,jt as Oa,k as ka,kn as Aa,kt as ja,mn as Ma,n as Na,nn as Pa,o as Fa,pn as Ia,rn as La,s as Ra,sn as za,v as Ba,vn as Va,w as Ha,x as Ua,zt as Wa}from"./git-tab-loading-BC6WP7W4.js";import{t as Ga}from"./arrow-left-BELOeFyX.js";import{A as Ka,B as qa,D as Ja,F as Ya,G as Xa,I as Za,L as Qa,N as $a,O as eo,P as to,R as no,S as ro,T as io,V as ao,W as oo,_ as so,a as co,b as lo,c as uo,d as fo,f as po,g as mo,h as ho,i as go,j as _o,k as vo,l as yo,m as bo,o as xo,p as So,r as Co,s as wo,t as To,u as Eo,v as Do,w as Oo,z as ko}from"./worktree-lifecycle-operation-vTgExKUM.js";import{t as Ao}from"./file-1a6_DhLG.js";import{a as jo,n as Mo,r as No,t as Po}from"./textarea-ewNKsXDa.js";import{t as Fo}from"./check-Dt8U0Zvm.js";import{a as Io,c as Lo,d as Ro,f as zo,i as Bo,l as Vo,n as Ho,o as Uo,r as Wo,s as Go,t as Ko,u as qo}from"./tooltip-B628Gs7C.js";import{t as Jo}from"./chevron-right-VbYrJ_st.js";import{t as Yo}from"./circle-check-DnEaQ9Rj.js";import{a as Xo,c as Zo,h as Qo,i as $o,m as es,n as ts,r as ns,t as rs,u as is}from"./icon-tooltip-YXzUubMO.js";import{n as as}from"./terminal-F3ZJ5fI8.js";import{d as os,f as ss,m as cs,p as ls}from"./git-toolbar-Dra1QlHb.js";import{t as us}from"./upload-J0hBTVF7.js";import{t as ds}from"./triangle-alert-BqI_9MkV.js";import{t as fs}from"./loader-circle-D-ter0qP.js";import{n as ps,r as ms}from"./use-submit-shortcut-hAaAH4HY.js";import{n as hs,t as gs}from"./square-8OFxLPoA.js";import{t as _s}from"./plus-CBVm02wz.js";import{t as vs}from"./search-x-CuinYQnl.js";import{t as ys}from"./x-DMIsmLBt.js";import{a as bs,i as xs,o as Ss}from"./collapsible-Bdyuw-he.js";import{a as Cs,c as ws,i as Ts,n as Es,o as Ds,r as Os,s as ks,t as As}from"./alert-dialog-DvPnvVvK.js";import{i as js,n as Ms,r as Ns,t as Ps}from"./tabs-BUk8rSoE.js";import{t as Fs}from"./input-DIWTlsx6.js";import{i as Is,r as Ls,t as Rs}from"./token-metrics-Dk2ZNHb_.js";import{t as zs}from"./diff-stat-CiWUpWY0.js";import{n as Bs,t as J}from"./centered-state-nM7v9xtl.js";import{a as Vs,i as Hs,n as Us,t as Ws}from"./markdown-Rbaca31B.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 Gs=class extends N{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 De({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=Ks(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=Ks(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=Ks(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=Ks(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Me.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=>jt(t,e))}findAll(e={}){return this.getAll().filter(t=>jt(e,t))}notify(e){Me.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Me.batch(()=>Promise.all(e.map(e=>e.continue().catch(Ot))))}};function Ks(e){return e.options.scope?.id}var qs=class extends N{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??me(r,t),a=this.get(i);return a||(a=new _({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(){Me.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=>l(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>l(e,t)):t}notify(e){Me.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Me.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Me.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Js=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new qs,this.#t=e.mutationCache||new Gs,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=O.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=cn.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=w(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Me.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;Me.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Me.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Me.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Ot).catch(Ot)}invalidateQueries(e,t={}){return Me.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=Me.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(Ot)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Ot)}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(Ot).catch(Ot)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ot).catch(Ot)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return cn.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(x(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ae(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(x(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ae(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||=me(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===ye&&(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),Ys=n();function Xs(){return new Js({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof Ke&&t.status>=400&&t.status<500?!1:t instanceof Ke&&t.status===0?e<3:e<1,retryDelay:(e,t)=>t instanceof Ke&&t.status===0?Math.min(250*2**e,1e3):Math.min(1e3*2**e,3e4)},mutations:{retry:!1}}})}var Zs=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`}]]),Qs=H(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),$s=H(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),ec=H(`bookmark`,[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]),tc=H(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),nc=H(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),rc=H(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),ic=H(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),ac=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`}]]),oc=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`}]]),sc=H(`corner-left-up`,[[`path`,{d:`M14 9 9 4 4 9`,key:`1af5af`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),cc=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`}]]),lc=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`}]]),uc=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`}]]),dc=H(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),fc=H(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),pc=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`}]]),mc=H(`folders`,[[`path`,{d:`M20 5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h2.5a1.5 1.5 0 0 1 1.2.6l.6.8a1.5 1.5 0 0 0 1.2.6z`,key:`a4852j`}],[`path`,{d:`M3 8.268a2 2 0 0 0-1 1.738V19a2 2 0 0 0 2 2h11a2 2 0 0 0 1.732-1`,key:`yxbcw3`}]]),hc=H(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),gc=H(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),_c=H(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),vc=H(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),yc=H(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),bc=H(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),xc=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`}]]),Sc=H(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Cc=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`}]]),wc=H(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Tc=H(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Ec=H(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Dc=H(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Oc=H(`notebook-pen`,[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`,key:`re6nr2`}],[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`pqwjuv`}]]),kc=H(`package-check`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16 17 2 2 4-4`,key:`uh5qu3`}],[`path`,{d:`M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753`,key:`kpkbpo`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),Ac=H(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),jc=H(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Mc=H(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),Nc=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`}]]),Pc=H(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Fc=H(`split`,[[`path`,{d:`M16 3h5v5`,key:`1806ms`}],[`path`,{d:`M8 3H3v5`,key:`15dfkv`}],[`path`,{d:`M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3`,key:`1qrqzj`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}]]),Ic=H(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),Lc=H(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Rc=H(`ticket`,[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]),zc=H(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),Bc={jira:{label:`Jira`,scopeLabel:`Jira projects`},linear:{label:`Linear`,scopeLabel:`Linear teams`}},Vc=kn.options.map(e=>({kind:e,...Bc[e]}));function Hc(e){let t=Y.useRef({value:e,previous:e});return Y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var X=i(),Uc=`Label`,Wc=Y.forwardRef((e,t)=>(0,X.jsx)(wn.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Wc.displayName=Uc;var Gc=Wc;function Kc(e,[t,n]){return Math.min(n,Math.max(t,e))}var qc=e(r(),1),Jc=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Yc=[` `,`Enter`],Xc=`Select`,[Zc,Qc,$c]=Qo(Xc),[el,tl]=Tn(Xc,[$c,Vo]),nl=Vo(),[rl,il]=el(Xc),[al,ol]=el(Xc),sl=`SelectProvider`;function cl(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=nl(t),[_,v]=Y.useState(null),[y,b]=Y.useState(null),[x,S]=Y.useState(!1),C=es(l),[w,T]=Cn({prop:r,defaultProp:i??!1,onChange:a,caller:Xc}),[E,D]=Cn({prop:o,defaultProp:s,onChange:c,caller:Xc}),O=Y.useRef(null),k=Y.useRef(E);Y.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=()=>D(k.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,D]);let A=!_||!!m||!!_.closest(`form`),[j,M]=Y.useState(new Set),N=Kn(),P=Array.from(j).map(e=>e.props.value).join(`;`),F=Y.useCallback(e=>{M(t=>new Set(t).add(e))},[]),I=Y.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),ee={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:N,value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:j,nativeSelectKey:P,isFormControl:A};return(0,X.jsx)(Lo,{...g,children:(0,X.jsx)(rl,{scope:t,...ee,children:(0,X.jsx)(Zc.Provider,{scope:t,children:(0,X.jsx)(al,{scope:t,onNativeOptionAdd:F,onNativeOptionRemove:I,children:cu(h)?h(ee):n})})})})}cl.displayName=sl;var ll=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,X.jsx)(cl,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,X.jsxs)(X.Fragment,{children:[n,e?(0,X.jsx)(su,{__scopeSelect:t}):null]})})};ll.displayName=Xc;var ul=`SelectTrigger`,dl=Y.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=nl(n),o=il(ul,n),s=o.disabled||r,c=Dn(t,o.onTriggerChange),l=Qc(n),u=Y.useRef(`touch`),[d,f,p]=uu(e=>{let t=l().filter(e=>!e.disabled),n=du(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,X.jsx)(Io,{asChild:!0,...a,children:(0,X.jsx)(wn.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":lu(o.value)?``:void 0,...i,ref:c,onClick:jn(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:jn(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:jn(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Jc.includes(e.key)&&(m(),e.preventDefault())})})})});dl.displayName=ul;var fl=`SelectValue`,pl=Y.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=il(fl,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Dn(t,c.onValueNodeChange);Wn(()=>{l(u)},[l,u]);let f=lu(c.value);return(0,X.jsx)(wn.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,X.jsx)(Y.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});pl.displayName=fl;var ml=`SelectIcon`,hl=Y.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,X.jsx)(wn.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});hl.displayName=ml;var gl=`SelectPortal`,[_l,vl]=el(gl,{forceMount:void 0}),yl=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,X.jsx)(_l,{scope:e.__scopeSelect,forceMount:n,children:(0,X.jsx)(Fn,{asChild:!0,...r})})};yl.displayName=gl;var bl=`SelectContent`,xl=Y.forwardRef((e,t)=>{let n=vl(bl,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=il(bl,e.__scopeSelect),[o,s]=Y.useState();return Wn(()=>{s(new DocumentFragment)},[]),(0,X.jsx)(An,{present:r||a.open,children:({present:e})=>e?(0,X.jsx)(Ol,{...i,ref:t}):(0,X.jsx)(Sl,{...i,fragment:o})})});xl.displayName=bl;var Sl=Y.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?qc.createPortal((0,X.jsx)(wl,{scope:n,children:(0,X.jsx)(Zc.Slot,{scope:n,children:(0,X.jsx)(`div`,{ref:t,children:r})})}),i):null});Sl.displayName=`SelectContentFragment`;var Cl=10,[wl,Tl]=el(bl),El=`SelectContentImpl`,Dl=bn(`SelectContent.RemoveScroll`),Ol=Y.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=il(bl,n),[y,b]=Y.useState(null),[x,S]=Y.useState(null),C=Dn(t,b),[w,T]=Y.useState(null),[E,D]=Y.useState(null),O=Qc(n),[k,A]=Y.useState(!1),j=Y.useRef(!1);Y.useEffect(()=>{if(y)return Hn(y)},[y]),Ln();let M=Y.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),N=Y.useCallback(()=>M([w,y]),[M,w,y]);Y.useEffect(()=>{k&&N()},[k,N]);let{onOpenChange:P,triggerPointerDownPosRef:F}=v;Y.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(F.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||P(!1),document.removeEventListener(`pointermove`,t),F.current=null};return F.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,P,F]),Y.useEffect(()=>{let e=()=>P(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[P]);let[I,ee]=uu(e=>{let t=O().filter(e=>!e.disabled),n=du(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),te=Y.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(j.current=!0))},[v.value]),ne=Y.useCallback(()=>y?.focus(),[y]),L=Y.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),re=r===`popper`?Ml:Al,ie=re===Ml?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,X.jsx)(wl,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:te,selectedItem:w,onItemLeave:ne,itemTextRefCallback:L,focusSelectedItem:N,selectedItemText:E,position:r,isPositioned:k,searchRef:I,children:(0,X.jsx)(zn,{as:Dl,allowPinchZoom:!0,children:(0,X.jsx)(Un,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:jn(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,X.jsx)(qn,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,X.jsx)(re,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...ie,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:jn(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ee(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>M(t)),e.preventDefault()}})})})})})})});Ol.displayName=El;var kl=`SelectItemAlignedPosition`,Al=Y.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=il(bl,n),o=Tl(bl,n),[s,c]=Y.useState(null),[l,u]=Y.useState(null),d=Dn(t,u),f=Qc(n),p=Y.useRef(!1),m=Y.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=Y.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Cl,d=Kc(a,[Cl,Math.max(Cl,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Cl,d=Kc(a,[Cl,Math.max(Cl,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Cl*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Cl,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${Cl}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);Wn(()=>y(),[y]);let[b,x]=Y.useState();return Wn(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,X.jsx)(Nl,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:Y.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,X.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,X.jsx)(wn.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Al.displayName=kl;var jl=`SelectPopperPosition`,Ml=Y.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Cl,...a}=e,o=nl(n);return(0,X.jsx)(Go,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Ml.displayName=jl;var[Nl,Pl]=el(bl,{}),Fl=`SelectViewport`,Il=Y.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Tl(Fl,n),o=Pl(Fl,n),s=Dn(t,a.onViewportChange),c=Y.useRef(0);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,X.jsx)(Zc.Slot,{scope:n,children:(0,X.jsx)(wn.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:jn(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Cl*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Il.displayName=Fl;var Ll=`SelectGroup`,[Rl,zl]=el(Ll),Bl=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Kn();return(0,X.jsx)(Rl,{scope:n,id:i,children:(0,X.jsx)(wn.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Bl.displayName=Ll;var Vl=`SelectLabel`,Hl=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=zl(Vl,n);return(0,X.jsx)(wn.div,{id:i.id,...r,ref:t})});Hl.displayName=Vl;var Ul=`SelectItem`,[Wl,Gl]=el(Ul),Kl=Y.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=il(Ul,n),c=Tl(Ul,n),l=s.value===r,[u,d]=Y.useState(a??``),[f,p]=Y.useState(!1),m=Dn(t,In(e=>c.itemRefCallback?.(e,r,i))),h=Kn(),g=Y.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,X.jsx)(Wl,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:Y.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,X.jsx)(Zc.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,X.jsx)(wn.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:jn(o.onFocus,()=>p(!0)),onBlur:jn(o.onBlur,()=>p(!1)),onClick:jn(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:jn(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:jn(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:jn(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:jn(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:jn(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(Yc.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});Kl.displayName=Ul;var ql=`SelectItemText`,Jl=Y.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=il(ql,n),s=Tl(ql,n),c=Gl(ql,n),l=ol(ql,n),[u,d]=Y.useState(null),f=In(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=Dn(t,d,c.onItemTextChange,f),m=u?.textContent,h=Y.useMemo(()=>(0,X.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return Wn(()=>(g(h),()=>_(h)),[g,_,h]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(wn.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!lu(o.value)?qc.createPortal(a.children,o.valueNode):null]})});Jl.displayName=ql;var Yl=`SelectItemIndicator`,Xl=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Gl(Yl,n).isSelected?(0,X.jsx)(wn.span,{"aria-hidden":!0,...r,ref:t}):null});Xl.displayName=Yl;var Zl=`SelectScrollUpButton`,Ql=Y.forwardRef((e,t)=>{let n=Tl(Zl,e.__scopeSelect),r=Pl(Zl,e.__scopeSelect),[i,a]=Y.useState(!1),o=Dn(t,r.onScrollButtonChange);return Wn(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,X.jsx)(tu,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Ql.displayName=Zl;var $l=`SelectScrollDownButton`,eu=Y.forwardRef((e,t)=>{let n=Tl($l,e.__scopeSelect),r=Pl($l,e.__scopeSelect),[i,a]=Y.useState(!1),o=Dn(t,r.onScrollButtonChange);return Wn(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,X.jsx)(tu,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});eu.displayName=$l;var tu=Y.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Tl(`SelectScrollButton`,n),o=Y.useRef(null),s=Qc(n),c=Y.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return Y.useEffect(()=>()=>c(),[c]),Wn(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,X.jsx)(wn.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:jn(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:jn(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:jn(i.onPointerLeave,()=>{c()})})}),nu=`SelectSeparator`,ru=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,X.jsx)(wn.div,{"aria-hidden":!0,...r,ref:t})});ru.displayName=nu;var iu=`SelectArrow`,au=Y.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=nl(n);return Tl(iu,n).position===`popper`?(0,X.jsx)(Uo,{...i,...r,ref:t}):null});au.displayName=iu;var ou=`SelectBubbleInput`,su=Y.forwardRef(({__scopeSelect:e,...t},n)=>{let r=il(ou,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=Y.useRef(null),m=Dn(n,p),h=i??``,g=Hc(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return Y.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,X.jsxs)(wn.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...Ro,...t.style},ref:m,defaultValue:h,children:[lu(i)&&!_?(0,X.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});su.displayName=ou;function cu(e){return typeof e==`function`}function lu(e){return e===``||e===void 0}function uu(e){let t=In(e),n=Y.useRef(``),r=Y.useRef(0),i=Y.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=Y.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return Y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function du(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=fu(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function fu(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var pu=`Switch`,[mu,hu]=Tn(pu),[gu,_u]=mu(pu);function vu(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=Cn({prop:n,defaultProp:i??!1,onChange:c,caller:pu}),[m,h]=Y.useState(null),[g,_]=Y.useState(null),v={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:Y.useRef(!1),required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,X.jsx)(gu,{scope:t,...v,children:Eu(d)?d(v):r})}var yu=`SwitchTrigger`,bu=Y.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{let{control:i,form:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=_u(yu,e),h=Dn(r,u),g=Y.useRef(c);return Y.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,d]),(0,X.jsx)(wn.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":Du(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:h,onClick:jn(t,e=>{d(e=>!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});bu.displayName=yu;var xu=Y.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,X.jsx)(vu,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(bu,{...d,ref:t,__scopeSwitch:n}),e&&(0,X.jsx)(Tu,{__scopeSwitch:n})]})})});xu.displayName=pu;var Su=`SwitchThumb`,Cu=Y.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=_u(Su,n);return(0,X.jsx)(wn.span,{"data-state":Du(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Cu.displayName=Su;var wu=`SwitchBubbleInput`,Tu=Y.forwardRef(({__scopeSwitch:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=_u(wu,e),m=Dn(n,p),h=Hc(a),g=qo(r);Y.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});n.call(e,a),e.dispatchEvent(t)}},[f,h,a,i]);let _=Y.useRef(a);return(0,X.jsx)(wn.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});Tu.displayName=wu;function Eu(e){return typeof e==`function`}function Du(e){return e?`checked`:`unchecked`}var Ou=On(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-destructive-foreground focus-visible:ring-destructive/20 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function ku({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,X.jsx)(n?Vn:`span`,{"data-slot":`badge`,"data-variant":t,className:U(Ou({variant:t}),e),...r})}var Au=`x-apple.systempreferences:com.apple.preference.security?Privacy_FilesAndFolders`,ju=`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-foreground hover:bg-muted`;function Mu(e){let t=e.replace(/[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?null:n===0?t.slice(0,1):t.slice(0,n)}function Nu({path:e,selected:t,onSelect:n,onEnter:r,decorate:i,emptyHint:a,showHidden:o=!1}){let s=Ee(e,o),c=s.data?.parent??null;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-[11.5px] text-soft-foreground`,title:s.data?.path??void 0,children:s.data?.path??(s.isError?``:`Loading…`)}),s.isError?(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,X.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not list that folder`}),s.error instanceof Ke&&s.error.status===403?(0,X.jsx)(`p`,{"data-slot":`fs-privacy-hint`,className:`text-[12.5px] text-soft-foreground`,children:`Allow it under Privacy & Security ▸ Files & Folders, then try again.`}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[12.5px]`,children:[e!==null&&Mu(e)!==null?(0,X.jsxs)(`button`,{type:`button`,"data-slot":`fs-error-back`,onClick:()=>r(Mu(e)),className:ju,children:[(0,X.jsx)(sc,{className:`size-3.5`,"aria-hidden":!0}),`Back`]}):null,s.error instanceof Ke&&s.error.status===403?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`a`,{"data-slot":`fs-privacy-settings`,href:Au,target:`_blank`,rel:`noreferrer`,className:ju,children:`Open Privacy Settings`}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`fs-retry`,onClick:()=>void s.refetch(),className:ju,children:`Try again`})]}):null]})]}):(0,X.jsxs)(`ul`,{"data-slot":`fs-listing`,className:`max-h-64 divide-y divide-border/60 overflow-y-auto overscroll-contain rounded-md border border-border`,children:[c===null?null:(0,X.jsx)(`li`,{className:`flex`,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`fs-up`,onClick:()=>r(c),className:`flex flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,X.jsx)(sc,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(s.data?.dirs??[]).map(e=>(0,X.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,X.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":t?.path===e.path,onClick:()=>n(e),onDoubleClick:()=>r(e.path),className:U(`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,t?.path===e.path&&`bg-muted`),children:[(0,X.jsx)(ss,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.name}),i?.(e)]}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`fs-enter`,"aria-label":`Open ${e.name}`,onClick:()=>r(e.path),className:`flex shrink-0 items-center px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,X.jsx)(Jo,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),s.data&&s.data.dirs.length===0?(0,X.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:a}):null]}),s.data?.truncated?(0,X.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-[11.5px] text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function Pu(e,t,n=!1){let r=Ee(e,n);return t?.path??r.data?.path??null}function Fu({open:e,onOpenChange:t}){let[n,r]=(0,Y.useState)(null),[i,a]=(0,Y.useState)(null),o=A(),s=dt(),c=Xn(),l=new Set((o.data?.projects??[]).filter(e=>!e.unregistered).map(e=>e.root)),u=e=>{r(e),a(null),s.reset()},d=Pu(n,i);return(0,X.jsx)(Cr,{open:e,onOpenChange:t,children:(0,X.jsxs)(Ar,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(wr,{children:[(0,X.jsx)(yr,{children:`Open local folder`}),(0,X.jsx)(Or,{children:`Pick the folder cezar should run in. Git repos are marked; any folder works.`})]}),(0,X.jsx)(Nu,{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)(ku,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`git`}):null,l.has(e.path)?(0,X.jsx)(ku,{variant:`ghost`,className:`shrink-0 text-[10px] text-muted-foreground`,children:`already added`}):null]})}),s.isError?(0,X.jsx)(`p`,{"data-slot":`add-project-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:s.error instanceof Error?s.error.message:`could not add that folder`}):null,(0,X.jsxs)(Tr,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,X.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-[11.5px] text-muted-foreground`,title:d??void 0,children:d??``}),(0,X.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,X.jsx)(W,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(W,{"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 Iu({className:e,...t}){return(0,X.jsx)(Gc,{"data-slot":`label`,className:U(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function Lu(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 Ru({open:e,onOpenChange:t}){let[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(!1),u=(0,Y.useRef)(!1),d=A(),f=zt(),{mutate:p,isPending:m}=f,h=Xn(),g=Lu(f.error),_=(0,Y.useMemo)(()=>`co-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),v=(0,Y.useRef)(_);v.current=_,(0,Y.useEffect)(()=>Lr((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===v.current&&(n.phase===`cloning`&&n.line?s(n.line):n.phase!==`cloning`&&s(null))}),[]);let y=(0,Y.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),b=i.trim()===``?y:i.trim(),x=d.data?.projectsDir??``,S=b===``?``:`${x.replace(/\/+$/,``)}/${b}`,C=(0,Y.useCallback)(()=>{n.trim()===``||m||(u.current=!1,l(!1),s(null),p({url:n.trim(),checkoutId:_,...i.trim()===``?{}:{name:i.trim()}},{onSuccess:({project:e})=>{t(!1),h(`/p/${encodeURIComponent(e.id)}/`)}}))},[p,m,_,i,h,t,n]);return(0,Y.useEffect)(()=>{if(!c)return;let e=()=>{u.current&&(u.current=!1,l(!1),C())},t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[c,C]),(0,X.jsx)(Cr,{open:e,onOpenChange:e=>f.isPending?void 0:t(e),children:(0,X.jsxs)(Ar,{"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)(wr,{children:[(0,X.jsx)(yr,{children:`Clone from GitHub`}),(0,X.jsxs)(Or,{children:[`The service clones with `,(0,X.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(Iu,{htmlFor:`clone-url`,children:`Repository`}),(0,X.jsx)(Fs,{id:`clone-url`,"data-slot":`clone-url`,autoFocus:!0,placeholder:`owner/repo or https://github.com/owner/repo`,value:n,disabled:f.isPending,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&C()}})]}),(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(Iu,{htmlFor:`clone-name`,children:`Folder name`}),(0,X.jsx)(Fs,{id:`clone-name`,"data-slot":`clone-name`,placeholder:y===``?`repo`:y,value:i,disabled:f.isPending,onChange:e=>a(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,X.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-[11.5px] text-soft-foreground`,title:S,children:S}),f.isPending?(0,X.jsx)(W,{"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)(Nc,{className:`size-3.5`,"aria-hidden":`true`})}):(0,X.jsx)(W,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,X.jsx)(or,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,X.jsx)(Nc,{className:`size-3.5`,"aria-hidden":`true`})})})]})]}),f.isPending?(0,X.jsx)(`p`,{"data-slot":`clone-progress`,className:`truncate font-mono text-[11.5px] text-muted-foreground`,children:o??`Starting the clone…`}):null,f.isError?(0,X.jsx)(`div`,{"data-slot":`clone-error`,className:`grid min-w-0 gap-1.5 text-[13px] text-danger`,children:g?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{children:`GitHub requires SAML authorization for this organization.`}),(0,X.jsxs)(`p`,{children:[(0,X.jsx)(`a`,{"data-slot":`clone-sso-link`,className:`font-medium underline underline-offset-2`,href:g,target:`_blank`,rel:`noreferrer`,onClick:()=>{u.current=!0,l(!0)},children:`Authorize this GitHub organization`}),c?` — return here after authorizing, or choose Retry clone.`:` — return to this tab to retry, or choose Retry clone.`]}),(0,X.jsxs)(`details`,{className:`min-w-0`,children:[(0,X.jsx)(`summary`,{children:`Error details`}),(0,X.jsx)(`p`,{className:`whitespace-pre-wrap break-all`,children:f.error instanceof Error?f.error.message:null})]})]}):(0,X.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-all`,children:f.error instanceof Error?f.error.message:`could not clone that repository`})}):null,(0,X.jsxs)(Tr,{children:[(0,X.jsx)(W,{variant:`outline`,disabled:f.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(W,{"data-slot":`clone-confirm`,disabled:n.trim()===``||b===``||f.isPending,onClick:C,children:f.isPending?`Cloning…`:f.isError?`Retry clone`:`Clone`})]})]})})}function zu({className:e,size:t=`default`,...n}){return(0,X.jsx)(xu,{"data-slot":`switch`,"data-size":t,className:U(`peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...n,children:(0,X.jsx)(Cu,{"data-slot":`switch-thumb`,className:U(`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0`)})})}var Bu=[{slug:`github/codespaces-nextjs`,label:`Next.js`,description:`Minimal Next.js app (GitHub)`},{slug:`vercel/ai-chatbot`,label:`Next.js AI chatbot`,description:`Full-featured AI chat app (Vercel)`},{slug:`vercel/nextjs-postgres-nextauth-tailwindcss-template`,label:`Next.js admin dashboard`,description:`Postgres, Auth.js and Tailwind (Vercel)`},{slug:`github/codespaces-react`,label:`React + Vite`,description:`React single-page app (GitHub)`},{slug:`antfu-collective/vitesse`,label:`Vue + Vite`,description:`Opinionated Vue starter (Vitesse)`},{slug:`nuxt-ui-templates/starter-vue`,label:`Vue + Nuxt UI`,description:`Vue + Vite with Nuxt UI (Nuxt)`},{slug:`mugnavo/cove`,label:`Vite+`,description:`TanStack Start on Vite+ (vp), Better Auth`},{slug:`w3cj/hono-open-api-starter`,label:`Hono`,description:`Type-safe JSON API with OpenAPI docs`},{slug:`github/codespaces-express`,label:`Express`,description:`Node.js web server (GitHub)`},{slug:`andrewmcodes/obsidian-beginner-vault-template`,label:`Obsidian vault`,description:`Your own knowledge base in Markdown`},{slug:`chibat/chrome-extension-typescript-starter`,label:`Chrome extension`,description:`TypeScript extension starter`},{slug:`actions/typescript-action`,label:`GitHub Action`,description:`TypeScript action with tests (GitHub)`},{slug:`microsoft/python-package-template`,label:`Python package`,description:`Packaging, tests and CI (Microsoft)`},{slug:`github/codespaces-flask`,label:`Flask`,description:`Python web app (GitHub)`},{slug:`github/codespaces-django`,label:`Django`,description:`Python web framework (GitHub)`},{slug:`github/codespaces-rails`,label:`Ruby on Rails`,description:`Rails app (GitHub)`},{slug:`github/codespaces-jupyter`,label:`Jupyter notebooks`,description:`Data science and ML (GitHub)`}];function Vu(e){let t=e.trim().toLowerCase();return t===``||Bu.some(e=>e.slug.toLowerCase()===t)?Bu:Bu.filter(e=>[e.label,e.slug,e.description].some(e=>e.toLowerCase().includes(t)))}function Hu({value:e,onChange:t,disabled:n,id:r}){let[i,a]=(0,Y.useState)(-1),o=(0,Y.useId)(),s=Vu(e),c=(0,Y.useRef)(null),l=e.trim();(0,Y.useEffect)(()=>{i<0||c.current?.querySelector(`[data-index="${i}"]`)?.scrollIntoView?.({block:`nearest`})},[i]),(0,Y.useEffect)(()=>{c.current?.querySelector(`[aria-selected="true"]`)?.scrollIntoView?.({block:`nearest`})},[l]);let u=e=>{n||(t(e),a(-1))};return(0,X.jsxs)(`div`,{className:`grid gap-2 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,X.jsx)(Fs,{id:r,"data-slot":`create-template`,role:`combobox`,"aria-expanded":s.length>0,"aria-controls":o,"aria-autocomplete":`list`,"aria-activedescendant":i>=0?`${o}-${i}`:void 0,autoComplete:`off`,placeholder:`Search, or paste owner/repo or a URL`,value:e,disabled:n,onBlur:()=>a(-1),onChange:e=>{t(e.target.value),a(-1)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;a(e=>s.length===0?-1:(e+t+s.length)%s.length)}else if(e.key===`Enter`&&i>=0){e.preventDefault();let t=s[i];t&&u(t.slug)}}}),s.length>0?(0,X.jsx)(`ul`,{ref:c,id:o,role:`listbox`,"aria-label":`Suggested templates`,"aria-disabled":n||void 0,"data-slot":`create-template-suggestions`,className:U(`max-h-56 overflow-y-auto overscroll-contain rounded-md border border-border p-1`,`md:max-h-none md:min-h-36 md:flex-1`,n?`pointer-events-none opacity-50`:void 0),children:s.map((e,t)=>{let n=e.slug===l;return(0,X.jsxs)(`li`,{id:`${o}-${t}`,role:`option`,"aria-selected":n,"data-index":t,"data-slot":`create-template-suggestion`,"data-template":e.slug,onMouseDown:e=>e.preventDefault(),onClick:()=>u(e.slug),onMouseEnter:()=>a(t),onMouseLeave:()=>a(-1),className:U(`grid cursor-pointer gap-0.5 rounded-sm border px-2 py-1.5`,n?`border-primary bg-primary/5`:`border-transparent`,t===i&&!n?`bg-accent text-accent-foreground`:void 0),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-baseline justify-between gap-2`,children:[(0,X.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-sm font-medium`,children:[e.label,n?(0,X.jsx)(Yo,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":`true`}):null]}),(0,X.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-muted-foreground`,children:e.description})]}),(0,X.jsx)(`span`,{className:`truncate font-mono text-[11px] text-soft-foreground`,children:e.slug})]},e.slug)})}):(0,X.jsxs)(`p`,{"data-slot":`create-template-no-match`,className:`px-1 text-[12px] text-muted-foreground`,children:[`No suggested template matches — any `,(0,X.jsx)(`span`,{className:`font-mono`,children:`owner/repo`}),` or GitHub URL works.`]})]})}function Uu(e){return e.trimStart().replace(/\s+/g,`-`)}function Wu({open:e,onOpenChange:t}){let[n,r]=(0,Y.useState)(``),[i,a]=(0,Y.useState)(!0),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(`empty`),[f,p]=(0,Y.useState)(null),m=A(),h=b(),g=mn(),_=Xn(),v=(0,Y.useMemo)(()=>`np-${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),y=(0,Y.useRef)(v);y.current=v,(0,Y.useEffect)(()=>Lr((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===y.current&&(n.phase===`cloning`&&n.line?p(n.line):n.phase!==`cloning`&&p(null))}),[]);let x=h.data,S=x?.available===!0&&Array.isArray(x.owners)&&x.owners.length>0,C=(0,Y.useMemo)(()=>x?.available&&Array.isArray(x.owners)?x.owners:[],[x]),w=C.some(e=>e.login===o)?o:C[0]?.login??``,T=i&&S,E=n.trim(),D=Gn.test(E),O=E===``||D?null:E.length>100?`At most 100 characters.`:`Use letters, digits, “.”, “-” and “_” only.`,k=m.data?.projectsDir??``,j=D?`${k.replace(/\/+$/,``)}/${E}`:``,M=T&&u===`template`,N=M&&c.trim()===``,P=()=>{if(!D||g.isPending||i&&h.isPending||N)return;p(null);let e=c.trim();g.mutate({name:E,checkoutId:v,...T?{github:{owner:w,...M&&e!==``?{template:e}:{}}}:{}},{onSuccess:({project:e})=>{t(!1),_(`/p/${encodeURIComponent(e.id)}/`)}})},F=g.isPending,I=h.isPending||S;return(0,X.jsx)(Cr,{open:e,onOpenChange:e=>F?void 0:t(e),children:(0,X.jsxs)(Ar,{"data-slot":`create-project-dialog`,className:U(`max-h-[calc(100dvh-2rem)] overflow-y-auto`,I?`md:h-[min(50rem,calc(100dvh-4rem))] md:max-w-3xl md:grid-rows-[auto_minmax(0,1fr)_auto] md:overflow-hidden`:void 0),children:[(0,X.jsxs)(wr,{children:[(0,X.jsx)(yr,{children:`New project`}),(0,X.jsx)(Or,{children:`cezar creates a new git repository in your checkout root and adds it as a project.`})]}),(0,X.jsxs)(`div`,{"data-slot":`create-layout`,className:U(`grid gap-6`,I?`md:min-h-0 md:grid-cols-[minmax(0,5fr)_minmax(0,6fr)]`:void 0),children:[I?(0,X.jsx)(`div`,{"data-slot":`create-owners-column`,className:`min-w-0 md:flex md:min-h-0 md:flex-col md:border-r md:border-border md:pr-6`,children:S?(0,X.jsx)(Gu,{owners:C,value:w,disabled:F||!T,onChange:s}):(0,X.jsx)(qu,{})}):null,(0,X.jsxs)(`div`,{"data-slot":`create-form-column`,className:U(`grid min-w-0 content-start gap-4`,I?`md:-m-1 md:flex md:min-h-0 md:flex-col md:overflow-y-auto md:p-1`:void 0),children:[(0,X.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,X.jsx)(Iu,{htmlFor:`create-name`,children:`Name`}),(0,X.jsx)(Fs,{id:`create-name`,"data-slot":`create-name`,autoFocus:!0,placeholder:`my-project`,value:n,disabled:F,"aria-invalid":O!==null,"aria-describedby":`create-name-hint`,onChange:e=>r(Uu(e.target.value)),onKeyDown:e=>{e.key===`Enter`&&P()}}),O?(0,X.jsx)(`p`,{id:`create-name-hint`,"data-slot":`create-name-error`,className:`text-[12px] text-danger`,children:O}):(0,X.jsx)(`p`,{id:`create-name-hint`,"data-slot":`create-target`,className:`min-w-0 truncate font-mono text-[11.5px] text-soft-foreground`,title:j,children:j})]}),(0,X.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-border p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(Iu,{htmlFor:`create-github`,className:`flex items-center gap-1.5`,children:[(0,X.jsx)(Sc,{className:`size-3.5`,"aria-hidden":`true`}),`Create a private GitHub repository`]}),(0,X.jsx)(zu,{id:`create-github`,"data-slot":`create-github`,checked:T,disabled:F||!S,onCheckedChange:a})]}),h.isPending?(0,X.jsx)(`p`,{className:`text-[12px] text-muted-foreground`,children:`Checking GitHub…`}):S?null:(0,X.jsx)(`p`,{"data-slot":`create-github-unavailable`,className:`text-[12px] text-muted-foreground`,children:x&&!x.available?x.reason:`Could not read your GitHub accounts — the project will be created locally only.`}),T?(0,X.jsxs)(`p`,{className:`text-[12px] text-muted-foreground`,children:[`Created as `,(0,X.jsx)(`strong`,{children:`private`}),` under `,(0,X.jsx)(`strong`,{children:w}),` — you can change its visibility on GitHub.`]}):null]}),(0,X.jsxs)(`div`,{"data-slot":`create-start`,className:`grid gap-3 rounded-md border border-border p-3 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,X.jsx)(`span`,{id:`create-start-label`,className:`text-sm font-medium`,children:`Start with`}),(0,X.jsxs)(`div`,{role:`radiogroup`,"aria-labelledby":`create-start-label`,className:`grid gap-2 sm:grid-cols-2`,children:[(0,X.jsx)(Ku,{slot:`create-start-empty`,checked:!M,disabled:F,title:`Empty repository`,hint:`One empty commit, no files.`,onSelect:()=>d(`empty`)}),(0,X.jsx)(Ku,{slot:`create-start-template`,checked:M,disabled:F||!T,title:`From a template`,hint:T?`Copy a GitHub template.`:`Needs a GitHub repository.`,onSelect:()=>d(`template`)})]}),M?(0,X.jsxs)(`div`,{className:`grid gap-1.5 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,X.jsx)(Iu,{htmlFor:`create-template`,children:`Template`}),(0,X.jsx)(Hu,{id:`create-template`,value:c,disabled:F,onChange:l})]}):null]}),F?(0,X.jsx)(`p`,{"data-slot":`create-progress`,className:`truncate font-mono text-[11.5px] text-muted-foreground`,children:f??`Starting…`}):null,g.isError?(0,X.jsx)(`p`,{"data-slot":`create-error`,className:`whitespace-pre-line text-[13px] text-danger`,children:g.error instanceof Error?g.error.message:`could not create the project`}):null]})]}),(0,X.jsxs)(Tr,{children:[(0,X.jsx)(W,{variant:`outline`,disabled:F,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(W,{"data-slot":`create-confirm`,disabled:!D||F||N||i&&h.isPending,onClick:P,children:F?`Creating…`:`Create`})]})]})})}function Gu({owners:e,value:t,disabled:n,onChange:r}){let i=(0,Y.useRef)([]),a=(t,n)=>{if(e.length===0)return;let a=(t+n+e.length)%e.length,o=e[a]?.login;o!==void 0&&(r(o),i.current[a]?.focus())};return(0,X.jsxs)(`div`,{className:`grid gap-3 md:flex md:min-h-0 md:flex-1 md:flex-col`,children:[(0,X.jsx)(`span`,{id:`create-owner-label`,className:`text-[12px] font-semibold tracking-wider text-muted-foreground uppercase`,children:`Select organization`}),(0,X.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`create-owner-label`,"data-slot":`create-owner`,className:`-mx-1 grid max-h-64 content-start gap-2 overflow-y-auto px-1 py-0.5 md:max-h-none md:min-h-0 md:flex-1`,children:e.map((e,o)=>{let s=e.login===t;return(0,X.jsxs)(`button`,{ref:e=>{i.current[o]=e},type:`button`,role:`radio`,"aria-checked":s,tabIndex:s?0:-1,disabled:n,"data-slot":`create-owner-option`,"data-owner":e.login,onClick:()=>r(e.login),onKeyDown:e=>{e.key===`ArrowDown`||e.key===`ArrowRight`?(e.preventDefault(),a(o,1)):(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(e.preventDefault(),a(o,-1))},className:U(`flex w-full items-center gap-3 rounded-lg border bg-card px-3 py-2.5 text-left outline-none transition-colors`,`focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,s?`border-primary bg-primary/5`:`border-border hover:bg-muted/50`),children:[(0,X.jsx)(Ju,{owner:e}),(0,X.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5 truncate text-sm font-semibold`,children:[e.login,s?(0,X.jsx)(Yo,{className:`size-4 shrink-0 text-primary`,"aria-hidden":`true`}):null]}),e.personal?(0,X.jsx)(`span`,{className:`text-[12px] text-muted-foreground`,children:`Personal account`}):e.description?(0,X.jsx)(`span`,{className:`line-clamp-2 text-[12px] text-muted-foreground`,children:e.description}):null]})]},e.login)})})]})}function Ku({slot:e,checked:t,disabled:n,title:r,hint:i,onSelect:a}){return(0,X.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,disabled:n,"data-slot":e,onClick:a,className:U(`grid gap-0.5 rounded-md border px-3 py-2 text-left outline-none transition-colors`,`focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50`,t?`border-primary bg-primary/5`:`border-border hover:bg-muted/50`),children:[(0,X.jsx)(`span`,{className:`text-sm font-medium`,children:r}),(0,X.jsx)(`span`,{className:`text-[12px] text-muted-foreground`,children:i})]})}function qu(){return(0,X.jsxs)(`div`,{className:`grid gap-3`,"data-slot":`create-owners-loading`,"aria-hidden":`true`,children:[(0,X.jsx)(`span`,{className:`text-[12px] font-semibold tracking-wider text-muted-foreground uppercase`,children:`Select organization`}),[0,1].map(e=>(0,X.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-border px-3 py-2.5`,children:[(0,X.jsx)(`span`,{className:`size-9 shrink-0 animate-pulse rounded-full bg-muted`}),(0,X.jsx)(`span`,{className:`h-3 w-24 animate-pulse rounded bg-muted`})]},e))]})}function Ju({owner:e}){let[t,n]=(0,Y.useState)(!1),r=e.personal?`rounded-full`:`rounded-md`;return e.avatarUrl&&!t?(0,X.jsx)(`img`,{src:e.avatarUrl,alt:``,width:36,height:36,loading:`lazy`,onError:()=>n(!0),"data-slot":`create-owner-avatar`,className:U(`size-9 shrink-0 bg-muted`,r)}):(0,X.jsx)(`span`,{"aria-hidden":`true`,className:U(`flex size-9 shrink-0 items-center justify-center bg-muted text-sm font-semibold text-muted-foreground uppercase`,r),children:e.login.slice(0,1)})}var Yu=class extends Y.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){console.error(`[cezar] ${this.props.label} failed to render`,e),G(`${this.props.label} failed to open: ${e instanceof Error?e.message:String(e)}`,{tone:`danger`}),this.props.onError()}render(){return this.state.failed?null:this.props.children}};function Xu(e){return(0,X.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,...e,children:(0,X.jsx)(`path`,{d:`M12 1.9a10.1 10.1 0 0 0-3.2 19.7c.5.1.7-.2.7-.5v-1.8c-2.8.6-3.4-1.2-3.4-1.2-.5-1.2-1.1-1.5-1.1-1.5-.9-.6.1-.6.1-.6 1 .1 1.5 1 1.5 1 .9 1.6 2.4 1.1 3 .9.1-.7.4-1.1.6-1.4-2.2-.3-4.6-1.1-4.6-5 0-1.1.4-2 1-2.7-.1-.3-.4-1.3.1-2.7 0 0 .9-.3 2.8 1a9.6 9.6 0 0 1 5 0c1.9-1.3 2.8-1 2.8-1 .5 1.4.2 2.4.1 2.7.6.7 1 1.6 1 2.7 0 3.9-2.4 4.7-4.6 5 .4.3.7.9.7 1.9v2.8c0 .3.2.6.7.5A10.1 10.1 0 0 0 12 1.9z`})})}var Zu=[{to:`/`,label:`Tasks`,icon:xc,match:[`/`,`/tasks`,`/compare`],badge:`tasks-unread`},{to:`/inbox`,label:`Inbox`,icon:_c,match:[`/inbox`],badge:`inbox-count`,inbox:!0},{to:`/git`,label:`Git`,icon:os,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:Xu,match:[`/github`],forge:!0},{to:`/tracker`,label:`Tracker`,icon:Rc,match:[`/tracker`],tracker:!0},{to:`/automations`,label:`Automations`,icon:Va,match:[`/automations`],automations:!0},{to:`/skills`,label:`Skills`,icon:ya,match:[`/skills`],badge:`skills-update`},{to:`/workflows`,label:`Workflows`,icon:Mo,match:[`/workflows`]},{to:`/settings`,label:`Settings`,icon:Nc,match:[`/settings`]}];function Qu({forge:e=!1,inbox:t=!1,automations:n=!1,tracker:r}={}){return Zu.filter(i=>(!i.forge||e)&&(!i.inbox||t)&&(!i.automations||n)&&(!i.tracker||r!==void 0)).map(e=>e.tracker?{...e,label:r?Bc[r].label:e.label}:e)}function $u(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function ed(e){let t=null;for(let n of Zu)for(let r of n.match)$u(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function td(e){let t=ed(e);return Zu.find(e=>e.to===t)??null}var nd=`cez-theme`,rd=`(prefers-color-scheme: light)`,id=`dark`;function ad(e){return e===`light`||e===`dark`||e===`system`?e:id}function od(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function sd(){try{return ad(localStorage.getItem(nd))}catch{return id}}function cd(e){try{localStorage.setItem(nd,e)}catch{}}function ld(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(rd).matches}function ud(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t}var dd=Y.createContext(null);function fd({children:e}){let[t,n]=Y.useState(sd),[r,i]=Y.useState(ld);Y.useEffect(()=>{let e=window.matchMedia?.(rd);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=od(t,r);Y.useLayoutEffect(()=>{ud(document.documentElement,a)},[a]);let o=Y.useCallback(e=>{n(e),cd(e)},[]),s=Y.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,X.jsx)(dd.Provider,{value:s,children:e})}function pd(){let e=Y.useContext(dd);if(!e)throw Error(`cezar: useTheme() must be called inside <ThemeProvider>`);return e}var md={light:`dark`,dark:`system`,system:`light`},hd={light:Lc,dark:Dc,system:Ec},gd={light:`light`,dark:`dark`,system:`system`};function _d({className:e}){let{theme:t,setTheme:n}=pd(),r=md[t],i=hd[t];return(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":t,title:`Theme: ${gd[t]}`,"aria-label":`Theme: ${gd[t]}. Switch to ${gd[r]}.`,onClick:()=>n(r),children:(0,X.jsx)(i,{"aria-hidden":`true`})})}function vd(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();if(!(e===``||t.has(e))&&(t.add(e),t.size>=200))break}return[...t]}function yd(e){return[...e].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt))}function bd(e,t){let n=vd(t);if(n.length===0)return yd(e);let r=new Map(n.map((e,t)=>[e,t])),i=[],a=[];for(let t of e)r.has(t.id)?i.push(t):a.push(t);return i.sort((e,t)=>r.get(e.id)-r.get(t.id)),[...yd(a),...i]}function xd(e,t,n){return t===n||t<0||n<0||t>=e.length||n>=e.length?[...e]:Gr([...e],t,n)}var Sd=`regular`,Cd=[{value:`regular`,label:`Regular`},{value:`automation`,label:`Automations`},{value:`all`,label:`All`}],wd=`cez-task-origin`;function Td(e){return e.automationId??e.automation?.automationId??e.automationTrigger?.automationId??e.automationTracker?.automationId}function Ed(e,t){let n=Td(e);if(n!==void 0)return n;let r=e.dispatch?.rootRunId;if(r===void 0||r===e.id)return;let i=t(r);return i===void 0?void 0:Td(i)}function Dd(e,t){return t===`all`?!0:t===`automation`?e!==void 0:e===void 0}function Od(e){return e===`regular`||e===`automation`||e===`all`?e:Sd}function kd(){try{return Od(localStorage.getItem(wd))}catch{return Sd}}var Ad=new Set,jd;function Md(e){try{localStorage.setItem(wd,e)}catch{jd=e}for(let e of Ad)e()}function Nd(){return jd??kd()}function Pd(e){Ad.add(e);let t=t=>{(t.key===null||t.key===`cez-task-origin`)&&e()};return window.addEventListener(`storage`,t),()=>{Ad.delete(e),window.removeEventListener(`storage`,t)}}function Fd(){return[Y.useSyncExternalStore(Pd,Nd,()=>Sd),Md]}var Id=`cezar:open-task-palette`;function Ld(e){window.dispatchEvent(new CustomEvent(Id,{detail:e}))}function Rd(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function zd(){let e=V(),t=Ue(),n=Y.useRef(0),r=Y.useRef(Promise.resolve()),i=Y.useMemo(()=>vd(t.data?.sidebar?.projectOrder),[t.data?.sidebar?.projectOrder]),a=Y.useCallback(t=>{let i=e.getQueryData(R.uiState);if(i===void 0)return;let{projectOrder:a,...o}=Rd(i.sidebar),s=t===null?o:{...o,projectOrder:t};e.setQueryData(R.uiState,{...i,sidebar:s});let c=++n.current,l=r.current.then(async()=>{let t=await v({sidebar:s},{keepalive:!0});c===n.current&&e.setQueryData(R.uiState,t)});r.current=l.catch(t=>{G(t instanceof Error?t.message:String(t),{tone:`danger`}),c===n.current&&e.invalidateQueries({queryKey:R.uiState})})},[e]),o=Y.useCallback(e=>{let t=vd(e);t.length!==0&&a(t.slice(0,200))},[a]),s=Y.useCallback(()=>a(null),[a]);return{order:i,canReorder:t.data!==void 0,setOrder:o,reset:s}}var Bd=`cezar:open-command-palette`;function Vd(){window.dispatchEvent(new Event(Bd))}function Hd(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function Ud(e,t,n){let r=t.trim().toLowerCase();if(r===``)return 1;let i=(n?.length?`${e} ${n.join(` `)}`:e).toLowerCase(),a=r.split(/\s+/),o=0;for(let[e,t]of a.entries()){let n=e=>e!==void 0&&/^#?\d+$/.test(e),r=n(t)||/^(pr|issue)$/.test(t)&&n(a[e+1]),s=0;for(let e=i.indexOf(t);e!==-1;e=i.indexOf(t,e+1)){let n=e===0||!/[a-z0-9]/.test(i[e-1]??``),a=!/[a-z0-9]/.test(i[e+t.length]??``);s=Math.max(s,r&&n&&a?1:(n?1:.5)*(a?1:.8)/(1+e/48))}if(s===0)return 0;o+=s}return o/a.length}var Wd=e=>({pullRequestUrl:e.pullRequestUrl,referencedPullRequestUrl:e.referencedPullRequestUrl,referencedPrCandidates:e.referencedPrCandidates,prNumber:e.prNumber,prRefs:e.prRefs,issueNumber:e.issueNumber,referencedIssueUrl:e.referencedIssueUrl,referencedIssueCandidates:e.referencedIssueCandidates,markerRefs:e.markerRefs});function Gd(e,t,n){let r=Hd(e).map(e=>({projectId:t,id:e.id,title:e.title,titleSummary:e.titleSummary,titleOrigin:e.titleOrigin,status:e.status,activity:e.activity,createdAt:e.createdAt,finishedAt:e.finishedAt,seenAt:e.seenAt,archived:e.archived,autoResumeAt:e.autoResumeAt,awaitingAnswerSince:e.awaitingAnswerSince,workflow:e.workflow,branch:e.branch,startedAt:e.startedAt,lastActivityAt:ln(e),...rf(Wd(e)),...rf({automationId:Td(e),dispatch:e.dispatch&&{rootRunId:e.dispatch.rootRunId,parentRunId:e.dispatch.parentRunId,kind:e.dispatch.kind}})})),i=new Set(r.map(af)),a=(n??[]).filter(e=>!i.has(af(e))).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),o=[...r,...a],s=new Map(o.map(e=>[e.id,e]));return o.map(e=>{if(e.automationId!==void 0)return e;let t=Ed(e,e=>s.get(e));return t===void 0?e:{...e,automationId:t}})}var Kd=`w-12 text-right`;function qd({label:e}){return(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1`,children:e}),(0,X.jsxs)(`span`,{"aria-hidden":`true`,className:`flex shrink-0 gap-1 text-[11px] font-normal`,children:[(0,X.jsx)(`span`,{className:U(Kd,`after:content-['Updated']`)}),(0,X.jsx)(`span`,{className:U(Kd,`after:content-['Created']`)})]})]})}function Jd(e){return e.status===`running`&&e.activity!==`monitoring`}function Yd(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:Zd().format(t)}var Xd,Zd=()=>Xd??=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function Qd(e,t,n=new Map){return e.map(e=>{let r=he(e),i=vt(e,e.projectId===null?void 0:n.get(e.projectId)),a=i.map(e=>`${e.kind} #${e.number}`).join(` `),o=e.projectId===null?null:t.get(e.projectId)??null;return{task:e,key:af(e),label:r,references:a,refList:i,value:`task ${r} ${a} ${e.id}`,keywords:[...o?[o]:[],...e.automationId?[`automation`,`automatic`]:[]],projectName:o,title:`${Jd(e)?`Working now`:`Updated ${Yd(e.lastActivityAt)}`} · created ${Yd(e.createdAt)}`}})}function $d(e,t,n=50){if(t.trim()===``)return{shown:e.slice(0,n),total:e.length};let r=[];return e.forEach((e,n)=>{let i=Ud(e.value,t,e.keywords);i>0&&r.push({entry:e,score:i,index:n})}),r.sort((e,t)=>t.score-e.score||e.index-t.index),{shown:r.slice(0,n).map(e=>e.entry),total:r.length}}function ef({entries:e,children:t}){let n=We(),r=Y.useMemo(()=>e.flatMap(e=>e.refList.map(t=>({projectId:e.task.projectId??n??``,kind:t.kind,number:t.number}))).filter(e=>e.projectId!==``),[e,n]),i=r.map(e=>`${e.projectId} ${e.kind}#${e.number}`).join(`|`),a=Y.useRef(r);a.current=r;let[o,s]=Y.useState(r);return Y.useEffect(()=>{let e=setTimeout(()=>s(a.current),250);return()=>clearTimeout(e)},[i]),(0,X.jsx)(Sr,{projectId:n,requests:o,children:t})}var tf=`[&_[cmdk-group-items]]:flex [&_[cmdk-group-items]]:flex-col`;function nf({hidden:e}){return e<=0?null:(0,X.jsxs)(mi,{forceMount:!0,disabled:!0,value:`__more-tasks`,"data-slot":`palette-more-tasks`,className:`order-last py-1.5! text-xs text-soft-foreground data-[disabled=true]:opacity-100`,children:[e,` more — keep typing to narrow`]})}function rf(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}var af=e=>`${e.projectId??``}/${e.id}`;function of(e){let t=e.filter(e=>ma(e)).sort((e,t)=>(t.finishedAt??``).localeCompare(e.finishedAt??``)),n=new Set(t.map(af));return{recentlyFinished:t,otherTasks:e.filter(e=>!n.has(af(e)))}}function sf(e,t,n=[]){let r=bd(e,n);return[...r.filter(e=>e.id!==t),...r.filter(e=>e.id===t)]}function cf(){let e=dr(),t=A(),n=Dt(),r=t.data,i=r?.bootProject??n.data?.bootProject??null,a=Pe(e,i),o=r!==void 0&&r.projects.length>1,s=D(o),c=s.data?.referenceStatuses;Y.useEffect(()=>{c&&Ct(c)},[c]);let l=Y.useMemo(()=>new Map((r?.projects??[]).map(e=>[e.id,e.name])),[r]),u=(e==="default"?null:e)??i,d=Y.useMemo(()=>Gd(a.data??[],u,s.data?.runs),[a.data,u,s.data]),f=Re();return{activeProjectId:e,registry:r,health:n,multiProject:o,projectNames:l,repoBases:Y.useMemo(()=>{let e=new Map;for(let t of r?.projects??[])t.repoUrl&&e.set(t.id,t.repoUrl);return u&&f&&!e.has(u)&&e.set(u,f),e},[r,u,f]),runsProjectId:u,tasks:d}}function lf(e,t=``){let n=`/tasks/${e.id}${t}`;return e.projectId===null?n:$n(e.projectId,n)}var uf=`cezar:palette-opened`;function df(e){window.dispatchEvent(new CustomEvent(uf,{detail:e}))}function ff(e,t,n){Y.useEffect(()=>{t&&df(e)},[t,e]),Y.useEffect(()=>{let t=t=>{t.detail!==e&&n()};return window.addEventListener(uf,t),()=>window.removeEventListener(uf,t)},[e,n])}function pf(){let[e,t]=Y.useState(!1),n=tr();vo(`k`,()=>t(e=>!e));let r=Y.useCallback(()=>{t(!1),n(`/new`)},[n]);vo(`n`,r),Ka(`c`,r),Y.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(Bd,e),()=>window.removeEventListener(Bd,e)},[]);let i=Y.useCallback(()=>t(!1),[]);return ff(`command`,e,i),Y.useEffect(()=>{e&&wa(`command`)},[e]),(0,X.jsx)(bi,{open:e,onOpenChange:e=>{e||Ia(`command`),t(e)},title:`Command palette`,description:`Search projects, tasks, views, actions, and skills`,showCloseButton:!1,filter:Ud,commandProps:{onKeyDown:Y.useCallback(e=>{if(e.key!==`Tab`||e.shiftKey||e.altKey||e.metaKey||e.ctrlKey)return;let n=e.currentTarget.querySelector(`[cmdk-item][data-selected="true"][data-slot="palette-task"]`),r=n?.dataset.runId;r&&(e.preventDefault(),ga(`cmdk_tab`),t(!1),Ld({runId:r,projectId:n.dataset.projectId??null}))},[])},className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,X.jsx)(hf,{close:i})})}var mf=Y.memo(function({entry:e,showProject:t,now:n,onSelect:r,slot:i=`palette-task`,current:a=!1}){let{task:o,label:s,projectName:c}=e,l=re(o),u=o.projectId?e.refList[0]:void 0;return(0,X.jsxs)(mi,{value:e.value,keywords:e.keywords,"data-slot":i,"data-run-id":o.id,"data-project-id":o.projectId??void 0,onSelect:()=>r(o),children:[(0,X.jsx)(Is,{tone:l.tone,pulse:l.pulse,"aria-label":l.label,role:`img`}),u&&o.projectId?(0,X.jsx)(`span`,{"data-slot":`palette-task-refs`,className:`flex shrink-0 items-center gap-1 [&_svg]:size-3!`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,X.jsx)(Gi,{run:o,projectId:o.projectId,reference:u,compact:!0,className:`h-auto shrink-0 gap-[2px] px-1.5 py-px text-[10.5px]`})}):null,(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:s,children:S(s,u?.number)?de(s).rest:s}),o.automationId?(0,X.jsxs)(`span`,{"data-slot":`palette-task-automation`,title:`Started by an automation`,className:`flex shrink-0 items-center gap-0.5 text-xs text-soft-foreground`,children:[(0,X.jsx)(Va,{"aria-hidden":`true`,className:`size-3!`}),`auto`]}):null,t&&c?(0,X.jsx)(`span`,{"data-slot":`palette-task-project`,className:`shrink-0 truncate text-xs text-soft-foreground`,children:c}):null,a?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-primary`,children:`open`}):null,(0,X.jsxs)(`span`,{"data-slot":`palette-task-age`,title:e.title,className:`flex shrink-0 gap-1 text-xs tabular-nums`,children:[(0,X.jsx)(`span`,{"data-slot":`palette-task-updated`,className:U(Kd,`text-muted-foreground`),children:Jd(o)?`now`:Ls(o.lastActivityAt,n)}),(0,X.jsx)(`span`,{"data-slot":`palette-task-created`,className:U(Kd,`text-soft-foreground`),children:Ls(o.createdAt,n)})]})]})});function hf({close:e}){let t=tr(),n=Xn(),[r,i]=Y.useState(``),a=r.trim()!==``,o=Y.useRef(new Set);Y.useEffect(()=>{for(let e of za(r))o.current.add(e)},[r]),Y.useEffect(()=>()=>Ma(o.current),[]);let{theme:s,setTheme:c}=pd(),{activeProjectId:l,registry:u,health:d,multiProject:f,projectNames:p,repoBases:m,tasks:h}=cf(),g=pe(),_=Le(),[v]=Y.useState(Date.now),{order:y}=zd(),b=Y.useMemo(()=>f&&u?sf(u.projects,l,y):[],[f,u,l,y]),x=Y.useMemo(()=>{let{recentlyFinished:e,otherTasks:t}=of(h);return{all:Qd(h,p,m),recentlyFinished:Qd(e,p,m),otherTasks:Qd(t,p,m)}},[h,p,m]),S=a?{shown:[],total:0}:$d(x.recentlyFinished,``,20),C=$d(a?x.all:x.otherTasks,r),w=f,T=_.data?.skillUsage,E=Y.useMemo(()=>Za(g.data??[],T),[g.data,T]),D=n=>{e(),t(n)},O=t=>{e(),n(t)},k=n=>{e(),t($n(n,`/`))},A=Y.useCallback(n=>{ga(`cmdk`),e(),t(lf(n))},[e,t]),j=md[s];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(gi,{placeholder:`Search projects, tasks, views, actions, skills…`,value:r,onValueChange:i}),(0,X.jsxs)(di,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:[(0,X.jsx)(ci,{children:`Nothing matches.`}),(0,X.jsx)(li,{children:(0,X.jsxs)(mi,{value:`new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>D(`/new`),children:[(0,X.jsx)(_s,{"aria-hidden":`true`}),`New task`,(0,X.jsx)(ai,{children:`C`})]})}),(0,X.jsxs)(ef,{entries:[...S.shown,...C.shown],children:[!a&&S.shown.length>0?(0,X.jsxs)(li,{heading:(0,X.jsx)(qd,{label:`Recently finished`}),className:tf,children:[S.shown.map(e=>(0,X.jsx)(mf,{entry:e,showProject:w,now:v,onSelect:A},e.key)),(0,X.jsx)(nf,{hidden:S.total-S.shown.length})]}):null,(0,X.jsxs)(li,{heading:`Views`,children:[f?(0,X.jsxs)(mi,{value:`view All tasks`,"data-slot":`palette-view`,"data-nav-to":`/tasks`,onSelect:()=>O(`/tasks`),children:[(0,X.jsx)(bc,{"aria-hidden":`true`}),`All tasks`]}):null,Qu({forge:d.data?.forge?.available===!0,inbox:d.data?.capabilities.followups===!0,automations:d.data?.capabilities.automations===!0,tracker:u?.projects.find(e=>e.id===(l??u.bootProject))?.tracker}).map(e=>{let t=e.icon;return(0,X.jsxs)(mi,{value:`view ${e.label}`,"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>D(e.to),children:[(0,X.jsx)(t,{"aria-hidden":`true`}),e.label]},e.to)}),(0,X.jsxs)(mi,{value:`view global settings`,"data-slot":`palette-view`,"data-nav-to":`/settings/global`,onSelect:()=>O(`/settings/global`),children:[(0,X.jsx)(Nc,{"aria-hidden":`true`}),`Global settings`]})]}),b.length>0?(0,X.jsx)(li,{heading:`Projects`,children:b.map(e=>{let t=e.id===l,n=e.status===`missing`;return(0,X.jsxs)(mi,{value:`project ${e.name} ${e.id}`,keywords:[e.root],"data-slot":`palette-project`,"data-project-id":e.id,disabled:n,onSelect:()=>k(e.id),children:[(0,X.jsx)(dc,{"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)(Fo,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id)})}):null,C.shown.length>0?(0,X.jsxs)(li,{heading:(0,X.jsx)(qd,{label:`Tasks`}),className:tf,children:[C.shown.map(e=>(0,X.jsx)(mf,{entry:e,showProject:w,now:v,onSelect:A},e.key)),(0,X.jsx)(nf,{hidden:C.total-C.shown.length})]}):null]}),(0,X.jsx)(li,{heading:`Actions`,children:(0,X.jsxs)(mi,{value:`action toggle theme`,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{c(j),e()},children:[(0,X.jsx)(Dc,{"aria-hidden":`true`}),`Toggle theme`,(0,X.jsxs)(ai,{className:`tracking-normal`,children:[s,` → `,j]})]})}),E.length>0?(0,X.jsx)(li,{heading:`Skills`,children:E.map(e=>(0,X.jsxs)(mi,{value:`skill ${e.name} ${e.path}`,keywords:e.description?[e.description]:void 0,"data-slot":`palette-skill`,"data-skill":e.name,onSelect:()=>D(`/new?skill=${encodeURIComponent(e.name)}`),children:[(0,X.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.path))}):null]})]})}function gf({className:e}){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search — command palette (⌘K / Ctrl+K)`,onClick:()=>Vd(),className:U(`flex w-full items-center gap-1.5 rounded-md border border-border bg-muted/30 px-2 py-1 text-left text-xs font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground`,e),children:[(0,X.jsx)(Nr,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate`,children:`Search…`}),(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`ml-auto shrink-0 rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:Ja(`k`)})]})}function _f(e){let t=cr(e);return t===`/settings`||t.startsWith(`/settings/`)}var vf=`https://github.com/open-mercato/cezar`,yf=`cez:star-toast-seen`;function bf(e){if(!Number.isFinite(e)||e<0)return`0`;let t=Math.floor(e);if(t<1e3)return String(t);let n=t/1e3,r=Math.floor(n*10)/10;return r<100?`${r.toFixed(1).replace(/\.0$/,``)}k`:`${Math.floor(n)}k`}var xf=`cez:star-ask`,Sf=1500;function Cf(e=Of()){if(!e)return null;try{let t=e.getItem(xf);if(t!==null){let e=JSON.parse(t);return{asks:Number.isInteger(e.asks)&&e.asks>=0?e.asks:3,...typeof e.lastAskedAt==`string`?{lastAskedAt:e.lastAskedAt}:{},...e.outcome===`starred`||e.outcome===`never`?{outcome:e.outcome}:{}}}let n=e.getItem(yf);return n===null?{asks:0}:{asks:1,lastAskedAt:n}}catch{return null}}function wf(e,t=Of()){try{t?.setItem(xf,JSON.stringify(e))}catch{}}function Tf(e,t){if(!e||e.outcome||e.asks>=3)return!1;if(!e.lastAskedAt)return!0;let n=Date.parse(e.lastAskedAt);return!Number.isFinite(n)||t-n>=12096e5}function Ef(e){return(e??[]).filter(e=>kf.has(e.status)).length}function Df(e){return e.visible&&e.focused&&!e.typing&&!e.dialogOpen&&e.now-e.lastInteractionAt>=0&&e.now-e.lastInteractionAt<=6e4}function Of(){try{return globalThis.localStorage??null}catch{return null}}var kf=new Set([`done`,`review`]);function Af(e,t){let n=new Map,r=!1,i=!1;for(let a of t??[]){n.set(a.id,a.status);let t=e.get(a.id);t===void 0||t===a.status||kf.has(a.status)&&(r=!0,a.pullRequestUrl&&(i=!0))}return{succeeded:r,withPullRequest:i,statuses:n}}var jf=[`354.6,217.3 511.0,307.6 421.0,359.6 354.6,321.2 267.9,371.2 267.9,471.3 444.6,573.3 354.6,625.3 177.9,523.3 177.9,319.3`,`177.9,284.6 354.6,182.6 354.6,78.7 177.9,180.7`,`354.6,372.3 397.0,396.8 397.0,445.8 354.6,470.3 312.1,445.8 312.1,396.8`,`483.7,372.3 526.1,396.8 526.1,445.8 483.7,470.3 441.2,445.8 441.2,396.8`],Mf={x:177.9,y:78.7,width:348.2,height:546.6},Nf={mark:26,name:19,gap:11.4};function Pf({height:e=Nf.mark,className:t}){return(0,X.jsx)(`svg`,{"data-slot":`brand-mark`,"aria-hidden":`true`,focusable:`false`,viewBox:`${Mf.x} ${Mf.y} ${Mf.width} ${Mf.height}`,height:e,width:e*Mf.width/Mf.height,fill:`currentColor`,className:U(`shrink-0`,t),children:jf.map(e=>(0,X.jsx)(`polygon`,{points:e},e))})}function Ff({className:e,name:t=`cezar`,logoUrl:n=null}){return(0,X.jsxs)(`span`,{"data-slot":`brand-lockup`,className:U(`flex min-w-0 items-center text-foreground`,e),style:{gap:Nf.gap},children:[n?(0,X.jsx)(`img`,{"data-slot":`brand-logo`,src:n,alt:``,className:`size-[26px] shrink-0 object-contain`}):(0,X.jsx)(Pf,{}),(0,X.jsx)(`span`,{"data-slot":`brand-name`,className:U(`max-w-full truncate leading-none font-semibold tracking-normal`,t===`cezar`&&`lowercase`),style:{fontFamily:`var(--brand)`,fontSize:Nf.name},children:t})]})}function If({...e}){return(0,X.jsx)(ll,{"data-slot":`select`,...e})}function Lf({...e}){return(0,X.jsx)(pl,{"data-slot":`select-value`,...e})}function Rf({className:e,size:t=`default`,children:n,...r}){return(0,X.jsxs)(dl,{"data-slot":`select-trigger`,"data-size":t,className:U(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-card px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,X.jsx)(hl,{asChild:!0,children:(0,X.jsx)(zo,{className:`size-4 opacity-50`})})]})}function zf({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,X.jsx)(yl,{children:(0,X.jsxs)(xl,{"data-slot":`select-content`,className:U(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,X.jsx)(Vf,{}),(0,X.jsx)(Il,{className:U(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,X.jsx)(Hf,{})]})})}function Bf({className:e,children:t,...n}){return(0,X.jsxs)(Kl,{"data-slot":`select-item`,className:U(`relative flex w-full cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,X.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,X.jsx)(Xl,{children:(0,X.jsx)(Fo,{className:`size-4`})})}),(0,X.jsx)(Jl,{children:t})]})}function Vf({className:e,...t}){return(0,X.jsx)(Ql,{"data-slot":`select-scroll-up-button`,className:U(`flex cursor-pointer items-center justify-center py-1`,e),...t,children:(0,X.jsx)(tc,{className:`size-4`})})}function Hf({className:e,...t}){return(0,X.jsx)(eu,{"data-slot":`select-scroll-down-button`,className:U(`flex cursor-pointer items-center justify-center py-1`,e),...t,children:(0,X.jsx)(zo,{className:`size-4`})})}function Uf(e){return/^\d/.test(e)&&!e.includes(`+`)?`v${e}`:e}function Wf(e,t){return!!t&&e.activeRuns>0&&e.scheduled?.target!==t}function Gf({label:e=`Update when idle`,doing:t,onClick:n,disabled:r}){return(0,X.jsx)(Wo,{delayDuration:300,children:(0,X.jsxs)(Ko,{children:[(0,X.jsx)(Bo,{asChild:!0,children:(0,X.jsx)(W,{variant:`outline`,size:`sm`,onClick:n,disabled:r,children:e})}),(0,X.jsxs)(Ho,{"data-slot":`update-when-idle-tooltip`,side:`bottom`,className:`max-w-64`,children:[`Waits until no task is running or queued, then `,t,` and restarts. Tasks waiting on your reply don't hold it up. You can close this window and keep working.`]})]})})}function Kf(e){let t=/-pr(\d+)\./.exec(e);return t?Number(t[1]):null}function qf({data:e,onApply:t,onSchedule:n,applying:r}){let i=f(),o=a(),[s,c]=(0,Y.useState)(`worktrees`),[l,u]=(0,Y.useState)(``),[d,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=e.job?.status===`running`||e.job?.status===`restarting`,_=e.installed.find(e=>e.active),v=i.data?.checkouts??[],y=i.data?.pulls,b=!i.data||v.length>0,x=b?s:`pulls`,S=l.trim().toLowerCase(),C=(0,Y.useMemo)(()=>v.filter(e=>!S||[e.branch,e.task?.title,e.task?.id,e.commit?.subject,e.worktree,e.pr?`#${e.pr}`:``].filter(Boolean).some(e=>e.toLowerCase().includes(S))),[v,S]),w=(0,Y.useMemo)(()=>(y?.items??[]).filter(e=>!e.version&&!m?!1:!S||[`#${e.number}`,String(e.number),e.title,e.branch,e.author??``].some(e=>e.toLowerCase().includes(S))),[y,S,m]),T=(y?.items??[]).filter(e=>!e.version).length,E=x===`worktrees`?v.find(e=>e.id===d):void 0,D=x===`pulls`?y?.items.find(e=>e.version&&e.version===d):void 0,O=E?.id??D?.version??null,k=!!E&&(!E.built||E.stale),A=!!O&&O===_?.id&&!k,j=D&&!D.installed?`Install & restart`:k?`${E.built?`Rebuild`:`Build`} & ${E.id===_?.id?`restart`:`switch`}`:`Switch & restart`;return(0,X.jsxs)(`div`,{"data-slot":`self-update-development`,className:`flex min-w-0 flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsx)(`div`,{role:`tablist`,"aria-label":`Development builds`,className:`flex rounded-md border border-border bg-muted/40 p-0.5`,children:[...b?[{value:`worktrees`,label:`Worktrees`,count:v.length}]:[],{value:`pulls`,label:`Pull requests`,count:(y?.items.length??0)-T}].map(e=>(0,X.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":x===e.value,onClick:()=>{c(e.value),p(null)},className:U(`rounded-[5px] px-3 py-1 text-[12.5px] font-semibold transition-colors`,x===e.value?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[e.label,i.data?(0,X.jsx)(`span`,{className:`ml-1.5 font-normal text-muted-foreground`,children:e.count}):null]},e.value))}),(0,X.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>o.mutate(),disabled:o.isPending||i.isFetching,children:o.isPending?`Refreshing…`:`Refresh`})]}),(0,X.jsx)(Fs,{"aria-label":`Filter`,value:l,onChange:e=>u(e.target.value),placeholder:x===`worktrees`?`Filter by task, branch, commit or #PR`:`Filter by #number, title, branch or author`,className:`h-8 text-[13px]`}),(0,X.jsx)(`div`,{className:`max-h-72 min-h-24 overflow-y-auto rounded-md border border-border`,children:i.isPending?(0,X.jsx)(`p`,{className:`px-3 py-3 text-[12.5px] text-muted-foreground`,children:`Looking for worktrees and pull requests…`}):i.error?(0,X.jsx)(`p`,{className:`px-3 py-3 text-[12.5px] text-danger`,children:i.error.message}):x===`worktrees`?(0,X.jsxs)(X.Fragment,{children:[C.length===0?(0,X.jsx)(`p`,{className:`px-3 py-3 text-[12.5px] text-muted-foreground`,children:`Nothing matches.`}):null,(0,X.jsx)(`div`,{role:`listbox`,"aria-label":`Worktrees`,children:C.map(e=>(0,X.jsx)(Yf,{checkout:e,active:e.id===_?.id,selected:d===e.id,onSelect:()=>p(e.id)},e.worktree))})]}):(0,X.jsxs)(X.Fragment,{children:[y&&!y.available?(0,X.jsx)(`p`,{className:`px-3 py-2 text-[12px] text-muted-foreground`,children:y.reason}):null,y?.available&&w.length===0?(0,X.jsx)(`p`,{className:`px-3 py-3 text-[12.5px] text-muted-foreground`,children:y.items.length===0?`No open pull requests on ${y.repo}.`:S?`Nothing matches.`:`No open pull request has a preview build.`}):null,(0,X.jsx)(`div`,{role:`listbox`,"aria-label":`Pull requests`,children:w.map(e=>(0,X.jsx)(Xf,{pull:e,active:!!e.version&&e.version===_?.id,selected:!!e.version&&d===e.version,onSelect:()=>e.version&&p(e.version)},e.number))}),T>0?(0,X.jsx)(`button`,{type:`button`,onClick:()=>h(e=>!e),className:`w-full border-t border-border px-3 py-2 text-left text-[12px] text-muted-foreground hover:text-foreground`,children:m?`Hide the ${T} without a preview build`:`${T} more without a preview build (forks, CI not green yet) — show`}):null]})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,X.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[11.5px] text-muted-foreground`,title:E?.worktree,children:E?k?`${E.built?`Built before its last commit`:`Not built yet`} — runs npm run build in ${E.worktree} first (about a minute).`:E.worktree:D?`Installs ${D.version} from npm.`:x===`worktrees`?`Linked, not copied: a worktree that is not built, or built before its last commit, is built before the switch.`:`Preview builds CI publishes for green same-repo pull requests.`}),!A&&Wf(e,O)?(0,X.jsx)(Gf,{label:`When idle`,doing:D?`${D.installed?`switches to`:`installs`} PR #${D.number}'s build`:`${k?`builds and switches to`:`switches to`} ${E.branch}`,onClick:()=>n(O),disabled:!e.canSelfUpdate||r||g}):null,(0,X.jsx)(W,{size:`sm`,variant:`contrast`,onClick:()=>O&&t(O),disabled:!O||A||!e.canSelfUpdate||r||g,children:j})]})]})}function Jf({selected:e,disabled:t,onSelect:n,title:r,children:i}){return(0,X.jsx)(`div`,{role:`option`,"aria-selected":e,"aria-disabled":t,tabIndex:t?-1:0,title:r,onClick:()=>!t&&n(),onKeyDown:e=>{!t&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},className:U(`flex min-w-0 flex-col gap-0.5 border-b border-border px-3 py-2 last:border-b-0 outline-none`,t?`cursor-not-allowed opacity-55`:`cursor-pointer hover:bg-muted/50 focus-visible:bg-muted/60`,e&&`bg-primary/10 hover:bg-primary/10`),children:i})}function Yf({checkout:e,active:t,selected:n,onSelect:r}){let i=e.task?.title??e.commit?.subject??e.branch;return(0,X.jsxs)(Jf,{selected:n,disabled:!e.id,onSelect:r,title:e.worktree,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:i}),e.pr?(0,X.jsxs)(ku,{variant:`outline`,children:[`#`,e.pr]}):null,t?(0,X.jsx)(ku,{variant:`secondary`,children:`current`}):null,e.built?e.stale?(0,X.jsx)(ku,{variant:`outline`,children:`needs rebuild`}):null:(0,X.jsx)(ku,{variant:`outline`,children:`not built`})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11.5px] text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono`,children:e.branch}),e.task?(0,X.jsxs)(`span`,{className:`shrink-0`,children:[`· `,e.task.status]}):null,e.commit?(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,e.commit.sha,` `,e.task?e.commit.subject:``,` · `,Ls(e.commit.at),` ago`]}):null,e.builtAt?(0,X.jsxs)(`span`,{className:`shrink-0`,children:[`· built `,Ls(e.builtAt),` ago`]}):null]})]})}function Xf({pull:e,active:t,selected:n,onSelect:r}){return(0,X.jsxs)(Jf,{selected:n,disabled:!e.version,onSelect:r,title:e.url,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsxs)(`span`,{className:`shrink-0 text-[13px] text-muted-foreground`,children:[`#`,e.number]}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:e.title}),e.draft?(0,X.jsx)(ku,{variant:`outline`,children:`draft`}):null,t?(0,X.jsx)(ku,{variant:`secondary`,children:`current`}):e.version?e.installed?(0,X.jsx)(ku,{variant:`outline`,children:`installed`}):null:(0,X.jsx)(ku,{variant:`outline`,children:`no build`})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11.5px] text-muted-foreground`,children:[e.author?(0,X.jsx)(`span`,{className:`shrink-0`,children:e.author}):null,(0,X.jsxs)(`span`,{className:`min-w-0 truncate font-mono`,children:[`· `,e.branch]}),(0,X.jsxs)(`span`,{className:`shrink-0`,children:[`· updated `,Ls(e.updatedAt),` ago`]}),e.version?(0,X.jsxs)(`span`,{className:`shrink-0`,children:[`· build `,e.publishedAt?`${Ls(e.publishedAt)} ago`:e.version]}):null]})]})}function Zf({open:e,onOpenChange:t,autoApply:n,brandName:r=`cezar`}){let i=Pt(e),a=Ce(),o=ce(),s=st(),c=C(),l=qt(),[u,d]=(0,Y.useState)(``),f=i.data,p=(0,Y.useRef)(null),m=(0,Y.useRef)(!1);return(0,Y.useEffect)(()=>{!n||m.current||!f||!f.canSelfUpdate||f.job||(m.current=!0,!(f.activeRuns>0)&&s.mutate(n))},[n,f,s]),(0,X.jsx)(Cr,{open:e,onOpenChange:e=>{!e&&f?.job?.status===`running`||t(e)},children:(0,X.jsxs)(Ar,{"data-slot":`self-update-dialog`,className:`sm:max-w-xl`,ref:p,onOpenAutoFocus:e=>{e.preventDefault(),p.current?.focus()},children:[(0,X.jsxs)(wr,{children:[(0,X.jsxs)(yr,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(`span`,{children:[r,` `,f?`v${f.version}`:``]}),(0,X.jsx)(rp,{data:f})]}),(0,X.jsxs)(Or,{className:`sr-only`,children:[`Update `,r,`, pick a release channel or switch versions.`]})]}),f?(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5`,children:[(0,X.jsx)(ep,{data:f,busy:o.isPending,onChange:e=>{d(``),o.mutate(e)}}),(0,X.jsx)(tp,{data:f,checking:a.isPending,onCheck:()=>a.mutate(),onApply:e=>s.mutate(e),onSchedule:e=>c.mutate(e),applying:s.isPending||c.isPending}),f.channel===`development`?(0,X.jsx)(qf,{data:f,onApply:e=>s.mutate(e),onSchedule:e=>c.mutate(e),applying:s.isPending||c.isPending}):(0,X.jsx)(np,{data:f,picked:u,onPick:d,onApply:e=>s.mutate(e),onSchedule:e=>c.mutate(e),applying:s.isPending||c.isPending}),f.canSelfUpdate?null:(0,X.jsx)(ip,{data:f}),f.scheduled?(0,X.jsxs)(`div`,{"data-slot":`self-update-scheduled`,className:`flex items-center justify-between gap-3 rounded-md border border-primary/40 bg-primary/5 px-3 py-2 text-[12.5px]`,children:[(0,X.jsxs)(`p`,{className:`min-w-0`,children:[r,` switches to `,(0,X.jsx)(`span`,{className:`font-semibold`,children:Uf(f.scheduled.target)}),` as soon as no task is running. You can close this window and keep working.`]}),(0,X.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>l.mutate(),disabled:l.isPending,children:`Cancel`})]}):f.activeRuns>0&&f.canSelfUpdate?(0,X.jsxs)(`p`,{className:`rounded-md border border-pending/50 bg-pending/10 px-3 py-2 text-[12.5px] text-foreground`,children:[f.activeRuns,` task`,f.activeRuns===1?` is`:`s are`,` running. A restart interrupts them; `,r,` re-queues or resumes them on the way back up.`,` `,`The “when idle” buttons wait for them to finish instead.`]}):null,o.error?(0,X.jsxs)(`p`,{className:`text-[12.5px] text-danger`,children:[`Could not switch the channel: `,o.error.message,o.variables===`development`?` The running ${r} server predates the Development channel — restart ${r} to load it.`:null]}):null,s.error?(0,X.jsx)(`p`,{className:`text-[12.5px] text-danger`,children:s.error.message}):null,c.error?(0,X.jsx)(`p`,{className:`text-[12.5px] text-danger`,children:c.error.message}):null,l.error?(0,X.jsx)(`p`,{className:`text-[12.5px] text-danger`,children:l.error.message}):null,f.job?(0,X.jsx)(ap,{data:f}):null]}):i.error?(0,X.jsx)(`p`,{className:`text-[13px] text-danger`,children:i.error.message}):null]})})}var Qf=[{value:`stable`,label:`Stable`},{value:`nightly`,label:`Nightly`},{value:`development`,label:`Development`}],$f={stable:`Tagged releases.`,nightly:`A fresh build of main every night.`,development:`A cezar worktree or an open pull request. Never updates on its own.`};function ep({data:e,busy:t,onChange:n}){return(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`text-[13px] font-semibold`,children:`Release channel`}),(0,X.jsx)(`div`,{className:`text-[12px] text-muted-foreground`,children:$f[e.channel]})]}),(0,X.jsx)(`div`,{role:`radiogroup`,"aria-label":`Release channel`,"data-slot":`channel-toggle`,className:`flex shrink-0 rounded-md border border-border bg-muted/40 p-0.5`,children:Qf.map(r=>{let i=e.channel===r.value;return(0,X.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":i,disabled:t,onClick:()=>!i&&n(r.value),className:U(`rounded-[5px] px-3 py-1 text-[12.5px] font-semibold transition-colors`,i?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:r.label},r.value)})})]})}function tp({data:e,checking:t,onCheck:n,onApply:r,onSchedule:i,applying:a}){let o=e.job?.status===`running`||e.job?.status===`restarting`,s=e.installed.find(e=>e.active),c=s?.source===`registry`?Kf(s.version):null,l=s&&(s.source===`link`||s.source===`local`||c!==null)?s:null;if(l||e.channel===`development`){let i=e.channel===`development`?null:e.latest[e.channel],s=i!==null&&e.installed.some(e=>e.source===`registry`&&e.id===i);return(0,X.jsxs)(`div`,{"data-slot":`self-update-latest`,className:`flex flex-col gap-2 rounded-md border border-border bg-card px-3 py-2.5`,children:[(0,X.jsx)(`div`,{className:`min-w-0 text-[13px] break-words`,children:l?.source===`link`?(0,X.jsxs)(X.Fragment,{children:[`Running worktree `,(0,X.jsx)(`span`,{className:`font-mono text-[12.5px] font-semibold`,children:l.branch??l.id}),`, not a release.`]}):l?.source===`local`?(0,X.jsx)(X.Fragment,{children:`Running a local build, not a release.`}):c===null?(0,X.jsxs)(X.Fragment,{children:[`Running `,(0,X.jsxs)(`span`,{className:`font-semibold`,children:[`v`,e.version]}),`. Pick a worktree or a pull request below.`]}):(0,X.jsxs)(X.Fragment,{children:[`Running the preview build of `,(0,X.jsxs)(`span`,{className:`font-semibold`,children:[`PR #`,c]}),`, not a release.`]})}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,X.jsx)(`div`,{className:`min-w-0 text-[11.5px] break-words text-muted-foreground`,children:e.channel===`development`?`Switch the channel back to Stable or Nightly to follow releases again.`:e.checkedAt?(0,X.jsxs)(X.Fragment,{children:[i?(0,X.jsxs)(X.Fragment,{children:[`Newest `,e.channel,`: `,(0,X.jsxs)(`span`,{className:`font-mono text-foreground`,children:[`v`,i]}),` ·`,` `]}):null,`checked `,new Date(e.checkedAt).toLocaleTimeString()]}):`The npm registry has not answered yet.`}),e.channel===`development`?null:(0,X.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,X.jsx)(W,{variant:`ghost`,size:`sm`,onClick:n,disabled:t||o,children:t?`Checking…`:`Check again`}),i?(0,X.jsx)(W,{size:`sm`,"aria-label":s?`Back to v${i}`:`Install v${i} & restart`,onClick:()=>r(i),disabled:!e.canSelfUpdate||a||o,children:s?`Switch back`:`Install & restart`}):null]})]})]})}let u=e.updateAvailable;return(0,X.jsxs)(`div`,{"data-slot":`self-update-latest`,className:U(`flex flex-wrap items-center justify-between gap-x-3 gap-y-2 rounded-md border px-3 py-2.5`,u?`border-primary/40 bg-primary/5`:`border-border bg-card`),children:[(0,X.jsxs)(`div`,{className:`min-w-[14rem] flex-1 text-[13px] break-words`,children:[e.checkedAt?u?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{className:`font-semibold`,children:[`v`,u]}),` is available on `,e.channel,`.`]}):(0,X.jsxs)(X.Fragment,{children:[`You are on the newest `,e.channel,` version`,e.channel===`nightly`&&e.latest.nightly?` (v${e.latest.nightly})`:``,`.`]}):(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`The npm registry has not answered yet.`}),e.checkedAt?(0,X.jsxs)(`div`,{className:`text-[11.5px] text-muted-foreground`,children:[`checked `,new Date(e.checkedAt).toLocaleTimeString()]}):null]}),(0,X.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,X.jsx)(W,{variant:`ghost`,size:`sm`,onClick:n,disabled:t||o,children:t?`Checking…`:`Check again`}),Wf(e,u)?(0,X.jsx)(Gf,{doing:`installs ${Uf(u)}`,onClick:()=>i(u),disabled:!e.canSelfUpdate||a||o}):null,u?(0,X.jsx)(W,{size:`sm`,onClick:()=>r(u),disabled:!e.canSelfUpdate||a||o,children:`Update & restart`}):null]})]})}function np({data:e,picked:t,onPick:n,onApply:r,onSchedule:i,applying:a}){let o=e.job?.status===`running`||e.job?.status===`restarting`,s=(0,Y.useMemo)(()=>{let t=e.channel===`stable`?e.installed.filter(e=>e.source===`local`).map(e=>({value:e.id,label:`v${e.version} · local build`,installed:!0,active:e.active})):[],n=e.available.filter(t=>t.channel===e.channel).map(t=>({value:t.version,label:`v${t.version}${t.publishedAt?` · ${t.publishedAt.slice(0,10)}`:``}`,installed:t.installed,active:e.installed.some(e=>e.active&&e.id===t.version)}));return[...t,...n]},[e]),c=s.find(e=>e.value===t);return(0,X.jsxs)(`div`,{"data-slot":`self-update-picker`,className:`flex min-w-0 flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`text-[13px] font-semibold`,children:[`Pick a version `,(0,X.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,e.channel]})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsxs)(If,{value:t,onValueChange:n,disabled:s.length===0||o,children:[(0,X.jsx)(Rf,{size:`sm`,"aria-label":`Version`,className:`w-0 min-w-0 flex-1 text-[13px]`,children:(0,X.jsx)(Lf,{placeholder:s.length===0?`No versions known`:`Choose a version to install`})}),(0,X.jsx)(zf,{className:`max-h-72`,children:s.map(e=>(0,X.jsx)(Bf,{value:e.value,children:(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.label,e.active?(0,X.jsx)(ku,{variant:`secondary`,children:`current`}):e.installed?(0,X.jsx)(ku,{variant:`outline`,children:`installed`}):null]})},e.value))})]}),c&&!c.active&&Wf(e,c.value)?(0,X.jsx)(Gf,{label:`When idle`,doing:`${c.installed?`switches to`:`installs`} ${Uf(c.value)}`,onClick:()=>i(c.value),disabled:!e.canSelfUpdate||a||o}):null,(0,X.jsx)(W,{size:`sm`,variant:`contrast`,onClick:()=>c&&r(c.value),disabled:!c||c.active||!e.canSelfUpdate||a||o,children:c?.installed?`Switch & restart`:`Install & restart`})]}),(0,X.jsx)(`p`,{className:`text-[11.5px] text-muted-foreground`,children:`Any version, older ones included. Installed versions stay on disk, so switching back is instant.`})]})}function rp({data:e}){let t=e?.installed.find(e=>e.active);if(t?.source===`local`)return(0,X.jsx)(ku,{variant:`outline`,children:`local build`});if(t?.source===`link`)return(0,X.jsxs)(ku,{variant:`outline`,children:[`worktree · `,t.branch??t.id]});let n=t?Kf(t.version):null;return n===null?null:(0,X.jsxs)(ku,{variant:`outline`,children:[`PR #`,n,` build`]})}function ip({data:e}){let t=e.installKind===`checkout`?`node packages/cezar/dist/index.js install`:e.installKind===`global-npm`?`cezar install`:`npx cezar-cli install`;return(0,X.jsxs)(`div`,{"data-slot":`self-update-install-hint`,className:`rounded-md border border-border bg-muted/40 px-3 py-2.5 text-[12.5px]`,children:[(0,X.jsx)(`p`,{children:e.reason}),(0,X.jsx)(`p`,{className:`mt-1.5 text-muted-foreground`,children:`Run this once, then start cezar with the plain command:`}),(0,X.jsx)(`pre`,{className:`mt-1.5 overflow-x-auto rounded bg-background px-2 py-1.5 font-mono text-[12px]`,children:t})]})}function ap({data:e}){let t=e.job,n=V(),r=(0,Y.useRef)(null),[i,a]=(0,Y.useState)(`waiting`);return(0,Y.useEffect)(()=>{r.current?.scrollTo({top:r.current.scrollHeight})},[t.log.length]),(0,Y.useEffect)(()=>{if(t.status!==`restarting`)return;let r=!1,i=Date.now(),o=()=>{a(`back`),n.removeQueries({queryKey:R.selfUpdate}),window.setTimeout(()=>window.location.reload(),400)},s=async()=>{if(!r){try{if((await fe()).version!==e.version)return o();let t=await ne().catch(()=>null);if(t&&!t.job)return o()}catch{}if(Date.now()-i>9e4){a(`timeout`);return}window.setTimeout(s,1e3)}};return window.setTimeout(s,1500),()=>{r=!0}},[t.status,e.version,n]),(0,X.jsxs)(`div`,{"data-slot":`self-update-job`,className:`flex min-w-0 flex-col gap-1.5`,children:[(0,X.jsx)(`div`,{className:`flex items-center justify-between text-[12.5px]`,children:(0,X.jsx)(`span`,{className:`font-semibold`,children:t.status===`running`?`Installing ${t.target}…`:t.status===`failed`?`Install of ${t.target} failed`:i===`back`?`Back — reloading`:i===`timeout`?`Restart took too long — reload the page by hand`:`Restarting into ${t.target}…`})}),(0,X.jsx)(`pre`,{ref:r,className:`max-h-40 min-w-0 overflow-y-auto rounded-md border border-border bg-background px-2 py-1.5 font-mono text-[11px] leading-[1.5] break-all whitespace-pre-wrap text-muted-foreground`,children:t.log.join(`
|
|
3
|
+
`)}),t.error?(0,X.jsx)(`p`,{className:`text-[12.5px] text-danger`,children:t.error}):null]})}var op=`cez-sidebar-width`;function sp(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(420,Math.max(264,Math.round(t))):264}function cp(){try{let e=localStorage.getItem(op);return e===null?264:sp(e)}catch{return 264}}function lp(e){try{localStorage.setItem(op,String(sp(e)))}catch{}}function up(){let[e]=Y.useState(()=>{if(typeof document>`u`)return null;let e=document.documentElement.dataset.cezDesktop;return e===`macos`||e===`windows`||e===`linux`?e:null});return e}var dp=new Set;function fp(e){dp.add(e);let t=t=>{t.key!==null&&t.key!==`cez-sidebar-width`||(pp=null,e())};return window.addEventListener(`storage`,t),()=>{dp.delete(e),window.removeEventListener(`storage`,t)}}var pp=null;function mp(){return pp??cp()}function hp(e){let t=sp(e);lp(t),pp=cp()===t?null:t;for(let e of dp)e()}function gp(){return[Y.useSyncExternalStore(fp,mp,mp),hp]}function _p({slot:e=`sidebar`,width:t,onWidthChange:n,titlebarInset:r=!1,children:i}){return(0,X.jsxs)(`aside`,{"data-slot":e,style:{width:t},className:U(`relative hidden shrink-0 flex-col border-r border-border bg-sidebar md:flex`,r&&`pt-[28px]`),children:[i,(0,X.jsx)(vp,{width:t,onWidthChange:n})]})}function vp({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(sp(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(sp(r)))},onDoubleClick:()=>t(264),title:`Drag to resize the sidebar — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-violet/40 focus-visible:bg-violet/60 focus-visible:outline-none`})}function yp({slot:e,title:t,children:n}){return(0,X.jsxs)(fi,{side:`left`,"data-slot":e,showCloseButton:!1,className:`w-[264px] gap-0 border-border bg-sidebar p-0 sm:max-w-none md:hidden`,"aria-describedby":void 0,children:[(0,X.jsx)(vi,{className:`sr-only`,children:t}),n((0,X.jsx)(_i,{asChild:!0,children:(0,X.jsx)(W,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`-mr-2 size-11`,children:(0,X.jsx)(ys,{className:`size-[17px]`,"aria-hidden":`true`})})}))]})}var bp=`(min-width: 768px)`,xp=Y.createContext(void 0),Sp=Y.memo(function({children:e,mainRef:t}){return(0,X.jsx)(`main`,{ref:t,"data-slot":`main`,className:`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,children:e})});function Cp(){return Y.useContext(xp)}function wp(e){return er({path:`/tasks/:id`,end:!0},cr(e))!==null}var Tp=Y.memo(function({children:e,repo:t=null,inboxCount:n=null,unreadCount:r=null,skillsUpdateAvailable:i=!1,version:a=null,latestVersion:o=null,starCount:s=null,taskQuickList:c,hostWidget:l,toolsMenu:u,forgeAvailable:d=!0,inboxAvailable:f=!0,automationsAvailable:p=!0,tracker:m,singleProject:h=!1,banner:g,footerBanner:_,projectGroups:v,brandName:y=`cezar`,brandLogoUrl:b=null}){let{pathname:x}=mr(),S=cr(x),C=ed(S),w=td(S),T=w?.to===`/tracker`&&m?{...w,label:Bc[m].label}:w,E=_f(x),[D,O]=Y.useState(!1),k=Y.useCallback(()=>O(!1),[]),A=Y.useRef(null),j=wp(x),[M,N]=gp();Y.useLayoutEffect(()=>{if(j)return;let e=A.current;e&&(e.scrollTop=0)},[x,j]),Y.useEffect(()=>{O(!1)},[x]),Y.useEffect(()=>{let e=window.matchMedia?.(bp);if(!e)return;e.matches&&O(!1);let t=e=>{e.matches&&O(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let P={activeTo:C,items:Y.useMemo(()=>Qu({forge:d,inbox:f,automations:p,tracker:m}),[d,f,p,m]),repo:t,inboxCount:f?n:null,unreadCount:r,skillsUpdateAvailable:i,version:a,latestVersion:o,starCount:s,taskQuickList:c,hostWidget:l,toolsMenu:u,projectGroups:v,singleProject:h,brandName:y,brandLogoUrl:b},F=up();return(0,X.jsxs)(`div`,{"data-slot":`app-shell`,"data-desktop":F??void 0,"data-chromeless":E?``:void 0,className:`flex h-dvh overflow-hidden bg-background text-foreground pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)]`,children:[F===`macos`?(0,X.jsx)(`div`,{"data-slot":`desktop-titlebar`,"data-tauri-drag-region":``,className:`fixed inset-x-0 top-0 z-[60] flex h-[28px] select-none items-center pl-[80px]`,children:a&&o&&o!==a?(0,X.jsx)(Ep,{latestVersion:o,brandName:y}):null}):null,E?null:(0,X.jsx)(Dp,{...P,width:M,onWidthChange:N,desktop:F}),(0,X.jsxs)(`div`,{className:U(`grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,F===`macos`&&`pt-[28px]`),children:[E?null:(0,X.jsxs)(hi,{open:D,onOpenChange:O,children:[(0,X.jsx)(Rp,{title:T?.label??y}),(0,X.jsx)(Op,{...P,onNavigate:k})]}),g?(0,X.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:g}):null,(0,X.jsx)(Sp,{mainRef:A,children:e}),(0,X.jsx)(`div`,{"data-slot":`composer`,className:`row-start-4 pb-[env(safe-area-inset-bottom)]`,children:_})]})]})});function Ep({latestVersion:e,brandName:t}){let[n,r]=Y.useState(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,"data-slot":`titlebar-update`,onClick:()=>r(!0),title:`Update ${t} to v${e} and restart`,className:`inline-flex h-[18px] items-center gap-1 rounded-full border border-primary/40 bg-primary/15 px-2 text-[11px] font-semibold text-foreground transition-colors hover:bg-primary/30`,children:[(0,X.jsx)(Is,{tone:`pending`,pulse:!0,className:`size-[5px] shrink-0`}),`Update `,t,(0,X.jsxs)(`span`,{className:`font-mono font-medium text-muted-foreground`,children:[`v`,e]})]}),n?(0,X.jsx)(Zf,{open:n,onOpenChange:r,autoApply:e,brandName:t}):null]})}var Dp=Y.memo(function({width:e,onWidthChange:t,desktop:n=null,...r}){return(0,X.jsx)(_p,{width:e,onWidthChange:t,titlebarInset:n===`macos`,children:(0,X.jsx)(kp,{...r,compactHeader:n===`macos`})})}),Op=Y.memo(function({onNavigate:e,...t}){return(0,X.jsx)(yp,{slot:`mobile-nav-drawer`,title:`Navigation`,children:n=>(0,X.jsx)(kp,{...t,onNavigate:e,headerAction:n})})});function kp({activeTo:e,items:t,repo:n,inboxCount:r,unreadCount:i,skillsUpdateAvailable:a,version:o,latestVersion:s,starCount:c,taskQuickList:l,hostWidget:u,toolsMenu:d,projectGroups:f,singleProject:p,brandName:m,brandLogoUrl:h,onNavigate:g,headerAction:_,compactHeader:v=!1}){return(0,X.jsxs)(`div`,{"data-slot":`sidebar-content`,className:`@container/sidebar flex min-h-0 flex-1 flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,X.jsxs)(`div`,{className:U(`flex items-center gap-[9px] px-3.5 pb-2.5`,v?`pt-1.5`:`pt-3.5`),children:[(0,X.jsx)(Ff,{name:m,logoUrl:h}),n&&!f?(0,X.jsxs)(`span`,{"data-slot":`repo-chip`,className:`ml-auto truncate font-mono text-[11px] font-medium text-soft-foreground`,children:[n.name,` / `,n.branch]}):null,_?(0,X.jsx)(`div`,{className:U(`shrink-0`,(!n||f)&&`ml-auto`),children:_}):null]}),(0,X.jsxs)(`div`,{className:`flex gap-1.5 px-2.5 pt-1 pb-2`,children:[(0,X.jsx)(W,{asChild:!0,variant:`contrast`,className:`relative min-w-0 flex-1 justify-center`,children:(0,X.jsxs)(K,{to:`/new`,onClick:g,children:[(0,X.jsx)(_s,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`absolute right-2.5 rounded-[5px] border border-b-2 border-contrast-foreground/25 bg-transparent px-[5px] py-px font-mono text-[10.5px] font-medium text-contrast-foreground/60`,children:`C`})]})}),p?null:(0,X.jsx)(Fp,{})]}),(0,X.jsx)(`div`,{className:`shrink-0 px-1.5`,children:(0,X.jsx)(Mp,{onNavigate:g})}),f?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`shrink-0 border-b border-border px-1.5 pt-0.5 pb-2`,children:(0,X.jsx)(Np,{onNavigate:g})}),(0,X.jsx)(`div`,{"data-slot":`project-groups`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pt-1.5 pb-2`,children:(0,X.jsx)(xp.Provider,{value:g,children:f})})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`nav`,{"aria-label":`Main`,className:`px-2.5 py-1.5`,children:t.map(t=>{let n=t.to===e,o=t.icon;return(0,X.jsxs)(K,{to:t.to,onClick:g,"aria-current":n?`page`:void 0,className:U(`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-[13.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground md:h-[34px]`,n&&`bg-muted font-semibold text-foreground`),children:[(0,X.jsx)(o,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&r?(0,X.jsx)(`span`,{"data-slot":`nav-badge`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:r}):null,t.badge===`tasks-unread`&&i?(0,X.jsx)(`span`,{"data-slot":`nav-unread-badge`,title:`${i} unread finished ${i===1?`task`:`tasks`}`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:i}):null,t.badge===`skills-update`&&a?(0,X.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,X.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,X.jsx)(`div`,{"data-slot":`task-quick-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2.5 pb-2`,children:l})]}),(0,X.jsxs)(`div`,{"data-slot":`sidebar-footer`,className:`flex flex-col gap-1.5 border-t border-border px-3.5 py-2.5`,children:[u,(0,X.jsx)(gf,{}),(0,X.jsxs)(`div`,{"data-slot":`sidebar-footer-controls`,className:`flex items-center gap-2`,children:[(0,X.jsx)(`div`,{"data-slot":`tools-menu`,className:`shrink-0`,children:d}),o?(0,X.jsx)(Ip,{version:o,latestVersion:s,brandName:m}):null,c===null?null:(0,X.jsx)(Lp,{count:c}),(0,X.jsx)(Pp,{onNavigate:g,className:`ml-auto`}),(0,X.jsx)(_d,{})]})]})]})}var Ap=`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-[13.5px] font-semibold text-foreground transition-colors hover:bg-muted md:h-9`;function jp(e){return U(`size-4 shrink-0`,e?`text-violet`:`text-violet/70`)}function Mp({onNavigate:e}){return(0,X.jsx)(rr,{to:`/dashboard`,"data-slot":`dashboard-link`,onClick:e,className:({isActive:e})=>U(Ap,e&&`bg-muted`),children:({isActive:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ni,{className:jp(e),"aria-hidden":`true`}),`Dashboard`]})})}function Np({onNavigate:e}){let{pathname:t}=mr(),n=t===`/tasks`;return(0,X.jsxs)(or,{to:`/tasks`,"data-slot":`all-tasks-link`,onClick:e,"aria-current":n?`page`:void 0,className:U(Ap,n&&`bg-muted`),children:[(0,X.jsx)(bc,{className:jp(n),"aria-hidden":`true`}),`All tasks`]})}function Pp({className:e,onNavigate:t}){return(0,X.jsx)(W,{asChild:!0,variant:`ghost`,size:`icon`,className:U(`size-7`,e),children:(0,X.jsx)(or,{to:`/settings/global`,"data-slot":`global-settings-link`,"aria-label":`Global settings`,title:`Global settings`,onClick:t,children:(0,X.jsx)(Nc,{className:`size-4`,"aria-hidden":`true`})})})}function Fp(){let[e,t]=Y.useState(!1),[n,r]=Y.useState(!1),[i,a]=Y.useState(!1);return(0,X.jsxs)(ts,{children:[(0,X.jsx)(is,{asChild:!0,children:(0,X.jsx)(W,{variant:`outline`,size:`icon`,"aria-label":`Add project`,title:`Add project`,className:`size-11 shrink-0 md:size-9`,children:(0,X.jsx)(dc,{className:`size-4`,"aria-hidden":`true`})})}),(0,X.jsxs)(ns,{align:`start`,className:`w-56`,children:[(0,X.jsx)(Xo,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,X.jsxs)($o,{"data-slot":`add-project-local`,onSelect:()=>{t(!0),xa(`folder`)},children:[(0,X.jsx)(ss,{"aria-hidden":`true`}),`Open local folder…`]}),(0,X.jsxs)($o,{"data-slot":`add-project-clone`,onSelect:()=>{r(!0),xa(`clone`)},children:[(0,X.jsx)(Xu,{"aria-hidden":`true`}),`Clone from GitHub…`]}),(0,X.jsxs)($o,{"data-slot":`add-project-create`,onSelect:()=>{a(!0),xa(`new`)},children:[(0,X.jsx)(fc,{"aria-hidden":`true`}),`New project…`]})]}),e?(0,X.jsx)(Yu,{label:`Open local folder`,onError:()=>t(!1),children:(0,X.jsx)(Fu,{open:!0,onOpenChange:t})}):null,n?(0,X.jsx)(Yu,{label:`Clone from GitHub`,onError:()=>r(!1),children:(0,X.jsx)(Ru,{open:!0,onOpenChange:r})}):null,i?(0,X.jsx)(Yu,{label:`New project`,onError:()=>a(!1),children:(0,X.jsx)(Wu,{open:!0,onOpenChange:a})}):null]})}function Ip({version:e,latestVersion:t,brandName:n}){let r=!!(t&&t!==e),[i,a]=Y.useState(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,"data-slot":`version-chip`,"data-update-available":r?`true`:void 0,title:r?`v${e} — update available: v${t}`:`v${e}`,"aria-label":r?`${n} v${e}, update to v${t} available — open updater`:`${n} v${e} — open updater`,onClick:()=>a(!0),className:`flex min-w-0 cursor-pointer items-center gap-1 rounded-full border border-border px-1.5 py-px font-mono text-[10px] font-medium text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[r?(0,X.jsx)(Is,{tone:`pending`,pulse:!0,className:`size-[5px] shrink-0`}):null,(0,X.jsxs)(`span`,{className:`truncate`,children:[`v`,e]})]}),i?(0,X.jsx)(Zf,{open:i,onOpenChange:a,brandName:n}):null]})}function Lp({count:e}){let t=bf(e);return(0,X.jsxs)(`a`,{"data-slot":`star-chip`,href:vf,target:`_blank`,rel:`noopener noreferrer`,title:`Star cezar on GitHub — ${e.toLocaleString()} stars`,"aria-label":`Star cezar on GitHub — ${e.toLocaleString()} stars`,className:`flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px font-mono text-[10px] font-medium text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:`⭐`}),(0,X.jsx)(`span`,{children:t})]})}function Rp({title:e}){return(0,X.jsx)(`header`,{"data-slot":`mobile-top-bar`,className:`row-start-1 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,X.jsxs)(`div`,{className:`flex h-11 items-center gap-2.5 px-3`,children:[(0,X.jsx)(si,{asChild:!0,children:(0,X.jsx)(W,{variant:`ghost`,size:`icon`,"aria-label":`Open menu`,className:`-ml-1.5 size-11`,children:(0,X.jsx)(wc,{className:`size-[17px]`,"aria-hidden":`true`})})}),(0,X.jsx)(`span`,{className:`truncate text-[14.5px] font-semibold`,children:e}),(0,X.jsx)(`div`,{"data-slot":`mobile-status`,className:`ml-auto flex items-center gap-2`})]})})}function zp(e,t){return e.startsWith(`@`)?{mode:`tasks`,query:e.slice(1)}:e.startsWith(`>`)?{mode:t?`commands`:`tasks`,query:e.slice(1)}:e.startsWith(`#`)?{mode:t?`files`:`tasks`,query:e.slice(1)}:{mode:t?`all`:`tasks`,query:e}}var Bp=e=>e.replace(/^[@>#]/,``),Vp=(e,t,n)=>Ud(e,Bp(t),n);function Hp(e){return(er(`/p/:projectId/tasks/:id/*`,e)??er(`/tasks/:id/*`,e))?.params.id}function Up(e,t,n=50){let r=t.trim();if(r===``)return e.slice(0,n);let i=[];for(let t of e){let e=t.slice(t.lastIndexOf(`/`)+1),n=Ud(t,r)+Ud(e,r);n>0&&i.push({path:t,score:n})}return i.sort((e,t)=>t.score-e.score||e.path.length-t.path.length),i.slice(0,n).map(e=>e.path)}var Wp=6,Gp=`task-palette-task`;function Kp(){let e=mr(),t=Hp(e.pathname),n=tr(),r=Jp(),[i,a]=Y.useState(!1),[o,s]=Y.useState(null),[c,l]=Y.useState(``),[u,d]=Y.useState(``),[f,p]=Y.useState(!1),[m,h]=Y.useState(null),[g,_]=Y.useState(null),[v,y]=Y.useState(null),b=Y.useRef(null),x=Y.useRef(null),S=Y.useRef(!1),C=Y.useRef(!1),w=Y.useRef(null),T=Qi();ff(`task`,i,Y.useCallback(()=>a(!1),[]));let E=Y.useRef(new Set),D=Y.useRef(!1),O=Y.useRef(i);O.current=i;let k=Y.useCallback((e,t,{reopen:n=!1}={})=>{!O.current&&!n&&wa(e?`task`:`task_switch`),D.current=!1,s(e),l(t),d(``),p(!1),y(null),h(null),S.current=!1,C.current=!1,a(!0)},[]),A=()=>[...x.current?.querySelectorAll(`[cmdk-item][data-slot="${Gp}"]`)??[]];vo(`p`,()=>{if(v)return;if(!i){t?k(t,``):k(null,`@`);return}if(p(!1),(f||!c.startsWith(`@`))&&o){l(`@`),D.current=!0,h({step:1});return}let e=A(),n=e.findIndex(e=>e.dataset.value===u);D.current=!0,h({step:n+1>=e.length?0:n+1})},{inEditable:!0}),Y.useEffect(()=>{if(!m)return;let e=setTimeout(()=>{let e=A(),t=e[Math.min(m.step,e.length-1)];t?.dataset.value&&d(t.dataset.value),h(null)},0);return()=>clearTimeout(e)},[m,c]);let j=Y.useCallback(e=>{if(e.projectId===null||e.projectId===r){k(e.runId,``);return}w.current=e.runId,a(!1),n(lf({id:e.runId,projectId:e.projectId}))},[r,n,k]);Y.useEffect(()=>{let e=e=>{let n=e.detail;n?j(n):t?k(t,``):k(null,`@`)};return window.addEventListener(Id,e),()=>window.removeEventListener(Id,e)},[j,t,k]),Y.useEffect(()=>{i||s(null)},[e.pathname]),Y.useEffect(()=>{!i&&!C.current&&s(null)},[i]),Y.useEffect(()=>{w.current&&w.current===t&&(w.current=null,k(t,``,{reopen:!0}))},[t,k]);let M=Y.useCallback(()=>{C.current&&(C.current=!1,te.current.open||s(null))},[]),N=(e,t=!1)=>{let n=b.current?.build().find(t=>t.id===e);if(!n||n.unavailable)return;if(La(n.id,`palette`),n.id===`rename`){n.perform();return}S.current=!0,C.current=$p(n.id),a(!1);let r=t&&n.performBeside?n.performBeside:n.perform;if(em(n.id))return r();setTimeout(r,0)},P=Y.useCallback(e=>{S.current=!0,ga(D.current?`cycle`:`enter`),a(!1),n(lf(e))},[n]),F=Y.useCallback(()=>{let e=b.current?.run;e&&(p(!0),l(he(e)),setTimeout(()=>x.current?.querySelector(`[cmdk-input]`)?.select(),0))},[]),I=()=>{let e=c.trim();e&&b.current&&b.current.rename(e),S.current=!0,a(!1)},ee=e=>{T.ready&&y({id:e,label:nm(e,b.current?.commands)})},te=Y.useRef({open:i,recording:v,pageTaskId:t,byChord:new Map,show:k,beginRename:F});te.current={open:i,recording:v,pageTaskId:t,byChord:new Map([...T.bindings].map(([e,t])=>[t,e])),show:k,beginRename:F},Y.useEffect(()=>{let e=e=>{if(e.repeat||e.defaultPrevented)return;let t=te.current;if(t.open||t.recording||!t.pageTaskId)return;let n=Ki(e),r=n?t.byChord.get(n):void 0;if(!n||!r||!rm(e.target,n)||Li())return;let i=b.current;if(!i||i.run.id!==t.pageTaskId)return;let a=i.build().find(e=>e.id===r);if(a){if(e.preventDefault(),a.unavailable)return void G(a.unavailable);if(La(a.id,`shortcut`),a.id===`rename`){t.show(t.pageTaskId,``,{reopen:!0}),setTimeout(t.beginRename,0);return}a.perform(`shortcut`)}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let ne=e=>{if(v){if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`)return y(null);if(!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&(e.key===`Backspace`||e.key===`Delete`))return T.assign(v.id,null),G(`Removed the shortcut for ${v.label}`),y(null);let t=Ki(e.nativeEvent);if(!t){let t=Wi(e.nativeEvent);t&&y({...v,problem:t});return}let n=Yi(t);if(n)return y({...v,problem:`${sa(t)} — ${n}`});let r=[...T.bindings].find(([e,n])=>n===t&&e!==v.id)?.[0];return T.assign(v.id,t),G(`${sa(t)} → ${v.label}${r?` (was ${nm(r,b.current?.commands)})`:``}`),y(null)}if(e.nativeEvent.isComposing||e.keyCode===229)return;if(f){e.key===`Enter`&&(e.preventDefault(),I());return}let n=x.current?.querySelector(`[cmdk-item][data-selected="true"]`);if(e.key===`Tab`&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey){let t=n?.dataset.slot===Gp?n.dataset.runId:void 0;if(!t)return;e.preventDefault(),ga(`tab`),j({runId:t,projectId:n?.dataset.projectId??null});return}if(e.key===`Enter`&&e.altKey&&n?.dataset.commandId){e.preventDefault(),N(n.dataset.commandId,!0);return}if(e.key===`Enter`&&e.shiftKey&&n?.dataset.commandId&&tm(n.dataset.commandId)){e.preventDefault(),ee(n.dataset.commandId);return}e.key===`Backspace`&&c===``&&o!==null&&o!==t&&(e.preventDefault(),k(t??null,`@`))},{mode:L,query:re}=f?{mode:`all`,query:``}:zp(c,o!==null);return Y.useEffect(()=>{if(!(!i||f||v))for(let e of za(re,L===`all`?void 0:L))E.current.add(e)},[i,f,v,re,L]),Y.useEffect(()=>{i||E.current.size===0||(Ma(E.current),E.current=new Set)},[i]),(0,X.jsxs)(X.Fragment,{children:[o??t?(0,X.jsx)(sm,{runId:o??t,apiRef:b,onCommands:_,onRename:F,onDialogDone:M,open:i},o??t):null,(0,X.jsx)(bi,{open:i,onOpenChange:e=>{e||Ia(L===`tasks`?`tasks`:L===`files`?`files`:`actions`),a(e)},title:`Task palette`,description:`Act on a task, switch tasks, or open one of its files`,showCloseButton:!1,filter:Vp,commandProps:{value:u,onValueChange:d,onKeyDown:ne,shouldFilter:!f&&!v&&L!==`files`},onOpenAutoFocus:e=>{let t=e.currentTarget?.querySelector(`[cmdk-input]`);t&&(e.preventDefault(),t.focus(),t.setSelectionRange(t.value.length,t.value.length))},onCloseAutoFocus:e=>{S.current&&e.preventDefault()},onEscapeKeyDown:e=>{if(v)return e.preventDefault(),y(null);f&&(e.preventDefault(),p(!1),l(``))},className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,X.jsxs)(`div`,{ref:x,"data-slot":`task-palette`,"data-mode":v?`record`:f?`rename`:L,className:`contents`,children:[(0,X.jsx)(gi,{placeholder:v?`Press a shortcut — ⌫ removes it, esc cancels`:qp(f?`rename`:L),value:c,onValueChange:l}),o&&!f&&L!==`tasks`?(0,X.jsx)(Yp,{runId:o,picked:o!==t}):null,(0,X.jsx)(di,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:v?(0,X.jsx)(li,{heading:`Shortcut for ${v.label}`,children:(0,X.jsxs)(mi,{value:`record`,"data-slot":`task-palette-recorder`,onSelect:()=>{},children:[(0,X.jsx)(yc,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:v.problem??`Press the keys for this command…`}),T.bindings.get(v.id)?(0,X.jsx)(ai,{children:sa(T.bindings.get(v.id))}):null]})}):f?(0,X.jsx)(li,{heading:`Rename`,children:(0,X.jsxs)(mi,{value:`rename`,"data-slot":`task-palette-rename`,onSelect:I,children:[(0,X.jsx)(ms,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:c.trim()?`Rename to “${c.trim()}”`:`Type the new name`}),(0,X.jsx)(ai,{children:`↵`})]})}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ci,{children:`Nothing matches.`}),L===`all`||L===`commands`?(0,X.jsx)(Xp,{commands:g?.runId===o?g.commands:[],bindings:T.bindings,onPerform:N,onRecord:ee}):null,L===`files`&&o?(0,X.jsx)(am,{runId:o,query:re,onPick:e=>{S.current=!0,a(!1);let t=ro(o);t?setTimeout(()=>t.openFile(e),0):(lo(o,e),n(`/tasks/${o}`))}}):null,L===`all`||L===`tasks`?(0,X.jsx)(im,{recentOnly:L===`all`,exclude:L===`all`?o:null,current:t,query:re,onPick:P}):null]})}),(0,X.jsx)(om,{mode:v?`record`:f?`rename`:L})]})})]})}function qp(e){switch(e){case`rename`:return`New name…`;case`tasks`:return`Switch to a task…`;case`files`:return`Open a file in this task…`;case`commands`:return`Run a command on this task…`;default:return`Act on this task — @ tasks · > commands · # files`}}function Jp(){let e=dr(),t=A(),n=Dt(),r=t.data?.bootProject??n.data?.bootProject??null;return(e==="default"?null:e)??r}function Yp({runId:e,picked:t}){let n=ht(e).data;if(!n)return null;let r=re(n);return(0,X.jsxs)(`div`,{"data-slot":`task-palette-subject`,className:`flex min-w-0 items-center gap-2 border-b border-border px-3 py-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:`Task`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground`,children:he(n)}),(0,X.jsx)(Ss,{className:`shrink-0`,dot:r.tone,pulse:r.pulse,children:r.label}),t?(0,X.jsx)(`span`,{className:`shrink-0 text-soft-foreground`,children:`⌫ back to tasks`}):null]})}function Xp({commands:e,bindings:t,onPerform:n,onRecord:r}){return(0,X.jsx)(X.Fragment,{children:Ji.map(i=>{let a=e.filter(e=>e.group===i.id&&!e.hidden);return a.length===0?null:(0,X.jsx)(li,{heading:i.heading,children:a.map(e=>{let a=Zp(e,t);return(0,X.jsxs)(mi,{value:`${i.heading} ${e.label} ${e.id}`,keywords:e.keywords,disabled:e.unavailable!==void 0,"data-slot":`task-palette-command`,"data-command-id":e.id,"aria-checked":e.pressed,onSelect:()=>n(e.id),className:U(`group/command`,e.danger&&`data-[selected=true]:text-danger`),children:[e.icon,(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.unavailable?(0,X.jsx)(`span`,{className:`shrink-0 truncate text-xs text-soft-foreground`,children:e.unavailable}):e.pressed?(0,X.jsx)(`span`,{className:`shrink-0 text-xs text-primary`,children:`on`}):null,tm(e.id)?(0,X.jsx)(`button`,{type:`button`,"data-slot":`task-palette-record`,"aria-label":`Set a shortcut for ${e.label}`,title:`Set a shortcut (⇧↵)`,className:`hidden shrink-0 rounded p-0.5 text-soft-foreground group-hover/command:inline-flex hover:text-foreground`,onPointerDown:e=>e.preventDefault(),onClick:t=>{t.stopPropagation(),r(e.id)},children:(0,X.jsx)(yc,{"aria-hidden":`true`,className:`size-3.5!`})}):null,a?(0,X.jsx)(ai,{children:a}):null]},e.id)})},i.id)})})}function Zp(e,t){let n=t.get(e.id);if(n)return sa(n);let r=e.shortcut&&/^[1-9]$/.test(e.shortcut)?t.get(`tab:${e.shortcut}`):void 0;return r?sa(r):e.shortcut}var Qp=new Set([`stop`,`delete`]),$p=e=>Qp.has(e)||e.startsWith(`git:`),em=e=>e.startsWith(`copy:`)||e===`open-pr`,tm=e=>!e.startsWith(`layout:`);function nm(e,t=[]){return ea.find(t=>t.id===e)?.label??t.find(t=>t.id===e)?.label??e}function rm(e,t){let n=t.split(`+`).includes(`Mod`);return e instanceof HTMLElement&&e.closest(`.xterm`)?n&&Wa():eo(e)&&!(e instanceof HTMLElement&&e.closest(`[cmdk-input]`))?n:!0}function im({recentOnly:e,exclude:t,current:n,query:r,onPick:i}){let{tasks:a,multiProject:o,projectNames:s,repoBases:c}=cf(),l=io(),u=Y.useMemo(()=>{let n=Oo(a,e=>e.id,l),r=new Set(l);return Qd(e?n.filter(e=>r.has(e.id)&&e.id!==t).slice(0,Wp):n,s,c)},[a,l,e,t,s,c]),{shown:d,total:f}=Y.useMemo(()=>$d(u,r),[u,r]),[p]=Y.useState(Date.now);return d.length===0?null:(0,X.jsx)(ef,{entries:d,children:(0,X.jsxs)(li,{heading:(0,X.jsx)(qd,{label:e?`Recent tasks`:`Tasks`}),className:tf,children:[d.map(e=>(0,X.jsx)(mf,{entry:e,slot:Gp,showProject:o,now:p,onSelect:i,current:e.task.id===n},e.key)),(0,X.jsx)(nf,{hidden:f-d.length})]})})}function am({runId:e,query:t,onPick:n}){let r=pn(e),i=Y.useMemo(()=>Up(r.data?.paths??[],t),[r.data,t]);return r.isPending?(0,X.jsx)(`p`,{className:`px-3 py-6 text-center text-xs text-soft-foreground`,children:`Loading files…`}):r.isError?(0,X.jsx)(`p`,{className:`px-3 py-6 text-center text-xs text-soft-foreground`,children:r.error.message}):(0,X.jsx)(li,{heading:`Files`,children:i.map(e=>{let t=e.lastIndexOf(`/`);return(0,X.jsxs)(mi,{value:`file ${e}`,"data-slot":`task-palette-file`,onSelect:()=>n(e),children:[(0,X.jsx)(Ao,{"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.slice(t+1)}),t>0?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.slice(0,t)}):null]},e)})})}function om({mode:e}){return(0,X.jsx)(`div`,{"data-slot":`task-palette-footer`,className:`flex flex-wrap gap-x-3 gap-y-1 border-t border-border px-3 py-1.5 text-[11px] text-soft-foreground`,children:(e===`record`?[`⌫ remove`,`esc cancel`]:e===`rename`?[`↵ save`,`esc cancel`]:e===`tasks`?[`↵ open`,`tab act on it`,`${Ja(`p`)} next`]:e===`files`?[`↵ open in Code`]:[`↵ run`,`⌥↵ open beside`,`⇧↵ set shortcut`,`@ tasks`,`> commands`,`# files`]).map(e=>(0,X.jsx)(`span`,{children:e},e))})}var sm=Y.memo(function(e){let t=ht(e.runId).data;return t?(0,X.jsx)(cm,{run:t,...e}):null});function cm(e){let t=Ta(e.run);return(0,X.jsx)(Sr,{projectId:t.projectId,requests:t.requests,children:(0,X.jsx)(lm,{...e})})}function lm({run:e,apiRef:t,onCommands:n,onRename:r,onDialogDone:i}){let a=ro(e.id),o=Hp(mr().pathname)===e.id,s=Ra(e,{surface:`palette`,onMarkedUnread:a?.markedUnread,onScreen:o}),c=Oa(e),l=ba(e,Fa(e)),u=Dt().data?.capabilities?.terminal===!0,d=_n(e.id),f=tr(),p=Jp(),m=Lt(e),h=()=>oa({run:e,canResume:l.canResumeHere,git:c.action,gitPending:c.pending,workspace:ro(e.id),terminalAvailable:u,openChoices:l.choices,prUrl:m?.url,taskUrl:`${window.location.origin}${p?$n(p,`/tasks/${e.id}`):`/tasks/${e.id}`}`},{markRead:()=>s.markRead.mutate(),markUnread:()=>s.markUnread.mutate(),pin:e=>s.pin.mutate(e===`shortcut`?`shortcut`:void 0),archive:e=>s.archive.mutate(e===`shortcut`?`shortcut`:void 0),rename:r,finish:()=>s.finish.mutate(),confirmStop:()=>s.setConfirming(`cancel`),confirmDelete:()=>s.setConfirming(`delete`),resumeInTerminal:()=>s.terminal.mutate(),gitAction:c.onAction,openIn:l.open,navigate:e=>f(e),openUrl:e=>window.open(e,`_blank`,`noopener,noreferrer`),copy:(e,t)=>void _a(e,`${t} copied`)}),g=h();t.current={run:e,commands:g,build:h,rename:e=>d.mutate({title:e},{onError:e=>G(e.message,{tone:`danger`})})};let _=g.map(e=>`${e.id}|${e.label}|${e.unavailable??``}|${+!!e.pressed}|${e.shortcut??``}`).join(`
|
|
4
|
+
`),v=Y.useRef(g);v.current=g,Y.useEffect(()=>n({runId:e.id,commands:v.current}),[_,n,e.id]);let y=s.confirming!==null||c.commitOpen||c.pending!==null||s.delete.isPending||s.cancel.isPending,b=Y.useRef(y);return Y.useEffect(()=>{b.current&&!y&&i(),b.current=y},[y,i]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ui,{run:e,confirming:s.confirming,lifecycleDelete:s.lifecycleDelete,onOpenChange:e=>!e&&s.setConfirming(null),onConfirm:e=>e===`delete`?s.delete.mutate():s.cancel.mutate()}),c.dialogs]})}var um=Y.createContext(null);function dm({children:e}){let[t,n]=Y.useState(`active`),r=Y.useMemo(()=>[t,n],[t]);return(0,X.jsx)(um.Provider,{value:r,children:e})}function fm(){let e=Y.useContext(um);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}var pm=1e4,mm=e=>Math.min(100,Math.max(0,e)),hm=e=>e===void 0||e<80?`ok`:e<90?`warn`:`critical`;function gm(){let e=Ni(),t=Oi();return!e||t!==`local`?null:(0,X.jsx)(_m,{})}function _m(){let e=Ai(),t=Di(),n=ki(),[r,i]=(0,Y.useState)(void 0),a=n!==void 0&&r===n;(0,Y.useEffect)(()=>{if(n===void 0)return;let e=Math.max(0,n+pm-Date.now()),t=setTimeout(()=>i(n),e);return()=>clearTimeout(t)},[n]);let o=e===void 0?void 0:Mi(e),s=o?.cpuPct,c=a?`stale`:o!==void 0&&o.cpuLimited&&s===void 0?`—`:s===void 0?t.length===0?`sampling…`:`—`:`${Math.round(s)}%`,l=o===void 0||o.memUsedBytes===void 0||o.memTotalBytes<=0?void 0:o.memUsedBytes/o.memTotalBytes*100,u=a?`stale`:l===void 0?`—`:`${Math.round(l)}%`,d=o===void 0?`—`:wi(o.memUsedBytes,o.memTotalBytes),f=o?.cpuLimited===!0?`${o.cpuLimitKind===`cpuset`?`cpuset `:``}${Ci(o.cpuCores)}`:void 0,p=`CPU ${c}${f===void 0?``:` of ${f}`}, RAM ${u} (${d})`;return(0,X.jsxs)(K,{to:`/settings/resources`,"data-slot":`host-usage-widget`,"data-state":a?`stale`:`live`,"data-frames":t.length,"aria-label":`Machine usage: ${p}. Open Settings, Resources.`,title:p,className:U(`grid grid-cols-[auto_minmax(0,1fr)_auto_auto_minmax(0,1fr)_auto] items-center gap-x-1.5 rounded-md border border-border px-2 py-1 text-[11px] leading-[14px] text-soft-foreground transition-colors hover:bg-muted hover:text-foreground`,a?`opacity-70`:null),children:[(0,X.jsx)(vm,{label:`CPU`,pct:a?void 0:s,valueSlot:`host-usage-widget-cpu`,value:c}),(0,X.jsx)(vm,{label:`RAM`,pct:a?void 0:l,valueSlot:`host-usage-widget-mem-pct`,value:u,gutter:!0})]})}function vm({label:e,pct:t,valueSlot:n,value:r,gutter:i}){let a=hm(t);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:U(`font-medium tracking-wide text-muted-foreground`,i===!0?`ml-1`:null),children:e}),(0,X.jsx)(`span`,{"data-slot":`host-usage-widget-${e.toLowerCase()}-bar`,"data-level":a,role:`meter`,"aria-label":e,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t===void 0?void 0:Math.round(mm(t)),className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,X.jsx)(`span`,{className:U(`block h-full rounded-full transition-[width] duration-500`,a===`critical`?`bg-destructive`:a===`warn`?`bg-pending`:`bg-primary`),style:{width:`${t===void 0?0:mm(t)}%`}})}),(0,X.jsx)(`span`,{"data-slot":n,className:U(`text-right font-medium tabular-nums`,a===`critical`?`text-destructive`:a===`warn`?`text-pending-strong`:`text-foreground`),children:r})]})}function ym({status:e,pending:t,error:n,dismissals:r,onDismissAuthFailures:i}){if(t||!e)return null;let a;try{a=pt(e)}catch{return null}let o=Do(a,r);if(o.length>0)return(0,X.jsxs)(`div`,{"data-slot":`provider-banner`,role:`alert`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-destructive/10 px-4 text-sm text-foreground`,children:[(0,X.jsx)(Is,{tone:`danger`}),(0,X.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,o.map(({label:e})=>e).join(`, `),`.`]}),(0,X.jsx)(K,{to:`/settings/agents#providers`,className:`ml-auto shrink-0 font-medium underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:`Open agent settings`}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Dismiss provider authentication alert`,onClick:()=>i(o),className:`shrink-0 rounded-sm p-1 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,X.jsx)(ys,{className:`size-4`,"aria-hidden":`true`})})]});if(n||a.providers.some(e=>e.enabled&&e.status===`connected`))return null;let s=a.providers.some(e=>e.status===`connected`),c=a.providers.some(e=>e.status===`unknown`);return(0,X.jsxs)(`div`,{"data-slot":`provider-banner`,role:`status`,className:`flex min-h-9 items-center gap-2 border-b border-border bg-muted/50 px-4 text-sm text-muted-foreground`,children:[(0,X.jsx)(Is,{tone:c?`danger`:`pending`}),(0,X.jsx)(`span`,{children:s?`No agent provider is enabled.`:c?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,X.jsx)(K,{to:`/settings/agents#providers`,className:`ml-auto shrink-0 font-medium text-foreground underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:`Configure providers`})]})}function bm(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function xm(){let e=ee(),t=Ue(),n=V(),r=(0,Y.useRef)(Promise.resolve()),i=(0,Y.useRef)(0),a=(0,Y.useRef)(0),o=(0,Y.useRef)(bm(t.data));(0,Y.useEffect)(()=>{a.current===0&&(o.current=bm(t.data))},[t.data]);let s=(0,Y.useCallback)(e=>{let t=R.uiState,s=bm(n.getQueryData(t)),c=mo(so(s?.dismissedProviderAuthFailures),e),l={...s,dismissedProviderAuthFailures:c};a.current+=1,n.setQueryData(t,l);let u=++i.current;r.current=r.current.then(async()=>{try{let e=await v({dismissedProviderAuthFailures:c});o.current=bm(e),u===i.current&&n.setQueryData(t,e)}catch(e){u===i.current&&(o.current===void 0?n.removeQueries({queryKey:t,exact:!0}):n.setQueryData(t,o.current),n.invalidateQueries({queryKey:t}),G(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--a.current}})},[n]);return(0,X.jsx)(ym,{status:e.data,pending:e.isPending,error:e.isError,dismissals:so(bm(t.data)?.dismissedProviderAuthFailures),onDismissAuthFailures:s})}var Sm=`https://github.com/open-mercato/cezar/blob/main/docs/telemetry.md`,Cm=`https://github.com/open-mercato/cezar/blob/main/packages/cezar/src/telemetry.ts`;function wm(e){return e!==void 0&&e.consent===`unknown`&&e.blockedBy===null}var Tm=[`How many tasks you start (agent, model)`,`How many messages you send`,`Which pages you open`,`Errors, with your paths removed`,`Version, OS, app or CLI`,`A random install id`],Em=[`Prompts, messages, code, diffs`,`File paths`,`Repo, branch or project names`,`Keys or credentials`,`Your IP, in any payload`];function Dm(){let e=V();return(0,Y.useCallback)(async t=>{try{let n=await rt({consent:t});return e.setQueryData(R.telemetryConsent,n),t===`denied`&&$t(),!0}catch(e){return G(e instanceof Error?e.message:String(e),{tone:`danger`}),!1}},[e])}function Om({busy:e,onAnswer:t,size:n}){let r=n===`lg`?`min-h-11`:`h-9`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{variant:`outline`,className:r,disabled:e,"data-slot":`telemetry-deny`,onClick:()=>t(`denied`),children:`Don’t share`}),(0,X.jsx)(W,{className:r,disabled:e,"data-slot":`telemetry-grant`,onClick:()=>t(`granted`),children:`Share usage data`})]})}function km(){let e=P(),t=Dm(),[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(!1);if(!wm(e.data))return null;let o=async e=>{r(!0);let n=await t(e);r(!1),n&&a(!1)};return(0,X.jsxs)(`div`,{"data-slot":`telemetry-consent-banner`,className:`px-4 pb-3 md:px-5 md:pb-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 rounded-lg border bg-card px-4 py-3 shadow-lg`,children:[(0,X.jsx)(Pc,{className:`hidden size-[18px] shrink-0 text-violet sm:block`,"aria-hidden":`true`}),(0,X.jsxs)(`p`,{className:`min-w-0 flex-1 basis-[280px] text-[13px] leading-relaxed text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:`Help improve cezar?`}),` With your OK we send task counts and crash reports to the maintainers — never prompts, code, paths or repo names. Change it anytime in Settings → Privacy.`,` `,(0,X.jsx)(`button`,{type:`button`,"data-slot":`telemetry-details`,className:`underline underline-offset-2 hover:text-foreground`,onClick:()=>a(!0),children:`Details`})]}),(0,X.jsx)(`div`,{className:`flex gap-2`,children:(0,X.jsx)(Om,{busy:n,onAnswer:e=>void o(e),size:`sm`})})]}),(0,X.jsx)(jm,{open:i,onOpenChange:a,busy:n,onAnswer:e=>void o(e)})]})}function Am({title:e,tone:t,items:n}){let r=t===`ok`?Fo:ys;return(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`block text-[13px] font-medium text-foreground`,children:e}),(0,X.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:n.map(e=>(0,X.jsxs)(`li`,{className:`flex gap-2 text-[13px] leading-snug text-muted-foreground`,children:[(0,X.jsx)(r,{className:`mt-0.5 size-3.5 shrink-0 ${t===`ok`?`text-success`:`text-soft-foreground`}`,"aria-hidden":`true`}),e]},e))})]})}function jm({open:e,onOpenChange:t,busy:n,onAnswer:r}){return(0,X.jsx)(Cr,{open:e,onOpenChange:t,children:(0,X.jsx)(Ar,{"data-slot":`telemetry-details-dialog`,className:`max-h-[calc(100dvh-2rem)] gap-0 overflow-y-auto p-0 sm:max-w-[480px]`,onOpenAutoFocus:e=>{e.preventDefault(),e.currentTarget.focus()},children:(0,X.jsxs)(`div`,{className:`space-y-5 p-6`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(`span`,{className:`block font-mono text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:`What is sent`}),(0,X.jsx)(yr,{className:`text-xl font-semibold tracking-tight`,children:`Usage data, in full`}),(0,X.jsx)(Or,{className:`text-sm leading-relaxed text-muted-foreground`,children:`Counts of what you use and reports of what broke, so cezar’s maintainers at Open Mercato can fix bugs without you filing them. Off until you say yes.`})]}),(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,X.jsx)(Am,{title:`Shared`,tone:`ok`,items:Tm}),(0,X.jsx)(Am,{title:`Never shared`,tone:`no`,items:Em})]}),(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`Every label is a closed list the server enforces. Withdraw anytime in Settings → Privacy or with `,(0,X.jsx)(`code`,{className:`font-mono`,children:`cezar telemetry disable`}),` — the install id is deleted.`,` `,(0,X.jsx)(`a`,{href:Cm,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:`Read the code`}),` · `,(0,X.jsx)(`a`,{href:Sm,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:`Privacy notice`})]}),(0,X.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:(0,X.jsx)(Om,{busy:n,onAnswer:r,size:`lg`})})]})})})}function Mm({archived:e,onToggle:t,className:n}){let r=e?Zs:Zi;return(0,X.jsx)(rs,{label:e?`Move back to the active list`:`Move to the archived list`,children:(0,X.jsx)(`button`,{type:`button`,"data-slot":`archive-toggle`,"aria-label":e?`Unarchive task`:`Archive task`,onClick:n=>{n.stopPropagation(),t(!e)},className:U(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-soft-foreground transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,n),children:(0,X.jsx)(r,{className:`size-3`,"aria-hidden":`true`})})})}function Nm(){return(0,X.jsx)(`span`,{"data-slot":`unread-marker`,className:`sr-only`,children:`, unread`})}var Pm={statuses:[],workflows:[],automations:[]};function Fm(e){return e.statuses.length+e.workflows.length+e.automations.length}function Im(e){let t=new Map(e.map(e=>[e.id,e]));return new Map(e.map(e=>[e.id,Ed(e,e=>t.get(e))]))}var Lm=(e,t)=>e.length===0||t!==void 0&&e.includes(t);function Rm(e,t,n,r){return e.filter(e=>{let i=r.get(e.id);return!(!Dd(i,t)||!Lm(n.statuses,e.status)||!Lm(n.workflows,sn(e))||t!==`regular`&&!Lm(n.automations,i))})}function zm(e,t){return t===`all`?[...e]:Rm(e,t,Pm,Im(e))}function Bm(e,t,n,r,i){let a=new Map;for(let o of Rm(e,t,{...n,[i]:[]},r)){let e=i===`statuses`?o.status:i===`workflows`?sn(o):r.get(o.id);e!==void 0&&a.set(e,(a.get(e)??0)+1)}return a}function Vm(e,t,n){return{regular:Rm(e,`regular`,t,n).length,automation:Rm(e,`automation`,t,n).length,all:Rm(e,`all`,t,n).length}}function Hm(e){let t=new Set;for(let n of e)n!==void 0&&t.add(n);return[...t].sort((e,t)=>e.localeCompare(t))}function Um(e){let t=new Map;for(let n of e)t.has(n.id)||t.set(n.id,{run:n,depth:0,children:[],childCount:0,descendantCount:0});let n=e=>{let n=e.dispatch?.parentRunId;if(n===void 0||n===e.id)return null;let r=t.get(n);if(r===void 0)return null;let i=new Set([e.id]),a=r;for(;a!==void 0;){if(i.has(a.run.id))return null;i.add(a.run.id);let e=a.run.dispatch?.parentRunId;a=e===void 0?void 0:t.get(e)}return r},r=[];for(let i of e){let e=t.get(i.id);if(e===void 0||e.run!==i)continue;let a=n(i);a===null?r.push(e):a.children.push(e)}let i=(e,t)=>{e.depth=t,e.childCount=e.children.length;let n=0;for(let r of e.children)n+=1+i(r,t+1);return e.descendantCount=n,n};for(let e of r)i(e,0);return r}function Wm(e,t){let n=[],r=e=>{for(let i of e)n.push(i),(i.children.length===0||t===void 0||t(i.run.id))&&r(i.children)};return r(e),n}function Gm(e,t){return Wm(Um(e),t)}function Km(e){return e<=0?null:`${e} subtask${e===1?``:`s`}`}function qm(e){return e.dispatch?.parentRunId===void 0?null:e.dispatch.kind??`implement`}var Jm=Y.createContext(void 0);function Ym({runs:e,view:t,onViewChange:n,currentRunId:r=null,now:i=Date.now(),showTokens:a=!0,showCost:o=!0,onTogglePin:s,onToggleArchive:c}){let l=Ne(e),u=ke(e,t),d=t===`archived`?void 0:s;return(0,X.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,X.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,X.jsxs)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,X.jsxs)(Qm,{view:`active`,current:t,onSelect:n,count:l.active,children:[`Active`,l.waiting>0&&t!==`active`?(0,X.jsx)(Is,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`needs you`}):null]}),(0,X.jsx)(Qm,{view:`archived`,current:t,onSelect:n,count:l.archived,children:`Archived`})]})}),u.length===0?(0,X.jsx)(`p`,{className:`px-3 py-3.5 text-xs text-soft-foreground`,children:t===`archived`?`Nothing archived yet.`:`No tasks yet — describe one.`}):(0,X.jsx)(Xm,{buckets:u,currentRunId:r,now:i,showTokens:a,showCost:o,onTogglePin:d,onToggleArchive:c})]})}function Xm({buckets:e,currentRunId:t=null,now:n=Date.now(),scope:r=null,showTokens:i=!0,showCost:a=!0,onTogglePin:o,onToggleArchive:s}){let[c,l]=Y.useState(()=>new Set),u=e=>l(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,X.jsx)(X.Fragment,{children:e.map(e=>(0,X.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":e.label,children:[(0,X.jsx)(`h2`,{className:`px-3 pt-2.5 pb-1 text-[11px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:e.label}),Zm(e.rows).map(e=>(0,X.jsx)($m,{row:e.run.row,depth:e.depth,childCount:e.childCount,currentRunId:t,now:n,scope:r,showTokens:i,showCost:a,expanded:e.run.row.kind===`group`&&c.has(e.run.row.groupId),onToggle:u,onTogglePin:o,onToggleArchive:s},e.run.id))]},e.label))})}function Zm(e){return Gm(e.map(e=>e.kind===`group`?{id:`group:${e.groupId}`,row:e}:{id:e.run.id,dispatch:e.run.dispatch,row:e}))}function Qm({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:U(`flex h-7 flex-1 items-center justify-center gap-1.5 rounded-[7px] text-[12.5px] font-medium text-muted-foreground`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,X.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function $m({row:e,depth:t,childCount:n,currentRunId:r,now:i,scope:a,expanded:o,onToggle:s,showTokens:c,showCost:l,onTogglePin:u,onToggleArchive:d}){return e.kind===`run`?(0,X.jsx)(ah,{run:e.run,depth:t,childCount:n,queuePosition:e.queuePosition,currentRunId:r,now:i,scope:a,showTokens:c,showCost:l,onTogglePin:u,onToggleArchive:d}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex items-center rounded-sm hover:bg-muted`,children:[(0,X.jsxs)(`button`,{type:`button`,"data-slot":`group-tile`,"data-group-id":e.groupId,"aria-expanded":o,onClick:()=>s(e.groupId),className:`flex min-w-0 flex-1 items-center gap-2 px-2.5 py-[7px] text-left`,children:[(0,X.jsx)(zo,{className:U(`size-3 shrink-0 text-soft-foreground transition-transform`,!o&&`-rotate-90`),"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`min-w-[7rem] flex-1 truncate text-[13px] font-medium`,children:e.title}),(0,X.jsxs)(`span`,{className:`shrink-0 rounded-full bg-muted px-1.5 py-px font-mono text-[10.5px] font-semibold text-muted-foreground`,children:[`×`,e.members.length]})]}),(0,X.jsx)(K,{to:$n(a,`/compare/${e.groupId}`),"data-slot":`group-compare`,title:`Compare the variants`,"aria-label":`Compare the variants of ${e.title}`,className:`mr-1.5 inline-flex size-6 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-violet/10 hover:text-violet`,children:(0,X.jsx)(Mc,{className:`size-3.5`,"aria-hidden":`true`})})]}),o?e.members.map(e=>(0,X.jsx)(ah,{run:e,queuePosition:null,currentRunId:r,now:i,scope:a,variant:!0,showTokens:c,showCost:l,onTogglePin:u,onToggleArchive:d},e.id)):null]})}var eh=`flex w-0 shrink-0 items-center gap-0.5 overflow-hidden opacity-0 group-hover/task-row:mr-1.5 group-hover/task-row:w-auto group-hover/task-row:opacity-100 group-focus-within/task-row:mr-1.5 group-focus-within/task-row:w-auto group-focus-within/task-row:opacity-100 no-hover:mr-1.5 no-hover:w-auto no-hover:opacity-100`,th=`no-hover:size-7`,nh=`group-hover/task-row:hidden group-focus-within/task-row:hidden`,rh=`no-hover:hidden`,ih=`group-hover/task-row:min-w-0 group-focus-within/task-row:min-w-0 no-hover:min-w-0`,ah=Y.memo(function({run:e,depth:t=0,childCount:n=0,queuePosition:r,currentRunId:i,now:a,scope:o,variant:s=!1,showTokens:c,showCost:l,onTogglePin:u,onToggleArchive:d}){let f=!!d&&(!!e.archived||!qi(e.status)),p=!!u||f,m=re(e),h=e.id===i,g=St(e,Y.useContext(Jm)),_=he(e),v=S(_,g?.number)?de(_).rest:_,y=ma(e),b=fa(e),x=s?``:r===null?Ls(ln(e),a):`#${r}`,C=Km(n),w=qm(e);return(0,X.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":h?`true`:void 0,"data-depth":t,style:t>0?{paddingLeft:`${10+t*14}px`}:void 0,className:U(`group/task-row flex items-center gap-2 rounded-sm pl-2.5 hover:bg-muted`,h&&`bg-muted`,s&&`pl-[26px]`),children:[(0,X.jsx)(Is,{tone:m.tone,pulse:m.pulse,"aria-label":m.label,role:`img`}),g?(0,X.jsx)(Gi,{run:e,reference:g,compact:!0,className:`h-auto shrink-0 gap-[2px] px-1.5 py-px text-[10.5px]`}):null,(0,X.jsxs)(K,{to:$n(o,`/tasks/${e.id}`),title:_,"aria-current":h?`page`:void 0,className:U(`flex min-w-0 flex-1 items-center gap-2 py-[7px]`,p?`pr-0.5`:`pr-2.5`),children:[s?(0,X.jsx)(`span`,{className:`inline-flex size-[15px] shrink-0 items-center justify-center rounded-full bg-violet/15 font-mono text-[9.5px] font-semibold text-violet`,children:e.variant??`?`}):null,(0,X.jsx)(`span`,{"data-slot":`task-row-title`,className:U(`min-w-[7rem] flex-1 truncate text-[13px]`,p&&ih,y?`font-semibold text-foreground`:b?`font-medium text-muted-foreground`:`font-medium`),children:s?oh(e,c,l):v}),(0,X.jsxs)(`span`,{"data-slot":`task-row-meta`,className:U(`contents`,p&&nh),children:[(0,X.jsxs)(`span`,{"data-slot":`task-row-meta-droppable`,className:U(`contents`,p&&rh),children:[w?(0,X.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:w}):null,e.diffStat?(0,X.jsx)(zs,{stat:e.diffStat,className:`hidden shrink-0 text-[10.5px] @min-[23rem]/sidebar:inline`}):null,C?(0,X.jsx)(`span`,{"data-slot":`subtask-count`,title:C,className:`hidden shrink-0 rounded-full bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground @min-[19rem]/sidebar:inline`,children:n}):null]}),x&&(r!==null||!g)?(0,X.jsx)(`span`,{"data-slot":`task-row-age`,className:U(`shrink-0 text-[11px] text-soft-foreground tabular-nums`,w&&t>0&&r===null&&`hidden @min-[19rem]/sidebar:inline`),children:x}):null]}),y?(0,X.jsx)(Nm,{}):null]}),p?(0,X.jsxs)(`div`,{"data-slot":`task-row-actions`,className:eh,children:[u?(0,X.jsx)(na,{pinned:!!e.pinned,onToggle:t=>u(e,t),className:th}):null,f&&d?(0,X.jsx)(Mm,{archived:!!e.archived,onToggle:t=>d(e,t),className:th}):null]}):null]})});function oh(e,t,n){let r=[e.runner??`claude`];t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&r.push(bs(e.inputTokens,e.outputTokens));let i=en(e.costUsd);return n&&i&&r.push(i),r.join(` · `)}function sh(){let e=Dt(),t=Pe(dr(),e.data?.bootProject??null),n=p(`sidebar`),r=Rs(e.data),[i,a]=fm(),[o]=Fd(),s=Y.useMemo(()=>t.data?zm(t.data,o):void 0,[t.data,o]),c=ar(`/tasks/:id/*`),l=ar(`/tasks/:id`),u=yi(3e4),d=Y.useCallback((e,t)=>n.mutate({id:e.id,pinned:t},{onError:e=>G(e.message,{tone:`danger`})}),[n.mutate]),f=ft(`sidebar`),m=Y.useCallback((e,t)=>f.mutate({id:e.id,archived:t},{onError:e=>G(e.message,{tone:`danger`})}),[f.mutate]),h=We(),g=Re(),_=Y.useMemo(()=>h===void 0?[]:(s??[]).flatMap(e=>vt(e).map(e=>({projectId:h,kind:e.kind,number:e.number}))),[s,h]);return s?(0,X.jsx)(Sr,{projectId:h,requests:_,children:(0,X.jsx)(Jm.Provider,{value:g,children:(0,X.jsx)(Ym,{runs:s,view:i,onViewChange:a,currentRunId:c?.params.id??l?.params.id??null,now:u,showTokens:r.tokens,showCost:r.cost,onTogglePin:d,onToggleArchive:m})})}):null}var ch=`cez-sidebar-collapsed`;function lh(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 uh(){try{let e=localStorage.getItem(ch);return e===null?{}:lh(JSON.parse(e))}catch{return{}}}function dh(e){try{localStorage.setItem(ch,JSON.stringify(e))}catch{}}function fh(e,t,n){let r=e?.[t];return r===void 0?t!==n:r}var ph=10;function mh(e){let[t,n]=Y.useState(uh),r=Y.useRef(t),i=Y.useCallback(e=>{r.current=e,dh(e),n(e)},[]);return{collapsed:t,toggle:Y.useCallback(t=>{i({...r.current,[t]:!fh(r.current,t,e)})},[e,i]),expand:Y.useCallback(e=>{if(!(e in r.current))return;let t={...r.current};delete t[e],i(t)},[i])}}function hh({projects:e,bootProjectId:t,inboxAvailable:n=!1,automationsAvailable:r=!1,inboxCount:i=null,skillsUpdateAvailable:a=!1}){let{pathname:o}=mr(),s=ir(o),c=s??t,{collapsed:l,toggle:u,expand:d}=mh(c),[f]=fm(),p=ed(cr(o)),m=ar(`/tasks/:id/*`),h=ar(`/tasks/:id`),g=m?.params.id??h?.params.id??null,_=yi(3e4),v=Rs(Dt().data),{order:y,canReorder:b,setOrder:x}=zd(),S=Y.useMemo(()=>{let t=bd(e,y),n=t.filter(e=>e.unregistered);return n.length===0?t:[...n,...t.filter(e=>!e.unregistered)]},[e,y]),C=Y.useMemo(()=>S.map(e=>e.id),[S]),w=ri(Hr(ti,{activationConstraint:{distance:4}}),Hr(Br,{coordinateGetter:Zr})),T=b&&S.length>1,E=Y.useCallback(e=>{let{active:t,over:n}=e;if(n===null||n.id===t.id)return;let r=C.indexOf(String(t.id)),i=C.indexOf(String(n.id));r===-1||i===-1||x(xd(C,r,i))},[C,x]),D=Y.useMemo(()=>{let e=e=>{let t=C.indexOf(String(e));return{name:S[t]?.name??String(e),position:`position ${t+1} of ${C.length}`}};return{onDragStart:({active:t})=>{let{name:n,position:r}=e(t.id);return`Picked up ${n}, ${r}.`},onDragOver:({active:t,over:n})=>n?`${e(t.id).name} moved to ${e(n.id).position}.`:`${e(t.id).name} is not over a drop position.`,onDragEnd:({active:t,over:n})=>n?`${e(t.id).name} dropped at ${e(n.id).position}.`:`${e(t.id).name} dropped. The order is unchanged.`,onDragCancel:({active:t})=>`Reordering cancelled. ${e(t.id).name} returned to ${e(t.id).position}.`}},[S,C]),O=S.map(e=>(0,X.jsx)(_h,{project:e,boot:e.id===t,active:e.id===s,collapsed:fh(l,e.id,c),onToggle:u,onSelect:d,view:f,activeTo:p,currentRunId:g,now:_,inboxAvailable:n,automationsAvailable:r,inboxCount:i,skillsUpdateAvailable:a,showTokens:v.tokens,showCost:v.cost,sortable:T,position:C.indexOf(e.id)+1,total:C.length},e.id));return(0,X.jsx)(`div`,{"data-slot":`project-group-list`,children:(0,X.jsx)(Kr,{sensors:w,collisionDetection:ii,accessibility:{announcements:D},onDragEnd:E,children:(0,X.jsx)(Wr,{items:C,strategy:Qr,children:O})})})}function gh({name:e,position:t,total:n,disabled:r,handleProps:i}){return(0,X.jsx)(`button`,{type:`button`,"data-slot":`project-group-grip`,disabled:r,"aria-label":`Reorder ${e}, position ${t} of ${n}`,className:U(`flex h-11 w-6 shrink-0 cursor-grab items-center justify-center rounded text-muted-foreground opacity-0 outline-none transition-opacity md:h-[34px] md:w-4`,`touch-none focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50`,`group-hover/row:opacity-100 group-focus-within/row:opacity-100`,`[@media(hover:none)]:opacity-100`,r&&`cursor-default group-hover/row:opacity-0 group-focus-within/row:opacity-0 [@media(hover:none)]:opacity-0`),...i,children:(0,X.jsx)(oo,{"aria-hidden":`true`,className:`size-3.5`})})}function _h({project:e,boot:t,active:n,collapsed:r,onToggle:i,onSelect:a,view:o,activeTo:s,currentRunId:c,now:l,inboxAvailable:u,automationsAvailable:d,inboxCount:f,skillsUpdateAvailable:m,showTokens:h,showCost:g,sortable:_,position:v,total:y}){let b=e.status===`missing`,x=_&&!b&&!e.unregistered,{attributes:S,listeners:C,setNodeRef:w,transform:T,transition:E,isDragging:D}=qr({id:e.id,disabled:!x}),O={transform:Rr.Translate.toString(T),transition:E},k=(0,X.jsx)(gh,{name:e.name,position:v,total:y,disabled:!x,handleProps:{...S,...C}}),A=Fe(e.id,!r&&!b,t),j=Re(),M=e.repoUrl??(n?j:void 0),N=Cp(),P=p(`sidebar`,e.id,t?`default`:e.id),F=Y.useCallback((e,t)=>P.mutate({id:e.id,pinned:t},{onError:e=>G(e.message,{tone:`danger`})}),[P.mutate]),I=ft(`sidebar`,e.id,t?`default`:e.id),ee=Y.useCallback((e,t)=>I.mutate({id:e.id,archived:t},{onError:e=>G(e.message,{tone:`danger`})}),[I.mutate]),[te]=Fd(),ne=A.data?Ne(A.data).waiting:0,L=A.data?it(ke(zm(A.data,te),o),ph):[],re=L.flatMap(t=>t.rows.flatMap(t=>vt(t.kind===`run`?t.run:t.members[0]).map(t=>({projectId:e.id,kind:t.kind,number:t.number}))));if(b)return(0,X.jsx)(`div`,{ref:w,style:O,"data-slot":`project-group`,"data-project":e.id,"data-status":`missing`,className:U(`mb-1`,D&&`relative z-10 opacity-40`),children:(0,X.jsxs)(`div`,{className:`flex items-center`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`w-6 shrink-0 md:w-4`}),(0,X.jsxs)(`div`,{"data-slot":`project-group-header`,title:`${e.root} is gone — remove it in Global settings → Projects`,className:`flex h-11 min-w-0 flex-1 items-center gap-[7px] rounded-lg px-2 text-[13px] font-semibold opacity-55 md:h-[34px]`,children:[(0,X.jsx)(`span`,{className:`w-3 shrink-0`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.name}),(0,X.jsx)(`span`,{"data-slot":`project-missing`,className:`ml-auto shrink-0 rounded-full bg-danger/15 px-[7px] py-px text-[10px] font-medium text-danger`,children:`folder not found`})]})]})});let ie=`project-group-${e.id}`;return(0,X.jsxs)(`div`,{ref:w,style:O,"data-slot":`project-group`,"data-project":e.id,"data-status":e.status,"data-collapsed":r?``:void 0,"data-dragging":D?``:void 0,"data-active":n?``:void 0,className:U(`mb-1`,D&&`relative z-10 opacity-40`),children:[(0,X.jsxs)(`div`,{className:`group/row flex items-center`,children:[k,(0,X.jsxs)(`div`,{"data-slot":`project-group-row`,className:U(`flex min-w-0 flex-1 items-center rounded-lg transition-colors hover:bg-muted`,n&&`bg-muted`),children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>i(e.id),"aria-expanded":!r,"aria-controls":ie,"aria-label":`${r?`Expand`:`Collapse`} ${e.name}`,"data-slot":`project-group-disclosure`,className:U(`flex h-11 w-[27px] shrink-0 items-center justify-center rounded-lg md:h-[34px]`),children:(0,X.jsx)(zo,{className:U(`size-3 shrink-0 text-muted-foreground transition-transform`,r&&`-rotate-90`),"aria-hidden":`true`})}),(0,X.jsxs)(K,{to:$n(e.id,`/`),onClick:()=>{a(e.id),N?.()},"aria-current":n?`true`:void 0,"data-slot":`project-group-header`,className:U(`flex h-11 min-w-0 flex-1 items-center gap-[7px] rounded-lg pr-2 text-left text-[13px] font-semibold md:h-[34px]`,n&&`text-foreground`),children:[(0,X.jsx)(`span`,{className:`truncate`,children:e.name}),e.unregistered?(0,X.jsx)(`span`,{"data-slot":`project-unregistered`,title:`cezar is serving this folder — it is not in your saved projects. Add it in Global settings → Projects.`,className:`shrink-0 rounded-full bg-muted px-[7px] py-px text-[10px] font-medium text-soft-foreground`,children:`not saved`}):null,ne?(0,X.jsx)(`span`,{"data-slot":`project-attention`,title:`${ne} task${ne===1?``:`s`} need${ne===1?`s`:``} you`,className:`shrink-0 rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:ne}):null,e.branch?(0,X.jsx)(`span`,{"data-slot":`project-branch`,className:`ml-auto max-w-[92px] truncate font-mono text-[10.5px] font-medium text-soft-foreground`,children:e.branch}):null]})]})]}),r?null:(0,X.jsxs)(`div`,{id:ie,"data-slot":`project-group-body`,className:`mt-1 ml-[14px] border-l border-border pl-2`,children:[(0,X.jsx)(`nav`,{"aria-label":`${e.name} navigation`,children:Qu({forge:e.forge===`github`,inbox:u,automations:d,tracker:e.tracker}).map(t=>{let r=n&&t.to===s,i=t.icon;return(0,X.jsxs)(K,{to:$n(e.id,t.to),onClick:N,"aria-current":r?`page`:void 0,className:U(`flex h-11 w-full items-center gap-2.5 rounded-md px-2.5 text-[13px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground md:h-[30px]`,r&&`bg-muted font-semibold text-foreground`),children:[(0,X.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),t.label,t.badge===`inbox-count`&&n&&f?(0,X.jsx)(`span`,{"data-slot":`nav-badge`,className:`ml-auto rounded-full bg-violet px-1.5 py-px text-[10.5px] font-semibold text-violet-foreground`,children:f}):null,t.badge===`skills-update`&&n&&m?(0,X.jsxs)(`span`,{"data-slot":`nav-update-marker`,className:`ml-auto flex items-center`,children:[(0,X.jsx)(`span`,{className:`size-1.5 rounded-full bg-violet`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Skills update available`})]}):null]},t.to)})}),(0,X.jsx)(Sr,{projectId:e.id,requests:re,children:(0,X.jsx)(Jm.Provider,{value:M,children:(0,X.jsx)(Xm,{buckets:L,currentRunId:n?c:null,now:l,scope:e.id,showTokens:h,showCost:g,onTogglePin:o===`archived`?void 0:F,onToggleArchive:ee})})}),(0,X.jsx)(K,{to:$n(e.id,`/`),onClick:N,"data-slot":`project-group-more`,className:`flex h-9 items-center rounded-md px-3 text-[12px] text-muted-foreground transition-colors hover:text-foreground md:h-7`,children:`More…`})]})]})}var vh={claude:!0,codex:!0,junie:!0,opencode:!0,cursor:!0,pi:!0,copilot:!0},yh=e=>Object.hasOwn(vh,e.name);function bh(e){let t=e.checks.filter(yh);if(t.length&&!t.some(e=>e.available))return`no agent CLI found — install one to run tasks`;let n=t.find(t=>t.name===e.defaultRunner);return n&&!n.available?`default runner (${e.defaultRunner}) not found`:null}function xh(e){let t=`cezar v${e.version}`,n=bh(e);if(n)return`${t} · ${n}`;let r=e.checks.filter(e=>!e.available).map(e=>e.name);return r.length?`${t} · optional: ${r.join(`, `)} not installed`:t}function Sh(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 Ch({health:e}){if(!e)return null;let t=bh(e);return(0,X.jsxs)(ts,{children:[(0,X.jsx)(is,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,title:xh(e),className:`flex items-center gap-1.5 rounded-full border border-border px-2 py-0.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,X.jsx)(Is,{tone:t?`pending`:`success`}),`Tools`,(0,X.jsx)(zo,{className:`size-[11px]`,"aria-hidden":`true`})]})}),(0,X.jsxs)(ns,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[(0,X.jsx)(Xo,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,X.jsx)(wh,{check:e},e.name):(0,X.jsx)(Eh,{check:e},e.name)),Sh(e)?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Zo,{}),(0,X.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-[11px] leading-snug text-muted-foreground`,children:Sh(e)})]}):null,(0,X.jsx)(Zo,{}),(0,X.jsx)($o,{asChild:!0,children:(0,X.jsxs)(or,{to:Th,"data-slot":`tools-settings`,className:`gap-2 text-[12.5px] text-muted-foreground`,children:[(0,X.jsx)(Nc,{className:`size-3.5`,"aria-hidden":`true`}),`Agent accounts`]})})]})]})}function wh({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)(Is,{tone:`success`}),(0,X.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,X.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11.5px] font-medium text-muted-foreground tabular-nums`,children:e.version??`not found`})]})}var Th=`/settings/global/accounts`;function Eh({check:e}){let t=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Is,{tone:`danger`}),(0,X.jsx)(`span`,{className:`font-mono text-[12.5px] font-medium`,children:e.name}),(0,X.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11.5px] font-medium text-muted-foreground`,children:`not found`})]}),e.hint||yh(e)?(0,X.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[e.hint?(0,X.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-[11px] leading-snug text-muted-foreground`,children:e.hint}):null,yh(e)?(0,X.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-[11.5px] font-semibold text-violet`,children:`Set up →`}):null]}):null]});return yh(e)?(0,X.jsx)($o,{asChild:!0,children:(0,X.jsx)(or,{to:`${Th}?agent=${encodeURIComponent(e.name)}`,"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:t})}):(0,X.jsx)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex flex-col items-stretch gap-1 rounded-sm px-2 py-1.5`,children:t})}function Dh(e){return e?.trim()||null}function Oh({projectName:e,pageLabel:t,brandName:n}){let r=Dh(e),i=Dh(t),a=Dh(n??null)??`cezar`;return r&&i?`${r} — ${i} · ${a}`:r?`${r} · ${a}`:i?`${i} · ${a}`:a}function kh(e){let t=Oh(e);(0,Y.useEffect)(()=>{document.title=t},[t]),(0,Y.useEffect)(()=>{let t=document.querySelector(`link[rel="icon"]`);t||(t=document.createElement(`link`),t.rel=`icon`,document.head.append(t)),t.href=e.brandLogoUrl??`/icon.svg`,t.type=e.brandLogoUrl?.includes(`.svg?`)?`image/svg+xml`:``},[e.brandLogoUrl])}var Ah=`cez-last-location`;function jh(){try{let e=localStorage.getItem(Ah);return e===null?null:JSON.parse(e)}catch{return null}}function Mh(e){try{localStorage.setItem(Ah,JSON.stringify(e))}catch{}}var Nh=new Set([`projectId`,`pathname`,`search`,`hash`]);function Ph(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(Object.keys(t).some(e=>!Nh.has(e))||typeof t.projectId!=`string`||t.projectId.length<1||t.projectId.length>64||typeof t.pathname!=`string`||t.pathname.length<1||t.pathname.length>2048||!t.pathname.startsWith(`/p/`)||_f(t.pathname)||t.search!==void 0&&(typeof t.search!=`string`||t.search.length>4096||!t.search.startsWith(`?`))||t.hash!==void 0&&(typeof t.hash!=`string`||t.hash.length>2048||!t.hash.startsWith(`#`)))return null;try{if(ir(t.pathname)!==t.projectId)return null}catch{return null}return{projectId:t.projectId,pathname:t.pathname,...t.search===void 0?{}:{search:t.search},...t.hash===void 0?{}:{hash:t.hash}}}function Fh(e,t){let n=t.projects.find(t=>t.id===e);return n!==void 0&&n.status!==`missing`}function Ih(e,t){if(t===void 0)return null;let n;try{n=ir(e.pathname)}catch{return null}return n===null||!Fh(n,t)?null:Ph({projectId:n,pathname:e.pathname,...e.search===``?{}:{search:e.search},...e.hash===``?{}:{hash:e.hash}})}function Lh(e,t,n){let r=Ph(e);return r===null||!(t===void 0?n!==void 0&&r.projectId===n:Fh(r.projectId,t))?null:`${r.pathname}${r.search??``}${r.hash??``}`}function Rh(e,t){if(e===void 0)return t;let{projects:n}=e;return n.length===0||n.some(e=>e.id===t)?t:bd(n.filter(e=>e.status!==`missing`),[])[0]?.id??t}function zh(e,t){let n=Ph(e);return n!==null&&n.projectId===t.projectId&&n.pathname===t.pathname&&(n.search??``)===(t.search??``)&&(n.hash??``)===(t.hash??``)}function Bh(){return(0,X.jsxs)(`div`,{"data-route":`automations`,className:`flex min-h-full flex-col`,children:[(0,X.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,X.jsx)(`h1`,{className:`text-base font-semibold`,children:`Automations`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Scheduled and GitHub-triggered runs.`})]}),(0,X.jsx)(`p`,{"data-slot":`automations-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading automations…`})]})}function Vh(){return(0,X.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(fs,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading variants…`,subtitle:`Fetching every variant's status, spend and diff summary.`})})}function Hh(){return(0,X.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(fs,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}var Uh={workflow:null,skills:[],runner:null,model:null},Wh=`cez-followup-selection`,Gh=ca.map(e=>e.id);function Kh(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[],runner:Gh.includes(t.runner)?t.runner:null,model:typeof t.model==`string`?t.model:null}}function qh(){try{let e=localStorage.getItem(Wh);return e?Kh(JSON.parse(e)):{...Uh}}catch{return{...Uh}}}function Jh(e){try{localStorage.setItem(Wh,JSON.stringify({...qh(),...e}))}catch{}}var Yh=`cez-followup-prompt:`;function Xh(e){try{return localStorage.getItem(Yh+e)??``}catch{return``}}function Zh(e,t){try{t===``?localStorage.removeItem(Yh+e):localStorage.setItem(Yh+e,t)}catch{}}function Qh(e){let t=ee(),n=yt(),r=Bt(t.data),i=n.data?.defaultRunner,a=Fi(e.runner,r,i??r[0]??`claude`),o=y(a),s=n.data?.modelsLocked===!0,{accounts:c,repoAccount:l}=bo(),u=c.some(t=>t.provider===a&&t.id===e.account)?e.account:null;return{runner:a,runnerExplicit:e.runner!==null,model:ka(s?null:e.model,a,n.data?.defaultModels,o.data),runners:r,defaultRunner:i,canRun:t.isSuccess&&r.length>0,modelsLocked:s,providerPending:t.isPending,providerError:t.isError,accounts:c,account:u,repoAccount:l}}function $h(e){let[t,n]=(0,Y.useState)(eg);return(0,Y.useEffect)(()=>{e&&Jh({runner:t.runner,model:t.model})},[e,t.runner,t.model]),rg(t,n),[t,n]}function eg(){let e=qh();return{runner:e.runner,model:e.model,account:null}}function tg(){return $h(!0)}function ng(){return $h(!1)}function rg(e,t){let n=ee(),r=yt(),i=Bt(n.data),a=Fi(e.runner,i,r.data?.defaultRunner??i[0]??`claude`),o=n.isSuccess&&i.length>0,s=o&&e.runner!==null&&!i.includes(e.runner),c=o&&e.model!==null&&Hi(e.model,a);(0,Y.useEffect)(()=>{!s&&!c||t({...e,runner:s?null:e.runner,model:c?null:e.model})},[s,c,e,t])}function ig(e){return{runner:Xi(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0}}function ag(e){return{...ig(e),...e.account?{agentProfile:e.account}:{}}}function og({pick:e,onChange:t,disabled:n=!1,accounts:r=!1}){let i=Qh(e),{runner:a,model:o,runners:s,canRun:c,modelsLocked:l}=i,u=yt(),d=y(a),f=Bi(a,d.data,[e.model,u.data?.defaultModels?.[a]]),p=n||!c,m=r?i.accounts:[];return(0,X.jsxs)(X.Fragment,{children:[s.length>1||s.some(e=>So(m,e))?(0,X.jsx)(Ba,{runners:s,value:a,accounts:m,account:r?i.account:null,repoAccount:r?i.repoAccount:void 0,disabled:p,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===a?e.model:null}:{runner:n,account:null,model:null})}):null,(0,X.jsx)(ha,{slot:`model-pill`,ariaLabel:`Model`,label:f.find(e=>e.id===o).label,value:o,disabled:p,readOnly:l===!0,disabledHint:l?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,model:n}),options:f.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:la(a,d.data,d.isError)})]})}function sg({templates:e,onInsert:t,triggerClassName:n,disabled:r,iconOnly:i=!1}){let[a,o]=(0,Y.useState)(!1),s=(0,Y.useRef)(null),c=tr();return e.length===0?null:(0,X.jsxs)(jr,{open:a,onOpenChange:o,children:[(0,X.jsx)(kr,{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:U(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,i?`w-[26px] justify-center px-0`:`px-2.5`,n),children:[(0,X.jsx)(Oc,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),i?null:(0,X.jsxs)(X.Fragment,{children:[`templates`,(0,X.jsx)(zo,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})]})}),(0,X.jsx)(br,{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)(pi,{filter:to,children:[(0,X.jsx)(gi,{placeholder:`search templates…`,onInput:()=>s.current?.scrollTo(0,0)}),(0,X.jsxs)(di,{ref:s,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,X.jsx)(ci,{children:`Nothing matches.`}),(0,X.jsx)(li,{heading:`Insert a template`,children:e.map(e=>(0,X.jsxs)(mi,{value:`template ${e.label} ${e.id}`,keywords:[e.text,...e.skills??[]],"data-slot":`prompt-template-option`,"data-template":e.id,title:e.text,className:`flex-col items-start gap-0.5`,onSelect:()=>{t(e.text),o(!1)},children:[(0,X.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12.5px] font-medium text-foreground`,children:e.label}),e.skills&&e.skills.length>0?(0,X.jsxs)(`span`,{"data-slot":`prompt-template-assigned`,title:`Applied automatically with: ${e.skills.join(`, `)}`,className:`inline-flex shrink-0 items-center gap-0.5 text-[10px] font-medium text-violet`,children:[(0,X.jsx)(ya,{"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)(ui,{}),(0,X.jsx)(li,{children:(0,X.jsx)(mi,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-[12px] text-muted-foreground`,onSelect:()=>{o(!1),c(`/settings/instructions#prompt-templates`)},children:`Edit templates…`})})]})]})})]})}var cg=re({status:`waiting`});function lg(e){return e.filter(e=>!e.startedTaskId)}function ug(e){return e.runnable??!!(e.suggestedSkill||e.suggestedPrompt)}function dg(){let e=Dt(),t=e.data?.capabilities.followups===!0,n=e.data!==void 0&&!t,r=ie(!n),i=un(),a=r.data===void 0?void 0:lg(r.data);return(0,X.jsxs)(`div`,{"data-route":`inbox`,className:`flex min-h-full flex-col`,children:[(0,X.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,X.jsx)(`h1`,{className:`text-base font-semibold`,children:`Inbox`}),(0,X.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:n?`Disabled for this server; per-task Notes still run.`:`Follow-ups agents suggested when they finished a task.`})]}),(0,X.jsx)(`div`,{className:`flex flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:n?(0,X.jsx)(J,{icon:(0,X.jsx)(_c,{}),tone:`neutral`,title:`The follow-up inbox is off`,subtitle:`Agents are not asked to leave follow-ups. Set CEZ_FOLLOWUPS=1 and restart the service to turn the inbox on.`,heading:`h2`}):a===void 0?r.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(ds,{}),tone:`danger`,title:`Could not load the inbox`,subtitle:r.error.message,heading:`h2`}):null:a.length===0?e.isPending?null:(0,X.jsx)(J,{icon:(0,X.jsx)(_c,{}),tone:`neutral`,title:`Inbox empty`,subtitle:`Agents drop follow-up suggestions here when they finish a task.`,heading:`h2`}):(0,X.jsx)(`ul`,{"data-slot":`todo-list`,className:`mx-auto flex w-full max-w-3xl flex-col gap-2.5`,children:a.map(e=>(0,X.jsx)(fg,{todo:e,sourceTaskExists:e.taskId===void 0?null:i.data?.some(t=>t.id===e.taskId)??!1},e.id))})})]})}function fg({todo:e,sourceTaskExists:t}){let n=tr(),r=V(),i=Le(),[a,o]=ng(),s=Qh(a),[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(``),f=(0,Y.useRef)(null),p=Dt(),m=uo(fo(i.data?.promptTemplates),p.data?.capabilities),h=e=>{let t=f.current?.selectionStart??u.length,n=yo(u,t,e);d(n.text),requestAnimationFrame(()=>{f.current?.focus(),f.current?.setSelectionRange(n.caret,n.caret)})},g=B({mutationFn:async()=>s.canRun?Ye(e.id,{...ig(s),prompt:u.trim()||void 0}):null,onSuccess:e=>{if(e===null)return;Ca(`inbox`);let{run:t}=e;r.invalidateQueries({queryKey:z.todos}),r.invalidateQueries({queryKey:z.runs.all}),n(`/tasks/${t.id}`)},onError:e=>G(e.message,{tone:`danger`})}),_=B({mutationFn:()=>kt(e.id),onSuccess:()=>{r.setQueryData(z.todos,t=>t?.filter(t=>t.id!==e.id)),r.invalidateQueries({queryKey:z.todos})},onError:e=>G(e.message,{tone:`danger`})}),v=g.isPending||_.isPending,y=ug(e);return(0,X.jsxs)(`li`,{"data-slot":`todo-card`,"data-id":e.id,className:`flex flex-col gap-2.5 rounded-lg border border-border bg-card p-4 shadow-xs`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(Is,{tone:cg.tone,pulse:cg.pulse,title:cg.label,className:`mt-[5px]`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{"data-slot":`todo-summary`,className:`text-sm leading-snug font-medium text-foreground`,children:e.summary}),(0,X.jsxs)(`div`,{"data-slot":`todo-meta`,className:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-soft-foreground`,children:[e.ts?(0,X.jsxs)(`span`,{children:[Ls(e.ts),` ago`]}):null,e.action?(0,X.jsx)(`span`,{children:e.action}):null,e.taskId===void 0?null:t?(0,X.jsx)(K,{to:`/tasks/${e.taskId}`,"data-slot":`todo-source`,className:`text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`source task`}):(0,X.jsx)(`span`,{"data-slot":`todo-source-gone`,children:`source task deleted`}),Bn(e.prUrl)?(0,X.jsx)(`a`,{href:e.prUrl,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`todo-pr`,className:`text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`PR`}):null,e.suggestedSkill?(0,X.jsxs)(`span`,{"data-slot":`todo-skill`,className:`font-mono`,children:[`skill: `,e.suggestedSkill]}):null]})]}),(0,X.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5 self-center`,children:y?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(W,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-run`,title:`Start a task from this follow-up`,disabled:v||!s.canRun,onClick:()=>g.mutate(),children:[(0,X.jsx)(hs,{"aria-hidden":`true`,className:`size-3`}),`Run`]}),(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`todo-dismiss`,title:`Check off (remove)`,disabled:v,onClick:()=>_.mutate(),children:`Dismiss`})]}):(0,X.jsxs)(W,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`todo-acknowledge`,title:`Acknowledge and remove this note`,disabled:v,onClick:()=>_.mutate(),children:[(0,X.jsx)(Fo,{"aria-hidden":`true`,className:`size-3`}),`Acknowledge`]})})]}),y?(0,X.jsxs)(`div`,{"data-slot":`todo-engine`,className:`flex flex-wrap items-center gap-2 pl-5`,children:[(0,X.jsx)(og,{pick:a,onChange:o,disabled:v||!s.canRun}),!s.providerPending&&!s.canRun?(0,X.jsxs)(`span`,{"data-slot":`todo-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[s.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this follow-up.`,(0,X.jsx)(K,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}):null,y?c?(0,X.jsxs)(`div`,{"data-slot":`todo-instructions`,className:`flex flex-col gap-2 pl-5`,children:[(0,X.jsx)(Po,{ref:f,"data-slot":`todo-instructions-input`,"aria-label":`Extra instructions for this follow-up`,value:u,onChange:e=>d(e.target.value),placeholder:`Add instructions for the agent… (appended to the suggestion above)`,maxLength:2e4,className:`min-h-16 text-[13px]`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(sg,{templates:m,onInsert:h}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-hide`,onClick:()=>l(!1),className:`text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:`Hide`})]})]}):(0,X.jsx)(`button`,{type:`button`,"data-slot":`todo-instructions-toggle`,onClick:()=>l(!0),className:`self-start pl-5 text-xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground`,children:u.trim()?`Edit instructions (added)`:`+ Add instructions`}):null]})}function pg({onLongPress:e,onClick:t,delayMs:n=450,moveTolerance:r=8}){let i=(0,Y.useRef)({onLongPress:e,onClick:t});i.current={onLongPress:e,onClick:t};let a=(0,Y.useRef)(null),o=(0,Y.useRef)({x:0,y:0}),s=(0,Y.useRef)(!1),c=(0,Y.useCallback)(()=>{a.current!==null&&(clearTimeout(a.current),a.current=null)},[]);return(0,Y.useEffect)(()=>c,[c]),{onPointerDown:(0,Y.useCallback)(e=>{s.current=!1,c(),e.button===0&&(o.current={x:e.clientX??0,y:e.clientY??0},a.current=setTimeout(()=>{a.current=null,s.current=!0,i.current.onLongPress()},n))},[c,n]),onPointerMove:(0,Y.useCallback)(e=>{if(a.current===null)return;let t=(e.clientX??0)-o.current.x,n=(e.clientY??0)-o.current.y;Math.hypot(t,n)>r&&c()},[c,r]),onPointerUp:c,onPointerCancel:c,onContextMenu:(0,Y.useCallback)(e=>{e.preventDefault(),c(),!s.current&&(s.current=!0,i.current.onLongPress())},[c]),onClick:(0,Y.useCallback)(e=>{if(s.current){s.current=!1,e.preventDefault();return}i.current.onClick?.()},[]),onKeyDown:(0,Y.useCallback)(e=>{(e.key===`ArrowDown`||e.key===`Enter`&&e.shiftKey)&&(e.preventDefault(),i.current.onLongPress())},[])}}function mg({available:e,value:t,onChange:n,onSettingsOpenChange:r,runners:i,parentRunner:a,parentModels:o}){let[s,c]=(0,Y.useState)(!1),l=Ni(),u=(0,Y.useRef)({});t!==null&&(u.current=t);let d=(t??u.current).runner??a,f=y(d,e&&d!==a),p=d===a?o:Bi(d,f.data),m=e=>{c(e),r?.(e)},h=t!==null,g=pg({onLongPress:()=>m(!0),onClick:()=>n(h?null:u.current)});if(!e)return null;let _=(0,X.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":h,"aria-label":`Dispatch`,"data-slot":`dispatch-toggle`,"data-state":h?`on`:`off`,...g,className:U(l?`inline-flex h-full w-[26px] items-center justify-center transition-colors hover:bg-muted`:U(Ua,`w-[26px] justify-center px-0`),h&&(l?`hover:bg-primary/15`:`border-primary/60 bg-primary/10 text-primary hover:bg-primary/15 hover:text-primary`)),children:(0,X.jsx)(Fc,{"aria-hidden":`true`,className:U(`size-3 shrink-0`,h?`text-primary`:`text-soft-foreground`)})}),v=(0,X.jsx)(xg,{value:t,remembered:u.current,onChange:n,runners:i,models:p}),b=(0,X.jsxs)(Ho,{side:`top`,sideOffset:6,className:`max-w-[260px]`,children:[(0,X.jsx)(`div`,{className:`font-medium`,children:h?`Dispatch — on`:`Dispatch — off`}),(0,X.jsx)(`div`,{className:`text-contrast-foreground/80`,children:h?`Splits this task into subtasks it runs as separate tasks`:`Let this task split into subtasks`}),l?(0,X.jsx)(`div`,{className:`mt-0.5 text-contrast-foreground/60`,children:`▾ limits and subtask defaults`}):null]}),x=l?(0,X.jsxs)(`span`,{"data-slot":`dispatch-control`,"data-state":h?`on`:`off`,className:U(`inline-flex h-[26px] items-stretch overflow-hidden rounded-full border border-border bg-card text-muted-foreground transition-colors`,h&&`border-primary/60 bg-primary/10 text-primary`),children:[(0,X.jsx)(Wo,{delayDuration:300,children:(0,X.jsxs)(Ko,{children:[(0,X.jsx)(Bo,{asChild:!0,children:_}),b]})}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Dispatch settings`,"aria-haspopup":`dialog`,"aria-expanded":s,"data-slot":`dispatch-settings-trigger`,onClick:()=>m(!s),className:U(`inline-flex w-[18px] items-center justify-center border-l border-border transition-colors hover:bg-muted`,h&&`border-primary/40 hover:bg-primary/15`),children:(0,X.jsx)(zo,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})})]}):(0,X.jsx)(Wo,{delayDuration:300,children:(0,X.jsxs)(Ko,{children:[(0,X.jsx)(Bo,{asChild:!0,children:_}),b]})});return l?(0,X.jsxs)(jr,{open:s,onOpenChange:m,children:[(0,X.jsx)(Er,{asChild:!0,children:x}),(0,X.jsx)(br,{align:`start`,sideOffset:8,"data-slot":`dispatch-settings`,className:`w-[340px] max-w-[calc(100vw-2rem)] p-3.5`,children:v})]}):(0,X.jsxs)(X.Fragment,{children:[x,(0,X.jsx)(hi,{open:s,onOpenChange:m,children:(0,X.jsxs)(fi,{side:`bottom`,"data-slot":`dispatch-settings`,className:`rounded-t-xl p-4 pt-16 pb-[max(1rem,env(safe-area-inset-bottom))]`,children:[(0,X.jsx)(vi,{className:`sr-only`,children:`Dispatch`}),(0,X.jsx)(oi,{className:`sr-only`,children:`Split this task into subtasks run as separate tasks`}),v]})})]})}function hg({label:e,htmlFor:t,children:n}){return(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`label`,{htmlFor:t,className:`shrink-0 text-xs text-foreground`,children:e}),n]})}var gg=`h-7 max-w-[180px] rounded-md border border-input bg-card px-2 text-xs shadow-xs outline-none transition-[color,box-shadow] hover:bg-muted focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,_g=[2,3,4,5,8,10,15,20,30,50],vg=.5,yg=1e4;function bg(e){let t={};return e.maxSubtasks!==void 0&&(t.maxSubtasks=e.maxSubtasks),e.inFlight!==void 0&&(t.inFlight=e.inFlight),e.runner!==void 0&&(t.runner=e.runner),e.model!==void 0&&(t.model=e.model),e.budgetUsd!==void 0&&(t.budgetUsd=e.budgetUsd),t}function xg({value:e,remembered:t,onChange:n,runners:r,models:i}){let a=(0,Y.useId)(),o=e!==null,s=e??t,c=e=>n(bg({...s,...e})),l=i.filter(e=>e.id!==``),u=ca.filter(e=>r.includes(e.id)),d=s.maxSubtasks!==void 0&&!_g.some(e=>e===s.maxSubtasks)?[..._g,s.maxSubtasks].sort((e,t)=>e-t):[..._g];return(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsxs)(`header`,{className:`flex items-start gap-2.5`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary`,children:(0,X.jsx)(Fc,{className:`size-3.5`})}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`div`,{className:`text-[13px] font-semibold leading-tight text-foreground`,children:`Dispatch`}),(0,X.jsx)(`p`,{className:`mt-0.5 text-xs leading-snug text-muted-foreground`,children:`Split this task into subtasks run as separate tasks`})]}),(0,X.jsx)(zu,{"aria-label":`Dispatch`,"data-slot":`dispatch-settings-switch`,checked:o,onCheckedChange:e=>n(e?t:null)})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border pt-3`,children:[(0,X.jsx)(hg,{label:`Max subtasks`,htmlFor:`${a}-max`,children:(0,X.jsxs)(`select`,{id:`${a}-max`,"data-slot":`dispatch-max-subtasks`,className:gg,value:s.maxSubtasks??``,onChange:e=>c({maxSubtasks:e.target.value===``?void 0:Number(e.target.value)}),children:[(0,X.jsx)(`option`,{value:``,children:`unlimited`}),d.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))]})}),(0,X.jsx)(hg,{label:`In flight at once`,htmlFor:`${a}-flight`,children:(0,X.jsx)(`select`,{id:`${a}-flight`,"data-slot":`dispatch-in-flight`,className:gg,value:s.inFlight??4,onChange:e=>{let t=Number(e.target.value);c({inFlight:t===4?void 0:t})},children:Array.from({length:4},(e,t)=>t+1).map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})}),(0,X.jsx)(hg,{label:`Subtask runner`,htmlFor:`${a}-runner`,children:(0,X.jsxs)(`select`,{id:`${a}-runner`,"data-slot":`dispatch-runner`,className:gg,value:s.runner??``,onChange:e=>c({runner:e.target.value===``?void 0:e.target.value,model:void 0}),children:[(0,X.jsx)(`option`,{value:``,children:`same as parent`}),u.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}),(0,X.jsx)(hg,{label:`Subtask model`,htmlFor:`${a}-model`,children:(0,X.jsxs)(`select`,{id:`${a}-model`,"data-slot":`dispatch-model`,className:gg,value:s.model??``,onChange:e=>c({model:e.target.value===``?void 0:e.target.value}),children:[(0,X.jsx)(`option`,{value:``,children:`same as parent`}),l.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.label},e.id)),s.model!==void 0&&!l.some(e=>e.id===s.model)?(0,X.jsx)(`option`,{value:s.model,children:s.model}):null]})}),(0,X.jsx)(hg,{label:`Budget per subtask`,htmlFor:`${a}-budget`,children:(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(Fs,{id:`${a}-budget`,"data-slot":`dispatch-budget`,type:`number`,inputMode:`decimal`,placeholder:`none`,step:.5,min:vg,max:yg,className:`h-7 w-24 px-2 text-xs md:text-xs`,value:s.budgetUsd??``,onChange:e=>{let t=e.target.value,n=Number(t);c({budgetUsd:t===``||!Number.isFinite(n)||n<=0?void 0:Math.min(yg,Math.max(vg,n))})}}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`USD`})]})})]}),(0,X.jsxs)(`p`,{className:`text-xs leading-snug text-muted-foreground`,children:[`The engine keeps its own brakes: `,4,` in flight and budgets carved out of this task's. These only tell the agent what you want.`]})]})}var Sg=38,Cg=280,wg=900,Tg=600,Eg=5500,Dg=1400,Z=e=>({text:e,tone:`key`}),Og=e=>({text:e,tone:`str`}),kg=e=>({text:e,tone:`fn`}),Ag=e=>({text:e,tone:`com`}),jg=e=>({text:e,tone:`num`}),Q=e=>({text:e}),Mg=[[[Ag(`// task accepted — isolating a worktree`)],[Z(`const`),Q(` tree = `),Z(`await`),Q(` git.`),kg(`worktree`),Q(`(task.branch)`)],[Z(`const`),Q(` agent = `),kg(`spawn`),Q(`(runner, { tree, skills })`)],[Z(`for await`),Q(` (`),Z(`const`),Q(` event `),Z(`of`),Q(` agent.`),kg(`stream`),Q(`()) {`)],[Q(` cockpit.`),kg(`render`),Q(`(event)`)],[Q(`}`)]],[[Q(`$ cezar run `),Og(`--worktree --autonomous`)],[Og(`✓`),Q(` worktree ready · base `),Og(`main`)],[Og(`✓`),Q(` agent started`)],[Ag(`… editing src/routes/new-task.tsx`)],[Og(`✓`),Q(` tests green · `),jg(`+42 −7`)],[Og(`✓`),Q(` pull request opened`)]],[[Ag(`# flaky: replay before touching code`)],[Z(`def`),Q(` `),kg(`stabilize`),Q(`(test):`)],[Q(` `),Z(`for`),Q(` attempt `),Z(`in`),Q(` `),kg(`range`),Q(`(`),jg(`3`),Q(`):`)],[Q(` `),Z(`if`),Q(` `),kg(`run`),Q(`(test).ok:`)],[Q(` `),Z(`return`),Q(` `),Og(`'green'`)],[Q(` `),Z(`return`),Q(` `),kg(`quarantine`),Q(`(test)`)]],[[Ag(`// apply the reviewed plan, step by step`)],[Z(`let`),Q(` diff = worktree.`),kg(`diff`),Q(`()?;`)],[Z(`match`),Q(` `),kg(`review`),Q(`(diff) {`)],[Q(` Ok(pr) => gh::`),kg(`open`),Q(`(pr),`)],[Q(` Err(e) => `),kg(`retry`),Q(`(e, backoff),`)],[Q(`}`)]],[[Ag(`// merge when every check is green`)],[Z(`func`),Q(` `),kg(`merge`),Q(`(pr *PullRequest) `),Z(`error`),Q(` {`)],[Q(` `),Z(`if`),Q(` err := ci.`),kg(`Wait`),Q(`(pr); err != `),Z(`nil`),Q(` {`)],[Q(` `),Z(`return`),Q(` err`)],[Q(` }`)],[Q(` `),Z(`return`),Q(` gh.`),kg(`Merge`),Q(`(pr)`)],[Q(`}`)]],[[Ag(`-- which branches ship the most?`)],[Z(`select`),Q(` branch, `),kg(`count`),Q(`(*) `),Z(`as`),Q(` runs`)],[Z(`from`),Q(` tasks`)],[Z(`where`),Q(` status = `),Og(`'green'`)],[Z(`group by`),Q(` branch`)],[Z(`order by`),Q(` runs `),Z(`desc`),Q(`;`)]],[[Ag(`/* the composer glow, one token deep */`)],[Q(`.composer`),Z(`:focus-within`),Q(` {`)],[Q(` border-color: `),kg(`var`),Q(`(--primary);`)],[Q(` box-shadow: `),jg(`0 0 0 3px`),Q(` `),kg(`var`),Q(`(--ring);`)],[Q(` transition: box-shadow `),jg(`120ms`),Q(` ease;`)],[Q(`}`)]]],Ng=[[`left-[3%] top-[12%]`,`left-[5%] top-[36%]`,`left-[8%] top-[58%]`],[`right-[3%] top-[14%]`,`right-[6%] top-[40%]`,`right-[4%] top-[62%]`],[`left-[28%] top-[66%]`,`left-[45%] top-[72%]`,`right-[26%] top-[70%]`]],Pg={key:`var(--syn-key)`,str:`var(--syn-str)`,fn:`var(--syn-fn)`,com:`var(--syn-com)`,num:`var(--syn-num)`},Fg=e=>e.reduce((e,t)=>e+t.text.length,0),Ig=e=>e.reduce((e,t)=>e+Fg(t)*Sg+Cg,0);function Lg(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1)),r=t[e];t[e]=t[n],t[n]=r}return t}function Rg(){let e=Lg(Mg).slice(0,Ng.length),t=Lg(Ng.map(e=>e[Math.floor(Math.random()*e.length)]??``)),n=Tg;return{blocks:e.map((e,r)=>{let i=n;return n+=Ig(e)+wg,{lines:e,slot:t[r]??``,startMs:i}}),cycleMs:n-wg+Eg+Dg}}function zg({block:e,cycleMs:t}){let n=e.startMs;return(0,X.jsx)(`div`,{className:U(`ghost-code-block absolute font-mono text-[11.5px] leading-[1.9] text-soft-foreground`,e.slot),style:{"--cycle":`${t}ms`},children:e.lines.map((e,t)=>{let r=Fg(e),i=n;return n+=r*Sg+Cg,(0,X.jsx)(`div`,{className:`ghost-code-line`,style:{"--n":r,"--t":`${r*Sg}ms`,"--d":`${i}ms`},children:e.map((e,t)=>(0,X.jsx)(`span`,{style:e.tone?{color:Pg[e.tone]}:void 0,children:e.text},t))},t)})})}var Bg=`(prefers-reduced-motion: reduce)`;function Vg(){let[e,t]=(0,Y.useState)(()=>typeof window.matchMedia==`function`&&!window.matchMedia(Bg).matches);return(0,Y.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(Bg),n=e=>t(!e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function Hg(){let[e,t]=(0,Y.useState)(0),n=Vg(),r=(0,Y.useMemo)(()=>Rg(),[e]);return(0,Y.useEffect)(()=>{if(!n)return;let e=window.setTimeout(()=>t(e=>e+1),r.cycleMs);return()=>window.clearTimeout(e)},[e,n,r.cycleMs]),(0,X.jsx)(`div`,{"data-slot":`ghost-code-backdrop`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 -z-10 overflow-hidden max-xl:hidden [mask-image:linear-gradient(to_bottom,black_30%,transparent_96%)]`,children:(0,X.jsx)(`div`,{className:`contents`,children:r.blocks.map((e,t)=>(0,X.jsx)(zg,{block:e,cycleMs:r.cycleMs},t))},e)})}function Ug({label:e,url:t,hint:n,showIcon:r=!0,copySlot:i=`bm-copy`}){let a=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{a.current?.setAttribute(`href`,t)},[t]);let o=async()=>{try{await navigator.clipboard.writeText(t),G(`Bookmarklet URL copied.`)}catch{G(`Copy failed — drag the button instead.`,{tone:`danger`})}};return(0,X.jsxs)(`div`,{"data-slot":`bm-row`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,X.jsxs)(`a`,{ref:a,draggable:!0,"data-slot":`bm-link`,title:`Drag me to your bookmarks bar`,onClick:e=>{e.preventDefault(),G(`Drag me to your bookmarks bar`)},className:`inline-flex shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 py-1 font-mono text-xs font-medium text-foreground shadow-xs transition-colors hover:bg-muted`,children:[r?(0,X.jsx)(Va,{"aria-hidden":`true`,className:`size-3 text-primary`}):null,e]}),(0,X.jsx)(`button`,{type:`button`,"data-slot":i,title:`Copy the bookmarklet URL`,onClick:()=>void o(),className:`shrink-0 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:`Copy`}),n?(0,X.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-soft-foreground`,children:n}):null]})}var Wg=`http://localhost:4321`;function Gg(e,t,n,r=Wg,i=null){let a=e=>encodeURIComponent(e).replaceAll(`'`,`%27`),o=`(()=>{const m=location.href.match(/^https:\\/\\/github\\.com\\/([^\\/]+)\\/([^\\/]+)\\/(pull|issues)\\/\\d+/);if(!m){alert('Open a GitHub PR or issue first');return;}const q='${`${e?`skill=${a(e)}&`:``}auto=${t?`1`:`0`}&key=${a(n)}&ref=`}'+encodeURIComponent(location.href);open('${r.replaceAll(`'`,`%27`)}${i===null||i===``?`/new`:`/p/${a(i)}/new`}?'+q,'_blank');})();`;return`javascript:${encodeURIComponent(o)}`}var Kg={ai:`From this project’s .ai/skills; always enabled while present.`,cezar:`From this project’s .ai/cezar/skills; always enabled while present.`,agents:`From .agents/skills or an agent-specific folder; always enabled while present.`,global:`User-wide from ~/.agents/skills or ~/.claude/skills, shared across projects.`,team:`Shared from a team repository configured for this project; importable skills can be enabled or disabled here.`,builtin:`Built into Cezar rather than installed from a skill repository.`};function qg({source:e,className:t,teamRepo:n}){let r=$a({source:e}),i=e===`team`&&n?`Shared from ${n}, a team skills repository configured for this project.`:Kg[e];return(0,X.jsx)(Wo,{delayDuration:300,children:(0,X.jsxs)(Ko,{children:[(0,X.jsx)(Bo,{asChild:!0,children:(0,X.jsx)(`span`,{"data-slot":`skill-source`,"data-source":e,"aria-label":i,className:U(`shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px]`,r?`font-semibold text-foreground`:`text-soft-foreground`,t),children:e})}),(0,X.jsx)(Ho,{side:`top`,sideOffset:6,className:`max-w-[260px]`,children:i})]})})}function Jg({skill:e,usedBy:t,heading:n=`h2`,enabled:r=!0,activation:i}){return(0,X.jsxs)(`div`,{"data-slot":`skill-detail`,className:`mx-auto w-full min-w-0 max-w-[var(--measure)]`,children:[(0,X.jsxs)(`section`,{"data-slot":`skill-properties`,className:`rounded-lg border border-border bg-muted/20 p-4`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2.5`,children:[(0,X.jsx)(n,{className:`min-w-0 font-mono text-lg font-semibold break-all`,children:e.name}),(0,X.jsx)(qg,{source:e.source,teamRepo:e.team?.repo})]}),(0,X.jsxs)(`p`,{"data-slot":`skill-path`,className:`mt-1 font-mono text-[10.5px] break-all text-soft-foreground`,children:[e.path,e.team?` · from ${e.team.repo}`:``]}),e.description?(0,X.jsx)(`p`,{"data-slot":`skill-description`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:e.description}):null]}),i?(0,X.jsx)(zu,{"data-slot":`skill-activation-detail`,"aria-label":i.ariaLabel,checked:i.checked,disabled:i.disabled,onCheckedChange:i.onCheckedChange,size:`sm`,className:`mt-1.5 shrink-0`}):null]}),r?(0,X.jsx)(Yg,{skill:e}):null,t===void 0?null:(0,X.jsxs)(`section`,{"data-slot":`skill-used-by`,className:`mt-4 border-t border-border pt-4`,children:[(0,X.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Used by`}),t.length>0?(0,X.jsx)(`ul`,{className:`mt-1.5 flex flex-col gap-1`,children:t.map(e=>(0,X.jsxs)(`li`,{className:`flex items-center gap-1.5 font-mono text-xs text-muted-foreground`,children:[(0,X.jsx)(Xa,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),e]},e))}):(0,X.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Not referenced by any workflow yet — quick-task picks it up when the task mentions it.`})]})]}),(0,X.jsxs)(`section`,{"data-slot":`skill-content`,className:`mt-6 min-w-0 border-t border-border pt-5`,children:[(0,X.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Content`}),(0,X.jsx)(`div`,{"data-slot":`skill-body`,className:`mt-3 text-sm`,children:(0,X.jsx)(Ws,{children:e.body})})]})]})}function Yg({skill:e}){let t=ve(),n=Dt(),r=A(),[i,a]=(0,Y.useState)(!1),o=t.data?.key??``,s=window.location.origin,c=dr()??n.data?.bootProject??null,l=r.data?.projects.find(e=>e.id===c)?.name??rC(n.data)?.name??null,u=Gg(e.name,i,o,s,c);return(0,X.jsxs)(`section`,{"data-slot":`skill-run-from-github`,className:`mt-5 border-t border-border pt-4`,children:[(0,X.jsx)(`h3`,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Run from GitHub`}),(0,X.jsx)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:`Drag the button to your bookmarks bar, then click it on a GitHub PR or issue.`}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-xs font-medium`,children:[(0,X.jsx)(zu,{"data-slot":`bookmarklet-auto`,size:`sm`,"aria-label":`Start automatically`,checked:i,onCheckedChange:a}),(0,X.jsx)(`span`,{children:`Start automatically`})]}),(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsx)(Ug,{label:l?`/${e.name} (${l})`:`/${e.name}`,url:u,showIcon:!1,copySlot:`skill-bookmarklet-copy`})}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`To update an existing bookmarklet after changing this option, drag the button to your bookmarks bar again.`}),(0,X.jsx)(K,{to:`/settings/bookmarklets`,"data-slot":`skill-bookmarklets-settings`,className:`mt-2 inline-block text-xs font-medium text-violet hover:underline`,children:`Manage saved bookmarklets`})]})}function Xg({skill:e,onClose:t}){return(0,X.jsx)(Cr,{open:e!==null,onOpenChange:e=>e?void 0:t(),children:(0,X.jsx)(Ar,{"data-slot":`skill-preview`,className:`block max-h-[80dvh] overflow-y-auto sm:max-w-2xl`,children:e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(yr,{className:`sr-only`,children:e.name}),(0,X.jsx)(Or,{className:`sr-only`,children:`Skill preview with GitHub launcher`}),(0,X.jsx)(Jg,{skill:e,heading:`h3`}),(0,X.jsx)(`p`,{className:`mt-5`,children:(0,X.jsx)(K,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-preview-manage`,onClick:t,className:`text-xs font-semibold text-violet hover:underline`,children:`Open in the Skills catalog`})})]}):null})})}function Zg({source:e,ready:t,skills:n,skillUsage:r,workflows:i,onPick:a}){let[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(null),f=(0,Y.useRef)(null),{mostUsed:p,project:m,global:h}=Qa(ko(n,c,r),r),g=i.find(e=>e.name===ra),_=qa(i,c).filter(e=>e.name!==ra),v=no(`no skill`,`none plain ${ra} ${g?.description??``}`,c)>0,y=!v&&p.length===0&&m.length===0&&h.length===0&&_.length===0,b=e=>{a(e),s(!1)},x=t=>b(e?.source===t.source&&e.ref===t.ref?null:t),S=(t,n)=>{let r=e?.source===`skill`&&e.ref===t.name;return(0,X.jsxs)(mi,{value:`skill ${t.name} ${t.path}`,keywords:ao(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.name,onSelect:()=>x({source:`skill`,ref:t.name}),children:[(0,X.jsx)(`span`,{className:U(`shrink-0 font-mono text-xs`,n&&`font-semibold`),children:t.name}),t.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,(0,X.jsx)(`button`,{type:`button`,"data-slot":`source-skill-view`,"aria-label":`View skill ${t.name}`,title:`View skill`,onClick:e=>{e.preventDefault(),e.stopPropagation(),d(t)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,X.jsx)(cs,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,X.jsx)(Fo,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},t.path)},C=e===null?_s:e.source===`skill`?ya:Mo,w=(0,X.jsxs)(`button`,{type:`button`,"data-slot":`source-pill`,"data-source-kind":e?.source??`none`,"aria-label":`Choose a skill or workflow`,title:e===null?`No skill — the task runs as one plain agent step. Pick a skill or workflow to change that.`:`Runs the ${e.source} "${e.ref}" — pick it again, or press ✕, to run without it`,disabled:!t,onKeyDown:t=>{e===null||t.metaKey||t.ctrlKey||t.altKey||t.key!==`Backspace`&&t.key!==`Delete`||(t.preventDefault(),a(null))},className:U(Ua,`font-mono text-[11.5px]`,e===null?`border-dashed text-soft-foreground`:`rounded-r-none border-r-0 border-foreground/60 pr-1.5 font-semibold text-foreground`),children:[(0,X.jsx)(C,{"aria-hidden":`true`,className:U(`size-3 shrink-0`,e===null?`text-soft-foreground`:`text-violet`)}),(0,X.jsx)(`span`,{className:`max-w-44 truncate`,children:t?e?.ref??`Skill`:`…`}),va]});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Xg,{skill:u,onClose:()=>d(null)}),(0,X.jsxs)(jr,{open:o,onOpenChange:e=>{s(e),e||l(``)},children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,X.jsx)(kr,{asChild:!0,children:w}),e!==null&&t?(0,X.jsx)(`button`,{type:`button`,"data-slot":`source-pill-clear`,"aria-label":`Clear the ${e.source} ${e.ref}`,title:`Run without it`,onClick:()=>a(null),className:U(Ua,`rounded-l-none border-foreground/60 pl-1.5 pr-2 text-soft-foreground hover:text-foreground`),children:(0,X.jsx)(ys,{"aria-hidden":`true`,className:`size-3`})}):null]}),(0,X.jsx)(br,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(pi,{shouldFilter:!1,children:[(0,X.jsx)(gi,{placeholder:`search skills & workflows…`,value:c,onValueChange:l,onInput:()=>f.current?.scrollTo(0,0)}),(0,X.jsxs)(di,{ref:f,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[y?(0,X.jsx)(ci,{children:`Nothing matches.`}):null,v?(0,X.jsx)(li,{children:(0,X.jsxs)(mi,{value:`none no-skill`,keywords:[`none`,`plain`,...ao(ra)],"data-slot":`source-option`,"data-source-kind":`none`,onSelect:()=>b(null),children:[(0,X.jsx)(xr,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,X.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:`No skill`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:g?.description??`One agent run on your task — no ceremony.`}),e===null?(0,X.jsx)(Fo,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]})}):null,p.length>0?(0,X.jsx)(li,{heading:`Most used`,children:p.map(e=>S(e,$a(e)))}):null,m.length>0?(0,X.jsx)(li,{heading:`Project skills`,children:m.map(e=>S(e,!0))}):null,_.length>0?(0,X.jsx)(li,{heading:`Workflows`,children:_.map(t=>{let n=e?.source===`workflow`&&e.ref===t.name;return(0,X.jsxs)(mi,{value:`workflow ${t.name}`,keywords:ao(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>x({source:`workflow`,ref:t.name}),children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:t.name}),t.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,n?(0,X.jsx)(Fo,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},t.name)})}):null,h.length>0?(0,X.jsx)(li,{heading:`Global`,children:h.map(e=>S(e,!1))}):null]})]})})]})]})}function Qg(e,t,n){let r=e.skill===``?{source:`workflow`,ref:`quick-task`}:{source:`skill`,ref:e.skill};return Ha({task:e.ref,source:r,model:``,runner:t,defaultRunner:n,variants:1,images:[],todoId:e.todo})}function $g(e,t){return e.kind===`failed`?{message:`Auto-start failed: ${e.message} — review and press Start`,tone:`danger`}:e.kind===`blocked`?{message:`Auto-start blocked (bad key) — review and press Start`,tone:`danger`}:t===``?{message:`Prefilled from link — review and press Start`,tone:`default`}:{message:`Unknown skill "${t}" — prefilled for quick-task; review and press Start`,tone:`danger`}}function e_(e,t){return`Use the "${e}" skill on: ${t}`}function t_(e){let t=e.dispatch===!0,n=e.configuredAutonomous===`source-dependent`?e.source===`skill`:e.configuredAutonomous,r=e.interactive!==!0&&void 0;return{autonomous:e.explicitAutonomous??(t?!0:void 0)??r??n,worktree:e.hasGit?e.variants>1||t?!0:e.explicitWorktree??r??e.configuredWorktree:!1}}function n_(e){return e.dispatch===!0?e.autonomous===!0?`Runs on its own and fans work out to subtasks — it will not pause for you.`:`Fans work out to subtasks in isolated worktrees.`:e.worktree?`Runs in an isolated worktree — review everything before it lands.`:e.hasGit&&e.newBranch?`Runs in the repo working tree on a new branch from base — your checkout switches to it.`: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 r_={text:``,source:null,runner:null,agentProfile:null,model:null,variants:1,worktree:null,autonomous:null,generateFollowups:null,dispatch:null},i_=`cez-new-task-draft`;function a_(e){return e===null?i_:`${i_}:${e}`}function o_(e){let t=e&&typeof e==`object`?e:{};return{text:typeof t.text==`string`?t.text:``,source:c_(t.source)?t.source:null,runner:typeof t.runner==`string`?t.runner:null,agentProfile:typeof t.agentProfile==`string`?t.agentProfile:null,model:typeof t.model==`string`?t.model:null,variants:t.variants===2||t.variants===3?t.variants:1,worktree:typeof t.worktree==`boolean`?t.worktree:null,...t.newBranch===!0?{newBranch:!0}:{},...typeof t.branchName==`string`&&t.branchName?{branchName:t.branchName}:{},autonomous:typeof t.autonomous==`boolean`?t.autonomous:null,generateFollowups:typeof t.generateFollowups==`boolean`?t.generateFollowups:null,dispatch:s_(t.dispatch)}}function s_(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n={},r=(e,t)=>typeof e==`number`&&Number.isInteger(e)&&e>=1&&e<=t?e:void 0,i=r(t.maxSubtasks,50);i!==void 0&&(n.maxSubtasks=i);let a=r(t.inFlight,4);return a!==void 0&&(n.inFlight=a),typeof t.runner==`string`&&ca.some(e=>e.id===t.runner)&&(n.runner=t.runner),typeof t.model==`string`&&t.model!==``&&t.model.length<=120&&(n.model=t.model),typeof t.budgetUsd==`number`&&Number.isFinite(t.budgetUsd)&&t.budgetUsd>0&&t.budgetUsd<=1e4&&(n.budgetUsd=t.budgetUsd),n}function c_(e){return!!e&&typeof e==`object`&&(e.source===`skill`||e.source===`workflow`)&&typeof e.ref==`string`}var l_=new Map;function u_(e=null){let t=a_(e),n=l_.get(t);if(n)return{...n};let r;try{let e=localStorage.getItem(t);r=e?o_(JSON.parse(e)):{...r_}}catch{r={...r_}}return l_.set(t,r),{...r}}function d_(e,t=null){let n=a_(t);l_.set(n,{...e});try{localStorage.setItem(n,JSON.stringify(e))}catch{}}function f_(e=null){let{branchName:t,...n}=u_(e);d_({...n,text:``,source:null},e)}var p_=new Map;function m_(e=null){return[...p_.get(a_(e))??[]]}function h_(e,t=null){let n=a_(t);e.length===0?p_.delete(n):p_.set(n,[...e])}function g_(e,t){if(e===t)return{moved:!1,reason:`same-project`};let n=u_(e),r=m_(e);if(n.text===``&&r.length===0)return{moved:!1,reason:`nothing-to-move`};let i=u_(t);return i.text!==``||m_(t).length>0?{moved:!1,reason:`destination-busy`}:(d_({...i,text:n.text},t),d_({...n,text:``},e),h_(r,t),h_([],e),{moved:!0})}function __(e){let t=typeof e==`string`?new URLSearchParams(e):e;return{skill:(t.get(`skill`)??``).trim(),ref:(t.get(`ref`)??t.get(`task`)??``).trim(),auto:t.get(`auto`)===`1`,key:t.get(`key`)??``,todo:(t.get(`todo`)??``).trim()}}function v_(){let[e]=Zn(),t=tr(),n=V(),{projectId:r}=pr(),i=_t().projectId,a=A(),[o]=(0,Y.useState)(()=>__(e)),s=Dt(),c=Zt(),l=pe(),u=Et(),d=Le(),f=yt(),p=I(),[m,h]=(0,Y.useState)(()=>({...u_(i),...o.ref===``?{}:{text:o.ref},...o.skill===``?{}:{source:{source:`skill`,ref:o.skill}}}));(0,Y.useEffect)(()=>{d_(m,i)},[m,i]);let g=e=>h(t=>({...t,...e})),[_,v]=(0,Y.useState)(()=>m_(i));(0,Y.useEffect)(()=>{h_(_,i)},[_,i]);let b=d.data?.recentSources,x=l.data,S=d.data?.skillUsage,C=(0,Y.useMemo)(()=>Za(x??[],S),[x,S]),w=c.data?.workflows??[],T=a.data?.projects??[],E=e=>a.data?.bootProject===e?null:e,D=l.data!==void 0&&c.data!==void 0&&!d.isPending,O=Da(m.source,C,w),k=O?.source===`skill`?C.find(e=>e.name===O.ref):void 0,j=(0,Y.useRef)(null),M=(0,Y.useMemo)(()=>uo(fo(d.data?.promptTemplates),s.data?.capabilities),[d.data?.promptTemplates,s.data?.capabilities]),N=wo(M,O?.source===`skill`?[O.ref]:[]),P=(0,Y.useRef)(m.text);P.current=m.text;let F=(0,Y.useRef)(``);(0,Y.useEffect)(()=>{if(!D)return;let e=po(P.current,F.current,N);F.current=e.applied,e.text!==P.current&&g({text:e.text})},[N,D]);let te=ee(),ne=Bt(te.data),L=f.data?.defaultRunner,re=L??`claude`,ie=ne.length>0?Fi(m.runner,ne,re):null,ae=ie??re,oe=te.isSuccess&&ne.length>0,se=y(ae),ce=f.data?.modelsLocked===!0,le=ie===null?[]:Bi(ie,se.data,[m.model,f.data?.defaultModels?.[ie]]),ue=ie===null?``:ka(ce?null:m.model,ie,f.data?.defaultModels,se.data),{accounts:de,repoAccount:fe}=bo(),me=de.some(e=>e.provider===ae&&e.id===m.agentProfile)?m.agentProfile:null,he=ho(ae,me??fe?.[ae]),ge=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{let e=oe&&!ge.current;ge.current=oe,e&&document.activeElement===document.body&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[oe]);let _e=u.data===void 0||u.data.info!==null,ve=_e?m.variants:1,ye=_e,be=s.data?.capabilities.dispatch===!0&&_e,Se=be?m.dispatch:null,Ce=Se!==null,[R,we]=(0,Y.useState)(!1),[Te,Ee]=(0,Y.useState)(!1),De=(0,Y.useRef)(null),Oe=e=>{g({dispatch:e}),De.current!==null&&clearTimeout(De.current),De.current=null,we(e!==null),e!==null&&(De.current=setTimeout(()=>we(!1),6e3))};(0,Y.useEffect)(()=>()=>{De.current!==null&&clearTimeout(De.current)},[]);let ke=ve>1||Ce,Ae=t_({hasGit:_e,variants:ve,explicitAutonomous:m.autonomous,explicitWorktree:m.worktree,interactive:k?.interactive,configuredAutonomous:p.data?.composerDefaults?.autonomous??p.data?.composerDefaults?.inheritedAutonomous??`source-dependent`,configuredWorktree:p.data?.composerDefaults?.worktree??p.data?.composerDefaults?.inheritedWorktree??!0,source:O?.source??`workflow`,dispatch:Ce}),je=Ae.worktree,Me=Ae.autonomous,Ne=s.data===void 0||s.data.capabilities.followups,Pe=Ne?m.generateFollowups??d.data?.lastGenerateFollowups??!0:!1,[Fe,Ie]=(0,Y.useState)(()=>o.auto&&o.ref!==``),[Re,ze]=(0,Y.useState)(()=>!o.auto&&o.ref!==``?{kind:`prefill`}:null),Be=(0,Y.useRef)(!1),Ve=(0,Y.useRef)(!1);return(0,Y.useEffect)(()=>{Be.current||(Be.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[]),(0,Y.useEffect)(()=>{if(!Ve.current&&!(!o.auto||o.ref===``)&&!te.isPending){if(!oe||ie===null){Ve.current=!0,ze({kind:`prefill`}),Ie(!1);return}if(!f.isPending){if(Ve.current=!0,L===void 0){ze({kind:`prefill`}),Ie(!1);return}if(ie!==L){ze({kind:`prefill`}),Ie(!1);return}(async()=>{let e=``;try{e=(await xe()).key}catch{}if(e!==``&&o.key===e)try{let e=await Yt(Qg(o,ie,L));Ca(`bookmarklet`),f_(i),n.invalidateQueries({queryKey:z.runs.all}),t($i(e));return}catch(e){ze({kind:`failed`,message:e instanceof Error?e.message:String(e)})}else ze({kind:`blocked`});Ie(!1)})()}}},[f.isPending,L,te.isPending,oe,ie]),(0,Y.useEffect)(()=>{if(Re===null||!D)return;ze(null);let e=o.skill!==``&&!C.some(e=>e.name===o.skill)?o.skill:``;e!==``&&g({text:e_(o.skill,o.ref),source:null});let{message:t,tone:n}=$g(Re,e);G(t,{tone:n}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"]`)?.focus()},[Re,D]),Fe?(0,X.jsxs)(`div`,{"data-route":`new`,className:`relative isolate flex min-h-full flex-col items-center justify-center overflow-x-clip px-6`,children:[(0,X.jsx)(Bs,{}),(0,X.jsxs)(`div`,{"data-slot":`auto-starting`,role:`status`,className:`text-center`,children:[(0,X.jsx)(`h1`,{className:`animate-pulse text-lg font-semibold tracking-tight`,children:`Starting task…`}),(0,X.jsx)(`p`,{className:`mt-1.5 text-[13.5px] text-muted-foreground`,children:`Launched from a bookmarklet — taking you to the run.`})]})]}):(0,X.jsxs)(`div`,{"data-route":`new`,className:`relative isolate flex min-h-full flex-col items-center overflow-x-clip px-6 pt-[clamp(32px,7vh,84px)] pb-16 max-md:px-3.5 max-md:pt-7`,children:[(0,X.jsx)(Bs,{}),(0,X.jsx)(Hg,{}),(0,X.jsxs)(`div`,{className:`w-full max-w-[720px]`,children:[(0,X.jsxs)(`header`,{className:`mb-6 text-center max-md:mb-4`,children:[(0,X.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight max-md:text-base`,children:`What should the agent work on?`}),(0,X.jsx)(`p`,{"data-slot":`run-mode-note`,className:`mt-1.5 text-[13.5px] text-muted-foreground max-md:text-xs`,children:n_({worktree:je,hasGit:_e,dispatch:Ce,autonomous:Me,newBranch:m.newBranch})})]}),(0,X.jsx)(go,{ref:j,onSubmit:async(e,r)=>{if(!oe||ie===null)throw Error(te.isPending?`Checking agent providers…`:te.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`);if(he.blocked!==null){let e=await he.verify();if(e!==null)throw Error(e)}if(!D)throw Error(`Still loading workflows and skills — try again in a second.`);let a=await Yt(Ha({task:e,source:O,model:ue,modelsLocked:ce,runner:ie,runnerExplicit:m.runner!==null,agentProfile:me,defaultRunner:L,variants:ve,images:r,worktree:je,newBranch:m.newBranch,branch:m.branchName,autonomous:Me,generateFollowups:Pe,todoId:o.todo,dispatch:Se}));Ca(`new_task`),dn({lastTask:O,...O?{recentSources:ta(b,O)}:{},...Ne?{lastGenerateFollowups:Pe}:{},...O?.source===`skill`&&d.data!==void 0?{skillUsage:_o(d.data.skillUsage,O.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:z.uiState})).catch(()=>{}),f_(i),n.invalidateQueries({queryKey:z.runs.all}),t($i(a))},value:m.text,onValueChange:e=>g({text:e}),images:_,onImagesChange:v,autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:`Start task`,disabled:!oe,disabledReason:te.isPending?`Checking agent providers…`:te.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`,autocompleteSkills:!0,footerStart:(0,X.jsxs)(X.Fragment,{children:[T.length>1&&r!==void 0?(0,X.jsx)(T_,{projects:T,projectId:r,onPick:e=>{let n=g_(i,E(e));!n.moved&&n.reason===`destination-busy`&&G(`Kept your draft in ${T.find(e=>e.id===(i??a.data?.bootProject))?.name??r}; ${T.find(t=>t.id===e)?.name??e} already has an unsent draft.`,{tone:`danger`}),t(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}}):null,(0,X.jsx)(Zg,{source:O,ready:D,skills:C,skillUsage:S,workflows:w,onPick:e=>g({source:e})}),ne.length>1||ne.some(e=>So(de,e))?(0,X.jsx)(Ba,{runners:ne,value:ae,accounts:de,account:me,repoAccount:fe,onPick:(e,t)=>g({runner:e,agentProfile:t,...e===ae?{}:{model:null}}),disabled:!oe}):null,(0,X.jsx)(ha,{slot:`model-pill`,ariaLabel:`Model`,label:le.find(e=>e.id===ue)?.label??`auto`,value:ue,disabled:!oe,readOnly:ce,disabledHint:ce?`Model selection is locked to native coding-agent settings.`:void 0,onPick:e=>g({model:e}),options:le.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:la(ae,se.data,se.isError)}),(0,X.jsx)(ha,{slot:`variants-pill`,ariaLabel:`Parallel variants`,label:ve>1?`×${ve} variants`:`×1`,value:String(ve),onPick:e=>g({variants:Number(e)}),disabled:!_e,hint:`How many times to run this task in parallel — each variant gets its own worktree, and you pick the diff you keep. ×1 runs it once.`,disabledHint:`Parallel variants need a git repository — each variant runs in its own worktree.`,options:[{value:`1`,label:`×1`,desc:`One run`},{value:`2`,label:`×2 variants`,desc:`Two competing runs — pick the diff you keep`},{value:`3`,label:`×3 variants`,desc:`Three competing runs — pick the diff you keep`}]}),(0,X.jsx)(y_,{}),ye?(0,X.jsx)(b_,{on:je,disabled:ke,disabledReason:Ce?`Dispatch forks this task's commits — subtasks need a worktree`:`Parallel variants always use isolated worktrees`,onChange:e=>g({worktree:e})}):null,ye&&!je?(0,X.jsx)(x_,{on:m.newBranch===!0,name:m.branchName??``,onChange:e=>g({newBranch:e}),onNameChange:e=>g({branchName:e})}):null,(0,X.jsx)(S_,{on:Me,onChange:e=>g({autonomous:e})}),Ne?(0,X.jsx)(C_,{on:Pe,onChange:e=>g({generateFollowups:e})}):null,M.length>0||be?(0,X.jsx)(y_,{}):null,(0,X.jsx)(sg,{templates:M,iconOnly:!0,onInsert:e=>j.current?.insertAtCaret(e)}),(0,X.jsx)(mg,{available:be,value:Se,onChange:Oe,onSettingsOpenChange:Ee,runners:ne,parentRunner:ae,parentModels:le}),u.data?.info?(0,X.jsx)(y_,{}):null,u.data?(0,X.jsx)(E_,{repo:u.data}):null,k?.interactive&&(m.autonomous===null||m.worktree===null)?(0,X.jsx)(`p`,{className:`basis-full text-xs text-muted-foreground`,"data-slot":`interactive-skill-hint`,children:`This skill recommends an interactive run in the current checkout. You can change either setting.`}):null]}),footerEnd:(0,X.jsxs)(X.Fragment,{children:[!oe&&!te.isPending?(0,X.jsx)(K,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:ps()})]})}),he.blocked===null?null:(0,X.jsxs)(`p`,{"data-slot":`account-signed-out`,role:`alert`,className:`mt-2 rounded-md border border-destructive/30 bg-destructive/[0.07] px-3 py-1.5 text-xs text-muted-foreground`,children:[he.blocked,` `,(0,X.jsx)(or,{to:`/settings/global/accounts`,className:`font-medium text-foreground underline underline-offset-2`,children:`Agent accounts`})]}),Ce&&(Te||R)?(0,X.jsxs)(`p`,{"data-slot":`dispatch-hint`,className:`mt-2 rounded-md border border-primary/25 bg-primary/[0.07] px-3 py-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`strong`,{className:`font-semibold text-foreground`,children:`Dispatch is on.`}),` Splits this task into subtasks it runs as separate tasks. Worktree stays on. Long-press the icon for limits.`]}):null,(0,X.jsx)(O_,{onPick:e=>g({text:e})})]})]})}function y_(){return(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`mx-0.5 h-3.5 w-px shrink-0 bg-border max-md:hidden`})}function b_({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"data-slot":`worktree-toggle`,onClick:()=>r(!e),title:t?n:e?`Runs in an isolated worktree — uncheck to run in the repo working tree`:`Runs in the repo working tree — check to isolate in a worktree`,className:U(Ua,e&&`border-primary/60 text-foreground`),children:[e?(0,X.jsx)(Fo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,X.jsx)(gs,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Worktree`]})}function x_({on:e,name:t,onChange:n,onNameChange:r}){return(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"data-slot":`new-branch-toggle`,onClick:()=>n(!e),title:e?`Switches the repo checkout to a new branch from the base before the agent starts`:`Runs on whatever branch is checked out — check to start a new branch from the base`,className:U(Ua,e&&`border-primary/60 text-foreground`),children:[e?(0,X.jsx)(Fo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,X.jsx)(gs,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`New branch`]}),e?(0,X.jsx)(`input`,{"aria-label":`New branch name`,"data-slot":`new-branch-name`,value:t,placeholder:`feat/… (auto)`,onChange:e=>r(e.target.value),className:`h-6 w-36 rounded-md border border-input bg-card px-2 font-mono text-[11px] outline-none focus-visible:border-ring`}):null]})}function S_({on:e,disabled:t,onChange:n}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"data-slot":`autonomous-toggle`,onClick:()=>n(!e),title:t?`Plan-first runs are interactive — autonomous is unavailable`:e?`Autonomous — the agent runs to completion without pausing for you`:`Runs interactively — check to let the agent finish without pausing for you`,className:U(Ua,e&&!t&&`border-primary/60 text-foreground`),children:[e?(0,X.jsx)(Fo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,X.jsx)(gs,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Autonomous`]})}function C_({on:e,onChange:t}){return(0,X.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"data-slot":`generate-followups-toggle`,onClick:()=>t(!e),title:e?`Agents can add newly discovered follow-up work to the task inbox`:`Follow-up generation is off; agents still maintain the handoff journal`,className:U(Ua,e&&`border-primary/60 text-foreground`),children:[e?(0,X.jsx)(Fo,{"aria-hidden":`true`,className:`size-3 shrink-0 text-primary`}):(0,X.jsx)(gs,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),`Follow-ups`]})}function w_(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 T_({projects:e,projectId:t,onPick:n}){let[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(``),s=e.find(e=>e.id===t),c=w_(e,a);return(0,X.jsxs)(jr,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,X.jsx)(kr,{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:U(Ua,`border-foreground/60 font-semibold text-foreground`),children:[(0,X.jsx)(dc,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,X.jsx)(`span`,{className:`max-w-40 truncate`,children:s?.name??t}),va]})}),(0,X.jsx)(br,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(pi,{shouldFilter:!1,children:[(0,X.jsx)(gi,{placeholder:`search projects…`,value:a,onValueChange:o}),(0,X.jsxs)(di,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,X.jsx)(ci,{children:`Nothing matches.`}):null,c.map(e=>(0,X.jsxs)(mi,{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)(Fo,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.id))]}),(0,X.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-[11px] leading-snug text-soft-foreground`,children:`Skills, workflows, settings and the draft re-resolve against the selected project.`})]})})]})}function E_({repo:e}){let t=V(),n=B({mutationFn:e=>Ze({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:z.repo}),G(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=>G(e.message,{tone:`danger`})});return e.info?(0,X.jsx)(ha,{slot:`base-pill`,ariaLabel:`Base branch`,label:(0,X.jsxs)(`span`,{className:`font-mono text-[11.5px]`,children:[`base: `,e.baseBranch??e.info.branch]}),value:e.baseBranch??``,onPick:e=>n.mutate(e===``?null:e),searchPlaceholder:`Search branches…`,options:[{value:``,label:`follow checked-out branch (${e.info.branch})`,desc:`New task worktrees fork from whatever branch is checked out`},...e.branches.map(e=>({value:e,label:e}))]}):null}var D_=[`Fix a failing or flaky test`,`Summarize recent commits on this branch`,`Update the README for recent changes`];function O_({onPick:e}){return(0,X.jsx)(`div`,{className:`mt-7 flex flex-wrap justify-center gap-2 max-md:justify-start`,children:D_.map(t=>(0,X.jsxs)(`button`,{type:`button`,"data-slot":`suggested-chip`,onClick:()=>e(t),className:`inline-flex h-[30px] items-center gap-1.5 rounded-full border border-border px-3 text-[12.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,X.jsx)(ya,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),t]},t))})}function k_(){return(0,X.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(oc,{}),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)(W,{asChild:!0,variant:`outline`,children:(0,X.jsx)(K,{to:`/`,children:`Back to tasks`})})})})}function A_(){return(0,X.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(fs,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})})}function j_(){return(0,X.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,X.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,X.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,X.jsx)(`p`,{"data-slot":`skills-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading skills…`})]})}function M_({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,X.jsx)(`div`,{"data-route":`unknown-project`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(pc,{}),tone:`neutral`,title:`“${e}” isn’t registered here`,subtitle:`This workspace doesn’t serve a project by that id. The link may come from another machine’s workspace — these are the projects this one can open:`,children:(0,X.jsx)(`ul`,{"data-slot":`registered-projects`,className:`mx-auto flex w-full max-w-xs flex-col gap-1.5 text-left`,children:n.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(or,{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 N_(){return(0,X.jsx)(`div`,{"data-route":`workflows`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(fs,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading workflows…`,subtitle:`Fetching the saved workflows and the node catalog.`})})}function P_(e){return ca.flatMap(t=>{let n=e.filter(e=>e.provider===t.id);return n.length<2?[{runner:t,account:null,label:t.label,desc:t.desc,missing:!1}]:n.map(e=>({runner:t,account:e.isDefault?null:e.id,label:`${t.label} · ${e.label}`,desc:e.exists?e.configDir:`${e.configDir} — folder not created yet`,missing:!e.exists}))})}var F_=e=>e.length>ca.length;function I_({rows:e,runner:t,accountFor:n,providerStatus:r,disabled:i=!1,accountDisabled:a=!1,onPick:o}){let s=F_(e);return(0,X.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:U(`gap-0.5 rounded-md border border-border bg-card p-0.5`,s?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(c=>{let l=Jt(r.data,c.runner.id),u=!r.isPending&&!r.isError&&l?.enabled===!0&&l.status===`connected`,d=r.isPending?`Checking provider authentication…`:r.isError?`Provider authentication could not be verified.`:l?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:u?void 0:`Connect this provider before selecting it.`,f=e.filter(e=>e.runner.id===c.runner.id).length>1,p=c.runner.id===t&&c.account===n(c.runner.id);return(0,X.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":p,"data-value":c.runner.id,"data-account":c.account??``,title:d??c.desc,disabled:i||!u||f&&a,onClick:()=>o(c.runner.id,c.account,f),className:U(`rounded-sm px-3 py-1.5 text-left font-mono text-[13px] font-medium transition-colors disabled:opacity-50`,p?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[c.label,s?(0,X.jsx)(`span`,{"data-slot":c.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":c.runner.id,className:`ml-2 font-sans text-[11.5px] text-soft-foreground`,children:c.desc}):null]},`${c.runner.id}:${c.account??``}`)})})}function L_({open:e,onOpenChange:t,providers:n,initialProvider:r}){let[i,a]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(r??n[0]??`claude`),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(``),[m,h]=(0,Y.useState)(!1),g=on(),_=f.trim();return(0,X.jsx)(Cr,{open:e,onOpenChange:t,children:(0,X.jsxs)(Ar,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(wr,{children:[(0,X.jsx)(yr,{children:`Add agent account`}),(0,X.jsx)(Or,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,X.jsx)(`select`,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:c,onChange:e=>l(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:n.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,X.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:u,placeholder:`Work`,onChange:e=>d(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:f,placeholder:c===`codex`?`~/.codex-second`:`~/.claude-second`,onChange:e=>{p(e.target.value),s(null),g.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[12.5px] outline-none focus-visible:border-ring`}),(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":m,onClick:()=>h(e=>!e),children:m?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-[11.5px] text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),m?(0,X.jsx)(Nu,{path:i,selected:o,onSelect:e=>{s(e),p(e.path),g.reset()},onEnter:e=>{a(e),s(null),g.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,g.isError?(0,X.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:g.error instanceof Error?g.error.message:`could not add that folder`}):null,(0,X.jsxs)(Tr,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(W,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(W,{"data-slot":`add-account-confirm`,disabled:_===``||g.isPending,onClick:()=>{_===``||g.isPending||g.mutate({provider:c,configDir:_,...u.trim()?{label:u.trim()}:{}},{onSuccess:()=>{t(!1),d(``),p(``),s(null),h(!1),G(`Account added — use Connect to sign in`)}})},children:g.isPending?`Adding…`:`Add account`})]})]})})}var R_={claude:`Claude Code`,codex:`Codex`,junie:`Junie`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,copilot:`GitHub Copilot CLI`},z_={claude:`curl -fsSL https://claude.ai/install.sh | bash`,codex:`npm i -g @openai/codex`,junie:`https://www.jetbrains.com/junie/`,opencode:`https://opencode.ai`,cursor:`curl https://cursor.com/install -fsS | bash`,pi:`https://github.com/badlogic/pi-mono`,copilot:`npm i -g @github/copilot`},B_={connected:{label:`Connected`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function V_(){let e=an();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent accounts…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(gc,{}),tone:`danger`,title:`Agent accounts did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(H_,{data:e.data})}function H_({data:e}){let t=Dt(),[n,r]=(0,Y.useState)(null),[i,a]=(0,Y.useState)(null),o=rn(),s=It,[c]=Zn(),l=c.get(`agent`),u=s.find(e=>e===l)??`claude`;return e.editable?(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Agent accounts`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`One agent per tab: whether it is installed, and which logins you have. Add a second config folder to keep a work account beside a personal one; each project picks which it uses in its own Agents settings.`})]}),(0,X.jsx)(W_,{profiles:e}),(0,X.jsxs)(Ps,{defaultValue:u,children:[(0,X.jsx)(Ns,{variant:`line`,"data-slot":`accounts-tabs`,children:s.map(e=>(0,X.jsx)(js,{value:e,"data-provider":e,children:R_[e]},e))}),s.map(n=>(0,X.jsx)(Ms,{value:n,className:`pt-4`,children:(0,X.jsx)(U_,{provider:n,check:t.data?.checks?.find(e=>e.name===n),accounts:e.profiles.filter(e=>e.provider===n),canCarryAccounts:e.profileCapableProviders.includes(n),onAdd:()=>r(n),onRemove:a})},n))]},u),n===null?null:(0,X.jsx)(L_,{open:!0,onOpenChange:e=>!e&&r(null),providers:e.profileCapableProviders,initialProvider:n},n),(0,X.jsx)(As,{open:i!==null,onOpenChange:e=>!e&&a(null),children:(0,X.jsxs)(Ts,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(ks,{children:[(0,X.jsxs)(ws,{children:[`Remove “`,i?.label,`”?`]}),(0,X.jsxs)(Cs,{children:[`This only forgets the account. Nothing in `,i?.configDir,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,X.jsxs)(Ds,{children:[(0,X.jsx)(Os,{children:`Cancel`}),(0,X.jsx)(Es,{"data-action":`accounts-remove-confirm`,disabled:o.isPending,onClick:()=>{let e=i;e&&o.mutate(e.id,{onSuccess:()=>{a(null),G(`Removed ${e.label}`)},onError:e=>G(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]}):(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 md:p-6`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Agent accounts`}),(0,X.jsx)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-soft-foreground`,children:`Agent accounts are managed from the machine that owns the checkout — this cockpit runs in hosted mode.`})]})}function U_({provider:e,check:t,accounts:n,canCarryAccounts:r,onAdd:i,onRemove:a}){let o=t?.available===!0;return(0,X.jsxs)(`div`,{"data-slot":`accounts-provider`,"data-provider":e,className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`dl`,{className:`divide-y divide-border/60 overflow-hidden rounded-md border border-border bg-card text-[13px]`,children:[(0,X.jsx)(G_,{label:`Installed`,children:t===void 0?(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Checking…`}):o?(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`Yes`}):(0,X.jsxs)(`span`,{"data-slot":`agent-installed`,className:`text-muted-foreground`,children:[`No — `,(0,X.jsx)(`code`,{className:`text-[12px]`,children:z_[e]})]})}),o&&t?.version?(0,X.jsx)(G_,{label:`Version`,children:(0,X.jsx)(`span`,{"data-slot":`agent-version`,className:`font-mono text-[12.5px]`,children:t.version})}):null,(0,X.jsx)(G_,{label:`Accounts`,children:(0,X.jsx)(`span`,{children:n.length===1?`the discovered one`:`${n.length} (1 discovered, ${n.length-1} added)`})})]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Logins`}),r?(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":e,onClick:i,children:`Add account`}):null]}),(0,X.jsx)(`ul`,{className:`divide-y divide-border/60 rounded-md border border-border bg-card`,children:n.map(e=>(0,X.jsx)(K_,{account:e,onRemove:()=>a(e)},e.id))}),r?null:(0,X.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`text-[11.5px] text-soft-foreground`,children:[R_[e],` can only hold one account here: it keeps its credentials outside its config folder, so a second folder would change settings without changing the login — which would say “work account” while billing the other one.`]})]})}function W_({profiles:e}){let t=V(),n=I(),r=ee(),i=je(),a=_e(),o=B({mutationFn:e=>Oe(e),onSuccess:e=>t.setQueryData(R.config,e),onError:e=>G(e.message,{tone:`danger`})});if(n.data===void 0)return null;let s=P_(e.profiles),c=n.data.agentDefaults.runner??`claude`,l=n.data.agentDefaults.models??{};return(0,X.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own.`})]}),(0,X.jsx)(I_,{rows:s,runner:c,accountFor:t=>e.defaults[t]??null,providerStatus:r,disabled:o.isPending,accountDisabled:a.isPending,onPick:(e,t,n)=>{e!==c&&o.mutate({agentDefaults:{runner:e}}),n&&a.mutate({projectId:null,provider:e,profileId:t},{onError:e=>G(e.message,{tone:`danger`})})}}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Default model per agent`}),ca.map(e=>(0,X.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:e.label}),(0,X.jsxs)(`select`,{"aria-label":`Default model for ${e.label}`,"data-slot":`accounts-default-model`,"data-runner":e.id,value:l[e.id]??``,disabled:o.isPending,onChange:t=>o.mutate({agentDefaults:{models:{[e.id]:t.target.value||null}}}),className:`block w-full max-w-xs rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[Bi(e.id,i[e.id].data,[l[e.id]]).map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),la(e.id,i[e.id].data,i[e.id].isError)?(0,X.jsx)(`option`,{disabled:!0,children:la(e.id,i[e.id].data,i[e.id].isError)}):null]})]},e.id))]})]})}function G_({label:e,children:t}){return(0,X.jsxs)(`div`,{className:`flex items-baseline gap-3 px-3.5 py-2.5`,children:[(0,X.jsx)(`dt`,{className:`w-28 shrink-0 text-muted-foreground`,children:e}),(0,X.jsx)(`dd`,{className:`min-w-0 flex-1`,children:t})]})}function K_({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),i=Rn(e),a=gt(),o=F(),s=Qt(i,e.status===void 0),c=e.status??s.data?.status,l=c?B_[c.status]:void 0;return(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`flex flex-col gap-2 px-3.5 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium text-foreground`,children:e.label}),e.isDefault?(0,X.jsx)(ku,{variant:`ghost`,className:`shrink-0 text-[10px] text-muted-foreground`,children:`discovered`}):null]}),(0,X.jsx)(`p`,{"data-slot":`account-path`,className:`mt-0.5 truncate font-mono text-[11.5px] text-soft-foreground`,title:e.path,children:e.configDir}),(0,X.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(Is,{tone:l?.tone??`neutral`,pulse:l===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,children:l?.label??`Checking…`}),e.exists?e.looksValid?null:(0,X.jsxs)(`span`,{"data-slot":`account-unrecognised`,children:[`— this folder does not look like `,R_[e.provider],` config yet`]}):(0,X.jsx)(`span`,{"data-slot":`account-missing`,children:`— folder not created yet; Connect will make it`})]}),c?.status===`not-installed`&&c.hint?(0,X.jsx)(`p`,{"data-slot":`account-install-hint`,className:`mt-1 text-xs text-soft-foreground`,children:c.hint}):null]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[c?.status!==`connected`&&c?.status!==`not-installed`?(0,X.jsx)(W,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:a.isPending,onClick:()=>a.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>G(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>e instanceof Ke&&e.command?G(`${e.message} — run: ${e.command}`,{tone:`danger`,expected:!0}):G(e.message,{tone:`danger`})}),children:`Connect`}):null,(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`account-recheck`,disabled:o.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>o.mutate(i,{onError:e=>G(e.message,{tone:`danger`})}),children:`Check again`}),(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`account-details-toggle`,"aria-expanded":n,onClick:()=>r(e=>!e),children:n?`Hide details`:`Show details`})]})]}),n?(0,X.jsx)(q_,{account:e,routeId:i,onRemove:t}):null]})}function q_({account:e,routeId:t,onRemove:n}){let r=Gt(t,!0),i=L(),a=we(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(e.label),u=Ve(),d=a.data?.targets??[],f=d.filter(e=>Sa(e.id)===void 0&&e.id!==`terminal`&&e.id!==`finder`).map(e=>({target:e})),p=d.filter(e=>Sa(e.id)===void 0).map(e=>({target:e})),m=(e,n,r)=>i.mutate({routeId:t,file:e,...r?{target:r}:{}},{onError:e=>G(e.message,{tone:`danger`}),onSuccess:()=>G(`Opened ${n}`)});return(0,X.jsxs)(`div`,{"data-slot":`account-details`,className:`rounded-md border border-border/60 bg-muted/30 p-3`,children:[r.isPending?(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Reading account details…`}):r.isError?(0,X.jsx)(`p`,{"data-slot":`account-details-error`,className:`text-xs text-danger`,children:r.error.message}):r.data.available?(0,X.jsx)(`dl`,{"data-slot":`account-identity`,className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs`,children:r.data.fields.map(e=>(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:e.label}),(0,X.jsx)(`dd`,{className:`min-w-0 truncate text-foreground`,title:e.value,children:e.value})]},e.label))}):(0,X.jsx)(`p`,{"data-slot":`account-identity-unavailable`,className:`text-xs text-muted-foreground`,children:r.data.reason??`No account details to show.`}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5 border-t border-border/60 pt-2.5`,children:[(0,X.jsx)(`span`,{className:`mr-1 text-xs text-muted-foreground`,children:`Config files`}),e.files.map(e=>(0,X.jsx)(Pi,{slot:`account-open-file`,label:e.label,triggerVariant:`outline`,disabled:i.isPending,title:e.exists?e.path:`${e.path} — not created yet`,choices:f,onPick:t=>m(e.id,e.label,t),leading:(0,X.jsxs)($o,{"data-target":`system`,onSelect:()=>m(e.id,e.label),children:[(0,X.jsx)(as,{"aria-hidden":`true`}),`System default`]})},e.id)),(0,X.jsx)(Pi,{slot:`account-open-folder`,label:`Folder`,disabled:i.isPending,title:e.path,choices:p,onPick:e=>m(`folder`,`folder`,e),leading:(0,X.jsxs)($o,{"data-target":`system`,onSelect:()=>m(`folder`,`folder`),children:[(0,X.jsx)(as,{"aria-hidden":`true`}),`System default`]})})]}),e.isDefault?null:(0,X.jsxs)(`div`,{"data-slot":`account-manage`,className:`mt-3 flex flex-wrap items-center gap-2 border-t border-border/60 pt-2.5`,children:[(0,X.jsx)(`span`,{className:`mr-1 text-xs text-muted-foreground`,children:`Account`}),o?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:c,onChange:e=>l(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,X.jsx)(W,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:u.isPending||c.trim()===``||c.trim()===e.label,onClick:()=>u.mutate({id:e.id,label:c.trim()},{onSuccess:()=>s(!1),onError:e=>G(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{l(e.label),s(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>s(!0),children:`Rename`}),(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:n,children:`Remove`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what cezar calls this account, not its folder.`})]})]})]})}var J_=1500;function Y_(e,t){let n=(0,Y.useMemo)(()=>e.split(`
|
|
5
|
+
`).map(e=>[{content:e}]),[e]),r=(0,Y.useMemo)(()=>Us(t),[t]),i=n.length>J_,[a,o]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{if(r===null||i)return;let t=!1;return Hs(e,r).then(n=>{t||o({key:e,tokens:n.tokens})}),()=>{t=!0}},[e,r,i]),r===null||i?n:a?.key===e?a.tokens:Vs(e,r)?.tokens??n}var X_=`m-0 min-h-full w-full whitespace-pre font-mono text-xs leading-[1.7] px-3 py-2 [tab-size:2]`;function Z_({value:e,onChange:t,language:n,readOnly:r,className:i,...a}){let o=Y_(e,n),s=(0,Y.useRef)(null),c=(0,Y.useRef)(null),l=()=>{let e=c.current,t=s.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,Y.useLayoutEffect)(l,[e]),(0,X.jsxs)(`div`,{"data-slot":`code-editor`,className:U(`relative overflow-hidden rounded-md border border-input bg-card`,i),children:[(0,X.jsx)(`pre`,{ref:s,"aria-hidden":`true`,className:U(X_,`pointer-events-none absolute inset-0 overflow-auto text-soft-foreground`),children:o.map((e,t)=>(0,X.jsx)(`span`,{className:`block`,children:e.length===0?`
|
|
6
|
+
`:(0,X.jsxs)(X.Fragment,{children:[e.map((e,t)=>(0,X.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),`
|
|
7
|
+
`]})},t))}),(0,X.jsx)(`textarea`,{ref:c,"data-slot":`code-editor-input`,value:e,readOnly:r,onChange:e=>t?.(e.target.value),onScroll:l,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`,autoComplete:`off`,wrap:`off`,className:U(X_,`relative block resize-none overflow-auto bg-transparent text-transparent caret-foreground outline-none`,`selection:bg-primary/30 focus-visible:ring-0`,r&&`cursor-default`),...a})]})}var Q_=`An editor-plus-commit: a saved change reaches a run after you commit it to the base branch.`;function $_(e){return t=>t.runners.includes(e)}function ev(e,t,n,r){let i=$_(e);return{id:t,label:n,note:r,files:t===`mcp`?e=>i(e)&&(e.holdsMcp===!0||e.kind===`mcp`):e=>i(e)&&e.kind===t}}var tv=[{id:`claude`,label:`Claude`,groups:[ev(`claude`,`settings`,`Settings`),ev(`claude`,`mcp`,`MCP`,`A dedicated .mcp.json (key: mcpServers), shared via version control.`),ev(`claude`,`memory`,`Memory & instructions`)]},{id:`codex`,label:`Codex`,note:Q_,groups:[ev(`codex`,`settings`,`Settings`),ev(`codex`,`mcp`,`MCP`,`Inside config.toml under [mcp_servers.<id>] — the same file as Codex’s settings.`),ev(`codex`,`memory`,`Memory & instructions`)]},{id:`copilot`,label:`GitHub Copilot`,note:Q_,groups:[ev(`copilot`,`settings`,`Settings`),ev(`copilot`,`mcp`,`MCP`,`A dedicated ~/.copilot/mcp-config.json. Per-run --additional-mcp-config augments it rather than replacing it.`),ev(`copilot`,`memory`,`Memory & instructions`)]},{id:`opencode`,label:`OpenCode`,note:Q_,groups:[ev(`opencode`,`settings`,`Settings`),ev(`opencode`,`mcp`,`MCP`,`Under the "mcp" key in opencode.json — the same file as OpenCode’s settings.`),ev(`opencode`,`memory`,`Memory & instructions`)]},{id:`cursor`,label:`Cursor`,note:"Cursor Agent CLI (`agent`). Auth via `agent login` or CURSOR_API_KEY. No separate memory file — instructions live in rules/MCP elsewhere.",groups:[ev(`cursor`,`settings`,`Settings`),ev(`cursor`,`mcp`,`MCP`,`User ~/.cursor/mcp.json and project .cursor/mcp.json.`)]}];function nv(e){let t=tv.find(t=>t.id===e);if(!t)throw Error(`no agent descriptor for ${e}`);return t}var rv=`{
|
|
8
|
+
"mcpServers": {
|
|
9
|
+
"example-stdio": {
|
|
10
|
+
"command": "/absolute/path/to/your-mcp-server",
|
|
11
|
+
"args": [],
|
|
12
|
+
"env": { "API_TOKEN": "your-personal-token" }
|
|
13
|
+
},
|
|
14
|
+
"example-http": {
|
|
15
|
+
"type": "http",
|
|
16
|
+
"url": "https://mcp.example.com/mcp",
|
|
17
|
+
"headers": { "Authorization": "Bearer your-personal-token" }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`;function iv(e){return e.private?`Private to this project — added to every run at launch, takes effect on the next session. Never committed.`:e.seeded?`Copied into each run’s worktree — takes effect on your next run.`:e.tracked===`tracked`?`Runs read the committed copy — this edit applies after you commit it.`:e.tracked===`outside-repo`?`Applies to every session on this machine.`:`Personal, git-ignored.`}function av(){let e=at(),t=Dt(),n=(0,Y.useMemo)(()=>t.data?Ri(t.data.checks):tv.map(e=>e.id),[t.data]);return e.isPending?(0,X.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(lc,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(ov,{listing:e.data,installed:n})}function ov({listing:e,installed:t}){let[n,r]=(0,Y.useState)(`claude`),[i,a]=(0,Y.useState)(null),o=nv(n),s=e.files.find(e=>e.id===i)??null,c=e=>{r(e),a(null)};return(0,X.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[!e.editable&&(0,X.jsx)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-soft-foreground`,children:`Read-only: agent config is edited from the machine that owns the checkout (this cockpit runs in hosted mode). You can still see every file and which one wins.`}),(0,X.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1 rounded-md bg-muted/40 p-1`,children:tv.map(e=>(0,X.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===o.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===o.id,onClick:()=>c(e.id),className:U(`flex items-center gap-2 rounded-md px-3 py-1.5 text-[13px] transition-colors`,e.id===o.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!t.includes(e.id)&&(0,X.jsx)(ku,{variant:`outline`,className:`text-[10px] text-soft-foreground`,children:`not installed`})]},e.id))}),o.note&&(0,X.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-[12px] text-soft-foreground`,children:o.note}),(0,X.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,20rem)_minmax(0,1fr)]`,children:[(0,X.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex flex-col gap-5`,children:(0,X.jsx)(sv,{agent:o,listing:e,selectedId:i,onSelect:a})}),(0,X.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,children:s?(0,X.jsx)(lv,{file:s},s.id):(0,X.jsx)(`div`,{className:`flex h-full min-h-40 items-center justify-center rounded-md border border-dashed border-border text-[13px] text-soft-foreground`,children:`Select a config file to view or edit it.`})})]})]})}function sv({agent:e,listing:t,selectedId:n,onSelect:r}){return(0,X.jsx)(X.Fragment,{children:e.groups.map(i=>{let a=t.files.filter(i.files),o=e.id===`claude`&&i.id===`mcp`;return a.length===0&&!(o&&t.userMcp)?null:(0,X.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":i.id,"data-agent":e.id,children:[(0,X.jsx)(`p`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-soft-foreground`,children:i.label}),i.note&&(0,X.jsx)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:i.note}),(0,X.jsx)(`ul`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>r(e.id),className:U(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-primary/15 text-foreground`:`hover:bg-muted/60`),children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px]`,children:e.label}),e.seeded&&(0,X.jsx)(ku,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`seeded`}),e.private&&(0,X.jsx)(ku,{variant:`outline`,className:`shrink-0 text-[10px]`,children:`private`}),!e.exists&&(0,X.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`absent`})]})},e.id))}),o&&t.userMcp&&(0,X.jsx)(cv,{userMcp:t.userMcp})]},i.id)})})}function cv({userMcp:e}){return(0,X.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,X.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,X.jsxs)(`p`,{className:`mb-2 text-[12px] text-soft-foreground`,children:[`Managed by `,(0,X.jsx)(`code`,{className:`font-mono`,children:`claude mcp add`}),` in `,e.path,` — cezar does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,X.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(ku,{variant:`outline`,className:`font-mono text-[11px]`,children:e})},e))}):(0,X.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`No user-scoped MCP servers.`}):(0,X.jsx)(`p`,{className:`text-[12px] text-soft-foreground`,children:`Could not read the file.`})]})}function lv({file:e}){let t=Ft(e.id),n=Xt(e.id),[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),l=t.data?.version??null;(0,Y.useEffect)(()=>{t.data&&(i(e.private&&!t.data.exists?rv:t.data.content),o(!1),c(null))},[t.data?.version,t.data]);let u=r??t.data?.content??``,d=t.data?u!==t.data.content:!1,f=e.writable;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,X.jsx)(ku,{variant:`outline`,className:`text-[10px] uppercase`,children:e.format}),(0,X.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,X.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-[12px] text-soft-foreground`,children:e.precedence}),(0,X.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-[12px] text-foreground/80`,children:[iv(e),e.hotReload?` ${e.hotReload}`:``]}),t.isPending?(0,X.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,X.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,X.jsx)(Z_,{value:u,language:e.format,readOnly:!f,onChange:i,"aria-label":`${e.label} contents`,className:`h-[26rem]`}),s&&(0,X.jsx)(`p`,{"data-slot":`agent-config-format-error`,className:`text-[12px] text-destructive`,children:s}),a&&(0,X.jsxs)(`div`,{"data-slot":`agent-config-conflict`,className:`flex items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px]`,children:[(0,X.jsx)(`span`,{children:`The file changed on disk since you opened it.`}),(0,X.jsx)(W,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),children:`Reload from disk`})]}),f&&(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(W,{size:`sm`,onClick:()=>{c(null),o(!1),n.mutate({content:u,version:l},{onSuccess:()=>{i(null),G(`${e.exists?`Saved`:`Created`} ${e.label}`)},onError:e=>{e instanceof Ke&&e.status===409?o(!0):e instanceof Ke&&e.status===400?c(e.message):G(e.message,{tone:`danger`})}})},disabled:!d||n.isPending,children:e.exists?`Save`:`Create`}),(0,X.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>i(null),disabled:!d||n.isPending,children:`Revert`}),d&&(0,X.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Unsaved changes`})]})]})}var uv=[{id:`claude`,label:`Claude Code`,login:`claude auth login`},{id:`codex`,label:`Codex`,login:`codex login`},{id:`junie`,label:`Junie`,login:`junie login`},{id:`opencode`,label:`OpenCode`,login:`opencode auth login`},{id:`cursor`,label:`Cursor`,login:`agent login`},{id:`pi`,label:`pi`,login:`pi /login`},{id:`copilot`,label:`GitHub Copilot CLI`,login:`copilot login`}],dv=e=>({claude:e,codex:e,junie:e,opencode:e,cursor:e,pi:e,copilot:e}),fv={connected:{label:`Credentials found`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function pv(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function mv(){let e=ee(),t=Je(),n=lt(),r=V(),[i,a]=(0,Y.useState)(null),o=(0,Y.useRef)(Promise.resolve()),s=(0,Y.useRef)(dv(0)),c=(0,Y.useRef)(dv(0)),l=(0,Y.useRef)(e.data);(0,Y.useEffect)(()=>{i&&Jt(e.data,i.provider)?.status===`connected`&&a(null)},[i,e.data]),(0,Y.useEffect)(()=>{if(e.data){if(Object.values(c.current).every(e=>e===0)||!l.current){l.current=e.data;return}l.current={providers:e.data.providers.map(e=>({...e,enabled:c.current[e.provider]>0?Jt(l.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[e.data]);let u=(0,Y.useCallback)((e,t)=>{let n=R.providerStatus,i=r.getQueryData(n);if(!i)return;l.current||=i;let a=pv(i,e,t);c.current[e]+=1,r.setQueryData(n,a);let u=++s.current[e];o.current=o.current.then(async()=>{try{let i=await te(e,t),a=Jt(i,e)?.enabled;if(a===void 0)return;if(l.current=pv(l.current??i,e,a),u===s.current[e]){let t=r.getQueryData(n);r.setQueryData(n,t?pv(t,e,a):i)}}catch(t){if(u===s.current[e]){let i=Jt(l.current,e)?.enabled,a=r.getQueryData(n);a&&i!==void 0?r.setQueryData(n,pv(a,e,i)):l.current?r.setQueryData(n,l.current):r.removeQueries({queryKey:n,exact:!0}),G(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{--c.current[e]}})},[r]),d=B({mutationFn:e=>Rt(e),onSuccess:async e=>{a(null),G(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await r.invalidateQueries({queryKey:R.providerStatus})},onError:(e,t)=>{if(e instanceof Ke&&e.command){let n=uv.find(e=>e.id===t)?.label??t;a({provider:t,label:n,message:e.message,command:e.command});return}G(e.message,{tone:`danger`})}}),f=async e=>{try{await navigator.clipboard.writeText(e),G(`Command copied`)}catch{G(`Could not copy the command`,{tone:`danger`})}};return(0,X.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,X.jsxs)(`div`,{className:`mb-2`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),e.isError?(0,X.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.error.message})]}),(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:uv.map(r=>{let a=Jt(e.data,r.id),o=a?.status,s=o?fv[o]:e.isPending?{label:`Checking…`,tone:`neutral`}:fv.unknown,c=d.isPending&&d.variables===r.id,l=o===`disconnected`||o===`unknown`,p=a?.authFailureId;return(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":r.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:r.label}),(0,X.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(Is,{tone:s.tone,pulse:e.isPending}),(0,X.jsx)(`span`,{children:s.label}),a?.enabled===!1?(0,X.jsx)(`span`,{children:`Disabled`}):null]}),o===`not-installed`?(0,X.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,r.label,`, then run `,(0,X.jsx)(`code`,{children:r.login}),`.`]}):o===`unknown`||e.isError&&!o?(0,X.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:a?.hint??`Verification failed. Check again when the provider is available.`}):a?.hint?(0,X.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:a.hint}):null]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o===`not-installed`?null:(0,X.jsx)(zu,{checked:a?.enabled??!0,"aria-label":`Use ${r.label}`,onCheckedChange:e=>u(r.id,e)}),l?(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,disabled:t.isPending,onClick:()=>t.mutate(void 0,{onError:e=>G(e.message,{tone:`danger`})}),children:`Check again`}):null,o===`disconnected`?(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,disabled:d.isPending,onClick:()=>d.mutate(r.id),children:c?`Opening…`:`Connect`}):null,p===void 0?null:(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,disabled:n.isPending,onClick:()=>n.mutate({provider:r.id,authFailureId:p},{onSuccess:()=>G(`${r.label} can be tried again.`),onError:e=>G(e.message,{tone:`danger`})}),children:`Try again`})]})]}),p===void 0?null:(0,X.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. cezar cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),i?.provider===r.id&&o!==`connected`?(0,X.jsxs)(`div`,{role:`region`,"aria-label":`${i.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,X.jsx)(`p`,{className:`text-[13px] text-foreground`,children:i.message}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:i.command}),(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void f(i.command),children:`Copy command`})]})]}):null]},r.id)})})]})}function hv(){let e=V();return B({mutationFn:e=>Ze(e),onSuccess:t=>{e.setQueryData(z.config,t),e.invalidateQueries({queryKey:z.health}),e.invalidateQueries({queryKey:z.repo})},onError:e=>G(e.message,{tone:`danger`})})}function gv(){let e=yt(),t=je(),n=ee();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(jo,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(_v,{config:e.data,catalogs:t,providerStatus:n})}function _v({config:e,catalogs:t,providerStatus:n}){let r=hv();return(0,X.jsxs)(`div`,{"data-slot":`agents-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(mv,{}),(0,X.jsx)(vv,{defaultRunner:e.defaultRunner,providerStatus:n,saving:r.isPending,onPick:e=>r.mutate({defaultRunner:e})}),(0,X.jsx)(yv,{title:`Default models`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,X.jsx)(`div`,{className:`flex max-w-md flex-col gap-2`,children:ca.map(i=>{let a=Jt(n.data,i.id),o=!n.isPending&&!n.isError&&a?.enabled===!0&&a.status===`connected`,s=n.isPending?`Checking provider authentication…`:n.isError?`Provider authentication could not be verified.`:a?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:o?void 0:`Connect this provider before selecting it.`,c=t[i.id],l=la(i.id,c.data,c.isError),u=Bi(i.id,c.data,[e.defaultModels[i.id]]),d=e.defaultModels[i.id]??``,f=u.find(e=>e.id===d)?.label??d??`auto (default)`;return(0,X.jsxs)(`label`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`w-24 shrink-0 font-mono text-xs text-muted-foreground`,children:i.label}),e.modelsLocked?(0,X.jsx)(`output`,{"aria-label":`Default model for ${i.label}`,"data-slot":`agents-model`,"data-runner":i.id,title:`Model selection is locked to native coding-agent settings.`,className:`block w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,X.jsxs)(`select`,{"aria-label":`Default model for ${i.label}`,"data-slot":`agents-model`,"data-runner":i.id,value:d,title:s??i.desc,disabled:r.isPending||!o,onChange:e=>r.mutate({defaultModels:{[i.id]:e.target.value||null},defaultModelsAuto:{[i.id]:e.target.value===``}}),className:`block w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[u.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.id===``?`auto (default)`:e.label},e.id)),l?(0,X.jsx)(`option`,{disabled:!0,children:l}):null]})]},i.id)})})})]})}function vv({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let i=an(),a=A(),o=_t(),s=Et(),c=_e(),l=o.projectId??`default`,u=s.data?.info?.root,d=u?i.data?.selections[u]:void 0,f=i.data?.defaults,p=P_(i.data?.profiles??[]),m=F_(p);return(0,X.jsxs)(yv,{title:m?`Default agent`:`Default runner`,hint:m?`Preselected for new tasks in THIS repo, and used by the chain planner. Each task can still pick another agent or account. The account is stored on this machine only — it is never committed, so a teammate keeps their own.`:`Preselected for new tasks in THIS repo, and used by the chain planner. Each task can still pick another runner.`,children:[(0,X.jsx)(I_,{rows:p,runner:e,accountFor:e=>d?.[e]??f?.[e]??null,providerStatus:t,disabled:n,accountDisabled:c.isPending||a.data===void 0,onPick:(t,n,i)=>{t!==e&&r(t),i&&c.mutate({projectId:l,provider:t,profileId:n},{onError:e=>G(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&Jt(t.data,e)?.enabled===!1?(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,m?(0,X.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function yv({title:e,hint:t,children:n}){return(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var bv=`cez-accent`,xv=`cez-density`,Sv=`cez-width`,Cv=`lime`,wv=`comfortable`,Tv=`narrow`;function Ev(e){return e===`lime`||e===`violet`?e:Cv}function Dv(e){return e===`comfortable`||e===`compact`||e===`ultra`?e:wv}function Ov(e){return e===`narrow`||e===`wide`?e:Tv}function kv(e){let t=e&&typeof e==`object`?e:{};return{accent:Ev(t.accent),density:Dv(t.density),width:Ov(t.width)}}function Av(){try{return{accent:Ev(localStorage.getItem(bv)),density:Dv(localStorage.getItem(xv)),width:Ov(localStorage.getItem(Sv))}}catch{return{accent:Cv,density:wv,width:Tv}}}function jv(e){try{localStorage.setItem(bv,e.accent),localStorage.setItem(xv,e.density),localStorage.setItem(Sv,e.width)}catch{}}function Mv(e,t){t.accent===`lime`?delete e.dataset.accent:e.dataset.accent=t.accent,t.density===`comfortable`?delete e.dataset.density:e.dataset.density=t.density,t.width===`narrow`?delete e.dataset.width:e.dataset.width=t.width}var Nv=Y.createContext(null);function Pv({children:e}){let t=V(),n=Ue(),[r,i]=Y.useState(Av),a=n.data;Y.useEffect(()=>{if(a===void 0)return;let e=kv(a.appearance);i(e),jv(e)},[a]),Y.useLayoutEffect(()=>{Mv(document.documentElement,r)},[r]);let o=Y.useCallback(e=>{i(e),jv(e),v({appearance:e}).then(e=>t.setQueryData(R.uiState,e)).catch(e=>{G(e instanceof Error?e.message:String(e),{tone:`danger`}),t.invalidateQueries({queryKey:R.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)(Nv.Provider,{value:u,children:e})}function Fv(){let e=Y.useContext(Nv);if(!e)throw Error(`cezar: useAppearance() must be called inside <AppearanceProvider>`);return e}var Iv=[{value:`system`,label:`System`,icon:Ec},{value:`light`,label:`Light`,icon:Lc},{value:`dark`,label:`Dark`,icon:Dc}],Lv=[{value:`lime`,label:`Lime`,swatch:`var(--accent-lime)`},{value:`violet`,label:`Violet`,swatch:`var(--violet)`}],Rv=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Compact for real`}],zv=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function Bv({slot:e,label:t,value:n,options:r,onChange:i}){return(0,X.jsx)(`div`,{role:`radiogroup`,"aria-label":t,"data-slot":e,className:`inline-flex w-fit gap-0.5 rounded-md border border-border bg-card p-0.5`,children:r.map(e=>{let t=e.value===n;return(0,X.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,"data-value":e.value,onClick:()=>i(e.value),className:U(`flex items-center gap-2 rounded-sm px-3 py-1.5 text-[13px] font-medium transition-colors`,t?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,X.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function Vv({title:e,hint:t,children:n}){return(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function Hv(){let e=A(),{order:t,canReorder:n,reset:r}=zd();return!((e.data?.projects.length??0)>1)||t.length===0?null:(0,X.jsx)(Vv,{title:`Project order`,hint:`The sidebar is in the order you dragged it into. Reset puts it back to most-recently-opened first. Shared with every browser signed in to this cezar.`,children:(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`appearance-project-order-reset`,disabled:!n,onClick:r,className:`w-fit`,children:`Reset order`})})}function Uv(){let e=I(),t=V(),n=(0,Y.useRef)(null),[r,i]=(0,Y.useState)(null);(0,Y.useEffect)(()=>()=>{r&&URL.revokeObjectURL(r.url)},[r]);let a=B({mutationFn:e=>Oe(e),onSuccess:e=>t.setQueryData(R.config,e),onError:e=>G(e.message,{tone:`danger`})}),o=B({mutationFn:async e=>e?Vt(e):Ae(),onSuccess:e=>{let n=t.getQueryData(R.config);n&&t.setQueryData(R.config,{...n,branding:{...n.branding,logoUrl:e}}),i(null)},onError:e=>G(e.message,{tone:`danger`})}),s=e.data?.branding,[c,l]=(0,Y.useState)(s?.name??`cezar`),[u,d]=(0,Y.useState)(s?.name??`cezar`);return(0,Y.useEffect)(()=>{s&&c===u&&(l(s.name),d(s.name))},[s?.name]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Vv,{title:`Instance name`,hint:`Shown in the sidebar and browser tab across this workspace.`,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`input`,{"data-slot":`branding-name`,"aria-label":`Instance name`,maxLength:80,value:c,onChange:e=>l(e.currentTarget.value),onBlur:()=>{let e=c.trim();if(!e){l(s?.name??`cezar`);return}e!==s?.name&&a.mutate({branding:{name:e}}),d(e)},className:`h-9 w-64 rounded-md border border-border bg-background px-3 text-sm`}),(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,disabled:!s||s.name===`cezar`||a.isPending,onClick:()=>a.mutate({branding:{name:null}}),children:`Reset name`})]})}),(0,X.jsx)(Vv,{title:`Logo`,hint:`PNG, JPEG, WebP, GIF, AVIF, or safe SVG up to 2 MB. Stored on this machine and shared by its browsers.`,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-lg border border-border bg-card p-3`,children:[r?(0,X.jsx)(`img`,{src:r.url,alt:`Logo preview`,className:`size-10 rounded-md border border-border bg-background object-contain p-1`}):s?.logoUrl?(0,X.jsx)(`img`,{src:s.logoUrl,alt:`Current instance logo`,className:`size-10 rounded-md border border-border bg-background object-contain p-1`}):(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-10 rounded-md border border-dashed border-border bg-background`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground`,children:r?.file.name??(s?.logoUrl?`Current logo`:`No logo selected`)}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Choose an image to preview it before saving.`})]}),(0,X.jsx)(`input`,{ref:n,"data-slot":`branding-logo`,"aria-label":`Upload logo`,type:`file`,accept:`image/png,image/jpeg,image/webp,image/gif,image/avif,image/svg+xml`,disabled:o.isPending,hidden:!0,onChange:e=>{let t=e.currentTarget.files?.[0];t&&i({file:t,url:URL.createObjectURL(t)}),e.currentTarget.value=``}}),(0,X.jsxs)(W,{type:`button`,variant:`outline`,size:`sm`,disabled:!s||o.isPending,onClick:()=>n.current?.click(),children:[(0,X.jsx)(us,{"aria-hidden":`true`,className:`size-3.5`}),`Choose logo`]}),r?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{type:`button`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(r.file),children:`Save logo`}),(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>i(null),children:`Cancel`})]}):s?.logoUrl?(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(null),children:`Remove logo`}):null]})})]})}function Wv(){let{theme:e,setTheme:t}=pd(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:s}=Fv();return(0,X.jsxs)(`div`,{"data-slot":`appearance-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(Uv,{}),(0,X.jsx)(Vv,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,X.jsx)(Bv,{slot:`appearance-theme`,label:`Theme`,value:e,options:Iv,onChange:t})}),(0,X.jsx)(Vv,{title:`Accent`,hint:`The primary action color. Saved with this repo's cockpit state.`,children:(0,X.jsx)(Bv,{slot:`appearance-accent`,label:`Accent`,value:n,options:Lv,onChange:a})}),(0,X.jsx)(Vv,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,X.jsx)(Bv,{slot:`appearance-density`,label:`Density`,value:r,options:Rv,onChange:o})}),(0,X.jsx)(Vv,{title:`Reading width`,hint:`Wide gives task sessions, commits, and skill content more room. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,children:(0,X.jsx)(Bv,{slot:`appearance-width`,label:`Reading width`,value:i,options:zv,onChange:s})}),(0,X.jsx)(Hv,{})]})}function Gv({embedded:e=!1}={}){let t=Le();return t.isPending?(0,X.jsx)(`p`,{"data-slot":`prompt-templates-loading`,className:e?`text-[13px] text-soft-foreground`:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading prompt templates…`}):t.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(Oc,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:t.error.message,heading:`h2`}):(0,X.jsx)(Kv,{initial:fo(t.data.promptTemplates),embedded:e})}function Kv({initial:e,embedded:t}){let n=V(),r=pe(),i=Le(),[a,o]=(0,Y.useState)(e),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(``),d=B({mutationFn:e=>dn({promptTemplates:e}),onSuccess:e=>{n.setQueryData(z.uiState,e),G(`Prompt templates saved`)},onError:e=>G(e.message,{tone:`danger`})}),f=JSON.stringify(a)!==JSON.stringify(e),p=a.some(e=>e.label.trim()===``||e.text.trim()===``),m=(e,t)=>o(n=>n.map(n=>n.id===e?{...n,...t}:n)),h=(e,t)=>o(n=>n.map(n=>{if(n.id!==e)return n;let r=n.skills??[],i=r.includes(t)?r.filter(e=>e!==t):[...r,t],{skills:a,...o}=n;return i.length>0?{...o,skills:i}:o})),g=e=>o(t=>t.filter(t=>t.id!==e));return(0,X.jsx)(`div`,{"data-slot":`prompt-templates-section`,className:t?`flex w-full flex-col gap-7`:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,X.jsxs)(Jv,{title:`Prompt templates`,hint:`Reusable snippets you can insert into a prompt — the new-task composer, the GitHub hand-over, and the Inbox's “Add instructions” box all offer this list. Assign a template to a skill and it fills the prompt in for you when you pick that skill, as long as you have not typed anything yet.`,children:[(0,X.jsx)(`div`,{"data-slot":`prompt-template-list`,className:`flex flex-col gap-3`,children:a.length===0?(0,X.jsx)(`p`,{"data-slot":`prompt-templates-empty`,className:`text-[13px] text-soft-foreground`,children:`No templates. Add one below, or reset to the built-ins.`}):a.map(e=>(0,X.jsxs)(`div`,{"data-slot":`prompt-template-row`,"data-template":e.id,className:`flex flex-col gap-1.5 rounded-md border border-border bg-card p-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Fs,{"aria-label":`Label for ${e.label||`this template`}`,"data-slot":`prompt-template-label-input`,value:e.label,maxLength:80,onChange:t=>m(e.id,{label:t.target.value}),className:`flex-1`}),(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>g(e.id),children:(0,X.jsx)(ys,{"aria-hidden":`true`,className:`size-3.5`})})]}),(0,X.jsx)(Po,{"aria-label":`Text for ${e.label||`this template`}`,"data-slot":`prompt-template-text-input`,value:e.text,maxLength:xo,onChange:t=>m(e.id,{text:t.target.value}),className:`min-h-14 text-[13px]`}),(0,X.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(qv,{label:e.label,skills:r.data??[],skillUsage:i.data?.skillUsage,selected:e.skills??[],onToggle:t=>h(e.id,t)}),(e.skills??[]).map(t=>(0,X.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skill-chip`,"data-skill":t,title:`Stop applying “${e.label}” automatically with ${t}`,onClick:()=>h(e.id,t),className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[t,(0,X.jsx)(ys,{"aria-hidden":`true`,className:`size-3`})]},t))]})]},e.id))}),(0,X.jsxs)(`div`,{"data-slot":`prompt-template-new`,className:`flex flex-col gap-1.5 rounded-md border border-dashed border-border p-3`,children:[(0,X.jsx)(Fs,{"aria-label":`New template label`,"data-slot":`prompt-template-new-label`,placeholder:`Label (e.g. "Add tests")`,value:s,maxLength:80,onChange:e=>c(e.target.value)}),(0,X.jsx)(Po,{"aria-label":`New template text`,"data-slot":`prompt-template-new-text`,placeholder:`The instructions to insert…`,value:l,maxLength:xo,onChange:e=>u(e.target.value),className:`min-h-14 text-[13px]`}),(0,X.jsxs)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`prompt-template-add`,disabled:!s.trim()||!l.trim(),onClick:()=>{let e=s.trim(),t=l.trim();!e||!t||(o(n=>[...n,{id:Eo(),label:e,text:t}]),c(``),u(``))},className:`self-start`,children:[(0,X.jsx)(_s,{"aria-hidden":`true`,className:`size-3.5`}),`Add template`]})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(W,{type:`button`,variant:`contrast`,size:`sm`,"data-action":`prompt-templates-save`,disabled:!f||p||d.isPending,onClick:()=>d.mutate(a),children:`Save`}),(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:d.isPending,onClick:()=>o(co.map(e=>({...e}))),children:`Reset to defaults`}),p?(0,X.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-[11px] text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function qv({label:e,skills:t,skillUsage:n,selected:r,onToggle:i}){let[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(``),l=(0,Y.useRef)(null),{mostUsed:u,project:d,global:f}=Qa(ko(t,s,n),n),p=(e,t)=>{let n=r.includes(e.name);return(0,X.jsxs)(mi,{value:`skill ${e.name} ${e.path}`,keywords:ao(e.name,e.description),"data-slot":`prompt-template-skill-option`,"data-skill":e.name,"data-selected":n?`true`:void 0,onSelect:()=>i(e.name),children:[(0,X.jsx)(`span`,{className:U(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,n?(0,X.jsx)(Fo,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.path)};return(0,X.jsxs)(jr,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,X.jsx)(kr,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skills-trigger`,"aria-label":`Apply ${e||`this template`} automatically with a skill`,title:`Pick the skills this template applies itself to`,disabled:t.length===0,className:U(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,r.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,X.jsx)(ya,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),t.length===0?`no skills found`:`apply with…`,(0,X.jsx)(zo,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,X.jsx)(br,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(pi,{shouldFilter:!1,children:[(0,X.jsx)(gi,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>l.current?.scrollTo(0,0)}),(0,X.jsxs)(di,{ref:l,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[u.length===0&&d.length===0&&f.length===0?(0,X.jsx)(ci,{children:`Nothing matches.`}):null,u.length>0?(0,X.jsx)(li,{heading:`Most used`,children:u.map(e=>p(e,$a(e)))}):null,d.length>0?(0,X.jsx)(li,{heading:`Project skills`,children:d.map(e=>p(e,!0))}):null,f.length>0?(0,X.jsx)(li,{heading:`Global`,children:f.map(e=>p(e,!1))}):null]})]})})]})}function Jv({title:e,hint:t,children:n}){return(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function $({title:e,hint:t,children:n}){return(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}var Yv=2e4,Xv=4e3;function Zv(){let e=yt();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`instructions-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading instructions…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(zi,{}),tone:`danger`,title:`Instructions did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(Qv,{config:e.data})}function Qv({config:e}){let t=hv(),[n,r]=(0,Y.useState)(e.systemPrompt??``),i=n.trim(),a=i===(e.systemPrompt??``),o=i.length>Yv,s=()=>t.mutate({systemPrompt:i===``?null:i},{onSuccess:()=>G(i===``?`System prompt cleared`:`System prompt saved`)}),[c,l]=(0,Y.useState)(e.branchNaming??``),u=c.trim(),d=u===(e.branchNaming??``),f=u.length>Xv;return(0,X.jsxs)(`div`,{"data-slot":`instructions-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsxs)($,{title:`System prompt`,hint:`Read by every agent step of every new task, whichever runner executes it. This is the only place it is edited.`,children:[(0,X.jsx)(Po,{"aria-label":`System prompt`,"data-slot":`instructions-system-prompt`,value:n,onChange:e=>r(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-32 max-w-xl`}),(0,X.jsxs)(`div`,{className:`flex max-w-xl items-center gap-3`,children:[(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`instructions-save-prompt`,disabled:a||o||t.isPending,onClick:s,children:`Save`}),o?(0,X.jsxs)(`p`,{"data-slot":`instructions-prompt-limit`,className:`text-[11px] text-danger`,children:[i.length.toLocaleString(),` characters — the limit is `,Yv.toLocaleString(),`.`]}):(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})]})]}),(0,X.jsxs)($,{title:`Branch naming`,hint:`How new task branches are named. Generated from the first prompt.`,children:[(0,X.jsx)(Po,{"aria-label":`Branch naming`,"data-slot":`instructions-branch-naming`,value:c,onChange:e=>l(e.target.value),placeholder:`Describe your branch naming convention…`,className:`min-h-24 max-w-xl`}),(0,X.jsxs)(`div`,{className:`flex max-w-xl items-center gap-3`,children:[(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`instructions-save-branch-naming`,disabled:d||f||t.isPending,onClick:()=>t.mutate({branchNaming:u===``?null:u},{onSuccess:()=>G(u===``?`Branch naming cleared`:`Branch naming saved`)}),children:`Save`}),f?(0,X.jsxs)(`p`,{"data-slot":`instructions-branch-naming-limit`,className:`text-[11px] text-danger`,children:[u.length.toLocaleString(),` characters — the limit is`,` `,Xv.toLocaleString(),`.`]}):(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Leave empty for the default names. A new task waits for its name before it forks.`})]})]}),(0,X.jsx)(`div`,{id:`prompt-templates`,className:`scroll-mt-20`,children:(0,X.jsx)(Gv,{embedded:!0})})]})}function $v(){let e=Qi(),[t,n]=Y.useState(null),[r,i]=Y.useState(null),a=Object.keys(e.overrides).length>0,o=Y.useMemo(()=>{let t=new Map;for(let e of ea)t.set(e.group,[...t.get(e.group)??[],e]);let n=Object.keys(e.overrides).filter(t=>!ea.some(e=>e.id===t)&&e.overrides[t]).map(e=>({id:e,label:e.replace(/^[a-z-]+:/,``),group:`Other`}));return n.length>0&&t.set(`Other`,n),[...t]},[e.overrides]);Y.useEffect(()=>{if(!t)return;let r=r=>{if(r.key===`Tab`&&!r.metaKey&&!r.ctrlKey&&!r.altKey||(r.preventDefault(),r.stopImmediatePropagation(),r.key===`Escape`))return n(null);if(!r.metaKey&&!r.ctrlKey&&!r.altKey&&!r.shiftKey&&(r.key===`Backspace`||r.key===`Delete`))return e.assign(t,null),n(null);let a=Ki(r);if(!a){let e=Wi(r);e&&i(e);return}let o=Yi(a);if(o)return i(`${sa(a)} — ${o}`);let s=[...e.bindings].find(([e,n])=>n===a&&e!==t)?.[0];e.assign(t,a),s&&G(`${sa(a)} moved from ${ey(s)} to ${ey(t)}`),n(null)},a=e=>{(e.target instanceof Element?e.target.closest(`[data-slot="shortcut-chord"]`):null)?.closest(`[data-command-id]`)?.dataset.commandId!==t&&n(null)};return window.addEventListener(`keydown`,r,{capture:!0}),window.addEventListener(`pointerdown`,a,{capture:!0}),()=>{window.removeEventListener(`keydown`,r,{capture:!0}),window.removeEventListener(`pointerdown`,a,{capture:!0})}},[t,e]);let s=Wa();return(0,X.jsxs)(`div`,{"data-slot":`keyboard-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(`section`,{className:`flex flex-col gap-2`,children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task shortcuts`}),(0,X.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`Run a task’s commands from the keyboard while the task is open. `,sa(`Mod+P`),` lists them all; press `,s?`⇧↵`:`Shift+Enter`,` on a row there to set its shortcut. `,s?`⌘`:`Ctrl`,` chords also work while you type.`]})]}),(0,X.jsxs)(W,{variant:`outline`,size:`sm`,"data-action":`reset-all-shortcuts`,disabled:!a||!e.ready,onClick:e.resetAll,children:[(0,X.jsx)(jc,{"aria-hidden":`true`}),` Reset all`]})]})}),o.map(([a,o])=>(0,X.jsxs)(`section`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(`h3`,{className:`text-xs font-medium tracking-wide text-soft-foreground uppercase`,children:a}),(0,X.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-md border border-border`,children:o.map(a=>{let o=e.bindings.get(a.id),s=t===a.id,c=a.id in e.overrides;return(0,X.jsxs)(`li`,{"data-slot":`shortcut-row`,"data-command-id":a.id,className:`flex items-center gap-2 px-3 py-1.5`,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:a.label}),s?(0,X.jsx)(`span`,{"data-slot":`shortcut-recording`,className:`text-xs text-primary`,children:r??`Press keys… (esc cancels, ⌫ removes)`}):null,(0,X.jsx)(`button`,{type:`button`,"data-slot":`shortcut-chord`,"aria-label":o?`Change the shortcut for ${a.label} (${sa(o)})`:`Set a shortcut for ${a.label}`,disabled:!e.ready,onClick:()=>{i(null),n(s?null:a.id)},onBlur:()=>{s&&n(null)},className:U(`min-w-16 rounded-[5px] border border-b-2 px-1.5 py-0.5 font-mono text-xs`,s?`border-primary text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:o?sa(o):(0,X.jsx)(yc,{"aria-hidden":`true`,className:`mx-auto size-3.5`})}),c?(0,X.jsx)(W,{variant:`ghost`,size:`icon-sm`,"aria-label":`Reset ${a.label} to ${ia[a.id]?sa(ia[a.id]):`no shortcut`}`,title:`Reset to default`,onClick:()=>e.reset(a.id),children:(0,X.jsx)(jc,{"aria-hidden":`true`})}):o?(0,X.jsx)(W,{variant:`ghost`,size:`icon-sm`,"aria-label":`Remove the shortcut for ${a.label}`,title:`Remove`,onClick:()=>e.assign(a.id,null),children:(0,X.jsx)(ys,{"aria-hidden":`true`})}):(0,X.jsx)(`span`,{className:`size-7 shrink-0`})]},a.id)})})]},a))]})}function ey(e){return ea.find(t=>t.id===e)?.label??e}function ty(){let e=pe();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`bookmarklets-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading bookmarklets…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(ds,{}),tone:`danger`,heading:`h2`,title:`Could not load bookmarklets`,subtitle:e.error.message}):(0,X.jsx)(`div`,{className:`flex min-h-full flex-1 overflow-y-auto px-4 py-5 md:px-7`,children:(0,X.jsx)(ny,{skills:Ya(e.data??[])})})}function ny({skills:e}){let t=ve(),n=Dt(),r=A(),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(``),c=t.data?.key??``,l=window.location.origin,u=dr()??n.data?.bootProject??null,d=r.data?.projects.find(e=>e.id===u)?.name??rC(n.data)?.name??null,f=o.trim().toLowerCase(),p=e.filter(e=>e.name.toLowerCase().includes(f));return(0,X.jsxs)(`div`,{"data-slot":`bookmarklet-panel`,className:`mx-auto w-full max-w-2xl`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Run from GitHub`}),(0,X.jsxs)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:[`Drag a button below to your browser's bookmarks bar. On any GitHub PR or issue, click it to open this cockpit directly. The cockpit must be running: `,(0,X.jsx)(`span`,{className:`font-mono`,children:`npx cezar`}),`.`]}),(0,X.jsxs)(`label`,{className:`mt-4 flex items-center gap-2 text-[13px] font-medium`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"data-slot":`bm-auto`,checked:i,onChange:e=>a(e.target.checked),className:`size-3.5`}),`One-click launch (auto-submit)`,` `,(0,X.jsx)(`span`,{className:`font-normal text-soft-foreground`,children:`— re-drag the buttons after changing this`})]}),(0,X.jsx)(`div`,{"data-slot":`bm-generic`,className:`mt-4`,children:(0,X.jsx)(Ug,{label:d?`cezar (${d}): this PR/issue`:`cezar: this PR/issue`,url:Gg(``,!1,c,l,u),hint:`prefills the form — nothing starts by itself`})}),(0,X.jsx)(Fs,{"data-slot":`bm-filter`,placeholder:`Filter skills…`,"aria-label":`Filter bookmarklet skills`,value:o,onChange:e=>s(e.target.value),className:`mt-5 h-8 text-[13px]`}),(0,X.jsx)(`div`,{"data-slot":`bm-list`,className:`mt-3 flex flex-col gap-2`,children:p.length>0?p.map(e=>(0,X.jsx)(Ug,{label:d?`/${e.name} (${d})`:`/${e.name}`,url:Gg(e.name,i,c,l,u),hint:e.source},e.path)):(0,X.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:e.length>0?`(no skills match)`:`(no skills yet — the generic launcher above still works)`})})]})}function ry(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function iy(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function ay(e,t){let n=new Map,r=[];for(let i of t??[]){n.set(i.id,i.status);let t=e.get(i.id);t===void 0||t===i.status||h(i)&&r.push(i)}return{entering:r,statuses:n}}function oy(e){return e.enabled&&e.hidden&&e.permission===`granted`}function sy(e){let t=re(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`}}function cy(){let e=V(),t=Ue(),[n,r]=Y.useState(!1),[i,a]=Y.useState(iy),o=t.data;Y.useEffect(()=>{o!==void 0&&r(ry(o.notifications).enabled)},[o]);let s=Y.useCallback(t=>{r(t),v({notifications:{enabled:t}}).then(t=>e.setQueryData(R.uiState,t)).catch(t=>{G(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:R.uiState})})},[e]),c=Y.useCallback(e=>{if(!e){s(!1);return}if(iy()!=="default"){s(!0);return}s(!0),Notification.requestPermission().then(e=>a(e)).catch(()=>a(iy()))},[s]),l=i===`unsupported`;return(0,X.jsx)(`div`,{"data-slot":`notifications-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,X.jsx)(`label`,{htmlFor:`notifications-enabled`,children:`Notify when an agent needs you`})}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`A browser notification when a task starts waiting, asks for review, or fails — only while this tab is in the background. Off by default.`})]}),(0,X.jsx)(zu,{id:`notifications-enabled`,"data-slot":`notifications-toggle`,checked:n,disabled:l,onCheckedChange:c})]}),l?(0,X.jsx)(`p`,{"data-slot":`notifications-unsupported`,className:`text-[13px] text-muted-foreground`,children:`This browser does not support notifications, so the toggle is unavailable here.`}):null,!l&&n&&i===`denied`?(0,X.jsx)(`p`,{"data-slot":`notifications-denied`,className:`text-[13px] text-danger`,children:`This browser is blocking notifications for the cockpit. The preference is saved, but nothing will be delivered here until you allow notifications in the browser's site settings.`}):null]})})}function ly(){let e=P(),t=Dm(),[n,r]=Y.useState(!1),i=e.data,a=i?.blockedBy??null;return(0,X.jsx)(`div`,{"data-slot":`privacy-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,X.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,X.jsx)(`label`,{htmlFor:`telemetry-enabled`,children:`Share usage data`})}),(0,X.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`Task counts and crash reports, sent to cezar’s maintainers at Open Mercato`,i?(0,X.jsxs)(X.Fragment,{children:[` (`,(0,X.jsx)(`span`,{className:`font-mono text-[12px]`,children:i.endpoint}),`)`]}):null,`. Never prompts, code, diffs, paths or repository names. Off unless you turn it on; turning it off deletes this machine’s install id.`]})]}),(0,X.jsx)(zu,{id:`telemetry-enabled`,"data-slot":`telemetry-toggle`,checked:i?.consent===`granted`,disabled:!i||n,onCheckedChange:e=>{r(!0),t(e?`granted`:`denied`).finally(()=>r(!1))}})]}),a===`env`?(0,X.jsxs)(`p`,{"data-slot":`telemetry-blocked`,className:`text-[13px] text-muted-foreground`,children:[(0,X.jsx)(`code`,{className:`font-mono text-[12px]`,children:`CEZ_TELEMETRY=0`}),` or`,` `,(0,X.jsx)(`code`,{className:`font-mono text-[12px]`,children:`DO_NOT_TRACK=1`}),` is set for this server, so nothing is sent whatever this switch says.`]}):a===`automation`?(0,X.jsxs)(`p`,{"data-slot":`telemetry-blocked`,className:`text-[13px] text-muted-foreground`,children:[`This server runs under CI, a test runner or `,(0,X.jsx)(`code`,{className:`font-mono text-[12px]`,children:`CEZ_DRY_RUN=1`}),`, so nothing is sent from it.`]}):null,(0,X.jsxs)(`a`,{href:Sm,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex w-fit items-center gap-1 text-[13px] text-muted-foreground underline-offset-4 hover:text-foreground hover:underline`,children:[`Exactly what is collected`,(0,X.jsx)(vr,{className:`size-3.5`,"aria-hidden":`true`})]})]})})}var uy=400,dy=Symbol(`none`),fy=e=>e===null?``:String(e);function py({value:e,min:t,max:n,onCommit:r,allowEmpty:i=!1,emptyStepFrom:a,placeholder:o,disabled:s,"aria-label":c,"data-slot":l,className:u}){let d=(0,Y.useId)(),[f,p]=(0,Y.useState)(()=>fy(e)),m=(0,Y.useRef)(f),h=(0,Y.useRef)(null),g=(0,Y.useRef)(dy),_=(0,Y.useRef)({value:e,onCommit:r});_.current={value:e,onCommit:r};let v=e=>{m.current=e,p(e)};(0,Y.useEffect)(()=>{g.current=dy,h.current===null&&v(fy(e))},[e]);let y=(0,Y.useRef)(()=>{});(0,Y.useEffect)(()=>()=>{h.current!==null&&y.current()},[]);let b=e=>{let r=e.trim();if(r===``)return i?null:`invalid`;if(!/^-?\d+$/.test(r))return`invalid`;let a=Number(r);return a<t||a>n?`invalid`:a},x=b(f),S=x===`invalid`,C=()=>{h.current!==null&&(clearTimeout(h.current),h.current=null);let{value:e,onCommit:t}=_.current,n=b(m.current);if(n===`invalid`||n===e||g.current!==dy&&n===g.current)return;let r=t(n);r instanceof Promise&&(g.current=n,r.catch(()=>{g.current===n&&(g.current=dy),v(fy(_.current.value))}))};y.current=C;let w=e=>{let r=b(m.current),i=r===null?a??t:r===`invalid`?(_.current.value??a??t)+e:r+e;v(String(Math.min(n,Math.max(t,i)))),h.current!==null&&clearTimeout(h.current),h.current=setTimeout(C,uy)},T=t=>{t.key===`ArrowUp`||t.key===`ArrowDown`?(t.preventDefault(),w(t.key===`ArrowUp`?1:-1)):t.key===`Enter`?(t.preventDefault(),C()):t.key===`Escape`&&(h.current!==null&&clearTimeout(h.current),h.current=null,v(fy(e)))},E=typeof x==`number`?x:null,D=`flex h-1/2 w-6 items-center justify-center text-soft-foreground hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-40`;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`div`,{className:U(`flex w-28 items-stretch overflow-hidden rounded-md border border-input bg-card shadow-xs focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50`,S&&`border-danger`,s&&`opacity-50`,u),children:[(0,X.jsx)(`input`,{type:`text`,inputMode:`numeric`,role:`spinbutton`,"aria-label":c,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":E??void 0,"aria-invalid":S||void 0,"aria-describedby":S?d:void 0,"data-slot":l,value:f,placeholder:o,disabled:s,onChange:e=>v(e.target.value),onBlur:C,onKeyDown:T,className:`min-w-0 flex-1 bg-transparent px-3 py-1.5 text-sm outline-none placeholder:text-soft-foreground`}),(0,X.jsxs)(`div`,{className:`flex flex-col border-l border-input`,children:[(0,X.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Increase ${c}`,"data-action":`stepper-increment`,disabled:s||E!==null&&E>=n,onMouseDown:e=>e.preventDefault(),onClick:()=>w(1),className:D,children:(0,X.jsx)(tc,{className:`size-3.5`})}),(0,X.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Decrease ${c}`,"data-action":`stepper-decrement`,disabled:s||E!==null&&E<=t,onMouseDown:e=>e.preventDefault(),onClick:()=>w(-1),className:U(D,`border-t border-input`),children:(0,X.jsx)(zo,{className:`size-3.5`})})]})]}),S?(0,X.jsxs)(`p`,{id:d,"data-slot":`stepper-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,t,` to `,n,i?`, or leave it empty`:``,`.`]}):null]})}function my(){let e=Wt();return{isPending:e.isPending,confirm:(t,n)=>e.mutate(t.id,{onSuccess:()=>{G(`${t.name} removed from the workspace — its files are untouched`),n?.()},onError:e=>G(e.message,{tone:`danger`})})}}function hy({project:e,onOpenChange:t,onConfirm:n}){return(0,X.jsx)(As,{open:e!==null,onOpenChange:t,children:(0,X.jsxs)(Ts,{children:[(0,X.jsxs)(ks,{children:[(0,X.jsxs)(ws,{children:[`Remove `,e?.name,` from the workspace?`]}),(0,X.jsxs)(Cs,{children:[`This only unregisters the project — `,(0,X.jsx)(`strong`,{children:`nothing on disk is deleted`}),`. The folder, its git history and its task history all stay exactly where they are, and adding it back later finds everything intact.`,(0,X.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[11px] text-foreground`,title:e?.root,children:e?.root})]})]}),(0,X.jsxs)(Ds,{children:[(0,X.jsx)(Os,{children:`Keep it`}),(0,X.jsx)(Es,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:n,children:`Remove from list`})]})]})})}var gy=1,_y=16,vy={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function yy(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function by(){let e=I(),t=A();return e.isPending||t.isPending?(0,X.jsx)(`p`,{"data-slot":`projects-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading projects…`}):e.isError||t.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(mc,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,X.jsx)(xy,{config:e.data,registry:t.data})}function xy({config:e,registry:t}){return(0,X.jsxs)(`div`,{"data-slot":`projects-section`,className:`mx-auto flex w-full max-w-4xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(Sy,{configKey:`browseRoot`,value:e.browseRoot,title:`Default browse folder`,hint:`Where “Open local folder…” starts. The picker cannot navigate above this folder.`,placeholder:`~/`,slot:`browse`,savedLabel:`Browse folder`,footer:`Only affects folder browsing; GitHub checkouts use the separate checkout folder.`}),(0,X.jsx)(Sy,{configKey:`projectsDir`,value:e.projectsDir,title:`Default checkout folder`,hint:`Where “Clone from GitHub” and “New project” put new projects: <folder>/<project name>.`,placeholder:`~/cezar/projects`,slot:`checkout`,savedLabel:`Checkout folder`,footer:`Only affects new checkouts; projects already registered keep their location.`,refreshProjects:!0}),(0,X.jsx)(Cy,{registry:t,workspaceMax:e.resources.maxParallel})]})}function Sy({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,savedLabel:o,footer:s,refreshProjects:c=!1}){let l=V(),u=B({mutationFn:t=>Oe(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{l.setQueryData(R.config,t),e===`browseRoot`?l.invalidateQueries({queryKey:R.fsBrowseRoot}):c&&l.invalidateQueries({queryKey:R.projects})}}),[d,f]=(0,Y.useState)(t),p=d.trim(),m=p===t,h=u.isError?u.error.message:null;return(0,X.jsxs)($,{title:n,hint:`${r} ${e===`browseRoot`?`Choose an existing folder; it is verified writable before saving.`:`The folder is created recursively if needed, then verified writable before saving.`}`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,"aria-label":n,"aria-invalid":h!==null,"data-slot":`projects-${a}-root`,value:d,disabled:u.isPending,placeholder:i,onChange:e=>{f(e.target.value),u.isError&&u.reset()},className:`block w-full max-w-sm rounded-md border border-input bg-card px-3 py-1.5 font-mono text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-danger disabled:opacity-50`}),(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`projects-save-${a}-root`,disabled:m||p===``||u.isPending,onClick:()=>u.mutate(p,{onSuccess:()=>G(`${o} set to ${p}`)}),children:`Save`})]}),h===null?(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:s}):(0,X.jsxs)(`p`,{"data-slot":`projects-${a}-root-error`,role:`alert`,className:`text-[11px] text-danger`,children:[h,` — setting unchanged`]})]})}function Cy({registry:e,workspaceMax:t}){let[n,r]=(0,Y.useState)(null),i=my(),a=(0,Y.useMemo)(()=>nn(e.projects),[e.projects]);return(0,X.jsxs)($,{title:`Registered projects`,hint:`The folders you have added. While this list is empty the folder cezar is serving is listed as “not registered” with an Add button; once you have projects, starting cezar somewhere new neither registers nor lists that folder — use “Add project” when you want to keep it. “Tags” group connected repositories — give the API, the web app and the design system a shared “storefront” tag and the global Tasks page can show all three as one piece of work. “Max parallel” caps how many of that project's tasks run at once (leave it empty to inherit the workspace limit); the workspace limit (${t}) still applies as an overall ceiling, so a per-project value above it has no extra effect until the workspace limit is raised. Removing a project only unregisters it — no files on disk are deleted.`,children:[e.projects.length===0?(0,X.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}):(0,X.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,X.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,X.jsx)(`caption`,{className:`sr-only`,children:`Projects in this workspace`}),(0,X.jsxs)(`colgroup`,{children:[(0,X.jsx)(`col`,{}),(0,X.jsx)(`col`,{style:{width:`104px`}}),(0,X.jsx)(`col`,{style:{width:`260px`}}),(0,X.jsx)(`col`,{style:{width:`150px`}}),(0,X.jsx)(`col`,{style:{width:`72px`}}),(0,X.jsx)(`col`,{style:{width:`92px`}})]}),(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Project`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Tags`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Max parallel`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Added`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,X.jsx)(`tbody`,{children:e.projects.map(n=>(0,X.jsx)(wy,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,vocabulary:a,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,X.jsx)(hy,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{if(!n)return;let e=n;r(null),i.confirm(e)}})]})}function wy({project:e,isBoot:t,workspaceMax:n,vocabulary:r,disabled:i,onRemove:a}){return(0,X.jsxs)(`tr`,{"data-slot":`project-row`,"data-project":e.id,className:`border-b border-border last:border-0`,children:[(0,X.jsxs)(`th`,{scope:`row`,className:`max-w-0 px-3 py-2 text-left font-normal`,children:[(0,X.jsx)(`span`,{className:`block truncate text-foreground`,children:e.name}),(0,X.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,title:e.root,children:e.root})]}),(0,X.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,X.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-[12px] text-danger`:`text-[12px] text-soft-foreground`,children:vy[e.status]}),e.unregistered?(0,X.jsx)(`span`,{"data-slot":`project-unregistered`,className:`ml-1 text-[11px] text-soft-foreground`,children:`· not registered`}):e.status===`missing`?null:(0,X.jsxs)(`span`,{className:`ml-1 text-[11px] text-soft-foreground`,children:[`· `,e.source]})]}),(0,X.jsx)(`td`,{className:`px-3 py-2`,children:e.unregistered?(0,X.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`—`}):(0,X.jsx)(Ey,{project:e,vocabulary:r})}),(0,X.jsx)(`td`,{className:`px-3 py-2`,children:e.unregistered?(0,X.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`—`}):(0,X.jsx)(Dy,{project:e,workspaceMax:n})}),(0,X.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:e.unregistered?`—`:yy(e.addedAt)}),(0,X.jsxs)(`td`,{className:`px-3 py-2 text-right whitespace-nowrap`,children:[!e.unregistered&&e.status!==`missing`?(0,X.jsx)(W,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,X.jsx)(or,{to:`/p/${encodeURIComponent(e.id)}/settings`,"data-action":`project-settings`,"aria-label":`Settings for ${e.name}`,children:`Settings`})}):null,e.unregistered?(0,X.jsx)(Ty,{root:e.root,name:e.name,disabled:i,notAddable:e.notAddable===!0}):(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`project-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:t?"cezar is serving this project — stop it and use `cezar projects remove`":void 0,disabled:i||t,onClick:a,children:`Remove`})]})]})}function Ty({root:e,name:t,disabled:n=!1,notAddable:r=!1}){let i=dt();return(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-add-boot`,"aria-label":`Add ${t} to your projects`,title:r?`Your home directory or a cezar task worktree cannot be a project — start cezar in a project folder, or use Open local folder`:`cezar is serving this folder — save it to your projects`,disabled:n||r||i.isPending,onClick:()=>i.mutate(e,{onSuccess:()=>G(`${t} added to your projects`),onError:e=>G(e.message,{tone:`danger`})}),children:`Add project`})}function Ey({project:e,vocabulary:t}){let n=M(),[r,i]=(0,Y.useState)(``),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(-1),l=(0,Y.useRef)(null),u=e.tags??[],d=Ut(t,u,r),f=a&&d.length>0,p=(t,r)=>{n.mutate({id:e.id,tags:t},{onSuccess:()=>G(r),onError:e=>G(e.message,{tone:`danger`})})},m=t=>{let n=t.trim().slice(0,32);if(c(-1),n){if(u.some(e=>e.toLowerCase()===n.toLowerCase())){i(``);return}if(u.length>=20){G(`${e.name} already has the maximum of 20 tags`,{tone:`danger`});return}i(``),p([...u,n],`${e.name} tagged \u201c${n}\u201d`)}},h=t=>{p(u.filter(e=>e!==t),`\u201c${t}\u201d removed from ${e.name}`)},g=`project-tag-suggestions-${e.id}`;return(0,X.jsxs)(`div`,{"data-slot":`project-tags`,className:`flex flex-wrap items-center gap-1`,children:[u.map(t=>(0,X.jsxs)(`span`,{"data-slot":`project-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full bg-violet/15 py-px pr-1 pl-2 text-[11px] font-medium whitespace-nowrap text-violet`,children:[t,(0,X.jsx)(`button`,{type:`button`,"data-action":`project-tag-remove`,"aria-label":`Remove tag ${t} from ${e.name}`,disabled:n.isPending,onClick:()=>h(t),className:`rounded-full p-0.5 hover:bg-violet/25 disabled:opacity-50`,children:(0,X.jsx)(ys,{className:`size-3`,"aria-hidden":`true`})})]},t)),(0,X.jsxs)(jr,{open:f,onOpenChange:o,children:[(0,X.jsx)(Er,{asChild:!0,children:(0,X.jsx)(`input`,{ref:l,type:`text`,"data-slot":`project-tag-input`,"aria-label":`Add a tag to ${e.name}`,role:`combobox`,"aria-expanded":f,"aria-controls":f?g:void 0,"aria-autocomplete":`list`,"aria-activedescendant":f&&s>=0?`${g}-${s}`:void 0,placeholder:u.length===0?`Add tag…`:`+`,value:r,maxLength:32,disabled:n.isPending,onFocus:()=>o(!0),onBlur:()=>o(!1),onChange:e=>{if(o(!0),c(-1),e.target.value.includes(`,`)){i(e.target.value.replace(/,/g,``));return}i(e.target.value)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(d.length===0)return;e.preventDefault(),o(!0);let t=e.key===`ArrowDown`?1:-1,n=s+t;c(n>=d.length?-1:n<-1?d.length-1:n);return}if(e.key===`Escape`&&f){e.preventDefault(),o(!1),c(-1);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),m(s>=0?d[s]??r:r);return}if(e.key===`Tab`){o(!1);return}if(e.key===`Backspace`&&r===``&&u.length>0){e.preventDefault();let t=u[u.length-1];t!==void 0&&h(t)}},className:`h-6 w-16 min-w-0 flex-1 rounded-md border border-input bg-card px-1.5 text-[12px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})}),(0,X.jsxs)(br,{align:`start`,sideOffset:4,id:g,role:`listbox`,"data-slot":`project-tag-suggestions`,className:`w-56 p-1`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,X.jsx)(`p`,{className:`px-2 pt-1 pb-1.5 text-[10.5px] text-soft-foreground`,children:`Tags used in this workspace`}),d.map((e,t)=>(0,X.jsx)(`button`,{type:`button`,id:`${g}-${t}`,role:`option`,"aria-selected":t===s,"data-slot":`project-tag-suggestion`,onMouseDown:e=>e.preventDefault(),onClick:()=>{m(e),l.current?.focus()},onMouseEnter:()=>c(t),className:U(`flex w-full items-center rounded-sm px-2 py-1 text-left text-[12px] font-medium text-violet`,t===s&&`bg-muted`),children:e},e))]})]})]})}function Dy({project:e,workspaceMax:t}){let n=M();return(0,X.jsx)(py,{"aria-label":`Max parallel tasks for ${e.name}`,"data-slot":`project-max-parallel`,value:e.maxParallel??null,min:gy,max:_y,allowEmpty:!0,emptyStepFrom:Math.min(_y,Math.max(gy,t)),placeholder:`Inherit (${t})`,className:`w-40`,onCommit:r=>n.mutateAsync({id:e.id,maxParallel:r},{onSuccess:()=>G(r===null?`${e.name} inherits the workspace limit (${t})`:`${e.name} runs at most ${r} task${r===1?``:`s`} at a time`),onError:e=>G(e.message,{tone:`danger`})})})}var Oy=30,ky=100,Ay=32,jy=60,My=85,Ny=e=>Math.min(100,Math.max(0,e));function Py(){Ei({enabled:!Ni()});let e=Oi(),t=xi(),{isError:n}=Si(),r=Ai(),i=Di(),a=Ti(),o=r===void 0?void 0:Mi(r),s=o?.cpuPct,c=e===`local`,l=o?.memTotalBytes??0,u=o?.memUsedBytes!==void 0&&l>0?Ny(o.memUsedBytes/l*100):0,d=s===void 0?void 0:s>My?`bg-danger`:s>=jy?`bg-pending`:`bg-primary`,f=s===void 0?void 0:Ny(s),p=i.length>=2?i.map((e,t)=>{let n=t/(Oy-1)*ky,r=Ay-Ny(e.cpuPct)/100*Ay;return`${n.toFixed(1)},${r.toFixed(1)}`}).join(` `):void 0,m=o===void 0||!o.cpuLimited?s===void 0?`sampling…`:`${Math.round(s)}%`:s===void 0?`—`:`${Math.round(s)}%`,h=o===void 0||!o.cpuLimited?void 0:`${o.cpuLimitKind===`cpuset`?`cpuset `:``}${Ci(o.cpuCores)}`,g=o===void 0?void 0:`${o.memUsedBytes===void 0?`—`:ot(o.memUsedBytes)} / ${ot(o.memTotalBytes)}`;return(0,X.jsxs)(`section`,{"data-slot":`machine-card`,"aria-labelledby":`machine-card-title`,className:`rounded-xl border border-border bg-card/60 p-4`,children:[(0,X.jsxs)(`header`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(Is,{tone:c?`success`:`neutral`,pulse:c}),(0,X.jsx)(`h2`,{id:`machine-card-title`,className:`text-sm font-semibold`,children:`Machine`}),(0,X.jsx)(`span`,{"data-slot":`machine-card-mode`,className:`text-[11px] text-soft-foreground`,children:c?`live`:`last known`}),(0,X.jsx)(`span`,{"data-slot":`machine-card-freshness`,className:`ml-auto shrink-0 text-[11px] tabular-nums text-soft-foreground`,children:a===void 0?`waiting…`:`updated ${a} s ago`})]}),o?.hasContainer===!0?(0,X.jsxs)(`p`,{"data-slot":`machine-card-limits`,className:`mt-2 text-[11.5px] text-soft-foreground`,children:[`cgroup limits detected · `,o.source]}):null,t?(0,X.jsx)(`p`,{"data-slot":`machine-card-transport`,className:`mt-2 text-[11.5px] text-soft-foreground`,children:`The server refused this origin's host topic, so live values are polled from the authenticated route instead.`}):null,n&&r===void 0?(0,X.jsx)(`p`,{"data-slot":`machine-card-error`,className:`mt-3 text-[12.5px] text-soft-foreground`,children:`Host totals are unavailable right now.`}):null,(0,X.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,X.jsxs)(`div`,{"data-slot":`machine-card-cpu`,className:`grid grid-cols-[86px_1fr] items-start gap-3`,children:[(0,X.jsxs)(`span`,{className:`pt-0.5 text-[12.5px] text-soft-foreground`,children:[`CPU`,o?.cpuIsEffective===!0?` (effective)`:``]}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`span`,{"data-slot":`machine-card-cpu-value`,className:`w-32 shrink-0 text-[13px] tabular-nums`,children:h===void 0?m:`${h} · ${m}`}),(0,X.jsx)(`div`,{className:`h-2 min-w-0 flex-1 overflow-hidden rounded-full bg-muted`,children:d===void 0||f===void 0?null:(0,X.jsx)(`div`,{"data-slot":`machine-card-cpu-bar`,className:U(`h-full rounded-full`,d),style:{width:`${f}%`}})})]}),p===void 0?null:(0,X.jsx)(`svg`,{"data-slot":`machine-card-cpu-sparkline`,className:`mt-1.5 h-8 w-full text-primary`,viewBox:`0 0 ${ky} ${Ay}`,preserveAspectRatio:`none`,role:`img`,"aria-label":`CPU over the last up to ${i.length*2} seconds`,children:(0,X.jsx)(`polyline`,{points:p,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,vectorEffect:`non-scaling-stroke`})})]})]}),o===void 0?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{"data-slot":`machine-card-memory`,className:`grid grid-cols-[86px_1fr] items-center gap-3`,children:[(0,X.jsxs)(`span`,{className:`text-[12.5px] text-soft-foreground`,children:[`Memory`,o.memIsEffective?` (effective)`:``]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,X.jsx)(`span`,{"data-slot":`machine-card-memory-value`,className:`w-32 shrink-0 text-[13px] tabular-nums`,children:g}),(0,X.jsx)(`div`,{className:`h-2 min-w-0 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,X.jsx)(`div`,{className:`h-full rounded-full bg-primary`,style:{width:`${u}%`}})})]})]}),typeof r?.swapTotalBytes==`number`&&typeof r?.swapUsedBytes==`number`?(0,X.jsxs)(`div`,{"data-slot":`machine-card-swap`,className:`grid grid-cols-[86px_1fr] items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`text-[12.5px] text-soft-foreground`,children:`Swap`}),(0,X.jsxs)(`span`,{className:`text-[13px] tabular-nums`,children:[ot(r.swapUsedBytes),` / `,ot(r.swapTotalBytes)]})]}):null,r?.loadAvg===void 0?null:(0,X.jsxs)(`div`,{"data-slot":`machine-card-load`,className:`grid grid-cols-[86px_1fr] items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`text-[12.5px] text-soft-foreground`,children:`Load average`}),(0,X.jsxs)(`span`,{className:`flex items-center gap-2 text-[13px] tabular-nums`,children:[r.loadAvg.one.toFixed(2),` · `,r.loadAvg.five.toFixed(2),` ·`,` `,r.loadAvg.fifteen.toFixed(2),(0,X.jsx)(`span`,{"data-slot":`machine-card-load-cores`,className:`rounded-md border border-border px-1.5 py-0.5 text-[11px] text-soft-foreground`,children:o.hasContainer&&o.hostCpuCount!==void 0?`host ${o.hostCpuCount} cores`:`${r.cpuCount} cores`})]})]}),o.hasContainer&&o.hostCpuCount!==void 0?(0,X.jsxs)(`p`,{"data-slot":`machine-card-host-context`,className:`text-[11.5px] tabular-nums text-soft-foreground`,children:[`host `,Ci(o.hostCpuCount),` · `,ot(r?.memTotalBytes??0),` RAM`]}):null]})]}),(0,X.jsx)(`p`,{"data-slot":`machine-card-caveat`,className:`mt-3 border-t border-border pt-2 text-[11px] text-soft-foreground`,children:o?.hasContainer===!0?`Effective values come from this process’s own cgroup; host totals are labelled.`:o?.cgroupUnknown===!0?`No cgroup information available for this process - host totals only.`:`Host totals - no cgroup limit tighter than the host detected for this process.`})]})}var Fy=1,Iy=16,Ly=16,Ry=1440,zy=1,By=60,Vy=256;function Hy(){let e=I();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(hc,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(Uy,{config:e.data})}function Uy({config:e}){let t=V(),n=B({mutationFn:e=>Oe(e),onSuccess:e=>t.setQueryData(R.config,e),onError:e=>G(e.message,{tone:`danger`})}),[r,i]=(0,Y.useState)(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),a=e.resources.monitoringWakeIntervalMinutes??null,[o,s]=(0,Y.useState)(a===null?`park`:`interval`),[c,l]=(0,Y.useState)(String(a??5)),u=Number(c),d=!Number.isInteger(u)||u<zy||u>By,f=o===`park`?a===null:!d&&a===u,p=()=>n.mutate({resources:{monitoringWakeIntervalMinutes:o===`park`?null:u}},{onSuccess:()=>G(o===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${u} minutes`)}),m=e.resources.autoResumeOnUsageLimit??!0,h=e=>n.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>G(e?`Tasks stopped by a usage limit will resume themselves`:`Tasks stopped by a usage limit will stay failed`)}),g=r.trim()===``?0:Number(r),_=r.trim()!==``&&(!Number.isInteger(g)||g<Vy),v=(e.resources.memoryLimitMb??0)===(_?-1:g),y=()=>n.mutate({resources:{memoryLimitMb:g===0?null:g}},{onSuccess:()=>G(g===0?`Memory limit cleared`:`Memory limit set to ${g} MiB`)}),b=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0},x=(e,t)=>n.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}});return(0,X.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(Py,{}),(0,X.jsxs)($,{title:`Max parallel tasks`,hint:`How many tasks run at once across every project. The rest wait in the queue. A non-git directory always runs one at a time.`,children:[(0,X.jsx)(py,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e.resources.maxParallel,min:Fy,max:Iy,onCommit:e=>n.mutateAsync({resources:{maxParallel:e??Fy}})}),(0,X.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Need a different limit for one project?`,` `,(0,X.jsx)(or,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Configure per-project limits`}),`.`]})]}),(0,X.jsxs)($,{title:`Waiting-session idle timeout`,hint:`How long a plain waiting session may stay open without activity before its live backend session ends. Continue resumes it; set 0 to keep it open indefinitely.`,children:[(0,X.jsx)(py,{"aria-label":`Waiting-session idle timeout`,"data-slot":`resources-idle-timeout`,value:e.resources.idleTimeoutMinutes??0,min:0,max:Ry,onCommit:e=>n.mutateAsync({resources:{idleTimeoutMinutes:e??0}})}),(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Minutes; 0 keeps plain waiting sessions alive. Monitoring sessions are already exempt.`})]}),(0,X.jsxs)($,{title:`Extra monitoring sessions`,hint:`How many agent sessions may wait on CI, sub-agents, or monitored commands without using an active task slot. Extra sessions stay alive but pause the queue.`,children:[(0,X.jsx)(py,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:e.resources.maxMonitoringSessions??2,min:0,max:Ly,onCommit:e=>n.mutateAsync({resources:{maxMonitoringSessions:e??0}})}),(0,X.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`Capacity: `,e.resources.maxParallel,` active + `,e.resources.maxMonitoringSessions??2,` monitoring. Set 0 to make monitoring share active slots.`]})]}),(0,X.jsxs)($,{title:`Monitoring wake-up`,hint:`Park uses no model turns. Re-check sends the same agent a follow-up on this cadence until work completes or the 40-wakeup safety cap is reached.`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`select`,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,value:o,disabled:n.isPending,onChange:e=>s(e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,X.jsx)(`option`,{value:`park`,children:`Park until resumed`}),(0,X.jsx)(`option`,{value:`interval`,children:`Re-check on an interval`})]}),o===`interval`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`number`,min:zy,max:By,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:c,disabled:n.isPending,onChange:e=>l(e.target.value),className:`block w-24 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`minutes`})]}):null,(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-monitoring-wake`,disabled:f||o===`interval`&&d||n.isPending,onClick:p,children:`Save`})]}),o===`interval`&&d?(0,X.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-[11px] text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applied consistently to Claude, Codex and OpenCode.`})]}),(0,X.jsxs)($,{title:`Auto-resume after a usage limit`,hint:`When an agent stops because its provider usage limit is reached, cezar waits for the reset the provider named and continues the task 30 seconds later — up to 12 times in a row without you. Off leaves the task failed with its Continue button.`,children:[(0,X.jsxs)(`select`,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,value:m?`on`:`off`,disabled:n.isPending,onChange:e=>h(e.target.value===`on`),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,X.jsx)(`option`,{value:`on`,children:`On`}),(0,X.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to Claude, Codex and OpenCode — whenever the provider says when the limit lifts.`})]}),(0,X.jsxs)($,{title:`Per-task memory limit`,hint:`When a task's whole process tree crosses this, the engine pauses it with a warning and starts the next queued task. Leave empty for no limit.`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:Vy,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:r,disabled:n.isPending,placeholder:`no limit`,onChange:e=>i(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`MiB`}),(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-memory`,disabled:v||_||n.isPending,onClick:y,children:`Save`})]}),_?(0,X.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number of at least `,Vy,` MiB, or leave empty for no limit.`]}):(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Applies to newly started tasks.`})]}),(0,X.jsxs)($,{title:`New task defaults`,hint:`Set stable composer defaults across projects. Explicit choices and run-shape constraints still win.`,children:[(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Autonomous by default`}),(0,X.jsxs)(`select`,{"aria-label":`Autonomous by default`,value:b.autonomous===null?`inherit`:b.autonomous?`on`:`off`,disabled:n.isPending,onChange:e=>x(`autonomous`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,X.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,X.jsx)(`option`,{value:`on`,children:`On`}),(0,X.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,X.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,b.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:b.inheritedAutonomous?`On`:`Off`]})]}),(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:`Use a worktree by default`}),(0,X.jsxs)(`select`,{"aria-label":`Use a worktree by default`,value:b.worktree===null?`inherit`:b.worktree?`on`:`off`,disabled:n.isPending,onChange:e=>x(`worktree`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,X.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,X.jsx)(`option`,{value:`on`,children:`On`}),(0,X.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,X.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`Inherited: `,b.inheritedWorktree?`On`:`Off`]})]})]}),(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated.`})]})]})}function Wy(){let e=I();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`skills-settings-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading skill settings…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(kc,{}),tone:`danger`,title:`Skill settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(Gy,{config:e.data})}function Gy({config:e}){let t=V(),n=B({mutationFn:e=>Oe(e),onSuccess:e=>t.setQueryData(R.config,e),onError:e=>G(e.message,{tone:`danger`})}),r=e.skillsAutoUpdate===null;return(0,X.jsx)(`div`,{"data-slot":`skills-settings-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,X.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:(0,X.jsx)(`label`,{htmlFor:`skills-auto-update`,children:`Update Open Mercato skills automatically`})}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Checks installed Open Mercato skills in the background and applies available updates. Other skills and untracked folders are never changed.`})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[(0,X.jsx)(zu,{id:`skills-auto-update`,"data-slot":`skills-auto-update`,checked:e.effectiveSkillsAutoUpdate,disabled:n.isPending,onCheckedChange:e=>n.mutate({skillsAutoUpdate:e})}),(0,X.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[e.effectiveSkillsAutoUpdate?`On`:`Off`,r?` (default)`:``]})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:r?`No override is saved. CEZ_SKILLS_AUTO_UPDATE supplies the inherited default when set; otherwise it is on.`:`An explicit workspace override is saved.`}),(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`skills-use-default`,disabled:r||n.isPending,onClick:()=>n.mutate({skillsAutoUpdate:null}),children:`Use default`})]})]})})}function Ky(){let e=yt();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`tasks-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading task settings…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(xc,{}),tone:`danger`,title:`Task settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(qy,{config:e.data})}function qy({config:e}){let t=Et(),n=hv();return(0,X.jsxs)(`div`,{"data-slot":`tasks-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:t.data?.info?(0,X.jsxs)(`select`,{"aria-label":`Base branch`,"data-slot":`tasks-base-branch`,value:e.baseBranch??``,disabled:n.isPending,onChange:e=>n.mutate({baseBranch:e.target.value||null}),className:`block w-full max-w-md rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,X.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),t.data.branches.map(e=>(0,X.jsx)(`option`,{value:e,children:e},e))]}):(0,X.jsx)(`p`,{"data-slot":`tasks-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:t.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})}),(0,X.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,children:(0,X.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,X.jsx)(zu,{"aria-label":`Review changes before finishing`,"data-slot":`tasks-review-gate`,checked:e.reviewGate??!1,disabled:n.isPending,onCheckedChange:e=>n.mutate({reviewGate:e},{onSuccess:()=>G(e?`Review gate on`:`Review gate off`)})}),(0,X.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,X.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,children:(0,X.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,X.jsx)(zu,{"aria-label":`Live title updates`,"data-slot":`tasks-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:n.isPending,onCheckedChange:e=>n.mutate({liveTitleUpdates:e},{onSuccess:()=>G(e?`Live title updates on`:`Live title updates off`)})}),(0,X.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})})]})}function Jy(){let e=Xe(),t=_r(),n=yt(),[r,i]=(0,Y.useState)(null),a=t.data?.worktrees??[],o=!!n.data?.worktreeLifecycle&&(n.data.worktreeLifecycle.afterCreate.length>0||n.data.worktreeLifecycle.beforeRemove.length>0),s=V(),[c,l]=(0,Y.useState)(null),d=async()=>{await Promise.all([s.invalidateQueries({queryKey:z.worktrees}),s.invalidateQueries({queryKey:gr.all()})])},f=B({mutationFn:()=>T(),onSuccess:e=>{d(),G(e.reclaimed.length===0?o||a.some(e=>e.operation||e.autoCleanupSuppressed)?`No worktrees reclaimed yet. Pending cleanup or retained worktrees may keep usage above the limit.`:`Nothing to reclaim — all worktrees are within the limit`:`Reclaimed ${e.reclaimed.length} worktree${e.reclaimed.length===1?``:`s`} (branch kept)`)},onError:e=>G(e.message,{tone:`danger`})}),p=B({mutationFn:async e=>o||a.some(t=>t.runId===e)?He({requestId:crypto.randomUUID(),runId:e,intent:`remove-worktree`}):u(e),onSuccess:(t,n)=>{d(),`operation`in t?(i({id:t.operation.id,title:e.data?.worktrees.find(e=>e.runId===n)?.title??n}),G(`Cleanup requested. The worktree remains until cleanup and removal complete.`)):G(`Worktree removed`)},onError:e=>G(e.message,{tone:`danger`})}),m=B({mutationFn:e=>He({requestId:crypto.randomUUID(),worktreeId:e,intent:`orphan`}),onSuccess:e=>{i({id:e.operation.id,title:`Orphan worktree`}),d(),G(`Orphan cleanup requested. Review its progress below.`)},onError:e=>G(e.message,{tone:`danger`})});if(e.isPending)return(0,X.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,X.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:h,totalBytes:g,keep:_}=e.data,v=f.isPending||p.isPending||m.isPending;return(0,X.jsxs)(`div`,{"data-slot":`worktrees-panel`,className:`flex flex-col gap-3`,children:[h.length===0?(0,X.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`text-[13px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,X.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,X.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,X.jsx)(`caption`,{className:`sr-only`,children:`Task worktrees currently materialized on disk`}),(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Task`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Size`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Age`}),(0,X.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,X.jsx)(`tbody`,{children:h.map(e=>(0,X.jsx)(Yy,{worktree:e,lifecycle:a.find(t=>t.runId===e.runId),disabled:v||!!a.find(t=>t.runId===e.runId)?.operation,onDelete:()=>l({kind:`delete`,runId:e.runId,title:e.title})},e.runId))})]})}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(`p`,{"data-slot":`worktrees-footer`,className:`text-[12px] text-soft-foreground`,children:[h.length,` worktree`,h.length===1?``:`s`,g===null?` · size unavailable`:` · ${ot(g)||`0 kB`} on disk`,` · `,_===0?`keeping all (unlimited)`:`keeping the last ${_}`]}),(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`worktrees-reclaim-now`,disabled:v,onClick:()=>l({kind:`reclaim`}),children:`Reclaim now`})]}),t.isError&&(0,X.jsxs)(`p`,{className:`text-xs text-danger`,role:`alert`,children:[`Lifecycle state could not be loaded: `,t.error.message]}),a.filter(e=>e.operation||e.autoCleanupSuppressed||e.needsAttention||!e.task).map(e=>(0,X.jsxs)(`section`,{className:`min-w-0 rounded-md border border-border p-3`,"data-slot":`lifecycle-worktree-row`,children:[(0,X.jsx)(`h3`,{className:`text-sm font-medium`,children:e.task?.title??`Orphan worktree ${e.runId.slice(0,8)}`}),(0,X.jsx)(`p`,{className:`break-all font-mono text-[11px] text-muted-foreground`,children:e.worktreePath}),e.error&&(0,X.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e.error}),e.needsAttention&&(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-danger`,children:[e.operation?.phase===`setup`?`Setup needs attention`:`Cleanup needs attention`,` — worktree retained.`]}),e.autoCleanupSuppressed&&(0,X.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Automatic cleanup is suppressed for this generation because it was kept or cancelled. Explicit removal is still available.`}),e.operation?(0,X.jsx)(`div`,{id:`lifecycle-operation-${e.operation.id}`,className:`mt-3 scroll-mt-4`,children:(0,X.jsx)(To,{operationId:e.operation.id,worktreePath:e.worktreePath,taskTitle:e.task?.title})}):!e.task&&!e.error&&e.onDisk?(0,X.jsx)(W,{className:`mt-2`,type:`button`,variant:`outline`,size:`sm`,disabled:v,onClick:()=>l({kind:`orphan`,worktreeId:e.worktreeId,title:e.worktreePath}),children:`Remove orphan worktree`}):null]},e.worktreeId)),r&&!a.some(e=>e.operation?.id===r.id)&&(0,X.jsx)(`div`,{id:`lifecycle-operation-${r.id}`,children:(0,X.jsx)(To,{operationId:r.id,taskTitle:r.title})}),(0,X.jsx)(As,{open:c!==null,onOpenChange:e=>!e&&l(null),children:(0,X.jsxs)(Ts,{children:[(0,X.jsxs)(ks,{children:[(0,X.jsx)(ws,{children:c?.kind===`delete`||c?.kind===`orphan`?`Delete this worktree?`:`Reclaim old worktrees?`}),(0,X.jsx)(Cs,{children:c?.kind===`delete`||c?.kind===`orphan`?(0,X.jsxs)(X.Fragment,{children:[`This removes the worktree directory and its branch — the local-only work is not recoverable afterwards. Configured cleanup scripts run first; failures retain the directory for your recovery choice.`,(0,X.jsx)(`span`,{className:`mt-1 block truncate font-medium text-foreground`,title:c.title,children:c.title})]}):`Finished worktrees beyond the keep-limit are reclaimed now (directory only). Their branches are kept, so the work stays recoverable.`})]}),(0,X.jsxs)(Ds,{children:[(0,X.jsx)(Os,{children:`Keep it`}),(0,X.jsx)(Es,{"data-action":`worktrees-confirm`,className:c?.kind===`delete`||c?.kind===`orphan`?`bg-danger text-danger-foreground hover:brightness-[0.96]`:void 0,onClick:()=>{c?.kind===`reclaim`?f.mutate():c?.kind===`delete`?p.mutate(c.runId):c?.kind===`orphan`&&m.mutate(c.worktreeId),l(null)},children:c?.kind===`delete`||c?.kind===`orphan`?`Delete`:`Reclaim now`})]})]})})]})}function Yy({worktree:e,lifecycle:t,disabled:n,onDelete:r}){return(0,X.jsxs)(`tr`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`border-b border-border last:border-0`,children:[(0,X.jsxs)(`th`,{scope:`row`,className:`max-w-[220px] px-3 py-2 text-left font-normal`,children:[(0,X.jsx)(`span`,{className:`block truncate text-foreground`,title:e.title,children:e.title}),(0,X.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-soft-foreground`,children:e.branch??e.runId.slice(0,8)})]}),(0,X.jsxs)(`td`,{className:`px-3 py-2`,children:[(0,X.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:e.status}),t?.needsAttention&&(0,X.jsx)(`span`,{className:`block text-[11px] text-danger`,children:t.operation?.phase===`setup`?`Setup needs attention`:`Cleanup needs attention`}),t?.autoCleanupSuppressed&&(0,X.jsx)(`span`,{className:`block text-[11px] text-muted-foreground`,children:`Automatic cleanup suppressed`}),e.reclaimable&&!t?.autoCleanupSuppressed?(0,X.jsx)(`span`,{"data-slot":`worktree-reclaimable`,className:`ml-1 text-[11px] text-soft-foreground`,children:`(reclaimable)`}):null]}),(0,X.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:e.sizeBytes===null?`—`:ot(e.sizeBytes)||`0 kB`}),(0,X.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:Ls(e.finishedAt??void 0)||`—`}),(0,X.jsx)(`td`,{className:`px-3 py-2 text-right`,children:(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`worktree-delete`,"aria-label":`Delete the worktree for ${e.title}`,disabled:n,onClick:r,children:`Delete`})})]})}var Xy=()=>({afterCreate:[],beforeRemove:[]}),Zy=[`afterCreate`,`beforeRemove`],Qy={afterCreate:`After worktree creation`,beforeRemove:`Before worktree removal`},$y=[[`root_path`,`The selected project’s root directory`],[`worktree_path`,`The isolated worktree directory`],[`worktree_id`,`Stable cez-prefixed resource identity`],[`task_id`,`The original task ID`]],eb=`w-full rounded-md border border-input bg-card px-3 py-2 text-sm outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`;function tb({config:e}){let t=V(),n=z.config,r=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>(r.current=!0,()=>{r.current=!1}),[]);let i=_r(),[a,o]=(0,Y.useState)(e.worktreeLifecycle??Xy()),[s,c]=(0,Y.useState)(e.worktreeLifecycle??Xy()),[l,u]=(0,Y.useState)(e.worktreeLifecycleRevision??null),[d,f]=(0,Y.useState)({}),[p,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(``),[_,v]=(0,Y.useState)({}),[y,b]=(0,Y.useState)(null),x=(0,Y.useRef)(new Map),S=(0,Y.useRef)({draft:a,previewWorktree:h});S.current={draft:a,previewWorktree:h};let C=JSON.stringify(a)!==JSON.stringify(s);(0,Y.useEffect)(()=>{if(C)return;let t=e.worktreeLifecycle??Xy();o(t),c(t),u(e.worktreeLifecycleRevision??null)},[e.worktreeLifecycle,e.worktreeLifecycleRevision,C]);let w=(e,t,n)=>{o(r=>({...r,[e]:r[e].map(e=>e.id===t?{...e,...n}:e)})),f(e=>({...e,[t]:``})),m(``),v(e=>{let n={...e};return delete n[t],n})},T=(e,t,n)=>{let r=x.current.get(t.id),i=r?.selectionStart??t.command.length,a=r?.selectionEnd??i,o=`{{ ${n} }}`;w(e,t.id,{command:t.command.slice(0,i)+o+t.command.slice(a)}),requestAnimationFrame(()=>{r?.focus(),r?.setSelectionRange(i+o.length,i+o.length)})},E=(e,t,n)=>{o(r=>{let i=[...r[e]],a=i.splice(t,1)[0];return i.splice(t+n,0,a),{...r,[e]:i}}),m(``)},D=async e=>{b(e.id);try{let t=await xt({command:e.command,...h?{worktreeId:h}:{}}),n=Zy.flatMap(e=>S.current.draft[e]).find(t=>t.id===e.id);if(!r.current||n?.command!==e.command||S.current.previewWorktree!==h)return;v(n=>({...n,[e.id]:t})),f(t=>({...t,[e.id]:``}))}catch(t){f(n=>({...n,[e.id]:t instanceof Error?t.message:`Preview failed`}))}finally{b(null)}},O=B({mutationFn:async()=>{f({}),m(``);let e=Mn.safeParse(a);if(!e.success){let t={};for(let n of e.error.issues){let e=n.path[0],r=typeof n.path[1]==`number`?a[e]?.[n.path[1]]?.id:void 0;t[r??`form`]=n.message}throw f(t),Error(`Check the highlighted commands before saving.`)}for(let t of Zy)for(let n of e.data[t]){if(!r.current)throw Error(`Settings closed; saving cancelled.`);try{await xt({command:n.command})}catch(e){throw f({[n.id]:e instanceof Error?e.message:`Invalid template`}),Error(`Check the highlighted command before saving.`)}}if(!r.current)throw Error(`Settings closed; saving cancelled.`);return Ze({worktreeLifecycle:e.data,worktreeLifecycleRevision:l})},onSuccess:e=>{let r=e.worktreeLifecycle??Xy();c(r),o(r),u(e.worktreeLifecycleRevision??null),t.setQueryData(n,e),m(`Saved. Retry uses these commands. Saving does not restart paused scripts.`)}}),k=async()=>{try{let e=await ge();t.setQueryData(n,e);let r=e.worktreeLifecycle??Xy();o(r),c(r),u(e.worktreeLifecycleRevision??null),f({}),v({}),m(`Loaded saved scripts.`),O.reset()}catch(e){f({form:e instanceof Error?e.message:`Settings could not be loaded`})}},A=i.data?.worktrees.filter(e=>e.operation&&e.needsAttention)??[];return(0,X.jsxs)(`div`,{id:`worktree-lifecycle-scripts`,className:`flex min-w-0 flex-col gap-5`,"data-slot":`worktree-lifecycle-editor`,children:[(0,X.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/30 p-3 text-[13px] text-muted-foreground`,children:[(0,X.jsx)(`p`,{children:`Scripts apply only to this project. Saving commands opts in to running them as the Cezar host user, with that user’s local privileges.`}),(0,X.jsx)(`p`,{className:`mt-1`,children:`Runtime: noninteractive Bash, in the isolated worktree directory. Bash must be installed on the host. Commands run in order; the default timeout is 30 minutes.`}),(0,X.jsxs)(`p`,{className:`mt-1`,id:`lifecycle-variable-help`,children:[`Values are shell-escaped; do not wrap variable tokens in quotes. Use `,(0,X.jsx)(`code`,{children:`\\{{`}),` for literal double braces, for example `,(0,X.jsx)(`code`,{children:`docker inspect --format '\\{{.State.Status}}' container`}),`.`]})]}),(0,X.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[`Preview context`,(0,X.jsxs)(`select`,{value:h,className:eb,onChange:e=>{g(e.target.value),v({})},children:[(0,X.jsx)(`option`,{value:``,children:`Example values (illustrative)`}),i.data?.worktrees.filter(e=>e.onDisk).map(e=>(0,X.jsx)(`option`,{value:e.worktreeId,children:e.task?.title??`Orphan ${e.runId.slice(0,8)}`},e.worktreeId))]})]}),Zy.map(e=>(0,X.jsxs)($,{title:Qy[e],hint:e===`afterCreate`?`Run after a worktree is created and before its agent starts, including recreation after reclamation.`:`Run while the worktree files still exist, before removal or reclamation. Failure retains the directory for recovery.`,children:[a[e].length===0&&(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No commands. This phase completes without running a script.`}),a[e].map((t,n)=>(0,X.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-2 rounded-md border border-border p-3`,disabled:O.isPending,children:[(0,X.jsxs)(`legend`,{className:`px-1 text-xs font-medium`,children:[`Command `,n+1]}),(0,X.jsx)(`label`,{className:`text-xs`,htmlFor:`lifecycle-name-${t.id}`,children:`Display name (optional)`}),(0,X.jsx)(`input`,{id:`lifecycle-name-${t.id}`,className:eb,value:t.name??``,maxLength:120,onChange:n=>w(e,t.id,{name:n.target.value})}),(0,X.jsxs)(`label`,{className:`text-xs`,htmlFor:`lifecycle-command-${t.id}`,children:[Qy[e],` — command `,n+1]}),(0,X.jsx)(`textarea`,{id:`lifecycle-command-${t.id}`,ref:e=>{e?x.current.set(t.id,e):x.current.delete(t.id)},className:`${eb} min-h-24 resize-y font-mono text-xs`,value:t.command,maxLength:32*1024,spellCheck:!1,"aria-describedby":`lifecycle-variable-help${d[t.id]?` lifecycle-error-${t.id}`:``}`,"aria-invalid":!!d[t.id],onChange:n=>w(e,t.id,{command:n.target.value})}),d[t.id]&&(0,X.jsx)(`p`,{id:`lifecycle-error-${t.id}`,className:`text-xs text-danger`,role:`alert`,children:d[t.id]}),(0,X.jsxs)(`details`,{className:`text-xs`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer py-1`,children:`Variables`}),(0,X.jsx)(`ul`,{className:`mt-1 space-y-2`,children:$y.map(([r,i])=>(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"aria-label":`Insert ${r} into ${Qy[e].toLowerCase()} command ${n+1}`,onClick:()=>T(e,t,r),children:(0,X.jsx)(`code`,{children:`{{ ${r} }}`})}),(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:i})]},r))})]}),(0,X.jsxs)(`details`,{className:`text-xs`,children:[(0,X.jsx)(`summary`,{className:`cursor-pointer py-1`,children:`Advanced timeout`}),(0,X.jsxs)(`label`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[`Timeout in seconds (1–86,400; blank uses 1,800)`,(0,X.jsx)(`input`,{type:`number`,min:1,max:86400,step:1,className:`${eb} max-w-32`,value:t.timeoutSeconds??``,onChange:n=>w(e,t.id,{timeoutSeconds:n.target.value===``?void 0:Number(n.target.value)})})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,disabled:n===0,"aria-label":`Move ${Qy[e].toLowerCase()} command ${n+1} up`,onClick:()=>E(e,n,-1),children:`Move up`}),(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,disabled:n===a[e].length-1,"aria-label":`Move ${Qy[e].toLowerCase()} command ${n+1} down`,onClick:()=>E(e,n,1),children:`Move down`}),(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":`Remove ${Qy[e].toLowerCase()} command ${n+1}`,onClick:()=>{o(n=>({...n,[e]:n[e].filter(e=>e.id!==t.id)})),m(``)},children:`Remove`}),(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,disabled:!t.command.trim()||y!==null,"aria-label":`Preview ${Qy[e].toLowerCase()} command ${n+1}`,onClick:()=>void D(t),children:y===t.id?`Previewing…`:`Preview`})]}),_[t.id]&&(0,X.jsxs)(`div`,{className:`min-w-0 rounded bg-muted p-2 text-xs`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:_[t.id].illustrative?`Example preview — illustrative values`:`Selected worktree preview`}),(0,X.jsxs)(`p`,{className:`break-all text-muted-foreground`,children:[`Working directory: `,_[t.id].cwd]}),(0,X.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-all`,children:_[t.id].renderedCommand}),(0,X.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Preview does not execute commands or expand shell expressions.`})]})]},t.id)),(0,X.jsxs)(W,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,disabled:a[e].length>=32||O.isPending,onClick:()=>{o(t=>({...t,[e]:[...t[e],{id:crypto.randomUUID(),command:``}]})),m(``)},children:[`Add `,e===`afterCreate`?`setup`:`cleanup`,` command`]})]},e)),(d.form||O.error)&&(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:d.form??O.error?.message}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(W,{type:`button`,disabled:!C||O.isPending,onClick:()=>O.mutate(),children:O.isPending?`Saving…`:`Save scripts`}),O.isError&&(0,X.jsx)(W,{type:`button`,variant:`outline`,onClick:()=>void k(),children:`Reload saved scripts`})]}),p&&(0,X.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:p}),A.length>0&&(0,X.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[(0,X.jsx)(`p`,{children:`Paused scripts wait for an explicit recovery choice.`}),A.map(e=>(0,X.jsxs)(`a`,{className:`mt-1 block text-primary underline`,href:`#lifecycle-operation-${e.operation.id}`,children:[`Return to `,e.task?.title??`orphan worktree`,` and Retry`]},e.worktreeId))]})]})}var nb=0,rb=1e3;function ib(){let e=yt();return e.isPending?(0,X.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,X.jsx)(J,{icon:(0,X.jsx)(uc,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,X.jsx)(ab,{config:e.data})}function ab({config:e}){let t=V(),n=B({mutationFn:e=>Ze(e),onSuccess:e=>t.setQueryData(z.config,e),onError:e=>G(e.message,{tone:`danger`})}),[r,i]=(0,Y.useState)(String(e.worktreeRetention)),a=Number(r),o=r.trim()===``||!Number.isInteger(a)||a<nb||a>rb,s=e.worktreeRetention===(o?-1:a);return(0,X.jsxs)(`div`,{"data-slot":`worktrees-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsxs)($,{title:`Keep last N worktrees`,hint:`Older finished worktrees are reclaimed to free disk; their branch is kept so the work stays recoverable. 0 = unlimited. In-review and running tasks are never reclaimed, so the count on disk can exceed this.`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:nb,max:rb,step:1,"aria-label":`Keep last N finished worktrees`,"data-slot":`resources-worktree-retention`,value:r,disabled:n.isPending,onChange:e=>i(e.target.value),className:`block w-32 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`worktrees`}),(0,X.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`resources-save-retention`,disabled:s||o||n.isPending,onClick:()=>n.mutate({worktreeRetention:a},{onSuccess:()=>{t.invalidateQueries({queryKey:z.worktrees}),G(a===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${a} finished worktree${a===1?``:`s`}`)}}),children:`Save`})]}),o?(0,X.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,nb,` to `,rb,` (0 = unlimited).`]}):(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:a===0?`Keeping every finished worktree.`:`Keeping the last ${a} finished worktree${a===1?``:`s`} on disk.`})]}),(0,X.jsx)(tb,{config:e}),(0,X.jsx)($,{title:`Worktrees`,hint:`Task worktrees currently on disk. Delete one to reclaim its space now, or reclaim everything past the keep-limit at once. Reclamation keeps branches; deleting a worktree also deletes its managed branch.`,children:(0,X.jsx)(Jy,{})})]})}function ob(){let e=g(),t=Te(),n=V(),[r,i]=(0,Y.useState)(`jira`),[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(``),p=()=>{f(``),u(``),c(``),o(null)};(0,Y.useEffect)(()=>{p(),_(!1),x(null)},[xn()]);let[h,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(null),S=yn(r,v,h),C=S.data?.pages??[],w=C.find(e=>e.available)?.available?C.find(e=>e.available).source:void 0,T=(0,Y.useMemo)(()=>C.flatMap(e=>e.available?e.candidates:[]),[C]);(0,Y.useEffect)(()=>{_(!1),x(null),p()},[e.data?.connection?.id]);let E=C.find(e=>!e.available),D=async e=>{await n.invalidateQueries({queryKey:z.tracker.allFor(e)}),await n.invalidateQueries({queryKey:R.projects})},O=B({mutationFn:async()=>{if(!b||!w)throw Error(`Choose a tracker project first.`);let t=xn(),n=z.tracker.associationFor(t);return{...await m({kind:r,sourceId:w.id,externalId:b.id,...e.data?.connection?{connectionId:e.data.connection.id}:{}}),projectId:t,associationKey:n}},onSuccess:async e=>{await Promise.all([n.cancelQueries({queryKey:z.tracker.allFor(e.projectId)}),n.cancelQueries({queryKey:R.projects})]),n.setQueryData(e.associationKey,{association:e.association}),_(!1),x(null),await D(e.projectId),G(`${e.association.externalName} connected`)},onError:e=>G(e.message,{tone:`danger`})}),k=B({mutationFn:async()=>{let e=xn(),t=z.tracker.associationFor(e);return{...await tn(),projectId:e,associationKey:t}},onSuccess:async e=>{await Promise.all([n.cancelQueries({queryKey:z.tracker.allFor(e.projectId)}),n.cancelQueries({queryKey:R.projects})]),n.setQueryData(e.associationKey,{association:null}),await D(e.projectId),G(`Tracker disconnected`)},onError:e=>G(e.message,{tone:`danger`})}),A=B({onMutate:()=>xn(),mutationFn:async()=>{let e=xn();if(!a)throw Error(`Choose a provider.`);return{...await ze(a===`jira`?{kind:`jira`,origin:s.trim(),email:l.trim(),token:d}:{kind:`linear`,key:d}),projectId:e}},onSuccess:async e=>{xn()===e.projectId&&(p(),_(!1),x(null)),await n.cancelQueries({queryKey:z.tracker.allFor(e.projectId)}),n.setQueryData([`tracker`,e.projectId,`connection`],{connection:e.connection,demo:e.demo}),await D(e.projectId),G(`Credentials saved for this project. Browse and connect a scope.`)},onError:(e,t,n)=>{xn()===n&&f(``),G(e.message,{tone:`danger`})}}),j=B({mutationFn:async()=>{let e=xn();return await oe(),e},onSuccess:async e=>{xn()===e&&(p(),_(!1),x(null)),await n.cancelQueries({queryKey:z.tracker.allFor(e)}),n.setQueryData([`tracker`,e,`connection`],{connection:null,demo:!1}),await D(e),G(`Project credentials removed`)},onError:e=>G(e.message,{tone:`danger`})}),M=A.isPending||j.isPending,N=t.data?.association,P=e.data?.connection,F=!!N&&(e.data?.demo===!0||!!P&&P.kind===N.kind&&P.id===N.connectionId);return t.isPending?(0,X.jsx)(`p`,{className:`p-6 text-sm text-muted-foreground`,children:`Loading tracker settings…`}):t.isError?(0,X.jsx)(`p`,{className:`p-6 text-sm text-danger`,children:t.error.message}):(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-6 p-4 md:p-6`,"data-slot":`tracker-settings`,children:[(0,X.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Issue tracker`}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Connect a project or team from your issue tracker. Credentials belong only to this project and are stored locally outside the repository. Server-wide environment keys are not used.`}),F&&t.data.association?(0,X.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 rounded-md border border-border p-3`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium`,children:t.data.association.externalName}),(0,X.jsxs)(`a`,{className:`inline-flex items-center gap-1 text-xs text-violet hover:underline`,href:t.data.association.source.webUrl,target:`_blank`,rel:`noreferrer`,children:[Bc[t.data.association.kind].label,` `,(0,X.jsx)(as,{className:`size-3`})]})]}),(0,X.jsxs)(W,{variant:`outline`,onClick:()=>k.mutate(),disabled:k.isPending,children:[(0,X.jsx)(zc,{className:`size-3.5`}),` Disconnect`]})]}):(0,X.jsx)(`p`,{className:`mt-4 text-sm font-medium`,children:e.isPending?`Loading connection…`:e.isError?`Connection status unavailable.`:`No tracker connected.`})]}),N&&P&&!e.isError&&!e.data?.demo&&!F?(0,X.jsx)(`p`,{className:`text-sm text-warning`,children:`This scope needs reconnection with this project's credentials. Configure a connection, then browse and select its scope again.`}):null,e.data?.error?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e.data.error}):null,(0,X.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`For local credential cleanup, run `,(0,X.jsx)(`code`,{children:`cez tracker-connections list`}),`, then `,(0,X.jsx)(`code`,{children:`cez tracker-connections remove <id>`}),`. Local deletion does not revoke the vendor token.`]}),e.isError?(0,X.jsxs)(`p`,{className:`text-sm text-danger`,children:[`Could not load project connection. `,(0,X.jsx)(`button`,{onClick:()=>void e.refetch(),children:`Retry`})]}):null,(0,X.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Connect a provider`}),(0,X.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:Vc.map(t=>{let n=!e.isError&&(e.data?.demo===!0||e.data?.connection?.kind===t.kind);return(0,X.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:t.label}),e.data?.demo?null:(0,X.jsxs)(W,{variant:`outline`,disabled:M||e.isPending||e.isError,onClick:()=>{p(),o(t.kind),_(!1),x(null)},children:[e.data?.connection?.kind===t.kind?`Replace`:`Configure`,` `,t.label,` credentials`]}),(0,X.jsxs)(W,{className:`mt-3`,variant:`outline`,disabled:!n||M,onClick:()=>{i(t.kind),_(!0),y(``),x(null)},children:[(0,X.jsx)(ua,{className:`size-3.5`}),` Browse `,t.label]}),n?null:(0,X.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Configure credentials for this project to browse.`})]},t.kind)})})]}),e.data?.connection?(0,X.jsx)(W,{variant:`outline`,disabled:M,onClick:()=>j.mutate(),children:`Remove project credentials`}):null,a?(0,X.jsxs)(`form`,{className:`rounded-lg border border-border bg-card p-4`,onSubmit:e=>{e.preventDefault(),A.mutate()},autoComplete:`off`,children:[(0,X.jsxs)(`h2`,{className:`font-medium`,children:[Bc[a].label,` credentials for this project`]}),(0,X.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Saved in a private .env file for this project, without encryption. Use read-only access limited to this project's data. Saving replaces this project's connection and requires selecting its scope again.`}),a===`jira`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Jira site URL`,(0,X.jsx)(`input`,{"aria-label":`Jira site URL`,type:`url`,required:!0,value:s,onChange:e=>c(e.target.value),placeholder:`https://your-site.atlassian.net`,className:`mt-1 block w-full rounded border bg-background p-2`})]}),(0,X.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Account email`,(0,X.jsx)(`input`,{"aria-label":`Account email`,type:`email`,required:!0,value:l,onChange:e=>u(e.target.value),className:`mt-1 block w-full rounded border bg-background p-2`})]})]}):null,(0,X.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`API token`,(0,X.jsx)(`input`,{"aria-label":`API token`,type:`password`,autoComplete:`new-password`,required:!0,maxLength:8192,value:d,onChange:e=>f(e.target.value),className:`mt-1 block w-full rounded border bg-background p-2`})]}),(0,X.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,X.jsx)(W,{type:`submit`,disabled:M,children:`Save project credentials`}),(0,X.jsx)(W,{type:`button`,variant:`outline`,disabled:M,onClick:p,children:`Cancel`})]})]}):null,h?(0,X.jsxs)(`section`,{className:`rounded-lg border border-violet/40 bg-card p-4`,"aria-label":`${Bc[r].label} picker`,children:[(0,X.jsxs)(`label`,{className:`text-xs font-medium`,htmlFor:`tracker-candidate-search`,children:[`Search `,Bc[r].scopeLabel]}),(0,X.jsx)(`input`,{id:`tracker-candidate-search`,className:`mt-2 h-9 w-full rounded-md border border-border bg-background px-3 text-sm`,value:v,onChange:e=>{y(e.target.value),x(null)},placeholder:`Search by name…`}),(0,X.jsxs)(`div`,{className:`mt-3 max-h-64 space-y-1 overflow-auto`,children:[S.isPending?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`}):null,S.isError?(0,X.jsx)(sb,{reason:S.error.message,generation:S.errorUpdatedAt,retry:()=>void S.refetch()}):null,E&&!E.available?(0,X.jsx)(sb,{reason:E.reason,generation:S.dataUpdatedAt,retryAfterSeconds:E.code===`rate_limited`?E.retryAfterSeconds:void 0,retry:()=>void S.refetch()}):null,T.map(e=>(0,X.jsx)(`button`,{type:`button`,className:`block w-full rounded-md border px-3 py-2 text-left text-sm ${b?.id===e.id?`border-violet bg-violet/10`:`border-border`}`,onClick:()=>x(e),children:e.name},e.id)),!S.isPending&&!S.isError&&!E&&T.length===0?(0,X.jsx)(`p`,{className:`py-3 text-sm text-muted-foreground`,children:`No projects or teams match.`}):null,S.hasNextPage?(0,X.jsx)(W,{variant:`ghost`,onClick:()=>void S.fetchNextPage(),disabled:S.isFetchingNextPage,children:`Load more`}):null]}),(0,X.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,X.jsx)(W,{variant:`contrast`,disabled:!b||O.isPending||M,onClick:()=>O.mutate(),children:`Connect`}),(0,X.jsx)(W,{variant:`ghost`,onClick:()=>_(!1),children:`Cancel`})]})]}):null]})}function sb({reason:e,retry:t,retryAfterSeconds:n=0,generation:r}){let[i,a]=(0,Y.useState)(n);return(0,Y.useEffect)(()=>a(n),[e,n,r]),(0,Y.useEffect)(()=>{if(i<=0)return;let e=window.setInterval(()=>a(e=>Math.max(0,e-1)),1e3);return()=>window.clearInterval(e)},[i>0]),(0,X.jsxs)(`div`,{className:`rounded-md border border-danger/30 bg-danger/5 p-3 text-sm`,children:[(0,X.jsx)(`p`,{className:`text-danger`,children:e}),(0,X.jsx)(W,{className:`mt-2`,variant:`outline`,disabled:i>0,onClick:t,children:i>0?`Retry in ${i}s`:`Retry`})]})}var cb={checks:`Check steps (workflow commands)`,cezar:`cezar itself (its own features — not the agents)`};function lb(e){return e===`keychain`?`Encrypted with a data key kept in your OS keychain.`:`Encrypted with a data key in ~/.cezar/secrets/.key (0600) — no OS keychain is available on this machine, so this is a private file, not a vault.`}function ub({scope:e,list:t,save:n,remove:r,invalidate:i}){let a=V(),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)([`checks`]),[f,p]=(0,Y.useState)(null),m=o===``?null:Sn(o),h=B({mutationFn:async()=>{let e=xn();return await n(o,{value:c,audiences:u}),{projectId:e,saved:o}},onSuccess:async({projectId:e,saved:t})=>{xn()===e&&(s(``),l(``),p(null)),await i(a,e),G(`${t} saved`)},onError:e=>p(e.message)}),g=B({mutationFn:async e=>{let t=xn();return await r(e),{projectId:t,removed:e}},onSuccess:async({projectId:e,removed:t})=>{await i(a,e),G(`${t} removed`)},onError:e=>G(e.message,{tone:`danger`})}),_=()=>{let e=Sn(o);if(e){p(e);return}if(u.length===0){p(`pick at least one audience`);return}p(null),h.mutate()},v=e=>d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),y=e===`project`?`Project secrets`:`Workspace secrets`,b=e===`project`?`Values for this project only — an e2e runner’s model key, a staging login. They reach the audiences you pick and never an agent session.`:`Values shared by every project on this machine — a key cezar’s own features use, a token every project’s checks need. A project secret of the same name wins. They never reach an agent session.`,x=t.data?.secrets??[];return(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-6 p-4 md:p-6`,"data-slot":`secrets-settings`,"data-scope":e,children:[(0,X.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:y}),(0,X.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:b}),t.isPending?(0,X.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:`Loading…`}):null,t.isError?(0,X.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:t.error?.message}):null,t.data&&x.length===0?(0,X.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:`No secrets stored.`}):null,t.data&&x.length>0?(0,X.jsx)(`ul`,{className:`mt-4 divide-y divide-border rounded-md border border-border`,"aria-label":`Stored ${e} secrets`,children:x.map(e=>(0,X.jsxs)(`li`,{className:`flex items-center justify-between gap-3 px-3 py-2`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`code`,{className:`text-sm`,children:e.name}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.audiences.map(e=>cb[e].split(` (`)[0]).join(` · `)})]}),(0,X.jsxs)(W,{variant:`outline`,"aria-label":`Delete ${e.name}`,disabled:g.isPending,onClick:()=>g.mutate(e.name),children:[(0,X.jsx)(No,{className:`size-3.5`}),` Delete`]})]},e.name))}):null,t.data?(0,X.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,"data-slot":`key-backend`,children:lb(t.data.keyBackend)}):null]}),(0,X.jsxs)(`form`,{className:`rounded-lg border border-border bg-card p-4`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),_()},children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Add or replace a secret`}),(0,X.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Name`,(0,X.jsx)(`input`,{"aria-label":`Name`,value:o,onChange:e=>{s(e.target.value.toUpperCase()),p(null)},autoComplete:`off`,spellCheck:!1,placeholder:`AI_GATEWAY_API_KEY`,"aria-invalid":m?!0:void 0,className:`mt-1 block w-full rounded border border-border bg-background p-2 font-mono`})]}),m?(0,X.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:m}):null,(0,X.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Value`,(0,X.jsx)(`input`,{"aria-label":`Value`,type:`password`,autoComplete:`off`,required:!0,value:c,onChange:e=>l(e.target.value),className:`mt-1 block w-full rounded border border-border bg-background p-2`})]}),(0,X.jsxs)(`fieldset`,{className:`mt-3`,children:[(0,X.jsx)(`legend`,{className:`text-sm`,children:`Who may read it`}),Jn.map(e=>(0,X.jsxs)(`label`,{className:`mt-1 flex items-center gap-2 text-sm`,children:[(0,X.jsx)(`input`,{type:`checkbox`,"aria-label":cb[e],checked:u.includes(e),onChange:()=>v(e)}),cb[e]]},e)),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Agents are never an audience: a secret cannot be handed to a Claude Code, Codex or OpenCode session.`})]}),f&&f!==m?(0,X.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:f}):null,(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsx)(W,{type:`submit`,disabled:h.isPending||o===``||c===``||u.length===0||!!m,children:`Save secret`})})]})]})}function db(){return(0,X.jsx)(ub,{scope:`project`,list:Be(),save:vn,remove:Mt,invalidate:(e,t)=>e.invalidateQueries({queryKey:z.secrets.allFor(t??``)})})}function fb(){return(0,X.jsx)(ub,{scope:`workspace`,list:qe(),save:Ie,remove:ue,invalidate:e=>e.invalidateQueries({queryKey:R.secrets})})}var pb=`/assets/tester-army-tUUSV6JM.png`,mb=`https://github.com/tester-army/e2e`,hb={AI_GATEWAY_API_KEY:`Vercel AI Gateway`,OPENAI_API_KEY:`OpenAI`,ANTHROPIC_API_KEY:`Anthropic`,OPENROUTER_API_KEY:`OpenRouter`},gb=new Set([`queued`,`running`,`waiting`]);function _b(e,t,n,r){if(gb.has(e))return`Setting up — cezar is installing and configuring e2e in its own worktree.`;let i=r?`its draft PR is ready — merge it to finish.`:`merge ${n?`branch ${n}`:`the setup task’s branch`} to finish.`;return e===`review`?`Ready for review — ${i}`:e===`done`?t?`Setup finished.`:`Setup finished — ${i}`:e===`failed`?`The last setup failed — open the task to see why, then try again.`:`The last setup was cancelled.`}function vb({ok:e,children:t}){return(0,X.jsxs)(`li`,{className:`flex items-center gap-2 text-sm`,"data-ok":e,children:[e?(0,X.jsx)(Fo,{className:`size-4 text-success`,"aria-hidden":!0}):(0,X.jsx)(Tc,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:e?void 0:`text-muted-foreground`,children:t})]})}function yb(){let e=V(),t=Xn(),n=tt(),r=ht(n.data?.setup?.runId),[i,a]=(0,Y.useState)(void 0),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(null),u=r.data?.status??n.data?.setup?.status,d=r.data?.pullRequestUrl&&/^https?:\/\//.test(r.data.pullRequestUrl)?r.data.pullRequestUrl:void 0,f=u!==void 0&&gb.has(u),p=n.data?.credentials??[],m=i??p[0]??`AI_GATEWAY_API_KEY`,h=!!(n.data?.configFile&&n.data.workflow),g=B({mutationFn:async()=>({projectId:xn(),runId:(await Ge(o?{credential:{name:m,value:o}}:{})).runId}),onSuccess:async({projectId:n,runId:r})=>{s(``),l(null),await Promise.all([e.invalidateQueries({queryKey:z.e2e.allFor(n??``)}),e.invalidateQueries({queryKey:z.secrets.allFor(n??``)})]),G(`e2e setup started`),xn()===n&&t($n(n,`/tasks/${r}`))},onError:e=>l(e.message)});return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,"data-slot":`e2e-settings`,children:[(0,X.jsxs)(`section`,{className:`rounded-lg border border-border bg-card p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(`img`,{src:pb,alt:``,width:40,height:40,className:`size-10 shrink-0 rounded-md`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:`TesterArmy e2e`}),(0,X.jsx)(`span`,{"data-slot":`e2e-badge`,"data-state":f?`setting-up`:h?`installed`:`none`,className:h&&!f?`rounded-full bg-success/10 px-2 py-0.5 text-xs font-medium text-success`:`rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:f?`Setting up`:h?`Installed`:`Not set up`})]}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Agentic browser end-to-end testing`})]}),(0,X.jsxs)(`a`,{href:mb,target:`_blank`,rel:`noreferrer`,className:`inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline`,children:[`tester-army/e2e `,(0,X.jsx)(as,{className:`size-3`,"aria-hidden":!0})]})]}),(0,X.jsxs)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:[`cezar installs it for this project, points it at your dev server, writes a smoke test and an`,` `,(0,X.jsx)(`code`,{children:`implement-and-e2e`}),` workflow, proves it all passes in a real browser and opens a draft PR for you to merge.`]}),n.isPending?(0,X.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:`Loading…`}):null,n.isError?(0,X.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-danger`,children:n.error.message}):null,n.data?(0,X.jsxs)(`ul`,{className:`mt-4 flex flex-col gap-1.5`,"aria-label":`e2e status`,children:[(0,X.jsx)(vb,{ok:!!n.data.configFile,children:n.data.configFile?(0,X.jsxs)(X.Fragment,{children:[`Configured (`,(0,X.jsx)(`code`,{children:n.data.configFile}),`)`]}):`Not configured in this checkout`}),(0,X.jsxs)(vb,{ok:n.data.workflow,children:[(0,X.jsx)(`code`,{children:`implement-and-e2e`}),` workflow `,n.data.workflow?`available`:`not added yet`]}),(0,X.jsx)(vb,{ok:p.length>0,children:p.length>0?(0,X.jsxs)(X.Fragment,{children:[`Model key: `,(0,X.jsx)(`code`,{children:p.join(`, `)})]}):`No model key — smoke tests run without one; agent steps need one`})]}):null,n.data?.setup&&u?(0,X.jsxs)(`p`,{className:`mt-3 text-sm`,"data-slot":`e2e-setup-run`,"data-status":u,children:[_b(u,!!n.data.configFile,r.data?.branch,d),` `,d&&!n.data.configFile?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`a`,{className:`underline`,href:d,target:`_blank`,rel:`noreferrer`,children:`Open the draft PR`}),` · `]}):null,(0,X.jsx)(or,{className:`underline`,to:$n(xn(),`/tasks/${n.data.setup.runId}`),children:`Open the setup task`})]}):null]}),(0,X.jsxs)(`form`,{className:`rounded-lg border border-border bg-card p-4`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),g.mutate()},children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold`,children:h?`Set up again`:`Set up e2e`}),(0,X.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Model provider`,(0,X.jsx)(`select`,{"aria-label":`Model provider`,value:m,onChange:e=>a(e.target.value),className:`mt-1 block w-full rounded border border-border bg-background p-2 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:Nn.map(e=>(0,X.jsxs)(`option`,{value:e,children:[hb[e],` (`,e,`)`,p.includes(e)?` — stored`:``]},e))})]}),(0,X.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`API key `,(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`(optional)`}),(0,X.jsx)(`input`,{"aria-label":`API key`,type:`password`,autoComplete:`off`,value:o,onChange:e=>s(e.target.value),placeholder:p.includes(m)?`stored — leave empty to keep it`:``,className:`mt-1 block w-full rounded border border-border bg-background p-2`})]}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Stored encrypted as a project secret for check steps only — never handed to an agent session.`}),c?(0,X.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:c}):null,(0,X.jsx)(`div`,{className:`mt-3`,children:(0,X.jsx)(W,{type:`submit`,disabled:g.isPending||f||!n.data,children:f?`Setup in progress…`:h?`Set up again`:`Set up e2e`})})]})]})}function bb(){return(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 md:p-6`,"data-slot":`integrations-settings`,children:[(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Tools cezar can set up in this project for you — each one as a task you review and merge.`}),(0,X.jsxs)(Ps,{defaultValue:`test-frameworks`,children:[(0,X.jsx)(Ns,{variant:`line`,"data-slot":`integrations-tabs`,children:(0,X.jsx)(js,{value:`test-frameworks`,children:`Test frameworks`})}),(0,X.jsx)(Ms,{value:`test-frameworks`,className:`pt-4`,children:(0,X.jsx)(yb,{})})]})]})}var xb=[{id:`tracker`,title:`Issue tracker`,description:`Connect this project to Jira or Linear.`,icon:Rc,component:ob,scope:`project`},{id:`secrets`,title:`Secrets`,description:`Encrypted values for this project’s check steps and cezar — never for agents.`,icon:vc,component:db,scope:`project`},{id:`integrations`,title:`External integrations`,description:`Third-party tools cezar installs and wires into this project — test frameworks first.`,icon:$s,component:bb,scope:`project`},{id:`agents`,title:`Agents`,description:`Providers, default runner and models.`,icon:jo,component:gv,scope:`project`},{id:`instructions`,title:`Instructions`,description:`What you write for the models: system prompt, branch naming, prompt templates.`,icon:zi,component:Zv,scope:`project`},{id:`tasks`,title:`Tasks`,description:`Base branch, review before finishing, live titles.`,icon:xc,component:Ky,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:lc,component:av,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:uc,component:ib,scope:`project`},{id:`bookmarklets`,title:`Bookmarklets`,description:`Launch skills from a GitHub PR or issue.`,icon:ec,component:ty,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, accent and density.`,icon:Ac,component:Wv,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:Qs,component:cy,scope:`global`},{id:`keyboard`,title:`Keyboard`,description:`Shortcuts for task commands.`,icon:yc,component:$v,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:hc,component:Hy,scope:`global`},{id:`skills`,title:`Skills`,description:`Updates for skills installed on this machine.`,icon:kc,component:Wy,scope:`global`},{id:`workspace-secrets`,title:`Secrets`,description:`Encrypted values shared by every project on this machine — never for agents.`,icon:vc,component:fb,scope:`global`},{id:`accounts`,title:`Agent accounts`,description:`Second logins, and the agent and models a project uses when it has chosen none.`,icon:gc,component:V_,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:mc,component:by,scope:`global`},{id:`privacy`,title:`Privacy`,description:`Whether cezar shares usage data with its maintainers. Off unless you turn it on.`,icon:Pc,component:ly,scope:`global`}];function Sb(e,t){return xb.filter(n=>!n.hidden&&n.scope===e&&!(t?.singleProject===!0&&n.id===`projects`))}function Cb(e){return{global:Sb(`global`,e),project:Sb(`project`,e)}}var wb=null;function Tb(e){_f(e.pathname)||(wb={pathname:e.pathname,search:e.search,hash:e.hash})}function Eb(){return wb}function Db(){let e=dr(),t=A().data;return e===null?null:t?.projects.find(t=>t.id===e)?.root??null}function Ob(e){navigator.clipboard.writeText(e).then(()=>G(`Project folder copied`)).catch(()=>G(e))}function kb(){let e=Db();return e===null?null:(0,X.jsx)($,{title:`Project folder`,hint:`Where this project lives on disk. Every task worktree, git command and agent run resolves against it.`,children:(0,X.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`field`,className:`flex items-start gap-3 rounded-md border border-border bg-card p-3`,children:[(0,X.jsx)(`span`,{"data-slot":`project-location-path`,className:`min-w-0 flex-1 font-mono text-xs break-all text-foreground`,children:e}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,X.jsx)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`Copy the project folder path`,onClick:()=>Ob(e),className:`text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:`Copy`}),(0,X.jsx)(jb,{root:e})]})]})})}function Ab(){let e=Db();return e===null?null:(0,X.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`nav`,className:`mt-auto px-2.5 pt-3`,children:[(0,X.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Project folder`}),(0,X.jsx)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`${e} — click to copy`,onClick:()=>Ob(e),className:`block w-full truncate text-left font-mono text-[11px] text-muted-foreground transition-colors hover:text-foreground`,children:e})]})}function jb({root:e}){let t=we(),n=B({mutationFn:e=>$e(e),onError:e=>G(e.message,{tone:`danger`})}),r=(t.data?.targets??[]).filter(e=>Sa(e.id)===void 0).map(e=>({target:e}));return r.length===0?null:(0,X.jsx)(Pi,{slot:`project-location-open`,label:`Open with`,triggerVariant:`outline`,title:e,disabled:n.isPending,choices:r,onPick:e=>n.mutate(e,{onSuccess:()=>G(`Opening the project folder in ${r.find(t=>t.target.id===e)?.target.label??e}`)})})}function Mb(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function Nb({capabilities:e}){let t=dr(),n=A(),r=I();if(n.isPending)return(0,X.jsx)(`p`,{"data-slot":`project-general-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading project…`});if(n.isError)return(0,X.jsxs)(`p`,{"data-slot":`project-general-error`,className:`text-[13px] text-danger`,children:[`Could not read the project registry — `,n.error.message]});let i=n.data,a=i?.projects.find(e=>e.id===t);if(!i||!a)return null;let o=e?.singleProject!==!0&&a.unregistered!==!0;return(0,X.jsxs)(`div`,{"data-slot":`project-general`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7`,children:[(0,X.jsx)(kb,{}),(0,X.jsx)(Pb,{project:a,canRemove:o}),a.unregistered?(0,X.jsx)($,{title:`Add to your projects`,hint:`cezar is serving this folder because you started it here — starting cezar somewhere new never adds it to your project list for you. Adding it keeps it in the sidebar between runs and gives it a registry entry to hold settings like the task cap. Nothing on disk changes either way.`,children:(0,X.jsx)(Ty,{root:a.root,name:a.name,notAddable:a.notAddable===!0})}):null,o?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{title:`Max parallel tasks`,hint:r.data?`How many of this project's tasks may run at once — leave it empty to inherit the workspace limit. The workspace limit (${r.data.resources.maxParallel}) still applies as an overall ceiling, so a higher value here has no extra effect until that one is raised.`:`How many of this project's tasks may run at once — leave it empty to inherit the workspace limit. The workspace limit still applies as an overall ceiling.`,children:r.data?(0,X.jsx)(Dy,{project:a,workspaceMax:r.data.resources.maxParallel}):(0,X.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading the workspace limit…`})}),(0,X.jsx)(Fb,{project:a,bootProject:i.bootProject})]}):null]})}function Pb({project:e,canRemove:t}){return(0,X.jsx)($,{title:`Project`,hint:`The registry entry for this checkout — re-probed every time the project list is read.`,children:(0,X.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-[8rem_minmax(0,1fr)] gap-x-3 gap-y-1.5 rounded-md border border-border bg-card p-3 text-[13px]`,children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Name`}),(0,X.jsx)(`dd`,{className:`min-w-0 truncate text-foreground`,children:e.name}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Status`}),(0,X.jsxs)(`dd`,{"data-slot":`project-general-status`,className:e.status===`missing`?`text-danger`:`text-foreground`,children:[vy[e.status],e.status===`missing`?t?` — remove it below, or restore the folder`:` — restore the folder at the path above`:null]}),e.branch===void 0?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Branch`}),(0,X.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-xs text-foreground`,children:e.branch})]}),e.unregistered?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`In your projects`}),(0,X.jsx)(`dd`,{"data-slot":`project-general-unregistered`,className:`text-foreground`,children:`No — served because cezar was started here`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Added`}),(0,X.jsxs)(`dd`,{className:`text-foreground`,children:[Mb(e.addedAt),(0,X.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:`Last opened`}),(0,X.jsx)(`dd`,{className:`text-foreground`,children:Mb(e.lastOpenedAt)})]})]})})}function Fb({project:e,bootProject:t}){let[n,r]=(0,Y.useState)(null),i=my(),a=Xn(),o=e.id===t;return(0,X.jsxs)($,{title:`Remove from workspace`,hint:`Unregisters this project so it leaves the sidebar and the project list. Nothing on disk is deleted — the folder, its git history and its task history all stay, and adding it back later finds everything intact.`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsxs)(W,{type:`button`,variant:`outline`,size:`sm`,"data-action":`project-general-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:o?"cezar is serving this project — stop it and use `cezar projects remove`":void 0,disabled:o||i.isPending,onClick:()=>r(e),className:`text-danger`,children:[`Remove `,e.name]}),o?(0,X.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`text-[11px] text-soft-foreground`,children:"cezar is serving this project — stop cezar and run `cezar projects remove` to drop it."}):null]}),(0,X.jsx)(hy,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function Ib(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}var Lb=`/settings/global`;function Rb(e,t){let n=`/p/${encodeURIComponent(e)}/settings`;return t===void 0?n:`${n}/${t}`}function zb(e){let{pathname:t}=mr(),n=A().data,r=Dt().data,i=ir(t),a=n?.bootProject??r?.bootProject??null,o=Y.useMemo(()=>{let e=[...n?.projects??[]].sort((e,t)=>t.lastOpenedAt.localeCompare(e.lastOpenedAt)).map(({id:e,name:t,status:n})=>({id:e,name:t,status:n}));if(i!==null&&!e.some(e=>e.id===i)){let t=i===a?r?.repo?.root.replace(/[\\/]+$/,``).split(/[\\/]/).pop():void 0;e.unshift({id:i,name:t||i,status:`ok`})}return e},[n,r,i,a]),s=o.find(e=>e.id===i)??null,c=s!==null&&(n?.projects??[]).some(e=>e.id===i),l=e?.singleProject===!0||o.length<=1||s!==null&&!c;return{projects:l&&s!==null&&!c?[s]:o,activeProjectId:i,activeProject:s,bootProjectId:a,flat:l}}function Bb(e){let t=Xn();return Y.useCallback(()=>{let n=Eb();if(n!==null){t(n);return}t(e===null?`/`:`/p/${encodeURIComponent(e)}/`)},[t,e])}function Vb(e){Y.useEffect(()=>{let t=t=>{t.key!==`Escape`||t.defaultPrevented||(t.target instanceof Element?t.target:null)?.closest(`input, textarea, select, [contenteditable]`)||document.querySelector(`[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"]`)||e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}var Hb=(e,t=!1)=>U(`flex h-[34px] shrink-0 items-center gap-2.5 rounded-md px-2.5 text-[13.5px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,t&&`h-11`,e&&`bg-muted font-semibold text-foreground`),Ub=Y.createContext(!1);function Wb({children:e}){return(0,X.jsx)(`p`,{className:`shrink-0 px-2.5 pt-1 pb-1 text-[10.5px] font-semibold tracking-wide text-soft-foreground uppercase`,children:e})}function Gb({project:e,sections:t,active:n,activeId:r,indent:i}){let a=Y.useContext(Ub);return(0,X.jsxs)(`div`,{className:U(`flex flex-col gap-0.5`,i&&`mt-0.5 ml-[14px] border-l border-border pl-2`),children:[(0,X.jsxs)(rr,{to:Rb(e.id),end:!0,"data-slot":`settings-project-general`,"data-project":e.id,className:U(Hb(n&&r===null,a),!a&&`h-[30px]`,`text-[13px]`),children:[(0,X.jsx)(Pr,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`General`]}),t.map(t=>{let i=n&&t.id===r;return(0,X.jsxs)(rr,{to:$n(e.id,Ib(`project`,t.id)),"data-project-section":t.id,"data-project":e.id,className:U(Hb(i,a),!a&&`h-[30px]`,`text-[13px]`),children:[(0,X.jsx)(t.icon,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),t.title]},t.id)})]})}function Kb({project:e}){return(0,X.jsx)(`span`,{className:`truncate`,children:e.name})}function qb({project:e,indent:t}){let n=`${e.name} is gone — remove it in Projects`;return(0,X.jsxs)(`div`,{"data-slot":`settings-project`,"data-project":e.id,"data-status":`missing`,title:n,className:`flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-[13px] font-medium opacity-55`,children:[t?(0,X.jsx)(`span`,{className:`w-3 shrink-0`,"aria-hidden":`true`}):null,(0,X.jsx)(`span`,{className:`truncate`,children:e.name}),(0,X.jsx)(`span`,{className:`sr-only`,children:n}),(0,X.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full bg-danger/15 px-[7px] py-px text-[10px] font-medium text-danger`,children:`folder not found`})]})}function Jb({project:e,sections:t,activeProjectId:n,activeId:r,openSectionId:i,onProjectPage:a,expanded:o,onToggle:s}){let c=e.id===n,l=Y.useContext(Ub),u=`settings-project-${Y.useId()}-${e.id}`,d=!c&&a?Rb(e.id,i??void 0):null;return e.status===`missing`?(0,X.jsx)(qb,{project:e,indent:!0}):(0,X.jsxs)(`div`,{"data-slot":`settings-project`,"data-project":e.id,"data-status":e.status,"data-expanded":o?``:void 0,children:[(0,X.jsxs)(`div`,{className:U(`flex items-center rounded-md`,c&&r===null&&`bg-muted`),children:[(0,X.jsx)(`button`,{type:`button`,onClick:s,"aria-expanded":o,"aria-controls":o?u:void 0,"aria-label":`${o?`Collapse`:`Expand`} ${e.name}`,className:U(`flex shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted/60 hover:text-foreground`,l?`size-11`:`size-7`),children:(0,X.jsx)(zo,{"aria-hidden":`true`,className:U(`size-3 transition-transform`,!o&&`-rotate-90`)})}),d===null?(0,X.jsx)(`button`,{type:`button`,onClick:s,"aria-expanded":o,"aria-controls":o?u:void 0,"data-slot":`settings-project-toggle`,className:U(`flex min-w-0 flex-1 items-center gap-1.5 rounded-md py-1.5 pr-2 text-left text-[13px] font-semibold transition-colors`,l&&`min-h-11`,c?`text-foreground`:`text-muted-foreground hover:text-foreground`),children:(0,X.jsx)(Kb,{project:e})}):(0,X.jsx)(or,{to:d,"data-slot":`settings-project-link`,title:`Open ${e.name}'s ${t.find(e=>e.id===i)?.title??`General`}`,className:U(`flex min-w-0 flex-1 items-center gap-1.5 rounded-md py-1.5 pr-2 text-left text-[13px] font-semibold text-muted-foreground transition-colors hover:text-foreground`,l&&`min-h-11`),children:(0,X.jsx)(Kb,{project:e})})]}),o?(0,X.jsx)(`div`,{id:u,children:(0,X.jsx)(Gb,{project:e,sections:t,active:c,activeId:r,indent:!0})}):null]})}function Yb(e){let[t,n]=gp();return(0,X.jsx)(_p,{slot:`settings-sidebar`,width:t,onWidthChange:n,children:(0,X.jsx)(Zb,{...e})})}function Xb({onOpenChange:e,...t}){let{pathname:n}=mr();return Y.useEffect(()=>{e(!1)},[n,e]),Y.useEffect(()=>{let t=window.matchMedia?.(`(min-width: 768px)`);if(!t)return;let n=t=>{t.matches&&e(!1)};return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),(0,X.jsx)(yp,{slot:`settings-mobile-drawer`,title:`Settings navigation`,children:e=>(0,X.jsx)(Zb,{...t,headerAction:e})})}function Zb({scope:e,activeId:t,capabilities:n,tree:r,leave:i,headerAction:a}){let{global:o,project:s}=Cb(n),c=!!a,l=r.activeProjectId,[u,d]=Y.useState({project:l,map:{}}),f=u.project===l?u.map:{},p=e=>f[e]??e===l,m=e=>d(t=>{let n=t.project===l?t.map:{};return{project:l,map:{...n,[e]:!(n[e]??e===l)}}}),h=e===`global`,[g]=r.projects,_=Dt().data,v=_?.version??null,y=_?.latestVersion??null,b=k().data,x=b?.available?b.count??null:null,S=I().data?.branding,C=S?.name??`cezar`,w=S?.logoUrl??null;return(0,X.jsx)(Ub.Provider,{value:c,children:(0,X.jsxs)(`div`,{"data-slot":`settings-sidebar-content`,className:`flex min-h-0 flex-1 flex-col pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-[9px] px-3.5 pt-3.5 pb-2.5`,children:[(0,X.jsx)(Ff,{name:C,logoUrl:w}),(0,X.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`settings-back`,title:`Back (Esc)`,onClick:i,className:U(`-mr-2 ml-auto shrink-0`,c?`h-11`:`h-[26px]`),children:[(0,X.jsx)(Ga,{"aria-hidden":`true`,className:`size-4`}),`Back`]}),a?(0,X.jsx)(`div`,{className:`shrink-0`,children:a}):null]}),(0,X.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav`,"data-scope":e,className:`flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto overscroll-contain px-2.5 py-1.5`,children:[(0,X.jsx)(Wb,{children:`General settings`}),o.map(e=>{let n=h&&e.id===t;return(0,X.jsxs)(rr,{to:Ib(`global`,e.id),"data-section":e.id,className:Hb(n,c),children:[(0,X.jsx)(e.icon,{"aria-hidden":`true`,className:`size-4 shrink-0`}),e.title]},e.id)}),(0,X.jsx)(`p`,{className:`shrink-0 px-2.5 pt-1 pb-2 text-[11px] text-soft-foreground`,children:`Stored in ~/.cezar`}),r.projects.length>0?(0,X.jsx)(`div`,{"data-slot":`settings-project-tree`,className:`mt-1 flex shrink-0 flex-col gap-0.5 border-t border-border pt-3`,children:r.flat&&g?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Wb,{children:g.id===l?`This project`:g.name}),g.status===`missing`?(0,X.jsx)(qb,{project:g,indent:!1}):(0,X.jsx)(Gb,{project:g,sections:s,active:g.id===l,activeId:t,indent:!1})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Wb,{children:`Project settings`}),r.projects.map(n=>(0,X.jsx)(Jb,{project:n,sections:s,activeProjectId:r.activeProjectId,activeId:t,openSectionId:e===`project`?t:null,onProjectPage:e===`project`,expanded:p(n.id),onToggle:()=>m(n.id)},n.id))]})}):null,e===`project`?(0,X.jsx)(Ab,{}):null]}),(0,X.jsxs)(`div`,{"data-slot":`settings-sidebar-footer`,className:`flex flex-col gap-1.5 border-t border-border px-3.5 py-2.5`,children:[(0,X.jsx)(gf,{}),(0,X.jsxs)(`div`,{"data-slot":`settings-sidebar-footer-controls`,className:`flex items-center gap-2`,children:[v?(0,X.jsx)(Ip,{version:v,latestVersion:y,brandName:C}):null,x===null?null:(0,X.jsx)(Lp,{count:x}),(0,X.jsx)(_d,{className:`ml-auto`})]})]})]})})}function Qb({scope:e,activeId:t,capabilities:n}){let r=Cb(n)[e],i=e===`global`?rr:sr,a=e=>U(`rounded-full border px-3 py-1.5 text-[13px] font-medium whitespace-nowrap transition-colors`,e?`border-transparent bg-contrast text-contrast-foreground`:`border-border bg-card text-muted-foreground`);return(0,X.jsxs)(`nav`,{"aria-label":`Sections of this area`,"data-slot":`settings-nav-mobile`,className:`flex shrink-0 gap-1.5 overflow-x-auto border-b border-border px-3 py-2.5 md:hidden`,children:[e===`project`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(or,{to:Lb,"data-slot":`settings-all-pill`,className:a(!1),children:`‹ General settings`}),(0,X.jsx)(i,{to:`/settings`,end:!0,"data-slot":`settings-nav-index`,className:a(!1),children:`General`})]}):null,r.map(n=>(0,X.jsx)(i,{to:Ib(e,n.id),"data-section":n.id,className:a(n.id===t),children:n.title},n.id))]})}function $b({title:e,projectName:t}){return(0,X.jsx)(`div`,{"data-slot":`settings-mobile-bar`,className:`shrink-0 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,X.jsxs)(`div`,{className:`flex h-[52px] items-center gap-1 px-2`,children:[(0,X.jsx)(si,{asChild:!0,children:(0,X.jsx)(W,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Open settings menu`,className:`size-11`,children:(0,X.jsx)(wc,{"aria-hidden":`true`,className:`size-[17px]`})})}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,X.jsx)(ex,{title:e,projectName:t,as:`span`})})]})})}function ex({title:e,projectName:t,as:n}){let r=n===`h1`?`text-base`:`text-[14.5px]`;return(0,X.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:U(`truncate font-semibold text-muted-foreground`,r),children:t}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:U(`shrink-0 font-normal text-soft-foreground`,r),children:`/`})]}):null,(0,X.jsx)(n,{className:U(`truncate font-semibold`,r),children:e})]})}function tx({scope:e,section:t,title:n,beside:r}){return(0,X.jsxs)(`header`,{"data-slot":`settings-header`,className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,X.jsx)(ex,{title:n,projectName:r,as:`h1`}),t?(0,X.jsx)(`p`,{className:`min-w-0 truncate text-[13px] text-soft-foreground`,children:t.description}):e===`project`?(0,X.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Project settings`}):null]})}function nx({scope:e,section:t,capabilities:n,routeName:r,children:i}){let a=zb(n),o=Bb(a.activeProjectId??a.bootProjectId);Vb(o);let s=a.activeProject?.name??a.activeProjectId,c=t?.title??(e===`global`?`Settings`:s??`Settings`),l=e===`project`&&t!==null?s:null,[u,d]=Y.useState(!1),f={scope:e,activeId:t?.id??null,capabilities:n,tree:a,leave:o};return(0,X.jsx)(hi,{open:u,onOpenChange:d,children:(0,X.jsxs)(`div`,{"data-route":r,className:`flex h-full min-h-full`,children:[(0,X.jsx)(Yb,{...f}),(0,X.jsx)(Xb,{...f,onOpenChange:d}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col overflow-y-auto overscroll-contain`,children:[(0,X.jsx)($b,{title:c,projectName:l}),(0,X.jsx)(tx,{scope:e,section:t,title:c,beside:l}),t?(0,X.jsx)(Qb,{scope:e,activeId:t.id,capabilities:n}):null,(0,X.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:i})]})]})})}function rx({section:e,scope:t,capabilities:n}){let r=e.component;return(0,X.jsx)(nx,{scope:t,section:e,capabilities:n,routeName:t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,children:(0,X.jsx)(r,{})})}var ix=`flex items-center gap-3.5 rounded-lg border border-border bg-card p-4 shadow-xs transition-colors hover:bg-card-2`;function ax({section:e}){return(0,X.jsx)(`li`,{children:(0,X.jsxs)(K,{to:Ib(`project`,e.id),"data-section":e.id,className:ix,children:[(0,X.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md border border-border bg-muted text-muted-foreground`,children:(0,X.jsx)(e.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,X.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:e.description})]}),(0,X.jsx)(Jo,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})})}function ox({scope:e,capabilities:t}){let n=mr(),r=Cb(t)[e];if(e===`global`){let e=r[0];return(0,X.jsx)(nr,{to:{pathname:Ib(`global`,e.id),search:n.search,hash:n.hash},replace:!0})}return(0,X.jsx)(nx,{scope:e,section:null,capabilities:t,routeName:`settings`,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[(0,X.jsx)(Nb,{capabilities:t}),(0,X.jsx)(`ul`,{"data-slot":`settings-index`,className:`mx-auto mt-7 flex w-full max-w-2xl flex-col gap-2.5 md:hidden`,children:r.map(e=>(0,X.jsx)(ax,{section:e},e.id))})]})})}function sx({label:e,expanded:t,onToggle:n,className:r}){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`subtask-toggle`,"aria-expanded":t,"aria-label":`${t?`Collapse`:`Expand`} ${e}`,onClick:n,className:U(`inline-flex shrink-0 items-center gap-0.5 rounded-full bg-muted py-px pr-1.5 pl-1 text-[10.5px] font-medium text-muted-foreground hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,r),children:[(0,X.jsx)(Jo,{className:U(`size-3 transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),e]})}function cx({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`skeleton`,className:U(`animate-pulse rounded-md bg-accent`,e),...t})}var lx=[{id:`status`,label:`Status`,canFold:!1,defaultExpanded:!0,align:`left`,width:`116px`},{id:`task`,label:`Task`,canFold:!1,defaultExpanded:!0,align:`left`},{id:`workflow`,label:`Workflow`,canFold:!0,defaultExpanded:!0,align:`left`,width:`124px`,icon:`workflow`},{id:`branch`,label:`Branch`,canFold:!0,defaultExpanded:!1,align:`left`,width:`128px`,icon:`branch`},{id:`diff`,label:`±`,canFold:!0,defaultExpanded:!0,align:`left`,width:`78px`,icon:`diff`},{id:`reference`,label:`Ref`,canFold:!0,defaultExpanded:!0,align:`left`,width:`76px`,icon:`reference`},{id:`tokens`,label:`IN / OUT`,canFold:!0,defaultExpanded:!0,align:`right`,width:`112px`,icon:`tokens`,capability:`tokens`},{id:`cost`,label:`Cost`,canFold:!0,defaultExpanded:!0,align:`right`,width:`76px`,icon:`cost`,capability:`cost`},{id:`cpu`,label:`CPU`,canFold:!0,defaultExpanded:!0,align:`right`,width:`68px`,icon:`cpu`},{id:`memory`,label:`Mem`,canFold:!0,defaultExpanded:!0,align:`right`,width:`88px`,icon:`memory`},{id:`started`,label:`Started`,canFold:!0,defaultExpanded:!0,align:`right`,width:`82px`,icon:`started`}],ux=new Map(lx.map(e=>[e.id,e]));function dx(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`boolean`))}function fx(e){let t={};for(let[n,r]of Object.entries(dx(e))){let e=ux.get(n);e?.canFold&&(t[e.id]=r)}return t}function px(e,t){let n=ux.get(e);return!n||!n.canFold?!0:t[e]??n.defaultExpanded}function mx(e,t){let n=dx(e);return ux.get(t)?.canFold?{...n,[t]:!px(t,fx(e))}:n}function hx(e){return lx.filter(t=>t.capability===void 0||e[t.capability])}function gx(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function _x(){let e=V(),t=Ue(),n=Y.useRef(0),r=Y.useRef(0),i=Y.useRef(Promise.resolve()),a=Y.useMemo(()=>fx(t.data?.taskTable?.expandedColumns),[t.data?.taskTable?.expandedColumns]),o=Y.useCallback(t=>{if(!lx.find(e=>e.id===t)?.canFold)return;let a=e.getQueryData(R.uiState);if(a===void 0)return;let o=gx(a?.taskTable),s={...o,expandedColumns:mx(o.expandedColumns,t)};e.setQueryData(R.uiState,{...a,taskTable:s});let c=++n.current;r.current=c;let l=i.current.then(async()=>{let t=await v({taskTable:s},{keepalive:!0});c===r.current&&e.setQueryData(R.uiState,t)});i.current=l.catch(t=>{G(t instanceof Error?t.message:String(t),{tone:`danger`}),c===r.current&&e.invalidateQueries({queryKey:R.uiState})})},[e]);return{expandedColumns:a,isExpanded:Y.useCallback(e=>px(e,a),[a]),toggleColumn:o,isPending:t.isPending}}function vx({runs:e,view:t,onViewChange:n,onArchiveFinished:r,onMarkAllRead:i,onRename:a,onTogglePin:o,now:s=Date.now(),showTokens:c=!0,showCost:l=!0,expandedColumns:u=fx(void 0),onToggleColumn:f=()=>void 0,columnsPending:p=!1,origin:m=`all`,onOriginChange:h=()=>void 0,automationNames:g,gitRepo:_=!0}){let[v,y]=Y.useState(``),[b,x]=Y.useState(new Set),S=e=>x(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),[C,w]=Y.useState(Pm),[T,D]=Y.useState(`recent`),O=Y.useMemo(()=>e??[],[e]),k=Y.useMemo(()=>Im(O),[O]),A=Rm(O,m,C,k),j=Ne(A),M=d(et(A,v),t,T),N=v.trim()!==``,P=be(M,t).map(e=>({...e,rows:Gm(e.runs,e=>N||b.has(e)),taskCount:Gm(e.runs,()=>!1).length})),F=E(O),I=wt(et(A,v),t),ee=Kt(O),te=hx({tokens:c,cost:l}).map(e=>e.id===`started`?{...e,label:At(T)}:e),ne=aa(O),L=t===`archived`?void 0:o;return(0,X.jsxs)(`div`,{"data-route":`tasks`,className:`flex min-h-full flex-col`,children:[(0,X.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,X.jsx)(`h1`,{className:`text-base font-semibold`,children:`Tasks`}),(0,X.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,X.jsx)(xx,{view:`active`,current:t,onSelect:n,count:j.active,children:`Active`}),(0,X.jsx)(xx,{view:`archived`,current:t,onSelect:n,count:j.archived,children:`Archived`})]}),(0,X.jsx)(`div`,{className:`flex-1`}),ne>0?(0,X.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`mark-all-read`,onClick:i,children:[(0,X.jsx)(Ir,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read`]}):null,t===`active`&&ee>0?(0,X.jsxs)(W,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,onClick:r,children:[(0,X.jsx)(Zi,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`]}):null,(0,X.jsxs)(`div`,{className:`relative w-60`,children:[(0,X.jsx)(Nr,{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 tasks…`,"aria-label":`Search tasks`,className:`h-9 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[O.length>0?(0,X.jsx)(bx,{runs:O,view:t,origin:m,onOriginChange:h,filters:C,onFiltersChange:w,automations:k,automationNames:g,sortBy:T,onSortByChange:D}):null,e===void 0?null:M.length===0?(0,X.jsx)(yx,{view:t,query:v,filtered:Fm(C)>0,onClearFilters:()=>w(Pm),origin:m,hiddenByOrigin:m!==`all`&&Rm(Nt(O,t),`all`,C,k).length>0,onShowAll:()=>h(`all`)}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{"data-slot":`tasks-table`,className:`hidden overflow-x-auto rounded-lg border border-border bg-card shadow-xs md:block`,children:(0,X.jsx)(Wo,{children:(0,X.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,X.jsx)(`colgroup`,{children:te.map(e=>{let t=px(e.id,u);return(0,X.jsx)(`col`,{"data-column-id":e.id,"data-expanded":t,style:{width:t?e.width:`42px`}},e.id)})}),(0,X.jsx)(`thead`,{children:(0,X.jsx)(`tr`,{children:te.map(e=>(0,X.jsx)(Cx,{column:e,expanded:px(e.id,u),onToggle:f,disabled:p},e.id))})}),(0,X.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:P.map(e=>(0,X.jsxs)(Y.Fragment,{children:[e.label?(0,X.jsx)(`tr`,{"data-slot":`tasks-section`,"data-section":e.key,children:(0,X.jsxs)(`th`,{scope:`rowgroup`,colSpan:te.length,className:U(Tx,`border-b border-border bg-muted/40 px-3.5 py-1.5 text-left`),children:[e.label,` · `,e.taskCount]})}):null,e.rows.map(e=>(0,X.jsx)(Dx,{gitRepo:_,run:e.run,depth:e.depth,childCount:e.childCount,subtasksExpanded:N||b.has(e.run.id),onToggleSubtasks:S,queuePosition:e.run.status===`queued`?F.get(e.run.id)??null:null,onRename:a,onTogglePin:L,now:s,sortBy:T,columns:te,expandedColumns:u},e.run.id))]},e.key))})]})})}),(0,X.jsx)(`div`,{"data-slot":`task-cards`,className:`flex flex-col gap-2.5 md:hidden`,children:P.map(e=>(0,X.jsxs)(Y.Fragment,{children:[e.label?(0,X.jsxs)(`h2`,{"data-slot":`tasks-section`,"data-section":e.key,className:U(Tx,`px-1 pt-1`),children:[e.label,` · `,e.taskCount]}):null,e.rows.map(e=>(0,X.jsx)(Nx,{run:e.run,depth:e.depth,childCount:e.childCount,subtasksExpanded:N||b.has(e.run.id),onToggleSubtasks:S,queuePosition:e.run.status===`queued`?F.get(e.run.id)??null:null,now:s,sortBy:T,showTokens:c,showCost:l,onTogglePin:L,gitRepo:_},e.run.id))]},e.key))})]}),I.map(e=>(0,X.jsxs)(`div`,{"data-slot":`compare-strip`,"data-group-id":e.groupId,className:`mt-3.5 flex flex-wrap items-center gap-2.5 rounded-lg border border-border bg-card px-3.5 py-2.5 text-[12.5px] text-muted-foreground shadow-xs`,children:[(0,X.jsx)(Mc,{className:`size-[15px] shrink-0 text-soft-foreground`,"aria-hidden":`true`}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e.title}),` — `,e.count,` variants finished`]}),(0,X.jsx)(W,{asChild:!0,variant:`outline`,size:`sm`,className:`md:ml-auto`,children:(0,X.jsx)(K,{to:`/compare/${e.groupId}`,children:`Compare`})})]},e.groupId))]}),(0,X.jsx)(K,{to:`/new`,"data-slot":`new-task-fab`,"aria-label":`New task`,className:`fixed right-4 bottom-[calc(16px+env(safe-area-inset-bottom))] z-20 inline-flex size-14 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-modal md:hidden`,children:(0,X.jsx)(_s,{className:`size-[22px]`,"aria-hidden":`true`})})]})}function yx({view:e,query:t,filtered:n=!1,onClearFilters:r=()=>void 0,origin:i=`all`,hiddenByOrigin:a=!1,onShowAll:o=()=>void 0}){let s=t.trim(),c=s?`search-miss`:n?`filtered`:a?`origin-hidden`:e===`archived`?`archive`:`no-tasks`;return(0,X.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":c,className:`flex flex-1 flex-col`,children:c===`filtered`?(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(vs,{}),tone:`neutral`,title:`No tasks match these filters`,actions:(0,X.jsx)(W,{type:`button`,variant:`outline`,onClick:r,children:`Clear filters`})}):c===`origin-hidden`?(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(Mo,{}),tone:`neutral`,title:i===`regular`?`No regular tasks here`:`No automation tasks here`,subtitle:i===`regular`?`Tasks started by automations are hidden.`:`Only tasks started by automations are shown.`,actions:(0,X.jsx)(W,{type:`button`,variant:`outline`,onClick:o,children:`Show all tasks`})}):c===`search-miss`?(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(vs,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No tasks match “${s}”.`}):c===`archive`?(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(Zi,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(xc,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,X.jsx)(W,{asChild:!0,children:(0,X.jsxs)(K,{to:`/new`,children:[(0,X.jsx)(_s,{"aria-hidden":`true`}),`New task`]})})})})}function bx({runs:e,view:t,origin:n,onOriginChange:r,filters:i,onFiltersChange:a,automations:o,automationNames:s,sortBy:c,onSortByChange:l}){let u=Y.useMemo(()=>e.filter(e=>t===`archived`?e.archived:!e.archived),[e,t]),d=Vm(u,i,o),f=e=>Bm(u,n,i,o,e),p=f(`statuses`),m=f(`workflows`),h=f(`automations`),g=Hm(u.map(e=>o.get(e.id))),_=(e,t)=>a(n=>({...n,[e]:n[e].includes(t)?n[e].filter(e=>e!==t):[...n[e],t]})),v=e=>a(t=>({...t,[e]:[]})),y=Fm(i);return(0,X.jsxs)(`div`,{"data-slot":`tasks-filters`,className:`mb-3 flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(ei,{slot:`task-origin`,label:`Show tasks started by`,value:n,options:Cd.map(e=>({...e,count:d[e.value]})),onChange:r}),(0,X.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,X.jsx)($r,{slot:`status`,label:`Status`,selected:i.statuses,onToggle:e=>_(`statuses`,e),onClear:()=>v(`statuses`),options:Hm(u.map(e=>e.status)).map(e=>({value:e,label:e,count:p.get(e)??0})),emptyLabel:`No tasks to filter`}),(0,X.jsx)($r,{slot:`workflow`,label:`Workflow`,selected:i.workflows,onToggle:e=>_(`workflows`,e),onClear:()=>v(`workflows`),options:Hm(u.map(e=>sn(e))).map(e=>({value:e,label:e,count:m.get(e)??0})),emptyLabel:`No tasks to filter`}),n!==`regular`&&g.length>0?(0,X.jsx)($r,{slot:`automation`,label:`Automation`,selected:i.automations,onToggle:e=>_(`automations`,e),onClear:()=>v(`automations`),options:g.map(e=>({value:e,label:s?.get(e)??e,count:h.get(e)??0})),emptyLabel:`No automation tasks`}):null,y>0?(0,X.jsxs)(`button`,{type:`button`,"data-action":`clear-filters`,onClick:()=>a(()=>Pm),className:`inline-flex h-7 items-center gap-1 rounded-full px-2 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,X.jsx)(ys,{className:`size-3`,"aria-hidden":`true`}),`Clear (`,y,`)`]}):null,(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:`Sort by`}),(0,X.jsx)(ei,{slot:`sort-by`,label:`Sort tasks by`,value:c,options:gn,onChange:l})]})}function xx({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:U(`flex h-7 items-center justify-center gap-1.5 rounded-[7px] px-3 text-[12.5px] font-medium text-muted-foreground`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,X.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function Sx({children:e,right:t=!1,columnId:n,folded:r=!1}){return(0,X.jsx)(`th`,{scope:`col`,"data-column-id":n,"data-folded":r||void 0,className:U(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-soft-foreground uppercase first:pl-4 last:pr-4`,t&&`text-right`,r&&`px-0 first:pl-0 last:pr-0`),children:e})}function Cx({column:e,expanded:t,onToggle:n,disabled:r}){if(!e.canFold)return(0,X.jsx)(Sx,{columnId:e.id,right:e.align===`right`,children:e.label});let i=t?`Fold`:`Expand`;return(0,X.jsx)(Sx,{columnId:e.id,right:e.align===`right`,folded:!t,children:(0,X.jsxs)(Ko,{children:[(0,X.jsx)(Bo,{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:U(`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)(nc,{className:`size-3 opacity-55`,"aria-hidden":`true`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(wx,{icon:e.icon}),(0,X.jsx)(rc,{className:`size-3 opacity-70`,"aria-hidden":`true`})]})})}),(0,X.jsxs)(Ho,{side:`top`,children:[e.label,` · `,i,` column`]})]})})}function wx({icon:e}){let t=`size-3.5`;switch(e){case`workflow`:return(0,X.jsx)(Mo,{className:t,"aria-hidden":`true`});case`branch`:return(0,X.jsx)(os,{className:t,"aria-hidden":`true`});case`diff`:return(0,X.jsx)(ls,{className:t,"aria-hidden":`true`});case`reference`:return(0,X.jsx)(ua,{className:t,"aria-hidden":`true`});case`tokens`:return(0,X.jsx)(ac,{className:t,"aria-hidden":`true`});case`cost`:return(0,X.jsx)(zr,{className:t,"aria-hidden":`true`});case`cpu`:return(0,X.jsx)(Aa,{className:t,"aria-hidden":`true`});case`memory`:return(0,X.jsx)(Cc,{className:t,"aria-hidden":`true`});case`started`:return(0,X.jsx)(ic,{className:t,"aria-hidden":`true`});default:return null}}var Tx=`text-[11px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,Ex=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function Dx({gitRepo:e,run:t,depth:n,childCount:r,subtasksExpanded:i,onToggleSubtasks:a,queuePosition:o,onRename:s,onTogglePin:c,now:l,sortBy:u,columns:d,expandedColumns:f}){let p=tr(),m=re(t),h=mt(t),g=`/tasks/${t.id}`,_=en(t.costUsd),v=St(t);return(0,X.jsx)(`tr`,{"data-slot":`task-table-row`,"data-run-id":t.id,"data-depth":n,onClick:e=>{e.target.closest(`a, button, input`)||p(g)},className:`group/row cursor-pointer hover:bg-muted`,children:d.map(d=>{if(d.id===`memory`)return null;if(d.id===`cpu`){let e=px(`cpu`,f),n=px(`memory`,f);return o!==null&&(e||n)?(0,X.jsxs)(`td`,{"data-slot":`queue-note`,"data-column-id":`cpu-memory`,colSpan:2,className:U(Ex,`text-right font-mono text-[11.5px] text-soft-foreground`),children:[`#`,o,` in queue`]},d.id):(0,X.jsx)(jx,{run:t,cpuExpanded:e,memoryExpanded:n},d.id)}return(0,X.jsx)(Ox,{gitRepo:e,column:d,expanded:px(d.id,f),run:t,depth:n,childCount:r,subtasksExpanded:i,onToggleSubtasks:a,attention:m,scheduled:h,reference:v,cost:_,to:g,onRename:s,onTogglePin:c,now:l,sortBy:u},d.id)})})}function Ox({gitRepo:e,column:t,expanded:n,run:r,depth:i,childCount:a,subtasksExpanded:o,onToggleSubtasks:s,attention:c,scheduled:l,reference:u,cost:d,to:f,onRename:p,onTogglePin:m,now:h,sortBy:g}){if(!n)return(0,X.jsx)(kx,{column:t.id});switch(t.id){case`status`:return(0,X.jsx)(`td`,{"data-column-id":t.id,className:Ex,children:(0,X.jsxs)(Ss,{dot:c.tone,pulse:c.pulse,title:l?.title,children:[c.label,l?(0,X.jsx)(`span`,{className:`tabular-nums`,children:l.label}):null]})});case`task`:return(0,X.jsx)(`td`,{"data-column-id":t.id,className:U(Ex,`min-w-[220px] max-w-0`),children:(0,X.jsx)(Ax,{run:r,depth:i,childCount:a,subtasksExpanded:o,onToggleSubtasks:s,to:f,onRename:p,onTogglePin:m})});case`workflow`:return(0,X.jsx)(`td`,{"data-column-id":t.id,className:U(Ex,`text-[12.5px] text-muted-foreground`),children:sn(r)});case`branch`:return(0,X.jsx)(`td`,{"data-column-id":t.id,className:Ex,children:r.branch?(0,X.jsx)(Ix,{branch:r.branch}):Lx(r,e)?(0,X.jsx)(Rx,{}):(0,X.jsx)(Px,{})});case`diff`:return(0,X.jsx)(`td`,{"data-column-id":t.id,className:Ex,children:r.diffStat?(0,X.jsx)(zs,{stat:r.diffStat}):(0,X.jsx)(Px,{})});case`reference`:return(0,X.jsx)(`td`,{"data-column-id":t.id,className:Ex,children:u?(0,X.jsx)(Gi,{run:r,reference:u}):(0,X.jsx)(Px,{})});case`tokens`:return(0,X.jsx)(`td`,{"data-column-id":t.id,className:U(Ex,`text-right text-xs text-muted-foreground`),children:(0,X.jsx)(xs,{inputTokens:r.inputTokens,outputTokens:r.outputTokens,variant:`table`,omitWhenUnknown:!1})});case`cost`:return(0,X.jsx)(`td`,{"data-column-id":t.id,className:U(Ex,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:d||(0,X.jsx)(Px,{})});case`started`:return(0,X.jsx)(`td`,{"data-column-id":t.id,className:U(Ex,`text-right text-xs text-soft-foreground tabular-nums`),children:Ls(se(r,g),h)});case`cpu`:case`memory`:return null}}function kx({column:e}){return(0,X.jsx)(`td`,{role:`presentation`,"aria-hidden":`true`,"data-column-id":e,"data-folded":`true`,className:U(Ex,`px-0 first:pl-0 last:pr-0`)})}function Ax({run:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,to:a,onRename:o,onTogglePin:s}){let c=he(e),l=Ii(c,t=>o(e.id,t)),u=ma(e),d=fa(e),f=Km(n),p=t>0?{paddingLeft:`${t*14}px`}:void 0;return l.editing?(0,X.jsx)(`span`,{className:`flex min-w-0 items-center`,style:p,children:(0,X.jsx)(ja,{editor:l,className:`text-[13px] font-medium`})}):(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,style:p,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`subtask-tick`,className:`shrink-0 font-mono text-[11px] leading-none text-soft-foreground`,children:`└`}):null,(0,X.jsxs)(K,{to:a,title:c,className:U(`min-w-0 truncate text-[13px]`,u?`font-semibold text-foreground`:d?`font-medium text-muted-foreground`:`font-medium`),children:[c,u?(0,X.jsx)(Nm,{}):null]}),qm(e)?(0,X.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:qm(e)}):null,f?(0,X.jsx)(sx,{label:f,expanded:r,onToggle:()=>i(e.id)}):null,(0,X.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:l.begin,className:`shrink-0 rounded-sm p-0.5 text-soft-foreground opacity-0 transition-opacity group-hover/row:opacity-100 hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,X.jsx)(ms,{className:`size-3`,"aria-hidden":`true`})}),s?(0,X.jsx)(na,{pinned:!!e.pinned,onToggle:t=>s(e,t),className:`size-[19px] opacity-0 group-hover/row:opacity-100 focus-visible:opacity-100 no-hover:opacity-100 data-[pinned=true]:opacity-100`}):null]})}function jx({run:e,cpuExpanded:t,memoryExpanded:n}){let r=Qe(e,Yr(e.id));return(0,X.jsxs)(X.Fragment,{children:[t?(0,X.jsx)(Mx,{column:`cpu`,cell:r.cpu}):(0,X.jsx)(kx,{column:`cpu`}),n?(0,X.jsx)(Mx,{column:`memory`,cell:r.mem}):(0,X.jsx)(kx,{column:`memory`})]})}function Mx({column:e,cell:t}){return(0,X.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-column-id":e,"data-usage-kind":t.kind,title:t.title,className:U(Ex,`text-right font-mono tabular-nums`,t.kind===`live`&&`bg-violet/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-[11.5px] text-soft-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:t.text||`—`})}function Nx({run:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,queuePosition:a,now:o,sortBy:s,showTokens:c,showCost:l,onTogglePin:u,gitRepo:d}){let f=tr(),p=re(e),m=mt(e),h=`/tasks/${e.id}`,g=St(e),_=ma(e),v=fa(e),y=en(e.costUsd),b=Km(n),x=e.inputTokens!==void 0||e.outputTokens!==void 0;return(0,X.jsxs)(`div`,{"data-slot":`task-card`,"data-run-id":e.id,"data-depth":t,style:t>0?{marginLeft:`${t*14}px`}:void 0,onClick:e=>{e.target.closest(`a, button`)||f(h)},className:`cursor-pointer rounded-lg border border-border bg-card px-3.5 py-3 shadow-xs`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,X.jsxs)(Ss,{dot:p.tone,pulse:p.pulse,className:`mt-px shrink-0`,title:m?.title,children:[p.label,m?(0,X.jsx)(`span`,{className:`tabular-nums`,children:m.label}):null]}),(0,X.jsxs)(K,{to:h,className:U(`min-w-0 flex-1 text-[13.5px] leading-[1.35]`,_?`font-semibold text-foreground`:v?`font-medium text-muted-foreground`:`font-medium`),children:[he(e),_?(0,X.jsx)(Nm,{}):null]}),qm(e)?(0,X.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`mt-px shrink-0 rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:qm(e)}):null,b?(0,X.jsx)(sx,{label:b,expanded:r,onToggle:()=>i(e.id),className:`mt-px`}):null,(0,X.jsx)(`span`,{className:`mt-0.5 shrink-0 text-[11.5px] text-soft-foreground tabular-nums`,children:Ls(se(e,s),o)}),u?(0,X.jsx)(na,{pinned:!!e.pinned,onToggle:t=>u(e,t),className:`-mr-1 mt-px`}):null]}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 font-mono text-[11.5px] font-medium text-muted-foreground tabular-nums`,children:[(0,X.jsx)(`span`,{children:sn(e)}),a===null?(0,X.jsxs)(X.Fragment,{children:[e.branch?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Fx,{}),(0,X.jsx)(`span`,{children:e.branch})]}):Lx(e,d)?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Fx,{}),(0,X.jsx)(Rx,{})]}):null,e.diffStat?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Fx,{}),(0,X.jsx)(zs,{stat:e.diffStat,className:`text-[11.5px]`})]}):null,c&&x?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Fx,{}),(0,X.jsx)(xs,{inputTokens:e.inputTokens,outputTokens:e.outputTokens})]}):null,l&&y?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Fx,{}),(0,X.jsx)(`span`,{children:y})]}):null]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Fx,{}),(0,X.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,a,` in queue`]})]}),g?(0,X.jsx)(Gi,{run:e,reference:g,className:`h-5`}):null]})]})}function Px(){return(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function Fx(){return(0,X.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`})}function Ix({branch:e}){return(0,X.jsx)(`span`,{className:`rounded-[6px] bg-muted px-1.5 py-0.5 font-mono text-[11.5px] font-medium text-muted-foreground`,children:e})}function Lx(e,t){return t&&e.status===`running`&&!e.branch&&e.worktree!==!1}function Rx(){return(0,X.jsx)(cx,{"data-slot":`branch-skeleton`,role:`status`,"aria-label":`naming branch`,className:`inline-block h-4 w-24 align-middle`})}function zx(){let e=un(),t=Rs(Dt().data),n=Et(),r=!n.data||n.data.info!==null,[i,a]=fm(),o=V(),l=B({mutationFn:s,onSuccess:()=>o.invalidateQueries({queryKey:z.runs.all})}),u=B({mutationFn:Ht,onSuccess:()=>o.invalidateQueries({queryKey:z.runs.all}),onError:e=>G(e.message,{tone:`danger`})}),d=B({mutationFn:({id:e,title:t})=>ct(e,{title:t}),onSuccess:e=>{c(o,e),o.invalidateQueries({queryKey:z.runs.all})},onError:e=>G(e.message,{tone:`danger`})}),f=p(`tasks_table`),m=yi(3e4),h=_x(),[g,_]=Fd(),v=Jr(),y=Y.useMemo(()=>(e.data??[]).some(e=>e.automation??e.automationTrigger??e.automationTracker),[e.data]),b=Vr(v.known&&!v.off&&y&&g!==`regular`),x=Y.useMemo(()=>new Map((b.data?.automations??[]).map(e=>[e.id,e.name])),[b.data]),S=We();return(0,X.jsx)(Sr,{projectId:S,requests:Y.useMemo(()=>S===void 0?[]:(e.data??[]).flatMap(e=>vt(e).map(e=>({projectId:S,kind:e.kind,number:e.number}))),[e.data,S]),children:(0,X.jsx)(vx,{runs:e.data,view:i,onViewChange:a,onArchiveFinished:()=>l.mutate(),onMarkAllRead:()=>u.mutate(),onRename:(e,t)=>d.mutate({id:e,title:t}),onTogglePin:(e,t)=>f.mutate({id:e.id,pinned:t},{onError:e=>G(e.message,{tone:`danger`})}),now:m,showTokens:t.tokens,showCost:t.cost,expandedColumns:h.expandedColumns,onToggleColumn:h.toggleColumn,columnsPending:h.isPending,origin:g,onOriginChange:_,gitRepo:r,automationNames:x})})}var Bx=` untagged`,Vx=[{value:`project`,label:`Project`},{value:`tag`,label:`Tag`},{value:`status`,label:`Status`},{value:`workflow`,label:`Workflow`}];function Hx(e,t){return e===t?`none`:t}function Ux(e,t){return[...e].sort((e,n)=>fn(se(e.run,t),se(n.run,t)))}var Wx={query:``,tags:[],statuses:[],workflows:[]};function Gx(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function Kx(e){return e.tags.length+e.statuses.length+e.workflows.length}function qx(e){return e.query.trim()!==``||Kx(e)>0}function Jx(e){return Kx(e.filters)+(e.filters.query.trim()===``?0:1)+(e.groupBy===`none`?0:1)}function Yx(e){return Jx(e)>0}function Xx(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.map(e=>{let t=n.get(e.projectId);return{run:e,project:t,projectName:t?.name||e.projectId,tags:t?.tags??[]}})}var Zx=e=>`${e.projectId}/${e.id}`;function Qx(e){let t=new Map(e.map(e=>[Zx(e.run),e.run]));return new Map(e.map(e=>[Zx(e.run),Ed(e.run,n=>t.get(`${e.run.projectId}/${n}`))]))}function $x(e,t,n){return e.filter(e=>Dd(n.get(Zx(e.run)),t))}function eS(e){let t=new Set;for(let n of e)t.add(n.run.workflow);return[...t].sort((e,t)=>e.localeCompare(t))}function tS(e){let t=new Set;for(let n of e)t.add(n.run.status);return[...t].sort((e,t)=>e.localeCompare(t))}function nS(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 rS=e=>e.tags.length===0?[Bx]:e.tags,iS=(e,t)=>e.length===0||t.some(t=>e.includes(t)),aS=(e,t)=>{if(t.length===0)return!0;let n=rS(e).map(e=>e.toLowerCase());return t.some(e=>n.includes(e.toLowerCase()))};function oS(e){return[he(e.run),e.projectName,e.run.workflow,e.run.branch??``,...e.tags].join(`
|
|
22
|
+
`).toLowerCase()}function sS(e,t,n){let r=t.query.trim().toLowerCase().split(/\s+/).filter(Boolean);return e.filter(e=>{if((n===`archived`?!e.run.archived:e.run.archived)||!iS(t.statuses,[e.run.status])||!iS(t.workflows,[e.run.workflow])||!aS(e,t.tags))return!1;if(r.length===0)return!0;let i=oS(e);return r.every(e=>i.includes(e))})}function cS(e,t,n,r){return sS(e,{...t,[r]:[]},n)}function lS(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(Bx,`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 uS(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var dS={query:`q`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,sort:`sort`,archived:`archived`},fS=new Set(Vx.map(e=>e.value));function pS(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set(dS.query,n);for(let n of e.filters.tags)n===` untagged`?t.set(dS.untagged,`1`):t.append(dS.tag,n);for(let n of e.filters.statuses)t.append(dS.status,n);for(let n of e.filters.workflows)t.append(dS.workflow,n);return e.groupBy!==`none`&&t.set(dS.groupBy,e.groupBy),e.sortBy!==`recent`&&t.set(dS.sort,e.sortBy),e.view===`archived`&&t.set(dS.archived,`1`),t}function mS(e){let t=e.getAll(dS.tag).filter(e=>e!==``);e.get(dS.untagged)===`1`&&t.push(Bx);let n=e.get(dS.groupBy)??``;return{filters:{query:e.get(dS.query)??``,tags:t,statuses:e.getAll(dS.status).filter(e=>e!==``),workflows:e.getAll(dS.workflow).filter(e=>e!==``)},groupBy:fS.has(n)?n:`none`,sortBy:e.get(dS.sort)===`created`?`created`:`recent`,view:e.get(dS.archived)===`1`?`archived`:`active`}}var hS=15e3,gS=250,_S=1,vS=new Set([`done`,`failed`,`cancelled`]);function yS(){return xS({request:({task:e,archived:t})=>ut(e.run.projectId,e.run.id,t,`all_tasks`),patch:({archived:e})=>t=>({...t,archived:e})})}function bS(){return xS({request:({task:e,read:t})=>j(e.run.projectId,e.run.id,t),patch:({read:e})=>t=>{if(e)return{...t,seenAt:new Date().toISOString()};let{seenAt:n,...r}=t;return r}})}function xS({request:e,patch:t}){let n=V();return B({mutationFn:e,onMutate:async e=>{await n.cancelQueries({queryKey:R.runsIndex});let r=n.getQueryData(R.runsIndex),i=t(e),{task:a}=e;return n.setQueryData(R.runsIndex,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===a.run.projectId&&e.id===a.run.id?i(e):e)}),{previous:r}},onError:(e,t,r)=>{r?.previous&&n.setQueryData(R.runsIndex,r.previous),G(e.message,{tone:`danger`})},onSettled:(e,t,{task:r})=>{n.invalidateQueries({queryKey:R.runsIndex}),n.invalidateQueries({queryKey:z.runs.all}),n.invalidateQueries({queryKey:[r.run.projectId,`runs`,`list`]})}})}function SS(){let e=A(),t=Rs(Dt().data),n=D(!0,hS),[r,i]=Zn(),{filters:a,groupBy:o,sortBy:s,view:c}=Y.useMemo(()=>mS(r),[r]),[l,u]=fm();Y.useEffect(()=>{l!==c&&u(c)},[c,l,u]);let d=yi(3e4),f=e=>i(t=>pS(e(mS(t))),{replace:!0}),p=e=>f(t=>({...t,filters:e(t.filters)})),m=e=>f(t=>({...t,groupBy:e})),h=e=>f(t=>({...t,sortBy:e})),g=e=>f(t=>({...t,view:e})),[_,v]=Y.useState(a.query),[y,b]=Y.useState(new Set),x=e=>b(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),S=a.query.trim()!==``,C=e=>S||y.has(e),w=Y.useRef(a.query);Y.useEffect(()=>{a.query!==w.current&&v(a.query),w.current=a.query},[a.query]),Y.useEffect(()=>{if(_===w.current)return;let e=setTimeout(()=>{w.current=_,p(e=>({...e,query:_}))},gS);return()=>clearTimeout(e)},[_]);let T=n.data?.referenceStatuses;Y.useEffect(()=>{T&&Ct(T)},[T]);let E=Y.useMemo(()=>e.data?.projects??[],[e.data]),O=Y.useMemo(()=>Xx(n.data?.runs??[],E),[n.data,E]),[k,j]=Fd(),M=Y.useMemo(()=>Qx(O),[O]),N=Y.useMemo(()=>$x(O,k,M),[O,k,M]),P=Y.useMemo(()=>{let e=e=>sS($x(O,e,M),a,c).length;return{regular:e(`regular`),automation:e(`automation`),all:e(`all`)}},[O,M,a,c]),F=Y.useMemo(()=>Ux(sS(N,a,c),s),[N,a,c,s]),I=Y.useMemo(()=>lS(F,o),[F,o]),ee=Y.useMemo(()=>F.flatMap(e=>vt(e.run,e.project?.repoUrl).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[F]),te=uS(n.data?.truncated??[],E),ne=(e,t)=>p(n=>({...n,[e]:Gx(n[e],t)})),L=e=>p(t=>({...t,[e]:[]})),re=yS(),ie=bS();if(n.isError||e.isError)return(0,X.jsx)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(J,{icon:(0,X.jsx)(bc,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:(n.error??e.error)?.message})});let ae=(0,X.jsxs)(`div`,{className:`relative w-full md:w-60`,children:[(0,X.jsx)(Nr,{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:_,onChange:e=>v(e.target.value),placeholder:`Search every project…`,"aria-label":`Search tasks across projects`,className:`h-9 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]});return(0,X.jsxs)(`div`,{"data-route":`global-tasks`,className:`flex min-h-full flex-col`,children:[(0,X.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,X.jsx)(`h1`,{className:`text-base font-semibold`,children:`All tasks`}),(0,X.jsxs)(`div`,{className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:[(0,X.jsx)(CS,{view:`active`,current:c,onSelect:g,children:`Active`}),(0,X.jsx)(CS,{view:`archived`,current:c,onSelect:g,children:`Archived`})]}),(0,X.jsx)(`div`,{className:`flex-1`}),(0,X.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`text-[12.5px] text-soft-foreground tabular-nums`,children:[F.length,` of `,O.length]}),ae]}),(0,X.jsxs)(`div`,{className:`flex flex-1 flex-col gap-3 p-3 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-5 md:pb-5`,children:[(0,X.jsx)(`div`,{className:`md:hidden`,children:ae}),(0,X.jsx)(wS,{filters:a,onToggle:ne,onClearFacet:L,onClearAll:()=>{v(``),f(e=>({...e,filters:Wx,groupBy:`none`}))},groupBy:o,onGroupByChange:m,sortBy:s,onSortByChange:h,projects:E,tasks:N,view:c,origin:k,onOriginChange:j,originCounts:P}),te.length>0?(0,X.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-[11.5px] text-soft-foreground`,children:[`Showing the `,n.data?.perProjectLimit,` most recently active tasks per project — older ones in`,` `,te.join(`, `),` are only in that project’s own Tasks page.`]}):null,n.data===void 0?null:F.length===0?(0,X.jsx)(IS,{view:c,filtered:qx(a),origin:k,hiddenByOrigin:k!==`all`&&P.all>0,onShowAll:()=>j(`all`)}):(0,X.jsx)(Sr,{requests:ee,children:I.map(e=>(0,X.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":e.key,children:[o===`none`?null:(0,X.jsxs)(`h2`,{className:`mb-1.5 flex items-center gap-2 text-[12px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:[o===`project`?(0,X.jsx)(or,{to:$n(e.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:e.label}):e.label,(0,X.jsx)(`span`,{className:`font-mono text-[11px] font-medium tabular-nums`,children:e.tasks.length})]}),(0,X.jsx)(ES,{tasks:e.tasks,now:d,sortBy:s,isSubtasksExpanded:C,onToggleSubtasks:x,showProject:o!==`project`,onArchive:(e,t)=>re.mutate({task:e,archived:t}),onSetRead:(e,t)=>ie.mutate({task:e,read:t}),busy:re.isPending||ie.isPending,showCost:t.cost})]},e.key))})]})]})}function CS({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:U(`flex h-7 items-center justify-center rounded-[7px] px-3 text-[12.5px] font-medium text-muted-foreground`,i&&`bg-card font-semibold text-foreground shadow-xs`),children:r})}function wS({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,sortBy:o,onSortByChange:s,projects:c,tasks:l,view:u,origin:d,onOriginChange:f,originCounts:p}){let m=Y.useMemo(()=>nn(c),[c]),h=Y.useMemo(()=>{let t=(t,n)=>nS(cS(l,e,u,t),n);return{tags:t(`tags`,rS),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[l,e,u]),g=e=>t=>({...t,count:e.get(t.value)??0});return(0,X.jsxs)(`div`,{"data-slot":`global-tasks-filters`,className:`flex flex-col gap-2 rounded-lg border border-border bg-card p-2.5 shadow-xs`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,X.jsx)(ei,{slot:`task-origin`,label:`Show tasks started by`,value:d,options:Cd.map(e=>({...e,count:p[e.value]})),onChange:f}),(0,X.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,X.jsx)($r,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:tS(l).map(e=>({value:e,label:e})).map(g(h.statuses)),emptyLabel:`No tasks to filter`}),(0,X.jsx)($r,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:eS(l).map(e=>({value:e,label:e})).map(g(h.workflows)),emptyLabel:`No tasks to filter`}),(0,X.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Group by`}),(0,X.jsx)(Ur,{slot:`group-by`,label:`Group tasks by`,value:i,options:Vx,onChange:e=>a(Hx(i,e))}),(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:`Sort by`}),(0,X.jsx)(ei,{slot:`sort-by`,label:`Sort tasks by`,value:o,options:gn,onChange:s}),Yx({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)(ys,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${Jx({filters:e,groupBy:i})})`]}):null]}),m.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`}),m.map(n=>(0,X.jsx)(Xr,{slot:`tag-filter`,tone:`tag`,label:n,count:h.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,X.jsx)(Xr,{slot:`tag-filter`,label:`Untagged`,count:h.tags.get(` untagged`)??0,selected:e.tags.includes(Bx),onToggle:()=>t(`tags`,Bx)})]}):(0,X.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-[11px] text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,X.jsx)(or,{to:`/settings/global/projects`,className:`font-medium text-violet hover:underline`,children:`Settings → Projects`}),` `,`to group their tasks together here.`]})]})}var TS=e=>e.dispatch;function ES({tasks:e,now:t,sortBy:n,isSubtasksExpanded:r,onToggleSubtasks:i,showProject:a,onArchive:o,onSetRead:s,busy:c,showCost:l}){return(0,X.jsx)(`div`,{"data-slot":`global-tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card shadow-xs`,children:(0,X.jsx)(Wo,{children:(0,X.jsxs)(`table`,{className:`w-full border-collapse`,children:[(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(DS,{className:`w-[104px]`,children:`Status`}),(0,X.jsx)(DS,{children:`Task`}),a?(0,X.jsx)(DS,{className:`w-[124px]`,children:`Project`}):null,(0,X.jsx)(DS,{className:`hidden w-[120px] xl:table-cell`,children:`Tags`}),(0,X.jsx)(DS,{className:`w-[84px]`,children:`Ref`}),(0,X.jsx)(DS,{className:`hidden w-[108px] xl:table-cell`,children:`Workflow`}),l?(0,X.jsx)(DS,{className:`hidden w-[64px] text-right lg:table-cell`,children:`Cost`}):null,(0,X.jsx)(DS,{className:`hidden w-[56px] text-right xl:table-cell`,children:`CPU`}),(0,X.jsx)(DS,{className:`hidden w-[84px] text-right xl:table-cell`,children:`Mem`}),(0,X.jsx)(DS,{className:`w-[72px] text-right`,children:At(n)}),(0,X.jsx)(DS,{className:`w-[64px] text-right`,children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,X.jsx)(`tbody`,{className:`[&>tr:last-child>td]:border-b-0`,children:Gm(e.map(e=>({id:e.run.id,dispatch:TS(e.run),task:e})),r).map(e=>(0,X.jsx)(kS,{task:e.run.task,depth:e.depth,childCount:e.childCount,subtasksExpanded:r(e.run.id),onToggleSubtasks:i,now:t,sortBy:n,showProject:a,onArchive:o,onSetRead:s,busy:c,showCost:l},`${e.run.task.run.projectId}/${e.run.task.run.id}`))})]})})})}function DS({children:e,className:t}){return(0,X.jsx)(`th`,{scope:`col`,className:U(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-soft-foreground uppercase first:pl-4 last:pr-4`,t),children:e})}var OS=`h-11 border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`;function kS({task:e,depth:t,childCount:n,subtasksExpanded:r,onToggleSubtasks:i,now:a,sortBy:o,showProject:s,onArchive:c,onSetRead:l,busy:u,showCost:d}){let{run:f}=e,p=re(f),m=$n(f.projectId,`/tasks/${f.id}`),h=ma(f),g=fa(f),_=vt(f,e.project?.repoUrl),v=Km(n),y=Qe(f,f.usage);return(0,X.jsxs)(`tr`,{"data-slot":`global-task-row`,"data-run-id":f.id,"data-project":f.projectId,"data-depth":t,className:`hover:bg-muted`,children:[(0,X.jsx)(`td`,{className:OS,children:(0,X.jsx)(Ss,{dot:p.tone,pulse:p.pulse,children:p.label})}),(0,X.jsx)(`td`,{className:U(OS,`min-w-[320px] max-w-0`),children:(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,style:t>0?{paddingLeft:`${t*14}px`}:void 0,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`subtask-tick`,className:`shrink-0 font-mono text-[11px] leading-none text-soft-foreground`,children:`└`}):null,(0,X.jsxs)(or,{to:m,title:he(f),className:U(`min-w-0 truncate text-[13px]`,h?`font-semibold text-foreground`:g?`font-medium text-muted-foreground`:`font-medium`),children:[he(f),h?(0,X.jsx)(Nm,{}):null]}),qm(f)?(0,X.jsx)(`span`,{"data-slot":`dispatch-kind`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,children:qm(f)}):null,v?(0,X.jsx)(sx,{label:v,expanded:r,onToggle:()=>i(f.id)}):null]})}),s?(0,X.jsx)(`td`,{className:U(OS,`text-[12.5px] text-muted-foreground`),children:(0,X.jsx)(or,{to:$n(f.projectId,`/`),className:`truncate hover:text-foreground`,children:e.projectName})}):null,(0,X.jsx)(`td`,{className:U(OS,`hidden xl:table-cell`),children:e.tags.length>0?(0,X.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:e.tags.map(e=>(0,X.jsx)(NS,{tag:e},e))}):(0,X.jsx)(FS,{})}),(0,X.jsx)(`td`,{className:OS,children:_.length>0?(0,X.jsx)(MS,{references:_,run:f}):(0,X.jsx)(FS,{})}),(0,X.jsx)(`td`,{className:U(OS,`hidden text-[12.5px] text-muted-foreground xl:table-cell`),children:f.workflow}),d?(0,X.jsx)(`td`,{className:U(OS,`hidden text-right font-mono text-xs text-muted-foreground tabular-nums lg:table-cell`),children:en(f.costUsd)||(0,X.jsx)(FS,{})}):null,(0,X.jsx)(PS,{column:`cpu`,cell:y.cpu}),(0,X.jsx)(PS,{column:`memory`,cell:y.mem}),(0,X.jsx)(`td`,{className:U(OS,`text-right text-xs text-soft-foreground tabular-nums`),children:Ls(se(f,o),a)}),(0,X.jsx)(`td`,{className:U(OS,`text-right`),children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,X.jsx)(AS,{task:e,busy:u,onSetRead:l}),(0,X.jsx)(jS,{task:e,busy:u,onArchive:c})]})})]})}function AS({task:e,busy:t,onSetRead:n}){if(!pa(e.run))return null;let r=ma(e.run),i=he(e.run),a=r?`Mark ${i} read`:`Mark ${i} unread`,o=r?cs:cc;return(0,X.jsxs)(Ko,{children:[(0,X.jsx)(Bo,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"data-action":r?`mark-read`:`mark-unread`,"aria-label":a,disabled:t,onClick:()=>n(e,r),className:U(`inline-flex size-7 items-center justify-center rounded-md transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,r?`text-violet`:`text-soft-foreground`),children:(0,X.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(Ho,{side:`left`,children:r?`Mark read`:`Mark unread`})]})}function jS({task:e,busy:t,onArchive:n}){let r=e.run.archived;if(!r&&!vS.has(e.run.status))return null;let i=r?`Restore ${he(e.run)} to the active list`:`Archive ${he(e.run)}`;return(0,X.jsxs)(Ko,{children:[(0,X.jsx)(Bo,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"data-action":r?`unarchive-run`:`archive-run`,"aria-label":i,disabled:t,onClick:()=>n(e,!r),className:`inline-flex size-7 items-center justify-center rounded-md text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,children:(0,X.jsx)(r?Zs:Zi,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,X.jsx)(Ho,{side:`left`,children:r?`Restore`:`Archive`})]})}function MS({references:e,run:t}){let n=e.slice(0,_S),r=e.length-n.length,i=he(t);return(0,X.jsxs)(`span`,{className:`flex flex-nowrap items-center gap-1`,children:[n.map(e=>(0,X.jsx)(Mr,{reference:e,taskTitle:i,projectId:t.projectId,conflictAction:(0,X.jsx)(da,{projectId:t.projectId,runId:t.id,prNumber:e.number}),className:`shrink-0`},`${e.kind}#${e.number}`)),r>0?(0,X.jsx)(Vi,{references:e,taskTitle:i,hidden:r,projectId:t.projectId}):null]})}function NS({tag:e,className:t}){return(0,X.jsx)(`span`,{"data-slot":`project-tag`,className:U(`inline-flex max-w-full items-center truncate rounded-full bg-muted px-1.5 py-px text-[10.5px] font-medium text-muted-foreground`,t),children:e})}function PS({column:e,cell:t}){return(0,X.jsx)(`td`,{"data-usage":e===`memory`?`mem`:e,"data-usage-kind":t.kind,title:t.title,className:U(OS,`hidden text-right font-mono tabular-nums xl:table-cell`,t.kind===`live`&&`bg-violet/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-[11.5px] text-soft-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:t.text||`—`})}function FS(){return(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function IS({view:e,filtered:t,origin:n=`all`,hiddenByOrigin:r=!1,onShowAll:i=()=>void 0}){return r?(0,X.jsx)(`div`,{"data-slot":`global-tasks-empty`,"data-empty-kind":`origin-hidden`,children:(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(bc,{}),tone:`neutral`,title:n===`regular`?`No regular tasks here`:`No automation tasks here`,subtitle:n===`regular`?`Tasks started by automations are hidden.`:`Only tasks started by automations are shown.`,actions:(0,X.jsx)(W,{type:`button`,variant:`outline`,onClick:i,children:`Show all tasks`})})}):t?(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(vs,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(Zi,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,X.jsx)(J,{heading:`h2`,icon:(0,X.jsx)(xc,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}var LS=Ea(`dashboard`,()=>Yn(()=>import(`./dashboard-wi0EQack.js`).then(e=>({default:e.DashboardRoute})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]))),RS=Ea(`compare`,()=>Yn(()=>import(`./compare-variants-CdchlJMs.js`).then(e=>({default:e.CompareVariantsRoute})),__vite__mapDeps([20,1,2,3,4,5,6,16,18,21,22,13,23,24,25,26,27,28]))),zS=Ea(`task-commits`,()=>Yn(()=>import(`./task-commits-D_gLpFQo.js`).then(e=>e.n).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([29,1,2,3,4,5,6,30,31,7,8,9,10,11,12,13,32,16,33,34,35,36,37,38,39,21,22,23,24,40,41,42,43]))),BS=(0,Y.lazy)(()=>Yn(()=>import(`./task-notes-BBp0rdzM.js`).then(e=>({default:e.TaskNotesRoute})),__vite__mapDeps([44,1,2,3,4,5,6,31,7,8,9,10,11,12,13,32,16,33,34,35,36,37,38,39,21,22,23,24,25,26,27,45,46,47]))),VS=Ea(`task-workspace`,()=>Yn(()=>import(`./task-workspace-Cr9AjTxP.js`).then(e=>({default:e.TaskWorkspaceRoute})),__vite__mapDeps([48,1,2,3,4,5,6,7,8,9,10,11,12,13,15,30,31,32,16,33,34,35,36,37,38,39,21,22,23,24,49,50,18,25,26,27,51,52,40,53,54,55,56,57,47,58,42,59,28,41,29,43,45,46]))),HS=Ea(`repo-git`,()=>Yn(()=>import(`./repo-git-CV-yXaSx.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([60,1,2,3,4,5,6,30,49,50,18,35,8,33,36,10,11,37,38,24,25,23,26,27,51,52,40,16,56,21,47,41,42,43]))),US=Ea(`github`,()=>Yn(()=>import(`./github-DZcdhMzw.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([61,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,31,32,33,34,35,36,37,38,39,21,22,23,24,40,53,50,54,62,18,52,63,25,26,27,42,64,41]))),WS=Ea(`tracker`,()=>Yn(()=>import(`./tracker-BHwMGsDY.js`).then(e=>({default:e.TrackerRoute})),__vite__mapDeps([65,1,2,3,4,5,6,7,8,9,10,11,12,13,15,30,31,32,16,33,34,35,36,37,38,39,21,22,23,24,40,54,63,25,26,27,64,53,50]))),GS=Ea(`workflow-graph`,()=>Yn(()=>import(`./workflow-graph-CcOTCItr.js`).then(e=>({default:e.WorkflowGraphRoute})),__vite__mapDeps([66,1,2,3,4,5,6,32,9,19,34,36,67,10,52,54,56,46,63,12,23,47,24,68]))),KS=Ea(`skills`,()=>Yn(()=>import(`./skills-DuSNv5op.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([69,1,2,3,4,5,6,7,8,9,10,11,12,13,31,32,16,33,34,35,36,37,38,39,21,22,23,24,40,53,15,50,54,47]))),qS=Ea(`automations`,()=>Yn(()=>import(`./automations-route-Cs1tsu1W.js`).then(e=>({default:e.AutomationsRoute})),__vite__mapDeps([70,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,31,32,33,34,35,36,37,38,39,21,22,23,24,40,53,50,54,17,62,18,55,67,56,47])));function JS(){let e=mr();return new URLSearchParams(e.search).get(`skill`)===`__bm`?(0,X.jsx)(ur,{to:{pathname:`/settings/bookmarklets`,hash:e.hash},replace:!0}):(0,X.jsx)(ur,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function YS({sectionId:e}){let t=mr();return(0,X.jsx)(nr,{to:{pathname:Ib(`global`,e),search:t.search,hash:t.hash},replace:!0})}function XS(){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 ZS(){let{projectId:e=``}=pr(),t=mr(),n=A(),r=Dt();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)(nr,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,X.jsx)(XS,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,X.jsx)(M_,{projectId:e,registry:n.data})}else if(!n.isError)return(0,X.jsx)(XS,{});return(0,X.jsx)(bt,{projectId:n.data?.bootProject===e?null:e,children:(0,X.jsx)(Qn,{},e)})}function QS(){let{projectId:e=``}=pr();return(0,X.jsx)(v_,{},e)}function $S(){let e=mr(),t=Dt(),n=A(),r=t.data?.bootProject??n.data?.bootProject,i=(t.data!==void 0||t.isError)&&(n.data!==void 0||n.isError);if(r===void 0&&!i)return(0,X.jsx)(XS,{});let a=r??`default`;if(e.pathname===`/`&&e.search===``&&e.hash===``){if(n.data===void 0&&!n.isError)return(0,X.jsx)(XS,{});let e=Lh(jh(),n.data,r);if(e!==null)return(0,X.jsx)(nr,{to:e,replace:!0});let t=Rh(n.data,a);if(t!==a)return(0,X.jsx)(nr,{to:`/p/${encodeURIComponent(t)}/`,replace:!0})}let o=e.pathname===`/p`||e.pathname===`/p/`?`/`:e.pathname;return(0,X.jsx)(nr,{to:`/p/${encodeURIComponent(a)}${o}${e.search}${e.hash}`,replace:!0})}var eC=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/tasks`,pageLabel:`All tasks`},{pattern:`/dashboard`,pageLabel:`Dashboard`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/compare/:groupId`,pageLabel:`Compare`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/tracker/*`,pageLabel:`Tracker`},{pattern:`/automations/*`,pageLabel:`Automations`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/inbox`,pageLabel:`Inbox`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function tC(e){let t=cr(e),n=er({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:eC.find(({pattern:e})=>er({path:e,end:!0},t))?.pageLabel??null,taskId:null}}var nC=(0,Y.memo)(function(){let e=Dt().data?.capabilities;return(0,X.jsxs)(hr,{children:[(0,X.jsxs)(q,{path:`/p/:projectId`,element:(0,X.jsx)(ZS,{}),children:[(0,X.jsx)(q,{index:!0,element:(0,X.jsx)(zx,{})}),(0,X.jsx)(q,{path:`new`,element:(0,X.jsx)(QS,{})}),(0,X.jsx)(q,{path:`tasks/:id`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Co,{}),children:(0,X.jsx)(VS,{})})}),(0,X.jsx)(q,{path:`tasks/:id/chat`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Co,{}),children:(0,X.jsx)(VS,{view:`session`})})}),(0,X.jsx)(q,{path:`tasks/:id/changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Na,{tab:`changes`}),children:(0,X.jsx)(VS,{view:`changes`})})}),(0,X.jsx)(q,{path:`tasks/:id/files`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Na,{tab:`files`}),children:(0,X.jsx)(VS,{view:`files`})})}),(0,X.jsx)(q,{path:`tasks/:id/graph`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Na,{tab:`changes`}),children:(0,X.jsx)(VS,{view:`graph`})})}),(0,X.jsx)(q,{path:`tasks/:id/commits`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Na,{tab:`changes`}),children:(0,X.jsx)(VS,{view:`commits`})})}),(0,X.jsx)(q,{path:`tasks/:id/notes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Na,{tab:`notes`}),children:(0,X.jsx)(BS,{})})}),(0,X.jsx)(q,{path:`tasks/:id/preview`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Na,{tab:`preview`}),children:(0,X.jsx)(VS,{view:`browser`})})}),(0,X.jsx)(q,{path:`tasks/:id/terminal`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Na,{tab:`terminal`}),children:(0,X.jsx)(VS,{view:`terminal`})})}),(0,X.jsx)(q,{path:`tasks/:id/commits/:sha`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Na,{tab:`changes`}),children:(0,X.jsx)(zS,{})})}),(0,X.jsx)(q,{path:`compare/:groupId`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Vh,{}),children:(0,X.jsx)(RS,{})})}),(0,X.jsx)(q,{path:`git`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(A_,{}),children:(0,X.jsx)(HS,{tab:`changes`})})}),(0,X.jsx)(q,{path:`git/commits`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(A_,{}),children:(0,X.jsx)(HS,{tab:`commits`})})}),(0,X.jsx)(q,{path:`git/commits/:sha`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(A_,{}),children:(0,X.jsx)(HS,{tab:`commits`})})}),(0,X.jsx)(q,{path:`git/branches`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(A_,{}),children:(0,X.jsx)(HS,{tab:`branches`})})}),(0,X.jsx)(q,{path:`git/files`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(A_,{}),children:(0,X.jsx)(HS,{tab:`files`})})}),(0,X.jsx)(q,{path:`git/files/*`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(A_,{}),children:(0,X.jsx)(HS,{tab:`files`})})}),(0,X.jsx)(q,{path:`github`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Hh,{}),children:(0,X.jsx)(US,{view:`issues`,index:!0})})}),(0,X.jsx)(q,{path:`tracker`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(XS,{}),children:(0,X.jsx)(WS,{})})}),(0,X.jsx)(q,{path:`tracker/:id`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(XS,{}),children:(0,X.jsx)(WS,{})})}),(0,X.jsx)(q,{path:`github/prs`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Hh,{}),children:(0,X.jsx)(US,{view:`prs`})})}),(0,X.jsx)(q,{path:`github/issues/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Hh,{}),children:(0,X.jsx)(US,{view:`issues`})})}),(0,X.jsx)(q,{path:`github/prs/:n`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Hh,{}),children:(0,X.jsx)(US,{view:`prs`})})}),(0,X.jsx)(q,{path:`github/prs/:n/changes`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Hh,{}),children:(0,X.jsx)(US,{view:`prs`,changes:!0})})}),(0,X.jsx)(q,{path:`automations`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Bh,{}),children:(0,X.jsx)(qS,{})})}),(0,X.jsx)(q,{path:`automations/new`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Bh,{}),children:(0,X.jsx)(qS,{mode:`new`})})}),(0,X.jsx)(q,{path:`automations/:automationId`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Bh,{}),children:(0,X.jsx)(qS,{mode:`edit`})})}),(0,X.jsx)(q,{path:`automations/:automationId/log`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Bh,{}),children:(0,X.jsx)(qS,{mode:`log`})})}),(0,X.jsx)(q,{path:`skills`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(j_,{}),children:(0,X.jsx)(KS,{})})}),(0,X.jsx)(q,{path:`inbox`,element:(0,X.jsx)(dg,{})}),(0,X.jsx)(q,{path:`workflows`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(N_,{}),children:(0,X.jsx)(GS,{})})}),(0,X.jsx)(q,{path:`workflows/:name`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(N_,{}),children:(0,X.jsx)(GS,{})})}),(0,X.jsx)(q,{path:`workflows-new/*`,element:(0,X.jsx)(ur,{to:`/workflows`,replace:!0})}),(0,X.jsx)(q,{path:`settings`,element:(0,X.jsx)(ox,{scope:`project`,capabilities:e})}),(0,X.jsx)(q,{path:`settings/skills`,element:(0,X.jsx)(JS,{})}),(0,X.jsx)(q,{path:`settings/prompt-templates`,element:(0,X.jsx)(ur,{to:{pathname:`/settings/instructions`,hash:`#prompt-templates`},replace:!0})}),Sb(`project`,e).map(t=>(0,X.jsx)(q,{path:`settings/${t.id}`,element:(0,X.jsx)(rx,{section:t,scope:`project`,capabilities:e})},t.id)),Sb(`global`,e).map(e=>(0,X.jsx)(q,{path:`settings/${e.id}`,element:(0,X.jsx)(YS,{sectionId:e.id})},e.id)),(0,X.jsx)(q,{path:`*`,element:(0,X.jsx)(k_,{})})]}),(0,X.jsx)(q,{path:`/tasks`,element:(0,X.jsx)(SS,{})}),(0,X.jsx)(q,{path:`/dashboard`,element:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(`div`,{role:`status`,className:`p-6 text-sm text-muted-foreground`,children:`Loading dashboard…`}),children:(0,X.jsx)(LS,{})})}),(0,X.jsx)(q,{path:`/settings/global`,element:(0,X.jsx)(ox,{scope:`global`,capabilities:e})}),Sb(`global`,e).map(t=>(0,X.jsx)(q,{path:Ib(`global`,t.id),element:(0,X.jsx)(rx,{section:t,scope:`global`,capabilities:e})},t.id)),(0,X.jsx)(q,{path:`*`,element:(0,X.jsx)($S,{})})]})});function rC(e){let t=e?.repo;if(!t)return null;let n=t.root.replace(/[\\/]+$/,``).split(/[\\/]/).pop();return n?{name:n,branch:t.branch}:null}function iC(e){return e?.available===!0&&(e.status===`available`||e.status===`error`)}var aC=(0,Y.memo)(function({children:e}){let{pathname:t}=mr(),n=dr(),r=Dt(),i=I(),a=i.data?.branding,o=a!==void 0&&(a.name!==`cezar`||a.logoUrl!==null),s=k(!o&&i.data!==void 0),c=r.data?.capabilities.followups===!0,l=r.data?.capabilities.automations===!0,u=ie(c),d=iC(Se(n??``,n!==null).data),f=A().data,p=tC(t),m=f?.bootProject??r.data?.bootProject??null,h=Pe(n,m,(0,Y.useMemo)(()=>aa,[])),g=n!==null&&n===m,_=f?.projects.find(e=>e.id===n),v=f?.projects.find(e=>e.id===m),y=n===null?v?.tracker:_?.tracker,b=p.taskId,x=Fe(n??``,_!==void 0&&b!==null,f?.bootProject===n,(0,Y.useMemo)(()=>e=>{let t=b?e.find(e=>e.id===b):void 0;return t?he(t):void 0},[b])).data;kh({projectName:t===`/settings/global`||t.startsWith(`/settings/global/`)?null:_?.name??(g?rC(r.data)?.name??null:null),pageLabel:x??p.pageLabel,brandName:i.data?.branding.name,brandLogoUrl:i.data?.branding.logoUrl});let S=f&&f.projects.length>1?f:null,C=(0,Y.useMemo)(()=>rC(r.data),[r.data?.repo?.root,r.data?.repo?.branch]),w=(0,Y.useMemo)(()=>(0,X.jsx)(xm,{}),[]),T=(0,Y.useMemo)(()=>(0,X.jsx)(km,{}),[]),E=(0,Y.useMemo)(()=>(0,X.jsx)(sh,{}),[]),D=(0,Y.useMemo)(()=>(0,X.jsx)(gm,{}),[]),O=(0,Y.useMemo)(()=>S?(0,X.jsx)(hh,{projects:S.projects,bootProjectId:S.bootProject,inboxAvailable:c,automationsAvailable:l,inboxCount:u.data?.length??null,skillsUpdateAvailable:d}):void 0,[S,c,l,u.data?.length,d]),j=(0,Y.useMemo)(()=>(0,X.jsx)(Ch,{health:r.data}),[r.data]);return(0,X.jsxs)(dm,{children:[(0,X.jsx)(Tp,{repo:C,brandName:i.data?.branding.name??`cezar`,brandLogoUrl:i.data?.branding.logoUrl??null,version:r.data?.version??null,latestVersion:r.data?.latestVersion??null,starCount:!o&&s.data?.available?s.data.count??null:null,inboxCount:u.data?.length??null,unreadCount:h.data??null,skillsUpdateAvailable:d,forgeAvailable:r.data?.forge?.available===!0,inboxAvailable:c,automationsAvailable:l,tracker:y,banner:w,footerBanner:T,singleProject:r.data?.capabilities.singleProject===!0,taskQuickList:E,hostWidget:D,projectGroups:O,toolsMenu:j,children:e}),(0,X.jsx)(pf,{}),(0,X.jsx)(Kp,{})]})});function oC(){let e=mr(),t=A();return(0,Y.useEffect)(()=>{Tb(e)},[e]),(0,Y.useEffect)(()=>{let n=Ih(e,t.data);n!==null&&(zh(jh(),n)||Mh(n))},[e.hash,e.pathname,e.search,t.data]),null}function sC(){let e=V(),t=ry(Ue().data?.notifications).enabled,n=(0,Y.useRef)(t);n.current=t;let r=(0,Y.useRef)(new Map);return(0,Y.useEffect)(()=>{let t=x(z.runs.list()),i=e=>{let{entering:t,statuses:i}=ay(r.current,e);if(r.current=i,t.length!==0&&oy({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:iy()}))for(let e of t)cC(e)};return i(e.getQueryData(z.runs.list())),e.getQueryCache().subscribe(e=>{e.query.queryHash!==t||e.type!==`updated`||i(e.query.state.data)})},[e]),null}function cC(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=sy(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}function lC(e,t=!0){return hn({queryKey:[...R.dashboard,`insights`,e],enabled:t,staleTime:5e3,refetchInterval:t?15e3:!1,refetchIntervalInBackground:!1,retry:!1,queryFn:async({signal:t})=>Pn.parse(await o(await Tt.api.v1.workspace.dashboard.insights.$get({query:{period:e,tzOffsetMinutes:String(new Date().getTimezoneOffset())}},{init:{signal:t}}),`/workspace/dashboard/insights`))})}var uC=[`pointerdown`,`pointermove`,`keydown`,`wheel`,`touchstart`];function dC(){let e=document.activeElement;return e?e.isContentEditable||e.tagName===`TEXTAREA`||e.tagName===`INPUT`&&e.type!==`checkbox`:!1}var fC=()=>document.querySelector(`[role="dialog"],[role="alertdialog"]`)!==null;function pC(){let e=V(),t=I(),n=t.data?.branding,r=n!==void 0&&(n.name!==`cezar`||n.logoUrl!==null),i=k(t.data!==void 0&&!r),a=!r&&i.data?.available===!0,o=!r&&i.data?.available?i.data.count??null:null,[s,c]=(0,Y.useState)(!1),l=(0,Y.useRef)(a);l.current=a;let u=(0,Y.useRef)(new Map),d=(0,Y.useRef)(null),f=(0,Y.useRef)(0);return(0,Y.useEffect)(()=>{let t=x(z.runs.list()),n,r=()=>Df({now:Date.now(),visible:document.visibilityState===`visible`,focused:document.hasFocus(),lastInteractionAt:f.current,typing:dC(),dialogOpen:fC()}),i=()=>{let e=d.current;if(!(e===null||n)){if(Date.now()-e>18e5){d.current=null;return}r()&&(n=setTimeout(()=>{n=void 0;let e=Cf();if(!(d.current===null||!r()||!l.current)){if(!Tf(e,Date.now())){d.current=null;return}d.current=null,wf({...e,asks:e.asks+1,lastAskedAt:new Date().toISOString()}),c(!0)}},Sf))}},a=e=>{let{succeeded:t,statuses:n}=Af(u.current,e);u.current=n,!(!t||!l.current)&&(Ef(e)<3||Tf(Cf(),Date.now())&&(d.current=Date.now(),i()))},o=()=>{f.current=Date.now(),i()};for(let e of uC)window.addEventListener(e,o,{passive:!0});document.addEventListener(`visibilitychange`,i),window.addEventListener(`focus`,i),a(e.getQueryData(z.runs.list()));let s=e.getQueryCache().subscribe(e=>{e.query.queryHash!==t||e.type!==`updated`||a(e.query.state.data)});return()=>{s(),clearTimeout(n);for(let e of uC)window.removeEventListener(e,o);document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`focus`,i)}},[e]),r?null:(0,X.jsx)(hC,{open:s,onOpenChange:c,count:o})}function mC(e){let t=Cf();t&&wf({...t,outcome:e})}function hC({open:e,onOpenChange:t,count:n}){let r=lC(`30d`,e).data?.delivered,i=r&&r.completedTasks>0?[{label:`Tasks done`,n:r.completedTasks,value:r.completedTasks.toLocaleString(`en-US`)},{label:`PRs opened`,n:r.prsOpened,value:r.prsOpened.toLocaleString(`en-US`)},{label:`Lines written`,n:r.additions,value:`+${r.additions.toLocaleString(`en-US`)}`}].filter(e=>e.n>0):null;return(0,X.jsx)(Cr,{open:e,onOpenChange:t,children:(0,X.jsxs)(Ar,{"data-slot":`star-ask`,className:`gap-0 overflow-hidden p-0 sm:max-w-[440px]`,children:[(0,X.jsxs)(`div`,{className:`relative flex h-36 items-center justify-center overflow-hidden border-b bg-card-2`,children:[(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`absolute inset-0 bg-[radial-gradient(circle_at_22%_35%,color-mix(in_oklab,var(--accent-lime)_32%,transparent),transparent_55%),radial-gradient(circle_at_80%_70%,color-mix(in_oklab,var(--violet)_38%,transparent),transparent_55%)]`}),(0,X.jsxs)(`div`,{"aria-hidden":`true`,className:`relative flex items-center gap-4`,children:[(0,X.jsx)(Pf,{height:52,className:`text-foreground`}),(0,X.jsx)(`span`,{className:`flex size-12 items-center justify-center rounded-full border bg-card shadow-md`,children:(0,X.jsx)(Ic,{className:`size-6 fill-current text-pending-strong`})})]}),n!==null&&(0,X.jsxs)(`span`,{className:`absolute bottom-3 left-1/2 -translate-x-1/2 rounded-full border bg-card/80 px-2.5 py-0.5 font-mono text-[11px] text-muted-foreground backdrop-blur`,children:[`⭐ `,bf(n),` stars on GitHub`]})]}),(0,X.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`span`,{className:`section-mark block font-mono text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground`,children:`Open source · MIT`}),(0,X.jsx)(yr,{className:`text-xl font-semibold tracking-tight`,children:`Is cezar pulling its weight?`}),(0,X.jsx)(Or,{className:`text-sm leading-relaxed text-muted-foreground`,children:`cezar is free, open source and runs on your machine, with no account to create. A GitHub star is how other developers find it, and how we know what to keep building.`})]}),i&&(0,X.jsxs)(`div`,{className:`rounded-lg border bg-card-2 p-3`,children:[(0,X.jsx)(`span`,{className:`block font-mono text-[10.5px] uppercase tracking-[0.12em] text-soft-foreground`,children:`Your last 30 days with cezar`}),(0,X.jsx)(`dl`,{className:`mt-2 grid gap-2`,style:{gridTemplateColumns:`repeat(${i.length}, minmax(0, 1fr))`},children:i.map(e=>(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col-reverse`,children:[(0,X.jsx)(`dt`,{className:`text-xs text-soft-foreground`,children:e.label}),(0,X.jsx)(`dd`,{className:`truncate text-lg font-semibold tabular-nums`,children:e.value})]},e.label))})]}),(0,X.jsx)(W,{asChild:!0,className:`h-11 w-full text-sm font-semibold`,children:(0,X.jsxs)(`a`,{href:vf,target:`_blank`,rel:`noopener noreferrer`,onClick:()=>{mC(`starred`),t(!1)},children:[(0,X.jsx)(Ic,{className:`size-4 fill-current`,"aria-hidden":`true`}),`Star cezar on GitHub`,(0,X.jsx)(vr,{className:`size-4`,"aria-hidden":`true`})]})}),(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,X.jsx)(W,{variant:`ghost`,className:`min-h-11`,onClick:()=>t(!1),children:`Maybe later`}),(0,X.jsx)(W,{variant:`ghost`,className:`min-h-11 text-soft-foreground`,onClick:()=>{mC(`never`),t(!1)},children:`Don’t ask again`})]})]})]})})}function gC(){let[e]=(0,Y.useState)(Xs);return(0,X.jsx)(nt,{client:e,children:(0,X.jsx)(Fr,{children:(0,X.jsxs)(ji,{children:[(0,X.jsx)(sC,{}),(0,X.jsx)(pC,{}),(0,X.jsx)(fd,{children:(0,X.jsx)(Pv,{children:(0,X.jsxs)(lr,{children:[(0,X.jsx)(oC,{}),(0,X.jsx)(Pa,{}),(0,X.jsx)(Dr,{children:(0,X.jsx)(aC,{children:(0,X.jsx)(nC,{})})}),(0,X.jsx)(fr,{})]})})})]})})})}function _C(){return(document.querySelector(`meta[name="cez-api-base"]`)?.getAttribute(`content`))?.trim()||``}En(_C());var vC=document.getElementById(`root`);if(!vC)throw Error(`cezar: #root container is missing from index.html`);(0,Ys.createRoot)(vC).render((0,X.jsx)(Y.StrictMode,{children:(0,X.jsx)(gC,{})}));export{Rc as A,Bf as C,zu as D,Xu as E,ic as F,Nc as M,Mc as N,Iu as O,jc as P,zf as S,Lf as T,Zh as _,A_ as a,Vh as b,Xg as c,og as d,ag as f,qh as g,Xh as h,N_ as i,Fc as j,Bc as k,qg as l,Qh as m,cx as n,Zg as o,tg as p,Ib as r,Jg as s,lC as t,sg as u,Jh as v,Rf as w,If as x,Hh as y};
|