bb-app 0.0.3 → 0.0.4

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.
@@ -1,6 +1,6 @@
1
- import{Br as e,Bt as t,Gn as n,Gr as r,Gt as i,Hi as a,Hr as o,Ht as s,I as c,In as l,Jn as u,Ki as d,Kn as f,Lr as p,M as m,P as h,Pt as g,R as _,Rr as v,Tr as y,Tt as b,Un as x,Ur as S,Ut as C,Vi as w,Vn as T,Vr as E,Vt as D,Wn as O,Wt as k,Yn as A,Yr as j,_i as M,ai as N,bn as P,bt as F,ii as I,j as ee,kn as te,kt as ne,mn as re,n as ie,ni as L,ri as R,t as z,tn as ae,vi as oe,vr as se,wr as ce,wt as le,xn as ue,yn as de,z as fe}from"./page-shell-Dglk9LmR.js";import{Nt as pe,Pt as me,c as he,d as ge,ht as _e,i as B,l as ve,o as ye,p as V,t as be,xt as H}from"./effective-hosts-BWRuszG7.js";import{C as xe,S as Se,_ as Ce,a as we,b as Te,c as Ee,d as De,f as Oe,g as ke,h as Ae,i as je,l as Me,m as Ne,o as Pe,p as Fe,r as Ie,s as Le,t as Re,u as ze,w as Be}from"./thread-queries-BOTfj5Vv.js";import{c as Ve,d as He,f as Ue,i as We,l as Ge,m as Ke,r as qe,t as Je}from"./pill-BHnTA2D7.js";import{a as Ye,g as Xe,h as Ze,i as U,o as W,r as Qe,s as $e,t as et,u as tt,v as G,y as nt}from"./dialog-CxN4lDeD.js";import{A as rt,O as it,S as at,_ as ot,a as st,b as ct,g as lt,h as ut,k as dt,m as ft,p as pt,t as mt,v as ht,y as gt}from"./localhost-badge-BBCmn0GW.js";import{f as _t,v as vt,y as yt}from"./mutation-cache-effects-BQHFwGL7.js";import{$ as bt,$t as xt,A as St,At as Ct,B as wt,Ct as Tt,D as Et,Dt,E as Ot,Et as kt,F as At,Ft as jt,G as Mt,Gt as Nt,H as Pt,Ht as Ft,I as It,It as Lt,J as Rt,Jt as zt,K as Bt,Kt as Vt,L as Ht,Lt as Ut,M as Wt,Mt as Gt,N as Kt,O as qt,Ot as Jt,P as Yt,Pt as Xt,Q as Zt,Qt,R as $t,S as en,St as tn,T as nn,Tt as rn,U as an,Ut as on,V as sn,Vt as cn,W as ln,Wt as un,X as dn,Y as fn,Yt as pn,Z as mn,Zt as hn,_ as gn,_t as _n,a as vn,an as yn,at as bn,b as xn,bt as Sn,c as Cn,ct as wn,d as Tn,dt as En,et as Dn,f as On,ft as kn,g as An,gt as jn,h as Mn,ht as Nn,i as Pn,it as Fn,j as In,jt as Ln,k as Rn,kt as zn,l as Bn,ln as Vn,lt as Hn,m as Un,mt as Wn,n as Gn,nt as Kn,o as qn,on as Jn,ot as Yn,p as Xn,pt as Zn,q as Qn,qt as $n,r as er,rt as tr,s as nr,st as rr,t as ir,tt as ar,u as or,un as sr,ut as cr,v as lr,vt as ur,w as dr,wt as fr,x as pr,xt as mr,y as hr,yt as gr,z as _r,zt as vr}from"./index-ByQGFt4l.js";import{t as yr}from"./split-button-CeV-MQ2f.js";import{t as br}from"./ThreadUnarchiveButton-EqnpnszW.js";var K=d(w(),1);function xr(e,t){return rt((0,K.useMemo)(()=>nt(null,(t,n,...r)=>e(t,n,...r)),[e]),t)}var Sr=class{highlighter;renderCache;computedLang=`text`;lineAnnotations={};constructor(e={theme:Ct},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=gr(e.theme??Ct)?mr():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&this.mergeOptions({themeType:e})}setLineAnnotations(e){this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.renderCache=void 0,this.highlighter=void 0,this.workerManager=void 0,this.onRenderUpdate=void 0}hydrate(e){let{options:t}=this.getRenderOptions(e),n=this.workerManager?.getFileResultCache(e);n!=null&&!Cr(t,n.options)&&(n=void 0),this.renderCache??={file:e,options:t,highlighted:!0,result:n?.result},this.workerManager?.isWorkingPool()===!0&&this.renderCache.result==null?this.workerManager.highlightFileAST(this,e):this.asyncHighlight(e).then(({result:t,options:n})=>{this.onHighlightSuccess(e,t,n)})}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getFileRenderOptions();let{theme:e=Ct,tokenizeMaxLineLength:t=1e3}=this.options;return{theme:e,tokenizeMaxLineLength:t}})(),{renderCache:n}=this;return n?.result==null||e!==n.file||!Cr(t,n.options)?{options:t,forceRender:!0}:{options:t,forceRender:!1}}renderFile(e=this.renderCache?.file){if(e==null)return;let t=this.workerManager?.getFileResultCache(e);t!=null&&this.renderCache==null&&(this.renderCache={file:e,highlighted:!0,...t});let{options:n,forceRender:r}=this.getRenderOptions(e);if(this.renderCache??={file:e,highlighted:!1,options:n,result:void 0},this.workerManager?.isWorkingPool()===!0)this.renderCache.result??=this.workerManager.getPlainFileAST(e),(!this.renderCache.highlighted||r)&&this.workerManager.highlightFileAST(this,e);else{this.computedLang=e.lang??kn(e.name);let t=this.highlighter!=null&&gr(n.theme),i=this.highlighter!=null&&fr(this.computedLang);if(this.highlighter!=null&&t&&(r||!this.renderCache.highlighted&&i||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,this.highlighter,!i);this.renderCache={file:e,options:n,highlighted:i,result:t}}(!t||!i)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.onHighlightSuccess(e,t,n)})}return this.renderCache.result==null?void 0:this.processFileResult(this.renderCache.file,this.renderCache.result)}async asyncRender(e){let{result:t}=await this.asyncHighlight(e);return this.processFileResult(e,t)}async asyncHighlight(e){this.computedLang=e.lang??kn(e.name);let t=this.highlighter!=null&&ur(Sn(this.options.theme)),n=this.highlighter!=null&&fr(this.computedLang);return(this.highlighter==null||!t||!n)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter)}renderFileWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e);return{result:Hn(e,t,r,n),options:r}}processFileResult(e,t){let{disableFileHeader:n=!1}=this.options,r=[],i=1;for(let e of t.code){r.push(e);let t=this.lineAnnotations[i];t!=null&&r.push(Nn({type:`annotation`,hunkIndex:0,lineIndex:i,annotations:t.map(e=>cr(e))})),i++}return{codeAST:r,preAST:this.createPreElement(t.code.length,t.themeStyles,t.baseThemeType),headerAST:n?void 0:this.renderHeader(e,t.themeStyles,t.baseThemeType),totalLines:t.code.length,themeStyles:t.themeStyles,baseThemeType:t.baseThemeType,css:``}}renderHeader(e,t,n){let{themeType:r=`system`}=this.options;return Wn({fileOrDiff:e,themeStyles:t,themeType:n??r})}renderFullHTML(e){return Tt(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(jn({tagName:`code`,children:e.codeAST,properties:{"data-code":``}})),{...e.preAST,children:t}}renderPartialHTML(e,t=!1){return Tt(t?jn({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await tn(En(this.computedLang,this.options)),this.highlighter}onHighlightSuccess(e,t,n){if(this.renderCache==null)return;let r=this.renderCache.file!==e||!this.renderCache.highlighted||!Cr(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:!0,result:t},r&&this.onRenderUpdate?.()}onHighlightError(e){console.error(e)}createPreElement(e,t,n){let{disableLineNumbers:r=!1,overflow:i=`scroll`,themeType:a=`system`}=this.options;return Zn({diffIndicators:`none`,disableBackground:!0,disableLineNumbers:r,overflow:i,themeStyles:t,themeType:n??a,split:!1,totalLines:e})}};function Cr(e,t){return _n(e.theme,t.theme)&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}var wr=-1,Tr=class{static LoadedCustomComponent=!0;__id=++wr;fileContainer;spriteSVG;pre;code;unsafeCSSStyle;hoverContent;errorWrapper;headerElement;headerMetadata;fileRenderer;resizeManager;mouseEventManager;lineSelectionManager;annotationElements=[];lineAnnotations=[];file;constructor(e={theme:Ct},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new Sr(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new rn,this.mouseEventManager=new kt(`file`,Dt(e)),this.lineSelectionManager=new Jt(zn(e)),this.workerManager?.subscribeToThemeChanges(this)}handleHighlightRender=()=>{this.rerender()};rerender(){this.file!=null&&this.render({file:this.file,forceRender:!0})}setOptions(e){e!=null&&(this.options=e,this.mouseEventManager.setOptions(Dt(e)),this.lineSelectionManager.setOptions(zn(e)))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){if((this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.fileRenderer.setThemeType(e),this.headerElement!=null&&(e===`system`?delete this.headerElement.dataset.themeType:this.headerElement.dataset.themeType=e),this.pre!=null))switch(e){case`system`:delete this.pre.dataset.themeType;break;case`light`:case`dark`:this.pre.dataset.themeType=e;break}}getHoveredLine=()=>this.mouseEventManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}setSelectedLines(e){this.lineSelectionManager.setSelection(e)}cleanUp(){this.fileRenderer.cleanUp(),this.resizeManager.cleanUp(),this.mouseEventManager.cleanUp(),this.lineSelectionManager.cleanUp(),this.workerManager?.unsubscribeToThemeChanges(this),this.workerManager=void 0,this.file=void 0,this.isContainerManaged||this.fileContainer?.parentNode?.removeChild(this.fileContainer),this.fileContainer?.shadowRoot!=null&&(this.fileContainer.shadowRoot.innerHTML=``),this.fileContainer=void 0,this.pre=void 0,this.headerElement=void 0,this.errorWrapper=void 0,this.unsafeCSSStyle=void 0}hydrate(e){let{fileContainer:t,prerenderedHTML:n}=e;ar(t,n);for(let e of Array.from(t.shadowRoot?.children??[])){if(e instanceof SVGElement){this.spriteSVG=e;continue}if(e instanceof HTMLElement){if(e instanceof HTMLPreElement){this.pre=e;continue}if(e instanceof HTMLStyleElement&&e.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=e;continue}if(`diffsHeader`in e.dataset){this.headerElement=e;continue}}}if(this.pre==null)this.render(e);else{let{file:n,lineAnnotations:r}=e;this.fileContainer=t,delete this.pre.dataset.dehydrated,this.lineAnnotations=r??this.lineAnnotations,this.file=n,this.fileRenderer.hydrate(n),this.renderAnnotations(),this.renderHoverUtility(),this.injectUnsafeCSS(),this.mouseEventManager.setup(this.pre),this.lineSelectionManager.setup(this.pre),(this.options.overflow??`scroll`)===`scroll`&&this.resizeManager.setup(this.pre)}}render({file:e,fileContainer:t,forceRender:n=!1,containerWrapper:r,lineAnnotations:i}){let a=i!=null&&(i.length>0||this.lineAnnotations.length>0)?i!==this.lineAnnotations:!1;if(!n&&rr(this.file,e)&&!a)return;this.file=e,this.fileRenderer.setOptions(this.options),i!=null&&this.setLineAnnotations(i),this.fileRenderer.setLineAnnotations(this.lineAnnotations);let{disableFileHeader:o=!1,disableErrorHandling:s=!1}=this.options;o&&this.headerElement!=null&&(this.headerElement.parentNode?.removeChild(this.headerElement),this.headerElement=void 0),t=this.getOrCreateFileContainerNode(t,r);try{let n=this.fileRenderer.renderFile(e);if(n==null){this.workerManager!=null&&!this.workerManager.isInitialized()&&this.workerManager.initialize().then(()=>this.rerender());return}n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t);let r=this.getOrCreatePreNode(t);this.applyHunksToDOM(n,r),this.renderAnnotations(),this.renderHoverUtility()}catch(e){if(s)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null)return;for(let e of this.annotationElements)e.parentNode?.removeChild(e);this.annotationElements.length=0;let{renderAnnotation:e}=this.options;if(e!=null&&this.lineAnnotations.length>0)for(let t of this.lineAnnotations){let n=e(t);if(n==null)continue;let r=Yn(cr(t));r.appendChild(n),this.annotationElements.push(r),this.fileContainer.appendChild(r)}}renderHoverUtility(){let{renderHoverUtility:e}=this.options;if(this.fileContainer==null||e==null)return;this.hoverContent??(this.hoverContent=Fn(),this.fileContainer.appendChild(this.hoverContent));let t=e(this.mouseEventManager.getHoveredLine);this.hoverContent.innerHTML=``,t!=null&&this.hoverContent.appendChild(t)}injectUnsafeCSS(){if(this.fileContainer?.shadowRoot==null)return;let{unsafeCSS:e}=this.options;if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.parentNode?.removeChild(this.unsafeCSSStyle),this.unsafeCSSStyle=void 0);return}this.unsafeCSSStyle??(this.unsafeCSSStyle=tr(),this.fileContainer.shadowRoot.appendChild(this.unsafeCSSStyle)),this.unsafeCSSStyle.innerText=Kn(e)}applyHunksToDOM(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e),t.innerHTML=``,this.code=bn(),this.code.innerHTML=this.fileRenderer.renderPartialHTML(e.codeAST),t.appendChild(this.code),this.injectUnsafeCSS(),this.mouseEventManager.setup(t),this.lineSelectionManager.setup(t),this.lineSelectionManager.setDirty(),(this.options.overflow??`scroll`)===`scroll`?this.resizeManager.setup(t):this.resizeManager.cleanUp()}applyHeaderToDOM(e,t){let{file:n}=this;if(n==null)return;this.cleanupErrorWrapper();let r=document.createElement(`div`);r.innerHTML=Tt(e);let i=r.firstElementChild;if(!(i instanceof HTMLElement)||(this.headerElement==null?t.shadowRoot?.prepend(i):t.shadowRoot?.replaceChild(i,this.headerElement),this.headerElement=i,this.isContainerManaged))return;let{renderCustomMetadata:a}=this.options;this.headerMetadata!=null&&this.headerMetadata.parentNode?.removeChild(this.headerMetadata);let o=a?.(n)??void 0;o!=null&&(this.headerMetadata=document.createElement(`div`),this.headerMetadata.slot=Gt,o instanceof Element?this.headerMetadata.appendChild(o):this.headerMetadata.innerText=`${o}`,t.appendChild(this.headerMetadata))}getOrCreateFileContainerNode(e,t){if(this.fileContainer=e??this.fileContainer??document.createElement(`diffs-container`),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=wn;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t,this.fileContainer.shadowRoot?.appendChild(this.spriteSVG))}return this.fileContainer}getOrCreatePreNode(e){return this.pre==null?(this.pre=document.createElement(`pre`),e.shadowRoot?.appendChild(this.pre)):this.pre.parentNode!==e&&e.shadowRoot?.appendChild(this.pre),this.pre}applyPreNodeAttributes(e,{totalLines:t,themeStyles:n,baseThemeType:r}){let{overflow:i=`scroll`,themeType:a=`system`,disableLineNumbers:o=!1}=this.options;Dn({pre:e,split:!1,themeStyles:n,overflow:i,disableLineNumbers:o,themeType:r??a,diffIndicators:`none`,disableBackground:!0,totalLines:t})}applyErrorToDOM(e,t){this.cleanupErrorWrapper();let n=this.getOrCreatePreNode(t);n.innerHTML=``,n.parentNode?.removeChild(n),this.pre=void 0;let r=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.innerHTML=``,r.appendChild(this.errorWrapper);let i=document.createElement(`div`);i.dataset.errorMessage=``,i.innerText=e.message,this.errorWrapper.appendChild(i);let a=document.createElement(`pre`);a.dataset.errorStack=``,a.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(a)}cleanupErrorWrapper(){this.errorWrapper?.parentNode?.removeChild(this.errorWrapper),this.errorWrapper=void 0}},q=oe();function Er({file:e,renderHeaderMetadata:t,renderAnnotation:n,lineAnnotations:r,renderHoverUtility:i,getHoveredLine:a}){let o=t?.(e);return(0,q.jsxs)(q.Fragment,{children:[o!=null&&(0,q.jsx)(`div`,{slot:`header-metadata`,children:o}),n!=null&&r?.map((e,t)=>(0,q.jsx)(`div`,{slot:cr(e),children:n(e)},t)),i!=null&&(0,q.jsx)(`div`,{slot:`hover-slot`,style:Zt,children:i(a)})]})}var Dr=typeof window>`u`?K.useEffect:K.useLayoutEffect;function Or({file:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i}){let a=(0,K.useContext)(fn),o=(0,K.useRef)(null),s=Rt(r=>{if(r!=null){if(o.current!=null)throw Error(`File: An instance should not already exist when a node is created`);o.current=new Tr(t,a,!0),o.current.hydrate({file:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:i})}else{if(o.current==null)throw Error(`File: A File instance should exist when unmounting`);o.current.cleanUp(),o.current=null}});return Dr(()=>{if(o.current==null)return;let i=!bt(o.current.options,t);o.current.setOptions(t),o.current.render({file:e,lineAnnotations:n,forceRender:i}),r!==void 0&&o.current.setSelectedLines(r)}),{ref:s,getHoveredLine:(0,K.useCallback)(()=>o.current?.getHoveredLine(),[])}}function kr({file:e,lineAnnotations:t,selectedLines:n,options:r,className:i,style:a,renderAnnotation:o,renderHeaderMetadata:s,prerenderedHTML:c,renderHoverUtility:l}){let{ref:u,getHoveredLine:d}=Or({file:e,options:r,lineAnnotations:t,selectedLines:n,prerenderedHTML:c});return(0,q.jsx)(Ln,{ref:u,className:i,style:a,children:mn(Er({file:e,renderAnnotation:o,renderHeaderMetadata:s,renderHoverUtility:l,lineAnnotations:t,getHoveredLine:d}),c)})}var Ar=8,jr=1;function Mr(){let e=typeof navigator<`u`?navigator.hardwareConcurrency:void 0;return e===void 0||e<=2?jr:Math.max(jr,Math.min(Ar,e-1))}function Nr(){return new Worker(new URL(`/assets/worker-portable-CA4_6zkQ.js`,``+import.meta.url),{name:`pierre-diffs-worker`})}var Pr=`bb.thread.terminalPanelState`,Fr=336*60*60*1e3,Ir=S({version:E(1),isOpen:v(),activeTerminalId:r().min(1).nullable(),panelHeightPercent:o().int().min(18).max(70),lastUsedAt:o().int().nonnegative()}).strict();function Lr(){return typeof window>`u`?null:window.localStorage}function Rr(e){return encodeURIComponent(e.trim())}function zr(e={}){return{version:1,isOpen:e.isOpen??!1,activeTerminalId:e.activeTerminalId??null,panelHeightPercent:e.panelHeightPercent??32,lastUsedAt:e.lastUsedAt??0}}var Br=zr();function Vr({threadId:e}){return`${Pr}-${Rr(e)}-1`}function Hr(e){return e.startsWith(`bb.thread.terminalPanelState-`)&&e.endsWith(`-1`)}function Ur({now:e,state:t}){return e-t.lastUsedAt>Fr}function Wr({initialValue:e,now:t,storedValue:n}){return Gr({initialValue:e,now:t,storedValue:n}).state}function Gr({initialValue:e,now:t,storedValue:n}){if(n===null)return{shouldPrune:!1,state:e};let r;try{r=JSON.parse(n)}catch{return{shouldPrune:!0,state:e}}let i=Ir.safeParse(r);return!i.success||Ur({now:t,state:i.data})?{shouldPrune:!0,state:e}:{shouldPrune:!1,state:i.data}}function Kr({state:e}){return JSON.stringify(e)}function qr({now:e}){let t=Lr();if(!t)return;let n=[];for(let e=0;e<t.length;e+=1){let r=t.key(e);r&&Hr(r)&&n.push(r)}for(let r of n)Gr({initialValue:Br,now:e,storedValue:t.getItem(r)}).shouldPrune&&t.removeItem(r)}function Jr(e){return e!=null&&e.length>0}function Yr(e,t){return{...e,lastUsedAt:t}}var Xr=tt({parse:(e,t)=>Wr({initialValue:t,now:Date.now(),storedValue:e}),serialize:e=>Kr({state:e})}),Zr=nt(Br),Qr=Ze(e=>G(Vr({threadId:e}),Br,Xr,{getOnInit:!0}));function $r(e){return Jr(e)?Qr(e):Zr}function ei(e){return t=>t.isOpen===e?t:{...t,isOpen:e}}function ti(e){(0,K.useEffect)(()=>{qr({now:Date.now()})},[e])}function ni(e){return dt($r(e))}function ri(e){let t=rt($r(e));return(0,K.useCallback)(n=>{if(!Jr(e))return;let r=Date.now();t(e=>{let t=n(e);return t===e?e:Yr(t,r)})},[t,e])}function ii(e){let t=ri(e);return(0,K.useCallback)(e=>{t(ei(e))},[t])}function ai(e){let t=ri(e);return(0,K.useCallback)(()=>{t(e=>({...e,isOpen:!e.isOpen}))},[t])}function oi(){let e=M();return I({meta:{errorMessage:`Failed to run environment action.`,showErrorToast:!1},mutationFn:({id:e,...t})=>P(e,t),onSuccess:(t,n)=>{vt({environmentId:n.id,queryClient:e})}})}function si(){let e=M();return I({meta:{errorMessage:`Failed to update environment.`,showErrorToast:!1},mutationFn:({id:e,...t})=>te(e,t),onSuccess:t=>{e.setQueryData(_(t.id),t),yt({environmentId:t.id,queryClient:e})}})}var ci=1e4,li=3e4;function ui(e,t){if(!e)throw Error(`${t}: environmentId is required when query is enabled`);return e}function di(e){if(!e)throw Error(`useEnvironmentFilePreview: path is required when query is enabled`);return e}function fi(e){if(!e)throw Error(`useEnvironmentFilePreview: source is required when query is enabled`);return e}function pi(e){if(!e)throw Error(`useEnvironmentGitDiff: target is required when query is enabled`);return e}function mi(e,n){return N({queryKey:_(e),queryFn:()=>t(ui(e,`useEnvironment`)),enabled:(n?.enabled??!0)&&!!e,staleTime:n?.staleTime})}function hi(e,t,n){return N({queryKey:fe(e,t??null),queryFn:()=>i(ui(e,`useEnvironmentWorkStatus`),t),enabled:(n?.enabled??!0)&&!!e,refetchOnWindowFocus:!1,staleTime:ci,placeholderData:(t,n)=>e?Ce(t,n?.queryKey,e):void 0})}function gi(e,t){return N({queryKey:c(e),queryFn:()=>s(e),enabled:(t?.enabled??!0)&&!!e,refetchOnWindowFocus:!1,staleTime:li})}function _i(e,t,n,r){return N({queryKey:m(e,t,n),queryFn:({signal:r})=>k({id:ui(e,`useEnvironmentFilePreview`),path:di(t),source:fi(n),signal:r}),enabled:(r?.enabled??!0)&&!!e&&!!t&&n!==null,refetchOnWindowFocus:!1})}function vi(e,t){let n=t.target,r=n?.type===`commit`?n.sha:n?.type===`all`||n?.type===`branch_committed`?n.mergeBaseBranch:null;return N({queryKey:h(e,n?.type??null,r),queryFn:()=>D(e,pi(n)),enabled:(t.enabled??!0)&&!!e&&n!==void 0,placeholderData:(t,n)=>ke(t,n?.queryKey,e),refetchOnWindowFocus:!1,staleTime:5e3})}function yi(e){return{filesCount:e.files.length,insertions:e.insertions,deletions:e.deletions}}function bi(e){return`${e} file${e===1?``:`s`}`}function xi(e){if(e.filesCount===0&&e.insertions===0&&e.deletions===0)return`No changes`;let t=bi(e.filesCount);return e.insertions===0&&e.deletions===0?t:`${t}, ${Nt({added:e.insertions,removed:e.deletions})}`}function Si(e){if(e.filesCount===0&&e.insertions===0&&e.deletions===0)return`No changes`;let t=bi(e.filesCount);return e.insertions===0&&e.deletions===0?t:(0,q.jsxs)(q.Fragment,{children:[t,`,`,` `,(0,q.jsx)(Lt,{insertions:e.insertions,deletions:e.deletions})]})}function Ci(e){if(!e)return[];let t=[],n=e.workingTree;if(n.files.length>0){let e=n.state===`untracked`;t.push({kind:e?`untracked`:`uncommitted`,label:e?`Untracked`:`Uncommitted`,files:n.files,mergeBaseRef:null,stats:n})}let r=e.mergeBase;return r&&r.files.length>0&&t.push({kind:`committed`,label:`Committed`,files:r.files,mergeBaseRef:r.baseRef,stats:r}),t}function wi(e){return Ci(e)[0]??null}function Ti(e){return e===`??`?`A?`:e}function Ei({files:e,className:t=`max-h-32`,emptyMessage:n=`No changed files detected.`,onFileClick:r}){return!e||e.length===0?(0,q.jsx)(Jn,{message:n}):(0,q.jsx)(`ul`,{className:R(`space-y-1 overflow-auto`,t),children:e.map(e=>(0,q.jsxs)(`li`,{className:`grid grid-cols-[1.5rem_minmax(0,1fr)_auto] items-start gap-x-3`,children:[(0,q.jsx)(`span`,{className:`text-xs leading-5 text-muted-foreground/80`,children:Ti(e.status)}),(0,q.jsx)(Mt,{path:e.path,onClick:r?()=>r(e):void 0}),e.insertions!==null&&e.deletions!==null?(0,q.jsx)(Lt,{insertions:e.insertions,deletions:e.deletions,hideZero:!0,className:`text-xs leading-5`}):null]},`${e.status}:${e.path}`))})}function Di({sections:e,onFileClick:t,listClassName:n,rowClassName:r,rowValueClassName:i}){let[a,o]=(0,K.useState)(null);if(e.length===0)return null;let s=e.find(e=>e.kind===a)??e[0],c=yi(s.stats),l=e.length>1,u=(0,q.jsx)(`span`,{className:`truncate text-muted-foreground`,children:Si(c)});return(0,q.jsx)(Wt,{label:l?(0,q.jsxs)(`span`,{className:`flex items-baseline gap-x-3`,children:[(0,q.jsx)(`span`,{className:`flex min-w-[var(--detail-label-width,96px)] items-baseline`,children:(0,q.jsxs)(B,{children:[(0,q.jsx)(ge,{asChild:!0,children:(0,q.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`h-5 w-auto min-w-0 justify-between gap-1 rounded-sm px-0 text-xs font-normal shadow-none hover:bg-transparent data-[state=open]:bg-transparent data-[state=open]:hover:bg-transparent`,title:s.label,"aria-label":`Switch changed files bucket`,children:[(0,q.jsx)(`span`,{className:`truncate`,children:s.label}),(0,q.jsx)(L,{name:`ChevronDown`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,q.jsx)(ye,{align:`start`,children:e.map(e=>(0,q.jsxs)(he,{onSelect:()=>o(e.kind),className:`flex items-center justify-between gap-2`,children:[(0,q.jsx)(`span`,{className:`truncate`,children:e.label}),(0,q.jsx)(L,{name:`Check`,className:R(`size-3.5 shrink-0`,e.kind===s.kind?`opacity-100`:`opacity-0`)})]},e.kind))})]})}),u]}):(0,q.jsxs)(`span`,{className:`flex items-baseline gap-x-3`,children:[(0,q.jsx)(`span`,{className:`min-w-[var(--detail-label-width,96px)] truncate`,children:s.label}),u]}),orientation:`vertical`,className:r,valueClassName:i,children:(0,q.jsx)(Ei,{files:s.files,className:n,onFileClick:t?e=>t({file:e,section:s}):void 0})})}function Oi(e){switch(e.kind){case`commit`:return{title:`Commit changes`,description:`Create a commit from the current workspace changes.`,submitLabel:`Commit changes`,showCommitControls:!0,showMergeBase:!1};case`commit_and_squash_merge`:return{title:`Commit and squash merge`,description:`Commit the current workspace changes, then squash merge this branch.`,submitLabel:`Commit + squash merge`,showCommitControls:!0,showMergeBase:!0};case`squash_merge`:return{title:`Squash merge`,description:`Squash merge this branch into the selected merge base.`,submitLabel:`Squash merge`,showCommitControls:!1,showMergeBase:!0};default:return f(e)}}function ki({target:e,branchName:t,gitStatusDisplay:n,changedFilesSection:r,threadId:i,threadType:a,showMergeBaseDetails:o=!1,mergeBaseBranch:s,mergeBaseBranchOptions:c,mergeBaseBranchOptionsLoading:l=!1,onMergeBaseBranchChange:u,onOpenChange:d,onCommit:f,onSquashMerge:p}){let m=(0,K.useMemo)(()=>e?Oi(e):null,[e]);return(0,q.jsx)(et,{open:e!==null,onOpenChange:d,children:(0,q.jsx)(Qe,{className:`max-w-[34rem] gap-0 overflow-hidden border-border/80 bg-background p-0 shadow-xl`,children:e&&m?(0,q.jsx)(Ai,{target:e,branchName:t,gitStatusDisplay:n,changedFilesSection:r,threadId:i,threadType:a,showMergeBaseDetails:o,mergeBaseBranch:s,mergeBaseBranchOptions:c,mergeBaseBranchOptionsLoading:l,onMergeBaseBranchChange:u,onOpenChange:d,onCommit:f,onSquashMerge:p},e.kind):null})})}function Ai({target:e,branchName:t,gitStatusDisplay:n,changedFilesSection:r,threadId:i,threadType:a,showMergeBaseDetails:o,mergeBaseBranch:s,mergeBaseBranchOptions:c,mergeBaseBranchOptionsLoading:l,onMergeBaseBranchChange:u,onOpenChange:d,onCommit:p,onSquashMerge:m}){let[h,g]=(0,K.useState)(null),_=Oi(e),v=Un({mergeBaseBranch:s,mergeBaseBranchOptions:c}),y=s??v[0],b=_.showMergeBase&&o===!0&&!!u&&v.length>0,x=_.showMergeBase&&o===!0&&(b||!!y),S=!!(r&&r.files.length>0);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(W,{className:`px-6 pt-5 pb-3`,children:[(0,q.jsx)($e,{children:_.title}),(0,q.jsx)(U,{children:_.description})]}),(0,q.jsxs)(`form`,{className:`space-y-5 px-6 pt-3 pb-5`,onSubmit:t=>{switch(t.preventDefault(),g(null),e.kind){case`commit`:d(!1),p();break;case`commit_and_squash_merge`:if(!y){g(`A merge base branch is required`);return}d(!1),m({mergeBaseBranch:y});break;case`squash_merge`:if(!y){g(`A merge base branch is required`);return}d(!1),m({mergeBaseBranch:y});break;default:f(e)}},children:[t||n||x||S?(0,q.jsxs)(In,{className:`border-border/70 bg-muted/20`,children:[t?(0,q.jsx)(Wt,{label:`Branch`,valueClassName:`min-w-0 truncate`,children:(0,q.jsx)(`span`,{className:`block truncate`,title:t,children:t})}):null,n?(0,q.jsx)(Wt,{label:`Git status`,valueClassName:`min-w-0`,children:(0,q.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2 whitespace-nowrap`,title:`${n.label} ${n.summary}`.trim(),children:[(0,q.jsx)(`span`,{className:`shrink-0 font-medium`,children:n.label}),(0,q.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:n.summaryContent})]})}):null,x&&y?(0,q.jsx)(Wt,{label:`Merge base`,valueClassName:`min-w-0`,children:b?(0,q.jsx)(Xn,{value:y,options:v,loading:l,onChange:e=>u?.(e),className:`max-w-full`}):(0,q.jsx)(`span`,{className:`block truncate`,title:y,children:y})}):null,S&&r?(0,q.jsx)(Di,{sections:[r],rowValueClassName:`pt-0.5`,listClassName:`max-h-40`}):null]}):null,(0,q.jsx)(Gn,{message:h}),(0,q.jsx)(Ye,{children:(0,q.jsx)(j,{type:`submit`,disabled:_.showMergeBase&&!y,children:_.submitLabel})})]})]})}var ji={vscode:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAeGVYSWZNTQAqAAAACAAEARoABQAAAAEAAAA+ARsABQAAAAEAAABGASgAAwAAAAEAAgAAh2kABAAAAAEAAABOAAAAAAAAAJAAAAABAAAAkAAAAAEAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAQKADAAQAAAABAAAAQAAAAACU3PoRAAAACXBIWXMAABYlAAAWJQFJUiTwAAABzWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczpleGlmPSJodH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xNCwliMkKCvMp1oy9nHd4WWxMSBGSji6oLeHmNtHmON7V2Ni73CHB5bXRZtJ215L52W0OtQ03gIg0yGuPtrrt+3zoD6wx8gBj4P0ccrJjDzl2qAAAAAElFTkSuQmCC`,finder:`/assets/finder-BYyfd7HG.png`,terminal:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAeGVYSWZNTQAqAAAACAAEARoABQAAAAEAAAA+ARsABQAAAAEAAABGASgAAwAAAAEAAgAAh2kABAAAAAEAAABOAAAAAAAAAJAAAAABAAAAkAAAAAEAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAQKADAAQAAAABAAAAQAAAAACU3PoRAAAACXBIWXMAABYlAAAWJQFJUiTwAAABnWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS4wLyI+CiAgICAgICAgIDxleGlmOlBpeGVsWERpbWVuc2lvbj4yNTY8L2V4aWY6UGl4ZWxYRGltZW5zaW9uPgogICAgICAgICA8ZXhpZjpQaXhlbFlEaW1lbnNpb24+MjU2PC9leGlmOlBpeGVsWURpbWVuc2lvbj4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+Cl6wHhsAAAq/SURBVHgB7VtrbFTHFT779Pu5xhgw2IANuBaIuP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37Ztws4Wx1OtQygARb84Zel23rLMSCHP3wjXmhH4GH0bt8eieU8rht4dDJ0EZ+dnM3Ajp3DPpgqdnA0kFGshHYvHKNYVn5rMTMpbHlVJgkQoADcyN+5iB3Y9hkuIusb7OA5rQWzJowb1T6ZwG8Vxrl/8+0XI0jqEAoDqbi7nfoDbVuTEcPSNggppxKv7j7fOUSdKw48N48swfYC7jaGTYDsAKHM3cwruwBjfwOTlpN2WpDW+j7ZUaqlPpmHShsENNDA4MPbx6Men2nHRDgB/Ij8xNjs/f9i2Lb+vv1fsrflEZ7WOPw8Qb397k320/cnt/FH88Lm/nRtDcejYtftmIICbdqf+kbATPfFYfJdhGVQq4N4NvhlwYCBWS+CBMU3cVkv10dPP7qS+Df1H33znVz8Hf+wErRgAblieXJi8ABBiMSe+K+JExEdTcS2+cmwuYXjUYKjTRWgkX5aOR2nosSF66pnPsPC/+M17vz6EKz6zzD+e0LBUrnlD3f1Ecvu3e7t6foArJ1uLuD/E9/DyuIrGW2e+isJ3+mVQcWi/dS9a164vVTlmmDWPnTQTXl6sK0b9UPmhjcOw+4F/lwz/Z28df/M4qrHzw7c82oalAsBE2Gmyu+y+bVuSwy/GnNiXdMP4NHaM/X7ZizAAfIDCO8gAiLZ9i5eYpYXdVjYtQjAWjs/zNREjjREG6KKeCTNkwXEDFFfjI3ncCp+OxKIjRa/0l8ujH/3p0qVL/wJh9tyW9J8YlgMAM8z1GQh+ujf0bRhKOIlB07CTlml04QweVya1KFTyvnML2osgRjKCb0lmhGzeuIg0PrcjrXPe4u2sSQbsG3XL2Jrk8IHFLZVL827ZnRq/M34HV/nZ0eERZ6H5UQqDZPuwXAAUNW7HKwg/igbHtWlkOx6UYBzXpnm7y48q63jH6wTXEVhHYB2B/0kE/gviOG5RK/1x9AAAAABJRU5ErkJggg==`,ghostty:`/assets/ghostty-D5T950Nz.png`,xcode:`/assets/xcode-BOSzsT4U.png`};function Mi({target:e,className:t=`size-4`}){return(0,q.jsx)(`img`,{alt:``,className:`${t} shrink-0 rounded-[3px]`,draggable:!1,src:ji[e.id]})}function Ni({onOpenPreferredTarget:e,onOpenTarget:t,preferredTarget:n,targets:r}){let[i,a]=(0,K.useState)(null),o=i!==null,s=(0,K.useCallback)(async(e,t)=>{if(i===null){a(e.id);try{await t()}finally{a(null)}}},[i]);return n?(0,q.jsx)(yr,{disabled:o,className:`px-1`,primaryAction:{label:`Open workspace in ${n.label}`,onSelect:()=>{s(n,e)},content:(0,q.jsx)(Mi,{target:n,className:`size-5`})},secondaryActions:r.map(e=>({label:e.label,onSelect:()=>{s(e,()=>t(e.id))},content:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mi,{target:e,className:`size-5`}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1`,children:e.label})]})})),triggerLabel:`Choose workspace open target`,mobileTitle:`Open Workspace`}):null}var Pi=nt(null),Fi=nt(null),Ii=nt([]);function Li(e){let t=dt(e.enabled?lt:Pi),n=dt(e.enabled?ut:Fi),r=dt(e.enabled?ot:Ii);return{openWorkspace:(0,K.useMemo)(()=>{if(!e.enabled||!t||!n||r.length===0)return null;let i=n;return e=>at(i,e)},[e.enabled,t,n,r.length]),workspaceOpenTargets:r}}var Ri=`Failed to open file locally`,zi=`Localhost is disconnected.`,Bi=`No local editor is available.`;function Vi(e){return e.hasDaemon?Bi:zi}function Hi(e){let{hasDaemon:t}=ft(),{openWorkspace:n,workspaceOpenTargets:r}=Li(e),[i,a]=ct(),o=(0,K.useMemo)(()=>gt({preferredTargetId:i,targets:r}),[i,r]),s=(0,K.useCallback)(async e=>{if(!r.find(t=>t.id===e.targetId)||!n)return hn.error(Ri,{description:Vi({hasDaemon:t})}),!1;e.rememberTarget&&a(e.targetId);try{return await n({lineNumber:e.lineNumber,path:e.path,targetId:e.targetId}),!0}catch(e){return hn.error(Ri,{description:e instanceof Error?e.message:void 0}),!1}},[t,n,a,r]),c=(0,K.useCallback)(async e=>o?s({lineNumber:e.lineNumber,path:e.path,rememberTarget:!1,targetId:o.id}):(hn.error(Ri,{description:Vi({hasDaemon:t})}),!1),[t,s,o]);return{canOpenPreferredTarget:o!==null,openPathInPreferredTarget:c,openPathInTarget:s,preferredTarget:o,workspaceOpenTargets:r}}function Ui(e,t){return e?e.sessions.findIndex(e=>e.id===t.id)===-1?{sessions:[...e.sessions,t]}:{sessions:e.sessions.map(e=>e.id===t.id?t:e)}:{sessions:[t]}}function Wi(e,t){if(!e)return e;let n=e.sessions.filter(e=>e.id!==t);return n.length===e.sessions.length?e:{sessions:n}}function Gi(e,t){if(!e)throw Error(`${t}: thread id is required when query is enabled`);return e}function Ki(e,t){return N({queryKey:F(e),queryFn:({signal:t})=>re(Gi(e,`useThreadTerminals`),t),enabled:(t?.enabled??!0)&&!!e,refetchOnWindowFocus:!1})}function qi(){let e=M();return I({meta:{errorMessage:`Failed to start terminal.`},mutationFn:({threadId:e,...t})=>g(e,t),onSuccess:t=>{e.setQueryData(F(t.threadId),e=>Ui(e,t)),e.invalidateQueries({queryKey:F(t.threadId)})}})}function Ji(){let e=M();return I({meta:{errorMessage:`Failed to rename terminal.`},mutationFn:({terminalId:e,threadId:t,...n})=>de(t,e,n),onSuccess:t=>{e.setQueryData(F(t.threadId),e=>Ui(e,t)),e.invalidateQueries({queryKey:F(t.threadId)})}})}function Yi(){let e=M();return I({meta:{errorMessage:`Failed to close terminal.`},mutationFn:({mode:e,terminalId:t,threadId:n})=>ne(n,t,{mode:e,reason:`user`}),onSuccess:(t,n)=>{e.setQueryData(F(t.threadId),e=>t.status===`exited`?Wi(e,n.terminalId):Ui(e,t)),e.invalidateQueries({queryKey:F(t.threadId)})}})}var Xi=`bb.thread.useStandardManagerTimeline`,Zi=`bb.thread.showAllEvents`;function Qi(){return typeof window>`u`?null:window.localStorage}function $i(e,t){return e===`true`?!0:e===`false`?!1:t}function ea({currentValue:e,initialValue:t,legacyValue:n}){return $i(e===null?n:e,t)}var ta=tt({parse:$i,serialize:e=>String(e)}),na=G(Xi,!1,{getItem:(e,t)=>{let n=Qi();return ea({currentValue:n?.getItem(e)??null,legacyValue:n?.getItem(Zi)??null,initialValue:t})},removeItem:e=>{ta.removeItem(e)},setItem:(e,t)=>{ta.setItem(e,t)},subscribe:ta.subscribe},{getOnInit:!0});function ra(){return it(na)}function ia(e,t){let n=e.mergeBase?.aheadCount??0,r=e.mergeBase?.behindCount??0;return n===0&&r===0?null:n>0&&r>0?t?`${n} ahead, ${r} behind relative to ${t}`:`${n} ahead, ${r} behind`:n>0?t?`${n} ahead of ${t}`:`${n} ahead`:t?`${r} behind ${t}`:`${r} behind`}function aa(e,t){return{label:e,summary:t,summaryContent:t}}function oa(e,t){if(!e){let e=t?.error instanceof b&&t.error.code===`path_not_found`;return t?.workspaceDeleted||e?aa(`Unknown`,`Workspace not found.`):aa(`Unknown`,`Workspace status unavailable.`)}let n=t?.mergeBaseBranch??e.mergeBase?.mergeBaseBranch,r=t?.showBranchComparison?ia(e,n):null;switch(e.workingTree.state){case`clean`:return(e.mergeBase?.aheadCount??0)>0&&(e.mergeBase?.behindCount??0)>0?aa(`Diverged`,r??`Branch has diverged.`):(e.mergeBase?.aheadCount??0)>0?aa(`Ahead`,r??`Local commits pending merge.`):(e.mergeBase?.behindCount??0)>0?aa(`Behind`,r??`Branch is behind its merge base.`):aa(t?.showBranchComparison?`Up to date`:`Clean`,n?`No local changes relative to ${n}.`:`No local changes.`);case`untracked`:return aa(`Untracked`,r??``);case`dirty_uncommitted`:return aa(`Dirty`,r??``);case`committed_unmerged`:return(e.mergeBase?.aheadCount??0)>0&&(e.mergeBase?.behindCount??0)>0?aa(`Diverged`,r??`Branch has diverged.`):(e.mergeBase?.behindCount??0)>0?aa(`Behind`,r??`Branch is behind its merge base.`):aa(`Ahead`,r??`Local commits pending merge.`);case`dirty_and_committed_unmerged`:return aa(`Dirty`,r??``);default:return f(e.workingTree.state)}}var sa=nt(!1),ca=G(`bb.thread.secondaryPanel.widthPercent`,50,tt({parse:(e,t)=>{if(e===null)return t;let n=Number.parseFloat(e);return Number.isFinite(n)&&n>0&&n<=100?n:t},serialize:e=>String(e)}),{getOnInit:!0}),la=nt(new Set),ua=nt(new Set),da=nt(void 0),fa=nt(null);function pa({activeSecondaryPanel:e,clearActiveFileTabs:t,defaultMergeBaseBranch:n,environmentId:r,mergeBaseBranchOptionsEnabled:i=!1,setThreadSecondaryPanel:a}){let o=dt(da),s=rt(da),c=rt(fa),{data:l,isLoading:u}=gi(r??``,{enabled:!!r&&(i||e===`git-diff`)});(0,K.useEffect)(()=>{s(void 0)},[r,s]);let d=(0,K.useCallback)(e=>{a(e)},[a]),f=(0,K.useCallback)(()=>{d(`git-diff`)},[d]);return{closeThreadSecondaryPanel:(0,K.useCallback)(()=>{e!==null&&a(null)},[e,a]),defaultMergeBaseBranch:n,isLoadingMergeBaseBranchOptions:u,mergeBaseBranchOptions:l,openDiffFile:(0,K.useCallback)(e=>{t(),c(e),f()},[t,f,c]),openThreadDiffPanel:f,openThreadSecondaryPanel:d,selectedMergeBaseBranch:o,setSelectedMergeBaseBranch:s}}function ma(e){return!!e.threadId&&e.inlineRowCount===0&&e.cachedRowCount===0&&!e.isLoading}function ha(e){return{sourceSeqEnd:e.sourceSeqEnd,sourceSeqStart:e.sourceSeqStart,turnId:e.turnId}}function ga(e,t){return e.turnId===t.turnId&&e.sourceSeqStart===t.sourceSeqStart&&e.sourceSeqEnd===t.sourceSeqEnd}function _a(e){let t={},n=e=>{for(let r of e){if(r.kind===`turn`){t[r.id]=ha(r),r.children&&n(r.children);continue}r.kind===`work`&&r.workKind===`delegation`&&n(r.childRows)}};return n(e),t}function va({candidateRowIds:e,previousRangesById:t,visibleRangesById:n}){let r=new Set;for(let i of e){let e=n[i],a=t[i];(!e||a&&!ga(a,e))&&r.add(i)}return r}function ya(e,t){let n=null;for(let r of t)e.has(r)&&(n??=new Set(e),n.delete(r));return n}function ba(e,t){let n=null;for(let r of t)r in e&&(n??={...e},delete n[r]);return n}function xa({currentLoadGeneration:e,request:t,visibleRangesById:n}){if(e!==t.loadGeneration)return!1;let r=n[t.rowId];return r!==void 0&&ga(r,t.range)}function Sa({loadTurnSummaryRows:e,managerTimelineView:t,timelineRows:n,threadId:r}){let i=(0,K.useRef)(0),a=(0,K.useRef)(e),o=(0,K.useRef)(r),s=(0,K.useRef)({}),c=(0,K.useRef)(new Set),l=(0,K.useRef)(new Set),u=(0,K.useRef)(new Set),d=(0,K.useRef)({}),[f,p]=(0,K.useState)(()=>new Set),[m,h]=(0,K.useState)(()=>new Set),[g,_]=(0,K.useState)({});(0,K.useLayoutEffect)(()=>{a.current=e},[e]),(0,K.useLayoutEffect)(()=>{o.current=r},[r]),(0,K.useLayoutEffect)(()=>{let e=_a(n),t=va({candidateRowIds:[...Object.keys(d.current),...c.current,...l.current,...u.current],previousRangesById:s.current,visibleRangesById:e});if(s.current=e,t.size===0)return;let r=ya(c.current,t);r&&(c.current=r);let i=ya(l.current,t);i&&(l.current=i,p(i));let a=ya(u.current,t);a&&(u.current=a,h(a));let o=ba(d.current,t);o&&(d.current=o,_(o))},[n]);let v=(0,K.useCallback)(e=>{let t=o.current,n={loadGeneration:i.current,range:ha(e),rowId:e.id},r=c.current,f=s.current[e.id];if(f===void 0||!ga(f,n.range)||r.has(e.id)||!ma({cachedRowCount:d.current[e.id]?.length??0,inlineRowCount:e.children?.length??0,isLoading:l.current.has(e.id),threadId:t})||!t)return;r.add(e.id);let m=new Set(l.current).add(e.id);if(l.current=m,p(m),u.current.has(e.id)){let t=new Set(u.current);t.delete(e.id),u.current=t,h(t)}a.current({id:t,turnId:e.turnId,sourceSeqStart:e.sourceSeqStart,sourceSeqEnd:e.sourceSeqEnd}).then(t=>{if(!xa({currentLoadGeneration:i.current,request:n,visibleRangesById:s.current}))return;let r={...d.current,[e.id]:t.rows};d.current=r,_(r)}).catch(()=>{if(!xa({currentLoadGeneration:i.current,request:n,visibleRangesById:s.current}))return;c.current.delete(e.id);let t=new Set(u.current).add(e.id);u.current=t,h(t)}).finally(()=>{if(!xa({currentLoadGeneration:i.current,request:n,visibleRangesById:s.current}))return;let t=new Set(l.current);t.delete(e.id),l.current=t,p(t)})},[]);return(0,K.useLayoutEffect)(()=>{i.current+=1,c.current=new Set;let e=new Set,t=new Set,n={};l.current=e,u.current=t,d.current=n,p(e),h(t),_(n)},[t,r]),{erroredTurnSummaryIds:m,handleLoadTurnSummaryRows:v,loadingTurnSummaryIds:f,turnSummaryRowsById:g}}function Ca({managerTimelineView:e,timelineRows:t,threadId:n}){let{mutateAsync:r}=Ne();return Sa({managerTimelineView:e,timelineRows:t,threadId:n,loadTurnSummaryRows:(0,K.useCallback)(t=>r({...t,managerTimelineView:e}),[r,e])})}var wa=pe;function Ta({actionsMenu:e,activeTerminalCount:t,isManagedThread:n,isManagerThread:r,isSecondaryPanelOpen:i,isTerminalPanelOpen:a,isThreadGitActionPending:o,onOpenThreadGitAction:s,onToggleSecondaryPanel:c,onToggleTerminalPanel:l,showTerminalPanelToggle:u,threadHeaderGitActions:d,threadTitle:f,workspaceOpenButton:p}){let[m,...h]=d,g=me(),_=g?`PanelBottom`:`PanelRight`;return(0,q.jsx)(dr,{center:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`truncate text-sm font-semibold`,children:f}),r?(0,q.jsx)(Je,{variant:`outline`,children:`manager`}):null,!r&&n?(0,q.jsx)(Je,{variant:`outline`,children:`managed`}):null]}),actions:(0,q.jsxs)(q.Fragment,{children:[p,m&&h.length>0?(0,q.jsx)(yr,{disabled:o,primaryAction:{label:m.label,onSelect:()=>s(m.target)},secondaryActions:h.map(e=>({label:e.label,onSelect:()=>s(e.target)}))}):m?(0,q.jsx)(j,{type:`button`,variant:`outline`,size:`sm`,disabled:o,className:wa,onClick:()=>s(m.target),children:m.label}):null,u?(0,q.jsxs)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`${nn} relative`,"aria-label":a?`Hide terminal panel`:`Show terminal panel`,"aria-pressed":a,title:a?`Hide terminal panel`:`Show terminal panel`,onClick:l,children:[(0,q.jsx)(L,{name:`Terminal`}),t>0?(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute -right-0.5 -top-0.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-primary px-1 text-[9px] font-semibold leading-none text-primary-foreground`,children:t>9?`9+`:t}):null]}):null,e,!g&&i?null:(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:nn,"aria-label":i?`Hide secondary panel`:`Show secondary panel`,"aria-pressed":i,title:i?`Hide secondary panel`:`Show secondary panel`,onClick:c,children:(0,q.jsx)(L,{name:_})})]})})}function Ea(){let e=M();return I({meta:{errorMessage:`Failed to resolve pending interaction.`,showErrorToast:!1},mutationFn:({threadId:e,interactionId:t,resolution:n})=>ue(e,t,n),onSuccess:(t,n)=>(_t({queryClient:e,threadId:n.threadId}),t)})}var Da=[];function Oa(){return{freeTextByQuestionId:{},selectedValuesByQuestionId:{}}}function ka({formState:e,question:t}){return e.selectedValuesByQuestionId[t.id]??Da}function Aa({formState:e,question:t}){return e.freeTextByQuestionId[t.id]??``}function ja({question:e,selectedValues:t}){let n=new Set((e.options??[]).map(e=>e.value));return t.filter(e=>n.has(e))}function Ma({optionValue:e,question:t,selectedValues:n}){return t.multiSelect?n.includes(e)?n.filter(t=>t!==e):[...n,e]:[e]}function Na(e,t){let n=ka({formState:e,question:t.question});return{...e,selectedValuesByQuestionId:{...e.selectedValuesByQuestionId,[t.question.id]:Ma({optionValue:t.optionValue,question:t.question,selectedValues:n})}}}function Pa(e,t){return{...e,freeTextByQuestionId:{...e.freeTextByQuestionId,[t.questionId]:t.value}}}function Fa({formState:e,question:t}){return ja({question:t,selectedValues:ka({formState:e,question:t})}).length>0?!0:t.allowFreeText&&Aa({formState:e,question:t}).trim().length>0}function Ia({formState:e,questions:t}){let n={};for(let r of t){let t=ja({question:r,selectedValues:ka({formState:e,question:r})}),i=Aa({formState:e,question:r}).trim();n[r.id]=r.allowFreeText&&i.length>0?{selected:t,freeText:i}:{selected:t}}return{kind:`user_answer`,answers:n}}function La({question:e}){return(0,q.jsxs)(`div`,{className:`min-w-0`,children:[e.shortLabel?(0,q.jsx)(`div`,{className:`text-xs font-medium uppercase text-muted-foreground`,children:e.shortLabel}):null,(0,q.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:e.prompt})]})}function Ra({checked:e,disabled:t,inputName:n,onOptionToggle:r,option:i,question:a}){let o=a.multiSelect?`checkbox`:`radio`;return(0,q.jsxs)(`label`,{className:R(`flex min-w-0 cursor-pointer items-start gap-2 rounded-md border px-3 py-2 transition-colors`,e?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-background/70 text-muted-foreground hover:bg-state-hover hover:text-foreground`,t&&`cursor-not-allowed opacity-60`),children:[(0,q.jsx)(`input`,{type:o,name:n,value:i.value,checked:e,disabled:t,onChange:()=>r({question:a,optionValue:i.value}),className:`mt-0.5 size-4 shrink-0 accent-primary`}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block text-sm font-medium`,children:i.label}),i.description?(0,q.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted-foreground`,children:i.description}):null]})]})}function za({disabled:e,formState:t,interactionId:n,onFreeTextChange:r,onOptionToggle:i,onSubmit:a,question:o}){let s=ka({formState:t,question:o}),c=Aa({formState:t,question:o}),l=`${n}-${o.id}`,u=o.options??[],d=`${o.shortLabel??o.prompt} answer`;return(0,q.jsxs)(`fieldset`,{className:`space-y-2 rounded-md border border-border bg-card px-4 py-3`,children:[(0,q.jsx)(`legend`,{className:`sr-only`,children:o.prompt}),(0,q.jsx)(La,{question:o}),u.length>0?(0,q.jsx)(`div`,{className:`grid gap-2`,children:u.map(t=>(0,q.jsx)(Ra,{checked:s.includes(t.value),disabled:e,inputName:l,onOptionToggle:i,option:t,question:o},t.value))}):null,o.allowFreeText?(0,q.jsx)(`textarea`,{"aria-label":d,value:c,disabled:e,rows:3,onChange:e=>r({questionId:o.id,value:e.target.value}),onKeyDown:e=>{e.nativeEvent.isComposing||e.key!==`Enter`||!e.metaKey&&!e.ctrlKey||(e.preventDefault(),a())},className:`min-h-20 w-full resize-y rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,placeholder:`Add an answer`}):null]})}function Ba({interactionId:e,questions:t,threadId:n}){let[r,i]=(0,K.useState)(Oa),a=Ea();(0,K.useEffect)(()=>{i(Oa())},[e]);let o=(0,K.useMemo)(()=>t.length>0&&t.every(e=>Fa({formState:r,question:e})),[r,t]),s=a.error?pn({error:a.error,fallbackMessage:`Failed to submit answer.`}):null,c=a.isPending,l=c||!o;return{disabled:c,formState:r,mutationErrorMessage:s,submitAnswer:()=>{if(l)return;let i=Ia({formState:r,questions:t});a.mutateAsync({threadId:n,interactionId:e,resolution:i}).catch(()=>{})},updateFreeTextAnswer:e=>{i(t=>Pa(t,e))},updateSelectedAnswer:e=>{i(t=>Na(t,e))}}}function Va({className:e,interactionId:t,isResolving:n=!1,questions:r,threadId:i}){let{disabled:a,formState:o,mutationErrorMessage:s,submitAnswer:c,updateFreeTextAnswer:l,updateSelectedAnswer:u}=Ba({interactionId:t,questions:r,threadId:i}),d=a||n,[f,p]=(0,K.useState)(0);(0,K.useEffect)(()=>{p(0)},[t]);let m=r.length,h=r[f]??null,g=f===m-1,_=h?Fa({formState:o,question:h}):!1,v=()=>{p(e=>Math.max(e-1,0))},y=()=>{if(g){c();return}p(e=>Math.min(e+1,m-1))};return h?(0,q.jsxs)(`form`,{className:R(`space-y-3`,e),onSubmit:e=>{e.preventDefault(),y()},children:[m>1?(0,q.jsx)(Ha,{currentIndex:f,totalQuestions:m}):null,(0,q.jsx)(za,{disabled:d,formState:o,interactionId:t,onFreeTextChange:l,onOptionToggle:u,onSubmit:y,question:h}),(0,q.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[f>0?(0,q.jsx)(j,{type:`button`,size:`sm`,variant:`outline`,disabled:d,onClick:v,children:`Back`}):null,(0,q.jsxs)(j,{type:`submit`,size:`sm`,disabled:d||!_,children:[n?(0,q.jsx)(L,{name:`Spinner`,className:`size-3 animate-spin`}):null,g?`Submit answer`:`Next`]})]}),s?(0,q.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/[0.06] px-3 py-2 text-xs text-destructive`,children:s}):null]}):null}function Ha({currentIndex:e,totalQuestions:t}){return(0,q.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,q.jsxs)(`span`,{children:[`Question `,e+1,` of `,t]}),(0,q.jsx)(`div`,{className:`flex items-center gap-1.5`,"aria-hidden":!0,children:Array.from({length:t}).map((t,n)=>(0,q.jsx)(`span`,{className:R(`size-1.5 rounded-full transition-colors`,n===e?`bg-foreground`:n<e?`bg-foreground/60`:`bg-foreground/25`)},n))})]})}function Ua({interaction:e,threadId:t}){return y(e.payload)?(0,q.jsx)(Ka,{interaction:e,payload:e.payload,threadId:t}):ce(e.payload)?(0,q.jsx)(Ga,{interaction:e,payload:e.payload,threadId:t}):f(e.payload)}function Wa({title:e,errorMessage:t,footer:n,children:r}){return(0,q.jsxs)(`div`,{className:`mb-2 rounded-lg border border-border/60 bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,children:[(0,q.jsx)(`h3`,{className:`min-w-0 text-sm font-semibold text-foreground`,children:(0,q.jsx)(Xt,{fullText:e,collapsedClassName:`line-clamp-2`,children:e})}),r?(0,q.jsx)(`div`,{className:`mt-3`,children:r}):null,n?(0,q.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center justify-end gap-2`,children:n}):null,t?(0,q.jsx)(`div`,{className:`mt-2 rounded-md border border-destructive/30 bg-destructive/[0.06] px-2 py-1 text-xs text-destructive`,children:t}):null]})}function Ga({interaction:e,payload:t,threadId:n}){let r=Ea(),i=e.status===`resolving`,a=Ya(e.resolution),o=(0,K.useMemo)(()=>Xa({interaction:e,payload:t}),[e,t]),s=r.error?pn({error:r.error,fallbackMessage:`Failed to resolve pending interaction.`}):null,c=r.isPending||i,l=t=>{let i=x(e,t);r.mutateAsync({threadId:n,interactionId:e.id,resolution:i}).catch(()=>{})};return(0,q.jsx)(Wa,{title:o.title,errorMessage:s,footer:t.availableDecisions.map(e=>(0,q.jsx)(qa,{decision:e,disabled:c,isLoading:i&&a===e,onClick:()=>l(e)},e)),children:o.body})}function Ka({interaction:e,payload:t,threadId:n}){let r=e.status===`resolving`;return(0,q.jsx)(Wa,{title:T({interaction:e,surface:`app`}),children:(0,q.jsx)(Va,{interactionId:e.id,isResolving:r,questions:t.questions,threadId:n})})}function qa({decision:e,disabled:t,isLoading:n,onClick:r}){return(0,q.jsxs)(j,{type:`button`,size:`sm`,variant:Ja(e),disabled:t,onClick:r,children:[n?(0,q.jsx)(L,{name:`Spinner`,className:`size-3 animate-spin`}):null,Za(e)]})}function Ja(e){switch(e){case`allow_once`:return`default`;case`allow_for_session`:return`outline`;case`deny`:return`ghost`}}function Ya(e){return!e||`kind`in e?null:e.decision}function Xa({interaction:e,payload:t}){switch(t.subject.kind){case`command`:{let n=t.subject.command,r=n?un(n)??n:null,i=O(e).filter(e=>!e.startsWith(`Command: `)).map(e=>e.startsWith(`Cwd: `)?e.slice(5):e);return{title:t.reason??`Do you want to run this command?`,body:r?(0,q.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-border bg-card`,children:[(0,q.jsxs)(`pre`,{className:R(jt(`base`),`overflow-auto whitespace-pre px-4 py-3 font-mono text-sm leading-tight text-foreground`),children:[`$ `,r]}),i.length>0?(0,q.jsx)(`ul`,{className:`border-t border-border/60 px-4 py-3 text-xs text-muted-foreground`,children:i.map(e=>(0,q.jsx)(`li`,{children:e},e))}):null]}):null}}case`file_change`:{let n=O(e);return{title:t.reason??`Do you want to make these changes?`,body:n.length>0?(0,q.jsx)(`ul`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-xs text-muted-foreground`,children:n.map(e=>(0,q.jsx)(`li`,{children:e},e))}):null}}case`permission_grant`:{let n=O(e);return{title:t.reason??`Do you want to grant this permission?`,body:n.length>0?(0,q.jsx)(`ul`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-xs text-muted-foreground`,children:n.map(e=>(0,q.jsx)(`li`,{children:e},e))}):null}}default:return f(t.subject)}}function Za(e){switch(e){case`allow_once`:return`Allow once`;case`allow_for_session`:return`Allow for session`;case`deny`:return`Deny`}}var Qa=`rounded-md border border-border/60 bg-muted/30`;function $a({children:e,ariaLabel:t,className:n,style:r}){return t?(0,q.jsx)(`section`,{"aria-label":t,className:R(Qa,n),style:r,children:e}):(0,q.jsx)(`div`,{className:R(Qa,n),style:r,children:e})}var eo=new Set([`active`,`host-reconnecting`,`waiting-for-host`]);function to(e){return eo.has(e)}var no={uncommitted:`Uncommitted`,untracked:`Untracked`,committed:`Committed`},ro={managedBy:{toggle:`thread-prompt-banner-managed-by-toggle`,body:`thread-prompt-banner-managed-by-body`},managerChildren:{toggle:`thread-prompt-banner-manager-children-toggle`,body:`thread-prompt-banner-manager-children-body`},todos:{toggle:`thread-prompt-banner-todos-toggle`,body:`thread-prompt-banner-todos-body`},git:{toggle:`thread-prompt-banner-git-toggle`,body:`thread-prompt-banner-git-body`}},io={in_progress:0,pending:1,completed:2};function ao(e){return e.items.length>0}function oo(e){if(e.length===0)return null;let t=0;for(let n of e)n.status===`completed`&&(t+=1);return t===0?`${e.length}`:`${t}/${e.length}`}function so({className:e}){return(0,q.jsx)(L,{name:`ChevronDown`,className:R(`size-3.5 shrink-0 rotate-45`,e),"aria-hidden":`true`})}function co({id:e,controlsId:t,ariaLabel:n,icon:r,label:i,isExpanded:a,onToggle:o}){return(0,q.jsxs)(`button`,{type:`button`,id:e,"aria-expanded":a,"aria-controls":t,"aria-label":n,onClick:o,className:R(`flex min-w-0 items-center rounded px-1 py-0.5 text-xs transition-colors hover:bg-state-hover`,i==null?`gap-0`:`gap-1.5`,a?`text-foreground/90`:`text-muted-foreground`),children:[r,i==null?null:(0,q.jsx)(`span`,{className:`min-w-0 truncate`,children:i}),(0,q.jsx)(L,{name:`ChevronDown`,className:R(`size-3.5 shrink-0 text-muted-foreground/70 transition-transform duration-200`,a&&`rotate-180`),"aria-hidden":`true`})]})}function lo({status:e}){let t=`size-3.5 shrink-0`;switch(e){case`in_progress`:return(0,q.jsx)(L,{name:`Square`,className:R(t,`fill-current text-muted-foreground/30`),"aria-hidden":`true`});case`completed`:return(0,q.jsx)(L,{name:`Check`,className:R(t,`text-muted-foreground/60`),"aria-hidden":`true`});case`pending`:return(0,q.jsx)(L,{name:`Square`,className:R(t,`text-muted-foreground/45`),"aria-hidden":`true`})}}function uo({items:e}){return(0,q.jsx)(`ul`,{className:`max-h-40 space-y-0.5 overflow-y-auto px-3 pb-2 pt-1.5`,children:[...e].sort((e,t)=>io[e.status]-io[t.status]).map(e=>(0,q.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 py-0.5 text-xs`,children:[(0,q.jsx)(lo,{status:e.status}),(0,q.jsx)(`span`,{className:R(`min-w-0 flex-1 truncate`,e.status===`in_progress`&&`font-medium text-foreground/90`,e.status===`pending`&&`text-foreground/85`,e.status===`completed`&&`text-muted-foreground/70 line-through decoration-muted-foreground/40`),title:e.text,children:e.text})]},e.id))})}function fo({managerName:e,href:t}){return(0,q.jsxs)(`div`,{className:`px-3 pb-2 pt-1.5 text-xs leading-relaxed text-muted-foreground`,children:[`This thread is managed by`,` `,(0,q.jsx)(We,{to:t,className:`text-foreground/90 underline-offset-2 hover:underline`,children:e}),`.`]})}function po({items:e}){return(0,q.jsx)(`ul`,{className:`max-h-40 space-y-0.5 overflow-y-auto px-3 pb-2 pt-1.5`,children:e.map(e=>(0,q.jsx)(`li`,{className:`text-xs`,children:(0,q.jsxs)(We,{to:e.href,title:e.title,className:`flex min-w-0 items-center gap-2 py-0.5 text-foreground/90 underline-offset-2 hover:underline`,children:[(0,q.jsx)(so,{className:`text-muted-foreground/60 no-underline`}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title})]})},e.id))})}function mo({id:e,labelledBy:t,isExpanded:n,children:r}){return(0,q.jsx)(`section`,{id:e,role:`region`,"aria-labelledby":t,"aria-hidden":!n,className:R(`grid overflow-hidden transition-[grid-template-rows,opacity,border-color] duration-200 ease-out`,n?`grid-rows-[1fr] border-t border-border/40 opacity-100`:`pointer-events-none grid-rows-[0fr] border-t border-transparent opacity-0`),children:(0,q.jsx)(`div`,{className:`overflow-hidden`,children:r})})}function ho({todoSection:e,gitSection:t,gitSectionPending:n,archivedSection:r,managedBySection:i,managerChildrenSection:a,expandedSection:o,onToggleSection:s}){if(n)return null;if(r){let e=o===`managedBy`&&i!==null;return(0,q.jsxs)($a,{ariaLabel:`Thread context before sending`,className:`overflow-hidden`,style:{minHeight:32},children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-0.5 px-2 py-1 text-xs text-muted-foreground`,children:[i?(0,q.jsx)(co,{id:ro.managedBy.toggle,controlsId:ro.managedBy.body,ariaLabel:`Managed by ${i.managerName}`,icon:(0,q.jsx)(L,{name:`UserRound`,className:`size-3.5 shrink-0`,"aria-hidden":`true`}),label:null,isExpanded:e,onToggle:()=>s(`managedBy`)}):null,(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 px-1 py-0.5`,children:[(0,q.jsx)(L,{name:`Archive`,className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`min-w-0 truncate`,children:`Thread is archived`})]})]}),i?(0,q.jsx)(mo,{id:ro.managedBy.body,labelledBy:ro.managedBy.toggle,isExpanded:e,children:(0,q.jsx)(fo,{managerName:i.managerName,href:i.href})}):null]})}let c=e!==null&&ao(e.pendingTodos),l=t!==null,u=i!==null,d=a!==null&&a.items.length>0;if(!c&&!l&&!u&&!d)return null;let f=c&&e?e.pendingTodos.items:[],p=o===`todos`&&c,m=o===`git`&&l,h=o===`managedBy`&&u,g=o===`managerChildren`&&d,_=l?(0,q.jsxs)(q.Fragment,{children:[c?null:(0,q.jsxs)(q.Fragment,{children:[no[t.changedFiles.kind],` · `]}),Si(yi(t.changedFiles.stats))]}):null,v=l&&t.mergeBase?Un({mergeBaseBranch:t.mergeBase.branch,mergeBaseBranchOptions:t.mergeBase.options}):[],y=u&&!c&&!l&&!d;return(0,q.jsxs)($a,{ariaLabel:`Thread context before sending`,className:`overflow-hidden`,style:{minHeight:32},children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-0.5 px-2 py-1 text-xs text-muted-foreground`,children:[u&&i&&y?(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 px-1 py-0.5`,children:[(0,q.jsx)(L,{name:`UserRound`,className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`Managed by`,` `,(0,q.jsx)(We,{to:i.href,className:`text-foreground/90 underline underline-offset-2`,children:i.managerName})]})]}):null,u&&i&&!y?(0,q.jsx)(co,{id:ro.managedBy.toggle,controlsId:ro.managedBy.body,ariaLabel:`Managed by ${i.managerName}`,icon:(0,q.jsx)(L,{name:`UserRound`,className:`size-3.5 shrink-0`,"aria-hidden":`true`}),label:null,isExpanded:h,onToggle:()=>s(`managedBy`)}):null,d&&a?(0,q.jsx)(co,{id:ro.managerChildren.toggle,controlsId:ro.managerChildren.body,icon:(0,q.jsx)(L,{name:`CircleDashed`,className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":`true`}),label:`${a.items.length} active managed ${a.items.length===1?`thread`:`threads`}`,isExpanded:g,onToggle:()=>s(`managerChildren`)}):null,c?(0,q.jsx)(co,{id:ro.todos.toggle,controlsId:ro.todos.body,icon:(0,q.jsx)(L,{name:`ListTodo`,className:`size-3.5 shrink-0`,"aria-hidden":`true`}),label:oo(f),isExpanded:p,onToggle:()=>s(`todos`)}):null,l&&_?(0,q.jsx)(co,{id:ro.git.toggle,controlsId:ro.git.body,icon:(0,q.jsx)(L,{name:`FileDiff`,className:`size-3.5 shrink-0`,"aria-hidden":`true`}),label:_,isExpanded:m,onToggle:()=>s(`git`)}):null,l&&t.mergeBase?(0,q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground/90`,children:[(0,q.jsx)(`span`,{className:`shrink-0`,children:`Merge base:`}),(0,q.jsx)(Xn,{value:t.mergeBase.branch,options:v,variant:`minimal`,loading:t.mergeBase.optionsLoading,onChange:t.mergeBase.onChange,onOpenChange:t.mergeBase.onPickerOpenChange,className:`max-w-[10rem]`,muted:!0,popoverAlign:`end`})]}):null]}),u&&i&&!y?(0,q.jsx)(mo,{id:ro.managedBy.body,labelledBy:ro.managedBy.toggle,isExpanded:h,children:(0,q.jsx)(fo,{managerName:i.managerName,href:i.href})}):null,d&&a?(0,q.jsx)(mo,{id:ro.managerChildren.body,labelledBy:ro.managerChildren.toggle,isExpanded:g,children:(0,q.jsx)(po,{items:a.items})}):null,c?(0,q.jsx)(mo,{id:ro.todos.body,labelledBy:ro.todos.toggle,isExpanded:p,children:(0,q.jsx)(uo,{items:f})}):null,l?(0,q.jsx)(mo,{id:ro.git.body,labelledBy:ro.git.toggle,isExpanded:m,children:(0,q.jsx)(Ei,{files:t.changedFiles.files,className:`max-h-32 px-3 pb-2 pt-1`,onFileClick:e=>t.onPromptBannerFileClick({file:e,section:t.changedFiles})})}):null]})}var go=220;function _o(e){let t=e.trim();return t.length===0?`Attachment`:Vt(t)}function vo(e){let t=0;for(let n of e)(n.type===`localImage`||n.type===`localFile`)&&(t+=1);return t}function yo(e){let t=e.filter(e=>e.type===`text`).map(e=>e.text.trim()).filter(e=>e.length>0).join(`
1
+ import{Br as e,Bt as t,Gn as n,Gr as r,Gt as i,Hi as a,Hr as o,Ht as s,I as c,In as l,Jn as u,Ki as d,Kn as f,Lr as p,M as m,P as h,Pt as g,R as _,Rr as v,Tr as y,Tt as b,Un as x,Ur as S,Ut as C,Vi as w,Vn as T,Vr as E,Vt as D,Wn as O,Wt as k,Yn as A,Yr as j,_i as M,ai as N,bn as P,bt as F,ii as I,j as ee,kn as te,kt as ne,mn as re,n as ie,ni as L,ri as R,t as z,tn as ae,vi as oe,vr as se,wr as ce,wt as le,xn as ue,yn as de,z as fe}from"./page-shell-Dglk9LmR.js";import{Nt as pe,Pt as me,c as he,d as ge,ht as _e,i as B,l as ve,o as ye,p as V,t as be,xt as H}from"./effective-hosts-ps3WYS_d.js";import{C as xe,S as Se,_ as Ce,a as we,b as Te,c as Ee,d as De,f as Oe,g as ke,h as Ae,i as je,l as Me,m as Ne,o as Pe,p as Fe,r as Ie,s as Le,t as Re,u as ze,w as Be}from"./thread-queries-BOTfj5Vv.js";import{c as Ve,d as He,f as Ue,i as We,l as Ge,m as Ke,r as qe,t as Je}from"./pill-DYYeHA29.js";import{a as Ye,g as Xe,h as Ze,i as U,o as W,r as Qe,s as $e,t as et,u as tt,v as G,y as nt}from"./dialog-CaQY-B8P.js";import{A as rt,O as it,S as at,_ as ot,a as st,b as ct,g as lt,h as ut,k as dt,m as ft,p as pt,t as mt,v as ht,y as gt}from"./localhost-badge-C9iEqET9.js";import{f as _t,v as vt,y as yt}from"./mutation-cache-effects-BQHFwGL7.js";import{$ as bt,$t as xt,A as St,At as Ct,B as wt,Ct as Tt,D as Et,Dt,E as Ot,Et as kt,F as At,Ft as jt,G as Mt,Gt as Nt,H as Pt,Ht as Ft,I as It,It as Lt,J as Rt,Jt as zt,K as Bt,Kt as Vt,L as Ht,Lt as Ut,M as Wt,Mt as Gt,N as Kt,O as qt,Ot as Jt,P as Yt,Pt as Xt,Q as Zt,Qt,R as $t,S as en,St as tn,T as nn,Tt as rn,U as an,Ut as on,V as sn,Vt as cn,W as ln,Wt as un,X as dn,Y as fn,Yt as pn,Z as mn,Zt as hn,_ as gn,_t as _n,a as vn,an as yn,at as bn,b as xn,bt as Sn,c as Cn,ct as wn,d as Tn,dt as En,et as Dn,f as On,ft as kn,g as An,gt as jn,h as Mn,ht as Nn,i as Pn,it as Fn,j as In,jt as Ln,k as Rn,kt as zn,l as Bn,ln as Vn,lt as Hn,m as Un,mt as Wn,n as Gn,nt as Kn,o as qn,on as Jn,ot as Yn,p as Xn,pt as Zn,q as Qn,qt as $n,r as er,rt as tr,s as nr,st as rr,t as ir,tt as ar,u as or,un as sr,ut as cr,v as lr,vt as ur,w as dr,wt as fr,x as pr,xt as mr,y as hr,yt as gr,z as _r,zt as vr}from"./index-B8UIxEOk.js";import{t as yr}from"./split-button-2v1ePK2A.js";import{t as br}from"./ThreadUnarchiveButton-EqnpnszW.js";var K=d(w(),1);function xr(e,t){return rt((0,K.useMemo)(()=>nt(null,(t,n,...r)=>e(t,n,...r)),[e]),t)}var Sr=class{highlighter;renderCache;computedLang=`text`;lineAnnotations={};constructor(e={theme:Ct},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=gr(e.theme??Ct)?mr():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??`system`)!==e&&this.mergeOptions({themeType:e})}setLineAnnotations(e){this.lineAnnotations={};for(let t of e){let e=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=e,e.push(t)}}cleanUp(){this.renderCache=void 0,this.highlighter=void 0,this.workerManager=void 0,this.onRenderUpdate=void 0}hydrate(e){let{options:t}=this.getRenderOptions(e),n=this.workerManager?.getFileResultCache(e);n!=null&&!Cr(t,n.options)&&(n=void 0),this.renderCache??={file:e,options:t,highlighted:!0,result:n?.result},this.workerManager?.isWorkingPool()===!0&&this.renderCache.result==null?this.workerManager.highlightFileAST(this,e):this.asyncHighlight(e).then(({result:t,options:n})=>{this.onHighlightSuccess(e,t,n)})}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getFileRenderOptions();let{theme:e=Ct,tokenizeMaxLineLength:t=1e3}=this.options;return{theme:e,tokenizeMaxLineLength:t}})(),{renderCache:n}=this;return n?.result==null||e!==n.file||!Cr(t,n.options)?{options:t,forceRender:!0}:{options:t,forceRender:!1}}renderFile(e=this.renderCache?.file){if(e==null)return;let t=this.workerManager?.getFileResultCache(e);t!=null&&this.renderCache==null&&(this.renderCache={file:e,highlighted:!0,...t});let{options:n,forceRender:r}=this.getRenderOptions(e);if(this.renderCache??={file:e,highlighted:!1,options:n,result:void 0},this.workerManager?.isWorkingPool()===!0)this.renderCache.result??=this.workerManager.getPlainFileAST(e),(!this.renderCache.highlighted||r)&&this.workerManager.highlightFileAST(this,e);else{this.computedLang=e.lang??kn(e.name);let t=this.highlighter!=null&&gr(n.theme),i=this.highlighter!=null&&fr(this.computedLang);if(this.highlighter!=null&&t&&(r||!this.renderCache.highlighted&&i||this.renderCache.result==null)){let{result:t,options:n}=this.renderFileWithHighlighter(e,this.highlighter,!i);this.renderCache={file:e,options:n,highlighted:i,result:t}}(!t||!i)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.onHighlightSuccess(e,t,n)})}return this.renderCache.result==null?void 0:this.processFileResult(this.renderCache.file,this.renderCache.result)}async asyncRender(e){let{result:t}=await this.asyncHighlight(e);return this.processFileResult(e,t)}async asyncHighlight(e){this.computedLang=e.lang??kn(e.name);let t=this.highlighter!=null&&ur(Sn(this.options.theme)),n=this.highlighter!=null&&fr(this.computedLang);return(this.highlighter==null||!t||!n)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter)}renderFileWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e);return{result:Hn(e,t,r,n),options:r}}processFileResult(e,t){let{disableFileHeader:n=!1}=this.options,r=[],i=1;for(let e of t.code){r.push(e);let t=this.lineAnnotations[i];t!=null&&r.push(Nn({type:`annotation`,hunkIndex:0,lineIndex:i,annotations:t.map(e=>cr(e))})),i++}return{codeAST:r,preAST:this.createPreElement(t.code.length,t.themeStyles,t.baseThemeType),headerAST:n?void 0:this.renderHeader(e,t.themeStyles,t.baseThemeType),totalLines:t.code.length,themeStyles:t.themeStyles,baseThemeType:t.baseThemeType,css:``}}renderHeader(e,t,n){let{themeType:r=`system`}=this.options;return Wn({fileOrDiff:e,themeStyles:t,themeType:n??r})}renderFullHTML(e){return Tt(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(jn({tagName:`code`,children:e.codeAST,properties:{"data-code":``}})),{...e.preAST,children:t}}renderPartialHTML(e,t=!1){return Tt(t?jn({tagName:`code`,children:e,properties:{"data-code":``}}):e)}async initializeHighlighter(){return this.highlighter=await tn(En(this.computedLang,this.options)),this.highlighter}onHighlightSuccess(e,t,n){if(this.renderCache==null)return;let r=this.renderCache.file!==e||!this.renderCache.highlighted||!Cr(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:!0,result:t},r&&this.onRenderUpdate?.()}onHighlightError(e){console.error(e)}createPreElement(e,t,n){let{disableLineNumbers:r=!1,overflow:i=`scroll`,themeType:a=`system`}=this.options;return Zn({diffIndicators:`none`,disableBackground:!0,disableLineNumbers:r,overflow:i,themeStyles:t,themeType:n??a,split:!1,totalLines:e})}};function Cr(e,t){return _n(e.theme,t.theme)&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}var wr=-1,Tr=class{static LoadedCustomComponent=!0;__id=++wr;fileContainer;spriteSVG;pre;code;unsafeCSSStyle;hoverContent;errorWrapper;headerElement;headerMetadata;fileRenderer;resizeManager;mouseEventManager;lineSelectionManager;annotationElements=[];lineAnnotations=[];file;constructor(e={theme:Ct},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.fileRenderer=new Sr(e,this.handleHighlightRender,this.workerManager),this.resizeManager=new rn,this.mouseEventManager=new kt(`file`,Dt(e)),this.lineSelectionManager=new Jt(zn(e)),this.workerManager?.subscribeToThemeChanges(this)}handleHighlightRender=()=>{this.rerender()};rerender(){this.file!=null&&this.render({file:this.file,forceRender:!0})}setOptions(e){e!=null&&(this.options=e,this.mouseEventManager.setOptions(Dt(e)),this.lineSelectionManager.setOptions(zn(e)))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){if((this.options.themeType??`system`)!==e&&(this.mergeOptions({themeType:e}),this.fileRenderer.setThemeType(e),this.headerElement!=null&&(e===`system`?delete this.headerElement.dataset.themeType:this.headerElement.dataset.themeType=e),this.pre!=null))switch(e){case`system`:delete this.pre.dataset.themeType;break;case`light`:case`dark`:this.pre.dataset.themeType=e;break}}getHoveredLine=()=>this.mouseEventManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}setSelectedLines(e){this.lineSelectionManager.setSelection(e)}cleanUp(){this.fileRenderer.cleanUp(),this.resizeManager.cleanUp(),this.mouseEventManager.cleanUp(),this.lineSelectionManager.cleanUp(),this.workerManager?.unsubscribeToThemeChanges(this),this.workerManager=void 0,this.file=void 0,this.isContainerManaged||this.fileContainer?.parentNode?.removeChild(this.fileContainer),this.fileContainer?.shadowRoot!=null&&(this.fileContainer.shadowRoot.innerHTML=``),this.fileContainer=void 0,this.pre=void 0,this.headerElement=void 0,this.errorWrapper=void 0,this.unsafeCSSStyle=void 0}hydrate(e){let{fileContainer:t,prerenderedHTML:n}=e;ar(t,n);for(let e of Array.from(t.shadowRoot?.children??[])){if(e instanceof SVGElement){this.spriteSVG=e;continue}if(e instanceof HTMLElement){if(e instanceof HTMLPreElement){this.pre=e;continue}if(e instanceof HTMLStyleElement&&e.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=e;continue}if(`diffsHeader`in e.dataset){this.headerElement=e;continue}}}if(this.pre==null)this.render(e);else{let{file:n,lineAnnotations:r}=e;this.fileContainer=t,delete this.pre.dataset.dehydrated,this.lineAnnotations=r??this.lineAnnotations,this.file=n,this.fileRenderer.hydrate(n),this.renderAnnotations(),this.renderHoverUtility(),this.injectUnsafeCSS(),this.mouseEventManager.setup(this.pre),this.lineSelectionManager.setup(this.pre),(this.options.overflow??`scroll`)===`scroll`&&this.resizeManager.setup(this.pre)}}render({file:e,fileContainer:t,forceRender:n=!1,containerWrapper:r,lineAnnotations:i}){let a=i!=null&&(i.length>0||this.lineAnnotations.length>0)?i!==this.lineAnnotations:!1;if(!n&&rr(this.file,e)&&!a)return;this.file=e,this.fileRenderer.setOptions(this.options),i!=null&&this.setLineAnnotations(i),this.fileRenderer.setLineAnnotations(this.lineAnnotations);let{disableFileHeader:o=!1,disableErrorHandling:s=!1}=this.options;o&&this.headerElement!=null&&(this.headerElement.parentNode?.removeChild(this.headerElement),this.headerElement=void 0),t=this.getOrCreateFileContainerNode(t,r);try{let n=this.fileRenderer.renderFile(e);if(n==null){this.workerManager!=null&&!this.workerManager.isInitialized()&&this.workerManager.initialize().then(()=>this.rerender());return}n.headerAST!=null&&this.applyHeaderToDOM(n.headerAST,t);let r=this.getOrCreatePreNode(t);this.applyHunksToDOM(n,r),this.renderAnnotations(),this.renderHoverUtility()}catch(e){if(s)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,t)}}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null)return;for(let e of this.annotationElements)e.parentNode?.removeChild(e);this.annotationElements.length=0;let{renderAnnotation:e}=this.options;if(e!=null&&this.lineAnnotations.length>0)for(let t of this.lineAnnotations){let n=e(t);if(n==null)continue;let r=Yn(cr(t));r.appendChild(n),this.annotationElements.push(r),this.fileContainer.appendChild(r)}}renderHoverUtility(){let{renderHoverUtility:e}=this.options;if(this.fileContainer==null||e==null)return;this.hoverContent??(this.hoverContent=Fn(),this.fileContainer.appendChild(this.hoverContent));let t=e(this.mouseEventManager.getHoveredLine);this.hoverContent.innerHTML=``,t!=null&&this.hoverContent.appendChild(t)}injectUnsafeCSS(){if(this.fileContainer?.shadowRoot==null)return;let{unsafeCSS:e}=this.options;if(e==null||e===``){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.parentNode?.removeChild(this.unsafeCSSStyle),this.unsafeCSSStyle=void 0);return}this.unsafeCSSStyle??(this.unsafeCSSStyle=tr(),this.fileContainer.shadowRoot.appendChild(this.unsafeCSSStyle)),this.unsafeCSSStyle.innerText=Kn(e)}applyHunksToDOM(e,t){this.cleanupErrorWrapper(),this.applyPreNodeAttributes(t,e),t.innerHTML=``,this.code=bn(),this.code.innerHTML=this.fileRenderer.renderPartialHTML(e.codeAST),t.appendChild(this.code),this.injectUnsafeCSS(),this.mouseEventManager.setup(t),this.lineSelectionManager.setup(t),this.lineSelectionManager.setDirty(),(this.options.overflow??`scroll`)===`scroll`?this.resizeManager.setup(t):this.resizeManager.cleanUp()}applyHeaderToDOM(e,t){let{file:n}=this;if(n==null)return;this.cleanupErrorWrapper();let r=document.createElement(`div`);r.innerHTML=Tt(e);let i=r.firstElementChild;if(!(i instanceof HTMLElement)||(this.headerElement==null?t.shadowRoot?.prepend(i):t.shadowRoot?.replaceChild(i,this.headerElement),this.headerElement=i,this.isContainerManaged))return;let{renderCustomMetadata:a}=this.options;this.headerMetadata!=null&&this.headerMetadata.parentNode?.removeChild(this.headerMetadata);let o=a?.(n)??void 0;o!=null&&(this.headerMetadata=document.createElement(`div`),this.headerMetadata.slot=Gt,o instanceof Element?this.headerMetadata.appendChild(o):this.headerMetadata.innerText=`${o}`,t.appendChild(this.headerMetadata))}getOrCreateFileContainerNode(e,t){if(this.fileContainer=e??this.fileContainer??document.createElement(`diffs-container`),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=wn;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t,this.fileContainer.shadowRoot?.appendChild(this.spriteSVG))}return this.fileContainer}getOrCreatePreNode(e){return this.pre==null?(this.pre=document.createElement(`pre`),e.shadowRoot?.appendChild(this.pre)):this.pre.parentNode!==e&&e.shadowRoot?.appendChild(this.pre),this.pre}applyPreNodeAttributes(e,{totalLines:t,themeStyles:n,baseThemeType:r}){let{overflow:i=`scroll`,themeType:a=`system`,disableLineNumbers:o=!1}=this.options;Dn({pre:e,split:!1,themeStyles:n,overflow:i,disableLineNumbers:o,themeType:r??a,diffIndicators:`none`,disableBackground:!0,totalLines:t})}applyErrorToDOM(e,t){this.cleanupErrorWrapper();let n=this.getOrCreatePreNode(t);n.innerHTML=``,n.parentNode?.removeChild(n),this.pre=void 0;let r=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.innerHTML=``,r.appendChild(this.errorWrapper);let i=document.createElement(`div`);i.dataset.errorMessage=``,i.innerText=e.message,this.errorWrapper.appendChild(i);let a=document.createElement(`pre`);a.dataset.errorStack=``,a.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(a)}cleanupErrorWrapper(){this.errorWrapper?.parentNode?.removeChild(this.errorWrapper),this.errorWrapper=void 0}},q=oe();function Er({file:e,renderHeaderMetadata:t,renderAnnotation:n,lineAnnotations:r,renderHoverUtility:i,getHoveredLine:a}){let o=t?.(e);return(0,q.jsxs)(q.Fragment,{children:[o!=null&&(0,q.jsx)(`div`,{slot:`header-metadata`,children:o}),n!=null&&r?.map((e,t)=>(0,q.jsx)(`div`,{slot:cr(e),children:n(e)},t)),i!=null&&(0,q.jsx)(`div`,{slot:`hover-slot`,style:Zt,children:i(a)})]})}var Dr=typeof window>`u`?K.useEffect:K.useLayoutEffect;function Or({file:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:i}){let a=(0,K.useContext)(fn),o=(0,K.useRef)(null),s=Rt(r=>{if(r!=null){if(o.current!=null)throw Error(`File: An instance should not already exist when a node is created`);o.current=new Tr(t,a,!0),o.current.hydrate({file:e,fileContainer:r,lineAnnotations:n,prerenderedHTML:i})}else{if(o.current==null)throw Error(`File: A File instance should exist when unmounting`);o.current.cleanUp(),o.current=null}});return Dr(()=>{if(o.current==null)return;let i=!bt(o.current.options,t);o.current.setOptions(t),o.current.render({file:e,lineAnnotations:n,forceRender:i}),r!==void 0&&o.current.setSelectedLines(r)}),{ref:s,getHoveredLine:(0,K.useCallback)(()=>o.current?.getHoveredLine(),[])}}function kr({file:e,lineAnnotations:t,selectedLines:n,options:r,className:i,style:a,renderAnnotation:o,renderHeaderMetadata:s,prerenderedHTML:c,renderHoverUtility:l}){let{ref:u,getHoveredLine:d}=Or({file:e,options:r,lineAnnotations:t,selectedLines:n,prerenderedHTML:c});return(0,q.jsx)(Ln,{ref:u,className:i,style:a,children:mn(Er({file:e,renderAnnotation:o,renderHeaderMetadata:s,renderHoverUtility:l,lineAnnotations:t,getHoveredLine:d}),c)})}var Ar=8,jr=1;function Mr(){let e=typeof navigator<`u`?navigator.hardwareConcurrency:void 0;return e===void 0||e<=2?jr:Math.max(jr,Math.min(Ar,e-1))}function Nr(){return new Worker(new URL(`/assets/worker-portable-CA4_6zkQ.js`,``+import.meta.url),{name:`pierre-diffs-worker`})}var Pr=`bb.thread.terminalPanelState`,Fr=336*60*60*1e3,Ir=S({version:E(1),isOpen:v(),activeTerminalId:r().min(1).nullable(),panelHeightPercent:o().int().min(18).max(70),lastUsedAt:o().int().nonnegative()}).strict();function Lr(){return typeof window>`u`?null:window.localStorage}function Rr(e){return encodeURIComponent(e.trim())}function zr(e={}){return{version:1,isOpen:e.isOpen??!1,activeTerminalId:e.activeTerminalId??null,panelHeightPercent:e.panelHeightPercent??32,lastUsedAt:e.lastUsedAt??0}}var Br=zr();function Vr({threadId:e}){return`${Pr}-${Rr(e)}-1`}function Hr(e){return e.startsWith(`bb.thread.terminalPanelState-`)&&e.endsWith(`-1`)}function Ur({now:e,state:t}){return e-t.lastUsedAt>Fr}function Wr({initialValue:e,now:t,storedValue:n}){return Gr({initialValue:e,now:t,storedValue:n}).state}function Gr({initialValue:e,now:t,storedValue:n}){if(n===null)return{shouldPrune:!1,state:e};let r;try{r=JSON.parse(n)}catch{return{shouldPrune:!0,state:e}}let i=Ir.safeParse(r);return!i.success||Ur({now:t,state:i.data})?{shouldPrune:!0,state:e}:{shouldPrune:!1,state:i.data}}function Kr({state:e}){return JSON.stringify(e)}function qr({now:e}){let t=Lr();if(!t)return;let n=[];for(let e=0;e<t.length;e+=1){let r=t.key(e);r&&Hr(r)&&n.push(r)}for(let r of n)Gr({initialValue:Br,now:e,storedValue:t.getItem(r)}).shouldPrune&&t.removeItem(r)}function Jr(e){return e!=null&&e.length>0}function Yr(e,t){return{...e,lastUsedAt:t}}var Xr=tt({parse:(e,t)=>Wr({initialValue:t,now:Date.now(),storedValue:e}),serialize:e=>Kr({state:e})}),Zr=nt(Br),Qr=Ze(e=>G(Vr({threadId:e}),Br,Xr,{getOnInit:!0}));function $r(e){return Jr(e)?Qr(e):Zr}function ei(e){return t=>t.isOpen===e?t:{...t,isOpen:e}}function ti(e){(0,K.useEffect)(()=>{qr({now:Date.now()})},[e])}function ni(e){return dt($r(e))}function ri(e){let t=rt($r(e));return(0,K.useCallback)(n=>{if(!Jr(e))return;let r=Date.now();t(e=>{let t=n(e);return t===e?e:Yr(t,r)})},[t,e])}function ii(e){let t=ri(e);return(0,K.useCallback)(e=>{t(ei(e))},[t])}function ai(e){let t=ri(e);return(0,K.useCallback)(()=>{t(e=>({...e,isOpen:!e.isOpen}))},[t])}function oi(){let e=M();return I({meta:{errorMessage:`Failed to run environment action.`,showErrorToast:!1},mutationFn:({id:e,...t})=>P(e,t),onSuccess:(t,n)=>{vt({environmentId:n.id,queryClient:e})}})}function si(){let e=M();return I({meta:{errorMessage:`Failed to update environment.`,showErrorToast:!1},mutationFn:({id:e,...t})=>te(e,t),onSuccess:t=>{e.setQueryData(_(t.id),t),yt({environmentId:t.id,queryClient:e})}})}var ci=1e4,li=3e4;function ui(e,t){if(!e)throw Error(`${t}: environmentId is required when query is enabled`);return e}function di(e){if(!e)throw Error(`useEnvironmentFilePreview: path is required when query is enabled`);return e}function fi(e){if(!e)throw Error(`useEnvironmentFilePreview: source is required when query is enabled`);return e}function pi(e){if(!e)throw Error(`useEnvironmentGitDiff: target is required when query is enabled`);return e}function mi(e,n){return N({queryKey:_(e),queryFn:()=>t(ui(e,`useEnvironment`)),enabled:(n?.enabled??!0)&&!!e,staleTime:n?.staleTime})}function hi(e,t,n){return N({queryKey:fe(e,t??null),queryFn:()=>i(ui(e,`useEnvironmentWorkStatus`),t),enabled:(n?.enabled??!0)&&!!e,refetchOnWindowFocus:!1,staleTime:ci,placeholderData:(t,n)=>e?Ce(t,n?.queryKey,e):void 0})}function gi(e,t){return N({queryKey:c(e),queryFn:()=>s(e),enabled:(t?.enabled??!0)&&!!e,refetchOnWindowFocus:!1,staleTime:li})}function _i(e,t,n,r){return N({queryKey:m(e,t,n),queryFn:({signal:r})=>k({id:ui(e,`useEnvironmentFilePreview`),path:di(t),source:fi(n),signal:r}),enabled:(r?.enabled??!0)&&!!e&&!!t&&n!==null,refetchOnWindowFocus:!1})}function vi(e,t){let n=t.target,r=n?.type===`commit`?n.sha:n?.type===`all`||n?.type===`branch_committed`?n.mergeBaseBranch:null;return N({queryKey:h(e,n?.type??null,r),queryFn:()=>D(e,pi(n)),enabled:(t.enabled??!0)&&!!e&&n!==void 0,placeholderData:(t,n)=>ke(t,n?.queryKey,e),refetchOnWindowFocus:!1,staleTime:5e3})}function yi(e){return{filesCount:e.files.length,insertions:e.insertions,deletions:e.deletions}}function bi(e){return`${e} file${e===1?``:`s`}`}function xi(e){if(e.filesCount===0&&e.insertions===0&&e.deletions===0)return`No changes`;let t=bi(e.filesCount);return e.insertions===0&&e.deletions===0?t:`${t}, ${Nt({added:e.insertions,removed:e.deletions})}`}function Si(e){if(e.filesCount===0&&e.insertions===0&&e.deletions===0)return`No changes`;let t=bi(e.filesCount);return e.insertions===0&&e.deletions===0?t:(0,q.jsxs)(q.Fragment,{children:[t,`,`,` `,(0,q.jsx)(Lt,{insertions:e.insertions,deletions:e.deletions})]})}function Ci(e){if(!e)return[];let t=[],n=e.workingTree;if(n.files.length>0){let e=n.state===`untracked`;t.push({kind:e?`untracked`:`uncommitted`,label:e?`Untracked`:`Uncommitted`,files:n.files,mergeBaseRef:null,stats:n})}let r=e.mergeBase;return r&&r.files.length>0&&t.push({kind:`committed`,label:`Committed`,files:r.files,mergeBaseRef:r.baseRef,stats:r}),t}function wi(e){return Ci(e)[0]??null}function Ti(e){return e===`??`?`A?`:e}function Ei({files:e,className:t=`max-h-32`,emptyMessage:n=`No changed files detected.`,onFileClick:r}){return!e||e.length===0?(0,q.jsx)(Jn,{message:n}):(0,q.jsx)(`ul`,{className:R(`space-y-1 overflow-auto`,t),children:e.map(e=>(0,q.jsxs)(`li`,{className:`grid grid-cols-[1.5rem_minmax(0,1fr)_auto] items-start gap-x-3`,children:[(0,q.jsx)(`span`,{className:`text-xs leading-5 text-muted-foreground`,children:Ti(e.status)}),(0,q.jsx)(Mt,{path:e.path,onClick:r?()=>r(e):void 0}),e.insertions!==null&&e.deletions!==null?(0,q.jsx)(Lt,{insertions:e.insertions,deletions:e.deletions,hideZero:!0,className:`text-xs leading-5`}):null]},`${e.status}:${e.path}`))})}function Di({sections:e,onFileClick:t,listClassName:n,rowClassName:r,rowValueClassName:i}){let[a,o]=(0,K.useState)(null);if(e.length===0)return null;let s=e.find(e=>e.kind===a)??e[0],c=yi(s.stats),l=e.length>1,u=(0,q.jsx)(`span`,{className:`truncate text-muted-foreground`,children:Si(c)});return(0,q.jsx)(Wt,{label:l?(0,q.jsxs)(`span`,{className:`flex items-baseline gap-x-3`,children:[(0,q.jsx)(`span`,{className:`flex min-w-[var(--detail-label-width,96px)] items-baseline`,children:(0,q.jsxs)(B,{children:[(0,q.jsx)(ge,{asChild:!0,children:(0,q.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`h-5 w-auto min-w-0 justify-between gap-1 rounded-sm px-0 text-xs font-normal shadow-none hover:bg-transparent data-[state=open]:bg-transparent data-[state=open]:hover:bg-transparent`,title:s.label,"aria-label":`Switch changed files bucket`,children:[(0,q.jsx)(`span`,{className:`truncate`,children:s.label}),(0,q.jsx)(L,{name:`ChevronDown`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,q.jsx)(ye,{align:`start`,children:e.map(e=>(0,q.jsxs)(he,{onSelect:()=>o(e.kind),className:`flex items-center justify-between gap-2`,children:[(0,q.jsx)(`span`,{className:`truncate`,children:e.label}),(0,q.jsx)(L,{name:`Check`,className:R(`size-3.5 shrink-0`,e.kind===s.kind?`opacity-100`:`opacity-0`)})]},e.kind))})]})}),u]}):(0,q.jsxs)(`span`,{className:`flex items-baseline gap-x-3`,children:[(0,q.jsx)(`span`,{className:`min-w-[var(--detail-label-width,96px)] truncate`,children:s.label}),u]}),orientation:`vertical`,className:r,valueClassName:i,children:(0,q.jsx)(Ei,{files:s.files,className:n,onFileClick:t?e=>t({file:e,section:s}):void 0})})}function Oi(e){switch(e.kind){case`commit`:return{title:`Commit changes`,description:`Create a commit from the current workspace changes.`,submitLabel:`Commit changes`,showCommitControls:!0,showMergeBase:!1};case`commit_and_squash_merge`:return{title:`Commit and squash merge`,description:`Commit the current workspace changes, then squash merge this branch.`,submitLabel:`Commit + squash merge`,showCommitControls:!0,showMergeBase:!0};case`squash_merge`:return{title:`Squash merge`,description:`Squash merge this branch into the selected merge base.`,submitLabel:`Squash merge`,showCommitControls:!1,showMergeBase:!0};default:return f(e)}}function ki({target:e,branchName:t,gitStatusDisplay:n,changedFilesSection:r,threadId:i,threadType:a,showMergeBaseDetails:o=!1,mergeBaseBranch:s,mergeBaseBranchOptions:c,mergeBaseBranchOptionsLoading:l=!1,onMergeBaseBranchChange:u,onOpenChange:d,onCommit:f,onSquashMerge:p}){let m=(0,K.useMemo)(()=>e?Oi(e):null,[e]);return(0,q.jsx)(et,{open:e!==null,onOpenChange:d,children:(0,q.jsx)(Qe,{className:`max-w-[34rem] gap-0 overflow-hidden border-border bg-background p-0 shadow-xl`,children:e&&m?(0,q.jsx)(Ai,{target:e,branchName:t,gitStatusDisplay:n,changedFilesSection:r,threadId:i,threadType:a,showMergeBaseDetails:o,mergeBaseBranch:s,mergeBaseBranchOptions:c,mergeBaseBranchOptionsLoading:l,onMergeBaseBranchChange:u,onOpenChange:d,onCommit:f,onSquashMerge:p},e.kind):null})})}function Ai({target:e,branchName:t,gitStatusDisplay:n,changedFilesSection:r,threadId:i,threadType:a,showMergeBaseDetails:o,mergeBaseBranch:s,mergeBaseBranchOptions:c,mergeBaseBranchOptionsLoading:l,onMergeBaseBranchChange:u,onOpenChange:d,onCommit:p,onSquashMerge:m}){let[h,g]=(0,K.useState)(null),_=Oi(e),v=Un({mergeBaseBranch:s,mergeBaseBranchOptions:c}),y=s??v[0],b=_.showMergeBase&&o===!0&&!!u&&v.length>0,x=_.showMergeBase&&o===!0&&(b||!!y),S=!!(r&&r.files.length>0);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(W,{className:`px-6 pt-5 pb-3`,children:[(0,q.jsx)($e,{children:_.title}),(0,q.jsx)(U,{children:_.description})]}),(0,q.jsxs)(`form`,{className:`space-y-5 px-6 pt-3 pb-5`,onSubmit:t=>{switch(t.preventDefault(),g(null),e.kind){case`commit`:d(!1),p();break;case`commit_and_squash_merge`:if(!y){g(`A merge base branch is required`);return}d(!1),m({mergeBaseBranch:y});break;case`squash_merge`:if(!y){g(`A merge base branch is required`);return}d(!1),m({mergeBaseBranch:y});break;default:f(e)}},children:[t||n||x||S?(0,q.jsxs)(In,{className:`border-border bg-surface-recessed`,children:[t?(0,q.jsx)(Wt,{label:`Branch`,valueClassName:`min-w-0 truncate`,children:(0,q.jsx)(`span`,{className:`block truncate`,title:t,children:t})}):null,n?(0,q.jsx)(Wt,{label:`Git status`,valueClassName:`min-w-0`,children:(0,q.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2 whitespace-nowrap`,title:`${n.label} ${n.summary}`.trim(),children:[(0,q.jsx)(`span`,{className:`shrink-0 font-medium`,children:n.label}),(0,q.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:n.summaryContent})]})}):null,x&&y?(0,q.jsx)(Wt,{label:`Merge base`,valueClassName:`min-w-0`,children:b?(0,q.jsx)(Xn,{value:y,options:v,loading:l,onChange:e=>u?.(e),className:`max-w-full`}):(0,q.jsx)(`span`,{className:`block truncate`,title:y,children:y})}):null,S&&r?(0,q.jsx)(Di,{sections:[r],rowValueClassName:`pt-0.5`,listClassName:`max-h-40`}):null]}):null,(0,q.jsx)(Gn,{message:h}),(0,q.jsx)(Ye,{children:(0,q.jsx)(j,{type:`submit`,disabled:_.showMergeBase&&!y,children:_.submitLabel})})]})]})}var ji={vscode:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAeGVYSWZNTQAqAAAACAAEARoABQAAAAEAAAA+ARsABQAAAAEAAABGASgAAwAAAAEAAgAAh2kABAAAAAEAAABOAAAAAAAAAJAAAAABAAAAkAAAAAEAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAQKADAAQAAAABAAAAQAAAAACU3PoRAAAACXBIWXMAABYlAAAWJQFJUiTwAAABzWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS4wLyI+CiAgICAgICAgIDxleGlmOkNvbG9yU3BhY2U+MTwvZXhpZjpDb2xvclNwYWNlPgogICAgICAgICA8ZXhpZjpQaXhlbFhEaW1lbnNpb24+MTAyNDwvZXhpZjpQaXhlbFhEaW1lbnNpb24+CiAgICAgICAgIDxleGlmOlBpeGVsWURpbWVuc2lvbj4xMDI0PC9leGlmOlBpeGVsWURpbWVuc2lvbj4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CsHtO6kAA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8etq65KVAAybiS4M8C973uZwCm2UJ1irV3iL0JEXj6qmnggG50dySchrdfH4cWKsuqL8c1L0DnbZ5s1IBHTCh3PqRV1R3g5F4r25wKOdh+Rf2vklcMBTfYIHvcNhcYBHur5pMta3wxHWid/CKh8FI/EzrFdWt09HXBAB6QOxTnBojlbNobmZ96LlpMss/J7/ZUZzhHVHciwUWvQXPr40osRAiYESAyUGvt0M/Bfz0vXwaPGzHAAAAABJRU5ErkJggg==`,"sublime-text":`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAeGVYSWZNTQAqAAAACAAEARoABQAAAAEAAAA+ARsABQAAAAEAAABGASgAAwAAAAEAAgAAh2kABAAAAAEAAABOAAAAAAAAAJAAAAABAAAAkAAAAAEAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAQKADAAQAAAABAAAAQAAAAACU3PoRAAAACXBIWXMAABYlAAAWJQFJUiTwAAABzWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS4wLyI+CiAgICAgICAgIDxleGlmOkNvbG9yU3BhY2U+MTwvZXhpZjpDb2xvclNwYWNlPgogICAgICAgICA8ZXhpZjpQaXhlbFhEaW1lbnNpb24+MTAyNDwvZXhpZjpQaXhlbFhEaW1lbnNpb24+CiAgICAgICAgIDxleGlmOlBpeGVsWUR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z+JkJfwXqmig73ZZH3yq+d47MRuV6qtOY0/dn2iRbDBvLH5VuCrK3RVtXyltrpAdgEzS3vLw8qqOkBeDevXvprq6uO/iJwPesaPOZhK2JSxIVnsIXm38/46EnJoslRm4Cs/5m1zrueT+bANwfGhpK6XhpAcCASqFQ+Ec4HF4HAAlZAeE7j8D/etIjlRGfqXR1XeQ2pym77niCDv8EU/M7/Eb2nK3aNDMzcwm/r3mGHxho+7CBCtK9eYfPW1vrVxvXgc+xkdaH7JMTExN/c2PjqtnDhw+f5XK5d90IvKhtBGBxcfG9J0+ejLjJuBrhdZ1SqdSXyWSyPxKJHLO7vm7MN12PwE3l379+/fo7kMW8enKWqi4AGFbG724/RkDsAwhHncm8GLW0OqcrvPbS3bt3f4nlb66eZF4AII3l8fHxj2Kx2AKC4quhUIj/Z6Ae7R1pV0pTcfyybXJ2dvaPN2/efAfKZ7wI0KgWfkyHY729vT9paWn5AZbI/RCgncx3GhBOR2as81ko/mhpaemj0dHRv2cymRtQHPtOb6lRABRVBs893d3d++AV/fCIJMBoBQgRZHoV6W6WtuJhL43dE5TmIS0PxXP5fH4K7v40nU4z0E0iaw89dmLqfbuF3G56Sk57aYBhr9x930VgF4FdBHYRaBCB/wHWGEMSa+r9eQAAAABJRU5ErkJggg==`,zed:`/assets/zed-C-eVD5h3.png`,windsurf:`/assets/windsurf-Do5nbXdF.png`,antigravity:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAHhlWElmTU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAIdpAAQAAAABAAAATgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAECgAwAEAAAAAQAAAEAAAAAAdd52hwAAAAlwSFlzAAALEwAACxMBAJqcGAAADB1JREFUeAHtW2tsZFUd/537mPdM37vtbtvtdt0HdlnA1/IUgyhoDIoJYjZE+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FKPlZQufmYSBcMKdQbDg4PbB2p/p6zsWm8zOrtker52KNOTA0IqgurpxPT82wvswjMIvClQeB/QMMm6ZCwrokAAAAASUVORK5CYII=`,iterm2:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAeGVYSWZNTQAqAAAACAAEARoABQAAAAEAAAA+ARsABQAAAAEAAABGASgAAwAAAAEAAgAAh2kABAAAAAEAAABOAAAAAAAAAJAAAAABAAAAkAAAAAEAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAQKADAAQAAAABAAAAQAAAAACU3PoRAAAACXBIWXMAABYlAAAWJQFJUiTwAAABnWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS4wLyI+CiAgICAgICAgIDxleGlmOlBpeGVsWERpbWVuc2lvbj4yNTY8L2V4aWY6UGl4ZWxYRGltZW5zaW9uPgogICAgICAgICA8ZXhpZjpQaXhlbFlEaW1lbnNpb24+MjU2PC9leGlmOlBpeGVsWURpbWVuc2lvbj4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+Cl6wHhsAAAuWSURBVHgB7Vvrb1THFT/3uXt3ba/tXWObABGkgiYlD1UVUQRSkfqQWjVITatKadS0/Antl0RVW0BKP/ClUpFKq6B8aNqQF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/nRtDcejYtftmIICbdqf+kbATPfFYfJdhGVQq4N4NvhlwYCBWS+CBMU3cVkv10dPP7qS+Df1H33znVz8Hf+wErRgAblieXJi8ABBiMSe+K+JExEdTcS2+cmwuYXjUYKjTRWgkX5aOR2nosSF66pnPsPC/+M17vz6EKz6zzD+e0LBUrnlD3f1Ecvu3e7t6foArJ1uLuD/E9/DyuIrGW2e+isJ3+mVQcWi/dS9a164vVTlmmDWPnTQTXl6sK0b9UPmhjcOw+4F/lwz/Z28df/M4qrHzw7c82oalAsBE2Gmyu+y+bVuSwy/GnNiXdMP4NHaM/X7ZizAAfIDCO8gAiLZ9i5eYpYXdVjYtQjAWjs/zNREjjREG6KKeCTNkwXEDFFfjI3ncCp+OxKIjRa/0l8ujH/3p0qVL/wJh9tyW9J8YlgMAM8z1GQh+ujf0bRhKOIlB07CTlml04QweVya1KFTyvnML2osgRjKCb0lmhGzeuIg0PrcjrXPe4u2sSQbsG3XL2Jrk8IHFLZVL827ZnRq/M34HV/nZ0eERZ6H5UQqDZPuwXAAUNW7HKwg/igbHtWlkOx6UYBzXpnm7y48q63jH6wTXEVhHYB2B/0kE/gviOG5RK/1x9AAAAABJRU5ErkJggg==`,ghostty:`/assets/ghostty-D5T950Nz.png`,xcode:`/assets/xcode-BOSzsT4U.png`};function Mi({target:e,className:t=`size-4`}){return(0,q.jsx)(`img`,{alt:``,className:`${t} shrink-0 rounded-[3px]`,draggable:!1,src:ji[e.id]})}function Ni({onOpenPreferredTarget:e,onOpenTarget:t,preferredTarget:n,targets:r}){let[i,a]=(0,K.useState)(null),o=i!==null,s=(0,K.useCallback)(async(e,t)=>{if(i===null){a(e.id);try{await t()}finally{a(null)}}},[i]);return n?(0,q.jsx)(yr,{disabled:o,className:`px-1`,primaryAction:{label:`Open workspace in ${n.label}`,onSelect:()=>{s(n,e)},content:(0,q.jsx)(Mi,{target:n,className:`size-5`})},secondaryActions:r.map(e=>({label:e.label,onSelect:()=>{s(e,()=>t(e.id))},content:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mi,{target:e,className:`size-5`}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1`,children:e.label})]})})),triggerLabel:`Choose workspace open target`,mobileTitle:`Open Workspace`}):null}var Pi=nt(null),Fi=nt(null),Ii=nt([]);function Li(e){let t=dt(e.enabled?lt:Pi),n=dt(e.enabled?ut:Fi),r=dt(e.enabled?ot:Ii);return{openWorkspace:(0,K.useMemo)(()=>{if(!e.enabled||!t||!n||r.length===0)return null;let i=n;return e=>at(i,e)},[e.enabled,t,n,r.length]),workspaceOpenTargets:r}}var Ri=`Failed to open file locally`,zi=`Localhost is disconnected.`,Bi=`No local editor is available.`;function Vi(e){return e.hasDaemon?Bi:zi}function Hi(e){let{hasDaemon:t}=ft(),{openWorkspace:n,workspaceOpenTargets:r}=Li(e),[i,a]=ct(),o=(0,K.useMemo)(()=>gt({preferredTargetId:i,targets:r}),[i,r]),s=(0,K.useCallback)(async e=>{if(!r.find(t=>t.id===e.targetId)||!n)return hn.error(Ri,{description:Vi({hasDaemon:t})}),!1;e.rememberTarget&&a(e.targetId);try{return await n({lineNumber:e.lineNumber,path:e.path,targetId:e.targetId}),!0}catch(e){return hn.error(Ri,{description:e instanceof Error?e.message:void 0}),!1}},[t,n,a,r]),c=(0,K.useCallback)(async e=>o?s({lineNumber:e.lineNumber,path:e.path,rememberTarget:!1,targetId:o.id}):(hn.error(Ri,{description:Vi({hasDaemon:t})}),!1),[t,s,o]);return{canOpenPreferredTarget:o!==null,openPathInPreferredTarget:c,openPathInTarget:s,preferredTarget:o,workspaceOpenTargets:r}}function Ui(e,t){return e?e.sessions.findIndex(e=>e.id===t.id)===-1?{sessions:[...e.sessions,t]}:{sessions:e.sessions.map(e=>e.id===t.id?t:e)}:{sessions:[t]}}function Wi(e,t){if(!e)return e;let n=e.sessions.filter(e=>e.id!==t);return n.length===e.sessions.length?e:{sessions:n}}function Gi(e,t){if(!e)throw Error(`${t}: thread id is required when query is enabled`);return e}function Ki(e,t){return N({queryKey:F(e),queryFn:({signal:t})=>re(Gi(e,`useThreadTerminals`),t),enabled:(t?.enabled??!0)&&!!e,refetchOnWindowFocus:!1})}function qi(){let e=M();return I({meta:{errorMessage:`Failed to start terminal.`},mutationFn:({threadId:e,...t})=>g(e,t),onSuccess:t=>{e.setQueryData(F(t.threadId),e=>Ui(e,t)),e.invalidateQueries({queryKey:F(t.threadId)})}})}function Ji(){let e=M();return I({meta:{errorMessage:`Failed to rename terminal.`},mutationFn:({terminalId:e,threadId:t,...n})=>de(t,e,n),onSuccess:t=>{e.setQueryData(F(t.threadId),e=>Ui(e,t)),e.invalidateQueries({queryKey:F(t.threadId)})}})}function Yi(){let e=M();return I({meta:{errorMessage:`Failed to close terminal.`},mutationFn:({mode:e,terminalId:t,threadId:n})=>ne(n,t,{mode:e,reason:`user`}),onSuccess:(t,n)=>{e.setQueryData(F(t.threadId),e=>t.status===`exited`?Wi(e,n.terminalId):Ui(e,t)),e.invalidateQueries({queryKey:F(t.threadId)})}})}var Xi=`bb.thread.useStandardManagerTimeline`,Zi=`bb.thread.showAllEvents`;function Qi(){return typeof window>`u`?null:window.localStorage}function $i(e,t){return e===`true`?!0:e===`false`?!1:t}function ea({currentValue:e,initialValue:t,legacyValue:n}){return $i(e===null?n:e,t)}var ta=tt({parse:$i,serialize:e=>String(e)}),na=G(Xi,!1,{getItem:(e,t)=>{let n=Qi();return ea({currentValue:n?.getItem(e)??null,legacyValue:n?.getItem(Zi)??null,initialValue:t})},removeItem:e=>{ta.removeItem(e)},setItem:(e,t)=>{ta.setItem(e,t)},subscribe:ta.subscribe},{getOnInit:!0});function ra(){return it(na)}function ia(e,t){let n=e.mergeBase?.aheadCount??0,r=e.mergeBase?.behindCount??0;return n===0&&r===0?null:n>0&&r>0?t?`${n} ahead, ${r} behind relative to ${t}`:`${n} ahead, ${r} behind`:n>0?t?`${n} ahead of ${t}`:`${n} ahead`:t?`${r} behind ${t}`:`${r} behind`}function aa(e,t){return{label:e,summary:t,summaryContent:t}}function oa(e,t){if(!e){let e=t?.error instanceof b&&t.error.code===`path_not_found`;return t?.workspaceDeleted||e?aa(`Unknown`,`Workspace not found.`):aa(`Unknown`,`Workspace status unavailable.`)}let n=t?.mergeBaseBranch??e.mergeBase?.mergeBaseBranch,r=t?.showBranchComparison?ia(e,n):null;switch(e.workingTree.state){case`clean`:return(e.mergeBase?.aheadCount??0)>0&&(e.mergeBase?.behindCount??0)>0?aa(`Diverged`,r??`Branch has diverged.`):(e.mergeBase?.aheadCount??0)>0?aa(`Ahead`,r??`Local commits pending merge.`):(e.mergeBase?.behindCount??0)>0?aa(`Behind`,r??`Branch is behind its merge base.`):aa(t?.showBranchComparison?`Up to date`:`Clean`,n?`No local changes relative to ${n}.`:`No local changes.`);case`untracked`:return aa(`Untracked`,r??``);case`dirty_uncommitted`:return aa(`Dirty`,r??``);case`committed_unmerged`:return(e.mergeBase?.aheadCount??0)>0&&(e.mergeBase?.behindCount??0)>0?aa(`Diverged`,r??`Branch has diverged.`):(e.mergeBase?.behindCount??0)>0?aa(`Behind`,r??`Branch is behind its merge base.`):aa(`Ahead`,r??`Local commits pending merge.`);case`dirty_and_committed_unmerged`:return aa(`Dirty`,r??``);default:return f(e.workingTree.state)}}var sa=nt(!1),ca=G(`bb.thread.secondaryPanel.widthPercent`,50,tt({parse:(e,t)=>{if(e===null)return t;let n=Number.parseFloat(e);return Number.isFinite(n)&&n>0&&n<=100?n:t},serialize:e=>String(e)}),{getOnInit:!0}),la=nt(new Set),ua=nt(new Set),da=nt(void 0),fa=nt(null);function pa({activeSecondaryPanel:e,clearActiveFileTabs:t,defaultMergeBaseBranch:n,environmentId:r,mergeBaseBranchOptionsEnabled:i=!1,setThreadSecondaryPanel:a}){let o=dt(da),s=rt(da),c=rt(fa),{data:l,isLoading:u}=gi(r??``,{enabled:!!r&&(i||e===`git-diff`)});(0,K.useEffect)(()=>{s(void 0)},[r,s]);let d=(0,K.useCallback)(e=>{a(e)},[a]),f=(0,K.useCallback)(()=>{d(`git-diff`)},[d]);return{closeThreadSecondaryPanel:(0,K.useCallback)(()=>{e!==null&&a(null)},[e,a]),defaultMergeBaseBranch:n,isLoadingMergeBaseBranchOptions:u,mergeBaseBranchOptions:l,openDiffFile:(0,K.useCallback)(e=>{t(),c(e),f()},[t,f,c]),openThreadDiffPanel:f,openThreadSecondaryPanel:d,selectedMergeBaseBranch:o,setSelectedMergeBaseBranch:s}}function ma(e){return!!e.threadId&&e.inlineRowCount===0&&e.cachedRowCount===0&&!e.isLoading}function ha(e){return{sourceSeqEnd:e.sourceSeqEnd,sourceSeqStart:e.sourceSeqStart,turnId:e.turnId}}function ga(e,t){return e.turnId===t.turnId&&e.sourceSeqStart===t.sourceSeqStart&&e.sourceSeqEnd===t.sourceSeqEnd}function _a(e){let t={},n=e=>{for(let r of e){if(r.kind===`turn`){t[r.id]=ha(r),r.children&&n(r.children);continue}r.kind===`work`&&r.workKind===`delegation`&&n(r.childRows)}};return n(e),t}function va({candidateRowIds:e,previousRangesById:t,visibleRangesById:n}){let r=new Set;for(let i of e){let e=n[i],a=t[i];(!e||a&&!ga(a,e))&&r.add(i)}return r}function ya(e,t){let n=null;for(let r of t)e.has(r)&&(n??=new Set(e),n.delete(r));return n}function ba(e,t){let n=null;for(let r of t)r in e&&(n??={...e},delete n[r]);return n}function xa({currentLoadGeneration:e,request:t,visibleRangesById:n}){if(e!==t.loadGeneration)return!1;let r=n[t.rowId];return r!==void 0&&ga(r,t.range)}function Sa({loadTurnSummaryRows:e,managerTimelineView:t,timelineRows:n,threadId:r}){let i=(0,K.useRef)(0),a=(0,K.useRef)(e),o=(0,K.useRef)(r),s=(0,K.useRef)({}),c=(0,K.useRef)(new Set),l=(0,K.useRef)(new Set),u=(0,K.useRef)(new Set),d=(0,K.useRef)({}),[f,p]=(0,K.useState)(()=>new Set),[m,h]=(0,K.useState)(()=>new Set),[g,_]=(0,K.useState)({});(0,K.useLayoutEffect)(()=>{a.current=e},[e]),(0,K.useLayoutEffect)(()=>{o.current=r},[r]),(0,K.useLayoutEffect)(()=>{let e=_a(n),t=va({candidateRowIds:[...Object.keys(d.current),...c.current,...l.current,...u.current],previousRangesById:s.current,visibleRangesById:e});if(s.current=e,t.size===0)return;let r=ya(c.current,t);r&&(c.current=r);let i=ya(l.current,t);i&&(l.current=i,p(i));let a=ya(u.current,t);a&&(u.current=a,h(a));let o=ba(d.current,t);o&&(d.current=o,_(o))},[n]);let v=(0,K.useCallback)(e=>{let t=o.current,n={loadGeneration:i.current,range:ha(e),rowId:e.id},r=c.current,f=s.current[e.id];if(f===void 0||!ga(f,n.range)||r.has(e.id)||!ma({cachedRowCount:d.current[e.id]?.length??0,inlineRowCount:e.children?.length??0,isLoading:l.current.has(e.id),threadId:t})||!t)return;r.add(e.id);let m=new Set(l.current).add(e.id);if(l.current=m,p(m),u.current.has(e.id)){let t=new Set(u.current);t.delete(e.id),u.current=t,h(t)}a.current({id:t,turnId:e.turnId,sourceSeqStart:e.sourceSeqStart,sourceSeqEnd:e.sourceSeqEnd}).then(t=>{if(!xa({currentLoadGeneration:i.current,request:n,visibleRangesById:s.current}))return;let r={...d.current,[e.id]:t.rows};d.current=r,_(r)}).catch(()=>{if(!xa({currentLoadGeneration:i.current,request:n,visibleRangesById:s.current}))return;c.current.delete(e.id);let t=new Set(u.current).add(e.id);u.current=t,h(t)}).finally(()=>{if(!xa({currentLoadGeneration:i.current,request:n,visibleRangesById:s.current}))return;let t=new Set(l.current);t.delete(e.id),l.current=t,p(t)})},[]);return(0,K.useLayoutEffect)(()=>{i.current+=1,c.current=new Set;let e=new Set,t=new Set,n={};l.current=e,u.current=t,d.current=n,p(e),h(t),_(n)},[t,r]),{erroredTurnSummaryIds:m,handleLoadTurnSummaryRows:v,loadingTurnSummaryIds:f,turnSummaryRowsById:g}}function Ca({managerTimelineView:e,timelineRows:t,threadId:n}){let{mutateAsync:r}=Ne();return Sa({managerTimelineView:e,timelineRows:t,threadId:n,loadTurnSummaryRows:(0,K.useCallback)(t=>r({...t,managerTimelineView:e}),[r,e])})}var wa=pe;function Ta({actionsMenu:e,activeTerminalCount:t,isManagedThread:n,isManagerThread:r,isSecondaryPanelOpen:i,isTerminalPanelOpen:a,isThreadGitActionPending:o,onOpenThreadGitAction:s,onToggleSecondaryPanel:c,onToggleTerminalPanel:l,showTerminalPanelToggle:u,threadHeaderGitActions:d,threadTitle:f,workspaceOpenButton:p}){let[m,...h]=d,g=me(),_=g?`PanelBottom`:`PanelRight`;return(0,q.jsx)(dr,{center:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`truncate text-sm font-semibold`,children:f}),r?(0,q.jsx)(Je,{variant:`outline`,children:`manager`}):null,!r&&n?(0,q.jsx)(Je,{variant:`outline`,children:`managed`}):null]}),actions:(0,q.jsxs)(q.Fragment,{children:[p,m&&h.length>0?(0,q.jsx)(yr,{disabled:o,primaryAction:{label:m.label,onSelect:()=>s(m.target)},secondaryActions:h.map(e=>({label:e.label,onSelect:()=>s(e.target)}))}):m?(0,q.jsx)(j,{type:`button`,variant:`outline`,size:`sm`,disabled:o,className:wa,onClick:()=>s(m.target),children:m.label}):null,u?(0,q.jsxs)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`${nn} relative`,"aria-label":a?`Hide terminal panel`:`Show terminal panel`,"aria-pressed":a,title:a?`Hide terminal panel`:`Show terminal panel`,onClick:l,children:[(0,q.jsx)(L,{name:`Terminal`}),t>0?(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute -right-0.5 -top-0.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-primary px-1 text-[9px] font-semibold leading-none text-primary-foreground`,children:t>9?`9+`:t}):null]}):null,e,!g&&i?null:(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:nn,"aria-label":i?`Hide secondary panel`:`Show secondary panel`,"aria-pressed":i,title:i?`Hide secondary panel`:`Show secondary panel`,onClick:c,children:(0,q.jsx)(L,{name:_})})]})})}function Ea(){let e=M();return I({meta:{errorMessage:`Failed to resolve pending interaction.`,showErrorToast:!1},mutationFn:({threadId:e,interactionId:t,resolution:n})=>ue(e,t,n),onSuccess:(t,n)=>(_t({queryClient:e,threadId:n.threadId}),t)})}var Da=[];function Oa(){return{freeTextByQuestionId:{},selectedValuesByQuestionId:{}}}function ka({formState:e,question:t}){return e.selectedValuesByQuestionId[t.id]??Da}function Aa({formState:e,question:t}){return e.freeTextByQuestionId[t.id]??``}function ja({question:e,selectedValues:t}){let n=new Set((e.options??[]).map(e=>e.value));return t.filter(e=>n.has(e))}function Ma({optionValue:e,question:t,selectedValues:n}){return t.multiSelect?n.includes(e)?n.filter(t=>t!==e):[...n,e]:[e]}function Na(e,t){let n=ka({formState:e,question:t.question});return{...e,selectedValuesByQuestionId:{...e.selectedValuesByQuestionId,[t.question.id]:Ma({optionValue:t.optionValue,question:t.question,selectedValues:n})}}}function Pa(e,t){return{...e,freeTextByQuestionId:{...e.freeTextByQuestionId,[t.questionId]:t.value}}}function Fa({formState:e,question:t}){return ja({question:t,selectedValues:ka({formState:e,question:t})}).length>0?!0:t.allowFreeText&&Aa({formState:e,question:t}).trim().length>0}function Ia({formState:e,questions:t}){let n={};for(let r of t){let t=ja({question:r,selectedValues:ka({formState:e,question:r})}),i=Aa({formState:e,question:r}).trim();n[r.id]=r.allowFreeText&&i.length>0?{selected:t,freeText:i}:{selected:t}}return{kind:`user_answer`,answers:n}}function La({question:e}){return(0,q.jsxs)(`div`,{className:`min-w-0`,children:[e.shortLabel?(0,q.jsx)(`div`,{className:`text-xs font-medium uppercase text-muted-foreground`,children:e.shortLabel}):null,(0,q.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:e.prompt})]})}function Ra({checked:e,disabled:t,inputName:n,onOptionToggle:r,option:i,question:a}){let o=a.multiSelect?`checkbox`:`radio`;return(0,q.jsxs)(`label`,{className:R(`flex min-w-0 cursor-pointer items-start gap-2 rounded-md border px-3 py-2 transition-colors`,e?`border-surface-selected-border bg-surface-selected text-foreground`:`border-border bg-surface-raised text-muted-foreground hover:bg-state-hover hover:text-foreground`,t&&`cursor-not-allowed opacity-60`),children:[(0,q.jsx)(`input`,{type:o,name:n,value:i.value,checked:e,disabled:t,onChange:()=>r({question:a,optionValue:i.value}),className:`mt-0.5 size-4 shrink-0 accent-primary`}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block text-sm font-medium`,children:i.label}),i.description?(0,q.jsx)(`span`,{className:`mt-0.5 block text-xs text-muted-foreground`,children:i.description}):null]})]})}function za({disabled:e,formState:t,interactionId:n,onFreeTextChange:r,onOptionToggle:i,onSubmit:a,question:o}){let s=ka({formState:t,question:o}),c=Aa({formState:t,question:o}),l=`${n}-${o.id}`,u=o.options??[],d=`${o.shortLabel??o.prompt} answer`;return(0,q.jsxs)(`fieldset`,{className:`space-y-2 rounded-md border border-border bg-card px-4 py-3`,children:[(0,q.jsx)(`legend`,{className:`sr-only`,children:o.prompt}),(0,q.jsx)(La,{question:o}),u.length>0?(0,q.jsx)(`div`,{className:`grid gap-2`,children:u.map(t=>(0,q.jsx)(Ra,{checked:s.includes(t.value),disabled:e,inputName:l,onOptionToggle:i,option:t,question:o},t.value))}):null,o.allowFreeText?(0,q.jsx)(`textarea`,{"aria-label":d,value:c,disabled:e,rows:3,onChange:e=>r({questionId:o.id,value:e.target.value}),onKeyDown:e=>{e.nativeEvent.isComposing||e.key!==`Enter`||!e.metaKey&&!e.ctrlKey||(e.preventDefault(),a())},className:`min-h-20 w-full resize-y rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,placeholder:`Add an answer`}):null]})}function Ba({interactionId:e,questions:t,threadId:n}){let[r,i]=(0,K.useState)(Oa),a=Ea();(0,K.useEffect)(()=>{i(Oa())},[e]);let o=(0,K.useMemo)(()=>t.length>0&&t.every(e=>Fa({formState:r,question:e})),[r,t]),s=a.error?pn({error:a.error,fallbackMessage:`Failed to submit answer.`}):null,c=a.isPending,l=c||!o;return{disabled:c,formState:r,mutationErrorMessage:s,submitAnswer:()=>{if(l)return;let i=Ia({formState:r,questions:t});a.mutateAsync({threadId:n,interactionId:e,resolution:i}).catch(()=>{})},updateFreeTextAnswer:e=>{i(t=>Pa(t,e))},updateSelectedAnswer:e=>{i(t=>Na(t,e))}}}function Va({className:e,interactionId:t,isResolving:n=!1,questions:r,threadId:i}){let{disabled:a,formState:o,mutationErrorMessage:s,submitAnswer:c,updateFreeTextAnswer:l,updateSelectedAnswer:u}=Ba({interactionId:t,questions:r,threadId:i}),d=a||n,[f,p]=(0,K.useState)(0);(0,K.useEffect)(()=>{p(0)},[t]);let m=r.length,h=r[f]??null,g=f===m-1,_=h?Fa({formState:o,question:h}):!1,v=()=>{p(e=>Math.max(e-1,0))},y=()=>{if(g){c();return}p(e=>Math.min(e+1,m-1))};return h?(0,q.jsxs)(`form`,{className:R(`space-y-3`,e),onSubmit:e=>{e.preventDefault(),y()},children:[m>1?(0,q.jsx)(Ha,{currentIndex:f,totalQuestions:m}):null,(0,q.jsx)(za,{disabled:d,formState:o,interactionId:t,onFreeTextChange:l,onOptionToggle:u,onSubmit:y,question:h}),(0,q.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[f>0?(0,q.jsx)(j,{type:`button`,size:`sm`,variant:`outline`,disabled:d,onClick:v,children:`Back`}):null,(0,q.jsxs)(j,{type:`submit`,size:`sm`,disabled:d||!_,children:[n?(0,q.jsx)(L,{name:`Spinner`,className:`size-3 animate-spin`}):null,g?`Submit answer`:`Next`]})]}),s?(0,q.jsx)(`div`,{className:`rounded-md border border-surface-destructive-border bg-surface-destructive px-3 py-2 text-xs text-destructive`,children:s}):null]}):null}function Ha({currentIndex:e,totalQuestions:t}){return(0,q.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,q.jsxs)(`span`,{children:[`Question `,e+1,` of `,t]}),(0,q.jsx)(`div`,{className:`flex items-center gap-1.5`,"aria-hidden":!0,children:Array.from({length:t}).map((t,n)=>(0,q.jsx)(`span`,{className:R(`size-1.5 rounded-full transition-colors`,n===e?`bg-foreground`:n<e?`bg-foreground/60`:`bg-foreground/25`)},n))})]})}function Ua({interaction:e,threadId:t}){return y(e.payload)?(0,q.jsx)(Ka,{interaction:e,payload:e.payload,threadId:t}):ce(e.payload)?(0,q.jsx)(Ga,{interaction:e,payload:e.payload,threadId:t}):f(e.payload)}function Wa({title:e,errorMessage:t,footer:n,children:r}){return(0,q.jsxs)(`div`,{className:`mb-2 rounded-lg border border-border bg-surface-recessed px-4 py-3 text-xs text-muted-foreground`,children:[(0,q.jsx)(`h3`,{className:`min-w-0 text-sm font-semibold text-foreground`,children:(0,q.jsx)(Xt,{fullText:e,collapsedClassName:`line-clamp-2`,children:e})}),r?(0,q.jsx)(`div`,{className:`mt-3`,children:r}):null,n?(0,q.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center justify-end gap-2`,children:n}):null,t?(0,q.jsx)(`div`,{className:`mt-2 rounded-md border border-surface-destructive-border bg-surface-destructive px-2 py-1 text-xs text-destructive`,children:t}):null]})}function Ga({interaction:e,payload:t,threadId:n}){let r=Ea(),i=e.status===`resolving`,a=Ya(e.resolution),o=(0,K.useMemo)(()=>Xa({interaction:e,payload:t}),[e,t]),s=r.error?pn({error:r.error,fallbackMessage:`Failed to resolve pending interaction.`}):null,c=r.isPending||i,l=t=>{let i=x(e,t);r.mutateAsync({threadId:n,interactionId:e.id,resolution:i}).catch(()=>{})};return(0,q.jsx)(Wa,{title:o.title,errorMessage:s,footer:t.availableDecisions.map(e=>(0,q.jsx)(qa,{decision:e,disabled:c,isLoading:i&&a===e,onClick:()=>l(e)},e)),children:o.body})}function Ka({interaction:e,payload:t,threadId:n}){let r=e.status===`resolving`;return(0,q.jsx)(Wa,{title:T({interaction:e,surface:`app`}),children:(0,q.jsx)(Va,{interactionId:e.id,isResolving:r,questions:t.questions,threadId:n})})}function qa({decision:e,disabled:t,isLoading:n,onClick:r}){return(0,q.jsxs)(j,{type:`button`,size:`sm`,variant:Ja(e),disabled:t,onClick:r,children:[n?(0,q.jsx)(L,{name:`Spinner`,className:`size-3 animate-spin`}):null,Za(e)]})}function Ja(e){switch(e){case`allow_once`:return`default`;case`allow_for_session`:return`outline`;case`deny`:return`ghost`}}function Ya(e){return!e||`kind`in e?null:e.decision}function Xa({interaction:e,payload:t}){switch(t.subject.kind){case`command`:{let n=t.subject.command,r=n?un(n)??n:null,i=O(e).filter(e=>!e.startsWith(`Command: `)).map(e=>e.startsWith(`Cwd: `)?e.slice(5):e);return{title:t.reason??`Do you want to run this command?`,body:r?(0,q.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-border bg-card`,children:[(0,q.jsxs)(`pre`,{className:R(jt(`base`),`overflow-auto whitespace-pre px-4 py-3 font-mono text-sm leading-tight text-foreground`),children:[`$ `,r]}),i.length>0?(0,q.jsx)(`ul`,{className:`border-t border-border px-4 py-3 text-xs text-muted-foreground`,children:i.map(e=>(0,q.jsx)(`li`,{children:e},e))}):null]}):null}}case`file_change`:{let n=O(e);return{title:t.reason??`Do you want to make these changes?`,body:n.length>0?(0,q.jsx)(`ul`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-xs text-muted-foreground`,children:n.map(e=>(0,q.jsx)(`li`,{children:e},e))}):null}}case`permission_grant`:{let n=O(e);return{title:t.reason??`Do you want to grant this permission?`,body:n.length>0?(0,q.jsx)(`ul`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-xs text-muted-foreground`,children:n.map(e=>(0,q.jsx)(`li`,{children:e},e))}):null}}default:return f(t.subject)}}function Za(e){switch(e){case`allow_once`:return`Allow once`;case`allow_for_session`:return`Allow for session`;case`deny`:return`Deny`}}var Qa=`rounded-md border border-border bg-surface-recessed`;function $a({children:e,ariaLabel:t,className:n,style:r}){return t?(0,q.jsx)(`section`,{"aria-label":t,className:R(Qa,n),style:r,children:e}):(0,q.jsx)(`div`,{className:R(Qa,n),style:r,children:e})}var eo=new Set([`active`,`host-reconnecting`,`waiting-for-host`]);function to(e){return eo.has(e)}var no={uncommitted:`Uncommitted`,untracked:`Untracked`,committed:`Committed`},ro={managedBy:{toggle:`thread-prompt-banner-managed-by-toggle`,body:`thread-prompt-banner-managed-by-body`},managerChildren:{toggle:`thread-prompt-banner-manager-children-toggle`,body:`thread-prompt-banner-manager-children-body`},todos:{toggle:`thread-prompt-banner-todos-toggle`,body:`thread-prompt-banner-todos-body`},git:{toggle:`thread-prompt-banner-git-toggle`,body:`thread-prompt-banner-git-body`}},io={in_progress:0,pending:1,completed:2};function ao(e){return e.items.length>0}function oo(e){if(e.length===0)return null;let t=0;for(let n of e)n.status===`completed`&&(t+=1);return t===0?`${e.length}`:`${t}/${e.length}`}function so({className:e}){return(0,q.jsx)(L,{name:`ChevronDown`,className:R(`size-3.5 shrink-0 rotate-45`,e),"aria-hidden":`true`})}function co({id:e,controlsId:t,ariaLabel:n,icon:r,label:i,isExpanded:a,onToggle:o}){return(0,q.jsxs)(`button`,{type:`button`,id:e,"aria-expanded":a,"aria-controls":t,"aria-label":n,onClick:o,className:R(`flex min-w-0 items-center rounded px-1 py-0.5 text-xs transition-colors hover:bg-state-hover`,i==null?`gap-0`:`gap-1.5`,a?`text-foreground`:`text-muted-foreground`),children:[r,i==null?null:(0,q.jsx)(`span`,{className:`min-w-0 truncate`,children:i}),(0,q.jsx)(L,{name:`ChevronDown`,className:R(`size-3.5 shrink-0 text-subtle-foreground transition-transform duration-200`,a&&`rotate-180`),"aria-hidden":`true`})]})}function lo({status:e}){let t=`size-3.5 shrink-0`;switch(e){case`in_progress`:return(0,q.jsx)(L,{name:`Square`,className:R(t,`fill-current text-muted-foreground/30`),"aria-hidden":`true`});case`completed`:return(0,q.jsx)(L,{name:`Check`,className:R(t,`text-muted-foreground/60`),"aria-hidden":`true`});case`pending`:return(0,q.jsx)(L,{name:`Square`,className:R(t,`text-muted-foreground/45`),"aria-hidden":`true`})}}function uo({items:e}){return(0,q.jsx)(`ul`,{className:`max-h-40 space-y-0.5 overflow-y-auto px-3 pb-2 pt-1.5`,children:[...e].sort((e,t)=>io[e.status]-io[t.status]).map(e=>(0,q.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 py-0.5 text-xs`,children:[(0,q.jsx)(lo,{status:e.status}),(0,q.jsx)(`span`,{className:R(`min-w-0 flex-1 truncate`,e.status===`in_progress`&&`font-medium text-foreground`,e.status===`pending`&&`text-muted-foreground`,e.status===`completed`&&`text-subtle-foreground line-through decoration-subtle-foreground`),title:e.text,children:e.text})]},e.id))})}function fo({managerName:e,href:t}){return(0,q.jsxs)(`div`,{className:`px-3 pb-2 pt-1.5 text-xs leading-relaxed text-muted-foreground`,children:[`This thread is managed by`,` `,(0,q.jsx)(We,{to:t,className:`text-foreground/90 underline-offset-2 hover:underline`,children:e}),`.`]})}function po({items:e}){return(0,q.jsx)(`ul`,{className:`max-h-40 space-y-0.5 overflow-y-auto px-3 pb-2 pt-1.5`,children:e.map(e=>(0,q.jsx)(`li`,{className:`text-xs`,children:(0,q.jsxs)(We,{to:e.href,title:e.title,className:`flex min-w-0 items-center gap-2 py-0.5 text-foreground/90 underline-offset-2 hover:underline`,children:[(0,q.jsx)(so,{className:`text-subtle-foreground no-underline`}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title})]})},e.id))})}function mo({id:e,labelledBy:t,isExpanded:n,children:r}){return(0,q.jsx)(`section`,{id:e,role:`region`,"aria-labelledby":t,"aria-hidden":!n,className:R(`grid overflow-hidden transition-[grid-template-rows,opacity,border-color] duration-200 ease-out`,n?`grid-rows-[1fr] border-t border-border opacity-100`:`pointer-events-none grid-rows-[0fr] border-t border-transparent opacity-0`),children:(0,q.jsx)(`div`,{className:`overflow-hidden`,children:r})})}function ho({todoSection:e,gitSection:t,gitSectionPending:n,archivedSection:r,managedBySection:i,managerChildrenSection:a,expandedSection:o,onToggleSection:s}){if(n)return null;if(r){let e=o===`managedBy`&&i!==null;return(0,q.jsxs)($a,{ariaLabel:`Thread context before sending`,className:`overflow-hidden`,style:{minHeight:32},children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-0.5 px-2 py-1 text-xs text-muted-foreground`,children:[i?(0,q.jsx)(co,{id:ro.managedBy.toggle,controlsId:ro.managedBy.body,ariaLabel:`Managed by ${i.managerName}`,icon:(0,q.jsx)(L,{name:`UserRound`,className:`size-3.5 shrink-0`,"aria-hidden":`true`}),label:null,isExpanded:e,onToggle:()=>s(`managedBy`)}):null,(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 px-1 py-0.5`,children:[(0,q.jsx)(L,{name:`Archive`,className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`min-w-0 truncate`,children:`Thread is archived`})]})]}),i?(0,q.jsx)(mo,{id:ro.managedBy.body,labelledBy:ro.managedBy.toggle,isExpanded:e,children:(0,q.jsx)(fo,{managerName:i.managerName,href:i.href})}):null]})}let c=e!==null&&ao(e.pendingTodos),l=t!==null,u=i!==null,d=a!==null&&a.items.length>0;if(!c&&!l&&!u&&!d)return null;let f=c&&e?e.pendingTodos.items:[],p=o===`todos`&&c,m=o===`git`&&l,h=o===`managedBy`&&u,g=o===`managerChildren`&&d,_=l?(0,q.jsxs)(q.Fragment,{children:[c?null:(0,q.jsxs)(q.Fragment,{children:[no[t.changedFiles.kind],` · `]}),Si(yi(t.changedFiles.stats))]}):null,v=l&&t.mergeBase?Un({mergeBaseBranch:t.mergeBase.branch,mergeBaseBranchOptions:t.mergeBase.options}):[],y=u&&!c&&!l&&!d;return(0,q.jsxs)($a,{ariaLabel:`Thread context before sending`,className:`overflow-hidden`,style:{minHeight:32},children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-0.5 px-2 py-1 text-xs text-muted-foreground`,children:[u&&i&&y?(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 px-1 py-0.5`,children:[(0,q.jsx)(L,{name:`UserRound`,className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`Managed by`,` `,(0,q.jsx)(We,{to:i.href,className:`text-foreground/90 underline underline-offset-2`,children:i.managerName})]})]}):null,u&&i&&!y?(0,q.jsx)(co,{id:ro.managedBy.toggle,controlsId:ro.managedBy.body,ariaLabel:`Managed by ${i.managerName}`,icon:(0,q.jsx)(L,{name:`UserRound`,className:`size-3.5 shrink-0`,"aria-hidden":`true`}),label:null,isExpanded:h,onToggle:()=>s(`managedBy`)}):null,d&&a?(0,q.jsx)(co,{id:ro.managerChildren.toggle,controlsId:ro.managerChildren.body,icon:(0,q.jsx)(L,{name:`CircleDashed`,className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":`true`}),label:`${a.items.length} active managed ${a.items.length===1?`thread`:`threads`}`,isExpanded:g,onToggle:()=>s(`managerChildren`)}):null,c?(0,q.jsx)(co,{id:ro.todos.toggle,controlsId:ro.todos.body,icon:(0,q.jsx)(L,{name:`ListTodo`,className:`size-3.5 shrink-0`,"aria-hidden":`true`}),label:oo(f),isExpanded:p,onToggle:()=>s(`todos`)}):null,l&&_?(0,q.jsx)(co,{id:ro.git.toggle,controlsId:ro.git.body,icon:(0,q.jsx)(L,{name:`FileDiff`,className:`size-3.5 shrink-0`,"aria-hidden":`true`}),label:_,isExpanded:m,onToggle:()=>s(`git`)}):null,l&&t.mergeBase?(0,q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,q.jsx)(`span`,{className:`shrink-0`,children:`Merge base:`}),(0,q.jsx)(Xn,{value:t.mergeBase.branch,options:v,variant:`minimal`,loading:t.mergeBase.optionsLoading,onChange:t.mergeBase.onChange,onOpenChange:t.mergeBase.onPickerOpenChange,className:`max-w-[10rem]`,muted:!0,popoverAlign:`end`})]}):null]}),u&&i&&!y?(0,q.jsx)(mo,{id:ro.managedBy.body,labelledBy:ro.managedBy.toggle,isExpanded:h,children:(0,q.jsx)(fo,{managerName:i.managerName,href:i.href})}):null,d&&a?(0,q.jsx)(mo,{id:ro.managerChildren.body,labelledBy:ro.managerChildren.toggle,isExpanded:g,children:(0,q.jsx)(po,{items:a.items})}):null,c?(0,q.jsx)(mo,{id:ro.todos.body,labelledBy:ro.todos.toggle,isExpanded:p,children:(0,q.jsx)(uo,{items:f})}):null,l?(0,q.jsx)(mo,{id:ro.git.body,labelledBy:ro.git.toggle,isExpanded:m,children:(0,q.jsx)(Ei,{files:t.changedFiles.files,className:`max-h-32 px-3 pb-2 pt-1`,onFileClick:e=>t.onPromptBannerFileClick({file:e,section:t.changedFiles})})}):null]})}var go=220;function _o(e){let t=e.trim();return t.length===0?`Attachment`:Vt(t)}function vo(e){let t=0;for(let n of e)(n.type===`localImage`||n.type===`localFile`)&&(t+=1);return t}function yo(e){let t=e.filter(e=>e.type===`text`).map(e=>e.text.trim()).filter(e=>e.length>0).join(`
2
2
 
3
- `).trim();if(t.length>0)return t.length<=go?t:`${t.slice(0,go-1)}...`;let n=vo(e);if(n===1){let t=e.find(e=>e.type===`localImage`||e.type===`localFile`);return t?t.type===`localFile`&&t.name?`Attachment only (${t.name})`:`Attachment only (${_o(t.path)})`:`Attachment only (1 file)`}return n>1?`Attachment only (${n} files)`:`(empty message)`}function bo(e){return hr(e)}var xo=(0,K.memo)(function({queuedMessage:e,index:t,isProcessing:n,sendDisabled:r,actionDisabled:i,onSendImmediately:a,onEdit:o,onDelete:s}){let c=(0,K.useMemo)(()=>yo(e.content),[e.content]),l=(0,K.useMemo)(()=>vo(e.content),[e.content]);return(0,q.jsx)(`li`,{className:`px-2.5 py-0.5`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(`div`,{className:`p-0.5 text-muted-foreground`,children:(0,q.jsx)(L,{name:`CornerDownRight`,className:`size-3.5`})}),(0,q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 text-xs leading-4`,children:[(0,q.jsx)(`p`,{className:`min-w-0 truncate text-foreground`,title:c,children:c}),l>0?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`.`}),(0,q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:l===1?`1 attachment`:`${l} attachments`})]}):null,n?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`.`}),(0,q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Sending...`})]}):null]})}),(0,q.jsxs)(`div`,{className:`ml-1 flex shrink-0 items-center gap-1`,children:[(0,q.jsx)(j,{type:`button`,size:`sm`,variant:`link`,className:`h-auto px-0 pr-1 text-xs text-muted-foreground underline`,disabled:r||n,onClick:()=>a(e.id),children:n?`Sending...`:`Send now`}),(0,q.jsx)(j,{type:`button`,size:`icon`,variant:`ghost`,className:`size-7 text-muted-foreground`,disabled:i||n,onClick:()=>o(e.id),"aria-label":`Edit queued message ${t+1}`,title:`Edit queued message`,children:(0,q.jsx)(L,{name:`Edit`,className:`size-3.5`})}),(0,q.jsx)(j,{type:`button`,size:`icon`,variant:`ghost`,className:`size-7 text-muted-foreground hover:text-destructive`,disabled:i||n,onClick:()=>s(e.id),"aria-label":`Delete queued message ${t+1}`,title:`Delete queued message`,children:(0,q.jsx)(L,{name:`Trash2`,className:`size-3.5`})})]})]})})});function So({queuedMessages:e,sendDisabled:t,actionDisabled:n,processingMessageId:r,onSendImmediately:i,onEdit:a,onDelete:o}){return e.length===0?null:(0,q.jsxs)($a,{ariaLabel:`Queued messages`,className:`overflow-hidden`,children:[(0,q.jsx)(`div`,{className:`flex items-center justify-between px-2.5 pb-1 pt-2.5`,children:(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Queued (`,e.length,`)`]})}),(0,q.jsx)(`ul`,{children:e.map((e,s)=>(0,q.jsx)(xo,{queuedMessage:e,index:s,isProcessing:r===e.id,sendDisabled:t,actionDisabled:n,onSendImmediately:i,onEdit:a,onDelete:o},e.id))})]})}var Co=(0,K.memo)(function({environmentLabel:e,environmentHostLabel:t,environmentHostConnected:n,environmentIcon:r,environmentBranchName:i,onCreateNewThreadInWorktree:a}){return!e&&n===void 0?null:(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 pr-1.5`,children:[e?(0,q.jsx)(pr,{label:`Environment`,value:(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(`span`,{children:e}),t?(0,q.jsxs)(`span`,{className:`hidden text-muted-foreground/60 lg:inline`,children:[`· `,t]}):null,n===void 0?null:(0,q.jsx)(On,{connected:n,className:`translate-y-px`})]}),leading:r?(0,q.jsx)(L,{name:r,className:`size-4 shrink-0`}):null,className:`h-6 shrink-0`,muted:!0}):n===void 0?null:(0,q.jsx)(On,{connected:n}),i?(0,q.jsxs)(`button`,{type:`button`,className:`hidden min-w-0 items-center gap-1 rounded-md px-1.5 py-0.5 text-xs text-muted-foreground/75 transition-colors hover:bg-state-hover hover:text-foreground md:flex`,title:`Copy branch name: ${i}`,onClick:()=>{on(i,{successMessage:`Branch name copied`,errorMessage:`Failed to copy branch name`})},children:[(0,q.jsx)(L,{name:`GitMerge`,className:`size-3.5 shrink-0`}),(0,q.jsx)(`span`,{className:`truncate`,children:i})]}):null,a?(0,q.jsx)(`button`,{type:`button`,"aria-label":`Create new thread in this worktree`,title:`New thread in this worktree`,onClick:a,className:`-ml-1 inline-flex shrink-0 items-center justify-center rounded-md px-1 py-0.5 text-muted-foreground/75 transition-colors hover:bg-state-hover hover:text-foreground`,children:(0,q.jsx)(L,{name:`MessageSquarePlus`,className:`size-4`})}):null]})});function wo({visible:e,active:t=!1,onClick:n,className:r,ariaLabel:i=`Scroll to latest event`}){return(0,q.jsx)(`div`,{className:R(`flex h-0 items-center justify-center`,r),children:(0,q.jsx)(`button`,{onClick:n,className:R(`z-20 -mt-20 flex size-8 items-center justify-center rounded-full border border-foreground/20 bg-background/80 backdrop-blur-md transition-all duration-200 hover:border-foreground/30 hover:bg-background/90`,e?`translate-y-0 opacity-100`:`pointer-events-none translate-y-2 opacity-0`),"aria-label":i,type:`button`,children:t?(0,q.jsx)(To,{}):(0,q.jsx)(L,{name:`ArrowDown`,className:`size-4`})})})}function To(){return(0,q.jsxs)(`span`,{className:`flex items-center gap-0.5`,"aria-hidden":!0,children:[(0,q.jsx)(`span`,{className:`size-1 animate-typing-dot rounded-full bg-current [animation-delay:-240ms]`}),(0,q.jsx)(`span`,{className:`size-1 animate-typing-dot rounded-full bg-current [animation-delay:-120ms]`}),(0,q.jsx)(`span`,{className:`size-1 animate-typing-dot rounded-full bg-current`})]})}function Eo({active:e}){let t=ie();return t?(0,q.jsx)(wo,{visible:!t.isAtBottom,active:e,onClick:t.scrollToBottom}):null}function Do({onSubmit:e,submission:t,...n}){let r=ie(),i=()=>{e(),r?.scrollToBottom()},a=t?.onModifierSubmit===void 0?void 0:()=>{t.onModifierSubmit?.(),r?.scrollToBottom()},o=t===void 0?void 0:{...t,...a?{onModifierSubmit:a}:{}};return(0,q.jsx)(An,{...n,onSubmit:i,submission:o})}var Oo=68,ko=Oo+32,Ao=(0,K.memo)(function({attachments:e,stack:t,composer:n,environmentSummary:r,contextWindowUsage:i,execution:a,permission:o,mentions:s,zenModeResetKey:c}){let l=n.submitMode,u=l.kind===`queue`,d=l.kind===`ready`||l.kind===`queue`,f=l.kind===`blocked`&&l.reason===`stopping`,p=l.kind===`queue`||l.kind===`stop-only`?l.onStop:void 0,m=p!==void 0,h=(0,K.useRef)(null),g=Mn(h),_=n.canSteerSubmit?n.onSteerSubmit:void 0,v=(0,K.useRef)(null),[y,b]=(0,K.useState)(0);(0,K.useLayoutEffect)(()=>{let e=v.current;if(!e)return;let t=e.offsetHeight;b(e=>e===t?e:t)},[t]),(0,K.useEffect)(()=>{let e=v.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e=>{let t=e[0];t&&b(t.contentRect.height)});return t.observe(e),()=>t.disconnect()},[]);let x=Math.max(Oo,ko-y);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Eo,{active:n.threadRuntimeDisplayStatus===`active`}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`div`,{ref:v,className:`space-y-2`,children:t}),(0,q.jsx)(Do,{promptBoxRef:h,voice:g,minHeight:x,value:n.message,onChange:n.onChangeMessage,onSubmit:n.onSubmit,history:n.history,placeholder:n.promptPlaceholder,mentionMenuPlacement:`top`,autoFocus:!0,submission:{onStop:p,isSubmitting:n.isFollowUpSubmitting||f,disabled:!d||n.isFollowUpSubmitting,onModifierSubmit:_,title:u?`Queue follow-up (Enter)`:f?`Stopping run...`:`Submit (Enter)`,isRunning:m,mode:`enter`},mentions:s,attachments:e,zenMode:{layout:`thread`,storageKey:null,resetKey:c,resetOnSubmit:!0},footerStart:(0,q.jsx)(xn,{...a})}),(0,q.jsxs)(`div`,{className:`mt-1 flex min-h-6 items-center justify-between gap-2 pl-[15px] pr-3.5`,children:[(0,q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-1`,children:r}),(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,q.jsx)(Tn,{value:o.value,options:o.options,onChange:o.onChange,supported:o.supported,className:`h-6`}),i?(0,q.jsx)(Ot,{usage:i}):null]})]})]})]})});function jo(e){return e===`active`||e===`host-reconnecting`}function Mo({hasPromptDraftInput:e,isFollowUpSubmitting:t,isQueueMutationPending:n,queuedMessageCount:r,runtimeDisplayStatus:i,submitModeKind:a}){return i===`active`&&a===`queue`&&!t&&!n&&(r>0||e)}function No({input:e,threadId:t,...n}){return e.length===0?null:{id:t,input:e,mode:`auto`,...n.model?{model:n.model}:{},...Lo(n)}}function Po({input:e,threadId:t}){return e.length===0?null:{id:t,input:e,mode:`steer`}}function Fo({input:e,threadId:t,...n}){return e.length===0?null:{id:t,input:e,model:n.model,...Lo(n)}}function Io({queuedMessages:e,threadId:t}){return e.map(e=>({id:t,mode:`steer`,queuedMessageId:e.id}))}function Lo({permissionMode:e,reasoningLevel:t,serviceTier:n,supportsServiceTier:r}){return{...r&&n?{serviceTier:n}:{},reasoningLevel:t,permissionMode:e}}function Ro(e,t){if(e===`created`||e===`provisioning`)return t?`Hiring manager...`:`Creating thread...`;switch(e){case`waiting-for-host`:return`Host daemon disconnected`;case`host-reconnecting`:return`Waiting for host daemon to reconnect...`;case`error`:return`Retry by sending a follow-up message`;case`idle`:case`active`:return t?`Send a message. @ to mention files or threads`:`Ask for follow-up changes. @ to mention files`;default:return f(e)}}function zo({canUseGitUi:e,composerQueriesEnabled:t,composerQueriesRefetchOnMount:n,composerQueriesStaleTime:r,contextWindowUsage:i,environmentBranchName:a,environmentHostConnected:o,environmentHostLabel:s,environmentIcon:c,environmentLabel:l,onCreateNewThreadInWorktree:u,isEnvironmentActionPending:d,pendingInteractions:f,onChangedFileClick:p,openThreadDiffPanel:m,projectId:h,workspaceChangedFilesSection:g,workspaceStatusPending:_,contextBannerMergeBase:v,pendingTodos:y,managedBySection:b,managerChildrenSection:x,sendMessage:S,thread:C}){let{data:w}=we(C.id,{enabled:t,refetchOnMount:n,staleTime:r}),{data:T=[]}=ze(C.id,{enabled:t,refetchOnMount:n,staleTime:r}),E=(0,K.useRef)(new Map);E.current=(0,K.useMemo)(()=>{let e=new Map;for(let t of T)e.set(t.id,t);return e},[T]);let{data:D=[]}=Me(C.id,{enabled:t,refetchOnMount:n,staleTime:r}),O=vn(),k=Cn(),A=qn(),j=Bn(),M=pt(),N=Pn({projectId:h,threadId:C.id}),P=er(h,{threadSuggestionMode:C.type===`manager`?`all`:`managers`,currentThreadId:C.id,environmentId:C.environmentId??null}),[F,I]=(0,K.useState)(null),[ee,te]=(0,K.useState)(null),[ne,re]=(0,K.useState)(null),[ie,L]=(0,K.useState)(!1),R=(0,K.useMemo)(()=>or(D),[D]),{selectedProviderId:z,providerOptions:ae,hasMultipleProviders:oe,selectedProviderDisplayName:se,selectedModel:ce,setSelectedModel:le,serviceTier:ue,setServiceTier:de,reasoningLevel:fe,setReasoningLevel:pe,permissionMode:me,setPermissionMode:he,activeModel:ge,modelOptions:_e,reasoningOptions:B,permissionModeOptions:ve,supportsPermissionModeSelection:ye,supportsServiceTier:V,serviceTierSupportByProvider:be}=en({enabled:t,environmentId:C.environmentId??void 0,scope:`component-local`,resetKey:C.id,initialProviderId:C.providerId,initialModel:w?.model,initialServiceTier:w?.serviceTier,initialReasoningLevel:w?.reasoningLevel,initialPermissionMode:w?.permissionMode,initialEnvironmentSelectionValue:C.environmentId??void 0}),H=C.runtime.displayStatus,xe=H===`created`,Se=H===`provisioning`,Ce=H===`waiting-for-host`,Te=C.stopRequestedAt!==null||j.isPending&&j.variables===C.id,Ee=Re(f),De=Ee!==null,Oe=O.isPending||k.isPending||A.isPending||ie,ke=S.isPending||d||O.isPending||ie,Ae=(0,K.useCallback)(()=>{j.mutate(C.id)},[j,C.id]),je=(0,K.useMemo)(()=>Te?{kind:`blocked`,reason:`stopping`}:De?{kind:`blocked`,reason:`pending-interaction`}:xe||Se?{kind:`blocked`,reason:`provisioning`}:Ce?{kind:`stop-only`,onStop:Ae}:H===`active`||H===`host-reconnecting`?{kind:`queue`,onStop:Ae}:{kind:`ready`},[Ae,De,xe,Se,Te,Ce,H]),Ne=Te?`Stopping thread...`:Ro(H,C.type===`manager`),Pe=(0,K.useMemo)(()=>({text:N.text,attachments:N.attachments}),[N.attachments,N.text]),Fe=(0,K.useMemo)(()=>lr(Pe),[Pe]),Ie=Mo({hasPromptDraftInput:Fe.length>0,isFollowUpSubmitting:ke,isQueueMutationPending:Oe,queuedMessageCount:T.length,runtimeDisplayStatus:H,submitModeKind:je.kind}),Le=(0,K.useCallback)(async e=>{if(e.length===0)return;I(null);let t=[];for(let n of e)try{let e=await M.mutateAsync({projectId:h,file:n});N.addAttachment(e)}catch{t.push(n.name)}t.length>0&&I(`Failed to attach: ${t.join(`, `)}`)},[h,N,M]),Be=(0,K.useCallback)(async()=>{let e=Pe,t=Fe;if(t.length===0)return;N.clearIfCurrentMatches(e),I(null);let n=jo(H);try{if(n){let e=Fo({threadId:C.id,input:t,model:ge?.model??ce,supportsServiceTier:V,serviceTier:ue,reasoningLevel:fe,permissionMode:me});e&&await O.mutateAsync(e)}else{let e=No({threadId:C.id,input:t,model:ge?.model??ce,supportsServiceTier:V,serviceTier:ue,reasoningLevel:fe,permissionMode:me});e&&await S.mutateAsync(e)}}catch(t){N.restoreIfEmpty(e),hn.error(pn({error:t,fallbackMessage:n?`Failed to queue message.`:`Failed to send follow-up.`}))}},[ge?.model,O,Pe,Fe,N,fe,me,ce,S,ue,V,C.id,H]),Ve=(0,K.useCallback)(async()=>{if(!Ie)return;let e=Pe,t=Fe;if(!(T.length===0&&t.length===0)){L(!0),t.length>0&&N.clearIfCurrentMatches(e),I(null);try{for(let e of Io({queuedMessages:T,threadId:C.id}))await k.mutateAsync(e);let e=Po({input:t,threadId:C.id});e&&await S.mutateAsync(e)}catch(t){N.restoreIfEmpty(e),hn.error(pn({error:t,fallbackMessage:`Failed to send steer.`}))}finally{L(!1)}}},[Ie,Pe,Fe,N,T,S,k,C.id]),He=(0,K.useCallback)(e=>{E.current.has(e)&&(re(e),k.mutateAsync({id:C.id,mode:`auto`,queuedMessageId:e}).then(()=>{I(null)}).catch(e=>{hn.error(pn({error:e,fallbackMessage:`Failed to send queued message.`}))}).finally(()=>{re(t=>t===e?null:t)}))},[k,C.id]),Ue=(0,K.useCallback)(e=>{let t=E.current.get(e);t&&(re(e),A.mutateAsync({id:C.id,queuedMessageId:e}).then(()=>{let e=bo(t.content);N.setDraft(e),I(null)}).catch(e=>{hn.error(pn({error:e,fallbackMessage:`Failed to edit queued message.`}))}).finally(()=>{re(t=>t===e?null:t)}))},[A,N,C.id]),We=(0,K.useCallback)(e=>{re(e),A.mutateAsync({id:C.id,queuedMessageId:e}).catch(e=>{hn.error(pn({error:e,fallbackMessage:`Failed to delete queued message.`}))}).finally(()=>{re(t=>t===e?null:t)})},[A,C.id]),Ge=(0,K.useCallback)(e=>{p(e)},[p]),Ke=(0,K.useCallback)(e=>{te(t=>t===e?null:e)},[]),qe=(0,K.useMemo)(()=>({items:N.attachments,projectId:h,isAttaching:M.isPending,error:F,onAttachFiles:Le,onRemove:N.removeAttachment}),[F,Le,h,N.attachments,N.removeAttachment,M.isPending]),Je=(0,K.useMemo)(()=>({history:{currentDraft:Pe,entries:R,onSelectEntry:N.setDraft,resetKey:C.id},isFollowUpSubmitting:ke,message:N.text,onChangeMessage:N.setText,onSteerSubmit:Ve,onSubmit:Be,promptPlaceholder:Ne,canSteerSubmit:Ie,submitMode:je,threadRuntimeDisplayStatus:H}),[Ie,Pe,Be,Ve,ke,N.setDraft,N.setText,N.text,R,Ne,H,je,C.id]),Ye=(0,K.useMemo)(()=>({provider:{options:ae,selectedId:z,hasMultiple:oe,displayName:se},model:{active:ge,selected:ce,options:_e,onChange:le},serviceTier:{value:ue,onChange:de,supported:V,supportByProvider:be},reasoning:{value:fe,options:B,onChange:pe}}),[ge,oe,_e,ae,fe,B,ce,se,z,ue,be,pe,le,de,V]),Xe=(0,K.useMemo)(()=>({value:me,options:ve,onChange:he,supported:ye}),[me,ve,he,ye]),Ze=(0,K.useMemo)(()=>({suggestions:P.suggestions,isLoading:P.isLoading,isError:P.isError,onQueryChange:P.setQuery}),[P.isError,P.isLoading,P.setQuery,P.suggestions]),U=(0,K.useMemo)(()=>l||o!==void 0?(0,q.jsx)(Co,{environmentLabel:l,environmentHostLabel:s,environmentHostConnected:o,environmentIcon:c,environmentBranchName:a,onCreateNewThreadInWorktree:u}):null,[a,o,s,c,l,u]);return Ee?(0,q.jsx)(Ua,{interaction:Ee,threadId:C.id}):(0,q.jsx)(Ao,{attachments:qe,stack:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ho,{todoSection:C.type===`manager`||!y?null:{pendingTodos:y},archivedSection:C.archivedAt===null?null:{archivedAt:C.archivedAt},managedBySection:b,managerChildrenSection:x,gitSection:g?{changedFiles:g,mergeBase:v,onPromptBannerFileClick:e?Ge:()=>{}}:null,gitSectionPending:_,expandedSection:ee,onToggleSection:Ke}),(0,q.jsx)(So,{queuedMessages:T,sendDisabled:!(je.kind===`ready`||je.kind===`queue`)||ke||Oe,actionDisabled:Oe,processingMessageId:ne,onSendImmediately:He,onEdit:Ue,onDelete:We})]}),composer:Je,zenModeResetKey:C.id,environmentSummary:U,contextWindowUsage:i??null,execution:Ye,permission:Xe,mentions:Ze})}var Bo=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=w();function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!==`default`){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var r=n(t),i=typeof window<`u`,a=t.createContext(null);a.displayName=`PanelGroupContext`;var o={group:`data-panel-group`,groupDirection:`data-panel-group-direction`,groupId:`data-panel-group-id`,panel:`data-panel`,panelCollapsible:`data-panel-collapsible`,panelId:`data-panel-id`,panelSize:`data-panel-size`,resizeHandle:`data-resize-handle`,resizeHandleActive:`data-resize-handle-active`,resizeHandleEnabled:`data-panel-resize-handle-enabled`,resizeHandleId:`data-panel-resize-handle-id`,resizeHandleState:`data-resize-handle-state`},s=10,c=i?t.useLayoutEffect:()=>{},l=r.useId,u=typeof l==`function`?l:()=>null,d=0;function f(e=null){let n=u(),r=t.useRef(e||n||null);return r.current===null&&(r.current=``+ d++),e??r.current}function p({children:e,className:n=``,collapsedSize:r,collapsible:i,defaultSize:s,forwardedRef:l,id:u,maxSize:d,minSize:p,onCollapse:m,onExpand:h,onResize:g,order:_,style:v,tagName:y=`div`,...b}){let x=t.useContext(a);if(x===null)throw Error(`Panel components must be rendered within a PanelGroup container`);let{collapsePanel:S,expandPanel:C,getPanelSize:w,getPanelStyle:T,groupId:E,isPanelCollapsed:D,reevaluatePanelConstraints:O,registerPanel:k,resizePanel:A,unregisterPanel:j}=x,M=f(u),N=t.useRef({callbacks:{onCollapse:m,onExpand:h,onResize:g},constraints:{collapsedSize:r,collapsible:i,defaultSize:s,maxSize:d,minSize:p},id:M,idIsFromProps:u!==void 0,order:_});t.useRef({didLogMissingDefaultSizeWarning:!1}),c(()=>{let{callbacks:e,constraints:t}=N.current,n={...t};N.current.id=M,N.current.idIsFromProps=u!==void 0,N.current.order=_,e.onCollapse=m,e.onExpand=h,e.onResize=g,t.collapsedSize=r,t.collapsible=i,t.defaultSize=s,t.maxSize=d,t.minSize=p,(n.collapsedSize!==t.collapsedSize||n.collapsible!==t.collapsible||n.maxSize!==t.maxSize||n.minSize!==t.minSize)&&O(N.current,n)}),c(()=>{let e=N.current;return k(e),()=>{j(e)}},[_,M,k,j]),t.useImperativeHandle(l,()=>({collapse:()=>{S(N.current)},expand:e=>{C(N.current,e)},getId(){return M},getSize(){return w(N.current)},isCollapsed(){return D(N.current)},isExpanded(){return!D(N.current)},resize:e=>{A(N.current,e)}}),[S,C,w,D,M,A]);let P=T(N.current,s);return t.createElement(y,{...b,children:e,className:n,id:M,style:{...P,...v},[o.groupId]:E,[o.panel]:``,[o.panelCollapsible]:i||void 0,[o.panelId]:M,[o.panelSize]:parseFloat(``+P.flexGrow).toFixed(1)})}var m=t.forwardRef((e,n)=>t.createElement(p,{...e,forwardedRef:n}));p.displayName=`Panel`,m.displayName=`forwardRef(Panel)`;var h;function g(){return h}var _=null,v=!0,y=-1,b=null;function x(e,t){if(t){let e=(t&ne)!==0,n=(t&re)!==0,r=(t&ie)!==0,i=(t&L)!==0;if(e)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}switch(e){case`horizontal`:return`ew-resize`;case`intersection`:return`move`;case`vertical`:return`ns-resize`}}function S(){b!==null&&(document.head.removeChild(b),_=null,b=null,y=-1)}function C(e,t){if(!v)return;let n=x(e,t);if(_!==n){if(_=n,b===null){b=document.createElement(`style`);let e=g();e&&b.setAttribute(`nonce`,e),document.head.appendChild(b)}if(y>=0){var r;(r=b.sheet)==null||r.removeRule(y)}y=b.sheet?.insertRule(`*{cursor: ${n} !important;}`)??-1}}function T(e){return e.type===`keydown`}function E(e){return e.type.startsWith(`pointer`)}function D(e){return e.type.startsWith(`mouse`)}function O(e){if(E(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(D(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function k(){if(typeof matchMedia==`function`)return matchMedia(`(pointer:coarse)`).matches?`coarse`:`fine`}function A(e,t,n){return n?e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y:e.x<=t.x+t.width&&e.x+e.width>=t.x&&e.y<=t.y+t.height&&e.y+e.height>=t.y}function j(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:ee(e),b:ee(t)},r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;V(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:I(F(n.a)),b:I(F(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var M=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function N(e){let t=getComputedStyle(te(e)??e).display;return t===`flex`||t===`inline-flex`}function P(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||N(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||M.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function F(e){let t=e.length;for(;t--;){let n=e[t];if(V(n,`Missing node`),P(n))return n}return null}function I(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ee(e){let t=[];for(;e;)t.push(e),e=te(e);return t}function te(e){let{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}var ne=1,re=2,ie=4,L=8,R=k()===`coarse`,z=[],ae=!1,oe=new Map,se=new Map,ce=new Set;function le(e,t,n,r,i){let{ownerDocument:a}=t,o={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:i},s=oe.get(a)??0;return oe.set(a,s+1),ce.add(o),B(),function(){se.delete(e),ce.delete(o);let t=oe.get(a)??1;if(oe.set(a,t-1),B(),t===1&&oe.delete(a),z.includes(o)){let e=z.indexOf(o);e>=0&&z.splice(e,1),ge(),i(`up`,!0,null)}}}function ue(e){let{target:t}=e,{x:n,y:r}=O(e);ae=!0,me({target:t,x:n,y:r}),B(),z.length>0&&(ve(`down`,e),e.preventDefault(),pe(t)||e.stopImmediatePropagation())}function de(e){let{x:t,y:n}=O(e);if(ae&&e.buttons===0&&(ae=!1,ve(`up`,e)),!ae){let{target:r}=e;me({target:r,x:t,y:n})}ve(`move`,e),ge(),z.length>0&&e.preventDefault()}function fe(e){let{target:t}=e,{x:n,y:r}=O(e);se.clear(),ae=!1,z.length>0&&(e.preventDefault(),pe(t)||e.stopImmediatePropagation()),ve(`up`,e),me({target:t,x:n,y:r}),ge(),B()}function pe(e){let t=e;for(;t;){if(t.hasAttribute(o.resizeHandle))return!0;t=t.parentElement}return!1}function me({target:e,x:t,y:n}){z.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),ce.forEach(e=>{let{element:i,hitAreaMargins:a}=e,o=i.getBoundingClientRect(),{bottom:s,left:c,right:l,top:u}=o,d=R?a.coarse:a.fine;if(t>=c-d&&t<=l+d&&n>=u-d&&n<=s+d){if(r!==null&&document.contains(r)&&i!==r&&!i.contains(r)&&!r.contains(i)&&j(r,i)>0){let e=r,t=!1;for(;e&&!e.contains(i);){if(A(e.getBoundingClientRect(),o,!0)){t=!0;break}e=e.parentElement}if(t)return}z.push(e)}})}function he(e,t){se.set(e,t)}function ge(){let e=!1,t=!1;z.forEach(n=>{let{direction:r}=n;r===`horizontal`?e=!0:t=!0});let n=0;se.forEach(e=>{n|=e}),e&&t?C(`intersection`,n):e?C(`horizontal`,n):t?C(`vertical`,n):S()}var _e=new AbortController;function B(){_e.abort(),_e=new AbortController;let e={capture:!0,signal:_e.signal};ce.size&&(ae?(z.length>0&&oe.forEach((t,n)=>{let{body:r}=n;t>0&&(r.addEventListener(`contextmenu`,fe,e),r.addEventListener(`pointerleave`,de,e),r.addEventListener(`pointermove`,de,e))}),window.addEventListener(`pointerup`,fe,e),window.addEventListener(`pointercancel`,fe,e)):oe.forEach((t,n)=>{let{body:r}=n;t>0&&(r.addEventListener(`pointerdown`,ue,e),r.addEventListener(`pointermove`,de,e))}))}function ve(e,t){ce.forEach(n=>{let{setResizeHandlerState:r}=n;r(e,z.includes(n),t)})}function ye(){let[e,n]=t.useState(0);return t.useCallback(()=>n(e=>e+1),[])}function V(e,t){if(!e)throw console.error(t),Error(t)}function be(e,t,n=s){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function H(e,t,n=s){return be(e,t,n)===0}function xe(e,t,n){return be(e,t,n)===0}function Se(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],a=t[r];if(!xe(i,a,n))return!1}return!0}function Ce({panelConstraints:e,panelIndex:t,size:n}){let r=e[t];V(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,maxSize:o=100,minSize:c=0}=r;if(be(n,c)<0)if(a){let e=(i+c)/2;n=be(n,e)<0?i:c}else n=c;return n=Math.min(o,n),n=parseFloat(n.toFixed(s)),n}function we({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(xe(e,0))return t;let o=[...t],[s,c]=r;V(s!=null,`Invalid first pivot index`),V(c!=null,`Invalid second pivot index`);let l=0;if(a===`keyboard`){{let r=e<0?c:s,i=n[r];V(i,`Panel constraints not found for index ${r}`);let{collapsedSize:a=0,collapsible:o,minSize:l=0}=i;if(o){let n=t[r];if(V(n!=null,`Previous layout not found for panel index ${r}`),xe(n,a)){let t=l-n;be(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let r=e<0?s:c,i=n[r];V(i,`No panel constraints found for index ${r}`);let{collapsedSize:a=0,collapsible:o,minSize:l=0}=i;if(o){let n=t[r];if(V(n!=null,`Previous layout not found for panel index ${r}`),xe(n,l)){let t=n-a;be(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{let r=e<0?1:-1,i=e<0?c:s,a=0;for(;;){let e=t[i];V(e!=null,`Previous layout not found for panel index ${i}`);let o=Ce({panelConstraints:n,panelIndex:i,size:100})-e;if(a+=o,i+=r,i<0||i>=n.length)break}let o=Math.min(Math.abs(e),Math.abs(a));e=e<0?0-o:o}{let r=e<0?s:c;for(;r>=0&&r<n.length;){let i=Math.abs(e)-Math.abs(l),a=t[r];V(a!=null,`Previous layout not found for panel index ${r}`);let s=a-i,c=Ce({panelConstraints:n,panelIndex:r,size:s});if(!xe(a,c)&&(l+=a-c,o[r]=c,l.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?r--:r++}}if(Se(i,o))return i;{let r=e<0?c:s,i=t[r];V(i!=null,`Previous layout not found for panel index ${r}`);let a=i+l,u=Ce({panelConstraints:n,panelIndex:r,size:a});if(o[r]=u,!xe(u,a)){let t=a-u,r=e<0?c:s;for(;r>=0&&r<n.length;){let i=o[r];V(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Ce({panelConstraints:n,panelIndex:r,size:a});if(xe(i,s)||(t-=s-i,o[r]=s),xe(t,0))break;e>0?r--:r++}}}return xe(o.reduce((e,t)=>t+e,0),100)?o:i}function Te({layout:e,panelsArray:t,pivotIndices:n}){let r=0,i=100,a=0,o=0,s=n[0];return V(s!=null,`No pivot index found`),t.forEach((e,t)=>{let{constraints:n}=e,{maxSize:c=100,minSize:l=0}=n;t===s?(r=l,i=c):(a+=l,o+=c)}),{valueMax:Math.min(i,100-a),valueMin:Math.max(r,100-o),valueNow:e[s]}}function Ee(e,t=document){return Array.from(t.querySelectorAll(`[${o.resizeHandleId}][data-panel-group-id="${e}"]`))}function De(e,t,n=document){return Ee(e,n).findIndex(e=>e.getAttribute(o.resizeHandleId)===t)??null}function Oe(e,t,n){let r=De(e,t,n);return r==null?[-1,-1]:[r,r+1]}function ke(e,t=document){return t instanceof HTMLElement&&t?.dataset?.panelGroupId==e?t:t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`)||null}function Ae(e,t=document){return t.querySelector(`[${o.resizeHandleId}="${e}"]`)||null}function je(e,t,n,r=document){let i=Ae(t,r),a=Ee(e,r),o=i?a.indexOf(i):-1;return[n[o]?.id??null,n[o+1]?.id??null]}function Me({committedValuesRef:e,eagerValuesRef:n,groupId:r,layout:i,panelDataArray:a,panelGroupElement:s,setLayout:l}){t.useRef({didWarnAboutMissingResizeHandle:!1}),c(()=>{if(!s)return;let e=Ee(r,s);for(let t=0;t<a.length-1;t++){let{valueMax:n,valueMin:r,valueNow:o}=Te({layout:i,panelsArray:a,pivotIndices:[t,t+1]}),s=e[t];if(s!=null){let e=a[t];V(e,`No panel data found for index "${t}"`),s.setAttribute(`aria-controls`,e.id),s.setAttribute(`aria-valuemax`,``+Math.round(n)),s.setAttribute(`aria-valuemin`,``+Math.round(r)),s.setAttribute(`aria-valuenow`,o==null?``:``+Math.round(o))}}return()=>{e.forEach((e,t)=>{e.removeAttribute(`aria-controls`),e.removeAttribute(`aria-valuemax`),e.removeAttribute(`aria-valuemin`),e.removeAttribute(`aria-valuenow`)})}},[r,i,a,s]),t.useEffect(()=>{if(!s)return;let e=n.current;V(e,`Eager values not found`);let{panelDataArray:t}=e;V(ke(r,s)!=null,`No group found for id "${r}"`);let a=Ee(r,s);V(a,`No resize handles found for group id "${r}"`);let c=a.map(e=>{let n=e.getAttribute(o.resizeHandleId);V(n,`Resize handle element has no handle id attribute`);let[a,c]=je(r,n,t,s);if(a==null||c==null)return()=>{};let u=e=>{if(!e.defaultPrevented)switch(e.key){case`Enter`:{e.preventDefault();let o=t.findIndex(e=>e.id===a);if(o>=0){let e=t[o];V(e,`No panel data found for index ${o}`);let a=i[o],{collapsedSize:c=0,collapsible:u,minSize:d=0}=e.constraints;if(a!=null&&u){let e=we({delta:xe(a,c)?d-c:c-a,initialLayout:i,panelConstraints:t.map(e=>e.constraints),pivotIndices:Oe(r,n,s),prevLayout:i,trigger:`keyboard`});i!==e&&l(e)}}break}}};return e.addEventListener(`keydown`,u),()=>{e.removeEventListener(`keydown`,u)}});return()=>{c.forEach(e=>e())}},[s,e,n,r,i,a,l])}function Ne(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Pe(e,t){let n=e===`horizontal`,{x:r,y:i}=O(t);return n?r:i}function Fe(e,t,n,r,i){let a=n===`horizontal`,s=Ae(t,i);V(s,`No resize handle element found for id "${t}"`);let c=s.getAttribute(o.groupId);V(c,`Resize handle element has no group id attribute`);let{initialCursorPosition:l}=r,u=Pe(n,e),d=ke(c,i);V(d,`No group element found for id "${c}"`);let f=d.getBoundingClientRect(),p=a?f.width:f.height;return(u-l)/p*100}function Ie(e,t,n,r,i,a){if(T(e)){let t=n===`horizontal`,r=0;r=e.shiftKey?100:i??10;let a=0;switch(e.key){case`ArrowDown`:a=t?0:r;break;case`ArrowLeft`:a=t?-r:0;break;case`ArrowRight`:a=t?r:0;break;case`ArrowUp`:a=t?0:-r;break;case`End`:a=100;break;case`Home`:a=-100;break}return a}else return r==null?0:Fe(e,t,n,r,a)}function Le({panelDataArray:e}){let t=Array(e.length),n=e.map(e=>e.constraints),r=0,i=100;for(let a=0;a<e.length;a++){let e=n[a];V(e,`Panel constraints not found for index ${a}`);let{defaultSize:o}=e;o!=null&&(r++,t[a]=o,i-=o)}for(let a=0;a<e.length;a++){let o=n[a];V(o,`Panel constraints not found for index ${a}`);let{defaultSize:s}=o;if(s!=null)continue;let c=e.length-r,l=i/c;r++,t[a]=l,i-=l}return t}function Re(e,t,n){t.forEach((t,r)=>{let i=e[r];V(i,`Panel data not found for index ${r}`);let{callbacks:a,constraints:o,id:s}=i,{collapsedSize:c=0,collapsible:l}=o,u=n[s];if(u==null||t!==u){n[s]=t;let{onCollapse:e,onExpand:r,onResize:i}=a;i&&i(t,u),l&&(e||r)&&(r&&(u==null||H(u,c))&&!H(t,c)&&r(),e&&(u==null||!H(u,c))&&H(t,c)&&e())}})}function ze(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Be({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:i,precision:a=3}){let o=n[i],s;return s=o==null?e==null?`1`:e.toPrecision(a):r.length===1?`1`:o.toPrecision(a),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:`hidden`,pointerEvents:t===null?void 0:`none`}}function Ve(e,t=10){let n=null;return(...r)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...r)},t)}}function He(e){try{if(typeof localStorage<`u`)e.getItem=e=>localStorage.getItem(e),e.setItem=(e,t)=>{localStorage.setItem(e,t)};else throw Error(`localStorage not supported in this environment`)}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function Ue(e){return`react-resizable-panels:${e}`}function We(e){return e.map(e=>{let{constraints:t,id:n,idIsFromProps:r,order:i}=e;return r?n:i?`${i}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(`,`)}function Ge(e,t){try{let n=Ue(e),r=t.getItem(n);if(r){let e=JSON.parse(r);if(typeof e==`object`&&e)return e}}catch{}return null}function Ke(e,t,n){return(Ge(e,n)??{})[We(t)]??null}function qe(e,t,n,r,i){let a=Ue(e),o=We(t),s=Ge(e,i)??{};s[o]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{i.setItem(a,JSON.stringify(s))}catch(e){console.error(e)}}function Je({layout:e,panelConstraints:t}){let n=[...e],r=n.reduce((e,t)=>e+t,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(e=>`${e}%`).join(`, `)}`);if(!xe(r,100)&&n.length>0)for(let e=0;e<t.length;e++){let t=n[e];V(t!=null,`No layout data found for index ${e}`),n[e]=100/r*t}let i=0;for(let e=0;e<t.length;e++){let r=n[e];V(r!=null,`No layout data found for index ${e}`);let a=Ce({panelConstraints:t,panelIndex:e,size:r});r!=a&&(i+=r-a,n[e]=a)}if(!xe(i,0))for(let e=0;e<t.length;e++){let r=n[e];V(r!=null,`No layout data found for index ${e}`);let a=r+i,o=Ce({panelConstraints:t,panelIndex:e,size:a});if(r!==o&&(i-=o-r,n[e]=o,xe(i,0)))break}return n}var Ye=100,Xe={getItem:e=>(He(Xe),Xe.getItem(e)),setItem:(e,t)=>{He(Xe),Xe.setItem(e,t)}},Ze={};function U({autoSaveId:e=null,children:n,className:r=``,direction:i,forwardedRef:s,id:l=null,onLayout:u=null,keyboardResizeBy:d=null,storage:p=Xe,style:m,tagName:h=`div`,...g}){let _=f(l),v=t.useRef(null),[y,b]=t.useState(null),[x,S]=t.useState([]),C=ye(),w=t.useRef({}),O=t.useRef(new Map),k=t.useRef(0),A=t.useRef({autoSaveId:e,direction:i,dragState:y,id:_,keyboardResizeBy:d,onLayout:u,storage:p}),j=t.useRef({layout:x,panelDataArray:[],panelDataArrayChanged:!1});t.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),t.useImperativeHandle(s,()=>({getId:()=>A.current.id,getLayout:()=>{let{layout:e}=j.current;return e},setLayout:e=>{let{onLayout:t}=A.current,{layout:n,panelDataArray:r}=j.current,i=Je({layout:e,panelConstraints:r.map(e=>e.constraints)});Ne(n,i)||(S(i),j.current.layout=i,t&&t(i),Re(r,i,w.current))}}),[]),c(()=>{A.current.autoSaveId=e,A.current.direction=i,A.current.dragState=y,A.current.id=_,A.current.onLayout=u,A.current.storage=p}),Me({committedValuesRef:A,eagerValuesRef:j,groupId:_,layout:x,panelDataArray:j.current.panelDataArray,setLayout:S,panelGroupElement:v.current}),t.useEffect(()=>{let{panelDataArray:t}=j.current;if(e){if(x.length===0||x.length!==t.length)return;let n=Ze[e];n??(n=Ve(qe,Ye),Ze[e]=n);let r=[...t],i=new Map(O.current);n(e,r,i,x,p)}},[e,x,p]),t.useEffect(()=>{});let M=t.useCallback(e=>{let{onLayout:t}=A.current,{layout:n,panelDataArray:r}=j.current;if(e.constraints.collapsible){let i=r.map(e=>e.constraints),{collapsedSize:a=0,panelSize:o,pivotIndices:s}=$e(r,e,n);if(V(o!=null,`Panel size not found for panel "${e.id}"`),!H(o,a)){O.current.set(e.id,o);let c=we({delta:Qe(r,e)===r.length-1?o-a:a-o,initialLayout:n,panelConstraints:i,pivotIndices:s,prevLayout:n,trigger:`imperative-api`});ze(n,c)||(S(c),j.current.layout=c,t&&t(c),Re(r,c,w.current))}}},[]),N=t.useCallback((e,t)=>{let{onLayout:n}=A.current,{layout:r,panelDataArray:i}=j.current;if(e.constraints.collapsible){let a=i.map(e=>e.constraints),{collapsedSize:o=0,panelSize:s=0,minSize:c=0,pivotIndices:l}=$e(i,e,r),u=t??c;if(H(s,o)){let t=O.current.get(e.id),o=t!=null&&t>=u?t:u,c=we({delta:Qe(i,e)===i.length-1?s-o:o-s,initialLayout:r,panelConstraints:a,pivotIndices:l,prevLayout:r,trigger:`imperative-api`});ze(r,c)||(S(c),j.current.layout=c,n&&n(c),Re(i,c,w.current))}}},[]),P=t.useCallback(e=>{let{layout:t,panelDataArray:n}=j.current,{panelSize:r}=$e(n,e,t);return V(r!=null,`Panel size not found for panel "${e.id}"`),r},[]),F=t.useCallback((e,t)=>{let{panelDataArray:n}=j.current;return Be({defaultSize:t,dragState:y,layout:x,panelData:n,panelIndex:Qe(n,e)})},[y,x]),I=t.useCallback(e=>{let{layout:t,panelDataArray:n}=j.current,{collapsedSize:r=0,collapsible:i,panelSize:a}=$e(n,e,t);return V(a!=null,`Panel size not found for panel "${e.id}"`),i===!0&&H(a,r)},[]),ee=t.useCallback(e=>{let{layout:t,panelDataArray:n}=j.current,{collapsedSize:r=0,collapsible:i,panelSize:a}=$e(n,e,t);return V(a!=null,`Panel size not found for panel "${e.id}"`),!i||be(a,r)>0},[]),te=t.useCallback(e=>{let{panelDataArray:t}=j.current;t.push(e),t.sort((e,t)=>{let n=e.order,r=t.order;return n==null&&r==null?0:n==null?-1:r==null?1:n-r}),j.current.panelDataArrayChanged=!0,C()},[C]);c(()=>{if(j.current.panelDataArrayChanged){j.current.panelDataArrayChanged=!1;let{autoSaveId:e,onLayout:t,storage:n}=A.current,{layout:r,panelDataArray:i}=j.current,a=null;if(e){let t=Ke(e,i,n);t&&(O.current=new Map(Object.entries(t.expandToSizes)),a=t.layout)}a??=Le({panelDataArray:i});let o=Je({layout:a,panelConstraints:i.map(e=>e.constraints)});Ne(r,o)||(S(o),j.current.layout=o,t&&t(o),Re(i,o,w.current))}}),c(()=>{let e=j.current;return()=>{e.layout=[]}},[]);let R=t.useCallback(e=>{let t=!1,n=v.current;return n&&window.getComputedStyle(n,null).getPropertyValue(`direction`)===`rtl`&&(t=!0),function(n){n.preventDefault();let r=v.current;if(!r)return()=>null;let{direction:i,dragState:a,id:o,keyboardResizeBy:s,onLayout:c}=A.current,{layout:l,panelDataArray:u}=j.current,{initialLayout:d}=a??{},f=Oe(o,e,r),p=Ie(n,e,i,a,s,r),m=i===`horizontal`;m&&t&&(p=-p);let h=u.map(e=>e.constraints),g=we({delta:p,initialLayout:d??l,panelConstraints:h,pivotIndices:f,prevLayout:l,trigger:T(n)?`keyboard`:`mouse-or-touch`}),_=!ze(l,g);(E(n)||D(n))&&k.current!=p&&(k.current=p,!_&&p!==0?m?he(e,p<0?ne:re):he(e,p<0?ie:L):he(e,0)),_&&(S(g),j.current.layout=g,c&&c(g),Re(u,g,w.current))}},[]),z=t.useCallback((e,t)=>{let{onLayout:n}=A.current,{layout:r,panelDataArray:i}=j.current,a=i.map(e=>e.constraints),{panelSize:o,pivotIndices:s}=$e(i,e,r);V(o!=null,`Panel size not found for panel "${e.id}"`);let c=we({delta:Qe(i,e)===i.length-1?o-t:t-o,initialLayout:r,panelConstraints:a,pivotIndices:s,prevLayout:r,trigger:`imperative-api`});ze(r,c)||(S(c),j.current.layout=c,n&&n(c),Re(i,c,w.current))},[]),ae=t.useCallback((e,t)=>{let{layout:n,panelDataArray:r}=j.current,{collapsedSize:i=0,collapsible:a}=t,{collapsedSize:o=0,collapsible:s,maxSize:c=100,minSize:l=0}=e.constraints,{panelSize:u}=$e(r,e,n);u!=null&&(a&&s&&H(u,i)?H(i,o)||z(e,o):u<l?z(e,l):u>c&&z(e,c))},[z]),oe=t.useCallback((e,t)=>{let{direction:n}=A.current,{layout:r}=j.current;if(!v.current)return;let i=Ae(e,v.current);V(i,`Drag handle element not found for id "${e}"`);let a=Pe(n,t);b({dragHandleId:e,dragHandleRect:i.getBoundingClientRect(),initialCursorPosition:a,initialLayout:r})},[]),se=t.useCallback(()=>{b(null)},[]),ce=t.useCallback(e=>{let{panelDataArray:t}=j.current,n=Qe(t,e);n>=0&&(t.splice(n,1),delete w.current[e.id],j.current.panelDataArrayChanged=!0,C())},[C]),le=t.useMemo(()=>({collapsePanel:M,direction:i,dragState:y,expandPanel:N,getPanelSize:P,getPanelStyle:F,groupId:_,isPanelCollapsed:I,isPanelExpanded:ee,reevaluatePanelConstraints:ae,registerPanel:te,registerResizeHandle:R,resizePanel:z,startDragging:oe,stopDragging:se,unregisterPanel:ce,panelGroupElement:v.current}),[M,y,i,N,P,F,_,I,ee,ae,te,R,z,oe,se,ce]),ue={display:`flex`,flexDirection:i===`horizontal`?`row`:`column`,height:`100%`,overflow:`hidden`,width:`100%`};return t.createElement(a.Provider,{value:le},t.createElement(h,{...g,children:n,className:r,id:l,ref:v,style:{...ue,...m},[o.group]:``,[o.groupDirection]:i,[o.groupId]:_}))}var W=t.forwardRef((e,n)=>t.createElement(U,{...e,forwardedRef:n}));U.displayName=`PanelGroup`,W.displayName=`forwardRef(PanelGroup)`;function Qe(e,t){return e.findIndex(e=>e===t||e.id===t.id)}function $e(e,t,n){let r=Qe(e,t),i=r===e.length-1?[r-1,r]:[r,r+1],a=n[r];return{...t.constraints,panelSize:a,pivotIndices:i}}function et({disabled:e,handleId:n,resizeHandler:r,panelGroupElement:i}){t.useEffect(()=>{if(e||r==null||i==null)return;let t=Ae(n,i);if(t==null)return;let a=e=>{if(!e.defaultPrevented)switch(e.key){case`ArrowDown`:case`ArrowLeft`:case`ArrowRight`:case`ArrowUp`:case`End`:case`Home`:e.preventDefault(),r(e);break;case`F6`:{e.preventDefault();let r=t.getAttribute(o.groupId);V(r,`No group element found for id "${r}"`);let a=Ee(r,i),s=De(r,n,i);V(s!==null,`No resize element found for id "${n}"`),a[e.shiftKey?s>0?s-1:a.length-1:s+1<a.length?s+1:0].focus();break}}};return t.addEventListener(`keydown`,a),()=>{t.removeEventListener(`keydown`,a)}},[i,e,n,r])}function tt({children:e=null,className:n=``,disabled:r=!1,hitAreaMargins:i,id:s,onBlur:l,onClick:u,onDragging:d,onFocus:p,onPointerDown:m,onPointerUp:h,style:g={},tabIndex:_=0,tagName:v=`div`,...y}){let b=t.useRef(null),x=t.useRef({onClick:u,onDragging:d,onPointerDown:m,onPointerUp:h});t.useEffect(()=>{x.current.onClick=u,x.current.onDragging=d,x.current.onPointerDown=m,x.current.onPointerUp=h});let S=t.useContext(a);if(S===null)throw Error(`PanelResizeHandle components must be rendered within a PanelGroup container`);let{direction:C,groupId:w,registerResizeHandle:T,startDragging:E,stopDragging:D,panelGroupElement:O}=S,k=f(s),[A,j]=t.useState(`inactive`),[M,N]=t.useState(!1),[P,F]=t.useState(null),I=t.useRef({state:A});c(()=>{I.current.state=A}),t.useEffect(()=>{if(r)F(null);else{let e=T(k);F(()=>e)}},[r,k,T]);let ee=i?.coarse??15,te=i?.fine??5;t.useEffect(()=>{if(r||P==null)return;let e=b.current;V(e,`Element ref not attached`);let t=!1;return le(k,e,C,{coarse:ee,fine:te},(e,n,r)=>{if(!n){j(`inactive`);return}switch(e){case`down`:{j(`drag`),t=!1,V(r,`Expected event to be defined for "down" action`),E(k,r);let{onDragging:e,onPointerDown:n}=x.current;e?.(!0),n?.();break}case`move`:{let{state:e}=I.current;t=!0,e!==`drag`&&j(`hover`),V(r,`Expected event to be defined for "move" action`),P(r);break}case`up`:{j(`hover`),D();let{onClick:e,onDragging:n,onPointerUp:r}=x.current;n?.(!1),r?.(),t||e?.();break}}})},[ee,C,r,te,T,k,P,E,D]),et({disabled:r,handleId:k,resizeHandler:P,panelGroupElement:O});let ne={touchAction:`none`,userSelect:`none`};return t.createElement(v,{...y,children:e,className:n,id:s,onBlur:()=>{N(!1),l?.()},onFocus:()=>{N(!0),p?.()},ref:b,role:`separator`,style:{...ne,...g},tabIndex:_,[o.groupDirection]:C,[o.groupId]:w,[o.resizeHandle]:``,[o.resizeHandleActive]:A===`drag`?`pointer`:M?`keyboard`:void 0,[o.resizeHandleEnabled]:!r,[o.resizeHandleId]:k,[o.resizeHandleState]:A})}tt.displayName=`PanelResizeHandle`,e.Panel=m,e.PanelGroup=W,e.PanelResizeHandle=tt}))(),Vo=`max-w-[180px]`;function Ho({label:e,secondaryLabel:t=null,title:n,isActive:r,onSelect:i,labelMaxWidthClass:a=Vo,closeAction:o}){let s=o!==null;return(0,q.jsxs)(`div`,{className:R(`inline-flex h-7 shrink-0 items-center rounded-md text-xs transition-colors`,r?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/60`),children:[(0,q.jsxs)(`button`,{type:`button`,onClick:i,"aria-pressed":r,title:n,className:R(`flex h-full min-w-0 items-center rounded-l-md pl-2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,s?`pr-1`:`rounded-r-md pr-2`),children:[(0,q.jsx)(`span`,{className:R(`truncate`,a),children:e}),t?(0,q.jsx)(`span`,{className:`ml-1 shrink-0 text-muted-foreground/80`,children:t}):null]}),o?(0,q.jsx)(`button`,{type:`button`,onClick:o.onClose,disabled:o.isClosing,"aria-label":o.closeLabel,title:o.closeTooltip,className:`mr-1 ml-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded opacity-70 transition-opacity hover:bg-muted-foreground/15 hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-30`,children:o.isClosing?(0,q.jsx)(L,{name:`Spinner`,className:`size-3 animate-spin`}):(0,q.jsx)(L,{name:`X`,className:`size-3`})}):null]})}var Uo=`uncommitted`;function Wo(e,t){if(e===`uncommitted`)return{type:`uncommitted`};if(e)return{type:`commit`,sha:e};if(t)return{type:`all`,mergeBaseBranch:t}}function Go(e,t={hasUncommittedChanges:!1}){let n={value:`all`,label:`All changes`},r={value:Uo,label:`Uncommitted changes`},i=e.map(e=>({value:e.sha,label:e.subject,monoPrefix:e.shortSha}));return e.length>0||t.hasUncommittedChanges?[n,...t.hasUncommittedChanges?[r]:[],...i]:[n]}function Ko(e,t,n={hasUncommittedChanges:!1}){return e?e===`uncommitted`?!n.hasUncommittedChanges:!t.some(t=>t.sha===e):!1}function qo(e){let t=e.currentGitDiff.trim().length>0,n=$t(e.currentGitDiff),r=e.parsedGitDiffFileCount>0,i=t&&e.lastParsedGitDiffKey!==n;return{currentGitDiffKey:n,hasCurrentGitDiff:t,hasParsedGitDiffFiles:r,isAwaitingCurrentGitDiffParse:i,isPreparingGitDiff:!r&&(e.isAwaitingPrerequisites||e.isGitDiffLoading||e.isParsingGitDiffFiles||i)}}function Jo({entry:e,expectedFileCount:t}){return t>10?!0:Ht(e.fileDiff)===`deleted`}function Yo({bulkCollapsePreference:e,currentCollapsedFileKeys:t,expectedFileCount:n,focusedFileKey:r,parsedGitDiffFileEntries:i,previousFileKeys:a}){if(e===`expanded-all`)return new Set;let o=new Set;for(let s of i){if(r!==null){s.key!==r&&o.add(s.key);continue}if(e===`collapsed-all`){o.add(s.key);continue}if(a.has(s.key)){t.has(s.key)&&o.add(s.key);continue}Jo({entry:s,expectedFileCount:n})&&o.add(s.key)}return o}function Xo(e){let t=$t(e.gitDiff);if(!e.isDiffPanelActive||e.gitDiff.trim().length===0)return{kind:`reset`,gitDiffKey:t,patchChunks:[]};let n=sn(e.gitDiff);return n.length===0?{kind:`empty`,gitDiffKey:t,patchChunks:[]}:n.length<=24?{kind:`immediate`,gitDiffKey:t,patchChunks:n}:{kind:`batched`,gitDiffKey:t,patchChunks:n}}var Zo=150,Qo=4,$o=6,es=30,ts=70;function ns(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function rs({environmentId:e,gitDiffIdentity:t,expectedGitDiffFileCount:n,parsedGitDiffFileEntries:r,isDiffPanelActive:i,isParsingGitDiffFiles:a}){let o=xr((0,K.useCallback)(e=>e(la),[])),s=rt(la),c=rt(ua),l=(0,K.useRef)(new Map),u=(0,K.useRef)(new Map),d=(0,K.useRef)(`default`),f=(0,K.useRef)(null),p=(0,K.useRef)(new Set),m=(0,K.useRef)(new Set),h=(0,K.useRef)(new Map),g=(0,K.useCallback)(e=>{let t=u.current.get(e);if(t===void 0)return;u.current.delete(e);let n=l.current.get(t);n&&(n.delete(e),n.size===0&&(window.clearTimeout(t),l.current.delete(t)))},[]),_=(0,K.useCallback)(()=>{for(let e of l.current.keys())window.clearTimeout(e);l.current.clear(),u.current.clear()},[]);(0,K.useLayoutEffect)(()=>{_(),d.current=`default`,f.current=null,p.current=new Set,m.current.clear(),s(new Set),c(new Set)},[e,t,_,s,c]),(0,K.useEffect)(()=>()=>{_(),m.current.clear()},[_]);let v=(0,K.useCallback)((e,t)=>{if(e.length===0)return;let n=[],r=new Set;for(let t of e)r.has(t)||(r.add(t),n.push(t));if(n.length===0)return;let i=Math.max(1,Math.min(t?.initialBatchSize??n.length,n.length)),a=Math.max(1,t?.batchSize??n.length),o=Math.max(0,t?.initialDelayMs??Zo),s=Math.max(0,t?.batchDelayMs??Zo);c(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)g(e);let d=(e,t)=>{let n=new Set(e),r=0;r=window.setTimeout(()=>{let e=l.current.get(r);if(e){l.current.delete(r);for(let t of e)u.current.delete(t);c(t=>{let n=!1,r=new Set(t);for(let t of e)n=r.delete(t)||n;return n?r:t})}},t),l.current.set(r,n);for(let e of n)u.current.set(e,r)};d(n.slice(0,i),o);let f=0;for(let e=i;e<n.length;e+=a){let t=o+(f+1)*s;d(n.slice(e,e+a),t),f+=1}},[g,c]);(0,K.useLayoutEffect)(()=>{if(!i)return;if(r.length===0&&!a&&n===0){p.current=new Set,m.current.clear(),s(e=>e.size===0?e:new Set),c(e=>e.size===0?e:new Set),_();return}if(r.length===0)return;let e=new Set(r.map(({key:e})=>e));f.current!==null&&!e.has(f.current)&&(f.current=null);for(let t of m.current)e.has(t)||m.current.delete(t);let t=Yo({bulkCollapsePreference:d.current,currentCollapsedFileKeys:o(),expectedFileCount:n,focusedFileKey:f.current,parsedGitDiffFileEntries:r,previousFileKeys:p.current});p.current=e,s(e=>ns(e,t)?e:t);let l=[];for(let{key:e}of r)m.current.has(e)||(m.current.add(e),t.has(e)||l.push(e));l.length!==0&&v(l,n>10||a||l.length>Qo?{initialBatchSize:Qo,initialDelayMs:es,batchSize:$o,batchDelayMs:ts}:void 0)},[_,n,o,i,a,r,v,s,c]);let y=(0,K.useCallback)(e=>{d.current=`default`,f.current=null;let t=o().has(e);if(s(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),t){v([e]);return}g(e),c(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[g,v,s,c,o]),b=(0,K.useCallback)(e=>{if(r.length===0)return;let t=r.map(({key:e})=>e);if(!t.includes(e))return;d.current=`default`,f.current=e,m.current.add(e);let n=o().has(e);for(let n of t)n!==e&&g(n);s(new Set(t.filter(t=>t!==e))),c(t=>{let n=!1,r=new Set(t);for(let i of t)i!==e&&(n=r.delete(i)||n);return n?r:t}),n&&v([e])},[g,o,r,v,s,c]),x=(0,K.useCallback)(()=>{if(r.length===0)return;let e=r.map(({key:e})=>e),t=o();if(e.every(e=>t.has(e))){d.current=`expanded-all`,f.current=null,s(new Set),v(e);return}d.current=`collapsed-all`,f.current=null,_(),s(new Set(e)),c(new Set)},[_,r,v,s,c,o]),S=(0,K.useCallback)((e,t)=>{if(t){h.current.set(e,t);return}h.current.delete(e)},[]);return{focusGitDiffFile:b,gitDiffFileRefs:h,queuedGitDiffFileRenderKeys:m.current,setGitDiffFileRef:S,toggleAllGitDiffFilesCollapsed:x,toggleGitDiffFileCollapsed:y}}function is({environmentId:e,isDiffPanelActive:t,defaultMergeBaseBranch:n}){let r=dt(da),i=dt(fa),a=rt(fa),o=dt(la),s=dt(ua),c=(0,K.useRef)(null),[l,u]=(0,K.useState)(null),[d,f]=(0,K.useState)([]),[p,m]=(0,K.useState)(0),[h,g]=(0,K.useState)(!1),[_,v]=(0,K.useState)(``),[y,b]=(0,K.useState)(null),x=r??n,S=(0,K.useMemo)(()=>Wo(l,x),[x,l]),w=(0,K.useMemo)(()=>os({environmentId:e,target:S}),[e,S]),{data:T}=hi(e??``,x,{enabled:!!e&&!!x&&t}),{data:E,isLoading:D,isPlaceholderData:O,error:k}=vi(e??``,{enabled:!!e&&t&&S!==void 0,target:S});(0,K.useEffect)(()=>{if(E&&!O){b(e=>e?.requestIdentity===w&&e.response===E?e:{requestIdentity:w,response:E});return}D||b(e=>e?.requestIdentity===w?e:null)},[E,w,D,O]);let A=E&&!O?E:y?.requestIdentity===w?y.response:void 0,j=A?.mergeBaseRef??null,N=(0,K.useMemo)(()=>as({environmentId:e,mergeBaseRef:j,target:S}),[j,e,S]),P=A?.diff??``,F=(0,K.useMemo)(()=>At(d),[d]),{focusGitDiffFile:I,gitDiffFileRefs:te,queuedGitDiffFileRenderKeys:ne,setGitDiffFileRef:re,toggleAllGitDiffFilesCollapsed:ie,toggleGitDiffFileCollapsed:L}=rs({environmentId:e,gitDiffIdentity:N,expectedGitDiffFileCount:p,parsedGitDiffFileEntries:F,isDiffPanelActive:t,isParsingGitDiffFiles:h}),R=qo({currentGitDiff:P,isAwaitingPrerequisites:t&&!!e&&S===void 0,isGitDiffLoading:D,isParsingGitDiffFiles:h,lastParsedGitDiffKey:_,parsedGitDiffFileCount:F.length});(0,K.useEffect)(()=>{let e=Xo({gitDiff:P,isDiffPanelActive:t});if(e.kind===`reset`){f([]),m(0),g(!1),v(``);return}if(f([]),m(e.patchChunks.length),e.kind===`empty`){g(!1),v(e.gitDiffKey);return}if(e.kind===`immediate`){f(_r(P)),g(!1),v(e.gitDiffKey);return}let n=e.patchChunks,r=!1,i=null,a=0,o=!1,s=()=>{if(r)return;let t=a===0?6:18,c=n.slice(a,a+t);if(c.length===0){g(!1),v(e.gitDiffKey);return}let l=wt(c);if(!r){if(a+=c.length,f(e=>o?[...e,...l]:l),o=!0,a>=n.length||r){g(!1),v(e.gitDiffKey);return}i=window.setTimeout(s,24)}};return g(!0),s(),()=>{r=!0,i!==null&&window.clearTimeout(i)}},[P,t]),(0,K.useEffect)(()=>{u(null)},[e]),(0,K.useEffect)(()=>{a(null)},[e,a]),(0,K.useEffect)(()=>{i&&u(null)},[i]);let z=(T?.workingTree.files.length??0)>0;(0,K.useEffect)(()=>{Ko(l,T?.mergeBase?.commits??[],{hasUncommittedChanges:z})&&u(null)},[T?.mergeBase?.commits,z,l]),(0,K.useLayoutEffect)(()=>{if(!i||!t){c.current=null;return}let e=F.find(({fileDiff:e})=>It(e,i));if(!e){!D&&!h&&!R.isAwaitingCurrentGitDiffParse&&a(null);return}if(c.current!==i){c.current=i,I(e.key);return}let n=o.has(e.key),r=!ne.has(e.key)||s.has(e.key);n||r||(te.current.get(e.key)?.scrollIntoView({block:`start`,behavior:`instant`}),a(null))},[o,I,te,R.isAwaitingCurrentGitDiffParse,t,D,h,s,F,i,ne,a]);let ae=(0,K.useMemo)(()=>T?.mergeBase?.commits??[],[T?.mergeBase?.commits]),oe=l??`all`,se=(0,K.useMemo)(()=>Go(ae,{hasUncommittedChanges:z}),[ae,z]),ce=(0,K.useMemo)(()=>Pt(h?[]:d,P),[P,h,d]),{hasParsedGitDiffFiles:le,isPreparingGitDiff:ue}=R,de=(0,K.useCallback)(e=>{u(e===`all`?null:e)},[]),fe=M(),pe=(0,K.useMemo)(()=>cs(S,j),[S,j]);return{currentGitDiff:P,gitDiffError:k,gitDiffSelectOptions:se,gitDiffSelectValue:oe,gitDiffStats:ce,hasParsedGitDiffFiles:le,isGitDiffLoading:D,isParsingGitDiffFiles:h,isPreparingGitDiff:ue,onGitDiffSelectionChange:de,onRequestFileContents:(0,K.useMemo)(()=>{if(!e||pe===void 0)return;let t=e,n=pe,r=ss(n);return async(e,i)=>{let a=await fe.fetchQuery({queryKey:ee(t,n.type,r,e,i),queryFn:()=>C(t,n,e,i),staleTime:5e3});return ls(e,a.content,a.contentEncoding)}},[e,pe,fe]),parsedGitDiffFileEntries:F,queuedGitDiffFileRenderKeys:ne,setGitDiffFileRef:re,threadGitDiff:A,toggleAllGitDiffFilesCollapsed:ie,toggleGitDiffFileCollapsed:L}}function as({environmentId:e,mergeBaseRef:t,target:n}){let r=e??`none`;if(!n)return`${r}:none`;switch(n.type){case`uncommitted`:return`${r}:uncommitted`;case`branch_committed`:return[r,`branch_committed`,n.mergeBaseBranch,t??`pending`].join(`:`);case`all`:return[r,`all`,n.mergeBaseBranch,t??`pending`].join(`:`);case`commit`:return`${r}:commit:${n.sha}`;default:return n}}function os({environmentId:e,target:t}){let n=e??`none`;if(!t)return`${n}:none`;switch(t.type){case`uncommitted`:return`${n}:uncommitted`;case`branch_committed`:return[n,`branch_committed`,t.mergeBaseBranch].join(`:`);case`all`:return[n,`all`,t.mergeBaseBranch].join(`:`);case`commit`:return`${n}:commit:${t.sha}`;default:return t}}function ss(e){switch(e.type){case`uncommitted`:return null;case`branch_committed`:case`all`:return e.mergeBaseRef;case`commit`:return e.sha;default:return e}}function cs(e,t){if(e)switch(e.type){case`uncommitted`:return{type:`uncommitted`};case`branch_committed`:return t?{type:`branch_committed`,mergeBaseRef:t}:void 0;case`all`:return t?{type:`all`,mergeBaseRef:t}:void 0;case`commit`:return{type:`commit`,sha:e.sha};default:return e}}function ls(e,t,n){return n===`utf8`?{name:e,contents:t}:null}var us=760;function ds({isSecondaryPanelOpen:e}){let[t,n]=(0,K.useState)(`unified`),r=rt(sa),i=dt(ca),a=rt(ca),o=(0,K.useRef)(null),s=(0,K.useRef)(null),c=(0,K.useRef)(i),l=(0,K.useRef)(null),u=(0,K.useRef)(!1),d=(0,K.useCallback)(t=>{if(!e||t===void 0)return;let r=t>=us,i=l.current,a=i!==null&&i!==r;if(a&&u.current&&(u.current=!1),!u.current||a){let e=r?`split`:`unified`;n(t=>t===e?t:e)}l.current=r},[e,n]),f=(0,K.useRef)(e);return(0,K.useEffect)(()=>{if(f.current===e)return;f.current=e;let t=s.current;t&&(e?(t.expand(c.current),d(o.current?.getBoundingClientRect().width)):t.collapse())},[e,d]),(0,K.useEffect)(()=>{e||(u.current=!1,l.current=null)},[e]),Qn({ref:o,onResize:({width:e})=>{d(e??o.current?.getBoundingClientRect().width)}}),{gitDiffDisplayMode:t,handleGitDiffDisplayModeChange:(0,K.useCallback)(e=>{u.current=!0,n(e)},[n]),handleSecondaryPanelDragging:(0,K.useCallback)(e=>{if(r(e),e){u.current=!1;return}c.current>0&&a(c.current)},[r,a]),handleSecondaryPanelResize:(0,K.useCallback)(e=>{e<=0||(c.current=e)},[]),persistedWidthPercent:i,secondaryPanelRef:o,secondaryResizablePanelRef:s}}var fs=`20rem`;function ps({value:e,options:t,onChange:n,disabled:r,panelWidthPx:i}){let a=t.find(t=>t.value===e),o=a?.label??e,s=a?.monoPrefix;return(0,q.jsxs)(B,{children:[(0,q.jsx)(ge,{asChild:!0,disabled:r,children:(0,q.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,disabled:r,className:R(`h-8 w-full min-w-0 justify-between gap-2 rounded-lg border border-border/70 bg-transparent px-2.5 text-xs font-normal`,r&&`opacity-60`),children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[s?(0,q.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:s}):null,(0,q.jsx)(`span`,{className:`truncate`,children:o})]}),(0,q.jsx)(L,{name:`ChevronDown`,className:`size-3.5 shrink-0 text-muted-foreground`})]})}),(0,q.jsx)(ye,{align:`start`,className:`min-w-[var(--radix-dropdown-menu-trigger-width)]`,style:{maxWidth:`min(var(--radix-popper-available-width), max(${fs}, ${i}px))`},children:t.map(t=>(0,q.jsxs)(he,{onSelect:()=>n(t.value),className:`flex items-center justify-between gap-2`,children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,title:t.monoPrefix?`${t.monoPrefix} ${t.label}`:t.label,children:[t.monoPrefix?(0,q.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:t.monoPrefix}):null,(0,q.jsx)(`span`,{className:`truncate`,children:t.label})]}),(0,q.jsx)(L,{name:`Check`,className:R(_e,t.value===e?`opacity-100`:`opacity-0`)})]},t.value))})]})}function ms({selectionValue:e,selectionOptions:t,onSelectionChange:n,isSelectorDisabled:r,stats:i,isParsing:a,areAllFilesCollapsed:o,isCollapseAllDisabled:s,onToggleAllCollapsed:c,displayMode:l,onDisplayModeChange:u}){let d=(0,K.useRef)(null),{width:f=0}=Qn({ref:d,box:`content-box`});return(0,q.jsx)(`div`,{ref:d,className:`px-4 pb-3`,children:(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,q.jsx)(ps,{value:e,options:t,onChange:n,disabled:r,panelWidthPx:f})}),(0,q.jsx)(`span`,{className:`min-w-0 shrink truncate text-xs text-muted-foreground`,title:xi(i),children:Si(i)}),a?(0,q.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground`,children:[(0,q.jsx)(L,{name:`Spinner`,className:`size-3 animate-spin`}),`Parsing`]}):null,(0,q.jsxs)(`div`,{className:`ml-auto flex min-w-0 shrink-0 items-center justify-end gap-1`,children:[(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 w-7 rounded-md p-0 text-muted-foreground`,onClick:c,disabled:s,"aria-label":o?`Expand all files`:`Collapse all files`,title:o?`Expand all files`:`Collapse all files`,children:o?(0,q.jsx)(L,{name:`ChevronsDown`,className:`size-3.5`}):(0,q.jsx)(L,{name:`ChevronsUp`,className:`size-3.5`})}),(0,q.jsxs)(`div`,{className:`inline-flex items-center gap-1 rounded-lg border border-border/70 p-0.5`,role:`tablist`,"aria-label":`Diff view mode`,children:[(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 w-7 rounded-md p-0 text-muted-foreground`,onClick:()=>u(`unified`),"aria-label":`Stacked diff view`,"aria-pressed":l===`unified`,title:`Stacked diff view`,children:(0,q.jsx)(L,{name:`Rows2`,className:`size-3.5`})}),(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 w-7 rounded-md p-0 text-muted-foreground`,onClick:()=>u(`split`),"aria-label":`Split diff view`,"aria-pressed":l===`split`,title:`Split diff view`,children:(0,q.jsx)(L,{name:`Columns2`,className:`size-3.5`})})]})]})]})})}var hs=new Set([`md`,`mdx`,`markdown`]),gs={"--diffs-font-size":`12px`,"--diffs-line-height":`18px`,"--diffs-gap-block":`16px`},_s={"--md-content-w":`100cqi`},vs={width:`100%`,height:`100%`,border:0};function ys(e){let t=e.split(`.`).pop()?.toLowerCase();return t!==void 0&&hs.has(t)}function bs({state:e,path:t,copyPath:n=null,onOpenInEditor:r,statusLabel:i=null}){let a=e.kind===`ready`&&ys(e.file.name),[o,s]=(0,K.useState)(`preview`);return(0,K.useEffect)(()=>{s(`preview`)},[t]),(0,q.jsxs)(`div`,{className:e.kind===`html`?`@container/page flex h-full min-h-0 flex-col`:`@container/page`,style:_s,children:[(0,q.jsx)(Ss,{path:t,copyPath:n,onOpenInEditor:r,statusLabel:i,markdownMode:a?o:null,onMarkdownModeChange:s}),(0,q.jsx)(xs,{state:e,path:t,markdownMode:a?o:`preview`})]})}function xs({state:e,path:t,markdownMode:n}){return e.kind===`loading`?(0,q.jsx)(Os,{}):e.kind===`empty`?(0,q.jsx)(ks,{message:`Empty file.`}):e.kind===`not-found`?(0,q.jsx)(ks,{message:`File not found.`,role:`alert`}):e.kind===`manager-status-pending`?(0,q.jsx)(ks,{message:`Manager hasn't written a status yet.`}):e.kind===`error`?(0,q.jsx)(ks,{message:e.message??`Failed to load file`,role:e.message===void 0?`alert`:void 0}):e.kind===`image`?(0,q.jsx)(ws,{url:e.url,alt:t}):e.kind===`html`?(0,q.jsx)(Ts,{file:e.file}):ys(e.file.name)&&n===`preview`?(0,q.jsx)(Cs,{file:e.file}):(0,q.jsx)(As,{file:e.file,lineNumber:e.lineNumber??null})}function Ss({path:e,copyPath:t,onOpenInEditor:n,statusLabel:r,markdownMode:i,onMarkdownModeChange:a}){return(0,q.jsxs)(`div`,{className:`sticky top-0 z-10`,children:[(0,q.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b border-border/70 bg-background px-4`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,q.jsx)(Bt,{className:`min-w-0 font-mono text-xs font-medium leading-5 text-foreground`,title:e,children:e}),r===null?null:(0,q.jsxs)(`span`,{className:`shrink-0 text-xs leading-5 text-muted-foreground`,children:[`(`,r,`)`]}),t===null?null:(0,q.jsx)(cn,{text:t,label:`Copy file path`,className:`shrink-0 rounded-md hover:bg-state-hover hover:text-foreground`}),n?(0,q.jsx)(`button`,{type:`button`,onClick:()=>n(e),"aria-label":`Open in editor`,title:`Open in editor`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-state-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:(0,q.jsx)(L,{name:`ExternalLink`,"aria-hidden":!0,className:`size-3`})}):null]}),i===null?null:(0,q.jsxs)(`div`,{className:`ml-auto inline-flex shrink-0 items-center gap-0.5 rounded-md border border-border/70 p-0.5`,role:`tablist`,"aria-label":`Markdown view mode`,children:[(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`h-5 rounded-sm px-2 text-xs text-muted-foreground`,onClick:()=>a(`preview`),"aria-pressed":i===`preview`,title:`Rendered preview`,children:`Preview`}),(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`h-5 rounded-sm px-2 text-xs text-muted-foreground`,onClick:()=>a(`source`),"aria-pressed":i===`source`,title:`Markdown source`,children:`Raw`})]})]}),(0,q.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 top-full h-4 bg-gradient-to-b from-background to-transparent`})]})}function Cs({file:e}){return(0,q.jsx)(`div`,{className:`px-4 pt-4`,children:(0,q.jsx)(Ut,{allowHtml:!0,content:e.contents})})}function ws({url:e,alt:t}){return(0,q.jsx)(`div`,{className:`pt-4`,children:(0,q.jsx)(`img`,{src:e,alt:t,className:`block max-h-[34rem] w-full object-contain`})})}function Ts({file:e}){return(0,q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,q.jsx)(`iframe`,{title:e.name,srcDoc:e.contents,style:vs})})}function Es(e){let t=e.querySelectorAll(`[data-file-preview-target-line]`);for(let e of t)e.removeAttribute(`data-file-preview-target-line`),e.removeAttribute(`data-selected-line`)}function Ds(e,t){let n=e.querySelectorAll(`[data-line="${t}"]`);for(let e of n)if(e instanceof HTMLElement&&e.dataset.lineIndex!==void 0)return e;for(let e of n)if(e instanceof HTMLElement)return e;return null}function Os(){return(0,q.jsxs)(`div`,{className:`space-y-2 px-4 pt-4`,"aria-busy":!0,children:[(0,q.jsx)(sr,{className:`h-3 w-3/4 rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-full rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-5/6 rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-2/3 rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-full rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-3/5 rounded-sm`})]})}function ks({message:e,role:t}){return(0,q.jsx)(`p`,{role:t,className:`mx-4 mt-4 rounded-lg border border-dashed border-border/70 bg-background/45 px-3 py-6 text-center text-sm text-muted-foreground`,children:e})}function As({file:e,lineNumber:t}){let n=vr(),r=(0,K.useRef)(null),i=(0,K.useMemo)(()=>({themeType:n,overflow:`scroll`,disableFileHeader:!0,enableLineSelection:t!==null}),[t,n]),a=(0,K.useMemo)(()=>t===null?null:{start:t,end:t},[t]);return(0,K.useEffect)(()=>{let e=r.current,n=null,i=null,a=0;function o(){n=window.requestAnimationFrame(s),i=window.setTimeout(s,16)}function s(){let e=r.current;if(!e||(Es(e),Es(e.ownerDocument.body),t===null))return;let n=Ds(e,t)??Ds(e.ownerDocument.body,t);if(n){n.setAttribute(`data-file-preview-target-line`,``),n.setAttribute(`data-selected-line`,`single`),n.scrollIntoView?.({block:`center`});return}a+=1,a<8&&o()}return s(),()=>{e&&(Es(e),Es(e.ownerDocument.body)),n!==null&&window.cancelAnimationFrame(n),i!==null&&window.clearTimeout(i)}},[e.contents,e.name,t]),(0,q.jsx)(`div`,{ref:r,style:gs,"data-file-preview-line-number":t??void 0,children:(0,q.jsx)(kr,{file:e,options:i,selectedLines:a})})}var js=`STATUS.md`,Ms=`STATUS.html`;function Ns(e){return e===`STATUS.md`||e===`STATUS.html`}function Ps(e){return e?.some(e=>e.path===`STATUS.html`)??!1?Ms:js}function Fs({activePath:e,copyPath:t=null,error:n,filePreview:r,isLoading:i,lineNumber:a=null,onOpenInEditor:o,pendingNotFoundPath:s,statusLabel:c=null}){if(n){let r=n instanceof b&&n.status===404;return r&&e===s?(0,q.jsx)(bs,{path:e,copyPath:t,onOpenInEditor:o,statusLabel:c,state:{kind:`manager-status-pending`}}):(0,q.jsx)(bs,{path:e,copyPath:t,onOpenInEditor:o,statusLabel:c,state:{kind:r?`not-found`:`error`}})}return i||!r||r.path!==e?(0,q.jsx)(bs,{path:e,copyPath:t,onOpenInEditor:o,statusLabel:c,state:{kind:`loading`}}):e===`STATUS.html`&&r.kind===`text`?(0,q.jsx)(bs,{path:e,copyPath:t,onOpenInEditor:o,statusLabel:c,state:{kind:`html`,file:{name:r.name??e,contents:r.content}}}):r.kind===`text`?r.content.length===0?(0,q.jsx)(bs,{path:e,copyPath:t,onOpenInEditor:o,statusLabel:c,state:{kind:`empty`}}):(0,q.jsx)(bs,{path:e,copyPath:t,onOpenInEditor:o,statusLabel:c,state:{kind:`ready`,lineNumber:a,file:{name:r.name??e,contents:r.content}}}):r.kind===`image`?(0,q.jsx)(bs,{path:e,copyPath:t,onOpenInEditor:o,statusLabel:c,state:{kind:`image`,url:r.url}}):(0,q.jsx)(bs,{path:e,copyPath:t,onOpenInEditor:o,statusLabel:c,state:{kind:`error`,message:`Preview not available for ${r.mimeType}.`}})}function Is({activePath:e,copyPath:t,error:n,filePreview:r,isLoading:i,lineNumber:a,onOpenInEditor:o,pinnedPath:s}){return(0,q.jsx)(Fs,{activePath:e,copyPath:t,error:n,filePreview:r,isLoading:i,lineNumber:a,onOpenInEditor:o,pendingNotFoundPath:s})}var Ls=3,Rs=`min-h-0 flex-1 overflow-x-hidden overflow-y-auto`;function zs({count:e=Ls}){return(0,q.jsx)(`div`,{className:`space-y-2 pt-2`,children:Array.from({length:e}).map((e,t)=>(0,q.jsxs)(`div`,{className:`rounded-lg border border-border/70 bg-background/70`,children:[(0,q.jsx)(`div`,{className:`border-b border-border/70 bg-card/70 px-3 py-1.5`,children:(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,q.jsx)(sr,{className:`size-4 shrink-0 rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-48 max-w-full rounded-sm`})]}),(0,q.jsx)(sr,{className:`h-3 w-14 shrink-0 rounded-sm`})]})}),(0,q.jsxs)(`div`,{className:`space-y-1.5 px-2.5 py-2`,children:[(0,q.jsx)(sr,{className:`h-3 w-full rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-[94%] rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-[90%] rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-[86%] rounded-sm`})]})]},`git-diff-skeleton-${t}`))})}var Bs=(0,K.memo)(function({fileKey:e,fileDiff:t,diffViewOptions:n,filePathRoot:r,onOpenFileInEditor:i,onOpenFilePreview:a,isCollapsed:o,isRendering:s,setGitDiffFileRef:c,toggleGitDiffFileCollapsed:l,onRequestFileContents:u}){return(0,q.jsx)(Yt,{fileDiff:t,diffViewOptions:n,filePathRoot:r,onOpenFileInEditor:i,onOpenFilePreview:a,isCollapsed:o,onToggleCollapsed:(0,K.useCallback)(()=>{l(e)},[e,l]),stickyHeader:!0,isRendering:s,cardRef:(0,K.useCallback)(t=>{c(e,t)},[e,c]),onRequestFileContents:u})});function Vs({collapsedGitDiffFileKeys:e,currentGitDiff:t,gitDiffError:n,gitDiffViewOptions:r,isParsingGitDiffFiles:i,isPreparingGitDiff:a,loadingGitDiffFileKeys:o,onOpenFileInEditor:s,onOpenFilePreview:c,onRequestFileContents:l,parsedGitDiffFileEntries:u,queuedGitDiffFileRenderKeys:d,setGitDiffFileRef:f,threadGitDiff:p,toggleGitDiffFileCollapsed:m,workspaceRootPath:h}){let g=t.trim().length>0;return(0,q.jsx)(`div`,{className:R(Rs,`px-4 pb-3`),children:a?(0,q.jsx)(zs,{}):n?(0,q.jsx)(`p`,{className:`rounded-lg border border-destructive/20 bg-destructive/5 px-3 py-2 text-xs text-destructive`,children:n.message}):p&&g?(0,q.jsxs)(q.Fragment,{children:[u.length>0?(0,q.jsxs)(`div`,{className:`space-y-2`,children:[u.map(({key:t,fileDiff:n})=>(0,q.jsx)(Bs,{fileKey:t,fileDiff:n,diffViewOptions:r,filePathRoot:h,onOpenFileInEditor:s,onOpenFilePreview:c,isCollapsed:e.has(t),isRendering:!d.has(t)||o.has(t),setGitDiffFileRef:f,toggleGitDiffFileCollapsed:m,onRequestFileContents:l},t)),i?(0,q.jsx)(`div`,{className:`rounded-lg border border-border/70 bg-background/70 px-3 py-3`,children:(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(sr,{className:`h-3 w-52 max-w-full rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-5/6 rounded-sm`})]})}):null]}):(0,q.jsx)(`pre`,{className:`overflow-auto whitespace-pre rounded-lg border border-border/70 bg-background/70 p-3 font-mono text-xs text-foreground`,children:p.diff}),p.truncated?(0,q.jsx)(`p`,{className:`pt-2 text-xs text-muted-foreground`,children:`Diff output was truncated for display.`}):null]}):(0,q.jsx)(`p`,{className:`rounded-lg border border-dashed border-border/70 bg-background/45 px-3 py-6 text-center text-sm text-muted-foreground`,children:`No diff to display.`})})}function Hs({metadataContent:e}){return(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-4 pb-3`,children:e})}function Us({activePath:e,copyPath:t=null,environmentId:n,lineNumber:r,onOpenInEditor:i,source:a,statusLabel:o}){let{data:s,error:c,isLoading:l}=_i(n,e,a);return(0,q.jsx)(Fs,{activePath:e,copyPath:t,error:c,filePreview:s,isLoading:l,lineNumber:r,onOpenInEditor:i,statusLabel:o})}function Ws({activePath:e,environmentId:t,lineNumber:n,onOpenInEditor:r,threadId:i}){let{data:a,error:o,isLoading:s}=Le(i,t,e);return(0,q.jsx)(Fs,{activePath:e,error:o,filePreview:a,isLoading:s,lineNumber:n,onOpenInEditor:r,statusLabel:null})}function Gs({activePath:e,copyPath:t=null,isManagerThread:n,onOpenInEditor:r,pinnedPath:i,threadId:a}){let{data:o,error:s,isLoading:c}=De(a,e,{enabled:n});return(0,q.jsx)(Is,{activePath:e,copyPath:t,error:s,filePreview:o,isLoading:c,onOpenInEditor:r,pinnedPath:i})}var Ks=24,qs=70,Js=`duration-[220ms] ease-[cubic-bezier(0.32,0.72,0,1)]`,Ys=`min-h-0 flex-1 overflow-x-hidden overflow-y-auto`;function Xs({activePanel:e,canUseGitUi:t,defaultMergeBaseBranch:n,environmentId:r,metadataContent:i,fileTabs:a,fileTabContent:o,isOpen:s,showGitDiffTab:c=!0,onPanelFocus:l,onPanelChange:u,onCollapse:d,onClose:f,workspaceRootPath:p,onOpenFileInEditor:m,onOpenFilePreview:h,renderAsDrawer:g}){let _=a?.find(e=>e.isActive)!==void 0,v=g?`X`:`PanelRight`,{gitDiffDisplayMode:y,handleGitDiffDisplayModeChange:b,handleSecondaryPanelDragging:x,handleSecondaryPanelResize:S,persistedWidthPercent:C,secondaryPanelRef:w,secondaryResizablePanelRef:T}=ds({isSecondaryPanelOpen:s}),E=!t&&e===`git-diff`?`thread-info`:e,D=E===`git-diff`,{currentGitDiff:O,gitDiffError:k,gitDiffSelectOptions:A,gitDiffSelectValue:M,gitDiffStats:N,hasParsedGitDiffFiles:P,isGitDiffLoading:F,isParsingGitDiffFiles:I,isPreparingGitDiff:ee,onGitDiffSelectionChange:te,onRequestFileContents:ne,parsedGitDiffFileEntries:re,queuedGitDiffFileRenderKeys:ie,setGitDiffFileRef:z,threadGitDiff:ae,toggleAllGitDiffFilesCollapsed:oe,toggleGitDiffFileCollapsed:se}=is({environmentId:r,isDiffPanelActive:D,defaultMergeBaseBranch:n}),ce=dt(la),le=dt(ua),ue=(0,K.useMemo)(()=>P&&re.every(({key:e})=>ce.has(e)),[ce,P,re]),de=vr(),fe=(0,K.useMemo)(()=>({...Kt,diffStyle:y,themeType:de}),[y,de]),pe=(0,q.jsxs)(`aside`,{ref:w,"aria-hidden":!s,onFocusCapture:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||l()},className:R(`flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background`,!g&&[`transition-[transform,opacity,background-color]`,Js,s?`opacity-100`:`pointer-events-none translate-x-[8%] opacity-0`]),children:[(0,q.jsxs)(`div`,{className:`bg-background`,children:[(0,q.jsxs)(`div`,{className:`flex h-12 min-w-0 items-center justify-between gap-2 px-4`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1`,role:`tablist`,"aria-label":`Secondary panel views`,children:[(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 w-7 shrink-0 rounded-md p-0`,onClick:()=>u(`thread-info`),"aria-label":`Show thread info panel`,"aria-pressed":E===`thread-info`&&!_,title:`Info`,children:(0,q.jsx)(L,{name:`Info`})}),c===!1?null:(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 w-7 shrink-0 rounded-md p-0`,onClick:()=>u(`git-diff`),"aria-label":`Show diff panel`,"aria-pressed":D&&!_,title:`Diff`,children:(0,q.jsx)(L,{name:`FileDiff`})}),a&&a.length>0?(0,q.jsx)(`div`,{className:`flex min-w-0 items-center gap-1 overflow-x-auto`,children:a.map(e=>(0,q.jsx)(Zs,{tab:e},e.id))}):null]}),(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0 rounded-md p-0`,onClick:f,"aria-label":g?`Close secondary panel`:`Hide secondary panel`,title:g?`Close secondary panel`:`Hide secondary panel`,children:(0,q.jsx)(L,{name:v})})]}),D&&!_?(0,q.jsx)(ms,{selectionValue:M,selectionOptions:A,onSelectionChange:te,isSelectorDisabled:F||ae===void 0,stats:N,isParsing:I,areAllFilesCollapsed:ue,isCollapseAllDisabled:!P||F,onToggleAllCollapsed:oe,displayMode:y,onDisplayModeChange:b}):null]}),(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:_?(0,q.jsx)(`div`,{className:R(Ys,`pb-3`),children:o??(0,q.jsx)(`p`,{className:`mx-4 rounded-lg border border-dashed border-border/70 bg-background/45 px-3 py-6 text-center text-sm text-muted-foreground`,children:`No file preview content provided.`})}):D?(0,q.jsx)(Vs,{collapsedGitDiffFileKeys:ce,currentGitDiff:O,gitDiffError:k instanceof Error?k:k?Error(`Failed to load git diff`):null,gitDiffViewOptions:fe,isParsingGitDiffFiles:I,isPreparingGitDiff:ee,loadingGitDiffFileKeys:le,onOpenFileInEditor:m,onOpenFilePreview:h,onRequestFileContents:ne,parsedGitDiffFileEntries:re,queuedGitDiffFileRenderKeys:ie,setGitDiffFileRef:z,threadGitDiff:ae,toggleGitDiffFileCollapsed:se,workspaceRootPath:p}):(0,q.jsx)(Hs,{metadataContent:i})})]});return g?pe:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Qs,{isOpen:s,onDragging:x}),(0,q.jsx)(Bo.Panel,{ref:T,id:`thread-detail-secondary-panel`,collapsible:!0,collapsedSize:0,defaultSize:s?C:0,minSize:Ks,maxSize:qs,onCollapse:d,onResize:S,order:2,className:R(`min-w-0 overflow-hidden transition-[flex-grow,flex-basis,opacity]`,Js,s?`opacity-100`:`opacity-0`),children:pe})]})}function Zs({tab:e}){let t=e.statusLabel===null?e.filename:`${e.filename} (${e.statusLabel})`;return(0,q.jsx)(Ho,{label:e.filename,secondaryLabel:e.statusLabel===null?null:`(${e.statusLabel})`,title:t,isActive:e.isActive,onSelect:e.onSelect,labelMaxWidthClass:`max-w-[160px]`,closeAction:e.isPinned?null:{onClose:e.onClose,closeLabel:`Close ${e.filename}`,closeTooltip:`Close tab`}})}function Qs({isOpen:e,onDragging:t}){let n=dt(sa);return(0,q.jsx)(Bo.PanelResizeHandle,{id:`thread-detail-secondary-panel-handle`,disabled:!e,onDragging:t,className:R(`group relative shrink-0 cursor-col-resize overflow-visible bg-transparent transition-[width,opacity,background-color] before:absolute before:inset-y-0 before:-left-1.5 before:-right-1.5 before:content-['']`,Js,e?`w-px opacity-100`:`pointer-events-none w-0 opacity-0`,n&&`bg-accent/20`),"aria-label":`Resize thread and secondary panels`,children:(0,q.jsx)(`span`,{className:R(`pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border/70 transition-colors`,n?`bg-accent-foreground/50`:`group-hover:bg-accent-foreground/35`)})})}var $s=`file-tree-container`,ec=`data-file-tree-style`,tc=`data-file-tree-unsafe-css`,nc=`data-file-tree-scrollbar-measure`,rc=`data-file-tree-scrollbar-gutter-measured`,ic=`--trees-scrollbar-gutter-measured`,ac=`header`,oc=`context-menu`,sc=`context-menu-trigger`,cc=typeof window>`u`?K.useEffect:K.useLayoutEffect;function lc(e,t,n){let r=e==null?null:(0,q.jsx)(`div`,{slot:ac,children:e}),i=t!=null&&n!=null?(0,q.jsx)(`div`,{slot:oc,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,q.jsxs)(q.Fragment,{children:[r,i]})}function uc(e,t){return typeof window>`u`&&t!=null?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,q.jsx)(q.Fragment,{children:e})}function dc(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement?!0:e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function fc(e,t,n,r,i){let a={...e??{}};if(t!=null&&delete a.header,n){let t=e?.contextMenu,n=t?.onClose,o=t?.onOpen;a.contextMenu={...t??{},enabled:!0,onClose:()=>{n?.(),r()},onOpen:(e,t)=>{i(e,t),o?.(e,t)}},delete a.contextMenu.render}return a.header!=null||a.contextMenu!=null?a:void 0}function pc({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(null),u=(0,K.useRef)(n.getComposition()),d=(0,K.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,K.useCallback)(()=>{s(null)},[]),m=(0,K.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,K.useMemo)(()=>fc(h,e,f,p,m),[h,p,m,f,e]),_=(0,K.useCallback)(e=>{l(e)},[]);(0,K.useEffect)(()=>{f||s(null)},[f]),cc(()=>{n.setComposition(g)},[g,n]),cc(()=>{if(c!=null)return r!=null&&dc(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=uc(lc(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,q.jsx)($s,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}var mc=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
3
+ `).trim();if(t.length>0)return t.length<=go?t:`${t.slice(0,go-1)}...`;let n=vo(e);if(n===1){let t=e.find(e=>e.type===`localImage`||e.type===`localFile`);return t?t.type===`localFile`&&t.name?`Attachment only (${t.name})`:`Attachment only (${_o(t.path)})`:`Attachment only (1 file)`}return n>1?`Attachment only (${n} files)`:`(empty message)`}function bo(e){return hr(e)}var xo=(0,K.memo)(function({queuedMessage:e,index:t,isProcessing:n,sendDisabled:r,actionDisabled:i,onSendImmediately:a,onEdit:o,onDelete:s}){let c=(0,K.useMemo)(()=>yo(e.content),[e.content]),l=(0,K.useMemo)(()=>vo(e.content),[e.content]);return(0,q.jsx)(`li`,{className:`px-2.5 py-0.5`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(`div`,{className:`p-0.5 text-muted-foreground`,children:(0,q.jsx)(L,{name:`CornerDownRight`,className:`size-3.5`})}),(0,q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 text-xs leading-4`,children:[(0,q.jsx)(`p`,{className:`min-w-0 truncate text-foreground`,title:c,children:c}),l>0?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`.`}),(0,q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:l===1?`1 attachment`:`${l} attachments`})]}):null,n?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`.`}),(0,q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Sending...`})]}):null]})}),(0,q.jsxs)(`div`,{className:`ml-1 flex shrink-0 items-center gap-1`,children:[(0,q.jsx)(j,{type:`button`,size:`sm`,variant:`link`,className:`h-auto px-0 pr-1 text-xs text-muted-foreground underline`,disabled:r||n,onClick:()=>a(e.id),children:n?`Sending...`:`Send now`}),(0,q.jsx)(j,{type:`button`,size:`icon`,variant:`ghost`,className:`size-7 text-muted-foreground`,disabled:i||n,onClick:()=>o(e.id),"aria-label":`Edit queued message ${t+1}`,title:`Edit queued message`,children:(0,q.jsx)(L,{name:`Edit`,className:`size-3.5`})}),(0,q.jsx)(j,{type:`button`,size:`icon`,variant:`ghost`,className:`size-7 text-muted-foreground hover:text-destructive`,disabled:i||n,onClick:()=>s(e.id),"aria-label":`Delete queued message ${t+1}`,title:`Delete queued message`,children:(0,q.jsx)(L,{name:`Trash2`,className:`size-3.5`})})]})]})})});function So({queuedMessages:e,sendDisabled:t,actionDisabled:n,processingMessageId:r,onSendImmediately:i,onEdit:a,onDelete:o}){return e.length===0?null:(0,q.jsxs)($a,{ariaLabel:`Queued messages`,className:`overflow-hidden`,children:[(0,q.jsx)(`div`,{className:`flex items-center justify-between px-2.5 pb-1 pt-2.5`,children:(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Queued (`,e.length,`)`]})}),(0,q.jsx)(`ul`,{children:e.map((e,s)=>(0,q.jsx)(xo,{queuedMessage:e,index:s,isProcessing:r===e.id,sendDisabled:t,actionDisabled:n,onSendImmediately:i,onEdit:a,onDelete:o},e.id))})]})}var Co=(0,K.memo)(function({environmentLabel:e,environmentHostLabel:t,environmentHostConnected:n,environmentIcon:r,environmentBranchName:i,onCreateNewThreadInWorktree:a}){return!e&&n===void 0?null:(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 pr-1.5`,children:[e?(0,q.jsx)(pr,{label:`Environment`,value:(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(`span`,{children:e}),t?(0,q.jsxs)(`span`,{className:`hidden text-muted-foreground lg:inline`,children:[`· `,t]}):null,n===void 0?null:(0,q.jsx)(On,{connected:n,className:`translate-y-px`})]}),leading:r?(0,q.jsx)(L,{name:r,className:`size-4 shrink-0`}):null,className:`h-6 shrink-0`,muted:!0}):n===void 0?null:(0,q.jsx)(On,{connected:n}),i?(0,q.jsxs)(`button`,{type:`button`,className:`hidden min-w-0 items-center gap-1 rounded-md px-1.5 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-state-hover hover:text-foreground md:flex`,title:`Copy branch name: ${i}`,onClick:()=>{on(i,{successMessage:`Branch name copied`,errorMessage:`Failed to copy branch name`})},children:[(0,q.jsx)(L,{name:`GitMerge`,className:`size-3.5 shrink-0`}),(0,q.jsx)(`span`,{className:`truncate`,children:i})]}):null,a?(0,q.jsx)(`button`,{type:`button`,"aria-label":`Create new thread in this worktree`,title:`New thread in this worktree`,onClick:a,className:`-ml-1 inline-flex shrink-0 items-center justify-center rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-state-hover hover:text-foreground`,children:(0,q.jsx)(L,{name:`MessageSquarePlus`,className:`size-4`})}):null]})});function wo({visible:e,active:t=!1,onClick:n,className:r,ariaLabel:i=`Scroll to latest event`}){return(0,q.jsx)(`div`,{className:R(`flex h-0 items-center justify-center`,r),children:(0,q.jsx)(`button`,{onClick:n,className:R(`z-20 -mt-20 flex size-8 items-center justify-center rounded-full border border-border bg-surface-scrim backdrop-blur-md transition-all duration-200 hover:bg-state-hover`,e?`translate-y-0 opacity-100`:`pointer-events-none translate-y-2 opacity-0`),"aria-label":i,type:`button`,children:t?(0,q.jsx)(To,{}):(0,q.jsx)(L,{name:`ArrowDown`,className:`size-4`})})})}function To(){return(0,q.jsxs)(`span`,{className:`flex items-center gap-0.5`,"aria-hidden":!0,children:[(0,q.jsx)(`span`,{className:`size-1 animate-typing-dot rounded-full bg-current [animation-delay:-240ms]`}),(0,q.jsx)(`span`,{className:`size-1 animate-typing-dot rounded-full bg-current [animation-delay:-120ms]`}),(0,q.jsx)(`span`,{className:`size-1 animate-typing-dot rounded-full bg-current`})]})}function Eo({active:e}){let t=ie();return t?(0,q.jsx)(wo,{visible:!t.isAtBottom,active:e,onClick:t.scrollToBottom}):null}function Do({onSubmit:e,submission:t,...n}){let r=ie(),i=()=>{e(),r?.scrollToBottom()},a=t?.onModifierSubmit===void 0?void 0:()=>{t.onModifierSubmit?.(),r?.scrollToBottom()},o=t===void 0?void 0:{...t,...a?{onModifierSubmit:a}:{}};return(0,q.jsx)(An,{...n,onSubmit:i,submission:o})}var Oo=68,ko=Oo+32,Ao=(0,K.memo)(function({attachments:e,stack:t,composer:n,environmentSummary:r,contextWindowUsage:i,execution:a,permission:o,mentions:s,zenModeResetKey:c}){let l=n.submitMode,u=l.kind===`queue`,d=l.kind===`ready`||l.kind===`queue`,f=l.kind===`blocked`&&l.reason===`stopping`,p=l.kind===`queue`||l.kind===`stop-only`?l.onStop:void 0,m=p!==void 0,h=(0,K.useRef)(null),g=Mn(h),_=n.canSteerSubmit?n.onSteerSubmit:void 0,v=(0,K.useRef)(null),[y,b]=(0,K.useState)(0);(0,K.useLayoutEffect)(()=>{let e=v.current;if(!e)return;let t=e.offsetHeight;b(e=>e===t?e:t)},[t]),(0,K.useEffect)(()=>{let e=v.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e=>{let t=e[0];t&&b(t.contentRect.height)});return t.observe(e),()=>t.disconnect()},[]);let x=Math.max(Oo,ko-y);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Eo,{active:n.threadRuntimeDisplayStatus===`active`}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(`div`,{ref:v,className:`space-y-2`,children:t}),(0,q.jsx)(Do,{promptBoxRef:h,voice:g,minHeight:x,value:n.message,onChange:n.onChangeMessage,onSubmit:n.onSubmit,history:n.history,placeholder:n.promptPlaceholder,mentionMenuPlacement:`top`,autoFocus:!0,submission:{onStop:p,isSubmitting:n.isFollowUpSubmitting||f,disabled:!d||n.isFollowUpSubmitting,onModifierSubmit:_,title:u?`Queue follow-up (Enter)`:f?`Stopping run...`:`Submit (Enter)`,isRunning:m,mode:`enter`},mentions:s,attachments:e,zenMode:{layout:`thread`,storageKey:null,resetKey:c,resetOnSubmit:!0},footerStart:(0,q.jsx)(xn,{...a})}),(0,q.jsxs)(`div`,{className:`mt-1 flex min-h-6 items-center justify-between gap-2 pl-[15px] pr-3.5`,children:[(0,q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-1`,children:r}),(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,q.jsx)(Tn,{value:o.value,options:o.options,onChange:o.onChange,supported:o.supported,className:`h-6`}),i?(0,q.jsx)(Ot,{usage:i}):null]})]})]})]})});function jo(e){return e===`active`||e===`host-reconnecting`}function Mo({hasPromptDraftInput:e,isFollowUpSubmitting:t,isQueueMutationPending:n,queuedMessageCount:r,runtimeDisplayStatus:i,submitModeKind:a}){return i===`active`&&a===`queue`&&!t&&!n&&(r>0||e)}function No({input:e,threadId:t,...n}){return e.length===0?null:{id:t,input:e,mode:`auto`,...n.model?{model:n.model}:{},...Lo(n)}}function Po({input:e,threadId:t}){return e.length===0?null:{id:t,input:e,mode:`steer`}}function Fo({input:e,threadId:t,...n}){return e.length===0?null:{id:t,input:e,model:n.model,...Lo(n)}}function Io({queuedMessages:e,threadId:t}){return e.map(e=>({id:t,mode:`steer`,queuedMessageId:e.id}))}function Lo({permissionMode:e,reasoningLevel:t,serviceTier:n,supportsServiceTier:r}){return{...r&&n?{serviceTier:n}:{},reasoningLevel:t,permissionMode:e}}function Ro(e,t){if(e===`created`||e===`provisioning`)return t?`Hiring manager...`:`Creating thread...`;switch(e){case`waiting-for-host`:return`Host daemon disconnected`;case`host-reconnecting`:return`Waiting for host daemon to reconnect...`;case`error`:return`Retry by sending a follow-up message`;case`idle`:case`active`:return t?`Send a message. @ to mention files or threads`:`Ask for follow-up changes. @ to mention files`;default:return f(e)}}function zo({canUseGitUi:e,composerQueriesEnabled:t,composerQueriesRefetchOnMount:n,composerQueriesStaleTime:r,contextWindowUsage:i,environmentBranchName:a,environmentHostConnected:o,environmentHostLabel:s,environmentIcon:c,environmentLabel:l,onCreateNewThreadInWorktree:u,isEnvironmentActionPending:d,pendingInteractions:f,onChangedFileClick:p,openThreadDiffPanel:m,projectId:h,workspaceChangedFilesSection:g,workspaceStatusPending:_,contextBannerMergeBase:v,pendingTodos:y,managedBySection:b,managerChildrenSection:x,sendMessage:S,thread:C}){let{data:w}=we(C.id,{enabled:t,refetchOnMount:n,staleTime:r}),{data:T=[]}=ze(C.id,{enabled:t,refetchOnMount:n,staleTime:r}),E=(0,K.useRef)(new Map);E.current=(0,K.useMemo)(()=>{let e=new Map;for(let t of T)e.set(t.id,t);return e},[T]);let{data:D=[]}=Me(C.id,{enabled:t,refetchOnMount:n,staleTime:r}),O=vn(),k=Cn(),A=qn(),j=Bn(),M=pt(),N=Pn({projectId:h,threadId:C.id}),P=er(h,{threadSuggestionMode:C.type===`manager`?`all`:`managers`,currentThreadId:C.id,environmentId:C.environmentId??null}),[F,I]=(0,K.useState)(null),[ee,te]=(0,K.useState)(null),[ne,re]=(0,K.useState)(null),[ie,L]=(0,K.useState)(!1),R=(0,K.useMemo)(()=>or(D),[D]),{selectedProviderId:z,providerOptions:ae,hasMultipleProviders:oe,selectedProviderDisplayName:se,selectedModel:ce,setSelectedModel:le,serviceTier:ue,setServiceTier:de,reasoningLevel:fe,setReasoningLevel:pe,permissionMode:me,setPermissionMode:he,activeModel:ge,modelOptions:_e,reasoningOptions:B,permissionModeOptions:ve,supportsPermissionModeSelection:ye,supportsServiceTier:V,serviceTierSupportByProvider:be}=en({enabled:t,environmentId:C.environmentId??void 0,scope:`component-local`,resetKey:C.id,initialProviderId:C.providerId,initialModel:w?.model,initialServiceTier:w?.serviceTier,initialReasoningLevel:w?.reasoningLevel,initialPermissionMode:w?.permissionMode,initialEnvironmentSelectionValue:C.environmentId??void 0}),H=C.runtime.displayStatus,xe=H===`created`,Se=H===`provisioning`,Ce=H===`waiting-for-host`,Te=C.stopRequestedAt!==null||j.isPending&&j.variables===C.id,Ee=Re(f),De=Ee!==null,Oe=O.isPending||k.isPending||A.isPending||ie,ke=S.isPending||d||O.isPending||ie,Ae=(0,K.useCallback)(()=>{j.mutate(C.id)},[j,C.id]),je=(0,K.useMemo)(()=>Te?{kind:`blocked`,reason:`stopping`}:De?{kind:`blocked`,reason:`pending-interaction`}:xe||Se?{kind:`blocked`,reason:`provisioning`}:Ce?{kind:`stop-only`,onStop:Ae}:H===`active`||H===`host-reconnecting`?{kind:`queue`,onStop:Ae}:{kind:`ready`},[Ae,De,xe,Se,Te,Ce,H]),Ne=Te?`Stopping thread...`:Ro(H,C.type===`manager`),Pe=(0,K.useMemo)(()=>({text:N.text,attachments:N.attachments}),[N.attachments,N.text]),Fe=(0,K.useMemo)(()=>lr(Pe),[Pe]),Ie=Mo({hasPromptDraftInput:Fe.length>0,isFollowUpSubmitting:ke,isQueueMutationPending:Oe,queuedMessageCount:T.length,runtimeDisplayStatus:H,submitModeKind:je.kind}),Le=(0,K.useCallback)(async e=>{if(e.length===0)return;I(null);let t=[];for(let n of e)try{let e=await M.mutateAsync({projectId:h,file:n});N.addAttachment(e)}catch{t.push(n.name)}t.length>0&&I(`Failed to attach: ${t.join(`, `)}`)},[h,N,M]),Be=(0,K.useCallback)(async()=>{let e=Pe,t=Fe;if(t.length===0)return;N.clearIfCurrentMatches(e),I(null);let n=jo(H);try{if(n){let e=Fo({threadId:C.id,input:t,model:ge?.model??ce,supportsServiceTier:V,serviceTier:ue,reasoningLevel:fe,permissionMode:me});e&&await O.mutateAsync(e)}else{let e=No({threadId:C.id,input:t,model:ge?.model??ce,supportsServiceTier:V,serviceTier:ue,reasoningLevel:fe,permissionMode:me});e&&await S.mutateAsync(e)}}catch(t){N.restoreIfEmpty(e),hn.error(pn({error:t,fallbackMessage:n?`Failed to queue message.`:`Failed to send follow-up.`}))}},[ge?.model,O,Pe,Fe,N,fe,me,ce,S,ue,V,C.id,H]),Ve=(0,K.useCallback)(async()=>{if(!Ie)return;let e=Pe,t=Fe;if(!(T.length===0&&t.length===0)){L(!0),t.length>0&&N.clearIfCurrentMatches(e),I(null);try{for(let e of Io({queuedMessages:T,threadId:C.id}))await k.mutateAsync(e);let e=Po({input:t,threadId:C.id});e&&await S.mutateAsync(e)}catch(t){N.restoreIfEmpty(e),hn.error(pn({error:t,fallbackMessage:`Failed to send steer.`}))}finally{L(!1)}}},[Ie,Pe,Fe,N,T,S,k,C.id]),He=(0,K.useCallback)(e=>{E.current.has(e)&&(re(e),k.mutateAsync({id:C.id,mode:`auto`,queuedMessageId:e}).then(()=>{I(null)}).catch(e=>{hn.error(pn({error:e,fallbackMessage:`Failed to send queued message.`}))}).finally(()=>{re(t=>t===e?null:t)}))},[k,C.id]),Ue=(0,K.useCallback)(e=>{let t=E.current.get(e);t&&(re(e),A.mutateAsync({id:C.id,queuedMessageId:e}).then(()=>{let e=bo(t.content);N.setDraft(e),I(null)}).catch(e=>{hn.error(pn({error:e,fallbackMessage:`Failed to edit queued message.`}))}).finally(()=>{re(t=>t===e?null:t)}))},[A,N,C.id]),We=(0,K.useCallback)(e=>{re(e),A.mutateAsync({id:C.id,queuedMessageId:e}).catch(e=>{hn.error(pn({error:e,fallbackMessage:`Failed to delete queued message.`}))}).finally(()=>{re(t=>t===e?null:t)})},[A,C.id]),Ge=(0,K.useCallback)(e=>{p(e)},[p]),Ke=(0,K.useCallback)(e=>{te(t=>t===e?null:e)},[]),qe=(0,K.useMemo)(()=>({items:N.attachments,projectId:h,isAttaching:M.isPending,error:F,onAttachFiles:Le,onRemove:N.removeAttachment}),[F,Le,h,N.attachments,N.removeAttachment,M.isPending]),Je=(0,K.useMemo)(()=>({history:{currentDraft:Pe,entries:R,onSelectEntry:N.setDraft,resetKey:C.id},isFollowUpSubmitting:ke,message:N.text,onChangeMessage:N.setText,onSteerSubmit:Ve,onSubmit:Be,promptPlaceholder:Ne,canSteerSubmit:Ie,submitMode:je,threadRuntimeDisplayStatus:H}),[Ie,Pe,Be,Ve,ke,N.setDraft,N.setText,N.text,R,Ne,H,je,C.id]),Ye=(0,K.useMemo)(()=>({provider:{options:ae,selectedId:z,hasMultiple:oe,displayName:se},model:{active:ge,selected:ce,options:_e,onChange:le},serviceTier:{value:ue,onChange:de,supported:V,supportByProvider:be},reasoning:{value:fe,options:B,onChange:pe}}),[ge,oe,_e,ae,fe,B,ce,se,z,ue,be,pe,le,de,V]),Xe=(0,K.useMemo)(()=>({value:me,options:ve,onChange:he,supported:ye}),[me,ve,he,ye]),Ze=(0,K.useMemo)(()=>({suggestions:P.suggestions,isLoading:P.isLoading,isError:P.isError,onQueryChange:P.setQuery}),[P.isError,P.isLoading,P.setQuery,P.suggestions]),U=(0,K.useMemo)(()=>l||o!==void 0?(0,q.jsx)(Co,{environmentLabel:l,environmentHostLabel:s,environmentHostConnected:o,environmentIcon:c,environmentBranchName:a,onCreateNewThreadInWorktree:u}):null,[a,o,s,c,l,u]);return Ee?(0,q.jsx)(Ua,{interaction:Ee,threadId:C.id}):(0,q.jsx)(Ao,{attachments:qe,stack:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ho,{todoSection:C.type===`manager`||!y?null:{pendingTodos:y},archivedSection:C.archivedAt===null?null:{archivedAt:C.archivedAt},managedBySection:b,managerChildrenSection:x,gitSection:g?{changedFiles:g,mergeBase:v,onPromptBannerFileClick:e?Ge:()=>{}}:null,gitSectionPending:_,expandedSection:ee,onToggleSection:Ke}),(0,q.jsx)(So,{queuedMessages:T,sendDisabled:!(je.kind===`ready`||je.kind===`queue`)||ke||Oe,actionDisabled:Oe,processingMessageId:ne,onSendImmediately:He,onEdit:Ue,onDelete:We})]}),composer:Je,zenModeResetKey:C.id,environmentSummary:U,contextWindowUsage:i??null,execution:Ye,permission:Xe,mentions:Ze})}var Bo=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=w();function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!==`default`){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var r=n(t),i=typeof window<`u`,a=t.createContext(null);a.displayName=`PanelGroupContext`;var o={group:`data-panel-group`,groupDirection:`data-panel-group-direction`,groupId:`data-panel-group-id`,panel:`data-panel`,panelCollapsible:`data-panel-collapsible`,panelId:`data-panel-id`,panelSize:`data-panel-size`,resizeHandle:`data-resize-handle`,resizeHandleActive:`data-resize-handle-active`,resizeHandleEnabled:`data-panel-resize-handle-enabled`,resizeHandleId:`data-panel-resize-handle-id`,resizeHandleState:`data-resize-handle-state`},s=10,c=i?t.useLayoutEffect:()=>{},l=r.useId,u=typeof l==`function`?l:()=>null,d=0;function f(e=null){let n=u(),r=t.useRef(e||n||null);return r.current===null&&(r.current=``+ d++),e??r.current}function p({children:e,className:n=``,collapsedSize:r,collapsible:i,defaultSize:s,forwardedRef:l,id:u,maxSize:d,minSize:p,onCollapse:m,onExpand:h,onResize:g,order:_,style:v,tagName:y=`div`,...b}){let x=t.useContext(a);if(x===null)throw Error(`Panel components must be rendered within a PanelGroup container`);let{collapsePanel:S,expandPanel:C,getPanelSize:w,getPanelStyle:T,groupId:E,isPanelCollapsed:D,reevaluatePanelConstraints:O,registerPanel:k,resizePanel:A,unregisterPanel:j}=x,M=f(u),N=t.useRef({callbacks:{onCollapse:m,onExpand:h,onResize:g},constraints:{collapsedSize:r,collapsible:i,defaultSize:s,maxSize:d,minSize:p},id:M,idIsFromProps:u!==void 0,order:_});t.useRef({didLogMissingDefaultSizeWarning:!1}),c(()=>{let{callbacks:e,constraints:t}=N.current,n={...t};N.current.id=M,N.current.idIsFromProps=u!==void 0,N.current.order=_,e.onCollapse=m,e.onExpand=h,e.onResize=g,t.collapsedSize=r,t.collapsible=i,t.defaultSize=s,t.maxSize=d,t.minSize=p,(n.collapsedSize!==t.collapsedSize||n.collapsible!==t.collapsible||n.maxSize!==t.maxSize||n.minSize!==t.minSize)&&O(N.current,n)}),c(()=>{let e=N.current;return k(e),()=>{j(e)}},[_,M,k,j]),t.useImperativeHandle(l,()=>({collapse:()=>{S(N.current)},expand:e=>{C(N.current,e)},getId(){return M},getSize(){return w(N.current)},isCollapsed(){return D(N.current)},isExpanded(){return!D(N.current)},resize:e=>{A(N.current,e)}}),[S,C,w,D,M,A]);let P=T(N.current,s);return t.createElement(y,{...b,children:e,className:n,id:M,style:{...P,...v},[o.groupId]:E,[o.panel]:``,[o.panelCollapsible]:i||void 0,[o.panelId]:M,[o.panelSize]:parseFloat(``+P.flexGrow).toFixed(1)})}var m=t.forwardRef((e,n)=>t.createElement(p,{...e,forwardedRef:n}));p.displayName=`Panel`,m.displayName=`forwardRef(Panel)`;var h;function g(){return h}var _=null,v=!0,y=-1,b=null;function x(e,t){if(t){let e=(t&ne)!==0,n=(t&re)!==0,r=(t&ie)!==0,i=(t&L)!==0;if(e)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}switch(e){case`horizontal`:return`ew-resize`;case`intersection`:return`move`;case`vertical`:return`ns-resize`}}function S(){b!==null&&(document.head.removeChild(b),_=null,b=null,y=-1)}function C(e,t){if(!v)return;let n=x(e,t);if(_!==n){if(_=n,b===null){b=document.createElement(`style`);let e=g();e&&b.setAttribute(`nonce`,e),document.head.appendChild(b)}if(y>=0){var r;(r=b.sheet)==null||r.removeRule(y)}y=b.sheet?.insertRule(`*{cursor: ${n} !important;}`)??-1}}function T(e){return e.type===`keydown`}function E(e){return e.type.startsWith(`pointer`)}function D(e){return e.type.startsWith(`mouse`)}function O(e){if(E(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(D(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function k(){if(typeof matchMedia==`function`)return matchMedia(`(pointer:coarse)`).matches?`coarse`:`fine`}function A(e,t,n){return n?e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y:e.x<=t.x+t.width&&e.x+e.width>=t.x&&e.y<=t.y+t.height&&e.y+e.height>=t.y}function j(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:ee(e),b:ee(t)},r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;V(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:I(F(n.a)),b:I(F(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var M=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function N(e){let t=getComputedStyle(te(e)??e).display;return t===`flex`||t===`inline-flex`}function P(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||N(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||M.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function F(e){let t=e.length;for(;t--;){let n=e[t];if(V(n,`Missing node`),P(n))return n}return null}function I(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ee(e){let t=[];for(;e;)t.push(e),e=te(e);return t}function te(e){let{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}var ne=1,re=2,ie=4,L=8,R=k()===`coarse`,z=[],ae=!1,oe=new Map,se=new Map,ce=new Set;function le(e,t,n,r,i){let{ownerDocument:a}=t,o={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:i},s=oe.get(a)??0;return oe.set(a,s+1),ce.add(o),B(),function(){se.delete(e),ce.delete(o);let t=oe.get(a)??1;if(oe.set(a,t-1),B(),t===1&&oe.delete(a),z.includes(o)){let e=z.indexOf(o);e>=0&&z.splice(e,1),ge(),i(`up`,!0,null)}}}function ue(e){let{target:t}=e,{x:n,y:r}=O(e);ae=!0,me({target:t,x:n,y:r}),B(),z.length>0&&(ve(`down`,e),e.preventDefault(),pe(t)||e.stopImmediatePropagation())}function de(e){let{x:t,y:n}=O(e);if(ae&&e.buttons===0&&(ae=!1,ve(`up`,e)),!ae){let{target:r}=e;me({target:r,x:t,y:n})}ve(`move`,e),ge(),z.length>0&&e.preventDefault()}function fe(e){let{target:t}=e,{x:n,y:r}=O(e);se.clear(),ae=!1,z.length>0&&(e.preventDefault(),pe(t)||e.stopImmediatePropagation()),ve(`up`,e),me({target:t,x:n,y:r}),ge(),B()}function pe(e){let t=e;for(;t;){if(t.hasAttribute(o.resizeHandle))return!0;t=t.parentElement}return!1}function me({target:e,x:t,y:n}){z.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),ce.forEach(e=>{let{element:i,hitAreaMargins:a}=e,o=i.getBoundingClientRect(),{bottom:s,left:c,right:l,top:u}=o,d=R?a.coarse:a.fine;if(t>=c-d&&t<=l+d&&n>=u-d&&n<=s+d){if(r!==null&&document.contains(r)&&i!==r&&!i.contains(r)&&!r.contains(i)&&j(r,i)>0){let e=r,t=!1;for(;e&&!e.contains(i);){if(A(e.getBoundingClientRect(),o,!0)){t=!0;break}e=e.parentElement}if(t)return}z.push(e)}})}function he(e,t){se.set(e,t)}function ge(){let e=!1,t=!1;z.forEach(n=>{let{direction:r}=n;r===`horizontal`?e=!0:t=!0});let n=0;se.forEach(e=>{n|=e}),e&&t?C(`intersection`,n):e?C(`horizontal`,n):t?C(`vertical`,n):S()}var _e=new AbortController;function B(){_e.abort(),_e=new AbortController;let e={capture:!0,signal:_e.signal};ce.size&&(ae?(z.length>0&&oe.forEach((t,n)=>{let{body:r}=n;t>0&&(r.addEventListener(`contextmenu`,fe,e),r.addEventListener(`pointerleave`,de,e),r.addEventListener(`pointermove`,de,e))}),window.addEventListener(`pointerup`,fe,e),window.addEventListener(`pointercancel`,fe,e)):oe.forEach((t,n)=>{let{body:r}=n;t>0&&(r.addEventListener(`pointerdown`,ue,e),r.addEventListener(`pointermove`,de,e))}))}function ve(e,t){ce.forEach(n=>{let{setResizeHandlerState:r}=n;r(e,z.includes(n),t)})}function ye(){let[e,n]=t.useState(0);return t.useCallback(()=>n(e=>e+1),[])}function V(e,t){if(!e)throw console.error(t),Error(t)}function be(e,t,n=s){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function H(e,t,n=s){return be(e,t,n)===0}function xe(e,t,n){return be(e,t,n)===0}function Se(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],a=t[r];if(!xe(i,a,n))return!1}return!0}function Ce({panelConstraints:e,panelIndex:t,size:n}){let r=e[t];V(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,maxSize:o=100,minSize:c=0}=r;if(be(n,c)<0)if(a){let e=(i+c)/2;n=be(n,e)<0?i:c}else n=c;return n=Math.min(o,n),n=parseFloat(n.toFixed(s)),n}function we({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(xe(e,0))return t;let o=[...t],[s,c]=r;V(s!=null,`Invalid first pivot index`),V(c!=null,`Invalid second pivot index`);let l=0;if(a===`keyboard`){{let r=e<0?c:s,i=n[r];V(i,`Panel constraints not found for index ${r}`);let{collapsedSize:a=0,collapsible:o,minSize:l=0}=i;if(o){let n=t[r];if(V(n!=null,`Previous layout not found for panel index ${r}`),xe(n,a)){let t=l-n;be(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let r=e<0?s:c,i=n[r];V(i,`No panel constraints found for index ${r}`);let{collapsedSize:a=0,collapsible:o,minSize:l=0}=i;if(o){let n=t[r];if(V(n!=null,`Previous layout not found for panel index ${r}`),xe(n,l)){let t=n-a;be(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{let r=e<0?1:-1,i=e<0?c:s,a=0;for(;;){let e=t[i];V(e!=null,`Previous layout not found for panel index ${i}`);let o=Ce({panelConstraints:n,panelIndex:i,size:100})-e;if(a+=o,i+=r,i<0||i>=n.length)break}let o=Math.min(Math.abs(e),Math.abs(a));e=e<0?0-o:o}{let r=e<0?s:c;for(;r>=0&&r<n.length;){let i=Math.abs(e)-Math.abs(l),a=t[r];V(a!=null,`Previous layout not found for panel index ${r}`);let s=a-i,c=Ce({panelConstraints:n,panelIndex:r,size:s});if(!xe(a,c)&&(l+=a-c,o[r]=c,l.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?r--:r++}}if(Se(i,o))return i;{let r=e<0?c:s,i=t[r];V(i!=null,`Previous layout not found for panel index ${r}`);let a=i+l,u=Ce({panelConstraints:n,panelIndex:r,size:a});if(o[r]=u,!xe(u,a)){let t=a-u,r=e<0?c:s;for(;r>=0&&r<n.length;){let i=o[r];V(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Ce({panelConstraints:n,panelIndex:r,size:a});if(xe(i,s)||(t-=s-i,o[r]=s),xe(t,0))break;e>0?r--:r++}}}return xe(o.reduce((e,t)=>t+e,0),100)?o:i}function Te({layout:e,panelsArray:t,pivotIndices:n}){let r=0,i=100,a=0,o=0,s=n[0];return V(s!=null,`No pivot index found`),t.forEach((e,t)=>{let{constraints:n}=e,{maxSize:c=100,minSize:l=0}=n;t===s?(r=l,i=c):(a+=l,o+=c)}),{valueMax:Math.min(i,100-a),valueMin:Math.max(r,100-o),valueNow:e[s]}}function Ee(e,t=document){return Array.from(t.querySelectorAll(`[${o.resizeHandleId}][data-panel-group-id="${e}"]`))}function De(e,t,n=document){return Ee(e,n).findIndex(e=>e.getAttribute(o.resizeHandleId)===t)??null}function Oe(e,t,n){let r=De(e,t,n);return r==null?[-1,-1]:[r,r+1]}function ke(e,t=document){return t instanceof HTMLElement&&t?.dataset?.panelGroupId==e?t:t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`)||null}function Ae(e,t=document){return t.querySelector(`[${o.resizeHandleId}="${e}"]`)||null}function je(e,t,n,r=document){let i=Ae(t,r),a=Ee(e,r),o=i?a.indexOf(i):-1;return[n[o]?.id??null,n[o+1]?.id??null]}function Me({committedValuesRef:e,eagerValuesRef:n,groupId:r,layout:i,panelDataArray:a,panelGroupElement:s,setLayout:l}){t.useRef({didWarnAboutMissingResizeHandle:!1}),c(()=>{if(!s)return;let e=Ee(r,s);for(let t=0;t<a.length-1;t++){let{valueMax:n,valueMin:r,valueNow:o}=Te({layout:i,panelsArray:a,pivotIndices:[t,t+1]}),s=e[t];if(s!=null){let e=a[t];V(e,`No panel data found for index "${t}"`),s.setAttribute(`aria-controls`,e.id),s.setAttribute(`aria-valuemax`,``+Math.round(n)),s.setAttribute(`aria-valuemin`,``+Math.round(r)),s.setAttribute(`aria-valuenow`,o==null?``:``+Math.round(o))}}return()=>{e.forEach((e,t)=>{e.removeAttribute(`aria-controls`),e.removeAttribute(`aria-valuemax`),e.removeAttribute(`aria-valuemin`),e.removeAttribute(`aria-valuenow`)})}},[r,i,a,s]),t.useEffect(()=>{if(!s)return;let e=n.current;V(e,`Eager values not found`);let{panelDataArray:t}=e;V(ke(r,s)!=null,`No group found for id "${r}"`);let a=Ee(r,s);V(a,`No resize handles found for group id "${r}"`);let c=a.map(e=>{let n=e.getAttribute(o.resizeHandleId);V(n,`Resize handle element has no handle id attribute`);let[a,c]=je(r,n,t,s);if(a==null||c==null)return()=>{};let u=e=>{if(!e.defaultPrevented)switch(e.key){case`Enter`:{e.preventDefault();let o=t.findIndex(e=>e.id===a);if(o>=0){let e=t[o];V(e,`No panel data found for index ${o}`);let a=i[o],{collapsedSize:c=0,collapsible:u,minSize:d=0}=e.constraints;if(a!=null&&u){let e=we({delta:xe(a,c)?d-c:c-a,initialLayout:i,panelConstraints:t.map(e=>e.constraints),pivotIndices:Oe(r,n,s),prevLayout:i,trigger:`keyboard`});i!==e&&l(e)}}break}}};return e.addEventListener(`keydown`,u),()=>{e.removeEventListener(`keydown`,u)}});return()=>{c.forEach(e=>e())}},[s,e,n,r,i,a,l])}function Ne(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Pe(e,t){let n=e===`horizontal`,{x:r,y:i}=O(t);return n?r:i}function Fe(e,t,n,r,i){let a=n===`horizontal`,s=Ae(t,i);V(s,`No resize handle element found for id "${t}"`);let c=s.getAttribute(o.groupId);V(c,`Resize handle element has no group id attribute`);let{initialCursorPosition:l}=r,u=Pe(n,e),d=ke(c,i);V(d,`No group element found for id "${c}"`);let f=d.getBoundingClientRect(),p=a?f.width:f.height;return(u-l)/p*100}function Ie(e,t,n,r,i,a){if(T(e)){let t=n===`horizontal`,r=0;r=e.shiftKey?100:i??10;let a=0;switch(e.key){case`ArrowDown`:a=t?0:r;break;case`ArrowLeft`:a=t?-r:0;break;case`ArrowRight`:a=t?r:0;break;case`ArrowUp`:a=t?0:-r;break;case`End`:a=100;break;case`Home`:a=-100;break}return a}else return r==null?0:Fe(e,t,n,r,a)}function Le({panelDataArray:e}){let t=Array(e.length),n=e.map(e=>e.constraints),r=0,i=100;for(let a=0;a<e.length;a++){let e=n[a];V(e,`Panel constraints not found for index ${a}`);let{defaultSize:o}=e;o!=null&&(r++,t[a]=o,i-=o)}for(let a=0;a<e.length;a++){let o=n[a];V(o,`Panel constraints not found for index ${a}`);let{defaultSize:s}=o;if(s!=null)continue;let c=e.length-r,l=i/c;r++,t[a]=l,i-=l}return t}function Re(e,t,n){t.forEach((t,r)=>{let i=e[r];V(i,`Panel data not found for index ${r}`);let{callbacks:a,constraints:o,id:s}=i,{collapsedSize:c=0,collapsible:l}=o,u=n[s];if(u==null||t!==u){n[s]=t;let{onCollapse:e,onExpand:r,onResize:i}=a;i&&i(t,u),l&&(e||r)&&(r&&(u==null||H(u,c))&&!H(t,c)&&r(),e&&(u==null||!H(u,c))&&H(t,c)&&e())}})}function ze(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Be({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:i,precision:a=3}){let o=n[i],s;return s=o==null?e==null?`1`:e.toPrecision(a):r.length===1?`1`:o.toPrecision(a),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:`hidden`,pointerEvents:t===null?void 0:`none`}}function Ve(e,t=10){let n=null;return(...r)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...r)},t)}}function He(e){try{if(typeof localStorage<`u`)e.getItem=e=>localStorage.getItem(e),e.setItem=(e,t)=>{localStorage.setItem(e,t)};else throw Error(`localStorage not supported in this environment`)}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function Ue(e){return`react-resizable-panels:${e}`}function We(e){return e.map(e=>{let{constraints:t,id:n,idIsFromProps:r,order:i}=e;return r?n:i?`${i}:${JSON.stringify(t)}`:JSON.stringify(t)}).sort((e,t)=>e.localeCompare(t)).join(`,`)}function Ge(e,t){try{let n=Ue(e),r=t.getItem(n);if(r){let e=JSON.parse(r);if(typeof e==`object`&&e)return e}}catch{}return null}function Ke(e,t,n){return(Ge(e,n)??{})[We(t)]??null}function qe(e,t,n,r,i){let a=Ue(e),o=We(t),s=Ge(e,i)??{};s[o]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{i.setItem(a,JSON.stringify(s))}catch(e){console.error(e)}}function Je({layout:e,panelConstraints:t}){let n=[...e],r=n.reduce((e,t)=>e+t,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(e=>`${e}%`).join(`, `)}`);if(!xe(r,100)&&n.length>0)for(let e=0;e<t.length;e++){let t=n[e];V(t!=null,`No layout data found for index ${e}`),n[e]=100/r*t}let i=0;for(let e=0;e<t.length;e++){let r=n[e];V(r!=null,`No layout data found for index ${e}`);let a=Ce({panelConstraints:t,panelIndex:e,size:r});r!=a&&(i+=r-a,n[e]=a)}if(!xe(i,0))for(let e=0;e<t.length;e++){let r=n[e];V(r!=null,`No layout data found for index ${e}`);let a=r+i,o=Ce({panelConstraints:t,panelIndex:e,size:a});if(r!==o&&(i-=o-r,n[e]=o,xe(i,0)))break}return n}var Ye=100,Xe={getItem:e=>(He(Xe),Xe.getItem(e)),setItem:(e,t)=>{He(Xe),Xe.setItem(e,t)}},Ze={};function U({autoSaveId:e=null,children:n,className:r=``,direction:i,forwardedRef:s,id:l=null,onLayout:u=null,keyboardResizeBy:d=null,storage:p=Xe,style:m,tagName:h=`div`,...g}){let _=f(l),v=t.useRef(null),[y,b]=t.useState(null),[x,S]=t.useState([]),C=ye(),w=t.useRef({}),O=t.useRef(new Map),k=t.useRef(0),A=t.useRef({autoSaveId:e,direction:i,dragState:y,id:_,keyboardResizeBy:d,onLayout:u,storage:p}),j=t.useRef({layout:x,panelDataArray:[],panelDataArrayChanged:!1});t.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),t.useImperativeHandle(s,()=>({getId:()=>A.current.id,getLayout:()=>{let{layout:e}=j.current;return e},setLayout:e=>{let{onLayout:t}=A.current,{layout:n,panelDataArray:r}=j.current,i=Je({layout:e,panelConstraints:r.map(e=>e.constraints)});Ne(n,i)||(S(i),j.current.layout=i,t&&t(i),Re(r,i,w.current))}}),[]),c(()=>{A.current.autoSaveId=e,A.current.direction=i,A.current.dragState=y,A.current.id=_,A.current.onLayout=u,A.current.storage=p}),Me({committedValuesRef:A,eagerValuesRef:j,groupId:_,layout:x,panelDataArray:j.current.panelDataArray,setLayout:S,panelGroupElement:v.current}),t.useEffect(()=>{let{panelDataArray:t}=j.current;if(e){if(x.length===0||x.length!==t.length)return;let n=Ze[e];n??(n=Ve(qe,Ye),Ze[e]=n);let r=[...t],i=new Map(O.current);n(e,r,i,x,p)}},[e,x,p]),t.useEffect(()=>{});let M=t.useCallback(e=>{let{onLayout:t}=A.current,{layout:n,panelDataArray:r}=j.current;if(e.constraints.collapsible){let i=r.map(e=>e.constraints),{collapsedSize:a=0,panelSize:o,pivotIndices:s}=$e(r,e,n);if(V(o!=null,`Panel size not found for panel "${e.id}"`),!H(o,a)){O.current.set(e.id,o);let c=we({delta:Qe(r,e)===r.length-1?o-a:a-o,initialLayout:n,panelConstraints:i,pivotIndices:s,prevLayout:n,trigger:`imperative-api`});ze(n,c)||(S(c),j.current.layout=c,t&&t(c),Re(r,c,w.current))}}},[]),N=t.useCallback((e,t)=>{let{onLayout:n}=A.current,{layout:r,panelDataArray:i}=j.current;if(e.constraints.collapsible){let a=i.map(e=>e.constraints),{collapsedSize:o=0,panelSize:s=0,minSize:c=0,pivotIndices:l}=$e(i,e,r),u=t??c;if(H(s,o)){let t=O.current.get(e.id),o=t!=null&&t>=u?t:u,c=we({delta:Qe(i,e)===i.length-1?s-o:o-s,initialLayout:r,panelConstraints:a,pivotIndices:l,prevLayout:r,trigger:`imperative-api`});ze(r,c)||(S(c),j.current.layout=c,n&&n(c),Re(i,c,w.current))}}},[]),P=t.useCallback(e=>{let{layout:t,panelDataArray:n}=j.current,{panelSize:r}=$e(n,e,t);return V(r!=null,`Panel size not found for panel "${e.id}"`),r},[]),F=t.useCallback((e,t)=>{let{panelDataArray:n}=j.current;return Be({defaultSize:t,dragState:y,layout:x,panelData:n,panelIndex:Qe(n,e)})},[y,x]),I=t.useCallback(e=>{let{layout:t,panelDataArray:n}=j.current,{collapsedSize:r=0,collapsible:i,panelSize:a}=$e(n,e,t);return V(a!=null,`Panel size not found for panel "${e.id}"`),i===!0&&H(a,r)},[]),ee=t.useCallback(e=>{let{layout:t,panelDataArray:n}=j.current,{collapsedSize:r=0,collapsible:i,panelSize:a}=$e(n,e,t);return V(a!=null,`Panel size not found for panel "${e.id}"`),!i||be(a,r)>0},[]),te=t.useCallback(e=>{let{panelDataArray:t}=j.current;t.push(e),t.sort((e,t)=>{let n=e.order,r=t.order;return n==null&&r==null?0:n==null?-1:r==null?1:n-r}),j.current.panelDataArrayChanged=!0,C()},[C]);c(()=>{if(j.current.panelDataArrayChanged){j.current.panelDataArrayChanged=!1;let{autoSaveId:e,onLayout:t,storage:n}=A.current,{layout:r,panelDataArray:i}=j.current,a=null;if(e){let t=Ke(e,i,n);t&&(O.current=new Map(Object.entries(t.expandToSizes)),a=t.layout)}a??=Le({panelDataArray:i});let o=Je({layout:a,panelConstraints:i.map(e=>e.constraints)});Ne(r,o)||(S(o),j.current.layout=o,t&&t(o),Re(i,o,w.current))}}),c(()=>{let e=j.current;return()=>{e.layout=[]}},[]);let R=t.useCallback(e=>{let t=!1,n=v.current;return n&&window.getComputedStyle(n,null).getPropertyValue(`direction`)===`rtl`&&(t=!0),function(n){n.preventDefault();let r=v.current;if(!r)return()=>null;let{direction:i,dragState:a,id:o,keyboardResizeBy:s,onLayout:c}=A.current,{layout:l,panelDataArray:u}=j.current,{initialLayout:d}=a??{},f=Oe(o,e,r),p=Ie(n,e,i,a,s,r),m=i===`horizontal`;m&&t&&(p=-p);let h=u.map(e=>e.constraints),g=we({delta:p,initialLayout:d??l,panelConstraints:h,pivotIndices:f,prevLayout:l,trigger:T(n)?`keyboard`:`mouse-or-touch`}),_=!ze(l,g);(E(n)||D(n))&&k.current!=p&&(k.current=p,!_&&p!==0?m?he(e,p<0?ne:re):he(e,p<0?ie:L):he(e,0)),_&&(S(g),j.current.layout=g,c&&c(g),Re(u,g,w.current))}},[]),z=t.useCallback((e,t)=>{let{onLayout:n}=A.current,{layout:r,panelDataArray:i}=j.current,a=i.map(e=>e.constraints),{panelSize:o,pivotIndices:s}=$e(i,e,r);V(o!=null,`Panel size not found for panel "${e.id}"`);let c=we({delta:Qe(i,e)===i.length-1?o-t:t-o,initialLayout:r,panelConstraints:a,pivotIndices:s,prevLayout:r,trigger:`imperative-api`});ze(r,c)||(S(c),j.current.layout=c,n&&n(c),Re(i,c,w.current))},[]),ae=t.useCallback((e,t)=>{let{layout:n,panelDataArray:r}=j.current,{collapsedSize:i=0,collapsible:a}=t,{collapsedSize:o=0,collapsible:s,maxSize:c=100,minSize:l=0}=e.constraints,{panelSize:u}=$e(r,e,n);u!=null&&(a&&s&&H(u,i)?H(i,o)||z(e,o):u<l?z(e,l):u>c&&z(e,c))},[z]),oe=t.useCallback((e,t)=>{let{direction:n}=A.current,{layout:r}=j.current;if(!v.current)return;let i=Ae(e,v.current);V(i,`Drag handle element not found for id "${e}"`);let a=Pe(n,t);b({dragHandleId:e,dragHandleRect:i.getBoundingClientRect(),initialCursorPosition:a,initialLayout:r})},[]),se=t.useCallback(()=>{b(null)},[]),ce=t.useCallback(e=>{let{panelDataArray:t}=j.current,n=Qe(t,e);n>=0&&(t.splice(n,1),delete w.current[e.id],j.current.panelDataArrayChanged=!0,C())},[C]),le=t.useMemo(()=>({collapsePanel:M,direction:i,dragState:y,expandPanel:N,getPanelSize:P,getPanelStyle:F,groupId:_,isPanelCollapsed:I,isPanelExpanded:ee,reevaluatePanelConstraints:ae,registerPanel:te,registerResizeHandle:R,resizePanel:z,startDragging:oe,stopDragging:se,unregisterPanel:ce,panelGroupElement:v.current}),[M,y,i,N,P,F,_,I,ee,ae,te,R,z,oe,se,ce]),ue={display:`flex`,flexDirection:i===`horizontal`?`row`:`column`,height:`100%`,overflow:`hidden`,width:`100%`};return t.createElement(a.Provider,{value:le},t.createElement(h,{...g,children:n,className:r,id:l,ref:v,style:{...ue,...m},[o.group]:``,[o.groupDirection]:i,[o.groupId]:_}))}var W=t.forwardRef((e,n)=>t.createElement(U,{...e,forwardedRef:n}));U.displayName=`PanelGroup`,W.displayName=`forwardRef(PanelGroup)`;function Qe(e,t){return e.findIndex(e=>e===t||e.id===t.id)}function $e(e,t,n){let r=Qe(e,t),i=r===e.length-1?[r-1,r]:[r,r+1],a=n[r];return{...t.constraints,panelSize:a,pivotIndices:i}}function et({disabled:e,handleId:n,resizeHandler:r,panelGroupElement:i}){t.useEffect(()=>{if(e||r==null||i==null)return;let t=Ae(n,i);if(t==null)return;let a=e=>{if(!e.defaultPrevented)switch(e.key){case`ArrowDown`:case`ArrowLeft`:case`ArrowRight`:case`ArrowUp`:case`End`:case`Home`:e.preventDefault(),r(e);break;case`F6`:{e.preventDefault();let r=t.getAttribute(o.groupId);V(r,`No group element found for id "${r}"`);let a=Ee(r,i),s=De(r,n,i);V(s!==null,`No resize element found for id "${n}"`),a[e.shiftKey?s>0?s-1:a.length-1:s+1<a.length?s+1:0].focus();break}}};return t.addEventListener(`keydown`,a),()=>{t.removeEventListener(`keydown`,a)}},[i,e,n,r])}function tt({children:e=null,className:n=``,disabled:r=!1,hitAreaMargins:i,id:s,onBlur:l,onClick:u,onDragging:d,onFocus:p,onPointerDown:m,onPointerUp:h,style:g={},tabIndex:_=0,tagName:v=`div`,...y}){let b=t.useRef(null),x=t.useRef({onClick:u,onDragging:d,onPointerDown:m,onPointerUp:h});t.useEffect(()=>{x.current.onClick=u,x.current.onDragging=d,x.current.onPointerDown=m,x.current.onPointerUp=h});let S=t.useContext(a);if(S===null)throw Error(`PanelResizeHandle components must be rendered within a PanelGroup container`);let{direction:C,groupId:w,registerResizeHandle:T,startDragging:E,stopDragging:D,panelGroupElement:O}=S,k=f(s),[A,j]=t.useState(`inactive`),[M,N]=t.useState(!1),[P,F]=t.useState(null),I=t.useRef({state:A});c(()=>{I.current.state=A}),t.useEffect(()=>{if(r)F(null);else{let e=T(k);F(()=>e)}},[r,k,T]);let ee=i?.coarse??15,te=i?.fine??5;t.useEffect(()=>{if(r||P==null)return;let e=b.current;V(e,`Element ref not attached`);let t=!1;return le(k,e,C,{coarse:ee,fine:te},(e,n,r)=>{if(!n){j(`inactive`);return}switch(e){case`down`:{j(`drag`),t=!1,V(r,`Expected event to be defined for "down" action`),E(k,r);let{onDragging:e,onPointerDown:n}=x.current;e?.(!0),n?.();break}case`move`:{let{state:e}=I.current;t=!0,e!==`drag`&&j(`hover`),V(r,`Expected event to be defined for "move" action`),P(r);break}case`up`:{j(`hover`),D();let{onClick:e,onDragging:n,onPointerUp:r}=x.current;n?.(!1),r?.(),t||e?.();break}}})},[ee,C,r,te,T,k,P,E,D]),et({disabled:r,handleId:k,resizeHandler:P,panelGroupElement:O});let ne={touchAction:`none`,userSelect:`none`};return t.createElement(v,{...y,children:e,className:n,id:s,onBlur:()=>{N(!1),l?.()},onFocus:()=>{N(!0),p?.()},ref:b,role:`separator`,style:{...ne,...g},tabIndex:_,[o.groupDirection]:C,[o.groupId]:w,[o.resizeHandle]:``,[o.resizeHandleActive]:A===`drag`?`pointer`:M?`keyboard`:void 0,[o.resizeHandleEnabled]:!r,[o.resizeHandleId]:k,[o.resizeHandleState]:A})}tt.displayName=`PanelResizeHandle`,e.Panel=m,e.PanelGroup=W,e.PanelResizeHandle=tt}))(),Vo=`max-w-[180px]`;function Ho({label:e,secondaryLabel:t=null,title:n,isActive:r,onSelect:i,labelMaxWidthClass:a=Vo,closeAction:o}){let s=o!==null;return(0,q.jsxs)(`div`,{className:R(`inline-flex h-7 shrink-0 items-center rounded-md text-xs transition-colors`,r?`bg-muted text-foreground`:`text-muted-foreground hover:bg-state-hover`),children:[(0,q.jsxs)(`button`,{type:`button`,onClick:i,"aria-pressed":r,title:n,className:R(`flex h-full min-w-0 items-center rounded-l-md pl-2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,s?`pr-1`:`rounded-r-md pr-2`),children:[(0,q.jsx)(`span`,{className:R(`truncate`,a),children:e}),t?(0,q.jsx)(`span`,{className:`ml-1 shrink-0 text-muted-foreground`,children:t}):null]}),o?(0,q.jsx)(`button`,{type:`button`,onClick:o.onClose,disabled:o.isClosing,"aria-label":o.closeLabel,title:o.closeTooltip,className:`mr-1 ml-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded opacity-70 transition-opacity hover:bg-muted-foreground/15 hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-30`,children:o.isClosing?(0,q.jsx)(L,{name:`Spinner`,className:`size-3 animate-spin`}):(0,q.jsx)(L,{name:`X`,className:`size-3`})}):null]})}var Uo=`uncommitted`;function Wo(e,t){if(e===`uncommitted`)return{type:`uncommitted`};if(e)return{type:`commit`,sha:e};if(t)return{type:`all`,mergeBaseBranch:t}}function Go(e,t={hasUncommittedChanges:!1}){let n={value:`all`,label:`All changes`},r={value:Uo,label:`Uncommitted changes`},i=e.map(e=>({value:e.sha,label:e.subject,monoPrefix:e.shortSha}));return e.length>0||t.hasUncommittedChanges?[n,...t.hasUncommittedChanges?[r]:[],...i]:[n]}function Ko(e,t,n={hasUncommittedChanges:!1}){return e?e===`uncommitted`?!n.hasUncommittedChanges:!t.some(t=>t.sha===e):!1}function qo(e){let t=e.currentGitDiff.trim().length>0,n=$t(e.currentGitDiff),r=e.parsedGitDiffFileCount>0,i=t&&e.lastParsedGitDiffKey!==n;return{currentGitDiffKey:n,hasCurrentGitDiff:t,hasParsedGitDiffFiles:r,isAwaitingCurrentGitDiffParse:i,isPreparingGitDiff:!r&&(e.isAwaitingPrerequisites||e.isGitDiffLoading||e.isParsingGitDiffFiles||i)}}function Jo({entry:e,expectedFileCount:t}){return t>10?!0:Ht(e.fileDiff)===`deleted`}function Yo({bulkCollapsePreference:e,currentCollapsedFileKeys:t,expectedFileCount:n,focusedFileKey:r,parsedGitDiffFileEntries:i,previousFileKeys:a}){if(e===`expanded-all`)return new Set;let o=new Set;for(let s of i){if(r!==null){s.key!==r&&o.add(s.key);continue}if(e===`collapsed-all`){o.add(s.key);continue}if(a.has(s.key)){t.has(s.key)&&o.add(s.key);continue}Jo({entry:s,expectedFileCount:n})&&o.add(s.key)}return o}function Xo(e){let t=$t(e.gitDiff);if(!e.isDiffPanelActive||e.gitDiff.trim().length===0)return{kind:`reset`,gitDiffKey:t,patchChunks:[]};let n=sn(e.gitDiff);return n.length===0?{kind:`empty`,gitDiffKey:t,patchChunks:[]}:n.length<=24?{kind:`immediate`,gitDiffKey:t,patchChunks:n}:{kind:`batched`,gitDiffKey:t,patchChunks:n}}var Zo=150,Qo=4,$o=6,es=30,ts=70;function ns(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function rs({environmentId:e,gitDiffIdentity:t,expectedGitDiffFileCount:n,parsedGitDiffFileEntries:r,isDiffPanelActive:i,isParsingGitDiffFiles:a}){let o=xr((0,K.useCallback)(e=>e(la),[])),s=rt(la),c=rt(ua),l=(0,K.useRef)(new Map),u=(0,K.useRef)(new Map),d=(0,K.useRef)(`default`),f=(0,K.useRef)(null),p=(0,K.useRef)(new Set),m=(0,K.useRef)(new Set),h=(0,K.useRef)(new Map),g=(0,K.useCallback)(e=>{let t=u.current.get(e);if(t===void 0)return;u.current.delete(e);let n=l.current.get(t);n&&(n.delete(e),n.size===0&&(window.clearTimeout(t),l.current.delete(t)))},[]),_=(0,K.useCallback)(()=>{for(let e of l.current.keys())window.clearTimeout(e);l.current.clear(),u.current.clear()},[]);(0,K.useLayoutEffect)(()=>{_(),d.current=`default`,f.current=null,p.current=new Set,m.current.clear(),s(new Set),c(new Set)},[e,t,_,s,c]),(0,K.useEffect)(()=>()=>{_(),m.current.clear()},[_]);let v=(0,K.useCallback)((e,t)=>{if(e.length===0)return;let n=[],r=new Set;for(let t of e)r.has(t)||(r.add(t),n.push(t));if(n.length===0)return;let i=Math.max(1,Math.min(t?.initialBatchSize??n.length,n.length)),a=Math.max(1,t?.batchSize??n.length),o=Math.max(0,t?.initialDelayMs??Zo),s=Math.max(0,t?.batchDelayMs??Zo);c(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)g(e);let d=(e,t)=>{let n=new Set(e),r=0;r=window.setTimeout(()=>{let e=l.current.get(r);if(e){l.current.delete(r);for(let t of e)u.current.delete(t);c(t=>{let n=!1,r=new Set(t);for(let t of e)n=r.delete(t)||n;return n?r:t})}},t),l.current.set(r,n);for(let e of n)u.current.set(e,r)};d(n.slice(0,i),o);let f=0;for(let e=i;e<n.length;e+=a){let t=o+(f+1)*s;d(n.slice(e,e+a),t),f+=1}},[g,c]);(0,K.useLayoutEffect)(()=>{if(!i)return;if(r.length===0&&!a&&n===0){p.current=new Set,m.current.clear(),s(e=>e.size===0?e:new Set),c(e=>e.size===0?e:new Set),_();return}if(r.length===0)return;let e=new Set(r.map(({key:e})=>e));f.current!==null&&!e.has(f.current)&&(f.current=null);for(let t of m.current)e.has(t)||m.current.delete(t);let t=Yo({bulkCollapsePreference:d.current,currentCollapsedFileKeys:o(),expectedFileCount:n,focusedFileKey:f.current,parsedGitDiffFileEntries:r,previousFileKeys:p.current});p.current=e,s(e=>ns(e,t)?e:t);let l=[];for(let{key:e}of r)m.current.has(e)||(m.current.add(e),t.has(e)||l.push(e));l.length!==0&&v(l,n>10||a||l.length>Qo?{initialBatchSize:Qo,initialDelayMs:es,batchSize:$o,batchDelayMs:ts}:void 0)},[_,n,o,i,a,r,v,s,c]);let y=(0,K.useCallback)(e=>{d.current=`default`,f.current=null;let t=o().has(e);if(s(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),t){v([e]);return}g(e),c(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[g,v,s,c,o]),b=(0,K.useCallback)(e=>{if(r.length===0)return;let t=r.map(({key:e})=>e);if(!t.includes(e))return;d.current=`default`,f.current=e,m.current.add(e);let n=o().has(e);for(let n of t)n!==e&&g(n);s(new Set(t.filter(t=>t!==e))),c(t=>{let n=!1,r=new Set(t);for(let i of t)i!==e&&(n=r.delete(i)||n);return n?r:t}),n&&v([e])},[g,o,r,v,s,c]),x=(0,K.useCallback)(()=>{if(r.length===0)return;let e=r.map(({key:e})=>e),t=o();if(e.every(e=>t.has(e))){d.current=`expanded-all`,f.current=null,s(new Set),v(e);return}d.current=`collapsed-all`,f.current=null,_(),s(new Set(e)),c(new Set)},[_,r,v,s,c,o]),S=(0,K.useCallback)((e,t)=>{if(t){h.current.set(e,t);return}h.current.delete(e)},[]);return{focusGitDiffFile:b,gitDiffFileRefs:h,queuedGitDiffFileRenderKeys:m.current,setGitDiffFileRef:S,toggleAllGitDiffFilesCollapsed:x,toggleGitDiffFileCollapsed:y}}function is({environmentId:e,isDiffPanelActive:t,defaultMergeBaseBranch:n}){let r=dt(da),i=dt(fa),a=rt(fa),o=dt(la),s=dt(ua),c=(0,K.useRef)(null),[l,u]=(0,K.useState)(null),[d,f]=(0,K.useState)([]),[p,m]=(0,K.useState)(0),[h,g]=(0,K.useState)(!1),[_,v]=(0,K.useState)(``),[y,b]=(0,K.useState)(null),x=r??n,S=(0,K.useMemo)(()=>Wo(l,x),[x,l]),w=(0,K.useMemo)(()=>os({environmentId:e,target:S}),[e,S]),{data:T}=hi(e??``,x,{enabled:!!e&&!!x&&t}),{data:E,isLoading:D,isPlaceholderData:O,error:k}=vi(e??``,{enabled:!!e&&t&&S!==void 0,target:S});(0,K.useEffect)(()=>{if(E&&!O){b(e=>e?.requestIdentity===w&&e.response===E?e:{requestIdentity:w,response:E});return}D||b(e=>e?.requestIdentity===w?e:null)},[E,w,D,O]);let A=E&&!O?E:y?.requestIdentity===w?y.response:void 0,j=A?.mergeBaseRef??null,N=(0,K.useMemo)(()=>as({environmentId:e,mergeBaseRef:j,target:S}),[j,e,S]),P=A?.diff??``,F=(0,K.useMemo)(()=>At(d),[d]),{focusGitDiffFile:I,gitDiffFileRefs:te,queuedGitDiffFileRenderKeys:ne,setGitDiffFileRef:re,toggleAllGitDiffFilesCollapsed:ie,toggleGitDiffFileCollapsed:L}=rs({environmentId:e,gitDiffIdentity:N,expectedGitDiffFileCount:p,parsedGitDiffFileEntries:F,isDiffPanelActive:t,isParsingGitDiffFiles:h}),R=qo({currentGitDiff:P,isAwaitingPrerequisites:t&&!!e&&S===void 0,isGitDiffLoading:D,isParsingGitDiffFiles:h,lastParsedGitDiffKey:_,parsedGitDiffFileCount:F.length});(0,K.useEffect)(()=>{let e=Xo({gitDiff:P,isDiffPanelActive:t});if(e.kind===`reset`){f([]),m(0),g(!1),v(``);return}if(f([]),m(e.patchChunks.length),e.kind===`empty`){g(!1),v(e.gitDiffKey);return}if(e.kind===`immediate`){f(_r(P)),g(!1),v(e.gitDiffKey);return}let n=e.patchChunks,r=!1,i=null,a=0,o=!1,s=()=>{if(r)return;let t=a===0?6:18,c=n.slice(a,a+t);if(c.length===0){g(!1),v(e.gitDiffKey);return}let l=wt(c);if(!r){if(a+=c.length,f(e=>o?[...e,...l]:l),o=!0,a>=n.length||r){g(!1),v(e.gitDiffKey);return}i=window.setTimeout(s,24)}};return g(!0),s(),()=>{r=!0,i!==null&&window.clearTimeout(i)}},[P,t]),(0,K.useEffect)(()=>{u(null)},[e]),(0,K.useEffect)(()=>{a(null)},[e,a]),(0,K.useEffect)(()=>{i&&u(null)},[i]);let z=(T?.workingTree.files.length??0)>0;(0,K.useEffect)(()=>{Ko(l,T?.mergeBase?.commits??[],{hasUncommittedChanges:z})&&u(null)},[T?.mergeBase?.commits,z,l]),(0,K.useLayoutEffect)(()=>{if(!i||!t){c.current=null;return}let e=F.find(({fileDiff:e})=>It(e,i));if(!e){!D&&!h&&!R.isAwaitingCurrentGitDiffParse&&a(null);return}if(c.current!==i){c.current=i,I(e.key);return}let n=o.has(e.key),r=!ne.has(e.key)||s.has(e.key);n||r||(te.current.get(e.key)?.scrollIntoView({block:`start`,behavior:`instant`}),a(null))},[o,I,te,R.isAwaitingCurrentGitDiffParse,t,D,h,s,F,i,ne,a]);let ae=(0,K.useMemo)(()=>T?.mergeBase?.commits??[],[T?.mergeBase?.commits]),oe=l??`all`,se=(0,K.useMemo)(()=>Go(ae,{hasUncommittedChanges:z}),[ae,z]),ce=(0,K.useMemo)(()=>Pt(h?[]:d,P),[P,h,d]),{hasParsedGitDiffFiles:le,isPreparingGitDiff:ue}=R,de=(0,K.useCallback)(e=>{u(e===`all`?null:e)},[]),fe=M(),pe=(0,K.useMemo)(()=>cs(S,j),[S,j]);return{currentGitDiff:P,gitDiffError:k,gitDiffSelectOptions:se,gitDiffSelectValue:oe,gitDiffStats:ce,hasParsedGitDiffFiles:le,isGitDiffLoading:D,isParsingGitDiffFiles:h,isPreparingGitDiff:ue,onGitDiffSelectionChange:de,onRequestFileContents:(0,K.useMemo)(()=>{if(!e||pe===void 0)return;let t=e,n=pe,r=ss(n);return async(e,i)=>{let a=await fe.fetchQuery({queryKey:ee(t,n.type,r,e,i),queryFn:()=>C(t,n,e,i),staleTime:5e3});return ls(e,a.content,a.contentEncoding)}},[e,pe,fe]),parsedGitDiffFileEntries:F,queuedGitDiffFileRenderKeys:ne,setGitDiffFileRef:re,threadGitDiff:A,toggleAllGitDiffFilesCollapsed:ie,toggleGitDiffFileCollapsed:L}}function as({environmentId:e,mergeBaseRef:t,target:n}){let r=e??`none`;if(!n)return`${r}:none`;switch(n.type){case`uncommitted`:return`${r}:uncommitted`;case`branch_committed`:return[r,`branch_committed`,n.mergeBaseBranch,t??`pending`].join(`:`);case`all`:return[r,`all`,n.mergeBaseBranch,t??`pending`].join(`:`);case`commit`:return`${r}:commit:${n.sha}`;default:return n}}function os({environmentId:e,target:t}){let n=e??`none`;if(!t)return`${n}:none`;switch(t.type){case`uncommitted`:return`${n}:uncommitted`;case`branch_committed`:return[n,`branch_committed`,t.mergeBaseBranch].join(`:`);case`all`:return[n,`all`,t.mergeBaseBranch].join(`:`);case`commit`:return`${n}:commit:${t.sha}`;default:return t}}function ss(e){switch(e.type){case`uncommitted`:return null;case`branch_committed`:case`all`:return e.mergeBaseRef;case`commit`:return e.sha;default:return e}}function cs(e,t){if(e)switch(e.type){case`uncommitted`:return{type:`uncommitted`};case`branch_committed`:return t?{type:`branch_committed`,mergeBaseRef:t}:void 0;case`all`:return t?{type:`all`,mergeBaseRef:t}:void 0;case`commit`:return{type:`commit`,sha:e.sha};default:return e}}function ls(e,t,n){return n===`utf8`?{name:e,contents:t}:null}var us=760;function ds({isSecondaryPanelOpen:e}){let[t,n]=(0,K.useState)(`unified`),r=rt(sa),i=dt(ca),a=rt(ca),o=(0,K.useRef)(null),s=(0,K.useRef)(null),c=(0,K.useRef)(i),l=(0,K.useRef)(null),u=(0,K.useRef)(!1),d=(0,K.useCallback)(t=>{if(!e||t===void 0)return;let r=t>=us,i=l.current,a=i!==null&&i!==r;if(a&&u.current&&(u.current=!1),!u.current||a){let e=r?`split`:`unified`;n(t=>t===e?t:e)}l.current=r},[e,n]),f=(0,K.useRef)(e);return(0,K.useEffect)(()=>{if(f.current===e)return;f.current=e;let t=s.current;t&&(e?(t.expand(c.current),d(o.current?.getBoundingClientRect().width)):t.collapse())},[e,d]),(0,K.useEffect)(()=>{e||(u.current=!1,l.current=null)},[e]),Qn({ref:o,onResize:({width:e})=>{d(e??o.current?.getBoundingClientRect().width)}}),{gitDiffDisplayMode:t,handleGitDiffDisplayModeChange:(0,K.useCallback)(e=>{u.current=!0,n(e)},[n]),handleSecondaryPanelDragging:(0,K.useCallback)(e=>{if(r(e),e){u.current=!1;return}c.current>0&&a(c.current)},[r,a]),handleSecondaryPanelResize:(0,K.useCallback)(e=>{e<=0||(c.current=e)},[]),persistedWidthPercent:i,secondaryPanelRef:o,secondaryResizablePanelRef:s}}var fs=`20rem`;function ps({value:e,options:t,onChange:n,disabled:r,panelWidthPx:i}){let a=t.find(t=>t.value===e),o=a?.label??e,s=a?.monoPrefix;return(0,q.jsxs)(B,{children:[(0,q.jsx)(ge,{asChild:!0,disabled:r,children:(0,q.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,disabled:r,className:R(`h-8 w-full min-w-0 justify-between gap-2 rounded-lg border border-border bg-transparent px-2.5 text-xs font-normal`,r&&`opacity-60`),children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[s?(0,q.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:s}):null,(0,q.jsx)(`span`,{className:`truncate`,children:o})]}),(0,q.jsx)(L,{name:`ChevronDown`,className:`size-3.5 shrink-0 text-muted-foreground`})]})}),(0,q.jsx)(ye,{align:`start`,className:`min-w-[var(--radix-dropdown-menu-trigger-width)]`,style:{maxWidth:`min(var(--radix-popper-available-width), max(${fs}, ${i}px))`},children:t.map(t=>(0,q.jsxs)(he,{onSelect:()=>n(t.value),className:`flex items-center justify-between gap-2`,children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,title:t.monoPrefix?`${t.monoPrefix} ${t.label}`:t.label,children:[t.monoPrefix?(0,q.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:t.monoPrefix}):null,(0,q.jsx)(`span`,{className:`truncate`,children:t.label})]}),(0,q.jsx)(L,{name:`Check`,className:R(_e,t.value===e?`opacity-100`:`opacity-0`)})]},t.value))})]})}function ms({selectionValue:e,selectionOptions:t,onSelectionChange:n,isSelectorDisabled:r,stats:i,isParsing:a,areAllFilesCollapsed:o,isCollapseAllDisabled:s,onToggleAllCollapsed:c,displayMode:l,onDisplayModeChange:u}){let d=(0,K.useRef)(null),{width:f=0}=Qn({ref:d,box:`content-box`});return(0,q.jsx)(`div`,{ref:d,className:`px-4 pb-3`,children:(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,q.jsx)(ps,{value:e,options:t,onChange:n,disabled:r,panelWidthPx:f})}),(0,q.jsx)(`span`,{className:`min-w-0 shrink truncate text-xs text-muted-foreground`,title:xi(i),children:Si(i)}),a?(0,q.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground`,children:[(0,q.jsx)(L,{name:`Spinner`,className:`size-3 animate-spin`}),`Parsing`]}):null,(0,q.jsxs)(`div`,{className:`ml-auto flex min-w-0 shrink-0 items-center justify-end gap-1`,children:[(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 w-7 rounded-md p-0 text-muted-foreground`,onClick:c,disabled:s,"aria-label":o?`Expand all files`:`Collapse all files`,title:o?`Expand all files`:`Collapse all files`,children:o?(0,q.jsx)(L,{name:`ChevronsDown`,className:`size-3.5`}):(0,q.jsx)(L,{name:`ChevronsUp`,className:`size-3.5`})}),(0,q.jsxs)(`div`,{className:`inline-flex items-center gap-1 rounded-lg border border-border p-0.5`,role:`tablist`,"aria-label":`Diff view mode`,children:[(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 w-7 rounded-md p-0 text-muted-foreground`,onClick:()=>u(`unified`),"aria-label":`Stacked diff view`,"aria-pressed":l===`unified`,title:`Stacked diff view`,children:(0,q.jsx)(L,{name:`Rows2`,className:`size-3.5`})}),(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 w-7 rounded-md p-0 text-muted-foreground`,onClick:()=>u(`split`),"aria-label":`Split diff view`,"aria-pressed":l===`split`,title:`Split diff view`,children:(0,q.jsx)(L,{name:`Columns2`,className:`size-3.5`})})]})]})]})})}var hs=new Set([`md`,`mdx`,`markdown`]),gs={"--diffs-font-size":`12px`,"--diffs-line-height":`18px`,"--diffs-gap-block":`16px`},_s={"--md-content-w":`100cqi`},vs={width:`100%`,height:`100%`,border:0};function ys(e){let t=e.split(`.`).pop()?.toLowerCase();return t!==void 0&&hs.has(t)}function bs({state:e,path:t,copyPath:n=null,onOpenInEditor:r,statusLabel:i=null}){let a=e.kind===`ready`&&ys(e.file.name),[o,s]=(0,K.useState)(`preview`);return(0,K.useEffect)(()=>{s(`preview`)},[t]),(0,q.jsxs)(`div`,{className:e.kind===`html`?`@container/page flex h-full min-h-0 flex-col`:`@container/page`,style:_s,children:[(0,q.jsx)(Ss,{path:t,copyPath:n,onOpenInEditor:r,statusLabel:i,markdownMode:a?o:null,onMarkdownModeChange:s}),(0,q.jsx)(xs,{state:e,path:t,markdownMode:a?o:`preview`})]})}function xs({state:e,path:t,markdownMode:n}){return e.kind===`loading`?(0,q.jsx)(Os,{}):e.kind===`empty`?(0,q.jsx)(ks,{message:`Empty file.`}):e.kind===`not-found`?(0,q.jsx)(ks,{message:`File not found.`,role:`alert`}):e.kind===`manager-status-pending`?(0,q.jsx)(ks,{message:`Manager hasn't written a status yet.`}):e.kind===`error`?(0,q.jsx)(ks,{message:e.message??`Failed to load file`,role:e.message===void 0?`alert`:void 0}):e.kind===`image`?(0,q.jsx)(ws,{url:e.url,alt:t}):e.kind===`html`?(0,q.jsx)(Ts,{file:e.file}):ys(e.file.name)&&n===`preview`?(0,q.jsx)(Cs,{file:e.file}):(0,q.jsx)(As,{file:e.file,lineNumber:e.lineNumber??null})}function Ss({path:e,copyPath:t,onOpenInEditor:n,statusLabel:r,markdownMode:i,onMarkdownModeChange:a}){return(0,q.jsxs)(`div`,{className:`sticky top-0 z-10`,children:[(0,q.jsxs)(`div`,{className:`flex h-9 items-center gap-2 border-b border-border bg-background px-4`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,q.jsx)(Bt,{className:`min-w-0 font-mono text-xs font-medium leading-5 text-foreground`,title:e,children:e}),r===null?null:(0,q.jsxs)(`span`,{className:`shrink-0 text-xs leading-5 text-muted-foreground`,children:[`(`,r,`)`]}),t===null?null:(0,q.jsx)(cn,{text:t,label:`Copy file path`,className:`shrink-0 rounded-md hover:bg-state-hover hover:text-foreground`}),n?(0,q.jsx)(`button`,{type:`button`,onClick:()=>n(e),"aria-label":`Open in editor`,title:`Open in editor`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-state-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:(0,q.jsx)(L,{name:`ExternalLink`,"aria-hidden":!0,className:`size-3`})}):null]}),i===null?null:(0,q.jsxs)(`div`,{className:`ml-auto inline-flex shrink-0 items-center gap-0.5 rounded-md border border-border p-0.5`,role:`tablist`,"aria-label":`Markdown view mode`,children:[(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`h-5 rounded-sm px-2 text-xs text-muted-foreground`,onClick:()=>a(`preview`),"aria-pressed":i===`preview`,title:`Rendered preview`,children:`Preview`}),(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`h-5 rounded-sm px-2 text-xs text-muted-foreground`,onClick:()=>a(`source`),"aria-pressed":i===`source`,title:`Markdown source`,children:`Raw`})]})]}),(0,q.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 top-full h-4 bg-gradient-to-b from-background to-transparent`})]})}function Cs({file:e}){return(0,q.jsx)(`div`,{className:`px-4 pt-4`,children:(0,q.jsx)(Ut,{allowHtml:!0,content:e.contents})})}function ws({url:e,alt:t}){return(0,q.jsx)(`div`,{className:`pt-4`,children:(0,q.jsx)(`img`,{src:e,alt:t,className:`block max-h-[34rem] w-full object-contain`})})}function Ts({file:e}){return(0,q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,q.jsx)(`iframe`,{title:e.name,srcDoc:e.contents,style:vs})})}function Es(e){let t=e.querySelectorAll(`[data-file-preview-target-line]`);for(let e of t)e.removeAttribute(`data-file-preview-target-line`),e.removeAttribute(`data-selected-line`)}function Ds(e,t){let n=e.querySelectorAll(`[data-line="${t}"]`);for(let e of n)if(e instanceof HTMLElement&&e.dataset.lineIndex!==void 0)return e;for(let e of n)if(e instanceof HTMLElement)return e;return null}function Os(){return(0,q.jsxs)(`div`,{className:`space-y-2 px-4 pt-4`,"aria-busy":!0,children:[(0,q.jsx)(sr,{className:`h-3 w-3/4 rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-full rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-5/6 rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-2/3 rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-full rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-3/5 rounded-sm`})]})}function ks({message:e,role:t}){return(0,q.jsx)(`p`,{role:t,className:`mx-4 mt-4 rounded-lg border border-dashed border-border bg-surface-raised px-3 py-6 text-center text-sm text-muted-foreground`,children:e})}function As({file:e,lineNumber:t}){let n=vr(),r=(0,K.useRef)(null),i=(0,K.useMemo)(()=>({themeType:n,overflow:`scroll`,disableFileHeader:!0,enableLineSelection:t!==null}),[t,n]),a=(0,K.useMemo)(()=>t===null?null:{start:t,end:t},[t]);return(0,K.useEffect)(()=>{let e=r.current,n=null,i=null,a=0;function o(){n=window.requestAnimationFrame(s),i=window.setTimeout(s,16)}function s(){let e=r.current;if(!e||(Es(e),Es(e.ownerDocument.body),t===null))return;let n=Ds(e,t)??Ds(e.ownerDocument.body,t);if(n){n.setAttribute(`data-file-preview-target-line`,``),n.setAttribute(`data-selected-line`,`single`),n.scrollIntoView?.({block:`center`});return}a+=1,a<8&&o()}return s(),()=>{e&&(Es(e),Es(e.ownerDocument.body)),n!==null&&window.cancelAnimationFrame(n),i!==null&&window.clearTimeout(i)}},[e.contents,e.name,t]),(0,q.jsx)(`div`,{ref:r,style:gs,"data-file-preview-line-number":t??void 0,children:(0,q.jsx)(kr,{file:e,options:i,selectedLines:a})})}var js=`STATUS.md`,Ms=`STATUS.html`;function Ns(e){return e===`STATUS.md`||e===`STATUS.html`}function Ps(e){return e?.some(e=>e.path===`STATUS.html`)??!1?Ms:js}function Fs({activePath:e,copyPath:t=null,error:n,filePreview:r,isLoading:i,lineNumber:a=null,onOpenInEditor:o,pendingNotFoundPath:s,statusLabel:c=null}){if(n){let r=n instanceof b&&n.status===404;return r&&e===s?(0,q.jsx)(bs,{path:e,copyPath:t,onOpenInEditor:o,statusLabel:c,state:{kind:`manager-status-pending`}}):(0,q.jsx)(bs,{path:e,copyPath:t,onOpenInEditor:o,statusLabel:c,state:{kind:r?`not-found`:`error`}})}return i||!r||r.path!==e?(0,q.jsx)(bs,{path:e,copyPath:t,onOpenInEditor:o,statusLabel:c,state:{kind:`loading`}}):e===`STATUS.html`&&r.kind===`text`?(0,q.jsx)(bs,{path:e,copyPath:t,onOpenInEditor:o,statusLabel:c,state:{kind:`html`,file:{name:r.name??e,contents:r.content}}}):r.kind===`text`?r.content.length===0?(0,q.jsx)(bs,{path:e,copyPath:t,onOpenInEditor:o,statusLabel:c,state:{kind:`empty`}}):(0,q.jsx)(bs,{path:e,copyPath:t,onOpenInEditor:o,statusLabel:c,state:{kind:`ready`,lineNumber:a,file:{name:r.name??e,contents:r.content}}}):r.kind===`image`?(0,q.jsx)(bs,{path:e,copyPath:t,onOpenInEditor:o,statusLabel:c,state:{kind:`image`,url:r.url}}):(0,q.jsx)(bs,{path:e,copyPath:t,onOpenInEditor:o,statusLabel:c,state:{kind:`error`,message:`Preview not available for ${r.mimeType}.`}})}function Is({activePath:e,copyPath:t,error:n,filePreview:r,isLoading:i,lineNumber:a,onOpenInEditor:o,pinnedPath:s}){return(0,q.jsx)(Fs,{activePath:e,copyPath:t,error:n,filePreview:r,isLoading:i,lineNumber:a,onOpenInEditor:o,pendingNotFoundPath:s})}var Ls=3,Rs=`min-h-0 flex-1 overflow-x-hidden overflow-y-auto`;function zs({count:e=Ls}){return(0,q.jsx)(`div`,{className:`space-y-2 pt-2`,children:Array.from({length:e}).map((e,t)=>(0,q.jsxs)(`div`,{className:`rounded-lg border border-border bg-surface-raised`,children:[(0,q.jsx)(`div`,{className:`border-b border-border bg-surface-recessed px-3 py-1.5`,children:(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,q.jsx)(sr,{className:`size-4 shrink-0 rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-48 max-w-full rounded-sm`})]}),(0,q.jsx)(sr,{className:`h-3 w-14 shrink-0 rounded-sm`})]})}),(0,q.jsxs)(`div`,{className:`space-y-1.5 px-2.5 py-2`,children:[(0,q.jsx)(sr,{className:`h-3 w-full rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-[94%] rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-[90%] rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-[86%] rounded-sm`})]})]},`git-diff-skeleton-${t}`))})}var Bs=(0,K.memo)(function({fileKey:e,fileDiff:t,diffViewOptions:n,filePathRoot:r,onOpenFileInEditor:i,onOpenFilePreview:a,isCollapsed:o,isRendering:s,setGitDiffFileRef:c,toggleGitDiffFileCollapsed:l,onRequestFileContents:u}){return(0,q.jsx)(Yt,{fileDiff:t,diffViewOptions:n,filePathRoot:r,onOpenFileInEditor:i,onOpenFilePreview:a,isCollapsed:o,onToggleCollapsed:(0,K.useCallback)(()=>{l(e)},[e,l]),stickyHeader:!0,isRendering:s,cardRef:(0,K.useCallback)(t=>{c(e,t)},[e,c]),onRequestFileContents:u})});function Vs({collapsedGitDiffFileKeys:e,currentGitDiff:t,gitDiffError:n,gitDiffViewOptions:r,isParsingGitDiffFiles:i,isPreparingGitDiff:a,loadingGitDiffFileKeys:o,onOpenFileInEditor:s,onOpenFilePreview:c,onRequestFileContents:l,parsedGitDiffFileEntries:u,queuedGitDiffFileRenderKeys:d,setGitDiffFileRef:f,threadGitDiff:p,toggleGitDiffFileCollapsed:m,workspaceRootPath:h}){let g=t.trim().length>0;return(0,q.jsx)(`div`,{className:R(Rs,`px-4 pb-3`),children:a?(0,q.jsx)(zs,{}):n?(0,q.jsx)(`p`,{className:`rounded-lg border border-surface-destructive-border bg-surface-destructive px-3 py-2 text-xs text-destructive`,children:n.message}):p&&g?(0,q.jsxs)(q.Fragment,{children:[u.length>0?(0,q.jsxs)(`div`,{className:`space-y-2`,children:[u.map(({key:t,fileDiff:n})=>(0,q.jsx)(Bs,{fileKey:t,fileDiff:n,diffViewOptions:r,filePathRoot:h,onOpenFileInEditor:s,onOpenFilePreview:c,isCollapsed:e.has(t),isRendering:!d.has(t)||o.has(t),setGitDiffFileRef:f,toggleGitDiffFileCollapsed:m,onRequestFileContents:l},t)),i?(0,q.jsx)(`div`,{className:`rounded-lg border border-border bg-surface-raised px-3 py-3`,children:(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(sr,{className:`h-3 w-52 max-w-full rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 w-5/6 rounded-sm`})]})}):null]}):(0,q.jsx)(`pre`,{className:`overflow-auto whitespace-pre rounded-lg border border-border bg-surface-raised p-3 font-mono text-xs text-foreground`,children:p.diff}),p.truncated?(0,q.jsx)(`p`,{className:`pt-2 text-xs text-muted-foreground`,children:`Diff output was truncated for display.`}):null]}):(0,q.jsx)(`p`,{className:`rounded-lg border border-dashed border-border bg-surface-raised px-3 py-6 text-center text-sm text-muted-foreground`,children:`No diff to display.`})})}function Hs({metadataContent:e}){return(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-4 pb-3`,children:e})}function Us({activePath:e,copyPath:t=null,environmentId:n,lineNumber:r,onOpenInEditor:i,source:a,statusLabel:o}){let{data:s,error:c,isLoading:l}=_i(n,e,a);return(0,q.jsx)(Fs,{activePath:e,copyPath:t,error:c,filePreview:s,isLoading:l,lineNumber:r,onOpenInEditor:i,statusLabel:o})}function Ws({activePath:e,environmentId:t,lineNumber:n,onOpenInEditor:r,threadId:i}){let{data:a,error:o,isLoading:s}=Le(i,t,e);return(0,q.jsx)(Fs,{activePath:e,error:o,filePreview:a,isLoading:s,lineNumber:n,onOpenInEditor:r,statusLabel:null})}function Gs({activePath:e,copyPath:t=null,isManagerThread:n,onOpenInEditor:r,pinnedPath:i,threadId:a}){let{data:o,error:s,isLoading:c}=De(a,e,{enabled:n});return(0,q.jsx)(Is,{activePath:e,copyPath:t,error:s,filePreview:o,isLoading:c,onOpenInEditor:r,pinnedPath:i})}var Ks=24,qs=70,Js=`duration-[220ms] ease-[cubic-bezier(0.32,0.72,0,1)]`,Ys=`min-h-0 flex-1 overflow-x-hidden overflow-y-auto`;function Xs({activePanel:e,canUseGitUi:t,defaultMergeBaseBranch:n,environmentId:r,metadataContent:i,fileTabs:a,fileTabContent:o,isOpen:s,showGitDiffTab:c=!0,onPanelFocus:l,onPanelChange:u,onCollapse:d,onClose:f,workspaceRootPath:p,onOpenFileInEditor:m,onOpenFilePreview:h,renderAsDrawer:g}){let _=a?.find(e=>e.isActive)!==void 0,v=g?`X`:`PanelRight`,{gitDiffDisplayMode:y,handleGitDiffDisplayModeChange:b,handleSecondaryPanelDragging:x,handleSecondaryPanelResize:S,persistedWidthPercent:C,secondaryPanelRef:w,secondaryResizablePanelRef:T}=ds({isSecondaryPanelOpen:s}),E=!t&&e===`git-diff`?`thread-info`:e,D=E===`git-diff`,{currentGitDiff:O,gitDiffError:k,gitDiffSelectOptions:A,gitDiffSelectValue:M,gitDiffStats:N,hasParsedGitDiffFiles:P,isGitDiffLoading:F,isParsingGitDiffFiles:I,isPreparingGitDiff:ee,onGitDiffSelectionChange:te,onRequestFileContents:ne,parsedGitDiffFileEntries:re,queuedGitDiffFileRenderKeys:ie,setGitDiffFileRef:z,threadGitDiff:ae,toggleAllGitDiffFilesCollapsed:oe,toggleGitDiffFileCollapsed:se}=is({environmentId:r,isDiffPanelActive:D,defaultMergeBaseBranch:n}),ce=dt(la),le=dt(ua),ue=(0,K.useMemo)(()=>P&&re.every(({key:e})=>ce.has(e)),[ce,P,re]),de=vr(),fe=(0,K.useMemo)(()=>({...Kt,diffStyle:y,themeType:de}),[y,de]),pe=(0,q.jsxs)(`aside`,{ref:w,"aria-hidden":!s,onFocusCapture:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||l()},className:R(`flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-background`,!g&&[`transition-[transform,opacity,background-color]`,Js,s?`opacity-100`:`pointer-events-none translate-x-[8%] opacity-0`]),children:[(0,q.jsxs)(`div`,{className:`bg-background`,children:[(0,q.jsxs)(`div`,{className:`flex h-12 min-w-0 items-center justify-between gap-2 px-4`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1`,role:`tablist`,"aria-label":`Secondary panel views`,children:[(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 w-7 shrink-0 rounded-md p-0`,onClick:()=>u(`thread-info`),"aria-label":`Show thread info panel`,"aria-pressed":E===`thread-info`&&!_,title:`Info`,children:(0,q.jsx)(L,{name:`Info`})}),c===!1?null:(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 w-7 shrink-0 rounded-md p-0`,onClick:()=>u(`git-diff`),"aria-label":`Show diff panel`,"aria-pressed":D&&!_,title:`Diff`,children:(0,q.jsx)(L,{name:`FileDiff`})}),a&&a.length>0?(0,q.jsx)(`div`,{className:`flex min-w-0 items-center gap-1 overflow-x-auto`,children:a.map(e=>(0,q.jsx)(Zs,{tab:e},e.id))}):null]}),(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0 rounded-md p-0`,onClick:f,"aria-label":g?`Close secondary panel`:`Hide secondary panel`,title:g?`Close secondary panel`:`Hide secondary panel`,children:(0,q.jsx)(L,{name:v})})]}),D&&!_?(0,q.jsx)(ms,{selectionValue:M,selectionOptions:A,onSelectionChange:te,isSelectorDisabled:F||ae===void 0,stats:N,isParsing:I,areAllFilesCollapsed:ue,isCollapseAllDisabled:!P||F,onToggleAllCollapsed:oe,displayMode:y,onDisplayModeChange:b}):null]}),(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:_?(0,q.jsx)(`div`,{className:R(Ys,`pb-3`),children:o??(0,q.jsx)(`p`,{className:`mx-4 rounded-lg border border-dashed border-border bg-surface-raised px-3 py-6 text-center text-sm text-muted-foreground`,children:`No file preview content provided.`})}):D?(0,q.jsx)(Vs,{collapsedGitDiffFileKeys:ce,currentGitDiff:O,gitDiffError:k instanceof Error?k:k?Error(`Failed to load git diff`):null,gitDiffViewOptions:fe,isParsingGitDiffFiles:I,isPreparingGitDiff:ee,loadingGitDiffFileKeys:le,onOpenFileInEditor:m,onOpenFilePreview:h,onRequestFileContents:ne,parsedGitDiffFileEntries:re,queuedGitDiffFileRenderKeys:ie,setGitDiffFileRef:z,threadGitDiff:ae,toggleGitDiffFileCollapsed:se,workspaceRootPath:p}):(0,q.jsx)(Hs,{metadataContent:i})})]});return g?pe:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Qs,{isOpen:s,onDragging:x}),(0,q.jsx)(Bo.Panel,{ref:T,id:`thread-detail-secondary-panel`,collapsible:!0,collapsedSize:0,defaultSize:s?C:0,minSize:Ks,maxSize:qs,onCollapse:d,onResize:S,order:2,className:R(`min-w-0 overflow-hidden transition-[flex-grow,flex-basis,opacity]`,Js,s?`opacity-100`:`opacity-0`),children:pe})]})}function Zs({tab:e}){let t=e.statusLabel===null?e.filename:`${e.filename} (${e.statusLabel})`;return(0,q.jsx)(Ho,{label:e.filename,secondaryLabel:e.statusLabel===null?null:`(${e.statusLabel})`,title:t,isActive:e.isActive,onSelect:e.onSelect,labelMaxWidthClass:`max-w-[160px]`,closeAction:e.isPinned?null:{onClose:e.onClose,closeLabel:`Close ${e.filename}`,closeTooltip:`Close tab`}})}function Qs({isOpen:e,onDragging:t}){let n=dt(sa);return(0,q.jsx)(Bo.PanelResizeHandle,{id:`thread-detail-secondary-panel-handle`,disabled:!e,onDragging:t,className:R(`group relative shrink-0 cursor-col-resize overflow-visible bg-transparent transition-[width,opacity,background-color] before:absolute before:inset-y-0 before:-left-1.5 before:-right-1.5 before:content-['']`,Js,e?`w-px opacity-100`:`pointer-events-none w-0 opacity-0`,n&&`bg-accent/20`),"aria-label":`Resize thread and secondary panels`,children:(0,q.jsx)(`span`,{className:R(`pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border transition-colors`,n?`bg-accent-foreground/50`:`group-hover:bg-accent-foreground/35`)})})}var $s=`file-tree-container`,ec=`data-file-tree-style`,tc=`data-file-tree-unsafe-css`,nc=`data-file-tree-scrollbar-measure`,rc=`data-file-tree-scrollbar-gutter-measured`,ic=`--trees-scrollbar-gutter-measured`,ac=`header`,oc=`context-menu`,sc=`context-menu-trigger`,cc=typeof window>`u`?K.useEffect:K.useLayoutEffect;function lc(e,t,n){let r=e==null?null:(0,q.jsx)(`div`,{slot:ac,children:e}),i=t!=null&&n!=null?(0,q.jsx)(`div`,{slot:oc,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,q.jsxs)(q.Fragment,{children:[r,i]})}function uc(e,t){return typeof window>`u`&&t!=null?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,q.jsx)(q.Fragment,{children:e})}function dc(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement?!0:e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function fc(e,t,n,r,i){let a={...e??{}};if(t!=null&&delete a.header,n){let t=e?.contextMenu,n=t?.onClose,o=t?.onOpen;a.contextMenu={...t??{},enabled:!0,onClose:()=>{n?.(),r()},onOpen:(e,t)=>{i(e,t),o?.(e,t)}},delete a.contextMenu.render}return a.header!=null||a.contextMenu!=null?a:void 0}function pc({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(null),u=(0,K.useRef)(n.getComposition()),d=(0,K.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,K.useCallback)(()=>{s(null)},[]),m=(0,K.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,K.useMemo)(()=>fc(h,e,f,p,m),[h,p,m,f,e]),_=(0,K.useCallback)(e=>{l(e)},[]);(0,K.useEffect)(()=>{f||s(null)},[f]),cc(()=>{n.setComposition(g)},[g,n]),cc(()=>{if(c!=null)return r!=null&&dc(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=uc(lc(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,q.jsx)($s,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}var mc=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
4
4
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
5
5
  <path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06" fill="currentcolor"/>
6
6
  </symbol>
@@ -1812,7 +1812,7 @@ import{Br as e,Bt as t,Gn as n,Gr as r,Gt as i,Hi as a,Hr as o,Ht as s,I as c,In
1812
1812
  }`}function Nl(e){return`${jl}
1813
1813
  @layer unsafe {
1814
1814
  ${e}
1815
- }`}var Pl=new WeakMap;function Fl(e){let t=Pl.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(nc,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),Pl.set(e,i),i}function Il(e,t){if(!e.isConnected)return;let n=Fl(t);if(n==null)return;let r=t.querySelector(`style[${rc}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(rc,``),t.appendChild(i)),i.textContent=`:host { ${ic}: ${n}px; }`}var Ll;function Rl(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){Ll??(Ll=new CSSStyleSheet,Ll.replaceSync(Ml(Al)));let t=!1;try{e.adoptedStyleSheets=[Ll],t=!0}catch{}if(t){e.querySelector(`style[${ec}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(ec,``),t.textContent=Ml(Al),e.prepend(t)}}function zl(e,t){Bl(e,t),Rl(t),Il(e,t)}function Bl(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});zl(this,e)}}if(customElements.define($s,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll($s)))e instanceof HTMLElement&&zl(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Vl=5,Hl=1<<Vl,Ul=Hl*4;function Wl(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Gl(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Kl(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function ql(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function Jl(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function Yl(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function Xl(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,eu(e,t)}function Zl(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=ql(e).get(t);if(i===void 0)return;let a=i>>Vl;e.childVisibleChunkSums[a]+=r}function Ql(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=tu(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=Hl}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function $l(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>Vl;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<Vl}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function eu(e,t){if(t.childIds.length<Ul){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/Hl),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>Vl]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function tu(e,t,n,r){let i=Math.min(t.childIds.length,n+Hl),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var nu=7,ru=3,iu=1<<ru,au=4;function ou(e,t,n=0){return e<<au|n<<ru|t}function su(e){return e.depthAndFlags>>>au}function cu(e){return(e.depthAndFlags&iu)>>ru}function J(e){return(e.depthAndFlags&iu)!==0}function lu(e){return e.depthAndFlags&nu}function uu(e,t){return(lu(e)&t)!==0}function du(e,t){e.depthAndFlags|=t}function fu(e,t){e.depthAndFlags=ou(t,lu(e),cu(e))}var pu=Symbol(`benchmarkInstrumentation`);function mu(e,t){return t==null||Object.defineProperty(e,pu,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function hu(e){return e==null?null:e[pu]??null}function Y(e,t,n){return e==null?n():e.measurePhase(t,n)}function gu(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function _u(e){return e>=48&&e<=57}function vu(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!_u(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&_u(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function yu(e){let t=e.toLowerCase();return{lowerValue:t,tokens:vu(t)}}function bu(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function xu(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=bu(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Su(e,t,n){let r=xu(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function Cu(e,t){return Su(e,t,yu)}function wu(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function Tu(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=wu(e,r);return a===wu(t,r)?Cu(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function Eu(e,t){return Tu(e,t)}function Du(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=yu(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=wu(e,n);return o===wu(t,n)?Su(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function Ou(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=yu(r);return e.sortKeyById[t]=i,i}function ku(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function Au(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function ju(e){let{hasTrailingSlash:t,segments:n}=Au(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function Mu(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=Au(e);return{requiresDirectory:t,segments:n}}var Nu=``;function Pu(){let e=new Map;return e.set(Nu,0),{idByValue:e,valueById:[Nu],sortKeyById:[yu(Nu)]}}function Fu(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function Iu(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var Lu=Symbol(`pathStorePreparedInputKind`);function Ru(e,t){return e[Lu]=t,e}function zu(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function Bu(e,t,n){return n===`default`?Eu(e,t):n(zu(e),zu(t))}function Vu(){return{depthAndFlags:ou(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function Hu(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function Uu(e){return e.isDirectory?e.segments.length:e.segments.length-1}function Wu(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function Gu(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function Ku(e,t={}){return Qu(e,t).map(e=>e.path)}function qu(e,t={}){let n=Qu(e,t);return Ru({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function Ju(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return Ru({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function Yu(e){let t=e,n=t.preparedPaths;if(t[Lu]===`prepared`&&n!=null)return n;if(!Wu(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function Xu(e){let t=e;return t[Lu]===`presorted`&&t.presortedPaths!=null||Gu(t.presortedPaths)?t.presortedPaths:null}function Zu(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function Qu(e,t={}){let n=ku(t),r=hu(t);gu(r,`workload.inputFiles`,e.length);let i=Y(r,`store.preparePathEntries.parse`,()=>e.map(e=>ju(e)));return Y(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>Bu(e,t,n.sort))),i}var $u=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[Vu()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=Pu();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=hu(e),this.options=ku(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,Wl())}appendPaths(e){return Y(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>ju(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,Y(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return Y(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:ou(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:ou(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:ou(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=ju(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:ou(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:ou(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=ju(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(Y(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||Y(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort===`default`?Du(this.lastPreparedPath,e,this.segmentSortKeyCache):Bu(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=Uu(e),i=n==null?0:Uu(n),a=n==null?0:Hu(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=Fu(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:ou(su(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),Jl(i,s),s}createFileChildUnchecked(e,t){let n=Fu(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:ou(su(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Jl(r,a),a}getOrCreateDirectoryChild(e,t){let n=Fu(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!J(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:ou(su(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Jl(r,a),this.directories.set(a,Wl()),a}createDirectoryChild(e,t){let n=Fu(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:ou(su(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Jl(r,a),this.directories.set(a,Wl()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!J(n))throw Error(`Path is not a directory: "${t}"`);if(uu(n,1))throw Error(`Duplicate path: "${t}"`);du(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,Gl());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(J(a)){let t=Gl();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;J(n)&&this.directories.set(t,Wl());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),Jl(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!J(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return Xl(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function ed(e,t=`closed`,n=null){let r=nd(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function td(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function nd(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function rd(e,t){return uu(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:su(t)<=e.defaultExpansion}function id(e,t,n=e.snapshot.nodes[t]){return n==null||!J(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:rd(e,n)}function ad(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!J(r))return;let i=rd(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function od(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function sd(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function cd(e,t){let n=od(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function ld(e,t){let n=od(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function ud(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function dd(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function fd(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function pd(e,t){e.directoryLoadInfoById.delete(t)}function md(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function hd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function gd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function _d(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function vd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function yd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function bd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function xd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function Sd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Cd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function wd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function Td(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function Ed(e,t,n){return{...n,visibleCountDelta:Ld(e)-t}}function Dd(e,t){let n=Ld(e),r=td();e.transactionStack.push(r);try{t()}catch(t){throw Ad(e,r,!1),t}Ad(e,r,!0,Ld(e)-n)}function Od(e,t){let n=e.instrumentation;if(n==null){kd(e,t);return}Y(n,`store.events.record`,()=>kd(e,t))}function kd(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){Fd(e,t);return}n.events.push(t),Pd(n,t)}function Ad(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?Nd(i,t):Y(n,`store.events.batch.merge`,()=>Nd(i,t));return}let a=jd(t,r),o=e.instrumentation;if(o==null){Fd(e,a);return}Y(o,`store.events.batch.commit`,()=>Fd(e,a))}function jd(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function Md(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function Nd(e,t){for(let n of t.events)e.events.push(n);Md(e,t)}function Pd(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function Fd(e,t){let n=e.instrumentation;if(n==null){Id(e,t);return}Y(n,`store.events.emit`,()=>Id(e,t))}function Id(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function Ld(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function Rd(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!J(n)||uu(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!J(a)?null:i}function zd(e,t){let n=t;for(;;){let t=Rd(e,n);if(t==null)return n;n=t}}function Bd(e,t){let n=[t],r=t;for(;;){let t=Rd(e,r);if(t==null)return n;n.push(t),r=t}}function Vd(e,t){let n=t==null?e.snapshot.rootId:Zd(e,t);return n==null?[]:ef(e,n)}function Hd(e,t){let n=ju(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=gf(e,hf(e,r)),{createdNodeIds:a,directoryId:o}=tf(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=X(e,o);if(uu(n,1))throw Error(`Path already exists: "${t}"`);du(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=rf(e,o,n.basename),s.add(c);Jd(e,o);let l=gf(e,o);return hd({affectedAncestorIds:Xd(e,c),affectedNodeIds:[...s],path:t,projectionChanged:_f(i,l)})}function Ud(e,t,n){let r=Zd(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=X(e,r);if(uu(i,2))throw Error(`The root node cannot be removed`);if(J(i)&&$d(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=gf(e,a),s=pf(e,r);sf(e,a,r,i.nameId),mf(e,a),Jd(e,a);let c=gf(e,a);return gd({affectedAncestorIds:Xd(e,a),affectedNodeIds:s,path:t,projectionChanged:_f(o,c),recursive:n.recursive===!0})}function Wd(e,t,n,r){let i=Zd(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=X(e,i);if(uu(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=df(e,i,n),c=gf(e,a.parentId),l=gf(e,s.parentId),u=Iu(e.snapshot.segmentTable,a.nameId),d=Fu(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(J(a)&&xf(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=Kl(e.snapshot.nodes,$d(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&ff(e,p,o,cu(a))===`skip`)return null;let m=a.parentId;sf(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),bf(e,i),of(e,s.parentId,i),mf(e,m),e.pathCacheVersion++,Jd(e,m),s.parentId!==m&&Jd(e,s.parentId);let h=gf(e,m),g=gf(e,s.parentId);return _d({affectedAncestorIds:[...new Set([...Xd(e,m),...Xd(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:vf([c,l],[h,g]),to:qd(e,i)})}function Gd(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function Kd(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function qd(e,t){let n=X(e,t),r=Gd(e,t);if(r!=null)return r;if(uu(n,2))return Kd(e,t,``);let i=qd(e,n.parentId),a=Iu(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return Kd(e,t,J(n)?`${o}/`:o)}function Jd(e,t){let n=e.instrumentation;if(n==null){Cf(e,t);return}Y(n,`store.recomputeCountsUpwardFrom`,()=>Cf(e,t))}function Yd(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!J(o)){Sf(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Sf(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function Xd(e,t){let n=[],r=t;for(;r!=null;){let t=X(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function Zd(e,t){if(t.length===0)return e.snapshot.rootId;let n=Mu(t);return Qd(e,n.segments,n.requiresDirectory)}function Qd(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=$d(e,r),a=Kl(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=X(e,r);return n&&!J(i)?null:r}function $d(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function X(e,t){let n=e.snapshot.nodes[t];if(n===void 0||uu(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function ef(e,t){let n=e.snapshot.nodes[t];if(n===void 0||uu(n,4))return[];if(!J(n))return[qd(e,t)];if($d(e,t).childIds.length===0)return uu(n,1)&&!uu(n,2)?[qd(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||uu(n,4)){i.pop();continue}if(!J(n)){r.push(qd(e,t.nodeId)),i.pop();continue}let a=$d(e,t.nodeId);if(a.childIds.length===0){uu(n,1)&&!uu(n,2)&&r.push(qd(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function tf(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=Fu(e.snapshot.segmentTable,i),a=$d(e,r),o=Kl(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!J(X(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=nf(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function nf(e,t,n){let r=X(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:ou(su(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,Wl()),of(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function rf(e,t,n){let r=Fu(e.snapshot.segmentTable,n),i=$d(e,t);if(Kl(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${Tf(e,t,n)}"`);let a=X(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:ou(su(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),of(e,t,o),e.activeNodeCount++,o}function af(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}cf(e,n,o)<0?i=a:r=a+1}return r}function of(e,t,n){let r=$d(e,t),i=X(e,n);Kl(e.snapshot.nodes,r).set(i.nameId,n),Zl(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=af(e,r,n);r.childIds.splice(a,0,n),Yl(r,a),eu(e.snapshot.nodes,r)}function sf(e,t,n,r){let i=$d(e,t),a=ql(i),o=a.get(n)??-1;Kl(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&Zl(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),Yl(i,o),eu(e.snapshot.nodes,i))}function cf(e,t,n){let r=e.snapshot.options.sort;return r===`default`?lf(e,t,n):r(uf(e,t),uf(e,n))}function lf(e,t,n){let r=X(e,t),i=X(e,n),a=J(r);if(a!==J(i))return a?-1:1;let o=xu(Ou(e.snapshot.segmentTable,r.nameId),Ou(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=Iu(e.snapshot.segmentTable,r.nameId),c=Iu(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function uf(e,t){let n=X(e,t),r=qd(e,t),i=J(n),a=i?r.slice(0,-1):r;return{basename:Iu(e.snapshot.segmentTable,n.nameId),depth:su(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function df(e,t,n){let r=X(e,t),i=Zd(e,n);if(i!=null){let t=X(e,i);if(J(t))return{basename:Iu(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=Mu(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=Mu(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:Qd(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function ff(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${qd(e,t)}"`);let i=X(e,t);if(cu(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(J(i)&&$d(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return pf(e,t),sf(e,a,t,o),mf(e,a),Jd(e,a),`handled`}function pf(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=X(e,t.nodeId);if(t.visitedChildren||!J(i)){J(i)&&e.snapshot.directories.delete(t.nodeId),du(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),pd(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=$d(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function mf(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!J(t)||uu(t,2)||$d(e,n).childIds.length>0)return;du(t,1),n=t.parentId===n?null:t.parentId}}function hf(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=Kl(e.snapshot.nodes,$d(e,n)).get(t);if(i==null||!J(X(e,i)))break;n=i}return n}function gf(e,t){let n=yf(e,t);if(n==null)return null;let r=zd(e,n),i=X(e,r),a=n===r?null:Bd(e,n).map(t=>qd(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:$d(e,r).childIds.length>0,path:qd(e,r),terminalKind:cu(i)})}function _f(e,t){return vf([e],[t])}function vf(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function yf(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!J(t)||uu(t,2))return null;if(!id(e,n,t))return n;n=t.parentId}return null}function bf(e,t){let n=X(e,t);if(fu(n,(t===e.snapshot.rootId?-1:su(X(e,n.parentId)))+1),!J(n))return;let r=$d(e,t);for(let t of r.childIds)bf(e,t)}function xf(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=X(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Sf(e,t,n=X(e,t),r=!1){let i=e.instrumentation;if(i==null){wf(e,t,n,r);return}Y(i,`store.recomputeNodeCounts`,()=>wf(e,t,n,r))}function Cf(e,t){let n=t;for(;n!=null;){let t=X(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Sf(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&Zl($d(e,s),n,a,o),n=s}}function wf(e,t,n,r){if(!J(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=$d(e,t);if(r){let t=e.instrumentation;t==null?Xl(e.snapshot.nodes,i):Y(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>Xl(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,uu(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=Rd(e,t)==null?id(e,t,n)?1+o:1:o}function Tf(e,t,n){let r=qd(e,t);return r.length===0?n:`${r}${n}`}function Ef(e){return e!=null&&!uu(e,4)}function Df(e,t){let n=e.snapshot.nodes[t];return!Ef(n)||!J(n)||uu(n,2)?null:n}function Of(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Ef(e.snapshot.nodes[n])&&(t+=1);return t}function kf(e){return Math.max(0,e.valueById.length-1)}function Af(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:Of(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:kf(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function jf(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function Mf(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)Df(e,n)!=null&&t.push(qd(e,n));for(let t of e.expandedDirectoryIds)Df(e,t)!=null&&n.push(qd(e,t));return{collapsedPaths:t,expandedPaths:n}}function Nf(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)Df(e,n)==null||sd(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:qd(e,n)});return t}function Pf(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=Zd(e,n);t!=null&&ad(e,t,!0,X(e,t))}for(let n of t.collapsedPaths){let t=Zd(e,n);t!=null&&ad(e,t,!1,X(e,t))}}function Ff(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=Zd(e,n.path);t!=null&&Df(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function If(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function Lf(e){let t=e.snapshot.segmentTable,n=Pu();for(let r of e.snapshot.nodes)if(Ef(r)){if(uu(r,2)){r.nameId=0;continue}r.nameId=Fu(n,Iu(t,r.nameId))}e.snapshot.segmentTable=n}function Rf(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Ef(r)||!J(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Ef(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[X(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),Xl(e.snapshot.nodes,n)}}function zf(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(Ef(n))break;--t}e.snapshot.nodes.length=t+1}function Bf(e){let t=Mf(e),n=Nf(e);Y(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>If(e)),Y(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>Lf(e)),Y(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>Rf(e)),Y(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>zf(e)),Y(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>Pf(e,t)),Y(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>Ff(e,n)),Y(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>Yd(e,e.snapshot.rootId))}function Vf(e){let t=Mf(e),n=Nf(e),r=Y(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>Vd(e)),i=mu({...e.snapshot.options},e.instrumentation),a=Y(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new $u(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,Y(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>Pf(e,t)),Y(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>Ff(e,n)),Y(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>Yd(e,e.snapshot.rootId))}function Hf(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function Uf(e,t){let n=Af(e);t===`stable`?Y(e.instrumentation,`store.cleanup.stable`,()=>Bf(e)):Y(e.instrumentation,`store.cleanup.aggressive`,()=>Vf(e));let r=Af(e);return jf(t,t===`stable`,n,r)}var Wf=64;function Gf(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function Kf(e){return X(e,e.snapshot.rootId).visibleSubtreeCount}function qf(e,t,n,r){let i=X(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function Jf(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:pp(e,t.cursor),setSize:t.setSize,subtreeEndIndex:qf(e,t.cursor,t.index,n)}}function Yf(e,t,n,r,i,a){let o=$d(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=Ql(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return Xf(e,u,l,r+c,i+1,s,o.childIds.length,a)}function Xf(e,t,n,r,i,a,o,s){if(!J(X(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=sp(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=X(e,c.terminalNodeId);if(!J(l)||!id(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Yf(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function Zf(e,t){let n=Kf(e);if(t<0||t>=n)return null;let r=Yf(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>qd(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=Jf(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:pp(e,r.cursor),setSize:r.setSize,subtreeEndIndex:qf(e,r.cursor,r.index,n)}}function Qf(e,t,n){let r=e.instrumentation,i=Kf(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return fp(e,o+1);let t=[],n=ip(e,a);for(let r=a;r<=o&&n!=null;r++){let r=pp(e,n);t.push(r),n=lp(e,n)}return t}let s=[],c=0,l=0,u=Y(r,`store.getVisibleSlice.selectFirstRow`,()=>ip(e,a));for(let t=a;t<=o&&u!=null;t++){let t=Y(r,`store.getVisibleSlice.materializeRow`,()=>pp(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=Y(r,`store.getVisibleSlice.advanceCursor`,()=>lp(e,u))}return gu(r,`workload.visibleRowsRead`,s.length),gu(r,`workload.flattenedRowsRead`,c),gu(r,`workload.flattenedSegmentsRead`,l),s}function $f(e,t=Kf(e)){let n=e.instrumentation;return n==null?dp(e,t):Y(n,`store.getVisibleTreeProjection`,()=>dp(e,t))}function ep(e){return up($f(e))}function tp(e,t){let n=Zd(e,t);if(n==null||n===e.snapshot.rootId||J(X(e,n))&&zd(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=X(e,i).parentId,n=$d(e,t),s=ql(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=$l(a,n,s),t!==o){let n=X(e,t),a=Rd(e,t);if(!id(e,t,n)&&a!==i)return null;zd(e,t)===t&&(r+=1)}i=t}return r}function np(e,t){let n=Zd(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!J(r))throw Error(`Path is not a directory: "${t}"`);return id(e,n,r)?null:(ad(e,n,!0,r),Jd(e,n),vd({affectedAncestorIds:Xd(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function rp(e,t){let n=Zd(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!J(r))throw Error(`Path is not a directory: "${t}"`);return id(e,n,r)?(ad(e,n,!1,r),Jd(e,n),yd({affectedAncestorIds:Xd(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function ip(e,t){return t<0||t>=Kf(e)?null:ap(e,e.snapshot.rootId,t,-1)}function ap(e,t,n,r){let i=$d(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?Ql(e.snapshot.nodes,i,n):Y(a,`store.getVisibleSlice.selectChildIndex`,()=>Ql(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return op(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function op(e,t,n,r){if(!J(X(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=sp(e,t,r);if(n===0)return i;let a=X(e,i.terminalNodeId);if(!J(a)||!id(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return ap(e,i.terminalNodeId,n-1,i.visibleDepth)}function sp(e,t,n){return J(X(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:zd(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:Y(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>zd(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function cp(e,t){let n=X(e,t);if(!J(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:Rd(e,r)!==t}function lp(e,t){let n=X(e,t.terminalNodeId);if(J(n)){let r=$d(e,t.terminalNodeId);if(id(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:op(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=X(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=$d(e,n),o=ql(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return op(e,s,0,i);cp(e,r)&&i--,r=n}}function up(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function dp(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(Wf);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=Gf(o,y);let x,S=_;if(J(v))S=f?zd(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:qd(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&J(C)&&id(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function fp(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!J(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:qd(e,f)};continue}let h=l?zd(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=pp(e,g);let _=i[h];_!=null&&J(_)&&id(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function pp(e,t){let n=X(e,t.terminalNodeId),r=J(n)?mp(e,t):null,i=qd(e,t.terminalNodeId),a=Iu(e.snapshot.segmentTable,n.nameId),o=J(n)&&$d(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?Bd(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:Iu(e.snapshot.segmentTable,r.nameId),nodeId:n,path:qd(e,n)}}):Y(c,`store.getVisibleSlice.flatten.collectSegments`,()=>Bd(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:Iu(e.snapshot.segmentTable,r.nameId),nodeId:n,path:qd(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:J(n)&&id(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:J(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function mp(e,t){if(t.headNodeId===t.terminalNodeId)return sd(e,t.terminalNodeId);let n=Bd(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=sd(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function hp(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!J(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&eu(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&J(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,eu(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function gp(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var _p=class e{#e;constructor(e={}){let t=hu(e),n=Y(t,`store.builder.create`,()=>new $u(e));if(e.preparedInput!=null){let t=Xu(e.preparedInput);t==null?n.appendPreparedPaths(Yu(e.preparedInput),!1):n.appendPresortedPaths(t,Zu(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(Y(t,`store.preparePathEntries`,()=>Qu(r,e)))}let r=Y(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=Y(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=Y(t,`store.state.create`,()=>ed(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:Y(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||gp(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&Y(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?Y(t,`store.state.initializeOpenVisibleCounts`,()=>hp(this.#e)):Y(t,`store.state.recomputeCounts`,()=>Yd(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return Ku(e,t)}static prepareInput(e,t={}){return qu(e,t)}static preparePresortedInput(e){return Ju(e)}list(e){return Y(this.#e.instrumentation,`store.list`,()=>Vd(this.#e,e))}add(e){Y(this.#e.instrumentation,`store.add`,()=>{let t=Kf(this.#e);Od(this.#e,Ed(this.#e,t,Hd(this.#e,e)))})}remove(e,t={}){Y(this.#e.instrumentation,`store.remove`,()=>{let n=Kf(this.#e);Od(this.#e,Ed(this.#e,n,Ud(this.#e,e,t)))})}move(e,t,n={}){Y(this.#e.instrumentation,`store.move`,()=>{let r=Kf(this.#e),i=Wd(this.#e,e,t,n);i!=null&&Od(this.#e,Ed(this.#e,r,i))})}batch(e){Dd(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return Y(this.#e.instrumentation,`store.getVisibleCount`,()=>Kf(this.#e))}getVisibleSlice(e,t){return Y(this.#e.instrumentation,`store.getVisibleSlice`,()=>Qf(this.#e,e,t))}getVisibleRowContext(e){return Y(this.#e.instrumentation,`store.getVisibleRowContext`,()=>Zf(this.#e,e))}getVisibleTreeProjection(){return ep(this.#e)}getVisibleTreeProjectionData(e){return $f(this.#e,e)}getVisibleIndex(e){return Y(this.#e.instrumentation,`store.getVisibleIndex`,()=>tp(this.#e,e))}getPathInfo(e){return Y(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=Zd(this.#e,e);if(t==null)return null;let n=X(this.#e,t);return{depth:su(n),kind:J(n)?`directory`:`file`,path:qd(this.#e,t)}})}isExpanded(e){return Y(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=X(this.#e,t);return id(this.#e,t,n)})}expand(e){Y(this.#e.instrumentation,`store.expand`,()=>{let t=Kf(this.#e),n=np(this.#e,e);n!=null&&Od(this.#e,Ed(this.#e,t,n))})}collapse(e){Y(this.#e.instrumentation,`store.collapse`,()=>{let t=Kf(this.#e),n=rp(this.#e,e);n!=null&&Od(this.#e,Ed(this.#e,t,n))})}on(e,t){return md(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return sd(this.#e,t)}markDirectoryUnloaded(e){Y(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if($d(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=Kf(this.#e);ld(this.#e,t),Od(this.#e,Ed(this.#e,n,bd({affectedAncestorIds:Xd(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return Y(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=Kf(this.#e),r=cd(this.#e,t);return Od(this.#e,Ed(this.#e,n,xd({affectedAncestorIds:Xd(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return Y(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||sd(this.#e,n)!==`loading`||!dd(this.#e,n,e.attemptId))return!1;let r=qd(this.#e,n);this.validateChildPatch(r,t);let i=Kf(this.#e),a=[];for(let e of t.operations){vp(r,e);let t=Kf(this.#e);switch(e.type){case`add`:a.push(Ed(this.#e,t,Hd(this.#e,e.path)));break;case`remove`:a.push(Ed(this.#e,t,Ud(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=Wd(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(Ed(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return Od(this.#e,Ed(this.#e,i,Sd({affectedAncestorIds:Xd(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:qd(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return Y(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=Kf(this.#e),r=ud(this.#e,t,e.attemptId);return Od(this.#e,Ed(this.#e,n,Cd({affectedAncestorIds:Xd(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:qd(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return Y(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=Kf(this.#e),i=fd(this.#e,n,e.attemptId,t);return Od(this.#e,Ed(this.#e,r,wd({affectedAncestorIds:Xd(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:qd(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return Y(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(Hf(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=Kf(this.#e),n=Uf(this.#e,e.mode??`stable`);return Od(this.#e,Ed(this.#e,t,Td({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=$d(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??yu(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=xu(Ou(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!J(X(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=X(this.#e,n);id(this.#e,n,i)||(ad(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=X(this.#e,e);if(!id(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=Zd(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!J(X(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!J(X(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=X(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=X(this.#e,e),r=Rd(this.#e,e);if(!id(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function vp(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var yp=e=>e.startsWith(`f::`)?e.slice(3):e;function bp(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function xp(e,t){return e===``?t:`${e}/${t}`}function Sp({files:e,path:t,isFolder:n,nextBasename:r}){let i=yp(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=bp(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=xp(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function Cp(e){return e.endsWith(`/`)}function wp(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function Tp(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function Ep(e,t){return t.includes(e)?Tp(t):[e]}function Dp(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function Op(e,t){return{draggedPaths:e,target:t}}function kp(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(Cp(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function Ap(e,t){return t.kind===`root`||t.directoryPath==null?wp(e):t.directoryPath}function jp(e,t){let n=e.map(e=>{let n=Ap(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}var Mp=Symbol(`FILE_TREE_RENAME_VIEW`);function Np(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}var Pp=512,Fp=512;function Ip(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function Lp(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function Rp(e){return Lp(e).at(-1)??null}function zp(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}var Bp=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},Vp=e=>e.toLowerCase();function Hp(e){return e.endsWith(`/`)}function Up(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function Wp(e){return e.endsWith(`/`)?e.slice(0,-1):e}function Gp(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}function Kp(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function qp(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function Jp(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return qp(e,t.path)?n?e:null:e;case`move`:return Kp(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=Jp(r,e,n),r==null)return null;return r}}}function Yp(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function Xp(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Zp(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!Xp(_p.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function Qp(e){switch(e.operation){case`add`:return{...Yp(e),operation:`add`,path:e.path};case`remove`:return{...Yp(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...Yp(e),from:e.from,operation:`move`,to:e.to}}}function $p(e){return{...Yp(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>Qp(e)),operation:`batch`}}function em(e){switch(e.operation){case`add`:case`remove`:case`move`:return Qp(e);case`batch`:return $p(e);default:return null}}function tm(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=Lp(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function nm(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:tm(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var rm=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=new Set;#z=0;#B;#V=0;#H=!1;#U=0;#W;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=Zp({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#B=this.#se(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ae(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#R=new Set(d),this.#L=f,this.#z=1),this.#Oe(f,!1),r!=null&&this.#Se(r,!1),this.#W=this.#Fe()}destroy(){this.#W?.(),this.#W=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#pe()}focusFirstItem(){this.#ve().length>0&&this.#Me(0)}focusLastItem(){this.#U<=0||(this.#Ne(),this.#Me(this.#U-1))}focusNextItem(){this.#De(1)}focusParentItem(){if(this.#c==null)return;let e=Rp(this.#c);if(e==null)return;let t=this.#Y(e);t>=0&&this.#Me(t)}focusPath(e){let t=this.#B.getPathInfo(e)?.path??null;if(t==null)return;this.#Ne();let n=this.#Y(t);n>=0&&this.#Me(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Y(t);return n>=0?(this.#Me(n),this.#ve()[n]??t):null}focusPreviousItem(){this.#De(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#X(this.#c)}getFocusedPath(){return this.#c}resolveNearestVisiblePath(e){let t=this.#ve();if(this.#U===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#B.getPathInfo(e)?.path??e,r=this.#Y(n);return r>=0?t[r]??n:this.#J(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#R]}getSelectionVersion(){return this.#z}getVisibleCount(){return this.#U}getVisibleRows(e,t){if(t<e||this.#U===0)return[];let n=Math.max(0,e),r=Math.min(this.#U-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=Fp){let e=[];for(let t=n;t<=r;t+=1){let n=this.#B.getVisibleRowContext(t);if(n==null)break;e.push(this.#Q(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ne(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#ye(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#B.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#ye(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#Z(o,i,a,{ancestorPaths:this.#te(a),path:s})})}return this.#B.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#Z(e,r,r,{ancestorPaths:this.#te(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#U===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#U;r+=1){let i=e+r*t,a=Math.min(this.#U-1,Math.floor(i/t)),o=this.#$(a,r)??(a>0?this.#$(a-1,r):void 0);if(o==null)break;n.push({row:this.#Q(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#B.getPathInfo(e);return t==null?null:this.#X(t.path,t)}selectAllVisiblePaths(){this.#Ne();let e=[...this.#ve()];this.#re(e,this.#c??this.#L)}selectOnlyPath(e){let t=this.#Ae(e);t!=null&&this.#re([t],t)}selectPath(e){let t=this.#Ae(e);t==null||this.#R.has(t)||this.#re([...this.#R,t])}deselectPath(e){let t=this.#Ae(e);t==null||!this.#R.has(t)||this.#re([...this.#R].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ae(e);if(t!=null){if(this.#R.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ae(e);if(t!=null){if(this.#R.has(t)){this.#re([...this.#R].filter(e=>e!==t),t);return}this.#re([...this.#R,t],t)}}selectPathRange(e,t){let n=this.#Ae(e);if(n==null)return;this.#Ne();let r=this.#L,i=r==null?-1:this.#be(r),a=this.#be(n);if(i===-1||a===-1){let e=t?[...this.#R,n]:[n];this.#re(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#ve().slice(o,s+1),l=t?[...this.#R,...c]:c;this.#re(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#U-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ne();let r=this.#ve(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#R);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#re([...o],this.#L??i,!1),this.#Me(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ae(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=Ep(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#re([t],t,!1),this.#je(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#we(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=Op(t.draggedPaths,n);(kp(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}Dp(t.target,n)||(this.#i={...t,target:n},this.#we())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#we())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#we(),!1;let n=Op(e.draggedPaths,t);if(kp(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#we(),!1;let r=jp(e.draggedPaths,t);if(r==null)return this.#we(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#B.move(e.from,e.to,{collision:e.collision})}else this.#oe(r.operations),this.#B.batch(r.operations)}catch(e){return this.#we(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#B.add(e)}remove(e,t={}){this.#B.remove(e,t)}move(e,t,n={}){this.#B.move(e,t,n)}batch(e){this.#B.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Se(e,!0)}openSearch(e=``){this.#Se(e,!0)}closeSearch(){this.#Se(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#xe(1)}focusPreviousSearchMatch(){this.#xe(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#B.getPathInfo(e);if(n==null)return!1;let r=n.path,i=Hp(r),a=Wp(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of Lp(r))this.#B.isExpanded(e)||this.#B.expand(e);return this.#re([r],r,!1),this.#M!=null&&(this.#Se(null,!1),this.#y?.(this.#M)),this.#je(r),this.#T=r,this.#E=Up(r),this.#D=t.removeIfCanceled??!1,this.#we(),!0}[Mp](){return{cancel:()=>{this.#G()},commit:()=>{this.#K()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#q(e)}}}#G(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,Hp(e)?{recursive:!0}:void 0);return}this.#je(e),this.#we()}#K(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,Hp(e)?{recursive:!0}:void 0);return}let t=Hp(e),n=Sp({files:this.#B.list(),isFolder:t,nextBasename:this.#E,path:Wp(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#je(e),this.#v?.(n.error),this.#we();return}if(n.sourcePath===n.destinationPath){this.#je(e),this.#we();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(Gp(n.sourcePath,t),Gp(n.destinationPath,t))}#q(e){this.#T==null||this.#E===e||(this.#E=e,this.#we())}resetPaths(e,t={}){let n=this.#B.list().length,r=this.#U,i=Zp({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#se(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#L;this.#W?.(),this.#B=a,this.#d.clear(),this.#pe();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!Ip(this.#R,u);this.#R=new Set(u),d&&(this.#z+=1),this.#L=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#Oe(o,o!=null||u.length>0||this.#L!=null),this.#W=this.#Fe(),this.#we(),this.#Te({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#U-r})}#J(e){this.#Ne();let t=Rp(e),n=zp(e,t),r=null,i=null;for(let e of this.#ve()){if(Rp(e)!==t)continue;let a=zp(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Y(e){let t=this.#be(e);if(t!==-1)return t;let n=Lp(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#be(t);if(r!==-1)return r}return this.#ve().length>0?0:-1}#X(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#B.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#ie(r.path):this.#ae(r.path);return this.#d.set(r.path,i),i}#Z(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#R.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#Q(e){return this.#Z(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#$(e,t){let n=this.#B.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ee(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ee(n),n];return this.#a.set(e,r),r}#te(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ee(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ne(e){this.#B.collapse(e)}#re(e,t=this.#L,n=!0){let r=[...new Set(e)],i=!Ip(this.#R,r),a=this.#L!==t;!i&&!a||(this.#R=new Set(r),this.#L=t,i&&(this.#z+=1),n&&this.#we())}#ie(e){return{collapse:()=>{this.#ne(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#Ee(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#B.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#R.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#Ie(e)}}}#ae(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#R.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#oe(e){let t=this.#B.list();this.#se(t).batch(e)}#se(e,t,n){return new _p({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ce(){return this.#h??=this.#B.list(),this.#h}#le(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ce()){e.add(t);for(let n of Lp(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#ue(){return this.#g??=this.#ce().map(Vp),this.#g}#de(){return this.#f??=this.#le().filter(e=>e.endsWith(`/`)),this.#f}#fe(){return this.#p??=this.#de().map(Vp),this.#p}#pe(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#me(){return this.#de().filter(e=>this.#B.isExpanded(e))}#he(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#R)for(let n of Lp(e))t.add(n);this.#ge(t)}#ge(e){this.#H=!0;try{for(let t of this.#de()){let n=e.has(t),r=this.#B.isExpanded(t);n&&!r?this.#B.expand(t):!n&&r&&this.#B.collapse(t)}}finally{this.#H=!1}}#_e(){let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#M==null||this.#M.length===0||this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#U=this.#V;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#U=n.length}#ve(){return this.#I??this.#b}#ye(e){return this.#F?.[e]??e}#be(e){return this.#P?.get(e)??this.#B.getVisibleIndex(e)??-1}#xe(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Se(e,t){let n=e==null?null:Bp(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#me()),this.#M=n,n==null)this.#he(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#Oe(this.#c,!0);else if(n.length===0)this.#he(!1),this.#O.clear(),this.#N=null,this.#Oe(this.#c,!0);else{let e=this.#Ce();this.#Oe(e,!0)}t&&(this.#y?.(this.#M),this.#we())}}#Ce(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ce(),n=this.#ue(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#de(),s=this.#fe();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of Lp(e))l.add(t),c?.add(t)}return this.#ge(l),a??this.#c}#we(){for(let e of this.#t)e()}#Te(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#Ee(e){for(let t of Lp(e))this.#B.isExpanded(t)||this.#B.expand(t);this.#B.isExpanded(e)||this.#B.expand(e)}#De(e){let t=this.#U;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ne(),this.#Me(r))}#Oe(e,t=!0){let n=this.#B.getVisibleCount();this.#V=n;let r=nm(this.#B.getVisibleTreeProjectionData(t?void 0:Math.min(n,Pp)),e,t?e=>this.#B.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#_e(),this.#s=e==null?this.#ve().length>0?0:-1:this.#Y(e),this.#c=this.#s<0?null:this.#ke(this.#s)}#ke(e){return this.#ve()[e]??(this.#F==null?this.#B.getVisibleRowContext(e)?.row.path??null:null)}#Ae(e){return this.#B.getPathInfo(e)?.path??null}#je(e){if(e==null)return;let t=this.#Y(e);t>=0&&this.#Me(t,!1)}#Me(e,t=!0){let n=this.#ke(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#we()))}#Ne(){this.#l||this.#Oe(this.#c,!0)}#Pe(e){let t=Jp(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=Jp(this.#c,e,!0),r=[...this.#R].map(t=>Jp(t,e)).filter(e=>e!=null).map(e=>this.#B.getPathInfo(e)?.path??null).filter(e=>e!=null),i=Jp(this.#L,e),a=i==null?null:this.#B.getPathInfo(i)?.path??null,o=[...new Set(r)];return Ip(this.#R,o)||(this.#R=new Set(o),this.#z+=1),this.#L=a,n}#Fe(){return this.#B.on(`*`,e=>{if(this.#H)return;e.canonicalChanged&&(this.#d.clear(),this.#pe()),this.#i!=null&&Np(e)&&(this.#i=null);let t=Np(e)?this.#Pe(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ce():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#Oe(n,r),this.#we();let i=em(e);i!=null&&this.#Te(i)})}#Ie(e){if(this.#B.isExpanded(e)){this.#ne(e);return}this.#Ee(e)}},im=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function am(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(!(e[t]===`/`||t===e.length)){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function om(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function sm(e,t){return t?`${e}/`:e}function cm(e,t=null){let n=im(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=am(t.path);if(e==null)continue;let n=sm(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of om(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var lm=e=>e.trim().toLowerCase(),um=e=>e.split(`/`).at(-1)??e,dm=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function fm(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function pm(e){let t=El(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(lm(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let n=um(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return fm(c,e);for(let[t,n]of a)if(s.includes(t))return fm(n,e);let l=dm(n);for(let t of l){let n=i.get(t);if(n!=null)return fm(n,e)}let u=wl(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:Sl(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:fm(s,e)}}}var Z,mm,hm,gm,_m,vm,ym,bm,xm,Sm,Cm={},wm=[],Tm=Array.isArray,Em=wm.slice,Dm=Object.assign;function Om(e){e&&e.parentNode&&e.remove()}function km(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?Em.call(arguments,2):n),Am(e,o,r,i,null)}function Am(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++mm,__i:-1,__u:0};return i==null&&Z.vnode!=null&&Z.vnode(a),a}function jm(e){return e.children}function Mm(e,t){this.props=e,this.context=t,this.__g=0}function Nm(e,t){if(t==null)return e.__?Nm(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?Nm(e):null}function Pm(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return Pm(e)}}function Fm(e){(8&e.__g||!(e.__g|=8)||!hm.push(e)||_m++)&&gm==Z.debounceRendering||((gm=Z.debounceRendering)||queueMicrotask)(Im)}function Im(){for(var e,t,n,r,i,a,o,s,c=1;hm.length;)hm.length>c&&hm.sort(vm),e=hm.shift(),c=hm.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=Dm({},r)).__v=r.__v+1,Z.vnode&&Z.vnode(n),Wm(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??Nm(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,Km(a,n,o),n.__e!=i&&Pm(n)));_m=0}function Lm(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||wm,b=t.length;for(c=Rm(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?Cm:y[m.__i]||Cm,m.__i=f,_=Wm(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&Ym(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=zm(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function Rm(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?Am(null,o,null,null,null):Tm(o)?Am(jm,{children:o},null,null,null):o.constructor==null&&o.__b>0?Am(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=Bm(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=Nm(s)),Xm(s,s));return r}function zm(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=zm(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Nm(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Bm(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function Vm(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function Hm(e,t,n,r,i){var a;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||Vm(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||Vm(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(ym,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=bm,e.addEventListener(t,a?Sm:xm,a)):e.removeEventListener(t,a?Sm:xm,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function Um(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=bm++;else if(t.u<n.l)return;return n(Z.event?Z.event(t):t)}}}function Wm(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=Z.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new M(v,x):(t.__c=f=new Mm(v,x),f.constructor=M,f.render=Zm),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Dm({},f.__s)),Dm(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=Z.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=Dm({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===jm&&d.key==null&&(E=qm(d.props.children)),s=Lm(e,Tm(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)Om(a[j]);Gm(t)}else t.__e=n.__e,t.__k=n.__k,e.then||Gm(t);Z.__e(e,t,n)}else s=t.__e=Jm(n.__e,t,n,r,i,a,o,c,l,u);return(d=Z.diffed)&&d(t),128&t.__u?void 0:s}function Gm(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(Gm)}function Km(e,t,n){for(var r=0;r<n.length;r++)Ym(n[r],n[++r],n[++r]);Z.__c&&Z.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Z.__e(e,t.__v)}})}function qm(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:Tm(e)?e.map(qm):Dm({},e)}function Jm(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(Z.__m&&Z.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=Em.call(e.childNodes),v=n.props||Cm,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;Hm(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||Hm(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),Lm(b==`template`?e.content:e,Tm(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&Nm(n,0),s,c,l),a!=null)for(u=a.length;u--;)Om(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||Hm(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&Hm(e,u,g,v[u],i))}return e}function Ym(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){Z.__e(e,n)}}function Xm(e,t,n){var r,i;if(Z.unmount&&Z.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Ym(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Z.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Xm(r[i],t,n||typeof e.type!=`function`);n||Om(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function Zm(e,t,n){return this.constructor(e,n)}function Qm(e,t){var n,r,i,a;t==document&&(t=document.documentElement),Z.__&&Z.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=km(jm,null,[e]),i=[],a=[],Wm(t,e,r||Cm,Cm,t.namespaceURI,r?null:t.firstChild?Em.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),Km(i,e,a)}function $m(e,t){e.__u|=32,Qm(e,t)}Z={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw _m=0,e}},mm=0,Mm.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Dm({},this.state);typeof e==`function`&&(e=e(Dm({},n),this.props)),e&&Dm(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Fm(this))},Mm.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),Fm(this))},Mm.prototype.render=jm,hm=[],_m=0,vm=function(e,t){return e.__v.__b-t.__v.__b},ym=/(PointerCapture)$|Capture$/i,bm=0,xm=Um(!1),Sm=Um(!0);var eh=0;Array.isArray;function Q(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--eh,__i:-1,__u:0,__source:i,__self:a};return Z.vnode&&Z.vnode(l),l}var th=16,nh=16,rh={};function ih({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=rh[e]??{width:th,height:nh},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Q(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:Q(`use`,{href:c})})}var ah=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},oh=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},sh=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},ch=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},lh=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},uh=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function dh({children:e,marker:t,variant:n=`default`}){"use no memo";return Q(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Q(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Q(`span`,{"data-truncate-fade":!0}):t})})}function fh(e){"use no memo";let{mode:t,children:n}=e;return Q(`div`,{children:[Q(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Q(`span`,{children:n}):n}),Q(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Q(`span`,{children:n}):n})]})}function ph({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Q(fh,{mode:t,children:e},`content`),o=Q(dh,{marker:n,mode:t,variant:r},`marker`),s=Q(`div`,{"data-truncate-fill":!0},`fill`);return Q(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Q(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function mh({children:e,...t}){"use no memo";return Q(ph,{mode:`truncate`,...t,children:e})}function hh({children:e,...t}){"use no memo";return Q(ph,{mode:`fruncate`,...t,children:e})}function gh({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=Q(mh,{...s,children:t[0]}),l=Q(hh,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Q(`div`,{className:a,style:o});if(e.length<i)return Q(n===`end`?hh:mh,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=ah:r===`extension`?t=oh:r===`leaf-path`&&(t=sh);else if(typeof r==`number`)t=ch,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=lh:e===`first`&&(t=uh)}else typeof r==`function`&&(t=r);t??=ah;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=Q(mh,{...s,..._,children:f}),l=Q(hh,{...s,...v,children:p})}return Q(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Q(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Q(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var _h={endIndex:-1,startIndex:-1};function vh(e,t,n){return Math.min(Math.max(e,t),n)}function yh(e,t){return e<0||t<e?_h:{endIndex:t,startIndex:e}}function bh(e){return e.startIndex<0||e.endIndex<e.startIndex}function xh(e,t){return bh(e)?0:(e.endIndex-e.startIndex+1)*t}function Sh(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function Ch(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function wh(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function Th(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function Eh(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function Dh(e,t,n){if(e.length===0||t<=0)return[];let r=Eh(e),i=wh(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=Th(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function Oh(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=vh(t.scrollTop,0,o),c=t.stickyRows??Dh(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=Sh(s,n,t.itemHeight),m=Sh(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?_h:yh(m,Ch(u+d,n,t.itemHeight)),y=g+1,b=bh(v)?_h:yh(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=xh(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:bh(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var kh={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},Ah={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},jh=`Contains git status items`;function Mh(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function Nh(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function Ph(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}function Fh(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function Ih(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}var Lh,Rh,zh,Bh,Vh=Object.is,Hh=0,Uh=[],Wh=Z,Gh=Wh.__b,Kh=Wh.__r,qh=Wh.diffed,Jh=Wh.__c,Yh=Wh.unmount,Xh=Wh.__;function Zh(e,t){Wh.__h&&Wh.__h(Rh,e,Hh||t),Hh=0;var n=Rh.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Qh(e){return Hh=1,$h(ug,e)}function $h(e,t,n){var r=Zh(Lh++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):ug(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);Vh(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Rh,!Rh.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,Vh(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};Rh.__f=!0;var a=Rh.shouldComponentUpdate,o=Rh.componentWillUpdate;Rh.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},Rh.shouldComponentUpdate=i}return r.__N||r.__}function eg(e,t){var n=Zh(Lh++,3);!Wh.__s&&lg(n.__H,t)&&(n.__=e,n.u=t,Rh.__H.__h.push(n))}function tg(e,t){var n=Zh(Lh++,4);!Wh.__s&&lg(n.__H,t)&&(n.__=e,n.u=t,Rh.__h.push(n))}function $(e){return Hh=5,ng(function(){return{current:e}},[])}function ng(e,t){var n=Zh(Lh++,7);return lg(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function rg(e,t){return Hh=8,ng(function(){return e},t)}function ig(){for(var e;e=Uh.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(sg),e.__H.__h.forEach(cg),e.__H.__h=[]}catch(t){e.__H.__h=[],Wh.__e(t,e.__v)}}Wh.__b=function(e){Rh=null,Gh&&Gh(e)},Wh.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Xh&&Xh(e,t)},Wh.__r=function(e){Kh&&Kh(e),Lh=0;var t=(Rh=e.__c).__H;t&&(zh===Rh?(t.__h=[],Rh.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(sg),t.__h.forEach(cg),t.__h=[],Lh=0)),zh=Rh},Wh.diffed=function(e){qh&&qh(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Uh.push(t)!==1&&Bh===Wh.requestAnimationFrame||((Bh=Wh.requestAnimationFrame)||og)(ig)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),zh=Rh=null},Wh.__c=function(e,t){t.some(function(e){try{e.__h.forEach(sg),e.__h=e.__h.filter(function(e){return!e.__||cg(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],Wh.__e(n,e.__v)}}),Jh&&Jh(e,t)},Wh.unmount=function(e){Yh&&Yh(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{sg(e)}catch(e){t=e}}),n.__H=void 0,t&&Wh.__e(t,n.__v))};var ag=typeof requestAnimationFrame==`function`;function og(e){var t,n=function(){clearTimeout(r),ag&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ag&&(t=requestAnimationFrame(n))}function sg(e){var t=Rh,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),Rh=t}function cg(e){var t=Rh;e.__c=e.__(),Rh=t}function lg(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!Vh(t,e[n])})}function ug(e,t){return typeof t==`function`?t(e):t}function dg(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function fg(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function pg({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Q(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function mg(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Q(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Q(jm,{children:[Q(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Q(mh,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function hg(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function gg(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function _g(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function vg({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=Oh(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:_g(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?_g(u,1,t,o):i&&r<=0&&c.length>0?Dh(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var yg=400,bg=10,xg=40,Sg=18;function Cg(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?wg(e,t,n):a instanceof HTMLElement?a:null}function wg(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function Tg(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function Eg(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function Dg(){return navigator.vendor!==`Apple Computer, Inc.`}function Og(e,t){let n=e-t.top;if(n<xg)return-Math.ceil((xg-Math.max(0,n))/xg*Sg);let r=t.bottom-e;return r<xg?Math.ceil((xg-Math.max(0,r))/xg*Sg):0}function kg(e,t){if(e!=null){let t=kh[e];return t==null?null:{text:t,title:Ah[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:jh}:null}function Ag(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function jg(e){return e!=null&&`toggle`in e}function Mg(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function Ng(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function Pg(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function Fg(e,t){return e!=null&&e>0?e:t}function Ig(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function Lg(e,t,n,r,i=0){let a=Fh({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function Rg(e,t,n,r,i,a){let o=Ih({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function zg(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function Bg(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function Vg(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function Hg(e,t){return t&&Vg(e)||(e.ctrlKey||e.metaKey)&&Mg(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var Ug=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function Wg(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function Gg(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function Kg(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function qg(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function Jg(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function Yg(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function Xg(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function Zg(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function Qg(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=Zg(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function $g(e,t){return{kind:e.kind,name:gg(e),path:t}}function e_(e){return e==null?void 0:`${e}__tree`}function t_(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function n_(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function r_(e,t){if(e==null)return null;if(`text`in e)return Q(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?n_(e.icon)?t(e.icon):{name:e.icon}:n_(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Q(`span`,{title:e.title,children:Q(ih,{...n})})}function i_(e){e!=null&&dg(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function a_(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=hg(e);return Q(jm,{children:[e.depth>0?Q(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Q(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Q(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Q(ih,{...t(`file-tree-icon-chevron`)}):Q(ih,{...t(`file-tree-icon-file`,u)})}),Q(`div`,{"data-item-section":`content`,children:e.isFlattened?mg(e,c,a):c??Q(gh,{minimumLength:5,split:`extension`,children:e.name})}),i?Q(`div`,{"data-item-section":`decoration`,children:r==null?null:r_(r,t)}):null,s?Q(`div`,{"data-item-section":`git`,children:r_(o,t)}):null,n?Q(`div`,{"data-item-section":`action`,children:l?Q(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Q(ih,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function o_(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:N}=e,P=hg(t),{isParked:F=!1,mode:I=`flow`,style:ee}=r,te=I===`sticky`,ne=_?.get(P)??null??Ag(t.ancestorPaths,v,y),re=t.kind===`directory`&&(b?.has(P)??!1),ie=A(t,P),L=kg(ne,re),R=S&&w,z=ie!=null||x||R,ae=R&&T===`always`,oe=a.getPath()===P,se=oe?a.getValue():``,ce=te||!oe?null:Q(pg,{ref:D,ariaLabel:`Rename ${gg(t)}`,isFlattened:t.isFlattened,value:se,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),le=a_(t,k,{actionLaneEnabled:R,customDecoration:ie,decorationLaneEnabled:z,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:L,gitLaneActive:x,renameInput:ce,showDecorativeActionAffordance:ae}),ue={...Nh({ariaLabel:gg(t),domId:t.isFocused?t_(h,P,F):void 0,extraStyle:ee,features:{actionLaneEnabled:R,contextMenuButtonVisibility:R?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:re,effectiveGitStatus:ne,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusPath(P),j(t,P,{anchorRect:Kg(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:te?void 0:()=>{i.focusPath(P)},onKeyDown:te?void 0:N,ref:e=>{O(P,e)}};return!te&&oe?Q(`div`,{...ue,children:le}):Q(`button`,{...ue,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(te){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:le})}function s_(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(hg(e))).map((n,r)=>o_(e,n,t.start+r))}function c_({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=kl,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=$(null),v=$(null),y=$(!1),b=$(null),x=$(null),S=$(null),C=$(null),w=$(null),T=$(new Map),E=$(new Map),D=$(()=>{}),O=$(null),k=$(!1),A=$(null),j=$(null),M=$(!1),N=$(null),P=$(null),F=$(null),I=$(null),ee=$(null),te=$(null),ne=$(null),re=$(null),ie=$(!1),L=$(null),R=$(null),z=$(null),ae=$(null),oe=ng(()=>new Map,[]),[,se]=Qh(0),[ce,le]=Qh(null),[ue,de]=Qh(null),[fe,pe]=Qh(null),[me,he]=Qh(null),[ge,_e]=Qh(0),[B,ve]=Qh(null),ye=$(B);ye.current=B;let V=$(null),be=$(null),H=$(null),xe=$(null),Se=$(null),Ce=$(!1),we=()=>{be.current=null,H.current=null,xe.current=null},Te=(e,t)=>{be.current=e,H.current=null,xe.current=t==null?null:{path:e,scrollTop:t}},Ee=(e,t)=>{be.current=null,H.current={path:e,viewportOffset:t},xe.current=null},De=$(d===`retain`&&t.isSearchOpen()),[Oe,ke]=Qh(p);eg(()=>{p||ke(!1)},[p]);let Ae=$(!1),je=rg(()=>{Ae.current=!0,ke(e=>e&&!1)},[]),[Me,Ne]=Qh(()=>vg({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Pe,Fe]=Qh(!1);eg(()=>{Fe(!0)},[]);let Ie=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Le=e?.contextMenu?.triggerMode??(Ie?`right-click`:`both`),Re=Le===`both`||Le===`button`,ze=e?.contextMenu?.buttonVisibility??`when-needed`,Be=Le===`both`||Le===`right-click`;tg(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Se.current=t,de(t),he(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Ce.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Ve=rg((e,t)=>{Jg(T.current,e,t)},[]),He=rg((e,t)=>{Jg(E.current,e,t)},[]),Ue=rg(e=>{x.current=e},[]),We=rg(e=>Yg(e,E.current,T.current),[]),Ge=n!=null||r!=null||i!=null,{resolveIcon:Ke}=ng(()=>pm(a),[a]),qe=t[Mp](),Je=qe.getPath(),Ye=Je!=null,Xe=t.isSearchOpen(),Ze=t.getSearchValue(),U=t.getFocusedPath(),W=t.getFocusedIndex(),Qe=t.isDragAndDropEnabled(),$e=t.getDragSession(),et=ng(()=>$e==null?null:new Set($e.draggedPaths),[$e]),tt=$e?.target??null,G=$e?.primaryPath??null,nt=e_(o),{overlayHeight:rt,overlayRows:it,snapshot:at,visibleRows:ot}=Me,st=at.physical.viewportHeight,ct=ng(()=>({end:at.window.endIndex,start:at.window.startIndex}),[at.window.endIndex,at.window.startIndex]),lt=it,ut=at.sticky.rows,dt=at.physical.totalHeight,ft=at.sticky.height,pt=ng(()=>new Set(ut.map(e=>hg(e.row))),[ut]),mt=W>=0&&W>=ct.start&&W<=ct.end,ht=rg((e,t)=>u?.({item:$g(e,t),row:e})??null,[u]),gt=rg(e=>dg(e==null?null:T.current.get(e)??null)?!0:dg(S.current),[]),_t=rg(e=>{gt(t.focusNearestPath(e))},[t,gt]),vt=$(_t);vt.current=_t;let yt=$(!0),bt=$(()=>{}),xt=rg((t=!0)=>{let n=ye.current;n!=null&&(yt.current=yt.current&&t,ve(null),e?.contextMenu?.onClose?.(),yt.current&&_t(n.path))},[e?.contextMenu,_t]);bt.current=xt;let St=rg(e=>{let t=e==null?null:qg(S.current,e);pe(e=>e===t?e:t)},[]),Ct=rg((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=We(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Te(n,e?.scrollTop??null),k.current=!0,le(e=>e===n?e:n)}i.focus(),St(a),yt.current=!0,ve({anchorRect:r?.anchorRect??null,item:$g(e,n),path:n,source:r?.source??`keyboard`})},[t,We,St]),wt=rg(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=Pg(e,st);N.current=W<0||e==null?null:Math.max(0,Math.min(W*s-e.scrollTop,Math.max(0,t-s))),M.current=!0}t.startRenaming(e)!==!1&&(he(`focus`),se(e=>e+1))}},[t,W,s,l,st]),Tt=rg((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=Pg(i,st),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:vg({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return k.current=!0,Rg(i,a,s,l,u,d),D.current(),V.current=n?e:null,!0},[t,s,c,st,h]),Et=()=>y.current===!0||ae.current!=null||ie.current===!0,Dt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Ot=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},kt=()=>{I.current!=null&&(clearTimeout(I.current),I.current=null),F.current=null},At=()=>{te.current?.remove(),te.current=null},jt=()=>{Ot(P.current),P.current=null,ee.current=null},Mt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Nt=()=>{re.current?.(),re.current=null,ae.current!=null&&(clearTimeout(ae.current),ae.current=null),ie.current=!1,L.current=null,z.current=null,R.current!=null&&(R.current.setAttribute(`draggable`,`true`),R.current.style.removeProperty(`touch-action`),R.current=null),At(),kt(),jt(),ne.current=null},Pt=(e,n)=>{let r=S.current?.getRootNode(),i=Tg(Cg(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Ft=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){kt();return}let r=t.getItem(e.directoryPath),i=jg(r)?r:null;if(i==null||i.isExpanded()){kt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;F.current!==a&&(kt(),F.current=a,I.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},It=()=>{P.current=null;let e=ee.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=Og(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),Ft(Pt(e.clientX,e.clientY)),P.current=Dt(It)},Lt=(e,t)=>{ee.current={clientX:e,clientY:t},P.current??=Dt(It)},Rt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Nt(),At(),kt(),jt(),t.startDrag(r)===!1){e.preventDefault();return}if(ne.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),Dg())){let t=Eg(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Mt(t),te.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},zt=()=>{At(),kt(),jt(),ne.current=null,t.cancelDrag()},Bt=(e,n,r)=>{if(ae.current!=null||ie.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;z.current={clientX:i.clientX,clientY:i.clientY},R.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!ie.current;ae.current!=null&&(clearTimeout(ae.current),ae.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),re.current===o&&(re.current=null),t&&(a.setAttribute(`draggable`,`true`),R.current===a&&(R.current=null),z.current=null)},s=e=>{let t=e.touches[0],n=z.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=bg*bg||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),re.current=o,ae.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),R.current===a&&(R.current=null),z.current=null;return}ie.current=!0,R.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),ne.current=n;let e=a.getBoundingClientRect(),s=Eg(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Mt(s),te.current=s,L.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=L.current;n!=null&&te.current!=null&&(te.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Ft(Pt(t.clientX,t.clientY)),Lt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Pt(n.clientX,n.clientY),t.completeDrag(),Nt()},u=()=>{t.cancelDrag(),Nt()};re.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},yg)},Vt=e=>{if(B!=null){if(e.key===`Escape`){xt(),e.preventDefault(),e.stopPropagation();return}Ug.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(qe.isActive()){if(e.key===`Escape`)qe.cancel();else if(e.key===`Enter`)qe.commit();else return;he(`focus`),se(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){wt(U??void 0),e.preventDefault(),e.stopPropagation();return}if(Xe){if(e.key===`Escape`)M.current=!1,N.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=Pg(n,st);N.current=W<0||n==null?null:Math.max(0,Math.min(W*s-n.scrollTop,Math.max(0,r-s))),M.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;he(`focus`),se(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&Ng(e)){t.openSearch(e.key),se(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ie&&Vg(e),r=Hg(e,Ie),i=r&&S.current!=null?fg(S.current):null,a=r?new Set(Xg(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==U&&a.has(o)){let e=C.current;Te(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=jg(p)?p:null,h=u!=null&&(pt.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=Yg(u,E.current,T.current);e==null||n==null?y=!1:Ct(e,u)}else if((e.ctrlKey||e.metaKey)&&Mg(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;he(`focus`);let b=t.getFocusedPath(),x=b!=null&&(pt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Te(b,v?.scrollTop??null),k.current=!0,le(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Ee(b,Qg(S.current,v,i,u,s,ft,st)),k.current=!0,le(e=>e===b?e:b)):we()}se(e=>e+1),e.preventDefault(),e.stopPropagation()};tg(()=>{if(!(!f||!Xe)){if(De.current){De.current=!1;return}dg(w.current)}},[Xe,f]),tg(()=>{let e=x.current;switch(Mh({hasRenderedInput:e!=null,previousRenamingPath:j.current,renamingPath:Je})){case`reset`:j.current=null;return;case`reveal-canonical`:Je!=null&&Tt(Je,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(V.current=null,j.current=Je,dg(e),e.select());return}},[ct.end,ct.start,Je,Tt,pt]),tg(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=fg(e)?.dataset.itemPath??null;le(e=>e===t?e:t)},i=()=>{n(),k.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,fg(e)!=null){r();return}k.current=!1,le(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),k.current=!1,le(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;le(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),tg(()=>{let e=S.current;e!=null&&(at.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[at.physical.scrollTop]),tg(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=Pg(n,g);let a=()=>{let e=t.getVisibleCount(),r=Fg(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ne(vg({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};D.current=a;let o=!1,l=t.subscribe(()=>{o?se(e=>e+1):o=!0,a()}),u=()=>{Ce.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,_e(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||Ce.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),ye.current!=null&&y.current&&bt.current(),Ce.current===!0){y.current=!1;return}de(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:Ig(e[0]))??Pg(n,g),a()}):null;return w?.observe(n),()=>{D.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,w?.disconnect()}},[t,g,s,c,h]),tg(()=>{Ie||B==null||xt(!1)},[xt,Ie,B]);let Ht=ng(()=>B==null?null:`${B.path}::${B.source}`,[B]);tg(()=>{if(Ht==null){m?.clearSlotContent(oc);return}let t=ye.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??Gg(n.getBoundingClientRect()),close:e=>{bt.current(e?.restoreFocus??!0)},restoreFocus:()=>{yt.current&&vt.current(ye.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(oc,i),e?.contextMenu?.onOpen?.(t.item,r),i_(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&i_(i)}),()=>{m?.clearSlotContent(oc)}},[Ht,e?.contextMenu,m]),tg(()=>{B!=null&&t.getItem(B.path)==null&&xt()},[xt,B,t]),tg(()=>{if(B==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(Wg(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&xt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),xt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[xt,B]),tg(()=>{let e=C.current,t=S.current;if(e==null||t==null){A.current=U;return}let n=U==null?null:T.current.get(U)??null,r=fg(t),i=r?.dataset.itemPath??null,a=Ye&&x.current===r,o=f&&w.current===r,c=M.current&&!Xe,l=N.current??0,u=V.current,d=be.current,p=H.current,m=xe.current,h=r!=null,g=k.current||h,_=A.current!==U,v=d!=null&&d===U&&U!=null,y=c&&Rg(e,W,s,st,dt,l),b=u!=null&&u===U&&Rg(e,W,s,st,dt,ft),E=p!=null&&p.path===U&&Rg(e,W,s,st,dt,p.viewportOffset),O=m!=null&&m.path===U&&e.scrollTop!==m.scrollTop;if(O&&(e.scrollTop=m.scrollTop),(O||b||E||y||g&&_&&u!==U&&!v&&Lg(e,W,s,st,ft))&&D.current(),!g){A.current=U;return}if(a){A.current=U;return}if(o&&!c){A.current=U;return}if(n==null){c&&W>=0&&(Rg(e,W,s,st,dt,l),D.current()),A.current=U;return}(_||c||u===U||d===U||p?.path===U||m?.path===U||i==null||i!==U)&&(dg(n),u===U&&(V.current=null),d===U&&(be.current=null),p?.path===U&&(H.current=null),m?.path===U&&(xe.current=null),M.current=!1,N.current=null),A.current=U},[t,W,U,mt,s,Ye,Xe,ct,st,f,ft,dt,ot]);let Ut=W>=0&&W>=at.visible.startIndex&&W<=at.visible.endIndex,Wt=U!=null&&lt.some(e=>hg(e.row)===U),Gt=Ut||Wt,Kt=Re&&k.current===!0&&Gt?U:null,qt=me===`pointer`?ue:null,Jt=B?.path??Se.current??qt??Kt??ue,Yt=B?.source===`right-click`;tg(()=>{y.current&&B==null||St(We(Jt))},[B,We,ct,st,ge,lt,Jt,St,ot]);let Xt=rg(e=>{if(y.current||Wg(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&he(e=>e===`pointer`?e:`pointer`),de(e=>e===i?e:i)},[]),Zt=rg(()=>{de(null)},[]);tg(()=>{if(!Qe)return;let e=()=>{Nt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Nt(),t.cancelDrag()}},[t,Qe]);let Qt=e=>{if(!Qe||t.getDragSession()==null||ie.current)return;let n=Tg(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Ft(t.getDragSession()?.target??null),Lt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},$t=e=>{if(!Qe||t.getDragSession()==null||ie.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(kt(),jt(),t.setDragTarget(null))},en=e=>{!Qe||t.getDragSession()==null||ie.current||(e.preventDefault(),Pt(e.clientX,e.clientY),t.completeDrag(),At(),kt(),jt(),ne.current=null)},tn=at.window.height,nn=at.window.offsetTop,rn=Math.min(0,st-tn-ft),an=ce===U||M.current,on=U!=null&&an&&!mt&&W>=0?ot[W]??t.getVisibleRows(W,W)[0]??null:null,sn=on==null?null:zg(W,s,ct,tn),cn=ne.current,ln=G!=null&&cn!=null&&cn.path===G&&cn.index>=ct.start&&cn.index<=ct.end,un=G!=null&&cn!=null&&cn.path===G&&!ln&&cn.path!==on?.path?cn:null,dn=un==null?null:zg(un.index,s,ct,tn),fn=Bg((W>=0?ot[W]??t.getVisibleRows(W,W)[0]??null:null)?.ancestorPaths.at(-1)??null),pn=Xe&&U!=null?t_(o,U,!mt):void 0,mn=B?.path??(Xe?U:ce),hn=B?.path??ue,gn=We(Jt),_n=Ie&&Re&&!Yt&&!Ye&&gn!=null&&fe!=null&&Jt!=null,vn=Ie&&(_n||B!=null),yn=B?.anchorRect,bn=yn==null&&gn!=null&&fe!=null&&(B!=null||_n)?fe:null,xn=yn==null?bn==null?void 0:{top:`${bn}px`}:{left:`${yn.left}px`,position:`fixed`,right:`auto`,top:`${yn.top}px`},Sn=Yt?{opacity:`0`}:void 0,Cn=rg((e,n,r,i)=>{let a=t.getItem(r),o=Ph({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:t.isSearchOpen(),mode:i});switch(o.selection.kind){case`range`:t.selectPathRange(r,o.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(r);break;case`single`:t.selectOnlyPath(r);break}let s=e.currentTarget instanceof HTMLElement?e.currentTarget:null,c=n.index>=at.visible.startIndex&&n.index<=at.visible.endIndex,l=i===`flow`&&c&&s!=null&&s.dataset.itemParked!==`true`;a?.focus(),l&&(k.current=!0,le(e=>e===r?e:r),he(`focus`)),o.toggleDirectory&&jg(a)&&a.toggle(),o.closeSearch&&t.closeSearch(),o.revealCanonical&&Tt(r,{targetOffset:`sticky-parents`})},[t,at.visible.endIndex,at.visible.startIndex,Tt]),wn=()=>{if(y.current||!Re||Jt==null||gn==null)return;let e=t.getItem(Jt);e!=null&&(St(gn),yt.current=!0,ve({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:gn.getAttribute(`aria-label`)??Jt,path:e.getPath()},path:e.getPath(),source:`button`}))},Tn={contextHoverPath:hn,contextMenuButtonTriggerEnabled:Re,contextMenuButtonVisibility:ze,contextMenuEnabled:Ie,contextMenuRightClickEnabled:Be,contextMenuTriggerMode:Le,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Qe,draggedPathSet:et,dragTarget:tt,gitLaneActive:Ge,gitStatusByPath:n,handleRowDragEnd:zt,handleRowDragStart:Rt,handleRowTouchStart:Bt,ignoredGitDirectories:r,ignoredInheritanceCache:oe,instanceId:o,itemHeight:s,onKeyDown:Vt,onRowClick:Cn,openContextMenuForRow:Ct,registerButton:Ve,registerRenameInput:Ue,renameView:qe,renderDecorationForRow:ht,resolveIcon:Ke,shouldSuppressContextMenu:Et,visualFocusPath:mn},En={...Tn,registerButton:He};return Q(`div`,{ref:S,id:nt,"data-file-tree-context-menu-button-visibility":Ie&&Re?ze:void 0,"data-file-tree-context-menu-trigger-mode":Ie?Le:void 0,"data-file-tree-has-context-menu-action-lane":Ie&&Re?`true`:void 0,"data-file-tree-has-git-lane":Ge?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:Qe?$t:void 0,onDragOver:Qe?Qt:void 0,onDrop:Qe?en:void 0,onKeyDown:Vt,onPointerLeave:Ie?Zt:void 0,onPointerOver:Ie?Xt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Q(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:fn}}),Q(`slot`,{name:ac,"data-type":`header-slot`}),f?Q(`div`,{"data-file-tree-search-container":!0,"data-open":Xe?`true`:`false`,children:Q(`input`,{ref:w,"aria-activedescendant":pn,"aria-controls":nt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Oe?`true`:void 0,value:Ze,onBlur:()=>{d===`retain`&&!Ae.current||t.closeSearch()},onFocus:je,onPointerDown:je,onInput:e=>{je();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Q(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Pe&&lt.length>0?Q(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Q(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${rt}px`},children:lt.map((e,t)=>o_(En,e.row,`sticky:${hg(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${lt.length-t}`}}))})}):null,Q(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${dt}px`},children:[Q(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${nn}px`}}),Q(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${tn}px`,top:`${rn}px`,bottom:`${rn}px`},children:[s_(Tn,ct,pt),on!=null&&sn!=null?o_(Tn,on,`parked:${on.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:G===on.path?`none`:void 0,position:`absolute`,right:`0`,top:`${sn}px`}}):null,un!=null&&dn!=null?o_(Tn,un,`parked-drag:${un.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${dn}px`}}):null]})]})]}),Ie?Q(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":vn?`true`:`false`,style:xn,children:[Q(`button`,{ref:v,type:`button`,"data-type":sc,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":B==null?`false`:`true`,"data-visible":_n?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),B!=null){xt();return}wn()},tabIndex:-1,style:Sn,children:Q(ih,{...Ke(`file-tree-icon-ellipsis`)})}),B==null?null:Q(`slot`,{name:oc})]}):null,B==null?null:Q(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),xt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),xt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var l_={hydrateRoot:(e,t)=>{$m(km(c_,t),e)},renderRoot:(e,t)=>{Qm(km(c_,t),e)},unmountRoot:e=>{Qm(null,e)}};function u_(e,t){l_.renderRoot(e,t)}function d_(e,t){l_.hydrateRoot(e,t)}function f_(e){l_.unmountRoot(e)}var p_=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}},m_=`__c`,h_=`__k`,g_=`__d`,__=`__s`,v_=/[\s\n\\/='"\0<>]/,y_=/^(xlink|xmlns|xml)([A-Z])/,b_=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,x_=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,S_=new Set([`draggable`,`spellcheck`]);function C_(e){e.__g===void 0?e[g_]=!0:e.__g|=8}function w_(e){e.__g===void 0?e[g_]=!1:e.__g&=-9}function T_(e){return e.__g===void 0?!0===e[g_]:!!(8&e.__g)}var E_=/["&<]/;function D_(e){if(e.length===0||!1===E_.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`&quot;`;break;case 38:i=`&amp;`;break;case 60:i=`&lt;`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var O_={},k_=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),A_=/[A-Z]/g;function j_(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:O_[n]||(O_[n]=n.replace(A_,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||k_.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function M_(){this.__d=!0}function N_(e,t){return{__v:e,context:t,props:e.props,setState:M_,forceUpdate:M_,__d:!0,__h:[]}}function P_(e,t,n){if(!e.s){if(n instanceof F_){if(!n.s)return void(n.o=P_.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(P_.bind(null,e,t),P_.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var F_=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{P_(r,1,a(this.v))}catch(e){P_(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?P_(r,1,t?t(i):i):n?P_(r,1,n(i)):P_(r,2,i)}catch(e){P_(r,2,e)}},r},e}(),I_,L_,R_,z_,B_={},V_=Array.isArray,H_=Object.assign,U_=``,W_=`<!--$s-->`,G_=`<!--/$s-->`;function K_(e,t){var n,r=e.type,i=!0;return e[m_]?(i=!1,(n=e[m_]).state=n[__]):n=new r(e.props,t),e[m_]=n,n.__v=e,n.props=e.props,n.context=t,C_(n),n.state??=B_,n[__]??(n[__]=n.state),r.getDerivedStateFromProps?n.state=H_({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[__]===n.state?n.state:n[__]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),R_&&R_(e),n.render(n.props,n.state,t)}function q_(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===U_)return U_;var s=typeof e;if(s!=`object`)return s==`function`?U_:s==`string`?D_(e):e+U_;if(V_(e)){var c,l=U_;i[h_]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=q_(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=U_,V_(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return U_;e.__=i,I_&&I_(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===jm){if(`tpl`in g){for(var x=U_,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!V_(C)?x+=C:x+=q_(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+D_(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var w=t[_.__c];b=w?w.props.value:_.__}var T=h.prototype&&typeof h.prototype.render==`function`;if(T)v=K_(e,b),y=e[m_];else{e[m_]=y=N_(e,b);for(var E=0;T_(y)&&E++<25;){w_(y),R_&&R_(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}C_(y)}if(y.getChildContext!=null&&(t=H_({},t,y.getChildContext())),T&&Z.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===jm&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return q_(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[__]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,B_),T_(y)?(v=K_(e,t),(y=e[m_]).getChildContext!=null&&(t=H_({},t,y.getChildContext())),q_(v=v!=null&&v.type===jm&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):U_}finally{L_&&L_(e),z_&&z_(e)}}}v=v!=null&&v.type===jm&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=q_(v,t,n,r,e,a,o);return L_&&L_(e),Z.unmount&&Z.unmount(e),e._suspended?typeof D==`string`?W_+D+G_:V_(D)?(D.unshift(W_),D.push(G_),D):D.then(function(e){return W_+e+G_}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return q_(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=Z.__e;return k&&k(i,e),U_}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=q_(v,t,n,r,e,a,o);return e._suspended?W_+s+G_:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=U_;for(var N in g){var P=g[N];if(typeof(P=Y_(P)?P.value:P)!=`function`||N===`class`||N===`className`){switch(N){case`children`:A=P;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;N=`for`;break;case`className`:if(`class`in g)continue;N=`class`;break;case`defaultChecked`:N=`checked`;break;case`defaultSelected`:N=`selected`;break;case`defaultValue`:case`value`:switch(N=`value`,h){case`textarea`:A=P;continue;case`select`:r=P;continue;case`option`:r!=P||`selected`in g||(j+=` selected`)}break;case`dangerouslySetInnerHTML`:M=P&&P.__html;continue;case`style`:typeof P==`object`&&(P=j_(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(y_.test(N))N=N.replace(y_,`$1:$2`).toLowerCase();else{if(v_.test(N))continue;N[4]!==`-`&&!S_.has(N)||P==null?n?x_.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):b_.test(N)&&(N=N.toLowerCase()):P+=U_}}P!=null&&!1!==P&&(j=!0===P||P===U_?j+` `+N:j+` `+N+`="`+(typeof P==`string`?D_(P):P+U_)+`"`)}}if(v_.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=D_(A):A!=null&&!1!==A&&!0!==A&&(M=q_(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),L_&&L_(e),z_&&z_(e),!M&&J_.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return V_(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var J_=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function Y_(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var X_=0;function Z_(e){return e!=null&&e.length>0?e:(X_+=1,`pst_ft_${X_}`)}function Q_({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??kl)}function $_(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function ev(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function tv(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var nv=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new p_;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=Z_(a),this.#p=cm(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=Ol(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new rm({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(f_(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),u_(t.wrapper,this.#w()))}setGitStatus(e){this.#p=cm(e,this.#p);let t=this.#T();t!=null&&u_(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),u_(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),d_(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),u_(r,this.#w())}#C(){return{initialViewportHeight:Q_({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(ac,e());return}this.#l.setSlotHtml(ac,this.#e?.header?.html??null)}#k(e){let t=tv(e).find(e=>ev(e)),n=$_(xl(El(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=tv(e),n=t.find(e=>ev(e)),r=t.filter(e=>e!==n),i=El(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=$_(i);if(a==null){for(let e of r)e.remove();return}if(!(r.length===1&&r[0].outerHTML===a.outerHTML)){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=El(this.#m);t.colored&&Cl(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${tc}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}this.#g?.parentNode===e&&this.#_===this.#h||(this.#g??=document.createElement(`style`),this.#g.setAttribute(tc,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=Nl(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return zl(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}};function rv(e){let t=(0,K.useRef)(null);return t.current??=new nv(e),(0,K.useEffect)(()=>{let e=t.current;return()=>{e?.cleanUp(),t.current=null}},[]),{model:t.current}}var iv={"--trees-accent-override":`var(--ring)`,"--trees-bg-muted-override":`color-mix(in srgb, var(--muted) 45%, transparent)`,"--trees-bg-override":`transparent`,"--trees-border-color-override":`var(--border)`,"--trees-fg-muted-override":`var(--muted-foreground)`,"--trees-fg-override":`var(--foreground)`,"--trees-focus-ring-color-override":`var(--ring)`,"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`var(--text-sm)`,"--trees-item-margin-x-override":`0`,"--trees-padding-inline-override":`0`,"--trees-scrollbar-thumb-override":`color-mix(in srgb, var(--muted-foreground) 35%, transparent)`,"--trees-selected-bg-override":`color-mix(in srgb, var(--accent) 65%, transparent)`,"--trees-selected-fg-override":`var(--foreground)`,"--trees-selected-focused-border-color-override":`var(--ring)`,height:`100%`};function av({controller:e,filesError:t,isFilesLoading:n}){let{closeSearch:r,filteredFiles:i,isSearchOpen:a,loadedFiles:o,model:s,searchQuery:c,setSearchQuery:l}=e,u=vr(),d=(0,K.useRef)(null);(0,K.useEffect)(()=>{a&&d.current?.focus()},[a]);let f=(0,K.useMemo)(()=>({...iv,colorScheme:u}),[u]),p;return p=t?(0,q.jsx)(Jn,{message:t.message,messageClassName:`text-destructive`}):n&&o.length===0?(0,q.jsx)(Jn,{icon:`Spinner`,message:`Loading files...`,iconClassName:`animate-spin`}):o.length===0?(0,q.jsx)(Jn,{message:`No files yet.`}):i.length===0?(0,q.jsx)(Jn,{message:`No files match search.`}):(0,q.jsx)(pc,{"aria-label":`Thread storage file tree`,className:`block h-full min-h-0`,model:s,style:f}),(0,q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-1`,children:[a?(0,q.jsxs)(`div`,{className:`flex h-7 shrink-0 items-center gap-2`,children:[(0,q.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,q.jsx)(L,{name:`Search`,className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,q.jsx)(Xe,{ref:d,"aria-label":`Search files`,className:`h-7 pl-7 pr-2 text-xs focus-visible:ring-0`,placeholder:`Search files`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),r())}})]}),(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0 rounded-md p-0 text-muted-foreground`,"aria-label":`Close search`,onClick:r,children:(0,q.jsx)(L,{name:`X`,className:`size-3.5`})})]}):null,(0,q.jsx)(`div`,{className:`min-h-0 flex-1`,children:p})]})}function ov(e){return e?.type===`standard`&&e.parentThreadId===null}function sv({currentThreadId:e,isManagerThread:t,managerThreads:n,parentThreadDisplayName:r,parentThreadId:i}){if(!e||t)return[];let a=[{value:`none`,label:`None`}],o=new Set([`none`]),s=(t,n)=>{!t||t===e||o.has(t)||(o.add(t),a.push({value:t,label:n}))};s(i??void 0,r??`Manager`);for(let e of n)s(e.id,e.title?.trim()?e.title:`Manager`);return a}function cv({thread:e,projectId:t,parentThreadDisplayName:n,managerThreads:r,canAssignToManager:i,canTakeOverThread:a,updateThreadPending:o,onAssignManager:s,defaultOpen:c}){let l=e.type===`manager`,u=e.parentThreadId??void 0,d=(0,K.useMemo)(()=>sv({currentThreadId:e.id,isManagerThread:l,managerThreads:r,parentThreadDisplayName:n,parentThreadId:u}),[l,r,n,u,e.id]),f=u??`none`,p=d.find(e=>e.value===f)?.label;return l||!u&&!i&&!a?null:(0,q.jsx)(Wt,{label:`Manager`,valueClassName:`min-w-0`,children:u?(0,q.jsxs)(`div`,{className:`inline-flex max-w-full min-w-0 items-center gap-1 text-xs text-foreground`,children:[(0,q.jsx)(qe,{to:`/projects/${t}/threads/${u}`,className:`min-w-0 truncate text-xs text-foreground no-underline transition-[text-decoration-color] duration-150 hover:underline hover:underline-offset-2`,children:p??`Manager`}),(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`size-3.5 shrink-0 rounded-full p-0 text-muted-foreground hover:bg-transparent hover:text-foreground [&_svg]:size-3`,disabled:o,onClick:()=>{s(null)},"aria-label":`Unassign manager`,children:(0,q.jsx)(L,{name:`X`})})]}):(0,q.jsxs)(B,{defaultOpen:c,children:[(0,q.jsx)(ge,{asChild:!0,children:(0,q.jsxs)(`div`,{role:`button`,tabIndex:o||d.length<=1&&f===`none`?-1:0,className:`inline-flex w-fit max-w-full min-w-0 items-center gap-1 rounded-md px-0 text-xs leading-tight text-foreground outline-none ring-sidebar-ring transition-colors hover:text-foreground focus-visible:ring-2`,children:[(0,q.jsx)(`span`,{className:`min-w-0 truncate text-xs text-foreground`,children:p??`None`}),(0,q.jsx)(L,{name:`ChevronDown`,className:`size-3.5 shrink-0 text-muted-foreground`})]})}),(0,q.jsxs)(ye,{align:`start`,className:`min-w-40 max-w-72`,children:[(0,q.jsx)(ve,{children:`Assign to manager`}),d.map(e=>(0,q.jsxs)(he,{onSelect:()=>{s(e.value===`none`?null:e.value)},className:`flex items-center justify-between gap-3`,children:[(0,q.jsx)(`span`,{className:`truncate`,title:e.label,children:e.label}),(0,q.jsx)(L,{name:`Check`,className:f===e.value?R(`opacity-100`,H):R(`opacity-0`,H)})]},e.value))]})]})})}function lv({thread:e}){return e.type===`manager`?(0,q.jsx)(Wt,{label:`Kind`,valueClassName:`min-w-0 truncate`,children:`Manager`}):null}function uv({environmentHost:e,environment:t,environmentIsLocal:n}){if(!e)return null;let r=t?n:void 0,i=e.status===`connected`;return(0,q.jsx)(Wt,{label:`Host`,valueClassName:`min-w-0 truncate`,children:(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(`span`,{className:`truncate`,children:e.name}),r?(0,q.jsx)(mt,{}):null,(0,q.jsx)(On,{connected:i})]})})}function dv({thread:e,environment:t,environmentHost:r,environmentIsLocal:i}){let a=yn({projectId:e.projectId,environmentId:t?.id??``});if(e.type===`manager`||!t)return null;let o=n({environment:t,isLocalHost:i,hostName:r?.name}),s=fv(t);return(0,q.jsx)(Wt,{label:`Environment`,valueClassName:`min-w-0`,children:(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,q.jsx)(`span`,{className:`min-w-0 truncate`,children:o.modeLabel}),s?(0,q.jsx)(`button`,{type:`button`,"aria-label":`Create new thread in this worktree`,title:`New thread in this worktree`,onClick:a,className:`inline-flex shrink-0 items-center justify-center rounded-md p-0.5 text-muted-foreground/75 transition-colors hover:bg-state-hover hover:text-foreground`,children:(0,q.jsx)(L,{name:`MessageSquarePlus`,className:`size-4`})}):null]})})}function fv(e){return e.isWorktree||e.workspaceProvisionType===`managed-worktree`}function pv({thread:e,environment:t}){return e.type===`manager`||!t?.path||!fv(t)?null:(0,q.jsx)(Wt,{label:`Worktree path`,valueClassName:`min-w-0`,children:(0,q.jsx)(Ft,{text:t.path,label:`Copy worktree path`,title:t.path,successMessage:`Worktree path copied`,errorMessage:`Failed to copy worktree path`})})}function mv({thread:e,workspaceStatus:t}){let n=t?.branch.currentBranch??null;return e.type===`manager`||!n?null:(0,q.jsx)(Wt,{label:`Branch`,valueClassName:`min-w-0 truncate`,children:(0,q.jsx)(Ft,{text:n,label:`Copy branch name`,successMessage:`Branch name copied`,errorMessage:`Failed to copy branch name`})})}function hv({thread:e,workspaceStatus:t,selectedMergeBaseBranch:n,mergeBaseBranchOptions:r,isLoadingMergeBaseBranchOptions:i,onMergeBaseBranchChange:a,defaultOpen:o}){let s=n??t?.mergeBase?.mergeBaseBranch??t?.branch.defaultBranch,c=s,l=(0,K.useMemo)(()=>Un({mergeBaseBranch:c,mergeBaseBranchOptions:r}),[c,r]),u=!!(s||t?.branch.defaultBranch),d=t?.branch.currentBranch!=null&&t.branch.currentBranch===t.branch.defaultBranch,f=u&&!!c&&!d;return e.type===`manager`||!f?null:(0,q.jsx)(Wt,{label:`Merge base`,valueClassName:`min-w-0 truncate`,children:c&&l.length>0&&c?(0,q.jsx)(Xn,{value:c,options:l,variant:`minimal`,loading:i,onChange:a,className:`max-w-full`,defaultOpen:o}):c})}function gv({thread:e,environment:t,workspaceStatus:n,workspaceStatusError:r,selectedMergeBaseBranch:i}){let a=e.type!==`manager`,o=t?.status===`destroyed`;if(!(a&&(n||r||o)&&!(e.archivedAt!=null&&t?.managed!==!0)))return null;let s=i??n?.mergeBase?.mergeBaseBranch??n?.branch.defaultBranch,c=oa(n,{mergeBaseBranch:s,showBranchComparison:!!(s||n?.branch.defaultBranch),error:r,workspaceDeleted:o}),l=n?.workingTree.state===`untracked`?`text-muted-foreground`:`text-foreground`;return(0,q.jsx)(Wt,{label:`Git status`,align:`start`,valueClassName:`min-w-0`,children:(0,q.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2 whitespace-nowrap`,title:`${c.label} ${c.summary}`,children:[(0,q.jsx)(`span`,{className:R(`shrink-0 font-medium`,l),children:c.label}),(0,q.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:c.summaryContent})]})})}function _v({thread:e}){let t=Se(),n=t.isPending&&t.variables?.id===e.id,r=(0,K.useCallback)(()=>{t.mutate({id:e.id})},[e.id,t]);return e.archivedAt==null?null:(0,q.jsx)(Wt,{label:`Archived`,valueClassName:`min-w-0 truncate`,children:(0,q.jsx)(br,{isPending:n,onUnarchive:r,threadType:e.type})})}function vv({thread:e,workspaceStatus:t,onChangedFileClick:n}){return e.type===`manager`?null:(0,q.jsx)(Di,{sections:Ci(t),onFileClick:n,rowClassName:`min-h-0 flex-1`,rowValueClassName:`min-h-0 flex-1`,listClassName:`h-full`})}function yv({controller:e,filesError:t,isFilesLoading:n}){let{isSearchOpen:r,openSearch:i}=e;return(0,q.jsx)(Wt,{orientation:`vertical`,className:`min-h-0 flex-1`,valueClassName:`min-h-0 flex-1 overflow-hidden`,labelClassName:`flex items-center justify-between gap-2`,label:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{children:`Manager workspace`}),r?null:(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`h-5 w-5 shrink-0 rounded-md p-0 text-muted-foreground`,"aria-label":`Search files`,onClick:i,children:(0,q.jsx)(L,{name:`Search`,className:`size-3.5`})})]}),children:(0,q.jsx)(av,{controller:e,filesError:t,isFilesLoading:n})})}function bv({thread:e,parentThreadDisplayName:t,environment:n,workspaceStatus:r,workspaceStatusError:i}){let a=e.type===`manager`,o=e.parentThreadId??void 0,s=!a,c=n?.status===`destroyed`,l=s&&(!!r||!!i||c)&&!(e.archivedAt!=null&&n?.managed!==!0),u=r?.branch.currentBranch??null,d=Ci(r),f=s&&d.length>0;return!!(a||o||!a&&n||!a&&u||l||f||e.archivedAt!=null||t&&o)}function xv({hasFlexibleHeight:e,children:t}){return(0,q.jsx)(In,{className:R(`h-full min-h-0 rounded-none border-0 bg-transparent px-0 py-0`,e?`flex-1`:`shrink-0`),children:t})}function Sv(e){let{thread:t,projectId:n,parentThreadDisplayName:r,managerThreads:i,canAssignToManager:a,canTakeOverThread:o,environmentHost:s,environmentIsLocal:c,environment:l,workspaceStatus:u,workspaceStatusError:d,selectedMergeBaseBranch:f,mergeBaseBranchOptions:p,isLoadingMergeBaseBranchOptions:m,updateThreadPending:h,storage:g,onAssignManager:_,onMergeBaseBranchChange:v,onChangedFileClick:y}=e;return(0,q.jsxs)(xv,{hasFlexibleHeight:g!==void 0||t.type!==`manager`&&Ci(u).length>0,children:[(0,q.jsx)(lv,{thread:t}),(0,q.jsx)(cv,{thread:t,projectId:n,parentThreadDisplayName:r,managerThreads:i,canAssignToManager:a,canTakeOverThread:o,updateThreadPending:h,onAssignManager:_}),(0,q.jsx)(uv,{environmentHost:s,environment:l,environmentIsLocal:c}),(0,q.jsx)(dv,{thread:t,environment:l,environmentHost:s,environmentIsLocal:c}),(0,q.jsx)(pv,{thread:t,environment:l}),(0,q.jsx)(mv,{thread:t,workspaceStatus:u}),(0,q.jsx)(hv,{thread:t,workspaceStatus:u,selectedMergeBaseBranch:f,mergeBaseBranchOptions:p,isLoadingMergeBaseBranchOptions:m,onMergeBaseBranchChange:v}),(0,q.jsx)(gv,{thread:t,environment:l,workspaceStatus:u,workspaceStatusError:d,selectedMergeBaseBranch:f}),(0,q.jsx)(_v,{thread:t}),(0,q.jsx)(vv,{thread:t,workspaceStatus:u,onChangedFileClick:y}),g?(0,q.jsx)(yv,{...g}):null]})}function Cv({children:e,className:t}){return(0,q.jsx)(`div`,{className:R(`flex min-w-0 flex-col gap-1`,t),children:e})}function wv({stopRequestedAt:e,threadId:t}){return{id:`${t}:pending-stop:${e}`,threadId:t,turnId:null,sourceSeqStart:0,sourceSeqEnd:0,startedAt:e,createdAt:e,kind:`system`,systemKind:`operation`,operationKind:`thread-interrupted`,title:`Stop requested`,detail:null,status:`pending`,completedAt:null}}function Tv(e,t){return e.some(e=>e.kind===`system`&&e.systemKind===`operation`&&e.operationKind===`thread-interrupted`&&e.createdAt>=t)}function Ev({rows:e,stopRequestedAt:t,threadId:n}){return(0,K.useMemo)(()=>t===null||Tv(e,t)?e:[...e,wv({stopRequestedAt:t,threadId:n})],[e,t,n])}function Dv({activeThinking:e,footer:t,hasOlderTimelineRows:n,header:r,hostConnectionNotice:i,isLoadingOlderTimelineRows:a,isThreadTimelinePending:o,timelineError:s,loadingTurnSummaryIds:c,erroredTurnSummaryIds:l,onLoadOlderRows:u,onLoadTurnSummaryRows:d,onOpenLocalFileLink:f,onTitleAction:p,projectId:m,showOngoingIndicator:h,ongoingIndicatorLabel:g,stopRequestedAt:_,timelineRows:v,threadId:y,threadRuntimeDisplayStatus:b,turnSummaryRowsIdentity:x,turnSummaryRowsById:S,unreadDividerPlacement:C,workspaceRootPath:w}){let T=vr(),E=e!==null&&g===void 0,D=e?.text.trim()??``,O=E&&D.length>0?e?.text:void 0,k=E&&e?e.id:g??`working`,A=Ev({rows:v,stopRequestedAt:_,threadId:y});return(0,q.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,children:[r,(0,q.jsx)(z,{scrollBehavior:`bottom-anchor`,shellClassName:`!mx-0 !mt-0 md:!mx-0 md:!mt-0`,contentClassName:`min-h-full gap-2 pt-4`,footerClassName:`chat-prompt-box`,footer:t,children:(0,q.jsxs)(Cv,{className:`flex-1`,children:[n&&!o&&!s?(0,q.jsx)(Ov,{isLoadingOlderTimelineRows:a,onLoadOlderRows:u}):null,o?(0,q.jsx)(kv,{}):s?(0,q.jsx)(qt,{label:`Failed to load timeline`,className:`mt-6 text-destructive`}):A.length>0?(0,q.jsx)(Rn,{loadingTurnSummaryIds:c,erroredTurnSummaryIds:l,onLoadTurnSummaryRows:d,onOpenLocalFileLink:f,onTitleAction:p,projectId:m,resolveUserAttachmentImageSrc:gn,themeType:T,timelineRows:A,threadRuntimeDisplayStatus:b,turnSummaryRowsIdentity:x,turnSummaryRowsById:S,unreadDividerPlacement:C,workspaceRootPath:w}):null,i?(0,q.jsx)(qt,{label:i.label,className:i.tone===`error`?`mt-4 text-destructive`:`mt-4`}):null,(0,q.jsx)(St,{visible:h,children:(0,q.jsx)(Et,{details:O,isThinking:E,label:g},k)})]})},y)]})}function Ov({isLoadingOlderTimelineRows:e,onLoadOlderRows:t}){let n=ie();return(0,q.jsx)(`div`,{className:`flex justify-center pt-2 mb-3`,children:(0,q.jsxs)(j,{type:`button`,variant:`outline`,size:`sm`,onClick:(0,K.useCallback)(()=>{n?.captureScrollAnchor(),t()},[n,t]),disabled:e,children:[(0,q.jsx)(L,{name:`ChevronUp`,"aria-hidden":`true`}),e?`Loading older messages...`:`Load older messages`]})})}function kv(){let[e,t]=(0,K.useState)(!1);return(0,K.useEffect)(()=>{let e=window.setTimeout(()=>t(!0),200);return()=>window.clearTimeout(e)},[]),e?(0,q.jsx)(qt,{label:`Loading thread...`,className:`mt-6`}):null}var Av=100,jv=`duration-[220ms] ease-[cubic-bezier(0.32,0.72,0,1)]`;function Mv({footer:e,header:t,isMetadataLoading:n,isSecondaryPanelOpen:r,metadata:i,onTerminalPanelResize:a,secondaryPanel:o,terminalPanel:s,terminalPanelHeightPercent:c,terminalPanelOpen:l,timeline:u}){let d=me(),f=dt(ca),p=(0,K.useRef)(null),m=(0,K.useRef)(c),h=(0,K.useRef)(!1);(0,K.useEffect)(()=>{if(!h.current){h.current=!0;return}let e=p.current;e&&(l?e.expand(m.current):e.collapse())},[l]);let g=(0,K.useCallback)(e=>{e<=0||(m.current=e,a(e))},[a]),_=bv(i)?(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:(0,q.jsx)(Sv,{...i})}):n?(0,q.jsx)(Fv,{}):(0,q.jsx)(`div`,{className:`pt-1 text-sm text-muted-foreground`,children:`No thread details available.`}),v=d?null:(0,q.jsx)(Xs,{...o,renderAsDrawer:!1,metadataContent:_}),y=d?(0,q.jsx)(Xs,{...o,renderAsDrawer:!0,metadataContent:_}):null;return(0,q.jsxs)(`div`,{className:`-mx-4 -mb-4 -mt-4 flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden md:-mx-5 md:-mb-5 md:-mt-5`,children:[(0,q.jsxs)(Bo.PanelGroup,{direction:`vertical`,className:`h-full w-full min-w-0`,children:[(0,q.jsx)(Bo.Panel,{id:`thread-detail-main-panel`,defaultSize:l?100-c:100,minSize:30,order:1,className:`min-w-0 overflow-hidden`,children:(0,q.jsxs)(Bo.PanelGroup,{direction:`horizontal`,className:`h-full w-full min-w-0`,children:[(0,q.jsx)(Bo.Panel,{id:`thread-detail-timeline-panel`,defaultSize:r&&!d?100-f:Av,minSize:30,order:1,className:`min-w-0 overflow-hidden`,children:(0,q.jsx)(Dv,{...u,footer:e,header:t})}),v]})}),s?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Nv,{isOpen:l}),(0,q.jsx)(Bo.Panel,{ref:p,id:`thread-detail-terminal-panel`,collapsible:!0,collapsedSize:0,defaultSize:l?c:0,minSize:18,maxSize:70,order:2,onResize:g,className:R(`min-h-0 min-w-0 overflow-hidden transition-[flex-grow,flex-basis,opacity]`,jv,l?`opacity-100`:`opacity-0`),children:s})]}):null]}),d?(0,q.jsx)(V,{open:r,onOpenChange:e=>{e||o.onClose()},srLabel:`Thread details`,contentClassName:`h-[92dvh] max-h-[92dvh]`,handleOnly:!0,children:(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:y})}):null]})}function Nv({isOpen:e}){return(0,q.jsx)(Bo.PanelResizeHandle,{id:`thread-detail-terminal-panel-handle`,disabled:!e,className:R(`group relative shrink-0 cursor-row-resize overflow-visible bg-transparent transition-[height,opacity,background-color]`,jv,`before:absolute before:-inset-y-1.5 before:inset-x-0 before:content-['']`,e?`h-px opacity-100`:`pointer-events-none h-0 opacity-0`),"aria-label":`Resize thread and terminal panels`,children:(0,q.jsx)(`span`,{className:`pointer-events-none absolute inset-x-0 top-1/2 h-px -translate-y-1/2 bg-border/70 transition-colors group-hover:bg-accent-foreground/35`})})}var Pv=[`w-40`,`w-28`,`w-36`,`w-24`];function Fv(){return(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:(0,q.jsx)(xv,{hasFlexibleHeight:!1,children:Pv.map((e,t)=>(0,q.jsxs)(`div`,{className:`grid grid-cols-[var(--detail-label-width,96px)_minmax(0,1fr)] items-center gap-x-3 py-0.5`,children:[(0,q.jsx)(sr,{className:`h-3 w-14 rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 ${e} max-w-full rounded-sm`})]},t))})})}function Iv(e){return e!==void 0&&e.length>0}function Lv({closePersistedPanel:e,isCompactViewport:t,isPersistedOpen:n,openPersistedDiffFile:r,openPersistedDiffPanel:i,openPersistedPanel:a,threadId:o,togglePersistedPanel:s}){let[c,l]=(0,K.useState)(null);(0,K.useEffect)(()=>{l(null)},[o]),(0,K.useEffect)(()=>{t||l(null)},[t]);let u=(0,K.useCallback)(()=>{Iv(o)&&l(o)},[o]),d=(0,K.useCallback)(()=>{l(e=>e===o?null:e)},[o]),f=Iv(o)&&c===o,p=t?f:n,m=(0,K.useCallback)(e=>{a(e),t&&u()},[t,u,a]),h=(0,K.useCallback)(()=>{i(),t&&u()},[t,u,i]),g=(0,K.useCallback)(e=>{r(e),t&&u()},[t,u,r]),_=(0,K.useCallback)(()=>{if(t){d();return}e()},[d,e,t]),v=(0,K.useCallback)(()=>{if(!t){s();return}if(f){d();return}u()},[d,t,f,u,s]);return(0,K.useMemo)(()=>({closePanel:_,isOpen:p,openDiffFile:g,openDiffPanel:h,openPanel:m,togglePanel:v}),[_,p,g,h,m,v])}function Rv({activePath:e,fileListEnabled:t=!0,fileListOptions:n=le,filePreviewEnabled:r=!0,threadId:i,threadType:a}){let o=a===`manager`,{data:s,isLoading:c,error:l}=Oe(i??``,n,{enabled:o&&t}),{data:u,isLoading:d,error:f}=De(i??``,e,{enabled:o&&r&&e!==null});return{isThreadStorageFilePreviewLoading:d,isThreadStorageFilesLoading:c,threadStorageFilePreview:u,threadStorageFilePreviewError:f,threadStorageFilesError:l,threadStorageFiles:s,threadStorageRootPath:s?.storageRootPath??null}}var zv=[];function Bv(e){let t=new Set;for(let n of e){let e=n.split(`/`).filter(e=>e.length>0),r=``;for(let n of e.slice(0,-1))r=`${r}${n}/`,t.add(r)}return Array.from(t)}function Vv({files:e,onSelectPath:t,selectedPath:n}){let[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(``),s=e??zv,c=(0,K.useMemo)(()=>{let e=a.trim().toLowerCase();return e.length===0?s:s.filter(t=>t.path.toLowerCase().includes(e))},[s,a]),l=(0,K.useMemo)(()=>c.map(e=>e.path),[c]),u=(0,K.useMemo)(()=>new Set(l),[l]),d=(0,K.useRef)(u),f=(0,K.useRef)(t),p=(0,K.useRef)(!1);(0,K.useEffect)(()=>{d.current=u},[u]),(0,K.useEffect)(()=>{f.current=t},[t]);let{model:m}=rv({density:`compact`,initialExpansion:`closed`,onSelectionChange:(0,K.useCallback)(e=>{if(p.current)return;let t=e[0];!t||!d.current.has(t)||f.current(t)},[]),paths:[],search:!1}),h=a.trim().length>0,g=(0,K.useMemo)(()=>h?Bv(l):[],[h,l]);(0,K.useEffect)(()=>{m.resetPaths(l,{initialExpandedPaths:g})},[g,l,m]),(0,K.useEffect)(()=>{let e=m.getSelectedPaths(),t=n!==null&&u.has(n);if(!(t?e.length===1&&e[0]===n:e.length===0)){p.current=!0;try{for(let r of e)t&&r===n||m.getItem(r)?.deselect();t&&m.getItem(n)?.select()}finally{p.current=!1}}},[u,m,n]);let _=(0,K.useCallback)(()=>{i(!0)},[]);return{closeSearch:(0,K.useCallback)(()=>{i(!1),o(``)},[]),filteredFiles:c,isSearchOpen:r,loadedFiles:s,model:m,openSearch:_,searchQuery:a,setSearchQuery:o}}var Hv=`bb.thread.fixedPanelTabsState`,Uv=336*60*60*1e3,Wv=`thread-info`,Gv=`git-diff`,Kv=e(`kind`,[S({kind:E(`working-tree`)}).strict(),S({kind:E(`head`)}).strict(),S({kind:E(`merge-base`),ref:r().min(1)}).strict()]),qv=E(`deleted`).nullable(),Jv=S({id:E(Wv),kind:E(`thread-info`)}).strict(),Yv=S({id:E(Gv),kind:E(`git-diff`)}).strict(),Xv=S({environmentId:r().min(1).nullable(),id:r().min(1),kind:E(`workspace-file-preview`),lineNumber:o().int().positive().nullable(),path:r().min(1),source:Kv,statusLabel:qv}).strict(),Zv=S({id:r().min(1),kind:E(`host-file-preview`),lineNumber:o().int().positive().nullable(),path:r().min(1)}).strict(),Qv=S({id:r().min(1),isPinned:v(),kind:E(`thread-storage-file-preview`),path:r().min(1)}).strict(),$v=S({id:r().min(1),kind:E(`terminal`),terminalId:r().min(1)}).strict(),ey=e(`kind`,[Jv,Yv,Xv,Zv,Qv]),ty=e(`kind`,[$v]),ny=S({tabs:p(ey),activeTabId:r().min(1).nullable(),isOpen:v()}).strict(),ry=S({tabs:p(ey),activeTabId:r().min(1).nullable()}).strict(),iy=S({tabs:p(ty),activeTabId:r().min(1).nullable()}).strict(),ay=S({version:E(1),secondary:ny,bottom:iy,lastUsedAt:o().int().nonnegative()}).strict(),oy=S({version:E(1),secondary:ry,bottom:iy,lastUsedAt:o().int().nonnegative()}).strict();function sy(){return typeof window>`u`?null:window.localStorage}function cy(e){return encodeURIComponent(e.trim())}function ly(e,t){return`${e}:${encodeURIComponent(t)}`}function uy(){return{id:Wv,kind:`thread-info`}}function dy(){return{id:Gv,kind:`git-diff`}}function fy({environmentId:e,tab:t}){return{environmentId:e,id:ly(`workspace-file-preview`,t.path),kind:`workspace-file-preview`,lineNumber:t.lineNumber,path:t.path,source:t.source,statusLabel:t.statusLabel}}function py(e){return{id:ly(`host-file-preview`,e.path),kind:`host-file-preview`,lineNumber:e.lineNumber,path:e.path}}function my({isPinned:e,path:t}){return{id:ly(`thread-storage-file-preview`,t),isPinned:e,kind:`thread-storage-file-preview`,path:t}}function hy({terminalId:e}){return{id:`terminal:${encodeURIComponent(e)}`,kind:`terminal`,terminalId:e}}function gy(e,t){return e===`bottom`?t.kind===`terminal`:t.kind!==`terminal`}function _y({group:e,region:t}){let n=new Set,r=[];for(let i of e.tabs)!gy(t,i)||n.has(i.id)||(n.add(i.id),r.push(i));return{tabs:r,activeTabId:e.activeTabId!==null&&n.has(e.activeTabId)?e.activeTabId:null}}function vy(e){return{..._y({group:e,region:`secondary`}),isOpen:e.isOpen}}function yy({state:e}){return{...e,secondary:vy(e.secondary),bottom:_y({group:e.bottom,region:`bottom`})}}function by(e={}){return yy({state:{version:1,secondary:e.secondary??{tabs:[],activeTabId:null,isOpen:!1},bottom:e.bottom??{tabs:[],activeTabId:null},lastUsedAt:e.lastUsedAt??0}})}var xy=by();function Sy({threadId:e}){return`${Hv}-${cy(e)}-1`}function Cy(e){return e.startsWith(`bb.thread.fixedPanelTabsState-`)&&e.endsWith(`-1`)}function wy({now:e,state:t}){return e-t.lastUsedAt>Uv}function Ty({initialValue:e,now:t,storedValue:n}){return Ey({initialValue:e,now:t,storedValue:n}).state}function Ey({initialValue:e,now:t,storedValue:n}){if(n===null)return{shouldPrune:!1,state:e};let r;try{r=JSON.parse(n)}catch{return{shouldPrune:!0,state:e}}let i=ay.safeParse(r);if(i.success){let n=yy({state:i.data});return wy({now:t,state:n})?{shouldPrune:!0,state:e}:{shouldPrune:!1,state:n}}let a=oy.safeParse(r);if(!a.success)return{shouldPrune:!0,state:e};let o=yy({state:{...a.data,secondary:{...a.data.secondary,isOpen:a.data.secondary.activeTabId!==null}}});return wy({now:t,state:o})?{shouldPrune:!0,state:e}:{shouldPrune:!1,state:o}}function Dy({state:e}){return JSON.stringify(yy({state:e}))}function Oy({now:e}){let t=sy();if(!t)return;let n=[];for(let e=0;e<t.length;e+=1){let r=t.key(e);r&&Cy(r)&&n.push(r)}for(let r of n)Ey({initialValue:xy,now:e,storedValue:t.getItem(r)}).shouldPrune&&t.removeItem(r)}function ky(e,t){if(e.id!==t.id||e.kind!==t.kind)return!1;switch(e.kind){case`thread-info`:case`git-diff`:return!0;case`workspace-file-preview`:return t.kind===`workspace-file-preview`&&e.environmentId===t.environmentId&&e.lineNumber===t.lineNumber&&e.path===t.path&&l(e.source,t.source)&&e.statusLabel===t.statusLabel;case`host-file-preview`:return t.kind===`host-file-preview`&&e.lineNumber===t.lineNumber&&e.path===t.path;case`thread-storage-file-preview`:return t.kind===`thread-storage-file-preview`&&e.isPinned===t.isPinned&&e.path===t.path;case`terminal`:return t.kind===`terminal`&&e.terminalId===t.terminalId}}var Ay=`secondaryPanel`,jy=`git-diff`,My=`thread-info`;function Ny(e){switch(e){case jy:return`git-diff`;case My:return`thread-info`;default:return null}}function Py(e){return Ny(new URLSearchParams(e).get(Ay))}function Fy(e,t){let n=new URLSearchParams(e);return t?n.set(Ay,t):n.delete(Ay),n.toString()}var Iy=60*1e3;function Ly(e){return e!=null&&e.length>0}function Ry(e,t){return{...e,lastUsedAt:t}}var zy=tt({parse:(e,t)=>Ty({initialValue:t,now:Date.now(),storedValue:e}),serialize:e=>Dy({state:e})}),By=nt(xy),Vy=Ze(e=>G(Sy({threadId:e}),xy,zy,{getOnInit:!0}));function Hy(e){return Ly(e)?Vy(e):By}function Uy(e){switch(e){case`thread-info`:return uy().id;case`git-diff`:return dy().id}}function Wy(e){switch(e){case`thread-info`:return uy();case`git-diff`:return dy()}}function Gy(e){let t=e.bottom.activeTabId;if(t===null)return null;let n=e.bottom.tabs.find(e=>e.id===t);return n?.kind===`terminal`?n:null}function Ky(e,t){let n=hy({terminalId:t});return e.find(e=>e.id===n.id)?e:[...e,n]}function qy(e,t){let n=hy({terminalId:t}),r=e.filter(e=>e.id!==n.id);return r.length===e.length?e:r}function Jy(e,t){let n=Uy(t);return e.some(e=>e.id===n)?e:[...e,Wy(t)]}function Yy(e,t){return t!==null&&e.some(e=>e.id===t)}function Xy(e){if(Yy(e.secondary.tabs,e.secondary.activeTabId))return e.secondary.isOpen?e:{...e,secondary:{...e.secondary,isOpen:!0}};let t=`thread-info`,n=Jy(e.secondary.tabs,t),r=Uy(t);return{...e,secondary:{tabs:n,activeTabId:r,isOpen:!0}}}function Zy(e){return e.secondary.isOpen?{...e,secondary:{...e.secondary,isOpen:!1}}:e}function Qy(e){(0,K.useEffect)(()=>{Oy({now:Date.now()})},[e])}function $y(e){return dt(Hy(e))}function eb(e){let t=rt(Hy(e));return(0,K.useCallback)(n=>{if(!Ly(e))return;let r=Date.now();t(e=>{let t=n(e);return t===e?e:Ry(t,r)})},[t,e])}function tb(e){let t=eb(e),n=(0,K.useRef)(null);return(0,K.useCallback)(()=>{let r=Date.now();n.current!==null&&n.current.threadId===e&&r-n.current.touchedAt<Iy||(n.current={threadId:e,touchedAt:r},t(e=>!e.secondary.isOpen&&e.secondary.tabs.length===0&&e.bottom.tabs.length===0||r-e.lastUsedAt<Iy?e:{...e}))},[e,t])}function nb(e){let t=eb(e);return(0,K.useCallback)(e=>{t(t=>{let n=Jy(t.secondary.tabs,e),r=Uy(e);return n===t.secondary.tabs&&t.secondary.activeTabId===r&&t.secondary.isOpen?t:{...t,secondary:{tabs:n,activeTabId:r,isOpen:!0}}})},[t])}function rb(e){let t=eb(e);return(0,K.useCallback)(()=>{t(Zy)},[t])}function ib(e){let t=eb(e);return(0,K.useCallback)(()=>{t(e=>e.secondary.isOpen?Zy(e):Xy(e))},[t])}function ab(e,t){let n=Ge(),r=He();(0,K.useEffect)(()=>{if(!Ly(e))return;let i=Py(n.search);if(i===null)return;t(i);let a=Fy(n.search,null);r({pathname:n.pathname,search:a.length>0?`?${a}`:``},{replace:!0})},[n.pathname,n.search,r,t,e])}function ob(e){return Gy($y(e))?.terminalId??null}function sb(e){let t=eb(e);return(0,K.useCallback)(e=>{t(t=>{if(e===null)return t.bottom.activeTabId===null?t:{...t,bottom:{...t.bottom,activeTabId:null}};let n=Ky(t.bottom.tabs,e),r=hy({terminalId:e}).id;return n===t.bottom.tabs&&t.bottom.activeTabId===r?t:{...t,bottom:{tabs:n,activeTabId:r}}})},[t])}function cb(e){let t=eb(e);return(0,K.useCallback)(e=>{t(t=>{let n=qy(t.bottom.tabs,e);if(n===t.bottom.tabs)return t;let r=t.bottom.activeTabId===hy({terminalId:e}).id;return{...t,bottom:{tabs:n,activeTabId:r?null:t.bottom.activeTabId}}})},[t])}function lb(e){return e.kind===`workspace-file-preview`}function ub(e){return e.kind===`host-file-preview`}function db(e){return e.kind===`thread-storage-file-preview`}function fb(e,t){return lb(e)&&e.environmentId===t}function pb(e){let t=e.secondary.activeTabId;return t===null?null:e.secondary.tabs.find(e=>e.id===t)??null}function mb({activeTabId:e,isOpen:t,state:n,tabs:r}){return r===n.secondary.tabs&&e===n.secondary.activeTabId&&t===n.secondary.isOpen?n:{...n,secondary:{tabs:r,activeTabId:e,isOpen:t}}}function hb(e,t){let n=e.filter(e=>!db(e)||e.path===t||!Ns(e.path));return n.length===e.length?e:n}function gb(e,t){let n=e.findIndex(e=>e.id===t.id);if(n===-1)return[...e,t];let r=e[n];return r&&ky(r,t)?e:e.map(e=>e.id===t.id?t:e)}function _b(e,t){let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function vb(e,t){let n=e.filter(e=>!lb(e)||e.environmentId===t);return n.length===e.length?e:n}function yb(e){let t=e.filter(e=>!db(e));return t.length===e.length?e:t}function bb(e,t){let n=e.filter(e=>!db(e)||t.has(e.path));return n.length===e.length?e:n}function xb(e,t){return t!==null&&e.some(e=>e.id===t)}function Sb(e,t){return my({isPinned:e===t,path:e})}function Cb(e,t){return Eb(e,t)?.id??Sb(t,t).id}function wb(e,t){for(let n of e)if(lb(n)&&n.path===t)return n;return null}function Tb(e,t){for(let n of e)if(ub(n)&&n.path===t)return n;return null}function Eb(e,t){for(let n of e)if(db(n)&&n.path===t)return n;return null}function Db(e){return{lineNumber:e.lineNumber,path:e.path,source:e.source,statusLabel:e.statusLabel}}function Ob(e){return{lineNumber:e.lineNumber,path:e.path}}function kb(e){let t=e.filter(e=>e.isPinned),n=e.filter(e=>!e.isPinned);return[...t,...n]}function Ab({threadId:e,environmentId:t,threadType:n,storageFiles:r}){let i=$y(e),a=eb(e),o=n!==void 0,s=n===`manager`,c=Ps(r),u=o?t??null:void 0;(0,K.useEffect)(()=>{u!==void 0&&a(e=>{let t=vb(e.secondary.tabs,u);return mb({activeTabId:xb(t,e.secondary.activeTabId)?e.secondary.activeTabId:null,isOpen:e.secondary.isOpen,state:e,tabs:t})})},[u,a]),(0,K.useEffect)(()=>{o&&(s||a(e=>{let t=yb(e.secondary.tabs);return mb({activeTabId:xb(t,e.secondary.activeTabId)?e.secondary.activeTabId:null,isOpen:e.secondary.isOpen,state:e,tabs:t})}))},[s,o,a]);let d=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!s){d.current=null;return}let e=d.current!==c;d.current=c,a(t=>{let n=Sb(c,c),r=gb(e?hb(t.secondary.tabs,c):t.secondary.tabs,n);return mb({activeTabId:xb(r,t.secondary.activeTabId)?t.secondary.activeTabId:n.id,isOpen:t.secondary.isOpen,state:t,tabs:r})})},[i.secondary.activeTabId,s,c,a]),(0,K.useEffect)(()=>{!o||!r||s&&a(e=>{let t=new Set([c,...r.map(e=>e.path)]),n=bb(e.secondary.tabs,t);return mb({activeTabId:xb(n,e.secondary.activeTabId)?e.secondary.activeTabId:Cb(n,c),isOpen:e.secondary.isOpen,state:e,tabs:n})})},[s,o,c,r,a]);let f=(0,K.useCallback)(({lineNumber:e,path:t,source:n,statusLabel:r})=>{if(u===void 0)return;let i=fy({environmentId:u,tab:{lineNumber:e,path:t,source:n,statusLabel:r}});a(a=>{let o=wb(a.secondary.tabs,t),s=gb(a.secondary.tabs,i);return o&&o.environmentId===u&&o.lineNumber===e&&l(o.source,n)&&o.statusLabel===r&&a.secondary.activeTabId===i.id&&a.secondary.isOpen?a:mb({activeTabId:i.id,isOpen:!0,state:a,tabs:s})})},[u,a]),p=(0,K.useCallback)(e=>{a(t=>{let n=wb(t.secondary.tabs,e);if(!n)return t;let r=_b(t.secondary.tabs,n.id);return mb({activeTabId:t.secondary.activeTabId===n.id?null:t.secondary.activeTabId,isOpen:t.secondary.isOpen,state:t,tabs:r})})},[a]),m=(0,K.useCallback)(e=>{a(t=>{let n=wb(t.secondary.tabs,e);return!n||t.secondary.activeTabId===n.id&&t.secondary.isOpen?t:mb({activeTabId:n.id,isOpen:!0,state:t,tabs:t.secondary.tabs})})},[a]),h=(0,K.useCallback)(e=>{if(!s)return;let t=Sb(e,c);a(e=>{let n=gb(e.secondary.tabs,t);return n===e.secondary.tabs&&e.secondary.activeTabId===t.id&&e.secondary.isOpen?e:mb({activeTabId:t.id,isOpen:!0,state:e,tabs:n})})},[s,c,a]),g=(0,K.useCallback)(({lineNumber:t,path:n})=>{if(!e)return;let r=py({lineNumber:t,path:n});a(e=>{let i=Tb(e.secondary.tabs,n),a=gb(e.secondary.tabs,r);return i&&i.lineNumber===t&&e.secondary.activeTabId===r.id&&e.secondary.isOpen?e:mb({activeTabId:r.id,isOpen:!0,state:e,tabs:a})})},[e,a]),_=(0,K.useCallback)(e=>{a(t=>{let n=Tb(t.secondary.tabs,e);if(!n)return t;let r=_b(t.secondary.tabs,n.id);return mb({activeTabId:t.secondary.activeTabId===n.id?null:t.secondary.activeTabId,isOpen:t.secondary.isOpen,state:t,tabs:r})})},[a]),v=(0,K.useCallback)(e=>{a(t=>{let n=Tb(t.secondary.tabs,e);return!n||t.secondary.activeTabId===n.id&&t.secondary.isOpen?t:mb({activeTabId:n.id,isOpen:!0,state:t,tabs:t.secondary.tabs})})},[a]),y=(0,K.useCallback)(e=>{!s||e===c||a(t=>{let n=Eb(t.secondary.tabs,e);if(!n)return t;let r=_b(t.secondary.tabs,n.id);return mb({activeTabId:t.secondary.activeTabId===n.id?null:t.secondary.activeTabId,isOpen:t.secondary.isOpen,state:t,tabs:r})})},[s,c,a]),b=(0,K.useCallback)(e=>{s&&a(t=>{let n=Eb(t.secondary.tabs,e);return!n||t.secondary.activeTabId===n.id&&t.secondary.isOpen?t:mb({activeTabId:n.id,isOpen:!0,state:t,tabs:t.secondary.tabs})})},[s,a]),x=(0,K.useCallback)(()=>{a(e=>{let t=pb(e);return!t||t.kind!==`workspace-file-preview`&&t.kind!==`host-file-preview`&&t.kind!==`thread-storage-file-preview`?e:mb({activeTabId:null,isOpen:e.secondary.isOpen,state:e,tabs:e.secondary.tabs})})},[a]),S=pb(i),C=u===void 0?[]:i.secondary.tabs.filter(e=>fb(e,u)),w=S?.kind===`workspace-file-preview`&&S.environmentId===u?S:null,T=s&&S?.kind===`thread-storage-file-preview`?S:null,E=S?.kind===`host-file-preview`?S:null,D=s?kb(i.secondary.tabs.filter(db)):[];return{activateHostFileTab:v,activateStorageFileTab:b,activateWorkspaceFileTab:m,activeHostFileLineNumber:E?.lineNumber??null,activeHostFilePath:E?.path??null,activeStorageFilePath:T?.path??null,activeWorkspaceFileLineNumber:w?.lineNumber??null,activeWorkspaceFilePath:w?.path??null,activeWorkspaceFileSource:w?.source??null,activeWorkspaceFileStatusLabel:w?.statusLabel??null,clearActiveFileTabs:x,closeHostFileTab:_,closeStorageFileTab:y,closeWorkspaceFileTab:p,openHostFile:g,openHostFileTabs:i.secondary.tabs.filter(ub).map(Ob),openStorageFile:h,openStorageFilePaths:D.map(e=>e.path),openWorkspaceFile:f,openWorkspaceFileTabs:C.map(Db),pinnedStorageFilePath:c}}function jb(e){return e??void 0}function Mb({previousStateKey:e,nextStateKey:t,persistedMergeBaseBranch:n,selectedMergeBaseBranch:r,updatePending:i}){return e===t?i?!1:r!==jb(n):!0}function Nb({environment:e,workspaceStatus:t}){return e?.baseBranch??t?.branch.defaultBranch??e?.defaultBranch??void 0}function Pb({environment:e,selectedMergeBaseBranch:t,workspaceStatus:n}){return t??e?.mergeBaseBranch??e?.baseBranch??n?.mergeBase?.mergeBaseBranch??n?.branch.defaultBranch??se(e)}function Fb({branch:e,environment:t,workspaceStatus:n}){let r=e.trim();return r.length===0||r===Nb({environment:t,workspaceStatus:n})?null:r}function Ib({environment:e,mergeBaseBranchOptions:t,selectedMergeBaseBranch:n,setSelectedMergeBaseBranch:r,thread:i,updateEnvironment:a,workspaceStatus:o}){let s=(0,K.useRef)(void 0),c=e?.id??i?.id,l=a.isPending&&a.variables?.id===e?.id;(0,K.useEffect)(()=>{Mb({previousStateKey:s.current,nextStateKey:c,persistedMergeBaseBranch:e?.mergeBaseBranch,selectedMergeBaseBranch:n,updatePending:l})&&(s.current=c,r(jb(e?.mergeBaseBranch)))},[e?.mergeBaseBranch,l,c,n,r]);let u=Pb({environment:e,selectedMergeBaseBranch:n,workspaceStatus:o}),d=!!(u||o?.branch.defaultBranch),f=u,p=(0,K.useMemo)(()=>Un({mergeBaseBranch:f,mergeBaseBranchOptions:t}),[f,t]),m=o?.branch.currentBranch!=null&&o.branch.currentBranch===o.branch.defaultBranch,h=d&&!!f&&!m;return{canSelectMergeBase:!!(h&&f&&p.length>0),effectiveMergeBaseBranch:u,handleMergeBaseBranchChange:(0,K.useCallback)(t=>{if(!e||!i?.environmentId)return;let n=t.trim(),s=Fb({branch:n,environment:e,workspaceStatus:o}),c=e.mergeBaseBranch;r(n),s!==c&&a.mutate({id:e.id,mergeBaseBranch:s},{onError:t=>{r(e.mergeBaseBranch??void 0),hn.error(pn({error:t,fallbackMessage:`Failed to update merge base branch.`}))}})},[e,r,i?.environmentId,a,o]),showBranchComparisonUi:d,showMergeBase:h,mergeBaseBranch:f,mergeBaseCandidates:p}}var Lb=a((e=>{e.__esModule=!0,e.extend=a,e.indexOf=l,e.escapeExpression=u,e.isEmpty=d,e.createFrame=f,e.blockParams=p,e.appendContextPath=m;var t={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#x27;`,"`":`&#x60;`,"=":`&#x3D;`},n=/[&<>"'`=]/g,r=/[&<>"'`=]/;function i(e){return t[e]}function a(e){for(var t=1;t<arguments.length;t++)for(var n in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],n)&&(e[n]=arguments[t][n]);return e}var o=Object.prototype.toString;e.toString=o;var s=function(e){return typeof e==`function`};s(/x/)&&(e.isFunction=s=function(e){return typeof e==`function`&&o.call(e)===`[object Function]`}),e.isFunction=s;var c=Array.isArray||function(e){return e&&typeof e==`object`?o.call(e)===`[object Array]`:!1};e.isArray=c;function l(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function u(e){if(typeof e!=`string`){if(e&&e.toHTML)return e.toHTML();if(e==null)return``;if(!e)return e+``;e=``+e}return r.test(e)?e.replace(n,i):e}function d(e){return!e&&e!==0?!0:!!(c(e)&&e.length===0)}function f(e){var t=a({},e);return t._parent=e,t}function p(e,t){return e.path=t,e}function m(e,t){return(e?e+`.`:``)+t}})),Rb=a(((e,t)=>{e.__esModule=!0;var n=[`description`,`fileName`,`lineNumber`,`endLineNumber`,`message`,`name`,`number`,`stack`];function r(e,t){var i=t&&t.loc,a=void 0,o=void 0,s=void 0,c=void 0;i&&(a=i.start.line,o=i.end.line,s=i.start.column,c=i.end.column,e+=` - `+a+`:`+s);for(var l=Error.prototype.constructor.call(this,e),u=0;u<n.length;u++)this[n[u]]=l[n[u]];Error.captureStackTrace&&Error.captureStackTrace(this,r);try{i&&(this.lineNumber=a,this.endLineNumber=o,Object.defineProperty?(Object.defineProperty(this,`column`,{value:s,enumerable:!0}),Object.defineProperty(this,`endColumn`,{value:c,enumerable:!0})):(this.column=s,this.endColumn=c))}catch{}}r.prototype=Error(),e.default=r,t.exports=e.default})),zb=a(((e,t)=>{e.__esModule=!0;var n=Lb();e.default=function(e){e.registerHelper(`blockHelperMissing`,function(t,r){var i=r.inverse,a=r.fn;if(t===!0)return a(this);if(t===!1||t==null)return i(this);if(n.isArray(t))return t.length>0?(r.ids&&=[r.name],e.helpers.each(t,r)):i(this);if(r.data&&r.ids){var o=n.createFrame(r.data);o.contextPath=n.appendContextPath(r.data.contextPath,r.name),r={data:o}}return a(t,r)})},t.exports=e.default})),Bb=a(((e,t)=>{e.__esModule=!0;function n(e){return e&&e.__esModule?e:{default:e}}var r=Lb(),i=n(Rb());e.default=function(e){e.registerHelper(`each`,function(e,t){if(!t)throw new i.default(`Must pass iterator to #each`);var n=t.fn,a=t.inverse,o=0,s=``,c=void 0,l=void 0;t.data&&t.ids&&(l=r.appendContextPath(t.data.contextPath,t.ids[0])+`.`),r.isFunction(e)&&(e=e.call(this)),t.data&&(c=r.createFrame(t.data));function u(t,i,a){c&&(c.key=t,c.index=i,c.first=i===0,c.last=!!a,l&&(c.contextPath=l+t)),s+=n(e[t],{data:c,blockParams:r.blockParams([e[t],t],[l+t,null])})}if(e&&typeof e==`object`)if(r.isArray(e))for(var d=e.length;o<d;o++)o in e&&u(o,o,o===e.length-1);else if(typeof Symbol==`function`&&e[Symbol.iterator]){for(var f=[],p=e[Symbol.iterator](),m=p.next();!m.done;m=p.next())f.push(m.value);e=f;for(var d=e.length;o<d;o++)u(o,o,o===e.length-1)}else (function(){var t=void 0;Object.keys(e).forEach(function(e){t!==void 0&&u(t,o-1),t=e,o++}),t!==void 0&&u(t,o-1,!0)})();return o===0&&(s=a(this)),s})},t.exports=e.default})),Vb=a(((e,t)=>{e.__esModule=!0;function n(e){return e&&e.__esModule?e:{default:e}}var r=n(Rb());e.default=function(e){e.registerHelper(`helperMissing`,function(){if(arguments.length!==1)throw new r.default(`Missing helper: "`+arguments[arguments.length-1].name+`"`)})},t.exports=e.default})),Hb=a(((e,t)=>{e.__esModule=!0;function n(e){return e&&e.__esModule?e:{default:e}}var r=Lb(),i=n(Rb());e.default=function(e){e.registerHelper(`if`,function(e,t){if(arguments.length!=2)throw new i.default(`#if requires exactly one argument`);return r.isFunction(e)&&(e=e.call(this)),!t.hash.includeZero&&!e||r.isEmpty(e)?t.inverse(this):t.fn(this)}),e.registerHelper(`unless`,function(t,n){if(arguments.length!=2)throw new i.default(`#unless requires exactly one argument`);return e.helpers.if.call(this,t,{fn:n.inverse,inverse:n.fn,hash:n.hash})})},t.exports=e.default})),Ub=a(((e,t)=>{e.__esModule=!0,e.default=function(e){e.registerHelper(`log`,function(){for(var t=[void 0],n=arguments[arguments.length-1],r=0;r<arguments.length-1;r++)t.push(arguments[r]);var i=1;n.hash.level==null?n.data&&n.data.level!=null&&(i=n.data.level):i=n.hash.level,t[0]=i,e.log.apply(e,t)})},t.exports=e.default})),Wb=a(((e,t)=>{e.__esModule=!0,e.default=function(e){e.registerHelper(`lookup`,function(e,t,n){return e&&n.lookupProperty(e,t)})},t.exports=e.default})),Gb=a(((e,t)=>{e.__esModule=!0;function n(e){return e&&e.__esModule?e:{default:e}}var r=Lb(),i=n(Rb());e.default=function(e){e.registerHelper(`with`,function(e,t){if(arguments.length!=2)throw new i.default(`#with requires exactly one argument`);r.isFunction(e)&&(e=e.call(this));var n=t.fn;if(r.isEmpty(e))return t.inverse(this);var a=t.data;return t.data&&t.ids&&(a=r.createFrame(t.data),a.contextPath=r.appendContextPath(t.data.contextPath,t.ids[0])),n(e,{data:a,blockParams:r.blockParams([e],[a&&a.contextPath])})})},t.exports=e.default})),Kb=a((e=>{e.__esModule=!0,e.registerDefaultHelpers=l,e.moveHelperToHooks=u;function t(e){return e&&e.__esModule?e:{default:e}}var n=t(zb()),r=t(Bb()),i=t(Vb()),a=t(Hb()),o=t(Ub()),s=t(Wb()),c=t(Gb());function l(e){n.default(e),r.default(e),i.default(e),a.default(e),o.default(e),s.default(e),c.default(e)}function u(e,t,n){e.helpers[t]&&(e.hooks[t]=e.helpers[t],n||delete e.helpers[t])}})),qb=a(((e,t)=>{e.__esModule=!0;var n=Lb();e.default=function(e){e.registerDecorator(`inline`,function(e,t,r,i){var a=e;return t.partials||(t.partials={},a=function(i,a){var o=r.partials;r.partials=n.extend({},o,t.partials);var s=e(i,a);return r.partials=o,s}),t.partials[i.args[0]]=i.fn,a})},t.exports=e.default})),Jb=a((e=>{e.__esModule=!0,e.registerDefaultDecorators=r;function t(e){return e&&e.__esModule?e:{default:e}}var n=t(qb());function r(e){n.default(e)}})),Yb=a(((e,t)=>{e.__esModule=!0;var n=Lb(),r={methodMap:[`debug`,`info`,`warn`,`error`],level:`info`,lookupLevel:function(e){if(typeof e==`string`){var t=n.indexOf(r.methodMap,e.toLowerCase());e=t>=0?t:parseInt(e,10)}return e},log:function(e){if(e=r.lookupLevel(e),typeof console<`u`&&r.lookupLevel(r.level)<=e){var t=r.methodMap[e];console[t]||(t=`log`);var n=[...arguments].slice(1);console[t].apply(console,n)}}};e.default=r,t.exports=e.default})),Xb=a((e=>{e.__esModule=!0,e.createNewLookupObject=n;var t=Lb();function n(){var e=[...arguments];return t.extend.apply(void 0,[Object.create(null)].concat(e))}})),Zb=a((e=>{e.__esModule=!0,e.createProtoAccessControl=a,e.resultIsAllowed=o,e.resetLoggedProperties=l;function t(e){return e&&e.__esModule?e:{default:e}}var n=Xb(),r=t(Yb()),i=Object.create(null);function a(e){var t=Object.create(null);t.constructor=!1,t.__defineGetter__=!1,t.__defineSetter__=!1,t.__lookupGetter__=!1;var r=Object.create(null);return r.__proto__=!1,{properties:{whitelist:n.createNewLookupObject(r,e.allowedProtoProperties),defaultValue:e.allowProtoPropertiesByDefault},methods:{whitelist:n.createNewLookupObject(t,e.allowedProtoMethods),defaultValue:e.allowProtoMethodsByDefault}}}function o(e,t,n){return s(typeof e==`function`?t.methods:t.properties,n)}function s(e,t){return e.whitelist[t]===void 0?e.defaultValue===void 0?(c(t),!1):e.defaultValue:e.whitelist[t]===!0}function c(e){i[e]!==!0&&(i[e]=!0,r.default.log(`error`,`Handlebars: Access has been denied to resolve the property "`+e+`" because it is not an "own property" of its parent.
1815
+ }`}var Pl=new WeakMap;function Fl(e){let t=Pl.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(nc,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),Pl.set(e,i),i}function Il(e,t){if(!e.isConnected)return;let n=Fl(t);if(n==null)return;let r=t.querySelector(`style[${rc}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(rc,``),t.appendChild(i)),i.textContent=`:host { ${ic}: ${n}px; }`}var Ll;function Rl(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){Ll??(Ll=new CSSStyleSheet,Ll.replaceSync(Ml(Al)));let t=!1;try{e.adoptedStyleSheets=[Ll],t=!0}catch{}if(t){e.querySelector(`style[${ec}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(ec,``),t.textContent=Ml(Al),e.prepend(t)}}function zl(e,t){Bl(e,t),Rl(t),Il(e,t)}function Bl(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});zl(this,e)}}if(customElements.define($s,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll($s)))e instanceof HTMLElement&&zl(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var Vl=5,Hl=1<<Vl,Ul=Hl*4;function Wl(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Gl(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Kl(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function ql(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function Jl(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function Yl(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function Xl(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,eu(e,t)}function Zl(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=ql(e).get(t);if(i===void 0)return;let a=i>>Vl;e.childVisibleChunkSums[a]+=r}function Ql(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=tu(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=Hl}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function $l(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>Vl;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<Vl}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function eu(e,t){if(t.childIds.length<Ul){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/Hl),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>Vl]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function tu(e,t,n,r){let i=Math.min(t.childIds.length,n+Hl),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var nu=7,ru=3,iu=1<<ru,au=4;function ou(e,t,n=0){return e<<au|n<<ru|t}function su(e){return e.depthAndFlags>>>au}function cu(e){return(e.depthAndFlags&iu)>>ru}function J(e){return(e.depthAndFlags&iu)!==0}function lu(e){return e.depthAndFlags&nu}function uu(e,t){return(lu(e)&t)!==0}function du(e,t){e.depthAndFlags|=t}function fu(e,t){e.depthAndFlags=ou(t,lu(e),cu(e))}var pu=Symbol(`benchmarkInstrumentation`);function mu(e,t){return t==null||Object.defineProperty(e,pu,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function hu(e){return e==null?null:e[pu]??null}function Y(e,t,n){return e==null?n():e.measurePhase(t,n)}function gu(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function _u(e){return e>=48&&e<=57}function vu(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!_u(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&_u(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function yu(e){let t=e.toLowerCase();return{lowerValue:t,tokens:vu(t)}}function bu(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function xu(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=bu(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function Su(e,t,n){let r=xu(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function Cu(e,t){return Su(e,t,yu)}function wu(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function Tu(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=wu(e,r);return a===wu(t,r)?Cu(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function Eu(e,t){return Tu(e,t)}function Du(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=yu(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=wu(e,n);return o===wu(t,n)?Su(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function Ou(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=yu(r);return e.sortKeyById[t]=i,i}function ku(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function Au(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function ju(e){let{hasTrailingSlash:t,segments:n}=Au(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function Mu(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=Au(e);return{requiresDirectory:t,segments:n}}var Nu=``;function Pu(){let e=new Map;return e.set(Nu,0),{idByValue:e,valueById:[Nu],sortKeyById:[yu(Nu)]}}function Fu(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function Iu(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var Lu=Symbol(`pathStorePreparedInputKind`);function Ru(e,t){return e[Lu]=t,e}function zu(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function Bu(e,t,n){return n===`default`?Eu(e,t):n(zu(e),zu(t))}function Vu(){return{depthAndFlags:ou(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function Hu(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function Uu(e){return e.isDirectory?e.segments.length:e.segments.length-1}function Wu(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function Gu(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function Ku(e,t={}){return Qu(e,t).map(e=>e.path)}function qu(e,t={}){let n=Qu(e,t);return Ru({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function Ju(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return Ru({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function Yu(e){let t=e,n=t.preparedPaths;if(t[Lu]===`prepared`&&n!=null)return n;if(!Wu(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function Xu(e){let t=e;return t[Lu]===`presorted`&&t.presortedPaths!=null||Gu(t.presortedPaths)?t.presortedPaths:null}function Zu(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function Qu(e,t={}){let n=ku(t),r=hu(t);gu(r,`workload.inputFiles`,e.length);let i=Y(r,`store.preparePathEntries.parse`,()=>e.map(e=>ju(e)));return Y(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>Bu(e,t,n.sort))),i}var $u=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[Vu()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=Pu();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=hu(e),this.options=ku(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,Wl())}appendPaths(e){return Y(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>ju(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,Y(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return Y(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:ou(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:ou(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:ou(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=ju(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:ou(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:ou(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=ju(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(Y(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||Y(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort===`default`?Du(this.lastPreparedPath,e,this.segmentSortKeyCache):Bu(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=Uu(e),i=n==null?0:Uu(n),a=n==null?0:Hu(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=Fu(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:ou(su(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),Jl(i,s),s}createFileChildUnchecked(e,t){let n=Fu(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:ou(su(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Jl(r,a),a}getOrCreateDirectoryChild(e,t){let n=Fu(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!J(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:ou(su(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Jl(r,a),this.directories.set(a,Wl()),a}createDirectoryChild(e,t){let n=Fu(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:ou(su(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),Jl(r,a),this.directories.set(a,Wl()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!J(n))throw Error(`Path is not a directory: "${t}"`);if(uu(n,1))throw Error(`Duplicate path: "${t}"`);du(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,Gl());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(J(a)){let t=Gl();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;J(n)&&this.directories.set(t,Wl());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),Jl(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!J(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return Xl(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function ed(e,t=`closed`,n=null){let r=nd(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function td(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function nd(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function rd(e,t){return uu(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:su(t)<=e.defaultExpansion}function id(e,t,n=e.snapshot.nodes[t]){return n==null||!J(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:rd(e,n)}function ad(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!J(r))return;let i=rd(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function od(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function sd(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function cd(e,t){let n=od(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function ld(e,t){let n=od(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function ud(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function dd(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function fd(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function pd(e,t){e.directoryLoadInfoById.delete(t)}function md(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function hd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function gd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function _d(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function vd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function yd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function bd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function xd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function Sd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function Cd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function wd(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function Td(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function Ed(e,t,n){return{...n,visibleCountDelta:Ld(e)-t}}function Dd(e,t){let n=Ld(e),r=td();e.transactionStack.push(r);try{t()}catch(t){throw Ad(e,r,!1),t}Ad(e,r,!0,Ld(e)-n)}function Od(e,t){let n=e.instrumentation;if(n==null){kd(e,t);return}Y(n,`store.events.record`,()=>kd(e,t))}function kd(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){Fd(e,t);return}n.events.push(t),Pd(n,t)}function Ad(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?Nd(i,t):Y(n,`store.events.batch.merge`,()=>Nd(i,t));return}let a=jd(t,r),o=e.instrumentation;if(o==null){Fd(e,a);return}Y(o,`store.events.batch.commit`,()=>Fd(e,a))}function jd(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function Md(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function Nd(e,t){for(let n of t.events)e.events.push(n);Md(e,t)}function Pd(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function Fd(e,t){let n=e.instrumentation;if(n==null){Id(e,t);return}Y(n,`store.events.emit`,()=>Id(e,t))}function Id(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function Ld(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function Rd(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!J(n)||uu(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!J(a)?null:i}function zd(e,t){let n=t;for(;;){let t=Rd(e,n);if(t==null)return n;n=t}}function Bd(e,t){let n=[t],r=t;for(;;){let t=Rd(e,r);if(t==null)return n;n.push(t),r=t}}function Vd(e,t){let n=t==null?e.snapshot.rootId:Zd(e,t);return n==null?[]:ef(e,n)}function Hd(e,t){let n=ju(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=gf(e,hf(e,r)),{createdNodeIds:a,directoryId:o}=tf(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=X(e,o);if(uu(n,1))throw Error(`Path already exists: "${t}"`);du(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=rf(e,o,n.basename),s.add(c);Jd(e,o);let l=gf(e,o);return hd({affectedAncestorIds:Xd(e,c),affectedNodeIds:[...s],path:t,projectionChanged:_f(i,l)})}function Ud(e,t,n){let r=Zd(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=X(e,r);if(uu(i,2))throw Error(`The root node cannot be removed`);if(J(i)&&$d(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=gf(e,a),s=pf(e,r);sf(e,a,r,i.nameId),mf(e,a),Jd(e,a);let c=gf(e,a);return gd({affectedAncestorIds:Xd(e,a),affectedNodeIds:s,path:t,projectionChanged:_f(o,c),recursive:n.recursive===!0})}function Wd(e,t,n,r){let i=Zd(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=X(e,i);if(uu(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=df(e,i,n),c=gf(e,a.parentId),l=gf(e,s.parentId),u=Iu(e.snapshot.segmentTable,a.nameId),d=Fu(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(J(a)&&xf(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=Kl(e.snapshot.nodes,$d(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&ff(e,p,o,cu(a))===`skip`)return null;let m=a.parentId;sf(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),bf(e,i),of(e,s.parentId,i),mf(e,m),e.pathCacheVersion++,Jd(e,m),s.parentId!==m&&Jd(e,s.parentId);let h=gf(e,m),g=gf(e,s.parentId);return _d({affectedAncestorIds:[...new Set([...Xd(e,m),...Xd(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:vf([c,l],[h,g]),to:qd(e,i)})}function Gd(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function Kd(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function qd(e,t){let n=X(e,t),r=Gd(e,t);if(r!=null)return r;if(uu(n,2))return Kd(e,t,``);let i=qd(e,n.parentId),a=Iu(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return Kd(e,t,J(n)?`${o}/`:o)}function Jd(e,t){let n=e.instrumentation;if(n==null){Cf(e,t);return}Y(n,`store.recomputeCountsUpwardFrom`,()=>Cf(e,t))}function Yd(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!J(o)){Sf(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){Sf(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function Xd(e,t){let n=[],r=t;for(;r!=null;){let t=X(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function Zd(e,t){if(t.length===0)return e.snapshot.rootId;let n=Mu(t);return Qd(e,n.segments,n.requiresDirectory)}function Qd(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=$d(e,r),a=Kl(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=X(e,r);return n&&!J(i)?null:r}function $d(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function X(e,t){let n=e.snapshot.nodes[t];if(n===void 0||uu(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function ef(e,t){let n=e.snapshot.nodes[t];if(n===void 0||uu(n,4))return[];if(!J(n))return[qd(e,t)];if($d(e,t).childIds.length===0)return uu(n,1)&&!uu(n,2)?[qd(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||uu(n,4)){i.pop();continue}if(!J(n)){r.push(qd(e,t.nodeId)),i.pop();continue}let a=$d(e,t.nodeId);if(a.childIds.length===0){uu(n,1)&&!uu(n,2)&&r.push(qd(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function tf(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=Fu(e.snapshot.segmentTable,i),a=$d(e,r),o=Kl(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!J(X(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=nf(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function nf(e,t,n){let r=X(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:ou(su(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,Wl()),of(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function rf(e,t,n){let r=Fu(e.snapshot.segmentTable,n),i=$d(e,t);if(Kl(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${Tf(e,t,n)}"`);let a=X(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:ou(su(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),of(e,t,o),e.activeNodeCount++,o}function af(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}cf(e,n,o)<0?i=a:r=a+1}return r}function of(e,t,n){let r=$d(e,t),i=X(e,n);Kl(e.snapshot.nodes,r).set(i.nameId,n),Zl(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=af(e,r,n);r.childIds.splice(a,0,n),Yl(r,a),eu(e.snapshot.nodes,r)}function sf(e,t,n,r){let i=$d(e,t),a=ql(i),o=a.get(n)??-1;Kl(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&Zl(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),Yl(i,o),eu(e.snapshot.nodes,i))}function cf(e,t,n){let r=e.snapshot.options.sort;return r===`default`?lf(e,t,n):r(uf(e,t),uf(e,n))}function lf(e,t,n){let r=X(e,t),i=X(e,n),a=J(r);if(a!==J(i))return a?-1:1;let o=xu(Ou(e.snapshot.segmentTable,r.nameId),Ou(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=Iu(e.snapshot.segmentTable,r.nameId),c=Iu(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function uf(e,t){let n=X(e,t),r=qd(e,t),i=J(n),a=i?r.slice(0,-1):r;return{basename:Iu(e.snapshot.segmentTable,n.nameId),depth:su(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function df(e,t,n){let r=X(e,t),i=Zd(e,n);if(i!=null){let t=X(e,i);if(J(t))return{basename:Iu(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=Mu(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=Mu(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:Qd(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function ff(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${qd(e,t)}"`);let i=X(e,t);if(cu(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(J(i)&&$d(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return pf(e,t),sf(e,a,t,o),mf(e,a),Jd(e,a),`handled`}function pf(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=X(e,t.nodeId);if(t.visitedChildren||!J(i)){J(i)&&e.snapshot.directories.delete(t.nodeId),du(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),pd(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=$d(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function mf(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!J(t)||uu(t,2)||$d(e,n).childIds.length>0)return;du(t,1),n=t.parentId===n?null:t.parentId}}function hf(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=Kl(e.snapshot.nodes,$d(e,n)).get(t);if(i==null||!J(X(e,i)))break;n=i}return n}function gf(e,t){let n=yf(e,t);if(n==null)return null;let r=zd(e,n),i=X(e,r),a=n===r?null:Bd(e,n).map(t=>qd(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:$d(e,r).childIds.length>0,path:qd(e,r),terminalKind:cu(i)})}function _f(e,t){return vf([e],[t])}function vf(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function yf(e,t){let n=t;for(;n!=null;){let t=X(e,n);if(!J(t)||uu(t,2))return null;if(!id(e,n,t))return n;n=t.parentId}return null}function bf(e,t){let n=X(e,t);if(fu(n,(t===e.snapshot.rootId?-1:su(X(e,n.parentId)))+1),!J(n))return;let r=$d(e,t);for(let t of r.childIds)bf(e,t)}function xf(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=X(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function Sf(e,t,n=X(e,t),r=!1){let i=e.instrumentation;if(i==null){wf(e,t,n,r);return}Y(i,`store.recomputeNodeCounts`,()=>wf(e,t,n,r))}function Cf(e,t){let n=t;for(;n!=null;){let t=X(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(Sf(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&Zl($d(e,s),n,a,o),n=s}}function wf(e,t,n,r){if(!J(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=$d(e,t);if(r){let t=e.instrumentation;t==null?Xl(e.snapshot.nodes,i):Y(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>Xl(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,uu(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=Rd(e,t)==null?id(e,t,n)?1+o:1:o}function Tf(e,t,n){let r=qd(e,t);return r.length===0?n:`${r}${n}`}function Ef(e){return e!=null&&!uu(e,4)}function Df(e,t){let n=e.snapshot.nodes[t];return!Ef(n)||!J(n)||uu(n,2)?null:n}function Of(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&Ef(e.snapshot.nodes[n])&&(t+=1);return t}function kf(e){return Math.max(0,e.valueById.length-1)}function Af(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:Of(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:kf(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function jf(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function Mf(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)Df(e,n)!=null&&t.push(qd(e,n));for(let t of e.expandedDirectoryIds)Df(e,t)!=null&&n.push(qd(e,t));return{collapsedPaths:t,expandedPaths:n}}function Nf(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)Df(e,n)==null||sd(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:qd(e,n)});return t}function Pf(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=Zd(e,n);t!=null&&ad(e,t,!0,X(e,t))}for(let n of t.collapsedPaths){let t=Zd(e,n);t!=null&&ad(e,t,!1,X(e,t))}}function Ff(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=Zd(e,n.path);t!=null&&Df(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function If(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function Lf(e){let t=e.snapshot.segmentTable,n=Pu();for(let r of e.snapshot.nodes)if(Ef(r)){if(uu(r,2)){r.nameId=0;continue}r.nameId=Fu(n,Iu(t,r.nameId))}e.snapshot.segmentTable=n}function Rf(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!Ef(r)||!J(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return Ef(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[X(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),Xl(e.snapshot.nodes,n)}}function zf(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(Ef(n))break;--t}e.snapshot.nodes.length=t+1}function Bf(e){let t=Mf(e),n=Nf(e);Y(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>If(e)),Y(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>Lf(e)),Y(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>Rf(e)),Y(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>zf(e)),Y(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>Pf(e,t)),Y(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>Ff(e,n)),Y(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>Yd(e,e.snapshot.rootId))}function Vf(e){let t=Mf(e),n=Nf(e),r=Y(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>Vd(e)),i=mu({...e.snapshot.options},e.instrumentation),a=Y(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new $u(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,Y(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>Pf(e,t)),Y(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>Ff(e,n)),Y(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>Yd(e,e.snapshot.rootId))}function Hf(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function Uf(e,t){let n=Af(e);t===`stable`?Y(e.instrumentation,`store.cleanup.stable`,()=>Bf(e)):Y(e.instrumentation,`store.cleanup.aggressive`,()=>Vf(e));let r=Af(e);return jf(t,t===`stable`,n,r)}var Wf=64;function Gf(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function Kf(e){return X(e,e.snapshot.rootId).visibleSubtreeCount}function qf(e,t,n,r){let i=X(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function Jf(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:pp(e,t.cursor),setSize:t.setSize,subtreeEndIndex:qf(e,t.cursor,t.index,n)}}function Yf(e,t,n,r,i,a){let o=$d(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=Ql(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return Xf(e,u,l,r+c,i+1,s,o.childIds.length,a)}function Xf(e,t,n,r,i,a,o,s){if(!J(X(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=sp(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=X(e,c.terminalNodeId);if(!J(l)||!id(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return Yf(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function Zf(e,t){let n=Kf(e);if(t<0||t>=n)return null;let r=Yf(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>qd(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=Jf(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:pp(e,r.cursor),setSize:r.setSize,subtreeEndIndex:qf(e,r.cursor,r.index,n)}}function Qf(e,t,n){let r=e.instrumentation,i=Kf(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return fp(e,o+1);let t=[],n=ip(e,a);for(let r=a;r<=o&&n!=null;r++){let r=pp(e,n);t.push(r),n=lp(e,n)}return t}let s=[],c=0,l=0,u=Y(r,`store.getVisibleSlice.selectFirstRow`,()=>ip(e,a));for(let t=a;t<=o&&u!=null;t++){let t=Y(r,`store.getVisibleSlice.materializeRow`,()=>pp(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=Y(r,`store.getVisibleSlice.advanceCursor`,()=>lp(e,u))}return gu(r,`workload.visibleRowsRead`,s.length),gu(r,`workload.flattenedRowsRead`,c),gu(r,`workload.flattenedSegmentsRead`,l),s}function $f(e,t=Kf(e)){let n=e.instrumentation;return n==null?dp(e,t):Y(n,`store.getVisibleTreeProjection`,()=>dp(e,t))}function ep(e){return up($f(e))}function tp(e,t){let n=Zd(e,t);if(n==null||n===e.snapshot.rootId||J(X(e,n))&&zd(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=X(e,i).parentId,n=$d(e,t),s=ql(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=$l(a,n,s),t!==o){let n=X(e,t),a=Rd(e,t);if(!id(e,t,n)&&a!==i)return null;zd(e,t)===t&&(r+=1)}i=t}return r}function np(e,t){let n=Zd(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!J(r))throw Error(`Path is not a directory: "${t}"`);return id(e,n,r)?null:(ad(e,n,!0,r),Jd(e,n),vd({affectedAncestorIds:Xd(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function rp(e,t){let n=Zd(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=X(e,n);if(!J(r))throw Error(`Path is not a directory: "${t}"`);return id(e,n,r)?(ad(e,n,!1,r),Jd(e,n),yd({affectedAncestorIds:Xd(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function ip(e,t){return t<0||t>=Kf(e)?null:ap(e,e.snapshot.rootId,t,-1)}function ap(e,t,n,r){let i=$d(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?Ql(e.snapshot.nodes,i,n):Y(a,`store.getVisibleSlice.selectChildIndex`,()=>Ql(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return op(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function op(e,t,n,r){if(!J(X(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=sp(e,t,r);if(n===0)return i;let a=X(e,i.terminalNodeId);if(!J(a)||!id(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return ap(e,i.terminalNodeId,n-1,i.visibleDepth)}function sp(e,t,n){return J(X(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:zd(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:Y(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>zd(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function cp(e,t){let n=X(e,t);if(!J(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:Rd(e,r)!==t}function lp(e,t){let n=X(e,t.terminalNodeId);if(J(n)){let r=$d(e,t.terminalNodeId);if(id(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:op(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=X(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=$d(e,n),o=ql(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return op(e,s,0,i);cp(e,r)&&i--,r=n}}function up(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function dp(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(Wf);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=Gf(o,y);let x,S=_;if(J(v))S=f?zd(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:qd(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&J(C)&&id(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function fp(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!J(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:qd(e,f)};continue}let h=l?zd(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=pp(e,g);let _=i[h];_!=null&&J(_)&&id(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function pp(e,t){let n=X(e,t.terminalNodeId),r=J(n)?mp(e,t):null,i=qd(e,t.terminalNodeId),a=Iu(e.snapshot.segmentTable,n.nameId),o=J(n)&&$d(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?Bd(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:Iu(e.snapshot.segmentTable,r.nameId),nodeId:n,path:qd(e,n)}}):Y(c,`store.getVisibleSlice.flatten.collectSegments`,()=>Bd(e,t.headNodeId).map(n=>{let r=X(e,n);return{isTerminal:n===t.terminalNodeId,name:Iu(e.snapshot.segmentTable,r.nameId),nodeId:n,path:qd(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:J(n)&&id(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:J(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function mp(e,t){if(t.headNodeId===t.terminalNodeId)return sd(e,t.terminalNodeId);let n=Bd(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=sd(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function hp(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!J(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&eu(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&J(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,eu(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function gp(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var _p=class e{#e;constructor(e={}){let t=hu(e),n=Y(t,`store.builder.create`,()=>new $u(e));if(e.preparedInput!=null){let t=Xu(e.preparedInput);t==null?n.appendPreparedPaths(Yu(e.preparedInput),!1):n.appendPresortedPaths(t,Zu(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(Y(t,`store.preparePathEntries`,()=>Qu(r,e)))}let r=Y(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=Y(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=Y(t,`store.state.create`,()=>ed(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:Y(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||gp(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&Y(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?Y(t,`store.state.initializeOpenVisibleCounts`,()=>hp(this.#e)):Y(t,`store.state.recomputeCounts`,()=>Yd(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return Ku(e,t)}static prepareInput(e,t={}){return qu(e,t)}static preparePresortedInput(e){return Ju(e)}list(e){return Y(this.#e.instrumentation,`store.list`,()=>Vd(this.#e,e))}add(e){Y(this.#e.instrumentation,`store.add`,()=>{let t=Kf(this.#e);Od(this.#e,Ed(this.#e,t,Hd(this.#e,e)))})}remove(e,t={}){Y(this.#e.instrumentation,`store.remove`,()=>{let n=Kf(this.#e);Od(this.#e,Ed(this.#e,n,Ud(this.#e,e,t)))})}move(e,t,n={}){Y(this.#e.instrumentation,`store.move`,()=>{let r=Kf(this.#e),i=Wd(this.#e,e,t,n);i!=null&&Od(this.#e,Ed(this.#e,r,i))})}batch(e){Dd(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return Y(this.#e.instrumentation,`store.getVisibleCount`,()=>Kf(this.#e))}getVisibleSlice(e,t){return Y(this.#e.instrumentation,`store.getVisibleSlice`,()=>Qf(this.#e,e,t))}getVisibleRowContext(e){return Y(this.#e.instrumentation,`store.getVisibleRowContext`,()=>Zf(this.#e,e))}getVisibleTreeProjection(){return ep(this.#e)}getVisibleTreeProjectionData(e){return $f(this.#e,e)}getVisibleIndex(e){return Y(this.#e.instrumentation,`store.getVisibleIndex`,()=>tp(this.#e,e))}getPathInfo(e){return Y(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=Zd(this.#e,e);if(t==null)return null;let n=X(this.#e,t);return{depth:su(n),kind:J(n)?`directory`:`file`,path:qd(this.#e,t)}})}isExpanded(e){return Y(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=X(this.#e,t);return id(this.#e,t,n)})}expand(e){Y(this.#e.instrumentation,`store.expand`,()=>{let t=Kf(this.#e),n=np(this.#e,e);n!=null&&Od(this.#e,Ed(this.#e,t,n))})}collapse(e){Y(this.#e.instrumentation,`store.collapse`,()=>{let t=Kf(this.#e),n=rp(this.#e,e);n!=null&&Od(this.#e,Ed(this.#e,t,n))})}on(e,t){return md(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return sd(this.#e,t)}markDirectoryUnloaded(e){Y(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if($d(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=Kf(this.#e);ld(this.#e,t),Od(this.#e,Ed(this.#e,n,bd({affectedAncestorIds:Xd(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return Y(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=Kf(this.#e),r=cd(this.#e,t);return Od(this.#e,Ed(this.#e,n,xd({affectedAncestorIds:Xd(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return Y(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||sd(this.#e,n)!==`loading`||!dd(this.#e,n,e.attemptId))return!1;let r=qd(this.#e,n);this.validateChildPatch(r,t);let i=Kf(this.#e),a=[];for(let e of t.operations){vp(r,e);let t=Kf(this.#e);switch(e.type){case`add`:a.push(Ed(this.#e,t,Hd(this.#e,e.path)));break;case`remove`:a.push(Ed(this.#e,t,Ud(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=Wd(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(Ed(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return Od(this.#e,Ed(this.#e,i,Sd({affectedAncestorIds:Xd(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:qd(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return Y(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=Kf(this.#e),r=ud(this.#e,t,e.attemptId);return Od(this.#e,Ed(this.#e,n,Cd({affectedAncestorIds:Xd(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:qd(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return Y(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=Kf(this.#e),i=fd(this.#e,n,e.attemptId,t);return Od(this.#e,Ed(this.#e,r,wd({affectedAncestorIds:Xd(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:qd(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return Y(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(Hf(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=Kf(this.#e),n=Uf(this.#e,e.mode??`stable`);return Od(this.#e,Ed(this.#e,t,Td({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=$d(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??yu(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=xu(Ou(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!J(X(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=X(this.#e,n);id(this.#e,n,i)||(ad(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=X(this.#e,e);if(!id(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=Zd(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!J(X(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!J(X(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=X(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=X(this.#e,e),r=Rd(this.#e,e);if(!id(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function vp(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var yp=e=>e.startsWith(`f::`)?e.slice(3):e;function bp(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function xp(e,t){return e===``?t:`${e}/${t}`}function Sp({files:e,path:t,isFolder:n,nextBasename:r}){let i=yp(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=bp(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=xp(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function Cp(e){return e.endsWith(`/`)}function wp(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function Tp(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function Ep(e,t){return t.includes(e)?Tp(t):[e]}function Dp(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function Op(e,t){return{draggedPaths:e,target:t}}function kp(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(Cp(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function Ap(e,t){return t.kind===`root`||t.directoryPath==null?wp(e):t.directoryPath}function jp(e,t){let n=e.map(e=>{let n=Ap(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}var Mp=Symbol(`FILE_TREE_RENAME_VIEW`);function Np(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}var Pp=512,Fp=512;function Ip(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function Lp(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function Rp(e){return Lp(e).at(-1)??null}function zp(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}var Bp=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},Vp=e=>e.toLowerCase();function Hp(e){return e.endsWith(`/`)}function Up(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function Wp(e){return e.endsWith(`/`)?e.slice(0,-1):e}function Gp(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}function Kp(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function qp(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function Jp(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return qp(e,t.path)?n?e:null:e;case`move`:return Kp(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=Jp(r,e,n),r==null)return null;return r}}}function Yp(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function Xp(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function Zp(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!Xp(_p.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function Qp(e){switch(e.operation){case`add`:return{...Yp(e),operation:`add`,path:e.path};case`remove`:return{...Yp(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...Yp(e),from:e.from,operation:`move`,to:e.to}}}function $p(e){return{...Yp(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>Qp(e)),operation:`batch`}}function em(e){switch(e.operation){case`add`:case`remove`:case`move`:return Qp(e);case`batch`:return $p(e);default:return null}}function tm(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=Lp(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function nm(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:tm(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var rm=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=new Set;#z=0;#B;#V=0;#H=!1;#U=0;#W;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=Zp({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#B=this.#se(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ae(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#R=new Set(d),this.#L=f,this.#z=1),this.#Oe(f,!1),r!=null&&this.#Se(r,!1),this.#W=this.#Fe()}destroy(){this.#W?.(),this.#W=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#pe()}focusFirstItem(){this.#ve().length>0&&this.#Me(0)}focusLastItem(){this.#U<=0||(this.#Ne(),this.#Me(this.#U-1))}focusNextItem(){this.#De(1)}focusParentItem(){if(this.#c==null)return;let e=Rp(this.#c);if(e==null)return;let t=this.#Y(e);t>=0&&this.#Me(t)}focusPath(e){let t=this.#B.getPathInfo(e)?.path??null;if(t==null)return;this.#Ne();let n=this.#Y(t);n>=0&&this.#Me(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Y(t);return n>=0?(this.#Me(n),this.#ve()[n]??t):null}focusPreviousItem(){this.#De(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#X(this.#c)}getFocusedPath(){return this.#c}resolveNearestVisiblePath(e){let t=this.#ve();if(this.#U===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#B.getPathInfo(e)?.path??e,r=this.#Y(n);return r>=0?t[r]??n:this.#J(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#R]}getSelectionVersion(){return this.#z}getVisibleCount(){return this.#U}getVisibleRows(e,t){if(t<e||this.#U===0)return[];let n=Math.max(0,e),r=Math.min(this.#U-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=Fp){let e=[];for(let t=n;t<=r;t+=1){let n=this.#B.getVisibleRowContext(t);if(n==null)break;e.push(this.#Q(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ne(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#ye(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#B.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#ye(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#Z(o,i,a,{ancestorPaths:this.#te(a),path:s})})}return this.#B.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#Z(e,r,r,{ancestorPaths:this.#te(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#U===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#U;r+=1){let i=e+r*t,a=Math.min(this.#U-1,Math.floor(i/t)),o=this.#$(a,r)??(a>0?this.#$(a-1,r):void 0);if(o==null)break;n.push({row:this.#Q(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#B.getPathInfo(e);return t==null?null:this.#X(t.path,t)}selectAllVisiblePaths(){this.#Ne();let e=[...this.#ve()];this.#re(e,this.#c??this.#L)}selectOnlyPath(e){let t=this.#Ae(e);t!=null&&this.#re([t],t)}selectPath(e){let t=this.#Ae(e);t==null||this.#R.has(t)||this.#re([...this.#R,t])}deselectPath(e){let t=this.#Ae(e);t==null||!this.#R.has(t)||this.#re([...this.#R].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ae(e);if(t!=null){if(this.#R.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ae(e);if(t!=null){if(this.#R.has(t)){this.#re([...this.#R].filter(e=>e!==t),t);return}this.#re([...this.#R,t],t)}}selectPathRange(e,t){let n=this.#Ae(e);if(n==null)return;this.#Ne();let r=this.#L,i=r==null?-1:this.#be(r),a=this.#be(n);if(i===-1||a===-1){let e=t?[...this.#R,n]:[n];this.#re(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#ve().slice(o,s+1),l=t?[...this.#R,...c]:c;this.#re(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#U-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ne();let r=this.#ve(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#R);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#re([...o],this.#L??i,!1),this.#Me(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ae(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=Ep(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#re([t],t,!1),this.#je(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#we(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=Op(t.draggedPaths,n);(kp(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}Dp(t.target,n)||(this.#i={...t,target:n},this.#we())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#we())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#we(),!1;let n=Op(e.draggedPaths,t);if(kp(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#we(),!1;let r=jp(e.draggedPaths,t);if(r==null)return this.#we(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#B.move(e.from,e.to,{collision:e.collision})}else this.#oe(r.operations),this.#B.batch(r.operations)}catch(e){return this.#we(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#B.add(e)}remove(e,t={}){this.#B.remove(e,t)}move(e,t,n={}){this.#B.move(e,t,n)}batch(e){this.#B.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Se(e,!0)}openSearch(e=``){this.#Se(e,!0)}closeSearch(){this.#Se(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#xe(1)}focusPreviousSearchMatch(){this.#xe(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#B.getPathInfo(e);if(n==null)return!1;let r=n.path,i=Hp(r),a=Wp(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of Lp(r))this.#B.isExpanded(e)||this.#B.expand(e);return this.#re([r],r,!1),this.#M!=null&&(this.#Se(null,!1),this.#y?.(this.#M)),this.#je(r),this.#T=r,this.#E=Up(r),this.#D=t.removeIfCanceled??!1,this.#we(),!0}[Mp](){return{cancel:()=>{this.#G()},commit:()=>{this.#K()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#q(e)}}}#G(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,Hp(e)?{recursive:!0}:void 0);return}this.#je(e),this.#we()}#K(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,Hp(e)?{recursive:!0}:void 0);return}let t=Hp(e),n=Sp({files:this.#B.list(),isFolder:t,nextBasename:this.#E,path:Wp(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#je(e),this.#v?.(n.error),this.#we();return}if(n.sourcePath===n.destinationPath){this.#je(e),this.#we();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(Gp(n.sourcePath,t),Gp(n.destinationPath,t))}#q(e){this.#T==null||this.#E===e||(this.#E=e,this.#we())}resetPaths(e,t={}){let n=this.#B.list().length,r=this.#U,i=Zp({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#se(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#L;this.#W?.(),this.#B=a,this.#d.clear(),this.#pe();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!Ip(this.#R,u);this.#R=new Set(u),d&&(this.#z+=1),this.#L=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#Oe(o,o!=null||u.length>0||this.#L!=null),this.#W=this.#Fe(),this.#we(),this.#Te({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#U-r})}#J(e){this.#Ne();let t=Rp(e),n=zp(e,t),r=null,i=null;for(let e of this.#ve()){if(Rp(e)!==t)continue;let a=zp(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Y(e){let t=this.#be(e);if(t!==-1)return t;let n=Lp(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#be(t);if(r!==-1)return r}return this.#ve().length>0?0:-1}#X(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#B.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#ie(r.path):this.#ae(r.path);return this.#d.set(r.path,i),i}#Z(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#R.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#Q(e){return this.#Z(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#$(e,t){let n=this.#B.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ee(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ee(n),n];return this.#a.set(e,r),r}#te(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ee(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ne(e){this.#B.collapse(e)}#re(e,t=this.#L,n=!0){let r=[...new Set(e)],i=!Ip(this.#R,r),a=this.#L!==t;!i&&!a||(this.#R=new Set(r),this.#L=t,i&&(this.#z+=1),n&&this.#we())}#ie(e){return{collapse:()=>{this.#ne(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#Ee(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#B.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#R.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#Ie(e)}}}#ae(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#R.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#oe(e){let t=this.#B.list();this.#se(t).batch(e)}#se(e,t,n){return new _p({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ce(){return this.#h??=this.#B.list(),this.#h}#le(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ce()){e.add(t);for(let n of Lp(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#ue(){return this.#g??=this.#ce().map(Vp),this.#g}#de(){return this.#f??=this.#le().filter(e=>e.endsWith(`/`)),this.#f}#fe(){return this.#p??=this.#de().map(Vp),this.#p}#pe(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#me(){return this.#de().filter(e=>this.#B.isExpanded(e))}#he(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#R)for(let n of Lp(e))t.add(n);this.#ge(t)}#ge(e){this.#H=!0;try{for(let t of this.#de()){let n=e.has(t),r=this.#B.isExpanded(t);n&&!r?this.#B.expand(t):!n&&r&&this.#B.collapse(t)}}finally{this.#H=!1}}#_e(){let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#M==null||this.#M.length===0||this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#U=this.#V;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#U=n.length}#ve(){return this.#I??this.#b}#ye(e){return this.#F?.[e]??e}#be(e){return this.#P?.get(e)??this.#B.getVisibleIndex(e)??-1}#xe(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Se(e,t){let n=e==null?null:Bp(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#me()),this.#M=n,n==null)this.#he(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#Oe(this.#c,!0);else if(n.length===0)this.#he(!1),this.#O.clear(),this.#N=null,this.#Oe(this.#c,!0);else{let e=this.#Ce();this.#Oe(e,!0)}t&&(this.#y?.(this.#M),this.#we())}}#Ce(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ce(),n=this.#ue(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#de(),s=this.#fe();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of Lp(e))l.add(t),c?.add(t)}return this.#ge(l),a??this.#c}#we(){for(let e of this.#t)e()}#Te(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#Ee(e){for(let t of Lp(e))this.#B.isExpanded(t)||this.#B.expand(t);this.#B.isExpanded(e)||this.#B.expand(e)}#De(e){let t=this.#U;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ne(),this.#Me(r))}#Oe(e,t=!0){let n=this.#B.getVisibleCount();this.#V=n;let r=nm(this.#B.getVisibleTreeProjectionData(t?void 0:Math.min(n,Pp)),e,t?e=>this.#B.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#_e(),this.#s=e==null?this.#ve().length>0?0:-1:this.#Y(e),this.#c=this.#s<0?null:this.#ke(this.#s)}#ke(e){return this.#ve()[e]??(this.#F==null?this.#B.getVisibleRowContext(e)?.row.path??null:null)}#Ae(e){return this.#B.getPathInfo(e)?.path??null}#je(e){if(e==null)return;let t=this.#Y(e);t>=0&&this.#Me(t,!1)}#Me(e,t=!0){let n=this.#ke(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#we()))}#Ne(){this.#l||this.#Oe(this.#c,!0)}#Pe(e){let t=Jp(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=Jp(this.#c,e,!0),r=[...this.#R].map(t=>Jp(t,e)).filter(e=>e!=null).map(e=>this.#B.getPathInfo(e)?.path??null).filter(e=>e!=null),i=Jp(this.#L,e),a=i==null?null:this.#B.getPathInfo(i)?.path??null,o=[...new Set(r)];return Ip(this.#R,o)||(this.#R=new Set(o),this.#z+=1),this.#L=a,n}#Fe(){return this.#B.on(`*`,e=>{if(this.#H)return;e.canonicalChanged&&(this.#d.clear(),this.#pe()),this.#i!=null&&Np(e)&&(this.#i=null);let t=Np(e)?this.#Pe(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ce():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#Oe(n,r),this.#we();let i=em(e);i!=null&&this.#Te(i)})}#Ie(e){if(this.#B.isExpanded(e)){this.#ne(e);return}this.#Ee(e)}},im=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function am(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(!(e[t]===`/`||t===e.length)){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function om(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function sm(e,t){return t?`${e}/`:e}function cm(e,t=null){let n=im(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=am(t.path);if(e==null)continue;let n=sm(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of om(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var lm=e=>e.trim().toLowerCase(),um=e=>e.split(`/`).at(-1)??e,dm=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function fm(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function pm(e){let t=El(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(lm(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let n=um(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return fm(c,e);for(let[t,n]of a)if(s.includes(t))return fm(n,e);let l=dm(n);for(let t of l){let n=i.get(t);if(n!=null)return fm(n,e)}let u=wl(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:Sl(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:fm(s,e)}}}var Z,mm,hm,gm,_m,vm,ym,bm,xm,Sm,Cm={},wm=[],Tm=Array.isArray,Em=wm.slice,Dm=Object.assign;function Om(e){e&&e.parentNode&&e.remove()}function km(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?Em.call(arguments,2):n),Am(e,o,r,i,null)}function Am(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++mm,__i:-1,__u:0};return i==null&&Z.vnode!=null&&Z.vnode(a),a}function jm(e){return e.children}function Mm(e,t){this.props=e,this.context=t,this.__g=0}function Nm(e,t){if(t==null)return e.__?Nm(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?Nm(e):null}function Pm(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return Pm(e)}}function Fm(e){(8&e.__g||!(e.__g|=8)||!hm.push(e)||_m++)&&gm==Z.debounceRendering||((gm=Z.debounceRendering)||queueMicrotask)(Im)}function Im(){for(var e,t,n,r,i,a,o,s,c=1;hm.length;)hm.length>c&&hm.sort(vm),e=hm.shift(),c=hm.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=Dm({},r)).__v=r.__v+1,Z.vnode&&Z.vnode(n),Wm(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??Nm(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,Km(a,n,o),n.__e!=i&&Pm(n)));_m=0}function Lm(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||wm,b=t.length;for(c=Rm(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?Cm:y[m.__i]||Cm,m.__i=f,_=Wm(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&Ym(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=zm(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function Rm(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?Am(null,o,null,null,null):Tm(o)?Am(jm,{children:o},null,null,null):o.constructor==null&&o.__b>0?Am(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=Bm(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=Nm(s)),Xm(s,s));return r}function zm(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=zm(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Nm(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Bm(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function Vm(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function Hm(e,t,n,r,i){var a;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||Vm(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||Vm(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(ym,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=bm,e.addEventListener(t,a?Sm:xm,a)):e.removeEventListener(t,a?Sm:xm,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function Um(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=bm++;else if(t.u<n.l)return;return n(Z.event?Z.event(t):t)}}}function Wm(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=Z.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new M(v,x):(t.__c=f=new Mm(v,x),f.constructor=M,f.render=Zm),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Dm({},f.__s)),Dm(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=Z.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=Dm({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===jm&&d.key==null&&(E=qm(d.props.children)),s=Lm(e,Tm(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)Om(a[j]);Gm(t)}else t.__e=n.__e,t.__k=n.__k,e.then||Gm(t);Z.__e(e,t,n)}else s=t.__e=Jm(n.__e,t,n,r,i,a,o,c,l,u);return(d=Z.diffed)&&d(t),128&t.__u?void 0:s}function Gm(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(Gm)}function Km(e,t,n){for(var r=0;r<n.length;r++)Ym(n[r],n[++r],n[++r]);Z.__c&&Z.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Z.__e(e,t.__v)}})}function qm(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:Tm(e)?e.map(qm):Dm({},e)}function Jm(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(Z.__m&&Z.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=Em.call(e.childNodes),v=n.props||Cm,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;Hm(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||Hm(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),Lm(b==`template`?e.content:e,Tm(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&Nm(n,0),s,c,l),a!=null)for(u=a.length;u--;)Om(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||Hm(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&Hm(e,u,g,v[u],i))}return e}function Ym(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){Z.__e(e,n)}}function Xm(e,t,n){var r,i;if(Z.unmount&&Z.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Ym(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Z.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Xm(r[i],t,n||typeof e.type!=`function`);n||Om(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function Zm(e,t,n){return this.constructor(e,n)}function Qm(e,t){var n,r,i,a;t==document&&(t=document.documentElement),Z.__&&Z.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=km(jm,null,[e]),i=[],a=[],Wm(t,e,r||Cm,Cm,t.namespaceURI,r?null:t.firstChild?Em.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),Km(i,e,a)}function $m(e,t){e.__u|=32,Qm(e,t)}Z={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw _m=0,e}},mm=0,Mm.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Dm({},this.state);typeof e==`function`&&(e=e(Dm({},n),this.props)),e&&Dm(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Fm(this))},Mm.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),Fm(this))},Mm.prototype.render=jm,hm=[],_m=0,vm=function(e,t){return e.__v.__b-t.__v.__b},ym=/(PointerCapture)$|Capture$/i,bm=0,xm=Um(!1),Sm=Um(!0);var eh=0;Array.isArray;function Q(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--eh,__i:-1,__u:0,__source:i,__self:a};return Z.vnode&&Z.vnode(l),l}var th=16,nh=16,rh={};function ih({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=rh[e]??{width:th,height:nh},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return Q(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:Q(`use`,{href:c})})}var ah=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},oh=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},sh=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},ch=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},lh=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},uh=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function dh({children:e,marker:t,variant:n=`default`}){"use no memo";return Q(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Q(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?Q(`span`,{"data-truncate-fade":!0}):t})})}function fh(e){"use no memo";let{mode:t,children:n}=e;return Q(`div`,{children:[Q(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?Q(`span`,{children:n}):n}),Q(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?Q(`span`,{children:n}):n})]})}function ph({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=Q(fh,{mode:t,children:e},`content`),o=Q(dh,{marker:n,mode:t,variant:r},`marker`),s=Q(`div`,{"data-truncate-fill":!0},`fill`);return Q(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:Q(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function mh({children:e,...t}){"use no memo";return Q(ph,{mode:`truncate`,...t,children:e})}function hh({children:e,...t}){"use no memo";return Q(ph,{mode:`fruncate`,...t,children:e})}function gh({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=Q(mh,{...s,children:t[0]}),l=Q(hh,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return Q(`div`,{className:a,style:o});if(e.length<i)return Q(n===`end`?hh:mh,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=ah:r===`extension`?t=oh:r===`leaf-path`&&(t=sh);else if(typeof r==`number`)t=ch,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=lh:e===`first`&&(t=uh)}else typeof r==`function`&&(t=r);t??=ah;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=Q(mh,{...s,..._,children:f}),l=Q(hh,{...s,...v,children:p})}return Q(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[Q(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),Q(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var _h={endIndex:-1,startIndex:-1};function vh(e,t,n){return Math.min(Math.max(e,t),n)}function yh(e,t){return e<0||t<e?_h:{endIndex:t,startIndex:e}}function bh(e){return e.startIndex<0||e.endIndex<e.startIndex}function xh(e,t){return bh(e)?0:(e.endIndex-e.startIndex+1)*t}function Sh(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function Ch(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function wh(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function Th(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function Eh(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function Dh(e,t,n){if(e.length===0||t<=0)return[];let r=Eh(e),i=wh(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=Th(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function Oh(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=vh(t.scrollTop,0,o),c=t.stickyRows??Dh(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=Sh(s,n,t.itemHeight),m=Sh(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?_h:yh(m,Ch(u+d,n,t.itemHeight)),y=g+1,b=bh(v)?_h:yh(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=xh(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:bh(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var kh={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},Ah={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},jh=`Contains git status items`;function Mh(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function Nh(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function Ph(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}function Fh(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function Ih(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}var Lh,Rh,zh,Bh,Vh=Object.is,Hh=0,Uh=[],Wh=Z,Gh=Wh.__b,Kh=Wh.__r,qh=Wh.diffed,Jh=Wh.__c,Yh=Wh.unmount,Xh=Wh.__;function Zh(e,t){Wh.__h&&Wh.__h(Rh,e,Hh||t),Hh=0;var n=Rh.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Qh(e){return Hh=1,$h(ug,e)}function $h(e,t,n){var r=Zh(Lh++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):ug(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);Vh(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Rh,!Rh.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,Vh(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};Rh.__f=!0;var a=Rh.shouldComponentUpdate,o=Rh.componentWillUpdate;Rh.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},Rh.shouldComponentUpdate=i}return r.__N||r.__}function eg(e,t){var n=Zh(Lh++,3);!Wh.__s&&lg(n.__H,t)&&(n.__=e,n.u=t,Rh.__H.__h.push(n))}function tg(e,t){var n=Zh(Lh++,4);!Wh.__s&&lg(n.__H,t)&&(n.__=e,n.u=t,Rh.__h.push(n))}function $(e){return Hh=5,ng(function(){return{current:e}},[])}function ng(e,t){var n=Zh(Lh++,7);return lg(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function rg(e,t){return Hh=8,ng(function(){return e},t)}function ig(){for(var e;e=Uh.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(sg),e.__H.__h.forEach(cg),e.__H.__h=[]}catch(t){e.__H.__h=[],Wh.__e(t,e.__v)}}Wh.__b=function(e){Rh=null,Gh&&Gh(e)},Wh.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Xh&&Xh(e,t)},Wh.__r=function(e){Kh&&Kh(e),Lh=0;var t=(Rh=e.__c).__H;t&&(zh===Rh?(t.__h=[],Rh.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(sg),t.__h.forEach(cg),t.__h=[],Lh=0)),zh=Rh},Wh.diffed=function(e){qh&&qh(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Uh.push(t)!==1&&Bh===Wh.requestAnimationFrame||((Bh=Wh.requestAnimationFrame)||og)(ig)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),zh=Rh=null},Wh.__c=function(e,t){t.some(function(e){try{e.__h.forEach(sg),e.__h=e.__h.filter(function(e){return!e.__||cg(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],Wh.__e(n,e.__v)}}),Jh&&Jh(e,t)},Wh.unmount=function(e){Yh&&Yh(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{sg(e)}catch(e){t=e}}),n.__H=void 0,t&&Wh.__e(t,n.__v))};var ag=typeof requestAnimationFrame==`function`;function og(e){var t,n=function(){clearTimeout(r),ag&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ag&&(t=requestAnimationFrame(n))}function sg(e){var t=Rh,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),Rh=t}function cg(e){var t=Rh;e.__c=e.__(),Rh=t}function lg(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!Vh(t,e[n])})}function ug(e,t){return typeof t==`function`?t(e):t}function dg(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function fg(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function pg({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return Q(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function mg(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:Q(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return Q(jm,{children:[Q(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:Q(mh,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function hg(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function gg(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function _g(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function vg({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=Oh(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:_g(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?_g(u,1,t,o):i&&r<=0&&c.length>0?Dh(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var yg=400,bg=10,xg=40,Sg=18;function Cg(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?wg(e,t,n):a instanceof HTMLElement?a:null}function wg(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function Tg(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function Eg(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function Dg(){return navigator.vendor!==`Apple Computer, Inc.`}function Og(e,t){let n=e-t.top;if(n<xg)return-Math.ceil((xg-Math.max(0,n))/xg*Sg);let r=t.bottom-e;return r<xg?Math.ceil((xg-Math.max(0,r))/xg*Sg):0}function kg(e,t){if(e!=null){let t=kh[e];return t==null?null:{text:t,title:Ah[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:jh}:null}function Ag(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function jg(e){return e!=null&&`toggle`in e}function Mg(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function Ng(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function Pg(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function Fg(e,t){return e!=null&&e>0?e:t}function Ig(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function Lg(e,t,n,r,i=0){let a=Fh({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function Rg(e,t,n,r,i,a){let o=Ih({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function zg(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function Bg(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function Vg(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function Hg(e,t){return t&&Vg(e)||(e.ctrlKey||e.metaKey)&&Mg(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var Ug=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function Wg(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function Gg(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function Kg(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function qg(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function Jg(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function Yg(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function Xg(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function Zg(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function Qg(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=Zg(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function $g(e,t){return{kind:e.kind,name:gg(e),path:t}}function e_(e){return e==null?void 0:`${e}__tree`}function t_(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function n_(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function r_(e,t){if(e==null)return null;if(`text`in e)return Q(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?n_(e.icon)?t(e.icon):{name:e.icon}:n_(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return Q(`span`,{title:e.title,children:Q(ih,{...n})})}function i_(e){e!=null&&dg(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function a_(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=hg(e);return Q(jm,{children:[e.depth>0?Q(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>Q(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,Q(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?Q(ih,{...t(`file-tree-icon-chevron`)}):Q(ih,{...t(`file-tree-icon-file`,u)})}),Q(`div`,{"data-item-section":`content`,children:e.isFlattened?mg(e,c,a):c??Q(gh,{minimumLength:5,split:`extension`,children:e.name})}),i?Q(`div`,{"data-item-section":`decoration`,children:r==null?null:r_(r,t)}):null,s?Q(`div`,{"data-item-section":`git`,children:r_(o,t)}):null,n?Q(`div`,{"data-item-section":`action`,children:l?Q(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:Q(ih,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function o_(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:N}=e,P=hg(t),{isParked:F=!1,mode:I=`flow`,style:ee}=r,te=I===`sticky`,ne=_?.get(P)??null??Ag(t.ancestorPaths,v,y),re=t.kind===`directory`&&(b?.has(P)??!1),ie=A(t,P),L=kg(ne,re),R=S&&w,z=ie!=null||x||R,ae=R&&T===`always`,oe=a.getPath()===P,se=oe?a.getValue():``,ce=te||!oe?null:Q(pg,{ref:D,ariaLabel:`Rename ${gg(t)}`,isFlattened:t.isFlattened,value:se,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),le=a_(t,k,{actionLaneEnabled:R,customDecoration:ie,decorationLaneEnabled:z,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:L,gitLaneActive:x,renameInput:ce,showDecorativeActionAffordance:ae}),ue={...Nh({ariaLabel:gg(t),domId:t.isFocused?t_(h,P,F):void 0,extraStyle:ee,features:{actionLaneEnabled:R,contextMenuButtonVisibility:R?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:re,effectiveGitStatus:ne,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusPath(P),j(t,P,{anchorRect:Kg(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:te?void 0:()=>{i.focusPath(P)},onKeyDown:te?void 0:N,ref:e=>{O(P,e)}};return!te&&oe?Q(`div`,{...ue,children:le}):Q(`button`,{...ue,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(te){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:le})}function s_(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(hg(e))).map((n,r)=>o_(e,n,t.start+r))}function c_({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=kl,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=$(null),v=$(null),y=$(!1),b=$(null),x=$(null),S=$(null),C=$(null),w=$(null),T=$(new Map),E=$(new Map),D=$(()=>{}),O=$(null),k=$(!1),A=$(null),j=$(null),M=$(!1),N=$(null),P=$(null),F=$(null),I=$(null),ee=$(null),te=$(null),ne=$(null),re=$(null),ie=$(!1),L=$(null),R=$(null),z=$(null),ae=$(null),oe=ng(()=>new Map,[]),[,se]=Qh(0),[ce,le]=Qh(null),[ue,de]=Qh(null),[fe,pe]=Qh(null),[me,he]=Qh(null),[ge,_e]=Qh(0),[B,ve]=Qh(null),ye=$(B);ye.current=B;let V=$(null),be=$(null),H=$(null),xe=$(null),Se=$(null),Ce=$(!1),we=()=>{be.current=null,H.current=null,xe.current=null},Te=(e,t)=>{be.current=e,H.current=null,xe.current=t==null?null:{path:e,scrollTop:t}},Ee=(e,t)=>{be.current=null,H.current={path:e,viewportOffset:t},xe.current=null},De=$(d===`retain`&&t.isSearchOpen()),[Oe,ke]=Qh(p);eg(()=>{p||ke(!1)},[p]);let Ae=$(!1),je=rg(()=>{Ae.current=!0,ke(e=>e&&!1)},[]),[Me,Ne]=Qh(()=>vg({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Pe,Fe]=Qh(!1);eg(()=>{Fe(!0)},[]);let Ie=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,Le=e?.contextMenu?.triggerMode??(Ie?`right-click`:`both`),Re=Le===`both`||Le===`button`,ze=e?.contextMenu?.buttonVisibility??`when-needed`,Be=Le===`both`||Le===`right-click`;tg(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;Se.current=t,de(t),he(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(Ce.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Ve=rg((e,t)=>{Jg(T.current,e,t)},[]),He=rg((e,t)=>{Jg(E.current,e,t)},[]),Ue=rg(e=>{x.current=e},[]),We=rg(e=>Yg(e,E.current,T.current),[]),Ge=n!=null||r!=null||i!=null,{resolveIcon:Ke}=ng(()=>pm(a),[a]),qe=t[Mp](),Je=qe.getPath(),Ye=Je!=null,Xe=t.isSearchOpen(),Ze=t.getSearchValue(),U=t.getFocusedPath(),W=t.getFocusedIndex(),Qe=t.isDragAndDropEnabled(),$e=t.getDragSession(),et=ng(()=>$e==null?null:new Set($e.draggedPaths),[$e]),tt=$e?.target??null,G=$e?.primaryPath??null,nt=e_(o),{overlayHeight:rt,overlayRows:it,snapshot:at,visibleRows:ot}=Me,st=at.physical.viewportHeight,ct=ng(()=>({end:at.window.endIndex,start:at.window.startIndex}),[at.window.endIndex,at.window.startIndex]),lt=it,ut=at.sticky.rows,dt=at.physical.totalHeight,ft=at.sticky.height,pt=ng(()=>new Set(ut.map(e=>hg(e.row))),[ut]),mt=W>=0&&W>=ct.start&&W<=ct.end,ht=rg((e,t)=>u?.({item:$g(e,t),row:e})??null,[u]),gt=rg(e=>dg(e==null?null:T.current.get(e)??null)?!0:dg(S.current),[]),_t=rg(e=>{gt(t.focusNearestPath(e))},[t,gt]),vt=$(_t);vt.current=_t;let yt=$(!0),bt=$(()=>{}),xt=rg((t=!0)=>{let n=ye.current;n!=null&&(yt.current=yt.current&&t,ve(null),e?.contextMenu?.onClose?.(),yt.current&&_t(n.path))},[e?.contextMenu,_t]);bt.current=xt;let St=rg(e=>{let t=e==null?null:qg(S.current,e);pe(e=>e===t?e:t)},[]),Ct=rg((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=We(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;Te(n,e?.scrollTop??null),k.current=!0,le(e=>e===n?e:n)}i.focus(),St(a),yt.current=!0,ve({anchorRect:r?.anchorRect??null,item:$g(e,n),path:n,source:r?.source??`keyboard`})},[t,We,St]),wt=rg(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=Pg(e,st);N.current=W<0||e==null?null:Math.max(0,Math.min(W*s-e.scrollTop,Math.max(0,t-s))),M.current=!0}t.startRenaming(e)!==!1&&(he(`focus`),se(e=>e+1))}},[t,W,s,l,st]),Tt=rg((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=Pg(i,st),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:vg({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return k.current=!0,Rg(i,a,s,l,u,d),D.current(),V.current=n?e:null,!0},[t,s,c,st,h]),Et=()=>y.current===!0||ae.current!=null||ie.current===!0,Dt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Ot=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},kt=()=>{I.current!=null&&(clearTimeout(I.current),I.current=null),F.current=null},At=()=>{te.current?.remove(),te.current=null},jt=()=>{Ot(P.current),P.current=null,ee.current=null},Mt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},Nt=()=>{re.current?.(),re.current=null,ae.current!=null&&(clearTimeout(ae.current),ae.current=null),ie.current=!1,L.current=null,z.current=null,R.current!=null&&(R.current.setAttribute(`draggable`,`true`),R.current.style.removeProperty(`touch-action`),R.current=null),At(),kt(),jt(),ne.current=null},Pt=(e,n)=>{let r=S.current?.getRootNode(),i=Tg(Cg(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Ft=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){kt();return}let r=t.getItem(e.directoryPath),i=jg(r)?r:null;if(i==null||i.isExpanded()){kt();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;F.current!==a&&(kt(),F.current=a,I.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},It=()=>{P.current=null;let e=ee.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=Og(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),Ft(Pt(e.clientX,e.clientY)),P.current=Dt(It)},Lt=(e,t)=>{ee.current={clientX:e,clientY:t},P.current??=Dt(It)},Rt=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(Nt(),At(),kt(),jt(),t.startDrag(r)===!1){e.preventDefault();return}if(ne.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),Dg())){let t=Eg(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),Mt(t),te.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},zt=()=>{At(),kt(),jt(),ne.current=null,t.cancelDrag()},Bt=(e,n,r)=>{if(ae.current!=null||ie.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;z.current={clientX:i.clientX,clientY:i.clientY},R.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!ie.current;ae.current!=null&&(clearTimeout(ae.current),ae.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),re.current===o&&(re.current=null),t&&(a.setAttribute(`draggable`,`true`),R.current===a&&(R.current=null),z.current=null)},s=e=>{let t=e.touches[0],n=z.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=bg*bg||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),re.current=o,ae.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),R.current===a&&(R.current=null),z.current=null;return}ie.current=!0,R.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),ne.current=n;let e=a.getBoundingClientRect(),s=Eg(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),Mt(s),te.current=s,L.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=L.current;n!=null&&te.current!=null&&(te.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Ft(Pt(t.clientX,t.clientY)),Lt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&Pt(n.clientX,n.clientY),t.completeDrag(),Nt()},u=()=>{t.cancelDrag(),Nt()};re.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},yg)},Vt=e=>{if(B!=null){if(e.key===`Escape`){xt(),e.preventDefault(),e.stopPropagation();return}Ug.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(qe.isActive()){if(e.key===`Escape`)qe.cancel();else if(e.key===`Enter`)qe.commit();else return;he(`focus`),se(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){wt(U??void 0),e.preventDefault(),e.stopPropagation();return}if(Xe){if(e.key===`Escape`)M.current=!1,N.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=Pg(n,st);N.current=W<0||n==null?null:Math.max(0,Math.min(W*s-n.scrollTop,Math.max(0,r-s))),M.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;he(`focus`),se(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&Ng(e)){t.openSearch(e.key),se(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ie&&Vg(e),r=Hg(e,Ie),i=r&&S.current!=null?fg(S.current):null,a=r?new Set(Xg(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==U&&a.has(o)){let e=C.current;Te(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=jg(p)?p:null,h=u!=null&&(pt.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=Yg(u,E.current,T.current);e==null||n==null?y=!1:Ct(e,u)}else if((e.ctrlKey||e.metaKey)&&Mg(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;he(`focus`);let b=t.getFocusedPath(),x=b!=null&&(pt.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))Te(b,v?.scrollTop??null),k.current=!0,le(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(Ee(b,Qg(S.current,v,i,u,s,ft,st)),k.current=!0,le(e=>e===b?e:b)):we()}se(e=>e+1),e.preventDefault(),e.stopPropagation()};tg(()=>{if(!(!f||!Xe)){if(De.current){De.current=!1;return}dg(w.current)}},[Xe,f]),tg(()=>{let e=x.current;switch(Mh({hasRenderedInput:e!=null,previousRenamingPath:j.current,renamingPath:Je})){case`reset`:j.current=null;return;case`reveal-canonical`:Je!=null&&Tt(Je,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(V.current=null,j.current=Je,dg(e),e.select());return}},[ct.end,ct.start,Je,Tt,pt]),tg(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=fg(e)?.dataset.itemPath??null;le(e=>e===t?e:t)},i=()=>{n(),k.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,fg(e)!=null){r();return}k.current=!1,le(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),k.current=!1,le(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;le(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),tg(()=>{let e=S.current;e!=null&&(at.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[at.physical.scrollTop]),tg(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=Pg(n,g);let a=()=>{let e=t.getVisibleCount(),r=Fg(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),Ne(vg({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};D.current=a;let o=!1,l=t.subscribe(()=>{o?se(e=>e+1):o=!0,a()}),u=()=>{Ce.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,_e(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||Ce.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),ye.current!=null&&y.current&&bt.current(),Ce.current===!0){y.current=!1;return}de(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:Ig(e[0]))??Pg(n,g),a()}):null;return w?.observe(n),()=>{D.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,w?.disconnect()}},[t,g,s,c,h]),tg(()=>{Ie||B==null||xt(!1)},[xt,Ie,B]);let Ht=ng(()=>B==null?null:`${B.path}::${B.source}`,[B]);tg(()=>{if(Ht==null){m?.clearSlotContent(oc);return}let t=ye.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??Gg(n.getBoundingClientRect()),close:e=>{bt.current(e?.restoreFocus??!0)},restoreFocus:()=>{yt.current&&vt.current(ye.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(oc,i),e?.contextMenu?.onOpen?.(t.item,r),i_(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&i_(i)}),()=>{m?.clearSlotContent(oc)}},[Ht,e?.contextMenu,m]),tg(()=>{B!=null&&t.getItem(B.path)==null&&xt()},[xt,B,t]),tg(()=>{if(B==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(Wg(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&xt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),xt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[xt,B]),tg(()=>{let e=C.current,t=S.current;if(e==null||t==null){A.current=U;return}let n=U==null?null:T.current.get(U)??null,r=fg(t),i=r?.dataset.itemPath??null,a=Ye&&x.current===r,o=f&&w.current===r,c=M.current&&!Xe,l=N.current??0,u=V.current,d=be.current,p=H.current,m=xe.current,h=r!=null,g=k.current||h,_=A.current!==U,v=d!=null&&d===U&&U!=null,y=c&&Rg(e,W,s,st,dt,l),b=u!=null&&u===U&&Rg(e,W,s,st,dt,ft),E=p!=null&&p.path===U&&Rg(e,W,s,st,dt,p.viewportOffset),O=m!=null&&m.path===U&&e.scrollTop!==m.scrollTop;if(O&&(e.scrollTop=m.scrollTop),(O||b||E||y||g&&_&&u!==U&&!v&&Lg(e,W,s,st,ft))&&D.current(),!g){A.current=U;return}if(a){A.current=U;return}if(o&&!c){A.current=U;return}if(n==null){c&&W>=0&&(Rg(e,W,s,st,dt,l),D.current()),A.current=U;return}(_||c||u===U||d===U||p?.path===U||m?.path===U||i==null||i!==U)&&(dg(n),u===U&&(V.current=null),d===U&&(be.current=null),p?.path===U&&(H.current=null),m?.path===U&&(xe.current=null),M.current=!1,N.current=null),A.current=U},[t,W,U,mt,s,Ye,Xe,ct,st,f,ft,dt,ot]);let Ut=W>=0&&W>=at.visible.startIndex&&W<=at.visible.endIndex,Wt=U!=null&&lt.some(e=>hg(e.row)===U),Gt=Ut||Wt,Kt=Re&&k.current===!0&&Gt?U:null,qt=me===`pointer`?ue:null,Jt=B?.path??Se.current??qt??Kt??ue,Yt=B?.source===`right-click`;tg(()=>{y.current&&B==null||St(We(Jt))},[B,We,ct,st,ge,lt,Jt,St,ot]);let Xt=rg(e=>{if(y.current||Wg(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&he(e=>e===`pointer`?e:`pointer`),de(e=>e===i?e:i)},[]),Zt=rg(()=>{de(null)},[]);tg(()=>{if(!Qe)return;let e=()=>{Nt(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),Nt(),t.cancelDrag()}},[t,Qe]);let Qt=e=>{if(!Qe||t.getDragSession()==null||ie.current)return;let n=Tg(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Ft(t.getDragSession()?.target??null),Lt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},$t=e=>{if(!Qe||t.getDragSession()==null||ie.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(kt(),jt(),t.setDragTarget(null))},en=e=>{!Qe||t.getDragSession()==null||ie.current||(e.preventDefault(),Pt(e.clientX,e.clientY),t.completeDrag(),At(),kt(),jt(),ne.current=null)},tn=at.window.height,nn=at.window.offsetTop,rn=Math.min(0,st-tn-ft),an=ce===U||M.current,on=U!=null&&an&&!mt&&W>=0?ot[W]??t.getVisibleRows(W,W)[0]??null:null,sn=on==null?null:zg(W,s,ct,tn),cn=ne.current,ln=G!=null&&cn!=null&&cn.path===G&&cn.index>=ct.start&&cn.index<=ct.end,un=G!=null&&cn!=null&&cn.path===G&&!ln&&cn.path!==on?.path?cn:null,dn=un==null?null:zg(un.index,s,ct,tn),fn=Bg((W>=0?ot[W]??t.getVisibleRows(W,W)[0]??null:null)?.ancestorPaths.at(-1)??null),pn=Xe&&U!=null?t_(o,U,!mt):void 0,mn=B?.path??(Xe?U:ce),hn=B?.path??ue,gn=We(Jt),_n=Ie&&Re&&!Yt&&!Ye&&gn!=null&&fe!=null&&Jt!=null,vn=Ie&&(_n||B!=null),yn=B?.anchorRect,bn=yn==null&&gn!=null&&fe!=null&&(B!=null||_n)?fe:null,xn=yn==null?bn==null?void 0:{top:`${bn}px`}:{left:`${yn.left}px`,position:`fixed`,right:`auto`,top:`${yn.top}px`},Sn=Yt?{opacity:`0`}:void 0,Cn=rg((e,n,r,i)=>{let a=t.getItem(r),o=Ph({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:t.isSearchOpen(),mode:i});switch(o.selection.kind){case`range`:t.selectPathRange(r,o.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(r);break;case`single`:t.selectOnlyPath(r);break}let s=e.currentTarget instanceof HTMLElement?e.currentTarget:null,c=n.index>=at.visible.startIndex&&n.index<=at.visible.endIndex,l=i===`flow`&&c&&s!=null&&s.dataset.itemParked!==`true`;a?.focus(),l&&(k.current=!0,le(e=>e===r?e:r),he(`focus`)),o.toggleDirectory&&jg(a)&&a.toggle(),o.closeSearch&&t.closeSearch(),o.revealCanonical&&Tt(r,{targetOffset:`sticky-parents`})},[t,at.visible.endIndex,at.visible.startIndex,Tt]),wn=()=>{if(y.current||!Re||Jt==null||gn==null)return;let e=t.getItem(Jt);e!=null&&(St(gn),yt.current=!0,ve({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:gn.getAttribute(`aria-label`)??Jt,path:e.getPath()},path:e.getPath(),source:`button`}))},Tn={contextHoverPath:hn,contextMenuButtonTriggerEnabled:Re,contextMenuButtonVisibility:ze,contextMenuEnabled:Ie,contextMenuRightClickEnabled:Be,contextMenuTriggerMode:Le,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Qe,draggedPathSet:et,dragTarget:tt,gitLaneActive:Ge,gitStatusByPath:n,handleRowDragEnd:zt,handleRowDragStart:Rt,handleRowTouchStart:Bt,ignoredGitDirectories:r,ignoredInheritanceCache:oe,instanceId:o,itemHeight:s,onKeyDown:Vt,onRowClick:Cn,openContextMenuForRow:Ct,registerButton:Ve,registerRenameInput:Ue,renameView:qe,renderDecorationForRow:ht,resolveIcon:Ke,shouldSuppressContextMenu:Et,visualFocusPath:mn},En={...Tn,registerButton:He};return Q(`div`,{ref:S,id:nt,"data-file-tree-context-menu-button-visibility":Ie&&Re?ze:void 0,"data-file-tree-context-menu-trigger-mode":Ie?Le:void 0,"data-file-tree-has-context-menu-action-lane":Ie&&Re?`true`:void 0,"data-file-tree-has-git-lane":Ge?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:Qe?$t:void 0,onDragOver:Qe?Qt:void 0,onDrop:Qe?en:void 0,onKeyDown:Vt,onPointerLeave:Ie?Zt:void 0,onPointerOver:Ie?Xt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[Q(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:fn}}),Q(`slot`,{name:ac,"data-type":`header-slot`}),f?Q(`div`,{"data-file-tree-search-container":!0,"data-open":Xe?`true`:`false`,children:Q(`input`,{ref:w,"aria-activedescendant":pn,"aria-controls":nt,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Oe?`true`:void 0,value:Ze,onBlur:()=>{d===`retain`&&!Ae.current||t.closeSearch()},onFocus:je,onPointerDown:je,onInput:e=>{je();let n=e.currentTarget;t.setSearch(n.value)}})}):null,Q(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Pe&&lt.length>0?Q(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:Q(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${rt}px`},children:lt.map((e,t)=>o_(En,e.row,`sticky:${hg(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${lt.length-t}`}}))})}):null,Q(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${dt}px`},children:[Q(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${nn}px`}}),Q(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${tn}px`,top:`${rn}px`,bottom:`${rn}px`},children:[s_(Tn,ct,pt),on!=null&&sn!=null?o_(Tn,on,`parked:${on.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:G===on.path?`none`:void 0,position:`absolute`,right:`0`,top:`${sn}px`}}):null,un!=null&&dn!=null?o_(Tn,un,`parked-drag:${un.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${dn}px`}}):null]})]})]}),Ie?Q(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":vn?`true`:`false`,style:xn,children:[Q(`button`,{ref:v,type:`button`,"data-type":sc,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":B==null?`false`:`true`,"data-visible":_n?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),B!=null){xt();return}wn()},tabIndex:-1,style:Sn,children:Q(ih,{...Ke(`file-tree-icon-ellipsis`)})}),B==null?null:Q(`slot`,{name:oc})]}):null,B==null?null:Q(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),xt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),xt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var l_={hydrateRoot:(e,t)=>{$m(km(c_,t),e)},renderRoot:(e,t)=>{Qm(km(c_,t),e)},unmountRoot:e=>{Qm(null,e)}};function u_(e,t){l_.renderRoot(e,t)}function d_(e,t){l_.hydrateRoot(e,t)}function f_(e){l_.unmountRoot(e)}var p_=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}},m_=`__c`,h_=`__k`,g_=`__d`,__=`__s`,v_=/[\s\n\\/='"\0<>]/,y_=/^(xlink|xmlns|xml)([A-Z])/,b_=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,x_=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,S_=new Set([`draggable`,`spellcheck`]);function C_(e){e.__g===void 0?e[g_]=!0:e.__g|=8}function w_(e){e.__g===void 0?e[g_]=!1:e.__g&=-9}function T_(e){return e.__g===void 0?!0===e[g_]:!!(8&e.__g)}var E_=/["&<]/;function D_(e){if(e.length===0||!1===E_.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`&quot;`;break;case 38:i=`&amp;`;break;case 60:i=`&lt;`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var O_={},k_=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),A_=/[A-Z]/g;function j_(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:O_[n]||(O_[n]=n.replace(A_,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||k_.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function M_(){this.__d=!0}function N_(e,t){return{__v:e,context:t,props:e.props,setState:M_,forceUpdate:M_,__d:!0,__h:[]}}function P_(e,t,n){if(!e.s){if(n instanceof F_){if(!n.s)return void(n.o=P_.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(P_.bind(null,e,t),P_.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var F_=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{P_(r,1,a(this.v))}catch(e){P_(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?P_(r,1,t?t(i):i):n?P_(r,1,n(i)):P_(r,2,i)}catch(e){P_(r,2,e)}},r},e}(),I_,L_,R_,z_,B_={},V_=Array.isArray,H_=Object.assign,U_=``,W_=`<!--$s-->`,G_=`<!--/$s-->`;function K_(e,t){var n,r=e.type,i=!0;return e[m_]?(i=!1,(n=e[m_]).state=n[__]):n=new r(e.props,t),e[m_]=n,n.__v=e,n.props=e.props,n.context=t,C_(n),n.state??=B_,n[__]??(n[__]=n.state),r.getDerivedStateFromProps?n.state=H_({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[__]===n.state?n.state:n[__]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),R_&&R_(e),n.render(n.props,n.state,t)}function q_(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===U_)return U_;var s=typeof e;if(s!=`object`)return s==`function`?U_:s==`string`?D_(e):e+U_;if(V_(e)){var c,l=U_;i[h_]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=q_(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=U_,V_(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return U_;e.__=i,I_&&I_(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===jm){if(`tpl`in g){for(var x=U_,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!V_(C)?x+=C:x+=q_(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+D_(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var w=t[_.__c];b=w?w.props.value:_.__}var T=h.prototype&&typeof h.prototype.render==`function`;if(T)v=K_(e,b),y=e[m_];else{e[m_]=y=N_(e,b);for(var E=0;T_(y)&&E++<25;){w_(y),R_&&R_(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}C_(y)}if(y.getChildContext!=null&&(t=H_({},t,y.getChildContext())),T&&Z.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===jm&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return q_(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[__]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,B_),T_(y)?(v=K_(e,t),(y=e[m_]).getChildContext!=null&&(t=H_({},t,y.getChildContext())),q_(v=v!=null&&v.type===jm&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):U_}finally{L_&&L_(e),z_&&z_(e)}}}v=v!=null&&v.type===jm&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=q_(v,t,n,r,e,a,o);return L_&&L_(e),Z.unmount&&Z.unmount(e),e._suspended?typeof D==`string`?W_+D+G_:V_(D)?(D.unshift(W_),D.push(G_),D):D.then(function(e){return W_+e+G_}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return q_(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=Z.__e;return k&&k(i,e),U_}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=q_(v,t,n,r,e,a,o);return e._suspended?W_+s+G_:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=U_;for(var N in g){var P=g[N];if(typeof(P=Y_(P)?P.value:P)!=`function`||N===`class`||N===`className`){switch(N){case`children`:A=P;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;N=`for`;break;case`className`:if(`class`in g)continue;N=`class`;break;case`defaultChecked`:N=`checked`;break;case`defaultSelected`:N=`selected`;break;case`defaultValue`:case`value`:switch(N=`value`,h){case`textarea`:A=P;continue;case`select`:r=P;continue;case`option`:r!=P||`selected`in g||(j+=` selected`)}break;case`dangerouslySetInnerHTML`:M=P&&P.__html;continue;case`style`:typeof P==`object`&&(P=j_(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(y_.test(N))N=N.replace(y_,`$1:$2`).toLowerCase();else{if(v_.test(N))continue;N[4]!==`-`&&!S_.has(N)||P==null?n?x_.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):b_.test(N)&&(N=N.toLowerCase()):P+=U_}}P!=null&&!1!==P&&(j=!0===P||P===U_?j+` `+N:j+` `+N+`="`+(typeof P==`string`?D_(P):P+U_)+`"`)}}if(v_.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=D_(A):A!=null&&!1!==A&&!0!==A&&(M=q_(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),L_&&L_(e),z_&&z_(e),!M&&J_.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return V_(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var J_=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function Y_(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var X_=0;function Z_(e){return e!=null&&e.length>0?e:(X_+=1,`pst_ft_${X_}`)}function Q_({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??kl)}function $_(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function ev(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function tv(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var nv=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new p_;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=Z_(a),this.#p=cm(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=Ol(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new rm({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(f_(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),u_(t.wrapper,this.#w()))}setGitStatus(e){this.#p=cm(e,this.#p);let t=this.#T();t!=null&&u_(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),u_(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),d_(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),u_(r,this.#w())}#C(){return{initialViewportHeight:Q_({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(ac,e());return}this.#l.setSlotHtml(ac,this.#e?.header?.html??null)}#k(e){let t=tv(e).find(e=>ev(e)),n=$_(xl(El(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=tv(e),n=t.find(e=>ev(e)),r=t.filter(e=>e!==n),i=El(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=$_(i);if(a==null){for(let e of r)e.remove();return}if(!(r.length===1&&r[0].outerHTML===a.outerHTML)){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=El(this.#m);t.colored&&Cl(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${tc}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}this.#g?.parentNode===e&&this.#_===this.#h||(this.#g??=document.createElement(`style`),this.#g.setAttribute(tc,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=Nl(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return zl(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}};function rv(e){let t=(0,K.useRef)(null);return t.current??=new nv(e),(0,K.useEffect)(()=>{let e=t.current;return()=>{e?.cleanUp(),t.current=null}},[]),{model:t.current}}var iv={"--trees-accent-override":`var(--ring)`,"--trees-bg-muted-override":`color-mix(in srgb, var(--muted) 45%, transparent)`,"--trees-bg-override":`transparent`,"--trees-border-color-override":`var(--border)`,"--trees-fg-muted-override":`var(--muted-foreground)`,"--trees-fg-override":`var(--foreground)`,"--trees-focus-ring-color-override":`var(--ring)`,"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`var(--text-sm)`,"--trees-item-margin-x-override":`0`,"--trees-padding-inline-override":`0`,"--trees-scrollbar-thumb-override":`color-mix(in srgb, var(--muted-foreground) 35%, transparent)`,"--trees-selected-bg-override":`color-mix(in srgb, var(--accent) 65%, transparent)`,"--trees-selected-fg-override":`var(--foreground)`,"--trees-selected-focused-border-color-override":`var(--ring)`,height:`100%`};function av({controller:e,filesError:t,isFilesLoading:n}){let{closeSearch:r,filteredFiles:i,isSearchOpen:a,loadedFiles:o,model:s,searchQuery:c,setSearchQuery:l}=e,u=vr(),d=(0,K.useRef)(null);(0,K.useEffect)(()=>{a&&d.current?.focus()},[a]);let f=(0,K.useMemo)(()=>({...iv,colorScheme:u}),[u]),p;return p=t?(0,q.jsx)(Jn,{message:t.message,messageClassName:`text-destructive`}):n&&o.length===0?(0,q.jsx)(Jn,{icon:`Spinner`,message:`Loading files...`,iconClassName:`animate-spin`}):o.length===0?(0,q.jsx)(Jn,{message:`No files yet.`}):i.length===0?(0,q.jsx)(Jn,{message:`No files match search.`}):(0,q.jsx)(pc,{"aria-label":`Thread storage file tree`,className:`block h-full min-h-0`,model:s,style:f}),(0,q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-1`,children:[a?(0,q.jsxs)(`div`,{className:`flex h-7 shrink-0 items-center gap-2`,children:[(0,q.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,q.jsx)(L,{name:`Search`,className:`pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,q.jsx)(Xe,{ref:d,"aria-label":`Search files`,className:`h-7 pl-7 pr-2 text-xs focus-visible:ring-0`,placeholder:`Search files`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),r())}})]}),(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0 rounded-md p-0 text-muted-foreground`,"aria-label":`Close search`,onClick:r,children:(0,q.jsx)(L,{name:`X`,className:`size-3.5`})})]}):null,(0,q.jsx)(`div`,{className:`min-h-0 flex-1`,children:p})]})}function ov(e){return e?.type===`standard`&&e.parentThreadId===null}function sv({currentThreadId:e,isManagerThread:t,managerThreads:n,parentThreadDisplayName:r,parentThreadId:i}){if(!e||t)return[];let a=[{value:`none`,label:`None`}],o=new Set([`none`]),s=(t,n)=>{!t||t===e||o.has(t)||(o.add(t),a.push({value:t,label:n}))};s(i??void 0,r??`Manager`);for(let e of n)s(e.id,e.title?.trim()?e.title:`Manager`);return a}function cv({thread:e,projectId:t,parentThreadDisplayName:n,managerThreads:r,canAssignToManager:i,canTakeOverThread:a,updateThreadPending:o,onAssignManager:s,defaultOpen:c}){let l=e.type===`manager`,u=e.parentThreadId??void 0,d=(0,K.useMemo)(()=>sv({currentThreadId:e.id,isManagerThread:l,managerThreads:r,parentThreadDisplayName:n,parentThreadId:u}),[l,r,n,u,e.id]),f=u??`none`,p=d.find(e=>e.value===f)?.label;return l||!u&&!i&&!a?null:(0,q.jsx)(Wt,{label:`Manager`,valueClassName:`min-w-0`,children:u?(0,q.jsxs)(`div`,{className:`inline-flex max-w-full min-w-0 items-center gap-1 text-xs text-foreground`,children:[(0,q.jsx)(qe,{to:`/projects/${t}/threads/${u}`,className:`min-w-0 truncate text-xs text-foreground no-underline transition-[text-decoration-color] duration-150 hover:underline hover:underline-offset-2`,children:p??`Manager`}),(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`size-3.5 shrink-0 rounded-full p-0 text-muted-foreground hover:bg-transparent hover:text-foreground [&_svg]:size-3`,disabled:o,onClick:()=>{s(null)},"aria-label":`Unassign manager`,children:(0,q.jsx)(L,{name:`X`})})]}):(0,q.jsxs)(B,{defaultOpen:c,children:[(0,q.jsx)(ge,{asChild:!0,children:(0,q.jsxs)(`div`,{role:`button`,tabIndex:o||d.length<=1&&f===`none`?-1:0,className:`inline-flex w-fit max-w-full min-w-0 items-center gap-1 rounded-md px-0 text-xs leading-tight text-foreground outline-none ring-sidebar-ring transition-colors hover:text-foreground focus-visible:ring-2`,children:[(0,q.jsx)(`span`,{className:`min-w-0 truncate text-xs text-foreground`,children:p??`None`}),(0,q.jsx)(L,{name:`ChevronDown`,className:`size-3.5 shrink-0 text-muted-foreground`})]})}),(0,q.jsxs)(ye,{align:`start`,className:`min-w-40 max-w-72`,children:[(0,q.jsx)(ve,{children:`Assign to manager`}),d.map(e=>(0,q.jsxs)(he,{onSelect:()=>{s(e.value===`none`?null:e.value)},className:`flex items-center justify-between gap-3`,children:[(0,q.jsx)(`span`,{className:`truncate`,title:e.label,children:e.label}),(0,q.jsx)(L,{name:`Check`,className:f===e.value?R(`opacity-100`,H):R(`opacity-0`,H)})]},e.value))]})]})})}function lv({thread:e}){return e.type===`manager`?(0,q.jsx)(Wt,{label:`Kind`,valueClassName:`min-w-0 truncate`,children:`Manager`}):null}function uv({environmentHost:e,environment:t,environmentIsLocal:n}){if(!e)return null;let r=t?n:void 0,i=e.status===`connected`;return(0,q.jsx)(Wt,{label:`Host`,valueClassName:`min-w-0 truncate`,children:(0,q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,q.jsx)(`span`,{className:`truncate`,children:e.name}),r?(0,q.jsx)(mt,{}):null,(0,q.jsx)(On,{connected:i})]})})}function dv({thread:e,environment:t,environmentHost:r,environmentIsLocal:i}){let a=yn({projectId:e.projectId,environmentId:t?.id??``});if(e.type===`manager`||!t)return null;let o=n({environment:t,isLocalHost:i,hostName:r?.name}),s=fv(t);return(0,q.jsx)(Wt,{label:`Environment`,valueClassName:`min-w-0`,children:(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,q.jsx)(`span`,{className:`min-w-0 truncate`,children:o.modeLabel}),s?(0,q.jsx)(`button`,{type:`button`,"aria-label":`Create new thread in this worktree`,title:`New thread in this worktree`,onClick:a,className:`inline-flex shrink-0 items-center justify-center rounded-md p-0.5 text-muted-foreground transition-colors hover:bg-state-hover hover:text-foreground`,children:(0,q.jsx)(L,{name:`MessageSquarePlus`,className:`size-4`})}):null]})})}function fv(e){return e.isWorktree||e.workspaceProvisionType===`managed-worktree`}function pv({thread:e,environment:t}){return e.type===`manager`||!t?.path||!fv(t)?null:(0,q.jsx)(Wt,{label:`Worktree path`,valueClassName:`min-w-0`,children:(0,q.jsx)(Ft,{text:t.path,label:`Copy worktree path`,title:t.path,successMessage:`Worktree path copied`,errorMessage:`Failed to copy worktree path`})})}function mv({thread:e,workspaceStatus:t}){let n=t?.branch.currentBranch??null;return e.type===`manager`||!n?null:(0,q.jsx)(Wt,{label:`Branch`,valueClassName:`min-w-0 truncate`,children:(0,q.jsx)(Ft,{text:n,label:`Copy branch name`,successMessage:`Branch name copied`,errorMessage:`Failed to copy branch name`})})}function hv({thread:e,workspaceStatus:t,selectedMergeBaseBranch:n,mergeBaseBranchOptions:r,isLoadingMergeBaseBranchOptions:i,onMergeBaseBranchChange:a,defaultOpen:o}){let s=n??t?.mergeBase?.mergeBaseBranch??t?.branch.defaultBranch,c=s,l=(0,K.useMemo)(()=>Un({mergeBaseBranch:c,mergeBaseBranchOptions:r}),[c,r]),u=!!(s||t?.branch.defaultBranch),d=t?.branch.currentBranch!=null&&t.branch.currentBranch===t.branch.defaultBranch,f=u&&!!c&&!d;return e.type===`manager`||!f?null:(0,q.jsx)(Wt,{label:`Merge base`,valueClassName:`min-w-0 truncate`,children:c&&l.length>0&&c?(0,q.jsx)(Xn,{value:c,options:l,variant:`minimal`,loading:i,onChange:a,className:`max-w-full`,defaultOpen:o}):c})}function gv({thread:e,environment:t,workspaceStatus:n,workspaceStatusError:r,selectedMergeBaseBranch:i}){let a=e.type!==`manager`,o=t?.status===`destroyed`;if(!(a&&(n||r||o)&&!(e.archivedAt!=null&&t?.managed!==!0)))return null;let s=i??n?.mergeBase?.mergeBaseBranch??n?.branch.defaultBranch,c=oa(n,{mergeBaseBranch:s,showBranchComparison:!!(s||n?.branch.defaultBranch),error:r,workspaceDeleted:o}),l=n?.workingTree.state===`untracked`?`text-muted-foreground`:`text-foreground`;return(0,q.jsx)(Wt,{label:`Git status`,align:`start`,valueClassName:`min-w-0`,children:(0,q.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2 whitespace-nowrap`,title:`${c.label} ${c.summary}`,children:[(0,q.jsx)(`span`,{className:R(`shrink-0 font-medium`,l),children:c.label}),(0,q.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:c.summaryContent})]})})}function _v({thread:e}){let t=Se(),n=t.isPending&&t.variables?.id===e.id,r=(0,K.useCallback)(()=>{t.mutate({id:e.id})},[e.id,t]);return e.archivedAt==null?null:(0,q.jsx)(Wt,{label:`Archived`,valueClassName:`min-w-0 truncate`,children:(0,q.jsx)(br,{isPending:n,onUnarchive:r,threadType:e.type})})}function vv({thread:e,workspaceStatus:t,onChangedFileClick:n}){return e.type===`manager`?null:(0,q.jsx)(Di,{sections:Ci(t),onFileClick:n,rowClassName:`min-h-0 flex-1`,rowValueClassName:`min-h-0 flex-1`,listClassName:`h-full`})}function yv({controller:e,filesError:t,isFilesLoading:n}){let{isSearchOpen:r,openSearch:i}=e;return(0,q.jsx)(Wt,{orientation:`vertical`,className:`min-h-0 flex-1`,valueClassName:`min-h-0 flex-1 overflow-hidden`,labelClassName:`flex items-center justify-between gap-2`,label:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{children:`Manager workspace`}),r?null:(0,q.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`h-5 w-5 shrink-0 rounded-md p-0 text-muted-foreground`,"aria-label":`Search files`,onClick:i,children:(0,q.jsx)(L,{name:`Search`,className:`size-3.5`})})]}),children:(0,q.jsx)(av,{controller:e,filesError:t,isFilesLoading:n})})}function bv({thread:e,parentThreadDisplayName:t,environment:n,workspaceStatus:r,workspaceStatusError:i}){let a=e.type===`manager`,o=e.parentThreadId??void 0,s=!a,c=n?.status===`destroyed`,l=s&&(!!r||!!i||c)&&!(e.archivedAt!=null&&n?.managed!==!0),u=r?.branch.currentBranch??null,d=Ci(r),f=s&&d.length>0;return!!(a||o||!a&&n||!a&&u||l||f||e.archivedAt!=null||t&&o)}function xv({hasFlexibleHeight:e,children:t}){return(0,q.jsx)(In,{className:R(`h-full min-h-0 rounded-none border-0 bg-transparent px-0 py-0`,e?`flex-1`:`shrink-0`),children:t})}function Sv(e){let{thread:t,projectId:n,parentThreadDisplayName:r,managerThreads:i,canAssignToManager:a,canTakeOverThread:o,environmentHost:s,environmentIsLocal:c,environment:l,workspaceStatus:u,workspaceStatusError:d,selectedMergeBaseBranch:f,mergeBaseBranchOptions:p,isLoadingMergeBaseBranchOptions:m,updateThreadPending:h,storage:g,onAssignManager:_,onMergeBaseBranchChange:v,onChangedFileClick:y}=e;return(0,q.jsxs)(xv,{hasFlexibleHeight:g!==void 0||t.type!==`manager`&&Ci(u).length>0,children:[(0,q.jsx)(lv,{thread:t}),(0,q.jsx)(cv,{thread:t,projectId:n,parentThreadDisplayName:r,managerThreads:i,canAssignToManager:a,canTakeOverThread:o,updateThreadPending:h,onAssignManager:_}),(0,q.jsx)(uv,{environmentHost:s,environment:l,environmentIsLocal:c}),(0,q.jsx)(dv,{thread:t,environment:l,environmentHost:s,environmentIsLocal:c}),(0,q.jsx)(pv,{thread:t,environment:l}),(0,q.jsx)(mv,{thread:t,workspaceStatus:u}),(0,q.jsx)(hv,{thread:t,workspaceStatus:u,selectedMergeBaseBranch:f,mergeBaseBranchOptions:p,isLoadingMergeBaseBranchOptions:m,onMergeBaseBranchChange:v}),(0,q.jsx)(gv,{thread:t,environment:l,workspaceStatus:u,workspaceStatusError:d,selectedMergeBaseBranch:f}),(0,q.jsx)(_v,{thread:t}),(0,q.jsx)(vv,{thread:t,workspaceStatus:u,onChangedFileClick:y}),g?(0,q.jsx)(yv,{...g}):null]})}function Cv({children:e,className:t}){return(0,q.jsx)(`div`,{className:R(`flex min-w-0 flex-col gap-1`,t),children:e})}function wv({stopRequestedAt:e,threadId:t}){return{id:`${t}:pending-stop:${e}`,threadId:t,turnId:null,sourceSeqStart:0,sourceSeqEnd:0,startedAt:e,createdAt:e,kind:`system`,systemKind:`operation`,operationKind:`thread-interrupted`,title:`Stop requested`,detail:null,status:`pending`,completedAt:null}}function Tv(e,t){return e.some(e=>e.kind===`system`&&e.systemKind===`operation`&&e.operationKind===`thread-interrupted`&&e.createdAt>=t)}function Ev({rows:e,stopRequestedAt:t,threadId:n}){return(0,K.useMemo)(()=>t===null||Tv(e,t)?e:[...e,wv({stopRequestedAt:t,threadId:n})],[e,t,n])}function Dv({activeThinking:e,footer:t,hasOlderTimelineRows:n,header:r,hostConnectionNotice:i,isLoadingOlderTimelineRows:a,isThreadTimelinePending:o,timelineError:s,loadingTurnSummaryIds:c,erroredTurnSummaryIds:l,onLoadOlderRows:u,onLoadTurnSummaryRows:d,onOpenLocalFileLink:f,onTitleAction:p,projectId:m,showOngoingIndicator:h,ongoingIndicatorLabel:g,stopRequestedAt:_,timelineRows:v,threadId:y,threadRuntimeDisplayStatus:b,turnSummaryRowsIdentity:x,turnSummaryRowsById:S,unreadDividerPlacement:C,workspaceRootPath:w}){let T=vr(),E=e!==null&&g===void 0,D=e?.text.trim()??``,O=E&&D.length>0?e?.text:void 0,k=E&&e?e.id:g??`working`,A=Ev({rows:v,stopRequestedAt:_,threadId:y});return(0,q.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,children:[r,(0,q.jsx)(z,{scrollBehavior:`bottom-anchor`,shellClassName:`!mx-0 !mt-0 md:!mx-0 md:!mt-0`,contentClassName:`min-h-full gap-2 pt-4`,footerClassName:`chat-prompt-box`,footer:t,children:(0,q.jsxs)(Cv,{className:`flex-1`,children:[n&&!o&&!s?(0,q.jsx)(Ov,{isLoadingOlderTimelineRows:a,onLoadOlderRows:u}):null,o?(0,q.jsx)(kv,{}):s?(0,q.jsx)(qt,{label:`Failed to load timeline`,className:`mt-6 text-destructive`}):A.length>0?(0,q.jsx)(Rn,{loadingTurnSummaryIds:c,erroredTurnSummaryIds:l,onLoadTurnSummaryRows:d,onOpenLocalFileLink:f,onTitleAction:p,projectId:m,resolveUserAttachmentImageSrc:gn,themeType:T,timelineRows:A,threadRuntimeDisplayStatus:b,turnSummaryRowsIdentity:x,turnSummaryRowsById:S,unreadDividerPlacement:C,workspaceRootPath:w}):null,i?(0,q.jsx)(qt,{label:i.label,className:i.tone===`error`?`mt-4 text-destructive`:`mt-4`}):null,(0,q.jsx)(St,{visible:h,children:(0,q.jsx)(Et,{details:O,isThinking:E,label:g},k)})]})},y)]})}function Ov({isLoadingOlderTimelineRows:e,onLoadOlderRows:t}){let n=ie();return(0,q.jsx)(`div`,{className:`flex justify-center pt-2 mb-3`,children:(0,q.jsxs)(j,{type:`button`,variant:`outline`,size:`sm`,onClick:(0,K.useCallback)(()=>{n?.captureScrollAnchor(),t()},[n,t]),disabled:e,children:[(0,q.jsx)(L,{name:`ChevronUp`,"aria-hidden":`true`}),e?`Loading older messages...`:`Load older messages`]})})}function kv(){let[e,t]=(0,K.useState)(!1);return(0,K.useEffect)(()=>{let e=window.setTimeout(()=>t(!0),200);return()=>window.clearTimeout(e)},[]),e?(0,q.jsx)(qt,{label:`Loading thread...`,className:`mt-6`}):null}var Av=100,jv=`duration-[220ms] ease-[cubic-bezier(0.32,0.72,0,1)]`;function Mv({footer:e,header:t,isMetadataLoading:n,isSecondaryPanelOpen:r,metadata:i,onTerminalPanelResize:a,secondaryPanel:o,terminalPanel:s,terminalPanelHeightPercent:c,terminalPanelOpen:l,timeline:u}){let d=me(),f=dt(ca),p=(0,K.useRef)(null),m=(0,K.useRef)(c),h=(0,K.useRef)(!1);(0,K.useEffect)(()=>{if(!h.current){h.current=!0;return}let e=p.current;e&&(l?e.expand(m.current):e.collapse())},[l]);let g=(0,K.useCallback)(e=>{e<=0||(m.current=e,a(e))},[a]),_=bv(i)?(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:(0,q.jsx)(Sv,{...i})}):n?(0,q.jsx)(Fv,{}):(0,q.jsx)(`div`,{className:`pt-1 text-sm text-muted-foreground`,children:`No thread details available.`}),v=d?null:(0,q.jsx)(Xs,{...o,renderAsDrawer:!1,metadataContent:_}),y=d?(0,q.jsx)(Xs,{...o,renderAsDrawer:!0,metadataContent:_}):null;return(0,q.jsxs)(`div`,{className:`-mx-4 -mb-4 -mt-4 flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden md:-mx-5 md:-mb-5 md:-mt-5`,children:[(0,q.jsxs)(Bo.PanelGroup,{direction:`vertical`,className:`h-full w-full min-w-0`,children:[(0,q.jsx)(Bo.Panel,{id:`thread-detail-main-panel`,defaultSize:l?100-c:100,minSize:30,order:1,className:`min-w-0 overflow-hidden`,children:(0,q.jsxs)(Bo.PanelGroup,{direction:`horizontal`,className:`h-full w-full min-w-0`,children:[(0,q.jsx)(Bo.Panel,{id:`thread-detail-timeline-panel`,defaultSize:r&&!d?100-f:Av,minSize:30,order:1,className:`min-w-0 overflow-hidden`,children:(0,q.jsx)(Dv,{...u,footer:e,header:t})}),v]})}),s?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Nv,{isOpen:l}),(0,q.jsx)(Bo.Panel,{ref:p,id:`thread-detail-terminal-panel`,collapsible:!0,collapsedSize:0,defaultSize:l?c:0,minSize:18,maxSize:70,order:2,onResize:g,className:R(`min-h-0 min-w-0 overflow-hidden transition-[flex-grow,flex-basis,opacity]`,jv,l?`opacity-100`:`opacity-0`),children:s})]}):null]}),d?(0,q.jsx)(V,{open:r,onOpenChange:e=>{e||o.onClose()},srLabel:`Thread details`,contentClassName:`h-[92dvh] max-h-[92dvh]`,handleOnly:!0,children:(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:y})}):null]})}function Nv({isOpen:e}){return(0,q.jsx)(Bo.PanelResizeHandle,{id:`thread-detail-terminal-panel-handle`,disabled:!e,className:R(`group relative shrink-0 cursor-row-resize overflow-visible bg-transparent transition-[height,opacity,background-color]`,jv,`before:absolute before:-inset-y-1.5 before:inset-x-0 before:content-['']`,e?`h-px opacity-100`:`pointer-events-none h-0 opacity-0`),"aria-label":`Resize thread and terminal panels`,children:(0,q.jsx)(`span`,{className:`pointer-events-none absolute inset-x-0 top-1/2 h-px -translate-y-1/2 bg-border transition-colors group-hover:bg-accent-foreground/35`})})}var Pv=[`w-40`,`w-28`,`w-36`,`w-24`];function Fv(){return(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:(0,q.jsx)(xv,{hasFlexibleHeight:!1,children:Pv.map((e,t)=>(0,q.jsxs)(`div`,{className:`grid grid-cols-[var(--detail-label-width,96px)_minmax(0,1fr)] items-center gap-x-3 py-0.5`,children:[(0,q.jsx)(sr,{className:`h-3 w-14 rounded-sm`}),(0,q.jsx)(sr,{className:`h-3 ${e} max-w-full rounded-sm`})]},t))})})}function Iv(e){return e!==void 0&&e.length>0}function Lv({closePersistedPanel:e,isCompactViewport:t,isPersistedOpen:n,openPersistedDiffFile:r,openPersistedDiffPanel:i,openPersistedPanel:a,threadId:o,togglePersistedPanel:s}){let[c,l]=(0,K.useState)(null);(0,K.useEffect)(()=>{l(null)},[o]),(0,K.useEffect)(()=>{t||l(null)},[t]);let u=(0,K.useCallback)(()=>{Iv(o)&&l(o)},[o]),d=(0,K.useCallback)(()=>{l(e=>e===o?null:e)},[o]),f=Iv(o)&&c===o,p=t?f:n,m=(0,K.useCallback)(e=>{a(e),t&&u()},[t,u,a]),h=(0,K.useCallback)(()=>{i(),t&&u()},[t,u,i]),g=(0,K.useCallback)(e=>{r(e),t&&u()},[t,u,r]),_=(0,K.useCallback)(()=>{if(t){d();return}e()},[d,e,t]),v=(0,K.useCallback)(()=>{if(!t){s();return}if(f){d();return}u()},[d,t,f,u,s]);return(0,K.useMemo)(()=>({closePanel:_,isOpen:p,openDiffFile:g,openDiffPanel:h,openPanel:m,togglePanel:v}),[_,p,g,h,m,v])}function Rv({activePath:e,fileListEnabled:t=!0,fileListOptions:n=le,filePreviewEnabled:r=!0,threadId:i,threadType:a}){let o=a===`manager`,{data:s,isLoading:c,error:l}=Oe(i??``,n,{enabled:o&&t}),{data:u,isLoading:d,error:f}=De(i??``,e,{enabled:o&&r&&e!==null});return{isThreadStorageFilePreviewLoading:d,isThreadStorageFilesLoading:c,threadStorageFilePreview:u,threadStorageFilePreviewError:f,threadStorageFilesError:l,threadStorageFiles:s,threadStorageRootPath:s?.storageRootPath??null}}var zv=[];function Bv(e){let t=new Set;for(let n of e){let e=n.split(`/`).filter(e=>e.length>0),r=``;for(let n of e.slice(0,-1))r=`${r}${n}/`,t.add(r)}return Array.from(t)}function Vv({files:e,onSelectPath:t,selectedPath:n}){let[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(``),s=e??zv,c=(0,K.useMemo)(()=>{let e=a.trim().toLowerCase();return e.length===0?s:s.filter(t=>t.path.toLowerCase().includes(e))},[s,a]),l=(0,K.useMemo)(()=>c.map(e=>e.path),[c]),u=(0,K.useMemo)(()=>new Set(l),[l]),d=(0,K.useRef)(u),f=(0,K.useRef)(t),p=(0,K.useRef)(!1);(0,K.useEffect)(()=>{d.current=u},[u]),(0,K.useEffect)(()=>{f.current=t},[t]);let{model:m}=rv({density:`compact`,initialExpansion:`closed`,onSelectionChange:(0,K.useCallback)(e=>{if(p.current)return;let t=e[0];!t||!d.current.has(t)||f.current(t)},[]),paths:[],search:!1}),h=a.trim().length>0,g=(0,K.useMemo)(()=>h?Bv(l):[],[h,l]);(0,K.useEffect)(()=>{m.resetPaths(l,{initialExpandedPaths:g})},[g,l,m]),(0,K.useEffect)(()=>{let e=m.getSelectedPaths(),t=n!==null&&u.has(n);if(!(t?e.length===1&&e[0]===n:e.length===0)){p.current=!0;try{for(let r of e)t&&r===n||m.getItem(r)?.deselect();t&&m.getItem(n)?.select()}finally{p.current=!1}}},[u,m,n]);let _=(0,K.useCallback)(()=>{i(!0)},[]);return{closeSearch:(0,K.useCallback)(()=>{i(!1),o(``)},[]),filteredFiles:c,isSearchOpen:r,loadedFiles:s,model:m,openSearch:_,searchQuery:a,setSearchQuery:o}}var Hv=`bb.thread.fixedPanelTabsState`,Uv=336*60*60*1e3,Wv=`thread-info`,Gv=`git-diff`,Kv=e(`kind`,[S({kind:E(`working-tree`)}).strict(),S({kind:E(`head`)}).strict(),S({kind:E(`merge-base`),ref:r().min(1)}).strict()]),qv=E(`deleted`).nullable(),Jv=S({id:E(Wv),kind:E(`thread-info`)}).strict(),Yv=S({id:E(Gv),kind:E(`git-diff`)}).strict(),Xv=S({environmentId:r().min(1).nullable(),id:r().min(1),kind:E(`workspace-file-preview`),lineNumber:o().int().positive().nullable(),path:r().min(1),source:Kv,statusLabel:qv}).strict(),Zv=S({id:r().min(1),kind:E(`host-file-preview`),lineNumber:o().int().positive().nullable(),path:r().min(1)}).strict(),Qv=S({id:r().min(1),isPinned:v(),kind:E(`thread-storage-file-preview`),path:r().min(1)}).strict(),$v=S({id:r().min(1),kind:E(`terminal`),terminalId:r().min(1)}).strict(),ey=e(`kind`,[Jv,Yv,Xv,Zv,Qv]),ty=e(`kind`,[$v]),ny=S({tabs:p(ey),activeTabId:r().min(1).nullable(),isOpen:v()}).strict(),ry=S({tabs:p(ey),activeTabId:r().min(1).nullable()}).strict(),iy=S({tabs:p(ty),activeTabId:r().min(1).nullable()}).strict(),ay=S({version:E(1),secondary:ny,bottom:iy,lastUsedAt:o().int().nonnegative()}).strict(),oy=S({version:E(1),secondary:ry,bottom:iy,lastUsedAt:o().int().nonnegative()}).strict();function sy(){return typeof window>`u`?null:window.localStorage}function cy(e){return encodeURIComponent(e.trim())}function ly(e,t){return`${e}:${encodeURIComponent(t)}`}function uy(){return{id:Wv,kind:`thread-info`}}function dy(){return{id:Gv,kind:`git-diff`}}function fy({environmentId:e,tab:t}){return{environmentId:e,id:ly(`workspace-file-preview`,t.path),kind:`workspace-file-preview`,lineNumber:t.lineNumber,path:t.path,source:t.source,statusLabel:t.statusLabel}}function py(e){return{id:ly(`host-file-preview`,e.path),kind:`host-file-preview`,lineNumber:e.lineNumber,path:e.path}}function my({isPinned:e,path:t}){return{id:ly(`thread-storage-file-preview`,t),isPinned:e,kind:`thread-storage-file-preview`,path:t}}function hy({terminalId:e}){return{id:`terminal:${encodeURIComponent(e)}`,kind:`terminal`,terminalId:e}}function gy(e,t){return e===`bottom`?t.kind===`terminal`:t.kind!==`terminal`}function _y({group:e,region:t}){let n=new Set,r=[];for(let i of e.tabs)!gy(t,i)||n.has(i.id)||(n.add(i.id),r.push(i));return{tabs:r,activeTabId:e.activeTabId!==null&&n.has(e.activeTabId)?e.activeTabId:null}}function vy(e){return{..._y({group:e,region:`secondary`}),isOpen:e.isOpen}}function yy({state:e}){return{...e,secondary:vy(e.secondary),bottom:_y({group:e.bottom,region:`bottom`})}}function by(e={}){return yy({state:{version:1,secondary:e.secondary??{tabs:[],activeTabId:null,isOpen:!1},bottom:e.bottom??{tabs:[],activeTabId:null},lastUsedAt:e.lastUsedAt??0}})}var xy=by();function Sy({threadId:e}){return`${Hv}-${cy(e)}-1`}function Cy(e){return e.startsWith(`bb.thread.fixedPanelTabsState-`)&&e.endsWith(`-1`)}function wy({now:e,state:t}){return e-t.lastUsedAt>Uv}function Ty({initialValue:e,now:t,storedValue:n}){return Ey({initialValue:e,now:t,storedValue:n}).state}function Ey({initialValue:e,now:t,storedValue:n}){if(n===null)return{shouldPrune:!1,state:e};let r;try{r=JSON.parse(n)}catch{return{shouldPrune:!0,state:e}}let i=ay.safeParse(r);if(i.success){let n=yy({state:i.data});return wy({now:t,state:n})?{shouldPrune:!0,state:e}:{shouldPrune:!1,state:n}}let a=oy.safeParse(r);if(!a.success)return{shouldPrune:!0,state:e};let o=yy({state:{...a.data,secondary:{...a.data.secondary,isOpen:a.data.secondary.activeTabId!==null}}});return wy({now:t,state:o})?{shouldPrune:!0,state:e}:{shouldPrune:!1,state:o}}function Dy({state:e}){return JSON.stringify(yy({state:e}))}function Oy({now:e}){let t=sy();if(!t)return;let n=[];for(let e=0;e<t.length;e+=1){let r=t.key(e);r&&Cy(r)&&n.push(r)}for(let r of n)Ey({initialValue:xy,now:e,storedValue:t.getItem(r)}).shouldPrune&&t.removeItem(r)}function ky(e,t){if(e.id!==t.id||e.kind!==t.kind)return!1;switch(e.kind){case`thread-info`:case`git-diff`:return!0;case`workspace-file-preview`:return t.kind===`workspace-file-preview`&&e.environmentId===t.environmentId&&e.lineNumber===t.lineNumber&&e.path===t.path&&l(e.source,t.source)&&e.statusLabel===t.statusLabel;case`host-file-preview`:return t.kind===`host-file-preview`&&e.lineNumber===t.lineNumber&&e.path===t.path;case`thread-storage-file-preview`:return t.kind===`thread-storage-file-preview`&&e.isPinned===t.isPinned&&e.path===t.path;case`terminal`:return t.kind===`terminal`&&e.terminalId===t.terminalId}}var Ay=`secondaryPanel`,jy=`git-diff`,My=`thread-info`;function Ny(e){switch(e){case jy:return`git-diff`;case My:return`thread-info`;default:return null}}function Py(e){return Ny(new URLSearchParams(e).get(Ay))}function Fy(e,t){let n=new URLSearchParams(e);return t?n.set(Ay,t):n.delete(Ay),n.toString()}var Iy=60*1e3;function Ly(e){return e!=null&&e.length>0}function Ry(e,t){return{...e,lastUsedAt:t}}var zy=tt({parse:(e,t)=>Ty({initialValue:t,now:Date.now(),storedValue:e}),serialize:e=>Dy({state:e})}),By=nt(xy),Vy=Ze(e=>G(Sy({threadId:e}),xy,zy,{getOnInit:!0}));function Hy(e){return Ly(e)?Vy(e):By}function Uy(e){switch(e){case`thread-info`:return uy().id;case`git-diff`:return dy().id}}function Wy(e){switch(e){case`thread-info`:return uy();case`git-diff`:return dy()}}function Gy(e){let t=e.bottom.activeTabId;if(t===null)return null;let n=e.bottom.tabs.find(e=>e.id===t);return n?.kind===`terminal`?n:null}function Ky(e,t){let n=hy({terminalId:t});return e.find(e=>e.id===n.id)?e:[...e,n]}function qy(e,t){let n=hy({terminalId:t}),r=e.filter(e=>e.id!==n.id);return r.length===e.length?e:r}function Jy(e,t){let n=Uy(t);return e.some(e=>e.id===n)?e:[...e,Wy(t)]}function Yy(e,t){return t!==null&&e.some(e=>e.id===t)}function Xy(e){if(Yy(e.secondary.tabs,e.secondary.activeTabId))return e.secondary.isOpen?e:{...e,secondary:{...e.secondary,isOpen:!0}};let t=`thread-info`,n=Jy(e.secondary.tabs,t),r=Uy(t);return{...e,secondary:{tabs:n,activeTabId:r,isOpen:!0}}}function Zy(e){return e.secondary.isOpen?{...e,secondary:{...e.secondary,isOpen:!1}}:e}function Qy(e){(0,K.useEffect)(()=>{Oy({now:Date.now()})},[e])}function $y(e){return dt(Hy(e))}function eb(e){let t=rt(Hy(e));return(0,K.useCallback)(n=>{if(!Ly(e))return;let r=Date.now();t(e=>{let t=n(e);return t===e?e:Ry(t,r)})},[t,e])}function tb(e){let t=eb(e),n=(0,K.useRef)(null);return(0,K.useCallback)(()=>{let r=Date.now();n.current!==null&&n.current.threadId===e&&r-n.current.touchedAt<Iy||(n.current={threadId:e,touchedAt:r},t(e=>!e.secondary.isOpen&&e.secondary.tabs.length===0&&e.bottom.tabs.length===0||r-e.lastUsedAt<Iy?e:{...e}))},[e,t])}function nb(e){let t=eb(e);return(0,K.useCallback)(e=>{t(t=>{let n=Jy(t.secondary.tabs,e),r=Uy(e);return n===t.secondary.tabs&&t.secondary.activeTabId===r&&t.secondary.isOpen?t:{...t,secondary:{tabs:n,activeTabId:r,isOpen:!0}}})},[t])}function rb(e){let t=eb(e);return(0,K.useCallback)(()=>{t(Zy)},[t])}function ib(e){let t=eb(e);return(0,K.useCallback)(()=>{t(e=>e.secondary.isOpen?Zy(e):Xy(e))},[t])}function ab(e,t){let n=Ge(),r=He();(0,K.useEffect)(()=>{if(!Ly(e))return;let i=Py(n.search);if(i===null)return;t(i);let a=Fy(n.search,null);r({pathname:n.pathname,search:a.length>0?`?${a}`:``},{replace:!0})},[n.pathname,n.search,r,t,e])}function ob(e){return Gy($y(e))?.terminalId??null}function sb(e){let t=eb(e);return(0,K.useCallback)(e=>{t(t=>{if(e===null)return t.bottom.activeTabId===null?t:{...t,bottom:{...t.bottom,activeTabId:null}};let n=Ky(t.bottom.tabs,e),r=hy({terminalId:e}).id;return n===t.bottom.tabs&&t.bottom.activeTabId===r?t:{...t,bottom:{tabs:n,activeTabId:r}}})},[t])}function cb(e){let t=eb(e);return(0,K.useCallback)(e=>{t(t=>{let n=qy(t.bottom.tabs,e);if(n===t.bottom.tabs)return t;let r=t.bottom.activeTabId===hy({terminalId:e}).id;return{...t,bottom:{tabs:n,activeTabId:r?null:t.bottom.activeTabId}}})},[t])}function lb(e){return e.kind===`workspace-file-preview`}function ub(e){return e.kind===`host-file-preview`}function db(e){return e.kind===`thread-storage-file-preview`}function fb(e,t){return lb(e)&&e.environmentId===t}function pb(e){let t=e.secondary.activeTabId;return t===null?null:e.secondary.tabs.find(e=>e.id===t)??null}function mb({activeTabId:e,isOpen:t,state:n,tabs:r}){return r===n.secondary.tabs&&e===n.secondary.activeTabId&&t===n.secondary.isOpen?n:{...n,secondary:{tabs:r,activeTabId:e,isOpen:t}}}function hb(e,t){let n=e.filter(e=>!db(e)||e.path===t||!Ns(e.path));return n.length===e.length?e:n}function gb(e,t){let n=e.findIndex(e=>e.id===t.id);if(n===-1)return[...e,t];let r=e[n];return r&&ky(r,t)?e:e.map(e=>e.id===t.id?t:e)}function _b(e,t){let n=e.filter(e=>e.id!==t);return n.length===e.length?e:n}function vb(e,t){let n=e.filter(e=>!lb(e)||e.environmentId===t);return n.length===e.length?e:n}function yb(e){let t=e.filter(e=>!db(e));return t.length===e.length?e:t}function bb(e,t){let n=e.filter(e=>!db(e)||t.has(e.path));return n.length===e.length?e:n}function xb(e,t){return t!==null&&e.some(e=>e.id===t)}function Sb(e,t){return my({isPinned:e===t,path:e})}function Cb(e,t){return Eb(e,t)?.id??Sb(t,t).id}function wb(e,t){for(let n of e)if(lb(n)&&n.path===t)return n;return null}function Tb(e,t){for(let n of e)if(ub(n)&&n.path===t)return n;return null}function Eb(e,t){for(let n of e)if(db(n)&&n.path===t)return n;return null}function Db(e){return{lineNumber:e.lineNumber,path:e.path,source:e.source,statusLabel:e.statusLabel}}function Ob(e){return{lineNumber:e.lineNumber,path:e.path}}function kb(e){let t=e.filter(e=>e.isPinned),n=e.filter(e=>!e.isPinned);return[...t,...n]}function Ab({threadId:e,environmentId:t,threadType:n,storageFiles:r}){let i=$y(e),a=eb(e),o=n!==void 0,s=n===`manager`,c=Ps(r),u=o?t??null:void 0;(0,K.useEffect)(()=>{u!==void 0&&a(e=>{let t=vb(e.secondary.tabs,u);return mb({activeTabId:xb(t,e.secondary.activeTabId)?e.secondary.activeTabId:null,isOpen:e.secondary.isOpen,state:e,tabs:t})})},[u,a]),(0,K.useEffect)(()=>{o&&(s||a(e=>{let t=yb(e.secondary.tabs);return mb({activeTabId:xb(t,e.secondary.activeTabId)?e.secondary.activeTabId:null,isOpen:e.secondary.isOpen,state:e,tabs:t})}))},[s,o,a]);let d=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!s){d.current=null;return}let e=d.current!==c;d.current=c,a(t=>{let n=Sb(c,c),r=gb(e?hb(t.secondary.tabs,c):t.secondary.tabs,n);return mb({activeTabId:xb(r,t.secondary.activeTabId)?t.secondary.activeTabId:n.id,isOpen:t.secondary.isOpen,state:t,tabs:r})})},[i.secondary.activeTabId,s,c,a]),(0,K.useEffect)(()=>{!o||!r||s&&a(e=>{let t=new Set([c,...r.map(e=>e.path)]),n=bb(e.secondary.tabs,t);return mb({activeTabId:xb(n,e.secondary.activeTabId)?e.secondary.activeTabId:Cb(n,c),isOpen:e.secondary.isOpen,state:e,tabs:n})})},[s,o,c,r,a]);let f=(0,K.useCallback)(({lineNumber:e,path:t,source:n,statusLabel:r})=>{if(u===void 0)return;let i=fy({environmentId:u,tab:{lineNumber:e,path:t,source:n,statusLabel:r}});a(a=>{let o=wb(a.secondary.tabs,t),s=gb(a.secondary.tabs,i);return o&&o.environmentId===u&&o.lineNumber===e&&l(o.source,n)&&o.statusLabel===r&&a.secondary.activeTabId===i.id&&a.secondary.isOpen?a:mb({activeTabId:i.id,isOpen:!0,state:a,tabs:s})})},[u,a]),p=(0,K.useCallback)(e=>{a(t=>{let n=wb(t.secondary.tabs,e);if(!n)return t;let r=_b(t.secondary.tabs,n.id);return mb({activeTabId:t.secondary.activeTabId===n.id?null:t.secondary.activeTabId,isOpen:t.secondary.isOpen,state:t,tabs:r})})},[a]),m=(0,K.useCallback)(e=>{a(t=>{let n=wb(t.secondary.tabs,e);return!n||t.secondary.activeTabId===n.id&&t.secondary.isOpen?t:mb({activeTabId:n.id,isOpen:!0,state:t,tabs:t.secondary.tabs})})},[a]),h=(0,K.useCallback)(e=>{if(!s)return;let t=Sb(e,c);a(e=>{let n=gb(e.secondary.tabs,t);return n===e.secondary.tabs&&e.secondary.activeTabId===t.id&&e.secondary.isOpen?e:mb({activeTabId:t.id,isOpen:!0,state:e,tabs:n})})},[s,c,a]),g=(0,K.useCallback)(({lineNumber:t,path:n})=>{if(!e)return;let r=py({lineNumber:t,path:n});a(e=>{let i=Tb(e.secondary.tabs,n),a=gb(e.secondary.tabs,r);return i&&i.lineNumber===t&&e.secondary.activeTabId===r.id&&e.secondary.isOpen?e:mb({activeTabId:r.id,isOpen:!0,state:e,tabs:a})})},[e,a]),_=(0,K.useCallback)(e=>{a(t=>{let n=Tb(t.secondary.tabs,e);if(!n)return t;let r=_b(t.secondary.tabs,n.id);return mb({activeTabId:t.secondary.activeTabId===n.id?null:t.secondary.activeTabId,isOpen:t.secondary.isOpen,state:t,tabs:r})})},[a]),v=(0,K.useCallback)(e=>{a(t=>{let n=Tb(t.secondary.tabs,e);return!n||t.secondary.activeTabId===n.id&&t.secondary.isOpen?t:mb({activeTabId:n.id,isOpen:!0,state:t,tabs:t.secondary.tabs})})},[a]),y=(0,K.useCallback)(e=>{!s||e===c||a(t=>{let n=Eb(t.secondary.tabs,e);if(!n)return t;let r=_b(t.secondary.tabs,n.id);return mb({activeTabId:t.secondary.activeTabId===n.id?null:t.secondary.activeTabId,isOpen:t.secondary.isOpen,state:t,tabs:r})})},[s,c,a]),b=(0,K.useCallback)(e=>{s&&a(t=>{let n=Eb(t.secondary.tabs,e);return!n||t.secondary.activeTabId===n.id&&t.secondary.isOpen?t:mb({activeTabId:n.id,isOpen:!0,state:t,tabs:t.secondary.tabs})})},[s,a]),x=(0,K.useCallback)(()=>{a(e=>{let t=pb(e);return!t||t.kind!==`workspace-file-preview`&&t.kind!==`host-file-preview`&&t.kind!==`thread-storage-file-preview`?e:mb({activeTabId:null,isOpen:e.secondary.isOpen,state:e,tabs:e.secondary.tabs})})},[a]),S=pb(i),C=u===void 0?[]:i.secondary.tabs.filter(e=>fb(e,u)),w=S?.kind===`workspace-file-preview`&&S.environmentId===u?S:null,T=s&&S?.kind===`thread-storage-file-preview`?S:null,E=S?.kind===`host-file-preview`?S:null,D=s?kb(i.secondary.tabs.filter(db)):[];return{activateHostFileTab:v,activateStorageFileTab:b,activateWorkspaceFileTab:m,activeHostFileLineNumber:E?.lineNumber??null,activeHostFilePath:E?.path??null,activeStorageFilePath:T?.path??null,activeWorkspaceFileLineNumber:w?.lineNumber??null,activeWorkspaceFilePath:w?.path??null,activeWorkspaceFileSource:w?.source??null,activeWorkspaceFileStatusLabel:w?.statusLabel??null,clearActiveFileTabs:x,closeHostFileTab:_,closeStorageFileTab:y,closeWorkspaceFileTab:p,openHostFile:g,openHostFileTabs:i.secondary.tabs.filter(ub).map(Ob),openStorageFile:h,openStorageFilePaths:D.map(e=>e.path),openWorkspaceFile:f,openWorkspaceFileTabs:C.map(Db),pinnedStorageFilePath:c}}function jb(e){return e??void 0}function Mb({previousStateKey:e,nextStateKey:t,persistedMergeBaseBranch:n,selectedMergeBaseBranch:r,updatePending:i}){return e===t?i?!1:r!==jb(n):!0}function Nb({environment:e,workspaceStatus:t}){return e?.baseBranch??t?.branch.defaultBranch??e?.defaultBranch??void 0}function Pb({environment:e,selectedMergeBaseBranch:t,workspaceStatus:n}){return t??e?.mergeBaseBranch??e?.baseBranch??n?.mergeBase?.mergeBaseBranch??n?.branch.defaultBranch??se(e)}function Fb({branch:e,environment:t,workspaceStatus:n}){let r=e.trim();return r.length===0||r===Nb({environment:t,workspaceStatus:n})?null:r}function Ib({environment:e,mergeBaseBranchOptions:t,selectedMergeBaseBranch:n,setSelectedMergeBaseBranch:r,thread:i,updateEnvironment:a,workspaceStatus:o}){let s=(0,K.useRef)(void 0),c=e?.id??i?.id,l=a.isPending&&a.variables?.id===e?.id;(0,K.useEffect)(()=>{Mb({previousStateKey:s.current,nextStateKey:c,persistedMergeBaseBranch:e?.mergeBaseBranch,selectedMergeBaseBranch:n,updatePending:l})&&(s.current=c,r(jb(e?.mergeBaseBranch)))},[e?.mergeBaseBranch,l,c,n,r]);let u=Pb({environment:e,selectedMergeBaseBranch:n,workspaceStatus:o}),d=!!(u||o?.branch.defaultBranch),f=u,p=(0,K.useMemo)(()=>Un({mergeBaseBranch:f,mergeBaseBranchOptions:t}),[f,t]),m=o?.branch.currentBranch!=null&&o.branch.currentBranch===o.branch.defaultBranch,h=d&&!!f&&!m;return{canSelectMergeBase:!!(h&&f&&p.length>0),effectiveMergeBaseBranch:u,handleMergeBaseBranchChange:(0,K.useCallback)(t=>{if(!e||!i?.environmentId)return;let n=t.trim(),s=Fb({branch:n,environment:e,workspaceStatus:o}),c=e.mergeBaseBranch;r(n),s!==c&&a.mutate({id:e.id,mergeBaseBranch:s},{onError:t=>{r(e.mergeBaseBranch??void 0),hn.error(pn({error:t,fallbackMessage:`Failed to update merge base branch.`}))}})},[e,r,i?.environmentId,a,o]),showBranchComparisonUi:d,showMergeBase:h,mergeBaseBranch:f,mergeBaseCandidates:p}}var Lb=a((e=>{e.__esModule=!0,e.extend=a,e.indexOf=l,e.escapeExpression=u,e.isEmpty=d,e.createFrame=f,e.blockParams=p,e.appendContextPath=m;var t={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#x27;`,"`":`&#x60;`,"=":`&#x3D;`},n=/[&<>"'`=]/g,r=/[&<>"'`=]/;function i(e){return t[e]}function a(e){for(var t=1;t<arguments.length;t++)for(var n in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],n)&&(e[n]=arguments[t][n]);return e}var o=Object.prototype.toString;e.toString=o;var s=function(e){return typeof e==`function`};s(/x/)&&(e.isFunction=s=function(e){return typeof e==`function`&&o.call(e)===`[object Function]`}),e.isFunction=s;var c=Array.isArray||function(e){return e&&typeof e==`object`?o.call(e)===`[object Array]`:!1};e.isArray=c;function l(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function u(e){if(typeof e!=`string`){if(e&&e.toHTML)return e.toHTML();if(e==null)return``;if(!e)return e+``;e=``+e}return r.test(e)?e.replace(n,i):e}function d(e){return!e&&e!==0?!0:!!(c(e)&&e.length===0)}function f(e){var t=a({},e);return t._parent=e,t}function p(e,t){return e.path=t,e}function m(e,t){return(e?e+`.`:``)+t}})),Rb=a(((e,t)=>{e.__esModule=!0;var n=[`description`,`fileName`,`lineNumber`,`endLineNumber`,`message`,`name`,`number`,`stack`];function r(e,t){var i=t&&t.loc,a=void 0,o=void 0,s=void 0,c=void 0;i&&(a=i.start.line,o=i.end.line,s=i.start.column,c=i.end.column,e+=` - `+a+`:`+s);for(var l=Error.prototype.constructor.call(this,e),u=0;u<n.length;u++)this[n[u]]=l[n[u]];Error.captureStackTrace&&Error.captureStackTrace(this,r);try{i&&(this.lineNumber=a,this.endLineNumber=o,Object.defineProperty?(Object.defineProperty(this,`column`,{value:s,enumerable:!0}),Object.defineProperty(this,`endColumn`,{value:c,enumerable:!0})):(this.column=s,this.endColumn=c))}catch{}}r.prototype=Error(),e.default=r,t.exports=e.default})),zb=a(((e,t)=>{e.__esModule=!0;var n=Lb();e.default=function(e){e.registerHelper(`blockHelperMissing`,function(t,r){var i=r.inverse,a=r.fn;if(t===!0)return a(this);if(t===!1||t==null)return i(this);if(n.isArray(t))return t.length>0?(r.ids&&=[r.name],e.helpers.each(t,r)):i(this);if(r.data&&r.ids){var o=n.createFrame(r.data);o.contextPath=n.appendContextPath(r.data.contextPath,r.name),r={data:o}}return a(t,r)})},t.exports=e.default})),Bb=a(((e,t)=>{e.__esModule=!0;function n(e){return e&&e.__esModule?e:{default:e}}var r=Lb(),i=n(Rb());e.default=function(e){e.registerHelper(`each`,function(e,t){if(!t)throw new i.default(`Must pass iterator to #each`);var n=t.fn,a=t.inverse,o=0,s=``,c=void 0,l=void 0;t.data&&t.ids&&(l=r.appendContextPath(t.data.contextPath,t.ids[0])+`.`),r.isFunction(e)&&(e=e.call(this)),t.data&&(c=r.createFrame(t.data));function u(t,i,a){c&&(c.key=t,c.index=i,c.first=i===0,c.last=!!a,l&&(c.contextPath=l+t)),s+=n(e[t],{data:c,blockParams:r.blockParams([e[t],t],[l+t,null])})}if(e&&typeof e==`object`)if(r.isArray(e))for(var d=e.length;o<d;o++)o in e&&u(o,o,o===e.length-1);else if(typeof Symbol==`function`&&e[Symbol.iterator]){for(var f=[],p=e[Symbol.iterator](),m=p.next();!m.done;m=p.next())f.push(m.value);e=f;for(var d=e.length;o<d;o++)u(o,o,o===e.length-1)}else (function(){var t=void 0;Object.keys(e).forEach(function(e){t!==void 0&&u(t,o-1),t=e,o++}),t!==void 0&&u(t,o-1,!0)})();return o===0&&(s=a(this)),s})},t.exports=e.default})),Vb=a(((e,t)=>{e.__esModule=!0;function n(e){return e&&e.__esModule?e:{default:e}}var r=n(Rb());e.default=function(e){e.registerHelper(`helperMissing`,function(){if(arguments.length!==1)throw new r.default(`Missing helper: "`+arguments[arguments.length-1].name+`"`)})},t.exports=e.default})),Hb=a(((e,t)=>{e.__esModule=!0;function n(e){return e&&e.__esModule?e:{default:e}}var r=Lb(),i=n(Rb());e.default=function(e){e.registerHelper(`if`,function(e,t){if(arguments.length!=2)throw new i.default(`#if requires exactly one argument`);return r.isFunction(e)&&(e=e.call(this)),!t.hash.includeZero&&!e||r.isEmpty(e)?t.inverse(this):t.fn(this)}),e.registerHelper(`unless`,function(t,n){if(arguments.length!=2)throw new i.default(`#unless requires exactly one argument`);return e.helpers.if.call(this,t,{fn:n.inverse,inverse:n.fn,hash:n.hash})})},t.exports=e.default})),Ub=a(((e,t)=>{e.__esModule=!0,e.default=function(e){e.registerHelper(`log`,function(){for(var t=[void 0],n=arguments[arguments.length-1],r=0;r<arguments.length-1;r++)t.push(arguments[r]);var i=1;n.hash.level==null?n.data&&n.data.level!=null&&(i=n.data.level):i=n.hash.level,t[0]=i,e.log.apply(e,t)})},t.exports=e.default})),Wb=a(((e,t)=>{e.__esModule=!0,e.default=function(e){e.registerHelper(`lookup`,function(e,t,n){return e&&n.lookupProperty(e,t)})},t.exports=e.default})),Gb=a(((e,t)=>{e.__esModule=!0;function n(e){return e&&e.__esModule?e:{default:e}}var r=Lb(),i=n(Rb());e.default=function(e){e.registerHelper(`with`,function(e,t){if(arguments.length!=2)throw new i.default(`#with requires exactly one argument`);r.isFunction(e)&&(e=e.call(this));var n=t.fn;if(r.isEmpty(e))return t.inverse(this);var a=t.data;return t.data&&t.ids&&(a=r.createFrame(t.data),a.contextPath=r.appendContextPath(t.data.contextPath,t.ids[0])),n(e,{data:a,blockParams:r.blockParams([e],[a&&a.contextPath])})})},t.exports=e.default})),Kb=a((e=>{e.__esModule=!0,e.registerDefaultHelpers=l,e.moveHelperToHooks=u;function t(e){return e&&e.__esModule?e:{default:e}}var n=t(zb()),r=t(Bb()),i=t(Vb()),a=t(Hb()),o=t(Ub()),s=t(Wb()),c=t(Gb());function l(e){n.default(e),r.default(e),i.default(e),a.default(e),o.default(e),s.default(e),c.default(e)}function u(e,t,n){e.helpers[t]&&(e.hooks[t]=e.helpers[t],n||delete e.helpers[t])}})),qb=a(((e,t)=>{e.__esModule=!0;var n=Lb();e.default=function(e){e.registerDecorator(`inline`,function(e,t,r,i){var a=e;return t.partials||(t.partials={},a=function(i,a){var o=r.partials;r.partials=n.extend({},o,t.partials);var s=e(i,a);return r.partials=o,s}),t.partials[i.args[0]]=i.fn,a})},t.exports=e.default})),Jb=a((e=>{e.__esModule=!0,e.registerDefaultDecorators=r;function t(e){return e&&e.__esModule?e:{default:e}}var n=t(qb());function r(e){n.default(e)}})),Yb=a(((e,t)=>{e.__esModule=!0;var n=Lb(),r={methodMap:[`debug`,`info`,`warn`,`error`],level:`info`,lookupLevel:function(e){if(typeof e==`string`){var t=n.indexOf(r.methodMap,e.toLowerCase());e=t>=0?t:parseInt(e,10)}return e},log:function(e){if(e=r.lookupLevel(e),typeof console<`u`&&r.lookupLevel(r.level)<=e){var t=r.methodMap[e];console[t]||(t=`log`);var n=[...arguments].slice(1);console[t].apply(console,n)}}};e.default=r,t.exports=e.default})),Xb=a((e=>{e.__esModule=!0,e.createNewLookupObject=n;var t=Lb();function n(){var e=[...arguments];return t.extend.apply(void 0,[Object.create(null)].concat(e))}})),Zb=a((e=>{e.__esModule=!0,e.createProtoAccessControl=a,e.resultIsAllowed=o,e.resetLoggedProperties=l;function t(e){return e&&e.__esModule?e:{default:e}}var n=Xb(),r=t(Yb()),i=Object.create(null);function a(e){var t=Object.create(null);t.constructor=!1,t.__defineGetter__=!1,t.__defineSetter__=!1,t.__lookupGetter__=!1;var r=Object.create(null);return r.__proto__=!1,{properties:{whitelist:n.createNewLookupObject(r,e.allowedProtoProperties),defaultValue:e.allowProtoPropertiesByDefault},methods:{whitelist:n.createNewLookupObject(t,e.allowedProtoMethods),defaultValue:e.allowProtoMethodsByDefault}}}function o(e,t,n){return s(typeof e==`function`?t.methods:t.properties,n)}function s(e,t){return e.whitelist[t]===void 0?e.defaultValue===void 0?(c(t),!1):e.defaultValue:e.whitelist[t]===!0}function c(e){i[e]!==!0&&(i[e]=!0,r.default.log(`error`,`Handlebars: Access has been denied to resolve the property "`+e+`" because it is not an "own property" of its parent.
1816
1816
  You can add a runtime option to disable the check or this warning:
1817
1817
  See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details`))}function l(){Object.keys(i).forEach(function(e){delete i[e]})}})),Qb=a((e=>{e.__esModule=!0,e.HandlebarsEnvironment=l;function t(e){return e&&e.__esModule?e:{default:e}}var n=Lb(),r=t(Rb()),i=Kb(),a=Jb(),o=t(Yb()),s=Zb();e.VERSION=`4.7.8`,e.COMPILER_REVISION=8,e.LAST_COMPATIBLE_COMPILER_REVISION=7,e.REVISION_CHANGES={1:`<= 1.0.rc.2`,2:`== 1.0.0-rc.3`,3:`== 1.0.0-rc.4`,4:`== 1.x.x`,5:`== 2.0.0-alpha.x`,6:`>= 2.0.0-beta.1`,7:`>= 4.0.0 <4.3.0`,8:`>= 4.3.0`};var c=`[object Object]`;function l(e,t,n){this.helpers=e||{},this.partials=t||{},this.decorators=n||{},i.registerDefaultHelpers(this),a.registerDefaultDecorators(this)}l.prototype={constructor:l,logger:o.default,log:o.default.log,registerHelper:function(e,t){if(n.toString.call(e)===c){if(t)throw new r.default(`Arg not supported with multiple helpers`);n.extend(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if(n.toString.call(e)===c)n.extend(this.partials,e);else{if(t===void 0)throw new r.default(`Attempting to register a partial called "`+e+`" as undefined`);this.partials[e]=t}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,t){if(n.toString.call(e)===c){if(t)throw new r.default(`Arg not supported with multiple decorators`);n.extend(this.decorators,e)}else this.decorators[e]=t},unregisterDecorator:function(e){delete this.decorators[e]},resetLoggedPropertyAccesses:function(){s.resetLoggedProperties()}},e.log=o.default.log,e.createFrame=n.createFrame,e.logger=o.default})),$b=a(((e,t)=>{e.__esModule=!0;function n(e){this.string=e}n.prototype.toString=n.prototype.toHTML=function(){return``+this.string},e.default=n,t.exports=e.default})),ex=a((e=>{e.__esModule=!0,e.wrapHelper=t;function t(e,t){return typeof e==`function`?function(){var n=arguments[arguments.length-1];return arguments[arguments.length-1]=t(n),e.apply(this,arguments)}:e}})),tx=a((e=>{e.__esModule=!0,e.checkRevision=l,e.template=u,e.wrapProgram=d,e.resolvePartial=f,e.invokePartial=p,e.noop=m;function t(e){return e&&e.__esModule?e:{default:e}}function n(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}var r=n(Lb()),i=t(Rb()),a=Qb(),o=Kb(),s=ex(),c=Zb();function l(e){var t=e&&e[0]||1,n=a.COMPILER_REVISION;if(!(t>=a.LAST_COMPATIBLE_COMPILER_REVISION&&t<=a.COMPILER_REVISION))if(t<a.LAST_COMPATIBLE_COMPILER_REVISION){var r=a.REVISION_CHANGES[n],o=a.REVISION_CHANGES[t];throw new i.default(`Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version (`+r+`) or downgrade your runtime to an older version (`+o+`).`)}else throw new i.default(`Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version (`+e[1]+`).`)}function u(e,t){if(!t)throw new i.default(`No environment passed to template`);if(!e||!e.main)throw new i.default(`Unknown template object: `+typeof e);e.main.decorator=e.main_d,t.VM.checkRevision(e.compiler);var n=e.compiler&&e.compiler[0]===7;function a(n,a,o){o.hash&&(a=r.extend({},a,o.hash),o.ids&&(o.ids[0]=!0)),n=t.VM.resolvePartial.call(this,n,a,o);var s=r.extend({},o,{hooks:this.hooks,protoAccessControl:this.protoAccessControl}),c=t.VM.invokePartial.call(this,n,a,s);if(c==null&&t.compile&&(o.partials[o.name]=t.compile(n,e.compilerOptions,t),c=o.partials[o.name](a,s)),c!=null){if(o.indent){for(var l=c.split(`
1818
1818
  `),u=0,d=l.length;u<d&&!(!l[u]&&u+1===d);u++)l[u]=o.indent+l[u];c=l.join(`