@staff0rd/assist 0.934.4 → 0.934.5

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.
@@ -4019,7 +4019,7 @@ ${f.join(`
4019
4019
  `,mti=po`
4020
4020
  0%, 100% { transform: scale(1); }
4021
4021
  50% { transform: scale(1.08); }
4022
- `,ISr={content:'""',position:"absolute",borderRadius:"inherit",background:"conic-gradient(from calc(var(--rainbow-pill-h) * 1deg) in oklch longer hue, oklch(66% 0.21 0), oklch(66% 0.21 0))",animation:`${pti} 1.8s linear infinite`},gti={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${mti} 1.6s ease-in-out infinite`,"&::before":{...ISr,inset:0,zIndex:-1},"&::after":{...ISr,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:Gs.rainbowPill.text,textShadow:Gs.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function DSr({children:e}){return(0,$A.jsxs)($A.Fragment,{children:[(0,$A.jsx)(J_,{styles:hti}),(0,$A.jsx)(ie,{component:"span","data-testid":"rainbow-pill",sx:gti,children:e})]})}function NSr({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function OSr(e){if(e.length!==2)return!1;let[t,r]=e;return NSr(t)===NSr(r)}var fT=E($(),1);function W1e({rateLimits:e}){let t=c_(3e4),r=[{window:e.five_hour,windowSeconds:18e3,fallbackLabel:"5h"},{window:e.seven_day,windowSeconds:604800,fallbackLabel:"7d"}].filter(o=>o.window?.used_percentage!=null),n=OSr(r.map(o=>({pct:o.window?.used_percentage??0,timeLabel:H1e(o.window?.resets_at,o.fallbackLabel,t)}))),i=r.map((o,a)=>(0,fT.jsxs)(BSr.Fragment,{children:[a>0?(0,fT.jsx)(ie,{component:"span",sx:{color:o$,mr:.5},children:","}):null,(0,fT.jsx)(MSr,{window:o.window,windowSeconds:o.windowSeconds,fallbackLabel:o.fallbackLabel,now:t})]},o.fallbackLabel));return n?(0,fT.jsx)(DSr,{children:i}):(0,fT.jsx)(fT.Fragment,{children:i})}var k_=E($(),1);function $Sr({groups:e}){return(0,k_.jsx)(k_.Fragment,{children:e.map((t,r)=>(0,k_.jsxs)(FSr.Fragment,{children:[(0,k_.jsx)(ie,{component:"span",sx:{color:o$,ml:r>0?1:0,mr:.5},children:Mu(t.harness)}),(0,k_.jsx)(W1e,{rateLimits:t.rateLimits})]},t.harness))})}function yti(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function vti(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function bti(e,t,r,n){if(e>=t)return;let i=e/t;return Math.round(r-n*(1-i))}function USr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let i=yWe(t,r,n);if(i==null)return{kind:"unprojectable"};let o=l_(e,t,r,n),a=yti(o),s=vti(o);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*i,at:bti(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*i}}}function G1e(e){return t=>t.tokens.color.onAppBar.level[e]}function WSr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${r1e(e.at,t)}`}var N0=E($(),1);function $We({direction:e,threshold:t}){let r=e==="back",n={display:"inline-flex",gap:.5,minWidth:"6ch",justifyContent:r?"flex-end":"flex-start"};if(!t)return(0,N0.jsx)(ie,{component:"span",sx:n});let i=(0,N0.jsx)(ie,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,N0.jsxs)(ie,{component:"span",sx:{color:G1e(t.level)},children:[Math.round(t.pct),"%"]});return(0,N0.jsx)(ie,{component:"span",sx:n,children:r?(0,N0.jsxs)(N0.Fragment,{children:[o,i]}):(0,N0.jsxs)(N0.Fragment,{children:[i,o]})})}var __=E($(),1);function GSr({label:e,pct:t,resetsAt:r,windowSeconds:n,now:i}){let o=l_(t,r,n,i),a=USr(t,r,n,i),s=a.kind==="projected"?a:void 0;return(0,__.jsxs)(ie,{sx:{display:"flex",alignItems:"baseline",gap:.75},children:[(0,__.jsx)(ie,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,__.jsx)($We,{direction:"back",threshold:s?.recovery}),(0,__.jsxs)(ie,{component:"span",sx:{minWidth:"4ch",textAlign:"right",color:G1e(o)},children:[Math.round(t),"%"]}),(0,__.jsx)($We,{direction:"forward",threshold:s?.worse}),(0,__.jsx)(ie,{component:"span",sx:{opacity:.6},children:s?s.recovery&&WSr(s.recovery,i):"no projection yet"})]})}function VSr(e){return[{label:"5h",window:e.five_hour,windowSeconds:18e3},{label:"7d",window:e.seven_day,windowSeconds:604800}].flatMap(t=>t.window?.used_percentage==null?[]:[{label:t.label,pct:t.window.used_percentage,resetsAt:t.window.resets_at,windowSeconds:t.windowSeconds}])}var qSr=E($(),1);function V1e({rateLimits:e,now:t}){return VSr(e).map(r=>(0,qSr.jsx)(GSr,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var zA=E($(),1);function jSr({groups:e}){let t=c_(3e4);return(0,zA.jsxs)(ie,{sx:{fontFamily:"fontFamilyMono",fontSize:12},children:[e.map(r=>(0,zA.jsxs)(ie,{sx:{mb:.5},children:[(0,zA.jsx)(ie,{sx:{opacity:.8},children:Mu(r.harness)}),(0,zA.jsx)(V1e,{rateLimits:r.rateLimits,now:t})]},r.harness)),(0,zA.jsx)(ie,{sx:{mt:.5,opacity:.6},children:"Account usage per harness \u2014 view history"})]})}function YSr(e){return e?.five_hour?.used_percentage!=null||e?.seven_day?.used_percentage!=null}function KSr(e,t){let r=[];YSr(e)&&r.push({harness:"claude",rateLimits:e});for(let[n,i]of Object.entries(t))YSr(i)&&r.push({harness:n,rateLimits:i});return r}var xti={display:"flex",alignItems:"center",ml:2,fontFamily:"fontFamilyMono",fontSize:13},Tti={display:"flex",alignItems:"center",height:22,px:1,borderRadius:1,fontSize:"inherit","&:hover, &:focus-visible":{bgcolor:e=>e.tokens.color.statusBar?.hover,color:e=>e.tokens.color.statusBar?.hoverText}},XSr=e=>e?Tti:xti;var TX=E($(),1),zWe="Claude account usage (5h / 7d windows) \u2014 view history";function ZSr({rateLimits:e}){let t=c_(3e4);return(0,TX.jsxs)(ie,{sx:{fontFamily:"fontFamilyMono",fontSize:12},children:[(0,TX.jsx)(V1e,{rateLimits:e,now:t}),(0,TX.jsx)(ie,{sx:{mt:.5,opacity:.6},children:zWe})]})}var HA=E($(),1),Sti={};function q1e({rateLimits:e,harnessRateLimits:t=Sti,onStatusBar:r=!1}){let n=KSr(e,t),i=n.every(l=>l.harness==="claude"),o=e,a=zWe,s="Usage";return n.length>0&&i?(a=(0,HA.jsx)(ZSr,{rateLimits:o}),s=(0,HA.jsx)(W1e,{rateLimits:o})):n.length>0&&(a=(0,HA.jsx)(jSr,{groups:n}),s=(0,HA.jsx)($Sr,{groups:n})),(0,HA.jsx)(lr,{title:a,placement:r?"top-end":"bottom",children:(0,HA.jsx)(Kr,{component:ws,to:"/usage",underline:r?"none":"hover",color:"inherit",sx:XSr(r),children:s})})}var eCr=E(fe(),1);var E_="0.934.4";var j1e=E(fe(),1),HWe=(0,j1e.createContext)(null);function Y1e(){return(0,j1e.useContext)(HWe)}var UWe=E($(),1);function QSr(){let e=Y1e();return!e||e===E_?null:(0,UWe.jsx)(lr,{title:`Daemon is running v${e}, but this page was served by v${E_}. Restart the daemon to match.`,children:(0,UWe.jsx)(M1e,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var WWe=e=>e.tokens.color.statusBar,Cti={height:22,py:0,borderRadius:1,fontSize:"inherit",opacity:1,"&:hover, &:focus-visible":{bgcolor:e=>WWe(e)?.hover,color:e=>WWe(e)?.hoverText},"& .ready-count":{fontWeight:500,color:e=>WWe(e)?.readyText}},JSr=(e,t=!1)=>({display:"inline-flex",alignItems:"center",gap:.75,px:1,py:.25,borderRadius:999,fontSize:12,lineHeight:1.5,color:"inherit",opacity:e?1:.55,bgcolor:r=>e?w_(r).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{opacity:1,bgcolor:r=>w_(r).hover},"& .ready-dot":{width:t?6:8,height:t?6:8,borderRadius:"50%",bgcolor:r=>w_(r).dot,boxShadow:r=>`0 0 0 ${t?3:2}px ${w_(r).dotRing}`},"& .ready-count":{fontWeight:500},...t&&Cti});var sg=E($(),1);function K1e({onStatusBar:e=!1}){let{entries:t}=kF(),r=Oi(),n=(0,eCr.useCallback)(()=>r("/updates"),[r]),{matches:i,chords:o}=jn("openUpdates");if(Eo(i,n),!E_)return null;let a=t.filter(MF).length;return(0,sg.jsxs)(sg.Fragment,{children:[(0,sg.jsx)(lr,{describeChild:!0,placement:e?"top-start":"bottom",title:(0,sg.jsx)(Iu,{label:"Updates",chords:o}),children:(0,sg.jsxs)(pn,{component:ws,to:"/updates","aria-label":a?`Updates: ${a} node${a>1?"s have":" has"} an update ready`:"Updates",sx:JSr(a>0,e),children:[a>0&&(0,sg.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,sg.jsxs)("span",{children:["v",E_]}),a>0&&(0,sg.jsxs)("span",{className:"ready-count",children:[a," ready"]})]})}),(0,sg.jsx)(QSr,{})]})}var X1e=E($(),1);function tCr({socket:e}){return(0,X1e.jsx)(PSr,{start:(0,X1e.jsx)(K1e,{onStatusBar:!0}),end:(0,X1e.jsx)(q1e,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits,onStatusBar:!0})})}var tve=E(fe(),1);var eve=E(fe(),1);function rCr(e,t,r){if(!e)return"Select a repo to search files.";if(r.error)return"Couldn't search files in this repo.";if(!(r.files.length>0||r.loading))return t?"No matching files.":"No files in this repo."}var R_=E($(),1),wti={display:"flex",gap:1,alignItems:"center",minWidth:0},kti={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},_ti={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},Eti={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function Rti(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function nCr({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,R_.jsx)(Hp,{dense:!0,sx:{py:0},children:e.map((i,o)=>{let{dir:a,basename:s}=Rti(i);return(0,R_.jsxs)(ln,{selected:o===t,onMouseEnter:()=>r(o),onClick:()=>n(i),sx:wti,children:[(0,R_.jsx)(fB,{path:i}),(0,R_.jsxs)(ie,{sx:kti,children:[(0,R_.jsx)(Le,{component:"span",sx:_ti,children:s}),(0,R_.jsx)(Le,{component:"span",color:"text.secondary",sx:Eti,children:a})]})]},i)})})}var Z1e=E($(),1),Ati={maxHeight:420,overflowY:"auto"},Pti={px:2,py:2,fontSize:13};function iCr({message:e,files:t,highlight:r,onHighlight:n,onSelect:i}){return(0,Z1e.jsx)(ie,{sx:Ati,children:e?(0,Z1e.jsx)(Le,{color:"text.secondary",sx:Pti,children:e}):(0,Z1e.jsx)(nCr,{files:t,highlight:r,onHighlight:n,onSelect:i})})}var oCr=E($(),1),Lti={mt:6,alignSelf:"flex-start"};function Q1e({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,oCr.jsx)(Wl,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:Lti},transition:{onEntered:t}},children:n})}var J1e=E(fe(),1);var aCr={files:[],loading:!1,error:!1};function sCr(e,t){let[r,n]=(0,J1e.useState)(aCr),i=yr();return(0,J1e.useEffect)(()=>{if(!e){n(aCr);return}let o=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await fetch(qr(`/api/files?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,i));if(!s.ok)throw new Error(`HTTP ${s.status}`);let l=await s.json();if(o)return;n({files:Array.isArray(l.files)?l.files:[],loading:!1,error:!1})}catch{o||n({files:[],loading:!1,error:!0})}})(),()=>{o=!0}},[e,t,i]),r}var UA=E($(),1);function Mti(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function lCr({onClose:e}){let{worktreeNode:t}=$n();return(0,UA.jsx)(mf.Provider,{value:t,children:(0,UA.jsx)(Iti,{onClose:e})})}function Iti({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=$n(),[n,i]=(0,eve.useState)(""),o=sCr(t,n),a=Oi(),s=(0,eve.useRef)(null),l=p=>a(Mti(p,t,r)),{highlight:u,setHighlight:f,onKeyDown:d}=g_(o.files,n,l,e),h=p=>{l(p),e()};return(0,UA.jsxs)(Q1e,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,UA.jsx)(gS,{autoFocus:!0,inputRef:s,value:n,onChange:i,onKeyDown:d,placeholder:"Search files by name..."}),(0,UA.jsx)(iCr,{message:rCr(t,n,o),files:o.files,highlight:u,onHighlight:f,onSelect:h})]})}function cCr(e){Eo(jn("quickOpen").matches,e)}var fCr=E($(),1);function uCr(){let[e,t]=(0,tve.useState)(!1);return cCr((0,tve.useCallback)(()=>t(!0),[])),e?(0,fCr.jsx)(lCr,{onClose:()=>t(!1)}):null}var rve=E($(),1);function dCr({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,rve.jsx)(Bh,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,rve.jsx)(yi,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,rve.jsx)(Dt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var wX=E(fe(),1);function hCr(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var _Cr=E(fe(),1);var pCr=E($(),1),mCr=st((0,pCr.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2"}),"Circle");var Dti={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function gCr(e){return e?Dti[e]:"success.main"}function yCr(e){return e.split("-")[0].split(".").map(Number)}function vCr(e,t){if(!e||!t||e===t)return;let r=yCr(e),n=yCr(t);for(let i=0;i<Math.max(r.length,n.length);i++){let o=(r[i]??0)-(n[i]??0);if(Number.isNaN(o))return;if(o!==0)return o<0?"behind":"ahead"}}var WA=E($(),1),Nti={height:16,fontSize:10},Oti={opacity:.6,fontSize:"0.85em"};function Bti(e,t){if(t===e.local)return"this machine";let r=e.links.find(n=>n.name===t);return r?r.error?`${r.state}: ${r.error}`:r.state:""}function SX({nodes:e,name:t,showVersion:r=!1}){let n=Y1e()??E_,i=e.links.find(a=>a.name===t),o=vCr(i?.peerVersion,n);return(0,WA.jsx)(lr,{title:Bti(e,t),placement:"right",children:(0,WA.jsxs)(ie,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,WA.jsx)(mCr,{sx:{fontSize:8,color:gCr(i?.state)}}),t,r&&i?.peerVersion&&(0,WA.jsxs)(ie,{component:"span",sx:Oti,children:["v",i.peerVersion]}),o&&(0,WA.jsx)(rn,{label:o,size:"small",color:o==="behind"?"warning":"info",sx:Nti})]})})}var GA=E($(),1),Fti={opacity:.6},$ti={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function bCr({nodes:e,name:t,clone:r}){let n=(0,GA.jsx)(SX,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,GA.jsx)(ie,{component:"span",sx:Fti,children:n}):(0,GA.jsx)(lr,{title:VF(t,r.cloneTarget),children:(0,GA.jsxs)(ie,{component:"span",sx:$ti,children:[(0,GA.jsx)(GF,{sx:{fontSize:14}}),n]})})}var TCr=E($(),1),zti={px:1.5,borderRadius:.75,fontSize:12,fontWeight:600,color:"text.secondary","&:hover":{color:"text.primary",bgcolor:"action.hover"},"&[aria-checked='true']":{color:"primary.main",bgcolor:"action.selected"},"&.Mui-focusVisible":{outline:2,outlineColor:"primary.main"}};function xCr({value:e,label:t,checked:r,autoFocus:n,onSelect:i}){return(0,TCr.jsx)(pn,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:i,sx:zti,children:t})}var SCr={ArrowRight:1,ArrowLeft:-1};function Hti(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+SCr[e.key]+r)%r}function CCr(e,t,r,n){return i=>{if(i.key==="ArrowUp"||i.key==="ArrowDown"){if(!n)return;i.preventDefault(),n();return}if(i.key!=="Tab"&&!SCr[i.key]){A2(i);return}let o=Hti(i,e.indexOf(t),e.length);o!==void 0&&(i.preventDefault(),r(e[o]),i.currentTarget.querySelector(`[data-value="${e[o]}"]`)?.focus())}}var wCr=E(fe(),1);function a$(e){return e?.querySelector('[aria-checked="true"]')}function kCr(e,t){(0,wCr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=a$(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var GWe=E($(),1),Uti={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function nve({label:e,options:t,value:r,onChange:n,optionLabel:i=u=>u,groupRef:o,autoFocus:a,onTrack:s,onToggleRow:l}){return kCr(o,r),(0,GWe.jsx)(Rt,{ref:o,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:CCr(t,r,n,l),sx:Uti,children:t.map(u=>(0,GWe.jsx)(xCr,{value:u,label:i(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var VWe=E($(),1);function ECr({value:e,onChange:t,cloneState:r}){let{nodes:n,names:i,visible:o}=_c(),a=(0,_Cr.useRef)(null);return!o||!n||!e?null:(0,VWe.jsx)(nve,{label:"Machine",options:i,value:e,onChange:t,optionLabel:s=>(0,VWe.jsx)(bCr,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var ACr=E($(),1);function RCr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:i,onTrack:o}){return(0,ACr.jsx)(Jn,{value:e,onChange:a=>t(a.target.value),onKeyDown:A2,onFocus:o,onSelect:o,inputRef:n,placeholder:r,autoFocus:i,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"},input:{sx:{fontSize:14}}}})}var ICr=E(fe(),1);var dT={draft:{placeholder:"Describe the backlog item to draft...",submitLabel:"Start draft",sessionMode:"assist-draft"},bug:{placeholder:"Describe the bug: what happened, what you expected...",submitLabel:"File bug",sessionMode:"assist-bug"},prompt:{placeholder:Bge,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},PCr=Object.keys(dT);var qWe=E($(),1);function LCr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:i}){return(0,qWe.jsx)(Bs,{open:e!==null,anchorEl:e,onClose:i,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(o=>(0,qWe.jsx)(ln,{role:"menuitemradio","aria-checked":o===t,selected:o===t,onClick:()=>{n(o),i()},sx:{fontSize:13},children:Mu(o)},o))})}var VA=E($(),1);function MCr(e){return t=>t==="prompt"&&e?(0,VA.jsxs)(VA.Fragment,{children:["prompt",(0,VA.jsx)(ie,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${Mu(e)}`}),(0,VA.jsx)(bd,{sx:{fontSize:18,mr:-.75}})]}):t}var qA=E($(),1);function DCr({draft:e,harness:t,harnesses:r,focus:n}){let[i,o]=(0,ICr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>o(a$(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,qA.jsxs)(qA.Fragment,{children:[(0,qA.jsx)(nve,{label:"Mode",options:PCr,value:e.mode,onChange:l,optionLabel:MCr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,qA.jsx)(LCr,{anchor:i,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>o(null)})]})}var VCr=E(fe(),1);var jWe=E($(),1),Wti={zIndex:e=>e.zIndex.modal+1};function NCr({open:e,anchor:t,children:r}){return(0,jWe.jsx)(Q6,{open:e,anchorEl:t,placement:"bottom-start",sx:Wti,children:(0,jWe.jsx)(tn,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}function OCr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:{fontSize:13,height:40}}}}var BCr=E(B6(),1);function FCr({open:e,highlighted:t,accept:r,close:n,navigate:i,openList:o}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),o();return}A2(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,BCr.flushSync)(()=>{r(t),n()}),A2(a);return}if(a.key!=="Tab"){i(a);return}t!==void 0&&r(t),n()}}}function $Cr(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Tv(n).toLowerCase().includes(r)):e}var YWe=E(fe(),1);function zCr(){let[e,t]=(0,YWe.useState)(!1),[r,n]=(0,YWe.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:i=>{n(i),t(!0)},close:()=>{t(!1),n("")}}}var UCr=E(fe(),1);var HCr=e=>e?Tv(e):"";function WCr(e){let[t,r]=(0,UCr.useState)(()=>HCr(e));return{text:t,setText:r,showRepo:n=>r(HCr(n))}}function GCr(e,t,r){let n=zCr(),i=WCr(t),o=$Cr(e,n.query),a=f=>{r(f),i.showRepo(f)},s=g_(o,n.query,a,n.close),l=()=>s.setHighlight(Math.max(e.indexOf(t),0)),u=()=>{l(),n.show()};return{open:n.open,text:i.text,filtered:o,highlight:s.highlight,setHighlight:s.setHighlight,onKeyDown:FCr({open:n.open,highlighted:o[s.highlight],accept:a,close:n.close,navigate:s.onKeyDown,openList:u}),onClick:()=>{n.open||u()},onType:f=>{i.setText(f),n.filterBy(f)},onFocus:l,onBlur:()=>{n.close(),i.showRepo(t)},pick:f=>{a(f),n.close()}}}var s$=E($(),1);function qCr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:i,onTrack:o}){let a=GCr(e,t,r),s=(0,VCr.useRef)(null);return(0,s$.jsxs)(ie,{ref:s,sx:{flex:1,minWidth:0},children:[(0,s$.jsx)(Jn,{value:a.text,onChange:l=>a.onType(l.target.value),onFocus:l=>{l.target.select(),a.onFocus(),o()},inputRef:n,autoFocus:i,onClick:a.onClick,onBlur:a.onBlur,onKeyDown:a.onKeyDown,placeholder:"Repo",size:"small",fullWidth:!0,slotProps:OCr(a.open)}),(0,s$.jsx)(NCr,{open:a.open,anchor:s.current,children:(0,s$.jsx)(E1e,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var A_=E($(),1);function jCr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:i}=$n();return(0,A_.jsxs)(Rt,{spacing:1,sx:{p:1},children:[(0,A_.jsx)(RCr,{value:r.prompt,onChange:r.setPrompt,placeholder:dT[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),(0,A_.jsxs)(Rt,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,A_.jsx)(qCr,{repos:i,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,A_.jsx)(DCr,{...t})]}),(0,A_.jsx)(ECr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var l$=E($(),1),Gti=["Enter start","Shift+Enter newline","Esc close"],Vti={alignItems:"center",px:1.5,py:1,borderTop:1,borderColor:"divider",bgcolor:"action.hover"};function YCr({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,l$.jsxs)(Rt,{direction:"row",spacing:1.5,sx:Vti,children:[(0,l$.jsx)(Rt,{direction:"row",spacing:1.5,sx:{mr:"auto"},children:Gti.map(n=>(0,l$.jsx)(Le,{variant:"caption",color:"text.secondary",children:n},n))}),(0,l$.jsx)(Dt,{type:"submit",variant:"contained",size:"small",disabled:t,loading:r,children:e})]})}var jA=E(fe(),1);function KCr(e,t){let r=(0,jA.useRef)(e),n=(0,jA.useRef)(null),i=(0,jA.useRef)(null),o=(0,jA.useRef)(null),a=(0,jA.useCallback)(u=>{n.current=u;let{field:f,selectionStart:d,selectionEnd:h}=r.current;u&&f==="prompt"&&u.setSelectionRange(d,h)},[]),s=u=>{let f=u.target;t({field:"prompt",selectionStart:f.selectionStart,selectionEnd:f.selectionEnd})},l=()=>{if(o.current?.closest("form")?.contains(document.activeElement))return;let{field:u}=r.current;({repo:i.current,mode:a$(o.current),prompt:n.current}[u]??n.current)?.focus()};return{autoFocus:e.field,promptRef:a,repoRef:i,modeRef:o,trackPrompt:s,trackRepo:()=>t({...e,field:"repo"}),trackMode:()=>t({...e,field:"mode"}),restore:l}}function qti(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:A1e(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function XCr(e,t){let{names:r,visible:n}=_c(),i=w1e(t,n?r:[void 0]);return{cloneState:i,target:qti(t,e,i(e))}}function ZCr({mode:e,harness:t,prompt:r,cwd:n,node:i},o){let a=n||void 0,s=i?[i]:[];if(e==="prompt"){t==="claude"?o.onCreate(r,a,...s):o.onCreateHarness(t,r,a,...s);return}if(e==="design"){o.onCreateDesign(r,a,...s);return}let l=i?[{node:i}]:[];wur(dT[e].sessionMode,n,(u,f)=>o.onCreateAssist(u,f,...l),()=>{},r)}function QCr(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(g1e(r.prompt,n.onCreateAssist),!0):(ZCr({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var ive=E(fe(),1);function JCr(e,t){let[r,n]=(0,ive.useState)(!1);return(0,ive.useEffect)(()=>{!r||e.modePending||(n(!1),t())},[r,e.modePending,t]),()=>{e.modePending?n(!0):t()}}function ewr(e,t,r,n,i){let o=JCr(e,()=>{QCr(e,t,r,n)&&i()});return a=>{a.preventDefault(),o()}}var CX=E(fe(),1);function twr(e,t){let r=(0,CX.useRef)(e),n=(0,CX.useRef)(null);return(0,CX.useEffect)(()=>{if(r.current&&!e){let i=n.current;i?.isConnected?i.focus():t()}r.current=e},[e,t]),i=>{n.current=i.target}}var nwr=E($(),1),jti={border:0,margin:0,padding:0,minWidth:0};function rwr({loading:e,restoreFocus:t,children:r}){let n=twr(e,t);return(0,nwr.jsx)("fieldset",{disabled:e,style:jti,onFocus:n,children:r})}var YA=E($(),1);function iwr({draft:e,launchers:t,onClose:r}){let n=KCr(e.focus,e.setFocus),i=hCr(f_()),o=i.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=XCr(e.node,e.cwd),l=ewr(e,o,a,t,r);return(0,YA.jsx)(Q1e,{onClose:r,onEntered:n.restore,centered:!0,children:(0,YA.jsx)("form",{onSubmit:l,children:(0,YA.jsxs)(rwr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,YA.jsx)(jCr,{draft:e,harness:o,harnesses:i,focus:n,cloneState:s}),(0,YA.jsx)(YCr,{submitLabel:a.kind==="clone"?"Clone":dT[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var ove=E(fe(),1);var Yti=1e3;async function Kti(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",n=await(await fetch(`/api/new-session-defaults${t}`)).json();return Object.hasOwn(dT,n?.mode)?n.mode:null}catch{return null}}function owr(e,t=0){let[r,n]=(0,ove.useState)(null);return(0,ove.useEffect)(()=>{let i=!1,o,a=async()=>{let s=await Kti(e);i||(s?n({cwd:e,opens:t,mode:s}):o=setTimeout(a,Yti))};return a(),()=>{i=!0,clearTimeout(o)}},[e,t]),r?{mode:r.mode,pending:r.cwd!==e||r.opens!==t}:null}function awr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var hT=E(fe(),1),swr={field:"prompt",selectionStart:0,selectionEnd:0};function lwr(){let[e,t]=(0,hT.useState)(""),[r,n]=(0,hT.useState)(),[i,o]=(0,hT.useState)(),[a,s]=(0,hT.useState)("claude"),[l,u]=(0,hT.useState)(),[f,d]=(0,hT.useState)(swr),h=(0,hT.useCallback)(()=>{t(""),n(void 0),o(void 0),u(void 0),d(swr)},[]);return{prompt:e,cwd:r,mode:i,harness:a,node:l,focus:f,setPrompt:t,setNode:u,setCwd:n,setMode:o,setHarness:s,setFocus:d,clear:h}}function cwr(e,t=owr){let{selectedCwd:r}=$n(),n=_c(),i=lwr(),o=i.cwd??r,a=t(o,e);return a?{...i,cwd:o,mode:i.mode??a.mode,modePending:i.mode===void 0&&a.pending,node:awr(i.node,n)}:null}function uwr(e){Eo(jn("newSession").matches,e)}var fwr=E(fe(),1);function dwr(e,t){let{selectedCwd:r}=$n(),[n,i]=Uc(),o=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,fwr.useEffect)(()=>{o===null||!s||!l||!u||(o&&(s(o),l(a),u({field:"prompt",selectionStart:o.length,selectionEnd:o.length})),t(),i(f=>(f.delete("new"),f.delete("newCwd"),f),{replace:!0}))},[o,a,s,l,u,t,i])}var pwr=E($(),1);function hwr({launchers:e}){let[t,r]=(0,wX.useState)(!1),[n,i]=(0,wX.useState)(0),o=cwr(n),a=(0,wX.useCallback)(()=>{r(!0),i(s=>s+1)},[]);return uwr(a),dwr(o,a),!t||!o?null:(0,pwr.jsx)(iwr,{draft:o,launchers:e,onClose:()=>r(!1)})}var ave=E($(),1);function mwr({reconnecting:e}){return(0,ave.jsx)(Bh,{open:e,children:(0,ave.jsx)(yi,{severity:"info",variant:"filled",icon:(0,ave.jsx)(oo,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var Rv=E($(),1);function gwr({socket:e,onViewLaunchedSession:t}){return(0,Rv.jsxs)(Rv.Fragment,{children:[(0,Rv.jsx)(uCr,{}),(0,Rv.jsx)(hwr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,Rv.jsx)(mwr,{reconnecting:e.reconnecting}),(0,Rv.jsx)(Xl,{error:e.error,onClose:e.clearError}),(0,Rv.jsx)(dCr,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Av=E(fe(),1);var Xti=6e4;function Zti(e,t,r){return t.map(n=>e.find(i=>i.name===n)??{name:n,local:n===r,loading:!0})}function ywr(e){let t=e.nodes?.local,r=e.names.join(`
4022
+ `,ISr={content:'""',position:"absolute",borderRadius:"inherit",background:"conic-gradient(from calc(var(--rainbow-pill-h) * 1deg) in oklch longer hue, oklch(66% 0.21 0), oklch(66% 0.21 0))",animation:`${pti} 1.8s linear infinite`},gti={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${mti} 1.6s ease-in-out infinite`,"&::before":{...ISr,inset:0,zIndex:-1},"&::after":{...ISr,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:Gs.rainbowPill.text,textShadow:Gs.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function DSr({children:e}){return(0,$A.jsxs)($A.Fragment,{children:[(0,$A.jsx)(J_,{styles:hti}),(0,$A.jsx)(ie,{component:"span","data-testid":"rainbow-pill",sx:gti,children:e})]})}function NSr({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function OSr(e){if(e.length!==2)return!1;let[t,r]=e;return NSr(t)===NSr(r)}var fT=E($(),1);function W1e({rateLimits:e}){let t=c_(3e4),r=[{window:e.five_hour,windowSeconds:18e3,fallbackLabel:"5h"},{window:e.seven_day,windowSeconds:604800,fallbackLabel:"7d"}].filter(o=>o.window?.used_percentage!=null),n=OSr(r.map(o=>({pct:o.window?.used_percentage??0,timeLabel:H1e(o.window?.resets_at,o.fallbackLabel,t)}))),i=r.map((o,a)=>(0,fT.jsxs)(BSr.Fragment,{children:[a>0?(0,fT.jsx)(ie,{component:"span",sx:{color:o$,mr:.5},children:","}):null,(0,fT.jsx)(MSr,{window:o.window,windowSeconds:o.windowSeconds,fallbackLabel:o.fallbackLabel,now:t})]},o.fallbackLabel));return n?(0,fT.jsx)(DSr,{children:i}):(0,fT.jsx)(fT.Fragment,{children:i})}var k_=E($(),1);function $Sr({groups:e}){return(0,k_.jsx)(k_.Fragment,{children:e.map((t,r)=>(0,k_.jsxs)(FSr.Fragment,{children:[(0,k_.jsx)(ie,{component:"span",sx:{color:o$,ml:r>0?1:0,mr:.5},children:Mu(t.harness)}),(0,k_.jsx)(W1e,{rateLimits:t.rateLimits})]},t.harness))})}function yti(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function vti(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function bti(e,t,r,n){if(e>=t)return;let i=e/t;return Math.round(r-n*(1-i))}function USr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let i=yWe(t,r,n);if(i==null)return{kind:"unprojectable"};let o=l_(e,t,r,n),a=yti(o),s=vti(o);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*i,at:bti(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*i}}}function G1e(e){return t=>t.tokens.color.onAppBar.level[e]}function WSr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${r1e(e.at,t)}`}var N0=E($(),1);function $We({direction:e,threshold:t}){let r=e==="back",n={display:"inline-flex",gap:.5,minWidth:"6ch",justifyContent:r?"flex-end":"flex-start"};if(!t)return(0,N0.jsx)(ie,{component:"span",sx:n});let i=(0,N0.jsx)(ie,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,N0.jsxs)(ie,{component:"span",sx:{color:G1e(t.level)},children:[Math.round(t.pct),"%"]});return(0,N0.jsx)(ie,{component:"span",sx:n,children:r?(0,N0.jsxs)(N0.Fragment,{children:[o,i]}):(0,N0.jsxs)(N0.Fragment,{children:[i,o]})})}var __=E($(),1);function GSr({label:e,pct:t,resetsAt:r,windowSeconds:n,now:i}){let o=l_(t,r,n,i),a=USr(t,r,n,i),s=a.kind==="projected"?a:void 0;return(0,__.jsxs)(ie,{sx:{display:"flex",alignItems:"baseline",gap:.75},children:[(0,__.jsx)(ie,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,__.jsx)($We,{direction:"back",threshold:s?.recovery}),(0,__.jsxs)(ie,{component:"span",sx:{minWidth:"4ch",textAlign:"right",color:G1e(o)},children:[Math.round(t),"%"]}),(0,__.jsx)($We,{direction:"forward",threshold:s?.worse}),(0,__.jsx)(ie,{component:"span",sx:{opacity:.6},children:s?s.recovery&&WSr(s.recovery,i):"no projection yet"})]})}function VSr(e){return[{label:"5h",window:e.five_hour,windowSeconds:18e3},{label:"7d",window:e.seven_day,windowSeconds:604800}].flatMap(t=>t.window?.used_percentage==null?[]:[{label:t.label,pct:t.window.used_percentage,resetsAt:t.window.resets_at,windowSeconds:t.windowSeconds}])}var qSr=E($(),1);function V1e({rateLimits:e,now:t}){return VSr(e).map(r=>(0,qSr.jsx)(GSr,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var zA=E($(),1);function jSr({groups:e}){let t=c_(3e4);return(0,zA.jsxs)(ie,{sx:{fontFamily:"fontFamilyMono",fontSize:12},children:[e.map(r=>(0,zA.jsxs)(ie,{sx:{mb:.5},children:[(0,zA.jsx)(ie,{sx:{opacity:.8},children:Mu(r.harness)}),(0,zA.jsx)(V1e,{rateLimits:r.rateLimits,now:t})]},r.harness)),(0,zA.jsx)(ie,{sx:{mt:.5,opacity:.6},children:"Account usage per harness \u2014 view history"})]})}function YSr(e){return e?.five_hour?.used_percentage!=null||e?.seven_day?.used_percentage!=null}function KSr(e,t){let r=[];YSr(e)&&r.push({harness:"claude",rateLimits:e});for(let[n,i]of Object.entries(t))YSr(i)&&r.push({harness:n,rateLimits:i});return r}var xti={display:"flex",alignItems:"center",ml:2,fontFamily:"fontFamilyMono",fontSize:13},Tti={display:"flex",alignItems:"center",height:22,px:1,borderRadius:1,fontSize:"inherit","&:hover, &:focus-visible":{bgcolor:e=>e.tokens.color.statusBar?.hover,color:e=>e.tokens.color.statusBar?.hoverText}},XSr=e=>e?Tti:xti;var TX=E($(),1),zWe="Claude account usage (5h / 7d windows) \u2014 view history";function ZSr({rateLimits:e}){let t=c_(3e4);return(0,TX.jsxs)(ie,{sx:{fontFamily:"fontFamilyMono",fontSize:12},children:[(0,TX.jsx)(V1e,{rateLimits:e,now:t}),(0,TX.jsx)(ie,{sx:{mt:.5,opacity:.6},children:zWe})]})}var HA=E($(),1),Sti={};function q1e({rateLimits:e,harnessRateLimits:t=Sti,onStatusBar:r=!1}){let n=KSr(e,t),i=n.every(l=>l.harness==="claude"),o=e,a=zWe,s="Usage";return n.length>0&&i?(a=(0,HA.jsx)(ZSr,{rateLimits:o}),s=(0,HA.jsx)(W1e,{rateLimits:o})):n.length>0&&(a=(0,HA.jsx)(jSr,{groups:n}),s=(0,HA.jsx)($Sr,{groups:n})),(0,HA.jsx)(lr,{title:a,placement:r?"top-end":"bottom",children:(0,HA.jsx)(Kr,{component:ws,to:"/usage",underline:r?"none":"hover",color:"inherit",sx:XSr(r),children:s})})}var eCr=E(fe(),1);var E_="0.934.5";var j1e=E(fe(),1),HWe=(0,j1e.createContext)(null);function Y1e(){return(0,j1e.useContext)(HWe)}var UWe=E($(),1);function QSr(){let e=Y1e();return!e||e===E_?null:(0,UWe.jsx)(lr,{title:`Daemon is running v${e}, but this page was served by v${E_}. Restart the daemon to match.`,children:(0,UWe.jsx)(M1e,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var WWe=e=>e.tokens.color.statusBar,Cti={height:22,py:0,borderRadius:1,fontSize:"inherit",opacity:1,"&:hover, &:focus-visible":{bgcolor:e=>WWe(e)?.hover,color:e=>WWe(e)?.hoverText},"& .ready-count":{fontWeight:500,color:e=>WWe(e)?.readyText}},JSr=(e,t=!1)=>({display:"inline-flex",alignItems:"center",gap:.75,px:1,py:.25,borderRadius:999,fontSize:12,lineHeight:1.5,color:"inherit",opacity:e?1:.55,bgcolor:r=>e?w_(r).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{opacity:1,bgcolor:r=>w_(r).hover},"& .ready-dot":{width:t?6:8,height:t?6:8,borderRadius:"50%",bgcolor:r=>w_(r).dot,boxShadow:r=>`0 0 0 ${t?3:2}px ${w_(r).dotRing}`},"& .ready-count":{fontWeight:500},...t&&Cti});var sg=E($(),1);function K1e({onStatusBar:e=!1}){let{entries:t}=kF(),r=Oi(),n=(0,eCr.useCallback)(()=>r("/updates"),[r]),{matches:i,chords:o}=jn("openUpdates");if(Eo(i,n),!E_)return null;let a=t.filter(MF).length;return(0,sg.jsxs)(sg.Fragment,{children:[(0,sg.jsx)(lr,{describeChild:!0,placement:e?"top-start":"bottom",title:(0,sg.jsx)(Iu,{label:"Updates",chords:o}),children:(0,sg.jsxs)(pn,{component:ws,to:"/updates","aria-label":a?`Updates: ${a} node${a>1?"s have":" has"} an update ready`:"Updates",sx:JSr(a>0,e),children:[a>0&&(0,sg.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,sg.jsxs)("span",{children:["v",E_]}),a>0&&(0,sg.jsxs)("span",{className:"ready-count",children:[a," ready"]})]})}),(0,sg.jsx)(QSr,{})]})}var X1e=E($(),1);function tCr({socket:e}){return(0,X1e.jsx)(PSr,{start:(0,X1e.jsx)(K1e,{onStatusBar:!0}),end:(0,X1e.jsx)(q1e,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits,onStatusBar:!0})})}var tve=E(fe(),1);var eve=E(fe(),1);function rCr(e,t,r){if(!e)return"Select a repo to search files.";if(r.error)return"Couldn't search files in this repo.";if(!(r.files.length>0||r.loading))return t?"No matching files.":"No files in this repo."}var R_=E($(),1),wti={display:"flex",gap:1,alignItems:"center",minWidth:0},kti={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},_ti={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},Eti={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function Rti(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function nCr({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,R_.jsx)(Hp,{dense:!0,sx:{py:0},children:e.map((i,o)=>{let{dir:a,basename:s}=Rti(i);return(0,R_.jsxs)(ln,{selected:o===t,onMouseEnter:()=>r(o),onClick:()=>n(i),sx:wti,children:[(0,R_.jsx)(fB,{path:i}),(0,R_.jsxs)(ie,{sx:kti,children:[(0,R_.jsx)(Le,{component:"span",sx:_ti,children:s}),(0,R_.jsx)(Le,{component:"span",color:"text.secondary",sx:Eti,children:a})]})]},i)})})}var Z1e=E($(),1),Ati={maxHeight:420,overflowY:"auto"},Pti={px:2,py:2,fontSize:13};function iCr({message:e,files:t,highlight:r,onHighlight:n,onSelect:i}){return(0,Z1e.jsx)(ie,{sx:Ati,children:e?(0,Z1e.jsx)(Le,{color:"text.secondary",sx:Pti,children:e}):(0,Z1e.jsx)(nCr,{files:t,highlight:r,onHighlight:n,onSelect:i})})}var oCr=E($(),1),Lti={mt:6,alignSelf:"flex-start"};function Q1e({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,oCr.jsx)(Wl,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:Lti},transition:{onEntered:t}},children:n})}var J1e=E(fe(),1);var aCr={files:[],loading:!1,error:!1};function sCr(e,t){let[r,n]=(0,J1e.useState)(aCr),i=yr();return(0,J1e.useEffect)(()=>{if(!e){n(aCr);return}let o=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await fetch(qr(`/api/files?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,i));if(!s.ok)throw new Error(`HTTP ${s.status}`);let l=await s.json();if(o)return;n({files:Array.isArray(l.files)?l.files:[],loading:!1,error:!1})}catch{o||n({files:[],loading:!1,error:!0})}})(),()=>{o=!0}},[e,t,i]),r}var UA=E($(),1);function Mti(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function lCr({onClose:e}){let{worktreeNode:t}=$n();return(0,UA.jsx)(mf.Provider,{value:t,children:(0,UA.jsx)(Iti,{onClose:e})})}function Iti({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=$n(),[n,i]=(0,eve.useState)(""),o=sCr(t,n),a=Oi(),s=(0,eve.useRef)(null),l=p=>a(Mti(p,t,r)),{highlight:u,setHighlight:f,onKeyDown:d}=g_(o.files,n,l,e),h=p=>{l(p),e()};return(0,UA.jsxs)(Q1e,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,UA.jsx)(gS,{autoFocus:!0,inputRef:s,value:n,onChange:i,onKeyDown:d,placeholder:"Search files by name..."}),(0,UA.jsx)(iCr,{message:rCr(t,n,o),files:o.files,highlight:u,onHighlight:f,onSelect:h})]})}function cCr(e){Eo(jn("quickOpen").matches,e)}var fCr=E($(),1);function uCr(){let[e,t]=(0,tve.useState)(!1);return cCr((0,tve.useCallback)(()=>t(!0),[])),e?(0,fCr.jsx)(lCr,{onClose:()=>t(!1)}):null}var rve=E($(),1);function dCr({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,rve.jsx)(Bh,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,rve.jsx)(yi,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,rve.jsx)(Dt,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var wX=E(fe(),1);function hCr(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var _Cr=E(fe(),1);var pCr=E($(),1),mCr=st((0,pCr.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2"}),"Circle");var Dti={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function gCr(e){return e?Dti[e]:"success.main"}function yCr(e){return e.split("-")[0].split(".").map(Number)}function vCr(e,t){if(!e||!t||e===t)return;let r=yCr(e),n=yCr(t);for(let i=0;i<Math.max(r.length,n.length);i++){let o=(r[i]??0)-(n[i]??0);if(Number.isNaN(o))return;if(o!==0)return o<0?"behind":"ahead"}}var WA=E($(),1),Nti={height:16,fontSize:10},Oti={opacity:.6,fontSize:"0.85em"};function Bti(e,t){if(t===e.local)return"this machine";let r=e.links.find(n=>n.name===t);return r?r.error?`${r.state}: ${r.error}`:r.state:""}function SX({nodes:e,name:t,showVersion:r=!1}){let n=Y1e()??E_,i=e.links.find(a=>a.name===t),o=vCr(i?.peerVersion,n);return(0,WA.jsx)(lr,{title:Bti(e,t),placement:"right",children:(0,WA.jsxs)(ie,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,WA.jsx)(mCr,{sx:{fontSize:8,color:gCr(i?.state)}}),t,r&&i?.peerVersion&&(0,WA.jsxs)(ie,{component:"span",sx:Oti,children:["v",i.peerVersion]}),o&&(0,WA.jsx)(rn,{label:o,size:"small",color:o==="behind"?"warning":"info",sx:Nti})]})})}var GA=E($(),1),Fti={opacity:.6},$ti={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function bCr({nodes:e,name:t,clone:r}){let n=(0,GA.jsx)(SX,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,GA.jsx)(ie,{component:"span",sx:Fti,children:n}):(0,GA.jsx)(lr,{title:VF(t,r.cloneTarget),children:(0,GA.jsxs)(ie,{component:"span",sx:$ti,children:[(0,GA.jsx)(GF,{sx:{fontSize:14}}),n]})})}var TCr=E($(),1),zti={px:1.5,borderRadius:.75,fontSize:12,fontWeight:600,color:"text.secondary","&:hover":{color:"text.primary",bgcolor:"action.hover"},"&[aria-checked='true']":{color:"primary.main",bgcolor:"action.selected"},"&.Mui-focusVisible":{outline:2,outlineColor:"primary.main"}};function xCr({value:e,label:t,checked:r,autoFocus:n,onSelect:i}){return(0,TCr.jsx)(pn,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:i,sx:zti,children:t})}var SCr={ArrowRight:1,ArrowLeft:-1};function Hti(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+SCr[e.key]+r)%r}function CCr(e,t,r,n){return i=>{if(i.key==="ArrowUp"||i.key==="ArrowDown"){if(!n)return;i.preventDefault(),n();return}if(i.key!=="Tab"&&!SCr[i.key]){A2(i);return}let o=Hti(i,e.indexOf(t),e.length);o!==void 0&&(i.preventDefault(),r(e[o]),i.currentTarget.querySelector(`[data-value="${e[o]}"]`)?.focus())}}var wCr=E(fe(),1);function a$(e){return e?.querySelector('[aria-checked="true"]')}function kCr(e,t){(0,wCr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=a$(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var GWe=E($(),1),Uti={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function nve({label:e,options:t,value:r,onChange:n,optionLabel:i=u=>u,groupRef:o,autoFocus:a,onTrack:s,onToggleRow:l}){return kCr(o,r),(0,GWe.jsx)(Rt,{ref:o,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:CCr(t,r,n,l),sx:Uti,children:t.map(u=>(0,GWe.jsx)(xCr,{value:u,label:i(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var VWe=E($(),1);function ECr({value:e,onChange:t,cloneState:r}){let{nodes:n,names:i,visible:o}=_c(),a=(0,_Cr.useRef)(null);return!o||!n||!e?null:(0,VWe.jsx)(nve,{label:"Machine",options:i,value:e,onChange:t,optionLabel:s=>(0,VWe.jsx)(bCr,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var ACr=E($(),1);function RCr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:i,onTrack:o}){return(0,ACr.jsx)(Jn,{value:e,onChange:a=>t(a.target.value),onKeyDown:A2,onFocus:o,onSelect:o,inputRef:n,placeholder:r,autoFocus:i,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"},input:{sx:{fontSize:14}}}})}var ICr=E(fe(),1);var dT={draft:{placeholder:"Describe the backlog item to draft...",submitLabel:"Start draft",sessionMode:"assist-draft"},bug:{placeholder:"Describe the bug: what happened, what you expected...",submitLabel:"File bug",sessionMode:"assist-bug"},prompt:{placeholder:Bge,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},PCr=Object.keys(dT);var qWe=E($(),1);function LCr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:i}){return(0,qWe.jsx)(Bs,{open:e!==null,anchorEl:e,onClose:i,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(o=>(0,qWe.jsx)(ln,{role:"menuitemradio","aria-checked":o===t,selected:o===t,onClick:()=>{n(o),i()},sx:{fontSize:13},children:Mu(o)},o))})}var VA=E($(),1);function MCr(e){return t=>t==="prompt"&&e?(0,VA.jsxs)(VA.Fragment,{children:["prompt",(0,VA.jsx)(ie,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${Mu(e)}`}),(0,VA.jsx)(bd,{sx:{fontSize:18,mr:-.75}})]}):t}var qA=E($(),1);function DCr({draft:e,harness:t,harnesses:r,focus:n}){let[i,o]=(0,ICr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>o(a$(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,qA.jsxs)(qA.Fragment,{children:[(0,qA.jsx)(nve,{label:"Mode",options:PCr,value:e.mode,onChange:l,optionLabel:MCr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,qA.jsx)(LCr,{anchor:i,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>o(null)})]})}var VCr=E(fe(),1);var jWe=E($(),1),Wti={zIndex:e=>e.zIndex.modal+1};function NCr({open:e,anchor:t,children:r}){return(0,jWe.jsx)(Q6,{open:e,anchorEl:t,placement:"bottom-start",sx:Wti,children:(0,jWe.jsx)(tn,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}function OCr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:{fontSize:13,height:40}}}}var BCr=E(B6(),1);function FCr({open:e,highlighted:t,accept:r,close:n,navigate:i,openList:o}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),o();return}A2(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,BCr.flushSync)(()=>{r(t),n()}),A2(a);return}if(a.key!=="Tab"){i(a);return}t!==void 0&&r(t),n()}}}function $Cr(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>Tv(n).toLowerCase().includes(r)):e}var YWe=E(fe(),1);function zCr(){let[e,t]=(0,YWe.useState)(!1),[r,n]=(0,YWe.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:i=>{n(i),t(!0)},close:()=>{t(!1),n("")}}}var UCr=E(fe(),1);var HCr=e=>e?Tv(e):"";function WCr(e){let[t,r]=(0,UCr.useState)(()=>HCr(e));return{text:t,setText:r,showRepo:n=>r(HCr(n))}}function GCr(e,t,r){let n=zCr(),i=WCr(t),o=$Cr(e,n.query),a=f=>{r(f),i.showRepo(f)},s=g_(o,n.query,a,n.close),l=()=>s.setHighlight(Math.max(e.indexOf(t),0)),u=()=>{l(),n.show()};return{open:n.open,text:i.text,filtered:o,highlight:s.highlight,setHighlight:s.setHighlight,onKeyDown:FCr({open:n.open,highlighted:o[s.highlight],accept:a,close:n.close,navigate:s.onKeyDown,openList:u}),onClick:()=>{n.open||u()},onType:f=>{i.setText(f),n.filterBy(f)},onFocus:l,onBlur:()=>{n.close(),i.showRepo(t)},pick:f=>{a(f),n.close()}}}var s$=E($(),1);function qCr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:i,onTrack:o}){let a=GCr(e,t,r),s=(0,VCr.useRef)(null);return(0,s$.jsxs)(ie,{ref:s,sx:{flex:1,minWidth:0},children:[(0,s$.jsx)(Jn,{value:a.text,onChange:l=>a.onType(l.target.value),onFocus:l=>{l.target.select(),a.onFocus(),o()},inputRef:n,autoFocus:i,onClick:a.onClick,onBlur:a.onBlur,onKeyDown:a.onKeyDown,placeholder:"Repo",size:"small",fullWidth:!0,slotProps:OCr(a.open)}),(0,s$.jsx)(NCr,{open:a.open,anchor:s.current,children:(0,s$.jsx)(E1e,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var A_=E($(),1);function jCr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:i}=$n();return(0,A_.jsxs)(Rt,{spacing:1,sx:{p:1},children:[(0,A_.jsx)(RCr,{value:r.prompt,onChange:r.setPrompt,placeholder:dT[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),(0,A_.jsxs)(Rt,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,A_.jsx)(qCr,{repos:i,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,A_.jsx)(DCr,{...t})]}),(0,A_.jsx)(ECr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var l$=E($(),1),Gti=["Enter start","Shift+Enter newline","Esc close"],Vti={alignItems:"center",px:1.5,py:1,borderTop:1,borderColor:"divider",bgcolor:"action.hover"};function YCr({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,l$.jsxs)(Rt,{direction:"row",spacing:1.5,sx:Vti,children:[(0,l$.jsx)(Rt,{direction:"row",spacing:1.5,sx:{mr:"auto"},children:Gti.map(n=>(0,l$.jsx)(Le,{variant:"caption",color:"text.secondary",children:n},n))}),(0,l$.jsx)(Dt,{type:"submit",variant:"contained",size:"small",disabled:t,loading:r,children:e})]})}var jA=E(fe(),1);function KCr(e,t){let r=(0,jA.useRef)(e),n=(0,jA.useRef)(null),i=(0,jA.useRef)(null),o=(0,jA.useRef)(null),a=(0,jA.useCallback)(u=>{n.current=u;let{field:f,selectionStart:d,selectionEnd:h}=r.current;u&&f==="prompt"&&u.setSelectionRange(d,h)},[]),s=u=>{let f=u.target;t({field:"prompt",selectionStart:f.selectionStart,selectionEnd:f.selectionEnd})},l=()=>{if(o.current?.closest("form")?.contains(document.activeElement))return;let{field:u}=r.current;({repo:i.current,mode:a$(o.current),prompt:n.current}[u]??n.current)?.focus()};return{autoFocus:e.field,promptRef:a,repoRef:i,modeRef:o,trackPrompt:s,trackRepo:()=>t({...e,field:"repo"}),trackMode:()=>t({...e,field:"mode"}),restore:l}}function qti(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:A1e(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function XCr(e,t){let{names:r,visible:n}=_c(),i=w1e(t,n?r:[void 0]);return{cloneState:i,target:qti(t,e,i(e))}}function ZCr({mode:e,harness:t,prompt:r,cwd:n,node:i},o){let a=n||void 0,s=i?[i]:[];if(e==="prompt"){t==="claude"?o.onCreate(r,a,...s):o.onCreateHarness(t,r,a,...s);return}if(e==="design"){o.onCreateDesign(r,a,...s);return}let l=i?[{node:i}]:[];wur(dT[e].sessionMode,n,(u,f)=>o.onCreateAssist(u,f,...l),()=>{},r)}function QCr(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(g1e(r.prompt,n.onCreateAssist),!0):(ZCr({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var ive=E(fe(),1);function JCr(e,t){let[r,n]=(0,ive.useState)(!1);return(0,ive.useEffect)(()=>{!r||e.modePending||(n(!1),t())},[r,e.modePending,t]),()=>{e.modePending?n(!0):t()}}function ewr(e,t,r,n,i){let o=JCr(e,()=>{QCr(e,t,r,n)&&i()});return a=>{a.preventDefault(),o()}}var CX=E(fe(),1);function twr(e,t){let r=(0,CX.useRef)(e),n=(0,CX.useRef)(null);return(0,CX.useEffect)(()=>{if(r.current&&!e){let i=n.current;i?.isConnected?i.focus():t()}r.current=e},[e,t]),i=>{n.current=i.target}}var nwr=E($(),1),jti={border:0,margin:0,padding:0,minWidth:0};function rwr({loading:e,restoreFocus:t,children:r}){let n=twr(e,t);return(0,nwr.jsx)("fieldset",{disabled:e,style:jti,onFocus:n,children:r})}var YA=E($(),1);function iwr({draft:e,launchers:t,onClose:r}){let n=KCr(e.focus,e.setFocus),i=hCr(f_()),o=i.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=XCr(e.node,e.cwd),l=ewr(e,o,a,t,r);return(0,YA.jsx)(Q1e,{onClose:r,onEntered:n.restore,centered:!0,children:(0,YA.jsx)("form",{onSubmit:l,children:(0,YA.jsxs)(rwr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,YA.jsx)(jCr,{draft:e,harness:o,harnesses:i,focus:n,cloneState:s}),(0,YA.jsx)(YCr,{submitLabel:a.kind==="clone"?"Clone":dT[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var ove=E(fe(),1);var Yti=1e3;async function Kti(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",n=await(await fetch(`/api/new-session-defaults${t}`)).json();return Object.hasOwn(dT,n?.mode)?n.mode:null}catch{return null}}function owr(e,t=0){let[r,n]=(0,ove.useState)(null);return(0,ove.useEffect)(()=>{let i=!1,o,a=async()=>{let s=await Kti(e);i||(s?n({cwd:e,opens:t,mode:s}):o=setTimeout(a,Yti))};return a(),()=>{i=!0,clearTimeout(o)}},[e,t]),r?{mode:r.mode,pending:r.cwd!==e||r.opens!==t}:null}function awr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var hT=E(fe(),1),swr={field:"prompt",selectionStart:0,selectionEnd:0};function lwr(){let[e,t]=(0,hT.useState)(""),[r,n]=(0,hT.useState)(),[i,o]=(0,hT.useState)(),[a,s]=(0,hT.useState)("claude"),[l,u]=(0,hT.useState)(),[f,d]=(0,hT.useState)(swr),h=(0,hT.useCallback)(()=>{t(""),n(void 0),o(void 0),u(void 0),d(swr)},[]);return{prompt:e,cwd:r,mode:i,harness:a,node:l,focus:f,setPrompt:t,setNode:u,setCwd:n,setMode:o,setHarness:s,setFocus:d,clear:h}}function cwr(e,t=owr){let{selectedCwd:r}=$n(),n=_c(),i=lwr(),o=i.cwd??r,a=t(o,e);return a?{...i,cwd:o,mode:i.mode??a.mode,modePending:i.mode===void 0&&a.pending,node:awr(i.node,n)}:null}function uwr(e){Eo(jn("newSession").matches,e)}var fwr=E(fe(),1);function dwr(e,t){let{selectedCwd:r}=$n(),[n,i]=Uc(),o=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,fwr.useEffect)(()=>{o===null||!s||!l||!u||(o&&(s(o),l(a),u({field:"prompt",selectionStart:o.length,selectionEnd:o.length})),t(),i(f=>(f.delete("new"),f.delete("newCwd"),f),{replace:!0}))},[o,a,s,l,u,t,i])}var pwr=E($(),1);function hwr({launchers:e}){let[t,r]=(0,wX.useState)(!1),[n,i]=(0,wX.useState)(0),o=cwr(n),a=(0,wX.useCallback)(()=>{r(!0),i(s=>s+1)},[]);return uwr(a),dwr(o,a),!t||!o?null:(0,pwr.jsx)(iwr,{draft:o,launchers:e,onClose:()=>r(!1)})}var ave=E($(),1);function mwr({reconnecting:e}){return(0,ave.jsx)(Bh,{open:e,children:(0,ave.jsx)(yi,{severity:"info",variant:"filled",icon:(0,ave.jsx)(oo,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var Rv=E($(),1);function gwr({socket:e,onViewLaunchedSession:t}){return(0,Rv.jsxs)(Rv.Fragment,{children:[(0,Rv.jsx)(uCr,{}),(0,Rv.jsx)(hwr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,Rv.jsx)(mwr,{reconnecting:e.reconnecting}),(0,Rv.jsx)(Xl,{error:e.error,onClose:e.clearError}),(0,Rv.jsx)(dCr,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Av=E(fe(),1);var Xti=6e4;function Zti(e,t,r){return t.map(n=>e.find(i=>i.name===n)??{name:n,local:n===r,loading:!0})}function ywr(e){let t=e.nodes?.local,r=e.names.join(`
4023
4023
  `),[n,i]=(0,Av.useState)([]),o=(0,Av.useRef)(0),a=(0,Av.useCallback)(()=>{let l=r?r.split(`
4024
4024
  `):[];if(l.length===0)return;let u=++o.current;i(f=>Zti(f,l,t));for(let f of l)Yye(f,f===t).then(d=>{u===o.current&&i(h=>h.map(p=>p.name===f?d:p))})},[r,t]);(0,Av.useEffect)(()=>{a();let l=setInterval(a,Xti);return()=>clearInterval(l)},[a]);let s=n.length===0;return(0,Av.useMemo)(()=>({entries:n,loading:s,refresh:a}),[n,s,a])}var P_=E($(),1);function vwr({shell:e,children:t}){let{socket:r,selection:n,launch:i,sidebarCollapse:o}=e,a=ywr(r.nodeSelection);return(0,P_.jsx)(lWe.Provider,{value:a,children:(0,P_.jsx)(cwe.Provider,{value:o,children:(0,P_.jsx)(sU.Provider,{value:n,children:(0,P_.jsx)(EWe.Provider,{value:r.nodeSelection,children:(0,P_.jsx)(mf.Provider,{value:n.selectedNode,children:(0,P_.jsx)(X$e.Provider,{value:i,children:(0,P_.jsx)(Znt,{children:t})})})})})})})}var bwr=E($(),1),xwr=st((0,bwr.jsx)("path",{d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z"}),"Computer");var Twr=E(fe(),1);var O0=E($(),1),Qti={ml:1,textTransform:"none",fontSize:12};function Swr(){let{nodes:e,names:t,visible:r,selected:n,select:i}=_c(),[o,a]=(0,Twr.useState)(null);return!r||!e||!n?null:(0,O0.jsxs)(O0.Fragment,{children:[(0,O0.jsx)(Dt,{size:"small",color:"inherit",startIcon:(0,O0.jsx)(xwr,{fontSize:"small"}),"aria-label":"Machine","aria-haspopup":"menu",onClick:s=>a(s.currentTarget),sx:Qti,children:(0,O0.jsx)(SX,{nodes:e,name:n})}),(0,O0.jsx)(Bs,{anchorEl:o,open:!!o,onClose:()=>a(null),children:t.map(s=>(0,O0.jsx)(ln,{selected:s===n,onClick:()=>{i(s),a(null)},sx:{fontSize:13},children:(0,O0.jsx)(SX,{nodes:e,name:s,showVersion:!0})},s))})]})}var kX=E(fe(),1);function Cwr(e,t){return[...e[0].slice(0,-1),String(t+1)]}var sve=E($(),1);function wwr({index:e,label:t,...r}){let{chords:n}=jn("navTab");return(0,sve.jsx)(lr,{describeChild:!0,title:(0,sve.jsx)(Iu,{label:t,chords:[Cwr(n,e)]}),children:(0,sve.jsx)(tb,{label:t,...r})})}var KWe=E(fe(),1);function kwr(e,t){let{bound:r}=jn("navTab"),n=e.length,i=(0,KWe.useCallback)(a=>(gU(a,r)??n)<n,[r,n]),o=(0,KWe.useCallback)(a=>{let s=e[gU(a,r)??-1];s&&t(s)},[e,t,r]);Eo(i,o)}var lve=E(fe(),1);function _wr(){let[e,t]=(0,lve.useState)(!1);return(0,lve.useEffect)(()=>{let r=!1;return(async()=>{try{let i=await(await fetch("/api/news/nav")).json();r||t(i?.showInNav===!0)}catch{r||t(!1)}})(),()=>{r=!0}},[]),e}var cve=E(fe(),1);async function Jti(e,t){let r=await fetch(qr(`/api/releases/configured?cwd=${encodeURIComponent(e)}`,t));return r.ok?(await r.json())?.configured===!0:void 0}function Ewr(e){let[t,r]=(0,cve.useState)(null),n=yr(),i=`${n??""}\0${e}`;return(0,cve.useEffect)(()=>{if(!e)return;let o=!1;return Jti(e,n).catch(()=>{}).then(a=>{o||r({key:i,configured:a})}),()=>{o=!0}},[e,n,i]),t?.key===i?t.configured:void 0}var Rwr=E(fe(),1);function Awr(e){let{pathname:t}=Uo(),r=Oi(),n=t==="/releases"||t.startsWith("/releases/");(0,Rwr.useEffect)(()=>{e===!1&&n&&r("/sessions",{replace:!0})},[e,n,r])}var eri={path:"/sessions",label:"Sessions"},tri={path:"/backlog",label:"Backlog"},rri={path:"/next",label:"Next"},nri={path:"/releases",label:"Releases"},iri={path:"/news",label:"News"};function Pwr(e,t){return[eri,tri,rri,...e?[nri]:[],...t?[iri]:[]]}var XWe=E($(),1);function Lwr({cwd:e}){let t=Uo(),r=Oi(),n=Ewr(e),i=_wr();Awr(n);let o=n===!0,a=(0,kX.useMemo)(()=>Pwr(o,i),[o,i]),s=(0,kX.useMemo)(()=>a.map(f=>f.path),[a]),l=a.findIndex(f=>t.pathname.startsWith(f.path)),u=(0,kX.useCallback)(f=>{t.pathname!==f&&r(f)},[t.pathname,r]);return kwr(s,u),(0,XWe.jsx)(A5,{value:l===-1?!1:l,textColor:"inherit",indicatorColor:"secondary",children:a.map((f,d)=>(0,XWe.jsx)(wwr,{index:d,label:f.label,onClick:()=>u(f.path)},f.path))})}var Mwr=E($(),1),Iwr=st((0,Mwr.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m5 11h-4v4h-2v-4H7v-2h4V7h2v4h4z"}),"AddCircle");var _X=E($(),1),ori={color:"success.light"};function Dwr(){let[,e]=Uc(),{label:t,chords:r}=jn("newSession");return(0,_X.jsx)(lr,{title:(0,_X.jsx)(Iu,{label:t,chords:r}),children:(0,_X.jsx)(ir,{size:"small",sx:ori,"aria-label":"New session",onClick:()=>e(i=>(i.set("new",""),i),{replace:!0}),children:(0,_X.jsx)(Iwr,{})})})}var fve=E(fe(),1);var uve=E($(),1),ari={color:"inherit"};function Nwr({cwd:e}){let[t,r]=(0,fve.useState)(null),n=yr();return(0,fve.useEffect)(()=>{if(!e){r(null);return}let i=!1;return(async()=>{try{let a=await(await fetch(qr(`/api/github-url?cwd=${encodeURIComponent(e)}`,n))).json();i||r(a?.url??null)}catch{i||r(null)}})(),()=>{i=!0}},[e,n]),t?(0,uve.jsx)(lr,{title:"Open in GitHub",children:(0,uve.jsx)(ir,{sx:ari,onClick:()=>window.open(t,"_blank"),children:(0,uve.jsx)(TL,{})})}):null}var B0=E($(),1),sri={color:"inherit",mr:1.5};function Owr({reconnecting:e}){let{pending:t,error:r,clearError:n,restart:i}=s_("webserver",e);return(0,B0.jsxs)(B0.Fragment,{children:[(0,B0.jsx)(lr,{title:"Restart web server",children:(0,B0.jsx)("span",{children:(0,B0.jsx)(ir,{sx:sri,disabled:t,onClick:i,children:t?(0,B0.jsx)(oo,{size:24}):(0,B0.jsx)(qye,{})})})}),(0,B0.jsx)(Xl,{error:r,onClose:n})]})}var $wr=E(fe(),1);var Bwr=E(fe(),1);function Fwr(e){let t=Fn().palette.primary.main;Eo(jn("focusRepoPicker").matches,(0,Bwr.useCallback)(()=>jl({locate:()=>e.current?.querySelector("button")??null,focus:r=>r.focus()},t),[e,t]))}var EX=E($(),1),lri={width:240,ml:2};function zwr({repos:e,selected:t,onSelect:r}){let n=(0,$wr.useRef)(null);Fwr(n);let{chords:i}=jn("focusRepoPicker");return(0,EX.jsx)(ie,{ref:n,sx:lri,children:(0,EX.jsx)(Fge,{label:t?Tv(t):"Select repo...",tooltip:(0,EX.jsx)(Iu,{label:"Repo",chords:i}),typeToOpen:!0,children:(o,a)=>(0,EX.jsx)(R2r,{repos:e,selected:t,onSelect:r,close:o,initialFilter:a})})})}var Xwr=E(fe(),1);var RX=E(fe(),1);function dve(e){let[t,r]=(0,RX.useState)([]),[n,i]=(0,RX.useState)(!0),o=yr();return(0,RX.useEffect)(()=>{if(!e){r([]),i(!1);return}let a=!1;return i(!0),fetch(qr(`/api/pr-list?cwd=${encodeURIComponent(e)}`,o)).then(s=>s.json()).then(s=>{a||(r(Array.isArray(s?.prs)?s.prs:[]),i(!1))}).catch(()=>{a||(r([]),i(!1))}),()=>{a=!0}},[e,o]),{prs:t,loading:n}}var ZWe=E($(),1);function QWe({text:e}){return(0,ZWe.jsx)(ie,{sx:{p:1.5},children:(0,ZWe.jsx)(Le,{sx:{fontSize:13,color:"text.secondary"},children:e})})}var KA=E($(),1);function Hwr({pr:e,highlighted:t,onHover:r,onPick:n}){let i=_1e(t);return(0,KA.jsx)(ln,{ref:i,selected:t,onMouseDown:o=>o.preventDefault(),onMouseEnter:r,onClick:()=>n(e),sx:{alignItems:"flex-start",py:.75,whiteSpace:"normal"},children:(0,KA.jsxs)(Rt,{spacing:.25,sx:{minWidth:0},children:[(0,KA.jsxs)(Le,{sx:{fontSize:13,lineHeight:1.3,fontWeight:500},children:[e.title,e.isDraft&&(0,KA.jsx)(rn,{label:"Draft",size:"small",variant:"outlined",sx:{ml:.75,height:18,fontSize:10,verticalAlign:"middle"}})]}),(0,KA.jsxs)(Le,{sx:{fontSize:11,color:"text.secondary"},children:["#",e.number," \xB7 ",e.author," \xB7 ",_o(e.createdAt)]})]})})}var JWe=E($(),1);function Uwr({prs:e,highlight:t,onHighlight:r,onPick:n}){return(0,JWe.jsx)(Hp,{dense:!0,disablePadding:!0,sx:{maxHeight:200,overflowY:"auto"},children:e.map((i,o)=>(0,JWe.jsx)(Hwr,{pr:i,highlighted:o===t,onHover:()=>r(o),onPick:n},i.number))})}var Gwr=E(fe(),1);function Wwr(e,t){let r=t.trim().toLowerCase();if(!r)return e;let n=r.replace(/^#/,"");return e.filter(i=>i.title.toLowerCase().includes(r)||i.author.toLowerCase().includes(r)||n!==""&&String(i.number).includes(n))}function Vwr(e,t,r){let[n,i]=(0,Gwr.useState)(""),o=Wwr(e,n),{highlight:a,setHighlight:s,onKeyDown:l}=g_(o,n,t,r);return{filter:n,setFilter:i,filtered:o,highlight:a,setHighlight:s,onKeyDown:l,select:f=>{t(f),r()}}}var L_=E($(),1),qwr={...NB,left:"auto",width:320,maxHeight:"none",overflowY:"visible"};function jwr({cwd:e,onPick:t,close:r}){let{prs:n,loading:i}=dve(e),o=Vwr(n,t,r);return i||n.length===0?(0,L_.jsx)(tn,{elevation:4,sx:qwr,children:(0,L_.jsx)(QWe,{text:i?"Loading open PRs\u2026":"No open PRs"})}):(0,L_.jsxs)(tn,{elevation:4,sx:qwr,children:[(0,L_.jsx)(gS,{autoFocus:!0,value:o.filter,onChange:o.setFilter,onKeyDown:o.onKeyDown,placeholder:"Filter PRs..."}),o.filtered.length===0?(0,L_.jsx)(QWe,{text:"No PRs match"}):(0,L_.jsx)(Uwr,{prs:o.filtered,highlight:o.highlight,onHighlight:o.setHighlight,onPick:o.select})]})}var Kwr=E($(),1);function Ywr({cwd:e,onPick:t,close:r}){return(0,Kwr.jsx)(jwr,{cwd:e,onPick:t,close:r})}var M_=E($(),1);function Zwr({cwd:e,disabled:t,onSelect:r}){let{prs:n,loading:i}=dve(e),[o,a]=(0,Xwr.useState)(null);return i||n.length===0?null:(0,M_.jsxs)(M_.Fragment,{children:[(0,M_.jsx)(Fge,{label:"prs",disabled:t,children:s=>(0,M_.jsx)(Ywr,{cwd:e,onPick:a,close:s})}),o&&(0,M_.jsx)(mge,{pr:o,onSelect:s=>{r(o,s),a(null)},onCancel:()=>a(null)})]})}var Jwr=E($(),1);function Qwr({onStartRun:e,cwd:t}){let r=Ige(t);return!t||r.length===0?null:(0,Jwr.jsx)(Lge,{runs:r,onSelect:n=>e(n,t)})}var AX=E($(),1);function ekr({onCreateAssist:e,onStartRun:t}){let{selectedCwd:r,selectedNode:n}=$n();return(0,AX.jsxs)(Rt,{direction:"row",spacing:.5,sx:{alignItems:"center","&:not(:empty)":{ml:2}},children:[(0,AX.jsx)(Zwr,{cwd:r,disabled:!r,onSelect:(i,o)=>e([...o,String(i.number)],r,{...bB(i),node:n})}),(0,AX.jsx)(Qwr,{onStartRun:(i,o)=>t(i,o,void 0,void 0,n),cwd:r})]})}var ch=E($(),1),cri={minHeight:48,pl:1,pr:14};function tkr({socket:e,selection:t}){let{collapsed:r,onToggleCollapsed:n}=RS(),{design:i}=Fn();return(0,ch.jsxs)(R5,{variant:"dense",disableGutters:!0,sx:cri,children:[r&&(0,ch.jsx)(Cre,{collapsed:r,onToggleCollapsed:n}),(0,ch.jsx)(Owr,{reconnecting:e.reconnecting}),(0,ch.jsx)(Lwr,{cwd:t.selectedCwd}),(0,ch.jsx)(Swr,{}),(0,ch.jsx)(zwr,{repos:t.repos,selected:t.selectedCwd,onSelect:t.setSelectedCwd}),(0,ch.jsxs)(ie,{sx:{display:"flex",alignItems:"center",ml:1},children:[(0,ch.jsx)(zge,{cwd:t.selectedCwd}),(0,ch.jsx)(Nwr,{cwd:t.selectedCwd}),(0,ch.jsx)(Dwr,{})]}),(0,ch.jsx)(ekr,{onCreateAssist:e.createAssistSession,onStartRun:e.startRun}),i!=="slate"&&(0,ch.jsx)(q1e,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits})]})}var hve=E(fe(),1);function rkr(){let[e,t]=(0,hve.useState)(null);return(0,hve.useEffect)(()=>{let r=!1;return(async()=>{try{let i=await(await fetch("/api/health")).json();!r&&typeof i?.nodeName=="string"&&t(i.nodeName)}catch{}})(),()=>{r=!0}},[]),e}var ikr=E($(),1),uri={lineHeight:"32px",bgcolor:"transparent"};function nkr(){let e=rkr();return e?(0,ikr.jsx)(Cxe,{sx:uri,children:e}):null}var okr=E($(),1),akr=st((0,okr.jsx)("path",{d:"M20 5H4c-1.1 0-1.99.9-1.99 2L2 17c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m-9 3h2v2h-2zm0 3h2v2h-2zM8 8h2v2H8zm0 3h2v2H8zm-1 2H5v-2h2zm0-3H5V8h2zm9 7H8v-2h8zm0-4h-2v-2h2zm0-3h-2V8h2zm3 3h-2v-2h2zm0-3h-2V8h2z"}),"Keyboard");var skr=E($(),1),lkr=st((0,skr.jsx)("path",{d:"M12 2C6.49 2 2 6.49 2 12s4.49 10 10 10c1.38 0 2.5-1.12 2.5-2.5 0-.61-.23-1.2-.64-1.67-.08-.1-.13-.21-.13-.33 0-.28.22-.5.5-.5H16c3.31 0 6-2.69 6-6 0-4.96-4.49-9-10-9m5.5 11c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m-3-4c-.83 0-1.5-.67-1.5-1.5S13.67 6 14.5 6s1.5.67 1.5 1.5S15.33 9 14.5 9M5 11.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5S7.33 13 6.5 13 5 12.33 5 11.5m6-4c0 .83-.67 1.5-1.5 1.5S8 8.33 8 7.5 8.67 6 9.5 6s1.5.67 1.5 1.5"}),"Palette");var ckr=E($(),1),ukr=st((0,ckr.jsx)("path",{d:"m12 16.5 4-4h-3v-9h-2v9H8zm9-13h-6v1.99h6v14.03H3V5.49h6V3.5H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2"}),"SystemUpdateAlt");var fkr=E($(),1),dkr=st((0,fkr.jsx)("path",{d:"M20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12s-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6c3.31 0 6 2.69 6 6s-2.69 6-6 6"}),"Brightness4");var hkr=E($(),1),pkr=st((0,hkr.jsx)("path",{d:"M20 8.69V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12zM12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6m0-10c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4"}),"Brightness7");var eGe=E($(),1);function mkr({mode:e}){return e==="dark"?(0,eGe.jsx)(pkr,{fontSize:"small"}):(0,eGe.jsx)(dkr,{fontSize:"small"})}var gkr=E($(),1),ykr=st((0,gkr.jsx)("path",{d:"m20.38 8.57-1.23 1.85a8 8 0 0 1-.22 7.58H5.07A8 8 0 0 1 15.58 6.85l1.85-1.23A10 10 0 0 0 3.35 19a2 2 0 0 0 1.72 1h13.85a2 2 0 0 0 1.74-1 10 10 0 0 0-.27-10.44zm-9.79 6.84a2 2 0 0 0 2.83 0l5.66-8.49-8.49 5.66a2 2 0 0 0 0 2.83"}),"Speed");var c$=E($(),1);function vkr(){let e=Cge();return(0,c$.jsxs)(ln,{onClick:()=>cmt(!e),children:[(0,c$.jsx)(Xv,{children:(0,c$.jsx)(ykr,{fontSize:"small"})}),(0,c$.jsx)(Th,{children:e?"Hide render HUD":"Show render HUD"})]})}var La=E($(),1);function bkr({mode:e,restartLabel:t,updateLabel:r,onToggleColorMode:n,onToggleDesign:i,onShowShortcuts:o,onRestart:a,onUpdate:s}){return[(0,La.jsxs)(ln,{onClick:n,children:[(0,La.jsx)(Xv,{children:(0,La.jsx)(mkr,{mode:e})}),(0,La.jsx)(Th,{children:"Toggle dark mode"})]},"color-mode"),(0,La.jsxs)(ln,{onClick:i,children:[(0,La.jsx)(Xv,{children:(0,La.jsx)(lkr,{fontSize:"small"})}),(0,La.jsx)(Th,{children:"Toggle Slate design"})]},"design"),(0,La.jsx)(vkr,{},"render-hud"),(0,La.jsxs)(ln,{onClick:o,children:[(0,La.jsx)(Xv,{children:(0,La.jsx)(akr,{fontSize:"small"})}),(0,La.jsx)(Th,{children:"Keyboard shortcuts"})]},"shortcuts"),(0,La.jsx)(Ci,{},"restart-divider"),(0,La.jsxs)(ln,{onClick:a,children:[(0,La.jsx)(Xv,{children:(0,La.jsx)(UL,{fontSize:"small"})}),(0,La.jsx)(Th,{children:t})]},"restart"),(0,La.jsxs)(ln,{onClick:s,children:[(0,La.jsx)(Xv,{children:(0,La.jsx)(ukr,{fontSize:"small"})}),(0,La.jsx)(Th,{children:r})]},"update")]}var xkr=E(fe(),1);var Skr=E($(),1);function Tkr({peer:e,onRestart:t,onClose:r}){let[n,i]=(0,xkr.useState)(!1);return(0,Skr.jsx)(bi,{title:`Restart ${e}?`,message:`Restarts the sessions daemon and web server on ${e}. Its sessions resume when the daemon is back. This page stays open.`,confirmLabel:"Restart",busy:n,autoFocusConfirm:!0,onConfirm:()=>{i(!0),t(e).finally(r)},onCancel:r})}function Ckr(e){let t=new Map;for(let r of e){let n=t.get(r.group)??[];n.push(r),t.set(r.group,n)}return[...t].map(([r,n])=>({name:r,shortcuts:n}))}var fri=Object.keys(BL);function wkr(){let e=FL();return Ckr(fri.map(t=>SS(t,e)))}var Rp=E($(),1),dri={display:"flex",alignItems:"center",justifyContent:"space-between",pr:1},hri={display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,py:.5};function kkr({onClose:e}){let t=wkr();return(0,Rp.jsxs)(Wl,{open:!0,onClose:e,maxWidth:"xs",fullWidth:!0,"aria-labelledby":"shortcuts-dialog-title",children:[(0,Rp.jsxs)(ku,{id:"shortcuts-dialog-title",sx:dri,children:["Keyboard shortcuts",(0,Rp.jsx)(ir,{size:"small","aria-label":"Close",onClick:e,children:(0,Rp.jsx)(Wo,{fontSize:"small"})})]}),(0,Rp.jsx)(wu,{dividers:!0,children:t.map(r=>(0,Rp.jsxs)(ie,{component:"section",sx:{mb:1.5},children:[(0,Rp.jsx)(Le,{variant:"overline",color:"text.secondary",children:r.name}),r.shortcuts.map(n=>(0,Rp.jsxs)(ie,{sx:hri,children:[(0,Rp.jsx)(Le,{variant:"body2",children:n.label}),(0,Rp.jsx)(Rt,{direction:"row",spacing:.5,children:(0,Rp.jsx)(ere,{chords:n.chords})})]},n.label))]},r.name))})]})}var XA=E($(),1);function _kr({reconnecting:e,onClose:t}){let{pending:r,error:n,clearError:i,restart:o}=s_(NF.target,e);return(0,XA.jsxs)(XA.Fragment,{children:[(0,XA.jsx)(bi,{title:NF.label,message:NF.message,confirmLabel:"Restart",busy:r,autoFocusConfirm:!0,onConfirm:()=>{o()},onCancel:t}),(0,XA.jsx)(Xl,{error:n,onClose:i})]})}var Rkr=E($(),1);function pri(e){return e?{title:`Update assist on ${e}?`,message:`This runs 'assist update' on ${e} as a new session, then restarts its web server. This page stays open.`}:{title:"Update assist",message:"This starts a new session running 'assist update'. Its output will appear in the terminal."}}function Ekr({peer:e,onConfirm:t,onClose:r}){return(0,Rkr.jsx)(bi,{...pri(e),confirmLabel:"Update",onConfirm:()=>{t(),r()},onCancel:r})}var F0=E(fe(),1);async function mri(e){try{let t=await fetch(`/api/node-doctor?link=${encodeURIComponent(e)}`);return t.ok?(await t.json()).hop:null}catch{return null}}async function Akr(e,t){let r=await mri(e);if(!r)return t;let n=r.remediation?` \u2014 ${r.remediation}`:"";return`${t}: ${r.hop} hop failed: ${r.error}${n}`}var pT=E(fe(),1);function Pkr(e){let{nodes:t}=_c(),[r,n]=(0,pT.useState)(null),i=(0,pT.useRef)(!1),o=r?t?.links.find(l=>l.name===r.peer):void 0;(0,pT.useEffect)(()=>{if(!(!r||!o)){if(o.state!=="connected"){i.current=!0;return}i.current&&(n(null),e(r.describe(r.peer,o.peerVersion)))}},[r,o,e]);let a=(0,pT.useCallback)((l,u)=>{i.current=!1,n({peer:l,describe:u})},[]),s=(0,pT.useCallback)(()=>n(null),[]);return{watch:a,stop:s}}var gri=9e4;function pve(){let[e,t]=(0,F0.useState)(null),[r,n]=(0,F0.useState)(null),i=(0,F0.useRef)(void 0),o=(0,F0.useCallback)(f=>{clearTimeout(i.current),t(f)},[]),{watch:a,stop:s}=Pkr(o);(0,F0.useEffect)(()=>()=>clearTimeout(i.current),[]);let l=(0,F0.useCallback)(async(f,d)=>{n(await Akr(f,d))},[]);return{requestThenAwait:(0,F0.useCallback)(async(f,d,h,p)=>{let m;try{m=await h()}catch{}return m?.ok?(a(f,p),clearTimeout(i.current),i.current=setTimeout(()=>{s(),l(f,`${f} did not come back`)},gri),!0):(await l(f,`${d} failed (${await DF(m)})`),!1)},[l,a,s]),back:e,clearBack:()=>t(null),error:r,clearError:()=>n(null)}}var yri=(e,t)=>t?`${e} is back (v${t})`:`${e} is back`;function Lkr(){let{requestThenAwait:e,...t}=pve();return{restart:n=>e(n,`Restart ${n}`,()=>a_("both",n),yri),...t}}var PX=E(fe(),1);var $0=E(fe(),1);function Mkr(e){return e.commandType==="assist"&&e.assistArgs?.[0]==="update"&&e.status==="done"}function mve(e,t,r){let[n,i]=(0,$0.useState)(!1),[o,a]=(0,$0.useState)(!1),s=(0,$0.useRef)(!1),l=(0,$0.useRef)(e);l.current=e;let u=(0,$0.useRef)(new Set),f=(0,$0.useCallback)(()=>{s.current=!1,a(!1),u.current=new Set(l.current.filter(Mkr).map(d=>d.id)),i(!0)},[]);return(0,$0.useEffect)(()=>{if(!n||o)return;if(t){s.current=!0;return}if(!s.current)return;e.some(h=>Mkr(h)&&h.node===r&&!u.current.has(h.id))&&a(!0)},[n,o,t,e,r]),{arm:f,completed:o}}var Ikr=(e,t)=>t?`${e} updated to v${t}`:`${e} updated`;function vri(e){return fetch(`/api/self-update?node=${encodeURIComponent(e)}`,{method:"POST"})}function Dkr(e){let{nodes:t}=_c(),{launchAssist:r}=al(),{requestThenAwait:n,...i}=pve(),[o,a]=(0,PX.useState)(null),[s,l]=(0,PX.useState)(),u=m=>t?.links.find(g=>g.name===m)?.state,{arm:f,completed:d}=mve(e,u(s)!=="connected",s);(0,PX.useEffect)(()=>{!d||!s||(l(void 0),n(s,`Restart ${s}'s web server`,()=>a_("webserver",s),Ikr))},[d,s,n]);let h=async m=>{a(`Updating assist on ${m}\u2026`),await n(m,`Update ${m}`,()=>vri(m),Ikr),a(null)};return{update:m=>{if(u(m)!=="connected"){h(m);return}l(m),f(),r(["update"],void 0,{node:m})},progress:o,...i}}var z0=E($(),1);function Nkr({dialog:e,peer:t,sessions:r,reconnecting:n,onClose:i}){let{launchAssist:o,armUpdateReload:a}=al(),s=Lkr(),l=Dkr(r);return(0,z0.jsxs)(z0.Fragment,{children:[e==="shortcuts"&&(0,z0.jsx)(kkr,{onClose:i}),e==="restart"&&t&&(0,z0.jsx)(Tkr,{peer:t,onRestart:s.restart,onClose:i}),e==="restart"&&!t&&(0,z0.jsx)(_kr,{reconnecting:n,onClose:i}),e==="update"&&(0,z0.jsx)(Ekr,{peer:t,onConfirm:()=>{if(t){l.update(t);return}a(),o(["update"])},onClose:i}),(0,z0.jsx)(jK,{notices:s}),(0,z0.jsx)(jK,{notices:l})]})}var Okr=E($(),1),Bkr=st((0,Okr.jsx)("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}),"Settings");var Fkr=E(fe(),1);var LX=E($(),1);function $kr(){let e=Oi(),t=(0,Fkr.useCallback)(()=>e("/config"),[e]),{matches:r,chords:n}=jn("openConfig");return Eo(r,t),(0,LX.jsx)(lr,{describeChild:!0,title:(0,LX.jsx)(Iu,{label:"Config",chords:n}),children:(0,LX.jsx)(ir,{size:"small",sx:{color:"inherit"},"aria-label":"Config",onClick:t,children:(0,LX.jsx)(Bkr,{fontSize:"small"})})})}var zkr=E($(),1),Hkr=st((0,zkr.jsx)("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}),"Menu");var gve=E(fe(),1);var MX=E($(),1);function Ukr({open:e,onOpen:t}){let r=(0,gve.useRef)(null),{matches:n,chords:i}=jn("openMenu");return Eo(n,(0,gve.useCallback)(()=>{r.current&&t(r.current)},[t])),(0,MX.jsx)(lr,{describeChild:!0,title:(0,MX.jsx)(Iu,{label:"Menu",chords:i}),children:(0,MX.jsx)(ir,{ref:r,onClick:o=>t(o.currentTarget),size:"small",sx:{color:"inherit"},"aria-label":"Open menu","aria-haspopup":"true","aria-expanded":e?"true":void 0,children:(0,MX.jsx)(Hkr,{fontSize:"small"})})})}var u$=E($(),1);function Wkr({open:e,onOpen:t}){let{design:r}=Fn();return(0,u$.jsxs)(ie,{sx:{position:"fixed",top:8,right:16,zIndex:n=>n.zIndex.drawer+2,display:"flex",alignItems:"center",gap:.5,color:"inherit"},children:[r!=="slate"&&(0,u$.jsx)(K1e,{}),(0,u$.jsx)($kr,{}),(0,u$.jsx)(Ukr,{open:e,onOpen:t})]})}var ZA=E(fe(),1);var Vkr=E(fe(),1);var Gkr=!0,bri=new Set(["openMenu","cycleCards"]),xri=Object.keys(BL).filter(e=>!bri.has(e));function qkr(e,t){let r=FL();(0,Vkr.useEffect)(()=>{if(!e)return;let n=i=>{xri.some(o=>SS(o,r).matches(i))&&t()};return globalThis.addEventListener("keydown",n,Gkr),()=>globalThis.removeEventListener("keydown",n,Gkr)},[e,t,r])}function jkr(){let[e,t]=(0,ZA.useState)(null),[r,n]=(0,ZA.useState)(!0),i=!!e,o=(0,ZA.useCallback)(()=>t(null),[]),a=(0,ZA.useCallback)(s=>{n(!0),t(s)},[]);return qkr(i,(0,ZA.useCallback)(()=>{n(!1),t(null)},[])),{anchorEl:e,open:i,close:o,openAt:a,restoreFocus:r}}var IX=E(fe(),1);function Ykr(e){Eo(jn("shortcutsSheet").matches,e)}function Kkr(){let[e,t]=(0,IX.useState)(null);Ykr((0,IX.useCallback)(()=>t("shortcuts"),[]));let r=(0,IX.useCallback)(()=>t(null),[]);return{dialog:e,showDialog:t,closeDialog:r}}function Xkr(){let{nodes:e,selected:t}=_c();return e&&t&&t!==e.local?t:void 0}function Zkr(e){return{restartLabel:e?`Restart ${e}`:NF.label,updateLabel:e?`Update assist on ${e}`:"Update assist"}}function Qkr(e,t,r){let n=i=>()=>{i(),e()};return{onToggleColorMode:n(t),onToggleDesign:n(r)}}var mT=E($(),1);function Jkr({mode:e,toggle:t,toggleDesign:r,sessions:n,reconnecting:i}){let{anchorEl:o,open:a,close:s,openAt:l,restoreFocus:u}=jkr(),{dialog:f,showDialog:d,closeDialog:h}=Kkr(),p=Xkr(),m=g=>()=>{s(),d(g)};return(0,mT.jsxs)(mT.Fragment,{children:[(0,mT.jsx)(Wkr,{open:a,onOpen:l}),(0,mT.jsxs)(Bs,{anchorEl:o,open:a,onClose:s,disableRestoreFocus:!u,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[(0,mT.jsx)(nkr,{}),bkr({mode:e,...Zkr(p),...Qkr(s,t,r),onShowShortcuts:m("shortcuts"),onRestart:m("restart"),onUpdate:m("update")})]}),(0,mT.jsx)(Nkr,{dialog:f,peer:p,sessions:n,reconnecting:i,onClose:h})]})}var r_r=E(fe(),1);var t_r=E($(),1);function e_r({conflict:e,onConfirm:t,onCancel:r}){let{name:n,cwd:i,port:o,group:a}=e.existing,s=nm(i),l=o?` on port ${o}`:"",u=s?` in ${s}`:"",f=a?`, holding the ${a} server slot`:"";return(0,t_r.jsx)(bi,{title:a?`Replace the ${a} server?`:"Replace running server?",message:`"${n}" is already serving${l}${u}${f}. Replace it \u2014 stop the running server and start this one?`,confirmLabel:"Replace",confirmColor:"error",onConfirm:t,onCancel:r})}var yve=E($(),1);function n_r({socket:e,children:t}){let{serverConflict:r,clearServerConflict:n,retrySession:i,stopSession:o,startRun:a,discardSession:s}=e,l=(0,r_r.useMemo)(()=>({onStop:o,onStart:a,onDiscard:s}),[o,a,s]),u=()=>{r&&(r.runName?a(r.runName,r.cwd,!0,r.launchedFrom,r.node):r.sessionId&&i(r.sessionId,!0),n())};return(0,yve.jsxs)(twe.Provider,{value:l,children:[t,r&&(0,yve.jsx)(e_r,{conflict:r,onConfirm:u,onCancel:n})]})}var i_r=new Map;function o_r(e,t){if(!uie())return;let r=i_r.get(e);if(i_r.set(e,t),!!r)for(let[n,i]of Object.entries(t))Object.is(i,r[n])||ky(`\u0394 ${e}.${n}`)}var bve=E(fe(),1);function a_r(e,t,r){if(!t)return null;let n=e[t];if(!n)return null;let i=r.find(o=>o.id===n);return!i||im(i)!==t?null:n}function Pv(e,t,r){if(e)return t.find(n=>n.id===e)??r.find(n=>n.sessionId===e)}function vve(){let{pathname:e}=Uo();return e.startsWith("/backlog")||e.startsWith("/usage")}function s_r({selectedCwd:e,selectedCardId:t,sessions:r,history:n,activeByRepo:i,onSelect:o}){let a=Pv(t,r,n),s=a&&im(a),l=!!(s&&s===e),u=a_r(i,e,r),f=(0,bve.useRef)(t),d=vve();(0,bve.useEffect)(()=>{let h=f.current!==t&&!!s;f.current=t,!(d||h||l||!u)&&o(u)},[t,s,l,u,o,d])}var Sve=E(fe(),1);function l_r(e,t,r,n){return Pv(e,t,r)?.cwd||n}function c_r(e,t,r,n){let i=l_r(e,t,r,n.cwd),o=Pv(e,t,r);return{cwd:i,node:o?.cwd?o.node:n.node}}var tGe=E(fe(),1);function u_r(e,t,r){let{cwd:n,node:i,origin:o}=r,a=(0,tGe.useCallback)((l,u)=>{let f=lT(u,t),d=pX(e,l);return d?d.clones[f]:f===(l===n?i:Ep)?l:void 0},[e,t,n,i]),s=(0,tGe.useCallback)(l=>pX(e,l)?.origin??(l===n?o:void 0),[e,n,o]);return{cloneOn:a,originOf:s}}var xve=E(fe(),1);function f_r(e,t,r,n){let i=(0,xve.useRef)(e);(0,xve.useEffect)(()=>{if(i.current===e)return;i.current=e;let o=pX(t,r)?.clones[e];o&&n(o,e)},[e,t,r,n])}var f$=E(fe(),1);function d_r(e,t,r){if(t.node!==void 0)return t.node;let n=new Set(e.flatMap(i=>Object.entries(i.clones).filter(([,o])=>o===t.cwd).map(([o])=>o)));return n.has(r)?r:n.size===0||n.has(Ep)?Ep:[...n][0]}function h_r(e,t,r,n){let[i,o]=(0,f$.useState)({cwd:e}),a=(0,f$.useCallback)((l,u,f)=>o({cwd:l,node:u,origin:f}),[]);(0,f$.useEffect)(()=>{e&&!i.cwd&&o({cwd:e})},[e,i.cwd]);let s=d_r(t,{cwd:i.cwd,node:i.node===void 0?void 0:lT(i.node,n)},r);return{selectedCwd:i.cwd,selectedNode:s||void 0,selectedPick:{cwd:i.cwd,node:s,origin:i.origin},setSelectedCwd:a}}var p_r=E(fe(),1);function Tve(e,t,r){let n=Pv(e,t,r);return n&&im(n)}function m_r(e,t,r,n){let i=Tve(e,t,r),o=Pv(e,t,r),a=o?.node??Ep,s=o?.repoGroup?.origin;(0,p_r.useEffect)(()=>{i&&n(i,a,s)},[i,a,s,n])}function g_r(e,t,r,n,i){let o=i.nodes?.local,a=lT(i.selected,o),s=(0,Sve.useMemo)(()=>eTr(e,t),[e,t]),{selectedCwd:l,selectedNode:u,selectedPick:f,setSelectedCwd:d}=h_r(e,s,a,o);m_r(r,n,t,d),f_r(a,s,l,d);let{cloneOn:h,originOf:p}=u_r(s,o,f),m=(0,Sve.useMemo)(()=>s.map(v=>tTr(v,a)),[s,a]),{cwd:g,node:y}=c_r(r,n,t,{cwd:l,node:u});return(0,Sve.useMemo)(()=>({repos:m,selectedCwd:l,selectedNode:u,worktreeCwd:g,worktreeNode:y,setSelectedCwd:d,cloneOn:h,originOf:p}),[m,l,u,g,y,d,h,p])}var wve=E(fe(),1);var I_=E(fe(),1);var y_r=E(fe(),1),Cve="assist:reloaded-after-update";function v_r(e){(0,y_r.useEffect)(()=>{globalThis.sessionStorage?.getItem(Cve)&&(globalThis.sessionStorage.removeItem(Cve),e({message:"Reloaded after updating assist",sessionId:null}))},[e])}function b_r(e,t,r,n){let{arm:i,completed:o}=mve(e,t),a=(0,I_.useRef)(!1),s=(0,I_.useCallback)(()=>{globalThis.sessionStorage?.setItem(Cve,"1")},[]),{error:l,restart:u}=s_("webserver",t,s);return v_r(r),(0,I_.useEffect)(()=>{l&&n(l)},[l,n]),(0,I_.useEffect)(()=>{!o||a.current||(a.current=!0,u())},[o,u]),{armUpdateReload:(0,I_.useCallback)(()=>{a.current=!1,i()},[i])}}function x_r(e){let{armUpdateReload:t}=b_r(e.sessions,e.reconnecting,e.setSuccess,e.setError),r=yy(e.selectSession),n=(0,wve.useMemo)(()=>({launchAssist:e.createAssistSession,launchAgentInStream:e.createSessionInStream,resumeSession:e.resumeSession,armUpdateReload:t,activateSession:r,sendInput:e.sendInput}),[e.createAssistSession,e.createSessionInStream,e.resumeSession,t,r,e.sendInput]),i=Oi(),o=(0,wve.useCallback)(a=>{e.selectSession(a),i("/sessions"),e.clearSuccess()},[i,e.selectSession,e.clearSuccess]);return{launch:n,viewLaunchedSession:o}}var T_r=E(fe(),1);function S_r(e,t,r,n){let i=Tve(e,t,r);(0,T_r.useEffect)(()=>{e&&i&&n({type:"set-active",cwd:i,sessionId:e})},[e,i,n])}var kve=E(fe(),1);function C_r(e,t){let r=(0,kve.useRef)(new Map);(0,kve.useEffect)(()=>{let n=new Set;for(let{id:i,status:o}of e)n.add(i),r.current.get(i)!==o&&(r.current.set(i,o),console.debug(`[sessions] render session ${i} status=${o}`),t({type:"ui-status",sessionId:i,status:o}));for(let i of r.current.keys())n.has(i)||r.current.delete(i)},[e,t])}var d$=E(fe(),1),w_r="assist.sessions.node";function Tri(){try{return localStorage.getItem(w_r)}catch{return null}}function Sri(e){try{localStorage.setItem(w_r,e)}catch{}}function k_r(e){let[t,r]=(0,d$.useState)(Tri),n=(0,d$.useCallback)(i=>{r(i),Sri(i)},[]);return(0,d$.useMemo)(()=>{let i=e?[e.local,...e.links.map(o=>o.name)]:[];return{nodes:e,names:i,visible:i.length>1,selected:t&&i.includes(t)?t:e?.local,select:n}},[e,t,n])}var E_r=E(fe(),1);function __r(e){let t=e;if(t.type==="create")return{cwd:t.cwd,title:t.prompt?.trim()||(t.design?"New design session":"New session"),node:t.node};if(t.type==="create-assist"){let r=t.title?.trim();return{cwd:t.cwd,title:r||"New session",named:!!r,node:t.node}}return null}function R_r(e,t){return(0,E_r.useCallback)(r=>{let n=e.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify(r));let i=__r(r);i&&t(i)},[e,t])}var Lv=E(fe(),1);function _ve(e,t,r,n,i){e({type:"create",prompt:r||void 0,cwd:n,...t,...i?{node:i}:{}})}function A_r(e){return(t,r,n)=>_ve(e,{design:!0},t,r,n)}function P_r(e){return(t,r,n,i)=>_ve(e,{harness:t},r,n,i)}function L_r(e){return(t,r,n)=>_ve(e,{auto:!0},t,r,n)}function M_r(e){return(t,r,n)=>e({type:"create-assist",assistArgs:t,cwd:r,...n})}function I_r(e){return(t,r,n,i,o)=>e({type:"resume",sessionId:t,cwd:r,name:n,harness:i,node:o})}function D_r(e,t){return(r,n)=>{t.delete(r),e({type:"retry",sessionId:r,replace:n})}}function N_r(e,t){return r=>{t.delete(r),e({type:"restart",sessionId:r})}}function O_r(e,t){return r=>{e({type:"dismiss",sessionId:r}),t.delete(r)}}function B_r(e,t){return r=>{e({type:"discard",sessionId:r}),t.delete(r)}}function F_r(e){return t=>e({type:"stop",sessionId:t})}function $_r(e){return(t,r,n,i,o)=>e({type:"create-run",runName:t,cwd:r,replace:n,launchedFrom:i,node:o})}function z_r(e){return(t,r)=>e({type:"set-autoapprove",sessionId:t,enabled:r})}function H_r(e){return(t,r)=>e({type:"set-autoadvance",sessionId:t,enabled:r})}function U_r(e){return(t,r)=>e({type:"set-starred",sessionId:t,starred:r})}function W_r(e){return(t,r)=>e({type:"input",sessionId:t,data:r,viewerId:qK})}function G_r(e){return(t,r,n,i)=>e({type:"resize",sessionId:t,cols:r,rows:n,viewerId:qK,claim:i==="claim",refresh:i==="refresh"})}function V_r(e){return(t,r,n,i)=>e({type:"pr-decision",sessionId:t,requestId:r,decision:n,...i})}var QA=E(fe(),1);function q_r(e){return(t,r,n)=>e({type:"create",prompt:r||void 0,cwd:n,joinSessionId:t,auto:!0})}function j_r(e){return{createSession:(0,QA.useMemo)(()=>L_r(e),[e]),createSessionInStream:(0,QA.useMemo)(()=>q_r(e),[e]),createDesignSession:(0,QA.useMemo)(()=>A_r(e),[e]),createHarnessSession:(0,QA.useMemo)(()=>P_r(e),[e]),createAssistSession:(0,QA.useMemo)(()=>M_r(e),[e]),resumeSession:(0,QA.useMemo)(()=>I_r(e),[e])}}var DX=E(fe(),1);function Y_r(e,t){let r=(0,DX.useCallback)((a,s)=>{D_r(e,t.current)(a,s)},[e,t]),n=(0,DX.useCallback)(a=>{N_r(e,t.current)(a)},[e,t]),i=(0,DX.useCallback)(a=>{O_r(e,t.current)(a)},[e,t]),o=(0,DX.useCallback)(a=>{B_r(e,t.current)(a)},[e,t]);return{retrySession:r,restartSession:n,dismissSession:i,discardSession:o}}function K_r(e,t,r){return(n,i)=>{let o=t.get(n);return o&&(i(o),e({type:"snapshot",sessionId:n})),r.set(n,i),()=>r.delete(n)}}function X_r(e,t,r){let n={...j_r(e),sendInput:(0,Lv.useMemo)(()=>W_r(e),[e]),sendResize:(0,Lv.useMemo)(()=>G_r(e),[e]),sendPrDecision:(0,Lv.useMemo)(()=>V_r(e),[e]),setAutoApprove:(0,Lv.useMemo)(()=>z_r(e),[e]),setAutoAdvance:(0,Lv.useMemo)(()=>H_r(e),[e]),setStarred:(0,Lv.useMemo)(()=>U_r(e),[e]),stopSession:(0,Lv.useMemo)(()=>F_r(e),[e]),startRun:(0,Lv.useMemo)(()=>$_r(e),[e])},i=(0,Lv.useMemo)(()=>K_r(e,t.current,r.current),[e,t,r]);return{...n,...Y_r(e,t),onOutput:i}}var NX=E(fe(),1);function Z_r(e,t,r){let n=(0,NX.useCallback)(s=>{r(s),e({type:"fetch-transcript",sessionId:s})},[e,r]),i=(0,NX.useCallback)(s=>e({type:"fetch-user-messages",sessionId:s}),[e]),o=(0,NX.useCallback)(()=>{r(null)},[r]),a=(0,NX.useCallback)(s=>{r(null),t(s)},[t,r]);return{viewTranscript:n,fetchUserMessages:i,clearTranscript:o,selectSession:a}}var Pve=E(fe(),1);function Q_r(e,t){let r=new Set(t.map(i=>i.id)),n=null;for(let i of Object.values(e))r.has(i)&&(n=i);return n}var h$=E(fe(),1);function J_r(){let[e,t]=(0,h$.useState)(null),r=(0,h$.useRef)(e);r.current=e;let n=(0,h$.useCallback)(()=>r.current,[]);return{activeId:e,setActiveId:t,getActiveId:n}}var t5r=E(fe(),1);function e5r(e,t,r=null){return t!==null?e.some(n=>n.id===t)?t:e[0]?.id??null:r&&e.some(n=>n.id===r)?r:e[0]?.id??null}function r5r(e,t,r){let n=vve();(0,t5r.useEffect)(()=>{if(n){t(null);return}t(i=>e5r(e,i,r))},[e,t,r,n])}var Eve=E(fe(),1);function n5r(){let[e,t]=(0,Eve.useState)({}),[r,n]=(0,Eve.useState)(null),[i,o]=(0,Eve.useState)(null);return{activeByRepo:e,setActiveByRepo:t,daemonVersion:r,setDaemonVersion:n,nodes:i,setNodes:o}}var H0=E(fe(),1);function i5r(e,t){for(let r of t)clearTimeout(e.get(r)),e.delete(r)}function o5r(e,t){let r=new Set(t.map(n=>n.id));return[...e.keys()].filter(n=>!r.has(n))}function a5r(e,t){if(!t.some(n=>e.has(n)))return e;let r=new Set(e);for(let n of t)r.delete(n);return r}function s5r(e,t){let r=[];for(let n of t){let i=e.get(n.id);i!==void 0&&i!==n.startedAt&&r.push(n.id)}return r}function l5r(e,t){return t.filter(r=>r.commandType==="run"&&e.get(r.id)!==r.startedAt).map(r=>r.id)}var Cri=1500;function c5r(){let[e,t]=(0,H0.useState)(new Set),r=(0,H0.useRef)(new Map),n=(0,H0.useRef)(new Map),i=(0,H0.useCallback)(s=>{t(l=>l.has(s)?l:new Set(l).add(s))},[]),o=(0,H0.useCallback)(s=>{let l=n.current;for(let u of s)clearTimeout(l.get(u)),l.set(u,setTimeout(()=>{l.delete(u),i(u)},Cri))},[i]);(0,H0.useEffect)(()=>{let s=n.current;return()=>{for(let l of s.values())clearTimeout(l)}},[]);let a=(0,H0.useCallback)(s=>{let l=o5r(r.current,s),u=[...s5r(r.current,s),...l],f=l5r(r.current,s);r.current=new Map(s.map(d=>[d.id,d.startedAt])),i5r(n.current,l),u.length&&t(d=>a5r(d,u)),o(f)},[o]);return{initialized:e,markInitialized:i,syncSessions:a}}var D_=E(fe(),1);function u5r(){let[e,t]=(0,D_.useState)(null),[r,n]=(0,D_.useState)(null),[i,o]=(0,D_.useState)(null),a=(0,D_.useCallback)(()=>t(null),[]),s=(0,D_.useCallback)(()=>n(null),[]),l=(0,D_.useCallback)(()=>o(null),[]);return{error:e,setError:t,clearError:a,success:r,setSuccess:n,clearSuccess:s,serverConflict:i,setServerConflict:o,clearServerConflict:l}}var Mv=E(fe(),1);function f5r(e,t){return[...e,{...t,status:"launching"}]}function Rve(e){return e.find(t=>t.status==="launching")}function d5r(e){let t=Rve(e);return t?e.filter(r=>r.id!==t.id):e}function h5r(e,t){let r=Rve(e);return r?rGe(e,r.id,t):e}function rGe(e,t,r){return e.map(n=>n.id===t&&n.status==="launching"?{...n,status:"error",error:r}:n)}function p5r(e,t){return e.filter(r=>r.id!==t)}var m5r=E(fe(),1);var wri=6e4,kri="Launch timed out \u2014 the session did not start.";function g5r(e,t){(0,m5r.useEffect)(()=>{let r=e.filter(i=>i.status==="launching");if(r.length===0)return;let n=r.map(i=>setTimeout(()=>t(o=>rGe(o,i.id,kri)),Math.max(0,wri-(Date.now()-i.startedAt))));return()=>n.forEach(clearTimeout)},[e,t])}function y5r(){let[e,t]=(0,Mv.useState)([]),r=(0,Mv.useRef)([]),n=(0,Mv.useCallback)(l=>{r.current=l(r.current),t(r.current)},[]),i=(0,Mv.useCallback)(l=>{n(u=>f5r(u,{id:crypto.randomUUID(),startedAt:Date.now(),...l}))},[n]),o=(0,Mv.useCallback)(()=>{let l=Rve(r.current);return n(d5r),l?.named?l.title:void 0},[n]),a=(0,Mv.useCallback)(l=>n(u=>h5r(u,l)),[n]),s=(0,Mv.useCallback)(l=>n(u=>p5r(u,l)),[n]);return g5r(e,n),{pendingLaunches:e,addPendingLaunch:i,resolvePendingLaunch:o,failPendingLaunch:a,dismissPendingLaunch:s}}var OX=E(fe(),1);function v5r(){let[e,t]=(0,OX.useState)(null),[r,n]=(0,OX.useState)({}),i=(0,OX.useCallback)((o,a)=>{o!=="claude"&&n(s=>({...s,[o]:a}))},[]);return{rateLimits:e,setRateLimits:t,harnessRateLimits:r,setHarnessRateLimits:i}}var b5r=E(fe(),1);function x5r(e,t){return(0,b5r.useCallback)(r=>{e(r),t(r)},[e,t])}var nGe=E(fe(),1);function T5r(){let e=(0,nGe.useRef)(new Map),t=(0,nGe.useRef)(new Map);return{buffers:e,handlers:t}}var Ave=E(fe(),1);function S5r(){let[e,t]=(0,Ave.useState)(null),[r,n]=(0,Ave.useState)(null),[i,o]=(0,Ave.useState)(null);return{transcript:e,setTranscript:t,viewingTranscriptSessionId:r,setViewingTranscriptSessionId:n,userMessages:i,setUserMessages:o}}var N_=E(fe(),1);function C5r(e,t){let r=e.sessionId;t.buffers.current?.delete(r),t.handlers.current?.get(r)?.("\x1Bc")}function w5r(e,t){let r=e.sessionId,n=t.resolvePendingLaunch();e.isNew&&t.getActiveId()!==null||(t.setViewingTranscriptSessionId(null),t.setActiveId(r)),e.isNew&&t.setSuccess({message:n?`Started ${n}`:"New session started",sessionId:r})}function k5r(e,t){let r=e.message;t.setError(r),t.failPendingLaunch(r)}function _5r(e,t){let r=e.rateLimits,n=e.harness;!n||n==="claude"?t.setRateLimits(r):t.setHarnessRateLimits?.(n,r)}function E5r(e,t){t.setNodes({local:e.local,links:e.links??[]})}function R5r(e,t){t.setSuccess({message:e.message,sessionId:null})}function A5r(e,t){let r=e.sessionId,n=t.buffers.current?.get(r)??"";t.buffers.current?.set(r,n+e.data),t.handlers.current?.get(r)?.(e.data),t.markInitialized(r)}function P5r(e,t){t.setServerConflict({existing:e.existing,runName:e.runName,cwd:e.cwd,sessionId:e.sessionId,launchedFrom:e.launchedFrom,node:e.node})}function L5r(e,t){let r=e.sessions;t.setSessions(r),e.cwd&&t.setCurrentCwd(e.cwd),t.setActiveByRepo(e.active??{})}function M5r(e,t){let r=e.sessionId,n=e.data;t.buffers.current?.set(r,n),t.handlers.current?.get(r)?.(`\x1Bc${n}`)}var _ri={sessions:L5r,created:w5r,history:(e,t)=>t.setHistory(e.sessions),transcript:(e,t)=>t.setTranscript({sessionId:e.sessionId,messages:e.messages}),"user-messages":(e,t)=>t.setUserMessages({sessionId:e.sessionId,messages:e.messages}),hello:(e,t)=>t.setDaemonVersion(e.version),nodes:E5r,error:k5r,notice:R5r,"run-conflict":P5r,limits:_5r,clear:C5r,output:A5r,snapshot:M5r};function I5r(e,t){_ri[e.type]?.(e,t)}function D5r(e,t={}){let r=location.protocol==="https:"?"wss:":"ws:",n=new WebSocket(`${r}//${location.host}/ws`);return n.onopen=()=>{t.onOpen?.(),n.send(JSON.stringify({type:"hello"})),n.send(JSON.stringify({type:"history"}))},n.onmessage=i=>{I5r(JSON.parse(i.data),e)},n.onclose=()=>t.onClose?.(),n}function N5r(e,t,r,n){let i=!1,o,a=0,s=!1,l=()=>{i||t(D5r(e,{onOpen:()=>{s&&r(),s=!1,n(!1),a=0},onClose:()=>{if(i)return;s=!0,n(!0);let u=Math.min(300*2**a,2e3);a+=1,o=setTimeout(l,u)}}))};return l(),()=>{i=!0,o&&clearTimeout(o)}}function O5r(e){let t=(0,N_.useRef)(null),[r,n]=(0,N_.useState)(!1),{handleSessions:i,markInitialized:o,buffers:a,handlers:s}=e;(0,N_.useEffect)(()=>{let u=()=>{a.current?.clear();let d=s.current;if(d)for(let h of d.values())h("\x1Bc")},f=N5r({...e,setSessions:i},d=>{t.current=d},u,n);return()=>{f(),t.current?.close()}},[i,o,a,s]);let l=(0,N_.useCallback)(()=>{let u=t.current;u?.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"history"}))},[]);return{wsRef:t,requestHistory:l,reconnecting:r}}function B5r(){let[e,t]=(0,Pve.useState)([]),[r,n]=(0,Pve.useState)([]),{activeId:i,setActiveId:o,getActiveId:a}=J_r(),s=n5r(),l=S5r(),[u,f]=(0,Pve.useState)(""),d=u5r(),h=y5r(),p=v5r(),{initialized:m,markInitialized:g,syncSessions:y}=c5r(),v=T5r(),b=x5r(y,t),{wsRef:x,requestHistory:C,reconnecting:S}=O5r({handleSessions:b,setHistory:n,getActiveId:a,setActiveId:o,...s,...l,setCurrentCwd:f,...d,...h,...p,markInitialized:g,...v});return r5r(e,o,Q_r(s.activeByRepo,e)),{sessions:e,history:r,activeId:i,setActiveId:o,...s,...l,currentCwd:u,...d,...h,...p,initialized:m,wsRef:x,...v,requestHistory:C,reconnecting:S}}function F5r(){let e=B5r(),{wsRef:t,buffers:r,handlers:n,addPendingLaunch:i,activeId:o,sessions:a}=e,s=k_r(e.nodes),l=R_r(t,i),u=X_r(l,r,n);S_r(o,a,e.history,l),C_r(a,l);let f=Z_r(l,e.setActiveId,e.setViewingTranscriptSessionId);return{...e,...u,...f,nodeSelection:s}}var p$=E(fe(),1);var $5r="assist:sidebar-collapsed";function z5r(){let[e,t]=(0,p$.useState)(()=>Xu($5r).length>0),r=(0,p$.useCallback)(()=>{t(n=>{let i=!n;return Zu($5r,i?[!0]:[]),i})},[]);return(0,p$.useMemo)(()=>({collapsed:e,onToggleCollapsed:r}),[e,r])}var H5r=E(fe(),1);function U5r(){(0,H5r.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch("/api/hotkeys");if(!t.ok)return;let r=await t.json();e||sE.set(r)}catch{}})(),()=>{e=!0}},[])}function W5r(){let e=F5r(),t=Vme(e),r=g_r(e.currentCwd,e.history,t,e.sessions,e.nodeSelection);s_r({selectedCwd:r.selectedCwd,selectedCardId:t,sessions:e.sessions,history:e.history,activeByRepo:e.activeByRepo,onSelect:e.selectSession});let{launch:n,viewLaunchedSession:i}=x_r(e);U5r();let o=z5r();return o_r("shell",{...e,selection:r,launch:n,sidebarCollapse:o}),{socket:e,selection:r,launch:n,viewLaunchedSession:i,sidebarCollapse:o}}var lg=E($(),1),Eri={zIndex:e=>e.zIndex.drawer+1},Rri={minHeight:48};function G5r({mode:e,toggle:t,toggleDesign:r}){let n=W5r(),{socket:i,selection:o,viewLaunchedSession:a}=n,{design:s}=Fn();return(0,lg.jsx)(vwr,{shell:n,children:(0,lg.jsxs)(HWe.Provider,{value:i.daemonVersion,children:[(0,lg.jsx)(Jkr,{mode:e,toggle:t,toggleDesign:r,sessions:i.sessions,reconnecting:i.reconnecting}),(0,lg.jsx)(sxe,{position:"fixed",sx:Eri,"data-testid":"toolbar",children:(0,lg.jsx)(tkr,{socket:i,selection:o})}),(0,lg.jsx)(R5,{variant:"dense",sx:Rri}),(0,lg.jsx)(n_r,{socket:i,children:(0,lg.jsx)(ESr,{socket:i})}),s==="slate"&&(0,lg.jsx)(tCr,{socket:i}),(0,lg.jsx)(gwr,{socket:i,onViewLaunchedSession:a})]})})}var V5r=E(fe(),1);function q5r(){let[e,t]=(0,V5r.useState)(()=>{try{return localStorage.getItem("theme-mode")??"dark"}catch{return"dark"}});return{mode:e,toggle:()=>t(n=>{let i=n==="dark"?"light":"dark";try{localStorage.setItem("theme-mode",i)}catch{}return i})}}var Ari={black:"#2e3436",red:"#cc0000",green:"#4e9a06",yellow:"#c4a000",blue:"#3465a4",magenta:"#75507b",cyan:"#06989a",white:"#d3d7cf",brightBlack:"#555753",brightRed:"#ef2929",brightGreen:"#8ae234",brightYellow:"#fce94f",brightBlue:"#729fcf",brightMagenta:"#ad7fa8",brightCyan:"#34e2e2",brightWhite:"#eeeeec"},BX="rgba(0, 0, 0, 0.87)",j5r={background:"rgba(97, 97, 97, 0.92)",text:"#fff"},Y5r={warning:"rgba(255, 167, 38, 0.09)",error:"rgba(244, 67, 54, 0.09)"},K5r={secondary:"rgba(255, 255, 255, 0.7)",hover:"rgba(255, 255, 255, 0.12)",active:"rgba(255, 255, 255, 0.16)",dot:"#ffb74d",dotRing:"rgba(0, 0, 0, 0.15)"},m$={name:"classic",dark:{color:{background:"#1e1e1e",surface:"#252526",raised:"rgba(255, 255, 255, 0.08)",line:"rgba(255, 255, 255, 0.12)",lineSoft:"rgba(255, 255, 255, 0.12)",text:{primary:"#fff",secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)"},selected:"rgba(255, 255, 255, 0.16)",wash:Y5r,well:"#1b1b1c",stripe:"rgba(255, 255, 255, 0.1)",overlay:j5r,onAppBar:{...K5r,level:{ok:"#66bb6a",warn:"#ffa726",over:"#f44336"}},primary:{main:"#90caf9",light:"#e3f2fd",dark:"#42a5f5",contrastText:BX},secondary:{main:"#ce93d8",light:"#f3e5f5",dark:"#ab47bc",contrastText:BX},success:{main:"#66bb6a",light:"#81c784",dark:"#388e3c",contrastText:BX},warning:{main:"#ffa726",light:"#ffb74d",dark:"#f57c00",contrastText:BX},error:{main:"#f44336",light:"#e57373",dark:"#d32f2f",contrastText:"#fff"},info:{main:"#29b6f6",light:"#4fc3f7",dark:"#0288d1",contrastText:BX}},terminal:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",cursorAccent:"#1e1e1e",selectionBackground:"rgba(255, 255, 255, 0.3)",...Ari},elevation:{appBar:1}},light:{color:{background:"#fff",surface:"#fff",raised:"rgba(0, 0, 0, 0.04)",line:"rgba(0, 0, 0, 0.12)",lineSoft:"rgba(0, 0, 0, 0.12)",text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},selected:"rgba(0, 0, 0, 0.08)",wash:Y5r,well:"#f3f4f6",stripe:"rgba(0, 0, 0, 0.1)",overlay:j5r,onAppBar:{...K5r,level:{ok:"#b9f6ca",warn:"#ffe57f",over:"#ffcdd2"}},primary:{main:"#1976d2",light:"#42a5f5",dark:"#1565c0",contrastText:"#fff"},secondary:{main:"#9c27b0",light:"#ba68c8",dark:"#7b1fa2",contrastText:"#fff"},success:{main:"#2e7d32",light:"#4caf50",dark:"#1b5e20",contrastText:"#fff"},warning:{main:"#ed6c02",light:"#ff9800",dark:"#e65100",contrastText:"#fff"},error:{main:"#d32f2f",light:"#ef5350",dark:"#c62828",contrastText:"#fff"},info:{main:"#0288d1",light:"#03a9f4",dark:"#01579b",contrastText:"#fff"}},terminal:{background:"#ffffff",foreground:"#333333",cursor:"#333333",cursorAccent:"#ffffff",selectionBackground:"#add6ff",black:"#000000",red:"#cd3131",green:"#107c10",yellow:"#949800",blue:"#0451a5",magenta:"#bc05bc",cyan:"#0598bc",white:"#555555",brightBlack:"#666666",brightRed:"#cd3131",brightGreen:"#14ce14",brightYellow:"#b5ba00",brightBlue:"#0451a5",brightMagenta:"#bc05bc",brightCyan:"#0598bc",brightWhite:"#a5a5a5"},elevation:{appBar:1}},font:{ui:'"Roboto", "Helvetica", "Arial", sans-serif',mono:"monospace",terminal:"'Cascadia Code', 'Fira Code', Consolas, monospace"},type:{fontSize:14,terminalFontSize:14,scale:{caption:12,body2:14,body1:16,subtitle2:14,subtitle1:16,h6:20,h5:24,h4:34,button:14},button:{textTransform:"uppercase",fontWeight:500}},radius:{sm:4,md:4},spacing:8};function X5r({color:e,radius:t,elevation:r,type:n}){let i={border:`1px solid ${e.line}`};return{MuiTooltip:{styleOverrides:{tooltip:{...i,backgroundColor:e.overlay.background,color:e.overlay.text,borderRadius:t.md,boxShadow:r.overlay,fontSize:`${n.scale.caption/16}rem`,padding:"6px 10px"},arrow:{color:e.overlay.background}}},MuiPopover:{styleOverrides:{paper:{...i,boxShadow:r.overlay}}},MuiDialog:{styleOverrides:{paper:{...i,backgroundColor:e.surface,borderRadius:t.md+4,boxShadow:r.dialog}}}}}function Z5r({color:e,radius:t}){return{MuiButton:{defaultProps:{disableElevation:!0},styleOverrides:{root:{borderRadius:t.sm}},variants:[{props:{variant:"tonal"},style:{backgroundColor:e.raised,border:`1px solid ${e.line}`,color:e.text.primary,"&:hover":{backgroundColor:e.raised,borderColor:e.text.disabled}}},{props:{variant:"outlined",color:"error"},style:{borderColor:gi(e.error.main,.35),"&:hover":{borderColor:e.error.main,backgroundColor:gi(e.error.main,.1)}}}]},MuiChip:{styleOverrides:{root:{fontWeight:600,borderRadius:999},sizeSmall:{height:22},outlined:{borderColor:e.line}}}}}var iGe=e=>`color-mix(in srgb, currentColor ${e}%, transparent)`;function Q5r({radius:e}){return{MuiTabs:{styleOverrides:{root:{minHeight:40,alignItems:"center"},list:{gap:2},indicator:{display:"none"}}},MuiTab:{styleOverrides:{root:{minHeight:30,padding:"6px 10px",borderRadius:e.sm,textTransform:"none",fontWeight:500,"&:hover":{backgroundColor:iGe(8)},"&.Mui-selected":{backgroundColor:iGe(12),boxShadow:`inset 0 0 0 1px ${iGe(18)}`}}}}}}function J5r(e){let{appBar:t}=e.color;return{...X5r(e),...Z5r(e),...Q5r(e),MuiPaper:{styleOverrides:{root:{backgroundImage:"none"},outlined:{borderColor:e.color.line}}},MuiAppBar:{defaultProps:{elevation:e.elevation.appBar},styleOverrides:{root:t&&{backgroundColor:t.background,color:t.text,borderBottom:`1px solid ${e.color.line}`}}}}}var Iv="#0e1116",oGe="#141820",Lve="#1b202a",Mve="#e3e7ee",aGe="#8a93a3",FX="#8b9cff",Ive="#5fd0a0",Dve="#f2b45a",Nve="#f27a7a",Ove={name:"slate",dark:{color:{background:Iv,surface:oGe,raised:Lve,line:"#262c37",lineSoft:"#1d222b",text:{primary:Mve,secondary:aGe,disabled:"#5c6473"},selected:"rgba(139, 156, 255, 0.14)",wash:{warning:"rgba(242, 180, 90, 0.09)",error:"rgba(242, 122, 122, 0.09)"},well:Iv,stripe:Lve,overlay:{background:Lve,text:Mve},appBar:{background:oGe,text:Mve},onAppBar:{...m$.dark.color.onAppBar,secondary:aGe,level:{ok:Ive,warn:Dve,over:Nve}},statusBar:{background:oGe,text:aGe,hoverText:Mve,secondary:"#5c6473",hover:Lve,active:"transparent",dot:FX,dotRing:"rgba(139, 156, 255, 0.14)",readyText:FX,level:{ok:Ive,warn:Dve,over:Nve}},primary:{main:FX,contrastText:Iv},secondary:{main:"#c99bff",contrastText:Iv},success:{main:Ive,contrastText:Iv},warning:{main:Dve,contrastText:Iv},error:{main:Nve,contrastText:Iv},info:{main:"#6cb6ff",contrastText:Iv}},terminal:{background:Iv,foreground:"#d6dbe4",cursor:FX,cursorAccent:Iv,selectionBackground:"rgba(139, 156, 255, 0.28)",black:"#1b2029",red:Nve,green:Ive,yellow:Dve,blue:FX,magenta:"#c99bff",cyan:"#6cc8d8",white:"#c3c9d4",brightBlack:"#5c6473",brightRed:"#ff9a9a",brightGreen:"#82e0b6",brightYellow:"#ffc97a",brightBlue:"#a9b6ff",brightMagenta:"#dcb8ff",brightCyan:"#8fdbe8",brightWhite:"#eef1f6"},elevation:{appBar:0,overlay:"0 14px 34px rgba(0, 0, 0, 0.45)",dialog:"0 30px 60px rgba(0, 0, 0, 0.5)"}},light:{...m$.light,color:{...m$.light.color,statusBar:{background:"#f3f4f6",text:"rgba(0, 0, 0, 0.6)",hoverText:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.38)",hover:"rgba(0, 0, 0, 0.06)",active:"transparent",dot:"#1976d2",dotRing:"rgba(25, 118, 210, 0.16)",readyText:"#1976d2",level:{ok:"#2e7d32",warn:"#ed6c02",over:"#d32f2f"}}},elevation:{appBar:0,overlay:"0 8px 24px rgba(15, 23, 42, 0.12)",dialog:"0 24px 48px rgba(15, 23, 42, 0.18)"}},font:{ui:'"Geist Variable", "Segoe UI", system-ui, sans-serif',mono:'"Geist Mono Variable", ui-monospace, Menlo, Consolas, monospace',terminal:'"Geist Mono Variable", ui-monospace, Menlo, Consolas, monospace'},type:{fontSize:14,terminalFontSize:13,scale:{caption:12,body2:14,body1:15,subtitle2:14,subtitle1:15,h6:16,h5:18,h4:24,button:14},button:{textTransform:"none",fontWeight:600}},radius:{sm:6,md:8},spacing:8};var gT=e=>`${e/16}rem`;function eEr({font:e,type:t}){let{scale:r}=t;return{fontFamily:e.ui,fontFamilyMono:e.mono,fontSize:t.fontSize,button:{...t.button,fontSize:gT(r.button)},caption:{fontSize:gT(r.caption)},body2:{fontSize:gT(r.body2)},body1:{fontSize:gT(r.body1)},subtitle2:{fontSize:gT(r.subtitle2)},subtitle1:{fontSize:gT(r.subtitle1)},h6:{fontSize:gT(r.h6)},h5:{fontSize:gT(r.h5)},h4:{fontSize:gT(r.h4)}}}function tEr(e){return{MuiButtonBase:{styleOverrides:{root:{cursor:"pointer","&.Mui-disabled":{cursor:"default"}}}},MuiLink:{styleOverrides:{root:{cursor:"pointer"}}},MuiAppBar:{defaultProps:{elevation:e.elevation.appBar}}}}var Pri={classic:m$,slate:Ove};function Lri(e,t){let{dark:r,light:n,...i}=Pri[e];return{...i,...t==="dark"?r:n,mode:t}}function rEr(e,t){let r=Lri(e,t),{color:n}=r;return Y0({design:e,tokens:r,palette:{mode:t,background:{default:n.background,paper:n.surface},primary:n.primary,secondary:n.secondary,success:n.success,warning:n.warning,error:n.error,info:n.info,text:n.text,divider:n.line,action:{hover:n.raised,selected:n.selected}},typography:eEr(r),shape:{borderRadius:r.radius.sm},spacing:r.spacing,components:{...tEr(r),...e==="slate"&&J5r(r)}})}function nEr(){if(typeof document>"u"||!document.fonts)return Promise.resolve();let{font:e,type:t}=Ove;return Promise.allSettled([document.fonts.load(`${t.fontSize}px ${e.ui}`),document.fonts.load(`${t.terminalFontSize}px ${e.terminal}`)])}var iEr=E(fe(),1),oEr="design";function Mri(){try{return localStorage.getItem(oEr)==="slate"?"slate":"classic"}catch{return"classic"}}function aEr(){let[e,t]=(0,iEr.useState)(Mri);return{design:e,toggleDesign:()=>t(n=>{let i=n==="slate"?"classic":"slate";try{localStorage.setItem(oEr,i)}catch{}return i})}}var sEr=E(fe(),1);var Bve=E($(),1),Iri=5;function lEr({children:e}){let[t,r]=(0,sEr.useState)(null);return(0,Bve.jsxs)(Ewe.Provider,{value:t,children:[e,(0,Bve.jsx)(ie,{ref:r,"data-testid":"toast-stack",sx:{position:"fixed",zIndex:"snackbar",bottom:{xs:1,sm:3},left:{xs:1,sm:"50%"},right:{xs:1,sm:"auto"},transform:{sm:"translateX(-50%)"},display:"flex",flexDirection:"column",alignItems:{xs:"stretch",sm:"center"},gap:1,pointerEvents:"none","& > *":{pointerEvents:"auto"},[`& > :nth-last-of-type(n+${Iri+1})`]:{display:"none"}}})]})}var yT=E($(),1);function Dri(){let{mode:e,toggle:t}=q5r(),{design:r,toggleDesign:n}=aEr(),i=(0,uEr.useMemo)(()=>rEr(r,e),[r,e]);return(0,yT.jsxs)(qZ,{theme:i,children:[(0,yT.jsx)(IQ,{}),(0,yT.jsx)(lEr,{children:(0,yT.jsx)(G5r,{mode:e,toggle:t,toggleDesign:n})})]})}var Nri=LCe([{path:"*",element:(0,yT.jsx)(Dri,{})}]);function Ori(){return(0,yT.jsx)(CCe,{router:Nri})}var cEr=document.getElementById("app");cEr&&nEr().then(()=>{(0,fEr.createRoot)(cEr).render((0,yT.jsx)(Ori,{}))});})();
4025
4025
  /*! Bundled license information: