@staff0rd/assist 0.1042.3 → 0.1043.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3870,12 +3870,12 @@ ${e?`File: ${e}
3870
3870
 
3871
3871
  ${zb(n,o)}`}function T2e(e,t,r){return n=>{Gd(t,e.id,S2e(n)),r()}}function p4(e){return!e||e.status==="stopped"||e.closing===!0?{unavailable:"Comments are unavailable \u2014 that session is no longer live."}:{session:e}}function N2r(e,t){return t?p4(e.find(r=>r.claudeSessionId===t)):{unavailable:"Open this diff from a session card to comment on it."}}function O2r({path:e,lines:t,quote:r,note:n}){return t?S2e({path:e,startLine:t.start,endLine:t.end,quote:r,note:n}):`${e}
3872
3872
 
3873
- ${zb(r,n)}`}function w2e(e,t,r){return n=>{Gd(t,e.id,O2r(n)),r()}}function $2r(e,t,r){let[n,o]=(0,B2r.useState)(null),{session:i,unavailable:a}=N2r(e,t);return{onComment:i?T2e(i,r,()=>o(i.name)):void 0,onFileComment:i?w2e(i,r,()=>o(i.name)):void 0,onAddRule:i?x2e(i,r,()=>o(i.name)):void 0,unavailable:a,sentTo:n,clearSent:()=>o(null)}}var DXe=C(ee(),1);var Tyo={modify:"modified",add:"added",delete:"removed",rename:"renamed",copy:"renamed"};function F2r(e,{query:t,changeType:r}){let n=t.trim().toLowerCase();return e.filter(o=>n&&!Zp(o).toLowerCase().includes(n)?!1:r==="all"||Tyo[o.type]===r)}function z2r(e){let t=new Map(xL(u2e(e)).map((r,n)=>[r,n]));return[...e].sort((r,n)=>(t.get(Zp(r))??0)-(t.get(Zp(n))??0))}function U2r(e){return e.replace(/\t$/,"")}function H2r(e){return ade(e).map(t=>({...t,oldPath:U2r(t.oldPath),newPath:U2r(t.newPath)}))}function W2r({diff:e,error:t,search:r,changeType:n}){let o=(0,DXe.useMemo)(()=>t||!e?[]:H2r(e),[e,t]),i=(0,DXe.useMemo)(()=>z2r(F2r(o,{query:r,changeType:n})),[o,r,n]);return{files:o,visibleFiles:i}}var OXe=C(ee(),1);var C2e=C(ee(),1);function Vl(e){try{let t=localStorage.getItem(e);if(!t)return[];let r=JSON.parse(t);return Array.isArray(r.items)?r.items:[]}catch{return[]}}function iu(e,t){try{if(t.length===0){localStorage.removeItem(e);return}localStorage.setItem(e,JSON.stringify({savedAt:Date.now(),items:t}))}catch{}}function wL(e){try{localStorage.removeItem(e)}catch{}}function h4(e){try{let t=Date.now();for(let r=localStorage.length-1;r>=0;r--){let n=localStorage.key(r);if(!n?.startsWith(e))continue;let o=localStorage.getItem(n),i=o?JSON.parse(o).savedAt:0;(!i||t-i>864e5)&&localStorage.removeItem(n)}}catch{}}var NXe="assist:diff-view-type";function G2r(){let[e]=Vl(NXe);return e==="unified"||e==="split"?e:"split"}function eH(){let[e,t]=(0,C2e.useState)(G2r);return(0,C2e.useEffect)(()=>{let r=n=>{n.key===NXe&&t(G2r())};return addEventListener("storage",r),()=>removeEventListener("storage",r)},[]),{viewType:e,onChange:r=>{iu(NXe,[r]),t(r)}}}function V2r(){let{viewType:e,onChange:t}=eH(),[r,n]=(0,OXe.useState)(""),[o,i]=(0,OXe.useState)("all");return{viewType:e,onChange:t,search:r,onSearchChange:n,changeType:o,onChangeTypeChange:i}}var J2r=C(ee(),1);var wyo=new Set(["all",jR]);function q2r(e){let t=e==="uncommitted",r=wyo.has(e);return{file:t||r,paths:t||r,needsUncommittedFiles:r}}var Nee=C(ee(),1);async function j2r(e,t,r){let n=await Jt(tn(`/api/diff/revert?cwd=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`,r),{method:"POST"});if(n.ok)return;let o=await n.json().catch(()=>({}));throw new Error(typeof o.error=="string"?o.error:"Failed to revert file")}async function BT(e,t,r){let n=await Jt(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),o=await n.json().catch(()=>({}));if(!n.ok)throw new Error(typeof o.error=="string"?o.error:r);return o}async function Y2r(e,t,r){let n=await BT(tn(`/api/diff/revert-all?cwd=${encodeURIComponent(e)}`,r),{paths:t},"Failed to revert files");return Array.isArray(n.failed)?n.failed:[]}function Cyo(e){let t=e.length===1?"file":"files";return`Failed to revert ${e.length} ${t}: ${e.map(r=>`${r.path} (${r.error})`).join(", ")}`}function K2r(e,t,r){let[n,o]=(0,Nee.useState)(null),i=yr(),a=(0,Nee.useCallback)(l=>{j2r(e,l,i).then(r).catch(u=>o(u instanceof Error?u.message:"Failed to revert file"))},[e,i,r]),s=(0,Nee.useCallback)(l=>{Y2r(e,l,i).then(u=>{r(),u.length>0&&o(Cyo(u))}).catch(u=>o(u instanceof Error?u.message:"Failed to revert files"))},[e,i,r]);return{onRevert:t.file?a:void 0,onRevertPaths:t.paths?s:void 0,error:n,clearError:()=>o(null)}}var Z2r=C(ee(),1);function X2r(e){let t=e?.uncommitted??e,r=t?.new??[];return{paths:new Set([...r,...t?.modified??[],...t?.deleted??[]]),newPaths:new Set(r)}}function Q2r(e,t,r){let{counts:n,refresh:o}=Wce(e,t,r);return{files:(0,Z2r.useMemo)(()=>r?X2r(n):void 0,[r,n]),refresh:o}}function eSr(e,t,r,n){let o=q2r(r),i=Q2r(e,t,o.needsUncommittedFiles),a=i.refresh,s=(0,J2r.useCallback)(()=>{n(),a()},[n,a]);return{revert:K2r(e,o,s),uncommittedFiles:i.files}}var k2e=C(ee(),1);var BXe={commits:[],branchBase:null,loaded:!1};function tSr(e,t){let[r,n]=(0,k2e.useState)(BXe),o=yr();return(0,k2e.useEffect)(()=>{if(!e){n(BXe);return}let i=!1;return(async()=>{try{let l=await(await Jt(tn(`/api/diff-scopes?${T8(e,t)}`,o))).json();i||n({commits:l?.commits??[],branchBase:l?.branchBase??null,loaded:!0})}catch(s){Pr(s,"diff scopes"),i||n({...BXe,loaded:!0})}})(),()=>{i=!0}},[e,t,o]),r}function rSr(e,t,r){let{commits:n,branchBase:o,loaded:i}=tSr(e,t);return{scope:r===jR&&i&&!o?"all":r,commits:n,branchBase:o}}var oSr=C(ee(),1);var nSr="assist:diff-tree-hidden";function iSr(){let[e,t]=(0,oSr.useState)(()=>Vl(nSr).length>0);return{treeVisible:!e,onToggleTree:()=>{let r=!e;iu(nSr,r?[!0]:[]),t(r)}}}function aSr(e,t,r,n,o){let i=rSr(e,t,r),{diff:a,loading:s,error:l,refresh:u}=M2r(e,t,i.scope),{revert:d,uncommittedFiles:f}=eSr(e,t,i.scope,u),p=V2r(),h=iSr(),m=$2r(n,t,o),g=I2r(e),{files:y,visibleFiles:v}=W2r({diff:a,error:l,search:p.search,changeType:p.changeType}),b=v.map(T=>Zp(T)),x=P2r(h.treeVisible?b:[]);return{scopeState:i,loading:s,filters:p,treePanel:h,comments:m,collapsedFiles:g,activeFile:x,revert:d,uncommittedFiles:f,collapseAll:_2r(b,g),visibleFiles:v,totals:R2r(v),emptyMessage:E2r(l,y.length)}}var $T=C(P(),1);function _2e({cwd:e,sessionId:t,scope:r,onScopeChange:n,sessions:o,sendInput:i,mode:a,onToggleMode:s,onClose:l,scrollRegionProps:u}){let d=aSr(e,t,r,o,i);return(0,$T.jsxs)($T.Fragment,{children:[(0,$T.jsxs)(Skt,{onClose:l,scrollRegionProps:u,children:[(0,$T.jsx)(D3t,{...d.filters,...d.treePanel,...d.collapseAll,scope:d.scopeState,onScopeChange:n,totals:d.totals,commentHint:d.comments.unavailable,mode:a,onToggleMode:s,onClose:l}),(0,$T.jsx)(w2r,{...Tkt(d,e)})]}),(0,$T.jsx)(k2r,{sentTo:d.comments.sentTo,clearSent:d.comments.clearSent,revertError:d.revert.error,clearRevertError:d.revert.clearError})]})}function sSr(){let[e,t]=al(),{selectedCwd:r}=to();return{cwd:e.get("cwd")||r,sessionId:e.get("session")??void 0,scope:e.get("scope")||"all",setScope:n=>{t(o=>(n==="all"?o.delete("scope"):o.set("scope",n),o),{replace:!0})}}}var $Xe=C(P(),1);function lSr({sessions:e,sendInput:t}){let{cwd:r,sessionId:n,scope:o,setScope:i}=sSr();return(0,$Xe.jsx)(Is,{maxWidth:!1,children:(0,$Xe.jsx)(_2e,{cwd:r,sessionId:n,scope:o,onScopeChange:i,sessions:e,sendInput:t})})}var cSr=C(P(),1);function E2e({defaultTo:e,children:t}){let[r]=al(),{selectedNode:n,worktreeNode:o}=to(),i=e==="worktree"?o:n,a=r.get("cwd")?r.get("node")||void 0:i;return(0,cSr.jsx)(ic.Provider,{value:a,children:t})}var FXe=C(P(),1);function uSr({socket:e}){return(0,FXe.jsx)(E2e,{defaultTo:"selected",children:(0,FXe.jsx)(lSr,{sessions:e.sessions,sendInput:e.sendInput})})}function R2e(e){return e.viewingTranscriptSessionId??e.activeId}var ySr=C(ee(),1);var $ee=C(ee(),1);var zXe="plaintext";function dSr(e,t,r,n){return e.editor.create(t,{value:r.value,language:r.language??zXe,readOnly:r.readOnly??!1,theme:n,automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,renderWhitespace:"selection"})}var Oee=C(ee(),1);var WXe="/monaco.js",UXe="/monaco.css",kyo="/monaco.worker.js",HXe;function fSr(){return globalThis.monaco}function _yo(){return document.querySelector(`link[href="${UXe}"]`)?Promise.resolve():new Promise((e,t)=>{let r=document.createElement("link");r.rel="stylesheet",r.href=UXe,r.addEventListener("load",()=>e()),r.addEventListener("error",()=>t(new Error(`Failed to load ${UXe}`))),document.head.append(r)})}function Eyo(){return new Promise((e,t)=>{let r=document.createElement("script");r.src=WXe,r.addEventListener("load",()=>e()),r.addEventListener("error",()=>t(new Error(`Failed to load ${WXe}`))),document.head.append(r)})}async function Ryo(){globalThis.MonacoEnvironment={getWorker:()=>new Worker(kyo)},await Promise.all([_yo(),Eyo()]);let e=fSr();if(!e)throw new Error(`${WXe} did not register the editor API`);return e}function pSr(){let e=fSr();return e?Promise.resolve(e):(HXe??(HXe=Ryo().catch(t=>{throw HXe=void 0,t})),HXe)}function hSr(){let[e,t]=(0,Oee.useState)(),[r,n]=(0,Oee.useState)(!1);return(0,Oee.useEffect)(()=>{let o=!1;return pSr().then(i=>!o&&t(i),()=>!o&&n(!0)),()=>{o=!0}},[]),{monaco:e,failed:r}}var Bee=C(ee(),1);function mSr(e,t,r,n){(0,Bee.useEffect)(()=>{let o=e.current;o&&o.getValue()!==r.value&&o.setValue(r.value)},[e,t,r.value]),(0,Bee.useEffect)(()=>{let o=e.current?.getModel();t&&o&&t.editor.setModelLanguage(o,r.language??zXe)},[e,t,r.language]),(0,Bee.useEffect)(()=>{t?.editor.setTheme(n)},[t,n]),(0,Bee.useEffect)(()=>{e.current?.updateOptions({readOnly:r.readOnly??!1})},[e,t,r.readOnly])}function gSr(e,t){let{monaco:r,failed:n}=hSr(),o=(0,$ee.useRef)(null),i=Pn().palette.mode==="dark"?"vs-dark":"vs",a=(0,$ee.useRef)({settings:t,theme:i});return a.current={settings:t,theme:i},(0,$ee.useEffect)(()=>{let s=e.current;if(!r||!s)return;let l=dSr(r,s,a.current.settings,a.current.theme);o.current=l;let u=l.onDidChangeModelContent(()=>a.current.settings.onChange?.(l.getValue()));return()=>{o.current=null,u.dispose(),l.getModel()?.dispose(),l.dispose()}},[r,e]),mSr(o,r,t,i),n?"error":r?"ready":"loading"}var GXe=C(P(),1),Pyo=e=>t=>({border:`1px solid ${t.palette.divider}`,borderRadius:1,overflow:"hidden",height:e});function vSr({height:e,...t}){let r=(0,ySr.useRef)(null);return gSr(r,t)==="error"?(0,GXe.jsx)(Ce,{color:"text.secondary",align:"center",sx:{py:6},children:"The editor failed to load."}):(0,GXe.jsx)(G,{ref:r,sx:Pyo(e)})}var bSr="typescript",Ayo={ts:"typescript",mts:"typescript",cts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",json:bSr,jsonc:bSr,css:"css",scss:"scss",less:"less",py:"python",md:"markdown",markdown:"markdown",mdx:"mdx",yml:"yaml",yaml:"yaml",sh:"shell",bash:"shell",zsh:"shell",ps1:"powershell",html:"html",htm:"html",xml:"xml",svg:"xml",sql:"sql",rs:"rust",go:"go",java:"java",kt:"kotlin",cs:"csharp",rb:"ruby",php:"php",c:"cpp",h:"cpp",cpp:"cpp",hpp:"cpp",swift:"swift",dart:"dart",lua:"lua",r:"r",graphql:"graphql",gql:"graphql",dockerfile:"dockerfile",ini:"ini"};function xSr(e){let t=e.split(".").pop()?.toLowerCase();return t?Ayo[t]:void 0}var P2e=C(P(),1),Lyo=`calc(100vh - 152px - ${d1})`;function SSr({path:e,cwd:t,rendered:r,value:n,onChange:o,comments:i}){return r?(0,P2e.jsx)(a2e,{path:e,cwd:t,source:n,onComment:i.onComment,onAddRule:i.onAddRule,unavailable:i.unavailable,children:(0,P2e.jsx)(i4,{content:n,renderMermaid:!0,wide:!0})}):(0,P2e.jsx)(vSr,{value:n,language:xSr(e),height:Lyo,onChange:o})}var TSr=C(P(),1),A2e=nt((0,TSr.jsx)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m-4 10h2v-2h-2v-2h2v-2h-2V8h4v10h-4zm0 0h-2v2H4V6h5.17l2 2H14v2h2v2h-2v2h2z"}),"FolderZipOutlined");var wSr=C(P(),1),m4=nt((0,wSr.jsx)("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-4.86 8.86-3 3.87L9 13.14 6 17h12z"}),"ImageOutlined");var CSr=C(P(),1),kSr=nt((0,CSr.jsx)("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zM6 20V4h7v5h5v11z"}),"InsertDriveFileOutlined");var _Sr=C(P(),1),ESr=nt((0,_Sr.jsx)("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m0 14H8V4h12zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4zm12 6V9c0-.55-.45-1-1-1h-2v5h2c.55 0 1-.45 1-1m-2-3h1v3h-1zm4 2h1v-1h-1V9h1V8h-2v5h1zm-8 0h1c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9v5h1zm0-2h1v1h-1z"}),"PictureAsPdfOutlined");var RSr=C(P(),1),PSr=nt((0,RSr.jsx)("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"}),"StorageOutlined");var FTr=C(LSr(),1),_Ze=C(DSr(),1),zTr=C(OSr(),1),UTr=C($Sr(),1),HTr=C(zSr(),1),WTr=C(HSr(),1),GTr=C(GSr(),1),VTr=C(qSr(),1),qTr=C(YSr(),1),jTr=C(XSr(),1),YTr=C(QSr(),1),KTr=C(eTr(),1),XTr=C(rTr(),1),ZTr=C(oTr(),1),QTr=C(aTr(),1),JTr=C(lTr(),1),ewr=C(uTr(),1),twr=C(fTr(),1),rwr=C(mTr(),1),nwr=C(vTr(),1),owr=C(xTr(),1),iwr=C(TTr(),1),awr=C(CTr(),1),swr=C(_Tr(),1),lwr=C(RTr(),1),cwr=C(ATr(),1);var nH=Gl.fileType,LTr={Icon:FTr.default,unpaintedFill:nH.bash},TZe={Icon:zTr.default},ITr={Icon:UTr.default},MTr={Icon:VTr.default},wZe={Icon:jTr.default},DTr={Icon:YTr.default,unpaintedFill:nH.json},NTr={Icon:KTr.default},CZe={Icon:XTr.default,unpaintedFill:nH.markdown},OTr={Icon:ewr.default},BTr={Icon:nwr.default},kZe={Icon:awr.default},Iyo={Icon:lwr.default,unpaintedFill:nH.xml},$Tr={Icon:cwr.default,unpaintedFill:nH.yaml},uwr=e=>Myo[e],Myo={c:{Icon:_Ze.default},cc:TZe,cjs:wZe,cpp:TZe,cs:{Icon:HTr.default},css:ITr,cts:kZe,dockerfile:{Icon:WTr.default},go:{Icon:GTr.default},h:{Icon:_Ze.default},hpp:TZe,htm:MTr,html:MTr,java:{Icon:qTr.default},js:wZe,json:DTr,jsonc:DTr,jsx:OTr,kt:NTr,kts:NTr,less:ITr,markdown:CZe,md:CZe,mdx:CZe,mjs:wZe,mts:kZe,php:{Icon:ZTr.default},ps1:{Icon:QTr.default},py:{Icon:JTr.default},rb:{Icon:twr.default},rs:{Icon:rwr.default,unpaintedFill:nH.rust},sass:BTr,scss:BTr,sh:LTr,swift:{Icon:owr.default},tf:{Icon:iwr.default},ts:kZe,tsx:OTr,vue:{Icon:swr.default},xml:Iyo,yaml:$Tr,yml:$Tr,zsh:LTr};var N2e=C(P(),1),O2e=16,Dyo={gif:m4,gz:A2e,ico:m4,jpeg:m4,jpg:m4,pdf:ESr,png:m4,sql:PSr,svg:m4,tar:A2e,webp:m4,zip:A2e},Nyo={width:O2e,height:O2e,flexShrink:0,display:"flex",alignItems:"center"},Oyo={fontSize:O2e,color:"text.secondary"};function Byo(e){let t=e.slice(e.lastIndexOf("/")+1).toLowerCase(),r=t.lastIndexOf(".");return r<=0?t:t.slice(r+1)}function B2e({path:e}){let t=Byo(e),r=uwr(t),n=Dyo[t]??kSr;return(0,N2e.jsx)(G,{sx:Nyo,children:r?(0,N2e.jsx)(r.Icon,{size:O2e,fill:r.unpaintedFill}):(0,N2e.jsx)(n,{sx:Oyo})})}var dwr=C(P(),1),fwr=nt((0,dwr.jsx)("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"}),"Save");var zT=C(P(),1),$yo={display:"flex",alignItems:"center",gap:1,flexShrink:0};function pwr({mode:e,onModeChange:t,onSave:r,saving:n,dirty:o}){let i=fo("save").chords;return(0,zT.jsxs)(G,{sx:$yo,children:[e&&(0,zT.jsxs)(Dc,{exclusive:!0,size:"small",value:e,onChange:(a,s)=>s&&t(s),children:[(0,zT.jsx)(ms,{value:"raw",children:"Raw"}),(0,zT.jsx)(ms,{value:"rendered",children:"Rendered"})]}),(0,zT.jsx)(ht,{size:"small",variant:"outlined",startIcon:(0,zT.jsx)(fwr,{sx:{fontSize:16}}),onClick:r,disabled:n||!o,title:`Save (${zce(i[0])})`,children:"Save"}),(0,zT.jsx)(Ude,{})]})}var _L=C(P(),1),Fyo={display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,mb:1},zyo={fontFamily:"fontFamilyMono",fontSize:13},Uyo={display:"flex",alignItems:"center",gap:1,minWidth:0};function hwr({path:e,mode:t,onModeChange:r,onSave:n,saving:o,dirty:i}){return(0,_L.jsxs)(G,{sx:Fyo,children:[(0,_L.jsxs)(G,{sx:Uyo,children:[(0,_L.jsx)(B2e,{path:e}),(0,_L.jsx)(Ce,{color:"text.secondary",sx:zyo,children:e})]}),(0,_L.jsx)(pwr,{mode:t,onModeChange:r,onSave:n,saving:o,dirty:i})]})}function mwr(e,t,r){return r?t?e==="absent"?"This file is not in the working tree.":e==="too-large"?"This file is too large to display (over 2 MB).":"Couldn't load this file.":"No file path given.":"Select a repo to view files."}var gwr=C(ee(),1);var vwr=C(P(),1);function ywr({dirty:e}){let t=G6e(e);return(0,gwr.useEffect)(()=>{if(!e)return;let r=n=>n.preventDefault();return globalThis.addEventListener("beforeunload",r),()=>globalThis.removeEventListener("beforeunload",r)},[e]),t.state!=="blocked"?null:(0,vwr.jsx)(Ho,{title:"Discard unsaved changes?",message:"This file has unsaved changes that will be lost.",confirmLabel:"Discard",onConfirm:()=>t.proceed(),onCancel:()=>t.reset()})}var _wr=C(ee(),1);var g4=C(ee(),1);async function bwr({cwd:e,node:t,path:r,content:n,mtimeMs:o}){let i=await BT(tn(`/api/file?cwd=${encodeURIComponent(e)}&path=${encodeURIComponent(r)}`,t),{content:n,mtimeMs:o},"Failed to save file");if(typeof i.content!="string")throw new Error("The server returned no file content");return{content:i.content,mtimeMs:typeof i.mtimeMs=="number"?i.mtimeMs:o}}var F2e=C(ee(),1);function $2e(e){return e.status==="ready"?{content:e.content,mtimeMs:e.mtimeMs}:{content:"",mtimeMs:0}}function xwr(e){let[t,r]=(0,F2e.useState)(e),[n,o]=(0,F2e.useState)(()=>$2e(e)),[i,a]=(0,F2e.useState)(()=>$2e(e).content);if(t!==e){let s=$2e(e);r(e),o(s),a(s.content)}return{saved:n,setSaved:o,value:i,setValue:a}}function Hyo(e){return e instanceof Error?e.message:"Failed to save file"}function Swr(e,t,r){let{saved:n,setSaved:o,value:i,setValue:a}=xwr(r),[s,l]=(0,g4.useState)(!1),[u,d]=(0,g4.useState)(null),f=(0,g4.useRef)(i),p=yr();f.current=i;let h=r.status==="ready"&&i!==n.content,m=(0,g4.useCallback)(()=>{!e||!h||s||(l(!0),bwr({cwd:e,node:p,path:t,content:f.current,mtimeMs:n.mtimeMs}).then(y=>{o(y),a(y.content)}).catch(y=>d(Hyo(y))).finally(()=>l(!1)))},[e,p,t,h,s,n.mtimeMs,o,a]),g=(0,g4.useCallback)(()=>d(null),[]);return{value:i,setValue:a,save:m,saving:s,dirty:h,error:u,clearError:g}}var wwr=C(ee(),1);function Twr(e,t){return t?p4(e.find(r=>r.id===t)):{unavailable:"Select a session card to comment on this file."}}function Cwr(e,t,r){let[n,o]=(0,wwr.useState)(null),{session:i,unavailable:a}=Twr(e,t),s=()=>o(i?.name??null);return{onComment:i?w2e(i,r,s):void 0,onAddRule:i?x2e(i,r,s):void 0,unavailable:a,sentTo:n,clearSent:()=>o(null)}}function kwr(e){Zi(fo("save").matches,e)}function Ewr(e,t,r){let[n]=al(),o=n.get("path")??"",{worktreeCwd:i}=to(),a=n.get("cwd")||i,s=l2e(a,o),l=Swr(a,o,s),u=Cwr(e,t,r),[d,f]=(0,_wr.useState)("raw");return kwr(l.save),{path:o,cwd:a,state:s,buffer:l,comments:u,isMarkdown:Fde(o)==="markdown",mode:d,setMode:f}}var y4=C(P(),1);function Rwr({sessions:e,sendInput:t,cardId:r}){let{path:n,cwd:o,state:i,buffer:a,comments:s,isMarkdown:l,mode:u,setMode:d}=Ewr(e,r,t);return(0,y4.jsxs)(Is,{loading:i.status==="loading"&&!!(o&&n),isEmpty:i.status!=="ready",emptyMessage:mwr(i.status,n,o),maxWidth:!1,children:[(0,y4.jsx)(hwr,{path:n,mode:l?u:void 0,onModeChange:d,onSave:a.save,saving:a.saving,dirty:a.dirty}),i.status==="ready"&&(0,y4.jsx)(SSr,{path:n,cwd:o,rendered:l&&u==="rendered",value:a.value,onChange:a.setValue,comments:s}),(0,y4.jsx)(ywr,{dirty:a.dirty}),(0,y4.jsx)(kl,{error:a.error,onClose:a.clearError}),(0,y4.jsx)(d4,{sessionName:s.sentTo,onClose:s.clearSent})]})}var EZe=C(P(),1);function Pwr({socket:e}){return(0,EZe.jsx)(E2e,{defaultTo:"worktree",children:(0,EZe.jsx)(Rwr,{sessions:e.sessions,sendInput:e.sendInput,cardId:R2e(e)})})}var Xwr=C(ee(),1);var Awr=C(P(),1),oH=nt((0,Awr.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");function ma(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(1)}M`}function z2e(e){return`$${e.toFixed(2)}`}function Lwr(e){return e.input+e.output+e.cacheRead+(e.cacheWrite??0)}function U2e(e){let t=`${ma(Lwr(e))} tokens`;return e.costUsd===null?t:`${t} \xB7 ${z2e(e.costUsd)}`}function Iwr(e){if(!e)return"";if(e.scanning)return"Scanning Gmail and Slack\u2026";let t=e.lastScanAt?`Last scanned ${xo(e.lastScanAt)}`:"Never scanned",r=e.run?.status==="finished"&&e.run.usage?` \xB7 ${U2e(e.run.usage)}`:"",n=e.intervalMinutes?`scans every ${e.intervalMinutes} min`:"scheduled scans off";return`${t}${r} \xB7 ${n}`}var H2e,EL,Wee,RZe=new Set;function W2e(){for(let e of RZe)e()}function PZe(e){H2e=e,W2e()}function Mwr(e){EL=e,W2e()}async function Dwr(){try{let e=await Jt("/api/inbox"),t=await e.json();e.ok&&Array.isArray(t)&&PZe(t)}catch(e){Pr(e,"inbox refresh"),H2e===void 0&&PZe([])}}async function Nwr(){try{let e=await Jt("/api/inbox/status"),t=await e.json().catch(()=>({}));if(e.ok){Wee=void 0,Mwr(t);return}Wee=`Couldn't read scan status: ${t.error??`HTTP ${e.status}`}`}catch(e){Wee=`Couldn't read scan status: ${String(e)}`}W2e()}async function Wyo(e){PZe((H2e??[]).filter(t=>t.id!==e));try{await BT(`/api/inbox/${encodeURIComponent(e)}/dismiss`,{},"Failed to dismiss message")}finally{await Dwr()}}async function Gyo(){EL&&Mwr({...EL,scanning:!0,lastError:null});try{await BT("/api/inbox/scan",{},"Failed to start inbox scan")}catch(e){Wee=e instanceof Error?e.message:String(e),EL&&(EL={...EL,scanning:!1}),W2e();return}await Nwr()}var qs={get:()=>H2e,getStatus:()=>EL,getStatusError:()=>Wee,refresh:Dwr,refreshStatus:Nwr,dismiss:Wyo,scan:Gyo,subscribe(e){return RZe.add(e),()=>RZe.delete(e)}};var Owr=C(ee(),1);function G2e(){return(0,Owr.useSyncExternalStore)(qs.subscribe,qs.getStatus)}var Bwr=C(ee(),1);function $wr(){return(0,Bwr.useSyncExternalStore)(qs.subscribe,qs.getStatusError)}var Ky=C(P(),1);function Fwr(){let e=G2e(),t=$wr(),r=e?.scanning===!0,n=t??(e?.lastError&&!r?`Last scan failed: ${e.lastError}`:void 0);return(0,Ky.jsxs)(G,{sx:{display:"flex",alignItems:"flex-end",gap:2,flexWrap:"wrap",mb:3},children:[(0,Ky.jsxs)(G,{sx:{flex:"1 1 auto"},children:[(0,Ky.jsx)(Ce,{variant:"h5",component:"h1",children:"Inbox"}),(0,Ky.jsx)(Ce,{variant:"body2",color:"text.secondary",children:Iwr(e)}),n&&(0,Ky.jsx)(Ce,{variant:"body2",color:"error",children:n})]}),(0,Ky.jsx)(sr,{title:r?"A scan is already running":"",children:(0,Ky.jsx)("span",{children:(0,Ky.jsx)(ht,{variant:"outlined",size:"small",startIcon:(0,Ky.jsx)(oH,{}),disabled:r,onClick:()=>{qs.scan()},children:r?"Scanning\u2026":"Scan now"})})})]})}var Xy=C(P(),1),Vyo={display:"flex",alignItems:"flex-start",gap:1,bgcolor:"background.paper",borderRadius:2,p:2.5,transition:"background-color 0.15s","&:hover":{bgcolor:"action.hover"}},qyo={color:"text.disabled","&:hover":{color:"text.primary"}};function zwr({message:e,onDismiss:t}){return(0,Xy.jsxs)(G,{sx:Vyo,children:[(0,Xy.jsxs)(Qr,{href:e.link,target:"_blank",rel:"noopener noreferrer",underline:"none",color:"inherit",sx:{flex:1,minWidth:0},children:[(0,Xy.jsxs)(G,{sx:{display:"flex",alignItems:"center",gap:1,mb:.75},children:[(0,Xy.jsx)(Vn,{label:e.source,size:"small"}),(0,Xy.jsx)(Ce,{variant:"subtitle2",children:e.sender}),(0,Xy.jsx)(Ce,{variant:"body2",color:"text.secondary",children:xo(e.receivedAt)})]}),(0,Xy.jsx)(Ce,{variant:"body2",children:e.summary})]}),(0,Xy.jsx)(jt,{size:"small",onClick:t,title:`Dismiss message from ${e.sender}`,sx:qyo,children:(0,Xy.jsx)(Uo,{sx:{fontSize:16}})})]})}function iH(e){let t=Math.floor(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}var Hwr=C(P(),1);function Uwr({tokens:e}){return(0,Hwr.jsx)(Ce,{component:"span",sx:{fontSize:"inherit",fontFamily:"fontFamilyMono",display:{xs:"none",sm:"inline"}},color:"text.disabled",noWrap:!0,children:e===void 0?"":ma(e)})}var RL=C(P(),1),jyo={tool:"info.main",text:"text.secondary",result:"success.main",error:"error.main"},Yyo={display:"grid",gridTemplateColumns:{xs:"3.5em 9em 1fr",sm:"3.5em 9em 1fr auto"},gap:1,py:.5,typography:"caption",alignItems:"baseline"};function Wwr({event:e,startedAt:t}){let r=Date.parse(e.at)-Date.parse(t);return(0,RL.jsxs)(G,{sx:Yyo,children:[(0,RL.jsx)(Ce,{component:"span",sx:{fontSize:"inherit",fontFamily:"fontFamilyMono"},color:"text.disabled",children:iH(Math.max(0,r))}),(0,RL.jsx)(Ce,{component:"span",sx:{fontSize:"inherit",fontWeight:600,color:jyo[e.kind]},noWrap:!0,children:e.label}),(0,RL.jsx)(Ce,{component:"span",sx:{fontSize:"inherit",fontFamily:e.kind==="tool"?"fontFamilyMono":void 0,color:e.kind==="error"?"error.main":"text.primary",overflowWrap:"anywhere",whiteSpace:"pre-wrap"},children:e.detail}),(0,RL.jsx)(Uwr,{tokens:e.tokens})]})}function V2e(e,t){let[r,n]=t.split(".");return e.palette[r]?.[n]??t}function Ub(e){return t=>{let r=V2e(t,e);return{display:"inline-flex",alignItems:"center",gap:"5px",flexShrink:0,px:1,lineHeight:"18px",borderRadius:999,fontSize:11,fontWeight:600,whiteSpace:"nowrap",color:r,bgcolor:Vr(r,.15)}}}var q2e=C(ee(),1);function j2e(e){let[t,r]=(0,q2e.useState)(()=>Date.now()),n=e.status==="scanning";(0,q2e.useEffect)(()=>{if(!n)return;let i=setInterval(()=>r(Date.now()),1e3);return()=>clearInterval(i)},[n]);let o=e.finishedAt?Date.parse(e.finishedAt):t;return Math.max(0,o-Date.parse(e.startedAt))}var Hb=C(P(),1),Kyo={scanning:{label:"Scanning",color:"info.main"},finished:{label:"Finished",color:"success.main"},failed:{label:"Failed",color:"error.main"}},Xyo={display:"flex",alignItems:"center",gap:1,width:"100%",px:2,py:1.25,justifyContent:"flex-start",textAlign:"left"};function Gwr({run:e,open:t,onToggle:r}){let n=j2e(e),{label:o,color:i}=Kyo[e.status];return(0,Hb.jsxs)(nr,{sx:Xyo,onClick:r,"aria-expanded":t,children:[(0,Hb.jsx)(ba,{fontSize:"small",sx:{color:"text.secondary",transform:t?"none":"rotate(-90deg)",transition:"transform 0.15s"}}),(0,Hb.jsx)(Ce,{variant:"subtitle2",children:"Scan activity"}),(0,Hb.jsx)(G,{component:"span",sx:Ub(i),children:o}),(0,Hb.jsxs)(Ce,{variant:"caption",color:"text.secondary",sx:{ml:"auto",fontFamily:"fontFamilyMono"},children:[e.usage&&(0,Hb.jsxs)(Hb.Fragment,{children:[U2e(e.usage),e.status==="scanning"?" so far":""," \xB7 "]}),iH(n)]})]})}function Vwr(){return{input:0,output:0,cacheRead:0,cacheWrite:0,costUsd:null,durationMs:null}}var i0=C(P(),1),Zyo={display:"grid",gridTemplateColumns:{xs:"repeat(3, minmax(0, 1fr))",sm:"repeat(6, minmax(0, 1fr))"},borderTop:1,borderBottom:1,borderColor:"divider"};function aH({label:e,value:t}){return(0,i0.jsxs)(G,{sx:{px:2,py:1.25,minWidth:0},children:[(0,i0.jsx)(Ce,{variant:"caption",color:"text.secondary",sx:{display:"block",textTransform:"uppercase"},children:e}),(0,i0.jsx)(Ce,{variant:"body1",sx:{fontFamily:"fontFamilyMono"},color:t===null?"text.disabled":"text.primary",noWrap:!0,children:t??"pending"})]})}function qwr({run:e}){let t=j2e(e),r=e.usage??Vwr(),n=o=>o.toLocaleString();return(0,i0.jsxs)(G,{sx:Zyo,children:[(0,i0.jsx)(aH,{label:"Input",value:n(r.input)}),(0,i0.jsx)(aH,{label:"Output",value:n(r.output)}),(0,i0.jsx)(aH,{label:"Cache read",value:n(r.cacheRead)}),(0,i0.jsx)(aH,{label:"Cache write",value:n(r.cacheWrite)}),(0,i0.jsx)(aH,{label:"Cost",value:r.costUsd===null?null:z2e(r.costUsd)}),(0,i0.jsx)(aH,{label:"Duration",value:iH(r.durationMs??t)})]})}var Y2e=C(ee(),1);function jwr(e){let[t,r]=(0,Y2e.useState)(e.status==="scanning"),n=e.status==="scanning"?e.startedAt:void 0;return(0,Y2e.useEffect)(()=>{n&&r(!0)},[n]),[t,r]}var Wb=C(P(),1),Qyo={bgcolor:"background.paper",borderRadius:2,mb:3};function Jyo({run:e}){let[t,r]=jwr(e);return(0,Wb.jsxs)(G,{sx:Qyo,children:[(0,Wb.jsx)(Gwr,{run:e,open:t,onToggle:()=>r(!t)}),(0,Wb.jsxs)(Hv,{in:t,unmountOnExit:!0,children:[(0,Wb.jsx)(qwr,{run:e}),(0,Wb.jsx)(G,{sx:{px:2,py:1,maxHeight:360,overflowY:"auto"},children:e.events.length===0?(0,Wb.jsx)(Ce,{variant:"caption",color:"text.secondary",children:"Waiting for the first tool call\u2026"}):e.events.map((n,o)=>(0,Wb.jsx)(Wwr,{event:n,startedAt:e.startedAt},`${n.at}-${o}`))})]})]})}function Ywr(){let e=G2e()?.run;return e?(0,Wb.jsx)(Jyo,{run:e}):null}var Kwr=C(ee(),1);function K2e(){return(0,Kwr.useSyncExternalStore)(qs.subscribe,qs.get)}var Gb=C(P(),1);function Zwr(){let e=K2e();return(0,Xwr.useEffect)(()=>{qs.refresh(),qs.refreshStatus()},[]),(0,Gb.jsx)(Is,{loading:e===void 0,header:(0,Gb.jsxs)(Gb.Fragment,{children:[(0,Gb.jsx)(Fwr,{}),(0,Gb.jsx)(Ywr,{})]}),isEmpty:e?.length===0,emptyMessage:"No messages need a reply.",children:(0,Gb.jsx)(kt,{spacing:1,children:e?.map(t=>(0,Gb.jsx)(zwr,{message:t,onDismiss:()=>{qs.dismiss(t.id)}},t.id))})})}var Gee=C(ee(),1);var AZe=C(P(),1);function Qwr(){return(0,AZe.jsx)(G,{sx:{display:"flex",justifyContent:"flex-end",mb:2},children:(0,AZe.jsx)(Qr,{component:da,to:"/config?search=news",underline:"hover",variant:"body2",children:"News settings"})})}function Jwr(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return"just now";let r=Math.floor(t/60);if(r<60)return`${r}m ago`;let n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}var UT=C(P(),1),evo={display:"block",bgcolor:"background.paper",borderRadius:2,p:2.5,transition:"background-color 0.15s","&:hover":{bgcolor:"action.hover"}},tvo={width:16,height:16};function eCr({item:e}){return(0,UT.jsxs)(Qr,{href:e.link,target:"_blank",rel:"noopener noreferrer",underline:"none",color:"inherit",sx:evo,children:[(0,UT.jsxs)(G,{sx:{display:"flex",alignItems:"center",gap:1,mb:.75},children:[(0,UT.jsx)(U3e,{src:`${e.feedOrigin}/favicon.ico`,variant:"rounded",sx:tvo,children:" "}),(0,UT.jsx)(Vn,{label:e.feedTitle,size:"small"}),(0,UT.jsx)(Ce,{variant:"body2",color:"text.secondary",children:Jwr(e.pubDate)})]}),(0,UT.jsx)(Ce,{variant:"h6",sx:{fontWeight:500,lineHeight:1.3},children:e.title}),e.excerpt&&(0,UT.jsx)(Ce,{variant:"body2",color:"text.secondary",sx:{mt:.75},children:e.excerpt})]})}function rvo(e){let t=new Date(e),r=new Date;return t.toLocaleDateString("en-US",{weekday:"long",month:"short",day:"numeric",year:t.getFullYear()!==r.getFullYear()?"numeric":void 0})}function nvo(e){return new Date(e).toISOString().slice(0,10)}function tCr(e){let t=new Map;for(let r of e){let n=nvo(r.pubDate),o=t.get(n);o?o.items.push(r):t.set(n,{label:rvo(r.pubDate),items:[r]})}return[...t.values()]}var v4=C(P(),1);async function ovo(){return(await Jt("/api/news/items")).json()}function rCr(){let[e,t]=(0,Gee.useState)([]),[r,n]=(0,Gee.useState)(!0);return(0,Gee.useEffect)(()=>{ovo().then(o=>t(tCr(o))).finally(()=>n(!1))},[]),(0,v4.jsx)(Is,{loading:r,isEmpty:e.length===0,emptyMessage:"No news items.",header:(0,v4.jsx)(Qwr,{}),children:e.map(o=>(0,v4.jsxs)(G,{sx:{mb:4},children:[(0,v4.jsx)(Ce,{variant:"overline",color:"text.secondary",sx:{display:"block",mb:1,px:.5},children:o.label}),(0,v4.jsx)(kt,{spacing:1,children:o.items.map(i=>(0,v4.jsx)(eCr,{item:i},`${i.link}-${i.pubDate}`))})]},o.label))})}function X2e(e){let t=e.peerPrs.items[0];if(t)return{kind:"pr",item:t};let r=e.assignedIssues.items[0];if(r)return{kind:"issue",item:r};let n=e.pickups.items[0];if(n)return{kind:"pickup",item:n};let o=e.myPrs.items[0];return o?{kind:"mine",item:o}:null}var a0={review:{label:"Review",color:"primary"},mine:{label:"Yours",color:"info"},assigned:{label:"Assigned",color:"secondary"},pickup:{label:"Pick up",color:"success"}};var Vee=C(P(),1);function nCr(){return(0,Vee.jsxs)(Zr,{variant:"outlined",sx:{p:4,textAlign:"center"},children:[(0,Vee.jsx)(Ce,{variant:"h6",component:"h2",children:"Nothing needs you here"}),(0,Vee.jsx)(Ce,{sx:{color:"text.secondary"},children:"No peer PRs await your review, no issues are assigned to you and no project items are ready to pick up."})]})}function oCr({peerPrs:e,myPrs:t,assignedIssues:r,pickups:n}){return[e,t,r,n].every(o=>o.items.length===0&&!o.error)}var iCr=C(P(),1);function Z2e({chip:e}){return(0,iCr.jsx)(Vn,{label:e.label,size:"small",color:e.color,variant:"tonal"})}var HT=C(P(),1),ivo={fontSize:14,fontWeight:600},avo=e=>({color:"text.disabled",fontFamily:e.typography.fontFamilyMono,fontSize:12});function qee({chip:e,title:t,count:r,error:n,rows:o}){return o.length===0&&!n?null:(0,HT.jsxs)(kt,{spacing:1,component:"section",children:[(0,HT.jsxs)(kt,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,HT.jsx)(Z2e,{chip:e}),(0,HT.jsx)(Ce,{variant:"subtitle2",component:"h3",sx:ivo,children:t}),(0,HT.jsx)(Ce,{variant:"body2",sx:avo,children:r})]}),n&&(0,HT.jsx)(no,{severity:"error",sx:{whiteSpace:"pre-line"},children:n}),o.length>0&&(0,HT.jsx)(Zr,{variant:"outlined",sx:{overflow:"hidden"},children:o})]})}var aCr="github.com/";function Q2e(e){let t=(e.remoteOrigin??e.repoGroup?.origin)?.toLowerCase();return t?.startsWith(aCr)?t.slice(aCr.length):void 0}function J2e(e,t,r){let n=t.toLowerCase();return e.filter(o=>i1(o)===r&&Q2e(o)===n)}var sH=C(P(),1),svo={success:{label:"checks passing",color:"success.main"},failure:{label:"checks failing",color:"error.main"},pending:{label:"checks running",color:"warning.main"}};function lH({pr:e}){let t=e.checks?svo[e.checks]:null,r=e.reason==="requested"?`review requested ${xo(e.requestedAt)}`:`opened ${xo(e.createdAt)}`;return(0,sH.jsxs)(kt,{direction:"row",spacing:1.5,useFlexGap:!0,sx:{flexWrap:"wrap",color:"text.secondary"},children:[(0,sH.jsx)(Ce,{variant:"body2",children:e.author}),(0,sH.jsx)(Ce,{variant:"body2",children:r}),t&&(0,sH.jsx)(Ce,{variant:"body2",sx:{color:t.color},children:t.label})]})}var eSe=C(ee(),1),LZe=(0,eSe.createContext)({sessions:[],trackedIssues:new Map,activate:()=>{}});function b4(){return(0,eSe.useContext)(LZe)}var sCr=C(P(),1),tSe=nt((0,sCr.jsx)("path",{d:"M20 4H4c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2m0 14H4V8h16zm-2-1h-6v-2h6zM7.5 17l-1.41-1.41L8.67 13l-2.59-2.59L7.5 9l4 4z"}),"Terminal");var rSe=C(P(),1);function lCr({sessions:e,size:t}){let{activate:r}=b4();return e.map(n=>(0,rSe.jsxs)(ht,{variant:"contained",size:t,startIcon:(0,rSe.jsx)(tSe,{}),onClick:()=>r(n.id),children:["Session ",n.id]},n.id))}function cCr(e){return e==="medium"?{start:"contained",link:"tonal"}:{start:"tonal",link:"text"}}var dCr=C(P(),1);function uCr({url:e,variant:t,size:r}){return(0,dCr.jsx)(ht,{variant:t,size:r,href:e,target:"_blank",rel:"noopener noreferrer",children:"GitHub \u2197"})}var nSe=C(ee(),1),IZe=(0,nSe.createContext)(()=>{});function fCr(){return(0,nSe.useContext)(IZe)}var WT=C(P(),1);function oSe({repo:e,url:t,onStart:r,sessions:n=[],size:o="small"}){let i=fCr()(e),a=cCr(o);return(0,WT.jsxs)(kt,{direction:"row",spacing:1,useFlexGap:!0,sx:{flexShrink:0,flexWrap:"wrap"},children:[(0,WT.jsx)(lCr,{sessions:n,size:o}),(0,WT.jsx)(sr,{title:i?"":`No local clone of ${e} to start a session in`,children:(0,WT.jsx)("span",{children:(0,WT.jsx)(ht,{variant:a.start,size:o,startIcon:(0,WT.jsx)(sy,{}),disabled:!i,onClick:()=>i&&r(i),children:"Start session"})})}),(0,WT.jsx)(uCr,{url:t,variant:a.link,size:o})]})}var pCr=C(P(),1),lvo={fontFamily:"fontFamilyMono",whiteSpace:"nowrap",fontSize:12,fontWeight:400,color:"text.disabled"};function iSe({repo:e,number:t}){return(0,pCr.jsxs)(Ce,{variant:"body2",sx:lvo,children:[e,"#",t]})}var x4=C(P(),1),cvo=e=>({px:"14px",py:"10px",alignItems:{sm:"center"},transition:"background-color .2s ease","&:hover":{bgcolor:e.tokens.color.raised},"& + &":{borderTop:1,borderColor:e.tokens.color.lineSoft}}),uvo={fontWeight:600,fontSize:14,overflowWrap:"anywhere"};function aSe({repo:e,number:t,title:r,facts:n,url:o,onStart:i,sessions:a}){return(0,x4.jsxs)(kt,{direction:{xs:"column",sm:"row"},spacing:1,sx:cvo,children:[(0,x4.jsxs)(kt,{spacing:.25,sx:{flex:1,minWidth:0},children:[(0,x4.jsxs)(kt,{direction:"row",spacing:1,useFlexGap:!0,sx:{alignItems:"baseline",flexWrap:"wrap"},children:[(0,x4.jsx)(iSe,{repo:e,number:t}),(0,x4.jsx)(Ce,{sx:uvo,children:r})]}),n]}),(0,x4.jsx)(oSe,{repo:e,url:o,onStart:i,sessions:a})]})}var sSe=C(P(),1);function MZe({chip:e,title:t,section:r,hiddenUrl:n,onStart:o}){let{sessions:i}=b4();return(0,sSe.jsx)(qee,{chip:e,title:t,count:r.items.length,error:r.error,rows:r.items.filter(a=>a.url!==n).map(a=>(0,sSe.jsx)(aSe,{repo:a.repo,number:a.number,title:a.title,facts:(0,sSe.jsx)(lH,{pr:a}),url:a.url,onStart:s=>o(a,s),sessions:J2e(i,a.repo,a.number)},a.url))})}function lSe(e,t,r,n){let o=r.toLowerCase(),i=`${o}#${n}`;return e.filter(a=>Q2e(a)===o&&(a.promptIssue?.toLowerCase()===i||t.get(a.id)?.toLowerCase()===i))}var gCr=C(P(),1),hCr=Gl.issueType;function mCr({type:e}){let t=hCr[e.color]??hCr.GRAY;return(0,gCr.jsx)(Vn,{label:e.name,size:"small",variant:"outlined",sx:r=>{let n=r.palette.mode==="dark"?t.dark:t.light;return{color:n,borderColor:n,height:20}}})}var GT=C(P(),1);function cH({issue:e}){let t="status"in e?e:null;return(0,GT.jsxs)(kt,{direction:"row",spacing:1.5,useFlexGap:!0,sx:{flexWrap:"wrap",color:"text.secondary",alignItems:"center"},children:[t?.type&&(0,GT.jsx)(mCr,{type:t.type}),t&&(0,GT.jsxs)(Ce,{variant:"body2",children:[t.projectTitle," \xB7 ",t.status]}),t?.priority&&(0,GT.jsx)(Ce,{variant:"body2",children:t.priority}),(0,GT.jsx)(Ce,{variant:"body2",children:e.author}),(0,GT.jsxs)(Ce,{variant:"body2",children:["opened ",xo(e.createdAt)]}),e.labels.length>0&&(0,GT.jsx)(Ce,{variant:"body2",children:e.labels.join(", ")})]})}var DZe=C(P(),1);function NZe(e,t,r,{sessions:n,trackedIssues:o}){return e.filter(i=>i.url!==t).map(i=>(0,DZe.jsx)(aSe,{repo:i.repo,number:i.number,title:i.title,facts:(0,DZe.jsx)(cH,{issue:i}),url:i.url,onStart:a=>r(i,a),sessions:lSe(n,o,i.repo,i.number)},i.url))}var Vb=C(P(),1);function yCr({data:e,onStartPr:t,onStartIssue:r,onStartPickup:n}){let o=b4(),{peerPrs:i,myPrs:a,assignedIssues:s,pickups:l}=e;if(oCr(e))return(0,Vb.jsx)(nCr,{});let u=X2e(e)?.item.url;return(0,Vb.jsxs)(Vb.Fragment,{children:[(0,Vb.jsx)(MZe,{chip:a0.review,title:"Peer PRs awaiting your review",section:i,hiddenUrl:u,onStart:t}),(0,Vb.jsx)(MZe,{chip:a0.mine,title:"Your open PRs",section:a,hiddenUrl:u,onStart:t}),(0,Vb.jsx)(qee,{chip:a0.assigned,title:"Issues assigned to you",count:s.items.length,error:s.error,rows:NZe(s.items,u,r,o)}),(0,Vb.jsx)(qee,{chip:a0.pickup,title:"Project items to pick up",count:l.items.length,error:l.error,rows:NZe(l.items,u,n,o)})]})}var vCr=C(ee(),1),cSe=C(P(),1);function bCr({lines:e}){return(0,cSe.jsx)(Ce,{sx:{m:0,fontSize:12.5,color:"text.secondary"},children:e.map((t,r)=>(0,cSe.jsxs)(vCr.Fragment,{children:[r>0&&" \xB7 ",t]},t.key))})}var PL=C(P(),1),dvo=e=>({fontFamily:e.typography.fontFamilyMono,fontSize:11.5,color:"text.primary"});function uSe({label:e,value:t,unset:r,setter:n,showSetter:o}){return(0,PL.jsxs)(Ce,{variant:"body2",component:"span",sx:{color:"text.secondary",fontSize:"inherit"},children:[e,": ",t??r,o&&(0,PL.jsxs)(PL.Fragment,{children:[" \xB7 set with ",(0,PL.jsx)(Ce,{component:"code",variant:"body2",sx:dvo,children:n})]})]})}var xCr=C(ee(),1),dSe=C(P(),1);function SCr({projects:e,boards:t}){return e.map((r,n)=>{let o=t.find(i=>i.project===r);return(0,dSe.jsxs)(xCr.Fragment,{children:[n>0&&", ",o?.url?(0,dSe.jsx)(Qr,{href:o.url,target:"_blank",rel:"noopener noreferrer",underline:"hover",title:r,children:o.title}):r]},r)})}var uH=C(P(),1);function fvo(e){let t=[e.excludeLabels.length>0&&`labels ${e.excludeLabels.join(", ")}`,e.excludeTypes.length>0&&`types ${e.excludeTypes.join(", ")}`].filter(Boolean),r=t.length>0?`, excluding ${t.join("; ")}`:"";return`, picking up ${e.pickStatuses.join(", ")}${r}`}function TCr(e,t){return e.projects.length===0?null:(0,uH.jsxs)(uH.Fragment,{children:[(0,uH.jsx)(SCr,{projects:e.projects,boards:t}),fvo(e)]})}var jee=C(P(),1);function pvo(e,t){return e?e.join(", "):t?`${t} (this repo, by default)`:null}function wCr({scope:e,boards:t}){let r=[(0,jee.jsx)(uSe,{label:"Peers",value:e.peers.length>0?e.peers.join(", "):null,unset:"none \u2014 only PRs requesting your review appear",setter:"assist config set next.peers alice,bob --repo",showSetter:e.peers.length===0},"peers"),(0,jee.jsx)(uSe,{label:"Repos",value:pvo(e.repos,e.selfRepo),unset:"none",setter:"assist config set next.repos my-org,other/web --repo",showSetter:!e.repos},"repos"),(0,jee.jsx)(uSe,{label:"Projects",value:TCr(e,t),unset:"none \u2014 no project items are suggested",setter:"assist config set next.projects my-org/3,my-org/5 --repo",showSetter:e.projects.length===0},"projects")];return(0,jee.jsx)(bCr,{lines:r})}var VT=C(P(),1),hvo={flex:1,m:0,mb:.5,fontSize:22,fontWeight:600,lineHeight:1.3,letterSpacing:"-0.01em"};function CCr({loading:e,data:t,onRefresh:r}){return(0,VT.jsxs)(kt,{direction:"row",useFlexGap:!0,sx:{mb:"22px",gap:"8px 16px",alignItems:"flex-start"},children:[(0,VT.jsxs)(kt,{sx:{flex:1,minWidth:0},children:[(0,VT.jsx)(Ce,{component:"h2",sx:hvo,children:"Next"}),t&&(0,VT.jsx)(wCr,{scope:t.scope,boards:t.boards})]}),(0,VT.jsxs)(kt,{direction:"row",spacing:1,children:[(0,VT.jsx)(ht,{component:da,to:"/config?search=next",children:"Next settings"}),(0,VT.jsx)(ht,{variant:"tonal",onClick:r,disabled:e,children:"Refresh"})]})]})}var fSe=C(P(),1);function kCr({picking:e,error:t,clearError:r}){return e?(0,fSe.jsxs)(no,{severity:"info",children:["Assigning ",e.repo,"#",e.number," to you and moving it to In Progress\u2026"]}):t?(0,fSe.jsx)(no,{severity:"error",onClose:r,children:t}):null}var _Cr=e=>({px:2.5,py:"18px","& > .MuiStack-root":{gap:"10px"},"& > .MuiStack-root > :not(style) ~ :not(style)":{mt:0},"& h2":{fontSize:19,fontWeight:600,lineHeight:1.35,letterSpacing:"-0.01em"},"& .MuiTypography-overline":{fontSize:11,fontWeight:600,letterSpacing:"0.08em",color:"text.disabled"},borderColor:Vr(e.palette.primary.main,.4),borderRadius:`${e.tokens.radius.md+2}px`,backgroundImage:`linear-gradient(180deg, ${e.palette.action.selected}, transparent 70%)`});var Zy=C(P(),1);function ECr({chip:e,repo:t,number:r,title:n,facts:o,why:i,url:a,onStart:s,sessions:l}){return(0,Zy.jsx)(Zr,{variant:"outlined",sx:_Cr,children:(0,Zy.jsxs)(kt,{spacing:1.5,children:[(0,Zy.jsx)(Ce,{variant:"overline",sx:{color:"text.secondary",lineHeight:1.5},children:"Your next best action"}),(0,Zy.jsxs)(kt,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,Zy.jsx)(Z2e,{chip:e}),(0,Zy.jsx)(iSe,{repo:t,number:r})]}),(0,Zy.jsx)(Ce,{variant:"h6",component:"h2",children:n}),o,(0,Zy.jsx)(Ce,{sx:{color:"text.secondary",maxWidth:"65ch"},children:i}),(0,Zy.jsx)(oSe,{repo:t,url:a,onStart:s,sessions:l,size:"medium"})]})})}function RCr(e,t,r){let n=t>1?`the oldest of ${t} issues assigned to you`:"the only issue assigned to you",o=r?", and no peer PRs await your review":"";return`Opened ${xo(e.createdAt)} \u2014 ${n}${o}.`}function PCr(e,t,r){let n=t>1?`the oldest of your ${t} open PRs`:"your only open PR",o=e.isDraft?"drafted":"opened",i=r?", and nothing else awaits your review, is assigned to you or is ready to pick up":"";return`You ${o} it ${xo(e.createdAt)} \u2014 ${n}${i}.`}var LCr=C(P(),1);function ACr(e,{data:t,onStartPr:r}){let{peerPrs:n,myPrs:o,assignedIssues:i,pickups:a}=t;return{chip:a0.mine,facts:(0,LCr.jsx)(lH,{pr:e}),why:PCr(e,o.items.length,!n.error&&!i.error&&!a.error),onStart:s=>r(e,s)}}function ICr(e,t,r){let n=t>1?`the top of ${t} unassigned project items`:"the only unassigned project item",o=r?", and nothing is assigned to you or awaiting your review":"";return`${e.status} on ${e.projectTitle} \u2014 ${n} you could pick up${o}.`}var DCr=C(P(),1);function MCr(e,{data:t,onStartPickup:r}){let{peerPrs:n,assignedIssues:o,pickups:i}=t;return{chip:a0.pickup,facts:(0,DCr.jsx)(cH,{issue:e}),why:ICr(e,i.items.length,!n.error&&!o.error),onStart:a=>r(e,a)}}function NCr(e,t){let r=t>1?`the oldest of ${t} PRs`:"the only PR",n=e.reason==="requested"?`${e.author} requested your review ${xo(e.requestedAt)}`:`${e.author} is a peer and opened it ${xo(e.createdAt)}`,o=e.checks==="success"?" Checks pass, so your review is what it is waiting on.":"";return`${n} \u2014 ${r} waiting on your review.${o}`}var OZe=C(P(),1);function OCr(e,t){let{data:r,onStartPr:n,onStartIssue:o}=t,{peerPrs:i,assignedIssues:a}=r;switch(e.kind){case"pr":return{chip:a0.review,facts:(0,OZe.jsx)(lH,{pr:e.item}),why:NCr(e.item,i.items.length),onStart:s=>n(e.item,s)};case"issue":return{chip:a0.assigned,facts:(0,OZe.jsx)(cH,{issue:e.item}),why:RCr(e.item,a.items.length,!i.error),onStart:s=>o(e.item,s)};case"pickup":return MCr(e.item,t);case"mine":return ACr(e.item,t)}}var $Cr=C(P(),1);function BCr(e){let{sessions:t,trackedIssues:r}=b4(),n=X2e(e.data);if(!n)return null;let{repo:o,number:i,title:a,url:s}=n.item;return(0,$Cr.jsx)(ECr,{repo:o,number:i,title:a,url:s,sessions:n.kind==="pr"||n.kind==="mine"?J2e(t,o,i):lSe(t,r,o,i),...OCr(n,e)})}function S4(e){return{title:e.title,subtitle:`#${e.number} \xB7 ${e.author} \xB7 ${xo(e.createdAt)}`}}var pSe=C(ee(),1),BZe=(0,pSe.createContext)({launchAssist:()=>{},launchAgentInStream:()=>{},resumeSession:()=>{},armUpdateReload:()=>{},activateSession:()=>{},sendInput:()=>{}});function ql(){return(0,pSe.useContext)(BZe)}var UCr=C(ee(),1);var dH=[{label:"Review",args:["review"]},{label:"Review & refine",args:["review","--refine"]},{label:"Review & apply",args:["review","--apply"]},{label:"Review & post",args:["review","--no-prompt","--submit"]},{label:"High-level review",args:["review","--high-level"]}];var $Ze=[{key:"force",label:"Force re-run",flag:"--force"},{key:"addressComments",label:"Address comments after",flag:"--address-comments"},{key:"announce",label:"Announce to Slack after",flag:"--announce"}],Yee={force:!1,addressComments:!1,announce:!1};function hSe(e){return $Ze.filter(({key:t})=>e[t]).map(({flag:t})=>t)}var mSe=C(P(),1),mvo={"& .MuiFormControlLabel-label":{fontSize:12}};function gSe({value:e,onChange:t}){return(0,mSe.jsx)(eRe,{sx:{px:2,py:.5},children:$Ze.map(({key:r,label:n})=>(0,mSe.jsx)(Gv,{control:(0,mSe.jsx)(np,{size:"small",checked:e[r],onChange:o=>t({...e,[r]:o.target.checked})}),label:n,sx:mvo},r))})}var FCr=[{label:"Checkout",args:["review","--checkout-only"]},{label:"Address Comments",args:["review-pr-comments"]},{label:"Address Comments (batch)",args:["review-pr-comments","--batch"]},{label:"Address Comments (auto)",args:["review-pr-comments","--auto"]},{label:"Fix conflicts (merge)",args:["fix-conflict"]},{label:"Fix conflicts (rebase)",args:["fix-conflict","--rebase"]}];var T4=C(P(),1);function zCr({pr:e,onSelect:t,onCancel:r}){return(0,T4.jsxs)(T4.Fragment,{children:[FCr.map(({label:n,args:o})=>(0,T4.jsx)(jr,{onClick:()=>t(o),children:n},n)),(0,T4.jsx)(eo,{}),(0,T4.jsx)(jr,{onClick:()=>{window.open(e.url,"_blank"),r()},children:"Open in GitHub"})]})}var mm=C(P(),1);function ySe({pr:e,onSelect:t,onCancel:r}){let[n,o]=(0,UCr.useState)(Yee);return(0,mm.jsxs)(vl,{open:!0,onClose:r,maxWidth:"xs",fullWidth:!0,children:[(0,mm.jsxs)(bd,{sx:{fontSize:15},children:["Review #",e.number,": ",e.title]}),(0,mm.jsx)(vd,{sx:{px:0},children:(0,mm.jsxs)(eg,{children:[dH.map(({label:i,args:a})=>(0,mm.jsx)(jr,{onClick:()=>t([...a,...hSe(n)]),children:i},i)),(0,mm.jsx)(eo,{}),(0,mm.jsx)(gSe,{value:n,onChange:o}),(0,mm.jsx)(eo,{}),(0,mm.jsx)(zCr,{pr:e,onSelect:t,onCancel:r})]})}),(0,mm.jsx)(op,{children:(0,mm.jsx)(ht,{onClick:r,children:"Cancel"})})]})}var WCr=C(P(),1);function HCr({review:{pr:e,cwd:t},onClose:r}){let{selectedNode:n}=to(),{launchAssist:o}=ql();return(0,WCr.jsx)(ySe,{pr:e,onSelect:i=>{o([...i,String(e.number)],t,{...S4(e),node:n}),r()},onCancel:r})}var GCr=C(ee(),1);function VCr(e){let{repos:t,selectedCwd:r,originOf:n}=to();return(0,GCr.useCallback)(o=>{let i=o.toLowerCase();if(e?.toLowerCase()===i)return r;let a=`github.com/${i}`;return t.find(s=>n(s)?.toLowerCase()===a)},[t,r,n,e])}var YCr=C(ee(),1);function qCr(){let[,e]=al();return(t,r)=>e(n=>(n.set("new",`Issue ${t.repo}#${t.number}: ${t.title}
3873
+ ${zb(r,n)}`}function w2e(e,t,r){return n=>{Gd(t,e.id,O2r(n)),r()}}function $2r(e,t,r){let[n,o]=(0,B2r.useState)(null),{session:i,unavailable:a}=N2r(e,t);return{onComment:i?T2e(i,r,()=>o(i.name)):void 0,onFileComment:i?w2e(i,r,()=>o(i.name)):void 0,onAddRule:i?x2e(i,r,()=>o(i.name)):void 0,unavailable:a,sentTo:n,clearSent:()=>o(null)}}var DXe=C(ee(),1);var Tyo={modify:"modified",add:"added",delete:"removed",rename:"renamed",copy:"renamed"};function F2r(e,{query:t,changeType:r}){let n=t.trim().toLowerCase();return e.filter(o=>n&&!Zp(o).toLowerCase().includes(n)?!1:r==="all"||Tyo[o.type]===r)}function z2r(e){let t=new Map(xL(u2e(e)).map((r,n)=>[r,n]));return[...e].sort((r,n)=>(t.get(Zp(r))??0)-(t.get(Zp(n))??0))}function U2r(e){return e.replace(/\t$/,"")}function H2r(e){return ade(e).map(t=>({...t,oldPath:U2r(t.oldPath),newPath:U2r(t.newPath)}))}function W2r({diff:e,error:t,search:r,changeType:n}){let o=(0,DXe.useMemo)(()=>t||!e?[]:H2r(e),[e,t]),i=(0,DXe.useMemo)(()=>z2r(F2r(o,{query:r,changeType:n})),[o,r,n]);return{files:o,visibleFiles:i}}var OXe=C(ee(),1);var C2e=C(ee(),1);function Vl(e){try{let t=localStorage.getItem(e);if(!t)return[];let r=JSON.parse(t);return Array.isArray(r.items)?r.items:[]}catch{return[]}}function iu(e,t){try{if(t.length===0){localStorage.removeItem(e);return}localStorage.setItem(e,JSON.stringify({savedAt:Date.now(),items:t}))}catch{}}function wL(e){try{localStorage.removeItem(e)}catch{}}function h4(e){try{let t=Date.now();for(let r=localStorage.length-1;r>=0;r--){let n=localStorage.key(r);if(!n?.startsWith(e))continue;let o=localStorage.getItem(n),i=o?JSON.parse(o).savedAt:0;(!i||t-i>864e5)&&localStorage.removeItem(n)}}catch{}}var NXe="assist:diff-view-type";function G2r(){let[e]=Vl(NXe);return e==="unified"||e==="split"?e:"split"}function eH(){let[e,t]=(0,C2e.useState)(G2r);return(0,C2e.useEffect)(()=>{let r=n=>{n.key===NXe&&t(G2r())};return addEventListener("storage",r),()=>removeEventListener("storage",r)},[]),{viewType:e,onChange:r=>{iu(NXe,[r]),t(r)}}}function V2r(){let{viewType:e,onChange:t}=eH(),[r,n]=(0,OXe.useState)(""),[o,i]=(0,OXe.useState)("all");return{viewType:e,onChange:t,search:r,onSearchChange:n,changeType:o,onChangeTypeChange:i}}var J2r=C(ee(),1);var wyo=new Set(["all",jR]);function q2r(e){let t=e==="uncommitted",r=wyo.has(e);return{file:t||r,paths:t||r,needsUncommittedFiles:r}}var Nee=C(ee(),1);async function j2r(e,t,r){let n=await Jt(tn(`/api/diff/revert?cwd=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`,r),{method:"POST"});if(n.ok)return;let o=await n.json().catch(()=>({}));throw new Error(typeof o.error=="string"?o.error:"Failed to revert file")}async function BT(e,t,r){let n=await Jt(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),o=await n.json().catch(()=>({}));if(!n.ok)throw new Error(typeof o.error=="string"?o.error:r);return o}async function Y2r(e,t,r){let n=await BT(tn(`/api/diff/revert-all?cwd=${encodeURIComponent(e)}`,r),{paths:t},"Failed to revert files");return Array.isArray(n.failed)?n.failed:[]}function Cyo(e){let t=e.length===1?"file":"files";return`Failed to revert ${e.length} ${t}: ${e.map(r=>`${r.path} (${r.error})`).join(", ")}`}function K2r(e,t,r){let[n,o]=(0,Nee.useState)(null),i=yr(),a=(0,Nee.useCallback)(l=>{j2r(e,l,i).then(r).catch(u=>o(u instanceof Error?u.message:"Failed to revert file"))},[e,i,r]),s=(0,Nee.useCallback)(l=>{Y2r(e,l,i).then(u=>{r(),u.length>0&&o(Cyo(u))}).catch(u=>o(u instanceof Error?u.message:"Failed to revert files"))},[e,i,r]);return{onRevert:t.file?a:void 0,onRevertPaths:t.paths?s:void 0,error:n,clearError:()=>o(null)}}var Z2r=C(ee(),1);function X2r(e){let t=e?.uncommitted??e,r=t?.new??[];return{paths:new Set([...r,...t?.modified??[],...t?.deleted??[]]),newPaths:new Set(r)}}function Q2r(e,t,r){let{counts:n,refresh:o}=Wce(e,t,r);return{files:(0,Z2r.useMemo)(()=>r?X2r(n):void 0,[r,n]),refresh:o}}function eSr(e,t,r,n){let o=q2r(r),i=Q2r(e,t,o.needsUncommittedFiles),a=i.refresh,s=(0,J2r.useCallback)(()=>{n(),a()},[n,a]);return{revert:K2r(e,o,s),uncommittedFiles:i.files}}var k2e=C(ee(),1);var BXe={commits:[],branchBase:null,loaded:!1};function tSr(e,t){let[r,n]=(0,k2e.useState)(BXe),o=yr();return(0,k2e.useEffect)(()=>{if(!e){n(BXe);return}let i=!1;return(async()=>{try{let l=await(await Jt(tn(`/api/diff-scopes?${T8(e,t)}`,o))).json();i||n({commits:l?.commits??[],branchBase:l?.branchBase??null,loaded:!0})}catch(s){Pr(s,"diff scopes"),i||n({...BXe,loaded:!0})}})(),()=>{i=!0}},[e,t,o]),r}function rSr(e,t,r){let{commits:n,branchBase:o,loaded:i}=tSr(e,t);return{scope:r===jR&&i&&!o?"all":r,commits:n,branchBase:o}}var oSr=C(ee(),1);var nSr="assist:diff-tree-hidden";function iSr(){let[e,t]=(0,oSr.useState)(()=>Vl(nSr).length>0);return{treeVisible:!e,onToggleTree:()=>{let r=!e;iu(nSr,r?[!0]:[]),t(r)}}}function aSr(e,t,r,n,o){let i=rSr(e,t,r),{diff:a,loading:s,error:l,refresh:u}=M2r(e,t,i.scope),{revert:d,uncommittedFiles:f}=eSr(e,t,i.scope,u),p=V2r(),h=iSr(),m=$2r(n,t,o),g=I2r(e),{files:y,visibleFiles:v}=W2r({diff:a,error:l,search:p.search,changeType:p.changeType}),b=v.map(T=>Zp(T)),x=P2r(h.treeVisible?b:[]);return{scopeState:i,loading:s,filters:p,treePanel:h,comments:m,collapsedFiles:g,activeFile:x,revert:d,uncommittedFiles:f,collapseAll:_2r(b,g),visibleFiles:v,totals:R2r(v),emptyMessage:E2r(l,y.length)}}var $T=C(P(),1);function _2e({cwd:e,sessionId:t,scope:r,onScopeChange:n,sessions:o,sendInput:i,mode:a,onToggleMode:s,onClose:l,scrollRegionProps:u}){let d=aSr(e,t,r,o,i);return(0,$T.jsxs)($T.Fragment,{children:[(0,$T.jsxs)(Skt,{onClose:l,scrollRegionProps:u,children:[(0,$T.jsx)(D3t,{...d.filters,...d.treePanel,...d.collapseAll,scope:d.scopeState,onScopeChange:n,totals:d.totals,commentHint:d.comments.unavailable,mode:a,onToggleMode:s,onClose:l}),(0,$T.jsx)(w2r,{...Tkt(d,e)})]}),(0,$T.jsx)(k2r,{sentTo:d.comments.sentTo,clearSent:d.comments.clearSent,revertError:d.revert.error,clearRevertError:d.revert.clearError})]})}function sSr(){let[e,t]=al(),{selectedCwd:r}=to();return{cwd:e.get("cwd")||r,sessionId:e.get("session")??void 0,scope:e.get("scope")||"all",setScope:n=>{t(o=>(n==="all"?o.delete("scope"):o.set("scope",n),o),{replace:!0})}}}var $Xe=C(P(),1);function lSr({sessions:e,sendInput:t}){let{cwd:r,sessionId:n,scope:o,setScope:i}=sSr();return(0,$Xe.jsx)(Is,{maxWidth:!1,children:(0,$Xe.jsx)(_2e,{cwd:r,sessionId:n,scope:o,onScopeChange:i,sessions:e,sendInput:t})})}var cSr=C(P(),1);function E2e({defaultTo:e,children:t}){let[r]=al(),{selectedNode:n,worktreeNode:o}=to(),i=e==="worktree"?o:n,a=r.get("cwd")?r.get("node")||void 0:i;return(0,cSr.jsx)(ic.Provider,{value:a,children:t})}var FXe=C(P(),1);function uSr({socket:e}){return(0,FXe.jsx)(E2e,{defaultTo:"selected",children:(0,FXe.jsx)(lSr,{sessions:e.sessions,sendInput:e.sendInput})})}function R2e(e){return e.viewingTranscriptSessionId??e.activeId}var ySr=C(ee(),1);var $ee=C(ee(),1);var zXe="plaintext";function dSr(e,t,r,n){return e.editor.create(t,{value:r.value,language:r.language??zXe,readOnly:r.readOnly??!1,theme:n,automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,renderWhitespace:"selection"})}var Oee=C(ee(),1);var WXe="/monaco.js",UXe="/monaco.css",kyo="/monaco.worker.js",HXe;function fSr(){return globalThis.monaco}function _yo(){return document.querySelector(`link[href="${UXe}"]`)?Promise.resolve():new Promise((e,t)=>{let r=document.createElement("link");r.rel="stylesheet",r.href=UXe,r.addEventListener("load",()=>e()),r.addEventListener("error",()=>t(new Error(`Failed to load ${UXe}`))),document.head.append(r)})}function Eyo(){return new Promise((e,t)=>{let r=document.createElement("script");r.src=WXe,r.addEventListener("load",()=>e()),r.addEventListener("error",()=>t(new Error(`Failed to load ${WXe}`))),document.head.append(r)})}async function Ryo(){globalThis.MonacoEnvironment={getWorker:()=>new Worker(kyo)},await Promise.all([_yo(),Eyo()]);let e=fSr();if(!e)throw new Error(`${WXe} did not register the editor API`);return e}function pSr(){let e=fSr();return e?Promise.resolve(e):(HXe??(HXe=Ryo().catch(t=>{throw HXe=void 0,t})),HXe)}function hSr(){let[e,t]=(0,Oee.useState)(),[r,n]=(0,Oee.useState)(!1);return(0,Oee.useEffect)(()=>{let o=!1;return pSr().then(i=>!o&&t(i),()=>!o&&n(!0)),()=>{o=!0}},[]),{monaco:e,failed:r}}var Bee=C(ee(),1);function mSr(e,t,r,n){(0,Bee.useEffect)(()=>{let o=e.current;o&&o.getValue()!==r.value&&o.setValue(r.value)},[e,t,r.value]),(0,Bee.useEffect)(()=>{let o=e.current?.getModel();t&&o&&t.editor.setModelLanguage(o,r.language??zXe)},[e,t,r.language]),(0,Bee.useEffect)(()=>{t?.editor.setTheme(n)},[t,n]),(0,Bee.useEffect)(()=>{e.current?.updateOptions({readOnly:r.readOnly??!1})},[e,t,r.readOnly])}function gSr(e,t){let{monaco:r,failed:n}=hSr(),o=(0,$ee.useRef)(null),i=Pn().palette.mode==="dark"?"vs-dark":"vs",a=(0,$ee.useRef)({settings:t,theme:i});return a.current={settings:t,theme:i},(0,$ee.useEffect)(()=>{let s=e.current;if(!r||!s)return;let l=dSr(r,s,a.current.settings,a.current.theme);o.current=l;let u=l.onDidChangeModelContent(()=>a.current.settings.onChange?.(l.getValue()));return()=>{o.current=null,u.dispose(),l.getModel()?.dispose(),l.dispose()}},[r,e]),mSr(o,r,t,i),n?"error":r?"ready":"loading"}var GXe=C(P(),1),Pyo=e=>t=>({border:`1px solid ${t.palette.divider}`,borderRadius:1,overflow:"hidden",height:e});function vSr({height:e,...t}){let r=(0,ySr.useRef)(null);return gSr(r,t)==="error"?(0,GXe.jsx)(Ce,{color:"text.secondary",align:"center",sx:{py:6},children:"The editor failed to load."}):(0,GXe.jsx)(G,{ref:r,sx:Pyo(e)})}var bSr="typescript",Ayo={ts:"typescript",mts:"typescript",cts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",json:bSr,jsonc:bSr,css:"css",scss:"scss",less:"less",py:"python",md:"markdown",markdown:"markdown",mdx:"mdx",yml:"yaml",yaml:"yaml",sh:"shell",bash:"shell",zsh:"shell",ps1:"powershell",html:"html",htm:"html",xml:"xml",svg:"xml",sql:"sql",rs:"rust",go:"go",java:"java",kt:"kotlin",cs:"csharp",rb:"ruby",php:"php",c:"cpp",h:"cpp",cpp:"cpp",hpp:"cpp",swift:"swift",dart:"dart",lua:"lua",r:"r",graphql:"graphql",gql:"graphql",dockerfile:"dockerfile",ini:"ini"};function xSr(e){let t=e.split(".").pop()?.toLowerCase();return t?Ayo[t]:void 0}var P2e=C(P(),1),Lyo=`calc(100vh - 152px - ${d1})`;function SSr({path:e,cwd:t,rendered:r,value:n,onChange:o,comments:i}){return r?(0,P2e.jsx)(a2e,{path:e,cwd:t,source:n,onComment:i.onComment,onAddRule:i.onAddRule,unavailable:i.unavailable,children:(0,P2e.jsx)(i4,{content:n,renderMermaid:!0,wide:!0})}):(0,P2e.jsx)(vSr,{value:n,language:xSr(e),height:Lyo,onChange:o})}var TSr=C(P(),1),A2e=nt((0,TSr.jsx)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m-4 10h2v-2h-2v-2h2v-2h-2V8h4v10h-4zm0 0h-2v2H4V6h5.17l2 2H14v2h2v2h-2v2h2z"}),"FolderZipOutlined");var wSr=C(P(),1),m4=nt((0,wSr.jsx)("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-4.86 8.86-3 3.87L9 13.14 6 17h12z"}),"ImageOutlined");var CSr=C(P(),1),kSr=nt((0,CSr.jsx)("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zM6 20V4h7v5h5v11z"}),"InsertDriveFileOutlined");var _Sr=C(P(),1),ESr=nt((0,_Sr.jsx)("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m0 14H8V4h12zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4zm12 6V9c0-.55-.45-1-1-1h-2v5h2c.55 0 1-.45 1-1m-2-3h1v3h-1zm4 2h1v-1h-1V9h1V8h-2v5h1zm-8 0h1c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1H9v5h1zm0-2h1v1h-1z"}),"PictureAsPdfOutlined");var RSr=C(P(),1),PSr=nt((0,RSr.jsx)("path",{d:"M2 20h20v-4H2zm2-3h2v2H4zM2 4v4h20V4zm4 3H4V5h2zm-4 7h20v-4H2zm2-3h2v2H4z"}),"StorageOutlined");var FTr=C(LSr(),1),_Ze=C(DSr(),1),zTr=C(OSr(),1),UTr=C($Sr(),1),HTr=C(zSr(),1),WTr=C(HSr(),1),GTr=C(GSr(),1),VTr=C(qSr(),1),qTr=C(YSr(),1),jTr=C(XSr(),1),YTr=C(QSr(),1),KTr=C(eTr(),1),XTr=C(rTr(),1),ZTr=C(oTr(),1),QTr=C(aTr(),1),JTr=C(lTr(),1),ewr=C(uTr(),1),twr=C(fTr(),1),rwr=C(mTr(),1),nwr=C(vTr(),1),owr=C(xTr(),1),iwr=C(TTr(),1),awr=C(CTr(),1),swr=C(_Tr(),1),lwr=C(RTr(),1),cwr=C(ATr(),1);var nH=Gl.fileType,LTr={Icon:FTr.default,unpaintedFill:nH.bash},TZe={Icon:zTr.default},ITr={Icon:UTr.default},MTr={Icon:VTr.default},wZe={Icon:jTr.default},DTr={Icon:YTr.default,unpaintedFill:nH.json},NTr={Icon:KTr.default},CZe={Icon:XTr.default,unpaintedFill:nH.markdown},OTr={Icon:ewr.default},BTr={Icon:nwr.default},kZe={Icon:awr.default},Iyo={Icon:lwr.default,unpaintedFill:nH.xml},$Tr={Icon:cwr.default,unpaintedFill:nH.yaml},uwr=e=>Myo[e],Myo={c:{Icon:_Ze.default},cc:TZe,cjs:wZe,cpp:TZe,cs:{Icon:HTr.default},css:ITr,cts:kZe,dockerfile:{Icon:WTr.default},go:{Icon:GTr.default},h:{Icon:_Ze.default},hpp:TZe,htm:MTr,html:MTr,java:{Icon:qTr.default},js:wZe,json:DTr,jsonc:DTr,jsx:OTr,kt:NTr,kts:NTr,less:ITr,markdown:CZe,md:CZe,mdx:CZe,mjs:wZe,mts:kZe,php:{Icon:ZTr.default},ps1:{Icon:QTr.default},py:{Icon:JTr.default},rb:{Icon:twr.default},rs:{Icon:rwr.default,unpaintedFill:nH.rust},sass:BTr,scss:BTr,sh:LTr,swift:{Icon:owr.default},tf:{Icon:iwr.default},ts:kZe,tsx:OTr,vue:{Icon:swr.default},xml:Iyo,yaml:$Tr,yml:$Tr,zsh:LTr};var N2e=C(P(),1),O2e=16,Dyo={gif:m4,gz:A2e,ico:m4,jpeg:m4,jpg:m4,pdf:ESr,png:m4,sql:PSr,svg:m4,tar:A2e,webp:m4,zip:A2e},Nyo={width:O2e,height:O2e,flexShrink:0,display:"flex",alignItems:"center"},Oyo={fontSize:O2e,color:"text.secondary"};function Byo(e){let t=e.slice(e.lastIndexOf("/")+1).toLowerCase(),r=t.lastIndexOf(".");return r<=0?t:t.slice(r+1)}function B2e({path:e}){let t=Byo(e),r=uwr(t),n=Dyo[t]??kSr;return(0,N2e.jsx)(G,{sx:Nyo,children:r?(0,N2e.jsx)(r.Icon,{size:O2e,fill:r.unpaintedFill}):(0,N2e.jsx)(n,{sx:Oyo})})}var dwr=C(P(),1),fwr=nt((0,dwr.jsx)("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"}),"Save");var zT=C(P(),1),$yo={display:"flex",alignItems:"center",gap:1,flexShrink:0};function pwr({mode:e,onModeChange:t,onSave:r,saving:n,dirty:o}){let i=fo("save").chords;return(0,zT.jsxs)(G,{sx:$yo,children:[e&&(0,zT.jsxs)(Dc,{exclusive:!0,size:"small",value:e,onChange:(a,s)=>s&&t(s),children:[(0,zT.jsx)(ms,{value:"raw",children:"Raw"}),(0,zT.jsx)(ms,{value:"rendered",children:"Rendered"})]}),(0,zT.jsx)(ht,{size:"small",variant:"outlined",startIcon:(0,zT.jsx)(fwr,{sx:{fontSize:16}}),onClick:r,disabled:n||!o,title:`Save (${zce(i[0])})`,children:"Save"}),(0,zT.jsx)(Ude,{})]})}var _L=C(P(),1),Fyo={display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,mb:1},zyo={fontFamily:"fontFamilyMono",fontSize:13},Uyo={display:"flex",alignItems:"center",gap:1,minWidth:0};function hwr({path:e,mode:t,onModeChange:r,onSave:n,saving:o,dirty:i}){return(0,_L.jsxs)(G,{sx:Fyo,children:[(0,_L.jsxs)(G,{sx:Uyo,children:[(0,_L.jsx)(B2e,{path:e}),(0,_L.jsx)(Ce,{color:"text.secondary",sx:zyo,children:e})]}),(0,_L.jsx)(pwr,{mode:t,onModeChange:r,onSave:n,saving:o,dirty:i})]})}function mwr(e,t,r){return r?t?e==="absent"?"This file is not in the working tree.":e==="too-large"?"This file is too large to display (over 2 MB).":"Couldn't load this file.":"No file path given.":"Select a repo to view files."}var gwr=C(ee(),1);var vwr=C(P(),1);function ywr({dirty:e}){let t=G6e(e);return(0,gwr.useEffect)(()=>{if(!e)return;let r=n=>n.preventDefault();return globalThis.addEventListener("beforeunload",r),()=>globalThis.removeEventListener("beforeunload",r)},[e]),t.state!=="blocked"?null:(0,vwr.jsx)(Ho,{title:"Discard unsaved changes?",message:"This file has unsaved changes that will be lost.",confirmLabel:"Discard",onConfirm:()=>t.proceed(),onCancel:()=>t.reset()})}var _wr=C(ee(),1);var g4=C(ee(),1);async function bwr({cwd:e,node:t,path:r,content:n,mtimeMs:o}){let i=await BT(tn(`/api/file?cwd=${encodeURIComponent(e)}&path=${encodeURIComponent(r)}`,t),{content:n,mtimeMs:o},"Failed to save file");if(typeof i.content!="string")throw new Error("The server returned no file content");return{content:i.content,mtimeMs:typeof i.mtimeMs=="number"?i.mtimeMs:o}}var F2e=C(ee(),1);function $2e(e){return e.status==="ready"?{content:e.content,mtimeMs:e.mtimeMs}:{content:"",mtimeMs:0}}function xwr(e){let[t,r]=(0,F2e.useState)(e),[n,o]=(0,F2e.useState)(()=>$2e(e)),[i,a]=(0,F2e.useState)(()=>$2e(e).content);if(t!==e){let s=$2e(e);r(e),o(s),a(s.content)}return{saved:n,setSaved:o,value:i,setValue:a}}function Hyo(e){return e instanceof Error?e.message:"Failed to save file"}function Swr(e,t,r){let{saved:n,setSaved:o,value:i,setValue:a}=xwr(r),[s,l]=(0,g4.useState)(!1),[u,d]=(0,g4.useState)(null),f=(0,g4.useRef)(i),p=yr();f.current=i;let h=r.status==="ready"&&i!==n.content,m=(0,g4.useCallback)(()=>{!e||!h||s||(l(!0),bwr({cwd:e,node:p,path:t,content:f.current,mtimeMs:n.mtimeMs}).then(y=>{o(y),a(y.content)}).catch(y=>d(Hyo(y))).finally(()=>l(!1)))},[e,p,t,h,s,n.mtimeMs,o,a]),g=(0,g4.useCallback)(()=>d(null),[]);return{value:i,setValue:a,save:m,saving:s,dirty:h,error:u,clearError:g}}var wwr=C(ee(),1);function Twr(e,t){return t?p4(e.find(r=>r.id===t)):{unavailable:"Select a session card to comment on this file."}}function Cwr(e,t,r){let[n,o]=(0,wwr.useState)(null),{session:i,unavailable:a}=Twr(e,t),s=()=>o(i?.name??null);return{onComment:i?w2e(i,r,s):void 0,onAddRule:i?x2e(i,r,s):void 0,unavailable:a,sentTo:n,clearSent:()=>o(null)}}function kwr(e){Zi(fo("save").matches,e)}function Ewr(e,t,r){let[n]=al(),o=n.get("path")??"",{worktreeCwd:i}=to(),a=n.get("cwd")||i,s=l2e(a,o),l=Swr(a,o,s),u=Cwr(e,t,r),[d,f]=(0,_wr.useState)("raw");return kwr(l.save),{path:o,cwd:a,state:s,buffer:l,comments:u,isMarkdown:Fde(o)==="markdown",mode:d,setMode:f}}var y4=C(P(),1);function Rwr({sessions:e,sendInput:t,cardId:r}){let{path:n,cwd:o,state:i,buffer:a,comments:s,isMarkdown:l,mode:u,setMode:d}=Ewr(e,r,t);return(0,y4.jsxs)(Is,{loading:i.status==="loading"&&!!(o&&n),isEmpty:i.status!=="ready",emptyMessage:mwr(i.status,n,o),maxWidth:!1,children:[(0,y4.jsx)(hwr,{path:n,mode:l?u:void 0,onModeChange:d,onSave:a.save,saving:a.saving,dirty:a.dirty}),i.status==="ready"&&(0,y4.jsx)(SSr,{path:n,cwd:o,rendered:l&&u==="rendered",value:a.value,onChange:a.setValue,comments:s}),(0,y4.jsx)(ywr,{dirty:a.dirty}),(0,y4.jsx)(kl,{error:a.error,onClose:a.clearError}),(0,y4.jsx)(d4,{sessionName:s.sentTo,onClose:s.clearSent})]})}var EZe=C(P(),1);function Pwr({socket:e}){return(0,EZe.jsx)(E2e,{defaultTo:"worktree",children:(0,EZe.jsx)(Rwr,{sessions:e.sessions,sendInput:e.sendInput,cardId:R2e(e)})})}var Xwr=C(ee(),1);var Awr=C(P(),1),oH=nt((0,Awr.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");function ma(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(1)}k`:`${(e/1e6).toFixed(1)}M`}function z2e(e){return`$${e.toFixed(2)}`}function Lwr(e){return e.input+e.output+e.cacheRead+(e.cacheWrite??0)}function U2e(e){let t=`${ma(Lwr(e))} tokens`;return e.costUsd===null?t:`${t} \xB7 ${z2e(e.costUsd)}`}function Iwr(e){if(!e)return"";if(e.scanning)return"Scanning Gmail and Slack\u2026";let t=e.lastScanAt?`Last scanned ${xo(e.lastScanAt)}`:"Never scanned",r=e.run?.status==="finished"&&e.run.usage?` \xB7 ${U2e(e.run.usage)}`:"",n=e.intervalMinutes?`scans every ${e.intervalMinutes} min`:"scheduled scans off";return`${t}${r} \xB7 ${n}`}var H2e,EL,Wee,RZe=new Set;function W2e(){for(let e of RZe)e()}function PZe(e){H2e=e,W2e()}function Mwr(e){EL=e,W2e()}async function Dwr(){try{let e=await Jt("/api/inbox"),t=await e.json();e.ok&&Array.isArray(t)&&PZe(t)}catch(e){Pr(e,"inbox refresh"),H2e===void 0&&PZe([])}}async function Nwr(){try{let e=await Jt("/api/inbox/status"),t=await e.json().catch(()=>({}));if(e.ok){Wee=void 0,Mwr(t);return}Wee=`Couldn't read scan status: ${t.error??`HTTP ${e.status}`}`}catch(e){Wee=`Couldn't read scan status: ${String(e)}`}W2e()}async function Wyo(e){PZe((H2e??[]).filter(t=>t.id!==e));try{await BT(`/api/inbox/${encodeURIComponent(e)}/dismiss`,{},"Failed to dismiss message")}finally{await Dwr()}}async function Gyo(){EL&&Mwr({...EL,scanning:!0,lastError:null});try{await BT("/api/inbox/scan",{},"Failed to start inbox scan")}catch(e){Wee=e instanceof Error?e.message:String(e),EL&&(EL={...EL,scanning:!1}),W2e();return}await Nwr()}var qs={get:()=>H2e,getStatus:()=>EL,getStatusError:()=>Wee,refresh:Dwr,refreshStatus:Nwr,dismiss:Wyo,scan:Gyo,subscribe(e){return RZe.add(e),()=>RZe.delete(e)}};var Owr=C(ee(),1);function G2e(){return(0,Owr.useSyncExternalStore)(qs.subscribe,qs.getStatus)}var Bwr=C(ee(),1);function $wr(){return(0,Bwr.useSyncExternalStore)(qs.subscribe,qs.getStatusError)}var Ky=C(P(),1);function Fwr(){let e=G2e(),t=$wr(),r=e?.scanning===!0,n=t??(e?.lastError&&!r?`Last scan failed: ${e.lastError}`:void 0);return(0,Ky.jsxs)(G,{sx:{display:"flex",alignItems:"flex-end",gap:2,flexWrap:"wrap",mb:3},children:[(0,Ky.jsxs)(G,{sx:{flex:"1 1 auto"},children:[(0,Ky.jsx)(Ce,{variant:"h5",component:"h1",children:"Inbox"}),(0,Ky.jsx)(Ce,{variant:"body2",color:"text.secondary",children:Iwr(e)}),n&&(0,Ky.jsx)(Ce,{variant:"body2",color:"error",children:n})]}),(0,Ky.jsx)(sr,{title:r?"A scan is already running":"",children:(0,Ky.jsx)("span",{children:(0,Ky.jsx)(ht,{variant:"outlined",size:"small",startIcon:(0,Ky.jsx)(oH,{}),disabled:r,onClick:()=>{qs.scan()},children:r?"Scanning\u2026":"Scan now"})})})]})}var Xy=C(P(),1),Vyo={display:"flex",alignItems:"flex-start",gap:1,bgcolor:"background.paper",borderRadius:2,p:2.5,transition:"background-color 0.15s","&:hover":{bgcolor:"action.hover"}},qyo={color:"text.disabled","&:hover":{color:"text.primary"}};function zwr({message:e,onDismiss:t}){return(0,Xy.jsxs)(G,{sx:Vyo,children:[(0,Xy.jsxs)(Qr,{href:e.link,target:"_blank",rel:"noopener noreferrer",underline:"none",color:"inherit",sx:{flex:1,minWidth:0},children:[(0,Xy.jsxs)(G,{sx:{display:"flex",alignItems:"center",gap:1,mb:.75},children:[(0,Xy.jsx)(Vn,{label:e.source,size:"small"}),(0,Xy.jsx)(Ce,{variant:"subtitle2",children:e.sender}),(0,Xy.jsx)(Ce,{variant:"body2",color:"text.secondary",children:xo(e.receivedAt)})]}),(0,Xy.jsx)(Ce,{variant:"body2",children:e.summary})]}),(0,Xy.jsx)(jt,{size:"small",onClick:t,title:`Dismiss message from ${e.sender}`,sx:qyo,children:(0,Xy.jsx)(Uo,{sx:{fontSize:16}})})]})}function iH(e){let t=Math.floor(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}var Hwr=C(P(),1);function Uwr({tokens:e}){return(0,Hwr.jsx)(Ce,{component:"span",sx:{fontSize:"inherit",fontFamily:"fontFamilyMono",display:{xs:"none",sm:"inline"}},color:"text.disabled",noWrap:!0,children:e===void 0?"":ma(e)})}var RL=C(P(),1),jyo={tool:"info.main",text:"text.secondary",result:"success.main",error:"error.main"},Yyo={display:"grid",gridTemplateColumns:{xs:"3.5em 9em 1fr",sm:"3.5em 9em 1fr auto"},gap:1,py:.5,typography:"caption",alignItems:"baseline"};function Wwr({event:e,startedAt:t}){let r=Date.parse(e.at)-Date.parse(t);return(0,RL.jsxs)(G,{sx:Yyo,children:[(0,RL.jsx)(Ce,{component:"span",sx:{fontSize:"inherit",fontFamily:"fontFamilyMono"},color:"text.disabled",children:iH(Math.max(0,r))}),(0,RL.jsx)(Ce,{component:"span",sx:{fontSize:"inherit",fontWeight:600,color:jyo[e.kind]},noWrap:!0,children:e.label}),(0,RL.jsx)(Ce,{component:"span",sx:{fontSize:"inherit",fontFamily:e.kind==="tool"?"fontFamilyMono":void 0,color:e.kind==="error"?"error.main":"text.primary",overflowWrap:"anywhere",whiteSpace:"pre-wrap"},children:e.detail}),(0,RL.jsx)(Uwr,{tokens:e.tokens})]})}function V2e(e,t){let[r,n]=t.split(".");return e.palette[r]?.[n]??t}function Ub(e){return t=>{let r=V2e(t,e);return{display:"inline-flex",alignItems:"center",gap:"5px",flexShrink:0,px:1,lineHeight:"18px",borderRadius:999,fontSize:11,fontWeight:600,whiteSpace:"nowrap",color:r,bgcolor:Vr(r,.15)}}}var q2e=C(ee(),1);function j2e(e){let[t,r]=(0,q2e.useState)(()=>Date.now()),n=e.status==="scanning";(0,q2e.useEffect)(()=>{if(!n)return;let i=setInterval(()=>r(Date.now()),1e3);return()=>clearInterval(i)},[n]);let o=e.finishedAt?Date.parse(e.finishedAt):t;return Math.max(0,o-Date.parse(e.startedAt))}var Hb=C(P(),1),Kyo={scanning:{label:"Scanning",color:"info.main"},finished:{label:"Finished",color:"success.main"},failed:{label:"Failed",color:"error.main"}},Xyo={display:"flex",alignItems:"center",gap:1,width:"100%",px:2,py:1.25,justifyContent:"flex-start",textAlign:"left"};function Gwr({run:e,open:t,onToggle:r}){let n=j2e(e),{label:o,color:i}=Kyo[e.status];return(0,Hb.jsxs)(nr,{sx:Xyo,onClick:r,"aria-expanded":t,children:[(0,Hb.jsx)(ba,{fontSize:"small",sx:{color:"text.secondary",transform:t?"none":"rotate(-90deg)",transition:"transform 0.15s"}}),(0,Hb.jsx)(Ce,{variant:"subtitle2",children:"Scan activity"}),(0,Hb.jsx)(G,{component:"span",sx:Ub(i),children:o}),(0,Hb.jsxs)(Ce,{variant:"caption",color:"text.secondary",sx:{ml:"auto",fontFamily:"fontFamilyMono"},children:[e.usage&&(0,Hb.jsxs)(Hb.Fragment,{children:[U2e(e.usage),e.status==="scanning"?" so far":""," \xB7 "]}),iH(n)]})]})}function Vwr(){return{input:0,output:0,cacheRead:0,cacheWrite:0,costUsd:null,durationMs:null}}var i0=C(P(),1),Zyo={display:"grid",gridTemplateColumns:{xs:"repeat(3, minmax(0, 1fr))",sm:"repeat(6, minmax(0, 1fr))"},borderTop:1,borderBottom:1,borderColor:"divider"};function aH({label:e,value:t}){return(0,i0.jsxs)(G,{sx:{px:2,py:1.25,minWidth:0},children:[(0,i0.jsx)(Ce,{variant:"caption",color:"text.secondary",sx:{display:"block",textTransform:"uppercase"},children:e}),(0,i0.jsx)(Ce,{variant:"body1",sx:{fontFamily:"fontFamilyMono"},color:t===null?"text.disabled":"text.primary",noWrap:!0,children:t??"pending"})]})}function qwr({run:e}){let t=j2e(e),r=e.usage??Vwr(),n=o=>o.toLocaleString();return(0,i0.jsxs)(G,{sx:Zyo,children:[(0,i0.jsx)(aH,{label:"Input",value:n(r.input)}),(0,i0.jsx)(aH,{label:"Output",value:n(r.output)}),(0,i0.jsx)(aH,{label:"Cache read",value:n(r.cacheRead)}),(0,i0.jsx)(aH,{label:"Cache write",value:n(r.cacheWrite)}),(0,i0.jsx)(aH,{label:"Cost",value:r.costUsd===null?null:z2e(r.costUsd)}),(0,i0.jsx)(aH,{label:"Duration",value:iH(r.durationMs??t)})]})}var Y2e=C(ee(),1);function jwr(e){let[t,r]=(0,Y2e.useState)(e.status==="scanning"),n=e.status==="scanning"?e.startedAt:void 0;return(0,Y2e.useEffect)(()=>{n&&r(!0)},[n]),[t,r]}var Wb=C(P(),1),Qyo={bgcolor:"background.paper",borderRadius:2,mb:3};function Jyo({run:e}){let[t,r]=jwr(e);return(0,Wb.jsxs)(G,{sx:Qyo,children:[(0,Wb.jsx)(Gwr,{run:e,open:t,onToggle:()=>r(!t)}),(0,Wb.jsxs)(Hv,{in:t,unmountOnExit:!0,children:[(0,Wb.jsx)(qwr,{run:e}),(0,Wb.jsx)(G,{sx:{px:2,py:1,maxHeight:360,overflowY:"auto"},children:e.events.length===0?(0,Wb.jsx)(Ce,{variant:"caption",color:"text.secondary",children:"Waiting for the first tool call\u2026"}):e.events.map((n,o)=>(0,Wb.jsx)(Wwr,{event:n,startedAt:e.startedAt},`${n.at}-${o}`))})]})]})}function Ywr(){let e=G2e()?.run;return e?(0,Wb.jsx)(Jyo,{run:e}):null}var Kwr=C(ee(),1);function K2e(){return(0,Kwr.useSyncExternalStore)(qs.subscribe,qs.get)}var Gb=C(P(),1);function Zwr(){let e=K2e();return(0,Xwr.useEffect)(()=>{qs.refresh(),qs.refreshStatus()},[]),(0,Gb.jsx)(Is,{loading:e===void 0,header:(0,Gb.jsxs)(Gb.Fragment,{children:[(0,Gb.jsx)(Fwr,{}),(0,Gb.jsx)(Ywr,{})]}),isEmpty:e?.length===0,emptyMessage:"No messages need a reply.",children:(0,Gb.jsx)(kt,{spacing:1,children:e?.map(t=>(0,Gb.jsx)(zwr,{message:t,onDismiss:()=>{qs.dismiss(t.id)}},t.id))})})}var Gee=C(ee(),1);var AZe=C(P(),1);function Qwr(){return(0,AZe.jsx)(G,{sx:{display:"flex",justifyContent:"flex-end",mb:2},children:(0,AZe.jsx)(Qr,{component:da,to:"/config?search=news",underline:"hover",variant:"body2",children:"News settings"})})}function Jwr(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return"just now";let r=Math.floor(t/60);if(r<60)return`${r}m ago`;let n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}var UT=C(P(),1),evo={display:"block",bgcolor:"background.paper",borderRadius:2,p:2.5,transition:"background-color 0.15s","&:hover":{bgcolor:"action.hover"}},tvo={width:16,height:16};function eCr({item:e}){return(0,UT.jsxs)(Qr,{href:e.link,target:"_blank",rel:"noopener noreferrer",underline:"none",color:"inherit",sx:evo,children:[(0,UT.jsxs)(G,{sx:{display:"flex",alignItems:"center",gap:1,mb:.75},children:[(0,UT.jsx)(U3e,{src:`${e.feedOrigin}/favicon.ico`,variant:"rounded",sx:tvo,children:" "}),(0,UT.jsx)(Vn,{label:e.feedTitle,size:"small"}),(0,UT.jsx)(Ce,{variant:"body2",color:"text.secondary",children:Jwr(e.pubDate)})]}),(0,UT.jsx)(Ce,{variant:"h6",sx:{fontWeight:500,lineHeight:1.3},children:e.title}),e.excerpt&&(0,UT.jsx)(Ce,{variant:"body2",color:"text.secondary",sx:{mt:.75},children:e.excerpt})]})}function rvo(e){let t=new Date(e),r=new Date;return t.toLocaleDateString("en-US",{weekday:"long",month:"short",day:"numeric",year:t.getFullYear()!==r.getFullYear()?"numeric":void 0})}function nvo(e){return new Date(e).toISOString().slice(0,10)}function tCr(e){let t=new Map;for(let r of e){let n=nvo(r.pubDate),o=t.get(n);o?o.items.push(r):t.set(n,{label:rvo(r.pubDate),items:[r]})}return[...t.values()]}var v4=C(P(),1);async function ovo(){return(await Jt("/api/news/items")).json()}function rCr(){let[e,t]=(0,Gee.useState)([]),[r,n]=(0,Gee.useState)(!0);return(0,Gee.useEffect)(()=>{ovo().then(o=>t(tCr(o))).finally(()=>n(!1))},[]),(0,v4.jsx)(Is,{loading:r,isEmpty:e.length===0,emptyMessage:"No news items.",header:(0,v4.jsx)(Qwr,{}),children:e.map(o=>(0,v4.jsxs)(G,{sx:{mb:4},children:[(0,v4.jsx)(Ce,{variant:"overline",color:"text.secondary",sx:{display:"block",mb:1,px:.5},children:o.label}),(0,v4.jsx)(kt,{spacing:1,children:o.items.map(i=>(0,v4.jsx)(eCr,{item:i},`${i.link}-${i.pubDate}`))})]},o.label))})}function X2e(e){let t=e.peerPrs.items[0];if(t)return{kind:"pr",item:t};let r=e.assignedIssues.items[0];if(r)return{kind:"issue",item:r};let n=e.pickups.items[0];if(n)return{kind:"pickup",item:n};let o=e.myPrs.items[0];return o?{kind:"mine",item:o}:null}var a0={review:{label:"Review",color:"primary"},mine:{label:"Yours",color:"info"},assigned:{label:"Assigned",color:"secondary"},pickup:{label:"Pick up",color:"success"}};var Vee=C(P(),1);function nCr(){return(0,Vee.jsxs)(Zr,{variant:"outlined",sx:{p:4,textAlign:"center"},children:[(0,Vee.jsx)(Ce,{variant:"h6",component:"h2",children:"Nothing needs you here"}),(0,Vee.jsx)(Ce,{sx:{color:"text.secondary"},children:"No peer PRs await your review, no issues are assigned to you and no project items are ready to pick up."})]})}function oCr({peerPrs:e,myPrs:t,assignedIssues:r,pickups:n}){return[e,t,r,n].every(o=>o.items.length===0&&!o.error)}var iCr=C(P(),1);function Z2e({chip:e}){return(0,iCr.jsx)(Vn,{label:e.label,size:"small",color:e.color,variant:"tonal"})}var HT=C(P(),1),ivo={fontSize:14,fontWeight:600},avo=e=>({color:"text.disabled",fontFamily:e.typography.fontFamilyMono,fontSize:12});function qee({chip:e,title:t,count:r,error:n,rows:o}){return o.length===0&&!n?null:(0,HT.jsxs)(kt,{spacing:1,component:"section",children:[(0,HT.jsxs)(kt,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,HT.jsx)(Z2e,{chip:e}),(0,HT.jsx)(Ce,{variant:"subtitle2",component:"h3",sx:ivo,children:t}),(0,HT.jsx)(Ce,{variant:"body2",sx:avo,children:r})]}),n&&(0,HT.jsx)(no,{severity:"error",sx:{whiteSpace:"pre-line"},children:n}),o.length>0&&(0,HT.jsx)(Zr,{variant:"outlined",sx:{overflow:"hidden"},children:o})]})}var aCr="github.com/";function Q2e(e){let t=(e.remoteOrigin??e.repoGroup?.origin)?.toLowerCase();return t?.startsWith(aCr)?t.slice(aCr.length):void 0}function J2e(e,t,r){let n=t.toLowerCase();return e.filter(o=>i1(o)===r&&Q2e(o)===n)}var sH=C(P(),1),svo={success:{label:"checks passing",color:"success.main"},failure:{label:"checks failing",color:"error.main"},pending:{label:"checks running",color:"warning.main"}};function lH({pr:e}){let t=e.checks?svo[e.checks]:null,r=e.reason==="requested"?`review requested ${xo(e.requestedAt)}`:`opened ${xo(e.createdAt)}`;return(0,sH.jsxs)(kt,{direction:"row",spacing:1.5,useFlexGap:!0,sx:{flexWrap:"wrap",color:"text.secondary"},children:[(0,sH.jsx)(Ce,{variant:"body2",children:e.author}),(0,sH.jsx)(Ce,{variant:"body2",children:r}),t&&(0,sH.jsx)(Ce,{variant:"body2",sx:{color:t.color},children:t.label})]})}var eSe=C(ee(),1),LZe=(0,eSe.createContext)({sessions:[],trackedIssues:new Map,activate:()=>{}});function b4(){return(0,eSe.useContext)(LZe)}var sCr=C(P(),1),tSe=nt((0,sCr.jsx)("path",{d:"M20 4H4c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2m0 14H4V8h16zm-2-1h-6v-2h6zM7.5 17l-1.41-1.41L8.67 13l-2.59-2.59L7.5 9l4 4z"}),"Terminal");var rSe=C(P(),1);function lCr({sessions:e,size:t}){let{activate:r}=b4();return e.map(n=>(0,rSe.jsxs)(ht,{variant:"contained",size:t,startIcon:(0,rSe.jsx)(tSe,{}),onClick:()=>r(n.id),children:["Session ",n.id]},n.id))}function cCr(e){return e==="medium"?{start:"contained",link:"tonal"}:{start:"tonal",link:"text"}}var dCr=C(P(),1);function uCr({url:e,variant:t,size:r}){return(0,dCr.jsx)(ht,{variant:t,size:r,href:e,target:"_blank",rel:"noopener noreferrer",children:"GitHub \u2197"})}var nSe=C(ee(),1),IZe=(0,nSe.createContext)(()=>{});function fCr(){return(0,nSe.useContext)(IZe)}var WT=C(P(),1);function oSe({repo:e,url:t,onStart:r,sessions:n=[],size:o="small"}){let i=fCr()(e),a=cCr(o);return(0,WT.jsxs)(kt,{direction:"row",spacing:1,useFlexGap:!0,sx:{flexShrink:0,flexWrap:"wrap"},children:[(0,WT.jsx)(lCr,{sessions:n,size:o}),(0,WT.jsx)(sr,{title:i?"":`No local clone of ${e} to start a session in`,children:(0,WT.jsx)("span",{children:(0,WT.jsx)(ht,{variant:a.start,size:o,startIcon:(0,WT.jsx)(sy,{}),disabled:!i,onClick:()=>i&&r(i),children:"Start session"})})}),(0,WT.jsx)(uCr,{url:t,variant:a.link,size:o})]})}var pCr=C(P(),1),lvo={fontFamily:"fontFamilyMono",whiteSpace:"nowrap",fontSize:12,fontWeight:400,color:"text.disabled"};function iSe({repo:e,number:t}){return(0,pCr.jsxs)(Ce,{variant:"body2",sx:lvo,children:[e,"#",t]})}var x4=C(P(),1),cvo=e=>({px:"14px",py:"10px",alignItems:{sm:"center"},transition:"background-color .2s ease","&:hover":{bgcolor:e.tokens.color.raised},"& + &":{borderTop:1,borderColor:e.tokens.color.lineSoft}}),uvo={fontWeight:600,fontSize:14,overflowWrap:"anywhere"};function aSe({repo:e,number:t,title:r,facts:n,url:o,onStart:i,sessions:a}){return(0,x4.jsxs)(kt,{direction:{xs:"column",sm:"row"},spacing:1,sx:cvo,children:[(0,x4.jsxs)(kt,{spacing:.25,sx:{flex:1,minWidth:0},children:[(0,x4.jsxs)(kt,{direction:"row",spacing:1,useFlexGap:!0,sx:{alignItems:"baseline",flexWrap:"wrap"},children:[(0,x4.jsx)(iSe,{repo:e,number:t}),(0,x4.jsx)(Ce,{sx:uvo,children:r})]}),n]}),(0,x4.jsx)(oSe,{repo:e,url:o,onStart:i,sessions:a})]})}var sSe=C(P(),1);function MZe({chip:e,title:t,section:r,hiddenUrl:n,onStart:o}){let{sessions:i}=b4();return(0,sSe.jsx)(qee,{chip:e,title:t,count:r.items.length,error:r.error,rows:r.items.filter(a=>a.url!==n).map(a=>(0,sSe.jsx)(aSe,{repo:a.repo,number:a.number,title:a.title,facts:(0,sSe.jsx)(lH,{pr:a}),url:a.url,onStart:s=>o(a,s),sessions:J2e(i,a.repo,a.number)},a.url))})}function lSe(e,t,r,n){let o=r.toLowerCase(),i=`${o}#${n}`;return e.filter(a=>Q2e(a)===o&&(a.promptIssue?.toLowerCase()===i||t.get(a.id)?.toLowerCase()===i))}var gCr=C(P(),1),hCr=Gl.issueType;function mCr({type:e}){let t=hCr[e.color]??hCr.GRAY;return(0,gCr.jsx)(Vn,{label:e.name,size:"small",variant:"outlined",sx:r=>{let n=r.palette.mode==="dark"?t.dark:t.light;return{color:n,borderColor:n,height:20}}})}var GT=C(P(),1);function cH({issue:e}){let t="status"in e?e:null;return(0,GT.jsxs)(kt,{direction:"row",spacing:1.5,useFlexGap:!0,sx:{flexWrap:"wrap",color:"text.secondary",alignItems:"center"},children:[t?.type&&(0,GT.jsx)(mCr,{type:t.type}),t&&(0,GT.jsxs)(Ce,{variant:"body2",children:[t.projectTitle," \xB7 ",t.status]}),t?.priority&&(0,GT.jsx)(Ce,{variant:"body2",children:t.priority}),(0,GT.jsx)(Ce,{variant:"body2",children:e.author}),(0,GT.jsxs)(Ce,{variant:"body2",children:["opened ",xo(e.createdAt)]}),e.labels.length>0&&(0,GT.jsx)(Ce,{variant:"body2",children:e.labels.join(", ")})]})}var DZe=C(P(),1);function NZe(e,t,r,{sessions:n,trackedIssues:o}){return e.filter(i=>i.url!==t).map(i=>(0,DZe.jsx)(aSe,{repo:i.repo,number:i.number,title:i.title,facts:(0,DZe.jsx)(cH,{issue:i}),url:i.url,onStart:a=>r(i,a),sessions:lSe(n,o,i.repo,i.number)},i.url))}var Vb=C(P(),1);function yCr({data:e,onStartPr:t,onStartIssue:r,onStartPickup:n}){let o=b4(),{peerPrs:i,myPrs:a,assignedIssues:s,pickups:l}=e;if(oCr(e))return(0,Vb.jsx)(nCr,{});let u=X2e(e)?.item.url;return(0,Vb.jsxs)(Vb.Fragment,{children:[(0,Vb.jsx)(MZe,{chip:a0.review,title:"Peer PRs awaiting your review",section:i,hiddenUrl:u,onStart:t}),(0,Vb.jsx)(MZe,{chip:a0.mine,title:"Your open PRs",section:a,hiddenUrl:u,onStart:t}),(0,Vb.jsx)(qee,{chip:a0.assigned,title:"Issues assigned to you",count:s.items.length,error:s.error,rows:NZe(s.items,u,r,o)}),(0,Vb.jsx)(qee,{chip:a0.pickup,title:"Project items to pick up",count:l.items.length,error:l.error,rows:NZe(l.items,u,n,o)})]})}var vCr=C(ee(),1),cSe=C(P(),1);function bCr({lines:e}){return(0,cSe.jsx)(Ce,{sx:{m:0,fontSize:12.5,color:"text.secondary"},children:e.map((t,r)=>(0,cSe.jsxs)(vCr.Fragment,{children:[r>0&&" \xB7 ",t]},t.key))})}var PL=C(P(),1),dvo=e=>({fontFamily:e.typography.fontFamilyMono,fontSize:11.5,color:"text.primary"});function uSe({label:e,value:t,unset:r,setter:n,showSetter:o}){return(0,PL.jsxs)(Ce,{variant:"body2",component:"span",sx:{color:"text.secondary",fontSize:"inherit"},children:[e,": ",t??r,o&&(0,PL.jsxs)(PL.Fragment,{children:[" \xB7 set with ",(0,PL.jsx)(Ce,{component:"code",variant:"body2",sx:dvo,children:n})]})]})}var xCr=C(ee(),1),dSe=C(P(),1);function SCr({projects:e,boards:t}){return e.map((r,n)=>{let o=t.find(i=>i.project===r);return(0,dSe.jsxs)(xCr.Fragment,{children:[n>0&&", ",o?.url?(0,dSe.jsx)(Qr,{href:o.url,target:"_blank",rel:"noopener noreferrer",underline:"hover",title:r,children:o.title}):r]},r)})}var uH=C(P(),1);function fvo(e){let t=[e.excludeLabels.length>0&&`labels ${e.excludeLabels.join(", ")}`,e.excludeTypes.length>0&&`types ${e.excludeTypes.join(", ")}`].filter(Boolean),r=t.length>0?`, excluding ${t.join("; ")}`:"";return`, picking up ${e.pickStatuses.join(", ")}${r}`}function TCr(e,t){return e.projects.length===0?null:(0,uH.jsxs)(uH.Fragment,{children:[(0,uH.jsx)(SCr,{projects:e.projects,boards:t}),fvo(e)]})}var jee=C(P(),1);function pvo(e,t){return e?e.join(", "):t?`${t} (this repo, by default)`:null}function wCr({scope:e,boards:t}){let r=[(0,jee.jsx)(uSe,{label:"Peers",value:e.peers.length>0?e.peers.join(", "):null,unset:"none \u2014 only PRs requesting your review appear",setter:"assist config set next.peers alice,bob --repo",showSetter:e.peers.length===0},"peers"),(0,jee.jsx)(uSe,{label:"Repos",value:pvo(e.repos,e.selfRepo),unset:"none",setter:"assist config set next.repos my-org,other/web --repo",showSetter:!e.repos},"repos"),(0,jee.jsx)(uSe,{label:"Projects",value:TCr(e,t),unset:"none \u2014 no project items are suggested",setter:"assist config set next.projects my-org/3,my-org/5 --repo",showSetter:e.projects.length===0},"projects")];return(0,jee.jsx)(bCr,{lines:r})}var VT=C(P(),1),hvo={flex:1,m:0,mb:.5,fontSize:22,fontWeight:600,lineHeight:1.3,letterSpacing:"-0.01em"};function CCr({loading:e,data:t,onRefresh:r}){return(0,VT.jsxs)(kt,{direction:"row",useFlexGap:!0,sx:{mb:"22px",gap:"8px 16px",alignItems:"flex-start"},children:[(0,VT.jsxs)(kt,{sx:{flex:1,minWidth:0},children:[(0,VT.jsx)(Ce,{component:"h2",sx:hvo,children:"Next"}),t&&(0,VT.jsx)(wCr,{scope:t.scope,boards:t.boards})]}),(0,VT.jsxs)(kt,{direction:"row",spacing:1,children:[(0,VT.jsx)(ht,{component:da,to:"/config?search=next",children:"Next settings"}),(0,VT.jsx)(ht,{variant:"tonal",onClick:r,disabled:e,children:"Refresh"})]})]})}var fSe=C(P(),1);function kCr({picking:e,error:t,clearError:r}){return e?(0,fSe.jsxs)(no,{severity:"info",children:["Assigning ",e.repo,"#",e.number," to you and moving it to In Progress\u2026"]}):t?(0,fSe.jsx)(no,{severity:"error",onClose:r,children:t}):null}var _Cr=e=>({px:2.5,py:"18px","& > .MuiStack-root":{gap:"10px"},"& > .MuiStack-root > :not(style) ~ :not(style)":{mt:0},"& h2":{fontSize:19,fontWeight:600,lineHeight:1.35,letterSpacing:"-0.01em"},"& .MuiTypography-overline":{fontSize:11,fontWeight:600,letterSpacing:"0.08em",color:"text.disabled"},borderColor:Vr(e.palette.primary.main,.4),borderRadius:`${e.tokens.radius.md+2}px`,backgroundImage:`linear-gradient(180deg, ${e.palette.action.selected}, transparent 70%)`});var Zy=C(P(),1);function ECr({chip:e,repo:t,number:r,title:n,facts:o,why:i,url:a,onStart:s,sessions:l}){return(0,Zy.jsx)(Zr,{variant:"outlined",sx:_Cr,children:(0,Zy.jsxs)(kt,{spacing:1.5,children:[(0,Zy.jsx)(Ce,{variant:"overline",sx:{color:"text.secondary",lineHeight:1.5},children:"Your next best action"}),(0,Zy.jsxs)(kt,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,Zy.jsx)(Z2e,{chip:e}),(0,Zy.jsx)(iSe,{repo:t,number:r})]}),(0,Zy.jsx)(Ce,{variant:"h6",component:"h2",children:n}),o,(0,Zy.jsx)(Ce,{sx:{color:"text.secondary",maxWidth:"65ch"},children:i}),(0,Zy.jsx)(oSe,{repo:t,url:a,onStart:s,sessions:l,size:"medium"})]})})}function RCr(e,t,r){let n=t>1?`the oldest of ${t} issues assigned to you`:"the only issue assigned to you",o=r?", and no peer PRs await your review":"";return`Opened ${xo(e.createdAt)} \u2014 ${n}${o}.`}function PCr(e,t,r){let n=t>1?`the oldest of your ${t} open PRs`:"your only open PR",o=e.isDraft?"drafted":"opened",i=r?", and nothing else awaits your review, is assigned to you or is ready to pick up":"";return`You ${o} it ${xo(e.createdAt)} \u2014 ${n}${i}.`}var LCr=C(P(),1);function ACr(e,{data:t,onStartPr:r}){let{peerPrs:n,myPrs:o,assignedIssues:i,pickups:a}=t;return{chip:a0.mine,facts:(0,LCr.jsx)(lH,{pr:e}),why:PCr(e,o.items.length,!n.error&&!i.error&&!a.error),onStart:s=>r(e,s)}}function ICr(e,t,r){let n=t>1?`the top of ${t} unassigned project items`:"the only unassigned project item",o=r?", and nothing is assigned to you or awaiting your review":"";return`${e.status} on ${e.projectTitle} \u2014 ${n} you could pick up${o}.`}var DCr=C(P(),1);function MCr(e,{data:t,onStartPickup:r}){let{peerPrs:n,assignedIssues:o,pickups:i}=t;return{chip:a0.pickup,facts:(0,DCr.jsx)(cH,{issue:e}),why:ICr(e,i.items.length,!n.error&&!o.error),onStart:a=>r(e,a)}}function NCr(e,t){let r=t>1?`the oldest of ${t} PRs`:"the only PR",n=e.reason==="requested"?`${e.author} requested your review ${xo(e.requestedAt)}`:`${e.author} is a peer and opened it ${xo(e.createdAt)}`,o=e.checks==="success"?" Checks pass, so your review is what it is waiting on.":"";return`${n} \u2014 ${r} waiting on your review.${o}`}var OZe=C(P(),1);function OCr(e,t){let{data:r,onStartPr:n,onStartIssue:o}=t,{peerPrs:i,assignedIssues:a}=r;switch(e.kind){case"pr":return{chip:a0.review,facts:(0,OZe.jsx)(lH,{pr:e.item}),why:NCr(e.item,i.items.length),onStart:s=>n(e.item,s)};case"issue":return{chip:a0.assigned,facts:(0,OZe.jsx)(cH,{issue:e.item}),why:RCr(e.item,a.items.length,!i.error),onStart:s=>o(e.item,s)};case"pickup":return MCr(e.item,t);case"mine":return ACr(e.item,t)}}var $Cr=C(P(),1);function BCr(e){let{sessions:t,trackedIssues:r}=b4(),n=X2e(e.data);if(!n)return null;let{repo:o,number:i,title:a,url:s}=n.item;return(0,$Cr.jsx)(ECr,{repo:o,number:i,title:a,url:s,sessions:n.kind==="pr"||n.kind==="mine"?J2e(t,o,i):lSe(t,r,o,i),...OCr(n,e)})}function S4(e){return{title:e.title,subtitle:`#${e.number} \xB7 ${e.author} \xB7 ${xo(e.createdAt)}`}}var pSe=C(ee(),1),BZe=(0,pSe.createContext)({launchAssist:()=>{},launchAgentInStream:()=>{},resumeSession:()=>{},armUpdateReload:()=>{},activateSession:()=>{},sendInput:()=>{}});function ql(){return(0,pSe.useContext)(BZe)}var UCr=C(ee(),1);var dH=[{label:"Review",args:["review"]},{label:"Review & refine",args:["review","--refine"]},{label:"Review & apply",args:["review","--apply"]},{label:"Review & post",args:["review","--no-prompt","--submit"]},{label:"High-level review",args:["review","--high-level"]}];var $Ze=[{key:"force",label:"Force re-run",flag:"--force"},{key:"addressComments",label:"Address comments after",flag:"--address-comments"},{key:"announce",label:"Announce to Slack after",flag:"--announce"}],Yee={force:!1,addressComments:!1,announce:!1};function hSe(e){return $Ze.filter(({key:t})=>e[t]).map(({flag:t})=>t)}var mSe=C(P(),1),mvo={"& .MuiFormControlLabel-label":{fontSize:12}};function gSe({value:e,onChange:t}){return(0,mSe.jsx)(eRe,{sx:{px:2,py:.5},children:$Ze.map(({key:r,label:n})=>(0,mSe.jsx)(Gv,{control:(0,mSe.jsx)(np,{size:"small",checked:e[r],onChange:o=>t({...e,[r]:o.target.checked})}),label:n,sx:mvo},r))})}var FCr=[{label:"Checkout",args:["review","--checkout-only"]},{label:"Address Comments",args:["review-pr-comments"]},{label:"Address Comments (auto)",args:["review-pr-comments","--auto"]},{label:"Fix conflicts (merge)",args:["fix-conflict"]},{label:"Fix conflicts (rebase)",args:["fix-conflict","--rebase"]}];var T4=C(P(),1);function zCr({pr:e,onSelect:t,onCancel:r}){return(0,T4.jsxs)(T4.Fragment,{children:[FCr.map(({label:n,args:o})=>(0,T4.jsx)(jr,{onClick:()=>t(o),children:n},n)),(0,T4.jsx)(eo,{}),(0,T4.jsx)(jr,{onClick:()=>{window.open(e.url,"_blank"),r()},children:"Open in GitHub"})]})}var mm=C(P(),1);function ySe({pr:e,onSelect:t,onCancel:r}){let[n,o]=(0,UCr.useState)(Yee);return(0,mm.jsxs)(vl,{open:!0,onClose:r,maxWidth:"xs",fullWidth:!0,children:[(0,mm.jsxs)(bd,{sx:{fontSize:15},children:["Review #",e.number,": ",e.title]}),(0,mm.jsx)(vd,{sx:{px:0},children:(0,mm.jsxs)(eg,{children:[dH.map(({label:i,args:a})=>(0,mm.jsx)(jr,{onClick:()=>t([...a,...hSe(n)]),children:i},i)),(0,mm.jsx)(eo,{}),(0,mm.jsx)(gSe,{value:n,onChange:o}),(0,mm.jsx)(eo,{}),(0,mm.jsx)(zCr,{pr:e,onSelect:t,onCancel:r})]})}),(0,mm.jsx)(op,{children:(0,mm.jsx)(ht,{onClick:r,children:"Cancel"})})]})}var WCr=C(P(),1);function HCr({review:{pr:e,cwd:t},onClose:r}){let{selectedNode:n}=to(),{launchAssist:o}=ql();return(0,WCr.jsx)(ySe,{pr:e,onSelect:i=>{o([...i,String(e.number)],t,{...S4(e),node:n}),r()},onCancel:r})}var GCr=C(ee(),1);function VCr(e){let{repos:t,selectedCwd:r,originOf:n}=to();return(0,GCr.useCallback)(o=>{let i=o.toLowerCase();if(e?.toLowerCase()===i)return r;let a=`github.com/${i}`;return t.find(s=>n(s)?.toLowerCase()===a)},[t,r,n,e])}var YCr=C(ee(),1);function qCr(){let[,e]=al();return(t,r)=>e(n=>(n.set("new",`Issue ${t.repo}#${t.number}: ${t.title}
3874
3874
  ${t.url}`),n.set("newCwd",r),n),{replace:!0})}var FZe=C(ee(),1);function jCr(e,t,r){let n=yr(),[o,i]=(0,FZe.useState)(null),[a,s]=(0,FZe.useState)(null);return{start:(u,d)=>{i(u),s(null);let{project:f,repo:p,number:h,itemId:m}=u;BT(tn(`/api/next/pickup?cwd=${encodeURIComponent(e)}`,n),{project:f,repo:p,number:h,itemId:m},"Failed to pick up the item").then(()=>{t(u,d),r()}).catch(g=>s(`Could not pick up ${p}#${h}: ${g instanceof Error?g.message:String(g)}`)).finally(()=>i(null))},picking:o,error:a,clearError:()=>s(null)}}function KCr(e,t){let[r,n]=(0,YCr.useState)(null),o=qCr(),{start:i,...a}=jCr(e,o,t);return{actions:{onStartPr:(l,u)=>n({pr:l,cwd:u}),onStartIssue:o,onStartPickup:(l,u)=>!a.picking&&i(l,u)},pickup:a,reviewing:r,closeReview:()=>n(null)}}var qT=C(ee(),1);var XCr=3e4;async function gvo(e,t){let r=await Jt(tn(`/api/next?cwd=${encodeURIComponent(e)}`,t),{signal:AbortSignal.timeout(XCr)}).catch(o=>{throw o instanceof DOMException&&o.name==="TimeoutError"?new Error(`No response after ${XCr/1e3}s.`):o}),n=await r.json();if(!r.ok)throw new Error(n?.error??`HTTP ${r.status}`);return n}function ZCr(e){let t=yr(),[r,n]=(0,qT.useState)(null),[o,i]=(0,qT.useState)(!0),[a,s]=(0,qT.useState)(null),[l,u]=(0,qT.useState)(0);(0,qT.useEffect)(()=>{if(!e){n(null),i(!1),s("No repo selected.");return}let f=!1;return i(!0),gvo(e,t).then(p=>{f||(n(p),s(null))}).catch(p=>{f||(n(null),s(p instanceof Error?p.message:"Failed to load."))}).finally(()=>{f||i(!1)}),()=>{f=!0}},[e,t,l]);let d=(0,qT.useCallback)(()=>u(f=>f+1),[]);return{data:r,loading:o,error:a,refresh:d}}var yvo={maxWidth:980,mx:0,px:3.5,py:2.5};function QCr(){return{shell:{maxWidth:!1,sx:yvo},spacing:"22px"}}var zZe=C(ee(),1);var vSe=C(ee(),1);function JCr(e){let t=yr(),[r,n]=(0,vSe.useState)(()=>new Map),o=JSON.stringify(e.flatMap(i=>{let a=i.activity?.itemId;return a==null?[]:[[i.id,i.cwd,a]]}));return(0,vSe.useEffect)(()=>{let i=!1,a=JSON.parse(o);return Promise.all(a.map(async([s,l,u])=>{let f=(await sce(l??void 0,t)).get(u)?.githubIssue;return f?[s,f]:void 0})).then(s=>{i||n(new Map(s.filter(l=>l!==void 0)))}),()=>{i=!0}},[o,t]),r}function ekr(e,t){let r=yr()??"",n=u1(t),o=(0,zZe.useMemo)(()=>e.filter(a=>(a.node??"")===r),[e,r]),i=JCr(o);return(0,zZe.useMemo)(()=>({sessions:o,trackedIssues:i,activate:n}),[o,i,n])}var Qy=C(P(),1);function tkr({sessions:e,selectSession:t}){let{selectedCwd:r}=to(),{data:n,loading:o,error:i,refresh:a}=ZCr(r),{actions:s,pickup:l,reviewing:u,closeReview:d}=KCr(r,a),f=VCr(n?.scope.selfRepo??null),p=ekr(e,t),h=QCr();return(0,Qy.jsxs)(Is,{...h.shell,loading:o&&!n,header:(0,Qy.jsx)(CCr,{loading:o,data:n,onRefresh:a}),isEmpty:!n,emptyMessage:i??void 0,children:[n&&(0,Qy.jsx)(IZe.Provider,{value:f,children:(0,Qy.jsx)(LZe.Provider,{value:p,children:(0,Qy.jsxs)(kt,{spacing:h.spacing,children:[(0,Qy.jsx)(kCr,{...l}),(0,Qy.jsx)(BCr,{data:n,...s}),(0,Qy.jsx)(yCr,{data:n,...s})]})})}),u&&(0,Qy.jsx)(HCr,{review:u,onClose:d})]})}var Xkr=C(ee(),1);var UZe={live:"What's live",run:"Latest run"};var Kee=C(P(),1),vvo={display:"flex",justifyContent:"flex-end"},bvo={fontSize:"0.975rem"},xvo={live:"What each environment is running right now",run:"How far the latest run of this workflow has reached"};function rkr({layer:e,onChange:t}){return(0,Kee.jsx)(G,{sx:vvo,children:(0,Kee.jsx)(Dc,{size:"small",exclusive:!0,value:e,"aria-label":"Data layer",onChange:(r,n)=>{n&&t(n)},children:Object.keys(UZe).map(r=>(0,Kee.jsx)(sr,{title:xvo[r],children:(0,Kee.jsx)(ms,{value:r,sx:bvo,children:UZe[r]})},r))})})}var Svo=[{mark:"\u25CF",tone:"ok",label:"current",tooltip:"Running the latest commit on the default branch"},{mark:"\u25D1",tone:"gate",label:"gated",tooltip:"Behind, with a newer commit waiting for someone to approve"},{mark:"\u25B2",tone:"drift",label:"behind",tooltip:"Behind the default branch, and nothing is queued to fix it"},{mark:"\u25CB",tone:"idle",label:"no deploy",tooltip:"No successful deployment recorded, or a build or approval step rather than an environment"},{mark:"queued",tone:"gate",label:"next in line",tooltip:"Built and queued, but not live \u2014 waiting for approval"},{mark:"\u2212n",tone:"drift",label:"behind by n",tooltip:"Commits on the default branch this environment has not got yet"}],Tvo=[{mark:"\u2714",tone:"ok",label:"done",tooltip:"Built or deployed by this run"},{mark:"\u25D1",tone:"gate",label:"gated",tooltip:"Waiting for someone to approve this deploy"},{mark:"\u25CF",tone:"gate",label:"running",tooltip:"Running now"},{mark:"\u2715",tone:"fail",label:"failed",tooltip:"This job failed in the latest run"},{mark:"\u25CB",tone:"idle",label:"untouched",tooltip:"This run never got here"}];function nkr(e){return e==="run"?Tvo:Svo}var HZe=C(P(),1),wvo={cursor:"help",borderRadius:"2px","&:focus-visible":{outline:"2px solid",outlineOffset:"2px"}};function gm({title:e,color:t,children:r}){return(0,HZe.jsx)(sr,{title:e,children:(0,HZe.jsx)(G,{component:"span",tabIndex:0,sx:wvo,color:t,children:r})})}var Wf={ok:"success.main",gate:"warning.main",drift:"error.main",fail:"error.main",idle:"text.secondary"};var s0=C(P(),1),Cvo={display:"flex",flexWrap:"wrap",alignItems:"center",gap:2,pt:1.5,mt:1,borderTop:1,borderColor:"divider",fontSize:14.4,color:"text.secondary"},WZe={display:"inline-flex",alignItems:"center",gap:.75},kvo={fontFamily:"fontFamilyMono",fontSize:12.6,letterSpacing:"0.09em",textTransform:"uppercase"},okr={width:22,height:2};function ikr({layer:e}){return(0,s0.jsxs)(G,{sx:Cvo,children:[(0,s0.jsx)(G,{component:"span",sx:kvo,children:"hover anything for the long version"}),nkr(e).map(t=>(0,s0.jsxs)(G,{component:"span",sx:WZe,children:[(0,s0.jsx)(gm,{title:t.tooltip,color:Wf[t.tone],children:t.mark}),t.label]},t.label)),(0,s0.jsxs)(G,{component:"span",sx:WZe,children:[(0,s0.jsx)(gm,{title:"This promotion has happened \u2014 the target carries the source's commit",children:(0,s0.jsx)(G,{component:"span",sx:{...okr,display:"block",bgcolor:"primary.main"}})}),"promoted"]}),(0,s0.jsxs)(G,{component:"span",sx:WZe,children:[(0,s0.jsx)(gm,{title:"This promotion has not happened yet",children:(0,s0.jsx)(G,{component:"span",sx:{...okr,display:"block",borderTop:"2px dashed",borderColor:"text.disabled",height:0}})}),"not yet"]})]})}var SH=C(ee(),1);var ete=C(ee(),1);var bSe=C(P(),1),_vo={position:"absolute",inset:0,overflow:"visible",pointerEvents:"none",zIndex:0};function akr({edges:e,promoted:t,geometry:r}){let n=Pn(),{width:o,height:i,paths:a}=r;return o===0||i===0?null:(0,bSe.jsx)(G,{component:"svg",sx:_vo,width:o,height:i,viewBox:`0 0 ${o} ${i}`,"aria-hidden":"true",children:e.map(([s,l],u)=>{let d=a[u];if(!d)return null;let f=t[u]??!1;return(0,bSe.jsx)("path",{d,fill:"none",strokeWidth:1.5,stroke:f?n.palette.primary.main:n.palette.text.disabled,strokeDasharray:f?void 0:"3 4",children:(0,bSe.jsx)("title",{children:f?`${s} \u2192 ${l}: promoted \u2014 the target carries the source's commit`:`${s} \u2192 ${l}: not promoted yet`})},`${s}\0${l}`)})})}function skr(e,t,r,n){let o=e.get(r),i=e.get(n);return!o||!i?!1:t==="run"?i.run?.status==="ok":i.kind!=="environment"?!1:o.kind!=="environment"?i.behind===0:!!(o.live&&o.live.sha===i.live?.sha)}function lkr(e,t,r){let n=new Map(e.map(o=>[o.id,o]));return t.map(([o,i])=>skr(n,r,o,i))}function Evo(e){let t=new Map;for(let[r,n]of e)t.set(n,[...t.get(n)??[],r]);return t}function Rvo(e){let t=Evo(e),r=new Map,n=new Set,o=i=>{let a=r.get(i);if(a!==void 0)return a;if(n.has(i))return 0;n.add(i);let s=Math.max(0,...(t.get(i)??[]).map(l=>o(l)+1));return n.delete(i),r.set(i,s),s};return o}function ckr(e,t){let r=Rvo(t),n=[];for(let o of e){let i=r(o.id);for(;n.length<=i;)n.push([]);n[i]?.push(o)}return n}var Pvo=new Intl.DateTimeFormat(void 0,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"});function Xee(e){return Pvo.format(new Date(e))}var qb=C(P(),1),Avo=7,Lvo={fontFamily:"fontFamilyMono"},Ivo={mt:.5},Mvo={opacity:.75,fontFamily:"fontFamilyMono"};function fH({repo:e,commit:t,note:r}){return(0,qb.jsx)(sr,{title:(0,qb.jsxs)(qb.Fragment,{children:[(0,qb.jsx)(G,{children:r}),t.subject&&(0,qb.jsx)(G,{sx:Ivo,children:t.subject}),t.author&&(0,qb.jsx)(G,{sx:Mvo,children:t.author})]}),children:(0,qb.jsx)(Qr,{sx:Lvo,href:`https://github.com/${e}/commit/${t.sha}`,target:"_blank",rel:"noreferrer",children:t.sha.slice(0,Avo)})})}var pH={display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:1,fontFamily:"fontFamilyMono",fontSize:13.2,color:"text.secondary"};var hH=C(P(),1);function Dvo(e){let t=`Live in ${e.environment}`;return e.deployedAt?`${t} since ${Xee(e.deployedAt)}`:t}function Nvo(e,t){return`${e} ${e===1?"commit":"commits"} on ${t??"the default branch"} this environment has not got yet`}function ukr({node:e,repo:t,defaultBranch:r}){let{live:n,deployedAt:o,behind:i,queued:a}=e;return(0,hH.jsxs)(G,{sx:pH,children:[n&&(0,hH.jsx)(fH,{repo:t,commit:n,note:Dvo(e)}),o&&(0,hH.jsx)(gm,{title:`Deployed ${Xee(o)}`,children:xo(o)}),i!==null&&i>0&&(0,hH.jsxs)(gm,{title:Nvo(i,r),color:Wf[a?"gate":"drift"],children:["\u2212",i]})]})}var Tkr=C(ee(),1);function dkr(e,t){return t.pr?{href:t.pr.url,label:`#${t.pr.number}`}:{href:`https://github.com/${e}/commit/${t.sha}`,label:t.sha.slice(0,7)}}var AL={row:e=>({display:"grid",gridTemplateColumns:"7ch minmax(0, 1fr) auto",alignItems:"baseline",columnGap:1.5,px:1.5,py:.5,opacity:e?.62:1,"&:hover":{bgcolor:"action.hover"}}),ref:{fontFamily:"fontFamilyMono",fontSize:12.5},subject:{display:"flex",alignItems:"baseline",minWidth:0,fontSize:13},subjectText:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},by:{fontSize:12,color:"text.secondary",whiteSpace:"nowrap"},liveBadge:{ml:1,px:.5,flexShrink:0,border:"1px solid currentColor",borderRadius:"3px",fontSize:10.5,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:Wf.ok}};var w4=C(P(),1);function Ovo({author:e,date:t}){return[e,t&&xo(t)].filter(Boolean).join(" \xB7 ")}function GZe({repo:e,change:t,live:r=!1}){let n=dkr(e,t);return(0,w4.jsxs)(G,{component:"li",sx:AL.row(r),children:[(0,w4.jsx)(Qr,{sx:AL.ref,href:n.href,target:"_blank",rel:"noreferrer",children:n.label}),(0,w4.jsxs)(G,{component:"span",sx:AL.subject,title:t.subject??void 0,children:[(0,w4.jsx)(G,{component:"span",sx:AL.subjectText,children:t.subject}),r&&(0,w4.jsx)(G,{component:"span",sx:AL.liveBadge,children:"live"})]}),(0,w4.jsx)(G,{component:"span",sx:AL.by,children:Ovo(t)})]})}var VZe=C(P(),1),Bvo={display:"grid",gap:1.25,p:1.5},$vo=[86,64,86,64];function fkr(){return(0,VZe.jsx)(G,{sx:Bvo,"aria-label":"Loading changes",children:$vo.map((e,t)=>(0,VZe.jsx)(MRe,{variant:"rounded",height:10,width:`${e}%`},t))})}var C4=C(P(),1),Fvo={px:1.5,py:2,fontSize:13,lineHeight:1.5,color:"error.main"},zvo={listStyle:"none",m:0,py:.5,px:0,maxHeight:296,overflowY:"auto"};function pkr({repo:e,live:t,view:r}){if(r.status==="loading")return(0,C4.jsx)(fkr,{});if(r.status==="error")return(0,C4.jsxs)(G,{sx:Fvo,children:["Couldn't load the commit range from GitHub. Check"," ",(0,C4.jsx)("code",{children:"gh auth status"}),", then try again."]});let{total:n,changes:o}=r.compare;return(0,C4.jsxs)(G,{component:"ol",sx:zvo,children:[o.map(i=>(0,C4.jsx)(GZe,{repo:e,change:i},i.sha)),t&&o.length>=n&&(0,C4.jsx)(GZe,{repo:e,change:{...t,date:null,pr:null},live:!0})]})}var hkr=C(P(),1),Uvo={fontWeight:500};function qZe({href:e,children:t}){return(0,hkr.jsxs)(Qr,{sx:Uvo,href:e,target:"_blank",rel:"noreferrer",underline:"hover",children:[t," \u2197"]})}var mH=C(P(),1),Hvo={display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:1.5,px:1.5,py:1,borderTop:1,borderColor:"divider",fontSize:12.5,color:"text.secondary"};function mkr({repo:e,live:t,queued:r,runUrl:n,view:o}){let i=o.status==="loaded"&&o.compare.changes.length<o.compare.total?o.compare:null;return!i&&!t&&!n?null:(0,mH.jsxs)(G,{sx:Hvo,children:[i&&(0,mH.jsxs)("span",{children:["Showing ",i.changes.length," of ",i.total]}),t&&(0,mH.jsx)(qZe,{href:`https://github.com/${e}/compare/${t.sha}...${r.sha}`,children:"Compare on GitHub"}),n&&(0,mH.jsx)(qZe,{href:n,children:"Review deployment"})]})}var Zee=C(P(),1),Wvo=7,Gvo={display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:1.5,px:1.5,py:1,borderBottom:1,borderColor:"divider"},Vvo={fontWeight:500,fontSize:13.5},qvo={fontFamily:"fontFamilyMono",fontSize:12,color:"text.secondary",whiteSpace:"nowrap"};function jZe(e){return e.slice(0,Wvo)}function jvo(e,t){if(e.status!=="loaded")return`Changes queued for ${t}`;let{total:r,changes:n}=e.compare,i=n.every(a=>a.pr)?"PR":"change";return`${r} ${i}${r===1?"":"s"} queued for ${t}`}function gkr({environment:e,live:t,queued:r,view:n}){return(0,Zee.jsxs)(G,{sx:Gvo,children:[(0,Zee.jsx)(G,{component:"strong",sx:Vvo,children:jvo(n,e)}),(0,Zee.jsx)(G,{component:"span",sx:qvo,children:t?`${jZe(t.sha)} \u2192 ${jZe(r.sha)}`:jZe(r.sha)})]})}var k4=C(P(),1);function ykr({repo:e,environment:t,live:r,queued:n,runUrl:o,view:i}){return(0,k4.jsxs)(k4.Fragment,{children:[(0,k4.jsx)(gkr,{environment:t,live:r,queued:n,view:i}),(0,k4.jsx)(pkr,{repo:e,live:r,view:i}),(0,k4.jsx)(mkr,{repo:e,live:r,queued:n,runUrl:o,view:i})]})}var vkr=C(P(),1),bkr=nt((0,vkr.jsx)("path",{d:"M18 23H4c-1.1 0-2-.9-2-2V7h2v14h14zM14.5 7V5h-2v2h-2v2h2v2h2V9h2V7zm2 6h-6v2h6zM15 1H8c-1.1 0-1.99.9-1.99 2L6 17c0 1.1.89 2 1.99 2H19c1.1 0 2-.9 2-2V7zm4 16H8V3h6.17L19 7.83z"}),"DifferenceOutlined");var Qee={button:{p:.25,my:-.5,alignSelf:"center",color:"text.secondary","&:hover":{color:Wf.gate},"&[aria-expanded='true']":{color:Wf.gate}},icon:{fontSize:16},paper:{width:"min(720px, calc(100vw - 32px))",mt:.75}};var YZe=C(P(),1);function xkr({environment:e,open:t,title:r,onClick:n}){return(0,YZe.jsx)(jt,{sx:Qee.button,"aria-label":`Show changes queued for ${e}`,"aria-expanded":t,"aria-haspopup":"dialog",title:r,onClick:n,children:(0,YZe.jsx)(bkr,{sx:Qee.icon})})}var xSe=C(ee(),1);function Yvo(e,t,r,n){let o=new URLSearchParams({cwd:e,repo:t,head:n});return r&&o.set("base",r),`/api/releases/compare?${o}`}function Skr(e,t,r,n){let{selectedCwd:o}=to(),i=yr(),[a,s]=(0,xSe.useState)({status:"loading"});return(0,xSe.useEffect)(()=>{if(!e)return;let l=!1;return s({status:"loading"}),Jt(tn(Yvo(o,t,r,n),i)).then(async u=>{if(!u.ok)throw new Error(`HTTP ${u.status}`);let d=await u.json();l||s({status:"loaded",compare:d})}).catch(u=>{Pr(u,"release compare"),l||s({status:"error"})}),()=>{l=!0}},[e,o,i,t,r,n]),a}var _4=C(P(),1);function wkr({repo:e,environment:t,live:r,queued:n,runUrl:o}){let[i,a]=(0,Tkr.useState)(null),s=!!i,l=Skr(s,e,r?.sha??null,n.sha),u=`Changes queued for ${t}`;return(0,_4.jsxs)(_4.Fragment,{children:[(0,_4.jsx)(xkr,{environment:t,open:s,title:u,onClick:d=>a(s?null:d.currentTarget)}),(0,_4.jsx)(Td,{open:s,anchorEl:i,onClose:()=>a(null),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},slotProps:{paper:{sx:Qee.paper,role:"dialog","aria-label":u}},children:(0,_4.jsx)(ykr,{repo:e,environment:t,live:r,queued:n,runUrl:o,view:l})})]})}var gH=C(P(),1);function Ckr({repo:e,environment:t,live:r,commit:n,runUrl:o}){return(0,gH.jsxs)(G,{sx:pH,children:[(0,gH.jsx)(gm,{title:"Built and queued, but not live \u2014 waiting for approval",color:Wf.gate,children:"queued"}),(0,gH.jsx)(fH,{repo:e,commit:n,note:`Queued for ${t}, waiting for approval`}),(0,gH.jsx)(wkr,{repo:e,environment:t,live:r,queued:n,runUrl:o})]})}var LL=C(P(),1);function kkr({node:e,repo:t,defaultBranch:r,streamRunUrl:n}){return e.kind!=="environment"?null:(0,LL.jsxs)(LL.Fragment,{children:[(0,LL.jsx)(ukr,{node:e,repo:t,defaultBranch:r}),e.queued&&(0,LL.jsx)(Ckr,{repo:t,environment:e.environment,live:e.live,commit:e.queued,runUrl:e.queuedRunUrl??n})]})}var yH=C(P(),1),Kvo={display:"flex",alignItems:"center",gap:1,fontFamily:"fontFamilyMono",fontWeight:600,fontSize:15.6},Xvo={overflowWrap:"anywhere"},Zvo={ml:"auto",fontSize:13.2,lineHeight:1};function _kr({label:e,mark:t}){return(0,yH.jsxs)(G,{sx:Kvo,children:[(0,yH.jsx)(G,{component:"span",sx:Xvo,children:e}),(0,yH.jsx)(G,{component:"span",sx:Zvo,children:(0,yH.jsx)(gm,{title:t.tooltip,color:Wf[t.tone],children:t.glyph})})]})}function Ekr(e,t){let r=t??"the default branch";if(e.kind!=="environment")return{tone:"idle",glyph:"\u25CB",tooltip:e.kind==="gate"?"An approval step, not a deployable environment":"A build step, not a deployable environment"};if(!e.live)return{tone:"idle",glyph:"\u25CB",tooltip:"No successful deployment recorded for this environment"};if(e.behind===null)return{tone:"idle",glyph:"\u25CF",tooltip:`Live, but its distance from ${r} could not be read`};if(e.behind===0)return{tone:"ok",glyph:"\u25CF",tooltip:`Running the latest commit on ${r}`};let n=e.behind===1?"commit":"commits";return e.queued?{tone:"gate",glyph:"\u25D1",tooltip:`Behind ${r} by ${e.behind} ${n}, with a newer commit waiting for approval`}:{tone:"drift",glyph:"\u25B2",tooltip:`Behind ${r} by ${e.behind} ${n}, and nothing is queued to fix it`}}function Rkr(e,t,r,n){return{position:"relative",zIndex:1,borderRadius:1,border:1,px:1,py:.5,transition:"opacity 0.2s ease",bgcolor:e==="environment"?"background.paper":"action.hover",borderColor:Wf[t],borderStyle:t==="idle"?"dashed":"solid",opacity:r?.22:1,outline:n?2:0,outlineColor:"primary.main",outlineStyle:"solid"}}var Jee=C(P(),1);function Pkr({node:e,mark:t}){let r=e.run?.url;return(0,Jee.jsx)(G,{sx:pH,children:r?(0,Jee.jsx)(sr,{title:`${t.tooltip} \u2014 open this job on GitHub`,children:(0,Jee.jsx)(Qr,{href:r,target:"_blank",rel:"noreferrer",children:t.short})}):(0,Jee.jsx)(gm,{title:t.tooltip,children:t.short})})}function KZe(e){return String(e).padStart(2,"0")}function SSe(e){let t=Math.max(0,e);return t<6e4?`${Math.round(t/1e3)}s`:t<36e5?`${Math.floor(t/6e4)}m${KZe(Math.floor(t%6e4/1e3))}s`:t<864e5?`${Math.floor(t/36e5)}h${KZe(Math.floor(t%36e5/6e4))}m`:`${Math.floor(t/864e5)}d${KZe(Math.floor(t%864e5/36e5))}h`}function Qvo(e){return!e.startedAt||!e.completedAt?null:SSe(Date.parse(e.completedAt)-Date.parse(e.startedAt))}function Akr(e,t){let r=Qvo(t);if(t.status==="fail")return{tone:"fail",glyph:"\u2715",short:r??t.conclusion??"failed",tooltip:r?`Failed after ${r} \u2014 ${t.conclusion??"no conclusion"}`:`Failed \u2014 ${t.conclusion??"no conclusion"}`};let n=e.kind==="environment"?"Deployed":"Built";return{tone:"ok",glyph:"\u2714",short:r??"done",tooltip:r?`${n} in ${r}`:`${n} by this run`}}function Lkr(e,t){if(e.status!=="gate"&&e.status!=="running")return null;let r=e.startedAt?SSe(t-Date.parse(e.startedAt)):null;return e.status==="gate"?{tone:"gate",glyph:"\u25D1",short:r??"gated",tooltip:r?`Waiting for someone to approve, for ${r}`:"Waiting for someone to approve"}:{tone:"gate",glyph:"\u25CF",short:r??"running",tooltip:r?`Running for ${r}`:"Running now"}}var Jvo={tone:"idle",glyph:"\u25CB",short:"no run",tooltip:"No run of this workflow to read"};function e1o(e){let t=e.conclusion??"not started";return{tone:"idle",glyph:"\u25CB",short:t,tooltip:`This run never got here \u2014 ${t}`}}function Ikr(e,t){let r=e.run;return r?r.status==="idle"?e1o(r):Lkr(r,t)??Akr(e,r):Jvo}var vH=C(P(),1);function Mkr({node:e,repo:t,defaultBranch:r,streamRunUrl:n,layer:o,dimmed:i,ringed:a}){let s=o==="run"?Ikr(e,Date.now()):null,l=s??Ekr(e,r);return(0,vH.jsxs)(G,{"data-release-node":e.id,sx:Rkr(e.kind,l.tone,i,a),children:[(0,vH.jsx)(_kr,{label:e.label,mark:l}),s?(0,vH.jsx)(Pkr,{node:e,mark:s}):(0,vH.jsx)(kkr,{node:e,repo:t,defaultBranch:r,streamRunUrl:n})]})}var XZe=C(P(),1),t1o={display:"flex",flexDirection:"column",justifyContent:"center",gap:1};function Dkr({nodes:e,stream:t,layer:r,highlight:n}){return(0,XZe.jsx)(G,{sx:t1o,children:e.map(o=>(0,XZe.jsx)(Mkr,{node:o,repo:t.repo,defaultBranch:t.defaultBranch,streamRunUrl:t.run?.url??null,layer:r,dimmed:!!n&&!n?.has(o.id),ringed:!!n?.has(o.id)},o.id))})}var TSe=C(ee(),1);function Nkr(e,t,r){let n=e.querySelector(`[data-release-node="${CSS.escape(r)}"]`);if(!n)return null;let o=n.getBoundingClientRect();return{left:o.left-t.left,right:o.right-t.left,y:o.top-t.top+o.height/2}}function Okr(e,t){let r=e.getBoundingClientRect(),n=t.map(([o,i])=>{let a=Nkr(e,r,o),s=Nkr(e,r,i);if(!a||!s)return"";let l=(a.right+s.left)/2;return`M ${a.right} ${a.y} C ${l} ${a.y}, ${l} ${s.y}, ${s.left} ${s.y}`});return{width:r.width,height:r.height,paths:n}}function Bkr(e,t){return e.width===t.width&&e.height===t.height&&e.paths.length===t.paths.length&&e.paths.every((r,n)=>r===t.paths[n])}var r1o={width:0,height:0,paths:[]};function $kr(e,t){let[r,n]=(0,TSe.useState)(r1o);return(0,TSe.useLayoutEffect)(()=>{let o=e.current;if(!o)return;let i=0,a=()=>{let u=Okr(o,t);n(d=>Bkr(d,u)?d:u)},s=()=>{cancelAnimationFrame(i),i=requestAnimationFrame(a)};a();let l=new ResizeObserver(s);l.observe(o);for(let u of o.querySelectorAll("[data-release-node]"))l.observe(u);return window.addEventListener("resize",s),()=>{cancelAnimationFrame(i),l.disconnect(),window.removeEventListener("resize",s)}},[e,t]),r}var bH=C(P(),1),n1o={overflowX:"auto",p:1.5,flex:"1 1 auto",minWidth:0},o1o={position:"relative",display:"grid",gridAutoFlow:"column",gridAutoColumns:"minmax(180px, 1fr)",gap:4,minWidth:"min-content"};function Fkr({stream:e,layer:t,highlight:r}){let n=(0,ete.useRef)(null),{nodes:o,edges:i}=e,a=(0,ete.useMemo)(()=>ckr(o,i),[o,i]),s=(0,ete.useMemo)(()=>lkr(o,i,t),[o,i,t]),l=$kr(n,i);return(0,bH.jsx)(G,{sx:n1o,children:(0,bH.jsxs)(G,{ref:n,sx:o1o,children:[(0,bH.jsx)(akr,{edges:i,promoted:s,geometry:l}),a.map((u,d)=>(0,bH.jsx)(Dkr,{nodes:u,stream:e,layer:t,highlight:r},u[0]?.id??`column-${d}`))]})})}var xH=C(P(),1);function i1o(e){let t=e.startedAt?` started ${Xee(e.startedAt)}`:"";return`Latest run #${e.number} \u2014 ${e.status}${t}`}function zkr({stream:e,sx:t}){let{head:r,run:n}=e;return!r&&!n?null:(0,xH.jsxs)(G,{sx:t,children:[r&&(0,xH.jsx)(fH,{repo:e.repo,commit:r,note:`Tip of ${e.defaultBranch??"the default branch"}`}),r&&n&&" \xB7 ",n&&(0,xH.jsx)(sr,{title:i1o(n),children:(0,xH.jsxs)(Qr,{href:n.url,target:"_blank",rel:"noreferrer",children:["#",n.number]})})]})}var ZZe=C(P(),1),a1o={ok:"success",gate:"warning",drift:"error",fail:"error",idle:"default"},s1o={display:"flex",flexWrap:"wrap",gap:.5,mt:1,flexDirection:{xs:"row",md:"column"},alignItems:"flex-start"},l1o={height:"auto",py:.25,cursor:"help",maxWidth:"100%","& .MuiChip-label":{whiteSpace:"normal",textAlign:"left",fontSize:13.8,px:1}};function Ukr({pills:e,onHighlight:t}){return e.length===0?null:(0,ZZe.jsx)(G,{sx:s1o,children:e.map(r=>(0,ZZe.jsx)(Vn,{component:"button",type:"button",size:"small",variant:"outlined",color:a1o[r.tone],label:r.text,sx:l1o,onMouseEnter:()=>t(r.ids),onMouseLeave:()=>t(null),onFocus:()=>t(r.ids),onBlur:()=>t(null)},r.text))})}var E4=C(P(),1),c1o={flex:{md:"0 0 252px"},borderRight:{xs:0,md:1},borderBottom:{xs:1,md:0},borderColor:"divider",px:1.5,py:1},u1o={fontSize:"1.05rem"},QZe={fontFamily:"fontFamilyMono",display:"block",fontSize:13.2,color:"text.secondary"};function Hkr({stream:e,pills:t,onHighlight:r}){return(0,E4.jsxs)(G,{sx:c1o,children:[(0,E4.jsx)(Ce,{variant:"subtitle2",sx:u1o,children:e.name}),(0,E4.jsx)(G,{sx:QZe,children:e.repo}),(0,E4.jsx)(G,{sx:QZe,children:e.workflow}),(0,E4.jsx)(zkr,{stream:e,sx:QZe}),(0,E4.jsx)(Ukr,{pills:t,onHighlight:r})]})}function jb(e,t,r){return{tone:e,text:t,ids:r.map(n=>n.id)}}function wSe(e){return e.filter((t,r)=>r===0||t.ids.length>0)}function d1o(e,t){return`${e} ${t}${e===1?"":"s"}`}function Wkr(e,t){let r=e.filter(s=>s.behind===0),n=e.filter(s=>s.queued),o=e.filter(s=>(s.behind??0)>0&&!s.queued),i=e.filter(s=>!s.live),a=Math.max(0,...o.map(s=>s.behind??0));return wSe([jb("ok",`${r.length} of ${e.length} running the latest commit on ${t}`,r),jb("gate",`${n.length} waiting for someone to approve`,n),jb("drift",`${o.length} behind ${t}, furthest by ${d1o(a,"commit")}`,o),jb("idle",`${i.length} with no successful deployment`,i)])}function Gkr(e){let t=a=>e.filter(s=>s.run?.status===a),r=t("ok"),n=t("gate"),o=t("fail"),i=e.filter(a=>!a.run||a.run.status==="idle");return wSe([jb("ok",`${r.length} of ${e.length} deployed by this run`,r),jb("gate",`${n.length} stopped at an approval gate`,n),jb("fail",`${o.length} failed in this run`,o),jb("idle",`${i.length} this run never touched`,i)])}function Vkr(e,t){let r=e.nodes.filter(n=>n.kind==="environment");return r.length===0?[]:t==="run"?Gkr(r):Wkr(r,e.defaultBranch??"the default branch")}var jT=C(P(),1),f1o={display:"flex",alignItems:"stretch",flexDirection:{xs:"column",md:"row"}},qkr={flex:"1 1 auto",minWidth:0,p:1.5};function jkr({stream:e,layer:t}){let[r,n]=(0,SH.useState)(null),o=(0,SH.useMemo)(()=>Vkr(e,t),[e,t]),i=(0,SH.useCallback)(a=>n(a?new Set(a):null),[]);return(0,jT.jsxs)(Zr,{variant:"outlined",sx:f1o,children:[(0,jT.jsx)(Hkr,{stream:e,pills:o,onHighlight:i}),e.error?(0,jT.jsx)(G,{sx:qkr,children:(0,jT.jsx)(no,{severity:"warning",variant:"outlined",children:e.error})}):e.nodes.length===0?(0,jT.jsx)(G,{sx:qkr,children:(0,jT.jsx)(Ce,{variant:"body2",color:"text.secondary",children:"No nodes declared for this stream."})}):(0,jT.jsx)(Fkr,{stream:e,layer:t,highlight:r})]})}var CSe=C(ee(),1);var Ykr={streams:[],loading:!0,error:null};async function p1o(e,t){let r=await Jt(tn(`/api/releases/state?cwd=${encodeURIComponent(e)}`,t)),n=await r.json();if(!r.ok)throw new Error(n?.error??`HTTP ${r.status}`);return n.streams??[]}function Kkr(e){let[t,r]=(0,CSe.useState)(Ykr),n=yr();return(0,CSe.useEffect)(()=>{if(!e){r({streams:[],loading:!1,error:"No repo selected."});return}let o=!1;return r(Ykr),p1o(e,n).then(i=>{o||r({streams:i,loading:!1,error:null})}).catch(i=>{o||r({streams:[],loading:!1,error:i instanceof Error?i.message:"Failed to load release state."})}),()=>{o=!0}},[e,n]),t}var IL=C(P(),1),h1o={maxWidth:{lg:1440}};function Zkr(){let{selectedCwd:e}=to(),{streams:t,loading:r,error:n}=Kkr(e),[o,i]=(0,Xkr.useState)("live");return(0,IL.jsx)(Is,{loading:r,title:"Releases",isEmpty:t.length===0,emptyMessage:n??"No release streams declared under releases.streams.",maxWidth:"lg",sx:h1o,children:(0,IL.jsxs)(kt,{spacing:1,children:[(0,IL.jsx)(rkr,{layer:o,onChange:i}),t.map(a=>(0,IL.jsx)(jkr,{stream:a,layer:o},`${a.repo}:${a.name}`)),(0,IL.jsx)(ikr,{layer:o})]})})}var tte=C(ee(),1);var m1o=600;function JZe(e,t){if(!e||!t)return;navigator.clipboard?.writeText(t);let r=e.style.outline;e.style.outline=`2px solid ${Gl.renderHud.text}`,setTimeout(()=>{e.style.outline=r},m1o)}function Qkr(e,t,r){let n=[];for(let[o,i]of e){let a=i-(t.get(o)??0);n.push({label:o,total:i,perSecond:r>0?a*1e3/r:0})}return n.sort((o,i)=>i.perSecond-o.perSecond||i.total-o.total)}function Jkr(e){if(e.length===0)return"no renders since reset";let t=Math.max(...e.map(n=>n.label.length));return["renders/s total (click to copy)",...e.map(n=>`${n.label.padEnd(t)} ${n.perSecond.toFixed(0).padStart(4)}/s ${String(n.total).padStart(6)}`)].join(`
3875
3875
  `)}var e_r=C(ee(),1);var g1o=()=>!1;function kSe(){return(0,e_r.useSyncExternalStore)(z3t,Qde,g1o)}var t_r=e=>({position:"fixed",bottom:`calc(8px + ${d1})`,right:8,zIndex:3e3,background:Gl.renderHud.background,color:Gl.renderHud.text,font:`11px/1.4 ${e}`,padding:"6px 8px",borderRadius:4,whiteSpace:"pre",cursor:"pointer",userSelect:"none"});var n_r=C(P(),1),y1o=500;function r_r(){let{font:e}=Pn().tokens,t=(0,tte.useRef)(null),r=(0,tte.useRef)(""),n=kSe();return(0,tte.useEffect)(()=>{if(!n)return;let o=new Map(vP),i=performance.now(),a=requestAnimationFrame(function s(){a=requestAnimationFrame(s);let l=performance.now();if(l-i<y1o)return;let u=Qkr(vP,o,l-i);o=new Map(vP),i=l,r.current=Jkr(u),t.current&&(t.current.textContent=r.current)});return()=>cancelAnimationFrame(a)},[n]),n?(0,n_r.jsx)("div",{ref:t,style:t_r(e.mono),title:"Click to copy",onClick:()=>JZe(t.current,r.current),onKeyDown:()=>JZe(t.current,r.current)}):null}var Xit=C(ee(),1);var MEr=C(ee(),1);var ESe=C(ee(),1);function o_r(e){let{activity:t,status:r}=e;return(t?.kind==="backlog"&&r!=="done"?t.phaseName:void 0)??e.subtitle}var TH={color:"text.disabled",fontFamily:"fontFamilyMono",fontSize:"0.8125rem",whiteSpace:"nowrap",flexShrink:0};var wH=C(P(),1),v1o={...TH,display:"inline-flex",alignItems:"center",gap:.25,borderRadius:.5,px:.25},i_r={fontSize:"0.875rem"};function b1o(e){let[t=""]=e.split("-");return t===e?e.slice(0,8):t}function a_r({conversationId:e,collapsed:t,harness:r}){let{copied:n,copy:o}=d8(e);return t?(0,wH.jsxs)(nr,{sx:v1o,onClick:o,title:n?"Copied the full conversation id":`Click to copy the full conversation id ${e}`,children:[b1o(e),n?(0,wH.jsx)(zc,{sx:i_r}):(0,wH.jsx)(B8,{sx:i_r})]}):(0,wH.jsx)(Ce,{sx:{...TH,userSelect:"all"},title:`${dxt(r)} conversation ${e}`,children:e})}var R4=C(P(),1);function s_r({session:e,collapsed:t}){let{id:r,claudeSessionId:n,harnessSessionId:o}=e,i=n??o,a=i8(Rk(e))?Qa(e.cwd):"";return(0,R4.jsxs)(R4.Fragment,{children:[a&&(0,R4.jsx)(Ce,{sx:{...TH,color:"text.secondary"},title:e.cwd,children:a}),(0,R4.jsx)(Ce,{sx:{...TH,userSelect:"all"},title:`assist session ${r}`,children:`#${r}`}),i&&(0,R4.jsx)(a_r,{conversationId:i,collapsed:t,harness:e.harness})]})}var _Se=C(P(),1),x1o=Bi`
3876
3876
  0%, 100% { opacity: 1; transform: scale(1); }
3877
3877
  50% { opacity: 0.35; transform: scale(0.8); }
3878
- `,l_r={flexShrink:0,fontSize:"1.68rem",lineHeight:.6},S1o={...l_r,animation:`${x1o} 1.4s ease-in-out infinite`,"@media (prefers-reduced-motion: reduce)":{animation:"none"}};function c_r({status:e,label:t=!1}){return t?(0,_Se.jsxs)(G,{component:"span",sx:Ub(Mu[e]),children:[Du[e]," ",e]}):(0,_Se.jsx)(Ce,{variant:"caption",sx:{...Lk(e)?S1o:l_r,color:Mu[e]},title:e,children:"\u25CF"})}var YT=C(P(),1),T1o={flexShrink:0,whiteSpace:"nowrap"};function w1o({session:e}){return iue(e)?(0,YT.jsxs)(G,{component:"span",sx:Ub(Mu.running),children:[Du.running," verifying"]}):(0,YT.jsx)(c_r,{status:Xi(e),label:!0})}function u_r({session:e}){let{restored:t}=e;return(0,YT.jsxs)(YT.Fragment,{children:[(0,YT.jsx)(w1o,{session:e}),t!==void 0&&(0,YT.jsx)(Ce,{variant:"caption",sx:{...T1o,color:t?"success.main":"warning.main"},children:t?"restored":"not restored"})]})}var rte=C(P(),1),C1o={display:"flex",alignItems:"center",gap:.75,minWidth:0},k1o={color:"text.primary",fontSize:"1.25rem",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function d_r({session:e}){return(0,rte.jsxs)(G,{sx:C1o,children:[Yce(e.activity).map(t=>(0,rte.jsx)(oce,{itemId:t,cwd:wl(e)},t)),(0,rte.jsx)(Ce,{variant:"body1",sx:k1o,children:c1(e)})]})}var P4=C(ee(),1);function f_r(e,t){let[r,n]=(0,P4.useState)(0),[o,i]=(0,P4.useState)(!1),a=(0,P4.useRef)(0);return(0,P4.useEffect)(()=>{let s=e.current;if(!s||typeof ResizeObserver>"u")return;let l=new ResizeObserver(()=>n(s.scrollWidth));return l.observe(s),()=>l.disconnect()},[e]),(0,P4.useEffect)(()=>{o||(a.current=r),t!==null&&a.current>0&&i(a.current>t)},[o,r,t]),{width:r,collapsed:o}}var A4=C(P(),1),_1o={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:0,overflow:"hidden"},E1o={display:"flex",alignItems:"center",alignSelf:"flex-start",gap:1},R1o={color:"text.secondary",fontSize:"0.875rem",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function p_r({session:e,minWidth:t,budget:r,onIdentityWidth:n}){let o=(0,ESe.useRef)(null),{width:i,collapsed:a}=f_r(o,r),s=o_r(e);return(0,ESe.useEffect)(()=>n(i),[i,n]),(0,A4.jsxs)(G,{sx:{..._1o,minWidth:`${t}px`},children:[(0,A4.jsxs)(G,{ref:o,sx:E1o,children:[(0,A4.jsx)(s_r,{session:e,collapsed:a}),(0,A4.jsx)(u_r,{session:e})]}),(0,A4.jsx)(d_r,{session:e}),s&&(0,A4.jsx)(Ce,{sx:R1o,children:s})]})}var PEr=C(ee(),1);function Yb(e){let{activity:t,status:r}=e;if(!(r==="done"||t?.kind!=="backlog"||t.itemId==null))return{itemId:t.itemId,phase:t.phase,totalPhases:t.totalPhases}}var eQe=C(P(),1);function h_r({pr:e}){return e.url?(0,eQe.jsx)(Ls,{label:"PR",title:"Open PR",icon:(0,eQe.jsx)(Qle,{sx:{fontSize:14}}),onClick:t=>{t.stopPropagation(),window.open(e.url,"_blank")}}):null}var m_r=C(P(),1),RSe=nt((0,m_r.jsx)("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m0 14H5.17l-.59.59-.58.58V4h16zm-9.5-2H18v-2h-5.5zm3.86-5.87c.2-.2.2-.51 0-.71l-1.77-1.77c-.2-.2-.51-.2-.71 0L6 11.53V14h2.47z"}),"RateReviewOutlined");var C_r=C(ee(),1);var y_r=C(P(),1),P1o=[{label:"Address Comments",args:[]},{label:"Address Comments (batch)",args:["--batch"]},{label:"Address Comments (auto)",args:["--auto"]}];function g_r({review:e,pick:t}){return P1o.map(({label:r,args:n})=>(0,y_r.jsx)(jr,{onClick:o=>t(o,()=>e.launchAddressComments(n)),children:r},r))}var L4=C(P(),1);function v_r({anchorEl:e,onClose:t,review:r,highLevel:n}){let o=(i,a)=>{i.stopPropagation(),t(),a()};return(0,L4.jsxs)(Rs,{anchorEl:e,open:!!e,onClose:t,onClick:i=>i.stopPropagation(),children:[dH.map(i=>(0,L4.jsx)(jr,{onClick:a=>o(a,n&&i.args.includes("--high-level")?n.run:()=>r.launchMode(i.args)),children:i.label},i.label)),(0,L4.jsx)(eo,{}),(0,L4.jsx)(gSe,{value:r.options,onChange:r.setOptions}),(0,L4.jsx)(eo,{}),(0,L4.jsx)(g_r,{review:r,pick:o})]})}function b_r(e,t){let r=e.pendingPrPreview;return r?.kind==="high-level-review"&&r.prNumber===t}function x_r(e,t){return e.assistArgs?.[0]==="review"&&e.assistArgs.includes("--high-level")&&i1(e)===t}function S_r(e,t,r){let{activateSession:n,sendInput:o}=ql(),i=Pn().palette.primary.main;if(!e||!x_r(e,t.number))return;if(b_r(e,t.number))return{run:()=>{n(e.id),Fc(lf("preview",e.id),i)}};let a=r.force?" --force":"";return{run:()=>Gd(o,e.id,`/review-high-level ${t.number}${a}`)}}var T_r=C(ee(),1);function w_r(e,t,r){let{launchAssist:n}=ql(),[o,i]=(0,T_r.useState)(Yee),a={...S4(t),inPlace:!0,launchedFrom:r},s=l=>n(l,e,a);return{options:o,setOptions:i,resetOptions:()=>i(Yee),launchMode:l=>s([...l,String(t.number),...hSe(o)]),launchAddressComments:l=>s(["review-pr-comments",String(t.number),...l])}}var I4=C(P(),1);function k_r({cwd:e,pr:t,session:r}){let n=w_r(e,t,r?.id),o=S_r(r,t,n.options),[i,a]=(0,C_r.useState)(null);return(0,I4.jsxs)(I4.Fragment,{children:[(0,I4.jsx)(Ls,{label:"Review",title:"Review PR",icon:(0,I4.jsx)(RSe,{sx:{fontSize:14}}),onClick:s=>{s.stopPropagation(),n.resetOptions(),a(s.currentTarget)}}),(0,I4.jsx)(v_r,{anchorEl:i,onClose:()=>a(null),review:n,highLevel:o})]})}var nte=C(P(),1),__r=nt((0,nte.jsxs)("g",{fillRule:"evenodd",children:[(0,nte.jsx)("path",{d:"M20 3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H4V5h16z"}),(0,nte.jsx)("path",{d:"M19.41 10.42 17.99 9l-3.17 3.17-1.41-1.42L12 12.16 14.82 15zM5 7h5v2H5zm0 4h5v2H5zm0 4h5v2H5z"})]}),"FactCheckOutlined");var A_r=C(ee(),1);var M4=C(P(),1);function E_r({content:e,onClose:t}){return(0,M4.jsxs)(vl,{open:!0,onClose:t,maxWidth:"md",fullWidth:!0,children:[(0,M4.jsx)(bd,{children:"Review synthesis"}),(0,M4.jsx)(vd,{dividers:!0,children:(0,M4.jsx)(Pl,{className:"markdown",sx:{lineHeight:1.7,"& p":{mt:0},"& a":{color:"primary.main"},wordBreak:"break-word"},html:OT(e)})}),(0,M4.jsx)(op,{children:(0,M4.jsx)(ht,{onClick:t,children:"Close"})})]})}var PSe=C(ee(),1);async function R_r(e,t){try{let r=await Jt(tn(`/api/review/synthesis?cwd=${encodeURIComponent(e)}`,t));if(r.status===404)return{status:"absent"};if(!r.ok)return{status:"error"};let n=await r.json();return typeof n.synthesis!="string"?{status:"absent"}:{status:"ready",content:n.synthesis}}catch(r){return Pr(r,"review synthesis"),{status:"error"}}}function P_r(e,t){let[r,n]=(0,PSe.useState)({status:"loading"}),o=yr();return(0,PSe.useEffect)(()=>{if(!e||!t){n({status:"absent"});return}let i=!1;return n({status:"loading"}),R_r(e,o).then(a=>{i||n(a)}),()=>{i=!0}},[e,t,o]),r}var KT=C(P(),1);function L_r({session:e}){let t=Rk(e)==="review",r=P_r(e.cwd,t),[n,o]=(0,A_r.useState)(!1);return r.status!=="ready"?null:(0,KT.jsxs)(KT.Fragment,{children:[(0,KT.jsx)(Ls,{label:"Findings",title:"View review findings",icon:(0,KT.jsx)(__r,{sx:{fontSize:14}}),onClick:i=>{i.stopPropagation(),o(!0)}}),n&&(0,KT.jsx)(Da,{children:(0,KT.jsx)(E_r,{content:r.content,onClose:()=>o(!1)})})]})}var D4=C(P(),1);function I_r({session:e}){let t=w8(e.cwd,i1(e),e.status),r=e.cwd;return(0,D4.jsxs)(D4.Fragment,{children:[t&&r&&(0,D4.jsx)(h_r,{pr:t}),t&&r&&(0,D4.jsx)(k_r,{cwd:r,pr:t,session:e}),(0,D4.jsx)(L_r,{session:e})]})}var D_r=C(ee(),1);function M_r(e,t){return{onClick:r=>{r.stopPropagation(),r.shiftKey?e():t()},onKeyDown:r=>{r.key!=="Enter"||!r.shiftKey||(r.preventDefault(),r.stopPropagation(),e())}}}var tQe=C(ee(),1);function ASe(e,t,r,n){let[o,i]=(0,tQe.useState)(!1),[a,s]=(0,tQe.useState)(null);return{busy:o,error:a,clearError:()=>s(null),confirm:async()=>{if(!o){i(!0);try{await m8(e,"done",t,n),r()}catch(u){Pr(u,"mark item done"),s(`Failed to mark item ${wn(e)} as done`)}finally{i(!1)}}}}}var Jy=C(P(),1);function N_r({target:e,cwd:t,onDismiss:r,shortcut:n}){let{itemId:o,phase:i,totalPhases:a}=e,[s,l]=(0,D_r.useState)(!1),{busy:u,error:d,clearError:f,confirm:p}=ASe(o,t,()=>{l(!1),r({closeServerRuns:!0})});return(0,Jy.jsxs)(Jy.Fragment,{children:[(0,Jy.jsx)(Ls,{label:"Done",title:"Mark done (Shift skips confirmation)",ariaLabel:"Mark done",shortcut:n,icon:(0,Jy.jsx)(zc,{sx:{fontSize:16}}),...M_r(()=>{p()},()=>l(!0))}),s&&(0,Jy.jsx)(Da,{children:(0,Jy.jsx)(Ho,{title:`Mark ${wn(o)} done`,message:`${i??0} of ${a??0} phases completed. Mark this backlog item as done and end its session?`,confirmLabel:"Mark done",autoFocusConfirm:!0,busy:u,onConfirm:p,onCancel:()=>l(!1)})}),(0,Jy.jsx)(Da,{children:(0,Jy.jsx)(kl,{error:d,onClose:f})})]})}var O_r=C(P(),1),ML=nt((0,O_r.jsx)("path",{d:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8"}),"Replay");var rQe=C(P(),1);function B_r({id:e,onRetry:t,shortcut:r,server:n}){return(0,rQe.jsx)(Ls,{label:"Retry",title:`Retry session ${e}${n?" (shift+click replaces a running server without asking)":""}`,shortcut:r,icon:(0,rQe.jsx)(ML,{sx:{fontSize:14}}),onClick:i=>{i.stopPropagation(),t(n&&i.shiftKey?!0:void 0)}})}var nQe=C(P(),1);function $_r({runName:e,cwd:t,launchedFrom:r}){let{onStart:n}=k8();return(0,nQe.jsx)(Ls,{label:e,title:`Start ${e} (shift+click replaces a running server without asking)`,tone:"start",icon:(0,nQe.jsx)(sy,{sx:{fontSize:16}}),onClick:o=>{o.stopPropagation(),n(e,t,o.shiftKey||void 0,r)}})}var MSe=C(ee(),1);var LSe={textTransform:"none",fontSize:11,justifyContent:"space-between",maxWidth:"100%",overflow:"hidden"};var CH=C(P(),1),A1o={[`& .${oo.lastButton}`]:{minWidth:0,px:.25}};function F_r({label:e,open:t,onClick:r,onDefaultAction:n,disabled:o=!1}){let i=t?Mk:gp,a=typeof e=="string"?`${e} options`:"options";return(0,CH.jsxs)(NC,{size:"small",variant:"outlined",disabled:o,sx:A1o,children:[(0,CH.jsx)(ht,{disabled:o,onClick:n,sx:{...LSe,justifyContent:"center"},children:e}),(0,CH.jsx)(ht,{disabled:o,onClick:r,"aria-label":a,title:a,"aria-haspopup":"true","aria-expanded":t,children:(0,CH.jsx)(i,{sx:{fontSize:18}})})]})}var kH=C(P(),1);function ISe({label:e,open:t,onClick:r,onDefaultAction:n,disabled:o=!1,tooltip:i}){if(n)return(0,kH.jsx)(F_r,{label:e,open:t,onClick:r,onDefaultAction:n,disabled:o});let a=(0,kH.jsx)(ht,{size:"small",variant:"outlined",disabled:o,onClick:r,"aria-haspopup":"true","aria-expanded":t,endIcon:t?(0,kH.jsx)(Mk,{}):(0,kH.jsx)(gp,{}),sx:LSe,fullWidth:!0,children:e});return i?(0,kH.jsx)(sr,{describeChild:!0,title:i,children:a}):a}var DL=C(P(),1);function DSe({runs:e,onSelect:t}){let[r,n]=(0,MSe.useState)(!1),o=(0,MSe.useRef)(null),i=()=>n(!1);return(0,DL.jsxs)(Zr,{ref:o,variant:"outlined",sx:{display:"inline-flex",border:"none"},children:[(0,DL.jsx)(ISe,{label:"server",open:r,onClick:()=>n(!r)}),(0,DL.jsx)(Rs,{anchorEl:o.current,open:r,onClose:i,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{width:200,maxHeight:200}},list:{dense:!0,disablePadding:!0}},children:e.map(a=>(0,DL.jsx)(jr,{onClick:s=>{i(),t(a.name,s.shiftKey||void 0)},sx:{py:.75},children:(0,DL.jsx)(Ce,{sx:{fontSize:13},children:a.name})},a.name))})]})}var NSe=C(ee(),1);function OSe(e){let[t,r]=(0,NSe.useState)([]),n=yr();return(0,NSe.useEffect)(()=>{if(!e){r([]);return}let o=!1;return Jt(tn(`/api/server-runs?cwd=${encodeURIComponent(e)}`,n)).then(i=>i.json()).then(i=>{o||r(Array.isArray(i?.runs)?i.runs:[])}).catch(i=>{Pr(i,"server runs"),o||r([])}),()=>{o=!0}},[e,n]),t}var NL=C(P(),1);function z_r({session:e}){let t=OSe(e.cwd),{onStart:r}=k8();return t.length>2?(0,NL.jsx)(Da,{children:(0,NL.jsx)(DSe,{runs:t,onSelect:(n,o)=>r(n,e.cwd,o,e.id)})}):(0,NL.jsx)(NL.Fragment,{children:t.map(n=>(0,NL.jsx)($_r,{runName:n.name,cwd:e.cwd,launchedFrom:e.id},n.name))})}var U_r=C(P(),1),N4=nt((0,U_r.jsx)("path",{d:"M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"}),"Star");var H_r=C(P(),1),O4=nt((0,H_r.jsx)("path",{d:"m22 9.24-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28z"}),"StarBorder");var BSe=C(P(),1);function W_r({session:e}){let{isStarred:t,toggleStar:r}=mg(),n=t(e);return(0,BSe.jsx)(Ls,{label:n?"Unstar":"Star",title:n?"Unstar":"Star",tone:n?"starred":"muted",pressed:n,icon:n?(0,BSe.jsx)(N4,{sx:{fontSize:16}}):(0,BSe.jsx)(O4,{sx:{fontSize:16}}),onClick:o=>{o.stopPropagation(),r(e)}})}var G_r=C(P(),1),V_r=nt((0,G_r.jsx)("path",{d:"M22 9V7h-2v2h-2v2h2v2h2v-2h2V9zM8 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m0-6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2m0 7c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4m6 5H2v-.99C2.2 16.29 5.3 15 8 15s5.8 1.29 6 2zM12.51 4.05C13.43 5.11 14 6.49 14 8s-.57 2.89-1.49 3.95C14.47 11.7 16 10.04 16 8s-1.53-3.7-3.49-3.95m4.02 9.78C17.42 14.66 18 15.7 18 17v3h2v-3c0-1.45-1.59-2.51-3.47-3.17"}),"GroupAddOutlined");var eEr=C(ee(),1);function q_r(e){return e.joinable===!0}var j_r={"assist-draft":["draft","--once"],"assist-bug":["bug","--once"],"assist-refine":["refine","--once"]};function L1o(e){return e in j_r}function I1o(e,t){let r=[...j_r[e]],n=t?.trim();return n&&r.push(n),r}function Y_r(e,t,r,n,o){if(L1o(e)&&t){r(I1o(e,o),t);return}n(e)}var $Se="Enter prompt...";function XT(e){e.key==="Enter"&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.currentTarget.closest("form")?.requestSubmit())}var Z_r=C(ee(),1);var oQe=C(ee(),1);function K_r(e){return e.ctrlKey||e.altKey||e.metaKey?!1:e.key.length===1&&e.key!==" "}function X_r(e,t){let[r,n]=(0,oQe.useState)(!1),[o,i]=(0,oQe.useState)("");return{open:r,initialFilter:o,onKeyDown:l=>{!e||r||t||K_r(l)&&(l.preventDefault(),i(l.key),n(!0))},toggle:()=>{i(""),n(!r)},close:()=>n(!1)}}var zSe=C(P(),1),_H={position:"absolute",top:"100%",left:0,right:0,mt:.25,maxHeight:200,overflowY:"auto",zIndex:10};function FSe({label:e,children:t,disabled:r=!1,onDefaultAction:n,tooltip:o,typeToOpen:i=!1}){let{open:a,initialFilter:s,onKeyDown:l,toggle:u,close:d}=X_r(i,r),f=(0,Z_r.useRef)(null);return(0,zSe.jsxs)(Zr,{component:"fieldset",ref:f,variant:"outlined",sx:{position:"relative",border:"none",m:0,p:0},onBlur:p=>{f.current?.contains(p.relatedTarget)||d()},onKeyDown:l,children:[(0,zSe.jsx)(ISe,{label:e,open:a,disabled:r,onClick:u,onDefaultAction:n,tooltip:o}),a&&t(d,s)]})}function Q_r(e){return e?{width:320}:{..._H,left:"auto",width:320}}var OL=C(P(),1);function J_r({value:e,onChange:t,onSubmit:r,header:n,anchored:o=!1}){return(0,OL.jsx)(Zr,{elevation:o?0:4,sx:Q_r(o),children:(0,OL.jsxs)(kt,{component:"form",spacing:1,sx:{p:1},onSubmit:i=>{i.preventDefault(),r()},children:[n,(0,OL.jsxs)(kt,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,OL.jsx)($n,{value:e,onChange:i=>t(i.target.value),onKeyDown:XT,placeholder:$Se,size:"small",autoFocus:!0,fullWidth:!0,multiline:!0,maxRows:7,slotProps:{input:{sx:{fontSize:13}}}}),(0,OL.jsx)(ht,{type:"submit",variant:"contained",size:"small",sx:{whiteSpace:"nowrap"},children:"Start"})]})]})})}var USe=C(ee(),1);var M1o="assist:prompt-draft:";function EH(e){let t=M1o+e,[r,n]=(0,USe.useState)(()=>({key:t,prompt:Vl(t)[0]??""})),o=r.key===t?r.prompt:Vl(t)[0]??"",i=(0,USe.useCallback)(a=>{n(s=>{let l=s.key===t?s.prompt:Vl(t)[0]??"",u=typeof a=="function"?a(l):a;return iu(t,u?[u]:[]),{key:t,prompt:u}})},[t]);return[o,i]}var ZT=C(P(),1);function tEr({session:e,shortcut:t}){let{launchAgentInStream:r}=ql(),[n,o]=(0,eEr.useState)(null),[i,a]=EH(`add-agent:${e.id}`);return q_r(e)?(0,ZT.jsxs)(ZT.Fragment,{children:[(0,ZT.jsx)(Ls,{label:"Add agent",title:"Add another agent to this session's workspace",ariaLabel:"add agent",shortcut:t,icon:(0,ZT.jsx)(V_r,{sx:{fontSize:14}}),onClick:s=>{s.stopPropagation(),o(s.currentTarget)}}),(0,ZT.jsx)(Td,{anchorEl:n,open:!!n,onClose:()=>o(null),onClick:s=>s.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:(0,ZT.jsx)(J_r,{anchored:!0,value:i,onChange:a,onSubmit:()=>{r(e.id,i,e.cwd),a(""),o(null)}})})]}):null}var cEr=C(ee(),1);var iQe=C(P(),1);function rEr(e){return(0,iQe.jsx)(TC,{viewBox:"-3 -3 30 30",...e,children:(0,iQe.jsx)("path",{d:"M23.15 2.587L18.21.21a1.494 1.494 0 0 0-1.705.29l-9.46 8.63-4.12-3.128a.999.999 0 0 0-1.276.057L.327 7.261A1 1 0 0 0 .326 8.74L3.899 12 .326 15.26a1 1 0 0 0 .001 1.479L1.65 17.94a.999.999 0 0 0 1.276.057l4.12-3.128 9.46 8.63a1.492 1.492 0 0 0 1.704.29l4.942-2.377A1.5 1.5 0 0 0 24 20.06V3.939a1.5 1.5 0 0 0-.85-1.352zm-5.146 14.861L10.826 12l7.178-5.448v10.896z"})})}var nEr=C(P(),1),D1o={fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"};function HSe({children:e,sx:t,...r}){return(0,nEr.jsx)(TC,{viewBox:"0 0 16 16",sx:[D1o,t??{}].flat(),...r,children:e})}var aQe=C(P(),1);function oEr(e){return(0,aQe.jsx)(HSe,{...e,children:(0,aQe.jsx)("path",{d:"M11 2l3 1.5v9L11 14 4 8l7-6zM2 6l2 2-2 2"})})}var sQe=C(P(),1);function iEr({outlined:e,small:t}){return e?(0,sQe.jsx)(oEr,{}):(0,sQe.jsx)(rEr,{sx:t?{fontSize:14}:void 0})}var WSe={"& .MuiIconButton-root .MuiSvgIcon-root":{fontSize:15}};var lQe=C(P(),1);function aEr({show:e,outlined:t,children:r}){return e?(0,lQe.jsx)(sr,{title:"Open in VS Code",children:(0,lQe.jsx)(G,{component:"span",sx:t?WSe:void 0,children:r})}):r}var sEr="Failed to open VS Code";async function lEr(e,t){try{let r=await Jt(tn(`/api/open-in-code?cwd=${encodeURIComponent(e)}`,t),{method:"POST"});return r.ok?null:(await r.json().catch(()=>null))?.error??sEr}catch(r){return Pr(r,"open in VS Code"),sEr}}var QT=C(P(),1);function GSe({cwd:e,variant:t="toolbar",shortcut:r}){let[n,o]=(0,cEr.useState)(null),i=t==="card",a=yr();return(0,QT.jsxs)(QT.Fragment,{children:[(0,QT.jsx)(aEr,{show:!r,outlined:!i,children:(0,QT.jsx)(Ls,{label:"VS Code",title:r?"Open in VS Code":void 0,ariaLabel:"Open in VS Code",tone:i?"muted":"secondary",size:i?"small":"medium",disabled:!e,shortcut:r,icon:(0,QT.jsx)(iEr,{outlined:!i,small:i}),onClick:s=>{s.stopPropagation(),lEr(e,a).then(l=>l&&o(l))}})}),(0,QT.jsx)(kl,{error:n,onClose:()=>o(null)})]})}var BL=C(P(),1);function uEr({session:e}){return(0,BL.jsxs)(BL.Fragment,{children:[(0,BL.jsx)(tEr,{session:e,shortcut:"focusAddAgent"}),e.cwd&&(0,BL.jsx)(GSe,{cwd:e.cwd,variant:"card",shortcut:e.commandType==="run"?void 0:"focusVsCode"})]})}var dEr=C(P(),1),RH=nt((0,dEr.jsx)("path",{d:"M3 13c0-2.45 1.76-4.47 4.08-4.91l-1.49 1.5L7 11l4-4.01L7 3 5.59 4.41l1.58 1.58v.06C3.7 6.46 1 9.42 1 13c0 3.87 3.13 7 7 7h3v-2H8c-2.76 0-5-2.24-5-5m10 0v7h9v-7zm7 5h-5v-3h5zM13 4h9v7h-9z"}),"MoveUp");var hEr=C(ee(),1);var ote=C(P(),1);function fEr({session:e,queued:t,targets:r,close:n}){let{transfer:o,cancel:i}=Xle();return t?(0,ote.jsx)(jr,{onClick:()=>{n(),i(e.id)},children:"Cancel pending transfer"}):r===null?(0,ote.jsx)(jr,{disabled:!0,children:"Finding nodes\u2026"}):r.length===0?(0,ote.jsx)(jr,{disabled:!0,children:"No connected node has this repo"}):r.map(a=>(0,ote.jsx)(jr,{onClick:()=>{n(),o(e.id,a.node,a.cwd)},children:a.node},a.node))}function pEr(e){let t=e.assistArgs;if(!(e.commandType!=="assist"||!t)&&!(t[0]!=="backlog"||t[1]!=="run"||!t[2]))return t}function PH(e,t){if(!t||!pEr(e)||!e.repoGroup)return[];let r=e.node??t.local,n=t.links.filter(o=>o.state==="connected").map(o=>o.name);return[t.local,...n].filter(o=>o!==r)}var VSe={pending:!1,queued:!1,failed:!1};function AH(e){let t=e.transfer;return t?t.queued?{...VSe,label:`Transfer to ${t.target} pending`,title:`Transfers to ${t.target} once the agent is idle`,queued:!0}:t.error?{...VSe,label:"Retry transfer",title:`Transfer to ${t.target} failed: ${t.error}`,failed:!0}:{...VSe,label:`Transferring to ${t.target}\u2026`,title:`Transferring to ${t.target}`,pending:!0}:{...VSe,label:"Transfer",title:"Transfer to node"}}var jSe=C(ee(),1);function qSe(e,t){return Promise.all(t.map(async r=>{let n=await N1o(e,r).catch(o=>(Pr(o,`clone location on ${r}`),{}));return[r,n]}))}async function N1o(e,t){let r=await Jt(tn(`/api/repo-location?origin=${encodeURIComponent(e)}`,t||void 0));return r.ok?r.json():{}}function YSe(e,t,r){let[n,o]=(0,jSe.useState)(null),i=e.repoGroup?.origin,a=PH(e,t).join("\0");return(0,jSe.useEffect)(()=>{if(!r||!i||!a||!t)return;let s=!1;o(null);let l=a.split("\0"),u=d=>d===t.local?"":d;return qSe(i,l.map(u)).then(d=>{s||o(d.flatMap(([f,p])=>{let{cwd:h}=p;return h?[{node:f||t.local,cwd:h}]:[]}))}),()=>{s=!0}},[r,i,a,t]),a?n:[]}var JT=C(P(),1);function mEr({session:e}){let{nodes:t}=Xle(),[r,n]=(0,hEr.useState)(null),o=AH(e),i=YSe(e,t,r!==null&&!o.queued);return PH(e,t).length===0?null:(0,JT.jsxs)(JT.Fragment,{children:[(0,JT.jsx)(Ls,{label:o.label,title:o.title,tone:o.failed?"starred":"muted",disabled:o.pending,icon:(0,JT.jsx)(RH,{sx:{fontSize:14}}),onClick:a=>{a.stopPropagation(),n(a.currentTarget)}}),(0,JT.jsx)(Rs,{anchorEl:r,open:r!==null,onClose:()=>n(null),children:(0,JT.jsx)(fEr,{session:e,queued:o.queued,targets:i,close:()=>n(null)})})]})}var ym=C(P(),1);function gEr({session:e,onRetry:t,onRestart:r,onDismiss:n}){let o=e.status==="stopped"||e.closing===!0,i=Yb(e);return(0,ym.jsxs)(ym.Fragment,{children:[(0,ym.jsx)(z_r,{session:e}),(0,ym.jsx)(uEr,{session:e}),(0,ym.jsx)(I_r,{session:e}),r&&!o&&(0,ym.jsx)(oue,{id:e.id,onRestart:r,harness:e.harness}),t&&(0,ym.jsx)(B_r,{id:e.id,onRetry:t,server:e.server,shortcut:e.commandType==="run"?"focusVsCode":void 0}),(0,ym.jsx)(W_r,{session:e}),(0,ym.jsx)(mEr,{session:e}),i&&(0,ym.jsx)(N_r,{target:i,cwd:e.cwd,onDismiss:n,shortcut:"focusDone"})]})}var vEr=C(P(),1);function yEr({session:e}){return e.cwd?(0,vEr.jsx)(Gce,{panelSessionId:e.id,cwd:e.cwd,sessionId:e.claudeSessionId,offerBranchDiff:!0,toggleChordHint:!0,countButton:!0}):null}var cQe=C(P(),1),O1o={display:"flex",flexShrink:0};function bEr({session:e,onDismiss:t,childDismiss:r}){let{status:n,id:o}=e;return n==="stopped"||e.closing?null:(0,cQe.jsx)(G,{sx:O1o,children:(0,cQe.jsx)(Jce,{id:o,status:n,onDismiss:t,childDismiss:r})})}var KSe=C(ee(),1);function xEr(e=0,t=null){let[,r]=(0,KSe.useState)(0);(0,KSe.useEffect)(()=>{if(t==null)return;let s=setInterval(()=>r(l=>l+1),1e3);return()=>clearInterval(s)},[t]);let n=t==null?e:e+(Date.now()-t),o=Math.floor(n/1e3),i=Math.floor(o/60),a=o%60;return i>=60?`${Math.floor(i/60)}h ${i%60}m`:i>0?`${i}m ${a}s`:`${a}s`}var TEr=C(P(),1);function SEr({session:e}){let t=xEr(e.runningMs,e.runningSince);return(0,TEr.jsx)(Ce,{variant:"caption",sx:{flexShrink:0,whiteSpace:"nowrap",color:"text.disabled"},children:t})}var XSe=C(P(),1);function wEr({label:e,checked:t,onChange:r,inline:n=!1}){return(0,XSe.jsx)(Da,{children:(0,XSe.jsx)(Gv,{sx:n?{m:0,flexShrink:0}:{m:0,mt:.5},control:(0,XSe.jsx)(qv,{size:"small",checked:t,onChange:o=>r(o.target.checked)}),label:e,slotProps:{typography:{variant:"caption",color:"text.secondary"}}})})}function CEr(e,t){return e==="autoApprove"?t.onSetAutoApprove:t.onSetAutoAdvance}var ite=C(P(),1);function kEr({session:e,onSetAutoApprove:t,onSetAutoAdvance:r}){return(0,ite.jsx)(ite.Fragment,{children:C8(e).map(n=>(0,ite.jsx)(wEr,{inline:!0,label:n.label,checked:n.checked,onChange:CEr(n.key,{onSetAutoApprove:t,onSetAutoAdvance:r})},n.key))})}var ZSe=C(ee(),1);function _Er(e,t,r){let n=1,o=0;for(let i of e){let a=o===0?i:o+t+i;a>r&&o>0?(n++,o=i):o=a}return n}function EEr(e,t,r){if(e.length===0||e.reduce((s,l)=>s+l,0)+t*(e.length-1)<=r)return;let o=_Er(e,t,r),i=Math.ceil(Math.max(...e)),a=Math.max(i,Math.floor(r));for(;i<a;){let s=Math.floor((i+a)/2);_Er(e,t,s)<=o?a=s:i=s+1}return i+1}function B1o(e,t){return e.gap===t.gap&&e.widths.length===t.widths.length&&e.widths.every((r,n)=>r===t.widths[n])}function $1o(e){let t=getComputedStyle(e);return e.getBoundingClientRect().width+(Number.parseFloat(t.marginLeft)||0)+(Number.parseFloat(t.marginRight)||0)}function uQe(e){return Array.from(e.children).flatMap(t=>getComputedStyle(t).display==="contents"?uQe(t):[t])}function REr(e,t){let[r,n]=(0,ZSe.useState)({widths:[],gap:0});if((0,ZSe.useEffect)(()=>{let o=e.current;if(!o||typeof ResizeObserver>"u")return;let i=()=>{let u={widths:uQe(o).map($1o),gap:Number.parseFloat(getComputedStyle(o).columnGap)||0};n(d=>B1o(d,u)?d:u)},a=new ResizeObserver(i),s=()=>{a.disconnect();for(let u of uQe(o))a.observe(u);i()},l=new MutationObserver(s);return l.observe(o,{childList:!0,subtree:!0}),s(),()=>{a.disconnect(),l.disconnect()}},[e]),t!==null)return EEr(r.widths,r.gap,t)}var ew=C(P(),1),F1o={display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"flex-end",gap:1,flexGrow:0,flexShrink:1,flexBasis:"auto",minWidth:0};function AEr({session:e,labelled:t,available:r,onRetry:n,onRestart:o,onDismiss:i,childDismiss:a,onSetAutoApprove:s,onSetAutoAdvance:l}){let u=(0,PEr.useRef)(null),d=REr(u,r);return(0,ew.jsxs)(G,{ref:u,sx:{...F1o,width:d},children:[(0,ew.jsx)(yEr,{session:e}),(0,ew.jsx)(SEr,{session:e}),(0,ew.jsx)(kEr,{session:e,onSetAutoApprove:s,onSetAutoAdvance:l}),(0,ew.jsx)(OLe.Provider,{value:t,children:(0,ew.jsx)(gEr,{session:e,onRetry:n,onRestart:o,onDismiss:i})}),(0,ew.jsx)(bEr,{session:e,onDismiss:i,childDismiss:a})]})}var LEr=C(ee(),1);var dQe=8,z1o=560,U1o=48,H1o=.5;function IEr(e){let t=SN(e),[r,n]=(0,LEr.useState)(0),o=t===null?r:Math.min(r,Math.max(t-U1o,0));return{floor:o,budget:t===null?null:t*H1o,labelled:t===null||t-o>=z1o,available:t===null?null:t-o-dQe,setIdentityWidth:n}}var ate=C(P(),1),W1o={position:"sticky",top:0,zIndex:1,display:"flex",alignItems:"center",gap:`${dQe}px`,px:1.5,py:.75,borderBottom:1,borderColor:"divider",bgcolor:"background.paper",overflow:"hidden"};function DEr({session:e,...t}){let r=(0,MEr.useRef)(null),n=IEr(r);return(0,ate.jsxs)(G,{ref:r,sx:W1o,"data-top-bar-session-id":e.id,children:[(0,ate.jsx)(p_r,{session:e,minWidth:n.floor,budget:n.budget,onIdentityWidth:n.setIdentityWidth}),(0,ate.jsx)(AEr,{session:e,labelled:n.labelled,available:n.available,...t})]})}var OEr=C(P(),1);function NEr({session:e,sessions:t,lifecycle:r}){let n=Rce(t).find(o=>o.session.id===e.id)?.children??[];return(0,OEr.jsx)(DEr,{session:e,...A8(e,r),childDismiss:Bce(e,n,r.onDismiss),onSetAutoApprove:o=>r.onSetAutoApprove(e.id,o),onSetAutoAdvance:o=>r.onSetAutoAdvance(e.id,o)},e.id)}var fQe=C(P(),1),G1o={flexShrink:0};function BEr({session:e,sessions:t,lifecycle:r}){return e===void 0?null:(0,fQe.jsx)(G,{"data-testid":"session-top-bar",sx:G1o,children:(0,fQe.jsx)(NEr,{session:e,sessions:t,lifecycle:r})})}var QSe=C(P(),1),$Er={minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden",bgcolor:"background.paper",borderColor:"divider"},V1o={...$Er,width:"50%",borderLeft:1},q1o={...$Er,width:"100%"};function FEr({sessionId:e,panel:t,sessions:r,sendInput:n}){let{closePanel:o,setPanelScope:i,togglePanelMode:a}=gg();return(0,QSe.jsx)(G,{sx:t.mode==="full"?q1o:V1o,children:(0,QSe.jsx)(ic.Provider,{value:t.node,children:(0,QSe.jsx)(_2e,{cwd:t.cwd,sessionId:t.claudeSessionId,scope:t.scope,onScopeChange:s=>i(e,s),sessions:r,sendInput:n,mode:t.mode,onToggleMode:()=>a(e),onClose:()=>o(e),scrollRegionProps:{"data-diff-session-id":e,tabIndex:-1}})})})}var ste=C(P(),1),j1o={display:"flex",flex:1,minHeight:0,overflow:"hidden"};function zEr({sessionId:e,sessions:t,sendInput:r,children:n}){let o=gg().panelFor(e);return(0,ste.jsxs)(G,{sx:j1o,children:[(0,ste.jsx)(G,{sx:{display:o?.mode==="full"?"none":"flex",width:o?"50%":"100%",minWidth:0},children:n}),o&&e!==null&&(0,ste.jsx)(FEr,{sessionId:e,panel:o,sessions:t,sendInput:r},e)]})}var JSe=C(ee(),1),pQe=(0,JSe.createContext)({mode:"half",full:!1});function LH(){return(0,JSe.useContext)(pQe)}var W3r=C(ee(),1);function Tc(e){return{comments:[],screenshots:[],reviewAfter:!1,announceAfter:!1,draft:!1,autoMerge:!1,...e?{selection:e}:{}}}var HEr=C(P(),1);function UEr(){let{mode:e,onToggleMode:t}=LH();return t?(0,HEr.jsx)(Hde,{mode:e,onToggleMode:t,subject:"preview"}):null}function IH(e,t){return e.kind==="pr-comment"||e.kind==="github-issue-comment"?{label:"Comment",color:"default"}:e.kind==="github-issue-edit"?{label:"Edit issue",color:"warning"}:e.kind==="miro-board"?{label:"Miro boxes",color:"info"}:e.kind==="slack-post"?{label:"Slack post",color:"success"}:e.kind==="show"?{label:"Show",color:"default"}:e.kind==="ask"?{label:"Review",color:"info"}:e.kind==="question"?{label:"Question",color:"info"}:e.kind==="check"?{label:"Check",color:"check"}:e.kind==="design"?{label:"Design",color:"check"}:e.kind==="high-level-review"?{label:"Checklist",color:"info"}:e.kind==="github-issue"?{label:"New issue",color:"success"}:e.kind==="backlog-item"?e.itemType==="bug"?{label:"Bug",color:"warning"}:{label:"Story",color:"info"}:e.prNumber!==null?{label:`Update #${e.prNumber}`,color:"info"}:t?{label:"New draft PR",color:"success"}:{label:"New PR",color:"success"}}var Y1o=/[^\s/]+\/[^\s/#]+#\d+/;function WEr(e){let t=Y1o.exec(e);if(!t)return null;let r=Jle(t[0]);return r?{before:e.slice(0,t.index),reference:t[0],url:r,after:e.slice(t.index+t[0].length)}:null}var Kb=C(P(),1);function Jp({preview:e,draft:t}){let r=IH(e,t),n=WEr(e.title);return(0,Kb.jsxs)(G,{sx:{p:2,display:"flex",alignItems:"center",gap:1},children:[(0,Kb.jsx)(Ce,{variant:"subtitle1",sx:{flex:1,fontWeight:600},children:n?(0,Kb.jsxs)(Kb.Fragment,{children:[n.before,(0,Kb.jsx)(Qr,{href:n.url,target:"_blank",rel:"noreferrer",underline:"hover",children:n.reference}),n.after]}):e.title}),(0,Kb.jsx)(Vn,{size:"small",label:r.label,color:r.color}),(0,Kb.jsx)(UEr,{})]})}var l0={flex:1,minWidth:0,height:"100%",display:"flex",flexDirection:"column",borderLeft:1,borderColor:"divider",bgcolor:"background.paper"};var GEr=C(ee(),1);var Xb=C(P(),1);function VEr({onResult:e,onDismiss:t}){let[r,n]=(0,GEr.useState)(""),o=hue();return(0,Xb.jsxs)(Xb.Fragment,{children:[(0,Xb.jsx)($n,{placeholder:"Add a note for the agent (optional)",multiline:!0,minRows:2,size:"small",value:r,onChange:i=>n(i.target.value),slotProps:{htmlInput:{"aria-label":"Note"}},sx:{px:2,pt:1.5}}),(0,Xb.jsxs)(kt,{direction:"row",spacing:1,sx:{px:2,py:1.5,alignItems:"center",justifyContent:"flex-end"},children:[(0,Xb.jsx)(ht,{variant:"tonal",onClick:t,children:"Dismiss"}),(0,Xb.jsx)(ht,{color:"error",variant:"outlined",onClick:()=>e("doesn't work",r),children:"Doesn't work"}),(0,Xb.jsx)(ht,{color:"success",variant:"contained",onClick:()=>e("works",r),...o,children:"Works"})]})]})}var qEr=C(ee(),1);var jEr=C(P(),1),K1o={"& code":{fontFamily:"fontFamilyMono",fontSize:"0.88em",bgcolor:"action.hover",px:.5,borderRadius:.5},"& a":{color:"primary.main",overflowWrap:"anywhere"}};function B4({text:e}){let t=(0,qEr.useMemo)(()=>Fb(e),[e]);return(0,jEr.jsx)(Pl,{component:"span",sx:K1o,html:t})}var YEr=C(P(),1);function MH({children:e}){return(0,YEr.jsx)(Ce,{variant:"overline",sx:{color:"text.secondary",letterSpacing:1},children:e})}var tw=C(P(),1);function eTe({items:e}){return(0,tw.jsxs)(tw.Fragment,{children:[(0,tw.jsx)(MH,{children:"Before"}),(0,tw.jsx)(G,{sx:{display:"flex",flexWrap:"wrap",gap:.75},children:e.map(t=>(0,tw.jsx)(Vn,{size:"small",variant:"tonal",label:(0,tw.jsx)(B4,{text:t})},t))})]})}var KEr=C(ee(),1);var rw=C(P(),1);function tTe({changed:e}){let[t,r]=(0,KEr.useState)(!1);return(0,rw.jsxs)(G,{children:[(0,rw.jsxs)(nr,{"aria-expanded":t,onClick:()=>r(n=>!n),sx:{gap:.5,color:"text.secondary",borderRadius:1},children:[(0,rw.jsx)(Wo,{fontSize:"small",sx:{transform:t?"rotate(90deg)":"none",transition:"transform 0.15s"}}),(0,rw.jsx)(Ce,{variant:"overline",sx:{letterSpacing:1},children:"What changed"})]}),(0,rw.jsx)(Hv,{in:t,children:(0,rw.jsx)(Ce,{variant:"body2",sx:{color:"text.secondary",pl:3},children:(0,rw.jsx)(B4,{text:e})})})]})}var ev=C(P(),1);function XEr({check:e}){let t=e.before??[];return(0,ev.jsxs)(kt,{spacing:2,sx:{p:2,flex:1,minHeight:0,overflowY:"auto"},children:[t.length>0&&(0,ev.jsx)(kt,{spacing:.75,children:(0,ev.jsx)(eTe,{items:t})}),(0,ev.jsxs)(kt,{spacing:.75,children:[(0,ev.jsx)(MH,{children:"Steps"}),(0,ev.jsx)(G,{component:"ol",sx:{m:0,pl:2.5,display:"grid",gap:.75},children:e.steps.map(r=>(0,ev.jsx)(Ce,{component:"li",variant:"body1",children:(0,ev.jsx)(B4,{text:r})},r))})]}),e.changed&&(0,ev.jsx)(tTe,{changed:e.changed})]})}var qL={};Br(qL,{$brand:()=>rTe,$input:()=>Net,$output:()=>Det,NEVER:()=>hQe,TimePrecision:()=>Fet,ZodAny:()=>Rrt,ZodArray:()=>Irt,ZodBase64:()=>Pwe,ZodBase64URL:()=>Awe,ZodBigInt:()=>cW,ZodBigIntFormat:()=>Mwe,ZodBoolean:()=>lW,ZodCIDRv4:()=>Ewe,ZodCIDRv6:()=>Rwe,ZodCUID:()=>xwe,ZodCUID2:()=>Swe,ZodCatch:()=>ent,ZodCodec:()=>Uwe,ZodCustom:()=>Fte,ZodCustomStringFormat:()=>aW,ZodDate:()=>Dte,ZodDefault:()=>Yrt,ZodDiscriminatedUnion:()=>Drt,ZodE164:()=>Lwe,ZodEmail:()=>ywe,ZodEmoji:()=>vwe,ZodEnum:()=>oW,ZodError:()=>w2o,ZodExactOptional:()=>Vrt,ZodFile:()=>Wrt,ZodFirstPartyTypeKind:()=>fnt,ZodFunction:()=>cnt,ZodGUID:()=>Pte,ZodIPv4:()=>kwe,ZodIPv6:()=>_we,ZodISODate:()=>dwe,ZodISODateTime:()=>uwe,ZodISODuration:()=>pwe,ZodISOTime:()=>fwe,ZodIntersection:()=>Nrt,ZodIssueCode:()=>k2o,ZodJWT:()=>Iwe,ZodKSUID:()=>Cwe,ZodLazy:()=>ant,ZodLiteral:()=>Hrt,ZodMAC:()=>Srt,ZodMap:()=>zrt,ZodNaN:()=>rnt,ZodNanoID:()=>bwe,ZodNever:()=>Art,ZodNonOptional:()=>Fwe,ZodNull:()=>_rt,ZodNullable:()=>jrt,ZodNumber:()=>sW,ZodNumberFormat:()=>VL,ZodObject:()=>Ote,ZodOptional:()=>$we,ZodPipe:()=>zwe,ZodPrefault:()=>Xrt,ZodPromise:()=>lnt,ZodReadonly:()=>nnt,ZodRealError:()=>rh,ZodRecord:()=>$te,ZodSet:()=>Urt,ZodString:()=>iW,ZodStringFormat:()=>oa,ZodSuccess:()=>Jrt,ZodSymbol:()=>Crt,ZodTemplateLiteral:()=>int,ZodTransform:()=>Grt,ZodTuple:()=>Brt,ZodType:()=>ao,ZodULID:()=>Twe,ZodURL:()=>Mte,ZodUUID:()=>ex,ZodUndefined:()=>krt,ZodUnion:()=>Bte,ZodUnknown:()=>Prt,ZodVoid:()=>Lrt,ZodXID:()=>wwe,ZodXor:()=>Mrt,_ZodString:()=>gwe,_default:()=>Krt,_function:()=>P3r,any:()=>s3r,array:()=>Nte,base64:()=>G5r,base64url:()=>V5r,bigint:()=>r3r,boolean:()=>wrt,catch:()=>tnt,check:()=>A3r,cidrv4:()=>H5r,cidrv6:()=>W5r,clone:()=>Gf,codec:()=>_3r,coerce:()=>pnt,config:()=>js,core:()=>iw,cuid:()=>D5r,cuid2:()=>N5r,custom:()=>L3r,date:()=>c3r,decode:()=>hrt,decodeAsync:()=>grt,describe:()=>I3r,discriminatedUnion:()=>m3r,e164:()=>q5r,email:()=>C5r,emoji:()=>I5r,encode:()=>prt,encodeAsync:()=>mrt,endsWith:()=>YH,enum:()=>Owe,exactOptional:()=>qrt,file:()=>T3r,flattenError:()=>gte,float32:()=>Q5r,float64:()=>J5r,formatError:()=>yte,fromJSONSchema:()=>F3r,function:()=>P3r,getErrorMap:()=>E2o,globalRegistry:()=>ld,gt:()=>Qb,gte:()=>Vf,guid:()=>k5r,hash:()=>Z5r,hex:()=>X5r,hostname:()=>K5r,httpUrl:()=>L5r,includes:()=>qH,instanceof:()=>D3r,int:()=>mwe,int32:()=>e3r,int64:()=>n3r,intersection:()=>Ort,ipv4:()=>F5r,ipv6:()=>U5r,iso:()=>nW,json:()=>O3r,jwt:()=>j5r,keyof:()=>u3r,ksuid:()=>$5r,lazy:()=>snt,length:()=>WL,literal:()=>S3r,locales:()=>kte,looseObject:()=>p3r,looseRecord:()=>y3r,lowercase:()=>GH,lt:()=>Zb,lte:()=>bm,mac:()=>z5r,map:()=>v3r,maxLength:()=>HL,maxSize:()=>G4,meta:()=>M3r,mime:()=>KH,minLength:()=>ow,minSize:()=>Jb,multipleOf:()=>W4,nan:()=>k3r,nanoid:()=>M5r,nativeEnum:()=>x3r,negative:()=>ewe,never:()=>Dwe,nonnegative:()=>rwe,nonoptional:()=>Qrt,nonpositive:()=>twe,normalize:()=>XH,null:()=>Ert,nullable:()=>Lte,nullish:()=>w3r,number:()=>Trt,object:()=>d3r,optional:()=>Ate,overwrite:()=>rv,parse:()=>crt,parseAsync:()=>urt,partialRecord:()=>g3r,pipe:()=>Ite,positive:()=>JTe,prefault:()=>Zrt,preprocess:()=>B3r,prettifyError:()=>_Qe,promise:()=>R3r,property:()=>nwe,readonly:()=>ont,record:()=>Frt,refine:()=>unt,regex:()=>WH,regexes:()=>u0,registry:()=>ITe,safeDecode:()=>vrt,safeDecodeAsync:()=>xrt,safeEncode:()=>yrt,safeEncodeAsync:()=>brt,safeParse:()=>drt,safeParseAsync:()=>frt,set:()=>b3r,setErrorMap:()=>_2o,size:()=>UL,slugify:()=>eW,startsWith:()=>jH,strictObject:()=>f3r,string:()=>hwe,stringFormat:()=>Y5r,stringbool:()=>N3r,success:()=>C3r,superRefine:()=>dnt,symbol:()=>i3r,templateLiteral:()=>E3r,toJSONSchema:()=>swe,toLowerCase:()=>QH,toUpperCase:()=>JH,transform:()=>Bwe,treeifyError:()=>kQe,trim:()=>ZH,tuple:()=>$rt,uint32:()=>t3r,uint64:()=>o3r,ulid:()=>O5r,undefined:()=>a3r,union:()=>Nwe,unknown:()=>GL,uppercase:()=>VH,url:()=>A5r,util:()=>cr,uuid:()=>_5r,uuidv4:()=>E5r,uuidv6:()=>R5r,uuidv7:()=>P5r,void:()=>l3r,xid:()=>B5r,xor:()=>h3r});var iw={};Br(iw,{$ZodAny:()=>eet,$ZodArray:()=>iet,$ZodAsyncError:()=>tv,$ZodBase64:()=>GJe,$ZodBase64URL:()=>VJe,$ZodBigInt:()=>kTe,$ZodBigIntFormat:()=>XJe,$ZodBoolean:()=>Ste,$ZodCIDRv4:()=>UJe,$ZodCIDRv6:()=>HJe,$ZodCUID:()=>PJe,$ZodCUID2:()=>AJe,$ZodCatch:()=>ket,$ZodCheck:()=>ga,$ZodCheckBigIntFormat:()=>iJe,$ZodCheckEndsWith:()=>yJe,$ZodCheckGreaterThan:()=>vTe,$ZodCheckIncludes:()=>mJe,$ZodCheckLengthEquals:()=>dJe,$ZodCheckLessThan:()=>yTe,$ZodCheckLowerCase:()=>pJe,$ZodCheckMaxLength:()=>cJe,$ZodCheckMaxSize:()=>aJe,$ZodCheckMimeType:()=>bJe,$ZodCheckMinLength:()=>uJe,$ZodCheckMinSize:()=>sJe,$ZodCheckMultipleOf:()=>nJe,$ZodCheckNumberFormat:()=>oJe,$ZodCheckOverwrite:()=>xJe,$ZodCheckProperty:()=>vJe,$ZodCheckRegex:()=>fJe,$ZodCheckSizeEquals:()=>lJe,$ZodCheckStartsWith:()=>gJe,$ZodCheckStringFormat:()=>UH,$ZodCheckUpperCase:()=>hJe,$ZodCodec:()=>wte,$ZodCustom:()=>Met,$ZodCustomStringFormat:()=>YJe,$ZodDate:()=>oet,$ZodDefault:()=>xet,$ZodDiscriminatedUnion:()=>cet,$ZodE164:()=>qJe,$ZodEmail:()=>kJe,$ZodEmoji:()=>EJe,$ZodEncodeError:()=>$4,$ZodEnum:()=>het,$ZodError:()=>mte,$ZodExactOptional:()=>vet,$ZodFile:()=>get,$ZodFunction:()=>Aet,$ZodGUID:()=>wJe,$ZodIPv4:()=>$Je,$ZodIPv6:()=>FJe,$ZodISODate:()=>NJe,$ZodISODateTime:()=>DJe,$ZodISODuration:()=>BJe,$ZodISOTime:()=>OJe,$ZodIntersection:()=>uet,$ZodJWT:()=>jJe,$ZodKSUID:()=>MJe,$ZodLazy:()=>Iet,$ZodLiteral:()=>met,$ZodMAC:()=>zJe,$ZodMap:()=>fet,$ZodNaN:()=>_et,$ZodNanoID:()=>RJe,$ZodNever:()=>ret,$ZodNonOptional:()=>wet,$ZodNull:()=>JJe,$ZodNullable:()=>bet,$ZodNumber:()=>CTe,$ZodNumberFormat:()=>KJe,$ZodObject:()=>w4r,$ZodObjectJIT:()=>aet,$ZodOptional:()=>ETe,$ZodPipe:()=>Eet,$ZodPrefault:()=>Tet,$ZodPromise:()=>Let,$ZodReadonly:()=>Ret,$ZodRealError:()=>th,$ZodRecord:()=>det,$ZodRegistry:()=>LTe,$ZodSet:()=>pet,$ZodString:()=>zL,$ZodStringFormat:()=>na,$ZodSuccess:()=>Cet,$ZodSymbol:()=>ZJe,$ZodTemplateLiteral:()=>Pet,$ZodTransform:()=>yet,$ZodTuple:()=>_Te,$ZodType:()=>Yn,$ZodULID:()=>LJe,$ZodURL:()=>_Je,$ZodUUID:()=>CJe,$ZodUndefined:()=>QJe,$ZodUnion:()=>Tte,$ZodUnknown:()=>tet,$ZodVoid:()=>net,$ZodXID:()=>IJe,$ZodXor:()=>set,$brand:()=>rTe,$constructor:()=>dt,$input:()=>Net,$output:()=>Det,Doc:()=>xte,JSONSchema:()=>T5r,JSONSchemaGenerator:()=>lwe,NEVER:()=>hQe,TimePrecision:()=>Fet,_any:()=>att,_array:()=>ptt,_base64:()=>KTe,_base64url:()=>XTe,_bigint:()=>Jet,_boolean:()=>Zet,_catch:()=>m2o,_check:()=>S5r,_cidrv4:()=>jTe,_cidrv6:()=>YTe,_coercedBigint:()=>ett,_coercedBoolean:()=>Qet,_coercedDate:()=>dtt,_coercedNumber:()=>Vet,_coercedString:()=>Bet,_cuid:()=>zTe,_cuid2:()=>UTe,_custom:()=>mtt,_date:()=>utt,_decode:()=>lTe,_decodeAsync:()=>uTe,_default:()=>f2o,_discriminatedUnion:()=>e2o,_e164:()=>ZTe,_email:()=>MTe,_emoji:()=>$Te,_encode:()=>sTe,_encodeAsync:()=>cTe,_endsWith:()=>YH,_enum:()=>a2o,_file:()=>htt,_float32:()=>jet,_float64:()=>Yet,_gt:()=>Qb,_gte:()=>Vf,_guid:()=>_te,_includes:()=>qH,_int:()=>qet,_int32:()=>Ket,_int64:()=>ttt,_intersection:()=>t2o,_ipv4:()=>VTe,_ipv6:()=>qTe,_isoDate:()=>Uet,_isoDateTime:()=>zet,_isoDuration:()=>Wet,_isoTime:()=>Het,_jwt:()=>QTe,_ksuid:()=>GTe,_lazy:()=>b2o,_length:()=>WL,_literal:()=>l2o,_lowercase:()=>GH,_lt:()=>Zb,_lte:()=>bm,_mac:()=>$et,_map:()=>o2o,_max:()=>bm,_maxLength:()=>HL,_maxSize:()=>G4,_mime:()=>KH,_min:()=>Vf,_minLength:()=>ow,_minSize:()=>Jb,_multipleOf:()=>W4,_nan:()=>ftt,_nanoid:()=>FTe,_nativeEnum:()=>s2o,_negative:()=>ewe,_never:()=>ltt,_nonnegative:()=>rwe,_nonoptional:()=>p2o,_nonpositive:()=>twe,_normalize:()=>XH,_null:()=>itt,_nullable:()=>d2o,_number:()=>Get,_optional:()=>u2o,_overwrite:()=>rv,_parse:()=>BH,_parseAsync:()=>$H,_pipe:()=>g2o,_positive:()=>JTe,_promise:()=>x2o,_property:()=>nwe,_readonly:()=>y2o,_record:()=>n2o,_refine:()=>gtt,_regex:()=>WH,_safeDecode:()=>fTe,_safeDecodeAsync:()=>hTe,_safeEncode:()=>dTe,_safeEncodeAsync:()=>pTe,_safeParse:()=>FH,_safeParseAsync:()=>zH,_set:()=>i2o,_size:()=>UL,_slugify:()=>eW,_startsWith:()=>jH,_string:()=>Oet,_stringFormat:()=>tW,_stringbool:()=>xtt,_success:()=>h2o,_superRefine:()=>ytt,_symbol:()=>ntt,_templateLiteral:()=>v2o,_toLowerCase:()=>QH,_toUpperCase:()=>JH,_transform:()=>c2o,_trim:()=>ZH,_tuple:()=>r2o,_uint32:()=>Xet,_uint64:()=>rtt,_ulid:()=>HTe,_undefined:()=>ott,_union:()=>Qxo,_unknown:()=>stt,_uppercase:()=>VH,_url:()=>Ete,_uuid:()=>DTe,_uuidv4:()=>NTe,_uuidv6:()=>OTe,_uuidv7:()=>BTe,_void:()=>ctt,_xid:()=>WTe,_xor:()=>Jxo,clone:()=>Gf,config:()=>js,createStandardJSONSchemaMethod:()=>rW,createToJSONSchemaMethod:()=>Stt,decode:()=>wbo,decodeAsync:()=>kbo,describe:()=>vtt,encode:()=>Tbo,encodeAsync:()=>Cbo,extractDefs:()=>q4,finalize:()=>j4,flattenError:()=>gte,formatError:()=>yte,globalConfig:()=>lte,globalRegistry:()=>ld,initializeContext:()=>V4,isValidBase64:()=>WJe,isValidBase64URL:()=>b4r,isValidJWT:()=>x4r,locales:()=>kte,meta:()=>btt,parse:()=>iTe,parseAsync:()=>aTe,prettifyError:()=>_Qe,process:()=>Ni,regexes:()=>u0,registry:()=>ITe,safeDecode:()=>Ebo,safeDecodeAsync:()=>Pbo,safeEncode:()=>_bo,safeEncodeAsync:()=>Rbo,safeParse:()=>EQe,safeParseAsync:()=>RQe,toDotPath:()=>t4r,toJSONSchema:()=>swe,treeifyError:()=>kQe,util:()=>cr,version:()=>SJe});var hQe=Object.freeze({status:"aborted"});function dt(e,t,r){function n(s,l){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,l);let u=a.prototype,d=Object.keys(u);for(let f=0;f<d.length;f++){let p=d[f];p in s||(s[p]=u[p].bind(s))}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(s){var l;let u=r?.Parent?new i:this;n(u,s),(l=u._zod).deferred??(l.deferred=[]);for(let d of u._zod.deferred)d();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var rTe=Symbol("zod_brand"),tv=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},$4=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},lte={};function js(e){return e&&Object.assign(lte,e),lte}var cr={};Br(cr,{BIGINT_FORMAT_RANGES:()=>CQe,Class:()=>gQe,NUMBER_FORMAT_RANGES:()=>wQe,aborted:()=>H4,allowsEval:()=>bQe,assert:()=>ebo,assertEqual:()=>X1o,assertIs:()=>Q1o,assertNever:()=>J1o,assertNotEqual:()=>Z1o,assignProp:()=>z4,base64ToUint8Array:()=>QEr,base64urlToUint8Array:()=>ybo,cached:()=>NH,captureStackTrace:()=>oTe,cleanEnum:()=>gbo,cleanRegex:()=>dte,clone:()=>Gf,cloneDef:()=>rbo,createTransparentProxy:()=>lbo,defineLazy:()=>mo,esc:()=>nTe,escapeRegex:()=>c0,extend:()=>dbo,finalizeIssue:()=>eh,floatSafeRemainder:()=>yQe,getElementAtPath:()=>nbo,getEnumValues:()=>ute,getLengthableOrigin:()=>hte,getParsedType:()=>sbo,getSizableOrigin:()=>pte,hexToUint8Array:()=>bbo,isObject:()=>$L,isPlainObject:()=>U4,issue:()=>OH,joinValues:()=>Pt,jsonStringifyReplacer:()=>DH,merge:()=>pbo,mergeDefs:()=>nw,normalizeParams:()=>hr,nullish:()=>F4,numKeys:()=>abo,objectClone:()=>tbo,omit:()=>ubo,optionalKeys:()=>TQe,parsedType:()=>ar,partial:()=>hbo,pick:()=>cbo,prefixIssues:()=>vm,primitiveTypes:()=>SQe,promiseAllObject:()=>obo,propertyKeyTypes:()=>fte,randomString:()=>ibo,required:()=>mbo,safeExtend:()=>fbo,shallowClone:()=>xQe,slugify:()=>vQe,stringifyPrimitive:()=>or,uint8ArrayToBase64:()=>JEr,uint8ArrayToBase64url:()=>vbo,uint8ArrayToHex:()=>xbo,unwrapMessage:()=>cte});function X1o(e){return e}function Z1o(e){return e}function Q1o(e){}function J1o(e){throw new Error("Unexpected value in exhaustive check")}function ebo(e){}function ute(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Pt(e,t="|"){return e.map(r=>or(r)).join(t)}function DH(e,t){return typeof t=="bigint"?t.toString():t}function NH(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function F4(e){return e==null}function dte(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function yQe(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let l=n.match(/\d?e-(\d?)/);l?.[1]&&(o=Number.parseInt(l[1]))}let i=r>o?r:o,a=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return a%s/10**i}var ZEr=Symbol("evaluating");function mo(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ZEr)return n===void 0&&(n=ZEr,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function tbo(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function z4(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function nw(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function rbo(e){return nw(e._zod.def)}function nbo(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function obo(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function ibo(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function nTe(e){return JSON.stringify(e)}function vQe(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var oTe="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function $L(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var bQe=NH(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function U4(e){if($L(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!($L(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function xQe(e){return U4(e)?{...e}:Array.isArray(e)?[...e]:e}function abo(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var sbo=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},fte=new Set(["string","number","symbol"]),SQe=new Set(["string","number","bigint","boolean","symbol","undefined"]);function c0(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Gf(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function hr(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function lbo(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function or(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function TQe(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var wQe={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},CQe={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function cbo(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=nw(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return z4(this,"shape",a),a},checks:[]});return Gf(e,i)}function ubo(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=nw(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return z4(this,"shape",a),a},checks:[]});return Gf(e,i)}function dbo(e,t){if(!U4(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=nw(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return z4(this,"shape",i),i}});return Gf(e,o)}function fbo(e,t){if(!U4(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=nw(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return z4(this,"shape",n),n}});return Gf(e,r)}function pbo(e,t){let r=nw(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return z4(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Gf(e,r)}function hbo(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=nw(t._zod.def,{get shape(){let s=t._zod.def.shape,l={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(l[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)l[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return z4(this,"shape",l),l},checks:[]});return Gf(t,a)}function mbo(e,t,r){let n=nw(t._zod.def,{get shape(){let o=t._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return z4(this,"shape",i),i}});return Gf(t,n)}function H4(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function vm(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function cte(e){return typeof e=="string"?e:e?.message}function eh(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=cte(e.inst?._zod.def?.error?.(e))??cte(t?.error?.(e))??cte(r.customError?.(e))??cte(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function pte(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function hte(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ar(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function OH(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function gbo(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function QEr(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function JEr(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function ybo(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return QEr(t+r)}function vbo(e){return JEr(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function bbo(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function xbo(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var gQe=class{constructor(...t){}};var e4r=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,DH,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},mte=dt("$ZodError",e4r),th=dt("$ZodError",e4r,{Parent:Error});function gte(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function yte(e,t=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let a=r,s=0;for(;s<i.path.length;){let l=i.path[s];s===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(i))):a[l]=a[l]||{_errors:[]},a=a[l],s++}}};return n(e),r}function kQe(e,t=r=>r.message){let r={errors:[]},n=(o,i=[])=>{var a,s;for(let l of o.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>n({issues:u},l.path));else if(l.code==="invalid_key")n({issues:l.issues},l.path);else if(l.code==="invalid_element")n({issues:l.issues},l.path);else{let u=[...i,...l.path];if(u.length===0){r.errors.push(t(l));continue}let d=r,f=0;for(;f<u.length;){let p=u[f],h=f===u.length-1;typeof p=="string"?(d.properties??(d.properties={}),(a=d.properties)[p]??(a[p]={errors:[]}),d=d.properties[p]):(d.items??(d.items=[]),(s=d.items)[p]??(s[p]={errors:[]}),d=d.items[p]),h&&d.errors.push(t(l)),f++}}};return n(e),r}function t4r(e){let t=[],r=e.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?t.push(`[${n}]`):typeof n=="symbol"?t.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?t.push(`[${JSON.stringify(n)}]`):(t.length&&t.push("."),t.push(n));return t.join("")}function _Qe(e){let t=[],r=[...e.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)t.push(`\u2716 ${n.message}`),n.path?.length&&t.push(` \u2192 at ${t4r(n.path)}`);return t.join(`
3878
+ `,l_r={flexShrink:0,fontSize:"1.68rem",lineHeight:.6},S1o={...l_r,animation:`${x1o} 1.4s ease-in-out infinite`,"@media (prefers-reduced-motion: reduce)":{animation:"none"}};function c_r({status:e,label:t=!1}){return t?(0,_Se.jsxs)(G,{component:"span",sx:Ub(Mu[e]),children:[Du[e]," ",e]}):(0,_Se.jsx)(Ce,{variant:"caption",sx:{...Lk(e)?S1o:l_r,color:Mu[e]},title:e,children:"\u25CF"})}var YT=C(P(),1),T1o={flexShrink:0,whiteSpace:"nowrap"};function w1o({session:e}){return iue(e)?(0,YT.jsxs)(G,{component:"span",sx:Ub(Mu.running),children:[Du.running," verifying"]}):(0,YT.jsx)(c_r,{status:Xi(e),label:!0})}function u_r({session:e}){let{restored:t}=e;return(0,YT.jsxs)(YT.Fragment,{children:[(0,YT.jsx)(w1o,{session:e}),t!==void 0&&(0,YT.jsx)(Ce,{variant:"caption",sx:{...T1o,color:t?"success.main":"warning.main"},children:t?"restored":"not restored"})]})}var rte=C(P(),1),C1o={display:"flex",alignItems:"center",gap:.75,minWidth:0},k1o={color:"text.primary",fontSize:"1.25rem",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function d_r({session:e}){return(0,rte.jsxs)(G,{sx:C1o,children:[Yce(e.activity).map(t=>(0,rte.jsx)(oce,{itemId:t,cwd:wl(e)},t)),(0,rte.jsx)(Ce,{variant:"body1",sx:k1o,children:c1(e)})]})}var P4=C(ee(),1);function f_r(e,t){let[r,n]=(0,P4.useState)(0),[o,i]=(0,P4.useState)(!1),a=(0,P4.useRef)(0);return(0,P4.useEffect)(()=>{let s=e.current;if(!s||typeof ResizeObserver>"u")return;let l=new ResizeObserver(()=>n(s.scrollWidth));return l.observe(s),()=>l.disconnect()},[e]),(0,P4.useEffect)(()=>{o||(a.current=r),t!==null&&a.current>0&&i(a.current>t)},[o,r,t]),{width:r,collapsed:o}}var A4=C(P(),1),_1o={display:"flex",flexDirection:"column",flexGrow:1,flexShrink:1,flexBasis:0,overflow:"hidden"},E1o={display:"flex",alignItems:"center",alignSelf:"flex-start",gap:1},R1o={color:"text.secondary",fontSize:"0.875rem",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function p_r({session:e,minWidth:t,budget:r,onIdentityWidth:n}){let o=(0,ESe.useRef)(null),{width:i,collapsed:a}=f_r(o,r),s=o_r(e);return(0,ESe.useEffect)(()=>n(i),[i,n]),(0,A4.jsxs)(G,{sx:{..._1o,minWidth:`${t}px`},children:[(0,A4.jsxs)(G,{ref:o,sx:E1o,children:[(0,A4.jsx)(s_r,{session:e,collapsed:a}),(0,A4.jsx)(u_r,{session:e})]}),(0,A4.jsx)(d_r,{session:e}),s&&(0,A4.jsx)(Ce,{sx:R1o,children:s})]})}var PEr=C(ee(),1);function Yb(e){let{activity:t,status:r}=e;if(!(r==="done"||t?.kind!=="backlog"||t.itemId==null))return{itemId:t.itemId,phase:t.phase,totalPhases:t.totalPhases}}var eQe=C(P(),1);function h_r({pr:e}){return e.url?(0,eQe.jsx)(Ls,{label:"PR",title:"Open PR",icon:(0,eQe.jsx)(Qle,{sx:{fontSize:14}}),onClick:t=>{t.stopPropagation(),window.open(e.url,"_blank")}}):null}var m_r=C(P(),1),RSe=nt((0,m_r.jsx)("path",{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m0 14H5.17l-.59.59-.58.58V4h16zm-9.5-2H18v-2h-5.5zm3.86-5.87c.2-.2.2-.51 0-.71l-1.77-1.77c-.2-.2-.51-.2-.71 0L6 11.53V14h2.47z"}),"RateReviewOutlined");var C_r=C(ee(),1);var y_r=C(P(),1),P1o=[{label:"Address Comments",args:[]},{label:"Address Comments (auto)",args:["--auto"]}];function g_r({review:e,pick:t}){return P1o.map(({label:r,args:n})=>(0,y_r.jsx)(jr,{onClick:o=>t(o,()=>e.launchAddressComments(n)),children:r},r))}var L4=C(P(),1);function v_r({anchorEl:e,onClose:t,review:r,highLevel:n}){let o=(i,a)=>{i.stopPropagation(),t(),a()};return(0,L4.jsxs)(Rs,{anchorEl:e,open:!!e,onClose:t,onClick:i=>i.stopPropagation(),children:[dH.map(i=>(0,L4.jsx)(jr,{onClick:a=>o(a,n&&i.args.includes("--high-level")?n.run:()=>r.launchMode(i.args)),children:i.label},i.label)),(0,L4.jsx)(eo,{}),(0,L4.jsx)(gSe,{value:r.options,onChange:r.setOptions}),(0,L4.jsx)(eo,{}),(0,L4.jsx)(g_r,{review:r,pick:o})]})}function b_r(e,t){let r=e.pendingPrPreview;return r?.kind==="high-level-review"&&r.prNumber===t}function x_r(e,t){return e.assistArgs?.[0]==="review"&&e.assistArgs.includes("--high-level")&&i1(e)===t}function S_r(e,t,r){let{activateSession:n,sendInput:o}=ql(),i=Pn().palette.primary.main;if(!e||!x_r(e,t.number))return;if(b_r(e,t.number))return{run:()=>{n(e.id),Fc(lf("preview",e.id),i)}};let a=r.force?" --force":"";return{run:()=>Gd(o,e.id,`/review-high-level ${t.number}${a}`)}}var T_r=C(ee(),1);function w_r(e,t,r){let{launchAssist:n}=ql(),[o,i]=(0,T_r.useState)(Yee),a={...S4(t),inPlace:!0,launchedFrom:r},s=l=>n(l,e,a);return{options:o,setOptions:i,resetOptions:()=>i(Yee),launchMode:l=>s([...l,String(t.number),...hSe(o)]),launchAddressComments:l=>s(["review-pr-comments",String(t.number),...l])}}var I4=C(P(),1);function k_r({cwd:e,pr:t,session:r}){let n=w_r(e,t,r?.id),o=S_r(r,t,n.options),[i,a]=(0,C_r.useState)(null);return(0,I4.jsxs)(I4.Fragment,{children:[(0,I4.jsx)(Ls,{label:"Review",title:"Review PR",icon:(0,I4.jsx)(RSe,{sx:{fontSize:14}}),onClick:s=>{s.stopPropagation(),n.resetOptions(),a(s.currentTarget)}}),(0,I4.jsx)(v_r,{anchorEl:i,onClose:()=>a(null),review:n,highLevel:o})]})}var nte=C(P(),1),__r=nt((0,nte.jsxs)("g",{fillRule:"evenodd",children:[(0,nte.jsx)("path",{d:"M20 3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H4V5h16z"}),(0,nte.jsx)("path",{d:"M19.41 10.42 17.99 9l-3.17 3.17-1.41-1.42L12 12.16 14.82 15zM5 7h5v2H5zm0 4h5v2H5zm0 4h5v2H5z"})]}),"FactCheckOutlined");var A_r=C(ee(),1);var M4=C(P(),1);function E_r({content:e,onClose:t}){return(0,M4.jsxs)(vl,{open:!0,onClose:t,maxWidth:"md",fullWidth:!0,children:[(0,M4.jsx)(bd,{children:"Review synthesis"}),(0,M4.jsx)(vd,{dividers:!0,children:(0,M4.jsx)(Pl,{className:"markdown",sx:{lineHeight:1.7,"& p":{mt:0},"& a":{color:"primary.main"},wordBreak:"break-word"},html:OT(e)})}),(0,M4.jsx)(op,{children:(0,M4.jsx)(ht,{onClick:t,children:"Close"})})]})}var PSe=C(ee(),1);async function R_r(e,t){try{let r=await Jt(tn(`/api/review/synthesis?cwd=${encodeURIComponent(e)}`,t));if(r.status===404)return{status:"absent"};if(!r.ok)return{status:"error"};let n=await r.json();return typeof n.synthesis!="string"?{status:"absent"}:{status:"ready",content:n.synthesis}}catch(r){return Pr(r,"review synthesis"),{status:"error"}}}function P_r(e,t){let[r,n]=(0,PSe.useState)({status:"loading"}),o=yr();return(0,PSe.useEffect)(()=>{if(!e||!t){n({status:"absent"});return}let i=!1;return n({status:"loading"}),R_r(e,o).then(a=>{i||n(a)}),()=>{i=!0}},[e,t,o]),r}var KT=C(P(),1);function L_r({session:e}){let t=Rk(e)==="review",r=P_r(e.cwd,t),[n,o]=(0,A_r.useState)(!1);return r.status!=="ready"?null:(0,KT.jsxs)(KT.Fragment,{children:[(0,KT.jsx)(Ls,{label:"Findings",title:"View review findings",icon:(0,KT.jsx)(__r,{sx:{fontSize:14}}),onClick:i=>{i.stopPropagation(),o(!0)}}),n&&(0,KT.jsx)(Da,{children:(0,KT.jsx)(E_r,{content:r.content,onClose:()=>o(!1)})})]})}var D4=C(P(),1);function I_r({session:e}){let t=w8(e.cwd,i1(e),e.status),r=e.cwd;return(0,D4.jsxs)(D4.Fragment,{children:[t&&r&&(0,D4.jsx)(h_r,{pr:t}),t&&r&&(0,D4.jsx)(k_r,{cwd:r,pr:t,session:e}),(0,D4.jsx)(L_r,{session:e})]})}var D_r=C(ee(),1);function M_r(e,t){return{onClick:r=>{r.stopPropagation(),r.shiftKey?e():t()},onKeyDown:r=>{r.key!=="Enter"||!r.shiftKey||(r.preventDefault(),r.stopPropagation(),e())}}}var tQe=C(ee(),1);function ASe(e,t,r,n){let[o,i]=(0,tQe.useState)(!1),[a,s]=(0,tQe.useState)(null);return{busy:o,error:a,clearError:()=>s(null),confirm:async()=>{if(!o){i(!0);try{await m8(e,"done",t,n),r()}catch(u){Pr(u,"mark item done"),s(`Failed to mark item ${wn(e)} as done`)}finally{i(!1)}}}}}var Jy=C(P(),1);function N_r({target:e,cwd:t,onDismiss:r,shortcut:n}){let{itemId:o,phase:i,totalPhases:a}=e,[s,l]=(0,D_r.useState)(!1),{busy:u,error:d,clearError:f,confirm:p}=ASe(o,t,()=>{l(!1),r({closeServerRuns:!0})});return(0,Jy.jsxs)(Jy.Fragment,{children:[(0,Jy.jsx)(Ls,{label:"Done",title:"Mark done (Shift skips confirmation)",ariaLabel:"Mark done",shortcut:n,icon:(0,Jy.jsx)(zc,{sx:{fontSize:16}}),...M_r(()=>{p()},()=>l(!0))}),s&&(0,Jy.jsx)(Da,{children:(0,Jy.jsx)(Ho,{title:`Mark ${wn(o)} done`,message:`${i??0} of ${a??0} phases completed. Mark this backlog item as done and end its session?`,confirmLabel:"Mark done",autoFocusConfirm:!0,busy:u,onConfirm:p,onCancel:()=>l(!1)})}),(0,Jy.jsx)(Da,{children:(0,Jy.jsx)(kl,{error:d,onClose:f})})]})}var O_r=C(P(),1),ML=nt((0,O_r.jsx)("path",{d:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8"}),"Replay");var rQe=C(P(),1);function B_r({id:e,onRetry:t,shortcut:r,server:n}){return(0,rQe.jsx)(Ls,{label:"Retry",title:`Retry session ${e}${n?" (shift+click replaces a running server without asking)":""}`,shortcut:r,icon:(0,rQe.jsx)(ML,{sx:{fontSize:14}}),onClick:i=>{i.stopPropagation(),t(n&&i.shiftKey?!0:void 0)}})}var nQe=C(P(),1);function $_r({runName:e,cwd:t,launchedFrom:r}){let{onStart:n}=k8();return(0,nQe.jsx)(Ls,{label:e,title:`Start ${e} (shift+click replaces a running server without asking)`,tone:"start",icon:(0,nQe.jsx)(sy,{sx:{fontSize:16}}),onClick:o=>{o.stopPropagation(),n(e,t,o.shiftKey||void 0,r)}})}var MSe=C(ee(),1);var LSe={textTransform:"none",fontSize:11,justifyContent:"space-between",maxWidth:"100%",overflow:"hidden"};var CH=C(P(),1),A1o={[`& .${oo.lastButton}`]:{minWidth:0,px:.25}};function F_r({label:e,open:t,onClick:r,onDefaultAction:n,disabled:o=!1}){let i=t?Mk:gp,a=typeof e=="string"?`${e} options`:"options";return(0,CH.jsxs)(NC,{size:"small",variant:"outlined",disabled:o,sx:A1o,children:[(0,CH.jsx)(ht,{disabled:o,onClick:n,sx:{...LSe,justifyContent:"center"},children:e}),(0,CH.jsx)(ht,{disabled:o,onClick:r,"aria-label":a,title:a,"aria-haspopup":"true","aria-expanded":t,children:(0,CH.jsx)(i,{sx:{fontSize:18}})})]})}var kH=C(P(),1);function ISe({label:e,open:t,onClick:r,onDefaultAction:n,disabled:o=!1,tooltip:i}){if(n)return(0,kH.jsx)(F_r,{label:e,open:t,onClick:r,onDefaultAction:n,disabled:o});let a=(0,kH.jsx)(ht,{size:"small",variant:"outlined",disabled:o,onClick:r,"aria-haspopup":"true","aria-expanded":t,endIcon:t?(0,kH.jsx)(Mk,{}):(0,kH.jsx)(gp,{}),sx:LSe,fullWidth:!0,children:e});return i?(0,kH.jsx)(sr,{describeChild:!0,title:i,children:a}):a}var DL=C(P(),1);function DSe({runs:e,onSelect:t}){let[r,n]=(0,MSe.useState)(!1),o=(0,MSe.useRef)(null),i=()=>n(!1);return(0,DL.jsxs)(Zr,{ref:o,variant:"outlined",sx:{display:"inline-flex",border:"none"},children:[(0,DL.jsx)(ISe,{label:"server",open:r,onClick:()=>n(!r)}),(0,DL.jsx)(Rs,{anchorEl:o.current,open:r,onClose:i,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{width:200,maxHeight:200}},list:{dense:!0,disablePadding:!0}},children:e.map(a=>(0,DL.jsx)(jr,{onClick:s=>{i(),t(a.name,s.shiftKey||void 0)},sx:{py:.75},children:(0,DL.jsx)(Ce,{sx:{fontSize:13},children:a.name})},a.name))})]})}var NSe=C(ee(),1);function OSe(e){let[t,r]=(0,NSe.useState)([]),n=yr();return(0,NSe.useEffect)(()=>{if(!e){r([]);return}let o=!1;return Jt(tn(`/api/server-runs?cwd=${encodeURIComponent(e)}`,n)).then(i=>i.json()).then(i=>{o||r(Array.isArray(i?.runs)?i.runs:[])}).catch(i=>{Pr(i,"server runs"),o||r([])}),()=>{o=!0}},[e,n]),t}var NL=C(P(),1);function z_r({session:e}){let t=OSe(e.cwd),{onStart:r}=k8();return t.length>2?(0,NL.jsx)(Da,{children:(0,NL.jsx)(DSe,{runs:t,onSelect:(n,o)=>r(n,e.cwd,o,e.id)})}):(0,NL.jsx)(NL.Fragment,{children:t.map(n=>(0,NL.jsx)($_r,{runName:n.name,cwd:e.cwd,launchedFrom:e.id},n.name))})}var U_r=C(P(),1),N4=nt((0,U_r.jsx)("path",{d:"M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"}),"Star");var H_r=C(P(),1),O4=nt((0,H_r.jsx)("path",{d:"m22 9.24-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28z"}),"StarBorder");var BSe=C(P(),1);function W_r({session:e}){let{isStarred:t,toggleStar:r}=mg(),n=t(e);return(0,BSe.jsx)(Ls,{label:n?"Unstar":"Star",title:n?"Unstar":"Star",tone:n?"starred":"muted",pressed:n,icon:n?(0,BSe.jsx)(N4,{sx:{fontSize:16}}):(0,BSe.jsx)(O4,{sx:{fontSize:16}}),onClick:o=>{o.stopPropagation(),r(e)}})}var G_r=C(P(),1),V_r=nt((0,G_r.jsx)("path",{d:"M22 9V7h-2v2h-2v2h2v2h2v-2h2V9zM8 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m0-6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2m0 7c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4m6 5H2v-.99C2.2 16.29 5.3 15 8 15s5.8 1.29 6 2zM12.51 4.05C13.43 5.11 14 6.49 14 8s-.57 2.89-1.49 3.95C14.47 11.7 16 10.04 16 8s-1.53-3.7-3.49-3.95m4.02 9.78C17.42 14.66 18 15.7 18 17v3h2v-3c0-1.45-1.59-2.51-3.47-3.17"}),"GroupAddOutlined");var eEr=C(ee(),1);function q_r(e){return e.joinable===!0}var j_r={"assist-draft":["draft","--once"],"assist-bug":["bug","--once"],"assist-refine":["refine","--once"]};function L1o(e){return e in j_r}function I1o(e,t){let r=[...j_r[e]],n=t?.trim();return n&&r.push(n),r}function Y_r(e,t,r,n,o){if(L1o(e)&&t){r(I1o(e,o),t);return}n(e)}var $Se="Enter prompt...";function XT(e){e.key==="Enter"&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.currentTarget.closest("form")?.requestSubmit())}var Z_r=C(ee(),1);var oQe=C(ee(),1);function K_r(e){return e.ctrlKey||e.altKey||e.metaKey?!1:e.key.length===1&&e.key!==" "}function X_r(e,t){let[r,n]=(0,oQe.useState)(!1),[o,i]=(0,oQe.useState)("");return{open:r,initialFilter:o,onKeyDown:l=>{!e||r||t||K_r(l)&&(l.preventDefault(),i(l.key),n(!0))},toggle:()=>{i(""),n(!r)},close:()=>n(!1)}}var zSe=C(P(),1),_H={position:"absolute",top:"100%",left:0,right:0,mt:.25,maxHeight:200,overflowY:"auto",zIndex:10};function FSe({label:e,children:t,disabled:r=!1,onDefaultAction:n,tooltip:o,typeToOpen:i=!1}){let{open:a,initialFilter:s,onKeyDown:l,toggle:u,close:d}=X_r(i,r),f=(0,Z_r.useRef)(null);return(0,zSe.jsxs)(Zr,{component:"fieldset",ref:f,variant:"outlined",sx:{position:"relative",border:"none",m:0,p:0},onBlur:p=>{f.current?.contains(p.relatedTarget)||d()},onKeyDown:l,children:[(0,zSe.jsx)(ISe,{label:e,open:a,disabled:r,onClick:u,onDefaultAction:n,tooltip:o}),a&&t(d,s)]})}function Q_r(e){return e?{width:320}:{..._H,left:"auto",width:320}}var OL=C(P(),1);function J_r({value:e,onChange:t,onSubmit:r,header:n,anchored:o=!1}){return(0,OL.jsx)(Zr,{elevation:o?0:4,sx:Q_r(o),children:(0,OL.jsxs)(kt,{component:"form",spacing:1,sx:{p:1},onSubmit:i=>{i.preventDefault(),r()},children:[n,(0,OL.jsxs)(kt,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,OL.jsx)($n,{value:e,onChange:i=>t(i.target.value),onKeyDown:XT,placeholder:$Se,size:"small",autoFocus:!0,fullWidth:!0,multiline:!0,maxRows:7,slotProps:{input:{sx:{fontSize:13}}}}),(0,OL.jsx)(ht,{type:"submit",variant:"contained",size:"small",sx:{whiteSpace:"nowrap"},children:"Start"})]})]})})}var USe=C(ee(),1);var M1o="assist:prompt-draft:";function EH(e){let t=M1o+e,[r,n]=(0,USe.useState)(()=>({key:t,prompt:Vl(t)[0]??""})),o=r.key===t?r.prompt:Vl(t)[0]??"",i=(0,USe.useCallback)(a=>{n(s=>{let l=s.key===t?s.prompt:Vl(t)[0]??"",u=typeof a=="function"?a(l):a;return iu(t,u?[u]:[]),{key:t,prompt:u}})},[t]);return[o,i]}var ZT=C(P(),1);function tEr({session:e,shortcut:t}){let{launchAgentInStream:r}=ql(),[n,o]=(0,eEr.useState)(null),[i,a]=EH(`add-agent:${e.id}`);return q_r(e)?(0,ZT.jsxs)(ZT.Fragment,{children:[(0,ZT.jsx)(Ls,{label:"Add agent",title:"Add another agent to this session's workspace",ariaLabel:"add agent",shortcut:t,icon:(0,ZT.jsx)(V_r,{sx:{fontSize:14}}),onClick:s=>{s.stopPropagation(),o(s.currentTarget)}}),(0,ZT.jsx)(Td,{anchorEl:n,open:!!n,onClose:()=>o(null),onClick:s=>s.stopPropagation(),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:(0,ZT.jsx)(J_r,{anchored:!0,value:i,onChange:a,onSubmit:()=>{r(e.id,i,e.cwd),a(""),o(null)}})})]}):null}var cEr=C(ee(),1);var iQe=C(P(),1);function rEr(e){return(0,iQe.jsx)(TC,{viewBox:"-3 -3 30 30",...e,children:(0,iQe.jsx)("path",{d:"M23.15 2.587L18.21.21a1.494 1.494 0 0 0-1.705.29l-9.46 8.63-4.12-3.128a.999.999 0 0 0-1.276.057L.327 7.261A1 1 0 0 0 .326 8.74L3.899 12 .326 15.26a1 1 0 0 0 .001 1.479L1.65 17.94a.999.999 0 0 0 1.276.057l4.12-3.128 9.46 8.63a1.492 1.492 0 0 0 1.704.29l4.942-2.377A1.5 1.5 0 0 0 24 20.06V3.939a1.5 1.5 0 0 0-.85-1.352zm-5.146 14.861L10.826 12l7.178-5.448v10.896z"})})}var nEr=C(P(),1),D1o={fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"};function HSe({children:e,sx:t,...r}){return(0,nEr.jsx)(TC,{viewBox:"0 0 16 16",sx:[D1o,t??{}].flat(),...r,children:e})}var aQe=C(P(),1);function oEr(e){return(0,aQe.jsx)(HSe,{...e,children:(0,aQe.jsx)("path",{d:"M11 2l3 1.5v9L11 14 4 8l7-6zM2 6l2 2-2 2"})})}var sQe=C(P(),1);function iEr({outlined:e,small:t}){return e?(0,sQe.jsx)(oEr,{}):(0,sQe.jsx)(rEr,{sx:t?{fontSize:14}:void 0})}var WSe={"& .MuiIconButton-root .MuiSvgIcon-root":{fontSize:15}};var lQe=C(P(),1);function aEr({show:e,outlined:t,children:r}){return e?(0,lQe.jsx)(sr,{title:"Open in VS Code",children:(0,lQe.jsx)(G,{component:"span",sx:t?WSe:void 0,children:r})}):r}var sEr="Failed to open VS Code";async function lEr(e,t){try{let r=await Jt(tn(`/api/open-in-code?cwd=${encodeURIComponent(e)}`,t),{method:"POST"});return r.ok?null:(await r.json().catch(()=>null))?.error??sEr}catch(r){return Pr(r,"open in VS Code"),sEr}}var QT=C(P(),1);function GSe({cwd:e,variant:t="toolbar",shortcut:r}){let[n,o]=(0,cEr.useState)(null),i=t==="card",a=yr();return(0,QT.jsxs)(QT.Fragment,{children:[(0,QT.jsx)(aEr,{show:!r,outlined:!i,children:(0,QT.jsx)(Ls,{label:"VS Code",title:r?"Open in VS Code":void 0,ariaLabel:"Open in VS Code",tone:i?"muted":"secondary",size:i?"small":"medium",disabled:!e,shortcut:r,icon:(0,QT.jsx)(iEr,{outlined:!i,small:i}),onClick:s=>{s.stopPropagation(),lEr(e,a).then(l=>l&&o(l))}})}),(0,QT.jsx)(kl,{error:n,onClose:()=>o(null)})]})}var BL=C(P(),1);function uEr({session:e}){return(0,BL.jsxs)(BL.Fragment,{children:[(0,BL.jsx)(tEr,{session:e,shortcut:"focusAddAgent"}),e.cwd&&(0,BL.jsx)(GSe,{cwd:e.cwd,variant:"card",shortcut:e.commandType==="run"?void 0:"focusVsCode"})]})}var dEr=C(P(),1),RH=nt((0,dEr.jsx)("path",{d:"M3 13c0-2.45 1.76-4.47 4.08-4.91l-1.49 1.5L7 11l4-4.01L7 3 5.59 4.41l1.58 1.58v.06C3.7 6.46 1 9.42 1 13c0 3.87 3.13 7 7 7h3v-2H8c-2.76 0-5-2.24-5-5m10 0v7h9v-7zm7 5h-5v-3h5zM13 4h9v7h-9z"}),"MoveUp");var hEr=C(ee(),1);var ote=C(P(),1);function fEr({session:e,queued:t,targets:r,close:n}){let{transfer:o,cancel:i}=Xle();return t?(0,ote.jsx)(jr,{onClick:()=>{n(),i(e.id)},children:"Cancel pending transfer"}):r===null?(0,ote.jsx)(jr,{disabled:!0,children:"Finding nodes\u2026"}):r.length===0?(0,ote.jsx)(jr,{disabled:!0,children:"No connected node has this repo"}):r.map(a=>(0,ote.jsx)(jr,{onClick:()=>{n(),o(e.id,a.node,a.cwd)},children:a.node},a.node))}function pEr(e){let t=e.assistArgs;if(!(e.commandType!=="assist"||!t)&&!(t[0]!=="backlog"||t[1]!=="run"||!t[2]))return t}function PH(e,t){if(!t||!pEr(e)||!e.repoGroup)return[];let r=e.node??t.local,n=t.links.filter(o=>o.state==="connected").map(o=>o.name);return[t.local,...n].filter(o=>o!==r)}var VSe={pending:!1,queued:!1,failed:!1};function AH(e){let t=e.transfer;return t?t.queued?{...VSe,label:`Transfer to ${t.target} pending`,title:`Transfers to ${t.target} once the agent is idle`,queued:!0}:t.error?{...VSe,label:"Retry transfer",title:`Transfer to ${t.target} failed: ${t.error}`,failed:!0}:{...VSe,label:`Transferring to ${t.target}\u2026`,title:`Transferring to ${t.target}`,pending:!0}:{...VSe,label:"Transfer",title:"Transfer to node"}}var jSe=C(ee(),1);function qSe(e,t){return Promise.all(t.map(async r=>{let n=await N1o(e,r).catch(o=>(Pr(o,`clone location on ${r}`),{}));return[r,n]}))}async function N1o(e,t){let r=await Jt(tn(`/api/repo-location?origin=${encodeURIComponent(e)}`,t||void 0));return r.ok?r.json():{}}function YSe(e,t,r){let[n,o]=(0,jSe.useState)(null),i=e.repoGroup?.origin,a=PH(e,t).join("\0");return(0,jSe.useEffect)(()=>{if(!r||!i||!a||!t)return;let s=!1;o(null);let l=a.split("\0"),u=d=>d===t.local?"":d;return qSe(i,l.map(u)).then(d=>{s||o(d.flatMap(([f,p])=>{let{cwd:h}=p;return h?[{node:f||t.local,cwd:h}]:[]}))}),()=>{s=!0}},[r,i,a,t]),a?n:[]}var JT=C(P(),1);function mEr({session:e}){let{nodes:t}=Xle(),[r,n]=(0,hEr.useState)(null),o=AH(e),i=YSe(e,t,r!==null&&!o.queued);return PH(e,t).length===0?null:(0,JT.jsxs)(JT.Fragment,{children:[(0,JT.jsx)(Ls,{label:o.label,title:o.title,tone:o.failed?"starred":"muted",disabled:o.pending,icon:(0,JT.jsx)(RH,{sx:{fontSize:14}}),onClick:a=>{a.stopPropagation(),n(a.currentTarget)}}),(0,JT.jsx)(Rs,{anchorEl:r,open:r!==null,onClose:()=>n(null),children:(0,JT.jsx)(fEr,{session:e,queued:o.queued,targets:i,close:()=>n(null)})})]})}var ym=C(P(),1);function gEr({session:e,onRetry:t,onRestart:r,onDismiss:n}){let o=e.status==="stopped"||e.closing===!0,i=Yb(e);return(0,ym.jsxs)(ym.Fragment,{children:[(0,ym.jsx)(z_r,{session:e}),(0,ym.jsx)(uEr,{session:e}),(0,ym.jsx)(I_r,{session:e}),r&&!o&&(0,ym.jsx)(oue,{id:e.id,onRestart:r,harness:e.harness}),t&&(0,ym.jsx)(B_r,{id:e.id,onRetry:t,server:e.server,shortcut:e.commandType==="run"?"focusVsCode":void 0}),(0,ym.jsx)(W_r,{session:e}),(0,ym.jsx)(mEr,{session:e}),i&&(0,ym.jsx)(N_r,{target:i,cwd:e.cwd,onDismiss:n,shortcut:"focusDone"})]})}var vEr=C(P(),1);function yEr({session:e}){return e.cwd?(0,vEr.jsx)(Gce,{panelSessionId:e.id,cwd:e.cwd,sessionId:e.claudeSessionId,offerBranchDiff:!0,toggleChordHint:!0,countButton:!0}):null}var cQe=C(P(),1),O1o={display:"flex",flexShrink:0};function bEr({session:e,onDismiss:t,childDismiss:r}){let{status:n,id:o}=e;return n==="stopped"||e.closing?null:(0,cQe.jsx)(G,{sx:O1o,children:(0,cQe.jsx)(Jce,{id:o,status:n,onDismiss:t,childDismiss:r})})}var KSe=C(ee(),1);function xEr(e=0,t=null){let[,r]=(0,KSe.useState)(0);(0,KSe.useEffect)(()=>{if(t==null)return;let s=setInterval(()=>r(l=>l+1),1e3);return()=>clearInterval(s)},[t]);let n=t==null?e:e+(Date.now()-t),o=Math.floor(n/1e3),i=Math.floor(o/60),a=o%60;return i>=60?`${Math.floor(i/60)}h ${i%60}m`:i>0?`${i}m ${a}s`:`${a}s`}var TEr=C(P(),1);function SEr({session:e}){let t=xEr(e.runningMs,e.runningSince);return(0,TEr.jsx)(Ce,{variant:"caption",sx:{flexShrink:0,whiteSpace:"nowrap",color:"text.disabled"},children:t})}var XSe=C(P(),1);function wEr({label:e,checked:t,onChange:r,inline:n=!1}){return(0,XSe.jsx)(Da,{children:(0,XSe.jsx)(Gv,{sx:n?{m:0,flexShrink:0}:{m:0,mt:.5},control:(0,XSe.jsx)(qv,{size:"small",checked:t,onChange:o=>r(o.target.checked)}),label:e,slotProps:{typography:{variant:"caption",color:"text.secondary"}}})})}function CEr(e,t){return e==="autoApprove"?t.onSetAutoApprove:t.onSetAutoAdvance}var ite=C(P(),1);function kEr({session:e,onSetAutoApprove:t,onSetAutoAdvance:r}){return(0,ite.jsx)(ite.Fragment,{children:C8(e).map(n=>(0,ite.jsx)(wEr,{inline:!0,label:n.label,checked:n.checked,onChange:CEr(n.key,{onSetAutoApprove:t,onSetAutoAdvance:r})},n.key))})}var ZSe=C(ee(),1);function _Er(e,t,r){let n=1,o=0;for(let i of e){let a=o===0?i:o+t+i;a>r&&o>0?(n++,o=i):o=a}return n}function EEr(e,t,r){if(e.length===0||e.reduce((s,l)=>s+l,0)+t*(e.length-1)<=r)return;let o=_Er(e,t,r),i=Math.ceil(Math.max(...e)),a=Math.max(i,Math.floor(r));for(;i<a;){let s=Math.floor((i+a)/2);_Er(e,t,s)<=o?a=s:i=s+1}return i+1}function B1o(e,t){return e.gap===t.gap&&e.widths.length===t.widths.length&&e.widths.every((r,n)=>r===t.widths[n])}function $1o(e){let t=getComputedStyle(e);return e.getBoundingClientRect().width+(Number.parseFloat(t.marginLeft)||0)+(Number.parseFloat(t.marginRight)||0)}function uQe(e){return Array.from(e.children).flatMap(t=>getComputedStyle(t).display==="contents"?uQe(t):[t])}function REr(e,t){let[r,n]=(0,ZSe.useState)({widths:[],gap:0});if((0,ZSe.useEffect)(()=>{let o=e.current;if(!o||typeof ResizeObserver>"u")return;let i=()=>{let u={widths:uQe(o).map($1o),gap:Number.parseFloat(getComputedStyle(o).columnGap)||0};n(d=>B1o(d,u)?d:u)},a=new ResizeObserver(i),s=()=>{a.disconnect();for(let u of uQe(o))a.observe(u);i()},l=new MutationObserver(s);return l.observe(o,{childList:!0,subtree:!0}),s(),()=>{a.disconnect(),l.disconnect()}},[e]),t!==null)return EEr(r.widths,r.gap,t)}var ew=C(P(),1),F1o={display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"flex-end",gap:1,flexGrow:0,flexShrink:1,flexBasis:"auto",minWidth:0};function AEr({session:e,labelled:t,available:r,onRetry:n,onRestart:o,onDismiss:i,childDismiss:a,onSetAutoApprove:s,onSetAutoAdvance:l}){let u=(0,PEr.useRef)(null),d=REr(u,r);return(0,ew.jsxs)(G,{ref:u,sx:{...F1o,width:d},children:[(0,ew.jsx)(yEr,{session:e}),(0,ew.jsx)(SEr,{session:e}),(0,ew.jsx)(kEr,{session:e,onSetAutoApprove:s,onSetAutoAdvance:l}),(0,ew.jsx)(OLe.Provider,{value:t,children:(0,ew.jsx)(gEr,{session:e,onRetry:n,onRestart:o,onDismiss:i})}),(0,ew.jsx)(bEr,{session:e,onDismiss:i,childDismiss:a})]})}var LEr=C(ee(),1);var dQe=8,z1o=560,U1o=48,H1o=.5;function IEr(e){let t=SN(e),[r,n]=(0,LEr.useState)(0),o=t===null?r:Math.min(r,Math.max(t-U1o,0));return{floor:o,budget:t===null?null:t*H1o,labelled:t===null||t-o>=z1o,available:t===null?null:t-o-dQe,setIdentityWidth:n}}var ate=C(P(),1),W1o={position:"sticky",top:0,zIndex:1,display:"flex",alignItems:"center",gap:`${dQe}px`,px:1.5,py:.75,borderBottom:1,borderColor:"divider",bgcolor:"background.paper",overflow:"hidden"};function DEr({session:e,...t}){let r=(0,MEr.useRef)(null),n=IEr(r);return(0,ate.jsxs)(G,{ref:r,sx:W1o,"data-top-bar-session-id":e.id,children:[(0,ate.jsx)(p_r,{session:e,minWidth:n.floor,budget:n.budget,onIdentityWidth:n.setIdentityWidth}),(0,ate.jsx)(AEr,{session:e,labelled:n.labelled,available:n.available,...t})]})}var OEr=C(P(),1);function NEr({session:e,sessions:t,lifecycle:r}){let n=Rce(t).find(o=>o.session.id===e.id)?.children??[];return(0,OEr.jsx)(DEr,{session:e,...A8(e,r),childDismiss:Bce(e,n,r.onDismiss),onSetAutoApprove:o=>r.onSetAutoApprove(e.id,o),onSetAutoAdvance:o=>r.onSetAutoAdvance(e.id,o)},e.id)}var fQe=C(P(),1),G1o={flexShrink:0};function BEr({session:e,sessions:t,lifecycle:r}){return e===void 0?null:(0,fQe.jsx)(G,{"data-testid":"session-top-bar",sx:G1o,children:(0,fQe.jsx)(NEr,{session:e,sessions:t,lifecycle:r})})}var QSe=C(P(),1),$Er={minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden",bgcolor:"background.paper",borderColor:"divider"},V1o={...$Er,width:"50%",borderLeft:1},q1o={...$Er,width:"100%"};function FEr({sessionId:e,panel:t,sessions:r,sendInput:n}){let{closePanel:o,setPanelScope:i,togglePanelMode:a}=gg();return(0,QSe.jsx)(G,{sx:t.mode==="full"?q1o:V1o,children:(0,QSe.jsx)(ic.Provider,{value:t.node,children:(0,QSe.jsx)(_2e,{cwd:t.cwd,sessionId:t.claudeSessionId,scope:t.scope,onScopeChange:s=>i(e,s),sessions:r,sendInput:n,mode:t.mode,onToggleMode:()=>a(e),onClose:()=>o(e),scrollRegionProps:{"data-diff-session-id":e,tabIndex:-1}})})})}var ste=C(P(),1),j1o={display:"flex",flex:1,minHeight:0,overflow:"hidden"};function zEr({sessionId:e,sessions:t,sendInput:r,children:n}){let o=gg().panelFor(e);return(0,ste.jsxs)(G,{sx:j1o,children:[(0,ste.jsx)(G,{sx:{display:o?.mode==="full"?"none":"flex",width:o?"50%":"100%",minWidth:0},children:n}),o&&e!==null&&(0,ste.jsx)(FEr,{sessionId:e,panel:o,sessions:t,sendInput:r},e)]})}var JSe=C(ee(),1),pQe=(0,JSe.createContext)({mode:"half",full:!1});function LH(){return(0,JSe.useContext)(pQe)}var W3r=C(ee(),1);function Tc(e){return{comments:[],screenshots:[],reviewAfter:!1,announceAfter:!1,draft:!1,autoMerge:!1,...e?{selection:e}:{}}}var HEr=C(P(),1);function UEr(){let{mode:e,onToggleMode:t}=LH();return t?(0,HEr.jsx)(Hde,{mode:e,onToggleMode:t,subject:"preview"}):null}function IH(e,t){return e.kind==="pr-comment"||e.kind==="github-issue-comment"?{label:"Comment",color:"default"}:e.kind==="github-issue-edit"?{label:"Edit issue",color:"warning"}:e.kind==="miro-board"?{label:"Miro boxes",color:"info"}:e.kind==="slack-post"?{label:"Slack post",color:"success"}:e.kind==="show"?{label:"Show",color:"default"}:e.kind==="ask"?{label:"Review",color:"info"}:e.kind==="question"?{label:"Question",color:"info"}:e.kind==="check"?{label:"Check",color:"check"}:e.kind==="design"?{label:"Design",color:"check"}:e.kind==="high-level-review"?{label:"Checklist",color:"info"}:e.kind==="github-issue"?{label:"New issue",color:"success"}:e.kind==="backlog-item"?e.itemType==="bug"?{label:"Bug",color:"warning"}:{label:"Story",color:"info"}:e.prNumber!==null?{label:`Update #${e.prNumber}`,color:"info"}:t?{label:"New draft PR",color:"success"}:{label:"New PR",color:"success"}}var Y1o=/[^\s/]+\/[^\s/#]+#\d+/;function WEr(e){let t=Y1o.exec(e);if(!t)return null;let r=Jle(t[0]);return r?{before:e.slice(0,t.index),reference:t[0],url:r,after:e.slice(t.index+t[0].length)}:null}var Kb=C(P(),1);function Jp({preview:e,draft:t}){let r=IH(e,t),n=WEr(e.title);return(0,Kb.jsxs)(G,{sx:{p:2,display:"flex",alignItems:"center",gap:1},children:[(0,Kb.jsx)(Ce,{variant:"subtitle1",sx:{flex:1,fontWeight:600},children:n?(0,Kb.jsxs)(Kb.Fragment,{children:[n.before,(0,Kb.jsx)(Qr,{href:n.url,target:"_blank",rel:"noreferrer",underline:"hover",children:n.reference}),n.after]}):e.title}),(0,Kb.jsx)(Vn,{size:"small",label:r.label,color:r.color}),(0,Kb.jsx)(UEr,{})]})}var l0={flex:1,minWidth:0,height:"100%",display:"flex",flexDirection:"column",borderLeft:1,borderColor:"divider",bgcolor:"background.paper"};var GEr=C(ee(),1);var Xb=C(P(),1);function VEr({onResult:e,onDismiss:t}){let[r,n]=(0,GEr.useState)(""),o=hue();return(0,Xb.jsxs)(Xb.Fragment,{children:[(0,Xb.jsx)($n,{placeholder:"Add a note for the agent (optional)",multiline:!0,minRows:2,size:"small",value:r,onChange:i=>n(i.target.value),slotProps:{htmlInput:{"aria-label":"Note"}},sx:{px:2,pt:1.5}}),(0,Xb.jsxs)(kt,{direction:"row",spacing:1,sx:{px:2,py:1.5,alignItems:"center",justifyContent:"flex-end"},children:[(0,Xb.jsx)(ht,{variant:"tonal",onClick:t,children:"Dismiss"}),(0,Xb.jsx)(ht,{color:"error",variant:"outlined",onClick:()=>e("doesn't work",r),children:"Doesn't work"}),(0,Xb.jsx)(ht,{color:"success",variant:"contained",onClick:()=>e("works",r),...o,children:"Works"})]})]})}var qEr=C(ee(),1);var jEr=C(P(),1),K1o={"& code":{fontFamily:"fontFamilyMono",fontSize:"0.88em",bgcolor:"action.hover",px:.5,borderRadius:.5},"& a":{color:"primary.main",overflowWrap:"anywhere"}};function B4({text:e}){let t=(0,qEr.useMemo)(()=>Fb(e),[e]);return(0,jEr.jsx)(Pl,{component:"span",sx:K1o,html:t})}var YEr=C(P(),1);function MH({children:e}){return(0,YEr.jsx)(Ce,{variant:"overline",sx:{color:"text.secondary",letterSpacing:1},children:e})}var tw=C(P(),1);function eTe({items:e}){return(0,tw.jsxs)(tw.Fragment,{children:[(0,tw.jsx)(MH,{children:"Before"}),(0,tw.jsx)(G,{sx:{display:"flex",flexWrap:"wrap",gap:.75},children:e.map(t=>(0,tw.jsx)(Vn,{size:"small",variant:"tonal",label:(0,tw.jsx)(B4,{text:t})},t))})]})}var KEr=C(ee(),1);var rw=C(P(),1);function tTe({changed:e}){let[t,r]=(0,KEr.useState)(!1);return(0,rw.jsxs)(G,{children:[(0,rw.jsxs)(nr,{"aria-expanded":t,onClick:()=>r(n=>!n),sx:{gap:.5,color:"text.secondary",borderRadius:1},children:[(0,rw.jsx)(Wo,{fontSize:"small",sx:{transform:t?"rotate(90deg)":"none",transition:"transform 0.15s"}}),(0,rw.jsx)(Ce,{variant:"overline",sx:{letterSpacing:1},children:"What changed"})]}),(0,rw.jsx)(Hv,{in:t,children:(0,rw.jsx)(Ce,{variant:"body2",sx:{color:"text.secondary",pl:3},children:(0,rw.jsx)(B4,{text:e})})})]})}var ev=C(P(),1);function XEr({check:e}){let t=e.before??[];return(0,ev.jsxs)(kt,{spacing:2,sx:{p:2,flex:1,minHeight:0,overflowY:"auto"},children:[t.length>0&&(0,ev.jsx)(kt,{spacing:.75,children:(0,ev.jsx)(eTe,{items:t})}),(0,ev.jsxs)(kt,{spacing:.75,children:[(0,ev.jsx)(MH,{children:"Steps"}),(0,ev.jsx)(G,{component:"ol",sx:{m:0,pl:2.5,display:"grid",gap:.75},children:e.steps.map(r=>(0,ev.jsx)(Ce,{component:"li",variant:"body1",children:(0,ev.jsx)(B4,{text:r})},r))})]}),e.changed&&(0,ev.jsx)(tTe,{changed:e.changed})]})}var qL={};Br(qL,{$brand:()=>rTe,$input:()=>Net,$output:()=>Det,NEVER:()=>hQe,TimePrecision:()=>Fet,ZodAny:()=>Rrt,ZodArray:()=>Irt,ZodBase64:()=>Pwe,ZodBase64URL:()=>Awe,ZodBigInt:()=>cW,ZodBigIntFormat:()=>Mwe,ZodBoolean:()=>lW,ZodCIDRv4:()=>Ewe,ZodCIDRv6:()=>Rwe,ZodCUID:()=>xwe,ZodCUID2:()=>Swe,ZodCatch:()=>ent,ZodCodec:()=>Uwe,ZodCustom:()=>Fte,ZodCustomStringFormat:()=>aW,ZodDate:()=>Dte,ZodDefault:()=>Yrt,ZodDiscriminatedUnion:()=>Drt,ZodE164:()=>Lwe,ZodEmail:()=>ywe,ZodEmoji:()=>vwe,ZodEnum:()=>oW,ZodError:()=>w2o,ZodExactOptional:()=>Vrt,ZodFile:()=>Wrt,ZodFirstPartyTypeKind:()=>fnt,ZodFunction:()=>cnt,ZodGUID:()=>Pte,ZodIPv4:()=>kwe,ZodIPv6:()=>_we,ZodISODate:()=>dwe,ZodISODateTime:()=>uwe,ZodISODuration:()=>pwe,ZodISOTime:()=>fwe,ZodIntersection:()=>Nrt,ZodIssueCode:()=>k2o,ZodJWT:()=>Iwe,ZodKSUID:()=>Cwe,ZodLazy:()=>ant,ZodLiteral:()=>Hrt,ZodMAC:()=>Srt,ZodMap:()=>zrt,ZodNaN:()=>rnt,ZodNanoID:()=>bwe,ZodNever:()=>Art,ZodNonOptional:()=>Fwe,ZodNull:()=>_rt,ZodNullable:()=>jrt,ZodNumber:()=>sW,ZodNumberFormat:()=>VL,ZodObject:()=>Ote,ZodOptional:()=>$we,ZodPipe:()=>zwe,ZodPrefault:()=>Xrt,ZodPromise:()=>lnt,ZodReadonly:()=>nnt,ZodRealError:()=>rh,ZodRecord:()=>$te,ZodSet:()=>Urt,ZodString:()=>iW,ZodStringFormat:()=>oa,ZodSuccess:()=>Jrt,ZodSymbol:()=>Crt,ZodTemplateLiteral:()=>int,ZodTransform:()=>Grt,ZodTuple:()=>Brt,ZodType:()=>ao,ZodULID:()=>Twe,ZodURL:()=>Mte,ZodUUID:()=>ex,ZodUndefined:()=>krt,ZodUnion:()=>Bte,ZodUnknown:()=>Prt,ZodVoid:()=>Lrt,ZodXID:()=>wwe,ZodXor:()=>Mrt,_ZodString:()=>gwe,_default:()=>Krt,_function:()=>P3r,any:()=>s3r,array:()=>Nte,base64:()=>G5r,base64url:()=>V5r,bigint:()=>r3r,boolean:()=>wrt,catch:()=>tnt,check:()=>A3r,cidrv4:()=>H5r,cidrv6:()=>W5r,clone:()=>Gf,codec:()=>_3r,coerce:()=>pnt,config:()=>js,core:()=>iw,cuid:()=>D5r,cuid2:()=>N5r,custom:()=>L3r,date:()=>c3r,decode:()=>hrt,decodeAsync:()=>grt,describe:()=>I3r,discriminatedUnion:()=>m3r,e164:()=>q5r,email:()=>C5r,emoji:()=>I5r,encode:()=>prt,encodeAsync:()=>mrt,endsWith:()=>YH,enum:()=>Owe,exactOptional:()=>qrt,file:()=>T3r,flattenError:()=>gte,float32:()=>Q5r,float64:()=>J5r,formatError:()=>yte,fromJSONSchema:()=>F3r,function:()=>P3r,getErrorMap:()=>E2o,globalRegistry:()=>ld,gt:()=>Qb,gte:()=>Vf,guid:()=>k5r,hash:()=>Z5r,hex:()=>X5r,hostname:()=>K5r,httpUrl:()=>L5r,includes:()=>qH,instanceof:()=>D3r,int:()=>mwe,int32:()=>e3r,int64:()=>n3r,intersection:()=>Ort,ipv4:()=>F5r,ipv6:()=>U5r,iso:()=>nW,json:()=>O3r,jwt:()=>j5r,keyof:()=>u3r,ksuid:()=>$5r,lazy:()=>snt,length:()=>WL,literal:()=>S3r,locales:()=>kte,looseObject:()=>p3r,looseRecord:()=>y3r,lowercase:()=>GH,lt:()=>Zb,lte:()=>bm,mac:()=>z5r,map:()=>v3r,maxLength:()=>HL,maxSize:()=>G4,meta:()=>M3r,mime:()=>KH,minLength:()=>ow,minSize:()=>Jb,multipleOf:()=>W4,nan:()=>k3r,nanoid:()=>M5r,nativeEnum:()=>x3r,negative:()=>ewe,never:()=>Dwe,nonnegative:()=>rwe,nonoptional:()=>Qrt,nonpositive:()=>twe,normalize:()=>XH,null:()=>Ert,nullable:()=>Lte,nullish:()=>w3r,number:()=>Trt,object:()=>d3r,optional:()=>Ate,overwrite:()=>rv,parse:()=>crt,parseAsync:()=>urt,partialRecord:()=>g3r,pipe:()=>Ite,positive:()=>JTe,prefault:()=>Zrt,preprocess:()=>B3r,prettifyError:()=>_Qe,promise:()=>R3r,property:()=>nwe,readonly:()=>ont,record:()=>Frt,refine:()=>unt,regex:()=>WH,regexes:()=>u0,registry:()=>ITe,safeDecode:()=>vrt,safeDecodeAsync:()=>xrt,safeEncode:()=>yrt,safeEncodeAsync:()=>brt,safeParse:()=>drt,safeParseAsync:()=>frt,set:()=>b3r,setErrorMap:()=>_2o,size:()=>UL,slugify:()=>eW,startsWith:()=>jH,strictObject:()=>f3r,string:()=>hwe,stringFormat:()=>Y5r,stringbool:()=>N3r,success:()=>C3r,superRefine:()=>dnt,symbol:()=>i3r,templateLiteral:()=>E3r,toJSONSchema:()=>swe,toLowerCase:()=>QH,toUpperCase:()=>JH,transform:()=>Bwe,treeifyError:()=>kQe,trim:()=>ZH,tuple:()=>$rt,uint32:()=>t3r,uint64:()=>o3r,ulid:()=>O5r,undefined:()=>a3r,union:()=>Nwe,unknown:()=>GL,uppercase:()=>VH,url:()=>A5r,util:()=>cr,uuid:()=>_5r,uuidv4:()=>E5r,uuidv6:()=>R5r,uuidv7:()=>P5r,void:()=>l3r,xid:()=>B5r,xor:()=>h3r});var iw={};Br(iw,{$ZodAny:()=>eet,$ZodArray:()=>iet,$ZodAsyncError:()=>tv,$ZodBase64:()=>GJe,$ZodBase64URL:()=>VJe,$ZodBigInt:()=>kTe,$ZodBigIntFormat:()=>XJe,$ZodBoolean:()=>Ste,$ZodCIDRv4:()=>UJe,$ZodCIDRv6:()=>HJe,$ZodCUID:()=>PJe,$ZodCUID2:()=>AJe,$ZodCatch:()=>ket,$ZodCheck:()=>ga,$ZodCheckBigIntFormat:()=>iJe,$ZodCheckEndsWith:()=>yJe,$ZodCheckGreaterThan:()=>vTe,$ZodCheckIncludes:()=>mJe,$ZodCheckLengthEquals:()=>dJe,$ZodCheckLessThan:()=>yTe,$ZodCheckLowerCase:()=>pJe,$ZodCheckMaxLength:()=>cJe,$ZodCheckMaxSize:()=>aJe,$ZodCheckMimeType:()=>bJe,$ZodCheckMinLength:()=>uJe,$ZodCheckMinSize:()=>sJe,$ZodCheckMultipleOf:()=>nJe,$ZodCheckNumberFormat:()=>oJe,$ZodCheckOverwrite:()=>xJe,$ZodCheckProperty:()=>vJe,$ZodCheckRegex:()=>fJe,$ZodCheckSizeEquals:()=>lJe,$ZodCheckStartsWith:()=>gJe,$ZodCheckStringFormat:()=>UH,$ZodCheckUpperCase:()=>hJe,$ZodCodec:()=>wte,$ZodCustom:()=>Met,$ZodCustomStringFormat:()=>YJe,$ZodDate:()=>oet,$ZodDefault:()=>xet,$ZodDiscriminatedUnion:()=>cet,$ZodE164:()=>qJe,$ZodEmail:()=>kJe,$ZodEmoji:()=>EJe,$ZodEncodeError:()=>$4,$ZodEnum:()=>het,$ZodError:()=>mte,$ZodExactOptional:()=>vet,$ZodFile:()=>get,$ZodFunction:()=>Aet,$ZodGUID:()=>wJe,$ZodIPv4:()=>$Je,$ZodIPv6:()=>FJe,$ZodISODate:()=>NJe,$ZodISODateTime:()=>DJe,$ZodISODuration:()=>BJe,$ZodISOTime:()=>OJe,$ZodIntersection:()=>uet,$ZodJWT:()=>jJe,$ZodKSUID:()=>MJe,$ZodLazy:()=>Iet,$ZodLiteral:()=>met,$ZodMAC:()=>zJe,$ZodMap:()=>fet,$ZodNaN:()=>_et,$ZodNanoID:()=>RJe,$ZodNever:()=>ret,$ZodNonOptional:()=>wet,$ZodNull:()=>JJe,$ZodNullable:()=>bet,$ZodNumber:()=>CTe,$ZodNumberFormat:()=>KJe,$ZodObject:()=>w4r,$ZodObjectJIT:()=>aet,$ZodOptional:()=>ETe,$ZodPipe:()=>Eet,$ZodPrefault:()=>Tet,$ZodPromise:()=>Let,$ZodReadonly:()=>Ret,$ZodRealError:()=>th,$ZodRecord:()=>det,$ZodRegistry:()=>LTe,$ZodSet:()=>pet,$ZodString:()=>zL,$ZodStringFormat:()=>na,$ZodSuccess:()=>Cet,$ZodSymbol:()=>ZJe,$ZodTemplateLiteral:()=>Pet,$ZodTransform:()=>yet,$ZodTuple:()=>_Te,$ZodType:()=>Yn,$ZodULID:()=>LJe,$ZodURL:()=>_Je,$ZodUUID:()=>CJe,$ZodUndefined:()=>QJe,$ZodUnion:()=>Tte,$ZodUnknown:()=>tet,$ZodVoid:()=>net,$ZodXID:()=>IJe,$ZodXor:()=>set,$brand:()=>rTe,$constructor:()=>dt,$input:()=>Net,$output:()=>Det,Doc:()=>xte,JSONSchema:()=>T5r,JSONSchemaGenerator:()=>lwe,NEVER:()=>hQe,TimePrecision:()=>Fet,_any:()=>att,_array:()=>ptt,_base64:()=>KTe,_base64url:()=>XTe,_bigint:()=>Jet,_boolean:()=>Zet,_catch:()=>m2o,_check:()=>S5r,_cidrv4:()=>jTe,_cidrv6:()=>YTe,_coercedBigint:()=>ett,_coercedBoolean:()=>Qet,_coercedDate:()=>dtt,_coercedNumber:()=>Vet,_coercedString:()=>Bet,_cuid:()=>zTe,_cuid2:()=>UTe,_custom:()=>mtt,_date:()=>utt,_decode:()=>lTe,_decodeAsync:()=>uTe,_default:()=>f2o,_discriminatedUnion:()=>e2o,_e164:()=>ZTe,_email:()=>MTe,_emoji:()=>$Te,_encode:()=>sTe,_encodeAsync:()=>cTe,_endsWith:()=>YH,_enum:()=>a2o,_file:()=>htt,_float32:()=>jet,_float64:()=>Yet,_gt:()=>Qb,_gte:()=>Vf,_guid:()=>_te,_includes:()=>qH,_int:()=>qet,_int32:()=>Ket,_int64:()=>ttt,_intersection:()=>t2o,_ipv4:()=>VTe,_ipv6:()=>qTe,_isoDate:()=>Uet,_isoDateTime:()=>zet,_isoDuration:()=>Wet,_isoTime:()=>Het,_jwt:()=>QTe,_ksuid:()=>GTe,_lazy:()=>b2o,_length:()=>WL,_literal:()=>l2o,_lowercase:()=>GH,_lt:()=>Zb,_lte:()=>bm,_mac:()=>$et,_map:()=>o2o,_max:()=>bm,_maxLength:()=>HL,_maxSize:()=>G4,_mime:()=>KH,_min:()=>Vf,_minLength:()=>ow,_minSize:()=>Jb,_multipleOf:()=>W4,_nan:()=>ftt,_nanoid:()=>FTe,_nativeEnum:()=>s2o,_negative:()=>ewe,_never:()=>ltt,_nonnegative:()=>rwe,_nonoptional:()=>p2o,_nonpositive:()=>twe,_normalize:()=>XH,_null:()=>itt,_nullable:()=>d2o,_number:()=>Get,_optional:()=>u2o,_overwrite:()=>rv,_parse:()=>BH,_parseAsync:()=>$H,_pipe:()=>g2o,_positive:()=>JTe,_promise:()=>x2o,_property:()=>nwe,_readonly:()=>y2o,_record:()=>n2o,_refine:()=>gtt,_regex:()=>WH,_safeDecode:()=>fTe,_safeDecodeAsync:()=>hTe,_safeEncode:()=>dTe,_safeEncodeAsync:()=>pTe,_safeParse:()=>FH,_safeParseAsync:()=>zH,_set:()=>i2o,_size:()=>UL,_slugify:()=>eW,_startsWith:()=>jH,_string:()=>Oet,_stringFormat:()=>tW,_stringbool:()=>xtt,_success:()=>h2o,_superRefine:()=>ytt,_symbol:()=>ntt,_templateLiteral:()=>v2o,_toLowerCase:()=>QH,_toUpperCase:()=>JH,_transform:()=>c2o,_trim:()=>ZH,_tuple:()=>r2o,_uint32:()=>Xet,_uint64:()=>rtt,_ulid:()=>HTe,_undefined:()=>ott,_union:()=>Qxo,_unknown:()=>stt,_uppercase:()=>VH,_url:()=>Ete,_uuid:()=>DTe,_uuidv4:()=>NTe,_uuidv6:()=>OTe,_uuidv7:()=>BTe,_void:()=>ctt,_xid:()=>WTe,_xor:()=>Jxo,clone:()=>Gf,config:()=>js,createStandardJSONSchemaMethod:()=>rW,createToJSONSchemaMethod:()=>Stt,decode:()=>wbo,decodeAsync:()=>kbo,describe:()=>vtt,encode:()=>Tbo,encodeAsync:()=>Cbo,extractDefs:()=>q4,finalize:()=>j4,flattenError:()=>gte,formatError:()=>yte,globalConfig:()=>lte,globalRegistry:()=>ld,initializeContext:()=>V4,isValidBase64:()=>WJe,isValidBase64URL:()=>b4r,isValidJWT:()=>x4r,locales:()=>kte,meta:()=>btt,parse:()=>iTe,parseAsync:()=>aTe,prettifyError:()=>_Qe,process:()=>Ni,regexes:()=>u0,registry:()=>ITe,safeDecode:()=>Ebo,safeDecodeAsync:()=>Pbo,safeEncode:()=>_bo,safeEncodeAsync:()=>Rbo,safeParse:()=>EQe,safeParseAsync:()=>RQe,toDotPath:()=>t4r,toJSONSchema:()=>swe,treeifyError:()=>kQe,util:()=>cr,version:()=>SJe});var hQe=Object.freeze({status:"aborted"});function dt(e,t,r){function n(s,l){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,l);let u=a.prototype,d=Object.keys(u);for(let f=0;f<d.length;f++){let p=d[f];p in s||(s[p]=u[p].bind(s))}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(s){var l;let u=r?.Parent?new i:this;n(u,s),(l=u._zod).deferred??(l.deferred=[]);for(let d of u._zod.deferred)d();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var rTe=Symbol("zod_brand"),tv=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},$4=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},lte={};function js(e){return e&&Object.assign(lte,e),lte}var cr={};Br(cr,{BIGINT_FORMAT_RANGES:()=>CQe,Class:()=>gQe,NUMBER_FORMAT_RANGES:()=>wQe,aborted:()=>H4,allowsEval:()=>bQe,assert:()=>ebo,assertEqual:()=>X1o,assertIs:()=>Q1o,assertNever:()=>J1o,assertNotEqual:()=>Z1o,assignProp:()=>z4,base64ToUint8Array:()=>QEr,base64urlToUint8Array:()=>ybo,cached:()=>NH,captureStackTrace:()=>oTe,cleanEnum:()=>gbo,cleanRegex:()=>dte,clone:()=>Gf,cloneDef:()=>rbo,createTransparentProxy:()=>lbo,defineLazy:()=>mo,esc:()=>nTe,escapeRegex:()=>c0,extend:()=>dbo,finalizeIssue:()=>eh,floatSafeRemainder:()=>yQe,getElementAtPath:()=>nbo,getEnumValues:()=>ute,getLengthableOrigin:()=>hte,getParsedType:()=>sbo,getSizableOrigin:()=>pte,hexToUint8Array:()=>bbo,isObject:()=>$L,isPlainObject:()=>U4,issue:()=>OH,joinValues:()=>Pt,jsonStringifyReplacer:()=>DH,merge:()=>pbo,mergeDefs:()=>nw,normalizeParams:()=>hr,nullish:()=>F4,numKeys:()=>abo,objectClone:()=>tbo,omit:()=>ubo,optionalKeys:()=>TQe,parsedType:()=>ar,partial:()=>hbo,pick:()=>cbo,prefixIssues:()=>vm,primitiveTypes:()=>SQe,promiseAllObject:()=>obo,propertyKeyTypes:()=>fte,randomString:()=>ibo,required:()=>mbo,safeExtend:()=>fbo,shallowClone:()=>xQe,slugify:()=>vQe,stringifyPrimitive:()=>or,uint8ArrayToBase64:()=>JEr,uint8ArrayToBase64url:()=>vbo,uint8ArrayToHex:()=>xbo,unwrapMessage:()=>cte});function X1o(e){return e}function Z1o(e){return e}function Q1o(e){}function J1o(e){throw new Error("Unexpected value in exhaustive check")}function ebo(e){}function ute(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Pt(e,t="|"){return e.map(r=>or(r)).join(t)}function DH(e,t){return typeof t=="bigint"?t.toString():t}function NH(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function F4(e){return e==null}function dte(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function yQe(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let l=n.match(/\d?e-(\d?)/);l?.[1]&&(o=Number.parseInt(l[1]))}let i=r>o?r:o,a=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return a%s/10**i}var ZEr=Symbol("evaluating");function mo(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ZEr)return n===void 0&&(n=ZEr,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function tbo(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function z4(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function nw(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function rbo(e){return nw(e._zod.def)}function nbo(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function obo(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function ibo(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function nTe(e){return JSON.stringify(e)}function vQe(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var oTe="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function $L(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var bQe=NH(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function U4(e){if($L(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!($L(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function xQe(e){return U4(e)?{...e}:Array.isArray(e)?[...e]:e}function abo(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var sbo=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},fte=new Set(["string","number","symbol"]),SQe=new Set(["string","number","bigint","boolean","symbol","undefined"]);function c0(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Gf(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function hr(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function lbo(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function or(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function TQe(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var wQe={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},CQe={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function cbo(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=nw(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return z4(this,"shape",a),a},checks:[]});return Gf(e,i)}function ubo(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=nw(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return z4(this,"shape",a),a},checks:[]});return Gf(e,i)}function dbo(e,t){if(!U4(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=nw(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return z4(this,"shape",i),i}});return Gf(e,o)}function fbo(e,t){if(!U4(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=nw(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return z4(this,"shape",n),n}});return Gf(e,r)}function pbo(e,t){let r=nw(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return z4(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Gf(e,r)}function hbo(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=nw(t._zod.def,{get shape(){let s=t._zod.def.shape,l={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(l[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)l[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return z4(this,"shape",l),l},checks:[]});return Gf(t,a)}function mbo(e,t,r){let n=nw(t._zod.def,{get shape(){let o=t._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return z4(this,"shape",i),i}});return Gf(t,n)}function H4(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function vm(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function cte(e){return typeof e=="string"?e:e?.message}function eh(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=cte(e.inst?._zod.def?.error?.(e))??cte(t?.error?.(e))??cte(r.customError?.(e))??cte(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function pte(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function hte(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ar(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function OH(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function gbo(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function QEr(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function JEr(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function ybo(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return QEr(t+r)}function vbo(e){return JEr(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function bbo(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function xbo(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var gQe=class{constructor(...t){}};var e4r=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,DH,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},mte=dt("$ZodError",e4r),th=dt("$ZodError",e4r,{Parent:Error});function gte(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function yte(e,t=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let a=r,s=0;for(;s<i.path.length;){let l=i.path[s];s===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(i))):a[l]=a[l]||{_errors:[]},a=a[l],s++}}};return n(e),r}function kQe(e,t=r=>r.message){let r={errors:[]},n=(o,i=[])=>{var a,s;for(let l of o.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>n({issues:u},l.path));else if(l.code==="invalid_key")n({issues:l.issues},l.path);else if(l.code==="invalid_element")n({issues:l.issues},l.path);else{let u=[...i,...l.path];if(u.length===0){r.errors.push(t(l));continue}let d=r,f=0;for(;f<u.length;){let p=u[f],h=f===u.length-1;typeof p=="string"?(d.properties??(d.properties={}),(a=d.properties)[p]??(a[p]={errors:[]}),d=d.properties[p]):(d.items??(d.items=[]),(s=d.items)[p]??(s[p]={errors:[]}),d=d.items[p]),h&&d.errors.push(t(l)),f++}}};return n(e),r}function t4r(e){let t=[],r=e.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?t.push(`[${n}]`):typeof n=="symbol"?t.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?t.push(`[${JSON.stringify(n)}]`):(t.length&&t.push("."),t.push(n));return t.join("")}function _Qe(e){let t=[],r=[...e.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)t.push(`\u2716 ${n.message}`),n.path?.length&&t.push(` \u2192 at ${t4r(n.path)}`);return t.join(`
3879
3879
  `)}var BH=e=>(t,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new tv;if(a.issues.length){let s=new(o?.Err??e)(a.issues.map(l=>eh(l,i,js())));throw oTe(s,o?.callee),s}return a.value},iTe=BH(th),$H=e=>async(t,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??e)(a.issues.map(l=>eh(l,i,js())));throw oTe(s,o?.callee),s}return a.value},aTe=$H(th),FH=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new tv;return i.issues.length?{success:!1,error:new(e??mte)(i.issues.map(a=>eh(a,o,js())))}:{success:!0,data:i.value}},EQe=FH(th),zH=e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>eh(a,o,js())))}:{success:!0,data:i.value}},RQe=zH(th),sTe=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return BH(e)(t,r,o)},Tbo=sTe(th),lTe=e=>(t,r,n)=>BH(e)(t,r,n),wbo=lTe(th),cTe=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return $H(e)(t,r,o)},Cbo=cTe(th),uTe=e=>async(t,r,n)=>$H(e)(t,r,n),kbo=uTe(th),dTe=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return FH(e)(t,r,o)},_bo=dTe(th),fTe=e=>(t,r,n)=>FH(e)(t,r,n),Ebo=fTe(th),pTe=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return zH(e)(t,r,o)},Rbo=pTe(th),hTe=e=>async(t,r,n)=>zH(e)(t,r,n),Pbo=hTe(th);var u0={};Br(u0,{base64:()=>GQe,base64url:()=>mTe,bigint:()=>XQe,boolean:()=>QQe,browserEmail:()=>Bbo,cidrv4:()=>HQe,cidrv6:()=>WQe,cuid:()=>PQe,cuid2:()=>AQe,date:()=>qQe,datetime:()=>YQe,domain:()=>zbo,duration:()=>NQe,e164:()=>VQe,email:()=>BQe,emoji:()=>$Qe,extendedDuration:()=>Abo,guid:()=>OQe,hex:()=>Ubo,hostname:()=>Fbo,html5Email:()=>Dbo,idnEmail:()=>Obo,integer:()=>ZQe,ipv4:()=>FQe,ipv6:()=>zQe,ksuid:()=>MQe,lowercase:()=>tJe,mac:()=>UQe,md5_base64:()=>Wbo,md5_base64url:()=>Gbo,md5_hex:()=>Hbo,nanoid:()=>DQe,null:()=>JQe,number:()=>gTe,rfc5322Email:()=>Nbo,sha1_base64:()=>qbo,sha1_base64url:()=>jbo,sha1_hex:()=>Vbo,sha256_base64:()=>Kbo,sha256_base64url:()=>Xbo,sha256_hex:()=>Ybo,sha384_base64:()=>Qbo,sha384_base64url:()=>Jbo,sha384_hex:()=>Zbo,sha512_base64:()=>txo,sha512_base64url:()=>rxo,sha512_hex:()=>exo,string:()=>KQe,time:()=>jQe,ulid:()=>LQe,undefined:()=>eJe,unicodeEmail:()=>r4r,uppercase:()=>rJe,uuid:()=>FL,uuid4:()=>Lbo,uuid6:()=>Ibo,uuid7:()=>Mbo,xid:()=>IQe});var PQe=/^[cC][^\s-]{8,}$/,AQe=/^[0-9a-z]+$/,LQe=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,IQe=/^[0-9a-vA-V]{20}$/,MQe=/^[A-Za-z0-9]{27}$/,DQe=/^[a-zA-Z0-9_-]{21}$/,NQe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Abo=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,OQe=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,FL=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Lbo=FL(4),Ibo=FL(6),Mbo=FL(7),BQe=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Dbo=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Nbo=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,r4r=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Obo=r4r,Bbo=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,$bo="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function $Qe(){return new RegExp($bo,"u")}var FQe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,zQe=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,UQe=e=>{let t=c0(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},HQe=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,WQe=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,GQe=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,mTe=/^[A-Za-z0-9_-]*$/,Fbo=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,zbo=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,VQe=/^\+[1-9]\d{6,14}$/,n4r="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",qQe=new RegExp(`^${n4r}$`);function o4r(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function jQe(e){return new RegExp(`^${o4r(e)}$`)}function YQe(e){let t=o4r({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${n4r}T(?:${n})$`)}var KQe=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},XQe=/^-?\d+n?$/,ZQe=/^-?\d+$/,gTe=/^-?\d+(?:\.\d+)?$/,QQe=/^(?:true|false)$/i,JQe=/^null$/i;var eJe=/^undefined$/i;var tJe=/^[^A-Z]*$/,rJe=/^[^a-z]*$/,Ubo=/^[0-9a-fA-F]*$/;function vte(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function bte(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Hbo=/^[0-9a-fA-F]{32}$/,Wbo=vte(22,"=="),Gbo=bte(22),Vbo=/^[0-9a-fA-F]{40}$/,qbo=vte(27,"="),jbo=bte(27),Ybo=/^[0-9a-fA-F]{64}$/,Kbo=vte(43,"="),Xbo=bte(43),Zbo=/^[0-9a-fA-F]{96}$/,Qbo=vte(64,""),Jbo=bte(64),exo=/^[0-9a-fA-F]{128}$/,txo=vte(86,"=="),rxo=bte(86);var ga=dt("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),a4r={number:"number",bigint:"bigint",object:"date"},yTe=dt("$ZodCheckLessThan",(e,t)=>{ga.init(e,t);let r=a4r[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vTe=dt("$ZodCheckGreaterThan",(e,t)=>{ga.init(e,t);let r=a4r[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),nJe=dt("$ZodCheckMultipleOf",(e,t)=>{ga.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):yQe(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),oJe=dt("$ZodCheckNumberFormat",(e,t)=>{ga.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=wQe[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=o,s.maximum=i,r&&(s.pattern=ZQe)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),iJe=dt("$ZodCheckBigIntFormat",(e,t)=>{ga.init(e,t);let[r,n]=CQe[t.format];e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),aJe=dt("$ZodCheckMaxSize",(e,t)=>{var r;ga.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!F4(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:pte(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),sJe=dt("$ZodCheckMinSize",(e,t)=>{var r;ga.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!F4(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:pte(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),lJe=dt("$ZodCheckSizeEquals",(e,t)=>{var r;ga.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!F4(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:pte(o),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),cJe=dt("$ZodCheckMaxLength",(e,t)=>{var r;ga.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!F4(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;if(o.length<=t.maximum)return;let a=hte(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),uJe=dt("$ZodCheckMinLength",(e,t)=>{var r;ga.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!F4(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let a=hte(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),dJe=dt("$ZodCheckLengthEquals",(e,t)=>{var r;ga.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!F4(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,i=o.length;if(i===t.length)return;let a=hte(o),s=i>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),UH=dt("$ZodCheckStringFormat",(e,t)=>{var r,n;ga.init(e,t),e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),fJe=dt("$ZodCheckRegex",(e,t)=>{UH.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),pJe=dt("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=tJe),UH.init(e,t)}),hJe=dt("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=rJe),UH.init(e,t)}),mJe=dt("$ZodCheckIncludes",(e,t)=>{ga.init(e,t);let r=c0(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),gJe=dt("$ZodCheckStartsWith",(e,t)=>{ga.init(e,t);let r=new RegExp(`^${c0(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),yJe=dt("$ZodCheckEndsWith",(e,t)=>{ga.init(e,t);let r=new RegExp(`.*${c0(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function i4r(e,t,r){e.issues.length&&t.issues.push(...vm(r,e.issues))}var vJe=dt("$ZodCheckProperty",(e,t)=>{ga.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>i4r(o,r,t.property));i4r(n,r,t.property)}}),bJe=dt("$ZodCheckMimeType",(e,t)=>{ga.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),xJe=dt("$ZodCheckOverwrite",(e,t)=>{ga.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var xte=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
3880
3880
  `).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(`
3881
3881
  `))}};var SJe={major:4,minor:3,patch:6};var Yn=dt("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=SJe;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,s,l)=>{let u=H4(a),d;for(let f of s){if(f._zod.def.when){if(!f._zod.def.when(a))continue}else if(u)continue;let p=a.issues.length,h=f._zod.check(a);if(h instanceof Promise&&l?.async===!1)throw new tv;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,a.issues.length!==p&&(u||(u=H4(a,p)))});else{if(a.issues.length===p)continue;u||(u=H4(a,p))}}return d?d.then(()=>a):a},i=(a,s,l)=>{if(H4(a))return a.aborted=!0,a;let u=o(s,n,l);if(u instanceof Promise){if(l.async===!1)throw new tv;return u.then(d=>e._zod.parse(d,l))}return e._zod.parse(u,l)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(d=>i(d,a,s)):i(u,a,s)}let l=e._zod.parse(a,s);if(l instanceof Promise){if(s.async===!1)throw new tv;return l.then(u=>o(u,n,s))}return o(l,n,s)}}mo(e,"~standard",()=>({validate:o=>{try{let i=EQe(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return RQe(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),zL=dt("$ZodString",(e,t)=>{Yn.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??KQe(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),na=dt("$ZodStringFormat",(e,t)=>{UH.init(e,t),zL.init(e,t)}),wJe=dt("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=OQe),na.init(e,t)}),CJe=dt("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=FL(n))}else t.pattern??(t.pattern=FL());na.init(e,t)}),kJe=dt("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=BQe),na.init(e,t)}),_Je=dt("$ZodURL",(e,t)=>{na.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),EJe=dt("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=$Qe()),na.init(e,t)}),RJe=dt("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=DQe),na.init(e,t)}),PJe=dt("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=PQe),na.init(e,t)}),AJe=dt("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=AQe),na.init(e,t)}),LJe=dt("$ZodULID",(e,t)=>{t.pattern??(t.pattern=LQe),na.init(e,t)}),IJe=dt("$ZodXID",(e,t)=>{t.pattern??(t.pattern=IQe),na.init(e,t)}),MJe=dt("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=MQe),na.init(e,t)}),DJe=dt("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=YQe(t)),na.init(e,t)}),NJe=dt("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=qQe),na.init(e,t)}),OJe=dt("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=jQe(t)),na.init(e,t)}),BJe=dt("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=NQe),na.init(e,t)}),$Je=dt("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=FQe),na.init(e,t),e._zod.bag.format="ipv4"}),FJe=dt("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=zQe),na.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),zJe=dt("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=UQe(t.delimiter)),na.init(e,t),e._zod.bag.format="mac"}),UJe=dt("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=HQe),na.init(e,t)}),HJe=dt("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=WQe),na.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function WJe(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var GJe=dt("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=GQe),na.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{WJe(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function b4r(e){if(!mTe.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return WJe(r)}var VJe=dt("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=mTe),na.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{b4r(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),qJe=dt("$ZodE164",(e,t)=>{t.pattern??(t.pattern=VQe),na.init(e,t)});function x4r(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var jJe=dt("$ZodJWT",(e,t)=>{na.init(e,t),e._zod.check=r=>{x4r(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),YJe=dt("$ZodCustomStringFormat",(e,t)=>{na.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),CTe=dt("$ZodNumber",(e,t)=>{Yn.init(e,t),e._zod.pattern=e._zod.bag.pattern??gTe,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),KJe=dt("$ZodNumberFormat",(e,t)=>{oJe.init(e,t),CTe.init(e,t)}),Ste=dt("$ZodBoolean",(e,t)=>{Yn.init(e,t),e._zod.pattern=QQe,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),kTe=dt("$ZodBigInt",(e,t)=>{Yn.init(e,t),e._zod.pattern=XQe,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),XJe=dt("$ZodBigIntFormat",(e,t)=>{iJe.init(e,t),kTe.init(e,t)}),ZJe=dt("$ZodSymbol",(e,t)=>{Yn.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),QJe=dt("$ZodUndefined",(e,t)=>{Yn.init(e,t),e._zod.pattern=eJe,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),JJe=dt("$ZodNull",(e,t)=>{Yn.init(e,t),e._zod.pattern=JQe,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),eet=dt("$ZodAny",(e,t)=>{Yn.init(e,t),e._zod.parse=r=>r}),tet=dt("$ZodUnknown",(e,t)=>{Yn.init(e,t),e._zod.parse=r=>r}),ret=dt("$ZodNever",(e,t)=>{Yn.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),net=dt("$ZodVoid",(e,t)=>{Yn.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),oet=dt("$ZodDate",(e,t)=>{Yn.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});function l4r(e,t,r){e.issues.length&&t.issues.push(...vm(r,e.issues)),t.value[r]=e.value}var iet=dt("$ZodArray",(e,t)=>{Yn.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let i=[];for(let a=0;a<o.length;a++){let s=o[a],l=t.element._zod.run({value:s,issues:[]},n);l instanceof Promise?i.push(l.then(u=>l4r(u,r,a))):l4r(l,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function wTe(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...vm(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function S4r(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=TQe(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function T4r(e,t,r,n,o,i){let a=[],s=o.keySet,l=o.catchall._zod,u=l.def.type,d=l.optout==="optional";for(let f in t){if(s.has(f))continue;if(u==="never"){a.push(f);continue}let p=l.run({value:t[f],issues:[]},n);p instanceof Promise?e.push(p.then(h=>wTe(h,r,f,t,d))):wTe(p,r,f,t,d)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}var w4r=dt("$ZodObject",(e,t)=>{if(Yn.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let l={...s};return Object.defineProperty(t,"shape",{value:l}),l}})}let n=NH(()=>S4r(t));mo(e._zod,"propValues",()=>{let s=t.shape,l={};for(let u in s){let d=s[u]._zod;if(d.values){l[u]??(l[u]=new Set);for(let f of d.values)l[u].add(f)}}return l});let o=$L,i=t.catchall,a;e._zod.parse=(s,l)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let d=[],f=a.shape;for(let p of a.keys){let h=f[p],m=h._zod.optout==="optional",g=h._zod.run({value:u[p],issues:[]},l);g instanceof Promise?d.push(g.then(y=>wTe(y,s,p,u,m))):wTe(g,s,p,u,m)}return i?T4r(d,u,s,l,n.value,e):d.length?Promise.all(d).then(()=>s):s}}),aet=dt("$ZodObjectJIT",(e,t)=>{w4r.init(e,t);let r=e._zod.parse,n=NH(()=>S4r(t)),o=p=>{let h=new xte(["shape","payload","ctx"]),m=n.value,g=x=>{let T=nTe(x);return`shape[${T}]._zod.run({ value: input[${T}], issues: [] }, ctx)`};h.write("const input = payload.value;");let y=Object.create(null),v=0;for(let x of m.keys)y[x]=`key_${v++}`;h.write("const newResult = {};");for(let x of m.keys){let T=y[x],w=nTe(x),_=p[x]?._zod?.optout==="optional";h.write(`const ${T} = ${g(x)};`),_?h.write(`
@@ -4058,7 +4058,7 @@ ${d.join(`
4058
4058
  `,xPo=Bi`
4059
4059
  0%, 100% { transform: scale(1); }
4060
4060
  50% { transform: scale(1.08); }
4061
- `,cFr={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:`${bPo} 1.8s linear infinite`},SPo={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${xPo} 1.6s ease-in-out infinite`,"&::before":{...cFr,inset:0,zIndex:-1},"&::after":{...cFr,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:Gl.rainbowPill.text,textShadow:Gl.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function uFr({children:e}){return(0,jI.jsxs)(jI.Fragment,{children:[(0,jI.jsx)(H3,{styles:vPo}),(0,jI.jsx)(G,{component:"span","data-testid":"rainbow-pill",sx:SPo,children:e})]})}function dFr({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function fFr(e){if(e.length!==2)return!1;let[t,r]=e;return dFr(t)===dFr(r)}var Ww=C(P(),1);function hFr({rateLimits:e}){let t=k0(3e4),r=[{window:e.five_hour,windowSeconds:18e3,fallbackLabel:"5h"},{window:e.seven_day,windowSeconds:604800,fallbackLabel:"7d"}].filter(i=>i.window?.used_percentage!=null),n=fFr(r.map(i=>({pct:i.window?.used_percentage??0,timeLabel:lEe(i.window?.resets_at,i.fallbackLabel,t)}))),o=r.map((i,a)=>(0,Ww.jsxs)(pFr.Fragment,{children:[a>0?(0,Ww.jsx)(G,{component:"span",sx:{color:FG,mr:.5},children:","}):null,(0,Ww.jsx)(lFr,{window:i.window,windowSeconds:i.windowSeconds,fallbackLabel:i.fallbackLabel,now:t})]},i.fallbackLabel));return n?(0,Ww.jsx)(uFr,{children:o}):(0,Ww.jsx)(Ww.Fragment,{children:o})}var G5=C(P(),1);function gFr({groups:e}){return(0,G5.jsx)(G5.Fragment,{children:e.map((t,r)=>(0,G5.jsxs)(mFr.Fragment,{children:[(0,G5.jsx)(G,{component:"span",sx:{color:FG,ml:r>0?1:0,mr:.5},children:$c(t.harness)}),(0,G5.jsx)(hFr,{rateLimits:t.rateLimits})]},t.harness))})}var yFr={root:{fontFamily:"fontFamilyMono",fontSize:12,display:"grid",gap:1},group:{display:"grid",gap:"2px"},heading:{color:e=>e.tokens.color.onAppBar.secondary},foot:{pt:.75,opacity:.6,borderTop:"1px solid color-mix(in srgb, currentColor 18%, transparent)"}};function TPo(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function wPo(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function CPo(e,t,r,n){if(e>=t)return;let o=e/t;return Math.round(r-n*(1-o))}function xFr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let o=dat(t,r,n);if(o==null)return{kind:"unprojectable"};let i=xx(e,t,r,n),a=TPo(i),s=wPo(i);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*o,at:CPo(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*o}}}function uEe(e){return t=>t.tokens.color.onAppBar.level[e]}function SFr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${hG(e.at,t)}`}var V5=C(P(),1),TFr={display:"contents"};function Iat({direction:e,threshold:t}){let r=e==="back";if(!t)return(0,V5.jsxs)(G,{component:"span",sx:TFr,children:[(0,V5.jsx)("span",{}),(0,V5.jsx)("span",{})]});let n=(0,V5.jsx)(G,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,V5.jsxs)(G,{component:"span",sx:{color:uEe(t.level),textAlign:"right"},children:[Math.round(t.pct),"%"]});return(0,V5.jsxs)(G,{component:"span",sx:TFr,children:[r?o:n,r?n:o]})}var wFr={row:{display:"grid",gridTemplateColumns:"2.5ch 4ch 1ch 4ch 1ch 4ch auto",alignItems:"baseline",gap:.75,fontVariantNumeric:"tabular-nums"},pctWeight:500,note:{pl:.75,color:e=>e.tokens.color.onAppBar.secondary}};var q5=C(P(),1);function CFr({label:e,pct:t,resetsAt:r,windowSeconds:n,now:o}){let i=wFr,a=xx(t,r,n,o),s=xFr(t,r,n,o),l=s.kind==="projected"?s:void 0;return(0,q5.jsxs)(G,{sx:i.row,children:[(0,q5.jsx)(G,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,q5.jsx)(Iat,{direction:"back",threshold:l?.recovery}),(0,q5.jsxs)(G,{component:"span",sx:{minWidth:"4ch",textAlign:"right",fontWeight:i.pctWeight,color:uEe(a)},children:[Math.round(t),"%"]}),(0,q5.jsx)(Iat,{direction:"forward",threshold:l?.worse}),(0,q5.jsx)(G,{component:"span",sx:i.note,children:l?l.recovery&&SFr(l.recovery,o):"no projection yet"})]})}function dEe(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 _Fr=C(P(),1);function kFr({rateLimits:e,now:t}){return dEe(e).map(r=>(0,_Fr.jsx)(CFr,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var YI=C(P(),1);function EFr({groups:e}){let t=k0(3e4),r=yFr;return(0,YI.jsxs)(G,{sx:r.root,children:[e.map(n=>(0,YI.jsxs)(G,{sx:r.group,children:[(0,YI.jsx)(G,{sx:r.heading,children:$c(n.harness)}),(0,YI.jsx)(kFr,{rateLimits:n.rateLimits,now:t})]},n.harness)),(0,YI.jsx)(G,{sx:r.foot,children:"Account usage per harness \u2014 view history"})]})}var Mat=C(P(),1),kPo="Claude account usage (5h / 7d windows) \u2014 view history";function RFr(e){return e.length===0?{title:kPo,content:"Usage"}:{title:(0,Mat.jsx)(EFr,{groups:e}),content:(0,Mat.jsx)(gFr,{groups:e})}}var PFr={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}},AFr={tooltip:{sx:{p:"10px 12px",minWidth:300,maxWidth:"none"}}};var Dat=C(P(),1),_Po={};function LFr({rateLimits:e,harnessRateLimits:t=_Po}){let{title:r,content:n}=RFr(sEe(e,t));return(0,Dat.jsx)(sr,{title:r,placement:"top-start",slotProps:AFr,children:(0,Dat.jsx)(Qr,{component:da,to:"/usage",underline:"none",color:"inherit",sx:PFr,children:n})})}var DFr=C(ee(),1);var ch="0.1042.3";var fEe=C(ee(),1),Nat=(0,fEe.createContext)(null);function pEe(){return(0,fEe.useContext)(Nat)}var Oat=C(P(),1);function IFr(){let e=pEe();return!e||e===ch?null:(0,Oat.jsx)(sr,{title:`Daemon is running v${e}, but this page was served by v${ch}. Restart the daemon to match.`,children:(0,Oat.jsx)(K_e,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var MFr=e=>({display:"inline-flex",alignItems:"center",gap:.75,px:1,py:0,height:22,borderRadius:1,fontSize:"inherit",lineHeight:1.5,color:"inherit",opacity:1,bgcolor:t=>e?Dx(t).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{bgcolor:t=>Dx(t).hover,color:t=>Dx(t).hoverText},"& .ready-dot":{width:6,height:6,borderRadius:"50%",bgcolor:t=>Dx(t).dot,boxShadow:t=>`0 0 0 3px ${Dx(t).dotRing}`},"& .ready-count":{fontWeight:500,color:t=>Dx(t).readyText}});var P0=C(P(),1);function NFr(){let{entries:e}=gx(),t=an(),r=(0,DFr.useCallback)(()=>t("/updates"),[t]),{matches:n,chords:o}=fo("openUpdates");if(Zi(n,r),!ch)return null;let i=e.filter(E5).length;return(0,P0.jsxs)(P0.Fragment,{children:[(0,P0.jsx)(sr,{describeChild:!0,placement:"top-end",title:(0,P0.jsx)(Rd,{label:"Updates",chords:o}),children:(0,P0.jsxs)(nr,{component:da,to:"/updates","aria-label":i?`Updates: ${i} node${i>1?"s have":" has"} an update ready`:"Updates",sx:MFr(i>0),children:[i>0&&(0,P0.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,P0.jsxs)("span",{children:["v",ch]}),i>0&&(0,P0.jsxs)("span",{className:"ready-count",children:[i," ready"]})]})}),(0,P0.jsx)(IFr,{})]})}var Gw=C(P(),1);function OFr({socket:e}){return(0,Gw.jsx)(Y$r,{start:(0,Gw.jsx)(LFr,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits}),end:(0,Gw.jsxs)(Gw.Fragment,{children:[(0,Gw.jsx)(iFr,{}),(0,Gw.jsx)(NFr,{})]})})}var BFr=C(ee(),1);var Vw=C(P(),1),EPo=2e4;function $Fr(){let{entries:e,refresh:t}=gx(),[r,n]=(0,BFr.useState)(),o=e.find(l=>l.local)?.status?.extension,i=o?.behind&&o.updateLink&&o.latest?o:void 0,a=i!==void 0&&r!==i.latest,s=()=>n(i?.latest);return(0,Vw.jsx)(Nu,{open:a,children:(0,Vw.jsxs)(no,{severity:"info",variant:"filled",action:(0,Vw.jsxs)(Vw.Fragment,{children:[(0,Vw.jsx)(ht,{color:"inherit",size:"small",href:i?.updateLink,onClick:()=>setTimeout(t,EPo),children:"Install"}),(0,Vw.jsx)(ht,{color:"inherit",size:"small",onClick:s,children:"Dismiss"})]}),children:["assist extension v",i?.connected," \u2192 v",i?.latest]})})}var vEe=C(ee(),1);var yEe=C(ee(),1);function FFr(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 j5=C(P(),1),RPo={display:"flex",gap:1,alignItems:"center",minWidth:0},PPo={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},APo={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},LPo={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function IPo(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function zFr({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,j5.jsx)(eg,{dense:!0,sx:{py:0},children:e.map((o,i)=>{let{dir:a,basename:s}=IPo(o);return(0,j5.jsxs)(jr,{selected:i===t,onMouseEnter:()=>r(i),onClick:()=>n(o),sx:RPo,children:[(0,j5.jsx)(B2e,{path:o}),(0,j5.jsxs)(G,{sx:PPo,children:[(0,j5.jsx)(Ce,{component:"span",sx:APo,children:s}),(0,j5.jsx)(Ce,{component:"span",color:"text.secondary",sx:LPo,children:a})]})]},o)})})}var hEe=C(P(),1),MPo={maxHeight:420,overflowY:"auto"},DPo={px:2,py:2,fontSize:13};function UFr({message:e,files:t,highlight:r,onHighlight:n,onSelect:o}){return(0,hEe.jsx)(G,{sx:MPo,children:e?(0,hEe.jsx)(Ce,{color:"text.secondary",sx:DPo,children:e}):(0,hEe.jsx)(zFr,{files:t,highlight:r,onHighlight:n,onSelect:o})})}var HFr=C(P(),1),NPo={mt:6,alignSelf:"flex-start"};function mEe({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,HFr.jsx)(vl,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:NPo},transition:{onEntered:t}},children:n})}var gEe=C(ee(),1);var WFr={files:[],loading:!1,error:!1};function GFr(e,t){let[r,n]=(0,gEe.useState)(WFr),o=yr();return(0,gEe.useEffect)(()=>{if(!e){n(WFr);return}let i=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await Jt(tn(`/api/files?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,o));if(!s.ok)throw new Error(`HTTP ${s.status}`);let l=await s.json();if(i)return;n({files:Array.isArray(l.files)?l.files:[],loading:!1,error:!1})}catch(s){Pr(s,"file search"),i||n({files:[],loading:!1,error:!0})}})(),()=>{i=!0}},[e,t,o]),r}var KI=C(P(),1);function OPo(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function VFr({onClose:e}){let{worktreeNode:t}=to();return(0,KI.jsx)(ic.Provider,{value:t,children:(0,KI.jsx)(BPo,{onClose:e})})}function BPo({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=to(),[n,o]=(0,yEe.useState)(""),i=GFr(t,n),a=an(),s=(0,yEe.useRef)(null),l=h=>a(OPo(h,t,r)),{highlight:u,setHighlight:d,onKeyDown:f}=N5(i.files,n,l,e),p=h=>{l(h),e()};return(0,KI.jsxs)(mEe,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,KI.jsx)(xk,{autoFocus:!0,inputRef:s,value:n,onChange:o,onKeyDown:f,placeholder:"Search files by name..."}),(0,KI.jsx)(UFr,{message:FFr(t,n,i),files:i.files,highlight:u,onHighlight:d,onSelect:p})]})}function qFr(e){Zi(fo("quickOpen").matches,e)}var YFr=C(P(),1);function jFr(){let[e,t]=(0,vEe.useState)(!1);return qFr((0,vEe.useCallback)(()=>t(!0),[])),e?(0,YFr.jsx)(VFr,{onClose:()=>t(!1)}):null}var bEe=C(P(),1);function KFr({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,bEe.jsx)(Nu,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,bEe.jsx)(no,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,bEe.jsx)(ht,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var Ine=C(ee(),1);function zG(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var lzr=C(ee(),1);var XFr=C(P(),1),ZFr=nt((0,XFr.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 $Po={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function QFr(e){return e?$Po[e]:"success.main"}function JFr(e){return e.split("-")[0].split(".").map(Number)}function ezr(e,t){if(!e||!t||e===t)return;let r=JFr(e),n=JFr(t);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]??0)-(n[o]??0);if(Number.isNaN(i))return;if(i!==0)return i<0?"behind":"ahead"}}var XI=C(P(),1),FPo={height:16,fontSize:10},zPo={opacity:.6,fontSize:"0.85em"};function UPo(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 Ane({nodes:e,name:t,showVersion:r=!1}){let n=pEe()??ch,o=e.links.find(a=>a.name===t),i=ezr(o?.peerVersion,n);return(0,XI.jsx)(sr,{title:UPo(e,t),placement:"right",children:(0,XI.jsxs)(G,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,XI.jsx)(ZFr,{sx:{fontSize:8,color:QFr(o?.state)}}),t,r&&o?.peerVersion&&(0,XI.jsxs)(G,{component:"span",sx:zPo,children:["v",o.peerVersion]}),i&&(0,XI.jsx)(Vn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:FPo})]})})}var ZI=C(P(),1),HPo={opacity:.6},WPo={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function tzr({nodes:e,name:t,clone:r}){let n=(0,ZI.jsx)(Ane,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,ZI.jsx)(G,{component:"span",sx:HPo,children:n}):(0,ZI.jsx)(sr,{title:TG(t,r.cloneTarget),children:(0,ZI.jsxs)(G,{component:"span",sx:WPo,children:[(0,ZI.jsx)(SG,{sx:{fontSize:14}}),n]})})}var nzr=C(P(),1),GPo={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 rzr({value:e,label:t,checked:r,autoFocus:n,onSelect:o}){return(0,nzr.jsx)(nr,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:o,sx:GPo,children:t})}var ozr={ArrowRight:1,ArrowLeft:-1};function VPo(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+ozr[e.key]+r)%r}function izr(e,t,r,n){return o=>{if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!n)return;o.preventDefault(),n();return}if(o.key!=="Tab"&&!ozr[o.key]){XT(o);return}let i=VPo(o,e.indexOf(t),e.length);i!==void 0&&(o.preventDefault(),r(e[i]),o.currentTarget.querySelector(`[data-value="${e[i]}"]`)?.focus())}}var azr=C(ee(),1);function UG(e){return e?.querySelector('[aria-checked="true"]')}function szr(e,t){(0,azr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=UG(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var Bat=C(P(),1),qPo={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function xEe({label:e,options:t,value:r,onChange:n,optionLabel:o=u=>u,groupRef:i,autoFocus:a,onTrack:s,onToggleRow:l}){return szr(i,r),(0,Bat.jsx)(kt,{ref:i,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:izr(t,r,n,l),sx:qPo,children:t.map(u=>(0,Bat.jsx)(rzr,{value:u,label:o(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var $at=C(P(),1);function czr({value:e,onChange:t,cloneState:r}){let{nodes:n,names:o,visible:i}=Cl(),a=(0,lzr.useRef)(null);return!i||!n||!e?null:(0,$at.jsx)(xEe,{label:"Machine",options:o,value:e,onChange:t,optionLabel:s=>(0,$at.jsx)(tzr,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var SEe=C(P(),1);function uzr({prompt:e,children:t}){return(0,SEe.jsxs)(kt,{children:[e,(0,SEe.jsx)(kt,{spacing:1,sx:{px:1.5,pb:1.5},children:t})]})}var fzr=C(P(),1),jPo=".MuiOutlinedInput-notchedOutline",YPo={"& .MuiOutlinedInput-root":{px:"18px",py:2,minHeight:92,alignItems:"flex-start",bgcolor:"transparent",borderRadius:0,fontSize:15},[`&&& ${jPo}`]:{border:0},"& textarea::placeholder":{color:"text.disabled",opacity:1}};function dzr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:o,onTrack:i}){return(0,fzr.jsx)($n,{sx:YPo,value:e,onChange:a=>t(a.target.value),onKeyDown:XT,onFocus:i,onSelect:i,inputRef:n,placeholder:r,autoFocus:o,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"}}})}var gzr=C(ee(),1);var hv={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:$Se,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},pzr=Object.keys(hv);var Fat=C(P(),1);function hzr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:o}){return(0,Fat.jsx)(Rs,{open:e!==null,anchorEl:e,onClose:o,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(i=>(0,Fat.jsx)(jr,{role:"menuitemradio","aria-checked":i===t,selected:i===t,onClick:()=>{n(i),o()},sx:{fontSize:13},children:$c(i)},i))})}var QI=C(P(),1);function mzr(e){return t=>t==="prompt"&&e?(0,QI.jsxs)(QI.Fragment,{children:["prompt",(0,QI.jsx)(G,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${$c(e)}`}),(0,QI.jsx)(gp,{sx:{fontSize:18,mr:-.75}})]}):t}var JI=C(P(),1);function yzr({draft:e,harness:t,harnesses:r,focus:n}){let[o,i]=(0,gzr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>i(UG(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,JI.jsxs)(JI.Fragment,{children:[(0,JI.jsx)(xEe,{label:"Mode",options:pzr,value:e.mode,onChange:l,optionLabel:mzr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,JI.jsx)(hzr,{anchor:o,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>i(null)})]})}var Pzr=C(ee(),1);var zat=C(P(),1),KPo={zIndex:e=>e.zIndex.modal+1};function vzr({open:e,anchor:t,children:r}){return(0,zat.jsx)(RD,{open:e,anchorEl:t,placement:"bottom-start",sx:KPo,children:(0,zat.jsx)(Zr,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}var bzr=C(P(),1),xzr=nt((0,bzr.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var Uat=C(P(),1),XPo={fontSize:13,height:36,pr:1,cursor:"pointer","& input":{cursor:"text"}},ZPo={fontSize:16,color:"text.disabled"};function Szr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:XPo,endAdornment:(0,Uat.jsx)(lRe,{position:"end",children:(0,Uat.jsx)(xzr,{sx:ZPo})})}}}var Tzr=C(pD(),1);function wzr({open:e,highlighted:t,accept:r,close:n,navigate:o,openList:i}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),i();return}XT(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,Tzr.flushSync)(()=>{r(t),n()}),XT(a);return}if(a.key!=="Tab"){o(a);return}t!==void 0&&r(t),n()}}}function TEe(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>kx(n).toLowerCase().includes(r)):e}var Hat=C(ee(),1);function Czr(){let[e,t]=(0,Hat.useState)(!1),[r,n]=(0,Hat.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:o=>{n(o),t(!0)},close:()=>{t(!1),n("")}}}var _zr=C(ee(),1);var kzr=e=>e?kx(e):"";function Ezr(e){let[t,r]=(0,_zr.useState)(()=>kzr(e));return{text:t,setText:r,showRepo:n=>r(kzr(n))}}function Rzr(e,t,r){let n=Czr(),o=Ezr(t),i=TEe(e,n.query),a=d=>{r(d),o.showRepo(d)},s=N5(i,n.query,a,n.close),l=()=>s.setHighlight(Math.max(e.indexOf(t),0)),u=()=>{l(),n.show()};return{open:n.open,text:o.text,filtered:i,highlight:s.highlight,setHighlight:s.setHighlight,onKeyDown:wzr({open:n.open,highlighted:i[s.highlight],accept:a,close:n.close,navigate:s.onKeyDown,openList:u}),onClick:()=>{n.open||u()},onType:d=>{o.setText(d),n.filterBy(d)},onFocus:l,onBlur:()=>{n.close(),o.showRepo(t)},pick:d=>{a(d),n.close()}}}var HG=C(P(),1);function Azr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:o,onTrack:i}){let a=Rzr(e,t,r),s=(0,Pzr.useRef)(null);return(0,HG.jsxs)(G,{ref:s,sx:{flex:1,minWidth:0},children:[(0,HG.jsx)($n,{value:a.text,onChange:l=>a.onType(l.target.value),onFocus:l=>{l.target.select(),a.onFocus(),i()},inputRef:n,autoFocus:o,onClick:a.onClick,onBlur:a.onBlur,onKeyDown:a.onKeyDown,placeholder:"Repo",size:"small",fullWidth:!0,slotProps:Szr(a.open)}),(0,HG.jsx)(vzr,{open:a.open,anchor:s.current,children:(0,HG.jsx)(W_e,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var Y5=C(P(),1);function Lzr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:o}=to();return(0,Y5.jsxs)(uzr,{prompt:(0,Y5.jsx)(dzr,{value:r.prompt,onChange:r.setPrompt,placeholder:hv[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),children:[(0,Y5.jsxs)(kt,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,Y5.jsx)(Azr,{repos:o,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,Y5.jsx)(yzr,{...t})]}),(0,Y5.jsx)(czr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var Dzr=C(P(),1),Izr=[["Enter","start"],["Shift+Enter","newline"],["Esc","close"]];function Mzr({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,Dzr.jsx)(ht,{type:"submit",variant:"contained",disabled:t,loading:r,children:e})}var eM=C(P(),1),QPo=e=>({alignItems:"center",flexWrap:"wrap",gap:"14px",py:"10px",pl:"18px",pr:1.5,borderTop:1,borderColor:e.tokens.color.lineSoft,bgcolor:"background.default",fontSize:12,color:"text.secondary"}),JPo=e=>({mr:.5,px:"5px",border:1,borderColor:"divider",borderRadius:"4px",fontFamily:e.typography.fontFamilyMono,fontSize:10.5,color:"text.primary"});function Nzr(e){return(0,eM.jsxs)(kt,{direction:"row",sx:QPo,children:[Izr.map(([t,r])=>(0,eM.jsxs)("span",{children:[(0,eM.jsx)(G,{component:"kbd",sx:JPo,children:t}),r]},t)),(0,eM.jsx)(G,{sx:{flex:1}}),(0,eM.jsx)(Mzr,{...e})]})}var tM=C(ee(),1);function Ozr(e,t){let r=(0,tM.useRef)(e),n=(0,tM.useRef)(null),o=(0,tM.useRef)(null),i=(0,tM.useRef)(null),a=(0,tM.useCallback)(u=>{n.current=u;let{field:d,selectionStart:f,selectionEnd:p}=r.current;u&&d==="prompt"&&u.setSelectionRange(f,p)},[]),s=u=>{let d=u.target;t({field:"prompt",selectionStart:d.selectionStart,selectionEnd:d.selectionEnd})},l=()=>{if(i.current?.closest("form")?.contains(document.activeElement))return;let{field:u}=r.current;({repo:o.current,mode:UG(i.current),prompt:n.current}[u]??n.current)?.focus()};return{autoFocus:e.field,promptRef:a,repoRef:o,modeRef:i,trackPrompt:s,trackRepo:()=>t({...e,field:"repo"}),trackMode:()=>t({...e,field:"mode"}),restore:l}}function eAo(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:V_e(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function Bzr(e,t){let{names:r,visible:n}=Cl(),o=z_e(t,n?r:[void 0]);return{cloneState:o,target:eAo(t,e,o(e))}}function wEe({mode:e,harness:t,prompt:r,cwd:n,node:o},i){let a=n||void 0,s=o?[o]:[];if(e==="prompt"){t==="claude"?i.onCreate(r,a,...s):i.onCreateHarness(t,r,a,...s);return}if(e==="design"){i.onCreateDesign(r,a,...s);return}let l=o?[{node:o}]:[];Y_r(hv[e].sessionMode,n,(u,d)=>i.onCreateAssist(u,d,...l),()=>{},r)}function $zr(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(I_e(r.prompt,n.onCreateAssist),!0):(wEe({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var CEe=C(ee(),1);function Fzr(e,t){let[r,n]=(0,CEe.useState)(!1);return(0,CEe.useEffect)(()=>{!r||e.modePending||(n(!1),e.modeError||t())},[r,e.modePending,e.modeError,t]),()=>{e.modePending?n(!0):t()}}function zzr(e,t,r,n,o){let i=Fzr(e,()=>{$zr(e,t,r,n)&&o()});return a=>{a.preventDefault(),i()}}var Lne=C(ee(),1);function Uzr(e,t){let r=(0,Lne.useRef)(e),n=(0,Lne.useRef)(null);return(0,Lne.useEffect)(()=>{if(r.current&&!e){let o=n.current;o?.isConnected?o.focus():t()}r.current=e},[e,t]),o=>{n.current=o.target}}var Wzr=C(P(),1),tAo={border:0,margin:0,padding:0,minWidth:0};function Hzr({loading:e,restoreFocus:t,children:r}){let n=Uzr(e,t);return(0,Wzr.jsx)("fieldset",{disabled:e,style:tAo,onFocus:n,children:r})}var _Ee=C(P(),1);function kEe({error:e,onRetry:t}){return e?(0,_Ee.jsxs)(no,{severity:"error",sx:{mx:2,my:1},action:t&&(0,_Ee.jsx)(ht,{color:"inherit",size:"small",onClick:t,children:"Retry"}),children:["Couldn't load this repo's default mode (",e,"). Pick a mode or retry."]}):null}var K5=C(P(),1);function Gzr({draft:e,launchers:t,onClose:r}){let n=Ozr(e.focus,e.setFocus),o=zG(_0()),i=o.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=Bzr(e.node,e.cwd),l=zzr(e,i,a,t,r);return(0,K5.jsx)(mEe,{onClose:r,onEntered:n.restore,centered:!0,children:(0,K5.jsx)("form",{onSubmit:l,children:(0,K5.jsxs)(Hzr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,K5.jsx)(Lzr,{draft:e,harness:i,harnesses:o,focus:n,cloneState:s}),(0,K5.jsx)(kEe,{error:e.modeError,onRetry:e.retryMode}),(0,K5.jsx)(Nzr,{submitLabel:a.kind==="clone"?"Clone":hv[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var rM=C(ee(),1);async function rAo(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",r=await Jt(`/api/new-session-defaults${t}`);if(!r.ok)return{error:`HTTP ${r.status}`};let n=await r.json();if(Object.hasOwn(hv,n?.mode))return{mode:n.mode};throw new Error(`unknown mode ${JSON.stringify(n?.mode)}`)}catch(t){return Pr(t,"new-session defaults"),{error:t instanceof Error?t.message:String(t)}}}function EEe(e,t=0){let[r,n]=(0,rM.useState)(0),[o,i]=(0,rM.useState)(null),a=(0,rM.useCallback)(()=>n(l=>l+1),[]);if((0,rM.useEffect)(()=>{let l=!1;return rAo(e).then(u=>{l||i({cwd:e,opens:t,attempt:r,outcome:u})}),()=>{l=!0}},[e,t,r]),!o)return null;let{outcome:s}=o;return{mode:"mode"in s?s.mode:"prompt",pending:o.cwd!==e||o.opens!==t||o.attempt!==r,error:"error"in s?s.error:void 0,retry:a}}function REe(e,t){if(!(e!==void 0||!t||t.pending))return t.error}function Vzr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var X5=C(ee(),1);var qzr={field:"prompt",selectionStart:0,selectionEnd:0};function jzr(){let[e,t]=EH("new-session"),[r,n]=(0,X5.useState)(),[o,i]=(0,X5.useState)(),[a,s]=(0,X5.useState)("claude"),[l,u]=(0,X5.useState)(),[d,f]=(0,X5.useState)(qzr),p=(0,X5.useCallback)(()=>{t(""),n(void 0),i(void 0),u(void 0),f(qzr)},[t]);return{prompt:e,cwd:r,mode:o,harness:a,node:l,focus:d,setPrompt:t,setNode:u,setCwd:n,setMode:i,setHarness:s,setFocus:f,clear:p}}function Yzr(e,t=EEe){let{selectedCwd:r}=to(),n=Cl(),o=jzr(),i=o.cwd??r,a=t(i,e);return a?{...o,cwd:i,mode:o.mode??a.mode,modePending:o.mode===void 0&&a.pending,modeError:REe(o.mode,a),retryMode:a.retry,node:Vzr(o.node,n)}:null}function Kzr(e){Zi(fo("newSession").matches,e)}var Xzr=C(ee(),1);function Zzr(e,t){let{selectedCwd:r}=to(),[n,o]=al(),i=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,Xzr.useEffect)(()=>{i===null||!s||!l||!u||(i&&(s(i),l(a),u({field:"prompt",selectionStart:i.length,selectionEnd:i.length})),t(),o(d=>(d.delete("new"),d.delete("newCwd"),d),{replace:!0}))},[i,a,s,l,u,t,o])}var Jzr=C(P(),1);function Qzr({launchers:e}){let[t,r]=(0,Ine.useState)(!1),[n,o]=(0,Ine.useState)(0),i=Yzr(n),a=(0,Ine.useCallback)(()=>{r(!0),o(s=>s+1)},[]);return Kzr(a),Zzr(i,a),!t||!i?null:(0,Jzr.jsx)(Gzr,{draft:i,launchers:e,onClose:()=>r(!1)})}var PEe=C(P(),1);function eUr({reconnecting:e}){return(0,PEe.jsx)(Nu,{open:e,children:(0,PEe.jsx)(no,{severity:"info",variant:"filled",icon:(0,PEe.jsx)(Ao,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var mv=C(P(),1);function tUr({socket:e,onViewLaunchedSession:t}){return(0,mv.jsxs)(mv.Fragment,{children:[(0,mv.jsx)(jFr,{}),(0,mv.jsx)(Qzr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,mv.jsx)(eUr,{reconnecting:e.reconnecting}),(0,mv.jsx)($Fr,{}),(0,mv.jsx)(kl,{error:e.error,onClose:e.clearError}),(0,mv.jsx)(KFr,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Nx=C(ee(),1);var nAo=6e4;function oAo(e,t,r){return t.map(n=>e.find(o=>o.name===n)??{name:n,local:n===r,loading:!0})}function AEe(e){let t=e.nodes?.local,r=e.names.join(`
4061
+ `,cFr={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:`${bPo} 1.8s linear infinite`},SPo={display:"inline-flex",alignItems:"center",px:1.5,py:"3px",borderRadius:999,position:"relative",isolation:"isolate",fontWeight:700,animation:`${xPo} 1.6s ease-in-out infinite`,"&::before":{...cFr,inset:0,zIndex:-1},"&::after":{...cFr,inset:"-5px",zIndex:-2,filter:"blur(9px)",opacity:.85},"& span":{color:Gl.rainbowPill.text,textShadow:Gl.rainbowPill.shadow},"@media (prefers-reduced-motion: reduce)":{animation:"none","&::before, &::after":{animation:"none"}}};function uFr({children:e}){return(0,jI.jsxs)(jI.Fragment,{children:[(0,jI.jsx)(H3,{styles:vPo}),(0,jI.jsx)(G,{component:"span","data-testid":"rainbow-pill",sx:SPo,children:e})]})}function dFr({pct:e,timeLabel:t}){return[Math.round(e),...(t.match(/\d+/g)??[]).map(Number)].join(",")}function fFr(e){if(e.length!==2)return!1;let[t,r]=e;return dFr(t)===dFr(r)}var Ww=C(P(),1);function hFr({rateLimits:e}){let t=k0(3e4),r=[{window:e.five_hour,windowSeconds:18e3,fallbackLabel:"5h"},{window:e.seven_day,windowSeconds:604800,fallbackLabel:"7d"}].filter(i=>i.window?.used_percentage!=null),n=fFr(r.map(i=>({pct:i.window?.used_percentage??0,timeLabel:lEe(i.window?.resets_at,i.fallbackLabel,t)}))),o=r.map((i,a)=>(0,Ww.jsxs)(pFr.Fragment,{children:[a>0?(0,Ww.jsx)(G,{component:"span",sx:{color:FG,mr:.5},children:","}):null,(0,Ww.jsx)(lFr,{window:i.window,windowSeconds:i.windowSeconds,fallbackLabel:i.fallbackLabel,now:t})]},i.fallbackLabel));return n?(0,Ww.jsx)(uFr,{children:o}):(0,Ww.jsx)(Ww.Fragment,{children:o})}var G5=C(P(),1);function gFr({groups:e}){return(0,G5.jsx)(G5.Fragment,{children:e.map((t,r)=>(0,G5.jsxs)(mFr.Fragment,{children:[(0,G5.jsx)(G,{component:"span",sx:{color:FG,ml:r>0?1:0,mr:.5},children:$c(t.harness)}),(0,G5.jsx)(hFr,{rateLimits:t.rateLimits})]},t.harness))})}var yFr={root:{fontFamily:"fontFamilyMono",fontSize:12,display:"grid",gap:1},group:{display:"grid",gap:"2px"},heading:{color:e=>e.tokens.color.onAppBar.secondary},foot:{pt:.75,opacity:.6,borderTop:"1px solid color-mix(in srgb, currentColor 18%, transparent)"}};function TPo(e){if(e==="over")return{level:"warn",boundary:100};if(e==="warn")return{level:"ok",boundary:75}}function wPo(e){if(e==="ok")return{level:"warn",boundary:75};if(e==="warn")return{level:"over",boundary:100}}function CPo(e,t,r,n){if(e>=t)return;let o=e/t;return Math.round(r-n*(1-o))}function xFr(e,t,r,n){if(t==null)return{kind:"unprojectable"};let o=dat(t,r,n);if(o==null)return{kind:"unprojectable"};let i=xx(e,t,r,n),a=TPo(i),s=wPo(i);return{kind:"projected",recovery:a&&{level:a.level,pct:a.boundary*o,at:CPo(e,a.boundary,t,r)},worse:s&&{level:s.level,pct:s.boundary*o}}}function uEe(e){return t=>t.tokens.color.onAppBar.level[e]}function SFr(e,t){return e.at==null?"not before reset":`${e.level==="ok"?"green":"under"} in ${hG(e.at,t)}`}var V5=C(P(),1),TFr={display:"contents"};function Iat({direction:e,threshold:t}){let r=e==="back";if(!t)return(0,V5.jsxs)(G,{component:"span",sx:TFr,children:[(0,V5.jsx)("span",{}),(0,V5.jsx)("span",{})]});let n=(0,V5.jsx)(G,{component:"span",sx:{opacity:.6},children:r?"\u2190":"\u2192"}),o=(0,V5.jsxs)(G,{component:"span",sx:{color:uEe(t.level),textAlign:"right"},children:[Math.round(t.pct),"%"]});return(0,V5.jsxs)(G,{component:"span",sx:TFr,children:[r?o:n,r?n:o]})}var wFr={row:{display:"grid",gridTemplateColumns:"2.5ch 4ch 1ch 4ch 1ch 4ch auto",alignItems:"baseline",gap:.75,fontVariantNumeric:"tabular-nums"},pctWeight:500,note:{pl:.75,color:e=>e.tokens.color.onAppBar.secondary}};var q5=C(P(),1);function CFr({label:e,pct:t,resetsAt:r,windowSeconds:n,now:o}){let i=wFr,a=xx(t,r,n,o),s=xFr(t,r,n,o),l=s.kind==="projected"?s:void 0;return(0,q5.jsxs)(G,{sx:i.row,children:[(0,q5.jsx)(G,{component:"span",sx:{minWidth:"2ch"},children:e}),(0,q5.jsx)(Iat,{direction:"back",threshold:l?.recovery}),(0,q5.jsxs)(G,{component:"span",sx:{minWidth:"4ch",textAlign:"right",fontWeight:i.pctWeight,color:uEe(a)},children:[Math.round(t),"%"]}),(0,q5.jsx)(Iat,{direction:"forward",threshold:l?.worse}),(0,q5.jsx)(G,{component:"span",sx:i.note,children:l?l.recovery&&SFr(l.recovery,o):"no projection yet"})]})}function dEe(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 _Fr=C(P(),1);function kFr({rateLimits:e,now:t}){return dEe(e).map(r=>(0,_Fr.jsx)(CFr,{label:r.label,pct:r.pct,resetsAt:r.resetsAt,windowSeconds:r.windowSeconds,now:t},r.label))}var YI=C(P(),1);function EFr({groups:e}){let t=k0(3e4),r=yFr;return(0,YI.jsxs)(G,{sx:r.root,children:[e.map(n=>(0,YI.jsxs)(G,{sx:r.group,children:[(0,YI.jsx)(G,{sx:r.heading,children:$c(n.harness)}),(0,YI.jsx)(kFr,{rateLimits:n.rateLimits,now:t})]},n.harness)),(0,YI.jsx)(G,{sx:r.foot,children:"Account usage per harness \u2014 view history"})]})}var Mat=C(P(),1),kPo="Claude account usage (5h / 7d windows) \u2014 view history";function RFr(e){return e.length===0?{title:kPo,content:"Usage"}:{title:(0,Mat.jsx)(EFr,{groups:e}),content:(0,Mat.jsx)(gFr,{groups:e})}}var PFr={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}},AFr={tooltip:{sx:{p:"10px 12px",minWidth:300,maxWidth:"none"}}};var Dat=C(P(),1),_Po={};function LFr({rateLimits:e,harnessRateLimits:t=_Po}){let{title:r,content:n}=RFr(sEe(e,t));return(0,Dat.jsx)(sr,{title:r,placement:"top-start",slotProps:AFr,children:(0,Dat.jsx)(Qr,{component:da,to:"/usage",underline:"none",color:"inherit",sx:PFr,children:n})})}var DFr=C(ee(),1);var ch="0.1043.0";var fEe=C(ee(),1),Nat=(0,fEe.createContext)(null);function pEe(){return(0,fEe.useContext)(Nat)}var Oat=C(P(),1);function IFr(){let e=pEe();return!e||e===ch?null:(0,Oat.jsx)(sr,{title:`Daemon is running v${e}, but this page was served by v${ch}. Restart the daemon to match.`,children:(0,Oat.jsx)(K_e,{fontSize:"small",color:"warning","aria-label":"Version mismatch"})})}var MFr=e=>({display:"inline-flex",alignItems:"center",gap:.75,px:1,py:0,height:22,borderRadius:1,fontSize:"inherit",lineHeight:1.5,color:"inherit",opacity:1,bgcolor:t=>e?Dx(t).active:"transparent",transition:"opacity .2s ease, background-color .2s ease, color .2s ease","&:hover, &:focus-visible":{bgcolor:t=>Dx(t).hover,color:t=>Dx(t).hoverText},"& .ready-dot":{width:6,height:6,borderRadius:"50%",bgcolor:t=>Dx(t).dot,boxShadow:t=>`0 0 0 3px ${Dx(t).dotRing}`},"& .ready-count":{fontWeight:500,color:t=>Dx(t).readyText}});var P0=C(P(),1);function NFr(){let{entries:e}=gx(),t=an(),r=(0,DFr.useCallback)(()=>t("/updates"),[t]),{matches:n,chords:o}=fo("openUpdates");if(Zi(n,r),!ch)return null;let i=e.filter(E5).length;return(0,P0.jsxs)(P0.Fragment,{children:[(0,P0.jsx)(sr,{describeChild:!0,placement:"top-end",title:(0,P0.jsx)(Rd,{label:"Updates",chords:o}),children:(0,P0.jsxs)(nr,{component:da,to:"/updates","aria-label":i?`Updates: ${i} node${i>1?"s have":" has"} an update ready`:"Updates",sx:MFr(i>0),children:[i>0&&(0,P0.jsx)("span",{className:"ready-dot","aria-hidden":!0}),(0,P0.jsxs)("span",{children:["v",ch]}),i>0&&(0,P0.jsxs)("span",{className:"ready-count",children:[i," ready"]})]})}),(0,P0.jsx)(IFr,{})]})}var Gw=C(P(),1);function OFr({socket:e}){return(0,Gw.jsx)(Y$r,{start:(0,Gw.jsx)(LFr,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits}),end:(0,Gw.jsxs)(Gw.Fragment,{children:[(0,Gw.jsx)(iFr,{}),(0,Gw.jsx)(NFr,{})]})})}var BFr=C(ee(),1);var Vw=C(P(),1),EPo=2e4;function $Fr(){let{entries:e,refresh:t}=gx(),[r,n]=(0,BFr.useState)(),o=e.find(l=>l.local)?.status?.extension,i=o?.behind&&o.updateLink&&o.latest?o:void 0,a=i!==void 0&&r!==i.latest,s=()=>n(i?.latest);return(0,Vw.jsx)(Nu,{open:a,children:(0,Vw.jsxs)(no,{severity:"info",variant:"filled",action:(0,Vw.jsxs)(Vw.Fragment,{children:[(0,Vw.jsx)(ht,{color:"inherit",size:"small",href:i?.updateLink,onClick:()=>setTimeout(t,EPo),children:"Install"}),(0,Vw.jsx)(ht,{color:"inherit",size:"small",onClick:s,children:"Dismiss"})]}),children:["assist extension v",i?.connected," \u2192 v",i?.latest]})})}var vEe=C(ee(),1);var yEe=C(ee(),1);function FFr(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 j5=C(P(),1),RPo={display:"flex",gap:1,alignItems:"center",minWidth:0},PPo={display:"flex",gap:1,alignItems:"baseline",minWidth:0,overflow:"hidden"},APo={fontFamily:"fontFamilyMono",fontSize:13,whiteSpace:"nowrap"},LPo={fontFamily:"fontFamilyMono",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function IPo(e){let t=e.lastIndexOf("/");return t===-1?{dir:"",basename:e}:{dir:e.slice(0,t),basename:e.slice(t+1)}}function zFr({files:e,highlight:t,onHighlight:r,onSelect:n}){return(0,j5.jsx)(eg,{dense:!0,sx:{py:0},children:e.map((o,i)=>{let{dir:a,basename:s}=IPo(o);return(0,j5.jsxs)(jr,{selected:i===t,onMouseEnter:()=>r(i),onClick:()=>n(o),sx:RPo,children:[(0,j5.jsx)(B2e,{path:o}),(0,j5.jsxs)(G,{sx:PPo,children:[(0,j5.jsx)(Ce,{component:"span",sx:APo,children:s}),(0,j5.jsx)(Ce,{component:"span",color:"text.secondary",sx:LPo,children:a})]})]},o)})})}var hEe=C(P(),1),MPo={maxHeight:420,overflowY:"auto"},DPo={px:2,py:2,fontSize:13};function UFr({message:e,files:t,highlight:r,onHighlight:n,onSelect:o}){return(0,hEe.jsx)(G,{sx:MPo,children:e?(0,hEe.jsx)(Ce,{color:"text.secondary",sx:DPo,children:e}):(0,hEe.jsx)(zFr,{files:t,highlight:r,onHighlight:n,onSelect:o})})}var HFr=C(P(),1),NPo={mt:6,alignSelf:"flex-start"};function mEe({onClose:e,onEntered:t,centered:r=!1,children:n}){return(0,HFr.jsx)(vl,{open:!0,onClose:e,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:r?void 0:NPo},transition:{onEntered:t}},children:n})}var gEe=C(ee(),1);var WFr={files:[],loading:!1,error:!1};function GFr(e,t){let[r,n]=(0,gEe.useState)(WFr),o=yr();return(0,gEe.useEffect)(()=>{if(!e){n(WFr);return}let i=!1;return n(s=>({...s,loading:!0})),(async()=>{try{let s=await Jt(tn(`/api/files?cwd=${encodeURIComponent(e)}&q=${encodeURIComponent(t)}`,o));if(!s.ok)throw new Error(`HTTP ${s.status}`);let l=await s.json();if(i)return;n({files:Array.isArray(l.files)?l.files:[],loading:!1,error:!1})}catch(s){Pr(s,"file search"),i||n({files:[],loading:!1,error:!0})}})(),()=>{i=!0}},[e,t,o]),r}var KI=C(P(),1);function OPo(e,t,r){let n=new URLSearchParams({path:e});return t&&n.set("cwd",t),t&&r&&n.set("node",r),`/file?${n}`}function VFr({onClose:e}){let{worktreeNode:t}=to();return(0,KI.jsx)(ic.Provider,{value:t,children:(0,KI.jsx)(BPo,{onClose:e})})}function BPo({onClose:e}){let{worktreeCwd:t,worktreeNode:r}=to(),[n,o]=(0,yEe.useState)(""),i=GFr(t,n),a=an(),s=(0,yEe.useRef)(null),l=h=>a(OPo(h,t,r)),{highlight:u,setHighlight:d,onKeyDown:f}=N5(i.files,n,l,e),p=h=>{l(h),e()};return(0,KI.jsxs)(mEe,{onClose:e,onEntered:()=>s.current?.focus(),children:[(0,KI.jsx)(xk,{autoFocus:!0,inputRef:s,value:n,onChange:o,onKeyDown:f,placeholder:"Search files by name..."}),(0,KI.jsx)(UFr,{message:FFr(t,n,i),files:i.files,highlight:u,onHighlight:d,onSelect:p})]})}function qFr(e){Zi(fo("quickOpen").matches,e)}var YFr=C(P(),1);function jFr(){let[e,t]=(0,vEe.useState)(!1);return qFr((0,vEe.useCallback)(()=>t(!0),[])),e?(0,YFr.jsx)(VFr,{onClose:()=>t(!1)}):null}var bEe=C(P(),1);function KFr({notice:e,onClose:t,onView:r}){let n=e?.sessionId??null;return(0,bEe.jsx)(Nu,{open:e!==null,autoHideDuration:6e3,onClose:t,children:(0,bEe.jsx)(no,{severity:"success",variant:"filled",onClose:t,action:n!==null?(0,bEe.jsx)(ht,{color:"inherit",size:"small",onClick:()=>r(n),children:"View"}):void 0,children:e?.message})})}var Ine=C(ee(),1);function zG(e){let t=["claude"];return e.exposeCodexActions&&t.push("codex"),e.exposePiActions&&t.push("pi"),t}var lzr=C(ee(),1);var XFr=C(P(),1),ZFr=nt((0,XFr.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 $Po={connected:"success.main",connecting:"warning.main",disconnected:"error.main","version-blocked":"error.main"};function QFr(e){return e?$Po[e]:"success.main"}function JFr(e){return e.split("-")[0].split(".").map(Number)}function ezr(e,t){if(!e||!t||e===t)return;let r=JFr(e),n=JFr(t);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]??0)-(n[o]??0);if(Number.isNaN(i))return;if(i!==0)return i<0?"behind":"ahead"}}var XI=C(P(),1),FPo={height:16,fontSize:10},zPo={opacity:.6,fontSize:"0.85em"};function UPo(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 Ane({nodes:e,name:t,showVersion:r=!1}){let n=pEe()??ch,o=e.links.find(a=>a.name===t),i=ezr(o?.peerVersion,n);return(0,XI.jsx)(sr,{title:UPo(e,t),placement:"right",children:(0,XI.jsxs)(G,{component:"span",sx:{display:"inline-flex",alignItems:"center",gap:.75},children:[(0,XI.jsx)(ZFr,{sx:{fontSize:8,color:QFr(o?.state)}}),t,r&&o?.peerVersion&&(0,XI.jsxs)(G,{component:"span",sx:zPo,children:["v",o.peerVersion]}),i&&(0,XI.jsx)(Vn,{label:i,size:"small",color:i==="behind"?"warning":"info",sx:FPo})]})})}var ZI=C(P(),1),HPo={opacity:.6},WPo={display:"inline-flex",alignItems:"center",gap:.5,px:.5,border:1,borderStyle:"dashed",borderRadius:1};function tzr({nodes:e,name:t,clone:r}){let n=(0,ZI.jsx)(Ane,{nodes:e,name:t});return r.kind==="cloned"?n:r.kind==="unavailable"?(0,ZI.jsx)(G,{component:"span",sx:HPo,children:n}):(0,ZI.jsx)(sr,{title:TG(t,r.cloneTarget),children:(0,ZI.jsxs)(G,{component:"span",sx:WPo,children:[(0,ZI.jsx)(SG,{sx:{fontSize:14}}),n]})})}var nzr=C(P(),1),GPo={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 rzr({value:e,label:t,checked:r,autoFocus:n,onSelect:o}){return(0,nzr.jsx)(nr,{role:"radio","aria-checked":r,"data-value":e,tabIndex:r?0:-1,autoFocus:n&&r,onClick:o,sx:GPo,children:t})}var ozr={ArrowRight:1,ArrowLeft:-1};function VPo(e,t,r){if(e.key==="Tab"){let n=t+(e.shiftKey?-1:1);return n>=0&&n<r?n:void 0}return(t+ozr[e.key]+r)%r}function izr(e,t,r,n){return o=>{if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!n)return;o.preventDefault(),n();return}if(o.key!=="Tab"&&!ozr[o.key]){XT(o);return}let i=VPo(o,e.indexOf(t),e.length);i!==void 0&&(o.preventDefault(),r(e[i]),o.currentTarget.querySelector(`[data-value="${e[i]}"]`)?.focus())}}var azr=C(ee(),1);function UG(e){return e?.querySelector('[aria-checked="true"]')}function szr(e,t){(0,azr.useEffect)(()=>{let r=e.current;if(!r?.contains(document.activeElement))return;let n=UG(r);n&&n!==document.activeElement&&n.focus()},[e,t])}var Bat=C(P(),1),qPo={border:1,borderColor:"divider",borderRadius:1,height:40,p:"2px",flexShrink:0};function xEe({label:e,options:t,value:r,onChange:n,optionLabel:o=u=>u,groupRef:i,autoFocus:a,onTrack:s,onToggleRow:l}){return szr(i,r),(0,Bat.jsx)(kt,{ref:i,direction:"row",role:"radiogroup","aria-label":e,spacing:"2px",onFocus:s,onKeyDown:izr(t,r,n,l),sx:qPo,children:t.map(u=>(0,Bat.jsx)(rzr,{value:u,label:o(u),checked:u===r,autoFocus:a,onSelect:()=>n(u)},u))})}var $at=C(P(),1);function czr({value:e,onChange:t,cloneState:r}){let{nodes:n,names:o,visible:i}=Cl(),a=(0,lzr.useRef)(null);return!i||!n||!e?null:(0,$at.jsx)(xEe,{label:"Machine",options:o,value:e,onChange:t,optionLabel:s=>(0,$at.jsx)(tzr,{nodes:n,name:s,clone:r(s)}),groupRef:a,autoFocus:!1,onTrack:()=>{}})}var SEe=C(P(),1);function uzr({prompt:e,children:t}){return(0,SEe.jsxs)(kt,{children:[e,(0,SEe.jsx)(kt,{spacing:1,sx:{px:1.5,pb:1.5},children:t})]})}var fzr=C(P(),1),jPo=".MuiOutlinedInput-notchedOutline",YPo={"& .MuiOutlinedInput-root":{px:"18px",py:2,minHeight:92,alignItems:"flex-start",bgcolor:"transparent",borderRadius:0,fontSize:15},[`&&& ${jPo}`]:{border:0},"& textarea::placeholder":{color:"text.disabled",opacity:1}};function dzr({value:e,onChange:t,placeholder:r,inputRef:n,autoFocus:o,onTrack:i}){return(0,fzr.jsx)($n,{sx:YPo,value:e,onChange:a=>t(a.target.value),onKeyDown:XT,onFocus:i,onSelect:i,inputRef:n,placeholder:r,autoFocus:o,fullWidth:!0,multiline:!0,minRows:3,maxRows:12,slotProps:{htmlInput:{"aria-label":"Prompt"}}})}var gzr=C(ee(),1);var hv={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:$Se,submitLabel:"Start session"},design:{placeholder:"Describe the design task...",submitLabel:"Start design"}},pzr=Object.keys(hv);var Fat=C(P(),1);function hzr({anchor:e,harness:t,harnesses:r,onPick:n,onClose:o}){return(0,Fat.jsx)(Rs,{open:e!==null,anchorEl:e,onClose:o,slotProps:{list:{dense:!0,"aria-label":"Harness"}},children:r.map(i=>(0,Fat.jsx)(jr,{role:"menuitemradio","aria-checked":i===t,selected:i===t,onClick:()=>{n(i),o()},sx:{fontSize:13},children:$c(i)},i))})}var QI=C(P(),1);function mzr(e){return t=>t==="prompt"&&e?(0,QI.jsxs)(QI.Fragment,{children:["prompt",(0,QI.jsx)(G,{component:"span",sx:{fontWeight:400,whiteSpace:"pre"},children:` \xB7 ${$c(e)}`}),(0,QI.jsx)(gp,{sx:{fontSize:18,mr:-.75}})]}):t}var JI=C(P(),1);function yzr({draft:e,harness:t,harnesses:r,focus:n}){let[o,i]=(0,gzr.useState)(null),a=e.mode==="prompt"&&r.length>1,s=()=>i(UG(n.modeRef.current)??null),l=u=>{a&&u==="prompt"?s():e.setMode(u)};return(0,JI.jsxs)(JI.Fragment,{children:[(0,JI.jsx)(xEe,{label:"Mode",options:pzr,value:e.mode,onChange:l,optionLabel:mzr(r.length>1?t:void 0),groupRef:n.modeRef,autoFocus:n.autoFocus==="mode",onTrack:n.trackMode,onToggleRow:a?s:void 0}),(0,JI.jsx)(hzr,{anchor:o,harness:t,harnesses:r,onPick:e.setHarness,onClose:()=>i(null)})]})}var Pzr=C(ee(),1);var zat=C(P(),1),KPo={zIndex:e=>e.zIndex.modal+1};function vzr({open:e,anchor:t,children:r}){return(0,zat.jsx)(RD,{open:e,anchorEl:t,placement:"bottom-start",sx:KPo,children:(0,zat.jsx)(Zr,{sx:{maxHeight:240,overflowY:"auto",width:t?.clientWidth},onMouseDown:n=>n.preventDefault(),children:r})})}var bzr=C(P(),1),xzr=nt((0,bzr.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown");var Uat=C(P(),1),XPo={fontSize:13,height:36,pr:1,cursor:"pointer","& input":{cursor:"text"}},ZPo={fontSize:16,color:"text.disabled"};function Szr(e){return{htmlInput:{role:"combobox","aria-label":"Repo","aria-expanded":e},input:{sx:XPo,endAdornment:(0,Uat.jsx)(lRe,{position:"end",children:(0,Uat.jsx)(xzr,{sx:ZPo})})}}}var Tzr=C(pD(),1);function wzr({open:e,highlighted:t,accept:r,close:n,navigate:o,openList:i}){return a=>{if(!e){if(a.key==="ArrowDown"){a.preventDefault(),i();return}XT(a);return}if(a.key!=="Escape"){if(a.key==="Enter"){if(a.preventDefault(),t===void 0)return;(0,Tzr.flushSync)(()=>{r(t),n()}),XT(a);return}if(a.key!=="Tab"){o(a);return}t!==void 0&&r(t),n()}}}function TEe(e,t){let r=t.trim().toLowerCase();return r?e.filter(n=>kx(n).toLowerCase().includes(r)):e}var Hat=C(ee(),1);function Czr(){let[e,t]=(0,Hat.useState)(!1),[r,n]=(0,Hat.useState)("");return{open:e,query:r,show:()=>t(!0),filterBy:o=>{n(o),t(!0)},close:()=>{t(!1),n("")}}}var _zr=C(ee(),1);var kzr=e=>e?kx(e):"";function Ezr(e){let[t,r]=(0,_zr.useState)(()=>kzr(e));return{text:t,setText:r,showRepo:n=>r(kzr(n))}}function Rzr(e,t,r){let n=Czr(),o=Ezr(t),i=TEe(e,n.query),a=d=>{r(d),o.showRepo(d)},s=N5(i,n.query,a,n.close),l=()=>s.setHighlight(Math.max(e.indexOf(t),0)),u=()=>{l(),n.show()};return{open:n.open,text:o.text,filtered:i,highlight:s.highlight,setHighlight:s.setHighlight,onKeyDown:wzr({open:n.open,highlighted:i[s.highlight],accept:a,close:n.close,navigate:s.onKeyDown,openList:u}),onClick:()=>{n.open||u()},onType:d=>{o.setText(d),n.filterBy(d)},onFocus:l,onBlur:()=>{n.close(),o.showRepo(t)},pick:d=>{a(d),n.close()}}}var HG=C(P(),1);function Azr({repos:e,value:t,onChange:r,inputRef:n,autoFocus:o,onTrack:i}){let a=Rzr(e,t,r),s=(0,Pzr.useRef)(null);return(0,HG.jsxs)(G,{ref:s,sx:{flex:1,minWidth:0},children:[(0,HG.jsx)($n,{value:a.text,onChange:l=>a.onType(l.target.value),onFocus:l=>{l.target.select(),a.onFocus(),i()},inputRef:n,autoFocus:o,onClick:a.onClick,onBlur:a.onBlur,onKeyDown:a.onKeyDown,placeholder:"Repo",size:"small",fullWidth:!0,slotProps:Szr(a.open)}),(0,HG.jsx)(vzr,{open:a.open,anchor:s.current,children:(0,HG.jsx)(W_e,{repos:a.filtered,selected:t,highlight:a.highlight,onHighlight:a.setHighlight,onSelect:a.pick})})]})}var Y5=C(P(),1);function Lzr({cloneState:e,...t}){let{draft:r,focus:n}=t,{repos:o}=to();return(0,Y5.jsxs)(uzr,{prompt:(0,Y5.jsx)(dzr,{value:r.prompt,onChange:r.setPrompt,placeholder:hv[r.mode].placeholder,inputRef:n.promptRef,autoFocus:n.autoFocus==="prompt",onTrack:n.trackPrompt}),children:[(0,Y5.jsxs)(kt,{direction:"row",spacing:1,sx:{alignItems:"flex-start"},children:[(0,Y5.jsx)(Azr,{repos:o,value:r.cwd,onChange:r.setCwd,inputRef:n.repoRef,autoFocus:n.autoFocus==="repo",onTrack:n.trackRepo}),(0,Y5.jsx)(yzr,{...t})]}),(0,Y5.jsx)(czr,{value:r.node,onChange:r.setNode,cloneState:e})]})}var Dzr=C(P(),1),Izr=[["Enter","start"],["Shift+Enter","newline"],["Esc","close"]];function Mzr({submitLabel:e,disabled:t=!1,loading:r=!1}){return(0,Dzr.jsx)(ht,{type:"submit",variant:"contained",disabled:t,loading:r,children:e})}var eM=C(P(),1),QPo=e=>({alignItems:"center",flexWrap:"wrap",gap:"14px",py:"10px",pl:"18px",pr:1.5,borderTop:1,borderColor:e.tokens.color.lineSoft,bgcolor:"background.default",fontSize:12,color:"text.secondary"}),JPo=e=>({mr:.5,px:"5px",border:1,borderColor:"divider",borderRadius:"4px",fontFamily:e.typography.fontFamilyMono,fontSize:10.5,color:"text.primary"});function Nzr(e){return(0,eM.jsxs)(kt,{direction:"row",sx:QPo,children:[Izr.map(([t,r])=>(0,eM.jsxs)("span",{children:[(0,eM.jsx)(G,{component:"kbd",sx:JPo,children:t}),r]},t)),(0,eM.jsx)(G,{sx:{flex:1}}),(0,eM.jsx)(Mzr,{...e})]})}var tM=C(ee(),1);function Ozr(e,t){let r=(0,tM.useRef)(e),n=(0,tM.useRef)(null),o=(0,tM.useRef)(null),i=(0,tM.useRef)(null),a=(0,tM.useCallback)(u=>{n.current=u;let{field:d,selectionStart:f,selectionEnd:p}=r.current;u&&d==="prompt"&&u.setSelectionRange(f,p)},[]),s=u=>{let d=u.target;t({field:"prompt",selectionStart:d.selectionStart,selectionEnd:d.selectionEnd})},l=()=>{if(i.current?.closest("form")?.contains(document.activeElement))return;let{field:u}=r.current;({repo:o.current,mode:UG(i.current),prompt:n.current}[u]??n.current)?.focus()};return{autoFocus:e.field,promptRef:a,repoRef:o,modeRef:i,trackPrompt:s,trackRepo:()=>t({...e,field:"repo"}),trackMode:()=>t({...e,field:"mode"}),restore:l}}function eAo(e,t,r){return e?r.kind==="cloned"?{kind:"launch",cwd:r.cwd}:r.kind==="clonable"?{kind:"clone",prompt:V_e(r,t)}:{kind:"blocked"}:{kind:"launch",cwd:e}}function Bzr(e,t){let{names:r,visible:n}=Cl(),o=z_e(t,n?r:[void 0]);return{cloneState:o,target:eAo(t,e,o(e))}}function wEe({mode:e,harness:t,prompt:r,cwd:n,node:o},i){let a=n||void 0,s=o?[o]:[];if(e==="prompt"){t==="claude"?i.onCreate(r,a,...s):i.onCreateHarness(t,r,a,...s);return}if(e==="design"){i.onCreateDesign(r,a,...s);return}let l=o?[{node:o}]:[];Y_r(hv[e].sessionMode,n,(u,d)=>i.onCreateAssist(u,d,...l),()=>{},r)}function $zr(e,t,r,n){return r.kind==="blocked"||e.modePending?!1:r.kind==="clone"?(I_e(r.prompt,n.onCreateAssist),!0):(wEe({mode:e.mode,harness:t,prompt:e.prompt,cwd:r.cwd,node:e.node},n),e.clear(),!0)}var CEe=C(ee(),1);function Fzr(e,t){let[r,n]=(0,CEe.useState)(!1);return(0,CEe.useEffect)(()=>{!r||e.modePending||(n(!1),e.modeError||t())},[r,e.modePending,e.modeError,t]),()=>{e.modePending?n(!0):t()}}function zzr(e,t,r,n,o){let i=Fzr(e,()=>{$zr(e,t,r,n)&&o()});return a=>{a.preventDefault(),i()}}var Lne=C(ee(),1);function Uzr(e,t){let r=(0,Lne.useRef)(e),n=(0,Lne.useRef)(null);return(0,Lne.useEffect)(()=>{if(r.current&&!e){let o=n.current;o?.isConnected?o.focus():t()}r.current=e},[e,t]),o=>{n.current=o.target}}var Wzr=C(P(),1),tAo={border:0,margin:0,padding:0,minWidth:0};function Hzr({loading:e,restoreFocus:t,children:r}){let n=Uzr(e,t);return(0,Wzr.jsx)("fieldset",{disabled:e,style:tAo,onFocus:n,children:r})}var _Ee=C(P(),1);function kEe({error:e,onRetry:t}){return e?(0,_Ee.jsxs)(no,{severity:"error",sx:{mx:2,my:1},action:t&&(0,_Ee.jsx)(ht,{color:"inherit",size:"small",onClick:t,children:"Retry"}),children:["Couldn't load this repo's default mode (",e,"). Pick a mode or retry."]}):null}var K5=C(P(),1);function Gzr({draft:e,launchers:t,onClose:r}){let n=Ozr(e.focus,e.setFocus),o=zG(_0()),i=o.includes(e.harness)?e.harness:"claude",{target:a,cloneState:s}=Bzr(e.node,e.cwd),l=zzr(e,i,a,t,r);return(0,K5.jsx)(mEe,{onClose:r,onEntered:n.restore,centered:!0,children:(0,K5.jsx)("form",{onSubmit:l,children:(0,K5.jsxs)(Hzr,{loading:e.modePending,restoreFocus:n.restore,children:[(0,K5.jsx)(Lzr,{draft:e,harness:i,harnesses:o,focus:n,cloneState:s}),(0,K5.jsx)(kEe,{error:e.modeError,onRetry:e.retryMode}),(0,K5.jsx)(Nzr,{submitLabel:a.kind==="clone"?"Clone":hv[e.mode].submitLabel,disabled:a.kind==="blocked",loading:e.modePending})]})})})}var rM=C(ee(),1);async function rAo(e){try{let t=e?`?cwd=${encodeURIComponent(e)}`:"",r=await Jt(`/api/new-session-defaults${t}`);if(!r.ok)return{error:`HTTP ${r.status}`};let n=await r.json();if(Object.hasOwn(hv,n?.mode))return{mode:n.mode};throw new Error(`unknown mode ${JSON.stringify(n?.mode)}`)}catch(t){return Pr(t,"new-session defaults"),{error:t instanceof Error?t.message:String(t)}}}function EEe(e,t=0){let[r,n]=(0,rM.useState)(0),[o,i]=(0,rM.useState)(null),a=(0,rM.useCallback)(()=>n(l=>l+1),[]);if((0,rM.useEffect)(()=>{let l=!1;return rAo(e).then(u=>{l||i({cwd:e,opens:t,attempt:r,outcome:u})}),()=>{l=!0}},[e,t,r]),!o)return null;let{outcome:s}=o;return{mode:"mode"in s?s.mode:"prompt",pending:o.cwd!==e||o.opens!==t||o.attempt!==r,error:"error"in s?s.error:void 0,retry:a}}function REe(e,t){if(!(e!==void 0||!t||t.pending))return t.error}function Vzr(e,{visible:t,names:r,selected:n}){if(t)return e&&r.includes(e)?e:n}var X5=C(ee(),1);var qzr={field:"prompt",selectionStart:0,selectionEnd:0};function jzr(){let[e,t]=EH("new-session"),[r,n]=(0,X5.useState)(),[o,i]=(0,X5.useState)(),[a,s]=(0,X5.useState)("claude"),[l,u]=(0,X5.useState)(),[d,f]=(0,X5.useState)(qzr),p=(0,X5.useCallback)(()=>{t(""),n(void 0),i(void 0),u(void 0),f(qzr)},[t]);return{prompt:e,cwd:r,mode:o,harness:a,node:l,focus:d,setPrompt:t,setNode:u,setCwd:n,setMode:i,setHarness:s,setFocus:f,clear:p}}function Yzr(e,t=EEe){let{selectedCwd:r}=to(),n=Cl(),o=jzr(),i=o.cwd??r,a=t(i,e);return a?{...o,cwd:i,mode:o.mode??a.mode,modePending:o.mode===void 0&&a.pending,modeError:REe(o.mode,a),retryMode:a.retry,node:Vzr(o.node,n)}:null}function Kzr(e){Zi(fo("newSession").matches,e)}var Xzr=C(ee(),1);function Zzr(e,t){let{selectedCwd:r}=to(),[n,o]=al(),i=n.get("new"),a=n.get("newCwd")??r,{setPrompt:s,setCwd:l,setFocus:u}=e??{};(0,Xzr.useEffect)(()=>{i===null||!s||!l||!u||(i&&(s(i),l(a),u({field:"prompt",selectionStart:i.length,selectionEnd:i.length})),t(),o(d=>(d.delete("new"),d.delete("newCwd"),d),{replace:!0}))},[i,a,s,l,u,t,o])}var Jzr=C(P(),1);function Qzr({launchers:e}){let[t,r]=(0,Ine.useState)(!1),[n,o]=(0,Ine.useState)(0),i=Yzr(n),a=(0,Ine.useCallback)(()=>{r(!0),o(s=>s+1)},[]);return Kzr(a),Zzr(i,a),!t||!i?null:(0,Jzr.jsx)(Gzr,{draft:i,launchers:e,onClose:()=>r(!1)})}var PEe=C(P(),1);function eUr({reconnecting:e}){return(0,PEe.jsx)(Nu,{open:e,children:(0,PEe.jsx)(no,{severity:"info",variant:"filled",icon:(0,PEe.jsx)(Ao,{size:16,color:"inherit"}),children:"Reconnecting\u2026"})})}var mv=C(P(),1);function tUr({socket:e,onViewLaunchedSession:t}){return(0,mv.jsxs)(mv.Fragment,{children:[(0,mv.jsx)(jFr,{}),(0,mv.jsx)(Qzr,{launchers:{onCreate:e.createSession,onCreateDesign:e.createDesignSession,onCreateHarness:e.createHarnessSession,onCreateAssist:e.createAssistSession}}),(0,mv.jsx)(eUr,{reconnecting:e.reconnecting}),(0,mv.jsx)($Fr,{}),(0,mv.jsx)(kl,{error:e.error,onClose:e.clearError}),(0,mv.jsx)(KFr,{notice:e.success,onClose:e.clearSuccess,onView:t})]})}var Nx=C(ee(),1);var nAo=6e4;function oAo(e,t,r){return t.map(n=>e.find(o=>o.name===n)??{name:n,local:n===r,loading:!0})}function AEe(e){let t=e.nodes?.local,r=e.names.join(`
4062
4062
  `),[n,o]=(0,Nx.useState)([]),i=(0,Nx.useRef)(0),a=(0,Nx.useCallback)(()=>{let l=r?r.split(`
4063
4063
  `):[];if(l.length===0)return;let u=++i.current;o(d=>oAo(d,l,t));for(let d of l)s_e(d,d===t).then(f=>{u===i.current&&o(p=>p.map(h=>h.name===d?f:h))})},[r,t]);(0,Nx.useEffect)(()=>{a();let l=setInterval(a,nAo);return()=>clearInterval(l)},[a]);let s=n.length===0;return(0,Nx.useMemo)(()=>({entries:n,loading:s,refresh:a}),[n,s,a])}var Z5=C(P(),1);function rUr({shell:e,children:t}){let{socket:r,selection:n,launch:o,sidebarCollapse:i}=e,a=AEe(r.nodeSelection);return(0,Z5.jsx)(Qit.Provider,{value:a,children:(0,Z5.jsx)(HLe.Provider,{value:i,children:(0,Z5.jsx)(kY.Provider,{value:n,children:(0,Z5.jsx)(xLe.Provider,{value:r.nodeSelection,children:(0,Z5.jsx)(ic.Provider,{value:n.selectedNode,children:(0,Z5.jsx)(BZe.Provider,{value:o,children:(0,Z5.jsx)(jbt,{children:t})})})})})})})}var nUr=C(P(),1),oUr=nt((0,nUr.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 iUr=C(ee(),1);var gv=C(P(),1),iAo={ml:1,textTransform:"none",fontSize:12};function aUr(){let{nodes:e,names:t,visible:r,selected:n,select:o}=Cl(),[i,a]=(0,iUr.useState)(null);return!r||!e||!n?null:(0,gv.jsxs)(gv.Fragment,{children:[(0,gv.jsx)(ht,{size:"small",color:"inherit",startIcon:(0,gv.jsx)(oUr,{fontSize:"small"}),"aria-label":"Machine","aria-haspopup":"menu",onClick:s=>a(s.currentTarget),sx:iAo,children:(0,gv.jsx)(Ane,{nodes:e,name:n})}),(0,gv.jsx)(Rs,{anchorEl:i,open:!!i,onClose:()=>a(null),children:t.map(s=>(0,gv.jsx)(jr,{selected:s===n,onClick:()=>{o(s),a(null)},sx:{fontSize:13},children:(0,gv.jsx)(Ane,{nodes:e,name:s,showVersion:!0})},s))})]})}var Mne=C(ee(),1);function sUr(e,t){return[...e[0].slice(0,-1),String(t+1)]}var nM=C(P(),1),aAo=[gi("secondary"),{ml:.75}];function lUr({index:e,label:t,count:r,...n}){let{chords:o}=fo("navTab");return(0,nM.jsx)(sr,{describeChild:!0,title:(0,nM.jsx)(Rd,{label:t,chords:[sUr(o,e)]}),children:(0,nM.jsx)(jv,{label:r?(0,nM.jsxs)("span",{children:[t,(0,nM.jsx)(G,{component:"span",sx:aAo,children:r})]}):t,...n})})}var cUr=C(ee(),1);var sAo=6e4;function uUr(){let e=K2e();return(0,cUr.useEffect)(()=>{qs.refresh();let t=setInterval(()=>{qs.refresh()},sAo);return()=>clearInterval(t)},[]),e?.length??0}var Wat=C(ee(),1);function dUr(e,t){let{bound:r}=fo("navTab"),n=e.length,o=(0,Wat.useCallback)(a=>(DY(a,r)??n)<n,[r,n]),i=(0,Wat.useCallback)(a=>{let s=e[DY(a,r)??-1];s&&t(s)},[e,t,r]);Zi(o,i)}var LEe=C(ee(),1);function fUr(){let[e,t]=(0,LEe.useState)(!1);return(0,LEe.useEffect)(()=>{let r=!1;return(async()=>{try{let o=await(await Jt("/api/news/nav")).json();r||t(o?.showInNav===!0)}catch(n){Pr(n,"news nav"),r||t(!1)}})(),()=>{r=!0}},[]),e}var IEe=C(ee(),1);async function lAo(e,t){let r=await Jt(tn(`/api/releases/configured?cwd=${encodeURIComponent(e)}`,t));return r.ok?(await r.json())?.configured===!0:void 0}function pUr(e){let[t,r]=(0,IEe.useState)(null),n=yr(),o=`${n??""}\0${e}`;return(0,IEe.useEffect)(()=>{if(!e)return;let i=!1;return lAo(e,n).catch(a=>{Pr(a,"releases configured")}).then(a=>{i||r({key:o,configured:a})}),()=>{i=!0}},[e,n,o]),t?.key===o?t.configured:void 0}var hUr=C(ee(),1);function mUr(e){let{pathname:t}=mi(),r=an(),n=t==="/releases"||t.startsWith("/releases/");(0,hUr.useEffect)(()=>{e===!1&&n&&r("/sessions",{replace:!0})},[e,n,r])}var cAo={path:"/sessions",label:"Sessions"},uAo={path:"/backlog",label:"Backlog"},dAo={path:"/next",label:"Next"},fAo={path:"/releases",label:"Releases"},pAo={path:"/news",label:"News"},hAo={path:"/inbox",label:"Inbox"};function gUr(e,t){return[cAo,uAo,dAo,...e?[fAo]:[],...t?[pAo]:[],hAo]}var Gat=C(P(),1),mAo={mx:"6px"};function yUr({cwd:e}){let t=mi(),r=an(),n=pUr(e),o=fUr(),i=uUr();mUr(n);let a=n===!0,s=(0,Mne.useMemo)(()=>gUr(a,o),[a,o]),l=(0,Mne.useMemo)(()=>s.map(f=>f.path),[s]),u=s.findIndex(f=>t.pathname.startsWith(f.path)),d=(0,Mne.useCallback)(f=>{t.pathname!==f&&r(f)},[t.pathname,r]);return dUr(l,d),(0,Gat.jsx)(gR,{sx:mAo,value:u===-1?!1:u,textColor:"inherit",indicatorColor:"secondary",children:s.map((f,p)=>(0,Gat.jsx)(lUr,{index:p,label:f.label,count:f.path==="/inbox"?i:void 0,onClick:()=>d(f.path)},f.path))})}var Dne=C(P(),1),vUr=(e,t)=>({bgcolor:e,color:t,"& .MuiSvgIcon-root":{color:t},transition:"filter 0.2s ease, transform 0.2s ease","&:hover":{bgcolor:e,color:t,filter:"brightness(1.08)"},"&:active":{transform:"translateY(1px)"}}),gAo=e=>({ml:.75,...e.tokens.color.appBar?vUr("primary.main","primary.contrastText"):vUr("primary.contrastText","primary.main")});function bUr(){let[,e]=al(),{label:t,chords:r}=fo("newSession");return(0,Dne.jsx)(sr,{title:(0,Dne.jsx)(Rd,{label:t,chords:r}),children:(0,Dne.jsx)(jt,{sx:gAo,"aria-label":"New session",onClick:()=>e(o=>(o.set("new",""),o),{replace:!0}),children:(0,Dne.jsx)(mp,{})})})}var MEe=C(ee(),1);var Nne=C(P(),1),yAo={strokeWidth:2};function xUr(e){return(0,Nne.jsxs)(HSe,{viewBox:"0 0 24 24",sx:yAo,...e,children:[(0,Nne.jsx)("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 3.5c-.3 1.15-.3 2.35 0 3.5A5.4 5.4 0 0 0 4 10.5c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"}),(0,Nne.jsx)("path",{d:"M9 18c-4.51 2-5-2-7-2"})]})}var One=C(P(),1);function SUr({cwd:e}){let[t,r]=(0,MEe.useState)(null),n=yr();return(0,MEe.useEffect)(()=>{if(!e){r(null);return}let o=!1;return(async()=>{try{let a=await(await Jt(tn(`/api/github-url?cwd=${encodeURIComponent(e)}`,n))).json();o||r(a?.url??null)}catch(i){Pr(i,"GitHub URL"),o||r(null)}})(),()=>{o=!0}},[e,n]),t?(0,One.jsx)(sr,{title:"Open in GitHub",children:(0,One.jsx)(G,{component:"span",sx:WSe,children:(0,One.jsx)(jt,{onClick:()=>window.open(t,"_blank"),children:(0,One.jsx)(xUr,{})})})}):null}var yv=C(P(),1),vAo={color:"inherit",mr:1.5};function TUr({reconnecting:e}){let{pending:t,error:r,clearError:n,restart:o}=A5("webserver",e);return(0,yv.jsxs)(yv.Fragment,{children:[(0,yv.jsx)(sr,{title:"Restart web server",children:(0,yv.jsx)("span",{children:(0,yv.jsx)(jt,{sx:vAo,disabled:t,onClick:o,children:t?(0,yv.jsx)(Ao,{size:24}):(0,yv.jsx)(oH,{})})})}),(0,yv.jsx)(kl,{error:r,onClose:n})]})}var kUr=C(ee(),1);var wUr=C(ee(),1);function CUr(e){let t=Pn().palette.primary.main;Zi(fo("focusRepoPicker").matches,(0,wUr.useCallback)(()=>Fc({locate:()=>e.current?.querySelector("button")??null,focus:r=>r.focus()},t),[e,t]))}var Bne=C(P(),1),bAo={width:240,ml:2};function _Ur({repos:e,selected:t,onSelect:r}){let n=(0,kUr.useRef)(null);CUr(n);let{chords:o}=fo("focusRepoPicker");return(0,Bne.jsx)(G,{ref:n,sx:bAo,children:(0,Bne.jsx)(FSe,{label:t?kx(t):"Select repo...",tooltip:(0,Bne.jsx)(Rd,{label:"Repo",chords:o}),typeToOpen:!0,children:(i,a)=>(0,Bne.jsx)(IBr,{repos:e,selected:t,onSelect:r,close:i,initialFilter:a})})})}var OUr=C(ee(),1);var $ne=C(ee(),1);function DEe(e){let[t,r]=(0,$ne.useState)([]),[n,o]=(0,$ne.useState)(!0),i=yr();return(0,$ne.useEffect)(()=>{if(!e){r([]),o(!1);return}let a=!1;return o(!0),Jt(tn(`/api/pr-list?cwd=${encodeURIComponent(e)}`,i)).then(s=>s.json()).then(s=>{a||(r(Array.isArray(s?.prs)?s.prs:[]),o(!1))}).catch(s=>{Pr(s,"open PRs"),!a&&(r([]),o(!1))}),()=>{a=!0}},[e,i]),{prs:t,loading:n}}var Vat=C(P(),1);function qat({text:e}){return(0,Vat.jsx)(G,{sx:{p:1.5},children:(0,Vat.jsx)(Ce,{sx:{fontSize:13,color:"text.secondary"},children:e})})}var oM=C(P(),1);function EUr({pr:e,highlighted:t,onHover:r,onPick:n}){let o=H_e(t);return(0,oM.jsx)(jr,{ref:o,selected:t,onMouseDown:i=>i.preventDefault(),onMouseEnter:r,onClick:()=>n(e),sx:{alignItems:"flex-start",py:.75,whiteSpace:"normal"},children:(0,oM.jsxs)(kt,{spacing:.25,sx:{minWidth:0},children:[(0,oM.jsxs)(Ce,{sx:{fontSize:13,lineHeight:1.3,fontWeight:500},children:[e.title,e.isDraft&&(0,oM.jsx)(Vn,{label:"Draft",size:"small",variant:"outlined",sx:{ml:.75,height:18,fontSize:10,verticalAlign:"middle"}})]}),(0,oM.jsxs)(Ce,{sx:{fontSize:11,color:"text.secondary"},children:["#",e.number," \xB7 ",e.author," \xB7 ",xo(e.createdAt)]})]})})}var jat=C(P(),1);function RUr({prs:e,highlight:t,onHighlight:r,onPick:n}){return(0,jat.jsx)(eg,{dense:!0,disablePadding:!0,sx:{maxHeight:200,overflowY:"auto"},children:e.map((o,i)=>(0,jat.jsx)(EUr,{pr:o,highlighted:i===t,onHover:()=>r(i),onPick:n},o.number))})}var AUr=C(ee(),1);function PUr(e,t){let r=t.trim().toLowerCase();if(!r)return e;let n=r.replace(/^#/,"");return e.filter(o=>o.title.toLowerCase().includes(r)||o.author.toLowerCase().includes(r)||n!==""&&String(o.number).includes(n))}function LUr(e,t,r){let[n,o]=(0,AUr.useState)(""),i=PUr(e,n),{highlight:a,setHighlight:s,onKeyDown:l}=N5(i,n,t,r);return{filter:n,setFilter:o,filtered:i,highlight:a,setHighlight:s,onKeyDown:l,select:d=>{t(d),r()}}}var Q5=C(P(),1),IUr={..._H,left:"auto",width:320,maxHeight:"none",overflowY:"visible"};function MUr({cwd:e,onPick:t,close:r}){let{prs:n,loading:o}=DEe(e),i=LUr(n,t,r);return o||n.length===0?(0,Q5.jsx)(Zr,{elevation:4,sx:IUr,children:(0,Q5.jsx)(qat,{text:o?"Loading open PRs\u2026":"No open PRs"})}):(0,Q5.jsxs)(Zr,{elevation:4,sx:IUr,children:[(0,Q5.jsx)(xk,{autoFocus:!0,value:i.filter,onChange:i.setFilter,onKeyDown:i.onKeyDown,placeholder:"Filter PRs..."}),i.filtered.length===0?(0,Q5.jsx)(qat,{text:"No PRs match"}):(0,Q5.jsx)(RUr,{prs:i.filtered,highlight:i.highlight,onHighlight:i.setHighlight,onPick:i.select})]})}var NUr=C(P(),1);function DUr({cwd:e,onPick:t,close:r}){return(0,NUr.jsx)(MUr,{cwd:e,onPick:t,close:r})}var J5=C(P(),1);function BUr({cwd:e,disabled:t,onSelect:r}){let{prs:n,loading:o}=DEe(e),[i,a]=(0,OUr.useState)(null);return o||n.length===0?null:(0,J5.jsxs)(J5.Fragment,{children:[(0,J5.jsx)(FSe,{label:"prs",disabled:t,children:s=>(0,J5.jsx)(DUr,{cwd:e,onPick:a,close:s})}),i&&(0,J5.jsx)(ySe,{pr:i,onSelect:s=>{r(i,s),a(null)},onCancel:()=>a(null)})]})}var FUr=C(P(),1);function $Ur({onStartRun:e,cwd:t}){let r=OSe(t);return!t||r.length===0?null:(0,FUr.jsx)(DSe,{runs:r,onSelect:(n,o)=>e(n,t,o)})}var Fne=C(P(),1);function zUr({onCreateAssist:e,onStartRun:t}){let{selectedCwd:r,selectedNode:n}=to();return(0,Fne.jsxs)(kt,{direction:"row",spacing:.5,sx:{alignItems:"center","&:not(:empty)":{ml:1.5}},children:[(0,Fne.jsx)(BUr,{cwd:r,disabled:!r,onSelect:(o,i)=>e([...i,String(o.number)],r,{...S4(o),node:n})}),(0,Fne.jsx)($Ur,{onStartRun:(o,i,a)=>t(o,i,a,void 0,n),cwd:r})]})}var Lm=C(P(),1),xAo={minHeight:48,pl:1,pr:14};function UUr({socket:e,selection:t}){let{collapsed:r,onToggleCollapsed:n}=Ik();return(0,Lm.jsxs)(hR,{variant:"dense",disableGutters:!0,sx:xAo,children:[r&&(0,Lm.jsx)(uue,{collapsed:r,onToggleCollapsed:n}),(0,Lm.jsx)(TUr,{reconnecting:e.reconnecting}),(0,Lm.jsx)(yUr,{cwd:t.selectedCwd}),(0,Lm.jsx)(aUr,{}),(0,Lm.jsx)(_Ur,{repos:t.repos,selected:t.selectedCwd,onSelect:t.setSelectedCwd}),(0,Lm.jsxs)(G,{sx:{display:"flex",alignItems:"center",ml:1},children:[(0,Lm.jsx)(GSe,{cwd:t.selectedCwd}),(0,Lm.jsx)(SUr,{cwd:t.selectedCwd}),(0,Lm.jsx)(bUr,{})]}),(0,Lm.jsx)(zUr,{onCreateAssist:e.createAssistSession,onStartRun:e.startRun})]})}var NEe=C(ee(),1);function HUr(){let[e,t]=(0,NEe.useState)(null);return(0,NEe.useEffect)(()=>{let r=!1;return(async()=>{try{let o=await(await Jt("/api/health")).json();!r&&typeof o?.nodeName=="string"&&t(o.nodeName)}catch(n){Pr(n,"node name")}})(),()=>{r=!0}},[]),e}var GUr=C(P(),1),SAo={lineHeight:"32px",bgcolor:"transparent"};function WUr(){let e=HUr();return e?(0,GUr.jsx)(F3e,{sx:SAo,children:e}):null}var VUr=C(P(),1),qUr=nt((0,VUr.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 jUr=C(P(),1),YUr=nt((0,jUr.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 KUr=C(P(),1),XUr=nt((0,KUr.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 ZUr=C(P(),1),QUr=nt((0,ZUr.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 Yat=C(P(),1);function JUr({mode:e}){return e==="dark"?(0,Yat.jsx)(QUr,{fontSize:"small"}):(0,Yat.jsx)(XUr,{fontSize:"small"})}var eHr=C(P(),1),tHr=nt((0,eHr.jsx)("path",{d:"M15.5 1h-8C6.12 1 5 2.12 5 3.5v17C5 21.88 6.12 23 7.5 23h8c1.38 0 2.5-1.12 2.5-2.5v-17C18 2.12 16.88 1 15.5 1m-4 21c-.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.5m4.5-4H7V4h9z"}),"PhoneIphone");var WG=C(P(),1);function rHr({onClose:e}){let t=an();return(0,WG.jsxs)(jr,{onClick:()=>{e(),t("/connect-mobile")},children:[(0,WG.jsx)(Jm,{children:(0,WG.jsx)(tHr,{fontSize:"small"})}),(0,WG.jsx)(Sd,{children:"Connect mobile"})]})}var nHr=C(P(),1),oHr=nt((0,nHr.jsx)("path",{d:"M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7s2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11"}),"Extension");var GG=C(P(),1);function TAo(e){return e?.installLink?`${e.connected?`v${e.connected} installed`:"not connected"} \xB7 v${e.latest} latest`:"unavailable"}function iHr({onClose:e}){let{entries:t}=gx(),r=t.find(o=>o.local)?.status?.extension,n=r?.installLink;return(0,GG.jsxs)(jr,{component:"a",href:n,disabled:!n,onClick:e,children:[(0,GG.jsx)(Jm,{children:(0,GG.jsx)(oHr,{fontSize:"small"})}),(0,GG.jsx)(Sd,{primary:"Firefox extension",secondary:TAo(r)})]})}var aHr=C(P(),1),sHr=nt((0,aHr.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 VG=C(P(),1);function lHr(){let e=kSe();return(0,VG.jsxs)(jr,{onClick:()=>F3t(!e),children:[(0,VG.jsx)(Jm,{children:(0,VG.jsx)(sHr,{fontSize:"small"})}),(0,VG.jsx)(Sd,{children:e?"Hide render HUD":"Show render HUD"})]})}var Qs=C(P(),1);function cHr({mode:e,restartLabel:t,updateLabel:r,onToggleColorMode:n,onShowShortcuts:o,onConnectMobile:i,onFirefoxExtension:a,onRestart:s,onUpdate:l}){return[(0,Qs.jsxs)(jr,{onClick:n,children:[(0,Qs.jsx)(Jm,{children:(0,Qs.jsx)(JUr,{mode:e})}),(0,Qs.jsx)(Sd,{children:"Toggle dark mode"})]},"color-mode"),(0,Qs.jsx)(lHr,{},"render-hud"),(0,Qs.jsxs)(jr,{onClick:o,children:[(0,Qs.jsx)(Jm,{children:(0,Qs.jsx)(qUr,{fontSize:"small"})}),(0,Qs.jsx)(Sd,{children:"Keyboard shortcuts"})]},"shortcuts"),(0,Qs.jsx)(rHr,{onClose:i},"connect-mobile"),(0,Qs.jsx)(iHr,{onClose:a},"firefox-extension"),(0,Qs.jsx)(eo,{},"restart-divider"),(0,Qs.jsxs)(jr,{onClick:s,children:[(0,Qs.jsx)(Jm,{children:(0,Qs.jsx)(_8,{fontSize:"small"})}),(0,Qs.jsx)(Sd,{children:t})]},"restart"),(0,Qs.jsxs)(jr,{onClick:l,children:[(0,Qs.jsx)(Jm,{children:(0,Qs.jsx)(YUr,{fontSize:"small"})}),(0,Qs.jsx)(Sd,{children:r})]},"update")]}var uHr=C(ee(),1);var fHr=C(P(),1);function dHr({peer:e,onRestart:t,onClose:r}){let[n,o]=(0,uHr.useState)(!1);return(0,fHr.jsx)(Ho,{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:()=>{o(!0),t(e).finally(r)},onCancel:r})}function pHr(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 wAo=Object.keys(b8);function hHr(){let e=x8();return pHr(wAo.map(t=>kk(t,e)))}var Im=C(P(),1),CAo={display:"flex",alignItems:"center",justifyContent:"space-between",pr:1},kAo={display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,py:.5};function mHr({onClose:e}){let t=hHr();return(0,Im.jsxs)(vl,{open:!0,onClose:e,maxWidth:"xs",fullWidth:!0,"aria-labelledby":"shortcuts-dialog-title",children:[(0,Im.jsxs)(bd,{id:"shortcuts-dialog-title",sx:CAo,children:["Keyboard shortcuts",(0,Im.jsx)(jt,{size:"small","aria-label":"Close",onClick:e,children:(0,Im.jsx)(Uo,{fontSize:"small"})})]}),(0,Im.jsx)(vd,{dividers:!0,children:t.map(r=>(0,Im.jsxs)(G,{component:"section",sx:{mb:1.5},children:[(0,Im.jsx)(Ce,{variant:"overline",color:"text.secondary",children:r.name}),r.shortcuts.map(n=>(0,Im.jsxs)(G,{sx:kAo,children:[(0,Im.jsx)(Ce,{variant:"body2",children:n.label}),(0,Im.jsx)(kt,{direction:"row",spacing:.5,children:(0,Im.jsx)(Uce,{chords:n.chords})})]},n.label))]},r.name))})]})}var iM=C(P(),1);function gHr({reconnecting:e,onClose:t}){let{pending:r,error:n,clearError:o,restart:i}=A5(iG.target,e);return(0,iM.jsxs)(iM.Fragment,{children:[(0,iM.jsx)(Ho,{title:iG.label,message:iG.message,confirmLabel:"Restart",busy:r,autoFocusConfirm:!0,onConfirm:()=>{i()},onCancel:t}),(0,iM.jsx)(kl,{error:n,onClose:o})]})}var vHr=C(P(),1);function _Ao(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 yHr({peer:e,onConfirm:t,onClose:r}){return(0,vHr.jsx)(Ho,{..._Ao(e),confirmLabel:"Update",onConfirm:()=>{t(),r()},onCancel:r})}var vv=C(ee(),1);async function EAo(e){try{let t=await Jt(`/api/node-doctor?link=${encodeURIComponent(e)}`);return t.ok?(await t.json()).hop:null}catch(t){return Pr(t,"node doctor"),null}}async function bHr(e,t){let r=await EAo(e);if(!r)return t;let n=r.remediation?` \u2014 ${r.remediation}`:"";return`${t}: ${r.hop} hop failed: ${r.error}${n}`}var qw=C(ee(),1);function xHr(e){let{nodes:t}=Cl(),[r,n]=(0,qw.useState)(null),o=(0,qw.useRef)(!1),i=r?t?.links.find(l=>l.name===r.peer):void 0;(0,qw.useEffect)(()=>{if(!(!r||!i)){if(i.state!=="connected"){o.current=!0;return}o.current&&(n(null),e(r.describe(r.peer,i.peerVersion)))}},[r,i,e]);let a=(0,qw.useCallback)((l,u)=>{o.current=!1,n({peer:l,describe:u})},[]),s=(0,qw.useCallback)(()=>n(null),[]);return{watch:a,stop:s}}var RAo=9e4;function OEe(){let[e,t]=(0,vv.useState)(null),[r,n]=(0,vv.useState)(null),o=(0,vv.useRef)(void 0),i=(0,vv.useCallback)(d=>{clearTimeout(o.current),t(d)},[]),{watch:a,stop:s}=xHr(i);(0,vv.useEffect)(()=>()=>clearTimeout(o.current),[]);let l=(0,vv.useCallback)(async(d,f)=>{n(await bHr(d,f))},[]);return{requestThenAwait:(0,vv.useCallback)(async(d,f,p,h)=>{let m;try{m=await p()}catch(g){Pr(g,`${f} ${d}`)}return m?.ok?(a(d,h),clearTimeout(o.current),o.current=setTimeout(()=>{s(),l(d,`${d} did not come back`)},RAo),!0):(await l(d,`${f} failed (${await R5(m)})`),!1)},[l,a,s]),back:e,clearBack:()=>t(null),error:r,clearError:()=>n(null)}}var PAo=(e,t)=>t?`${e} is back (v${t})`:`${e} is back`;function SHr(){let{requestThenAwait:e,...t}=OEe();return{restart:n=>e(n,`Restart ${n}`,()=>P5("both",n),PAo),...t}}var zne=C(ee(),1);function BEe(e){return Jt(tn("/api/self-update",e),{method:"POST",timeoutMs:66e4})}var bv=C(ee(),1);function THr(e){return e.commandType==="assist"&&e.assistArgs?.[0]==="update"&&e.status==="done"}function $Ee(e,t,r){let[n,o]=(0,bv.useState)(!1),[i,a]=(0,bv.useState)(!1),s=(0,bv.useRef)(!1),l=(0,bv.useRef)(e);l.current=e;let u=(0,bv.useRef)(new Set),d=(0,bv.useCallback)(()=>{s.current=!1,a(!1),u.current=new Set(l.current.filter(THr).map(f=>f.id)),o(!0)},[]);return(0,bv.useEffect)(()=>{if(!n||i)return;if(t){s.current=!0;return}if(!s.current)return;e.some(p=>THr(p)&&p.node===r&&!u.current.has(p.id))&&a(!0)},[n,i,t,e,r]),{arm:d,completed:i}}var wHr=(e,t)=>t?`${e} updated to v${t}`:`${e} updated`;function CHr(e){let{nodes:t}=Cl(),{launchAssist:r}=ql(),{requestThenAwait:n,...o}=OEe(),[i,a]=(0,zne.useState)(null),[s,l]=(0,zne.useState)(),u=m=>t?.links.find(g=>g.name===m)?.state,{arm:d,completed:f}=$Ee(e,u(s)!=="connected",s);(0,zne.useEffect)(()=>{!f||!s||(l(void 0),n(s,`Restart ${s}'s web server`,()=>P5("webserver",s),wHr))},[f,s,n]);let p=async m=>{a(`Updating assist on ${m}\u2026`),await n(m,`Update ${m}`,()=>BEe(m),wHr),a(null)};return{update:m=>{if(u(m)!=="connected"){p(m);return}l(m),d(),r(["update"],void 0,{node:m})},progress:i,...o}}var xv=C(P(),1);function kHr({dialog:e,peer:t,sessions:r,reconnecting:n,onClose:o}){let{launchAssist:i,armUpdateReload:a}=ql(),s=SHr(),l=CHr(r);return(0,xv.jsxs)(xv.Fragment,{children:[e==="shortcuts"&&(0,xv.jsx)(mHr,{onClose:o}),e==="restart"&&t&&(0,xv.jsx)(dHr,{peer:t,onRestart:s.restart,onClose:o}),e==="restart"&&!t&&(0,xv.jsx)(gHr,{reconnecting:n,onClose:o}),e==="update"&&(0,xv.jsx)(yHr,{peer:t,onConfirm:()=>{if(t){l.update(t);return}a(),i(["update"])},onClose:o}),(0,xv.jsx)(Kre,{notices:s}),(0,xv.jsx)(Kre,{notices:l})]})}var _Hr=C(P(),1),EHr=nt((0,_Hr.jsx)("path",{d:"M11 18h2v-2h-2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4"}),"HelpOutlineOutlined");var FEe=C(P(),1),AAo="https://staffordwilliams.com/assist";function RHr(){return(0,FEe.jsx)(sr,{title:"Help",children:(0,FEe.jsx)(jt,{component:"a",href:AAo,target:"_blank",rel:"noopener noreferrer","aria-label":"Help",size:"small",sx:{color:"inherit"},children:(0,FEe.jsx)(EHr,{fontSize:"small"})})})}var PHr=C(P(),1),AHr=nt((0,PHr.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 LHr=C(ee(),1);var Une=C(P(),1);function IHr(){let e=an(),t=(0,LHr.useCallback)(()=>e("/config"),[e]),{matches:r,chords:n}=fo("openConfig");return Zi(r,t),(0,Une.jsx)(sr,{describeChild:!0,title:(0,Une.jsx)(Rd,{label:"Config",chords:n}),children:(0,Une.jsx)(jt,{size:"small",sx:{color:"inherit"},"aria-label":"Config",onClick:t,children:(0,Une.jsx)(AHr,{fontSize:"small"})})})}var MHr=C(P(),1),DHr=nt((0,MHr.jsx)("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}),"Menu");var zEe=C(ee(),1);var Hne=C(P(),1);function NHr({open:e,onOpen:t}){let r=(0,zEe.useRef)(null),{matches:n,chords:o}=fo("openMenu");return Zi(n,(0,zEe.useCallback)(()=>{r.current&&t(r.current)},[t])),(0,Hne.jsx)(sr,{describeChild:!0,title:(0,Hne.jsx)(Rd,{label:"Menu",chords:o}),children:(0,Hne.jsx)(jt,{ref:r,onClick:i=>t(i.currentTarget),size:"small",sx:{color:"inherit"},"aria-label":"Open menu","aria-haspopup":"true","aria-expanded":e?"true":void 0,children:(0,Hne.jsx)(DHr,{fontSize:"small"})})})}var qG=C(P(),1);function OHr({open:e,onOpen:t}){return(0,qG.jsxs)(G,{sx:{position:"fixed",top:8,right:16,zIndex:r=>r.zIndex.drawer+2,display:"flex",alignItems:"center",gap:.5,color:r=>r.tokens.color.appBar?.text??r.palette.primary.contrastText},children:[(0,qG.jsx)(RHr,{}),(0,qG.jsx)(IHr,{}),(0,qG.jsx)(NHr,{open:e,onOpen:t})]})}var aM=C(ee(),1);var $Hr=C(ee(),1);var BHr=!0,LAo=new Set(["openMenu","cycleCards"]),IAo=Object.keys(b8).filter(e=>!LAo.has(e));function FHr(e,t){let r=x8();(0,$Hr.useEffect)(()=>{if(!e)return;let n=o=>{IAo.some(i=>kk(i,r).matches(o))&&t()};return globalThis.addEventListener("keydown",n,BHr),()=>globalThis.removeEventListener("keydown",n,BHr)},[e,t,r])}function zHr(){let[e,t]=(0,aM.useState)(null),[r,n]=(0,aM.useState)(!0),o=!!e,i=(0,aM.useCallback)(()=>t(null),[]),a=(0,aM.useCallback)(s=>{n(!0),t(s)},[]);return FHr(o,(0,aM.useCallback)(()=>{n(!1),t(null)},[])),{anchorEl:e,open:o,close:i,openAt:a,restoreFocus:r}}var Wne=C(ee(),1);function UHr(e){Zi(fo("shortcutsSheet").matches,e)}function HHr(){let[e,t]=(0,Wne.useState)(null);UHr((0,Wne.useCallback)(()=>t("shortcuts"),[]));let r=(0,Wne.useCallback)(()=>t(null),[]);return{dialog:e,showDialog:t,closeDialog:r}}function WHr(){let{nodes:e,selected:t}=Cl();return e&&t&&t!==e.local?t:void 0}function GHr(e){return{restartLabel:e?`Restart ${e}`:iG.label,updateLabel:e?`Update assist on ${e}`:"Update assist"}}var jw=C(P(),1);function VHr({mode:e,toggle:t,sessions:r,reconnecting:n}){let{anchorEl:o,open:i,close:a,openAt:s,restoreFocus:l}=zHr(),{dialog:u,showDialog:d,closeDialog:f}=HHr(),p=WHr(),h=m=>()=>{a(),d(m)};return(0,jw.jsxs)(jw.Fragment,{children:[(0,jw.jsx)(OHr,{open:i,onOpen:s}),(0,jw.jsxs)(Rs,{anchorEl:o,open:i,onClose:a,disableRestoreFocus:!l,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:[(0,jw.jsx)(WUr,{}),cHr({mode:e,...GHr(p),onToggleColorMode:()=>{t(),a()},onShowShortcuts:h("shortcuts"),onConnectMobile:a,onFirefoxExtension:a,onRestart:h("restart"),onUpdate:h("update")})]}),(0,jw.jsx)(kHr,{dialog:u,peer:p,sessions:r,reconnecting:n,onClose:f})]})}var YHr=C(ee(),1);var jHr=C(P(),1);function qHr({conflict:e,onConfirm:t,onCancel:r}){let{name:n,cwd:o,port:i,group:a}=e.existing,s=Qa(o),l=i?` on port ${i}`:"",u=s?` in ${s}`:"",d=a?`, holding the ${a} server slot`:"";return(0,jHr.jsx)(Ho,{title:a?`Replace the ${a} server?`:"Replace running server?",message:`"${n}" is already serving${l}${u}${d}. Replace it \u2014 stop the running server and start this one? Shift+click skips this dialog next time.`,confirmLabel:"Replace",confirmColor:"error",onConfirm:t,onCancel:r})}var UEe=C(P(),1);function KHr({socket:e,children:t}){let{serverConflict:r,clearServerConflict:n,retrySession:o,stopSession:i,startRun:a,discardSession:s}=e,l=(0,YHr.useMemo)(()=>({onStop:i,onStart:a,onDiscard:s}),[i,a,s]),u=()=>{r&&(r.runName?a(r.runName,r.cwd,!0,r.launchedFrom,r.node):r.sessionId&&o(r.sessionId,!0),n())};return(0,UEe.jsxs)(DLe.Provider,{value:l,children:[t,r&&(0,UEe.jsx)(qHr,{conflict:r,onConfirm:u,onCancel:n})]})}var XHr=new Map;function ZHr(e,t){if(!Qde())return;let r=XHr.get(e);if(XHr.set(e,t),!!r)for(let[n,o]of Object.entries(t))Object.is(o,r[n])||v1(`\u0394 ${e}.${n}`)}var WEe=C(ee(),1);function QHr(e,t,r){if(!t)return null;let n=e[t];if(!n)return null;let o=r.find(i=>i.id===n);return!o||wl(o)!==t?null:n}function Ox(e,t,r){if(e)return t.find(n=>n.id===e)??r.find(n=>n.sessionId===e)}function HEe(){let{pathname:e}=mi();return e.startsWith("/backlog")||e.startsWith("/usage")}function JHr({selectedCwd:e,selectedCardId:t,sessions:r,history:n,activeByRepo:o,onSelect:i}){let a=Ox(t,r,n),s=a&&wl(a),l=!!(s&&s===e),u=QHr(o,e,r),d=(0,WEe.useRef)(t),f=HEe();(0,WEe.useEffect)(()=>{let p=d.current!==t&&!!s;d.current=t,!(f||p||l||!u)&&i(u)},[t,s,l,u,i,f])}var qEe=C(ee(),1);function eWr(e,t,r,n){return Ox(e,t,r)?.cwd||n}function tWr(e,t,r,n){let o=eWr(e,t,r,n.cwd),i=Ox(e,t,r);return{cwd:o,node:i?.cwd?i.node:n.node}}var Kat=C(ee(),1);function rWr(e,t,r){let{cwd:n,node:o,origin:i}=r,a=(0,Kat.useCallback)((l,u)=>{let d=sh(u,t),f=Sne(e,l);return f?f.clones[d]:d===(l===n?o:Qf)?l:void 0},[e,t,n,o]),s=(0,Kat.useCallback)(l=>Sne(e,l)?.origin??(l===n?i:void 0),[e,n,i]);return{cloneOn:a,originOf:s}}var GEe=C(ee(),1);function nWr(e,t,r,n){let o=(0,GEe.useRef)(e);(0,GEe.useEffect)(()=>{if(o.current===e)return;o.current=e;let i=Sne(t,r)?.clones[e];i&&n(i,e)},[e,t,r,n])}var jG=C(ee(),1);function oWr(e,t,r){if(t.node!==void 0)return t.node;let n=new Set(e.flatMap(o=>Object.entries(o.clones).filter(([,i])=>i===t.cwd).map(([i])=>i)));return n.has(r)?r:n.size===0||n.has(Qf)?Qf:[...n][0]}function iWr(e,t,r,n){let[o,i]=(0,jG.useState)({cwd:e}),a=(0,jG.useCallback)((l,u,d)=>i({cwd:l,node:u,origin:d}),[]);(0,jG.useEffect)(()=>{e&&!o.cwd&&i({cwd:e})},[e,o.cwd]);let s=oWr(t,{cwd:o.cwd,node:o.node===void 0?void 0:sh(o.node,n)},r);return{selectedCwd:o.cwd,selectedNode:s||void 0,selectedPick:{cwd:o.cwd,node:s,origin:o.origin},setSelectedCwd:a}}var aWr=C(ee(),1);function VEe(e,t,r){let n=Ox(e,t,r);return n&&wl(n)}function sWr(e,t,r,n){let o=VEe(e,t,r),i=Ox(e,t,r),a=i?.node??Qf,s=i?.repoGroup?.origin;(0,aWr.useEffect)(()=>{o&&n(o,a,s)},[o,a,s,n])}function lWr(e,t,r,n,o){let i=o.nodes?.local,a=sh(o.selected,i),s=(0,qEe.useMemo)(()=>B5(e,t),[e,t]),{selectedCwd:l,selectedNode:u,selectedPick:d,setSelectedCwd:f}=iWr(e,s,a,i);sWr(r,n,t,f),nWr(a,s,l,f);let{cloneOn:p,originOf:h}=rWr(s,i,d),m=(0,qEe.useMemo)(()=>s.map(v=>p9r(v,a)),[s,a]),{cwd:g,node:y}=tWr(r,n,t,{cwd:l,node:u});return(0,qEe.useMemo)(()=>({repos:m,selectedCwd:l,selectedNode:u,worktreeCwd:g,worktreeNode:y,setSelectedCwd:f,cloneOn:p,originOf:h}),[m,l,u,g,y,f,p,h])}var YEe=C(ee(),1);var e3=C(ee(),1);var cWr=C(ee(),1),jEe="assist:reloaded-after-update";function uWr(e){(0,cWr.useEffect)(()=>{globalThis.sessionStorage?.getItem(jEe)&&(globalThis.sessionStorage.removeItem(jEe),e({message:"Reloaded after updating assist",sessionId:null}))},[e])}function dWr(e,t,r,n){let{arm:o,completed:i}=$Ee(e,t),a=(0,e3.useRef)(!1),s=(0,e3.useCallback)(()=>{globalThis.sessionStorage?.setItem(jEe,"1")},[]),{error:l,restart:u}=A5("webserver",t,s);return uWr(r),(0,e3.useEffect)(()=>{l&&n(l)},[l,n]),(0,e3.useEffect)(()=>{!i||a.current||(a.current=!0,u())},[i,u]),{armUpdateReload:(0,e3.useCallback)(()=>{a.current=!1,o()},[o])}}function fWr(e){let{armUpdateReload:t}=dWr(e.sessions,e.reconnecting,e.setSuccess,e.setError),r=u1(e.selectSession),n=(0,YEe.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]),o=an(),i=(0,YEe.useCallback)(a=>{e.selectSession(a),o("/sessions"),e.clearSuccess()},[o,e.selectSession,e.clearSuccess]);return{launch:n,viewLaunchedSession:i}}var pWr=C(ee(),1);function hWr(e,t,r,n){let o=VEe(e,t,r);(0,pWr.useEffect)(()=>{e&&o&&n({type:"set-active",cwd:o,sessionId:e})},[e,o,n])}var KEe=C(ee(),1);function mWr(e,t){let r=(0,KEe.useRef)(new Map);(0,KEe.useEffect)(()=>{let n=new Set;for(let{id:o,status:i}of e)n.add(o),r.current.get(o)!==i&&(r.current.set(o,i),console.debug(`[sessions] render session ${o} status=${i}`),t({type:"ui-status",sessionId:o,status:i}));for(let o of r.current.keys())n.has(o)||r.current.delete(o)},[e,t])}var YG=C(ee(),1),gWr="assist.sessions.node";function MAo(){try{return localStorage.getItem(gWr)}catch{return null}}function DAo(e){try{localStorage.setItem(gWr,e)}catch{}}function yWr(e){let[t,r]=(0,YG.useState)(MAo),n=(0,YG.useCallback)(o=>{r(o),DAo(o)},[]);return(0,YG.useMemo)(()=>{let o=e?[e.local,...e.links.map(i=>i.name)]:[];return{nodes:e,names:o,visible:o.length>1,selected:t&&o.includes(t)?t:e?.local,select:n}},[e,t,n])}var bWr=C(ee(),1);function vWr(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 xWr(e,t){return(0,bWr.useCallback)(r=>{let n=e.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify(r));let o=vWr(r);o&&t(o)},[e,t])}var A0=C(ee(),1);function XEe(e,t,r,n,o){e({type:"create",prompt:r||void 0,cwd:n,...t,...o?{node:o}:{}})}function SWr(e){return(t,r,n)=>XEe(e,{design:!0},t,r,n)}function TWr(e){return(t,r,n,o)=>XEe(e,{harness:t},r,n,o)}function wWr(e){return(t,r,n)=>XEe(e,{auto:!0},t,r,n)}function CWr(e){return(t,r,n)=>e({type:"create-assist",assistArgs:t,cwd:r,...n})}function kWr(e){return(t,r,n,o,i)=>e({type:"resume",sessionId:t,cwd:r,name:n,harness:o,node:i})}function _Wr(e,t){return(r,n)=>{t.delete(r),e({type:"retry",sessionId:r,replace:n})}}function EWr(e,t){return r=>{t.delete(r),e({type:"restart",sessionId:r})}}function RWr(e,t){return(r,n)=>{e({type:"dismiss",sessionId:r,...n}),t.delete(r)}}function PWr(e,t){return r=>{e({type:"discard",sessionId:r}),t.delete(r)}}function AWr(e){return t=>e({type:"stop",sessionId:t})}function LWr(e){return(t,r,n)=>e({type:"transfer",sessionId:t,target:r,cwd:n})}function IWr(e){return t=>e({type:"cancel-transfer",sessionId:t})}function MWr(e){return(t,r,n,o,i)=>e({type:"create-run",runName:t,cwd:r,replace:n,launchedFrom:o,node:i})}function DWr(e){return(t,r)=>e({type:"set-autoapprove",sessionId:t,enabled:r})}function NWr(e){return(t,r)=>e({type:"set-autoadvance",sessionId:t,enabled:r})}function OWr(e){return(t,r)=>e({type:"set-starred",sessionId:t,starred:r})}function BWr(e){return(t,r)=>e({type:"input",sessionId:t,data:r,viewerId:PI})}function $Wr(e){return(t,r,n,o)=>e({type:"resize",sessionId:t,cols:r,rows:n,viewerId:PI,claim:o==="claim",refresh:o==="refresh"})}function FWr(e){return(t,r,n,o)=>e({type:"pr-decision",sessionId:t,requestId:r,decision:n,...o})}var sM=C(ee(),1);function zWr(e){return(t,r,n)=>e({type:"create",prompt:r||void 0,cwd:n,joinSessionId:t,auto:!0})}function UWr(e){return{createSession:(0,sM.useMemo)(()=>wWr(e),[e]),createSessionInStream:(0,sM.useMemo)(()=>zWr(e),[e]),createDesignSession:(0,sM.useMemo)(()=>SWr(e),[e]),createHarnessSession:(0,sM.useMemo)(()=>TWr(e),[e]),createAssistSession:(0,sM.useMemo)(()=>CWr(e),[e]),resumeSession:(0,sM.useMemo)(()=>kWr(e),[e])}}var Gne=C(ee(),1);function HWr(e,t){let r=(0,Gne.useCallback)((a,s)=>{_Wr(e,t.current)(a,s)},[e,t]),n=(0,Gne.useCallback)(a=>{EWr(e,t.current)(a)},[e,t]),o=(0,Gne.useCallback)((a,s)=>{RWr(e,t.current)(a,s)},[e,t]),i=(0,Gne.useCallback)(a=>{PWr(e,t.current)(a)},[e,t]);return{retrySession:r,restartSession:n,dismissSession:o,discardSession:i}}function WWr(e,t,r){return(n,o)=>{let i=t.get(n);return i&&(o(i),e({type:"snapshot",sessionId:n})),r.set(n,o),()=>r.delete(n)}}function GWr(e,t,r){let n={...UWr(e),sendInput:(0,A0.useMemo)(()=>BWr(e),[e]),sendResize:(0,A0.useMemo)(()=>$Wr(e),[e]),sendPrDecision:(0,A0.useMemo)(()=>FWr(e),[e]),setAutoApprove:(0,A0.useMemo)(()=>DWr(e),[e]),setAutoAdvance:(0,A0.useMemo)(()=>NWr(e),[e]),setStarred:(0,A0.useMemo)(()=>OWr(e),[e]),stopSession:(0,A0.useMemo)(()=>AWr(e),[e]),startRun:(0,A0.useMemo)(()=>MWr(e),[e]),transferSession:(0,A0.useMemo)(()=>LWr(e),[e]),cancelTransfer:(0,A0.useMemo)(()=>IWr(e),[e])},o=(0,A0.useMemo)(()=>WWr(e,t.current,r.current),[e,t,r]);return{...n,...HWr(e,t),onOutput:o}}var Vne=C(ee(),1);function VWr(e,t,r){let n=(0,Vne.useCallback)(s=>{r(s),e({type:"fetch-transcript",sessionId:s})},[e,r]),o=(0,Vne.useCallback)(s=>e({type:"fetch-user-messages",sessionId:s}),[e]),i=(0,Vne.useCallback)(()=>{r(null)},[r]),a=(0,Vne.useCallback)(s=>{r(null),t(s)},[t,r]);return{viewTranscript:n,fetchUserMessages:o,clearTranscript:i,selectSession:a}}var e4e=C(ee(),1);function qWr(e,t){let r=new Set(t.map(o=>o.id)),n=null;for(let o of Object.values(e))r.has(o)&&(n=o);return n}var KG=C(ee(),1);function jWr(){let[e,t]=(0,KG.useState)(null),r=(0,KG.useRef)(e);r.current=e;let n=(0,KG.useCallback)(()=>r.current,[]);return{activeId:e,setActiveId:t,getActiveId:n}}var KWr=C(ee(),1);function YWr(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 XWr(e,t,r){let n=HEe();(0,KWr.useEffect)(()=>{if(n){t(null);return}t(o=>YWr(e,o,r))},[e,t,r,n])}var ZEe=C(ee(),1);function ZWr(){let[e,t]=(0,ZEe.useState)({}),[r,n]=(0,ZEe.useState)(null),[o,i]=(0,ZEe.useState)(null);return{activeByRepo:e,setActiveByRepo:t,daemonVersion:r,setDaemonVersion:n,nodes:o,setNodes:i}}var Sv=C(ee(),1);function QWr(e,t){for(let r of t)clearTimeout(e.get(r)),e.delete(r)}function JWr(e,t){let r=new Set(t.map(n=>n.id));return[...e.keys()].filter(n=>!r.has(n))}function eGr(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 tGr(e,t){let r=[];for(let n of t){let o=e.get(n.id);o!==void 0&&o!==n.startedAt&&r.push(n.id)}return r}function rGr(e,t){return t.filter(r=>r.commandType==="run"&&e.get(r.id)!==r.startedAt).map(r=>r.id)}var NAo=1500;function nGr(){let[e,t]=(0,Sv.useState)(new Set),r=(0,Sv.useRef)(new Map),n=(0,Sv.useRef)(new Map),o=(0,Sv.useCallback)(s=>{t(l=>l.has(s)?l:new Set(l).add(s))},[]),i=(0,Sv.useCallback)(s=>{let l=n.current;for(let u of s)clearTimeout(l.get(u)),l.set(u,setTimeout(()=>{l.delete(u),o(u)},NAo))},[o]);(0,Sv.useEffect)(()=>{let s=n.current;return()=>{for(let l of s.values())clearTimeout(l)}},[]);let a=(0,Sv.useCallback)(s=>{let l=JWr(r.current,s),u=[...tGr(r.current,s),...l],d=rGr(r.current,s);r.current=new Map(s.map(f=>[f.id,f.startedAt])),QWr(n.current,l),u.length&&t(f=>eGr(f,u)),i(d)},[i]);return{initialized:e,markInitialized:o,syncSessions:a}}var t3=C(ee(),1);function oGr(){let[e,t]=(0,t3.useState)(null),[r,n]=(0,t3.useState)(null),[o,i]=(0,t3.useState)(null),a=(0,t3.useCallback)(()=>t(null),[]),s=(0,t3.useCallback)(()=>n(null),[]),l=(0,t3.useCallback)(()=>i(null),[]);return{error:e,setError:t,clearError:a,success:r,setSuccess:n,clearSuccess:s,serverConflict:o,setServerConflict:i,clearServerConflict:l}}var Bx=C(ee(),1);function iGr(e,t){return[...e,{...t,status:"launching"}]}function QEe(e){return e.find(t=>t.status==="launching")}function aGr(e){let t=QEe(e);return t?e.filter(r=>r.id!==t.id):e}function sGr(e,t){let r=QEe(e);return r?Xat(e,r.id,t):e}function Xat(e,t,r){return e.map(n=>n.id===t&&n.status==="launching"?{...n,status:"error",error:r}:n)}function lGr(e,t){return e.filter(r=>r.id!==t)}var cGr=C(ee(),1);var OAo=6e4,BAo="Launch timed out \u2014 the session did not start.";function uGr(e,t){(0,cGr.useEffect)(()=>{let r=e.filter(o=>o.status==="launching");if(r.length===0)return;let n=r.map(o=>setTimeout(()=>t(i=>Xat(i,o.id,BAo)),Math.max(0,OAo-(Date.now()-o.startedAt))));return()=>n.forEach(clearTimeout)},[e,t])}function dGr(){let[e,t]=(0,Bx.useState)([]),r=(0,Bx.useRef)([]),n=(0,Bx.useCallback)(l=>{r.current=l(r.current),t(r.current)},[]),o=(0,Bx.useCallback)(l=>{n(u=>iGr(u,{id:crypto.randomUUID(),startedAt:Date.now(),...l}))},[n]),i=(0,Bx.useCallback)(()=>{let l=QEe(r.current);return n(aGr),l?.named?l.title:void 0},[n]),a=(0,Bx.useCallback)(l=>n(u=>sGr(u,l)),[n]),s=(0,Bx.useCallback)(l=>n(u=>lGr(u,l)),[n]);return uGr(e,n),{pendingLaunches:e,addPendingLaunch:o,resolvePendingLaunch:i,failPendingLaunch:a,dismissPendingLaunch:s}}var qne=C(ee(),1);function fGr(){let[e,t]=(0,qne.useState)(null),[r,n]=(0,qne.useState)({}),o=(0,qne.useCallback)((i,a)=>{i!=="claude"&&n(s=>({...s,[i]:a}))},[]);return{rateLimits:e,setRateLimits:t,harnessRateLimits:r,setHarnessRateLimits:o}}var pGr=C(ee(),1);function hGr(e,t){return(0,pGr.useCallback)(r=>{e(r),t(r)},[e,t])}var Zat=C(ee(),1);function mGr(){let e=(0,Zat.useRef)(new Map),t=(0,Zat.useRef)(new Map);return{buffers:e,handlers:t}}var JEe=C(ee(),1);function gGr(){let[e,t]=(0,JEe.useState)(null),[r,n]=(0,JEe.useState)(null),[o,i]=(0,JEe.useState)(null);return{transcript:e,setTranscript:t,viewingTranscriptSessionId:r,setViewingTranscriptSessionId:n,userMessages:o,setUserMessages:i}}var r3=C(ee(),1);function yGr(e,t){let r=e.sessionId;t.buffers.current?.delete(r),t.handlers.current?.get(r)?.("\x1Bc")}function vGr(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 bGr(e,t){let r=e.message;t.setError(r),t.failPendingLaunch(r)}function xGr(e,t){let r=e.rateLimits,n=e.harness;!n||n==="claude"?t.setRateLimits(r):t.setHarnessRateLimits?.(n,r)}function SGr(e,t){t.setNodes({local:e.local,links:e.links??[]})}function TGr(e,t){t.setSuccess({message:e.message,sessionId:null})}function wGr(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 CGr(e,t){t.setServerConflict({existing:e.existing,runName:e.runName,cwd:e.cwd,sessionId:e.sessionId,launchedFrom:e.launchedFrom,node:e.node})}function kGr(e,t){let r=e.sessions;t.setSessions(r),e.cwd&&t.setCurrentCwd(e.cwd),t.setActiveByRepo(e.active??{})}function _Gr(e,t){let r=e.sessionId,n=e.data;t.buffers.current?.set(r,n),t.handlers.current?.get(r)?.(`\x1Bc${n}`)}var $Ao={sessions:kGr,created:vGr,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:SGr,error:bGr,notice:TGr,inbox:()=>{qs.refresh(),qs.refreshStatus()},"inbox-activity":()=>{qs.refreshStatus()},"run-conflict":CGr,limits:xGr,clear:yGr,output:wGr,snapshot:_Gr};function EGr(e,t){$Ao[e.type]?.(e,t)}function RGr(e,t={}){let r=new WebSocket(hxt("/ws"));return r.onopen=()=>{t.onOpen?.(),r.send(JSON.stringify({type:"hello"})),r.send(JSON.stringify({type:"history"}))},r.onmessage=n=>{EGr(JSON.parse(n.data),e)},r.onclose=()=>t.onClose?.(),r}function PGr(e,t,r,n){let o=!1,i,a=0,s=!1,l=()=>{o||t(RGr(e,{onOpen:()=>{s&&r(),s=!1,n(!1),a=0},onClose:()=>{if(o)return;s=!0,n(!0);let u=Math.min(300*2**a,2e3);a+=1,i=setTimeout(l,u)}}))};return l(),()=>{o=!0,i&&clearTimeout(i)}}function AGr(e){let t=(0,r3.useRef)(null),[r,n]=(0,r3.useState)(!1),{handleSessions:o,markInitialized:i,buffers:a,handlers:s}=e;(0,r3.useEffect)(()=>{let u=()=>{a.current?.clear();let f=s.current;if(f)for(let p of f.values())p("\x1Bc")},d=PGr({...e,setSessions:o},f=>{t.current=f},u,n);return()=>{d(),t.current?.close()}},[o,i,a,s]);let l=(0,r3.useCallback)(()=>{let u=t.current;u?.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"history"}))},[]);return{wsRef:t,requestHistory:l,reconnecting:r}}function LGr(){let[e,t]=(0,e4e.useState)([]),[r,n]=(0,e4e.useState)([]),{activeId:o,setActiveId:i,getActiveId:a}=jWr(),s=ZWr(),l=gGr(),[u,d]=(0,e4e.useState)(""),f=oGr(),p=dGr(),h=fGr(),{initialized:m,markInitialized:g,syncSessions:y}=nGr(),v=mGr(),b=hGr(y,t),{wsRef:x,requestHistory:T,reconnecting:w}=AGr({handleSessions:b,setHistory:n,getActiveId:a,setActiveId:i,...s,...l,setCurrentCwd:d,...f,...p,...h,markInitialized:g,...v});return XWr(e,i,qWr(s.activeByRepo,e)),{sessions:e,history:r,activeId:o,setActiveId:i,...s,...l,currentCwd:u,...f,...p,...h,initialized:m,wsRef:x,...v,requestHistory:T,reconnecting:w}}function t4e(){let e=LGr(),{wsRef:t,buffers:r,handlers:n,addPendingLaunch:o,activeId:i,sessions:a}=e,s=yWr(e.nodes),l=xWr(t,o),u=GWr(l,r,n);hWr(i,a,e.history,l),mWr(a,l);let d=VWr(l,e.setActiveId,e.setViewingTranscriptSessionId);return{...e,...u,...d,nodeSelection:s}}var XG=C(ee(),1);var IGr="assist:sidebar-collapsed";function MGr(){let[e,t]=(0,XG.useState)(()=>Vl(IGr).length>0),r=(0,XG.useCallback)(()=>{t(n=>{let o=!n;return iu(IGr,o?[!0]:[]),o})},[]);return(0,XG.useMemo)(()=>({collapsed:e,onToggleCollapsed:r}),[e,r])}var DGr=C(ee(),1);function NGr(){(0,DGr.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await Jt("/api/hotkeys");if(!t.ok)return;let r=await t.json();e||YR.set(r)}catch(t){Pr(t,"hotkey bindings")}})(),()=>{e=!0}},[])}function OGr(){let e=t4e(),t=R2e(e),r=lWr(e.currentCwd,e.history,t,e.sessions,e.nodeSelection);JHr({selectedCwd:r.selectedCwd,selectedCardId:t,sessions:e.sessions,history:e.history,activeByRepo:e.activeByRepo,onSelect:e.selectSession});let{launch:n,viewLaunchedSession:o}=fWr(e);NGr();let i=MGr();return ZHr("shell",{...e,selection:r,launch:n,sidebarCollapse:i}),{socket:e,selection:r,launch:n,viewLaunchedSession:o,sidebarCollapse:i}}var Mm=C(P(),1),FAo={zIndex:e=>e.zIndex.drawer+1},zAo={minHeight:48};function $Gr({mode:e,toggle:t}){let r=OGr(),{socket:n,selection:o,viewLaunchedSession:i}=r,{nodes:a,transferSession:s,cancelTransfer:l}=n,u=(0,BGr.useMemo)(()=>({nodes:a,transfer:s,cancel:l}),[a,s,l]);return(0,Mm.jsx)(rUr,{shell:r,children:(0,Mm.jsxs)(Nat.Provider,{value:n.daemonVersion,children:[(0,Mm.jsx)(VHr,{mode:e,toggle:t,sessions:n.sessions,reconnecting:n.reconnecting}),(0,Mm.jsx)(w3e,{position:"fixed",sx:FAo,"data-testid":"toolbar",children:(0,Mm.jsx)(UUr,{socket:n,selection:o})}),(0,Mm.jsx)(hR,{variant:"dense",sx:zAo}),(0,Mm.jsx)(eLe.Provider,{value:u,children:(0,Mm.jsx)(KHr,{socket:n,children:(0,Mm.jsx)(V$r,{socket:n})})}),(0,Mm.jsx)(OFr,{socket:n}),(0,Mm.jsx)(tUr,{socket:n,onViewLaunchedSession:i})]})})}function UGr(e){return e instanceof Error?e.message:String(e)}function UAo(e){return e.filename?` (${e.filename}:${e.lineno}:${e.colno})`:""}function FGr(e){SY(e.error)||(HR(e.error),TY("error",`${e.message||UGr(e.error)}${UAo(e)}`))}function zGr(e){SY(e.reason)||(HR(e.reason),TY("rejection",UGr(e.reason)))}function HGr(){return globalThis.addEventListener("error",FGr),globalThis.addEventListener("unhandledrejection",zGr),()=>{globalThis.removeEventListener("error",FGr),globalThis.removeEventListener("unhandledrejection",zGr)}}var WGr=C(ee(),1);function GGr(){let[e,t]=(0,WGr.useState)(()=>{try{return localStorage.getItem("theme-mode")??"dark"}catch{return"dark"}});return{mode:e,toggle:()=>t(n=>{let o=n==="dark"?"light":"dark";try{localStorage.setItem("theme-mode",o)}catch{}return o})}}function VGr({color:e,radius:t}){return{MuiMenu:{styleOverrides:{paper:{borderRadius:t.md},list:{padding:4}}},MuiMenuItem:{styleOverrides:{root:{minHeight:30,padding:"5px 10px",borderRadius:4,fontSize:13,"&:hover":{backgroundColor:e.raised},"& .MuiListItemIcon-root":{minWidth:28},"& .MuiSvgIcon-root":{fontSize:16},"& .MuiListItemText-primary":{fontSize:13}}}}}}function qGr(e){let{color:t,radius:r,elevation:n,type:o}=e,i={border:`1px solid ${t.line}`};return{...VGr(e),MuiTooltip:{styleOverrides:{tooltip:{...i,backgroundColor:t.overlay.background,color:t.overlay.text,borderRadius:r.md,boxShadow:n.overlay,fontSize:`${o.scale.caption/16}rem`,padding:"6px 10px"},arrow:{color:t.overlay.background}}},MuiPopover:{styleOverrides:{paper:{...i,boxShadow:n.overlay}}},MuiBackdrop:{styleOverrides:{root:{"&:not(.MuiBackdrop-invisible)":{backgroundColor:t.scrim,backdropFilter:"blur(2px)"}}}},MuiDialog:{styleOverrides:{paper:{...i,backgroundColor:t.surface,borderRadius:r.md+4,boxShadow:n.dialog}}}}}var jGr=({variant:e})=>e==="outlined"||e==="tonal",YGr=[{props:{size:"small"},style:{minHeight:26,padding:"4px 9px",fontSize:12}},{props:jGr,style:{padding:"5px 11px"}},{props:e=>jGr(e)&&e.size==="small",style:{padding:"3px 8px"}}];var r4e=["primary","secondary","success","warning","error","info","check"];function jne(e,t){return{backgroundColor:Vr(e,t),borderColor:Vr(e,.35),color:e}}function KGr({color:e}){return[{props:{variant:"tonal"},style:{backgroundColor:e.raised,border:`1px solid ${e.line}`,color:e.text.primary,"&:hover":{backgroundColor:e.raised,borderColor:e.text.disabled}}},...r4e.filter(t=>t!=="primary").map(t=>({props:{variant:"tonal",color:t},style:{...jne(e[t].main,.16),"&:hover":jne(e[t].main,.24)}}))]}var XGr={"& > *:nth-of-type(1)":{fontSize:16}};function ZGr(e){let{color:t,radius:r,density:n}=e,{minHeight:o,fontSize:i,paddingX:a}=n.button;return{MuiButton:{defaultProps:{disableElevation:!0},styleOverrides:{root:{minHeight:o,padding:`6px ${a}px`,borderRadius:r.sm,fontSize:i,fontWeight:600,lineHeight:"18px"},startIcon:{marginLeft:-2,marginRight:6,...XGr},endIcon:{marginLeft:6,marginRight:-2,...XGr}},variants:[...YGr,{props:{variant:"text",color:"primary"},style:{color:t.text.secondary,"&:hover":{backgroundColor:t.raised,color:t.text.primary}}},...KGr(e),{props:{variant:"outlined",color:"error"},style:{borderColor:Vr(t.error.main,.35),"&:hover":{borderColor:t.error.main,backgroundColor:Vr(t.error.main,.1)}}}]}}}function Qat({color:e},t){return[{props:{variant:t,color:"default"},style:{backgroundColor:"transparent",border:`1px solid ${e.line}`,color:e.text.secondary,"&.MuiChip-clickable:hover":{backgroundColor:e.raised}}},...r4e.map(r=>({props:{variant:t,color:r},style:{...jne(e[r].main,.14),borderColor:"transparent","& .MuiChip-deleteIcon":{color:Vr(e[r].main,.7),"&:hover, &:active":{color:e[r].main}},"&.MuiChip-clickable:hover":{backgroundColor:Vr(e[r].main,.22)}}}))]}function QGr(e){return{MuiChip:{styleOverrides:{root:{height:20,fontSize:11,fontWeight:600,borderRadius:999},sizeSmall:{height:20,"& .MuiChip-label":{padding:"0 7px"}},label:{padding:"0 8px"},icon:{fontSize:14,marginLeft:6,marginRight:-2},deleteIcon:{fontSize:14,marginLeft:-2,marginRight:4},outlined:{borderColor:e.color.line}},variants:[...Qat(e,"tonal"),...Qat(e,"filled")]}}}function JGr(e){return{...ZGr(e),MuiButtonGroup:{defaultProps:{disableElevation:!0},variants:[{props:{variant:"tonal"},style:{"& .MuiButtonGroup-middleButton, & .MuiButtonGroup-lastButton":{marginLeft:-1}}}]},...QGr(e)}}var Jat=e=>`color-mix(in srgb, currentColor ${e}%, transparent)`,HAo={".MuiAppBar-root &":{color:"inherit","&:hover":{backgroundColor:Jat(8)},"&.Mui-selected":{color:"inherit",backgroundColor:Jat(12),boxShadow:`inset 0 0 0 1px ${Jat(18)}`}}};function eVr({color:e,radius:t}){return{MuiTabs:{styleOverrides:{root:{minHeight:40,alignItems:"center"},list:{gap:2},indicator:{display:"none"}}},MuiTab:{styleOverrides:{root:{minHeight:30,padding:"6px 10px",borderRadius:t.sm,textTransform:"none",fontSize:13,fontWeight:500,opacity:1,color:e.text.secondary,"&:hover":{backgroundColor:e.raised,color:e.text.primary},"&.Mui-selected":{color:e.text.primary,backgroundColor:e.raised,boxShadow:`inset 0 0 0 1px ${e.line}`},...!e.appBar&&HAo}}}}}var tVr=(e,t)=>({width:e,height:e,"& .MuiSvgIcon-root":{fontSize:t}});function rVr({color:e,radius:t,density:r}){let{side:n,icon:o,smallSide:i,smallIcon:a}=r.iconButton;return{MuiIconButton:{styleOverrides:{root:{...tVr(n,o),padding:0,borderRadius:t.sm,"&:hover":{backgroundColor:e.raised}}},variants:[{props:{size:"small"},style:tVr(i,a)},{props:{color:"default"},style:{color:e.text.secondary,"&:hover":{color:e.text.primary},...!e.appBar&&{".MuiAppBar-root &, .MuiAppBar-root &:hover":{color:"inherit"}}}}]}}}function nVr({color:e,radius:t}){return{MuiToggleButtonGroup:{styleOverrides:{root:{padding:2,gap:2,border:`1px solid ${e.line}`,borderRadius:t.sm,backgroundColor:e.background},grouped:{margin:0,border:0,borderRadius:4}}},MuiToggleButton:{styleOverrides:{root:{padding:"3px 8px",border:0,borderRadius:4,fontSize:13,fontWeight:500,lineHeight:"18px",textTransform:"none",color:e.text.secondary,"& .MuiSvgIcon-root":{fontSize:16},"&:hover":{backgroundColor:"transparent",color:e.text.primary},"&.Mui-selected, &.Mui-selected:hover":{backgroundColor:e.raised,color:e.text.primary}}}}}}var n4e=".MuiOutlinedInput-notchedOutline";function oVr({color:e,radius:t,density:r}){let n=r.inputFontSize;return{MuiOutlinedInput:{styleOverrides:{root:{backgroundColor:e.background,borderRadius:t.sm,fontSize:n,color:e.text.primary,[`& ${n4e}`]:{borderColor:e.line},[`&:hover ${n4e}`]:{borderColor:e.text.disabled},[`&.Mui-focused ${n4e}`]:{borderColor:e.primary.main,borderWidth:1},[`&.Mui-error ${n4e}`]:{borderColor:e.error.main}}}},MuiInputLabel:{styleOverrides:{root:{fontSize:n,color:e.text.secondary,"&.Mui-focused":{color:e.primary.main}}}},MuiSelect:{styleOverrides:{icon:{color:e.text.disabled}}}}}function iVr({color:e,density:t}){let{width:r,height:n,thumb:o}=t.switch;return{MuiSwitch:{styleOverrides:{root:{width:r,height:n,padding:0,"& .MuiSwitch-switchBase":{padding:2,color:e.text.secondary,"&.Mui-checked":{transform:`translateX(${r-n}px)`,color:e.primary.contrastText},"&.Mui-checked + .MuiSwitch-track":{backgroundColor:e.primary.main,opacity:1}},"& .MuiSwitch-thumb":{width:o,height:o,boxShadow:"none"},"& .MuiSwitch-track":{borderRadius:n/2,backgroundColor:e.line,opacity:1}}}},MuiFormControlLabel:{styleOverrides:{root:{"&:has(.MuiSwitch-root)":{marginLeft:0,gap:8}}}}}}function aVr(e){let{appBar:t}=e.color;return{...qGr(e),...JGr(e),...rVr(e),...nVr(e),...oVr(e),...iVr(e),...eVr(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 Tv="#0e1116",est="#141820",o4e="#1b202a",i4e="#e3e7ee",tst="#8a93a3",Yne="#8b9cff",a4e="#5fd0a0",s4e="#f2b45a",l4e="#f27a7a",sVr="#6cc8d8",lVr={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)"},c4e={dark:{color:{background:Tv,surface:est,raised:o4e,line:"#262c37",lineSoft:"#1d222b",text:{primary:i4e,secondary:tst,disabled:"#5c6473"},selected:"rgba(139, 156, 255, 0.14)",wash:{warning:"rgba(242, 180, 90, 0.09)",error:"rgba(242, 122, 122, 0.09)",accent:"rgba(139, 156, 255, 0.1)",check:"rgba(108, 200, 216, 0.09)"},well:Tv,stripe:o4e,codeWash:"rgba(255, 255, 255, 0.08)",overlay:{background:o4e,text:i4e},scrim:"rgba(0, 0, 0, 0.5)",appBar:{background:est,text:i4e},onAppBar:{...lVr,secondary:tst,level:{ok:a4e,warn:s4e,over:l4e}},statusBar:{background:est,text:tst,hoverText:i4e,secondary:"#5c6473",hover:o4e,active:"transparent",dot:Yne,dotRing:"rgba(139, 156, 255, 0.14)",readyText:Yne,level:{ok:a4e,warn:s4e,over:l4e}},primary:{main:Yne,contrastText:Tv},secondary:{main:"#c99bff",contrastText:Tv},success:{main:a4e,contrastText:Tv},warning:{main:s4e,contrastText:Tv},error:{main:l4e,contrastText:Tv},info:{main:"#6cb6ff",contrastText:Tv},check:{main:sVr,contrastText:Tv}},terminal:{background:Tv,foreground:"#d6dbe4",cursor:Yne,cursorAccent:Tv,selectionBackground:"rgba(139, 156, 255, 0.28)",black:"#1b2029",red:l4e,green:a4e,yellow:s4e,blue:Yne,magenta:"#c99bff",cyan:sVr,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)",stuckHeader:"0 8px 8px -9px rgba(0, 0, 0, 0.8)"}},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:{warning:"rgba(255, 167, 38, 0.09)",error:"rgba(244, 67, 54, 0.09)",accent:"rgba(25, 118, 210, 0.08)",check:"rgba(0, 131, 143, 0.08)"},well:"#f3f4f6",stripe:"rgba(0, 0, 0, 0.1)",codeWash:"rgba(0, 0, 0, 0.06)",overlay:{background:"rgba(97, 97, 97, 0.92)",text:"#fff"},onAppBar:{...lVr,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"},check:{main:"#00838f",light:"#4fb3bf",dark:"#005662",contrastText:"#fff"},scrim:"rgba(15, 23, 42, 0.32)",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"}}},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:0,overlay:"0 8px 24px rgba(15, 23, 42, 0.12)",dialog:"0 24px 48px rgba(15, 23, 42, 0.18)",stuckHeader:"0 6px 6px -7px rgba(0, 0, 0, 0.2)"}},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},selection:{ringWidth:2,titleWeight:500},spacing:8,densities:{desktop:{target:30,bar:40,iconButton:{side:30,icon:18,smallSide:26,smallIcon:16},button:{minHeight:30,fontSize:13,paddingX:12},switch:{width:34,height:20,thumb:16},inputFontSize:13,filterSelectMinWidth:160,tabBar:{height:44,icon:20,label:10,badge:16,insetTrim:0}},touch:{target:48,bar:60,iconButton:{side:48,icon:30,smallSide:40,smallIcon:24},button:{minHeight:48,fontSize:17,paddingX:20},switch:{width:51,height:31,thumb:27},inputFontSize:16,filterSelectMinWidth:200,tabBar:{height:49,icon:26,label:11,badge:18,insetTrim:12}}}};var Yw=e=>`${e/16}rem`;function cVr({font:e,type:t}){let{scale:r}=t;return{fontFamily:e.ui,fontFamilyMono:e.mono,fontSize:t.fontSize,button:{...t.button,fontSize:Yw(r.button)},caption:{fontSize:Yw(r.caption)},body2:{fontSize:Yw(r.body2)},body1:{fontSize:Yw(r.body1)},subtitle2:{fontSize:Yw(r.subtitle2)},subtitle1:{fontSize:Yw(r.subtitle1)},h6:{fontSize:Yw(r.h6)},h5:{fontSize:Yw(r.h5)},h4:{fontSize:Yw(r.h4)}}}function uVr(e){return{MuiButtonBase:{styleOverrides:{root:{cursor:"pointer","&.Mui-disabled":{cursor:"default"}}}},MuiLink:{styleOverrides:{root:{cursor:"pointer"}}},MuiAppBar:{defaultProps:{elevation:e.elevation.appBar}}}}function WAo(e,t){let{dark:r,light:n,densities:o,...i}=c4e;return{...i,...e==="dark"?r:n,mode:e,density:o[t]}}function dVr(e,t="desktop"){let r=WAo(e,t),{color:n}=r;return Fv({tokens:r,palette:{mode:e,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,check:n.check,text:n.text,divider:n.line,action:{hover:n.raised,selected:n.selected}},typography:cVr(r),shape:{borderRadius:r.radius.sm},spacing:r.spacing,components:{...uVr(r),...aVr(r)}})}function fVr(){if(typeof document>"u"||!document.fonts)return Promise.resolve();let{font:e,type:t}=c4e;return Promise.allSettled([document.fonts.load(`${t.fontSize}px ${e.ui}`),document.fonts.load(`${t.terminalFontSize}px ${e.terminal}`)])}var Pqr=C(ee(),1);var n3=C(P(),1);function pVr({status:e,onClose:t}){return(0,n3.jsxs)(n3.Fragment,{children:[(0,n3.jsx)(Nu,{open:e.kind==="probing",children:(0,n3.jsx)(no,{severity:"info",variant:"filled",children:e.kind==="probing"?`Connecting to ${e.name}\u2026`:""})}),(0,n3.jsx)(kl,{error:e.kind==="error"?e.message:null,onClose:t})]})}var d4e=C(ee(),1);var GAo=/^\d+(\.\d+){3}$/;function lM(e){try{let{hostname:t}=new URL(e);return GAo.test(t)?t:t.split(".")[0]}catch{return""}}var VAo=/^[a-z]+:[/]{2}/i;function u4e(e){let t=e.trim(),r=VAo.test(t)?t:`https://${t}`;try{let n=new URL(r);return n.protocol!=="https:"&&n.protocol!=="http:"?void 0:n.origin}catch{return}}function qAo(e){try{return new URL(e)}catch{return}}function jAo(e){return e.protocol==="assist:"&&e.hostname==="add-node"&&(e.pathname===""||e.pathname==="/")}function hVr(e){let t=qAo(e);if(!t||!jAo(t))return{ok:!1,error:`Not an assist add-node link: ${e}`};let r=t.searchParams.get("url"),n=r?u4e(r):void 0;return n?{ok:!0,node:{name:t.searchParams.get("name")?.trim()||lM(n),url:n}}:{ok:!1,error:`The link has no valid node URL: ${r??"(missing)"}`}}var mVr=5e3,gVr="/api/health";async function YAo(e){let t=new AbortController,r=setTimeout(()=>t.abort(),mVr);try{let n=await fetch(`${e}${gVr}`,{signal:t.signal,cache:"no-store"});return n.ok?{ok:!0,health:await n.json()}:{ok:!1,error:`HTTP ${n.status}`,status:n.status}}catch(n){return t.signal.aborted?{ok:!1,error:`timed out after ${mVr/1e3}s`}:{ok:!1,error:n instanceof Error?n.message:String(n)}}finally{clearTimeout(r)}}async function o3(e){let t=Date.now(),r=await YAo(e);return r.ok||c8({at:new Date(t).toISOString(),method:"GET",path:gVr,base:e,status:r.status,error:r.status===void 0?r.error:void 0,durationMs:Date.now()-t}),r}async function yVr(e,t){let r=hVr(e);if(!r.ok)return r;let{node:n}=r;t(n);let o=await o3(n.url);return o.ok?{ok:!0,node:n,health:o.health}:{ok:!1,error:`Can't reach ${n.name} at ${n.url}: ${o.error}`}}cM();var ast=Xw("App",{web:()=>Promise.resolve().then(()=>(wVr(),TVr)).then(e=>new e.AppWeb)});var QG=C(ee(),1);var r6o=5e3;function CVr(e){let t=(0,QG.useRef)(e),r=(0,QG.useRef)(void 0);(0,QG.useEffect)(()=>{t.current=e},[e]),(0,QG.useEffect)(()=>{let n=i=>{let a=Date.now(),s=r.current?.url===i&&a-r.current.at<r6o;r.current={url:i,at:a},s||t.current(i)},o=ast.addListener("appUrlOpen",({url:i})=>n(i));return ast.getLaunchUrl().then(i=>{i?.url&&n(i.url)}).catch(i=>Pr(i,"launch url")),()=>{o.then(i=>i.remove())}},[])}function kVr(e){let[t,r]=(0,d4e.useState)({kind:"idle"});CVr(async o=>{let i=await yVr(o,a=>r({kind:"probing",name:a.name}));if(!i.ok){r({kind:"error",message:i.error});return}e(i.node,i.health),r({kind:"idle"})});let n=(0,d4e.useCallback)(()=>r({kind:"idle"}),[]);return{status:t,dismiss:n}}var Zne=C(P(),1);function _Vr({name:e}){return(0,Zne.jsxs)(G,{sx:{height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,bgcolor:"background.default"},children:[(0,Zne.jsx)(Ao,{size:28}),(0,Zne.jsxs)(Ce,{variant:"body2",color:"text.secondary",children:["Connecting to ",e??"home node","\u2026"]})]})}var f4e=C(ee(),1),sst=(0,f4e.createContext)(null);function i3(){return(0,f4e.useContext)(sst)}var ya={top:"env(safe-area-inset-top, 0px)",bottom:"env(safe-area-inset-bottom, 0px)"};var RVr=C(P(),1);function EVr({value:e,error:t,onChange:r}){return(0,RVr.jsx)($n,{autoFocus:!0,label:"Web server URL",placeholder:"https://mac.tail1234.ts.net:3100",value:e,onChange:n=>r(n.target.value),error:!!t,helperText:t??"The address where you open the sessions page in a browser.",slotProps:{htmlInput:{autoCapitalize:"none",autoCorrect:"off",inputMode:"url"}}})}var Qne=C(ee(),1);function PVr(e,t){let[r,n]=(0,Qne.useState)(e?.url??""),[o,i]=(0,Qne.useState)(e?.name),[a,s]=(0,Qne.useState)(),[l,u]=(0,Qne.useState)(!1),d=u4e(r),f=o??(d?lM(d):"");return{url:r,changeUrl:m=>{n(m),s(void 0)},name:f,setName:i,error:a,busy:l,submit:async m=>{if(m.preventDefault(),!d){s("Enter an http(s) URL, e.g. https://mac.tail1234.ts.net:3100");return}u(!0);let g=await t({name:f.trim()||lM(d),url:d});u(!1),s(g)}}}var JG=C(P(),1);function p4e({initial:e,submitLabel:t,onSubmit:r,children:n}){let o=PVr(e,r);return(0,JG.jsxs)(kt,{component:"form",spacing:2,onSubmit:o.submit,children:[(0,JG.jsx)(EVr,{value:o.url,error:o.error,onChange:o.changeUrl}),(0,JG.jsx)($n,{label:"Name",value:o.name,onChange:i=>o.setName(i.target.value),helperText:"Filled in from the host name. Shown on the node chip.",slotProps:{htmlInput:{autoCapitalize:"none",autoCorrect:"off"}}}),(0,JG.jsx)(ht,{type:"submit",variant:"contained",size:"large",disabled:!o.url.trim()||o.busy,children:o.busy?"Checking\u2026":t}),n]})}var Zw=C(P(),1),n6o={height:"100%",boxSizing:"border-box",overflowY:"auto",display:"flex",justifyContent:"center",pt:`calc(${ya.top} + 28px)`,pb:`calc(${ya.bottom} + 24px)`,px:2.5,bgcolor:"background.default"},o6o={width:56,height:56,borderRadius:"14px",bgcolor:"action.hover",border:1,borderColor:"divider",display:"grid",placeItems:"center",fontFamily:"fontFamilyMono",fontSize:22,fontWeight:600,color:"primary.main"};function AVr({onConnect:e}){return(0,Zw.jsx)(G,{sx:n6o,children:(0,Zw.jsxs)(kt,{spacing:2.5,sx:{width:"100%",maxWidth:420},children:[(0,Zw.jsx)(G,{sx:o6o,children:">_"}),(0,Zw.jsx)(Ce,{variant:"h5",sx:{fontWeight:700},children:"Connect to a home node"}),(0,Zw.jsxs)(Ce,{variant:"body2",color:"text.secondary",children:["The phone connects to one assist web server over Tailscale. You'll see its sessions and the sessions of every node it links to. Make sure Tailscale is connected on this phone and"," ",(0,Zw.jsx)("code",{children:"assist sessions web"})," is running on that machine."]}),(0,Zw.jsx)(p4e,{submitLabel:"Connect",onSubmit:async r=>{let n=await o3(r.url);if(!n.ok)return`Can't reach ${r.url}: ${n.error}`;e(r,n.health)}})]})})}var mqr=C(ee(),1);var wv=C(P(),1),i6o={flex:"none",pt:ya.top,bgcolor:"background.default"},a6o={height:e=>e.tokens.density.bar,display:"grid",gridTemplateColumns:"minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr)",columnGap:1,alignItems:"center",px:1.5},s6o={height:e=>e.tokens.density.bar,display:"flex",alignItems:"center",gap:.5,px:.5},l6o={textAlign:"center",minWidth:0,maxWidth:220,fontSize:15,fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},c6o={flex:1,minWidth:0,fontSize:15,fontWeight:600,lineHeight:1.25,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",overflowWrap:"anywhere"};function yu({left:e,title:t,right:r,leadingTitle:n}){return(0,wv.jsx)(G,{component:"header",sx:i6o,children:n?(0,wv.jsxs)(G,{sx:s6o,children:[(0,wv.jsx)(G,{sx:{flex:"none"},children:e}),(0,wv.jsx)(G,{component:"h1",sx:[c6o,{m:0}],children:t}),(0,wv.jsx)(G,{sx:{flex:"none",display:"flex"},children:r})]}):(0,wv.jsxs)(G,{sx:a6o,children:[(0,wv.jsx)(G,{sx:{justifySelf:"start",minWidth:0},children:e}),(0,wv.jsx)(G,{sx:l6o,children:t}),(0,wv.jsx)(G,{sx:{justifySelf:"end",display:"flex",gap:.25},children:r})]})})}var $x=e=>e.tokens.color.raised;var LVr=C(P(),1),u6o={ok:e=>e.palette.success.main,warn:e=>e.palette.warning.main,error:e=>e.palette.error.main,off:e=>e.palette.text.disabled};function L0({tone:e}){return(0,LVr.jsx)(G,{component:"span",sx:{width:8,height:8,flex:"none",borderRadius:"50%",bgcolor:u6o[e]}})}var ks=e=>e.tokens.density.target;var eV=C(P(),1),d6o={display:"inline-flex",alignItems:"center",gap:.75,height:ks,pl:1.125,pr:.75,borderRadius:"24px",border:1,borderColor:"divider",bgcolor:$x,color:"text.primary",fontFamily:"fontFamilyMono",fontSize:13,maxWidth:140,justifyContent:"flex-start"},f6o={minWidth:0,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"};function h4e({name:e,tone:t,onClick:r}){return(0,eV.jsxs)(nr,{sx:d6o,onClick:r,disabled:!r,"aria-label":"Nodes","data-testid":"phone-node-chip",children:[(0,eV.jsx)(L0,{tone:t}),(0,eV.jsx)(G,{component:"span",sx:f6o,children:e??"\u2026"}),r&&(0,eV.jsx)(ba,{sx:{fontSize:16,flex:"none"}})]})}var cqr=C(ee(),1);var m4e=C(P(),1);function IVr({homeNode:e,node:t,onDone:r}){let n=!!t&&t.url===e.home?.url;return(0,m4e.jsx)(G,{sx:{px:2.5,pt:1},children:(0,m4e.jsx)(p4e,{initial:t,submitLabel:t?"Save":"Add node",onSubmit:async i=>{if(e.nodes.some(s=>s.url===i.url&&s.url!==t?.url))return"That URL is already saved";e.saveNode(t?.url??i.url,i),r()},children:t&&(0,m4e.jsx)(ht,{color:"error",size:"large",disabled:n,onClick:()=>{e.removeNode(t.url),r()},children:n?"Switch home node to delete this one":"Delete node"})})})}var MVr=C(P(),1),p6o={width:36,height:5,borderRadius:"3px",bgcolor:"text.disabled",opacity:.5,mx:"auto",mb:.75};function tV(){return(0,MVr.jsx)(G,{sx:p6o})}var Qw=C(P(),1),h6o={display:"flex",justifyContent:"space-between",alignItems:"center",gap:1,px:2,pt:.75,pb:1.25},m6o={color:"primary.main",fontSize:16,minHeight:ks,px:.5,borderRadius:1};function rV({title:e,actionLabel:t,onAction:r}){return(0,Qw.jsxs)(Qw.Fragment,{children:[(0,Qw.jsx)(tV,{}),(0,Qw.jsxs)(G,{sx:h6o,children:[(0,Qw.jsx)(G,{component:"b",sx:{fontSize:17,fontWeight:600},children:e}),(0,Qw.jsx)(nr,{sx:m6o,onClick:r,children:t})]})]})}var uM=C(P(),1);function DVr({homeNode:e,node:t,onDone:r}){return(0,uM.jsxs)(uM.Fragment,{children:[(0,uM.jsx)(rV,{title:t?"Edit node":"Add node",actionLabel:"Cancel",onAction:r}),(0,uM.jsx)(IVr,{homeNode:e,node:t,onDone:r},t?.url??"add")]})}var Or={group:{flexShrink:0,mx:2,my:.75,borderRadius:"12px",bgcolor:"background.default",border:1,borderColor:"divider",overflow:"hidden","& > *:not(:last-child)":{borderBottom:1,borderColor:e=>e.tokens.color.lineSoft}},item:{width:"100%",minHeight:ks,display:"flex",alignItems:"center",justifyContent:"flex-start",gap:1.5,px:1.75,py:1,textAlign:"left",fontSize:16},grow:{flex:1,minWidth:0},detail:{display:"block",fontSize:13,color:"text.secondary",fontFamily:"fontFamilyMono",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},end:{display:"flex",alignItems:"center",gap:.75,color:"text.secondary",fontSize:14},label:{px:4,pt:1.75,pb:.25,fontSize:13,fontWeight:600,textTransform:"uppercase",letterSpacing:".04em",color:"text.secondary"}};function NVr(e,t){return e.replace(/\/+$/,"")===t.replace(/\/+$/,"")}function nV(e,t){let r=e.split(".").map(Number),n=t.split(".").map(Number);for(let o=0;o<Math.max(r.length,n.length);o++){let i=(r[o]||0)-(n[o]||0);if(i!==0)return Math.sign(i)}return 0}function OVr(e,t,r){let n=t.filter(a=>a.node===e.name).length,o=[e.state,`${n} session${n===1?"":"s"}`,e.peerVersion&&`v${e.peerVersion}`,e.state!=="connected"&&e.error],i=e.peerVersion&&r?nV(e.peerVersion,r):0;return{text:o.filter(Boolean).join(" \xB7 "),drift:i<0?"behind":i>0?"ahead":void 0}}var g4e={connected:"ok",connecting:"warn",disconnected:"error","version-blocked":"error"};var lst=C(P(),1);function BVr({name:e,onSave:t}){return(0,lst.jsx)(jt,{"aria-label":`Save ${e} as a home node`,onClick:t,sx:{color:"primary.main",borderRadius:0},children:(0,lst.jsx)(mp,{fontSize:"small"})})}var Jw=C(P(),1),g6o={fontFamily:"fontFamilyMono",fontSize:12,px:.75,border:1,borderColor:"currentColor",borderRadius:"4px",color:"warning.main"};function $Vr({links:e,sessions:t,homeVersion:r,isSaved:n,onSave:o}){return(0,Jw.jsx)(G,{sx:Or.group,children:e.map(i=>{let{text:a,drift:s}=OVr(i,t,r);return(0,Jw.jsxs)(G,{sx:[Or.item,{pr:0}],children:[(0,Jw.jsx)(L0,{tone:g4e[i.state]}),(0,Jw.jsxs)(G,{component:"span",sx:Or.grow,children:[i.name,(0,Jw.jsx)(G,{component:"span",sx:Or.detail,children:a})]}),s&&(0,Jw.jsx)(G,{component:"span",sx:g6o,children:s}),!n(i.url)&&(0,Jw.jsx)(BVr,{name:i.name,onSave:()=>o(i)})]},i.name)})})}var Fx=C(P(),1);function oV({title:e,rows:t}){return(0,Fx.jsxs)(Fx.Fragment,{children:[(0,Fx.jsx)(G,{sx:Or.label,children:e}),(0,Fx.jsx)(G,{sx:Or.group,children:t.map(r=>(0,Fx.jsxs)(G,{sx:Or.item,children:[(0,Fx.jsx)(G,{component:"span",sx:Or.grow,children:r.label}),(0,Fx.jsx)(G,{component:"span",sx:[Or.end,{fontFamily:"fontFamilyMono"},r.color?{color:r.color}:{}],children:r.value})]},r.key))})]})}var zVr=C(P(),1);function FVr({rateLimits:e,harnessRateLimits:t}){let r=k0(3e4),n=sEe(e,t).flatMap(o=>dEe(o.rateLimits).map(i=>({key:`${o.harness}-${i.label}`,label:`${$c(o.harness)} \xB7 ${i.label}`,value:i.resetsAt!=null?`${Math.round(i.pct)}% \xB7 ${hG(i.resetsAt,r)}`:`${Math.round(i.pct)}%`,color:b_e(xx(i.pct,i.resetsAt,i.windowSeconds,r))})));return n.length===0?null:(0,zVr.jsx)(oV,{title:"Rate limits",rows:n})}var zx=C(P(),1);function UVr({status:e,homeVersion:t,homeNode:r}){let n=e.nodes?.links??[];return(0,zx.jsxs)(zx.Fragment,{children:[n.length>0&&(0,zx.jsxs)(zx.Fragment,{children:[(0,zx.jsxs)(G,{sx:Or.label,children:["Linked through ",e.nodes?.local]}),(0,zx.jsx)($Vr,{links:n,sessions:e.sessions,homeVersion:t,isSaved:o=>r.nodes.some(i=>NVr(i.url,o)),onSave:({name:o,url:i})=>r.saveNode("",{name:o,url:i})})]}),(0,zx.jsx)(FVr,{rateLimits:e.rateLimits,harnessRateLimits:e.harnessRateLimits})]})}var y6o={ok:"ok",ready:"warn",diverged:"warn",retrying:"warn",paused:"off",off:"off",loading:"off",unavailable:"error"};function y4e(e,t){let r=T0(e),{status:n}=e,o=!!n&&!!t&&nV(t,n.built)>0,i=E5(e),a=n&&(n.running===n.built?`v${n.running}`:`v${n.running} \u2192 v${n.built}`),s=o?`v${t} available`:i?"restart pending":r.label.toLowerCase();return{tone:o?"warn":y6o[r.kind],detail:[a,s].filter(Boolean).join(" \xB7 "),updateAvailable:o,restartPending:i}}var Dm=C(P(),1);function HVr({updates:e,onOpen:t}){let{entries:r,latest:n,notices:o}=e;return r.length===0?null:(0,Dm.jsxs)(Dm.Fragment,{children:[(0,Dm.jsx)(G,{sx:Or.label,children:"Updates"}),(0,Dm.jsx)(G,{sx:Or.group,children:r.map(i=>{let a=y4e(i,n),s=o.busy[i.name];return(0,Dm.jsxs)(nr,{sx:Or.item,onClick:()=>t(i.name),"data-testid":`phone-update-row-${i.name}`,children:[(0,Dm.jsx)(L0,{tone:a.tone}),(0,Dm.jsxs)(G,{component:"span",sx:Or.grow,children:[i.name,(0,Dm.jsx)(G,{component:"span",sx:Or.detail,children:a.detail})]}),(0,Dm.jsxs)(G,{component:"span",sx:Or.end,children:[s&&`${s}\u2026`,(0,Dm.jsx)(Wo,{})]})]},i.name)})})]})}var Jne=C(P(),1);function v4e({onAdd:e}){return(0,Jne.jsxs)(nr,{sx:Or.item,onClick:e,children:[(0,Jne.jsx)(mp,{sx:{color:"primary.main"}}),(0,Jne.jsx)(G,{component:"span",sx:{color:"primary.main"},children:"Add node URL"})]})}function Ux(e){try{return new URL(e).host}catch{return e}}function b4e(e){if(!e)return{tone:"off",text:"checking\u2026"};if(!e.ok)return{tone:"error",text:"unreachable"};let t=e.health.version;return{tone:"ok",text:t?`reachable \xB7 v${t}`:"reachable"}}var x4e=C(ee(),1);var v6o=15e3;function S4e(e){let[t,r]=(0,x4e.useState)({}),n=e.join(`
4064
4064
  `);return(0,x4e.useEffect)(()=>{if(!n)return;let o=!1,i=()=>{for(let s of n.split(`