@wjarka/cezarion 0.18.0-dev.7675 → 0.18.0-dev.7685
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/package.json +2 -2
- package/web/dist/assets/{activity-motion-D9kDOQdA.js → activity-motion-DjV4Xoms.js} +1 -1
- package/web/dist/assets/{activity-route-CZsGE2kr.js → activity-route-CeDmVBg_.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-BuON_M0j.js → commit-diff-panel-BkPuLrzW.js} +1 -1
- package/web/dist/assets/{diff-Db5bcfH_.js → diff-BBZcIIOt.js} +2 -2
- package/web/dist/assets/{diff-view-DqlLiU5V.js → diff-view-DUNXpfvw.js} +1 -1
- package/web/dist/assets/{file-preview-DSnLzP2A.js → file-preview-QFfT9j-q.js} +1 -1
- package/web/dist/assets/{git-toolbar-WHsIb3zj.js → git-toolbar-Bd54EFZj.js} +1 -1
- package/web/dist/assets/{github-BZSy7bl0.js → github-D1ZGYZ6k.js} +1 -1
- package/web/dist/assets/{global-activity-route-BPvST6Do.js → global-activity-route-BVmBGVep.js} +1 -1
- package/web/dist/assets/{index-DmUnZuj2.js → index-Eo2qZksq.js} +5 -5
- package/web/dist/assets/{markdown-EqokmdNx.js → markdown-B6DqG9Ie.js} +1 -1
- package/web/dist/assets/{picker-pill-DP8YY8yK.js → picker-pill-Dbb3GY1a.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-DePVzNAm.js → preview-pane-connected-DHH1E04c.js} +1 -1
- package/web/dist/assets/{prompt-template-menu-DhXONhoB.js → prompt-template-menu-Dc2ufWt7.js} +1 -1
- package/web/dist/assets/{repo-git-CWn2Z4Un.js → repo-git-DyuGJJ8w.js} +1 -1
- package/web/dist/assets/{report-reader-RkXaRhiv.js → report-reader-TX7SV7cO.js} +1 -1
- package/web/dist/assets/{reports-CiU1cLpn.js → reports-DC4T6nCI.js} +1 -1
- package/web/dist/assets/{run-header-z48y-i75.js → run-header-CZANvy6Z.js} +1 -1
- package/web/dist/assets/{skills-BeZ9naR_.js → skills-DAe4cSA-.js} +1 -1
- package/web/dist/assets/{task-changes-R9UrXbyp.js → task-changes-Fj_aEo7v.js} +1 -1
- package/web/dist/assets/{task-commits-BgwKBJPa.js → task-commits-B0Ezfa9a.js} +1 -1
- package/web/dist/assets/{task-files-BuoYB5UQ.js → task-files-HfwuKxjl.js} +1 -1
- package/web/dist/assets/{task-github-item-DQ_suCNz.js → task-github-item-B8bv9VSp.js} +1 -1
- package/web/dist/assets/{task-thread-B7GO7yjQ.js → task-thread-Bm755mTM.js} +1 -1
- package/web/dist/assets/{thread-state-DSb5VKd8.js → thread-state-CJEzn845.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-C6FNQ2e0.js → use-hand-to-agent-state-CUbaxdrd.js} +1 -1
- package/web/dist/assets/{workflows-b6WsU1qg.js → workflows-DMaQulmN.js} +1 -1
- package/web/dist/index.html +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html-BY76lXLH.js","assets/css-BsVw1vtW.js","assets/javascript-BgS3c2Ky.js","assets/core-DzoyrHjB.js","assets/lib-DrPFkMXk.js","assets/rolldown-runtime-QTnfLwEv.js","assets/preview-pane-connected-
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r,t as i}from"./react-runtime-CCIEwYL0.js";import{C as a,D as o,E as s,M as c,O as l,P as u,T as d,_ as f,a as p,b as m,c as h,d as g,f as _,g as v,h as y,i as b,j as x,k as S,l as C,m as w,n as T,p as E,r as D,s as O,t as k,v as A,w as j,x as M,y as ee}from"./button-C1fD-ZFr.js";import{n as te,r as ne}from"./live-refetch-CZb2VOyu.js";import{$ as re,$r as ie,An as N,Ar as P,Bn as F,C as ae,Cn as oe,Cr as se,Ct as ce,E as le,En as ue,Er as de,Fr as fe,G as pe,Gn as me,Hn as he,Hr as ge,Ht as _e,Ir as ve,It as ye,Jt as be,K as xe,Lr as Se,Mn as Ce,Mr as we,Mt as Te,Nn as Ee,Nt as De,O as Oe,Ot as ke,Pr as Ae,Rn as je,Rr as Me,Si as Ne,St as Pe,Tn as Fe,Tr as Ie,U as Le,Un as Re,Ur as ze,Ut as Be,V as Ve,Vn as He,Vt as Ue,W as We,Wn as Ge,Wt as Ke,Xn as qe,Xt as Je,Yn as Ye,Yt as Xe,_ as Ze,_i as Qe,_r as $e,a as et,ar as tt,b as nt,bi as rt,ci as it,d as at,ei as I,fi as ot,fn as st,gn as ct,gr as lt,gt as ut,hi as dt,in as ft,kn as pt,li as mt,lr as ht,m as gt,mi as _t,mn as vt,mt as yt,n as bt,ni as xt,nr as St,o as Ct,on as wt,or as Tt,p as Et,pi as Dt,pn as Ot,pt as kt,qn as At,qt as jt,r as Mt,s as Nt,si as Pt,sr as Ft,t as It,ti as Lt,tr as Rt,ui as zt,ur as Bt,vr as Vt,w as Ht,wn as Ut,wr as Wt,xi as Gt,xr as Kt,xt as qt,yn as Jt,yr as Yt,zn as Xt,zr as Zt}from"./project-scope-context-DMCS5p-N.js";import{A as Qt,H as $t,I as L,K as en,L as R,M as tn,N as nn,O as z,R as rn,U as an,V as B,j as on,q as sn,z as cn}from"./live-protocol-DKHlCFyG.js";import{t as ln}from"./useInfiniteQuery-CvdGA_PU.js";import{At as un,B as dn,Ct as fn,Dt as pn,Et as mn,Ft as hn,G as gn,Gt as _n,H as vn,Ht as yn,J as bn,Jt as xn,K as Sn,Kt as Cn,L as wn,Lt as Tn,M as En,Mt as Dn,N as On,O as kn,Ot as An,P as jn,Pt as V,Q as Mn,Rt as Nn,S as Pn,St as Fn,Tt as In,U as Ln,Ut as Rn,V as zn,W as Bn,Wt as Vn,X as Hn,Xt as Un,Y as Wn,Yt as H,Z as Gn,_ as Kn,a as qn,bt as Jn,d as Yn,dt as Xn,et as Zn,f as Qn,g as $n,h as er,i as tr,it as nr,jt as rr,kt as ir,m as ar,n as or,nt as sr,o as cr,ot as lr,p as ur,q as dr,qt as fr,r as pr,rt as mr,s as hr,t as U,tt as gr,ut as _r,v as vr,wt as yr,xt as br,yt as xr,z as Sr,zt as Cr}from"./queries-DHY6U3e_.js";import{t as wr}from"./useQuery-BJFZunTR.js";import{i as W}from"./bundle-mjs-BT31bpU6.js";import{i as Tr,r as Er,t as Dr}from"./cez-idle-D1rXzVuh.js";import{A as Or,B as kr,C as Ar,D as jr,F as Mr,G as Nr,H as Pr,I as Fr,K as Ir,L as Lr,M as Rr,N as zr,O as Br,P as Vr,Q as Hr,R as Ur,S as Wr,T as Gr,U as Kr,V as qr,W as Jr,X as Yr,Y as Xr,Z as Zr,a as Qr,c as $r,d as ei,g as ti,h as ni,i as ri,j as ii,k as ai,l as oi,m as si,n as ci,o as li,p as ui,q as di,r as fi,s as pi,t as mi,tt as hi,u as gi,v as _i,w as vi,x as yi,y as bi,z as xi}from"./use-desktop-EnHXg46f.js";import{t as Si}from"./ws-BxsIvFCG.js";import{n as G,t as Ci}from"./toaster-Cxgzn9ip.js";import{i as wi,n as Ti,o as Ei,r as Di,s as Oi,t as ki}from"./runners-C-sPUQye.js";import{$ as Ai,A as ji,B as Mi,C as Ni,D as Pi,E as Fi,F as Ii,G as Li,I as Ri,J as zi,K as Bi,L as Vi,O as Hi,Q as Ui,R as Wi,T as Gi,U as Ki,V as qi,W as Ji,X as Yi,Y as Xi,Z as Zi,c as Qi,ct as $i,d as ea,dt as ta,et as na,ft as ra,g as ia,h as aa,i as oa,it as sa,j as ca,k as la,l as ua,n as da,nt as fa,o as pa,ot as ma,p as ha,pt as ga,r as _a,rt as va,s as ya,t as ba,tt as xa,u as Sa,ut as Ca,v as wa,x as Ta,y as Ea,z as Da}from"./design-icons-B6-0w7Aw.js";import{t as K}from"./createLucideIcon-BHp8sXmF.js";import{_ as Oa,a as ka,c as Aa,d as ja,f as Ma,g as Na,h as Pa,i as Fa,m as Ia,o as La,p as Ra,r as za,s as Ba,u as Va,y as Ha}from"./nav-row-styles-CFjnD-9J.js";import{t as Ua}from"./eye-B8okNWXU.js";import{a as Wa,i as Ga,n as Ka,r as qa,t as Ja}from"./format-BNCkW110.js";import{t as Ya}from"./play-CmVAj_fu.js";import{a as Xa,i as Za,l as Qa,r as $a,s as eo,t as to,u as no}from"./reference-chip-BKeVxG_E.js";import{a as ro,c as io,d as ao,f as oo,h as q,i as so,l as co,m as lo,n as uo,o as fo,p as J,r as po,t as mo,u as ho}from"./es2015-Ch36azR0.js";import{C as go,S as _o,_ as vo,a as yo,b as bo,c as xo,d as So,f as Co,g as wo,h as To,i as Eo,l as Do,m as Oo,o as ko,p as Ao,r as jo,s as Mo,t as No,u as Po,v as Fo,w as Io,x as Lo,y as Ro}from"./dropdown-menu-DRFDwG2X.js";import{a as zo,c as Bo,i as Vo,l as Ho,n as Uo,o as Wo,r as Go,s as Ko,t as qo}from"./dist-Du8mGhoH.js";import{a as Jo,i as Yo,n as Xo,o as Zo,r as Qo,s as $o,t as es}from"./dialog-DSwzMeY3.js";import{a as ts,c as ns,d as rs,g as is,h as as,i as os,l as ss,o as cs,p as ls,r as us,s as ds,t as fs,u as ps,y as ms}from"./prompt-template-menu-DhXONhoB.js";import{a as hs,c as gs,i as _s,l as vs,n as ys,o as bs,r as xs,s as Ss,t as Y}from"./project-router-LT30LjzY.js";import{t as Cs}from"./attention-zJ-ho5os.js";import{A as ws,C as Ts,D as Es,E as Ds,F as Os,L as ks,M as As,N as js,O as Ms,P as Ns,S as Ps,T as Fs,_ as Is,a as Ls,b as Rs,c as zs,d as Bs,g as Vs,h as Hs,i as Us,j as Ws,k as Gs,l as Ks,m as qs,n as Js,o as Ys,p as Xs,r as Zs,s as Qs,t as $s,u as ec,v as tc,w as nc,x as rc,y as ic}from"./picker-pill-DP8YY8yK.js";import{_ as ac,a as oc,c as sc,d as cc,f as lc,g as uc,i as dc,l as fc,n as pc,o as mc,p as hc,r as gc,t as _c,u as vc,v as yc}from"./sortable.esm-zp_qkYGV.js";import{c as bc,d as xc,f as Sc,i as Cc,n as wc,o as Tc,p as Ec,r as Dc,t as Oc,u as kc}from"./skills-pM_PouEs.js";import{t as X}from"./centered-state-CiiA8Vgw.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 Ac=class extends Ne{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 Un({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=jc(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=jc(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=jc(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=jc(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){sn.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=>ot(t,e))}findAll(e={}){return this.getAll().filter(t=>ot(e,t))}notify(e){sn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return sn.batch(()=>Promise.all(e.map(e=>e.continue().catch(_t))))}};function jc(e){return e.options.scope?.id}var Mc=class extends Ne{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??zt(r,t),a=this.get(i);return a||(a=new xt({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(){sn.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=>Dt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Dt(e,t)):t}notify(e){sn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){sn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){sn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Nc=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Mc,this.#t=e.mutationCache||new Ac,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Gt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Pt.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(Qe(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=it(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return sn.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;sn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return sn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=sn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(_t).catch(_t)}invalidateQueries(e,t={}){return sn.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=sn.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(_t)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(_t)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Qe(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_t).catch(_t)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_t).catch(_t)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Pt.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(mt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{dt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(mt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{dt(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||=zt(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===rt&&(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()}},Z=e(t(),1),Pc=n(),Fc=class extends EventTarget{readyState=0;release;constructor(e,t){super(),this.release=this.subscribe()}subscribe(){let e=()=>queueMicrotask(()=>{this.readyState===0&&(this.readyState=1,this.dispatchEvent(new Event(`open`)))});return Ae({kind:`workspace`},{ready:e,reset:()=>{this.readyState!==2&&(this.readyState=0,e())},frame:t=>{if(`data`in t&&t.event===`reconnect`){this.readyState=0,e();return}if(`data`in t&&t.event===`disconnect`){this.readyState===1&&(this.readyState=0,this.dispatchEvent(new Event(`error`)));return}`data`in t&&t.event===`ready`&&fe(),`data`in t&&this.dispatchEvent(new MessageEvent(t.event,{data:t.data}))}})}requestReady(){return this.readyState!==2&&we()}close(){this.readyState=2,this.release()}};R({runs:nn(`summary`).optional()});var Ic=B().min(1),Lc=L().int().positive(),Rc=R({project:Ic,seq:Lc,run:Ge,relationships:B().min(1)}),zc=R({project:Ic,seq:Lc,id:B().min(1)}),Bc=R({generation:B().min(1),seq:L().int().nonnegative()}),Vc=R({project:Ic,usage:cn(B(),He)});R({runs:Qt(Re),referenceStatuses:he,perProjectLimit:L(),truncated:Qt(B()),generation:B().min(1),eventSeq:L().int().nonnegative()});function Hc(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}switch(e){case`run-summary`:{let e=Rc.safeParse(n);return e.success?{project:e.data.project,event:{type:`run-summary`,summary:e.data.run,seq:e.data.seq,relationships:e.data.relationships}}:null}case`run-deleted`:{let e=zc.safeParse(n);return e.success?{project:e.data.project,event:{type:`run-deleted`,id:e.data.id,seq:e.data.seq}}:null}case`usage`:{let e=Vc.safeParse(n);return e.success?{project:e.data.project,event:{type:`usage`,usage:e.data.usage}}:null}case`ready`:{let e=Bc.safeParse(n);return e.success?{project:null,event:{type:`ready`,generation:e.data.generation,seq:e.data.seq}}:null}default:return null}}function Uc(){let e;return{ready(t){let n=e!==void 0&&t>e;return e=t,n},frame(t){let n=e!==void 0&&t!==e+1;return e=t,n},reset(){e=void 0}}}function Wc(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=[...e];return r[n]=t,r}let r=e.findIndex(e=>(e.createdAt??``).localeCompare(t.createdAt)<0),i=[...e];return i.splice(r<0?e.length:r,0,t),i}function Gc(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}var Kc=Object.freeze({});function qc(){let e=Kc,t=new Set;return{subscribe(e){return t.add(e),()=>t.delete(e)},get:()=>e,set(n){e=n;for(let e of t)e()}}}function Jc(e,t){let n=e.getQueryData(t);if(n?.finishBlocked===void 0)return;let{finishBlocked:r,...i}=n;e.setQueryData(t,i)}function Yc(e){let t=new Map,n=t=>e.getQueryCache().find({queryKey:t,exact:!0}),r=t=>{if(!t.owed||t.timer!==void 0)return;let i=n(t.key);if(!i){t.owed=!1;return}if(!i.isActive()){t.owed=!1,e.invalidateQueries({queryKey:t.key,exact:!0,refetchType:`none`});return}if(i.state.fetchStatus!==`idle`)return;let a=t.lastStart+400-Date.now();if(a>0){t.timer=setTimeout(()=>{t.timer=void 0,r(t)},a);return}t.owed=!1,t.lastStart=Date.now(),e.refetchQueries({queryKey:t.key,exact:!0,type:`active`},{cancelRefetch:!1})},i=e.getQueryCache().subscribe(n=>{if(n.type!==`updated`||t.size===0)return;let i=t.get(JSON.stringify(n.query.queryKey));if(i){if(n.action.type===`success`&&!n.action.manual){let t=n.query.promise;t&&i.preEvent.has(t)&&(i.preEvent.delete(t),Jc(e,i.key),i.owed=!0)}n.query.state.fetchStatus===`idle`&&r(i)}});return{onEvent(i){let a=U.runs.detail(i),o=n(a);if(!o)return;let s=JSON.stringify(a),c=t.get(s);c||(c={key:a,owed:!1,lastStart:0,preEvent:new WeakSet},t.set(s,c)),o.state.fetchStatus!==`idle`&&o.promise&&c.preEvent.add(o.promise),Jc(e,a),c.owed=!0,r(c)},forget(e){let n=JSON.stringify(U.runs.detail(e));clearTimeout(t.get(n)?.timer),t.delete(n)},cancel(){i();for(let e of t.values())clearTimeout(e.timer);t.clear()}}}function Xc(e){let t=new Map;return{refresh(n){let r=U.runs.detail(n);if(!e.getQueryState(r))return;let i=JSON.stringify(r);clearTimeout(t.get(i)),e.cancelQueries({queryKey:r}),t.set(i,setTimeout(()=>{t.delete(i),e.invalidateQueries({queryKey:r})},400))},cancel(){for(let e of t.values())clearTimeout(e);t.clear()}}}var Q=i(),Zc=S(`/workspace/events?runs=summary`),Qc=2,$c=3e3,el=[`run-summary`,`run-deleted`,`usage`,`ping`,`ready`],tl=[`project-added`,`project-removed`,`checkout-progress`,`automation-change`,`project-ready`],nl=new Set;function rl(e){return nl.add(e),()=>{nl.delete(e)}}function il(e){return e[1]===`runs`&&e[2]===`list`}function al(e,t){return e.cancelQueries({queryKey:t}).then(()=>e.invalidateQueries({queryKey:t}))}function ol(e){return e.invalidateQueries({predicate:e=>il(e.queryKey),refetchType:`none`}),e.getQueryCache().findAll({predicate:e=>il(e.queryKey)&&(e.state.data!==void 0||e.state.fetchStatus!==`idle`)}).map(t=>al(e,t.queryKey))}var sl=1e3,cl=new WeakMap;function ll(e){let t=U.repoBranches,n=cl.get(e);if(n){n.set(JSON.stringify(t),t);return}cl.set(e,new Map([[JSON.stringify(t),t]])),setTimeout(()=>{let t=cl.get(e);cl.delete(e);for(let n of t?.values()??[])e.invalidateQueries({queryKey:n})},sl)}function ul(e,t,n=!1){if(t?.aborted)return Promise.resolve();let r=[U.runs.all,V.runsIndex,V.projects,U.health,U.worktrees,U.repoBranches,V.providerStatus],i=()=>{for(let t of r)e.cancelQueries({queryKey:t})};return t?.addEventListener(`abort`,i,{once:!0}),Tr(()=>{for(let t of e.getQueryCache().findAll({predicate:e=>il(e.queryKey)}))t.state.data===void 0&&t.state.fetchStatus!==`idle`&&e.cancelQueries({queryKey:t.queryKey,exact:!0});return[e.invalidateQueries({queryKey:U.runs.all,...n?{predicate:e=>[`list`,`detail`,`relationships`,`archived`].includes(String(e.queryKey[2]))}:{}}),e.invalidateQueries({predicate:e=>il(e.queryKey)}),yn(e).reconcile(),e.invalidateQueries({queryKey:V.projects}),al(e,U.health),e.invalidateQueries({queryKey:U.worktrees}),e.invalidateQueries({queryKey:U.repoBranches}),e.invalidateQueries({queryKey:V.providerStatus}),n?void 0:e.invalidateQueries({predicate:({queryKey:e})=>e.length===3&&e[1]===`github`&&(e[2]===null||typeof e[2]==`number`)})]}).finally(()=>t?.removeEventListener(`abort`,i))}function dl(e){return x()??fl(e)}function fl(e){let t=e.getQueryData(V.projects)?.bootProject;return typeof t==`string`&&t!==``?t:e.getQueryData(U.health)?.bootProject??e.getQueryData([`default`,`health`])?.bootProject}function pl(e,t){return[fr({projectId:e,boot:e===t}).cacheScope,`runs`,`list`]}function ml(e){let t=new Map,n=new Map,r=t=>{let r=n.get(JSON.stringify(t));if(!r)return;let i=e.getQueryCache().find({queryKey:t,exact:!0}),a=i?.promise;r.phase=`awaiting-fetch`,r.dirty=!1,e.invalidateQueries({queryKey:t,exact:!0}),i?.promise&&i.promise!==a&&(r.phase=`fetching`)},i=e.getQueryCache().subscribe(t=>{if(!n.size||t.type!==`updated`)return;let i=JSON.stringify(t.query.queryKey),a=n.get(i);if(a){if(t.action.type===`setState`){t.query.state.isInvalidated||e.invalidateQueries({queryKey:a.key,exact:!0,refetchType:`none`});return}if(t.action.type===`fetch`){a.phase===`awaiting-fetch`&&(a.phase=`fetching`),a.dirty=!1;return}if(t.action.type===`success`){if(!t.action.manual){a.phase===`fetching`&&!a.dirty?n.delete(i):r(a.key);return}a.phase!==`needs-start`&&(a.phase===`fetching`&&(a.dirty=!0),e.invalidateQueries({queryKey:a.key,exact:!0},{cancelRefetch:!1}))}}}),a=(t,r)=>{let i=JSON.stringify(t),a=e.getQueryCache().find({queryKey:t,exact:!0});if(!a)return;let o=n.get(i);!o&&(a.state.fetchStatus!==`idle`||a.state.isInvalidated)||o&&a.state.fetchStatus===`idle`?(n.set(i,{key:t,phase:`needs-start`,dirty:!1}),a.state.fetchStatus!==`idle`&&e.cancelQueries({queryKey:t,exact:!0}),r.some(e=>JSON.stringify(e)===i)||r.push(t)):o?.phase===`fetching`&&(o.dirty=!0)},o,s,c=(i=!1)=>{s!==void 0&&clearTimeout(s),s=void 0,o!==void 0&&cancelAnimationFrame(o),o=void 0;let c=[];for(let{key:r,baseList:i,baseQuery:o,baseUpdateCount:s,runs:l}of t.values()){let t=e.getQueryCache().find({queryKey:r,exact:!0});if(t!==o||t?.state.dataUpdateCount!==s||t?.state.data!==i){c.push(r),n.set(JSON.stringify(r),{key:r,phase:`needs-start`,dirty:!1}),e.cancelQueries({queryKey:r,exact:!0});continue}a(r,c),e.setQueryData(r,e=>{let t=e;for(let e of l.values())t=Wc(t,e);return t})}if(t.clear(),!i)for(let e of c)r(e);return c},l=t=>{let n=[pl(t,fl(e))],r=[t,`runs`,`list`];return(t===dl(e)||e.getQueryState(r))&&n.push(r),t===dl(e)&&n.push(U.runs.list()),[...new Map(n.map(e=>[JSON.stringify(e),e])).values()]};return{onEvent(i,u){let d=l(i);if(u.type===`run-summary`&&u.summary.archived&&d.every(t=>!e.getQueryData(t)?.find(e=>e.id===u.summary.id)?.archived)&&u.type===`run-summary`){for(let r of d){let i=JSON.stringify(r),a=n.get(i);a?.phase===`fetching`&&(a.dirty=!0);let o=t.get(i);if(!o){let n=e.getQueryCache().find({queryKey:r,exact:!0});o={key:r,baseList:n?.state.data,baseQuery:n,baseUpdateCount:n?.state.dataUpdateCount,runs:new Map},t.set(i,o)}o.runs.set(u.summary.id,u.summary)}s===void 0&&(s=setTimeout(()=>{c()},50),typeof requestAnimationFrame==`function`&&(o=requestAnimationFrame(()=>{c()})));return}let f=c(!0);for(let t of d)a(t,f),u.type===`run-summary`?e.setQueryData(t,e=>Wc(e,u.summary)):e.setQueryData(t,e=>Gc(e,u.id));for(let e of f)r(e)},flush:c,cancel(){i(),n.clear()}}}var hl=400;function gl(e){let t=new Map,n=new Map,r=(t,r)=>{if(r&&!e.getQueryState(t))return;let i=JSON.stringify(t);n.has(i)||n.set(i,setTimeout(()=>{n.delete(i),e.invalidateQueries({queryKey:t})},hl))};return{onSummary(e,n){let i=e.delegation?.role===`worker`?e.delegation.parentRunId:void 0,a=e.delegation?.role===`worker`?e.delegation.supervisorRunId:void 0,o=t.get(e.id);if(t.set(e.id,{shape:n,...i===void 0?{}:{parentRunId:i},...a===void 0?{}:{supervisorRunId:a}}),o?.shape!==n){r(U.runs.relationships(e.id),!0);for(let e of[i,a])e!==void 0&&r(U.runs.relationships(e),!0)}},onDeleted(n){let i=t.get(n);t.delete(n),e.removeQueries({queryKey:U.runs.relationships(n)}),i?.supervisorRunId!==void 0&&r(U.runs.relationships(i.supervisorRunId),!0),i?.parentRunId===void 0?r([...U.runs.all,`relationships`],!1):r(U.runs.relationships(i.parentRunId),!0)},cancel(){for(let e of n.values())clearTimeout(e);n.clear(),t.clear()}}}var _l={predicate:e=>e.queryKey[1]===`runs`&&e.queryKey[2]===`archived`};function vl(e,t){if(t.delegation?.role===`worker`)return;let n=!1;for(let r of e.getQueryCache().findAll(_l)){let i=r.state.data;i&&(i.pages.some(e=>e.runs.some(e=>e.id===t.id))?(e.setQueryData(r.queryKey,{...i,pages:i.pages.map(e=>({...e,runs:e.runs.map(e=>e.id===t.id?t:e)}))}),(!t.archived||r.queryKey[3]!==``)&&(n=!0)):t.archived&&(n=!0))}n&&e.invalidateQueries(_l)}function yl(e,t,n,r,i){switch(n.type){case`run-summary`:{let t=n.summary;if(vl(e,t),i.onSummary(t,n.relationships),r.fetcher.onEvent(t.id),t.delegation?.role===`worker`){let n=t.delegation.parentRunId;Jc(e,U.runs.detail(n)),r.refreshParent(n)}let a=U.runs.changes(t.id);e.getQueryData(a)!==void 0&&e.invalidateQueries({queryKey:a}),e.invalidateQueries({queryKey:U.worktrees}),ll(e);return}case`run-deleted`:i.onDeleted(n.id),r.fetcher.forget(n.id),e.removeQueries({queryKey:U.runs.detail(n.id)}),e.removeQueries({queryKey:U.runs.diff(n.id)}),e.setQueriesData(_l,e=>e&&e.pages.some(e=>e.runs.some(e=>e.id===n.id))?{...e,pages:e.pages.map(e=>({...e,runs:e.runs.filter(e=>e.id!==n.id)}))}:e),e.invalidateQueries(_l),e.invalidateQueries({queryKey:U.worktrees}),ll(e);return;case`usage`:t.set(n.usage);return;case`ping`:case`ready`:return}}function bl(e,t=Zc){let n=I();(0,Z.useEffect)(()=>{let r=Fc;if(typeof r!=`function`)return;let i=null,a=yn(n);a.setUnknownGenerationHandler(()=>{let e=i?.requestReady;return typeof e==`function`&&e.call(i)});let o=Xc(n),s=Yc(n),c={fetcher:s,refreshParent:o.refresh},l=Uc(),u=ml(n),d=gl(n),f=!1,p,m=!1,h=!1,g=!1,_=!1,v=()=>{g=!0,_=!1;let e=V.providerStatus;n.cancelQueries({queryKey:e,exact:!0}).then(()=>n.invalidateQueries({queryKey:e,exact:!0,refetchType:`active`})).finally(()=>{if(h||!_){g=!1;return}v()})},y=()=>{h||p!==void 0||(p=setTimeout(()=>{p=void 0,h||b()},$c))},b=()=>{i?.close(),i=new r(t,{withCredentials:!0}),i.addEventListener(`open`,()=>{f=!0,l.reset(),a.detach(),Er(!1),m&&(u.flush(),ul(n)),m||(Tr(()=>ol(n)),n.cancelQueries({queryKey:U.health}).then(()=>{h||n.invalidateQueries({queryKey:U.health})}),a.reconcile()),m=!0});for(let t of el)i.addEventListener(t,r=>{let i=Hc(t,r.data);if(!i)return;if(i.event.type===`ready`){let e=l.ready(i.event.seq);a.ready(i.event.generation,i.event.seq),e&&(u.flush(),ul(n));return}let o=(i.event.type===`run-summary`||i.event.type===`run-deleted`)&&l.frame(i.event.seq);i.event.type===`ping`&&f&&(f=!1,Tr(()=>ol(n)),Er(!0)),i.project!==null&&(i.event.type===`run-summary`||i.event.type===`run-deleted`?a.run(i.project,i.event,o):i.event.type===`usage`&&a.usage(i.project,i.event.usage)),i.project!==null&&(i.event.type===`run-summary`||i.event.type===`run-deleted`)&&u.onEvent(i.project,i.event),(i.project===null||i.project===dl(n))&&yl(n,e,i.event,c,d),o&&(u.flush(),ul(n))});for(let e of tl)i.addEventListener(e,t=>{let r;try{r=JSON.parse(t.data)}catch{return}if(e===`project-ready`?a.reconcile({hold:!0}):e!==`checkout-progress`&&e!==`automation-change`&&n.invalidateQueries({queryKey:V.projects}),e===`project-added`){let e=r?.project?.id;typeof e==`string`&&e!==``&&a.restoreProject(e),a.reconcile({hold:!0})}if(e===`project-removed`){let e=r?.id;typeof e==`string`&&e!==``&&a.dropProject(e)}for(let t of[...nl])t(e,r)});i.addEventListener(`health`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=Zt.safeParse(t);r.success&&(n.cancelQueries({queryKey:U.health}),n.setQueryData(U.health,r.data))}),i.addEventListener(`provider-status`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=se(t);if(!r)return;let i=V.providerStatus,a=Kt(n.getQueryData(i),r);if(a!==void 0){n.setQueryData(i,a);return}if(g){_=!0;return}v()}),i.addEventListener(`error`,()=>{Er(!1),a.detach(),i?.readyState===Qc&&y()})},x=()=>{document.visibilityState===`visible`&&(u.flush(),a.flush(),(!i||i.readyState===Qc)&&(clearTimeout(p),p=void 0,b()))},S=()=>{clearTimeout(p),p=void 0,u.flush()};document.addEventListener(`visibilitychange`,x),window.addEventListener(`pagehide`,S);let C=P((e,t)=>(u.flush(),ul(n,e,t)));return b(),()=>{C(),h=!0,Er(!1),clearTimeout(p),u.flush(),u.cancel(),a.stop(),o.cancel(),s.cancel(),a.setUnknownGenerationHandler(void 0),d.cancel(),document.removeEventListener(`visibilitychange`,x),window.removeEventListener(`pagehide`,S),i?.close(),i=null}},[n,e,t])}var xl=(0,Z.createContext)(null);function Sl({children:e}){let[t]=(0,Z.useState)(qc);return bl(t),On(),(0,Q.jsx)(xl.Provider,{value:t,children:e})}function Cl(e){let t=(0,Z.useContext)(xl),n=t?t.get:Tl;return(0,Z.useSyncExternalStore)(t?t.subscribe:wl,()=>e?n()[e]:void 0,()=>void 0)}var wl=()=>()=>void 0,Tl=()=>Kc,El=B().regex(/^(?:(?:config\.json(?:\.bak)?|agent-accounts\.json|ui-state\.json|server\.json|server\.install\.lock)|(?:remote-settings|server-instances)\/[a-zA-Z0-9-]+\.(?:json|install\.lock))$/),Dl=R({file:El,detectedAt:en(),canRestore:on()}),Ol=[`reset`,`outside-write`,`legacy-change`],kl=R({files:Qt(tn(`reason`,[Dl.extend({reason:nn(`reset`)}),Dl.extend({reason:nn(`outside-write`)}),Dl.extend({reason:nn(`legacy-change`),canImport:on()})]))});function Al(e,t){return!e||typeof e!=`object`||!(`files`in e)||!Array.isArray(e.files)?e:{...e,files:e.files.filter(e=>!(e&&typeof e==`object`&&`reason`in e&&typeof e.reason==`string`&&!t.includes(e.reason)))}}var jl=rn(e=>Al(e,Ol),kl);R({file:El,detectedAt:en()}).strict();async function Ml(e,t,n){n.throwIfAborted();let r=new Lt(e,{queryKey:t.queryKey,queryFn:t.queryFn,retry:!1,enabled:!1}).subscribe(()=>void 0);n.addEventListener(`abort`,r,{once:!0});try{return await e.fetchQuery({...t,retry:!1})}finally{n.removeEventListener(`abort`,r),r()}}var Nl=[`workspace`,`home-recovery`];function Pl(e){let t=jl.safeParse(e);if(!t.success)throw new et(200,`the Squawk server answered /home/recovery with an unexpected body`);return t.data}async function Fl(e){return Pl(await ct(await Et.api.v1.home.recovery.$get({},Te(e)),`/home/recovery`))}function Il(){return wr({queryKey:Nl,queryFn:({signal:e})=>Fl({signal:e}),enabled:Me(),staleTime:1/0,retry:!1})}function Ll(){let e=I();(0,Z.useEffect)(()=>{let t=!0,n=new AbortController,r,i=async t=>{ve()&&await Ml(e,{queryKey:Nl,queryFn:({signal:e})=>Fl({signal:e}),staleTime:0},t?AbortSignal.any([n.signal,t]):n.signal)},a=n=>{let r;try{r=Pl(n)}catch{i().catch(()=>{});return}e.cancelQueries({queryKey:Nl,exact:!0}).then(()=>{t&&ve()&&e.setQueryData(Nl,r)})},o=()=>{let t=e.getQueryData(U.health)?.capabilities?.localHandoff===!0;t&&ve()&&!r?r=Si(`home:recovery`,a):(!t||!ve())&&r&&(r(),r=void 0)};o();let s=e.getQueryCache().subscribe(o),c=Se(t=>{o(),t?i().catch(()=>{}):e.cancelQueries({queryKey:Nl,exact:!0})}),l=P(e=>i(e));return()=>{t=!1,n.abort(),l(),c(),s(),r?.()}},[e])}function Rl(e,t){let n=t===`config.json`?[V.projects,V.config,V.runsIndex]:t===`agent-accounts.json`?[V.agentProfiles,V.providerStatus]:t===`ui-state.json`?[V.uiState]:[];for(let t of n)e.invalidateQueries({queryKey:t})}function zl(e){let t=I();return H({mutationFn:async t=>Pl(await ct(await Et.api.v1.home.recovery[e].$post({json:t}),`/home/recovery/${e}`)),onSuccess:async(e,n)=>{await t.cancelQueries({queryKey:Nl,exact:!0}),t.setQueryData(Nl,e),Rl(t,n.file)}})}var Bl=()=>zl(`restore`),Vl=()=>zl(`accept`),Hl=()=>zl(`import`);function Ul(){return Ll(),null}function Wl(){return new Nc({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof et&&t.status>=400&&t.status<500?!1:e<1},mutations:{retry:!1}}})}var Gl=Z.createContext(null),Kl=class extends Z.Component{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:Error(String(e))}}componentDidCatch(e,t){console.error(`Squawk cockpit: uncaught render error`,e,t.componentStack)}render(){let{error:e}=this.state;return e?(0,Q.jsxs)(`div`,{"data-slot":`app-error`,role:`alert`,style:{display:`flex`,minHeight:`100dvh`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:`12px`,padding:`24px`,textAlign:`center`,font:`14px/1.5 system-ui, sans-serif`},children:[(0,Q.jsx)(`h1`,{style:{fontSize:`20px`,fontWeight:600,margin:0},children:`The cockpit hit an error`}),(0,Q.jsxs)(`p`,{style:{margin:0,maxWidth:`52ch`},children:[`Reload to carry on. Nothing on disk changed — Squawk’s state lives in`,` `,(0,Q.jsx)(`code`,{children:`.ai/cezar/`}),`, and this page never wrote to it.`]}),(0,Q.jsx)(`pre`,{"data-slot":`app-error-detail`,style:{margin:0,maxWidth:`100%`,overflowX:`auto`,textAlign:`left`,opacity:.75},children:e.message}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>location.reload(),style:{padding:`6px 14px`,cursor:`pointer`},children:`Reload`})]}):this.props.children}},ql=K(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Jl=K(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),Yl=K(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Xl=K(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Zl=K(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),Ql=K(`brush`,[[`path`,{d:`m11 10 3 3`,key:`fzmg1i`}],[`path`,{d:`M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z`,key:`p4q2r7`}],[`path`,{d:`M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031`,key:`wy6l02`}]]),$l=K(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),eu=K(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),tu=K(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),nu=K(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),ru=K(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),iu=K(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),au=K(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),ou=K(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),su=K(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),cu=K(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),lu=K(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),uu=K(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),du=K(`corner-left-up`,[[`path`,{d:`M14 9 9 4 4 9`,key:`1af5af`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),fu=K(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),pu=K(`diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),mu=K(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),hu=K(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),gu=K(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),_u=K(`feather`,[[`path`,{d:`M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z`,key:`18jl4k`}],[`path`,{d:`M16 8 2 22`,key:`vp34q`}],[`path`,{d:`M17.5 15H9`,key:`1oz8nu`}]]),vu=K(`file-cog`,[[`path`,{d:`M15 8a1 1 0 0 1-1-1V2a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8z`,key:`1ckgky`}],[`path`,{d:`M20 8v12a2 2 0 0 1-2 2h-4.182`,key:`1726p0`}],[`path`,{d:`m3.305 19.53.923-.382`,key:`ao1pio`}],[`path`,{d:`M4 10.592V4a2 2 0 0 1 2-2h8`,key:`1foop0`}],[`path`,{d:`m4.228 16.852-.924-.383`,key:`1fv9zy`}],[`path`,{d:`m5.852 15.228-.383-.923`,key:`1a9hc2`}],[`path`,{d:`m5.852 20.772-.383.924`,key:`1sh9ke`}],[`path`,{d:`m8.148 15.228.383-.923`,key:`4yu6lf`}],[`path`,{d:`m8.53 21.696-.382-.924`,key:`18b0s9`}],[`path`,{d:`m9.773 16.852.922-.383`,key:`ti6xop`}],[`path`,{d:`m9.773 19.148.922.383`,key:`rws47d`}],[`circle`,{cx:`7`,cy:`18`,r:`3`,key:`lvkj7j`}]]),yu=K(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),bu=K(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),xu=K(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),Su=K(`folder`,[[`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`}]]),Cu=K(`gem`,[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),wu=K(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),Tu=K(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Eu=K(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Du=K(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),Ou=K(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),ku=K(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Au=K(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),ju=K(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),Mu=K(`memory-stick`,[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]),Nu=K(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Pu=K(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Fu=K(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),Iu=K(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Lu=K(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Ru=K(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),zu=K(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),Bu=K(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Vu=K(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),Hu=K(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Uu=K(`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`}]]),Wu=K(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),Gu=K(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Ku=K(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),qu=K(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Ju=K(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Yu=K(`waves-horizontal`,[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]]),Xu=K(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Zu=K(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Qu=`cezar:open-command-palette`;function $u(){window.dispatchEvent(new Event(Qu))}var ed=`cez-sidebar-width`;function td(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(420,Math.max(264,Math.round(t))):264}function nd(){try{let e=localStorage.getItem(ed);return e===null?264:td(e)}catch{return 264}}function rd(e){try{localStorage.setItem(ed,String(td(e)))}catch{}}var id=Z.createContext(264),ad=Z.createContext(void 0);function od(){return Z.useContext(ad)}var sd=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),cd=`VisuallyHidden`,ld=Z.forwardRef((e,t)=>(0,Q.jsx)(q.span,{...e,ref:t,style:{...sd,...e.style}}));ld.displayName=cd;var ud=ld,dd=`Collapsible`,[fd,pd]=lo(dd),[md,hd]=fd(dd),gd=Z.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=ao({prop:r,defaultProp:i??!1,onChange:o,caller:dd});return(0,Q.jsx)(md,{scope:n,disabled:a,contentId:co(),open:c,onOpenToggle:Z.useCallback(()=>l(e=>!e),[l]),children:(0,Q.jsx)(q.div,{"data-state":Sd(c),"data-disabled":a?``:void 0,...s,ref:t})})});gd.displayName=dd;var _d=`CollapsibleTrigger`,vd=Z.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=hd(_d,n);return(0,Q.jsx)(q.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":Sd(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:J(e.onClick,i.onOpenToggle)})});vd.displayName=_d;var yd=`CollapsibleContent`,bd=Z.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=hd(yd,e.__scopeCollapsible);return(0,Q.jsx)(ho,{present:n||i.open,children:({present:e})=>(0,Q.jsx)(xd,{...r,ref:t,present:e})})});bd.displayName=yd;var xd=Z.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=hd(yd,n),[s,c]=Z.useState(r),l=Z.useRef(null),u=O(t,l),d=Z.useRef(0),f=d.current,p=Z.useRef(0),m=p.current,h=o.open||s,g=Z.useRef(h),_=Z.useRef(void 0);return Z.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),oo(()=>{let e=l.current;if(e){_.current=_.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=_.current.transitionDuration,e.style.animationName=_.current.animationName),c(r)}},[o.open,r]),(0,Q.jsx)(q.div,{"data-state":Sd(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})});function Sd(e){return e?`open`:`closed`}var Cd=gd,wd=`AlertDialog`,[Td,Ed]=lo(wd,[Ho]),Dd=Ho(),Od=e=>{let{__scopeAlertDialog:t,...n}=e,r=Dd(t);return(0,Q.jsx)(qo,{...r,...n,modal:!0})};Od.displayName=wd;var kd=`AlertDialogTrigger`,Ad=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Dd(n);return(0,Q.jsx)(Bo,{...i,...r,ref:t})});Ad.displayName=kd;var jd=`AlertDialogPortal`,Md=e=>{let{__scopeAlertDialog:t,...n}=e,r=Dd(t);return(0,Q.jsx)(Wo,{...r,...n})};Md.displayName=jd;var Nd=`AlertDialogOverlay`,Pd=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Dd(n);return(0,Q.jsx)(zo,{...i,...r,ref:t})});Pd.displayName=Nd;var Fd=`AlertDialogContent`,[Id,Ld]=Td(Fd),Rd=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=Dd(n),o=O(t,Z.useRef(null)),s=Z.useRef(null);return(0,Q.jsx)(Id,{scope:n,cancelRef:s,children:(0,Q.jsx)(Go,{role:`alertdialog`,...a,...i,ref:o,onOpenAutoFocus:J(i.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})});Rd.displayName=Fd;var zd=`AlertDialogTitle`,Bd=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Dd(n);return(0,Q.jsx)(Ko,{...i,...r,ref:t})});Bd.displayName=zd;var Vd=`AlertDialogDescription`,Hd=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Dd(n);return(0,Q.jsx)(Vo,{...i,...r,ref:t})});Hd.displayName=Vd;var Ud=`AlertDialogAction`,Wd=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Dd(n);return(0,Q.jsx)(Uo,{...i,...r,ref:t})});Wd.displayName=Ud;var Gd=`AlertDialogCancel`,Kd=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=Ld(Gd,n),a=Dd(n),o=O(t,i);return(0,Q.jsx)(Uo,{...a,...r,ref:o})});Kd.displayName=Gd;var qd=Od,Jd=Md,Yd=Pd,Xd=Rd,Zd=Wd,Qd=Kd,$d=Bd,ef=Hd;function tf(e){let t=Z.useRef({value:e,previous:e});return Z.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var nf=`Label`,rf=Z.forwardRef((e,t)=>(0,Q.jsx)(q.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));rf.displayName=nf;var af=rf;function of(e,[t,n]){return Math.min(n,Math.max(t,e))}var sf=e(r(),1),cf=[` `,`Enter`,`ArrowUp`,`ArrowDown`],lf=[` `,`Enter`],uf=`Select`,[df,ff,pf]=Io(uf),[mf,hf]=lo(uf,[pf,Lo]),gf=Lo(),[_f,vf]=mf(uf),[yf,bf]=mf(uf),xf=`SelectProvider`;function Sf(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=gf(t),[_,v]=Z.useState(null),[y,b]=Z.useState(null),[x,S]=Z.useState(!1),C=go(l),[w,T]=ao({prop:r,defaultProp:i??!1,onChange:a,caller:uf}),[E,D]=ao({prop:o,defaultProp:s,onChange:c,caller:uf}),O=Z.useRef(null),k=Z.useRef(E);Z.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]=Z.useState(new Set),ee=co(),te=Array.from(j).map(e=>e.props.value).join(`;`),ne=Z.useCallback(e=>{M(t=>new Set(t).add(e))},[]),re=Z.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),ie={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:ee,value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:j,nativeSelectKey:te,isFormControl:A};return(0,Q.jsx)(bo,{...g,children:(0,Q.jsx)(_f,{scope:t,...ie,children:(0,Q.jsx)(df.Provider,{scope:t,children:(0,Q.jsx)(yf,{scope:t,onNativeOptionAdd:ne,onNativeOptionRemove:re,children:Sp(h)?h(ie):n})})})})}Sf.displayName=xf;var Cf=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,Q.jsx)(Sf,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,Q.jsxs)(Q.Fragment,{children:[n,e?(0,Q.jsx)(xp,{__scopeSelect:t}):null]})})};Cf.displayName=uf;var wf=`SelectTrigger`,Tf=Z.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=gf(n),o=vf(wf,n),s=o.disabled||r,c=O(t,o.onTriggerChange),l=ff(n),u=Z.useRef(`touch`),[d,f,p]=wp(e=>{let t=l().filter(e=>!e.disabled),n=Tp(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,Q.jsx)(vo,{asChild:!0,...a,children:(0,Q.jsx)(q.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":Cp(o.value)?``:void 0,...i,ref:c,onClick:J(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:J(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:J(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&cf.includes(e.key)&&(m(),e.preventDefault())})})})});Tf.displayName=wf;var Ef=`SelectValue`,Df=Z.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=vf(Ef,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=O(t,c.onValueNodeChange);oo(()=>{l(u)},[l,u]);let f=Cp(c.value);return(0,Q.jsx)(q.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,Q.jsx)(Z.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});Df.displayName=Ef;var Of=`SelectIcon`,kf=Z.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,Q.jsx)(q.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});kf.displayName=Of;var Af=`SelectPortal`,[jf,Mf]=mf(Af,{forceMount:void 0}),Nf=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,Q.jsx)(jf,{scope:e.__scopeSelect,forceMount:n,children:(0,Q.jsx)(so,{asChild:!0,...r})})};Nf.displayName=Af;var Pf=`SelectContent`,Ff=Z.forwardRef((e,t)=>{let n=Mf(Pf,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=vf(Pf,e.__scopeSelect),[o,s]=Z.useState();return oo(()=>{s(new DocumentFragment)},[]),(0,Q.jsx)(ho,{present:r||a.open,children:({present:e})=>e?(0,Q.jsx)(Hf,{...i,ref:t}):(0,Q.jsx)(If,{...i,fragment:o})})});Ff.displayName=Pf;var If=Z.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?sf.createPortal((0,Q.jsx)(Rf,{scope:n,children:(0,Q.jsx)(df.Slot,{scope:n,children:(0,Q.jsx)(`div`,{ref:t,children:r})})}),i):null});If.displayName=`SelectContentFragment`;var Lf=10,[Rf,zf]=mf(Pf),Bf=`SelectContentImpl`,Vf=b(`SelectContent.RemoveScroll`),Hf=Z.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=vf(Pf,n),[y,b]=Z.useState(null),[x,S]=Z.useState(null),C=O(t,b),[w,T]=Z.useState(null),[E,D]=Z.useState(null),k=ff(n),[A,j]=Z.useState(!1),M=Z.useRef(!1);Z.useEffect(()=>{if(y)return mo(y)},[y]),po();let ee=Z.useCallback(e=>{let[t,...n]=k().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},[k,x]),te=Z.useCallback(()=>ee([w,y]),[ee,w,y]);Z.useEffect(()=>{A&&te()},[A,te]);let{onOpenChange:ne,triggerPointerDownPosRef:re}=v;Z.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(re.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(re.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||ne(!1),document.removeEventListener(`pointermove`,t),re.current=null};return re.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,ne,re]),Z.useEffect(()=>{let e=()=>ne(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[ne]);let[ie,N]=wp(e=>{let t=k().filter(e=>!e.disabled),n=Tp(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),P=Z.useCallback((e,t,n)=>{let r=!M.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(M.current=!0))},[v.value]),F=Z.useCallback(()=>y?.focus(),[y]),ae=Z.useCallback((e,t,n)=>{let r=!M.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),oe=r===`popper`?Kf:Wf,se=oe===Kf?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,Q.jsx)(Rf,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:P,selectedItem:w,onItemLeave:F,itemTextRefCallback:ae,focusSelectedItem:te,selectedItemText:E,position:r,isPositioned:A,searchRef:ie,children:(0,Q.jsx)(uo,{as:Vf,allowPinchZoom:!0,children:(0,Q.jsx)(ro,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:J(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,Q.jsx)(fo,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,Q.jsx)(oe,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...se,onPlaced:()=>j(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:J(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&N(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().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(()=>ee(t)),e.preventDefault()}})})})})})})});Hf.displayName=Bf;var Uf=`SelectItemAlignedPosition`,Wf=Z.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=vf(Pf,n),o=zf(Pf,n),[s,c]=Z.useState(null),[l,u]=Z.useState(null),d=O(t,u),f=ff(n),p=Z.useRef(!1),m=Z.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=Z.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-Lf,d=of(a,[Lf,Math.max(Lf,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-Lf,d=of(a,[Lf,Math.max(Lf,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Lf*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-Lf,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=`${Lf}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]);oo(()=>y(),[y]);let[b,x]=Z.useState();return oo(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,Q.jsx)(qf,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:Z.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,Q.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,Q.jsx)(q.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Wf.displayName=Uf;var Gf=`SelectPopperPosition`,Kf=Z.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Lf,...a}=e,o=gf(n);return(0,Q.jsx)(Ro,{...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)`}})});Kf.displayName=Gf;var[qf,Jf]=mf(Pf,{}),Yf=`SelectViewport`,Xf=Z.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=zf(Yf,n),o=Jf(Yf,n),s=O(t,a.onViewportChange),c=Z.useRef(0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.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,Q.jsx)(df.Slot,{scope:n,children:(0,Q.jsx)(q.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:J(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-Lf*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})})})]})});Xf.displayName=Yf;var Zf=`SelectGroup`,[Qf,$f]=mf(Zf),ep=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=co();return(0,Q.jsx)(Qf,{scope:n,id:i,children:(0,Q.jsx)(q.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});ep.displayName=Zf;var tp=`SelectLabel`,np=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=$f(tp,n);return(0,Q.jsx)(q.div,{id:i.id,...r,ref:t})});np.displayName=tp;var rp=`SelectItem`,[ip,ap]=mf(rp),op=Z.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=vf(rp,n),c=zf(rp,n),l=s.value===r,[u,d]=Z.useState(a??``),[f,p]=Z.useState(!1),m=O(t,io(e=>c.itemRefCallback?.(e,r,i))),h=co(),g=Z.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,Q.jsx)(ip,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:Z.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,Q.jsx)(df.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,Q.jsx)(q.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:J(o.onFocus,()=>p(!0)),onBlur:J(o.onBlur,()=>p(!1)),onClick:J(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:J(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:J(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:J(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:J(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:J(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(lf.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});op.displayName=rp;var sp=`SelectItemText`,cp=Z.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=vf(sp,n),s=zf(sp,n),c=ap(sp,n),l=bf(sp,n),[u,d]=Z.useState(null),f=io(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=O(t,d,c.onItemTextChange,f),m=u?.textContent,h=Z.useMemo(()=>(0,Q.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return oo(()=>(g(h),()=>_(h)),[g,_,h]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Cp(o.value)?sf.createPortal(a.children,o.valueNode):null]})});cp.displayName=sp;var lp=`SelectItemIndicator`,up=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return ap(lp,n).isSelected?(0,Q.jsx)(q.span,{"aria-hidden":!0,...r,ref:t}):null});up.displayName=lp;var dp=`SelectScrollUpButton`,fp=Z.forwardRef((e,t)=>{let n=zf(dp,e.__scopeSelect),r=Jf(dp,e.__scopeSelect),[i,a]=Z.useState(!1),o=O(t,r.onScrollButtonChange);return oo(()=>{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,Q.jsx)(hp,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});fp.displayName=dp;var pp=`SelectScrollDownButton`,mp=Z.forwardRef((e,t)=>{let n=zf(pp,e.__scopeSelect),r=Jf(pp,e.__scopeSelect),[i,a]=Z.useState(!1),o=O(t,r.onScrollButtonChange);return oo(()=>{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,Q.jsx)(hp,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});mp.displayName=pp;var hp=Z.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=zf(`SelectScrollButton`,n),o=Z.useRef(null),s=ff(n),c=Z.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return Z.useEffect(()=>()=>c(),[c]),oo(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,Q.jsx)(q.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:J(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:J(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:J(i.onPointerLeave,()=>{c()})})}),gp=`SelectSeparator`,_p=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,Q.jsx)(q.div,{"aria-hidden":!0,...r,ref:t})});_p.displayName=gp;var vp=`SelectArrow`,yp=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=gf(n);return zf(vp,n).position===`popper`?(0,Q.jsx)(Fo,{...i,...r,ref:t}):null});yp.displayName=vp;var bp=`SelectBubbleInput`,xp=Z.forwardRef(({__scopeSelect:e,...t},n)=>{let r=vf(bp,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=Z.useRef(null),m=O(n,p),h=i??``,g=tf(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return Z.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,Q.jsxs)(q.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...sd,...t.style},ref:m,defaultValue:h,children:[Cp(i)&&!_?(0,Q.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});xp.displayName=bp;function Sp(e){return typeof e==`function`}function Cp(e){return e===``||e===void 0}function wp(e){let t=io(e),n=Z.useRef(``),r=Z.useRef(0),i=Z.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=Z.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return Z.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Tp(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=Ep(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 Ep(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Dp=`Switch`,[Op,kp]=lo(Dp),[Ap,jp]=Op(Dp);function Mp(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]=ao({prop:n,defaultProp:i??!1,onChange:c,caller:Dp}),[m,h]=Z.useState(null),[g,_]=Z.useState(null),v={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:Z.useRef(!1),required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,Q.jsx)(Ap,{scope:t,...v,children:Bp(d)?d(v):r})}var Np=`SwitchTrigger`,Pp=Z.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}=jp(Np,e),h=O(r,u),g=Z.useRef(c);return Z.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,Q.jsx)(q.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":Vp(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:h,onClick:J(t,e=>{d(e=>!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});Pp.displayName=Np;var Fp=Z.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,Q.jsx)(Mp,{__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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Pp,{...d,ref:t,__scopeSwitch:n}),e&&(0,Q.jsx)(zp,{__scopeSwitch:n})]})})});Fp.displayName=Dp;var Ip=`SwitchThumb`,Lp=Z.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=jp(Ip,n);return(0,Q.jsx)(q.span,{"data-state":Vp(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Lp.displayName=Ip;var Rp=`SwitchBubbleInput`,zp=Z.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}=jp(Rp,e),m=O(n,p),h=tf(a),g=_o(r);Z.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 _=Z.useRef(a);return(0,Q.jsx)(q.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%)`}})});zp.displayName=Rp;function Bp(e){return typeof e==`function`}function Vp(e){return e?`checked`:`unchecked`}var Hp=`Tabs`,[Up,Wp]=lo(Hp,[wo]),Gp=wo(),[Kp,qp]=Up(Hp),Jp=Z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=go(s),[d,f]=ao({prop:r,onChange:i,defaultProp:a??``,caller:Hp});return(0,Q.jsx)(Kp,{scope:n,baseId:co(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,Q.jsx)(q.div,{dir:u,"data-orientation":o,...l,ref:t})})});Jp.displayName=Hp;var Yp=`TabsList`,Xp=Z.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=qp(Yp,n),o=Gp(n);return(0,Q.jsx)(To,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,Q.jsx)(q.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Xp.displayName=Yp;var Zp=`TabsTrigger`,Qp=Z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=qp(Zp,n),s=Gp(n),c=tm(o.baseId,r),l=nm(o.baseId,r),u=r===o.value;return(0,Q.jsx)(Oo,{asChild:!0,...s,focusable:!i,active:u,children:(0,Q.jsx)(q.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:J(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:J(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:J(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Qp.displayName=Zp;var $p=`TabsContent`,em=Z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=qp($p,n),c=tm(s.baseId,r),l=nm(s.baseId,r),u=r===s.value,d=Z.useRef(u);return Z.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,Q.jsx)(ho,{present:i||u,children:({present:n})=>(0,Q.jsx)(q.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});em.displayName=$p;function tm(e,t){return`${e}-trigger-${t}`}function nm(e,t){return`${e}-content-${t}`}var rm=Jp,im=Xp,am=Qp,om=em,[sm,cm]=lo(`Tooltip`,[Lo]),lm=Lo(),um=`TooltipProvider`,dm=700,fm=`tooltip.open`,[pm,mm]=sm(um),hm=e=>{let{__scopeTooltip:t,delayDuration:n=dm,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=Z.useRef(!0),s=Z.useRef(!1),c=Z.useRef(0);return Z.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,Q.jsx)(pm,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:Z.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:Z.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:Z.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};hm.displayName=um;var gm=`Tooltip`,[_m,vm]=sm(gm),ym=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=mm(gm,e.__scopeTooltip),l=lm(t),[u,d]=Z.useState(null),f=co(),p=Z.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=Z.useRef(!1),[_,v]=ao({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(fm))):c.onClose(),a?.(e)},caller:gm}),y=Z.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=Z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=Z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=Z.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return Z.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,Q.jsx)(bo,{...l,children:(0,Q.jsx)(_m,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:Z.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:Z.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};ym.displayName=gm;var bm=`TooltipTrigger`,xm=Z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=vm(bm,n),a=mm(bm,n),o=lm(n),s=O(t,Z.useRef(null),i.onTriggerChange),c=Z.useRef(!1),l=Z.useRef(!1),u=Z.useCallback(()=>c.current=!1,[]);return Z.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,Q.jsx)(vo,{asChild:!0,...o,children:(0,Q.jsx)(q.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:J(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:J(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:J(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:J(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:J(e.onBlur,i.onClose),onClick:J(e.onClick,i.onClose)})})});xm.displayName=bm;var Sm=`TooltipPortal`,[Cm,wm]=sm(Sm,{forceMount:void 0}),Tm=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=vm(Sm,t);return(0,Q.jsx)(Cm,{scope:t,forceMount:n,children:(0,Q.jsx)(ho,{present:n||a.open,children:(0,Q.jsx)(so,{asChild:!0,container:i,children:r})})})};Tm.displayName=Sm;var Em=`TooltipContent`,Dm=Z.forwardRef((e,t)=>{let n=wm(Em,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=vm(Em,e.__scopeTooltip);return(0,Q.jsx)(ho,{present:r||o.open,children:o.disableHoverableContent?(0,Q.jsx)(Mm,{side:i,...a,ref:t}):(0,Q.jsx)(Om,{side:i,...a,ref:t})})}),Om=Z.forwardRef((e,t)=>{let n=vm(Em,e.__scopeTooltip),r=mm(Em,e.__scopeTooltip),i=Z.useRef(null),a=O(t,i),[o,s]=Z.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=Z.useCallback(()=>{s(null),d(!1)},[d]),p=Z.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Im(r,Fm(r,n.getBoundingClientRect())),a=Lm(t.getBoundingClientRect()),o=zm([...i,...a]);s(o),d(!0)},[d]);return Z.useEffect(()=>()=>f(),[f]),Z.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),Z.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Rm(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,Q.jsx)(Mm,{...e,ref:a})}),[km,Am]=sm(gm,{isInside:!1}),jm=p(`TooltipContent`),Mm=Z.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=vm(Em,n),l=lm(n),{onClose:u}=c;return Z.useEffect(()=>(document.addEventListener(fm,u),()=>document.removeEventListener(fm,u)),[u]),Z.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,Q.jsx)(fo,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,Q.jsxs)(Ro,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,Q.jsx)(jm,{children:r}),(0,Q.jsx)(km,{scope:n,isInside:!0,children:(0,Q.jsx)(ud,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Dm.displayName=Em;var Nm=`TooltipArrow`,Pm=Z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=lm(n);return Am(Nm,n).isInside?null:(0,Q.jsx)(Fo,{...i,...r,ref:t})});Pm.displayName=Nm;function Fm(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Im(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Lm(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Rm(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function zm(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Bm(t)}function Bm(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Vm=hm,Hm=ym,Um=xm,Wm=Tm,Gm=Dm,Km=Pm,qm=h(`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-accent-strong text-accent-strong-foreground [a&]:hover:bg-accent-strong/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-link-foreground underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function Jm({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,Q.jsx)(n?D:`span`,{"data-slot":`badge`,"data-variant":t,className:C(qm({variant:t}),e),...r})}var Ym=`x-apple.systempreferences:com.apple.preference.security?Privacy_FilesAndFolders`,Xm=`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-foreground hover:bg-muted`;function Zm(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 Qm({path:e,selected:t,onSelect:n,onEnter:r,decorate:i,emptyHint:a,showHidden:o=!1}){let s=Pn(e,o),c=s.data?.parent??null;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-[11px] text-soft-foreground`,title:s.data?.path??void 0,children:s.data?.path??(s.isError?``:`Loading…`)}),s.isError?(0,Q.jsx)($m,{error:s.error,path:e,onEnter:r,onRetry:()=>void s.refetch()}):(0,Q.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,Q.jsx)(`li`,{className:`flex`,children:(0,Q.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,Q.jsx)(du,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(s.data?.dirs??[]).map(e=>(0,Q.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":t?.path===e.path,onClick:()=>n(e),onDoubleClick:()=>r(e.path),className:C(`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,Q.jsx)(Su,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),i?.(e)]}),(0,Q.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,Q.jsx)(ru,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),s.data&&s.data.dirs.length===0?(0,Q.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:a}):null]}),s.data?.truncated?(0,Q.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-[11px] text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function $m({error:e,path:t,onEnter:n,onRetry:r}){let i=e instanceof et&&e.status===403,a=t===null?null:Zm(t);return(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Q.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:e instanceof Error?e.message:`could not list that folder`}),i?(0,Q.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,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[12.5px]`,children:[a===null?null:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`fs-error-back`,onClick:()=>n(a),className:Xm,children:[(0,Q.jsx)(du,{className:`size-3.5`,"aria-hidden":!0}),`Back`]}),i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`a`,{"data-slot":`fs-privacy-settings`,href:Ym,target:`_blank`,rel:`noreferrer`,className:Xm,children:`Open Privacy Settings`}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`fs-retry`,onClick:r,className:Xm,children:`Try again`})]}):null]})]})}function eh(e,t,n=!1){let r=Pn(e,n);return t?.path??r.data?.path??null}function th({open:e,onOpenChange:t}){let[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(null),o=bn(),s=gr(),c=j(),l=new Set((o.data?.projects??[]).map(e=>e.root)),u=e=>{r(e),a(null),s.reset()},d=eh(n,i);return(0,Q.jsx)(es,{open:e,onOpenChange:t,children:(0,Q.jsxs)(Qo,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,Q.jsxs)(Zo,{children:[(0,Q.jsx)($o,{children:`Open local folder`}),(0,Q.jsx)(Yo,{children:`Pick the folder Squawk should run in. Git repos are marked; any folder works.`})]}),(0,Q.jsxs)(Xo,{className:`space-y-4`,children:[(0,Q.jsx)(Qm,{path:n,selected:i,onSelect:a,onEnter:u,emptyHint:`No subfolders here — “Add project” registers this folder.`,decorate:e=>(0,Q.jsxs)(Q.Fragment,{children:[e.isRepo?(0,Q.jsx)(Jm,{variant:`outline`,className:`shrink-0 text-[12px]`,children:`git`}):null,l.has(e.path)?(0,Q.jsx)(Jm,{variant:`ghost`,className:`shrink-0 text-[12px] text-muted-foreground`,children:`already added`}):null]})}),s.isError?(0,Q.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,Q.jsxs)(Jo,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-[11px] text-muted-foreground`,title:d??void 0,children:d??``}),(0,Q.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,Q.jsx)(k,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(k,{"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 nh(e,t){let[n,r]=(0,Z.useState)(null),i=(0,Z.useMemo)(()=>`${e}${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),a=(0,Z.useRef)(i);return a.current=i,(0,Z.useEffect)(()=>rl((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===a.current&&(n.phase===`cloning`&&n.line?r(n.line):n.phase!==`cloning`&&r(null))}),[]),(0,Z.useEffect)(()=>P(async e=>{if(!t)return;let n=await xe(i,{signal:e}).catch(()=>null);if(!n)return;let{progress:o}=n;e.aborted||o?.checkoutId!==a.current||r(o?.phase===`cloning`?o.line??null:null)}),[t,i]),{checkoutId:i,progress:n,setProgress:r}}function rh({className:e,type:t,...n}){return(0,Q.jsx)(`input`,{type:t,"data-slot":`input`,className:C(`h-11 w-full min-w-0 rounded-md border border-control-border bg-[var(--task-brand-bg)] px-3 py-1 text-base shadow-none transition-[color,box-shadow] outline-hidden selection:bg-accent-strong selection:text-accent-strong-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-soft-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20`,e),...n})}function ih({className:e,...t}){return(0,Q.jsx)(af,{"data-slot":`label`,className:C(`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 ah(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 oh({open:e,onOpenChange:t}){let[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(!1),c=(0,Z.useRef)(!1),l=bn(),u=Qn(),{mutate:d,isPending:f}=u,p=j(),m=ah(u.error),{checkoutId:h,progress:g,setProgress:_}=nh(`co-`,f),v=(0,Z.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),y=i.trim()===``?v:i.trim(),b=l.data?.projectsDir??``,x=y===``?``:`${b.replace(/\/+$/,``)}/${y}`,S=(0,Z.useCallback)(()=>{n.trim()===``||f||(c.current=!1,s(!1),_(null),d({url:n.trim(),checkoutId:h,...i.trim()===``?{}:{name:i.trim()}},{onSuccess:({project:e})=>{t(!1),p(`/p/${encodeURIComponent(e.id)}/`)}}))},[d,f,h,i,p,t,n]);return(0,Z.useEffect)(()=>{if(!o)return;let e=()=>{c.current&&(c.current=!1,s(!1),S())},t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[o,S]),(0,Q.jsx)(es,{open:e,onOpenChange:e=>u.isPending?void 0:t(e),children:(0,Q.jsxs)(Qo,{"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,Q.jsxs)(Zo,{children:[(0,Q.jsx)($o,{children:`Clone from GitHub`}),(0,Q.jsxs)(Yo,{children:[`Squawk clones with `,(0,Q.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(ih,{htmlFor:`clone-url`,children:`Repository`}),(0,Q.jsx)(rh,{id:`clone-url`,"data-slot":`clone-url`,autoFocus:!0,placeholder:`owner/repo or https://github.com/owner/repo`,value:n,disabled:u.isPending,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&S()}})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(ih,{htmlFor:`clone-name`,children:`Folder name`}),(0,Q.jsx)(rh,{id:`clone-name`,"data-slot":`clone-name`,placeholder:v===``?`repo`:v,value:i,disabled:u.isPending,onChange:e=>a(e.target.value)}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-[11px] text-soft-foreground`,title:x,children:x}),u.isPending?(0,Q.jsx)(k,{"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,Q.jsx)(Ui,{className:`size-3.5`,"aria-hidden":`true`})}):(0,Q.jsx)(k,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,Q.jsx)(E,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,Q.jsx)(Ui,{className:`size-3.5`,"aria-hidden":`true`})})})]})]}),u.isPending?(0,Q.jsx)(`p`,{"data-slot":`clone-progress`,className:`truncate font-mono text-[11px] text-muted-foreground`,children:g??`Starting the clone…`}):null,u.isError?(0,Q.jsx)(`div`,{"data-slot":`clone-error`,className:`grid min-w-0 gap-1.5 text-[13px] text-danger`,children:m?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{children:`GitHub requires SAML authorization for this organization.`}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`a`,{"data-slot":`clone-sso-link`,className:`inline-flex min-h-11 items-center font-medium underline underline-offset-2`,href:m,target:`_blank`,rel:`noreferrer`,onClick:()=>{c.current=!0,s(!0)},children:`Authorize this GitHub organization`}),o?` — return here after authorizing, or choose Retry clone.`:` — return to this tab to retry, or choose Retry clone.`]}),(0,Q.jsxs)(`details`,{className:`min-w-0`,children:[(0,Q.jsx)(`summary`,{className:`min-h-11 content-center`,children:`Error details`}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-all`,children:u.error instanceof Error?u.error.message:null})]})]}):(0,Q.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-all`,children:u.error instanceof Error?u.error.message:`could not clone that repository`})}):null,(0,Q.jsxs)(Jo,{children:[(0,Q.jsx)(k,{variant:`outline`,disabled:u.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(k,{"data-slot":`clone-confirm`,disabled:n.trim()===``||y===``||u.isPending,onClick:S,children:u.isPending?`Cloning…`:u.isError?`Retry clone`:`Clone`})]})]})})}var sh=[{slug:`github/codespaces-nextjs`,label:`Next.js`,description:`Minimal Next.js app (GitHub)`},{slug:`vercel/chatbot`,label:`Next.js AI chatbot`,description:`Full-featured AI chat app (Vercel)`},{slug:`vercel/nextjs-postgres-nextauth-tailwindcss-template`,label:`Next.js admin dashboard`,description:`Postgres, Auth.js and Tailwind (Vercel)`},{slug:`github/codespaces-react`,label:`React + Vite`,description:`React single-page app (GitHub)`},{slug:`antfu-collective/vitesse`,label:`Vue + Vite`,description:`Opinionated Vue starter (Vitesse)`},{slug:`nuxt-ui-templates/starter-vue`,label:`Vue + Nuxt UI`,description:`Vue + Vite with Nuxt UI (Nuxt)`},{slug:`mugnavo/cove`,label:`Vite+`,description:`TanStack Start on Vite+ (vp), Better Auth`},{slug:`w3cj/hono-open-api-starter`,label:`Hono`,description:`Type-safe JSON API with OpenAPI docs`},{slug:`github/codespaces-express`,label:`Express`,description:`Node.js web server (GitHub)`},{slug:`andrewmcodes/obsidian-beginner-vault-template`,label:`Obsidian vault`,description:`Your own knowledge base in Markdown`},{slug:`chibat/chrome-extension-typescript-starter`,label:`Chrome extension`,description:`TypeScript extension starter`},{slug:`actions/typescript-action`,label:`GitHub Action`,description:`TypeScript action with tests (GitHub)`},{slug:`microsoft/python-package-template`,label:`Python package`,description:`Packaging, tests and CI (Microsoft)`},{slug:`github/codespaces-flask`,label:`Flask`,description:`Python web app (GitHub)`},{slug:`github/codespaces-django`,label:`Django`,description:`Python web framework (GitHub)`},{slug:`github/codespaces-rails`,label:`Ruby on Rails`,description:`Rails app (GitHub)`},{slug:`github/codespaces-jupyter`,label:`Jupyter notebooks`,description:`Data science and ML (GitHub)`}];function ch(e){let t=e.trim().toLowerCase();return t===``||sh.some(e=>e.slug.toLowerCase()===t)?sh:sh.filter(e=>[e.label,e.slug,e.description].some(e=>e.toLowerCase().includes(t)))}function lh({value:e,onChange:t,disabled:n,id:r}){let i=(0,Z.useId)(),a=ch(e),[o,s]=(0,Z.useState)(-1),c=(0,Z.useRef)(null);(0,Z.useEffect)(()=>s(-1),[e]),(0,Z.useEffect)(()=>{o<0||c.current?.querySelector(`[data-index="${o}"]`)?.scrollIntoView?.({block:`nearest`})},[o]);let l=e=>`${i}-option-${e}`;return(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-1.5`,children:[(0,Q.jsx)(rh,{id:r,"data-slot":`create-project-template`,role:`combobox`,"aria-expanded":`true`,"aria-controls":i,"aria-autocomplete":`list`,"aria-activedescendant":o>=0?l(o):void 0,autoComplete:`off`,spellCheck:!1,placeholder:`owner/repo or https://github.com/owner/repo`,value:e,disabled:n,onChange:e=>t(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),a.length===0)return;let t=e.key===`ArrowDown`;s(e=>e<0?t?0:a.length-1:(e+(t?1:-1)+a.length)%a.length)}else if(e.key===`Enter`&&o>=0){e.preventDefault(),e.stopPropagation();let n=a[o];n&&t(n.slug)}}}),(0,Q.jsx)(`ul`,{ref:c,id:i,role:`listbox`,"aria-label":`Suggested templates`,"data-slot":`create-project-template-list`,className:`max-h-48 min-h-0 overflow-y-auto overscroll-contain rounded-md border border-border`,children:a.length===0?(0,Q.jsx)(`li`,{className:`px-3 py-2 text-xs text-muted-foreground`,role:`presentation`,children:`No suggestion matches — any GitHub template repository works.`}):a.map((r,i)=>{let a=r.slug.toLowerCase()===e.trim().toLowerCase();return(0,Q.jsxs)(`li`,{id:l(i),role:`option`,"aria-selected":a,"data-index":i,"data-value":r.slug,"data-slot":`create-project-template-option`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n||t(r.slug)},className:C(`grid min-h-11 cursor-pointer content-center gap-0.5 px-3 py-1.5 text-start`,`pointer-hover:hover:bg-accent`,i===o&&`bg-accent`,a&&`font-medium`),children:[(0,Q.jsxs)(`span`,{className:`truncate text-[13px]`,children:[r.label,` `,(0,Q.jsx)(`span`,{className:`font-mono text-[11px] text-soft-foreground`,children:r.slug})]}),(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:r.description})]},r.slug)})})]})}function uh({className:e,size:t=`default`,...n}){return(0,Q.jsx)(Fp,{"data-slot":`switch`,"data-size":t,className:C(`peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-none transition-[color,background-color,border-color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-6 data-[size=default]:w-10 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-accent-strong data-[state=unchecked]:bg-input`,e),...n,children:(0,Q.jsx)(Lp,{"data-slot":`switch-thumb`,className:C(`pointer-events-none block rounded-full bg-background ring-0 motion-safe:transition-transform group-data-[size=default]/switch:size-[18px] group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-[state=checked]:translate-x-5 group-data-[size=default]/switch:data-[state=unchecked]:translate-x-0.5 group-data-[size=sm]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-[state=unchecked]:translate-x-0`)})})}function dh(e){return{available:e.data?.available?e.data.owners:null,unavailableReason:e.isError?`GitHub is unavailable: ${e.error instanceof Error?e.error.message:`could not ask gh`}`:e.data&&!e.data.available?e.data.reason:null}}function fh(e,t){return e&&t!==null&&t.length>0}function ph(e,t){return e??t?.[0]?.login??null}function mh(e){return(e.data?.projectsDir??``).replace(/\/+$/,``)}function hh({nameValid:e,isPending:t,created:n,github:r,chosenOwner:i,effectiveStart:a,template:o}){return e&&!t&&n===null&&(!r||i!==null&&(a===`empty`||o.trim()!==``))}function gh({trimmed:e,checkoutId:t,github:n,chosenOwner:r,effectiveStart:i,template:a}){return{name:e,checkoutId:t,...n&&r?{github:{owner:r,...i===`template`?{template:a.trim()}:{}}}:{}}}function _h({created:e}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ma,{"aria-hidden":`true`,className:`mbs-0.5 size-5 shrink-0 text-warning`}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,Q.jsx)(`p`,{className:`font-medium`,children:`The project was created, but its GitHub repository is not finished.`}),(0,Q.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-words font-mono text-xs`,children:e.warning})]})]})}function vh({fieldId:e,name:t,setName:n,trimmed:r,nameValid:i,projectsDir:a,isPending:o,create:s}){let c=`${e}-name-hint`;return(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(ih,{htmlFor:`${e}-name`,children:`Name`}),(0,Q.jsx)(rh,{id:`${e}-name`,"data-slot":`create-project-name`,autoFocus:!0,autoComplete:`off`,spellCheck:!1,placeholder:`my-project`,value:t,disabled:o,"aria-invalid":r!==``&&!i,"aria-describedby":r!==``&&!i?c:void 0,onChange:e=>n(e.target.value.replace(/\s/g,`-`)),onKeyDown:e=>{e.key===`Enter`&&s()}}),r!==``&&!i?(0,Q.jsx)(`p`,{id:c,"data-slot":`create-project-name-hint`,className:`text-xs text-danger`,children:`Use letters, digits, “.”, “-” and “_” only, starting with a letter or digit — it names the folder and the repository.`}):null,(0,Q.jsx)(`p`,{"data-slot":`create-project-path`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,title:`${a}/${r}`,children:r===``?`${a}/…`:`${a}/${r}`})]})}function yh({fieldId:e,github:t,setGithubOn:n,isPending:r,available:i}){return(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(uh,{id:`${e}-github`,"data-slot":`create-project-github`,checked:t,disabled:r||i===null||i.length===0,onCheckedChange:n,className:`mbs-0.5`}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-0.5`,children:[(0,Q.jsx)(ih,{htmlFor:`${e}-github`,children:`Also create a private GitHub repository`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Under the account you choose. You can change its visibility on GitHub later.`})]})]})}function bh({fieldId:e,effectiveStart:t,setStart:n,isPending:r,github:i,template:a,setTemplate:o}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`fieldset`,{className:`grid gap-2`,disabled:r,children:[(0,Q.jsx)(`legend`,{className:`mbe-2 text-sm font-medium`,children:`Start with`}),(0,Q.jsx)(wh,{slot:`create-project-start-empty`,name:`${e}-start`,checked:t===`empty`,disabled:r,onChange:()=>n(`empty`),title:`Empty repository`,detail:`One empty first commit, no files.`}),(0,Q.jsx)(wh,{slot:`create-project-start-template`,name:`${e}-start`,checked:t===`template`,disabled:r||!i,onChange:()=>n(`template`),title:`From a template`,detail:i?`GitHub generates the repository from a template.`:`Needs the GitHub repository.`})]}),t===`template`?(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(ih,{htmlFor:`${e}-template`,children:`Template`}),(0,Q.jsx)(lh,{id:`${e}-template`,value:a,onChange:o,disabled:r})]}):null]})}function xh({isPending:e,progress:t,failed:n,error:r}){return(0,Q.jsxs)(Q.Fragment,{children:[e?(0,Q.jsx)(`p`,{"data-slot":`create-project-progress`,className:`flex-none truncate font-mono text-[11px] text-muted-foreground`,children:t??`Starting…`}):null,n?(0,Q.jsx)(`p`,{"data-slot":`create-project-error`,role:`alert`,className:`flex-none min-w-0 whitespace-pre-wrap break-words text-[13px] text-danger`,children:r instanceof Error?r.message:`could not create the project`}):null]})}function Sh({created:e,goToProject:t,isPending:n,onCancel:r,ready:i,onCreate:a,failed:o}){return(0,Q.jsx)(Jo,{className:`flex-none`,children:e?(0,Q.jsx)(k,{"data-slot":`create-project-open`,onClick:t,children:`Go to project`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{variant:`outline`,disabled:n,onClick:r,children:`Cancel`}),(0,Q.jsx)(k,{"data-slot":`create-project-submit`,disabled:!i,onClick:a,children:n?`Creating…`:o?`Try again`:`Create project`})]})})}function Ch({open:e,onOpenChange:t}){let[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(`empty`),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(null),m=bn(),h=kn({enabled:e}),g=Kn(),{mutate:_,isPending:v}=g,y=j(),b=(0,Z.useId)(),x=(0,Z.useRef)(!1),{checkoutId:S,progress:C,setProgress:w}=nh(`np-`,v),{available:T,unavailableReason:E}=dh(h),D=fh(i,T),O=ph(o,T),k=D?c:`empty`,A=n.trim(),M=oe.test(A),ee=mh(m),te=hh({nameValid:M,isPending:v,created:f,github:D,chosenOwner:O,effectiveStart:k,template:u}),ne=(0,Z.useCallback)(()=>{!te||x.current||(x.current=!0,w(null),_(gh({trimmed:A,checkoutId:S,github:D,chosenOwner:O,effectiveStart:k,template:u}),{onSettled:()=>{x.current=!1},onSuccess:({project:e,warning:n})=>{if(n){p({projectId:e.id,warning:n});return}t(!1),y(`/p/${encodeURIComponent(e.id)}/`)}}))},[te,_,A,S,D,O,k,u,t,y]);return(0,Q.jsx)(es,{open:e,onOpenChange:e=>v?void 0:t(e),children:(0,Q.jsxs)(Qo,{"data-slot":`create-project-dialog`,className:`flex min-w-0 flex-col overflow-y-clip overflow-x-clip sm:max-w-2xl`,children:[(0,Q.jsxs)(Zo,{className:`flex-none`,children:[(0,Q.jsx)($o,{children:`New project`}),(0,Q.jsx)(Yo,{children:`Squawk creates a git repository with one empty commit in your checkout root and adds it as a project.`})]}),f?(0,Q.jsx)(`div`,{"data-slot":`create-project-warning`,role:`status`,className:`flex min-h-0 flex-1 gap-3 overflow-y-auto overscroll-contain rounded-md border border-border bg-muted p-4 text-[13px]`,children:(0,Q.jsx)(_h,{created:f})}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-wrap gap-6 overflow-y-auto overscroll-contain`,children:[(0,Q.jsxs)(`div`,{className:`grid min-w-[50%] grow-[999] basis-0 content-start gap-5`,children:[(0,Q.jsx)(vh,{fieldId:b,name:n,setName:r,trimmed:A,nameValid:M,projectsDir:ee,isPending:v,create:ne}),(0,Q.jsx)(yh,{fieldId:b,github:D,setGithubOn:a,isPending:v,available:T}),(0,Q.jsx)(bh,{fieldId:b,effectiveStart:k,setStart:l,isPending:v,github:D,template:u,setTemplate:d})]}),(0,Q.jsx)(Th,{owners:T,unavailableReason:E,enabled:D&&!v,chosen:O,onChoose:s,groupName:`${b}-owner`})]}),(0,Q.jsx)(xh,{isPending:v,progress:C,failed:g.isError,error:g.error}),(0,Q.jsx)(Sh,{created:f,goToProject:()=>{f&&(t(!1),y(`/p/${encodeURIComponent(f.projectId)}/`))},isPending:v,onCancel:()=>t(!1),ready:te,onCreate:ne,failed:g.isError})]})})}function wh({slot:e,name:t,checked:n,disabled:r,onChange:i,title:a,detail:o}){return(0,Q.jsxs)(`label`,{className:C(`flex min-h-11 items-start gap-3 rounded-md border border-border p-3`,`has-[:checked]:border-accent-strong has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-ring`,r?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,Q.jsx)(`input`,{type:`radio`,"data-slot":e,name:t,checked:n,disabled:r,onChange:i,className:`mbs-0.5 size-4 accent-[var(--color-accent-strong)]`}),(0,Q.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium`,children:a}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o})]})]})}function Th({owners:e,unavailableReason:t,enabled:n,chosen:r,onChoose:i,groupName:a}){return(0,Q.jsxs)(`fieldset`,{"data-slot":`create-project-owners`,disabled:!n,className:`grid min-w-0 grow basis-56 content-start gap-2`,children:[(0,Q.jsx)(`legend`,{className:`mbe-2 text-sm font-medium`,children:`Repository owner`}),t===null?e===null?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ms,{className:`h-14 w-full`}),(0,Q.jsx)(ms,{className:`h-14 w-full`})]}):e.map(e=>(0,Q.jsxs)(`label`,{"data-slot":`create-project-owner`,className:C(`flex min-h-11 min-w-0 items-center gap-3 rounded-md border border-border p-2.5`,`has-[:checked]:border-accent-strong has-[:checked]:bg-accent`,`has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-ring`,n?`cursor-pointer pointer-hover:hover:bg-accent`:`cursor-not-allowed opacity-60`),children:[(0,Q.jsx)(`input`,{type:`radio`,name:a,value:e.login,checked:r===e.login,disabled:!n,onChange:()=>i(e.login),className:`sr-only`}),e.avatarUrl?(0,Q.jsx)(`img`,{src:e.avatarUrl,alt:``,className:`size-8 shrink-0 rounded-full object-cover`}):(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-8 shrink-0 place-items-center rounded-full bg-muted text-xs font-medium uppercase`,children:e.login.slice(0,1)}),(0,Q.jsxs)(`span`,{className:`grid min-w-0`,children:[(0,Q.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.login}),(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.personal?`Personal account`:e.description??`Organization`})]})]},e.login)):(0,Q.jsxs)(`p`,{"data-slot":`create-project-github-unavailable`,className:`rounded-md border border-border bg-muted p-3 text-xs text-muted-foreground break-words`,children:[t,`. Local projects still work.`]})]})}function Eh({triggerClassName:e,icon:t=Pi,iconClassName:n=`size-4`,side:r,origin:i,label:a,iconFrameClassName:o}={}){let[s,c]=Z.useState(!1),[l,u]=Z.useState(!1),[d,f]=Z.useState(!1);return(0,Q.jsxs)(No,{children:[(0,Q.jsx)(Ao,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`ghost`,"aria-label":`Add project`,title:`Add project`,"data-origin":i,className:C(`size-9 p-0 text-muted-foreground`,e),children:[o?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:o,children:(0,Q.jsx)(t,{className:n,"aria-hidden":`true`})}):(0,Q.jsx)(t,{className:n,"aria-hidden":`true`}),a?(0,Q.jsx)(`span`,{children:a}):(0,Q.jsx)(`span`,{className:`sr-only`,children:`Add project`})]})}),(0,Q.jsxs)(jo,{align:`start`,...g({side:r}),className:`w-56`,children:[(0,Q.jsx)(yo,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,Q.jsxs)(Eo,{"data-slot":`add-project-new`,onSelect:()=>f(!0),children:[(0,Q.jsx)(Pi,{"aria-hidden":`true`}),`New project…`]}),(0,Q.jsxs)(Eo,{"data-slot":`add-project-local`,onSelect:()=>c(!0),children:[(0,Q.jsx)(Gi,{"aria-hidden":`true`}),`Open local folder…`]}),(0,Q.jsxs)(Eo,{"data-slot":`add-project-clone`,onSelect:()=>u(!0),children:[(0,Q.jsx)(Ri,{"aria-hidden":`true`}),`Clone from GitHub…`]})]}),s?(0,Q.jsx)(th,{open:!0,onOpenChange:c}):null,l?(0,Q.jsx)(oh,{open:!0,onOpenChange:u}):null,d?(0,Q.jsx)(Ch,{open:!0,onOpenChange:f}):null]})}function Dh(e,t){return typeof t==`string`&&Object.hasOwn(e,t)?e[t]:void 0}var Oh={folder:Su,terminal:qu,vscode:su,cursor:Fu,zed:Zu,windsurf:Yu,sublime:_u,idea:pu,pycharm:Ou,webstorm:Tu,goland:Wu,rubymine:Cu,phpstorm:Zl,clion:fu,rider:Xl,"android-studio":Gu,xcode:Du,warp:Vu,bot:Yl,sparkles:Ku};function kh(e,t){let n=Ah(e.id);return Dh(Oh,n===void 0?e.icon:Di(t,n)?.icon)??hi}function Ah(e){let t=e.startsWith(`cli:`)?e.slice(4):``;return t===``?void 0:t}function jh({choices:e,onPick:t,label:n=`Open in…`,title:r,triggerVariant:i=`ghost`,disabled:a=!1,leading:o,trailing:s,slot:c,className:l}){let u=Oi().data;return(0,Q.jsxs)(No,{children:[(0,Q.jsx)(Ao,{asChild:!0,children:(0,Q.jsxs)(k,{variant:i,size:`sm`,title:r,disabled:a,"data-slot":c,className:l,children:[(0,Q.jsx)(hi,{"aria-hidden":`true`}),n]})}),(0,Q.jsxs)(jo,{align:`end`,children:[o,o&&e.length>0?(0,Q.jsx)(Do,{}):null,e.map(({target:e,suffix:n,title:r})=>{let i=kh(e,u);return(0,Q.jsxs)(Eo,{"data-target":e.id,title:r,onSelect:()=>t(e.id),children:[(0,Q.jsx)(i,{"aria-hidden":`true`}),e.label,n??``]},e.id)}),s]})]})}var Mh=[`done`,`failed`,`cancelled`];function Nh(e){return Mh.includes(e)}function Ph(e){return!St(e)&&Nh(e.status)&&!Zr(e)}function Fh(e){return e.reduce((e,t)=>zr(t)||!Zr(t)?e:e+1,0)}function Ih(e){return e.status===`failed`?`danger`:`success`}var Lh={needsYou:0,failedUnread:0,inMotion:0,finishedUnread:0};function Rh(e){let t={...Lh};for(let n of e)n.archived||zr(n)||(Ee(n)?t.needsYou+=1:Ce(n).tone===`running`?t.inMotion+=1:Zr(n)&&(n.status===`failed`?t.failedUnread+=1:n.status===`done`&&(t.finishedUnread+=1)));return t}function zh(e){let t=new Map;for(let n of e){let e=t.get(n.projectId);e?e.push(n):t.set(n.projectId,[n])}return new Map([...t].map(([e,t])=>[e,Rh(t)]))}function Bh(e,t,n={}){if(n.unknown)return`${e} · activity unknown`;let r=Vh(t).map(e=>e.text);return[e,r.length>0?r.join(` · `):`idle`].join(` · `)}function Vh(e){let{needsYou:t,failedUnread:n,inMotion:r,finishedUnread:i}=e??Lh,a=[];return t>0&&a.push({tone:`amber`,text:`${t} needs you`}),n>0&&a.push({tone:`red`,text:`${n} failed`}),r>0&&a.push({tone:`violet`,text:`${r} working`}),i>0&&a.push({tone:`green`,text:`${i} finished`}),a}function Hh(e){let t={...Lh};for(let n of e)n&&(t.needsYou+=n.needsYou,t.failedUnread+=n.failedUnread,t.inMotion+=n.inMotion,t.finishedUnread+=n.finishedUnread);return t}function Uh(e){let t=e.split(/[-_ .]+/).filter(e=>e!==``);return(t.length>=2?[t[0],t[1]].map(e=>[...e][0]):[...t[0]??``].slice(0,2)).join(``).toLowerCase()}var Wh=`w-[228px] rounded-[10px] border-border bg-sidebar p-[5px] text-foreground shadow-[0_10px_28px_#00000047] motion-reduce:animate-none`,Gh=`h-8 gap-2.5 rounded-[6px] px-[9px] py-0 text-[13px] focus:bg-sidebar-row-hover focus:text-foreground [&_svg]:size-[15px] [&_svg]:text-soft-foreground focus:[&_svg]:text-foreground max-md:min-h-11`;function Kh(){let e=Ss(),t=En(),n=bn(),r=n.data?.bootProject??t.data?.bootProject,i=e??r??null,a=n.data?.projects.find(e=>e.id===i),o=i===r?t.data?.repo:void 0,s=a?.root??o?.root;return{health:t,registry:n,projectId:i,project:a,root:s,name:a?.name??s?.split(/[\\/]/).filter(Boolean).at(-1),branch:o?.branch??a?.branch}}function qh({onNavigate:e}={}){let t=(0,Z.useRef)(null),n=(0,Z.useRef)(null),[r,i]=(0,Z.useState)(0),{health:a,registry:o,projectId:s,root:c,name:l,branch:u}=Kh(),d=a.data?.capabilities.localHandoff===!0,f=l??(o.isPending?`Loading project…`:`Project unavailable`),p=[d?c:void 0,u].filter(Boolean).join(` · `);return(0,Q.jsxs)(`div`,{"data-slot":`project-header`,className:`flex min-w-0 items-center gap-2.5 px-[14px] pt-[14px] pb-2.5`,children:[(0,Q.jsx)(`span`,{ref:t,"aria-hidden":`true`,"data-slot":`project-header-mark`,className:`flex size-7 shrink-0 items-center justify-center rounded-[7px] border border-soft-foreground bg-sidebar-row-selected text-[11px] leading-none font-semibold text-foreground`,children:l?Uh(l):`…`}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-px`,children:[(0,Q.jsx)(`div`,{"data-slot":`project-header-name`,className:`truncate text-[14px] font-semibold text-foreground`,title:f,children:f}),(0,Q.jsx)(`div`,{"data-slot":`project-header-detail`,dir:`rtl`,className:`truncate text-left font-mono text-[10.5px] text-soft-foreground`,title:p||void 0,children:(0,Q.jsx)(`bdi`,{dir:`ltr`,children:p||(o.isPending?`Loading…`:`Branch unavailable`)})})]}),(0,Q.jsx)(Qh,{projectId:s,onNavigate:e,triggerRef:n,triggerClassName:`size-7 max-md:size-11`,align:`start`,alignOffset:r,onOpenChange:e=>{e&&t.current&&n.current&&i(t.current.getBoundingClientRect().left-n.current.getBoundingClientRect().left)}})]})}function Jh(e,t,n){let r=e.data?.bootProject??t.data?.bootProject,i=e.data?.projects.find(e=>e.id===n),a=n===r?t.data?.repo:void 0;return{bootId:r,project:i,root:i?.root??a?.root}}function Yh({marking:e,runs:t,unread:n,projectId:r}){return e||t.isError||t.data===void 0||n.length===0||r===null}function Xh({marking:e,runs:t,unread:n}){return e?`Marking…`:t.isError?`Unavailable`:t.data===void 0?`Loading…`:`${n.length} unread`}function Zh(e,t){return!e||t?.status===`missing`}function Qh({projectId:e,onNavigate:t,triggerRef:n,triggerClassName:r,align:i=`start`,alignOffset:a,side:o,onOpenChange:s}){let c=od(),l=En(),u=bn(),[d,f]=(0,Z.useState)(!1),{bootId:p,project:m,root:h}=Jh(u,l,e),_=gn(e??`default`,e!==null,e===p),v=jn(fr({projectId:e??`default`,boot:e===p})),y=(0,Z.useRef)(e);y.current=e;let b=l.data?.capabilities.localHandoff===!0,x=(_.data??[]).filter(e=>!zr(e)&&Zr(e));async function S(){f(!0);let t=0;try{for(let n of x){if(y.current!==e)break;try{await v.mutateAsync(n.id)}catch{t+=1}}t>0&&G(`Could not mark ${t} task${t===1?``:`s`} read. Try again.`,{tone:`danger`})}finally{f(!1)}}async function w(){if(h)try{await navigator.clipboard.writeText(h),G(`Project folder copied`)}catch{G(`Could not copy path: ${h}`,{tone:`danger`})}}return(0,Q.jsxs)(No,{...g({onOpenChange:s}),children:[(0,Q.jsx)(Ao,{asChild:!0,children:(0,Q.jsx)(`button`,{"data-slot":`project-menu-trigger`,ref:n,type:`button`,"aria-label":`Project menu`,className:C(`flex shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-[state=open]:bg-sidebar-row-selected data-[state=open]:text-foreground`,r),children:(0,Q.jsx)(hu,{"aria-hidden":`true`,className:`size-[15px]`})})}),(0,Q.jsxs)(jo,{align:i,...g({alignOffset:a,side:o}),sideOffset:4,className:Wh,children:[(0,Q.jsxs)(Eo,{className:Gh,disabled:Yh({marking:d,runs:_,unread:x,projectId:e}),onSelect:()=>{S()},children:[(0,Q.jsx)($l,{"aria-hidden":`true`}),` Mark all read`,(0,Q.jsx)(`span`,{className:`ml-auto text-[11.5px] text-soft-foreground`,children:Xh({marking:d,runs:_,unread:x})})]}),(0,Q.jsx)(Do,{className:`mx-0`}),b&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($h,{projectId:e??`default`,disabled:Zh(h,m)}),(0,Q.jsxs)(Eo,{className:Gh,disabled:!h,onSelect:()=>{w()},children:[(0,Q.jsx)(uu,{"aria-hidden":`true`}),` Copy path`]}),(0,Q.jsx)(Do,{className:`mx-0`})]}),(0,Q.jsx)(Eo,{asChild:!0,className:Gh,children:(0,Q.jsxs)(Y,{to:`/settings`,onClick:t??c,children:[(0,Q.jsx)(Uu,{"aria-hidden":`true`}),` Project settings`]})})]})]})}function $h({disabled:e,projectId:t}){let n=wn(),r=H({mutationFn:e=>ye(e,t),onError:e=>G(e.message,{tone:`danger`}),onSuccess:()=>G(`Opening project folder`)}),i=(n.data?.targets??[]).filter(e=>Ah(e.id)===void 0);return(0,Q.jsxs)(Po,{children:[(0,Q.jsxs)(Co,{className:Gh,disabled:e||r.isPending,children:[(0,Q.jsx)(hi,{"aria-hidden":`true`}),` Open in`]}),(0,Q.jsx)(ko,{children:(0,Q.jsxs)(So,{className:Wh,children:[i.map(e=>{let t=kh(e);return(0,Q.jsxs)(Eo,{className:Gh,"data-target":e.id,onSelect:()=>r.mutate(e.id),children:[(0,Q.jsx)(t,{"aria-hidden":`true`}),e.label]},e.id)}),i.length===0&&(0,Q.jsx)(Eo,{className:Gh,disabled:!0,children:n.isError?`Apps unavailable`:n.isPending?`Loading apps…`:`No apps available`})]})})]})}var eg={amber:`text-signal-word-amber`,red:`text-signal-word-red`,violet:`text-status-running`,green:`text-success`};function tg({signal:e,known:t,current:n,maxParts:r,slot:i,className:a}){let o=Vh(e).slice(0,r);return(0,Q.jsx)(`span`,{"data-slot":i,className:C(`flex min-w-0 items-center font-medium`,n?`text-muted-foreground`:`text-soft-foreground`,a),children:t?o.length===0?`idle`:o.map((e,t)=>(0,Q.jsxs)(`span`,{className:`flex items-center gap-x-[inherit]`,children:[t>0?(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,(0,Q.jsx)(`span`,{"data-tone":e.tone,className:eg[e.tone],children:e.text})]},e.tone)):`activity unknown`})}var ng=h(`inline-block shrink-0`,{variants:{tone:{success:``,pending:``,danger:``,accent:``,info:``,running:``,neutral:``},shape:{filled:`size-[7px] rounded-full`,ring:`size-[7px] rounded-full border-[1.5px] bg-transparent`,workers:`inline-flex size-[12px] items-center justify-center`},pulse:{true:`animate-pulse motion-reduce:animate-none`,false:``}},compoundVariants:[{shape:`filled`,tone:`success`,className:`bg-success`},{shape:`filled`,tone:`pending`,className:`bg-pending-strong`},{shape:`filled`,tone:`danger`,className:`bg-danger`},{shape:`filled`,tone:`accent`,className:`bg-accent-strong`},{shape:`filled`,tone:`info`,className:`bg-info`},{shape:`filled`,tone:`running`,className:`bg-status-running`},{shape:`filled`,tone:`neutral`,className:`bg-soft-foreground`},{shape:`ring`,tone:`success`,className:`border-success`},{shape:`ring`,tone:`pending`,className:`border-pending-strong`},{shape:`ring`,tone:`danger`,className:`border-danger`},{shape:`ring`,tone:`accent`,className:`border-accent-strong`},{shape:`ring`,tone:`info`,className:`border-info`},{shape:`ring`,tone:`running`,className:`border-status-running`},{shape:`ring`,tone:`neutral`,className:`border-soft-foreground`},{shape:`workers`,tone:`success`,className:`text-success`},{shape:`workers`,tone:`pending`,className:`text-pending-strong`},{shape:`workers`,tone:`danger`,className:`text-danger`},{shape:`workers`,tone:`accent`,className:`text-accent-icon`},{shape:`workers`,tone:`info`,className:`text-info`},{shape:`workers`,tone:`running`,className:`text-status-running`},{shape:`workers`,tone:`neutral`,className:`text-soft-foreground`}],defaultVariants:{tone:`neutral`,shape:`filled`,pulse:!1}});function $({className:e,tone:t=`neutral`,shape:n=`filled`,pulse:r=!1,...i}){return(0,Q.jsx)(`span`,{"data-slot":`status-dot`,"data-tone":t,"data-shape":n,"data-pulse":r?`true`:void 0,className:C(ng({tone:t,shape:n,pulse:r,className:e})),...i,children:n===`workers`?(0,Q.jsx)(Yl,{className:`size-[12px]`,"aria-hidden":`true`}):null})}function rg(e,t){let n=e=>e.split(`.`).slice(0,3).map(e=>Number.parseInt(e,10)||0),r=n(e),i=n(t);for(let e=0;e<3;e++){let t=(r[e]??0)-(i[e]??0);if(t!==0)return t>0}return!1}var ig={amber:`bg-pending text-signal-ink-amber`,red:`bg-danger text-signal-ink`,violet:`bg-status-running text-signal-ink`,green:`bg-success text-signal-ink`};function ag(e,t,n){return e>9&&!(n&&t>1)?22:t===1?18:14}function og({position:e,segments:t,className:n,compact:r=!1}){let i=t.filter(e=>e.count>0);return i.length===0?null:(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`rail-pill-${e}`,className:C(`pointer-events-none absolute -right-[4px] box-border flex h-[17px] overflow-hidden rounded-[9px] border-2 border-background`,e===`top`?`-top-[6px]`:`top-[25px]`,n),children:i.map(({tone:e,count:t})=>(0,Q.jsx)(`span`,{"data-segment":e,"data-count":t,style:{width:ag(t,i.length,r)},className:C(`flex items-center justify-center text-[10px] leading-[13px] font-bold tabular-nums`,ig[e]),children:t>9?`9+`:t},e))})}function sg(e){return{top:[{tone:`amber`,count:e?.needsYou??0},{tone:`red`,count:e?.failedUnread??0}],bottom:[{tone:`violet`,count:e?.inMotion??0},{tone:`green`,count:e?.finishedUnread??0}]}}var cg=`cez-theme`,lg=`(prefers-color-scheme: light)`,ug=`dark`;function dg(e){return e===`light`||e===`dark`||e===`system`?e:ug}function fg(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function pg(){try{return dg(localStorage.getItem(cg))}catch{return ug}}function mg(e){try{localStorage.setItem(cg,e)}catch{}}function hg(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(lg).matches}function gg(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t}function _g(e){return`/cezarion-mark-${e}.svg`}function vg(e){let t=document.querySelector(`link[rel="icon"]`);t&&(t.href=_g(e))}var yg=Z.createContext(null);function bg({children:e}){let[t,n]=Z.useState(pg),[r,i]=Z.useState(hg);Z.useEffect(()=>{let e=window.matchMedia?.(lg);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=fg(t,r);Z.useLayoutEffect(()=>{gg(document.documentElement,a),vg(a)},[a]);let o=Z.useCallback(e=>{n(e),mg(e)},[]),s=Z.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,Q.jsx)(yg.Provider,{value:s,children:e})}function xg(){let e=Z.useContext(yg);if(!e)throw Error(`Squawk: useTheme() must be called inside <ThemeProvider>`);return e}var Sg={light:`dark`,dark:`system`,system:`light`},Cg={light:`light`,dark:`dark`,system:`system`};function wg({className:e,showLabel:t=!1,labelClassName:n}){let{theme:r,setTheme:i}=xg(),a=Sg[r],o=va;return(0,Q.jsxs)(k,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":r,title:`Theme: ${Cg[r]}`,"aria-label":`Theme: ${Cg[r]}. Switch to ${Cg[a]}.`,onClick:()=>i(a),children:[(0,Q.jsx)(o,{"aria-hidden":`true`}),t?(0,Q.jsxs)(`span`,{className:n,children:[`Theme · `,r.charAt(0).toUpperCase()+r.slice(1)]}):null]})}function Tg({...e}){return(0,Q.jsx)(qo,{"data-slot":`sheet`,...e})}function Eg({...e}){return(0,Q.jsx)(Bo,{"data-slot":`sheet-trigger`,...e})}function Dg({...e}){return(0,Q.jsx)(Uo,{"data-slot":`sheet-close`,...e})}function Og({...e}){return(0,Q.jsx)(Wo,{"data-slot":`sheet-portal`,...e})}function kg({className:e,...t}){return(0,Q.jsx)(zo,{"data-slot":`sheet-overlay`,className:C(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Ag({className:e,children:t,side:n=`right`,showCloseButton:r=!0,overlayClassName:i,...a}){return(0,Q.jsxs)(Og,{children:[(0,Q.jsx)(kg,{className:i}),(0,Q.jsxs)(Go,{"data-slot":`sheet-content`,className:C(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition-colors ease-in-out motion-safe:data-[state=closed]:animate-out data-[state=closed]:duration-300 motion-safe:data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 end-0 h-full w-3/4 border-s motion-safe:data-[state=closed]:slide-out-to-right motion-safe:data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 start-0 h-full w-3/4 border-e motion-safe:data-[state=closed]:slide-out-to-left motion-safe:data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 inset-bs-0 h-auto border-be motion-safe:data-[state=closed]:slide-out-to-top motion-safe:data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 inset-be-0 h-auto border-bs motion-safe:data-[state=closed]:slide-out-to-bottom motion-safe:data-[state=open]:slide-in-from-bottom`,e),...a,children:[t,r&&(0,Q.jsxs)(Uo,{className:`absolute inset-bs-4 end-4 rounded-sm opacity-70 ring-offset-background transition-opacity pointer-hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,Q.jsx)(ra,{className:`size-4`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function jg({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sheet-header`,className:C(`flex flex-col gap-1.5 p-4`,e),...t})}function Mg({className:e,...t}){return(0,Q.jsx)(Ko,{"data-slot":`sheet-title`,className:C(`font-semibold text-foreground`,e),...t})}function Ng({className:e,...t}){return(0,Q.jsx)(Vo,{"data-slot":`sheet-description`,className:C(`text-sm text-muted-foreground`,e),...t})}function Pg(e,t){if(!e?.signals)return null;let n=e.signals;return Hh(e.projects.filter(e=>e.id!==t).map(e=>n.get(e.id)))}function Fg(e){let t=Vh(e??void 0).map(e=>e.text);return t.length>0?`Open projects. Elsewhere: ${t.join(`, `)}`:`Open projects`}function Ig({elsewhere:e}){if(!e)return null;let{top:t,bottom:n}=sg(e),r=`right-[2px] border-card`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(og,{position:`top`,segments:t,compact:!0,className:C(r,`top-[3px]`)}),(0,Q.jsx)(og,{position:`bottom`,segments:n,compact:!0,className:C(r,`top-[24px]`)})]})}function Lg({version:e,latestVersion:t=null}){let{resolvedTheme:n}=xg(),r=!!(e&&t&&rg(t,e));return(0,Q.jsxs)(`div`,{"data-slot":`drawer-identity`,className:`flex shrink-0 items-center gap-[12px] border-b border-border pt-[env(safe-area-inset-top)] pr-[14px] pb-[14px] pl-[18px]`,children:[(0,Q.jsx)(`img`,{src:`/cezarion-mark-${n}.svg`,alt:``,"aria-hidden":`true`,className:`mt-[14px] size-[32px] rounded-lg`}),(0,Q.jsx)(`span`,{"data-slot":`drawer-wordmark`,className:`mt-[14px] text-[18px] leading-none font-bold tracking-[-0.02em] text-foreground`,children:`Squawk`}),e?(0,Q.jsxs)(`span`,{"data-slot":`drawer-version`,"data-update-available":r?`true`:void 0,title:r?`v${e} — update available: v${t}`:`v${e}`,className:`mt-[14px] min-w-0 truncate text-[11px] leading-none text-soft-foreground`,children:[r?(0,Q.jsx)($,{tone:`pending`,className:`mr-1 inline-block size-[5px] align-middle`}):null,`v`,e]}):null,(0,Q.jsx)(Dg,{asChild:!0,children:(0,Q.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`mt-[14px] ml-auto size-[44px] text-foreground`,children:(0,Q.jsx)(ra,{className:`size-[19px]`,"aria-hidden":`true`})})})]})}function Rg({project:e,signal:t,known:n,current:r,onNavigate:i}){let{top:a,bottom:o}=sg(t),s=r?`border-sidebar-row-selected`:`border-sidebar`,c=`right-[-4px]`,l=(0,Q.jsxs)(E,{to:hs(e.id,`/`),onClick:i,"data-slot":`drawer-project`,"data-project-id":e.id,"aria-current":r?`page`:void 0,className:C(`flex h-[64px] min-w-0 items-center gap-[12px] rounded-[10px] px-[10px] text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r&&`flex-1 hover:bg-sidebar-row-selected`),children:[(0,Q.jsxs)(`span`,{"aria-hidden":`true`,className:C(`relative flex size-[40px] shrink-0 items-center justify-center rounded-[10px] border text-[13px] leading-none font-semibold`,r?`border-soft-foreground bg-sidebar text-foreground`:`border-transparent bg-muted text-muted-foreground`),children:[Uh(e.name),(0,Q.jsx)(og,{position:`top`,segments:a,className:C(c,s)}),(0,Q.jsx)(og,{position:`bottom`,segments:o,className:C(c,s,`top-[29px]`)})]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Q.jsx)(`span`,{className:`truncate text-[14.5px] leading-tight font-semibold`,children:e.name}),(0,Q.jsx)(tg,{signal:t,known:n,current:r,slot:`drawer-project-state`,className:`flex-wrap gap-x-[6px] text-[11.5px] leading-tight`})]}),r?(0,Q.jsx)(Qi,{"aria-hidden":`true`,className:`size-[16px] shrink-0 text-foreground`}):null]});return r?(0,Q.jsxs)(`div`,{"data-slot":`drawer-project-current`,className:`flex items-center rounded-[10px] bg-sidebar-row-selected pr-[4px]`,children:[l,(0,Q.jsx)(Qh,{projectId:e.id,onNavigate:i,triggerClassName:`size-[44px]`,align:`end`})]}):l}var zg=`flex h-[48px] w-full items-center gap-[12px] rounded-[10px] px-[10px] text-[14.5px] font-normal text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring [&_svg]:size-[18px] [&_svg]:shrink-0 [&_svg]:text-soft-foreground`;function Bg({nav:e,currentProjectId:t,onNavigate:n}){return(0,Q.jsxs)(`div`,{"data-slot":`drawer-projects`,className:`shrink-0`,children:[(0,Q.jsx)(`div`,{className:`px-[18px] pt-[14px] pb-[6px] text-[12px] font-medium text-soft-foreground`,id:`drawer-projects-label`,children:`Projects`}),(0,Q.jsx)(`div`,{role:`group`,"data-slot":`drawer-projects-group`,"aria-labelledby":`drawer-projects-label`,className:`flex flex-col gap-[2px] px-[8px] pb-[8px]`,children:e.projects.map(r=>(0,Q.jsx)(Rg,{project:r,signal:e.signals?.get(r.id),known:e.signals!==null,current:r.id===t,onNavigate:n},r.id))}),(0,Q.jsxs)(`div`,{"data-slot":`drawer-workspace`,className:`flex flex-col gap-[2px] border-t border-border px-[8px] py-[8px]`,children:[(0,Q.jsxs)(E,{to:`/tasks`,onClick:n,"data-slot":`drawer-all-projects`,className:zg,children:[(0,Q.jsx)(Da,{"aria-hidden":`true`}),`All projects · task overview`]}),(0,Q.jsx)(Eh,{origin:`mobile`,icon:Pi,iconClassName:`size-[18px]`,label:`Add project`,triggerClassName:C(zg,`h-[48px] justify-start p-0 px-[10px] text-foreground`)})]})]})}function Vg({onNavigate:e,tools:t}){let{theme:n,setTheme:r}=xg(),i=Sg[n],a=n.charAt(0).toUpperCase()+n.slice(1);return(0,Q.jsxs)(`div`,{"data-slot":`drawer-global`,className:`flex shrink-0 flex-col gap-[2px] border-t border-border px-[8px] pt-[8px] pb-[max(8px,env(safe-area-inset-bottom))]`,children:[t?(0,Q.jsxs)(E,{to:`/tools`,onClick:e,"data-slot":`drawer-tools`,"aria-label":t.blocked?`Tools, needs setup`:void 0,"aria-describedby":t.blocked&&t.note?`drawer-tools-note`:void 0,className:C(zg,t.note&&`h-auto min-h-[48px] py-[6px]`),children:[(0,Q.jsxs)(`span`,{className:`relative flex shrink-0`,children:[(0,Q.jsx)(ta,{"aria-hidden":`true`}),t.blocked?(0,Q.jsx)($,{tone:`pending`,"data-slot":`drawer-tools-dot`,className:`absolute -top-[2px] -right-[3px] ring-[1.5px] ring-sidebar`}):null]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`span`,{children:`Tools`}),t.note?(0,Q.jsx)(`span`,{id:`drawer-tools-note`,"data-slot":`drawer-tools-note`,className:`text-[11.5px] leading-tight text-soft-foreground`,children:t.note}):null]})]}):null,(0,Q.jsxs)(E,{to:`/settings/global/appearance`,onClick:e,"data-slot":`drawer-global-settings`,className:zg,children:[(0,Q.jsx)(Zi,{"aria-hidden":`true`}),`Global settings`]}),(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`theme-toggle`,"data-theme-pref":n,"aria-label":`Theme: ${n.toLowerCase()}. Switch to ${i}.`,onClick:()=>r(i),className:zg,children:[(0,Q.jsx)(va,{"aria-hidden":`true`}),`Theme · `,a]})]})}function Hg(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function Ug(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function Wg(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Hg(e.target)&&!Ug(e.target))}function Gg(e,t){let n=Z.useRef(t);Z.useLayoutEffect(()=>{n.current=t}),Z.useEffect(()=>{let t=t=>{Wg(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function Kg(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Hg(e.target))}function qg(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function Jg(e,t){let n=Z.useRef(t);Z.useLayoutEffect(()=>{n.current=t}),Z.useEffect(()=>{let t=t=>{Kg(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}var Yg=Z.createContext(null);function Xg(){return Z.useContext(Yg)}function Zg({slot:e,children:t}){return(0,sf.createPortal)(t,e)}var Qg=`(min-width: 768px)`;function $g(){let[e,t]=Z.useState(()=>window.matchMedia?.(Qg).matches??!0);return Z.useEffect(()=>{let e=window.matchMedia?.(Qg);if(!e)return;let n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function e_({delayDuration:e=0,...t}){return(0,Q.jsx)(Vm,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function t_({...e}){return(0,Q.jsx)(Hm,{"data-slot":`tooltip`,...e})}function n_({...e}){return(0,Q.jsx)(Um,{"data-slot":`tooltip-trigger`,...e})}function r_({className:e,sideOffset:t=0,children:n,...r}){return(0,Q.jsx)(Wm,{children:(0,Q.jsxs)(Gm,{"data-slot":`tooltip-content`,sideOffset:t,className:C(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) motion-safe:animate-in rounded-md bg-contrast px-3 py-1.5 text-xs text-balance text-contrast-foreground fade-in-0 motion-safe:zoom-in-95 motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,Q.jsx)(Km,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-contrast fill-contrast`})]})})}var i_=[`/git`,`/automations`,`/workflows`,`/reports`];function a_({items:e,activeTo:t,needsYou:n=!1,onNavigate:r}){let[i,a]=(0,Z.useState)(!1),o=(0,Z.useRef)(null),s=e.filter(e=>i_.includes(e.to)),c=e.filter(e=>!s.includes(e)),l=s.some(e=>e.to===t);return(0,Q.jsx)(e_,{children:(0,Q.jsxs)(`nav`,{ref:o,"aria-label":`Main`,"data-slot":`view-tabs`,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;let t=Array.from(o.current?.querySelectorAll(`[data-view-tab]`)??[]),n=t.indexOf(document.activeElement);n<0||(e.preventDefault(),t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowRight`?1:-1)+t.length)%t.length]?.focus())},className:`flex shrink-0 items-center justify-between max-md:justify-start max-md:gap-1 max-md:overflow-x-auto border-b border-border px-3 pt-2.5 pb-2`,children:[c.map(e=>{let i=e.to===t,a=e.icon,o=e.to===`/`&&n&&!i;return(0,Q.jsxs)(t_,{children:[(0,Q.jsx)(n_,{asChild:!0,children:(0,Q.jsxs)(Y,{to:e.to,onClick:r,"data-view-tab":!0,"aria-label":e.label,"aria-current":i?`page`:void 0,className:C(`relative flex h-[30px] min-w-0 items-center justify-center rounded-[7px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11`,i?`shrink-0 gap-1.5 bg-sidebar-row-selected px-[9px] text-[12px] font-semibold text-foreground`:`w-7 shrink-0`),children:[(0,Q.jsxs)(`span`,{className:`relative`,children:[(0,Q.jsx)(a,{className:`size-[15px] shrink-0`,"aria-hidden":`true`}),o?(0,Q.jsx)(`span`,{"aria-label":`Tasks need you`,"data-slot":`nav-needs-you-dot`,className:`absolute -top-1 -right-1 size-[7px] rounded-full border-[1.5px] border-sidebar bg-pending-strong`}):null]}),i?(0,Q.jsx)(`span`,{className:`truncate`,children:e.label}):null]})}),(0,Q.jsx)(r_,{side:`bottom`,sideOffset:6,style:{pointerEvents:`none`},children:e.label})]},e.to)}),s.length?(0,Q.jsxs)(No,{open:i,onOpenChange:a,children:[(0,Q.jsxs)(t_,{children:[(0,Q.jsx)(n_,{asChild:!0,children:(0,Q.jsx)(Ao,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"data-view-tab":!0,"aria-label":`More views`,"data-active":l?`true`:void 0,className:C(`relative flex h-[30px] w-7 shrink-0 items-center justify-center rounded-[7px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11`,(i||l)&&`bg-sidebar-row-selected text-foreground`),children:(0,Q.jsx)(hu,{className:`size-[15px]`,"aria-hidden":`true`})})})}),(0,Q.jsx)(r_,{side:`bottom`,sideOffset:6,style:{pointerEvents:`none`},children:`More views`})]}),(0,Q.jsx)(jo,{align:`end`,sideOffset:4,className:`w-48 rounded-[10px] border-border bg-sidebar p-[5px] shadow-[0_10px_28px_#00000047]`,children:s.map(e=>{let n=e.icon,i=e.to===t;return(0,Q.jsx)(Eo,{asChild:!0,className:C(`h-8 max-md:min-h-11 gap-2.5 rounded-md px-[9px] text-[13px] text-foreground focus:bg-sidebar-row-hover`,i&&`bg-sidebar-row-selected font-medium`),children:(0,Q.jsxs)(Y,{to:e.to,onClick:r,"aria-current":i?`page`:void 0,children:[(0,Q.jsx)(n,{className:`size-[15px] text-soft-foreground`}),e.label]})},e.to)})})]}):null]})})}var o_=[{to:`/`,label:`Tasks`,icon:Mi,match:[`/`,`/tasks`],badge:`tasks-unread`},{to:`/activity`,label:`Activity`,icon:ql,match:[`/activity`]},{to:`/git`,label:`Git`,icon:ji,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:Ri,match:[`/github`],forge:!0},{to:`/automations`,label:`Automations`,icon:ga,match:[`/automations`],automations:!0},{to:`/skills`,label:`Skills`,icon:xa,match:[`/skills`]},{to:`/workflows`,label:`Workflows`,icon:Ca,match:[`/workflows`]},{to:`/reports`,label:`Reports`,icon:yu,match:[`/reports`]},{to:`/settings`,label:`Settings`,icon:Ui,match:[`/settings`]}];function s_({forge:e=!1,automations:t=!1}={}){return o_.filter(n=>(!n.forge||e)&&(!n.automations||t))}function c_(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function l_(e){let t=null;for(let n of o_)for(let r of n.match)c_(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function u_(e){let t=l_(e);return o_.find(e=>e.to===t)??null}function d_(e){return/^\/tasks\/[^/]+(?:\/|$)/.test(bs(e))}function f_(e,t){let n=bs(e);return/^\/git\/?$/.test(n)?new URLSearchParams(t).get(`view`)===`repo`:n.startsWith(`/git/`)}var p_=[`/`,`/activity`,`/github`],m_=[`/git`,`/skills`,`/workflows`,`/reports`,`/settings`,`/automations`];function h_(e,t,n){let r=bs(e),i=r===`/new`,a=d_(e);return{activeTo:i?`/new`:l_(r),current:u_(r),currentProjectId:_s(e),newTask:i,pushed:a,showTabBar:!a&&!f_(e,t)&&!n,gitRepositoryView:r===`/git`&&new URLSearchParams(t).get(`view`)===`repo`}}var g_=[{to:`/git`,label:`Git`},{to:`/skills`,label:`Skills`},{to:`/workflows`,label:`Workflows`},{to:`/reports`,label:`Reports`},{to:`/settings`,label:`Project settings`}],__=[`/automations`],v_=`flex h-[50px] min-h-11 w-full items-center gap-[14px] rounded-[10px] px-[10px] text-[14.5px] text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-ring [&_svg]:size-[18px] [&_svg]:shrink-0 [&_svg]:text-muted-foreground`;function y_({open:e,onOpenChange:t,onCloseAutoFocus:n,projectName:r,items:i,activeTo:a}){let o=new Map(i.map(e=>[e.to,e])),s=g_.flatMap(({to:e,label:t})=>{let n=o.get(e);return n?[{to:e,label:t,icon:n.icon}]:[]}),c=__.flatMap(e=>{let t=o.get(e);return t?[{to:e,label:t.label,icon:t.icon}]:[]}),l=()=>t(!1),u=({to:e,label:t,icon:n})=>{let r=e===a;return(0,Q.jsxs)(Y,{to:e,onClick:l,"data-slot":`more-row`,"data-more-row":e,"aria-current":r?`page`:void 0,className:C(v_,r&&`bg-sidebar-row-selected hover:bg-sidebar-row-selected`),children:[(0,Q.jsx)(n,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),(0,Q.jsx)(Sa,{"aria-hidden":`true`,className:`!size-[15px]`})]},e)};return(0,Q.jsx)(Tg,{open:e,onOpenChange:t,children:(0,Q.jsxs)(Ag,{side:`bottom`,"data-slot":`more-sheet`,showCloseButton:!1,onCloseAutoFocus:n,"aria-describedby":void 0,className:`gap-0 rounded-t-[20px] border-border bg-sidebar px-[14px] pt-[10px] pb-[max(14px,env(safe-area-inset-bottom))] md:hidden`,children:[(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`mx-auto mb-[14px] h-[5px] w-[36px] rounded-[3px] bg-border`}),(0,Q.jsxs)(`div`,{className:`flex items-baseline gap-[10px] px-[10px] pb-[6px]`,children:[(0,Q.jsx)(Mg,{className:`text-[17px] leading-tight font-bold`,children:`More`}),r?(0,Q.jsx)(`span`,{"data-slot":`more-project`,className:`min-w-0 truncate text-[12.5px] text-soft-foreground`,children:r}):null]}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-[2px]`,children:s.map(u)}),c.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{role:`separator`,className:`mx-[10px] mt-[8px] border-t border-border`}),(0,Q.jsx)(`div`,{className:`px-[10px] pt-[12px] pb-[4px] text-[12px] font-medium text-soft-foreground`,children:`Shown when their flag is on`}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-[2px]`,children:c.map(u)})]}):null]})})}var b_=`(min-width: 768px)`;function x_({items:e,activeTo:t,signal:n,projectName:r,showNewTask:i=!0}){let[o,s]=Z.useState(!1),c=Z.useRef(null),{pathname:l}=a();Z.useEffect(()=>{s(!1)},[l]),Z.useEffect(()=>{let e=window.matchMedia?.(b_);if(!e)return;e.matches&&s(!1);let t=e=>{e.matches&&s(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let u=e.filter(e=>p_.includes(e.to)),d=t!==null&&m_.includes(t),{top:f}=sg(n),p=f.some(e=>e.count>0),m=e=>C(`relative flex h-full min-h-11 min-w-11 flex-1 flex-col items-center justify-center gap-[3px] text-[10.5px] leading-none focus-visible:outline-2 focus-visible:outline-ring`,e?`font-semibold text-foreground`:`font-medium text-soft-foreground`);return(0,Q.jsxs)(Q.Fragment,{children:[i?(0,Q.jsxs)(Y,{to:`/new`,"data-slot":`mobile-new-task`,className:`group-has-[[data-new-task-action]]/shell:hidden absolute right-4 bottom-full z-30 mb-4 flex h-12 items-center gap-2 rounded-[24px] bg-foreground px-[18px] text-[14px] font-semibold text-background shadow-[0_8px_24px_#00000055] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(zi,{"aria-hidden":`true`,className:`size-[18px]`}),`New task`]}):null,(0,Q.jsxs)(`nav`,{"aria-label":`Views`,"data-slot":`mobile-tab-bar`,className:`flex h-[54px] items-stretch`,children:[u.map(e=>{let n=e.to===t,r=e.icon,i=e.to===`/`&&p;return(0,Q.jsxs)(Y,{to:e.to,"data-tab":e.to,"aria-current":n?`page`:void 0,className:m(n),children:[(0,Q.jsxs)(`span`,{className:`relative`,children:[(0,Q.jsx)(r,{"aria-hidden":`true`,className:`size-[21px]`}),i?(0,Q.jsx)(og,{position:`top`,segments:f,className:`-top-[6px] -right-[10px] border-sidebar`}):null]}),e.label]},e.to)}),(0,Q.jsxs)(`button`,{ref:c,type:`button`,"data-tab":`more`,"aria-haspopup":`dialog`,"aria-expanded":o,"data-active":d?`true`:void 0,onClick:()=>s(!0),className:m(d),children:[(0,Q.jsx)(`span`,{className:`relative`,children:(0,Q.jsx)(Ta,{"aria-hidden":`true`,className:`size-[21px]`})}),`More`]})]}),(0,Q.jsx)(y_,{open:o,onOpenChange:s,onCloseAutoFocus:e=>{c.current?.isConnected&&(e.preventDefault(),c.current.focus())},projectName:r,items:e,activeTo:t})]})}var S_=`(min-width: 768px)`;function C_(e){return m({path:`/tasks/:id`,end:!0},bs(e))!==null}function w_(e){let t=bs(e);return t===`/github`||t.startsWith(`/github/`)}function T_({children:e,breadcrumb:t,repo:n=null,version:r=null,latestVersion:i=null,sidebarList:o,taskQuickList:s,sessionScope:c,toolsMenu:l,forgeAvailable:u=!0,automationsAvailable:f=!0,banner:p,mobileProjects:m,projectHeader:h,sidebarProjectId:g,needsYou:_,projectRail:v,toolsStatus:y}){let{pathname:b,search:x}=a(),{activeTo:S,current:w,currentProjectId:T,newTask:E,pushed:D,showTabBar:O,gitRepositoryView:k}=h_(b,x,jr()),[A,j]=Z.useState(!1),[M,ee]=Z.useState(null),te=Z.useRef(null),ne=Z.useRef(null),re=Z.useRef(null),ie=C_(b);Z.useLayoutEffect(()=>{let e=re.current;if(re.current=b,ie||e!==null&&_s(e)===_s(b)&&w_(e)&&w_(b))return;let t=ne.current;t&&(t.scrollTop=0)},[b,ie,k]);let N=d(),P=Z.useRef(b);Z.useEffect(()=>{let e=P.current;P.current=b,e!==b&&(N===`REPLACE`&&M_(e,b)||j(!1))},[b,N]),Z.useEffect(()=>{let e=window.matchMedia?.(S_);if(!e)return;e.matches&&j(!1);let t=e=>{e.matches&&j(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let F=s_({forge:u,automations:f}),ae={version:r,latestVersion:i};return(0,Q.jsx)(Tg,{open:A,onOpenChange:j,children:(0,Q.jsxs)(`div`,{"data-slot":`app-shell`,className:`flex h-dvh overflow-hidden bg-background text-foreground pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)]`,children:[(0,Q.jsx)(O_,{projectRail:v,activeTo:S,items:F,repo:n,release:ae,sidebarList:o,taskQuickList:s,sessionScope:c,toolsMenu:l,projectHeader:h,sidebarProjectId:g,needsYou:_}),(0,Q.jsx)(j_,{release:ae,taskQuickList:s,sidebarProjectId:g,mobileProjects:m,currentProjectId:T,toolsStatus:y,onNavigate:()=>j(!1),onCloseAutoFocus:e=>{te.current?.isConnected&&(e.preventDefault(),te.current.focus())}}),(0,Q.jsxs)(`div`,{className:`group/shell grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,children:[(0,Q.jsx)(R_,{title:w?.label??`Squawk`,pushed:D?{onSlot:ee}:null,repo:n,elsewhere:Pg(m,T),onTrigger:e=>{te.current=e}}),(0,Q.jsx)(E_,{breadcrumb:t,repo:n,label:w?.label,newTask:E}),p?(0,Q.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:p}):null,(0,Q.jsx)(`main`,{ref:ne,"data-slot":`main`,className:C(`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,O&&!E&&`max-md:pb-20`),children:(0,Q.jsx)(Yg.Provider,{value:D?M:null,children:e})}),(0,Q.jsx)(D_,{showTabBar:O,items:F,activeTo:S,mobileProjects:m,currentProjectId:T,repo:n,newTask:E})]})]})})}function E_({breadcrumb:e,repo:t,label:n,newTask:r}){let i=e?.project??t?.name,a=e?.branch??t?.branch;return(0,Q.jsxs)(`header`,{"data-slot":`desktop-breadcrumb`,className:C(`row-start-1 hidden min-w-0 items-center gap-3 border-b border-border text-[13px] text-muted-foreground md:flex`,r?`h-[72px] px-11`:`h-16 px-9`),children:[(0,Q.jsx)(Gi,{"aria-hidden":`true`,className:`size-4 shrink-0`}),i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:i}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`/`})]}):null,(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:e?.page??n??`Squawk`}),a?(0,Q.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 text-[11px]`,children:[(0,Q.jsx)(Ai,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),a]}):null]})}function D_({showTabBar:e,items:t,activeTo:n,mobileProjects:r,currentProjectId:i,repo:a,newTask:o}){let s=i===null?void 0:r?.signals?.get(i);return(0,Q.jsx)(`div`,{"data-slot":`composer`,className:C(`row-start-4 pb-[max(env(safe-area-inset-bottom),var(--kb,0px))]`,e&&`relative max-md:border-t max-md:border-border max-md:bg-sidebar`),children:e?(0,Q.jsx)(`div`,{className:`md:hidden`,children:(0,Q.jsx)(x_,{items:t,activeTo:n,signal:s,projectName:r?.projects.find(e=>e.id===i)?.name??a?.name??null,showNewTask:!o})}):null})}function O_({projectRail:e,...t}){let[n,r]=Z.useState(nd),i=Z.useCallback(e=>{let t=td(e);r(t),rd(t)},[]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(id.Provider,{value:n,children:e}),(0,Q.jsx)(k_,{...t,width:n,onWidthChange:i})]})}function k_({width:e,onWidthChange:t,...n}){return(0,Q.jsxs)(`aside`,{"data-slot":`sidebar`,style:{width:e},className:`relative hidden shrink-0 flex-col border-r border-border bg-sidebar md:flex`,children:[(0,Q.jsx)(P_,{...n}),(0,Q.jsx)(A_,{width:e,onWidthChange:t})]})}function A_({width:e,onWidthChange:t}){let n=Z.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(td(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,Q.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(td(r)))},onDoubleClick:()=>t(264),title:`Drag to resize the sidebar — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-[var(--composer-border)] focus-visible:bg-[var(--composer-border)] focus-visible:outline-none`})}function j_({onNavigate:e,onCloseAutoFocus:t,mobileProjects:n,currentProjectId:r,toolsStatus:i,release:a,taskQuickList:o,sidebarProjectId:s}){return(0,Q.jsxs)(Ag,{side:`left`,"data-slot":`mobile-nav-drawer`,onCloseAutoFocus:t,overlayClassName:`bg-[var(--nav-scrim)]`,showCloseButton:!1,className:`w-[calc(100%-68px)] max-w-[334px] gap-0 border-border bg-sidebar p-0 sm:max-w-[334px] md:hidden`,"aria-describedby":void 0,children:[(0,Q.jsx)(Mg,{className:`sr-only`,children:`Navigation`}),(0,Q.jsx)(Lg,{version:a.version,latestVersion:a.latestVersion}),(0,Q.jsxs)(`div`,{"data-slot":`drawer-scroll`,className:`flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,children:[n?(0,Q.jsx)(Bg,{nav:n,currentProjectId:r,onNavigate:e}):null,o?(0,Q.jsx)(N_,{projectId:s,onNavigate:e,children:(0,Q.jsx)(`div`,{"data-slot":`drawer-tasks`,className:`border-t border-border px-[8px] py-[8px]`,children:o})}):null]}),(0,Q.jsx)(Vg,{onNavigate:e,tools:i})]})}function M_(e,t){return _s(e)==="default"&&_s(t)!==null&&_s(t)!=="default"&&bs(e)===bs(t)}function N_({projectId:e,onNavigate:t,children:n}){let r=Mt(),i=e===void 0?r:{projectId:e,apiBase:`${l}/p/${encodeURIComponent(e)}`};return(0,Q.jsx)(It.Provider,{value:i,children:(0,Q.jsx)(ad.Provider,{value:t,children:n})})}function P_({activeTo:e,items:t,repo:n,release:r,sidebarList:i,taskQuickList:a,sessionScope:o,toolsMenu:s,projectHeader:c,sidebarProjectId:l,needsYou:u,onNavigate:d}){return(0,Q.jsx)(N_,{projectId:l,onNavigate:d,children:(0,Q.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,Q.jsx)(`div`,{"data-slot":`sidebar-header`,className:`shrink-0`,children:c??(n?(0,Q.jsxs)(`div`,{className:`px-[14px] pt-[14px] pb-2.5`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:n.name}),(0,Q.jsx)(`div`,{className:`truncate font-mono text-[10.5px] text-soft-foreground`,children:n.branch})]}):null)}),(0,Q.jsxs)(`div`,{"data-slot":`sidebar-actions`,className:`flex flex-col gap-2 px-3`,children:[(0,Q.jsx)(I_,{}),(0,Q.jsx)(k,{asChild:!0,variant:`ghost`,className:C(`relative h-[32px] max-md:min-h-11 rounded-[7px] bg-muted w-full min-w-0 justify-start gap-2 px-2.5 text-[12.5px] font-medium text-foreground hover:bg-sidebar-row-hover hover:text-foreground`,e===`/new`&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:(0,Q.jsxs)(Y,{to:`/new`,onClick:d,"data-sidebar-item":`new-task`,"aria-current":e===`/new`?`page`:void 0,children:[(0,Q.jsx)(zi,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,Q.jsx)(`kbd`,{"aria-hidden":`true`,className:`sr-only`,children:`C`})]})})]}),o?(0,Q.jsx)(`div`,{className:`shrink-0 px-3 pt-2`,children:o}):null,(0,Q.jsx)(a_,{items:t,activeTo:e,needsYou:u,onNavigate:d}),(0,Q.jsx)(`div`,{"data-slot":`project-task-navigation`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-3`,children:(0,Q.jsx)(ad.Provider,{value:d,children:i??(0,Q.jsx)(`div`,{"data-slot":`task-quick-list`,children:a})})}),(0,Q.jsx)(F_,{toolsMenu:s,release:r})]})})}function F_({toolsMenu:e,release:t}){return(0,Q.jsx)(`div`,{"data-slot":`sidebar-footer`,className:`shrink-0`,children:(0,Q.jsxs)(`div`,{"data-slot":`sidebar-footer-controls`,className:`flex h-11 items-center justify-between gap-1 border-t border-border px-3`,children:[(0,Q.jsx)(`div`,{"data-slot":`tools-menu`,className:`shrink-0`,children:e}),(0,Q.jsx)(`div`,{className:`flex min-w-0 items-center gap-1`,"data-slot":`version-action`,children:t.version?(0,Q.jsx)(L_,{version:t.version,latestVersion:t.latestVersion}):null})]})})}function I_(){return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search — command palette (⌘K / Ctrl+K)`,onClick:()=>$u(),className:`flex h-[32px] max-md:min-h-11 w-full items-center gap-2 rounded-[7px] border border-border bg-background px-2.5 text-left text-[12.5px] font-normal text-soft-foreground transition-colors hover:border-border hover:text-foreground`,children:[(0,Q.jsx)(Yi,{className:`size-[14px] shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:`Search…`}),(0,Q.jsx)(`kbd`,{"aria-hidden":`true`,className:`ml-auto shrink-0 font-sans text-[11px] font-normal text-soft-foreground`,children:qg(`k`)})]})}function L_({version:e,latestVersion:t}){let n=!!(t&&rg(t,e));return(0,Q.jsxs)(`span`,{"data-slot":`version-chip`,"data-update-available":n?`true`:void 0,title:n?`v${e} — update available: v${t}`:`v${e}`,className:`flex min-w-0 items-center gap-1 font-mono text-[11px] text-soft-foreground`,children:[n?(0,Q.jsx)($,{tone:`pending`,className:`size-[5px] shrink-0`}):null,(0,Q.jsxs)(`span`,{className:`truncate`,children:[`v`,e]})]})}function R_({title:e,pushed:t,repo:n,elsewhere:r,onTrigger:i}){return t?(0,Q.jsx)(z_,{onSlot:t.onSlot}):(0,Q.jsx)(`header`,{"data-slot":`mobile-top-bar`,className:`row-start-1 min-w-0 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,Q.jsxs)(`div`,{className:`flex h-[56px] min-w-0 items-center gap-[8px] px-[8px]`,children:[(0,Q.jsx)(Eg,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`ghost`,"aria-label":Fg(r),onClick:e=>i(e.currentTarget),className:`relative h-[44px] w-[64px] shrink-0 justify-start rounded-md p-0 pl-[10px] text-foreground`,children:[(0,Q.jsx)(qi,{className:`size-[20px]`,"aria-hidden":`true`}),(0,Q.jsx)(Ig,{elsewhere:r})]})}),n?(0,Q.jsx)(Eg,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`mobile-project-picker`,"aria-label":`Switch project: ${n.name}`,onClick:e=>i(e.currentTarget),className:`flex h-[44px] min-w-0 flex-1 items-center justify-start gap-[10px] rounded-md text-left focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-[28px] shrink-0 items-center justify-center rounded-[8px] border border-soft-foreground bg-sidebar-row-selected text-[11px] leading-none font-semibold text-foreground`,children:Uh(n.name)}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`span`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,children:n.name}),n.branch?(0,Q.jsx)(`span`,{className:`truncate font-mono text-[10.5px] leading-tight text-soft-foreground`,children:n.branch}):null]}),(0,Q.jsx)(ua,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`})]})}):null,e===`Squawk`?n?null:(0,Q.jsx)(`span`,{className:`flex-1`}):(0,Q.jsx)(`span`,{"data-slot":`mobile-route-title`,className:C(`truncate text-[15px] font-semibold text-foreground`,n?`sr-only`:`min-w-0 flex-1 pl-[8px]`),children:e}),(0,Q.jsx)(k,{variant:`ghost`,"aria-label":`Search`,"data-slot":`mobile-search`,onClick:()=>$u(),className:`ml-auto size-[44px] shrink-0 p-0 text-foreground`,children:(0,Q.jsx)(Yi,{className:`size-[19px]`,"aria-hidden":`true`})})]})})}function z_({onSlot:e}){let t=gs();return(0,Q.jsx)(`header`,{"data-slot":`mobile-top-bar`,"data-mode":`task`,className:`row-start-1 min-w-0 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,Q.jsxs)(`div`,{className:`flex h-[56px] min-w-0 items-center gap-[4px] px-[8px]`,children:[(0,Q.jsx)(k,{variant:`ghost`,"aria-label":`Back`,"data-slot":`mobile-back`,onClick:()=>{let e=window.history.state?.idx;t(typeof e==`number`&&e>0?-1:`/`)},className:`size-[44px] shrink-0 p-0 text-foreground`,children:(0,Q.jsx)(tu,{className:`size-[22px]`,"aria-hidden":`true`})}),(0,Q.jsx)(`div`,{"data-slot":`mobile-run-bar`,ref:e,className:`flex min-w-0 flex-1 items-center gap-[4px]`})]})})}function B_(e,t){let n=typeof e==`string`?new URLSearchParams(e):e,r=n.get(`runner`),i=r!==null&&(t?.runners.some(e=>e.id===r)??!1),a=n.get(`skillPath`);return{skill:(n.get(`skill`)??``).trim(),...a?{skillPath:a}:{},...i?{runner:r}:{},...n.has(`account`)?{account:n.get(`account`)}:{},ref:(n.get(`ref`)??n.get(`task`)??``).trim()}}function V_(e){let t=new URLSearchParams;e.skill&&t.set(`skill`,e.skill),e.skillPath!==void 0&&t.set(`skillPath`,e.skillPath),e.runner&&t.set(`runner`,e.runner),e.account!==void 0&&t.set(`account`,e.account),e.ref&&t.set(`ref`,e.ref);let n=t.toString();return n?`/new?${n}`:`/new`}var H_=`cez-last-location`;function U_(){try{let e=localStorage.getItem(H_);return e===null?null:JSON.parse(e)}catch{return null}}function W_(e){try{localStorage.setItem(H_,JSON.stringify(e))}catch{}}var G_=new Set([`projectId`,`pathname`,`search`,`hash`]);function K_(e){return typeof e!=`string`||e.length<1||e.length>64?null:e}function q_(e){return typeof e!=`string`||e.length<1||e.length>2048||!e.startsWith(`/p/`)?null:e}function J_(e){return e!==void 0&&(typeof e!=`string`||e.length>4096||!e.startsWith(`?`))?null:e}function Y_(e){return e!==void 0&&(typeof e!=`string`||e.length>2048||!e.startsWith(`#`))?null:e}function X_(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(Object.keys(t).some(e=>!G_.has(e)))return null;let n=K_(t.projectId);if(n===null)return null;let r=q_(t.pathname);if(r===null)return null;let i=J_(t.search);if(i===null)return null;let a=Y_(t.hash);if(a===null)return null;try{if(_s(r)!==n)return null}catch{return null}return{projectId:n,pathname:r,...i===void 0?{}:{search:i},...a===void 0?{}:{hash:a}}}function Z_(e,t){let n=t.projects.find(t=>t.id===e);return n!==void 0&&n.status!==`missing`}function Q_(e,t){if(t===void 0)return null;let n;try{n=_s(e.pathname)}catch{return null}return n===null||!Z_(n,t)?null:X_({projectId:n,pathname:e.pathname,...e.search===``?{}:{search:e.search},...e.hash===``?{}:{hash:e.hash}})}function $_(e,t,n){let r=X_(e);return r===null||!(t===void 0?n!==void 0&&r.projectId===n:Z_(r.projectId,t))?null:`${r.pathname}${r.search??``}${r.hash??``}`}function ev(e,t){let n=X_(e);return n!==null&&n.projectId===t.projectId&&n.pathname===t.pathname&&(n.search??``)===(t.search??``)&&(n.hash??``)===(t.hash??``)}var tv=`cez-project-locations`;function nv(){try{let e=localStorage.getItem(tv),t=e===null?null:JSON.parse(e);return typeof t==`object`&&t&&!Array.isArray(t)?t:{}}catch{return{}}}function rv(e){let t=nv()[e];return t===void 0?null:t}function iv(e){try{localStorage.setItem(tv,JSON.stringify({...nv(),[e.projectId]:e}))}catch{}}function av(e,t,n){let r=X_(t);return r===null||r.projectId!==e||n===void 0||!Z_(e,n)?null:`${r.pathname}${r.search??``}${r.hash??``}`}var ov=2500,sv=e=>String(hs(e,`/`));function cv(e,t,n){let r={href:sv(e),verify:!1},i=av(e,t,n.registry);if(i===null)return r;try{let e=i.replace(/[?#].*$/,``),t=n.matchRoute(e);return t===null?r:{href:i,verify:Object.keys(t.params).some(e=>e!==`projectId`)}}catch{return r}}var lv=e=>yt(xn(e.params.id??``,{projectId:e.opts.projectId}),{signal:e.opts.signal});function uv(e){let t=Number(e);return Number.isSafeInteger(t)&&t>=1?t:null}async function dv(e,t,n){let r=await re(e,t,{},n.opts);return r.available?r.item!==null:null}var fv=async e=>(await lv(e),!0),pv=async e=>(await lv(e),await ut(e.params.id??``,e.params.sha??``,e.opts),!0);async function mv(e,t){let n=await lv(e),r=uv(e.params.n);return r===null?!1:bi(n,e.repoBase).some(e=>e.kind===t&&e.number===r)?dv(t,r,e):e.repoBase===void 0&&null}var hv=async e=>(await kt(e.params.sha??``,e.opts),!0);async function gv(e,t){let n=uv(e.params.n);return n!==null&&dv(t,n,e)}var _v=[{matches:e=>e===`/tasks/:id/commits/:sha`,check:pv},{matches:e=>e===`/tasks/:id/issue/:n`,check:e=>mv(e,`issue`)},{matches:e=>e===`/tasks/:id/pr/:n`,check:e=>mv(e,`pr`)},{matches:e=>e.startsWith(`/tasks/:id`),check:fv},{matches:e=>e===`/git/commits/:sha`,check:hv},{matches:e=>e===`/github/issues/:n`,check:e=>gv(e,`issue`)},{matches:e=>e.startsWith(`/github/prs/:n`),check:e=>gv(e,`pr`)},{matches:e=>e===`/workflows/:name`,check:async e=>{let{workflows:t,issues:n}=await ke(e.opts);return t.some(t=>t.name===e.params.name)?!0:n.length>0&&null}},{matches:e=>e.startsWith(`/automations/:automationId`),check:async e=>{let t=await pe(e.opts);return t.available?t.automations.some(t=>t.id===e.params.automationId):null}}];async function vv(e,t,n,r,i){let a=``;try{let o=i(t);if(o===null)return!1;a=o.pattern;let s=_v.find(e=>e.matches(o.pattern));return s===void 0?null:await s.check({projectId:e,pattern:a,params:o.params,repoBase:r,opts:{projectId:e,signal:n}})}catch(e){return!bv(e,a)&&null}}var yv=/unknown revision|bad object|bad revision|unknown commit|not a commit hash|needed a single revision/i;function bv(e,t){return e instanceof et?e.status===404||(t===`/git/commits/:sha`||t===`/tasks/:id/commits/:sha`)&&e.status===409&&yv.test(e.message):!1}async function xv(e,t,n){let r=cv(e,t,n);if(!r.verify)return r.href;let i=new AbortController,a=setTimeout(()=>i.abort(),ov);try{return await vv(e,r.href.replace(/[?#].*$/,``),i.signal,n.repoBaseOf?.(e),n.matchRoute)===!1?sv(e):r.href}finally{clearTimeout(a)}}var Sv={key:``,navigate:null,ticket:0};function Cv(e,t){e!==Sv.key&&Sv.ticket++,Sv.key=e,Sv.navigate=t}function wv(){Sv.ticket++}async function Tv(e,t,n){let r=++Sv.ticket,i=Sv.key,a=await xv(e,t,n);r===Sv.ticket&&i===Sv.key&&Sv.navigate?.(a)}function Ev(){let e=j(),t=a();Z.useLayoutEffect(()=>{Cv(`${t.key}|${t.pathname}${t.search}${t.hash}`,e)},[e,t.key,t.pathname,t.search,t.hash])}function Dv(){let e=Z.useContext(Gl);if(e===null)throw Error(`useProjectSwitch needs a ProjectRouteMatcherContext provider (App provides matchProjectRoute)`);let t=bn().data,n=En().data,r=Z.useCallback(e=>t?.projects.find(t=>t.id===e)?.repoUrl??(e===(n?.bootProject??t?.bootProject)?Cr(n?.repo?.remote):void 0),[t,n]);Ev();let{pathname:i,search:o,hash:s}=a(),c=_s(i),l=`${i}${o}${s}`;return{target:Z.useCallback(n=>n===c?{href:l,verify:!1}:cv(n,rv(n),{registry:t,matchRoute:e}),[t,e,c,l]),go:Z.useCallback(async n=>{if(n===c)return wv();await Tv(n,rv(n),{registry:t,repoBaseOf:r,matchRoute:e})},[t,r,e,c])}}function Ov(e){return e?.capabilities?.automations===!0}function kv(){let e=En().data,t=(0,Z.useRef)(void 0);(0,Z.useEffect)(()=>{e&&(t.current=e)},[e]);let n=e??t.current;return n?Ov(n)?`available`:`unavailable`:`unknown`}function Av(){return kv()===`available`}function jv(e){return e<=200}function Mv(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 Nv(e,t){let n=Mv(t);if(n.length===0)return[...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)),[...a,...i]}function Pv(e,t,n){return t===n||t<0||n<0||t>=e.length||n>=e.length?[...e]:pc([...e],t,n)}function Fv(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Iv(){let e=I(),t=Dn(),n=Z.useRef(0),r=Z.useRef(Promise.resolve()),i=Z.useMemo(()=>Mv(t.data?.sidebar?.projectOrder),[t.data?.sidebar?.projectOrder]),a=Z.useCallback(t=>{let i=e.getQueryData(V.uiState);if(i===void 0)return;let{projectOrder:a,...o}=Fv(i.sidebar),s=t===null?o:{...o,projectOrder:t};e.setQueryData(V.uiState,{...i,sidebar:s});let c=++n.current,l=r.current.then(async()=>{let t=await Je({sidebar:s},{keepalive:!0});c===n.current&&e.setQueryData(V.uiState,t)});r.current=l.catch(t=>{G(t instanceof Error?t.message:String(t),{tone:`danger`}),c===n.current&&e.invalidateQueries({queryKey:V.uiState})})},[e]),o=Z.useCallback(e=>{let t=Mv(e);t.length===0||!jv(e.length)||a(t)},[a]),s=Z.useCallback(()=>a(null),[a]);return{order:i,canReorder:t.data!==void 0,setOrder:o,reset:s}}function Lv(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function Rv(e,t,n){let r=t.trim().toLowerCase();if(r===``)return 1;let i=(n?.length?`${e} ${n.join(` `)}`:e).toLowerCase(),a=r.split(/\s+/),o=0;for(let e of a){let t=i.indexOf(e);if(t===-1)return 0;let n=t===0||!/[a-z0-9]/.test(i[t-1]??``);o+=(n?1:.5)/(1+t/48)}return o/a.length}function zv(e,t){if(t.trim()===``)return e;let n=e=>e.rows.reduce((e,n)=>Math.max(e,Rv(n.value,t,n.keywords)),0);return e.map(e=>({group:e,score:n(e)})).sort((e,t)=>t.score-e.score).map(({group:e})=>e)}function Bv(e,t){return{value:`task ${xi(e)} ${e.id}`,keywords:[...t?[t]:[],...qv(e),...[e.branch,e.workflow,e.workflowLabel,e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl].filter(e=>!!e)]}}var Vv=e=>({value:`view ${e}`}),Hv=e=>({value:`project ${e.name} ${e.id}`,keywords:[e.root]}),Uv=e=>({value:`skill ${e.id} ${e.name} ${e.path??``}`,...g({keywords:e.description?[e.description]:void 0})}),Wv={value:`action toggle theme`},Gv=150;function Kv(e,t,n,r=[]){let i=Lv(e.filter(e=>!zr(e))).map(e=>({...e,projectId:t})),a=new Set(i.map(Jv)),o=[...n??[],...r].filter(e=>zr(e)||a.has(Jv(e))?!1:(a.add(Jv(e)),!0)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return[...i,...o]}function qv(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?/\/(\d+)\/?$/.exec(n):null;e&&t.add(Number(e[1]))}for(let n of[e.prNumber,e.issueNumber,e.markerRefs?.pr,e.markerRefs?.issue])typeof n==`number`&&Number.isInteger(n)&&n>0&&t.add(n);return[...t].flatMap(e=>[String(e),`#${e}`])}var Jv=e=>`${e.projectId??``}/${e.id}`;function Yv(e){let t=e.filter(e=>Zr(e)).sort((e,t)=>(t.finishedAt??``).localeCompare(e.finishedAt??``)),n=new Set(t.map(Jv));return{recentlyFinished:t,otherTasks:e.filter(e=>!n.has(Jv(e)))}}function Xv(e,t,n=[]){let r=Nv(e,n);return[...r.filter(e=>e.id!==t),...r.filter(e=>e.id===t)]}function Zv(){let[e,t]=Z.useState(!1),n=gs();Gg(`k`,()=>t(e=>!e));let r=Z.useCallback(()=>{t(!1),n(`/new`)},[n]);return Gg(`n`,r),Jg(`c`,r),Z.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(Qu,e),()=>window.removeEventListener(Qu,e)},[]),(0,Q.jsx)(ws,{open:e,onOpenChange:t,title:`Command palette`,description:`Search projects, tasks, views, actions, and skills`,showCloseButton:!1,filter:Rv,className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,Q.jsx)(ay,{close:()=>t(!1)})})}function Qv({heading:e,tasks:t,projectName:n,showProject:r,now:i,onSelect:a}){return(0,Q.jsx)(As,{heading:e,children:t.map(e=>(0,Q.jsx)($v,{task:e,projectName:n(e),showProject:r,now:i,onSelect:a},Jv(e)))})}function $v({task:e,projectName:t,showProject:n,now:r,onSelect:i}){let a=Ce(e),o=xi(e);return(0,Q.jsxs)(Ns,{...Bv(e,t),"data-slot":`palette-task`,"data-run-id":e.id,"data-project-id":e.projectId??void 0,onSelect:()=>i(e),children:[(0,Q.jsx)($,{tone:a.tone,shape:a.shape,pulse:a.pulse,"aria-label":a.label,role:`img`}),e.delegation?.role===`worker`?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:o}),n&&t?(0,Q.jsx)(`span`,{"data-slot":`palette-task-project`,className:`shrink-0 truncate text-xs text-soft-foreground`,children:t}):null,(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:Ga(e.finishedAt??e.createdAt,r)})]})}function ey({multiProject:e,health:t}){return[...e?[{label:`All tasks`,to:`/tasks`,icon:Da,global:!0}]:[],...s_({forge:t.data?.forge?.available===!0,automations:Ov(t.data)}).map(e=>({label:e.label,to:e.to,icon:e.icon,global:!1}))]}function ty({views:e,go:t,goGlobal:n,orderedProjects:r,activeProjectId:i,goProject:a,otherTasks:o,searching:s,taskProjectName:c,showProjectOnTasks:l,now:u,selectTask:d,orderedSkills:f,skillRunner:p,theme:m,nextTheme:h,setTheme:g,close:_}){let v=[{rows:e.map(e=>Vv(e.label)),node:(0,Q.jsx)(As,{heading:`Views`,children:e.map(e=>{let r=e.icon;return(0,Q.jsxs)(Ns,{...Vv(e.label),"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>e.global?n(e.to):t(e.to),children:[(0,Q.jsx)(r,{"aria-hidden":`true`}),e.label]},e.to)})},`views`)}];return r.length>0&&v.push({rows:r.map(Hv),node:(0,Q.jsx)(As,{heading:`Projects`,children:r.map(e=>{let t=e.id===i,n=e.status===`missing`;return(0,Q.jsxs)(Ns,{...Hv(e),"data-slot":`palette-project`,"data-project-id":e.id,disabled:n,onSelect:()=>a(e.id),children:[(0,Q.jsx)(Fi,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),n?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-soft-foreground`,children:e.branch}),t?(0,Q.jsx)(Qi,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.id)})},`projects`)}),o.length>0&&v.push({rows:s?o.map(e=>Bv(e,c(e))):[],node:(0,Q.jsx)(Qv,{heading:`Tasks`,tasks:o,projectName:c,showProject:l,now:u,onSelect:d},`tasks`)}),v.push({rows:[Wv],node:(0,Q.jsx)(As,{heading:`Actions`,children:(0,Q.jsxs)(Ns,{...Wv,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{g(h),_()},children:[(0,Q.jsx)(va,{"aria-hidden":`true`}),`Toggle theme`,(0,Q.jsxs)(ks,{className:`tracking-normal`,children:[m,` → `,h]})]})},`actions`)}),f.length>0&&v.push({rows:f.map(Uv),node:(0,Q.jsx)(As,{heading:`Skills`,children:f.map(e=>(0,Q.jsxs)(Ns,{...Uv(e),"data-slot":`palette-skill`,"data-skill":e.id,onSelect:()=>t(V_({skill:e.id,skillPath:e.path,runner:p})),children:[(0,Q.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.path?(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},JSON.stringify([e.id,e.path])))},`skills`)}),v}function ny({search:e,setSearch:t}){return(0,Q.jsx)(js,{placeholder:`Search projects, tasks, views, actions, skills…`,value:e,onValueChange:t})}function ry({search:e,searching:t,recentlyFinished:n,groups:r,taskProjectName:i,showProjectOnTasks:a,now:o,selectTask:s,go:c}){return(0,Q.jsxs)(Os,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:[(0,Q.jsx)(Ws,{children:`Nothing matches.`}),(0,Q.jsx)(As,{children:(0,Q.jsxs)(Ns,{value:`new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>c(`/new`),children:[(0,Q.jsx)(zi,{"aria-hidden":`true`}),`New task`,(0,Q.jsx)(ks,{children:`C`})]})}),!t&&n.length>0?(0,Q.jsx)(Qv,{heading:`Recently finished`,tasks:n,projectName:i,showProject:a,now:o,onSelect:s}):null,zv(r,e).map(e=>e.node)]})}function iy({cappedProjects:e}){return e.length===0?null:(0,Q.jsxs)(`p`,{"data-slot":`palette-search-truncated`,role:`status`,className:`border-t border-border px-3 py-2 text-[11px] text-soft-foreground`,children:[`More matches in `,e.join(`, `),`. Type more to narrow them.`]})}function ay({close:e}){let t=gs(),n=j(),[r,i]=Z.useState(``),a=r.trim()!==``,o=Ss(),{theme:s,setTheme:c}=xg(),l=xr(),u=hn(),d=bn(),f=mn(),p=En(),m=Date.now(),h=d.data,g=h!==void 0&&h.projects.length>1,_=Jn(g),{order:v}=Iv(),y=Z.useMemo(()=>g?Xv(h.projects,o,v):[],[g,h,o,v]),b=Z.useMemo(()=>new Map((h?.projects??[]).map(e=>[e.id,e.name])),[h]),x=o??h?.bootProject??null,[S,C]=Z.useState(``);Z.useEffect(()=>{let e=setTimeout(()=>C(r),Gv);return()=>clearTimeout(e)},[r]);let w=br(S),T=a?w.data?.runs:void 0,E=a&&!w.isPlaceholderData?(w.data?.truncated??[]).map(e=>b.get(e)??e):[],D=Z.useMemo(()=>Kv(l.data??[],x,_.data?.runs,T),[l.data,x,_.data,T]),O=Z.useMemo(()=>Yv(D),[D]),k=a?[]:O.recentlyFinished,A=a?D:O.otherTasks,M=g,ee=e=>e.projectId===null?null:b.get(e.projectId)??null,te=f.data?.skillUsage,ne=Z.useMemo(()=>Tc(u.data??[],te),[u.data,te]),re=n=>{e(),t(n)},ie=t=>{e(),n(t)},N=Dv(),P=t=>{e(),N.go(t)},F=n=>{e(),t(n.projectId===null?`/tasks/${n.id}`:hs(n.projectId,`/tasks/${n.id}`))},ae=Sg[s],oe=ty({views:ey({multiProject:g,health:p}),go:re,goGlobal:ie,orderedProjects:y,activeProjectId:o,goProject:P,otherTasks:A,searching:a,taskProjectName:ee,showProjectOnTasks:M,now:m,selectTask:F,orderedSkills:ne,skillRunner:u.runner,theme:s,nextTheme:ae,setTheme:c,close:e});return(u.isError||u.list?.source===`unavailable`)&&a&&oe.push({rows:[{value:r.trim()}],node:(0,Q.jsx)(As,{heading:`Skills`,children:(0,Q.jsxs)(Ns,{value:r.trim(),onSelect:()=>re(V_({skill:r.trim(),runner:u.runner})),children:[`Use skill id “`,r.trim(),`” (unchecked)`]})},`unchecked-skill`)}),(0,Q.jsxs)(Q.Fragment,{children:[ny({search:r,setSearch:i}),ry({search:r,searching:a,recentlyFinished:k,groups:oe,taskProjectName:ee,showProjectOnTasks:M,now:m,selectTask:F,go:re}),iy({cappedProjects:E})]})}var oy=Z.createContext(null);function sy({children:e}){let[t,n]=Z.useState(`active`),r=Av(),i=r?t:`active`,a=Z.useMemo(()=>[i,n,r],[i,r]);return(0,Q.jsx)(oy.Provider,{value:a,children:e})}function cy(){let e=Z.useContext(oy);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}function ly(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return{};let n=e,r={};for(let{id:e}of t?.runners??[]){let t=n[e];typeof t==`string`&&t.length>0&&t.length<=128&&(r[e]=t)}return r}function uy(e,t,n){if(!e||!n)return[];let r=new Map(e.providers.map(e=>[e.provider,e]));return n.runners.flatMap(({id:e,displayName:n})=>{let i=r.get(e);return i?.status!==`disconnected`||!i.authFailureId||t[e]===i.authFailureId?[]:[{provider:e,label:n,authFailureId:i.authFailureId}]})}function dy(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function fy({status:e,runners:t,pending:n,error:r,dismissals:i,onDismissAuthFailures:a}){if(n||!e)return null;let o;try{o=Wt(e)}catch{return null}let s=uy(o,i,t);if(s.length>0)return(0,Q.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,Q.jsx)($,{tone:`danger`}),(0,Q.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,s.map(({label:e})=>e).join(`, `),`.`]}),(0,Q.jsx)(Y,{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,Q.jsx)(`button`,{type:`button`,"aria-label":`Dismiss provider authentication alert`,onClick:()=>a(s),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,Q.jsx)(Xu,{className:`size-4`,"aria-hidden":`true`})})]});if(r||o.providers.some(e=>e.enabled&&e.status===`connected`))return null;let c=o.providers.some(e=>e.status===`connected`),l=o.providers.some(e=>e.status===`unknown`);return(0,Q.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,Q.jsx)($,{tone:l?`danger`:`pending`}),(0,Q.jsx)(`span`,{children:c?`No agent provider is enabled.`:l?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,Q.jsx)(Y,{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 py(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function my(){let e=Wn(),t=Oi().data,n=Dn(),r=I(),i=(0,Z.useRef)(Promise.resolve()),a=(0,Z.useRef)(0),o=(0,Z.useRef)(0),s=(0,Z.useRef)(py(n.data));(0,Z.useEffect)(()=>{o.current===0&&(s.current=py(n.data))},[n.data]);let c=(0,Z.useCallback)(e=>{let n=V.uiState,c=py(r.getQueryData(n)),l=dy(ly(c?.dismissedProviderAuthFailures,t),e),u={...c,dismissedProviderAuthFailures:l};o.current+=1,r.setQueryData(n,u);let d=++a.current;i.current=i.current.then(async()=>{try{let e=await Je({dismissedProviderAuthFailures:l});s.current=py(e),d===a.current&&r.setQueryData(n,e)}catch(e){d===a.current&&(s.current===void 0?r.removeQueries({queryKey:n,exact:!0}):r.setQueryData(n,s.current),r.invalidateQueries({queryKey:n}),G(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--o.current}})},[r,t]);return(0,Q.jsx)(fy,{status:e.data,runners:t,pending:e.isPending,error:e.isError,dismissals:ly(py(n.data)?.dismissedProviderAuthFailures,t),onDismissAuthFailures:c})}function hy(e={displayName:`Squawk`,command:`hsq`,npx:`npx -p @hearsay-tools/squawk hsq`}){return e.command}function gy(e){return e.reason===`legacy-change`?e.canImport?`${e.file} changed in the old home. Import keeps live-only changes. Old-home changes win when both homes changed the same key or entry.`:`${e.file} changed in the old home. Import is unavailable. Ignore keeps the live file and skips these old-home changes.`:e.reason===`outside-write`?`${e.file} changed outside Squawk. Restore the previous version or accept the file as found.`:e.file===`config.json`?`The project registry was reset. Restore the previous projects?`:`The account list was reset. Restore the previous accounts?`}function _y({file:e,editable:t}){let n=Bl(),r=Vl(),i=Hl(),a=e.reason===`legacy-change`,o=n.isPending||r.isPending||i.isPending,s=n.error??r.error??i.error,c=t=>{n.reset(),r.reset(),i.reset();let a={file:e.file,detectedAt:e.detectedAt};t===`restore`?n.mutate(a):t===`accept`?r.mutate(a):i.mutate(a)};return(0,Q.jsxs)(`div`,{"data-slot":`home-recovery`,"data-home-file":e.file,role:`status`,"aria-live":`polite`,"aria-busy":o,className:`flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-border bg-muted/50 p-3 text-sm text-foreground`,children:[(0,Q.jsx)(`span`,{className:`flex-[1_1_24rem] [min-inline-size:0] [overflow-wrap:break-word]`,children:gy(e)}),t?(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a?e.canImport&&(0,Q.jsx)(k,{type:`button`,"data-action":`import`,disabled:o,onClick:()=>c(`import`),children:`Import changes from the old home`}):(0,Q.jsx)(k,{type:`button`,"data-action":`restore`,disabled:o||!e.canRestore,onClick:()=>c(`restore`),children:`Restore`}),(0,Q.jsx)(k,{type:`button`,variant:`outline`,"data-action":`accept`,disabled:o,onClick:()=>c(`accept`),children:a?`Ignore`:`Accept as found`})]}):t===!1&&(0,Q.jsxs)(`p`,{className:`basis-full`,children:[a?e.canImport?`Only the host operator can import or ignore this file.`:`Only the host operator can ignore this file.`:`Only the host operator can restore or accept this file.`,e.file.startsWith(`remote-settings/`)&&(a?(0,Q.jsxs)(Q.Fragment,{children:[` `,e.canImport&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`code`,{children:[hy(),` backup import `,e.file]}),` or `]}),(0,Q.jsxs)(`code`,{children:[hy(),` backup ignore `,e.file]})]}):(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{children:[hy(),` backup restore `,e.file]})]}))]}),t&&s&&(0,Q.jsx)(`p`,{role:`alert`,className:`basis-full text-danger`,children:s.message})]})}function vy(){let e=Il(),t=En().data?.capabilities?.localHandoff;return(0,Q.jsx)(`div`,{"data-slot":`home-recovery-state`,"data-state":e.isSuccess?`ready`:e.isError?`error`:`pending`,children:e.data?.files.map(e=>(0,Q.jsx)(_y,{file:e,editable:!e.file.startsWith(`remote-settings/`)&&t},e.file))})}var yy=`cez-project-rail-expanded`;function by(e,t){return e-232-t>=640}function xy(){try{return localStorage.getItem(yy)===`1`}catch{return!1}}function Sy(e){try{localStorage.setItem(yy,e?`1`:`0`)}catch{}}function Cy(e){if(e!==void 0)return e.isDragging?`relative z-10 opacity-40 [-webkit-touch-callout:none]`:`[-webkit-touch-callout:none]`}function wy({project:e,signal:t,known:n,current:r,target:i,onSwitchProject:a,onSelectProject:o,sort:s}){let c=Bh(e.name,t,{unknown:!n});return(0,Q.jsxs)(`div`,{ref:s?.setNodeRef,style:s?.style,...s?.listeners,"data-slot":`rail-project`,"data-project-id":e.id,"data-dragging":s?.isDragging?``:void 0,className:C(`relative flex h-[52px] w-full shrink-0 items-center justify-center`,Cy(s)),children:[r?(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`rail-current-bar`,className:`absolute top-1/2 left-0 h-5 w-[3px] -translate-y-1/2 rounded-r-[2px] bg-foreground`}):null,(0,Q.jsxs)(`div`,{className:`relative size-9`,children:[(0,Q.jsx)(E,{ref:s?.setActivatorNodeRef,"aria-describedby":s?.attributes[`aria-describedby`],to:i.href,onClick:t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(o?.(e.id),i.verify&&a&&(t.preventDefault(),a(e.id)))},"aria-label":c,title:c,"aria-current":r?`page`:void 0,className:C(`flex size-full items-center justify-center rounded-[9px] border text-[12px] leading-none font-semibold focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r?`border-soft-foreground bg-sidebar-row-selected text-foreground`:`border-transparent bg-muted text-muted-foreground hover:text-foreground`),children:Uh(e.name)}),(0,Q.jsx)(og,{position:`top`,segments:sg(t).top}),(0,Q.jsx)(og,{position:`bottom`,segments:sg(t).bottom})]})]})}var Ty=`motion-safe:rail-text-in`;function Ey({project:e,signal:t,known:n,current:r,target:i,onSwitchProject:a,onSelectProject:o,sort:s}){let c=Bh(e.name,t,{unknown:!n}),{top:l,bottom:u}=sg(t),d=r?`border-sidebar-row-selected`:`border-background group-hover:border-sidebar-row-hover`;return(0,Q.jsxs)(`div`,{ref:s?.setNodeRef,style:s?.style,...s?.listeners,"data-slot":`rail-project`,"data-project-id":e.id,"data-dragging":s?.isDragging?``:void 0,className:C(`group/row relative w-full shrink-0`,Cy(s)),children:[(0,Q.jsxs)(E,{to:i.href,onClick:t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(o?.(e.id),i.verify&&a&&(t.preventDefault(),a(e.id)))},"aria-label":c,"aria-current":r?`page`:void 0,className:C(`group flex h-[52px] w-full items-center gap-[10px] rounded-[8px] px-[6px] pr-6 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r?`bg-sidebar-row-selected`:`hover:bg-sidebar-row-hover`),children:[(0,Q.jsxs)(`span`,{"aria-hidden":`true`,"data-slot":`rail-mark`,className:C(`relative flex size-9 shrink-0 items-center justify-center rounded-[9px] border text-[12px] leading-none font-semibold`,r?`border-soft-foreground bg-sidebar text-foreground`:`border-transparent bg-muted text-muted-foreground`),children:[Uh(e.name),(0,Q.jsx)(og,{position:`top`,segments:l,className:d}),(0,Q.jsx)(og,{position:`bottom`,segments:u,className:d})]}),(0,Q.jsxs)(`span`,{className:C(`flex min-w-0 flex-1 flex-col gap-px`,Ty),children:[(0,Q.jsx)(`span`,{"data-slot":`rail-project-name`,className:C(`truncate text-[13.5px] leading-[18px] font-semibold`,r?`text-foreground`:`text-muted-foreground`),children:e.name}),(0,Q.jsx)(tg,{signal:t,known:n,current:r,maxParts:2,slot:`rail-project-state`,className:`h-4 gap-x-[4px] overflow-hidden text-[11px] leading-4 whitespace-nowrap`})]})]}),s?(0,Q.jsx)(Dy,{name:e.name,sort:s}):null]})}function Dy({name:e,sort:t}){return(0,Q.jsx)(`button`,{type:`button`,ref:t.setActivatorNodeRef,"data-slot":`rail-project-grip`,...t.attributes,"aria-label":`Reorder ${e}, position ${t.position} of ${t.total}`,className:C(`absolute top-1/2 right-0.5 flex h-10 w-5 -translate-y-1/2 cursor-grab touch-none items-center justify-center rounded text-soft-foreground opacity-0 outline-none transition-opacity hover:text-foreground motion-reduce:transition-none`,`focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50`,`group-hover/row:opacity-100 group-focus-within/row:opacity-100 [@media(hover:none)]:opacity-100`),children:(0,Q.jsx)(Eu,{"aria-hidden":`true`,className:`size-3.5`})})}function Oy({expanded:e,position:t,total:n,sortable:r,...i}){let{attributes:a,listeners:o,setNodeRef:s,setActivatorNodeRef:c,transform:l,transition:u,isDragging:d}=dc({id:i.project.id,disabled:!r}),f=r?{setNodeRef:s,setActivatorNodeRef:c,style:{transform:yc.Translate.toString(l),transition:u},listeners:o,attributes:a,isDragging:d,position:t,total:n}:void 0;return e?(0,Q.jsx)(Ey,{...i,sort:f}):(0,Q.jsx)(wy,{...i,sort:f})}var ky=({transform:e})=>({...e,x:0}),Ay=class extends cc{static activators=[{eventName:`onPointerDown`,handler:({nativeEvent:e},t)=>e.pointerType!==`touch`&&cc.activators[0].handler({nativeEvent:e},t)}]},jy={delay:250,tolerance:5},My={start:[sc.Space],cancel:[sc.Esc],end:[sc.Space,sc.Enter,sc.Tab]},Ny={droppable:{strategy:vc.Always}},Py={draggable:`To reorder projects, press Space to pick this project up. Use the up and down arrow keys to move it, Space to drop it, or Escape to cancel.`};function Fy(e,t){let[n,r]=Z.useState(null),i=Z.useMemo(()=>{if(n===null||n.base!==e)return e;let t=new Map(e.map(e=>[e.id,e]));return n.ids.flatMap(e=>t.get(e)??[])},[n,e]),a=Z.useMemo(()=>i.map(e=>e.id),[i]),o=ac(uc(Ay,{activationConstraint:{distance:6}}),uc(lc,{activationConstraint:jy}),uc(fc,{coordinateGetter:gc,keyboardCodes:My})),s=Z.useRef(null),c=Z.useCallback(()=>{s.current?.();let e=e=>e.preventDefault();window.addEventListener(`click`,e,!0),s.current=()=>{window.removeEventListener(`click`,e,!0),s.current=null}},[]),l=Z.useCallback(()=>{let e=s.current;window.setTimeout(()=>e?.(),0)},[]);Z.useEffect(()=>()=>s.current?.(),[]);let u=Z.useCallback(n=>{l();let{active:i,over:o}=n;if(!t||o===null||o.id===i.id)return;let s=Pv(a,a.indexOf(String(i.id)),a.indexOf(String(o.id)));s.some((e,t)=>e!==a[t])&&(r({base:e,ids:s}),t(s))},[l,e,a,t]);return{projects:i,ids:a,sensors:o,announcements:Z.useMemo(()=>{let e=e=>{let t=a.indexOf(String(e));return{name:i[t]?.name??String(e),position:`position ${t+1} of ${a.length}`}};return{onDragStart:({active:t})=>`Picked up ${e(t.id).name}, ${e(t.id).position}.`,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}.`}},[a,i]),onDragStart:c,onDragEnd:u,onDragCancel:l}}function Iy(e){return C(`flex shrink-0 items-center rounded-[8px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,e?`size-auto h-9 w-full justify-start gap-3 px-2.5 text-[13px] font-normal`:`size-9 justify-center`)}var Ly=C(`truncate text-muted-foreground group-hover:text-foreground`,Ty);function Ry({to:e,label:t,slot:n,active:r,expanded:i,children:a}){return(0,Q.jsxs)(E,{to:e,"data-slot":n,"aria-label":t,title:i?void 0:t,"aria-current":r?`page`:void 0,className:C(`group`,Iy(i),r&&`bg-sidebar-row-selected text-foreground hover:bg-sidebar-row-selected`),children:[a,i?(0,Q.jsx)(`span`,{className:Ly,children:t}):null]})}function zy(e){let[t,n]=Z.useState(()=>window.innerWidth);return Z.useEffect(()=>{let e=()=>n(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),by(t,e)}function By(){let e=zy(Z.useContext(id));return(0,Q.jsx)(`div`,{"aria-hidden":`true`,"data-slot":`project-rail-placeholder`,style:{width:xy()&&e?232:60},className:`hidden shrink-0 border-r border-border bg-background md:block`})}var Vy=e=>({href:String(hs(e,`/`)),verify:!1});function Hy({expanded:e,resolvedTheme:t,version:n}){let r=n?`Squawk v${n}`:`Squawk`;return e?(0,Q.jsxs)(`div`,{"data-slot":`rail-identity`,className:`flex shrink-0 flex-col gap-0.5`,children:[(0,Q.jsxs)(`div`,{className:`flex h-[34px] items-center gap-[10px] px-0.5`,children:[(0,Q.jsx)(`img`,{src:`/cezarion-mark-${t}.svg`,alt:``,"aria-hidden":`true`,"data-slot":`rail-app-mark`,className:`size-[34px] shrink-0 rounded-[8px]`}),(0,Q.jsxs)(`span`,{className:C(`flex min-w-0 items-baseline gap-[10px] whitespace-nowrap`,Ty),"aria-label":r,children:[(0,Q.jsx)(`span`,{className:`text-[15px] leading-none font-bold text-foreground`,children:`Squawk`}),n?(0,Q.jsxs)(`span`,{"data-slot":`rail-version`,title:`v${n}`,className:`min-w-0 truncate text-[11px] leading-none text-soft-foreground`,children:[`v`,n]}):null]})]}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`h-px w-full bg-border`}),(0,Q.jsx)(`div`,{className:C(`px-1 pt-2.5 pb-1 text-[11px] font-medium text-soft-foreground`,Ty),children:`Projects`})]}):(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-0.5`,children:[(0,Q.jsx)(`img`,{src:`/cezarion-mark-${t}.svg`,alt:r,title:r,"data-slot":`rail-app-mark`,className:`size-[34px] rounded-[9px]`}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`mt-0.5 mb-1.5 h-px w-6 bg-border`})]})}function Uy({expanded:e}){return e?(0,Q.jsx)(Eh,{origin:`rail`,icon:zi,iconClassName:`size-[15px] text-soft-foreground`,iconFrameClassName:`flex size-9 shrink-0 items-center justify-center rounded-[9px] border border-border`,label:`Add project`,side:`right`,triggerClassName:C(`h-[44px] w-full shrink-0 justify-start gap-[10px] rounded-[8px] px-[6px] text-[13px] font-normal text-muted-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring motion-safe:[&>span:last-child]:rail-text-in`)}):(0,Q.jsx)(Eh,{origin:`rail`,icon:zi,iconClassName:`size-[15px]`,side:`right`,triggerClassName:`shrink-0 rounded-[9px] border border-border text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`})}function Wy({roomToExpand:e,expanded:t,toggle:n,railId:r,allProjectsActive:i,settingsActive:a}){return(0,Q.jsxs)(`div`,{"data-slot":`rail-bottom`,className:C(`flex shrink-0 flex-col gap-0.5 pt-2`,t?`items-stretch`:`items-center`),children:[e?(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`rail-expand-toggle`,"aria-expanded":t,"aria-controls":r,"aria-label":t?`Collapse projects`:`Expand projects`,title:t?void 0:`Expand projects`,onClick:n,className:C(`group`,Iy(t)),children:[t?(0,Q.jsx)(Iu,{className:`size-4 shrink-0`,"aria-hidden":`true`}):(0,Q.jsx)(Lu,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t?(0,Q.jsx)(`span`,{className:Ly,children:`Collapse`}):null]}):null,(0,Q.jsx)(Ry,{to:`/tasks`,label:`All projects`,slot:`rail-all-projects`,active:i,expanded:t,children:(0,Q.jsx)(Da,{className:`size-4 shrink-0`,"aria-hidden":`true`})}),(0,Q.jsx)(Ry,{to:`/settings/global/appearance`,label:`Global settings`,slot:`rail-global-settings`,active:a,expanded:t,children:(0,Q.jsx)(Zi,{className:`size-4 shrink-0`,"aria-hidden":`true`})}),(0,Q.jsx)(wg,{showLabel:t,labelClassName:Ly,className:C(`group`,Iy(t),`[&_svg]:size-4`)})]})}function Gy({projects:e,signals:t,version:n,projectTarget:r=Vy,onSwitchProject:i,onSelectProject:o,canReorder:s=!1,onReorder:c}){let{pathname:l}=a(),{resolvedTheme:u}=xg(),d=Z.useContext(id),[f,p]=Z.useState(xy),m=zy(d),h=f&&m,g=()=>{let e=!h;p(e),Sy(e)},_=_s(l),v=l===`/tasks`,y=l===`/settings/global`||l.startsWith(`/settings/global/`),b=Z.useId(),x=Fy(e,c),S=s&&c!==void 0&&e.length>1;return(0,Q.jsxs)(`nav`,{id:b,"aria-label":`Projects`,"data-slot":`project-rail`,"data-expanded":h?`true`:`false`,style:{width:h?232:60},className:C(`hidden shrink-0 flex-col overflow-hidden border-r border-border bg-background pt-3 pb-3.5 transition-[width] duration-[160ms] ease-out motion-reduce:transition-none md:flex`,h?`items-stretch px-2.5`:`items-center`),children:[(0,Q.jsx)(Hy,{expanded:h,resolvedTheme:u,version:n}),(0,Q.jsxs)(`div`,{"data-slot":`rail-projects`,className:C(`flex min-h-0 w-full flex-1 flex-col gap-0.5 overflow-y-auto overscroll-contain [scrollbar-width:none]`,h?`items-stretch`:`items-center`),children:[(0,Q.jsx)(mc,{sensors:x.sensors,collisionDetection:hc,measuring:Ny,modifiers:[ky],accessibility:{announcements:x.announcements,screenReaderInstructions:Py},onDragStart:x.onDragStart,onDragEnd:x.onDragEnd,onDragCancel:x.onDragCancel,children:(0,Q.jsx)(_c,{items:x.ids,strategy:oc,disabled:!S,children:x.projects.map((e,n)=>(0,Q.jsx)(Oy,{expanded:h,sortable:S,position:n+1,total:x.projects.length,project:e,signal:t?.get(e.id),known:t!==null,current:e.id===_,target:r(e.id),onSwitchProject:i,onSelectProject:o},e.id))})}),(0,Q.jsx)(Uy,{expanded:h})]}),(0,Q.jsx)(Wy,{roomToExpand:m,expanded:h,toggle:g,railId:b,allProjectsActive:v,settingsActive:y})]})}function Ky(){let e=I(),t=bn().data?.projects,{order:n,canReorder:r,setOrder:i}=Iv(),a=r&&t!==void 0&&jv(t.length),o=Z.useMemo(()=>t?Nv(t,n):void 0,[t,n]),s=Jn().data,c=Z.useMemo(()=>s?zh(s.runs):null,[s]),l=t?.map(e=>e.id).sort().join(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/html-BY76lXLH.js","assets/css-BsVw1vtW.js","assets/javascript-BgS3c2Ky.js","assets/core-DzoyrHjB.js","assets/lib-DrPFkMXk.js","assets/rolldown-runtime-QTnfLwEv.js","assets/preview-pane-connected-DHH1E04c.js","assets/react-runtime-CCIEwYL0.js","assets/button-C1fD-ZFr.js","assets/bundle-mjs-BT31bpU6.js","assets/project-scope-context-DMCS5p-N.js","assets/live-protocol-DKHlCFyG.js","assets/toaster-Cxgzn9ip.js","assets/createLucideIcon-BHp8sXmF.js","assets/arrow-right-Dh_Lx3um.js","assets/hourglass-B0lPAJvT.js","assets/info-DA1x_4bz.js","assets/format-BNCkW110.js","assets/play-CmVAj_fu.js","assets/thread-state-CJEzn845.js","assets/app-window-CSHwDX9N.js","assets/dropdown-menu-DRFDwG2X.js","assets/design-icons-B6-0w7Aw.js","assets/es2015-Ch36azR0.js","assets/project-router-LT30LjzY.js","assets/report-reader-TX7SV7cO.js","assets/queries-DHY6U3e_.js","assets/live-refetch-CZb2VOyu.js","assets/useInfiniteQuery-CvdGA_PU.js","assets/useQuery-BJFZunTR.js","assets/ws-BxsIvFCG.js","assets/file-preview-QFfT9j-q.js","assets/centered-state-CiiA8Vgw.js","assets/markdown-B6DqG9Ie.js","assets/chunk-BO2N2NFS-CM5F_Wdn.js","assets/task-thread-Bm755mTM.js","assets/use-desktop-EnHXg46f.js","assets/attention-zJ-ho5os.js","assets/runners-C-sPUQye.js","assets/run-header-CZANvy6Z.js","assets/message-square-B-MD-8rD.js","assets/reference-chip-BKeVxG_E.js","assets/dialog-DSwzMeY3.js","assets/dist-Du8mGhoH.js","assets/tab-link-C_0J92TF.js","assets/run-header-CC7VUTg9.css","assets/eye-B8okNWXU.js","assets/picker-pill-Dbb3GY1a.js","assets/zoomable-image-DrDnCL4V.js","assets/report-title-D4Mbu2Er.js","assets/task-thread-DtQ6uGfQ.css","assets/task-changes-Fj_aEo7v.js","assets/git-toolbar-Bd54EFZj.js","assets/diff-controls-C8aqhty4.js","assets/markdown-BBDDg-4t.js","assets/diff-BBZcIIOt.js","assets/image-preview-2AnVvt0e.js","assets/task-files-HfwuKxjl.js","assets/task-commits-B0Ezfa9a.js","assets/commit-diff-panel-BkPuLrzW.js","assets/task-github-item-B8bv9VSp.js","assets/use-hand-to-agent-state-CUbaxdrd.js","assets/prompt-template-menu-Dc2ufWt7.js","assets/skills-pM_PouEs.js","assets/use-hand-to-agent-state-C7esPJ-N.css","assets/repo-git-DyuGJJ8w.js","assets/nav-row-styles-CFjnD-9J.js","assets/repo-git-DVXNOJDT.css","assets/github-D1ZGYZ6k.js","assets/reports-DC4T6nCI.js","assets/reports-B7QAzibP.css","assets/workflows-DMaQulmN.js","assets/sortable.esm-zp_qkYGV.js","assets/workflows-C21NystW.css","assets/activity-route-CeDmVBg_.js","assets/activity-motion-DjV4Xoms.js","assets/activity-motion-0wHCeUs7.css","assets/global-activity-route-BVmBGVep.js","assets/skills-DAe4cSA-.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r,t as i}from"./react-runtime-CCIEwYL0.js";import{C as a,D as o,E as s,M as c,O as l,P as u,T as d,_ as f,a as p,b as m,c as h,d as g,f as _,g as v,h as y,i as b,j as x,k as S,l as C,m as w,n as T,p as E,r as D,s as O,t as k,v as A,w as j,x as M,y as ee}from"./button-C1fD-ZFr.js";import{n as te,r as ne}from"./live-refetch-CZb2VOyu.js";import{$ as re,$r as ie,An as N,Ar as P,Bn as F,C as ae,Cn as oe,Cr as se,Ct as ce,E as le,En as ue,Er as de,Fr as fe,G as pe,Gn as me,Hn as he,Hr as ge,Ht as _e,Ir as ve,It as ye,Jt as be,K as xe,Lr as Se,Mn as Ce,Mr as we,Mt as Te,Nn as Ee,Nt as De,O as Oe,Ot as ke,Pr as Ae,Rn as je,Rr as Me,Si as Ne,St as Pe,Tn as Fe,Tr as Ie,U as Le,Un as Re,Ur as ze,Ut as Be,V as Ve,Vn as He,Vt as Ue,W as We,Wn as Ge,Wt as Ke,Xn as qe,Xt as Je,Yn as Ye,Yt as Xe,_ as Ze,_i as Qe,_r as $e,a as et,ar as tt,b as nt,bi as rt,ci as it,d as at,ei as I,fi as ot,fn as st,gn as ct,gr as lt,gt as ut,hi as dt,in as ft,kn as pt,li as mt,lr as ht,m as gt,mi as _t,mn as vt,mt as yt,n as bt,ni as xt,nr as St,o as Ct,on as wt,or as Tt,p as Et,pi as Dt,pn as Ot,pt as kt,qn as At,qt as jt,r as Mt,s as Nt,si as Pt,sr as Ft,t as It,ti as Lt,tr as Rt,ui as zt,ur as Bt,vr as Vt,w as Ht,wn as Ut,wr as Wt,xi as Gt,xr as Kt,xt as qt,yn as Jt,yr as Yt,zn as Xt,zr as Zt}from"./project-scope-context-DMCS5p-N.js";import{A as Qt,H as $t,I as L,K as en,L as R,M as tn,N as nn,O as z,R as rn,U as an,V as B,j as on,q as sn,z as cn}from"./live-protocol-DKHlCFyG.js";import{t as ln}from"./useInfiniteQuery-CvdGA_PU.js";import{At as un,B as dn,Ct as fn,Dt as pn,Et as mn,Ft as hn,G as gn,Gt as _n,H as vn,Ht as yn,J as bn,Jt as xn,K as Sn,Kt as Cn,L as wn,Lt as Tn,M as En,Mt as Dn,N as On,O as kn,Ot as An,P as jn,Pt as V,Q as Mn,Rt as Nn,S as Pn,St as Fn,Tt as In,U as Ln,Ut as Rn,V as zn,W as Bn,Wt as Vn,X as Hn,Xt as Un,Y as Wn,Yt as H,Z as Gn,_ as Kn,a as qn,bt as Jn,d as Yn,dt as Xn,et as Zn,f as Qn,g as $n,h as er,i as tr,it as nr,jt as rr,kt as ir,m as ar,n as or,nt as sr,o as cr,ot as lr,p as ur,q as dr,qt as fr,r as pr,rt as mr,s as hr,t as U,tt as gr,ut as _r,v as vr,wt as yr,xt as br,yt as xr,z as Sr,zt as Cr}from"./queries-DHY6U3e_.js";import{t as wr}from"./useQuery-BJFZunTR.js";import{i as W}from"./bundle-mjs-BT31bpU6.js";import{i as Tr,r as Er,t as Dr}from"./cez-idle-D1rXzVuh.js";import{A as Or,B as kr,C as Ar,D as jr,F as Mr,G as Nr,H as Pr,I as Fr,K as Ir,L as Lr,M as Rr,N as zr,O as Br,P as Vr,Q as Hr,R as Ur,S as Wr,T as Gr,U as Kr,V as qr,W as Jr,X as Yr,Y as Xr,Z as Zr,a as Qr,c as $r,d as ei,g as ti,h as ni,i as ri,j as ii,k as ai,l as oi,m as si,n as ci,o as li,p as ui,q as di,r as fi,s as pi,t as mi,tt as hi,u as gi,v as _i,w as vi,x as yi,y as bi,z as xi}from"./use-desktop-EnHXg46f.js";import{t as Si}from"./ws-BxsIvFCG.js";import{n as G,t as Ci}from"./toaster-Cxgzn9ip.js";import{i as wi,n as Ti,o as Ei,r as Di,s as Oi,t as ki}from"./runners-C-sPUQye.js";import{$ as Ai,A as ji,B as Mi,C as Ni,D as Pi,E as Fi,F as Ii,G as Li,I as Ri,J as zi,K as Bi,L as Vi,O as Hi,Q as Ui,R as Wi,T as Gi,U as Ki,V as qi,W as Ji,X as Yi,Y as Xi,Z as Zi,c as Qi,ct as $i,d as ea,dt as ta,et as na,ft as ra,g as ia,h as aa,i as oa,it as sa,j as ca,k as la,l as ua,n as da,nt as fa,o as pa,ot as ma,p as ha,pt as ga,r as _a,rt as va,s as ya,t as ba,tt as xa,u as Sa,ut as Ca,v as wa,x as Ta,y as Ea,z as Da}from"./design-icons-B6-0w7Aw.js";import{t as K}from"./createLucideIcon-BHp8sXmF.js";import{_ as Oa,a as ka,c as Aa,d as ja,f as Ma,g as Na,h as Pa,i as Fa,m as Ia,o as La,p as Ra,r as za,s as Ba,u as Va,y as Ha}from"./nav-row-styles-CFjnD-9J.js";import{t as Ua}from"./eye-B8okNWXU.js";import{a as Wa,i as Ga,n as Ka,r as qa,t as Ja}from"./format-BNCkW110.js";import{t as Ya}from"./play-CmVAj_fu.js";import{a as Xa,i as Za,l as Qa,r as $a,s as eo,t as to,u as no}from"./reference-chip-BKeVxG_E.js";import{a as ro,c as io,d as ao,f as oo,h as q,i as so,l as co,m as lo,n as uo,o as fo,p as J,r as po,t as mo,u as ho}from"./es2015-Ch36azR0.js";import{C as go,S as _o,_ as vo,a as yo,b as bo,c as xo,d as So,f as Co,g as wo,h as To,i as Eo,l as Do,m as Oo,o as ko,p as Ao,r as jo,s as Mo,t as No,u as Po,v as Fo,w as Io,x as Lo,y as Ro}from"./dropdown-menu-DRFDwG2X.js";import{a as zo,c as Bo,i as Vo,l as Ho,n as Uo,o as Wo,r as Go,s as Ko,t as qo}from"./dist-Du8mGhoH.js";import{a as Jo,i as Yo,n as Xo,o as Zo,r as Qo,s as $o,t as es}from"./dialog-DSwzMeY3.js";import{a as ts,c as ns,d as rs,g as is,h as as,i as os,l as ss,o as cs,p as ls,r as us,s as ds,t as fs,u as ps,y as ms}from"./prompt-template-menu-Dc2ufWt7.js";import{a as hs,c as gs,i as _s,l as vs,n as ys,o as bs,r as xs,s as Ss,t as Y}from"./project-router-LT30LjzY.js";import{t as Cs}from"./attention-zJ-ho5os.js";import{A as ws,C as Ts,D as Es,E as Ds,F as Os,L as ks,M as As,N as js,O as Ms,P as Ns,S as Ps,T as Fs,_ as Is,a as Ls,b as Rs,c as zs,d as Bs,g as Vs,h as Hs,i as Us,j as Ws,k as Gs,l as Ks,m as qs,n as Js,o as Ys,p as Xs,r as Zs,s as Qs,t as $s,u as ec,v as tc,w as nc,x as rc,y as ic}from"./picker-pill-Dbb3GY1a.js";import{_ as ac,a as oc,c as sc,d as cc,f as lc,g as uc,i as dc,l as fc,n as pc,o as mc,p as hc,r as gc,t as _c,u as vc,v as yc}from"./sortable.esm-zp_qkYGV.js";import{c as bc,d as xc,f as Sc,i as Cc,n as wc,o as Tc,p as Ec,r as Dc,t as Oc,u as kc}from"./skills-pM_PouEs.js";import{t as X}from"./centered-state-CiiA8Vgw.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 Ac=class extends Ne{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 Un({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=jc(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=jc(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=jc(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=jc(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){sn.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=>ot(t,e))}findAll(e={}){return this.getAll().filter(t=>ot(e,t))}notify(e){sn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return sn.batch(()=>Promise.all(e.map(e=>e.continue().catch(_t))))}};function jc(e){return e.options.scope?.id}var Mc=class extends Ne{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??zt(r,t),a=this.get(i);return a||(a=new xt({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(){sn.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=>Dt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Dt(e,t)):t}notify(e){sn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){sn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){sn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Nc=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Mc,this.#t=e.mutationCache||new Ac,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Gt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Pt.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(Qe(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=it(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return sn.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;sn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return sn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=sn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(_t).catch(_t)}invalidateQueries(e,t={}){return sn.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=sn.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(_t)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(_t)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Qe(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_t).catch(_t)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_t).catch(_t)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Pt.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(mt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{dt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(mt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{dt(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||=zt(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===rt&&(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()}},Z=e(t(),1),Pc=n(),Fc=class extends EventTarget{readyState=0;release;constructor(e,t){super(),this.release=this.subscribe()}subscribe(){let e=()=>queueMicrotask(()=>{this.readyState===0&&(this.readyState=1,this.dispatchEvent(new Event(`open`)))});return Ae({kind:`workspace`},{ready:e,reset:()=>{this.readyState!==2&&(this.readyState=0,e())},frame:t=>{if(`data`in t&&t.event===`reconnect`){this.readyState=0,e();return}if(`data`in t&&t.event===`disconnect`){this.readyState===1&&(this.readyState=0,this.dispatchEvent(new Event(`error`)));return}`data`in t&&t.event===`ready`&&fe(),`data`in t&&this.dispatchEvent(new MessageEvent(t.event,{data:t.data}))}})}requestReady(){return this.readyState!==2&&we()}close(){this.readyState=2,this.release()}};R({runs:nn(`summary`).optional()});var Ic=B().min(1),Lc=L().int().positive(),Rc=R({project:Ic,seq:Lc,run:Ge,relationships:B().min(1)}),zc=R({project:Ic,seq:Lc,id:B().min(1)}),Bc=R({generation:B().min(1),seq:L().int().nonnegative()}),Vc=R({project:Ic,usage:cn(B(),He)});R({runs:Qt(Re),referenceStatuses:he,perProjectLimit:L(),truncated:Qt(B()),generation:B().min(1),eventSeq:L().int().nonnegative()});function Hc(e,t){if(e===`ping`)return{project:null,event:{type:`ping`}};let n;try{n=JSON.parse(t)}catch{return null}switch(e){case`run-summary`:{let e=Rc.safeParse(n);return e.success?{project:e.data.project,event:{type:`run-summary`,summary:e.data.run,seq:e.data.seq,relationships:e.data.relationships}}:null}case`run-deleted`:{let e=zc.safeParse(n);return e.success?{project:e.data.project,event:{type:`run-deleted`,id:e.data.id,seq:e.data.seq}}:null}case`usage`:{let e=Vc.safeParse(n);return e.success?{project:e.data.project,event:{type:`usage`,usage:e.data.usage}}:null}case`ready`:{let e=Bc.safeParse(n);return e.success?{project:null,event:{type:`ready`,generation:e.data.generation,seq:e.data.seq}}:null}default:return null}}function Uc(){let e;return{ready(t){let n=e!==void 0&&t>e;return e=t,n},frame(t){let n=e!==void 0&&t!==e+1;return e=t,n},reset(){e=void 0}}}function Wc(e,t){if(!e)return;let n=e.findIndex(e=>e.id===t.id);if(n>=0){let r=[...e];return r[n]=t,r}let r=e.findIndex(e=>(e.createdAt??``).localeCompare(t.createdAt)<0),i=[...e];return i.splice(r<0?e.length:r,0,t),i}function Gc(e,t){if(!e)return;let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}var Kc=Object.freeze({});function qc(){let e=Kc,t=new Set;return{subscribe(e){return t.add(e),()=>t.delete(e)},get:()=>e,set(n){e=n;for(let e of t)e()}}}function Jc(e,t){let n=e.getQueryData(t);if(n?.finishBlocked===void 0)return;let{finishBlocked:r,...i}=n;e.setQueryData(t,i)}function Yc(e){let t=new Map,n=t=>e.getQueryCache().find({queryKey:t,exact:!0}),r=t=>{if(!t.owed||t.timer!==void 0)return;let i=n(t.key);if(!i){t.owed=!1;return}if(!i.isActive()){t.owed=!1,e.invalidateQueries({queryKey:t.key,exact:!0,refetchType:`none`});return}if(i.state.fetchStatus!==`idle`)return;let a=t.lastStart+400-Date.now();if(a>0){t.timer=setTimeout(()=>{t.timer=void 0,r(t)},a);return}t.owed=!1,t.lastStart=Date.now(),e.refetchQueries({queryKey:t.key,exact:!0,type:`active`},{cancelRefetch:!1})},i=e.getQueryCache().subscribe(n=>{if(n.type!==`updated`||t.size===0)return;let i=t.get(JSON.stringify(n.query.queryKey));if(i){if(n.action.type===`success`&&!n.action.manual){let t=n.query.promise;t&&i.preEvent.has(t)&&(i.preEvent.delete(t),Jc(e,i.key),i.owed=!0)}n.query.state.fetchStatus===`idle`&&r(i)}});return{onEvent(i){let a=U.runs.detail(i),o=n(a);if(!o)return;let s=JSON.stringify(a),c=t.get(s);c||(c={key:a,owed:!1,lastStart:0,preEvent:new WeakSet},t.set(s,c)),o.state.fetchStatus!==`idle`&&o.promise&&c.preEvent.add(o.promise),Jc(e,a),c.owed=!0,r(c)},forget(e){let n=JSON.stringify(U.runs.detail(e));clearTimeout(t.get(n)?.timer),t.delete(n)},cancel(){i();for(let e of t.values())clearTimeout(e.timer);t.clear()}}}function Xc(e){let t=new Map;return{refresh(n){let r=U.runs.detail(n);if(!e.getQueryState(r))return;let i=JSON.stringify(r);clearTimeout(t.get(i)),e.cancelQueries({queryKey:r}),t.set(i,setTimeout(()=>{t.delete(i),e.invalidateQueries({queryKey:r})},400))},cancel(){for(let e of t.values())clearTimeout(e);t.clear()}}}var Q=i(),Zc=S(`/workspace/events?runs=summary`),Qc=2,$c=3e3,el=[`run-summary`,`run-deleted`,`usage`,`ping`,`ready`],tl=[`project-added`,`project-removed`,`checkout-progress`,`automation-change`,`project-ready`],nl=new Set;function rl(e){return nl.add(e),()=>{nl.delete(e)}}function il(e){return e[1]===`runs`&&e[2]===`list`}function al(e,t){return e.cancelQueries({queryKey:t}).then(()=>e.invalidateQueries({queryKey:t}))}function ol(e){return e.invalidateQueries({predicate:e=>il(e.queryKey),refetchType:`none`}),e.getQueryCache().findAll({predicate:e=>il(e.queryKey)&&(e.state.data!==void 0||e.state.fetchStatus!==`idle`)}).map(t=>al(e,t.queryKey))}var sl=1e3,cl=new WeakMap;function ll(e){let t=U.repoBranches,n=cl.get(e);if(n){n.set(JSON.stringify(t),t);return}cl.set(e,new Map([[JSON.stringify(t),t]])),setTimeout(()=>{let t=cl.get(e);cl.delete(e);for(let n of t?.values()??[])e.invalidateQueries({queryKey:n})},sl)}function ul(e,t,n=!1){if(t?.aborted)return Promise.resolve();let r=[U.runs.all,V.runsIndex,V.projects,U.health,U.worktrees,U.repoBranches,V.providerStatus],i=()=>{for(let t of r)e.cancelQueries({queryKey:t})};return t?.addEventListener(`abort`,i,{once:!0}),Tr(()=>{for(let t of e.getQueryCache().findAll({predicate:e=>il(e.queryKey)}))t.state.data===void 0&&t.state.fetchStatus!==`idle`&&e.cancelQueries({queryKey:t.queryKey,exact:!0});return[e.invalidateQueries({queryKey:U.runs.all,...n?{predicate:e=>[`list`,`detail`,`relationships`,`archived`].includes(String(e.queryKey[2]))}:{}}),e.invalidateQueries({predicate:e=>il(e.queryKey)}),yn(e).reconcile(),e.invalidateQueries({queryKey:V.projects}),al(e,U.health),e.invalidateQueries({queryKey:U.worktrees}),e.invalidateQueries({queryKey:U.repoBranches}),e.invalidateQueries({queryKey:V.providerStatus}),n?void 0:e.invalidateQueries({predicate:({queryKey:e})=>e.length===3&&e[1]===`github`&&(e[2]===null||typeof e[2]==`number`)})]}).finally(()=>t?.removeEventListener(`abort`,i))}function dl(e){return x()??fl(e)}function fl(e){let t=e.getQueryData(V.projects)?.bootProject;return typeof t==`string`&&t!==``?t:e.getQueryData(U.health)?.bootProject??e.getQueryData([`default`,`health`])?.bootProject}function pl(e,t){return[fr({projectId:e,boot:e===t}).cacheScope,`runs`,`list`]}function ml(e){let t=new Map,n=new Map,r=t=>{let r=n.get(JSON.stringify(t));if(!r)return;let i=e.getQueryCache().find({queryKey:t,exact:!0}),a=i?.promise;r.phase=`awaiting-fetch`,r.dirty=!1,e.invalidateQueries({queryKey:t,exact:!0}),i?.promise&&i.promise!==a&&(r.phase=`fetching`)},i=e.getQueryCache().subscribe(t=>{if(!n.size||t.type!==`updated`)return;let i=JSON.stringify(t.query.queryKey),a=n.get(i);if(a){if(t.action.type===`setState`){t.query.state.isInvalidated||e.invalidateQueries({queryKey:a.key,exact:!0,refetchType:`none`});return}if(t.action.type===`fetch`){a.phase===`awaiting-fetch`&&(a.phase=`fetching`),a.dirty=!1;return}if(t.action.type===`success`){if(!t.action.manual){a.phase===`fetching`&&!a.dirty?n.delete(i):r(a.key);return}a.phase!==`needs-start`&&(a.phase===`fetching`&&(a.dirty=!0),e.invalidateQueries({queryKey:a.key,exact:!0},{cancelRefetch:!1}))}}}),a=(t,r)=>{let i=JSON.stringify(t),a=e.getQueryCache().find({queryKey:t,exact:!0});if(!a)return;let o=n.get(i);!o&&(a.state.fetchStatus!==`idle`||a.state.isInvalidated)||o&&a.state.fetchStatus===`idle`?(n.set(i,{key:t,phase:`needs-start`,dirty:!1}),a.state.fetchStatus!==`idle`&&e.cancelQueries({queryKey:t,exact:!0}),r.some(e=>JSON.stringify(e)===i)||r.push(t)):o?.phase===`fetching`&&(o.dirty=!0)},o,s,c=(i=!1)=>{s!==void 0&&clearTimeout(s),s=void 0,o!==void 0&&cancelAnimationFrame(o),o=void 0;let c=[];for(let{key:r,baseList:i,baseQuery:o,baseUpdateCount:s,runs:l}of t.values()){let t=e.getQueryCache().find({queryKey:r,exact:!0});if(t!==o||t?.state.dataUpdateCount!==s||t?.state.data!==i){c.push(r),n.set(JSON.stringify(r),{key:r,phase:`needs-start`,dirty:!1}),e.cancelQueries({queryKey:r,exact:!0});continue}a(r,c),e.setQueryData(r,e=>{let t=e;for(let e of l.values())t=Wc(t,e);return t})}if(t.clear(),!i)for(let e of c)r(e);return c},l=t=>{let n=[pl(t,fl(e))],r=[t,`runs`,`list`];return(t===dl(e)||e.getQueryState(r))&&n.push(r),t===dl(e)&&n.push(U.runs.list()),[...new Map(n.map(e=>[JSON.stringify(e),e])).values()]};return{onEvent(i,u){let d=l(i);if(u.type===`run-summary`&&u.summary.archived&&d.every(t=>!e.getQueryData(t)?.find(e=>e.id===u.summary.id)?.archived)&&u.type===`run-summary`){for(let r of d){let i=JSON.stringify(r),a=n.get(i);a?.phase===`fetching`&&(a.dirty=!0);let o=t.get(i);if(!o){let n=e.getQueryCache().find({queryKey:r,exact:!0});o={key:r,baseList:n?.state.data,baseQuery:n,baseUpdateCount:n?.state.dataUpdateCount,runs:new Map},t.set(i,o)}o.runs.set(u.summary.id,u.summary)}s===void 0&&(s=setTimeout(()=>{c()},50),typeof requestAnimationFrame==`function`&&(o=requestAnimationFrame(()=>{c()})));return}let f=c(!0);for(let t of d)a(t,f),u.type===`run-summary`?e.setQueryData(t,e=>Wc(e,u.summary)):e.setQueryData(t,e=>Gc(e,u.id));for(let e of f)r(e)},flush:c,cancel(){i(),n.clear()}}}var hl=400;function gl(e){let t=new Map,n=new Map,r=(t,r)=>{if(r&&!e.getQueryState(t))return;let i=JSON.stringify(t);n.has(i)||n.set(i,setTimeout(()=>{n.delete(i),e.invalidateQueries({queryKey:t})},hl))};return{onSummary(e,n){let i=e.delegation?.role===`worker`?e.delegation.parentRunId:void 0,a=e.delegation?.role===`worker`?e.delegation.supervisorRunId:void 0,o=t.get(e.id);if(t.set(e.id,{shape:n,...i===void 0?{}:{parentRunId:i},...a===void 0?{}:{supervisorRunId:a}}),o?.shape!==n){r(U.runs.relationships(e.id),!0);for(let e of[i,a])e!==void 0&&r(U.runs.relationships(e),!0)}},onDeleted(n){let i=t.get(n);t.delete(n),e.removeQueries({queryKey:U.runs.relationships(n)}),i?.supervisorRunId!==void 0&&r(U.runs.relationships(i.supervisorRunId),!0),i?.parentRunId===void 0?r([...U.runs.all,`relationships`],!1):r(U.runs.relationships(i.parentRunId),!0)},cancel(){for(let e of n.values())clearTimeout(e);n.clear(),t.clear()}}}var _l={predicate:e=>e.queryKey[1]===`runs`&&e.queryKey[2]===`archived`};function vl(e,t){if(t.delegation?.role===`worker`)return;let n=!1;for(let r of e.getQueryCache().findAll(_l)){let i=r.state.data;i&&(i.pages.some(e=>e.runs.some(e=>e.id===t.id))?(e.setQueryData(r.queryKey,{...i,pages:i.pages.map(e=>({...e,runs:e.runs.map(e=>e.id===t.id?t:e)}))}),(!t.archived||r.queryKey[3]!==``)&&(n=!0)):t.archived&&(n=!0))}n&&e.invalidateQueries(_l)}function yl(e,t,n,r,i){switch(n.type){case`run-summary`:{let t=n.summary;if(vl(e,t),i.onSummary(t,n.relationships),r.fetcher.onEvent(t.id),t.delegation?.role===`worker`){let n=t.delegation.parentRunId;Jc(e,U.runs.detail(n)),r.refreshParent(n)}let a=U.runs.changes(t.id);e.getQueryData(a)!==void 0&&e.invalidateQueries({queryKey:a}),e.invalidateQueries({queryKey:U.worktrees}),ll(e);return}case`run-deleted`:i.onDeleted(n.id),r.fetcher.forget(n.id),e.removeQueries({queryKey:U.runs.detail(n.id)}),e.removeQueries({queryKey:U.runs.diff(n.id)}),e.setQueriesData(_l,e=>e&&e.pages.some(e=>e.runs.some(e=>e.id===n.id))?{...e,pages:e.pages.map(e=>({...e,runs:e.runs.filter(e=>e.id!==n.id)}))}:e),e.invalidateQueries(_l),e.invalidateQueries({queryKey:U.worktrees}),ll(e);return;case`usage`:t.set(n.usage);return;case`ping`:case`ready`:return}}function bl(e,t=Zc){let n=I();(0,Z.useEffect)(()=>{let r=Fc;if(typeof r!=`function`)return;let i=null,a=yn(n);a.setUnknownGenerationHandler(()=>{let e=i?.requestReady;return typeof e==`function`&&e.call(i)});let o=Xc(n),s=Yc(n),c={fetcher:s,refreshParent:o.refresh},l=Uc(),u=ml(n),d=gl(n),f=!1,p,m=!1,h=!1,g=!1,_=!1,v=()=>{g=!0,_=!1;let e=V.providerStatus;n.cancelQueries({queryKey:e,exact:!0}).then(()=>n.invalidateQueries({queryKey:e,exact:!0,refetchType:`active`})).finally(()=>{if(h||!_){g=!1;return}v()})},y=()=>{h||p!==void 0||(p=setTimeout(()=>{p=void 0,h||b()},$c))},b=()=>{i?.close(),i=new r(t,{withCredentials:!0}),i.addEventListener(`open`,()=>{f=!0,l.reset(),a.detach(),Er(!1),m&&(u.flush(),ul(n)),m||(Tr(()=>ol(n)),n.cancelQueries({queryKey:U.health}).then(()=>{h||n.invalidateQueries({queryKey:U.health})}),a.reconcile()),m=!0});for(let t of el)i.addEventListener(t,r=>{let i=Hc(t,r.data);if(!i)return;if(i.event.type===`ready`){let e=l.ready(i.event.seq);a.ready(i.event.generation,i.event.seq),e&&(u.flush(),ul(n));return}let o=(i.event.type===`run-summary`||i.event.type===`run-deleted`)&&l.frame(i.event.seq);i.event.type===`ping`&&f&&(f=!1,Tr(()=>ol(n)),Er(!0)),i.project!==null&&(i.event.type===`run-summary`||i.event.type===`run-deleted`?a.run(i.project,i.event,o):i.event.type===`usage`&&a.usage(i.project,i.event.usage)),i.project!==null&&(i.event.type===`run-summary`||i.event.type===`run-deleted`)&&u.onEvent(i.project,i.event),(i.project===null||i.project===dl(n))&&yl(n,e,i.event,c,d),o&&(u.flush(),ul(n))});for(let e of tl)i.addEventListener(e,t=>{let r;try{r=JSON.parse(t.data)}catch{return}if(e===`project-ready`?a.reconcile({hold:!0}):e!==`checkout-progress`&&e!==`automation-change`&&n.invalidateQueries({queryKey:V.projects}),e===`project-added`){let e=r?.project?.id;typeof e==`string`&&e!==``&&a.restoreProject(e),a.reconcile({hold:!0})}if(e===`project-removed`){let e=r?.id;typeof e==`string`&&e!==``&&a.dropProject(e)}for(let t of[...nl])t(e,r)});i.addEventListener(`health`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=Zt.safeParse(t);r.success&&(n.cancelQueries({queryKey:U.health}),n.setQueryData(U.health,r.data))}),i.addEventListener(`provider-status`,e=>{let t;try{t=JSON.parse(e.data)}catch{return}let r=se(t);if(!r)return;let i=V.providerStatus,a=Kt(n.getQueryData(i),r);if(a!==void 0){n.setQueryData(i,a);return}if(g){_=!0;return}v()}),i.addEventListener(`error`,()=>{Er(!1),a.detach(),i?.readyState===Qc&&y()})},x=()=>{document.visibilityState===`visible`&&(u.flush(),a.flush(),(!i||i.readyState===Qc)&&(clearTimeout(p),p=void 0,b()))},S=()=>{clearTimeout(p),p=void 0,u.flush()};document.addEventListener(`visibilitychange`,x),window.addEventListener(`pagehide`,S);let C=P((e,t)=>(u.flush(),ul(n,e,t)));return b(),()=>{C(),h=!0,Er(!1),clearTimeout(p),u.flush(),u.cancel(),a.stop(),o.cancel(),s.cancel(),a.setUnknownGenerationHandler(void 0),d.cancel(),document.removeEventListener(`visibilitychange`,x),window.removeEventListener(`pagehide`,S),i?.close(),i=null}},[n,e,t])}var xl=(0,Z.createContext)(null);function Sl({children:e}){let[t]=(0,Z.useState)(qc);return bl(t),On(),(0,Q.jsx)(xl.Provider,{value:t,children:e})}function Cl(e){let t=(0,Z.useContext)(xl),n=t?t.get:Tl;return(0,Z.useSyncExternalStore)(t?t.subscribe:wl,()=>e?n()[e]:void 0,()=>void 0)}var wl=()=>()=>void 0,Tl=()=>Kc,El=B().regex(/^(?:(?:config\.json(?:\.bak)?|agent-accounts\.json|ui-state\.json|server\.json|server\.install\.lock)|(?:remote-settings|server-instances)\/[a-zA-Z0-9-]+\.(?:json|install\.lock))$/),Dl=R({file:El,detectedAt:en(),canRestore:on()}),Ol=[`reset`,`outside-write`,`legacy-change`],kl=R({files:Qt(tn(`reason`,[Dl.extend({reason:nn(`reset`)}),Dl.extend({reason:nn(`outside-write`)}),Dl.extend({reason:nn(`legacy-change`),canImport:on()})]))});function Al(e,t){return!e||typeof e!=`object`||!(`files`in e)||!Array.isArray(e.files)?e:{...e,files:e.files.filter(e=>!(e&&typeof e==`object`&&`reason`in e&&typeof e.reason==`string`&&!t.includes(e.reason)))}}var jl=rn(e=>Al(e,Ol),kl);R({file:El,detectedAt:en()}).strict();async function Ml(e,t,n){n.throwIfAborted();let r=new Lt(e,{queryKey:t.queryKey,queryFn:t.queryFn,retry:!1,enabled:!1}).subscribe(()=>void 0);n.addEventListener(`abort`,r,{once:!0});try{return await e.fetchQuery({...t,retry:!1})}finally{n.removeEventListener(`abort`,r),r()}}var Nl=[`workspace`,`home-recovery`];function Pl(e){let t=jl.safeParse(e);if(!t.success)throw new et(200,`the Squawk server answered /home/recovery with an unexpected body`);return t.data}async function Fl(e){return Pl(await ct(await Et.api.v1.home.recovery.$get({},Te(e)),`/home/recovery`))}function Il(){return wr({queryKey:Nl,queryFn:({signal:e})=>Fl({signal:e}),enabled:Me(),staleTime:1/0,retry:!1})}function Ll(){let e=I();(0,Z.useEffect)(()=>{let t=!0,n=new AbortController,r,i=async t=>{ve()&&await Ml(e,{queryKey:Nl,queryFn:({signal:e})=>Fl({signal:e}),staleTime:0},t?AbortSignal.any([n.signal,t]):n.signal)},a=n=>{let r;try{r=Pl(n)}catch{i().catch(()=>{});return}e.cancelQueries({queryKey:Nl,exact:!0}).then(()=>{t&&ve()&&e.setQueryData(Nl,r)})},o=()=>{let t=e.getQueryData(U.health)?.capabilities?.localHandoff===!0;t&&ve()&&!r?r=Si(`home:recovery`,a):(!t||!ve())&&r&&(r(),r=void 0)};o();let s=e.getQueryCache().subscribe(o),c=Se(t=>{o(),t?i().catch(()=>{}):e.cancelQueries({queryKey:Nl,exact:!0})}),l=P(e=>i(e));return()=>{t=!1,n.abort(),l(),c(),s(),r?.()}},[e])}function Rl(e,t){let n=t===`config.json`?[V.projects,V.config,V.runsIndex]:t===`agent-accounts.json`?[V.agentProfiles,V.providerStatus]:t===`ui-state.json`?[V.uiState]:[];for(let t of n)e.invalidateQueries({queryKey:t})}function zl(e){let t=I();return H({mutationFn:async t=>Pl(await ct(await Et.api.v1.home.recovery[e].$post({json:t}),`/home/recovery/${e}`)),onSuccess:async(e,n)=>{await t.cancelQueries({queryKey:Nl,exact:!0}),t.setQueryData(Nl,e),Rl(t,n.file)}})}var Bl=()=>zl(`restore`),Vl=()=>zl(`accept`),Hl=()=>zl(`import`);function Ul(){return Ll(),null}function Wl(){return new Nc({defaultOptions:{queries:{refetchInterval:!1,staleTime:5*6e4,gcTime:30*6e4,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:(e,t)=>t instanceof et&&t.status>=400&&t.status<500?!1:e<1},mutations:{retry:!1}}})}var Gl=Z.createContext(null),Kl=class extends Z.Component{state={error:null};static getDerivedStateFromError(e){return{error:e instanceof Error?e:Error(String(e))}}componentDidCatch(e,t){console.error(`Squawk cockpit: uncaught render error`,e,t.componentStack)}render(){let{error:e}=this.state;return e?(0,Q.jsxs)(`div`,{"data-slot":`app-error`,role:`alert`,style:{display:`flex`,minHeight:`100dvh`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:`12px`,padding:`24px`,textAlign:`center`,font:`14px/1.5 system-ui, sans-serif`},children:[(0,Q.jsx)(`h1`,{style:{fontSize:`20px`,fontWeight:600,margin:0},children:`The cockpit hit an error`}),(0,Q.jsxs)(`p`,{style:{margin:0,maxWidth:`52ch`},children:[`Reload to carry on. Nothing on disk changed — Squawk’s state lives in`,` `,(0,Q.jsx)(`code`,{children:`.ai/cezar/`}),`, and this page never wrote to it.`]}),(0,Q.jsx)(`pre`,{"data-slot":`app-error-detail`,style:{margin:0,maxWidth:`100%`,overflowX:`auto`,textAlign:`left`,opacity:.75},children:e.message}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>location.reload(),style:{padding:`6px 14px`,cursor:`pointer`},children:`Reload`})]}):this.props.children}},ql=K(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Jl=K(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),Yl=K(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Xl=K(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Zl=K(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),Ql=K(`brush`,[[`path`,{d:`m11 10 3 3`,key:`fzmg1i`}],[`path`,{d:`M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z`,key:`p4q2r7`}],[`path`,{d:`M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031`,key:`wy6l02`}]]),$l=K(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),eu=K(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),tu=K(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),nu=K(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),ru=K(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),iu=K(`chevrons-left`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),au=K(`chevrons-right`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),ou=K(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),su=K(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),cu=K(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),lu=K(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),uu=K(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),du=K(`corner-left-up`,[[`path`,{d:`M14 9 9 4 4 9`,key:`1af5af`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),fu=K(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),pu=K(`diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),mu=K(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),hu=K(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),gu=K(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),_u=K(`feather`,[[`path`,{d:`M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z`,key:`18jl4k`}],[`path`,{d:`M16 8 2 22`,key:`vp34q`}],[`path`,{d:`M17.5 15H9`,key:`1oz8nu`}]]),vu=K(`file-cog`,[[`path`,{d:`M15 8a1 1 0 0 1-1-1V2a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8z`,key:`1ckgky`}],[`path`,{d:`M20 8v12a2 2 0 0 1-2 2h-4.182`,key:`1726p0`}],[`path`,{d:`m3.305 19.53.923-.382`,key:`ao1pio`}],[`path`,{d:`M4 10.592V4a2 2 0 0 1 2-2h8`,key:`1foop0`}],[`path`,{d:`m4.228 16.852-.924-.383`,key:`1fv9zy`}],[`path`,{d:`m5.852 15.228-.383-.923`,key:`1a9hc2`}],[`path`,{d:`m5.852 20.772-.383.924`,key:`1sh9ke`}],[`path`,{d:`m8.148 15.228.383-.923`,key:`4yu6lf`}],[`path`,{d:`m8.53 21.696-.382-.924`,key:`18b0s9`}],[`path`,{d:`m9.773 16.852.922-.383`,key:`ti6xop`}],[`path`,{d:`m9.773 19.148.922.383`,key:`rws47d`}],[`circle`,{cx:`7`,cy:`18`,r:`3`,key:`lvkj7j`}]]),yu=K(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),bu=K(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),xu=K(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),Su=K(`folder`,[[`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`}]]),Cu=K(`gem`,[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),wu=K(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),Tu=K(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Eu=K(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Du=K(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),Ou=K(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),ku=K(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Au=K(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),ju=K(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),Mu=K(`memory-stick`,[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]),Nu=K(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Pu=K(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Fu=K(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),Iu=K(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Lu=K(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Ru=K(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),zu=K(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),Bu=K(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Vu=K(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),Hu=K(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Uu=K(`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`}]]),Wu=K(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),Gu=K(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Ku=K(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),qu=K(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Ju=K(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Yu=K(`waves-horizontal`,[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]]),Xu=K(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Zu=K(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Qu=`cezar:open-command-palette`;function $u(){window.dispatchEvent(new Event(Qu))}var ed=`cez-sidebar-width`;function td(e){let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(420,Math.max(264,Math.round(t))):264}function nd(){try{let e=localStorage.getItem(ed);return e===null?264:td(e)}catch{return 264}}function rd(e){try{localStorage.setItem(ed,String(td(e)))}catch{}}var id=Z.createContext(264),ad=Z.createContext(void 0);function od(){return Z.useContext(ad)}var sd=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),cd=`VisuallyHidden`,ld=Z.forwardRef((e,t)=>(0,Q.jsx)(q.span,{...e,ref:t,style:{...sd,...e.style}}));ld.displayName=cd;var ud=ld,dd=`Collapsible`,[fd,pd]=lo(dd),[md,hd]=fd(dd),gd=Z.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=ao({prop:r,defaultProp:i??!1,onChange:o,caller:dd});return(0,Q.jsx)(md,{scope:n,disabled:a,contentId:co(),open:c,onOpenToggle:Z.useCallback(()=>l(e=>!e),[l]),children:(0,Q.jsx)(q.div,{"data-state":Sd(c),"data-disabled":a?``:void 0,...s,ref:t})})});gd.displayName=dd;var _d=`CollapsibleTrigger`,vd=Z.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=hd(_d,n);return(0,Q.jsx)(q.button,{type:`button`,"aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open||!1,"data-state":Sd(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:J(e.onClick,i.onOpenToggle)})});vd.displayName=_d;var yd=`CollapsibleContent`,bd=Z.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=hd(yd,e.__scopeCollapsible);return(0,Q.jsx)(ho,{present:n||i.open,children:({present:e})=>(0,Q.jsx)(xd,{...r,ref:t,present:e})})});bd.displayName=yd;var xd=Z.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=hd(yd,n),[s,c]=Z.useState(r),l=Z.useRef(null),u=O(t,l),d=Z.useRef(0),f=d.current,p=Z.useRef(0),m=p.current,h=o.open||s,g=Z.useRef(h),_=Z.useRef(void 0);return Z.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),oo(()=>{let e=l.current;if(e){_.current=_.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=_.current.transitionDuration,e.style.animationName=_.current.animationName),c(r)}},[o.open,r]),(0,Q.jsx)(q.div,{"data-state":Sd(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})});function Sd(e){return e?`open`:`closed`}var Cd=gd,wd=`AlertDialog`,[Td,Ed]=lo(wd,[Ho]),Dd=Ho(),Od=e=>{let{__scopeAlertDialog:t,...n}=e,r=Dd(t);return(0,Q.jsx)(qo,{...r,...n,modal:!0})};Od.displayName=wd;var kd=`AlertDialogTrigger`,Ad=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Dd(n);return(0,Q.jsx)(Bo,{...i,...r,ref:t})});Ad.displayName=kd;var jd=`AlertDialogPortal`,Md=e=>{let{__scopeAlertDialog:t,...n}=e,r=Dd(t);return(0,Q.jsx)(Wo,{...r,...n})};Md.displayName=jd;var Nd=`AlertDialogOverlay`,Pd=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Dd(n);return(0,Q.jsx)(zo,{...i,...r,ref:t})});Pd.displayName=Nd;var Fd=`AlertDialogContent`,[Id,Ld]=Td(Fd),Rd=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=Dd(n),o=O(t,Z.useRef(null)),s=Z.useRef(null);return(0,Q.jsx)(Id,{scope:n,cancelRef:s,children:(0,Q.jsx)(Go,{role:`alertdialog`,...a,...i,ref:o,onOpenAutoFocus:J(i.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})});Rd.displayName=Fd;var zd=`AlertDialogTitle`,Bd=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Dd(n);return(0,Q.jsx)(Ko,{...i,...r,ref:t})});Bd.displayName=zd;var Vd=`AlertDialogDescription`,Hd=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Dd(n);return(0,Q.jsx)(Vo,{...i,...r,ref:t})});Hd.displayName=Vd;var Ud=`AlertDialogAction`,Wd=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=Dd(n);return(0,Q.jsx)(Uo,{...i,...r,ref:t})});Wd.displayName=Ud;var Gd=`AlertDialogCancel`,Kd=Z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=Ld(Gd,n),a=Dd(n),o=O(t,i);return(0,Q.jsx)(Uo,{...a,...r,ref:o})});Kd.displayName=Gd;var qd=Od,Jd=Md,Yd=Pd,Xd=Rd,Zd=Wd,Qd=Kd,$d=Bd,ef=Hd;function tf(e){let t=Z.useRef({value:e,previous:e});return Z.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var nf=`Label`,rf=Z.forwardRef((e,t)=>(0,Q.jsx)(q.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));rf.displayName=nf;var af=rf;function of(e,[t,n]){return Math.min(n,Math.max(t,e))}var sf=e(r(),1),cf=[` `,`Enter`,`ArrowUp`,`ArrowDown`],lf=[` `,`Enter`],uf=`Select`,[df,ff,pf]=Io(uf),[mf,hf]=lo(uf,[pf,Lo]),gf=Lo(),[_f,vf]=mf(uf),[yf,bf]=mf(uf),xf=`SelectProvider`;function Sf(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=gf(t),[_,v]=Z.useState(null),[y,b]=Z.useState(null),[x,S]=Z.useState(!1),C=go(l),[w,T]=ao({prop:r,defaultProp:i??!1,onChange:a,caller:uf}),[E,D]=ao({prop:o,defaultProp:s,onChange:c,caller:uf}),O=Z.useRef(null),k=Z.useRef(E);Z.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]=Z.useState(new Set),ee=co(),te=Array.from(j).map(e=>e.props.value).join(`;`),ne=Z.useCallback(e=>{M(t=>new Set(t).add(e))},[]),re=Z.useCallback(e=>{M(t=>{let n=new Set(t);return n.delete(e),n})},[]),ie={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:ee,value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:j,nativeSelectKey:te,isFormControl:A};return(0,Q.jsx)(bo,{...g,children:(0,Q.jsx)(_f,{scope:t,...ie,children:(0,Q.jsx)(df.Provider,{scope:t,children:(0,Q.jsx)(yf,{scope:t,onNativeOptionAdd:ne,onNativeOptionRemove:re,children:Sp(h)?h(ie):n})})})})}Sf.displayName=xf;var Cf=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,Q.jsx)(Sf,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,Q.jsxs)(Q.Fragment,{children:[n,e?(0,Q.jsx)(xp,{__scopeSelect:t}):null]})})};Cf.displayName=uf;var wf=`SelectTrigger`,Tf=Z.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=gf(n),o=vf(wf,n),s=o.disabled||r,c=O(t,o.onTriggerChange),l=ff(n),u=Z.useRef(`touch`),[d,f,p]=wp(e=>{let t=l().filter(e=>!e.disabled),n=Tp(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,Q.jsx)(vo,{asChild:!0,...a,children:(0,Q.jsx)(q.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":Cp(o.value)?``:void 0,...i,ref:c,onClick:J(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:J(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:J(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&cf.includes(e.key)&&(m(),e.preventDefault())})})})});Tf.displayName=wf;var Ef=`SelectValue`,Df=Z.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=vf(Ef,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=O(t,c.onValueNodeChange);oo(()=>{l(u)},[l,u]);let f=Cp(c.value);return(0,Q.jsx)(q.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,Q.jsx)(Z.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});Df.displayName=Ef;var Of=`SelectIcon`,kf=Z.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,Q.jsx)(q.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});kf.displayName=Of;var Af=`SelectPortal`,[jf,Mf]=mf(Af,{forceMount:void 0}),Nf=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,Q.jsx)(jf,{scope:e.__scopeSelect,forceMount:n,children:(0,Q.jsx)(so,{asChild:!0,...r})})};Nf.displayName=Af;var Pf=`SelectContent`,Ff=Z.forwardRef((e,t)=>{let n=Mf(Pf,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=vf(Pf,e.__scopeSelect),[o,s]=Z.useState();return oo(()=>{s(new DocumentFragment)},[]),(0,Q.jsx)(ho,{present:r||a.open,children:({present:e})=>e?(0,Q.jsx)(Hf,{...i,ref:t}):(0,Q.jsx)(If,{...i,fragment:o})})});Ff.displayName=Pf;var If=Z.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?sf.createPortal((0,Q.jsx)(Rf,{scope:n,children:(0,Q.jsx)(df.Slot,{scope:n,children:(0,Q.jsx)(`div`,{ref:t,children:r})})}),i):null});If.displayName=`SelectContentFragment`;var Lf=10,[Rf,zf]=mf(Pf),Bf=`SelectContentImpl`,Vf=b(`SelectContent.RemoveScroll`),Hf=Z.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=vf(Pf,n),[y,b]=Z.useState(null),[x,S]=Z.useState(null),C=O(t,b),[w,T]=Z.useState(null),[E,D]=Z.useState(null),k=ff(n),[A,j]=Z.useState(!1),M=Z.useRef(!1);Z.useEffect(()=>{if(y)return mo(y)},[y]),po();let ee=Z.useCallback(e=>{let[t,...n]=k().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},[k,x]),te=Z.useCallback(()=>ee([w,y]),[ee,w,y]);Z.useEffect(()=>{A&&te()},[A,te]);let{onOpenChange:ne,triggerPointerDownPosRef:re}=v;Z.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(re.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(re.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||ne(!1),document.removeEventListener(`pointermove`,t),re.current=null};return re.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,ne,re]),Z.useEffect(()=>{let e=()=>ne(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[ne]);let[ie,N]=wp(e=>{let t=k().filter(e=>!e.disabled),n=Tp(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),P=Z.useCallback((e,t,n)=>{let r=!M.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(M.current=!0))},[v.value]),F=Z.useCallback(()=>y?.focus(),[y]),ae=Z.useCallback((e,t,n)=>{let r=!M.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),oe=r===`popper`?Kf:Wf,se=oe===Kf?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,Q.jsx)(Rf,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:P,selectedItem:w,onItemLeave:F,itemTextRefCallback:ae,focusSelectedItem:te,selectedItemText:E,position:r,isPositioned:A,searchRef:ie,children:(0,Q.jsx)(uo,{as:Vf,allowPinchZoom:!0,children:(0,Q.jsx)(ro,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:J(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,Q.jsx)(fo,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,Q.jsx)(oe,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...se,onPlaced:()=>j(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:J(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&N(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().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(()=>ee(t)),e.preventDefault()}})})})})})})});Hf.displayName=Bf;var Uf=`SelectItemAlignedPosition`,Wf=Z.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=vf(Pf,n),o=zf(Pf,n),[s,c]=Z.useState(null),[l,u]=Z.useState(null),d=O(t,u),f=ff(n),p=Z.useRef(!1),m=Z.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=Z.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-Lf,d=of(a,[Lf,Math.max(Lf,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-Lf,d=of(a,[Lf,Math.max(Lf,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Lf*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-Lf,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=`${Lf}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]);oo(()=>y(),[y]);let[b,x]=Z.useState();return oo(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,Q.jsx)(qf,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:Z.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,Q.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,Q.jsx)(q.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Wf.displayName=Uf;var Gf=`SelectPopperPosition`,Kf=Z.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Lf,...a}=e,o=gf(n);return(0,Q.jsx)(Ro,{...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)`}})});Kf.displayName=Gf;var[qf,Jf]=mf(Pf,{}),Yf=`SelectViewport`,Xf=Z.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=zf(Yf,n),o=Jf(Yf,n),s=O(t,a.onViewportChange),c=Z.useRef(0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.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,Q.jsx)(df.Slot,{scope:n,children:(0,Q.jsx)(q.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:J(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-Lf*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})})})]})});Xf.displayName=Yf;var Zf=`SelectGroup`,[Qf,$f]=mf(Zf),ep=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=co();return(0,Q.jsx)(Qf,{scope:n,id:i,children:(0,Q.jsx)(q.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});ep.displayName=Zf;var tp=`SelectLabel`,np=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=$f(tp,n);return(0,Q.jsx)(q.div,{id:i.id,...r,ref:t})});np.displayName=tp;var rp=`SelectItem`,[ip,ap]=mf(rp),op=Z.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=vf(rp,n),c=zf(rp,n),l=s.value===r,[u,d]=Z.useState(a??``),[f,p]=Z.useState(!1),m=O(t,io(e=>c.itemRefCallback?.(e,r,i))),h=co(),g=Z.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,Q.jsx)(ip,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:Z.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,Q.jsx)(df.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,Q.jsx)(q.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:J(o.onFocus,()=>p(!0)),onBlur:J(o.onBlur,()=>p(!1)),onClick:J(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:J(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:J(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:J(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:J(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:J(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(lf.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});op.displayName=rp;var sp=`SelectItemText`,cp=Z.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=vf(sp,n),s=zf(sp,n),c=ap(sp,n),l=bf(sp,n),[u,d]=Z.useState(null),f=io(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=O(t,d,c.onItemTextChange,f),m=u?.textContent,h=Z.useMemo(()=>(0,Q.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return oo(()=>(g(h),()=>_(h)),[g,_,h]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!Cp(o.value)?sf.createPortal(a.children,o.valueNode):null]})});cp.displayName=sp;var lp=`SelectItemIndicator`,up=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return ap(lp,n).isSelected?(0,Q.jsx)(q.span,{"aria-hidden":!0,...r,ref:t}):null});up.displayName=lp;var dp=`SelectScrollUpButton`,fp=Z.forwardRef((e,t)=>{let n=zf(dp,e.__scopeSelect),r=Jf(dp,e.__scopeSelect),[i,a]=Z.useState(!1),o=O(t,r.onScrollButtonChange);return oo(()=>{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,Q.jsx)(hp,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});fp.displayName=dp;var pp=`SelectScrollDownButton`,mp=Z.forwardRef((e,t)=>{let n=zf(pp,e.__scopeSelect),r=Jf(pp,e.__scopeSelect),[i,a]=Z.useState(!1),o=O(t,r.onScrollButtonChange);return oo(()=>{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,Q.jsx)(hp,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});mp.displayName=pp;var hp=Z.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=zf(`SelectScrollButton`,n),o=Z.useRef(null),s=ff(n),c=Z.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return Z.useEffect(()=>()=>c(),[c]),oo(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,Q.jsx)(q.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:J(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:J(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:J(i.onPointerLeave,()=>{c()})})}),gp=`SelectSeparator`,_p=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,Q.jsx)(q.div,{"aria-hidden":!0,...r,ref:t})});_p.displayName=gp;var vp=`SelectArrow`,yp=Z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=gf(n);return zf(vp,n).position===`popper`?(0,Q.jsx)(Fo,{...i,...r,ref:t}):null});yp.displayName=vp;var bp=`SelectBubbleInput`,xp=Z.forwardRef(({__scopeSelect:e,...t},n)=>{let r=vf(bp,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=Z.useRef(null),m=O(n,p),h=i??``,g=tf(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return Z.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,Q.jsxs)(q.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...sd,...t.style},ref:m,defaultValue:h,children:[Cp(i)&&!_?(0,Q.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});xp.displayName=bp;function Sp(e){return typeof e==`function`}function Cp(e){return e===``||e===void 0}function wp(e){let t=io(e),n=Z.useRef(``),r=Z.useRef(0),i=Z.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=Z.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return Z.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Tp(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=Ep(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 Ep(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Dp=`Switch`,[Op,kp]=lo(Dp),[Ap,jp]=Op(Dp);function Mp(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]=ao({prop:n,defaultProp:i??!1,onChange:c,caller:Dp}),[m,h]=Z.useState(null),[g,_]=Z.useState(null),v={checked:f,setChecked:p,disabled:a,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:Z.useRef(!1),required:l,defaultChecked:i,isFormControl:!m||!!o||!!m.closest(`form`),bubbleInput:g,setBubbleInput:_};return(0,Q.jsx)(Ap,{scope:t,...v,children:Bp(d)?d(v):r})}var Np=`SwitchTrigger`,Pp=Z.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}=jp(Np,e),h=O(r,u),g=Z.useRef(c);return Z.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,Q.jsx)(q.button,{type:`button`,role:`switch`,"aria-checked":c,"aria-required":l,"data-state":Vp(c),"data-disabled":s?``:void 0,disabled:s,value:o,...n,ref:h,onClick:J(t,e=>{d(e=>!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});Pp.displayName=Np;var Fp=Z.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,Q.jsx)(Mp,{__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,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Pp,{...d,ref:t,__scopeSwitch:n}),e&&(0,Q.jsx)(zp,{__scopeSwitch:n})]})})});Fp.displayName=Dp;var Ip=`SwitchThumb`,Lp=Z.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=jp(Ip,n);return(0,Q.jsx)(q.span,{"data-state":Vp(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});Lp.displayName=Ip;var Rp=`SwitchBubbleInput`,zp=Z.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}=jp(Rp,e),m=O(n,p),h=tf(a),g=_o(r);Z.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 _=Z.useRef(a);return(0,Q.jsx)(q.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%)`}})});zp.displayName=Rp;function Bp(e){return typeof e==`function`}function Vp(e){return e?`checked`:`unchecked`}var Hp=`Tabs`,[Up,Wp]=lo(Hp,[wo]),Gp=wo(),[Kp,qp]=Up(Hp),Jp=Z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=go(s),[d,f]=ao({prop:r,onChange:i,defaultProp:a??``,caller:Hp});return(0,Q.jsx)(Kp,{scope:n,baseId:co(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,Q.jsx)(q.div,{dir:u,"data-orientation":o,...l,ref:t})})});Jp.displayName=Hp;var Yp=`TabsList`,Xp=Z.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=qp(Yp,n),o=Gp(n);return(0,Q.jsx)(To,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,Q.jsx)(q.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Xp.displayName=Yp;var Zp=`TabsTrigger`,Qp=Z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=qp(Zp,n),s=Gp(n),c=tm(o.baseId,r),l=nm(o.baseId,r),u=r===o.value;return(0,Q.jsx)(Oo,{asChild:!0,...s,focusable:!i,active:u,children:(0,Q.jsx)(q.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:J(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:J(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:J(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Qp.displayName=Zp;var $p=`TabsContent`,em=Z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=qp($p,n),c=tm(s.baseId,r),l=nm(s.baseId,r),u=r===s.value,d=Z.useRef(u);return Z.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,Q.jsx)(ho,{present:i||u,children:({present:n})=>(0,Q.jsx)(q.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});em.displayName=$p;function tm(e,t){return`${e}-trigger-${t}`}function nm(e,t){return`${e}-content-${t}`}var rm=Jp,im=Xp,am=Qp,om=em,[sm,cm]=lo(`Tooltip`,[Lo]),lm=Lo(),um=`TooltipProvider`,dm=700,fm=`tooltip.open`,[pm,mm]=sm(um),hm=e=>{let{__scopeTooltip:t,delayDuration:n=dm,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=Z.useRef(!0),s=Z.useRef(!1),c=Z.useRef(0);return Z.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,Q.jsx)(pm,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:Z.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:Z.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:Z.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};hm.displayName=um;var gm=`Tooltip`,[_m,vm]=sm(gm),ym=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=mm(gm,e.__scopeTooltip),l=lm(t),[u,d]=Z.useState(null),f=co(),p=Z.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=Z.useRef(!1),[_,v]=ao({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(fm))):c.onClose(),a?.(e)},caller:gm}),y=Z.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=Z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=Z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=Z.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return Z.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,Q.jsx)(bo,{...l,children:(0,Q.jsx)(_m,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:Z.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:Z.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};ym.displayName=gm;var bm=`TooltipTrigger`,xm=Z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=vm(bm,n),a=mm(bm,n),o=lm(n),s=O(t,Z.useRef(null),i.onTriggerChange),c=Z.useRef(!1),l=Z.useRef(!1),u=Z.useCallback(()=>c.current=!1,[]);return Z.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,Q.jsx)(vo,{asChild:!0,...o,children:(0,Q.jsx)(q.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:J(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:J(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:J(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:J(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:J(e.onBlur,i.onClose),onClick:J(e.onClick,i.onClose)})})});xm.displayName=bm;var Sm=`TooltipPortal`,[Cm,wm]=sm(Sm,{forceMount:void 0}),Tm=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=vm(Sm,t);return(0,Q.jsx)(Cm,{scope:t,forceMount:n,children:(0,Q.jsx)(ho,{present:n||a.open,children:(0,Q.jsx)(so,{asChild:!0,container:i,children:r})})})};Tm.displayName=Sm;var Em=`TooltipContent`,Dm=Z.forwardRef((e,t)=>{let n=wm(Em,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=vm(Em,e.__scopeTooltip);return(0,Q.jsx)(ho,{present:r||o.open,children:o.disableHoverableContent?(0,Q.jsx)(Mm,{side:i,...a,ref:t}):(0,Q.jsx)(Om,{side:i,...a,ref:t})})}),Om=Z.forwardRef((e,t)=>{let n=vm(Em,e.__scopeTooltip),r=mm(Em,e.__scopeTooltip),i=Z.useRef(null),a=O(t,i),[o,s]=Z.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=Z.useCallback(()=>{s(null),d(!1)},[d]),p=Z.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Im(r,Fm(r,n.getBoundingClientRect())),a=Lm(t.getBoundingClientRect()),o=zm([...i,...a]);s(o),d(!0)},[d]);return Z.useEffect(()=>()=>f(),[f]),Z.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),Z.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Rm(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,Q.jsx)(Mm,{...e,ref:a})}),[km,Am]=sm(gm,{isInside:!1}),jm=p(`TooltipContent`),Mm=Z.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=vm(Em,n),l=lm(n),{onClose:u}=c;return Z.useEffect(()=>(document.addEventListener(fm,u),()=>document.removeEventListener(fm,u)),[u]),Z.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,Q.jsx)(fo,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,Q.jsxs)(Ro,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,Q.jsx)(jm,{children:r}),(0,Q.jsx)(km,{scope:n,isInside:!0,children:(0,Q.jsx)(ud,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Dm.displayName=Em;var Nm=`TooltipArrow`,Pm=Z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=lm(n);return Am(Nm,n).isInside?null:(0,Q.jsx)(Fo,{...i,...r,ref:t})});Pm.displayName=Nm;function Fm(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Im(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Lm(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Rm(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function zm(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Bm(t)}function Bm(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Vm=hm,Hm=ym,Um=xm,Wm=Tm,Gm=Dm,Km=Pm,qm=h(`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-accent-strong text-accent-strong-foreground [a&]:hover:bg-accent-strong/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-link-foreground underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function Jm({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,Q.jsx)(n?D:`span`,{"data-slot":`badge`,"data-variant":t,className:C(qm({variant:t}),e),...r})}var Ym=`x-apple.systempreferences:com.apple.preference.security?Privacy_FilesAndFolders`,Xm=`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-foreground hover:bg-muted`;function Zm(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 Qm({path:e,selected:t,onSelect:n,onEnter:r,decorate:i,emptyHint:a,showHidden:o=!1}){let s=Pn(e,o),c=s.data?.parent??null;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-[11px] text-soft-foreground`,title:s.data?.path??void 0,children:s.data?.path??(s.isError?``:`Loading…`)}),s.isError?(0,Q.jsx)($m,{error:s.error,path:e,onEnter:r,onRetry:()=>void s.refetch()}):(0,Q.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,Q.jsx)(`li`,{className:`flex`,children:(0,Q.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,Q.jsx)(du,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(s.data?.dirs??[]).map(e=>(0,Q.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":t?.path===e.path,onClick:()=>n(e),onDoubleClick:()=>r(e.path),className:C(`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,Q.jsx)(Su,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),i?.(e)]}),(0,Q.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,Q.jsx)(ru,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),s.data&&s.data.dirs.length===0?(0,Q.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:a}):null]}),s.data?.truncated?(0,Q.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-[11px] text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function $m({error:e,path:t,onEnter:n,onRetry:r}){let i=e instanceof et&&e.status===403,a=t===null?null:Zm(t);return(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Q.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:e instanceof Error?e.message:`could not list that folder`}),i?(0,Q.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,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[12.5px]`,children:[a===null?null:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`fs-error-back`,onClick:()=>n(a),className:Xm,children:[(0,Q.jsx)(du,{className:`size-3.5`,"aria-hidden":!0}),`Back`]}),i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`a`,{"data-slot":`fs-privacy-settings`,href:Ym,target:`_blank`,rel:`noreferrer`,className:Xm,children:`Open Privacy Settings`}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`fs-retry`,onClick:r,className:Xm,children:`Try again`})]}):null]})]})}function eh(e,t,n=!1){let r=Pn(e,n);return t?.path??r.data?.path??null}function th({open:e,onOpenChange:t}){let[n,r]=(0,Z.useState)(null),[i,a]=(0,Z.useState)(null),o=bn(),s=gr(),c=j(),l=new Set((o.data?.projects??[]).map(e=>e.root)),u=e=>{r(e),a(null),s.reset()},d=eh(n,i);return(0,Q.jsx)(es,{open:e,onOpenChange:t,children:(0,Q.jsxs)(Qo,{"data-slot":`add-project-dialog`,className:`sm:max-w-lg`,children:[(0,Q.jsxs)(Zo,{children:[(0,Q.jsx)($o,{children:`Open local folder`}),(0,Q.jsx)(Yo,{children:`Pick the folder Squawk should run in. Git repos are marked; any folder works.`})]}),(0,Q.jsxs)(Xo,{className:`space-y-4`,children:[(0,Q.jsx)(Qm,{path:n,selected:i,onSelect:a,onEnter:u,emptyHint:`No subfolders here — “Add project” registers this folder.`,decorate:e=>(0,Q.jsxs)(Q.Fragment,{children:[e.isRepo?(0,Q.jsx)(Jm,{variant:`outline`,className:`shrink-0 text-[12px]`,children:`git`}):null,l.has(e.path)?(0,Q.jsx)(Jm,{variant:`ghost`,className:`shrink-0 text-[12px] text-muted-foreground`,children:`already added`}):null]})}),s.isError?(0,Q.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,Q.jsxs)(Jo,{className:`min-w-0 sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`span`,{"data-slot":`add-project-target`,className:`min-w-0 truncate font-mono text-[11px] text-muted-foreground`,title:d??void 0,children:d??``}),(0,Q.jsxs)(`span`,{className:`flex shrink-0 gap-2`,children:[(0,Q.jsx)(k,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(k,{"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 nh(e,t){let[n,r]=(0,Z.useState)(null),i=(0,Z.useMemo)(()=>`${e}${Math.random().toString(36).slice(2)}-${Date.now().toString(36)}`,[]),a=(0,Z.useRef)(i);return a.current=i,(0,Z.useEffect)(()=>rl((e,t)=>{if(e!==`checkout-progress`)return;let n=t;n?.checkoutId===a.current&&(n.phase===`cloning`&&n.line?r(n.line):n.phase!==`cloning`&&r(null))}),[]),(0,Z.useEffect)(()=>P(async e=>{if(!t)return;let n=await xe(i,{signal:e}).catch(()=>null);if(!n)return;let{progress:o}=n;e.aborted||o?.checkoutId!==a.current||r(o?.phase===`cloning`?o.line??null:null)}),[t,i]),{checkoutId:i,progress:n,setProgress:r}}function rh({className:e,type:t,...n}){return(0,Q.jsx)(`input`,{type:t,"data-slot":`input`,className:C(`h-11 w-full min-w-0 rounded-md border border-control-border bg-[var(--task-brand-bg)] px-3 py-1 text-base shadow-none transition-[color,box-shadow] outline-hidden selection:bg-accent-strong selection:text-accent-strong-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-soft-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20`,e),...n})}function ih({className:e,...t}){return(0,Q.jsx)(af,{"data-slot":`label`,className:C(`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 ah(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 oh({open:e,onOpenChange:t}){let[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(!1),c=(0,Z.useRef)(!1),l=bn(),u=Qn(),{mutate:d,isPending:f}=u,p=j(),m=ah(u.error),{checkoutId:h,progress:g,setProgress:_}=nh(`co-`,f),v=(0,Z.useMemo)(()=>{let e=n.trim().replace(/\/+$/,``).replace(/\.git$/,``).split(`/`).pop()??``;return e.includes(`:`)?e.split(`:`).pop()??``:e},[n]),y=i.trim()===``?v:i.trim(),b=l.data?.projectsDir??``,x=y===``?``:`${b.replace(/\/+$/,``)}/${y}`,S=(0,Z.useCallback)(()=>{n.trim()===``||f||(c.current=!1,s(!1),_(null),d({url:n.trim(),checkoutId:h,...i.trim()===``?{}:{name:i.trim()}},{onSuccess:({project:e})=>{t(!1),p(`/p/${encodeURIComponent(e.id)}/`)}}))},[d,f,h,i,p,t,n]);return(0,Z.useEffect)(()=>{if(!o)return;let e=()=>{c.current&&(c.current=!1,s(!1),S())},t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[o,S]),(0,Q.jsx)(es,{open:e,onOpenChange:e=>u.isPending?void 0:t(e),children:(0,Q.jsxs)(Qo,{"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,Q.jsxs)(Zo,{children:[(0,Q.jsx)($o,{children:`Clone from GitHub`}),(0,Q.jsxs)(Yo,{children:[`Squawk clones with `,(0,Q.jsx)(`code`,{children:`gh`}),` into your checkout root and adds the result as a project.`]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(ih,{htmlFor:`clone-url`,children:`Repository`}),(0,Q.jsx)(rh,{id:`clone-url`,"data-slot":`clone-url`,autoFocus:!0,placeholder:`owner/repo or https://github.com/owner/repo`,value:n,disabled:u.isPending,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&S()}})]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(ih,{htmlFor:`clone-name`,children:`Folder name`}),(0,Q.jsx)(rh,{id:`clone-name`,"data-slot":`clone-name`,placeholder:v===``?`repo`:v,value:i,disabled:u.isPending,onChange:e=>a(e.target.value)}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(`p`,{"data-slot":`clone-target`,className:`min-w-0 flex-1 truncate font-mono text-[11px] text-soft-foreground`,title:x,children:x}),u.isPending?(0,Q.jsx)(k,{"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,Q.jsx)(Ui,{className:`size-3.5`,"aria-hidden":`true`})}):(0,Q.jsx)(k,{asChild:!0,variant:`ghost`,size:`icon-sm`,className:`size-7`,children:(0,Q.jsx)(E,{to:`/settings/global/projects`,"data-slot":`clone-root-settings`,"aria-label":`Edit checkout root`,title:`Edit checkout root`,children:(0,Q.jsx)(Ui,{className:`size-3.5`,"aria-hidden":`true`})})})]})]}),u.isPending?(0,Q.jsx)(`p`,{"data-slot":`clone-progress`,className:`truncate font-mono text-[11px] text-muted-foreground`,children:g??`Starting the clone…`}):null,u.isError?(0,Q.jsx)(`div`,{"data-slot":`clone-error`,className:`grid min-w-0 gap-1.5 text-[13px] text-danger`,children:m?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{children:`GitHub requires SAML authorization for this organization.`}),(0,Q.jsxs)(`p`,{children:[(0,Q.jsx)(`a`,{"data-slot":`clone-sso-link`,className:`inline-flex min-h-11 items-center font-medium underline underline-offset-2`,href:m,target:`_blank`,rel:`noreferrer`,onClick:()=>{c.current=!0,s(!0)},children:`Authorize this GitHub organization`}),o?` — return here after authorizing, or choose Retry clone.`:` — return to this tab to retry, or choose Retry clone.`]}),(0,Q.jsxs)(`details`,{className:`min-w-0`,children:[(0,Q.jsx)(`summary`,{className:`min-h-11 content-center`,children:`Error details`}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-all`,children:u.error instanceof Error?u.error.message:null})]})]}):(0,Q.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-all`,children:u.error instanceof Error?u.error.message:`could not clone that repository`})}):null,(0,Q.jsxs)(Jo,{children:[(0,Q.jsx)(k,{variant:`outline`,disabled:u.isPending,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(k,{"data-slot":`clone-confirm`,disabled:n.trim()===``||y===``||u.isPending,onClick:S,children:u.isPending?`Cloning…`:u.isError?`Retry clone`:`Clone`})]})]})})}var sh=[{slug:`github/codespaces-nextjs`,label:`Next.js`,description:`Minimal Next.js app (GitHub)`},{slug:`vercel/chatbot`,label:`Next.js AI chatbot`,description:`Full-featured AI chat app (Vercel)`},{slug:`vercel/nextjs-postgres-nextauth-tailwindcss-template`,label:`Next.js admin dashboard`,description:`Postgres, Auth.js and Tailwind (Vercel)`},{slug:`github/codespaces-react`,label:`React + Vite`,description:`React single-page app (GitHub)`},{slug:`antfu-collective/vitesse`,label:`Vue + Vite`,description:`Opinionated Vue starter (Vitesse)`},{slug:`nuxt-ui-templates/starter-vue`,label:`Vue + Nuxt UI`,description:`Vue + Vite with Nuxt UI (Nuxt)`},{slug:`mugnavo/cove`,label:`Vite+`,description:`TanStack Start on Vite+ (vp), Better Auth`},{slug:`w3cj/hono-open-api-starter`,label:`Hono`,description:`Type-safe JSON API with OpenAPI docs`},{slug:`github/codespaces-express`,label:`Express`,description:`Node.js web server (GitHub)`},{slug:`andrewmcodes/obsidian-beginner-vault-template`,label:`Obsidian vault`,description:`Your own knowledge base in Markdown`},{slug:`chibat/chrome-extension-typescript-starter`,label:`Chrome extension`,description:`TypeScript extension starter`},{slug:`actions/typescript-action`,label:`GitHub Action`,description:`TypeScript action with tests (GitHub)`},{slug:`microsoft/python-package-template`,label:`Python package`,description:`Packaging, tests and CI (Microsoft)`},{slug:`github/codespaces-flask`,label:`Flask`,description:`Python web app (GitHub)`},{slug:`github/codespaces-django`,label:`Django`,description:`Python web framework (GitHub)`},{slug:`github/codespaces-rails`,label:`Ruby on Rails`,description:`Rails app (GitHub)`},{slug:`github/codespaces-jupyter`,label:`Jupyter notebooks`,description:`Data science and ML (GitHub)`}];function ch(e){let t=e.trim().toLowerCase();return t===``||sh.some(e=>e.slug.toLowerCase()===t)?sh:sh.filter(e=>[e.label,e.slug,e.description].some(e=>e.toLowerCase().includes(t)))}function lh({value:e,onChange:t,disabled:n,id:r}){let i=(0,Z.useId)(),a=ch(e),[o,s]=(0,Z.useState)(-1),c=(0,Z.useRef)(null);(0,Z.useEffect)(()=>s(-1),[e]),(0,Z.useEffect)(()=>{o<0||c.current?.querySelector(`[data-index="${o}"]`)?.scrollIntoView?.({block:`nearest`})},[o]);let l=e=>`${i}-option-${e}`;return(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-1.5`,children:[(0,Q.jsx)(rh,{id:r,"data-slot":`create-project-template`,role:`combobox`,"aria-expanded":`true`,"aria-controls":i,"aria-autocomplete":`list`,"aria-activedescendant":o>=0?l(o):void 0,autoComplete:`off`,spellCheck:!1,placeholder:`owner/repo or https://github.com/owner/repo`,value:e,disabled:n,onChange:e=>t(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),a.length===0)return;let t=e.key===`ArrowDown`;s(e=>e<0?t?0:a.length-1:(e+(t?1:-1)+a.length)%a.length)}else if(e.key===`Enter`&&o>=0){e.preventDefault(),e.stopPropagation();let n=a[o];n&&t(n.slug)}}}),(0,Q.jsx)(`ul`,{ref:c,id:i,role:`listbox`,"aria-label":`Suggested templates`,"data-slot":`create-project-template-list`,className:`max-h-48 min-h-0 overflow-y-auto overscroll-contain rounded-md border border-border`,children:a.length===0?(0,Q.jsx)(`li`,{className:`px-3 py-2 text-xs text-muted-foreground`,role:`presentation`,children:`No suggestion matches — any GitHub template repository works.`}):a.map((r,i)=>{let a=r.slug.toLowerCase()===e.trim().toLowerCase();return(0,Q.jsxs)(`li`,{id:l(i),role:`option`,"aria-selected":a,"data-index":i,"data-value":r.slug,"data-slot":`create-project-template-option`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n||t(r.slug)},className:C(`grid min-h-11 cursor-pointer content-center gap-0.5 px-3 py-1.5 text-start`,`pointer-hover:hover:bg-accent`,i===o&&`bg-accent`,a&&`font-medium`),children:[(0,Q.jsxs)(`span`,{className:`truncate text-[13px]`,children:[r.label,` `,(0,Q.jsx)(`span`,{className:`font-mono text-[11px] text-soft-foreground`,children:r.slug})]}),(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:r.description})]},r.slug)})})]})}function uh({className:e,size:t=`default`,...n}){return(0,Q.jsx)(Fp,{"data-slot":`switch`,"data-size":t,className:C(`peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-none transition-[color,background-color,border-color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-6 data-[size=default]:w-10 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-accent-strong data-[state=unchecked]:bg-input`,e),...n,children:(0,Q.jsx)(Lp,{"data-slot":`switch-thumb`,className:C(`pointer-events-none block rounded-full bg-background ring-0 motion-safe:transition-transform group-data-[size=default]/switch:size-[18px] group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-[state=checked]:translate-x-5 group-data-[size=default]/switch:data-[state=unchecked]:translate-x-0.5 group-data-[size=sm]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-[state=unchecked]:translate-x-0`)})})}function dh(e){return{available:e.data?.available?e.data.owners:null,unavailableReason:e.isError?`GitHub is unavailable: ${e.error instanceof Error?e.error.message:`could not ask gh`}`:e.data&&!e.data.available?e.data.reason:null}}function fh(e,t){return e&&t!==null&&t.length>0}function ph(e,t){return e??t?.[0]?.login??null}function mh(e){return(e.data?.projectsDir??``).replace(/\/+$/,``)}function hh({nameValid:e,isPending:t,created:n,github:r,chosenOwner:i,effectiveStart:a,template:o}){return e&&!t&&n===null&&(!r||i!==null&&(a===`empty`||o.trim()!==``))}function gh({trimmed:e,checkoutId:t,github:n,chosenOwner:r,effectiveStart:i,template:a}){return{name:e,checkoutId:t,...n&&r?{github:{owner:r,...i===`template`?{template:a.trim()}:{}}}:{}}}function _h({created:e}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ma,{"aria-hidden":`true`,className:`mbs-0.5 size-5 shrink-0 text-warning`}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,Q.jsx)(`p`,{className:`font-medium`,children:`The project was created, but its GitHub repository is not finished.`}),(0,Q.jsx)(`p`,{className:`min-w-0 whitespace-pre-wrap break-words font-mono text-xs`,children:e.warning})]})]})}function vh({fieldId:e,name:t,setName:n,trimmed:r,nameValid:i,projectsDir:a,isPending:o,create:s}){let c=`${e}-name-hint`;return(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(ih,{htmlFor:`${e}-name`,children:`Name`}),(0,Q.jsx)(rh,{id:`${e}-name`,"data-slot":`create-project-name`,autoFocus:!0,autoComplete:`off`,spellCheck:!1,placeholder:`my-project`,value:t,disabled:o,"aria-invalid":r!==``&&!i,"aria-describedby":r!==``&&!i?c:void 0,onChange:e=>n(e.target.value.replace(/\s/g,`-`)),onKeyDown:e=>{e.key===`Enter`&&s()}}),r!==``&&!i?(0,Q.jsx)(`p`,{id:c,"data-slot":`create-project-name-hint`,className:`text-xs text-danger`,children:`Use letters, digits, “.”, “-” and “_” only, starting with a letter or digit — it names the folder and the repository.`}):null,(0,Q.jsx)(`p`,{"data-slot":`create-project-path`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,title:`${a}/${r}`,children:r===``?`${a}/…`:`${a}/${r}`})]})}function yh({fieldId:e,github:t,setGithubOn:n,isPending:r,available:i}){return(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(uh,{id:`${e}-github`,"data-slot":`create-project-github`,checked:t,disabled:r||i===null||i.length===0,onCheckedChange:n,className:`mbs-0.5`}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-0.5`,children:[(0,Q.jsx)(ih,{htmlFor:`${e}-github`,children:`Also create a private GitHub repository`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Under the account you choose. You can change its visibility on GitHub later.`})]})]})}function bh({fieldId:e,effectiveStart:t,setStart:n,isPending:r,github:i,template:a,setTemplate:o}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`fieldset`,{className:`grid gap-2`,disabled:r,children:[(0,Q.jsx)(`legend`,{className:`mbe-2 text-sm font-medium`,children:`Start with`}),(0,Q.jsx)(wh,{slot:`create-project-start-empty`,name:`${e}-start`,checked:t===`empty`,disabled:r,onChange:()=>n(`empty`),title:`Empty repository`,detail:`One empty first commit, no files.`}),(0,Q.jsx)(wh,{slot:`create-project-start-template`,name:`${e}-start`,checked:t===`template`,disabled:r||!i,onChange:()=>n(`template`),title:`From a template`,detail:i?`GitHub generates the repository from a template.`:`Needs the GitHub repository.`})]}),t===`template`?(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(ih,{htmlFor:`${e}-template`,children:`Template`}),(0,Q.jsx)(lh,{id:`${e}-template`,value:a,onChange:o,disabled:r})]}):null]})}function xh({isPending:e,progress:t,failed:n,error:r}){return(0,Q.jsxs)(Q.Fragment,{children:[e?(0,Q.jsx)(`p`,{"data-slot":`create-project-progress`,className:`flex-none truncate font-mono text-[11px] text-muted-foreground`,children:t??`Starting…`}):null,n?(0,Q.jsx)(`p`,{"data-slot":`create-project-error`,role:`alert`,className:`flex-none min-w-0 whitespace-pre-wrap break-words text-[13px] text-danger`,children:r instanceof Error?r.message:`could not create the project`}):null]})}function Sh({created:e,goToProject:t,isPending:n,onCancel:r,ready:i,onCreate:a,failed:o}){return(0,Q.jsx)(Jo,{className:`flex-none`,children:e?(0,Q.jsx)(k,{"data-slot":`create-project-open`,onClick:t,children:`Go to project`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{variant:`outline`,disabled:n,onClick:r,children:`Cancel`}),(0,Q.jsx)(k,{"data-slot":`create-project-submit`,disabled:!i,onClick:a,children:n?`Creating…`:o?`Try again`:`Create project`})]})})}function Ch({open:e,onOpenChange:t}){let[n,r]=(0,Z.useState)(``),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(`empty`),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(null),m=bn(),h=kn({enabled:e}),g=Kn(),{mutate:_,isPending:v}=g,y=j(),b=(0,Z.useId)(),x=(0,Z.useRef)(!1),{checkoutId:S,progress:C,setProgress:w}=nh(`np-`,v),{available:T,unavailableReason:E}=dh(h),D=fh(i,T),O=ph(o,T),k=D?c:`empty`,A=n.trim(),M=oe.test(A),ee=mh(m),te=hh({nameValid:M,isPending:v,created:f,github:D,chosenOwner:O,effectiveStart:k,template:u}),ne=(0,Z.useCallback)(()=>{!te||x.current||(x.current=!0,w(null),_(gh({trimmed:A,checkoutId:S,github:D,chosenOwner:O,effectiveStart:k,template:u}),{onSettled:()=>{x.current=!1},onSuccess:({project:e,warning:n})=>{if(n){p({projectId:e.id,warning:n});return}t(!1),y(`/p/${encodeURIComponent(e.id)}/`)}}))},[te,_,A,S,D,O,k,u,t,y]);return(0,Q.jsx)(es,{open:e,onOpenChange:e=>v?void 0:t(e),children:(0,Q.jsxs)(Qo,{"data-slot":`create-project-dialog`,className:`flex min-w-0 flex-col overflow-y-clip overflow-x-clip sm:max-w-2xl`,children:[(0,Q.jsxs)(Zo,{className:`flex-none`,children:[(0,Q.jsx)($o,{children:`New project`}),(0,Q.jsx)(Yo,{children:`Squawk creates a git repository with one empty commit in your checkout root and adds it as a project.`})]}),f?(0,Q.jsx)(`div`,{"data-slot":`create-project-warning`,role:`status`,className:`flex min-h-0 flex-1 gap-3 overflow-y-auto overscroll-contain rounded-md border border-border bg-muted p-4 text-[13px]`,children:(0,Q.jsx)(_h,{created:f})}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-wrap gap-6 overflow-y-auto overscroll-contain`,children:[(0,Q.jsxs)(`div`,{className:`grid min-w-[50%] grow-[999] basis-0 content-start gap-5`,children:[(0,Q.jsx)(vh,{fieldId:b,name:n,setName:r,trimmed:A,nameValid:M,projectsDir:ee,isPending:v,create:ne}),(0,Q.jsx)(yh,{fieldId:b,github:D,setGithubOn:a,isPending:v,available:T}),(0,Q.jsx)(bh,{fieldId:b,effectiveStart:k,setStart:l,isPending:v,github:D,template:u,setTemplate:d})]}),(0,Q.jsx)(Th,{owners:T,unavailableReason:E,enabled:D&&!v,chosen:O,onChoose:s,groupName:`${b}-owner`})]}),(0,Q.jsx)(xh,{isPending:v,progress:C,failed:g.isError,error:g.error}),(0,Q.jsx)(Sh,{created:f,goToProject:()=>{f&&(t(!1),y(`/p/${encodeURIComponent(f.projectId)}/`))},isPending:v,onCancel:()=>t(!1),ready:te,onCreate:ne,failed:g.isError})]})})}function wh({slot:e,name:t,checked:n,disabled:r,onChange:i,title:a,detail:o}){return(0,Q.jsxs)(`label`,{className:C(`flex min-h-11 items-start gap-3 rounded-md border border-border p-3`,`has-[:checked]:border-accent-strong has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-ring`,r?`cursor-not-allowed opacity-60`:`cursor-pointer`),children:[(0,Q.jsx)(`input`,{type:`radio`,"data-slot":e,name:t,checked:n,disabled:r,onChange:i,className:`mbs-0.5 size-4 accent-[var(--color-accent-strong)]`}),(0,Q.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium`,children:a}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o})]})]})}function Th({owners:e,unavailableReason:t,enabled:n,chosen:r,onChoose:i,groupName:a}){return(0,Q.jsxs)(`fieldset`,{"data-slot":`create-project-owners`,disabled:!n,className:`grid min-w-0 grow basis-56 content-start gap-2`,children:[(0,Q.jsx)(`legend`,{className:`mbe-2 text-sm font-medium`,children:`Repository owner`}),t===null?e===null?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ms,{className:`h-14 w-full`}),(0,Q.jsx)(ms,{className:`h-14 w-full`})]}):e.map(e=>(0,Q.jsxs)(`label`,{"data-slot":`create-project-owner`,className:C(`flex min-h-11 min-w-0 items-center gap-3 rounded-md border border-border p-2.5`,`has-[:checked]:border-accent-strong has-[:checked]:bg-accent`,`has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-ring`,n?`cursor-pointer pointer-hover:hover:bg-accent`:`cursor-not-allowed opacity-60`),children:[(0,Q.jsx)(`input`,{type:`radio`,name:a,value:e.login,checked:r===e.login,disabled:!n,onChange:()=>i(e.login),className:`sr-only`}),e.avatarUrl?(0,Q.jsx)(`img`,{src:e.avatarUrl,alt:``,className:`size-8 shrink-0 rounded-full object-cover`}):(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-8 shrink-0 place-items-center rounded-full bg-muted text-xs font-medium uppercase`,children:e.login.slice(0,1)}),(0,Q.jsxs)(`span`,{className:`grid min-w-0`,children:[(0,Q.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.login}),(0,Q.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.personal?`Personal account`:e.description??`Organization`})]})]},e.login)):(0,Q.jsxs)(`p`,{"data-slot":`create-project-github-unavailable`,className:`rounded-md border border-border bg-muted p-3 text-xs text-muted-foreground break-words`,children:[t,`. Local projects still work.`]})]})}function Eh({triggerClassName:e,icon:t=Pi,iconClassName:n=`size-4`,side:r,origin:i,label:a,iconFrameClassName:o}={}){let[s,c]=Z.useState(!1),[l,u]=Z.useState(!1),[d,f]=Z.useState(!1);return(0,Q.jsxs)(No,{children:[(0,Q.jsx)(Ao,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`ghost`,"aria-label":`Add project`,title:`Add project`,"data-origin":i,className:C(`size-9 p-0 text-muted-foreground`,e),children:[o?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:o,children:(0,Q.jsx)(t,{className:n,"aria-hidden":`true`})}):(0,Q.jsx)(t,{className:n,"aria-hidden":`true`}),a?(0,Q.jsx)(`span`,{children:a}):(0,Q.jsx)(`span`,{className:`sr-only`,children:`Add project`})]})}),(0,Q.jsxs)(jo,{align:`start`,...g({side:r}),className:`w-56`,children:[(0,Q.jsx)(yo,{className:`text-xs text-soft-foreground`,children:`Add project`}),(0,Q.jsxs)(Eo,{"data-slot":`add-project-new`,onSelect:()=>f(!0),children:[(0,Q.jsx)(Pi,{"aria-hidden":`true`}),`New project…`]}),(0,Q.jsxs)(Eo,{"data-slot":`add-project-local`,onSelect:()=>c(!0),children:[(0,Q.jsx)(Gi,{"aria-hidden":`true`}),`Open local folder…`]}),(0,Q.jsxs)(Eo,{"data-slot":`add-project-clone`,onSelect:()=>u(!0),children:[(0,Q.jsx)(Ri,{"aria-hidden":`true`}),`Clone from GitHub…`]})]}),s?(0,Q.jsx)(th,{open:!0,onOpenChange:c}):null,l?(0,Q.jsx)(oh,{open:!0,onOpenChange:u}):null,d?(0,Q.jsx)(Ch,{open:!0,onOpenChange:f}):null]})}function Dh(e,t){return typeof t==`string`&&Object.hasOwn(e,t)?e[t]:void 0}var Oh={folder:Su,terminal:qu,vscode:su,cursor:Fu,zed:Zu,windsurf:Yu,sublime:_u,idea:pu,pycharm:Ou,webstorm:Tu,goland:Wu,rubymine:Cu,phpstorm:Zl,clion:fu,rider:Xl,"android-studio":Gu,xcode:Du,warp:Vu,bot:Yl,sparkles:Ku};function kh(e,t){let n=Ah(e.id);return Dh(Oh,n===void 0?e.icon:Di(t,n)?.icon)??hi}function Ah(e){let t=e.startsWith(`cli:`)?e.slice(4):``;return t===``?void 0:t}function jh({choices:e,onPick:t,label:n=`Open in…`,title:r,triggerVariant:i=`ghost`,disabled:a=!1,leading:o,trailing:s,slot:c,className:l}){let u=Oi().data;return(0,Q.jsxs)(No,{children:[(0,Q.jsx)(Ao,{asChild:!0,children:(0,Q.jsxs)(k,{variant:i,size:`sm`,title:r,disabled:a,"data-slot":c,className:l,children:[(0,Q.jsx)(hi,{"aria-hidden":`true`}),n]})}),(0,Q.jsxs)(jo,{align:`end`,children:[o,o&&e.length>0?(0,Q.jsx)(Do,{}):null,e.map(({target:e,suffix:n,title:r})=>{let i=kh(e,u);return(0,Q.jsxs)(Eo,{"data-target":e.id,title:r,onSelect:()=>t(e.id),children:[(0,Q.jsx)(i,{"aria-hidden":`true`}),e.label,n??``]},e.id)}),s]})]})}var Mh=[`done`,`failed`,`cancelled`];function Nh(e){return Mh.includes(e)}function Ph(e){return!St(e)&&Nh(e.status)&&!Zr(e)}function Fh(e){return e.reduce((e,t)=>zr(t)||!Zr(t)?e:e+1,0)}function Ih(e){return e.status===`failed`?`danger`:`success`}var Lh={needsYou:0,failedUnread:0,inMotion:0,finishedUnread:0};function Rh(e){let t={...Lh};for(let n of e)n.archived||zr(n)||(Ee(n)?t.needsYou+=1:Ce(n).tone===`running`?t.inMotion+=1:Zr(n)&&(n.status===`failed`?t.failedUnread+=1:n.status===`done`&&(t.finishedUnread+=1)));return t}function zh(e){let t=new Map;for(let n of e){let e=t.get(n.projectId);e?e.push(n):t.set(n.projectId,[n])}return new Map([...t].map(([e,t])=>[e,Rh(t)]))}function Bh(e,t,n={}){if(n.unknown)return`${e} · activity unknown`;let r=Vh(t).map(e=>e.text);return[e,r.length>0?r.join(` · `):`idle`].join(` · `)}function Vh(e){let{needsYou:t,failedUnread:n,inMotion:r,finishedUnread:i}=e??Lh,a=[];return t>0&&a.push({tone:`amber`,text:`${t} needs you`}),n>0&&a.push({tone:`red`,text:`${n} failed`}),r>0&&a.push({tone:`violet`,text:`${r} working`}),i>0&&a.push({tone:`green`,text:`${i} finished`}),a}function Hh(e){let t={...Lh};for(let n of e)n&&(t.needsYou+=n.needsYou,t.failedUnread+=n.failedUnread,t.inMotion+=n.inMotion,t.finishedUnread+=n.finishedUnread);return t}function Uh(e){let t=e.split(/[-_ .]+/).filter(e=>e!==``);return(t.length>=2?[t[0],t[1]].map(e=>[...e][0]):[...t[0]??``].slice(0,2)).join(``).toLowerCase()}var Wh=`w-[228px] rounded-[10px] border-border bg-sidebar p-[5px] text-foreground shadow-[0_10px_28px_#00000047] motion-reduce:animate-none`,Gh=`h-8 gap-2.5 rounded-[6px] px-[9px] py-0 text-[13px] focus:bg-sidebar-row-hover focus:text-foreground [&_svg]:size-[15px] [&_svg]:text-soft-foreground focus:[&_svg]:text-foreground max-md:min-h-11`;function Kh(){let e=Ss(),t=En(),n=bn(),r=n.data?.bootProject??t.data?.bootProject,i=e??r??null,a=n.data?.projects.find(e=>e.id===i),o=i===r?t.data?.repo:void 0,s=a?.root??o?.root;return{health:t,registry:n,projectId:i,project:a,root:s,name:a?.name??s?.split(/[\\/]/).filter(Boolean).at(-1),branch:o?.branch??a?.branch}}function qh({onNavigate:e}={}){let t=(0,Z.useRef)(null),n=(0,Z.useRef)(null),[r,i]=(0,Z.useState)(0),{health:a,registry:o,projectId:s,root:c,name:l,branch:u}=Kh(),d=a.data?.capabilities.localHandoff===!0,f=l??(o.isPending?`Loading project…`:`Project unavailable`),p=[d?c:void 0,u].filter(Boolean).join(` · `);return(0,Q.jsxs)(`div`,{"data-slot":`project-header`,className:`flex min-w-0 items-center gap-2.5 px-[14px] pt-[14px] pb-2.5`,children:[(0,Q.jsx)(`span`,{ref:t,"aria-hidden":`true`,"data-slot":`project-header-mark`,className:`flex size-7 shrink-0 items-center justify-center rounded-[7px] border border-soft-foreground bg-sidebar-row-selected text-[11px] leading-none font-semibold text-foreground`,children:l?Uh(l):`…`}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-px`,children:[(0,Q.jsx)(`div`,{"data-slot":`project-header-name`,className:`truncate text-[14px] font-semibold text-foreground`,title:f,children:f}),(0,Q.jsx)(`div`,{"data-slot":`project-header-detail`,dir:`rtl`,className:`truncate text-left font-mono text-[10.5px] text-soft-foreground`,title:p||void 0,children:(0,Q.jsx)(`bdi`,{dir:`ltr`,children:p||(o.isPending?`Loading…`:`Branch unavailable`)})})]}),(0,Q.jsx)(Qh,{projectId:s,onNavigate:e,triggerRef:n,triggerClassName:`size-7 max-md:size-11`,align:`start`,alignOffset:r,onOpenChange:e=>{e&&t.current&&n.current&&i(t.current.getBoundingClientRect().left-n.current.getBoundingClientRect().left)}})]})}function Jh(e,t,n){let r=e.data?.bootProject??t.data?.bootProject,i=e.data?.projects.find(e=>e.id===n),a=n===r?t.data?.repo:void 0;return{bootId:r,project:i,root:i?.root??a?.root}}function Yh({marking:e,runs:t,unread:n,projectId:r}){return e||t.isError||t.data===void 0||n.length===0||r===null}function Xh({marking:e,runs:t,unread:n}){return e?`Marking…`:t.isError?`Unavailable`:t.data===void 0?`Loading…`:`${n.length} unread`}function Zh(e,t){return!e||t?.status===`missing`}function Qh({projectId:e,onNavigate:t,triggerRef:n,triggerClassName:r,align:i=`start`,alignOffset:a,side:o,onOpenChange:s}){let c=od(),l=En(),u=bn(),[d,f]=(0,Z.useState)(!1),{bootId:p,project:m,root:h}=Jh(u,l,e),_=gn(e??`default`,e!==null,e===p),v=jn(fr({projectId:e??`default`,boot:e===p})),y=(0,Z.useRef)(e);y.current=e;let b=l.data?.capabilities.localHandoff===!0,x=(_.data??[]).filter(e=>!zr(e)&&Zr(e));async function S(){f(!0);let t=0;try{for(let n of x){if(y.current!==e)break;try{await v.mutateAsync(n.id)}catch{t+=1}}t>0&&G(`Could not mark ${t} task${t===1?``:`s`} read. Try again.`,{tone:`danger`})}finally{f(!1)}}async function w(){if(h)try{await navigator.clipboard.writeText(h),G(`Project folder copied`)}catch{G(`Could not copy path: ${h}`,{tone:`danger`})}}return(0,Q.jsxs)(No,{...g({onOpenChange:s}),children:[(0,Q.jsx)(Ao,{asChild:!0,children:(0,Q.jsx)(`button`,{"data-slot":`project-menu-trigger`,ref:n,type:`button`,"aria-label":`Project menu`,className:C(`flex shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-[state=open]:bg-sidebar-row-selected data-[state=open]:text-foreground`,r),children:(0,Q.jsx)(hu,{"aria-hidden":`true`,className:`size-[15px]`})})}),(0,Q.jsxs)(jo,{align:i,...g({alignOffset:a,side:o}),sideOffset:4,className:Wh,children:[(0,Q.jsxs)(Eo,{className:Gh,disabled:Yh({marking:d,runs:_,unread:x,projectId:e}),onSelect:()=>{S()},children:[(0,Q.jsx)($l,{"aria-hidden":`true`}),` Mark all read`,(0,Q.jsx)(`span`,{className:`ml-auto text-[11.5px] text-soft-foreground`,children:Xh({marking:d,runs:_,unread:x})})]}),(0,Q.jsx)(Do,{className:`mx-0`}),b&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($h,{projectId:e??`default`,disabled:Zh(h,m)}),(0,Q.jsxs)(Eo,{className:Gh,disabled:!h,onSelect:()=>{w()},children:[(0,Q.jsx)(uu,{"aria-hidden":`true`}),` Copy path`]}),(0,Q.jsx)(Do,{className:`mx-0`})]}),(0,Q.jsx)(Eo,{asChild:!0,className:Gh,children:(0,Q.jsxs)(Y,{to:`/settings`,onClick:t??c,children:[(0,Q.jsx)(Uu,{"aria-hidden":`true`}),` Project settings`]})})]})]})}function $h({disabled:e,projectId:t}){let n=wn(),r=H({mutationFn:e=>ye(e,t),onError:e=>G(e.message,{tone:`danger`}),onSuccess:()=>G(`Opening project folder`)}),i=(n.data?.targets??[]).filter(e=>Ah(e.id)===void 0);return(0,Q.jsxs)(Po,{children:[(0,Q.jsxs)(Co,{className:Gh,disabled:e||r.isPending,children:[(0,Q.jsx)(hi,{"aria-hidden":`true`}),` Open in`]}),(0,Q.jsx)(ko,{children:(0,Q.jsxs)(So,{className:Wh,children:[i.map(e=>{let t=kh(e);return(0,Q.jsxs)(Eo,{className:Gh,"data-target":e.id,onSelect:()=>r.mutate(e.id),children:[(0,Q.jsx)(t,{"aria-hidden":`true`}),e.label]},e.id)}),i.length===0&&(0,Q.jsx)(Eo,{className:Gh,disabled:!0,children:n.isError?`Apps unavailable`:n.isPending?`Loading apps…`:`No apps available`})]})})]})}var eg={amber:`text-signal-word-amber`,red:`text-signal-word-red`,violet:`text-status-running`,green:`text-success`};function tg({signal:e,known:t,current:n,maxParts:r,slot:i,className:a}){let o=Vh(e).slice(0,r);return(0,Q.jsx)(`span`,{"data-slot":i,className:C(`flex min-w-0 items-center font-medium`,n?`text-muted-foreground`:`text-soft-foreground`,a),children:t?o.length===0?`idle`:o.map((e,t)=>(0,Q.jsxs)(`span`,{className:`flex items-center gap-x-[inherit]`,children:[t>0?(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,(0,Q.jsx)(`span`,{"data-tone":e.tone,className:eg[e.tone],children:e.text})]},e.tone)):`activity unknown`})}var ng=h(`inline-block shrink-0`,{variants:{tone:{success:``,pending:``,danger:``,accent:``,info:``,running:``,neutral:``},shape:{filled:`size-[7px] rounded-full`,ring:`size-[7px] rounded-full border-[1.5px] bg-transparent`,workers:`inline-flex size-[12px] items-center justify-center`},pulse:{true:`animate-pulse motion-reduce:animate-none`,false:``}},compoundVariants:[{shape:`filled`,tone:`success`,className:`bg-success`},{shape:`filled`,tone:`pending`,className:`bg-pending-strong`},{shape:`filled`,tone:`danger`,className:`bg-danger`},{shape:`filled`,tone:`accent`,className:`bg-accent-strong`},{shape:`filled`,tone:`info`,className:`bg-info`},{shape:`filled`,tone:`running`,className:`bg-status-running`},{shape:`filled`,tone:`neutral`,className:`bg-soft-foreground`},{shape:`ring`,tone:`success`,className:`border-success`},{shape:`ring`,tone:`pending`,className:`border-pending-strong`},{shape:`ring`,tone:`danger`,className:`border-danger`},{shape:`ring`,tone:`accent`,className:`border-accent-strong`},{shape:`ring`,tone:`info`,className:`border-info`},{shape:`ring`,tone:`running`,className:`border-status-running`},{shape:`ring`,tone:`neutral`,className:`border-soft-foreground`},{shape:`workers`,tone:`success`,className:`text-success`},{shape:`workers`,tone:`pending`,className:`text-pending-strong`},{shape:`workers`,tone:`danger`,className:`text-danger`},{shape:`workers`,tone:`accent`,className:`text-accent-icon`},{shape:`workers`,tone:`info`,className:`text-info`},{shape:`workers`,tone:`running`,className:`text-status-running`},{shape:`workers`,tone:`neutral`,className:`text-soft-foreground`}],defaultVariants:{tone:`neutral`,shape:`filled`,pulse:!1}});function $({className:e,tone:t=`neutral`,shape:n=`filled`,pulse:r=!1,...i}){return(0,Q.jsx)(`span`,{"data-slot":`status-dot`,"data-tone":t,"data-shape":n,"data-pulse":r?`true`:void 0,className:C(ng({tone:t,shape:n,pulse:r,className:e})),...i,children:n===`workers`?(0,Q.jsx)(Yl,{className:`size-[12px]`,"aria-hidden":`true`}):null})}function rg(e,t){let n=e=>e.split(`.`).slice(0,3).map(e=>Number.parseInt(e,10)||0),r=n(e),i=n(t);for(let e=0;e<3;e++){let t=(r[e]??0)-(i[e]??0);if(t!==0)return t>0}return!1}var ig={amber:`bg-pending text-signal-ink-amber`,red:`bg-danger text-signal-ink`,violet:`bg-status-running text-signal-ink`,green:`bg-success text-signal-ink`};function ag(e,t,n){return e>9&&!(n&&t>1)?22:t===1?18:14}function og({position:e,segments:t,className:n,compact:r=!1}){let i=t.filter(e=>e.count>0);return i.length===0?null:(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`rail-pill-${e}`,className:C(`pointer-events-none absolute -right-[4px] box-border flex h-[17px] overflow-hidden rounded-[9px] border-2 border-background`,e===`top`?`-top-[6px]`:`top-[25px]`,n),children:i.map(({tone:e,count:t})=>(0,Q.jsx)(`span`,{"data-segment":e,"data-count":t,style:{width:ag(t,i.length,r)},className:C(`flex items-center justify-center text-[10px] leading-[13px] font-bold tabular-nums`,ig[e]),children:t>9?`9+`:t},e))})}function sg(e){return{top:[{tone:`amber`,count:e?.needsYou??0},{tone:`red`,count:e?.failedUnread??0}],bottom:[{tone:`violet`,count:e?.inMotion??0},{tone:`green`,count:e?.finishedUnread??0}]}}var cg=`cez-theme`,lg=`(prefers-color-scheme: light)`,ug=`dark`;function dg(e){return e===`light`||e===`dark`||e===`system`?e:ug}function fg(e,t){return e===`light`||e===`system`&&t?`light`:`dark`}function pg(){try{return dg(localStorage.getItem(cg))}catch{return ug}}function mg(e){try{localStorage.setItem(cg,e)}catch{}}function hg(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(lg).matches}function gg(e,t){e.classList.toggle(`light`,t===`light`),e.style.colorScheme=t}function _g(e){return`/cezarion-mark-${e}.svg`}function vg(e){let t=document.querySelector(`link[rel="icon"]`);t&&(t.href=_g(e))}var yg=Z.createContext(null);function bg({children:e}){let[t,n]=Z.useState(pg),[r,i]=Z.useState(hg);Z.useEffect(()=>{let e=window.matchMedia?.(lg);if(!e)return;i(e.matches);let t=e=>i(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let a=fg(t,r);Z.useLayoutEffect(()=>{gg(document.documentElement,a),vg(a)},[a]);let o=Z.useCallback(e=>{n(e),mg(e)},[]),s=Z.useMemo(()=>({theme:t,resolvedTheme:a,setTheme:o}),[t,a,o]);return(0,Q.jsx)(yg.Provider,{value:s,children:e})}function xg(){let e=Z.useContext(yg);if(!e)throw Error(`Squawk: useTheme() must be called inside <ThemeProvider>`);return e}var Sg={light:`dark`,dark:`system`,system:`light`},Cg={light:`light`,dark:`dark`,system:`system`};function wg({className:e,showLabel:t=!1,labelClassName:n}){let{theme:r,setTheme:i}=xg(),a=Sg[r],o=va;return(0,Q.jsxs)(k,{type:`button`,variant:`ghost`,size:`icon-sm`,className:e,"data-slot":`theme-toggle`,"data-theme-pref":r,title:`Theme: ${Cg[r]}`,"aria-label":`Theme: ${Cg[r]}. Switch to ${Cg[a]}.`,onClick:()=>i(a),children:[(0,Q.jsx)(o,{"aria-hidden":`true`}),t?(0,Q.jsxs)(`span`,{className:n,children:[`Theme · `,r.charAt(0).toUpperCase()+r.slice(1)]}):null]})}function Tg({...e}){return(0,Q.jsx)(qo,{"data-slot":`sheet`,...e})}function Eg({...e}){return(0,Q.jsx)(Bo,{"data-slot":`sheet-trigger`,...e})}function Dg({...e}){return(0,Q.jsx)(Uo,{"data-slot":`sheet-close`,...e})}function Og({...e}){return(0,Q.jsx)(Wo,{"data-slot":`sheet-portal`,...e})}function kg({className:e,...t}){return(0,Q.jsx)(zo,{"data-slot":`sheet-overlay`,className:C(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Ag({className:e,children:t,side:n=`right`,showCloseButton:r=!0,overlayClassName:i,...a}){return(0,Q.jsxs)(Og,{children:[(0,Q.jsx)(kg,{className:i}),(0,Q.jsxs)(Go,{"data-slot":`sheet-content`,className:C(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition-colors ease-in-out motion-safe:data-[state=closed]:animate-out data-[state=closed]:duration-300 motion-safe:data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 end-0 h-full w-3/4 border-s motion-safe:data-[state=closed]:slide-out-to-right motion-safe:data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 start-0 h-full w-3/4 border-e motion-safe:data-[state=closed]:slide-out-to-left motion-safe:data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 inset-bs-0 h-auto border-be motion-safe:data-[state=closed]:slide-out-to-top motion-safe:data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 inset-be-0 h-auto border-bs motion-safe:data-[state=closed]:slide-out-to-bottom motion-safe:data-[state=open]:slide-in-from-bottom`,e),...a,children:[t,r&&(0,Q.jsxs)(Uo,{className:`absolute inset-bs-4 end-4 rounded-sm opacity-70 ring-offset-background transition-opacity pointer-hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,Q.jsx)(ra,{className:`size-4`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function jg({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`sheet-header`,className:C(`flex flex-col gap-1.5 p-4`,e),...t})}function Mg({className:e,...t}){return(0,Q.jsx)(Ko,{"data-slot":`sheet-title`,className:C(`font-semibold text-foreground`,e),...t})}function Ng({className:e,...t}){return(0,Q.jsx)(Vo,{"data-slot":`sheet-description`,className:C(`text-sm text-muted-foreground`,e),...t})}function Pg(e,t){if(!e?.signals)return null;let n=e.signals;return Hh(e.projects.filter(e=>e.id!==t).map(e=>n.get(e.id)))}function Fg(e){let t=Vh(e??void 0).map(e=>e.text);return t.length>0?`Open projects. Elsewhere: ${t.join(`, `)}`:`Open projects`}function Ig({elsewhere:e}){if(!e)return null;let{top:t,bottom:n}=sg(e),r=`right-[2px] border-card`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(og,{position:`top`,segments:t,compact:!0,className:C(r,`top-[3px]`)}),(0,Q.jsx)(og,{position:`bottom`,segments:n,compact:!0,className:C(r,`top-[24px]`)})]})}function Lg({version:e,latestVersion:t=null}){let{resolvedTheme:n}=xg(),r=!!(e&&t&&rg(t,e));return(0,Q.jsxs)(`div`,{"data-slot":`drawer-identity`,className:`flex shrink-0 items-center gap-[12px] border-b border-border pt-[env(safe-area-inset-top)] pr-[14px] pb-[14px] pl-[18px]`,children:[(0,Q.jsx)(`img`,{src:`/cezarion-mark-${n}.svg`,alt:``,"aria-hidden":`true`,className:`mt-[14px] size-[32px] rounded-lg`}),(0,Q.jsx)(`span`,{"data-slot":`drawer-wordmark`,className:`mt-[14px] text-[18px] leading-none font-bold tracking-[-0.02em] text-foreground`,children:`Squawk`}),e?(0,Q.jsxs)(`span`,{"data-slot":`drawer-version`,"data-update-available":r?`true`:void 0,title:r?`v${e} — update available: v${t}`:`v${e}`,className:`mt-[14px] min-w-0 truncate text-[11px] leading-none text-soft-foreground`,children:[r?(0,Q.jsx)($,{tone:`pending`,className:`mr-1 inline-block size-[5px] align-middle`}):null,`v`,e]}):null,(0,Q.jsx)(Dg,{asChild:!0,children:(0,Q.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`Close menu`,className:`mt-[14px] ml-auto size-[44px] text-foreground`,children:(0,Q.jsx)(ra,{className:`size-[19px]`,"aria-hidden":`true`})})})]})}function Rg({project:e,signal:t,known:n,current:r,onNavigate:i}){let{top:a,bottom:o}=sg(t),s=r?`border-sidebar-row-selected`:`border-sidebar`,c=`right-[-4px]`,l=(0,Q.jsxs)(E,{to:hs(e.id,`/`),onClick:i,"data-slot":`drawer-project`,"data-project-id":e.id,"aria-current":r?`page`:void 0,className:C(`flex h-[64px] min-w-0 items-center gap-[12px] rounded-[10px] px-[10px] text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r&&`flex-1 hover:bg-sidebar-row-selected`),children:[(0,Q.jsxs)(`span`,{"aria-hidden":`true`,className:C(`relative flex size-[40px] shrink-0 items-center justify-center rounded-[10px] border text-[13px] leading-none font-semibold`,r?`border-soft-foreground bg-sidebar text-foreground`:`border-transparent bg-muted text-muted-foreground`),children:[Uh(e.name),(0,Q.jsx)(og,{position:`top`,segments:a,className:C(c,s)}),(0,Q.jsx)(og,{position:`bottom`,segments:o,className:C(c,s,`top-[29px]`)})]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Q.jsx)(`span`,{className:`truncate text-[14.5px] leading-tight font-semibold`,children:e.name}),(0,Q.jsx)(tg,{signal:t,known:n,current:r,slot:`drawer-project-state`,className:`flex-wrap gap-x-[6px] text-[11.5px] leading-tight`})]}),r?(0,Q.jsx)(Qi,{"aria-hidden":`true`,className:`size-[16px] shrink-0 text-foreground`}):null]});return r?(0,Q.jsxs)(`div`,{"data-slot":`drawer-project-current`,className:`flex items-center rounded-[10px] bg-sidebar-row-selected pr-[4px]`,children:[l,(0,Q.jsx)(Qh,{projectId:e.id,onNavigate:i,triggerClassName:`size-[44px]`,align:`end`})]}):l}var zg=`flex h-[48px] w-full items-center gap-[12px] rounded-[10px] px-[10px] text-[14.5px] font-normal text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring [&_svg]:size-[18px] [&_svg]:shrink-0 [&_svg]:text-soft-foreground`;function Bg({nav:e,currentProjectId:t,onNavigate:n}){return(0,Q.jsxs)(`div`,{"data-slot":`drawer-projects`,className:`shrink-0`,children:[(0,Q.jsx)(`div`,{className:`px-[18px] pt-[14px] pb-[6px] text-[12px] font-medium text-soft-foreground`,id:`drawer-projects-label`,children:`Projects`}),(0,Q.jsx)(`div`,{role:`group`,"data-slot":`drawer-projects-group`,"aria-labelledby":`drawer-projects-label`,className:`flex flex-col gap-[2px] px-[8px] pb-[8px]`,children:e.projects.map(r=>(0,Q.jsx)(Rg,{project:r,signal:e.signals?.get(r.id),known:e.signals!==null,current:r.id===t,onNavigate:n},r.id))}),(0,Q.jsxs)(`div`,{"data-slot":`drawer-workspace`,className:`flex flex-col gap-[2px] border-t border-border px-[8px] py-[8px]`,children:[(0,Q.jsxs)(E,{to:`/tasks`,onClick:n,"data-slot":`drawer-all-projects`,className:zg,children:[(0,Q.jsx)(Da,{"aria-hidden":`true`}),`All projects · task overview`]}),(0,Q.jsx)(Eh,{origin:`mobile`,icon:Pi,iconClassName:`size-[18px]`,label:`Add project`,triggerClassName:C(zg,`h-[48px] justify-start p-0 px-[10px] text-foreground`)})]})]})}function Vg({onNavigate:e,tools:t}){let{theme:n,setTheme:r}=xg(),i=Sg[n],a=n.charAt(0).toUpperCase()+n.slice(1);return(0,Q.jsxs)(`div`,{"data-slot":`drawer-global`,className:`flex shrink-0 flex-col gap-[2px] border-t border-border px-[8px] pt-[8px] pb-[max(8px,env(safe-area-inset-bottom))]`,children:[t?(0,Q.jsxs)(E,{to:`/tools`,onClick:e,"data-slot":`drawer-tools`,"aria-label":t.blocked?`Tools, needs setup`:void 0,"aria-describedby":t.blocked&&t.note?`drawer-tools-note`:void 0,className:C(zg,t.note&&`h-auto min-h-[48px] py-[6px]`),children:[(0,Q.jsxs)(`span`,{className:`relative flex shrink-0`,children:[(0,Q.jsx)(ta,{"aria-hidden":`true`}),t.blocked?(0,Q.jsx)($,{tone:`pending`,"data-slot":`drawer-tools-dot`,className:`absolute -top-[2px] -right-[3px] ring-[1.5px] ring-sidebar`}):null]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`span`,{children:`Tools`}),t.note?(0,Q.jsx)(`span`,{id:`drawer-tools-note`,"data-slot":`drawer-tools-note`,className:`text-[11.5px] leading-tight text-soft-foreground`,children:t.note}):null]})]}):null,(0,Q.jsxs)(E,{to:`/settings/global/appearance`,onClick:e,"data-slot":`drawer-global-settings`,className:zg,children:[(0,Q.jsx)(Zi,{"aria-hidden":`true`}),`Global settings`]}),(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`theme-toggle`,"data-theme-pref":n,"aria-label":`Theme: ${n.toLowerCase()}. Switch to ${i}.`,onClick:()=>r(i),className:zg,children:[(0,Q.jsx)(va,{"aria-hidden":`true`}),`Theme · `,a]})]})}function Hg(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function Ug(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function Wg(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Hg(e.target)&&!Ug(e.target))}function Gg(e,t){let n=Z.useRef(t);Z.useLayoutEffect(()=>{n.current=t}),Z.useEffect(()=>{let t=t=>{Wg(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function Kg(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Hg(e.target))}function qg(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function Jg(e,t){let n=Z.useRef(t);Z.useLayoutEffect(()=>{n.current=t}),Z.useEffect(()=>{let t=t=>{Kg(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}var Yg=Z.createContext(null);function Xg(){return Z.useContext(Yg)}function Zg({slot:e,children:t}){return(0,sf.createPortal)(t,e)}var Qg=`(min-width: 768px)`;function $g(){let[e,t]=Z.useState(()=>window.matchMedia?.(Qg).matches??!0);return Z.useEffect(()=>{let e=window.matchMedia?.(Qg);if(!e)return;let n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function e_({delayDuration:e=0,...t}){return(0,Q.jsx)(Vm,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function t_({...e}){return(0,Q.jsx)(Hm,{"data-slot":`tooltip`,...e})}function n_({...e}){return(0,Q.jsx)(Um,{"data-slot":`tooltip-trigger`,...e})}function r_({className:e,sideOffset:t=0,children:n,...r}){return(0,Q.jsx)(Wm,{children:(0,Q.jsxs)(Gm,{"data-slot":`tooltip-content`,sideOffset:t,className:C(`z-50 w-fit origin-(--radix-tooltip-content-transform-origin) motion-safe:animate-in rounded-md bg-contrast px-3 py-1.5 text-xs text-balance text-contrast-foreground fade-in-0 motion-safe:zoom-in-95 motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95`,e),...r,children:[n,(0,Q.jsx)(Km,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-contrast fill-contrast`})]})})}var i_=[`/git`,`/automations`,`/workflows`,`/reports`];function a_({items:e,activeTo:t,needsYou:n=!1,onNavigate:r}){let[i,a]=(0,Z.useState)(!1),o=(0,Z.useRef)(null),s=e.filter(e=>i_.includes(e.to)),c=e.filter(e=>!s.includes(e)),l=s.some(e=>e.to===t);return(0,Q.jsx)(e_,{children:(0,Q.jsxs)(`nav`,{ref:o,"aria-label":`Main`,"data-slot":`view-tabs`,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;let t=Array.from(o.current?.querySelectorAll(`[data-view-tab]`)??[]),n=t.indexOf(document.activeElement);n<0||(e.preventDefault(),t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowRight`?1:-1)+t.length)%t.length]?.focus())},className:`flex shrink-0 items-center justify-between max-md:justify-start max-md:gap-1 max-md:overflow-x-auto border-b border-border px-3 pt-2.5 pb-2`,children:[c.map(e=>{let i=e.to===t,a=e.icon,o=e.to===`/`&&n&&!i;return(0,Q.jsxs)(t_,{children:[(0,Q.jsx)(n_,{asChild:!0,children:(0,Q.jsxs)(Y,{to:e.to,onClick:r,"data-view-tab":!0,"aria-label":e.label,"aria-current":i?`page`:void 0,className:C(`relative flex h-[30px] min-w-0 items-center justify-center rounded-[7px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11`,i?`shrink-0 gap-1.5 bg-sidebar-row-selected px-[9px] text-[12px] font-semibold text-foreground`:`w-7 shrink-0`),children:[(0,Q.jsxs)(`span`,{className:`relative`,children:[(0,Q.jsx)(a,{className:`size-[15px] shrink-0`,"aria-hidden":`true`}),o?(0,Q.jsx)(`span`,{"aria-label":`Tasks need you`,"data-slot":`nav-needs-you-dot`,className:`absolute -top-1 -right-1 size-[7px] rounded-full border-[1.5px] border-sidebar bg-pending-strong`}):null]}),i?(0,Q.jsx)(`span`,{className:`truncate`,children:e.label}):null]})}),(0,Q.jsx)(r_,{side:`bottom`,sideOffset:6,style:{pointerEvents:`none`},children:e.label})]},e.to)}),s.length?(0,Q.jsxs)(No,{open:i,onOpenChange:a,children:[(0,Q.jsxs)(t_,{children:[(0,Q.jsx)(n_,{asChild:!0,children:(0,Q.jsx)(Ao,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"data-view-tab":!0,"aria-label":`More views`,"data-active":l?`true`:void 0,className:C(`relative flex h-[30px] w-7 shrink-0 items-center justify-center rounded-[7px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11`,(i||l)&&`bg-sidebar-row-selected text-foreground`),children:(0,Q.jsx)(hu,{className:`size-[15px]`,"aria-hidden":`true`})})})}),(0,Q.jsx)(r_,{side:`bottom`,sideOffset:6,style:{pointerEvents:`none`},children:`More views`})]}),(0,Q.jsx)(jo,{align:`end`,sideOffset:4,className:`w-48 rounded-[10px] border-border bg-sidebar p-[5px] shadow-[0_10px_28px_#00000047]`,children:s.map(e=>{let n=e.icon,i=e.to===t;return(0,Q.jsx)(Eo,{asChild:!0,className:C(`h-8 max-md:min-h-11 gap-2.5 rounded-md px-[9px] text-[13px] text-foreground focus:bg-sidebar-row-hover`,i&&`bg-sidebar-row-selected font-medium`),children:(0,Q.jsxs)(Y,{to:e.to,onClick:r,"aria-current":i?`page`:void 0,children:[(0,Q.jsx)(n,{className:`size-[15px] text-soft-foreground`}),e.label]})},e.to)})})]}):null]})})}var o_=[{to:`/`,label:`Tasks`,icon:Mi,match:[`/`,`/tasks`],badge:`tasks-unread`},{to:`/activity`,label:`Activity`,icon:ql,match:[`/activity`]},{to:`/git`,label:`Git`,icon:ji,match:[`/git`]},{to:`/github`,label:`GitHub`,icon:Ri,match:[`/github`],forge:!0},{to:`/automations`,label:`Automations`,icon:ga,match:[`/automations`],automations:!0},{to:`/skills`,label:`Skills`,icon:xa,match:[`/skills`]},{to:`/workflows`,label:`Workflows`,icon:Ca,match:[`/workflows`]},{to:`/reports`,label:`Reports`,icon:yu,match:[`/reports`]},{to:`/settings`,label:`Settings`,icon:Ui,match:[`/settings`]}];function s_({forge:e=!1,automations:t=!1}={}){return o_.filter(n=>(!n.forge||e)&&(!n.automations||t))}function c_(e,t){return t===`/`?e===`/`:e===t||e.startsWith(t+`/`)}function l_(e){let t=null;for(let n of o_)for(let r of n.match)c_(e,r)&&(t===null||r.length>t.length)&&(t={to:n.to,length:r.length});return t?.to??null}function u_(e){let t=l_(e);return o_.find(e=>e.to===t)??null}function d_(e){return/^\/tasks\/[^/]+(?:\/|$)/.test(bs(e))}function f_(e,t){let n=bs(e);return/^\/git\/?$/.test(n)?new URLSearchParams(t).get(`view`)===`repo`:n.startsWith(`/git/`)}var p_=[`/`,`/activity`,`/github`],m_=[`/git`,`/skills`,`/workflows`,`/reports`,`/settings`,`/automations`];function h_(e,t,n){let r=bs(e),i=r===`/new`,a=d_(e);return{activeTo:i?`/new`:l_(r),current:u_(r),currentProjectId:_s(e),newTask:i,pushed:a,showTabBar:!a&&!f_(e,t)&&!n,gitRepositoryView:r===`/git`&&new URLSearchParams(t).get(`view`)===`repo`}}var g_=[{to:`/git`,label:`Git`},{to:`/skills`,label:`Skills`},{to:`/workflows`,label:`Workflows`},{to:`/reports`,label:`Reports`},{to:`/settings`,label:`Project settings`}],__=[`/automations`],v_=`flex h-[50px] min-h-11 w-full items-center gap-[14px] rounded-[10px] px-[10px] text-[14.5px] text-foreground hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:outline-ring [&_svg]:size-[18px] [&_svg]:shrink-0 [&_svg]:text-muted-foreground`;function y_({open:e,onOpenChange:t,onCloseAutoFocus:n,projectName:r,items:i,activeTo:a}){let o=new Map(i.map(e=>[e.to,e])),s=g_.flatMap(({to:e,label:t})=>{let n=o.get(e);return n?[{to:e,label:t,icon:n.icon}]:[]}),c=__.flatMap(e=>{let t=o.get(e);return t?[{to:e,label:t.label,icon:t.icon}]:[]}),l=()=>t(!1),u=({to:e,label:t,icon:n})=>{let r=e===a;return(0,Q.jsxs)(Y,{to:e,onClick:l,"data-slot":`more-row`,"data-more-row":e,"aria-current":r?`page`:void 0,className:C(v_,r&&`bg-sidebar-row-selected hover:bg-sidebar-row-selected`),children:[(0,Q.jsx)(n,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),(0,Q.jsx)(Sa,{"aria-hidden":`true`,className:`!size-[15px]`})]},e)};return(0,Q.jsx)(Tg,{open:e,onOpenChange:t,children:(0,Q.jsxs)(Ag,{side:`bottom`,"data-slot":`more-sheet`,showCloseButton:!1,onCloseAutoFocus:n,"aria-describedby":void 0,className:`gap-0 rounded-t-[20px] border-border bg-sidebar px-[14px] pt-[10px] pb-[max(14px,env(safe-area-inset-bottom))] md:hidden`,children:[(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`mx-auto mb-[14px] h-[5px] w-[36px] rounded-[3px] bg-border`}),(0,Q.jsxs)(`div`,{className:`flex items-baseline gap-[10px] px-[10px] pb-[6px]`,children:[(0,Q.jsx)(Mg,{className:`text-[17px] leading-tight font-bold`,children:`More`}),r?(0,Q.jsx)(`span`,{"data-slot":`more-project`,className:`min-w-0 truncate text-[12.5px] text-soft-foreground`,children:r}):null]}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-[2px]`,children:s.map(u)}),c.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{role:`separator`,className:`mx-[10px] mt-[8px] border-t border-border`}),(0,Q.jsx)(`div`,{className:`px-[10px] pt-[12px] pb-[4px] text-[12px] font-medium text-soft-foreground`,children:`Shown when their flag is on`}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-[2px]`,children:c.map(u)})]}):null]})})}var b_=`(min-width: 768px)`;function x_({items:e,activeTo:t,signal:n,projectName:r,showNewTask:i=!0}){let[o,s]=Z.useState(!1),c=Z.useRef(null),{pathname:l}=a();Z.useEffect(()=>{s(!1)},[l]),Z.useEffect(()=>{let e=window.matchMedia?.(b_);if(!e)return;e.matches&&s(!1);let t=e=>{e.matches&&s(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let u=e.filter(e=>p_.includes(e.to)),d=t!==null&&m_.includes(t),{top:f}=sg(n),p=f.some(e=>e.count>0),m=e=>C(`relative flex h-full min-h-11 min-w-11 flex-1 flex-col items-center justify-center gap-[3px] text-[10.5px] leading-none focus-visible:outline-2 focus-visible:outline-ring`,e?`font-semibold text-foreground`:`font-medium text-soft-foreground`);return(0,Q.jsxs)(Q.Fragment,{children:[i?(0,Q.jsxs)(Y,{to:`/new`,"data-slot":`mobile-new-task`,className:`group-has-[[data-new-task-action]]/shell:hidden absolute right-4 bottom-full z-30 mb-4 flex h-12 items-center gap-2 rounded-[24px] bg-foreground px-[18px] text-[14px] font-semibold text-background shadow-[0_8px_24px_#00000055] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(zi,{"aria-hidden":`true`,className:`size-[18px]`}),`New task`]}):null,(0,Q.jsxs)(`nav`,{"aria-label":`Views`,"data-slot":`mobile-tab-bar`,className:`flex h-[54px] items-stretch`,children:[u.map(e=>{let n=e.to===t,r=e.icon,i=e.to===`/`&&p;return(0,Q.jsxs)(Y,{to:e.to,"data-tab":e.to,"aria-current":n?`page`:void 0,className:m(n),children:[(0,Q.jsxs)(`span`,{className:`relative`,children:[(0,Q.jsx)(r,{"aria-hidden":`true`,className:`size-[21px]`}),i?(0,Q.jsx)(og,{position:`top`,segments:f,className:`-top-[6px] -right-[10px] border-sidebar`}):null]}),e.label]},e.to)}),(0,Q.jsxs)(`button`,{ref:c,type:`button`,"data-tab":`more`,"aria-haspopup":`dialog`,"aria-expanded":o,"data-active":d?`true`:void 0,onClick:()=>s(!0),className:m(d),children:[(0,Q.jsx)(`span`,{className:`relative`,children:(0,Q.jsx)(Ta,{"aria-hidden":`true`,className:`size-[21px]`})}),`More`]})]}),(0,Q.jsx)(y_,{open:o,onOpenChange:s,onCloseAutoFocus:e=>{c.current?.isConnected&&(e.preventDefault(),c.current.focus())},projectName:r,items:e,activeTo:t})]})}var S_=`(min-width: 768px)`;function C_(e){return m({path:`/tasks/:id`,end:!0},bs(e))!==null}function w_(e){let t=bs(e);return t===`/github`||t.startsWith(`/github/`)}function T_({children:e,breadcrumb:t,repo:n=null,version:r=null,latestVersion:i=null,sidebarList:o,taskQuickList:s,sessionScope:c,toolsMenu:l,forgeAvailable:u=!0,automationsAvailable:f=!0,banner:p,mobileProjects:m,projectHeader:h,sidebarProjectId:g,needsYou:_,projectRail:v,toolsStatus:y}){let{pathname:b,search:x}=a(),{activeTo:S,current:w,currentProjectId:T,newTask:E,pushed:D,showTabBar:O,gitRepositoryView:k}=h_(b,x,jr()),[A,j]=Z.useState(!1),[M,ee]=Z.useState(null),te=Z.useRef(null),ne=Z.useRef(null),re=Z.useRef(null),ie=C_(b);Z.useLayoutEffect(()=>{let e=re.current;if(re.current=b,ie||e!==null&&_s(e)===_s(b)&&w_(e)&&w_(b))return;let t=ne.current;t&&(t.scrollTop=0)},[b,ie,k]);let N=d(),P=Z.useRef(b);Z.useEffect(()=>{let e=P.current;P.current=b,e!==b&&(N===`REPLACE`&&M_(e,b)||j(!1))},[b,N]),Z.useEffect(()=>{let e=window.matchMedia?.(S_);if(!e)return;e.matches&&j(!1);let t=e=>{e.matches&&j(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let F=s_({forge:u,automations:f}),ae={version:r,latestVersion:i};return(0,Q.jsx)(Tg,{open:A,onOpenChange:j,children:(0,Q.jsxs)(`div`,{"data-slot":`app-shell`,className:`flex h-dvh overflow-hidden bg-background text-foreground pl-[env(safe-area-inset-left)] pr-[env(safe-area-inset-right)]`,children:[(0,Q.jsx)(O_,{projectRail:v,activeTo:S,items:F,repo:n,release:ae,sidebarList:o,taskQuickList:s,sessionScope:c,toolsMenu:l,projectHeader:h,sidebarProjectId:g,needsYou:_}),(0,Q.jsx)(j_,{release:ae,taskQuickList:s,sidebarProjectId:g,mobileProjects:m,currentProjectId:T,toolsStatus:y,onNavigate:()=>j(!1),onCloseAutoFocus:e=>{te.current?.isConnected&&(e.preventDefault(),te.current.focus())}}),(0,Q.jsxs)(`div`,{className:`group/shell grid min-w-0 flex-1 grid-rows-[auto_auto_1fr_auto] overflow-hidden`,children:[(0,Q.jsx)(R_,{title:w?.label??`Squawk`,pushed:D?{onSlot:ee}:null,repo:n,elsewhere:Pg(m,T),onTrigger:e=>{te.current=e}}),(0,Q.jsx)(E_,{breadcrumb:t,repo:n,label:w?.label,newTask:E}),p?(0,Q.jsx)(`div`,{"data-slot":`banner-slot`,className:`row-start-2`,children:p}):null,(0,Q.jsx)(`main`,{ref:ne,"data-slot":`main`,className:C(`row-start-3 min-h-0 overflow-y-auto overscroll-contain`,O&&!E&&`max-md:pb-20`),children:(0,Q.jsx)(Yg.Provider,{value:D?M:null,children:e})}),(0,Q.jsx)(D_,{showTabBar:O,items:F,activeTo:S,mobileProjects:m,currentProjectId:T,repo:n,newTask:E})]})]})})}function E_({breadcrumb:e,repo:t,label:n,newTask:r}){let i=e?.project??t?.name,a=e?.branch??t?.branch;return(0,Q.jsxs)(`header`,{"data-slot":`desktop-breadcrumb`,className:C(`row-start-1 hidden min-w-0 items-center gap-3 border-b border-border text-[13px] text-muted-foreground md:flex`,r?`h-[72px] px-11`:`h-16 px-9`),children:[(0,Q.jsx)(Gi,{"aria-hidden":`true`,className:`size-4 shrink-0`}),i?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:i}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`/`})]}):null,(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:e?.page??n??`Squawk`}),a?(0,Q.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 text-[11px]`,children:[(0,Q.jsx)(Ai,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),a]}):null]})}function D_({showTabBar:e,items:t,activeTo:n,mobileProjects:r,currentProjectId:i,repo:a,newTask:o}){let s=i===null?void 0:r?.signals?.get(i);return(0,Q.jsx)(`div`,{"data-slot":`composer`,className:C(`row-start-4 pb-[max(env(safe-area-inset-bottom),var(--kb,0px))]`,e&&`relative max-md:border-t max-md:border-border max-md:bg-sidebar`),children:e?(0,Q.jsx)(`div`,{className:`md:hidden`,children:(0,Q.jsx)(x_,{items:t,activeTo:n,signal:s,projectName:r?.projects.find(e=>e.id===i)?.name??a?.name??null,showNewTask:!o})}):null})}function O_({projectRail:e,...t}){let[n,r]=Z.useState(nd),i=Z.useCallback(e=>{let t=td(e);r(t),rd(t)},[]);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(id.Provider,{value:n,children:e}),(0,Q.jsx)(k_,{...t,width:n,onWidthChange:i})]})}function k_({width:e,onWidthChange:t,...n}){return(0,Q.jsxs)(`aside`,{"data-slot":`sidebar`,style:{width:e},className:`relative hidden shrink-0 flex-col border-r border-border bg-sidebar md:flex`,children:[(0,Q.jsx)(P_,{...n}),(0,Q.jsx)(A_,{width:e,onWidthChange:t})]})}function A_({width:e,onWidthChange:t}){let n=Z.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(td(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,Q.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(td(r)))},onDoubleClick:()=>t(264),title:`Drag to resize the sidebar — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-[var(--composer-border)] focus-visible:bg-[var(--composer-border)] focus-visible:outline-none`})}function j_({onNavigate:e,onCloseAutoFocus:t,mobileProjects:n,currentProjectId:r,toolsStatus:i,release:a,taskQuickList:o,sidebarProjectId:s}){return(0,Q.jsxs)(Ag,{side:`left`,"data-slot":`mobile-nav-drawer`,onCloseAutoFocus:t,overlayClassName:`bg-[var(--nav-scrim)]`,showCloseButton:!1,className:`w-[calc(100%-68px)] max-w-[334px] gap-0 border-border bg-sidebar p-0 sm:max-w-[334px] md:hidden`,"aria-describedby":void 0,children:[(0,Q.jsx)(Mg,{className:`sr-only`,children:`Navigation`}),(0,Q.jsx)(Lg,{version:a.version,latestVersion:a.latestVersion}),(0,Q.jsxs)(`div`,{"data-slot":`drawer-scroll`,className:`flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,children:[n?(0,Q.jsx)(Bg,{nav:n,currentProjectId:r,onNavigate:e}):null,o?(0,Q.jsx)(N_,{projectId:s,onNavigate:e,children:(0,Q.jsx)(`div`,{"data-slot":`drawer-tasks`,className:`border-t border-border px-[8px] py-[8px]`,children:o})}):null]}),(0,Q.jsx)(Vg,{onNavigate:e,tools:i})]})}function M_(e,t){return _s(e)==="default"&&_s(t)!==null&&_s(t)!=="default"&&bs(e)===bs(t)}function N_({projectId:e,onNavigate:t,children:n}){let r=Mt(),i=e===void 0?r:{projectId:e,apiBase:`${l}/p/${encodeURIComponent(e)}`};return(0,Q.jsx)(It.Provider,{value:i,children:(0,Q.jsx)(ad.Provider,{value:t,children:n})})}function P_({activeTo:e,items:t,repo:n,release:r,sidebarList:i,taskQuickList:a,sessionScope:o,toolsMenu:s,projectHeader:c,sidebarProjectId:l,needsYou:u,onNavigate:d}){return(0,Q.jsx)(N_,{projectId:l,onNavigate:d,children:(0,Q.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,Q.jsx)(`div`,{"data-slot":`sidebar-header`,className:`shrink-0`,children:c??(n?(0,Q.jsxs)(`div`,{className:`px-[14px] pt-[14px] pb-2.5`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-semibold`,children:n.name}),(0,Q.jsx)(`div`,{className:`truncate font-mono text-[10.5px] text-soft-foreground`,children:n.branch})]}):null)}),(0,Q.jsxs)(`div`,{"data-slot":`sidebar-actions`,className:`flex flex-col gap-2 px-3`,children:[(0,Q.jsx)(I_,{}),(0,Q.jsx)(k,{asChild:!0,variant:`ghost`,className:C(`relative h-[32px] max-md:min-h-11 rounded-[7px] bg-muted w-full min-w-0 justify-start gap-2 px-2.5 text-[12.5px] font-medium text-foreground hover:bg-sidebar-row-hover hover:text-foreground`,e===`/new`&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:(0,Q.jsxs)(Y,{to:`/new`,onClick:d,"data-sidebar-item":`new-task`,"aria-current":e===`/new`?`page`:void 0,children:[(0,Q.jsx)(zi,{className:`size-[15px]`,"aria-hidden":`true`}),`New task`,(0,Q.jsx)(`kbd`,{"aria-hidden":`true`,className:`sr-only`,children:`C`})]})})]}),o?(0,Q.jsx)(`div`,{className:`shrink-0 px-3 pt-2`,children:o}):null,(0,Q.jsx)(a_,{items:t,activeTo:e,needsYou:u,onNavigate:d}),(0,Q.jsx)(`div`,{"data-slot":`project-task-navigation`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-3`,children:(0,Q.jsx)(ad.Provider,{value:d,children:i??(0,Q.jsx)(`div`,{"data-slot":`task-quick-list`,children:a})})}),(0,Q.jsx)(F_,{toolsMenu:s,release:r})]})})}function F_({toolsMenu:e,release:t}){return(0,Q.jsx)(`div`,{"data-slot":`sidebar-footer`,className:`shrink-0`,children:(0,Q.jsxs)(`div`,{"data-slot":`sidebar-footer-controls`,className:`flex h-11 items-center justify-between gap-1 border-t border-border px-3`,children:[(0,Q.jsx)(`div`,{"data-slot":`tools-menu`,className:`shrink-0`,children:e}),(0,Q.jsx)(`div`,{className:`flex min-w-0 items-center gap-1`,"data-slot":`version-action`,children:t.version?(0,Q.jsx)(L_,{version:t.version,latestVersion:t.latestVersion}):null})]})})}function I_(){return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`command-palette-hint`,title:`Search — command palette (⌘K / Ctrl+K)`,onClick:()=>$u(),className:`flex h-[32px] max-md:min-h-11 w-full items-center gap-2 rounded-[7px] border border-border bg-background px-2.5 text-left text-[12.5px] font-normal text-soft-foreground transition-colors hover:border-border hover:text-foreground`,children:[(0,Q.jsx)(Yi,{className:`size-[14px] shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:`Search…`}),(0,Q.jsx)(`kbd`,{"aria-hidden":`true`,className:`ml-auto shrink-0 font-sans text-[11px] font-normal text-soft-foreground`,children:qg(`k`)})]})}function L_({version:e,latestVersion:t}){let n=!!(t&&rg(t,e));return(0,Q.jsxs)(`span`,{"data-slot":`version-chip`,"data-update-available":n?`true`:void 0,title:n?`v${e} — update available: v${t}`:`v${e}`,className:`flex min-w-0 items-center gap-1 font-mono text-[11px] text-soft-foreground`,children:[n?(0,Q.jsx)($,{tone:`pending`,className:`size-[5px] shrink-0`}):null,(0,Q.jsxs)(`span`,{className:`truncate`,children:[`v`,e]})]})}function R_({title:e,pushed:t,repo:n,elsewhere:r,onTrigger:i}){return t?(0,Q.jsx)(z_,{onSlot:t.onSlot}):(0,Q.jsx)(`header`,{"data-slot":`mobile-top-bar`,className:`row-start-1 min-w-0 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,Q.jsxs)(`div`,{className:`flex h-[56px] min-w-0 items-center gap-[8px] px-[8px]`,children:[(0,Q.jsx)(Eg,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`ghost`,"aria-label":Fg(r),onClick:e=>i(e.currentTarget),className:`relative h-[44px] w-[64px] shrink-0 justify-start rounded-md p-0 pl-[10px] text-foreground`,children:[(0,Q.jsx)(qi,{className:`size-[20px]`,"aria-hidden":`true`}),(0,Q.jsx)(Ig,{elsewhere:r})]})}),n?(0,Q.jsx)(Eg,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`mobile-project-picker`,"aria-label":`Switch project: ${n.name}`,onClick:e=>i(e.currentTarget),className:`flex h-[44px] min-w-0 flex-1 items-center justify-start gap-[10px] rounded-md text-left focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-[28px] shrink-0 items-center justify-center rounded-[8px] border border-soft-foreground bg-sidebar-row-selected text-[11px] leading-none font-semibold text-foreground`,children:Uh(n.name)}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`span`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,children:n.name}),n.branch?(0,Q.jsx)(`span`,{className:`truncate font-mono text-[10.5px] leading-tight text-soft-foreground`,children:n.branch}):null]}),(0,Q.jsx)(ua,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`})]})}):null,e===`Squawk`?n?null:(0,Q.jsx)(`span`,{className:`flex-1`}):(0,Q.jsx)(`span`,{"data-slot":`mobile-route-title`,className:C(`truncate text-[15px] font-semibold text-foreground`,n?`sr-only`:`min-w-0 flex-1 pl-[8px]`),children:e}),(0,Q.jsx)(k,{variant:`ghost`,"aria-label":`Search`,"data-slot":`mobile-search`,onClick:()=>$u(),className:`ml-auto size-[44px] shrink-0 p-0 text-foreground`,children:(0,Q.jsx)(Yi,{className:`size-[19px]`,"aria-hidden":`true`})})]})})}function z_({onSlot:e}){let t=gs();return(0,Q.jsx)(`header`,{"data-slot":`mobile-top-bar`,"data-mode":`task`,className:`row-start-1 min-w-0 border-b border-border bg-card pt-[env(safe-area-inset-top)] md:hidden`,children:(0,Q.jsxs)(`div`,{className:`flex h-[56px] min-w-0 items-center gap-[4px] px-[8px]`,children:[(0,Q.jsx)(k,{variant:`ghost`,"aria-label":`Back`,"data-slot":`mobile-back`,onClick:()=>{let e=window.history.state?.idx;t(typeof e==`number`&&e>0?-1:`/`)},className:`size-[44px] shrink-0 p-0 text-foreground`,children:(0,Q.jsx)(tu,{className:`size-[22px]`,"aria-hidden":`true`})}),(0,Q.jsx)(`div`,{"data-slot":`mobile-run-bar`,ref:e,className:`flex min-w-0 flex-1 items-center gap-[4px]`})]})})}function B_(e,t){let n=typeof e==`string`?new URLSearchParams(e):e,r=n.get(`runner`),i=r!==null&&(t?.runners.some(e=>e.id===r)??!1),a=n.get(`skillPath`);return{skill:(n.get(`skill`)??``).trim(),...a?{skillPath:a}:{},...i?{runner:r}:{},...n.has(`account`)?{account:n.get(`account`)}:{},ref:(n.get(`ref`)??n.get(`task`)??``).trim()}}function V_(e){let t=new URLSearchParams;e.skill&&t.set(`skill`,e.skill),e.skillPath!==void 0&&t.set(`skillPath`,e.skillPath),e.runner&&t.set(`runner`,e.runner),e.account!==void 0&&t.set(`account`,e.account),e.ref&&t.set(`ref`,e.ref);let n=t.toString();return n?`/new?${n}`:`/new`}var H_=`cez-last-location`;function U_(){try{let e=localStorage.getItem(H_);return e===null?null:JSON.parse(e)}catch{return null}}function W_(e){try{localStorage.setItem(H_,JSON.stringify(e))}catch{}}var G_=new Set([`projectId`,`pathname`,`search`,`hash`]);function K_(e){return typeof e!=`string`||e.length<1||e.length>64?null:e}function q_(e){return typeof e!=`string`||e.length<1||e.length>2048||!e.startsWith(`/p/`)?null:e}function J_(e){return e!==void 0&&(typeof e!=`string`||e.length>4096||!e.startsWith(`?`))?null:e}function Y_(e){return e!==void 0&&(typeof e!=`string`||e.length>2048||!e.startsWith(`#`))?null:e}function X_(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(Object.keys(t).some(e=>!G_.has(e)))return null;let n=K_(t.projectId);if(n===null)return null;let r=q_(t.pathname);if(r===null)return null;let i=J_(t.search);if(i===null)return null;let a=Y_(t.hash);if(a===null)return null;try{if(_s(r)!==n)return null}catch{return null}return{projectId:n,pathname:r,...i===void 0?{}:{search:i},...a===void 0?{}:{hash:a}}}function Z_(e,t){let n=t.projects.find(t=>t.id===e);return n!==void 0&&n.status!==`missing`}function Q_(e,t){if(t===void 0)return null;let n;try{n=_s(e.pathname)}catch{return null}return n===null||!Z_(n,t)?null:X_({projectId:n,pathname:e.pathname,...e.search===``?{}:{search:e.search},...e.hash===``?{}:{hash:e.hash}})}function $_(e,t,n){let r=X_(e);return r===null||!(t===void 0?n!==void 0&&r.projectId===n:Z_(r.projectId,t))?null:`${r.pathname}${r.search??``}${r.hash??``}`}function ev(e,t){let n=X_(e);return n!==null&&n.projectId===t.projectId&&n.pathname===t.pathname&&(n.search??``)===(t.search??``)&&(n.hash??``)===(t.hash??``)}var tv=`cez-project-locations`;function nv(){try{let e=localStorage.getItem(tv),t=e===null?null:JSON.parse(e);return typeof t==`object`&&t&&!Array.isArray(t)?t:{}}catch{return{}}}function rv(e){let t=nv()[e];return t===void 0?null:t}function iv(e){try{localStorage.setItem(tv,JSON.stringify({...nv(),[e.projectId]:e}))}catch{}}function av(e,t,n){let r=X_(t);return r===null||r.projectId!==e||n===void 0||!Z_(e,n)?null:`${r.pathname}${r.search??``}${r.hash??``}`}var ov=2500,sv=e=>String(hs(e,`/`));function cv(e,t,n){let r={href:sv(e),verify:!1},i=av(e,t,n.registry);if(i===null)return r;try{let e=i.replace(/[?#].*$/,``),t=n.matchRoute(e);return t===null?r:{href:i,verify:Object.keys(t.params).some(e=>e!==`projectId`)}}catch{return r}}var lv=e=>yt(xn(e.params.id??``,{projectId:e.opts.projectId}),{signal:e.opts.signal});function uv(e){let t=Number(e);return Number.isSafeInteger(t)&&t>=1?t:null}async function dv(e,t,n){let r=await re(e,t,{},n.opts);return r.available?r.item!==null:null}var fv=async e=>(await lv(e),!0),pv=async e=>(await lv(e),await ut(e.params.id??``,e.params.sha??``,e.opts),!0);async function mv(e,t){let n=await lv(e),r=uv(e.params.n);return r===null?!1:bi(n,e.repoBase).some(e=>e.kind===t&&e.number===r)?dv(t,r,e):e.repoBase===void 0&&null}var hv=async e=>(await kt(e.params.sha??``,e.opts),!0);async function gv(e,t){let n=uv(e.params.n);return n!==null&&dv(t,n,e)}var _v=[{matches:e=>e===`/tasks/:id/commits/:sha`,check:pv},{matches:e=>e===`/tasks/:id/issue/:n`,check:e=>mv(e,`issue`)},{matches:e=>e===`/tasks/:id/pr/:n`,check:e=>mv(e,`pr`)},{matches:e=>e.startsWith(`/tasks/:id`),check:fv},{matches:e=>e===`/git/commits/:sha`,check:hv},{matches:e=>e===`/github/issues/:n`,check:e=>gv(e,`issue`)},{matches:e=>e.startsWith(`/github/prs/:n`),check:e=>gv(e,`pr`)},{matches:e=>e===`/workflows/:name`,check:async e=>{let{workflows:t,issues:n}=await ke(e.opts);return t.some(t=>t.name===e.params.name)?!0:n.length>0&&null}},{matches:e=>e.startsWith(`/automations/:automationId`),check:async e=>{let t=await pe(e.opts);return t.available?t.automations.some(t=>t.id===e.params.automationId):null}}];async function vv(e,t,n,r,i){let a=``;try{let o=i(t);if(o===null)return!1;a=o.pattern;let s=_v.find(e=>e.matches(o.pattern));return s===void 0?null:await s.check({projectId:e,pattern:a,params:o.params,repoBase:r,opts:{projectId:e,signal:n}})}catch(e){return!bv(e,a)&&null}}var yv=/unknown revision|bad object|bad revision|unknown commit|not a commit hash|needed a single revision/i;function bv(e,t){return e instanceof et?e.status===404||(t===`/git/commits/:sha`||t===`/tasks/:id/commits/:sha`)&&e.status===409&&yv.test(e.message):!1}async function xv(e,t,n){let r=cv(e,t,n);if(!r.verify)return r.href;let i=new AbortController,a=setTimeout(()=>i.abort(),ov);try{return await vv(e,r.href.replace(/[?#].*$/,``),i.signal,n.repoBaseOf?.(e),n.matchRoute)===!1?sv(e):r.href}finally{clearTimeout(a)}}var Sv={key:``,navigate:null,ticket:0};function Cv(e,t){e!==Sv.key&&Sv.ticket++,Sv.key=e,Sv.navigate=t}function wv(){Sv.ticket++}async function Tv(e,t,n){let r=++Sv.ticket,i=Sv.key,a=await xv(e,t,n);r===Sv.ticket&&i===Sv.key&&Sv.navigate?.(a)}function Ev(){let e=j(),t=a();Z.useLayoutEffect(()=>{Cv(`${t.key}|${t.pathname}${t.search}${t.hash}`,e)},[e,t.key,t.pathname,t.search,t.hash])}function Dv(){let e=Z.useContext(Gl);if(e===null)throw Error(`useProjectSwitch needs a ProjectRouteMatcherContext provider (App provides matchProjectRoute)`);let t=bn().data,n=En().data,r=Z.useCallback(e=>t?.projects.find(t=>t.id===e)?.repoUrl??(e===(n?.bootProject??t?.bootProject)?Cr(n?.repo?.remote):void 0),[t,n]);Ev();let{pathname:i,search:o,hash:s}=a(),c=_s(i),l=`${i}${o}${s}`;return{target:Z.useCallback(n=>n===c?{href:l,verify:!1}:cv(n,rv(n),{registry:t,matchRoute:e}),[t,e,c,l]),go:Z.useCallback(async n=>{if(n===c)return wv();await Tv(n,rv(n),{registry:t,repoBaseOf:r,matchRoute:e})},[t,r,e,c])}}function Ov(e){return e?.capabilities?.automations===!0}function kv(){let e=En().data,t=(0,Z.useRef)(void 0);(0,Z.useEffect)(()=>{e&&(t.current=e)},[e]);let n=e??t.current;return n?Ov(n)?`available`:`unavailable`:`unknown`}function Av(){return kv()===`available`}function jv(e){return e<=200}function Mv(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 Nv(e,t){let n=Mv(t);if(n.length===0)return[...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)),[...a,...i]}function Pv(e,t,n){return t===n||t<0||n<0||t>=e.length||n>=e.length?[...e]:pc([...e],t,n)}function Fv(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Iv(){let e=I(),t=Dn(),n=Z.useRef(0),r=Z.useRef(Promise.resolve()),i=Z.useMemo(()=>Mv(t.data?.sidebar?.projectOrder),[t.data?.sidebar?.projectOrder]),a=Z.useCallback(t=>{let i=e.getQueryData(V.uiState);if(i===void 0)return;let{projectOrder:a,...o}=Fv(i.sidebar),s=t===null?o:{...o,projectOrder:t};e.setQueryData(V.uiState,{...i,sidebar:s});let c=++n.current,l=r.current.then(async()=>{let t=await Je({sidebar:s},{keepalive:!0});c===n.current&&e.setQueryData(V.uiState,t)});r.current=l.catch(t=>{G(t instanceof Error?t.message:String(t),{tone:`danger`}),c===n.current&&e.invalidateQueries({queryKey:V.uiState})})},[e]),o=Z.useCallback(e=>{let t=Mv(e);t.length===0||!jv(e.length)||a(t)},[a]),s=Z.useCallback(()=>a(null),[a]);return{order:i,canReorder:t.data!==void 0,setOrder:o,reset:s}}function Lv(e){return[...e].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt))}function Rv(e,t,n){let r=t.trim().toLowerCase();if(r===``)return 1;let i=(n?.length?`${e} ${n.join(` `)}`:e).toLowerCase(),a=r.split(/\s+/),o=0;for(let e of a){let t=i.indexOf(e);if(t===-1)return 0;let n=t===0||!/[a-z0-9]/.test(i[t-1]??``);o+=(n?1:.5)/(1+t/48)}return o/a.length}function zv(e,t){if(t.trim()===``)return e;let n=e=>e.rows.reduce((e,n)=>Math.max(e,Rv(n.value,t,n.keywords)),0);return e.map(e=>({group:e,score:n(e)})).sort((e,t)=>t.score-e.score).map(({group:e})=>e)}function Bv(e,t){return{value:`task ${xi(e)} ${e.id}`,keywords:[...t?[t]:[],...qv(e),...[e.branch,e.workflow,e.workflowLabel,e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl].filter(e=>!!e)]}}var Vv=e=>({value:`view ${e}`}),Hv=e=>({value:`project ${e.name} ${e.id}`,keywords:[e.root]}),Uv=e=>({value:`skill ${e.id} ${e.name} ${e.path??``}`,...g({keywords:e.description?[e.description]:void 0})}),Wv={value:`action toggle theme`},Gv=150;function Kv(e,t,n,r=[]){let i=Lv(e.filter(e=>!zr(e))).map(e=>({...e,projectId:t})),a=new Set(i.map(Jv)),o=[...n??[],...r].filter(e=>zr(e)||a.has(Jv(e))?!1:(a.add(Jv(e)),!0)).sort((e,t)=>t.createdAt.localeCompare(e.createdAt));return[...i,...o]}function qv(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?/\/(\d+)\/?$/.exec(n):null;e&&t.add(Number(e[1]))}for(let n of[e.prNumber,e.issueNumber,e.markerRefs?.pr,e.markerRefs?.issue])typeof n==`number`&&Number.isInteger(n)&&n>0&&t.add(n);return[...t].flatMap(e=>[String(e),`#${e}`])}var Jv=e=>`${e.projectId??``}/${e.id}`;function Yv(e){let t=e.filter(e=>Zr(e)).sort((e,t)=>(t.finishedAt??``).localeCompare(e.finishedAt??``)),n=new Set(t.map(Jv));return{recentlyFinished:t,otherTasks:e.filter(e=>!n.has(Jv(e)))}}function Xv(e,t,n=[]){let r=Nv(e,n);return[...r.filter(e=>e.id!==t),...r.filter(e=>e.id===t)]}function Zv(){let[e,t]=Z.useState(!1),n=gs();Gg(`k`,()=>t(e=>!e));let r=Z.useCallback(()=>{t(!1),n(`/new`)},[n]);return Gg(`n`,r),Jg(`c`,r),Z.useEffect(()=>{let e=()=>t(!0);return window.addEventListener(Qu,e),()=>window.removeEventListener(Qu,e)},[]),(0,Q.jsx)(ws,{open:e,onOpenChange:t,title:`Command palette`,description:`Search projects, tasks, views, actions, and skills`,showCloseButton:!1,filter:Rv,className:`top-[10vh] translate-y-0 sm:max-w-2xl lg:max-w-3xl xl:max-w-4xl`,children:(0,Q.jsx)(ay,{close:()=>t(!1)})})}function Qv({heading:e,tasks:t,projectName:n,showProject:r,now:i,onSelect:a}){return(0,Q.jsx)(As,{heading:e,children:t.map(e=>(0,Q.jsx)($v,{task:e,projectName:n(e),showProject:r,now:i,onSelect:a},Jv(e)))})}function $v({task:e,projectName:t,showProject:n,now:r,onSelect:i}){let a=Ce(e),o=xi(e);return(0,Q.jsxs)(Ns,{...Bv(e,t),"data-slot":`palette-task`,"data-run-id":e.id,"data-project-id":e.projectId??void 0,onSelect:()=>i(e),children:[(0,Q.jsx)($,{tone:a.tone,shape:a.shape,pulse:a.pulse,"aria-label":a.label,role:`img`}),e.delegation?.role===`worker`?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:o}),n&&t?(0,Q.jsx)(`span`,{"data-slot":`palette-task-project`,className:`shrink-0 truncate text-xs text-soft-foreground`,children:t}):null,(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:Ga(e.finishedAt??e.createdAt,r)})]})}function ey({multiProject:e,health:t}){return[...e?[{label:`All tasks`,to:`/tasks`,icon:Da,global:!0}]:[],...s_({forge:t.data?.forge?.available===!0,automations:Ov(t.data)}).map(e=>({label:e.label,to:e.to,icon:e.icon,global:!1}))]}function ty({views:e,go:t,goGlobal:n,orderedProjects:r,activeProjectId:i,goProject:a,otherTasks:o,searching:s,taskProjectName:c,showProjectOnTasks:l,now:u,selectTask:d,orderedSkills:f,skillRunner:p,theme:m,nextTheme:h,setTheme:g,close:_}){let v=[{rows:e.map(e=>Vv(e.label)),node:(0,Q.jsx)(As,{heading:`Views`,children:e.map(e=>{let r=e.icon;return(0,Q.jsxs)(Ns,{...Vv(e.label),"data-slot":`palette-view`,"data-nav-to":e.to,onSelect:()=>e.global?n(e.to):t(e.to),children:[(0,Q.jsx)(r,{"aria-hidden":`true`}),e.label]},e.to)})},`views`)}];return r.length>0&&v.push({rows:r.map(Hv),node:(0,Q.jsx)(As,{heading:`Projects`,children:r.map(e=>{let t=e.id===i,n=e.status===`missing`;return(0,Q.jsxs)(Ns,{...Hv(e),"data-slot":`palette-project`,"data-project-id":e.id,disabled:n,onSelect:()=>a(e.id),children:[(0,Q.jsx)(Fi,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),n?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-soft-foreground`,children:e.branch}),t?(0,Q.jsx)(Qi,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.id)})},`projects`)}),o.length>0&&v.push({rows:s?o.map(e=>Bv(e,c(e))):[],node:(0,Q.jsx)(Qv,{heading:`Tasks`,tasks:o,projectName:c,showProject:l,now:u,onSelect:d},`tasks`)}),v.push({rows:[Wv],node:(0,Q.jsx)(As,{heading:`Actions`,children:(0,Q.jsxs)(Ns,{...Wv,"data-slot":`palette-action`,"data-action":`toggle-theme`,onSelect:()=>{g(h),_()},children:[(0,Q.jsx)(va,{"aria-hidden":`true`}),`Toggle theme`,(0,Q.jsxs)(ks,{className:`tracking-normal`,children:[m,` → `,h]})]})},`actions`)}),f.length>0&&v.push({rows:f.map(Uv),node:(0,Q.jsx)(As,{heading:`Skills`,children:f.map(e=>(0,Q.jsxs)(Ns,{...Uv(e),"data-slot":`palette-skill`,"data-skill":e.id,onSelect:()=>t(V_({skill:e.id,skillPath:e.path,runner:p})),children:[(0,Q.jsx)(`span`,{className:`shrink-0 font-medium`,children:e.name}),e.path?(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},JSON.stringify([e.id,e.path])))},`skills`)}),v}function ny({search:e,setSearch:t}){return(0,Q.jsx)(js,{placeholder:`Search projects, tasks, views, actions, skills…`,value:e,onValueChange:t})}function ry({search:e,searching:t,recentlyFinished:n,groups:r,taskProjectName:i,showProjectOnTasks:a,now:o,selectTask:s,go:c}){return(0,Q.jsxs)(Os,{className:`max-h-[55vh] min-h-[14rem] sm:max-h-[60vh] lg:max-h-[68vh]`,children:[(0,Q.jsx)(Ws,{children:`Nothing matches.`}),(0,Q.jsx)(As,{children:(0,Q.jsxs)(Ns,{value:`new task`,"data-slot":`palette-view`,"data-nav-to":`/new`,onSelect:()=>c(`/new`),children:[(0,Q.jsx)(zi,{"aria-hidden":`true`}),`New task`,(0,Q.jsx)(ks,{children:`C`})]})}),!t&&n.length>0?(0,Q.jsx)(Qv,{heading:`Recently finished`,tasks:n,projectName:i,showProject:a,now:o,onSelect:s}):null,zv(r,e).map(e=>e.node)]})}function iy({cappedProjects:e}){return e.length===0?null:(0,Q.jsxs)(`p`,{"data-slot":`palette-search-truncated`,role:`status`,className:`border-t border-border px-3 py-2 text-[11px] text-soft-foreground`,children:[`More matches in `,e.join(`, `),`. Type more to narrow them.`]})}function ay({close:e}){let t=gs(),n=j(),[r,i]=Z.useState(``),a=r.trim()!==``,o=Ss(),{theme:s,setTheme:c}=xg(),l=xr(),u=hn(),d=bn(),f=mn(),p=En(),m=Date.now(),h=d.data,g=h!==void 0&&h.projects.length>1,_=Jn(g),{order:v}=Iv(),y=Z.useMemo(()=>g?Xv(h.projects,o,v):[],[g,h,o,v]),b=Z.useMemo(()=>new Map((h?.projects??[]).map(e=>[e.id,e.name])),[h]),x=o??h?.bootProject??null,[S,C]=Z.useState(``);Z.useEffect(()=>{let e=setTimeout(()=>C(r),Gv);return()=>clearTimeout(e)},[r]);let w=br(S),T=a?w.data?.runs:void 0,E=a&&!w.isPlaceholderData?(w.data?.truncated??[]).map(e=>b.get(e)??e):[],D=Z.useMemo(()=>Kv(l.data??[],x,_.data?.runs,T),[l.data,x,_.data,T]),O=Z.useMemo(()=>Yv(D),[D]),k=a?[]:O.recentlyFinished,A=a?D:O.otherTasks,M=g,ee=e=>e.projectId===null?null:b.get(e.projectId)??null,te=f.data?.skillUsage,ne=Z.useMemo(()=>Tc(u.data??[],te),[u.data,te]),re=n=>{e(),t(n)},ie=t=>{e(),n(t)},N=Dv(),P=t=>{e(),N.go(t)},F=n=>{e(),t(n.projectId===null?`/tasks/${n.id}`:hs(n.projectId,`/tasks/${n.id}`))},ae=Sg[s],oe=ty({views:ey({multiProject:g,health:p}),go:re,goGlobal:ie,orderedProjects:y,activeProjectId:o,goProject:P,otherTasks:A,searching:a,taskProjectName:ee,showProjectOnTasks:M,now:m,selectTask:F,orderedSkills:ne,skillRunner:u.runner,theme:s,nextTheme:ae,setTheme:c,close:e});return(u.isError||u.list?.source===`unavailable`)&&a&&oe.push({rows:[{value:r.trim()}],node:(0,Q.jsx)(As,{heading:`Skills`,children:(0,Q.jsxs)(Ns,{value:r.trim(),onSelect:()=>re(V_({skill:r.trim(),runner:u.runner})),children:[`Use skill id “`,r.trim(),`” (unchecked)`]})},`unchecked-skill`)}),(0,Q.jsxs)(Q.Fragment,{children:[ny({search:r,setSearch:i}),ry({search:r,searching:a,recentlyFinished:k,groups:oe,taskProjectName:ee,showProjectOnTasks:M,now:m,selectTask:F,go:re}),iy({cappedProjects:E})]})}var oy=Z.createContext(null);function sy({children:e}){let[t,n]=Z.useState(`active`),r=Av(),i=r?t:`active`,a=Z.useMemo(()=>[i,n,r],[i,r]);return(0,Q.jsx)(oy.Provider,{value:a,children:e})}function cy(){let e=Z.useContext(oy);if(!e)throw Error(`useListView must be used inside a <ListViewProvider>`);return e}function ly(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return{};let n=e,r={};for(let{id:e}of t?.runners??[]){let t=n[e];typeof t==`string`&&t.length>0&&t.length<=128&&(r[e]=t)}return r}function uy(e,t,n){if(!e||!n)return[];let r=new Map(e.providers.map(e=>[e.provider,e]));return n.runners.flatMap(({id:e,displayName:n})=>{let i=r.get(e);return i?.status!==`disconnected`||!i.authFailureId||t[e]===i.authFailureId?[]:[{provider:e,label:n,authFailureId:i.authFailureId}]})}function dy(e,t){return{...e,...Object.fromEntries(t.map(({provider:e,authFailureId:t})=>[e,t]))}}function fy({status:e,runners:t,pending:n,error:r,dismissals:i,onDismissAuthFailures:a}){if(n||!e)return null;let o;try{o=Wt(e)}catch{return null}let s=uy(o,i,t);if(s.length>0)return(0,Q.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,Q.jsx)($,{tone:`danger`}),(0,Q.jsxs)(`span`,{children:[`Provider authentication failed during a task:`,` `,s.map(({label:e})=>e).join(`, `),`.`]}),(0,Q.jsx)(Y,{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,Q.jsx)(`button`,{type:`button`,"aria-label":`Dismiss provider authentication alert`,onClick:()=>a(s),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,Q.jsx)(Xu,{className:`size-4`,"aria-hidden":`true`})})]});if(r||o.providers.some(e=>e.enabled&&e.status===`connected`))return null;let c=o.providers.some(e=>e.status===`connected`),l=o.providers.some(e=>e.status===`unknown`);return(0,Q.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,Q.jsx)($,{tone:l?`danger`:`pending`}),(0,Q.jsx)(`span`,{children:c?`No agent provider is enabled.`:l?`No connected provider could be verified.`:`No agent provider credentials were found.`}),(0,Q.jsx)(Y,{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 py(e){if(!(typeof e!=`object`||!e||Array.isArray(e)))return e}function my(){let e=Wn(),t=Oi().data,n=Dn(),r=I(),i=(0,Z.useRef)(Promise.resolve()),a=(0,Z.useRef)(0),o=(0,Z.useRef)(0),s=(0,Z.useRef)(py(n.data));(0,Z.useEffect)(()=>{o.current===0&&(s.current=py(n.data))},[n.data]);let c=(0,Z.useCallback)(e=>{let n=V.uiState,c=py(r.getQueryData(n)),l=dy(ly(c?.dismissedProviderAuthFailures,t),e),u={...c,dismissedProviderAuthFailures:l};o.current+=1,r.setQueryData(n,u);let d=++a.current;i.current=i.current.then(async()=>{try{let e=await Je({dismissedProviderAuthFailures:l});s.current=py(e),d===a.current&&r.setQueryData(n,e)}catch(e){d===a.current&&(s.current===void 0?r.removeQueries({queryKey:n,exact:!0}):r.setQueryData(n,s.current),r.invalidateQueries({queryKey:n}),G(e instanceof Error?e.message:String(e),{tone:`danger`}))}finally{--o.current}})},[r,t]);return(0,Q.jsx)(fy,{status:e.data,runners:t,pending:e.isPending,error:e.isError,dismissals:ly(py(n.data)?.dismissedProviderAuthFailures,t),onDismissAuthFailures:c})}function hy(e={displayName:`Squawk`,command:`hsq`,npx:`npx -p @hearsay-tools/squawk hsq`}){return e.command}function gy(e){return e.reason===`legacy-change`?e.canImport?`${e.file} changed in the old home. Import keeps live-only changes. Old-home changes win when both homes changed the same key or entry.`:`${e.file} changed in the old home. Import is unavailable. Ignore keeps the live file and skips these old-home changes.`:e.reason===`outside-write`?`${e.file} changed outside Squawk. Restore the previous version or accept the file as found.`:e.file===`config.json`?`The project registry was reset. Restore the previous projects?`:`The account list was reset. Restore the previous accounts?`}function _y({file:e,editable:t}){let n=Bl(),r=Vl(),i=Hl(),a=e.reason===`legacy-change`,o=n.isPending||r.isPending||i.isPending,s=n.error??r.error??i.error,c=t=>{n.reset(),r.reset(),i.reset();let a={file:e.file,detectedAt:e.detectedAt};t===`restore`?n.mutate(a):t===`accept`?r.mutate(a):i.mutate(a)};return(0,Q.jsxs)(`div`,{"data-slot":`home-recovery`,"data-home-file":e.file,role:`status`,"aria-live":`polite`,"aria-busy":o,className:`flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-border bg-muted/50 p-3 text-sm text-foreground`,children:[(0,Q.jsx)(`span`,{className:`flex-[1_1_24rem] [min-inline-size:0] [overflow-wrap:break-word]`,children:gy(e)}),t?(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a?e.canImport&&(0,Q.jsx)(k,{type:`button`,"data-action":`import`,disabled:o,onClick:()=>c(`import`),children:`Import changes from the old home`}):(0,Q.jsx)(k,{type:`button`,"data-action":`restore`,disabled:o||!e.canRestore,onClick:()=>c(`restore`),children:`Restore`}),(0,Q.jsx)(k,{type:`button`,variant:`outline`,"data-action":`accept`,disabled:o,onClick:()=>c(`accept`),children:a?`Ignore`:`Accept as found`})]}):t===!1&&(0,Q.jsxs)(`p`,{className:`basis-full`,children:[a?e.canImport?`Only the host operator can import or ignore this file.`:`Only the host operator can ignore this file.`:`Only the host operator can restore or accept this file.`,e.file.startsWith(`remote-settings/`)&&(a?(0,Q.jsxs)(Q.Fragment,{children:[` `,e.canImport&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`code`,{children:[hy(),` backup import `,e.file]}),` or `]}),(0,Q.jsxs)(`code`,{children:[hy(),` backup ignore `,e.file]})]}):(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{children:[hy(),` backup restore `,e.file]})]}))]}),t&&s&&(0,Q.jsx)(`p`,{role:`alert`,className:`basis-full text-danger`,children:s.message})]})}function vy(){let e=Il(),t=En().data?.capabilities?.localHandoff;return(0,Q.jsx)(`div`,{"data-slot":`home-recovery-state`,"data-state":e.isSuccess?`ready`:e.isError?`error`:`pending`,children:e.data?.files.map(e=>(0,Q.jsx)(_y,{file:e,editable:!e.file.startsWith(`remote-settings/`)&&t},e.file))})}var yy=`cez-project-rail-expanded`;function by(e,t){return e-232-t>=640}function xy(){try{return localStorage.getItem(yy)===`1`}catch{return!1}}function Sy(e){try{localStorage.setItem(yy,e?`1`:`0`)}catch{}}function Cy(e){if(e!==void 0)return e.isDragging?`relative z-10 opacity-40 [-webkit-touch-callout:none]`:`[-webkit-touch-callout:none]`}function wy({project:e,signal:t,known:n,current:r,target:i,onSwitchProject:a,onSelectProject:o,sort:s}){let c=Bh(e.name,t,{unknown:!n});return(0,Q.jsxs)(`div`,{ref:s?.setNodeRef,style:s?.style,...s?.listeners,"data-slot":`rail-project`,"data-project-id":e.id,"data-dragging":s?.isDragging?``:void 0,className:C(`relative flex h-[52px] w-full shrink-0 items-center justify-center`,Cy(s)),children:[r?(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`rail-current-bar`,className:`absolute top-1/2 left-0 h-5 w-[3px] -translate-y-1/2 rounded-r-[2px] bg-foreground`}):null,(0,Q.jsxs)(`div`,{className:`relative size-9`,children:[(0,Q.jsx)(E,{ref:s?.setActivatorNodeRef,"aria-describedby":s?.attributes[`aria-describedby`],to:i.href,onClick:t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(o?.(e.id),i.verify&&a&&(t.preventDefault(),a(e.id)))},"aria-label":c,title:c,"aria-current":r?`page`:void 0,className:C(`flex size-full items-center justify-center rounded-[9px] border text-[12px] leading-none font-semibold focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r?`border-soft-foreground bg-sidebar-row-selected text-foreground`:`border-transparent bg-muted text-muted-foreground hover:text-foreground`),children:Uh(e.name)}),(0,Q.jsx)(og,{position:`top`,segments:sg(t).top}),(0,Q.jsx)(og,{position:`bottom`,segments:sg(t).bottom})]})]})}var Ty=`motion-safe:rail-text-in`;function Ey({project:e,signal:t,known:n,current:r,target:i,onSwitchProject:a,onSelectProject:o,sort:s}){let c=Bh(e.name,t,{unknown:!n}),{top:l,bottom:u}=sg(t),d=r?`border-sidebar-row-selected`:`border-background group-hover:border-sidebar-row-hover`;return(0,Q.jsxs)(`div`,{ref:s?.setNodeRef,style:s?.style,...s?.listeners,"data-slot":`rail-project`,"data-project-id":e.id,"data-dragging":s?.isDragging?``:void 0,className:C(`group/row relative w-full shrink-0`,Cy(s)),children:[(0,Q.jsxs)(E,{to:i.href,onClick:t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(o?.(e.id),i.verify&&a&&(t.preventDefault(),a(e.id)))},"aria-label":c,"aria-current":r?`page`:void 0,className:C(`group flex h-[52px] w-full items-center gap-[10px] rounded-[8px] px-[6px] pr-6 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,r?`bg-sidebar-row-selected`:`hover:bg-sidebar-row-hover`),children:[(0,Q.jsxs)(`span`,{"aria-hidden":`true`,"data-slot":`rail-mark`,className:C(`relative flex size-9 shrink-0 items-center justify-center rounded-[9px] border text-[12px] leading-none font-semibold`,r?`border-soft-foreground bg-sidebar text-foreground`:`border-transparent bg-muted text-muted-foreground`),children:[Uh(e.name),(0,Q.jsx)(og,{position:`top`,segments:l,className:d}),(0,Q.jsx)(og,{position:`bottom`,segments:u,className:d})]}),(0,Q.jsxs)(`span`,{className:C(`flex min-w-0 flex-1 flex-col gap-px`,Ty),children:[(0,Q.jsx)(`span`,{"data-slot":`rail-project-name`,className:C(`truncate text-[13.5px] leading-[18px] font-semibold`,r?`text-foreground`:`text-muted-foreground`),children:e.name}),(0,Q.jsx)(tg,{signal:t,known:n,current:r,maxParts:2,slot:`rail-project-state`,className:`h-4 gap-x-[4px] overflow-hidden text-[11px] leading-4 whitespace-nowrap`})]})]}),s?(0,Q.jsx)(Dy,{name:e.name,sort:s}):null]})}function Dy({name:e,sort:t}){return(0,Q.jsx)(`button`,{type:`button`,ref:t.setActivatorNodeRef,"data-slot":`rail-project-grip`,...t.attributes,"aria-label":`Reorder ${e}, position ${t.position} of ${t.total}`,className:C(`absolute top-1/2 right-0.5 flex h-10 w-5 -translate-y-1/2 cursor-grab touch-none items-center justify-center rounded text-soft-foreground opacity-0 outline-none transition-opacity hover:text-foreground motion-reduce:transition-none`,`focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50`,`group-hover/row:opacity-100 group-focus-within/row:opacity-100 [@media(hover:none)]:opacity-100`),children:(0,Q.jsx)(Eu,{"aria-hidden":`true`,className:`size-3.5`})})}function Oy({expanded:e,position:t,total:n,sortable:r,...i}){let{attributes:a,listeners:o,setNodeRef:s,setActivatorNodeRef:c,transform:l,transition:u,isDragging:d}=dc({id:i.project.id,disabled:!r}),f=r?{setNodeRef:s,setActivatorNodeRef:c,style:{transform:yc.Translate.toString(l),transition:u},listeners:o,attributes:a,isDragging:d,position:t,total:n}:void 0;return e?(0,Q.jsx)(Ey,{...i,sort:f}):(0,Q.jsx)(wy,{...i,sort:f})}var ky=({transform:e})=>({...e,x:0}),Ay=class extends cc{static activators=[{eventName:`onPointerDown`,handler:({nativeEvent:e},t)=>e.pointerType!==`touch`&&cc.activators[0].handler({nativeEvent:e},t)}]},jy={delay:250,tolerance:5},My={start:[sc.Space],cancel:[sc.Esc],end:[sc.Space,sc.Enter,sc.Tab]},Ny={droppable:{strategy:vc.Always}},Py={draggable:`To reorder projects, press Space to pick this project up. Use the up and down arrow keys to move it, Space to drop it, or Escape to cancel.`};function Fy(e,t){let[n,r]=Z.useState(null),i=Z.useMemo(()=>{if(n===null||n.base!==e)return e;let t=new Map(e.map(e=>[e.id,e]));return n.ids.flatMap(e=>t.get(e)??[])},[n,e]),a=Z.useMemo(()=>i.map(e=>e.id),[i]),o=ac(uc(Ay,{activationConstraint:{distance:6}}),uc(lc,{activationConstraint:jy}),uc(fc,{coordinateGetter:gc,keyboardCodes:My})),s=Z.useRef(null),c=Z.useCallback(()=>{s.current?.();let e=e=>e.preventDefault();window.addEventListener(`click`,e,!0),s.current=()=>{window.removeEventListener(`click`,e,!0),s.current=null}},[]),l=Z.useCallback(()=>{let e=s.current;window.setTimeout(()=>e?.(),0)},[]);Z.useEffect(()=>()=>s.current?.(),[]);let u=Z.useCallback(n=>{l();let{active:i,over:o}=n;if(!t||o===null||o.id===i.id)return;let s=Pv(a,a.indexOf(String(i.id)),a.indexOf(String(o.id)));s.some((e,t)=>e!==a[t])&&(r({base:e,ids:s}),t(s))},[l,e,a,t]);return{projects:i,ids:a,sensors:o,announcements:Z.useMemo(()=>{let e=e=>{let t=a.indexOf(String(e));return{name:i[t]?.name??String(e),position:`position ${t+1} of ${a.length}`}};return{onDragStart:({active:t})=>`Picked up ${e(t.id).name}, ${e(t.id).position}.`,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}.`}},[a,i]),onDragStart:c,onDragEnd:u,onDragCancel:l}}function Iy(e){return C(`flex shrink-0 items-center rounded-[8px] text-soft-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,e?`size-auto h-9 w-full justify-start gap-3 px-2.5 text-[13px] font-normal`:`size-9 justify-center`)}var Ly=C(`truncate text-muted-foreground group-hover:text-foreground`,Ty);function Ry({to:e,label:t,slot:n,active:r,expanded:i,children:a}){return(0,Q.jsxs)(E,{to:e,"data-slot":n,"aria-label":t,title:i?void 0:t,"aria-current":r?`page`:void 0,className:C(`group`,Iy(i),r&&`bg-sidebar-row-selected text-foreground hover:bg-sidebar-row-selected`),children:[a,i?(0,Q.jsx)(`span`,{className:Ly,children:t}):null]})}function zy(e){let[t,n]=Z.useState(()=>window.innerWidth);return Z.useEffect(()=>{let e=()=>n(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),by(t,e)}function By(){let e=zy(Z.useContext(id));return(0,Q.jsx)(`div`,{"aria-hidden":`true`,"data-slot":`project-rail-placeholder`,style:{width:xy()&&e?232:60},className:`hidden shrink-0 border-r border-border bg-background md:block`})}var Vy=e=>({href:String(hs(e,`/`)),verify:!1});function Hy({expanded:e,resolvedTheme:t,version:n}){let r=n?`Squawk v${n}`:`Squawk`;return e?(0,Q.jsxs)(`div`,{"data-slot":`rail-identity`,className:`flex shrink-0 flex-col gap-0.5`,children:[(0,Q.jsxs)(`div`,{className:`flex h-[34px] items-center gap-[10px] px-0.5`,children:[(0,Q.jsx)(`img`,{src:`/cezarion-mark-${t}.svg`,alt:``,"aria-hidden":`true`,"data-slot":`rail-app-mark`,className:`size-[34px] shrink-0 rounded-[8px]`}),(0,Q.jsxs)(`span`,{className:C(`flex min-w-0 items-baseline gap-[10px] whitespace-nowrap`,Ty),"aria-label":r,children:[(0,Q.jsx)(`span`,{className:`text-[15px] leading-none font-bold text-foreground`,children:`Squawk`}),n?(0,Q.jsxs)(`span`,{"data-slot":`rail-version`,title:`v${n}`,className:`min-w-0 truncate text-[11px] leading-none text-soft-foreground`,children:[`v`,n]}):null]})]}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`h-px w-full bg-border`}),(0,Q.jsx)(`div`,{className:C(`px-1 pt-2.5 pb-1 text-[11px] font-medium text-soft-foreground`,Ty),children:`Projects`})]}):(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-0.5`,children:[(0,Q.jsx)(`img`,{src:`/cezarion-mark-${t}.svg`,alt:r,title:r,"data-slot":`rail-app-mark`,className:`size-[34px] rounded-[9px]`}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:`mt-0.5 mb-1.5 h-px w-6 bg-border`})]})}function Uy({expanded:e}){return e?(0,Q.jsx)(Eh,{origin:`rail`,icon:zi,iconClassName:`size-[15px] text-soft-foreground`,iconFrameClassName:`flex size-9 shrink-0 items-center justify-center rounded-[9px] border border-border`,label:`Add project`,side:`right`,triggerClassName:C(`h-[44px] w-full shrink-0 justify-start gap-[10px] rounded-[8px] px-[6px] text-[13px] font-normal text-muted-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring motion-safe:[&>span:last-child]:rail-text-in`)}):(0,Q.jsx)(Eh,{origin:`rail`,icon:zi,iconClassName:`size-[15px]`,side:`right`,triggerClassName:`shrink-0 rounded-[9px] border border-border text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`})}function Wy({roomToExpand:e,expanded:t,toggle:n,railId:r,allProjectsActive:i,settingsActive:a}){return(0,Q.jsxs)(`div`,{"data-slot":`rail-bottom`,className:C(`flex shrink-0 flex-col gap-0.5 pt-2`,t?`items-stretch`:`items-center`),children:[e?(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`rail-expand-toggle`,"aria-expanded":t,"aria-controls":r,"aria-label":t?`Collapse projects`:`Expand projects`,title:t?void 0:`Expand projects`,onClick:n,className:C(`group`,Iy(t)),children:[t?(0,Q.jsx)(Iu,{className:`size-4 shrink-0`,"aria-hidden":`true`}):(0,Q.jsx)(Lu,{className:`size-4 shrink-0`,"aria-hidden":`true`}),t?(0,Q.jsx)(`span`,{className:Ly,children:`Collapse`}):null]}):null,(0,Q.jsx)(Ry,{to:`/tasks`,label:`All projects`,slot:`rail-all-projects`,active:i,expanded:t,children:(0,Q.jsx)(Da,{className:`size-4 shrink-0`,"aria-hidden":`true`})}),(0,Q.jsx)(Ry,{to:`/settings/global/appearance`,label:`Global settings`,slot:`rail-global-settings`,active:a,expanded:t,children:(0,Q.jsx)(Zi,{className:`size-4 shrink-0`,"aria-hidden":`true`})}),(0,Q.jsx)(wg,{showLabel:t,labelClassName:Ly,className:C(`group`,Iy(t),`[&_svg]:size-4`)})]})}function Gy({projects:e,signals:t,version:n,projectTarget:r=Vy,onSwitchProject:i,onSelectProject:o,canReorder:s=!1,onReorder:c}){let{pathname:l}=a(),{resolvedTheme:u}=xg(),d=Z.useContext(id),[f,p]=Z.useState(xy),m=zy(d),h=f&&m,g=()=>{let e=!h;p(e),Sy(e)},_=_s(l),v=l===`/tasks`,y=l===`/settings/global`||l.startsWith(`/settings/global/`),b=Z.useId(),x=Fy(e,c),S=s&&c!==void 0&&e.length>1;return(0,Q.jsxs)(`nav`,{id:b,"aria-label":`Projects`,"data-slot":`project-rail`,"data-expanded":h?`true`:`false`,style:{width:h?232:60},className:C(`hidden shrink-0 flex-col overflow-hidden border-r border-border bg-background pt-3 pb-3.5 transition-[width] duration-[160ms] ease-out motion-reduce:transition-none md:flex`,h?`items-stretch px-2.5`:`items-center`),children:[(0,Q.jsx)(Hy,{expanded:h,resolvedTheme:u,version:n}),(0,Q.jsxs)(`div`,{"data-slot":`rail-projects`,className:C(`flex min-h-0 w-full flex-1 flex-col gap-0.5 overflow-y-auto overscroll-contain [scrollbar-width:none]`,h?`items-stretch`:`items-center`),children:[(0,Q.jsx)(mc,{sensors:x.sensors,collisionDetection:hc,measuring:Ny,modifiers:[ky],accessibility:{announcements:x.announcements,screenReaderInstructions:Py},onDragStart:x.onDragStart,onDragEnd:x.onDragEnd,onDragCancel:x.onDragCancel,children:(0,Q.jsx)(_c,{items:x.ids,strategy:oc,disabled:!S,children:x.projects.map((e,n)=>(0,Q.jsx)(Oy,{expanded:h,sortable:S,position:n+1,total:x.projects.length,project:e,signal:t?.get(e.id),known:t!==null,current:e.id===_,target:r(e.id),onSwitchProject:i,onSelectProject:o},e.id))})}),(0,Q.jsx)(Uy,{expanded:h})]}),(0,Q.jsx)(Wy,{roomToExpand:m,expanded:h,toggle:g,railId:b,allProjectsActive:v,settingsActive:y})]})}function Ky(){let e=I(),t=bn().data?.projects,{order:n,canReorder:r,setOrder:i}=Iv(),a=r&&t!==void 0&&jv(t.length),o=Z.useMemo(()=>t?Nv(t,n):void 0,[t,n]),s=Jn().data,c=Z.useMemo(()=>s?zh(s.runs):null,[s]),l=t?.map(e=>e.id).sort().join(`
|
|
3
3
|
`),u=Z.useRef(void 0);return Z.useEffect(()=>{if(l===void 0)return;let t=u.current;if(u.current=l,t===void 0||t===l)return;let n=new Set(t.split(`
|
|
4
4
|
`)),r=new Set(l.split(`
|
|
5
|
-
`)),i=yn(e);for(let e of n)r.has(e)||i.dropProject(e);let a=[...r].filter(e=>!n.has(e));for(let e of a)i.restoreProject(e);a.length>0&&i.reconcile({hold:!0})},[e,l]),Z.useMemo(()=>o?{projects:o,signals:c,canReorder:a,onReorder:i}:null,[o,c,a,i])}var qy=60;function Jy(e){return`title`in e?`Archived "${e.title.length>qy?`${e.title.slice(0,qy-1)}…`:e.title}"`:`Archived ${e.count} ${e.count===1?`task`:`tasks`}`}async function Yy(e,t,n){let r=new Set(n),i=(await Promise.allSettled(t.map(async t=>{await Nt(xn(t,{projectId:e}),!1),r.has(t)&&await _e(xn(t,{projectId:e}),!0)}))).find(e=>e.status===`rejected`);i&&G(i.reason instanceof Error?i.reason.message:`Could not undo the archive.`,{tone:`danger`})}function Xy(){let e=document.activeElement;return!e||e===document.body||!e.isConnected}function Zy(e,t){if(!e.isConnected)return t();let n=new MutationObserver(()=>{e.isConnected||(n.disconnect(),clearTimeout(r),t())}),r=setTimeout(()=>n.disconnect(),5e3);n.observe(document.body,{childList:!0,subtree:!0})}function Qy(e,t){if(!Xy())return;let n=e?.isConnected?e:t?.isConnected?t:null;n instanceof HTMLElement&&(n.tabIndex<0&&!n.hasAttribute(`tabindex`)&&(n.tabIndex=-1),n.focus({preventScroll:!0}))}function $y(e,t,n){if(!e)return()=>{};let r=t(e);return()=>Zy(e,()=>Qy(r,n))}function eb(e){let t=document.activeElement?.closest(`[data-slot="task-row"]`);return t?.getAttribute(`data-run-id`)===e?t:Array.from(document.querySelectorAll(`[data-slot="task-row"]`)).find(t=>t.getAttribute(`data-run-id`)===e)??null}var tb=e=>e?.querySelector(`a`)??null;function nb(e,t){let n=e?.projectId,r=e?.cacheScope,i=Rn(),[a,o]=Z.useState(null),s=e=>i.invalidateAfter(`runs`,fr({projectId:n,cacheScope:e})),l=(e,t,r,i)=>G(e,{action:{label:`Undo`,onAction:()=>void Yy(n,r,i).finally(()=>void s(t))}}),u=Z.useRef(new Map);return{archiveOne:e=>{let i=u.current.get(e.id);if(i)return i;let a=r??c(),o=!!e.pinned,d=eb(e.id),f=$y(d,e=>{let t=Array.from(e.closest(`[data-slot="quick-list-bucket"]`)?.querySelectorAll(`[data-slot="task-row"]`)??[]),n=t.indexOf(e);return tb(t[n+1]??t[n-1])},d?.closest(`[data-slot="quick-list-bucket"]`)?.parentElement??null),p=Nt(xn(e.id,{projectId:n}),!0).then(()=>(s(a),l(Jy({title:xi(e)}),a,[e.id],o?[e.id]:[]),f(),t?.(),!0),e=>(G(e.message,{tone:`danger`}),!1)).finally(()=>u.current.delete(e.id));return u.current.set(e.id,p),p},sweep:(e,i)=>{let a=r??c();o(e);let u=document.activeElement,d=u?.matches(`[data-action="archive-group"]`)?u:null,f=$y(d,e=>tb(e.closest(`[data-slot="quick-list-bucket"]`)?.nextElementSibling?.querySelector(`[data-slot="task-row"]`)??void 0),d?.closest(`[data-slot="quick-list-bucket"]`)?.parentElement??null);Ct(fr({projectId:n}),e,i).then(({ids:e,pinnedIds:n})=>{s(a),e.length>0&&l(Jy({count:e.length}),a,e,n),f(),e.length>0&&t?.()},e=>G(e.message,{tone:`danger`})).finally(()=>o(null))},sweeping:a}}var rb=.6,ib=300,ab=100,ob={offset:0,phase:`idle`,past:!1},sb=null;function cb(e,t){sb&&sb.id!==e&&sb.close(),sb={id:e,close:t}}function lb(e){sb?.id===e&&(sb=null)}function ub(){if(!(typeof navigator>`u`||typeof navigator.vibrate!=`function`))try{navigator.vibrate(10)}catch{}}function db({id:e,enabled:t,onArchive:n}){let[r,i]=Z.useState(ob),a=Z.useRef(null),o=Z.useRef(null),s=Z.useRef(!1),c=Z.useRef(!1),l=Z.useRef(void 0),u=()=>{c.current=!0,clearTimeout(l.current),l.current=void 0},d=()=>{c.current&&(clearTimeout(l.current),l.current=setTimeout(()=>{c.current=!1},ib))};Z.useEffect(()=>()=>clearTimeout(l.current),[]);let f=Z.useRef(r);f.current=r;let p=Z.useRef(n);p.current=n;let m=Z.useCallback(()=>{o.current=null,s.current=!1,lb(e),i(ob)},[e]);Z.useEffect(()=>{!t&&f.current.phase!==`committing`&&m()},[t,m]),Z.useEffect(()=>()=>lb(e),[e]);let h=r.phase===`open`;Z.useEffect(()=>{if(!h)return;let e=()=>m(),t=e=>{let t=a.current;t&&e.target instanceof Node&&t.contains(e.target)||m()};return document.addEventListener(`scroll`,e,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,t,!0),()=>{document.removeEventListener(`scroll`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,!0)}},[h,m]);let g=t=>{lb(e),i({offset:-t,phase:`committing`,past:!0});let n=e=>{e===!1&&m()};try{let e=p.current();e&&typeof e.then==`function`&&e.then(n,m)}catch{m()}};return{offset:r.offset,phase:r.phase,past:r.past,surfaceRef:a,bind:{onPointerDown:e=>{if(c.current=!1,!t||f.current.phase===`committing`||e.pointerType===`mouse`&&e.button!==0)return;let n=(a.current??e.currentTarget).getBoundingClientRect();o.current={pointerId:e.pointerId,x0:e.clientX,y0:e.clientY,base:f.current.phase===`open`?-88:0,width:n.width>0?n.width:320,axis:null,wasOpen:f.current.phase===`open`,samples:[{x:e.clientX,t:Date.now()}]}},onPointerMove:t=>{let n=o.current;if(!n||t.pointerId!==n.pointerId)return;let r=t.clientX-n.x0,a=t.clientY-n.y0;if(n.axis===null){if(Math.max(Math.abs(r),Math.abs(a))<10||(n.axis=Math.abs(r)>Math.abs(a)?`x`:`y`,n.axis===`y`))return;try{t.currentTarget.setPointerCapture?.(t.pointerId)}catch{}cb(e,m),u()}if(n.axis!==`x`)return;let c=Math.min(0,Math.max(-n.width,n.base+r)),l=-c>=rb*n.width;l&&!s.current&&ub(),s.current=l,n.samples.push({x:t.clientX,t:Date.now()}),n.samples.length>8&&n.samples.shift(),i({offset:c,phase:`dragging`,past:l})},onPointerUp:t=>{let n=o.current;if(!n||t.pointerId!==n.pointerId)return;if(o.current=null,n.axis!==`x`){n.axis===null&&n.wasOpen&&(u(),d(),m());return}d();let r=f.current.offset,a=Date.now(),c={x:t.clientX,t:a},l=n.samples.find(e=>a-e.t<=ab&&e.t<a),p=l?(c.x-l.x)/(c.t-l.t):0;s.current=!1,f.current.past||p<=-1&&-r>=40?g(n.width):p<1&&-r>=40?(cb(e,m),i({offset:-88,phase:`open`,past:!1})):m()},onPointerCancel:e=>{let t=o.current;!t||e.pointerId!==t.pointerId||(o.current=null,d(),t.axis===`x`&&m())},onClickCapture:e=>{c.current&&(c.current=!1,e.preventDefault(),e.stopPropagation())},onKeyDownCapture:()=>{c.current=!1}},close:m}}function fb(e){if(e<1e3)return String(e);let t=[`k`,`M`,`B`,`T`],n=Math.floor(Math.log10(e)/3);return n>t.length?e.toExponential(0).replace(`+`,``):`${Math.floor(e/1e3**n)}${t[n-1]}`}function pb({stat:e,className:t,compact:n=!1}){let r=`+${e.adds} −${e.dels} across ${e.files} ${e.files===1?`file`:`files`}`,i=e.repointed?`${r} — measured against another branch checked out in this task's worktree, as this task found it`:void 0;return(0,Q.jsxs)(`span`,{"data-slot":`diff-stat`,...i?{"data-repointed":`true`,"aria-label":i}:{},...n&&!i?{"aria-label":r}:{},title:i??r,className:C(`font-mono text-xs font-semibold tabular-nums`,e.repointed&&`cursor-help underline decoration-dotted underline-offset-2`,t),children:[(0,Q.jsxs)(`span`,{className:`text-success`,children:[`+`,n?fb(e.adds):e.adds.toLocaleString(`en-US`)]}),` `,(0,Q.jsxs)(`span`,{className:`text-danger`,children:[`−`,n?fb(e.dels):e.dels.toLocaleString(`en-US`)]})]})}function mb(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}function hb(e){return e.runner??`claude`}function gb(e,t,n){let r=Ie(t,e);return r?.enabled===!1?{provider:e,usable:!1,reason:`${ki(n,e)} is disabled. Enable it in ${Qa(`providers`)}.`}:r?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${ki(n,e)} credentials are unavailable. Authorize it in ${Qa(`providers`)}.`}}function _b(e,t,n){return gb(mb(e),t,n)}function vb(e,t,n){return gb(hb(e),t,n)}function yb(e){let t=Wn(),n=Oi().data,r=mb(e);return t.isSuccess&&t.data&&n?_b(e,t.data,n):{provider:r,usable:!0}}function bb(e){let t=Wn(),n=Oi(),r=hb(e);return t.isSuccess&&t.data&&n.data?vb(e,t.data,n.data):t.isError||n.isError?{provider:r,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:r,usable:!1,reason:`Checking agent providers…`}}function xb(e){return Hr(e).sessionId}function Sb(e){return Hr(e).backend}function Cb(e){if(di(e)||e.cliHandoff===!1)return;let t=e.cliResumeCommand;if(t!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${t}`:t}function wb(e,t){let n=Ah(t);return!n||di(e)?!1:n===Sb(e)&&xb(e)!==void 0}function Tb(e){return(e.status===`failed`||St(e))&&(e.waits?.length??0)>0}function Eb(e,t){return t&&e.delegation?.role===`root`&&(e.status===`failed`||St(e))}function Db(e){return e.status===`cancelled`&&e.startedAt===void 0&&e.workflowDef!==void 0&&e.steps.every(e=>e.status===`pending`&&e.startedAt===void 0&&!e.sessionId)}function Ob(e){return Xr(e)&&e.removedRunner===void 0}function kb(e,t=!1){let n=di(e),r=xb(e)!==void 0;return{finish:e.status===`waiting`&&n||e.status===`review`,continueRun:(!n||e.removedRunner!==void 0&&e.status!==`queued`)&&!e.stopping&&e.delegation?.role!==`invalid`&&!(e.delegation?.role===`worker`&&e.delegation.destroy)&&(r||Db(e)||e.removedRunner!==void 0),terminal:Fb(e,n,r),notes:!0,archive:!n,pin:!e.archived&&!zr(e),markUnread:Ir(e)&&!Zr(e),cancel:n||Tb(e)||Eb(e,t),deleteRun:!n}}function Ab(e,t=!1){let n=kb(e,t);return n.archive&&!n.cancel&&!e.archiveBlocker}function jb(e){return e.status===`waiting`&&e.finishBlocked===null&&Ce(e).bucket===`waiting`}function Mb(e){return`Merge head branch and resolve conflicts in ${e?`PR number ${e}`:`this pull request`}`}function Nb(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function Pb(e,t){let n=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).findIndex(e=>e.id===t);return n>=0?n+1:void 0}function Fb(e,t,n){return e.cliHandoff!==!1&&!t&&n}var Ib=[50,100,200,400,800,1e3,1e3,1e3,1e3],Lb=e=>new Promise(t=>setTimeout(t,e));function Rb(e){return e instanceof et&&e.status===409&&e.message===`run is still active`}async function zb(e,t=Lb){for(let n=0;;n+=1)try{return await e()}catch(e){let r=Ib[n];if(!Rb(e)||r===void 0)throw e;await t(r)}}function Bb(e){return di(e)?`live`:kb(e).continueRun?`resume`:`unavailable`}function Vb(e,t){let n=fn(e.id,t),r=er(e.id,t),i=yb(e),a=bb(e),[o,s]=(0,Z.useState)(void 0),[c,l]=(0,Z.useState)(!1),u=(0,Z.useRef)(!1),d=Bb(e),f=d===`resume`?!a.usable:d===`live`&&!i.usable,p=d===`unavailable`?`no-session`:f?`provider`:void 0,m=p===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:p===`provider`?d===`resume`?a.reason:i.reason:void 0,h=(e,t)=>a.usable?r.mutateAsync({text:e,...t===void 0?{}:{images:t}}):Promise.reject(Error(a.reason??`The run provider is unavailable.`));return{mode:d,blockedBy:p,reason:m,isPending:c||n.isPending||r.isPending,error:o,send:async(t,r)=>{if(p||u.current)return m;u.current=!0,l(!0),s(void 0);try{if(d===`resume`){await zb(()=>h(t,r));return}try{await n.mutateAsync({text:t,...r===void 0?{}:{images:r}})}catch(n){if(n instanceof et&&n.status===409&&xb(e)!==void 0){try{await zb(()=>h(t,r))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Session closed. Retry to reopen the session. ${t}`)}return}throw n}return}catch(e){let t=e instanceof Error?e.message:String(e);return s(t),t}finally{u.current=!1,l(!1)}}}}function Hb({run:e,projectId:t,prNumber:n}){let r=Vb(e,t),i=$a(),[a,o]=(0,Z.useState)(!1),s=a||r.isPending,c=!!r.blockedBy,l=async()=>{if(s||c)return;let e=r.mode===`resume`;o(!0);try{let t=await r.send(Mb(n));t?G(t,{tone:`danger`}):(G(`${e?`Task reopened`:`Sent to the task`} — resolving conflicts${n?` in PR #${n}`:``}`),i())}finally{o(!1)}};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{type:`button`,size:`sm`,"data-slot":`reference-conflict-action`,disabled:c||s,onClick:()=>void l(),className:`h-7 w-full text-xs`,children:s?`Sending…`:`Resolve conflicts`}),c&&r.reason?(0,Q.jsx)(`span`,{className:`block opacity-70`,children:r.reason}):null]})}function Ub({projectId:e,runId:t,prNumber:n}){let r=Bn(e,t);return r.data?(0,Q.jsx)(Hb,{run:r.data,projectId:e,prNumber:n}):(0,Q.jsx)(k,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:r.isError?`Unavailable`:`Loading…`})}function Wb({runId:e,prNumber:t}){let{projectId:n}=eo();return n===void 0?(0,Q.jsx)(Gb,{runId:e,prNumber:t}):(0,Q.jsx)(Ub,{projectId:n,runId:e,prNumber:t})}function Gb({runId:e,prNumber:t}){let n=Xn(e);return n.data?(0,Q.jsx)(Hb,{run:n.data,prNumber:t}):(0,Q.jsx)(k,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:n.isError?`Unavailable`:`Loading…`})}function Kb({run:e,reference:t,className:n,compact:r=!1,plain:i=!1,inert:a=!1}){let{projectId:o,repoBase:s}=eo(),c=o!==void 0&&t.number!==void 0?_i(o,e.id,{kind:t.kind,number:t.number,url:t.url},s):void 0;return(0,Q.jsx)(to,{reference:t,taskTitle:xi(e),to:c,conflictAction:ei({...t,number:t.number??0},s)?(0,Q.jsx)(Wb,{runId:e.id,prNumber:t.number}):void 0,className:n,compact:r,plain:i,inert:a})}var qb=220;function Jb({references:e,taskTitle:t,visibleCount:n,plain:r=!1,projectId:i,runId:a,repoBase:o}){let[s,c]=Z.useState(!1),l=Z.useRef(!1),u=Z.useRef(!1),d=Z.useRef(null),f=Z.useRef(void 0);Z.useEffect(()=>()=>clearTimeout(f.current),[]);let p=e=>e.pointerType!==`touch`,m=()=>clearTimeout(f.current),h=e=>{p(e)&&(m(),s||(l.current=!0),c(!0))},g=e=>{p(e)&&(m(),f.current=setTimeout(()=>c(!1),qb))},_=e.length-n,v=e.slice(n).map(t=>{let n=e.some(e=>e!==t&&e.kind===t.kind&&e.number===t.number)&&t.url?new URL(t.url).pathname.split(`/`).slice(1,3).join(`/`):``;return`${t.kind} #${t.number}${n?` (${n})`:``}`}).join(`, `);return _<=0?null:(0,Q.jsxs)(fi,{open:s,onOpenChange:c,children:[(0,Q.jsx)(li,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`reference-overflow`,title:v,"aria-label":`Show all ${e.length} references for ${t}`,onPointerEnter:h,onPointerLeave:g,onPointerDown:e=>{e.stopPropagation(),u.current=s&&l.current,l.current=!1},onClick:e=>{e.stopPropagation(),s&&(u.current||l.current)&&(e.preventDefault(),m(),d.current?.focus()),u.current=!1,l.current=!1},className:`no-hover:min-h-[44px] no-hover:min-w-[44px] max-md:min-h-[44px] max-md:min-w-[44px] shrink-0 rounded-full px-1 text-[11px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[`+`,_]})}),(0,Q.jsxs)(Qr,{ref:d,align:`start`,collisionPadding:8,className:`w-auto min-w-40 max-h-(--radix-popover-content-available-height) overflow-y-auto overscroll-contain p-1.5`,"data-slot":`reference-overflow-list`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onPointerEnter:h,onPointerLeave:g,onOpenAutoFocus:e=>{e.preventDefault(),!l.current&&e.target instanceof HTMLElement&&e.target.focus()},onKeyDownCapture:e=>{e.key===`Escape`&&(e.preventDefault(),l.current=!1,c(!1))},onCloseAutoFocus:e=>{l.current&&e.preventDefault()},children:[(0,Q.jsx)(`p`,{className:`px-1 pb-1.5 text-[11px] text-soft-foreground`,children:`References`}),(0,Q.jsx)(`span`,{className:`flex flex-col items-start gap-1`,children:e.map(e=>(0,Q.jsx)(to,{reference:e,taskTitle:t,projectId:i,repoBase:o,to:i===void 0?void 0:_i(i,a,e,o),plain:r,className:`no-hover:min-h-[44px] max-md:min-h-[44px]`,conflictAction:i&&ei(e,o)?(0,Q.jsx)(Ub,{projectId:i,runId:a,prNumber:e.number}):void 0},ui(e)))})]})]})}function Yb({references:e,maxVisible:t,taskTitle:n,projectId:r,runId:i,repoBase:a,plain:o=!1,compact:s=!1,inertInline:c=!1,fitContainer:l=!1,overflowContainer:u}){let d=Z.useRef(null),[f,p]=Z.useState(t),m=Z.useRef(new Map),h=e.map(ui).join(`|`);Z.useLayoutEffect(()=>{let n=d.current;if(!l||!n?.parentElement){p(t);return}let r=n.parentElement,i=()=>{[...n.querySelectorAll(`:scope > [data-slot="pr-chip"], :scope > [data-slot="issue-chip"]`)].forEach((t,n)=>{let r=t.getBoundingClientRect().width;r&&m.current.set(ui(e[n]),r)});let i=r.getBoundingClientRect();if(!i.width)return;let a=Math.min(t,e.length);n.dataset.referenceWidth=String(e.slice(0,a).reduce((e,t)=>e+(m.current.get(ui(t))??48),0)+Math.max(0,a-1)*4);let o=0;for(let e=n.nextElementSibling;e;e=e.nextElementSibling){if(e.getAttribute(`data-slot`)===`task-row-age`||e.getAttribute(`aria-hidden`)===`true`&&e.nextElementSibling?.getAttribute(`data-slot`)===`task-row-age`)continue;let t=getComputedStyle(e);o+=e.getBoundingClientRect().width+(parseFloat(t.marginLeft)||0)+(parseFloat(t.marginRight)||0)}let s=i.right-n.getBoundingClientRect().left-o,l=n.querySelector(`[data-slot="reference-overflow"]`)?.getBoundingClientRect().width||(c?44:26),d=Math.min(t,e.length);for(;d>0&&!(e.slice(0,d).reduce((e,t)=>e+(m.current.get(ui(t))??48)+4,0)+(u===void 0&&d<e.length?l:0)<=s+(d===e.length?u?.getBoundingClientRect().width??0:0));)d--;p(d)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);return a.observe(r),a.observe(n),()=>a.disconnect()},[l,t,h,c,e,u]);let g=Math.min(f,t,e.length),_=(0,Q.jsx)(Jb,{references:e,visibleCount:g,taskTitle:n,projectId:r,runId:i,repoBase:a,plain:o});return(0,Q.jsxs)(`span`,{ref:d,"data-slot":`reference-list`,className:`inline-flex max-w-full flex-nowrap items-center gap-1 align-middle`,children:[e.slice(0,g).map(e=>(0,Q.jsx)(to,{reference:e,taskTitle:n,projectId:r,repoBase:a,to:r===void 0?void 0:_i(r,i,e,a),plain:o,compact:s,inert:c,className:`shrink-0`,conflictAction:r&&ei(e,a)?(0,Q.jsx)(Ub,{projectId:r,runId:i,prNumber:e.number}):void 0},ui(e))),u===void 0?_:u?(0,sf.createPortal)(_,u):null]})}function Xb({pinned:e,onToggle:t,className:n}){return(0,Q.jsx)(`button`,{type:`button`,"data-slot":`pin-toggle`,"data-pinned":e?`true`:void 0,"aria-pressed":e,"aria-label":e?`Unpin task`:`Pin task`,title:e?`Unpin from the top of the list`:`Pin to the top of the list`,onClick:n=>{n.stopPropagation(),t(!e)},className:C(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-soft-foreground transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,n,`max-md:min-h-11 max-md:min-w-11 no-hover:min-h-11 no-hover:min-w-11`),children:(0,Q.jsx)(zu,{"data-slot":`pin-icon`,className:`size-[12px]`,fill:e?`currentColor`:`none`,"aria-hidden":`true`})})}var Zb=`opacity-0 group-hover/task-row:opacity-100 focus-visible:opacity-100 group-has-[:focus-visible]/task-row:opacity-100 no-hover:opacity-100`,Qb=`opacity-0 group-hover/task-row:opacity-100 focus-visible:opacity-100 group-has-[:focus-visible]/task-row:opacity-100`,$b=`transition-opacity motion-reduce:transition-none group-hover/task-row:opacity-0 group-has-[:focus-visible]/task-row:opacity-0 max-md:absolute max-md:top-1/2 max-md:left-0 max-md:-translate-y-1/2 max-md:opacity-100 no-hover:absolute no-hover:top-1/2 no-hover:left-0 no-hover:-translate-y-1/2 no-hover:opacity-100`;function ex({run:e,title:t,unread:n,inertReferences:r,onTogglePin:i,onArchiveRun:a}){return(0,Q.jsxs)(`span`,{"data-slot":`task-row-trailing`,className:`relative flex h-[19px] w-[16px] shrink-0 items-center justify-center max-md:h-auto max-md:w-11 max-md:self-stretch no-hover:h-auto no-hover:w-11 no-hover:self-stretch`,children:[n?(0,Q.jsx)($,{tone:Ih(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,"data-slot":`unread-marker`,className:i?$b:void 0}):null,i?(0,Q.jsx)(Xb,{pinned:!!e.pinned,onToggle:t=>i(e,t),className:C(`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2`,Zb)}):null,a&&!r&&Yr(e)?(0,Q.jsx)(`button`,{type:`button`,"data-action":`archive-run`,"aria-label":`Archive ${t}`,title:`Archive task`,onClick:t=>{t.stopPropagation(),a(e)},className:C(`absolute top-[19.5px] left-1/2 inline-flex size-5 -translate-x-1/2 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none motion-reduce:transition-none`,Qb),children:(0,Q.jsx)(ba,{className:`size-[12px] -translate-y-[2.5px]`,"aria-hidden":`true`})}):null]})}function tx({inertReferences:e,swipeable:t,swipe:n,title:r,onArchive:i,children:a}){return e?(0,Q.jsxs)(`div`,{ref:n.surfaceRef,"data-slot":`task-row-swipe`,"data-swipe":t?`on`:void 0,"data-phase":t?n.phase:void 0,className:C(`relative rounded-[6px]`,t&&`touch-pan-y touch-pinch-zoom overflow-hidden`),children:[n.offset<0?(0,Q.jsx)(nx,{width:-n.offset,past:n.past,title:r,onArchive:i}):null,a]}):a}function nx({width:e,past:t,title:n,onArchive:r}){return(0,Q.jsx)(`div`,{"data-slot":`task-row-swipe-action`,"data-past":t?`true`:void 0,"aria-hidden":`true`,style:{width:e},className:C(`absolute inset-y-0 right-0 flex items-stretch justify-end overflow-hidden rounded-[6px]`,t?`bg-info text-signal-ink`:`bg-muted text-foreground`),children:t?(0,Q.jsxs)(`span`,{className:`flex w-full items-center justify-center gap-2 text-[12px] font-semibold whitespace-nowrap`,children:[(0,Q.jsx)(ba,{className:`size-[16px] shrink-0`,"aria-hidden":`true`}),`Release to archive`]}):(0,Q.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Archive ${n}`,onClick:e=>{e.stopPropagation(),r()},className:`flex w-[88px] shrink-0 flex-col items-center justify-center gap-1 text-[12px] font-semibold`,children:[(0,Q.jsx)(ba,{className:`size-[16px]`,"aria-hidden":`true`}),`Archive`]})})}var rx=`[&>[data-ellipsis-hidden]]:pointer-events-none`,ix=`data-ellipsis-hidden`,ax=new Map;function ox(e){let t=getComputedStyle(e),n=`${t.fontStyle} ${t.fontWeight} ${t.fontSize} ${t.fontFamily} ${t.letterSpacing}`,r=ax.get(n);if(r!==void 0)return r;let i=document.createElement(`span`);i.textContent=`…`,i.setAttribute(`aria-hidden`,`true`),Object.assign(i.style,{position:`absolute`,visibility:`hidden`,whiteSpace:`pre`,fontStyle:t.fontStyle,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFamily:t.fontFamily,letterSpacing:t.letterSpacing}),document.body.appendChild(i);let a=i.getBoundingClientRect().width;i.remove();let o=a||parseFloat(t.fontSize)||12;return a&&(!document.fonts||document.fonts.status===`loaded`)&&ax.set(n,o),o}function sx(e,t){if(e.scrollWidth<=e.clientWidth)return[];let n=e.getBoundingClientRect(),r=parseFloat(getComputedStyle(e).paddingRight)||0,i=n.left+e.clientLeft+e.clientWidth-r-t+.5;return Array.from(e.children).filter(e=>e.getBoundingClientRect().right>i)}function cx(e,t,n){Z.useLayoutEffect(()=>{let n=e.current;if(!t||!n||typeof ResizeObserver>`u`)return;let r=!0,i=()=>{if(!r)return;let e=new Set(sx(n,ox(n)));for(let t of Array.from(n.children))t.hasAttribute(ix)!==e.has(t)&&t.toggleAttribute(ix,e.has(t))},a=new ResizeObserver(i),o=new Set,s=()=>{for(let e of Array.from(n.children))o.has(e)||(o.add(e),a.observe(e))};a.observe(n),s(),i();let c=typeof MutationObserver>`u`?null:new MutationObserver(()=>{s(),i()});return c?.observe(n,{childList:!0}),document.fonts&&document.fonts.status!==`loaded`&&document.fonts.ready.then(i),()=>{r=!1,a.disconnect(),c?.disconnect();for(let e of Array.from(n.children))e.removeAttribute(ix)}},[e,t,n])}var lx=`(hover: none)`;function ux(){let[e,t]=(0,Z.useState)(()=>typeof window.matchMedia==`function`&&window.matchMedia(lx).matches);return(0,Z.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(lx);t(e.matches);let n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var dx={"needs-permission":`label`,failed:`label`,"needs-you":`none`,"needs-review":`label`,running:`label`,"usage-limit":`resume`,"waiting-on-workers":`label`,"waiting-on-subagents":`label`,"waiting-for-ci":`label`,"waiting-for-merge":`label`,"waiting-for-command":`until`,monitoring:`next-check`,"waiting-for-capacity":`label`,queued:`queue-position`,done:`none`,cancelled:`none`,unseen:`label`};function fx(e,t,n,r){let{label:i}=e;switch(dx[e.rung]){case`none`:return;case`queue-position`:return t===null?i:`queued #${t}`;case`resume`:{let e=qa(n.autoResumeAt,r),t=n.autoResumeReason===`provider-error`?`provider error`:i;return e===`scheduled`?t:`${t}, ${e}`}case`next-check`:{let e=Rt(n),t=e?.kind===`timer`?new Date(e.at):void 0;return t&&Number.isFinite(t.getTime())?`${i}, next check ${Ja(t,new Date(r))}`:i}case`until`:{let e=Rt(n),t=e?.kind===`process`?new Date(e.deadline):void 0;return t&&Number.isFinite(t.getTime())?`${i}, until ${Ja(t,new Date(r))}`:i}case`label`:return i}}function px({run:e,attention:t,queuePosition:n,inWorkingGroup:r,scope:i,now:a}){let o=Wr(e,void 0,i??void 0),s=n===null?Ga(e.finishedAt??e.createdAt,a):``,c=r&&t.rung===`running`?void 0:fx(t,n,e,a);return{stateWord:c,references:o,age:s,key:`${s}|${c??``}|${o.map(e=>`${e.kind}-${e.number}-${e.url}`).join(`,`)}|${+!!e.notify}`}}function mx(e){let t=xi(e);return{title:t,displayTitle:Ur(t,yi(e)?.number)?Jr(t).rest:t}}function hx(e){let[t,n]=Z.useState(()=>Date.now());return Z.useEffect(()=>{if(te())return;let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var gx=`cez-sidebar-collapsed`,_x=`cez-sidebar-sections-collapsed`;function vx(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 yx(e=gx){try{let t=localStorage.getItem(e);return t===null?{}:vx(JSON.parse(t))}catch{return{}}}function bx(e,t=gx){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}var xx=`cez-sidebar-sections-changed`;function Sx(e){let[t,n]=(0,Z.useState)(()=>yx(_x)),[r,i]=(0,Z.useState)({}),a=(0,Z.useRef)(t);(0,Z.useEffect)(()=>{let e=e=>{if(e instanceof StorageEvent&&e.key!==null&&e.key!==`cez-sidebar-sections-collapsed`)return;let t=e instanceof CustomEvent?e.detail:yx(_x);a.current=t,n(t)};return window.addEventListener(`storage`,e),window.addEventListener(xx,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(xx,e)}},[]),(0,Z.useEffect)(()=>{if(e===null||Object.keys(r).length===0)return;let t={...a.current};for(let[n,i]of Object.entries(r))t[JSON.stringify([e,n])]=i;i({}),a.current=t,n(t),bx(t,_x),window.dispatchEvent(new CustomEvent(xx,{detail:t}))},[e,r]);let o=t=>JSON.stringify([e,t]);return{isCollapsed:e=>e!==`Archived`&&(r[e]??t[o(e)])===!0,toggle:t=>{if(e===null){i(e=>({...e,[t]:e[t]!==!0}));return}let r=o(t),s={...a.current,[r]:a.current[r]!==!0};a.current=s,n(s),bx(s,_x),window.dispatchEvent(new CustomEvent(xx,{detail:s}))}}}function Cx({runs:e,view:t,automations:n,onViewChange:r,currentRunId:i=null,now:a=Date.now(),onTogglePin:o,onArchiveRun:s,onSweep:c,sweeping:l=null,showViewControls:u=!0,rowLimit:d,sidebarLimits:f,projectId:p=null}){let m=od(),h=Pr(e,n),g=Kr(e,t,n),_=Rr(g,`active`),v=ii(_,f??d??{overall:null}),y=c?wx(g):void 0;return(0,Q.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,Q.jsxs)(`div`,{"data-slot":`quick-list-header`,className:`flex min-h-11 items-center gap-1.5 pr-[6px] pl-[10px] md:min-h-[26px]`,children:[(0,Q.jsx)(`h2`,{className:`text-[13px] font-semibold text-foreground`,children:`Tasks`}),(0,Q.jsx)(`span`,{className:`text-[11.5px] text-soft-foreground`,children:h[t]}),(0,Q.jsxs)(Y,{to:`/`,onClick:m,className:`ml-auto flex min-h-11 items-center gap-0.5 text-[12px] text-soft-foreground hover:text-foreground md:min-h-[26px]`,children:[`All`,(0,Q.jsx)(Sa,{className:`size-[13px]`,"aria-hidden":`true`})]})]}),u?(0,Q.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,Q.jsx)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[2px]`,children:(0,Q.jsx)(Rx,{view:t,automations:n,onSelect:r,counts:h})})}):null,_.length===0?(0,Q.jsx)(`p`,{className:`px-3 py-3.5 text-xs text-soft-foreground`,children:t===`automations`?`No automation tasks.`:`No tasks yet — describe one.`}):(0,Q.jsx)(Tx,{buckets:v,allBuckets:_,sectionProjectId:p,currentRunId:qr(i,e),now:a,onTogglePin:o,onArchiveRun:s,onSweep:c,sweeping:l,sweepCounts:y,view:t,automations:n})]})}function wx(e){return{unpinned:ti(e,`unpinned`),pinned:ti(e,`pinned`)}}function Tx({buckets:e,currentRunId:t=null,now:n=Date.now(),scope:r=null,onTogglePin:i,onArchiveRun:a,onSweep:o,sweeping:s=null,sweepCounts:c,projectName:l,allBuckets:u=e,sectionProjectId:d=r,view:f=`active`,automations:p}){let m=Z.useId(),h=Sx(d),g=Z.useRef(null),_=Z.useRef(null);Z.useLayoutEffect(()=>{let e=_.current;if(!e||e.element.isConnected||(_.current=null,document.activeElement!==document.body))return;let t=u.find(t=>t.rows.some(t=>t.run.id===e.id));if(!t)return;let n=Array.from(g.current?.children??[]).find(e=>e.dataset.bucket===t.label);(Array.from(n?.querySelectorAll(`[data-slot="task-row"]`)??[]).find(t=>t.dataset.runId===e.id)?.querySelector(`a`)??n?.querySelector(`[data-slot="section-toggle"]`))?.focus({preventScroll:!0})});let v=(e,o=!1)=>(0,Q.jsx)(Nx,{inWorkingGroup:o,run:e.run,queuePosition:e.queuePosition,currentRunId:t,now:n,scope:r,onTogglePin:i,onArchiveRun:a});return(0,Q.jsx)(`div`,{ref:g,className:`flex flex-col gap-3`,onFocusCapture:e=>{let t=e.target.closest(`[data-slot="task-row"]`);_.current=t?.dataset.runId?{id:t.dataset.runId,element:e.target}:null},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||(_.current=null)},children:u.map(t=>{let n=t.label===`Archived`,i=h.isCollapsed(t.label),a=e.find(({label:e})=>e===t.label)?.rows??[],u=t.rows.length,d=!n&&!i&&a.length<u,g=`${m}-${t.label.replaceAll(` `,`-`)}`;return(0,Q.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":t.label,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pr-[6px]`,children:[(0,Q.jsx)(Dx,{id:g,bucket:t,collapsed:i,cut:d,onToggle:h.toggle}),d?(0,Q.jsx)(Ex,{section:t.label,shown:a.length,total:u,scope:r,view:f,automations:p}):null,o&&c?(0,Q.jsx)(Ix,{label:t.label,headingId:g,projectName:l,counts:c,onSweep:o,sweeping:s}):null]}),(0,Q.jsx)(`div`,{id:`${g}-rows`,hidden:i,children:!i&&a.map(e=>(0,Q.jsx)(`div`,{children:v(e,t.label===`Working`)},e.run.id))})]},t.label)})})}function Ex({section:e,shown:t,total:n,scope:r,view:i,automations:a}){let o=od();return(0,Q.jsxs)(Y,{to:hs(r,kr(e,i,a)),onClick:o,"data-slot":`section-cut-link`,"aria-label":`${e}: showing ${t} of ${n}, see all`,title:`The sidebar shows ${t} of ${n} ${e} tasks. Click to see all of them. Change the limit in ${Qa(`sidebar`)}.`,className:`mr-auto -ml-1 flex min-h-[44px] min-w-[44px] shrink-0 items-center rounded-[4px] px-1 text-[11px] font-normal text-soft-foreground tabular-nums underline decoration-dotted underline-offset-[3px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground md:min-h-[26px] md:min-w-0 no-hover:min-h-[44px] no-hover:min-w-[44px]`,children:[t,` of `,n]})}function Dx({id:e,bucket:t,collapsed:n,cut:r,onToggle:i}){let a=t.rows.length;if(t.label===`Archived`)return(0,Q.jsx)(`h2`,{id:e,className:`min-w-0 flex-1 text-[11px] font-medium text-soft-foreground`,children:(0,Q.jsxs)(`span`,{className:`px-[10px] pt-[2px] pb-[4px]`,children:[t.label,` `,a]})});let o=t.label,s=t.rows.map(e=>e.run),c=s.length?Ce(Mr(s)):null,l=s.some(Zr),u=n?Sa:ua;return(0,Q.jsx)(`h2`,{id:e,className:C(`min-w-0 text-[11px] font-medium text-soft-foreground`,r?`shrink-0`:`flex-1`),children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`section-toggle`,"aria-expanded":!n,"aria-controls":`${e}-rows`,"aria-label":`${o} ${a}`,onClick:()=>i(o),className:C(`flex min-h-[44px] items-center gap-1.5 rounded-[4px] px-[10px] text-left hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground md:min-h-[26px] no-hover:min-h-[44px]`,r?`pr-[4px]`:`w-full`),children:[(0,Q.jsx)(u,{className:`size-[12px] shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:o}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(`span`,{className:`font-normal tabular-nums`,children:a})]}),c&&(o===`Needs you`||n)?(0,Q.jsx)($,{tone:c.tone,shape:c.shape,pulse:c.pulse,role:`img`,"aria-label":c.label,title:c.label}):null,n&&l?(0,Q.jsx)(`span`,{role:`img`,"aria-label":`unread`,title:`Unread tasks`,className:`size-[5px] shrink-0 rounded-full bg-foreground`}):null]})})}function Ox({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`view-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:C(`flex min-h-11 min-w-0 flex-1 items-center justify-center gap-1.5 rounded-[7px] text-[11px] font-medium text-muted-foreground md:min-h-[22px]`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,Q.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function kx(){let e=ux(),t=ci();return e||!t}function Ax(e){let t=document.createRange();t.selectNodeContents(e);let n=t.getBoundingClientRect?.().width,r=e.querySelector(`[data-reference-width]`),i=r?Math.max(0,Number(r.dataset.referenceWidth)-r.getBoundingClientRect().width):0;return Math.ceil((n||e.scrollWidth)+i)}function jx(e,t,n){let[r,i]=Z.useState(!1),[a,o]=Z.useState(0),s=Z.useRef(!1),c=Z.useRef(!1),l=Z.useRef(null),u=Z.useCallback(e=>{s.current=e,i(e)},[]);return Z.useLayoutEffect(()=>{let r=e.current;if(!t||!r||typeof ResizeObserver>`u`){l.current=null,u(!1);return}let i=!0,a=()=>{if(i){if(l.current?.key!==n){if(s.current){u(!1),o(e=>e+1);return}l.current={key:n,width:Ax(r)}}u(l.current.width>r.clientWidth)}};a();let d=new ResizeObserver(a);d.observe(r);let f=new WeakMap,p=new ResizeObserver(e=>{let t=!1;for(let n of e??[]){let e=n.borderBoxSize?.[0]?.inlineSize??n.contentRect.width,r=f.get(n.target);f.set(n.target,e),r!==void 0&&r!==e&&(t=!0)}!t||!i||(l.current=null,a())}),m=new Set,h=()=>{let e=!1;for(let t of[...r.children,...r.querySelectorAll(`[data-slot="reference-list"] [data-slot="pr-chip"], [data-slot="reference-list"] [data-slot="issue-chip"]`)]){let{slot:n}=t.dataset;n===`task-row-age`||t.getAttribute(`aria-hidden`)===`true`||m.has(t)||(m.add(t),f.set(t,t.getBoundingClientRect().width),p.observe(t),e=!0)}return e};h();let g=typeof MutationObserver>`u`?null:new MutationObserver(()=>{!h()||!i||(l.current=null,a())});return g?.observe(r,{childList:!0,subtree:!0}),document.fonts&&document.fonts.status!==`loaded`&&!c.current&&document.fonts.ready.then(()=>{c.current=!0,i&&(l.current=null,a())}),()=>{i=!1,d.disconnect(),p.disconnect(),g?.disconnect()}},[e,t,n,a,u]),t&&r}function Mx(){return(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:` · `})}function Nx({run:e,queuePosition:t,currentRunId:n,now:r,scope:i,inWorkingGroup:a=!1,onTogglePin:o,onArchiveRun:s}){let c=gs(),l=od(),u=kx(),d=!!s&&u&&Yr(e),f=db({id:e.id,enabled:d,onArchive:()=>s?.(e)}),p=hs(i,`/tasks/${e.id}`),m=Ce(e),h=e.id===n,{title:g,displayTitle:_}=mx(e),v=Zr(e),y=px({run:e,attention:m,queuePosition:t,inWorkingGroup:a,scope:i,now:r}),[b,x]=Z.useState(null);return(0,Q.jsx)(tx,{inertReferences:u,swipeable:d,swipe:f,title:g,onArchive:()=>void s?.(e),children:(0,Q.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":h?`true`:void 0,onClick:e=>{e.currentTarget.contains(e.target)&&(e.target.closest(`a, button, input`)||(c(p),l?.()))},...d?f.bind:{},style:f.offset?{transform:`translateX(${f.offset}px)`}:void 0,className:C(`selection-row group/task-row flex cursor-pointer items-start gap-2.5 rounded-[6px] py-1.5 pr-2 pl-2.5 hover:bg-sidebar-row-hover`,d&&`select-none`,d&&f.phase!==`dragging`&&`motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-out`,h&&`bg-sidebar-row-selected hover:bg-sidebar-row-selected`),children:[(0,Q.jsx)(`span`,{"data-slot":`task-row-dot`,className:`flex h-[19px] w-[12px] shrink-0 items-center justify-center`,children:(0,Q.jsx)($,{tone:m.tone,shape:m.shape,pulse:m.pulse,"aria-label":m.label,title:m.label,role:`img`})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(Px,{run:e,to:p,title:g,displayTitle:_,isActive:h,unread:v,swipeable:d,onNavigate:l}),(0,Q.jsx)(Fx,{run:e,meta:y,title:g,scope:i,isActive:h,inertReferences:u,overflowContainer:b})]}),y.references.length?(0,Q.jsx)(`span`,{ref:x,"data-slot":`protected-reference-overflow`,className:C(`shrink-0 self-end`,u&&`-my-1.5 self-center`)}):null,e.delegation?.role===`worker`?(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`Worker · `,m.label]}):null,(0,Q.jsx)(ex,{run:e,title:g,unread:v,inertReferences:u,onTogglePin:o,onArchiveRun:s})]})})}function Px({run:e,to:t,title:n,displayTitle:r,isActive:i,unread:a,swipeable:o,onNavigate:s}){return(0,Q.jsxs)(Y,{to:t,onClick:s,title:n,"aria-current":i?`page`:void 0,draggable:!o&&void 0,className:`flex h-[19px] min-w-0 items-center gap-2 rounded-[2px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,children:[(0,Q.jsx)(`span`,{"data-slot":`task-row-title`,className:C(`min-w-[7rem] flex-1 truncate text-[13px] leading-[1.45] font-medium text-muted-foreground`,a&&`font-semibold text-foreground`,i&&`text-foreground`),children:r}),e.diffStat?(0,Q.jsx)(pb,{stat:e.diffStat,className:`hidden shrink-0 text-[12px] @min-[23rem]/sidebar:inline`}):null]})}function Fx({run:e,meta:t,title:n,scope:r,isActive:i,inertReferences:a,overflowContainer:o}){let{stateWord:s,references:c,age:l,key:u}=t,d=eo(),f=Z.useRef(null),p=jx(f,!!l,u);cx(f,!a&&c.length>0,`${u}|${+!!p}`);let m=[];return s&&m.push((0,Q.jsx)(`span`,{"data-slot":`task-row-state`,children:s},`state`)),c.length&&m.push((0,Q.jsx)(Yb,{references:c,maxVisible:2,taskTitle:n,projectId:r??d.projectId,repoBase:d.repoBase,runId:e.id,plain:!0,compact:!0,inertInline:a,fitContainer:!0,overflowContainer:o},`references`)),l&&!p&&m.push((0,Q.jsx)(`span`,{"data-slot":`task-row-age`,className:`tabular-nums`,children:l},`age`)),(0,Q.jsxs)(`div`,{ref:f,"data-slot":`task-row-meta`,className:C(`h-[16px] min-w-0 truncate text-[11.5px] leading-[1.4] font-normal text-soft-foreground`,rx,i&&`text-muted-foreground`),children:[e.notify===!0?(0,Q.jsx)(`span`,{"data-slot":`task-row-notify`,role:`img`,"aria-label":`Notifying the task webhook`,title:`Notifying the task webhook`,className:`mr-[4px] inline-block shrink-0 align-[-1px]`,children:(0,Q.jsx)(Hu,{"aria-hidden":`true`,className:`size-[10px]`})}):null,m.length?m.flatMap((e,t)=>t?[(0,Q.jsx)(Mx,{},`sep-${t}`),e]:[e]):e.notify===!0?null:`\xA0`]})}function Ix({label:e,headingId:t,projectName:n,counts:r,onSweep:i,sweeping:a}){let o=e===`Finished`?`unpinned`:null;if(!o||r[o]===0)return null;let s=a===o,c=`Archive all`;return(0,Q.jsxs)(`button`,{type:`button`,"data-action":`archive-group`,"data-scope":o,disabled:s,"aria-busy":s?`true`:void 0,"aria-label":n?`${c}, ${n}`:void 0,"aria-describedby":t,onClick:()=>i(o),className:`relative inline-flex shrink-0 items-center gap-1 rounded-[4px] px-1.5 py-0.5 font-sans text-[11px] leading-[1.4] text-muted-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground disabled:opacity-60 max-md:before:absolute max-md:before:top-1/2 max-md:before:left-0 max-md:before:h-11 max-md:before:w-full max-md:before:-translate-y-1/2 max-md:before:content-[''] no-hover:before:absolute no-hover:before:top-1/2 no-hover:before:left-0 no-hover:before:h-11 no-hover:before:w-full no-hover:before:-translate-y-1/2 no-hover:before:content-['']`,children:[(0,Q.jsx)(ba,{className:`size-[11px]`,"aria-hidden":`true`}),c]})}function Lx({showViewControls:e=!0,projectId:t,boot:n=!1}){let r=od(),i=t??c(),a=gn(i,!0,n),o=Sn(i,!0,n).data?.sidebarLimits??{},s=Sr(fr({projectId:i,boot:n})),l=nb(fr({projectId:i,boot:n}),r),u=En(),[d,f,p]=cy(),m=vs(`/tasks/:id/*`),h=vs(`/tasks/:id`),g=hx(3e4),_=Mn(),v=t??_,y=Ln(v),b=ii(Rr(Kr(a.data??[],d,p),`active`),o),x=v===void 0?[]:b.flatMap(e=>e.rows.flatMap(({run:e})=>Wr(e,y).filter(e=>ei(e,y)).map(e=>({projectId:v,kind:e.kind,number:e.number}))));return a.data?(0,Q.jsx)(Za,{projectId:v,repoBase:y,requests:x,children:(0,Q.jsx)(Cx,{showViewControls:e,sidebarLimits:o,projectId:v==="default"?u.data?.bootProject??null:v??null,runs:a.data,view:d,automations:p,onViewChange:f,currentRunId:m?.params.id??h?.params.id??null,now:g,onTogglePin:(e,t)=>s.mutate({id:e.id,pinned:t}),onArchiveRun:l.archiveOne,onSweep:e=>l.sweep(e,p?d===`automations`:void 0),sweeping:l.sweeping})}):null}function Rx({view:e,automations:t,onSelect:n,counts:r}){let i=(0,Q.jsx)($,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`needs you`});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Ox,{view:`active`,current:e,onSelect:n,count:r.active,children:[`Active`,r.activeWaiting>0&&e!==`active`?i:null]}),t?(0,Q.jsxs)(Ox,{view:`automations`,current:e,onSelect:n,count:r.automations,children:[`Automations`,r.automationsWaiting>0&&e!==`automations`?i:null]}):null]})}var zx=e=>e.available?`success`:`danger`,Bx=e=>e.available?`Installed`:`Not installed`,Vx=e=>e.available?null:e.hint??null,Hx=`/settings/agents`,Ux=`inline-flex items-center rounded-sm text-xs font-medium text-foreground hover:underline focus-visible:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring max-md:min-h-11 no-hover:min-h-11`,Wx=(e,t)=>wi(t).includes(e.name);function Gx(e,t){let n=e.checks.filter(e=>Wx(e,t));if(n.length&&!n.some(e=>e.available))return`no agent CLI found — install one to run tasks`;let r=n.find(t=>t.name===e.defaultRunner);return r&&!r.available?`default runner (${e.defaultRunner}) not found`:null}function Kx(e,t){let n=`Squawk v${e.version}`;if(t===void 0)return n;let r=Gx(e,t);if(r)return`${n} · ${r}`;let i=e.checks.filter(e=>!e.available).map(e=>e.name);return i.length?`${n} · optional: ${i.join(`, `)} not installed`:n}function qx(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 Jx({health:e,runners:t,sessionScope:n}){if(!e)return null;let r=Gx(e,t);return(0,Q.jsxs)(No,{children:[(0,Q.jsx)(Ao,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,"aria-label":`Tools`,title:Kx(e,t),className:`relative flex items-center gap-1.5 rounded-[6px] px-2 py-1.5 text-[12px] font-normal text-soft-foreground transition-colors hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-[state=open]:bg-sidebar-row-selected data-[state=open]:text-foreground`,children:[(0,Q.jsx)(ta,{className:`size-[15px]`,"aria-hidden":`true`}),r?(0,Q.jsx)($,{tone:`pending`,className:`absolute top-1 left-5 size-1.5`}):null,`Tools`]})}),(0,Q.jsxs)(jo,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[n?(0,Q.jsx)(`div`,{className:`px-2 py-2`,children:n}):null,(0,Q.jsx)(yo,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,Q.jsx)(Yx,{check:e},e.name):(0,Q.jsx)(Xx,{check:e},e.name)),qx(e)?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Do,{}),(0,Q.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-[11px] leading-snug text-muted-foreground`,children:qx(e)})]}):null,(0,Q.jsx)(Do,{}),(0,Q.jsx)(Eo,{asChild:!0,children:(0,Q.jsx)(E,{to:`/tools`,children:`Tools diagnostics`})}),(0,Q.jsx)(Eo,{asChild:!0,children:(0,Q.jsxs)(Y,{to:Hx,"data-slot":`tools-settings`,className:`gap-2 text-[13px] text-muted-foreground`,children:[(0,Q.jsx)(Ui,{className:`size-3.5`,"aria-hidden":`true`}),`Tool settings`]})})]})]})}function Yx({check:e}){return(0,Q.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,Q.jsx)($,{tone:zx(e)}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] font-medium`,children:e.name}),(0,Q.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11px] font-medium text-muted-foreground tabular-nums`,children:e.version??`not found`})]})}function Xx({check:e}){let t=Vx(e);return(0,Q.jsx)(Eo,{asChild:!0,children:(0,Q.jsxs)(Y,{to:Hx,"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)($,{tone:zx(e)}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] font-medium`,children:e.name}),(0,Q.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11px] font-medium text-muted-foreground`,children:`not found`})]}),(0,Q.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[t?(0,Q.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-[11px] leading-snug text-muted-foreground`,children:t}):null,(0,Q.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-[11px] font-semibold text-accent-text`,children:`Set up →`})]})]})})}function Zx(e){return e?.trim()||null}function Qx({projectName:e,pageLabel:t}){let n=Zx(e),r=Zx(t);return n&&r?`${n} — ${r} · Squawk`:n?`${n} · Squawk`:r?`${r} · Squawk`:`Squawk`}function $x(e){let t=Qx(e);(0,Z.useEffect)(()=>{document.title=t},[t])}function eS({...e}){return(0,Q.jsx)(qd,{"data-slot":`alert-dialog`,...e})}function tS({...e}){return(0,Q.jsx)(Jd,{"data-slot":`alert-dialog-portal`,...e})}function nS({className:e,...t}){return(0,Q.jsx)(Yd,{"data-slot":`alert-dialog-overlay`,className:C(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none`,e),...t})}function rS({className:e,...t}){return(0,Q.jsxs)(tS,{children:[(0,Q.jsx)(nS,{}),(0,Q.jsx)(Xd,{"data-slot":`alert-dialog-content`,className:C(`fixed inset-bs-[50%] start-[50%] z-50 grid max-h-[calc(100dvh-2rem)] overflow-y-auto overscroll-contain w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-hidden motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95 motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none sm:max-w-md`,e),...t})]})}function iS({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:C(`flex flex-col gap-2 text-center sm:text-start`,e),...t})}function aS({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:C(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function oS({className:e,...t}){return(0,Q.jsx)($d,{"data-slot":`alert-dialog-title`,className:C(`text-lg leading-none font-semibold`,e),...t})}function sS({className:e,...t}){return(0,Q.jsx)(ef,{"data-slot":`alert-dialog-description`,className:C(`text-sm text-muted-foreground`,e),...t})}function cS({className:e,...t}){return(0,Q.jsx)(Zd,{"data-slot":`alert-dialog-action`,className:C(T({variant:`contrast`}),e),...t})}function lS({className:e,...t}){return(0,Q.jsx)(Qd,{"data-slot":`alert-dialog-cancel`,className:C(T({variant:`outline`}),e),...t})}function uS(e){let t=bs(e);return/^\/git\/branches(?:\/|$)/.test(t)?`branches`:/^\/git\/not-landed(?:\/|$)/.test(t)?`not-landed`:/^\/git\/cleanup(?:\/|$)/.test(t)?`cleanup`:/^\/git\/changes(?:\/|$)/.test(t)?`changes`:/^\/git(?:\/commits(?:\/[^/]+)?)?\/?$/.test(t)?`main`:null}var dS={main:`/git`,"not-landed":`/git/not-landed`,cleanup:`/git/cleanup`,branches:`/git/branches`,changes:`/git/changes`},fS=`/git?view=repo`,pS={second:`s`,minute:`m`,hour:`h`,day:`d`,week:`w`,month:`mo`,year:`y`};function mS(e){let t=/^(\d+) (second|minute|hour|day|week|month|year)s? ago$/.exec(e.trim());return t?`${t[1]}${pS[t[2]]}`:e}function hS(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}var gS=new Intl.DateTimeFormat(`en-US`,{weekday:`short`,month:`short`,day:`numeric`}),_S=new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,year:`numeric`});function vS(e,t){let n=Date.parse(e);if(Number.isNaN(n))return`Earlier`;let r=hS(t);if(n>=r)return`Today`;if(n>=hS(r-1))return`Yesterday`;let i=new Date(n);return(i.getFullYear()===new Date(t).getFullYear()?gS:_S).format(i)}function yS(e,t=Date.now()){let n=[];for(let r of e){let e=vS(r.at,t),i=n.at(-1);i?.label===e?i.commits.push(r):n.push({label:e,commits:[r]})}return n}function bS(e,t=Date.now()){return e.filter(e=>vS(e.at,t)===`Today`).length}function xS(e,t){return(e.baseBranch??t.branch)===t.branch?e.tracking:null}function SS(e,t=Date.now()){let n=e.fetchedAt?Ga(e.fetchedAt,t):``;return n?`fetched ${n} ago`:`never fetched`}function CS(e,t){let n=I(),r=[e,`repo`],i=[e,`health`],[a,o]=(0,Z.useState)(null),s=e=>G(e.message,{tone:`danger`}),c=()=>Promise.all([n.invalidateQueries({queryKey:r}),n.invalidateQueries({queryKey:i}),n.invalidateQueries({queryKey:V.projects})]),l=H({mutationFn:t=>Ke(t,e)}),u=async(e=!1)=>{let n=a?.branch??t.branch;try{let t=await l.mutateAsync(e?{branch:n,confirm:!0}:{branch:n});if(`risks`in t){o(t);return}o(null),G(t.summary),await c()}catch(e){o(null),G(e instanceof Error?e.message:String(e),{tone:`danger`}),await c()}},d=H({mutationFn:t=>ae({name:t},e),onSuccess:async e=>{G(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await c(),n.setQueryData(r,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),n.setQueryData(i,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:s}),f=H({mutationFn:t=>jt({baseBranch:t},e),onSuccess:t=>{G(t.baseBranch?`New tasks now start from ${t.baseBranch}`:`New tasks now start from the checked-out branch`),n.invalidateQueries({queryKey:r}),n.invalidateQueries({queryKey:[e,`config`]})},onError:s});return{hasRemote:!!t.remote,pull:u,pulling:l.isPending,confirmation:a,dismissConfirmation:()=>{l.isPending||o(null)},switchBranch:d,setBase:f}}var wS={sidebar:{card:`gap-[8px] rounded-[8px] p-[10px]`,branchRow:`gap-[6px]`,branchIcon:`size-[14px]`,branch:`text-[12.5px]`,chevron:`size-[12px]`,pull:`h-[24px] gap-[4px] rounded-[6px] px-[8px] text-[11.5px] [&>svg]:size-[12px]`,line:`text-[11px]`,lineChevron:`size-[11px]`,dirty:`gap-[6px] pt-[6px] text-[11px] [&>svg]:size-[12px]`},screen:{card:`gap-[10px] rounded-[10px] p-[12px]`,branchRow:`gap-[8px]`,branchIcon:`size-[16px]`,branch:`text-[14px]`,chevron:`size-[14px]`,pull:`h-[36px] gap-[6px] rounded-[8px] px-[14px] text-[13px] [&>svg]:size-[14px]`,line:`text-[12px]`,lineChevron:`size-[12px]`,dirty:`h-[40px] gap-[8px] pt-[4px] text-[13px] [&>svg:first-child]:size-[14px] [&>svg:last-child]:size-[15px]`}};function TS({scope:e,repo:t,info:n,variant:r,onNavigate:i}){let a=wS[r],o=CS(e,n),s=t.baseBranch??n.branch,c=t.status.length,l=xS(t,n),u=o.switchBranch.isPending,d=(0,Z.useRef)(null);return(0,Q.jsxs)(`section`,{"aria-label":`Checkout`,"data-slot":`git-checkout`,"data-variant":r,className:C(`flex flex-col border border-border`,a.card),children:[(0,Q.jsxs)(`div`,{className:C(`flex min-w-0 items-center`,a.branchRow),children:[(0,Q.jsxs)(No,{children:[(0,Q.jsxs)(Ao,{"data-slot":`git-branch-menu`,"aria-label":`Branch ${n.branch}. Switch branch`,disabled:u,className:C(`group flex min-w-0 flex-1 items-center rounded-[4px] text-left outline-none focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,a.branchRow,r===`screen`&&`min-h-11`),children:[(0,Q.jsx)(ji,{"aria-hidden":`true`,className:C(`shrink-0 text-muted-foreground`,a.branchIcon)}),(0,Q.jsx)(`span`,{"data-slot":`git-checkout-branch`,className:C(`min-w-0 flex-1 truncate font-mono font-semibold text-foreground`,a.branch),children:n.branch}),(0,Q.jsx)(ua,{"aria-hidden":`true`,className:C(`shrink-0 text-soft-foreground group-hover:text-foreground`,a.chevron)})]}),(0,Q.jsxs)(jo,{align:`start`,className:`w-64`,children:[(0,Q.jsx)(yo,{className:`text-xs text-soft-foreground`,children:`Switch branch`}),(0,Q.jsx)(Mo,{value:n.branch,onValueChange:e=>{e!==n.branch&&o.switchBranch.mutate(e)},children:t.branches.map(e=>(0,Q.jsx)(xo,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,Q.jsx)(`span`,{className:`truncate`,children:e})},e))}),(0,Q.jsx)(Do,{}),(0,Q.jsx)(Eo,{asChild:!0,children:(0,Q.jsx)(Y,{to:dS.branches,"data-slot":`git-branch-menu-all`,onClick:i,children:`Create or find a branch…`})})]})]}),(0,Q.jsxs)(`button`,{ref:d,type:`button`,"data-action":`repo-pull`,disabled:!o.hasRemote||o.pulling,title:o.hasRemote?`Pull ${n.branch}`:`No remote configured. Add a Git remote before pulling.`,onClick:()=>void o.pull(),className:C(`inline-flex shrink-0 items-center bg-muted font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100`,a.pull),children:[o.pulling?(0,Q.jsx)(Wa,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Q.jsx)(da,{"aria-hidden":`true`}),`Pull`]})]}),l?(0,Q.jsx)(ES,{tracking:l,className:a.line}):null,(0,Q.jsxs)(No,{children:[(0,Q.jsxs)(Ao,{"data-slot":`base-branch-picker`,"aria-label":`New tasks start from ${s}. Change the base branch`,disabled:o.setBase.isPending,className:C(`group flex min-w-0 items-center gap-[4px] self-start rounded-[4px] text-soft-foreground outline-none hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,a.line,r===`screen`&&`min-h-[32px]`),children:[(0,Q.jsx)(`span`,{className:`shrink-0`,children:`New tasks start from`}),(0,Q.jsx)(`span`,{"data-slot":`base-branch`,className:`min-w-0 truncate font-mono text-muted-foreground group-hover:text-foreground`,children:s}),(0,Q.jsx)(ua,{"aria-hidden":`true`,className:C(`shrink-0`,a.lineChevron)})]}),(0,Q.jsxs)(jo,{align:`start`,className:`w-64`,children:[(0,Q.jsx)(yo,{className:`text-xs text-soft-foreground`,children:`New tasks start from`}),(0,Q.jsxs)(Mo,{value:t.baseBranch??``,onValueChange:e=>o.setBase.mutate(e===``?null:e),children:[(0,Q.jsx)(xo,{value:``,"data-branch":``,className:`text-[12.5px]`,children:`The checked-out branch (default)`}),t.branches.map(e=>(0,Q.jsx)(xo,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,Q.jsx)(`span`,{className:`truncate`,children:e})},e))]})]})]}),c>0?(0,Q.jsxs)(Y,{to:dS.changes,"data-slot":`git-uncommitted`,onClick:i,className:C(`flex min-w-0 items-center border-t border-border text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,a.dirty),children:[(0,Q.jsx)(ma,{"aria-hidden":`true`,className:`shrink-0 text-inbox-count-foreground`}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[c,` uncommitted file`,c===1?``:`s`]}),(0,Q.jsx)(Sa,{"aria-hidden":`true`,className:`shrink-0 text-soft-foreground`})]}):null,(0,Q.jsx)(DS,{checkout:o,returnFocus:d})]})}function ES({tracking:e,className:t}){let n=e.ref.split(`/`)[0]||e.ref,r=SS(e);return(0,Q.jsx)(`p`,{"data-slot":`git-freshness`,className:C(`flex min-w-0 items-center gap-[4px] text-soft-foreground`,t),children:e.behind>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{"data-slot":`git-behind`,className:`shrink-0 font-medium text-inbox-count-foreground`,children:[e.behind,` behind `,n]}),(0,Q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,r]})]}):(0,Q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`up to date · `,r]})})}function DS({checkout:e,returnFocus:t}){return(0,Q.jsx)(eS,{open:e.confirmation!==null,onOpenChange:t=>!t&&e.dismissConfirmation(),children:(0,Q.jsxs)(rS,{onCloseAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,Q.jsxs)(iS,{children:[(0,Q.jsxs)(oS,{children:[`Pull `,e.confirmation?.branch,` anyway?`]}),(0,Q.jsx)(sS,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[e.confirmation?.risks.includes(`active_runs`)?(0,Q.jsx)(`p`,{children:`An active session is using this repository. Pulling can change files while it works.`}):null,e.confirmation?.risks.includes(`dirty_tree`)?(0,Q.jsx)(`p`,{children:`The checkout has dirty files. Git may refuse the pull to protect them.`}):null]})})]}),(0,Q.jsxs)(aS,{children:[(0,Q.jsx)(lS,{className:`h-11`,disabled:e.pulling,children:`Cancel`}),(0,Q.jsx)(cS,{className:`h-11`,disabled:e.pulling||e.confirmation===null,onClick:t=>{t.preventDefault(),e.pull(!0)},children:e.pulling?`Pulling…`:`Pull anyway`})]})]})})}var OS={main:ca,"not-landed":wu,cleanup:Ql,branches:ji};function kS(e,t){switch(e){case`main`:return t?`Recently on ${t}`:`Recent commits`;case`not-landed`:return`Not landed`;case`cleanup`:return`Cleanup`;case`branches`:return`All branches`;case`changes`:return`Uncommitted changes`}}var AS=[`main`,`not-landed`,`cleanup`,`branches`];function jS({branch:e,counts:t,variant:n,active:r,onNavigate:i}){let a=n===`screen`;return(0,Q.jsx)(`nav`,{"aria-label":`Git sections`,"data-slot":`git-sections`,className:a?ka:Oa,children:AS.map(n=>{let o=OS[n],s=!a&&r===n,c=t[n];return(0,Q.jsxs)(Y,{to:a&&n===`main`?fS:dS[n],"data-git-section":n,"aria-current":s?`page`:void 0,onClick:i,className:C(a?Aa:C(Pa,`text-[12.5px]`),Na,s&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:[(0,Q.jsx)(o,{"aria-hidden":`true`,className:a?Ba:Ia}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:kS(n,e)}),c?(0,Q.jsx)(`span`,{"data-slot":`git-section-count`,className:a?Fa:ja,children:c}):null,a?(0,Q.jsx)(Sa,{"aria-hidden":`true`,className:za}):null]},n)})})}async function MS(e,t){return ct(await Et.api.v1.p[`:projectId`].repo.branches.counts.$get({param:{projectId:t??c()}},Te(e)),`/repo/branches/counts`)}function NS(e){return wr({queryKey:[e,`repo`,`branches`,`counts`],queryFn:({signal:t})=>MS({signal:t},e)})}function PS(e,t,n){let r=dr(e),i=NS(e),a=r.data?.totalBytes??null,o=i.data?.counts??null,s=t&&n===`screen`?bS(t.log):0;return{main:s>0?`${s} today`:null,"not-landed":o?.notLanded?String(o.notLanded):null,cleanup:a?gi(a):r.data&&a===null&&o?.cleanup?String(o.cleanup):null,branches:t?String(i.data?.allBranches??t.branches.length):null}}function FS({scope:e}){let t=vn(e),{pathname:n}=a(),r=od(),i=t.data?.info?t.data:null,o=PS(e,i,`sidebar`);return(0,Q.jsxs)(`div`,{"data-slot":`git-sidebar`,role:`region`,"aria-label":`Git`,className:Va,children:[i?.info?(0,Q.jsx)(TS,{scope:e,repo:i,info:i.info,variant:`sidebar`,onNavigate:r},e):t.isPending?(0,Q.jsx)(`div`,{"data-slot":`git-checkout-placeholder`,"aria-hidden":`true`,className:`h-[94px] rounded-[8px] border border-border`}):null,t.isPending?null:(0,Q.jsx)(jS,{branch:i?.info?.branch??null,counts:o,variant:`sidebar`,active:uS(n),onNavigate:r})]})}var IS={assigned:$i,"no-task":Ha,"has-task":ya,all:ha,review:Ua,mine:Ii,failing:ia,"all-prs":ha};function LS(e,t){return e===`assigned`||e===`mine`?t.identity:e===`no-task`||e===`has-task`?t.tasks:null}function RS({model:e,variant:t,activeId:n,onNavigate:r}){let i=t===`screen`;return(0,Q.jsx)(Q.Fragment,{children:[{key:`issues`,label:`Issues`,rows:os},{key:`prs`,label:`Pull requests`,rows:ts}].map(t=>(0,Q.jsxs)(`nav`,{"aria-label":t.label,"data-slot":`github-filter-group`,"data-group":t.key,className:i?ka:C(Ma,t.key===`prs`&&`pt-[6px]`),children:[(0,Q.jsx)(`h3`,{className:i?La:Ra,children:t.label}),t.rows.map(({id:t,label:a})=>{let o=IS[t],s=n===t,c=LS(t,e.blocked),l=e.counts[t],u=ps(l),d=C(i?Aa:C(Pa,`text-[12.5px]`),c?`cursor-not-allowed opacity-60`:Na,s&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),f=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(o,{"aria-hidden":`true`,className:i?Ba:Ia}),(0,Q.jsx)(`span`,{className:`truncate`,children:a}),u?(0,Q.jsx)(`span`,{"data-slot":`gh-filter-count`,title:ds(t,l),className:i?Fa:ja,children:u}):null,i?(0,Q.jsx)(Sa,{"aria-hidden":`true`,className:C(za,!u&&`ml-auto`)}):null]});if(c)return(0,Q.jsxs)(`div`,{"data-gh-filter":t,"aria-disabled":`true`,title:c,className:d,children:[f,(0,Q.jsx)(`span`,{className:`sr-only`,children:c})]},t);let{view:p,filter:m}=ss(t);return(0,Q.jsx)(Y,{to:rs(p,m),"data-gh-filter":t,"aria-current":s?`page`:void 0,onClick:r,className:d,children:f},t)})]},t.key))})}function zS(e){let t=dn(e,50).data,n=t?.available===!0,r=gn(e,!0,e==="default"),i=zn(e,`pr`,cs,n),a=zn(e,`pr`,us,n),o=(0,Z.useMemo)(()=>r.data?ls(r.data,t?.repo,e):null,[r.data,t?.repo,e]);return{gh:t,counts:(0,Z.useMemo)(()=>ns({gh:t,tasks:o,review:i.data,failing:a.data}),[t,o,i.data,a.data]),blocked:{identity:t?.available===!0&&!t.viewerLogin?`GitHub login unavailable.`:null,tasks:r.isError&&!r.data?`Task list unavailable.`:null}}}function BS(e){return/^\/github\/prs(?:\/|$)/.test(bs(e))?`prs`:`issues`}function VS({scope:e}){let t=zS(e),{pathname:n}=a(),[r]=o(),i=od(),s=BS(n);return(0,Q.jsx)(`div`,{"data-slot":`github-sidebar`,role:`region`,"aria-label":`GitHub`,className:Va,children:(0,Q.jsx)(RS,{model:t,variant:`sidebar`,activeId:is(s,as(s,r.get(`filter`))),onNavigate:i})})}function HS(){let e=ur();return e.isPending?(0,Q.jsx)(`p`,{role:`status`,children:`Loading task settings…`}):e.isError?(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,Q.jsx)(WS,{config:e.data,scope:`project`})}function US(){let e=rr();return e.isPending?(0,Q.jsx)(`p`,{role:`status`,className:`p-4 text-sm`,children:`Loading task settings…`}):e.isError?(0,Q.jsxs)(`p`,{role:`alert`,className:`p-4 text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,Q.jsx)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 md:p-6`,children:(0,Q.jsx)(WS,{config:e.data,scope:`global`})})}function WS({config:e,scope:t}){let n=(0,Z.useId)(),r=I(),i=H({mutationFn:async({archiveOnMerge:e,projectKey:n})=>t===`project`?jt({archiveOnMerge:e},n[0]):Xe({archiveOnMerge:e}),onSuccess:(e,{projectKey:n})=>{t===`project`?r.setQueryData(n,e):(r.setQueryData(V.config,e),r.invalidateQueries({predicate:e=>e.queryKey.at(-1)===`config`&&e.queryKey!==V.config}))}});return(0,Q.jsxs)(`section`,{"data-slot":`archive-on-merge-field`,className:`flex min-w-0 flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`label`,{htmlFor:n,className:`text-sm font-semibold text-foreground`,children:`Archive tasks after PRs merge`}),(0,Q.jsx)(`p`,{id:`${n}-hint`,className:`text-[13px] text-muted-foreground`,children:`Automatically archive a settled task and its workers once all their associated pull requests merge. History stays available in Archived.`})]}),(0,Q.jsxs)(`select`,{id:n,"aria-describedby":`${n}-hint ${n}-effective`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus-visible:outline-2 focus-visible:outline-ring active:bg-muted disabled:opacity-50`,value:e.archiveOnMerge===null?`inherit`:e.archiveOnMerge?`enabled`:`disabled`,disabled:i.isPending,onChange:e=>i.mutate({archiveOnMerge:e.target.value===`inherit`?null:e.target.value===`enabled`,projectKey:U.config}),children:[(0,Q.jsx)(`option`,{value:`inherit`,children:t===`project`?`Inherit global setting`:`Use default`}),(0,Q.jsx)(`option`,{value:`enabled`,children:`Enabled`}),(0,Q.jsx)(`option`,{value:`disabled`,children:`Disabled`})]}),(0,Q.jsxs)(`p`,{id:`${n}-effective`,className:`text-[13px] text-muted-foreground`,children:[`Currently `,e.effectiveArchiveOnMerge?`enabled`:`disabled`,` · `,e.archiveOnMergeSource,` setting.`]}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Unarchive restores the task. It stays visible until a later associated PR merges.`}),i.isPending?(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Saving…`}):null,i.isError?(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save: `,i.error.message]}):null]})}function GS({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(rm,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:C(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var KS=h(`group/tabs-list inline-flex w-fit items-center justify-center rounded-md p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function qS({className:e,variant:t=`default`,...n}){return(0,Q.jsx)(im,{"data-slot":`tabs-list`,"data-variant":t,className:C(KS({variant:t}),e),...n})}function JS({className:e,...t}){return(0,Q.jsx)(am,{"data-slot":`tabs-trigger`,className:C(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-sm border border-transparent px-3 py-1 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-[color,background-color,border-color,box-shadow] group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start pointer-hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-xs group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-card data-[state=active]:font-semibold data-[state=active]:text-foreground`,`after:absolute after:bg-accent-strong after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:inset-be-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function YS({className:e,...t}){return(0,Q.jsx)(om,{"data-slot":`tabs-content`,className:C(`flex-1 outline-hidden`,e),...t})}function XS(e,t){return Ti(t).flatMap(t=>{let n=e.filter(e=>e.provider===t.id);return n.length<2?[{runner:t,account:null,label:t.pickerLabel,desc:t.pickerDescription,missing:!1}]:n.map(e=>({runner:t,account:e.isDefault?null:e.id,label:`${t.pickerLabel} · ${e.label}`,desc:e.exists?e.configDir:`${e.configDir} — folder not created yet`,missing:!e.exists}))})}var ZS=(e,t)=>e.length>wi(t).length;function QS(e,t){let n=Ie(e.data,t),r=!e.isPending&&!e.isError&&n?.enabled===!0&&n.status===`connected`;return{providerConnected:r,providerReason:e.isPending?`Checking provider authentication…`:e.isError?`Provider authentication could not be verified.`:n?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:r?void 0:`Connect this provider before selecting it.`}}function $S({rows:e,runner:t,accountFor:n,providerStatus:r,disabled:i=!1,accountDisabled:a=!1,onPick:o}){let s=Oi().data,c=s===void 0,l=ZS(e,s);return(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:C(`gap-0.5 rounded-md border border-border bg-card p-0.5`,l?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(s=>{let{providerConnected:u,providerReason:d}=QS(r,s.runner.id),f=e.filter(e=>e.runner.id===s.runner.id).length>1,p=s.runner.id===t&&s.account===n(s.runner.id);return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":p,"data-value":s.runner.id,"data-account":s.account??``,title:d??s.desc,disabled:i||c||!u||f&&a,onClick:()=>o(s.runner.id,s.account,f),className:C(`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:[s.label,l?(0,Q.jsx)(`span`,{"data-slot":s.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":s.runner.id,className:`ml-2 font-sans text-[11px] text-soft-foreground`,children:s.desc}):null]},`${s.runner.id}:${s.account??``}`)})})}var eC=`~/.claude-second`;function tC({open:e,onOpenChange:t,providers:n,initialProvider:r}){let i=Oi().data,[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)(r??n[0]??`claude`),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(!1),_=$n(),v=p.trim();return(0,Q.jsx)(es,{open:e,onOpenChange:t,children:(0,Q.jsxs)(Qo,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,Q.jsxs)(Zo,{children:[(0,Q.jsx)($o,{children:`Add agent account`}),(0,Q.jsx)(Yo,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,Q.jsx)(`select`,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:l,onChange:e=>u(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`,children:n.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,Q.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:d,placeholder:`Work`,onChange:e=>f(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,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,Q.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:p,placeholder:Di(i,l)?.accountFolderExample??eC,onChange:e=>{m(e.target.value),c(null),_.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,Q.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":h,onClick:()=>g(e=>!e),children:h?`Hide folders`:`Browse…`})]}),(0,Q.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`A `,(0,Q.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),h?(0,Q.jsx)(Qm,{path:a,selected:s,onSelect:e=>{c(e),m(e.path),_.reset()},onEnter:e=>{o(e),c(null),_.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,_.isError?(0,Q.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:_.error instanceof Error?_.error.message:`could not add that folder`}):null,(0,Q.jsxs)(Jo,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,Q.jsx)(k,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(k,{"data-slot":`add-account-confirm`,disabled:v===``||_.isPending,onClick:()=>{v===``||_.isPending||_.mutate({provider:l,configDir:v,...d.trim()?{label:d.trim()}:{}},{onSuccess:()=>{t(!1),f(``),m(``),c(null),g(!1),G(`Account added — use Connect to sign in`)}})},children:_.isPending?`Adding…`:`Add account`})]})]})})}async function nC(e,t){return ct(await Et.api.v1.providers[`sign-in`].start.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/sign-in/start`)}async function rC(e){return ct(await Et.api.v1.providers[`sign-in`][`:id`].$get({param:{id:e}}),`/providers/sign-in/:id`)}async function iC(e,t){return ct(await Et.api.v1.providers[`sign-in`][`:id`].redirect.$post({param:{id:e},json:{redirectUrl:t}}),`/providers/sign-in/:id/redirect`)}async function aC(e){return ct(await Et.api.v1.providers[`sign-in`][`:id`].$delete({param:{id:e}}),`/providers/sign-in/:id`)}function oC(e,t){let n=I(),[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(``),l=(0,Z.useRef)(null),u=(0,Z.useRef)(!0),d=(0,Z.useRef)(0),f=()=>{d.current++,m.current=!1;let e=l.current;l.current=null,e?.state===`waiting`&&aC(e.id).catch(()=>{}),o(null),c(``),i(!1)};(0,Z.useEffect)(()=>(u.current=!0,()=>{u.current=!1,d.current++;let e=l.current;e?.state===`waiting`&&aC(e.id).catch(()=>{})}),[]);let p=H({mutationFn:n=>nC(e,t).then(e=>({result:e,generation:n})),retry:!1,onSuccess:({result:e,generation:t})=>{if(!u.current||!m.current||t!==d.current){aC(e.id).catch(()=>{});return}l.current=e,o(e)}}),m=(0,Z.useRef)(r);m.current=r;let h=wr({queryKey:[`browser-sign-in`,a?.id],queryFn:()=>rC(a.id),enabled:r&&a?.state===`waiting`,retry:!1,refetchInterval:e=>e.state.error||e.state.data?.state&&e.state.data.state!==`waiting`?!1:1e3,gcTime:0}),g=h.data??a,_=H({mutationFn:()=>iC(a.id,s),retry:!1,onSuccess:()=>{c(``),h.refetch()}});return(0,Z.useEffect)(()=>{g?.state===`connected`&&(l.current=g,o(g),Promise.all([n.invalidateQueries({queryKey:V.agentProfiles}),n.invalidateQueries({queryKey:V.providerStatus}),n.invalidateQueries({queryKey:V.models(e)})]))},[g,n,e]),{open:r,result:g,redirect:s,setRedirect:c,start:p,replay:_,status:h,error:p.error??_.error??h.error,close:f,connect:()=>{i(!0),m.current=!0,p.reset(),_.reset(),p.mutate(++d.current)}}}function sC({provider:e,profileId:t,label:n}){let{open:r,result:i,redirect:a,setRedirect:o,start:s,replay:c,status:l,error:u,close:d,connect:f}=oC(e,t);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:s.isPending,onClick:f,children:`Connect`}),(0,Q.jsx)(es,{open:r,onOpenChange:e=>{e||d()},children:(0,Q.jsxs)(Qo,{children:[(0,Q.jsxs)(Zo,{children:[(0,Q.jsxs)($o,{children:[`Sign in to `,n]}),(0,Q.jsx)(Yo,{children:`Use a personal Google account. Business and agent-platform sign-in are not supported.`})]}),s.isPending?(0,Q.jsx)(`p`,{role:`status`,children:`Preparing sign-in…`}):null,i?.state===`waiting`?(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[(0,Q.jsx)(`a`,{href:i.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-action underline`,children:`Open Google sign-in`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`After consent, sign-in completes here. If your browser cannot reach the host’s 127.0.0.1 address, paste the full failed redirect URL below.`}),(0,Q.jsxs)(`label`,{className:`grid gap-2`,children:[`Redirect URL`,(0,Q.jsx)(rh,{type:`url`,autoComplete:`off`,spellCheck:!1,value:a,onChange:e=>o(e.target.value)})]}),(0,Q.jsx)(k,{disabled:!a.trim()||c.isPending,onClick:()=>c.mutate(),children:`Complete sign-in`})]}):null,i?.state===`connected`?(0,Q.jsx)(`p`,{role:`status`,children:`Connected.`}):null,i?.state===`failed`?(0,Q.jsx)(`p`,{role:`alert`,children:i.error}):null,i?.state===`cancelled`?(0,Q.jsx)(`p`,{role:`status`,children:`Sign-in cancelled. Close this window and Connect again.`}):null,u?(0,Q.jsx)(`p`,{role:`alert`,children:u.message}):null,l.isError&&i?.state===`waiting`?(0,Q.jsx)(k,{onClick:()=>void l.refetch(),children:`Retry status`}):null,(0,Q.jsx)(Jo,{children:(0,Q.jsx)(k,{variant:`outline`,onClick:d,children:i?.state===`connected`?`Done`:`Cancel`})})]})})]})}function cC(e){let t=(0,Z.useRef)(null),n=e.rows.find(t=>t.runner.id===e.runner&&t.account===e.accountFor(t.runner.id));return(0,Q.jsxs)(`details`,{ref:t,className:`settings-agent-picker`,children:[(0,Q.jsxs)(`summary`,{children:[(0,Q.jsx)(sa,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1`,children:(n?.label??e.runner).replace(/^codex/,`Codex`).replace(/^claude/,`Claude Code`)}),(0,Q.jsx)(ua,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`})]}),(0,Q.jsx)($S,{...e,onPick:(...n)=>{e.onPick(...n),t.current&&(t.current.open=!1)}})]})}var lC={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 uC(){let e=cr(),t=Oi();return e.isPending||t.isPending?(0,Q.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent accounts…`}):e.isError?(0,Q.jsx)(X,{icon:(0,Q.jsx)(ku,{}),tone:`danger`,title:`Agent accounts did not load`,subtitle:e.error.message,heading:`h2`}):t.isError?(0,Q.jsx)(X,{icon:(0,Q.jsx)(ku,{}),tone:`danger`,title:`Agent accounts did not load`,subtitle:t.error.message,heading:`h2`}):(0,Q.jsx)(dC,{data:e.data,runners:t.data})}function dC({data:e,runners:t}){let n=En(),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(null),s=sr(),c=t.runners.map(e=>e.id);return e.editable?(0,Q.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,Q.jsx)(`div`,{children:(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Manage runner installations, logins and defaults for new projects.`})}),(0,Q.jsxs)(GS,{defaultValue:`claude`,children:[(0,Q.jsx)(qS,{variant:`line`,"data-slot":`accounts-tabs`,children:c.map(e=>(0,Q.jsx)(JS,{value:e,"data-provider":e,children:ki(t,e)},e))}),c.map(r=>(0,Q.jsx)(YS,{value:r,className:`pt-4`,children:(0,Q.jsx)(fC,{provider:r,runners:t,check:n.data?.checks?.find(e=>e.name===r),accounts:e.profiles.filter(e=>e.provider===r),canCarryAccounts:e.profileCapableProviders.includes(r),onAdd:()=>i(r),onRemove:o})},r))]}),(0,Q.jsx)(pC,{runners:t}),r===null?null:(0,Q.jsx)(tC,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,Q.jsx)(eS,{open:a!==null,onOpenChange:e=>!e&&o(null),children:(0,Q.jsxs)(rS,{"data-slot":`accounts-remove-confirm`,children:[(0,Q.jsxs)(iS,{children:[(0,Q.jsxs)(oS,{children:[`Remove “`,a?.label,`”?`]}),(0,Q.jsxs)(sS,{children:[`This only forgets the account. Nothing in `,a?.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,Q.jsxs)(aS,{children:[(0,Q.jsx)(lS,{children:`Cancel`}),(0,Q.jsx)(cS,{"data-action":`accounts-remove-confirm`,disabled:s.isPending,onClick:()=>{let e=a;e&&s.mutate(e.id,{onSuccess:()=>{o(null),G(`Removed ${e.label}`)},onError:e=>G(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]}):(0,Q.jsx)(`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,Q.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 fC({provider:e,runners:t,check:n,accounts:r,canCarryAccounts:i,onAdd:a,onRemove:o}){let s=n?.available===!0,c=r.filter(e=>e.isDefault).length;return(0,Q.jsxs)(`div`,{"data-slot":`accounts-provider`,"data-provider":e,className:`flex flex-col gap-4`,children:[(0,Q.jsx)(`h3`,{className:`settings-account-provider-title`,children:ki(t,e)}),(0,Q.jsxs)(`div`,{className:`settings-account-installation settings-readout`,children:[n===void 0?(0,Q.jsx)(`span`,{children:`Checking…`}):s?(0,Q.jsx)(`span`,{"data-slot":`agent-installed`,children:`Installed`}):(0,Q.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`Not installed — `,(0,Q.jsx)(`code`,{children:Di(t,e)?.installHint})]}),s&&n?.version?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,Q.jsx)(`span`,{"data-slot":`agent-version`,children:n.version})]}):null,(0,Q.jsxs)(`span`,{className:`settings-account-count`,children:[r.length,` `,r.length===1?`account`:`accounts`,` (`,c,` discovered, `,r.length-c,` added)`]})]}),(0,Q.jsx)(`ul`,{className:`bg-card`,children:r.map(e=>(0,Q.jsx)(gC,{account:e,runners:t,onRemove:()=>o(e)},e.id))}),i?(0,Q.jsx)(`div`,{className:`settings-account-add-row`,children:(0,Q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":e,onClick:a,children:`Add account`})}):null,i?null:(0,Q.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`text-[11px] text-soft-foreground`,children:[ki(t,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 pC({runners:e}){let[t,n]=(0,Z.useState)(null),r=I(),i=rr(),a=Wn(),o=_n(wi(e)),s=H({mutationFn:e=>Xe(e),onSuccess:e=>r.setQueryData(V.config,e),onError:e=>G(e.message,{tone:`danger`})});if(i.data===void 0)return null;let c=XS([],e),l=i.data.agentDefaults.runner??`claude`,u=i.data.agentDefaults.models??{};return(0,Q.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,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,Q.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,Q.jsx)(cC,{rows:c,runner:l,accountFor:()=>null,providerStatus:a,disabled:s.isPending,onPick:e=>{e!==l&&s.mutate({agentDefaults:{runner:e}})}}),(0,Q.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,Q.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,Q.jsx)(`span`,{children:`Default model for`}),(0,Q.jsx)(`select`,{"aria-label":`Model agent`,value:t??l,onChange:e=>n(e.target.value),children:e.runners.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.displayName},e.id))})]}),e.runners.filter(e=>e.id===(t??l)).map(t=>(0,Q.jsxs)(`label`,{className:`settings-account-model flex items-center gap-3`,children:[(0,Q.jsx)(Ea,{className:`size-4 text-accent-icon shrink-0`}),(0,Q.jsx)(`span`,{className:`w-24 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,Q.jsxs)(`select`,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:u[t.id]??``,disabled:s.isPending,onChange:e=>s.mutate({agentDefaults:{models:{[t.id]:e.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:[tc(t.id,e,o[t.id]?.data,[u[t.id]]).map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.id===``?`Native default`:e.label},e.id)),(0,Q.jsx)(mC,{runner:t.id,runners:e,catalog:o[t.id]})]})]},t.id))]})]})}function mC({runner:e,runners:t,catalog:n}){let r=Vs(e,t,n);return r?(0,Q.jsx)(`option`,{disabled:!0,children:r}):null}function hC({account:e,runners:t,status:n}){let r=ar();return(0,Q.jsxs)(Q.Fragment,{children:[n?.status!==`connected`&&Di(t,e.provider)?.browserLogin?(0,Q.jsx)(sC,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,n?.status!==`connected`&&Di(t,e.provider)?.terminalLogin!==!1?(0,Q.jsx)(k,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:r.isPending,onClick:()=>r.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=>G(e instanceof et&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function gC({account:e,runners:t,onRemove:n}){let r=je(e),i=Gn(),a=pr(r,e.status===void 0),o=e.status??a.data?.status,s=o?lC[o.status]:void 0;return(0,Q.jsx)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`flex flex-col gap-2 px-3.5 py-3`,children:(0,Q.jsxs)(`div`,{className:`settings-account-card`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-foreground`,children:e.label}),e.isDefault?(0,Q.jsx)(Jm,{variant:`ghost`,className:`shrink-0 text-[12px] text-muted-foreground`,children:`discovered`}):null]}),(0,Q.jsxs)(`div`,{className:`settings-account-readout settings-readout`,children:[(0,Q.jsx)(`p`,{"data-slot":`account-path`,className:`mt-0.5 truncate font-mono text-[11px] text-soft-foreground`,title:e.path,children:e.configDir}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)($,{tone:s?.tone??`neutral`,pulse:s===void 0}),(0,Q.jsx)(`span`,{"data-slot":`account-status`,children:s?.label??`Checking…`}),o?.requiresAccountHome===!1?null:e.exists?e.looksValid?null:(0,Q.jsxs)(`span`,{"data-slot":`account-unrecognised`,children:[`— this folder does not look like `,ki(t,e.provider),` config yet`]}):(0,Q.jsx)(`span`,{"data-slot":`account-missing`,children:`— folder not created yet; Connect will make it`})]}),o?.hint?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o.hint}):null]})]}),(0,Q.jsxs)(`div`,{className:`settings-account-actions`,children:[(0,Q.jsx)(hC,{account:e,runners:t,status:o}),(0,Q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:i.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>i.mutate(r,{onError:e=>G(e.message,{tone:`danger`})}),children:`Check again`}),(0,Q.jsx)(_C,{account:e,onRemove:n})]})]})})}function _C({account:e,onRemove:t}){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(e.label),o=pn();return(0,Q.jsx)(Q.Fragment,{children:e.isDefault?null:(0,Q.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(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,Q.jsx)(k,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>G(e.message,{tone:`danger`})}),children:`Save`}),(0,Q.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,Q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}var vC={core:null,langs:new Map},yC={name:`cezar-syn`,type:`dark`,fg:`var(--syn-var)`,bg:`transparent`,settings:[{scope:[`keyword`,`storage`,`constant.language`,`variable.language`,`entity.other.attribute-name`,`support.type.property-name`],settings:{foreground:`var(--syn-key)`}},{scope:[`string`,`punctuation.definition.string`],settings:{foreground:`var(--syn-str)`}},{scope:[`entity.name.function`,`support.function`,`entity.name.tag`,`entity.name.type`,`entity.name.class`,`support.class`,`support.type`],settings:{foreground:`var(--syn-fn)`}},{scope:[`comment`,`punctuation.definition.comment`],settings:{foreground:`var(--syn-com)`}},{scope:[`constant.numeric`,`constant.character`,`constant.other`,`support.constant`,`keyword.other.unit`],settings:{foreground:`var(--syn-num)`}},{scope:[`punctuation`,`keyword.operator`,`meta.brace`,`punctuation.separator`,`punctuation.terminator`],settings:{foreground:`var(--syn-punc)`}},{scope:[`variable`,`entity.name.variable`],settings:{foreground:`var(--syn-var)`}}]},bC={typescript:()=>W(()=>import(`./typescript-bsJCZSQ-.js`),[]),tsx:()=>W(()=>import(`./tsx-udAQXfEw.js`),[]),javascript:()=>W(()=>import(`./javascript-BgS3c2Ky.js`),[]),jsx:()=>W(()=>import(`./jsx-Bz0zcwM4.js`),[]),json:()=>W(()=>import(`./json-qhed-kSA.js`),[]),jsonc:()=>W(()=>import(`./jsonc-CYpm1nAK.js`),[]),shellscript:()=>W(()=>import(`./shellscript-CLZ0U2zV.js`),[]),python:()=>W(()=>import(`./python-gzcpVVnB.js`),[]),markdown:()=>W(()=>import(`./markdown-BYOwaDjH.js`),[]),css:()=>W(()=>import(`./css-BsVw1vtW.js`),[]),html:()=>W(()=>import(`./html-BY76lXLH.js`),__vite__mapDeps([0,1,2])),diff:()=>W(()=>import(`./diff-woXpYk--.js`),[]),yaml:()=>W(()=>import(`./yaml-rwi0_p6S.js`),[]),toml:()=>W(()=>import(`./toml-CcmNWLt0.js`),[]),go:()=>W(()=>import(`./go-rLFTqkRN.js`),[]),rust:()=>W(()=>import(`./rust-Cfkwpbl8.js`),[]),sql:()=>W(()=>import(`./sql-BsFa4tDR.js`),[])},xC={ts:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,bash:`shellscript`,sh:`shellscript`,shell:`shellscript`,zsh:`shellscript`,console:`shellscript`,py:`python`,md:`markdown`,yml:`yaml`,golang:`go`,rs:`rust`,vue:`html`,xml:`html`},SC=new Set([``,`plaintext`,`text`,`txt`,`plain`]);function CC(e){let t=e.trim().toLowerCase();return Object.hasOwn(bC,t)?t:Dh(xC,t)??null}function wC(e){return SC.has(e.trim().toLowerCase())}function TC(){return[...Object.keys(bC),...Object.keys(xC),...SC].filter(e=>e!==``)}function EC(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);if(n<=0)return null;let r=t.slice(n+1).toLowerCase();return CC(Dh({mts:`typescript`,cts:`typescript`,htm:`html`},r)??r)}var DC=null,OC=new Set;function kC(){return vC.core??=Promise.all([W(()=>import(`./core-DzoyrHjB.js`),__vite__mapDeps([3,4,5])),W(()=>import(`./engine-javascript-FQvzRocB.js`),[])]).then(async([{createHighlighterCore:e},{createJavaScriptRegexEngine:t}])=>(DC=await e({themes:[yC],langs:[],engine:t({forgiving:!0})}),DC)),vC.core}function AC(e){let t=CC(e);if(t===null||OC.has(t))return Promise.resolve();let n=vC.langs.get(t);return n||(n=kC().then(async e=>{await e.loadLanguage(await bC[t]()),OC.add(t)}).catch(()=>{vC.langs.delete(t)}),vC.langs.set(t,n)),n}function jC(e){return{tokens:e.split(`
|
|
5
|
+
`)),i=yn(e);for(let e of n)r.has(e)||i.dropProject(e);let a=[...r].filter(e=>!n.has(e));for(let e of a)i.restoreProject(e);a.length>0&&i.reconcile({hold:!0})},[e,l]),Z.useMemo(()=>o?{projects:o,signals:c,canReorder:a,onReorder:i}:null,[o,c,a,i])}var qy=60;function Jy(e){return`title`in e?`Archived "${e.title.length>qy?`${e.title.slice(0,qy-1)}…`:e.title}"`:`Archived ${e.count} ${e.count===1?`task`:`tasks`}`}async function Yy(e,t,n){let r=new Set(n),i=(await Promise.allSettled(t.map(async t=>{await Nt(xn(t,{projectId:e}),!1),r.has(t)&&await _e(xn(t,{projectId:e}),!0)}))).find(e=>e.status===`rejected`);i&&G(i.reason instanceof Error?i.reason.message:`Could not undo the archive.`,{tone:`danger`})}function Xy(){let e=document.activeElement;return!e||e===document.body||!e.isConnected}function Zy(e,t){if(!e.isConnected)return t();let n=new MutationObserver(()=>{e.isConnected||(n.disconnect(),clearTimeout(r),t())}),r=setTimeout(()=>n.disconnect(),5e3);n.observe(document.body,{childList:!0,subtree:!0})}function Qy(e,t){if(!Xy())return;let n=e?.isConnected?e:t?.isConnected?t:null;n instanceof HTMLElement&&(n.tabIndex<0&&!n.hasAttribute(`tabindex`)&&(n.tabIndex=-1),n.focus({preventScroll:!0}))}function $y(e,t,n){if(!e)return()=>{};let r=t(e);return()=>Zy(e,()=>Qy(r,n))}function eb(e){let t=document.activeElement?.closest(`[data-slot="task-row"]`);return t?.getAttribute(`data-run-id`)===e?t:Array.from(document.querySelectorAll(`[data-slot="task-row"]`)).find(t=>t.getAttribute(`data-run-id`)===e)??null}var tb=e=>e?.querySelector(`a`)??null;function nb(e,t){let n=e?.projectId,r=e?.cacheScope,i=Rn(),[a,o]=Z.useState(null),s=e=>i.invalidateAfter(`runs`,fr({projectId:n,cacheScope:e})),l=(e,t,r,i)=>G(e,{action:{label:`Undo`,onAction:()=>void Yy(n,r,i).finally(()=>void s(t))}}),u=Z.useRef(new Map);return{archiveOne:e=>{let i=u.current.get(e.id);if(i)return i;let a=r??c(),o=!!e.pinned,d=eb(e.id),f=$y(d,e=>{let t=Array.from(e.closest(`[data-slot="quick-list-bucket"]`)?.querySelectorAll(`[data-slot="task-row"]`)??[]),n=t.indexOf(e);return tb(t[n+1]??t[n-1])},d?.closest(`[data-slot="quick-list-bucket"]`)?.parentElement??null),p=Nt(xn(e.id,{projectId:n}),!0).then(()=>(s(a),l(Jy({title:xi(e)}),a,[e.id],o?[e.id]:[]),f(),t?.(),!0),e=>(G(e.message,{tone:`danger`}),!1)).finally(()=>u.current.delete(e.id));return u.current.set(e.id,p),p},sweep:(e,i)=>{let a=r??c();o(e);let u=document.activeElement,d=u?.matches(`[data-action="archive-group"]`)?u:null,f=$y(d,e=>tb(e.closest(`[data-slot="quick-list-bucket"]`)?.nextElementSibling?.querySelector(`[data-slot="task-row"]`)??void 0),d?.closest(`[data-slot="quick-list-bucket"]`)?.parentElement??null);Ct(fr({projectId:n}),e,i).then(({ids:e,pinnedIds:n})=>{s(a),e.length>0&&l(Jy({count:e.length}),a,e,n),f(),e.length>0&&t?.()},e=>G(e.message,{tone:`danger`})).finally(()=>o(null))},sweeping:a}}var rb=.6,ib=300,ab=100,ob={offset:0,phase:`idle`,past:!1},sb=null;function cb(e,t){sb&&sb.id!==e&&sb.close(),sb={id:e,close:t}}function lb(e){sb?.id===e&&(sb=null)}function ub(){if(!(typeof navigator>`u`||typeof navigator.vibrate!=`function`))try{navigator.vibrate(10)}catch{}}function db({id:e,enabled:t,onArchive:n}){let[r,i]=Z.useState(ob),a=Z.useRef(null),o=Z.useRef(null),s=Z.useRef(!1),c=Z.useRef(!1),l=Z.useRef(void 0),u=()=>{c.current=!0,clearTimeout(l.current),l.current=void 0},d=()=>{c.current&&(clearTimeout(l.current),l.current=setTimeout(()=>{c.current=!1},ib))};Z.useEffect(()=>()=>clearTimeout(l.current),[]);let f=Z.useRef(r);f.current=r;let p=Z.useRef(n);p.current=n;let m=Z.useCallback(()=>{o.current=null,s.current=!1,lb(e),i(ob)},[e]);Z.useEffect(()=>{!t&&f.current.phase!==`committing`&&m()},[t,m]),Z.useEffect(()=>()=>lb(e),[e]);let h=r.phase===`open`;Z.useEffect(()=>{if(!h)return;let e=()=>m(),t=e=>{let t=a.current;t&&e.target instanceof Node&&t.contains(e.target)||m()};return document.addEventListener(`scroll`,e,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,t,!0),()=>{document.removeEventListener(`scroll`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,!0)}},[h,m]);let g=t=>{lb(e),i({offset:-t,phase:`committing`,past:!0});let n=e=>{e===!1&&m()};try{let e=p.current();e&&typeof e.then==`function`&&e.then(n,m)}catch{m()}};return{offset:r.offset,phase:r.phase,past:r.past,surfaceRef:a,bind:{onPointerDown:e=>{if(c.current=!1,!t||f.current.phase===`committing`||e.pointerType===`mouse`&&e.button!==0)return;let n=(a.current??e.currentTarget).getBoundingClientRect();o.current={pointerId:e.pointerId,x0:e.clientX,y0:e.clientY,base:f.current.phase===`open`?-88:0,width:n.width>0?n.width:320,axis:null,wasOpen:f.current.phase===`open`,samples:[{x:e.clientX,t:Date.now()}]}},onPointerMove:t=>{let n=o.current;if(!n||t.pointerId!==n.pointerId)return;let r=t.clientX-n.x0,a=t.clientY-n.y0;if(n.axis===null){if(Math.max(Math.abs(r),Math.abs(a))<10||(n.axis=Math.abs(r)>Math.abs(a)?`x`:`y`,n.axis===`y`))return;try{t.currentTarget.setPointerCapture?.(t.pointerId)}catch{}cb(e,m),u()}if(n.axis!==`x`)return;let c=Math.min(0,Math.max(-n.width,n.base+r)),l=-c>=rb*n.width;l&&!s.current&&ub(),s.current=l,n.samples.push({x:t.clientX,t:Date.now()}),n.samples.length>8&&n.samples.shift(),i({offset:c,phase:`dragging`,past:l})},onPointerUp:t=>{let n=o.current;if(!n||t.pointerId!==n.pointerId)return;if(o.current=null,n.axis!==`x`){n.axis===null&&n.wasOpen&&(u(),d(),m());return}d();let r=f.current.offset,a=Date.now(),c={x:t.clientX,t:a},l=n.samples.find(e=>a-e.t<=ab&&e.t<a),p=l?(c.x-l.x)/(c.t-l.t):0;s.current=!1,f.current.past||p<=-1&&-r>=40?g(n.width):p<1&&-r>=40?(cb(e,m),i({offset:-88,phase:`open`,past:!1})):m()},onPointerCancel:e=>{let t=o.current;!t||e.pointerId!==t.pointerId||(o.current=null,d(),t.axis===`x`&&m())},onClickCapture:e=>{c.current&&(c.current=!1,e.preventDefault(),e.stopPropagation())},onKeyDownCapture:()=>{c.current=!1}},close:m}}function fb(e){if(e<1e3)return String(e);let t=[`k`,`M`,`B`,`T`],n=Math.floor(Math.log10(e)/3);return n>t.length?e.toExponential(0).replace(`+`,``):`${Math.floor(e/1e3**n)}${t[n-1]}`}function pb({stat:e,className:t,compact:n=!1}){let r=`+${e.adds} −${e.dels} across ${e.files} ${e.files===1?`file`:`files`}`,i=e.repointed?`${r} — measured against another branch checked out in this task's worktree, as this task found it`:void 0;return(0,Q.jsxs)(`span`,{"data-slot":`diff-stat`,...i?{"data-repointed":`true`,"aria-label":i}:{},...n&&!i?{"aria-label":r}:{},title:i??r,className:C(`font-mono text-xs font-semibold tabular-nums`,e.repointed&&`cursor-help underline decoration-dotted underline-offset-2`,t),children:[(0,Q.jsxs)(`span`,{className:`text-success`,children:[`+`,n?fb(e.adds):e.adds.toLocaleString(`en-US`)]}),` `,(0,Q.jsxs)(`span`,{className:`text-danger`,children:[`−`,n?fb(e.dels):e.dels.toLocaleString(`en-US`)]})]})}function mb(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}function hb(e){return e.runner??`claude`}function gb(e,t,n){let r=Ie(t,e);return r?.enabled===!1?{provider:e,usable:!1,reason:`${ki(n,e)} is disabled. Enable it in ${Qa(`providers`)}.`}:r?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${ki(n,e)} credentials are unavailable. Authorize it in ${Qa(`providers`)}.`}}function _b(e,t,n){return gb(mb(e),t,n)}function vb(e,t,n){return gb(hb(e),t,n)}function yb(e){let t=Wn(),n=Oi().data,r=mb(e);return t.isSuccess&&t.data&&n?_b(e,t.data,n):{provider:r,usable:!0}}function bb(e){let t=Wn(),n=Oi(),r=hb(e);return t.isSuccess&&t.data&&n.data?vb(e,t.data,n.data):t.isError||n.isError?{provider:r,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:r,usable:!1,reason:`Checking agent providers…`}}function xb(e){return Hr(e).sessionId}function Sb(e){return Hr(e).backend}function Cb(e){if(di(e)||e.cliHandoff===!1)return;let t=e.cliResumeCommand;if(t!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${t}`:t}function wb(e,t){let n=Ah(t);return!n||di(e)?!1:n===Sb(e)&&xb(e)!==void 0}function Tb(e){return(e.status===`failed`||St(e))&&(e.waits?.length??0)>0}function Eb(e,t){return t&&e.delegation?.role===`root`&&(e.status===`failed`||St(e))}function Db(e){return e.status===`cancelled`&&e.startedAt===void 0&&e.workflowDef!==void 0&&e.steps.every(e=>e.status===`pending`&&e.startedAt===void 0&&!e.sessionId)}function Ob(e){return Xr(e)&&e.removedRunner===void 0}function kb(e,t=!1){let n=di(e),r=xb(e)!==void 0;return{finish:e.status===`waiting`&&n||e.status===`review`,continueRun:(!n||e.removedRunner!==void 0&&e.status!==`queued`)&&!e.stopping&&e.delegation?.role!==`invalid`&&!(e.delegation?.role===`worker`&&e.delegation.destroy)&&(r||Db(e)||e.removedRunner!==void 0),terminal:Fb(e,n,r),notes:!0,archive:!n,pin:!e.archived&&!zr(e),markUnread:Ir(e)&&!Zr(e),cancel:n||Tb(e)||Eb(e,t),deleteRun:!n}}function Ab(e,t=!1){let n=kb(e,t);return n.archive&&!n.cancel&&!e.archiveBlocker}function jb(e){return e.status===`waiting`&&e.finishBlocked===null&&Ce(e).bucket===`waiting`}function Mb(e){return`Merge head branch and resolve conflicts in ${e?`PR number ${e}`:`this pull request`}`}function Nb(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function Pb(e,t){let n=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).findIndex(e=>e.id===t);return n>=0?n+1:void 0}function Fb(e,t,n){return e.cliHandoff!==!1&&!t&&n}var Ib=[50,100,200,400,800,1e3,1e3,1e3,1e3],Lb=e=>new Promise(t=>setTimeout(t,e));function Rb(e){return e instanceof et&&e.status===409&&e.message===`run is still active`}async function zb(e,t=Lb){for(let n=0;;n+=1)try{return await e()}catch(e){let r=Ib[n];if(!Rb(e)||r===void 0)throw e;await t(r)}}function Bb(e){return di(e)?`live`:kb(e).continueRun?`resume`:`unavailable`}function Vb(e,t){let n=fn(e.id,t),r=er(e.id,t),i=yb(e),a=bb(e),[o,s]=(0,Z.useState)(void 0),[c,l]=(0,Z.useState)(!1),u=(0,Z.useRef)(!1),d=Bb(e),f=d===`resume`?!a.usable:d===`live`&&!i.usable,p=d===`unavailable`?`no-session`:f?`provider`:void 0,m=p===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:p===`provider`?d===`resume`?a.reason:i.reason:void 0,h=(e,t)=>a.usable?r.mutateAsync({text:e,...t===void 0?{}:{images:t}}):Promise.reject(Error(a.reason??`The run provider is unavailable.`));return{mode:d,blockedBy:p,reason:m,isPending:c||n.isPending||r.isPending,error:o,send:async(t,r)=>{if(p||u.current)return m;u.current=!0,l(!0),s(void 0);try{if(d===`resume`){await zb(()=>h(t,r));return}try{await n.mutateAsync({text:t,...r===void 0?{}:{images:r}})}catch(n){if(n instanceof et&&n.status===409&&xb(e)!==void 0){try{await zb(()=>h(t,r))}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(`Session closed. Retry to reopen the session. ${t}`)}return}throw n}return}catch(e){let t=e instanceof Error?e.message:String(e);return s(t),t}finally{u.current=!1,l(!1)}}}}function Hb({run:e,projectId:t,prNumber:n}){let r=Vb(e,t),i=$a(),[a,o]=(0,Z.useState)(!1),s=a||r.isPending,c=!!r.blockedBy,l=async()=>{if(s||c)return;let e=r.mode===`resume`;o(!0);try{let t=await r.send(Mb(n));t?G(t,{tone:`danger`}):(G(`${e?`Task reopened`:`Sent to the task`} — resolving conflicts${n?` in PR #${n}`:``}`),i())}finally{o(!1)}};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{type:`button`,size:`sm`,"data-slot":`reference-conflict-action`,disabled:c||s,onClick:()=>void l(),className:`h-7 w-full text-xs`,children:s?`Sending…`:`Resolve conflicts`}),c&&r.reason?(0,Q.jsx)(`span`,{className:`block opacity-70`,children:r.reason}):null]})}function Ub({projectId:e,runId:t,prNumber:n}){let r=Bn(e,t);return r.data?(0,Q.jsx)(Hb,{run:r.data,projectId:e,prNumber:n}):(0,Q.jsx)(k,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:r.isError?`Unavailable`:`Loading…`})}function Wb({runId:e,prNumber:t}){let{projectId:n}=eo();return n===void 0?(0,Q.jsx)(Gb,{runId:e,prNumber:t}):(0,Q.jsx)(Ub,{projectId:n,runId:e,prNumber:t})}function Gb({runId:e,prNumber:t}){let n=Xn(e);return n.data?(0,Q.jsx)(Hb,{run:n.data,prNumber:t}):(0,Q.jsx)(k,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:n.isError?`Unavailable`:`Loading…`})}function Kb({run:e,reference:t,className:n,compact:r=!1,plain:i=!1,inert:a=!1}){let{projectId:o,repoBase:s}=eo(),c=o!==void 0&&t.number!==void 0?_i(o,e.id,{kind:t.kind,number:t.number,url:t.url},s):void 0;return(0,Q.jsx)(to,{reference:t,taskTitle:xi(e),to:c,conflictAction:ei({...t,number:t.number??0},s)?(0,Q.jsx)(Wb,{runId:e.id,prNumber:t.number}):void 0,className:n,compact:r,plain:i,inert:a})}var qb=220;function Jb({references:e,taskTitle:t,visibleCount:n,plain:r=!1,projectId:i,runId:a,repoBase:o}){let[s,c]=Z.useState(!1),l=Z.useRef(!1),u=Z.useRef(!1),d=Z.useRef(null),f=Z.useRef(void 0);Z.useEffect(()=>()=>clearTimeout(f.current),[]);let p=e=>e.pointerType!==`touch`,m=()=>clearTimeout(f.current),h=e=>{p(e)&&(m(),s||(l.current=!0),c(!0))},g=e=>{p(e)&&(m(),f.current=setTimeout(()=>c(!1),qb))},_=e.length-n,v=e.slice(n).map(t=>{let n=e.some(e=>e!==t&&e.kind===t.kind&&e.number===t.number)&&t.url?new URL(t.url).pathname.split(`/`).slice(1,3).join(`/`):``;return`${t.kind} #${t.number}${n?` (${n})`:``}`}).join(`, `);return _<=0?null:(0,Q.jsxs)(fi,{open:s,onOpenChange:c,children:[(0,Q.jsx)(li,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`reference-overflow`,title:v,"aria-label":`Show all ${e.length} references for ${t}`,onPointerEnter:h,onPointerLeave:g,onPointerDown:e=>{e.stopPropagation(),u.current=s&&l.current,l.current=!1},onClick:e=>{e.stopPropagation(),s&&(u.current||l.current)&&(e.preventDefault(),m(),d.current?.focus()),u.current=!1,l.current=!1},className:`no-hover:min-h-[44px] no-hover:min-w-[44px] max-md:min-h-[44px] max-md:min-w-[44px] shrink-0 rounded-full px-1 text-[11px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[`+`,_]})}),(0,Q.jsxs)(Qr,{ref:d,align:`start`,collisionPadding:8,className:`w-auto min-w-40 max-h-(--radix-popover-content-available-height) overflow-y-auto overscroll-contain p-1.5`,"data-slot":`reference-overflow-list`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onPointerEnter:h,onPointerLeave:g,onOpenAutoFocus:e=>{e.preventDefault(),!l.current&&e.target instanceof HTMLElement&&e.target.focus()},onKeyDownCapture:e=>{e.key===`Escape`&&(e.preventDefault(),l.current=!1,c(!1))},onCloseAutoFocus:e=>{l.current&&e.preventDefault()},children:[(0,Q.jsx)(`p`,{className:`px-1 pb-1.5 text-[11px] text-soft-foreground`,children:`References`}),(0,Q.jsx)(`span`,{className:`flex flex-col items-start gap-1`,children:e.map(e=>(0,Q.jsx)(to,{reference:e,taskTitle:t,projectId:i,repoBase:o,to:i===void 0?void 0:_i(i,a,e,o),plain:r,className:`no-hover:min-h-[44px] max-md:min-h-[44px]`,conflictAction:i&&ei(e,o)?(0,Q.jsx)(Ub,{projectId:i,runId:a,prNumber:e.number}):void 0},ui(e)))})]})]})}function Yb({references:e,maxVisible:t,taskTitle:n,projectId:r,runId:i,repoBase:a,plain:o=!1,compact:s=!1,inertInline:c=!1,fitContainer:l=!1,overflowContainer:u}){let d=Z.useRef(null),[f,p]=Z.useState(t),m=Z.useRef(new Map),h=e.map(ui).join(`|`);Z.useLayoutEffect(()=>{let n=d.current;if(!l||!n?.parentElement){p(t);return}let r=n.parentElement,i=()=>{[...n.querySelectorAll(`:scope > [data-slot="pr-chip"], :scope > [data-slot="issue-chip"]`)].forEach((t,n)=>{let r=t.getBoundingClientRect().width;r&&m.current.set(ui(e[n]),r)});let i=r.getBoundingClientRect();if(!i.width)return;let a=Math.min(t,e.length);n.dataset.referenceWidth=String(e.slice(0,a).reduce((e,t)=>e+(m.current.get(ui(t))??48),0)+Math.max(0,a-1)*4);let o=0;for(let e=n.nextElementSibling;e;e=e.nextElementSibling){if(e.getAttribute(`data-slot`)===`task-row-age`||e.getAttribute(`aria-hidden`)===`true`&&e.nextElementSibling?.getAttribute(`data-slot`)===`task-row-age`)continue;let t=getComputedStyle(e);o+=e.getBoundingClientRect().width+(parseFloat(t.marginLeft)||0)+(parseFloat(t.marginRight)||0)}let s=i.right-n.getBoundingClientRect().left-o,l=n.querySelector(`[data-slot="reference-overflow"]`)?.getBoundingClientRect().width||(c?44:26),d=Math.min(t,e.length);for(;d>0&&!(e.slice(0,d).reduce((e,t)=>e+(m.current.get(ui(t))??48)+4,0)+(u===void 0&&d<e.length?l:0)<=s+(d===e.length?u?.getBoundingClientRect().width??0:0));)d--;p(d)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);return a.observe(r),a.observe(n),()=>a.disconnect()},[l,t,h,c,e,u]);let g=Math.min(f,t,e.length),_=(0,Q.jsx)(Jb,{references:e,visibleCount:g,taskTitle:n,projectId:r,runId:i,repoBase:a,plain:o});return(0,Q.jsxs)(`span`,{ref:d,"data-slot":`reference-list`,className:`inline-flex max-w-full flex-nowrap items-center gap-1 align-middle`,children:[e.slice(0,g).map(e=>(0,Q.jsx)(to,{reference:e,taskTitle:n,projectId:r,repoBase:a,to:r===void 0?void 0:_i(r,i,e,a),plain:o,compact:s,inert:c,className:`shrink-0`,conflictAction:r&&ei(e,a)?(0,Q.jsx)(Ub,{projectId:r,runId:i,prNumber:e.number}):void 0},ui(e))),u===void 0?_:u?(0,sf.createPortal)(_,u):null]})}function Xb({pinned:e,onToggle:t,className:n}){return(0,Q.jsx)(`button`,{type:`button`,"data-slot":`pin-toggle`,"data-pinned":e?`true`:void 0,"aria-pressed":e,"aria-label":e?`Unpin task`:`Pin task`,title:e?`Unpin from the top of the list`:`Pin to the top of the list`,onClick:n=>{n.stopPropagation(),t(!e)},className:C(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-soft-foreground transition-colors motion-reduce:transition-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,n,`max-md:min-h-11 max-md:min-w-11 no-hover:min-h-11 no-hover:min-w-11`),children:(0,Q.jsx)(zu,{"data-slot":`pin-icon`,className:`size-[12px]`,fill:e?`currentColor`:`none`,"aria-hidden":`true`})})}var Zb=`opacity-0 group-hover/task-row:opacity-100 focus-visible:opacity-100 group-has-[:focus-visible]/task-row:opacity-100 no-hover:opacity-100`,Qb=`opacity-0 group-hover/task-row:opacity-100 focus-visible:opacity-100 group-has-[:focus-visible]/task-row:opacity-100`,$b=`transition-opacity motion-reduce:transition-none group-hover/task-row:opacity-0 group-has-[:focus-visible]/task-row:opacity-0 max-md:absolute max-md:top-1/2 max-md:left-0 max-md:-translate-y-1/2 max-md:opacity-100 no-hover:absolute no-hover:top-1/2 no-hover:left-0 no-hover:-translate-y-1/2 no-hover:opacity-100`;function ex({run:e,title:t,unread:n,inertReferences:r,onTogglePin:i,onArchiveRun:a}){return(0,Q.jsxs)(`span`,{"data-slot":`task-row-trailing`,className:`relative flex h-[19px] w-[16px] shrink-0 items-center justify-center max-md:h-auto max-md:w-11 max-md:self-stretch no-hover:h-auto no-hover:w-11 no-hover:self-stretch`,children:[n?(0,Q.jsx)($,{tone:Ih(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,"data-slot":`unread-marker`,className:i?$b:void 0}):null,i?(0,Q.jsx)(Xb,{pinned:!!e.pinned,onToggle:t=>i(e,t),className:C(`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2`,Zb)}):null,a&&!r&&Yr(e)?(0,Q.jsx)(`button`,{type:`button`,"data-action":`archive-run`,"aria-label":`Archive ${t}`,title:`Archive task`,onClick:t=>{t.stopPropagation(),a(e)},className:C(`absolute top-[19.5px] left-1/2 inline-flex size-5 -translate-x-1/2 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none motion-reduce:transition-none`,Qb),children:(0,Q.jsx)(ba,{className:`size-[12px] -translate-y-[2.5px]`,"aria-hidden":`true`})}):null]})}function tx({inertReferences:e,swipeable:t,swipe:n,title:r,onArchive:i,children:a}){return e?(0,Q.jsxs)(`div`,{ref:n.surfaceRef,"data-slot":`task-row-swipe`,"data-swipe":t?`on`:void 0,"data-phase":t?n.phase:void 0,className:C(`relative rounded-[6px]`,t&&`touch-pan-y touch-pinch-zoom overflow-hidden`),children:[n.offset<0?(0,Q.jsx)(nx,{width:-n.offset,past:n.past,title:r,onArchive:i}):null,a]}):a}function nx({width:e,past:t,title:n,onArchive:r}){return(0,Q.jsx)(`div`,{"data-slot":`task-row-swipe-action`,"data-past":t?`true`:void 0,"aria-hidden":`true`,style:{width:e},className:C(`absolute inset-y-0 right-0 flex items-stretch justify-end overflow-hidden rounded-[6px]`,t?`bg-info text-signal-ink`:`bg-muted text-foreground`),children:t?(0,Q.jsxs)(`span`,{className:`flex w-full items-center justify-center gap-2 text-[12px] font-semibold whitespace-nowrap`,children:[(0,Q.jsx)(ba,{className:`size-[16px] shrink-0`,"aria-hidden":`true`}),`Release to archive`]}):(0,Q.jsxs)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Archive ${n}`,onClick:e=>{e.stopPropagation(),r()},className:`flex w-[88px] shrink-0 flex-col items-center justify-center gap-1 text-[12px] font-semibold`,children:[(0,Q.jsx)(ba,{className:`size-[16px]`,"aria-hidden":`true`}),`Archive`]})})}var rx=`[&>[data-ellipsis-hidden]]:pointer-events-none`,ix=`data-ellipsis-hidden`,ax=new Map;function ox(e){let t=getComputedStyle(e),n=`${t.fontStyle} ${t.fontWeight} ${t.fontSize} ${t.fontFamily} ${t.letterSpacing}`,r=ax.get(n);if(r!==void 0)return r;let i=document.createElement(`span`);i.textContent=`…`,i.setAttribute(`aria-hidden`,`true`),Object.assign(i.style,{position:`absolute`,visibility:`hidden`,whiteSpace:`pre`,fontStyle:t.fontStyle,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFamily:t.fontFamily,letterSpacing:t.letterSpacing}),document.body.appendChild(i);let a=i.getBoundingClientRect().width;i.remove();let o=a||parseFloat(t.fontSize)||12;return a&&(!document.fonts||document.fonts.status===`loaded`)&&ax.set(n,o),o}function sx(e,t){if(e.scrollWidth<=e.clientWidth)return[];let n=e.getBoundingClientRect(),r=parseFloat(getComputedStyle(e).paddingRight)||0,i=n.left+e.clientLeft+e.clientWidth-r-t+.5;return Array.from(e.children).filter(e=>e.getBoundingClientRect().right>i)}function cx(e,t,n){Z.useLayoutEffect(()=>{let n=e.current;if(!t||!n||typeof ResizeObserver>`u`)return;let r=!0,i=()=>{if(!r)return;let e=new Set(sx(n,ox(n)));for(let t of Array.from(n.children))t.hasAttribute(ix)!==e.has(t)&&t.toggleAttribute(ix,e.has(t))},a=new ResizeObserver(i),o=new Set,s=()=>{for(let e of Array.from(n.children))o.has(e)||(o.add(e),a.observe(e))};a.observe(n),s(),i();let c=typeof MutationObserver>`u`?null:new MutationObserver(()=>{s(),i()});return c?.observe(n,{childList:!0}),document.fonts&&document.fonts.status!==`loaded`&&document.fonts.ready.then(i),()=>{r=!1,a.disconnect(),c?.disconnect();for(let e of Array.from(n.children))e.removeAttribute(ix)}},[e,t,n])}var lx=`(hover: none)`;function ux(){let[e,t]=(0,Z.useState)(()=>typeof window.matchMedia==`function`&&window.matchMedia(lx).matches);return(0,Z.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(lx);t(e.matches);let n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var dx={"needs-permission":`label`,failed:`label`,"needs-you":`none`,"needs-review":`label`,running:`label`,"usage-limit":`resume`,"waiting-on-workers":`label`,"waiting-on-subagents":`label`,"waiting-for-ci":`label`,"waiting-for-merge":`label`,"waiting-for-command":`until`,monitoring:`next-check`,"waiting-for-capacity":`label`,queued:`queue-position`,done:`none`,cancelled:`none`,unseen:`label`};function fx(e,t,n,r){let{label:i}=e;switch(dx[e.rung]){case`none`:return;case`queue-position`:return t===null?i:`queued #${t}`;case`resume`:{let e=qa(n.autoResumeAt,r),t=n.autoResumeReason===`provider-error`?`provider error`:i;return e===`scheduled`?t:`${t}, ${e}`}case`next-check`:{let e=Rt(n),t=e?.kind===`timer`?new Date(e.at):void 0;return t&&Number.isFinite(t.getTime())?`${i}, next check ${Ja(t,new Date(r))}`:i}case`until`:{let e=Rt(n),t=e?.kind===`process`?new Date(e.deadline):void 0;return t&&Number.isFinite(t.getTime())?`${i}, until ${Ja(t,new Date(r))}`:i}case`label`:return i}}function px({run:e,attention:t,queuePosition:n,inWorkingGroup:r,scope:i,now:a}){let o=Wr(e,void 0,i??void 0),s=n===null?Ga(e.finishedAt??e.createdAt,a):``,c=r&&t.rung===`running`?void 0:fx(t,n,e,a);return{stateWord:c,references:o,age:s,key:`${s}|${c??``}|${o.map(e=>`${e.kind}-${e.number}-${e.url}`).join(`,`)}|${+!!e.notify}`}}function mx(e){let t=xi(e);return{title:t,displayTitle:Ur(t,yi(e)?.number)?Jr(t).rest:t}}function hx(e){let[t,n]=Z.useState(()=>Date.now());return Z.useEffect(()=>{if(te())return;let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var gx=`cez-sidebar-collapsed`,_x=`cez-sidebar-sections-collapsed`;function vx(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 yx(e=gx){try{let t=localStorage.getItem(e);return t===null?{}:vx(JSON.parse(t))}catch{return{}}}function bx(e,t=gx){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}var xx=`cez-sidebar-sections-changed`;function Sx(e){let[t,n]=(0,Z.useState)(()=>yx(_x)),[r,i]=(0,Z.useState)({}),a=(0,Z.useRef)(t);(0,Z.useEffect)(()=>{let e=e=>{if(e instanceof StorageEvent&&e.key!==null&&e.key!==`cez-sidebar-sections-collapsed`)return;let t=e instanceof CustomEvent?e.detail:yx(_x);a.current=t,n(t)};return window.addEventListener(`storage`,e),window.addEventListener(xx,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(xx,e)}},[]),(0,Z.useEffect)(()=>{if(e===null||Object.keys(r).length===0)return;let t={...a.current};for(let[n,i]of Object.entries(r))t[JSON.stringify([e,n])]=i;i({}),a.current=t,n(t),bx(t,_x),window.dispatchEvent(new CustomEvent(xx,{detail:t}))},[e,r]);let o=t=>JSON.stringify([e,t]);return{isCollapsed:e=>e!==`Archived`&&(r[e]??t[o(e)])===!0,toggle:t=>{if(e===null){i(e=>({...e,[t]:e[t]!==!0}));return}let r=o(t),s={...a.current,[r]:a.current[r]!==!0};a.current=s,n(s),bx(s,_x),window.dispatchEvent(new CustomEvent(xx,{detail:s}))}}}function Cx({runs:e,view:t,automations:n,onViewChange:r,currentRunId:i=null,now:a=Date.now(),onTogglePin:o,onArchiveRun:s,onSweep:c,sweeping:l=null,showViewControls:u=!0,rowLimit:d,sidebarLimits:f,projectId:p=null}){let m=od(),h=Pr(e,n),g=Kr(e,t,n),_=Rr(g,`active`),v=ii(_,f??d??{overall:null}),y=c?wx(g):void 0;return(0,Q.jsxs)(`div`,{"data-slot":`quick-list`,children:[(0,Q.jsxs)(`div`,{"data-slot":`quick-list-header`,className:`flex min-h-11 items-center gap-1.5 pr-[6px] pl-[10px] md:min-h-[26px]`,children:[(0,Q.jsx)(`h2`,{className:`text-[13px] font-semibold text-foreground`,children:`Tasks`}),(0,Q.jsx)(`span`,{className:`text-[11.5px] text-soft-foreground`,children:h[t]}),(0,Q.jsxs)(Y,{to:`/`,onClick:m,className:`ml-auto flex min-h-11 items-center gap-0.5 text-[12px] text-soft-foreground hover:text-foreground md:min-h-[26px]`,children:[`All`,(0,Q.jsx)(Sa,{className:`size-[13px]`,"aria-hidden":`true`})]})]}),u?(0,Q.jsx)(`div`,{className:`sticky top-0 z-10 bg-sidebar pt-2 pb-1`,children:(0,Q.jsx)(`div`,{className:`inline-flex w-full gap-0.5 rounded-md bg-muted p-[2px]`,children:(0,Q.jsx)(Rx,{view:t,automations:n,onSelect:r,counts:h})})}):null,_.length===0?(0,Q.jsx)(`p`,{className:`px-3 py-3.5 text-xs text-soft-foreground`,children:t===`automations`?`No automation tasks.`:`No tasks yet — describe one.`}):(0,Q.jsx)(Tx,{buckets:v,allBuckets:_,sectionProjectId:p,currentRunId:qr(i,e),now:a,onTogglePin:o,onArchiveRun:s,onSweep:c,sweeping:l,sweepCounts:y,view:t,automations:n})]})}function wx(e){return{unpinned:ti(e,`unpinned`),pinned:ti(e,`pinned`)}}function Tx({buckets:e,currentRunId:t=null,now:n=Date.now(),scope:r=null,onTogglePin:i,onArchiveRun:a,onSweep:o,sweeping:s=null,sweepCounts:c,projectName:l,allBuckets:u=e,sectionProjectId:d=r,view:f=`active`,automations:p}){let m=Z.useId(),h=Sx(d),g=Z.useRef(null),_=Z.useRef(null);Z.useLayoutEffect(()=>{let e=_.current;if(!e||e.element.isConnected||(_.current=null,document.activeElement!==document.body))return;let t=u.find(t=>t.rows.some(t=>t.run.id===e.id));if(!t)return;let n=Array.from(g.current?.children??[]).find(e=>e.dataset.bucket===t.label);(Array.from(n?.querySelectorAll(`[data-slot="task-row"]`)??[]).find(t=>t.dataset.runId===e.id)?.querySelector(`a`)??n?.querySelector(`[data-slot="section-toggle"]`))?.focus({preventScroll:!0})});let v=(e,o=!1)=>(0,Q.jsx)(Nx,{inWorkingGroup:o,run:e.run,queuePosition:e.queuePosition,currentRunId:t,now:n,scope:r,onTogglePin:i,onArchiveRun:a});return(0,Q.jsx)(`div`,{ref:g,className:`flex flex-col gap-3`,onFocusCapture:e=>{let t=e.target.closest(`[data-slot="task-row"]`);_.current=t?.dataset.runId?{id:t.dataset.runId,element:e.target}:null},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||(_.current=null)},children:u.map(t=>{let n=t.label===`Archived`,i=h.isCollapsed(t.label),a=e.find(({label:e})=>e===t.label)?.rows??[],u=t.rows.length,d=!n&&!i&&a.length<u,g=`${m}-${t.label.replaceAll(` `,`-`)}`;return(0,Q.jsxs)(`div`,{"data-slot":`quick-list-bucket`,"data-bucket":t.label,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pr-[6px]`,children:[(0,Q.jsx)(Dx,{id:g,bucket:t,collapsed:i,cut:d,onToggle:h.toggle}),d?(0,Q.jsx)(Ex,{section:t.label,shown:a.length,total:u,scope:r,view:f,automations:p}):null,o&&c?(0,Q.jsx)(Ix,{label:t.label,headingId:g,projectName:l,counts:c,onSweep:o,sweeping:s}):null]}),(0,Q.jsx)(`div`,{id:`${g}-rows`,hidden:i,children:!i&&a.map(e=>(0,Q.jsx)(`div`,{children:v(e,t.label===`Working`)},e.run.id))})]},t.label)})})}function Ex({section:e,shown:t,total:n,scope:r,view:i,automations:a}){let o=od();return(0,Q.jsxs)(Y,{to:hs(r,kr(e,i,a)),onClick:o,"data-slot":`section-cut-link`,"aria-label":`${e}: showing ${t} of ${n}, see all`,title:`The sidebar shows ${t} of ${n} ${e} tasks. Click to see all of them. Change the limit in ${Qa(`sidebar`)}.`,className:`mr-auto -ml-1 flex min-h-[44px] min-w-[44px] shrink-0 items-center rounded-[4px] px-1 text-[11px] font-normal text-soft-foreground tabular-nums underline decoration-dotted underline-offset-[3px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground md:min-h-[26px] md:min-w-0 no-hover:min-h-[44px] no-hover:min-w-[44px]`,children:[t,` of `,n]})}function Dx({id:e,bucket:t,collapsed:n,cut:r,onToggle:i}){let a=t.rows.length;if(t.label===`Archived`)return(0,Q.jsx)(`h2`,{id:e,className:`min-w-0 flex-1 text-[11px] font-medium text-soft-foreground`,children:(0,Q.jsxs)(`span`,{className:`px-[10px] pt-[2px] pb-[4px]`,children:[t.label,` `,a]})});let o=t.label,s=t.rows.map(e=>e.run),c=s.length?Ce(Mr(s)):null,l=s.some(Zr),u=n?Sa:ua;return(0,Q.jsx)(`h2`,{id:e,className:C(`min-w-0 text-[11px] font-medium text-soft-foreground`,r?`shrink-0`:`flex-1`),children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`section-toggle`,"aria-expanded":!n,"aria-controls":`${e}-rows`,"aria-label":`${o} ${a}`,onClick:()=>i(o),className:C(`flex min-h-[44px] items-center gap-1.5 rounded-[4px] px-[10px] text-left hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground md:min-h-[26px] no-hover:min-h-[44px]`,r?`pr-[4px]`:`w-full`),children:[(0,Q.jsx)(u,{className:`size-[12px] shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:o}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(`span`,{className:`font-normal tabular-nums`,children:a})]}),c&&(o===`Needs you`||n)?(0,Q.jsx)($,{tone:c.tone,shape:c.shape,pulse:c.pulse,role:`img`,"aria-label":c.label,title:c.label}):null,n&&l?(0,Q.jsx)(`span`,{role:`img`,"aria-label":`unread`,title:`Unread tasks`,className:`size-[5px] shrink-0 rounded-full bg-foreground`}):null]})})}function Ox({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`view-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:C(`flex min-h-11 min-w-0 flex-1 items-center justify-center gap-1.5 rounded-[7px] text-[11px] font-medium text-muted-foreground md:min-h-[22px]`,a&&`bg-card font-semibold text-foreground shadow-xs`),children:[i,r>0?(0,Q.jsx)(`span`,{className:`font-mono text-[11px] tabular-nums`,children:r}):null]})}function kx(){let e=ux(),t=ci();return e||!t}function Ax(e){let t=document.createRange();t.selectNodeContents(e);let n=t.getBoundingClientRect?.().width,r=e.querySelector(`[data-reference-width]`),i=r?Math.max(0,Number(r.dataset.referenceWidth)-r.getBoundingClientRect().width):0;return Math.ceil((n||e.scrollWidth)+i)}function jx(e,t,n){let[r,i]=Z.useState(!1),[a,o]=Z.useState(0),s=Z.useRef(!1),c=Z.useRef(!1),l=Z.useRef(null),u=Z.useCallback(e=>{s.current=e,i(e)},[]);return Z.useLayoutEffect(()=>{let r=e.current;if(!t||!r||typeof ResizeObserver>`u`){l.current=null,u(!1);return}let i=!0,a=()=>{if(i){if(l.current?.key!==n){if(s.current){u(!1),o(e=>e+1);return}l.current={key:n,width:Ax(r)}}u(l.current.width>r.clientWidth)}};a();let d=new ResizeObserver(a);d.observe(r);let f=new WeakMap,p=new ResizeObserver(e=>{let t=!1;for(let n of e??[]){let e=n.borderBoxSize?.[0]?.inlineSize??n.contentRect.width,r=f.get(n.target);f.set(n.target,e),r!==void 0&&r!==e&&(t=!0)}!t||!i||(l.current=null,a())}),m=new Set,h=()=>{let e=!1;for(let t of[...r.children,...r.querySelectorAll(`[data-slot="reference-list"] [data-slot="pr-chip"], [data-slot="reference-list"] [data-slot="issue-chip"]`)]){let{slot:n}=t.dataset;n===`task-row-age`||t.getAttribute(`aria-hidden`)===`true`||m.has(t)||(m.add(t),f.set(t,t.getBoundingClientRect().width),p.observe(t),e=!0)}return e};h();let g=typeof MutationObserver>`u`?null:new MutationObserver(()=>{!h()||!i||(l.current=null,a())});return g?.observe(r,{childList:!0,subtree:!0}),document.fonts&&document.fonts.status!==`loaded`&&!c.current&&document.fonts.ready.then(()=>{c.current=!0,i&&(l.current=null,a())}),()=>{i=!1,d.disconnect(),p.disconnect(),g?.disconnect()}},[e,t,n,a,u]),t&&r}function Mx(){return(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:` · `})}function Nx({run:e,queuePosition:t,currentRunId:n,now:r,scope:i,inWorkingGroup:a=!1,onTogglePin:o,onArchiveRun:s}){let c=gs(),l=od(),u=kx(),d=!!s&&u&&Yr(e),f=db({id:e.id,enabled:d,onArchive:()=>s?.(e)}),p=hs(i,`/tasks/${e.id}`),m=Ce(e),h=e.id===n,{title:g,displayTitle:_}=mx(e),v=Zr(e),y=px({run:e,attention:m,queuePosition:t,inWorkingGroup:a,scope:i,now:r}),[b,x]=Z.useState(null);return(0,Q.jsx)(tx,{inertReferences:u,swipeable:d,swipe:f,title:g,onArchive:()=>void s?.(e),children:(0,Q.jsxs)(`div`,{"data-slot":`task-row`,"data-run-id":e.id,"data-active":h?`true`:void 0,onClick:e=>{e.currentTarget.contains(e.target)&&(e.target.closest(`a, button, input`)||(c(p),l?.()))},...d?f.bind:{},style:f.offset?{transform:`translateX(${f.offset}px)`}:void 0,className:C(`selection-row group/task-row flex cursor-pointer items-start gap-2.5 rounded-[6px] py-1.5 pr-2 pl-2.5 hover:bg-sidebar-row-hover`,d&&`select-none`,d&&f.phase!==`dragging`&&`motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-out`,h&&`bg-sidebar-row-selected hover:bg-sidebar-row-selected`),children:[(0,Q.jsx)(`span`,{"data-slot":`task-row-dot`,className:`flex h-[19px] w-[12px] shrink-0 items-center justify-center`,children:(0,Q.jsx)($,{tone:m.tone,shape:m.shape,pulse:m.pulse,"aria-label":m.label,title:m.label,role:`img`})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Q.jsx)(Px,{run:e,to:p,title:g,displayTitle:_,isActive:h,unread:v,swipeable:d,onNavigate:l}),(0,Q.jsx)(Fx,{run:e,meta:y,title:g,scope:i,isActive:h,inertReferences:u,overflowContainer:b})]}),y.references.length?(0,Q.jsx)(`span`,{ref:x,"data-slot":`protected-reference-overflow`,className:C(`shrink-0 self-end`,u&&`-my-1.5 self-center`)}):null,e.delegation?.role===`worker`?(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`Worker · `,m.label]}):null,(0,Q.jsx)(ex,{run:e,title:g,unread:v,inertReferences:u,onTogglePin:o,onArchiveRun:s})]})})}function Px({run:e,to:t,title:n,displayTitle:r,isActive:i,unread:a,swipeable:o,onNavigate:s}){return(0,Q.jsxs)(Y,{to:t,onClick:s,title:n,"aria-current":i?`page`:void 0,draggable:!o&&void 0,className:`flex h-[19px] min-w-0 items-center gap-2 rounded-[2px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,children:[(0,Q.jsx)(`span`,{"data-slot":`task-row-title`,className:C(`min-w-[7rem] flex-1 truncate text-[13px] leading-[1.45] font-medium text-muted-foreground`,a&&`font-semibold text-foreground`,i&&`text-foreground`),children:r}),e.diffStat?(0,Q.jsx)(pb,{stat:e.diffStat,className:`hidden shrink-0 text-[12px] @min-[23rem]/sidebar:inline`}):null]})}function Fx({run:e,meta:t,title:n,scope:r,isActive:i,inertReferences:a,overflowContainer:o}){let{stateWord:s,references:c,age:l,key:u}=t,d=eo(),f=Z.useRef(null),p=jx(f,!!l,u);cx(f,!a&&c.length>0,`${u}|${+!!p}`);let m=[];return s&&m.push((0,Q.jsx)(`span`,{"data-slot":`task-row-state`,children:s},`state`)),c.length&&m.push((0,Q.jsx)(Yb,{references:c,maxVisible:2,taskTitle:n,projectId:r??d.projectId,repoBase:d.repoBase,runId:e.id,plain:!0,compact:!0,inertInline:a,fitContainer:!0,overflowContainer:o},`references`)),l&&!p&&m.push((0,Q.jsx)(`span`,{"data-slot":`task-row-age`,className:`tabular-nums`,children:l},`age`)),(0,Q.jsxs)(`div`,{ref:f,"data-slot":`task-row-meta`,className:C(`h-[16px] min-w-0 truncate text-[11.5px] leading-[1.4] font-normal text-soft-foreground`,rx,i&&`text-muted-foreground`),children:[e.notify===!0?(0,Q.jsx)(`span`,{"data-slot":`task-row-notify`,role:`img`,"aria-label":`Notifying the task webhook`,title:`Notifying the task webhook`,className:`mr-[4px] inline-block shrink-0 align-[-1px]`,children:(0,Q.jsx)(Hu,{"aria-hidden":`true`,className:`size-[10px]`})}):null,m.length?m.flatMap((e,t)=>t?[(0,Q.jsx)(Mx,{},`sep-${t}`),e]:[e]):e.notify===!0?null:`\xA0`]})}function Ix({label:e,headingId:t,projectName:n,counts:r,onSweep:i,sweeping:a}){let o=e===`Finished`?`unpinned`:null;if(!o||r[o]===0)return null;let s=a===o,c=`Archive all`;return(0,Q.jsxs)(`button`,{type:`button`,"data-action":`archive-group`,"data-scope":o,disabled:s,"aria-busy":s?`true`:void 0,"aria-label":n?`${c}, ${n}`:void 0,"aria-describedby":t,onClick:()=>i(o),className:`relative inline-flex shrink-0 items-center gap-1 rounded-[4px] px-1.5 py-0.5 font-sans text-[11px] leading-[1.4] text-muted-foreground hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-link-foreground disabled:opacity-60 max-md:before:absolute max-md:before:top-1/2 max-md:before:left-0 max-md:before:h-11 max-md:before:w-full max-md:before:-translate-y-1/2 max-md:before:content-[''] no-hover:before:absolute no-hover:before:top-1/2 no-hover:before:left-0 no-hover:before:h-11 no-hover:before:w-full no-hover:before:-translate-y-1/2 no-hover:before:content-['']`,children:[(0,Q.jsx)(ba,{className:`size-[11px]`,"aria-hidden":`true`}),c]})}function Lx({showViewControls:e=!0,projectId:t,boot:n=!1}){let r=od(),i=t??c(),a=gn(i,!0,n),o=Sn(i,!0,n).data?.sidebarLimits??{},s=Sr(fr({projectId:i,boot:n})),l=nb(fr({projectId:i,boot:n}),r),u=En(),[d,f,p]=cy(),m=vs(`/tasks/:id/*`),h=vs(`/tasks/:id`),g=hx(3e4),_=Mn(),v=t??_,y=Ln(v),b=ii(Rr(Kr(a.data??[],d,p),`active`),o),x=v===void 0?[]:b.flatMap(e=>e.rows.flatMap(({run:e})=>Wr(e,y).filter(e=>ei(e,y)).map(e=>({projectId:v,kind:e.kind,number:e.number}))));return a.data?(0,Q.jsx)(Za,{projectId:v,repoBase:y,requests:x,children:(0,Q.jsx)(Cx,{showViewControls:e,sidebarLimits:o,projectId:v==="default"?u.data?.bootProject??null:v??null,runs:a.data,view:d,automations:p,onViewChange:f,currentRunId:m?.params.id??h?.params.id??null,now:g,onTogglePin:(e,t)=>s.mutate({id:e.id,pinned:t}),onArchiveRun:l.archiveOne,onSweep:e=>l.sweep(e,p?d===`automations`:void 0),sweeping:l.sweeping})}):null}function Rx({view:e,automations:t,onSelect:n,counts:r}){let i=(0,Q.jsx)($,{tone:`pending`,pulse:!0,"data-slot":`waiting-dot`,"aria-label":`needs you`});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Ox,{view:`active`,current:e,onSelect:n,count:r.active,children:[`Active`,r.activeWaiting>0&&e!==`active`?i:null]}),t?(0,Q.jsxs)(Ox,{view:`automations`,current:e,onSelect:n,count:r.automations,children:[`Automations`,r.automationsWaiting>0&&e!==`automations`?i:null]}):null]})}var zx=e=>e.available?`success`:`danger`,Bx=e=>e.available?`Installed`:`Not installed`,Vx=e=>e.available?null:e.hint??null,Hx=`/settings/agents`,Ux=`inline-flex items-center rounded-sm text-xs font-medium text-foreground hover:underline focus-visible:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring max-md:min-h-11 no-hover:min-h-11`,Wx=(e,t)=>wi(t).includes(e.name);function Gx(e,t){let n=e.checks.filter(e=>Wx(e,t));if(n.length&&!n.some(e=>e.available))return`no agent CLI found — install one to run tasks`;let r=n.find(t=>t.name===e.defaultRunner);return r&&!r.available?`default runner (${e.defaultRunner}) not found`:null}function Kx(e,t){let n=`Squawk v${e.version}`;if(t===void 0)return n;let r=Gx(e,t);if(r)return`${n} · ${r}`;let i=e.checks.filter(e=>!e.available).map(e=>e.name);return i.length?`${n} · optional: ${i.join(`, `)} not installed`:n}function qx(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 Jx({health:e,runners:t,sessionScope:n}){if(!e)return null;let r=Gx(e,t);return(0,Q.jsxs)(No,{children:[(0,Q.jsx)(Ao,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`tools-menu-trigger`,"aria-label":`Tools`,title:Kx(e,t),className:`relative flex items-center gap-1.5 rounded-[6px] px-2 py-1.5 text-[12px] font-normal text-soft-foreground transition-colors hover:bg-sidebar-row-hover hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-[state=open]:bg-sidebar-row-selected data-[state=open]:text-foreground`,children:[(0,Q.jsx)(ta,{className:`size-[15px]`,"aria-hidden":`true`}),r?(0,Q.jsx)($,{tone:`pending`,className:`absolute top-1 left-5 size-1.5`}):null,`Tools`]})}),(0,Q.jsxs)(jo,{side:`top`,align:`start`,"data-slot":`tools-menu-content`,className:`w-[240px]`,children:[n?(0,Q.jsx)(`div`,{className:`px-2 py-2`,children:n}):null,(0,Q.jsx)(yo,{className:`text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:`Installed tools`}),e.checks.map(e=>e.available?(0,Q.jsx)(Yx,{check:e},e.name):(0,Q.jsx)(Xx,{check:e},e.name)),qx(e)?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Do,{}),(0,Q.jsx)(`p`,{"data-slot":`forge-note`,className:`px-2 py-1.5 text-[11px] leading-snug text-muted-foreground`,children:qx(e)})]}):null,(0,Q.jsx)(Do,{}),(0,Q.jsx)(Eo,{asChild:!0,children:(0,Q.jsx)(E,{to:`/tools`,children:`Tools diagnostics`})}),(0,Q.jsx)(Eo,{asChild:!0,children:(0,Q.jsxs)(Y,{to:Hx,"data-slot":`tools-settings`,className:`gap-2 text-[13px] text-muted-foreground`,children:[(0,Q.jsx)(Ui,{className:`size-3.5`,"aria-hidden":`true`}),`Tool settings`]})})]})]})}function Yx({check:e}){return(0,Q.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,Q.jsx)($,{tone:zx(e)}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] font-medium`,children:e.name}),(0,Q.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11px] font-medium text-muted-foreground tabular-nums`,children:e.version??`not found`})]})}function Xx({check:e}){let t=Vx(e);return(0,Q.jsx)(Eo,{asChild:!0,children:(0,Q.jsxs)(Y,{to:Hx,"data-slot":`tool-row`,"data-tool":e.name,"data-available":`false`,className:`flex-col items-stretch gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)($,{tone:zx(e)}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] font-medium`,children:e.name}),(0,Q.jsx)(`span`,{"data-slot":`tool-version`,className:`ml-auto font-mono text-[11px] font-medium text-muted-foreground`,children:`not found`})]}),(0,Q.jsxs)(`span`,{className:`flex items-end justify-between gap-3 pl-[15px]`,children:[t?(0,Q.jsx)(`span`,{"data-slot":`tool-hint`,className:`min-w-0 text-[11px] leading-snug text-muted-foreground`,children:t}):null,(0,Q.jsx)(`span`,{"data-slot":`tool-setup`,className:`ml-auto shrink-0 text-[11px] font-semibold text-accent-text`,children:`Set up →`})]})]})})}function Zx(e){return e?.trim()||null}function Qx({projectName:e,pageLabel:t}){let n=Zx(e),r=Zx(t);return n&&r?`${n} — ${r} · Squawk`:n?`${n} · Squawk`:r?`${r} · Squawk`:`Squawk`}function $x(e){let t=Qx(e);(0,Z.useEffect)(()=>{document.title=t},[t])}function eS({...e}){return(0,Q.jsx)(qd,{"data-slot":`alert-dialog`,...e})}function tS({...e}){return(0,Q.jsx)(Jd,{"data-slot":`alert-dialog-portal`,...e})}function nS({className:e,...t}){return(0,Q.jsx)(Yd,{"data-slot":`alert-dialog-overlay`,className:C(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none`,e),...t})}function rS({className:e,...t}){return(0,Q.jsxs)(tS,{children:[(0,Q.jsx)(nS,{}),(0,Q.jsx)(Xd,{"data-slot":`alert-dialog-content`,className:C(`fixed inset-bs-[50%] start-[50%] z-50 grid max-h-[calc(100dvh-2rem)] overflow-y-auto overscroll-contain w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-hidden motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95 motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none sm:max-w-md`,e),...t})]})}function iS({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:C(`flex flex-col gap-2 text-center sm:text-start`,e),...t})}function aS({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:C(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function oS({className:e,...t}){return(0,Q.jsx)($d,{"data-slot":`alert-dialog-title`,className:C(`text-lg leading-none font-semibold`,e),...t})}function sS({className:e,...t}){return(0,Q.jsx)(ef,{"data-slot":`alert-dialog-description`,className:C(`text-sm text-muted-foreground`,e),...t})}function cS({className:e,...t}){return(0,Q.jsx)(Zd,{"data-slot":`alert-dialog-action`,className:C(T({variant:`contrast`}),e),...t})}function lS({className:e,...t}){return(0,Q.jsx)(Qd,{"data-slot":`alert-dialog-cancel`,className:C(T({variant:`outline`}),e),...t})}function uS(e){let t=bs(e);return/^\/git\/branches(?:\/|$)/.test(t)?`branches`:/^\/git\/not-landed(?:\/|$)/.test(t)?`not-landed`:/^\/git\/cleanup(?:\/|$)/.test(t)?`cleanup`:/^\/git\/changes(?:\/|$)/.test(t)?`changes`:/^\/git(?:\/commits(?:\/[^/]+)?)?\/?$/.test(t)?`main`:null}var dS={main:`/git`,"not-landed":`/git/not-landed`,cleanup:`/git/cleanup`,branches:`/git/branches`,changes:`/git/changes`},fS=`/git?view=repo`,pS={second:`s`,minute:`m`,hour:`h`,day:`d`,week:`w`,month:`mo`,year:`y`};function mS(e){let t=/^(\d+) (second|minute|hour|day|week|month|year)s? ago$/.exec(e.trim());return t?`${t[1]}${pS[t[2]]}`:e}function hS(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}var gS=new Intl.DateTimeFormat(`en-US`,{weekday:`short`,month:`short`,day:`numeric`}),_S=new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,year:`numeric`});function vS(e,t){let n=Date.parse(e);if(Number.isNaN(n))return`Earlier`;let r=hS(t);if(n>=r)return`Today`;if(n>=hS(r-1))return`Yesterday`;let i=new Date(n);return(i.getFullYear()===new Date(t).getFullYear()?gS:_S).format(i)}function yS(e,t=Date.now()){let n=[];for(let r of e){let e=vS(r.at,t),i=n.at(-1);i?.label===e?i.commits.push(r):n.push({label:e,commits:[r]})}return n}function bS(e,t=Date.now()){return e.filter(e=>vS(e.at,t)===`Today`).length}function xS(e,t){return(e.baseBranch??t.branch)===t.branch?e.tracking:null}function SS(e,t=Date.now()){let n=e.fetchedAt?Ga(e.fetchedAt,t):``;return n?`fetched ${n} ago`:`never fetched`}function CS(e,t){let n=I(),r=[e,`repo`],i=[e,`health`],[a,o]=(0,Z.useState)(null),s=e=>G(e.message,{tone:`danger`}),c=()=>Promise.all([n.invalidateQueries({queryKey:r}),n.invalidateQueries({queryKey:i}),n.invalidateQueries({queryKey:V.projects})]),l=H({mutationFn:t=>Ke(t,e)}),u=async(e=!1)=>{let n=a?.branch??t.branch;try{let t=await l.mutateAsync(e?{branch:n,confirm:!0}:{branch:n});if(`risks`in t){o(t);return}o(null),G(t.summary),await c()}catch(e){o(null),G(e instanceof Error?e.message:String(e),{tone:`danger`}),await c()}},d=H({mutationFn:t=>ae({name:t},e),onSuccess:async e=>{G(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await c(),n.setQueryData(r,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),n.setQueryData(i,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:s}),f=H({mutationFn:t=>jt({baseBranch:t},e),onSuccess:t=>{G(t.baseBranch?`New tasks now start from ${t.baseBranch}`:`New tasks now start from the checked-out branch`),n.invalidateQueries({queryKey:r}),n.invalidateQueries({queryKey:[e,`config`]})},onError:s});return{hasRemote:!!t.remote,pull:u,pulling:l.isPending,confirmation:a,dismissConfirmation:()=>{l.isPending||o(null)},switchBranch:d,setBase:f}}var wS={sidebar:{card:`gap-[8px] rounded-[8px] p-[10px]`,branchRow:`gap-[6px]`,branchIcon:`size-[14px]`,branch:`text-[12.5px]`,chevron:`size-[12px]`,pull:`h-[24px] gap-[4px] rounded-[6px] px-[8px] text-[11.5px] [&>svg]:size-[12px]`,line:`text-[11px]`,lineChevron:`size-[11px]`,dirty:`gap-[6px] pt-[6px] text-[11px] [&>svg]:size-[12px]`},screen:{card:`gap-[10px] rounded-[10px] p-[12px]`,branchRow:`gap-[8px]`,branchIcon:`size-[16px]`,branch:`text-[14px]`,chevron:`size-[14px]`,pull:`h-[36px] gap-[6px] rounded-[8px] px-[14px] text-[13px] [&>svg]:size-[14px]`,line:`text-[12px]`,lineChevron:`size-[12px]`,dirty:`h-[40px] gap-[8px] pt-[4px] text-[13px] [&>svg:first-child]:size-[14px] [&>svg:last-child]:size-[15px]`}};function TS({scope:e,repo:t,info:n,variant:r,onNavigate:i}){let a=wS[r],o=CS(e,n),s=t.baseBranch??n.branch,c=t.status.length,l=xS(t,n),u=o.switchBranch.isPending,d=(0,Z.useRef)(null);return(0,Q.jsxs)(`section`,{"aria-label":`Checkout`,"data-slot":`git-checkout`,"data-variant":r,className:C(`flex flex-col border border-border`,a.card),children:[(0,Q.jsxs)(`div`,{className:C(`flex min-w-0 items-center`,a.branchRow),children:[(0,Q.jsxs)(No,{children:[(0,Q.jsxs)(Ao,{"data-slot":`git-branch-menu`,"aria-label":`Branch ${n.branch}. Switch branch`,disabled:u,className:C(`group flex min-w-0 flex-1 items-center rounded-[4px] text-left outline-none focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,a.branchRow,r===`screen`&&`min-h-11`),children:[(0,Q.jsx)(ji,{"aria-hidden":`true`,className:C(`shrink-0 text-muted-foreground`,a.branchIcon)}),(0,Q.jsx)(`span`,{"data-slot":`git-checkout-branch`,className:C(`min-w-0 flex-1 truncate font-mono font-semibold text-foreground`,a.branch),children:n.branch}),(0,Q.jsx)(ua,{"aria-hidden":`true`,className:C(`shrink-0 text-soft-foreground group-hover:text-foreground`,a.chevron)})]}),(0,Q.jsxs)(jo,{align:`start`,className:`w-64`,children:[(0,Q.jsx)(yo,{className:`text-xs text-soft-foreground`,children:`Switch branch`}),(0,Q.jsx)(Mo,{value:n.branch,onValueChange:e=>{e!==n.branch&&o.switchBranch.mutate(e)},children:t.branches.map(e=>(0,Q.jsx)(xo,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,Q.jsx)(`span`,{className:`truncate`,children:e})},e))}),(0,Q.jsx)(Do,{}),(0,Q.jsx)(Eo,{asChild:!0,children:(0,Q.jsx)(Y,{to:dS.branches,"data-slot":`git-branch-menu-all`,onClick:i,children:`Create or find a branch…`})})]})]}),(0,Q.jsxs)(`button`,{ref:d,type:`button`,"data-action":`repo-pull`,disabled:!o.hasRemote||o.pulling,title:o.hasRemote?`Pull ${n.branch}`:`No remote configured. Add a Git remote before pulling.`,onClick:()=>void o.pull(),className:C(`inline-flex shrink-0 items-center bg-muted font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100`,a.pull),children:[o.pulling?(0,Q.jsx)(Wa,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Q.jsx)(da,{"aria-hidden":`true`}),`Pull`]})]}),l?(0,Q.jsx)(ES,{tracking:l,className:a.line}):null,(0,Q.jsxs)(No,{children:[(0,Q.jsxs)(Ao,{"data-slot":`base-branch-picker`,"aria-label":`New tasks start from ${s}. Change the base branch`,disabled:o.setBase.isPending,className:C(`group flex min-w-0 items-center gap-[4px] self-start rounded-[4px] text-soft-foreground outline-none hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,a.line,r===`screen`&&`min-h-[32px]`),children:[(0,Q.jsx)(`span`,{className:`shrink-0`,children:`New tasks start from`}),(0,Q.jsx)(`span`,{"data-slot":`base-branch`,className:`min-w-0 truncate font-mono text-muted-foreground group-hover:text-foreground`,children:s}),(0,Q.jsx)(ua,{"aria-hidden":`true`,className:C(`shrink-0`,a.lineChevron)})]}),(0,Q.jsxs)(jo,{align:`start`,className:`w-64`,children:[(0,Q.jsx)(yo,{className:`text-xs text-soft-foreground`,children:`New tasks start from`}),(0,Q.jsxs)(Mo,{value:t.baseBranch??``,onValueChange:e=>o.setBase.mutate(e===``?null:e),children:[(0,Q.jsx)(xo,{value:``,"data-branch":``,className:`text-[12.5px]`,children:`The checked-out branch (default)`}),t.branches.map(e=>(0,Q.jsx)(xo,{value:e,"data-branch":e,className:`font-mono text-[12.5px]`,children:(0,Q.jsx)(`span`,{className:`truncate`,children:e})},e))]})]})]}),c>0?(0,Q.jsxs)(Y,{to:dS.changes,"data-slot":`git-uncommitted`,onClick:i,className:C(`flex min-w-0 items-center border-t border-border text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,a.dirty),children:[(0,Q.jsx)(ma,{"aria-hidden":`true`,className:`shrink-0 text-inbox-count-foreground`}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[c,` uncommitted file`,c===1?``:`s`]}),(0,Q.jsx)(Sa,{"aria-hidden":`true`,className:`shrink-0 text-soft-foreground`})]}):null,(0,Q.jsx)(DS,{checkout:o,returnFocus:d})]})}function ES({tracking:e,className:t}){let n=e.ref.split(`/`)[0]||e.ref,r=SS(e);return(0,Q.jsx)(`p`,{"data-slot":`git-freshness`,className:C(`flex min-w-0 items-center gap-[4px] text-soft-foreground`,t),children:e.behind>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{"data-slot":`git-behind`,className:`shrink-0 font-medium text-inbox-count-foreground`,children:[e.behind,` behind `,n]}),(0,Q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`· `,r]})]}):(0,Q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`up to date · `,r]})})}function DS({checkout:e,returnFocus:t}){return(0,Q.jsx)(eS,{open:e.confirmation!==null,onOpenChange:t=>!t&&e.dismissConfirmation(),children:(0,Q.jsxs)(rS,{onCloseAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,Q.jsxs)(iS,{children:[(0,Q.jsxs)(oS,{children:[`Pull `,e.confirmation?.branch,` anyway?`]}),(0,Q.jsx)(sS,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[e.confirmation?.risks.includes(`active_runs`)?(0,Q.jsx)(`p`,{children:`An active session is using this repository. Pulling can change files while it works.`}):null,e.confirmation?.risks.includes(`dirty_tree`)?(0,Q.jsx)(`p`,{children:`The checkout has dirty files. Git may refuse the pull to protect them.`}):null]})})]}),(0,Q.jsxs)(aS,{children:[(0,Q.jsx)(lS,{className:`h-11`,disabled:e.pulling,children:`Cancel`}),(0,Q.jsx)(cS,{className:`h-11`,disabled:e.pulling||e.confirmation===null,onClick:t=>{t.preventDefault(),e.pull(!0)},children:e.pulling?`Pulling…`:`Pull anyway`})]})]})})}var OS={main:ca,"not-landed":wu,cleanup:Ql,branches:ji};function kS(e,t){switch(e){case`main`:return t?`Recently on ${t}`:`Recent commits`;case`not-landed`:return`Not landed`;case`cleanup`:return`Cleanup`;case`branches`:return`All branches`;case`changes`:return`Uncommitted changes`}}var AS=[`main`,`not-landed`,`cleanup`,`branches`];function jS({branch:e,counts:t,variant:n,active:r,onNavigate:i}){let a=n===`screen`;return(0,Q.jsx)(`nav`,{"aria-label":`Git sections`,"data-slot":`git-sections`,className:a?ka:Oa,children:AS.map(n=>{let o=OS[n],s=!a&&r===n,c=t[n];return(0,Q.jsxs)(Y,{to:a&&n===`main`?fS:dS[n],"data-git-section":n,"aria-current":s?`page`:void 0,onClick:i,className:C(a?Aa:C(Pa,`text-[12.5px]`),Na,s&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:[(0,Q.jsx)(o,{"aria-hidden":`true`,className:a?Ba:Ia}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:kS(n,e)}),c?(0,Q.jsx)(`span`,{"data-slot":`git-section-count`,className:a?Fa:ja,children:c}):null,a?(0,Q.jsx)(Sa,{"aria-hidden":`true`,className:za}):null]},n)})})}async function MS(e,t){return ct(await Et.api.v1.p[`:projectId`].repo.branches.counts.$get({param:{projectId:t??c()}},Te(e)),`/repo/branches/counts`)}function NS(e){return wr({queryKey:[e,`repo`,`branches`,`counts`],queryFn:({signal:t})=>MS({signal:t},e)})}function PS(e,t,n){let r=dr(e),i=NS(e),a=r.data?.totalBytes??null,o=i.data?.counts??null,s=t&&n===`screen`?bS(t.log):0;return{main:s>0?`${s} today`:null,"not-landed":o?.notLanded?String(o.notLanded):null,cleanup:a?gi(a):r.data&&a===null&&o?.cleanup?String(o.cleanup):null,branches:t?String(i.data?.allBranches??t.branches.length):null}}function FS({scope:e}){let t=vn(e),{pathname:n}=a(),r=od(),i=t.data?.info?t.data:null,o=PS(e,i,`sidebar`);return(0,Q.jsxs)(`div`,{"data-slot":`git-sidebar`,role:`region`,"aria-label":`Git`,className:Va,children:[i?.info?(0,Q.jsx)(TS,{scope:e,repo:i,info:i.info,variant:`sidebar`,onNavigate:r},e):t.isPending?(0,Q.jsx)(`div`,{"data-slot":`git-checkout-placeholder`,"aria-hidden":`true`,className:`h-[94px] rounded-[8px] border border-border`}):null,t.isPending?null:(0,Q.jsx)(jS,{branch:i?.info?.branch??null,counts:o,variant:`sidebar`,active:uS(n),onNavigate:r})]})}var IS={assigned:$i,"no-task":Ha,"has-task":ya,all:ha,review:Ua,mine:Ii,failing:ia,"all-prs":ha};function LS(e,t){return e===`assigned`||e===`mine`?t.identity:e===`no-task`||e===`has-task`?t.tasks:null}function RS({model:e,variant:t,activeId:n,onNavigate:r}){let i=t===`screen`;return(0,Q.jsx)(Q.Fragment,{children:[{key:`issues`,label:`Issues`,rows:os},{key:`prs`,label:`Pull requests`,rows:ts}].map(t=>(0,Q.jsxs)(`nav`,{"aria-label":t.label,"data-slot":`github-filter-group`,"data-group":t.key,className:i?ka:C(Ma,t.key===`prs`&&`pt-[6px]`),children:[(0,Q.jsx)(`h3`,{className:i?La:Ra,children:t.label}),t.rows.map(({id:t,label:a})=>{let o=IS[t],s=n===t,c=LS(t,e.blocked),l=e.counts[t],u=ps(l),d=C(i?Aa:C(Pa,`text-[12.5px]`),c?`cursor-not-allowed opacity-60`:Na,s&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),f=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(o,{"aria-hidden":`true`,className:i?Ba:Ia}),(0,Q.jsx)(`span`,{className:`truncate`,children:a}),u?(0,Q.jsx)(`span`,{"data-slot":`gh-filter-count`,title:ds(t,l),className:i?Fa:ja,children:u}):null,i?(0,Q.jsx)(Sa,{"aria-hidden":`true`,className:C(za,!u&&`ml-auto`)}):null]});if(c)return(0,Q.jsxs)(`div`,{"data-gh-filter":t,"aria-disabled":`true`,title:c,className:d,children:[f,(0,Q.jsx)(`span`,{className:`sr-only`,children:c})]},t);let{view:p,filter:m}=ss(t);return(0,Q.jsx)(Y,{to:rs(p,m),"data-gh-filter":t,"aria-current":s?`page`:void 0,onClick:r,className:d,children:f},t)})]},t.key))})}function zS(e){let t=dn(e,50).data,n=t?.available===!0,r=gn(e,!0,e==="default"),i=zn(e,`pr`,cs,n),a=zn(e,`pr`,us,n),o=(0,Z.useMemo)(()=>r.data?ls(r.data,t?.repo,e):null,[r.data,t?.repo,e]);return{gh:t,counts:(0,Z.useMemo)(()=>ns({gh:t,tasks:o,review:i.data,failing:a.data}),[t,o,i.data,a.data]),blocked:{identity:t?.available===!0&&!t.viewerLogin?`GitHub login unavailable.`:null,tasks:r.isError&&!r.data?`Task list unavailable.`:null}}}function BS(e){return/^\/github\/prs(?:\/|$)/.test(bs(e))?`prs`:`issues`}function VS({scope:e}){let t=zS(e),{pathname:n}=a(),[r]=o(),i=od(),s=BS(n);return(0,Q.jsx)(`div`,{"data-slot":`github-sidebar`,role:`region`,"aria-label":`GitHub`,className:Va,children:(0,Q.jsx)(RS,{model:t,variant:`sidebar`,activeId:is(s,as(s,r.get(`filter`))),onNavigate:i})})}function HS(){let e=ur();return e.isPending?(0,Q.jsx)(`p`,{role:`status`,children:`Loading task settings…`}):e.isError?(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,Q.jsx)(WS,{config:e.data,scope:`project`})}function US(){let e=rr();return e.isPending?(0,Q.jsx)(`p`,{role:`status`,className:`p-4 text-sm`,children:`Loading task settings…`}):e.isError?(0,Q.jsxs)(`p`,{role:`alert`,className:`p-4 text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,Q.jsx)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-4 p-4 md:p-6`,children:(0,Q.jsx)(WS,{config:e.data,scope:`global`})})}function WS({config:e,scope:t}){let n=(0,Z.useId)(),r=I(),i=H({mutationFn:async({archiveOnMerge:e,projectKey:n})=>t===`project`?jt({archiveOnMerge:e},n[0]):Xe({archiveOnMerge:e}),onSuccess:(e,{projectKey:n})=>{t===`project`?r.setQueryData(n,e):(r.setQueryData(V.config,e),r.invalidateQueries({predicate:e=>e.queryKey.at(-1)===`config`&&e.queryKey!==V.config}))}});return(0,Q.jsxs)(`section`,{"data-slot":`archive-on-merge-field`,className:`flex min-w-0 flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`label`,{htmlFor:n,className:`text-sm font-semibold text-foreground`,children:`Archive tasks after PRs merge`}),(0,Q.jsx)(`p`,{id:`${n}-hint`,className:`text-[13px] text-muted-foreground`,children:`Automatically archive a settled task and its workers once all their associated pull requests merge. History stays available in Archived.`})]}),(0,Q.jsxs)(`select`,{id:n,"aria-describedby":`${n}-hint ${n}-effective`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus-visible:outline-2 focus-visible:outline-ring active:bg-muted disabled:opacity-50`,value:e.archiveOnMerge===null?`inherit`:e.archiveOnMerge?`enabled`:`disabled`,disabled:i.isPending,onChange:e=>i.mutate({archiveOnMerge:e.target.value===`inherit`?null:e.target.value===`enabled`,projectKey:U.config}),children:[(0,Q.jsx)(`option`,{value:`inherit`,children:t===`project`?`Inherit global setting`:`Use default`}),(0,Q.jsx)(`option`,{value:`enabled`,children:`Enabled`}),(0,Q.jsx)(`option`,{value:`disabled`,children:`Disabled`})]}),(0,Q.jsxs)(`p`,{id:`${n}-effective`,className:`text-[13px] text-muted-foreground`,children:[`Currently `,e.effectiveArchiveOnMerge?`enabled`:`disabled`,` · `,e.archiveOnMergeSource,` setting.`]}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Unarchive restores the task. It stays visible until a later associated PR merges.`}),i.isPending?(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Saving…`}):null,i.isError?(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save: `,i.error.message]}):null]})}function GS({className:e,orientation:t=`horizontal`,...n}){return(0,Q.jsx)(rm,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:C(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var KS=h(`group/tabs-list inline-flex w-fit items-center justify-center rounded-md p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function qS({className:e,variant:t=`default`,...n}){return(0,Q.jsx)(im,{"data-slot":`tabs-list`,"data-variant":t,className:C(KS({variant:t}),e),...n})}function JS({className:e,...t}){return(0,Q.jsx)(am,{"data-slot":`tabs-trigger`,className:C(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-sm border border-transparent px-3 py-1 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-[color,background-color,border-color,box-shadow] group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start pointer-hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-xs group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-card data-[state=active]:font-semibold data-[state=active]:text-foreground`,`after:absolute after:bg-accent-strong after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:inset-be-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function YS({className:e,...t}){return(0,Q.jsx)(om,{"data-slot":`tabs-content`,className:C(`flex-1 outline-hidden`,e),...t})}function XS(e,t){return Ti(t).flatMap(t=>{let n=e.filter(e=>e.provider===t.id);return n.length<2?[{runner:t,account:null,label:t.pickerLabel,desc:t.pickerDescription,missing:!1}]:n.map(e=>({runner:t,account:e.isDefault?null:e.id,label:`${t.pickerLabel} · ${e.label}`,desc:e.exists?e.configDir:`${e.configDir} — folder not created yet`,missing:!e.exists}))})}var ZS=(e,t)=>e.length>wi(t).length;function QS(e,t){let n=Ie(e.data,t),r=!e.isPending&&!e.isError&&n?.enabled===!0&&n.status===`connected`;return{providerConnected:r,providerReason:e.isPending?`Checking provider authentication…`:e.isError?`Provider authentication could not be verified.`:n?.enabled===!1?`This provider is disabled. Enable it above or choose another provider.`:r?void 0:`Connect this provider before selecting it.`}}function $S({rows:e,runner:t,accountFor:n,providerStatus:r,disabled:i=!1,accountDisabled:a=!1,onPick:o}){let s=Oi().data,c=s===void 0,l=ZS(e,s);return(0,Q.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default runner`,"data-slot":`agents-runner`,className:C(`gap-0.5 rounded-md border border-border bg-card p-0.5`,l?`flex max-w-md flex-col`:`inline-flex w-fit`),children:e.map(s=>{let{providerConnected:u,providerReason:d}=QS(r,s.runner.id),f=e.filter(e=>e.runner.id===s.runner.id).length>1,p=s.runner.id===t&&s.account===n(s.runner.id);return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":p,"data-value":s.runner.id,"data-account":s.account??``,title:d??s.desc,disabled:i||c||!u||f&&a,onClick:()=>o(s.runner.id,s.account,f),className:C(`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:[s.label,l?(0,Q.jsx)(`span`,{"data-slot":s.missing?`agents-account-missing`:`agents-account-dir`,"data-runner":s.runner.id,className:`ml-2 font-sans text-[11px] text-soft-foreground`,children:s.desc}):null]},`${s.runner.id}:${s.account??``}`)})})}var eC=`~/.claude-second`;function tC({open:e,onOpenChange:t,providers:n,initialProvider:r}){let i=Oi().data,[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)(r??n[0]??`claude`),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(!1),_=$n(),v=p.trim();return(0,Q.jsx)(es,{open:e,onOpenChange:t,children:(0,Q.jsxs)(Qo,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,Q.jsxs)(Zo,{children:[(0,Q.jsx)($o,{children:`Add agent account`}),(0,Q.jsx)(Yo,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,Q.jsx)(`select`,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:l,onChange:e=>u(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`,children:n.map(e=>(0,Q.jsx)(`option`,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,Q.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:d,placeholder:`Work`,onChange:e=>f(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,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,Q.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:p,placeholder:Di(i,l)?.accountFolderExample??eC,onChange:e=>{m(e.target.value),c(null),_.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,Q.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":h,onClick:()=>g(e=>!e),children:h?`Hide folders`:`Browse…`})]}),(0,Q.jsxs)(`p`,{className:`text-[11px] text-soft-foreground`,children:[`A `,(0,Q.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),h?(0,Q.jsx)(Qm,{path:a,selected:s,onSelect:e=>{c(e),m(e.path),_.reset()},onEnter:e=>{o(e),c(null),_.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,_.isError?(0,Q.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:_.error instanceof Error?_.error.message:`could not add that folder`}):null,(0,Q.jsxs)(Jo,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,Q.jsx)(k,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(k,{"data-slot":`add-account-confirm`,disabled:v===``||_.isPending,onClick:()=>{v===``||_.isPending||_.mutate({provider:l,configDir:v,...d.trim()?{label:d.trim()}:{}},{onSuccess:()=>{t(!1),f(``),m(``),c(null),g(!1),G(`Account added — use Connect to sign in`)}})},children:_.isPending?`Adding…`:`Add account`})]})]})})}async function nC(e,t){return ct(await Et.api.v1.providers[`sign-in`].start.$post({json:{provider:e,...t?{profileId:t}:{}}}),`/providers/sign-in/start`)}async function rC(e){return ct(await Et.api.v1.providers[`sign-in`][`:id`].$get({param:{id:e}}),`/providers/sign-in/:id`)}async function iC(e,t){return ct(await Et.api.v1.providers[`sign-in`][`:id`].redirect.$post({param:{id:e},json:{redirectUrl:t}}),`/providers/sign-in/:id/redirect`)}async function aC(e){return ct(await Et.api.v1.providers[`sign-in`][`:id`].$delete({param:{id:e}}),`/providers/sign-in/:id`)}function oC(e,t){let n=I(),[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(``),l=(0,Z.useRef)(null),u=(0,Z.useRef)(!0),d=(0,Z.useRef)(0),f=()=>{d.current++,m.current=!1;let e=l.current;l.current=null,e?.state===`waiting`&&aC(e.id).catch(()=>{}),o(null),c(``),i(!1)};(0,Z.useEffect)(()=>(u.current=!0,()=>{u.current=!1,d.current++;let e=l.current;e?.state===`waiting`&&aC(e.id).catch(()=>{})}),[]);let p=H({mutationFn:n=>nC(e,t).then(e=>({result:e,generation:n})),retry:!1,onSuccess:({result:e,generation:t})=>{if(!u.current||!m.current||t!==d.current){aC(e.id).catch(()=>{});return}l.current=e,o(e)}}),m=(0,Z.useRef)(r);m.current=r;let h=wr({queryKey:[`browser-sign-in`,a?.id],queryFn:()=>rC(a.id),enabled:r&&a?.state===`waiting`,retry:!1,refetchInterval:e=>e.state.error||e.state.data?.state&&e.state.data.state!==`waiting`?!1:1e3,gcTime:0}),g=h.data??a,_=H({mutationFn:()=>iC(a.id,s),retry:!1,onSuccess:()=>{c(``),h.refetch()}});return(0,Z.useEffect)(()=>{g?.state===`connected`&&(l.current=g,o(g),Promise.all([n.invalidateQueries({queryKey:V.agentProfiles}),n.invalidateQueries({queryKey:V.providerStatus}),n.invalidateQueries({queryKey:V.models(e)})]))},[g,n,e]),{open:r,result:g,redirect:s,setRedirect:c,start:p,replay:_,status:h,error:p.error??_.error??h.error,close:f,connect:()=>{i(!0),m.current=!0,p.reset(),_.reset(),p.mutate(++d.current)}}}function sC({provider:e,profileId:t,label:n}){let{open:r,result:i,redirect:a,setRedirect:o,start:s,replay:c,status:l,error:u,close:d,connect:f}=oC(e,t);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:s.isPending,onClick:f,children:`Connect`}),(0,Q.jsx)(es,{open:r,onOpenChange:e=>{e||d()},children:(0,Q.jsxs)(Qo,{children:[(0,Q.jsxs)(Zo,{children:[(0,Q.jsxs)($o,{children:[`Sign in to `,n]}),(0,Q.jsx)(Yo,{children:`Use a personal Google account. Business and agent-platform sign-in are not supported.`})]}),s.isPending?(0,Q.jsx)(`p`,{role:`status`,children:`Preparing sign-in…`}):null,i?.state===`waiting`?(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[(0,Q.jsx)(`a`,{href:i.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-action underline`,children:`Open Google sign-in`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`After consent, sign-in completes here. If your browser cannot reach the host’s 127.0.0.1 address, paste the full failed redirect URL below.`}),(0,Q.jsxs)(`label`,{className:`grid gap-2`,children:[`Redirect URL`,(0,Q.jsx)(rh,{type:`url`,autoComplete:`off`,spellCheck:!1,value:a,onChange:e=>o(e.target.value)})]}),(0,Q.jsx)(k,{disabled:!a.trim()||c.isPending,onClick:()=>c.mutate(),children:`Complete sign-in`})]}):null,i?.state===`connected`?(0,Q.jsx)(`p`,{role:`status`,children:`Connected.`}):null,i?.state===`failed`?(0,Q.jsx)(`p`,{role:`alert`,children:i.error}):null,i?.state===`cancelled`?(0,Q.jsx)(`p`,{role:`status`,children:`Sign-in cancelled. Close this window and Connect again.`}):null,u?(0,Q.jsx)(`p`,{role:`alert`,children:u.message}):null,l.isError&&i?.state===`waiting`?(0,Q.jsx)(k,{onClick:()=>void l.refetch(),children:`Retry status`}):null,(0,Q.jsx)(Jo,{children:(0,Q.jsx)(k,{variant:`outline`,onClick:d,children:i?.state===`connected`?`Done`:`Cancel`})})]})})]})}function cC(e){let t=(0,Z.useRef)(null),n=e.rows.find(t=>t.runner.id===e.runner&&t.account===e.accountFor(t.runner.id));return(0,Q.jsxs)(`details`,{ref:t,className:`settings-agent-picker`,children:[(0,Q.jsxs)(`summary`,{children:[(0,Q.jsx)(sa,{"aria-hidden":`true`,className:`size-4 text-accent-text`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1`,children:(n?.label??e.runner).replace(/^codex/,`Codex`).replace(/^claude/,`Claude Code`)}),(0,Q.jsx)(ua,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`})]}),(0,Q.jsx)($S,{...e,onPick:(...n)=>{e.onPick(...n),t.current&&(t.current.open=!1)}})]})}var lC={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 uC(){let e=cr(),t=Oi();return e.isPending||t.isPending?(0,Q.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent accounts…`}):e.isError?(0,Q.jsx)(X,{icon:(0,Q.jsx)(ku,{}),tone:`danger`,title:`Agent accounts did not load`,subtitle:e.error.message,heading:`h2`}):t.isError?(0,Q.jsx)(X,{icon:(0,Q.jsx)(ku,{}),tone:`danger`,title:`Agent accounts did not load`,subtitle:t.error.message,heading:`h2`}):(0,Q.jsx)(dC,{data:e.data,runners:t.data})}function dC({data:e,runners:t}){let n=En(),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(null),s=sr(),c=t.runners.map(e=>e.id);return e.editable?(0,Q.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,Q.jsx)(`div`,{children:(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Manage runner installations, logins and defaults for new projects.`})}),(0,Q.jsxs)(GS,{defaultValue:`claude`,children:[(0,Q.jsx)(qS,{variant:`line`,"data-slot":`accounts-tabs`,children:c.map(e=>(0,Q.jsx)(JS,{value:e,"data-provider":e,children:ki(t,e)},e))}),c.map(r=>(0,Q.jsx)(YS,{value:r,className:`pt-4`,children:(0,Q.jsx)(fC,{provider:r,runners:t,check:n.data?.checks?.find(e=>e.name===r),accounts:e.profiles.filter(e=>e.provider===r),canCarryAccounts:e.profileCapableProviders.includes(r),onAdd:()=>i(r),onRemove:o})},r))]}),(0,Q.jsx)(pC,{runners:t}),r===null?null:(0,Q.jsx)(tC,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,Q.jsx)(eS,{open:a!==null,onOpenChange:e=>!e&&o(null),children:(0,Q.jsxs)(rS,{"data-slot":`accounts-remove-confirm`,children:[(0,Q.jsxs)(iS,{children:[(0,Q.jsxs)(oS,{children:[`Remove “`,a?.label,`”?`]}),(0,Q.jsxs)(sS,{children:[`This only forgets the account. Nothing in `,a?.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,Q.jsxs)(aS,{children:[(0,Q.jsx)(lS,{children:`Cancel`}),(0,Q.jsx)(cS,{"data-action":`accounts-remove-confirm`,disabled:s.isPending,onClick:()=>{let e=a;e&&s.mutate(e.id,{onSuccess:()=>{o(null),G(`Removed ${e.label}`)},onError:e=>G(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]}):(0,Q.jsx)(`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,Q.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 fC({provider:e,runners:t,check:n,accounts:r,canCarryAccounts:i,onAdd:a,onRemove:o}){let s=n?.available===!0,c=r.filter(e=>e.isDefault).length;return(0,Q.jsxs)(`div`,{"data-slot":`accounts-provider`,"data-provider":e,className:`flex flex-col gap-4`,children:[(0,Q.jsx)(`h3`,{className:`settings-account-provider-title`,children:ki(t,e)}),(0,Q.jsxs)(`div`,{className:`settings-account-installation settings-readout`,children:[n===void 0?(0,Q.jsx)(`span`,{children:`Checking…`}):s?(0,Q.jsx)(`span`,{"data-slot":`agent-installed`,children:`Installed`}):(0,Q.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`Not installed — `,(0,Q.jsx)(`code`,{children:Di(t,e)?.installHint})]}),s&&n?.version?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,Q.jsx)(`span`,{"data-slot":`agent-version`,children:n.version})]}):null,(0,Q.jsxs)(`span`,{className:`settings-account-count`,children:[r.length,` `,r.length===1?`account`:`accounts`,` (`,c,` discovered, `,r.length-c,` added)`]})]}),(0,Q.jsx)(`ul`,{className:`bg-card`,children:r.map(e=>(0,Q.jsx)(gC,{account:e,runners:t,onRemove:()=>o(e)},e.id))}),i?(0,Q.jsx)(`div`,{className:`settings-account-add-row`,children:(0,Q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":e,onClick:a,children:`Add account`})}):null,i?null:(0,Q.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`text-[11px] text-soft-foreground`,children:[ki(t,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 pC({runners:e}){let[t,n]=(0,Z.useState)(null),r=I(),i=rr(),a=Wn(),o=_n(wi(e)),s=H({mutationFn:e=>Xe(e),onSuccess:e=>r.setQueryData(V.config,e),onError:e=>G(e.message,{tone:`danger`})});if(i.data===void 0)return null;let c=XS([],e),l=i.data.agentDefaults.runner??`claude`,u=i.data.agentDefaults.models??{};return(0,Q.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,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,Q.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,Q.jsx)(cC,{rows:c,runner:l,accountFor:()=>null,providerStatus:a,disabled:s.isPending,onPick:e=>{e!==l&&s.mutate({agentDefaults:{runner:e}})}}),(0,Q.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,Q.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,Q.jsx)(`span`,{children:`Default model for`}),(0,Q.jsx)(`select`,{"aria-label":`Model agent`,value:t??l,onChange:e=>n(e.target.value),children:e.runners.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.displayName},e.id))})]}),e.runners.filter(e=>e.id===(t??l)).map(t=>(0,Q.jsxs)(`label`,{className:`settings-account-model flex items-center gap-3`,children:[(0,Q.jsx)(Ea,{className:`size-4 text-accent-icon shrink-0`}),(0,Q.jsx)(`span`,{className:`w-24 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,Q.jsxs)(`select`,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:u[t.id]??``,disabled:s.isPending,onChange:e=>s.mutate({agentDefaults:{models:{[t.id]:e.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:[tc(t.id,e,o[t.id]?.data,[u[t.id]]).map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.id===``?`Native default`:e.label},e.id)),(0,Q.jsx)(mC,{runner:t.id,runners:e,catalog:o[t.id]})]})]},t.id))]})]})}function mC({runner:e,runners:t,catalog:n}){let r=Vs(e,t,n);return r?(0,Q.jsx)(`option`,{disabled:!0,children:r}):null}function hC({account:e,runners:t,status:n}){let r=ar();return(0,Q.jsxs)(Q.Fragment,{children:[n&&n.status!==`connected`&&Di(t,e.provider)?.browserLogin?(0,Q.jsx)(sC,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,n&&n.status!==`connected`&&Di(t,e.provider)?.terminalLogin!==!1?(0,Q.jsx)(k,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:r.isPending,onClick:()=>r.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=>G(e instanceof et&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function gC({account:e,runners:t,onRemove:n}){let r=je(e),i=Gn(),a=pr(r,e.status===void 0),o=e.status??a.data?.status,s=o?lC[o.status]:void 0;return(0,Q.jsx)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`flex flex-col gap-2 px-3.5 py-3`,children:(0,Q.jsxs)(`div`,{className:`settings-account-card`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium text-foreground`,children:e.label}),e.isDefault?(0,Q.jsx)(Jm,{variant:`ghost`,className:`shrink-0 text-[12px] text-muted-foreground`,children:`discovered`}):null]}),(0,Q.jsxs)(`div`,{className:`settings-account-readout settings-readout`,children:[(0,Q.jsx)(`p`,{"data-slot":`account-path`,className:`mt-0.5 truncate font-mono text-[11px] text-soft-foreground`,title:e.path,children:e.configDir}),(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)($,{tone:s?.tone??`neutral`,pulse:s===void 0}),(0,Q.jsx)(`span`,{"data-slot":`account-status`,children:s?.label??`Checking…`}),!o||o.requiresAccountHome===!1?null:e.exists?e.looksValid?null:(0,Q.jsxs)(`span`,{"data-slot":`account-unrecognised`,children:[`— this folder does not look like `,ki(t,e.provider),` config yet`]}):(0,Q.jsx)(`span`,{"data-slot":`account-missing`,children:`— folder not created yet; Connect will make it`})]}),o?.hint?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o.hint}):null]})]}),(0,Q.jsxs)(`div`,{className:`settings-account-actions`,children:[(0,Q.jsx)(hC,{account:e,runners:t,status:o}),(0,Q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:i.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>i.mutate(r,{onError:e=>G(e.message,{tone:`danger`})}),children:`Check again`}),(0,Q.jsx)(_C,{account:e,onRemove:n})]})]})})}function _C({account:e,onRemove:t}){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(e.label),o=pn();return(0,Q.jsx)(Q.Fragment,{children:e.isDefault?null:(0,Q.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(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,Q.jsx)(k,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>G(e.message,{tone:`danger`})}),children:`Save`}),(0,Q.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,Q.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}var vC={core:null,langs:new Map},yC={name:`cezar-syn`,type:`dark`,fg:`var(--syn-var)`,bg:`transparent`,settings:[{scope:[`keyword`,`storage`,`constant.language`,`variable.language`,`entity.other.attribute-name`,`support.type.property-name`],settings:{foreground:`var(--syn-key)`}},{scope:[`string`,`punctuation.definition.string`],settings:{foreground:`var(--syn-str)`}},{scope:[`entity.name.function`,`support.function`,`entity.name.tag`,`entity.name.type`,`entity.name.class`,`support.class`,`support.type`],settings:{foreground:`var(--syn-fn)`}},{scope:[`comment`,`punctuation.definition.comment`],settings:{foreground:`var(--syn-com)`}},{scope:[`constant.numeric`,`constant.character`,`constant.other`,`support.constant`,`keyword.other.unit`],settings:{foreground:`var(--syn-num)`}},{scope:[`punctuation`,`keyword.operator`,`meta.brace`,`punctuation.separator`,`punctuation.terminator`],settings:{foreground:`var(--syn-punc)`}},{scope:[`variable`,`entity.name.variable`],settings:{foreground:`var(--syn-var)`}}]},bC={typescript:()=>W(()=>import(`./typescript-bsJCZSQ-.js`),[]),tsx:()=>W(()=>import(`./tsx-udAQXfEw.js`),[]),javascript:()=>W(()=>import(`./javascript-BgS3c2Ky.js`),[]),jsx:()=>W(()=>import(`./jsx-Bz0zcwM4.js`),[]),json:()=>W(()=>import(`./json-qhed-kSA.js`),[]),jsonc:()=>W(()=>import(`./jsonc-CYpm1nAK.js`),[]),shellscript:()=>W(()=>import(`./shellscript-CLZ0U2zV.js`),[]),python:()=>W(()=>import(`./python-gzcpVVnB.js`),[]),markdown:()=>W(()=>import(`./markdown-BYOwaDjH.js`),[]),css:()=>W(()=>import(`./css-BsVw1vtW.js`),[]),html:()=>W(()=>import(`./html-BY76lXLH.js`),__vite__mapDeps([0,1,2])),diff:()=>W(()=>import(`./diff-woXpYk--.js`),[]),yaml:()=>W(()=>import(`./yaml-rwi0_p6S.js`),[]),toml:()=>W(()=>import(`./toml-CcmNWLt0.js`),[]),go:()=>W(()=>import(`./go-rLFTqkRN.js`),[]),rust:()=>W(()=>import(`./rust-Cfkwpbl8.js`),[]),sql:()=>W(()=>import(`./sql-BsFa4tDR.js`),[])},xC={ts:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,bash:`shellscript`,sh:`shellscript`,shell:`shellscript`,zsh:`shellscript`,console:`shellscript`,py:`python`,md:`markdown`,yml:`yaml`,golang:`go`,rs:`rust`,vue:`html`,xml:`html`},SC=new Set([``,`plaintext`,`text`,`txt`,`plain`]);function CC(e){let t=e.trim().toLowerCase();return Object.hasOwn(bC,t)?t:Dh(xC,t)??null}function wC(e){return SC.has(e.trim().toLowerCase())}function TC(){return[...Object.keys(bC),...Object.keys(xC),...SC].filter(e=>e!==``)}function EC(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);if(n<=0)return null;let r=t.slice(n+1).toLowerCase();return CC(Dh({mts:`typescript`,cts:`typescript`,htm:`html`},r)??r)}var DC=null,OC=new Set;function kC(){return vC.core??=Promise.all([W(()=>import(`./core-DzoyrHjB.js`),__vite__mapDeps([3,4,5])),W(()=>import(`./engine-javascript-FQvzRocB.js`),[])]).then(async([{createHighlighterCore:e},{createJavaScriptRegexEngine:t}])=>(DC=await e({themes:[yC],langs:[],engine:t({forgiving:!0})}),DC)),vC.core}function AC(e){let t=CC(e);if(t===null||OC.has(t))return Promise.resolve();let n=vC.langs.get(t);return n||(n=kC().then(async e=>{await e.loadLanguage(await bC[t]()),OC.add(t)}).catch(()=>{vC.langs.delete(t)}),vC.langs.set(t,n)),n}function jC(e){return{tokens:e.split(`
|
|
6
6
|
`).map(e=>[{content:e}]),fg:`var(--syn-var)`,bg:`transparent`}}function MC(e,t,n={}){if(wC(t))return jC(e);let r=CC(t);if(r===null)return jC(e);if(!DC||!OC.has(r))return null;try{let t=DC.codeToTokens(e,{lang:r,theme:yC.name,...g({tokenizeTimeLimit:n.tokenizeTimeLimit})});return{tokens:t.tokens.map(e=>e.map(({content:e,color:t})=>({content:e,...g({color:t})}))),fg:t.fg??`var(--syn-var)`,bg:`transparent`}}catch{return jC(e)}}async function NC(e,t,n={}){return MC(e,t,n)||(await AC(t),MC(e,t,n)??jC(e))}var PC=1500;function FC(e,t){let n=(0,Z.useMemo)(()=>e.split(`
|
|
7
7
|
`).map(e=>[{content:e}]),[e]),r=(0,Z.useMemo)(()=>CC(t),[t]),i=n.length>PC,[a,o]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{if(r===null||i)return;let t=!1;return NC(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:MC(e,r)?.tokens??n}var IC=`code-editor-surface m-0 min-h-full w-full whitespace-pre font-mono text-xs leading-[1.7] px-3 py-2 [tab-size:2]`;function LC({value:e,onChange:t,language:n,readOnly:r,className:i,...a}){let o=FC(e,n),s=(0,Z.useRef)(null),c=(0,Z.useRef)(null),l=()=>{let e=c.current,t=s.current;!e||!t||(t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft)};return(0,Z.useLayoutEffect)(l,[e]),(0,Q.jsxs)(`div`,{"data-slot":`code-editor`,className:C(`relative overflow-hidden rounded-md border border-input bg-card`,i),children:[(0,Q.jsx)(`pre`,{ref:s,"aria-hidden":`true`,className:C(IC,`pointer-events-none absolute inset-0 overflow-auto text-soft-foreground`),children:o.map((e,t)=>(0,Q.jsx)(`span`,{className:`block`,children:e.length===0?`
|
|
8
8
|
`:(0,Q.jsxs)(Q.Fragment,{children:[e.map((e,t)=>(0,Q.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),`
|
|
@@ -10,5 +10,5 @@ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,n,r,t as i}from
|
|
|
10
10
|
`).map(e=>e.trim()).filter(e=>e!==``),r=Number(t);return{commands:n,timeoutSeconds:r,invalid:n.length>20?`Enter at most 20 commands.`:n.some(e=>e.length>4e3)?`Keep each command under ${lt.toLocaleString(`en-US`)} characters.`:t.trim()===``||!Number.isInteger(r)||r<1||r>7200?`Enter a whole number of seconds from 1 to ${$e}.`:null}}function OT(){let e=Ss(),t=bn().data;return e===null?null:t?.projects.find(t=>t.id===e)?.root??null}function kT(e){navigator.clipboard.writeText(e).then(()=>G(`Project folder copied`)).catch(()=>G(e))}function AT(){let e=OT();return e===null?null:(0,Q.jsx)(qw,{title:`Project folder`,hint:`Where this project lives on disk. Every task worktree, git command and agent run resolves against it.`,children:(0,Q.jsxs)(`div`,{"data-slot":`project-location`,"data-variant":`field`,className:`flex flex-col gap-3`,children:[(0,Q.jsx)(`span`,{"data-slot":`project-location-path`,className:`w-full min-w-0 rounded-md border border-border bg-background p-3 text-[13px] break-all text-foreground`,children:e}),(0,Q.jsxs)(`div`,{className:`flex w-full flex-wrap items-center gap-2 border-t border-border pt-4`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-action":`project-location-copy`,title:`Copy the project folder path`,onClick:()=>kT(e),className:`inline-flex min-h-11 items-center gap-2 rounded-md border border-border bg-card px-3 text-xs text-foreground transition-colors hover:bg-muted`,children:[(0,Q.jsx)(wa,{"aria-hidden":`true`,className:`size-4`}),`Copy path`]}),(0,Q.jsx)(jT,{root:e})]})]})})}function jT({root:e}){let t=wn(),n=H({mutationFn:e=>ye(e),onError:e=>G(e.message,{tone:`danger`})}),r=(t.data?.targets??[]).filter(e=>Ah(e.id)===void 0).map(e=>({target:e}));return r.length===0?null:(0,Q.jsx)(jh,{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}`)})})}var MT={setup:{key:`worktreeSetup`,issueKey:`worktreeSetupIssue`,slot:`worktree-setup`,title:`Prepare new worktrees`,hint:`Runs in every new task and worker worktree before the agent starts, in order, stopping at the first failure. Leave commands empty to skip setup.`,empty:`No setup commands configured. No commands will run in new worktrees.`,label:`Worktree setup commands, one per line`,example:`npm ci`,fileEditApplies:`Valid file edits apply to new worktrees.`,saved:`Worktree setup saved`,cleared:`Worktree setup cleared`,save:`Save setup`},teardown:{key:`worktreeTeardown`,issueKey:`worktreeTeardownIssue`,slot:`worktree-teardown`,title:`Stop worker services before destroy`,hint:`Runs in a worker’s worktree when the worker is destroyed, before destroy stops the worker’s processes, in order, stopping at the first failure. A failure is recorded on the worker and destroy goes on. Leave commands empty to skip teardown.`,empty:`No teardown commands configured. Destroy runs no commands in worker worktrees.`,label:`Worktree teardown commands, one per line`,example:`docker compose down`,fileEditApplies:`Valid file edits apply to the next worker destroy.`,saved:`Worktree teardown saved`,cleared:`Worktree teardown cleared`,save:`Save teardown`}};function NT({config:e,copy:t}){let n=I(),r=En(),i=HC(),a=OT(),o=a===null?null:`${a.replace(/\/$/,``)}/.ai/cezar/config.json`,s=r.data?.capabilities?.settingsAdmin===!0,c=e[t.key],l=e[t.issueKey],u=c?.commands??[],d=c?.timeoutSeconds??900,[f,p]=(0,Z.useState)(u.join(`
|
|
11
11
|
`)),[m,h]=(0,Z.useState)(String(d)),{commands:g,timeoutSeconds:_,invalid:v}=DT(f,m),y=l===null&&g.length===u.length&&g.every((e,t)=>e===u[t])&&(g.length===0||_===d),b=H({mutationFn:e=>jt(e),onSuccess:e=>{n.setQueryData(U.config,e),p(g.join(`
|
|
12
12
|
`)),G(g.length===0?t.cleared:t.saved)},onError:e=>{G(e.message,{tone:`danger`}),e instanceof et&&e.status===409&&i()}}),x=()=>b.mutate({[t.key]:g.length===0?null:{commands:g,..._===900?{}:{timeoutSeconds:_}}}),S=`block 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 read-only:bg-muted read-only:text-muted-foreground`;return(0,Q.jsxs)(qw,{title:t.title,hint:t.hint,children:[(0,Q.jsx)(WC,{risk:`These commands run on the machine running Squawk`}),(0,Q.jsxs)(ET,{copy:t,savedCommandCount:u.length,settingsAdmin:r.data?.capabilities?.settingsAdmin,configPath:o,issue:l,invalid:v,children:[(0,Q.jsx)(`textarea`,{"data-slot":`${t.slot}-commands`,"aria-label":t.label,rows:4,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,value:f,readOnly:!s,disabled:b.isPending,onChange:e=>p(e.target.value),className:`${S} min-h-24 w-full resize-y font-mono text-[13px] leading-relaxed`}),(0,Q.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`Example only: `,(0,Q.jsx)(`code`,{children:t.example}),`. Commands run only after they are saved.`]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-soft-foreground`,children:[(0,Q.jsx)(`span`,{children:`Timeout per command`}),(0,Q.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:1,max:$e,step:1,"data-slot":`${t.slot}-timeout`,value:m,readOnly:!s,disabled:b.isPending,onChange:e=>h(e.target.value),className:`${S} min-h-11 w-28 md:min-h-0`}),(0,Q.jsx)(`span`,{children:`seconds`})]}),(0,Q.jsx)(k,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 self-start md:min-h-0`,"data-action":`${t.slot}-save`,disabled:!s||y||v!==null||b.isPending,onClick:x,children:t.save})]})]})]})}var PT=0,FT=1e3;function IT(){let e=ur();return e.isPending?(0,Q.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading worktree settings…`}):e.isError?(0,Q.jsx)(X,{icon:(0,Q.jsx)(bu,{}),tone:`danger`,title:`Worktree settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Q.jsx)(LT,{config:e.data})}function LT({config:e}){let t=I(),n=H({mutationFn:e=>jt(e),onSuccess:e=>t.setQueryData(U.config,e),onError:e=>G(e.message,{tone:`danger`})}),[r,i]=(0,Z.useState)(String(e.worktreeRetention)),a=Number(r),o=r.trim()===``||!Number.isInteger(a)||a<PT||a>FT,s=e.worktreeRetention===(o?-1:a);return(0,Q.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,Q.jsxs)(qw,{title:`Keep N finished 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,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:PT,max:FT,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,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`worktrees`}),(0,Q.jsx)(k,{type:`button`,variant:`primary`,size:`sm`,className:`self-start`,"data-action":`resources-save-retention`,disabled:s||o||n.isPending,onClick:()=>n.mutate({worktreeRetention:a},{onSuccess:()=>{t.invalidateQueries({queryKey:U.worktrees}),G(a===0?`Keeping all worktrees (unlimited)`:`Keeping the last ${a} finished worktree${a===1?``:`s`}`)}}),children:`Save retention`})]}),o?(0,Q.jsxs)(`p`,{"data-slot":`resources-retention-invalid`,className:`text-[11px] text-danger`,children:[`Enter a whole number from `,PT,` to `,FT,` (0 = unlimited).`]}):(0,Q.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,Q.jsx)(NT,{config:e,copy:MT.setup}),(0,Q.jsx)(NT,{config:e,copy:MT.teardown}),(0,Q.jsxs)(Y,{to:`/git/cleanup`,"data-slot":`worktrees-manage-link`,className:`inline-flex min-h-11 items-center gap-1 self-start text-[13px] font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring md:min-h-0`,children:[`Manage worktrees on Git`,(0,Q.jsx)(Sa,{"aria-hidden":`true`,className:`size-[14px]`})]})]})}var RT=[{id:`sidebar`,title:`Sidebar`,description:`Overall and per-section task limits for this project.`,icon:la,component:ST,scope:`project`},{id:`agents`,title:`Agents`,description:`Default runner, models and system prompt.`,icon:ya,component:uw,scope:`project`},{id:`agent-config`,title:`Agent config`,description:`Edit the coding agents’ own config files, per scope.`,icon:vu,component:KC,scope:`project`},{id:`worktrees`,title:`Worktrees`,description:`How many finished task worktrees this project keeps on disk.`,icon:bu,component:IT,scope:`project`},{id:`prompt-templates`,title:`Prompt templates`,description:`Reusable snippets for follow-up instructions.`,icon:yu,component:aT,scope:`project`},{id:`appearance`,title:`Appearance`,description:`Theme, accent and density.`,icon:Li,component:Rw,scope:`global`},{id:`notifications`,title:`Notifications`,description:`Browser notifications when an agent needs you.`,icon:pa,component:Ww,scope:`global`},{id:`resources`,title:`Resources`,description:`Parallel tasks and per-task memory limit, across every project.`,icon:la,component:pT,scope:`global`},{id:`tasks`,title:`Tasks`,description:`Automatic task archiving after pull requests merge.`,icon:bu,component:US,scope:`global`},{id:`accounts`,title:`Agent accounts`,description:`Second logins, and the agent and models a project uses when it has chosen none.`,icon:Wi,component:uC,scope:`global`},{id:`projects`,title:`Projects`,description:`The workspace registry and where GitHub checkouts land.`,icon:Hi,component:Zw,scope:`global`}];function zT(e){return RT.filter(t=>t.scope===e)}function BT({projectId:e,projectName:t}){return(0,Q.jsx)(`div`,{"data-slot":`settings-sidebar`,className:Va,children:[`project`,`global`].map(n=>{let r=n===`project`?`This project${t?` · ${t}`:``}`:`Global · every project`,i=n===`project`?`/p/${encodeURIComponent(e)}/settings`:`/settings/global`,a=zT(n).map(e=>({id:e.id,title:e.title,icon:e.icon,to:`${i}/${e.id}`})),o=n===`project`?[{id:`general`,title:`General`,icon:Ui,to:i},...a]:a;return(0,Q.jsxs)(`nav`,{"aria-label":r,"data-slot":`settings-nav`,"data-scope":n,className:C(`flex flex-col gap-px`,n===`global`&&`pt-[6px]`),children:[(0,Q.jsx)(`h3`,{title:r,className:Ra,children:r}),o.map(({id:e,title:t,icon:n,to:r})=>(0,Q.jsxs)(w,{to:r,end:!0,"data-section":e,className:({isActive:e})=>C(Pa,Na,e&&`bg-sidebar-row-selected text-foreground font-medium hover:bg-sidebar-row-selected`),children:[(0,Q.jsx)(n,{"aria-hidden":`true`,className:Ia}),(0,Q.jsx)(`span`,{className:`truncate`,children:t})]},e))]},n)})})}var VT=[{pattern:`/`,pageLabel:`Tasks`},{pattern:`/tasks`,pageLabel:`All tasks`},{pattern:`/tools`,pageLabel:`Workspace tools`},{pattern:`/new`,pageLabel:`New task`},{pattern:`/activity`,pageLabel:`Activity`},{pattern:`/git/*`,pageLabel:`Git`},{pattern:`/github/*`,pageLabel:`GitHub`},{pattern:`/automations/*`,pageLabel:`Automations`},{pattern:`/skills`,pageLabel:`Skills`},{pattern:`/reports`,pageLabel:`Reports`},{pattern:`/workflows/*`,pageLabel:`Workflows`},{pattern:`/settings/*`,pageLabel:`Settings`}];function HT(e){let t=bs(e),n=m({path:`/tasks/:id/*`,end:!0},t);return n?{pageLabel:null,taskId:n.params.id??null}:{pageLabel:VT.find(({pattern:e})=>m({path:e,end:!0},t))?.pageLabel??null,taskId:null}}function UT(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 WT(e,t,n){let r=t?.bootProject??n?.bootProject??null,i=e??r??`default`;return{bootProjectId:r,sidebarProjectId:i,sidebarBoot:i===r,isBootProject:e!==null&&e===r,activeProject:t?.projects.find(t=>t.id===e)}}function GT(e,t,n,r,i,a){let o=e===`/tools`||e===`/settings/global`||e.startsWith(`/settings/global/`),s=o?null:t?.name??(n?UT(r)?.name??null:null),c=i.taskId?a?.find(e=>e.id===i.taskId):void 0;return{globalSettings:o,projectName:s,titleRun:c,pageLabel:c?xi(c):i.pageLabel}}function KT(e,t){return e?e.forge===`github`:t?.forge?.available===!0}function qT(e,t,n,r,i,a){return/^\/settings(?:\/|$)/.test(e)?(0,Q.jsx)(BT,{projectId:n,projectName:i?.projects.find(e=>e.id===n)?.name??(r?UT(a)?.name??null:null)}):/^\/github(?:\/|$)/.test(e)&&t?(0,Q.jsx)(VS,{scope:fr({projectId:n,boot:r}).cacheScope}):/^\/git(?:\/|$)/.test(e)?(0,Q.jsx)(FS,{scope:fr({projectId:n,boot:r}).cacheScope}):void 0}function JT(e,t,n,r,i){return e===`/tools`?UT(i):t?null:n?{name:n.name,branch:n.id===r?i?.repo?.branch??``:``}:UT(i)}function YT(e,t,n,r){return{project:e===`/tools`?`Workspace`:t,page:n?`Tasks / ${r}`:r??`Squawk`,branch:n?.worktreePath?`Isolated worktree`:void 0}}function XT(e,t,n,r){return e?(0,Q.jsx)(Gy,{...e,projectTarget:t.target,onSwitchProject:e=>void t.go(e),version:r}):n?(0,Q.jsx)(By,{}):null}function ZT({children:e}){let{pathname:t}=a(),n=Ss(),r=En(),i=Oi(),o=(0,Z.useRef)(void 0);(0,Z.useEffect)(()=>{r.data&&(o.current=r.data)},[r.data]);let s=r.data??o.current,c=Ov(s),l=bn(),u=l.data,d=Ky(),f=Dv(),p=HT(t),{bootProjectId:m,sidebarProjectId:h,sidebarBoot:g,isBootProject:_,activeProject:v}=WT(n,u,r.data),y=gn(h,!0,g),b=gn(n??``,v!==void 0&&p.taskId!==null,u?.bootProject===n).data,{globalSettings:x,projectName:S,titleRun:C,pageLabel:w}=GT(t,v,_,r.data,p,b);$x({projectName:S,pageLabel:w});let T=KT(v,r.data),E=qT(bs(t),T,h,g,u,r.data),D=s?.version??null;return(0,Q.jsxs)(sy,{children:[(0,Q.jsx)(T_,{repo:JT(t,x,v,m,r.data),breadcrumb:YT(t,S,C,w),version:D,latestVersion:s?.latestVersion??null,forgeAvailable:T,automationsAvailable:c,banner:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(vy,{}),(0,Q.jsx)(my,{})]}),sidebarList:E,taskQuickList:(0,Q.jsx)(Lx,{projectId:h,boot:g}),sidebarProjectId:h,projectHeader:(0,Q.jsx)(qh,{}),mobileProjects:d,needsYou:Vr(y.data??[]).waiting>0,toolsMenu:(0,Q.jsx)(Jx,{health:r.data,runners:i.data}),toolsStatus:r.data?{blocked:Gx(r.data,i.data)!==null,note:qx(r.data)}:null,projectRail:XT(d,f,l.isPending,D),children:e}),(0,Q.jsx)(Zv,{})]})}function QT(){let e=a(),t=bn();return Ev(),(0,Z.useEffect)(()=>{let n=Q_(e,t.data);n!==null&&(ev(U_(),n)||W_(n),ev(rv(n.projectId),n)||iv(n))},[e.hash,e.pathname,e.search,t.data]),null}function $T(){let e=I(),t=zw(Dn().data?.notifications).enabled,n=(0,Z.useRef)(t);return n.current=t,(0,Z.useEffect)(()=>{let t=e.getQueryCache(),r=new Map,i=new Map,a=new Map,o=new Set,s=new Map,c=0,l=e=>e.length===3&&typeof e[0]==`string`&&e[1]===`runs`&&e[2]===`list`,u=()=>{let e=new Set([...r.values()].flatMap(e=>[...e.keys()]));for(let t of i.keys())e.has(t)||(i.delete(t),a.delete(t),o.delete(t))},d=(e,t,s=!1,l=1/0)=>{let d=r.get(e),{statuses:f}=Vw(new Map,t),p=t.filter(e=>{if((a.get(e.id)??0)>l)return!1;let t=d?.get(e.id),n=f.get(e.id),r=l===1/0?t:i.get(e.id);return t!==void 0&&r!==void 0&&(r.status!==n.status||r.wantsAttention!==n.wantsAttention)}),{entering:m,statuses:h}=Vw(i,p);for(let[e,t]of f)!d?.has(e)&&!o.has(e)&&(a.get(e)??0)<=l&&(i.set(e,t),a.set(e,++c));for(let[e,t]of h){let n=i.get(e);n?.status===t.status&&n.wantsAttention===t.wantsAttention||(i.set(e,t),a.set(e,++c),o.add(e))}if(r.set(e,f),u(),!s&&m.length!==0&&Hw({enabled:n.current,hidden:document.visibilityState===`hidden`,permission:Bw()}))for(let e of m)eE(e)};for(let e of t.getAll().sort((e,t)=>e.state.dataUpdatedAt-t.state.dataUpdatedAt))l(e.queryKey)&&Array.isArray(e.state.data)&&d(e.queryHash,e.state.data,!0);return t.subscribe(e=>{if(l(e.query.queryKey)){if(e.type===`removed`)r.delete(e.query.queryHash),s.delete(e.query.queryHash),u();else if(e.type===`updated`&&(e.action.type===`fetch`&&s.set(e.query.queryHash,c),e.action.type===`success`&&Array.isArray(e.query.state.data))){let t=e.action.manual?1/0:s.get(e.query.queryHash)??0;d(e.query.queryHash,e.query.state.data,!1,t),e.action.manual||s.delete(e.query.queryHash)}}})},[e]),null}function eE(e){let t=globalThis.Notification;if(typeof t!=`function`)return;let n=Uw(e);try{new t(n.title,{body:n.body,tag:n.tag})}catch{}}function tE(){return(0,Q.jsxs)(`div`,{"data-route":`activity`,"aria-busy":`true`,className:`min-h-full w-full px-[18px] py-6 md:px-7`,children:[(0,Q.jsx)(`h1`,{className:`text-[18px] font-semibold`,children:`Activity`}),(0,Q.jsx)(`p`,{"data-slot":`activity-loading`,role:`status`,className:`mt-4 text-xs text-muted-foreground`,children:`Loading activity…`})]})}function nE(){return(0,Q.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(X,{icon:(0,Q.jsx)(Wa,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading GitHub…`,subtitle:`Fetching open issues and pull requests.`})})}var rE=`(hover: none) and (pointer: coarse)`;function iE(){return typeof globalThis.matchMedia==`function`&&globalThis.matchMedia(rE).matches}function aE(e){return e.key!==`Enter`||e.shiftKey||e.altKey||e.repeat||e.isComposing?!1:e.metaKey||e.ctrlKey?!0:!iE()}function oE(e=typeof navigator>`u`?``:navigator.platform){return/mac|iphone|ipad|ipod/i.test(e)?`⌘↵`:`Ctrl+↵`}var sE={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,bmp:`image/bmp`,avif:`image/avif`,md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,log:`text/plain`,pdf:`application/pdf`};function cE(e){return Ft(e.type)?e.type:Dh(sE,e.name.split(`.`).pop()?.toLowerCase()??``)??null}async function lE(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));let r=btoa(n),i=cE(e)??`application/octet-stream`,a=ht(i);return{mediaType:i,data:r,...a?{preview:`data:${i};base64,${r}`}:{},name:e.name||(a?`pasted image`:`pasted.${Tt(i)}`),isImage:a}}function uE(e,t){let n=[],r=[],i=t;for(let t of e){let e=t.name||`attachment`;if(cE(t)===null){r.push(`${e} is not a supported attachment (images, PDF and plain-text files such as TXT or MD)`);continue}if(t.size>5242880){r.push(`${e} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${e} skipped — max 4 attachments per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}var dE=new Set([`/`,`@`]);function fE(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(dE.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function pE(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function mE(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function hE(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}function gE(e,t){switch(e){case`aborted`:return null;case`network`:case`service-not-allowed`:return{message:`Dictation couldn't reach this browser's speech service. Some Chromium builds, such as Helium, block it. Use your system dictation instead (macOS: press Fn/Globe twice), or open the cockpit in Chrome or Safari.`,retryable:e===`network`};case`not-allowed`:return{message:`Microphone access is blocked. Allow it in this site's browser settings, then try again.`,retryable:!0};case`audio-capture`:return{message:`No microphone was found. Connect one, then try again.`,retryable:!0};case`language-not-supported`:return{message:`This browser can't recognize speech in ${t}. Use your system dictation instead (macOS: press Fn/Globe twice).`,retryable:!1};case`no-speech`:return{message:`No speech was heard. Check the microphone, then try again.`,retryable:!0};default:return{message:`Dictation failed${e?` — ${e}`:``}`,retryable:!0}}}function _E(e){let[t,n]=Z.useState(null),r=Z.useRef(null),i=Z.useRef(``),a=Z.useRef(!1),o=Z.useRef(()=>{}),[s]=Z.useState(()=>mE()!==void 0),c=Z.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);Z.useEffect(()=>(a.current=!0,()=>{a.current=!1,c()}),[c]);let l=Z.useCallback(()=>o.current(),[]),u=Z.useCallback(()=>{if(!a.current||r.current)return;let t=mE();if(!t)return;let o;try{o=new t,o.lang=navigator.language||`en-US`,o.continuous=!0,o.interimResults=!0;let a=Date.now();o.onresult=e=>{let t=hE(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:a})},o.onerror=t=>{console.warn(`[dictation] recognition error`,t.error,t.message);let n=gE(t.error,o.lang);c(),n&&e(n.message,n.retryable?l:void 0)},o.start(),r.current=o,n({transcript:``,startedAt:a})}catch{e(`Dictation failed — the microphone could not be started`,l),c()}},[e,l,c]);return o.current=u,{supported:s,recording:t,start:u,cancel:Z.useCallback(()=>c(),[c]),finish:Z.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function vE(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}function yE(e,t){return e.trim()!==``||t>0}function bE(e,t,n,r){return!e&&(t!==void 0&&n||r)}function xE(e,t,n){return!e&&!t&&n!==void 0}function SE(e,t,n,r){return e||t||!n&&r!==void 0}function CE(e,t,n){return!e&&t?t:n}function wE(e,t,n){return e||t&&n}function TE(e,t,n){return e||t&&n}function EE(e,t,n,r,i,a){return e||t||n||i.trim()===``&&a===0&&!r}function DE(e,t){return e&&!t}function OE(e){return e??`default`}function kE(e,t){return e.get(t)??!1}function AE(e){return e instanceof Error?e.message:String(e)}function jE(e,t){return e===``?t:`${t}\n${e}`}function ME(e){return`${e||`Attachment`} could not be read — try attaching it again`}function NE(e){return[...e??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null)}function PE(e){return[...e??[]]}function FE(e,t){return e.trim()===``?t:`${e.replace(/\s*$/,``)} ${t}`}function IE(e,t,n,r,i){return e||t||n&&(r||i)}function LE(e,t,n){return!e||t||n}function RE(e,t,n){return(e+t+n)%n}function zE(e,t){return e??t}function BE(){return typeof CSS<`u`&&CSS.supports(`field-sizing`,`content`)}function VE(e,t){return e!==t}function HE(e){return e||void 0}function UE(e,t){return e&&!t||void 0}function WE(e,t,n){return e?t??``:n}function GE(e,t){return e?`${t}-submission`:void 0}function KE(e,t,n){return e?`${t} ${n}`:t}function qE(e,t,n,r){return e||t||n!==null||r!=null}function JE(e,t,n){return e||!!t||n}function YE(e,t){return!!e||t}function XE(e,t){return!e&&!t}function ZE(e,t){return!!e||!!t}function QE(e,t){return e===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:t?`Loading skills…`:`No matching skills.`}function $E(e,t){return C(`shrink-0 truncate`,e&&`font-semibold`,t&&`font-mono text-xs`)}function eD(e,t,n){return C(e&&`new-task-composer`,t&&`session-composer`,n&&`opacity-80`)}function tD(e){return C(`rounded-xl border border-[var(--composer-border)] bg-card shadow-none transition-[border-color,box-shadow] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,e&&`new-task-editor`)}function nD(e){return C(`group relative shrink-0 overflow-hidden rounded-md border border-border`,e?`size-12`:`flex h-12 min-w-11 max-w-[200px] items-center gap-1.5 bg-muted/40 px-2.5 text-xs text-muted-foreground`)}function rD(e,t){return C(`block field-sizing-content min-h-11 w-full overflow-y-auto resize-none bg-transparent px-3 pbs-2.5 pbe-1 text-base leading-normal outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed md:min-h-[54px] md:px-4 md:pbs-3 md:text-sm`,e?`max-h-11 md:max-h-[220px]`:`max-h-[220px]`,t&&`md:text-base`)}function iD(e,t){return e?`Task description`:t}function aD(e){return e?`hidden px-5 pbs-5 text-xs text-muted-foreground md:block`:`sr-only`}function oD(e){return C(`ms-auto flex min-w-0 flex-wrap items-center justify-end gap-1 md:flex-nowrap`,e&&`new-task-submission`)}function sD(e){return C(`min-w-0 flex-wrap items-center gap-1.5 md:flex-nowrap`,e.executionOptions&&`me-auto`,e.mobileCollapsible&&`max-md:[&_button]:min-h-11 max-md:[&_button]:min-w-11`,e.mobileCompact?`hidden md:flex`:`flex`)}function cD(e,t){return C(e.executionOptions?`h-12 w-full gap-2 px-6`:e.sessionControls?`h-11 w-auto gap-2 px-5`:`size-11`,!e.hasContent&&t&&`w-auto px-3`,`active:opacity-80`)}function lD(e,t){return C(`overflow-y-auto text-xs leading-5 text-muted-foreground`,e&&!t?`h-0`:`px-3 pbe-2 md:px-4`,e?t&&`min-h-6`:`h-24 md:h-20`)}function uD(e){return C(`h-11 min-w-11 active:opacity-80`,e?`w-auto px-3`:`w-11`)}function dD(e){return C(`flex min-w-0 flex-wrap items-center gap-1`,e&&`w-full`)}function fD(e){return C(`transition-transform motion-reduce:transition-none`,!e&&`rotate-180`)}function pD(e){return C(`h-11 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground md:h-8`,e&&`hidden md:inline-flex`)}function mD(e){return e.disabled||e.busy||e.stopPending||!e.hasContent&&!e.allowEmptySubmit}function hD(e,t){return!e.sessionControls&&!e.hasContent&&!!t}function gD(e,t){return e.executionOptions||e.sessionControls||!e.hasContent&&!!t}function _D(e,t){return e.sessionControls||e.hasContent||!t}function vD(e){return e?`Finishing…`:`Finish`}function yD({mode:e,onStart:t}){return(0,Q.jsxs)(k,{type:`button`,variant:`ghost`,size:`sm`,disabled:e.disabled||e.readOnly,"aria-label":`Start dictation`,title:`Dictation`,className:pD(e.mobileCompact),onClick:t,children:[(0,Q.jsx)(Ki,{"aria-hidden":`true`,className:`size-3.5`}),ZE(e.executionOptions,e.sessionControls)?null:`Dictation`]})}function bD({mode:e,onFinish:t}){return(0,Q.jsxs)(k,{type:`button`,"data-slot":`composer-finish`,"aria-label":e.finishLabel,"aria-busy":e.finishing||void 0,title:e.finishTitle,disabled:e.busy||e.stopPending||e.finishing,className:`h-11 w-auto gap-[7px] px-5 active:opacity-80`,onClick:t,children:[(0,Q.jsx)(Qi,{"aria-hidden":`true`}),e.finishLabel]})}function xD({mode:e,onStop:t}){return(0,Q.jsxs)(k,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":e.stopPending?`Stopping…`:`Stop`,"aria-busy":e.stopPending||void 0,title:e.stopPending?`Waiting for execution to stop`:`Stop execution; keep existing work`,disabled:e.busy||e.stopPending,className:uD(e.labelledStop),onClick:t,children:[(0,Q.jsx)(fa,{"aria-hidden":`true`,className:`size-3 fill-current`}),e.labelledStop?e.stopPending?`Stopping…`:`Stop`:null]})}function SD({shown:e,compactFeedback:t,hasCompactFeedback:n,textareaId:r,submissionError:i,stopPending:a,busy:o,pendingLabel:s,failureHint:c,idleFeedback:l}){return e?(0,Q.jsx)(`div`,{className:lD(t,n),children:(0,Q.jsx)(`div`,{id:`${r}-submission`,role:i===null?`status`:`alert`,"aria-atomic":`true`,tabIndex:i===null?void 0:0,className:`break-words`,children:a?`Stopping execution. Your draft is kept.`:o?s:i===null?l??null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`font-medium text-foreground`,children:i}),(0,Q.jsx)(`p`,{children:c})]})})}):null}function CD({mode:e,emptySubmitLabel:t,optionsId:n,dictationButton:r,footerEnd:i,stopControl:a,secondaryAction:o,finishControl:s,onSubmit:c}){return(0,Q.jsxs)(`div`,{"data-slot":`composer-submit-row`,className:oD(e.executionOptions),children:[ZE(e.executionOptions,e.sessionControls)?null:r,i?(0,Q.jsx)(`div`,{id:n,"data-slot":`composer-footer-end`,className:sD(e),children:(0,Q.jsx)(`div`,{className:`contents`,inert:HE(e.readOnly),children:i})}):null,(0,Q.jsxs)(`div`,{className:`flex min-w-[100px] items-center justify-end gap-1`,"data-slot":`composer-actions`,children:[a??o,s,XE(e.primaryStop,e.primaryFinish)?(0,Q.jsxs)(k,{type:`button`,size:`icon-sm`,"aria-label":e.submitLabel,"aria-busy":UE(e.busy,e.stopPending),disabled:mD(e),className:cD(e,t),onClick:c,children:[hD(e,t)?(0,Q.jsx)(Ya,{"aria-hidden":`true`}):null,gD(e,t)?e.submitLabel:null,_D(e,t)?(0,Q.jsx)(oa,{"aria-hidden":`true`}):null]}):null]})]})}function wD({images:e,readOnly:t,onRemove:n}){return e.length===0?null:(0,Q.jsx)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-nowrap items-center gap-2 overflow-x-auto px-4 pbs-3 md:flex-wrap md:overflow-visible`,children:e.map((e,r)=>(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:t?`Attachment submitted`:`Click to remove`,disabled:t,className:nD(e.isImage),onClick:()=>n(r),children:[e.isImage?(0,Q.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Bi,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,Q.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,Q.jsx)(ra,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${r}`))})}function TD({menuListRef:e,trigger:t,activeValue:n,skillsPending:r,candidates:i,onValueChange:a,onPick:o}){return(0,Q.jsx)(Gs,{shouldFilter:!1,value:n??``,onValueChange:a,children:(0,Q.jsx)(Os,{ref:e,"data-slot":`composer-menu`,"data-trigger":t,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:i.length===0?(0,Q.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:QE(t,r)}):i.map(e=>(0,Q.jsxs)(Ns,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>o(e),children:[(0,Q.jsx)(`span`,{className:$E(e.emphasized,t===`@`),children:e.label}),e.description?(0,Q.jsx)(`span`,{title:e.description,className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})}function ED({recording:e,insertionDisabled:t,onCancel:n,onInsert:r,onInsertAndSend:i,now:a}){return(0,Q.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-bs border-border bg-muted/60 px-3 py-2`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,Q.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:vE(e.startedAt,a)}),(0,Q.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e.transcript===``?(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e.transcript}),(0,Q.jsx)(k,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-11 text-muted-foreground md:size-8`,onClick:n,children:(0,Q.jsx)(ra,{"aria-hidden":`true`})}),(0,Q.jsx)(k,{type:`button`,variant:`outline`,size:`icon-sm`,disabled:t,"aria-label":`Insert transcription`,className:`size-11 md:size-8`,onClick:r,children:(0,Q.jsx)(Qi,{"aria-hidden":`true`})}),(0,Q.jsx)(k,{type:`button`,size:`icon-sm`,disabled:t,"aria-label":`Insert transcription and send`,className:`size-11 md:size-8`,onClick:i,children:(0,Q.jsx)(oa,{"aria-hidden":`true`})})]})}function DD({mobileOpen:e,controls:t,onToggle:n}){return(0,Q.jsx)(k,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`size-11 md:hidden`,"aria-label":e?`Collapse composer`:`Expand composer`,"aria-expanded":e,"aria-controls":t,onClick:n,children:(0,Q.jsx)(ua,{"aria-hidden":`true`,className:fD(e)})})}function OD(){return(0,Q.jsxs)(`p`,{"data-slot":`composer-skill-hint`,className:`flex items-center gap-2 px-5 pbs-3 pbe-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(sa,{"aria-hidden":`true`,className:`size-[15px] shrink-0`}),`Type / for a skill or workflow`]})}function kD({disabled:e,onFiles:t,inputRef:n}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,title:`Attach an image, PDF, TXT or MD file (or paste a screenshot)`,disabled:e,className:`size-11 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,Q.jsx)(Bi,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,Q.jsx)(`input`,{ref:n,type:`file`,accept:`image/*,application/pdf,text/plain,text/markdown,.pdf,.txt,.md,.markdown,.log`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function AD({mode:e,executionOptions:t,sessionControls:n,images:r,onRemoveImage:i,textareaId:a,textareaRef:o,text:s,disabled:c,retainDraftUntilSuccess:l,ariaLabel:u,disabledReason:d,placeholder:f,onTextChange:p,onKeyDown:m,onSelect:h,onPaste:g,recording:_,onCancelDictation:v,onInsertTranscript:y,onInsertAndSend:b,stopControl:x,mobileCollapsible:S,mobileOpen:C,optionsId:w,footerEnd:T,onToggleMobile:E,footerStart:D,attachInputRef:O,addFiles:k,dictationButton:A,submissionControls:j,feedback:M,agentOptions:ee}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{"data-slot":`composer-editor`,className:tD(t),children:[(0,Q.jsx)(wD,{images:r,readOnly:e.readOnly,onRemove:i}),(0,Q.jsx)(`label`,{htmlFor:a,className:aD(t),children:iD(t,u)}),(0,Q.jsx)(`textarea`,{ref:o,id:a,autoComplete:`off`,rows:1,value:s,disabled:c,readOnly:e.readOnly,"aria-busy":e.readOnly||void 0,"aria-describedby":GE(l,a),"aria-label":u,placeholder:WE(c,d,f),className:rD(e.mobileCompact,t),onChange:e=>p(e.target.value),onKeyDown:m,onSelect:h,onPaste:g}),t?(0,Q.jsx)(OD,{}):null,n&&_?(0,Q.jsx)(`div`,{"data-slot":`session-controls`,inert:HE(e.readOnly),children:n}):null,_?(0,Q.jsx)(jD,{recording:_,mode:e,onCancel:v,onInsert:y,onInsertAndSend:b,stopControl:x}):(0,Q.jsx)(MD,{mode:e,sessionControls:n,executionOptions:t,mobileCollapsible:S,mobileOpen:C,optionsId:w,textareaId:a,footerEnd:T,onToggleMobile:E,footerStart:D,attachInputRef:O,addFiles:k,disabled:c,dictationButton:A,submissionControls:j}),t?null:M]}),t?(0,Q.jsx)(ND,{mode:e,agentOptions:ee,executionOptions:t,submissionControls:j,feedback:M}):null]})}function jD({recording:e,mode:t,onCancel:n,onInsert:r,onInsertAndSend:i,stopControl:a}){let o=hx(1e3);return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(ED,{recording:e,insertionDisabled:t.readOnly,onCancel:n,onInsert:r,onInsertAndSend:i,now:o}),a?(0,Q.jsx)(`div`,{className:`flex justify-end px-2 pbe-2`,children:a}):null]})}function MD(e){return(0,Q.jsxs)(`div`,{"data-slot":`composer-toolbar`,className:`flex flex-wrap items-center gap-1 gap-y-1 px-1.5 pbs-1 pbe-1.5 md:gap-y-1.5 md:px-2 md:pbs-1.5 md:pbe-2`,children:[e.sessionControls?(0,Q.jsx)(`div`,{"data-slot":`session-controls`,inert:HE(e.mode.readOnly),children:e.sessionControls}):null,(0,Q.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:dD(e.executionOptions),children:[(0,Q.jsx)(kD,{disabled:e.disabled||e.mode.readOnly,onFiles:e.addFiles,inputRef:e.attachInputRef}),e.mobileCollapsible?(0,Q.jsx)(DD,{mobileOpen:e.mobileOpen,controls:KE(!!e.footerEnd,e.textareaId,e.optionsId),onToggle:e.onToggleMobile}):null,(0,Q.jsx)(`div`,{className:`contents`,inert:HE(e.mode.readOnly),children:e.footerStart}),ZE(e.executionOptions,e.sessionControls)?(0,Q.jsx)(`div`,{children:e.dictationButton}):null]}),e.executionOptions?null:e.submissionControls]})}function ND({mode:e,agentOptions:t,executionOptions:n,submissionControls:r,feedback:i}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{"data-slot":`composer-agent-options`,inert:HE(e.readOnly),children:t}),(0,Q.jsx)(`div`,{"data-slot":`composer-execution-panel`,inert:HE(e.readOnly),children:n}),r,(0,Q.jsx)(`div`,{"data-slot":`composer-feedback`,children:i})]})}function PD({open:e,onClose:t,rootRef:n,disabled:r,onDrop:i,className:a,children:o,menu:s}){return(0,Q.jsxs)(fi,{open:e,onOpenChange:e=>e?void 0:t(),children:[(0,Q.jsx)(ri,{asChild:!0,children:(0,Q.jsx)(`div`,{ref:n,"data-slot":`composer`,"data-disabled":r||void 0,onDrop:i,onDragOver:e=>e.preventDefault(),className:a,children:o})}),(0,Q.jsx)(Qr,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{n.current?.contains(e.target)&&e.preventDefault()},children:s})]})}var FD=new Map,ID={KeyA:`Yes, approved.`,KeyC:`Continue.`},LD={retainDraftUntilSuccess:!1,finishing:!1,stopOnEmpty:!1,stopping:!1,compactFeedback:!1,pendingLabel:`Starting task…`,failureHint:`Could not confirm submission. Check Tasks before you retry. Your draft is kept.`,clearOnSuccess:!0,autoFocus:!1,mobileCollapsible:!1,sendAriaLabel:`Send`,disabled:!1,disabledReason:`Session closed — Continue to reopen.`,allowEmptySubmit:!1,placeholder:`Reply — / for skills, @ for files…`,ariaLabel:`Reply to the agent`,autocompleteSkills:!0,quickReplies:!1};function RD(e,t){return e===void 0?t:e}function zD(e){return{...e,retainDraftUntilSuccess:RD(e.retainDraftUntilSuccess,LD.retainDraftUntilSuccess),finishing:RD(e.finishing,LD.finishing),stopOnEmpty:RD(e.stopOnEmpty,LD.stopOnEmpty),stopping:RD(e.stopping,LD.stopping),compactFeedback:RD(e.compactFeedback,LD.compactFeedback),pendingLabel:RD(e.pendingLabel,LD.pendingLabel),failureHint:RD(e.failureHint,LD.failureHint),clearOnSuccess:RD(e.clearOnSuccess,LD.clearOnSuccess),autoFocus:RD(e.autoFocus,LD.autoFocus),mobileCollapsible:RD(e.mobileCollapsible,LD.mobileCollapsible),sendAriaLabel:RD(e.sendAriaLabel,LD.sendAriaLabel),disabled:RD(e.disabled,LD.disabled),disabledReason:RD(e.disabledReason,LD.disabledReason),allowEmptySubmit:RD(e.allowEmptySubmit,LD.allowEmptySubmit),placeholder:RD(e.placeholder,LD.placeholder),ariaLabel:RD(e.ariaLabel,LD.ariaLabel),autocompleteSkills:RD(e.autocompleteSkills,LD.autocompleteSkills),quickReplies:RD(e.quickReplies,LD.quickReplies)}}function BD(e,t,n,r){if(e===null)return[];if(e.trigger===`/`){let r=new Set;return wc(t,e.query,n).filter(e=>r.has(e.id)?!1:(r.add(e.id),!0)).map(e=>({value:e.id,insert:e.id,label:e.name,description:VD(e,t),emphasized:Cc(e)}))}return(r?.()??[]).filter(t=>Dc(t,e.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1}))}function VD(e,t){let n=t.filter(t=>t.id===e.id);return[e.description,...n.map(e=>e.path),n.length>1?`Runner scope picks the copy. Use the task skill picker to choose a specific copy.`:void 0].filter(Boolean).join(` · `)}function HD(e,t){return e.some(e=>e.value===t)?t:e[0]?.value}function UD(e,t,n,r,i,a,o){!e||!t||!n||(r&&a(),i&&o())}function WD(e,t,n,r,i,a,o,s){if(e){a(n);return}G(n,{tone:`danger`}),t&&(o(e=>jE(e,r)),s(e=>[...i,...e].slice(0,4)))}function GD(e,t){let[n,r]=(0,Z.useState)(``),i=e??n,a=(0,Z.useRef)(i);a.current=i;let o=(0,Z.useRef)(t);return o.current=t,{text:i,textRef:a,setText:(0,Z.useCallback)(e=>{let t=typeof e==`function`?e(a.current):e;r(t),o.current?.(t)},[])}}function KD(e){let{onSubmit:t,retainDraftUntilSuccess:n,onStop:r,onFinish:i,finishing:a,secondaryAction:o,stopOnEmpty:s,stopping:c,emptySubmitLabel:l,compactFeedback:u,idleFeedback:d,pendingLabel:f,failureHint:p,clearOnSuccess:m,onPendingChange:h,value:g,onValueChange:_,autoFocus:v,mobileCollapsible:y,mobileDisclosureKey:b,footerStart:x,footerEnd:S,sessionControls:C,executionOptions:w,agentOptions:T,sendAriaLabel:E,disabled:D,disabledReason:O,allowEmptySubmit:k,placeholder:A,ariaLabel:j,autocompleteSkills:M,skillRunner:ee,skillAccount:te,quickReplies:ne,getMentionCandidates:re,ref:ie}=zD(e),{text:N,textRef:P,setText:F}=GD(g,_),[ae,oe]=(0,Z.useState)([]),se=(0,Z.useRef)(ae);se.current=ae;let[ce,le]=(0,Z.useState)(!1),ue=c||ce,de=(0,Z.useRef)(ue);de.current=ue;let[fe,pe]=(0,Z.useState)(!1),me=(0,Z.useRef)(!1),he=(0,Z.useRef)(0),ge=(0,Z.useRef)(!0);(0,Z.useEffect)(()=>(ge.current=!0,()=>{ge.current=!1}),[]);let[_e,ve]=(0,Z.useState)(null),ye=()=>TE(de.current,n,me.current),[xe,Se]=(0,Z.useState)(null),[Ce,we]=(0,Z.useState)(``),[Te,Ee]=(0,Z.useState)(!1),De=(0,Z.useRef)(null),Oe=(0,Z.useId)(),ke=(0,Z.useId)(),Ae=(0,Z.useRef)(null),je=(0,Z.useRef)(new Map),Me=b===void 0?je.current:FD,Ne=OE(b),[,Pe]=(0,Z.useReducer)(e=>e+1,0),Fe=kE(Me,Ne),Ie=(0,Z.useRef)(null),Le=(0,Z.useRef)(null),Re=(0,Z.useRef)(null),ze=hn(ee,te,M&&Te),Be=mn(),Ve=I(),He=(0,Z.useRef)(D);He.current=D;let Ue=_E((e,t)=>G(e,{tone:`danger`,...t?{action:{label:`Try again`,onAction:()=>{!He.current&&!ye()&&t()}}}:{}}));(0,Z.useEffect)(()=>{v&&De.current?.focus()},[]);let We=(0,Z.useCallback)(()=>{let e=De.current;if(!e||D||ye()){Se(null);return}let t=fE(e.value,zE(e.selectionStart,e.value.length));if(t?.trigger===`/`&&!M||t?.trigger===`@`&&re===void 0)return Se(null);t?.trigger===`/`&&Ee(!0),Se(t)},[M,D,re,n]),Ge=(0,Z.useMemo)(()=>BD(xe,ze.data??[],Be.data?.skillUsage,re),[re,ze.data,xe,Be.data?.skillUsage]),Ke=HD(Ge,Ce),qe=xe!==null;(0,Z.useLayoutEffect)(()=>{!qe||!Ke||[...Le.current?.querySelectorAll(`[data-slot="composer-menu-item"]`)??[]].find(e=>e.getAttribute(`data-value`)===Ke)?.scrollIntoView({block:`nearest`})},[Ke,qe]);let Je=(0,Z.useCallback)(()=>Se(null),[]),Ye=e=>{let t=De.current;if(!t||xe===null||ye())return;let n=zE(t.selectionStart,t.value.length),r=pE(t.value,xe,n,e.insert);xe.trigger===`/`&&Be.data!==void 0&&be({skillUsage:Oc(Be.data.skillUsage,e.insert)}).then(()=>Ve.invalidateQueries({queryKey:U.uiState})).catch(()=>{}),F(r.text),Re.current=r.caret,Se(null),t.focus()};(0,Z.useLayoutEffect)(()=>{let e=Re.current,t=De.current;e!==null&&t&&(t.setSelectionRange(e,e),Re.current=null)},[N]),(0,Z.useLayoutEffect)(()=>{let e=De.current;if(!e||BE())return;let t=()=>{e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`};t();let n=e.clientWidth,r=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>{VE(e.clientWidth,n)&&(n=e.clientWidth,t())});r?.observe(e);let i=!1;return document.fonts?.ready.then(()=>{i||t()}),()=>{i=!0,r?.disconnect()}},[N,Fe]);let Xe=(0,Z.useCallback)(e=>{if(D||ye())return;let t=he.current,r=uE(e,se.current.length);for(let e of r.rejected)G(e,{tone:`danger`});for(let e of r.accepted)lE(e).then(e=>{!ge.current||n&&me.current&&!de.current||t!==he.current||oe(t=>t.length>=4?t:[...t,e])},()=>G(ME(e.name),{tone:`danger`}))},[D,n]),Ze=e=>{let t=PE(e.dataTransfer?.files);t.length!==0&&(e.preventDefault(),Xe(t))},Qe=(0,Z.useCallback)((e,t)=>EE(D,c,me.current,k,e,t.length),[D,c,k]),$e=(0,Z.useCallback)(async(e,r,i)=>{let a=e.trim();if(!Qe(e,r)){me.current=!0,n&&(he.current+=1),pe(!0),ve(null),h?.(!0),Se(null),i&&!n&&(F(``),oe([]));try{await t(a,r.map(({mediaType:e,data:t})=>({mediaType:e,data:t}))),UD(ge.current,n,m,P.current===e,se.current===r,()=>F(``),()=>oe([]))}catch(t){if(!ge.current&&n)return;WD(n,i,AE(t),e,r,ve,F,oe)}finally{me.current=!1,ge.current&&(h?.(!1),pe(!1))}}},[Qe,t,n,m,h,F]),et=(0,Z.useCallback)(()=>Qe(P.current,se.current)?!1:($e(P.current,se.current,!0),!0),[Qe,$e]);(0,Z.useImperativeHandle)(ie,()=>({insertAtCaret:e=>{if(ye())return;let t=De.current,n=zE(t?.selectionStart??null,P.current.length),r=zs(P.current,n,e);F(r.text),Re.current=r.caret,t?.focus()}}),[F,n]);let tt=async()=>{if(!LE(r,c,me.current)){me.current=!0,pe(!0),le(!0),ve(null);try{await r?.()}catch(e){ge.current&&ve(AE(e))}finally{me.current=!1,ge.current&&(pe(!1),le(!1))}}},nt=e=>{qe&&rt(e)||aE({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),et())},rt=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),Ge.length===0)return!0;let t=Ge.findIndex(e=>e.value===Ke),n=e.key===`ArrowDown`?1:-1,r=Ge[RE(t,n,Ge.length)];return we(r.value),!0}if(e.key===`Escape`)return e.preventDefault(),Je(),!0;if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=Ge.find(e=>e.value===Ke);if(t)return e.preventDefault(),Ye(t),!0;Je()}return!1};(0,Z.useEffect)(()=>{if(!ne||D)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||Hg(e.target))return;let t=ID[e.code];t!==void 0&&(e.preventDefault(),$e(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[D,ne,$e]);let it=e=>{if(IE(D,de.current,me.current,e,n))return;let t=Ue.finish();if(t===``)return;let r=FE(N,t);if(e){n&&F(r),$e(r,ae,!0);return}F(r),Re.current=r.length,De.current?.focus()},at=yE(N,ae.length),ot=bE(at,r,s,ue),st=xE(at,ot,i),ct={hasContent:at,primaryStop:ot,primaryFinish:st,labelledStop:SE(ot,st,at,l),submitLabel:CE(at,l,E),busy:fe,stopPending:ue,finishing:a,finishLabel:vD(a),finishTitle:`Close the session and mark this task done`,disabled:D,allowEmptySubmit:k,readOnly:wE(ue,n,fe),mobileCompact:DE(y,Fe),mobileCollapsible:y,executionOptions:!!w,sessionControls:!!C,showStop:YE(r,ue)},lt=Ue.recording,ut=Ue.supported?(0,Q.jsx)(yD,{mode:ct,onStart:()=>{ye()||Ue.start()}}):null,dt=ct.primaryFinish?(0,Q.jsx)(bD,{mode:ct,onFinish:()=>void i?.()}):null,ft=ct.showStop?(0,Q.jsx)(xD,{mode:ct,onStop:()=>void tt()}):null,pt=(0,Q.jsx)(SD,{shown:JE(n,r,c),compactFeedback:u,hasCompactFeedback:qE(ue,fe,_e,d),textareaId:Oe,submissionError:_e,stopPending:ue,busy:fe,pendingLabel:f,failureHint:p,idleFeedback:d}),mt=(0,Q.jsx)(CD,{mode:ct,emptySubmitLabel:l,optionsId:ke,dictationButton:ut,footerEnd:S,stopControl:ft,secondaryAction:o,finishControl:dt,onSubmit:et});return(0,Q.jsx)(PD,{open:qe,onClose:Je,rootRef:Ie,disabled:D,onDrop:Ze,className:eD(w,C,D),menu:(0,Q.jsx)(TD,{menuListRef:Le,trigger:xe?.trigger,activeValue:Ke,skillsPending:ze.isPending,candidates:Ge,onValueChange:we,onPick:Ye}),children:(0,Q.jsx)(AD,{mode:ct,executionOptions:w,sessionControls:C,images:ae,onRemoveImage:e=>{ye()||oe(t=>t.filter((t,n)=>n!==e))},textareaId:Oe,textareaRef:De,text:N,disabled:D,retainDraftUntilSuccess:n,ariaLabel:j,disabledReason:O,placeholder:A,onTextChange:e=>{ye()||(F(e),We())},onKeyDown:nt,onSelect:We,onPaste:e=>{let t=NE(e.clipboardData?.items);t.length!==0&&(e.preventDefault(),Xe(t))},recording:lt,onCancelDictation:Ue.cancel,onInsertTranscript:()=>it(!1),onInsertAndSend:()=>it(!0),stopControl:ft,mobileCollapsible:y,mobileOpen:Fe,optionsId:ke,footerEnd:S,onToggleMobile:()=>{Me.set(Ne,!Fe),Pe()},footerStart:x,attachInputRef:Ae,addFiles:Xe,dictationButton:ut,submissionControls:mt,feedback:pt,agentOptions:T})})}var qD={repo:`Project`,user:`User`,system:`Built in`,other:null};function JD(e){return[e.scope?qD[e.scope]:null,e.plugin?`Plugin ${e.plugin}`:null].filter(Boolean).join(` · `)||null}function YD({skill:e,heading:t=`h2`,actions:n}){let r=JD(e);return(0,Q.jsxs)(`div`,{"data-slot":`skill-detail`,className:`grid min-w-0 gap-3 break-words`,children:[t?(0,Q.jsx)(t,{className:`text-xl font-semibold`,children:e.name}):null,e.description?(0,Q.jsx)(`p`,{"data-slot":`skill-description`,className:`max-w-[78ch] text-[13.5px] leading-relaxed`,children:e.description}):(0,Q.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`This runner reports no description.`}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[max-content_minmax(0,1fr)] items-center gap-x-4 gap-y-1.5 text-[12.5px]`,children:[(0,Q.jsx)(XD,{label:`Id`,children:(0,Q.jsx)(ZD,{value:e.id,label:`Copy id`})}),r?(0,Q.jsx)(XD,{label:`Source`,children:(0,Q.jsx)(`span`,{"data-slot":`skill-source`,children:r})}):null,e.path?(0,Q.jsx)(XD,{label:`File`,children:(0,Q.jsx)(ZD,{value:e.path,label:`Copy path`,slot:`skill-path`})}):null]}),n?(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n}):null]})}function XD({label:e,children:t}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`dt`,{className:`text-soft-foreground`,children:e}),(0,Q.jsx)(`dd`,{className:`flex min-w-0 items-center gap-1`,children:t})]})}function ZD({value:e,label:t,slot:n}){let r=()=>Promise.resolve().then(()=>navigator.clipboard.writeText(e)).then(()=>G(`Copied.`),e=>G(e instanceof Error?e.message:String(e),{tone:`danger`}));return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`code`,{"data-slot":n,title:e,className:`min-w-0 truncate rounded-sm border border-border bg-background px-1.5 py-px font-mono text-xs`,children:e}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":t,onClick:()=>void r(),className:`inline-flex size-7 shrink-0 items-center justify-center rounded-sm text-soft-foreground focus-visible:outline-2 pointer-hover:bg-muted pointer-hover:text-foreground`,children:(0,Q.jsx)(wa,{"aria-hidden":`true`,className:`size-3.5`})})]})}function QD({skill:e,onClose:t}){return(0,Q.jsx)(es,{open:e!==null,onOpenChange:e=>{e||t()},children:(0,Q.jsx)(Qo,{"data-slot":`skill-preview`,className:`max-h-[80dvh] overflow-y-auto`,children:e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($o,{className:`sr-only`,children:e.name}),(0,Q.jsx)(Yo,{className:`sr-only`,children:`Runner skill metadata`}),(0,Q.jsx)(YD,{skill:e,heading:`h3`})]}):null})})}function $D(){let e=cr(),t=lr(),n=(e.data?.profiles??[]).map(e=>({provider:e.provider,id:e.id,label:e.label,configDir:e.configDir})),r=t.data?.info?.root;return{accounts:n,repoAccount:r?e.data?.selections?.[r]:void 0}}function eO(e,t){return e.filter(e=>e.provider===t).length>1}function tO(e){try{let t=new URL(e),n=t.pathname===`/`?``:t.pathname.replace(/\/$/,``);return`${t.host}${n}`||e}catch{return e}}function nO(e){return e?e.webhooks?e.webhooks.filter(e=>e.tasks).map(({id:e,name:t,url:n})=>({id:e,name:t,url:n})):e.webhook?[{id:`task-webhook`,name:`Task webhook`,url:e.webhook.url}]:[]:[]}function rO(e){let t=e.map(e=>e.name);return t.length<=2?t.join(` and `):t.length===3?`${t[0]}, ${t[1]} and ${t[2]}`:`${t[0]}, ${t[1]} and ${t.length-2} more`}function iO(e,t){return e===``?{message:`Prefilled from link — review and press Start`,tone:`default`}:{message:t?`Unknown skill "${e}" — prefilled for quick-task; review and press Start`:`Unknown skill "${e}" — no skill selected; review before starting`,tone:`danger`}}function aO(e,t){return`Use the "${e}" skill on: ${t}`}function oO(e){let t=e.configuredAutonomous===`source-dependent`?e.source===`skill`:e.configuredAutonomous;return{autonomous:e.planFirst?!1:e.explicitAutonomous??t,worktree:e.hasGit?e.explicitWorktree??e.configuredWorktree:!1}}function sO(e){return e.worktree?`Runs in an isolated worktree — review everything before it lands.`:e.hasGit?`Runs in the repo working tree — your checkout is modified directly.`:`Runs in place — no git repository detected, so there is no worktree to isolate in.`}var cO={text:``,source:null,runner:null,agentProfile:null,model:null,effort:null,planFirst:!1,worktree:null,autonomous:null,archiveWhenDone:!1,autoMergePr:!1,allowWorkers:!0,allowMessaging:!0},lO=`cez-new-task-draft`;function uO(e){return e===null?lO:`${lO}:${e}`}function dO(e){let t=e&&typeof e==`object`?e:{};return{text:typeof t.text==`string`?t.text:``,source:fO(t.source)?t.source:null,runner:typeof t.runner==`string`?t.runner:null,agentProfile:typeof t.agentProfile==`string`?t.agentProfile:null,model:typeof t.model==`string`?t.model:null,effort:typeof t.effort==`string`?t.effort:null,planFirst:t.planFirst===!0,worktree:typeof t.worktree==`boolean`?t.worktree:null,autonomous:typeof t.autonomous==`boolean`?t.autonomous:null,archiveWhenDone:t.archiveWhenDone===!0,autoMergePr:t.autoMergePr===!0,allowWorkers:t.allowWorkers!==!1,allowMessaging:t.allowMessaging!==!1}}function fO(e){return!!e&&typeof e==`object`&&(e.source===`skill`||e.source===`workflow`)&&typeof e.ref==`string`}var pO=new Map,mO=new Map;function hO(e=null){return mO.get(uO(e))??0}function gO(e=null){let t=uO(e),n=pO.get(t);if(n)return{...n};let r;try{let e=localStorage.getItem(t);r=e?dO(JSON.parse(e)):{...cO}}catch{r={...cO}}return pO.set(t,r),{...r}}function _O(e,t=null){let n=uO(t);mO.set(n,hO(t)+1),pO.set(n,{...e});try{localStorage.setItem(n,JSON.stringify(e))}catch{}}function vO(e=null,t){t!==void 0&&hO(e)!==t||_O({...gO(e),text:``,source:null},e)}function yO(e,t,n){return{task:e,steps:[...n.steps],rationale:n.rationale,fallback:n.fallback,images:[...t]}}function bO(e,t){return!Number.isInteger(t)||t<0||t>=e.length?[...e]:e.filter((e,n)=>n!==t)}function xO(e,t,n){let r=[...e];if(!Number.isInteger(t)||t<0||t>=r.length)return r;let i=Math.max(0,Math.min(r.length-1,n));if(i===t)return r;let[a]=r.splice(t,1);return r.splice(i,0,a),r}function SO(e){return e.command??e.prompt??``}function CO(e,t=120){let n=e.split(`
|
|
13
|
-
`)[0]??``;return n.length>t?`${n.slice(0,t-1)}…`:n}function wO(e){let{task:t,steps:n,agentProfile:r,model:i,modelsLocked:a,effort:o,runner:s,runnerExplicit:c,defaultRunner:l,images:u,archiveWhenDone:d,autoMergePr:f,allowWorkers:p,allowMessaging:m}=e;return{task:t,steps:[...n],...r?{agentProfile:r}:{},model:a?void 0:i||void 0,effort:a?void 0:o||void 0,runner:nc(s,l,c),images:u.length>0?[...u]:void 0,...Es({archiveWhenDone:d,autoMergePr:f,allowWorkers:p,allowMessaging:m})}}function TO(e,t,n){return{runner:e,agentProfile:t||null,...e===n?{}:{model:null,effort:null}}}function EO(e,t){let n=gO(e);return{...n,...t.runner===void 0?{}:TO(t.runner,t.account,n.runner),...t.ref===``?{}:{text:t.ref},...t.skill===``?{}:{source:{source:`skill`,ref:t.skill,...t.skillPath===void 0?{}:{path:t.skillPath}}}}}function DO(e,t,n){let[r,i]=(0,Z.useState)(()=>EO(e,t)),a=(0,Z.useRef)(r);(0,Z.useEffect)(()=>{_O(a.current,e)},[e]);let o=(0,Z.useRef)(!1),s=(0,Z.useRef)(!0);(0,Z.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]);let c=t=>{if(!s.current||o.current)return;let n={...a.current,...t};a.current=n,_O(n,e),i(n)},l=(0,Z.useRef)(t.runner===void 0);return(0,Z.useEffect)(()=>{!l.current||n===void 0||(l.current=!1,c(TO(n,t.account,a.current.runner)))},[n]),{draft:r,update:c,clearStarted:t=>{if(hO(e)!==t)return;vO(e,t);let n=gO(e);a.current=n,s.current&&i(n)},submissionPending:o,mounted:s}}function OO(e,t,n,r){let i=un(),a=hn(n,r),o=a.data,s=t.data?.skillUsage,c=(0,Z.useMemo)(()=>Tc(o??[],s),[o,s]),l=i.data?.workflows??[],u=i.data!==void 0&&!t.isPending,d=Ts(e,c,l,a.unchecked),f=d?.source===`skill`?c.find(e=>e.id===d.ref&&(d.path===void 0||e.path===d.path)):void 0;return{skillList:c,skillUsage:s,workflowList:l,sourcesReady:u,source:d,selectedSkill:f,skillsSettled:!a.isPending,listUnchecked:a.unchecked,unchecked:a.unchecked||d?.source===`skill`&&!f}}function kO(e){let{uiState:t,source:n,sourcesReady:r,draftText:i,submissionPending:a,update:o}=e,s=t.data?.promptTemplates,c=(0,Z.useMemo)(()=>ec(s),[s]),l=Qs(c,n?.source===`skill`?[n.ref]:[]),u=(0,Z.useRef)(i);u.current=i;let d=(0,Z.useRef)(``);return(0,Z.useEffect)(()=>{if(!r||a.current)return;let e=Bs(u.current,d.current,l);d.current=e.applied,e.text!==u.current&&o({text:e.text})},[l,r]),c}function AO(e,t){let n=Wn(),r=Oi(),i=de(n.data,r.data),a=t.data?.defaultRunner,o=a??`claude`,s=i.length>0?Ps(e.runner,i,o):null,c=s??o,l=n.isSuccess&&i.length>0,u={isPending:n.isPending||r.isPending,isError:n.isError||r.isError},d=$D(),f=Cn(c,!0,d.accounts.some(t=>t.provider===c&&t.id===e.agentProfile)?e.agentProfile:d.repoAccount?.[c]),p=t.data?.modelsLocked===!0,m=t.data?.defaultModels,h=s===null?[]:tc(s,r.data,f.data,[e.model,m?.[s]]),g=s===null?``:rc(p?null:e.model,s,r.data,m,f.data),_=Is(g,f.data);return{providers:u,registered:r,runners:i,defaultRunner:a,runner:s,displayRunner:c,providersReady:l,catalog:f,modelsLocked:p,models:h,model:g,effortOptions:_,effort:p?``:Rs(e.effort,_)}}function jO(e,t){let n=cr(),{accounts:r,repoAccount:i}=$D(),a=r.some(n=>n.provider===e&&n.id===t);return{accountChoices:r,repoAccount:i,accountsSettled:!n.isPending,agentProfile:a?t:null}}function MO(e){let t=(0,Z.useRef)(!1),n=(0,Z.useRef)(void 0);(0,Z.useEffect)(()=>{n.current===void 0&&(n.current=document.activeElement);let r=e&&!t.current;t.current=e,r&&(document.activeElement===document.body||document.activeElement===n.current)&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[e])}function NO(e){let t=e.workspaceConfig.data?.composerDefaults;return oO({hasGit:e.hasGit,planFirst:e.draft.planFirst,explicitAutonomous:e.draft.autonomous,explicitWorktree:e.draft.worktree,configuredAutonomous:t?.autonomous??t?.inheritedAutonomous??`source-dependent`,configuredWorktree:t?.worktree??t?.inheritedWorktree??!0,source:e.source?.source??`workflow`})}function PO(e){let t=bn(),n=t.data?.projects??[],r=e??t.data?.bootProject,i=nO(n.find(e=>e.id===r)),[a,o]=(0,Z.useState)(!1);return{projectList:n,webhookTargets:i,notifyOn:i.length>0&&a,setNotifyChoice:o}}function FO(e){let[t,n]=(0,Z.useState)(()=>typeof window<`u`&&window.innerWidth<=767);return(0,Z.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=()=>n(window.innerWidth<=767||t.getBoundingClientRect().width<550);r();let i=typeof ResizeObserver>`u`?null:new ResizeObserver(r);return i?.observe(t),window.addEventListener(`resize`,r),()=>{i?.disconnect(),window.removeEventListener(`resize`,r)}},[]),t}function IO(e){let t=gs(),[n,r]=(0,Z.useState)(()=>e.deepLink.ref!==``||e.deepLink.skillPath!==void 0);LO(e.search,t),RO({pending:n,setPending:r,deepLink:e.deepLink,sourcesReady:e.sourcesReady,listUnchecked:e.listUnchecked,skillList:e.skillList,update:e.update})}function LO(e,t){let n=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{n.current||(n.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[])}function RO(e){let{pending:t,sourcesReady:n,deepLink:r}=e;(0,Z.useEffect)(()=>{if(!t||!n)return;e.setPending(!1);let i=!e.listUnchecked&&r.skill!==``&&!Fs({source:`skill`,ref:r.skill,...r.skillPath===void 0?{}:{path:r.skillPath}},e.skillList,[])?r.skill:``;i!==``&&r.ref!==``&&e.update({text:aO(r.skill,r.ref),source:null});let{message:a,tone:o}=iO(i,r.ref!==``);G(a,{tone:o}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"], [data-slot="composer"] button[aria-label="Plan task"]`)?.focus()},[t,n])}function zO(e){return e.isPending?`Checking agent providers…`:e.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`}function BO(e,t,n){be({lastTask:e?{source:e.source,ref:e.ref}:null,...e?{recentSources:ic(t.data?.recentSources,{source:e.source,ref:e.ref})}:{},...e?.source===`skill`&&t.data!==void 0?{skillUsage:Oc(t.data.skillUsage,e.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:U.uiState})).catch(()=>{})}function VO(e){let t=gs(),n=I(),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(!1),{draft:l,draftProjectId:u,engine:d,mounted:f}=e,{providers:p,providersReady:m,runner:h}=d,g=(r,i)=>{e.clearStarted(i),n.invalidateQueries({queryKey:U.runs.all}),f.current&&t(Ds(r))};return{plan:r,setPlan:i,planning:a,starting:s,submit:async(t,r)=>{let a=hO(u);if(!m||h===null)throw Error(zO(p));if(!e.sourcesReady)throw Error(`Still loading workflows and skills — try again in a second.`);if(l.agentProfile&&!e.accountsSettled)throw Error(`Still loading agent accounts — try again in a second.`);if(l.planFirst){o(!0);try{let e=await Be(t);f.current&&i(yO(t,r,e))}finally{o(!1)}return}let s=await Ht(Ms(Hs({task:t,source:e.source,model:d.model,modelsLocked:d.modelsLocked,effort:d.effort,runner:h,runnerExplicit:l.runner!==null,agentProfile:e.agentProfile,defaultRunner:d.defaultRunner,images:r,worktree:e.runMode.worktree,autonomous:e.runMode.autonomous,archiveWhenDone:l.archiveWhenDone,autoMergePr:l.autoMergePr,allowWorkers:l.allowWorkers,allowMessaging:l.allowMessaging}),e.notifyOn));BO(e.source,e.uiState,n),g(s,a)},startPlanned:async()=>{if(r===null||r.steps.length===0||s||!m||h===null||l.agentProfile&&!e.accountsSettled)return;let t=hO(u);c(!0);try{let n=await Ht(Ms(wO({task:r.task,steps:r.steps,agentProfile:e.agentProfile,model:d.model,modelsLocked:d.modelsLocked,effort:d.effort,runner:h,runnerExplicit:l.runner!==null,defaultRunner:d.defaultRunner,images:r.images,archiveWhenDone:l.archiveWhenDone,autoMergePr:l.autoMergePr,allowWorkers:l.allowWorkers,allowMessaging:l.allowMessaging}),e.notifyOn));i(null),g(n,t)}catch(e){G(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{c(!1)}}}}function HO({archiveWhenDone:e,autoMergePr:t,onChange:n,disabled:r=!1,embedded:i=!1}){let a=(0,Z.useId)();return(0,Q.jsxs)(`fieldset`,{"data-slot":`completion-controls`,"data-embedded":i||void 0,className:`grid min-w-0 gap-3`,children:[(0,Q.jsx)(`legend`,{className:i?`sr-only`:`text-sm font-medium [margin-block-end:0.5rem]`,children:`After Done`}),(0,Q.jsxs)(`label`,{htmlFor:`${a}-archive`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,Q.jsx)(`span`,{id:`${a}-archive-label`,children:`Archive when Done`}),i?(0,Q.jsx)(`span`,{id:`${a}-archive-help`,className:`completion-control-help`,children:`Move to Archived after Done, even without a PR. You can restore it later.`}):null]}),(0,Q.jsx)(uh,{id:`${a}-archive`,className:`completion-switch`,checked:e,disabled:r,"aria-labelledby":`${a}-archive-label`,"aria-describedby":`${a}-archive-help`,onCheckedChange:e=>n({archiveWhenDone:e})})]}),i?null:(0,Q.jsx)(`p`,{id:`${a}-archive-help`,className:`text-xs break-words text-muted-foreground`,children:`Move the task to Archived after it reaches Done. You can restore it later.`}),(0,Q.jsxs)(`label`,{htmlFor:`${a}-merge`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,Q.jsx)(`span`,{id:`${a}-merge-label`,children:`Auto-merge PR`}),i?(0,Q.jsx)(`span`,{id:`${a}-merge-help`,className:`completion-control-help`,children:`After Done, mark the PR ready and merge when current-head CI and GitHub rules allow.`}):null]}),(0,Q.jsx)(uh,{id:`${a}-merge`,className:`completion-switch`,checked:t,disabled:r,"aria-labelledby":`${a}-merge-label`,"aria-describedby":`${a}-merge-help`,onCheckedChange:e=>n({autoMergePr:e})})]}),i?null:(0,Q.jsx)(`p`,{id:`${a}-merge-help`,className:`text-xs break-words text-muted-foreground`,children:`After Done, mark a draft PR ready and merge when current-head CI and GitHub rules allow it.`}),!i||e&&t?(0,Q.jsx)(`p`,{className:`completion-order-note text-xs break-words text-muted-foreground`,children:i?`Merge runs before archive when both are on.`:`When both are on, merge comes before archive. Without a PR, Archive when Done still archives the task.`}):null]})}var UO=[{key:`allowWorkers`,slot:`workers`,label:`Allow Squawk workers`,help:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`},{key:`allowMessaging`,slot:`messaging`,label:`Allow task messaging`,help:`Agents in this task can message other tasks in this project.`}];function WO({allowWorkers:e,allowMessaging:t,onChange:n,disabled:r=!1,embedded:i=!1}){let a=(0,Z.useId)(),o={allowWorkers:e,allowMessaging:t};return(0,Q.jsxs)(`fieldset`,{"data-slot":`task-access-controls`,"data-embedded":i||void 0,className:`grid min-w-0 gap-3`,children:[(0,Q.jsx)(`legend`,{className:i?`sr-only`:`text-sm font-medium [margin-block-end:0.5rem]`,children:`Task access`}),UO.map(e=>(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsxs)(`label`,{htmlFor:`${a}-${e.slot}`,"data-slot":`task-access-${e.slot}`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,Q.jsx)(`span`,{id:`${a}-${e.slot}-label`,children:e.label}),i?(0,Q.jsx)(`span`,{id:`${a}-${e.slot}-help`,className:`completion-control-help`,children:e.help}):null]}),(0,Q.jsx)(uh,{id:`${a}-${e.slot}`,className:`completion-switch shrink-0`,checked:o[e.key],disabled:r,"aria-labelledby":`${a}-${e.slot}-label`,"aria-describedby":`${a}-${e.slot}-help`,onCheckedChange:t=>n({[e.key]:t})})]}),i?null:(0,Q.jsx)(`p`,{id:`${a}-${e.slot}-help`,className:`text-xs break-words text-muted-foreground`,children:e.help})]},e.key))]})}function GO(){return(0,Q.jsxs)(`header`,{className:`mb-7 max-md:mb-5`,children:[(0,Q.jsx)(`p`,{"data-slot":`page-eyebrow`,className:`mb-2 text-[11px] font-semibold tracking-[0.16em] text-[var(--accent-text)] uppercase`,children:`NEW TASK`}),(0,Q.jsx)(`h1`,{className:`text-[30px] leading-[normal] font-semibold tracking-[-0.9px] max-md:text-[22px] max-md:leading-[29px] max-md:tracking-[-0.6px]`,children:`What should the agent work on?`}),(0,Q.jsx)(`p`,{"data-slot":`page-description`,className:`mt-2 hidden text-[13px] text-muted-foreground md:block`,children:`Describe the outcome. Configure the run. Review everything before it lands.`})]})}function KO({groupRef:e,compact:t,engine:n,accounts:r,draftEffort:i,update:a}){let o=n.runners.length>1||n.runners.some(e=>eO(r.accountChoices,e))?(0,Q.jsx)(qO,{engine:n,accounts:r,update:a},`runner`):null,s=(0,Q.jsx)(JO,{engine:n,draftEffort:i,update:a},`model`),c=(0,Q.jsx)(YO,{engine:n,update:a},`effort`);return(0,Q.jsx)(`div`,{ref:e,"data-slot":`agent-options`,role:`group`,"aria-label":`Agent settings`,className:`new-task-agent-options`,children:(0,Q.jsx)(Js,{children:t?[o,c,s]:[o,s,c]})})}function qO({engine:e,accounts:t,update:n}){return(0,Q.jsx)(Zs,{icon:(0,Q.jsx)(sa,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:e.runners,value:e.displayRunner,accounts:t.accountChoices,account:t.agentProfile,repoAccount:t.repoAccount,onPick:(t,r)=>n({runner:t,agentProfile:r,...t===e.displayRunner?{}:{model:null}}),disabled:!e.providersReady})}function JO({engine:e,draftEffort:t,update:n}){let{catalog:r,displayRunner:i}=e;return(0,Q.jsx)($s,{icon:(0,Q.jsx)(Ea,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:e.models.find(t=>t.id===e.model)?.label??`auto`,value:e.model,disabled:!e.providersReady,readOnly:e.modelsLocked,disabledHint:e.modelsLocked?`Model selection is locked to native coding-agent settings.`:void 0,onPick:e=>{let i=Is(e,r.data);n({model:e,effort:t===null?null:Rs(t,i)})},options:e.models.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Vs(i,e.registered.data,r)})}function YO({engine:e,update:t}){return(0,Q.jsx)($s,{icon:(0,Q.jsx)(la,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:e.effortOptions.find(t=>t.value===e.effort)?.label??`auto`,value:e.effort,disabled:!e.providersReady,readOnly:e.modelsLocked,disabledHint:e.modelsLocked?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:e=>t({effort:e}),options:e.effortOptions.map(e=>({value:e.value,label:e.label,desc:e.desc}))})}function XO({engine:e,draft:t,update:n,repo:r,hasGit:i,runMode:a,webhook:o,completionDisabled:s}){let{displayRunner:c}=e,l=Oi().data;return(0,Q.jsxs)(`details`,{"data-slot":`execution-options`,open:!0,className:`group rounded-xl border border-border bg-card xl:self-start`,children:[(0,Q.jsxs)(`summary`,{className:`flex min-h-[44px] cursor-pointer list-none flex-wrap items-center gap-x-2 gap-y-1 px-3 py-2 text-xs text-muted-foreground pointer-hover:bg-muted/50 active:bg-muted/50 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground [&::-webkit-details-marker]:hidden`,children:[(0,Q.jsx)(na,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:`Execution settings`}),(0,Q.jsxs)(`span`,{"data-slot":`execution-summary`,hidden:!0,className:`min-w-0 basis-full truncate pl-5 xl:ml-auto xl:basis-auto xl:pl-0`,children:[Ei(l,c),` · `,e.models.find(t=>t.id===e.model)?.label??`auto`]}),(0,Q.jsx)(ua,{"aria-hidden":`true`,className:`new-task-settings-chevron size-4 shrink-0`})]}),(0,Q.jsxs)(`div`,{className:`new-task-settings-body`,children:[(0,Q.jsx)(`p`,{className:`new-task-settings-description`,children:`Control this run and what happens after Done.`}),(0,Q.jsxs)(`div`,{role:`group`,"aria-label":`Run settings`,className:`new-task-run-settings`,children:[i?(0,Q.jsx)(QO,{on:a.worktree,onChange:e=>n({worktree:e})}):null,(0,Q.jsx)(tk,{repo:r}),(0,Q.jsx)($O,{on:a.autonomous,disabled:t.planFirst,onChange:e=>n({autonomous:e})}),o.targets.length>0?(0,Q.jsx)(ek,{on:o.on,targets:o.targets,onChange:o.onChange}):null]}),(0,Q.jsx)(HO,{embedded:!0,archiveWhenDone:t.archiveWhenDone,autoMergePr:t.autoMergePr,onChange:n,disabled:s}),(0,Q.jsx)(WO,{embedded:!0,allowWorkers:t.allowWorkers,allowMessaging:t.allowMessaging,onChange:n,disabled:s})]})]})}function ZO({showConfigureProviders:e,planFirst:t,planning:n,onModeChange:r}){return(0,Q.jsxs)(Q.Fragment,{children:[e?(0,Q.jsx)(Y,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,Q.jsx)(rk,{planFirst:t,planning:n,onModeChange:r}),(0,Q.jsx)(`kbd`,{"aria-hidden":`true`,className:`hidden rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground md:inline`,children:oE()})]})}function QO({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,Q.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"aria-label":`Worktree`,"data-slot":`worktree-toggle`,onClick:()=>r(!e),title:t?n:e?`Runs in an isolated worktree — uncheck to run in the repo working tree`:`Runs in the repo working tree — check to isolate in a worktree`,className:`flex items-center justify-between gap-3 px-0 py-3 text-left`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Worktree`}),(0,Q.jsx)(`span`,{className:`block text-[12px] text-muted-foreground`,children:e?`Changes stay in a separate working copy.`:`Changes are made in the current working directory.`})]}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:C(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,Q.jsx)(`span`,{className:C(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function $O({on:e,disabled:t,onChange:n}){return(0,Q.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"aria-label":`Autonomous`,"data-slot":`autonomous-toggle`,onClick:()=>n(!e),title:t?`Plan-first runs are interactive — autonomous is unavailable`:e?`Autonomous — the agent runs to completion without pausing for you`:`Runs interactively — check to let the agent finish without pausing for you`,className:`flex items-center justify-between gap-3 px-0 py-3 text-left disabled:opacity-50`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Autonomous`}),(0,Q.jsx)(`span`,{className:`block text-[12px] text-muted-foreground`,children:`Let the agent proceed without prompts`})]}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:C(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,Q.jsx)(`span`,{className:C(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function ek({on:e,targets:t,onChange:n}){return(0,Q.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"aria-label":`Notify webhook`,"data-slot":`notify-webhook-toggle`,onClick:()=>n(!e),title:`${e?`Status changes go to`:`Check to send this task's status changes to`} ${rO(t)} (${t.map(e=>tO(e.url)).join(`, `)})`,className:`flex min-h-11 items-center justify-between gap-3 px-0 py-3 text-left`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Notify webhook`}),(0,Q.jsx)(`span`,{"data-slot":`notify-webhook-subtitle`,className:`block truncate text-[12px] text-muted-foreground`,children:`Send status changes`})]}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:C(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,Q.jsx)(`span`,{className:C(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function tk({repo:e}){return(0,Q.jsxs)(`div`,{"data-slot":`base-branch-row`,className:`new-task-base-branch flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:`Base branch`}),e?(0,Q.jsx)(nk,{repo:e}):null]})}function nk({repo:e}){let t=I(),n=H({mutationFn:e=>jt({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:U.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,Q.jsx)($s,{searchPlaceholder:`Search branches…`,slot:`base-pill`,ariaLabel:`Base branch`,label:(0,Q.jsx)(`span`,{className:`text-[11px]`,children:e.baseBranch??e.info.branch}),value:e.baseBranch??``,onPick:e=>n.mutate(e===``?null:e),options:[{value:``,label:`follow checked-out branch (${e.info.branch})`,desc:`New task worktrees fork from whatever branch is checked out`},...e.branches.map(e=>({value:e,label:e}))]}):null}function rk({planFirst:e,planning:t,onModeChange:n}){return(0,Q.jsxs)(`div`,{"data-slot":`mode-seg`,role:`radiogroup`,"aria-label":`Run mode`,className:`inline-flex items-center gap-0.5 rounded-lg bg-muted p-[3px]`,children:[(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":!e,onClick:()=>n(!1),className:C(`h-6 rounded-md px-2 text-xs transition-colors`,e?`font-medium text-muted-foreground hover:text-foreground`:`bg-card font-semibold text-foreground shadow-xs`),children:[e?null:(0,Q.jsx)(Qi,{"aria-hidden":`true`,className:`size-3.5`}),`Start`]}),(0,Q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-busy":t||void 0,"data-slot":`mode-plan`,onClick:()=>n(!0),className:C(`h-6 rounded-md px-2 text-xs transition-colors`,e?`bg-contrast font-semibold text-contrast-foreground ring-2 ring-ring/55`:`font-medium text-muted-foreground hover:text-foreground`,t&&`animate-pulse`),children:t?`Planning…`:`Plan first`})]})}function ik({plan:e,starting:t,startAvailable:n,startUnavailableReason:r,startUnavailableAction:i,onStepsChange:a,onStart:o,onDiscard:s}){let[c,l]=(0,Z.useState)(null),[u,d]=(0,Z.useState)(null),f=(0,Z.useRef)(null),p=(0,Z.useId)();(0,Z.useEffect)(()=>{f.current?.focus({preventScroll:!0});let e=f.current?.closest(`[data-slot="main"]`);e&&(e.scrollTop=0)},[]);let m=()=>{l(null),d(null)},h=(t,n)=>{t.preventDefault(),c!==null&&c!==n&&a(xO(e.steps,c,n)),m()},g=e.steps.length===0;return(0,Q.jsxs)(`div`,{"data-slot":`plan-page`,children:[(0,Q.jsxs)(`header`,{"data-slot":`plan-page-header`,children:[(0,Q.jsx)(`h1`,{children:`New task / Plan first`}),(0,Q.jsx)(`p`,{children:`Review the proposed chain before launching.`})]}),(0,Q.jsx)(`div`,{"data-slot":`plan-canvas`,children:(0,Q.jsxs)(`section`,{ref:f,tabIndex:-1,"aria-labelledby":p,"data-slot":`plan-review`,className:`flex flex-col outline-none`,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||e.target.closest(`[role="dialog"], [role="alertdialog"]`)||(e.preventDefault(),s())},children:[(0,Q.jsxs)(`header`,{"data-slot":`dialog-header`,className:`flex flex-col gap-1 px-5 pt-4 pb-3.5 text-left`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsx)(`h2`,{id:p,"data-slot":`dialog-title`,className:`text-[11px] font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:`Proposed chain`}),(0,Q.jsx)(`button`,{type:`button`,onClick:s,"aria-label":`Discard the plan`,className:`-mt-1 -mr-1 rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,Q.jsx)(ra,{"aria-hidden":`true`,className:`size-4`})})]}),(0,Q.jsx)(`p`,{"data-slot":`plan-task`,title:e.task,className:`text-[18px] font-medium text-foreground`,children:CO(e.task)}),e.fallback?(0,Q.jsx)(`p`,{"data-slot":`plan-fallback`,className:`text-xs text-soft-foreground italic`,children:`planner unavailable — single-step plan`}):e.rationale===``?null:(0,Q.jsx)(`p`,{"data-slot":`plan-rationale`,className:`text-xs text-muted-foreground`,children:e.rationale})]}),(0,Q.jsx)(`ol`,{"data-slot":`plan-steps`,className:`flex-1 space-y-2 overflow-y-auto px-5 py-4`,children:g?(0,Q.jsx)(`li`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`(no steps left — discard and plan again)`}):e.steps.map((t,n)=>(0,Q.jsxs)(`li`,{"data-slot":`plan-step`,"data-step-id":t.id,draggable:!0,onDragStart:()=>l(n),onDragOver:e=>{e.preventDefault(),d(n)},onDragLeave:()=>d(e=>e===n?null:e),onDrop:e=>h(e,n),onDragEnd:m,className:C(`flex items-center gap-2.5 rounded-lg border border-border bg-card-2 px-3 py-2.5`,c===n&&`opacity-50`,u===n&&c!==null&&c!==n&&`border-ring`),children:[(0,Q.jsx)(Vi,{"aria-hidden":`true`,className:`size-3.5 shrink-0 cursor-grab text-soft-foreground`}),(0,Q.jsx)(`span`,{className:`w-5 shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:String(n+1).padStart(2,`0`)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium`,children:t.name??t.id}),t.skill?(0,Q.jsx)(`span`,{"data-slot":`plan-badge-skill`,title:`skill`,className:`shrink-0 rounded-full bg-accent-strong/15 px-1.5 py-px font-mono text-[11px] font-medium text-accent-text`,children:t.skill}):null,t.command?(0,Q.jsx)(`span`,{"data-slot":`plan-badge-check`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[11px] font-medium text-muted-foreground`,children:`check`}):null]}),(0,Q.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap break-words font-mono text-[11px] text-muted-foreground`,children:SO(t)})]}),(0,Q.jsxs)(`span`,{"data-slot":`plan-step-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(k,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-up`,"aria-label":`Move step ${n+1} up`,disabled:n===0,className:`size-7 text-muted-foreground`,onClick:()=>a(xO(e.steps,n,n-1)),children:`Move up`}),(0,Q.jsx)(k,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-down`,"aria-label":`Move step ${n+1} down`,disabled:n===e.steps.length-1,className:`size-7 text-muted-foreground`,onClick:()=>a(xO(e.steps,n,n+1)),children:`Move down`}),(0,Q.jsx)(k,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-remove`,"aria-label":`Remove step ${n+1}`,className:`size-7 text-muted-foreground hover:text-danger`,onClick:()=>a(bO(e.steps,n)),children:`Remove`})]})]},t.id))}),!n&&r?(0,Q.jsxs)(`p`,{id:`plan-start-guidance`,className:`flex flex-wrap items-center gap-1.5 border-t border-border px-5 pt-3 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:r}),i]}):null,(0,Q.jsxs)(`div`,{"data-slot":`plan-actions`,className:`flex flex-wrap items-center gap-3 px-6 pt-3 pb-6`,children:[(0,Q.jsxs)(k,{type:`button`,"data-slot":`plan-start`,disabled:g||t||!n,title:n?void 0:r,"aria-describedby":!n&&r?`plan-start-guidance`:void 0,onClick:o,children:[(0,Q.jsx)(Ya,{"aria-hidden":`true`,className:`size-3.5`}),t?`Starting…`:`Start`]}),(0,Q.jsx)(ak,{steps:e.steps,disabled:g}),(0,Q.jsx)(k,{type:`button`,variant:`outline`,onClick:s,children:`Discard`})]}),(0,Q.jsx)(`p`,{className:`px-6 pb-6 text-xs text-muted-foreground`,children:`No steps left? Start is disabled. A planner failure shows a single-step fallback.`})]})})]})}function ak({steps:e,disabled:t}){let n=I(),[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),d=async t=>{let r=a.trim();if(!(r===``||l)){u(!0);try{let a=await le({name:r,steps:e,...t?{overwrite:!0}:{}});G(`Saved — ${a.path.split(`/`).pop()??a.path}`),n.invalidateQueries({queryKey:U.workflows}),c(!1),i(!1),o(``)}catch(e){e instanceof et&&e.exists===!0?c(!0):G(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{u(!1)}}};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{type:`button`,variant:`outline`,"data-slot":`plan-save`,disabled:t,onClick:()=>i(!0),children:`Save as chain`}),(0,Q.jsx)(es,{open:r,onOpenChange:e=>i(!!e),children:(0,Q.jsxs)(Qo,{"data-slot":`plan-save-dialog`,className:`sm:max-w-sm`,showCloseButton:!1,children:[(0,Q.jsxs)(Zo,{children:[(0,Q.jsx)($o,{children:`Save as chain`}),(0,Q.jsx)(Yo,{children:`Saves these steps as a reusable workflow — it joins the picker like any other chain.`})]}),(0,Q.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d(!1)},children:[(0,Q.jsx)(`label`,{htmlFor:`plan-chain-name`,className:`mb-2 block text-[11px] text-muted-foreground`,children:`Chain name`}),(0,Q.jsx)(rh,{id:`plan-chain-name`,value:a,onChange:e=>o(e.target.value),"aria-label":`Chain name`,placeholder:`e.g. fix-and-verify-v2`,maxLength:80,autoFocus:!0}),(0,Q.jsxs)(Jo,{className:`mt-4`,children:[(0,Q.jsx)(k,{type:`button`,variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,Q.jsx)(k,{type:`submit`,disabled:a.trim()===``||l,children:l?`Saving…`:`Save chain`})]})]})]})}),(0,Q.jsx)(eS,{open:s,onOpenChange:e=>e?void 0:c(!1),children:(0,Q.jsxs)(rS,{"data-slot":`plan-overwrite-dialog`,children:[(0,Q.jsxs)(iS,{children:[(0,Q.jsxs)(oS,{children:[`Overwrite “`,a.trim(),`”?`]}),(0,Q.jsx)(sS,{children:`A chain with this name already exists. Overwriting replaces its steps with this plan.`})]}),(0,Q.jsxs)(aS,{children:[(0,Q.jsx)(lS,{children:`Cancel`}),(0,Q.jsx)(cS,{onClick:()=>void d(!0),children:`Overwrite chain`})]})]})})]})}var ok={start:{note:`Start immediately with the selected configuration.`,pendingLabel:`Starting task…`,failureHint:void 0,clearOnSuccess:!0,sendAriaLabel:`Start task`},plan:{note:`Review the plan before starting the task.`,pendingLabel:`Planning task…`,failureHint:`Could not create the plan. Your draft is kept. Please retry.`,clearOnSuccess:!1,sendAriaLabel:`Plan task`}};function sk(){let[e]=o(),t=(0,Z.useRef)(null),n=(0,Z.useRef)(null),r=(0,Z.useRef)(null),{projectId:i}=s(),a=Mt().projectId,c=Oi().data,[l]=(0,Z.useState)(()=>e.toString()),[u]=(0,Z.useState)(()=>B_(l,c)),d=B_(l,c).runner,f=lr(),p=mn(),m=ur(),h=rr(),{draft:g,update:_,clearStarted:v,submissionPending:y,mounted:b}=DO(a,u,d),x=AO(g,m),S=jO(x.displayRunner,g.agentProfile),C=OO(g.source,p,x.displayRunner,S.agentProfile),{source:w,sourcesReady:T,skillList:E}=C,D=PO(i),O=kO({uiState:p,source:w,sourcesReady:T,draftText:g.text,submissionPending:y,update:_});MO(x.providersReady);let k=f.data===void 0||f.data.info!==null,A=NO({hasGit:k,draft:g,selectedSkill:C.selectedSkill,workspaceConfig:h,source:w}),{plan:j,setPlan:M,planning:ee,starting:te,submit:ne,startPlanned:re}=VO({draft:g,draftProjectId:a,engine:x,agentProfile:S.agentProfile,accountsSettled:S.accountsSettled,sourcesReady:T,source:w,runMode:A,notifyOn:D.notifyOn,uiState:p,mounted:b,clearStarted:v});IO({deepLink:u,search:e,sourcesReady:T&&C.skillsSettled&&!x.providers.isPending&&S.accountsSettled,listUnchecked:C.listUnchecked,skillList:E,update:_});let ie=FO(t),{providers:N,providersReady:P}=x,F=g.planFirst?ok.plan:ok.start,ae=zO(N);return(0,Q.jsxs)(`div`,{"data-route":`new`,"data-plan-review":j===null?void 0:`true`,className:`relative isolate flex min-h-full flex-col overflow-x-clip pb-16`,children:[(0,Q.jsxs)(`div`,{"data-slot":`new-task-layout`,ref:r,style:j===null?void 0:{display:`none`},className:`relative z-[1] mx-auto w-full max-w-none px-11 pt-12 max-md:px-[18px] max-md:pt-[22px]`,children:[(0,Q.jsx)(GO,{}),(0,Q.jsx)(KD,{ref:n,onSubmit:ne,retainDraftUntilSuccess:!0,idleFeedback:(0,Q.jsxs)(`div`,{"data-slot":`new-task-mode-note`,className:`flex items-center justify-between gap-3 text-[11px] text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:F.note}),(0,Q.jsx)(`kbd`,{className:`hidden font-sans md:inline`,children:oE()})]}),pendingLabel:F.pendingLabel,failureHint:F.failureHint,clearOnSuccess:F.clearOnSuccess,onPendingChange:e=>{y.current=e},value:g.text,onValueChange:e=>_({text:e}),autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:F.sendAriaLabel,disabled:!P||te,disabledReason:ae,autocompleteSkills:!0,skillRunner:x.displayRunner,skillAccount:S.agentProfile,footerStart:(0,Q.jsx)(ck,{projects:D.projectList,urlProjectId:i,templates:O,onInsertTemplate:e=>n.current?.insertAtCaret(e),sources:C,onPickSource:e=>_({source:e})}),agentOptions:(0,Q.jsx)(KO,{groupRef:t,compact:ie,engine:x,accounts:S,draftEffort:g.effort,update:_}),executionOptions:(0,Q.jsx)(XO,{engine:x,draft:g,update:_,repo:f.data,hasGit:k,runMode:A,webhook:{targets:D.webhookTargets,on:D.notifyOn,onChange:D.setNotifyChoice},completionDisabled:te||ee}),footerEnd:(0,Q.jsx)(ZO,{showConfigureProviders:!P&&!N.isPending,planFirst:g.planFirst,planning:ee,onModeChange:e=>_({planFirst:e})})}),(0,Q.jsx)(`p`,{"data-slot":`run-mode-note`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:sO({worktree:A.worktree,hasGit:k})})]}),j===null?null:(0,Q.jsx)(ik,{plan:j,starting:te,startAvailable:P,startUnavailableReason:ae,startUnavailableAction:N.isPending?void 0:(0,Q.jsx)(Y,{to:`/settings/agents#providers`,children:`Configure providers`}),onStepsChange:e=>M(t=>t&&{...t,steps:e}),onStart:()=>void re(),onDiscard:()=>{M(null),requestAnimationFrame(()=>r.current?.querySelector(`textarea`)?.focus())}})]})}function ck({projects:e,urlProjectId:t,templates:n,onInsertTemplate:r,sources:i,onPickSource:a}){let o=gs();return(0,Q.jsxs)(Q.Fragment,{children:[e.length>1&&t!==void 0?(0,Q.jsx)(uk,{projects:e,projectId:t,onPick:e=>o(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}):null,(0,Q.jsx)(fs,{label:`Template`,templates:n,onInsert:r}),(0,Q.jsx)(vk,{source:i.source,unchecked:i.unchecked,ready:i.sourcesReady,skills:i.skillList,skillUsage:i.skillUsage,workflows:i.workflowList,onPick:a})]})}function lk(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 uk({projects:e,projectId:t,onPick:n}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(``),{order:s}=Iv(),c=e.find(e=>e.id===t),l=lk(Nv(e,s),a);return(0,Q.jsxs)(fi,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,Q.jsx)(li,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`project-pill`,"aria-label":`Project`,title:`Which project this task runs in — its skills, workflows, settings and draft`,className:C(Ls,`border-foreground/60 font-semibold text-foreground`),children:[(0,Q.jsx)(Fi,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,Q.jsx)(`span`,{className:`max-w-40 truncate`,children:c?.name??t}),Us]})}),(0,Q.jsx)(Qr,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(Gs,{shouldFilter:!1,children:[(0,Q.jsx)(js,{placeholder:`search projects…`,value:a,onValueChange:o}),(0,Q.jsxs)(Os,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,Q.jsx)(Ws,{children:`Nothing matches.`}):null,l.map(e=>(0,Q.jsxs)(Ns,{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,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,Q.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground`,children:e.branch}),e.id===t?(0,Q.jsx)(Qi,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.id))]}),(0,Q.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 dk(e,t,n){return!e&&(t.ranked?t.ranked.length===0:t.mostUsed.length===0&&t.project.length===0&&t.global.length===0)&&n.length===0}function fk(e,t){return bc(`no skill`,`none plain ${Xs} ${e?.description??``}`,t)>0}function pk({source:e,ready:t,offersWorkflows:n,onPick:r,skillLabel:i}){let a=e===null||e.source===`skill`?xa:Ca;return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`source-pill`,"data-source-kind":e?.source??`none`,"aria-label":`Choose a skill or workflow`,title:e===null?`No skill — the task runs as one plain agent step. Pick a skill or workflow to change that.`:`Runs the ${e.source} "${e.ref}" — pick it again, or press ✕, to run without it`,disabled:!t,onKeyDown:t=>{e===null||t.metaKey||t.ctrlKey||t.altKey||t.key!==`Backspace`&&t.key!==`Delete`||(t.preventDefault(),r(null))},className:C(Ls,`font-mono text-[11px]`,e===null?`text-muted-foreground`:`rounded-r-none border-r-0 border-foreground/60 pr-1.5 font-semibold text-foreground`),children:[(0,Q.jsx)(a,{"aria-hidden":`true`,className:C(`size-3 shrink-0`,e===null?`text-muted-foreground`:`text-accent-icon`)}),(0,Q.jsx)(`span`,{className:`max-w-44 truncate`,children:t?i??e?.ref??(n?`Skill or workflow`:`Skill`):`…`}),Us]})}function mk({source:e,quickTask:t,onPick:n}){return(0,Q.jsx)(As,{children:(0,Q.jsxs)(Ns,{value:`none no-skill`,keywords:[`none`,`plain`,...Ec(Xs)],"data-slot":`source-option`,"data-source-kind":`none`,onSelect:()=>n(null),children:[(0,Q.jsx)(aa,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:`No skill`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t?.description??`One agent run on your task — no ceremony.`}),e===null?(0,Q.jsx)(Qi,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]})})}function hk({ranked:e,mostUsed:t,project:n,skillItem:r}){return(0,Q.jsx)(Q.Fragment,{children:e?e.length>0?(0,Q.jsx)(As,{children:e.map(e=>r(e,Cc(e)))}):null:(0,Q.jsxs)(Q.Fragment,{children:[t.length>0?(0,Q.jsx)(As,{heading:`Most used`,children:t.map(e=>r(e,Cc(e)))}):null,n.length>0?(0,Q.jsx)(As,{heading:`Project skills`,children:n.map(e=>r(e,!0))}):null]})})}function gk({source:e,matchedWorkflows:t,toggle:n}){return t.length>0?(0,Q.jsx)(As,{heading:`Workflows`,children:t.map(t=>{let r=e?.source===`workflow`&&e.ref===t.name;return(0,Q.jsxs)(Ns,{value:`workflow ${t.name}`,keywords:Ec(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>n({source:`workflow`,ref:t.name}),children:[(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:t.name}),t.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,r?(0,Q.jsx)(Qi,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},t.name)})}):null}function _k({global:e,skillItem:t}){return e.length>0?(0,Q.jsx)(As,{heading:`Global`,children:e.map(e=>t(e,!1))}):null}function vk({source:e,unchecked:t,ready:n,skills:r,skillUsage:i,workflows:a,onPick:o}){let[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(null),p=(0,Z.useRef)(null),{mostUsed:m,project:h,global:g,ranked:_}=kc(r,l,i),v=a.find(e=>e.name===Xs),y=xc(a,l).filter(e=>e.name!==Xs),b=a.some(e=>e.name!==Xs),x=fk(v,l),S=dk(x,{ranked:_,mostUsed:m,project:h,global:g},y),w=e=>{o(e),c(!1)},T=t=>w(e?.source===t.source&&e.ref===t.ref&&(e.source!==`skill`||t.source!==`skill`||e.path===t.path)?null:t),E=(t,n)=>{let r=e?.source===`skill`&&e.ref===t.id&&e.path===t.path;return(0,Q.jsxs)(Ns,{value:Sc(t),keywords:Ec(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.id,onSelect:()=>T({source:`skill`,ref:t.id,...t.path===void 0?{}:{path:t.path}}),children:[(0,Q.jsx)(iT,{skill:t,emphasized:n}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`source-skill-view`,"aria-label":`View skill ${t.name}`,title:`View skill`,onClick:e=>{e.preventDefault(),e.stopPropagation(),f(t)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Q.jsx)(Ua,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,Q.jsx)(Qi,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},Sc(t))},D=pk({source:e,ready:n,offersWorkflows:b,onPick:o,skillLabel:e?.source===`skill`?r.find(t=>t.id===e.ref&&(e.path===void 0||e.path===t.path))?.name:void 0});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(QD,{skill:d,onClose:()=>f(null)}),(0,Q.jsxs)(fi,{open:s,onOpenChange:e=>{c(e),e||u(``)},children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,Q.jsx)(li,{asChild:!0,children:D}),e?.source===`skill`&&t?(0,Q.jsx)(`span`,{role:`status`,children:`Unchecked`}):null,e!==null&&n?(0,Q.jsx)(`button`,{type:`button`,"data-slot":`source-pill-clear`,"aria-label":`Clear the ${e.source} ${e.ref}`,title:`Run without it`,onClick:()=>o(null),className:C(Ls,`rounded-l-none border-foreground/60 pl-1.5 pr-2 text-soft-foreground hover:text-foreground`),children:(0,Q.jsx)(ra,{"aria-hidden":`true`,className:`size-3`})}):null]}),(0,Q.jsx)(Qr,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(Gs,{shouldFilter:!1,children:[(0,Q.jsx)(js,{placeholder:`search skills & workflows…`,value:l,onValueChange:u,onInput:()=>p.current?.scrollTo(0,0)}),(0,Q.jsxs)(Os,{ref:p,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.trim()&&!r.some(e=>e.id===l.trim())?(0,Q.jsx)(As,{children:(0,Q.jsxs)(Ns,{value:`typed-skill`,onSelect:()=>w({source:`skill`,ref:l.trim(),typed:!0}),children:[`Use skill id “`,l.trim(),`” (unchecked)`]})}):null,S?(0,Q.jsx)(Ws,{children:`Nothing matches.`}):null,x?(0,Q.jsx)(mk,{source:e,quickTask:v,onPick:w}):null,(0,Q.jsx)(hk,{ranked:_,mostUsed:m,project:h,skillItem:E}),(0,Q.jsx)(gk,{source:e,matchedWorkflows:y,toggle:T}),(0,Q.jsx)(_k,{global:g,skillItem:E})]})]})})]})]})}function yk(){return(0,Q.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(X,{icon:(0,Q.jsx)(lu,{}),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,Q.jsx)(k,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(Y,{to:`/`,children:`Back to tasks`})})})})}function bk(){return(0,Q.jsx)(`div`,{className:`px-[18px] pt-2 md:hidden`,children:(0,Q.jsxs)(Y,{to:`/git`,"data-slot":`git-back`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,Q.jsx)(_a,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to Git`]})})}function xk(){let{pathname:e,search:t}=a();return(0,Q.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[bs(e)!==`/git`||new URLSearchParams(t).get(`view`)===`repo`?(0,Q.jsx)(bk,{}):null,(0,Q.jsx)(X,{icon:(0,Q.jsx)(Wa,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})]})}function Sk(){return(0,Q.jsxs)(`div`,{"data-route":`skills`,"aria-busy":`true`,className:`mx-auto min-h-full w-full max-w-[1100px] px-[18px] py-6 md:p-9`,children:[(0,Q.jsx)(`h1`,{className:`text-[25px] font-semibold tracking-tight md:text-[30px]`,children:`Skills`}),(0,Q.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`The skills each agent loads in this project, as its runner reports them.`}),(0,Q.jsx)(`p`,{"data-slot":`skills-loading`,role:`status`,className:`mt-6 text-xs text-muted-foreground`,children:`Loading skills…`}),(0,Q.jsxs)(`div`,{"aria-hidden":`true`,className:`mt-4 flex flex-col gap-[22px] motion-safe:animate-pulse`,children:[(0,Q.jsx)(`div`,{className:`h-11 rounded-lg border border-border bg-card`}),(0,Q.jsx)(`div`,{className:`h-80 rounded-xl border border-border bg-card`})]})]})}function Ck({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,Q.jsx)(`div`,{"data-route":`unknown-project`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(X,{icon:(0,Q.jsx)(xu,{}),tone:`neutral`,title:`“${e}” isn’t registered here`,subtitle:`This Squawk doesn’t serve a project by that id. The link may come from another machine’s workspace — these are the projects registered on this one:`,children:(0,Q.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,Q.jsx)(`li`,{children:(0,Q.jsxs)(E,{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,Q.jsxs)(`span`,{className:`font-mono text-[11px] font-normal text-soft-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function wk(){return(0,Q.jsxs)(`div`,{"data-route":`workflows`,"aria-busy":`true`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,Q.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`Workflows`}),(0,Q.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`Portable skill chains. Steps run from top to bottom.`}),(0,Q.jsx)(`p`,{"data-slot":`workflows-loading`,role:`status`,className:`mt-6 text-xs text-muted-foreground`,children:`Loading workflows…`}),(0,Q.jsxs)(`div`,{"aria-hidden":`true`,className:`mt-4 flex flex-col gap-[22px] motion-safe:animate-pulse`,children:[(0,Q.jsx)(`div`,{className:`h-11 rounded-lg border border-border bg-card`}),(0,Q.jsx)(`div`,{className:`h-80 rounded-xl border border-border bg-card`})]})]})}function Tk({tab:e}){return(0,Q.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(X,{icon:(0,Q.jsx)(Wa,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:e===`changes`?`Loading changes…`:`Loading files…`,subtitle:`Fetching the run record.`})})}function Ek({tab:e,error:t}){let n=t instanceof et&&t.status===404;return(0,Q.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(X,{icon:n?(0,Q.jsx)(no,{}):(0,Q.jsx)(ma,{size:16}),tone:n?`neutral`:`danger`,title:n?`Task not found`:`Could not load this task`,subtitle:n?`No run has this id. It may have been deleted, or the link is from another machine.`:t.message,actions:(0,Q.jsx)(k,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(Y,{to:`/`,children:`Back to tasks`})})})})}var Dk={issue:`issue`,pr:`pull request`};function Ok({kind:e,number:t,heading:n=`h1`}){let r=(0,Q.jsx)(`div`,{"data-slot":`task-github-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,Q.jsx)(X,{icon:(0,Q.jsx)(Wa,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:n,title:`Loading ${Dk[e]}${t===void 0?``:` #${t}`}…`,subtitle:t===void 0?`Fetching the run record.`:`Asking GitHub.`})});return n===`h2`?r:(0,Q.jsx)(`div`,{"data-route":`task-github-item`,className:`flex min-h-full flex-col`,children:r})}function kk(){return(0,Q.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(X,{icon:(0,Q.jsx)(Wa,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}async function Ak(e,t,n,r,i){try{return await Ml(e,{queryKey:[t,`runs`,`artifact-metadata`,n,r],queryFn:({signal:e})=>Ve(n,r,{signal:e})},i),!0}catch(e){if(e instanceof et&&e.status===404)return!1;throw e}}async function jk(e,t,n,r,i,a){if(await Ak(e,t,n,r,i))return n;i.throwIfAborted();let o=await Ml(e,{queryKey:[t,`runs`,`relationships`,n],queryFn:({signal:e})=>ce(n,{signal:e})},i),s=new Set(o.workers.map(e=>e.workerId));a&&s.add(a),s.delete(n);for(let n of s){if(i.aborted)throw i.reason;if(await Ak(e,t,n,r,i))return n}throw new et(404,`Report missing or deleted`)}function Mk(e,t,n){let r=I(),i=c();return wr({queryKey:[i,`runs`,`report-source`,e,t,n],queryFn:({signal:a})=>jk(r,i,e,t,a,n),enabled:!!(e&&t),retry:!1})}function Nk(){let[e]=o(),t=a(),n=j(),r=d(),i=Z.useRef(Math.random()),s=Z.useRef({renderedKey:``,next:e,seq:0,latestSeq:0});return Z.useLayoutEffect(()=>{if(s.current.renderedKey===t.key)return;let n=t.state,a=n?.__writerSession===i.current?n.__writerSeq:void 0;r===`REPLACE`&&a!==void 0&&a<=s.current.latestSeq?(s.current.renderedKey=t.key,a===s.current.latestSeq&&(s.current.next=e)):s.current={renderedKey:t.key,next:e,seq:s.current.seq,latestSeq:0}},[e,t,r]),[e,Z.useCallback(e=>{let t=e(new URLSearchParams(s.current.next));if(t.toString()===s.current.next.toString())return;let r=s.current.seq+1;s.current={...s.current,next:t,seq:r,latestSeq:r},n({search:`?${t}`},{replace:!0,state:{__writerSession:i.current,__writerSeq:r}})},[n])]}var Pk=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Fk(e){let t=e.get(`report`);return!t||!Pk.test(t)||e.getAll(`report`).length!==1||e.getAll(`card`).length>1?null:{artifactId:t,card:e.get(`card`)||null}}var Ik=(0,Z.createContext)(null);function Lk(e){let t=a(),n=j(),[r,i]=Nk(),o=Fk(r),[s,c]=(0,Z.useState)(()=>({runId:e,entries:new Map}));s.runId!==e&&c({runId:e,entries:new Map});let l=(0,Z.useCallback)((t,n)=>(c(r=>{if(r.runId===e&&r.entries.get(t)===n)return r;let i=new Map(r.runId===e?r.entries:[]);return i.set(t,n),{runId:e,entries:i}}),()=>void 0),[e]),u=(0,Z.useRef)({runId:e,callbacks:new Map});u.current.runId!==e&&(u.current={runId:e,callbacks:new Map});let d=(0,Z.useCallback)((e,t)=>(u.current.callbacks.set(e,t),()=>{u.current.callbacks.get(e)===t&&u.current.callbacks.delete(e)}),[]),f=(0,Z.useMemo)(()=>({register:l,registerOpener:d}),[l,d]),p=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{r.has(`report`)&&!o&&i(e=>(e.delete(`report`),e.delete(`card`),e))},[r,o,i]),(0,Z.useEffect)(()=>{let n=p.current;!o&&n&&n.runId===e&&n.card&&u.current.callbacks.get(n.card)?.(n.artifactId,n.scrollTop),p.current=o?{...o,runId:e,scrollTop:t.state?.reportScrollTop}:null},[e,o,t.state]),{selection:o,sourceRunId:s.runId===e&&o?s.entries.get(o.artifactId)??(o.card?void 0:e):void 0,registry:f,close:()=>{let e=t.state,r=window.navigation;if(e?.reportReturnKey&&r){r.traverseTo(e.reportReturnKey);return}if(e?.reportReturnTo){n(e.reportReturnTo,{replace:!0});return}i(e=>(e.delete(`report`),e.delete(`card`),e))}}}var Rk=class extends Z.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){console.error(`Squawk cockpit: the preview pane crashed`,e,t.componentStack)}render(){return this.state.failed?(0,Q.jsxs)(`div`,{"data-slot":`preview-pane-error`,role:`alert`,className:`flex h-full flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:`The preview hit an error`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The task is unaffected. Close the preview and open it again.`}),(0,Q.jsx)(k,{variant:`outline`,onClick:this.props.onClose,children:`Close preview`})]}):this.props.children}},zk=`cez-preview-tasks`,Bk=`cez.preview.pane-width`,Vk=e=>Math.min(75,Math.max(30,Math.round(e)));function Hk(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Uk(e){if(!Hk(e))return;let{port:t,agent:n,url:r}=e;if(typeof t==`number`&&Number.isInteger(t)&&t>=1&&t<=65535)return{port:t};if(n===!0)return{agent:!0};if(typeof r==`string`&&/^https?:\/\//i.test(r))return{url:r}}function Wk(e){if(!Hk(e))return;let t=Uk(e.target),n=typeof e.percent==`number`&&Number.isFinite(e.percent)?e.percent:void 0;return{open:e.open===!0,...t?{target:t}:{},...n===void 0?{}:{percent:n},at:typeof e.at==`number`?e.at:0}}function Gk(){try{let e=localStorage.getItem(zk),t=e===null?null:JSON.parse(e);return Hk(t)?t:{}}catch{return{}}}function Kk(e){let t=Wk(Gk()[e]);if(!t)return;let{at:n,...r}=t;return r}function qk(e,t,n=Date.now()){let r=Gk(),i={open:!1,...Wk(r[e]),...t,at:n};for(let e of Object.keys(i))i[e]===void 0&&delete i[e];r[e]=i;let a=Object.keys(r);if(a.length>100){let e=e=>Wk(r[e])?.at??0;for(let t of a.sort((t,n)=>e(t)-e(n)).slice(0,a.length-100))delete r[t]}try{localStorage.setItem(zk,JSON.stringify(r))}catch{}}function Jk(){try{let e=Number(localStorage.getItem(Bk));return e>0?e:void 0}catch{return}}function Yk(e){let t=(e===void 0?void 0:Kk(e)?.percent)??Jk();return t===void 0?58:Vk(t)}function Xk(e,t){try{localStorage.setItem(Bk,String(t))}catch{}e!==void 0&&qk(e,{percent:t})}var Zk=`(min-width: 1180px)`,Qk=`(max-width: 767px)`;function $k(e,t){let[n,r]=(0,Z.useState)(()=>window.matchMedia?.(e).matches??t);return(0,Z.useEffect)(()=>{let t=window.matchMedia?.(e);if(!t)return;let n=()=>r(t.matches);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),n}var eA=(0,Z.lazy)(()=>W(()=>import(`./preview-pane-connected-DePVzNAm.js`).then(e=>({default:e.ConnectedPreviewPane})),__vite__mapDeps([6,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]))),tA=2;function nA(e){let[t,n]=(0,Z.useState)(void 0);return(0,Z.useEffect)(()=>{let t=e.current?.closest(`[data-slot="main"]`);if(!t)return;let r=()=>n(t.clientHeight||void 0);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function rA({run:e,state:t,children:n,report:r}){let i=$k(Zk,!0),a=$k(Qk,!1),o=(0,Z.useRef)(null),s=nA(o),{percent:c,setPercent:l}=t,u=!!r||t.open&&e!==void 0,d=u&&!i,f=!r&&t.session,p=d&&!f,m=d&&f,h=e=>{let t=o.current?.getBoundingClientRect();!t||t.width===0||l(Vk((t.right-e)/t.width*100))},g=e=>{e.currentTarget.setPointerCapture?.(e.pointerId)},_=e=>{e.currentTarget.hasPointerCapture?.(e.pointerId)&&h(e.clientX)},v=e=>{if(e.key===`ArrowLeft`)l(Vk(c+tA));else if(e.key===`ArrowRight`)l(Vk(c-tA));else return;e.preventDefault()},y={"--preview-pane":`${c}%`,...s===void 0?{}:{"--preview-h":`${s}px`}};return(0,Q.jsxs)(`div`,{ref:o,"data-slot":`task-split`,"data-pane":u?`open`:`closed`,"data-takeover":p?``:void 0,className:`preview-split flex min-h-full`,style:y,children:[(0,Q.jsx)(`div`,{"data-slot":`task-main`,hidden:p&&a,"data-collapsed":p&&!a?``:void 0,className:`min-w-0 flex-1`,children:n}),u?(0,Q.jsxs)(Q.Fragment,{children:[i?(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize preview`,"aria-valuemin":30,"aria-valuemax":75,"aria-valuenow":c,tabIndex:0,"data-slot":`preview-divider`,className:`preview-divider`,onPointerDown:g,onPointerMove:_,onKeyDown:v}):null,(0,Q.jsxs)(`aside`,{"data-slot":`preview-pane`,"data-phone":a?``:void 0,hidden:m,className:`preview-pane`,children:[r,(0,Q.jsx)(`div`,{hidden:!!r,className:`h-full`,children:t.open&&e?(0,Q.jsx)(Rk,{onClose:t.closePane,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`p`,{role:`status`,className:`p-6 text-sm text-muted-foreground`,children:`Opening the preview…`}),children:(0,Q.jsx)(eA,{run:e,servers:e.previewServers??[],request:t.request,onSession:p?t.showSession:void 0,onTarget:t.setTarget,onLive:t.setLive,onClose:t.closePane},e.id)})}):null})]})]}):null]})}function iA(e){if(!e.worktreePath||e.worktreeReclaimedAt)return!0;let t=e.delegation?.role===`worker`?e.delegation.destroy:void 0;return t!==void 0&&!t.remaining.includes(`worktree`)}function aA(e){let{state:t,server:n}=e,r=Ga(e.stateAt);switch(t){case`registered`:return n.answeredAtRegistration?{tone:`neutral`,ring:!1,pulse:!1,text:`was running when registered`}:{tone:`neutral`,ring:!0,pulse:!1,text:`registered · not started`};case`adopted`:return{tone:`neutral`,ring:!1,pulse:!1,text:`was running when registered`};case`starting`:return{tone:`pending`,ring:!1,pulse:!0,text:`starting`};case`up`:return{tone:`success`,ring:!1,pulse:!1,text:r?`up · ${r}`:`up`};case`stalled`:return{tone:`pending`,ring:!1,pulse:!1,text:`stalled · port silent 2 min`};case`exited`:return{tone:`danger`,ring:!1,pulse:!1,text:e.exitCode===void 0?`exited`:`exited · code ${e.exitCode}`};case`stopped`:return{tone:`neutral`,ring:!0,pulse:!1,text:e.reason===`idle`?`stopped after 15 min idle`:`stopped`};case`unavailable`:return{tone:`neutral`,ring:!0,pulse:!1,text:`unavailable`}}}function oA(e){return{kind:`preview-server`,id:`preview-server:${e.port}`,server:e,state:`registered`,stateAt:e.registeredAt}}function sA(e,t){return t?.get(e.port)??oA(e)}function cA(e){return e.state===`registered`?e.server.answeredAtRegistration:e.state===`up`||e.state===`starting`||e.state===`adopted`}function lA(e){return e.split(` -- `)[0].trim()}var uA=(0,Z.createContext)(null);function dA(){return(0,Z.useContext)(uA)}var fA=e=>e&&`port`in e?e.port:void 0;function pA(){return typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 1180px)`).matches}function mA(e){let t=e===void 0?void 0:Kk(e),n=t?.open===!0,r=n?t.target:void 0;return{open:n,target:r,request:n?{...r,restored:!0}:void 0,session:n&&!pA(),percent:Yk(e)}}function hA(e,t=!1){let[n]=(0,Z.useState)(()=>mA(e)),[r,i]=(0,Z.useState)(n.open),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(n.target),[l,u]=(0,Z.useState)(n.session),[d,f]=(0,Z.useState)(n.request),[p,m]=(0,Z.useState)(n.percent),[h,g]=(0,Z.useState)(e),_=(0,Z.useRef)(r);if(_.current=r,h!==e){let t=mA(e);g(e),i(t.open),o(!1),c(t.target),u(t.session),f(t.request),m(t.percent)}t&&r&&d?.restored&&(i(!1),c(void 0),f(void 0),u(!1));let v=(0,Z.useCallback)(t=>{e!==void 0&&qk(e,t)},[e]),y=(0,Z.useCallback)(e=>{f({...e});let t=e.port===void 0?e.agent?{agent:!0}:void 0:{port:e.port};u(!1),i(!0),t?(c(t),v({open:!0,target:t})):_.current?v({open:!0}):(c(void 0),v({open:!0,target:void 0}))},[v]),b=(0,Z.useCallback)(()=>{i(!1),o(!1),u(!1),c(void 0),v({open:!1})},[v]),x=(0,Z.useCallback)(e=>{c(e),v({target:e})},[v]),S=(0,Z.useCallback)(t=>{m(t),Xk(e,t)},[e]),C=(0,Z.useCallback)(()=>u(!0),[]),w=fA(s);return(0,Z.useMemo)(()=>({open:r,live:a,port:w,target:s,percent:p,request:d,session:l,openPane:y,closePane:b,showSession:C,setLive:o,setTarget:x,setPercent:S}),[r,a,w,s,p,d,l,y,b,C,x,S])}function gA(e,t={}){let[n,r]=(0,Z.useState)([]),{cursor:i,afterSeq:a=0,maxEvents:o,compactAt:s,onCompact:l,onReset:u}=t;return(0,Z.useEffect)(()=>{if(r([]),!e)return;let t=a,n=!1,d=!1,f=c(),p=[],m,h,g=()=>{if(m!==void 0&&globalThis.cancelAnimationFrame?.(m),clearTimeout(h),m=void 0,h=void 0,n||p.length===0)return;let e=p;p=[],r(t=>{let r=[...t,...e];return!d&&s!==void 0&&r.length>=s&&(d=!0,queueMicrotask(()=>{n||l?.()})),o===void 0||r.length<=o?r:r.slice(-o)})},_=()=>{h===void 0&&(h=setTimeout(g,50),typeof globalThis.requestAnimationFrame==`function`&&(m=globalThis.requestAnimationFrame(g)))},v=Ae({kind:`run`,projectId:f,runId:e,afterSeq:a,...i?{cursor:i}:{}},{frame:e=>{!(`type`in e)||e.type!==`event`||e.event.seq<=t||(t=e.event.seq,p.push(e.event),_())},reset:async(e,n)=>{g();let r=await u?.(e,n);return r&&(t=Math.max(t,r.afterSeq)),r}});return()=>{n=!0,m!==void 0&&globalThis.cancelAnimationFrame?.(m),clearTimeout(h),v()}},[e,i,a,o,s,l,u]),n}var _A=5,vA=200,yA=5e3;function bA(...e){let t=new Map;for(let n of e)for(let e of n)t.set(e.seq,e);return[...t.values()].sort((e,t)=>e.seq-t.seq)}function xA(e,t,n){e.setQueryData(t,e=>{if(!e)return{pages:[n],pageParams:[void 0]};let t=[...e.pages],r=[...e.pageParams],i=-1;for(let e=0;e<t.length;e+=1)(i===-1||t[e].asOfSeq>t[i].asOfSeq)&&(i=e);if(i>=0&&t[i].asOfSeq>n.asOfSeq)return e;for(i>=0&&t[i].newerCursor===void 0?(t[i]=n,r[i]=void 0):(t.push(n),r.push(void 0));t.length>_A;)t.shift(),r.shift();return{pages:t,pageParams:r}})}function SA(e,t){return e!==void 0&&(t===void 0||e.asOfSeq>=t.asOfSeq)}function CA(e,t,n,r){let i=(0,Z.useRef)(void 0),a=r&&t.data!==void 0&&!t.isFetching&&!SA(t.data,n),o=e===void 0||n===void 0?void 0:`${e}:${n.asOfSeq}`;(0,Z.useEffect)(()=>{!a||o===void 0||i.current===o||(i.current=o,t.refetch())},[a,t,o])}function wA(e,t){return e!==void 0&&e.asOfSeq>t.asOfSeq?e:t}function TA(e){let t=c(),n=I(),r=[`run-history`,t,e],i=[`run-history-context`,t,e],a=ln({queryKey:r,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>qt(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:_A,staleTime:1/0,retry:1}),o=wr({queryKey:i,enabled:e!==void 0,queryFn:async({signal:t})=>{let r=await Pe(e,{signal:t});return wA(n.getQueryData(i),r)},retry:1}),s=(0,Z.useCallback)(async r=>{let i=r?{signal:r}:void 0,a=await qt(e,void 0,i),o=await Pe(e,i);return r?.throwIfAborted(),xA(n,[`run-history`,t,e],a),n.setQueryData([`run-history-context`,t,e],e=>wA(e,o)),a},[n,e,t]),l=(0,Z.useCallback)(async(t,n)=>{if(e===void 0)return;let r=await s(n);return{cursor:r.liveCursor,afterSeq:r.asOfSeq}},[s,e]),u=a.isError||o.isError,d=gA(u?e:void 0,{onReset:l}),f=a.data?.pages??[],p=f.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),m=(0,Z.useRef)(!1),h=(0,Z.useCallback)(()=>{e===void 0||m.current||(m.current=!0,s().catch(()=>{}).finally(()=>{m.current=!1}))},[s,e]),g=e=>e!==void 0&&n.getQueryData([`run-history`,t,e])!==void 0,[_,v]=(0,Z.useState)(()=>({runId:e,pending:g(e)})),y=_.pending;_.runId!==e&&(y=g(e),v({runId:e,pending:y})),(0,Z.useEffect)(()=>{if(!y||e===void 0)return;let t=!1,n=new AbortController;return s(n.signal).catch(()=>{}).finally(()=>{t||v({runId:e,pending:!1})}),()=>{t=!0,n.abort()}},[s,y,e]);let b=gA(!u&&p&&!y?e:void 0,{cursor:p?.liveCursor,afterSeq:p?.asOfSeq,maxEvents:yA,compactAt:vA,onCompact:h,onReset:l}),x=(0,Z.useRef)(0);x.current=b.length,(0,Z.useEffect)(()=>()=>{x.current>0&&h()},[h]);let S=(0,Z.useMemo)(()=>bA(...f.map(e=>e.events)),[f]),C=(0,Z.useMemo)(()=>u?d:bA(S,b),[u,d,S,b]);CA(e,o,p,!u);let w=u||SA(o.data,p),T=(0,Z.useMemo)(()=>{if(u)return d;let e=o.data?.contextEvents??[],t=o.data?.asOfSeq??0;return bA(e,C.filter(({seq:e})=>e>t))},[o.data,u,d,C]),E=(0,Z.useCallback)(async()=>{await a.fetchPreviousPage()},[a.fetchPreviousPage]),D=(0,Z.useCallback)(async()=>{u||(await n.resetQueries({queryKey:[`run-history`,t,e],exact:!0}),n.invalidateQueries({queryKey:[`run-history-context`,t,e],exact:!0}))},[u,n,e,t]);return{visibleEvents:C,currentEvents:T,currentComplete:w,isPending:!u&&a.isPending,contextPending:!u&&o.isPending,fallback:u,hasOlder:!u&&!!a.hasPreviousPage,isFetchingOlder:a.isFetchingPreviousPage,olderError:a.isFetchPreviousPageError?a.error instanceof Error?a.error.message:`Could not load earlier items`:void 0,loadOlder:E,jumpToLatest:D,retainedPages:f.length}}function EA(e){for(let t=e.length-1;t>=0;--t){let n=Bt.safeParse(e[t]);if(n.success)return n.data.state===`connected`}return!1}function DA(e){let{currentEvents:t}=TA(e);return(0,Z.useMemo)(()=>EA(t),[t])}var OA=(0,Z.lazy)(()=>W(()=>import(`./report-reader-RkXaRhiv.js`).then(e=>({default:e.ReportReader})),__vite__mapDeps([25,5,7,8,9,10,11,26,27,28,29,30,12,22,31,13,32,33,34,4])));function kA(){let{id:e}=s(),t=Xn(e),n=a(),r=En().data?.capabilities?.preview===!0,i=t.data?iA(t.data):!1,o=hA(e,i),c=Lk(e),l=Mk(e,c.selection?.artifactId,c.sourceRunId),u=c.selection?(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`p`,{role:`status`,children:`Loading report…`}),children:(0,Q.jsx)(OA,{runId:l.data??e??``,selection:{artifactId:c.selection.artifactId},fragment:n.hash,onBack:c.close,variant:`pane`,sourceLookup:l},`${e}:${c.selection.artifactId}`)}):void 0,d=r?(0,Q.jsx)(AA,{id:e,run:t.data,pane:o,removed:i,report:u,children:(0,Q.jsx)(v,{})}):(0,Q.jsx)(rA,{run:t.data,state:{...o,open:!1},report:u,children:(0,Q.jsx)(v,{})});return(0,Q.jsx)(Ik.Provider,{value:c.registry,children:d})}function AA({id:e,run:t,pane:n,removed:r,children:i,report:a}){let o=DA(e),s=(0,Z.useMemo)(()=>({...n,worktreeRemoved:r,agentLive:o}),[n,r,o]);return(0,Q.jsx)(uA.Provider,{value:s,children:(0,Q.jsx)(rA,{run:t,state:n,report:a,children:i})})}function jA({...e}){return(0,Q.jsx)(Cd,{"data-slot":`collapsible`,...e})}function MA({...e}){return(0,Q.jsx)(vd,{"data-slot":`collapsible-trigger`,...e})}function NA({...e}){return(0,Q.jsx)(bd,{"data-slot":`collapsible-content`,...e})}var PA={"needs-you":{label:`Needs you`,hint:`Asks a question, asks for permission, or waits for review`},failed:{label:`Failed`,hint:`Failed, with no scheduled resume`},done:{label:`Done`,hint:`Finished`},cancelled:{label:`Cancelled`,hint:`Was cancelled`},running:{label:`Running`,hint:`Runs an agent turn`},"waiting-workers":{label:`Waiting for agents`,hint:`Waits on its workers or their replies`},"waiting-ci":{label:`Waiting on CI`,hint:`Waits on a pull request's checks`},"waiting-timer":{label:`Waiting`,hint:`Waits on a timer`},"waiting-other":{label:`Any other wait`,hint:`Waits on anything else, including wait types added later`}},FA=(e,t)=>e.length===t.length&&e.every(e=>t.includes(e)),IA={name:``,description:``,url:``,token:``,tasks:!0,triggers:pt,agent:!1};function LA(e){return{name:e.name,description:e.description??``,url:e.url,token:``,tasks:e.tasks,triggers:e.triggers??pt,agent:e.agent}}var RA=e=>N.filter(t=>e.includes(t));function zA(e){let t=e.description.trim();return{name:e.name.trim(),url:e.url.trim(),...t?{description:t}:{},...e.token?{token:e.token}:{},tasks:e.tasks,...FA(e.triggers,pt)?{}:{triggers:RA(e.triggers)},agent:e.agent}}function BA(e,t){let n={},r=e.name.trim(),i=e.description.trim(),a=e.url.trim();return r!==t.name&&(n.name=r),i!==(t.description??``)&&(n.description=i),a!==t.url&&(n.url=a),e.token&&(n.token=e.token),e.tasks!==t.tasks&&(n.tasks=e.tasks),FA(e.triggers,t.triggers??pt)||(n.triggers=RA(e.triggers)),e.agent!==t.agent&&(n.agent=e.agent),n}var VA=`flex flex-col gap-1 text-[13px]`,HA=`text-[11px] text-muted-foreground`;function UA({draft:e,onChange:t,tokenSet:n}){let r=(0,Z.useId)(),i=(0,Z.useId)(),a=(0,Z.useId)(),o=(0,Z.useId)(),s=(0,Z.useId)(),c=(0,Z.useId)(),l=(0,Z.useId)(),u=(0,Z.useId)(),d=(0,Z.useId)(),f=(0,Z.useId)();return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,14rem),1fr))] gap-3`,children:[(0,Q.jsxs)(`div`,{className:VA,children:[(0,Q.jsx)(`label`,{htmlFor:r,className:HA,children:`Name`}),(0,Q.jsx)(rh,{id:r,"data-slot":`webhook-name`,autoComplete:`off`,maxLength:80,placeholder:`e.g. Team bot`,value:e.name,onChange:e=>t({name:e.target.value})})]}),(0,Q.jsxs)(`div`,{className:VA,children:[(0,Q.jsx)(`label`,{htmlFor:o,className:HA,children:`URL`}),(0,Q.jsx)(rh,{id:o,"data-slot":`webhook-url`,type:`url`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,maxLength:ue,placeholder:`https://bot.example/hooks/cez`,value:e.url,onChange:e=>t({url:e.target.value})})]})]}),(0,Q.jsxs)(`div`,{className:VA,children:[(0,Q.jsx)(`label`,{htmlFor:i,className:HA,children:`Description`}),(0,Q.jsx)(ew,{id:i,"data-slot":`webhook-description`,"aria-describedby":a,rows:2,maxLength:Ut,placeholder:`e.g. Posts to the #releases channel. Use it for release notes.`,value:e.description,onChange:e=>t({description:e.target.value})}),(0,Q.jsx)(`span`,{id:a,className:`text-[11px] text-soft-foreground`,children:`Agents read the name and description to decide when to use this webhook.`})]}),(0,Q.jsxs)(`div`,{className:VA,children:[(0,Q.jsx)(`label`,{htmlFor:s,className:HA,children:`Token`}),(0,Q.jsx)(rh,{id:s,"data-slot":`webhook-token`,type:`password`,autoComplete:`new-password`,spellCheck:!1,maxLength:Fe,"aria-describedby":c,placeholder:n?`Token set — type to replace`:`Optional Bearer token`,value:e.token,onChange:e=>t({token:e.target.value})}),(0,Q.jsx)(`span`,{id:c,className:`text-[11px] text-soft-foreground`,children:n?`The token is stored in ~/.cezar and never shown again. Leave it empty to keep it.`:`The token is stored in ~/.cezar, never in the repo. It is sent as a Bearer header.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,Q.jsx)(uh,{id:l,"aria-describedby":u,"data-slot":`webhook-tasks`,checked:e.tasks,onCheckedChange:e=>t({tasks:e})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,Q.jsx)(`label`,{htmlFor:l,className:`font-medium`,children:`Task notifications`}),(0,Q.jsx)(`span`,{id:u,className:`text-[11px] text-soft-foreground`,children:`Tasks you hand off, or start with notify on, send their status here.`})]})]}),e.tasks?(0,Q.jsxs)(`fieldset`,{"data-slot":`webhook-triggers`,className:`flex flex-col gap-1 sm:ps-[3.25rem]`,children:[(0,Q.jsx)(`legend`,{className:`pbe-1 text-[11px] text-muted-foreground`,children:`Send a delivery when a task enters`}),(0,Q.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(min(100%,15rem),1fr))] gap-x-3`,children:N.map(n=>(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-start gap-2.5 pbs-2 text-[13px]`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,"data-trigger":n,checked:e.triggers.includes(n),onChange:r=>t({triggers:r.target.checked?[...e.triggers,n]:e.triggers.filter(e=>e!==n)}),className:`mbs-0.5 size-[18px] shrink-0`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:PA[n].label}),(0,Q.jsx)(`span`,{className:`text-[11px] text-soft-foreground`,children:PA[n].hint})]})]},n))}),(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Handing a task off and Send test always deliver.`})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,Q.jsx)(uh,{id:d,"aria-describedby":f,"data-slot":`webhook-agent`,checked:e.agent,onCheckedChange:e=>t({agent:e})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,Q.jsx)(`label`,{htmlFor:d,className:`font-medium`,children:`Let agents send reports`}),(0,Q.jsx)(`span`,{id:f,className:`text-[11px] text-soft-foreground`,children:`Agents in this project may post a report here when the task calls for it.`})]})]})]})}var WA=`max-sm:h-11`,GA=(e,t)=>({tone:`alert`,text:`Not saved: ${e.message}. Fix the field and select ${t} again.`}),KA=e=>e.dryRun?{tone:`ok`,text:`Dry run: nothing was sent.`}:e.ok?{tone:`ok`,text:`Delivered (HTTP ${e.status??200}).`}:{tone:`danger`,text:`Not delivered: ${e.error??`unknown error`}.`};function qA({feedback:e}){return e?(0,Q.jsx)(`p`,{"data-slot":e.tone===`alert`?`webhook-error`:`webhook-result`,role:e.tone===`alert`?`alert`:`status`,className:e.tone===`ok`?`text-[13px] text-muted-foreground`:`text-[13px] text-danger`,children:e.text}):null}var JA=`rounded-md border border-border bg-background`,YA=`flex flex-col gap-3 border-bs border-border p-3`;function XA({projectId:e,webhook:t,defaultOpen:n=!1}){let r=ir(),i=nr(),a=In(),[o,s]=(0,Z.useState)(n),[c,l]=(0,Z.useState)(()=>LA(t)),[u,d]=(0,Z.useState)(null),f=BA(c,t),p=Object.keys(f).length>0,m=c.name.trim()!==``&&c.url.trim()!==``,h=r.isPending||i.isPending||a.isPending,g={projectId:e,webhookId:t.id},_=e=>r.mutate({...g,...f},{onSuccess:()=>{l(e=>({...e,token:``})),e?e():G(`${c.name.trim()} saved`)},onError:e=>d(GA(e,`Save`))}),v=()=>a.mutate(g,{onSuccess:e=>d(KA(e)),onError:e=>d({tone:`danger`,text:e.message})});return(0,Q.jsx)(`li`,{"data-slot":`webhook-card`,"data-webhook-id":t.id,className:JA,children:(0,Q.jsxs)(jA,{open:o,onOpenChange:s,children:[(0,Q.jsx)(MA,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-action":`webhook-toggle`,className:`group flex min-h-11 w-full items-center gap-3 rounded-md p-3 text-start focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground pointer-hover:bg-muted/50 active:bg-muted/50`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,Q.jsx)(`span`,{"data-slot":`webhook-card-name`,className:`min-w-0 break-words text-[13px] font-medium`,children:t.name}),t.tasks?(0,Q.jsx)(Jm,{variant:`secondary`,"data-badge":`tasks`,children:`Task notifications`}):null,t.agent?(0,Q.jsx)(Jm,{variant:`secondary`,"data-badge":`agent`,children:`Agents`}):null]}),(0,Q.jsx)(`span`,{"data-slot":`webhook-card-url`,className:`truncate text-[12px] text-muted-foreground`,children:tO(t.url)})]}),(0,Q.jsx)(ua,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground group-data-[state=open]:rotate-180`})]})}),(0,Q.jsx)(NA,{children:(0,Q.jsxs)(`form`,{"data-slot":`webhook-form`,className:YA,onSubmit:e=>{e.preventDefault(),d(null),m&&p&&_()},children:[(0,Q.jsx)(UA,{draft:c,tokenSet:t.tokenSet,onChange:e=>l(t=>({...t,...e}))}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(k,{type:`submit`,size:`sm`,className:WA,"data-action":`webhook-save`,disabled:h||!m||!p,children:`Save`}),(0,Q.jsx)(k,{type:`button`,size:`sm`,className:WA,variant:`outline`,"data-action":`webhook-test`,disabled:h||!m,onClick:()=>{d(null),p?_(v):v()},children:`Send test`}),t.tokenSet?(0,Q.jsx)(k,{type:`button`,size:`sm`,className:WA,variant:`ghost`,"data-action":`webhook-clear-token`,disabled:h,onClick:()=>r.mutate({...g,token:``},{onSuccess:()=>G(`Webhook token cleared`),onError:e=>d({tone:`danger`,text:`Token not cleared: ${e.message}.`})}),children:`Clear token`}):null,(0,Q.jsx)(k,{type:`button`,size:`sm`,className:WA,variant:`danger-ghost`,"data-action":`webhook-remove`,"aria-label":`Remove ${t.name}`,disabled:h,onClick:()=>i.mutate(g,{onSuccess:()=>G(`${t.name} removed`),onError:e=>d({tone:`danger`,text:`Not removed: ${e.message}.`})}),children:`Remove`})]}),(0,Q.jsx)(qA,{feedback:u})]})})]})})}function ZA({projectId:e,onCreated:t,onCancel:n}){let r=vr(),[i,a]=(0,Z.useState)(IA),[o,s]=(0,Z.useState)(null),c=i.name.trim()!==``&&i.url.trim()!==``;return(0,Q.jsxs)(`li`,{"data-slot":`webhook-card`,"data-draft":``,className:JA,children:[(0,Q.jsx)(`p`,{className:`p-3 text-[13px] font-medium`,children:`New webhook`}),(0,Q.jsxs)(`form`,{"data-slot":`webhook-form`,"aria-label":`New webhook`,className:YA,onSubmit:n=>{n.preventDefault(),s(null),c&&r.mutate({projectId:e,...zA(i)},{onSuccess:({webhook:e})=>{G(`${e.name} created`),t(e)},onError:e=>s(GA(e,`Create`))})},children:[(0,Q.jsx)(UA,{draft:i,tokenSet:!1,onChange:e=>a(t=>({...t,...e}))}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(k,{type:`submit`,size:`sm`,className:WA,"data-action":`webhook-create`,disabled:r.isPending||!c,children:`Create`}),(0,Q.jsx)(k,{type:`button`,size:`sm`,className:WA,variant:`ghost`,"data-action":`webhook-cancel`,disabled:r.isPending,onClick:n,children:`Cancel`})]}),(0,Q.jsx)(qA,{feedback:o})]})]})}function QA({project:e}){let t=e.webhooks??[],[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(null),o=t.length>=16;return(0,Q.jsx)(qw,{title:`Webhooks`,hint:`A webhook gets a POST from Squawk. Tasks can send their status to it, and agents can send it reports.`,children:(0,Q.jsxs)(`div`,{"data-slot":`project-webhooks`,className:`flex flex-col gap-3`,children:[t.length===0&&!n?(0,Q.jsx)(`p`,{"data-slot":`webhooks-empty`,className:`text-[13px] text-soft-foreground`,children:`No webhooks yet. Add one to send task updates to a bot, or to let agents post reports.`}):null,t.length>0||n?(0,Q.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[t.map(t=>(0,Q.jsx)(XA,{projectId:e.id,webhook:t,defaultOpen:t.id===i},t.id)),n?(0,Q.jsx)(ZA,{projectId:e.id,onCancel:()=>r(!1),onCreated:e=>{a(e.id),r(!1)}}):null]}):null,n?null:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(k,{type:`button`,size:`sm`,variant:`outline`,className:`max-sm:h-11`,"data-action":`webhook-add`,disabled:o,onClick:()=>r(!0),children:[(0,Q.jsx)(Bu,{"aria-hidden":`true`}),`Add webhook`]}),o?(0,Q.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`A project holds at most `,16,` webhooks.`]}):null]})]})})}function $A(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function ej(){let e=Ss(),t=bn(),n=rr();if(t.isPending)return(0,Q.jsx)(`p`,{"data-slot":`project-general-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading project…`});if(t.isError)return(0,Q.jsxs)(`p`,{"data-slot":`project-general-error`,className:`text-[13px] text-danger`,children:[`Could not read the project registry — `,t.error.message]});let r=t.data,i=r?.projects.find(t=>t.id===e);return!r||!i?null:(0,Q.jsxs)(`div`,{"data-slot":`project-general`,className:`flex w-full flex-col gap-5`,children:[(0,Q.jsxs)(`section`,{className:`flex flex-col gap-5 rounded-lg border border-border bg-card p-5 [&_select]:min-h-11 [&_select]:w-full`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-semibold`,children:`General`}),(0,Q.jsx)(AT,{}),(0,Q.jsx)(tj,{project:i}),(0,Q.jsx)(qw,{title:`Max parallel tasks`,hint:n.data?`The workspace limit (${n.data.resources.maxParallel}) still applies as an overall ceiling.`:`How many of this project's tasks may run at once. The workspace limit still applies as an overall ceiling.`,children:n.data?(0,Q.jsx)(rT,{project:i,workspaceMax:n.data.resources.maxParallel}):(0,Q.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading the workspace limit…`})}),(0,Q.jsx)(QA,{project:i},i.id)]}),(0,Q.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,Q.jsx)(nj,{project:i,bootProject:r.bootProject})})]})}function tj({project:e}){return(0,Q.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-1 gap-4 text-[13px] sm:grid-cols-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Project`}),(0,Q.jsx)(`dd`,{className:`mt-1 font-medium`,children:e.name})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Branch`}),(0,Q.jsx)(`dd`,{className:`mt-1 break-all`,children:e.branch??`—`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Status`}),(0,Q.jsxs)(`dd`,{"data-slot":`project-general-status`,className:e.status===`missing`?`mt-1 text-danger`:`mt-1`,children:[Yw[e.status],e.status===`missing`?` — remove it below, or restore the folder`:null]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Added`}),(0,Q.jsxs)(`dd`,{className:`mt-1`,children:[$A(e.addedAt),(0,Q.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Last opened`}),(0,Q.jsx)(`dd`,{className:`mt-1`,children:$A(e.lastOpenedAt)})]})]})}function nj({project:e,bootProject:t}){let[n,r]=(0,Z.useState)(null),i=Gw(),a=j(),o=e.id===t;return(0,Q.jsxs)(qw,{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 opening it again re-registers it.`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsxs)(k,{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?`Squawk is serving this project — it re-registers itself at every start`:void 0,disabled:o||i.isPending,onClick:()=>r(e),className:`text-danger`,children:[`Remove `,e.name]}),o?(0,Q.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`text-[11px] text-soft-foreground`,children:`Squawk is serving this project — it re-registers itself at every start.`}):null]}),(0,Q.jsx)(Kw,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function rj(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}var ij=rj(`global`,`appearance`);function aj(e){return e===`global`?{Link:E,NavLink:w}:{Link:Y,NavLink:ys}}function oj({scope:e,title:t,mobileTitle:n}){let r=Kh().name;return(0,Q.jsxs)(`header`,{"data-slot":`settings-main-header`,className:`settings-route-header flex shrink-0 flex-col gap-2`,children:[(0,Q.jsxs)(`h1`,{className:`text-[15px] font-semibold tracking-normal max-md:text-[24px] max-md:font-normal`,children:[(0,Q.jsx)(`span`,{className:`md:hidden`,children:n}),(0,Q.jsxs)(`span`,{className:`max-md:hidden`,children:[t,` · `,e===`global`?`every project`:r??`this project`]})]}),e===`global`?(0,Q.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`sr-only`,children:`Global settings`}):null]})}function sj({scope:e,activeId:t}){let{NavLink:n}=aj(e),r=zT(e);return(0,Q.jsxs)(`details`,{className:`settings-section-picker md:hidden`,children:[(0,Q.jsxs)(`summary`,{children:[r.find(e=>e.id===t)?.title??`General`,(0,Q.jsx)(ua,{"aria-hidden":`true`,className:`size-5 text-muted-foreground`})]}),(0,Q.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav-mobile`,"data-scope":e,children:[e===`project`?(0,Q.jsx)(n,{to:`/settings`,end:!0,"data-slot":`settings-nav-index`,children:`General`}):null,r.map(t=>(0,Q.jsx)(n,{to:rj(e,t.id),"data-section":t.id,children:t.title},t.id))]})]},`${e}-${t}`)}function cj({section:e,scope:t}){let n=e.component;return(0,Q.jsxs)(`div`,{"data-route":t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,className:`settings-route mx-auto flex min-h-full w-full flex-col`,children:[(0,Q.jsx)(oj,{scope:t,title:e.title,mobileTitle:t===`global`?`Global settings`:`Project settings`}),(0,Q.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,Q.jsx)(sj,{scope:t,activeId:e.id}),(0,Q.jsxs)(`section`,{className:`settings-panel min-w-0 self-start md:flex-1`,"aria-label":e.title,children:[(0,Q.jsx)(`h2`,{className:`settings-panel-title`,children:e.title}),(0,Q.jsx)(n,{})]})]})]})}function lj(){return(0,Q.jsxs)(`div`,{"data-route":`settings`,className:`settings-route mx-auto flex min-h-full w-full flex-col`,children:[(0,Q.jsx)(oj,{scope:`project`,title:`General`,mobileTitle:`Project settings`}),(0,Q.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,Q.jsx)(sj,{scope:`project`,activeId:null}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,Q.jsx)(ej,{}),(0,Q.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,Q.jsx)(HS,{})}),(0,Q.jsx)(`h2`,{className:`settings-other-title mt-6 rounded-t-lg border border-b-0 border-border bg-card px-5 pt-5 text-base font-semibold md:hidden`,children:`Other project settings`}),(0,Q.jsx)(`ul`,{"data-slot":`settings-index`,className:`mt-7 flex w-full flex-col gap-5 md:hidden`,children:zT(`project`).map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(Y,{to:rj(`project`,e.id),"data-section":e.id,className:`flex items-center gap-3.5 rounded-lg border border-border bg-card p-4 transition-colors hover:bg-card-2`,children:[(0,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center text-accent-text`,children:(0,Q.jsx)(e.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,Q.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:e.description})]}),(0,Q.jsx)(Sa,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},e.id))}),(0,Q.jsxs)(`p`,{className:`mt-5 w-full text-[12px] text-soft-foreground`,children:[`Appearance, notifications, host resources and the project registry live in`,` `,(0,Q.jsx)(E,{to:ij,"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})]})]})]})}function uj(){let[e,t]=(0,Z.useState)(()=>new Set);return{expandedRuns:e,toggleExpandedRun:(0,Z.useCallback)(e=>t(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[])}}var dj=[{id:`status`,label:`Status`,canFold:!1,defaultExpanded:!0,align:`left`,width:`120px`},{id:`task`,label:`Task`,canFold:!1,defaultExpanded:!0,align:`left`,width:`320px`},{id:`workflow`,label:`Workflow`,canFold:!0,defaultExpanded:!0,align:`left`,width:`84px`,icon:`workflow`},{id:`branch`,label:`Branch`,canFold:!0,defaultExpanded:!1,align:`left`,width:`120px`,icon:`branch`},{id:`diff`,label:`±`,canFold:!0,defaultExpanded:!0,align:`left`,width:`84px`,icon:`diff`},{id:`reference`,label:`Ref`,canFold:!0,defaultExpanded:!0,align:`left`,width:`104px`,icon:`reference`},{id:`tokens`,label:`IN / OUT`,canFold:!0,defaultExpanded:!0,align:`right`,width:`112px`,icon:`tokens`,capability:`tokens`},{id:`cost`,label:`Cost`,canFold:!0,defaultExpanded:!0,align:`right`,width:`64px`,icon:`cost`,capability:`cost`},{id:`cpu`,label:`CPU`,canFold:!0,defaultExpanded:!0,align:`right`,width:`60px`,icon:`cpu`},{id:`memory`,label:`Mem`,canFold:!0,defaultExpanded:!0,align:`right`,width:`80px`,icon:`memory`},{id:`started`,label:`Started`,canFold:!0,defaultExpanded:!0,align:`right`,width:`68px`,icon:`started`}],fj=new Map(dj.map(e=>[e.id,e]));function pj(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`boolean`))}function mj(e){let t={};for(let[n,r]of Object.entries(pj(e))){let e=fj.get(n);e?.canFold&&(t[e.id]=r)}return t}function hj(e,t){let n=fj.get(e);return!n||!n.canFold?!0:t[e]??n.defaultExpanded}function gj(e,t){let n=pj(e);return fj.get(t)?.canFold?{...n,[t]:!hj(t,mj(e))}:n}function _j(e){return dj.filter(t=>t.capability===void 0||e[t.capability])}function vj(e,t){return t===`flat`?!1:t===`virtual`||e>=100}function yj(e,t){let n=t===null?-1:e.indexOf(t);return n<0?[]:[n-1,n,n+1].filter(t=>t>=0&&t<e.length)}function bj(e,t){let n=e.map(e=>hj(e.id,t)?e.id===`workflow`||e.id===`memory`?120:Number.parseFloat(e.width??`100`):42);return{"--task-columns":e.map((e,t)=>e.id===`task`?`minmax(${n[t]}px, 1fr)`:`${n[t]}px`).join(` `),minInlineSize:Math.max(1240,n.reduce((e,t)=>e+t,0))}}function xj(e,t){let n=2;return{indexes:e.map(e=>{let r=n;return n+=t.has(e)?2:1,r}),rowCount:n-1}}var Sj=null,{min:Cj,max:wj,abs:Tj,floor:Ej}=Math,Dj=(e,t,n)=>Cj(n,wj(t,e)),Oj=e=>[...e].sort((e,t)=>e-t),kj=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)},Aj=()=>{let e;return[new Promise(t=>{e=t}),e]},jj=e=>{let t;return()=>(e&&=(t=e(),void 0),t)},Mj=(e,t,n)=>{let r=n?`unshift`:`push`;for(let n=0;n<t;n++)e[r](-1);return e},Nj=(e,t)=>{let n=e.t[t];return n===-1?e.o:n},Pj=(e,t,n)=>{let r=e.t[t]===-1;return e.t[t]=n,e.i=Cj(t,e.i),r},Fj=(e,t)=>{if(!e.l)return 0;if(e.i>=t)return e.u[t];e.i<0&&(e.u[0]=0,e.i=0);let n=e.i,r=e.u[n];for(;n<t;)r+=Nj(e,n),e.u[++n]=r;return e.i=t,r},Ij=(e,t,n=0,r=e.l-1)=>{let i=n;for(;n<=r;){let a=Ej((n+r)/2);Fj(e,a)<=t?(i=a,n=a+1):r=a-1}return Dj(i,0,e.l-1)},Lj=(e,t,n)=>{let r=t-e.l;return e.i=n?-1:Cj(t-1,e.i),e.l=t,r>0?(Mj(e.u,r),Mj(e.t,r,n),e.o*r):(e.u.splice(r),(n?e.t.splice(0,-r):e.t.splice(r)).reduce((t,n)=>t-(n===-1?e.o:n),0))},Rj=typeof window<`u`,zj=e=>e.documentElement,Bj=e=>e.ownerDocument,Vj=e=>e.defaultView,Hj=jj(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>0),Uj=jj(()=>`scrollBehavior`in zj(document).style),Wj=e=>wj(e.h(),e.p()),Gj=(e,t=40,n=0,r,i=!1)=>{let a=!!n,o=1,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=Sj,g=[0,a?wj(n-1,0):-1],_=0,v=!1,y=((e,t,n)=>({o:t,t:n?Mj(n.slice(0,Cj(e,n.length)),wj(0,e-n.length)):Mj([],e),l:e,i:-1,u:Mj([],e+1)}))(e,r?r[1]:t,r&&r[0]),b=new Set,x=()=>l-c,S=()=>x()+d+u,C=(e,t)=>((e,t,n,r)=>{if(r=Cj(r,e.l-1),Fj(e,r)<=t){let i=Ij(e,n,r);return[Ij(e,t,r,i),i]}{let i=Ij(e,t,void 0,r);return[i,Ij(e,n,i)]}})(y,e,t,g[0]),w=()=>Fj(y,y.l),T=(e,t)=>{let n=Fj(y,e)-d;return t?w()-n-E(e):n},E=e=>Nj(y,e),D=(e,t=-1)=>y.t[e]===t,O=e=>{e&&(Hj()&&p!==0||h&&m===1?d+=e:u+=e)};return{v:()=>{b.clear()},m:()=>o,_:()=>(e=>[e.t.slice(),e.o])(y),S:(e=200)=>{if(!v||a)return g;let t,n;if(f)[t,n]=g;else{let r=wj(0,S()),a=r+s;i||(e=wj(0,e),p!==1&&(r-=e),p!==2&&(a+=e)),[t,n]=g=C(wj(0,r),wj(0,a)),h&&(t=Cj(t,h[0]),n=wj(n,h[1]))}return[wj(t,0),Cj(n,y.l-1)]},$:e=>Ij(y,e-c),I:D,k:T,R:E,T:()=>y.l,C:()=>l,M:()=>p!==0,p:()=>s,O:()=>c,h:w,H:()=>(f=u,u=0,[f,m===2]),W:(e,t)=>{let n=[e,t];return b.add(n),()=>{b.delete(n)}},B:(e,t)=>{let n,r,g=0;switch(e){case 1:{if(t===l&&m===0)break;let e=f;f=0;let n=t-l,i=Tj(n);e&&i<Tj(e)+1||m!==0||(p=n<0?2:1),a&&=!1,l=t,g=4;let o=x();o>=-s&&o<=w()&&(g+=1,r=i>s);break}case 2:g=8,p!==0&&(n=!0,g+=1),p=0,m=0,h=Sj;break;case 3:{let e=t.filter(([e,t])=>!D(e,t));if(!e.length)break;O(e.reduce((e,[t,n])=>{let r;if(m===2)r=!0;else if(h&&m===1)r=t<h[0];else{let e=x(),n=T(t),i=E(t);r=p!==1&&m===0?n+i<=e:n<e&&n+i<e+s}return r&&(e+=n-E(t)),e},0));for(let[t,n]of e){let e=E(t),r=Pj(y,t,n);i&&(_+=r?n:n-e)}i&&s&&_>s&&(O(((e,t)=>{let n=0,r=[];e.t.forEach((e,i)=>{e!==-1&&(r.push(e),i<t&&n++)}),e.i=-1;let i=Oj(r),a=i.length,o=a/2|0,s=a%2==0?(i[o-1]+i[o])/2:i[o],c=e.o;return((e.o=s)-c)*wj(t-n,0)})(y,Ij(y,S()))),i=!1),g=3,r=!0;break}case 4:s!==t&&(s||(v=r=!0),s=t,g=3);break;case 5:t[1]?(O(Lj(y,t[0],!0)),m=2,g=1):(Lj(y,t[0]),g=1);break;case 6:c=t;break;case 7:m=1;break;case 8:h=C(t,t+s),g=1}g&&(o=1+(2147483647&o),n&&d&&(u+=d,d=0),b.forEach(([e,t])=>{g&e&&t(r)}))}}},Kj=setTimeout,qj=(e,t)=>t?-e:e,Jj=(e,t,n,r,i,a)=>{let o=Date.now,s=0,c=!1,l=!1,u=!1,d=!1,f=(()=>{let t,n=()=>{t!=Sj&&clearTimeout(t)},r=()=>{n(),t=Kj(()=>{t=Sj,(()=>{if(c||l)return c=!1,void f();u=!1,e.B(2)})()},150)};return r.J=n,r})(),p=()=>{s=o(),u&&(d=!0),a&&e.B(6,a()),e.B(1,r()),f()},m=t=>{if(c||!e.M()||t.ctrlKey)return;let r=o()-s;150>r&&50<r&&(n?t.deltaX:t.deltaY)&&(c=!0)},h=()=>{l=!0,u=d=!1},g=()=>{l=!1,Hj()&&(u=!0)};return t.addEventListener(`scroll`,p),t.addEventListener(`wheel`,m,{passive:!0}),t.addEventListener(`touchstart`,h,{passive:!0}),t.addEventListener(`touchend`,g,{passive:!0}),{A:()=>{t.removeEventListener(`scroll`,p),t.removeEventListener(`wheel`,m),t.removeEventListener(`touchstart`,h),t.removeEventListener(`touchend`,g),f.J()},L:()=>{let[t,n]=e.H();t&&(i(t,n,d),d=!1,n&&e.p()>e.h()&&e.B(1,r()))}}},Yj=(e,t,n)=>{let r;return[async(i,a)=>{if(!await t())return;r&&r();let o=()=>{let[t,n]=Aj();return r=()=>{n(!1)},e.p()&&Kj(r,150),[t,e.W(2,()=>{n(!0)})]};if(a&&Uj())e.B(8,i()),kj(async()=>{for(;;){let t=!0;for(let[n,r]=e.S();n<=r;n++)if(e.I(n)){t=!1;break}if(t)break;let[n,r]=o();try{if(!await n)return}finally{r()}}e.B(7),n(i(),a)});else for(;;){let[t,r]=o();try{if(e.B(7),n(i()),!await t)return}finally{r()}}},()=>{r&&r()}]},Xj=(e,t)=>{let n,r,i=Aj(),a=!1,o=t?`scrollLeft`:`scrollTop`,s=t?`overflowX`:`overflowY`,[c,l]=Yj(e,()=>i[0],(e,r)=>{e=qj(e,a),r?n.scrollTo({[t?`left`:`top`]:e,behavior:`smooth`}):n[o]=e});return{N(c,u){n=u,t&&(a=getComputedStyle(u).direction===`rtl`),r=Jj(e,u,t,()=>qj(u[o],a),(t,n,r)=>{if(r){let e=u.style,t=e[s];e[s]=`hidden`,Kj(()=>{e[s]=t})}u[o]=qj(e.C()+t,a),n&&l()}),i[1](!0)},v(){r&&r.A(),i[1](!1),i=Aj()},P:()=>a,V(e){c(()=>e)},X(t){t+=e.C(),c(()=>t)},Y(t,{align:n,smooth:r,offset:i=0}={}){if(t=Dj(t,0,e.T()-1),n===`nearest`){let r=e.k(t),i=e.C();if(r<i)n=`start`;else{if(!(r+e.R(t)>i+e.p()))return;n=`end`}}c(()=>i+e.O()+e.k(t)+(n===`end`?e.R(t)-e.p():n===`center`?(e.R(t)-e.p())/2:0),r)},q:()=>{r&&r.L()}}},Zj=e=>{let t;return{j(n){(t||=new(Vj(Bj(n))).ResizeObserver(e)).observe(n)},D(e){t.unobserve(e)},A(){t&&t.disconnect()}}},Qj=(e,t)=>{let n,r=t?`width`:`height`,i=new WeakMap,a=Zj(t=>{let a=[];for(let{target:o,contentRect:s}of t)if(o.offsetParent)if(o===n)e.B(4,s[r]);else{let e=i.get(o);e!=Sj&&a.push([e,s[r]])}a.length&&e.B(3,a)});return{G(e){a.j(n=e)},U:(e,t)=>(i.set(e,t),a.j(e),()=>{i.delete(e),a.D(e)}),v:a.A}},$j=Rj?Z.useLayoutEffect:Z.useEffect,eM=`current`,tM=(e,t)=>{if(Array.isArray(e))for(let n of e)tM(n,t);else e==null||typeof e==`boolean`||t.push(e)},nM=(e,t)=>e.key??`_`+t,rM=e=>{let t=(0,Z.useRef)(null);return t[eM]||(t[eM]=e())},iM=e=>{let t=(0,Z.useRef)(e);return $j(()=>{t[eM]=e},[e]),t},aM=(0,Z.memo)(({Z:e,ee:t,te:n,oe:r,ne:i,re:a,se:o,ie:s})=>{let c=(0,Z.useRef)(null);$j(()=>t(c[eM],n),[n]);let l=(0,Z.useMemo)(()=>{let e={contain:`layout style`,position:i&&s?void 0:`absolute`,[o?`height`:`width`]:`100%`,[o?`top`:`left`]:0,[o?`left`:`top`]:r,visibility:!i||s?void 0:`hidden`};return o&&(e.display=`inline-flex`),e},[r,i,s,o]);return(0,Q.jsx)(a,typeof a==`string`?{ref:c,style:l,children:e}:{ref:c,style:l,index:n,children:e})}),oM=(e,t)=>(0,Z.useMemo)(()=>{if(typeof e==`function`)return[n=>e(t[n],n),t.length];let n=(e=>{let t=[];return tM(e,t),t})(e);return[e=>n[e],n.length]},[e,t]),sM=(0,Z.forwardRef)(({children:e,data:t,bufferSize:n,itemSize:r,shift:i,horizontal:a,keepMounted:o,cache:s,startMargin:c=0,ssrCount:l,as:u=`div`,item:d=`div`,scrollRef:f,onScroll:p,onScrollEnd:m},h)=>{let[g,_]=oM(e,t),v=(0,Z.useRef)(null),y=(0,Z.useRef)(!!l),b=iM(p),x=iM(m),[S,C,w,T]=rM(()=>{let e=!!a,t=Gj(_,r,l,s,!r);return[t,Qj(t,e),Xj(t,e),e]});_!==S.T()&&S.B(5,[_,i]),c!==S.O()&&S.B(6,c);let[E,D]=(0,Z.useReducer)(S.m,void 0,S.m),O=S.M(),k=S.h(),A=w.P(),j=[],M=e=>{let t=g(e);return(0,Q.jsx)(aM,{ee:C.U,te:e,oe:S.k(e,A),ne:S.I(e),re:d,Z:t,se:T,ie:y[eM]},nM(t,e))};if($j(()=>{y[eM]=!1,S.W(1,e=>{e?(0,sf.flushSync)(D):D()}),S.W(4,()=>{b[eM]&&b[eM](S.C())}),S.W(8,()=>{x[eM]&&x[eM]()});let e=v[eM],t=t=>{C.G(t),w.N(e,t)};return f?kj(()=>{f[eM]&&t(f[eM])}):t(e.parentElement),()=>{S.v(),C.v(),w.v()}},[]),$j(()=>{w.q()},[E]),(0,Z.useImperativeHandle)(h,()=>({get cache(){return S._()},get scrollOffset(){return S.C()},get scrollSize(){return Wj(S)},get viewportSize(){return S.p()},findItemIndex:S.$,getItemOffset:S.k,getItemSize:S.R,scrollToIndex:w.Y,scrollTo:w.V,scrollBy:w.X}),[]),o){let e=new Set(o);for(let[t,r]=S.S(n);t<=r;t++)e.add(t);Oj([...e]).forEach(e=>{j.push(M(e))})}else for(let[e,t]=S.S(n);e<=t;e++)j.push(M(e));return(0,Q.jsx)(u,{ref:v,style:{contain:`size style`,overflowAnchor:`none`,flex:`none`,position:`relative`,width:T?k:`100%`,height:T?`100%`:k,pointerEvents:O?`none`:void 0},children:j})});function cM(e,t){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(``),o=(0,Z.useRef)(!1);return{editing:n,draft:i,setDraft:a,begin:()=>{a(e),o.current=!1,r(!0)},commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function lM({editor:e,className:t}){return(0,Q.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:e.commit,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:C(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}function uM(e){let t=new Map,n=new Set,r;return{begin:e,editingId:()=>r?.id??null,subscribeSelection(e){return n.add(e),()=>{n.delete(e)}},snapshot:e=>r?.id===e?r.editor:null,subscribe(e,n){let r=t.get(e);return r||(r=new Set,t.set(e,r)),r.add(n),()=>{r.delete(n),r.size||t.delete(e)}},publish(e,i){let a=r?.id;if(r=e&&i.editing?{id:e,editor:i}:void 0,a!==r?.id)for(let e of n)e();for(let e of new Set([a,r?.id]))if(e)for(let n of t.get(e)??[])n()}}}var dM=(0,Z.createContext)(null),fM={editing:!1,draft:``,begin(){},setDraft(){},commit(){},cancel(){}};function pM({children:e,runs:t,onRename:n}){let[r,i]=(0,Z.useState)(),[a]=(0,Z.useState)(()=>uM(e=>i({run:e}))),o=t.find(e=>e.id===r?.run.id),s=cM(o?xi(o):``,e=>{o&&n(o.id,e)});return(0,Z.useEffect)(()=>{r&&s.begin()},[r]),(0,Z.useEffect)(()=>{r&&!o&&(s.cancel(),i(void 0))},[r,o,s]),(0,Z.useLayoutEffect)(()=>{a.publish(o?.id,s)},[a,o?.id,s]),(0,Q.jsx)(dM,{value:a,children:e})}function mM(e){let t=(0,Z.useContext)(dM);if(!t)throw Error(`Task title editor needs its page provider`);return{...(0,Z.useSyncExternalStore)((0,Z.useCallback)(n=>t.subscribe(e.id,n),[t,e.id]),(0,Z.useCallback)(()=>t.snapshot(e.id),[t,e.id]))??fM,begin:()=>t.begin(e)}}var hM=()=>null;function gM(){return _M}function _M(){}function vM(){let e=(0,Z.useContext)(dM);return(0,Z.useSyncExternalStore)(e?.subscribeSelection??gM,e?.editingId??hM)}var yM=(0,Z.createContext)(null);function bM(e,t,n=!1){let[r,i]=(0,Z.useState)(null),a=(0,Z.useRef)(new Map),o=(0,Z.useCallback)((e,t)=>{t?a.current.set(e,t):a.current.delete(e)},[]),s=(0,Z.useCallback)(e=>[...a.current.values()].some(t=>t.includes(e)),[]);return{props:xM(e,t,i,n?s:void 0),value:(0,Z.useMemo)(()=>({focused:r,revision:t,registerList:n?o:void 0}),[r,t,o,n])}}function xM(e,t,n,r){let i=(0,Z.useRef)(r);(0,Z.useLayoutEffect)(()=>{i.current=r});let a=(0,Z.useRef)(null),o=(0,Z.useRef)(null);return(0,Z.useLayoutEffect)(()=>{let e=o.current;if(!e||e.element.isConnected||document.activeElement!==document.body)return;let t=()=>{o.current===e&&(o.current=null,n?.(null))},r=()=>{let n=e.project?`${e.project}/${e.runId}`:e.runId;if(i.current&&!i.current(n)||document.activeElement!==document.body||e.element.isConnected)return t(),!0;let r=[...a.current?.querySelectorAll(`[data-run-id]`)??[]].filter(t=>t.dataset.runId===e.runId&&t.dataset.project===e.project).flatMap(e=>[...e.querySelectorAll(`a,button,input`)]),o=r.find(t=>e.control?t.dataset.taskControl===e.control:t.tagName===e.tag&&t.getAttribute(`aria-label`)===e.label)??r.find(e=>e.tagName===`A`);return o?.focus({preventScroll:!0}),!!o&&document.activeElement===o};if(r()||!a.current)return;let s=()=>{l.disconnect(),document.removeEventListener(`pointerdown`,c,!0),document.removeEventListener(`keydown`,c,!0)},c=()=>{t(),s()},l=new MutationObserver(()=>{r()&&s()});return document.addEventListener(`pointerdown`,c,!0),document.addEventListener(`keydown`,c,!0),l.observe(a.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`style`]}),s},[e,t]),{ref:a,onFocusCapture:e=>{let t=e.target,r=t.closest(`[data-run-id]`);o.current=r?{element:t,runId:r.dataset.runId,project:r.dataset.project,control:t.dataset.taskControl??null,label:t.getAttribute(`aria-label`),tag:t.tagName}:null,n?.(r?r.dataset.project?`${r.dataset.project}/${r.dataset.runId}`:r.dataset.runId:null)},onBlurCapture:e=>{let t=e.target,r=e.currentTarget;queueMicrotask(()=>{o.current?.element===t&&t.isConnected&&!r.contains(document.activeElement)&&(o.current=null,n?.(null))})}}}var SM=new WeakMap;function CM({items:e,itemKey:t,children:n,itemSize:r}){let[i]=o(),a=(0,Z.useRef)(null),s=(0,Z.useRef)(null),[c,l]=(0,Z.useState)({available:null,margin:0}),[u,d]=(0,Z.useState)(null),f=vM(),p=(0,Z.useContext)(yM),m=e.map(t),h=vj(e.length,i.get(`tasks`)),g=c.available===!0&&h,_=(0,Z.useRef)(Symbol(`task-list`)),v=(0,Z.useRef)(()=>{});(0,Z.useLayoutEffect)(()=>{p?.registerList?.(_.current,m);let e=b.current;return e&&SM.set(e,{keys:m,handle:s,measure:()=>v.current()}),()=>{p?.registerList?.(_.current,null),e&&SM.delete(e)}});let y=xM(String(g),void 0,void 0,e=>m.includes(e)),b=y.ref;return(0,Z.useLayoutEffect)(()=>{let e=b.current,t=e?.closest(`[data-slot="main"]`);if(a.current=t??null,!e||!t){l(e=>e.available===!1?e:{available:!1,margin:0});return}let n=null,r=()=>{let r=Math.max(0,e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop);r!==n&&(n=r,l(e=>e.available===!0&&e.margin===r?e:{available:!0,margin:r}))};r(),v.current=r;let i=new ResizeObserver(r);for(let n=e;n&&n!==t;n=n.parentElement){i.observe(n);for(let e of n.parentElement?.children??[])i.observe(e)}return i.observe(t),()=>i.disconnect()},[]),(0,Q.jsx)(`div`,{ref:b,"data-slot":`task-list-items`,"data-virtualized":g,onFocusCapture:e=>{y.onFocusCapture(e),d(e.target.closest(`[data-task-item]`)?.dataset.taskItem??null)},onBlurCapture:e=>{y.onBlurCapture(e),e.relatedTarget&&!e.currentTarget.contains(e.relatedTarget)&&d(null)},children:g?(0,Q.jsx)(TM,{itemSize:r,items:e,keys:m,handle:s,scroll:a,margin:c.margin,focused:p?.focused??u,editing:f,children:n}):(c.available===null&&h?[]:e).map((t,r)=>(0,Q.jsx)(`div`,{"data-task-item":m[r],"data-first":r===0,"data-last":r===e.length-1,className:`task-list-flat-item`,children:n(t,r)},m[r]))})}function wM({layout:e,revision:t,visibilityRevision:n=``,children:r,...i}){let a=bM(e,t,!0);return(0,Q.jsx)(yM,{value:a.value,children:(0,Q.jsx)(DM,{revision:t,visibilityRevision:`${e}:${n}`,children:(0,Q.jsx)(`div`,{...i,...a.props,children:r})})})}function TM({items:e,keys:t,handle:n,scroll:r,margin:i,focused:a,editing:o,children:s,itemSize:c}){let[l,u]=(0,Z.useState)(!1),d=EM(r);return(0,Z.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(e=>{e.some(e=>e.contentRect.height>0)&&(u(!0),t.disconnect())});return t.observe(e),()=>t.disconnect()},[r]),(0,Q.jsx)(sM,{ref:n,...c===void 0?{}:{itemSize:c},scrollRef:r,startMargin:i,keepMounted:[...new Set([...!l&&e.length?[0]:[],...yj(t,a),...yj(t,d),...yj(t,o)])],data:e,children:(n,r)=>(0,Q.jsx)(`div`,{"data-task-item":t[r],"data-first":r===0,"data-last":r===e.length-1,children:s(n,r)},t[r])})}function EM(e){let[t,n]=(0,Z.useState)(null),r=(0,Z.useRef)(t);return(0,Z.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let i=e=>{if(e.target!==t)return;let i=t.contains(document.activeElement)?document.activeElement.closest(`[data-task-item]`)?.dataset.taskItem??null:null;i!==r.current&&(r.current=i,(0,sf.flushSync)(()=>n(i)))};return document.addEventListener(`scroll`,i,{capture:!0,passive:!0}),()=>document.removeEventListener(`scroll`,i,{capture:!0})},[e]),t}var DM=class extends Z.Component{root={current:null};owner(){return this.root.current?.closest(`[data-slot="main"]`)??null}getSnapshotBeforeUpdate(e){if(e.revision===this.props.revision&&e.visibilityRevision===this.props.visibilityRevision)return null;let t=this.owner();if(!t||!this.root.current)return null;let n=t.getBoundingClientRect();for(let e of this.root.current.querySelectorAll(`[data-task-item]`)){let r=e.getBoundingClientRect();if(r.bottom>n.top&&r.top<n.bottom)return{key:e.dataset.taskItem,top:r.top,scrollTop:t.scrollTop}}return{key:null,top:0,scrollTop:t.scrollTop}}componentDidUpdate(e,t,n){let r=this.owner();if(!n||!r)return;let i=n.key===null?null:this.currentTop(n.key);i!==null&&Math.abs(i-n.top)>.5&&(r.scrollTop+=i-n.top),queueMicrotask(()=>{r.isConnected&&(0,sf.flushSync)(()=>{for(let e of this.root.current?.querySelectorAll(`[data-slot="task-list-items"]`)??[])SM.get(e)?.measure();r.scrollTop!==n.scrollTop&&r.dispatchEvent(new Event(`scroll`))})})}currentTop(e){for(let t of this.root.current?.querySelectorAll(`[data-task-item]`)??[])if(t.dataset.taskItem===e)return t.getBoundingClientRect().top;for(let t of this.root.current?.querySelectorAll(`[data-slot="task-list-items"]`)??[]){let n=SM.get(t),r=n?.keys.indexOf(e)??-1,i=n?.handle.current;if(r>=0&&i)return t.getBoundingClientRect().top+i.getItemOffset(r)}return null}render(){return(0,Q.jsx)(`div`,{ref:this.root,style:{display:`contents`},children:this.props.children})}};function OM(e){return e===void 0?`unknown`:new Intl.NumberFormat().format(e)}function kM(e,t){return`Input tokens: ${OM(e)}; output tokens: ${OM(t)}`}function AM(e,t,n=`compact`){let r=e===void 0?`—`:Ka(e),i=t===void 0?`—`:Ka(t);return n===`table`?`${r} / ${i}`:`IN ${r} · OUT ${i}`}function jM({inputTokens:e,outputTokens:t,variant:n=`compact`,omitWhenUnknown:r=!0,className:i,title:a}){return r&&e===void 0&&t===void 0?null:(0,Q.jsx)(`span`,{"data-slot":`directional-usage`,"aria-label":kM(e,t),title:a,className:C(`font-mono tabular-nums`,i),children:AM(e,t,n)})}function MM({className:e,dot:t,shape:n=`filled`,pulse:r=!1,children:i,...a}){return(0,Q.jsxs)(`span`,{"data-slot":`pill`,className:C(`inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-[3px] text-xs font-medium whitespace-nowrap text-muted-foreground`,e),...a,children:[t?(0,Q.jsx)($,{tone:t,shape:n,pulse:r}):null,i]})}var NM=[{value:`all`,label:`All`},{value:`direct`,label:`Direct tasks`},{value:`automations`,label:`Automations`}];function PM(e){return e?NM:NM.filter(e=>e.value!==`automations`)}function FM(e,t){return e===`automations`&&!t?`all`:e}function IM(e){return e===`direct`||e===`automations`?e:`all`}function LM(e,t){return t===`all`||F(e)===(t===`automations`)}function RM(e){return e===`all`?void 0:e===`automations`}function zM(e,t){let n={all:0,direct:0,automations:0};for(let r of e)zr(r)||r.archived!==(t===`archived`)||(n.all+=1,F(r)?n.automations+=1:n.direct+=1);return n}function BM(e,t,n,r,i){let a=Vr(e).archived,o=a>=200;if(n===`all`)return i??(o?`200+`:a);let s=zM(t,`archived`)[n];return o&&r!==!1?`${s}+`:s}function VM(e){return e.rows.map(e=>e.run)}function HM(e,t){switch(e){case`Needs you`:return`pending`;case`Working`:return`running`;case`Archived`:return`neutral`;case`Finished`:return t.some(e=>Ce(e).bucket===`error`)?`danger`:`success`}}function UM(e,t,n){return Rr(e,t,Lr(n))}var WM=(e,t)=>JSON.stringify([e,t]);function GM(e,t,n){let r=new Map,i=e.map(e=>{let{run:t}=e,n=WM(t.projectId,t.id);r.set(n,e);let i=t.delegation;return{...t,id:n,...i&&`parentRunId`in i?{delegation:{...i,parentRunId:WM(t.projectId,i.parentRunId)}}:{}}}),a=new Map;for(let e of n){let t=a.get(e.projectId);t?t.push(e):a.set(e.projectId,[e])}let o=new Map;for(let[e,t]of a)for(let[n,r]of Lr(t))o.set(WM(e,n),r);let s=e=>r.get(e.id);return Rr(i,t,o).map(e=>({label:e.label,rows:e.rows.map(e=>({kind:`run`,run:s(e.run),queuePosition:e.queuePosition}))}))}function KM(e){return[e.run]}var qM=/^- \S+ — (?:(?:turn complete|step ".*" complete|step ".*" ended without done|session idle-closed) — |worktree setup (?:done in|failed —|skipped —) )/;function JM(e,t=3){let n=Ye(e,`## Progress log`);if(n<0)return[];let r=[];for(let i of e.slice(qe(e,n)).split(`
|
|
14
|
-
`)){if(r.length>=t||i.startsWith(`## `))break;let e=i.trim();!e||qM.test(e)||r.push(e.replace(/^[-*] /,``))}return r}function YM({origin:e,counts:t,automations:n,onChange:r}){return(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Task origin`,"data-slot":`origin-filter`,className:`flex flex-wrap items-center gap-1.5`,children:PM(n).map(n=>{let i=n.value===e;return(0,Q.jsxs)(`button`,{type:`button`,"data-origin":n.value,"aria-pressed":i,onClick:()=>r(n.value),className:C(`inline-flex min-h-11 items-center gap-1.5 rounded-full border border-border px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,i&&`border-accent-strong bg-accent-strong/10 text-accent-text`),children:[n.label,` `,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:t[n.value]})]},n.value)})})}function XM({onExpand:e,onCollapse:t}){return(0,Q.jsxs)(`div`,{"data-slot":`group-fold-controls`,className:`hidden flex-wrap items-center gap-2 md:ml-auto md:flex`,children:[(0,Q.jsx)(k,{type:`button`,variant:`ghost`,className:`min-h-11`,"data-action":`expand-groups`,onClick:e,children:`Expand groups`}),(0,Q.jsx)(k,{type:`button`,variant:`ghost`,className:`min-h-11`,"data-action":`collapse-groups`,onClick:t,children:`Collapse groups`})]})}function ZM({origin:e,counts:t,automations:n,onChange:r,labels:i,onSetAll:a}){return(0,Q.jsxs)(`div`,{"data-slot":`task-origin-row`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,Q.jsx)(YM,{origin:e,counts:t,automations:n,onChange:r}),i.length>0?(0,Q.jsx)(XM,{onExpand:()=>a(i,!1),onCollapse:()=>a(i,!0)}):null]})}var QM={pending:`needs you`,running:`working`,success:`finished`,danger:`contains failed tasks`,neutral:`archived`};function $M({id:e,label:t,count:n,tone:r,folded:i,collapsed:a,onToggle:o,children:s}){let c=a?Sa:ua;return(0,Q.jsxs)(`section`,{"data-slot":`task-status-group`,"data-bucket":t,"data-folded":i,"data-tone":r,"aria-labelledby":`${e}-heading`,className:`flex flex-col gap-2.5`,children:[(0,Q.jsx)(`h2`,{id:`${e}-heading`,className:`text-[13px] font-semibold text-foreground`,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`status-group-toggle`,"aria-expanded":!a,"aria-controls":`${e}-rows`,"aria-label":`${t} ${n}${r===`danger`?`, contains failed tasks`:``}`,onClick:o,className:`inline-flex min-h-11 items-center gap-2 rounded-md pr-2 hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,children:[(0,Q.jsx)(c,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Q.jsx)($,{tone:r,role:`img`,"aria-label":QM[r],title:QM[r]}),(0,Q.jsx)(`span`,{children:t}),` `,(0,Q.jsx)(`span`,{className:`font-normal tabular-nums text-muted-foreground`,children:n})]})}),(0,Q.jsx)(`div`,{id:`${e}-rows`,hidden:a,children:a?null:s})]})}function eN({automationId:e,automationName:t,project:n}){let r=e===void 0?`Direct task`:t??e;return(0,Q.jsxs)(`span`,{"data-slot":`task-origin`,"data-origin":e===void 0?`direct`:`automation`,className:`flex min-w-0 flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[n?(0,Q.jsxs)(Q.Fragment,{children:[n,(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`})]}):null,(0,Q.jsx)(`span`,{className:`min-w-0 break-words`,title:e===void 0?void 0:`Automation ${e}`,children:r})]})}function tN({projectId:e,runId:t,status:n,error:r,open:i}){let a=yr(e,t,!0),o=a.data===void 0?[]:JM(a.data);return(0,Q.jsxs)(`div`,{"data-slot":`task-preview`,className:`flex flex-col gap-3 rounded-md bg-muted/50 p-4 text-xs`,children:[(0,Q.jsx)(`p`,{className:`font-medium text-foreground first-letter:uppercase`,children:n}),r?(0,Q.jsx)(`p`,{"data-slot":`task-preview-error`,className:`break-words text-danger`,children:r}):null,a.isPending?(0,Q.jsx)(`p`,{role:`status`,className:`text-muted-foreground`,children:`Loading latest progress…`}):a.isError?(0,Q.jsx)(`p`,{"data-slot":`task-preview-unavailable`,className:`text-muted-foreground`,children:`Latest progress is unavailable.`}):o.length===0?(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:`No progress recorded yet.`}):(0,Q.jsx)(`ul`,{"aria-label":`Latest progress`,className:`flex flex-col gap-1 text-muted-foreground`,children:o.map((e,t)=>(0,Q.jsx)(`li`,{className:`break-words`,children:e},t))}),(0,Q.jsx)(`div`,{children:i})]})}var nN=`cez-task-list-folds`,rN=`cez-task-list-folds-changed`;function iN(e,t,n=new Set){let[r,i]=(0,Z.useState)(()=>yx(nN));(0,Z.useEffect)(()=>{let e=e=>{e instanceof StorageEvent&&e.key!==null&&e.key!==`cez-task-list-folds`||i(e instanceof CustomEvent?e.detail:yx(nN))};return window.addEventListener(`storage`,e),window.addEventListener(rN,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(rN,e)}},[]);let a=(0,Z.useCallback)(n=>JSON.stringify([e,t,n]),[e,t]),o=(0,Z.useCallback)(e=>{i(t=>{let n=e(t);return bx(n,nN),queueMicrotask(()=>window.dispatchEvent(new CustomEvent(rN,{detail:n}))),n})},[]),s=e=>r[a(e)]===!0;return{isFolded:s,isCollapsed:e=>s(e)&&!n.has(e),toggle:e=>o(t=>({...t,[a(e)]:t[a(e)]!==!0})),setAll:(e,t)=>o(n=>({...n,...Object.fromEntries(e.map(e=>[a(e),t]))})),only:(0,Z.useCallback)((e,t)=>o(n=>({...n,...Object.fromEntries(t.map(t=>[a(t),t!==e]))})),[o,a])}}function aN(e,t,n,r){let i=iN(e,t,n),a=(0,Z.useRef)(r);a.current=r;let[o,s]=Nk(),c=t===`active`?Fr(o.get(ai)):null,{only:l}=i;return(0,Z.useEffect)(()=>{c!==null&&(l(c,Or),a.current?.(),s(e=>(e.delete(ai),e)))},[c,l,s]),i}function oN(e){let t=e?.capabilities,n=t?.tokenMetrics!==!1;return{tokens:t?.tokenUsageMetrics??n,cost:t?.costMetrics??n}}function sN(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function cN(){let e=I(),t=Dn(),n=Z.useRef(0),r=Z.useRef(0),i=Z.useRef(Promise.resolve()),a=Z.useMemo(()=>mj(t.data?.taskTable?.expandedColumns),[t.data?.taskTable?.expandedColumns]),o=Z.useCallback(t=>{if(!dj.find(e=>e.id===t)?.canFold)return;let a=e.getQueryData(V.uiState);if(a===void 0)return;let o=sN(a?.taskTable),s={...o,expandedColumns:gj(o.expandedColumns,t)};e.setQueryData(V.uiState,{...a,taskTable:s});let c=++n.current;r.current=c;let l=i.current.then(async()=>{let t=await Je({taskTable:s},{keepalive:!0});c===r.current&&e.setQueryData(V.uiState,t)});i.current=l.catch(t=>{G(t instanceof Error?t.message:String(t),{tone:`danger`}),c===r.current&&e.invalidateQueries({queryKey:V.uiState})})},[e]);return{expandedColumns:a,isExpanded:Z.useCallback(e=>hj(e,a),[a]),toggleColumn:o,isPending:t.isPending}}var lN=()=>void 0;function uN({runs:e,view:t,onViewChange:n,onArchiveFinished:r,archivePending:i=!1,onMarkAllRead:a,onRename:o,onTogglePin:s,now:c=Date.now(),showTokens:l=!0,showCost:u=!0,expandedColumns:d=mj(void 0),onToggleColumn:f=()=>void 0,columnsPending:p=!1,projectName:m,error:h,onRetry:g,archivedPages:_,archivedTotal:v,onArchivedSearch:y,origin:b,onOriginChange:x,automations:S,urlQuery:C=``,onQueryChange:w,foldScope:T=`project`,automationName:E=lN}){let[D,O]=dN(C,w);Z.useEffect(()=>{y?.(D.trim())},[y,D]);let[A,j]=pN(b,x,S),[M,ee]=Z.useState(!1),te=ci(),{expandedRuns:ne,toggleExpandedRun:re}=uj(),ie=Z.useRef(null),N=Z.useMemo(()=>e??[],[e]),P=Z.useMemo(()=>mN({all:N,view:t,query:D,origin:A,archivedPages:_,archivedTotal:v,automationName:E}),[N,t,D,A,_,v,E]),{groups:F,needle:ae}=P,oe=Z.useMemo(()=>_j({tokens:l,cost:u}),[l,u]),se=aN(T,t,new Set(ae?F.map(e=>e.label):[]),()=>O(``)),ce=t===`archived`?void 0:s;return(0,Q.jsx)(pM,{runs:_?[...N,..._.runs]:N,onRename:o,children:(0,Q.jsxs)(wM,{layout:`${te}:${M}`,revision:F,visibilityRevision:JSON.stringify([Br.map(se.isCollapsed),[...ne].sort(),t,d]),"data-route":`tasks`,"data-presentation":M?`resources`:`summary`,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:[(0,Q.jsxs)(`header`,{ref:ie,className:`flex shrink-0 flex-col gap-[22px]`,children:[(0,Q.jsx)(fN,{projectName:m,detailedTable:M}),(0,Q.jsxs)(`div`,{className:`flex gap-6 border-b border-border`,children:[(0,Q.jsx)(EN,{view:`active`,current:t,onSelect:n,count:P.activeCount,children:`Active`}),(0,Q.jsx)(EN,{view:`archived`,current:t,onSelect:n,count:P.archivedCount,children:`Archived`})]}),(0,Q.jsxs)(`div`,{"data-slot":`tasks-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,Q.jsx)(gN,{view:t,unread:P.unread,finished:P.finished,archivePending:i,headerRef:ie,onMarkAllRead:()=>a(RM(A)),onArchiveFinished:()=>r(RM(A))}),(0,Q.jsxs)(`div`,{className:`relative order-first w-full md:w-auto md:min-w-64 md:flex-1`,children:[(0,Q.jsx)(Yi,{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,Q.jsx)(`input`,{type:`text`,value:D,onChange:e=>O(e.target.value),placeholder:`Search tasks or automations…`,"aria-label":`Search tasks`,className:`h-11 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,Q.jsx)(_N,{columns:oe,expandedColumns:d,columnsPending:p,onToggleColumn:f,detailedTable:M,onToggleDetailed:()=>ee(e=>!e)}),(0,Q.jsx)(k,{asChild:!0,"data-slot":`new-task-inline`,className:`min-h-11 inline-flex max-md:hidden`,children:(0,Q.jsxs)(Y,{to:`/new`,children:[(0,Q.jsx)(zi,{"aria-hidden":`true`}),`New task`]})})]}),(0,Q.jsx)(ZM,{origin:A,counts:P.originTotals,automations:S,onChange:j,labels:F.map(e=>e.label),onSetAll:se.setAll})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[e===void 0?(0,Q.jsx)(yN,{error:h,onRetry:g}):(0,Q.jsx)(vN,{view:t,query:D,origin:A,onShowAll:()=>{O(``),j(`all`)},caption:hN(P.visibleCount,P.incomplete,ae),captionOnPhones:ae!==``||P.incomplete,groups:F,folds:se,grouped:{desktop:te,expandedRuns:ne,toggleExpandedRun:re,detailedTable:M,columns:oe,expandedColumns:d,onToggleColumn:f,columnsPending:p,onRename:o,onTogglePin:ce,now:c,showTokens:l,showCost:u,automationName:E}}),t===`archived`&&_?(0,Q.jsx)(bN,{pages:_}):null]})]})})}function dN(e,t){let[n,r]=Z.useState(e),i=Z.useRef(e),a=Z.useRef(e),o=Z.useRef([]);return Z.useEffect(()=>{if(e===i.current)return;i.current=e;let t=o.current.indexOf(e);o.current=t===-1?[]:o.current.slice(t+1),t===-1&&e!==a.current&&r(e)},[e]),Z.useEffect(()=>{a.current=n.trim(),t?.(n,e=>{o.current.push(e)})},[t,n]),[n,r]}function fN({projectName:e,detailedTable:t}){return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`Project tasks`}),(0,Q.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[e?`${e} · `:``,t?`Every resource column shown. Fold columns without losing the saved view.`:`Review runs, pull requests and resource usage.`]})]})}function pN(e,t,n){let[r,i]=Z.useState(`all`);return[FM(e??r,n),t??i]}function mN({all:e,view:t,query:n,origin:r,archivedPages:i,archivedTotal:a,automationName:o}){let s=n.trim(),c=e=>e.automationId===void 0?``:o(e.automationId)??e.automationId,l=i?.query===s,u=new Set(l?i.runs.map(e=>e.id):[]),d=Nr(e,l||s===``?i?.runs??[]:[]).slice(e.length),f=pi(e,n,c),p=new Set(f.map(e=>e.id)),m=pi(e.filter(e=>u.has(e.id)&&!p.has(e.id)),``),h=e=>LM(e,r),g=UM([...f,...m,...pi(d,``)].filter(h),t,e),_=Nr(e,i?.query===``?i.runs:[]),v=Vr(e).archived>=200,y=e.filter(h);return{groups:g,needle:s,visibleCount:g.reduce((e,t)=>e+VM(t).length,0),originTotals:zM(_,t),activeCount:zM(e,`active`)[r],archivedCount:BM(e,_,r,i?.plainHasMore,a),incomplete:t===`archived`&&v&&i?.hasMore!==!1,finished:$r(y),unread:Fh(y)}}function hN(e,t,n){return`${e} ${e===1?`task`:`tasks`}${t?` loaded`:``}${n?` matching “${n}”`:``}`}function gN({view:e,unread:t,finished:n,archivePending:r,headerRef:i,onMarkAllRead:a,onArchiveFinished:o}){let s=Z.useRef(!1),[c,l]=Z.useState(!1),u=n>0||r;return Z.useEffect(()=>{let e=window.matchMedia?.(mi);if(!e)return;let t=()=>{e.matches&&l(!1)};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,Q.jsxs)(Q.Fragment,{children:[t>0?(0,Q.jsxs)(k,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`mark-all-read`,className:`hidden md:inline-flex`,onClick:a,children:[(0,Q.jsx)($l,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read`,` `,(0,Q.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:t})]}):null,e===`active`&&n>0?(0,Q.jsxs)(k,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,className:`inline-flex`,disabled:r,"aria-busy":r,onClick:o,children:[(0,Q.jsx)(ba,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`,` `,(0,Q.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:n})]}):null,e===`active`&&(u||t>0)?(0,Q.jsxs)(No,{open:c,onOpenChange:l,children:[(0,Q.jsx)(Ao,{asChild:!0,children:(0,Q.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`md:hidden`,"aria-label":`Task actions`,"aria-busy":r,children:(0,Q.jsx)(hu,{"aria-hidden":`true`})})}),(0,Q.jsxs)(jo,{align:`end`,className:`md:hidden`,onCloseAutoFocus:e=>{(s.current||window.matchMedia?.(`(min-width: 48rem)`).matches)&&(e.preventDefault(),s.current=!1,i.current?.querySelector(`[data-view="active"]`)?.focus())},children:[u?(0,Q.jsxs)(Eo,{disabled:r||n===0,onSelect:()=>{s.current=!0,o()},children:[(0,Q.jsx)(ba,{"aria-hidden":`true`}),r?`Archiving…`:`Archive finished (${n})`]}):null,t>0?(0,Q.jsxs)(Eo,{onSelect:a,children:[(0,Q.jsx)($l,{"aria-hidden":`true`}),`Mark all read (${t})`]}):null]})]}):null]})}function _N({columns:e,expandedColumns:t,columnsPending:n,onToggleColumn:r,detailedTable:i,onToggleDetailed:a}){return(0,Q.jsxs)(fi,{children:[(0,Q.jsx)(li,{asChild:!0,children:(0,Q.jsx)(k,{"data-slot":`task-columns-trigger`,variant:`outline`,className:`hidden min-h-11 md:inline-flex`,children:`Columns`})}),(0,Q.jsxs)(Qr,{align:`end`,className:`w-72`,children:[(0,Q.jsx)(`h2`,{className:`mb-2 text-base font-medium`,children:`Visible columns`}),(0,Q.jsx)(`p`,{className:`mb-4 text-xs text-muted-foreground`,children:`Status and Task · Always visible`}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:e.filter(e=>e.canFold).map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(`input`,{"data-column-toggle":e.id,type:`checkbox`,checked:hj(e.id,t),disabled:n,onChange:()=>r(e.id)}),e.id===`diff`?`Diff`:e.id===`reference`?`Reference`:e.id===`memory`?`Memory`:e.label]},e.id))}),(0,Q.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Saved automatically. Tokens and cost appear only when supported.`}),(0,Q.jsx)(k,{variant:`outline`,className:`mt-4`,onClick:a,children:i?`Summary view`:`Resource columns`})]})]})}function vN({view:e,query:t,origin:n,onShowAll:r,caption:i,captionOnPhones:a,groups:o,folds:s,grouped:c}){return o.length===0?(0,Q.jsx)(xN,{view:e,query:t,origin:n,onShowAll:r}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{"data-slot":`tasks-result-count`,className:C(`mb-3 text-[12px] text-muted-foreground tabular-nums`,!a&&`max-md:hidden`),children:i}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-[22px]`,children:o.map(t=>{let n=VM(t);return(0,Q.jsx)($M,{id:`tasks-group-${e}-${t.label.replaceAll(` `,`-`)}`,label:t.label,count:n.length,tone:HM(t.label,n),folded:s.isFolded(t.label),collapsed:s.isCollapsed(t.label),onToggle:()=>s.toggle(t.label),children:(0,Q.jsx)(wN,{group:t,...c})},t.label)})}),(0,Q.jsx)(`p`,{className:`mt-[22px] text-[11px] text-muted-foreground`,children:`Resource details—including tokens, cost, CPU and peak memory—are available when a task row is expanded.`})]})}function yN({error:e,onRetry:t}){return e?(0,Q.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-border bg-card p-6`,children:[(0,Q.jsx)(`h2`,{className:`text-lg`,children:`Could not load tasks`}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e}),(0,Q.jsx)(k,{variant:`outline`,className:`mt-4`,onClick:t,children:`Retry`})]}):(0,Q.jsx)(`div`,{role:`status`,"aria-label":`Loading tasks`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading tasks…`})}function bN({pages:e}){return e.failed?(0,Q.jsxs)(`p`,{role:`alert`,"data-slot":`archived-older-error`,className:`mt-3.5 flex items-center justify-center gap-2.5 text-[13px] text-muted-foreground`,children:[`Could not load older archived tasks.`,(0,Q.jsx)(k,{variant:`outline`,className:`min-h-11`,onClick:e.onLoadMore,children:`Retry`})]}):e.hasMore?(0,Q.jsx)(k,{"data-slot":`archived-older`,variant:`outline`,className:`mt-3.5 min-h-11 self-center`,disabled:e.loading,onClick:e.onLoadMore,children:e.loading?`Loading older archived…`:`Show older archived`}):null}function xN({view:e,query:t,origin:n=`all`,onShowAll:r}){let i=t.trim(),a=i||n!==`all`?`search-miss`:e===`archived`?`archive`:`no-tasks`;return(0,Q.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":a,className:`flex flex-1 flex-col`,children:a===`search-miss`?(0,Q.jsx)(X,{heading:`h2`,icon:(0,Q.jsx)(no,{}),tone:`neutral`,title:`No matching tasks`,subtitle:i?`No tasks match “${i}”.`:n===`automations`?`No automation started a task here.`:`No task here was started directly.`,actions:r?(0,Q.jsx)(k,{variant:`outline`,className:`min-h-11`,"data-action":`clear-task-filters`,onClick:r,children:`Show all tasks`}):void 0}):a===`archive`?(0,Q.jsx)(X,{heading:`h2`,icon:(0,Q.jsx)(ba,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,Q.jsx)(X,{heading:`h2`,icon:(0,Q.jsx)(ju,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,Q.jsx)(k,{asChild:!0,children:(0,Q.jsxs)(Y,{to:`/new`,"data-new-task-action":!0,children:[(0,Q.jsx)(zi,{"aria-hidden":`true`}),`New task`]})})})})}function SN({rows:e,onRename:t,onTogglePin:n,now:r,showTokens:i,showCost:a,automationName:o,expandedRuns:s,toggleExpandedRun:c}){let l=xj(e.map(({run:e})=>e.id),s);return(0,Q.jsx)(`div`,{"data-slot":`tasks-summary`,children:(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-5`,role:`table`,"aria-rowcount":l.rowCount,children:[(0,Q.jsx)(`div`,{role:`row`,"aria-rowindex":1,className:`task-summary-grid`,children:[`Task`,`Workflow`,`Changes`,`Pull request`,`Started`].map(e=>(0,Q.jsx)(`div`,{role:`columnheader`,className:`h-8 border-b border-border text-start text-[12px] font-medium uppercase text-muted-foreground`,children:e},e))}),(0,Q.jsx)(CM,{itemSize:103,items:e,itemKey:({run:e})=>e.id,children:({run:e,queuePosition:u},d)=>(0,Q.jsx)(CN,{run:e,queuePosition:u,rowIndex:l.indexes[d],onRename:t,onTogglePin:n,now:r,showTokens:i,showCost:a,automationName:o,open:s.has(e.id),toggleExpandedRun:c})})]})})}var CN=Z.memo(function({run:e,queuePosition:t,rowIndex:n,onRename:r,onTogglePin:i,now:a,showTokens:o,showCost:s,automationName:c,open:l,toggleExpandedRun:u}){let d=Ce(e),f=si(e),p=yi(e),m=`task-resources-${e.id}`;return(0,Q.jsxs)(`div`,{role:`rowgroup`,children:[(0,Q.jsxs)(`div`,{role:`row`,"aria-rowindex":n,"data-status":e.status,"data-slot":`task-summary-row`,"data-run-id":e.id,className:`task-summary-grid group/row`,children:[(0,Q.jsxs)(`div`,{role:`cell`,className:`py-5 pr-4 align-top`,children:[(0,Q.jsx)(FN,{run:e,to:`/tasks/${e.id}`,onRename:r,onTogglePin:i}),(0,Q.jsx)(`div`,{className:`mt-1`,children:(0,Q.jsx)(NN,{run:e,automationName:c})}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-task-control":`resources`,"aria-label":`${l?`Hide`:`Show`} resources for ${xi(e)}`,"aria-expanded":l,"aria-controls":m,"aria-describedby":`summary-status-${e.id}`,onClick:()=>u(e.id),className:`inline-flex min-h-[26px] items-center gap-1 rounded-md p-0 text-[11px] text-muted-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:(0,Q.jsxs)(MM,{id:`summary-status-${e.id}`,dot:d.tone,shape:d.shape,pulse:d.pulse,children:[d.label,f?` ${f.label}`:``]})}),e.status===`queued`&&t!==null?(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`#`,t,` in queue`]}):null]})]}),(0,Q.jsx)(`div`,{role:`cell`,className:`truncate pr-3 text-xs text-muted-foreground`,title:vi(e),children:vi(e)}),(0,Q.jsx)(`div`,{role:`cell`,className:`pr-2 text-xs`,children:e.diffStat?(0,Q.jsx)(pb,{stat:e.diffStat}):(0,Q.jsx)(VN,{})}),(0,Q.jsx)(`div`,{role:`cell`,className:`pr-2`,children:p?(0,Q.jsx)(Kb,{run:e,reference:p,compact:!0}):(0,Q.jsx)(VN,{})}),(0,Q.jsx)(`div`,{role:`cell`,className:`text-xs text-muted-foreground`,children:Ga(e.startedAt??e.createdAt,a)})]}),l?(0,Q.jsx)(`div`,{role:`row`,"aria-rowindex":n+1,"data-run-id":e.id,children:(0,Q.jsx)(`div`,{role:`cell`,"aria-colspan":5,className:`border-b border-border pb-5`,children:(0,Q.jsxs)(`div`,{id:m,className:`flex flex-col gap-3`,children:[(0,Q.jsx)(tN,{runId:e.id,status:d.label,error:e.error,open:(0,Q.jsx)(k,{asChild:!0,variant:`outline`,className:`min-h-11`,children:(0,Q.jsxs)(Y,{"data-task-control":`open`,to:`/tasks/${e.id}`,children:[`Open task`,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`: `,xi(e)]})]})})}),(0,Q.jsx)(`div`,{className:`rounded-md bg-muted/50 p-4`,children:(0,Q.jsx)(TN,{run:e,showTokens:o,showCost:s})})]})})}):null]})});function wN({desktop:e,expandedRuns:t,toggleExpandedRun:n,group:r,detailedTable:i,columns:a,expandedColumns:o,onToggleColumn:s,columnsPending:c,onRename:l,onTogglePin:u,now:d,showTokens:f,showCost:p,automationName:m}){let h=r.rows.flatMap(e=>KM(e).map(t=>({run:t,queuePosition:t.status===`queued`?e.queuePosition:null})));return(0,Q.jsxs)(Q.Fragment,{children:[e&&!i?(0,Q.jsx)(SN,{expandedRuns:t,toggleExpandedRun:n,rows:h,onRename:l,onTogglePin:u,now:d,showTokens:f,showCost:p,automationName:m}):null,e&&i?(0,Q.jsx)(`div`,{"data-slot":`tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card`,children:(0,Q.jsx)(e_,{children:(0,Q.jsxs)(`div`,{role:`table`,"aria-rowcount":h.length+1,className:`task-resource-grid`,style:bj(a,o),children:[(0,Q.jsx)(`div`,{role:`row`,"aria-rowindex":1,className:`task-resource-row`,children:a.map(e=>(0,Q.jsx)(ON,{column:e,expanded:hj(e.id,o),onToggle:s,disabled:c},e.id))}),(0,Q.jsx)(CM,{itemSize:50,items:h,itemKey:({run:e})=>e.id,children:({run:e,queuePosition:t},n)=>(0,Q.jsx)(jN,{rowIndex:n+2,run:e,queuePosition:t,onRename:l,onTogglePin:u,now:d,columns:a,expandedColumns:o,automationName:m})})]})})}):null,e?null:(0,Q.jsx)(`div`,{"data-slot":`task-cards`,className:`flex flex-col rounded-lg border border-border bg-card p-5`,children:(0,Q.jsx)(CM,{itemSize:178,items:h,itemKey:({run:e})=>e.id,children:({run:e,queuePosition:r})=>(0,Q.jsx)(zN,{resourcesOpen:t.has(e.id),onToggleResources:n,run:e,queuePosition:r,now:d,showTokens:f,showCost:p,onTogglePin:u,automationName:m},e.id)})})]})}function TN({run:e,showTokens:t,showCost:n}){let r=Ar(e,Cl(e.id));return(0,Q.jsxs)(`dl`,{className:`grid grid-cols-2 gap-4 text-xs md:grid-cols-4`,children:[t?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Tokens in / out`}),(0,Q.jsx)(`dd`,{className:`mt-1`,children:(0,Q.jsx)(jM,{inputTokens:e.inputTokens,outputTokens:e.outputTokens,omitWhenUnknown:!1})})]}):null,n?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Cost`}),(0,Q.jsx)(`dd`,{className:`mt-1`,children:oi(e.costUsd)||`—`})]}):null,(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`CPU`}),(0,Q.jsx)(`dd`,{className:`mt-1`,title:r.cpu.title,children:r.cpu.text||`—`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Memory`}),(0,Q.jsx)(`dd`,{className:`mt-1`,title:r.mem.title,children:r.mem.text||`—`})]}),e.branch?(0,Q.jsxs)(`div`,{className:`col-span-2`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Branch`}),(0,Q.jsx)(`dd`,{className:`mt-1 break-all`,children:e.branch})]}):null]})}function EN({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:C(`flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground`,a&&`border-accent-strong font-semibold text-accent-text`),children:[i,r===0?null:(0,Q.jsxs)(`span`,{className:`tabular-nums`,children:[` · `,r]})]})}function DN({children:e,right:t=!1,columnId:n,folded:r=!1}){return(0,Q.jsx)(`div`,{role:`columnheader`,"data-column-id":n,"data-folded":r||void 0,className:C(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-supporting-foreground uppercase first:pl-4 last:pr-4`,t&&`text-right`,r&&`px-0 first:pl-0 last:pr-0`),children:e})}function ON({column:e,expanded:t,onToggle:n,disabled:r}){if(!e.canFold)return(0,Q.jsx)(DN,{columnId:e.id,right:e.align===`right`,children:e.label});let i=t?`Fold`:`Expand`;return(0,Q.jsx)(DN,{columnId:e.id,right:e.align===`right`,folded:!t,children:(0,Q.jsxs)(t_,{children:[(0,Q.jsx)(n_,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`${i} ${e.label} column`,"aria-pressed":t,disabled:r,onClick:()=>n(e.id),className:C(`inline-flex h-8 w-full items-center gap-1 rounded-sm px-0.5 text-inherit outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-wait disabled:opacity-60`,e.align===`right`?`justify-end`:`justify-start`,!t&&`justify-center px-0`),children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{children:e.label}),(0,Q.jsx)(iu,{className:`size-3 opacity-55`,"aria-hidden":`true`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(kN,{icon:e.icon}),(0,Q.jsx)(au,{className:`size-3 opacity-70`,"aria-hidden":`true`})]})})}),(0,Q.jsxs)(r_,{side:`top`,children:[e.label,` · `,i,` column`]})]})})}function kN({icon:e}){let t=`size-3.5`;switch(e){case`workflow`:return(0,Q.jsx)(Ca,{className:t,"aria-hidden":`true`});case`branch`:return(0,Q.jsx)(ji,{className:t,"aria-hidden":`true`});case`diff`:return(0,Q.jsx)(Ni,{className:t,"aria-hidden":`true`});case`reference`:return(0,Q.jsx)(Au,{className:t,"aria-hidden":`true`});case`tokens`:return(0,Q.jsx)(cu,{className:t,"aria-hidden":`true`});case`cost`:return(0,Q.jsx)(mu,{className:t,"aria-hidden":`true`});case`cpu`:return(0,Q.jsx)(Ea,{className:t,"aria-hidden":`true`});case`memory`:return(0,Q.jsx)(Mu,{className:t,"aria-hidden":`true`});case`started`:return(0,Q.jsx)(ou,{className:t,"aria-hidden":`true`});default:return null}}var AN=`h-[88px] border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`,jN=Z.memo(function({rowIndex:e,run:t,queuePosition:n,onRename:r,onTogglePin:i,now:a,columns:o,expandedColumns:s,automationName:c}){let l=gs(),u=Ce(t),d=si(t),f=`/tasks/${t.id}`,p=oi(t.costUsd),m=yi(t);return(0,Q.jsx)(`div`,{role:`row`,"aria-rowindex":e,"data-slot":`task-table-row`,"data-run-id":t.id,onClick:e=>{e.target.closest(`a, button, input`)||l(f)},className:`task-resource-row group/row cursor-pointer hover:bg-muted`,children:o.map(e=>{if(e.id===`memory`)return null;if(e.id===`cpu`){let r=hj(`cpu`,s),i=hj(`memory`,s);return n!==null&&(r||i)?(0,Q.jsxs)(`div`,{role:`cell`,"data-slot":`queue-note`,"data-column-id":`cpu-memory`,"aria-colspan":2,style:{gridColumn:`span 2`},className:C(AN,`text-right font-mono text-[11px] text-supporting-foreground`),children:[`#`,n,` in queue`]},e.id):(0,Q.jsx)(IN,{run:t,cpuExpanded:r,memoryExpanded:i},e.id)}return(0,Q.jsx)(MN,{column:e,expanded:hj(e.id,s),run:t,attention:u,scheduled:d,reference:m,cost:p,to:f,onRename:r,onTogglePin:i,now:a,automationName:c},e.id)})})});function MN({column:e,expanded:t,run:n,attention:r,scheduled:i,reference:a,cost:o,to:s,onRename:c,onTogglePin:l,now:u,automationName:d}){if(!t)return(0,Q.jsx)(PN,{column:e.id});switch(e.id){case`status`:return(0,Q.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`overflow-hidden`),children:(0,Q.jsx)(MM,{dot:r.tone,shape:r.shape,pulse:r.pulse,title:i?.title??r.label,className:`w-full max-w-full overflow-hidden`,children:(0,Q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[r.label,i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:i.label})]}):null]})})});case`task`:return(0,Q.jsxs)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`min-w-[320px] max-w-0 whitespace-normal`),children:[(0,Q.jsx)(FN,{run:n,to:s,onRename:c,onTogglePin:l}),(0,Q.jsx)(`div`,{className:`mt-1`,children:(0,Q.jsx)(NN,{run:n,automationName:d})})]});case`workflow`:return(0,Q.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`max-w-0 truncate text-[13px] text-muted-foreground`),children:vi(n)});case`branch`:return(0,Q.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`max-w-0 overflow-hidden`),children:n.branch?(0,Q.jsx)(HN,{branch:n.branch}):(0,Q.jsx)(VN,{})});case`diff`:return(0,Q.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`overflow-hidden`),children:n.diffStat?(0,Q.jsx)(pb,{stat:n.diffStat,compact:!0,className:`block max-w-full`}):(0,Q.jsx)(VN,{})});case`reference`:return(0,Q.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`overflow-hidden`),children:a?(0,Q.jsx)(Kb,{run:n,reference:a,compact:!0,className:`max-w-full overflow-hidden`}):(0,Q.jsx)(VN,{})});case`tokens`:let t=kM(n.inputTokens,n.outputTokens);return(0,Q.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`text-right text-xs text-muted-foreground`),children:(0,Q.jsx)(jM,{inputTokens:n.inputTokens,outputTokens:n.outputTokens,variant:`table`,omitWhenUnknown:!1,title:t,className:`block max-w-full overflow-hidden text-ellipsis`})});case`cost`:return(0,Q.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:o?(0,Q.jsx)(RN,{text:o,accessibleText:`$${n.costUsd}`}):(0,Q.jsx)(VN,{})});case`started`:return(0,Q.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`text-right text-xs text-supporting-foreground tabular-nums`),children:Ga(n.startedAt??n.createdAt,u)});default:return null}}function NN({run:e,automationName:t}){return(0,Q.jsx)(eN,{automationId:e.automationId,automationName:e.automationId===void 0?void 0:t(e.automationId)})}function PN({column:e}){return(0,Q.jsx)(`div`,{role:`cell`,"aria-hidden":`true`,"data-column-id":e,"data-folded":`true`,className:C(AN,`px-0 first:pl-0 last:pr-0`)})}function FN({run:e,to:t,onTogglePin:n}){let r=xi(e),i=mM(e),a=Zr(e),o=Ph(e);return i.editing?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-slot":`table-title-editor`,children:[(0,Q.jsx)(lM,{editor:i,className:`basis-full text-[13px] font-medium`}),(0,Q.jsx)(k,{size:`sm`,"aria-label":`Save title`,onMouseDown:e=>e.preventDefault(),onClick:i.commit,children:`Save`}),(0,Q.jsx)(k,{size:`sm`,variant:`outline`,"aria-label":`Cancel rename`,onMouseDown:e=>e.preventDefault(),onClick:i.cancel,children:`Cancel`})]}):(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.delegation?.role===`worker`?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,Q.jsx)(Y,{"data-task-control":`title`,to:t,title:r,className:C(`line-clamp-2 min-w-0 flex-1 whitespace-normal rounded-sm text-[13px] leading-[18px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,a?`font-semibold text-foreground`:o?`font-normal text-foreground`:`font-medium`),children:r}),a?(0,Q.jsx)($,{tone:Ih(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null,(0,Q.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:i.begin,className:`shrink-0 rounded-sm p-0.5 text-soft-foreground opacity-0 transition-opacity group-hover/row:opacity-100 hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Q.jsx)(Ru,{className:`size-3`,"aria-hidden":`true`})}),n?(0,Q.jsx)(Xb,{pinned:!!e.pinned,onToggle:t=>n(e,t),className:`size-[19px] opacity-0 group-hover/row:opacity-100 focus-visible:opacity-100 no-hover:opacity-100 data-[pinned=true]:opacity-100`}):null]})}function IN({run:e,cpuExpanded:t,memoryExpanded:n}){let r=Ar(e,Cl(e.id));return(0,Q.jsxs)(Q.Fragment,{children:[t?(0,Q.jsx)(LN,{column:`cpu`,cell:r.cpu}):(0,Q.jsx)(PN,{column:`cpu`}),n?(0,Q.jsx)(LN,{column:`memory`,cell:r.mem}):(0,Q.jsx)(PN,{column:`memory`})]})}function LN({column:e,cell:t}){let n=t.text&&t.title?`${t.text}; ${t.title}`:t.text;return(0,Q.jsx)(`div`,{role:`cell`,"data-usage":e===`memory`?`mem`:e,"data-column-id":e,"data-usage-kind":t.kind,className:C(AN,`overflow-hidden`,`text-right font-mono tabular-nums`,t.kind===`live`&&`bg-accent-strong/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-[11px] text-supporting-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:(0,Q.jsx)(RN,{text:t.text||`—`,accessibleText:n||void 0})})}function RN({text:e,accessibleText:t}){return(0,Q.jsx)(`span`,{"data-slot":`bounded-metric`,...t?{"aria-label":t,title:t}:{},className:`block max-w-full overflow-hidden text-ellipsis`,children:e})}var zN=Z.memo(function({resourcesOpen:e,onToggleResources:t,run:n,queuePosition:r,now:i,showTokens:a,showCost:o,onTogglePin:s,automationName:c}){let l=gs(),u=Ce(n),d=si(n),f=`/tasks/${n.id}`,p=yi(n),m=Zr(n),h=Ph(n);return(0,Q.jsxs)(`div`,{"data-slot":`task-card`,"data-status":n.status,"data-run-id":n.id,onClick:e=>{e.target.closest(`a, button`)||l(f)},className:`cursor-pointer border-b border-border py-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2.5`,children:[(0,Q.jsx)(`button`,{"data-slot":`mobile-resources-toggle`,"data-task-control":`resources`,type:`button`,"aria-controls":`mobile-resources-${n.id}`,"aria-describedby":`mobile-status-${n.id}`,"aria-label":e?`Hide resources`:`Show resources`,title:e?`Hide resources`:`Show resources`,"aria-expanded":e,onClick:()=>t(n.id),children:(0,Q.jsxs)(MM,{id:`mobile-status-${n.id}`,dot:u.tone,shape:u.shape,pulse:u.pulse,className:`mt-px shrink-0`,title:d?.title,children:[u.label,d?(0,Q.jsx)(`span`,{className:`tabular-nums`,children:d.label}):null]})}),(0,Q.jsxs)(Y,{"data-task-control":`title`,to:f,className:C(`order-first w-full min-w-0 rounded-sm text-[14px] leading-[1.35] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,m?`font-semibold text-foreground`:h?`font-normal text-foreground`:`font-medium`),children:[n.delegation?.role===`worker`?(0,Q.jsx)(`span`,{className:`mr-2 text-xs text-muted-foreground`,children:`Worker`}):null,xi(n)]}),m?(0,Q.jsx)($,{tone:Ih(n),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`mt-1.5 shrink-0`}):null,(0,Q.jsx)(`div`,{className:`order-first w-full`,children:(0,Q.jsx)(NN,{run:n,automationName:c})}),s?(0,Q.jsx)(Xb,{pinned:!!n.pinned,onToggle:e=>s(n,e),className:`mt-px`}):null]}),(0,Q.jsxs)(`div`,{"data-slot":`mobile-task-meta`,className:`mt-4 grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-3 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:vi(n)}),r===null?n.diffStat?(0,Q.jsx)(pb,{stat:n.diffStat}):(0,Q.jsx)(VN,{}):(0,Q.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,r,` in queue`]}),(0,Q.jsx)(`span`,{children:Ga(n.startedAt??n.createdAt,i)})]}),p?(0,Q.jsx)(`div`,{className:`mt-3`,children:(0,Q.jsx)(Kb,{run:n,reference:p})}):null,e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`mt-3`,children:(0,Q.jsx)(tN,{runId:n.id,status:u.label,error:n.error,open:(0,Q.jsx)(k,{asChild:!0,variant:`outline`,className:`min-h-11`,children:(0,Q.jsxs)(Y,{"data-task-control":`open`,to:f,children:[`Open task`,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`: `,xi(n)]})]})})})}),(0,Q.jsx)(BN,{run:n,showTokens:a,showCost:o})]}):null]})});function BN({run:e,showTokens:t,showCost:n}){let r=Ar(e,Cl(e.id));return(0,Q.jsxs)(`dl`,{id:`mobile-resources-${e.id}`,className:`mt-3 grid grid-cols-2 gap-3 rounded-md bg-muted p-3 text-xs`,children:[e.branch?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:`Branch`}),(0,Q.jsx)(`dd`,{children:e.branch})]}):null,(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:`CPU`}),(0,Q.jsx)(`dd`,{children:r.cpu.text||`—`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:`Memory`}),(0,Q.jsx)(`dd`,{children:r.mem.text||`—`})]}),t?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:`IN / OUT`}),(0,Q.jsx)(`dd`,{children:(0,Q.jsx)(jM,{inputTokens:e.inputTokens,outputTokens:e.outputTokens})})]}):null,n?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:`Cost`}),(0,Q.jsx)(`dd`,{children:oi(e.costUsd)||`—`})]}):null]})}function VN(){return(0,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function HN({branch:e}){return(0,Q.jsx)(`span`,{title:e,className:`block truncate rounded-[6px] bg-muted px-1.5 py-0.5 font-mono text-[11px] font-medium text-muted-foreground`,children:e})}function UN(){let e=xr(),t=oN(En().data),n=Av(),{view:r,setView:i,origin:a,setOrigin:o,urlQuery:s,writeQuery:c}=GN(),l=Rn(),u=I(),d=JN(e.data,r),f=H({mutationFn:e=>Ct(fr(),void 0,e),onSuccess:()=>l.invalidateAfter(`runs`,()=>fr()),onError:e=>G(e.message,{tone:`danger`})}),p=H({mutationFn:e=>De(e),onSuccess:()=>u.invalidateQueries({queryKey:U.runs.all}),onError:e=>G(e.message,{tone:`danger`})}),m=H({mutationFn:({id:e,title:t})=>Ue(e,{title:t}),onSuccess:()=>u.invalidateQueries({queryKey:U.runs.all}),onError:e=>G(e.message,{tone:`danger`})}),h=Sr(),g=hx(3e4),_=cN(),v=Mn(),y=Ln(void 0,{retryOnMount:!1}),b=bn({retryOnMount:!1}).data?.projects?.find(e=>e.id===v)?.name,x=[...e.data??[],...d.pages?.runs??[]].some(e=>e.automationId!==void 0),S=Yn([void 0],n&&x),C=Z.useCallback(e=>S(void 0,e),[S]),w=Z.useMemo(()=>v===void 0?[]:(e.data??[]).flatMap(e=>{let t=yi(e);return t?[{projectId:v,kind:t.kind,number:t.number}]:[]}),[e.data,v]),T=Z.useCallback((e,t)=>m.mutate({id:e,title:t}),[m.mutate]),E=Z.useCallback((e,t)=>h.mutate({id:e.id,pinned:t}),[h.mutate]);return(0,Q.jsx)(Za,{projectId:v,repoBase:y,requests:w,children:(0,Q.jsx)(uN,{runs:e.data,projectName:b,error:e.error?.message,onRetry:()=>void e.refetch(),view:r,onViewChange:i,origin:a,onOriginChange:o,automations:n,urlQuery:s,onQueryChange:c,foldScope:`project:${v??`default`}`,automationName:C,onArchiveFinished:e=>{f.isPending||f.mutate(e)},archivePending:f.isPending,onMarkAllRead:e=>p.mutate(e),onRename:T,onTogglePin:E,now:g,showTokens:t.tokens,showCost:t.cost,expandedColumns:_.expandedColumns,onToggleColumn:_.toggleColumn,columnsPending:_.isPending,archivedPages:d.pages,archivedTotal:d.total,onArchivedSearch:d.search})})}function WN(e,t){return n=>(t===null?n.delete(e):n.set(e,t),n)}function GN(){let[e,t]=Nk(),n=e.get(`archived`)===`1`?`archived`:`active`,r=IM(e.get(`origin`)),[i,a]=Z.useState(n),[o,s]=Z.useState(r);Z.useEffect(()=>a(n),[n]),Z.useEffect(()=>s(r),[r]);let c=e.get(`q`)??``,l=Z.useRef(void 0);return Z.useEffect(()=>{let e=l;return()=>clearTimeout(e.current)},[]),{view:i,setView:e=>{a(e),t(WN(`archived`,e===`archived`?`1`:null))},origin:o,setOrigin:e=>{s(e),t(WN(`origin`,e===`all`?null:e))},urlQuery:c,writeQuery:Z.useCallback((e,n)=>{clearTimeout(l.current);let r=e.trim();l.current=setTimeout(()=>t(e=>{let t=e.get(`q`),i=WN(`q`,r===``?null:r)(e);return i.get(`q`)!==t&&n(r),i}),KN)},[t])}}var KN=250,qN=150;function JN(e,t){Rn();let n=I(),[r,i]=Z.useState(``),[a,o]=Z.useState(``);Z.useEffect(()=>{let e=setTimeout(()=>o(r),qN);return()=>clearTimeout(e)},[r]);let s=e!==void 0&&Vr(e).archived>=200,{data:c,isError:l,isPlaceholderData:u,hasNextPage:d,isFetchingNextPage:f,fetchNextPage:p,refetch:m}=hr(a,t===`archived`&&(a!==``||s)),h=c?.pages,g=Z.useMemo(()=>h||l?{runs:(h??[]).flatMap(e=>e.runs),query:u?null:a,hasMore:d,loading:f,onLoadMore:()=>void(h?p():m()),failed:l}:void 0,[h,l,u,a,d,f,p,m]),_=a===``?h:n.getQueryData(U.runs.archived(``))?.pages,v=_===void 0?void 0:_.at(-1)?.nextCursor!=null;return{pages:Z.useMemo(()=>g&&{...g,plainHasMore:v},[g,v]),total:_?.[0]?.total,search:i}}function YN({projects:e,perProjectLimit:t}){return e.length===0?null:(0,Q.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-[11px] text-soft-foreground`,children:[`Showing every active task and the newest `,t,` archived tasks per project — older archived tasks in`,` `,e.join(`, `),` are in that project’s own Tasks page.`]})}function XN({registry:e}){return e.length<=1?null:(0,Q.jsxs)(`section`,{"data-slot":`other-projects`,className:`rounded-lg border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold`,children:`Other projects`}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-col divide-y divide-border`,children:e.map(e=>(0,Q.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-[13px]`,children:e.name}),(0,Q.jsxs)(E,{to:hs(e.id,`/`),className:`inline-flex min-h-11 shrink-0 items-center rounded-md px-3 text-xs text-accent-text hover:bg-accent-strong/10`,children:[`View tasks`,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[` for `,e.name]})]})]},e.id))})]})}function ZN({view:e,filtered:t}){return t?(0,Q.jsx)(X,{heading:`h2`,icon:(0,Q.jsx)(no,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,Q.jsx)(X,{heading:`h2`,icon:(0,Q.jsx)(ba,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,Q.jsx)(X,{heading:`h2`,icon:(0,Q.jsx)(ju,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}function QN({groupBy:e,filterDetailsOpen:t,message:n,onRetry:r}){return(0,Q.jsx)(`div`,{"data-route":`global-tasks`,"data-presentation":e===`none`?`summary`:`cards`,"data-filter-details":t,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:(0,Q.jsx)(X,{icon:(0,Q.jsx)(Da,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:n,actions:(0,Q.jsx)(k,{variant:`outline`,onClick:r,children:`Retry`})})})}function $N({slot:e,label:t,options:n,selected:r,onToggle:i,onClear:a,searchPlaceholder:o,emptyLabel:s=`Nothing to filter by`}){let[c,l]=Z.useState(!1),u=r.length>0,d=r.length===1?n.find(e=>e.value===r[0])?.label??r[0]:`${r.length} selected`;return(0,Q.jsxs)(fi,{open:c,onOpenChange:l,children:[(0,Q.jsx)(li,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`facet-${e}`,"data-active":u?`true`:void 0,"aria-label":`Filter by ${t.toLowerCase()}`,className:C(`inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,u&&`border-accent-strong/40 bg-accent-strong/10 text-foreground`),children:[(0,Q.jsx)(`span`,{className:C(u&&`text-soft-foreground`),children:t}),u?(0,Q.jsx)(`span`,{className:`max-w-[140px] truncate font-semibold`,children:d}):null,(0,Q.jsx)(nu,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Q.jsxs)(Qr,{align:`start`,className:`w-64 p-0`,"data-testid":`facet-${e}-menu`,children:[(0,Q.jsxs)(Gs,{children:[(0,Q.jsx)(js,{placeholder:o??`Search ${t.toLowerCase()}…`}),(0,Q.jsxs)(Os,{children:[(0,Q.jsx)(Ws,{children:s}),(0,Q.jsx)(As,{children:n.map(e=>{let t=r.includes(e.value);return(0,Q.jsxs)(Ns,{value:e.label,onSelect:()=>i(e.value),"data-slot":`facet-option`,"data-value":e.value,"aria-checked":t,role:`option`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:C(`flex size-4 shrink-0 items-center justify-center rounded-[4px] border`,t?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-input`),children:t?(0,Q.jsx)(eu,{className:`size-3`}):null}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.count===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:e.count})]},e.value)})})]})]}),u?(0,Q.jsx)(`div`,{className:`border-t border-border p-1`,children:(0,Q.jsxs)(`button`,{type:`button`,"data-action":`facet-${e}-clear`,onClick:()=>a(),className:`w-full rounded-sm px-2 py-1.5 text-left text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[`Clear `,t.toLowerCase()]})}):null]})]})}function eP({label:e,count:t,selected:n,onToggle:r,slot:i,tone:a=`neutral`}){return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":i,"data-selected":n?`true`:void 0,"aria-pressed":n,onClick:r,className:C(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-xs font-medium transition-colors`,a===`tag`?`border-accent-strong/25 bg-accent-strong/10 text-accent-text hover:bg-accent-strong/20`:`border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground`,n&&`border-accent-strong bg-accent-strong text-accent-strong-foreground hover:bg-accent-strong`),children:[e,t===void 0?null:(0,Q.jsx)(`span`,{className:C(`font-mono text-[11px] tabular-nums`,!n&&`text-soft-foreground`),children:t})]})}function tP({slot:e,label:t,value:n,options:r,onChange:i,size:a=`compact`}){return(0,Q.jsx)(`div`,{"data-slot":e,role:`group`,"aria-label":t,className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:r.map(e=>{let t=e.value===n;return(0,Q.jsx)(`button`,{type:`button`,"data-value":e.value,"aria-pressed":t,disabled:e.disabled,title:e.title,onClick:()=>i(e.value),className:C(`flex h-6 items-center justify-center rounded-[6px] px-2.5 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,a===`touch`&&`h-11 px-4 text-[13px]`,t&&`bg-card font-semibold text-foreground shadow-xs`),children:e.label},e.value)})})}var nP=` untagged`,rP=[{value:`project`,label:`Project`},{value:`tag`,label:`Tag`},{value:`status`,label:`Status`},{value:`workflow`,label:`Workflow`}];function iP(e,t){return e===t?`none`:t}var aP={query:``,tags:[],statuses:[],workflows:[]};function oP(e,t){let{origin:n,...r}=e;return t===`all`?r:{...r,origin:t}}function sP(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function cP(e){return(e.projects?.length??0)+e.tags.length+e.statuses.length+e.workflows.length+(e.origin===void 0||e.origin===`all`?0:1)}function lP(e){return e.query.trim()!==``||cP(e)>0}function uP(e){return cP(e.filters)+(e.filters.query.trim()===``?0:1)+(e.groupBy===`none`?0:1)}function dP(e){return uP(e)>0}function fP(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.filter(e=>!zr(e)).map(e=>{let t=n.get(e.projectId);return{run:e,project:t,projectName:t?.name||e.projectId,tags:t?.tags??[]}})}function pP(e){let t=new Set;for(let n of e)t.add(n.run.workflow);return[...t].sort((e,t)=>e.localeCompare(t))}function mP(e){let t=new Set;for(let n of e)t.add(n.run.status);return[...t].sort((e,t)=>e.localeCompare(t))}function hP(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 gP=e=>e.tags.length===0?[nP]:e.tags,_P=(e,t)=>e.length===0||t.some(t=>e.includes(t)),vP=(e,t)=>{if(t.length===0)return!0;let n=gP(e).map(e=>e.toLowerCase());return t.some(e=>n.includes(e.toLowerCase()))};function yP(e,t){return{displayTitle:xi(e.run),projectName:e.projectName,tags:e.tags,automation:e.run.automationId===void 0?void 0:t(e)??e.run.automationId,references:()=>ni(e.run)}}function bP(e,t,n,r=()=>void 0){let i=t.query.trim()!==``;return e.filter(e=>(n===`archived`?!e.run.archived:e.run.archived)||!LM(e.run,t.origin??`all`)||!_P(t.projects??[],[e.run.projectId])||!_P(t.statuses,[e.run.status])||!_P(t.workflows,[e.run.workflow])||!vP(e,t.tags)?!1:!i||Gr(e.run,t.query,{scope:`shown`,extras:yP(e,r)}))}function xP(e,t,n,r,i){return bP(e,r===`origin`?{...t,origin:`all`}:{...t,[r]:[]},n,i)}function SP(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(nP,`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 CP(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var wP={query:`q`,project:`project`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,archived:`archived`,origin:`origin`},TP=new Set(rP.map(e=>e.value));function EP(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set(wP.query,n);for(let n of e.filters.tags)n===` untagged`?t.set(wP.untagged,`1`):t.append(wP.tag,n);for(let n of e.filters.projects??[])t.append(wP.project,n);for(let n of e.filters.statuses)t.append(wP.status,n);for(let n of e.filters.workflows)t.append(wP.workflow,n);return e.groupBy!==`none`&&t.set(wP.groupBy,e.groupBy),e.view===`archived`&&t.set(wP.archived,`1`),e.filters.origin!==void 0&&e.filters.origin!==`all`&&t.set(wP.origin,e.filters.origin),t}function DP(e,t){let n=e.getAll(wP.tag).filter(e=>e!==``);e.get(wP.untagged)===`1`&&n.push(nP);let r=e.get(wP.groupBy)??``,i=FM(IM(e.get(wP.origin)),t);return{filters:{query:e.get(wP.query)??``,...e.has(wP.project)?{projects:e.getAll(wP.project).filter(Boolean)}:{},tags:n,statuses:e.getAll(wP.status).filter(e=>e!==``),workflows:e.getAll(wP.workflow).filter(e=>e!==``),...i===`all`?{}:{origin:i}},groupBy:TP.has(r)?r:`none`,view:e.get(wP.archived)===`1`?`archived`:`active`}}var OP=15e3,kP=250,AP=1,jP=new Set([`done`,`failed`,`cancelled`]);function MP(){return PP({request:({task:e,archived:t})=>Nt(xn(e.run.id,{projectId:e.run.projectId}),t),patch:({archived:e})=>t=>({...t,archived:e})})}function NP(){return PP({request:({task:e,read:t})=>vt(xn(e.run.id,{projectId:e.run.projectId}),t),patch:({read:e})=>t=>{if(e)return{...t,seenAt:new Date().toISOString()};let{seenAt:n,...r}=t;return r}})}function PP({request:e,patch:t}){let n=Rn();return H({mutationFn:e,onMutate:e=>n.patchIndex(xn(e.task.run.id,{projectId:e.task.run.projectId}),()=>t(e)),onError:(e,t,n)=>{n?.rollback(),G(e.message,{tone:`danger`})},onSettled:(e,t,{task:r},i)=>{i?i.settle():n.invalidateAfter(`indexed`,xn(r.run.id,{projectId:r.run.projectId}))}})}function FP(){let{expandedRuns:e,toggleExpandedRun:t}=uj(),n=bn(),r=oN(En().data),i=Jn(!0,OP),[a,o]=Nk(),s=Av(),{filters:c,groupBy:l,view:u}=Z.useMemo(()=>DP(a,s),[a,s]),d=hx(3e4),f=e=>o(t=>{let n=EP(e(DP(t,!0))),r=t.get(`tasks`);return(r===`flat`||r===`virtual`)&&n.set(`tasks`,r),n}),p=e=>f(t=>({...t,filters:e(t.filters)})),m=e=>f(t=>({...t,groupBy:e})),h=e=>f(t=>({...t,view:e})),[g,_]=Z.useState(l!==`none`||c.tags.length>0),[v,y]=RP(c.query,e=>p(t=>({...t,query:e}))),b=i.data?.referenceStatuses;Z.useEffect(()=>{b&&or(b)},[b]);let x=Z.useMemo(()=>n.data?.projects??[],[n.data]),S=Z.useMemo(()=>i.data?.runs??[],[i.data]),C=Z.useMemo(()=>fP(S,x),[S,x]),{nameOf:w,visible:T,originTotals:D,statusGroups:O,folds:A}=zP({tasks:C,filters:c,view:u,groupBy:l,index:S,automationsOn:s}),j=Z.useMemo(()=>SP(T,l),[T,l]),M=c.origin??`all`,ee=e=>p(t=>oP(t,e)),te=Z.useMemo(()=>T.flatMap(e=>Wr(e.run,e.project?.repoUrl).filter(t=>ei(t,e.project?.repoUrl)).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[T]),ne=CP(i.data?.truncated??[],x),re=(e,t)=>p(n=>({...n,[e]:sP(n[e]??[],t)})),ie=e=>p(t=>({...t,[e]:[]})),N=MP(),P=NP(),F=Z.useCallback((e,t)=>N.mutate({task:e,archived:t}),[N.mutate]),ae=Z.useCallback((e,t)=>P.mutate({task:e,read:t}),[P.mutate]),oe=i.error??n.error;if(oe)return(0,Q.jsx)(QN,{groupBy:l,filterDetailsOpen:g,message:oe.message,onRetry:()=>{i.refetch(),n.refetch()}});let se=(0,Q.jsxs)(`div`,{className:`relative w-full`,children:[(0,Q.jsx)(Yi,{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,Q.jsx)(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`Search every project…`,"aria-label":`Search tasks across projects`,className:`h-11 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]});return(0,Q.jsxs)(wM,{layout:l,revision:j,visibilityRevision:JSON.stringify([Br.map(A.isCollapsed),[...e].sort(),u,g]),"data-route":`global-tasks`,"data-presentation":l===`none`?`summary`:`cards`,"data-filter-details":g,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-[22px]`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`All tasks`}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:l===`none`?`Every project. One place to review what your agents have shipped.`:`Filter across projects and act on each run without opening the session.`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-6 border-b border-border`,children:[(0,Q.jsx)(BP,{view:`active`,current:u,onSelect:h,children:`Active`}),(0,Q.jsx)(BP,{view:`archived`,current:u,onSelect:h,children:`Archived`}),(0,Q.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`ml-auto text-[13px] text-soft-foreground tabular-nums`,children:[T.length,` of `,C.length,ne.length>0?` loaded`:``]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 basis-full md:flex-1 md:basis-auto`,children:se}),(0,Q.jsxs)(k,{variant:`outline`,"aria-expanded":g,onClick:()=>_(e=>!e),children:[(0,Q.jsx)(na,{"aria-hidden":`true`}),`Filters`]}),(0,Q.jsx)(k,{asChild:!0,className:`min-h-11`,children:(0,Q.jsxs)(E,{to:hs(n.data?.bootProject??`default`,`/new`),children:[(0,Q.jsx)(zi,{"aria-hidden":`true`}),`New task`]})})]}),(0,Q.jsx)(ZM,{origin:M,counts:D,automations:s,onChange:ee,labels:O.map(e=>e.label),onSetAll:A.setAll})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[22px]`,children:[(0,Q.jsx)(VP,{filters:c,onToggle:re,onClearFacet:ie,onClearAll:()=>{y(``),f(e=>({...e,filters:aP,groupBy:`none`}))},groupBy:l,onGroupByChange:m,projects:x,tasks:C,view:u,automationName:w}),(0,Q.jsx)(YN,{projects:ne,perProjectLimit:i.data?.perProjectLimit}),i.data===void 0?(0,Q.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading tasks…`}):(0,Q.jsx)(IP,{view:u,filtered:lP(c),visibleCount:T.length,referenceRequests:te,lists:{groupBy:l,view:u,statusGroups:O,groups:j,folds:A,row:{now:d,onArchive:F,expandedRuns:e,toggleExpandedRun:t,onSetRead:ae,busy:N.isPending||P.isPending,showCost:r.cost,automationName:w}}}),(0,Q.jsx)(XN,{registry:x})]})]})}function IP({view:e,filtered:t,visibleCount:n,referenceRequests:r,lists:i}){return n===0?(0,Q.jsx)(ZN,{view:e,filtered:t}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Za,{requests:r,children:(0,Q.jsx)(LP,{...i})}),i.groupBy===`none`?(0,Q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Resource details—including tokens, cost, CPU and peak memory—are available when a task row is expanded.`}):null]})}function LP({groupBy:e,view:t,statusGroups:n,groups:r,folds:i,row:a}){return(0,Q.jsx)(Q.Fragment,{children:e===`none`?n.map(e=>{let n=VM(e);return(0,Q.jsx)($M,{id:`global-group-${t}-${e.label.replaceAll(` `,`-`)}`,label:e.label,count:n.length,tone:HM(e.label,n.map(e=>e.run)),folded:i.isFolded(e.label),collapsed:i.isCollapsed(e.label),onToggle:()=>i.toggle(e.label),children:(0,Q.jsx)(HP,{summary:!0,tasks:e.rows.flatMap(KM),showProject:!0,...a})},e.label)}):r.map(t=>(0,Q.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":t.key,children:[(0,Q.jsxs)(`h2`,{className:`mb-1.5 flex items-center gap-2 text-[12px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:[e===`project`?(0,Q.jsx)(E,{to:hs(t.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:t.label}):t.label,(0,Q.jsx)(`span`,{className:`font-mono text-[11px] font-medium tabular-nums`,children:t.tasks.length})]}),(0,Q.jsx)(HP,{tasks:t.tasks,showProject:e!==`project`,...a})]},t.key))})}function RP(e,t){let[n,r]=Z.useState(e),i=Z.useRef(e);return Z.useEffect(()=>{e!==i.current&&r(e),i.current=e},[e]),Z.useEffect(()=>{if(n===i.current)return;let e=setTimeout(()=>{i.current=n,t(n)},kP);return()=>clearTimeout(e)},[n]),[n,r]}function zP({tasks:e,filters:t,view:n,groupBy:r,index:i,automationsOn:a}){let o=Z.useMemo(()=>[...new Set(e.filter(e=>e.run.automationId!==void 0).map(e=>e.run.projectId))],[e]),s=Yn(o,a&&o.length>0),c=Z.useCallback(e=>e.run.automationId===void 0?void 0:s(e.run.projectId,e.run.automationId),[s]),l=Z.useMemo(()=>bP(e,t,n,c),[e,t,n,c]),u=zM(xP(e,t,n,`origin`,c).map(e=>e.run),n),d=r===`none`?GM(l,n,i):[];return{nameOf:c,visible:l,originTotals:u,statusGroups:d,folds:iN(`global`,n,new Set(t.query.trim()===``?[]:d.map(e=>e.label)))}}function BP({view:e,current:t,onSelect:n,children:r}){let i=e===t;return(0,Q.jsx)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":i,onClick:()=>n(e),className:C(`flex min-h-11 items-center justify-center border-b-2 border-transparent text-[13px] font-medium text-muted-foreground`,i&&`border-accent-strong font-semibold text-accent-text`),children:r})}function VP({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,projects:o,tasks:s,view:c,automationName:l}){let u=Z.useMemo(()=>Tn(o),[o]),d=Z.useMemo(()=>{let t=(t,n)=>hP(xP(s,e,c,t,l),n);return{projects:t(`projects`,e=>[e.run.projectId]),tags:t(`tags`,gP),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[s,e,c,l]),f=e=>t=>({...t,count:e.get(t.value)??0});return(0,Q.jsxs)(`div`,{"data-slot":`global-tasks-filters`,className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Q.jsx)($N,{slot:`project`,label:`Project`,selected:e.projects??[],onToggle:e=>t(`projects`,e),onClear:()=>n(`projects`),options:[...new Map(s.map(e=>[e.run.projectId,e.projectName])).entries()].map(([e,t])=>({value:e,label:t})).map(f(d.projects)),emptyLabel:`No tasks to filter`}),(0,Q.jsx)($N,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:mP(s).map(e=>({value:e,label:e})).map(f(d.statuses)),emptyLabel:`No tasks to filter`}),(0,Q.jsx)($N,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:pP(s).map(e=>({value:e,label:e})).map(f(d.workflows)),emptyLabel:`No tasks to filter`}),(0,Q.jsxs)(`div`,{"data-slot":`group-controls`,className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Group by`}),(0,Q.jsx)(tP,{slot:`group-by`,label:`Group tasks by`,value:i,options:rP,onChange:e=>a(iP(i,e))})]}),dP({filters:e,groupBy:i})?(0,Q.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,Q.jsx)(ra,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${uP({filters:e,groupBy:i})})`]}):null]}),u.length>0?(0,Q.jsxs)(`div`,{"data-slot":`tag-filters`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Tags`}),u.map(n=>(0,Q.jsx)(eP,{slot:`tag-filter`,tone:`tag`,label:n,count:d.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,Q.jsx)(eP,{slot:`tag-filter`,label:`Untagged`,count:d.tags.get(` untagged`)??0,selected:e.tags.includes(nP),onToggle:()=>t(`tags`,nP)})]}):(0,Q.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-[11px] text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,Q.jsx)(E,{to:`/settings/global/projects`,className:`font-medium text-accent-text hover:underline`,children:Qa(`projects`)}),` `,`to group their tasks together here.`]})]})}function HP({summary:e=!1,expandedRuns:t,toggleExpandedRun:n,tasks:r,now:i,showProject:a,onArchive:o,onSetRead:s,busy:c,showCost:l,automationName:u}){let d=xj(r.map(e=>`${e.run.projectId}/${e.run.id}`),t),f=ci();return(0,Q.jsxs)(`div`,{role:e?`table`:void 0,"aria-rowcount":e?d.rowCount:void 0,"data-slot":`global-tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card p-5`,children:[(0,Q.jsx)(`div`,{"data-slot":`global-summary-head`,className:`text-[12px]`,role:`row`,"aria-rowindex":1,children:[`Task`,`Workflow`,`Changes`,`Pull request`,`Started`].map(e=>(0,Q.jsx)(`span`,{role:`columnheader`,children:e},e))}),(0,Q.jsx)(e_,{children:(0,Q.jsx)(CM,{...e?{itemSize:f?115:218}:{},items:r,itemKey:e=>`${e.run.projectId}/${e.run.id}`,children:(r,f)=>(0,Q.jsx)(UP,{task:r,summary:e,rowIndex:d.indexes[f],resourcesOpen:t.has(`${r.run.projectId}/${r.run.id}`),toggleExpandedRun:n,now:i,showProject:a,onArchive:o,onSetRead:s,busy:c,showCost:l,automationName:u(r)},`${r.run.projectId}/${r.run.id}`)})})]})}var UP=Z.memo(function({rowIndex:e,resourcesOpen:t,toggleExpandedRun:n,summary:r,task:i,now:a,showProject:o,onArchive:s,onSetRead:c,busy:l,showCost:u,automationName:d}){let f=r?`row`:void 0,p=r?`cell`:void 0,{run:m}=i,h=Ce(m),g=hs(m.projectId,`/tasks/${m.id}`),_=Wr(m,i.project?.repoUrl),v=Ar(m,m.usage);return(0,Q.jsxs)(`article`,{role:r?`rowgroup`:void 0,"data-status":m.status,"data-expanded":t,"data-slot":`global-task-row`,"data-run-id":m.id,"data-project":m.projectId,className:`hover:bg-muted max-md:flex max-md:flex-wrap max-md:items-center max-md:gap-x-3 max-md:gap-y-2 max-md:border-b max-md:border-border max-md:py-5 `,children:[(0,Q.jsxs)(`div`,{"data-slot":`global-task-cells`,className:`contents`,role:f,"aria-rowindex":r?e:void 0,children:[(0,Q.jsx)(WP,{summary:r,task:i,showProject:o,automationName:d,resourcesOpen:t,toggleExpandedRun:n}),(0,Q.jsx)(`div`,{role:p,"data-slot":`global-task-workflow`,className:`text-[13px] text-muted-foreground`,children:m.workflow}),(0,Q.jsx)(`div`,{role:p,"data-slot":`global-task-diff`,className:`text-xs text-muted-foreground`,children:(0,Q.jsx)(`span`,{title:`Change totals are available in the project task list`,children:`—`})}),(0,Q.jsx)(`div`,{role:p,"data-slot":`global-task-references`,children:_.length>0?(0,Q.jsx)(qP,{references:_,run:m,repoBase:i.project?.repoUrl}):(0,Q.jsx)(YP,{})}),(0,Q.jsx)(`div`,{role:p,"data-slot":`global-task-age`,className:`text-right text-xs text-soft-foreground tabular-nums`,children:Ga(m.startedAt??m.createdAt,a)})]}),!r||t?(0,Q.jsx)(`div`,{className:`contents`,role:f,"aria-rowindex":r?e+1:void 0,children:(0,Q.jsxs)(`div`,{"data-slot":`global-task-detail-cell`,role:p,"aria-colspan":r?5:void 0,className:r?`col-span-full flex flex-col gap-3`:`contents`,children:[(0,Q.jsx)(`div`,{"data-slot":`global-task-actions`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,Q.jsx)(GP,{task:i,busy:l,onSetRead:c}),(0,Q.jsx)(KP,{task:i,busy:l,onArchive:s}),(0,Q.jsx)(k,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(E,{to:g,children:`Open task`})})]})}),t?(0,Q.jsxs)(`div`,{"data-slot":`global-task-resources`,className:`col-span-full flex flex-col gap-3`,children:[(0,Q.jsx)(tN,{projectId:m.projectId,runId:m.id,status:h.label,error:m.error,open:(0,Q.jsx)(k,{asChild:!0,variant:`outline`,className:`min-h-11`,children:(0,Q.jsxs)(E,{to:g,children:[`Open task`,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`: `,xi(m)]})]})})}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-2 gap-4 rounded-md bg-muted/50 p-4 text-xs md:grid-cols-3`,children:[u?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Cost`}),(0,Q.jsx)(`dd`,{className:`mt-1`,children:oi(m.costUsd)||`—`})]}):null,(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`CPU`}),(0,Q.jsx)(`dd`,{"data-usage":`cpu`,"data-usage-kind":v.cpu.kind,title:v.cpu.title,className:`mt-1`,children:v.cpu.text||`—`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Memory`}),(0,Q.jsx)(`dd`,{"data-usage":`mem`,"data-usage-kind":v.mem.kind,title:v.mem.title,className:`mt-1`,children:v.mem.text||`—`})]})]})]}):null]})}):null]})},(e,t)=>{let{task:n,...r}=e,{task:i,...a}=t;return n.run===i.run&&n.project===i.project&&n.projectName===i.projectName&&n.tags.length===i.tags.length&&n.tags.every((e,t)=>e===i.tags[t])&&Object.keys(r).every(e=>r[e]===a[e])});function WP({summary:e,task:t,showProject:n,automationName:r,resourcesOpen:i,toggleExpandedRun:a}){let{run:o}=t,s=Ce(o),c=hs(o.projectId,`/tasks/${o.id}`),l=Zr(o),u=Ph(o);return(0,Q.jsxs)(`div`,{role:e?`cell`:void 0,"data-slot":`global-task-title`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[o.delegation?.role===`worker`?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,Q.jsx)(E,{to:c,title:xi(o),"data-task-control":`title`,className:C(`min-w-0 truncate text-[14px] md:text-[13px]`,l?`font-semibold text-foreground`:u?`font-medium text-muted-foreground`:`font-medium`),children:xi(o)}),l?(0,Q.jsx)($,{tone:Ih(o),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null]}),(0,Q.jsx)(`div`,{className:`mt-1`,children:(0,Q.jsx)(eN,{automationId:o.automationId,automationName:r,project:n?(0,Q.jsx)(E,{to:hs(o.projectId,`/`),"data-slot":`task-project`,className:`truncate hover:text-foreground`,children:t.projectName}):void 0})}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-task-control":`resources`,"aria-expanded":i,"aria-label":`${i?`Hide`:`Show`} resources for ${xi(o)}`,onClick:()=>a(`${o.projectId}/${o.id}`),"aria-describedby":`global-status-${o.projectId}-${o.id}`,title:`Resources and actions`,className:`min-h-[26px] rounded-md p-0 text-[11px] text-muted-foreground hover:bg-muted`,children:(0,Q.jsx)(MM,{id:`global-status-${o.projectId}-${o.id}`,dot:s.tone,shape:s.shape,pulse:s.pulse,children:s.label})}),(0,Q.jsx)(`span`,{children:t.tags.length>0?(0,Q.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:t.tags.map(e=>(0,Q.jsx)(JP,{tag:e},e))}):null})]})]})}function GP({task:e,busy:t,onSetRead:n}){if(!Ir(e.run))return null;let r=Zr(e.run),i=xi(e.run),a=r?`Mark ${i} read`:`Mark ${i} unread`,o=r?Ua:gu;return(0,Q.jsxs)(t_,{children:[(0,Q.jsx)(n_,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-action":r?`mark-read`:`mark-unread`,"aria-label":a,disabled:t,onClick:()=>n(e,r),className:C(`inline-flex size-11 items-center justify-center md:size-8 rounded-md transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,r?`text-accent-icon`:`text-soft-foreground`),children:[(0,Q.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:r?`Mark read`:`Mark unread`})]})}),(0,Q.jsx)(r_,{side:`left`,children:r?`Mark read`:`Mark unread`})]})}function KP({task:e,busy:t,onArchive:n}){let r=e.run.archived;if(!r&&!jP.has(e.run.status))return null;let i=r?`Restore ${xi(e.run)} to the active list`:`Archive ${xi(e.run)}`;return(0,Q.jsxs)(t_,{children:[(0,Q.jsx)(n_,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-action":r?`unarchive-run`:`archive-run`,"aria-label":i,disabled:t,onClick:()=>n(e,!r),className:`inline-flex size-11 items-center justify-center md:size-8 rounded-md text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,children:[(0,Q.jsx)(r?Jl:ba,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:r?`Unarchive`:`Archive`})]})}),(0,Q.jsx)(r_,{side:`left`,children:r?`Restore`:`Archive`})]})}function qP({references:e,run:t,repoBase:n}){return(0,Q.jsx)(Yb,{references:e,maxVisible:AP,taskTitle:xi(t),projectId:t.projectId,runId:t.id,repoBase:n})}function JP({tag:e,className:t}){return(0,Q.jsx)(`span`,{"data-slot":`project-tag`,className:C(`inline-flex max-w-full items-center truncate rounded-full bg-muted px-1.5 py-px text-[11px] font-medium text-muted-foreground`,t),children:e})}function YP(){return(0,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}var XP=new Map;function ZP(e){let t=XP.get(e);return t||(t=new Intl.DateTimeFormat(`en-CA`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),XP.set(e,t)),t}function QP(e,t){try{let n=ZP(t).formatToParts(new Date(e)),r=e=>Number(n.find(t=>t.type===e)?.value),i=r(`year`),a=r(`month`),o=r(`day`);return{year:i,month:a,day:o,hour:r(`hour`)%24,minute:r(`minute`),second:r(`second`),weekday:$P(i,a,o)}}catch{return null}}function $P(e,t,n){return(new Date(Date.UTC(e,t-1,n)).getUTCDay()+6)%7+1}function eF(e,t){let n=QP(t,e);return n?Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)-t:null}function tF(e,t,n,r,i,a){let o=Date.UTC(e,t-1,n,r,i,0,0),s=o;for(let e=0;e<3;e+=1){let e=eF(a,s);if(e===null)return null;let t=o-e;if(Math.abs(t-s)<1e3)return t;s=t}return s}function nF(e){if(!e)return!1;try{return ZP(e).format(new Date(0)),!0}catch{return!1}}var rF=[`daily`,`weekdays`,`weekly`,`hours`,`once`],iF=[1,2,3,4,6,8,12],aF=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],oF=[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],sF=43200,cF=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/,lF=[`hour`,`minute`,`day`,`every`],uF=[`at`,`timeZone`,`latestStartMinutes`],dF=`the due time has passed; choose a later time or use Run now`,fF=z([`paused`,`waiting`,`failed`,`missed`,`archived`]);function pF(e){return`unknown time zone "${e}"; use an IANA name such as Europe/Warsaw`}var mF=R({type:z(rF),hour:L().int().min(0).max(23).optional(),minute:L().int().min(0).max(59).optional(),day:L().int().min(1).max(7).optional(),every:$t([nn(1),nn(2),nn(3),nn(4),nn(6),nn(8),nn(12)]).optional(),at:B().regex(cF,`at must be YYYY-MM-DDTHH:MM`).optional(),timeZone:B().optional(),latestStartMinutes:L().int().min(10).max(sF).optional()}).superRefine((e,t)=>{let n=t=>e[t]!==void 0,r=(e,n)=>t.addIssue({code:`custom`,path:[e],message:n});if(e.type!==`once`){for(let e of uF)n(e)&&r(e,`${e} applies only to a once schedule`);return}for(let e of lF)n(e)&&r(e,`${e} does not apply to a once schedule`);e.at===void 0?r(`at`,`a once schedule needs at (YYYY-MM-DDTHH:MM)`):cF.test(e.at)&&!vF(e.at)&&r(`at`,`at is not a real date and time`),e.timeZone===void 0?r(`timeZone`,`a once schedule needs a timeZone`):nF(e.timeZone)||r(`timeZone`,pF(e.timeZone))});function hF(e){return{type:e.type,hour:e.hour??4,minute:e.minute??0,day:e.day??1,every:e.every??6,...e.at===void 0?{}:{at:e.at},...e.timeZone===void 0?{}:{timeZone:e.timeZone},...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}function gF(e){if(e.type!==`once`||!e.at||!e.timeZone)return null;let t=_F(e.at);return t&&tF(t.year,t.month,t.day,t.hour,t.minute,e.timeZone)}function _F(e){let t=cF.exec(e);if(!t)return null;let[n,r,i,a,o]=t.slice(1).map(Number),s=new Date(Date.UTC(n,r,0)).getUTCDate();return r<1||r>12||i<1||i>s||a>23||o>59?null:{year:n,month:r,day:i,hour:a,minute:o}}var vF=e=>_F(e)!==null,yF=e=>String(e).padStart(2,`0`);function bF(e,t=0){return`${yF(e)}:${yF(t)}`}function xF(e){let t=hF(e);switch(t.type){case`once`:return SF(t);case`daily`:return`every day at ${bF(t.hour,t.minute)}`;case`weekdays`:return`weekdays at ${bF(t.hour,t.minute)}`;case`hours`:return t.every===1?`every hour`:`every ${t.every} hours`;case`weekly`:return`${oF[t.day-1]}s at ${bF(t.hour,t.minute)}`}}function SF(e){let t=e.at?_F(e.at):null;if(!t)return`once`;let{year:n,month:r,day:i,hour:a,minute:o}=t;return`once on ${aF[$P(n,r,i)-1]} ${i} ${CF[r-1]} ${n} at ${bF(a,o)} (${e.timeZone??`UTC`})`}var CF=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function wF(e){let t=hF(e);switch(t.type){case`once`:throw Error(`a once schedule has no cron form`);case`daily`:return`${t.minute} ${t.hour} * * *`;case`weekdays`:return`${t.minute} ${t.hour} * * 1-5`;case`hours`:return`0 */${t.every} * * *`;case`weekly`:return`${t.minute} ${t.hour} * * ${t.day%7}`}}function TF(e,t){switch(e.type){case`once`:return[];case`daily`:return[[e.hour,e.minute]];case`weekdays`:return t<=5?[[e.hour,e.minute]]:[];case`weekly`:return t===e.day?[[e.hour,e.minute]]:[];case`hours`:{let t=[];for(let n=0;n<24;n+=e.every)t.push([n,0]);return t}}}function EF(e,t,n,r,i=1e3){if(e.type===`once`){let r=gF(e);return r!==null&&r>=t&&r<n&&i>0?[r]:[]}let a=hF(e),o=QP(t,r);if(!o||n<=t)return[];let s=[],c=Math.ceil((n-t)/864e5)+2;for(let e=-1;e<=c;e+=1){let c=new Date(Date.UTC(o.year,o.month-1,o.day+e)),l=c.getUTCFullYear(),u=c.getUTCMonth()+1,d=c.getUTCDate();for(let[e,o]of TF(a,$P(l,u,d))){let a=tF(l,u,d,e,o,r);if(a===null||a!==s.at(-1)&&a>=t&&a<n&&(s.push(a),s.length>=i))return s}}return s}function DF(e,t){let n=t-e;if(n<=0)return`now`;let r=Math.floor(n/6e4);if(r<1)return`in <1m`;if(r<60)return`in ${r}m`;let i=Math.floor(r/60);return i<24?`in ${i}h`:`in ${Math.floor(i/24)}d`}var OF=new Map;function kF(e,t){if(!Number.isFinite(e))return null;let n=OF.get(t);try{n??=new Intl.DateTimeFormat(`en-GB`,{timeZone:t,weekday:`short`,year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}catch{return null}OF.set(t,n);let r={};for(let t of n.formatToParts(e))r[t.type]=t.value;let i=new Date(`${r.month} 1, ${r.year} UTC`).getUTCMonth();return{weekday:r.weekday,day:r.day,month:r.month,hour:r.hour,minute:r.minute,key:`${r.year}-${i}-${r.day}`,dayNumber:Math.floor(Date.UTC(Number(r.year),i,Number(r.day))/864e5)}}function AF(e,t){let n=kF(Date.parse(e),t);return n?`${n.weekday} ${n.hour}:${n.minute}`:e}function jF(e,t,n){let r=kF(Date.parse(e),t),i=kF(n,t);if(!r||!i)return e;let a=`${r.hour}:${r.minute}`,o=i.dayNumber-r.dayNumber;return o===0?`Today ${a}`:o===1?`Yesterday ${a}`:o>1&&o<7?`${r.weekday} ${a}`:`${r.day} ${r.month} ${a}`}var MF=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],NF=e=>String(e).padStart(2,`0`);function PF(e){let t=e?_F(e):null;if(!t)return null;let{year:n,month:r,day:i,hour:a,minute:o}=t;return{date:`${aF[$P(n,r,i)-1]} ${i} ${MF[r-1]} ${n}`,time:`${NF(a)}:${NF(o)}`}}var FF=36e5;function IF(e){let t=gF(e),n=e.timeZone,r=PF(e.at),i=t===null||!n?null:QP(t,n);if(t===null||!n||!r||!i)return null;let a={date:`${aF[$P(i.year,i.month,i.day)-1]} ${i.day} ${MF[i.month-1]} ${i.year}`,time:`${NF(i.hour)}:${NF(i.minute)}`};if(a.date!==r.date||a.time!==r.time)return{...a,note:`${r.time} does not exist on ${r.date} in ${n}.`};let o=e=>{let t=QP(e,n);return!!t&&t.day===i.day&&t.hour===i.hour&&t.minute===i.minute},s=(eF(n,t-12*FF)??0)-(eF(n,t+12*FF)??0);if(s<=0)return a;let c=o(t+s);if(!c&&!o(t-s))return a;let l=(eF(n,t)??0)/6e4,u=`UTC${l<0?`-`:`+`}${NF(Math.floor(Math.abs(l)/60))}:${NF(Math.abs(l)%60)}`;return{...a,note:`${r.time} happens twice that day; it runs at ${c?`the first`:`the second`} (${u}).`}}var LF=z([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),RF=R({includeExisting:on().optional(),authors:Qt(B()).optional(),assignees:Qt(B()).optional(),requireCurrentLabels:on().optional(),allLabels:Qt(B()).optional(),anyLabels:Qt(B()).optional(),excludeLabels:Qt(B()).optional(),changedLabels:Qt(B()).optional(),lookbackDays:L(),maxRecords:L()}),zF=z([`github`,`schedule`]),BF=Xt.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:B(),variants:$t([nn(1),nn(2),nn(3)]).optional(),systemPrompt:B().optional()}),VF=R({at:B(),outcome:z([`launched`,`cancelled`]),runId:B().optional(),receiptId:B().optional(),trigger:z([`schedule`,`late`,`manual`,`retry`]).optional()}),HF=R({id:B(),revision:L(),name:B(),description:B().optional(),enabled:on(),kind:zF,events:Qt(LF).optional(),intervalSeconds:L().optional(),filters:RF.optional(),schedule:mF.optional(),task:BF,archived:VF.optional(),createdAt:B(),updatedAt:B()}),UF=R({timestamp:B(),tieBreaker:B().optional()}),WF=R({since:B().datetime(),until:B().datetime(),source:L().int().min(0).max(2),page:L().int().min(1).max(10),item:L().int().min(0).max(100),event:L().int().min(0).max(1e3),cursor:UF.optional()}),GF={lastError:B().max(1e3).optional(),lastErrorAt:B().datetime().optional()},KF=R({revision:L().optional(),baselineAt:B().optional(),armedAt:B().optional(),historyScan:WF.optional(),cursor:UF.optional(),frozenHighWatermark:UF.extend({tieBreaker:B()}).optional(),backlogAfter:UF.extend({tieBreaker:B()}).optional(),nextCheckAt:B().optional(),lastSuccessAt:B().optional(),nextRunAt:B().optional(),lastRunAt:B().optional(),etags:cn(B(),B()).optional(),backoffUntil:B().optional(),consecutiveFailures:L().optional(),...GF,onceOutcome:z([`failed`,`missed`]).optional()});function qF(e){let t=e?.consecutiveFailures??0;if(!(t<3||!e?.lastError))return{consecutiveFailures:t,lastError:e.lastError,...e.lastErrorAt?{lastErrorAt:e.lastErrorAt}:{},...e.backoffUntil?{retryAt:e.backoffUntil}:{}}}var JF=z([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),YF=R({seq:L(),ts:B(),automationId:B(),revision:L(),event:LF.optional(),result:JF,reason:B().optional(),durationMs:L().optional(),receiptId:B().optional(),runId:B().optional(),githubNumber:L().optional(),githubTitle:B().optional(),githubUrl:B().optional(),rateLimit:R({bucket:z([`core`,`search`]),remaining:L().optional(),resetAt:B().optional()}).optional()}),XF=R({matches:L(),launched:L(),duplicates:L(),errors:L()}),ZF=HF.extend({state:KF.optional(),latestLog:YF.optional(),counts:XF,nextRunAt:B().optional(),onceStatus:fF.optional()});R({available:on(),reason:B().optional(),timeZone:B(),scheduler:R({state:z([`scheduled`,`idle`]),nextDue:B().optional()}),automations:Qt(ZF)}),R({automation:HF}).extend({once:R({dueAt:B(),timeZone:B(),resolvedInstant:B(),note:B()}).optional()}),R({automation:HF,state:KF.optional(),latestLog:YF.optional(),onceStatus:fF.optional()}),R({id:B(),automationId:B(),mode:z([`preview`,`execute`]),status:z([`queued`,`running`,`complete`,`error`]),createdAt:B(),completedAt:B().optional(),matches:L().optional(),truncated:on().optional(),error:B().optional()}),R({checkId:B()}),R({records:Qt(YF)}),R({receiptId:B(),runId:B()}),R({runId:B()}),HF.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:zF.optional(),task:BF.omit({variants:!0}).strict(),enable:on().optional()}).omit({enable:!0}).extend({enabled:on().optional(),expectedRevision:L()}),R({archived:z([`include`,`only`]).optional()}),R({mode:z([`preview`,`execute`])});function QF({...e}){return(0,Q.jsx)(Cf,{"data-slot":`select`,...e})}function $F({...e}){return(0,Q.jsx)(Df,{"data-slot":`select-value`,...e})}function eI({className:e,size:t=`default`,children:n,...r}){return(0,Q.jsxs)(Tf,{"data-slot":`select-trigger`,"data-size":t,className:C(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden 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-11 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 pointer-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,Q.jsx)(kf,{asChild:!0,children:(0,Q.jsx)(ua,{className:`size-4 opacity-50`})})]})}function tI({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,Q.jsx)(Nf,{children:(0,Q.jsxs)(Ff,{"data-slot":`select-content`,className:C(`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 motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe: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,Q.jsx)(rI,{}),(0,Q.jsx)(Xf,{className:C(`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,Q.jsx)(iI,{})]})})}function nI({className:e,children:t,...n}){return(0,Q.jsxs)(op,{"data-slot":`select-item`,className:C(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-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,Q.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,Q.jsx)(up,{children:(0,Q.jsx)(Qi,{className:`size-4`})})}),(0,Q.jsx)(cp,{children:t})]})}function rI({className:e,...t}){return(0,Q.jsx)(fp,{"data-slot":`select-scroll-up-button`,className:C(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,Q.jsx)(ea,{className:`size-4`})})}function iI({className:e,...t}){return(0,Q.jsx)(mp,{"data-slot":`select-scroll-down-button`,className:C(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,Q.jsx)(ua,{className:`size-4`})})}function aI({title:e,subtitle:t,action:n,children:r}){return(0,Q.jsxs)(`main`,{"data-route":`automations`,className:`task-flow-page w-full max-w-full min-w-0 max-md:p-4!`,children:[(0,Q.jsxs)(`header`,{className:`mb-6 flex flex-col items-start gap-5 max-md:mb-4 max-md:gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{className:`mb-2 text-[28px] font-medium max-md:text-[22px]`,children:e}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),n]}),r]})}function oI({text:e}){return(0,Q.jsx)(`div`,{role:`status`,className:`rounded-xl border bg-card p-6 text-sm text-muted-foreground`,children:e})}var sI={launched:`success`,manual:`success`,"catch-up":`success`,skipped:`neutral`,missed:`neutral`,"no-match":`neutral`,preview:`neutral`,baseline:`neutral`,duplicate:`neutral`,failed:`danger`,error:`danger`,"rate-limited":`danger`},cI={launched:`Launched`,manual:`Manual`,"catch-up":`Catch up`,skipped:`Skipped`,missed:`Missed`,"no-match":`No match`,preview:`Preview`,baseline:`Baseline`,duplicate:`Duplicate`,failed:`Failed`,error:`Error`,"rate-limited":`Rate limited`};function lI(e){let[t,n]=(0,Z.useState)(),[r,i]=(0,Z.useState)(``),a=(0,Z.useCallback)(t=>We(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,Z.useEffect)(()=>{a()},[a]),(0,Z.useEffect)(()=>P(a),[a]),(0,Z.useEffect)(()=>rl((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function uI(e,t){return e.result!==`failed`&&e.result!==`error`||!e.receiptId||e.runId?!1:!t.some(t=>t.receiptId===e.receiptId&&(t.runId||t.seq>e.seq))}function dI({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&uI(e,t),[o,s]=(0,Z.useState)(),[c,l]=(0,Z.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await ft(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,Q.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,Q.jsxs)(`li`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(MM,{dot:sI[e.result],children:cI[e.result]}),(0,Q.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:jF(e.ts,n,u)})]}),e.reason?(0,Q.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,Q.jsx)(`a`,{className:`inline-flex min-h-11 items-center underline underline-offset-4 break-all`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}):null,e.runId?(0,Q.jsx)(Y,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,Q.jsx)(k,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var fI=`all`;function pI({label:e,value:t,onChange:n,options:r}){return(0,Q.jsxs)(QF,{value:t,onValueChange:n,children:[(0,Q.jsx)(eI,{"aria-label":e,className:`w-full sm:w-52`,children:(0,Q.jsx)($F,{})}),(0,Q.jsx)(tI,{children:r.map(e=>(0,Q.jsx)(nI,{value:e.value,children:e.label},e.value))})]})}function mI({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=lI(e),[s,c]=(0,Z.useState)(fI),[l,u]=(0,Z.useState)(fI),d=(0,Z.useMemo)(()=>(i??[]).filter(e=>(s===fI||e.result===s)&&(l===fI||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,Q.jsx)(aI,{title:`Execution log`,subtitle:t??`Automation activity`,action:(0,Q.jsx)(k,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(Y,{to:`/automations`,children:`Back to automations`})}),children:a&&!i?(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,Q.jsx)(oI,{text:a}),(0,Q.jsx)(k,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,Q.jsx)(oI,{text:`Nothing has run yet.`}):(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(pI,{label:`Result`,value:s,onChange:c,options:[{value:fI,label:`All results`},...JF.options.map(e=>({value:e,label:cI[e]}))]}),f?(0,Q.jsx)(pI,{label:`Event`,value:l,onChange:u,options:[{value:fI,label:`All events`},...LF.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,Q.jsx)(oI,{text:`No rows match these filters.`}):(0,Q.jsx)(dI,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,Q.jsx)(oI,{text:`Loading execution log…`})})}function hI({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=lI(e);return(0,Q.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`mt-4 min-w-0 border-t pt-4`,children:[(0,Q.jsxs)(`h3`,{className:`mb-3 text-sm font-medium`,children:[`Recent activity`,r&&t?` · ${t}`:``]}),o&&!a?(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,Q.jsx)(oI,{text:o}),(0,Q.jsx)(k,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?a.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing has run yet.`}):(0,Q.jsx)(dI,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading activity…`})]})}function gI({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?IF(i):null,[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(``),f=(0,Z.useRef)(null),p=(0,Z.useRef)(null),m=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let e=m.current===`keep`?p.current:m.current===`delete`?f.current:null;m.current=null,e?.focus()},[o]);let h=async()=>{l(!0);try{await Oe(e.id),n()}catch(e){d(e instanceof Error?e.message:String(e)),l(!1)}},g=[[`Workflow`,e.task.workflow],[`Runner`,e.task.runner],[`Model`,e.task.model],[`Effort`,e.task.effort]];return(0,Q.jsx)(aI,{title:e.name,subtitle:`Archived one-time schedule. It cannot change; delete it when you no longer need the record.`,children:(0,Q.jsxs)(`div`,{className:`grid min-w-0 max-w-3xl gap-5`,children:[(0,Q.jsxs)(`section`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,Q.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,Q.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,Q.jsxs)(Q.Fragment,{children:[` · `,(0,Q.jsx)(Y,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${AF(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,Q.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,Q.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,Q.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-1`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,Q.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),g.filter(([,e])=>e).map(([e,t])=>(0,Q.jsxs)(`div`,{className:`grid gap-1`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,Q.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,Q.jsxs)(`section`,{className:`min-w-0`,children:[(0,Q.jsx)(hI,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,Q.jsx)(k,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,Q.jsx)(Y,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(k,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:c,onClick:()=>void h(),children:`Delete schedule`}),(0,Q.jsx)(k,{ref:p,variant:`outline`,disabled:c,onClick:()=>{m.current=`delete`,s(!1)},children:`Keep`})]})]}):(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(k,{ref:f,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{m.current=`keep`,s(!0)},children:`Delete`}),(0,Q.jsx)(k,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(Y,{to:`/automations`,children:`Back to automations`})})]}),u?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:u}):null]})]})})}var _I=z([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),vI=Qt(B().trim().min(1).max(200)).max(100).optional(),yI=R({includeExisting:on().optional(),requireCurrentLabels:on().optional(),authors:vI,assignees:vI,allLabels:vI,anyLabels:vI,excludeLabels:vI,changedLabels:vI,lookbackDays:L().int().min(1).max(90).default(7),maxRecords:L().int().min(1).max(100).default(25)}).passthrough(),bI=R({prompt:B().min(1).max(1e5),workflow:B().trim().min(1).max(200).optional(),steps:Qt(tt).min(1).max(100).optional(),runner:ge.optional(),model:B().trim().min(1).max(200).optional(),effort:B().trim().min(1).max(32).optional(),variants:$t([nn(1),nn(2),nn(3)]).optional(),worktree:on().optional(),autonomous:on().optional(),...me,...At,systemPrompt:B().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),xI=new Set(Object.keys(bI.shape).filter(e=>e!==`variants`));function SI(e){return Object.fromEntries(Object.entries(e).filter(([e])=>xI.has(e)))}rn(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e;return t.kind===`schedule`?e:{...t,intervalSeconds:t.intervalSeconds??300,filters:t.filters??{}}},R({id:B().min(1).max(100),revision:L().int().positive(),name:B().trim().min(1).max(200),description:B().max(2e3).optional(),enabled:on().default(!1),kind:zF.default(`github`),events:Qt(_I).min(1).max(4).optional(),intervalSeconds:L().int().min(60).max(86400).optional(),filters:yI.optional(),schedule:mF.passthrough().optional(),task:bI,archived:R({at:B().datetime(),outcome:z([`launched`,`cancelled`]),runId:B().optional(),receiptId:B().optional(),trigger:z([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:B().datetime(),updatedAt:B().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:ze.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:ze.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:ze.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:ze.custom,path:[`filters`],message:`a GitHub automation needs its bounded filter`}),e.events?.some(e=>e===`issue.labeled`||e===`issue.unlabeled`)&&!e.filters?.changedLabels?.length&&t.addIssue({code:ze.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),R({version:nn(1).default(1),automations:Qt(an()).default([]),tombstones:cn(B(),B().datetime()).optional()}).passthrough();var CI=R({timestamp:B().datetime(),tieBreaker:B().optional()}).passthrough(),wI=WF.extend({cursor:CI.optional()}),TI=R({revision:L().int().positive().optional(),baselineAt:B().datetime().optional(),armedAt:B().datetime().optional(),historyScan:wI.optional(),cursor:CI.optional(),frozenHighWatermark:CI.extend({tieBreaker:B()}).optional(),backlogAfter:CI.extend({tieBreaker:B()}).optional(),nextCheckAt:B().datetime().optional(),lastSuccessAt:B().datetime().optional(),nextRunAt:B().datetime().optional(),lastRunAt:B().datetime().optional(),etags:cn(B(),B()).optional(),backoffUntil:B().datetime().optional(),consecutiveFailures:L().int().nonnegative().optional(),...GF,onceOutcome:z([`failed`,`missed`]).optional()}).passthrough();R({version:nn(1).default(1),states:cn(B(),TI).default({})}).passthrough(),R({receiptId:B().min(1),receiptKey:B().min(1),eventId:B().min(1),automationId:B().min(1),revision:L().int().positive(),status:z([`reserved`,`launched`,`launch-error`,`released`]),runId:B().optional(),observedAt:B().datetime(),updatedAt:B().datetime(),error:B().max(2e3).optional(),occurrenceAt:B().datetime().optional(),candidate:R({eventId:B(),event:_I,timestamp:B().datetime(),tieBreaker:B(),repo:B(),nodeId:B(),number:L().int().positive(),title:B().max(500),url:B().url(),author:B().max(200),assignees:Qt(B().max(200)).max(100),labels:Qt(B().max(200)).max(100),changedLabel:B().max(200).optional()}).passthrough().optional()}).passthrough();var EI=z([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);R({seq:L().int().positive(),ts:B().datetime(),automationId:B().min(1),revision:L().int().positive(),event:_I.optional(),result:EI,reason:B().max(2e3).optional(),durationMs:L().int().nonnegative().optional(),receiptId:B().optional(),runId:B().optional(),githubNumber:L().int().positive().optional(),githubTitle:B().max(500).optional(),githubUrl:B().url().optional(),rateLimit:R({bucket:z([`core`,`search`]),remaining:L().int().nonnegative().optional(),resetAt:B().datetime().optional()}).passthrough().optional()}).passthrough();var DI=`quick-task`;function OI(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=SI(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:hF(e.schedule??{type:`daily`}),events:e.events??[`issue.opened`],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?d?{workflow:DI}:{}:{workflow:n},...r===void 0?{}:{runner:r},...i===void 0?{}:{model:i},autonomous:a??!0,archiveWhenDone:o??!1,autoMergePr:s??!1,allowWorkers:c!==!1,allowMessaging:l!==!1,enabled:e.enabled??e.enable??!1,taskExtra:u}}function kI(e){switch(e.type){case`daily`:case`weekdays`:return{type:e.type,hour:e.hour,minute:e.minute};case`weekly`:return{type:`weekly`,hour:e.hour,minute:e.minute,day:e.day};case`hours`:return{type:`hours`,every:e.every};case`once`:return{type:`once`,at:e.at??``,timeZone:e.timeZone??``,...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}}function AI(e){return{...e.taskExtra,prompt:e.prompt,...e.workflow?{workflow:e.workflow}:{},...e.runner?{runner:e.runner}:{},...e.model?{model:e.model}:{},autonomous:e.autonomous,...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers?{}:{allowWorkers:!1},...e.allowMessaging?{}:{allowMessaging:!1}}}function jI(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:kI(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:AI(e)}}function MI(e){return{...jI(e),enable:e.enabled}}function NI(e,t){return{...jI(e),task:{...AI(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function PI(e){return`'${e.replace(/'/g,`'\\''`)}'`}var FI=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),II=new Set([`anyLabels`,`authors`,`changedLabels`]);function LI(e){if(e.description!==void 0||!e.name.trim()||!e.task.prompt.trim())return!1;let t=e.task;if(Object.keys(t).some(e=>!FI.has(e))||t.archiveWhenDone===!1||t.autoMergePr===!1||t.allowWorkers===!0||t.allowMessaging===!0||t.worktree!==!0)return!1;if(e.kind===`schedule`)return e.schedule!==void 0;let{events:n,filters:r}=e;return!n?.length||n.some(e=>e.includes(`,`))||!r||r.lookbackDays!==7||r.maxRecords!==25?!1:Object.entries(r).every(([e,t])=>e===`lookbackDays`||e===`maxRecords`||e===`includeExisting`&&t===!0||II.has(e)&&Array.isArray(t)&&t.length>0)}function RI(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function zI(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function BI(e,t){return t.startsWith(`-`)?`--${e}=${PI(t)}`:`--${e} ${PI(t)}`}function VI(e){let t=[`${hy()} automation add`,BI(`name`,e.name)];if(e.schedule?.type===`once`)t.push(BI(`at`,e.schedule.at),BI(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push(BI(`latest-start`,zI(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push(BI(`cron`,wF(e.schedule)));else{t.push(BI(`on`,e.events.join(`,`)),`--every ${RI(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push(BI(`label`,n));for(let n of e.filters?.authors??[])t.push(BI(`author`,n));for(let n of e.filters?.changedLabels??[])t.push(BI(`changed-label`,n))}return t.push(...HI(e.task)),e.enable===!0&&t.push(`--enable`),t.push(BI(`prompt`,e.task.prompt)),t.join(` `)}function HI(e){let t=[];return e.workflow&&t.push(BI(`workflow`,e.workflow)),e.runner&&t.push(BI(`runner`,e.runner)),e.model&&t.push(BI(`model`,e.model)),e.autonomous===!1&&t.push(`--no-autonomous`),e.archiveWhenDone&&t.push(`--archive-when-done`),e.autoMergePr&&t.push(`--auto-merge-pr`),e.allowWorkers===!1&&t.push(`--no-workers`),e.allowMessaging===!1&&t.push(`--no-messaging`),t}function UI(e,t){let n=MI(e),r=LI(n)?VI(n):`${hy()} automation create --json ${PI(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${PI(t.origin)} CEZ_PROJECT_ID=${PI(t.projectId)} HSQ_COCKPIT_URL=${PI(t.origin)} HSQ_PROJECT_ID=${PI(t.projectId)} ${r}`:r}function WI({draft:e}){let t=Ss(),n=window.location.origin,r=(0,Z.useMemo)(()=>UI(e,t?{origin:n,projectId:t}:void 0),[e,n,t]),[i,a]=(0,Z.useState)(`idle`),o=(0,Z.useRef)(void 0);(0,Z.useEffect)(()=>()=>clearTimeout(o.current),[]),(0,Z.useEffect)(()=>a(`idle`),[r]);let s=async()=>{clearTimeout(o.current);try{await navigator.clipboard.writeText(r),a(`copied`),o.current=setTimeout(()=>a(`idle`),1600)}catch{a(`failed`)}};return(0,Q.jsxs)(`section`,{"aria-labelledby":`copy-as-cli-heading`,"data-slot":`copy-as-cli`,className:`mbs-4 rounded-xl border bg-card p-4`,children:[(0,Q.jsxs)(`div`,{className:`mbe-2 flex items-center gap-2`,children:[(0,Q.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`text-[15px] font-medium`,children:`Copy as CLI`}),(0,Q.jsxs)(k,{type:`button`,variant:`ghost`,size:`sm`,className:`ms-auto`,onClick:()=>void s(),children:[i===`copied`?(0,Q.jsx)(eu,{"aria-hidden":`true`}):(0,Q.jsx)(uu,{"aria-hidden":`true`}),i===`copied`?`Copied`:`Copy`]})]}),(0,Q.jsx)(`pre`,{className:`m-0 rounded-lg border bg-muted px-2.5 py-2 font-mono text-xs/relaxed break-words whitespace-pre-wrap text-muted-foreground`,children:r}),(0,Q.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:i===`failed`?`Could not copy — select the line and copy it by hand.`:(0,Q.jsxs)(Q.Fragment,{children:[`The definition Save would create. `,(0,Q.jsxs)(`code`,{children:[hy(),` automation schema`]}),` prints its shape.`]})})]})}function GI({pressed:e,onClick:t,disabled:n,children:r}){return(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:C(Ls,`h-11 px-4 text-[13px]`,e&&`border-transparent bg-accent-strong text-accent-strong-foreground hover:bg-accent-strong hover:text-accent-strong-foreground`),children:r})}var KI=LF.options,qI=[{seconds:60,label:`1 minute`},{seconds:300,label:`5 minutes`},{seconds:900,label:`15 minutes`},{seconds:1800,label:`30 minutes`},{seconds:3600,label:`1 hour`}],JI=[{key:`authors`,label:`Authors`},{key:`assignees`,label:`Assignees`},{key:`allLabels`,label:`Has all labels`},{key:`anyLabels`,label:`Has any label`},{key:`excludeLabels`,label:`Excludes labels`},{key:`changedLabels`,label:`Changed labels`,hint:`Required for the two label events.`}],YI=e=>(e??[]).join(`, `),XI=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function ZI(e){return e?`Existing matches within the lookback are eligible on the next check. Previously processed matches will not run again.`:`Enabling starts from a current-time baseline. Existing matches will not launch tasks.`}function QI(e){let t=Math.max(1,Math.round(e.intervalSeconds/60));return`Polls GitHub every ${t} minute${t===1?``:`s`} for ${e.events.join(`, `)||`no events`}. ${ZI(e.filters.includeExisting)}`}function $I({draft:e,onChange:t,disabledReason:n}){let r=n=>{t({events:e.events.includes(n)?e.events.filter(e=>e!==n):[...e.events,n]})},i=n=>t({filters:{...e.filters,...n}}),a=(n,r)=>{let i=XI(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=qI.some(t=>t.seconds===e.intervalSeconds)?qI:[...qI,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,Q.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,Q.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`flex flex-wrap gap-2`,children:KI.map(t=>(0,Q.jsx)(GI,{pressed:e.events.includes(t),onClick:()=>r(t),children:t},t))}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-interval`,children:`Check every`}),(0,Q.jsxs)(QF,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,Q.jsx)(eI,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,Q.jsx)($F,{})}),(0,Q.jsx)(tI,{children:o.map(e=>(0,Q.jsx)(nI,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,Q.jsx)(uh,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,Q.jsx)(`span`,{children:`Include existing items`})]}),(0,Q.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:ZI(e.filters.includeExisting)})]}),(0,Q.jsxs)(jA,{children:[(0,Q.jsxs)(MA,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,Q.jsx)(ua,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,Q.jsx)(NA,{children:(0,Q.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[JI.map(t=>(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,Q.jsx)(rh,{id:`automation-filter-${t.key}`,placeholder:`comma separated`,value:YI(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,Q.jsx)(rh,{id:`automation-filter-lookback`,type:`number`,min:1,value:e.filters.lookbackDays,onChange:e=>i({lookbackDays:Math.max(1,Number(e.target.value)||1)})})]}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,Q.jsx)(rh,{id:`automation-filter-max`,type:`number`,min:1,value:e.filters.maxRecords,onChange:e=>i({maxRecords:Math.max(1,Number(e.target.value)||1)})})]})]})})]})]})}var eL=e=>String(e).padStart(2,`0`);function tL({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,Z.useState)(eL(t)),o=(0,Z.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${eL(n)}.`,l=(0,Z.useId)();return(0,Z.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(rh,{ref:o,"aria-label":e,"aria-invalid":s||void 0,"aria-describedby":s?l:void 0,inputMode:`numeric`,maxLength:2,className:`w-20 text-center tabular-nums`,value:i,onChange:e=>{a(e.target.value),/^\d{1,2}$/.test(e.target.value)&&Number(e.target.value)<=n&&r(Number(e.target.value))},onBlur:()=>a(eL(t))}),s?(0,Q.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}var nL=[{minutes:void 0,label:`No limit`},{minutes:30,label:`30 minutes`},{minutes:120,label:`2 hours`},{minutes:360,label:`6 hours`},{minutes:1440,label:`1 day`},{minutes:10080,label:`7 days`}],rL=`none`,iL=e=>String(e).padStart(2,`0`);function aL(e,t=Date.now()){let n=QP(t,e)??QP(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${iL(r.getUTCMonth()+1)}-${iL(r.getUTCDate())}T09:00`}function oL(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function sL({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?_F(e.at):null,a=e.at?.slice(0,10)??``,o=i?.hour??9,s=i?.minute??0,c=(e,t,n)=>r({at:`${e}T${iL(t)}:${iL(n)}`}),l=(0,Z.useRef)(null),u=(0,Z.useId)(),d=gF(e),f=!(t?.type===`once`&&t.at===e.at&&t.timeZone===e.timeZone)&&d!==null&&d<=Date.now();(0,Z.useEffect)(()=>{l.current?.setCustomValidity(f?dF:``)},[f]);let p=IF(e);return(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-once-date`,children:`Date`}),(0,Q.jsx)(rh,{ref:l,id:`automation-once-date`,type:`date`,className:`w-44 max-w-full`,value:a,"aria-invalid":f||void 0,"aria-describedby":f?u:void 0,onChange:e=>{/^\d{4}-\d{2}-\d{2}$/.test(e.target.value)&&c(e.target.value,o,s)},required:!0})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,Q.jsx)(tL,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,Q.jsx)(tL,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,Q.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:dF}):null,(0,Q.jsx)(lL,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,Q.jsx)(uL,{value:e.latestStartMinutes,onChange:t=>n(cL(e,t))}),p?(0,Q.jsx)(`p`,{className:`text-sm break-words`,children:`Runs once at ${p.time} on ${p.date} (${e.timeZone}). ${p.note?`${p.note} `:``}Squawk must be running then.`}):null]})}function cL(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function lL({value:e,onCommit:t}){let[n,r]=(0,Z.useState)(e),i=(0,Z.useRef)(null),a=(0,Z.useId)(),o=(0,Z.useId)(),[s]=(0,Z.useState)(oL),c=n!==e||!nF(n),l=pF(n);return(0,Z.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,Q.jsx)(rh,{ref:i,id:`automation-once-zone`,list:a,autoComplete:`off`,spellCheck:!1,className:`w-full sm:w-72`,value:n,"aria-invalid":c||void 0,"aria-describedby":c?o:void 0,onChange:e=>{r(e.target.value),nF(e.target.value)&&t(e.target.value)}}),(0,Q.jsx)(`datalist`,{id:a,children:s.map(e=>(0,Q.jsx)(`option`,{value:e},e))}),c?(0,Q.jsx)(`p`,{id:o,className:`text-xs break-words text-destructive`,children:l}):null]})}function uL({value:e,onChange:t}){let n=nL.some(t=>t.minutes===e)||e===void 0?nL:[...nL,{minutes:e,label:`${e} minutes`}];return(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,Q.jsxs)(QF,{value:e===void 0?rL:String(e),onValueChange:e=>t(e===rL?void 0:Number(e)),children:[(0,Q.jsx)(eI,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,Q.jsx)($F,{})}),(0,Q.jsx)(tI,{children:n.map(e=>(0,Q.jsx)(nI,{value:e.minutes===void 0?rL:String(e.minutes),children:e.label},e.label))})]}),(0,Q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`If Squawk was not running at the time, it still starts the task this long afterwards; later, the schedule is marked missed.`})]})}var dL=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}];function fL({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??aL(r),timeZone:e.timeZone??r}:{type:t});return(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`flex flex-wrap gap-2`,children:dL.map(t=>(0,Q.jsx)(GI,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,Q.jsx)(sL,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`flex flex-wrap gap-2`,children:aF.map((t,n)=>(0,Q.jsx)(GI,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-every`,children:`Run every`}),(0,Q.jsxs)(QF,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,Q.jsx)(eI,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,Q.jsx)($F,{})}),(0,Q.jsx)(tI,{children:iF.map(e=>(0,Q.jsx)(nI,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Counted from midnight, so “every 6 hours” runs at 00:00, 06:00, 12:00 and 18:00.`})]}):(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,Q.jsx)(tL,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,Q.jsx)(tL,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,Q.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,Q.jsx)(`code`,{className:`font-mono text-foreground`,children:wF(e)})]})]})}var pL=40*864e5,mL=5;function hL({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,Q.jsx)(gL,{schedule:e,now:n});let r=EF(e,n+1,n+pL,t,mL);return(0,Q.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,Q.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Next 5 runs`}),r.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,Q.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid gap-1.5 text-sm`,children:r.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`font-medium tabular-nums`,children:AF(new Date(e).toISOString(),t)}),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:DF(n,e)})]},e))}),(0,Q.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this Squawk runs in.`]})]})}function gL({schedule:e,now:t}){let n=gF(e),r=IF(e);return(0,Q.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,Q.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Runs once`}),n===null||!r?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,Q.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:DF(t,n)}):null]}),r?.note?(0,Q.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,Q.jsx)(`p`,{className:`mt-3 text-xs break-words text-muted-foreground`,children:`Times are in ${e.timeZone??`UTC`}. Squawk must be running then; afterwards the schedule is archived with its task.`})]})}var _L={schedule:`On a schedule`,github:`When GitHub changes`};function vL(e){return/time zone|due time/i.test(e)?`when`:/placeholder|prompt|workflow|runner|model|task|autonomous/i.test(e)?`run`:/\bname\b/i.test(e)?`name`:/schedule|github|event|filter|label|interval|remote|forge|lookback|records?|hour|minute|poll|kind|archived/i.test(e)?`when`:`form`}function yL({title:e,failure:t,section:n,children:r}){return(0,Q.jsxs)(`fieldset`,{className:`grid min-w-0 gap-4 rounded-xl border p-5 max-md:p-4!`,children:[(0,Q.jsx)(`legend`,{className:`px-0`,children:e}),r,t?.section===n&&!t.conflict?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:t.message}):null]})}function bL({draft:e,patch:t,forge:n,automation:r}){return(0,Q.jsx)(Q.Fragment,{children:r?(0,Q.jsxs)(`p`,{className:`text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),_L[e.kind]]}):(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,Q.jsx)(tP,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:e.kind,onChange:e=>t({kind:e}),options:[{value:`schedule`,label:_L.schedule},{value:`github`,label:_L.github,disabled:!n.available,...n.available?{}:{title:n.reason??`GitHub is unavailable`}}]}),n.available?null:(0,Q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${n.reason??`no GitHub access`}`})]})})}function xL({draft:e,patch:t,forge:n,timeZone:r,automation:i}){return e.kind===`schedule`?(0,Q.jsx)(fL,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,Q.jsx)($I,{draft:e,onChange:t,...n.available?{}:{disabledReason:n.reason??`no GitHub access`}})}function SL({draft:e,patch:t,saving:n,automation:r}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,Q.jsx)(ew,{id:`automation-prompt`,value:e.prompt,onChange:e=>t({prompt:e.target.value}),rows:4,required:!0}),(0,Q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,Q.jsxs)(Q.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,Q.jsxs)(Q.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),(0,Q.jsx)(TL,{draft:e,patch:t}),(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,Q.jsx)(uh,{"aria-label":`Autonomous`,checked:e.autonomous,onCheckedChange:e=>t({autonomous:e})}),(0,Q.jsxs)(`span`,{children:[`Autonomous `,(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`· runs without waiting for answers`})]})]}),(0,Q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`Each run is an ordinary task in its own worktree, queued behind the parallel cap.`}),(0,Q.jsx)(HO,{archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,Q.jsx)(WO,{allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),r?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]})}function CL({draft:e,patch:t,automation:n}){let r=e.kind===`schedule`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,Q.jsx)(uh,{"aria-label":n?`Enabled`:`Enable after saving`,checked:e.enabled,onCheckedChange:e=>t({enabled:e})}),(0,Q.jsx)(`span`,{children:n?`Enabled`:`Enable after saving`})]}),(0,Q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:r&&e.schedule.type===`once`?`It runs once at the time set above, then moves to Archived with its task.`:r?`The first run is the next occurrence shown beside the schedule.`:ZI(e.filters.includeExisting)})]})}function wL({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,o]=(0,Z.useState)(()=>OI(e)),[s,c]=(0,Z.useState)(e?.revision),[l,u]=(0,Z.useState)(),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(``),y=e=>o(t=>({...t,...e})),b=async t=>{if(t.preventDefault(),d)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}f(!0),u(void 0);let i=`save`;try{if(e&&s!==void 0){let{automation:t}=await Jt(e.id,NI({...a,enabled:e.enabled},s));c(t.revision),a.enabled!==e.enabled&&(i=`enable`,await st(e.id,a.enabled))}else await nt(MI(a));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof et&&t.status===409&&/revision conflict/i.test(n)?u({section:`form`,message:`Edited elsewhere — reload to see the latest version`,conflict:!0}):u({section:i===`enable`?`enable`:vL(n),message:n})}finally{f(!1)}},x=async()=>{if(!(!e||h)){g(!0),v(``);try{await Oe(e.id),r()}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(!1)}}},S=e?`Save changes`:a.enabled?`Save and enable`:`Save paused`,C=a.kind===`schedule`;return(0,Q.jsx)(aI,{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,children:(0,Q.jsxs)(`form`,{className:`automation-editor grid min-w-0 gap-5 md:grid-cols-[minmax(0,1fr)_320px] md:items-start`,onSubmit:b,children:[(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,Q.jsx)(yL,{title:`Name`,section:`name`,failure:l,children:(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-name`,children:`Name`}),(0,Q.jsx)(rh,{id:`automation-name`,value:a.name,onChange:e=>y({name:e.target.value}),required:!0})]})}),(0,Q.jsxs)(yL,{title:`When`,section:`when`,failure:l,children:[(0,Q.jsx)(bL,{draft:a,patch:y,forge:t,automation:e}),(0,Q.jsx)(xL,{draft:a,patch:y,forge:t,timeZone:n,automation:e})]}),(0,Q.jsx)(yL,{title:`What to run`,section:`run`,failure:l,children:(0,Q.jsx)(SL,{draft:a,patch:y,saving:d,automation:e})}),(0,Q.jsx)(yL,{title:`Enable`,section:`enable`,failure:l,children:(0,Q.jsx)(CL,{draft:a,patch:y,automation:e})}),l?.section===`form`?(0,Q.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,Q.jsx)(`span`,{className:`break-words`,children:l.message}),l.conflict&&i?(0,Q.jsx)(k,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(k,{type:`submit`,disabled:d,children:d?`Saving…`:S}),(0,Q.jsx)(k,{type:`button`,variant:`outline`,asChild:!0,children:(0,Q.jsx)(Y,{to:`/automations`,children:`Cancel`})})]}),e?(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[p?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(k,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:h,onClick:()=>void x(),children:`Delete automation`}),(0,Q.jsx)(k,{type:`button`,variant:`outline`,disabled:h,onClick:()=>{m(!1),v(``)},children:`Keep`})]})]}):(0,Q.jsx)(k,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>m(!0),children:`Delete`}),_?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:_}):null]}):null]}),(0,Q.jsxs)(`aside`,{className:`min-w-0 md:sticky md:top-4`,children:[C?(0,Q.jsx)(hL,{schedule:a.schedule,timeZone:n}):(0,Q.jsxs)(`section`,{className:`rounded-xl border bg-card p-4`,children:[(0,Q.jsx)(`h2`,{className:`mb-2 text-[15px] font-medium`,children:`How it polls`}),(0,Q.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:QI(a)})]}),(0,Q.jsx)(WI,{draft:a})]})]})})}function TL({draft:e,patch:t}){let n=un(),r=Wn(),i=ur(),a=Oi(),o=e.runner??i.data?.defaultRunner??`claude`,s=Cn(o),c=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],l=[...new Set([...de(r.data,a.data),...e.runner?[e.runner]:[]])],u=tc(o,a.data,s.data,[e.model]),d=u.find(t=>t.id===(e.model??``))?.label??e.model??`auto`,f=e=>(0,Q.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,Q.jsx)(Js,{children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)($s,{slot:`automation-workflow-pill`,icon:f(Ca),fieldLabel:!0,ariaLabel:`Workflow`,label:e.workflow??`inline steps`,value:e.workflow??``,disabled:e.workflow===void 0,disabledHint:`This automation carries its own steps.`,options:c.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,Q.jsx)($s,{slot:`automation-runner-pill`,icon:f(sa),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner??`default`,value:e.runner??``,disabled:!a.data,options:[{value:``,label:`default`,desc:`The project’s default runner`},...l.map(e=>({value:e,label:Ei(a.data,e)}))],onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,Q.jsx)($s,{slot:`automation-model-pill`,icon:f(Ea),fieldLabel:!0,ariaLabel:`Model`,label:d,value:e.model??``,options:u.map(e=>({value:e.id,label:e.label,desc:e.desc})),onPick:e=>t({model:e||void 0})})]})})}function EL({data:e,error:t,refresh:n,archived:r=!1,onArchivedChange:i}){let[a,o]=(0,Z.useState)({}),[s,c]=(0,Z.useState)({}),l=(e,t)=>o(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),u=async(e,t)=>{c(t=>({...t,[e]:!0}));try{await t()}catch(t){l(e,{text:t instanceof Error?t.message:String(t),tone:`error`})}finally{c(t=>({...t,[e]:!1}))}},d=e=>u(e.id,async()=>{l(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await wt(e.id);l(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),f=e=>u(e.id,async()=>{l(e.id,void 0),await st(e.id,!e.enabled),await n()}),p=e=>u(e.id,async()=>{l(e.id,void 0),await at(e.id),await n()}),m=e=>u(e.id,async()=>{l(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await gt(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await Le(t);if(r.status===`complete`){l(e.id,{text:`${r.matches??0} filter match${r.matches===1?``:`es`} found; no tasks launched. Counts can include closed items and previously processed events.`,tone:`info`}),n();return}if(r.status===`error`)throw Error(r.error??`Preview failed`);await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)});return(0,Q.jsx)(aI,{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,action:(0,Q.jsx)(k,{asChild:!0,children:(0,Q.jsx)(Y,{to:`/automations/new`,children:`New automation`})}),children:t&&!e?(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,Q.jsx)(oI,{text:t}),(0,Q.jsx)(k,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(DL,{data:e}),i?(0,Q.jsx)(`div`,{className:`mb-4 flex flex-wrap gap-2`,children:(0,Q.jsx)(GI,{pressed:r,onClick:()=>i(!r),children:`Archived`})}):null,r&&e.automations.length===0?(0,Q.jsx)(oI,{text:`No archived one-time schedules.`}):e.automations.length===0?(0,Q.jsx)(X,{icon:(0,Q.jsx)(ga,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,Q.jsx)(k,{asChild:!0,children:(0,Q.jsx)(Y,{to:`/automations/new`,children:`New automation`})})}):(0,Q.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:e.automations.map(t=>(0,Q.jsx)(RL,{automation:t,timeZone:e.timeZone,note:a[t.id],busy:s[t.id]===!0,onRun:()=>void d(t),onToggle:()=>void f(t),onPreview:()=>void m(t),onCancel:()=>void p(t)},t.id))})]}):(0,Q.jsx)(oI,{text:`Loading automations…`})})}function DL({data:e}){return(0,Q.jsx)(`p`,{"data-slot":`automation-scheduler`,className:C(`mb-4 text-xs break-words`,e.scheduler.state===`scheduled`?`text-success`:`text-muted-foreground`),children:`Scheduler ${e.scheduler.state===`scheduled`?`running`:`idle`} · GitHub ${e.available?`available`:`unavailable`}${e.reason?` · ${e.reason}`:``} · ${e.timeZone}`})}function OL(e){return e.kind===`schedule`&&e.schedule?xF(e.schedule):`on ${(e.events??[]).join(`, `)} · every ${Math.round((e.intervalSeconds??300)/60)} min`}var kL={waiting:{label:`Waiting`,dot:`success`},paused:{label:`Paused`,dot:`neutral`},failed:{label:`Failed`,dot:`danger`},missed:{label:`Missed`,dot:`pending`},archived:{label:`Archived`,dot:`neutral`}};function AL(e){if(e.schedule?.type===`once`)return kL[e.onceStatus??(e.enabled?`waiting`:`paused`)]}function jL({automation:e,badge:t}){return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,Q.jsx)(e.kind===`schedule`?Xi:Ri,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-[13px] break-words text-muted-foreground`,children:OL(e)})]}),t?(0,Q.jsx)(MM,{dot:t.dot,children:t.label}):(0,Q.jsx)(MM,{dot:e.enabled?`success`:`neutral`,children:e.enabled?`Enabled`:`Paused`})]})}function ML({automation:e,archive:t}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`mt-3 text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,Q.jsxs)(Q.Fragment,{children:[` · `,(0,Q.jsx)(Y,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:(0,Q.jsx)(k,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(Y,{to:`/automations/${e.id}`,children:`Details`})})})]})}function NL({automation:e,timeZone:t}){let n=e.kind===`schedule`,r=e.enabled&&n?e.nextRunAt:void 0;return(0,Q.jsx)(`p`,{className:`mt-3 text-sm`,children:!n&&e.enabled?(0,Q.jsx)(`span`,{children:`continuous`}):r?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{children:`Next run: ${AF(r,t)}`}),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:` · ${DF(Date.now(),Date.parse(r))}`})]}):(0,Q.jsx)(`span`,{children:`Next run: —`})})}function PL({automation:e,timeZone:t}){let n=e.enabled?qF(e.state):void 0;return n?(0,Q.jsxs)(`p`,{role:`alert`,"data-slot":`automation-failing`,className:`mt-3 text-sm break-words text-destructive`,children:[`The last ${n.consecutiveFailures} checks failed: ${n.lastError}`,n.retryAt?(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${AF(n.retryAt,t)}`}):null]}):null}function FL({automation:e,busy:t,confirmingCancel:n,cancelRef:r,onToggle:i,onRun:a,onPreview:o,onOpenCancel:s}){let c=e.kind===`schedule`,l=e.schedule?.type===`once`;return(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,Q.jsx)(k,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(Y,{to:`/automations/${e.id}`,children:`Edit`})}),(0,Q.jsx)(k,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(Y,{to:`/automations/${e.id}/log`,children:`Execution log`})}),(0,Q.jsx)(k,{variant:`outline`,"data-action":`automation-toggle`,disabled:t,onClick:i,children:e.enabled?`Pause`:`Enable`}),c?(0,Q.jsx)(k,{variant:`outline`,"data-action":`automation-run`,disabled:t,onClick:a,children:`Run now`}):(0,Q.jsx)(k,{variant:`outline`,"data-action":`automation-preview`,disabled:t,onClick:o,children:`Test filter`}),l&&!n?(0,Q.jsx)(k,{variant:`outline`,ref:r,"data-action":`automation-cancel`,disabled:t,onClick:s,children:`Cancel`}):null]})}function IL({automation:e,busy:t,keepRef:n,onConfirm:r,onKeep:i}){return(0,Q.jsxs)(`div`,{className:`mt-3 grid justify-items-start gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(k,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,Q.jsx)(k,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function LL({note:e}){return(0,Q.jsxs)(`p`,{role:e.tone===`error`?`alert`:`status`,className:C(`mt-3 text-sm break-words`,e.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[e.text,e.runId?(0,Q.jsxs)(Q.Fragment,{children:[` · `,(0,Q.jsx)(Y,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`})]}):null]})}function RL({automation:e,timeZone:t,note:n,busy:r,onRun:i,onToggle:a,onPreview:o,onCancel:s}){let[c,l]=(0,Z.useState)(!1),u=(0,Z.useRef)(null),d=(0,Z.useRef)(null),f=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let e=f.current===`keep`?d.current:f.current===`cancel`?u.current:null;f.current=null,e?.focus()},[c]);let p=()=>{f.current=`keep`,l(!0)},m=()=>{f.current=`cancel`,l(!1)},h=e.archived;return(0,Q.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,Q.jsx)(jL,{automation:e,badge:AL(e)}),h?(0,Q.jsx)(ML,{automation:e,archive:h}):null,h?null:(0,Q.jsx)(NL,{automation:e,timeZone:t}),h?null:(0,Q.jsx)(PL,{automation:e,timeZone:t}),h?null:(0,Q.jsx)(FL,{automation:e,busy:r,confirmingCancel:c,cancelRef:u,onToggle:a,onRun:i,onPreview:o,onOpenCancel:p}),e.schedule?.type===`once`&&!h&&c?(0,Q.jsx)(IL,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,Q.jsx)(LL,{note:n}):null,(0,Q.jsx)(hI,{automationId:e.id,automationName:e.name,timeZone:t})]})}function zL(e){let t=Ss(),n=Av(),[r,i]=(0,Z.useState)(),[a,o]=(0,Z.useState)(``),s=(0,Z.useCallback)(t=>pe({signal:t,...e?{archived:e}:{}}).then(e=>{t?.aborted||(i(e),o(``))}).catch(e=>{t?.aborted||o(String(e))}),[e]);return(0,Z.useEffect)(()=>{n&&s()},[n,s]),(0,Z.useEffect)(()=>P(async e=>{n&&await s(e)}),[n,s]),(0,Z.useEffect)(()=>rl((e,n)=>{if(e!==`automation-change`)return;let r=n;typeof r.project==`string`&&(t===null||r.project===t)&&s()}),[t,s]),{data:r,error:a,refresh:s}}function BL({mode:e=`list`}){let{automationId:t}=s(),n=gs(),[r,i]=(0,Z.useState)(!1),{data:a,error:o,refresh:c}=zL(e===`list`?r?`only`:void 0:`include`),[l,u]=(0,Z.useState)(0),d=kv();if(d===`unknown`)return(0,Q.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,Q.jsx)(oI,{text:`Loading automations…`})});if(d===`unavailable`)return(0,Q.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,Q.jsx)(X,{icon:(0,Q.jsx)(ga,{}),tone:`neutral`,title:`Automations are off`,subtitle:`This server does not run schedules, poll GitHub or launch tasks from them. Unset CEZ_AUTOMATIONS or set it to 1 and restart Squawk to turn automations on.`,heading:`h2`})});let f=()=>{n(`/automations`),c()},p=a?.automations.find(e=>e.id===t);if(e===`list`)return(0,Q.jsx)(EL,{data:a,error:o,refresh:c,archived:r,onArchivedChange:i});if(!a)return o?(0,Q.jsx)(aI,{title:`Automations`,subtitle:`Could not load automations.`,children:(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,Q.jsx)(oI,{text:o}),(0,Q.jsx)(k,{variant:`outline`,onClick:()=>void c(),children:`Retry`})]})}):(0,Q.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,Q.jsx)(oI,{text:`Loading automations…`})});let m={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,Q.jsx)(wL,{forge:m,timeZone:a.timeZone,onSaved:f}):e===`edit`?p?p.archived?(0,Q.jsx)(gI,{automation:p,timeZone:a.timeZone,onDeleted:f}):(0,Q.jsx)(wL,{automation:p,forge:m,timeZone:a.timeZone,onSaved:f,onReload:()=>void c().then(()=>u(e=>e+1))},`${p.id}:${l}`):(0,Q.jsx)(aI,{title:`Automation not found`,subtitle:`This automation may have been removed.`,children:(0,Q.jsx)(k,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(Y,{to:`/automations`,children:`Back to automations`})})}):t?(0,Q.jsx)(mI,{automationId:t,automationName:p?.name,timeZone:a.timeZone,readOnly:!!p?.archived}):(0,Q.jsx)(oI,{text:`Automation not found.`})}function VL({health:e,projects:t,repository:n,onAction:r}){return(0,Q.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-6 max-md:p-4`,"aria-labelledby":`add-project-heading`,children:[(0,Q.jsx)(`h2`,{id:`add-project-heading`,className:`text-lg font-normal leading-[1.5]`,children:`Add project`}),(0,Q.jsx)(`p`,{className:`text-[13px] leading-[1.5] text-muted-foreground`,children:`Start a new repository, open an existing local folder, or clone a GitHub repository.`}),(0,Q.jsxs)(`dl`,{className:`space-y-4 text-[13px] leading-[1.5] text-muted-foreground`,children:[e.data?.repoRoot?(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,Q.jsx)(`dt`,{children:`Local folder`}),(0,Q.jsx)(`dd`,{className:`min-w-0 break-all`,children:e.data.repo?.root??e.data.repoRoot})]}):null,n?(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,Q.jsx)(`dt`,{children:`Repository`}),(0,Q.jsx)(`dd`,{className:`min-w-0 break-all`,children:n.replace(/^https:\/\//,``)})]}):null,t.data?.projectsDir?(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,Q.jsx)(`dt`,{children:`Checkout folder`}),(0,Q.jsx)(`dd`,{className:`min-w-0 break-all`,children:t.data.projectsDir})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(k,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,"data-action":`new-project`,onClick:()=>r(`new`),children:`New project`}),(0,Q.jsx)(k,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,onClick:()=>r(`local`),children:`Open local folder`}),(0,Q.jsx)(k,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,onClick:()=>r(`clone`),children:`Clone from GitHub`})]})]})}function HL({health:e,copying:t,onCopy:n}){return(0,Q.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-6 max-md:p-4`,"aria-labelledby":`tools-heading`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h2`,{id:`tools-heading`,className:`text-lg font-normal leading-[1.5]`,children:`Tools diagnostics`}),(0,Q.jsx)(Y,{to:Hx,"data-slot":`tools-settings`,className:Ux,children:`Tool settings ›`})]}),(0,Q.jsx)(`p`,{className:`text-[13px] leading-[1.5] text-muted-foreground`,children:`Check the tools available to this local workspace.`}),e.isError?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Could not refresh tool diagnostics. Recheck to retry.`}):null,!e.data&&!e.isError?(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Checking installed tools…`}):null,e.data?(0,Q.jsx)(`dl`,{className:`space-y-4 text-[13px] leading-[1.5] text-muted-foreground`,children:e.data.checks.map(e=>{let t=Vx(e);return(0,Q.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":e.available,className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,Q.jsxs)(`dt`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)($,{tone:zx(e)}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] font-medium text-foreground`,children:e.name})]}),(0,Q.jsxs)(`dd`,{className:`flex min-w-0 flex-1 items-center gap-x-3 text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 break-words`,children:[Bx(e),e.version?` · ${e.version}`:``]}),e.available?null:(0,Q.jsx)(Y,{to:Hx,"data-slot":`tool-setup`,className:`${Ux} ml-auto`,children:`Set up ›`})]}),t?(0,Q.jsx)(`dd`,{"data-slot":`tool-hint`,className:`basis-full min-w-0 break-words pl-[15px] text-xs leading-snug text-muted-foreground`,children:t}):null]},e.name)})}):null,e.data?.checks.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tool diagnostics reported by this server.`}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(k,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:e.isFetching?`Checking tools…`:`Recheck tools`}),(0,Q.jsx)(k,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,disabled:!e.data||t,onClick:()=>void n(),children:t?`Copying…`:`Copy diagnostics`})]})]})}function UL(){let e=En(),t=bn(),n=Cr(e.data?.repo?.remote),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!1);return(0,Q.jsxs)(`div`,{"data-route":`workspace-tools`,className:`w-full space-y-[22px] px-9 py-9 max-md:px-[18px] max-md:py-6`,children:[(0,Q.jsx)(`h1`,{className:`text-[28px] font-normal leading-[1.5] max-md:text-[24px]`,children:`Workspace tools`}),(0,Q.jsx)(VL,{health:e,projects:t,repository:n,onAction:i}),(0,Q.jsx)(HL,{health:e,copying:a,onCopy:async()=>{if(!(!e.data||a)){o(!0);try{await navigator.clipboard.writeText(JSON.stringify({version:e.data.version,checks:e.data.checks},null,2)),G(`Diagnostics copied`)}catch{G(`Could not copy diagnostics. Please try again.`,{tone:`danger`})}finally{o(!1)}}}}),r===`new`?(0,Q.jsx)(Ch,{open:!0,onOpenChange:e=>{e||i(null)}}):null,r===`local`?(0,Q.jsx)(th,{open:!0,onOpenChange:e=>{e||i(null)}}):null,r===`clone`?(0,Q.jsx)(oh,{open:!0,onOpenChange:e=>{e||i(null)}}):null]})}var WL=(0,Z.lazy)(()=>W(()=>import(`./task-thread-B7GO7yjQ.js`).then(e=>({default:e.TaskThreadRoute})),__vite__mapDeps([35,5,7,8,9,27,10,11,26,28,29,30,12,36,13,23,21,22,37,38,39,20,16,17,40,41,42,43,24,33,34,4,44,45,46,19,18,47,32,48,49,50]))),GL=(0,Z.lazy)(()=>W(()=>import(`./task-changes-R9UrXbyp.js`).then(e=>({default:e.TaskChangesRoute})),__vite__mapDeps([51,5,7,8,9,10,11,26,27,28,29,30,12,36,13,23,21,22,37,39,38,20,16,17,40,41,42,43,24,33,34,4,44,45,52,53,46,32,54,55,56,48]))),KL=(0,Z.lazy)(()=>W(()=>import(`./task-files-BuoYB5UQ.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([57,5,7,8,9,10,11,26,27,28,29,30,12,22,13,39,36,23,21,37,38,20,16,17,40,41,42,43,24,33,34,4,44,45,31,32]))),qL=(0,Z.lazy)(async()=>{let{TaskReportRoute:e}=await W(async()=>{let{TaskReportRoute:e}=await import(`./report-reader-RkXaRhiv.js`);return{TaskReportRoute:e}},__vite__mapDeps([25,5,7,8,9,10,11,26,27,28,29,30,12,22,31,13,32,33,34,4]));return{default:e}}),JL=(0,Z.lazy)(()=>W(()=>import(`./task-commits-BgwKBJPa.js`).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([58,5,7,8,9,10,11,26,27,28,29,30,12,36,13,23,21,22,37,39,38,20,16,17,40,41,42,43,24,33,34,4,44,45,32,59,53,46,55,56,48]))),YL=(0,Z.lazy)(()=>W(()=>import(`./task-github-item-DQ_suCNz.js`).then(e=>({default:e.TaskGithubItemRoute})),__vite__mapDeps([60,7,5,8,9,10,11,26,27,28,29,30,12,36,13,23,21,22,37,39,38,20,16,17,40,41,42,43,24,33,34,4,44,45,32,61,46,18,62,47,63,55,56,48,64]))),XL=(0,Z.lazy)(()=>W(()=>import(`./repo-git-CWn2Z4Un.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([65,5,7,8,9,10,11,26,27,28,29,30,12,36,13,23,21,22,37,66,53,46,52,16,17,41,24,32,54,55,56,48,59,67]))),ZL=(0,Z.lazy)(()=>W(()=>import(`./github-BZSy7bl0.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([68,5,7,8,9,10,11,26,27,28,29,30,12,36,13,23,21,22,37,66,17,62,24,47,38,43,42,63,32,61,46,40,18,33,34,4,55,56,48,44,64]))),QL=(0,Z.lazy)(()=>W(()=>import(`./reports-CiU1cLpn.js`).then(e=>({default:e.ReportsRoute})),__vite__mapDeps([69,5,7,8,9,10,11,28,30,24,49,70]))),$L=(0,Z.lazy)(()=>W(()=>import(`./workflows-b6WsU1qg.js`).then(e=>({default:e.WorkflowsRoute})),__vite__mapDeps([71,5,7,8,9,10,11,26,27,28,29,30,12,22,21,23,42,43,72,63,32,73]))),eR=(0,Z.lazy)(()=>W(()=>import(`./activity-route-CZsGE2kr.js`).then(e=>({default:e.ProjectActivityRoute})),__vite__mapDeps([74,5,7,8,9,14,13,75,27,10,11,29,30,15,46,40,24,37,76]))),tR=(0,Z.lazy)(()=>W(()=>import(`./global-activity-route-BPvST6Do.js`).then(e=>({default:e.GlobalActivityRoute})),__vite__mapDeps([77,5,7,8,9,26,27,10,11,28,29,30,12,75,13,15,46,40,24,37,76]))),nR=(0,Z.lazy)(()=>W(()=>import(`./skills-BeZ9naR_.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([78,5,7,8,9,10,11,26,27,28,29,30,12,38,22,24,63])));function rR(){let e=a();return(0,Q.jsx)(xs,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function iR({sectionId:e}){let t=a();return(0,Q.jsx)(y,{to:{pathname:rj(`global`,e),search:t.search,hash:t.hash},replace:!0})}function aR(){return(0,Q.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function oR(){let{projectId:e=``}=s(),t=a(),n=bn(),r=En();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,Q.jsx)(y,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,Q.jsx)(aR,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,Q.jsx)(Ck,{projectId:e,registry:n.data})}else if(!n.isError)return(0,Q.jsx)(aR,{});return(0,Q.jsx)(bt,{projectId:n.data?.bootProject===e?null:e,children:(0,Q.jsx)(v,{},e)})}function sR(){let{projectId:e=``}=s();return(0,Q.jsx)(sk,{},e)}var cR=/^\/tasks\/([0-9a-f-]{36})(?=\/|$)/i;function lR(e,t){let n=e.data?.bootProject??t.data?.bootProject;return{resolved:n,settled:(e.data!==void 0||e.isError)&&(t.data!==void 0||t.isError),boot:n??`default`}}function uR(e,t,n){if(!(e.pathname===`/`&&e.search===``&&e.hash===``))return;if(t.data===void 0&&!t.isError)return(0,Q.jsx)(aR,{});let r=$_(U_(),t.data,n);if(r!==null)return(0,Q.jsx)(y,{to:r,replace:!0})}function dR(e,t,n,r,i,a){if(!n)return null;let o=i.data?.runs.find(t=>t.id===e)?.projectId;return o===void 0?r?a.data===void 0&&!a.isError?null:a.data?.runs.find(t=>t.id===e)?.projectId??t:t:o}function fR(e,t){let n=t.pathname===`/p`||t.pathname===`/p/`?`/`:t.pathname;return(0,Q.jsx)(y,{to:`/p/${encodeURIComponent(e)}${n}${t.search}${t.hash}`,replace:!0})}function pR(){let e=a(),t=En(),n=bn(),r=cR.exec(e.pathname)?.[1]??null,i=Jn(r!==null),o=i.data!==void 0||i.isError,s=i.data!==void 0&&!i.data.runs.some(e=>e.id===r),c=br(r!==null&&s?r:``),{resolved:l,settled:u,boot:d}=lR(t,n);if(l===void 0&&!u)return(0,Q.jsx)(aR,{});let f=uR(e,n,l);if(f!==void 0)return f;let p=d;if(r!==null){let e=dR(r,d,o,s,i,c);if(e===null)return(0,Q.jsx)(aR,{});p=e}return fR(p,e)}function mR(){return(0,Q.jsxs)(f,{path:`/p/:projectId`,element:(0,Q.jsx)(oR,{}),children:[(0,Q.jsx)(f,{index:!0,element:(0,Q.jsx)(UN,{})}),(0,Q.jsx)(f,{path:`new`,element:(0,Q.jsx)(sR,{})}),(0,Q.jsx)(f,{path:`activity`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(tE,{}),children:(0,Q.jsx)(eR,{})})}),(0,Q.jsxs)(f,{path:`tasks/:id`,element:(0,Q.jsx)(kA,{}),children:[(0,Q.jsx)(f,{index:!0,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(kk,{}),children:(0,Q.jsx)(WL,{})})}),(0,Q.jsx)(f,{path:`changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Tk,{tab:`changes`}),children:(0,Q.jsx)(GL,{})})}),(0,Q.jsx)(f,{path:`files`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Tk,{tab:`files`}),children:(0,Q.jsx)(KL,{})})}),(0,Q.jsx)(f,{path:`report`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{"data-route":`task-report`,children:(0,Q.jsx)(`h1`,{className:`p-4 text-sm text-soft-foreground`,children:`Loading report…`})}),children:(0,Q.jsx)(qL,{})})}),(0,Q.jsx)(f,{path:`commits`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Tk,{tab:`changes`}),children:(0,Q.jsx)(JL,{})})}),(0,Q.jsx)(f,{path:`commits/:sha`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Tk,{tab:`changes`}),children:(0,Q.jsx)(JL,{})})}),(0,Q.jsx)(f,{path:`issue/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Ok,{kind:`issue`}),children:(0,Q.jsx)(YL,{kind:`issue`})})}),(0,Q.jsx)(f,{path:`pr/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Ok,{kind:`pr`}),children:(0,Q.jsx)(YL,{kind:`pr`})})})]}),(0,Q.jsx)(f,{path:`git`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(xk,{}),children:(0,Q.jsx)(XL,{section:`main`,index:!0})})}),(0,Q.jsx)(f,{path:`git/commits`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(xk,{}),children:(0,Q.jsx)(XL,{section:`main`})})}),(0,Q.jsx)(f,{path:`git/commits/:sha`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(xk,{}),children:(0,Q.jsx)(XL,{section:`main`})})}),(0,Q.jsx)(f,{path:`git/not-landed`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(xk,{}),children:(0,Q.jsx)(XL,{section:`not-landed`})})}),(0,Q.jsx)(f,{path:`git/cleanup`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(xk,{}),children:(0,Q.jsx)(XL,{section:`cleanup`})})}),(0,Q.jsx)(f,{path:`git/branches`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(xk,{}),children:(0,Q.jsx)(XL,{section:`branches`})})}),(0,Q.jsx)(f,{path:`git/changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(xk,{}),children:(0,Q.jsx)(XL,{section:`changes`})})}),(0,Q.jsx)(f,{path:`github`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(nE,{}),children:(0,Q.jsx)(ZL,{view:`issues`,index:!0})})}),(0,Q.jsx)(f,{path:`github/prs`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(nE,{}),children:(0,Q.jsx)(ZL,{view:`prs`})})}),(0,Q.jsx)(f,{path:`github/issues/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(nE,{}),children:(0,Q.jsx)(ZL,{view:`issues`})})}),(0,Q.jsx)(f,{path:`github/prs/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(nE,{}),children:(0,Q.jsx)(ZL,{view:`prs`})})}),(0,Q.jsx)(f,{path:`github/prs/:n/changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(nE,{}),children:(0,Q.jsx)(ZL,{view:`prs`,changes:!0})})}),(0,Q.jsx)(f,{path:`automations`,element:(0,Q.jsx)(BL,{})}),(0,Q.jsx)(f,{path:`automations/new`,element:(0,Q.jsx)(BL,{mode:`new`})}),(0,Q.jsx)(f,{path:`automations/:automationId`,element:(0,Q.jsx)(BL,{mode:`edit`})}),(0,Q.jsx)(f,{path:`automations/:automationId/log`,element:(0,Q.jsx)(BL,{mode:`log`})}),(0,Q.jsx)(f,{path:`skills`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Sk,{}),children:(0,Q.jsx)(nR,{})})}),(0,Q.jsx)(f,{path:`reports`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`p`,{role:`status`,children:`Loading reports…`}),children:(0,Q.jsx)(QL,{})})}),(0,Q.jsx)(f,{path:`workflows`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(wk,{}),children:(0,Q.jsx)($L,{})})}),(0,Q.jsx)(f,{path:`workflows/:name`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(wk,{}),children:(0,Q.jsx)($L,{})})}),(0,Q.jsx)(f,{path:`settings`,element:(0,Q.jsx)(lj,{})}),(0,Q.jsx)(f,{path:`settings/skills`,element:(0,Q.jsx)(rR,{})}),zT(`project`).map(e=>(0,Q.jsx)(f,{path:`settings/${e.id}`,element:(0,Q.jsx)(cj,{section:e,scope:`project`})},e.id)),zT(`global`).map(e=>(0,Q.jsx)(f,{path:`settings/${e.id}`,element:(0,Q.jsx)(iR,{sectionId:e.id})},e.id)),(0,Q.jsx)(f,{path:`*`,element:(0,Q.jsx)(yk,{})})]})}function hR(e){let t=M(ee(mR()),e),n=t?.at(-1);return!t||!n||n.route.path===`*`?null:{pattern:`/${t.slice(1).map(e=>e.route.path).filter(e=>e!==void 0).join(`/`)}`.replace(/\/$/,``)||`/`,params:n.params}}function gR(){return(0,Q.jsxs)(A,{children:[mR(),(0,Q.jsx)(f,{path:`/tasks`,element:(0,Q.jsx)(FP,{})}),(0,Q.jsx)(f,{path:`/tools`,element:(0,Q.jsx)(UL,{})}),(0,Q.jsx)(f,{path:`/activity`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(tE,{}),children:(0,Q.jsx)(tR,{})})}),(0,Q.jsx)(f,{path:`/settings/global`,element:(0,Q.jsx)(y,{to:ij,replace:!0})}),(0,Q.jsx)(f,{path:`/settings/global/skills`,element:(0,Q.jsx)(y,{to:`/skills`,replace:!0})}),zT(`global`).map(e=>(0,Q.jsx)(f,{path:rj(`global`,e.id),element:(0,Q.jsx)(cj,{section:e,scope:`global`})},e.id)),(0,Q.jsx)(f,{path:`*`,element:(0,Q.jsx)(pR,{})})]})}function _R(){let[e]=(0,Z.useState)(Wl);return(0,Z.useEffect)(()=>Dr(e),[e]),(0,Q.jsx)(Kl,{children:(0,Q.jsx)(ie,{client:e,children:(0,Q.jsxs)(Sl,{children:[(0,Q.jsx)(Ul,{}),(0,Q.jsx)($T,{}),(0,Q.jsx)(bg,{children:(0,Q.jsx)(kw,{children:(0,Q.jsxs)(_,{children:[(0,Q.jsx)(QT,{}),(0,Q.jsx)(Gl.Provider,{value:hR,children:(0,Q.jsx)(Xa,{children:(0,Q.jsx)(ZT,{children:(0,Q.jsx)(gR,{})})})}),(0,Q.jsx)(Ci,{})]})})})]})})})}var vR=document.querySelector(`meta[name="cez-api-base"]`)?.getAttribute(`content`);u(ne(vR,void 0,void 0));var yR=document.getElementById(`root`);if(!yR)throw Error(`Squawk: #root container is missing from index.html`);(0,Pc.createRoot)(yR).render((0,Q.jsx)(Z.StrictMode,{children:(0,Q.jsx)(_R,{})}));export{kS as $,Ah as $t,bk as A,kb as At,oE as B,r_ as Bt,Nk as C,Ob as Ct,Tk as D,jb as Dt,Ek as E,xb as Et,$D as F,Nv as Ft,NC as G,Xg as Gt,tE as H,n_ as Ht,YD as I,Ov as It,TC as J,Ng as Jt,MC as K,Tg as Kt,QD as L,Av as Lt,tO as M,pb as Mt,rO as N,hy as Nt,wk as O,Pb as Ot,eO as P,Iv as Pt,jS as Q,jh as Qt,KD as R,V_ as Rt,Ik as S,Nb as St,Ok as T,Sb as Tt,ew as U,Zg as Ut,nE as V,e_ as Vt,yC as W,$g as Wt,RS as X,Mg as Xt,zS as Y,jg as Yt,PS as Z,$ as Zt,dA as _,tu as _n,hx as _t,lM as a,Hu as an,xS as at,$k as b,Yl as bn,Ab as bt,jA as c,Nu as cn,mS as ct,DA as d,wu as dn,lS as dt,kh as en,TS as et,TA as f,yu as fn,rS as ft,aA as g,nu as gn,oS as gt,lA as h,ru as hn,iS as ht,jM as i,Gu as in,dS as it,nO as j,yb as jt,xk as k,Cb as kt,NA as l,Au as ln,eS as lt,cA as m,uu as mn,aS as mt,oN as n,Xu as nn,CS as nt,cM as o,Ru as on,SS as ot,sA as p,hu as pn,sS as pt,EC as q,Ag as qt,MM as r,qu as rn,fS as rt,sM as s,Pu as sn,yS as st,DF as t,rh as tn,DS as tt,MA as u,Tu as un,cS as ut,Zk as v,eu as vn,Hb as vt,kk as w,Db as wt,Rk as x,Jl as xn,wb as xt,Qk as y,Ql as yn,Vb as yt,aE as z,t_ as zt};
|
|
13
|
+
`)[0]??``;return n.length>t?`${n.slice(0,t-1)}…`:n}function wO(e){let{task:t,steps:n,agentProfile:r,model:i,modelsLocked:a,effort:o,runner:s,runnerExplicit:c,defaultRunner:l,images:u,archiveWhenDone:d,autoMergePr:f,allowWorkers:p,allowMessaging:m}=e;return{task:t,steps:[...n],...r?{agentProfile:r}:{},model:a?void 0:i||void 0,effort:a?void 0:o||void 0,runner:nc(s,l,c),images:u.length>0?[...u]:void 0,...Es({archiveWhenDone:d,autoMergePr:f,allowWorkers:p,allowMessaging:m})}}function TO(e,t,n){return{runner:e,agentProfile:t||null,...e===n?{}:{model:null,effort:null}}}function EO(e,t){let n=gO(e);return{...n,...t.runner===void 0?{}:TO(t.runner,t.account,n.runner),...t.ref===``?{}:{text:t.ref},...t.skill===``?{}:{source:{source:`skill`,ref:t.skill,...t.skillPath===void 0?{}:{path:t.skillPath}}}}}function DO(e,t,n){let[r,i]=(0,Z.useState)(()=>EO(e,t)),a=(0,Z.useRef)(r);(0,Z.useEffect)(()=>{_O(a.current,e)},[e]);let o=(0,Z.useRef)(!1),s=(0,Z.useRef)(!0);(0,Z.useEffect)(()=>(s.current=!0,()=>{s.current=!1}),[]);let c=t=>{if(!s.current||o.current)return;let n={...a.current,...t};a.current=n,_O(n,e),i(n)},l=(0,Z.useRef)(t.runner===void 0);return(0,Z.useEffect)(()=>{!l.current||n===void 0||(l.current=!1,c(TO(n,t.account,a.current.runner)))},[n]),{draft:r,update:c,clearStarted:t=>{if(hO(e)!==t)return;vO(e,t);let n=gO(e);a.current=n,s.current&&i(n)},submissionPending:o,mounted:s}}function OO(e,t,n,r){let i=un(),a=hn(n,r),o=a.data,s=t.data?.skillUsage,c=(0,Z.useMemo)(()=>Tc(o??[],s),[o,s]),l=i.data?.workflows??[],u=i.data!==void 0&&!t.isPending,d=Ts(e,c,l,a.unchecked),f=d?.source===`skill`?c.find(e=>e.id===d.ref&&(d.path===void 0||e.path===d.path)):void 0;return{skillList:c,skillUsage:s,workflowList:l,sourcesReady:u,source:d,selectedSkill:f,skillsSettled:!a.isPending,listUnchecked:a.unchecked,unchecked:a.unchecked||d?.source===`skill`&&!f}}function kO(e){let{uiState:t,source:n,sourcesReady:r,draftText:i,submissionPending:a,update:o}=e,s=t.data?.promptTemplates,c=(0,Z.useMemo)(()=>ec(s),[s]),l=Qs(c,n?.source===`skill`?[n.ref]:[]),u=(0,Z.useRef)(i);u.current=i;let d=(0,Z.useRef)(``);return(0,Z.useEffect)(()=>{if(!r||a.current)return;let e=Bs(u.current,d.current,l);d.current=e.applied,e.text!==u.current&&o({text:e.text})},[l,r]),c}function AO(e,t){let n=Wn(),r=Oi(),i=de(n.data,r.data),a=t.data?.defaultRunner,o=a??`claude`,s=i.length>0?Ps(e.runner,i,o):null,c=s??o,l=n.isSuccess&&i.length>0,u={isPending:n.isPending||r.isPending,isError:n.isError||r.isError},d=$D(),f=Cn(c,!0,d.accounts.some(t=>t.provider===c&&t.id===e.agentProfile)?e.agentProfile:d.repoAccount?.[c]),p=t.data?.modelsLocked===!0,m=t.data?.defaultModels,h=s===null?[]:tc(s,r.data,f.data,[e.model,m?.[s]]),g=s===null?``:rc(p?null:e.model,s,r.data,m,f.data),_=Is(g,f.data);return{providers:u,registered:r,runners:i,defaultRunner:a,runner:s,displayRunner:c,providersReady:l,catalog:f,modelsLocked:p,models:h,model:g,effortOptions:_,effort:p?``:Rs(e.effort,_)}}function jO(e,t){let n=cr(),{accounts:r,repoAccount:i}=$D(),a=r.some(n=>n.provider===e&&n.id===t);return{accountChoices:r,repoAccount:i,accountsSettled:!n.isPending,agentProfile:a?t:null}}function MO(e){let t=(0,Z.useRef)(!1),n=(0,Z.useRef)(void 0);(0,Z.useEffect)(()=>{n.current===void 0&&(n.current=document.activeElement);let r=e&&!t.current;t.current=e,r&&(document.activeElement===document.body||document.activeElement===n.current)&&document.querySelector(`textarea[aria-label="Describe a task for the agent"]`)?.focus()},[e])}function NO(e){let t=e.workspaceConfig.data?.composerDefaults;return oO({hasGit:e.hasGit,planFirst:e.draft.planFirst,explicitAutonomous:e.draft.autonomous,explicitWorktree:e.draft.worktree,configuredAutonomous:t?.autonomous??t?.inheritedAutonomous??`source-dependent`,configuredWorktree:t?.worktree??t?.inheritedWorktree??!0,source:e.source?.source??`workflow`})}function PO(e){let t=bn(),n=t.data?.projects??[],r=e??t.data?.bootProject,i=nO(n.find(e=>e.id===r)),[a,o]=(0,Z.useState)(!1);return{projectList:n,webhookTargets:i,notifyOn:i.length>0&&a,setNotifyChoice:o}}function FO(e){let[t,n]=(0,Z.useState)(()=>typeof window<`u`&&window.innerWidth<=767);return(0,Z.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=()=>n(window.innerWidth<=767||t.getBoundingClientRect().width<550);r();let i=typeof ResizeObserver>`u`?null:new ResizeObserver(r);return i?.observe(t),window.addEventListener(`resize`,r),()=>{i?.disconnect(),window.removeEventListener(`resize`,r)}},[]),t}function IO(e){let t=gs(),[n,r]=(0,Z.useState)(()=>e.deepLink.ref!==``||e.deepLink.skillPath!==void 0);LO(e.search,t),RO({pending:n,setPending:r,deepLink:e.deepLink,sourcesReady:e.sourcesReady,listUnchecked:e.listUnchecked,skillList:e.skillList,update:e.update})}function LO(e,t){let n=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{n.current||(n.current=!0,e.toString()!==``&&t(`/new`,{replace:!0}))},[])}function RO(e){let{pending:t,sourcesReady:n,deepLink:r}=e;(0,Z.useEffect)(()=>{if(!t||!n)return;e.setPending(!1);let i=!e.listUnchecked&&r.skill!==``&&!Fs({source:`skill`,ref:r.skill,...r.skillPath===void 0?{}:{path:r.skillPath}},e.skillList,[])?r.skill:``;i!==``&&r.ref!==``&&e.update({text:aO(r.skill,r.ref),source:null});let{message:a,tone:o}=iO(i,r.ref!==``);G(a,{tone:o}),document.querySelector(`[data-slot="composer"] button[aria-label="Start task"], [data-slot="composer"] button[aria-label="Plan task"]`)?.focus()},[t,n])}function zO(e){return e.isPending?`Checking agent providers…`:e.isError?`Provider authentication could not be verified.`:`Connect an agent provider before starting a task.`}function BO(e,t,n){be({lastTask:e?{source:e.source,ref:e.ref}:null,...e?{recentSources:ic(t.data?.recentSources,{source:e.source,ref:e.ref})}:{},...e?.source===`skill`&&t.data!==void 0?{skillUsage:Oc(t.data.skillUsage,e.ref)}:{}}).then(()=>n.invalidateQueries({queryKey:U.uiState})).catch(()=>{})}function VO(e){let t=gs(),n=I(),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(!1),{draft:l,draftProjectId:u,engine:d,mounted:f}=e,{providers:p,providersReady:m,runner:h}=d,g=(r,i)=>{e.clearStarted(i),n.invalidateQueries({queryKey:U.runs.all}),f.current&&t(Ds(r))};return{plan:r,setPlan:i,planning:a,starting:s,submit:async(t,r)=>{let a=hO(u);if(!m||h===null)throw Error(zO(p));if(!e.sourcesReady)throw Error(`Still loading workflows and skills — try again in a second.`);if(l.agentProfile&&!e.accountsSettled)throw Error(`Still loading agent accounts — try again in a second.`);if(l.planFirst){o(!0);try{let e=await Be(t);f.current&&i(yO(t,r,e))}finally{o(!1)}return}let s=await Ht(Ms(Hs({task:t,source:e.source,model:d.model,modelsLocked:d.modelsLocked,effort:d.effort,runner:h,runnerExplicit:l.runner!==null,agentProfile:e.agentProfile,defaultRunner:d.defaultRunner,images:r,worktree:e.runMode.worktree,autonomous:e.runMode.autonomous,archiveWhenDone:l.archiveWhenDone,autoMergePr:l.autoMergePr,allowWorkers:l.allowWorkers,allowMessaging:l.allowMessaging}),e.notifyOn));BO(e.source,e.uiState,n),g(s,a)},startPlanned:async()=>{if(r===null||r.steps.length===0||s||!m||h===null||l.agentProfile&&!e.accountsSettled)return;let t=hO(u);c(!0);try{let n=await Ht(Ms(wO({task:r.task,steps:r.steps,agentProfile:e.agentProfile,model:d.model,modelsLocked:d.modelsLocked,effort:d.effort,runner:h,runnerExplicit:l.runner!==null,defaultRunner:d.defaultRunner,images:r.images,archiveWhenDone:l.archiveWhenDone,autoMergePr:l.autoMergePr,allowWorkers:l.allowWorkers,allowMessaging:l.allowMessaging}),e.notifyOn));i(null),g(n,t)}catch(e){G(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{c(!1)}}}}function HO({archiveWhenDone:e,autoMergePr:t,onChange:n,disabled:r=!1,embedded:i=!1}){let a=(0,Z.useId)();return(0,Q.jsxs)(`fieldset`,{"data-slot":`completion-controls`,"data-embedded":i||void 0,className:`grid min-w-0 gap-3`,children:[(0,Q.jsx)(`legend`,{className:i?`sr-only`:`text-sm font-medium [margin-block-end:0.5rem]`,children:`After Done`}),(0,Q.jsxs)(`label`,{htmlFor:`${a}-archive`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,Q.jsx)(`span`,{id:`${a}-archive-label`,children:`Archive when Done`}),i?(0,Q.jsx)(`span`,{id:`${a}-archive-help`,className:`completion-control-help`,children:`Move to Archived after Done, even without a PR. You can restore it later.`}):null]}),(0,Q.jsx)(uh,{id:`${a}-archive`,className:`completion-switch`,checked:e,disabled:r,"aria-labelledby":`${a}-archive-label`,"aria-describedby":`${a}-archive-help`,onCheckedChange:e=>n({archiveWhenDone:e})})]}),i?null:(0,Q.jsx)(`p`,{id:`${a}-archive-help`,className:`text-xs break-words text-muted-foreground`,children:`Move the task to Archived after it reaches Done. You can restore it later.`}),(0,Q.jsxs)(`label`,{htmlFor:`${a}-merge`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,Q.jsx)(`span`,{id:`${a}-merge-label`,children:`Auto-merge PR`}),i?(0,Q.jsx)(`span`,{id:`${a}-merge-help`,className:`completion-control-help`,children:`After Done, mark the PR ready and merge when current-head CI and GitHub rules allow.`}):null]}),(0,Q.jsx)(uh,{id:`${a}-merge`,className:`completion-switch`,checked:t,disabled:r,"aria-labelledby":`${a}-merge-label`,"aria-describedby":`${a}-merge-help`,onCheckedChange:e=>n({autoMergePr:e})})]}),i?null:(0,Q.jsx)(`p`,{id:`${a}-merge-help`,className:`text-xs break-words text-muted-foreground`,children:`After Done, mark a draft PR ready and merge when current-head CI and GitHub rules allow it.`}),!i||e&&t?(0,Q.jsx)(`p`,{className:`completion-order-note text-xs break-words text-muted-foreground`,children:i?`Merge runs before archive when both are on.`:`When both are on, merge comes before archive. Without a PR, Archive when Done still archives the task.`}):null]})}var UO=[{key:`allowWorkers`,slot:`workers`,label:`Allow Squawk workers`,help:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`},{key:`allowMessaging`,slot:`messaging`,label:`Allow task messaging`,help:`Agents in this task can message other tasks in this project.`}];function WO({allowWorkers:e,allowMessaging:t,onChange:n,disabled:r=!1,embedded:i=!1}){let a=(0,Z.useId)(),o={allowWorkers:e,allowMessaging:t};return(0,Q.jsxs)(`fieldset`,{"data-slot":`task-access-controls`,"data-embedded":i||void 0,className:`grid min-w-0 gap-3`,children:[(0,Q.jsx)(`legend`,{className:i?`sr-only`:`text-sm font-medium [margin-block-end:0.5rem]`,children:`Task access`}),UO.map(e=>(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsxs)(`label`,{htmlFor:`${a}-${e.slot}`,"data-slot":`task-access-${e.slot}`,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,Q.jsx)(`span`,{id:`${a}-${e.slot}-label`,children:e.label}),i?(0,Q.jsx)(`span`,{id:`${a}-${e.slot}-help`,className:`completion-control-help`,children:e.help}):null]}),(0,Q.jsx)(uh,{id:`${a}-${e.slot}`,className:`completion-switch shrink-0`,checked:o[e.key],disabled:r,"aria-labelledby":`${a}-${e.slot}-label`,"aria-describedby":`${a}-${e.slot}-help`,onCheckedChange:t=>n({[e.key]:t})})]}),i?null:(0,Q.jsx)(`p`,{id:`${a}-${e.slot}-help`,className:`text-xs break-words text-muted-foreground`,children:e.help})]},e.key))]})}function GO(){return(0,Q.jsxs)(`header`,{className:`mb-7 max-md:mb-5`,children:[(0,Q.jsx)(`p`,{"data-slot":`page-eyebrow`,className:`mb-2 text-[11px] font-semibold tracking-[0.16em] text-[var(--accent-text)] uppercase`,children:`NEW TASK`}),(0,Q.jsx)(`h1`,{className:`text-[30px] leading-[normal] font-semibold tracking-[-0.9px] max-md:text-[22px] max-md:leading-[29px] max-md:tracking-[-0.6px]`,children:`What should the agent work on?`}),(0,Q.jsx)(`p`,{"data-slot":`page-description`,className:`mt-2 hidden text-[13px] text-muted-foreground md:block`,children:`Describe the outcome. Configure the run. Review everything before it lands.`})]})}function KO({groupRef:e,compact:t,engine:n,accounts:r,draftEffort:i,update:a}){let o=n.runners.length>1||n.runners.some(e=>eO(r.accountChoices,e))?(0,Q.jsx)(qO,{engine:n,accounts:r,update:a},`runner`):null,s=(0,Q.jsx)(JO,{engine:n,draftEffort:i,update:a},`model`),c=(0,Q.jsx)(YO,{engine:n,update:a},`effort`);return(0,Q.jsx)(`div`,{ref:e,"data-slot":`agent-options`,role:`group`,"aria-label":`Agent settings`,className:`new-task-agent-options`,children:(0,Q.jsx)(Js,{children:t?[o,c,s]:[o,s,c]})})}function qO({engine:e,accounts:t,update:n}){return(0,Q.jsx)(Zs,{icon:(0,Q.jsx)(sa,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:e.runners,value:e.displayRunner,accounts:t.accountChoices,account:t.agentProfile,repoAccount:t.repoAccount,onPick:(t,r)=>n({runner:t,agentProfile:r,...t===e.displayRunner?{}:{model:null}}),disabled:!e.providersReady})}function JO({engine:e,draftEffort:t,update:n}){let{catalog:r,displayRunner:i}=e;return(0,Q.jsx)($s,{icon:(0,Q.jsx)(Ea,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:e.models.find(t=>t.id===e.model)?.label??`auto`,value:e.model,disabled:!e.providersReady,readOnly:e.modelsLocked,disabledHint:e.modelsLocked?`Model selection is locked to native coding-agent settings.`:void 0,onPick:e=>{let i=Is(e,r.data);n({model:e,effort:t===null?null:Rs(t,i)})},options:e.models.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Vs(i,e.registered.data,r)})}function YO({engine:e,update:t}){return(0,Q.jsx)($s,{icon:(0,Q.jsx)(la,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:e.effortOptions.find(t=>t.value===e.effort)?.label??`auto`,value:e.effort,disabled:!e.providersReady,readOnly:e.modelsLocked,disabledHint:e.modelsLocked?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:e=>t({effort:e}),options:e.effortOptions.map(e=>({value:e.value,label:e.label,desc:e.desc}))})}function XO({engine:e,draft:t,update:n,repo:r,hasGit:i,runMode:a,webhook:o,completionDisabled:s}){let{displayRunner:c}=e,l=Oi().data;return(0,Q.jsxs)(`details`,{"data-slot":`execution-options`,open:!0,className:`group rounded-xl border border-border bg-card xl:self-start`,children:[(0,Q.jsxs)(`summary`,{className:`flex min-h-[44px] cursor-pointer list-none flex-wrap items-center gap-x-2 gap-y-1 px-3 py-2 text-xs text-muted-foreground pointer-hover:bg-muted/50 active:bg-muted/50 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground [&::-webkit-details-marker]:hidden`,children:[(0,Q.jsx)(na,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),(0,Q.jsx)(`span`,{className:`font-medium text-foreground`,children:`Execution settings`}),(0,Q.jsxs)(`span`,{"data-slot":`execution-summary`,hidden:!0,className:`min-w-0 basis-full truncate pl-5 xl:ml-auto xl:basis-auto xl:pl-0`,children:[Ei(l,c),` · `,e.models.find(t=>t.id===e.model)?.label??`auto`]}),(0,Q.jsx)(ua,{"aria-hidden":`true`,className:`new-task-settings-chevron size-4 shrink-0`})]}),(0,Q.jsxs)(`div`,{className:`new-task-settings-body`,children:[(0,Q.jsx)(`p`,{className:`new-task-settings-description`,children:`Control this run and what happens after Done.`}),(0,Q.jsxs)(`div`,{role:`group`,"aria-label":`Run settings`,className:`new-task-run-settings`,children:[i?(0,Q.jsx)(QO,{on:a.worktree,onChange:e=>n({worktree:e})}):null,(0,Q.jsx)(tk,{repo:r}),(0,Q.jsx)($O,{on:a.autonomous,disabled:t.planFirst,onChange:e=>n({autonomous:e})}),o.targets.length>0?(0,Q.jsx)(ek,{on:o.on,targets:o.targets,onChange:o.onChange}):null]}),(0,Q.jsx)(HO,{embedded:!0,archiveWhenDone:t.archiveWhenDone,autoMergePr:t.autoMergePr,onChange:n,disabled:s}),(0,Q.jsx)(WO,{embedded:!0,allowWorkers:t.allowWorkers,allowMessaging:t.allowMessaging,onChange:n,disabled:s})]})]})}function ZO({showConfigureProviders:e,planFirst:t,planning:n,onModeChange:r}){return(0,Q.jsxs)(Q.Fragment,{children:[e?(0,Q.jsx)(Y,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null,(0,Q.jsx)(rk,{planFirst:t,planning:n,onModeChange:r}),(0,Q.jsx)(`kbd`,{"aria-hidden":`true`,className:`hidden rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground md:inline`,children:oE()})]})}function QO({on:e,disabled:t,disabledReason:n,onChange:r}){return(0,Q.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"aria-label":`Worktree`,"data-slot":`worktree-toggle`,onClick:()=>r(!e),title:t?n:e?`Runs in an isolated worktree — uncheck to run in the repo working tree`:`Runs in the repo working tree — check to isolate in a worktree`,className:`flex items-center justify-between gap-3 px-0 py-3 text-left`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Worktree`}),(0,Q.jsx)(`span`,{className:`block text-[12px] text-muted-foreground`,children:e?`Changes stay in a separate working copy.`:`Changes are made in the current working directory.`})]}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:C(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,Q.jsx)(`span`,{className:C(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function $O({on:e,disabled:t,onChange:n}){return(0,Q.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,"aria-label":`Autonomous`,"data-slot":`autonomous-toggle`,onClick:()=>n(!e),title:t?`Plan-first runs are interactive — autonomous is unavailable`:e?`Autonomous — the agent runs to completion without pausing for you`:`Runs interactively — check to let the agent finish without pausing for you`,className:`flex items-center justify-between gap-3 px-0 py-3 text-left disabled:opacity-50`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Autonomous`}),(0,Q.jsx)(`span`,{className:`block text-[12px] text-muted-foreground`,children:`Let the agent proceed without prompts`})]}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:C(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,Q.jsx)(`span`,{className:C(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function ek({on:e,targets:t,onChange:n}){return(0,Q.jsxs)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,"aria-label":`Notify webhook`,"data-slot":`notify-webhook-toggle`,onClick:()=>n(!e),title:`${e?`Status changes go to`:`Check to send this task's status changes to`} ${rO(t)} (${t.map(e=>tO(e.url)).join(`, `)})`,className:`flex min-h-11 items-center justify-between gap-3 px-0 py-3 text-left`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-[13px] font-medium`,children:`Notify webhook`}),(0,Q.jsx)(`span`,{"data-slot":`notify-webhook-subtitle`,className:`block truncate text-[12px] text-muted-foreground`,children:`Send status changes`})]}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:C(`flex h-6 w-10 shrink-0 items-center rounded-full border p-0.5`,e?`border-accent-strong bg-accent-strong`:`border-muted-foreground bg-muted`),children:(0,Q.jsx)(`span`,{className:C(`size-[18px] rounded-full`,e?`ml-auto bg-accent-strong-foreground`:`bg-foreground`)})})]})}function tk({repo:e}){return(0,Q.jsxs)(`div`,{"data-slot":`base-branch-row`,className:`new-task-base-branch flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:`Base branch`}),e?(0,Q.jsx)(nk,{repo:e}):null]})}function nk({repo:e}){let t=I(),n=H({mutationFn:e=>jt({baseBranch:e}),onSuccess:e=>{t.invalidateQueries({queryKey:U.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,Q.jsx)($s,{searchPlaceholder:`Search branches…`,slot:`base-pill`,ariaLabel:`Base branch`,label:(0,Q.jsx)(`span`,{className:`text-[11px]`,children:e.baseBranch??e.info.branch}),value:e.baseBranch??``,onPick:e=>n.mutate(e===``?null:e),options:[{value:``,label:`follow checked-out branch (${e.info.branch})`,desc:`New task worktrees fork from whatever branch is checked out`},...e.branches.map(e=>({value:e,label:e}))]}):null}function rk({planFirst:e,planning:t,onModeChange:n}){return(0,Q.jsxs)(`div`,{"data-slot":`mode-seg`,role:`radiogroup`,"aria-label":`Run mode`,className:`inline-flex items-center gap-0.5 rounded-lg bg-muted p-[3px]`,children:[(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":!e,onClick:()=>n(!1),className:C(`h-6 rounded-md px-2 text-xs transition-colors`,e?`font-medium text-muted-foreground hover:text-foreground`:`bg-card font-semibold text-foreground shadow-xs`),children:[e?null:(0,Q.jsx)(Qi,{"aria-hidden":`true`,className:`size-3.5`}),`Start`]}),(0,Q.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e,"aria-busy":t||void 0,"data-slot":`mode-plan`,onClick:()=>n(!0),className:C(`h-6 rounded-md px-2 text-xs transition-colors`,e?`bg-contrast font-semibold text-contrast-foreground ring-2 ring-ring/55`:`font-medium text-muted-foreground hover:text-foreground`,t&&`animate-pulse`),children:t?`Planning…`:`Plan first`})]})}function ik({plan:e,starting:t,startAvailable:n,startUnavailableReason:r,startUnavailableAction:i,onStepsChange:a,onStart:o,onDiscard:s}){let[c,l]=(0,Z.useState)(null),[u,d]=(0,Z.useState)(null),f=(0,Z.useRef)(null),p=(0,Z.useId)();(0,Z.useEffect)(()=>{f.current?.focus({preventScroll:!0});let e=f.current?.closest(`[data-slot="main"]`);e&&(e.scrollTop=0)},[]);let m=()=>{l(null),d(null)},h=(t,n)=>{t.preventDefault(),c!==null&&c!==n&&a(xO(e.steps,c,n)),m()},g=e.steps.length===0;return(0,Q.jsxs)(`div`,{"data-slot":`plan-page`,children:[(0,Q.jsxs)(`header`,{"data-slot":`plan-page-header`,children:[(0,Q.jsx)(`h1`,{children:`New task / Plan first`}),(0,Q.jsx)(`p`,{children:`Review the proposed chain before launching.`})]}),(0,Q.jsx)(`div`,{"data-slot":`plan-canvas`,children:(0,Q.jsxs)(`section`,{ref:f,tabIndex:-1,"aria-labelledby":p,"data-slot":`plan-review`,className:`flex flex-col outline-none`,onKeyDown:e=>{e.key!==`Escape`||e.defaultPrevented||e.target.closest(`[role="dialog"], [role="alertdialog"]`)||(e.preventDefault(),s())},children:[(0,Q.jsxs)(`header`,{"data-slot":`dialog-header`,className:`flex flex-col gap-1 px-5 pt-4 pb-3.5 text-left`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsx)(`h2`,{id:p,"data-slot":`dialog-title`,className:`text-[11px] font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:`Proposed chain`}),(0,Q.jsx)(`button`,{type:`button`,onClick:s,"aria-label":`Discard the plan`,className:`-mt-1 -mr-1 rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:(0,Q.jsx)(ra,{"aria-hidden":`true`,className:`size-4`})})]}),(0,Q.jsx)(`p`,{"data-slot":`plan-task`,title:e.task,className:`text-[18px] font-medium text-foreground`,children:CO(e.task)}),e.fallback?(0,Q.jsx)(`p`,{"data-slot":`plan-fallback`,className:`text-xs text-soft-foreground italic`,children:`planner unavailable — single-step plan`}):e.rationale===``?null:(0,Q.jsx)(`p`,{"data-slot":`plan-rationale`,className:`text-xs text-muted-foreground`,children:e.rationale})]}),(0,Q.jsx)(`ol`,{"data-slot":`plan-steps`,className:`flex-1 space-y-2 overflow-y-auto px-5 py-4`,children:g?(0,Q.jsx)(`li`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`(no steps left — discard and plan again)`}):e.steps.map((t,n)=>(0,Q.jsxs)(`li`,{"data-slot":`plan-step`,"data-step-id":t.id,draggable:!0,onDragStart:()=>l(n),onDragOver:e=>{e.preventDefault(),d(n)},onDragLeave:()=>d(e=>e===n?null:e),onDrop:e=>h(e,n),onDragEnd:m,className:C(`flex items-center gap-2.5 rounded-lg border border-border bg-card-2 px-3 py-2.5`,c===n&&`opacity-50`,u===n&&c!==null&&c!==n&&`border-ring`),children:[(0,Q.jsx)(Vi,{"aria-hidden":`true`,className:`size-3.5 shrink-0 cursor-grab text-soft-foreground`}),(0,Q.jsx)(`span`,{className:`w-5 shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:String(n+1).padStart(2,`0`)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium`,children:t.name??t.id}),t.skill?(0,Q.jsx)(`span`,{"data-slot":`plan-badge-skill`,title:`skill`,className:`shrink-0 rounded-full bg-accent-strong/15 px-1.5 py-px font-mono text-[11px] font-medium text-accent-text`,children:t.skill}):null,t.command?(0,Q.jsx)(`span`,{"data-slot":`plan-badge-check`,className:`shrink-0 rounded-full bg-muted px-1.5 py-px text-[11px] font-medium text-muted-foreground`,children:`check`}):null]}),(0,Q.jsx)(`p`,{className:`mt-3 whitespace-pre-wrap break-words font-mono text-[11px] text-muted-foreground`,children:SO(t)})]}),(0,Q.jsxs)(`span`,{"data-slot":`plan-step-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(k,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-up`,"aria-label":`Move step ${n+1} up`,disabled:n===0,className:`size-7 text-muted-foreground`,onClick:()=>a(xO(e.steps,n,n-1)),children:`Move up`}),(0,Q.jsx)(k,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-down`,"aria-label":`Move step ${n+1} down`,disabled:n===e.steps.length-1,className:`size-7 text-muted-foreground`,onClick:()=>a(xO(e.steps,n,n+1)),children:`Move down`}),(0,Q.jsx)(k,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-slot":`plan-step-remove`,"aria-label":`Remove step ${n+1}`,className:`size-7 text-muted-foreground hover:text-danger`,onClick:()=>a(bO(e.steps,n)),children:`Remove`})]})]},t.id))}),!n&&r?(0,Q.jsxs)(`p`,{id:`plan-start-guidance`,className:`flex flex-wrap items-center gap-1.5 border-t border-border px-5 pt-3 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:r}),i]}):null,(0,Q.jsxs)(`div`,{"data-slot":`plan-actions`,className:`flex flex-wrap items-center gap-3 px-6 pt-3 pb-6`,children:[(0,Q.jsxs)(k,{type:`button`,"data-slot":`plan-start`,disabled:g||t||!n,title:n?void 0:r,"aria-describedby":!n&&r?`plan-start-guidance`:void 0,onClick:o,children:[(0,Q.jsx)(Ya,{"aria-hidden":`true`,className:`size-3.5`}),t?`Starting…`:`Start`]}),(0,Q.jsx)(ak,{steps:e.steps,disabled:g}),(0,Q.jsx)(k,{type:`button`,variant:`outline`,onClick:s,children:`Discard`})]}),(0,Q.jsx)(`p`,{className:`px-6 pb-6 text-xs text-muted-foreground`,children:`No steps left? Start is disabled. A planner failure shows a single-step fallback.`})]})})]})}function ak({steps:e,disabled:t}){let n=I(),[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),d=async t=>{let r=a.trim();if(!(r===``||l)){u(!0);try{let a=await le({name:r,steps:e,...t?{overwrite:!0}:{}});G(`Saved — ${a.path.split(`/`).pop()??a.path}`),n.invalidateQueries({queryKey:U.workflows}),c(!1),i(!1),o(``)}catch(e){e instanceof et&&e.exists===!0?c(!0):G(e instanceof Error?e.message:String(e),{tone:`danger`})}finally{u(!1)}}};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(k,{type:`button`,variant:`outline`,"data-slot":`plan-save`,disabled:t,onClick:()=>i(!0),children:`Save as chain`}),(0,Q.jsx)(es,{open:r,onOpenChange:e=>i(!!e),children:(0,Q.jsxs)(Qo,{"data-slot":`plan-save-dialog`,className:`sm:max-w-sm`,showCloseButton:!1,children:[(0,Q.jsxs)(Zo,{children:[(0,Q.jsx)($o,{children:`Save as chain`}),(0,Q.jsx)(Yo,{children:`Saves these steps as a reusable workflow — it joins the picker like any other chain.`})]}),(0,Q.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d(!1)},children:[(0,Q.jsx)(`label`,{htmlFor:`plan-chain-name`,className:`mb-2 block text-[11px] text-muted-foreground`,children:`Chain name`}),(0,Q.jsx)(rh,{id:`plan-chain-name`,value:a,onChange:e=>o(e.target.value),"aria-label":`Chain name`,placeholder:`e.g. fix-and-verify-v2`,maxLength:80,autoFocus:!0}),(0,Q.jsxs)(Jo,{className:`mt-4`,children:[(0,Q.jsx)(k,{type:`button`,variant:`outline`,onClick:()=>i(!1),children:`Cancel`}),(0,Q.jsx)(k,{type:`submit`,disabled:a.trim()===``||l,children:l?`Saving…`:`Save chain`})]})]})]})}),(0,Q.jsx)(eS,{open:s,onOpenChange:e=>e?void 0:c(!1),children:(0,Q.jsxs)(rS,{"data-slot":`plan-overwrite-dialog`,children:[(0,Q.jsxs)(iS,{children:[(0,Q.jsxs)(oS,{children:[`Overwrite “`,a.trim(),`”?`]}),(0,Q.jsx)(sS,{children:`A chain with this name already exists. Overwriting replaces its steps with this plan.`})]}),(0,Q.jsxs)(aS,{children:[(0,Q.jsx)(lS,{children:`Cancel`}),(0,Q.jsx)(cS,{onClick:()=>void d(!0),children:`Overwrite chain`})]})]})})]})}var ok={start:{note:`Start immediately with the selected configuration.`,pendingLabel:`Starting task…`,failureHint:void 0,clearOnSuccess:!0,sendAriaLabel:`Start task`},plan:{note:`Review the plan before starting the task.`,pendingLabel:`Planning task…`,failureHint:`Could not create the plan. Your draft is kept. Please retry.`,clearOnSuccess:!1,sendAriaLabel:`Plan task`}};function sk(){let[e]=o(),t=(0,Z.useRef)(null),n=(0,Z.useRef)(null),r=(0,Z.useRef)(null),{projectId:i}=s(),a=Mt().projectId,c=Oi().data,[l]=(0,Z.useState)(()=>e.toString()),[u]=(0,Z.useState)(()=>B_(l,c)),d=B_(l,c).runner,f=lr(),p=mn(),m=ur(),h=rr(),{draft:g,update:_,clearStarted:v,submissionPending:y,mounted:b}=DO(a,u,d),x=AO(g,m),S=jO(x.displayRunner,g.agentProfile),C=OO(g.source,p,x.displayRunner,S.agentProfile),{source:w,sourcesReady:T,skillList:E}=C,D=PO(i),O=kO({uiState:p,source:w,sourcesReady:T,draftText:g.text,submissionPending:y,update:_});MO(x.providersReady);let k=f.data===void 0||f.data.info!==null,A=NO({hasGit:k,draft:g,selectedSkill:C.selectedSkill,workspaceConfig:h,source:w}),{plan:j,setPlan:M,planning:ee,starting:te,submit:ne,startPlanned:re}=VO({draft:g,draftProjectId:a,engine:x,agentProfile:S.agentProfile,accountsSettled:S.accountsSettled,sourcesReady:T,source:w,runMode:A,notifyOn:D.notifyOn,uiState:p,mounted:b,clearStarted:v});IO({deepLink:u,search:e,sourcesReady:T&&C.skillsSettled&&!x.providers.isPending&&S.accountsSettled,listUnchecked:C.listUnchecked,skillList:E,update:_});let ie=FO(t),{providers:N,providersReady:P}=x,F=g.planFirst?ok.plan:ok.start,ae=zO(N);return(0,Q.jsxs)(`div`,{"data-route":`new`,"data-plan-review":j===null?void 0:`true`,className:`relative isolate flex min-h-full flex-col overflow-x-clip pb-16`,children:[(0,Q.jsxs)(`div`,{"data-slot":`new-task-layout`,ref:r,style:j===null?void 0:{display:`none`},className:`relative z-[1] mx-auto w-full max-w-none px-11 pt-12 max-md:px-[18px] max-md:pt-[22px]`,children:[(0,Q.jsx)(GO,{}),(0,Q.jsx)(KD,{ref:n,onSubmit:ne,retainDraftUntilSuccess:!0,idleFeedback:(0,Q.jsxs)(`div`,{"data-slot":`new-task-mode-note`,className:`flex items-center justify-between gap-3 text-[11px] text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:F.note}),(0,Q.jsx)(`kbd`,{className:`hidden font-sans md:inline`,children:oE()})]}),pendingLabel:F.pendingLabel,failureHint:F.failureHint,clearOnSuccess:F.clearOnSuccess,onPendingChange:e=>{y.current=e},value:g.text,onValueChange:e=>_({text:e}),autoFocus:!0,placeholder:`Describe a task for the agent — / for skills…`,ariaLabel:`Describe a task for the agent`,sendAriaLabel:F.sendAriaLabel,disabled:!P||te,disabledReason:ae,autocompleteSkills:!0,skillRunner:x.displayRunner,skillAccount:S.agentProfile,footerStart:(0,Q.jsx)(ck,{projects:D.projectList,urlProjectId:i,templates:O,onInsertTemplate:e=>n.current?.insertAtCaret(e),sources:C,onPickSource:e=>_({source:e})}),agentOptions:(0,Q.jsx)(KO,{groupRef:t,compact:ie,engine:x,accounts:S,draftEffort:g.effort,update:_}),executionOptions:(0,Q.jsx)(XO,{engine:x,draft:g,update:_,repo:f.data,hasGit:k,runMode:A,webhook:{targets:D.webhookTargets,on:D.notifyOn,onChange:D.setNotifyChoice},completionDisabled:te||ee}),footerEnd:(0,Q.jsx)(ZO,{showConfigureProviders:!P&&!N.isPending,planFirst:g.planFirst,planning:ee,onModeChange:e=>_({planFirst:e})})}),(0,Q.jsx)(`p`,{"data-slot":`run-mode-note`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:sO({worktree:A.worktree,hasGit:k})})]}),j===null?null:(0,Q.jsx)(ik,{plan:j,starting:te,startAvailable:P,startUnavailableReason:ae,startUnavailableAction:N.isPending?void 0:(0,Q.jsx)(Y,{to:`/settings/agents#providers`,children:`Configure providers`}),onStepsChange:e=>M(t=>t&&{...t,steps:e}),onStart:()=>void re(),onDiscard:()=>{M(null),requestAnimationFrame(()=>r.current?.querySelector(`textarea`)?.focus())}})]})}function ck({projects:e,urlProjectId:t,templates:n,onInsertTemplate:r,sources:i,onPickSource:a}){let o=gs();return(0,Q.jsxs)(Q.Fragment,{children:[e.length>1&&t!==void 0?(0,Q.jsx)(uk,{projects:e,projectId:t,onPick:e=>o(`/p/${encodeURIComponent(e)}/new`,{replace:!0})}):null,(0,Q.jsx)(fs,{label:`Template`,templates:n,onInsert:r}),(0,Q.jsx)(vk,{source:i.source,unchecked:i.unchecked,ready:i.sourcesReady,skills:i.skillList,skillUsage:i.skillUsage,workflows:i.workflowList,onPick:a})]})}function lk(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 uk({projects:e,projectId:t,onPick:n}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(``),{order:s}=Iv(),c=e.find(e=>e.id===t),l=lk(Nv(e,s),a);return(0,Q.jsxs)(fi,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,Q.jsx)(li,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`project-pill`,"aria-label":`Project`,title:`Which project this task runs in — its skills, workflows, settings and draft`,className:C(Ls,`border-foreground/60 font-semibold text-foreground`),children:[(0,Q.jsx)(Fi,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),(0,Q.jsx)(`span`,{className:`max-w-40 truncate`,children:c?.name??t}),Us]})}),(0,Q.jsx)(Qr,{align:`start`,sideOffset:8,className:`w-[300px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(Gs,{shouldFilter:!1,children:[(0,Q.jsx)(js,{placeholder:`search projects…`,value:a,onValueChange:o}),(0,Q.jsxs)(Os,{"data-slot":`project-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,Q.jsx)(Ws,{children:`Nothing matches.`}):null,l.map(e=>(0,Q.jsxs)(Ns,{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,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.name}),e.status===`missing`?(0,Q.jsx)(`span`,{className:`shrink-0 text-[11px] text-soft-foreground`,children:`folder not found`}):e.branch===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground`,children:e.branch}),e.id===t?(0,Q.jsx)(Qi,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.id))]}),(0,Q.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 dk(e,t,n){return!e&&(t.ranked?t.ranked.length===0:t.mostUsed.length===0&&t.project.length===0&&t.global.length===0)&&n.length===0}function fk(e,t){return bc(`no skill`,`none plain ${Xs} ${e?.description??``}`,t)>0}function pk({source:e,ready:t,offersWorkflows:n,onPick:r,skillLabel:i}){let a=e===null||e.source===`skill`?xa:Ca;return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`source-pill`,"data-source-kind":e?.source??`none`,"aria-label":`Choose a skill or workflow`,title:e===null?`No skill — the task runs as one plain agent step. Pick a skill or workflow to change that.`:`Runs the ${e.source} "${e.ref}" — pick it again, or press ✕, to run without it`,disabled:!t,onKeyDown:t=>{e===null||t.metaKey||t.ctrlKey||t.altKey||t.key!==`Backspace`&&t.key!==`Delete`||(t.preventDefault(),r(null))},className:C(Ls,`font-mono text-[11px]`,e===null?`text-muted-foreground`:`rounded-r-none border-r-0 border-foreground/60 pr-1.5 font-semibold text-foreground`),children:[(0,Q.jsx)(a,{"aria-hidden":`true`,className:C(`size-3 shrink-0`,e===null?`text-muted-foreground`:`text-accent-icon`)}),(0,Q.jsx)(`span`,{className:`max-w-44 truncate`,children:t?i??e?.ref??(n?`Skill or workflow`:`Skill`):`…`}),Us]})}function mk({source:e,quickTask:t,onPick:n}){return(0,Q.jsx)(As,{children:(0,Q.jsxs)(Ns,{value:`none no-skill`,keywords:[`none`,`plain`,...Ec(Xs)],"data-slot":`source-option`,"data-source-kind":`none`,onSelect:()=>n(null),children:[(0,Q.jsx)(aa,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Q.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:`No skill`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t?.description??`One agent run on your task — no ceremony.`}),e===null?(0,Q.jsx)(Qi,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]})})}function hk({ranked:e,mostUsed:t,project:n,skillItem:r}){return(0,Q.jsx)(Q.Fragment,{children:e?e.length>0?(0,Q.jsx)(As,{children:e.map(e=>r(e,Cc(e)))}):null:(0,Q.jsxs)(Q.Fragment,{children:[t.length>0?(0,Q.jsx)(As,{heading:`Most used`,children:t.map(e=>r(e,Cc(e)))}):null,n.length>0?(0,Q.jsx)(As,{heading:`Project skills`,children:n.map(e=>r(e,!0))}):null]})})}function gk({source:e,matchedWorkflows:t,toggle:n}){return t.length>0?(0,Q.jsx)(As,{heading:`Workflows`,children:t.map(t=>{let r=e?.source===`workflow`&&e.ref===t.name;return(0,Q.jsxs)(Ns,{value:`workflow ${t.name}`,keywords:Ec(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`workflow`,"data-source-ref":t.name,onSelect:()=>n({source:`workflow`,ref:t.name}),children:[(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:t.name}),t.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:t.description}):null,r?(0,Q.jsx)(Qi,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},t.name)})}):null}function _k({global:e,skillItem:t}){return e.length>0?(0,Q.jsx)(As,{heading:`Global`,children:e.map(e=>t(e,!1))}):null}function vk({source:e,unchecked:t,ready:n,skills:r,skillUsage:i,workflows:a,onPick:o}){let[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(null),p=(0,Z.useRef)(null),{mostUsed:m,project:h,global:g,ranked:_}=kc(r,l,i),v=a.find(e=>e.name===Xs),y=xc(a,l).filter(e=>e.name!==Xs),b=a.some(e=>e.name!==Xs),x=fk(v,l),S=dk(x,{ranked:_,mostUsed:m,project:h,global:g},y),w=e=>{o(e),c(!1)},T=t=>w(e?.source===t.source&&e.ref===t.ref&&(e.source!==`skill`||t.source!==`skill`||e.path===t.path)?null:t),E=(t,n)=>{let r=e?.source===`skill`&&e.ref===t.id&&e.path===t.path;return(0,Q.jsxs)(Ns,{value:Sc(t),keywords:Ec(t.name,t.description),"data-slot":`source-option`,"data-source-kind":`skill`,"data-source-ref":t.id,onSelect:()=>T({source:`skill`,ref:t.id,...t.path===void 0?{}:{path:t.path}}),children:[(0,Q.jsx)(iT,{skill:t,emphasized:n}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`source-skill-view`,"aria-label":`View skill ${t.name}`,title:`View skill`,onClick:e=>{e.preventDefault(),e.stopPropagation(),f(t)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Q.jsx)(Ua,{"aria-hidden":`true`,className:`size-3.5`})}),r?(0,Q.jsx)(Qi,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},Sc(t))},D=pk({source:e,ready:n,offersWorkflows:b,onPick:o,skillLabel:e?.source===`skill`?r.find(t=>t.id===e.ref&&(e.path===void 0||e.path===t.path))?.name:void 0});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(QD,{skill:d,onClose:()=>f(null)}),(0,Q.jsxs)(fi,{open:s,onOpenChange:e=>{c(e),e||u(``)},children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,Q.jsx)(li,{asChild:!0,children:D}),e?.source===`skill`&&t?(0,Q.jsx)(`span`,{role:`status`,children:`Unchecked`}):null,e!==null&&n?(0,Q.jsx)(`button`,{type:`button`,"data-slot":`source-pill-clear`,"aria-label":`Clear the ${e.source} ${e.ref}`,title:`Run without it`,onClick:()=>o(null),className:C(Ls,`rounded-l-none border-foreground/60 pl-1.5 pr-2 text-soft-foreground hover:text-foreground`),children:(0,Q.jsx)(ra,{"aria-hidden":`true`,className:`size-3`})}):null]}),(0,Q.jsx)(Qr,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(Gs,{shouldFilter:!1,children:[(0,Q.jsx)(js,{placeholder:`search skills & workflows…`,value:l,onValueChange:u,onInput:()=>p.current?.scrollTo(0,0)}),(0,Q.jsxs)(Os,{ref:p,"data-slot":`source-menu`,className:`max-h-[min(18rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.trim()&&!r.some(e=>e.id===l.trim())?(0,Q.jsx)(As,{children:(0,Q.jsxs)(Ns,{value:`typed-skill`,onSelect:()=>w({source:`skill`,ref:l.trim(),typed:!0}),children:[`Use skill id “`,l.trim(),`” (unchecked)`]})}):null,S?(0,Q.jsx)(Ws,{children:`Nothing matches.`}):null,x?(0,Q.jsx)(mk,{source:e,quickTask:v,onPick:w}):null,(0,Q.jsx)(hk,{ranked:_,mostUsed:m,project:h,skillItem:E}),(0,Q.jsx)(gk,{source:e,matchedWorkflows:y,toggle:T}),(0,Q.jsx)(_k,{global:g,skillItem:E})]})]})})]})]})}function yk(){return(0,Q.jsx)(`div`,{"data-route":`not-found`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(X,{icon:(0,Q.jsx)(lu,{}),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,Q.jsx)(k,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(Y,{to:`/`,children:`Back to tasks`})})})})}function bk(){return(0,Q.jsx)(`div`,{className:`px-[18px] pt-2 md:hidden`,children:(0,Q.jsxs)(Y,{to:`/git`,"data-slot":`git-back`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,Q.jsx)(_a,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to Git`]})})}function xk(){let{pathname:e,search:t}=a();return(0,Q.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[bs(e)!==`/git`||new URLSearchParams(t).get(`view`)===`repo`?(0,Q.jsx)(bk,{}):null,(0,Q.jsx)(X,{icon:(0,Q.jsx)(Wa,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading repository…`,subtitle:`Fetching the repo's git state.`})]})}function Sk(){return(0,Q.jsxs)(`div`,{"data-route":`skills`,"aria-busy":`true`,className:`mx-auto min-h-full w-full max-w-[1100px] px-[18px] py-6 md:p-9`,children:[(0,Q.jsx)(`h1`,{className:`text-[25px] font-semibold tracking-tight md:text-[30px]`,children:`Skills`}),(0,Q.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`The skills each agent loads in this project, as its runner reports them.`}),(0,Q.jsx)(`p`,{"data-slot":`skills-loading`,role:`status`,className:`mt-6 text-xs text-muted-foreground`,children:`Loading skills…`}),(0,Q.jsxs)(`div`,{"aria-hidden":`true`,className:`mt-4 flex flex-col gap-[22px] motion-safe:animate-pulse`,children:[(0,Q.jsx)(`div`,{className:`h-11 rounded-lg border border-border bg-card`}),(0,Q.jsx)(`div`,{className:`h-80 rounded-xl border border-border bg-card`})]})]})}function Ck({projectId:e,registry:t}){let n=t.projects.length?t.projects:[{id:t.bootProject,name:t.bootProject}];return(0,Q.jsx)(`div`,{"data-route":`unknown-project`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(X,{icon:(0,Q.jsx)(xu,{}),tone:`neutral`,title:`“${e}” isn’t registered here`,subtitle:`This Squawk doesn’t serve a project by that id. The link may come from another machine’s workspace — these are the projects registered on this one:`,children:(0,Q.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,Q.jsx)(`li`,{children:(0,Q.jsxs)(E,{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,Q.jsxs)(`span`,{className:`font-mono text-[11px] font-normal text-soft-foreground`,children:[`/p/`,e.id]})]})},e.id))})})})}function wk(){return(0,Q.jsxs)(`div`,{"data-route":`workflows`,"aria-busy":`true`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,Q.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`Workflows`}),(0,Q.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`Portable skill chains. Steps run from top to bottom.`}),(0,Q.jsx)(`p`,{"data-slot":`workflows-loading`,role:`status`,className:`mt-6 text-xs text-muted-foreground`,children:`Loading workflows…`}),(0,Q.jsxs)(`div`,{"aria-hidden":`true`,className:`mt-4 flex flex-col gap-[22px] motion-safe:animate-pulse`,children:[(0,Q.jsx)(`div`,{className:`h-11 rounded-lg border border-border bg-card`}),(0,Q.jsx)(`div`,{className:`h-80 rounded-xl border border-border bg-card`})]})]})}function Tk({tab:e}){return(0,Q.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(X,{icon:(0,Q.jsx)(Wa,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:e===`changes`?`Loading changes…`:`Loading files…`,subtitle:`Fetching the run record.`})})}function Ek({tab:e,error:t}){let n=t instanceof et&&t.status===404;return(0,Q.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(X,{icon:n?(0,Q.jsx)(no,{}):(0,Q.jsx)(ma,{size:16}),tone:n?`neutral`:`danger`,title:n?`Task not found`:`Could not load this task`,subtitle:n?`No run has this id. It may have been deleted, or the link is from another machine.`:t.message,actions:(0,Q.jsx)(k,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(Y,{to:`/`,children:`Back to tasks`})})})})}var Dk={issue:`issue`,pr:`pull request`};function Ok({kind:e,number:t,heading:n=`h1`}){let r=(0,Q.jsx)(`div`,{"data-slot":`task-github-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,Q.jsx)(X,{icon:(0,Q.jsx)(Wa,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:n,title:`Loading ${Dk[e]}${t===void 0?``:` #${t}`}…`,subtitle:t===void 0?`Fetching the run record.`:`Asking GitHub.`})});return n===`h2`?r:(0,Q.jsx)(`div`,{"data-route":`task-github-item`,className:`flex min-h-full flex-col`,children:r})}function kk(){return(0,Q.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(X,{icon:(0,Q.jsx)(Wa,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}async function Ak(e,t,n,r,i){try{return await Ml(e,{queryKey:[t,`runs`,`artifact-metadata`,n,r],queryFn:({signal:e})=>Ve(n,r,{signal:e})},i),!0}catch(e){if(e instanceof et&&e.status===404)return!1;throw e}}async function jk(e,t,n,r,i,a){if(await Ak(e,t,n,r,i))return n;i.throwIfAborted();let o=await Ml(e,{queryKey:[t,`runs`,`relationships`,n],queryFn:({signal:e})=>ce(n,{signal:e})},i),s=new Set(o.workers.map(e=>e.workerId));a&&s.add(a),s.delete(n);for(let n of s){if(i.aborted)throw i.reason;if(await Ak(e,t,n,r,i))return n}throw new et(404,`Report missing or deleted`)}function Mk(e,t,n){let r=I(),i=c();return wr({queryKey:[i,`runs`,`report-source`,e,t,n],queryFn:({signal:a})=>jk(r,i,e,t,a,n),enabled:!!(e&&t),retry:!1})}function Nk(){let[e]=o(),t=a(),n=j(),r=d(),i=Z.useRef(Math.random()),s=Z.useRef({renderedKey:``,next:e,seq:0,latestSeq:0});return Z.useLayoutEffect(()=>{if(s.current.renderedKey===t.key)return;let n=t.state,a=n?.__writerSession===i.current?n.__writerSeq:void 0;r===`REPLACE`&&a!==void 0&&a<=s.current.latestSeq?(s.current.renderedKey=t.key,a===s.current.latestSeq&&(s.current.next=e)):s.current={renderedKey:t.key,next:e,seq:s.current.seq,latestSeq:0}},[e,t,r]),[e,Z.useCallback(e=>{let t=e(new URLSearchParams(s.current.next));if(t.toString()===s.current.next.toString())return;let r=s.current.seq+1;s.current={...s.current,next:t,seq:r,latestSeq:r},n({search:`?${t}`},{replace:!0,state:{__writerSession:i.current,__writerSeq:r}})},[n])]}var Pk=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Fk(e){let t=e.get(`report`);return!t||!Pk.test(t)||e.getAll(`report`).length!==1||e.getAll(`card`).length>1?null:{artifactId:t,card:e.get(`card`)||null}}var Ik=(0,Z.createContext)(null);function Lk(e){let t=a(),n=j(),[r,i]=Nk(),o=Fk(r),[s,c]=(0,Z.useState)(()=>({runId:e,entries:new Map}));s.runId!==e&&c({runId:e,entries:new Map});let l=(0,Z.useCallback)((t,n)=>(c(r=>{if(r.runId===e&&r.entries.get(t)===n)return r;let i=new Map(r.runId===e?r.entries:[]);return i.set(t,n),{runId:e,entries:i}}),()=>void 0),[e]),u=(0,Z.useRef)({runId:e,callbacks:new Map});u.current.runId!==e&&(u.current={runId:e,callbacks:new Map});let d=(0,Z.useCallback)((e,t)=>(u.current.callbacks.set(e,t),()=>{u.current.callbacks.get(e)===t&&u.current.callbacks.delete(e)}),[]),f=(0,Z.useMemo)(()=>({register:l,registerOpener:d}),[l,d]),p=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{r.has(`report`)&&!o&&i(e=>(e.delete(`report`),e.delete(`card`),e))},[r,o,i]),(0,Z.useEffect)(()=>{let n=p.current;!o&&n&&n.runId===e&&n.card&&u.current.callbacks.get(n.card)?.(n.artifactId,n.scrollTop),p.current=o?{...o,runId:e,scrollTop:t.state?.reportScrollTop}:null},[e,o,t.state]),{selection:o,sourceRunId:s.runId===e&&o?s.entries.get(o.artifactId)??(o.card?void 0:e):void 0,registry:f,close:()=>{let e=t.state,r=window.navigation;if(e?.reportReturnKey&&r){r.traverseTo(e.reportReturnKey);return}if(e?.reportReturnTo){n(e.reportReturnTo,{replace:!0});return}i(e=>(e.delete(`report`),e.delete(`card`),e))}}}var Rk=class extends Z.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){console.error(`Squawk cockpit: the preview pane crashed`,e,t.componentStack)}render(){return this.state.failed?(0,Q.jsxs)(`div`,{"data-slot":`preview-pane-error`,role:`alert`,className:`flex h-full flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,children:`The preview hit an error`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`The task is unaffected. Close the preview and open it again.`}),(0,Q.jsx)(k,{variant:`outline`,onClick:this.props.onClose,children:`Close preview`})]}):this.props.children}},zk=`cez-preview-tasks`,Bk=`cez.preview.pane-width`,Vk=e=>Math.min(75,Math.max(30,Math.round(e)));function Hk(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Uk(e){if(!Hk(e))return;let{port:t,agent:n,url:r}=e;if(typeof t==`number`&&Number.isInteger(t)&&t>=1&&t<=65535)return{port:t};if(n===!0)return{agent:!0};if(typeof r==`string`&&/^https?:\/\//i.test(r))return{url:r}}function Wk(e){if(!Hk(e))return;let t=Uk(e.target),n=typeof e.percent==`number`&&Number.isFinite(e.percent)?e.percent:void 0;return{open:e.open===!0,...t?{target:t}:{},...n===void 0?{}:{percent:n},at:typeof e.at==`number`?e.at:0}}function Gk(){try{let e=localStorage.getItem(zk),t=e===null?null:JSON.parse(e);return Hk(t)?t:{}}catch{return{}}}function Kk(e){let t=Wk(Gk()[e]);if(!t)return;let{at:n,...r}=t;return r}function qk(e,t,n=Date.now()){let r=Gk(),i={open:!1,...Wk(r[e]),...t,at:n};for(let e of Object.keys(i))i[e]===void 0&&delete i[e];r[e]=i;let a=Object.keys(r);if(a.length>100){let e=e=>Wk(r[e])?.at??0;for(let t of a.sort((t,n)=>e(t)-e(n)).slice(0,a.length-100))delete r[t]}try{localStorage.setItem(zk,JSON.stringify(r))}catch{}}function Jk(){try{let e=Number(localStorage.getItem(Bk));return e>0?e:void 0}catch{return}}function Yk(e){let t=(e===void 0?void 0:Kk(e)?.percent)??Jk();return t===void 0?58:Vk(t)}function Xk(e,t){try{localStorage.setItem(Bk,String(t))}catch{}e!==void 0&&qk(e,{percent:t})}var Zk=`(min-width: 1180px)`,Qk=`(max-width: 767px)`;function $k(e,t){let[n,r]=(0,Z.useState)(()=>window.matchMedia?.(e).matches??t);return(0,Z.useEffect)(()=>{let t=window.matchMedia?.(e);if(!t)return;let n=()=>r(t.matches);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),n}var eA=(0,Z.lazy)(()=>W(()=>import(`./preview-pane-connected-DHH1E04c.js`).then(e=>({default:e.ConnectedPreviewPane})),__vite__mapDeps([6,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]))),tA=2;function nA(e){let[t,n]=(0,Z.useState)(void 0);return(0,Z.useEffect)(()=>{let t=e.current?.closest(`[data-slot="main"]`);if(!t)return;let r=()=>n(t.clientHeight||void 0);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function rA({run:e,state:t,children:n,report:r}){let i=$k(Zk,!0),a=$k(Qk,!1),o=(0,Z.useRef)(null),s=nA(o),{percent:c,setPercent:l}=t,u=!!r||t.open&&e!==void 0,d=u&&!i,f=!r&&t.session,p=d&&!f,m=d&&f,h=e=>{let t=o.current?.getBoundingClientRect();!t||t.width===0||l(Vk((t.right-e)/t.width*100))},g=e=>{e.currentTarget.setPointerCapture?.(e.pointerId)},_=e=>{e.currentTarget.hasPointerCapture?.(e.pointerId)&&h(e.clientX)},v=e=>{if(e.key===`ArrowLeft`)l(Vk(c+tA));else if(e.key===`ArrowRight`)l(Vk(c-tA));else return;e.preventDefault()},y={"--preview-pane":`${c}%`,...s===void 0?{}:{"--preview-h":`${s}px`}};return(0,Q.jsxs)(`div`,{ref:o,"data-slot":`task-split`,"data-pane":u?`open`:`closed`,"data-takeover":p?``:void 0,className:`preview-split flex min-h-full`,style:y,children:[(0,Q.jsx)(`div`,{"data-slot":`task-main`,hidden:p&&a,"data-collapsed":p&&!a?``:void 0,className:`min-w-0 flex-1`,children:n}),u?(0,Q.jsxs)(Q.Fragment,{children:[i?(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize preview`,"aria-valuemin":30,"aria-valuemax":75,"aria-valuenow":c,tabIndex:0,"data-slot":`preview-divider`,className:`preview-divider`,onPointerDown:g,onPointerMove:_,onKeyDown:v}):null,(0,Q.jsxs)(`aside`,{"data-slot":`preview-pane`,"data-phone":a?``:void 0,hidden:m,className:`preview-pane`,children:[r,(0,Q.jsx)(`div`,{hidden:!!r,className:`h-full`,children:t.open&&e?(0,Q.jsx)(Rk,{onClose:t.closePane,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`p`,{role:`status`,className:`p-6 text-sm text-muted-foreground`,children:`Opening the preview…`}),children:(0,Q.jsx)(eA,{run:e,servers:e.previewServers??[],request:t.request,onSession:p?t.showSession:void 0,onTarget:t.setTarget,onLive:t.setLive,onClose:t.closePane},e.id)})}):null})]})]}):null]})}function iA(e){if(!e.worktreePath||e.worktreeReclaimedAt)return!0;let t=e.delegation?.role===`worker`?e.delegation.destroy:void 0;return t!==void 0&&!t.remaining.includes(`worktree`)}function aA(e){let{state:t,server:n}=e,r=Ga(e.stateAt);switch(t){case`registered`:return n.answeredAtRegistration?{tone:`neutral`,ring:!1,pulse:!1,text:`was running when registered`}:{tone:`neutral`,ring:!0,pulse:!1,text:`registered · not started`};case`adopted`:return{tone:`neutral`,ring:!1,pulse:!1,text:`was running when registered`};case`starting`:return{tone:`pending`,ring:!1,pulse:!0,text:`starting`};case`up`:return{tone:`success`,ring:!1,pulse:!1,text:r?`up · ${r}`:`up`};case`stalled`:return{tone:`pending`,ring:!1,pulse:!1,text:`stalled · port silent 2 min`};case`exited`:return{tone:`danger`,ring:!1,pulse:!1,text:e.exitCode===void 0?`exited`:`exited · code ${e.exitCode}`};case`stopped`:return{tone:`neutral`,ring:!0,pulse:!1,text:e.reason===`idle`?`stopped after 15 min idle`:`stopped`};case`unavailable`:return{tone:`neutral`,ring:!0,pulse:!1,text:`unavailable`}}}function oA(e){return{kind:`preview-server`,id:`preview-server:${e.port}`,server:e,state:`registered`,stateAt:e.registeredAt}}function sA(e,t){return t?.get(e.port)??oA(e)}function cA(e){return e.state===`registered`?e.server.answeredAtRegistration:e.state===`up`||e.state===`starting`||e.state===`adopted`}function lA(e){return e.split(` -- `)[0].trim()}var uA=(0,Z.createContext)(null);function dA(){return(0,Z.useContext)(uA)}var fA=e=>e&&`port`in e?e.port:void 0;function pA(){return typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 1180px)`).matches}function mA(e){let t=e===void 0?void 0:Kk(e),n=t?.open===!0,r=n?t.target:void 0;return{open:n,target:r,request:n?{...r,restored:!0}:void 0,session:n&&!pA(),percent:Yk(e)}}function hA(e,t=!1){let[n]=(0,Z.useState)(()=>mA(e)),[r,i]=(0,Z.useState)(n.open),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(n.target),[l,u]=(0,Z.useState)(n.session),[d,f]=(0,Z.useState)(n.request),[p,m]=(0,Z.useState)(n.percent),[h,g]=(0,Z.useState)(e),_=(0,Z.useRef)(r);if(_.current=r,h!==e){let t=mA(e);g(e),i(t.open),o(!1),c(t.target),u(t.session),f(t.request),m(t.percent)}t&&r&&d?.restored&&(i(!1),c(void 0),f(void 0),u(!1));let v=(0,Z.useCallback)(t=>{e!==void 0&&qk(e,t)},[e]),y=(0,Z.useCallback)(e=>{f({...e});let t=e.port===void 0?e.agent?{agent:!0}:void 0:{port:e.port};u(!1),i(!0),t?(c(t),v({open:!0,target:t})):_.current?v({open:!0}):(c(void 0),v({open:!0,target:void 0}))},[v]),b=(0,Z.useCallback)(()=>{i(!1),o(!1),u(!1),c(void 0),v({open:!1})},[v]),x=(0,Z.useCallback)(e=>{c(e),v({target:e})},[v]),S=(0,Z.useCallback)(t=>{m(t),Xk(e,t)},[e]),C=(0,Z.useCallback)(()=>u(!0),[]),w=fA(s);return(0,Z.useMemo)(()=>({open:r,live:a,port:w,target:s,percent:p,request:d,session:l,openPane:y,closePane:b,showSession:C,setLive:o,setTarget:x,setPercent:S}),[r,a,w,s,p,d,l,y,b,C,x,S])}function gA(e,t={}){let[n,r]=(0,Z.useState)([]),{cursor:i,afterSeq:a=0,maxEvents:o,compactAt:s,onCompact:l,onReset:u}=t;return(0,Z.useEffect)(()=>{if(r([]),!e)return;let t=a,n=!1,d=!1,f=c(),p=[],m,h,g=()=>{if(m!==void 0&&globalThis.cancelAnimationFrame?.(m),clearTimeout(h),m=void 0,h=void 0,n||p.length===0)return;let e=p;p=[],r(t=>{let r=[...t,...e];return!d&&s!==void 0&&r.length>=s&&(d=!0,queueMicrotask(()=>{n||l?.()})),o===void 0||r.length<=o?r:r.slice(-o)})},_=()=>{h===void 0&&(h=setTimeout(g,50),typeof globalThis.requestAnimationFrame==`function`&&(m=globalThis.requestAnimationFrame(g)))},v=Ae({kind:`run`,projectId:f,runId:e,afterSeq:a,...i?{cursor:i}:{}},{frame:e=>{!(`type`in e)||e.type!==`event`||e.event.seq<=t||(t=e.event.seq,p.push(e.event),_())},reset:async(e,n)=>{g();let r=await u?.(e,n);return r&&(t=Math.max(t,r.afterSeq)),r}});return()=>{n=!0,m!==void 0&&globalThis.cancelAnimationFrame?.(m),clearTimeout(h),v()}},[e,i,a,o,s,l,u]),n}var _A=5,vA=200,yA=5e3;function bA(...e){let t=new Map;for(let n of e)for(let e of n)t.set(e.seq,e);return[...t.values()].sort((e,t)=>e.seq-t.seq)}function xA(e,t,n){e.setQueryData(t,e=>{if(!e)return{pages:[n],pageParams:[void 0]};let t=[...e.pages],r=[...e.pageParams],i=-1;for(let e=0;e<t.length;e+=1)(i===-1||t[e].asOfSeq>t[i].asOfSeq)&&(i=e);if(i>=0&&t[i].asOfSeq>n.asOfSeq)return e;for(i>=0&&t[i].newerCursor===void 0?(t[i]=n,r[i]=void 0):(t.push(n),r.push(void 0));t.length>_A;)t.shift(),r.shift();return{pages:t,pageParams:r}})}function SA(e,t){return e!==void 0&&(t===void 0||e.asOfSeq>=t.asOfSeq)}function CA(e,t,n,r){let i=(0,Z.useRef)(void 0),a=r&&t.data!==void 0&&!t.isFetching&&!SA(t.data,n),o=e===void 0||n===void 0?void 0:`${e}:${n.asOfSeq}`;(0,Z.useEffect)(()=>{!a||o===void 0||i.current===o||(i.current=o,t.refetch())},[a,t,o])}function wA(e,t){return e!==void 0&&e.asOfSeq>t.asOfSeq?e:t}function TA(e){let t=c(),n=I(),r=[`run-history`,t,e],i=[`run-history-context`,t,e],a=ln({queryKey:r,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>qt(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:_A,staleTime:1/0,retry:1}),o=wr({queryKey:i,enabled:e!==void 0,queryFn:async({signal:t})=>{let r=await Pe(e,{signal:t});return wA(n.getQueryData(i),r)},retry:1}),s=(0,Z.useCallback)(async r=>{let i=r?{signal:r}:void 0,a=await qt(e,void 0,i),o=await Pe(e,i);return r?.throwIfAborted(),xA(n,[`run-history`,t,e],a),n.setQueryData([`run-history-context`,t,e],e=>wA(e,o)),a},[n,e,t]),l=(0,Z.useCallback)(async(t,n)=>{if(e===void 0)return;let r=await s(n);return{cursor:r.liveCursor,afterSeq:r.asOfSeq}},[s,e]),u=a.isError||o.isError,d=gA(u?e:void 0,{onReset:l}),f=a.data?.pages??[],p=f.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),m=(0,Z.useRef)(!1),h=(0,Z.useCallback)(()=>{e===void 0||m.current||(m.current=!0,s().catch(()=>{}).finally(()=>{m.current=!1}))},[s,e]),g=e=>e!==void 0&&n.getQueryData([`run-history`,t,e])!==void 0,[_,v]=(0,Z.useState)(()=>({runId:e,pending:g(e)})),y=_.pending;_.runId!==e&&(y=g(e),v({runId:e,pending:y})),(0,Z.useEffect)(()=>{if(!y||e===void 0)return;let t=!1,n=new AbortController;return s(n.signal).catch(()=>{}).finally(()=>{t||v({runId:e,pending:!1})}),()=>{t=!0,n.abort()}},[s,y,e]);let b=gA(!u&&p&&!y?e:void 0,{cursor:p?.liveCursor,afterSeq:p?.asOfSeq,maxEvents:yA,compactAt:vA,onCompact:h,onReset:l}),x=(0,Z.useRef)(0);x.current=b.length,(0,Z.useEffect)(()=>()=>{x.current>0&&h()},[h]);let S=(0,Z.useMemo)(()=>bA(...f.map(e=>e.events)),[f]),C=(0,Z.useMemo)(()=>u?d:bA(S,b),[u,d,S,b]);CA(e,o,p,!u);let w=u||SA(o.data,p),T=(0,Z.useMemo)(()=>{if(u)return d;let e=o.data?.contextEvents??[],t=o.data?.asOfSeq??0;return bA(e,C.filter(({seq:e})=>e>t))},[o.data,u,d,C]),E=(0,Z.useCallback)(async()=>{await a.fetchPreviousPage()},[a.fetchPreviousPage]),D=(0,Z.useCallback)(async()=>{u||(await n.resetQueries({queryKey:[`run-history`,t,e],exact:!0}),n.invalidateQueries({queryKey:[`run-history-context`,t,e],exact:!0}))},[u,n,e,t]);return{visibleEvents:C,currentEvents:T,currentComplete:w,isPending:!u&&a.isPending,contextPending:!u&&o.isPending,fallback:u,hasOlder:!u&&!!a.hasPreviousPage,isFetchingOlder:a.isFetchingPreviousPage,olderError:a.isFetchPreviousPageError?a.error instanceof Error?a.error.message:`Could not load earlier items`:void 0,loadOlder:E,jumpToLatest:D,retainedPages:f.length}}function EA(e){for(let t=e.length-1;t>=0;--t){let n=Bt.safeParse(e[t]);if(n.success)return n.data.state===`connected`}return!1}function DA(e){let{currentEvents:t}=TA(e);return(0,Z.useMemo)(()=>EA(t),[t])}var OA=(0,Z.lazy)(()=>W(()=>import(`./report-reader-TX7SV7cO.js`).then(e=>({default:e.ReportReader})),__vite__mapDeps([25,5,7,8,9,10,11,26,27,28,29,30,12,22,31,13,32,33,34,4])));function kA(){let{id:e}=s(),t=Xn(e),n=a(),r=En().data?.capabilities?.preview===!0,i=t.data?iA(t.data):!1,o=hA(e,i),c=Lk(e),l=Mk(e,c.selection?.artifactId,c.sourceRunId),u=c.selection?(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`p`,{role:`status`,children:`Loading report…`}),children:(0,Q.jsx)(OA,{runId:l.data??e??``,selection:{artifactId:c.selection.artifactId},fragment:n.hash,onBack:c.close,variant:`pane`,sourceLookup:l},`${e}:${c.selection.artifactId}`)}):void 0,d=r?(0,Q.jsx)(AA,{id:e,run:t.data,pane:o,removed:i,report:u,children:(0,Q.jsx)(v,{})}):(0,Q.jsx)(rA,{run:t.data,state:{...o,open:!1},report:u,children:(0,Q.jsx)(v,{})});return(0,Q.jsx)(Ik.Provider,{value:c.registry,children:d})}function AA({id:e,run:t,pane:n,removed:r,children:i,report:a}){let o=DA(e),s=(0,Z.useMemo)(()=>({...n,worktreeRemoved:r,agentLive:o}),[n,r,o]);return(0,Q.jsx)(uA.Provider,{value:s,children:(0,Q.jsx)(rA,{run:t,state:n,report:a,children:i})})}function jA({...e}){return(0,Q.jsx)(Cd,{"data-slot":`collapsible`,...e})}function MA({...e}){return(0,Q.jsx)(vd,{"data-slot":`collapsible-trigger`,...e})}function NA({...e}){return(0,Q.jsx)(bd,{"data-slot":`collapsible-content`,...e})}var PA={"needs-you":{label:`Needs you`,hint:`Asks a question, asks for permission, or waits for review`},failed:{label:`Failed`,hint:`Failed, with no scheduled resume`},done:{label:`Done`,hint:`Finished`},cancelled:{label:`Cancelled`,hint:`Was cancelled`},running:{label:`Running`,hint:`Runs an agent turn`},"waiting-workers":{label:`Waiting for agents`,hint:`Waits on its workers or their replies`},"waiting-ci":{label:`Waiting on CI`,hint:`Waits on a pull request's checks`},"waiting-timer":{label:`Waiting`,hint:`Waits on a timer`},"waiting-other":{label:`Any other wait`,hint:`Waits on anything else, including wait types added later`}},FA=(e,t)=>e.length===t.length&&e.every(e=>t.includes(e)),IA={name:``,description:``,url:``,token:``,tasks:!0,triggers:pt,agent:!1};function LA(e){return{name:e.name,description:e.description??``,url:e.url,token:``,tasks:e.tasks,triggers:e.triggers??pt,agent:e.agent}}var RA=e=>N.filter(t=>e.includes(t));function zA(e){let t=e.description.trim();return{name:e.name.trim(),url:e.url.trim(),...t?{description:t}:{},...e.token?{token:e.token}:{},tasks:e.tasks,...FA(e.triggers,pt)?{}:{triggers:RA(e.triggers)},agent:e.agent}}function BA(e,t){let n={},r=e.name.trim(),i=e.description.trim(),a=e.url.trim();return r!==t.name&&(n.name=r),i!==(t.description??``)&&(n.description=i),a!==t.url&&(n.url=a),e.token&&(n.token=e.token),e.tasks!==t.tasks&&(n.tasks=e.tasks),FA(e.triggers,t.triggers??pt)||(n.triggers=RA(e.triggers)),e.agent!==t.agent&&(n.agent=e.agent),n}var VA=`flex flex-col gap-1 text-[13px]`,HA=`text-[11px] text-muted-foreground`;function UA({draft:e,onChange:t,tokenSet:n}){let r=(0,Z.useId)(),i=(0,Z.useId)(),a=(0,Z.useId)(),o=(0,Z.useId)(),s=(0,Z.useId)(),c=(0,Z.useId)(),l=(0,Z.useId)(),u=(0,Z.useId)(),d=(0,Z.useId)(),f=(0,Z.useId)();return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,14rem),1fr))] gap-3`,children:[(0,Q.jsxs)(`div`,{className:VA,children:[(0,Q.jsx)(`label`,{htmlFor:r,className:HA,children:`Name`}),(0,Q.jsx)(rh,{id:r,"data-slot":`webhook-name`,autoComplete:`off`,maxLength:80,placeholder:`e.g. Team bot`,value:e.name,onChange:e=>t({name:e.target.value})})]}),(0,Q.jsxs)(`div`,{className:VA,children:[(0,Q.jsx)(`label`,{htmlFor:o,className:HA,children:`URL`}),(0,Q.jsx)(rh,{id:o,"data-slot":`webhook-url`,type:`url`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,maxLength:ue,placeholder:`https://bot.example/hooks/cez`,value:e.url,onChange:e=>t({url:e.target.value})})]})]}),(0,Q.jsxs)(`div`,{className:VA,children:[(0,Q.jsx)(`label`,{htmlFor:i,className:HA,children:`Description`}),(0,Q.jsx)(ew,{id:i,"data-slot":`webhook-description`,"aria-describedby":a,rows:2,maxLength:Ut,placeholder:`e.g. Posts to the #releases channel. Use it for release notes.`,value:e.description,onChange:e=>t({description:e.target.value})}),(0,Q.jsx)(`span`,{id:a,className:`text-[11px] text-soft-foreground`,children:`Agents read the name and description to decide when to use this webhook.`})]}),(0,Q.jsxs)(`div`,{className:VA,children:[(0,Q.jsx)(`label`,{htmlFor:s,className:HA,children:`Token`}),(0,Q.jsx)(rh,{id:s,"data-slot":`webhook-token`,type:`password`,autoComplete:`new-password`,spellCheck:!1,maxLength:Fe,"aria-describedby":c,placeholder:n?`Token set — type to replace`:`Optional Bearer token`,value:e.token,onChange:e=>t({token:e.target.value})}),(0,Q.jsx)(`span`,{id:c,className:`text-[11px] text-soft-foreground`,children:n?`The token is stored in ~/.cezar and never shown again. Leave it empty to keep it.`:`The token is stored in ~/.cezar, never in the repo. It is sent as a Bearer header.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,Q.jsx)(uh,{id:l,"aria-describedby":u,"data-slot":`webhook-tasks`,checked:e.tasks,onCheckedChange:e=>t({tasks:e})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,Q.jsx)(`label`,{htmlFor:l,className:`font-medium`,children:`Task notifications`}),(0,Q.jsx)(`span`,{id:u,className:`text-[11px] text-soft-foreground`,children:`Tasks you hand off, or start with notify on, send their status here.`})]})]}),e.tasks?(0,Q.jsxs)(`fieldset`,{"data-slot":`webhook-triggers`,className:`flex flex-col gap-1 sm:ps-[3.25rem]`,children:[(0,Q.jsx)(`legend`,{className:`pbe-1 text-[11px] text-muted-foreground`,children:`Send a delivery when a task enters`}),(0,Q.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(min(100%,15rem),1fr))] gap-x-3`,children:N.map(n=>(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-start gap-2.5 pbs-2 text-[13px]`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,"data-trigger":n,checked:e.triggers.includes(n),onChange:r=>t({triggers:r.target.checked?[...e.triggers,n]:e.triggers.filter(e=>e!==n)}),className:`mbs-0.5 size-[18px] shrink-0`}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:PA[n].label}),(0,Q.jsx)(`span`,{className:`text-[11px] text-soft-foreground`,children:PA[n].hint})]})]},n))}),(0,Q.jsx)(`p`,{className:`text-[11px] text-soft-foreground`,children:`Handing a task off and Send test always deliver.`})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex min-h-11 items-center gap-3`,children:[(0,Q.jsx)(uh,{id:d,"aria-describedby":f,"data-slot":`webhook-agent`,checked:e.agent,onCheckedChange:e=>t({agent:e})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col text-[13px]`,children:[(0,Q.jsx)(`label`,{htmlFor:d,className:`font-medium`,children:`Let agents send reports`}),(0,Q.jsx)(`span`,{id:f,className:`text-[11px] text-soft-foreground`,children:`Agents in this project may post a report here when the task calls for it.`})]})]})]})}var WA=`max-sm:h-11`,GA=(e,t)=>({tone:`alert`,text:`Not saved: ${e.message}. Fix the field and select ${t} again.`}),KA=e=>e.dryRun?{tone:`ok`,text:`Dry run: nothing was sent.`}:e.ok?{tone:`ok`,text:`Delivered (HTTP ${e.status??200}).`}:{tone:`danger`,text:`Not delivered: ${e.error??`unknown error`}.`};function qA({feedback:e}){return e?(0,Q.jsx)(`p`,{"data-slot":e.tone===`alert`?`webhook-error`:`webhook-result`,role:e.tone===`alert`?`alert`:`status`,className:e.tone===`ok`?`text-[13px] text-muted-foreground`:`text-[13px] text-danger`,children:e.text}):null}var JA=`rounded-md border border-border bg-background`,YA=`flex flex-col gap-3 border-bs border-border p-3`;function XA({projectId:e,webhook:t,defaultOpen:n=!1}){let r=ir(),i=nr(),a=In(),[o,s]=(0,Z.useState)(n),[c,l]=(0,Z.useState)(()=>LA(t)),[u,d]=(0,Z.useState)(null),f=BA(c,t),p=Object.keys(f).length>0,m=c.name.trim()!==``&&c.url.trim()!==``,h=r.isPending||i.isPending||a.isPending,g={projectId:e,webhookId:t.id},_=e=>r.mutate({...g,...f},{onSuccess:()=>{l(e=>({...e,token:``})),e?e():G(`${c.name.trim()} saved`)},onError:e=>d(GA(e,`Save`))}),v=()=>a.mutate(g,{onSuccess:e=>d(KA(e)),onError:e=>d({tone:`danger`,text:e.message})});return(0,Q.jsx)(`li`,{"data-slot":`webhook-card`,"data-webhook-id":t.id,className:JA,children:(0,Q.jsxs)(jA,{open:o,onOpenChange:s,children:[(0,Q.jsx)(MA,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-action":`webhook-toggle`,className:`group flex min-h-11 w-full items-center gap-3 rounded-md p-3 text-start focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-foreground pointer-hover:bg-muted/50 active:bg-muted/50`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,Q.jsx)(`span`,{"data-slot":`webhook-card-name`,className:`min-w-0 break-words text-[13px] font-medium`,children:t.name}),t.tasks?(0,Q.jsx)(Jm,{variant:`secondary`,"data-badge":`tasks`,children:`Task notifications`}):null,t.agent?(0,Q.jsx)(Jm,{variant:`secondary`,"data-badge":`agent`,children:`Agents`}):null]}),(0,Q.jsx)(`span`,{"data-slot":`webhook-card-url`,className:`truncate text-[12px] text-muted-foreground`,children:tO(t.url)})]}),(0,Q.jsx)(ua,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground group-data-[state=open]:rotate-180`})]})}),(0,Q.jsx)(NA,{children:(0,Q.jsxs)(`form`,{"data-slot":`webhook-form`,className:YA,onSubmit:e=>{e.preventDefault(),d(null),m&&p&&_()},children:[(0,Q.jsx)(UA,{draft:c,tokenSet:t.tokenSet,onChange:e=>l(t=>({...t,...e}))}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(k,{type:`submit`,size:`sm`,className:WA,"data-action":`webhook-save`,disabled:h||!m||!p,children:`Save`}),(0,Q.jsx)(k,{type:`button`,size:`sm`,className:WA,variant:`outline`,"data-action":`webhook-test`,disabled:h||!m,onClick:()=>{d(null),p?_(v):v()},children:`Send test`}),t.tokenSet?(0,Q.jsx)(k,{type:`button`,size:`sm`,className:WA,variant:`ghost`,"data-action":`webhook-clear-token`,disabled:h,onClick:()=>r.mutate({...g,token:``},{onSuccess:()=>G(`Webhook token cleared`),onError:e=>d({tone:`danger`,text:`Token not cleared: ${e.message}.`})}),children:`Clear token`}):null,(0,Q.jsx)(k,{type:`button`,size:`sm`,className:WA,variant:`danger-ghost`,"data-action":`webhook-remove`,"aria-label":`Remove ${t.name}`,disabled:h,onClick:()=>i.mutate(g,{onSuccess:()=>G(`${t.name} removed`),onError:e=>d({tone:`danger`,text:`Not removed: ${e.message}.`})}),children:`Remove`})]}),(0,Q.jsx)(qA,{feedback:u})]})})]})})}function ZA({projectId:e,onCreated:t,onCancel:n}){let r=vr(),[i,a]=(0,Z.useState)(IA),[o,s]=(0,Z.useState)(null),c=i.name.trim()!==``&&i.url.trim()!==``;return(0,Q.jsxs)(`li`,{"data-slot":`webhook-card`,"data-draft":``,className:JA,children:[(0,Q.jsx)(`p`,{className:`p-3 text-[13px] font-medium`,children:`New webhook`}),(0,Q.jsxs)(`form`,{"data-slot":`webhook-form`,"aria-label":`New webhook`,className:YA,onSubmit:n=>{n.preventDefault(),s(null),c&&r.mutate({projectId:e,...zA(i)},{onSuccess:({webhook:e})=>{G(`${e.name} created`),t(e)},onError:e=>s(GA(e,`Create`))})},children:[(0,Q.jsx)(UA,{draft:i,tokenSet:!1,onChange:e=>a(t=>({...t,...e}))}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(k,{type:`submit`,size:`sm`,className:WA,"data-action":`webhook-create`,disabled:r.isPending||!c,children:`Create`}),(0,Q.jsx)(k,{type:`button`,size:`sm`,className:WA,variant:`ghost`,"data-action":`webhook-cancel`,disabled:r.isPending,onClick:n,children:`Cancel`})]}),(0,Q.jsx)(qA,{feedback:o})]})]})}function QA({project:e}){let t=e.webhooks??[],[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(null),o=t.length>=16;return(0,Q.jsx)(qw,{title:`Webhooks`,hint:`A webhook gets a POST from Squawk. Tasks can send their status to it, and agents can send it reports.`,children:(0,Q.jsxs)(`div`,{"data-slot":`project-webhooks`,className:`flex flex-col gap-3`,children:[t.length===0&&!n?(0,Q.jsx)(`p`,{"data-slot":`webhooks-empty`,className:`text-[13px] text-soft-foreground`,children:`No webhooks yet. Add one to send task updates to a bot, or to let agents post reports.`}):null,t.length>0||n?(0,Q.jsxs)(`ul`,{className:`flex flex-col gap-2`,children:[t.map(t=>(0,Q.jsx)(XA,{projectId:e.id,webhook:t,defaultOpen:t.id===i},t.id)),n?(0,Q.jsx)(ZA,{projectId:e.id,onCancel:()=>r(!1),onCreated:e=>{a(e.id),r(!1)}}):null]}):null,n?null:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(k,{type:`button`,size:`sm`,variant:`outline`,className:`max-sm:h-11`,"data-action":`webhook-add`,disabled:o,onClick:()=>r(!0),children:[(0,Q.jsx)(Bu,{"aria-hidden":`true`}),`Add webhook`]}),o?(0,Q.jsxs)(`span`,{className:`text-[11px] text-soft-foreground`,children:[`A project holds at most `,16,` webhooks.`]}):null]})]})})}function $A(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`})}function ej(){let e=Ss(),t=bn(),n=rr();if(t.isPending)return(0,Q.jsx)(`p`,{"data-slot":`project-general-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading project…`});if(t.isError)return(0,Q.jsxs)(`p`,{"data-slot":`project-general-error`,className:`text-[13px] text-danger`,children:[`Could not read the project registry — `,t.error.message]});let r=t.data,i=r?.projects.find(t=>t.id===e);return!r||!i?null:(0,Q.jsxs)(`div`,{"data-slot":`project-general`,className:`flex w-full flex-col gap-5`,children:[(0,Q.jsxs)(`section`,{className:`flex flex-col gap-5 rounded-lg border border-border bg-card p-5 [&_select]:min-h-11 [&_select]:w-full`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-semibold`,children:`General`}),(0,Q.jsx)(AT,{}),(0,Q.jsx)(tj,{project:i}),(0,Q.jsx)(qw,{title:`Max parallel tasks`,hint:n.data?`The workspace limit (${n.data.resources.maxParallel}) still applies as an overall ceiling.`:`How many of this project's tasks may run at once. The workspace limit still applies as an overall ceiling.`,children:n.data?(0,Q.jsx)(rT,{project:i,workspaceMax:n.data.resources.maxParallel}):(0,Q.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading the workspace limit…`})}),(0,Q.jsx)(QA,{project:i},i.id)]}),(0,Q.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,Q.jsx)(nj,{project:i,bootProject:r.bootProject})})]})}function tj({project:e}){return(0,Q.jsxs)(`dl`,{"data-slot":`project-facts`,className:`grid grid-cols-1 gap-4 text-[13px] sm:grid-cols-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Project`}),(0,Q.jsx)(`dd`,{className:`mt-1 font-medium`,children:e.name})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Branch`}),(0,Q.jsx)(`dd`,{className:`mt-1 break-all`,children:e.branch??`—`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Status`}),(0,Q.jsxs)(`dd`,{"data-slot":`project-general-status`,className:e.status===`missing`?`mt-1 text-danger`:`mt-1`,children:[Yw[e.status],e.status===`missing`?` — remove it below, or restore the folder`:null]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Added`}),(0,Q.jsxs)(`dd`,{className:`mt-1`,children:[$A(e.addedAt),(0,Q.jsx)(`span`,{className:`text-soft-foreground`,children:e.source===`checkout`?` · cloned from GitHub`:` · opened locally`})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-[11px] text-muted-foreground`,children:`Last opened`}),(0,Q.jsx)(`dd`,{className:`mt-1`,children:$A(e.lastOpenedAt)})]})]})}function nj({project:e,bootProject:t}){let[n,r]=(0,Z.useState)(null),i=Gw(),a=j(),o=e.id===t;return(0,Q.jsxs)(qw,{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 opening it again re-registers it.`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsxs)(k,{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?`Squawk is serving this project — it re-registers itself at every start`:void 0,disabled:o||i.isPending,onClick:()=>r(e),className:`text-danger`,children:[`Remove `,e.name]}),o?(0,Q.jsx)(`span`,{"data-slot":`project-general-remove-boot`,className:`text-[11px] text-soft-foreground`,children:`Squawk is serving this project — it re-registers itself at every start.`}):null]}),(0,Q.jsx)(Kw,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{r(null),i.confirm(e,()=>void a(`/p/${encodeURIComponent(t)}`))}})]})}function rj(e,t){return e===`global`?`/settings/global/${t}`:`/settings/${t}`}var ij=rj(`global`,`appearance`);function aj(e){return e===`global`?{Link:E,NavLink:w}:{Link:Y,NavLink:ys}}function oj({scope:e,title:t,mobileTitle:n}){let r=Kh().name;return(0,Q.jsxs)(`header`,{"data-slot":`settings-main-header`,className:`settings-route-header flex shrink-0 flex-col gap-2`,children:[(0,Q.jsxs)(`h1`,{className:`text-[15px] font-semibold tracking-normal max-md:text-[24px] max-md:font-normal`,children:[(0,Q.jsx)(`span`,{className:`md:hidden`,children:n}),(0,Q.jsxs)(`span`,{className:`max-md:hidden`,children:[t,` · `,e===`global`?`every project`:r??`this project`]})]}),e===`global`?(0,Q.jsx)(`span`,{"data-slot":`settings-scope-chip`,className:`sr-only`,children:`Global settings`}):null]})}function sj({scope:e,activeId:t}){let{NavLink:n}=aj(e),r=zT(e);return(0,Q.jsxs)(`details`,{className:`settings-section-picker md:hidden`,children:[(0,Q.jsxs)(`summary`,{children:[r.find(e=>e.id===t)?.title??`General`,(0,Q.jsx)(ua,{"aria-hidden":`true`,className:`size-5 text-muted-foreground`})]}),(0,Q.jsxs)(`nav`,{"aria-label":`Settings sections`,"data-slot":`settings-nav-mobile`,"data-scope":e,children:[e===`project`?(0,Q.jsx)(n,{to:`/settings`,end:!0,"data-slot":`settings-nav-index`,children:`General`}):null,r.map(t=>(0,Q.jsx)(n,{to:rj(e,t.id),"data-section":t.id,children:t.title},t.id))]})]},`${e}-${t}`)}function cj({section:e,scope:t}){let n=e.component;return(0,Q.jsxs)(`div`,{"data-route":t===`global`?`settings-global-${e.id}`:`settings-${e.id}`,className:`settings-route mx-auto flex min-h-full w-full flex-col`,children:[(0,Q.jsx)(oj,{scope:t,title:e.title,mobileTitle:t===`global`?`Global settings`:`Project settings`}),(0,Q.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,Q.jsx)(sj,{scope:t,activeId:e.id}),(0,Q.jsxs)(`section`,{className:`settings-panel min-w-0 self-start md:flex-1`,"aria-label":e.title,children:[(0,Q.jsx)(`h2`,{className:`settings-panel-title`,children:e.title}),(0,Q.jsx)(n,{})]})]})]})}function lj(){return(0,Q.jsxs)(`div`,{"data-route":`settings`,className:`settings-route mx-auto flex min-h-full w-full flex-col`,children:[(0,Q.jsx)(oj,{scope:`project`,title:`General`,mobileTitle:`Project settings`}),(0,Q.jsxs)(`div`,{className:`settings-route-body flex min-w-0 flex-1 flex-col md:flex-row`,children:[(0,Q.jsx)(sj,{scope:`project`,activeId:null}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,Q.jsx)(ej,{}),(0,Q.jsx)(`section`,{className:`rounded-lg border border-border bg-card p-5`,children:(0,Q.jsx)(HS,{})}),(0,Q.jsx)(`h2`,{className:`settings-other-title mt-6 rounded-t-lg border border-b-0 border-border bg-card px-5 pt-5 text-base font-semibold md:hidden`,children:`Other project settings`}),(0,Q.jsx)(`ul`,{"data-slot":`settings-index`,className:`mt-7 flex w-full flex-col gap-5 md:hidden`,children:zT(`project`).map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(Y,{to:rj(`project`,e.id),"data-section":e.id,className:`flex items-center gap-3.5 rounded-lg border border-border bg-card p-4 transition-colors hover:bg-card-2`,children:[(0,Q.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center text-accent-text`,children:(0,Q.jsx)(e.icon,{"aria-hidden":`true`,className:`size-4`})}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,Q.jsx)(`span`,{className:`block text-xs text-soft-foreground`,children:e.description})]}),(0,Q.jsx)(Sa,{"aria-hidden":`true`,className:`size-4 shrink-0 text-soft-foreground`})]})},e.id))}),(0,Q.jsxs)(`p`,{className:`mt-5 w-full text-[12px] text-soft-foreground`,children:[`Appearance, notifications, host resources and the project registry live in`,` `,(0,Q.jsx)(E,{to:ij,"data-slot":`settings-global-link`,className:`underline underline-offset-2 hover:text-foreground`,children:`Global settings`}),`.`]})]})]})]})}function uj(){let[e,t]=(0,Z.useState)(()=>new Set);return{expandedRuns:e,toggleExpandedRun:(0,Z.useCallback)(e=>t(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[])}}var dj=[{id:`status`,label:`Status`,canFold:!1,defaultExpanded:!0,align:`left`,width:`120px`},{id:`task`,label:`Task`,canFold:!1,defaultExpanded:!0,align:`left`,width:`320px`},{id:`workflow`,label:`Workflow`,canFold:!0,defaultExpanded:!0,align:`left`,width:`84px`,icon:`workflow`},{id:`branch`,label:`Branch`,canFold:!0,defaultExpanded:!1,align:`left`,width:`120px`,icon:`branch`},{id:`diff`,label:`±`,canFold:!0,defaultExpanded:!0,align:`left`,width:`84px`,icon:`diff`},{id:`reference`,label:`Ref`,canFold:!0,defaultExpanded:!0,align:`left`,width:`104px`,icon:`reference`},{id:`tokens`,label:`IN / OUT`,canFold:!0,defaultExpanded:!0,align:`right`,width:`112px`,icon:`tokens`,capability:`tokens`},{id:`cost`,label:`Cost`,canFold:!0,defaultExpanded:!0,align:`right`,width:`64px`,icon:`cost`,capability:`cost`},{id:`cpu`,label:`CPU`,canFold:!0,defaultExpanded:!0,align:`right`,width:`60px`,icon:`cpu`},{id:`memory`,label:`Mem`,canFold:!0,defaultExpanded:!0,align:`right`,width:`80px`,icon:`memory`},{id:`started`,label:`Started`,canFold:!0,defaultExpanded:!0,align:`right`,width:`68px`,icon:`started`}],fj=new Map(dj.map(e=>[e.id,e]));function pj(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`boolean`))}function mj(e){let t={};for(let[n,r]of Object.entries(pj(e))){let e=fj.get(n);e?.canFold&&(t[e.id]=r)}return t}function hj(e,t){let n=fj.get(e);return!n||!n.canFold?!0:t[e]??n.defaultExpanded}function gj(e,t){let n=pj(e);return fj.get(t)?.canFold?{...n,[t]:!hj(t,mj(e))}:n}function _j(e){return dj.filter(t=>t.capability===void 0||e[t.capability])}function vj(e,t){return t===`flat`?!1:t===`virtual`||e>=100}function yj(e,t){let n=t===null?-1:e.indexOf(t);return n<0?[]:[n-1,n,n+1].filter(t=>t>=0&&t<e.length)}function bj(e,t){let n=e.map(e=>hj(e.id,t)?e.id===`workflow`||e.id===`memory`?120:Number.parseFloat(e.width??`100`):42);return{"--task-columns":e.map((e,t)=>e.id===`task`?`minmax(${n[t]}px, 1fr)`:`${n[t]}px`).join(` `),minInlineSize:Math.max(1240,n.reduce((e,t)=>e+t,0))}}function xj(e,t){let n=2;return{indexes:e.map(e=>{let r=n;return n+=t.has(e)?2:1,r}),rowCount:n-1}}var Sj=null,{min:Cj,max:wj,abs:Tj,floor:Ej}=Math,Dj=(e,t,n)=>Cj(n,wj(t,e)),Oj=e=>[...e].sort((e,t)=>e-t),kj=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)},Aj=()=>{let e;return[new Promise(t=>{e=t}),e]},jj=e=>{let t;return()=>(e&&=(t=e(),void 0),t)},Mj=(e,t,n)=>{let r=n?`unshift`:`push`;for(let n=0;n<t;n++)e[r](-1);return e},Nj=(e,t)=>{let n=e.t[t];return n===-1?e.o:n},Pj=(e,t,n)=>{let r=e.t[t]===-1;return e.t[t]=n,e.i=Cj(t,e.i),r},Fj=(e,t)=>{if(!e.l)return 0;if(e.i>=t)return e.u[t];e.i<0&&(e.u[0]=0,e.i=0);let n=e.i,r=e.u[n];for(;n<t;)r+=Nj(e,n),e.u[++n]=r;return e.i=t,r},Ij=(e,t,n=0,r=e.l-1)=>{let i=n;for(;n<=r;){let a=Ej((n+r)/2);Fj(e,a)<=t?(i=a,n=a+1):r=a-1}return Dj(i,0,e.l-1)},Lj=(e,t,n)=>{let r=t-e.l;return e.i=n?-1:Cj(t-1,e.i),e.l=t,r>0?(Mj(e.u,r),Mj(e.t,r,n),e.o*r):(e.u.splice(r),(n?e.t.splice(0,-r):e.t.splice(r)).reduce((t,n)=>t-(n===-1?e.o:n),0))},Rj=typeof window<`u`,zj=e=>e.documentElement,Bj=e=>e.ownerDocument,Vj=e=>e.defaultView,Hj=jj(()=>!!/iP(hone|od|ad)/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>0),Uj=jj(()=>`scrollBehavior`in zj(document).style),Wj=e=>wj(e.h(),e.p()),Gj=(e,t=40,n=0,r,i=!1)=>{let a=!!n,o=1,s=0,c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=Sj,g=[0,a?wj(n-1,0):-1],_=0,v=!1,y=((e,t,n)=>({o:t,t:n?Mj(n.slice(0,Cj(e,n.length)),wj(0,e-n.length)):Mj([],e),l:e,i:-1,u:Mj([],e+1)}))(e,r?r[1]:t,r&&r[0]),b=new Set,x=()=>l-c,S=()=>x()+d+u,C=(e,t)=>((e,t,n,r)=>{if(r=Cj(r,e.l-1),Fj(e,r)<=t){let i=Ij(e,n,r);return[Ij(e,t,r,i),i]}{let i=Ij(e,t,void 0,r);return[i,Ij(e,n,i)]}})(y,e,t,g[0]),w=()=>Fj(y,y.l),T=(e,t)=>{let n=Fj(y,e)-d;return t?w()-n-E(e):n},E=e=>Nj(y,e),D=(e,t=-1)=>y.t[e]===t,O=e=>{e&&(Hj()&&p!==0||h&&m===1?d+=e:u+=e)};return{v:()=>{b.clear()},m:()=>o,_:()=>(e=>[e.t.slice(),e.o])(y),S:(e=200)=>{if(!v||a)return g;let t,n;if(f)[t,n]=g;else{let r=wj(0,S()),a=r+s;i||(e=wj(0,e),p!==1&&(r-=e),p!==2&&(a+=e)),[t,n]=g=C(wj(0,r),wj(0,a)),h&&(t=Cj(t,h[0]),n=wj(n,h[1]))}return[wj(t,0),Cj(n,y.l-1)]},$:e=>Ij(y,e-c),I:D,k:T,R:E,T:()=>y.l,C:()=>l,M:()=>p!==0,p:()=>s,O:()=>c,h:w,H:()=>(f=u,u=0,[f,m===2]),W:(e,t)=>{let n=[e,t];return b.add(n),()=>{b.delete(n)}},B:(e,t)=>{let n,r,g=0;switch(e){case 1:{if(t===l&&m===0)break;let e=f;f=0;let n=t-l,i=Tj(n);e&&i<Tj(e)+1||m!==0||(p=n<0?2:1),a&&=!1,l=t,g=4;let o=x();o>=-s&&o<=w()&&(g+=1,r=i>s);break}case 2:g=8,p!==0&&(n=!0,g+=1),p=0,m=0,h=Sj;break;case 3:{let e=t.filter(([e,t])=>!D(e,t));if(!e.length)break;O(e.reduce((e,[t,n])=>{let r;if(m===2)r=!0;else if(h&&m===1)r=t<h[0];else{let e=x(),n=T(t),i=E(t);r=p!==1&&m===0?n+i<=e:n<e&&n+i<e+s}return r&&(e+=n-E(t)),e},0));for(let[t,n]of e){let e=E(t),r=Pj(y,t,n);i&&(_+=r?n:n-e)}i&&s&&_>s&&(O(((e,t)=>{let n=0,r=[];e.t.forEach((e,i)=>{e!==-1&&(r.push(e),i<t&&n++)}),e.i=-1;let i=Oj(r),a=i.length,o=a/2|0,s=a%2==0?(i[o-1]+i[o])/2:i[o],c=e.o;return((e.o=s)-c)*wj(t-n,0)})(y,Ij(y,S()))),i=!1),g=3,r=!0;break}case 4:s!==t&&(s||(v=r=!0),s=t,g=3);break;case 5:t[1]?(O(Lj(y,t[0],!0)),m=2,g=1):(Lj(y,t[0]),g=1);break;case 6:c=t;break;case 7:m=1;break;case 8:h=C(t,t+s),g=1}g&&(o=1+(2147483647&o),n&&d&&(u+=d,d=0),b.forEach(([e,t])=>{g&e&&t(r)}))}}},Kj=setTimeout,qj=(e,t)=>t?-e:e,Jj=(e,t,n,r,i,a)=>{let o=Date.now,s=0,c=!1,l=!1,u=!1,d=!1,f=(()=>{let t,n=()=>{t!=Sj&&clearTimeout(t)},r=()=>{n(),t=Kj(()=>{t=Sj,(()=>{if(c||l)return c=!1,void f();u=!1,e.B(2)})()},150)};return r.J=n,r})(),p=()=>{s=o(),u&&(d=!0),a&&e.B(6,a()),e.B(1,r()),f()},m=t=>{if(c||!e.M()||t.ctrlKey)return;let r=o()-s;150>r&&50<r&&(n?t.deltaX:t.deltaY)&&(c=!0)},h=()=>{l=!0,u=d=!1},g=()=>{l=!1,Hj()&&(u=!0)};return t.addEventListener(`scroll`,p),t.addEventListener(`wheel`,m,{passive:!0}),t.addEventListener(`touchstart`,h,{passive:!0}),t.addEventListener(`touchend`,g,{passive:!0}),{A:()=>{t.removeEventListener(`scroll`,p),t.removeEventListener(`wheel`,m),t.removeEventListener(`touchstart`,h),t.removeEventListener(`touchend`,g),f.J()},L:()=>{let[t,n]=e.H();t&&(i(t,n,d),d=!1,n&&e.p()>e.h()&&e.B(1,r()))}}},Yj=(e,t,n)=>{let r;return[async(i,a)=>{if(!await t())return;r&&r();let o=()=>{let[t,n]=Aj();return r=()=>{n(!1)},e.p()&&Kj(r,150),[t,e.W(2,()=>{n(!0)})]};if(a&&Uj())e.B(8,i()),kj(async()=>{for(;;){let t=!0;for(let[n,r]=e.S();n<=r;n++)if(e.I(n)){t=!1;break}if(t)break;let[n,r]=o();try{if(!await n)return}finally{r()}}e.B(7),n(i(),a)});else for(;;){let[t,r]=o();try{if(e.B(7),n(i()),!await t)return}finally{r()}}},()=>{r&&r()}]},Xj=(e,t)=>{let n,r,i=Aj(),a=!1,o=t?`scrollLeft`:`scrollTop`,s=t?`overflowX`:`overflowY`,[c,l]=Yj(e,()=>i[0],(e,r)=>{e=qj(e,a),r?n.scrollTo({[t?`left`:`top`]:e,behavior:`smooth`}):n[o]=e});return{N(c,u){n=u,t&&(a=getComputedStyle(u).direction===`rtl`),r=Jj(e,u,t,()=>qj(u[o],a),(t,n,r)=>{if(r){let e=u.style,t=e[s];e[s]=`hidden`,Kj(()=>{e[s]=t})}u[o]=qj(e.C()+t,a),n&&l()}),i[1](!0)},v(){r&&r.A(),i[1](!1),i=Aj()},P:()=>a,V(e){c(()=>e)},X(t){t+=e.C(),c(()=>t)},Y(t,{align:n,smooth:r,offset:i=0}={}){if(t=Dj(t,0,e.T()-1),n===`nearest`){let r=e.k(t),i=e.C();if(r<i)n=`start`;else{if(!(r+e.R(t)>i+e.p()))return;n=`end`}}c(()=>i+e.O()+e.k(t)+(n===`end`?e.R(t)-e.p():n===`center`?(e.R(t)-e.p())/2:0),r)},q:()=>{r&&r.L()}}},Zj=e=>{let t;return{j(n){(t||=new(Vj(Bj(n))).ResizeObserver(e)).observe(n)},D(e){t.unobserve(e)},A(){t&&t.disconnect()}}},Qj=(e,t)=>{let n,r=t?`width`:`height`,i=new WeakMap,a=Zj(t=>{let a=[];for(let{target:o,contentRect:s}of t)if(o.offsetParent)if(o===n)e.B(4,s[r]);else{let e=i.get(o);e!=Sj&&a.push([e,s[r]])}a.length&&e.B(3,a)});return{G(e){a.j(n=e)},U:(e,t)=>(i.set(e,t),a.j(e),()=>{i.delete(e),a.D(e)}),v:a.A}},$j=Rj?Z.useLayoutEffect:Z.useEffect,eM=`current`,tM=(e,t)=>{if(Array.isArray(e))for(let n of e)tM(n,t);else e==null||typeof e==`boolean`||t.push(e)},nM=(e,t)=>e.key??`_`+t,rM=e=>{let t=(0,Z.useRef)(null);return t[eM]||(t[eM]=e())},iM=e=>{let t=(0,Z.useRef)(e);return $j(()=>{t[eM]=e},[e]),t},aM=(0,Z.memo)(({Z:e,ee:t,te:n,oe:r,ne:i,re:a,se:o,ie:s})=>{let c=(0,Z.useRef)(null);$j(()=>t(c[eM],n),[n]);let l=(0,Z.useMemo)(()=>{let e={contain:`layout style`,position:i&&s?void 0:`absolute`,[o?`height`:`width`]:`100%`,[o?`top`:`left`]:0,[o?`left`:`top`]:r,visibility:!i||s?void 0:`hidden`};return o&&(e.display=`inline-flex`),e},[r,i,s,o]);return(0,Q.jsx)(a,typeof a==`string`?{ref:c,style:l,children:e}:{ref:c,style:l,index:n,children:e})}),oM=(e,t)=>(0,Z.useMemo)(()=>{if(typeof e==`function`)return[n=>e(t[n],n),t.length];let n=(e=>{let t=[];return tM(e,t),t})(e);return[e=>n[e],n.length]},[e,t]),sM=(0,Z.forwardRef)(({children:e,data:t,bufferSize:n,itemSize:r,shift:i,horizontal:a,keepMounted:o,cache:s,startMargin:c=0,ssrCount:l,as:u=`div`,item:d=`div`,scrollRef:f,onScroll:p,onScrollEnd:m},h)=>{let[g,_]=oM(e,t),v=(0,Z.useRef)(null),y=(0,Z.useRef)(!!l),b=iM(p),x=iM(m),[S,C,w,T]=rM(()=>{let e=!!a,t=Gj(_,r,l,s,!r);return[t,Qj(t,e),Xj(t,e),e]});_!==S.T()&&S.B(5,[_,i]),c!==S.O()&&S.B(6,c);let[E,D]=(0,Z.useReducer)(S.m,void 0,S.m),O=S.M(),k=S.h(),A=w.P(),j=[],M=e=>{let t=g(e);return(0,Q.jsx)(aM,{ee:C.U,te:e,oe:S.k(e,A),ne:S.I(e),re:d,Z:t,se:T,ie:y[eM]},nM(t,e))};if($j(()=>{y[eM]=!1,S.W(1,e=>{e?(0,sf.flushSync)(D):D()}),S.W(4,()=>{b[eM]&&b[eM](S.C())}),S.W(8,()=>{x[eM]&&x[eM]()});let e=v[eM],t=t=>{C.G(t),w.N(e,t)};return f?kj(()=>{f[eM]&&t(f[eM])}):t(e.parentElement),()=>{S.v(),C.v(),w.v()}},[]),$j(()=>{w.q()},[E]),(0,Z.useImperativeHandle)(h,()=>({get cache(){return S._()},get scrollOffset(){return S.C()},get scrollSize(){return Wj(S)},get viewportSize(){return S.p()},findItemIndex:S.$,getItemOffset:S.k,getItemSize:S.R,scrollToIndex:w.Y,scrollTo:w.V,scrollBy:w.X}),[]),o){let e=new Set(o);for(let[t,r]=S.S(n);t<=r;t++)e.add(t);Oj([...e]).forEach(e=>{j.push(M(e))})}else for(let[e,t]=S.S(n);e<=t;e++)j.push(M(e));return(0,Q.jsx)(u,{ref:v,style:{contain:`size style`,overflowAnchor:`none`,flex:`none`,position:`relative`,width:T?k:`100%`,height:T?`100%`:k,pointerEvents:O?`none`:void 0},children:j})});function cM(e,t){let[n,r]=(0,Z.useState)(!1),[i,a]=(0,Z.useState)(``),o=(0,Z.useRef)(!1);return{editing:n,draft:i,setDraft:a,begin:()=>{a(e),o.current=!1,r(!0)},commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function lM({editor:e,className:t}){return(0,Q.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:e.commit,onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:C(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}function uM(e){let t=new Map,n=new Set,r;return{begin:e,editingId:()=>r?.id??null,subscribeSelection(e){return n.add(e),()=>{n.delete(e)}},snapshot:e=>r?.id===e?r.editor:null,subscribe(e,n){let r=t.get(e);return r||(r=new Set,t.set(e,r)),r.add(n),()=>{r.delete(n),r.size||t.delete(e)}},publish(e,i){let a=r?.id;if(r=e&&i.editing?{id:e,editor:i}:void 0,a!==r?.id)for(let e of n)e();for(let e of new Set([a,r?.id]))if(e)for(let n of t.get(e)??[])n()}}}var dM=(0,Z.createContext)(null),fM={editing:!1,draft:``,begin(){},setDraft(){},commit(){},cancel(){}};function pM({children:e,runs:t,onRename:n}){let[r,i]=(0,Z.useState)(),[a]=(0,Z.useState)(()=>uM(e=>i({run:e}))),o=t.find(e=>e.id===r?.run.id),s=cM(o?xi(o):``,e=>{o&&n(o.id,e)});return(0,Z.useEffect)(()=>{r&&s.begin()},[r]),(0,Z.useEffect)(()=>{r&&!o&&(s.cancel(),i(void 0))},[r,o,s]),(0,Z.useLayoutEffect)(()=>{a.publish(o?.id,s)},[a,o?.id,s]),(0,Q.jsx)(dM,{value:a,children:e})}function mM(e){let t=(0,Z.useContext)(dM);if(!t)throw Error(`Task title editor needs its page provider`);return{...(0,Z.useSyncExternalStore)((0,Z.useCallback)(n=>t.subscribe(e.id,n),[t,e.id]),(0,Z.useCallback)(()=>t.snapshot(e.id),[t,e.id]))??fM,begin:()=>t.begin(e)}}var hM=()=>null;function gM(){return _M}function _M(){}function vM(){let e=(0,Z.useContext)(dM);return(0,Z.useSyncExternalStore)(e?.subscribeSelection??gM,e?.editingId??hM)}var yM=(0,Z.createContext)(null);function bM(e,t,n=!1){let[r,i]=(0,Z.useState)(null),a=(0,Z.useRef)(new Map),o=(0,Z.useCallback)((e,t)=>{t?a.current.set(e,t):a.current.delete(e)},[]),s=(0,Z.useCallback)(e=>[...a.current.values()].some(t=>t.includes(e)),[]);return{props:xM(e,t,i,n?s:void 0),value:(0,Z.useMemo)(()=>({focused:r,revision:t,registerList:n?o:void 0}),[r,t,o,n])}}function xM(e,t,n,r){let i=(0,Z.useRef)(r);(0,Z.useLayoutEffect)(()=>{i.current=r});let a=(0,Z.useRef)(null),o=(0,Z.useRef)(null);return(0,Z.useLayoutEffect)(()=>{let e=o.current;if(!e||e.element.isConnected||document.activeElement!==document.body)return;let t=()=>{o.current===e&&(o.current=null,n?.(null))},r=()=>{let n=e.project?`${e.project}/${e.runId}`:e.runId;if(i.current&&!i.current(n)||document.activeElement!==document.body||e.element.isConnected)return t(),!0;let r=[...a.current?.querySelectorAll(`[data-run-id]`)??[]].filter(t=>t.dataset.runId===e.runId&&t.dataset.project===e.project).flatMap(e=>[...e.querySelectorAll(`a,button,input`)]),o=r.find(t=>e.control?t.dataset.taskControl===e.control:t.tagName===e.tag&&t.getAttribute(`aria-label`)===e.label)??r.find(e=>e.tagName===`A`);return o?.focus({preventScroll:!0}),!!o&&document.activeElement===o};if(r()||!a.current)return;let s=()=>{l.disconnect(),document.removeEventListener(`pointerdown`,c,!0),document.removeEventListener(`keydown`,c,!0)},c=()=>{t(),s()},l=new MutationObserver(()=>{r()&&s()});return document.addEventListener(`pointerdown`,c,!0),document.addEventListener(`keydown`,c,!0),l.observe(a.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`style`]}),s},[e,t]),{ref:a,onFocusCapture:e=>{let t=e.target,r=t.closest(`[data-run-id]`);o.current=r?{element:t,runId:r.dataset.runId,project:r.dataset.project,control:t.dataset.taskControl??null,label:t.getAttribute(`aria-label`),tag:t.tagName}:null,n?.(r?r.dataset.project?`${r.dataset.project}/${r.dataset.runId}`:r.dataset.runId:null)},onBlurCapture:e=>{let t=e.target,r=e.currentTarget;queueMicrotask(()=>{o.current?.element===t&&t.isConnected&&!r.contains(document.activeElement)&&(o.current=null,n?.(null))})}}}var SM=new WeakMap;function CM({items:e,itemKey:t,children:n,itemSize:r}){let[i]=o(),a=(0,Z.useRef)(null),s=(0,Z.useRef)(null),[c,l]=(0,Z.useState)({available:null,margin:0}),[u,d]=(0,Z.useState)(null),f=vM(),p=(0,Z.useContext)(yM),m=e.map(t),h=vj(e.length,i.get(`tasks`)),g=c.available===!0&&h,_=(0,Z.useRef)(Symbol(`task-list`)),v=(0,Z.useRef)(()=>{});(0,Z.useLayoutEffect)(()=>{p?.registerList?.(_.current,m);let e=b.current;return e&&SM.set(e,{keys:m,handle:s,measure:()=>v.current()}),()=>{p?.registerList?.(_.current,null),e&&SM.delete(e)}});let y=xM(String(g),void 0,void 0,e=>m.includes(e)),b=y.ref;return(0,Z.useLayoutEffect)(()=>{let e=b.current,t=e?.closest(`[data-slot="main"]`);if(a.current=t??null,!e||!t){l(e=>e.available===!1?e:{available:!1,margin:0});return}let n=null,r=()=>{let r=Math.max(0,e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop);r!==n&&(n=r,l(e=>e.available===!0&&e.margin===r?e:{available:!0,margin:r}))};r(),v.current=r;let i=new ResizeObserver(r);for(let n=e;n&&n!==t;n=n.parentElement){i.observe(n);for(let e of n.parentElement?.children??[])i.observe(e)}return i.observe(t),()=>i.disconnect()},[]),(0,Q.jsx)(`div`,{ref:b,"data-slot":`task-list-items`,"data-virtualized":g,onFocusCapture:e=>{y.onFocusCapture(e),d(e.target.closest(`[data-task-item]`)?.dataset.taskItem??null)},onBlurCapture:e=>{y.onBlurCapture(e),e.relatedTarget&&!e.currentTarget.contains(e.relatedTarget)&&d(null)},children:g?(0,Q.jsx)(TM,{itemSize:r,items:e,keys:m,handle:s,scroll:a,margin:c.margin,focused:p?.focused??u,editing:f,children:n}):(c.available===null&&h?[]:e).map((t,r)=>(0,Q.jsx)(`div`,{"data-task-item":m[r],"data-first":r===0,"data-last":r===e.length-1,className:`task-list-flat-item`,children:n(t,r)},m[r]))})}function wM({layout:e,revision:t,visibilityRevision:n=``,children:r,...i}){let a=bM(e,t,!0);return(0,Q.jsx)(yM,{value:a.value,children:(0,Q.jsx)(DM,{revision:t,visibilityRevision:`${e}:${n}`,children:(0,Q.jsx)(`div`,{...i,...a.props,children:r})})})}function TM({items:e,keys:t,handle:n,scroll:r,margin:i,focused:a,editing:o,children:s,itemSize:c}){let[l,u]=(0,Z.useState)(!1),d=EM(r);return(0,Z.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=new ResizeObserver(e=>{e.some(e=>e.contentRect.height>0)&&(u(!0),t.disconnect())});return t.observe(e),()=>t.disconnect()},[r]),(0,Q.jsx)(sM,{ref:n,...c===void 0?{}:{itemSize:c},scrollRef:r,startMargin:i,keepMounted:[...new Set([...!l&&e.length?[0]:[],...yj(t,a),...yj(t,d),...yj(t,o)])],data:e,children:(n,r)=>(0,Q.jsx)(`div`,{"data-task-item":t[r],"data-first":r===0,"data-last":r===e.length-1,children:s(n,r)},t[r])})}function EM(e){let[t,n]=(0,Z.useState)(null),r=(0,Z.useRef)(t);return(0,Z.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let i=e=>{if(e.target!==t)return;let i=t.contains(document.activeElement)?document.activeElement.closest(`[data-task-item]`)?.dataset.taskItem??null:null;i!==r.current&&(r.current=i,(0,sf.flushSync)(()=>n(i)))};return document.addEventListener(`scroll`,i,{capture:!0,passive:!0}),()=>document.removeEventListener(`scroll`,i,{capture:!0})},[e]),t}var DM=class extends Z.Component{root={current:null};owner(){return this.root.current?.closest(`[data-slot="main"]`)??null}getSnapshotBeforeUpdate(e){if(e.revision===this.props.revision&&e.visibilityRevision===this.props.visibilityRevision)return null;let t=this.owner();if(!t||!this.root.current)return null;let n=t.getBoundingClientRect();for(let e of this.root.current.querySelectorAll(`[data-task-item]`)){let r=e.getBoundingClientRect();if(r.bottom>n.top&&r.top<n.bottom)return{key:e.dataset.taskItem,top:r.top,scrollTop:t.scrollTop}}return{key:null,top:0,scrollTop:t.scrollTop}}componentDidUpdate(e,t,n){let r=this.owner();if(!n||!r)return;let i=n.key===null?null:this.currentTop(n.key);i!==null&&Math.abs(i-n.top)>.5&&(r.scrollTop+=i-n.top),queueMicrotask(()=>{r.isConnected&&(0,sf.flushSync)(()=>{for(let e of this.root.current?.querySelectorAll(`[data-slot="task-list-items"]`)??[])SM.get(e)?.measure();r.scrollTop!==n.scrollTop&&r.dispatchEvent(new Event(`scroll`))})})}currentTop(e){for(let t of this.root.current?.querySelectorAll(`[data-task-item]`)??[])if(t.dataset.taskItem===e)return t.getBoundingClientRect().top;for(let t of this.root.current?.querySelectorAll(`[data-slot="task-list-items"]`)??[]){let n=SM.get(t),r=n?.keys.indexOf(e)??-1,i=n?.handle.current;if(r>=0&&i)return t.getBoundingClientRect().top+i.getItemOffset(r)}return null}render(){return(0,Q.jsx)(`div`,{ref:this.root,style:{display:`contents`},children:this.props.children})}};function OM(e){return e===void 0?`unknown`:new Intl.NumberFormat().format(e)}function kM(e,t){return`Input tokens: ${OM(e)}; output tokens: ${OM(t)}`}function AM(e,t,n=`compact`){let r=e===void 0?`—`:Ka(e),i=t===void 0?`—`:Ka(t);return n===`table`?`${r} / ${i}`:`IN ${r} · OUT ${i}`}function jM({inputTokens:e,outputTokens:t,variant:n=`compact`,omitWhenUnknown:r=!0,className:i,title:a}){return r&&e===void 0&&t===void 0?null:(0,Q.jsx)(`span`,{"data-slot":`directional-usage`,"aria-label":kM(e,t),title:a,className:C(`font-mono tabular-nums`,i),children:AM(e,t,n)})}function MM({className:e,dot:t,shape:n=`filled`,pulse:r=!1,children:i,...a}){return(0,Q.jsxs)(`span`,{"data-slot":`pill`,className:C(`inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-[3px] text-xs font-medium whitespace-nowrap text-muted-foreground`,e),...a,children:[t?(0,Q.jsx)($,{tone:t,shape:n,pulse:r}):null,i]})}var NM=[{value:`all`,label:`All`},{value:`direct`,label:`Direct tasks`},{value:`automations`,label:`Automations`}];function PM(e){return e?NM:NM.filter(e=>e.value!==`automations`)}function FM(e,t){return e===`automations`&&!t?`all`:e}function IM(e){return e===`direct`||e===`automations`?e:`all`}function LM(e,t){return t===`all`||F(e)===(t===`automations`)}function RM(e){return e===`all`?void 0:e===`automations`}function zM(e,t){let n={all:0,direct:0,automations:0};for(let r of e)zr(r)||r.archived!==(t===`archived`)||(n.all+=1,F(r)?n.automations+=1:n.direct+=1);return n}function BM(e,t,n,r,i){let a=Vr(e).archived,o=a>=200;if(n===`all`)return i??(o?`200+`:a);let s=zM(t,`archived`)[n];return o&&r!==!1?`${s}+`:s}function VM(e){return e.rows.map(e=>e.run)}function HM(e,t){switch(e){case`Needs you`:return`pending`;case`Working`:return`running`;case`Archived`:return`neutral`;case`Finished`:return t.some(e=>Ce(e).bucket===`error`)?`danger`:`success`}}function UM(e,t,n){return Rr(e,t,Lr(n))}var WM=(e,t)=>JSON.stringify([e,t]);function GM(e,t,n){let r=new Map,i=e.map(e=>{let{run:t}=e,n=WM(t.projectId,t.id);r.set(n,e);let i=t.delegation;return{...t,id:n,...i&&`parentRunId`in i?{delegation:{...i,parentRunId:WM(t.projectId,i.parentRunId)}}:{}}}),a=new Map;for(let e of n){let t=a.get(e.projectId);t?t.push(e):a.set(e.projectId,[e])}let o=new Map;for(let[e,t]of a)for(let[n,r]of Lr(t))o.set(WM(e,n),r);let s=e=>r.get(e.id);return Rr(i,t,o).map(e=>({label:e.label,rows:e.rows.map(e=>({kind:`run`,run:s(e.run),queuePosition:e.queuePosition}))}))}function KM(e){return[e.run]}var qM=/^- \S+ — (?:(?:turn complete|step ".*" complete|step ".*" ended without done|session idle-closed) — |worktree setup (?:done in|failed —|skipped —) )/;function JM(e,t=3){let n=Ye(e,`## Progress log`);if(n<0)return[];let r=[];for(let i of e.slice(qe(e,n)).split(`
|
|
14
|
+
`)){if(r.length>=t||i.startsWith(`## `))break;let e=i.trim();!e||qM.test(e)||r.push(e.replace(/^[-*] /,``))}return r}function YM({origin:e,counts:t,automations:n,onChange:r}){return(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Task origin`,"data-slot":`origin-filter`,className:`flex flex-wrap items-center gap-1.5`,children:PM(n).map(n=>{let i=n.value===e;return(0,Q.jsxs)(`button`,{type:`button`,"data-origin":n.value,"aria-pressed":i,onClick:()=>r(n.value),className:C(`inline-flex min-h-11 items-center gap-1.5 rounded-full border border-border px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,i&&`border-accent-strong bg-accent-strong/10 text-accent-text`),children:[n.label,` `,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:t[n.value]})]},n.value)})})}function XM({onExpand:e,onCollapse:t}){return(0,Q.jsxs)(`div`,{"data-slot":`group-fold-controls`,className:`hidden flex-wrap items-center gap-2 md:ml-auto md:flex`,children:[(0,Q.jsx)(k,{type:`button`,variant:`ghost`,className:`min-h-11`,"data-action":`expand-groups`,onClick:e,children:`Expand groups`}),(0,Q.jsx)(k,{type:`button`,variant:`ghost`,className:`min-h-11`,"data-action":`collapse-groups`,onClick:t,children:`Collapse groups`})]})}function ZM({origin:e,counts:t,automations:n,onChange:r,labels:i,onSetAll:a}){return(0,Q.jsxs)(`div`,{"data-slot":`task-origin-row`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,Q.jsx)(YM,{origin:e,counts:t,automations:n,onChange:r}),i.length>0?(0,Q.jsx)(XM,{onExpand:()=>a(i,!1),onCollapse:()=>a(i,!0)}):null]})}var QM={pending:`needs you`,running:`working`,success:`finished`,danger:`contains failed tasks`,neutral:`archived`};function $M({id:e,label:t,count:n,tone:r,folded:i,collapsed:a,onToggle:o,children:s}){let c=a?Sa:ua;return(0,Q.jsxs)(`section`,{"data-slot":`task-status-group`,"data-bucket":t,"data-folded":i,"data-tone":r,"aria-labelledby":`${e}-heading`,className:`flex flex-col gap-2.5`,children:[(0,Q.jsx)(`h2`,{id:`${e}-heading`,className:`text-[13px] font-semibold text-foreground`,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`status-group-toggle`,"aria-expanded":!a,"aria-controls":`${e}-rows`,"aria-label":`${t} ${n}${r===`danger`?`, contains failed tasks`:``}`,onClick:o,className:`inline-flex min-h-11 items-center gap-2 rounded-md pr-2 hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,children:[(0,Q.jsx)(c,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Q.jsx)($,{tone:r,role:`img`,"aria-label":QM[r],title:QM[r]}),(0,Q.jsx)(`span`,{children:t}),` `,(0,Q.jsx)(`span`,{className:`font-normal tabular-nums text-muted-foreground`,children:n})]})}),(0,Q.jsx)(`div`,{id:`${e}-rows`,hidden:a,children:a?null:s})]})}function eN({automationId:e,automationName:t,project:n}){let r=e===void 0?`Direct task`:t??e;return(0,Q.jsxs)(`span`,{"data-slot":`task-origin`,"data-origin":e===void 0?`direct`:`automation`,className:`flex min-w-0 flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[n?(0,Q.jsxs)(Q.Fragment,{children:[n,(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`})]}):null,(0,Q.jsx)(`span`,{className:`min-w-0 break-words`,title:e===void 0?void 0:`Automation ${e}`,children:r})]})}function tN({projectId:e,runId:t,status:n,error:r,open:i}){let a=yr(e,t,!0),o=a.data===void 0?[]:JM(a.data);return(0,Q.jsxs)(`div`,{"data-slot":`task-preview`,className:`flex flex-col gap-3 rounded-md bg-muted/50 p-4 text-xs`,children:[(0,Q.jsx)(`p`,{className:`font-medium text-foreground first-letter:uppercase`,children:n}),r?(0,Q.jsx)(`p`,{"data-slot":`task-preview-error`,className:`break-words text-danger`,children:r}):null,a.isPending?(0,Q.jsx)(`p`,{role:`status`,className:`text-muted-foreground`,children:`Loading latest progress…`}):a.isError?(0,Q.jsx)(`p`,{"data-slot":`task-preview-unavailable`,className:`text-muted-foreground`,children:`Latest progress is unavailable.`}):o.length===0?(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:`No progress recorded yet.`}):(0,Q.jsx)(`ul`,{"aria-label":`Latest progress`,className:`flex flex-col gap-1 text-muted-foreground`,children:o.map((e,t)=>(0,Q.jsx)(`li`,{className:`break-words`,children:e},t))}),(0,Q.jsx)(`div`,{children:i})]})}var nN=`cez-task-list-folds`,rN=`cez-task-list-folds-changed`;function iN(e,t,n=new Set){let[r,i]=(0,Z.useState)(()=>yx(nN));(0,Z.useEffect)(()=>{let e=e=>{e instanceof StorageEvent&&e.key!==null&&e.key!==`cez-task-list-folds`||i(e instanceof CustomEvent?e.detail:yx(nN))};return window.addEventListener(`storage`,e),window.addEventListener(rN,e),()=>{window.removeEventListener(`storage`,e),window.removeEventListener(rN,e)}},[]);let a=(0,Z.useCallback)(n=>JSON.stringify([e,t,n]),[e,t]),o=(0,Z.useCallback)(e=>{i(t=>{let n=e(t);return bx(n,nN),queueMicrotask(()=>window.dispatchEvent(new CustomEvent(rN,{detail:n}))),n})},[]),s=e=>r[a(e)]===!0;return{isFolded:s,isCollapsed:e=>s(e)&&!n.has(e),toggle:e=>o(t=>({...t,[a(e)]:t[a(e)]!==!0})),setAll:(e,t)=>o(n=>({...n,...Object.fromEntries(e.map(e=>[a(e),t]))})),only:(0,Z.useCallback)((e,t)=>o(n=>({...n,...Object.fromEntries(t.map(t=>[a(t),t!==e]))})),[o,a])}}function aN(e,t,n,r){let i=iN(e,t,n),a=(0,Z.useRef)(r);a.current=r;let[o,s]=Nk(),c=t===`active`?Fr(o.get(ai)):null,{only:l}=i;return(0,Z.useEffect)(()=>{c!==null&&(l(c,Or),a.current?.(),s(e=>(e.delete(ai),e)))},[c,l,s]),i}function oN(e){let t=e?.capabilities,n=t?.tokenMetrics!==!1;return{tokens:t?.tokenUsageMetrics??n,cost:t?.costMetrics??n}}function sN(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function cN(){let e=I(),t=Dn(),n=Z.useRef(0),r=Z.useRef(0),i=Z.useRef(Promise.resolve()),a=Z.useMemo(()=>mj(t.data?.taskTable?.expandedColumns),[t.data?.taskTable?.expandedColumns]),o=Z.useCallback(t=>{if(!dj.find(e=>e.id===t)?.canFold)return;let a=e.getQueryData(V.uiState);if(a===void 0)return;let o=sN(a?.taskTable),s={...o,expandedColumns:gj(o.expandedColumns,t)};e.setQueryData(V.uiState,{...a,taskTable:s});let c=++n.current;r.current=c;let l=i.current.then(async()=>{let t=await Je({taskTable:s},{keepalive:!0});c===r.current&&e.setQueryData(V.uiState,t)});i.current=l.catch(t=>{G(t instanceof Error?t.message:String(t),{tone:`danger`}),c===r.current&&e.invalidateQueries({queryKey:V.uiState})})},[e]);return{expandedColumns:a,isExpanded:Z.useCallback(e=>hj(e,a),[a]),toggleColumn:o,isPending:t.isPending}}var lN=()=>void 0;function uN({runs:e,view:t,onViewChange:n,onArchiveFinished:r,archivePending:i=!1,onMarkAllRead:a,onRename:o,onTogglePin:s,now:c=Date.now(),showTokens:l=!0,showCost:u=!0,expandedColumns:d=mj(void 0),onToggleColumn:f=()=>void 0,columnsPending:p=!1,projectName:m,error:h,onRetry:g,archivedPages:_,archivedTotal:v,onArchivedSearch:y,origin:b,onOriginChange:x,automations:S,urlQuery:C=``,onQueryChange:w,foldScope:T=`project`,automationName:E=lN}){let[D,O]=dN(C,w);Z.useEffect(()=>{y?.(D.trim())},[y,D]);let[A,j]=pN(b,x,S),[M,ee]=Z.useState(!1),te=ci(),{expandedRuns:ne,toggleExpandedRun:re}=uj(),ie=Z.useRef(null),N=Z.useMemo(()=>e??[],[e]),P=Z.useMemo(()=>mN({all:N,view:t,query:D,origin:A,archivedPages:_,archivedTotal:v,automationName:E}),[N,t,D,A,_,v,E]),{groups:F,needle:ae}=P,oe=Z.useMemo(()=>_j({tokens:l,cost:u}),[l,u]),se=aN(T,t,new Set(ae?F.map(e=>e.label):[]),()=>O(``)),ce=t===`archived`?void 0:s;return(0,Q.jsx)(pM,{runs:_?[...N,..._.runs]:N,onRename:o,children:(0,Q.jsxs)(wM,{layout:`${te}:${M}`,revision:F,visibilityRevision:JSON.stringify([Br.map(se.isCollapsed),[...ne].sort(),t,d]),"data-route":`tasks`,"data-presentation":M?`resources`:`summary`,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:[(0,Q.jsxs)(`header`,{ref:ie,className:`flex shrink-0 flex-col gap-[22px]`,children:[(0,Q.jsx)(fN,{projectName:m,detailedTable:M}),(0,Q.jsxs)(`div`,{className:`flex gap-6 border-b border-border`,children:[(0,Q.jsx)(EN,{view:`active`,current:t,onSelect:n,count:P.activeCount,children:`Active`}),(0,Q.jsx)(EN,{view:`archived`,current:t,onSelect:n,count:P.archivedCount,children:`Archived`})]}),(0,Q.jsxs)(`div`,{"data-slot":`tasks-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,Q.jsx)(gN,{view:t,unread:P.unread,finished:P.finished,archivePending:i,headerRef:ie,onMarkAllRead:()=>a(RM(A)),onArchiveFinished:()=>r(RM(A))}),(0,Q.jsxs)(`div`,{className:`relative order-first w-full md:w-auto md:min-w-64 md:flex-1`,children:[(0,Q.jsx)(Yi,{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,Q.jsx)(`input`,{type:`text`,value:D,onChange:e=>O(e.target.value),placeholder:`Search tasks or automations…`,"aria-label":`Search tasks`,className:`h-11 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,Q.jsx)(_N,{columns:oe,expandedColumns:d,columnsPending:p,onToggleColumn:f,detailedTable:M,onToggleDetailed:()=>ee(e=>!e)}),(0,Q.jsx)(k,{asChild:!0,"data-slot":`new-task-inline`,className:`min-h-11 inline-flex max-md:hidden`,children:(0,Q.jsxs)(Y,{to:`/new`,children:[(0,Q.jsx)(zi,{"aria-hidden":`true`}),`New task`]})})]}),(0,Q.jsx)(ZM,{origin:A,counts:P.originTotals,automations:S,onChange:j,labels:F.map(e=>e.label),onSetAll:se.setAll})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[e===void 0?(0,Q.jsx)(yN,{error:h,onRetry:g}):(0,Q.jsx)(vN,{view:t,query:D,origin:A,onShowAll:()=>{O(``),j(`all`)},caption:hN(P.visibleCount,P.incomplete,ae),captionOnPhones:ae!==``||P.incomplete,groups:F,folds:se,grouped:{desktop:te,expandedRuns:ne,toggleExpandedRun:re,detailedTable:M,columns:oe,expandedColumns:d,onToggleColumn:f,columnsPending:p,onRename:o,onTogglePin:ce,now:c,showTokens:l,showCost:u,automationName:E}}),t===`archived`&&_?(0,Q.jsx)(bN,{pages:_}):null]})]})})}function dN(e,t){let[n,r]=Z.useState(e),i=Z.useRef(e),a=Z.useRef(e),o=Z.useRef([]);return Z.useEffect(()=>{if(e===i.current)return;i.current=e;let t=o.current.indexOf(e);o.current=t===-1?[]:o.current.slice(t+1),t===-1&&e!==a.current&&r(e)},[e]),Z.useEffect(()=>{a.current=n.trim(),t?.(n,e=>{o.current.push(e)})},[t,n]),[n,r]}function fN({projectName:e,detailedTable:t}){return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`Project tasks`}),(0,Q.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[e?`${e} · `:``,t?`Every resource column shown. Fold columns without losing the saved view.`:`Review runs, pull requests and resource usage.`]})]})}function pN(e,t,n){let[r,i]=Z.useState(`all`);return[FM(e??r,n),t??i]}function mN({all:e,view:t,query:n,origin:r,archivedPages:i,archivedTotal:a,automationName:o}){let s=n.trim(),c=e=>e.automationId===void 0?``:o(e.automationId)??e.automationId,l=i?.query===s,u=new Set(l?i.runs.map(e=>e.id):[]),d=Nr(e,l||s===``?i?.runs??[]:[]).slice(e.length),f=pi(e,n,c),p=new Set(f.map(e=>e.id)),m=pi(e.filter(e=>u.has(e.id)&&!p.has(e.id)),``),h=e=>LM(e,r),g=UM([...f,...m,...pi(d,``)].filter(h),t,e),_=Nr(e,i?.query===``?i.runs:[]),v=Vr(e).archived>=200,y=e.filter(h);return{groups:g,needle:s,visibleCount:g.reduce((e,t)=>e+VM(t).length,0),originTotals:zM(_,t),activeCount:zM(e,`active`)[r],archivedCount:BM(e,_,r,i?.plainHasMore,a),incomplete:t===`archived`&&v&&i?.hasMore!==!1,finished:$r(y),unread:Fh(y)}}function hN(e,t,n){return`${e} ${e===1?`task`:`tasks`}${t?` loaded`:``}${n?` matching “${n}”`:``}`}function gN({view:e,unread:t,finished:n,archivePending:r,headerRef:i,onMarkAllRead:a,onArchiveFinished:o}){let s=Z.useRef(!1),[c,l]=Z.useState(!1),u=n>0||r;return Z.useEffect(()=>{let e=window.matchMedia?.(mi);if(!e)return;let t=()=>{e.matches&&l(!1)};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,Q.jsxs)(Q.Fragment,{children:[t>0?(0,Q.jsxs)(k,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`mark-all-read`,className:`hidden md:inline-flex`,onClick:a,children:[(0,Q.jsx)($l,{className:`size-3.5`,"aria-hidden":`true`}),`Mark all read`,` `,(0,Q.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:t})]}):null,e===`active`&&n>0?(0,Q.jsxs)(k,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`archive-finished`,className:`inline-flex`,disabled:r,"aria-busy":r,onClick:o,children:[(0,Q.jsx)(ba,{className:`size-3.5`,"aria-hidden":`true`}),`Archive finished`,` `,(0,Q.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:n})]}):null,e===`active`&&(u||t>0)?(0,Q.jsxs)(No,{open:c,onOpenChange:l,children:[(0,Q.jsx)(Ao,{asChild:!0,children:(0,Q.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`md:hidden`,"aria-label":`Task actions`,"aria-busy":r,children:(0,Q.jsx)(hu,{"aria-hidden":`true`})})}),(0,Q.jsxs)(jo,{align:`end`,className:`md:hidden`,onCloseAutoFocus:e=>{(s.current||window.matchMedia?.(`(min-width: 48rem)`).matches)&&(e.preventDefault(),s.current=!1,i.current?.querySelector(`[data-view="active"]`)?.focus())},children:[u?(0,Q.jsxs)(Eo,{disabled:r||n===0,onSelect:()=>{s.current=!0,o()},children:[(0,Q.jsx)(ba,{"aria-hidden":`true`}),r?`Archiving…`:`Archive finished (${n})`]}):null,t>0?(0,Q.jsxs)(Eo,{onSelect:a,children:[(0,Q.jsx)($l,{"aria-hidden":`true`}),`Mark all read (${t})`]}):null]})]}):null]})}function _N({columns:e,expandedColumns:t,columnsPending:n,onToggleColumn:r,detailedTable:i,onToggleDetailed:a}){return(0,Q.jsxs)(fi,{children:[(0,Q.jsx)(li,{asChild:!0,children:(0,Q.jsx)(k,{"data-slot":`task-columns-trigger`,variant:`outline`,className:`hidden min-h-11 md:inline-flex`,children:`Columns`})}),(0,Q.jsxs)(Qr,{align:`end`,className:`w-72`,children:[(0,Q.jsx)(`h2`,{className:`mb-2 text-base font-medium`,children:`Visible columns`}),(0,Q.jsx)(`p`,{className:`mb-4 text-xs text-muted-foreground`,children:`Status and Task · Always visible`}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:e.filter(e=>e.canFold).map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(`input`,{"data-column-toggle":e.id,type:`checkbox`,checked:hj(e.id,t),disabled:n,onChange:()=>r(e.id)}),e.id===`diff`?`Diff`:e.id===`reference`?`Reference`:e.id===`memory`?`Memory`:e.label]},e.id))}),(0,Q.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Saved automatically. Tokens and cost appear only when supported.`}),(0,Q.jsx)(k,{variant:`outline`,className:`mt-4`,onClick:a,children:i?`Summary view`:`Resource columns`})]})]})}function vN({view:e,query:t,origin:n,onShowAll:r,caption:i,captionOnPhones:a,groups:o,folds:s,grouped:c}){return o.length===0?(0,Q.jsx)(xN,{view:e,query:t,origin:n,onShowAll:r}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{"data-slot":`tasks-result-count`,className:C(`mb-3 text-[12px] text-muted-foreground tabular-nums`,!a&&`max-md:hidden`),children:i}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-[22px]`,children:o.map(t=>{let n=VM(t);return(0,Q.jsx)($M,{id:`tasks-group-${e}-${t.label.replaceAll(` `,`-`)}`,label:t.label,count:n.length,tone:HM(t.label,n),folded:s.isFolded(t.label),collapsed:s.isCollapsed(t.label),onToggle:()=>s.toggle(t.label),children:(0,Q.jsx)(wN,{group:t,...c})},t.label)})}),(0,Q.jsx)(`p`,{className:`mt-[22px] text-[11px] text-muted-foreground`,children:`Resource details—including tokens, cost, CPU and peak memory—are available when a task row is expanded.`})]})}function yN({error:e,onRetry:t}){return e?(0,Q.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-border bg-card p-6`,children:[(0,Q.jsx)(`h2`,{className:`text-lg`,children:`Could not load tasks`}),(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e}),(0,Q.jsx)(k,{variant:`outline`,className:`mt-4`,onClick:t,children:`Retry`})]}):(0,Q.jsx)(`div`,{role:`status`,"aria-label":`Loading tasks`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading tasks…`})}function bN({pages:e}){return e.failed?(0,Q.jsxs)(`p`,{role:`alert`,"data-slot":`archived-older-error`,className:`mt-3.5 flex items-center justify-center gap-2.5 text-[13px] text-muted-foreground`,children:[`Could not load older archived tasks.`,(0,Q.jsx)(k,{variant:`outline`,className:`min-h-11`,onClick:e.onLoadMore,children:`Retry`})]}):e.hasMore?(0,Q.jsx)(k,{"data-slot":`archived-older`,variant:`outline`,className:`mt-3.5 min-h-11 self-center`,disabled:e.loading,onClick:e.onLoadMore,children:e.loading?`Loading older archived…`:`Show older archived`}):null}function xN({view:e,query:t,origin:n=`all`,onShowAll:r}){let i=t.trim(),a=i||n!==`all`?`search-miss`:e===`archived`?`archive`:`no-tasks`;return(0,Q.jsx)(`div`,{"data-slot":`tasks-empty`,"data-empty-kind":a,className:`flex flex-1 flex-col`,children:a===`search-miss`?(0,Q.jsx)(X,{heading:`h2`,icon:(0,Q.jsx)(no,{}),tone:`neutral`,title:`No matching tasks`,subtitle:i?`No tasks match “${i}”.`:n===`automations`?`No automation started a task here.`:`No task here was started directly.`,actions:r?(0,Q.jsx)(k,{variant:`outline`,className:`min-h-11`,"data-action":`clear-task-filters`,onClick:r,children:`Show all tasks`}):void 0}):a===`archive`?(0,Q.jsx)(X,{heading:`h2`,icon:(0,Q.jsx)(ba,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here.`}):(0,Q.jsx)(X,{heading:`h2`,icon:(0,Q.jsx)(ju,{}),tone:`primary`,backdrop:!0,title:`No tasks yet`,subtitle:`Describe a task to get started.`,actions:(0,Q.jsx)(k,{asChild:!0,children:(0,Q.jsxs)(Y,{to:`/new`,"data-new-task-action":!0,children:[(0,Q.jsx)(zi,{"aria-hidden":`true`}),`New task`]})})})})}function SN({rows:e,onRename:t,onTogglePin:n,now:r,showTokens:i,showCost:a,automationName:o,expandedRuns:s,toggleExpandedRun:c}){let l=xj(e.map(({run:e})=>e.id),s);return(0,Q.jsx)(`div`,{"data-slot":`tasks-summary`,children:(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-5`,role:`table`,"aria-rowcount":l.rowCount,children:[(0,Q.jsx)(`div`,{role:`row`,"aria-rowindex":1,className:`task-summary-grid`,children:[`Task`,`Workflow`,`Changes`,`Pull request`,`Started`].map(e=>(0,Q.jsx)(`div`,{role:`columnheader`,className:`h-8 border-b border-border text-start text-[12px] font-medium uppercase text-muted-foreground`,children:e},e))}),(0,Q.jsx)(CM,{itemSize:103,items:e,itemKey:({run:e})=>e.id,children:({run:e,queuePosition:u},d)=>(0,Q.jsx)(CN,{run:e,queuePosition:u,rowIndex:l.indexes[d],onRename:t,onTogglePin:n,now:r,showTokens:i,showCost:a,automationName:o,open:s.has(e.id),toggleExpandedRun:c})})]})})}var CN=Z.memo(function({run:e,queuePosition:t,rowIndex:n,onRename:r,onTogglePin:i,now:a,showTokens:o,showCost:s,automationName:c,open:l,toggleExpandedRun:u}){let d=Ce(e),f=si(e),p=yi(e),m=`task-resources-${e.id}`;return(0,Q.jsxs)(`div`,{role:`rowgroup`,children:[(0,Q.jsxs)(`div`,{role:`row`,"aria-rowindex":n,"data-status":e.status,"data-slot":`task-summary-row`,"data-run-id":e.id,className:`task-summary-grid group/row`,children:[(0,Q.jsxs)(`div`,{role:`cell`,className:`py-5 pr-4 align-top`,children:[(0,Q.jsx)(FN,{run:e,to:`/tasks/${e.id}`,onRename:r,onTogglePin:i}),(0,Q.jsx)(`div`,{className:`mt-1`,children:(0,Q.jsx)(NN,{run:e,automationName:c})}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-task-control":`resources`,"aria-label":`${l?`Hide`:`Show`} resources for ${xi(e)}`,"aria-expanded":l,"aria-controls":m,"aria-describedby":`summary-status-${e.id}`,onClick:()=>u(e.id),className:`inline-flex min-h-[26px] items-center gap-1 rounded-md p-0 text-[11px] text-muted-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:(0,Q.jsxs)(MM,{id:`summary-status-${e.id}`,dot:d.tone,shape:d.shape,pulse:d.pulse,children:[d.label,f?` ${f.label}`:``]})}),e.status===`queued`&&t!==null?(0,Q.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`#`,t,` in queue`]}):null]})]}),(0,Q.jsx)(`div`,{role:`cell`,className:`truncate pr-3 text-xs text-muted-foreground`,title:vi(e),children:vi(e)}),(0,Q.jsx)(`div`,{role:`cell`,className:`pr-2 text-xs`,children:e.diffStat?(0,Q.jsx)(pb,{stat:e.diffStat}):(0,Q.jsx)(VN,{})}),(0,Q.jsx)(`div`,{role:`cell`,className:`pr-2`,children:p?(0,Q.jsx)(Kb,{run:e,reference:p,compact:!0}):(0,Q.jsx)(VN,{})}),(0,Q.jsx)(`div`,{role:`cell`,className:`text-xs text-muted-foreground`,children:Ga(e.startedAt??e.createdAt,a)})]}),l?(0,Q.jsx)(`div`,{role:`row`,"aria-rowindex":n+1,"data-run-id":e.id,children:(0,Q.jsx)(`div`,{role:`cell`,"aria-colspan":5,className:`border-b border-border pb-5`,children:(0,Q.jsxs)(`div`,{id:m,className:`flex flex-col gap-3`,children:[(0,Q.jsx)(tN,{runId:e.id,status:d.label,error:e.error,open:(0,Q.jsx)(k,{asChild:!0,variant:`outline`,className:`min-h-11`,children:(0,Q.jsxs)(Y,{"data-task-control":`open`,to:`/tasks/${e.id}`,children:[`Open task`,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`: `,xi(e)]})]})})}),(0,Q.jsx)(`div`,{className:`rounded-md bg-muted/50 p-4`,children:(0,Q.jsx)(TN,{run:e,showTokens:o,showCost:s})})]})})}):null]})});function wN({desktop:e,expandedRuns:t,toggleExpandedRun:n,group:r,detailedTable:i,columns:a,expandedColumns:o,onToggleColumn:s,columnsPending:c,onRename:l,onTogglePin:u,now:d,showTokens:f,showCost:p,automationName:m}){let h=r.rows.flatMap(e=>KM(e).map(t=>({run:t,queuePosition:t.status===`queued`?e.queuePosition:null})));return(0,Q.jsxs)(Q.Fragment,{children:[e&&!i?(0,Q.jsx)(SN,{expandedRuns:t,toggleExpandedRun:n,rows:h,onRename:l,onTogglePin:u,now:d,showTokens:f,showCost:p,automationName:m}):null,e&&i?(0,Q.jsx)(`div`,{"data-slot":`tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card`,children:(0,Q.jsx)(e_,{children:(0,Q.jsxs)(`div`,{role:`table`,"aria-rowcount":h.length+1,className:`task-resource-grid`,style:bj(a,o),children:[(0,Q.jsx)(`div`,{role:`row`,"aria-rowindex":1,className:`task-resource-row`,children:a.map(e=>(0,Q.jsx)(ON,{column:e,expanded:hj(e.id,o),onToggle:s,disabled:c},e.id))}),(0,Q.jsx)(CM,{itemSize:50,items:h,itemKey:({run:e})=>e.id,children:({run:e,queuePosition:t},n)=>(0,Q.jsx)(jN,{rowIndex:n+2,run:e,queuePosition:t,onRename:l,onTogglePin:u,now:d,columns:a,expandedColumns:o,automationName:m})})]})})}):null,e?null:(0,Q.jsx)(`div`,{"data-slot":`task-cards`,className:`flex flex-col rounded-lg border border-border bg-card p-5`,children:(0,Q.jsx)(CM,{itemSize:178,items:h,itemKey:({run:e})=>e.id,children:({run:e,queuePosition:r})=>(0,Q.jsx)(zN,{resourcesOpen:t.has(e.id),onToggleResources:n,run:e,queuePosition:r,now:d,showTokens:f,showCost:p,onTogglePin:u,automationName:m},e.id)})})]})}function TN({run:e,showTokens:t,showCost:n}){let r=Ar(e,Cl(e.id));return(0,Q.jsxs)(`dl`,{className:`grid grid-cols-2 gap-4 text-xs md:grid-cols-4`,children:[t?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Tokens in / out`}),(0,Q.jsx)(`dd`,{className:`mt-1`,children:(0,Q.jsx)(jM,{inputTokens:e.inputTokens,outputTokens:e.outputTokens,omitWhenUnknown:!1})})]}):null,n?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Cost`}),(0,Q.jsx)(`dd`,{className:`mt-1`,children:oi(e.costUsd)||`—`})]}):null,(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`CPU`}),(0,Q.jsx)(`dd`,{className:`mt-1`,title:r.cpu.title,children:r.cpu.text||`—`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Memory`}),(0,Q.jsx)(`dd`,{className:`mt-1`,title:r.mem.title,children:r.mem.text||`—`})]}),e.branch?(0,Q.jsxs)(`div`,{className:`col-span-2`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Branch`}),(0,Q.jsx)(`dd`,{className:`mt-1 break-all`,children:e.branch})]}):null]})}function EN({view:e,current:t,onSelect:n,count:r,children:i}){let a=e===t;return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":a,onClick:()=>n(e),className:C(`flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground`,a&&`border-accent-strong font-semibold text-accent-text`),children:[i,r===0?null:(0,Q.jsxs)(`span`,{className:`tabular-nums`,children:[` · `,r]})]})}function DN({children:e,right:t=!1,columnId:n,folded:r=!1}){return(0,Q.jsx)(`div`,{role:`columnheader`,"data-column-id":n,"data-folded":r||void 0,className:C(`h-[38px] border-b border-border px-2.5 text-left text-[11px] font-semibold tracking-[0.05em] whitespace-nowrap text-supporting-foreground uppercase first:pl-4 last:pr-4`,t&&`text-right`,r&&`px-0 first:pl-0 last:pr-0`),children:e})}function ON({column:e,expanded:t,onToggle:n,disabled:r}){if(!e.canFold)return(0,Q.jsx)(DN,{columnId:e.id,right:e.align===`right`,children:e.label});let i=t?`Fold`:`Expand`;return(0,Q.jsx)(DN,{columnId:e.id,right:e.align===`right`,folded:!t,children:(0,Q.jsxs)(t_,{children:[(0,Q.jsx)(n_,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`${i} ${e.label} column`,"aria-pressed":t,disabled:r,onClick:()=>n(e.id),className:C(`inline-flex h-8 w-full items-center gap-1 rounded-sm px-0.5 text-inherit outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-wait disabled:opacity-60`,e.align===`right`?`justify-end`:`justify-start`,!t&&`justify-center px-0`),children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{children:e.label}),(0,Q.jsx)(iu,{className:`size-3 opacity-55`,"aria-hidden":`true`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(kN,{icon:e.icon}),(0,Q.jsx)(au,{className:`size-3 opacity-70`,"aria-hidden":`true`})]})})}),(0,Q.jsxs)(r_,{side:`top`,children:[e.label,` · `,i,` column`]})]})})}function kN({icon:e}){let t=`size-3.5`;switch(e){case`workflow`:return(0,Q.jsx)(Ca,{className:t,"aria-hidden":`true`});case`branch`:return(0,Q.jsx)(ji,{className:t,"aria-hidden":`true`});case`diff`:return(0,Q.jsx)(Ni,{className:t,"aria-hidden":`true`});case`reference`:return(0,Q.jsx)(Au,{className:t,"aria-hidden":`true`});case`tokens`:return(0,Q.jsx)(cu,{className:t,"aria-hidden":`true`});case`cost`:return(0,Q.jsx)(mu,{className:t,"aria-hidden":`true`});case`cpu`:return(0,Q.jsx)(Ea,{className:t,"aria-hidden":`true`});case`memory`:return(0,Q.jsx)(Mu,{className:t,"aria-hidden":`true`});case`started`:return(0,Q.jsx)(ou,{className:t,"aria-hidden":`true`});default:return null}}var AN=`h-[88px] border-b border-border px-2.5 whitespace-nowrap first:pl-4 last:pr-4`,jN=Z.memo(function({rowIndex:e,run:t,queuePosition:n,onRename:r,onTogglePin:i,now:a,columns:o,expandedColumns:s,automationName:c}){let l=gs(),u=Ce(t),d=si(t),f=`/tasks/${t.id}`,p=oi(t.costUsd),m=yi(t);return(0,Q.jsx)(`div`,{role:`row`,"aria-rowindex":e,"data-slot":`task-table-row`,"data-run-id":t.id,onClick:e=>{e.target.closest(`a, button, input`)||l(f)},className:`task-resource-row group/row cursor-pointer hover:bg-muted`,children:o.map(e=>{if(e.id===`memory`)return null;if(e.id===`cpu`){let r=hj(`cpu`,s),i=hj(`memory`,s);return n!==null&&(r||i)?(0,Q.jsxs)(`div`,{role:`cell`,"data-slot":`queue-note`,"data-column-id":`cpu-memory`,"aria-colspan":2,style:{gridColumn:`span 2`},className:C(AN,`text-right font-mono text-[11px] text-supporting-foreground`),children:[`#`,n,` in queue`]},e.id):(0,Q.jsx)(IN,{run:t,cpuExpanded:r,memoryExpanded:i},e.id)}return(0,Q.jsx)(MN,{column:e,expanded:hj(e.id,s),run:t,attention:u,scheduled:d,reference:m,cost:p,to:f,onRename:r,onTogglePin:i,now:a,automationName:c},e.id)})})});function MN({column:e,expanded:t,run:n,attention:r,scheduled:i,reference:a,cost:o,to:s,onRename:c,onTogglePin:l,now:u,automationName:d}){if(!t)return(0,Q.jsx)(PN,{column:e.id});switch(e.id){case`status`:return(0,Q.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`overflow-hidden`),children:(0,Q.jsx)(MM,{dot:r.tone,shape:r.shape,pulse:r.pulse,title:i?.title??r.label,className:`w-full max-w-full overflow-hidden`,children:(0,Q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[r.label,i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:i.label})]}):null]})})});case`task`:return(0,Q.jsxs)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`min-w-[320px] max-w-0 whitespace-normal`),children:[(0,Q.jsx)(FN,{run:n,to:s,onRename:c,onTogglePin:l}),(0,Q.jsx)(`div`,{className:`mt-1`,children:(0,Q.jsx)(NN,{run:n,automationName:d})})]});case`workflow`:return(0,Q.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`max-w-0 truncate text-[13px] text-muted-foreground`),children:vi(n)});case`branch`:return(0,Q.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`max-w-0 overflow-hidden`),children:n.branch?(0,Q.jsx)(HN,{branch:n.branch}):(0,Q.jsx)(VN,{})});case`diff`:return(0,Q.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`overflow-hidden`),children:n.diffStat?(0,Q.jsx)(pb,{stat:n.diffStat,compact:!0,className:`block max-w-full`}):(0,Q.jsx)(VN,{})});case`reference`:return(0,Q.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`overflow-hidden`),children:a?(0,Q.jsx)(Kb,{run:n,reference:a,compact:!0,className:`max-w-full overflow-hidden`}):(0,Q.jsx)(VN,{})});case`tokens`:let t=kM(n.inputTokens,n.outputTokens);return(0,Q.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`text-right text-xs text-muted-foreground`),children:(0,Q.jsx)(jM,{inputTokens:n.inputTokens,outputTokens:n.outputTokens,variant:`table`,omitWhenUnknown:!1,title:t,className:`block max-w-full overflow-hidden text-ellipsis`})});case`cost`:return(0,Q.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`text-right font-mono text-xs text-muted-foreground tabular-nums`),children:o?(0,Q.jsx)(RN,{text:o,accessibleText:`$${n.costUsd}`}):(0,Q.jsx)(VN,{})});case`started`:return(0,Q.jsx)(`div`,{role:`cell`,"data-column-id":e.id,className:C(AN,`text-right text-xs text-supporting-foreground tabular-nums`),children:Ga(n.startedAt??n.createdAt,u)});default:return null}}function NN({run:e,automationName:t}){return(0,Q.jsx)(eN,{automationId:e.automationId,automationName:e.automationId===void 0?void 0:t(e.automationId)})}function PN({column:e}){return(0,Q.jsx)(`div`,{role:`cell`,"aria-hidden":`true`,"data-column-id":e,"data-folded":`true`,className:C(AN,`px-0 first:pl-0 last:pr-0`)})}function FN({run:e,to:t,onTogglePin:n}){let r=xi(e),i=mM(e),a=Zr(e),o=Ph(e);return i.editing?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-slot":`table-title-editor`,children:[(0,Q.jsx)(lM,{editor:i,className:`basis-full text-[13px] font-medium`}),(0,Q.jsx)(k,{size:`sm`,"aria-label":`Save title`,onMouseDown:e=>e.preventDefault(),onClick:i.commit,children:`Save`}),(0,Q.jsx)(k,{size:`sm`,variant:`outline`,"aria-label":`Cancel rename`,onMouseDown:e=>e.preventDefault(),onClick:i.cancel,children:`Cancel`})]}):(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[e.delegation?.role===`worker`?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,Q.jsx)(Y,{"data-task-control":`title`,to:t,title:r,className:C(`line-clamp-2 min-w-0 flex-1 whitespace-normal rounded-sm text-[13px] leading-[18px] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,a?`font-semibold text-foreground`:o?`font-normal text-foreground`:`font-medium`),children:r}),a?(0,Q.jsx)($,{tone:Ih(e),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null,(0,Q.jsx)(`button`,{type:`button`,"data-slot":`row-rename`,"aria-label":`Rename task`,onClick:i.begin,className:`shrink-0 rounded-sm p-0.5 text-soft-foreground opacity-0 transition-opacity group-hover/row:opacity-100 hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Q.jsx)(Ru,{className:`size-3`,"aria-hidden":`true`})}),n?(0,Q.jsx)(Xb,{pinned:!!e.pinned,onToggle:t=>n(e,t),className:`size-[19px] opacity-0 group-hover/row:opacity-100 focus-visible:opacity-100 no-hover:opacity-100 data-[pinned=true]:opacity-100`}):null]})}function IN({run:e,cpuExpanded:t,memoryExpanded:n}){let r=Ar(e,Cl(e.id));return(0,Q.jsxs)(Q.Fragment,{children:[t?(0,Q.jsx)(LN,{column:`cpu`,cell:r.cpu}):(0,Q.jsx)(PN,{column:`cpu`}),n?(0,Q.jsx)(LN,{column:`memory`,cell:r.mem}):(0,Q.jsx)(PN,{column:`memory`})]})}function LN({column:e,cell:t}){let n=t.text&&t.title?`${t.text}; ${t.title}`:t.text;return(0,Q.jsx)(`div`,{role:`cell`,"data-usage":e===`memory`?`mem`:e,"data-column-id":e,"data-usage-kind":t.kind,className:C(AN,`overflow-hidden`,`text-right font-mono tabular-nums`,t.kind===`live`&&`bg-accent-strong/5 text-xs font-medium text-foreground`,t.kind===`peak`&&`text-[11px] text-supporting-foreground`,t.kind===`none`&&`text-xs text-soft-foreground`),children:(0,Q.jsx)(RN,{text:t.text||`—`,accessibleText:n||void 0})})}function RN({text:e,accessibleText:t}){return(0,Q.jsx)(`span`,{"data-slot":`bounded-metric`,...t?{"aria-label":t,title:t}:{},className:`block max-w-full overflow-hidden text-ellipsis`,children:e})}var zN=Z.memo(function({resourcesOpen:e,onToggleResources:t,run:n,queuePosition:r,now:i,showTokens:a,showCost:o,onTogglePin:s,automationName:c}){let l=gs(),u=Ce(n),d=si(n),f=`/tasks/${n.id}`,p=yi(n),m=Zr(n),h=Ph(n);return(0,Q.jsxs)(`div`,{"data-slot":`task-card`,"data-status":n.status,"data-run-id":n.id,onClick:e=>{e.target.closest(`a, button`)||l(f)},className:`cursor-pointer border-b border-border py-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start gap-2.5`,children:[(0,Q.jsx)(`button`,{"data-slot":`mobile-resources-toggle`,"data-task-control":`resources`,type:`button`,"aria-controls":`mobile-resources-${n.id}`,"aria-describedby":`mobile-status-${n.id}`,"aria-label":e?`Hide resources`:`Show resources`,title:e?`Hide resources`:`Show resources`,"aria-expanded":e,onClick:()=>t(n.id),children:(0,Q.jsxs)(MM,{id:`mobile-status-${n.id}`,dot:u.tone,shape:u.shape,pulse:u.pulse,className:`mt-px shrink-0`,title:d?.title,children:[u.label,d?(0,Q.jsx)(`span`,{className:`tabular-nums`,children:d.label}):null]})}),(0,Q.jsxs)(Y,{"data-task-control":`title`,to:f,className:C(`order-first w-full min-w-0 rounded-sm text-[14px] leading-[1.35] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,m?`font-semibold text-foreground`:h?`font-normal text-foreground`:`font-medium`),children:[n.delegation?.role===`worker`?(0,Q.jsx)(`span`,{className:`mr-2 text-xs text-muted-foreground`,children:`Worker`}):null,xi(n)]}),m?(0,Q.jsx)($,{tone:Ih(n),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`mt-1.5 shrink-0`}):null,(0,Q.jsx)(`div`,{className:`order-first w-full`,children:(0,Q.jsx)(NN,{run:n,automationName:c})}),s?(0,Q.jsx)(Xb,{pinned:!!n.pinned,onToggle:e=>s(n,e),className:`mt-px`}):null]}),(0,Q.jsxs)(`div`,{"data-slot":`mobile-task-meta`,className:`mt-4 grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-3 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:vi(n)}),r===null?n.diffStat?(0,Q.jsx)(pb,{stat:n.diffStat}):(0,Q.jsx)(VN,{}):(0,Q.jsxs)(`span`,{"data-slot":`queue-note`,children:[`#`,r,` in queue`]}),(0,Q.jsx)(`span`,{children:Ga(n.startedAt??n.createdAt,i)})]}),p?(0,Q.jsx)(`div`,{className:`mt-3`,children:(0,Q.jsx)(Kb,{run:n,reference:p})}):null,e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`mt-3`,children:(0,Q.jsx)(tN,{runId:n.id,status:u.label,error:n.error,open:(0,Q.jsx)(k,{asChild:!0,variant:`outline`,className:`min-h-11`,children:(0,Q.jsxs)(Y,{"data-task-control":`open`,to:f,children:[`Open task`,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`: `,xi(n)]})]})})})}),(0,Q.jsx)(BN,{run:n,showTokens:a,showCost:o})]}):null]})});function BN({run:e,showTokens:t,showCost:n}){let r=Ar(e,Cl(e.id));return(0,Q.jsxs)(`dl`,{id:`mobile-resources-${e.id}`,className:`mt-3 grid grid-cols-2 gap-3 rounded-md bg-muted p-3 text-xs`,children:[e.branch?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:`Branch`}),(0,Q.jsx)(`dd`,{children:e.branch})]}):null,(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:`CPU`}),(0,Q.jsx)(`dd`,{children:r.cpu.text||`—`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:`Memory`}),(0,Q.jsx)(`dd`,{children:r.mem.text||`—`})]}),t?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:`IN / OUT`}),(0,Q.jsx)(`dd`,{children:(0,Q.jsx)(jM,{inputTokens:e.inputTokens,outputTokens:e.outputTokens})})]}):null,n?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:`Cost`}),(0,Q.jsx)(`dd`,{children:oi(e.costUsd)||`—`})]}):null]})}function VN(){return(0,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}function HN({branch:e}){return(0,Q.jsx)(`span`,{title:e,className:`block truncate rounded-[6px] bg-muted px-1.5 py-0.5 font-mono text-[11px] font-medium text-muted-foreground`,children:e})}function UN(){let e=xr(),t=oN(En().data),n=Av(),{view:r,setView:i,origin:a,setOrigin:o,urlQuery:s,writeQuery:c}=GN(),l=Rn(),u=I(),d=JN(e.data,r),f=H({mutationFn:e=>Ct(fr(),void 0,e),onSuccess:()=>l.invalidateAfter(`runs`,()=>fr()),onError:e=>G(e.message,{tone:`danger`})}),p=H({mutationFn:e=>De(e),onSuccess:()=>u.invalidateQueries({queryKey:U.runs.all}),onError:e=>G(e.message,{tone:`danger`})}),m=H({mutationFn:({id:e,title:t})=>Ue(e,{title:t}),onSuccess:()=>u.invalidateQueries({queryKey:U.runs.all}),onError:e=>G(e.message,{tone:`danger`})}),h=Sr(),g=hx(3e4),_=cN(),v=Mn(),y=Ln(void 0,{retryOnMount:!1}),b=bn({retryOnMount:!1}).data?.projects?.find(e=>e.id===v)?.name,x=[...e.data??[],...d.pages?.runs??[]].some(e=>e.automationId!==void 0),S=Yn([void 0],n&&x),C=Z.useCallback(e=>S(void 0,e),[S]),w=Z.useMemo(()=>v===void 0?[]:(e.data??[]).flatMap(e=>{let t=yi(e);return t?[{projectId:v,kind:t.kind,number:t.number}]:[]}),[e.data,v]),T=Z.useCallback((e,t)=>m.mutate({id:e,title:t}),[m.mutate]),E=Z.useCallback((e,t)=>h.mutate({id:e.id,pinned:t}),[h.mutate]);return(0,Q.jsx)(Za,{projectId:v,repoBase:y,requests:w,children:(0,Q.jsx)(uN,{runs:e.data,projectName:b,error:e.error?.message,onRetry:()=>void e.refetch(),view:r,onViewChange:i,origin:a,onOriginChange:o,automations:n,urlQuery:s,onQueryChange:c,foldScope:`project:${v??`default`}`,automationName:C,onArchiveFinished:e=>{f.isPending||f.mutate(e)},archivePending:f.isPending,onMarkAllRead:e=>p.mutate(e),onRename:T,onTogglePin:E,now:g,showTokens:t.tokens,showCost:t.cost,expandedColumns:_.expandedColumns,onToggleColumn:_.toggleColumn,columnsPending:_.isPending,archivedPages:d.pages,archivedTotal:d.total,onArchivedSearch:d.search})})}function WN(e,t){return n=>(t===null?n.delete(e):n.set(e,t),n)}function GN(){let[e,t]=Nk(),n=e.get(`archived`)===`1`?`archived`:`active`,r=IM(e.get(`origin`)),[i,a]=Z.useState(n),[o,s]=Z.useState(r);Z.useEffect(()=>a(n),[n]),Z.useEffect(()=>s(r),[r]);let c=e.get(`q`)??``,l=Z.useRef(void 0);return Z.useEffect(()=>{let e=l;return()=>clearTimeout(e.current)},[]),{view:i,setView:e=>{a(e),t(WN(`archived`,e===`archived`?`1`:null))},origin:o,setOrigin:e=>{s(e),t(WN(`origin`,e===`all`?null:e))},urlQuery:c,writeQuery:Z.useCallback((e,n)=>{clearTimeout(l.current);let r=e.trim();l.current=setTimeout(()=>t(e=>{let t=e.get(`q`),i=WN(`q`,r===``?null:r)(e);return i.get(`q`)!==t&&n(r),i}),KN)},[t])}}var KN=250,qN=150;function JN(e,t){Rn();let n=I(),[r,i]=Z.useState(``),[a,o]=Z.useState(``);Z.useEffect(()=>{let e=setTimeout(()=>o(r),qN);return()=>clearTimeout(e)},[r]);let s=e!==void 0&&Vr(e).archived>=200,{data:c,isError:l,isPlaceholderData:u,hasNextPage:d,isFetchingNextPage:f,fetchNextPage:p,refetch:m}=hr(a,t===`archived`&&(a!==``||s)),h=c?.pages,g=Z.useMemo(()=>h||l?{runs:(h??[]).flatMap(e=>e.runs),query:u?null:a,hasMore:d,loading:f,onLoadMore:()=>void(h?p():m()),failed:l}:void 0,[h,l,u,a,d,f,p,m]),_=a===``?h:n.getQueryData(U.runs.archived(``))?.pages,v=_===void 0?void 0:_.at(-1)?.nextCursor!=null;return{pages:Z.useMemo(()=>g&&{...g,plainHasMore:v},[g,v]),total:_?.[0]?.total,search:i}}function YN({projects:e,perProjectLimit:t}){return e.length===0?null:(0,Q.jsxs)(`p`,{"data-slot":`global-tasks-truncated`,className:`text-[11px] text-soft-foreground`,children:[`Showing every active task and the newest `,t,` archived tasks per project — older archived tasks in`,` `,e.join(`, `),` are in that project’s own Tasks page.`]})}function XN({registry:e}){return e.length<=1?null:(0,Q.jsxs)(`section`,{"data-slot":`other-projects`,className:`rounded-lg border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-base font-semibold`,children:`Other projects`}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-col divide-y divide-border`,children:e.map(e=>(0,Q.jsxs)(`div`,{className:`flex min-h-14 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-[13px]`,children:e.name}),(0,Q.jsxs)(E,{to:hs(e.id,`/`),className:`inline-flex min-h-11 shrink-0 items-center rounded-md px-3 text-xs text-accent-text hover:bg-accent-strong/10`,children:[`View tasks`,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[` for `,e.name]})]})]},e.id))})]})}function ZN({view:e,filtered:t}){return t?(0,Q.jsx)(X,{heading:`h2`,icon:(0,Q.jsx)(no,{}),tone:`neutral`,title:`No matching tasks`,subtitle:`No task in any project matches these filters.`}):e===`archived`?(0,Q.jsx)(X,{heading:`h2`,icon:(0,Q.jsx)(ba,{}),tone:`neutral`,title:`Nothing archived yet`,subtitle:`Finished tasks you archive land here, from every project.`}):(0,Q.jsx)(X,{heading:`h2`,icon:(0,Q.jsx)(ju,{}),tone:`neutral`,title:`No tasks yet`,subtitle:`Start a task in any project and it shows up here.`})}function QN({groupBy:e,filterDetailsOpen:t,message:n,onRetry:r}){return(0,Q.jsx)(`div`,{"data-route":`global-tasks`,"data-presentation":e===`none`?`summary`:`cards`,"data-filter-details":t,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:(0,Q.jsx)(X,{icon:(0,Q.jsx)(Da,{}),tone:`danger`,title:`Tasks across projects did not load`,subtitle:n,actions:(0,Q.jsx)(k,{variant:`outline`,onClick:r,children:`Retry`})})})}function $N({slot:e,label:t,options:n,selected:r,onToggle:i,onClear:a,searchPlaceholder:o,emptyLabel:s=`Nothing to filter by`}){let[c,l]=Z.useState(!1),u=r.length>0,d=r.length===1?n.find(e=>e.value===r[0])?.label??r[0]:`${r.length} selected`;return(0,Q.jsxs)(fi,{open:c,onOpenChange:l,children:[(0,Q.jsx)(li,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`facet-${e}`,"data-active":u?`true`:void 0,"aria-label":`Filter by ${t.toLowerCase()}`,className:C(`inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,u&&`border-accent-strong/40 bg-accent-strong/10 text-foreground`),children:[(0,Q.jsx)(`span`,{className:C(u&&`text-soft-foreground`),children:t}),u?(0,Q.jsx)(`span`,{className:`max-w-[140px] truncate font-semibold`,children:d}):null,(0,Q.jsx)(nu,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Q.jsxs)(Qr,{align:`start`,className:`w-64 p-0`,"data-testid":`facet-${e}-menu`,children:[(0,Q.jsxs)(Gs,{children:[(0,Q.jsx)(js,{placeholder:o??`Search ${t.toLowerCase()}…`}),(0,Q.jsxs)(Os,{children:[(0,Q.jsx)(Ws,{children:s}),(0,Q.jsx)(As,{children:n.map(e=>{let t=r.includes(e.value);return(0,Q.jsxs)(Ns,{value:e.label,onSelect:()=>i(e.value),"data-slot":`facet-option`,"data-value":e.value,"aria-checked":t,role:`option`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:C(`flex size-4 shrink-0 items-center justify-center rounded-[4px] border`,t?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-input`),children:t?(0,Q.jsx)(eu,{className:`size-3`}):null}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.count===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:e.count})]},e.value)})})]})]}),u?(0,Q.jsx)(`div`,{className:`border-t border-border p-1`,children:(0,Q.jsxs)(`button`,{type:`button`,"data-action":`facet-${e}-clear`,onClick:()=>a(),className:`w-full rounded-sm px-2 py-1.5 text-left text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[`Clear `,t.toLowerCase()]})}):null]})]})}function eP({label:e,count:t,selected:n,onToggle:r,slot:i,tone:a=`neutral`}){return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":i,"data-selected":n?`true`:void 0,"aria-pressed":n,onClick:r,className:C(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-xs font-medium transition-colors`,a===`tag`?`border-accent-strong/25 bg-accent-strong/10 text-accent-text hover:bg-accent-strong/20`:`border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground`,n&&`border-accent-strong bg-accent-strong text-accent-strong-foreground hover:bg-accent-strong`),children:[e,t===void 0?null:(0,Q.jsx)(`span`,{className:C(`font-mono text-[11px] tabular-nums`,!n&&`text-soft-foreground`),children:t})]})}function tP({slot:e,label:t,value:n,options:r,onChange:i,size:a=`compact`}){return(0,Q.jsx)(`div`,{"data-slot":e,role:`group`,"aria-label":t,className:`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,children:r.map(e=>{let t=e.value===n;return(0,Q.jsx)(`button`,{type:`button`,"data-value":e.value,"aria-pressed":t,disabled:e.disabled,title:e.title,onClick:()=>i(e.value),className:C(`flex h-6 items-center justify-center rounded-[6px] px-2.5 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,a===`touch`&&`h-11 px-4 text-[13px]`,t&&`bg-card font-semibold text-foreground shadow-xs`),children:e.label},e.value)})})}var nP=` untagged`,rP=[{value:`project`,label:`Project`},{value:`tag`,label:`Tag`},{value:`status`,label:`Status`},{value:`workflow`,label:`Workflow`}];function iP(e,t){return e===t?`none`:t}var aP={query:``,tags:[],statuses:[],workflows:[]};function oP(e,t){let{origin:n,...r}=e;return t===`all`?r:{...r,origin:t}}function sP(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}function cP(e){return(e.projects?.length??0)+e.tags.length+e.statuses.length+e.workflows.length+(e.origin===void 0||e.origin===`all`?0:1)}function lP(e){return e.query.trim()!==``||cP(e)>0}function uP(e){return cP(e.filters)+(e.filters.query.trim()===``?0:1)+(e.groupBy===`none`?0:1)}function dP(e){return uP(e)>0}function fP(e,t){let n=new Map(t.map(e=>[e.id,e]));return e.filter(e=>!zr(e)).map(e=>{let t=n.get(e.projectId);return{run:e,project:t,projectName:t?.name||e.projectId,tags:t?.tags??[]}})}function pP(e){let t=new Set;for(let n of e)t.add(n.run.workflow);return[...t].sort((e,t)=>e.localeCompare(t))}function mP(e){let t=new Set;for(let n of e)t.add(n.run.status);return[...t].sort((e,t)=>e.localeCompare(t))}function hP(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 gP=e=>e.tags.length===0?[nP]:e.tags,_P=(e,t)=>e.length===0||t.some(t=>e.includes(t)),vP=(e,t)=>{if(t.length===0)return!0;let n=gP(e).map(e=>e.toLowerCase());return t.some(e=>n.includes(e.toLowerCase()))};function yP(e,t){return{displayTitle:xi(e.run),projectName:e.projectName,tags:e.tags,automation:e.run.automationId===void 0?void 0:t(e)??e.run.automationId,references:()=>ni(e.run)}}function bP(e,t,n,r=()=>void 0){let i=t.query.trim()!==``;return e.filter(e=>(n===`archived`?!e.run.archived:e.run.archived)||!LM(e.run,t.origin??`all`)||!_P(t.projects??[],[e.run.projectId])||!_P(t.statuses,[e.run.status])||!_P(t.workflows,[e.run.workflow])||!vP(e,t.tags)?!1:!i||Gr(e.run,t.query,{scope:`shown`,extras:yP(e,r)}))}function xP(e,t,n,r,i){return bP(e,r===`origin`?{...t,origin:`all`}:{...t,[r]:[]},n,i)}function SP(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(nP,`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 CP(e,t){let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>n.get(e)||e)}var wP={query:`q`,project:`project`,tag:`tag`,untagged:`untagged`,status:`status`,workflow:`workflow`,groupBy:`group`,archived:`archived`,origin:`origin`},TP=new Set(rP.map(e=>e.value));function EP(e){let t=new URLSearchParams,n=e.filters.query.trim();n!==``&&t.set(wP.query,n);for(let n of e.filters.tags)n===` untagged`?t.set(wP.untagged,`1`):t.append(wP.tag,n);for(let n of e.filters.projects??[])t.append(wP.project,n);for(let n of e.filters.statuses)t.append(wP.status,n);for(let n of e.filters.workflows)t.append(wP.workflow,n);return e.groupBy!==`none`&&t.set(wP.groupBy,e.groupBy),e.view===`archived`&&t.set(wP.archived,`1`),e.filters.origin!==void 0&&e.filters.origin!==`all`&&t.set(wP.origin,e.filters.origin),t}function DP(e,t){let n=e.getAll(wP.tag).filter(e=>e!==``);e.get(wP.untagged)===`1`&&n.push(nP);let r=e.get(wP.groupBy)??``,i=FM(IM(e.get(wP.origin)),t);return{filters:{query:e.get(wP.query)??``,...e.has(wP.project)?{projects:e.getAll(wP.project).filter(Boolean)}:{},tags:n,statuses:e.getAll(wP.status).filter(e=>e!==``),workflows:e.getAll(wP.workflow).filter(e=>e!==``),...i===`all`?{}:{origin:i}},groupBy:TP.has(r)?r:`none`,view:e.get(wP.archived)===`1`?`archived`:`active`}}var OP=15e3,kP=250,AP=1,jP=new Set([`done`,`failed`,`cancelled`]);function MP(){return PP({request:({task:e,archived:t})=>Nt(xn(e.run.id,{projectId:e.run.projectId}),t),patch:({archived:e})=>t=>({...t,archived:e})})}function NP(){return PP({request:({task:e,read:t})=>vt(xn(e.run.id,{projectId:e.run.projectId}),t),patch:({read:e})=>t=>{if(e)return{...t,seenAt:new Date().toISOString()};let{seenAt:n,...r}=t;return r}})}function PP({request:e,patch:t}){let n=Rn();return H({mutationFn:e,onMutate:e=>n.patchIndex(xn(e.task.run.id,{projectId:e.task.run.projectId}),()=>t(e)),onError:(e,t,n)=>{n?.rollback(),G(e.message,{tone:`danger`})},onSettled:(e,t,{task:r},i)=>{i?i.settle():n.invalidateAfter(`indexed`,xn(r.run.id,{projectId:r.run.projectId}))}})}function FP(){let{expandedRuns:e,toggleExpandedRun:t}=uj(),n=bn(),r=oN(En().data),i=Jn(!0,OP),[a,o]=Nk(),s=Av(),{filters:c,groupBy:l,view:u}=Z.useMemo(()=>DP(a,s),[a,s]),d=hx(3e4),f=e=>o(t=>{let n=EP(e(DP(t,!0))),r=t.get(`tasks`);return(r===`flat`||r===`virtual`)&&n.set(`tasks`,r),n}),p=e=>f(t=>({...t,filters:e(t.filters)})),m=e=>f(t=>({...t,groupBy:e})),h=e=>f(t=>({...t,view:e})),[g,_]=Z.useState(l!==`none`||c.tags.length>0),[v,y]=RP(c.query,e=>p(t=>({...t,query:e}))),b=i.data?.referenceStatuses;Z.useEffect(()=>{b&&or(b)},[b]);let x=Z.useMemo(()=>n.data?.projects??[],[n.data]),S=Z.useMemo(()=>i.data?.runs??[],[i.data]),C=Z.useMemo(()=>fP(S,x),[S,x]),{nameOf:w,visible:T,originTotals:D,statusGroups:O,folds:A}=zP({tasks:C,filters:c,view:u,groupBy:l,index:S,automationsOn:s}),j=Z.useMemo(()=>SP(T,l),[T,l]),M=c.origin??`all`,ee=e=>p(t=>oP(t,e)),te=Z.useMemo(()=>T.flatMap(e=>Wr(e.run,e.project?.repoUrl).filter(t=>ei(t,e.project?.repoUrl)).map(t=>({projectId:e.run.projectId,kind:t.kind,number:t.number}))),[T]),ne=CP(i.data?.truncated??[],x),re=(e,t)=>p(n=>({...n,[e]:sP(n[e]??[],t)})),ie=e=>p(t=>({...t,[e]:[]})),N=MP(),P=NP(),F=Z.useCallback((e,t)=>N.mutate({task:e,archived:t}),[N.mutate]),ae=Z.useCallback((e,t)=>P.mutate({task:e,read:t}),[P.mutate]),oe=i.error??n.error;if(oe)return(0,Q.jsx)(QN,{groupBy:l,filterDetailsOpen:g,message:oe.message,onRetry:()=>{i.refetch(),n.refetch()}});let se=(0,Q.jsxs)(`div`,{className:`relative w-full`,children:[(0,Q.jsx)(Yi,{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,Q.jsx)(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`Search every project…`,"aria-label":`Search tasks across projects`,className:`h-11 w-full rounded-md border border-input bg-card pr-3 pl-8 text-[13px] text-foreground outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]});return(0,Q.jsxs)(wM,{layout:l,revision:j,visibilityRevision:JSON.stringify([Br.map(A.isCollapsed),[...e].sort(),u,g]),"data-route":`global-tasks`,"data-presentation":l===`none`?`summary`:`cards`,"data-filter-details":g,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-[22px]`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`h1`,{className:`text-[30px] font-semibold tracking-tight`,children:`All tasks`}),(0,Q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:l===`none`?`Every project. One place to review what your agents have shipped.`:`Filter across projects and act on each run without opening the session.`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-6 border-b border-border`,children:[(0,Q.jsx)(BP,{view:`active`,current:u,onSelect:h,children:`Active`}),(0,Q.jsx)(BP,{view:`archived`,current:u,onSelect:h,children:`Archived`}),(0,Q.jsxs)(`span`,{"data-slot":`global-tasks-count`,className:`ml-auto text-[13px] text-soft-foreground tabular-nums`,children:[T.length,` of `,C.length,ne.length>0?` loaded`:``]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 basis-full md:flex-1 md:basis-auto`,children:se}),(0,Q.jsxs)(k,{variant:`outline`,"aria-expanded":g,onClick:()=>_(e=>!e),children:[(0,Q.jsx)(na,{"aria-hidden":`true`}),`Filters`]}),(0,Q.jsx)(k,{asChild:!0,className:`min-h-11`,children:(0,Q.jsxs)(E,{to:hs(n.data?.bootProject??`default`,`/new`),children:[(0,Q.jsx)(zi,{"aria-hidden":`true`}),`New task`]})})]}),(0,Q.jsx)(ZM,{origin:M,counts:D,automations:s,onChange:ee,labels:O.map(e=>e.label),onSetAll:A.setAll})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[22px]`,children:[(0,Q.jsx)(VP,{filters:c,onToggle:re,onClearFacet:ie,onClearAll:()=>{y(``),f(e=>({...e,filters:aP,groupBy:`none`}))},groupBy:l,onGroupByChange:m,projects:x,tasks:C,view:u,automationName:w}),(0,Q.jsx)(YN,{projects:ne,perProjectLimit:i.data?.perProjectLimit}),i.data===void 0?(0,Q.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:`Loading tasks…`}):(0,Q.jsx)(IP,{view:u,filtered:lP(c),visibleCount:T.length,referenceRequests:te,lists:{groupBy:l,view:u,statusGroups:O,groups:j,folds:A,row:{now:d,onArchive:F,expandedRuns:e,toggleExpandedRun:t,onSetRead:ae,busy:N.isPending||P.isPending,showCost:r.cost,automationName:w}}}),(0,Q.jsx)(XN,{registry:x})]})]})}function IP({view:e,filtered:t,visibleCount:n,referenceRequests:r,lists:i}){return n===0?(0,Q.jsx)(ZN,{view:e,filtered:t}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Za,{requests:r,children:(0,Q.jsx)(LP,{...i})}),i.groupBy===`none`?(0,Q.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Resource details—including tokens, cost, CPU and peak memory—are available when a task row is expanded.`}):null]})}function LP({groupBy:e,view:t,statusGroups:n,groups:r,folds:i,row:a}){return(0,Q.jsx)(Q.Fragment,{children:e===`none`?n.map(e=>{let n=VM(e);return(0,Q.jsx)($M,{id:`global-group-${t}-${e.label.replaceAll(` `,`-`)}`,label:e.label,count:n.length,tone:HM(e.label,n.map(e=>e.run)),folded:i.isFolded(e.label),collapsed:i.isCollapsed(e.label),onToggle:()=>i.toggle(e.label),children:(0,Q.jsx)(HP,{summary:!0,tasks:e.rows.flatMap(KM),showProject:!0,...a})},e.label)}):r.map(t=>(0,Q.jsxs)(`section`,{"data-slot":`task-group`,"data-group-key":t.key,children:[(0,Q.jsxs)(`h2`,{className:`mb-1.5 flex items-center gap-2 text-[12px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:[e===`project`?(0,Q.jsx)(E,{to:hs(t.key,`/`),"data-slot":`group-project-link`,className:`hover:text-foreground hover:underline`,children:t.label}):t.label,(0,Q.jsx)(`span`,{className:`font-mono text-[11px] font-medium tabular-nums`,children:t.tasks.length})]}),(0,Q.jsx)(HP,{tasks:t.tasks,showProject:e!==`project`,...a})]},t.key))})}function RP(e,t){let[n,r]=Z.useState(e),i=Z.useRef(e);return Z.useEffect(()=>{e!==i.current&&r(e),i.current=e},[e]),Z.useEffect(()=>{if(n===i.current)return;let e=setTimeout(()=>{i.current=n,t(n)},kP);return()=>clearTimeout(e)},[n]),[n,r]}function zP({tasks:e,filters:t,view:n,groupBy:r,index:i,automationsOn:a}){let o=Z.useMemo(()=>[...new Set(e.filter(e=>e.run.automationId!==void 0).map(e=>e.run.projectId))],[e]),s=Yn(o,a&&o.length>0),c=Z.useCallback(e=>e.run.automationId===void 0?void 0:s(e.run.projectId,e.run.automationId),[s]),l=Z.useMemo(()=>bP(e,t,n,c),[e,t,n,c]),u=zM(xP(e,t,n,`origin`,c).map(e=>e.run),n),d=r===`none`?GM(l,n,i):[];return{nameOf:c,visible:l,originTotals:u,statusGroups:d,folds:iN(`global`,n,new Set(t.query.trim()===``?[]:d.map(e=>e.label)))}}function BP({view:e,current:t,onSelect:n,children:r}){let i=e===t;return(0,Q.jsx)(`button`,{type:`button`,"data-slot":`overview-tab`,"data-view":e,"aria-pressed":i,onClick:()=>n(e),className:C(`flex min-h-11 items-center justify-center border-b-2 border-transparent text-[13px] font-medium text-muted-foreground`,i&&`border-accent-strong font-semibold text-accent-text`),children:r})}function VP({filters:e,onToggle:t,onClearFacet:n,onClearAll:r,groupBy:i,onGroupByChange:a,projects:o,tasks:s,view:c,automationName:l}){let u=Z.useMemo(()=>Tn(o),[o]),d=Z.useMemo(()=>{let t=(t,n)=>hP(xP(s,e,c,t,l),n);return{projects:t(`projects`,e=>[e.run.projectId]),tags:t(`tags`,gP),statuses:t(`statuses`,e=>[e.run.status]),workflows:t(`workflows`,e=>[e.run.workflow])}},[s,e,c,l]),f=e=>t=>({...t,count:e.get(t.value)??0});return(0,Q.jsxs)(`div`,{"data-slot":`global-tasks-filters`,className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Q.jsx)($N,{slot:`project`,label:`Project`,selected:e.projects??[],onToggle:e=>t(`projects`,e),onClear:()=>n(`projects`),options:[...new Map(s.map(e=>[e.run.projectId,e.projectName])).entries()].map(([e,t])=>({value:e,label:t})).map(f(d.projects)),emptyLabel:`No tasks to filter`}),(0,Q.jsx)($N,{slot:`status`,label:`Status`,selected:e.statuses,onToggle:e=>t(`statuses`,e),onClear:()=>n(`statuses`),options:mP(s).map(e=>({value:e,label:e})).map(f(d.statuses)),emptyLabel:`No tasks to filter`}),(0,Q.jsx)($N,{slot:`workflow`,label:`Workflow`,selected:e.workflows,onToggle:e=>t(`workflows`,e),onClear:()=>n(`workflows`),options:pP(s).map(e=>({value:e,label:e})).map(f(d.workflows)),emptyLabel:`No tasks to filter`}),(0,Q.jsxs)(`div`,{"data-slot":`group-controls`,className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Group by`}),(0,Q.jsx)(tP,{slot:`group-by`,label:`Group tasks by`,value:i,options:rP,onChange:e=>a(iP(i,e))})]}),dP({filters:e,groupBy:i})?(0,Q.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,Q.jsx)(ra,{className:`size-3`,"aria-hidden":`true`}),`Clear`,` (${uP({filters:e,groupBy:i})})`]}):null]}),u.length>0?(0,Q.jsxs)(`div`,{"data-slot":`tag-filters`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`text-[11px] font-medium text-soft-foreground`,children:`Tags`}),u.map(n=>(0,Q.jsx)(eP,{slot:`tag-filter`,tone:`tag`,label:n,count:d.tags.get(n)??0,selected:e.tags.some(e=>e.toLowerCase()===n.toLowerCase()),onToggle:()=>t(`tags`,n)},n)),(0,Q.jsx)(eP,{slot:`tag-filter`,label:`Untagged`,count:d.tags.get(` untagged`)??0,selected:e.tags.includes(nP),onToggle:()=>t(`tags`,nP)})]}):(0,Q.jsxs)(`p`,{"data-slot":`no-tags-hint`,className:`text-[11px] text-soft-foreground`,children:[`Tag connected repositories in`,` `,(0,Q.jsx)(E,{to:`/settings/global/projects`,className:`font-medium text-accent-text hover:underline`,children:Qa(`projects`)}),` `,`to group their tasks together here.`]})]})}function HP({summary:e=!1,expandedRuns:t,toggleExpandedRun:n,tasks:r,now:i,showProject:a,onArchive:o,onSetRead:s,busy:c,showCost:l,automationName:u}){let d=xj(r.map(e=>`${e.run.projectId}/${e.run.id}`),t),f=ci();return(0,Q.jsxs)(`div`,{role:e?`table`:void 0,"aria-rowcount":e?d.rowCount:void 0,"data-slot":`global-tasks-table`,className:`overflow-x-auto rounded-lg border border-border bg-card p-5`,children:[(0,Q.jsx)(`div`,{"data-slot":`global-summary-head`,className:`text-[12px]`,role:`row`,"aria-rowindex":1,children:[`Task`,`Workflow`,`Changes`,`Pull request`,`Started`].map(e=>(0,Q.jsx)(`span`,{role:`columnheader`,children:e},e))}),(0,Q.jsx)(e_,{children:(0,Q.jsx)(CM,{...e?{itemSize:f?115:218}:{},items:r,itemKey:e=>`${e.run.projectId}/${e.run.id}`,children:(r,f)=>(0,Q.jsx)(UP,{task:r,summary:e,rowIndex:d.indexes[f],resourcesOpen:t.has(`${r.run.projectId}/${r.run.id}`),toggleExpandedRun:n,now:i,showProject:a,onArchive:o,onSetRead:s,busy:c,showCost:l,automationName:u(r)},`${r.run.projectId}/${r.run.id}`)})})]})}var UP=Z.memo(function({rowIndex:e,resourcesOpen:t,toggleExpandedRun:n,summary:r,task:i,now:a,showProject:o,onArchive:s,onSetRead:c,busy:l,showCost:u,automationName:d}){let f=r?`row`:void 0,p=r?`cell`:void 0,{run:m}=i,h=Ce(m),g=hs(m.projectId,`/tasks/${m.id}`),_=Wr(m,i.project?.repoUrl),v=Ar(m,m.usage);return(0,Q.jsxs)(`article`,{role:r?`rowgroup`:void 0,"data-status":m.status,"data-expanded":t,"data-slot":`global-task-row`,"data-run-id":m.id,"data-project":m.projectId,className:`hover:bg-muted max-md:flex max-md:flex-wrap max-md:items-center max-md:gap-x-3 max-md:gap-y-2 max-md:border-b max-md:border-border max-md:py-5 `,children:[(0,Q.jsxs)(`div`,{"data-slot":`global-task-cells`,className:`contents`,role:f,"aria-rowindex":r?e:void 0,children:[(0,Q.jsx)(WP,{summary:r,task:i,showProject:o,automationName:d,resourcesOpen:t,toggleExpandedRun:n}),(0,Q.jsx)(`div`,{role:p,"data-slot":`global-task-workflow`,className:`text-[13px] text-muted-foreground`,children:m.workflow}),(0,Q.jsx)(`div`,{role:p,"data-slot":`global-task-diff`,className:`text-xs text-muted-foreground`,children:(0,Q.jsx)(`span`,{title:`Change totals are available in the project task list`,children:`—`})}),(0,Q.jsx)(`div`,{role:p,"data-slot":`global-task-references`,children:_.length>0?(0,Q.jsx)(qP,{references:_,run:m,repoBase:i.project?.repoUrl}):(0,Q.jsx)(YP,{})}),(0,Q.jsx)(`div`,{role:p,"data-slot":`global-task-age`,className:`text-right text-xs text-soft-foreground tabular-nums`,children:Ga(m.startedAt??m.createdAt,a)})]}),!r||t?(0,Q.jsx)(`div`,{className:`contents`,role:f,"aria-rowindex":r?e+1:void 0,children:(0,Q.jsxs)(`div`,{"data-slot":`global-task-detail-cell`,role:p,"aria-colspan":r?5:void 0,className:r?`col-span-full flex flex-col gap-3`:`contents`,children:[(0,Q.jsx)(`div`,{"data-slot":`global-task-actions`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,Q.jsx)(GP,{task:i,busy:l,onSetRead:c}),(0,Q.jsx)(KP,{task:i,busy:l,onArchive:s}),(0,Q.jsx)(k,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(E,{to:g,children:`Open task`})})]})}),t?(0,Q.jsxs)(`div`,{"data-slot":`global-task-resources`,className:`col-span-full flex flex-col gap-3`,children:[(0,Q.jsx)(tN,{projectId:m.projectId,runId:m.id,status:h.label,error:m.error,open:(0,Q.jsx)(k,{asChild:!0,variant:`outline`,className:`min-h-11`,children:(0,Q.jsxs)(E,{to:g,children:[`Open task`,(0,Q.jsxs)(`span`,{className:`sr-only`,children:[`: `,xi(m)]})]})})}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-2 gap-4 rounded-md bg-muted/50 p-4 text-xs md:grid-cols-3`,children:[u?(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Cost`}),(0,Q.jsx)(`dd`,{className:`mt-1`,children:oi(m.costUsd)||`—`})]}):null,(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`CPU`}),(0,Q.jsx)(`dd`,{"data-usage":`cpu`,"data-usage-kind":v.cpu.kind,title:v.cpu.title,className:`mt-1`,children:v.cpu.text||`—`})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Memory`}),(0,Q.jsx)(`dd`,{"data-usage":`mem`,"data-usage-kind":v.mem.kind,title:v.mem.title,className:`mt-1`,children:v.mem.text||`—`})]})]})]}):null]})}):null]})},(e,t)=>{let{task:n,...r}=e,{task:i,...a}=t;return n.run===i.run&&n.project===i.project&&n.projectName===i.projectName&&n.tags.length===i.tags.length&&n.tags.every((e,t)=>e===i.tags[t])&&Object.keys(r).every(e=>r[e]===a[e])});function WP({summary:e,task:t,showProject:n,automationName:r,resourcesOpen:i,toggleExpandedRun:a}){let{run:o}=t,s=Ce(o),c=hs(o.projectId,`/tasks/${o.id}`),l=Zr(o),u=Ph(o);return(0,Q.jsxs)(`div`,{role:e?`cell`:void 0,"data-slot":`global-task-title`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[o.delegation?.role===`worker`?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:`Worker`}):null,(0,Q.jsx)(E,{to:c,title:xi(o),"data-task-control":`title`,className:C(`min-w-0 truncate text-[14px] md:text-[13px]`,l?`font-semibold text-foreground`:u?`font-medium text-muted-foreground`:`font-medium`),children:xi(o)}),l?(0,Q.jsx)($,{tone:Ih(o),role:`img`,"aria-label":`unread`,title:`Unread — not opened since it finished`,className:`shrink-0`}):null]}),(0,Q.jsx)(`div`,{className:`mt-1`,children:(0,Q.jsx)(eN,{automationId:o.automationId,automationName:r,project:n?(0,Q.jsx)(E,{to:hs(o.projectId,`/`),"data-slot":`task-project`,className:`truncate hover:text-foreground`,children:t.projectName}):void 0})}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-task-control":`resources`,"aria-expanded":i,"aria-label":`${i?`Hide`:`Show`} resources for ${xi(o)}`,onClick:()=>a(`${o.projectId}/${o.id}`),"aria-describedby":`global-status-${o.projectId}-${o.id}`,title:`Resources and actions`,className:`min-h-[26px] rounded-md p-0 text-[11px] text-muted-foreground hover:bg-muted`,children:(0,Q.jsx)(MM,{id:`global-status-${o.projectId}-${o.id}`,dot:s.tone,shape:s.shape,pulse:s.pulse,children:s.label})}),(0,Q.jsx)(`span`,{children:t.tags.length>0?(0,Q.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:t.tags.map(e=>(0,Q.jsx)(JP,{tag:e},e))}):null})]})]})}function GP({task:e,busy:t,onSetRead:n}){if(!Ir(e.run))return null;let r=Zr(e.run),i=xi(e.run),a=r?`Mark ${i} read`:`Mark ${i} unread`,o=r?Ua:gu;return(0,Q.jsxs)(t_,{children:[(0,Q.jsx)(n_,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-action":r?`mark-read`:`mark-unread`,"aria-label":a,disabled:t,onClick:()=>n(e,r),className:C(`inline-flex size-11 items-center justify-center md:size-8 rounded-md transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,r?`text-accent-icon`:`text-soft-foreground`),children:[(0,Q.jsx)(o,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:r?`Mark read`:`Mark unread`})]})}),(0,Q.jsx)(r_,{side:`left`,children:r?`Mark read`:`Mark unread`})]})}function KP({task:e,busy:t,onArchive:n}){let r=e.run.archived;if(!r&&!jP.has(e.run.status))return null;let i=r?`Restore ${xi(e.run)} to the active list`:`Archive ${xi(e.run)}`;return(0,Q.jsxs)(t_,{children:[(0,Q.jsx)(n_,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-action":r?`unarchive-run`:`archive-run`,"aria-label":i,disabled:t,onClick:()=>n(e,!r),className:`inline-flex size-11 items-center justify-center md:size-8 rounded-md text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-wait disabled:opacity-50`,children:[(0,Q.jsx)(r?Jl:ba,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:r?`Unarchive`:`Archive`})]})}),(0,Q.jsx)(r_,{side:`left`,children:r?`Restore`:`Archive`})]})}function qP({references:e,run:t,repoBase:n}){return(0,Q.jsx)(Yb,{references:e,maxVisible:AP,taskTitle:xi(t),projectId:t.projectId,runId:t.id,repoBase:n})}function JP({tag:e,className:t}){return(0,Q.jsx)(`span`,{"data-slot":`project-tag`,className:C(`inline-flex max-w-full items-center truncate rounded-full bg-muted px-1.5 py-px text-[11px] font-medium text-muted-foreground`,t),children:e})}function YP(){return(0,Q.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`—`})}var XP=new Map;function ZP(e){let t=XP.get(e);return t||(t=new Intl.DateTimeFormat(`en-CA`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),XP.set(e,t)),t}function QP(e,t){try{let n=ZP(t).formatToParts(new Date(e)),r=e=>Number(n.find(t=>t.type===e)?.value),i=r(`year`),a=r(`month`),o=r(`day`);return{year:i,month:a,day:o,hour:r(`hour`)%24,minute:r(`minute`),second:r(`second`),weekday:$P(i,a,o)}}catch{return null}}function $P(e,t,n){return(new Date(Date.UTC(e,t-1,n)).getUTCDay()+6)%7+1}function eF(e,t){let n=QP(t,e);return n?Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)-t:null}function tF(e,t,n,r,i,a){let o=Date.UTC(e,t-1,n,r,i,0,0),s=o;for(let e=0;e<3;e+=1){let e=eF(a,s);if(e===null)return null;let t=o-e;if(Math.abs(t-s)<1e3)return t;s=t}return s}function nF(e){if(!e)return!1;try{return ZP(e).format(new Date(0)),!0}catch{return!1}}var rF=[`daily`,`weekdays`,`weekly`,`hours`,`once`],iF=[1,2,3,4,6,8,12],aF=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],oF=[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],sF=43200,cF=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/,lF=[`hour`,`minute`,`day`,`every`],uF=[`at`,`timeZone`,`latestStartMinutes`],dF=`the due time has passed; choose a later time or use Run now`,fF=z([`paused`,`waiting`,`failed`,`missed`,`archived`]);function pF(e){return`unknown time zone "${e}"; use an IANA name such as Europe/Warsaw`}var mF=R({type:z(rF),hour:L().int().min(0).max(23).optional(),minute:L().int().min(0).max(59).optional(),day:L().int().min(1).max(7).optional(),every:$t([nn(1),nn(2),nn(3),nn(4),nn(6),nn(8),nn(12)]).optional(),at:B().regex(cF,`at must be YYYY-MM-DDTHH:MM`).optional(),timeZone:B().optional(),latestStartMinutes:L().int().min(10).max(sF).optional()}).superRefine((e,t)=>{let n=t=>e[t]!==void 0,r=(e,n)=>t.addIssue({code:`custom`,path:[e],message:n});if(e.type!==`once`){for(let e of uF)n(e)&&r(e,`${e} applies only to a once schedule`);return}for(let e of lF)n(e)&&r(e,`${e} does not apply to a once schedule`);e.at===void 0?r(`at`,`a once schedule needs at (YYYY-MM-DDTHH:MM)`):cF.test(e.at)&&!vF(e.at)&&r(`at`,`at is not a real date and time`),e.timeZone===void 0?r(`timeZone`,`a once schedule needs a timeZone`):nF(e.timeZone)||r(`timeZone`,pF(e.timeZone))});function hF(e){return{type:e.type,hour:e.hour??4,minute:e.minute??0,day:e.day??1,every:e.every??6,...e.at===void 0?{}:{at:e.at},...e.timeZone===void 0?{}:{timeZone:e.timeZone},...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}function gF(e){if(e.type!==`once`||!e.at||!e.timeZone)return null;let t=_F(e.at);return t&&tF(t.year,t.month,t.day,t.hour,t.minute,e.timeZone)}function _F(e){let t=cF.exec(e);if(!t)return null;let[n,r,i,a,o]=t.slice(1).map(Number),s=new Date(Date.UTC(n,r,0)).getUTCDate();return r<1||r>12||i<1||i>s||a>23||o>59?null:{year:n,month:r,day:i,hour:a,minute:o}}var vF=e=>_F(e)!==null,yF=e=>String(e).padStart(2,`0`);function bF(e,t=0){return`${yF(e)}:${yF(t)}`}function xF(e){let t=hF(e);switch(t.type){case`once`:return SF(t);case`daily`:return`every day at ${bF(t.hour,t.minute)}`;case`weekdays`:return`weekdays at ${bF(t.hour,t.minute)}`;case`hours`:return t.every===1?`every hour`:`every ${t.every} hours`;case`weekly`:return`${oF[t.day-1]}s at ${bF(t.hour,t.minute)}`}}function SF(e){let t=e.at?_F(e.at):null;if(!t)return`once`;let{year:n,month:r,day:i,hour:a,minute:o}=t;return`once on ${aF[$P(n,r,i)-1]} ${i} ${CF[r-1]} ${n} at ${bF(a,o)} (${e.timeZone??`UTC`})`}var CF=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function wF(e){let t=hF(e);switch(t.type){case`once`:throw Error(`a once schedule has no cron form`);case`daily`:return`${t.minute} ${t.hour} * * *`;case`weekdays`:return`${t.minute} ${t.hour} * * 1-5`;case`hours`:return`0 */${t.every} * * *`;case`weekly`:return`${t.minute} ${t.hour} * * ${t.day%7}`}}function TF(e,t){switch(e.type){case`once`:return[];case`daily`:return[[e.hour,e.minute]];case`weekdays`:return t<=5?[[e.hour,e.minute]]:[];case`weekly`:return t===e.day?[[e.hour,e.minute]]:[];case`hours`:{let t=[];for(let n=0;n<24;n+=e.every)t.push([n,0]);return t}}}function EF(e,t,n,r,i=1e3){if(e.type===`once`){let r=gF(e);return r!==null&&r>=t&&r<n&&i>0?[r]:[]}let a=hF(e),o=QP(t,r);if(!o||n<=t)return[];let s=[],c=Math.ceil((n-t)/864e5)+2;for(let e=-1;e<=c;e+=1){let c=new Date(Date.UTC(o.year,o.month-1,o.day+e)),l=c.getUTCFullYear(),u=c.getUTCMonth()+1,d=c.getUTCDate();for(let[e,o]of TF(a,$P(l,u,d))){let a=tF(l,u,d,e,o,r);if(a===null||a!==s.at(-1)&&a>=t&&a<n&&(s.push(a),s.length>=i))return s}}return s}function DF(e,t){let n=t-e;if(n<=0)return`now`;let r=Math.floor(n/6e4);if(r<1)return`in <1m`;if(r<60)return`in ${r}m`;let i=Math.floor(r/60);return i<24?`in ${i}h`:`in ${Math.floor(i/24)}d`}var OF=new Map;function kF(e,t){if(!Number.isFinite(e))return null;let n=OF.get(t);try{n??=new Intl.DateTimeFormat(`en-GB`,{timeZone:t,weekday:`short`,year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}catch{return null}OF.set(t,n);let r={};for(let t of n.formatToParts(e))r[t.type]=t.value;let i=new Date(`${r.month} 1, ${r.year} UTC`).getUTCMonth();return{weekday:r.weekday,day:r.day,month:r.month,hour:r.hour,minute:r.minute,key:`${r.year}-${i}-${r.day}`,dayNumber:Math.floor(Date.UTC(Number(r.year),i,Number(r.day))/864e5)}}function AF(e,t){let n=kF(Date.parse(e),t);return n?`${n.weekday} ${n.hour}:${n.minute}`:e}function jF(e,t,n){let r=kF(Date.parse(e),t),i=kF(n,t);if(!r||!i)return e;let a=`${r.hour}:${r.minute}`,o=i.dayNumber-r.dayNumber;return o===0?`Today ${a}`:o===1?`Yesterday ${a}`:o>1&&o<7?`${r.weekday} ${a}`:`${r.day} ${r.month} ${a}`}var MF=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],NF=e=>String(e).padStart(2,`0`);function PF(e){let t=e?_F(e):null;if(!t)return null;let{year:n,month:r,day:i,hour:a,minute:o}=t;return{date:`${aF[$P(n,r,i)-1]} ${i} ${MF[r-1]} ${n}`,time:`${NF(a)}:${NF(o)}`}}var FF=36e5;function IF(e){let t=gF(e),n=e.timeZone,r=PF(e.at),i=t===null||!n?null:QP(t,n);if(t===null||!n||!r||!i)return null;let a={date:`${aF[$P(i.year,i.month,i.day)-1]} ${i.day} ${MF[i.month-1]} ${i.year}`,time:`${NF(i.hour)}:${NF(i.minute)}`};if(a.date!==r.date||a.time!==r.time)return{...a,note:`${r.time} does not exist on ${r.date} in ${n}.`};let o=e=>{let t=QP(e,n);return!!t&&t.day===i.day&&t.hour===i.hour&&t.minute===i.minute},s=(eF(n,t-12*FF)??0)-(eF(n,t+12*FF)??0);if(s<=0)return a;let c=o(t+s);if(!c&&!o(t-s))return a;let l=(eF(n,t)??0)/6e4,u=`UTC${l<0?`-`:`+`}${NF(Math.floor(Math.abs(l)/60))}:${NF(Math.abs(l)%60)}`;return{...a,note:`${r.time} happens twice that day; it runs at ${c?`the first`:`the second`} (${u}).`}}var LF=z([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),RF=R({includeExisting:on().optional(),authors:Qt(B()).optional(),assignees:Qt(B()).optional(),requireCurrentLabels:on().optional(),allLabels:Qt(B()).optional(),anyLabels:Qt(B()).optional(),excludeLabels:Qt(B()).optional(),changedLabels:Qt(B()).optional(),lookbackDays:L(),maxRecords:L()}),zF=z([`github`,`schedule`]),BF=Xt.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:B(),variants:$t([nn(1),nn(2),nn(3)]).optional(),systemPrompt:B().optional()}),VF=R({at:B(),outcome:z([`launched`,`cancelled`]),runId:B().optional(),receiptId:B().optional(),trigger:z([`schedule`,`late`,`manual`,`retry`]).optional()}),HF=R({id:B(),revision:L(),name:B(),description:B().optional(),enabled:on(),kind:zF,events:Qt(LF).optional(),intervalSeconds:L().optional(),filters:RF.optional(),schedule:mF.optional(),task:BF,archived:VF.optional(),createdAt:B(),updatedAt:B()}),UF=R({timestamp:B(),tieBreaker:B().optional()}),WF=R({since:B().datetime(),until:B().datetime(),source:L().int().min(0).max(2),page:L().int().min(1).max(10),item:L().int().min(0).max(100),event:L().int().min(0).max(1e3),cursor:UF.optional()}),GF={lastError:B().max(1e3).optional(),lastErrorAt:B().datetime().optional()},KF=R({revision:L().optional(),baselineAt:B().optional(),armedAt:B().optional(),historyScan:WF.optional(),cursor:UF.optional(),frozenHighWatermark:UF.extend({tieBreaker:B()}).optional(),backlogAfter:UF.extend({tieBreaker:B()}).optional(),nextCheckAt:B().optional(),lastSuccessAt:B().optional(),nextRunAt:B().optional(),lastRunAt:B().optional(),etags:cn(B(),B()).optional(),backoffUntil:B().optional(),consecutiveFailures:L().optional(),...GF,onceOutcome:z([`failed`,`missed`]).optional()});function qF(e){let t=e?.consecutiveFailures??0;if(!(t<3||!e?.lastError))return{consecutiveFailures:t,lastError:e.lastError,...e.lastErrorAt?{lastErrorAt:e.lastErrorAt}:{},...e.backoffUntil?{retryAt:e.backoffUntil}:{}}}var JF=z([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),YF=R({seq:L(),ts:B(),automationId:B(),revision:L(),event:LF.optional(),result:JF,reason:B().optional(),durationMs:L().optional(),receiptId:B().optional(),runId:B().optional(),githubNumber:L().optional(),githubTitle:B().optional(),githubUrl:B().optional(),rateLimit:R({bucket:z([`core`,`search`]),remaining:L().optional(),resetAt:B().optional()}).optional()}),XF=R({matches:L(),launched:L(),duplicates:L(),errors:L()}),ZF=HF.extend({state:KF.optional(),latestLog:YF.optional(),counts:XF,nextRunAt:B().optional(),onceStatus:fF.optional()});R({available:on(),reason:B().optional(),timeZone:B(),scheduler:R({state:z([`scheduled`,`idle`]),nextDue:B().optional()}),automations:Qt(ZF)}),R({automation:HF}).extend({once:R({dueAt:B(),timeZone:B(),resolvedInstant:B(),note:B()}).optional()}),R({automation:HF,state:KF.optional(),latestLog:YF.optional(),onceStatus:fF.optional()}),R({id:B(),automationId:B(),mode:z([`preview`,`execute`]),status:z([`queued`,`running`,`complete`,`error`]),createdAt:B(),completedAt:B().optional(),matches:L().optional(),truncated:on().optional(),error:B().optional()}),R({checkId:B()}),R({records:Qt(YF)}),R({receiptId:B(),runId:B()}),R({runId:B()}),HF.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:zF.optional(),task:BF.omit({variants:!0}).strict(),enable:on().optional()}).omit({enable:!0}).extend({enabled:on().optional(),expectedRevision:L()}),R({archived:z([`include`,`only`]).optional()}),R({mode:z([`preview`,`execute`])});function QF({...e}){return(0,Q.jsx)(Cf,{"data-slot":`select`,...e})}function $F({...e}){return(0,Q.jsx)(Df,{"data-slot":`select-value`,...e})}function eI({className:e,size:t=`default`,children:n,...r}){return(0,Q.jsxs)(Tf,{"data-slot":`select-trigger`,"data-size":t,className:C(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden 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-11 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 pointer-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,Q.jsx)(kf,{asChild:!0,children:(0,Q.jsx)(ua,{className:`size-4 opacity-50`})})]})}function tI({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,Q.jsx)(Nf,{children:(0,Q.jsxs)(Ff,{"data-slot":`select-content`,className:C(`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 motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe: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,Q.jsx)(rI,{}),(0,Q.jsx)(Xf,{className:C(`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,Q.jsx)(iI,{})]})})}function nI({className:e,children:t,...n}){return(0,Q.jsxs)(op,{"data-slot":`select-item`,className:C(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-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,Q.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,Q.jsx)(up,{children:(0,Q.jsx)(Qi,{className:`size-4`})})}),(0,Q.jsx)(cp,{children:t})]})}function rI({className:e,...t}){return(0,Q.jsx)(fp,{"data-slot":`select-scroll-up-button`,className:C(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,Q.jsx)(ea,{className:`size-4`})})}function iI({className:e,...t}){return(0,Q.jsx)(mp,{"data-slot":`select-scroll-down-button`,className:C(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,Q.jsx)(ua,{className:`size-4`})})}function aI({title:e,subtitle:t,action:n,children:r}){return(0,Q.jsxs)(`main`,{"data-route":`automations`,className:`task-flow-page w-full max-w-full min-w-0 max-md:p-4!`,children:[(0,Q.jsxs)(`header`,{className:`mb-6 flex flex-col items-start gap-5 max-md:mb-4 max-md:gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{className:`mb-2 text-[28px] font-medium max-md:text-[22px]`,children:e}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),n]}),r]})}function oI({text:e}){return(0,Q.jsx)(`div`,{role:`status`,className:`rounded-xl border bg-card p-6 text-sm text-muted-foreground`,children:e})}var sI={launched:`success`,manual:`success`,"catch-up":`success`,skipped:`neutral`,missed:`neutral`,"no-match":`neutral`,preview:`neutral`,baseline:`neutral`,duplicate:`neutral`,failed:`danger`,error:`danger`,"rate-limited":`danger`},cI={launched:`Launched`,manual:`Manual`,"catch-up":`Catch up`,skipped:`Skipped`,missed:`Missed`,"no-match":`No match`,preview:`Preview`,baseline:`Baseline`,duplicate:`Duplicate`,failed:`Failed`,error:`Error`,"rate-limited":`Rate limited`};function lI(e){let[t,n]=(0,Z.useState)(),[r,i]=(0,Z.useState)(``),a=(0,Z.useCallback)(t=>We(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,Z.useEffect)(()=>{a()},[a]),(0,Z.useEffect)(()=>P(a),[a]),(0,Z.useEffect)(()=>rl((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function uI(e,t){return e.result!==`failed`&&e.result!==`error`||!e.receiptId||e.runId?!1:!t.some(t=>t.receiptId===e.receiptId&&(t.runId||t.seq>e.seq))}function dI({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&uI(e,t),[o,s]=(0,Z.useState)(),[c,l]=(0,Z.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await ft(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,Q.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,Q.jsxs)(`li`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(MM,{dot:sI[e.result],children:cI[e.result]}),(0,Q.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:jF(e.ts,n,u)})]}),e.reason?(0,Q.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,Q.jsx)(`a`,{className:`inline-flex min-h-11 items-center underline underline-offset-4 break-all`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}):null,e.runId?(0,Q.jsx)(Y,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,Q.jsx)(k,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var fI=`all`;function pI({label:e,value:t,onChange:n,options:r}){return(0,Q.jsxs)(QF,{value:t,onValueChange:n,children:[(0,Q.jsx)(eI,{"aria-label":e,className:`w-full sm:w-52`,children:(0,Q.jsx)($F,{})}),(0,Q.jsx)(tI,{children:r.map(e=>(0,Q.jsx)(nI,{value:e.value,children:e.label},e.value))})]})}function mI({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=lI(e),[s,c]=(0,Z.useState)(fI),[l,u]=(0,Z.useState)(fI),d=(0,Z.useMemo)(()=>(i??[]).filter(e=>(s===fI||e.result===s)&&(l===fI||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,Q.jsx)(aI,{title:`Execution log`,subtitle:t??`Automation activity`,action:(0,Q.jsx)(k,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(Y,{to:`/automations`,children:`Back to automations`})}),children:a&&!i?(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,Q.jsx)(oI,{text:a}),(0,Q.jsx)(k,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,Q.jsx)(oI,{text:`Nothing has run yet.`}):(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(pI,{label:`Result`,value:s,onChange:c,options:[{value:fI,label:`All results`},...JF.options.map(e=>({value:e,label:cI[e]}))]}),f?(0,Q.jsx)(pI,{label:`Event`,value:l,onChange:u,options:[{value:fI,label:`All events`},...LF.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,Q.jsx)(oI,{text:`No rows match these filters.`}):(0,Q.jsx)(dI,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,Q.jsx)(oI,{text:`Loading execution log…`})})}function hI({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=lI(e);return(0,Q.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`mt-4 min-w-0 border-t pt-4`,children:[(0,Q.jsxs)(`h3`,{className:`mb-3 text-sm font-medium`,children:[`Recent activity`,r&&t?` · ${t}`:``]}),o&&!a?(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,Q.jsx)(oI,{text:o}),(0,Q.jsx)(k,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?a.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Nothing has run yet.`}):(0,Q.jsx)(dI,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading activity…`})]})}function gI({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?IF(i):null,[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(``),f=(0,Z.useRef)(null),p=(0,Z.useRef)(null),m=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let e=m.current===`keep`?p.current:m.current===`delete`?f.current:null;m.current=null,e?.focus()},[o]);let h=async()=>{l(!0);try{await Oe(e.id),n()}catch(e){d(e instanceof Error?e.message:String(e)),l(!1)}},g=[[`Workflow`,e.task.workflow],[`Runner`,e.task.runner],[`Model`,e.task.model],[`Effort`,e.task.effort]];return(0,Q.jsx)(aI,{title:e.name,subtitle:`Archived one-time schedule. It cannot change; delete it when you no longer need the record.`,children:(0,Q.jsxs)(`div`,{className:`grid min-w-0 max-w-3xl gap-5`,children:[(0,Q.jsxs)(`section`,{className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,Q.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,Q.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,Q.jsxs)(Q.Fragment,{children:[` · `,(0,Q.jsx)(Y,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${AF(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,Q.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,Q.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,Q.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-1`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,Q.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),g.filter(([,e])=>e).map(([e,t])=>(0,Q.jsxs)(`div`,{className:`grid gap-1`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,Q.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,Q.jsxs)(`section`,{className:`min-w-0`,children:[(0,Q.jsx)(hI,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,Q.jsx)(k,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,Q.jsx)(Y,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(k,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:c,onClick:()=>void h(),children:`Delete schedule`}),(0,Q.jsx)(k,{ref:p,variant:`outline`,disabled:c,onClick:()=>{m.current=`delete`,s(!1)},children:`Keep`})]})]}):(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(k,{ref:f,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{m.current=`keep`,s(!0)},children:`Delete`}),(0,Q.jsx)(k,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(Y,{to:`/automations`,children:`Back to automations`})})]}),u?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:u}):null]})]})})}var _I=z([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),vI=Qt(B().trim().min(1).max(200)).max(100).optional(),yI=R({includeExisting:on().optional(),requireCurrentLabels:on().optional(),authors:vI,assignees:vI,allLabels:vI,anyLabels:vI,excludeLabels:vI,changedLabels:vI,lookbackDays:L().int().min(1).max(90).default(7),maxRecords:L().int().min(1).max(100).default(25)}).passthrough(),bI=R({prompt:B().min(1).max(1e5),workflow:B().trim().min(1).max(200).optional(),steps:Qt(tt).min(1).max(100).optional(),runner:ge.optional(),model:B().trim().min(1).max(200).optional(),effort:B().trim().min(1).max(32).optional(),variants:$t([nn(1),nn(2),nn(3)]).optional(),worktree:on().optional(),autonomous:on().optional(),...me,...At,systemPrompt:B().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),xI=new Set(Object.keys(bI.shape).filter(e=>e!==`variants`));function SI(e){return Object.fromEntries(Object.entries(e).filter(([e])=>xI.has(e)))}rn(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e;return t.kind===`schedule`?e:{...t,intervalSeconds:t.intervalSeconds??300,filters:t.filters??{}}},R({id:B().min(1).max(100),revision:L().int().positive(),name:B().trim().min(1).max(200),description:B().max(2e3).optional(),enabled:on().default(!1),kind:zF.default(`github`),events:Qt(_I).min(1).max(4).optional(),intervalSeconds:L().int().min(60).max(86400).optional(),filters:yI.optional(),schedule:mF.passthrough().optional(),task:bI,archived:R({at:B().datetime(),outcome:z([`launched`,`cancelled`]),runId:B().optional(),receiptId:B().optional(),trigger:z([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:B().datetime(),updatedAt:B().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:ze.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:ze.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:ze.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:ze.custom,path:[`filters`],message:`a GitHub automation needs its bounded filter`}),e.events?.some(e=>e===`issue.labeled`||e===`issue.unlabeled`)&&!e.filters?.changedLabels?.length&&t.addIssue({code:ze.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),R({version:nn(1).default(1),automations:Qt(an()).default([]),tombstones:cn(B(),B().datetime()).optional()}).passthrough();var CI=R({timestamp:B().datetime(),tieBreaker:B().optional()}).passthrough(),wI=WF.extend({cursor:CI.optional()}),TI=R({revision:L().int().positive().optional(),baselineAt:B().datetime().optional(),armedAt:B().datetime().optional(),historyScan:wI.optional(),cursor:CI.optional(),frozenHighWatermark:CI.extend({tieBreaker:B()}).optional(),backlogAfter:CI.extend({tieBreaker:B()}).optional(),nextCheckAt:B().datetime().optional(),lastSuccessAt:B().datetime().optional(),nextRunAt:B().datetime().optional(),lastRunAt:B().datetime().optional(),etags:cn(B(),B()).optional(),backoffUntil:B().datetime().optional(),consecutiveFailures:L().int().nonnegative().optional(),...GF,onceOutcome:z([`failed`,`missed`]).optional()}).passthrough();R({version:nn(1).default(1),states:cn(B(),TI).default({})}).passthrough(),R({receiptId:B().min(1),receiptKey:B().min(1),eventId:B().min(1),automationId:B().min(1),revision:L().int().positive(),status:z([`reserved`,`launched`,`launch-error`,`released`]),runId:B().optional(),observedAt:B().datetime(),updatedAt:B().datetime(),error:B().max(2e3).optional(),occurrenceAt:B().datetime().optional(),candidate:R({eventId:B(),event:_I,timestamp:B().datetime(),tieBreaker:B(),repo:B(),nodeId:B(),number:L().int().positive(),title:B().max(500),url:B().url(),author:B().max(200),assignees:Qt(B().max(200)).max(100),labels:Qt(B().max(200)).max(100),changedLabel:B().max(200).optional()}).passthrough().optional()}).passthrough();var EI=z([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);R({seq:L().int().positive(),ts:B().datetime(),automationId:B().min(1),revision:L().int().positive(),event:_I.optional(),result:EI,reason:B().max(2e3).optional(),durationMs:L().int().nonnegative().optional(),receiptId:B().optional(),runId:B().optional(),githubNumber:L().int().positive().optional(),githubTitle:B().max(500).optional(),githubUrl:B().url().optional(),rateLimit:R({bucket:z([`core`,`search`]),remaining:L().int().nonnegative().optional(),resetAt:B().datetime().optional()}).passthrough().optional()}).passthrough();var DI=`quick-task`;function OI(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=SI(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:hF(e.schedule??{type:`daily`}),events:e.events??[`issue.opened`],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?d?{workflow:DI}:{}:{workflow:n},...r===void 0?{}:{runner:r},...i===void 0?{}:{model:i},autonomous:a??!0,archiveWhenDone:o??!1,autoMergePr:s??!1,allowWorkers:c!==!1,allowMessaging:l!==!1,enabled:e.enabled??e.enable??!1,taskExtra:u}}function kI(e){switch(e.type){case`daily`:case`weekdays`:return{type:e.type,hour:e.hour,minute:e.minute};case`weekly`:return{type:`weekly`,hour:e.hour,minute:e.minute,day:e.day};case`hours`:return{type:`hours`,every:e.every};case`once`:return{type:`once`,at:e.at??``,timeZone:e.timeZone??``,...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}}function AI(e){return{...e.taskExtra,prompt:e.prompt,...e.workflow?{workflow:e.workflow}:{},...e.runner?{runner:e.runner}:{},...e.model?{model:e.model}:{},autonomous:e.autonomous,...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers?{}:{allowWorkers:!1},...e.allowMessaging?{}:{allowMessaging:!1}}}function jI(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:kI(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:AI(e)}}function MI(e){return{...jI(e),enable:e.enabled}}function NI(e,t){return{...jI(e),task:{...AI(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function PI(e){return`'${e.replace(/'/g,`'\\''`)}'`}var FI=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),II=new Set([`anyLabels`,`authors`,`changedLabels`]);function LI(e){if(e.description!==void 0||!e.name.trim()||!e.task.prompt.trim())return!1;let t=e.task;if(Object.keys(t).some(e=>!FI.has(e))||t.archiveWhenDone===!1||t.autoMergePr===!1||t.allowWorkers===!0||t.allowMessaging===!0||t.worktree!==!0)return!1;if(e.kind===`schedule`)return e.schedule!==void 0;let{events:n,filters:r}=e;return!n?.length||n.some(e=>e.includes(`,`))||!r||r.lookbackDays!==7||r.maxRecords!==25?!1:Object.entries(r).every(([e,t])=>e===`lookbackDays`||e===`maxRecords`||e===`includeExisting`&&t===!0||II.has(e)&&Array.isArray(t)&&t.length>0)}function RI(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function zI(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function BI(e,t){return t.startsWith(`-`)?`--${e}=${PI(t)}`:`--${e} ${PI(t)}`}function VI(e){let t=[`${hy()} automation add`,BI(`name`,e.name)];if(e.schedule?.type===`once`)t.push(BI(`at`,e.schedule.at),BI(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push(BI(`latest-start`,zI(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push(BI(`cron`,wF(e.schedule)));else{t.push(BI(`on`,e.events.join(`,`)),`--every ${RI(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push(BI(`label`,n));for(let n of e.filters?.authors??[])t.push(BI(`author`,n));for(let n of e.filters?.changedLabels??[])t.push(BI(`changed-label`,n))}return t.push(...HI(e.task)),e.enable===!0&&t.push(`--enable`),t.push(BI(`prompt`,e.task.prompt)),t.join(` `)}function HI(e){let t=[];return e.workflow&&t.push(BI(`workflow`,e.workflow)),e.runner&&t.push(BI(`runner`,e.runner)),e.model&&t.push(BI(`model`,e.model)),e.autonomous===!1&&t.push(`--no-autonomous`),e.archiveWhenDone&&t.push(`--archive-when-done`),e.autoMergePr&&t.push(`--auto-merge-pr`),e.allowWorkers===!1&&t.push(`--no-workers`),e.allowMessaging===!1&&t.push(`--no-messaging`),t}function UI(e,t){let n=MI(e),r=LI(n)?VI(n):`${hy()} automation create --json ${PI(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${PI(t.origin)} CEZ_PROJECT_ID=${PI(t.projectId)} HSQ_COCKPIT_URL=${PI(t.origin)} HSQ_PROJECT_ID=${PI(t.projectId)} ${r}`:r}function WI({draft:e}){let t=Ss(),n=window.location.origin,r=(0,Z.useMemo)(()=>UI(e,t?{origin:n,projectId:t}:void 0),[e,n,t]),[i,a]=(0,Z.useState)(`idle`),o=(0,Z.useRef)(void 0);(0,Z.useEffect)(()=>()=>clearTimeout(o.current),[]),(0,Z.useEffect)(()=>a(`idle`),[r]);let s=async()=>{clearTimeout(o.current);try{await navigator.clipboard.writeText(r),a(`copied`),o.current=setTimeout(()=>a(`idle`),1600)}catch{a(`failed`)}};return(0,Q.jsxs)(`section`,{"aria-labelledby":`copy-as-cli-heading`,"data-slot":`copy-as-cli`,className:`mbs-4 rounded-xl border bg-card p-4`,children:[(0,Q.jsxs)(`div`,{className:`mbe-2 flex items-center gap-2`,children:[(0,Q.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`text-[15px] font-medium`,children:`Copy as CLI`}),(0,Q.jsxs)(k,{type:`button`,variant:`ghost`,size:`sm`,className:`ms-auto`,onClick:()=>void s(),children:[i===`copied`?(0,Q.jsx)(eu,{"aria-hidden":`true`}):(0,Q.jsx)(uu,{"aria-hidden":`true`}),i===`copied`?`Copied`:`Copy`]})]}),(0,Q.jsx)(`pre`,{className:`m-0 rounded-lg border bg-muted px-2.5 py-2 font-mono text-xs/relaxed break-words whitespace-pre-wrap text-muted-foreground`,children:r}),(0,Q.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:i===`failed`?`Could not copy — select the line and copy it by hand.`:(0,Q.jsxs)(Q.Fragment,{children:[`The definition Save would create. `,(0,Q.jsxs)(`code`,{children:[hy(),` automation schema`]}),` prints its shape.`]})})]})}function GI({pressed:e,onClick:t,disabled:n,children:r}){return(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:C(Ls,`h-11 px-4 text-[13px]`,e&&`border-transparent bg-accent-strong text-accent-strong-foreground hover:bg-accent-strong hover:text-accent-strong-foreground`),children:r})}var KI=LF.options,qI=[{seconds:60,label:`1 minute`},{seconds:300,label:`5 minutes`},{seconds:900,label:`15 minutes`},{seconds:1800,label:`30 minutes`},{seconds:3600,label:`1 hour`}],JI=[{key:`authors`,label:`Authors`},{key:`assignees`,label:`Assignees`},{key:`allLabels`,label:`Has all labels`},{key:`anyLabels`,label:`Has any label`},{key:`excludeLabels`,label:`Excludes labels`},{key:`changedLabels`,label:`Changed labels`,hint:`Required for the two label events.`}],YI=e=>(e??[]).join(`, `),XI=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function ZI(e){return e?`Existing matches within the lookback are eligible on the next check. Previously processed matches will not run again.`:`Enabling starts from a current-time baseline. Existing matches will not launch tasks.`}function QI(e){let t=Math.max(1,Math.round(e.intervalSeconds/60));return`Polls GitHub every ${t} minute${t===1?``:`s`} for ${e.events.join(`, `)||`no events`}. ${ZI(e.filters.includeExisting)}`}function $I({draft:e,onChange:t,disabledReason:n}){let r=n=>{t({events:e.events.includes(n)?e.events.filter(e=>e!==n):[...e.events,n]})},i=n=>t({filters:{...e.filters,...n}}),a=(n,r)=>{let i=XI(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=qI.some(t=>t.seconds===e.intervalSeconds)?qI:[...qI,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,Q.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,Q.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`flex flex-wrap gap-2`,children:KI.map(t=>(0,Q.jsx)(GI,{pressed:e.events.includes(t),onClick:()=>r(t),children:t},t))}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-interval`,children:`Check every`}),(0,Q.jsxs)(QF,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,Q.jsx)(eI,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,Q.jsx)($F,{})}),(0,Q.jsx)(tI,{children:o.map(e=>(0,Q.jsx)(nI,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,Q.jsx)(uh,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,Q.jsx)(`span`,{children:`Include existing items`})]}),(0,Q.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:ZI(e.filters.includeExisting)})]}),(0,Q.jsxs)(jA,{children:[(0,Q.jsxs)(MA,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,Q.jsx)(ua,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,Q.jsx)(NA,{children:(0,Q.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[JI.map(t=>(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,Q.jsx)(rh,{id:`automation-filter-${t.key}`,placeholder:`comma separated`,value:YI(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,Q.jsx)(rh,{id:`automation-filter-lookback`,type:`number`,min:1,value:e.filters.lookbackDays,onChange:e=>i({lookbackDays:Math.max(1,Number(e.target.value)||1)})})]}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,Q.jsx)(rh,{id:`automation-filter-max`,type:`number`,min:1,value:e.filters.maxRecords,onChange:e=>i({maxRecords:Math.max(1,Number(e.target.value)||1)})})]})]})})]})]})}var eL=e=>String(e).padStart(2,`0`);function tL({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,Z.useState)(eL(t)),o=(0,Z.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${eL(n)}.`,l=(0,Z.useId)();return(0,Z.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(rh,{ref:o,"aria-label":e,"aria-invalid":s||void 0,"aria-describedby":s?l:void 0,inputMode:`numeric`,maxLength:2,className:`w-20 text-center tabular-nums`,value:i,onChange:e=>{a(e.target.value),/^\d{1,2}$/.test(e.target.value)&&Number(e.target.value)<=n&&r(Number(e.target.value))},onBlur:()=>a(eL(t))}),s?(0,Q.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}var nL=[{minutes:void 0,label:`No limit`},{minutes:30,label:`30 minutes`},{minutes:120,label:`2 hours`},{minutes:360,label:`6 hours`},{minutes:1440,label:`1 day`},{minutes:10080,label:`7 days`}],rL=`none`,iL=e=>String(e).padStart(2,`0`);function aL(e,t=Date.now()){let n=QP(t,e)??QP(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${iL(r.getUTCMonth()+1)}-${iL(r.getUTCDate())}T09:00`}function oL(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function sL({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?_F(e.at):null,a=e.at?.slice(0,10)??``,o=i?.hour??9,s=i?.minute??0,c=(e,t,n)=>r({at:`${e}T${iL(t)}:${iL(n)}`}),l=(0,Z.useRef)(null),u=(0,Z.useId)(),d=gF(e),f=!(t?.type===`once`&&t.at===e.at&&t.timeZone===e.timeZone)&&d!==null&&d<=Date.now();(0,Z.useEffect)(()=>{l.current?.setCustomValidity(f?dF:``)},[f]);let p=IF(e);return(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-once-date`,children:`Date`}),(0,Q.jsx)(rh,{ref:l,id:`automation-once-date`,type:`date`,className:`w-44 max-w-full`,value:a,"aria-invalid":f||void 0,"aria-describedby":f?u:void 0,onChange:e=>{/^\d{4}-\d{2}-\d{2}$/.test(e.target.value)&&c(e.target.value,o,s)},required:!0})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,Q.jsx)(tL,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,Q.jsx)(tL,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,Q.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:dF}):null,(0,Q.jsx)(lL,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,Q.jsx)(uL,{value:e.latestStartMinutes,onChange:t=>n(cL(e,t))}),p?(0,Q.jsx)(`p`,{className:`text-sm break-words`,children:`Runs once at ${p.time} on ${p.date} (${e.timeZone}). ${p.note?`${p.note} `:``}Squawk must be running then.`}):null]})}function cL(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function lL({value:e,onCommit:t}){let[n,r]=(0,Z.useState)(e),i=(0,Z.useRef)(null),a=(0,Z.useId)(),o=(0,Z.useId)(),[s]=(0,Z.useState)(oL),c=n!==e||!nF(n),l=pF(n);return(0,Z.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,Q.jsx)(rh,{ref:i,id:`automation-once-zone`,list:a,autoComplete:`off`,spellCheck:!1,className:`w-full sm:w-72`,value:n,"aria-invalid":c||void 0,"aria-describedby":c?o:void 0,onChange:e=>{r(e.target.value),nF(e.target.value)&&t(e.target.value)}}),(0,Q.jsx)(`datalist`,{id:a,children:s.map(e=>(0,Q.jsx)(`option`,{value:e},e))}),c?(0,Q.jsx)(`p`,{id:o,className:`text-xs break-words text-destructive`,children:l}):null]})}function uL({value:e,onChange:t}){let n=nL.some(t=>t.minutes===e)||e===void 0?nL:[...nL,{minutes:e,label:`${e} minutes`}];return(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,Q.jsxs)(QF,{value:e===void 0?rL:String(e),onValueChange:e=>t(e===rL?void 0:Number(e)),children:[(0,Q.jsx)(eI,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,Q.jsx)($F,{})}),(0,Q.jsx)(tI,{children:n.map(e=>(0,Q.jsx)(nI,{value:e.minutes===void 0?rL:String(e.minutes),children:e.label},e.label))})]}),(0,Q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`If Squawk was not running at the time, it still starts the task this long afterwards; later, the schedule is marked missed.`})]})}var dL=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}];function fL({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??aL(r),timeZone:e.timeZone??r}:{type:t});return(0,Q.jsxs)(`div`,{className:`grid gap-4`,children:[(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`flex flex-wrap gap-2`,children:dL.map(t=>(0,Q.jsx)(GI,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,Q.jsx)(sL,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`flex flex-wrap gap-2`,children:aF.map((t,n)=>(0,Q.jsx)(GI,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-every`,children:`Run every`}),(0,Q.jsxs)(QF,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,Q.jsx)(eI,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,Q.jsx)($F,{})}),(0,Q.jsx)(tI,{children:iF.map(e=>(0,Q.jsx)(nI,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Counted from midnight, so “every 6 hours” runs at 00:00, 06:00, 12:00 and 18:00.`})]}):(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,Q.jsx)(tL,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,Q.jsx)(tL,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,Q.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,Q.jsx)(`code`,{className:`font-mono text-foreground`,children:wF(e)})]})]})}var pL=40*864e5,mL=5;function hL({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,Q.jsx)(gL,{schedule:e,now:n});let r=EF(e,n+1,n+pL,t,mL);return(0,Q.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,Q.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Next 5 runs`}),r.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,Q.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid gap-1.5 text-sm`,children:r.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`font-medium tabular-nums`,children:AF(new Date(e).toISOString(),t)}),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:DF(n,e)})]},e))}),(0,Q.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this Squawk runs in.`]})]})}function gL({schedule:e,now:t}){let n=gF(e),r=IF(e);return(0,Q.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,className:`rounded-xl border bg-card p-4`,children:[(0,Q.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-[15px] font-medium`,children:`Runs once`}),n===null||!r?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,Q.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,Q.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:DF(t,n)}):null]}),r?.note?(0,Q.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,Q.jsx)(`p`,{className:`mt-3 text-xs break-words text-muted-foreground`,children:`Times are in ${e.timeZone??`UTC`}. Squawk must be running then; afterwards the schedule is archived with its task.`})]})}var _L={schedule:`On a schedule`,github:`When GitHub changes`};function vL(e){return/time zone|due time/i.test(e)?`when`:/placeholder|prompt|workflow|runner|model|task|autonomous/i.test(e)?`run`:/\bname\b/i.test(e)?`name`:/schedule|github|event|filter|label|interval|remote|forge|lookback|records?|hour|minute|poll|kind|archived/i.test(e)?`when`:`form`}function yL({title:e,failure:t,section:n,children:r}){return(0,Q.jsxs)(`fieldset`,{className:`grid min-w-0 gap-4 rounded-xl border p-5 max-md:p-4!`,children:[(0,Q.jsx)(`legend`,{className:`px-0`,children:e}),r,t?.section===n&&!t.conflict?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:t.message}):null]})}function bL({draft:e,patch:t,forge:n,automation:r}){return(0,Q.jsx)(Q.Fragment,{children:r?(0,Q.jsxs)(`p`,{className:`text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),_L[e.kind]]}):(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,Q.jsx)(tP,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:e.kind,onChange:e=>t({kind:e}),options:[{value:`schedule`,label:_L.schedule},{value:`github`,label:_L.github,disabled:!n.available,...n.available?{}:{title:n.reason??`GitHub is unavailable`}}]}),n.available?null:(0,Q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${n.reason??`no GitHub access`}`})]})})}function xL({draft:e,patch:t,forge:n,timeZone:r,automation:i}){return e.kind===`schedule`?(0,Q.jsx)(fL,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,Q.jsx)($I,{draft:e,onChange:t,...n.available?{}:{disabledReason:n.reason??`no GitHub access`}})}function SL({draft:e,patch:t,saving:n,automation:r}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,Q.jsx)(ew,{id:`automation-prompt`,value:e.prompt,onChange:e=>t({prompt:e.target.value}),rows:4,required:!0}),(0,Q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,Q.jsxs)(Q.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,Q.jsxs)(Q.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),(0,Q.jsx)(TL,{draft:e,patch:t}),(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,Q.jsx)(uh,{"aria-label":`Autonomous`,checked:e.autonomous,onCheckedChange:e=>t({autonomous:e})}),(0,Q.jsxs)(`span`,{children:[`Autonomous `,(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`· runs without waiting for answers`})]})]}),(0,Q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`Each run is an ordinary task in its own worktree, queued behind the parallel cap.`}),(0,Q.jsx)(HO,{archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,Q.jsx)(WO,{allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),r?(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]})}function CL({draft:e,patch:t,automation:n}){let r=e.kind===`schedule`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,Q.jsx)(uh,{"aria-label":n?`Enabled`:`Enable after saving`,checked:e.enabled,onCheckedChange:e=>t({enabled:e})}),(0,Q.jsx)(`span`,{children:n?`Enabled`:`Enable after saving`})]}),(0,Q.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:r&&e.schedule.type===`once`?`It runs once at the time set above, then moves to Archived with its task.`:r?`The first run is the next occurrence shown beside the schedule.`:ZI(e.filters.includeExisting)})]})}function wL({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,o]=(0,Z.useState)(()=>OI(e)),[s,c]=(0,Z.useState)(e?.revision),[l,u]=(0,Z.useState)(),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(``),y=e=>o(t=>({...t,...e})),b=async t=>{if(t.preventDefault(),d)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}f(!0),u(void 0);let i=`save`;try{if(e&&s!==void 0){let{automation:t}=await Jt(e.id,NI({...a,enabled:e.enabled},s));c(t.revision),a.enabled!==e.enabled&&(i=`enable`,await st(e.id,a.enabled))}else await nt(MI(a));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof et&&t.status===409&&/revision conflict/i.test(n)?u({section:`form`,message:`Edited elsewhere — reload to see the latest version`,conflict:!0}):u({section:i===`enable`?`enable`:vL(n),message:n})}finally{f(!1)}},x=async()=>{if(!(!e||h)){g(!0),v(``);try{await Oe(e.id),r()}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(!1)}}},S=e?`Save changes`:a.enabled?`Save and enable`:`Save paused`,C=a.kind===`schedule`;return(0,Q.jsx)(aI,{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,children:(0,Q.jsxs)(`form`,{className:`automation-editor grid min-w-0 gap-5 md:grid-cols-[minmax(0,1fr)_320px] md:items-start`,onSubmit:b,children:[(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,Q.jsx)(yL,{title:`Name`,section:`name`,failure:l,children:(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(ih,{htmlFor:`automation-name`,children:`Name`}),(0,Q.jsx)(rh,{id:`automation-name`,value:a.name,onChange:e=>y({name:e.target.value}),required:!0})]})}),(0,Q.jsxs)(yL,{title:`When`,section:`when`,failure:l,children:[(0,Q.jsx)(bL,{draft:a,patch:y,forge:t,automation:e}),(0,Q.jsx)(xL,{draft:a,patch:y,forge:t,timeZone:n,automation:e})]}),(0,Q.jsx)(yL,{title:`What to run`,section:`run`,failure:l,children:(0,Q.jsx)(SL,{draft:a,patch:y,saving:d,automation:e})}),(0,Q.jsx)(yL,{title:`Enable`,section:`enable`,failure:l,children:(0,Q.jsx)(CL,{draft:a,patch:y,automation:e})}),l?.section===`form`?(0,Q.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,Q.jsx)(`span`,{className:`break-words`,children:l.message}),l.conflict&&i?(0,Q.jsx)(k,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(k,{type:`submit`,disabled:d,children:d?`Saving…`:S}),(0,Q.jsx)(k,{type:`button`,variant:`outline`,asChild:!0,children:(0,Q.jsx)(Y,{to:`/automations`,children:`Cancel`})})]}),e?(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[p?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(k,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:h,onClick:()=>void x(),children:`Delete automation`}),(0,Q.jsx)(k,{type:`button`,variant:`outline`,disabled:h,onClick:()=>{m(!1),v(``)},children:`Keep`})]})]}):(0,Q.jsx)(k,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>m(!0),children:`Delete`}),_?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:_}):null]}):null]}),(0,Q.jsxs)(`aside`,{className:`min-w-0 md:sticky md:top-4`,children:[C?(0,Q.jsx)(hL,{schedule:a.schedule,timeZone:n}):(0,Q.jsxs)(`section`,{className:`rounded-xl border bg-card p-4`,children:[(0,Q.jsx)(`h2`,{className:`mb-2 text-[15px] font-medium`,children:`How it polls`}),(0,Q.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:QI(a)})]}),(0,Q.jsx)(WI,{draft:a})]})]})})}function TL({draft:e,patch:t}){let n=un(),r=Wn(),i=ur(),a=Oi(),o=e.runner??i.data?.defaultRunner??`claude`,s=Cn(o),c=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],l=[...new Set([...de(r.data,a.data),...e.runner?[e.runner]:[]])],u=tc(o,a.data,s.data,[e.model]),d=u.find(t=>t.id===(e.model??``))?.label??e.model??`auto`,f=e=>(0,Q.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,Q.jsx)(Js,{children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)($s,{slot:`automation-workflow-pill`,icon:f(Ca),fieldLabel:!0,ariaLabel:`Workflow`,label:e.workflow??`inline steps`,value:e.workflow??``,disabled:e.workflow===void 0,disabledHint:`This automation carries its own steps.`,options:c.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,Q.jsx)($s,{slot:`automation-runner-pill`,icon:f(sa),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner??`default`,value:e.runner??``,disabled:!a.data,options:[{value:``,label:`default`,desc:`The project’s default runner`},...l.map(e=>({value:e,label:Ei(a.data,e)}))],onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,Q.jsx)($s,{slot:`automation-model-pill`,icon:f(Ea),fieldLabel:!0,ariaLabel:`Model`,label:d,value:e.model??``,options:u.map(e=>({value:e.id,label:e.label,desc:e.desc})),onPick:e=>t({model:e||void 0})})]})})}function EL({data:e,error:t,refresh:n,archived:r=!1,onArchivedChange:i}){let[a,o]=(0,Z.useState)({}),[s,c]=(0,Z.useState)({}),l=(e,t)=>o(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),u=async(e,t)=>{c(t=>({...t,[e]:!0}));try{await t()}catch(t){l(e,{text:t instanceof Error?t.message:String(t),tone:`error`})}finally{c(t=>({...t,[e]:!1}))}},d=e=>u(e.id,async()=>{l(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await wt(e.id);l(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),f=e=>u(e.id,async()=>{l(e.id,void 0),await st(e.id,!e.enabled),await n()}),p=e=>u(e.id,async()=>{l(e.id,void 0),await at(e.id),await n()}),m=e=>u(e.id,async()=>{l(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await gt(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await Le(t);if(r.status===`complete`){l(e.id,{text:`${r.matches??0} filter match${r.matches===1?``:`es`} found; no tasks launched. Counts can include closed items and previously processed events.`,tone:`info`}),n();return}if(r.status===`error`)throw Error(r.error??`Preview failed`);await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)});return(0,Q.jsx)(aI,{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,action:(0,Q.jsx)(k,{asChild:!0,children:(0,Q.jsx)(Y,{to:`/automations/new`,children:`New automation`})}),children:t&&!e?(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,Q.jsx)(oI,{text:t}),(0,Q.jsx)(k,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(DL,{data:e}),i?(0,Q.jsx)(`div`,{className:`mb-4 flex flex-wrap gap-2`,children:(0,Q.jsx)(GI,{pressed:r,onClick:()=>i(!r),children:`Archived`})}):null,r&&e.automations.length===0?(0,Q.jsx)(oI,{text:`No archived one-time schedules.`}):e.automations.length===0?(0,Q.jsx)(X,{icon:(0,Q.jsx)(ga,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,Q.jsx)(k,{asChild:!0,children:(0,Q.jsx)(Y,{to:`/automations/new`,children:`New automation`})})}):(0,Q.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:e.automations.map(t=>(0,Q.jsx)(RL,{automation:t,timeZone:e.timeZone,note:a[t.id],busy:s[t.id]===!0,onRun:()=>void d(t),onToggle:()=>void f(t),onPreview:()=>void m(t),onCancel:()=>void p(t)},t.id))})]}):(0,Q.jsx)(oI,{text:`Loading automations…`})})}function DL({data:e}){return(0,Q.jsx)(`p`,{"data-slot":`automation-scheduler`,className:C(`mb-4 text-xs break-words`,e.scheduler.state===`scheduled`?`text-success`:`text-muted-foreground`),children:`Scheduler ${e.scheduler.state===`scheduled`?`running`:`idle`} · GitHub ${e.available?`available`:`unavailable`}${e.reason?` · ${e.reason}`:``} · ${e.timeZone}`})}function OL(e){return e.kind===`schedule`&&e.schedule?xF(e.schedule):`on ${(e.events??[]).join(`, `)} · every ${Math.round((e.intervalSeconds??300)/60)} min`}var kL={waiting:{label:`Waiting`,dot:`success`},paused:{label:`Paused`,dot:`neutral`},failed:{label:`Failed`,dot:`danger`},missed:{label:`Missed`,dot:`pending`},archived:{label:`Archived`,dot:`neutral`}};function AL(e){if(e.schedule?.type===`once`)return kL[e.onceStatus??(e.enabled?`waiting`:`paused`)]}function jL({automation:e,badge:t}){return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,Q.jsx)(e.kind===`schedule`?Xi:Ri,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,Q.jsx)(`p`,{className:`mt-1.5 text-[13px] break-words text-muted-foreground`,children:OL(e)})]}),t?(0,Q.jsx)(MM,{dot:t.dot,children:t.label}):(0,Q.jsx)(MM,{dot:e.enabled?`success`:`neutral`,children:e.enabled?`Enabled`:`Paused`})]})}function ML({automation:e,archive:t}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`mt-3 text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,Q.jsxs)(Q.Fragment,{children:[` · `,(0,Q.jsx)(Y,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,Q.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:(0,Q.jsx)(k,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(Y,{to:`/automations/${e.id}`,children:`Details`})})})]})}function NL({automation:e,timeZone:t}){let n=e.kind===`schedule`,r=e.enabled&&n?e.nextRunAt:void 0;return(0,Q.jsx)(`p`,{className:`mt-3 text-sm`,children:!n&&e.enabled?(0,Q.jsx)(`span`,{children:`continuous`}):r?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{children:`Next run: ${AF(r,t)}`}),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:` · ${DF(Date.now(),Date.parse(r))}`})]}):(0,Q.jsx)(`span`,{children:`Next run: —`})})}function PL({automation:e,timeZone:t}){let n=e.enabled?qF(e.state):void 0;return n?(0,Q.jsxs)(`p`,{role:`alert`,"data-slot":`automation-failing`,className:`mt-3 text-sm break-words text-destructive`,children:[`The last ${n.consecutiveFailures} checks failed: ${n.lastError}`,n.retryAt?(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${AF(n.retryAt,t)}`}):null]}):null}function FL({automation:e,busy:t,confirmingCancel:n,cancelRef:r,onToggle:i,onRun:a,onPreview:o,onOpenCancel:s}){let c=e.kind===`schedule`,l=e.schedule?.type===`once`;return(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,Q.jsx)(k,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(Y,{to:`/automations/${e.id}`,children:`Edit`})}),(0,Q.jsx)(k,{variant:`outline`,asChild:!0,children:(0,Q.jsx)(Y,{to:`/automations/${e.id}/log`,children:`Execution log`})}),(0,Q.jsx)(k,{variant:`outline`,"data-action":`automation-toggle`,disabled:t,onClick:i,children:e.enabled?`Pause`:`Enable`}),c?(0,Q.jsx)(k,{variant:`outline`,"data-action":`automation-run`,disabled:t,onClick:a,children:`Run now`}):(0,Q.jsx)(k,{variant:`outline`,"data-action":`automation-preview`,disabled:t,onClick:o,children:`Test filter`}),l&&!n?(0,Q.jsx)(k,{variant:`outline`,ref:r,"data-action":`automation-cancel`,disabled:t,onClick:s,children:`Cancel`}):null]})}function IL({automation:e,busy:t,keepRef:n,onConfirm:r,onKeep:i}){return(0,Q.jsxs)(`div`,{className:`mt-3 grid justify-items-start gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsx)(k,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,Q.jsx)(k,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function LL({note:e}){return(0,Q.jsxs)(`p`,{role:e.tone===`error`?`alert`:`status`,className:C(`mt-3 text-sm break-words`,e.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[e.text,e.runId?(0,Q.jsxs)(Q.Fragment,{children:[` · `,(0,Q.jsx)(Y,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`})]}):null]})}function RL({automation:e,timeZone:t,note:n,busy:r,onRun:i,onToggle:a,onPreview:o,onCancel:s}){let[c,l]=(0,Z.useState)(!1),u=(0,Z.useRef)(null),d=(0,Z.useRef)(null),f=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let e=f.current===`keep`?d.current:f.current===`cancel`?u.current:null;f.current=null,e?.focus()},[c]);let p=()=>{f.current=`keep`,l(!0)},m=()=>{f.current=`cancel`,l(!1)},h=e.archived;return(0,Q.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`min-w-0 rounded-xl border bg-card p-4`,children:[(0,Q.jsx)(jL,{automation:e,badge:AL(e)}),h?(0,Q.jsx)(ML,{automation:e,archive:h}):null,h?null:(0,Q.jsx)(NL,{automation:e,timeZone:t}),h?null:(0,Q.jsx)(PL,{automation:e,timeZone:t}),h?null:(0,Q.jsx)(FL,{automation:e,busy:r,confirmingCancel:c,cancelRef:u,onToggle:a,onRun:i,onPreview:o,onOpenCancel:p}),e.schedule?.type===`once`&&!h&&c?(0,Q.jsx)(IL,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,Q.jsx)(LL,{note:n}):null,(0,Q.jsx)(hI,{automationId:e.id,automationName:e.name,timeZone:t})]})}function zL(e){let t=Ss(),n=Av(),[r,i]=(0,Z.useState)(),[a,o]=(0,Z.useState)(``),s=(0,Z.useCallback)(t=>pe({signal:t,...e?{archived:e}:{}}).then(e=>{t?.aborted||(i(e),o(``))}).catch(e=>{t?.aborted||o(String(e))}),[e]);return(0,Z.useEffect)(()=>{n&&s()},[n,s]),(0,Z.useEffect)(()=>P(async e=>{n&&await s(e)}),[n,s]),(0,Z.useEffect)(()=>rl((e,n)=>{if(e!==`automation-change`)return;let r=n;typeof r.project==`string`&&(t===null||r.project===t)&&s()}),[t,s]),{data:r,error:a,refresh:s}}function BL({mode:e=`list`}){let{automationId:t}=s(),n=gs(),[r,i]=(0,Z.useState)(!1),{data:a,error:o,refresh:c}=zL(e===`list`?r?`only`:void 0:`include`),[l,u]=(0,Z.useState)(0),d=kv();if(d===`unknown`)return(0,Q.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,Q.jsx)(oI,{text:`Loading automations…`})});if(d===`unavailable`)return(0,Q.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,Q.jsx)(X,{icon:(0,Q.jsx)(ga,{}),tone:`neutral`,title:`Automations are off`,subtitle:`This server does not run schedules, poll GitHub or launch tasks from them. Unset CEZ_AUTOMATIONS or set it to 1 and restart Squawk to turn automations on.`,heading:`h2`})});let f=()=>{n(`/automations`),c()},p=a?.automations.find(e=>e.id===t);if(e===`list`)return(0,Q.jsx)(EL,{data:a,error:o,refresh:c,archived:r,onArchivedChange:i});if(!a)return o?(0,Q.jsx)(aI,{title:`Automations`,subtitle:`Could not load automations.`,children:(0,Q.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,Q.jsx)(oI,{text:o}),(0,Q.jsx)(k,{variant:`outline`,onClick:()=>void c(),children:`Retry`})]})}):(0,Q.jsx)(`div`,{"data-route":`automations`,className:`task-flow-page flex min-h-full flex-col`,children:(0,Q.jsx)(oI,{text:`Loading automations…`})});let m={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,Q.jsx)(wL,{forge:m,timeZone:a.timeZone,onSaved:f}):e===`edit`?p?p.archived?(0,Q.jsx)(gI,{automation:p,timeZone:a.timeZone,onDeleted:f}):(0,Q.jsx)(wL,{automation:p,forge:m,timeZone:a.timeZone,onSaved:f,onReload:()=>void c().then(()=>u(e=>e+1))},`${p.id}:${l}`):(0,Q.jsx)(aI,{title:`Automation not found`,subtitle:`This automation may have been removed.`,children:(0,Q.jsx)(k,{asChild:!0,variant:`outline`,children:(0,Q.jsx)(Y,{to:`/automations`,children:`Back to automations`})})}):t?(0,Q.jsx)(mI,{automationId:t,automationName:p?.name,timeZone:a.timeZone,readOnly:!!p?.archived}):(0,Q.jsx)(oI,{text:`Automation not found.`})}function VL({health:e,projects:t,repository:n,onAction:r}){return(0,Q.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-6 max-md:p-4`,"aria-labelledby":`add-project-heading`,children:[(0,Q.jsx)(`h2`,{id:`add-project-heading`,className:`text-lg font-normal leading-[1.5]`,children:`Add project`}),(0,Q.jsx)(`p`,{className:`text-[13px] leading-[1.5] text-muted-foreground`,children:`Start a new repository, open an existing local folder, or clone a GitHub repository.`}),(0,Q.jsxs)(`dl`,{className:`space-y-4 text-[13px] leading-[1.5] text-muted-foreground`,children:[e.data?.repoRoot?(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,Q.jsx)(`dt`,{children:`Local folder`}),(0,Q.jsx)(`dd`,{className:`min-w-0 break-all`,children:e.data.repo?.root??e.data.repoRoot})]}):null,n?(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,Q.jsx)(`dt`,{children:`Repository`}),(0,Q.jsx)(`dd`,{className:`min-w-0 break-all`,children:n.replace(/^https:\/\//,``)})]}):null,t.data?.projectsDir?(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-3`,children:[(0,Q.jsx)(`dt`,{children:`Checkout folder`}),(0,Q.jsx)(`dd`,{className:`min-w-0 break-all`,children:t.data.projectsDir})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(k,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,"data-action":`new-project`,onClick:()=>r(`new`),children:`New project`}),(0,Q.jsx)(k,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,onClick:()=>r(`local`),children:`Open local folder`}),(0,Q.jsx)(k,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,onClick:()=>r(`clone`),children:`Clone from GitHub`})]})]})}function HL({health:e,copying:t,onCopy:n}){return(0,Q.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-border bg-card p-6 max-md:p-4`,"aria-labelledby":`tools-heading`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`h2`,{id:`tools-heading`,className:`text-lg font-normal leading-[1.5]`,children:`Tools diagnostics`}),(0,Q.jsx)(Y,{to:Hx,"data-slot":`tools-settings`,className:Ux,children:`Tool settings ›`})]}),(0,Q.jsx)(`p`,{className:`text-[13px] leading-[1.5] text-muted-foreground`,children:`Check the tools available to this local workspace.`}),e.isError?(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Could not refresh tool diagnostics. Recheck to retry.`}):null,!e.data&&!e.isError?(0,Q.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Checking installed tools…`}):null,e.data?(0,Q.jsx)(`dl`,{className:`space-y-4 text-[13px] leading-[1.5] text-muted-foreground`,children:e.data.checks.map(e=>{let t=Vx(e);return(0,Q.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":e.available,className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,Q.jsxs)(`dt`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)($,{tone:zx(e)}),(0,Q.jsx)(`span`,{className:`font-mono text-[13px] font-medium text-foreground`,children:e.name})]}),(0,Q.jsxs)(`dd`,{className:`flex min-w-0 flex-1 items-center gap-x-3 text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`min-w-0 break-words`,children:[Bx(e),e.version?` · ${e.version}`:``]}),e.available?null:(0,Q.jsx)(Y,{to:Hx,"data-slot":`tool-setup`,className:`${Ux} ml-auto`,children:`Set up ›`})]}),t?(0,Q.jsx)(`dd`,{"data-slot":`tool-hint`,className:`basis-full min-w-0 break-words pl-[15px] text-xs leading-snug text-muted-foreground`,children:t}):null]},e.name)})}):null,e.data?.checks.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tool diagnostics reported by this server.`}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(k,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:e.isFetching?`Checking tools…`:`Recheck tools`}),(0,Q.jsx)(k,{variant:`outline`,className:`h-10 rounded-lg px-[15px] text-xs font-normal leading-[18px]`,disabled:!e.data||t,onClick:()=>void n(),children:t?`Copying…`:`Copy diagnostics`})]})]})}function UL(){let e=En(),t=bn(),n=Cr(e.data?.repo?.remote),[r,i]=(0,Z.useState)(null),[a,o]=(0,Z.useState)(!1);return(0,Q.jsxs)(`div`,{"data-route":`workspace-tools`,className:`w-full space-y-[22px] px-9 py-9 max-md:px-[18px] max-md:py-6`,children:[(0,Q.jsx)(`h1`,{className:`text-[28px] font-normal leading-[1.5] max-md:text-[24px]`,children:`Workspace tools`}),(0,Q.jsx)(VL,{health:e,projects:t,repository:n,onAction:i}),(0,Q.jsx)(HL,{health:e,copying:a,onCopy:async()=>{if(!(!e.data||a)){o(!0);try{await navigator.clipboard.writeText(JSON.stringify({version:e.data.version,checks:e.data.checks},null,2)),G(`Diagnostics copied`)}catch{G(`Could not copy diagnostics. Please try again.`,{tone:`danger`})}finally{o(!1)}}}}),r===`new`?(0,Q.jsx)(Ch,{open:!0,onOpenChange:e=>{e||i(null)}}):null,r===`local`?(0,Q.jsx)(th,{open:!0,onOpenChange:e=>{e||i(null)}}):null,r===`clone`?(0,Q.jsx)(oh,{open:!0,onOpenChange:e=>{e||i(null)}}):null]})}var WL=(0,Z.lazy)(()=>W(()=>import(`./task-thread-Bm755mTM.js`).then(e=>({default:e.TaskThreadRoute})),__vite__mapDeps([35,5,7,8,9,27,10,11,26,28,29,30,12,36,13,23,21,22,37,38,39,20,16,17,40,41,42,43,24,33,34,4,44,45,46,19,18,47,32,48,49,50]))),GL=(0,Z.lazy)(()=>W(()=>import(`./task-changes-Fj_aEo7v.js`).then(e=>({default:e.TaskChangesRoute})),__vite__mapDeps([51,5,7,8,9,10,11,26,27,28,29,30,12,36,13,23,21,22,37,39,38,20,16,17,40,41,42,43,24,33,34,4,44,45,52,53,46,32,54,55,56,48]))),KL=(0,Z.lazy)(()=>W(()=>import(`./task-files-HfwuKxjl.js`).then(e=>({default:e.TaskFilesRoute})),__vite__mapDeps([57,5,7,8,9,10,11,26,27,28,29,30,12,22,13,39,36,23,21,37,38,20,16,17,40,41,42,43,24,33,34,4,44,45,31,32]))),qL=(0,Z.lazy)(async()=>{let{TaskReportRoute:e}=await W(async()=>{let{TaskReportRoute:e}=await import(`./report-reader-TX7SV7cO.js`);return{TaskReportRoute:e}},__vite__mapDeps([25,5,7,8,9,10,11,26,27,28,29,30,12,22,31,13,32,33,34,4]));return{default:e}}),JL=(0,Z.lazy)(()=>W(()=>import(`./task-commits-B0Ezfa9a.js`).then(e=>({default:e.TaskCommitsRoute})),__vite__mapDeps([58,5,7,8,9,10,11,26,27,28,29,30,12,36,13,23,21,22,37,39,38,20,16,17,40,41,42,43,24,33,34,4,44,45,32,59,53,46,55,56,48]))),YL=(0,Z.lazy)(()=>W(()=>import(`./task-github-item-B8bv9VSp.js`).then(e=>({default:e.TaskGithubItemRoute})),__vite__mapDeps([60,7,5,8,9,10,11,26,27,28,29,30,12,36,13,23,21,22,37,39,38,20,16,17,40,41,42,43,24,33,34,4,44,45,32,61,46,18,62,47,63,55,56,48,64]))),XL=(0,Z.lazy)(()=>W(()=>import(`./repo-git-DyuGJJ8w.js`).then(e=>({default:e.RepoGitRoute})),__vite__mapDeps([65,5,7,8,9,10,11,26,27,28,29,30,12,36,13,23,21,22,37,66,53,46,52,16,17,41,24,32,54,55,56,48,59,67]))),ZL=(0,Z.lazy)(()=>W(()=>import(`./github-D1ZGYZ6k.js`).then(e=>({default:e.GithubRoute})),__vite__mapDeps([68,5,7,8,9,10,11,26,27,28,29,30,12,36,13,23,21,22,37,66,17,62,24,47,38,43,42,63,32,61,46,40,18,33,34,4,55,56,48,44,64]))),QL=(0,Z.lazy)(()=>W(()=>import(`./reports-DC4T6nCI.js`).then(e=>({default:e.ReportsRoute})),__vite__mapDeps([69,5,7,8,9,10,11,28,30,24,49,70]))),$L=(0,Z.lazy)(()=>W(()=>import(`./workflows-DMaQulmN.js`).then(e=>({default:e.WorkflowsRoute})),__vite__mapDeps([71,5,7,8,9,10,11,26,27,28,29,30,12,22,21,23,42,43,72,63,32,73]))),eR=(0,Z.lazy)(()=>W(()=>import(`./activity-route-CeDmVBg_.js`).then(e=>({default:e.ProjectActivityRoute})),__vite__mapDeps([74,5,7,8,9,14,13,75,27,10,11,29,30,15,46,40,24,37,76]))),tR=(0,Z.lazy)(()=>W(()=>import(`./global-activity-route-BVmBGVep.js`).then(e=>({default:e.GlobalActivityRoute})),__vite__mapDeps([77,5,7,8,9,26,27,10,11,28,29,30,12,75,13,15,46,40,24,37,76]))),nR=(0,Z.lazy)(()=>W(()=>import(`./skills-DAe4cSA-.js`).then(e=>({default:e.SkillsRoute})),__vite__mapDeps([78,5,7,8,9,10,11,26,27,28,29,30,12,38,22,24,63])));function rR(){let e=a();return(0,Q.jsx)(xs,{to:{pathname:`/skills`,search:e.search,hash:e.hash},replace:!0})}function iR({sectionId:e}){let t=a();return(0,Q.jsx)(y,{to:{pathname:rj(`global`,e),search:t.search,hash:t.hash},replace:!0})}function aR(){return(0,Q.jsx)(`div`,{"data-route":`scope-resolving`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(`p`,{className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:`Loading…`})})}function oR(){let{projectId:e=``}=s(),t=a(),n=bn(),r=En();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,Q.jsx)(y,{to:`/p/${encodeURIComponent(e)}${n||`/`}${t.search}${t.hash}`,replace:!0})}if(!n.isError)return(0,Q.jsx)(aR,{})}if(n.data){if(!(n.data.bootProject===e||n.data.projects.some(t=>t.id===e)))return(0,Q.jsx)(Ck,{projectId:e,registry:n.data})}else if(!n.isError)return(0,Q.jsx)(aR,{});return(0,Q.jsx)(bt,{projectId:n.data?.bootProject===e?null:e,children:(0,Q.jsx)(v,{},e)})}function sR(){let{projectId:e=``}=s();return(0,Q.jsx)(sk,{},e)}var cR=/^\/tasks\/([0-9a-f-]{36})(?=\/|$)/i;function lR(e,t){let n=e.data?.bootProject??t.data?.bootProject;return{resolved:n,settled:(e.data!==void 0||e.isError)&&(t.data!==void 0||t.isError),boot:n??`default`}}function uR(e,t,n){if(!(e.pathname===`/`&&e.search===``&&e.hash===``))return;if(t.data===void 0&&!t.isError)return(0,Q.jsx)(aR,{});let r=$_(U_(),t.data,n);if(r!==null)return(0,Q.jsx)(y,{to:r,replace:!0})}function dR(e,t,n,r,i,a){if(!n)return null;let o=i.data?.runs.find(t=>t.id===e)?.projectId;return o===void 0?r?a.data===void 0&&!a.isError?null:a.data?.runs.find(t=>t.id===e)?.projectId??t:t:o}function fR(e,t){let n=t.pathname===`/p`||t.pathname===`/p/`?`/`:t.pathname;return(0,Q.jsx)(y,{to:`/p/${encodeURIComponent(e)}${n}${t.search}${t.hash}`,replace:!0})}function pR(){let e=a(),t=En(),n=bn(),r=cR.exec(e.pathname)?.[1]??null,i=Jn(r!==null),o=i.data!==void 0||i.isError,s=i.data!==void 0&&!i.data.runs.some(e=>e.id===r),c=br(r!==null&&s?r:``),{resolved:l,settled:u,boot:d}=lR(t,n);if(l===void 0&&!u)return(0,Q.jsx)(aR,{});let f=uR(e,n,l);if(f!==void 0)return f;let p=d;if(r!==null){let e=dR(r,d,o,s,i,c);if(e===null)return(0,Q.jsx)(aR,{});p=e}return fR(p,e)}function mR(){return(0,Q.jsxs)(f,{path:`/p/:projectId`,element:(0,Q.jsx)(oR,{}),children:[(0,Q.jsx)(f,{index:!0,element:(0,Q.jsx)(UN,{})}),(0,Q.jsx)(f,{path:`new`,element:(0,Q.jsx)(sR,{})}),(0,Q.jsx)(f,{path:`activity`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(tE,{}),children:(0,Q.jsx)(eR,{})})}),(0,Q.jsxs)(f,{path:`tasks/:id`,element:(0,Q.jsx)(kA,{}),children:[(0,Q.jsx)(f,{index:!0,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(kk,{}),children:(0,Q.jsx)(WL,{})})}),(0,Q.jsx)(f,{path:`changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Tk,{tab:`changes`}),children:(0,Q.jsx)(GL,{})})}),(0,Q.jsx)(f,{path:`files`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Tk,{tab:`files`}),children:(0,Q.jsx)(KL,{})})}),(0,Q.jsx)(f,{path:`report`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`div`,{"data-route":`task-report`,children:(0,Q.jsx)(`h1`,{className:`p-4 text-sm text-soft-foreground`,children:`Loading report…`})}),children:(0,Q.jsx)(qL,{})})}),(0,Q.jsx)(f,{path:`commits`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Tk,{tab:`changes`}),children:(0,Q.jsx)(JL,{})})}),(0,Q.jsx)(f,{path:`commits/:sha`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Tk,{tab:`changes`}),children:(0,Q.jsx)(JL,{})})}),(0,Q.jsx)(f,{path:`issue/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Ok,{kind:`issue`}),children:(0,Q.jsx)(YL,{kind:`issue`})})}),(0,Q.jsx)(f,{path:`pr/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Ok,{kind:`pr`}),children:(0,Q.jsx)(YL,{kind:`pr`})})})]}),(0,Q.jsx)(f,{path:`git`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(xk,{}),children:(0,Q.jsx)(XL,{section:`main`,index:!0})})}),(0,Q.jsx)(f,{path:`git/commits`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(xk,{}),children:(0,Q.jsx)(XL,{section:`main`})})}),(0,Q.jsx)(f,{path:`git/commits/:sha`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(xk,{}),children:(0,Q.jsx)(XL,{section:`main`})})}),(0,Q.jsx)(f,{path:`git/not-landed`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(xk,{}),children:(0,Q.jsx)(XL,{section:`not-landed`})})}),(0,Q.jsx)(f,{path:`git/cleanup`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(xk,{}),children:(0,Q.jsx)(XL,{section:`cleanup`})})}),(0,Q.jsx)(f,{path:`git/branches`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(xk,{}),children:(0,Q.jsx)(XL,{section:`branches`})})}),(0,Q.jsx)(f,{path:`git/changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(xk,{}),children:(0,Q.jsx)(XL,{section:`changes`})})}),(0,Q.jsx)(f,{path:`github`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(nE,{}),children:(0,Q.jsx)(ZL,{view:`issues`,index:!0})})}),(0,Q.jsx)(f,{path:`github/prs`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(nE,{}),children:(0,Q.jsx)(ZL,{view:`prs`})})}),(0,Q.jsx)(f,{path:`github/issues/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(nE,{}),children:(0,Q.jsx)(ZL,{view:`issues`})})}),(0,Q.jsx)(f,{path:`github/prs/:n`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(nE,{}),children:(0,Q.jsx)(ZL,{view:`prs`})})}),(0,Q.jsx)(f,{path:`github/prs/:n/changes`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(nE,{}),children:(0,Q.jsx)(ZL,{view:`prs`,changes:!0})})}),(0,Q.jsx)(f,{path:`automations`,element:(0,Q.jsx)(BL,{})}),(0,Q.jsx)(f,{path:`automations/new`,element:(0,Q.jsx)(BL,{mode:`new`})}),(0,Q.jsx)(f,{path:`automations/:automationId`,element:(0,Q.jsx)(BL,{mode:`edit`})}),(0,Q.jsx)(f,{path:`automations/:automationId/log`,element:(0,Q.jsx)(BL,{mode:`log`})}),(0,Q.jsx)(f,{path:`skills`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(Sk,{}),children:(0,Q.jsx)(nR,{})})}),(0,Q.jsx)(f,{path:`reports`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`p`,{role:`status`,children:`Loading reports…`}),children:(0,Q.jsx)(QL,{})})}),(0,Q.jsx)(f,{path:`workflows`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(wk,{}),children:(0,Q.jsx)($L,{})})}),(0,Q.jsx)(f,{path:`workflows/:name`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(wk,{}),children:(0,Q.jsx)($L,{})})}),(0,Q.jsx)(f,{path:`settings`,element:(0,Q.jsx)(lj,{})}),(0,Q.jsx)(f,{path:`settings/skills`,element:(0,Q.jsx)(rR,{})}),zT(`project`).map(e=>(0,Q.jsx)(f,{path:`settings/${e.id}`,element:(0,Q.jsx)(cj,{section:e,scope:`project`})},e.id)),zT(`global`).map(e=>(0,Q.jsx)(f,{path:`settings/${e.id}`,element:(0,Q.jsx)(iR,{sectionId:e.id})},e.id)),(0,Q.jsx)(f,{path:`*`,element:(0,Q.jsx)(yk,{})})]})}function hR(e){let t=M(ee(mR()),e),n=t?.at(-1);return!t||!n||n.route.path===`*`?null:{pattern:`/${t.slice(1).map(e=>e.route.path).filter(e=>e!==void 0).join(`/`)}`.replace(/\/$/,``)||`/`,params:n.params}}function gR(){return(0,Q.jsxs)(A,{children:[mR(),(0,Q.jsx)(f,{path:`/tasks`,element:(0,Q.jsx)(FP,{})}),(0,Q.jsx)(f,{path:`/tools`,element:(0,Q.jsx)(UL,{})}),(0,Q.jsx)(f,{path:`/activity`,element:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(tE,{}),children:(0,Q.jsx)(tR,{})})}),(0,Q.jsx)(f,{path:`/settings/global`,element:(0,Q.jsx)(y,{to:ij,replace:!0})}),(0,Q.jsx)(f,{path:`/settings/global/skills`,element:(0,Q.jsx)(y,{to:`/skills`,replace:!0})}),zT(`global`).map(e=>(0,Q.jsx)(f,{path:rj(`global`,e.id),element:(0,Q.jsx)(cj,{section:e,scope:`global`})},e.id)),(0,Q.jsx)(f,{path:`*`,element:(0,Q.jsx)(pR,{})})]})}function _R(){let[e]=(0,Z.useState)(Wl);return(0,Z.useEffect)(()=>Dr(e),[e]),(0,Q.jsx)(Kl,{children:(0,Q.jsx)(ie,{client:e,children:(0,Q.jsxs)(Sl,{children:[(0,Q.jsx)(Ul,{}),(0,Q.jsx)($T,{}),(0,Q.jsx)(bg,{children:(0,Q.jsx)(kw,{children:(0,Q.jsxs)(_,{children:[(0,Q.jsx)(QT,{}),(0,Q.jsx)(Gl.Provider,{value:hR,children:(0,Q.jsx)(Xa,{children:(0,Q.jsx)(ZT,{children:(0,Q.jsx)(gR,{})})})}),(0,Q.jsx)(Ci,{})]})})})]})})})}var vR=document.querySelector(`meta[name="cez-api-base"]`)?.getAttribute(`content`);u(ne(vR,void 0,void 0));var yR=document.getElementById(`root`);if(!yR)throw Error(`Squawk: #root container is missing from index.html`);(0,Pc.createRoot)(yR).render((0,Q.jsx)(Z.StrictMode,{children:(0,Q.jsx)(_R,{})}));export{kS as $,Ah as $t,bk as A,kb as At,oE as B,r_ as Bt,Nk as C,Ob as Ct,Tk as D,jb as Dt,Ek as E,xb as Et,$D as F,Nv as Ft,NC as G,Xg as Gt,tE as H,n_ as Ht,YD as I,Ov as It,TC as J,Ng as Jt,MC as K,Tg as Kt,QD as L,Av as Lt,tO as M,pb as Mt,rO as N,hy as Nt,wk as O,Pb as Ot,eO as P,Iv as Pt,jS as Q,jh as Qt,KD as R,V_ as Rt,Ik as S,Nb as St,Ok as T,Sb as Tt,ew as U,Zg as Ut,nE as V,e_ as Vt,yC as W,$g as Wt,RS as X,Mg as Xt,zS as Y,jg as Yt,PS as Z,$ as Zt,dA as _,tu as _n,hx as _t,lM as a,Hu as an,xS as at,$k as b,Yl as bn,Ab as bt,jA as c,Nu as cn,mS as ct,DA as d,wu as dn,lS as dt,kh as en,TS as et,TA as f,yu as fn,rS as ft,aA as g,nu as gn,oS as gt,lA as h,ru as hn,iS as ht,jM as i,Gu as in,dS as it,nO as j,yb as jt,xk as k,Cb as kt,NA as l,Au as ln,eS as lt,cA as m,uu as mn,aS as mt,oN as n,Xu as nn,CS as nt,cM as o,Ru as on,SS as ot,sA as p,hu as pn,sS as pt,EC as q,Ag as qt,MM as r,qu as rn,fS as rt,sM as s,Pu as sn,yS as st,DF as t,rh as tn,DS as tt,MA as u,Tu as un,cS as ut,Zk as v,eu as vn,Hb as vt,kk as w,Db as wt,Rk as x,Jl as xn,wb as xt,Qk as y,Ql as yn,Vb as yt,aE as z,t_ as zt};
|