reviewme 0.0.7 → 0.0.8

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.
@@ -3049,7 +3049,7 @@ ${t}`,r=e.startsWith(t)?0:Nz(e,n,0);if(r===-1)return[e];let o=[];if(r>0)o.push(e
3049
3049
  }`}function hH(e){return`@layer base, unsafe;
3050
3050
  @layer unsafe {
3051
3051
  ${e}
3052
- }`}var yH=new WeakMap;function Tfe(e){let t=yH.get(e);if(t!=null)return t;let n=document.createElement("div");n.setAttribute(oH,"true");let r=document.createElement("div");r.style.position="relative",r.style.height="200%",n.appendChild(r),e.appendChild(n);let o=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),yH.set(e,o),o}function wH(e,t){if(!e.isConnected)return;let n=Tfe(t);if(n==null)return;let r=t.querySelector(`style[${Y2}]`),o=r instanceof HTMLStyleElement?r:document.createElement("style");if(!(r instanceof HTMLStyleElement))o.setAttribute(Y2,""),t.appendChild(o);o.textContent=`:host { ${sH}: ${n}px; }`}var __;function $fe(e){if(typeof CSSStyleSheet<"u"&&typeof CSSStyleSheet.prototype.replaceSync==="function"&&"adoptedStyleSheets"in e){if(__==null)__=new CSSStyleSheet,__.replaceSync(C_(W2));let t=!1;try{e.adoptedStyleSheets=[__],t=!0}catch{}if(t){e.querySelector(`style[${y_}]`)?.remove();return}}if(e.querySelector("style[data-file-tree-style]")==null){let t=document.createElement("style");t.setAttribute(y_,""),t.textContent=C_(W2),e.prepend(t)}}function v_(e,t){Pfe(e,t),$fe(t),wH(e,t)}function Pfe(e,t){let n=e.querySelector('template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]');if(!(n instanceof HTMLTemplateElement))return;if(t.childNodes.length>0)return;if(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 t=this.shadowRoot??this.attachShadow({mode:"open"});v_(this,t)}}if(customElements.define(ah,e),typeof document<"u")for(let t of Array.from(document.querySelectorAll(ah))){if(!(t instanceof HTMLElement))continue;v_(t,t.shadowRoot??t.attachShadow({mode:"open"}))}}function Ip(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function J2(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Zd(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let o=e[r];if(o!=null)n.set(o.nameId,r)}return t.childIdByNameId=n,n}function BA(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];if(r!=null)t.set(r,n)}return e.childPositionById=t,t}function xA(e,t){if(e.childPositionById!=null)e.childPositionById.set(t,e.childIds.length);e.childIds.push(t)}function V2(e,t){if(e.childPositionById==null)return;for(let n=t;n<e.childIds.length;n++){let r=e.childIds[n];if(r!=null)e.childPositionById.set(r,n)}}function Qp(e,t){let n=0,r=0;for(let o of t.childIds){let c=e[o];if(c==null)continue;n+=c.subtreeNodeCount,r+=c.visibleSubtreeCount}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,Yd(e,t)}function B_(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let o=BA(e).get(t);if(o===void 0)return;let c=o>>5;e.childVisibleChunkSums[c]+=r}function x_(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let c=n,l=0;for(let d of r){if(c<d){let p=qfe(e,t,l,c);return{...p,childVisibleIndex:n-p.localVisibleIndex}}c-=d,l+=32}throw Error(`Visible child index ${String(n)} is out of range`)}let o=n;for(let c=0;c<t.childIds.length;c++){let l=t.childIds[c];if(l==null)continue;let d=e[l];if(d==null)continue;if(o<d.visibleSubtreeCount)return{childIndex:c,childVisibleIndex:n-o,localVisibleIndex:o};o-=d.visibleSubtreeCount}throw Error(`Visible child index ${String(n)} is out of range`)}function kH(e,t,n){let r=0,o=t.childVisibleChunkSums,c=0;if(o!=null){let l=n>>5;for(let d=0;d<l;d+=1)r+=o[d]??0;c=l<<5}for(let l=c;l<n;l+=1){let d=t.childIds[l];if(d==null)continue;let p=e[d];if(p==null)continue;r+=p.visibleSubtreeCount}return r}function Yd(e,t){if(t.childIds.length<128){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/32),r=new Int32Array(n);for(let o=0;o<t.childIds.length;o++){let c=t.childIds[o];if(c==null)continue;let l=e[c];if(l==null)continue;r[o>>5]+=l.visibleSubtreeCount}t.childVisibleChunkSums=r}function qfe(e,t,n,r){let o=Math.min(t.childIds.length,n+32),c=r;for(let l=n;l<o;l++){let d=t.childIds[l];if(d==null)continue;let p=e[d];if(p==null)continue;if(c<p.visibleSubtreeCount)return{childIndex:l,localVisibleIndex:c};c-=p.visibleSubtreeCount}throw Error(`Visible child index ${String(r)} is out of range`)}function Zr(e,t,n=0){return e<<4|n<<3|t}function Ci(e){return e.depthAndFlags>>>4}function rh(e){return(e.depthAndFlags&8)>>3}function Ue(e){return(e.depthAndFlags&8)!==0}function CH(e){return e.depthAndFlags&7}function Rn(e,t){return(CH(e)&t)!==0}function EA(e,t){e.depthAndFlags|=t}function _H(e,t){e.depthAndFlags=Zr(t,CH(e),rh(e))}var vH=Symbol("benchmarkInstrumentation");function BH(e,t){if(t==null)return e;return Object.defineProperty(e,vH,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function ih(e){if(e==null)return null;return e[vH]??null}function qe(e,t,n){if(e==null)return n();return e.measurePhase(t,n)}function IA(e,t,n){if(!Number.isFinite(n)||e==null)return;e.setCounter(t,n)}function xH(e){return e>=48&&e<=57}function Gfe(e){let t=[],n=0,r=0;while(r<e.length){while(r<e.length&&!xH(e.charCodeAt(r)))r+=1;if(r>=e.length)break;if(r>n)t.push(e.slice(n,r));let o=0;while(r<e.length&&xH(e.charCodeAt(r)))o=o*10+(e.charCodeAt(r)-48),r+=1;t.push(o),n=r}if(n<e.length||t.length===0)t.push(e.slice(n));return t}function Dp(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Gfe(t)}}function zfe(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let o=e[r],c=t[r];if(o===c)continue;if(typeof o==="number"&&typeof c==="number")return o<c?-1:1;let l=String(o),d=String(c);if(l!==d)return l<d?-1:1}if(e.length!==t.length)return e.length<t.length?-1:1;return 0}function oh(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==="string"&&typeof t.tokens[0]==="string"){if(e.lowerValue===t.lowerValue)return 0;return e.lowerValue<t.lowerValue?-1:1}let n=zfe(e.tokens,t.tokens);if(n!==0)return n;if(e.lowerValue!==t.lowerValue)return e.lowerValue<t.lowerValue?-1:1;return 0}function EH(e,t,n){let r=oh(n(e),n(t));if(r!==0)return r;if(e===t)return 0;return e<t?-1:1}function Ofe(e,t){return EH(e,t,Dp)}function E_(e,t){if(t!==e.segments.length-1)return 1;return e.isDirectory?1:0}function Hfe(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let o=e.segments[r],c=t.segments[r];if(o===c)continue;let l=E_(e,r);if(l!==E_(t,r))return l===1?-1:1;return Ofe(o,c)}if(e.segments.length!==t.segments.length)return e.segments.length<t.segments.length?-1:1;if(e.isDirectory===t.isDirectory)return 0;return e.isDirectory?-1:1}function IH(e,t){return Hfe(e,t)}function QH(e,t,n){let r=(c)=>{let l=n.get(c);if(l!=null)return l;let d=Dp(c);return n.set(c,d),d},o=Math.min(e.segments.length,t.segments.length);for(let c=0;c<o;c++){let l=e.segments[c],d=t.segments[c];if(l===d)continue;let p=E_(e,c);if(p!==E_(t,c))return p===1?-1:1;return EH(l,d,r)}if(e.segments.length!==t.segments.length)return e.segments.length<t.segments.length?-1:1;if(e.isDirectory===t.isDirectory)return 0;return e.isDirectory?-1:1}function sh(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],o=Dp(r);return e.sortKeyById[t]=o,o}function X2(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??"default"}}function DH(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],o=0;for(let c=0;c<n;c++){if(e.charCodeAt(c)!==47)continue;r.push(e.slice(o,c)),o=c+1}return r.push(e.slice(o,n)),{hasTrailingSlash:t,segments:r}}function Sp(e){let{hasTrailingSlash:t,segments:n}=DH(e);return{basename:n[n.length-1]??"",isDirectory:t,path:e,segments:n}}function I_(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=DH(e);return{requiresDirectory:t,segments:n}}function Q_(){let e=new Map;return e.set("",0),{idByValue:e,valueById:[""],sortKeyById:[Dp("")]}}function bs(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 ro(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var eS=Symbol("pathStorePreparedInputKind");function LH(e,t){return e[eS]=t,e}function SH(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function RH(e,t,n){if(n==="default")return IH(e,t);return n(SH(e),SH(t))}function Ufe(){return{depthAndFlags:Zr(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function Zfe(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 FH(e){return e.isDirectory?e.segments.length:e.segments.length-1}function Yfe(e){return Array.isArray(e)&&e.every((t)=>t!=null&&typeof t==="object"&&typeof t.path==="string"&&Array.isArray(t.segments)&&typeof t.basename==="string"&&typeof t.isDirectory==="boolean")}function Kfe(e){return Array.isArray(e)&&e.every((t)=>typeof t==="string")}function NH(e,t={}){return D_(e,t).map((n)=>n.path)}function MH(e,t={}){let n=D_(e,t);return LH({paths:n.map((r)=>r.path),preparedPaths:n},"prepared")}function jH(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let o=e[r];if(o.length>0&&o.charCodeAt(o.length-1)===47){n=!0;break}}return LH({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},"presorted")}function TH(e){let t=e,n=t.preparedPaths;if(t[eS]==="prepared"&&n!=null)return n;if(!Yfe(n))throw Error("preparedInput must come from PathStore.prepareInput()");return n}function $H(e){let t=e;if(t[eS]==="presorted"&&t.presortedPaths!=null)return t.presortedPaths;return Kfe(t.presortedPaths)?t.presortedPaths:null}function PH(e){let t=e;return typeof t.presortedPathsContainDirectories==="boolean"?t.presortedPathsContainDirectories:null}function D_(e,t={}){let n=X2(t),r=ih(t);IA(r,"workload.inputFiles",e.length);let o=qe(r,"store.preparePathEntries.parse",()=>e.map((c)=>Sp(c)));return qe(r,"store.preparePathEntries.sort",()=>o.sort((c,l)=>RH(c,l,n.sort))),o}var S_=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[Ufe()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=Q_();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=ih(e),this.options=X2(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let n=new Set,r=t.length;for(let o=0;o<r;o+=1){let c=t[o],l=c.length;n.add(l>0&&c.charCodeAt(l-1)===47?c.slice(0,l-1):c)}this.initialExpandedPathSet=n,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,Ip())}appendPaths(e){return qe(this.instrumentation,"store.builder.appendPaths.parse",()=>this.appendPreparedPaths(e.map((t)=>Sp(t))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,qe(this.instrumentation,"store.builder.appendPreparedPaths",()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return qe(this.instrumentation,"store.builder.appendPresortedPaths",()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,o=this.nodes,c=this.segmentTable,l=c.idByValue,d=c.valueById,p=this.directoryStack,A=0,f="",b=0;for(let h of e){if(n===h)throw Error(`Duplicate path: "${h}"`);let w=h.length>0&&h.charCodeAt(h.length-1)===47,C=w?h.length-1:h.length,_=0,v=0;if(n!=null)if(f.length>0&&h.length>f.length&&h.startsWith(f))_=b,v=f.length;else{let I=Math.min(C,n.length),D=!0;for(let F=0;F<I;F++){let M=h.charCodeAt(F);if(M!==n.charCodeAt(F)){D=!1;break}if(M===47)_++,v=F+1}if(D&&w&&I===C&&n.length>C&&n.charCodeAt(C)===47)_++,v=C+1}A=_,r=_;let B=v,E=h.indexOf("/",B);while(E>=0&&E<C){let I=p[A];if(I===void 0)throw Error("Directory stack underflow while building the path store");r++;let D=h.slice(B,E),F=l.get(D);if(F===void 0)F=d.length,l.set(D,F),d.push(D);let M=o.length;o.push({depthAndFlags:Zr(r,0,1),nameId:F,parentId:I,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(h.slice(0,E)),A++,p[A]=M,B=E+1,E=h.indexOf("/",B)}if(w){if(B<C){let D=p[A];if(D===void 0)throw Error(`Unable to resolve directory parent for "${h}"`);r++;let F=h.slice(B,C),M=l.get(F);if(M===void 0)M=d.length,l.set(F,M),d.push(F);let P=o.length;o.push({depthAndFlags:Zr(r,0,1),nameId:M,parentId:D,subtreeNodeCount:1,visibleSubtreeCount:1}),A++,p[A]=P,B=C+1}let I=p[A];if(I===void 0)throw Error(`Unable to resolve directory node for "${h}"`);this.promoteDirectoryToExplicit(I,h)}else{let I=p[A];if(I===void 0)throw Error(`Unable to resolve file parent for "${h}"`);let D=h.slice(B),F=l.get(D);if(F===void 0)F=d.length,l.set(D,F),d.push(D);o.push({depthAndFlags:Zr(r+1,0),nameId:F,parentId:I,subtreeNodeCount:1,visibleSubtreeCount:1})}if(B!==f.length)f=h.substring(0,B),b=r;n=h}if(p.length=A+1,n!=null)this.lastPreparedPath=Sp(n);this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,o=this.segmentTable,c=o.idByValue,l=o.valueById,d=this.directoryStack,p=0,A="",f=0;for(let b of e){if(t===b)throw Error(`Duplicate path: "${b}"`);let h=b.length,w=0,C=0;if(t!=null)if(A.length>0&&b.length>A.length&&b.startsWith(A))w=f,C=A.length;else{let D=Math.min(h,t.length);for(let F=0;F<D;F++){let M=b.charCodeAt(F);if(M!==t.charCodeAt(F))break;if(M===47)w++,C=F+1}}p=w,n=w;let _=C,v=b.indexOf("/",_);while(v>=0){let D=d[p];if(D===void 0)throw Error("Directory stack underflow while building the path store");n++;let F=b.slice(_,v),M=c.get(F);if(M===void 0)M=l.length,c.set(F,M),l.push(F);let P=r.length;r.push({depthAndFlags:Zr(n,0,1),nameId:M,parentId:D,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(b.slice(0,v)),this.presortedDirectoryNodeIds.push(P),p++,d[p]=P,_=v+1,v=b.indexOf("/",_)}let B=d[p];if(B===void 0)throw Error(`Unable to resolve file parent for "${b}"`);let E=b.slice(_),I=c.get(E);if(I===void 0)I=l.length,c.set(E,I),l.push(E);if(r.push({depthAndFlags:Zr(n+1,0),nameId:I,parentId:B,subtreeNodeCount:1,visibleSubtreeCount:1}),_!==A.length)A=b.substring(0,_),f=n;t=b}if(d.length=p+1,t!=null)this.lastPreparedPath=Sp(t);this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;if(this.hasDeferredDirectoryIndexes)qe(this.instrumentation,"store.builder.buildDirectoryIndexes",()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1;else if(!t)qe(this.instrumentation,"store.builder.computeSubtreeCounts",()=>this.computeSubtreeCounts(0));return{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(),this.hasDeferredDirectoryIndexes=!1;if(this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t){if((this.options.sort==="default"?QH(this.lastPreparedPath,e,this.segmentSortKeyCache):RH(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}}let n=this.lastPreparedPath,r=FH(e),o=n==null?0:FH(n),c=n==null?0:Zfe(n.segments,e.segments),l=Math.min(c,r,o);this.directoryStack.length=l+1;for(let p=l;p<r;p++){let A=this.directoryStack[this.directoryStack.length-1];if(A===void 0)throw Error("Directory stack underflow while building the path store");let f=t?this.getOrCreateDirectoryChild(A,e.segments[p]):this.createDirectoryChild(A,e.segments[p]);this.directoryStack.push(f)}if(e.isDirectory){let p=this.directoryStack[this.directoryStack.length-1];if(p===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(p,e.path),this.lastPreparedPath=e;return}let d=this.directoryStack[this.directoryStack.length-1];if(d===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);if(t)this.createFileChild(d,e.basename,e.path);else this.createFileChildUnchecked(d,e.basename);this.lastPreparedPath=e}recordCreatedDirectoryPath(e){if(!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null)return;if(this.createdDirectoryCount+=1,!this.initialExpandedPathSet.has(e))this.createdDirectoriesAllExpanded=!1}createFileChild(e,t,n){let r=bs(this.segmentTable,t),o=this.getDirectoryIndex(e),c=o.childIdByNameId;if(c!=null){if(c.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`)}let l=this.nodes[e];if(l===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let d=this.nodes.length;if(this.nodes.push({depthAndFlags:Zr(Ci(l)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),c!=null)c.set(r,d);return xA(o,d),d}createFileChildUnchecked(e,t){let n=bs(this.segmentTable,t),r=this.getDirectoryIndex(e),o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let c=this.nodes.length;if(this.nodes.push({depthAndFlags:Zr(Ci(o)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null)r.childIdByNameId.set(n,c);return xA(r,c),c}getOrCreateDirectoryChild(e,t){let n=bs(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let l=r.childIdByNameId.get(n);if(l!==void 0){let d=this.nodes[l];if(d!=null&&!Ue(d))throw Error(`Path collides with an existing file while creating directory "${t}"`);return l}}let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let c=this.nodes.length;if(this.nodes.push({depthAndFlags:Zr(Ci(o)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null)r.childIdByNameId.set(n,c);return xA(r,c),this.directories.set(c,Ip()),c}createDirectoryChild(e,t){let n=bs(this.segmentTable,t),r=this.getDirectoryIndex(e),o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let c=this.nodes.length;if(this.nodes.push({depthAndFlags:Zr(Ci(o)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null)r.childIdByNameId.set(n,c);return xA(r,c),this.directories.set(c,Ip()),c}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!Ue(n))throw Error(`Path is not a directory: "${t}"`);if(Rn(n,1))throw Error(`Duplicate path: "${t}"`);EA(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,J2());let r=-1,o=null;for(let c=1;c<t.length;c++){let l=t[c];if(l==null)continue;if(Ue(l)){let p=J2();n.set(c,p),r=c,o=p}let d;if(l.parentId===r)d=o;else d=n.get(l.parentId),r=l.parentId,o=d??null;if(d!=null)d.childIds.push(c)}if(e)return;for(let c=t.length-1;c>=1;c--){let l=t[c];if(l==null)continue;let d=t[l.parentId];if(d!=null)d.subtreeNodeCount+=l.subtreeNodeCount,d.visibleSubtreeCount+=l.visibleSubtreeCount}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;if(Ue(n))this.directories.set(t,Ip());let r=this.directories.get(n.parentId);if(r!=null){if(r.childIdByNameId!=null)r.childIdByNameId.set(n.nameId,t);xA(r,t)}}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!Ue(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let o of n.childIds)r+=this.computeSubtreeCounts(o);return Qp(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function qH(e,t="closed",n=null){let r=Wfe(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 GH(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function Wfe(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 zH(e,t){if(Rn(t,2))return!0;if(e.defaultExpansion==="open")return!0;if(e.defaultExpansion==="closed")return!1;return Ci(t)<=e.defaultExpansion}function Ka(e,t,n=e.snapshot.nodes[t]){if(n==null||!Ue(n))return!1;if(e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides)return!0;if(e.collapsedDirectoryIds.has(t))return!1;if(e.expandedDirectoryIds.has(t))return!0;return zH(e,n)}function Kd(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!Ue(r))return;let o=zH(e,r);if(n){if(o){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(o){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function OH(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 Wd(e,t){return e.directoryLoadInfoById.get(t)?.state??"loaded"}function HH(e,t){let n=OH(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 UH(e,t){let n=OH(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state="unloaded"}function ZH(e,t,n){let r=e.directoryLoadInfoById.get(t);if(r==null||r.activeAttemptId!==n)return!1;return r.activeAttemptId=null,r.errorMessage=null,r.state="loaded",!0}function YH(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function KH(e,t,n,r){let o=e.directoryLoadInfoById.get(t);if(o==null||o.activeAttemptId!==n)return!1;return o.activeAttemptId=null,o.errorMessage=r??null,o.state="error",!0}function WH(e,t){e.directoryLoadInfoById.delete(t)}function tU(e,t,n){let r=n,o=e.listeners.get(t);if(o!=null)o.add(r);else e.listeners.set(t,new Set([r]));return()=>{let c=e.listeners.get(t);if(c==null)return;if(c.delete(r),c.size===0)e.listeners.delete(t)}}function nU(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:"add",path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function aU(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:"remove",path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function rU(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:"move",projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function iU(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:"expand",path:e.path,projectionChanged:!0,visibleCountDelta:null}}function oU(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:"collapse",path:e.path,projectionChanged:!0,visibleCountDelta:null}}function sU(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:"mark-directory-unloaded",path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function cU(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 lU(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some((t)=>t.canonicalChanged),childEvents:e.childEvents,operation:"apply-child-patch",path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function dU(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 uU(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 pU(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 Yr(e,t,n){return{...n,visibleCountDelta:nS(e)-t}}function mU(e,t){let n=nS(e),r=GH();e.transactionStack.push(r);try{t()}catch(o){throw VH(e,r,!1),o}VH(e,r,!0,nS(e)-n)}function jo(e,t){let n=e.instrumentation;if(n==null){JH(e,t);return}qe(n,"store.events.record",()=>JH(e,t))}function JH(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){tS(e,t);return}n.events.push(t),Xfe(n,t)}function VH(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error("Transaction stack underflow");if(!n)return;let o=e.transactionStack[e.transactionStack.length-1]??null;if(o!=null){let d=e.instrumentation;if(d==null)XH(o,t);else qe(d,"store.events.batch.merge",()=>XH(o,t));return}let c=Jfe(t,r),l=e.instrumentation;if(l==null){tS(e,c);return}qe(l,"store.events.batch.commit",()=>tS(e,c))}function Jfe(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some((n)=>n.canonicalChanged),events:[...e.events],operation:"batch",projectionChanged:e.events.some((n)=>n.projectionChanged),visibleCountDelta:t}}function Vfe(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function XH(e,t){for(let n of t.events)e.events.push(n);Vfe(e,t)}function Xfe(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function tS(e,t){let n=e.instrumentation;if(n==null){eU(e,t);return}qe(n,"store.events.emit",()=>eU(e,t))}function eU(e,t){e.listeners.get(t.operation)?.forEach((n)=>n(t)),e.listeners.get("*")?.forEach((n)=>n(t))}function nS(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function Cl(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!Ue(n)||Rn(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let o=r.childIds[0];if(o==null)return null;let c=e.snapshot.nodes[o];if(c==null||!Ue(c))return null;return o}function _l(e,t){let n=t;while(!0){let r=Cl(e,n);if(r==null)return n;n=r}}function QA(e,t){let n=[t],r=t;while(!0){let o=Cl(e,r);if(o==null)return n;n.push(o),r=o}}function F_(e,t){let n=t==null?e.snapshot.rootId:Kr(e,t);if(n==null)return[];return tbe(e,n)}function rS(e,t){let n=Sp(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),o=Jd(e,dbe(e,r)),{createdNodeIds:c,directoryId:l}=nbe(e,r),d=new Set(c),p=l;if(n.isDirectory){let f=Ve(e,l);if(Rn(f,1))throw Error(`Path already exists: "${t}"`);EA(f,1),e.pathCacheByNodeId.set(l,{path:t,version:e.pathCacheVersion}),d.add(l)}else p=rbe(e,l,n.basename),d.add(p);Vd(e,l);let A=Jd(e,l);return nU({affectedAncestorIds:io(e,p),affectedNodeIds:[...d],path:t,projectionChanged:wU(o,A)})}function iS(e,t,n){let r=Kr(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let o=Ve(e,r);if(Rn(o,2))throw Error("The root node cannot be removed");if(Ue(o)&&vn(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let c=o.parentId,l=Jd(e,c),d=yU(e,r);cS(e,c,r,o.nameId),lS(e,c),Vd(e,c);let p=Jd(e,c);return aU({affectedAncestorIds:io(e,c),affectedNodeIds:d,path:t,projectionChanged:wU(l,p),recursive:n.recursive===!0})}function oS(e,t,n,r){let o=Kr(e,t);if(o==null)throw Error(`Source path does not exist: "${t}"`);let c=Ve(e,o);if(Rn(c,2))throw Error("The root node cannot be moved");let l=r.collision??"error",d=cbe(e,o,n),p=Jd(e,c.parentId),A=Jd(e,d.parentId),f=ro(e.snapshot.segmentTable,c.nameId),b=bs(e.snapshot.segmentTable,d.basename);if(d.parentId===c.parentId&&f===d.basename)return null;if(Ue(c)&&pbe(e,o,d.parentId))throw Error("Cannot move a directory into one of its descendants");let h=Zd(e.snapshot.nodes,vn(e,d.parentId)).get(b),w=d.existingNodeId??h??null;if(w!=null&&w!==o){if(lbe(e,w,l,rh(c))==="skip")return null}let C=c.parentId;if(cS(e,C,o,c.nameId),c.parentId=d.parentId,c.nameId=b,e.pathCacheByNodeId.delete(o),CU(e,o),sS(e,d.parentId,o),lS(e,C),e.pathCacheVersion++,Vd(e,C),d.parentId!==C)Vd(e,d.parentId);let _=Jd(e,C),v=Jd(e,d.parentId);return rU({affectedAncestorIds:[...new Set([...io(e,C),...io(e,d.parentId)])],affectedNodeIds:[o],from:t,projectionChanged:kU([p,A],[_,v]),to:hn(e,o)})}function ebe(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function AU(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function hn(e,t){let n=Ve(e,t),r=ebe(e,t);if(r!=null)return r;if(Rn(n,2))return AU(e,t,"");let o=hn(e,n.parentId),c=ro(e.snapshot.segmentTable,n.nameId),l=o.length===0?c:`${o}${c}`;return AU(e,t,Ue(n)?`${l}/`:l)}function Vd(e,t){let n=e.instrumentation;if(n==null){fU(e,t);return}qe(n,"store.recomputeCountsUpwardFrom",()=>fU(e,t))}function ch(e,t){let n=[[t,0]],{nodes:r,directories:o}=e.snapshot;while(n.length>0){let c=n[n.length-1],l=c[0],d=r[l];if(d==null||!Ue(d)){aS(e,l,d,!0),n.pop();continue}let p=o.get(l);if(p==null||c[1]>=p.childIds.length){aS(e,l,d,!0),n.pop();continue}let A=p.childIds[c[1]++];n.push([A,0])}}function io(e,t){let n=[],r=t;while(r!=null){let o=Ve(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=o.parentId}return n}function Kr(e,t){if(t.length===0)return e.snapshot.rootId;let n=I_(t);return hU(e,n.segments,n.requiresDirectory)}function hU(e,t,n){let r=e.snapshot.rootId;for(let c of t){let l=e.snapshot.segmentTable.idByValue.get(c);if(l===void 0)return null;let d=vn(e,r),p=Zd(e.snapshot.nodes,d).get(l);if(p===void 0)return null;r=p}let o=Ve(e,r);if(n&&!Ue(o))return null;return r}function vn(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 Ve(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Rn(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function tbe(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Rn(n,4))return[];if(!Ue(n))return[hn(e,t)];if(vn(e,t).childIds.length===0)return Rn(n,1)&&!Rn(n,2)?[hn(e,t)]:[];let r=[],o=[{childIndex:0,nodeId:t}];while(o.length>0){let c=o[o.length-1];if(c==null)break;let l=e.snapshot.nodes[c.nodeId];if(l===void 0||Rn(l,4)){o.pop();continue}if(!Ue(l)){r.push(hn(e,c.nodeId)),o.pop();continue}let d=vn(e,c.nodeId);if(d.childIds.length===0){if(Rn(l,1)&&!Rn(l,2))r.push(hn(e,c.nodeId));o.pop();continue}let p=d.childIds[c.childIndex];if(p==null){o.pop();continue}c.childIndex++,o.push({childIndex:0,nodeId:p})}return r}function nbe(e,t){let n=[],r=e.snapshot.rootId;for(let o of t){let c=bs(e.snapshot.segmentTable,o),l=vn(e,r),d=Zd(e.snapshot.nodes,l).get(c);if(d!==void 0){if(!Ue(Ve(e,d)))throw Error(`Cannot create a directory that collides with an existing file: "${o}"`);r=d;continue}r=abe(e,r,c),n.push(r)}return{createdNodeIds:n,directoryId:r}}function abe(e,t,n){let r=Ve(e,t),o=e.snapshot.nodes.length;if(e.snapshot.nodes.push({depthAndFlags:Zr(Ci(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(o,Ip()),sS(e,t,o),e.collapseNewDirectoriesByDefault)e.collapsedDirectoryIds.add(o),e.hasCollapsedDirectoryOverrides=!0;return e.activeNodeCount++,o}function rbe(e,t,n){let r=bs(e.snapshot.segmentTable,n),o=vn(e,t);if(Zd(e.snapshot.nodes,o).has(r))throw Error(`Path already exists: "${mbe(e,t,n)}"`);let c=Ve(e,t),l=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Zr(Ci(c)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),sS(e,t,l),e.activeNodeCount++,l}function ibe(e,t,n){let r=0,o=t.childIds.length;while(r<o){let c=r+o>>>1,l=t.childIds[c];if(l==null){o=c;continue}if(obe(e,n,l)<0)o=c;else r=c+1}return r}function sS(e,t,n){let r=vn(e,t),o=Ve(e,n);Zd(e.snapshot.nodes,r).set(o.nameId,n),B_(r,n,o.subtreeNodeCount,o.visibleSubtreeCount);let c=ibe(e,r,n);r.childIds.splice(c,0,n),V2(r,c),Yd(e.snapshot.nodes,r)}function cS(e,t,n,r){let o=vn(e,t),c=BA(o),l=c.get(n)??-1;Zd(e.snapshot.nodes,o).delete(r),c.delete(n);let d=e.snapshot.nodes[n];if(d!=null)B_(o,n,-d.subtreeNodeCount,-d.visibleSubtreeCount);if(l>=0)o.childIds.splice(l,1),V2(o,l),Yd(e.snapshot.nodes,o)}function obe(e,t,n){let r=e.snapshot.options.sort;if(r==="default")return sbe(e,t,n);return r(gU(e,t),gU(e,n))}function sbe(e,t,n){let r=Ve(e,t),o=Ve(e,n),c=Ue(r);if(c!==Ue(o))return c?-1:1;let l=oh(sh(e.snapshot.segmentTable,r.nameId),sh(e.snapshot.segmentTable,o.nameId));if(l!==0)return l;let d=ro(e.snapshot.segmentTable,r.nameId),p=ro(e.snapshot.segmentTable,o.nameId);if(d!==p)return d<p?-1:1;return t<n?-1:1}function gU(e,t){let n=Ve(e,t),r=hn(e,t),o=Ue(n),c=o?r.slice(0,-1):r;return{basename:ro(e.snapshot.segmentTable,n.nameId),depth:Ci(n),isDirectory:o,path:r,segments:c.length===0?[]:c.split("/")}}function cbe(e,t,n){let r=Ve(e,t),o=Kr(e,n);if(o!=null){let A=Ve(e,o);if(Ue(A))return{basename:ro(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:o};let f=I_(n).segments;return{basename:f[f.length-1]??"",existingNodeId:o,parentId:A.parentId}}let c=I_(n),l=c.segments[c.segments.length-1]??"",d=c.segments.slice(0,-1),p=d.length===0?e.snapshot.rootId:hU(e,d,!0);if(p==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:l,existingNodeId:null,parentId:p}}function lbe(e,t,n,r){if(n==="skip")return"skip";if(n==="error")throw Error(`Destination already exists: "${hn(e,t)}"`);let o=Ve(e,t);if(rh(o)!==r)throw Error("replace collision requires the same source and destination kinds");if(Ue(o)&&vn(e,t).childIds.length>0)throw Error("replace collision does not support non-empty directories");let{parentId:c,nameId:l}=o;return yU(e,t),cS(e,c,t,l),lS(e,c),Vd(e,c),"handled"}function yU(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];while(r.length>0){let o=r.pop();if(o==null)break;let c=Ve(e,o.nodeId);if(o.visitedChildren||!Ue(c)){if(Ue(c))e.snapshot.directories.delete(o.nodeId);if(EA(c,4),e.pathCacheByNodeId.delete(o.nodeId),e.collapsedDirectoryIds.delete(o.nodeId))e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;e.expandedDirectoryIds.delete(o.nodeId),WH(e,o.nodeId),e.activeNodeCount--,n.push(o.nodeId);continue}r.push({nodeId:o.nodeId,visitedChildren:!0});let l=vn(e,o.nodeId);for(let d=l.childIds.length-1;d>=0;d--){let p=l.childIds[d];if(p!=null)r.push({nodeId:p,visitedChildren:!1})}}return n}function lS(e,t){let n=t;while(n!=null){let r=Ve(e,n);if(!Ue(r)||Rn(r,2))return;if(vn(e,n).childIds.length>0)return;EA(r,1),n=r.parentId===n?null:r.parentId}}function dbe(e,t){let n=e.snapshot.rootId;for(let r of t){let o=e.snapshot.segmentTable.idByValue.get(r);if(o==null)break;let c=Zd(e.snapshot.nodes,vn(e,n)).get(o);if(c==null)break;if(!Ue(Ve(e,c)))break;n=c}return n}function Jd(e,t){let n=ube(e,t);if(n==null)return null;let r=_l(e,n),o=Ve(e,r),c=n===r?null:QA(e,n).map((l)=>hn(e,l));return JSON.stringify({flattenedSegmentPaths:c,hasChildren:vn(e,r).childIds.length>0,path:hn(e,r),terminalKind:rh(o)})}function wU(e,t){return kU([e],[t])}function kU(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],o=t[n];if(r==null||o==null||r!==o)return!0}return!1}function ube(e,t){let n=t;while(n!=null){let r=Ve(e,n);if(!Ue(r)||Rn(r,2))return null;if(!Ka(e,n,r))return n;n=r.parentId}return null}function CU(e,t){let n=Ve(e,t);if(_H(n,(t===e.snapshot.rootId?-1:Ci(Ve(e,n.parentId)))+1),!Ue(n))return;let r=vn(e,t);for(let o of r.childIds)CU(e,o)}function pbe(e,t,n){let r=n;while(r!=null){if(r===t)return!0;let o=Ve(e,r);if(r===e.snapshot.rootId)return!1;r=o.parentId}return!1}function aS(e,t,n=Ve(e,t),r=!1){let o=e.instrumentation;if(o==null){bU(e,t,n,r);return}qe(o,"store.recomputeNodeCounts",()=>bU(e,t,n,r))}function fU(e,t){let n=t;while(n!=null){let r=Ve(e,n),o=r.subtreeNodeCount,c=r.visibleSubtreeCount;if(aS(e,n,r),n===e.snapshot.rootId)return;let l=r.subtreeNodeCount-o,d=r.visibleSubtreeCount-c,p=r.parentId;if(l!==0||d!==0)B_(vn(e,p),n,l,d);n=p}}function bU(e,t,n,r){if(!Ue(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let o=vn(e,t);if(r){let d=e.instrumentation;if(d==null)Qp(e.snapshot.nodes,o);else qe(d,"store.recomputeNodeCounts.rebuildChildAggregates",()=>Qp(e.snapshot.nodes,o))}let c=1+o.totalChildSubtreeNodeCount,l=o.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=c,Rn(n,2)){n.visibleSubtreeCount=l;return}n.visibleSubtreeCount=Cl(e,t)!=null?l:Ka(e,t,n)?1+l:1}function mbe(e,t,n){let r=hn(e,t);return r.length===0?n:`${r}${n}`}function DA(e){return e!=null&&!Rn(e,4)}function L_(e,t){let n=e.snapshot.nodes[t];if(!DA(n)||!Ue(n)||Rn(n,2))return null;return n}function Abe(e){let t=0;for(let[n,r]of e.pathCacheByNodeId){if(r.version!==e.pathCacheVersion)continue;if(!DA(e.snapshot.nodes[n]))continue;t+=1}return t}function gbe(e){return Math.max(0,e.valueById.length-1)}function _U(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:Abe(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:gbe(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function fbe(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 vU(e){let t=[],n=[];for(let r of e.collapsedDirectoryIds)if(L_(e,r)!=null)t.push(hn(e,r));for(let r of e.expandedDirectoryIds)if(L_(e,r)!=null)n.push(hn(e,r));return{collapsedPaths:t,expandedPaths:n}}function BU(e){let t=[];for(let[n,r]of e.directoryLoadInfoById){if(L_(e,n)==null||Wd(e,n)==="loaded")continue;t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:hn(e,n)})}return t}function xU(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let r=Kr(e,n);if(r==null)continue;Kd(e,r,!0,Ve(e,r))}for(let n of t.collapsedPaths){let r=Kr(e,n);if(r==null)continue;Kd(e,r,!1,Ve(e,r))}}function EU(e,t){e.directoryLoadInfoById.clear();for(let n of t){let r=Kr(e,n.path);if(r==null)continue;if(L_(e,r)==null)continue;e.directoryLoadInfoById.set(r,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function bbe(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:"",version:e.pathCacheVersion})}function hbe(e){let t=e.snapshot.segmentTable,n=Q_();for(let r of e.snapshot.nodes){if(!DA(r))continue;if(Rn(r,2)){r.nameId=0;continue}r.nameId=bs(n,ro(t,r.nameId))}e.snapshot.segmentTable=n}function ybe(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!DA(r)||!Ue(r)){e.snapshot.directories.delete(t);continue}let o=n.childIds.filter((c)=>{let l=e.snapshot.nodes[c];return DA(l)&&l.parentId===t});n.childIds=o,n.childIdByNameId=new Map(o.map((c)=>[Ve(e,c).nameId,c])),n.childPositionById=new Map(o.map((c,l)=>[c,l])),Qp(e.snapshot.nodes,n)}}function wbe(e){let t=e.snapshot.nodes.length-1;while(t>e.snapshot.rootId){let n=e.snapshot.nodes[t];if(DA(n))break;t-=1}e.snapshot.nodes.length=t+1}function kbe(e){let t=vU(e),n=BU(e);qe(e.instrumentation,"store.cleanup.stable.clearPathCaches",()=>bbe(e)),qe(e.instrumentation,"store.cleanup.stable.rebuildSegmentTable",()=>hbe(e)),qe(e.instrumentation,"store.cleanup.stable.rebuildDirectoryIndexes",()=>ybe(e)),qe(e.instrumentation,"store.cleanup.stable.trimTrailingRemovedNodeSlots",()=>wbe(e)),qe(e.instrumentation,"store.cleanup.stable.restoreExpansionOverrides",()=>xU(e,t)),qe(e.instrumentation,"store.cleanup.stable.restoreDirectoryLoadInfos",()=>EU(e,n)),qe(e.instrumentation,"store.cleanup.stable.recomputeCounts",()=>ch(e,e.snapshot.rootId))}function Cbe(e){let t=vU(e),n=BU(e),r=qe(e.instrumentation,"store.cleanup.aggressive.listPaths",()=>F_(e)),o=BH({...e.snapshot.options},e.instrumentation),c=qe(e.instrumentation,"store.cleanup.aggressive.rebuildSnapshot",()=>{let l=new S_(o);return l.appendPaths(r),l.finish()});e.snapshot=c,e.activeNodeCount=c.nodes.length-1,e.pathCacheByNodeId=new Map([[c.rootId,{path:"",version:0}]]),e.pathCacheVersion=0,qe(e.instrumentation,"store.cleanup.aggressive.restoreExpansionOverrides",()=>xU(e,t)),qe(e.instrumentation,"store.cleanup.aggressive.restoreDirectoryLoadInfos",()=>EU(e,n)),qe(e.instrumentation,"store.cleanup.aggressive.recomputeCounts",()=>ch(e,e.snapshot.rootId))}function IU(e){for(let t of e.directoryLoadInfoById.values())if(t.state==="loading"&&t.activeAttemptId!=null)return!0;return!1}function QU(e,t){let n=_U(e);if(t==="stable")qe(e.instrumentation,"store.cleanup.stable",()=>kbe(e));else qe(e.instrumentation,"store.cleanup.aggressive",()=>Cbe(e));let r=_U(e);return fbe(t,t==="stable",n,r)}var _be=64;function vbe(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;while(r<n)r*=2;let o=new Int32Array(r);return o.fill(-1),o.set(e),o}function Wa(e){return Ve(e,e.snapshot.rootId).visibleSubtreeCount}function LU(e,t,n,r){let o=Ve(e,t.terminalNodeId),c=Math.max(1,o.visibleSubtreeCount);return Math.min(r-1,n+c-1)}function Bbe(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:lh(e,t.cursor),setSize:t.setSize,subtreeEndIndex:LU(e,t.cursor,t.index,n)}}function RU(e,t,n,r,o,c){let l=vn(e,t),{childIndex:d,childVisibleIndex:p,localVisibleIndex:A}=x_(e.snapshot.nodes,l,n),f=l.childIds[d];if(f==null)throw Error(`Visible index ${String(n)} is out of range`);return xbe(e,f,A,r+p,o+1,d,l.childIds.length,c)}function xbe(e,t,n,r,o,c,l,d){if(!Ue(Ve(e,t))){if(n===0)return{ancestors:d,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:o},index:r,posInSet:c,setSize:l};throw Error(`Visible index ${String(n)} is out of range for file`)}let p=GU(e,t,o);if(n===0)return{ancestors:d,cursor:p,index:r,posInSet:c,setSize:l};let A=Ve(e,p.terminalNodeId);if(!Ue(A)||!Ka(e,p.terminalNodeId,A))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return RU(e,p.terminalNodeId,n-1,r+1,p.visibleDepth,[...d,{cursor:p,index:r,posInSet:c,setSize:l}])}function NU(e,t){let n=Wa(e);if(t<0||t>=n)return null;let r=RU(e,e.snapshot.rootId,t,0,-1,[]),o=r.ancestors.map((l)=>hn(e,l.cursor.terminalNodeId)),c=null;return{ancestorPaths:o,get ancestorRows(){if(c!=null)return c;let l=[],d=[];for(let p of r.ancestors){let A=Bbe(e,p,n,[...d]);l.push(A),d.push(A.row.path)}return c=l,c},index:r.index,posInSet:r.posInSet,row:lh(e,r.cursor),setSize:r.setSize,subtreeEndIndex:LU(e,r.cursor,r.index,n)}}function MU(e,t,n){let r=e.instrumentation,o=Wa(e);if(o<=0||n<t)return[];let c=Math.max(0,Math.min(t,o-1)),l=Math.max(c,Math.min(n,o-1));if(r==null){if(c===0)return Qbe(e,l+1);let b=[],h=DU(e,c);for(let w=c;w<=l&&h!=null;w++){let C=lh(e,h);b.push(C),h=SU(e,h)}return b}let d=[],p=0,A=0,f=qe(r,"store.getVisibleSlice.selectFirstRow",()=>DU(e,c));for(let b=c;b<=l&&f!=null;b++){let h=qe(r,"store.getVisibleSlice.materializeRow",()=>lh(e,f));if(d.push(h),h.isFlattened)p++,A+=h.flattenedSegments?.length??0;f=qe(r,"store.getVisibleSlice.advanceCursor",()=>SU(e,f))}return IA(r,"workload.visibleRowsRead",d.length),IA(r,"workload.flattenedRowsRead",p),IA(r,"workload.flattenedSegmentsRead",A),d}function uS(e,t=Wa(e)){let n=e.instrumentation;if(n==null)return FU(e,t);return qe(n,"store.getVisibleTreeProjection",()=>FU(e,t))}function jU(e){return Ibe(uS(e))}function TU(e,t){let n=Kr(e,t);if(n==null||n===e.snapshot.rootId)return null;if(Ue(Ve(e,n))&&_l(e,n)!==n)return null;let r=0,o=n,{nodes:c,rootId:l}=e.snapshot;while(o!==l){let d=Ve(e,o).parentId,p=vn(e,d),A=BA(p).get(o);if(A==null)throw Error(`Child ${String(o)} was not found in its parent index`);if(r+=kH(c,p,A),d!==l){let f=Ve(e,d),b=Cl(e,d);if(!Ka(e,d,f)&&b!==o)return null;if(_l(e,d)===d)r+=1}o=d}return r}function $U(e,t){let n=Kr(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=Ve(e,n);if(!Ue(r))throw Error(`Path is not a directory: "${t}"`);if(Ka(e,n,r))return null;return Kd(e,n,!0,r),Vd(e,n),iU({affectedAncestorIds:io(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})}function PU(e,t){let n=Kr(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=Ve(e,n);if(!Ue(r))throw Error(`Path is not a directory: "${t}"`);if(!Ka(e,n,r))return null;return Kd(e,n,!1,r),Vd(e,n),oU({affectedAncestorIds:io(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})}function DU(e,t){if(t<0||t>=Wa(e))return null;return qU(e,e.snapshot.rootId,t,-1)}function qU(e,t,n,r){let o=vn(e,t),c=e.instrumentation,{childIndex:l,localVisibleIndex:d}=c==null?x_(e.snapshot.nodes,o,n):qe(c,"store.getVisibleSlice.selectChildIndex",()=>x_(e.snapshot.nodes,o,n)),p=o.childIds[l];if(p!=null)return dS(e,p,d,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function dS(e,t,n,r){if(!Ue(Ve(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 o=GU(e,t,r);if(n===0)return o;let c=Ve(e,o.terminalNodeId);if(!Ue(c)||!Ka(e,o.terminalNodeId,c))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return qU(e,o.terminalNodeId,n-1,o.visibleDepth)}function GU(e,t,n){if(!Ue(Ve(e,t)))return{headNodeId:t,terminalNodeId:t,visibleDepth:n};if(e.instrumentation==null)return{headNodeId:t,terminalNodeId:_l(e,t),visibleDepth:n};return{headNodeId:t,terminalNodeId:qe(e.instrumentation,"store.getVisibleSlice.flatten.resolveTerminalDirectory",()=>_l(e,t)),visibleDepth:n}}function Ebe(e,t){let n=Ve(e,t);if(!Ue(n))return!0;let r=n.parentId;if(r===e.snapshot.rootId)return!0;return Cl(e,r)!==t}function SU(e,t){let n=Ve(e,t.terminalNodeId);if(Ue(n)){let c=vn(e,t.terminalNodeId);if(Ka(e,t.terminalNodeId,n)&&c.childIds.length>0){let l=c.childIds[0];return l==null?null:dS(e,l,0,t.visibleDepth+1)}}let{terminalNodeId:r,visibleDepth:o}=t;while(!0){let c=Ve(e,r);if(r===e.snapshot.rootId)return null;let l=c.parentId,d=vn(e,l),p=BA(d).get(r)??-1;if(p<0)throw Error(`Child ${String(r)} was not found in its parent index`);let A=d.childIds[p+1]??null;if(A!=null)return dS(e,A,0,o);if(Ebe(e,r))o--;r=l}}function Ibe(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let o=e.getParentIndex(r);n[r]={index:r,parentPath:o>=0?e.paths[o]??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 FU(e,t){let n=Array(t),r=new Int32Array(t),o=new Int32Array(t),c=new Int32Array(t),l=new Int32Array(_be);l.fill(-1);let d=0,{nodes:p,directories:A,segmentTable:f}=e.snapshot,b=[[A.get(e.snapshot.rootId),0,-1,""]],h=e.snapshot.options.flattenEmptyDirectories,w=e.pathCacheByNodeId,C=e.pathCacheVersion,_=f.valueById;while(b.length>0&&d<t){let D=b[b.length-1],F=D[0];if(D[1]>=F.childIds.length){b.pop();continue}let M=D[1],P=F.childIds[D[1]++],q=p[P],W=D[2]+1,Z=D[3];l=vbe(l,W);let ye,ne=P;if(!Ue(q)){let ce=w.get(P);ye=ce!=null&&ce.version===C?ce.path:`${Z}${_[q.nameId]}`}else ne=h?_l(e,P):P,ye=ne===P?`${Z}${_[q.nameId]}/`:hn(e,ne);r[d]=l[W],n[d]=ye,o[d]=M,c[d]=F.childIds.length,l[W+1]=d,d+=1;let re=p[ne];if(re!=null&&Ue(re)&&Ka(e,ne,re))b.push([A.get(ne),0,W,ye])}if(d<t)n.length=d;let v=r.subarray(0,d),B=o.subarray(0,d),E=c.subarray(0,d),I=null;return{getParentIndex(D){return D<0||D>=d?-1:v[D]??-1},paths:n,posInSetByIndex:B,setSizeByIndex:E,get visibleIndexByPath(){if(I==null){I=new Map;for(let D=0;D<d;D+=1)I.set(n[D]??"",D)}return I}}}function Qbe(e,t){let n=Array(t),r=0,{nodes:o,directories:c,segmentTable:l}=e.snapshot,d=[[c.get(e.snapshot.rootId),0,-1]],p=l.valueById,A=e.snapshot.options.flattenEmptyDirectories,f=e.pathCacheByNodeId,b=e.pathCacheVersion;while(d.length>0&&r<t){let h=d[d.length-1],w=h[0];if(h[1]>=w.childIds.length){d.pop();continue}let C=w.childIds[h[1]++],_=o[C],v=h[2]+1;if(!Ue(_)){let D=f.get(C);n[r++]={depth:v,flattenedSegments:void 0,hasChildren:!1,id:C,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:"file",loadState:void 0,name:p[_.nameId],path:D!=null&&D.version===b?D.path:hn(e,C)};continue}let B=A?_l(e,C):C,E={headNodeId:C,terminalNodeId:B,visibleDepth:v};n[r++]=lh(e,E);let I=o[B];if(I!=null&&Ue(I)&&Ka(e,B,I))d.push([c.get(B),0,v])}if(r<t)n.length=r;return n}function lh(e,t){let n=Ve(e,t.terminalNodeId),r=Ue(n)?Dbe(e,t):null,o=hn(e,t.terminalNodeId),c=ro(e.snapshot.segmentTable,n.nameId),l=Ue(n)&&vn(e,t.terminalNodeId).childIds.length>0,d=t.headNodeId!==t.terminalNodeId,p=e.instrumentation,A=d?p==null?QA(e,t.headNodeId).map((f)=>{let b=Ve(e,f);return{isTerminal:f===t.terminalNodeId,name:ro(e.snapshot.segmentTable,b.nameId),nodeId:f,path:hn(e,f)}}):qe(p,"store.getVisibleSlice.flatten.collectSegments",()=>QA(e,t.headNodeId).map((f)=>{let b=Ve(e,f);return{isTerminal:f===t.terminalNodeId,name:ro(e.snapshot.segmentTable,b.nameId),nodeId:f,path:hn(e,f)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:A,hasChildren:l,id:t.terminalNodeId,isExpanded:Ue(n)&&Ka(e,t.terminalNodeId,n),isFlattened:d,isLoading:r==="loading",kind:Ue(n)?"directory":"file",loadState:r==null||r==="loaded"?void 0:r,name:c,path:o}}function Dbe(e,t){if(t.headNodeId===t.terminalNodeId)return Wd(e,t.terminalNodeId);let n=QA(e,t.headNodeId),r=!1,o=!1;for(let c of n){let l=Wd(e,c);if(l==="loading")return"loading";if(l==="error"){o=!0;continue}if(l==="unloaded")r=!0}if(o)return"error";if(r)return"unloaded";return"loaded"}var zU=8;function OU(e){let{nodes:t,directories:n,rootId:r,options:o}=e,c=t.length,l=new Int32Array(c),d=new Int32Array(c),p=new Int32Array(c),A=new Int32Array(c),f=new Int32Array(c),b=new Int32Array(c),h=new Int32Array(c);for(let v=0;v<c;v+=1){let B=t[v];if(B==null)continue;l[v]=B.parentId,d[v]=B.nameId,p[v]=B.depthAndFlags,A[v]=B.subtreeNodeCount,f[v]=B.visibleSubtreeCount}let w=0;for(let v of n.values())w+=v.childIds.length;let C=new Int32Array(w),_=0;for(let[v,B]of n){let E=B.childIds;b[v]=_,h[v]=E.length;for(let I=0;I<E.length;I+=1)C[_]=E[I],_+=1}return{nodeCount:c,rootId:r,flattenEmptyDirectories:o.flattenEmptyDirectories===!0,parentId:l,nameId:d,depthAndFlags:p,subtreeNodeCount:A,visibleSubtreeCount:f,childStart:b,childCount:h,childIdsFlat:C}}function HU(e){let{nodeCount:t,rootId:n,flattenEmptyDirectories:r,depthAndFlags:o,subtreeNodeCount:c,visibleSubtreeCount:l,childStart:d,childCount:p,childIdsFlat:A}=e;for(let C=t-1;C>=1;C-=1){if((o[C]&zU)===0)continue;let _=d[C],v=p[C],B=0,E=0;for(let D=0;D<v;D+=1){let F=A[_+D];B+=c[F],E+=l[F]}c[C]=1+B;let I;if(r&&v===1)I=(o[A[_]]&zU)!==0?E:1+E;else I=1+E;l[C]=I}let f=d[n],b=p[n],h=0,w=0;for(let C=0;C<b;C+=1){let _=A[f+C];h+=c[_],w+=l[_]}c[n]=1+h,l[n]=w}function Sbe(e){let{directories:t,nodes:n,options:r,rootId:o,presortedDirectoryNodeIds:c}=e.snapshot,l=r.flattenEmptyDirectories===!0,d=(w)=>{let C=n[w];if(C==null||!Ue(C))return;let _=t.get(w);if(_==null)throw Error(`Unknown directory child index for node ${String(w)}`);let v=_.childIds,B=v.length,E=0,I=0;for(let F=0;F<B;F++){let M=v[F];if(M==null)continue;let P=n[M];E+=P.subtreeNodeCount,I+=P.visibleSubtreeCount}if(_.totalChildSubtreeNodeCount=E,_.totalChildVisibleSubtreeCount=I,B>=128)Yd(n,_);C.subtreeNodeCount=1+E;let D;if(l&&B===1){let F=n[v[0]];D=F!=null&&Ue(F)?I:1+I}else D=1+I;C.visibleSubtreeCount=D};if(c!=null)for(let w=c.length-1;w>=0;w--)d(c[w]);else for(let w=n.length-1;w>=1;w--)d(w);let p=n[o],A=t.get(o);if(p==null||A==null)return;let f=A.childIds,b=0,h=0;for(let w=0;w<f.length;w++){let C=f[w];if(C==null)continue;let _=n[C];b+=_.subtreeNodeCount,h+=_.visibleSubtreeCount}A.totalChildSubtreeNodeCount=b,A.totalChildVisibleSubtreeCount=h,Yd(n,A),p.subtreeNodeCount=1+b,p.visibleSubtreeCount=h}function Fbe(e){let{directories:t,nodes:n,rootId:r}=e.snapshot,o=OU(e.snapshot);HU(o);let{subtreeNodeCount:c,visibleSubtreeCount:l}=o;for(let d=0;d<n.length;d+=1){let p=n[d];if(p==null)continue;p.subtreeNodeCount=c[d],p.visibleSubtreeCount=l[d]}for(let[d,p]of t){let A=p.childIds,f=A.length,b=0,h=0;for(let w=0;w<f;w++){let C=A[w];if(C==null)continue;let _=n[C];b+=_.subtreeNodeCount,h+=_.visibleSubtreeCount}if(p.totalChildSubtreeNodeCount=b,p.totalChildVisibleSubtreeCount=h,d===r||f>=128)Yd(n,p)}}function Lbe(e){return e.initialExpansion==="open"&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var R_=class e{#e;constructor(t={}){let n=ih(t),r=qe(n,"store.builder.create",()=>new S_(t));if(t.preparedInput!=null){let d=$H(t.preparedInput);if(d!=null)r.appendPresortedPaths(d,PH(t.preparedInput));else r.appendPreparedPaths(TH(t.preparedInput),!1)}else{let d=t.paths??[];if(t.presorted===!0)r.appendPaths(d);else r.appendPreparedPaths(qe(n,"store.preparePathEntries",()=>D_(d,t)))}let o=qe(n,"store.builder.finish",()=>r.finish({skipSubtreeCountPass:!0})),c=qe(n,"store.state.detectAllDirectoriesExpanded",()=>(t.initialExpansion??"closed")==="closed"&&r.didMatchAllInitialExpandedPaths());if(this.#e=qe(n,"store.state.create",()=>qH(o,c?"open":t.initialExpansion??"closed",n)),c)this.#e.collapseNewDirectoriesByDefault=!0;let l=c?this.#e.snapshot.directories.size-1:qe(n,"store.state.initializeExpandedPaths",()=>this.initializeExpandedPaths(t.initialExpandedPaths));if(c||Lbe(t)||(t.initialExpansion??"closed")==="closed"&&l===this.#e.snapshot.directories.size-1||(t.initialExpandedPaths?.length??0)>0&&qe(n,"store.state.checkAllDirectoriesExpanded",()=>this.hasAllDirectoriesExpanded()))if(t.useSoaCountSweep===!0)qe(n,"store.state.initializeOpenVisibleCountsViaSoa",()=>Fbe(this.#e));else qe(n,"store.state.initializeOpenVisibleCounts",()=>Sbe(this.#e));else qe(n,"store.state.recomputeCounts",()=>ch(this.#e,this.#e.snapshot.rootId))}static preparePaths(t,n={}){return NH(t,n)}static prepareInput(t,n={}){return MH(t,n)}static preparePresortedInput(t){return jH(t)}list(t){return qe(this.#e.instrumentation,"store.list",()=>F_(this.#e,t))}add(t){qe(this.#e.instrumentation,"store.add",()=>{let n=Wa(this.#e);jo(this.#e,Yr(this.#e,n,rS(this.#e,t)))})}remove(t,n={}){qe(this.#e.instrumentation,"store.remove",()=>{let r=Wa(this.#e);jo(this.#e,Yr(this.#e,r,iS(this.#e,t,n)))})}move(t,n,r={}){qe(this.#e.instrumentation,"store.move",()=>{let o=Wa(this.#e),c=oS(this.#e,t,n,r);if(c!=null)jo(this.#e,Yr(this.#e,o,c))})}batch(t){mU(this.#e,()=>{if(typeof t==="function"){t(this);return}for(let n of t)switch(n.type){case"add":this.add(n.path);break;case"remove":this.remove(n.path,{recursive:n.recursive});break;case"move":this.move(n.from,n.to,{collision:n.collision});break}})}getVisibleCount(){return qe(this.#e.instrumentation,"store.getVisibleCount",()=>Wa(this.#e))}getVisibleSlice(t,n){return qe(this.#e.instrumentation,"store.getVisibleSlice",()=>MU(this.#e,t,n))}getVisibleRowContext(t){return qe(this.#e.instrumentation,"store.getVisibleRowContext",()=>NU(this.#e,t))}getVisibleTreeProjection(){return jU(this.#e)}getVisibleTreeProjectionData(t){return uS(this.#e,t)}getVisibleIndex(t){return qe(this.#e.instrumentation,"store.getVisibleIndex",()=>TU(this.#e,t))}getPathInfo(t){return qe(this.#e.instrumentation,"store.getPathInfo",()=>{let n=Kr(this.#e,t);if(n==null)return null;let r=Ve(this.#e,n);return{depth:Ci(r),kind:Ue(r)?"directory":"file",path:hn(this.#e,n)}})}isExpanded(t){return qe(this.#e.instrumentation,"store.isExpanded",()=>{let n=this.requireDirectoryNodeId(t),r=Ve(this.#e,n);return Ka(this.#e,n,r)})}expand(t){qe(this.#e.instrumentation,"store.expand",()=>{let n=Wa(this.#e),r=$U(this.#e,t);if(r!=null)jo(this.#e,Yr(this.#e,n,r))})}collapse(t){qe(this.#e.instrumentation,"store.collapse",()=>{let n=Wa(this.#e),r=PU(this.#e,t);if(r!=null)jo(this.#e,Yr(this.#e,n,r))})}on(t,n){return tU(this.#e,t,n)}getDirectoryLoadState(t){let n=this.requireDirectoryNodeId(t);return Wd(this.#e,n)}markDirectoryUnloaded(t){qe(this.#e.instrumentation,"store.markDirectoryUnloaded",()=>{let n=this.requireDirectoryNodeId(t);if(vn(this.#e,n).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${t}"`);let r=Wa(this.#e);UH(this.#e,n),jo(this.#e,Yr(this.#e,r,sU({affectedAncestorIds:io(this.#e,n),affectedNodeIds:[n],path:t,projectionChanged:this.isDirectoryProjectionVisible(n)})))})}beginChildLoad(t){return qe(this.#e.instrumentation,"store.beginChildLoad",()=>{let n=this.requireDirectoryNodeId(t),r=Wa(this.#e),o=HH(this.#e,n);return jo(this.#e,Yr(this.#e,r,cU({affectedAncestorIds:io(this.#e,n),affectedNodeIds:[n],attemptId:o.attemptId,path:t,projectionChanged:this.isDirectoryProjectionVisible(n),reused:o.reused}))),o})}applyChildPatch(t,n){return qe(this.#e.instrumentation,"store.applyChildPatch",()=>{let r=this.resolveActiveDirectoryNodeId(t.nodeId);if(r==null||Wd(this.#e,r)!=="loading"||!YH(this.#e,r,t.attemptId))return!1;let o=hn(this.#e,r);this.validateChildPatch(o,n);let c=Wa(this.#e),l=[];for(let p of n.operations){Rbe(o,p);let A=Wa(this.#e);switch(p.type){case"add":l.push(Yr(this.#e,A,rS(this.#e,p.path)));break;case"remove":l.push(Yr(this.#e,A,iS(this.#e,p.path,{recursive:p.recursive})));break;case"move":{let f=oS(this.#e,p.from,p.to,{collision:p.collision});if(f!=null)l.push(Yr(this.#e,A,f));break}}}let d=l.some((p)=>p.projectionChanged)||this.isDirectoryProjectionVisible(r);return jo(this.#e,Yr(this.#e,c,lU({affectedAncestorIds:io(this.#e,r),affectedNodeIds:[r],attemptId:t.attemptId,childEvents:l,path:hn(this.#e,r),projectionChanged:d}))),!0})}completeChildLoad(t){return qe(this.#e.instrumentation,"store.completeChildLoad",()=>{let n=this.resolveActiveDirectoryNodeId(t.nodeId);if(n==null)return!1;let r=Wa(this.#e),o=ZH(this.#e,n,t.attemptId);return jo(this.#e,Yr(this.#e,r,dU({affectedAncestorIds:io(this.#e,n),affectedNodeIds:[n],attemptId:t.attemptId,path:hn(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!o}))),o})}failChildLoad(t,n){return qe(this.#e.instrumentation,"store.failChildLoad",()=>{let r=this.resolveActiveDirectoryNodeId(t.nodeId);if(r==null)return!1;let o=Wa(this.#e),c=KH(this.#e,r,t.attemptId,n);return jo(this.#e,Yr(this.#e,o,uU({affectedAncestorIds:io(this.#e,r),affectedNodeIds:[r],attemptId:t.attemptId,errorMessage:n,path:hn(this.#e,r),projectionChanged:this.isDirectoryProjectionVisible(r),stale:!c}))),c})}cleanup(t={}){return qe(this.#e.instrumentation,"store.cleanup",()=>{if(this.#e.transactionStack.length>0)throw Error("Cleanup cannot run during an open batch or transaction.");if(IU(this.#e))throw Error("Cleanup cannot run while directory loads are active.");let n=Wa(this.#e),r=QU(this.#e,t.mode??"stable");return jo(this.#e,Yr(this.#e,n,pU({...r,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:r.idsPreserved===!1}))),r})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(t){if(t==null||t.length===0)return 0;let n=0,r=[],o=[],c=0,l=null,d=this.#e.snapshot.segmentTable,p=d.valueById,A=this.#e.snapshot.nodes,f=new Map;for(let b of t){if(l!=null&&b<l)l=null,c=0,r.length=0,o.length=0;let h=b.length>0&&b.charCodeAt(b.length-1)===47?b.length-1:b.length;if(h===0){l=b,c=h,r.length=0,o.length=0;continue}let w=0,C=0;if(l!=null){let I=Math.min(h,c),D=!0;for(let F=0;F<I;F+=1){let M=b.charCodeAt(F);if(M!==l.charCodeAt(F)){D=!1;break}if(M===47)w+=1,C=F+1}if(D){if(I===c&&h>I&&b.charCodeAt(I)===47)w+=1,C=I+1;else if(I===h&&c>I&&l.charCodeAt(I)===47)w+=1,C=h+1}w=Math.min(w,o.length)}let _=w===0?this.#e.snapshot.rootId:o[w-1]??this.#e.snapshot.rootId,v=w,B=!0,E=C;while(E<=h){let I=b.indexOf("/",E),D=I===-1||I>h?h:I,F=b.slice(E,D),M=vn(this.#e,_).childIds,P=v===w?r[v]??0:0,q=P,W,Z=f.get(F)??Dp(F);f.set(F,Z);let ye=(ne,re)=>{for(q=ne;q<re;q+=1){let ce=M[q],ae=A[ce],V=p[ae.nameId];if(V===F)return W=ce,!0;let se=oh(sh(d,ae.nameId),Z);if(se>0||se===0&&V>F)return!1}return!1};if(!ye(P,M.length)&&P>0)ye(0,P);if(W===void 0){B=!1;break}if(!Ue(Ve(this.#e,W))){B=!1;break}if(r[v]=q,o[v]=W,_=W,v+=1,D===h)break;E=D+1}if(l=b,c=h,r.length=v,o.length=v,!B){l=null,c=0,r.length=0,o.length=0;continue}for(let I=w;I<v;I+=1){let D=o[I];if(D==null)continue;let F=Ve(this.#e,D);if(Ka(this.#e,D,F))continue;Kd(this.#e,D,!0,F),n+=1}}return n}hasAllDirectoriesExpanded(){for(let t of this.#e.snapshot.directories.keys()){if(t===this.#e.snapshot.rootId)continue;let n=Ve(this.#e,t);if(!Ka(this.#e,t,n))return!1}return!0}requireDirectoryNodeId(t){let n=Kr(this.#e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);if(!Ue(Ve(this.#e,n)))throw Error(`Path is not a directory: "${t}"`);return n}resolveActiveDirectoryNodeId(t){try{if(!Ue(Ve(this.#e,t)))throw Error(`Node is not a directory: ${String(t)}`);return t}catch{return null}}isDirectoryProjectionVisible(t){let n=t;while(n!==this.#e.snapshot.rootId){let r=Ve(this.#e,n).parentId;if(r!==this.#e.snapshot.rootId){let o=Ve(this.#e,r),c=Cl(this.#e,r);if(!Ka(this.#e,r,o)&&c!==n)return!1}n=r}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function Rbe(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 UU=(e)=>e.startsWith("f::")?e.slice(3):e;function Nbe(e){let t=e.lastIndexOf("/");if(t<0)return{parentPath:"",baseName:e};return{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function Mbe(e,t){return e===""?t:`${e}/${t}`}function ZU({files:e,path:t,isFolder:n,nextBasename:r}){let o=UU(t),c=r.trim();if(c.length===0)return{error:"Name cannot be empty."};if(c.includes("/"))return{error:'Name cannot include "/".'};let{parentPath:l,baseName:d}=Nbe(o);if(c===d)return{nextFiles:e,sourcePath:o,destinationPath:o,isFolder:n};let p=Mbe(l,c),A=Array(e.length),f=new Set;if(!n){let C=`${p}/`,_=!1;for(let v=0;v<e.length;v++){let B=e[v];if(B!==o&&B.startsWith(C))return{error:`"${p}" already exists.`};let E=B===o?p:B;if(f.has(E))return{error:`"${p}" already exists.`};if(f.add(E),A[v]=E,B===o)_=!0}if(!_)return{error:"Could not find the selected file to rename."};return{nextFiles:A,sourcePath:o,destinationPath:p,isFolder:n}}let b=`${o}/`,h=`${p}/`,w=0;for(let C=0;C<e.length;C++){let _=e[C],v=_===o||_.startsWith(b);if(!v&&(_===p||_.startsWith(h)))return{error:`"${p}" already exists.`};let B=v?`${p}${_.slice(o.length)}`:_;if(f.has(B))return{error:`"${p}" already exists.`};if(f.add(B),A[C]=B,v)w++}if(w===0)return{error:"Could not find the selected folder to rename."};return{nextFiles:A,sourcePath:o,destinationPath:p,isFolder:n}}function jbe(e){return e.endsWith("/")}function Tbe(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 $be(e){let t=[],n=new Set;for(let o of e){if(n.has(o))continue;n.add(o),t.push(o)}let r=new Set;for(let o of t.toSorted((c,l)=>{if(c.length!==l.length)return c.length-l.length;return c.localeCompare(l)})){let c=(o.endsWith("/")?o.slice(0,-1):o).split("/"),l=!1;for(let d=0;d<c.length-1;d+=1){let p=`${c.slice(0,d+1).join("/")}/`;if(!r.has(p))continue;l=!0;break}if(l)continue;r.add(o)}return t.filter((o)=>r.has(o))}function YU(e,t){return t.includes(e)?$be(t):[e]}function KU(e,t){if(e===t)return!0;if(e==null||t==null)return!1;return e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function pS(e,t){return{draggedPaths:e,target:t}}function mS(e,t){if(t.kind!=="directory"||t.directoryPath==null)return!1;for(let n of e){if(!jbe(n))continue;if(t.directoryPath===n||t.directoryPath.startsWith(n))return!0}return!1}function Pbe(e,t){if(t.kind==="root"||t.directoryPath==null)return Tbe(e);return t.directoryPath}function WU(e,t){let n=e.map((r)=>{let o=Pbe(r,t);if(o===r)return null;return{from:r,to:o,type:"move"}}).filter((r)=>r!=null);if(n.length===0)return null;return{operations:n,result:{draggedPaths:e,operation:n.length===1?"move":"batch",target:t}}}function qbe(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 AS(e,t,n){let{paths:r,preparedInput:o}=e;if(o==null){if(r==null)throw Error("FileTree requires paths or preparedInput");return{paths:r,preparedInput:void 0}}let c=o.paths;if(r==null)return{paths:c,preparedInput:o};if(!qbe(R_.preparePaths(r,n==null?{}:{sort:n}),c))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:c,preparedInput:o}}function gS(e){return e.operation==="add"||e.operation==="remove"||e.operation==="move"||e.operation==="batch"}function Gbe(e,t,n){if(e===t)return n;let r=t.endsWith("/")?t:`${t}/`;if(!e.startsWith(r))return e;return`${n.endsWith("/")?n:`${n}/`}${e.slice(r.length)}`}function zbe(e,t){if(e===t)return!0;let n=t.endsWith("/")?t:`${t}/`;return e.startsWith(n)}function SA(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 zbe(e,t.path)?n?e:null:e;case"move":return Gbe(e,t.from,t.to);case"batch":{let r=e;for(let o of t.events)if(r=SA(r,o,n),r==null)return null;return r}}}function N_(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function JU(e){switch(e.operation){case"add":return{...N_(e),operation:"add",path:e.path};case"remove":return{...N_(e),operation:"remove",path:e.path,recursive:e.recursive};case"move":return{...N_(e),from:e.from,operation:"move",to:e.to}}}function Obe(e){return{...N_(e),events:e.events.filter((t)=>t.operation==="add"||t.operation==="remove"||t.operation==="move").map((t)=>JU(t)),operation:"batch"}}function VU(e){switch(e.operation){case"add":case"remove":case"move":return JU(e);case"batch":return Obe(e);default:return null}}function M_(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function vl(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((r,o)=>`${n.slice(0,o+1).join("/")}/`)}function j_(e){return vl(e).at(-1)??null}function fS(e,t){if(t==null)return e;return e.startsWith(t)?e.slice(t.length):e}function dh(e){return e.endsWith("/")}var bS=(e)=>e.toLowerCase();function XU(e){let t=e.endsWith("/")?e.slice(0,-1):e,n=t.lastIndexOf("/");return n<0?t:t.slice(n+1)}function hS(e){return e.endsWith("/")?e.slice(0,-1):e}function yS(e,t){return t&&!e.endsWith("/")?`${e}/`:e}var eZ=(e)=>{let t=e.trim();if(t.length===0)return"";return(t.includes("\\")?t.replaceAll("\\","/"):t).toLowerCase()};var wS=Symbol("FILE_TREE_RENAME_VIEW"),Hbe=512,Ube=512;function Zbe(e){return e==="top"||e==="center"?e:"nearest"}function Ybe(e,t,n){if(e===0)return-1;if(n!=null){let r=t(n);if(r!=null)return r;let o=vl(n);for(let c=o.length-1;c>=0;c-=1){let l=o[c];if(l==null)continue;let d=t(l);if(d!=null)return d}}return 0}function Kbe(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??((o)=>e.visibleIndexByPath.get(o)??null);return{focusedIndex:Ybe(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var tZ=class e{static{Object.defineProperty(e.prototype,wS,{configurable:!0,value(){return{cancel:()=>{this.#xe()},commit:()=>{this.#Ee()},getPath:()=>this.#l,getValue:()=>this.#f,isActive:()=>this.#l!=null,setValue:(t)=>{this.#Ie(t)}}},writable:!0})}#e;#t=new Set;#c=new Map;#o=null;#r=null;#I=new Map;#P=new Map;#b=-1;#a=null;#h=!1;#Q=(t)=>-1;#y=new Map;#g=null;#p=null;#w=null;#k=null;#m=null;#q;#G;#N;#i=[];#z=new Int32Array(0);#O=new Int32Array(0);#V=void 0;#D=!1;#l=null;#f="";#S=!1;#B=new Set;#H=[];#U;#Z=null;#d=null;#M=null;#L=null;#v=null;#j=null;#X=null;#Be=0;#C=null;#s=new Set;#Y=0;#n;#ne=0;#ae=!1;#A=0;#K;constructor(t){let{dragAndDrop:n,fileTreeSearchMode:r,initialSearchQuery:o,initialSelectedPaths:c,renaming:l,onSearchChange:d,paths:p,preparedInput:A,...f}=t,b=AS({paths:p,preparedInput:A},"constructor",f.sort);if(this.#e=f,n!=null&&n!==!1)this.#o=n===!0?{}:n;if(this.#D=l!=null&&l!==!1,l!=null&&l!==!1&&l!==!0)this.#V=l.canRename,this.#G=l.onError,this.#q=l.onRename;this.#N=d,this.#U=r??"hide-non-matches",this.#n=this.#ie(b.paths,b.preparedInput);let h=c?.map((C)=>this.#R(C)).filter((C)=>C!=null)??[],w=h.at(-1)??null;if(h.length>0)this.#s=new Set(h),this.#C=w,this.#Y=1;if(this.#$(w,!1),o!=null)this.#W(o,!1);this.#K=this.#_e()}destroy(){this.#K?.(),this.#K=null,this.#c.clear(),this.#t.clear(),this.#y.clear(),this.#r=null,this.#se()}focusFirstItem(){if(this.#x().length>0)this.#E(0)}focusLastItem(){if(this.#A<=0)return;this.#F(),this.#E(this.#A-1)}focusNextItem(){this.#Ce(1)}focusParentItem(){if(this.#a==null)return;let t=j_(this.#a);if(t==null)return;let n=this.#T(t);if(n>=0)this.#E(n)}focusPath(t){let n=this.#n.getPathInfo(t)?.path??null;if(n==null)return;this.#F();let r=this.#T(n);if(r>=0)this.#E(r)}scrollToPath(t,n){let r=this.#n.getPathInfo(t)?.path??null;if(r==null)return;this.#F();let o=this.#Te(r);if(o<0)return;if(this.#ce(o)==null)return;if(n?.focus!==!1)this.#E(o,!1);this.#X={id:this.#Be+=1,offset:Zbe(n?.offset),visibleIndex:o},this.#u()}focusMountedPathFromInput(t){let n=this.#n.getPathInfo(t)?.path??null;if(n==null)return;let r=this.#T(n);if(r>=0)this.#E(r)}focusNearestPath(t){let n=this.resolveNearestVisiblePath(t);if(n==null)return null;let r=this.#T(n);if(r>=0)return this.#E(r),this.#x()[r]??n;return null}focusPreviousItem(){this.#Ce(-1)}getFocusedIndex(){return this.#b}getFocusedItem(){return this.#a==null?null:this.#le(this.#a)}getFocusedPath(){return this.#a}getScrollRequest(){return this.#X}clearScrollRequest(t){if(this.#X?.id===t)this.#X=null}resolveNearestVisiblePath(t){let n=this.#x();if(this.#A===0)return null;if(t==null)return this.#a??n[0]??null;let r=this.#n.getPathInfo(t)?.path??t,o=this.#T(r);if(o>=0)return n[o]??r;let c=this.#Qe(r);if(c!=null)return c;return this.#a??n[0]??null}getSelectedPaths(){return[...this.#s]}getSelectionVersion(){return this.#Y}getVisibleCount(){return this.#A}getVisibleRows(t,n){if(n<t||this.#A===0)return[];let r=Math.max(0,t),o=Math.min(this.#A-1,n);if(o<r)return[];let c=o-r+1;if(this.#v==null&&!this.#h&&o>=this.#i.length&&c<=Ube){let l=[];for(let d=r;d<=o;d+=1){let p=this.#n.getVisibleRowContext(d);if(p==null)break;l.push(this.#de(p))}return l}if(!this.#h&&o>=this.#i.length)this.#F();if(this.#v!=null){let l=Array.from({length:o-r+1},(f,b)=>this.#be(r+b)),d=new Map,p=l[0]??-1,A=p;for(let f=1;f<=l.length;f+=1){let b=l[f];if(b!=null&&b===A+1){A=b;continue}if(p>=0)this.#n.getVisibleSlice(p,A).forEach((h,w)=>{d.set(p+w,h)});if(b==null){p=-1,A=-1;continue}p=b,A=b}return Array.from({length:o-r+1},(f,b)=>{let h=r+b,w=this.#be(h),C=d.get(w),_=this.#i[w];if(C==null||_==null)throw Error(`Missing projection row for filtered visible index ${String(h)}`);return this.#re(C,h,w,{ancestorPaths:this.#me(w),path:_})})}return this.#n.getVisibleSlice(r,o).map((l,d)=>{let p=r+d,A=this.#i[p];if(A==null)throw Error(`Missing projection path for visible index ${String(p)}`);return this.#re(l,p,p,{ancestorPaths:this.#me(p),path:A})})}getStickyRowCandidates(t,n){if(this.#v!=null)return null;if(this.#A===0||t<=0||n<=0)return[];let r=[];for(let o=0;o<this.#A;o+=1){let c=t+o*n,l=Math.min(this.#A-1,Math.floor(c/n)),d=this.#ue(l,o)??(l>0?this.#ue(l-1,o):void 0);if(d==null)break;r.push({row:this.#de(d),subtreeEndIndex:d.subtreeEndIndex})}return r}getItem(t){let n=this.#n.getPathInfo(t);return n==null?null:this.#le(n.path,n)}resolveMountedDirectoryPathFromInput(t){let n=this.#n.getPathInfo(t);return n?.kind==="directory"?n.path:null}toggleMountedDirectoryFromInput(t){let n=this.resolveMountedDirectoryPathFromInput(t);if(n==null)return;this.#ve(n)}selectAllVisiblePaths(){this.#F();let t=[...this.#x()];this.#_(t,this.#a??this.#C)}selectOnlyPath(t){let n=this.#R(t);if(n==null)return;this.#_([n],n)}selectOnlyMountedPathFromInput(t){this.#_([t],t)}selectPath(t){let n=this.#R(t);if(n==null||this.#s.has(n))return;this.#_([...this.#s,n])}deselectPath(t){let n=this.#R(t);if(n==null||!this.#s.has(n))return;this.#_([...this.#s].filter((r)=>r!==n))}toggleFocusedSelection(){if(this.#a==null)return;this.togglePathSelectionFromInput(this.#a)}togglePathSelection(t){let n=this.#R(t);if(n==null)return;if(this.#s.has(n)){this.deselectPath(n);return}this.selectPath(n)}togglePathSelectionFromInput(t){let n=this.#R(t);if(n==null)return;if(this.#s.has(n)){this.#_([...this.#s].filter((r)=>r!==n),n);return}this.#_([...this.#s,n],n)}selectPathRange(t,n){let r=this.#R(t);if(r==null)return;this.#F();let o=this.#C,c=o==null?-1:this.#te(o),l=this.#te(r);if(c===-1||l===-1){let b=n?[...this.#s,r]:[r];this.#_(b,r);return}let[d,p]=c<=l?[c,l]:[l,c],A=this.#x().slice(d,p+1),f=n?[...this.#s,...A]:A;this.#_(f,o)}extendSelectionFromFocused(t){if(this.#a==null)return;let n=this.#b;if(n===-1)return;let r=Math.min(this.#A-1,Math.max(0,n+t));if(r===n)return;if(!this.#h&&r>=this.#i.length)this.#F();let o=this.#x(),c=o[n]??null,l=o[r]??null;if(c==null||l==null)return;let d=new Set(this.#s);if(d.has(c)&&d.has(l))d.delete(c);else d.add(l);this.#_([...d],this.#C??c,!1),this.#E(r)}getDragAndDropConfig(){return this.#o}isDragAndDropEnabled(){return this.#o!=null}getDragSession(){if(this.#r==null)return null;return{draggedPaths:[...this.#r.draggedPaths],primaryPath:this.#r.primaryPath,target:this.#r.target==null?null:{...this.#r.target}}}startDrag(t){if(this.#o==null)return!1;let n=this.#R(t);if(n==null)return!1;if(this.#d!=null&&this.#d.length>0)return!1;let r=this.getSelectedPaths(),o=YU(n,r);if(this.#o.canDrag?.(o)===!1)return!1;if(!r.includes(n))this.#_([n],n,!1);return this.#J(n),this.#r={draggedPaths:o,primaryPath:n,target:null},this.#u(),!0}setDragTarget(t){let n=this.#r;if(n==null)return;let r=t;if(r!=null){let o=pS(n.draggedPaths,r);if(mS(n.draggedPaths,r)||this.#o?.canDrop?.(o)===!1)r=null}if(KU(n.target,r))return;this.#r={...n,target:r},this.#u()}cancelDrag(){if(this.#r==null)return;this.#r=null,this.#u()}completeDrag(){let t=this.#r;if(t==null)return!1;this.#r=null;let n=t.target==null?null:{...t.target};if(n==null)return this.#u(),!1;let r=pS(t.draggedPaths,n);if(mS(t.draggedPaths,n)||this.#o?.canDrop?.(r)===!1)return this.#u(),!1;let o=WU(t.draggedPaths,n);if(o==null)return this.#u(),!1;try{if(o.operations.length===1){let c=o.operations[0];if(c==null||c.type!=="move")throw Error("Expected a single move operation for one-item drops");this.#n.move(c.from,c.to,{collision:c.collision})}else this.#Fe(o.operations),this.#n.batch(o.operations)}catch(c){return this.#u(),this.#o?.onDropError?.(c instanceof Error?c.message:String(c),r),!1}return this.#o?.onDropComplete?.(o.result),!0}subscribe(t){return this.#t.add(t),t(),()=>{this.#t.delete(t)}}add(t){this.#n.add(t)}remove(t,n={}){this.#n.remove(t,n)}move(t,n,r={}){this.#n.move(t,n,r)}batch(t){this.#n.batch(t)}onMutation(t,n){let r=t,o=n,c=this.#c.get(r);if(c==null)c=new Set,this.#c.set(r,c);return c.add(o),()=>{let l=this.#c.get(r);if(l?.delete(o),l?.size===0)this.#c.delete(r)}}setSearch(t){this.#W(t,!0)}openSearch(t=""){this.#W(t,!0)}closeSearch(){this.#W(null,!0)}isSearchOpen(){return this.#d!==null}getSearchValue(){return this.#d??""}getSearchMatchingPaths(){return this.#H}focusNextSearchMatch(){this.#he(1)}focusPreviousSearchMatch(){this.#he(-1)}startRenaming(t=this.#a??"",n={}){if(!this.#D)return!1;let r=this.#n.getPathInfo(t);if(r==null)return!1;let o=r.path,c=dh(o),l=hS(o);if(this.#V?.({isFolder:c,path:l})===!1)return!1;for(let d of vl(o))if(!this.#n.isExpanded(d))this.#n.expand(d);if(this.#_([o],o,!1),this.#d!=null)this.#W(null,!1),this.#N?.(this.#d);return this.#J(o),this.#l=o,this.#f=XU(o),this.#S=n.removeIfCanceled??!1,this.#u(),!0}#xe(){if(this.#l==null)return;let t=this.#l,n=this.#S;if(this.#l=null,this.#f="",this.#S=!1,n){this.remove(t,dh(t)?{recursive:!0}:void 0);return}this.#J(t),this.#u()}#Ee(){let t=this.#l;if(t==null)return;if(this.#S&&this.#f.trim().length===0){this.#l=null,this.#f="",this.#S=!1,this.remove(t,dh(t)?{recursive:!0}:void 0);return}let n=dh(t),r=ZU({files:this.#n.list(),isFolder:n,nextBasename:this.#f,path:hS(t)});if(this.#l=null,this.#f="",this.#S=!1,"error"in r){this.#J(t),this.#G?.(r.error),this.#u();return}if(r.sourcePath===r.destinationPath){this.#J(t),this.#u();return}this.#q?.({destinationPath:r.destinationPath,isFolder:r.isFolder,sourcePath:r.sourcePath}),this.move(yS(r.sourcePath,n),yS(r.destinationPath,n))}#Ie(t){if(this.#l==null||this.#f===t)return;this.#f=t,this.#u()}resetPaths(t,n={}){let r=!Array.isArray(t),o=r?void 0:t,c=r?t:n,l=this.#n.list().length,d=this.#A,p=AS({paths:o,preparedInput:c.preparedInput},"resetPaths",this.#e.sort),A=this.#ie(p.paths,p.preparedInput,c.initialExpandedPaths),f=this.#a,b=this.#l,h=this.getSelectedPaths(),w=this.#C;this.#K?.(),this.#n=A,this.#y.clear(),this.#se();let C=h.map((v)=>A.getPathInfo(v)?.path??null).filter((v)=>v!=null),_=!M_(this.#s,C);if(this.#s=new Set(C),_)this.#Y+=1;if(this.#C=w==null?null:A.getPathInfo(w)?.path??null,this.#l=b==null?null:A.getPathInfo(b)?.path??null,this.#l==null)this.#f="",this.#S=!1;this.#$(f,f!=null||C.length>0||this.#C!=null),this.#K=this.#_e(),this.#u(),this.#we({canonicalChanged:!0,operation:"reset",pathCountAfter:p.paths.length,pathCountBefore:l,projectionChanged:!0,usedPreparedInput:c.preparedInput!=null,visibleCountDelta:this.#A-d})}#Qe(t){this.#F();let n=j_(t),r=fS(t,n),o=null,c=null;for(let l of this.#x()){if(j_(l)!==n)continue;let d=fS(l,n);if(d<r){o=l;continue}if(d>r){c=l;break}}return o??c}#T(t){let n=this.#te(t);if(n!==-1)return n;let r=vl(t);for(let o=r.length-1;o>=0;o-=1){let c=r[o];if(c==null)continue;let l=this.#te(c);if(l!==-1)return l}return this.#x().length>0?0:-1}#le(t,n){let r=this.#y.get(t);if(r!=null)return r;let o=n??this.#n.getPathInfo(t);if(o==null)return null;let c=o.kind==="directory"?this.#De(o.path):this.#Se(o.path);return this.#y.set(o.path,c),c}#re(t,n,r,o){return{ancestorPaths:o.ancestorPaths,depth:t.depth,flattenedSegments:t.flattenedSegments?.map((c)=>({isTerminal:c.isTerminal,name:c.name,path:c.path})),hasChildren:t.hasChildren,index:n,isExpanded:t.isExpanded,isFlattened:t.isFlattened,isFocused:o.path===this.#a,isSelected:this.#s.has(o.path),kind:t.kind,level:t.depth,name:t.name,path:o.path,posInSet:o.posInSet??this.#z[r]??0,setSize:o.setSize??this.#O[r]??0}}#de(t){return this.#re(t.row,t.index,t.index,{ancestorPaths:t.ancestorPaths,path:t.row.path,posInSet:t.posInSet,setSize:t.setSize})}#ue(t,n){let r=this.#n.getVisibleRowContext(t);if(r==null)return;let o=r.ancestorRows[n];if(o!=null)return o;return n===r.ancestorRows.length&&r.row.kind==="directory"&&r.row.isExpanded?r:void 0}#pe(t){let n=this.#I.get(t);if(n!=null)return n;let r=this.#Q(t),o=r<0?[]:[...this.#pe(r),r];return this.#I.set(t,o),o}#me(t){let n=this.#P.get(t);if(n!=null)return n;let r=this.#pe(t).map((o)=>this.#i[o]??"").filter((o)=>o!=="");return this.#P.set(t,r),r}#Ae(t){this.#n.collapse(t)}#_(t,n=this.#C,r=!0){let o=[...new Set(t)],c=!M_(this.#s,o),l=this.#C!==n;if(!c&&!l)return;if(this.#s=new Set(o),this.#C=n,c)this.#Y+=1;if(r)this.#u()}#De(t){return{collapse:()=>{this.#Ae(t)},deselect:()=>{this.deselectPath(t)},expand:()=>{this.#ke(t)},focus:()=>{this.focusPath(t)},getPath:()=>t,isDirectory:()=>!0,isExpanded:()=>this.#n.isExpanded(t),isFocused:()=>this.#a===t,isSelected:()=>this.#s.has(t),select:()=>{this.selectPath(t)},toggleSelect:()=>{this.togglePathSelection(t)},toggle:()=>{this.#ve(t)}}}#Se(t){return{deselect:()=>{this.deselectPath(t)},focus:()=>{this.focusPath(t)},getPath:()=>t,isDirectory:()=>!1,isFocused:()=>this.#a===t,isSelected:()=>this.#s.has(t),select:()=>{this.selectPath(t)},toggleSelect:()=>{this.togglePathSelection(t)}}}#Fe(t){let n=this.#n.list();this.#ie(n).batch(t)}#ie(t,n,r){return new R_({...this.#e,paths:t,preparedInput:n==null?void 0:n,...r!==void 0?{initialExpandedPaths:r}:{}})}#oe(){if(this.#k!=null)return this.#k;return this.#k=this.#n.list(),this.#k}#Le(){if(this.#w!=null)return this.#w;let t=new Set;for(let n of this.#oe()){t.add(n);for(let r of vl(n))t.add(r)}return this.#w=[...t].sort(),this.#w}#Re(){if(this.#m!=null)return this.#m;return this.#m=this.#oe().map(bS),this.#m}#ee(){if(this.#g!=null)return this.#g;return this.#g=this.#Le().filter((t)=>t.endsWith("/")),this.#g}#Ne(){if(this.#p!=null)return this.#p;return this.#p=this.#ee().map(bS),this.#p}#se(){this.#g=null,this.#p=null,this.#w=null,this.#k=null,this.#m=null}#Me(){return this.#ee().filter((t)=>this.#n.isExpanded(t))}#ge(t){let n=new Set(this.#Z??[]);if(t)for(let r of this.#s)for(let o of vl(r))n.add(o);this.#fe(n)}#fe(t){this.#ae=!0;try{for(let n of this.#ee()){let r=t.has(n),o=this.#n.isExpanded(n);if(r&&!o)this.#n.expand(n);else if(!r&&o)this.#n.collapse(n)}}finally{this.#ae=!1}}#je(){if(this.#d==null||this.#d.length===0){this.#H=[],this.#v=null,this.#j=null,this.#L=null,this.#A=this.#ne;return}let t=this.#i;if(this.#H=t.filter((c)=>this.#B.has(c)),this.#U!=="hide-non-matches"||this.#B.size===0){this.#v=null,this.#j=null,this.#L=null,this.#A=this.#ne;return}let n=[],r=[],o=new Map;for(let[c,l]of t.entries()){if(this.#M?.has(l)!==!0)continue;o.set(l,r.length),n.push(c),r.push(l)}this.#v=n,this.#j=r,this.#L=o,this.#A=r.length}#x(){return this.#j??this.#i}#Te(t){if(this.#j!=null)return this.#L?.get(t)??-1;return this.#n.getVisibleIndex(t)??-1}#be(t){return this.#v?.[t]??t}#te(t){let n=this.#L?.get(t);if(n!=null)return n;return this.#n.getVisibleIndex(t)??-1}#he(t){let n=this.#H;if(n.length===0)return;let r=this.#a,o=r==null?-1:n.indexOf(r),c=n[o<0?t>0?0:n.length-1:Math.min(n.length-1,Math.max(0,o+t))];if(c!=null)this.focusPath(c)}#W(t,n){let r=t==null?null:eZ(t),o=this.#d;if(o===r)return;if(o==null&&r!=null)this.#Z=this.#Me();if(this.#d=r,r==null)this.#ge(!0),this.#Z=null,this.#B.clear(),this.#M=null,this.#$(this.#a,!0);else if(r.length===0)this.#ge(!1),this.#B.clear(),this.#M=null,this.#$(this.#a,!0);else{let c=this.#ye();this.#$(c,!0)}if(n)this.#N?.(this.#d),this.#u()}#ye(){if(this.#d==null||this.#d.length===0)return this.#B.clear(),this.#a;let t=this.#d,n=this.#oe(),r=this.#Re(),o=[],c=new Set,l=null;for(let b=0;b<n.length;b+=1){if(!r[b].includes(t))continue;let h=n[b];o.push(h),c.add(h),l??=h}let d=this.#ee(),p=this.#Ne();for(let b=0;b<d.length;b+=1){if(!p[b].includes(t))continue;let h=d[b];if(c.has(h))continue;o.push(h),c.add(h),l??=h}this.#B=c;let A=this.#U==="hide-non-matches"&&o.length>0?new Set:null;this.#M=A;let f=this.#U==="expand-matches"?new Set(this.#Z??[]):new Set;for(let b of o){if(A!=null)A.add(b);if(b.endsWith("/"))f.add(b);for(let h of vl(b))if(f.add(h),A!=null)A.add(h)}return this.#fe(f),l??this.#a}#u(){for(let t of this.#t)t()}#we(t){this.#c.get(t.operation)?.forEach((n)=>{n(t)}),this.#c.get("*")?.forEach((n)=>{n(t)})}#ke(t){for(let n of vl(t)){if(this.#n.isExpanded(n))continue;this.#n.expand(n)}if(!this.#n.isExpanded(t))this.#n.expand(t)}#Ce(t){let n=this.#A;if(n===0)return;let r=this.#b===-1?0:this.#b,o=Math.min(n-1,Math.max(0,r+t));if(o!==r||this.#b===-1){if(!this.#h&&this.#v==null&&o>=this.#i.length)this.#F();this.#E(o)}}#$(t,n=!0){let r=this.#n.getVisibleCount();this.#ne=r;let o=Kbe(this.#n.getVisibleTreeProjectionData(n?void 0:Math.min(r,Hbe)),t,n?(c)=>this.#n.getVisibleIndex(c):void 0);this.#I.clear(),this.#P.clear(),this.#h=o.paths.length>=r,this.#Q=o.getParentIndex,this.#i=o.paths,this.#z=o.posInSetByIndex,this.#O=o.setSizeByIndex,this.#je(),this.#b=t==null?this.#x().length>0?0:-1:this.#T(t),this.#a=this.#b<0?null:this.#ce(this.#b)}#ce(t){let n=this.#x()[t];if(n!=null)return n;if(this.#v!=null)return null;return this.#n.getVisibleRowContext(t)?.row.path??null}#R(t){return this.#n.getPathInfo(t)?.path??null}#J(t){if(t==null)return;let n=this.#T(t);if(n>=0)this.#E(n,!1)}#E(t,n=!0){let r=this.#ce(t);if(r==null)return;if(this.#b===t&&this.#a===r)return;if(this.#b=t,this.#a=r,n)this.#u()}#F(){if(this.#h)return;this.#$(this.#a,!0)}#$e(t){let n=SA(this.#l,t);if(n==null&&this.#l!=null)this.#f="";this.#l=n;let r=SA(this.#a,t,!0),o=[...this.#s].map((p)=>SA(p,t)).filter((p)=>p!=null).map((p)=>this.#n.getPathInfo(p)?.path??null).filter((p)=>p!=null),c=SA(this.#C,t),l=c==null?null:this.#n.getPathInfo(c)?.path??null,d=[...new Set(o)];if(!M_(this.#s,d))this.#s=new Set(d),this.#Y+=1;return this.#C=l,r}#_e(){return this.#n.on("*",(t)=>{if(this.#ae)return;if(t.canonicalChanged)this.#y.clear(),this.#se();if(this.#r!=null&&gS(t))this.#r=null;let n=gS(t)?this.#$e(t):this.#a,r=this.#d!=null&&this.#d.length>0?this.#ye():this.#d===""?this.#a:n,o=this.#d!=null||t.operation!=="expand"&&t.operation!=="collapse";this.#$(r,o),this.#u();let c=VU(t);if(c!=null)this.#we(c)})}#ve(t){if(this.#n.isExpanded(t)){this.#Ae(t);return}this.#ke(t)}};var nZ=(e)=>{if(e==null||e.length===0)return"0";let t=`${e.length}`;for(let n of e)t+=`\x00${n.path}\x00${n.status}`;return t};function aZ(e){let t=e.endsWith("/"),n="",r=-1;for(let o=0;o<=e.length;o+=1){if(!(e[o]==="/"||o===e.length)){if(r===-1)r=o;continue}if(r===-1)continue;if(n!=="")n+="/";n+=e.slice(r,o),r=-1}if(n==="")return null;return{isDirectory:t,path:n}}function rZ(e){let t=e.endsWith("/")?e.slice(0,-1):e;if(t.length===0)return[];let n=[],r=0;for(;;){let o=t.indexOf("/",r);if(o===-1)break;n.push(t.slice(0,o+1)),r=o+1}return n}function Wbe(e,t){return t?`${e}/`:e}function kS(e,t=null){let n=nZ(e==null?void 0:[...e]);if(n==="0")return null;if(t?.signature===n)return t;let r=new Map,o=new Set,c=new Set,l=new Map;for(let d of e??[]){let p=oZ(d);if(p==null)continue;cZ({canonicalPath:p.canonicalPath,changeCountByDirectoryPath:l,directoriesWithChanges:o,ignoredDirectoryPaths:c,isDirectory:p.isDirectory,status:d.status,statusByPath:r})}if(r.size===0)return null;return{changeCountByDirectoryPath:l,directoriesWithChanges:o,ignoredDirectoryPaths:c,signature:n,statusByPath:r}}function iZ(e,t){let n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;let o=new Map(e?.statusByPath),c=new Set(e?.directoriesWithChanges),l=new Set(e?.ignoredDirectoryPaths),d=new Map(e?.changeCountByDirectoryPath),p=!1;for(let A of n){let f=sZ(A);if(f==null)continue;p=Jbe({canonicalPath:f.canonicalPath,changeCountByDirectoryPath:d,directoriesWithChanges:c,ignoredDirectoryPaths:l,statusByPath:o})||p}for(let A of r){let f=oZ(A);if(f==null)continue;p=cZ({canonicalPath:f.canonicalPath,changeCountByDirectoryPath:d,directoriesWithChanges:c,ignoredDirectoryPaths:l,isDirectory:f.isDirectory,status:A.status,statusByPath:o})||p}if(!p)return e;if(o.size===0)return null;return{changeCountByDirectoryPath:d,directoriesWithChanges:c,ignoredDirectoryPaths:l,signature:ehe(o),statusByPath:o}}function oZ(e){return sZ(e.path)}function sZ(e){let t=aZ(e);if(t==null)return;return{canonicalPath:Wbe(t.path,t.isDirectory),isDirectory:t.isDirectory}}function Jbe({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:o}){let c=o.get(e);if(c==null)return!1;if(o.delete(e),c==="ignored"&&e.endsWith("/"))r.delete(e);return Xbe(t,n,e),!0}function cZ({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:o,status:c,statusByPath:l}){let d=l.get(e);if(d===c)return!1;if(d==null)Vbe(t,n,e);if(l.set(e,c),c==="ignored"&&o)r.add(e);else if(o)r.delete(e);return!0}function Vbe(e,t,n){for(let r of rZ(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function Xbe(e,t,n){for(let r of rZ(n)){let o=(e.get(r)??0)-1;if(o>0)e.set(r,o);else e.delete(r),t.delete(r)}}function ehe(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\x00${n}\x00${r}`;return t}var the=(e)=>e.trim().toLowerCase(),nhe=(e)=>e.split("/").at(-1)??e,ahe=(e)=>{let t=e.toLowerCase().split("."),n=[];for(let r=1;r<t.length;r+=1)n.push(t.slice(r).join("."));return n};function uh(e,t){if(typeof e==="string")return{name:e,remappedFrom:t};return{...e,remappedFrom:t}}function lZ(e){let t=vA(e),n=t.remap,r=new Map;for(let[d,p]of Object.entries(t.byFileName??{}))r.set(d.toLowerCase(),p);let o=new Map;for(let[d,p]of Object.entries(t.byFileExtension??{}))o.set(the(d),p);let c=Object.entries(t.byFileNameContains??{}).map(([d,p])=>[d.toLowerCase(),p]);return{resolveIcon:(d,p)=>{if(d==="file-tree-icon-file"&&p!=null){let f=nhe(p),b=f.toLowerCase(),h=r.get(b);if(h!=null)return uh(h,d);for(let[_,v]of c)if(b.includes(_))return uh(v,d);let w=ahe(f);for(let _ of w){let v=o.get(_);if(v!=null)return uh(v,d)}let C=fH(t.set,f,w);if(C!=null&&t.set!=="none"){if(C==="default"){let _=n?.[d];if(_!=null)return uh(_,d)}return{name:AH(C),remappedFrom:d,token:C}}}let A=n?.[d];if(A==null)return{name:d};return uh(A,d)}}}var dn,AZ,rhe,Fp,dZ,q_,gZ,fZ,BS,CS,_S,ihe,ph={},bZ=[],G_=Array.isArray,xS=bZ.slice,Xd=Object.assign;function ES(e){e&&e.parentNode&&e.remove()}function LA(e,t,n){var r,o,c,l={};for(c in t)c=="key"?r=t[c]:c=="ref"&&typeof e!="function"?o=t[c]:l[c]=t[c];return arguments.length>2&&(l.children=arguments.length>3?xS.call(arguments,2):n),$_(e,l,r,o,null)}function $_(e,t,n,r,o){var c={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o==null?++AZ:o,__i:-1,__u:0};return o==null&&dn.vnode!=null&&dn.vnode(c),c}function bc(e){return e.children}function P_(e,t){this.props=e,this.context=t,this.__g=0}function FA(e,t){if(t==null)return e.__?FA(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"?FA(e):null}function hZ(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 hZ(e)}}function uZ(e){(8&e.__g||!(e.__g|=8)||!Fp.push(e)||q_++)&&dZ==dn.debounceRendering||((dZ=dn.debounceRendering)||queueMicrotask)(ohe)}function ohe(){for(var e,t,n,r,o,c,l,d,p=1;Fp.length;)Fp.length>p&&Fp.sort(gZ),e=Fp.shift(),p=Fp.length,8&e.__g&&(n=void 0,o=(r=(t=e).__v).__e,c=[],l=[],(d=t.__P)&&((n=Xd({},r)).__v=r.__v+1,dn.vnode&&dn.vnode(n),IS(d,n,r,t.__n,d.namespaceURI,32&r.__u?[o]:null,c,o==null?FA(r):o,!!(32&r.__u),l,d.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,kZ(c,n,l),n.__e!=o&&hZ(n)));q_=0}function yZ(e,t,n,r,o,c,l,d,p,A,f,b){var h,w,C,_,v,B,E,I=r&&r.__k||bZ,D=t.length;for(p=she(n,t,I,p,D),h=0;h<D;h++)(C=n.__k[h])!=null&&(w=C.__i==-1?ph:I[C.__i]||ph,C.__i=h,B=IS(e,C,w,o,c,l,d,p,A,f,b),_=C.__e,C.ref&&w.ref!=C.ref&&(w.ref&&QS(w.ref,null,C),f.push(C.ref,C.__c||_,C)),v==null&&_!=null&&(v=_),(E=!!(4&C.__u))||w.__k===C.__k?p=wZ(C,p,e,E):typeof C.type=="function"&&B!==void 0?p=B:_&&(p=_.nextSibling),C.__u&=-7);return n.__e=v,p}function she(e,t,n,r,o){var c,l,d,p,A,f=n.length,b=f,h=0;for(e.__k=Array(o),c=0;c<o;c++)(l=t[c])!=null&&typeof l!="boolean"&&typeof l!="function"?(p=c+h,(l=e.__k[c]=typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?$_(null,l,null,null,null):G_(l)?$_(bc,{children:l},null,null,null):l.constructor==null&&l.__b>0?$_(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):l).__=e,l.__b=e.__b+1,d=null,(A=l.__i=che(l,n,p,b))!=-1&&(b--,(d=n[A])&&(d.__u|=2)),d==null||d.__v==null?(A==-1&&(o>f?h--:o<f&&h++),typeof l.type!="function"&&(l.__u|=4)):A!=p&&(A==p-1?h--:A==p+1?h++:(A>p?h--:h++,l.__u|=4))):e.__k[c]=null;if(b)for(c=0;c<f;c++)(d=n[c])!=null&&(2&d.__u)==0&&(d.__e==r&&(r=FA(d)),_Z(d,d));return r}function wZ(e,t,n,r){var o,c;if(typeof e.type=="function"){for(o=e.__k,c=0;o&&c<o.length;c++)o[c]&&(o[c].__=e,t=wZ(o[c],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=FA(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function che(e,t,n,r){var o,c,l,d=e.key,p=e.type,A=t[n],f=A!=null&&(2&A.__u)==0;if(A===null&&e.key==null||f&&d==A.key&&p==A.type)return n;if(r>(f?1:0)){for(o=n-1,c=n+1;o>=0||c<t.length;)if((A=t[l=o>=0?o--:c++])!=null&&(2&A.__u)==0&&d==A.key&&p==A.type)return l}return-1}function pZ(e,t,n){t[0]=="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":n}function T_(e,t,n,r,o){var c;e: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||pZ(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||pZ(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")c=t!=(t=t.replace(fZ,"$1")),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||(e.__l={}),e.__l[t+c]=n,n?r?n.l=r.l:(n.l=BS,e.addEventListener(t,c?_S:CS,c)):e.removeEventListener(t,c?_S:CS,c);else{if(o=="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==null?"":n;break e}catch(l){}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function mZ(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=BS++;else if(t.u<n.l)return;return n(dn.event?dn.event(t):t)}}}function IS(e,t,n,r,o,c,l,d,p,A,f){var b,h,w,C,_,v,B,E,I,D,F,M,P,q,W,Z,ye,ne,re,ce,ae,V=t.type;if(t.constructor!=null)return null;128&n.__u&&(p=!!(32&n.__u),n.__c.__z&&(d=t.__e=n.__e=(c=n.__c.__z)[0],n.__c.__z=null)),(b=dn.__b)&&b(t);e:if(typeof V=="function")try{if(E=t.props,I="prototype"in V&&V.prototype.render,D=(b=V.contextType)&&r[b.__c],F=b?D?D.props.value:b.__:r,n.__c?2&(h=t.__c=n.__c).__g&&(h.__g|=1,B=!0):(I?t.__c=h=new V(E,F):(t.__c=h=new P_(E,F),h.constructor=V,h.render=dhe),D&&D.sub(h),h.props=E,h.state||(h.state={}),h.context=F,h.__n=r,w=!0,h.__g|=8,h.__h=[],h._sb=[]),I&&h.__s==null&&(h.__s=h.state),I&&V.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=Xd({},h.__s)),Xd(h.__s,V.getDerivedStateFromProps(E,h.__s))),C=h.props,_=h.state,h.__v=t,w)I&&V.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),I&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(I&&V.getDerivedStateFromProps==null&&E!==C&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(E,F),!(4&h.__g)&&h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(E,h.__s,F)===!1||t.__v==n.__v){for(t.__v!=n.__v&&(h.props=E,h.state=h.__s,h.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(se){se&&(se.__=t)}),M=0;M<h._sb.length;M++)h.__h.push(h._sb[M]);h._sb=[],h.__h.length&&l.push(h);break e}h.componentWillUpdate!=null&&h.componentWillUpdate(E,h.__s,F),I&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(C,_,v)})}if(h.context=F,h.props=E,h.__P=e,h.__g&=-5,P=dn.__r,q=0,I){for(h.state=h.__s,h.__g&=-9,P&&P(t),b=h.render(h.props,h.state,h.context),W=0;W<h._sb.length;W++)h.__h.push(h._sb[W]);h._sb=[]}else do h.__g&=-9,P&&P(t),b=h.render(h.props,h.state,h.context),h.state=h.__s;while(8&h.__g&&++q<25);h.state=h.__s,h.getChildContext!=null&&(r=Xd({},r,h.getChildContext())),I&&!w&&h.getSnapshotBeforeUpdate!=null&&(v=h.getSnapshotBeforeUpdate(C,_)),Z=b,b!=null&&b.type===bc&&b.key==null&&(Z=CZ(b.props.children)),d=yZ(e,G_(Z)?Z:[Z],t,n,r,o,c,l,d,p,A,f),t.__u&=-161,h.__h.length&&l.push(h),B&&(h.__g&=-4)}catch(se){if(t.__v=null,p||c!=null)if(se.then){for(ye=0,ne=!1,t.__u|=p?160:128,t.__c.__z=[],re=0;re<c.length;re++)(ce=c[re])==null||ne||(ce.nodeType==8&&ce.data=="$s"?(ye>0&&t.__c.__z.push(ce),ye++,c[re]=null):ce.nodeType==8&&ce.data=="/$s"?(--ye>0&&t.__c.__z.push(ce),ne=ye===0,d=c[re],c[re]=null):ye>0&&(t.__c.__z.push(ce),c[re]=null));if(!ne){for(;d&&d.nodeType==8&&d.nextSibling;)d=d.nextSibling;c[c.indexOf(d)]=null,t.__c.__z=[d]}t.__e=d}else{for(ae=c.length;ae--;)ES(c[ae]);vS(t)}else t.__e=n.__e,t.__k=n.__k,se.then||vS(t);dn.__e(se,t,n)}else d=t.__e=lhe(n.__e,t,n,r,o,c,l,p,A,f);return(b=dn.diffed)&&b(t),128&t.__u?void 0:d}function vS(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(vS)}function kZ(e,t,n){for(var r=0;r<n.length;r++)QS(n[r],n[++r],n[++r]);dn.__c&&dn.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(c){c.call(o)})}catch(c){dn.__e(c,o.__v)}})}function CZ(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:G_(e)?e.map(CZ):Xd({},e)}function lhe(e,t,n,r,o,c,l,d,p,A){var f,b,h,w,C,_,v,B,E=n.props,I=t.props,D=t.type;if(D=="svg"?o="http://www.w3.org/2000/svg":D=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),c!=null){for(f=0;f<c.length;f++)if((C=c[f])&&"setAttribute"in C==!!D&&(D?C.localName==D:C.nodeType==3)){e=C,c[f]=null;break}}if(e==null){if(D==null)return A.createTextNode(I);e=A.createElementNS(o,D,I.is&&I),d&&(dn.__m&&dn.__m(t,c),d=!1),c=null}if(D==null)E===I||d&&e.data==I||(e.data=I);else{if(c=c&&xS.call(e.childNodes),E=n.props||ph,!d&&c!=null)for(E={},f=0;f<e.attributes.length;f++)E[(C=e.attributes[f]).name]=C.value;for(f in E)if(C=E[f],f=="children");else if(f=="dangerouslySetInnerHTML")h=C;else if(!(f in I)){if(f=="value"&&"defaultValue"in I||f=="checked"&&"defaultChecked"in I)continue;T_(e,f,null,C,o)}for(f in B=1&n.__u,I)C=I[f],f=="children"?w=C:f=="dangerouslySetInnerHTML"?b=C:f=="value"?_=C:f=="checked"?v=C:d&&typeof C!="function"||E[f]===C&&!B||T_(e,f,C,E[f],o);if(b)d||h&&(b.__html==h.__html||b.__html==e.innerHTML)||(e.innerHTML=b.__html),t.__k=[];else if(h&&(e.innerHTML=""),yZ(D=="template"?e.content:e,G_(w)?w:[w],t,n,r,D=="foreignObject"?"http://www.w3.org/1999/xhtml":o,c,l,c?c[0]:n.__k&&FA(n,0),d,p,A),c!=null)for(f=c.length;f--;)ES(c[f]);d||(f="value",D=="progress"&&_==null?e.removeAttribute("value"):_==null||_===e[f]&&(D!=="progress"||_)||T_(e,f,_,E[f],o),f="checked",v!=null&&v!=e[f]&&T_(e,f,v,E[f],o))}return e}function QS(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(o){dn.__e(o,n)}}function _Z(e,t,n){var r,o;if(dn.unmount&&dn.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||QS(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(c){dn.__e(c,t)}r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&_Z(r[o],t,n||typeof e.type!="function");n||ES(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function dhe(e,t,n){return this.constructor(e,n)}function z_(e,t){var n,r,o,c;t==document&&(t=document.documentElement),dn.__&&dn.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=LA(bc,null,[e]),o=[],c=[],IS(t,e,r||ph,ph,t.namespaceURI,r?null:t.firstChild?xS.call(t.childNodes):null,o,r?r.__e:t.firstChild,n,c,t.ownerDocument),kZ(o,e,c)}function vZ(e,t){e.__u|=32,z_(e,t)}dn={__e:function(e,t,n,r){for(var o,c,l;t=t.__;)if((o=t.__c)&&!(1&o.__g)){o.__g|=4;try{if((c=o.constructor)&&c.getDerivedStateFromError!=null&&(o.setState(c.getDerivedStateFromError(e)),l=8&o.__g),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),l=8&o.__g),l)return void(o.__g|=2)}catch(d){e=d}}throw q_=0,e}},AZ=0,rhe=function(e){return e!=null&&e.constructor==null},P_.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Xd({},this.state),typeof e=="function"&&(e=e(Xd({},n),this.props)),e&&Xd(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),uZ(this))},P_.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),uZ(this))},P_.prototype.render=bc,Fp=[],q_=0,gZ=function(e,t){return e.__v.__b-t.__v.__b},fZ=/(PointerCapture)$|Capture$/i,BS=0,CS=mZ(!1),_S=mZ(!0),ihe=0;var uhe=0;function Ne(e,t,n,r,o,c){t||(t={});var l,d,p=t;if("ref"in p&&typeof e!="function")for(d in p={},t)d=="ref"?l=t[d]:p[d]=t[d];var A={type:e,props:p,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--uhe,__i:-1,__u:0,__source:o,__self:c};return dn.vnode&&dn.vnode(A),A}var phe=16,mhe=16,Ahe={};function RA({name:e,remappedFrom:t,token:n,width:r,height:o,viewBox:c,label:l,alignCapitals:d=!1}){let p=`#${e.replace(/^#/,"")}`,{width:A,height:f,viewBox:b}=Ahe[e]??{width:phe,height:mhe},h=r??A,w=o??f,C=c??b??`0 0 ${A} ${f}`;return Ne("svg",{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":d,...l!=null?{"aria-label":l,role:"img"}:{"aria-hidden":!0},viewBox:C,width:h,height:w,children:Ne("use",{href:p})})}var BZ=(e)=>e!==void 0&&/\s/.test(e),ghe=(e,t)=>{let n=(r)=>BZ(e[r-1])||BZ(e[r]);if(!n(t))return t;for(let r=1;r<e.length;r++){let o=t-r;if(o>0&&!n(o))return o;let c=t+r;if(c<e.length&&!n(c))return c}return t},EZ=(e)=>ghe(e,Math.ceil(e.length/2)),xZ=(e)=>{if(e.length<2)return[e,""];let t=EZ(e);return[e.slice(0,t),e.slice(t)]},fhe=(e)=>{if(e.length<4)return[e,""];let t=e.lastIndexOf(".")+1,n=e.length-t>10,r=t>=1&&!n?t:EZ(e);return[e.slice(0,r),e.slice(r)]},bhe=(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)]},hhe=(e,{splitIndex:t}={})=>{if(typeof t!=="number"){let n=Math.ceil(e.length/2);return[e.slice(0,n),e.slice(n)]}return[e.slice(0,t),e.slice(t)]},yhe=(e,{splitOffset:t}={})=>{if(typeof t!=="number"||t<=0||t>=e.length){let r=Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},whe=(e,{splitOffset:t}={})=>{if(typeof t!=="number"||t<=0||t>=e.length){let r=Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]}let n=t;return[e.slice(0,n),e.slice(n)]};function khe({children:e,marker:t,variant:n="default"}){return Ne("div",{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Ne("div",{"data-truncate-marker":!0,children:typeof t==="function"?t({children:e}):n==="fade"?Ne("span",{"data-truncate-fade":!0}):t})})}function Che(e){let{mode:t,children:n}=e;return Ne("div",{children:[Ne("div",{"data-truncate-content":"visible",children:t==="fruncate"?Ne("span",{children:n}):n}),Ne("div",{"data-truncate-content":"overflow","aria-hidden":!0,children:t==="fruncate"?Ne("span",{children:n}):n})]})}function IZ({children:e,mode:t="truncate",marker:n="…",variant:r="default",...o}){let c=Ne(Che,{mode:t,children:e},"content"),l=Ne(khe,{marker:n,mode:t,variant:r},"marker");return Ne("div",{"data-truncate-container":t,"data-truncate-variant":r,...o,children:Ne("div",{"data-truncate-grid":!0,children:t==="truncate"?[c,l]:[l,c,Ne("div",{"data-truncate-fill":!0},"fill")]})})}function mh({children:e,...t}){return Ne(IZ,{mode:"truncate",...t,children:e})}function DS({children:e,...t}){return Ne(IZ,{mode:"fruncate",...t,children:e})}function QZ({children:e,contents:t,priority:n="end",split:r="center",minimumLength:o=12,className:c,style:l,...d}){let p=null,A=null;if(Array.isArray(t)){if(t.length!==2)return console.error("MiddleTruncate: contents must be an array of two items"),null;p=Ne(mh,{...d,children:t[0]}),A=Ne(DS,{...d,children:t[1]})}else{if(typeof e!=="string")return console.error("MiddleTruncate: children must be a string"),null;if(e.length===0)return Ne("div",{className:c,style:l});if(e.length<o)if(n==="end")return Ne(DS,{...d,className:c,style:l,children:e});else return Ne(mh,{...d,className:c,style:l,children:e});let f=null,b=null,h=null;if(typeof r==="string"){if(r==="center")f=xZ;else if(r==="extension")f=fhe;else if(r==="leaf-path")f=bhe}else if(typeof r==="number")f=hhe,b=r;else if(Array.isArray(r)){let[D,F]=r;if(h=F,D==="last")f=yhe;else if(D==="first")f=whe}else if(typeof r==="function")f=r;f??=xZ;let[w,C]=f(e,{priority:n,variant:d.variant,splitIndex:typeof b==="number"?b:void 0,splitOffset:typeof h==="number"?h:void 0}),_=w.length>=C.length,v=n==="equal"&&!_,B=n==="equal"&&_,E={},I={};if(v)E.marker="";if(B)I.marker="";p=Ne(mh,{...d,...E,children:w}),A=Ne(DS,{...d,...I,children:C})}return Ne("div",{"data-truncate-group-container":"middle",className:c,style:l,children:[Ne("div",{"data-truncate-segment-priority":n==="start"||n==="equal"?"1":"2",children:p}),Ne("div",{"data-truncate-segment-priority":n==="end"||n==="equal"?"1":"2",children:A})]})}var SS={endIndex:-1,startIndex:-1};function _he(e,t,n){return Math.min(Math.max(e,t),n)}function DZ(e,t){return e<0||t<e?SS:{endIndex:t,startIndex:e}}function FS(e){return e.startIndex<0||e.endIndex<e.startIndex}function vhe(e,t){return FS(e)?0:(e.endIndex-e.startIndex+1)*t}function SZ(e,t,n){if(t<=0)return-1;let r=t*n;if(e<=0)return 0;if(e>=r)return t;return Math.floor(e/n)}function Bhe(e,t,n){if(t<=0||e<=0)return-1;if(e>=t*n)return t-1;return Math.ceil(e/n)-1}function xhe(e){let t=new Map;return e.forEach((n,r)=>{if(n.kind!=="directory"||!n.isExpanded)return;let o=n.ancestorPaths.length,c=t.get(o);if(c==null){t.set(o,[r]);return}c.push(r)}),t}function Ehe(e,t){let n=0,r=e.length-1,o=-1;while(n<=r){let c=Math.floor((n+r)/2),l=e[c];if(l==null)break;if(l<=t){o=c,n=c+1;continue}r=c-1}return o}function Ihe(e){let t=new Map,n=[];for(let o=0;o<e.length;o+=1){let c=e[o];if(c==null)continue;let l=c.kind==="directory"&&c.isExpanded?[...c.ancestorPaths,c.path]:c.ancestorPaths,d=0;while(d<n.length&&d<l.length&&n[d]===l[d])d+=1;for(let p=n.length-1;p>=d;p-=1){let A=n[p];if(A!=null)t.set(A,o-1)}n.length=d;for(let p=d;p<l.length;p+=1){let A=l[p];if(A!=null)n.push(A)}}let r=e.length-1;for(let o of n)t.set(o,r);return t}function LS(e,t,n){if(e.length===0||t<=0)return[];let r=Ihe(e),o=xhe(e),c=[];for(let l=0;l<e.length;l+=1){let d=o.get(l);if(d==null||d.length===0)break;let p=t+l*n,A=Ehe(d,Math.min(e.length-1,Math.floor(p/n))),f=null;while(A>=0){let b=d[A],h=b==null?null:e[b]??null;if(h!=null&&(l===0||h.ancestorPaths[l-1]===c[l-1]?.path)){f=h;break}A-=1}if(f==null)break;c.push(f)}return c.map((l,d)=>{let p=d*n,A=(r.get(l.path)??e.length-1)+1;if(A>=e.length)return{row:l,top:p};let f=A*n-t;return{row:l,top:Math.min(p,f-n)}}).filter((l)=>l.top+n>0)}function FZ(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,o=Math.max(0,t.viewportHeight),c=Math.max(0,Math.floor(t.overscan)),l=Math.max(0,r-o),d=_he(t.scrollTop,0,l),p=t.stickyRows??LS(e,d,t.itemHeight),A=p.reduce((M,P)=>Math.max(M,P.top+t.itemHeight),0),f=Math.min(r,d+A),b=Math.max(0,o-A),h=Math.max(0,r-f),w=SZ(d,n,t.itemHeight),C=SZ(f,n,t.itemHeight),_=A<=0||w<0||w>=n?-1:w,v=_===-1?-1:Math.min(n-1,C-1),B=_===-1||v<_?0:v-_+1,E=b<=0||C>=n?SS:DZ(C,Bhe(f+b,n,t.itemHeight)),I=v+1,D=FS(E)?SS:DZ(Math.max(I,E.startIndex-c),Math.min(n-1,E.endIndex+c)),F=vhe(D,t.itemHeight);return{occlusion:{firstOccludedIndex:_,lastOccludedIndex:v,occludedCount:B},physical:{itemHeight:t.itemHeight,maxScrollTop:l,overscan:c,scrollTop:d,totalHeight:r,totalRowCount:n,viewportHeight:o},projected:{contentHeight:h,paneHeight:b,paneTop:f},sticky:{height:A,rows:p},visible:E,window:{endIndex:D.endIndex,height:F,offsetTop:FS(D)?0:D.startIndex*t.itemHeight,startIndex:D.startIndex}}}var LZ={added:"A",deleted:"D",ignored:null,modified:"M",renamed:"R",untracked:"U"},RZ={added:"Git status: added",deleted:"Git status: deleted",ignored:"Git status: ignored",modified:"Git status: modified",renamed:"Git status: renamed",untracked:"Git status: untracked"},NZ="Contains git status items";function MZ(e){if(e.current)return!0;return e.current=!0,!1}function RS(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:o=0,viewportHeight:c}=e;if(n<0)return null;let l=Math.max(0,o),d=n*r,p=d+r;if(d<t+l){let A=Math.max(0,d-l);return A===t?null:A}if(p>t+c){let A=p-c;return A===t?null:A}return null}function jZ(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:o,topInset:c=0,totalHeight:l,viewportHeight:d}=e;if(o==="nearest")return RS({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:c,viewportHeight:d});if(n<0)return null;let p=Math.max(0,c),A=n*r,f=Math.max(0,d-p),b=o==="center"?p+Math.max(0,(f-r)/2):p,h=Math.max(0,l-d),w=Math.max(0,Math.min(A-b,h));return w===t?null:w}function TZ(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:o,totalHeight:c,viewportHeight:l}=e;if(n<0)return null;let d=Math.max(0,o),p=n*r,A=p+r,f=t+d,b=t+l;if(p>=f&&A<=b)return null;let h=Math.max(0,c-l),w=Math.max(0,Math.min(p-d,h));return w===t?null:w}function Lp(e){if(e==null||!e.isConnected)return!1;if(e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();if(t instanceof ShadowRoot)return t.activeElement===e;return document.activeElement===e}function Ah(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let r=t.activeElement;return r instanceof HTMLElement?r:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function NA(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;if(n>0)return n;return e.clientHeight>0?e.clientHeight:t}function NS(e,t){return e!=null&&e>0?e:t}function $Z(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;if(n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0)return n.blockSize;return e.contentRect.height>0?e.contentRect.height:null}function MS(e,t,n,r,o=0){let c=RS({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:o,viewportHeight:r});if(c==null)return!1;return e.scrollTop=c,!0}function PZ(e,t,n,r,o,c,l=0){let d=jZ({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:c,topInset:l,totalHeight:o,viewportHeight:r});if(d==null)return!1;return e.scrollTop=d,!0}function MA(e,t,n,r,o,c){let l=TZ({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:c,totalHeight:o,viewportHeight:r});if(l==null)return!1;return e.scrollTop=l,!0}function jS(e,t,n,r){if(n.end<n.start)return null;if(e<n.start)return-t;if(e>n.end)return r;return null}function qZ(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;if(t==null)return"reset";if(!r)return"reveal-canonical";if(n===t)return"ignore";return"focus-input"}function GZ({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:o,onInput:c}){return Ne("input",{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:o,onInput:c,onClick:(l)=>l.stopPropagation(),onMouseDown:(l)=>l.stopPropagation(),onPointerDown:(l)=>l.stopPropagation()})}function zZ(e){let{row:t,mode:n,targetPath:r,ariaLabel:o,domId:c,isParked:l,itemHeight:d,features:p,state:A,extraStyle:f}=e,b=n==="sticky",h=t.ancestorPaths.at(-1)??"",w={};if(A.isFocusRinged)w["data-item-focused"]=!0;if(t.isSelected)w["data-item-selected"]=!0;if(A.isContextHovered)w["data-item-context-hover"]="true";if(A.isDragTarget)w["data-item-drag-target"]=!0;if(A.isDragging)w["data-item-dragging"]=!0;if(A.effectiveGitStatus!=null)w["data-item-git-status"]=A.effectiveGitStatus;if(A.containsGitChange)w["data-item-contains-git-change"]="true";return{"aria-expanded":!b&&t.kind==="directory"?t.isExpanded:void 0,"aria-haspopup":p.contextMenuEnabled?"menu":void 0,"aria-label":o,"aria-level":!b?t.level+1:void 0,"aria-posinset":!b?t.posInSet+1:void 0,"aria-selected":!b?t.isSelected?"true":"false":void 0,"aria-setsize":!b?t.setSize:void 0,"data-file-tree-sticky-path":b?r:void 0,"data-file-tree-sticky-row":b?"true":void 0,"data-item-context-menu-button-visibility":p.actionLaneEnabled?p.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":p.contextMenuEnabled?p.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":p.actionLaneEnabled?"true":void 0,"data-item-has-git-lane":p.gitLaneActive?"true":void 0,"data-item-parent-path":h.length>0?h:void 0,"data-item-parked":l?"true":void 0,"data-item-path":r,"data-item-type":t.kind==="directory"?"folder":"file","data-type":"item",id:!b?c:void 0,role:!b?"treeitem":void 0,style:{minHeight:`${d}px`,...f},tabIndex:!b&&t.isFocused?0:-1,...w}}function OZ(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:o}=e,c=t.ctrlKey||t.metaKey,l=t.shiftKey||c,d=t.shiftKey?{additive:c,kind:"range"}:c?{kind:"toggle"}:{kind:"single"};return{closeSearch:r,revealCanonical:n==="sticky",selection:d,toggleDirectory:!l&&o}}var jA,ea,TS,HZ,$S=Object.is,gh=0,XZ=[],sa=dn,UZ=sa.__b,ZZ=sa.__r,YZ=sa.diffed,KZ=sa.__c,WZ=sa.unmount,JZ=sa.__;function H_(e,t){sa.__h&&sa.__h(ea,e,gh||t),gh=0;var n=ea.__H||(ea.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function hs(e){return gh=1,Qhe(eY,e)}function Qhe(e,t,n){var r=H_(jA++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):eY(void 0,t),function(d){var p=r.__N?r.__N[0]:r.__[0],A=r.t(p,d);$S(p,A)||(r.__N=[A,r.__[1]],r.__c.setState({}))}],r.__c=ea,!ea.__f)){var o=function(d,p,A){if(!r.__c.__H)return!0;var f=r.__c.__H.__.filter(function(h){return!!h.__c});if(f.every(function(h){return!h.__N}))return!c||c.call(this,d,p,A);var b=r.__c.props!==d;return f.forEach(function(h){if(h.__N){var w=h.__[0];h.__=h.__N,h.__N=void 0,$S(w,h.__[0])||(b=!0)}}),c&&c.call(this,d,p,A)||b};ea.__f=!0;var{shouldComponentUpdate:c,componentWillUpdate:l}=ea;ea.componentWillUpdate=function(d,p,A){if(4&this.__g){var f=c;c=void 0,o(d,p,A),c=f}l&&l.call(this,d,p,A)},ea.shouldComponentUpdate=o}return r.__N||r.__}function qS(e,t){var n=H_(jA++,3);!sa.__s&&GS(n.__H,t)&&(n.__=e,n.u=t,ea.__H.__h.push(n))}function _i(e,t){var n=H_(jA++,4);!sa.__s&&GS(n.__H,t)&&(n.__=e,n.u=t,ea.__h.push(n))}function kt(e){return gh=5,Bl(function(){return{current:e}},[])}function Bl(e,t){var n=H_(jA++,7);return GS(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function fr(e,t){return gh=8,Bl(function(){return e},t)}function Dhe(){for(var e;e=XZ.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(O_),e.__H.__h.forEach(PS),e.__H.__h=[]}catch(t){e.__H.__h=[],sa.__e(t,e.__v)}}sa.__b=function(e){ea=null,UZ&&UZ(e)},sa.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),JZ&&JZ(e,t)},sa.__r=function(e){ZZ&&ZZ(e),jA=0;var t=(ea=e.__c).__H;t&&(TS===ea?(t.__h=[],ea.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.forEach(O_),t.__h.forEach(PS),t.__h=[],jA=0)),TS=ea},sa.diffed=function(e){YZ&&YZ(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(XZ.push(t)!==1&&HZ===sa.requestAnimationFrame||((HZ=sa.requestAnimationFrame)||She)(Dhe)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),TS=ea=null},sa.__c=function(e,t){t.some(function(n){try{n.__h.forEach(O_),n.__h=n.__h.filter(function(r){return!r.__||PS(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],sa.__e(r,n.__v)}}),KZ&&KZ(e,t)},sa.unmount=function(e){WZ&&WZ(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{O_(r)}catch(o){t=o}}),n.__H=void 0,t&&sa.__e(t,n.__v))};var VZ=typeof requestAnimationFrame=="function";function She(e){var t,n=function(){clearTimeout(r),VZ&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);VZ&&(t=requestAnimationFrame(n))}function O_(e){var t=ea,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ea=t}function PS(e){var t=ea;e.__c=e.__(),ea=t}function GS(e,t){return!e||e.length!==t.length||t.some(function(n,r){return!$S(n,e[r])})}function eY(e,t){return typeof t=="function"?t(e):t}function Fhe(e,t=null,n=null){let r=e.flattenedSegments;if(r==null||r.length===0)return t??e.name;return Ne("span",{"data-item-flattened-subitems":!0,children:r.map((o,c)=>{let l=c===r.length-1;return Ne(bc,{children:[Ne("span",{"data-item-flattened-subitem":o.path,"data-item-flattened-subitem-drag-target":n===o.path?"true":void 0,children:l&&t!=null?t:Ne(mh,{children:o.name})}),c<r.length-1?" / ":""]},o.path)})})}function $A(e){return e.isFlattened?e.flattenedSegments?.findLast((t)=>t.isTerminal)?.path??e.path:e.path}function OS(e){let t=e.flattenedSegments;if(t==null||t.length===0)return e.name;return t.map((n)=>n.name).join(" / ")}function tY(e,t,n,r){return e.map((o,c)=>{let l=c*n,d=o.subtreeEndIndex+1;if(d>=r)return{row:o.row,top:l};let p=d*n-t;return{row:o.row,top:Math.min(l,p-n)}}).filter((o)=>o.top+n>0)}function zS({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:o,viewportHeight:c}){let l=e.getVisibleCount(),d=o&&l>0?e.getStickyRowCandidates(r,t):[],p=d==null&&o&&l>0?e.getVisibleRows(0,l-1):[],A=FZ(p,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:d==null?void 0:tY(d,r,t,l),totalRowCount:l,viewportHeight:c}),f=o&&r<=0&&l>0?e.getStickyRowCandidates(1,t):[],b=f!=null&&r<=0?tY(f,1,t,l):o&&r<=0&&p.length>0?LS(p,1,t):A.sticky.rows;return{overlayHeight:b.reduce((h,w)=>Math.max(h,w.top+t),0),overlayRows:b,snapshot:A,visibleRows:p}}var Lhe=400,nY=10,TA=40,aY=18;function Rhe(e,t,n){let r=e,o=document.elementFromPoint?.bind(document)??null,c=r.elementFromPoint?.(t,n)??o?.(t,n)??null;if(e instanceof ShadowRoot&&(c==null||!e.contains(c)))return Nhe(e,t,n);return c instanceof HTMLElement?c:null}function Nhe(e,t,n){let r=Array.from(e.querySelectorAll('[data-type="item"], [data-item-flattened-subitem]'));for(let o=r.length-1;o>=0;o--){let c=r[o],l=c.getBoundingClientRect();if(t>=l.left&&t<=l.right&&n>=l.top&&n<=l.bottom)return c}return null}function rY(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]"),o=r instanceof HTMLElement?r.getAttribute("data-item-flattened-subitem")??null:null;if(o!=null&&o.endsWith("/"))return{directoryPath:o,flattenedSegmentPath:o,hoveredPath:n,kind:"directory"};if(t.dataset.itemType==="folder")return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:"directory"};let c=t.dataset.itemParentPath??null;if(c==null||c.length===0)return{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:"root"};return{directoryPath:c,flattenedSegmentPath:null,hoveredPath:n,kind:"directory"}}function iY(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 Mhe(){return navigator.vendor!=="Apple Computer, Inc."}function jhe(e,t){let n=e-t.top;if(n<TA)return-Math.ceil((TA-Math.max(0,n))/TA*aY);let r=t.bottom-e;if(r<TA)return Math.ceil((TA-Math.max(0,r))/TA*aY);return 0}function The(e,t){if(e!=null){let n=LZ[e];if(n==null)return null;return{text:n,title:RZ[e]}}if(t)return{icon:{name:"file-tree-icon-dot",width:6,height:6},title:NZ};return null}function $he(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let o=e.length-1;o>=0;o-=1){let c=e[o],l=n.get(c);if(l!=null){for(let d of r)n.set(d,l);return l?"ignored":null}if(t.has(c)){n.set(c,!0);for(let d of r)n.set(d,!0);return"ignored"}r.push(c)}for(let o of r)n.set(o,!1);return null}function oY(e){return e!=null&&"toggle"in e}function AY(e){return e.code==="Space"||e.key===" "||e.key==="Spacebar"}function Phe(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function qhe(e){if(e==null)return"";return`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll("\\","\\\\").replaceAll('"',"\\\"")}"] { opacity: 1; }`}function gY(e){return e.shiftKey&&e.key==="F10"||e.key==="ContextMenu"}function Ghe(e,t){if(t&&gY(e))return!0;if((e.ctrlKey||e.metaKey)&&AY(e))return!0;return e.key==="ArrowDown"||e.key==="ArrowLeft"||e.key==="ArrowRight"||e.key==="ArrowUp"}var zhe=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"]);function sY(e){for(let t of e.composedPath()){if(!(t instanceof HTMLElement))continue;if(t.dataset.fileTreeContextMenuRoot==="true")return!0;if(t.dataset.type==="context-menu-anchor"||t.dataset.type==="context-menu-trigger")return!0;if(t.getAttribute("slot")==="context-menu")return!0}return!1}function Ohe(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 Hhe(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function Uhe(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function cY(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function lY(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let o=n.get(e)??null;return o?.dataset.itemParked==="true"?null:o}function Zhe(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 r=n.dataset.fileTreeStickyPath;if(r!=null)t.push(r)}return t}function Yhe(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 Khe(e,t,n,r,o,c,l){let d=Math.max(0,c-o),p=t?.getBoundingClientRect()??null,A=p==null||n==null?null:n.getBoundingClientRect().top-p.top,f=Yhe(e,r),b=p==null||f==null?null:f.getBoundingClientRect().top-p.top;return Math.max(0,Math.min(b??Math.max(A??0,d),Math.max(0,l-o)))}function dY(e,t){return{kind:e.kind,name:OS(e),path:t}}function Whe(e){return e==null?void 0:`${e}__tree`}function fY(e,t,n){if(e==null)return;return`${e}__focused-item-${encodeURIComponent(t)}${n?"__parked":""}`}function uY(e){return e==="file-tree-icon-chevron"||e==="file-tree-icon-dot"||e==="file-tree-icon-file"||e==="file-tree-icon-lock"}function pY(e,t){if(e==null)return null;if("text"in e){if(e.parts!=null)return Ne("span",{title:e.title,children:e.parts.map((r,o)=>Ne("span",{style:{color:r.color},children:r.text},o))});return Ne("span",{title:e.title,children:e.text})}let n=typeof e.icon==="string"?uY(e.icon)?t(e.icon):{name:e.icon}:uY(e.icon.name)?(()=>{let r=t(e.icon.name),{name:o,...c}=e.icon;return{...r,...c}})():e.icon;return Ne("span",{title:e.title,children:Ne(RA,{...n})})}function mY(e){if(e==null)return;Lp(e.querySelector(["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", "))??e)}function Jhe(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:o=!1,dragTargetFlattenedSegmentPath:c=null,gitDecoration:l=null,gitLaneActive:d=!1,renameInput:p=null,showDecorativeActionAffordance:A=!1}={}){let f=$A(e);return Ne(bc,{children:[e.depth>0?Ne("div",{"data-item-section":"spacing",children:Array.from({length:e.depth}).map((b,h)=>Ne("div",{"data-item-section":"spacing-item","data-ancestor-path":e.ancestorPaths[h]},h))}):null,Ne("div",{"data-item-section":"icon",children:e.kind==="directory"?Ne(RA,{...t("file-tree-icon-chevron")}):Ne(RA,{...t("file-tree-icon-file",f)})}),Ne("div",{"data-item-section":"content",children:e.isFlattened?Fhe(e,p,c):p??Ne(QZ,{minimumLength:5,split:"extension",children:e.name})}),o?Ne("div",{"data-item-section":"decoration",children:r!=null?pY(r,t):null}):null,d?Ne("div",{"data-item-section":"git",children:pY(l,t)}):null,n?Ne("div",{"data-item-section":"action",children:A?Ne("span",{"aria-hidden":"true","data-item-action-affordance":"decorative",children:Ne(RA,{...t("file-tree-icon-ellipsis")})}):null}):null]})}function U_(e,t,n,r={}){let{controller:o,renameView:c,visualFocusPath:l,contextHoverPath:d,draggedPathSet:p,dragTarget:A,dragAndDropEnabled:f,shouldSuppressContextMenu:b,handleRowDragStart:h,handleRowDragEnd:w,handleRowTouchStart:C,instanceId:_,itemHeight:v,gitStatusByPath:B,ignoredGitDirectories:E,ignoredInheritanceCache:I,directoriesWithGitChanges:D,gitLaneActive:F,contextMenuEnabled:M,contextMenuTriggerMode:P,contextMenuButtonTriggerEnabled:q,contextMenuButtonVisibility:W,contextMenuRightClickEnabled:Z,registerRenameInput:ye,registerButton:ne,resolveIcon:re,renderDecorationForRow:ce,openContextMenuForRow:ae,onRowClick:V,onKeyDown:se}=e,ge=$A(t),{isParked:Ce=!1,mode:U="flow",style:pe}=r,xe=U==="sticky",Ie=B?.get(ge)??null??$he(t.ancestorPaths,E,I),Se=t.kind==="directory"&&(D?.has(ge)??!1),st=ce(t,ge),Ee=The(Ie,Se),ve=M&&q,Le=st!=null||F||ve,we=ve&&W==="always",Te=c.getPath()===ge,be=Te?c.getValue():"",ze=xe||!Te?null:Ne(GZ,{ref:ye,ariaLabel:`Rename ${OS(t)}`,isFlattened:t.isFlattened,value:be,onBlur:()=>{c.commit()},onInput:(Je)=>{c.setValue(Je.currentTarget.value)}}),Ke=Jhe(t,re,{actionLaneEnabled:ve,customDecoration:st,decorationLaneEnabled:Le,dragTargetFlattenedSegmentPath:A?.flattenedSegmentPath??null,gitDecoration:Ee,gitLaneActive:F,renameInput:ze,showDecorativeActionAffordance:we}),pt={...zZ({ariaLabel:OS(t),domId:t.isFocused?fY(_,ge,Ce):void 0,extraStyle:pe,features:{actionLaneEnabled:ve,contextMenuButtonVisibility:ve?W:null,contextMenuEnabled:M,contextMenuTriggerMode:M?P:null,gitLaneActive:F},isParked:Ce,itemHeight:v,mode:U,row:t,state:{containsGitChange:Se,effectiveGitStatus:Ie,isContextHovered:d===ge,isDragTarget:A?.kind==="directory"&&A.directoryPath===ge,isDragging:p?.has(ge)===!0,isFocusRinged:t.isFocused&&l===ge},targetPath:ge}),key:n,onContextMenu:M||f?(Je)=>{if(b()){Je.preventDefault();return}if(!M)return;if(Je.preventDefault(),!Z)return;o.focusMountedPathFromInput(ge),ae(t,ge,{anchorRect:Hhe(Je.clientX,Je.clientY),source:"right-click"})}:void 0,onFocus:!xe?()=>{o.focusMountedPathFromInput(ge)}:void 0,onKeyDown:!xe?se:void 0,ref:(Je)=>{ne(ge,Je)}};if(!xe&&Te)return Ne("div",{...pt,children:Ke});return Ne("button",{...pt,type:"button",draggable:f&&!Ce,onDragEnd:f&&!Ce?w:void 0,onDragStart:f&&!Ce?(Je)=>{h(Je,t,ge)}:void 0,onMouseDown:(Je)=>{if(xe){Je.preventDefault();return}if(o.isSearchOpen())Je.preventDefault()},onTouchStart:f&&!Ce?(Je)=>{C(Je,t,ge)}:void 0,onClick:(Je)=>{V(Je,t,ge,U)},children:Ke})}function Vhe(e,t,n){if(t.end<t.start)return[];return e.controller.getVisibleRows(t.start,t.end).filter((r)=>!n.has($A(r))).map((r,o)=>U_(e,r,t.start+o))}function HS({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:o,icons:c,instanceId:l,itemHeight:d=k_,overscan:p=10,renamingEnabled:A=!1,renderRowDecoration:f,searchBlurBehavior:b="close",searchEnabled:h=!1,searchFakeFocus:w=!1,slotHost:C,stickyFolders:_=!1,initialViewportHeight:v=420}){let B=kt(null),E=kt(null),I=kt(!1),D=kt(null),F=kt(null),M=kt(null),P=kt(null),q=kt(null),W=kt(new Map),Z=kt(new Map),ye=kt(()=>{}),ne=kt(null),re=kt(0),ce=kt(!1),ae=kt(null);if(ae.current!==t)ce.current=!1,ae.current=t;let V=kt(!1),se=kt(null),ge=kt(null),Ce=kt(!1),U=kt(null),pe=kt(null),xe=kt(null),Ie=kt(null),Se=kt(null),st=kt(null),Ee=kt(null),ve=kt(null),Le=kt(!1),we=kt(null),Te=kt(null),be=kt(null),ze=kt(null),Ke=Bl(()=>new Map,[]),[,pt]=hs(0),Je=kt(!1),[ft,Vt]=hs(null),[Oe,Mn]=hs(null),[bt,Xr]=hs(null),[ei,Ja]=hs(null),[Va,Qs]=hs(0),[Tt,so]=hs(null),zn=kt(Tt);zn.current=Tt;let Ei=kt(null),ca=kt(null),Xa=kt(null),yr=kt(null),Ii=kt(null),Qi=kt(!1),wr=()=>{ca.current=null,Xa.current=null,yr.current=null},S=(O,he)=>{ca.current=O,Xa.current=null,yr.current=he==null?null:{path:O,scrollTop:he}},te=(O,he)=>{ca.current=null,Xa.current={path:O,viewportOffset:he},yr.current=null},ke=kt(b==="retain"&&t.isSearchOpen()),[Qe,Me]=hs(w);qS(()=>{if(!w)Me(!1)},[w]);let it=kt(!1),tt=fr(()=>{it.current=!0,Me((O)=>O?!1:O)},[]),[Nt,We]=hs(()=>zS({controller:t,itemHeight:d,overscan:p,scrollTop:0,stickyFolders:_,viewportHeight:v})),[la,ja]=hs(!1);qS(()=>{ja(!0)},[]);let In=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,ti=e?.contextMenu?.triggerMode??(In?"right-click":"both"),Ta=ti==="both"||ti==="button",Di=e?.contextMenu?.buttonVisibility??"when-needed",co=ti==="both"||ti==="right-click";_i(()=>{let O=M.current;if(O==null)return;let he=(De)=>{if(!(De instanceof CustomEvent))return;let $e=De.detail?.path??null;Ii.current=$e,Mn($e),Ja($e==null?null:"pointer")},Ze=(De)=>{if(!(De instanceof CustomEvent))return;Qi.current=De.detail?.disabled===!0};return O.addEventListener("file-tree-debug-set-context-menu-trigger",he),O.addEventListener("file-tree-debug-set-scroll-suppression",Ze),()=>{O.removeEventListener("file-tree-debug-set-context-menu-trigger",he),O.removeEventListener("file-tree-debug-set-scroll-suppression",Ze)}},[]);let er=fr((O,he)=>{cY(W.current,O,he)},[]),na=fr((O,he)=>{cY(Z.current,O,he)},[]),du=fr((O)=>{F.current=O},[]),lo=fr((O)=>lY(O,Z.current,W.current),[]),yt=n!=null||r!=null||o!=null,{resolveIcon:Dr}=Bl(()=>lZ(c),[c]),Si=t[wS](),jn=Si.getPath(),xc=jn!=null,tr=t.isSearchOpen(),ag=t.getSearchValue(),wt=t.getFocusedPath(),$t=t.getFocusedIndex(),uo=t.getScrollRequest(),Ca=t.isDragAndDropEnabled(),$o=t.getDragSession(),rg=Bl(()=>$o==null?null:new Set($o.draggedPaths),[$o]),uu=$o?.target??null,Po=$o?.primaryPath??null,Ql=Whe(l),{overlayHeight:$a,overlayRows:po,snapshot:un,visibleRows:Pa}=Nt,wn=un.physical.viewportHeight,_a=Bl(()=>({end:un.window.endIndex,start:un.window.startIndex}),[un.window.endIndex,un.window.startIndex]),pn=po,qo=un.sticky.rows,da=un.physical.totalHeight,va=un.sticky.height,Go=Bl(()=>new Set(qo.map((O)=>$A(O.row))),[qo]),Dl=$t>=0&&$t>=_a.start&&$t<=_a.end,Ds=fr((O,he)=>f?.({item:dY(O,he),row:O})??null,[f]),Sr=fr((O)=>{if(Lp(O==null?null:W.current.get(O)??null))return!0;return Lp(M.current)},[]),Fi=fr((O)=>{Sr(t.focusNearestPath(O))},[t,Sr]),Ss=kt(Fi);Ss.current=Fi;let Tn=kt(!0),zo=kt(()=>{}),ua=fr((O=!0)=>{let he=zn.current;if(he==null)return;if(Tn.current=Tn.current&&O,so(null),e?.contextMenu?.onClose?.(),Tn.current)Fi(he.path)},[e?.contextMenu,Fi]);zo.current=ua;let Fr=fr((O)=>{let he=O==null?null:Uhe(M.current,O);Xr((Ze)=>Ze===he?Ze:he)},[]),Ba=fr((O,he,Ze)=>{let De=t.getItem(he);if(De==null)return;let $e=lo(he);if($e?.dataset.fileTreeStickyRow==="true"){let Xe=P.current;S(he,Xe?.scrollTop??null),V.current=!0,Vt((rn)=>rn===he?rn:he)}De.focus(),Fr($e),Tn.current=!0,so({anchorRect:Ze?.anchorRect??null,item:dY(O,he),path:he,source:Ze?.source??"keyboard"})},[t,lo,Fr]),Li=fr((O)=>{if(!A)return;if(t.isSearchOpen()){let he=P.current,Ze=NA(he,wn);U.current=$t<0||he==null?null:Math.max(0,Math.min($t*d-he.scrollTop,Math.max(0,Ze-d))),Ce.current=!0}if(t.startRenaming(O)===!1)return;Ja("focus"),pt((he)=>he+1)},[t,$t,d,A,wn]),Lr=fr((O,{restoreTreeFocus:he=!0,targetOffset:Ze="live-overlay"}={})=>{let De=P.current;if(De==null)return!1;t.focusPath(O);let $e=t.getFocusedIndex();if($e<0)return!1;let Xe=t.getVisibleRows($e,$e)[0]??null;if(Xe==null)return!1;let rn=NA(De,wn),nt=t.getVisibleCount()*d,Kt=Ze==="sticky-parents"?Xe.ancestorPaths.length*d:zS({controller:t,itemHeight:d,overscan:p,scrollTop:De.scrollTop,stickyFolders:_,viewportHeight:rn}).snapshot.sticky.height;return V.current=!0,MA(De,$e,d,rn,nt,Kt),ye.current(),Ei.current=he?O:null,!0},[t,d,p,wn,_]),Fs=()=>I.current===!0||ze.current!=null||Le.current===!0,Ls=(O)=>typeof window.requestAnimationFrame==="function"?window.requestAnimationFrame(()=>{O()}):window.setTimeout(O,16),Pt=(O)=>{if(O==null)return;if(typeof window.cancelAnimationFrame==="function"){window.cancelAnimationFrame(O);return}window.clearTimeout(O)},$n=()=>{if(Ie.current!=null)clearTimeout(Ie.current),Ie.current=null;xe.current=null},vt=()=>{st.current?.remove(),st.current=null},mo=()=>{Pt(pe.current),pe.current=null,Se.current=null},Tp=(O)=>{let he=M.current?.getRootNode();if(he instanceof ShadowRoot){he.append(O);return}document.body.append(O)},Ec=()=>{if(ve.current?.(),ve.current=null,ze.current!=null)clearTimeout(ze.current),ze.current=null;if(Le.current=!1,we.current=null,be.current=null,Te.current!=null)Te.current.setAttribute("draggable","true"),Te.current.style.removeProperty("touch-action"),Te.current=null;vt(),$n(),mo(),Ee.current=null},Yn=(O,he)=>{let Ze=M.current?.getRootNode(),De=rY(Rhe(Ze instanceof ShadowRoot?Ze:document,O,he));return t.setDragTarget(De),t.getDragSession()?.target??null},kr=(O)=>{let he=t.getDragAndDropConfig()?.openOnDropDelay??800;if(O==null||O.kind!=="directory"||O.directoryPath==null||he<=0){$n();return}let Ze=t.getItem(O.directoryPath),De=oY(Ze)?Ze:null;if(De==null||De.isExpanded()){$n();return}let $e=`${O.directoryPath}::${O.flattenedSegmentPath??""}`;if(xe.current===$e)return;$n(),xe.current=$e,Ie.current=setTimeout(()=>{let Xe=t.getDragSession()?.target;if(Xe?.kind!=="directory"||Xe.directoryPath!==O.directoryPath||Xe.flattenedSegmentPath!==O.flattenedSegmentPath)return;De.expand()},he)},nr=()=>{pe.current=null;let O=Se.current,he=P.current;if(O==null||he==null||t.getDragSession()==null)return;let Ze=he.getBoundingClientRect(),De=jhe(O.clientY,Ze);if(De===0)return;let $e=Math.max(0,he.scrollHeight-he.clientHeight),Xe=Math.max(0,Math.min($e,he.scrollTop+De));if(Xe!==he.scrollTop)he.scrollTop=Xe,ye.current();kr(Yn(O.clientX,O.clientY)),pe.current=Ls(nr)},Oo=(O,he)=>{Se.current={clientX:O,clientY:he},pe.current??=Ls(nr)},ni=(O,he,Ze)=>{let De=O.currentTarget;if(De==null)return;if(Ec(),vt(),$n(),mo(),t.startDrag(Ze)===!1){O.preventDefault();return}if(Ee.current=he,O.dataTransfer!=null){if(O.dataTransfer.effectAllowed="move",O.dataTransfer.dropEffect="move",O.dataTransfer.setData("text/plain",Ze),Mhe()){let $e=iY(De),Xe=De.getBoundingClientRect();Object.assign($e.style,{height:`${Xe.height}px`,opacity:"0.85",transform:"translate3d(-9999px, 0px, 0)",width:`${Xe.width}px`}),Tp($e),st.current=$e,O.dataTransfer.setDragImage($e,Math.max(0,O.clientX-Xe.left),Math.max(0,O.clientY-Xe.top))}}},pu=()=>{vt(),$n(),mo(),Ee.current=null,t.cancelDrag()},Rs=(O,he,Ze)=>{if(ze.current!=null||Le.current)return;let De=O.touches[0],$e=O.currentTarget;if(De==null||$e==null)return;be.current={clientX:De.clientX,clientY:De.clientY},Te.current=$e,$e.setAttribute("draggable","false");let Xe=(Kt={})=>{let on=Kt.restoreNativeDraggable??!Le.current;if(ze.current!=null)clearTimeout(ze.current),ze.current=null;if(document.removeEventListener("touchmove",rn),document.removeEventListener("touchend",nt),document.removeEventListener("touchcancel",nt),ve.current===Xe)ve.current=null;if(on){if($e.setAttribute("draggable","true"),Te.current===$e)Te.current=null;be.current=null}},rn=(Kt)=>{let on=Kt.touches[0],L=be.current;if(on==null||L==null)return;let j=on.clientX-L.clientX,K=on.clientY-L.clientY;if(j*j+K*K<=nY*nY)return;Xe()},nt=()=>{Xe()};document.addEventListener("touchmove",rn,{passive:!0}),document.addEventListener("touchend",nt),document.addEventListener("touchcancel",nt),ve.current=Xe,ze.current=setTimeout(()=>{if(Xe({restoreNativeDraggable:!1}),t.startDrag(Ze)===!1){if($e.setAttribute("draggable","true"),Te.current===$e)Te.current=null;be.current=null;return}Le.current=!0,Te.current=$e,$e.setAttribute("draggable","false"),$e.style.setProperty("touch-action","none"),Ee.current=he;let Kt=$e.getBoundingClientRect(),on=iY($e);Object.assign(on.style,{height:`${Kt.height}px`,opacity:"0.85",transform:`translate3d(${Kt.left}px, ${Kt.top}px, 0)`,width:`${Kt.width}px`}),Tp(on),st.current=on,we.current={x:De.clientX-Kt.left,y:De.clientY-Kt.top};let L=(ie)=>{let oe=ie.touches[0];if(oe==null)return;ie.preventDefault();let fe=we.current;if(fe!=null&&st.current!=null)st.current.style.transform=`translate3d(${oe.clientX-fe.x}px, ${oe.clientY-fe.y}px, 0)`;kr(Yn(oe.clientX,oe.clientY)),Oo(oe.clientX,oe.clientY)},j=(ie)=>{let oe=ie.changedTouches[0];if(oe!=null)Yn(oe.clientX,oe.clientY);t.completeDrag(),Ec()},K=()=>{t.cancelDrag(),Ec()};ve.current=()=>{document.removeEventListener("touchmove",L),document.removeEventListener("touchend",j),document.removeEventListener("touchcancel",K)},document.addEventListener("touchmove",L,{passive:!1}),document.addEventListener("touchend",j),document.addEventListener("touchcancel",K)},Lhe)},Ao=(O)=>{if(Tt!=null){if(O.key==="Escape"){ua(),O.preventDefault(),O.stopPropagation();return}if(zhe.has(O.key))O.preventDefault(),O.stopPropagation();return}if(Si.isActive()){if(O.isComposing||O.keyCode===229)return;if(O.key==="Escape")Si.cancel();else if(O.key==="Enter")Si.commit();else return;Ja("focus"),pt((mt)=>mt+1),O.preventDefault(),O.stopPropagation();return}if(A&&O.key==="F2"){Li(wt??void 0),O.preventDefault(),O.stopPropagation();return}if(tr){if(O.key==="Escape")Ce.current=!1,U.current=null,t.closeSearch();else if(O.key==="Enter"){let mt=t.getFocusedPath();if(mt!=null)t.selectOnlyPath(mt);let Pn=P.current,Ms=NA(Pn,wn);U.current=$t<0||Pn==null?null:Math.max(0,Math.min($t*d-Pn.scrollTop,Math.max(0,Ms-d))),Ce.current=!0,t.closeSearch()}else if(O.key==="ArrowDown")t.focusNextSearchMatch();else if(O.key==="ArrowUp")t.focusPreviousSearchMatch();else return;Ja("focus"),pt((mt)=>mt+1),O.preventDefault(),O.stopPropagation();return}if(h&&Phe(O)){t.openSearch(O.key),pt((mt)=>mt+1),O.preventDefault(),O.stopPropagation();return}let he=In&&gY(O),Ze=Ghe(O,In),De=Ze&&M.current!=null?Ah(M.current):null,$e=Ze?new Set(Zhe(M.current)):new Set,Xe=De?.dataset.fileTreeStickyPath??null,rn=De?.dataset.fileTreeStickyRow==="true"&&Xe!=null;if(rn&&Xe!==wt&&$e.has(Xe)){let mt=P.current;S(Xe,mt?.scrollTop??null),t.focusPath(Xe)}let nt=t.getFocusedPath(),Kt=t.getFocusedIndex(),on=t.getFocusedItem();if(on==null)return;let L=oY(on)?on:null,j=nt!=null&&(Go.has(nt)||rn&&Xe===nt&&$e.has(nt)),K=O.key==="ArrowDown"||O.key==="ArrowUp"||O.key==="ArrowRight"&&L!=null&&L.isExpanded(),ie=O.key==="ArrowLeft"&&j&&L!=null&&L.isExpanded(),oe=P.current,fe=!0;if(O.shiftKey&&O.key==="ArrowDown")t.extendSelectionFromFocused(1);else if(O.shiftKey&&O.key==="ArrowUp")t.extendSelectionFromFocused(-1);else if(he&&nt!=null&&Kt>=0){let mt=t.getVisibleRows(Kt,Kt)[0]??null,Pn=lY(nt,Z.current,W.current);if(mt==null||Pn==null)fe=!1;else Ba(mt,nt)}else if((O.ctrlKey||O.metaKey)&&AY(O))t.toggleFocusedSelection();else if((O.ctrlKey||O.metaKey)&&O.key.toLowerCase()==="a")t.selectAllVisiblePaths();else switch(O.key){case"ArrowDown":t.focusNextItem();break;case"ArrowUp":t.focusPreviousItem();break;case"ArrowRight":if(L==null||L.isExpanded())t.focusNextItem();else L.expand();break;case"ArrowLeft":if(L!=null&&L.isExpanded())L.collapse();else t.focusParentItem();break;case"Home":t.focusFirstItem();break;case"End":t.focusLastItem();break;default:fe=!1}if(!fe)return;Ja("focus");let Ge=t.getFocusedPath(),rt=Ge!=null&&(Go.has(Ge)||$e.has(Ge)),Xt=K&&Ge!==nt,Hn=he&&rn&&Xe===nt&&Ge===nt;if((j||Hn)&&Ge!=null&&(Xt&&rt||Hn))S(Ge,oe?.scrollTop??null),V.current=!0,Vt((mt)=>mt===Ge?mt:Ge);else{let mt=O.key==="ArrowUp"&&j&&Ge!==nt;if(Ge!=null&&(mt||ie&&Ge===nt))te(Ge,Khe(M.current,oe,De,nt,d,va,wn)),V.current=!0,Vt((Pn)=>Pn===Ge?Pn:Ge);else wr()}pt((mt)=>mt+1),O.preventDefault(),O.stopPropagation()};_i(()=>{if(!h||!tr)return;if(ke.current){ke.current=!1;return}Lp(q.current)},[tr,h]),_i(()=>{let O=F.current;switch(qZ({hasRenderedInput:O!=null,previousRenamingPath:ge.current,renamingPath:jn})){case"reset":ge.current=null;return;case"reveal-canonical":if(jn!=null)Lr(jn,{restoreTreeFocus:!1,targetOffset:"live-overlay"});return;case"ignore":return;case"focus-input":if(O!=null)Ei.current=null,ge.current=jn,Lp(O),O.select();return}},[_a.end,_a.start,jn,Lr,Go]),_i(()=>{let O=M.current;if(O==null)return;let he=null,Ze=()=>{if(he==null)return;clearTimeout(he),he=null},De=()=>{let rn=Ah(O)?.dataset.itemPath??null;Vt((nt)=>nt===rn?nt:rn)},$e=()=>{Ze(),V.current=!0,De()},Xe=(rn)=>{let nt=rn.relatedTarget;if(nt==null){Ze(),he=setTimeout(()=>{if(he=null,Ah(O)!=null){De();return}V.current=!1,Vt(null)},0);return}if(!(nt instanceof Node)||!O.contains(nt)){Ze(),V.current=!1,Vt(null);return}let Kt=nt instanceof HTMLElement?nt.dataset.itemPath??null:null;Vt((on)=>on===Kt?on:Kt)};return O.addEventListener("focusin",$e),O.addEventListener("focusout",Xe),()=>{Ze(),O.removeEventListener("focusin",$e),O.removeEventListener("focusout",Xe)}},[]),_i(()=>{let O=M.current;if(O==null)return;if(un.physical.scrollTop<=0)O.dataset.scrollAtTop="true";else delete O.dataset.scrollAtTop},[un.physical.scrollTop]),_i(()=>{let O=null,he=P.current,Ze=D.current,De=M.current;if(he==null)return;ne.current=NA(he,v);let $e=()=>{let fe=t.getVisibleCount(),Ge=NS(ne.current,v),rt=Math.max(0,fe*d-Ge);if(he.scrollTop>rt)he.scrollTop=rt;We(zS({controller:t,itemHeight:d,overscan:p,scrollTop:Math.min(he.scrollTop,rt),stickyFolders:_,viewportHeight:Ge}))};if(!ce.current){ce.current=!0;let fe=t.getFocusedIndex();if(fe>=0){let Ge=NS(ne.current,v),rt=t.getVisibleRows(fe,fe)[0]??null;MS(he,fe,d,Ge,_&&rt!=null?Math.max(0,Math.min(rt.ancestorPaths.length*d,Math.max(0,Ge-d))):0)}}ye.current=$e;let Xe=t.subscribe(()=>{if(MZ(Je))pt((fe)=>fe+1);$e()}),rn=()=>{if(Qi.current===!0)return;if(Ze!=null)Ze.dataset.isScrolling??="";if(De!=null)De.dataset.isScrolling??="";if(I.current=!0,O!=null)clearTimeout(O);O=setTimeout(()=>{if(Ze!=null)delete Ze.dataset.isScrolling;if(De!=null)delete De.dataset.isScrolling;I.current=!1,Qs((fe)=>fe+1),O=null},50)},nt=null,Kt=()=>{if(De!=null)delete De.dataset.overlayReveal;if(nt!=null)clearTimeout(nt),nt=null},on=()=>{if(De==null||Qi.current===!0)return;if(he.scrollTop>0)return;if(De.dataset.overlayReveal="true",nt!=null)clearTimeout(nt);nt=setTimeout(()=>{Kt()},200)},L=()=>{if($e(),he.scrollTop>0)Kt();if(zn.current!=null&&I.current)zo.current();if(Qi.current===!0){I.current=!1;return}Mn((fe)=>fe==null?fe:null),rn()},j=()=>{rn(),on()},K=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"," ","Spacebar"]),ie=(fe)=>{if(!K.has(fe.key))return;j()};he.addEventListener("scroll",L,{passive:!0}),he.addEventListener("wheel",j,{passive:!0}),he.addEventListener("touchmove",j,{passive:!0}),he.addEventListener("keydown",ie);let oe=typeof ResizeObserver<"u"?new ResizeObserver((fe)=>{ne.current=(fe[0]==null?null:$Z(fe[0]))??NA(he,v),$e()}):null;return oe?.observe(he),()=>{if(ye.current=()=>{},Xe(),he.removeEventListener("scroll",L),he.removeEventListener("wheel",j),he.removeEventListener("touchmove",j),he.removeEventListener("keydown",ie),O!=null)clearTimeout(O);if(nt!=null)clearTimeout(nt);if(Ze!=null)delete Ze.dataset.isScrolling;if(De!=null)delete De.dataset.isScrolling,delete De.dataset.overlayReveal;I.current=!1,ne.current=null,oe?.disconnect()}},[t,v,d,p,_]),_i(()=>{if(In||Tt==null)return;ua(!1)},[ua,In,Tt]);let an=Bl(()=>Tt==null?null:`${Tt.path}::${Tt.source}`,[Tt]);_i(()=>{if(an==null){C?.clearSlotContent(Ep);return}let O=zn.current;if(O==null)return;let he=E.current??B.current;if(he==null)return;let Ze={anchorElement:he,anchorRect:O.anchorRect??Ohe(he.getBoundingClientRect()),close:($e)=>{zo.current($e?.restoreFocus??!0)},restoreFocus:()=>{if(!Tn.current)return;Ss.current(zn.current?.path??null)}},De=e?.contextMenu?.render?.(O.item,Ze)??null;return C?.setSlotContent(Ep,De),e?.contextMenu?.onOpen?.(O.item,Ze),mY(De),queueMicrotask(()=>{if(De==null||!De.isConnected)return;if(document.activeElement!==De)return;mY(De)}),()=>{C?.clearSlotContent(Ep)}},[an,e?.contextMenu,C]),_i(()=>{if(Tt!=null&&t.getItem(Tt.path)==null)ua()},[ua,Tt,t]),_i(()=>{if(Tt==null)return;let O=M.current?.getRootNode(),he=O instanceof ShadowRoot?O.host:M.current,Ze=($e)=>{let Xe=$e.target;if(!(Xe instanceof Node))return;if(sY($e))return;if(B.current?.contains(Xe)===!0)return;if(he?.contains(Xe)===!0)return;ua()},De=($e)=>{if($e.key==="Escape")$e.preventDefault(),$e.stopPropagation(),ua()};return document.addEventListener("mousedown",Ze,!0),document.addEventListener("keydown",De,!0),()=>{document.removeEventListener("mousedown",Ze,!0),document.removeEventListener("keydown",De,!0)}},[ua,Tt]),_i(()=>{let O=P.current,he=M.current;if(O==null||he==null){se.current=wt;return}let Ze=wt==null?null:W.current.get(wt)??null,De=Ah(he),$e=De?.dataset.itemPath??null,Xe=xc&&F.current===De,rn=h&&q.current===De,nt=Ce.current&&!tr,Kt=U.current??0,on=Ei.current,L=ca.current,j=Xa.current,K=yr.current,ie=De!=null,oe=V.current||ie,fe=se.current!==wt,Ge=L!=null&&L===wt&&wt!=null,rt=!1,Xt=!1;if(uo!=null&&uo.id!==re.current){re.current=uo.id;let sg=uo.visibleIndex,qp=t.getVisibleRows(sg,sg)[0]??null;if(qp!=null){let Wo=_?Math.max(0,Math.min(qp.ancestorPaths.length*d,Math.max(0,wn-d))):va;rt=!0,Xt=PZ(O,sg,d,wn,da,uo.offset,Wo)}t.clearScrollRequest(uo.id)}let Hn=!rt&&nt&&MA(O,$t,d,wn,da,Kt),mt=!rt&&on!=null&&on===wt&&MA(O,$t,d,wn,da,va),Pn=!rt&&j!=null&&j.path===wt&&MA(O,$t,d,wn,da,j.viewportOffset),Ms=!rt&&K!=null&&K.path===wt&&O.scrollTop!==K.scrollTop;if(Ms)O.scrollTop=K.scrollTop;if(Ms||Xt||mt||Pn||Hn||oe&&fe&&on!==wt&&!Ge&&MS(O,$t,d,wn,va))ye.current();if(rt){se.current=wt;return}if(!oe){se.current=wt;return}if(Xe){se.current=wt;return}if(rn&&!nt){se.current=wt;return}if(Ze==null){if(nt&&$t>=0)MA(O,$t,d,wn,da,Kt),ye.current();se.current=wt;return}if(fe||nt||on===wt||L===wt||j?.path===wt||K?.path===wt||$e==null||$e!==wt){if(Lp(Ze),on===wt)Ei.current=null;if(L===wt)ca.current=null;if(j?.path===wt)Xa.current=null;if(K?.path===wt)yr.current=null;Ce.current=!1,U.current=null}se.current=wt},[t,$t,wt,Dl,d,xc,tr,_a,wn,h,uo,_,va,da,Pa]);let Ic=$t>=0&&$t>=un.visible.startIndex&&$t<=un.visible.endIndex,Sl=wt!=null&&pn.some((O)=>$A(O.row)===wt),qa=Ic||Sl,ig=Ta&&V.current===!0&&qa?wt:null,Ho=ei==="pointer"?Oe:null,go=Tt?.path??Ii.current??Ho??ig??Oe,fo=Tt?.source==="right-click";_i(()=>{if(I.current&&Tt==null)return;Fr(lo(go))},[Tt,lo,_a,wn,Va,pn,go,Fr,Pa]);let Ns=fr((O)=>{if(I.current)return;if(sY(O))return;let he=O.target;if(!(he instanceof HTMLElement))return;if(he.closest?.('[data-type="context-menu-trigger"]')!=null)return;let Ze=he.closest?.('[data-file-tree-sticky-row="true"]'),De=he.closest?.('[data-type="item"]'),$e=Ze instanceof HTMLElement?Ze.dataset.fileTreeStickyPath??null:De instanceof HTMLElement?De.dataset.itemPath??null:null;if($e!=null)Ja((Xe)=>Xe==="pointer"?Xe:"pointer");Mn((Xe)=>Xe===$e?Xe:$e)},[]),Uo=fr(()=>{Mn(null)},[]);_i(()=>{if(!Ca)return;let O=()=>{Ec(),t.cancelDrag()};return window.addEventListener("dragend",O),()=>{window.removeEventListener("dragend",O),Ec(),t.cancelDrag()}},[t,Ca]);let Fl=(O)=>{if(!Ca||t.getDragSession()==null||Le.current)return;let he=rY(O.target instanceof HTMLElement?O.target:null);if(t.setDragTarget(he),kr(t.getDragSession()?.target??null),Oo(O.clientX,O.clientY),O.dataTransfer!=null)O.dataTransfer.dropEffect="move";O.preventDefault()},Rr=(O)=>{if(!Ca||t.getDragSession()==null||Le.current)return;let he=O.relatedTarget;if(he instanceof Node&&M.current?.contains(he)===!0)return;$n(),mo(),t.setDragTarget(null)},mu=(O)=>{if(!Ca||t.getDragSession()==null||Le.current)return;O.preventDefault(),Yn(O.clientX,O.clientY),t.completeDrag(),vt(),$n(),mo(),Ee.current=null},ai=un.window.height,bo=un.window.offsetTop,Cr=Math.min(0,wn-ai),Ll=Math.min(0,wn-ai-va),Au=ft===wt||Ce.current,Ri=wt!=null&&Au&&!Dl&&$t>=0?Pa[$t]??t.getVisibleRows($t,$t)[0]??null:null,gu=Ri==null?null:jS($t,d,_a,ai),ri=Ee.current,og=Po!=null&&ri!=null&&ri.path===Po&&ri.index>=_a.start&&ri.index<=_a.end,Zo=Po!=null&&ri!=null&&ri.path===Po&&!og&&ri.path!==Ri?.path?ri:null,Yo=Zo==null?null:jS(Zo.index,d,_a,ai),fu=qhe(($t>=0?Pa[$t]??t.getVisibleRows($t,$t)[0]??null:null)?.ancestorPaths.at(-1)??null),$p=tr&&wt!=null?fY(l,wt,!Dl):void 0,Rl=Tt?.path??(tr?wt:ft),Nl=Tt?.path??Oe,Ko=lo(go),Ml=In&&Ta&&!fo&&!xc&&Ko!=null&&bt!=null&&go!=null,ho=In&&(Ml||Tt!=null),ii=Tt?.anchorRect,_r=ii==null&&Ko!=null&&bt!=null&&(Tt!=null||Ml)?bt:null,Pp=ii!=null?{left:`${ii.left}px`,position:"fixed",right:"auto",top:`${ii.top}px`}:_r!=null?{top:`${_r}px`}:void 0,bu=fo?{opacity:"0"}:void 0,vr=fr((O,he,Ze,De)=>{let $e=OZ({event:{ctrlKey:O.ctrlKey,metaKey:O.metaKey,shiftKey:O.shiftKey},isDirectory:he.kind==="directory",isSearchOpen:tr,mode:De}),Xe=$e.toggleDirectory&&he.kind==="directory",rn=Xe?t.resolveMountedDirectoryPathFromInput(Ze):null;if(Xe&&rn==null)return;let nt=rn??Ze;switch($e.selection.kind){case"range":t.selectPathRange(nt,$e.selection.additive);break;case"toggle":t.togglePathSelectionFromInput(nt);break;case"single":t.selectOnlyMountedPathFromInput(nt);break}let Kt=O.currentTarget instanceof HTMLElement?O.currentTarget:null,on=he.index>=un.visible.startIndex&&he.index<=un.visible.endIndex,L=De==="flow"&&on&&Kt!=null&&Kt.dataset.itemParked!=="true";if(t.focusMountedPathFromInput(nt),L)V.current=!0,Vt((j)=>j===nt?j:nt),Ja("focus");if(Xe)t.toggleMountedDirectoryFromInput(nt);if($e.closeSearch)t.closeSearch();if($e.revealCanonical)Lr(nt,{targetOffset:"sticky-parents"})},[t,tr,un.visible.endIndex,un.visible.startIndex,Lr]),yo=()=>{if(I.current)return;if(!Ta)return;if(go==null||Ko==null)return;let O=t.getItem(go);if(O==null)return;Fr(Ko),Tn.current=!0,so({anchorRect:null,item:{kind:O.isDirectory()?"directory":"file",name:Ko.getAttribute("aria-label")??go,path:O.getPath()},path:O.getPath(),source:"button"})},On={contextHoverPath:Nl,contextMenuButtonTriggerEnabled:Ta,contextMenuButtonVisibility:Di,contextMenuEnabled:In,contextMenuRightClickEnabled:co,contextMenuTriggerMode:ti,controller:t,directoriesWithGitChanges:o,dragAndDropEnabled:Ca,draggedPathSet:rg,dragTarget:uu,gitLaneActive:yt,gitStatusByPath:n,handleRowDragEnd:pu,handleRowDragStart:ni,handleRowTouchStart:Rs,ignoredGitDirectories:r,ignoredInheritanceCache:Ke,instanceId:l,itemHeight:d,onKeyDown:Ao,onRowClick:vr,openContextMenuForRow:Ba,registerButton:er,registerRenameInput:du,renameView:Si,renderDecorationForRow:Ds,resolveIcon:Dr,shouldSuppressContextMenu:Fs,visualFocusPath:Rl},oi={...On,registerButton:na};return Ne("div",{ref:M,id:Ql,"data-file-tree-context-menu-button-visibility":In&&Ta?Di:void 0,"data-file-tree-context-menu-trigger-mode":In?ti:void 0,"data-file-tree-has-context-menu-action-lane":In&&Ta?"true":void 0,"data-file-tree-has-git-lane":yt?"true":void 0,"data-file-tree-virtualized-root":"true",onDragLeave:Ca?Rr:void 0,onDragOver:Ca?Fl:void 0,onDrop:Ca?mu:void 0,onKeyDown:Ao,onPointerLeave:In?Uo:void 0,onPointerOver:In?Ns:void 0,role:"tree",tabIndex:-1,style:{outline:"none",position:"relative"},children:[Ne("style",{"data-file-tree-guide-style":"true",dangerouslySetInnerHTML:{__html:fu}}),Ne("slot",{name:xp,"data-type":"header-slot"}),h?Ne("div",{"data-file-tree-search-container":!0,"data-open":tr?"true":"false",children:Ne("input",{ref:q,"aria-activedescendant":$p,"aria-controls":Ql,placeholder:"Search…","data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Qe?"true":void 0,value:ag,onBlur:()=>{if(b==="retain"&&!it.current)return;t.closeSearch()},onFocus:tt,onPointerDown:tt,onInput:(O)=>{tt();let he=O.currentTarget;t.setSearch(he.value)}})}):null,Ne("div",{ref:P,"data-file-tree-virtualized-scroll":"true",children:[_&&la&&pn.length>0?Ne("div",{"aria-hidden":"true","data-file-tree-sticky-overlay":"true",children:Ne("div",{"data-file-tree-sticky-overlay-content":"true",style:{height:`${$a}px`},children:pn.map((O,he)=>U_(oi,O.row,`sticky:${$A(O.row)}`,{mode:"sticky",style:{left:"0",position:"absolute",right:"0",top:`${O.top}px`,zIndex:`${pn.length-he}`}}))})}):null,Ne("div",{ref:D,"data-file-tree-virtualized-list":"true",style:{height:`${da}px`},children:[Ne("div",{"data-file-tree-virtualized-sticky-offset":"true","aria-hidden":"true",style:{height:`${bo}px`}}),Ne("div",{"data-file-tree-virtualized-sticky":"true",style:{height:`${ai}px`,top:`${Cr}px`,bottom:`${Ll}px`},children:[Vhe(On,_a,Go),Ri!=null&&gu!=null?U_(On,Ri,`parked:${Ri.path}`,{isParked:!0,style:{left:"0",opacity:"0",pointerEvents:Po===Ri.path?"none":void 0,position:"absolute",right:"0",top:`${gu}px`}}):null,Zo!=null&&Yo!=null?U_(On,Zo,`parked-drag:${Zo.path}`,{isParked:!0,style:{left:"0",opacity:"0",pointerEvents:"none",position:"absolute",right:"0",top:`${Yo}px`}}):null]})]})]}),In?Ne("div",{ref:B,"data-type":"context-menu-anchor","data-visible":ho?"true":"false",style:Pp,children:[Ne("button",{ref:E,type:"button","data-type":cH,"aria-label":"Options","aria-haspopup":"menu","aria-expanded":Tt!=null?"true":"false","data-visible":Ml?"true":"false",onMouseDown:(O)=>{O.preventDefault()},onClick:(O)=>{if(O.preventDefault(),O.stopPropagation(),Tt!=null){ua();return}yo()},tabIndex:-1,style:bu,children:Ne(RA,{...Dr("file-tree-icon-ellipsis")})}),Tt!=null?Ne("slot",{name:Ep}):null]}):null,Tt!=null?Ne("div",{"data-type":"context-menu-wash","aria-hidden":"true",onMouseDownCapture:(O)=>{O.preventDefault(),ua()},onTouchStartCapture:(O)=>{O.preventDefault(),O.stopPropagation(),ua()},onTouchMoveCapture:(O)=>{O.preventDefault(),O.stopPropagation()},onWheelCapture:(O)=>{O.preventDefault(),O.stopPropagation()}}):null]})}var US={hydrateRoot:(e,t)=>{vZ(LA(HS,t),e)},renderRoot:(e,t)=>{z_(LA(HS,t),e)},unmountRoot:(e)=>{z_(null,e)}};function PA(e,t){US.renderRoot(e,t)}function bY(e,t){US.hydrateRoot(e,t)}function hY(e){US.unmountRoot(e)}var yY=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#c(e);if(t==null)return;t.remove(),this.#e.delete(e)}setHost(e){if(this.#t=e,e==null)return;this.#r(e);for(let[t,n]of this.#e)this.#o(t,n)}setSlotContent(e,t){let n=this.#c(e);if(n===t){if(t!=null)this.#e.set(e,t),this.#o(e,t);return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#o(e,t)}setSlotHtml(e,t){let n=t?.trim()??"";if(n.length===0){this.setSlotContent(e,null);return}let r=this.#c(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#o(e,r);return}let o=document.createElement("div");o.innerHTML=n,this.setSlotContent(e,o)}#c(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let r of Array.from(n.children)){if(!(r instanceof HTMLElement))continue;if(r.dataset.fileTreeManagedSlot===e)return r}return null}#o(e,t){if(t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t)this.#t.appendChild(t)}#r(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let n=t.dataset.fileTreeManagedSlot;if(n==null||this.#e.has(n))continue;this.#e.set(n,t)}}};var wY=0;function Xhe(e){if(e!=null&&e.length>0)return e;return wY+=1,`pst_ft_${wY}`}function eye({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??k_)}function kY(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 CY(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 _Y(e){return Array.from(e.children).filter((t)=>t instanceof SVGElement)}var vY=class{static LoadedCustomComponent=!0;#e;#t;#c;#o;#r;#I;#P;#b;#a;#h=new yY;#Q;#y;#g;#p;#w;#k;#m;#q;#G;#N=null;#i;#z=!1;#O=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:o,id:c,initialSearchQuery:l,icons:d,itemHeight:p,onSearchChange:A,onSelectionChange:f,overscan:b,renderRowDecoration:h,renaming:w,search:C,searchBlurBehavior:_,searchFakeFocus:v,stickyFolders:B,unsafeCSS:E,initialVisibleRowCount:I,...D}=e;this.#e=t,this.#c=Xhe(c),this.#p=kS(o),this.#w=d,this.#k=E,this.#o=f,this.#r=h,this.#I=w!=null&&w!==!1,this.#P=_,this.#b=C===!0,this.#a=v===!0,this.#Q=bH(n,p),this.#y={itemHeight:this.#Q.itemHeight,overscan:b,stickyFolders:B,initialVisibleRowCount:I},this.#t=new tZ({...D,fileTreeSearchMode:r,initialSearchQuery:l,onSearchChange:A,renaming:w}),this.#G=this.#t.getSelectionVersion(),this.#N=this.#o==null?null:this.subscribe(()=>{this.#S()})}unmount(){if(this.#i!=null)hY(this.#i),delete this.#i.dataset.fileTreeVirtualizedWrapper,this.#i=void 0;if(this.#h.clearAll(),this.#h.setHost(null),this.#g!=null)delete this.#g.dataset.fileTreeVirtualized,this.#j(this.#g),this.#g=void 0}cleanUp(){this.unmount(),this.#N?.(),this.#N=null,this.#t.destroy()}getFileTreeContainer(){return this.#g}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#Q.itemHeight}getDensityFactor(){return this.#Q.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){let t=iZ(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#l();if(n==null)return;PA(n.wrapper,this.#D())}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){if(Array.isArray(e))this.#t.resetPaths(e,t);else this.#t.resetPaths(e)}setComposition(e){this.#e=e;let t=this.#l();if(t==null)return;this.#B(),PA(t.wrapper,this.#D())}setGitStatus(e){let t=kS(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#l();if(n==null)return;PA(n.wrapper,this.#D())}setIcons(e){this.#w=e;let t=this.#l();if(t==null)return;this.#f(t.host,t.wrapper),PA(t.wrapper,this.#D())}hydrate({fileTreeContainer:e}){let t=this.#L(e),n=this.#M(t);this.#B(),bY(n,this.#D())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#L(t??this.#g,e),r=this.#M(n);this.#B(),PA(r,this.#D())}#V(){return{initialViewportHeight:eye({initialVisibleRowCount:this.#y.initialVisibleRowCount,itemHeight:this.#y.itemHeight}),itemHeight:this.#y.itemHeight,overscan:this.#y.overscan,stickyFolders:this.#y.stickyFolders}}#D(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#w,instanceId:this.#c,renamingEnabled:this.#I,renderRowDecoration:this.#r,searchBlurBehavior:this.#P,searchEnabled:this.#b,searchFakeFocus:this.#a,slotHost:this.#h,...this.#V()}}#l(){let e=this.#g,t=this.#i;if(e==null||t==null)return null;return{host:e,wrapper:t}}#f(e,t){let n=e.shadowRoot;if(n!=null)this.#H(n),this.#U(n);this.#Z(t)}#S(){let e=this.#o;if(e==null)return;let t=this.#t.getSelectionVersion();if(t===this.#G)return;this.#G=t,e(this.#t.getSelectedPaths())}#B(){let e=this.#e?.header?.render;if(e!=null){this.#h.setSlotContent(xp,e());return}this.#h.setSlotHtml(xp,this.#e?.header?.html??null)}#H(e){let t=_Y(e).find((r)=>CY(r)),n=kY(mH(vA(this.#w).set));if(n==null)return;if(t!=null&&t.outerHTML===n.outerHTML)return;if(t!=null)t.replaceWith(n);else e.prepend(n)}#U(e){let t=_Y(e),n=t.find((l)=>CY(l)),r=t.filter((l)=>l!==n),o=vA(this.#w).spriteSheet?.trim()??"";if(o.length===0){for(let l of r)l.remove();return}let c=kY(o);if(c==null){for(let l of r)l.remove();return}if(r.length===1&&r[0].outerHTML===c.outerHTML)return;for(let l of r)l.remove();e.appendChild(c)}#Z(e){let t=vA(this.#w);if(t.colored&&gH(t.set))e.dataset.fileTreeColoredIcons="true";else delete e.dataset.fileTreeColoredIcons}#d(e){let t=e.querySelector(`style[${Z2}]`);if(this.#m==null&&t instanceof HTMLStyleElement)this.#m=t;if(this.#k==null||this.#k===""){this.#m?.remove(),this.#m=void 0,this.#q=void 0;return}if(this.#m?.parentNode===e&&this.#q===this.#k)return;if(this.#m??=document.createElement("style"),this.#m.setAttribute(Z2,""),this.#m.parentNode!==e)e.appendChild(this.#m);this.#m.textContent=hH(this.#k),this.#q=this.#k}#M(e){if(this.#i!=null)return this.#i;let t=e.shadowRoot;if(t==null)throw Error("FileTree requires a shadow root");let n=Array.from(t.children).filter((o)=>o instanceof HTMLDivElement&&typeof o.dataset.fileTreeId==="string"&&o.dataset.fileTreeId.length>0),r=n.find((o)=>o.dataset.fileTreeId===this.#c)??n[0];if(r!=null)this.#c=r.dataset.fileTreeId??this.#c;if(this.#i=r??document.createElement("div"),this.#i.dataset.fileTreeId=this.#c,this.#i.dataset.fileTreeVirtualizedWrapper="true",this.#f(e,this.#i),this.#i.parentNode!==t)t.appendChild(this.#i);return this.#i}#L(e,t){let n=e??this.#g??document.createElement("file-tree-container");if(t!=null&&n.parentNode!==t)t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:"open"});return v_(n,r),this.#d(r),n.dataset.fileTreeVirtualized="true",n.style.display="flex",this.#v(n),this.#h.setHost(n),this.#g=n,n}#v(e){if(e.style.getPropertyValue("--trees-item-height")==="")e.style.setProperty("--trees-item-height",`${String(this.#Q.itemHeight)}px`),this.#z=!0;if(e.style.getPropertyValue("--trees-density-override")==="")e.style.setProperty("--trees-density-override",String(this.#Q.factor)),this.#O=!0}#j(e){if(this.#z)e.style.removeProperty("--trees-item-height"),this.#z=!1;if(this.#O)e.style.removeProperty("--trees-density-override"),this.#O=!1}};var qA=jt(cr(),1);function ZS(e){let[t]=qA.useState(()=>new vY(e)),n=qA.useRef({timeout:null,model:t});return qA.useEffect(()=>{let{current:r}=n;if(r.timeout!=null)clearTimeout(r.timeout),r.timeout=null;return()=>{r.timeout=setTimeout(()=>r.model.cleanUp(),1)}},[]),{model:t}}var K_=jt(cr(),1);var Z_=(...e)=>e.filter((t,n,r)=>Boolean(t)&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();var BY=(e)=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var xY=(e)=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());var YS=(e)=>{let t=xY(e);return t.charAt(0).toUpperCase()+t.slice(1)};var fh=jt(cr(),1);var Y_={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var EY=(e)=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var GA=jt(cr(),1),tye=GA.createContext({});var IY=()=>GA.useContext(tye);var QY=fh.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:o="",children:c,iconNode:l,...d},p)=>{let{size:A=24,strokeWidth:f=2,absoluteStrokeWidth:b=!1,color:h="currentColor",className:w=""}=IY()??{},C=r??b?Number(n??f)*24/Number(t??A):n??f;return fh.createElement("svg",{ref:p,...Y_,width:t??A??Y_.width,height:t??A??Y_.height,stroke:e??h,strokeWidth:C,className:Z_("lucide",w,o),...!c&&!EY(d)&&{"aria-hidden":"true"},...d},[...l.map(([_,v])=>fh.createElement(_,v)),...Array.isArray(c)?c:[c]])});var It=(e,t)=>{let n=K_.forwardRef(({className:r,...o},c)=>K_.createElement(QY,{ref:c,iconNode:t,className:Z_(`lucide-${BY(YS(e))}`,`lucide-${e}`,r),...o}));return n.displayName=YS(e),n};var nye=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],eu=It("columns-2",nye);var aye=[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]],tu=It("text-wrap",aye);var rye=[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]],bh=It("app-window",rye);var iye=[["path",{d:"M12 6V2H8",key:"1155em"}],["path",{d:"M15 11v2",key:"i11awn"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 16a2 2 0 0 1-2 2H8.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 4 20.286V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2z",key:"11gyqh"}],["path",{d:"M9 11v2",key:"1ueba0"}]],hh=It("bot-message-square",iye);var oye=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],yh=It("check",oye);var sye=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],zA=It("chevron-down",sye);var cye=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],wh=It("chevron-left",cye);var lye=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],OA=It("chevron-right",lye);var dye=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],kh=It("copy",dye);var uye=[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}],["path",{d:"M3 16v5h5",key:"1t08am"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 8V3h5",key:"1ln10m"}],["path",{d:"M9 9 3 3",key:"v551iv"}]],Ch=It("expand",uye);var pye=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],_h=It("folder-tree",pye);var mye=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],HA=It("folder",mye);var Aye=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],UA=It("git-branch",Aye);var gye=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],vh=It("layout-dashboard",gye);var fye=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],Bh=It("list-ordered",fye);var bye=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],xh=It("message-square",bye);var hye=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Eh=It("rotate-cw",hye);var yye=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ih=It("search",yye);var wye=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Qh=It("settings",wye);var kye=[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]],Dh=It("shrink",kye);var Cye=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Sh=It("upload",Cye);var Y=jt(cr(),1),cW=jt(Ww(),1);var DY={name:"reviewme",version:"0.0.6",license:"Apache-2.0",description:"A local, browser-based Git branch review tool with inline comments and Codex threads.",type:"module",bin:{reviewme:"bin/reviewme.mjs"},files:["bin","dist/frontend","dist/server","examples/themes","LICENSE","README.md","THIRD_PARTY_NOTICES.md"],engines:{node:">=22.13"},publishConfig:{access:"public"},scripts:{clean:"node scripts/clean-dist.mjs",dev:"npm run build && node ./bin/reviewme.mjs","build:frontend":"bun build ./src/frontend/index.html ./node_modules/@pierre/diffs/dist/worker/worker.js --outdir ./dist/frontend --entry-naming '[name].[ext]' --chunk-naming 'chunks/[name]-[hash].[ext]' --asset-naming 'assets/[name]-[hash].[ext]' --minify","build:server":"bun build ./src/server/main.ts --target=node --outdir=./dist/server --entry-naming=main.js --minify --sourcemap=linked",build:"npm run clean && npm run build:frontend && npm run build:server",prepack:"npm run build",start:"./bin/reviewme.mjs",test:"bun test",typecheck:"tsc --noEmit"},devDependencies:{"@pierre/diffs":"^1.3.6","@pierre/trees":"^1.0.0-beta.6","@types/react":"^19.2.2","@types/react-dom":"^19.2.2","bun-types":"^1.3.14","lucide-react":"^1.35.0",react:"^19.2.8","react-dom":"^19.2.8",typescript:"^5.9.3",yaml:"^2.9.0"}};function W_(e){if(e==null||typeof e!=="object")return null;let t=e,n=typeof t.path==="string"?t.path:void 0;if(n==null||n.length===0)return null;let r=t.kind==="file"||t.kind==="diff_range"?t.kind:t.startLine!=null||t.endLine!=null?"diff_range":"file",o=t.side==="old"||t.side==="new"?t.side:void 0,c=SY(t.startLine),l=SY(t.endLine);if(r==="diff_range"&&(c==null||l==null||o==null))return null;return{id:typeof t.id==="string"?t.id:void 0,kind:r,path:n,side:o,startLine:c,endLine:l,contextHash:typeof t.contextHash==="string"?t.contextHash:void 0}}function KS(e){if(e==null||typeof e!=="object")return null;let t=e,n=typeof t.id==="string"?t.id:void 0,r=typeof t.body==="string"?t.body:typeof t.message==="string"?t.message:void 0,o=W_(t.anchor??t);if(n==null||r==null||o==null)return null;let c=t.agentSession??t.agent,l=J_(c);return{id:n,snapshotId:typeof t.snapshotId==="string"?t.snapshotId:void 0,anchor:o,body:r,createdAt:typeof t.createdAt==="string"?t.createdAt:void 0,updatedAt:typeof t.updatedAt==="string"?t.updatedAt:void 0,agentSession:l}}function WS(e){if(e==null||typeof e!=="object")return null;let t=e,n=typeof t.id==="string"?t.id:void 0,r=typeof t.body==="string"?t.body:typeof t.message==="string"?t.message:void 0,o=W_(t.anchor??t);if(n==null||r==null||o==null)return null;return{id:n,snapshotId:typeof t.snapshotId==="string"?t.snapshotId:void 0,anchor:o,body:r,updatedAt:typeof t.updatedAt==="string"?t.updatedAt:void 0}}function J_(e){if(e==null||typeof e!=="object")return null;let t=e;if(typeof t.id!=="string")return null;return{id:t.id,provider:typeof t.provider==="string"?t.provider:"codex",externalThreadId:typeof t.externalThreadId==="string"?t.externalThreadId:typeof t.threadId==="string"?t.threadId:null,model:typeof t.model==="string"?t.model:null,effort:typeof t.effort==="string"?t.effort:typeof t.reasoningEffort==="string"?t.reasoningEffort:null,permissionMode:typeof t.permissionMode==="string"?t.permissionMode:"read-only",status:typeof t.status==="string"?t.status:"idle"}}function FY(e){if(e==null||typeof e!=="object")return{models:[]};let t=e,r=(Array.isArray(t.models)?t.models:[]).flatMap((l)=>{let d=vye(l);return d==null?[]:[d]}),c=(Array.isArray(t.efforts)?t.efforts:[]).flatMap((l)=>{let d=LY(l);return d==null?[]:[d]});return{models:r,defaultModel:typeof t.defaultModel==="string"?t.defaultModel:void 0,defaultEffort:typeof t.defaultEffort==="string"?t.defaultEffort:void 0,efforts:c}}function vye(e){if(typeof e==="string")return{id:e,label:e};if(e==null||typeof e!=="object")return null;let t=e,n=typeof t.id==="string"?t.id:typeof t.slug==="string"?t.slug:void 0;if(n==null)return null;let r=Array.isArray(t.reasoningEfforts)?t.reasoningEfforts:Array.isArray(t.supportedReasoningEfforts)?t.supportedReasoningEfforts:Array.isArray(t.efforts)?t.efforts:[];return{id:n,label:typeof t.label==="string"?t.label:typeof t.displayName==="string"?t.displayName:n,description:typeof t.description==="string"?t.description:void 0,default:t.default===!0||t.isDefault===!0,defaultReasoningEffort:typeof t.defaultReasoningEffort==="string"?t.defaultReasoningEffort:typeof t.default_reasoning_effort==="string"?t.default_reasoning_effort:void 0,reasoningEfforts:r.flatMap((o)=>{let c=LY(o);return c==null?[]:[c]})}}function LY(e){if(typeof e==="string")return{id:e,label:e};if(e==null||typeof e!=="object")return null;let t=e,n=typeof t.id==="string"?t.id:typeof t.value==="string"?t.value:void 0;if(n==null)return null;return{id:n,label:typeof t.label==="string"?t.label:n,description:typeof t.description==="string"?t.description:void 0,default:t.default===!0}}function SY(e){if(typeof e!=="number"||!Number.isInteger(e)||e<1)return;return e}function RY(){if(typeof window>"u")return;let e=new URLSearchParams(window.location.search).get("token");if(e!=null&&e.trim()!=="")return e;return document.querySelector('meta[name="reviewme-token"]')?.getAttribute("content")?.trim()||void 0}function Bye(){if(typeof window>"u")return"";return document.querySelector('meta[name="reviewme-api"]')?.getAttribute("content")?.replace(/\/$/,"")||""}function br(e){let t=new Headers(e);t.set("Accept","application/json");let n=RY();if(n!=null)t.set("Authorization",`Bearer ${n}`);return t}async function Nn(e){if(!e.ok){let n=(await e.text()).trim();throw Error(n.length>0?n:`ReviewMe request failed (${e.status}).`)}if((e.headers.get("content-type")??"").includes("application/json"))return await e.json();return{patch:await e.text()}}function yn(e,t){let r=`${Bye()}${e}`;return t==null||t.size===0?r:`${r}?${t.toString()}`}function ys(e,t){return{method:e,headers:br({"Content-Type":"application/json"}),body:JSON.stringify(t),cache:"no-store"}}function xye(e){return{method:"PATCH",headers:br({"Content-Type":"application/json"}),body:JSON.stringify(e),cache:"no-store"}}function nu(e){let t=new URLSearchParams;if(e==null)return t;if(t.set("from",e.from),t.set("to",e.to),t.set("mode",e.mode),e.includeUnstaged===!0)t.set("includeUnstaged","true");return t}function hc(e){if(e==null)return{};return{from:e.from,to:e.to,mode:e.mode,includeUnstaged:e.includeUnstaged===!0}}function JS(e,t){if(Array.isArray(e))return e;if(ws(e)&&Array.isArray(e[t]))return e[t];return[]}function Eye(e){let t=ws(e)?e:{},n=t.reviewedPaths??t.reviewed??t.files,r=Array.isArray(n)?n.flatMap((d)=>{if(typeof d==="string")return[d];if(ws(d)&&typeof d.path==="string"&&d.reviewed!==!1)return[d.path];return[]}):[],o=JS(e,"threads").concat(Array.isArray(t.comments)?t.comments:[]).flatMap((d)=>{let p=KS(d);return p==null?[]:[p]}),c=JS(e,"drafts").flatMap((d)=>{let p=WS(d);return p==null?[]:[p]}),l=JS(e,"agentConversations").flatMap(NY);return{snapshotId:typeof t.snapshotId==="string"?t.snapshotId:void 0,reviewedPaths:[...new Set(r)],threads:VS(o),drafts:VS(c),agentConversations:VS(l)}}function NY(e){let t=J_(e);if(t==null||!ws(e))return[];let n=Array.isArray(e.contexts)?e.contexts.flatMap((r)=>{if(!ws(r)||typeof r.id!=="string"||typeof r.prompt!=="string")return[];let o=W_(r.anchor);if(o==null)return[];return[{id:r.id,sourceThreadId:typeof r.sourceThreadId==="string"?r.sourceThreadId:null,anchor:o,prompt:r.prompt,createdAt:typeof r.createdAt==="string"?r.createdAt:void 0}]}):[];return[{...t,contexts:n}]}function VS(e){let t=new Set,n=[];for(let r of e){if(t.has(r.id))continue;t.add(r.id),n.push(r)}return n}class MY{async getAppSettings(){let e=await fetch(yn("/api/settings"),{headers:br(),cache:"no-store"});return Nn(e)}async setBrowserTabTitleMode(e){let t=await fetch(yn("/api/settings/browser-tab-title"),ys("PUT",{mode:e}));return Nn(t)}async setExitOnClose(e,t){let n=await fetch(yn("/api/settings/exit-on-close"),ys("PUT",{enabled:e,afterSeconds:t}));return Nn(n)}async getColorTheme(){let e=await fetch(yn("/api/theme"),{headers:br(),cache:"no-store"});return(await Nn(e)).theme}async getRepository(){let e=await fetch(yn("/api/repository"),{headers:br(),cache:"no-store"}),t=await Nn(e);return"repository"in t?t.repository:t}async listRefs(){let e=await fetch(yn("/api/refs"),{headers:br(),cache:"no-store"}),t=await Nn(e);return Array.isArray(t)?t:t.refs??[]}async listCommits(e){let t=await fetch(yn("/api/commits",nu(e)),{headers:br(),cache:"no-store"});return Nn(t)}async getDiff(e){let t=new URLSearchParams({from:e.from,to:e.to,mode:e.mode});if(e.includeUnstaged===!0)t.set("includeUnstaged","true");let n=await fetch(yn("/api/metadata",t),{headers:br(),cache:"no-store"}),r=await Nn(n);if(ws(r)&&Array.isArray(r.files)){let o=r.files.flatMap((d)=>{if(!ws(d))return[];let p=typeof d.id==="string"?d.id:void 0,A=typeof d.path==="string"?d.path:void 0;if(p==null||A==null)return[];return[{id:p,path:A,previousPath:typeof d.oldPath==="string"?d.oldPath:void 0,status:Iye(typeof d.status==="string"?d.status:"modified"),additions:typeof d.additions==="number"?d.additions:0,deletions:typeof d.deletions==="number"?d.deletions:0}]}),c=Array(o.length),l=0;return await Promise.all(Array.from({length:Math.min(8,o.length)},async()=>{while(l<o.length){let d=l++,p=o[d],A=await fetch(yn(`/api/files/${encodeURIComponent(p.id)}/diff`),{headers:br(),cache:"no-store"}),f=await Nn(A);c[d]=f.patch??""}})),{from:e.from,to:e.to,mode:e.mode,files:o,patch:c.filter(Boolean).join(`
3052
+ }`}var yH=new WeakMap;function Tfe(e){let t=yH.get(e);if(t!=null)return t;let n=document.createElement("div");n.setAttribute(oH,"true");let r=document.createElement("div");r.style.position="relative",r.style.height="200%",n.appendChild(r),e.appendChild(n);let o=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),yH.set(e,o),o}function wH(e,t){if(!e.isConnected)return;let n=Tfe(t);if(n==null)return;let r=t.querySelector(`style[${Y2}]`),o=r instanceof HTMLStyleElement?r:document.createElement("style");if(!(r instanceof HTMLStyleElement))o.setAttribute(Y2,""),t.appendChild(o);o.textContent=`:host { ${sH}: ${n}px; }`}var __;function $fe(e){if(typeof CSSStyleSheet<"u"&&typeof CSSStyleSheet.prototype.replaceSync==="function"&&"adoptedStyleSheets"in e){if(__==null)__=new CSSStyleSheet,__.replaceSync(C_(W2));let t=!1;try{e.adoptedStyleSheets=[__],t=!0}catch{}if(t){e.querySelector(`style[${y_}]`)?.remove();return}}if(e.querySelector("style[data-file-tree-style]")==null){let t=document.createElement("style");t.setAttribute(y_,""),t.textContent=C_(W2),e.prepend(t)}}function v_(e,t){Pfe(e,t),$fe(t),wH(e,t)}function Pfe(e,t){let n=e.querySelector('template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]');if(!(n instanceof HTMLTemplateElement))return;if(t.childNodes.length>0)return;if(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 t=this.shadowRoot??this.attachShadow({mode:"open"});v_(this,t)}}if(customElements.define(ah,e),typeof document<"u")for(let t of Array.from(document.querySelectorAll(ah))){if(!(t instanceof HTMLElement))continue;v_(t,t.shadowRoot??t.attachShadow({mode:"open"}))}}function Ip(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function J2(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function Zd(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let o=e[r];if(o!=null)n.set(o.nameId,r)}return t.childIdByNameId=n,n}function BA(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];if(r!=null)t.set(r,n)}return e.childPositionById=t,t}function xA(e,t){if(e.childPositionById!=null)e.childPositionById.set(t,e.childIds.length);e.childIds.push(t)}function V2(e,t){if(e.childPositionById==null)return;for(let n=t;n<e.childIds.length;n++){let r=e.childIds[n];if(r!=null)e.childPositionById.set(r,n)}}function Qp(e,t){let n=0,r=0;for(let o of t.childIds){let c=e[o];if(c==null)continue;n+=c.subtreeNodeCount,r+=c.visibleSubtreeCount}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,Yd(e,t)}function B_(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let o=BA(e).get(t);if(o===void 0)return;let c=o>>5;e.childVisibleChunkSums[c]+=r}function x_(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let c=n,l=0;for(let d of r){if(c<d){let p=qfe(e,t,l,c);return{...p,childVisibleIndex:n-p.localVisibleIndex}}c-=d,l+=32}throw Error(`Visible child index ${String(n)} is out of range`)}let o=n;for(let c=0;c<t.childIds.length;c++){let l=t.childIds[c];if(l==null)continue;let d=e[l];if(d==null)continue;if(o<d.visibleSubtreeCount)return{childIndex:c,childVisibleIndex:n-o,localVisibleIndex:o};o-=d.visibleSubtreeCount}throw Error(`Visible child index ${String(n)} is out of range`)}function kH(e,t,n){let r=0,o=t.childVisibleChunkSums,c=0;if(o!=null){let l=n>>5;for(let d=0;d<l;d+=1)r+=o[d]??0;c=l<<5}for(let l=c;l<n;l+=1){let d=t.childIds[l];if(d==null)continue;let p=e[d];if(p==null)continue;r+=p.visibleSubtreeCount}return r}function Yd(e,t){if(t.childIds.length<128){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/32),r=new Int32Array(n);for(let o=0;o<t.childIds.length;o++){let c=t.childIds[o];if(c==null)continue;let l=e[c];if(l==null)continue;r[o>>5]+=l.visibleSubtreeCount}t.childVisibleChunkSums=r}function qfe(e,t,n,r){let o=Math.min(t.childIds.length,n+32),c=r;for(let l=n;l<o;l++){let d=t.childIds[l];if(d==null)continue;let p=e[d];if(p==null)continue;if(c<p.visibleSubtreeCount)return{childIndex:l,localVisibleIndex:c};c-=p.visibleSubtreeCount}throw Error(`Visible child index ${String(r)} is out of range`)}function Zr(e,t,n=0){return e<<4|n<<3|t}function Ci(e){return e.depthAndFlags>>>4}function rh(e){return(e.depthAndFlags&8)>>3}function Ue(e){return(e.depthAndFlags&8)!==0}function CH(e){return e.depthAndFlags&7}function Rn(e,t){return(CH(e)&t)!==0}function EA(e,t){e.depthAndFlags|=t}function _H(e,t){e.depthAndFlags=Zr(t,CH(e),rh(e))}var vH=Symbol("benchmarkInstrumentation");function BH(e,t){if(t==null)return e;return Object.defineProperty(e,vH,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function ih(e){if(e==null)return null;return e[vH]??null}function qe(e,t,n){if(e==null)return n();return e.measurePhase(t,n)}function IA(e,t,n){if(!Number.isFinite(n)||e==null)return;e.setCounter(t,n)}function xH(e){return e>=48&&e<=57}function Gfe(e){let t=[],n=0,r=0;while(r<e.length){while(r<e.length&&!xH(e.charCodeAt(r)))r+=1;if(r>=e.length)break;if(r>n)t.push(e.slice(n,r));let o=0;while(r<e.length&&xH(e.charCodeAt(r)))o=o*10+(e.charCodeAt(r)-48),r+=1;t.push(o),n=r}if(n<e.length||t.length===0)t.push(e.slice(n));return t}function Dp(e){let t=e.toLowerCase();return{lowerValue:t,tokens:Gfe(t)}}function zfe(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let o=e[r],c=t[r];if(o===c)continue;if(typeof o==="number"&&typeof c==="number")return o<c?-1:1;let l=String(o),d=String(c);if(l!==d)return l<d?-1:1}if(e.length!==t.length)return e.length<t.length?-1:1;return 0}function oh(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==="string"&&typeof t.tokens[0]==="string"){if(e.lowerValue===t.lowerValue)return 0;return e.lowerValue<t.lowerValue?-1:1}let n=zfe(e.tokens,t.tokens);if(n!==0)return n;if(e.lowerValue!==t.lowerValue)return e.lowerValue<t.lowerValue?-1:1;return 0}function EH(e,t,n){let r=oh(n(e),n(t));if(r!==0)return r;if(e===t)return 0;return e<t?-1:1}function Ofe(e,t){return EH(e,t,Dp)}function E_(e,t){if(t!==e.segments.length-1)return 1;return e.isDirectory?1:0}function Hfe(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let o=e.segments[r],c=t.segments[r];if(o===c)continue;let l=E_(e,r);if(l!==E_(t,r))return l===1?-1:1;return Ofe(o,c)}if(e.segments.length!==t.segments.length)return e.segments.length<t.segments.length?-1:1;if(e.isDirectory===t.isDirectory)return 0;return e.isDirectory?-1:1}function IH(e,t){return Hfe(e,t)}function QH(e,t,n){let r=(c)=>{let l=n.get(c);if(l!=null)return l;let d=Dp(c);return n.set(c,d),d},o=Math.min(e.segments.length,t.segments.length);for(let c=0;c<o;c++){let l=e.segments[c],d=t.segments[c];if(l===d)continue;let p=E_(e,c);if(p!==E_(t,c))return p===1?-1:1;return EH(l,d,r)}if(e.segments.length!==t.segments.length)return e.segments.length<t.segments.length?-1:1;if(e.isDirectory===t.isDirectory)return 0;return e.isDirectory?-1:1}function sh(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],o=Dp(r);return e.sortKeyById[t]=o,o}function X2(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??"default"}}function DH(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],o=0;for(let c=0;c<n;c++){if(e.charCodeAt(c)!==47)continue;r.push(e.slice(o,c)),o=c+1}return r.push(e.slice(o,n)),{hasTrailingSlash:t,segments:r}}function Sp(e){let{hasTrailingSlash:t,segments:n}=DH(e);return{basename:n[n.length-1]??"",isDirectory:t,path:e,segments:n}}function I_(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=DH(e);return{requiresDirectory:t,segments:n}}function Q_(){let e=new Map;return e.set("",0),{idByValue:e,valueById:[""],sortKeyById:[Dp("")]}}function bs(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 ro(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var eS=Symbol("pathStorePreparedInputKind");function LH(e,t){return e[eS]=t,e}function SH(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function RH(e,t,n){if(n==="default")return IH(e,t);return n(SH(e),SH(t))}function Ufe(){return{depthAndFlags:Zr(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function Zfe(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 FH(e){return e.isDirectory?e.segments.length:e.segments.length-1}function Yfe(e){return Array.isArray(e)&&e.every((t)=>t!=null&&typeof t==="object"&&typeof t.path==="string"&&Array.isArray(t.segments)&&typeof t.basename==="string"&&typeof t.isDirectory==="boolean")}function Kfe(e){return Array.isArray(e)&&e.every((t)=>typeof t==="string")}function NH(e,t={}){return D_(e,t).map((n)=>n.path)}function MH(e,t={}){let n=D_(e,t);return LH({paths:n.map((r)=>r.path),preparedPaths:n},"prepared")}function jH(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let o=e[r];if(o.length>0&&o.charCodeAt(o.length-1)===47){n=!0;break}}return LH({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},"presorted")}function TH(e){let t=e,n=t.preparedPaths;if(t[eS]==="prepared"&&n!=null)return n;if(!Yfe(n))throw Error("preparedInput must come from PathStore.prepareInput()");return n}function $H(e){let t=e;if(t[eS]==="presorted"&&t.presortedPaths!=null)return t.presortedPaths;return Kfe(t.presortedPaths)?t.presortedPaths:null}function PH(e){let t=e;return typeof t.presortedPathsContainDirectories==="boolean"?t.presortedPathsContainDirectories:null}function D_(e,t={}){let n=X2(t),r=ih(t);IA(r,"workload.inputFiles",e.length);let o=qe(r,"store.preparePathEntries.parse",()=>e.map((c)=>Sp(c)));return qe(r,"store.preparePathEntries.sort",()=>o.sort((c,l)=>RH(c,l,n.sort))),o}var S_=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[Ufe()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=Q_();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=ih(e),this.options=X2(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let n=new Set,r=t.length;for(let o=0;o<r;o+=1){let c=t[o],l=c.length;n.add(l>0&&c.charCodeAt(l-1)===47?c.slice(0,l-1):c)}this.initialExpandedPathSet=n,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,Ip())}appendPaths(e){return qe(this.instrumentation,"store.builder.appendPaths.parse",()=>this.appendPreparedPaths(e.map((t)=>Sp(t))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,qe(this.instrumentation,"store.builder.appendPreparedPaths",()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return qe(this.instrumentation,"store.builder.appendPresortedPaths",()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,o=this.nodes,c=this.segmentTable,l=c.idByValue,d=c.valueById,p=this.directoryStack,A=0,f="",b=0;for(let h of e){if(n===h)throw Error(`Duplicate path: "${h}"`);let w=h.length>0&&h.charCodeAt(h.length-1)===47,C=w?h.length-1:h.length,_=0,v=0;if(n!=null)if(f.length>0&&h.length>f.length&&h.startsWith(f))_=b,v=f.length;else{let I=Math.min(C,n.length),D=!0;for(let F=0;F<I;F++){let M=h.charCodeAt(F);if(M!==n.charCodeAt(F)){D=!1;break}if(M===47)_++,v=F+1}if(D&&w&&I===C&&n.length>C&&n.charCodeAt(C)===47)_++,v=C+1}A=_,r=_;let B=v,E=h.indexOf("/",B);while(E>=0&&E<C){let I=p[A];if(I===void 0)throw Error("Directory stack underflow while building the path store");r++;let D=h.slice(B,E),F=l.get(D);if(F===void 0)F=d.length,l.set(D,F),d.push(D);let M=o.length;o.push({depthAndFlags:Zr(r,0,1),nameId:F,parentId:I,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(h.slice(0,E)),A++,p[A]=M,B=E+1,E=h.indexOf("/",B)}if(w){if(B<C){let D=p[A];if(D===void 0)throw Error(`Unable to resolve directory parent for "${h}"`);r++;let F=h.slice(B,C),M=l.get(F);if(M===void 0)M=d.length,l.set(F,M),d.push(F);let P=o.length;o.push({depthAndFlags:Zr(r,0,1),nameId:M,parentId:D,subtreeNodeCount:1,visibleSubtreeCount:1}),A++,p[A]=P,B=C+1}let I=p[A];if(I===void 0)throw Error(`Unable to resolve directory node for "${h}"`);this.promoteDirectoryToExplicit(I,h)}else{let I=p[A];if(I===void 0)throw Error(`Unable to resolve file parent for "${h}"`);let D=h.slice(B),F=l.get(D);if(F===void 0)F=d.length,l.set(D,F),d.push(D);o.push({depthAndFlags:Zr(r+1,0),nameId:F,parentId:I,subtreeNodeCount:1,visibleSubtreeCount:1})}if(B!==f.length)f=h.substring(0,B),b=r;n=h}if(p.length=A+1,n!=null)this.lastPreparedPath=Sp(n);this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,o=this.segmentTable,c=o.idByValue,l=o.valueById,d=this.directoryStack,p=0,A="",f=0;for(let b of e){if(t===b)throw Error(`Duplicate path: "${b}"`);let h=b.length,w=0,C=0;if(t!=null)if(A.length>0&&b.length>A.length&&b.startsWith(A))w=f,C=A.length;else{let D=Math.min(h,t.length);for(let F=0;F<D;F++){let M=b.charCodeAt(F);if(M!==t.charCodeAt(F))break;if(M===47)w++,C=F+1}}p=w,n=w;let _=C,v=b.indexOf("/",_);while(v>=0){let D=d[p];if(D===void 0)throw Error("Directory stack underflow while building the path store");n++;let F=b.slice(_,v),M=c.get(F);if(M===void 0)M=l.length,c.set(F,M),l.push(F);let P=r.length;r.push({depthAndFlags:Zr(n,0,1),nameId:M,parentId:D,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(b.slice(0,v)),this.presortedDirectoryNodeIds.push(P),p++,d[p]=P,_=v+1,v=b.indexOf("/",_)}let B=d[p];if(B===void 0)throw Error(`Unable to resolve file parent for "${b}"`);let E=b.slice(_),I=c.get(E);if(I===void 0)I=l.length,c.set(E,I),l.push(E);if(r.push({depthAndFlags:Zr(n+1,0),nameId:I,parentId:B,subtreeNodeCount:1,visibleSubtreeCount:1}),_!==A.length)A=b.substring(0,_),f=n;t=b}if(d.length=p+1,t!=null)this.lastPreparedPath=Sp(t);this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;if(this.hasDeferredDirectoryIndexes)qe(this.instrumentation,"store.builder.buildDirectoryIndexes",()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1;else if(!t)qe(this.instrumentation,"store.builder.computeSubtreeCounts",()=>this.computeSubtreeCounts(0));return{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(),this.hasDeferredDirectoryIndexes=!1;if(this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t){if((this.options.sort==="default"?QH(this.lastPreparedPath,e,this.segmentSortKeyCache):RH(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}}let n=this.lastPreparedPath,r=FH(e),o=n==null?0:FH(n),c=n==null?0:Zfe(n.segments,e.segments),l=Math.min(c,r,o);this.directoryStack.length=l+1;for(let p=l;p<r;p++){let A=this.directoryStack[this.directoryStack.length-1];if(A===void 0)throw Error("Directory stack underflow while building the path store");let f=t?this.getOrCreateDirectoryChild(A,e.segments[p]):this.createDirectoryChild(A,e.segments[p]);this.directoryStack.push(f)}if(e.isDirectory){let p=this.directoryStack[this.directoryStack.length-1];if(p===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(p,e.path),this.lastPreparedPath=e;return}let d=this.directoryStack[this.directoryStack.length-1];if(d===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);if(t)this.createFileChild(d,e.basename,e.path);else this.createFileChildUnchecked(d,e.basename);this.lastPreparedPath=e}recordCreatedDirectoryPath(e){if(!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null)return;if(this.createdDirectoryCount+=1,!this.initialExpandedPathSet.has(e))this.createdDirectoriesAllExpanded=!1}createFileChild(e,t,n){let r=bs(this.segmentTable,t),o=this.getDirectoryIndex(e),c=o.childIdByNameId;if(c!=null){if(c.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`)}let l=this.nodes[e];if(l===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let d=this.nodes.length;if(this.nodes.push({depthAndFlags:Zr(Ci(l)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),c!=null)c.set(r,d);return xA(o,d),d}createFileChildUnchecked(e,t){let n=bs(this.segmentTable,t),r=this.getDirectoryIndex(e),o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let c=this.nodes.length;if(this.nodes.push({depthAndFlags:Zr(Ci(o)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null)r.childIdByNameId.set(n,c);return xA(r,c),c}getOrCreateDirectoryChild(e,t){let n=bs(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let l=r.childIdByNameId.get(n);if(l!==void 0){let d=this.nodes[l];if(d!=null&&!Ue(d))throw Error(`Path collides with an existing file while creating directory "${t}"`);return l}}let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let c=this.nodes.length;if(this.nodes.push({depthAndFlags:Zr(Ci(o)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null)r.childIdByNameId.set(n,c);return xA(r,c),this.directories.set(c,Ip()),c}createDirectoryChild(e,t){let n=bs(this.segmentTable,t),r=this.getDirectoryIndex(e),o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let c=this.nodes.length;if(this.nodes.push({depthAndFlags:Zr(Ci(o)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null)r.childIdByNameId.set(n,c);return xA(r,c),this.directories.set(c,Ip()),c}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!Ue(n))throw Error(`Path is not a directory: "${t}"`);if(Rn(n,1))throw Error(`Duplicate path: "${t}"`);EA(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,J2());let r=-1,o=null;for(let c=1;c<t.length;c++){let l=t[c];if(l==null)continue;if(Ue(l)){let p=J2();n.set(c,p),r=c,o=p}let d;if(l.parentId===r)d=o;else d=n.get(l.parentId),r=l.parentId,o=d??null;if(d!=null)d.childIds.push(c)}if(e)return;for(let c=t.length-1;c>=1;c--){let l=t[c];if(l==null)continue;let d=t[l.parentId];if(d!=null)d.subtreeNodeCount+=l.subtreeNodeCount,d.visibleSubtreeCount+=l.visibleSubtreeCount}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;if(Ue(n))this.directories.set(t,Ip());let r=this.directories.get(n.parentId);if(r!=null){if(r.childIdByNameId!=null)r.childIdByNameId.set(n.nameId,t);xA(r,t)}}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!Ue(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let o of n.childIds)r+=this.computeSubtreeCounts(o);return Qp(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function qH(e,t="closed",n=null){let r=Wfe(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 GH(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function Wfe(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 zH(e,t){if(Rn(t,2))return!0;if(e.defaultExpansion==="open")return!0;if(e.defaultExpansion==="closed")return!1;return Ci(t)<=e.defaultExpansion}function Ka(e,t,n=e.snapshot.nodes[t]){if(n==null||!Ue(n))return!1;if(e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides)return!0;if(e.collapsedDirectoryIds.has(t))return!1;if(e.expandedDirectoryIds.has(t))return!0;return zH(e,n)}function Kd(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!Ue(r))return;let o=zH(e,r);if(n){if(o){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(o){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function OH(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 Wd(e,t){return e.directoryLoadInfoById.get(t)?.state??"loaded"}function HH(e,t){let n=OH(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 UH(e,t){let n=OH(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state="unloaded"}function ZH(e,t,n){let r=e.directoryLoadInfoById.get(t);if(r==null||r.activeAttemptId!==n)return!1;return r.activeAttemptId=null,r.errorMessage=null,r.state="loaded",!0}function YH(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function KH(e,t,n,r){let o=e.directoryLoadInfoById.get(t);if(o==null||o.activeAttemptId!==n)return!1;return o.activeAttemptId=null,o.errorMessage=r??null,o.state="error",!0}function WH(e,t){e.directoryLoadInfoById.delete(t)}function tU(e,t,n){let r=n,o=e.listeners.get(t);if(o!=null)o.add(r);else e.listeners.set(t,new Set([r]));return()=>{let c=e.listeners.get(t);if(c==null)return;if(c.delete(r),c.size===0)e.listeners.delete(t)}}function nU(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:"add",path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function aU(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:"remove",path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function rU(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:"move",projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function iU(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:"expand",path:e.path,projectionChanged:!0,visibleCountDelta:null}}function oU(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:"collapse",path:e.path,projectionChanged:!0,visibleCountDelta:null}}function sU(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:"mark-directory-unloaded",path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function cU(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 lU(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some((t)=>t.canonicalChanged),childEvents:e.childEvents,operation:"apply-child-patch",path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function dU(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 uU(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 pU(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 Yr(e,t,n){return{...n,visibleCountDelta:nS(e)-t}}function mU(e,t){let n=nS(e),r=GH();e.transactionStack.push(r);try{t()}catch(o){throw VH(e,r,!1),o}VH(e,r,!0,nS(e)-n)}function jo(e,t){let n=e.instrumentation;if(n==null){JH(e,t);return}qe(n,"store.events.record",()=>JH(e,t))}function JH(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){tS(e,t);return}n.events.push(t),Xfe(n,t)}function VH(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error("Transaction stack underflow");if(!n)return;let o=e.transactionStack[e.transactionStack.length-1]??null;if(o!=null){let d=e.instrumentation;if(d==null)XH(o,t);else qe(d,"store.events.batch.merge",()=>XH(o,t));return}let c=Jfe(t,r),l=e.instrumentation;if(l==null){tS(e,c);return}qe(l,"store.events.batch.commit",()=>tS(e,c))}function Jfe(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some((n)=>n.canonicalChanged),events:[...e.events],operation:"batch",projectionChanged:e.events.some((n)=>n.projectionChanged),visibleCountDelta:t}}function Vfe(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function XH(e,t){for(let n of t.events)e.events.push(n);Vfe(e,t)}function Xfe(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function tS(e,t){let n=e.instrumentation;if(n==null){eU(e,t);return}qe(n,"store.events.emit",()=>eU(e,t))}function eU(e,t){e.listeners.get(t.operation)?.forEach((n)=>n(t)),e.listeners.get("*")?.forEach((n)=>n(t))}function nS(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function Cl(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!Ue(n)||Rn(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let o=r.childIds[0];if(o==null)return null;let c=e.snapshot.nodes[o];if(c==null||!Ue(c))return null;return o}function _l(e,t){let n=t;while(!0){let r=Cl(e,n);if(r==null)return n;n=r}}function QA(e,t){let n=[t],r=t;while(!0){let o=Cl(e,r);if(o==null)return n;n.push(o),r=o}}function F_(e,t){let n=t==null?e.snapshot.rootId:Kr(e,t);if(n==null)return[];return tbe(e,n)}function rS(e,t){let n=Sp(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),o=Jd(e,dbe(e,r)),{createdNodeIds:c,directoryId:l}=nbe(e,r),d=new Set(c),p=l;if(n.isDirectory){let f=Ve(e,l);if(Rn(f,1))throw Error(`Path already exists: "${t}"`);EA(f,1),e.pathCacheByNodeId.set(l,{path:t,version:e.pathCacheVersion}),d.add(l)}else p=rbe(e,l,n.basename),d.add(p);Vd(e,l);let A=Jd(e,l);return nU({affectedAncestorIds:io(e,p),affectedNodeIds:[...d],path:t,projectionChanged:wU(o,A)})}function iS(e,t,n){let r=Kr(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let o=Ve(e,r);if(Rn(o,2))throw Error("The root node cannot be removed");if(Ue(o)&&vn(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let c=o.parentId,l=Jd(e,c),d=yU(e,r);cS(e,c,r,o.nameId),lS(e,c),Vd(e,c);let p=Jd(e,c);return aU({affectedAncestorIds:io(e,c),affectedNodeIds:d,path:t,projectionChanged:wU(l,p),recursive:n.recursive===!0})}function oS(e,t,n,r){let o=Kr(e,t);if(o==null)throw Error(`Source path does not exist: "${t}"`);let c=Ve(e,o);if(Rn(c,2))throw Error("The root node cannot be moved");let l=r.collision??"error",d=cbe(e,o,n),p=Jd(e,c.parentId),A=Jd(e,d.parentId),f=ro(e.snapshot.segmentTable,c.nameId),b=bs(e.snapshot.segmentTable,d.basename);if(d.parentId===c.parentId&&f===d.basename)return null;if(Ue(c)&&pbe(e,o,d.parentId))throw Error("Cannot move a directory into one of its descendants");let h=Zd(e.snapshot.nodes,vn(e,d.parentId)).get(b),w=d.existingNodeId??h??null;if(w!=null&&w!==o){if(lbe(e,w,l,rh(c))==="skip")return null}let C=c.parentId;if(cS(e,C,o,c.nameId),c.parentId=d.parentId,c.nameId=b,e.pathCacheByNodeId.delete(o),CU(e,o),sS(e,d.parentId,o),lS(e,C),e.pathCacheVersion++,Vd(e,C),d.parentId!==C)Vd(e,d.parentId);let _=Jd(e,C),v=Jd(e,d.parentId);return rU({affectedAncestorIds:[...new Set([...io(e,C),...io(e,d.parentId)])],affectedNodeIds:[o],from:t,projectionChanged:kU([p,A],[_,v]),to:hn(e,o)})}function ebe(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function AU(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function hn(e,t){let n=Ve(e,t),r=ebe(e,t);if(r!=null)return r;if(Rn(n,2))return AU(e,t,"");let o=hn(e,n.parentId),c=ro(e.snapshot.segmentTable,n.nameId),l=o.length===0?c:`${o}${c}`;return AU(e,t,Ue(n)?`${l}/`:l)}function Vd(e,t){let n=e.instrumentation;if(n==null){fU(e,t);return}qe(n,"store.recomputeCountsUpwardFrom",()=>fU(e,t))}function ch(e,t){let n=[[t,0]],{nodes:r,directories:o}=e.snapshot;while(n.length>0){let c=n[n.length-1],l=c[0],d=r[l];if(d==null||!Ue(d)){aS(e,l,d,!0),n.pop();continue}let p=o.get(l);if(p==null||c[1]>=p.childIds.length){aS(e,l,d,!0),n.pop();continue}let A=p.childIds[c[1]++];n.push([A,0])}}function io(e,t){let n=[],r=t;while(r!=null){let o=Ve(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=o.parentId}return n}function Kr(e,t){if(t.length===0)return e.snapshot.rootId;let n=I_(t);return hU(e,n.segments,n.requiresDirectory)}function hU(e,t,n){let r=e.snapshot.rootId;for(let c of t){let l=e.snapshot.segmentTable.idByValue.get(c);if(l===void 0)return null;let d=vn(e,r),p=Zd(e.snapshot.nodes,d).get(l);if(p===void 0)return null;r=p}let o=Ve(e,r);if(n&&!Ue(o))return null;return r}function vn(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 Ve(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Rn(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function tbe(e,t){let n=e.snapshot.nodes[t];if(n===void 0||Rn(n,4))return[];if(!Ue(n))return[hn(e,t)];if(vn(e,t).childIds.length===0)return Rn(n,1)&&!Rn(n,2)?[hn(e,t)]:[];let r=[],o=[{childIndex:0,nodeId:t}];while(o.length>0){let c=o[o.length-1];if(c==null)break;let l=e.snapshot.nodes[c.nodeId];if(l===void 0||Rn(l,4)){o.pop();continue}if(!Ue(l)){r.push(hn(e,c.nodeId)),o.pop();continue}let d=vn(e,c.nodeId);if(d.childIds.length===0){if(Rn(l,1)&&!Rn(l,2))r.push(hn(e,c.nodeId));o.pop();continue}let p=d.childIds[c.childIndex];if(p==null){o.pop();continue}c.childIndex++,o.push({childIndex:0,nodeId:p})}return r}function nbe(e,t){let n=[],r=e.snapshot.rootId;for(let o of t){let c=bs(e.snapshot.segmentTable,o),l=vn(e,r),d=Zd(e.snapshot.nodes,l).get(c);if(d!==void 0){if(!Ue(Ve(e,d)))throw Error(`Cannot create a directory that collides with an existing file: "${o}"`);r=d;continue}r=abe(e,r,c),n.push(r)}return{createdNodeIds:n,directoryId:r}}function abe(e,t,n){let r=Ve(e,t),o=e.snapshot.nodes.length;if(e.snapshot.nodes.push({depthAndFlags:Zr(Ci(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(o,Ip()),sS(e,t,o),e.collapseNewDirectoriesByDefault)e.collapsedDirectoryIds.add(o),e.hasCollapsedDirectoryOverrides=!0;return e.activeNodeCount++,o}function rbe(e,t,n){let r=bs(e.snapshot.segmentTable,n),o=vn(e,t);if(Zd(e.snapshot.nodes,o).has(r))throw Error(`Path already exists: "${mbe(e,t,n)}"`);let c=Ve(e,t),l=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:Zr(Ci(c)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),sS(e,t,l),e.activeNodeCount++,l}function ibe(e,t,n){let r=0,o=t.childIds.length;while(r<o){let c=r+o>>>1,l=t.childIds[c];if(l==null){o=c;continue}if(obe(e,n,l)<0)o=c;else r=c+1}return r}function sS(e,t,n){let r=vn(e,t),o=Ve(e,n);Zd(e.snapshot.nodes,r).set(o.nameId,n),B_(r,n,o.subtreeNodeCount,o.visibleSubtreeCount);let c=ibe(e,r,n);r.childIds.splice(c,0,n),V2(r,c),Yd(e.snapshot.nodes,r)}function cS(e,t,n,r){let o=vn(e,t),c=BA(o),l=c.get(n)??-1;Zd(e.snapshot.nodes,o).delete(r),c.delete(n);let d=e.snapshot.nodes[n];if(d!=null)B_(o,n,-d.subtreeNodeCount,-d.visibleSubtreeCount);if(l>=0)o.childIds.splice(l,1),V2(o,l),Yd(e.snapshot.nodes,o)}function obe(e,t,n){let r=e.snapshot.options.sort;if(r==="default")return sbe(e,t,n);return r(gU(e,t),gU(e,n))}function sbe(e,t,n){let r=Ve(e,t),o=Ve(e,n),c=Ue(r);if(c!==Ue(o))return c?-1:1;let l=oh(sh(e.snapshot.segmentTable,r.nameId),sh(e.snapshot.segmentTable,o.nameId));if(l!==0)return l;let d=ro(e.snapshot.segmentTable,r.nameId),p=ro(e.snapshot.segmentTable,o.nameId);if(d!==p)return d<p?-1:1;return t<n?-1:1}function gU(e,t){let n=Ve(e,t),r=hn(e,t),o=Ue(n),c=o?r.slice(0,-1):r;return{basename:ro(e.snapshot.segmentTable,n.nameId),depth:Ci(n),isDirectory:o,path:r,segments:c.length===0?[]:c.split("/")}}function cbe(e,t,n){let r=Ve(e,t),o=Kr(e,n);if(o!=null){let A=Ve(e,o);if(Ue(A))return{basename:ro(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:o};let f=I_(n).segments;return{basename:f[f.length-1]??"",existingNodeId:o,parentId:A.parentId}}let c=I_(n),l=c.segments[c.segments.length-1]??"",d=c.segments.slice(0,-1),p=d.length===0?e.snapshot.rootId:hU(e,d,!0);if(p==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:l,existingNodeId:null,parentId:p}}function lbe(e,t,n,r){if(n==="skip")return"skip";if(n==="error")throw Error(`Destination already exists: "${hn(e,t)}"`);let o=Ve(e,t);if(rh(o)!==r)throw Error("replace collision requires the same source and destination kinds");if(Ue(o)&&vn(e,t).childIds.length>0)throw Error("replace collision does not support non-empty directories");let{parentId:c,nameId:l}=o;return yU(e,t),cS(e,c,t,l),lS(e,c),Vd(e,c),"handled"}function yU(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];while(r.length>0){let o=r.pop();if(o==null)break;let c=Ve(e,o.nodeId);if(o.visitedChildren||!Ue(c)){if(Ue(c))e.snapshot.directories.delete(o.nodeId);if(EA(c,4),e.pathCacheByNodeId.delete(o.nodeId),e.collapsedDirectoryIds.delete(o.nodeId))e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;e.expandedDirectoryIds.delete(o.nodeId),WH(e,o.nodeId),e.activeNodeCount--,n.push(o.nodeId);continue}r.push({nodeId:o.nodeId,visitedChildren:!0});let l=vn(e,o.nodeId);for(let d=l.childIds.length-1;d>=0;d--){let p=l.childIds[d];if(p!=null)r.push({nodeId:p,visitedChildren:!1})}}return n}function lS(e,t){let n=t;while(n!=null){let r=Ve(e,n);if(!Ue(r)||Rn(r,2))return;if(vn(e,n).childIds.length>0)return;EA(r,1),n=r.parentId===n?null:r.parentId}}function dbe(e,t){let n=e.snapshot.rootId;for(let r of t){let o=e.snapshot.segmentTable.idByValue.get(r);if(o==null)break;let c=Zd(e.snapshot.nodes,vn(e,n)).get(o);if(c==null)break;if(!Ue(Ve(e,c)))break;n=c}return n}function Jd(e,t){let n=ube(e,t);if(n==null)return null;let r=_l(e,n),o=Ve(e,r),c=n===r?null:QA(e,n).map((l)=>hn(e,l));return JSON.stringify({flattenedSegmentPaths:c,hasChildren:vn(e,r).childIds.length>0,path:hn(e,r),terminalKind:rh(o)})}function wU(e,t){return kU([e],[t])}function kU(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],o=t[n];if(r==null||o==null||r!==o)return!0}return!1}function ube(e,t){let n=t;while(n!=null){let r=Ve(e,n);if(!Ue(r)||Rn(r,2))return null;if(!Ka(e,n,r))return n;n=r.parentId}return null}function CU(e,t){let n=Ve(e,t);if(_H(n,(t===e.snapshot.rootId?-1:Ci(Ve(e,n.parentId)))+1),!Ue(n))return;let r=vn(e,t);for(let o of r.childIds)CU(e,o)}function pbe(e,t,n){let r=n;while(r!=null){if(r===t)return!0;let o=Ve(e,r);if(r===e.snapshot.rootId)return!1;r=o.parentId}return!1}function aS(e,t,n=Ve(e,t),r=!1){let o=e.instrumentation;if(o==null){bU(e,t,n,r);return}qe(o,"store.recomputeNodeCounts",()=>bU(e,t,n,r))}function fU(e,t){let n=t;while(n!=null){let r=Ve(e,n),o=r.subtreeNodeCount,c=r.visibleSubtreeCount;if(aS(e,n,r),n===e.snapshot.rootId)return;let l=r.subtreeNodeCount-o,d=r.visibleSubtreeCount-c,p=r.parentId;if(l!==0||d!==0)B_(vn(e,p),n,l,d);n=p}}function bU(e,t,n,r){if(!Ue(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let o=vn(e,t);if(r){let d=e.instrumentation;if(d==null)Qp(e.snapshot.nodes,o);else qe(d,"store.recomputeNodeCounts.rebuildChildAggregates",()=>Qp(e.snapshot.nodes,o))}let c=1+o.totalChildSubtreeNodeCount,l=o.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=c,Rn(n,2)){n.visibleSubtreeCount=l;return}n.visibleSubtreeCount=Cl(e,t)!=null?l:Ka(e,t,n)?1+l:1}function mbe(e,t,n){let r=hn(e,t);return r.length===0?n:`${r}${n}`}function DA(e){return e!=null&&!Rn(e,4)}function L_(e,t){let n=e.snapshot.nodes[t];if(!DA(n)||!Ue(n)||Rn(n,2))return null;return n}function Abe(e){let t=0;for(let[n,r]of e.pathCacheByNodeId){if(r.version!==e.pathCacheVersion)continue;if(!DA(e.snapshot.nodes[n]))continue;t+=1}return t}function gbe(e){return Math.max(0,e.valueById.length-1)}function _U(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:Abe(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:gbe(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function fbe(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 vU(e){let t=[],n=[];for(let r of e.collapsedDirectoryIds)if(L_(e,r)!=null)t.push(hn(e,r));for(let r of e.expandedDirectoryIds)if(L_(e,r)!=null)n.push(hn(e,r));return{collapsedPaths:t,expandedPaths:n}}function BU(e){let t=[];for(let[n,r]of e.directoryLoadInfoById){if(L_(e,n)==null||Wd(e,n)==="loaded")continue;t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:hn(e,n)})}return t}function xU(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let r=Kr(e,n);if(r==null)continue;Kd(e,r,!0,Ve(e,r))}for(let n of t.collapsedPaths){let r=Kr(e,n);if(r==null)continue;Kd(e,r,!1,Ve(e,r))}}function EU(e,t){e.directoryLoadInfoById.clear();for(let n of t){let r=Kr(e,n.path);if(r==null)continue;if(L_(e,r)==null)continue;e.directoryLoadInfoById.set(r,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function bbe(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:"",version:e.pathCacheVersion})}function hbe(e){let t=e.snapshot.segmentTable,n=Q_();for(let r of e.snapshot.nodes){if(!DA(r))continue;if(Rn(r,2)){r.nameId=0;continue}r.nameId=bs(n,ro(t,r.nameId))}e.snapshot.segmentTable=n}function ybe(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!DA(r)||!Ue(r)){e.snapshot.directories.delete(t);continue}let o=n.childIds.filter((c)=>{let l=e.snapshot.nodes[c];return DA(l)&&l.parentId===t});n.childIds=o,n.childIdByNameId=new Map(o.map((c)=>[Ve(e,c).nameId,c])),n.childPositionById=new Map(o.map((c,l)=>[c,l])),Qp(e.snapshot.nodes,n)}}function wbe(e){let t=e.snapshot.nodes.length-1;while(t>e.snapshot.rootId){let n=e.snapshot.nodes[t];if(DA(n))break;t-=1}e.snapshot.nodes.length=t+1}function kbe(e){let t=vU(e),n=BU(e);qe(e.instrumentation,"store.cleanup.stable.clearPathCaches",()=>bbe(e)),qe(e.instrumentation,"store.cleanup.stable.rebuildSegmentTable",()=>hbe(e)),qe(e.instrumentation,"store.cleanup.stable.rebuildDirectoryIndexes",()=>ybe(e)),qe(e.instrumentation,"store.cleanup.stable.trimTrailingRemovedNodeSlots",()=>wbe(e)),qe(e.instrumentation,"store.cleanup.stable.restoreExpansionOverrides",()=>xU(e,t)),qe(e.instrumentation,"store.cleanup.stable.restoreDirectoryLoadInfos",()=>EU(e,n)),qe(e.instrumentation,"store.cleanup.stable.recomputeCounts",()=>ch(e,e.snapshot.rootId))}function Cbe(e){let t=vU(e),n=BU(e),r=qe(e.instrumentation,"store.cleanup.aggressive.listPaths",()=>F_(e)),o=BH({...e.snapshot.options},e.instrumentation),c=qe(e.instrumentation,"store.cleanup.aggressive.rebuildSnapshot",()=>{let l=new S_(o);return l.appendPaths(r),l.finish()});e.snapshot=c,e.activeNodeCount=c.nodes.length-1,e.pathCacheByNodeId=new Map([[c.rootId,{path:"",version:0}]]),e.pathCacheVersion=0,qe(e.instrumentation,"store.cleanup.aggressive.restoreExpansionOverrides",()=>xU(e,t)),qe(e.instrumentation,"store.cleanup.aggressive.restoreDirectoryLoadInfos",()=>EU(e,n)),qe(e.instrumentation,"store.cleanup.aggressive.recomputeCounts",()=>ch(e,e.snapshot.rootId))}function IU(e){for(let t of e.directoryLoadInfoById.values())if(t.state==="loading"&&t.activeAttemptId!=null)return!0;return!1}function QU(e,t){let n=_U(e);if(t==="stable")qe(e.instrumentation,"store.cleanup.stable",()=>kbe(e));else qe(e.instrumentation,"store.cleanup.aggressive",()=>Cbe(e));let r=_U(e);return fbe(t,t==="stable",n,r)}var _be=64;function vbe(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;while(r<n)r*=2;let o=new Int32Array(r);return o.fill(-1),o.set(e),o}function Wa(e){return Ve(e,e.snapshot.rootId).visibleSubtreeCount}function LU(e,t,n,r){let o=Ve(e,t.terminalNodeId),c=Math.max(1,o.visibleSubtreeCount);return Math.min(r-1,n+c-1)}function Bbe(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:lh(e,t.cursor),setSize:t.setSize,subtreeEndIndex:LU(e,t.cursor,t.index,n)}}function RU(e,t,n,r,o,c){let l=vn(e,t),{childIndex:d,childVisibleIndex:p,localVisibleIndex:A}=x_(e.snapshot.nodes,l,n),f=l.childIds[d];if(f==null)throw Error(`Visible index ${String(n)} is out of range`);return xbe(e,f,A,r+p,o+1,d,l.childIds.length,c)}function xbe(e,t,n,r,o,c,l,d){if(!Ue(Ve(e,t))){if(n===0)return{ancestors:d,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:o},index:r,posInSet:c,setSize:l};throw Error(`Visible index ${String(n)} is out of range for file`)}let p=GU(e,t,o);if(n===0)return{ancestors:d,cursor:p,index:r,posInSet:c,setSize:l};let A=Ve(e,p.terminalNodeId);if(!Ue(A)||!Ka(e,p.terminalNodeId,A))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return RU(e,p.terminalNodeId,n-1,r+1,p.visibleDepth,[...d,{cursor:p,index:r,posInSet:c,setSize:l}])}function NU(e,t){let n=Wa(e);if(t<0||t>=n)return null;let r=RU(e,e.snapshot.rootId,t,0,-1,[]),o=r.ancestors.map((l)=>hn(e,l.cursor.terminalNodeId)),c=null;return{ancestorPaths:o,get ancestorRows(){if(c!=null)return c;let l=[],d=[];for(let p of r.ancestors){let A=Bbe(e,p,n,[...d]);l.push(A),d.push(A.row.path)}return c=l,c},index:r.index,posInSet:r.posInSet,row:lh(e,r.cursor),setSize:r.setSize,subtreeEndIndex:LU(e,r.cursor,r.index,n)}}function MU(e,t,n){let r=e.instrumentation,o=Wa(e);if(o<=0||n<t)return[];let c=Math.max(0,Math.min(t,o-1)),l=Math.max(c,Math.min(n,o-1));if(r==null){if(c===0)return Qbe(e,l+1);let b=[],h=DU(e,c);for(let w=c;w<=l&&h!=null;w++){let C=lh(e,h);b.push(C),h=SU(e,h)}return b}let d=[],p=0,A=0,f=qe(r,"store.getVisibleSlice.selectFirstRow",()=>DU(e,c));for(let b=c;b<=l&&f!=null;b++){let h=qe(r,"store.getVisibleSlice.materializeRow",()=>lh(e,f));if(d.push(h),h.isFlattened)p++,A+=h.flattenedSegments?.length??0;f=qe(r,"store.getVisibleSlice.advanceCursor",()=>SU(e,f))}return IA(r,"workload.visibleRowsRead",d.length),IA(r,"workload.flattenedRowsRead",p),IA(r,"workload.flattenedSegmentsRead",A),d}function uS(e,t=Wa(e)){let n=e.instrumentation;if(n==null)return FU(e,t);return qe(n,"store.getVisibleTreeProjection",()=>FU(e,t))}function jU(e){return Ibe(uS(e))}function TU(e,t){let n=Kr(e,t);if(n==null||n===e.snapshot.rootId)return null;if(Ue(Ve(e,n))&&_l(e,n)!==n)return null;let r=0,o=n,{nodes:c,rootId:l}=e.snapshot;while(o!==l){let d=Ve(e,o).parentId,p=vn(e,d),A=BA(p).get(o);if(A==null)throw Error(`Child ${String(o)} was not found in its parent index`);if(r+=kH(c,p,A),d!==l){let f=Ve(e,d),b=Cl(e,d);if(!Ka(e,d,f)&&b!==o)return null;if(_l(e,d)===d)r+=1}o=d}return r}function $U(e,t){let n=Kr(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=Ve(e,n);if(!Ue(r))throw Error(`Path is not a directory: "${t}"`);if(Ka(e,n,r))return null;return Kd(e,n,!0,r),Vd(e,n),iU({affectedAncestorIds:io(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})}function PU(e,t){let n=Kr(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=Ve(e,n);if(!Ue(r))throw Error(`Path is not a directory: "${t}"`);if(!Ka(e,n,r))return null;return Kd(e,n,!1,r),Vd(e,n),oU({affectedAncestorIds:io(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})}function DU(e,t){if(t<0||t>=Wa(e))return null;return qU(e,e.snapshot.rootId,t,-1)}function qU(e,t,n,r){let o=vn(e,t),c=e.instrumentation,{childIndex:l,localVisibleIndex:d}=c==null?x_(e.snapshot.nodes,o,n):qe(c,"store.getVisibleSlice.selectChildIndex",()=>x_(e.snapshot.nodes,o,n)),p=o.childIds[l];if(p!=null)return dS(e,p,d,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function dS(e,t,n,r){if(!Ue(Ve(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 o=GU(e,t,r);if(n===0)return o;let c=Ve(e,o.terminalNodeId);if(!Ue(c)||!Ka(e,o.terminalNodeId,c))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return qU(e,o.terminalNodeId,n-1,o.visibleDepth)}function GU(e,t,n){if(!Ue(Ve(e,t)))return{headNodeId:t,terminalNodeId:t,visibleDepth:n};if(e.instrumentation==null)return{headNodeId:t,terminalNodeId:_l(e,t),visibleDepth:n};return{headNodeId:t,terminalNodeId:qe(e.instrumentation,"store.getVisibleSlice.flatten.resolveTerminalDirectory",()=>_l(e,t)),visibleDepth:n}}function Ebe(e,t){let n=Ve(e,t);if(!Ue(n))return!0;let r=n.parentId;if(r===e.snapshot.rootId)return!0;return Cl(e,r)!==t}function SU(e,t){let n=Ve(e,t.terminalNodeId);if(Ue(n)){let c=vn(e,t.terminalNodeId);if(Ka(e,t.terminalNodeId,n)&&c.childIds.length>0){let l=c.childIds[0];return l==null?null:dS(e,l,0,t.visibleDepth+1)}}let{terminalNodeId:r,visibleDepth:o}=t;while(!0){let c=Ve(e,r);if(r===e.snapshot.rootId)return null;let l=c.parentId,d=vn(e,l),p=BA(d).get(r)??-1;if(p<0)throw Error(`Child ${String(r)} was not found in its parent index`);let A=d.childIds[p+1]??null;if(A!=null)return dS(e,A,0,o);if(Ebe(e,r))o--;r=l}}function Ibe(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let o=e.getParentIndex(r);n[r]={index:r,parentPath:o>=0?e.paths[o]??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 FU(e,t){let n=Array(t),r=new Int32Array(t),o=new Int32Array(t),c=new Int32Array(t),l=new Int32Array(_be);l.fill(-1);let d=0,{nodes:p,directories:A,segmentTable:f}=e.snapshot,b=[[A.get(e.snapshot.rootId),0,-1,""]],h=e.snapshot.options.flattenEmptyDirectories,w=e.pathCacheByNodeId,C=e.pathCacheVersion,_=f.valueById;while(b.length>0&&d<t){let D=b[b.length-1],F=D[0];if(D[1]>=F.childIds.length){b.pop();continue}let M=D[1],P=F.childIds[D[1]++],q=p[P],W=D[2]+1,Z=D[3];l=vbe(l,W);let ye,ne=P;if(!Ue(q)){let ce=w.get(P);ye=ce!=null&&ce.version===C?ce.path:`${Z}${_[q.nameId]}`}else ne=h?_l(e,P):P,ye=ne===P?`${Z}${_[q.nameId]}/`:hn(e,ne);r[d]=l[W],n[d]=ye,o[d]=M,c[d]=F.childIds.length,l[W+1]=d,d+=1;let re=p[ne];if(re!=null&&Ue(re)&&Ka(e,ne,re))b.push([A.get(ne),0,W,ye])}if(d<t)n.length=d;let v=r.subarray(0,d),B=o.subarray(0,d),E=c.subarray(0,d),I=null;return{getParentIndex(D){return D<0||D>=d?-1:v[D]??-1},paths:n,posInSetByIndex:B,setSizeByIndex:E,get visibleIndexByPath(){if(I==null){I=new Map;for(let D=0;D<d;D+=1)I.set(n[D]??"",D)}return I}}}function Qbe(e,t){let n=Array(t),r=0,{nodes:o,directories:c,segmentTable:l}=e.snapshot,d=[[c.get(e.snapshot.rootId),0,-1]],p=l.valueById,A=e.snapshot.options.flattenEmptyDirectories,f=e.pathCacheByNodeId,b=e.pathCacheVersion;while(d.length>0&&r<t){let h=d[d.length-1],w=h[0];if(h[1]>=w.childIds.length){d.pop();continue}let C=w.childIds[h[1]++],_=o[C],v=h[2]+1;if(!Ue(_)){let D=f.get(C);n[r++]={depth:v,flattenedSegments:void 0,hasChildren:!1,id:C,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:"file",loadState:void 0,name:p[_.nameId],path:D!=null&&D.version===b?D.path:hn(e,C)};continue}let B=A?_l(e,C):C,E={headNodeId:C,terminalNodeId:B,visibleDepth:v};n[r++]=lh(e,E);let I=o[B];if(I!=null&&Ue(I)&&Ka(e,B,I))d.push([c.get(B),0,v])}if(r<t)n.length=r;return n}function lh(e,t){let n=Ve(e,t.terminalNodeId),r=Ue(n)?Dbe(e,t):null,o=hn(e,t.terminalNodeId),c=ro(e.snapshot.segmentTable,n.nameId),l=Ue(n)&&vn(e,t.terminalNodeId).childIds.length>0,d=t.headNodeId!==t.terminalNodeId,p=e.instrumentation,A=d?p==null?QA(e,t.headNodeId).map((f)=>{let b=Ve(e,f);return{isTerminal:f===t.terminalNodeId,name:ro(e.snapshot.segmentTable,b.nameId),nodeId:f,path:hn(e,f)}}):qe(p,"store.getVisibleSlice.flatten.collectSegments",()=>QA(e,t.headNodeId).map((f)=>{let b=Ve(e,f);return{isTerminal:f===t.terminalNodeId,name:ro(e.snapshot.segmentTable,b.nameId),nodeId:f,path:hn(e,f)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:A,hasChildren:l,id:t.terminalNodeId,isExpanded:Ue(n)&&Ka(e,t.terminalNodeId,n),isFlattened:d,isLoading:r==="loading",kind:Ue(n)?"directory":"file",loadState:r==null||r==="loaded"?void 0:r,name:c,path:o}}function Dbe(e,t){if(t.headNodeId===t.terminalNodeId)return Wd(e,t.terminalNodeId);let n=QA(e,t.headNodeId),r=!1,o=!1;for(let c of n){let l=Wd(e,c);if(l==="loading")return"loading";if(l==="error"){o=!0;continue}if(l==="unloaded")r=!0}if(o)return"error";if(r)return"unloaded";return"loaded"}var zU=8;function OU(e){let{nodes:t,directories:n,rootId:r,options:o}=e,c=t.length,l=new Int32Array(c),d=new Int32Array(c),p=new Int32Array(c),A=new Int32Array(c),f=new Int32Array(c),b=new Int32Array(c),h=new Int32Array(c);for(let v=0;v<c;v+=1){let B=t[v];if(B==null)continue;l[v]=B.parentId,d[v]=B.nameId,p[v]=B.depthAndFlags,A[v]=B.subtreeNodeCount,f[v]=B.visibleSubtreeCount}let w=0;for(let v of n.values())w+=v.childIds.length;let C=new Int32Array(w),_=0;for(let[v,B]of n){let E=B.childIds;b[v]=_,h[v]=E.length;for(let I=0;I<E.length;I+=1)C[_]=E[I],_+=1}return{nodeCount:c,rootId:r,flattenEmptyDirectories:o.flattenEmptyDirectories===!0,parentId:l,nameId:d,depthAndFlags:p,subtreeNodeCount:A,visibleSubtreeCount:f,childStart:b,childCount:h,childIdsFlat:C}}function HU(e){let{nodeCount:t,rootId:n,flattenEmptyDirectories:r,depthAndFlags:o,subtreeNodeCount:c,visibleSubtreeCount:l,childStart:d,childCount:p,childIdsFlat:A}=e;for(let C=t-1;C>=1;C-=1){if((o[C]&zU)===0)continue;let _=d[C],v=p[C],B=0,E=0;for(let D=0;D<v;D+=1){let F=A[_+D];B+=c[F],E+=l[F]}c[C]=1+B;let I;if(r&&v===1)I=(o[A[_]]&zU)!==0?E:1+E;else I=1+E;l[C]=I}let f=d[n],b=p[n],h=0,w=0;for(let C=0;C<b;C+=1){let _=A[f+C];h+=c[_],w+=l[_]}c[n]=1+h,l[n]=w}function Sbe(e){let{directories:t,nodes:n,options:r,rootId:o,presortedDirectoryNodeIds:c}=e.snapshot,l=r.flattenEmptyDirectories===!0,d=(w)=>{let C=n[w];if(C==null||!Ue(C))return;let _=t.get(w);if(_==null)throw Error(`Unknown directory child index for node ${String(w)}`);let v=_.childIds,B=v.length,E=0,I=0;for(let F=0;F<B;F++){let M=v[F];if(M==null)continue;let P=n[M];E+=P.subtreeNodeCount,I+=P.visibleSubtreeCount}if(_.totalChildSubtreeNodeCount=E,_.totalChildVisibleSubtreeCount=I,B>=128)Yd(n,_);C.subtreeNodeCount=1+E;let D;if(l&&B===1){let F=n[v[0]];D=F!=null&&Ue(F)?I:1+I}else D=1+I;C.visibleSubtreeCount=D};if(c!=null)for(let w=c.length-1;w>=0;w--)d(c[w]);else for(let w=n.length-1;w>=1;w--)d(w);let p=n[o],A=t.get(o);if(p==null||A==null)return;let f=A.childIds,b=0,h=0;for(let w=0;w<f.length;w++){let C=f[w];if(C==null)continue;let _=n[C];b+=_.subtreeNodeCount,h+=_.visibleSubtreeCount}A.totalChildSubtreeNodeCount=b,A.totalChildVisibleSubtreeCount=h,Yd(n,A),p.subtreeNodeCount=1+b,p.visibleSubtreeCount=h}function Fbe(e){let{directories:t,nodes:n,rootId:r}=e.snapshot,o=OU(e.snapshot);HU(o);let{subtreeNodeCount:c,visibleSubtreeCount:l}=o;for(let d=0;d<n.length;d+=1){let p=n[d];if(p==null)continue;p.subtreeNodeCount=c[d],p.visibleSubtreeCount=l[d]}for(let[d,p]of t){let A=p.childIds,f=A.length,b=0,h=0;for(let w=0;w<f;w++){let C=A[w];if(C==null)continue;let _=n[C];b+=_.subtreeNodeCount,h+=_.visibleSubtreeCount}if(p.totalChildSubtreeNodeCount=b,p.totalChildVisibleSubtreeCount=h,d===r||f>=128)Yd(n,p)}}function Lbe(e){return e.initialExpansion==="open"&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var R_=class e{#e;constructor(t={}){let n=ih(t),r=qe(n,"store.builder.create",()=>new S_(t));if(t.preparedInput!=null){let d=$H(t.preparedInput);if(d!=null)r.appendPresortedPaths(d,PH(t.preparedInput));else r.appendPreparedPaths(TH(t.preparedInput),!1)}else{let d=t.paths??[];if(t.presorted===!0)r.appendPaths(d);else r.appendPreparedPaths(qe(n,"store.preparePathEntries",()=>D_(d,t)))}let o=qe(n,"store.builder.finish",()=>r.finish({skipSubtreeCountPass:!0})),c=qe(n,"store.state.detectAllDirectoriesExpanded",()=>(t.initialExpansion??"closed")==="closed"&&r.didMatchAllInitialExpandedPaths());if(this.#e=qe(n,"store.state.create",()=>qH(o,c?"open":t.initialExpansion??"closed",n)),c)this.#e.collapseNewDirectoriesByDefault=!0;let l=c?this.#e.snapshot.directories.size-1:qe(n,"store.state.initializeExpandedPaths",()=>this.initializeExpandedPaths(t.initialExpandedPaths));if(c||Lbe(t)||(t.initialExpansion??"closed")==="closed"&&l===this.#e.snapshot.directories.size-1||(t.initialExpandedPaths?.length??0)>0&&qe(n,"store.state.checkAllDirectoriesExpanded",()=>this.hasAllDirectoriesExpanded()))if(t.useSoaCountSweep===!0)qe(n,"store.state.initializeOpenVisibleCountsViaSoa",()=>Fbe(this.#e));else qe(n,"store.state.initializeOpenVisibleCounts",()=>Sbe(this.#e));else qe(n,"store.state.recomputeCounts",()=>ch(this.#e,this.#e.snapshot.rootId))}static preparePaths(t,n={}){return NH(t,n)}static prepareInput(t,n={}){return MH(t,n)}static preparePresortedInput(t){return jH(t)}list(t){return qe(this.#e.instrumentation,"store.list",()=>F_(this.#e,t))}add(t){qe(this.#e.instrumentation,"store.add",()=>{let n=Wa(this.#e);jo(this.#e,Yr(this.#e,n,rS(this.#e,t)))})}remove(t,n={}){qe(this.#e.instrumentation,"store.remove",()=>{let r=Wa(this.#e);jo(this.#e,Yr(this.#e,r,iS(this.#e,t,n)))})}move(t,n,r={}){qe(this.#e.instrumentation,"store.move",()=>{let o=Wa(this.#e),c=oS(this.#e,t,n,r);if(c!=null)jo(this.#e,Yr(this.#e,o,c))})}batch(t){mU(this.#e,()=>{if(typeof t==="function"){t(this);return}for(let n of t)switch(n.type){case"add":this.add(n.path);break;case"remove":this.remove(n.path,{recursive:n.recursive});break;case"move":this.move(n.from,n.to,{collision:n.collision});break}})}getVisibleCount(){return qe(this.#e.instrumentation,"store.getVisibleCount",()=>Wa(this.#e))}getVisibleSlice(t,n){return qe(this.#e.instrumentation,"store.getVisibleSlice",()=>MU(this.#e,t,n))}getVisibleRowContext(t){return qe(this.#e.instrumentation,"store.getVisibleRowContext",()=>NU(this.#e,t))}getVisibleTreeProjection(){return jU(this.#e)}getVisibleTreeProjectionData(t){return uS(this.#e,t)}getVisibleIndex(t){return qe(this.#e.instrumentation,"store.getVisibleIndex",()=>TU(this.#e,t))}getPathInfo(t){return qe(this.#e.instrumentation,"store.getPathInfo",()=>{let n=Kr(this.#e,t);if(n==null)return null;let r=Ve(this.#e,n);return{depth:Ci(r),kind:Ue(r)?"directory":"file",path:hn(this.#e,n)}})}isExpanded(t){return qe(this.#e.instrumentation,"store.isExpanded",()=>{let n=this.requireDirectoryNodeId(t),r=Ve(this.#e,n);return Ka(this.#e,n,r)})}expand(t){qe(this.#e.instrumentation,"store.expand",()=>{let n=Wa(this.#e),r=$U(this.#e,t);if(r!=null)jo(this.#e,Yr(this.#e,n,r))})}collapse(t){qe(this.#e.instrumentation,"store.collapse",()=>{let n=Wa(this.#e),r=PU(this.#e,t);if(r!=null)jo(this.#e,Yr(this.#e,n,r))})}on(t,n){return tU(this.#e,t,n)}getDirectoryLoadState(t){let n=this.requireDirectoryNodeId(t);return Wd(this.#e,n)}markDirectoryUnloaded(t){qe(this.#e.instrumentation,"store.markDirectoryUnloaded",()=>{let n=this.requireDirectoryNodeId(t);if(vn(this.#e,n).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${t}"`);let r=Wa(this.#e);UH(this.#e,n),jo(this.#e,Yr(this.#e,r,sU({affectedAncestorIds:io(this.#e,n),affectedNodeIds:[n],path:t,projectionChanged:this.isDirectoryProjectionVisible(n)})))})}beginChildLoad(t){return qe(this.#e.instrumentation,"store.beginChildLoad",()=>{let n=this.requireDirectoryNodeId(t),r=Wa(this.#e),o=HH(this.#e,n);return jo(this.#e,Yr(this.#e,r,cU({affectedAncestorIds:io(this.#e,n),affectedNodeIds:[n],attemptId:o.attemptId,path:t,projectionChanged:this.isDirectoryProjectionVisible(n),reused:o.reused}))),o})}applyChildPatch(t,n){return qe(this.#e.instrumentation,"store.applyChildPatch",()=>{let r=this.resolveActiveDirectoryNodeId(t.nodeId);if(r==null||Wd(this.#e,r)!=="loading"||!YH(this.#e,r,t.attemptId))return!1;let o=hn(this.#e,r);this.validateChildPatch(o,n);let c=Wa(this.#e),l=[];for(let p of n.operations){Rbe(o,p);let A=Wa(this.#e);switch(p.type){case"add":l.push(Yr(this.#e,A,rS(this.#e,p.path)));break;case"remove":l.push(Yr(this.#e,A,iS(this.#e,p.path,{recursive:p.recursive})));break;case"move":{let f=oS(this.#e,p.from,p.to,{collision:p.collision});if(f!=null)l.push(Yr(this.#e,A,f));break}}}let d=l.some((p)=>p.projectionChanged)||this.isDirectoryProjectionVisible(r);return jo(this.#e,Yr(this.#e,c,lU({affectedAncestorIds:io(this.#e,r),affectedNodeIds:[r],attemptId:t.attemptId,childEvents:l,path:hn(this.#e,r),projectionChanged:d}))),!0})}completeChildLoad(t){return qe(this.#e.instrumentation,"store.completeChildLoad",()=>{let n=this.resolveActiveDirectoryNodeId(t.nodeId);if(n==null)return!1;let r=Wa(this.#e),o=ZH(this.#e,n,t.attemptId);return jo(this.#e,Yr(this.#e,r,dU({affectedAncestorIds:io(this.#e,n),affectedNodeIds:[n],attemptId:t.attemptId,path:hn(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!o}))),o})}failChildLoad(t,n){return qe(this.#e.instrumentation,"store.failChildLoad",()=>{let r=this.resolveActiveDirectoryNodeId(t.nodeId);if(r==null)return!1;let o=Wa(this.#e),c=KH(this.#e,r,t.attemptId,n);return jo(this.#e,Yr(this.#e,o,uU({affectedAncestorIds:io(this.#e,r),affectedNodeIds:[r],attemptId:t.attemptId,errorMessage:n,path:hn(this.#e,r),projectionChanged:this.isDirectoryProjectionVisible(r),stale:!c}))),c})}cleanup(t={}){return qe(this.#e.instrumentation,"store.cleanup",()=>{if(this.#e.transactionStack.length>0)throw Error("Cleanup cannot run during an open batch or transaction.");if(IU(this.#e))throw Error("Cleanup cannot run while directory loads are active.");let n=Wa(this.#e),r=QU(this.#e,t.mode??"stable");return jo(this.#e,Yr(this.#e,n,pU({...r,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:r.idsPreserved===!1}))),r})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(t){if(t==null||t.length===0)return 0;let n=0,r=[],o=[],c=0,l=null,d=this.#e.snapshot.segmentTable,p=d.valueById,A=this.#e.snapshot.nodes,f=new Map;for(let b of t){if(l!=null&&b<l)l=null,c=0,r.length=0,o.length=0;let h=b.length>0&&b.charCodeAt(b.length-1)===47?b.length-1:b.length;if(h===0){l=b,c=h,r.length=0,o.length=0;continue}let w=0,C=0;if(l!=null){let I=Math.min(h,c),D=!0;for(let F=0;F<I;F+=1){let M=b.charCodeAt(F);if(M!==l.charCodeAt(F)){D=!1;break}if(M===47)w+=1,C=F+1}if(D){if(I===c&&h>I&&b.charCodeAt(I)===47)w+=1,C=I+1;else if(I===h&&c>I&&l.charCodeAt(I)===47)w+=1,C=h+1}w=Math.min(w,o.length)}let _=w===0?this.#e.snapshot.rootId:o[w-1]??this.#e.snapshot.rootId,v=w,B=!0,E=C;while(E<=h){let I=b.indexOf("/",E),D=I===-1||I>h?h:I,F=b.slice(E,D),M=vn(this.#e,_).childIds,P=v===w?r[v]??0:0,q=P,W,Z=f.get(F)??Dp(F);f.set(F,Z);let ye=(ne,re)=>{for(q=ne;q<re;q+=1){let ce=M[q],ae=A[ce],V=p[ae.nameId];if(V===F)return W=ce,!0;let se=oh(sh(d,ae.nameId),Z);if(se>0||se===0&&V>F)return!1}return!1};if(!ye(P,M.length)&&P>0)ye(0,P);if(W===void 0){B=!1;break}if(!Ue(Ve(this.#e,W))){B=!1;break}if(r[v]=q,o[v]=W,_=W,v+=1,D===h)break;E=D+1}if(l=b,c=h,r.length=v,o.length=v,!B){l=null,c=0,r.length=0,o.length=0;continue}for(let I=w;I<v;I+=1){let D=o[I];if(D==null)continue;let F=Ve(this.#e,D);if(Ka(this.#e,D,F))continue;Kd(this.#e,D,!0,F),n+=1}}return n}hasAllDirectoriesExpanded(){for(let t of this.#e.snapshot.directories.keys()){if(t===this.#e.snapshot.rootId)continue;let n=Ve(this.#e,t);if(!Ka(this.#e,t,n))return!1}return!0}requireDirectoryNodeId(t){let n=Kr(this.#e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);if(!Ue(Ve(this.#e,n)))throw Error(`Path is not a directory: "${t}"`);return n}resolveActiveDirectoryNodeId(t){try{if(!Ue(Ve(this.#e,t)))throw Error(`Node is not a directory: ${String(t)}`);return t}catch{return null}}isDirectoryProjectionVisible(t){let n=t;while(n!==this.#e.snapshot.rootId){let r=Ve(this.#e,n).parentId;if(r!==this.#e.snapshot.rootId){let o=Ve(this.#e,r),c=Cl(this.#e,r);if(!Ka(this.#e,r,o)&&c!==n)return!1}n=r}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function Rbe(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 UU=(e)=>e.startsWith("f::")?e.slice(3):e;function Nbe(e){let t=e.lastIndexOf("/");if(t<0)return{parentPath:"",baseName:e};return{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function Mbe(e,t){return e===""?t:`${e}/${t}`}function ZU({files:e,path:t,isFolder:n,nextBasename:r}){let o=UU(t),c=r.trim();if(c.length===0)return{error:"Name cannot be empty."};if(c.includes("/"))return{error:'Name cannot include "/".'};let{parentPath:l,baseName:d}=Nbe(o);if(c===d)return{nextFiles:e,sourcePath:o,destinationPath:o,isFolder:n};let p=Mbe(l,c),A=Array(e.length),f=new Set;if(!n){let C=`${p}/`,_=!1;for(let v=0;v<e.length;v++){let B=e[v];if(B!==o&&B.startsWith(C))return{error:`"${p}" already exists.`};let E=B===o?p:B;if(f.has(E))return{error:`"${p}" already exists.`};if(f.add(E),A[v]=E,B===o)_=!0}if(!_)return{error:"Could not find the selected file to rename."};return{nextFiles:A,sourcePath:o,destinationPath:p,isFolder:n}}let b=`${o}/`,h=`${p}/`,w=0;for(let C=0;C<e.length;C++){let _=e[C],v=_===o||_.startsWith(b);if(!v&&(_===p||_.startsWith(h)))return{error:`"${p}" already exists.`};let B=v?`${p}${_.slice(o.length)}`:_;if(f.has(B))return{error:`"${p}" already exists.`};if(f.add(B),A[C]=B,v)w++}if(w===0)return{error:"Could not find the selected folder to rename."};return{nextFiles:A,sourcePath:o,destinationPath:p,isFolder:n}}function jbe(e){return e.endsWith("/")}function Tbe(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 $be(e){let t=[],n=new Set;for(let o of e){if(n.has(o))continue;n.add(o),t.push(o)}let r=new Set;for(let o of t.toSorted((c,l)=>{if(c.length!==l.length)return c.length-l.length;return c.localeCompare(l)})){let c=(o.endsWith("/")?o.slice(0,-1):o).split("/"),l=!1;for(let d=0;d<c.length-1;d+=1){let p=`${c.slice(0,d+1).join("/")}/`;if(!r.has(p))continue;l=!0;break}if(l)continue;r.add(o)}return t.filter((o)=>r.has(o))}function YU(e,t){return t.includes(e)?$be(t):[e]}function KU(e,t){if(e===t)return!0;if(e==null||t==null)return!1;return e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function pS(e,t){return{draggedPaths:e,target:t}}function mS(e,t){if(t.kind!=="directory"||t.directoryPath==null)return!1;for(let n of e){if(!jbe(n))continue;if(t.directoryPath===n||t.directoryPath.startsWith(n))return!0}return!1}function Pbe(e,t){if(t.kind==="root"||t.directoryPath==null)return Tbe(e);return t.directoryPath}function WU(e,t){let n=e.map((r)=>{let o=Pbe(r,t);if(o===r)return null;return{from:r,to:o,type:"move"}}).filter((r)=>r!=null);if(n.length===0)return null;return{operations:n,result:{draggedPaths:e,operation:n.length===1?"move":"batch",target:t}}}function qbe(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 AS(e,t,n){let{paths:r,preparedInput:o}=e;if(o==null){if(r==null)throw Error("FileTree requires paths or preparedInput");return{paths:r,preparedInput:void 0}}let c=o.paths;if(r==null)return{paths:c,preparedInput:o};if(!qbe(R_.preparePaths(r,n==null?{}:{sort:n}),c))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:c,preparedInput:o}}function gS(e){return e.operation==="add"||e.operation==="remove"||e.operation==="move"||e.operation==="batch"}function Gbe(e,t,n){if(e===t)return n;let r=t.endsWith("/")?t:`${t}/`;if(!e.startsWith(r))return e;return`${n.endsWith("/")?n:`${n}/`}${e.slice(r.length)}`}function zbe(e,t){if(e===t)return!0;let n=t.endsWith("/")?t:`${t}/`;return e.startsWith(n)}function SA(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 zbe(e,t.path)?n?e:null:e;case"move":return Gbe(e,t.from,t.to);case"batch":{let r=e;for(let o of t.events)if(r=SA(r,o,n),r==null)return null;return r}}}function N_(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function JU(e){switch(e.operation){case"add":return{...N_(e),operation:"add",path:e.path};case"remove":return{...N_(e),operation:"remove",path:e.path,recursive:e.recursive};case"move":return{...N_(e),from:e.from,operation:"move",to:e.to}}}function Obe(e){return{...N_(e),events:e.events.filter((t)=>t.operation==="add"||t.operation==="remove"||t.operation==="move").map((t)=>JU(t)),operation:"batch"}}function VU(e){switch(e.operation){case"add":case"remove":case"move":return JU(e);case"batch":return Obe(e);default:return null}}function M_(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function vl(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((r,o)=>`${n.slice(0,o+1).join("/")}/`)}function j_(e){return vl(e).at(-1)??null}function fS(e,t){if(t==null)return e;return e.startsWith(t)?e.slice(t.length):e}function dh(e){return e.endsWith("/")}var bS=(e)=>e.toLowerCase();function XU(e){let t=e.endsWith("/")?e.slice(0,-1):e,n=t.lastIndexOf("/");return n<0?t:t.slice(n+1)}function hS(e){return e.endsWith("/")?e.slice(0,-1):e}function yS(e,t){return t&&!e.endsWith("/")?`${e}/`:e}var eZ=(e)=>{let t=e.trim();if(t.length===0)return"";return(t.includes("\\")?t.replaceAll("\\","/"):t).toLowerCase()};var wS=Symbol("FILE_TREE_RENAME_VIEW"),Hbe=512,Ube=512;function Zbe(e){return e==="top"||e==="center"?e:"nearest"}function Ybe(e,t,n){if(e===0)return-1;if(n!=null){let r=t(n);if(r!=null)return r;let o=vl(n);for(let c=o.length-1;c>=0;c-=1){let l=o[c];if(l==null)continue;let d=t(l);if(d!=null)return d}}return 0}function Kbe(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??((o)=>e.visibleIndexByPath.get(o)??null);return{focusedIndex:Ybe(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var tZ=class e{static{Object.defineProperty(e.prototype,wS,{configurable:!0,value(){return{cancel:()=>{this.#xe()},commit:()=>{this.#Ee()},getPath:()=>this.#l,getValue:()=>this.#f,isActive:()=>this.#l!=null,setValue:(t)=>{this.#Ie(t)}}},writable:!0})}#e;#t=new Set;#c=new Map;#o=null;#r=null;#I=new Map;#P=new Map;#b=-1;#a=null;#h=!1;#Q=(t)=>-1;#y=new Map;#g=null;#p=null;#w=null;#k=null;#m=null;#q;#G;#N;#i=[];#z=new Int32Array(0);#O=new Int32Array(0);#V=void 0;#D=!1;#l=null;#f="";#S=!1;#B=new Set;#H=[];#U;#Z=null;#d=null;#M=null;#L=null;#v=null;#j=null;#X=null;#Be=0;#C=null;#s=new Set;#Y=0;#n;#ne=0;#ae=!1;#A=0;#K;constructor(t){let{dragAndDrop:n,fileTreeSearchMode:r,initialSearchQuery:o,initialSelectedPaths:c,renaming:l,onSearchChange:d,paths:p,preparedInput:A,...f}=t,b=AS({paths:p,preparedInput:A},"constructor",f.sort);if(this.#e=f,n!=null&&n!==!1)this.#o=n===!0?{}:n;if(this.#D=l!=null&&l!==!1,l!=null&&l!==!1&&l!==!0)this.#V=l.canRename,this.#G=l.onError,this.#q=l.onRename;this.#N=d,this.#U=r??"hide-non-matches",this.#n=this.#ie(b.paths,b.preparedInput);let h=c?.map((C)=>this.#R(C)).filter((C)=>C!=null)??[],w=h.at(-1)??null;if(h.length>0)this.#s=new Set(h),this.#C=w,this.#Y=1;if(this.#$(w,!1),o!=null)this.#W(o,!1);this.#K=this.#_e()}destroy(){this.#K?.(),this.#K=null,this.#c.clear(),this.#t.clear(),this.#y.clear(),this.#r=null,this.#se()}focusFirstItem(){if(this.#x().length>0)this.#E(0)}focusLastItem(){if(this.#A<=0)return;this.#F(),this.#E(this.#A-1)}focusNextItem(){this.#Ce(1)}focusParentItem(){if(this.#a==null)return;let t=j_(this.#a);if(t==null)return;let n=this.#T(t);if(n>=0)this.#E(n)}focusPath(t){let n=this.#n.getPathInfo(t)?.path??null;if(n==null)return;this.#F();let r=this.#T(n);if(r>=0)this.#E(r)}scrollToPath(t,n){let r=this.#n.getPathInfo(t)?.path??null;if(r==null)return;this.#F();let o=this.#Te(r);if(o<0)return;if(this.#ce(o)==null)return;if(n?.focus!==!1)this.#E(o,!1);this.#X={id:this.#Be+=1,offset:Zbe(n?.offset),visibleIndex:o},this.#u()}focusMountedPathFromInput(t){let n=this.#n.getPathInfo(t)?.path??null;if(n==null)return;let r=this.#T(n);if(r>=0)this.#E(r)}focusNearestPath(t){let n=this.resolveNearestVisiblePath(t);if(n==null)return null;let r=this.#T(n);if(r>=0)return this.#E(r),this.#x()[r]??n;return null}focusPreviousItem(){this.#Ce(-1)}getFocusedIndex(){return this.#b}getFocusedItem(){return this.#a==null?null:this.#le(this.#a)}getFocusedPath(){return this.#a}getScrollRequest(){return this.#X}clearScrollRequest(t){if(this.#X?.id===t)this.#X=null}resolveNearestVisiblePath(t){let n=this.#x();if(this.#A===0)return null;if(t==null)return this.#a??n[0]??null;let r=this.#n.getPathInfo(t)?.path??t,o=this.#T(r);if(o>=0)return n[o]??r;let c=this.#Qe(r);if(c!=null)return c;return this.#a??n[0]??null}getSelectedPaths(){return[...this.#s]}getSelectionVersion(){return this.#Y}getVisibleCount(){return this.#A}getVisibleRows(t,n){if(n<t||this.#A===0)return[];let r=Math.max(0,t),o=Math.min(this.#A-1,n);if(o<r)return[];let c=o-r+1;if(this.#v==null&&!this.#h&&o>=this.#i.length&&c<=Ube){let l=[];for(let d=r;d<=o;d+=1){let p=this.#n.getVisibleRowContext(d);if(p==null)break;l.push(this.#de(p))}return l}if(!this.#h&&o>=this.#i.length)this.#F();if(this.#v!=null){let l=Array.from({length:o-r+1},(f,b)=>this.#be(r+b)),d=new Map,p=l[0]??-1,A=p;for(let f=1;f<=l.length;f+=1){let b=l[f];if(b!=null&&b===A+1){A=b;continue}if(p>=0)this.#n.getVisibleSlice(p,A).forEach((h,w)=>{d.set(p+w,h)});if(b==null){p=-1,A=-1;continue}p=b,A=b}return Array.from({length:o-r+1},(f,b)=>{let h=r+b,w=this.#be(h),C=d.get(w),_=this.#i[w];if(C==null||_==null)throw Error(`Missing projection row for filtered visible index ${String(h)}`);return this.#re(C,h,w,{ancestorPaths:this.#me(w),path:_})})}return this.#n.getVisibleSlice(r,o).map((l,d)=>{let p=r+d,A=this.#i[p];if(A==null)throw Error(`Missing projection path for visible index ${String(p)}`);return this.#re(l,p,p,{ancestorPaths:this.#me(p),path:A})})}getStickyRowCandidates(t,n){if(this.#v!=null)return null;if(this.#A===0||t<=0||n<=0)return[];let r=[];for(let o=0;o<this.#A;o+=1){let c=t+o*n,l=Math.min(this.#A-1,Math.floor(c/n)),d=this.#ue(l,o)??(l>0?this.#ue(l-1,o):void 0);if(d==null)break;r.push({row:this.#de(d),subtreeEndIndex:d.subtreeEndIndex})}return r}getItem(t){let n=this.#n.getPathInfo(t);return n==null?null:this.#le(n.path,n)}resolveMountedDirectoryPathFromInput(t){let n=this.#n.getPathInfo(t);return n?.kind==="directory"?n.path:null}toggleMountedDirectoryFromInput(t){let n=this.resolveMountedDirectoryPathFromInput(t);if(n==null)return;this.#ve(n)}selectAllVisiblePaths(){this.#F();let t=[...this.#x()];this.#_(t,this.#a??this.#C)}selectOnlyPath(t){let n=this.#R(t);if(n==null)return;this.#_([n],n)}selectOnlyMountedPathFromInput(t){this.#_([t],t)}selectPath(t){let n=this.#R(t);if(n==null||this.#s.has(n))return;this.#_([...this.#s,n])}deselectPath(t){let n=this.#R(t);if(n==null||!this.#s.has(n))return;this.#_([...this.#s].filter((r)=>r!==n))}toggleFocusedSelection(){if(this.#a==null)return;this.togglePathSelectionFromInput(this.#a)}togglePathSelection(t){let n=this.#R(t);if(n==null)return;if(this.#s.has(n)){this.deselectPath(n);return}this.selectPath(n)}togglePathSelectionFromInput(t){let n=this.#R(t);if(n==null)return;if(this.#s.has(n)){this.#_([...this.#s].filter((r)=>r!==n),n);return}this.#_([...this.#s,n],n)}selectPathRange(t,n){let r=this.#R(t);if(r==null)return;this.#F();let o=this.#C,c=o==null?-1:this.#te(o),l=this.#te(r);if(c===-1||l===-1){let b=n?[...this.#s,r]:[r];this.#_(b,r);return}let[d,p]=c<=l?[c,l]:[l,c],A=this.#x().slice(d,p+1),f=n?[...this.#s,...A]:A;this.#_(f,o)}extendSelectionFromFocused(t){if(this.#a==null)return;let n=this.#b;if(n===-1)return;let r=Math.min(this.#A-1,Math.max(0,n+t));if(r===n)return;if(!this.#h&&r>=this.#i.length)this.#F();let o=this.#x(),c=o[n]??null,l=o[r]??null;if(c==null||l==null)return;let d=new Set(this.#s);if(d.has(c)&&d.has(l))d.delete(c);else d.add(l);this.#_([...d],this.#C??c,!1),this.#E(r)}getDragAndDropConfig(){return this.#o}isDragAndDropEnabled(){return this.#o!=null}getDragSession(){if(this.#r==null)return null;return{draggedPaths:[...this.#r.draggedPaths],primaryPath:this.#r.primaryPath,target:this.#r.target==null?null:{...this.#r.target}}}startDrag(t){if(this.#o==null)return!1;let n=this.#R(t);if(n==null)return!1;if(this.#d!=null&&this.#d.length>0)return!1;let r=this.getSelectedPaths(),o=YU(n,r);if(this.#o.canDrag?.(o)===!1)return!1;if(!r.includes(n))this.#_([n],n,!1);return this.#J(n),this.#r={draggedPaths:o,primaryPath:n,target:null},this.#u(),!0}setDragTarget(t){let n=this.#r;if(n==null)return;let r=t;if(r!=null){let o=pS(n.draggedPaths,r);if(mS(n.draggedPaths,r)||this.#o?.canDrop?.(o)===!1)r=null}if(KU(n.target,r))return;this.#r={...n,target:r},this.#u()}cancelDrag(){if(this.#r==null)return;this.#r=null,this.#u()}completeDrag(){let t=this.#r;if(t==null)return!1;this.#r=null;let n=t.target==null?null:{...t.target};if(n==null)return this.#u(),!1;let r=pS(t.draggedPaths,n);if(mS(t.draggedPaths,n)||this.#o?.canDrop?.(r)===!1)return this.#u(),!1;let o=WU(t.draggedPaths,n);if(o==null)return this.#u(),!1;try{if(o.operations.length===1){let c=o.operations[0];if(c==null||c.type!=="move")throw Error("Expected a single move operation for one-item drops");this.#n.move(c.from,c.to,{collision:c.collision})}else this.#Fe(o.operations),this.#n.batch(o.operations)}catch(c){return this.#u(),this.#o?.onDropError?.(c instanceof Error?c.message:String(c),r),!1}return this.#o?.onDropComplete?.(o.result),!0}subscribe(t){return this.#t.add(t),t(),()=>{this.#t.delete(t)}}add(t){this.#n.add(t)}remove(t,n={}){this.#n.remove(t,n)}move(t,n,r={}){this.#n.move(t,n,r)}batch(t){this.#n.batch(t)}onMutation(t,n){let r=t,o=n,c=this.#c.get(r);if(c==null)c=new Set,this.#c.set(r,c);return c.add(o),()=>{let l=this.#c.get(r);if(l?.delete(o),l?.size===0)this.#c.delete(r)}}setSearch(t){this.#W(t,!0)}openSearch(t=""){this.#W(t,!0)}closeSearch(){this.#W(null,!0)}isSearchOpen(){return this.#d!==null}getSearchValue(){return this.#d??""}getSearchMatchingPaths(){return this.#H}focusNextSearchMatch(){this.#he(1)}focusPreviousSearchMatch(){this.#he(-1)}startRenaming(t=this.#a??"",n={}){if(!this.#D)return!1;let r=this.#n.getPathInfo(t);if(r==null)return!1;let o=r.path,c=dh(o),l=hS(o);if(this.#V?.({isFolder:c,path:l})===!1)return!1;for(let d of vl(o))if(!this.#n.isExpanded(d))this.#n.expand(d);if(this.#_([o],o,!1),this.#d!=null)this.#W(null,!1),this.#N?.(this.#d);return this.#J(o),this.#l=o,this.#f=XU(o),this.#S=n.removeIfCanceled??!1,this.#u(),!0}#xe(){if(this.#l==null)return;let t=this.#l,n=this.#S;if(this.#l=null,this.#f="",this.#S=!1,n){this.remove(t,dh(t)?{recursive:!0}:void 0);return}this.#J(t),this.#u()}#Ee(){let t=this.#l;if(t==null)return;if(this.#S&&this.#f.trim().length===0){this.#l=null,this.#f="",this.#S=!1,this.remove(t,dh(t)?{recursive:!0}:void 0);return}let n=dh(t),r=ZU({files:this.#n.list(),isFolder:n,nextBasename:this.#f,path:hS(t)});if(this.#l=null,this.#f="",this.#S=!1,"error"in r){this.#J(t),this.#G?.(r.error),this.#u();return}if(r.sourcePath===r.destinationPath){this.#J(t),this.#u();return}this.#q?.({destinationPath:r.destinationPath,isFolder:r.isFolder,sourcePath:r.sourcePath}),this.move(yS(r.sourcePath,n),yS(r.destinationPath,n))}#Ie(t){if(this.#l==null||this.#f===t)return;this.#f=t,this.#u()}resetPaths(t,n={}){let r=!Array.isArray(t),o=r?void 0:t,c=r?t:n,l=this.#n.list().length,d=this.#A,p=AS({paths:o,preparedInput:c.preparedInput},"resetPaths",this.#e.sort),A=this.#ie(p.paths,p.preparedInput,c.initialExpandedPaths),f=this.#a,b=this.#l,h=this.getSelectedPaths(),w=this.#C;this.#K?.(),this.#n=A,this.#y.clear(),this.#se();let C=h.map((v)=>A.getPathInfo(v)?.path??null).filter((v)=>v!=null),_=!M_(this.#s,C);if(this.#s=new Set(C),_)this.#Y+=1;if(this.#C=w==null?null:A.getPathInfo(w)?.path??null,this.#l=b==null?null:A.getPathInfo(b)?.path??null,this.#l==null)this.#f="",this.#S=!1;this.#$(f,f!=null||C.length>0||this.#C!=null),this.#K=this.#_e(),this.#u(),this.#we({canonicalChanged:!0,operation:"reset",pathCountAfter:p.paths.length,pathCountBefore:l,projectionChanged:!0,usedPreparedInput:c.preparedInput!=null,visibleCountDelta:this.#A-d})}#Qe(t){this.#F();let n=j_(t),r=fS(t,n),o=null,c=null;for(let l of this.#x()){if(j_(l)!==n)continue;let d=fS(l,n);if(d<r){o=l;continue}if(d>r){c=l;break}}return o??c}#T(t){let n=this.#te(t);if(n!==-1)return n;let r=vl(t);for(let o=r.length-1;o>=0;o-=1){let c=r[o];if(c==null)continue;let l=this.#te(c);if(l!==-1)return l}return this.#x().length>0?0:-1}#le(t,n){let r=this.#y.get(t);if(r!=null)return r;let o=n??this.#n.getPathInfo(t);if(o==null)return null;let c=o.kind==="directory"?this.#De(o.path):this.#Se(o.path);return this.#y.set(o.path,c),c}#re(t,n,r,o){return{ancestorPaths:o.ancestorPaths,depth:t.depth,flattenedSegments:t.flattenedSegments?.map((c)=>({isTerminal:c.isTerminal,name:c.name,path:c.path})),hasChildren:t.hasChildren,index:n,isExpanded:t.isExpanded,isFlattened:t.isFlattened,isFocused:o.path===this.#a,isSelected:this.#s.has(o.path),kind:t.kind,level:t.depth,name:t.name,path:o.path,posInSet:o.posInSet??this.#z[r]??0,setSize:o.setSize??this.#O[r]??0}}#de(t){return this.#re(t.row,t.index,t.index,{ancestorPaths:t.ancestorPaths,path:t.row.path,posInSet:t.posInSet,setSize:t.setSize})}#ue(t,n){let r=this.#n.getVisibleRowContext(t);if(r==null)return;let o=r.ancestorRows[n];if(o!=null)return o;return n===r.ancestorRows.length&&r.row.kind==="directory"&&r.row.isExpanded?r:void 0}#pe(t){let n=this.#I.get(t);if(n!=null)return n;let r=this.#Q(t),o=r<0?[]:[...this.#pe(r),r];return this.#I.set(t,o),o}#me(t){let n=this.#P.get(t);if(n!=null)return n;let r=this.#pe(t).map((o)=>this.#i[o]??"").filter((o)=>o!=="");return this.#P.set(t,r),r}#Ae(t){this.#n.collapse(t)}#_(t,n=this.#C,r=!0){let o=[...new Set(t)],c=!M_(this.#s,o),l=this.#C!==n;if(!c&&!l)return;if(this.#s=new Set(o),this.#C=n,c)this.#Y+=1;if(r)this.#u()}#De(t){return{collapse:()=>{this.#Ae(t)},deselect:()=>{this.deselectPath(t)},expand:()=>{this.#ke(t)},focus:()=>{this.focusPath(t)},getPath:()=>t,isDirectory:()=>!0,isExpanded:()=>this.#n.isExpanded(t),isFocused:()=>this.#a===t,isSelected:()=>this.#s.has(t),select:()=>{this.selectPath(t)},toggleSelect:()=>{this.togglePathSelection(t)},toggle:()=>{this.#ve(t)}}}#Se(t){return{deselect:()=>{this.deselectPath(t)},focus:()=>{this.focusPath(t)},getPath:()=>t,isDirectory:()=>!1,isFocused:()=>this.#a===t,isSelected:()=>this.#s.has(t),select:()=>{this.selectPath(t)},toggleSelect:()=>{this.togglePathSelection(t)}}}#Fe(t){let n=this.#n.list();this.#ie(n).batch(t)}#ie(t,n,r){return new R_({...this.#e,paths:t,preparedInput:n==null?void 0:n,...r!==void 0?{initialExpandedPaths:r}:{}})}#oe(){if(this.#k!=null)return this.#k;return this.#k=this.#n.list(),this.#k}#Le(){if(this.#w!=null)return this.#w;let t=new Set;for(let n of this.#oe()){t.add(n);for(let r of vl(n))t.add(r)}return this.#w=[...t].sort(),this.#w}#Re(){if(this.#m!=null)return this.#m;return this.#m=this.#oe().map(bS),this.#m}#ee(){if(this.#g!=null)return this.#g;return this.#g=this.#Le().filter((t)=>t.endsWith("/")),this.#g}#Ne(){if(this.#p!=null)return this.#p;return this.#p=this.#ee().map(bS),this.#p}#se(){this.#g=null,this.#p=null,this.#w=null,this.#k=null,this.#m=null}#Me(){return this.#ee().filter((t)=>this.#n.isExpanded(t))}#ge(t){let n=new Set(this.#Z??[]);if(t)for(let r of this.#s)for(let o of vl(r))n.add(o);this.#fe(n)}#fe(t){this.#ae=!0;try{for(let n of this.#ee()){let r=t.has(n),o=this.#n.isExpanded(n);if(r&&!o)this.#n.expand(n);else if(!r&&o)this.#n.collapse(n)}}finally{this.#ae=!1}}#je(){if(this.#d==null||this.#d.length===0){this.#H=[],this.#v=null,this.#j=null,this.#L=null,this.#A=this.#ne;return}let t=this.#i;if(this.#H=t.filter((c)=>this.#B.has(c)),this.#U!=="hide-non-matches"||this.#B.size===0){this.#v=null,this.#j=null,this.#L=null,this.#A=this.#ne;return}let n=[],r=[],o=new Map;for(let[c,l]of t.entries()){if(this.#M?.has(l)!==!0)continue;o.set(l,r.length),n.push(c),r.push(l)}this.#v=n,this.#j=r,this.#L=o,this.#A=r.length}#x(){return this.#j??this.#i}#Te(t){if(this.#j!=null)return this.#L?.get(t)??-1;return this.#n.getVisibleIndex(t)??-1}#be(t){return this.#v?.[t]??t}#te(t){let n=this.#L?.get(t);if(n!=null)return n;return this.#n.getVisibleIndex(t)??-1}#he(t){let n=this.#H;if(n.length===0)return;let r=this.#a,o=r==null?-1:n.indexOf(r),c=n[o<0?t>0?0:n.length-1:Math.min(n.length-1,Math.max(0,o+t))];if(c!=null)this.focusPath(c)}#W(t,n){let r=t==null?null:eZ(t),o=this.#d;if(o===r)return;if(o==null&&r!=null)this.#Z=this.#Me();if(this.#d=r,r==null)this.#ge(!0),this.#Z=null,this.#B.clear(),this.#M=null,this.#$(this.#a,!0);else if(r.length===0)this.#ge(!1),this.#B.clear(),this.#M=null,this.#$(this.#a,!0);else{let c=this.#ye();this.#$(c,!0)}if(n)this.#N?.(this.#d),this.#u()}#ye(){if(this.#d==null||this.#d.length===0)return this.#B.clear(),this.#a;let t=this.#d,n=this.#oe(),r=this.#Re(),o=[],c=new Set,l=null;for(let b=0;b<n.length;b+=1){if(!r[b].includes(t))continue;let h=n[b];o.push(h),c.add(h),l??=h}let d=this.#ee(),p=this.#Ne();for(let b=0;b<d.length;b+=1){if(!p[b].includes(t))continue;let h=d[b];if(c.has(h))continue;o.push(h),c.add(h),l??=h}this.#B=c;let A=this.#U==="hide-non-matches"&&o.length>0?new Set:null;this.#M=A;let f=this.#U==="expand-matches"?new Set(this.#Z??[]):new Set;for(let b of o){if(A!=null)A.add(b);if(b.endsWith("/"))f.add(b);for(let h of vl(b))if(f.add(h),A!=null)A.add(h)}return this.#fe(f),l??this.#a}#u(){for(let t of this.#t)t()}#we(t){this.#c.get(t.operation)?.forEach((n)=>{n(t)}),this.#c.get("*")?.forEach((n)=>{n(t)})}#ke(t){for(let n of vl(t)){if(this.#n.isExpanded(n))continue;this.#n.expand(n)}if(!this.#n.isExpanded(t))this.#n.expand(t)}#Ce(t){let n=this.#A;if(n===0)return;let r=this.#b===-1?0:this.#b,o=Math.min(n-1,Math.max(0,r+t));if(o!==r||this.#b===-1){if(!this.#h&&this.#v==null&&o>=this.#i.length)this.#F();this.#E(o)}}#$(t,n=!0){let r=this.#n.getVisibleCount();this.#ne=r;let o=Kbe(this.#n.getVisibleTreeProjectionData(n?void 0:Math.min(r,Hbe)),t,n?(c)=>this.#n.getVisibleIndex(c):void 0);this.#I.clear(),this.#P.clear(),this.#h=o.paths.length>=r,this.#Q=o.getParentIndex,this.#i=o.paths,this.#z=o.posInSetByIndex,this.#O=o.setSizeByIndex,this.#je(),this.#b=t==null?this.#x().length>0?0:-1:this.#T(t),this.#a=this.#b<0?null:this.#ce(this.#b)}#ce(t){let n=this.#x()[t];if(n!=null)return n;if(this.#v!=null)return null;return this.#n.getVisibleRowContext(t)?.row.path??null}#R(t){return this.#n.getPathInfo(t)?.path??null}#J(t){if(t==null)return;let n=this.#T(t);if(n>=0)this.#E(n,!1)}#E(t,n=!0){let r=this.#ce(t);if(r==null)return;if(this.#b===t&&this.#a===r)return;if(this.#b=t,this.#a=r,n)this.#u()}#F(){if(this.#h)return;this.#$(this.#a,!0)}#$e(t){let n=SA(this.#l,t);if(n==null&&this.#l!=null)this.#f="";this.#l=n;let r=SA(this.#a,t,!0),o=[...this.#s].map((p)=>SA(p,t)).filter((p)=>p!=null).map((p)=>this.#n.getPathInfo(p)?.path??null).filter((p)=>p!=null),c=SA(this.#C,t),l=c==null?null:this.#n.getPathInfo(c)?.path??null,d=[...new Set(o)];if(!M_(this.#s,d))this.#s=new Set(d),this.#Y+=1;return this.#C=l,r}#_e(){return this.#n.on("*",(t)=>{if(this.#ae)return;if(t.canonicalChanged)this.#y.clear(),this.#se();if(this.#r!=null&&gS(t))this.#r=null;let n=gS(t)?this.#$e(t):this.#a,r=this.#d!=null&&this.#d.length>0?this.#ye():this.#d===""?this.#a:n,o=this.#d!=null||t.operation!=="expand"&&t.operation!=="collapse";this.#$(r,o),this.#u();let c=VU(t);if(c!=null)this.#we(c)})}#ve(t){if(this.#n.isExpanded(t)){this.#Ae(t);return}this.#ke(t)}};var nZ=(e)=>{if(e==null||e.length===0)return"0";let t=`${e.length}`;for(let n of e)t+=`\x00${n.path}\x00${n.status}`;return t};function aZ(e){let t=e.endsWith("/"),n="",r=-1;for(let o=0;o<=e.length;o+=1){if(!(e[o]==="/"||o===e.length)){if(r===-1)r=o;continue}if(r===-1)continue;if(n!=="")n+="/";n+=e.slice(r,o),r=-1}if(n==="")return null;return{isDirectory:t,path:n}}function rZ(e){let t=e.endsWith("/")?e.slice(0,-1):e;if(t.length===0)return[];let n=[],r=0;for(;;){let o=t.indexOf("/",r);if(o===-1)break;n.push(t.slice(0,o+1)),r=o+1}return n}function Wbe(e,t){return t?`${e}/`:e}function kS(e,t=null){let n=nZ(e==null?void 0:[...e]);if(n==="0")return null;if(t?.signature===n)return t;let r=new Map,o=new Set,c=new Set,l=new Map;for(let d of e??[]){let p=oZ(d);if(p==null)continue;cZ({canonicalPath:p.canonicalPath,changeCountByDirectoryPath:l,directoriesWithChanges:o,ignoredDirectoryPaths:c,isDirectory:p.isDirectory,status:d.status,statusByPath:r})}if(r.size===0)return null;return{changeCountByDirectoryPath:l,directoriesWithChanges:o,ignoredDirectoryPaths:c,signature:n,statusByPath:r}}function iZ(e,t){let n=t?.remove??[],r=t?.set??[];if(n.length===0&&r.length===0)return e;let o=new Map(e?.statusByPath),c=new Set(e?.directoriesWithChanges),l=new Set(e?.ignoredDirectoryPaths),d=new Map(e?.changeCountByDirectoryPath),p=!1;for(let A of n){let f=sZ(A);if(f==null)continue;p=Jbe({canonicalPath:f.canonicalPath,changeCountByDirectoryPath:d,directoriesWithChanges:c,ignoredDirectoryPaths:l,statusByPath:o})||p}for(let A of r){let f=oZ(A);if(f==null)continue;p=cZ({canonicalPath:f.canonicalPath,changeCountByDirectoryPath:d,directoriesWithChanges:c,ignoredDirectoryPaths:l,isDirectory:f.isDirectory,status:A.status,statusByPath:o})||p}if(!p)return e;if(o.size===0)return null;return{changeCountByDirectoryPath:d,directoriesWithChanges:c,ignoredDirectoryPaths:l,signature:ehe(o),statusByPath:o}}function oZ(e){return sZ(e.path)}function sZ(e){let t=aZ(e);if(t==null)return;return{canonicalPath:Wbe(t.path,t.isDirectory),isDirectory:t.isDirectory}}function Jbe({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,statusByPath:o}){let c=o.get(e);if(c==null)return!1;if(o.delete(e),c==="ignored"&&e.endsWith("/"))r.delete(e);return Xbe(t,n,e),!0}function cZ({canonicalPath:e,changeCountByDirectoryPath:t,directoriesWithChanges:n,ignoredDirectoryPaths:r,isDirectory:o,status:c,statusByPath:l}){let d=l.get(e);if(d===c)return!1;if(d==null)Vbe(t,n,e);if(l.set(e,c),c==="ignored"&&o)r.add(e);else if(o)r.delete(e);return!0}function Vbe(e,t,n){for(let r of rZ(n))e.set(r,(e.get(r)??0)+1),t.add(r)}function Xbe(e,t,n){for(let r of rZ(n)){let o=(e.get(r)??0)-1;if(o>0)e.set(r,o);else e.delete(r),t.delete(r)}}function ehe(e){let t=`${e.size}`;for(let[n,r]of e)t+=`\x00${n}\x00${r}`;return t}var the=(e)=>e.trim().toLowerCase(),nhe=(e)=>e.split("/").at(-1)??e,ahe=(e)=>{let t=e.toLowerCase().split("."),n=[];for(let r=1;r<t.length;r+=1)n.push(t.slice(r).join("."));return n};function uh(e,t){if(typeof e==="string")return{name:e,remappedFrom:t};return{...e,remappedFrom:t}}function lZ(e){let t=vA(e),n=t.remap,r=new Map;for(let[d,p]of Object.entries(t.byFileName??{}))r.set(d.toLowerCase(),p);let o=new Map;for(let[d,p]of Object.entries(t.byFileExtension??{}))o.set(the(d),p);let c=Object.entries(t.byFileNameContains??{}).map(([d,p])=>[d.toLowerCase(),p]);return{resolveIcon:(d,p)=>{if(d==="file-tree-icon-file"&&p!=null){let f=nhe(p),b=f.toLowerCase(),h=r.get(b);if(h!=null)return uh(h,d);for(let[_,v]of c)if(b.includes(_))return uh(v,d);let w=ahe(f);for(let _ of w){let v=o.get(_);if(v!=null)return uh(v,d)}let C=fH(t.set,f,w);if(C!=null&&t.set!=="none"){if(C==="default"){let _=n?.[d];if(_!=null)return uh(_,d)}return{name:AH(C),remappedFrom:d,token:C}}}let A=n?.[d];if(A==null)return{name:d};return uh(A,d)}}}var dn,AZ,rhe,Fp,dZ,q_,gZ,fZ,BS,CS,_S,ihe,ph={},bZ=[],G_=Array.isArray,xS=bZ.slice,Xd=Object.assign;function ES(e){e&&e.parentNode&&e.remove()}function LA(e,t,n){var r,o,c,l={};for(c in t)c=="key"?r=t[c]:c=="ref"&&typeof e!="function"?o=t[c]:l[c]=t[c];return arguments.length>2&&(l.children=arguments.length>3?xS.call(arguments,2):n),$_(e,l,r,o,null)}function $_(e,t,n,r,o){var c={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o==null?++AZ:o,__i:-1,__u:0};return o==null&&dn.vnode!=null&&dn.vnode(c),c}function bc(e){return e.children}function P_(e,t){this.props=e,this.context=t,this.__g=0}function FA(e,t){if(t==null)return e.__?FA(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"?FA(e):null}function hZ(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 hZ(e)}}function uZ(e){(8&e.__g||!(e.__g|=8)||!Fp.push(e)||q_++)&&dZ==dn.debounceRendering||((dZ=dn.debounceRendering)||queueMicrotask)(ohe)}function ohe(){for(var e,t,n,r,o,c,l,d,p=1;Fp.length;)Fp.length>p&&Fp.sort(gZ),e=Fp.shift(),p=Fp.length,8&e.__g&&(n=void 0,o=(r=(t=e).__v).__e,c=[],l=[],(d=t.__P)&&((n=Xd({},r)).__v=r.__v+1,dn.vnode&&dn.vnode(n),IS(d,n,r,t.__n,d.namespaceURI,32&r.__u?[o]:null,c,o==null?FA(r):o,!!(32&r.__u),l,d.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,kZ(c,n,l),n.__e!=o&&hZ(n)));q_=0}function yZ(e,t,n,r,o,c,l,d,p,A,f,b){var h,w,C,_,v,B,E,I=r&&r.__k||bZ,D=t.length;for(p=she(n,t,I,p,D),h=0;h<D;h++)(C=n.__k[h])!=null&&(w=C.__i==-1?ph:I[C.__i]||ph,C.__i=h,B=IS(e,C,w,o,c,l,d,p,A,f,b),_=C.__e,C.ref&&w.ref!=C.ref&&(w.ref&&QS(w.ref,null,C),f.push(C.ref,C.__c||_,C)),v==null&&_!=null&&(v=_),(E=!!(4&C.__u))||w.__k===C.__k?p=wZ(C,p,e,E):typeof C.type=="function"&&B!==void 0?p=B:_&&(p=_.nextSibling),C.__u&=-7);return n.__e=v,p}function she(e,t,n,r,o){var c,l,d,p,A,f=n.length,b=f,h=0;for(e.__k=Array(o),c=0;c<o;c++)(l=t[c])!=null&&typeof l!="boolean"&&typeof l!="function"?(p=c+h,(l=e.__k[c]=typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?$_(null,l,null,null,null):G_(l)?$_(bc,{children:l},null,null,null):l.constructor==null&&l.__b>0?$_(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):l).__=e,l.__b=e.__b+1,d=null,(A=l.__i=che(l,n,p,b))!=-1&&(b--,(d=n[A])&&(d.__u|=2)),d==null||d.__v==null?(A==-1&&(o>f?h--:o<f&&h++),typeof l.type!="function"&&(l.__u|=4)):A!=p&&(A==p-1?h--:A==p+1?h++:(A>p?h--:h++,l.__u|=4))):e.__k[c]=null;if(b)for(c=0;c<f;c++)(d=n[c])!=null&&(2&d.__u)==0&&(d.__e==r&&(r=FA(d)),_Z(d,d));return r}function wZ(e,t,n,r){var o,c;if(typeof e.type=="function"){for(o=e.__k,c=0;o&&c<o.length;c++)o[c]&&(o[c].__=e,t=wZ(o[c],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=FA(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function che(e,t,n,r){var o,c,l,d=e.key,p=e.type,A=t[n],f=A!=null&&(2&A.__u)==0;if(A===null&&e.key==null||f&&d==A.key&&p==A.type)return n;if(r>(f?1:0)){for(o=n-1,c=n+1;o>=0||c<t.length;)if((A=t[l=o>=0?o--:c++])!=null&&(2&A.__u)==0&&d==A.key&&p==A.type)return l}return-1}function pZ(e,t,n){t[0]=="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":n}function T_(e,t,n,r,o){var c;e: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||pZ(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||pZ(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")c=t!=(t=t.replace(fZ,"$1")),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||(e.__l={}),e.__l[t+c]=n,n?r?n.l=r.l:(n.l=BS,e.addEventListener(t,c?_S:CS,c)):e.removeEventListener(t,c?_S:CS,c);else{if(o=="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==null?"":n;break e}catch(l){}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function mZ(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=BS++;else if(t.u<n.l)return;return n(dn.event?dn.event(t):t)}}}function IS(e,t,n,r,o,c,l,d,p,A,f){var b,h,w,C,_,v,B,E,I,D,F,M,P,q,W,Z,ye,ne,re,ce,ae,V=t.type;if(t.constructor!=null)return null;128&n.__u&&(p=!!(32&n.__u),n.__c.__z&&(d=t.__e=n.__e=(c=n.__c.__z)[0],n.__c.__z=null)),(b=dn.__b)&&b(t);e:if(typeof V=="function")try{if(E=t.props,I="prototype"in V&&V.prototype.render,D=(b=V.contextType)&&r[b.__c],F=b?D?D.props.value:b.__:r,n.__c?2&(h=t.__c=n.__c).__g&&(h.__g|=1,B=!0):(I?t.__c=h=new V(E,F):(t.__c=h=new P_(E,F),h.constructor=V,h.render=dhe),D&&D.sub(h),h.props=E,h.state||(h.state={}),h.context=F,h.__n=r,w=!0,h.__g|=8,h.__h=[],h._sb=[]),I&&h.__s==null&&(h.__s=h.state),I&&V.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=Xd({},h.__s)),Xd(h.__s,V.getDerivedStateFromProps(E,h.__s))),C=h.props,_=h.state,h.__v=t,w)I&&V.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),I&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(I&&V.getDerivedStateFromProps==null&&E!==C&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(E,F),!(4&h.__g)&&h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(E,h.__s,F)===!1||t.__v==n.__v){for(t.__v!=n.__v&&(h.props=E,h.state=h.__s,h.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(se){se&&(se.__=t)}),M=0;M<h._sb.length;M++)h.__h.push(h._sb[M]);h._sb=[],h.__h.length&&l.push(h);break e}h.componentWillUpdate!=null&&h.componentWillUpdate(E,h.__s,F),I&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(C,_,v)})}if(h.context=F,h.props=E,h.__P=e,h.__g&=-5,P=dn.__r,q=0,I){for(h.state=h.__s,h.__g&=-9,P&&P(t),b=h.render(h.props,h.state,h.context),W=0;W<h._sb.length;W++)h.__h.push(h._sb[W]);h._sb=[]}else do h.__g&=-9,P&&P(t),b=h.render(h.props,h.state,h.context),h.state=h.__s;while(8&h.__g&&++q<25);h.state=h.__s,h.getChildContext!=null&&(r=Xd({},r,h.getChildContext())),I&&!w&&h.getSnapshotBeforeUpdate!=null&&(v=h.getSnapshotBeforeUpdate(C,_)),Z=b,b!=null&&b.type===bc&&b.key==null&&(Z=CZ(b.props.children)),d=yZ(e,G_(Z)?Z:[Z],t,n,r,o,c,l,d,p,A,f),t.__u&=-161,h.__h.length&&l.push(h),B&&(h.__g&=-4)}catch(se){if(t.__v=null,p||c!=null)if(se.then){for(ye=0,ne=!1,t.__u|=p?160:128,t.__c.__z=[],re=0;re<c.length;re++)(ce=c[re])==null||ne||(ce.nodeType==8&&ce.data=="$s"?(ye>0&&t.__c.__z.push(ce),ye++,c[re]=null):ce.nodeType==8&&ce.data=="/$s"?(--ye>0&&t.__c.__z.push(ce),ne=ye===0,d=c[re],c[re]=null):ye>0&&(t.__c.__z.push(ce),c[re]=null));if(!ne){for(;d&&d.nodeType==8&&d.nextSibling;)d=d.nextSibling;c[c.indexOf(d)]=null,t.__c.__z=[d]}t.__e=d}else{for(ae=c.length;ae--;)ES(c[ae]);vS(t)}else t.__e=n.__e,t.__k=n.__k,se.then||vS(t);dn.__e(se,t,n)}else d=t.__e=lhe(n.__e,t,n,r,o,c,l,p,A,f);return(b=dn.diffed)&&b(t),128&t.__u?void 0:d}function vS(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(vS)}function kZ(e,t,n){for(var r=0;r<n.length;r++)QS(n[r],n[++r],n[++r]);dn.__c&&dn.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(c){c.call(o)})}catch(c){dn.__e(c,o.__v)}})}function CZ(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:G_(e)?e.map(CZ):Xd({},e)}function lhe(e,t,n,r,o,c,l,d,p,A){var f,b,h,w,C,_,v,B,E=n.props,I=t.props,D=t.type;if(D=="svg"?o="http://www.w3.org/2000/svg":D=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),c!=null){for(f=0;f<c.length;f++)if((C=c[f])&&"setAttribute"in C==!!D&&(D?C.localName==D:C.nodeType==3)){e=C,c[f]=null;break}}if(e==null){if(D==null)return A.createTextNode(I);e=A.createElementNS(o,D,I.is&&I),d&&(dn.__m&&dn.__m(t,c),d=!1),c=null}if(D==null)E===I||d&&e.data==I||(e.data=I);else{if(c=c&&xS.call(e.childNodes),E=n.props||ph,!d&&c!=null)for(E={},f=0;f<e.attributes.length;f++)E[(C=e.attributes[f]).name]=C.value;for(f in E)if(C=E[f],f=="children");else if(f=="dangerouslySetInnerHTML")h=C;else if(!(f in I)){if(f=="value"&&"defaultValue"in I||f=="checked"&&"defaultChecked"in I)continue;T_(e,f,null,C,o)}for(f in B=1&n.__u,I)C=I[f],f=="children"?w=C:f=="dangerouslySetInnerHTML"?b=C:f=="value"?_=C:f=="checked"?v=C:d&&typeof C!="function"||E[f]===C&&!B||T_(e,f,C,E[f],o);if(b)d||h&&(b.__html==h.__html||b.__html==e.innerHTML)||(e.innerHTML=b.__html),t.__k=[];else if(h&&(e.innerHTML=""),yZ(D=="template"?e.content:e,G_(w)?w:[w],t,n,r,D=="foreignObject"?"http://www.w3.org/1999/xhtml":o,c,l,c?c[0]:n.__k&&FA(n,0),d,p,A),c!=null)for(f=c.length;f--;)ES(c[f]);d||(f="value",D=="progress"&&_==null?e.removeAttribute("value"):_==null||_===e[f]&&(D!=="progress"||_)||T_(e,f,_,E[f],o),f="checked",v!=null&&v!=e[f]&&T_(e,f,v,E[f],o))}return e}function QS(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(o){dn.__e(o,n)}}function _Z(e,t,n){var r,o;if(dn.unmount&&dn.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||QS(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(c){dn.__e(c,t)}r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&_Z(r[o],t,n||typeof e.type!="function");n||ES(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function dhe(e,t,n){return this.constructor(e,n)}function z_(e,t){var n,r,o,c;t==document&&(t=document.documentElement),dn.__&&dn.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=LA(bc,null,[e]),o=[],c=[],IS(t,e,r||ph,ph,t.namespaceURI,r?null:t.firstChild?xS.call(t.childNodes):null,o,r?r.__e:t.firstChild,n,c,t.ownerDocument),kZ(o,e,c)}function vZ(e,t){e.__u|=32,z_(e,t)}dn={__e:function(e,t,n,r){for(var o,c,l;t=t.__;)if((o=t.__c)&&!(1&o.__g)){o.__g|=4;try{if((c=o.constructor)&&c.getDerivedStateFromError!=null&&(o.setState(c.getDerivedStateFromError(e)),l=8&o.__g),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),l=8&o.__g),l)return void(o.__g|=2)}catch(d){e=d}}throw q_=0,e}},AZ=0,rhe=function(e){return e!=null&&e.constructor==null},P_.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Xd({},this.state),typeof e=="function"&&(e=e(Xd({},n),this.props)),e&&Xd(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),uZ(this))},P_.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),uZ(this))},P_.prototype.render=bc,Fp=[],q_=0,gZ=function(e,t){return e.__v.__b-t.__v.__b},fZ=/(PointerCapture)$|Capture$/i,BS=0,CS=mZ(!1),_S=mZ(!0),ihe=0;var uhe=0;function Ne(e,t,n,r,o,c){t||(t={});var l,d,p=t;if("ref"in p&&typeof e!="function")for(d in p={},t)d=="ref"?l=t[d]:p[d]=t[d];var A={type:e,props:p,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--uhe,__i:-1,__u:0,__source:o,__self:c};return dn.vnode&&dn.vnode(A),A}var phe=16,mhe=16,Ahe={};function RA({name:e,remappedFrom:t,token:n,width:r,height:o,viewBox:c,label:l,alignCapitals:d=!1}){let p=`#${e.replace(/^#/,"")}`,{width:A,height:f,viewBox:b}=Ahe[e]??{width:phe,height:mhe},h=r??A,w=o??f,C=c??b??`0 0 ${A} ${f}`;return Ne("svg",{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":d,...l!=null?{"aria-label":l,role:"img"}:{"aria-hidden":!0},viewBox:C,width:h,height:w,children:Ne("use",{href:p})})}var BZ=(e)=>e!==void 0&&/\s/.test(e),ghe=(e,t)=>{let n=(r)=>BZ(e[r-1])||BZ(e[r]);if(!n(t))return t;for(let r=1;r<e.length;r++){let o=t-r;if(o>0&&!n(o))return o;let c=t+r;if(c<e.length&&!n(c))return c}return t},EZ=(e)=>ghe(e,Math.ceil(e.length/2)),xZ=(e)=>{if(e.length<2)return[e,""];let t=EZ(e);return[e.slice(0,t),e.slice(t)]},fhe=(e)=>{if(e.length<4)return[e,""];let t=e.lastIndexOf(".")+1,n=e.length-t>10,r=t>=1&&!n?t:EZ(e);return[e.slice(0,r),e.slice(r)]},bhe=(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)]},hhe=(e,{splitIndex:t}={})=>{if(typeof t!=="number"){let n=Math.ceil(e.length/2);return[e.slice(0,n),e.slice(n)]}return[e.slice(0,t),e.slice(t)]},yhe=(e,{splitOffset:t}={})=>{if(typeof t!=="number"||t<=0||t>=e.length){let r=Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},whe=(e,{splitOffset:t}={})=>{if(typeof t!=="number"||t<=0||t>=e.length){let r=Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]}let n=t;return[e.slice(0,n),e.slice(n)]};function khe({children:e,marker:t,variant:n="default"}){return Ne("div",{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:Ne("div",{"data-truncate-marker":!0,children:typeof t==="function"?t({children:e}):n==="fade"?Ne("span",{"data-truncate-fade":!0}):t})})}function Che(e){let{mode:t,children:n}=e;return Ne("div",{children:[Ne("div",{"data-truncate-content":"visible",children:t==="fruncate"?Ne("span",{children:n}):n}),Ne("div",{"data-truncate-content":"overflow","aria-hidden":!0,children:t==="fruncate"?Ne("span",{children:n}):n})]})}function IZ({children:e,mode:t="truncate",marker:n="…",variant:r="default",...o}){let c=Ne(Che,{mode:t,children:e},"content"),l=Ne(khe,{marker:n,mode:t,variant:r},"marker");return Ne("div",{"data-truncate-container":t,"data-truncate-variant":r,...o,children:Ne("div",{"data-truncate-grid":!0,children:t==="truncate"?[c,l]:[l,c,Ne("div",{"data-truncate-fill":!0},"fill")]})})}function mh({children:e,...t}){return Ne(IZ,{mode:"truncate",...t,children:e})}function DS({children:e,...t}){return Ne(IZ,{mode:"fruncate",...t,children:e})}function QZ({children:e,contents:t,priority:n="end",split:r="center",minimumLength:o=12,className:c,style:l,...d}){let p=null,A=null;if(Array.isArray(t)){if(t.length!==2)return console.error("MiddleTruncate: contents must be an array of two items"),null;p=Ne(mh,{...d,children:t[0]}),A=Ne(DS,{...d,children:t[1]})}else{if(typeof e!=="string")return console.error("MiddleTruncate: children must be a string"),null;if(e.length===0)return Ne("div",{className:c,style:l});if(e.length<o)if(n==="end")return Ne(DS,{...d,className:c,style:l,children:e});else return Ne(mh,{...d,className:c,style:l,children:e});let f=null,b=null,h=null;if(typeof r==="string"){if(r==="center")f=xZ;else if(r==="extension")f=fhe;else if(r==="leaf-path")f=bhe}else if(typeof r==="number")f=hhe,b=r;else if(Array.isArray(r)){let[D,F]=r;if(h=F,D==="last")f=yhe;else if(D==="first")f=whe}else if(typeof r==="function")f=r;f??=xZ;let[w,C]=f(e,{priority:n,variant:d.variant,splitIndex:typeof b==="number"?b:void 0,splitOffset:typeof h==="number"?h:void 0}),_=w.length>=C.length,v=n==="equal"&&!_,B=n==="equal"&&_,E={},I={};if(v)E.marker="";if(B)I.marker="";p=Ne(mh,{...d,...E,children:w}),A=Ne(DS,{...d,...I,children:C})}return Ne("div",{"data-truncate-group-container":"middle",className:c,style:l,children:[Ne("div",{"data-truncate-segment-priority":n==="start"||n==="equal"?"1":"2",children:p}),Ne("div",{"data-truncate-segment-priority":n==="end"||n==="equal"?"1":"2",children:A})]})}var SS={endIndex:-1,startIndex:-1};function _he(e,t,n){return Math.min(Math.max(e,t),n)}function DZ(e,t){return e<0||t<e?SS:{endIndex:t,startIndex:e}}function FS(e){return e.startIndex<0||e.endIndex<e.startIndex}function vhe(e,t){return FS(e)?0:(e.endIndex-e.startIndex+1)*t}function SZ(e,t,n){if(t<=0)return-1;let r=t*n;if(e<=0)return 0;if(e>=r)return t;return Math.floor(e/n)}function Bhe(e,t,n){if(t<=0||e<=0)return-1;if(e>=t*n)return t-1;return Math.ceil(e/n)-1}function xhe(e){let t=new Map;return e.forEach((n,r)=>{if(n.kind!=="directory"||!n.isExpanded)return;let o=n.ancestorPaths.length,c=t.get(o);if(c==null){t.set(o,[r]);return}c.push(r)}),t}function Ehe(e,t){let n=0,r=e.length-1,o=-1;while(n<=r){let c=Math.floor((n+r)/2),l=e[c];if(l==null)break;if(l<=t){o=c,n=c+1;continue}r=c-1}return o}function Ihe(e){let t=new Map,n=[];for(let o=0;o<e.length;o+=1){let c=e[o];if(c==null)continue;let l=c.kind==="directory"&&c.isExpanded?[...c.ancestorPaths,c.path]:c.ancestorPaths,d=0;while(d<n.length&&d<l.length&&n[d]===l[d])d+=1;for(let p=n.length-1;p>=d;p-=1){let A=n[p];if(A!=null)t.set(A,o-1)}n.length=d;for(let p=d;p<l.length;p+=1){let A=l[p];if(A!=null)n.push(A)}}let r=e.length-1;for(let o of n)t.set(o,r);return t}function LS(e,t,n){if(e.length===0||t<=0)return[];let r=Ihe(e),o=xhe(e),c=[];for(let l=0;l<e.length;l+=1){let d=o.get(l);if(d==null||d.length===0)break;let p=t+l*n,A=Ehe(d,Math.min(e.length-1,Math.floor(p/n))),f=null;while(A>=0){let b=d[A],h=b==null?null:e[b]??null;if(h!=null&&(l===0||h.ancestorPaths[l-1]===c[l-1]?.path)){f=h;break}A-=1}if(f==null)break;c.push(f)}return c.map((l,d)=>{let p=d*n,A=(r.get(l.path)??e.length-1)+1;if(A>=e.length)return{row:l,top:p};let f=A*n-t;return{row:l,top:Math.min(p,f-n)}}).filter((l)=>l.top+n>0)}function FZ(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,o=Math.max(0,t.viewportHeight),c=Math.max(0,Math.floor(t.overscan)),l=Math.max(0,r-o),d=_he(t.scrollTop,0,l),p=t.stickyRows??LS(e,d,t.itemHeight),A=p.reduce((M,P)=>Math.max(M,P.top+t.itemHeight),0),f=Math.min(r,d+A),b=Math.max(0,o-A),h=Math.max(0,r-f),w=SZ(d,n,t.itemHeight),C=SZ(f,n,t.itemHeight),_=A<=0||w<0||w>=n?-1:w,v=_===-1?-1:Math.min(n-1,C-1),B=_===-1||v<_?0:v-_+1,E=b<=0||C>=n?SS:DZ(C,Bhe(f+b,n,t.itemHeight)),I=v+1,D=FS(E)?SS:DZ(Math.max(I,E.startIndex-c),Math.min(n-1,E.endIndex+c)),F=vhe(D,t.itemHeight);return{occlusion:{firstOccludedIndex:_,lastOccludedIndex:v,occludedCount:B},physical:{itemHeight:t.itemHeight,maxScrollTop:l,overscan:c,scrollTop:d,totalHeight:r,totalRowCount:n,viewportHeight:o},projected:{contentHeight:h,paneHeight:b,paneTop:f},sticky:{height:A,rows:p},visible:E,window:{endIndex:D.endIndex,height:F,offsetTop:FS(D)?0:D.startIndex*t.itemHeight,startIndex:D.startIndex}}}var LZ={added:"A",deleted:"D",ignored:null,modified:"M",renamed:"R",untracked:"U"},RZ={added:"Git status: added",deleted:"Git status: deleted",ignored:"Git status: ignored",modified:"Git status: modified",renamed:"Git status: renamed",untracked:"Git status: untracked"},NZ="Contains git status items";function MZ(e){if(e.current)return!0;return e.current=!0,!1}function RS(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:o=0,viewportHeight:c}=e;if(n<0)return null;let l=Math.max(0,o),d=n*r,p=d+r;if(d<t+l){let A=Math.max(0,d-l);return A===t?null:A}if(p>t+c){let A=p-c;return A===t?null:A}return null}function jZ(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,offset:o,topInset:c=0,totalHeight:l,viewportHeight:d}=e;if(o==="nearest")return RS({currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:c,viewportHeight:d});if(n<0)return null;let p=Math.max(0,c),A=n*r,f=Math.max(0,d-p),b=o==="center"?p+Math.max(0,(f-r)/2):p,h=Math.max(0,l-d),w=Math.max(0,Math.min(A-b,h));return w===t?null:w}function TZ(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:o,totalHeight:c,viewportHeight:l}=e;if(n<0)return null;let d=Math.max(0,o),p=n*r,A=p+r,f=t+d,b=t+l;if(p>=f&&A<=b)return null;let h=Math.max(0,c-l),w=Math.max(0,Math.min(p-d,h));return w===t?null:w}function Lp(e){if(e==null||!e.isConnected)return!1;if(e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();if(t instanceof ShadowRoot)return t.activeElement===e;return document.activeElement===e}function Ah(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let r=t.activeElement;return r instanceof HTMLElement?r:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function NA(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;if(n>0)return n;return e.clientHeight>0?e.clientHeight:t}function NS(e,t){return e!=null&&e>0?e:t}function $Z(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;if(n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0)return n.blockSize;return e.contentRect.height>0?e.contentRect.height:null}function MS(e,t,n,r,o=0){let c=RS({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:o,viewportHeight:r});if(c==null)return!1;return e.scrollTop=c,!0}function PZ(e,t,n,r,o,c,l=0){let d=jZ({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,offset:c,topInset:l,totalHeight:o,viewportHeight:r});if(d==null)return!1;return e.scrollTop=d,!0}function MA(e,t,n,r,o,c){let l=TZ({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:c,totalHeight:o,viewportHeight:r});if(l==null)return!1;return e.scrollTop=l,!0}function jS(e,t,n,r){if(n.end<n.start)return null;if(e<n.start)return-t;if(e>n.end)return r;return null}function qZ(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;if(t==null)return"reset";if(!r)return"reveal-canonical";if(n===t)return"ignore";return"focus-input"}function GZ({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:o,onInput:c}){return Ne("input",{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:o,onInput:c,onClick:(l)=>l.stopPropagation(),onMouseDown:(l)=>l.stopPropagation(),onPointerDown:(l)=>l.stopPropagation()})}function zZ(e){let{row:t,mode:n,targetPath:r,ariaLabel:o,domId:c,isParked:l,itemHeight:d,features:p,state:A,extraStyle:f}=e,b=n==="sticky",h=t.ancestorPaths.at(-1)??"",w={};if(A.isFocusRinged)w["data-item-focused"]=!0;if(t.isSelected)w["data-item-selected"]=!0;if(A.isContextHovered)w["data-item-context-hover"]="true";if(A.isDragTarget)w["data-item-drag-target"]=!0;if(A.isDragging)w["data-item-dragging"]=!0;if(A.effectiveGitStatus!=null)w["data-item-git-status"]=A.effectiveGitStatus;if(A.containsGitChange)w["data-item-contains-git-change"]="true";return{"aria-expanded":!b&&t.kind==="directory"?t.isExpanded:void 0,"aria-haspopup":p.contextMenuEnabled?"menu":void 0,"aria-label":o,"aria-level":!b?t.level+1:void 0,"aria-posinset":!b?t.posInSet+1:void 0,"aria-selected":!b?t.isSelected?"true":"false":void 0,"aria-setsize":!b?t.setSize:void 0,"data-file-tree-sticky-path":b?r:void 0,"data-file-tree-sticky-row":b?"true":void 0,"data-item-context-menu-button-visibility":p.actionLaneEnabled?p.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":p.contextMenuEnabled?p.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":p.actionLaneEnabled?"true":void 0,"data-item-has-git-lane":p.gitLaneActive?"true":void 0,"data-item-parent-path":h.length>0?h:void 0,"data-item-parked":l?"true":void 0,"data-item-path":r,"data-item-type":t.kind==="directory"?"folder":"file","data-type":"item",id:!b?c:void 0,role:!b?"treeitem":void 0,style:{minHeight:`${d}px`,...f},tabIndex:!b&&t.isFocused?0:-1,...w}}function OZ(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:o}=e,c=t.ctrlKey||t.metaKey,l=t.shiftKey||c,d=t.shiftKey?{additive:c,kind:"range"}:c?{kind:"toggle"}:{kind:"single"};return{closeSearch:r,revealCanonical:n==="sticky",selection:d,toggleDirectory:!l&&o}}var jA,ea,TS,HZ,$S=Object.is,gh=0,XZ=[],sa=dn,UZ=sa.__b,ZZ=sa.__r,YZ=sa.diffed,KZ=sa.__c,WZ=sa.unmount,JZ=sa.__;function H_(e,t){sa.__h&&sa.__h(ea,e,gh||t),gh=0;var n=ea.__H||(ea.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function hs(e){return gh=1,Qhe(eY,e)}function Qhe(e,t,n){var r=H_(jA++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):eY(void 0,t),function(d){var p=r.__N?r.__N[0]:r.__[0],A=r.t(p,d);$S(p,A)||(r.__N=[A,r.__[1]],r.__c.setState({}))}],r.__c=ea,!ea.__f)){var o=function(d,p,A){if(!r.__c.__H)return!0;var f=r.__c.__H.__.filter(function(h){return!!h.__c});if(f.every(function(h){return!h.__N}))return!c||c.call(this,d,p,A);var b=r.__c.props!==d;return f.forEach(function(h){if(h.__N){var w=h.__[0];h.__=h.__N,h.__N=void 0,$S(w,h.__[0])||(b=!0)}}),c&&c.call(this,d,p,A)||b};ea.__f=!0;var{shouldComponentUpdate:c,componentWillUpdate:l}=ea;ea.componentWillUpdate=function(d,p,A){if(4&this.__g){var f=c;c=void 0,o(d,p,A),c=f}l&&l.call(this,d,p,A)},ea.shouldComponentUpdate=o}return r.__N||r.__}function qS(e,t){var n=H_(jA++,3);!sa.__s&&GS(n.__H,t)&&(n.__=e,n.u=t,ea.__H.__h.push(n))}function _i(e,t){var n=H_(jA++,4);!sa.__s&&GS(n.__H,t)&&(n.__=e,n.u=t,ea.__h.push(n))}function kt(e){return gh=5,Bl(function(){return{current:e}},[])}function Bl(e,t){var n=H_(jA++,7);return GS(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function fr(e,t){return gh=8,Bl(function(){return e},t)}function Dhe(){for(var e;e=XZ.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(O_),e.__H.__h.forEach(PS),e.__H.__h=[]}catch(t){e.__H.__h=[],sa.__e(t,e.__v)}}sa.__b=function(e){ea=null,UZ&&UZ(e)},sa.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),JZ&&JZ(e,t)},sa.__r=function(e){ZZ&&ZZ(e),jA=0;var t=(ea=e.__c).__H;t&&(TS===ea?(t.__h=[],ea.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.forEach(O_),t.__h.forEach(PS),t.__h=[],jA=0)),TS=ea},sa.diffed=function(e){YZ&&YZ(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(XZ.push(t)!==1&&HZ===sa.requestAnimationFrame||((HZ=sa.requestAnimationFrame)||She)(Dhe)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),TS=ea=null},sa.__c=function(e,t){t.some(function(n){try{n.__h.forEach(O_),n.__h=n.__h.filter(function(r){return!r.__||PS(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],sa.__e(r,n.__v)}}),KZ&&KZ(e,t)},sa.unmount=function(e){WZ&&WZ(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{O_(r)}catch(o){t=o}}),n.__H=void 0,t&&sa.__e(t,n.__v))};var VZ=typeof requestAnimationFrame=="function";function She(e){var t,n=function(){clearTimeout(r),VZ&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);VZ&&(t=requestAnimationFrame(n))}function O_(e){var t=ea,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ea=t}function PS(e){var t=ea;e.__c=e.__(),ea=t}function GS(e,t){return!e||e.length!==t.length||t.some(function(n,r){return!$S(n,e[r])})}function eY(e,t){return typeof t=="function"?t(e):t}function Fhe(e,t=null,n=null){let r=e.flattenedSegments;if(r==null||r.length===0)return t??e.name;return Ne("span",{"data-item-flattened-subitems":!0,children:r.map((o,c)=>{let l=c===r.length-1;return Ne(bc,{children:[Ne("span",{"data-item-flattened-subitem":o.path,"data-item-flattened-subitem-drag-target":n===o.path?"true":void 0,children:l&&t!=null?t:Ne(mh,{children:o.name})}),c<r.length-1?" / ":""]},o.path)})})}function $A(e){return e.isFlattened?e.flattenedSegments?.findLast((t)=>t.isTerminal)?.path??e.path:e.path}function OS(e){let t=e.flattenedSegments;if(t==null||t.length===0)return e.name;return t.map((n)=>n.name).join(" / ")}function tY(e,t,n,r){return e.map((o,c)=>{let l=c*n,d=o.subtreeEndIndex+1;if(d>=r)return{row:o.row,top:l};let p=d*n-t;return{row:o.row,top:Math.min(l,p-n)}}).filter((o)=>o.top+n>0)}function zS({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:o,viewportHeight:c}){let l=e.getVisibleCount(),d=o&&l>0?e.getStickyRowCandidates(r,t):[],p=d==null&&o&&l>0?e.getVisibleRows(0,l-1):[],A=FZ(p,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:d==null?void 0:tY(d,r,t,l),totalRowCount:l,viewportHeight:c}),f=o&&r<=0&&l>0?e.getStickyRowCandidates(1,t):[],b=f!=null&&r<=0?tY(f,1,t,l):o&&r<=0&&p.length>0?LS(p,1,t):A.sticky.rows;return{overlayHeight:b.reduce((h,w)=>Math.max(h,w.top+t),0),overlayRows:b,snapshot:A,visibleRows:p}}var Lhe=400,nY=10,TA=40,aY=18;function Rhe(e,t,n){let r=e,o=document.elementFromPoint?.bind(document)??null,c=r.elementFromPoint?.(t,n)??o?.(t,n)??null;if(e instanceof ShadowRoot&&(c==null||!e.contains(c)))return Nhe(e,t,n);return c instanceof HTMLElement?c:null}function Nhe(e,t,n){let r=Array.from(e.querySelectorAll('[data-type="item"], [data-item-flattened-subitem]'));for(let o=r.length-1;o>=0;o--){let c=r[o],l=c.getBoundingClientRect();if(t>=l.left&&t<=l.right&&n>=l.top&&n<=l.bottom)return c}return null}function rY(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]"),o=r instanceof HTMLElement?r.getAttribute("data-item-flattened-subitem")??null:null;if(o!=null&&o.endsWith("/"))return{directoryPath:o,flattenedSegmentPath:o,hoveredPath:n,kind:"directory"};if(t.dataset.itemType==="folder")return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:"directory"};let c=t.dataset.itemParentPath??null;if(c==null||c.length===0)return{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:"root"};return{directoryPath:c,flattenedSegmentPath:null,hoveredPath:n,kind:"directory"}}function iY(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 Mhe(){return navigator.vendor!=="Apple Computer, Inc."}function jhe(e,t){let n=e-t.top;if(n<TA)return-Math.ceil((TA-Math.max(0,n))/TA*aY);let r=t.bottom-e;if(r<TA)return Math.ceil((TA-Math.max(0,r))/TA*aY);return 0}function The(e,t){if(e!=null){let n=LZ[e];if(n==null)return null;return{text:n,title:RZ[e]}}if(t)return{icon:{name:"file-tree-icon-dot",width:6,height:6},title:NZ};return null}function $he(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let o=e.length-1;o>=0;o-=1){let c=e[o],l=n.get(c);if(l!=null){for(let d of r)n.set(d,l);return l?"ignored":null}if(t.has(c)){n.set(c,!0);for(let d of r)n.set(d,!0);return"ignored"}r.push(c)}for(let o of r)n.set(o,!1);return null}function oY(e){return e!=null&&"toggle"in e}function AY(e){return e.code==="Space"||e.key===" "||e.key==="Spacebar"}function Phe(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function qhe(e){if(e==null)return"";return`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll("\\","\\\\").replaceAll('"',"\\\"")}"] { opacity: 1; }`}function gY(e){return e.shiftKey&&e.key==="F10"||e.key==="ContextMenu"}function Ghe(e,t){if(t&&gY(e))return!0;if((e.ctrlKey||e.metaKey)&&AY(e))return!0;return e.key==="ArrowDown"||e.key==="ArrowLeft"||e.key==="ArrowRight"||e.key==="ArrowUp"}var zhe=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"]);function sY(e){for(let t of e.composedPath()){if(!(t instanceof HTMLElement))continue;if(t.dataset.fileTreeContextMenuRoot==="true")return!0;if(t.dataset.type==="context-menu-anchor"||t.dataset.type==="context-menu-trigger")return!0;if(t.getAttribute("slot")==="context-menu")return!0}return!1}function Ohe(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 Hhe(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function Uhe(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function cY(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function lY(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let o=n.get(e)??null;return o?.dataset.itemParked==="true"?null:o}function Zhe(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 r=n.dataset.fileTreeStickyPath;if(r!=null)t.push(r)}return t}function Yhe(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 Khe(e,t,n,r,o,c,l){let d=Math.max(0,c-o),p=t?.getBoundingClientRect()??null,A=p==null||n==null?null:n.getBoundingClientRect().top-p.top,f=Yhe(e,r),b=p==null||f==null?null:f.getBoundingClientRect().top-p.top;return Math.max(0,Math.min(b??Math.max(A??0,d),Math.max(0,l-o)))}function dY(e,t){return{kind:e.kind,name:OS(e),path:t}}function Whe(e){return e==null?void 0:`${e}__tree`}function fY(e,t,n){if(e==null)return;return`${e}__focused-item-${encodeURIComponent(t)}${n?"__parked":""}`}function uY(e){return e==="file-tree-icon-chevron"||e==="file-tree-icon-dot"||e==="file-tree-icon-file"||e==="file-tree-icon-lock"}function pY(e,t){if(e==null)return null;if("text"in e){if(e.parts!=null)return Ne("span",{title:e.title,children:e.parts.map((r,o)=>Ne("span",{style:{color:r.color},children:r.text},o))});return Ne("span",{title:e.title,children:e.text})}let n=typeof e.icon==="string"?uY(e.icon)?t(e.icon):{name:e.icon}:uY(e.icon.name)?(()=>{let r=t(e.icon.name),{name:o,...c}=e.icon;return{...r,...c}})():e.icon;return Ne("span",{title:e.title,children:Ne(RA,{...n})})}function mY(e){if(e==null)return;Lp(e.querySelector(["button:not([disabled])","[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", "))??e)}function Jhe(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:o=!1,dragTargetFlattenedSegmentPath:c=null,gitDecoration:l=null,gitLaneActive:d=!1,renameInput:p=null,showDecorativeActionAffordance:A=!1}={}){let f=$A(e);return Ne(bc,{children:[e.depth>0?Ne("div",{"data-item-section":"spacing",children:Array.from({length:e.depth}).map((b,h)=>Ne("div",{"data-item-section":"spacing-item","data-ancestor-path":e.ancestorPaths[h]},h))}):null,Ne("div",{"data-item-section":"icon",children:e.kind==="directory"?Ne(RA,{...t("file-tree-icon-chevron")}):Ne(RA,{...t("file-tree-icon-file",f)})}),Ne("div",{"data-item-section":"content",children:e.isFlattened?Fhe(e,p,c):p??Ne(QZ,{minimumLength:5,split:"extension",children:e.name})}),o?Ne("div",{"data-item-section":"decoration",children:r!=null?pY(r,t):null}):null,d?Ne("div",{"data-item-section":"git",children:pY(l,t)}):null,n?Ne("div",{"data-item-section":"action",children:A?Ne("span",{"aria-hidden":"true","data-item-action-affordance":"decorative",children:Ne(RA,{...t("file-tree-icon-ellipsis")})}):null}):null]})}function U_(e,t,n,r={}){let{controller:o,renameView:c,visualFocusPath:l,contextHoverPath:d,draggedPathSet:p,dragTarget:A,dragAndDropEnabled:f,shouldSuppressContextMenu:b,handleRowDragStart:h,handleRowDragEnd:w,handleRowTouchStart:C,instanceId:_,itemHeight:v,gitStatusByPath:B,ignoredGitDirectories:E,ignoredInheritanceCache:I,directoriesWithGitChanges:D,gitLaneActive:F,contextMenuEnabled:M,contextMenuTriggerMode:P,contextMenuButtonTriggerEnabled:q,contextMenuButtonVisibility:W,contextMenuRightClickEnabled:Z,registerRenameInput:ye,registerButton:ne,resolveIcon:re,renderDecorationForRow:ce,openContextMenuForRow:ae,onRowClick:V,onKeyDown:se}=e,ge=$A(t),{isParked:Ce=!1,mode:U="flow",style:pe}=r,xe=U==="sticky",Ie=B?.get(ge)??null??$he(t.ancestorPaths,E,I),Se=t.kind==="directory"&&(D?.has(ge)??!1),st=ce(t,ge),Ee=The(Ie,Se),ve=M&&q,Le=st!=null||F||ve,we=ve&&W==="always",Te=c.getPath()===ge,be=Te?c.getValue():"",ze=xe||!Te?null:Ne(GZ,{ref:ye,ariaLabel:`Rename ${OS(t)}`,isFlattened:t.isFlattened,value:be,onBlur:()=>{c.commit()},onInput:(Je)=>{c.setValue(Je.currentTarget.value)}}),Ke=Jhe(t,re,{actionLaneEnabled:ve,customDecoration:st,decorationLaneEnabled:Le,dragTargetFlattenedSegmentPath:A?.flattenedSegmentPath??null,gitDecoration:Ee,gitLaneActive:F,renameInput:ze,showDecorativeActionAffordance:we}),pt={...zZ({ariaLabel:OS(t),domId:t.isFocused?fY(_,ge,Ce):void 0,extraStyle:pe,features:{actionLaneEnabled:ve,contextMenuButtonVisibility:ve?W:null,contextMenuEnabled:M,contextMenuTriggerMode:M?P:null,gitLaneActive:F},isParked:Ce,itemHeight:v,mode:U,row:t,state:{containsGitChange:Se,effectiveGitStatus:Ie,isContextHovered:d===ge,isDragTarget:A?.kind==="directory"&&A.directoryPath===ge,isDragging:p?.has(ge)===!0,isFocusRinged:t.isFocused&&l===ge},targetPath:ge}),key:n,onContextMenu:M||f?(Je)=>{if(b()){Je.preventDefault();return}if(!M)return;if(Je.preventDefault(),!Z)return;o.focusMountedPathFromInput(ge),ae(t,ge,{anchorRect:Hhe(Je.clientX,Je.clientY),source:"right-click"})}:void 0,onFocus:!xe?()=>{o.focusMountedPathFromInput(ge)}:void 0,onKeyDown:!xe?se:void 0,ref:(Je)=>{ne(ge,Je)}};if(!xe&&Te)return Ne("div",{...pt,children:Ke});return Ne("button",{...pt,type:"button",draggable:f&&!Ce,onDragEnd:f&&!Ce?w:void 0,onDragStart:f&&!Ce?(Je)=>{h(Je,t,ge)}:void 0,onMouseDown:(Je)=>{if(xe){Je.preventDefault();return}if(o.isSearchOpen())Je.preventDefault()},onTouchStart:f&&!Ce?(Je)=>{C(Je,t,ge)}:void 0,onClick:(Je)=>{V(Je,t,ge,U)},children:Ke})}function Vhe(e,t,n){if(t.end<t.start)return[];return e.controller.getVisibleRows(t.start,t.end).filter((r)=>!n.has($A(r))).map((r,o)=>U_(e,r,t.start+o))}function HS({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:o,icons:c,instanceId:l,itemHeight:d=k_,overscan:p=10,renamingEnabled:A=!1,renderRowDecoration:f,searchBlurBehavior:b="close",searchEnabled:h=!1,searchFakeFocus:w=!1,slotHost:C,stickyFolders:_=!1,initialViewportHeight:v=420}){let B=kt(null),E=kt(null),I=kt(!1),D=kt(null),F=kt(null),M=kt(null),P=kt(null),q=kt(null),W=kt(new Map),Z=kt(new Map),ye=kt(()=>{}),ne=kt(null),re=kt(0),ce=kt(!1),ae=kt(null);if(ae.current!==t)ce.current=!1,ae.current=t;let V=kt(!1),se=kt(null),ge=kt(null),Ce=kt(!1),U=kt(null),pe=kt(null),xe=kt(null),Ie=kt(null),Se=kt(null),st=kt(null),Ee=kt(null),ve=kt(null),Le=kt(!1),we=kt(null),Te=kt(null),be=kt(null),ze=kt(null),Ke=Bl(()=>new Map,[]),[,pt]=hs(0),Je=kt(!1),[ft,Vt]=hs(null),[Oe,Mn]=hs(null),[bt,Xr]=hs(null),[ei,Ja]=hs(null),[Va,Qs]=hs(0),[Tt,so]=hs(null),zn=kt(Tt);zn.current=Tt;let Ei=kt(null),ca=kt(null),Xa=kt(null),yr=kt(null),Ii=kt(null),Qi=kt(!1),wr=()=>{ca.current=null,Xa.current=null,yr.current=null},S=(O,he)=>{ca.current=O,Xa.current=null,yr.current=he==null?null:{path:O,scrollTop:he}},te=(O,he)=>{ca.current=null,Xa.current={path:O,viewportOffset:he},yr.current=null},ke=kt(b==="retain"&&t.isSearchOpen()),[Qe,Me]=hs(w);qS(()=>{if(!w)Me(!1)},[w]);let it=kt(!1),tt=fr(()=>{it.current=!0,Me((O)=>O?!1:O)},[]),[Nt,We]=hs(()=>zS({controller:t,itemHeight:d,overscan:p,scrollTop:0,stickyFolders:_,viewportHeight:v})),[la,ja]=hs(!1);qS(()=>{ja(!0)},[]);let In=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,ti=e?.contextMenu?.triggerMode??(In?"right-click":"both"),Ta=ti==="both"||ti==="button",Di=e?.contextMenu?.buttonVisibility??"when-needed",co=ti==="both"||ti==="right-click";_i(()=>{let O=M.current;if(O==null)return;let he=(De)=>{if(!(De instanceof CustomEvent))return;let $e=De.detail?.path??null;Ii.current=$e,Mn($e),Ja($e==null?null:"pointer")},Ze=(De)=>{if(!(De instanceof CustomEvent))return;Qi.current=De.detail?.disabled===!0};return O.addEventListener("file-tree-debug-set-context-menu-trigger",he),O.addEventListener("file-tree-debug-set-scroll-suppression",Ze),()=>{O.removeEventListener("file-tree-debug-set-context-menu-trigger",he),O.removeEventListener("file-tree-debug-set-scroll-suppression",Ze)}},[]);let er=fr((O,he)=>{cY(W.current,O,he)},[]),na=fr((O,he)=>{cY(Z.current,O,he)},[]),du=fr((O)=>{F.current=O},[]),lo=fr((O)=>lY(O,Z.current,W.current),[]),yt=n!=null||r!=null||o!=null,{resolveIcon:Dr}=Bl(()=>lZ(c),[c]),Si=t[wS](),jn=Si.getPath(),xc=jn!=null,tr=t.isSearchOpen(),ag=t.getSearchValue(),wt=t.getFocusedPath(),$t=t.getFocusedIndex(),uo=t.getScrollRequest(),Ca=t.isDragAndDropEnabled(),$o=t.getDragSession(),rg=Bl(()=>$o==null?null:new Set($o.draggedPaths),[$o]),uu=$o?.target??null,Po=$o?.primaryPath??null,Ql=Whe(l),{overlayHeight:$a,overlayRows:po,snapshot:un,visibleRows:Pa}=Nt,wn=un.physical.viewportHeight,_a=Bl(()=>({end:un.window.endIndex,start:un.window.startIndex}),[un.window.endIndex,un.window.startIndex]),pn=po,qo=un.sticky.rows,da=un.physical.totalHeight,va=un.sticky.height,Go=Bl(()=>new Set(qo.map((O)=>$A(O.row))),[qo]),Dl=$t>=0&&$t>=_a.start&&$t<=_a.end,Ds=fr((O,he)=>f?.({item:dY(O,he),row:O})??null,[f]),Sr=fr((O)=>{if(Lp(O==null?null:W.current.get(O)??null))return!0;return Lp(M.current)},[]),Fi=fr((O)=>{Sr(t.focusNearestPath(O))},[t,Sr]),Ss=kt(Fi);Ss.current=Fi;let Tn=kt(!0),zo=kt(()=>{}),ua=fr((O=!0)=>{let he=zn.current;if(he==null)return;if(Tn.current=Tn.current&&O,so(null),e?.contextMenu?.onClose?.(),Tn.current)Fi(he.path)},[e?.contextMenu,Fi]);zo.current=ua;let Fr=fr((O)=>{let he=O==null?null:Uhe(M.current,O);Xr((Ze)=>Ze===he?Ze:he)},[]),Ba=fr((O,he,Ze)=>{let De=t.getItem(he);if(De==null)return;let $e=lo(he);if($e?.dataset.fileTreeStickyRow==="true"){let Xe=P.current;S(he,Xe?.scrollTop??null),V.current=!0,Vt((rn)=>rn===he?rn:he)}De.focus(),Fr($e),Tn.current=!0,so({anchorRect:Ze?.anchorRect??null,item:dY(O,he),path:he,source:Ze?.source??"keyboard"})},[t,lo,Fr]),Li=fr((O)=>{if(!A)return;if(t.isSearchOpen()){let he=P.current,Ze=NA(he,wn);U.current=$t<0||he==null?null:Math.max(0,Math.min($t*d-he.scrollTop,Math.max(0,Ze-d))),Ce.current=!0}if(t.startRenaming(O)===!1)return;Ja("focus"),pt((he)=>he+1)},[t,$t,d,A,wn]),Lr=fr((O,{restoreTreeFocus:he=!0,targetOffset:Ze="live-overlay"}={})=>{let De=P.current;if(De==null)return!1;t.focusPath(O);let $e=t.getFocusedIndex();if($e<0)return!1;let Xe=t.getVisibleRows($e,$e)[0]??null;if(Xe==null)return!1;let rn=NA(De,wn),nt=t.getVisibleCount()*d,Kt=Ze==="sticky-parents"?Xe.ancestorPaths.length*d:zS({controller:t,itemHeight:d,overscan:p,scrollTop:De.scrollTop,stickyFolders:_,viewportHeight:rn}).snapshot.sticky.height;return V.current=!0,MA(De,$e,d,rn,nt,Kt),ye.current(),Ei.current=he?O:null,!0},[t,d,p,wn,_]),Fs=()=>I.current===!0||ze.current!=null||Le.current===!0,Ls=(O)=>typeof window.requestAnimationFrame==="function"?window.requestAnimationFrame(()=>{O()}):window.setTimeout(O,16),Pt=(O)=>{if(O==null)return;if(typeof window.cancelAnimationFrame==="function"){window.cancelAnimationFrame(O);return}window.clearTimeout(O)},$n=()=>{if(Ie.current!=null)clearTimeout(Ie.current),Ie.current=null;xe.current=null},vt=()=>{st.current?.remove(),st.current=null},mo=()=>{Pt(pe.current),pe.current=null,Se.current=null},Tp=(O)=>{let he=M.current?.getRootNode();if(he instanceof ShadowRoot){he.append(O);return}document.body.append(O)},Ec=()=>{if(ve.current?.(),ve.current=null,ze.current!=null)clearTimeout(ze.current),ze.current=null;if(Le.current=!1,we.current=null,be.current=null,Te.current!=null)Te.current.setAttribute("draggable","true"),Te.current.style.removeProperty("touch-action"),Te.current=null;vt(),$n(),mo(),Ee.current=null},Yn=(O,he)=>{let Ze=M.current?.getRootNode(),De=rY(Rhe(Ze instanceof ShadowRoot?Ze:document,O,he));return t.setDragTarget(De),t.getDragSession()?.target??null},kr=(O)=>{let he=t.getDragAndDropConfig()?.openOnDropDelay??800;if(O==null||O.kind!=="directory"||O.directoryPath==null||he<=0){$n();return}let Ze=t.getItem(O.directoryPath),De=oY(Ze)?Ze:null;if(De==null||De.isExpanded()){$n();return}let $e=`${O.directoryPath}::${O.flattenedSegmentPath??""}`;if(xe.current===$e)return;$n(),xe.current=$e,Ie.current=setTimeout(()=>{let Xe=t.getDragSession()?.target;if(Xe?.kind!=="directory"||Xe.directoryPath!==O.directoryPath||Xe.flattenedSegmentPath!==O.flattenedSegmentPath)return;De.expand()},he)},nr=()=>{pe.current=null;let O=Se.current,he=P.current;if(O==null||he==null||t.getDragSession()==null)return;let Ze=he.getBoundingClientRect(),De=jhe(O.clientY,Ze);if(De===0)return;let $e=Math.max(0,he.scrollHeight-he.clientHeight),Xe=Math.max(0,Math.min($e,he.scrollTop+De));if(Xe!==he.scrollTop)he.scrollTop=Xe,ye.current();kr(Yn(O.clientX,O.clientY)),pe.current=Ls(nr)},Oo=(O,he)=>{Se.current={clientX:O,clientY:he},pe.current??=Ls(nr)},ni=(O,he,Ze)=>{let De=O.currentTarget;if(De==null)return;if(Ec(),vt(),$n(),mo(),t.startDrag(Ze)===!1){O.preventDefault();return}if(Ee.current=he,O.dataTransfer!=null){if(O.dataTransfer.effectAllowed="move",O.dataTransfer.dropEffect="move",O.dataTransfer.setData("text/plain",Ze),Mhe()){let $e=iY(De),Xe=De.getBoundingClientRect();Object.assign($e.style,{height:`${Xe.height}px`,opacity:"0.85",transform:"translate3d(-9999px, 0px, 0)",width:`${Xe.width}px`}),Tp($e),st.current=$e,O.dataTransfer.setDragImage($e,Math.max(0,O.clientX-Xe.left),Math.max(0,O.clientY-Xe.top))}}},pu=()=>{vt(),$n(),mo(),Ee.current=null,t.cancelDrag()},Rs=(O,he,Ze)=>{if(ze.current!=null||Le.current)return;let De=O.touches[0],$e=O.currentTarget;if(De==null||$e==null)return;be.current={clientX:De.clientX,clientY:De.clientY},Te.current=$e,$e.setAttribute("draggable","false");let Xe=(Kt={})=>{let on=Kt.restoreNativeDraggable??!Le.current;if(ze.current!=null)clearTimeout(ze.current),ze.current=null;if(document.removeEventListener("touchmove",rn),document.removeEventListener("touchend",nt),document.removeEventListener("touchcancel",nt),ve.current===Xe)ve.current=null;if(on){if($e.setAttribute("draggable","true"),Te.current===$e)Te.current=null;be.current=null}},rn=(Kt)=>{let on=Kt.touches[0],L=be.current;if(on==null||L==null)return;let j=on.clientX-L.clientX,K=on.clientY-L.clientY;if(j*j+K*K<=nY*nY)return;Xe()},nt=()=>{Xe()};document.addEventListener("touchmove",rn,{passive:!0}),document.addEventListener("touchend",nt),document.addEventListener("touchcancel",nt),ve.current=Xe,ze.current=setTimeout(()=>{if(Xe({restoreNativeDraggable:!1}),t.startDrag(Ze)===!1){if($e.setAttribute("draggable","true"),Te.current===$e)Te.current=null;be.current=null;return}Le.current=!0,Te.current=$e,$e.setAttribute("draggable","false"),$e.style.setProperty("touch-action","none"),Ee.current=he;let Kt=$e.getBoundingClientRect(),on=iY($e);Object.assign(on.style,{height:`${Kt.height}px`,opacity:"0.85",transform:`translate3d(${Kt.left}px, ${Kt.top}px, 0)`,width:`${Kt.width}px`}),Tp(on),st.current=on,we.current={x:De.clientX-Kt.left,y:De.clientY-Kt.top};let L=(ie)=>{let oe=ie.touches[0];if(oe==null)return;ie.preventDefault();let fe=we.current;if(fe!=null&&st.current!=null)st.current.style.transform=`translate3d(${oe.clientX-fe.x}px, ${oe.clientY-fe.y}px, 0)`;kr(Yn(oe.clientX,oe.clientY)),Oo(oe.clientX,oe.clientY)},j=(ie)=>{let oe=ie.changedTouches[0];if(oe!=null)Yn(oe.clientX,oe.clientY);t.completeDrag(),Ec()},K=()=>{t.cancelDrag(),Ec()};ve.current=()=>{document.removeEventListener("touchmove",L),document.removeEventListener("touchend",j),document.removeEventListener("touchcancel",K)},document.addEventListener("touchmove",L,{passive:!1}),document.addEventListener("touchend",j),document.addEventListener("touchcancel",K)},Lhe)},Ao=(O)=>{if(Tt!=null){if(O.key==="Escape"){ua(),O.preventDefault(),O.stopPropagation();return}if(zhe.has(O.key))O.preventDefault(),O.stopPropagation();return}if(Si.isActive()){if(O.isComposing||O.keyCode===229)return;if(O.key==="Escape")Si.cancel();else if(O.key==="Enter")Si.commit();else return;Ja("focus"),pt((mt)=>mt+1),O.preventDefault(),O.stopPropagation();return}if(A&&O.key==="F2"){Li(wt??void 0),O.preventDefault(),O.stopPropagation();return}if(tr){if(O.key==="Escape")Ce.current=!1,U.current=null,t.closeSearch();else if(O.key==="Enter"){let mt=t.getFocusedPath();if(mt!=null)t.selectOnlyPath(mt);let Pn=P.current,Ms=NA(Pn,wn);U.current=$t<0||Pn==null?null:Math.max(0,Math.min($t*d-Pn.scrollTop,Math.max(0,Ms-d))),Ce.current=!0,t.closeSearch()}else if(O.key==="ArrowDown")t.focusNextSearchMatch();else if(O.key==="ArrowUp")t.focusPreviousSearchMatch();else return;Ja("focus"),pt((mt)=>mt+1),O.preventDefault(),O.stopPropagation();return}if(h&&Phe(O)){t.openSearch(O.key),pt((mt)=>mt+1),O.preventDefault(),O.stopPropagation();return}let he=In&&gY(O),Ze=Ghe(O,In),De=Ze&&M.current!=null?Ah(M.current):null,$e=Ze?new Set(Zhe(M.current)):new Set,Xe=De?.dataset.fileTreeStickyPath??null,rn=De?.dataset.fileTreeStickyRow==="true"&&Xe!=null;if(rn&&Xe!==wt&&$e.has(Xe)){let mt=P.current;S(Xe,mt?.scrollTop??null),t.focusPath(Xe)}let nt=t.getFocusedPath(),Kt=t.getFocusedIndex(),on=t.getFocusedItem();if(on==null)return;let L=oY(on)?on:null,j=nt!=null&&(Go.has(nt)||rn&&Xe===nt&&$e.has(nt)),K=O.key==="ArrowDown"||O.key==="ArrowUp"||O.key==="ArrowRight"&&L!=null&&L.isExpanded(),ie=O.key==="ArrowLeft"&&j&&L!=null&&L.isExpanded(),oe=P.current,fe=!0;if(O.shiftKey&&O.key==="ArrowDown")t.extendSelectionFromFocused(1);else if(O.shiftKey&&O.key==="ArrowUp")t.extendSelectionFromFocused(-1);else if(he&&nt!=null&&Kt>=0){let mt=t.getVisibleRows(Kt,Kt)[0]??null,Pn=lY(nt,Z.current,W.current);if(mt==null||Pn==null)fe=!1;else Ba(mt,nt)}else if((O.ctrlKey||O.metaKey)&&AY(O))t.toggleFocusedSelection();else if((O.ctrlKey||O.metaKey)&&O.key.toLowerCase()==="a")t.selectAllVisiblePaths();else switch(O.key){case"ArrowDown":t.focusNextItem();break;case"ArrowUp":t.focusPreviousItem();break;case"ArrowRight":if(L==null||L.isExpanded())t.focusNextItem();else L.expand();break;case"ArrowLeft":if(L!=null&&L.isExpanded())L.collapse();else t.focusParentItem();break;case"Home":t.focusFirstItem();break;case"End":t.focusLastItem();break;default:fe=!1}if(!fe)return;Ja("focus");let Ge=t.getFocusedPath(),rt=Ge!=null&&(Go.has(Ge)||$e.has(Ge)),Xt=K&&Ge!==nt,Hn=he&&rn&&Xe===nt&&Ge===nt;if((j||Hn)&&Ge!=null&&(Xt&&rt||Hn))S(Ge,oe?.scrollTop??null),V.current=!0,Vt((mt)=>mt===Ge?mt:Ge);else{let mt=O.key==="ArrowUp"&&j&&Ge!==nt;if(Ge!=null&&(mt||ie&&Ge===nt))te(Ge,Khe(M.current,oe,De,nt,d,va,wn)),V.current=!0,Vt((Pn)=>Pn===Ge?Pn:Ge);else wr()}pt((mt)=>mt+1),O.preventDefault(),O.stopPropagation()};_i(()=>{if(!h||!tr)return;if(ke.current){ke.current=!1;return}Lp(q.current)},[tr,h]),_i(()=>{let O=F.current;switch(qZ({hasRenderedInput:O!=null,previousRenamingPath:ge.current,renamingPath:jn})){case"reset":ge.current=null;return;case"reveal-canonical":if(jn!=null)Lr(jn,{restoreTreeFocus:!1,targetOffset:"live-overlay"});return;case"ignore":return;case"focus-input":if(O!=null)Ei.current=null,ge.current=jn,Lp(O),O.select();return}},[_a.end,_a.start,jn,Lr,Go]),_i(()=>{let O=M.current;if(O==null)return;let he=null,Ze=()=>{if(he==null)return;clearTimeout(he),he=null},De=()=>{let rn=Ah(O)?.dataset.itemPath??null;Vt((nt)=>nt===rn?nt:rn)},$e=()=>{Ze(),V.current=!0,De()},Xe=(rn)=>{let nt=rn.relatedTarget;if(nt==null){Ze(),he=setTimeout(()=>{if(he=null,Ah(O)!=null){De();return}V.current=!1,Vt(null)},0);return}if(!(nt instanceof Node)||!O.contains(nt)){Ze(),V.current=!1,Vt(null);return}let Kt=nt instanceof HTMLElement?nt.dataset.itemPath??null:null;Vt((on)=>on===Kt?on:Kt)};return O.addEventListener("focusin",$e),O.addEventListener("focusout",Xe),()=>{Ze(),O.removeEventListener("focusin",$e),O.removeEventListener("focusout",Xe)}},[]),_i(()=>{let O=M.current;if(O==null)return;if(un.physical.scrollTop<=0)O.dataset.scrollAtTop="true";else delete O.dataset.scrollAtTop},[un.physical.scrollTop]),_i(()=>{let O=null,he=P.current,Ze=D.current,De=M.current;if(he==null)return;ne.current=NA(he,v);let $e=()=>{let fe=t.getVisibleCount(),Ge=NS(ne.current,v),rt=Math.max(0,fe*d-Ge);if(he.scrollTop>rt)he.scrollTop=rt;We(zS({controller:t,itemHeight:d,overscan:p,scrollTop:Math.min(he.scrollTop,rt),stickyFolders:_,viewportHeight:Ge}))};if(!ce.current){ce.current=!0;let fe=t.getFocusedIndex();if(fe>=0){let Ge=NS(ne.current,v),rt=t.getVisibleRows(fe,fe)[0]??null;MS(he,fe,d,Ge,_&&rt!=null?Math.max(0,Math.min(rt.ancestorPaths.length*d,Math.max(0,Ge-d))):0)}}ye.current=$e;let Xe=t.subscribe(()=>{if(MZ(Je))pt((fe)=>fe+1);$e()}),rn=()=>{if(Qi.current===!0)return;if(Ze!=null)Ze.dataset.isScrolling??="";if(De!=null)De.dataset.isScrolling??="";if(I.current=!0,O!=null)clearTimeout(O);O=setTimeout(()=>{if(Ze!=null)delete Ze.dataset.isScrolling;if(De!=null)delete De.dataset.isScrolling;I.current=!1,Qs((fe)=>fe+1),O=null},50)},nt=null,Kt=()=>{if(De!=null)delete De.dataset.overlayReveal;if(nt!=null)clearTimeout(nt),nt=null},on=()=>{if(De==null||Qi.current===!0)return;if(he.scrollTop>0)return;if(De.dataset.overlayReveal="true",nt!=null)clearTimeout(nt);nt=setTimeout(()=>{Kt()},200)},L=()=>{if($e(),he.scrollTop>0)Kt();if(zn.current!=null&&I.current)zo.current();if(Qi.current===!0){I.current=!1;return}Mn((fe)=>fe==null?fe:null),rn()},j=()=>{rn(),on()},K=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"," ","Spacebar"]),ie=(fe)=>{if(!K.has(fe.key))return;j()};he.addEventListener("scroll",L,{passive:!0}),he.addEventListener("wheel",j,{passive:!0}),he.addEventListener("touchmove",j,{passive:!0}),he.addEventListener("keydown",ie);let oe=typeof ResizeObserver<"u"?new ResizeObserver((fe)=>{ne.current=(fe[0]==null?null:$Z(fe[0]))??NA(he,v),$e()}):null;return oe?.observe(he),()=>{if(ye.current=()=>{},Xe(),he.removeEventListener("scroll",L),he.removeEventListener("wheel",j),he.removeEventListener("touchmove",j),he.removeEventListener("keydown",ie),O!=null)clearTimeout(O);if(nt!=null)clearTimeout(nt);if(Ze!=null)delete Ze.dataset.isScrolling;if(De!=null)delete De.dataset.isScrolling,delete De.dataset.overlayReveal;I.current=!1,ne.current=null,oe?.disconnect()}},[t,v,d,p,_]),_i(()=>{if(In||Tt==null)return;ua(!1)},[ua,In,Tt]);let an=Bl(()=>Tt==null?null:`${Tt.path}::${Tt.source}`,[Tt]);_i(()=>{if(an==null){C?.clearSlotContent(Ep);return}let O=zn.current;if(O==null)return;let he=E.current??B.current;if(he==null)return;let Ze={anchorElement:he,anchorRect:O.anchorRect??Ohe(he.getBoundingClientRect()),close:($e)=>{zo.current($e?.restoreFocus??!0)},restoreFocus:()=>{if(!Tn.current)return;Ss.current(zn.current?.path??null)}},De=e?.contextMenu?.render?.(O.item,Ze)??null;return C?.setSlotContent(Ep,De),e?.contextMenu?.onOpen?.(O.item,Ze),mY(De),queueMicrotask(()=>{if(De==null||!De.isConnected)return;if(document.activeElement!==De)return;mY(De)}),()=>{C?.clearSlotContent(Ep)}},[an,e?.contextMenu,C]),_i(()=>{if(Tt!=null&&t.getItem(Tt.path)==null)ua()},[ua,Tt,t]),_i(()=>{if(Tt==null)return;let O=M.current?.getRootNode(),he=O instanceof ShadowRoot?O.host:M.current,Ze=($e)=>{let Xe=$e.target;if(!(Xe instanceof Node))return;if(sY($e))return;if(B.current?.contains(Xe)===!0)return;if(he?.contains(Xe)===!0)return;ua()},De=($e)=>{if($e.key==="Escape")$e.preventDefault(),$e.stopPropagation(),ua()};return document.addEventListener("mousedown",Ze,!0),document.addEventListener("keydown",De,!0),()=>{document.removeEventListener("mousedown",Ze,!0),document.removeEventListener("keydown",De,!0)}},[ua,Tt]),_i(()=>{let O=P.current,he=M.current;if(O==null||he==null){se.current=wt;return}let Ze=wt==null?null:W.current.get(wt)??null,De=Ah(he),$e=De?.dataset.itemPath??null,Xe=xc&&F.current===De,rn=h&&q.current===De,nt=Ce.current&&!tr,Kt=U.current??0,on=Ei.current,L=ca.current,j=Xa.current,K=yr.current,ie=De!=null,oe=V.current||ie,fe=se.current!==wt,Ge=L!=null&&L===wt&&wt!=null,rt=!1,Xt=!1;if(uo!=null&&uo.id!==re.current){re.current=uo.id;let sg=uo.visibleIndex,qp=t.getVisibleRows(sg,sg)[0]??null;if(qp!=null){let Wo=_?Math.max(0,Math.min(qp.ancestorPaths.length*d,Math.max(0,wn-d))):va;rt=!0,Xt=PZ(O,sg,d,wn,da,uo.offset,Wo)}t.clearScrollRequest(uo.id)}let Hn=!rt&&nt&&MA(O,$t,d,wn,da,Kt),mt=!rt&&on!=null&&on===wt&&MA(O,$t,d,wn,da,va),Pn=!rt&&j!=null&&j.path===wt&&MA(O,$t,d,wn,da,j.viewportOffset),Ms=!rt&&K!=null&&K.path===wt&&O.scrollTop!==K.scrollTop;if(Ms)O.scrollTop=K.scrollTop;if(Ms||Xt||mt||Pn||Hn||oe&&fe&&on!==wt&&!Ge&&MS(O,$t,d,wn,va))ye.current();if(rt){se.current=wt;return}if(!oe){se.current=wt;return}if(Xe){se.current=wt;return}if(rn&&!nt){se.current=wt;return}if(Ze==null){if(nt&&$t>=0)MA(O,$t,d,wn,da,Kt),ye.current();se.current=wt;return}if(fe||nt||on===wt||L===wt||j?.path===wt||K?.path===wt||$e==null||$e!==wt){if(Lp(Ze),on===wt)Ei.current=null;if(L===wt)ca.current=null;if(j?.path===wt)Xa.current=null;if(K?.path===wt)yr.current=null;Ce.current=!1,U.current=null}se.current=wt},[t,$t,wt,Dl,d,xc,tr,_a,wn,h,uo,_,va,da,Pa]);let Ic=$t>=0&&$t>=un.visible.startIndex&&$t<=un.visible.endIndex,Sl=wt!=null&&pn.some((O)=>$A(O.row)===wt),qa=Ic||Sl,ig=Ta&&V.current===!0&&qa?wt:null,Ho=ei==="pointer"?Oe:null,go=Tt?.path??Ii.current??Ho??ig??Oe,fo=Tt?.source==="right-click";_i(()=>{if(I.current&&Tt==null)return;Fr(lo(go))},[Tt,lo,_a,wn,Va,pn,go,Fr,Pa]);let Ns=fr((O)=>{if(I.current)return;if(sY(O))return;let he=O.target;if(!(he instanceof HTMLElement))return;if(he.closest?.('[data-type="context-menu-trigger"]')!=null)return;let Ze=he.closest?.('[data-file-tree-sticky-row="true"]'),De=he.closest?.('[data-type="item"]'),$e=Ze instanceof HTMLElement?Ze.dataset.fileTreeStickyPath??null:De instanceof HTMLElement?De.dataset.itemPath??null:null;if($e!=null)Ja((Xe)=>Xe==="pointer"?Xe:"pointer");Mn((Xe)=>Xe===$e?Xe:$e)},[]),Uo=fr(()=>{Mn(null)},[]);_i(()=>{if(!Ca)return;let O=()=>{Ec(),t.cancelDrag()};return window.addEventListener("dragend",O),()=>{window.removeEventListener("dragend",O),Ec(),t.cancelDrag()}},[t,Ca]);let Fl=(O)=>{if(!Ca||t.getDragSession()==null||Le.current)return;let he=rY(O.target instanceof HTMLElement?O.target:null);if(t.setDragTarget(he),kr(t.getDragSession()?.target??null),Oo(O.clientX,O.clientY),O.dataTransfer!=null)O.dataTransfer.dropEffect="move";O.preventDefault()},Rr=(O)=>{if(!Ca||t.getDragSession()==null||Le.current)return;let he=O.relatedTarget;if(he instanceof Node&&M.current?.contains(he)===!0)return;$n(),mo(),t.setDragTarget(null)},mu=(O)=>{if(!Ca||t.getDragSession()==null||Le.current)return;O.preventDefault(),Yn(O.clientX,O.clientY),t.completeDrag(),vt(),$n(),mo(),Ee.current=null},ai=un.window.height,bo=un.window.offsetTop,Cr=Math.min(0,wn-ai),Ll=Math.min(0,wn-ai-va),Au=ft===wt||Ce.current,Ri=wt!=null&&Au&&!Dl&&$t>=0?Pa[$t]??t.getVisibleRows($t,$t)[0]??null:null,gu=Ri==null?null:jS($t,d,_a,ai),ri=Ee.current,og=Po!=null&&ri!=null&&ri.path===Po&&ri.index>=_a.start&&ri.index<=_a.end,Zo=Po!=null&&ri!=null&&ri.path===Po&&!og&&ri.path!==Ri?.path?ri:null,Yo=Zo==null?null:jS(Zo.index,d,_a,ai),fu=qhe(($t>=0?Pa[$t]??t.getVisibleRows($t,$t)[0]??null:null)?.ancestorPaths.at(-1)??null),$p=tr&&wt!=null?fY(l,wt,!Dl):void 0,Rl=Tt?.path??(tr?wt:ft),Nl=Tt?.path??Oe,Ko=lo(go),Ml=In&&Ta&&!fo&&!xc&&Ko!=null&&bt!=null&&go!=null,ho=In&&(Ml||Tt!=null),ii=Tt?.anchorRect,_r=ii==null&&Ko!=null&&bt!=null&&(Tt!=null||Ml)?bt:null,Pp=ii!=null?{left:`${ii.left}px`,position:"fixed",right:"auto",top:`${ii.top}px`}:_r!=null?{top:`${_r}px`}:void 0,bu=fo?{opacity:"0"}:void 0,vr=fr((O,he,Ze,De)=>{let $e=OZ({event:{ctrlKey:O.ctrlKey,metaKey:O.metaKey,shiftKey:O.shiftKey},isDirectory:he.kind==="directory",isSearchOpen:tr,mode:De}),Xe=$e.toggleDirectory&&he.kind==="directory",rn=Xe?t.resolveMountedDirectoryPathFromInput(Ze):null;if(Xe&&rn==null)return;let nt=rn??Ze;switch($e.selection.kind){case"range":t.selectPathRange(nt,$e.selection.additive);break;case"toggle":t.togglePathSelectionFromInput(nt);break;case"single":t.selectOnlyMountedPathFromInput(nt);break}let Kt=O.currentTarget instanceof HTMLElement?O.currentTarget:null,on=he.index>=un.visible.startIndex&&he.index<=un.visible.endIndex,L=De==="flow"&&on&&Kt!=null&&Kt.dataset.itemParked!=="true";if(t.focusMountedPathFromInput(nt),L)V.current=!0,Vt((j)=>j===nt?j:nt),Ja("focus");if(Xe)t.toggleMountedDirectoryFromInput(nt);if($e.closeSearch)t.closeSearch();if($e.revealCanonical)Lr(nt,{targetOffset:"sticky-parents"})},[t,tr,un.visible.endIndex,un.visible.startIndex,Lr]),yo=()=>{if(I.current)return;if(!Ta)return;if(go==null||Ko==null)return;let O=t.getItem(go);if(O==null)return;Fr(Ko),Tn.current=!0,so({anchorRect:null,item:{kind:O.isDirectory()?"directory":"file",name:Ko.getAttribute("aria-label")??go,path:O.getPath()},path:O.getPath(),source:"button"})},On={contextHoverPath:Nl,contextMenuButtonTriggerEnabled:Ta,contextMenuButtonVisibility:Di,contextMenuEnabled:In,contextMenuRightClickEnabled:co,contextMenuTriggerMode:ti,controller:t,directoriesWithGitChanges:o,dragAndDropEnabled:Ca,draggedPathSet:rg,dragTarget:uu,gitLaneActive:yt,gitStatusByPath:n,handleRowDragEnd:pu,handleRowDragStart:ni,handleRowTouchStart:Rs,ignoredGitDirectories:r,ignoredInheritanceCache:Ke,instanceId:l,itemHeight:d,onKeyDown:Ao,onRowClick:vr,openContextMenuForRow:Ba,registerButton:er,registerRenameInput:du,renameView:Si,renderDecorationForRow:Ds,resolveIcon:Dr,shouldSuppressContextMenu:Fs,visualFocusPath:Rl},oi={...On,registerButton:na};return Ne("div",{ref:M,id:Ql,"data-file-tree-context-menu-button-visibility":In&&Ta?Di:void 0,"data-file-tree-context-menu-trigger-mode":In?ti:void 0,"data-file-tree-has-context-menu-action-lane":In&&Ta?"true":void 0,"data-file-tree-has-git-lane":yt?"true":void 0,"data-file-tree-virtualized-root":"true",onDragLeave:Ca?Rr:void 0,onDragOver:Ca?Fl:void 0,onDrop:Ca?mu:void 0,onKeyDown:Ao,onPointerLeave:In?Uo:void 0,onPointerOver:In?Ns:void 0,role:"tree",tabIndex:-1,style:{outline:"none",position:"relative"},children:[Ne("style",{"data-file-tree-guide-style":"true",dangerouslySetInnerHTML:{__html:fu}}),Ne("slot",{name:xp,"data-type":"header-slot"}),h?Ne("div",{"data-file-tree-search-container":!0,"data-open":tr?"true":"false",children:Ne("input",{ref:q,"aria-activedescendant":$p,"aria-controls":Ql,placeholder:"Search…","data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Qe?"true":void 0,value:ag,onBlur:()=>{if(b==="retain"&&!it.current)return;t.closeSearch()},onFocus:tt,onPointerDown:tt,onInput:(O)=>{tt();let he=O.currentTarget;t.setSearch(he.value)}})}):null,Ne("div",{ref:P,"data-file-tree-virtualized-scroll":"true",children:[_&&la&&pn.length>0?Ne("div",{"aria-hidden":"true","data-file-tree-sticky-overlay":"true",children:Ne("div",{"data-file-tree-sticky-overlay-content":"true",style:{height:`${$a}px`},children:pn.map((O,he)=>U_(oi,O.row,`sticky:${$A(O.row)}`,{mode:"sticky",style:{left:"0",position:"absolute",right:"0",top:`${O.top}px`,zIndex:`${pn.length-he}`}}))})}):null,Ne("div",{ref:D,"data-file-tree-virtualized-list":"true",style:{height:`${da}px`},children:[Ne("div",{"data-file-tree-virtualized-sticky-offset":"true","aria-hidden":"true",style:{height:`${bo}px`}}),Ne("div",{"data-file-tree-virtualized-sticky":"true",style:{height:`${ai}px`,top:`${Cr}px`,bottom:`${Ll}px`},children:[Vhe(On,_a,Go),Ri!=null&&gu!=null?U_(On,Ri,`parked:${Ri.path}`,{isParked:!0,style:{left:"0",opacity:"0",pointerEvents:Po===Ri.path?"none":void 0,position:"absolute",right:"0",top:`${gu}px`}}):null,Zo!=null&&Yo!=null?U_(On,Zo,`parked-drag:${Zo.path}`,{isParked:!0,style:{left:"0",opacity:"0",pointerEvents:"none",position:"absolute",right:"0",top:`${Yo}px`}}):null]})]})]}),In?Ne("div",{ref:B,"data-type":"context-menu-anchor","data-visible":ho?"true":"false",style:Pp,children:[Ne("button",{ref:E,type:"button","data-type":cH,"aria-label":"Options","aria-haspopup":"menu","aria-expanded":Tt!=null?"true":"false","data-visible":Ml?"true":"false",onMouseDown:(O)=>{O.preventDefault()},onClick:(O)=>{if(O.preventDefault(),O.stopPropagation(),Tt!=null){ua();return}yo()},tabIndex:-1,style:bu,children:Ne(RA,{...Dr("file-tree-icon-ellipsis")})}),Tt!=null?Ne("slot",{name:Ep}):null]}):null,Tt!=null?Ne("div",{"data-type":"context-menu-wash","aria-hidden":"true",onMouseDownCapture:(O)=>{O.preventDefault(),ua()},onTouchStartCapture:(O)=>{O.preventDefault(),O.stopPropagation(),ua()},onTouchMoveCapture:(O)=>{O.preventDefault(),O.stopPropagation()},onWheelCapture:(O)=>{O.preventDefault(),O.stopPropagation()}}):null]})}var US={hydrateRoot:(e,t)=>{vZ(LA(HS,t),e)},renderRoot:(e,t)=>{z_(LA(HS,t),e)},unmountRoot:(e)=>{z_(null,e)}};function PA(e,t){US.renderRoot(e,t)}function bY(e,t){US.hydrateRoot(e,t)}function hY(e){US.unmountRoot(e)}var yY=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#c(e);if(t==null)return;t.remove(),this.#e.delete(e)}setHost(e){if(this.#t=e,e==null)return;this.#r(e);for(let[t,n]of this.#e)this.#o(t,n)}setSlotContent(e,t){let n=this.#c(e);if(n===t){if(t!=null)this.#e.set(e,t),this.#o(e,t);return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#o(e,t)}setSlotHtml(e,t){let n=t?.trim()??"";if(n.length===0){this.setSlotContent(e,null);return}let r=this.#c(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#o(e,r);return}let o=document.createElement("div");o.innerHTML=n,this.setSlotContent(e,o)}#c(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let r of Array.from(n.children)){if(!(r instanceof HTMLElement))continue;if(r.dataset.fileTreeManagedSlot===e)return r}return null}#o(e,t){if(t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t)this.#t.appendChild(t)}#r(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let n=t.dataset.fileTreeManagedSlot;if(n==null||this.#e.has(n))continue;this.#e.set(n,t)}}};var wY=0;function Xhe(e){if(e!=null&&e.length>0)return e;return wY+=1,`pst_ft_${wY}`}function eye({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??k_)}function kY(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 CY(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 _Y(e){return Array.from(e.children).filter((t)=>t instanceof SVGElement)}var vY=class{static LoadedCustomComponent=!0;#e;#t;#c;#o;#r;#I;#P;#b;#a;#h=new yY;#Q;#y;#g;#p;#w;#k;#m;#q;#G;#N=null;#i;#z=!1;#O=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:o,id:c,initialSearchQuery:l,icons:d,itemHeight:p,onSearchChange:A,onSelectionChange:f,overscan:b,renderRowDecoration:h,renaming:w,search:C,searchBlurBehavior:_,searchFakeFocus:v,stickyFolders:B,unsafeCSS:E,initialVisibleRowCount:I,...D}=e;this.#e=t,this.#c=Xhe(c),this.#p=kS(o),this.#w=d,this.#k=E,this.#o=f,this.#r=h,this.#I=w!=null&&w!==!1,this.#P=_,this.#b=C===!0,this.#a=v===!0,this.#Q=bH(n,p),this.#y={itemHeight:this.#Q.itemHeight,overscan:b,stickyFolders:B,initialVisibleRowCount:I},this.#t=new tZ({...D,fileTreeSearchMode:r,initialSearchQuery:l,onSearchChange:A,renaming:w}),this.#G=this.#t.getSelectionVersion(),this.#N=this.#o==null?null:this.subscribe(()=>{this.#S()})}unmount(){if(this.#i!=null)hY(this.#i),delete this.#i.dataset.fileTreeVirtualizedWrapper,this.#i=void 0;if(this.#h.clearAll(),this.#h.setHost(null),this.#g!=null)delete this.#g.dataset.fileTreeVirtualized,this.#j(this.#g),this.#g=void 0}cleanUp(){this.unmount(),this.#N?.(),this.#N=null,this.#t.destroy()}getFileTreeContainer(){return this.#g}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getFocusedIndex(){return this.#t.getFocusedIndex()}getVisibleCount(){return this.#t.getVisibleCount()}getVisibleRows(e,t){return this.#t.getVisibleRows(e,t)}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#Q.itemHeight}getDensityFactor(){return this.#Q.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusFirstItem(){this.#t.focusFirstItem()}focusLastItem(){this.#t.focusLastItem()}focusNextItem(){this.#t.focusNextItem()}focusPreviousItem(){this.#t.focusPreviousItem()}focusParentItem(){this.#t.focusParentItem()}scrollToPath(e,t){this.#t.scrollToPath(e,t)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}applyGitStatusPatch(e){let t=iZ(this.#p,e);if(t===this.#p)return;this.#p=t;let n=this.#l();if(n==null)return;PA(n.wrapper,this.#D())}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){if(Array.isArray(e))this.#t.resetPaths(e,t);else this.#t.resetPaths(e)}setComposition(e){this.#e=e;let t=this.#l();if(t==null)return;this.#B(),PA(t.wrapper,this.#D())}setGitStatus(e){let t=kS(e,this.#p);if(t===this.#p)return;this.#p=t;let n=this.#l();if(n==null)return;PA(n.wrapper,this.#D())}setIcons(e){this.#w=e;let t=this.#l();if(t==null)return;this.#f(t.host,t.wrapper),PA(t.wrapper,this.#D())}hydrate({fileTreeContainer:e}){let t=this.#L(e),n=this.#M(t);this.#B(),bY(n,this.#D())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#L(t??this.#g,e),r=this.#M(n);this.#B(),PA(r,this.#D())}#V(){return{initialViewportHeight:eye({initialVisibleRowCount:this.#y.initialVisibleRowCount,itemHeight:this.#y.itemHeight}),itemHeight:this.#y.itemHeight,overscan:this.#y.overscan,stickyFolders:this.#y.stickyFolders}}#D(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#w,instanceId:this.#c,renamingEnabled:this.#I,renderRowDecoration:this.#r,searchBlurBehavior:this.#P,searchEnabled:this.#b,searchFakeFocus:this.#a,slotHost:this.#h,...this.#V()}}#l(){let e=this.#g,t=this.#i;if(e==null||t==null)return null;return{host:e,wrapper:t}}#f(e,t){let n=e.shadowRoot;if(n!=null)this.#H(n),this.#U(n);this.#Z(t)}#S(){let e=this.#o;if(e==null)return;let t=this.#t.getSelectionVersion();if(t===this.#G)return;this.#G=t,e(this.#t.getSelectedPaths())}#B(){let e=this.#e?.header?.render;if(e!=null){this.#h.setSlotContent(xp,e());return}this.#h.setSlotHtml(xp,this.#e?.header?.html??null)}#H(e){let t=_Y(e).find((r)=>CY(r)),n=kY(mH(vA(this.#w).set));if(n==null)return;if(t!=null&&t.outerHTML===n.outerHTML)return;if(t!=null)t.replaceWith(n);else e.prepend(n)}#U(e){let t=_Y(e),n=t.find((l)=>CY(l)),r=t.filter((l)=>l!==n),o=vA(this.#w).spriteSheet?.trim()??"";if(o.length===0){for(let l of r)l.remove();return}let c=kY(o);if(c==null){for(let l of r)l.remove();return}if(r.length===1&&r[0].outerHTML===c.outerHTML)return;for(let l of r)l.remove();e.appendChild(c)}#Z(e){let t=vA(this.#w);if(t.colored&&gH(t.set))e.dataset.fileTreeColoredIcons="true";else delete e.dataset.fileTreeColoredIcons}#d(e){let t=e.querySelector(`style[${Z2}]`);if(this.#m==null&&t instanceof HTMLStyleElement)this.#m=t;if(this.#k==null||this.#k===""){this.#m?.remove(),this.#m=void 0,this.#q=void 0;return}if(this.#m?.parentNode===e&&this.#q===this.#k)return;if(this.#m??=document.createElement("style"),this.#m.setAttribute(Z2,""),this.#m.parentNode!==e)e.appendChild(this.#m);this.#m.textContent=hH(this.#k),this.#q=this.#k}#M(e){if(this.#i!=null)return this.#i;let t=e.shadowRoot;if(t==null)throw Error("FileTree requires a shadow root");let n=Array.from(t.children).filter((o)=>o instanceof HTMLDivElement&&typeof o.dataset.fileTreeId==="string"&&o.dataset.fileTreeId.length>0),r=n.find((o)=>o.dataset.fileTreeId===this.#c)??n[0];if(r!=null)this.#c=r.dataset.fileTreeId??this.#c;if(this.#i=r??document.createElement("div"),this.#i.dataset.fileTreeId=this.#c,this.#i.dataset.fileTreeVirtualizedWrapper="true",this.#f(e,this.#i),this.#i.parentNode!==t)t.appendChild(this.#i);return this.#i}#L(e,t){let n=e??this.#g??document.createElement("file-tree-container");if(t!=null&&n.parentNode!==t)t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:"open"});return v_(n,r),this.#d(r),n.dataset.fileTreeVirtualized="true",n.style.display="flex",this.#v(n),this.#h.setHost(n),this.#g=n,n}#v(e){if(e.style.getPropertyValue("--trees-item-height")==="")e.style.setProperty("--trees-item-height",`${String(this.#Q.itemHeight)}px`),this.#z=!0;if(e.style.getPropertyValue("--trees-density-override")==="")e.style.setProperty("--trees-density-override",String(this.#Q.factor)),this.#O=!0}#j(e){if(this.#z)e.style.removeProperty("--trees-item-height"),this.#z=!1;if(this.#O)e.style.removeProperty("--trees-density-override"),this.#O=!1}};var qA=jt(cr(),1);function ZS(e){let[t]=qA.useState(()=>new vY(e)),n=qA.useRef({timeout:null,model:t});return qA.useEffect(()=>{let{current:r}=n;if(r.timeout!=null)clearTimeout(r.timeout),r.timeout=null;return()=>{r.timeout=setTimeout(()=>r.model.cleanUp(),1)}},[]),{model:t}}var K_=jt(cr(),1);var Z_=(...e)=>e.filter((t,n,r)=>Boolean(t)&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();var BY=(e)=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var xY=(e)=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());var YS=(e)=>{let t=xY(e);return t.charAt(0).toUpperCase()+t.slice(1)};var fh=jt(cr(),1);var Y_={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var EY=(e)=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var GA=jt(cr(),1),tye=GA.createContext({});var IY=()=>GA.useContext(tye);var QY=fh.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:o="",children:c,iconNode:l,...d},p)=>{let{size:A=24,strokeWidth:f=2,absoluteStrokeWidth:b=!1,color:h="currentColor",className:w=""}=IY()??{},C=r??b?Number(n??f)*24/Number(t??A):n??f;return fh.createElement("svg",{ref:p,...Y_,width:t??A??Y_.width,height:t??A??Y_.height,stroke:e??h,strokeWidth:C,className:Z_("lucide",w,o),...!c&&!EY(d)&&{"aria-hidden":"true"},...d},[...l.map(([_,v])=>fh.createElement(_,v)),...Array.isArray(c)?c:[c]])});var It=(e,t)=>{let n=K_.forwardRef(({className:r,...o},c)=>K_.createElement(QY,{ref:c,iconNode:t,className:Z_(`lucide-${BY(YS(e))}`,`lucide-${e}`,r),...o}));return n.displayName=YS(e),n};var nye=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],eu=It("columns-2",nye);var aye=[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]],tu=It("text-wrap",aye);var rye=[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]],bh=It("app-window",rye);var iye=[["path",{d:"M12 6V2H8",key:"1155em"}],["path",{d:"M15 11v2",key:"i11awn"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 16a2 2 0 0 1-2 2H8.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 4 20.286V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2z",key:"11gyqh"}],["path",{d:"M9 11v2",key:"1ueba0"}]],hh=It("bot-message-square",iye);var oye=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],yh=It("check",oye);var sye=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],zA=It("chevron-down",sye);var cye=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],wh=It("chevron-left",cye);var lye=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],OA=It("chevron-right",lye);var dye=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],kh=It("copy",dye);var uye=[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}],["path",{d:"M3 16v5h5",key:"1t08am"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 8V3h5",key:"1ln10m"}],["path",{d:"M9 9 3 3",key:"v551iv"}]],Ch=It("expand",uye);var pye=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],_h=It("folder-tree",pye);var mye=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],HA=It("folder",mye);var Aye=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],UA=It("git-branch",Aye);var gye=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],vh=It("layout-dashboard",gye);var fye=[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]],Bh=It("list-ordered",fye);var bye=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],xh=It("message-square",bye);var hye=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Eh=It("rotate-cw",hye);var yye=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ih=It("search",yye);var wye=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Qh=It("settings",wye);var kye=[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]],Dh=It("shrink",kye);var Cye=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Sh=It("upload",Cye);var Y=jt(cr(),1),cW=jt(Ww(),1);var DY={name:"reviewme",version:"0.0.8",license:"Apache-2.0",description:"A local, browser-based Git branch review tool with inline comments and Codex threads.",type:"module",bin:{reviewme:"bin/reviewme.mjs"},files:["bin","dist/frontend","dist/server","examples/themes","LICENSE","README.md","THIRD_PARTY_NOTICES.md"],engines:{node:">=22.13"},publishConfig:{access:"public"},scripts:{clean:"node scripts/clean-dist.mjs",dev:"npm run build && node ./bin/reviewme.mjs","build:frontend":"bun build ./src/frontend/index.html ./node_modules/@pierre/diffs/dist/worker/worker.js --outdir ./dist/frontend --entry-naming '[name].[ext]' --chunk-naming 'chunks/[name]-[hash].[ext]' --asset-naming 'assets/[name]-[hash].[ext]' --minify","build:server":"bun build ./src/server/main.ts --target=node --outdir=./dist/server --entry-naming=main.js --minify --sourcemap=linked",build:"npm run clean && npm run build:frontend && npm run build:server","release:auth":"npm whoami --registry=https://registry.npmjs.org/ >/dev/null 2>&1 || npm login --auth-type=web --registry=https://registry.npmjs.org/","release:check":"npm run build && node scripts/verify-release.mjs",release:"npm run release:auth && npm run release:check && npm publish --ignore-scripts",prepack:"npm run build && node scripts/verify-release.mjs",start:"./bin/reviewme.mjs",test:"bun test",typecheck:"tsc --noEmit"},devDependencies:{"@pierre/diffs":"^1.3.6","@pierre/trees":"^1.0.0-beta.6","@types/react":"^19.2.2","@types/react-dom":"^19.2.2","bun-types":"^1.3.14","lucide-react":"^1.35.0",react:"^19.2.8","react-dom":"^19.2.8",typescript:"^5.9.3",yaml:"^2.9.0"}};function W_(e){if(e==null||typeof e!=="object")return null;let t=e,n=typeof t.path==="string"?t.path:void 0;if(n==null||n.length===0)return null;let r=t.kind==="file"||t.kind==="diff_range"?t.kind:t.startLine!=null||t.endLine!=null?"diff_range":"file",o=t.side==="old"||t.side==="new"?t.side:void 0,c=SY(t.startLine),l=SY(t.endLine);if(r==="diff_range"&&(c==null||l==null||o==null))return null;return{id:typeof t.id==="string"?t.id:void 0,kind:r,path:n,side:o,startLine:c,endLine:l,contextHash:typeof t.contextHash==="string"?t.contextHash:void 0}}function KS(e){if(e==null||typeof e!=="object")return null;let t=e,n=typeof t.id==="string"?t.id:void 0,r=typeof t.body==="string"?t.body:typeof t.message==="string"?t.message:void 0,o=W_(t.anchor??t);if(n==null||r==null||o==null)return null;let c=t.agentSession??t.agent,l=J_(c);return{id:n,snapshotId:typeof t.snapshotId==="string"?t.snapshotId:void 0,anchor:o,body:r,createdAt:typeof t.createdAt==="string"?t.createdAt:void 0,updatedAt:typeof t.updatedAt==="string"?t.updatedAt:void 0,agentSession:l}}function WS(e){if(e==null||typeof e!=="object")return null;let t=e,n=typeof t.id==="string"?t.id:void 0,r=typeof t.body==="string"?t.body:typeof t.message==="string"?t.message:void 0,o=W_(t.anchor??t);if(n==null||r==null||o==null)return null;return{id:n,snapshotId:typeof t.snapshotId==="string"?t.snapshotId:void 0,anchor:o,body:r,updatedAt:typeof t.updatedAt==="string"?t.updatedAt:void 0}}function J_(e){if(e==null||typeof e!=="object")return null;let t=e;if(typeof t.id!=="string")return null;return{id:t.id,provider:typeof t.provider==="string"?t.provider:"codex",externalThreadId:typeof t.externalThreadId==="string"?t.externalThreadId:typeof t.threadId==="string"?t.threadId:null,model:typeof t.model==="string"?t.model:null,effort:typeof t.effort==="string"?t.effort:typeof t.reasoningEffort==="string"?t.reasoningEffort:null,permissionMode:typeof t.permissionMode==="string"?t.permissionMode:"read-only",status:typeof t.status==="string"?t.status:"idle"}}function FY(e){if(e==null||typeof e!=="object")return{models:[]};let t=e,r=(Array.isArray(t.models)?t.models:[]).flatMap((l)=>{let d=vye(l);return d==null?[]:[d]}),c=(Array.isArray(t.efforts)?t.efforts:[]).flatMap((l)=>{let d=LY(l);return d==null?[]:[d]});return{models:r,defaultModel:typeof t.defaultModel==="string"?t.defaultModel:void 0,defaultEffort:typeof t.defaultEffort==="string"?t.defaultEffort:void 0,efforts:c}}function vye(e){if(typeof e==="string")return{id:e,label:e};if(e==null||typeof e!=="object")return null;let t=e,n=typeof t.id==="string"?t.id:typeof t.slug==="string"?t.slug:void 0;if(n==null)return null;let r=Array.isArray(t.reasoningEfforts)?t.reasoningEfforts:Array.isArray(t.supportedReasoningEfforts)?t.supportedReasoningEfforts:Array.isArray(t.efforts)?t.efforts:[];return{id:n,label:typeof t.label==="string"?t.label:typeof t.displayName==="string"?t.displayName:n,description:typeof t.description==="string"?t.description:void 0,default:t.default===!0||t.isDefault===!0,defaultReasoningEffort:typeof t.defaultReasoningEffort==="string"?t.defaultReasoningEffort:typeof t.default_reasoning_effort==="string"?t.default_reasoning_effort:void 0,reasoningEfforts:r.flatMap((o)=>{let c=LY(o);return c==null?[]:[c]})}}function LY(e){if(typeof e==="string")return{id:e,label:e};if(e==null||typeof e!=="object")return null;let t=e,n=typeof t.id==="string"?t.id:typeof t.value==="string"?t.value:void 0;if(n==null)return null;return{id:n,label:typeof t.label==="string"?t.label:n,description:typeof t.description==="string"?t.description:void 0,default:t.default===!0}}function SY(e){if(typeof e!=="number"||!Number.isInteger(e)||e<1)return;return e}function RY(){if(typeof window>"u")return;let e=new URLSearchParams(window.location.search).get("token");if(e!=null&&e.trim()!=="")return e;return document.querySelector('meta[name="reviewme-token"]')?.getAttribute("content")?.trim()||void 0}function Bye(){if(typeof window>"u")return"";return document.querySelector('meta[name="reviewme-api"]')?.getAttribute("content")?.replace(/\/$/,"")||""}function br(e){let t=new Headers(e);t.set("Accept","application/json");let n=RY();if(n!=null)t.set("Authorization",`Bearer ${n}`);return t}async function Nn(e){if(!e.ok){let n=(await e.text()).trim();throw Error(n.length>0?n:`ReviewMe request failed (${e.status}).`)}if((e.headers.get("content-type")??"").includes("application/json"))return await e.json();return{patch:await e.text()}}function yn(e,t){let r=`${Bye()}${e}`;return t==null||t.size===0?r:`${r}?${t.toString()}`}function ys(e,t){return{method:e,headers:br({"Content-Type":"application/json"}),body:JSON.stringify(t),cache:"no-store"}}function xye(e){return{method:"PATCH",headers:br({"Content-Type":"application/json"}),body:JSON.stringify(e),cache:"no-store"}}function nu(e){let t=new URLSearchParams;if(e==null)return t;if(t.set("from",e.from),t.set("to",e.to),t.set("mode",e.mode),e.includeUnstaged===!0)t.set("includeUnstaged","true");return t}function hc(e){if(e==null)return{};return{from:e.from,to:e.to,mode:e.mode,includeUnstaged:e.includeUnstaged===!0}}function JS(e,t){if(Array.isArray(e))return e;if(ws(e)&&Array.isArray(e[t]))return e[t];return[]}function Eye(e){let t=ws(e)?e:{},n=t.reviewedPaths??t.reviewed??t.files,r=Array.isArray(n)?n.flatMap((d)=>{if(typeof d==="string")return[d];if(ws(d)&&typeof d.path==="string"&&d.reviewed!==!1)return[d.path];return[]}):[],o=JS(e,"threads").concat(Array.isArray(t.comments)?t.comments:[]).flatMap((d)=>{let p=KS(d);return p==null?[]:[p]}),c=JS(e,"drafts").flatMap((d)=>{let p=WS(d);return p==null?[]:[p]}),l=JS(e,"agentConversations").flatMap(NY);return{snapshotId:typeof t.snapshotId==="string"?t.snapshotId:void 0,reviewedPaths:[...new Set(r)],threads:VS(o),drafts:VS(c),agentConversations:VS(l)}}function NY(e){let t=J_(e);if(t==null||!ws(e))return[];let n=Array.isArray(e.contexts)?e.contexts.flatMap((r)=>{if(!ws(r)||typeof r.id!=="string"||typeof r.prompt!=="string")return[];let o=W_(r.anchor);if(o==null)return[];return[{id:r.id,sourceThreadId:typeof r.sourceThreadId==="string"?r.sourceThreadId:null,anchor:o,prompt:r.prompt,createdAt:typeof r.createdAt==="string"?r.createdAt:void 0}]}):[];return[{...t,contexts:n}]}function VS(e){let t=new Set,n=[];for(let r of e){if(t.has(r.id))continue;t.add(r.id),n.push(r)}return n}class MY{async getAppSettings(){let e=await fetch(yn("/api/settings"),{headers:br(),cache:"no-store"});return Nn(e)}async setBrowserTabTitleMode(e){let t=await fetch(yn("/api/settings/browser-tab-title"),ys("PUT",{mode:e}));return Nn(t)}async setExitOnClose(e,t){let n=await fetch(yn("/api/settings/exit-on-close"),ys("PUT",{enabled:e,afterSeconds:t}));return Nn(n)}async getColorTheme(){let e=await fetch(yn("/api/theme"),{headers:br(),cache:"no-store"});return(await Nn(e)).theme}async getRepository(){let e=await fetch(yn("/api/repository"),{headers:br(),cache:"no-store"}),t=await Nn(e);return"repository"in t?t.repository:t}async listRefs(){let e=await fetch(yn("/api/refs"),{headers:br(),cache:"no-store"}),t=await Nn(e);return Array.isArray(t)?t:t.refs??[]}async listCommits(e){let t=await fetch(yn("/api/commits",nu(e)),{headers:br(),cache:"no-store"});return Nn(t)}async getDiff(e){let t=new URLSearchParams({from:e.from,to:e.to,mode:e.mode});if(e.includeUnstaged===!0)t.set("includeUnstaged","true");let n=await fetch(yn("/api/metadata",t),{headers:br(),cache:"no-store"}),r=await Nn(n);if(ws(r)&&Array.isArray(r.files)){let o=r.files.flatMap((d)=>{if(!ws(d))return[];let p=typeof d.id==="string"?d.id:void 0,A=typeof d.path==="string"?d.path:void 0;if(p==null||A==null)return[];return[{id:p,path:A,previousPath:typeof d.oldPath==="string"?d.oldPath:void 0,status:Iye(typeof d.status==="string"?d.status:"modified"),additions:typeof d.additions==="number"?d.additions:0,deletions:typeof d.deletions==="number"?d.deletions:0}]}),c=Array(o.length),l=0;return await Promise.all(Array.from({length:Math.min(8,o.length)},async()=>{while(l<o.length){let d=l++,p=o[d],A=await fetch(yn(`/api/files/${encodeURIComponent(p.id)}/diff`),{headers:br(),cache:"no-store"}),f=await Nn(A);c[d]=f.patch??""}})),{from:e.from,to:e.to,mode:e.mode,files:o,patch:c.filter(Boolean).join(`
3053
3053
  `)}}return r}async streamDiff(e,t){let n=new URLSearchParams({from:e.from,to:e.to,mode:e.mode});if(e.includeUnstaged===!0)n.set("includeUnstaged","true");let r=br();return r.set("Accept","text/plain"),fetch(yn("/api/patch-stream",n),{headers:r,cache:"no-store",signal:t})}async loadFileDiff(e,t){let n=new URLSearchParams;if(t!=null){if(n.set("hydrate","true"),n.set("from",t.request.from),n.set("to",t.request.to),n.set("mode",t.request.mode),t.request.includeUnstaged===!0)n.set("includeUnstaged","true");if(t.oldPath!=null)n.set("oldPath",t.oldPath);if(t.newPath!=null)n.set("newPath",t.newPath);if(t.pureRename===!0)n.set("pureRename","true")}let r=await fetch(yn(`/api/files/${encodeURIComponent(e)}/diff`,n),{headers:br(),cache:"no-store"});return Nn(r)}async openWorkingFile(e){let t=await fetch(yn("/api/open-working-file"),ys("POST",{...e}));await Nn(t)}async openFileDiff(e){await this.openWorkingFile({path:e})}async revealInExplorer(e){await this.openWorkingFile({path:e})}async getReviewState(e){let t=await fetch(yn("/api/review",nu(e)),{headers:br(),cache:"no-store"});return Eye(await Nn(t))}async setReviewed(e,t,n){let r=encodeURIComponent(e),o=await fetch(yn(`/api/review/files/${r}/reviewed`,nu(n)),ys("PUT",{...hc(n),path:e,reviewed:t}));await Nn(o)}async setReviewedMany(e,t,n){let r=await fetch(yn("/api/review/files/reviewed",nu(n)),ys("PUT",{...hc(n),paths:e,reviewed:t}));await Nn(r)}async saveReviewThread(e){let t=await fetch(yn(e.id==null?"/api/review/threads":`/api/review/threads/${encodeURIComponent(e.id)}`),e.id==null?ys("POST",{...hc(e.request),anchor:e.anchor,body:e.body}):xye({...hc(e.request),anchor:e.anchor,body:e.body})),n=KS(await Nn(t));if(n==null)throw Error("The saved review comment was malformed.");return n}async updateReviewThread(e,t,n,r){return this.saveReviewThread({id:e,body:t,anchor:n??{kind:"file",path:"unknown"},request:r})}async deleteReviewThread(e,t){let n=await fetch(yn(`/api/review/threads/${encodeURIComponent(e)}`,nu(t)),{method:"DELETE",headers:br({"Content-Type":"application/json"}),body:JSON.stringify(hc(t)),cache:"no-store"});await Nn(n)}async saveReviewDraft(e){let t=await fetch(yn(`/api/review/drafts/${encodeURIComponent(e.id)}`),ys("PUT",{...hc(e.request),id:e.id,anchor:e.anchor,body:e.body})),n=WS(await Nn(t));if(n==null)return{id:e.id,anchor:e.anchor,body:e.body};return n}async deleteReviewDraft(e,t){let n=await fetch(yn(`/api/review/drafts/${encodeURIComponent(e)}`,nu(t)),{method:"DELETE",headers:br({"Content-Type":"application/json"}),body:JSON.stringify(hc(t)),cache:"no-store"});await Nn(n)}async getAgentCapabilities(){let e=await fetch(yn("/api/agents/codex/models"),{headers:br(),cache:"no-store"});return FY(await Nn(e))}async createAgentSession(e){let t=await fetch(yn(`/api/review/threads/${encodeURIComponent(e.threadId)}/agent-sessions`),ys("POST",{...hc(e.request),threadId:e.threadId,model:e.model,effort:e.effort,permissionMode:"read-only"})),n=J_(await Nn(t));if(n==null)throw Error("The Codex session response was malformed.");return n}async createAgentConversation(e){let t=await fetch(yn("/api/agent-conversations"),ys("POST",{...hc(e.request),anchor:e.anchor,prompt:e.prompt,model:e.model,effort:e.effort,fast:e.fast,permissionMode:"read-only"})),n=NY(await Nn(t))[0];if(n==null)throw Error("The Codex conversation response was malformed.");return n}async deleteAgentConversation(e,t){let n=await fetch(yn(`/api/agent-conversations/${encodeURIComponent(e)}`,nu(t)),{method:"DELETE",headers:br({"Content-Type":"application/json"}),body:JSON.stringify(hc(t)),cache:"no-store"});await Nn(n)}async sendAgentMessage(e,t){let n=await fetch(yn(`/api/agent-sessions/${encodeURIComponent(e)}/messages`),ys("POST",{body:t,message:t})),r=await Nn(n);if(!ws(r))return{};return{assistantText:typeof r.assistantText==="string"?r.assistantText:typeof r.text==="string"?r.text:void 0,status:typeof r.status==="string"?r.status:void 0}}async getAgentHistory(e){let t=await fetch(yn(`/api/agent-sessions/${encodeURIComponent(e)}/history`),{headers:br(),cache:"no-store"}),n=await Nn(t);return(ws(n)&&Array.isArray(n.history)?n.history:[]).flatMap((o)=>{if(!ws(o))return[];let c=o.role==="user"?"user":o.role==="assistant"?"assistant":null;if(c==null||typeof o.text!=="string")return[];return[{id:typeof o.id==="string"?o.id:void 0,role:c,text:o.text}]})}subscribeToAgentEvents(e,t){if(typeof window>"u"||typeof EventSource>"u")return{dispose(){}};let n=new EventSource(yn(`/api/agent-sessions/${encodeURIComponent(e)}/events`,nu())),r=(o)=>{try{let c=JSON.parse(o.data),l=Qye(c);if(l!=null)t(l)}catch{}};return n.addEventListener("message",r),n.addEventListener("event",r),n.addEventListener("error",()=>t({type:"error",message:"Codex connection was lost."})),{dispose(){n.close()}}}async stopAgentTurn(e){let t=await fetch(yn(`/api/agent-sessions/${encodeURIComponent(e)}/stop`),ys("POST",{}));await Nn(t)}subscribeToRepositoryChanges(e){if(typeof window>"u"||typeof EventSource>"u")return{dispose(){}};let t=new URLSearchParams,n=RY();if(n!=null)t.set("token",n);let r=new EventSource(yn("/api/events",t));return r.addEventListener("repository",e),r.addEventListener("change",e),{dispose(){r.close()}}}}function jY(){return new MY}function Iye(e){if(e==="added"||e==="deleted"||e==="renamed")return e;return"modified"}function ws(e){return e!=null&&typeof e==="object"&&!Array.isArray(e)}function Qye(e){if(!ws(e)||typeof e.type!=="string")return null;if(e.type==="text_delta"||e.type==="delta"){let t=typeof e.delta==="string"?e.delta:typeof e.text==="string"?e.text:"";return t.length>0?{type:"text_delta",delta:t}:null}if(e.type==="message"||e.type==="assistant_message"){let t=typeof e.text==="string"?e.text:typeof e.body==="string"?e.body:"";return t.length>0?{type:"message",role:"assistant",text:t}:null}if(e.type==="activity"||e.type==="tool")return{type:"activity",label:typeof e.label==="string"?e.label:"Codex activity",detail:typeof e.detail==="string"?e.detail:void 0,status:typeof e.status==="string"?e.status:void 0};if(e.type==="done"||e.type==="completed")return{type:"done",status:typeof e.status==="string"?e.status:void 0};if(e.type==="error")return{type:"error",message:typeof e.message==="string"?e.message:"Codex request failed."};return null}class XS{actions=new Map;set(e){this.actions.set(e.id,e)}run(e){let t=this.actions.get(e);if(t?.enabled===!1)return;t?.run()}get(e){return this.actions.get(e)}list(){return[...this.actions.values()]}}function TY(e){if(!(e instanceof HTMLElement))return!1;return e.isContentEditable||e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.tagName==="SELECT"}function $Y(e){if(e.key==="Escape")return"Escape";let t=e.key.toLowerCase();if(e.metaKey||e.ctrlKey)return`${e.shiftKey?"Mod+Shift+":"Mod+"}${t}`;if(e.shiftKey||e.altKey)return null;return t.length===1?t:null}function Dye(e){if(e==="new")return"added";if(e==="deleted")return"deleted";if(e==="rename-pure"||e==="rename-changed")return"renamed";return"modified"}function Sye(e){return e.hunks.reduce((t,n)=>({additions:t.additions+n.additionLines,deletions:t.deletions+n.deletionLines}),{additions:0,deletions:0})}function Fye(e){if(e==null||typeof e!=="object")return!1;let t=e;return(t.type==="diff"||t.type==="file")&&typeof t.id==="string"}function PY(e){return e.flatMap((t)=>{if(t.type!=="diff")return[];let{additions:n,deletions:r}=Sye(t.fileDiff);return[{id:t.id,path:t.fileDiff.name,previousPath:t.fileDiff.prevName,status:Dye(t.fileDiff.type),additions:n,deletions:r,lines:t.fileDiff.unifiedLineCount}]})}function Lye(e){let t=PY(e);return{files:t.length,additions:t.reduce((n,r)=>n+r.additions,0),deletions:t.reduce((n,r)=>n+r.deletions,0),lines:t.reduce((n,r)=>n+(r.lines??0),0)}}function Rye(e){let t=[],n=new Map,r=$b(e,"reviewme");for(let o of r)for(let c of o.files){let l=c.name||`file-${t.length+1}`,d=n.get(l)??0;n.set(l,d+1);let p=d===0?l:`${l}-${d+1}`;t.push({id:p,type:"diff",fileDiff:c,version:0})}return t}function Nye(e){if(e.items!=null){let t=e.items.filter(Fye);if(t.length>0)return t.slice()}if(typeof e.patch==="string"&&e.patch.length>0)return Rye(e.patch);return[]}function qY(e){let t=Nye(e),n=PY(t),r=e.files??[],o=n.length>0?n:r.slice(),c=Lye(t),l=e.stats==null?c:{files:e.stats.files??c.files,additions:e.stats.additions??c.additions,deletions:e.stats.deletions??c.deletions,lines:e.stats.lines??c.lines};return{items:t,files:o,stats:l}}var Na=jt(cr(),1);function GY(){return{diffStats:{addedLines:0,deletedLines:0,fileCount:0,totalLinesOfCode:0},fileIndex:0,gitStatusByPath:new Map,items:[],lastTreeSource:void 0,nextCollisionSuffixByBase:new Map,pendingGitStatusRemovePaths:new Set,pendingGitStatusSetByPath:new Map,pendingItems:[],pendingItemById:new Map,pathToItemId:new Map,pathStateByTreePath:new Map,paths:[]}}function eF(e,t,n){let{diffStats:r}=e;r.fileCount+=1,r.totalLinesOfCode+=t.unifiedLineCount;for(let f of t.hunks)r.addedLines+=f.additionLines,r.deletedLines+=f.deletionLines;let o=t.name,c=n==null?o:`${n}/${o}`,l=o.length===0?void 0:e.pathStateByTreePath.get(c),d=l==null?void 0:jye(e,c,l),p=e.pathToItemId.has(c)?Tye(e,c):c;e.fileIndex+=1;let A={id:p,type:"diff",fileDiff:t,version:0};if(e.items.push(A),e.pendingItems.push(A),e.pendingItemById.set(p,A),l==null&&o.length>0)e.paths.push(c);return e.pathToItemId.set(c,p),$ye(e,c,t.type,l?.sawDeleted===!0),e.pathStateByTreePath.set(c,{currentItem:A,currentItemId:p,currentType:t.type,sawDeleted:l?.sawDeleted===!0||t.type==="deleted"}),d}function zY(e){let t=e.pendingItems;return e.pendingItems=[],e.pendingItemById.clear(),t}function tF(e){let t=e.lastTreeSource,n=Mye(e),r={gitStatus:Array.from(e.gitStatusByPath.values()),gitStatusPatch:t==null?void 0:n,pathCount:e.paths.length,paths:e.paths,pathToItemId:e.pathToItemId,previousSource:t};return e.lastTreeSource=r,r}function V_(e){return e.flatMap((t)=>{if(t.type!=="diff")return[];let n=t.fileDiff.hunks.reduce((o,c)=>o+c.additionLines,0),r=t.fileDiff.hunks.reduce((o,c)=>o+c.deletionLines,0);return[{id:t.id,path:t.fileDiff.name,previousPath:t.fileDiff.prevName,status:OY(t.fileDiff.type),additions:n,deletions:r,lines:t.fileDiff.unifiedLineCount}]})}function X_(e){return{files:e.fileCount,additions:e.addedLines,deletions:e.deletedLines,lines:e.totalLinesOfCode}}function OY(e){switch(e){case"new":return"added";case"deleted":return"deleted";case"rename-pure":case"rename-changed":return"renamed";default:return"modified"}}function Mye(e){let{pendingGitStatusRemovePaths:t,pendingGitStatusSetByPath:n}=e;if(t.size===0&&n.size===0)return;let r={};if(t.size>0)r.remove=[...t],t.clear();if(n.size>0)r.set=[...n.values()],n.clear();return r}function jye(e,t,n){let r=n.currentItemId,o=n.currentType==="deleted"?"?deleted":"?previous",c=HY(e,`${t}${o}`);n.currentItem.id=c,n.currentItemId=c;let l=e.pendingItemById.get(r);if(l!=null){e.pendingItemById.delete(r),e.pendingItemById.set(c,l);return}return{oldId:r,newId:c}}function Tye(e,t){return HY(e,`${t}?2`)}function HY(e,t){if(!e.items.some((o)=>o.id===t))return t;let n=e.nextCollisionSuffixByBase.get(t)??2,r=`${t}-${n}`;while(e.items.some((o)=>o.id===r))n+=1,r=`${t}-${n}`;return e.nextCollisionSuffixByBase.set(t,n+1),r}function $ye(e,t,n,r){if(r&&n!=="deleted"){if(e.gitStatusByPath.delete(t))qye(e,t);return}let o=OY(n);if(e.gitStatusByPath.get(t)?.status===o)return;let c={path:t,status:o};e.gitStatusByPath.set(t,c),Pye(e,c)}function Pye(e,t){e.pendingGitStatusRemovePaths.delete(t.path),e.pendingGitStatusSetByPath.set(t.path,t)}function qye(e,t){e.pendingGitStatusSetByPath.delete(t),e.pendingGitStatusRemovePaths.add(t)}var UY=/\S/;async function KY(e,t){let n=e.getReader(),r=new TextDecoder,o=Gye();try{for(;;){let p=await n.read();if(p.done)break;if(p.value.byteLength===0)continue;o.push(r.decode(p.value,{stream:!0})),await ZY(o,t)}let c=r.decode();if(c.length>0)o.push(c),await ZY(o,t);let l=o.finish();if(l.fileText!=null)await t(l.fileText);let d;while((d=o.takeAvailableFile())!=null)await t(d);return l.fallbackPatchContent}finally{n.releaseLock()}}async function ZY(e,t){let n;while((n=e.takeAvailableFile())!=null)await t(n)}function Gye(){let e="",t,n=0,r=!1;function o(){if(t==null){if(t=nF(e,n),t==null){n=YY(e,0);return}r=!0,n=t+1}let c=t;if(c==null)return;let l=nF(e,n);if(l==null){n=YY(e,c+1);return}let d=zye(e,c,l),p=e.slice(0,d);return e=e.slice(d),t=nF(e,0),n=t==null?0:t+1,UY.test(p)?p:void 0}return{push(c){e+=c},takeAvailableFile:o,finish(){let c=o();if(c!=null)return{fileText:c};if(!UY.test(e))return e="",{};if(!r){let d=e;return e="",{fallbackPatchContent:d}}let l=e;return e="",{fileText:l}}}}function YY(e,t){return Math.max(t,e.length-11)}function nF(e,t){let n=Math.max(t,0);if(n===0&&e.startsWith("diff --git "))return 0;let r=e.indexOf(`
3054
3054
  diff --git `,n);return r===-1?void 0:r+1}function zye(e,t,n){let r=e.lastIndexOf(`
3055
3055
  From `,n-1);while(r>=t+1){let o=r+1,c=e.indexOf(`